diff --git a/library/PolyVoxCore/include/PolyVoxCore/Vector.h b/library/PolyVoxCore/include/PolyVoxCore/Vector.h index cbcdb6e..5aff010 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Vector.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Vector.h @@ -141,7 +141,8 @@ namespace PolyVox private: //Values for the vector - Type m_tElements[Size]; + //Type m_tElements[Size]; + Type* m_tElements; }; //Non-member overloaded operators. diff --git a/library/PolyVoxCore/include/PolyVoxCore/Vector.inl b/library/PolyVoxCore/include/PolyVoxCore/Vector.inl index 347f555..2491336 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Vector.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/Vector.inl @@ -30,7 +30,7 @@ namespace PolyVox \param y y component to set. */ template - Vector::Vector(Type x, Type y) throw() + Vector::Vector(Type x, Type y) throw() : m_tElements(new Type[Size]) { m_tElements[0] = x; m_tElements[1] = y; @@ -44,7 +44,7 @@ namespace PolyVox \param z z component to set. */ template - Vector::Vector(Type x, Type y, Type z) throw() + Vector::Vector(Type x, Type y, Type z) throw() : m_tElements(new Type[Size]) { m_tElements[0] = x; m_tElements[1] = y; @@ -60,7 +60,7 @@ namespace PolyVox \param w w component to set. */ template - Vector::Vector(Type x, Type y, Type z, Type w) throw() + Vector::Vector(Type x, Type y, Type z, Type w) throw() : m_tElements(new Type[Size]) { m_tElements[0] = x; m_tElements[1] = y; @@ -72,7 +72,7 @@ namespace PolyVox Creates a Vector object but does not initialise it. */ template - Vector::Vector(void) throw() + Vector::Vector(void) throw() : m_tElements(new Type[Size]) { } @@ -81,7 +81,7 @@ namespace PolyVox \param vector A reference to the Vector to be copied. */ template - Vector::Vector(const Vector& vector) throw() + Vector::Vector(const Vector& vector) throw() : m_tElements(new Type[Size]) { std::memcpy(m_tElements, vector.m_tElements, sizeof(Type) * Size); } @@ -97,7 +97,7 @@ namespace PolyVox */ template template - Vector::Vector(const Vector& vector) throw() + Vector::Vector(const Vector& vector) throw() : m_tElements(new Type[Size]) { for(uint32_t ct = 0; ct < Size; ++ct) { @@ -111,6 +111,7 @@ namespace PolyVox template Vector::~Vector(void) throw() { + delete[] m_tElements; } /**