diff --git a/library/PolyVoxCore/include/IndexedSurfacePatch.h b/library/PolyVoxCore/include/IndexedSurfacePatch.h index aa1b9a8e..39e01b6b 100644 --- a/library/PolyVoxCore/include/IndexedSurfacePatch.h +++ b/library/PolyVoxCore/include/IndexedSurfacePatch.h @@ -45,7 +45,7 @@ namespace PolyVox uint32_t getNoOfNonUniformTrianges(void) const; uint32_t getNoOfUniformTrianges(void) const; uint32_t getNoOfVertices(void) const; - std::vector& getRawVertexData(void); //FIXME - this shoudl be removed + std::vector& getRawVertexData(void); //FIXME - this should be removed const std::vector& getVertices(void) const; void addTriangle(uint32_t index0, uint32_t index1, uint32_t index2); diff --git a/library/PolyVoxCore/include/SurfaceVertex.h b/library/PolyVoxCore/include/SurfaceVertex.h index bc33d55f..14e06aee 100644 --- a/library/PolyVoxCore/include/SurfaceVertex.h +++ b/library/PolyVoxCore/include/SurfaceVertex.h @@ -48,8 +48,9 @@ namespace PolyVox public: Vector3DFloat position; Vector3DFloat normal; - float material; + float material; //FIXME: This shouldn't be float on CPU? bool m_bIsEdgeVertex; + bool m_bIsMaterialEdgeVertex; }; diff --git a/library/PolyVoxCore/source/IndexedSurfacePatch.cpp b/library/PolyVoxCore/source/IndexedSurfacePatch.cpp index f22055eb..c64354e0 100644 --- a/library/PolyVoxCore/source/IndexedSurfacePatch.cpp +++ b/library/PolyVoxCore/source/IndexedSurfacePatch.cpp @@ -95,6 +95,13 @@ namespace PolyVox m_vecTriangleIndices.push_back(index0); m_vecTriangleIndices.push_back(index1); m_vecTriangleIndices.push_back(index2); + + if((m_vecVertices[index0].material != m_vecVertices[index1].material) || (m_vecVertices[index0].material != m_vecVertices[index2].material)) + { + m_vecVertices[index0].m_bIsMaterialEdgeVertex = true; + m_vecVertices[index1].m_bIsMaterialEdgeVertex = true; + m_vecVertices[index2].m_bIsMaterialEdgeVertex = true; + } } uint32_t IndexedSurfacePatch::addVertex(const SurfaceVertex& vertex) diff --git a/library/PolyVoxCore/source/SurfaceVertex.cpp b/library/PolyVoxCore/source/SurfaceVertex.cpp index 159cdc5f..33c0483a 100644 --- a/library/PolyVoxCore/source/SurfaceVertex.cpp +++ b/library/PolyVoxCore/source/SurfaceVertex.cpp @@ -32,6 +32,7 @@ namespace PolyVox SurfaceVertex::SurfaceVertex(Vector3DFloat positionToSet, float materialToSet) :position(positionToSet) ,material(materialToSet) + ,m_bIsMaterialEdgeVertex(false) { } @@ -40,6 +41,7 @@ namespace PolyVox :position(positionToSet) ,normal(normalToSet) ,material(materialToSet) + ,m_bIsMaterialEdgeVertex(false) { }