Browse Source

math: minor compilation fixes for Visual Studio. Still does not link.

legacy
Sam Hocevar gary 13 years ago
parent
commit
6951578bb7
2 changed files with 11 additions and 3 deletions
  1. +10
    -2
      src/lol/math/vector.h
  2. +1
    -1
      src/vector.cpp

+ 10
- 2
src/lol/math/vector.h View File

@@ -94,7 +94,13 @@ template<typename T, int N> 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<T> const & operator =(tname<T> const &that) \
{ \
for (size_t n = 0; n < sizeof(*this) / sizeof(T); n++) \
(*this)[n] = that[n]; \
return *this; \
} \
\
template<typename U> \
inline operator tname<U>() const \
@@ -103,7 +109,9 @@ template<typename T, int N> struct XVec4
for (size_t n = 0; n < sizeof(*this) / sizeof(T); n++) \
ret[n] = static_cast<U>((*this)[n]); \
return ret; \
}
} \
\
void printf() const;

/*
* 2-element vectors


+ 1
- 1
src/vector.cpp View File

@@ -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]);


Loading…
Cancel
Save