Fix for invalid assert limiting number of vertices to 1000000.

This commit is contained in:
unknown 2012-01-25 11:06:30 +01:00
parent b9269c1778
commit 89522e3590
3 changed files with 11 additions and 8 deletions

View File

@ -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

View File

@ -100,6 +100,11 @@ namespace PolyVox
template <typename VertexType>
void SurfaceMesh<VertexType>::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 <typename VertexType>
void SurfaceMesh<VertexType>::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);

View File

@ -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