Small changes for debugging Cubiquity.

This commit is contained in:
David Williams 2013-07-27 15:02:16 +02:00
parent aab1149e8f
commit a10fcf8ecc
2 changed files with 11 additions and 1 deletions

View File

@ -117,4 +117,11 @@ freely, subject to the following restrictions:
#define polyvox_shared_ptr boost::shared_ptr #define polyvox_shared_ptr boost::shared_ptr
#endif #endif
//#define USE_LARGE_VOLUME
#ifdef USE_LARGE_VOLUME
#define POLYVOX_VOLUME LargeVolume
#else
#define POLYVOX_VOLUME SimpleVolume
#endif
#endif #endif

View File

@ -653,7 +653,10 @@ namespace PolyVox
inline void Vector<Size, StorageType, OperationType>::normalise(void) inline void Vector<Size, StorageType, OperationType>::normalise(void)
{ {
float fLength = this->length(); float fLength = this->length();
if(fLength <= 0.0)
// We could wait until the NAN occurs before throwing, but then we'd have to add some roll-back code.
// This seems like a lot of overhead for a common operation which should rarely go wrong.
if(fLength <= 0.0001)
{ {
POLYVOX_THROW(invalid_operation, "Cannot normalise a vector with a length of zero"); POLYVOX_THROW(invalid_operation, "Cannot normalise a vector with a length of zero");
} }