Added setElements to Vector.

Work on new OpenGL example.
This commit is contained in:
David Williams
2009-03-13 22:10:32 +00:00
parent 0f4a4c0e2b
commit bdea87d6d6
9 changed files with 27233 additions and 34 deletions

View File

@ -65,7 +65,7 @@ namespace PolyVox
///Division and Assignment Operator.
Vector<Size,Type>& operator/=(const Type& rhs) throw();
///Element Access
///Element Access.
Type getElement(uint32 index) const throw();
///Get the x component of the vector.
Type getX(void) const throw();
@ -76,8 +76,14 @@ namespace PolyVox
///Get the w component of the vector.
Type getW(void) const throw();
///Element Access
///Element Access.
void setElement(uint32 index, Type tValue) throw();
///Element Access.
void setElements(Type x, Type y) throw();
///Element Access.
void setElements(Type x, Type y, Type z) throw();
///Element Access.
void setElements(Type x, Type y, Type z, Type w) throw();
///Set the x component of the vector.
void setX(Type tX) throw();
///Set the y component of the vector.

View File

@ -397,6 +397,50 @@ namespace PolyVox
m_tElements[index] = tValue;
}
/**
Sets several elements of a vector at once.
\param x x component to set.
\param y y component to set.
*/
template <uint32 Size,typename Type>
inline void Vector<Size,Type>::setElements(Type x, Type y) throw()
{
m_tElements[0] = x;
m_tElements[1] = y;
}
/**
Sets several elements of a vector at once.
\param x x component to set.
\param y y component to set.
\param z z component to set.
*/
template <uint32 Size,typename Type>
inline void Vector<Size,Type>::setElements(Type x, Type y, Type z) throw()
{
m_tElements[0] = x;
m_tElements[1] = y;
m_tElements[2] = z;
}
/**
Sets several elements of a vector at once.
\param x x component to set.
\param y y component to set.
\param z z component to set.
\param w w component to set.
*/
template <uint32 Size,typename Type>
inline void Vector<Size,Type>::setElements(Type x, Type y, Type z, Type w) throw()
{
m_tElements[0] = x;
m_tElements[1] = y;
m_tElements[2] = z;
m_tElements[3] = w;
}
/**
\param tX The new value for the X component of a 1, 2, 3, or 4 dimensional Vector.
*/