|
8 | 8 | #include "nbl/core/declarations.h"
|
9 | 9 |
|
10 | 10 | #include "nbl/asset/ICPUPolygonGeometry.h"
|
| 11 | +#include "nbl/asset/utils/CGeometryManipulator.h" |
11 | 12 | #include "nbl/asset/utils/CQuantNormalCache.h"
|
12 | 13 | #include "nbl/asset/utils/CQuantQuaternionCache.h"
|
13 | 14 |
|
14 | 15 | namespace nbl::asset
|
15 | 16 | {
|
16 | 17 |
|
17 |
| -// TODO: move to its own header! |
18 |
| -class NBL_API2 CGeometryManipulator |
19 |
| -{ |
20 |
| - public: |
21 |
| - static inline void recomputeContentHash(const IGeometry<ICPUBuffer>::SDataView& view) |
22 |
| - { |
23 |
| - if (!view) |
24 |
| - return; |
25 |
| - view.src.buffer->setContentHash(view.src.buffer->computeContentHash()); |
26 |
| - } |
27 |
| - |
28 |
| - static inline IGeometryBase::SAABBStorage computeRange(const IGeometry<ICPUBuffer>::SDataView& view) |
29 |
| - { |
30 |
| - if (!view || !view.composed.isFormatted()) |
31 |
| - return {}; |
32 |
| - auto it = reinterpret_cast<char*>(view.src.buffer->getPointer())+view.src.offset; |
33 |
| - const auto end = it+view.src.actualSize(); |
34 |
| - auto addToAABB = [&](auto& aabb)->void |
35 |
| - { |
36 |
| - using aabb_t = std::remove_reference_t<decltype(aabb)>; |
37 |
| - for (auto i=0; i!=view.getElementCount(); i++) |
38 |
| - { |
39 |
| - typename aabb_t::point_t pt; |
40 |
| - view.decodeElement(i,pt); |
41 |
| - aabb.addPoint(pt); |
42 |
| - } |
43 |
| - }; |
44 |
| - IGeometryBase::SDataViewBase tmp = {}; |
45 |
| - tmp.resetRange(view.composed.rangeFormat); |
46 |
| - tmp.visitAABB(addToAABB); |
47 |
| - return tmp.encodedDataRange; |
48 |
| - } |
49 |
| - |
50 |
| - static inline void recomputeRange(IGeometry<ICPUBuffer>::SDataView& view, const bool deduceRangeFormat=true) |
51 |
| - { |
52 |
| - if (!view || !view.composed.isFormatted()) |
53 |
| - return; |
54 |
| - if (deduceRangeFormat) |
55 |
| - view.composed.rangeFormat = IGeometryBase::getMatchingAABBFormat(view.composed.format); |
56 |
| - view.composed.encodedDataRange = computeRange(view); |
57 |
| - } |
58 |
| -}; |
59 |
| - |
60 | 18 | //! An interface for easy manipulation of polygon geometries.
|
61 | 19 | class NBL_API2 CPolygonGeometryManipulator
|
62 | 20 | {
|
@@ -778,7 +736,5 @@ class CMeshManipulator : public IMeshManipulator
|
778 | 736 | };
|
779 | 737 | #endif
|
780 | 738 |
|
781 |
| -// TODO: Utility in another header for GeometryCollection to compute AABBs, deal with skins (joints), etc. |
782 |
| - |
783 | 739 | } // end namespace nbl::asset
|
784 | 740 | #endif
|
0 commit comments