diff --git a/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl b/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl index 456be614..a5469ff2 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SurfaceExtractor.inl @@ -613,13 +613,6 @@ namespace PolyVox if((ind0 != -1) && (ind1 != -1) && (ind2 != -1)) { - assert(ind0 >= 0); - assert(ind1 >= 0); - assert(ind2 >= 0); - - assert(ind0 < 1000000); - assert(ind1 < 1000000); - assert(ind2 < 1000000); m_meshCurrent->addTriangle(ind0, ind1, ind2); } }//For each triangle diff --git a/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.inl b/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.inl index f21ad6b0..5c4d0bc8 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.inl @@ -100,6 +100,11 @@ namespace PolyVox template void SurfaceMesh::addTriangle(uint32_t index0, uint32_t index1, uint32_t index2) { + //Make sure the specified indices correspond to valid vertices. + assert(index0 < m_vecVertices.size()); + assert(index1 < m_vecVertices.size()); + assert(index2 < m_vecVertices.size()); + m_vecTriangleIndices.push_back(index0); m_vecTriangleIndices.push_back(index1); m_vecTriangleIndices.push_back(index2); @@ -108,6 +113,11 @@ namespace PolyVox template void SurfaceMesh::addTriangleCubic(uint32_t index0, uint32_t index1, uint32_t index2) { + //Make sure the specified indices correspond to valid vertices. + assert(index0 < m_vecVertices.size()); + assert(index1 < m_vecVertices.size()); + assert(index2 < m_vecVertices.size()); + m_vecTriangleIndices.push_back(index0); m_vecTriangleIndices.push_back(index1); m_vecTriangleIndices.push_back(index2); diff --git a/library/PolyVoxCore/include/PolyVoxCore/Voxel.h b/library/PolyVoxCore/include/PolyVoxCore/Voxel.h index 6474d71d..48cfbb35 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Voxel.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Voxel.h @@ -60,7 +60,7 @@ namespace PolyVox // depend ont the type (float has a very different range from int8_t for example). // // The properties are currently exposed as constants because we need access to them at compile time. Ideally we would like to make them - // functions flagged with 'constexpr' as we could then make use of the max() and min() functions in std::numric_limits, but this is not + // functions flagged with 'constexpr' as we could then make use of the max() and min() functions in std::numeric_limits, but this is not // widely supported by compilers yet. We may change this in the future. // // Syntax for templatised traits classes: http://stackoverflow.com/q/8606302/849083