From e820b3de6e20ee8efe092b1aa351563862ec42b8 Mon Sep 17 00:00:00 2001 From: David Williams Date: Sat, 24 Oct 2009 18:48:52 +0000 Subject: [PATCH] Improvements to the way blending between materials is handled. --- library/PolyVoxCore/include/IndexedSurfacePatch.h | 5 +++++ library/PolyVoxCore/source/IndexedSurfacePatch.cpp | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/library/PolyVoxCore/include/IndexedSurfacePatch.h b/library/PolyVoxCore/include/IndexedSurfacePatch.h index 49eece04..6be505a2 100644 --- a/library/PolyVoxCore/include/IndexedSurfacePatch.h +++ b/library/PolyVoxCore/include/IndexedSurfacePatch.h @@ -85,6 +85,11 @@ namespace PolyVox std::vector m_vecVertices; std::vector m_vecLodRecords; + + //The set of materials which are in this mesh. Only those materials + //which cover a whole triangle are counted. Materials which only + //exist on a material boundary do not count. + std::set m_mapUsedMaterials; }; } diff --git a/library/PolyVoxCore/source/IndexedSurfacePatch.cpp b/library/PolyVoxCore/source/IndexedSurfacePatch.cpp index 91fa4930..72bcdec3 100644 --- a/library/PolyVoxCore/source/IndexedSurfacePatch.cpp +++ b/library/PolyVoxCore/source/IndexedSurfacePatch.cpp @@ -98,7 +98,11 @@ namespace PolyVox 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)) + if((m_vecVertices[index0].material == m_vecVertices[index1].material) && (m_vecVertices[index0].material == m_vecVertices[index2].material)) + { + m_mapUsedMaterials.insert(m_vecVertices[index0].material); + } + else { m_vecVertices[index0].m_bIsMaterialEdgeVertex = true; m_vecVertices[index1].m_bIsMaterialEdgeVertex = true;