diff --git a/include/IndexedSurfacePatch.h b/include/IndexedSurfacePatch.h index 1a448872..eeb8ac69 100644 --- a/include/IndexedSurfacePatch.h +++ b/include/IndexedSurfacePatch.h @@ -47,6 +47,7 @@ namespace PolyVox const std::vector& getIndices(void) const; unsigned short getNoNonUniformTrianges(void); + unsigned short getNoUniformTrianges(void); public: std::vector m_vecTriangleIndices; diff --git a/source/IndexedSurfacePatch.cpp b/source/IndexedSurfacePatch.cpp index b3a72163..784856f9 100644 --- a/source/IndexedSurfacePatch.cpp +++ b/source/IndexedSurfacePatch.cpp @@ -216,4 +216,18 @@ namespace PolyVox } return result; } + + unsigned short IndexedSurfacePatch::getNoUniformTrianges(void) + { + unsigned short result = 0; + for(int i = 0; i < m_vecTriangleIndices.size() - 2; i += 3) + { + if((m_vecVertices[m_vecTriangleIndices[i]].getMaterial() == m_vecVertices[m_vecTriangleIndices[i+1]].getMaterial()) + && (m_vecVertices[m_vecTriangleIndices[i]].getMaterial() == m_vecVertices[m_vecTriangleIndices[i+2]].getMaterial())) + { + result++; + } + } + return result; + } }