diff --git a/src/lol/math/vector.h b/src/lol/math/vector.h index 3bdace44..0206141d 100644 --- a/src/lol/math/vector.h +++ b/src/lol/math/vector.h @@ -94,7 +94,13 @@ template struct XVec4 inline T& operator[](int n) { return *(&this->x + n); } \ inline T const& operator[](int n) const { return *(&this->x + n); } \ \ - void printf() const; \ + /* Visual Studio insists on having an assignment operator. */ \ + inline tname const & operator =(tname const &that) \ + { \ + for (size_t n = 0; n < sizeof(*this) / sizeof(T); n++) \ + (*this)[n] = that[n]; \ + return *this; \ + } \ \ template \ inline operator tname() const \ @@ -103,7 +109,9 @@ template struct XVec4 for (size_t n = 0; n < sizeof(*this) / sizeof(T); n++) \ ret[n] = static_cast((*this)[n]); \ return ret; \ - } + } \ + \ + void printf() const; /* * 2-element vectors diff --git a/src/vector.cpp b/src/vector.cpp index 9b8cc1c5..2b67f0da 100644 --- a/src/vector.cpp +++ b/src/vector.cpp @@ -312,7 +312,7 @@ template<> quat::Quat(mat4 const &m) } else if (m[0][0] > m[1][1] && m[0][0] > m[2][2]) { - x = 0.5f * sqrt(1.0f + m[0][0] - m[1][1] - m[2][2]); + x = 0.5f * sqrtf(1.0f + m[0][0] - m[1][1] - m[2][2]); float s = 0.25f / x; y = s * (m[1][0] + m[0][1]); z = s * (m[0][2] + m[2][0]);