Now using new assert in Vector.
This commit is contained in:
		| @@ -21,6 +21,8 @@ freely, subject to the following restrictions: | |||||||
|     distribution. 	 |     distribution. 	 | ||||||
| *******************************************************************************/ | *******************************************************************************/ | ||||||
|  |  | ||||||
|  | #include <cassert> | ||||||
|  |  | ||||||
| namespace PolyVox | namespace PolyVox | ||||||
| { | { | ||||||
| 	template <typename VertexType> | 	template <typename VertexType> | ||||||
|   | |||||||
| @@ -24,11 +24,11 @@ freely, subject to the following restrictions: | |||||||
| #ifndef __PolyVox_Vector_H__ | #ifndef __PolyVox_Vector_H__ | ||||||
| #define __PolyVox_Vector_H__ | #define __PolyVox_Vector_H__ | ||||||
|  |  | ||||||
|  | #include "Impl/ErrorHandling.h" | ||||||
| #include "Impl/TypeDef.h" | #include "Impl/TypeDef.h" | ||||||
|  |  | ||||||
| #include "PolyVoxForwardDeclarations.h" | #include "PolyVoxForwardDeclarations.h" | ||||||
|  |  | ||||||
| #include <cassert> |  | ||||||
| #include <cmath> | #include <cmath> | ||||||
| #include <cstring> | #include <cstring> | ||||||
| #include <iostream> | #include <iostream> | ||||||
|   | |||||||
| @@ -414,7 +414,7 @@ namespace PolyVox | |||||||
| 	template <uint32_t Size, typename StorageType, typename OperationType> | 	template <uint32_t Size, typename StorageType, typename OperationType> | ||||||
| 	inline StorageType Vector<Size, StorageType, OperationType>::getElement(uint32_t index) const | 	inline StorageType Vector<Size, StorageType, OperationType>::getElement(uint32_t index) const | ||||||
| 	{ | 	{ | ||||||
| 		assert(index < Size); | 		POLYVOX_ASSERT(index < Size, "Attempted to access invalid vector element."); | ||||||
| 		return m_tElements[index]; | 		return m_tElements[index]; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -465,7 +465,7 @@ namespace PolyVox | |||||||
| 	template <uint32_t Size, typename StorageType, typename OperationType> | 	template <uint32_t Size, typename StorageType, typename OperationType> | ||||||
| 	inline void Vector<Size, StorageType, OperationType>::setElement(uint32_t index, StorageType tValue) | 	inline void Vector<Size, StorageType, OperationType>::setElement(uint32_t index, StorageType tValue) | ||||||
| 	{ | 	{ | ||||||
| 		assert(index < Size); | 		POLYVOX_ASSERT(index < Size, "Attempted to access invalid vector element."); | ||||||
| 		m_tElements[index] = tValue; | 		m_tElements[index] = tValue; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -649,7 +649,7 @@ namespace PolyVox | |||||||
| 		{ | 		{ | ||||||
| 			// Standard float rules apply for divide-by-zero | 			// Standard float rules apply for divide-by-zero | ||||||
| 			m_tElements[ct] /= fLength; | 			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 | }//namespace PolyVox | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user