24 #ifndef __PolyVox_MeshDecimator_H__
25 #define __PolyVox_MeshDecimator_H__
69 template <
typename VertexType>
76 RFF_ON_REGION_FACE_NEG_X,
77 RFF_ON_REGION_FACE_POS_X ,
78 RFF_ON_REGION_FACE_NEG_Y ,
79 RFF_ON_REGION_FACE_POS_Y ,
80 RFF_ON_REGION_FACE_NEG_Z ,
81 RFF_ON_REGION_FACE_POS_Z,
82 RFF_NO_OF_REGION_FACE_FLAGS
87 struct InitialVertexMetadata
90 bool isOnMaterialEdge;
91 std::bitset<RFF_NO_OF_REGION_FACE_FLAGS> isOnRegionFace;
118 bool operator==(
const IntVertex& rhs)
const
120 return (x == rhs.x) && (y == rhs.y) && (z == rhs.z);
123 bool operator<(
const IntVertex& rhs)
const
153 void fillInitialVertexMetadata(std::vector<InitialVertexMetadata>& vecInitialVertexMetadata);
155 void buildConnectivityData(
void);
157 bool attemptEdgeCollapse(uint32_t uSrc, uint32_t uDst);
162 uint32_t performDecimationPass(
float m_fMinDotProductForCollapse);
163 bool isSubset(std::bitset<RFF_NO_OF_REGION_FACE_FLAGS> a, std::bitset<RFF_NO_OF_REGION_FACE_FLAGS> b);
165 bool canCollapseEdge(uint32_t uSrc, uint32_t uDst);
166 bool canCollapseNormalEdge(uint32_t uSrc, uint32_t uDst);
167 bool canCollapseRegionEdge(uint32_t uSrc, uint32_t uDst);
168 bool canCollapseMaterialEdge(uint32_t uSrc, uint32_t uDst);
169 bool collapseChangesFaceNormals(uint32_t uSrc, uint32_t uDst,
float fThreshold);
173 std::vector<bool> vertexLocked;
174 std::vector<uint32_t> vertexMapper;
176 std::vector<Triangle> m_vecTriangles;
177 std::vector< std::vector<uint32_t> > trianglesUsingVertex;
179 std::vector<InitialVertexMetadata> m_vecInitialVertexMetadata;
181 float m_fMinDotProductForCollapse;
187 #endif //__PolyVox_MeshDecimator_H__