Skip to content

Commit 2c9b860

Browse files
author
devsh
committed
start removing unnecessary things from PolygonGeometryManipulator
1 parent 40a8df3 commit 2c9b860

File tree

3 files changed

+28
-52
lines changed

3 files changed

+28
-52
lines changed

include/nbl/asset/ICPUPolygonGeometry.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,29 @@ class NBL_API2 ICPUPolygonGeometry final : public IAsset, public IPolygonGeometr
151151
return nullptr;
152152
}
153153

154+
//
155+
template<typename Out, typename Index=uint32_t> requires (hlsl::concepts::UnsignedIntegralScalar<Out> && hlsl::concepts::UnsignedIntegralScalar<Index>)
156+
inline bool getPrimitiveIndices(Out* out, const Index primitiveID) const
157+
{
158+
// TODO: rename `m_verticesForFirst` to `m_verticesPerPrimitive` or `m_degree`
159+
for (auto i=0; i<m_verticesForFirst; i++)
160+
{
161+
assert(false);
162+
indexID = 0xdeadbeefBADC0FFEull; // TODO: need a callback for index mapping
163+
if (m_indexView)
164+
{
165+
hlsl::vector<Uint,1> tmp;
166+
if (!m_indexView.decodeElement<decltype(tmp),Index>(indexID,tmp));
167+
return false;
168+
*out = tmp[0];
169+
}
170+
else
171+
*out = indexID;
172+
out++;
173+
}
174+
return true;
175+
}
176+
154177
protected:
155178
//
156179
inline void visitDependents(std::function<bool(const IAsset*)> visit) const //override

include/nbl/asset/asset.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252

5353
// geometry
5454
#include "nbl/asset/utils/IGeometryCreator.h"
55-
#include "nbl/asset/utils/ICPUGeometryCollection.h"
56-
#include "nbl/asset/utils/ICPUMorphTargets.h"
55+
#include "nbl/asset/ICPUGeometryCollection.h"
56+
#include "nbl/asset/ICPUMorphTargets.h"
5757

5858
// manipulation + reflection + introspection
5959
#include "nbl/asset/utils/CSmoothNormalGenerator.h"

include/nbl/asset/utils/CPolygonGeometryManipulator.h

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Copyright (C) 2018-2025 - DevSH Graphics Programming Sp. z O.O.
22
// This file is part of the "Nabla Engine".
33
// For conditions of distribution and use, see copyright notice in nabla.h
4-
#ifndef _NBL_ASSET_I_POLYGON_GEOMETRY_MANIPULATOR_H_INCLUDED_
5-
#define _NBL_ASSET_I_POLYGON_GEOMETRY_MANIPULATOR_H_INCLUDED_
4+
#ifndef _NBL_ASSET_C_POLYGON_GEOMETRY_MANIPULATOR_H_INCLUDED_
5+
#define _NBL_ASSET_C_POLYGON_GEOMETRY_MANIPULATOR_H_INCLUDED_
66

77

88
#include "nbl/core/declarations.h"
@@ -17,7 +17,6 @@ namespace nbl::asset
1717
class NBL_API2 CPolygonGeometryManipulator
1818
{
1919
public:
20-
#if 0 // TODO: REDO
2120
//! Comparison methods
2221
enum E_ERROR_METRIC
2322
{
@@ -36,6 +35,7 @@ class NBL_API2 CPolygonGeometryManipulator
3635
EEM_QUATERNION,
3736
EEM_COUNT
3837
};
38+
#if 0 // TODO: REDO
3939
//! Struct used to pass chosen comparison method and epsilon to functions performing error metrics.
4040
/**
4141
By default epsilon equals 2^-16 and EEM_POSITIONS comparison method is set.
@@ -186,53 +186,6 @@ class NBL_API2 CPolygonGeometryManipulator
186186
*/
187187
static core::smart_refctd_ptr<ICPUBuffer> idxBufferFromTrianglesFanToTriangles(const void* _input, uint32_t& _idxCount, E_INDEX_TYPE _inIndexType, E_INDEX_TYPE _outIndexType);
188188

189-
//! Get amount of polygons in mesh buffer.
190-
/** \param meshbuffer Input mesh buffer
191-
\param Outputted Number of polygons in mesh buffer, if successful.
192-
\return If successfully can provide information */
193-
template<typename ...MeshbufTemplParams>
194-
static inline bool getPolyCount(uint32_t& outCount, const IMeshBuffer<MeshbufTemplParams...>* meshbuffer)
195-
{
196-
outCount = 0;
197-
if (!meshbuffer)
198-
return false;
199-
if (!meshbuffer->getPipeline())
200-
return false;
201-
202-
const auto& assemblyParams = meshbuffer->getPipeline()->getCachedCreationParams().primitiveAssembly;
203-
const E_PRIMITIVE_TOPOLOGY primType = assemblyParams.primitiveType;
204-
switch (primType)
205-
{
206-
case EPT_POINT_LIST:
207-
outCount = meshbuffer->getIndexCount();
208-
break;
209-
case EPT_LINE_STRIP:
210-
outCount = meshbuffer->getIndexCount() - 1;
211-
break;
212-
case EPT_LINE_LIST:
213-
outCount = meshbuffer->getIndexCount() / 2;
214-
break;
215-
case EPT_TRIANGLE_STRIP:
216-
outCount = meshbuffer->getIndexCount() - 2;
217-
break;
218-
case EPT_TRIANGLE_FAN:
219-
outCount = meshbuffer->getIndexCount() - 2;
220-
break;
221-
case EPT_TRIANGLE_LIST:
222-
outCount = meshbuffer->getIndexCount() / 3;
223-
break;
224-
case EPT_PATCH_LIST:
225-
outCount = meshbuffer->getIndexCount() / assemblyParams.tessPatchVertCount;
226-
break;
227-
default:
228-
assert(false); // need to implement calculation for more types
229-
return false;
230-
break;
231-
}
232-
233-
return true;
234-
}
235-
236189
//!
237190
static inline std::array<uint32_t,3u> getTriangleIndices(const ICPUMeshBuffer* mb, uint32_t triangleIx)
238191
{

0 commit comments

Comments
 (0)