Browse Source

math: disable some half-float vectors because of VS2013.

undefined
Sam Hocevar 10 years ago
parent
commit
50ce473fcf
2 changed files with 17 additions and 6 deletions
  1. +6
    -0
      src/lol/math/matrix.h
  2. +11
    -6
      src/lol/math/vector.h

+ 6
- 0
src/lol/math/matrix.h View File

@@ -130,7 +130,9 @@ static_assert(sizeof(i16mat2) == 8, "sizeof(i16mat2) == 8");
static_assert(sizeof(imat2) == 16, "sizeof(imat2) == 16");
static_assert(sizeof(i64mat2) == 32, "sizeof(i64mat2) == 32");

#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS
static_assert(sizeof(f16mat2) == 8, "sizeof(f16mat2) == 8");
#endif
static_assert(sizeof(mat2) == 16, "sizeof(mat2) == 16");
static_assert(sizeof(dmat2) == 32, "sizeof(dmat2) == 32");

@@ -253,7 +255,9 @@ static_assert(sizeof(i16mat3) == 18, "sizeof(i16mat3) == 18");
static_assert(sizeof(imat3) == 36, "sizeof(imat3) == 36");
static_assert(sizeof(i64mat3) == 72, "sizeof(i64mat3) == 72");

#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS
static_assert(sizeof(f16mat3) == 18, "sizeof(f16mat3) == 18");
#endif
static_assert(sizeof(mat3) == 36, "sizeof(mat3) == 36");
static_assert(sizeof(dmat3) == 72, "sizeof(dmat3) == 72");

@@ -423,7 +427,9 @@ static_assert(sizeof(i16mat4) == 32, "sizeof(i16mat4) == 32");
static_assert(sizeof(imat4) == 64, "sizeof(imat4) == 64");
static_assert(sizeof(i64mat4) == 128, "sizeof(i64mat4) == 128");

#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS
static_assert(sizeof(f16mat4) == 32, "sizeof(f16mat4) == 32");
#endif
static_assert(sizeof(mat4) == 64, "sizeof(mat4) == 64");
static_assert(sizeof(dmat4) == 128, "sizeof(dmat4) == 128");



+ 11
- 6
src/lol/math/vector.h View File

@@ -65,11 +65,11 @@ struct vec_t

/* Disable all default constructors and destructors; this object
* is only intended to exist as part of a union. */
#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS
vec_t() = delete;
vec_t(vec_t<T, N, SWIZZLE> const &) = delete;
~vec_t() = delete;

#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS
/* Allow the assignment operator if unrestricted unions are supported. */
inline vec_t<T, N, SWIZZLE>& operator =(vec_t<T, N> that);
{
@@ -83,8 +83,6 @@ struct vec_t
/* Pass by value in case this == &that */
return *this = (vec_t<T,N>)that;
}
#else
vec_t<T, N, SWIZZLE>& operator =(vec_t<T, N, SWIZZLE> that) = delete;
#endif

inline T& operator[](size_t n)
@@ -275,7 +273,9 @@ static_assert(sizeof(i16vec2) == 4, "sizeof(i16vec2) == 4");
static_assert(sizeof(ivec2) == 8, "sizeof(ivec2) == 8");
static_assert(sizeof(i64vec2) == 16, "sizeof(i64vec2) == 16");

#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS
static_assert(sizeof(f16vec2) == 4, "sizeof(f16vec2) == 4");
#endif
static_assert(sizeof(vec2) == 8, "sizeof(vec2) == 8");
static_assert(sizeof(dvec2) == 16, "sizeof(dvec2) == 16");

@@ -512,7 +512,9 @@ static_assert(sizeof(i16vec3) == 6, "sizeof(i16vec3) == 6");
static_assert(sizeof(ivec3) == 12, "sizeof(ivec3) == 12");
static_assert(sizeof(i64vec3) == 24, "sizeof(i64vec3) == 24");

#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS
static_assert(sizeof(f16vec3) == 6, "sizeof(f16vec3) == 6");
#endif
static_assert(sizeof(vec3) == 12, "sizeof(vec3) == 12");
static_assert(sizeof(dvec3) == 24, "sizeof(dvec3) == 24");

@@ -942,7 +944,9 @@ static_assert(sizeof(i16vec4) == 8, "sizeof(i16vec4) == 8");
static_assert(sizeof(ivec4) == 16, "sizeof(ivec4) == 16");
static_assert(sizeof(i64vec4) == 32, "sizeof(i64vec4) == 32");

#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS
static_assert(sizeof(f16vec4) == 8, "sizeof(f16vec4) == 8");
#endif
static_assert(sizeof(vec4) == 16, "sizeof(vec4) == 16");
static_assert(sizeof(dvec4) == 32, "sizeof(dvec4) == 32");

@@ -951,7 +955,8 @@ static_assert(sizeof(dvec4) == 32, "sizeof(dvec4) == 32");
*/

template<typename T, int N, int SWIZZLE>
static inline vec_t<T,N> operator *(T const &val, vec_t<T,N,SWIZZLE> const &a)
static inline typename std::enable_if<SWIZZLE != FULL_SWIZZLE, vec_t<T,N>>::type
operator *(T const &val, vec_t<T,N,SWIZZLE> const &a)
{
vec_t<T,N> ret;
for (int i = 0; i < N; ++i)
@@ -1178,14 +1183,14 @@ public:
}

template<int S = SWIZZLE>
inline typename std::enable_if<S != -1, T const &>::type
inline typename std::enable_if<S != FULL_SWIZZLE, T const &>::type
operator *() const
{
return m_vec[m_pos];
}

template<int S = SWIZZLE>
inline typename std::enable_if<S == -1, T const &>::type
inline typename std::enable_if<S == FULL_SWIZZLE, T const &>::type
operator *() const
{
return m_vec[m_pos];


Loading…
Cancel
Save