Simplyfing and improving updatePolyVoxGeometry()

This commit is contained in:
David Williams 2008-03-30 22:05:18 +00:00
parent f060898986
commit 5791919f01
2 changed files with 22 additions and 0 deletions

View File

@ -40,6 +40,8 @@ namespace PolyVox
Vector<Size,Type>& operator=(const Vector<Size,Type>& rhs) throw(); Vector<Size,Type>& operator=(const Vector<Size,Type>& rhs) throw();
///Equality Operator. ///Equality Operator.
bool operator==(const Vector<Size,Type>& rhs) const throw(); bool operator==(const Vector<Size,Type>& rhs) const throw();
///Comparison Operator.
bool operator<(const Vector<Size,Type>& rhs) const throw();
///Addition and Assignment Operator. ///Addition and Assignment Operator.
Vector<Size,Type>& operator+=(const Vector<Size,Type> &rhs) throw(); Vector<Size,Type>& operator+=(const Vector<Size,Type> &rhs) throw();
///Subtraction and Assignment Operator. ///Subtraction and Assignment Operator.

View File

@ -155,6 +155,26 @@ namespace PolyVox
return equal; return equal;
} }
/**
Checks whether this vector is less than the parameter. The metric is
meaningless but it allows Vectors to me used as key in sdt::map, etc.
\param rhs The Vector to compare to.
\return true if this is less than the parameter
\see operator!=
*/
template <boost::uint32_t Size, typename Type>
inline bool Vector<Size, Type>::operator<(const Vector<Size, Type> &rhs) const throw()
{
for(int ct = 0; ct < Size; ++ct)
{
if (m_tElements[ct] < rhs.m_tElements[ct])
return true;
if (rhs.m_tElements[ct] < m_tElements[ct])
return false;
}
return false;
}
/** /**
Subtraction operator subtracts corresponding elements of one Vector from the other. Subtraction operator subtracts corresponding elements of one Vector from the other.
\param rhs Vector to subtract \param rhs Vector to subtract