From a3cb8f7a766dc637c71cf5316a9d6fa3082396ce Mon Sep 17 00:00:00 2001 From: David Williams Date: Wed, 26 Dec 2012 15:02:03 +0000 Subject: [PATCH] Now using new assert in Vector. --- library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.inl | 2 ++ library/PolyVoxCore/include/PolyVoxCore/Vector.h | 2 +- library/PolyVoxCore/include/PolyVoxCore/Vector.inl | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.inl b/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.inl index 45d24ada..1b9f2bd0 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SurfaceMesh.inl @@ -21,6 +21,8 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ +#include + namespace PolyVox { template diff --git a/library/PolyVoxCore/include/PolyVoxCore/Vector.h b/library/PolyVoxCore/include/PolyVoxCore/Vector.h index 12c3c201..db3da0f8 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Vector.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Vector.h @@ -24,11 +24,11 @@ freely, subject to the following restrictions: #ifndef __PolyVox_Vector_H__ #define __PolyVox_Vector_H__ +#include "Impl/ErrorHandling.h" #include "Impl/TypeDef.h" #include "PolyVoxForwardDeclarations.h" -#include #include #include #include diff --git a/library/PolyVoxCore/include/PolyVoxCore/Vector.inl b/library/PolyVoxCore/include/PolyVoxCore/Vector.inl index 22d3009e..65b5eba7 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Vector.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/Vector.inl @@ -414,7 +414,7 @@ namespace PolyVox template inline StorageType Vector::getElement(uint32_t index) const { - assert(index < Size); + POLYVOX_ASSERT(index < Size, "Attempted to access invalid vector element."); return m_tElements[index]; } @@ -465,7 +465,7 @@ namespace PolyVox template inline void Vector::setElement(uint32_t index, StorageType tValue) { - assert(index < Size); + POLYVOX_ASSERT(index < Size, "Attempted to access invalid vector element."); m_tElements[index] = tValue; } @@ -649,7 +649,7 @@ namespace PolyVox { // Standard float rules apply for divide-by-zero m_tElements[ct] /= fLength; - assert(m_tElements[ct] == m_tElements[ct]); //Will assert if NAN + POLYVOX_ASSERT(m_tElements[ct] == m_tElements[ct], "Obtained NAN during vector normalisation. Perhaps the input vector was too short?"); } } }//namespace PolyVox