Bladeren bron

Fixed swizzle error with C++ 98

Christophe Riccio 7 jaren geleden
bovenliggende
commit
c7822ff6ff
3 gewijzigde bestanden met toevoegingen van 11 en 12 verwijderingen
  1. 6 6
      glm/detail/_swizzle.hpp
  2. 2 3
      glm/detail/func_matrix_simd.inl
  3. 3 3
      glm/detail/setup.hpp

+ 6 - 6
glm/detail/_swizzle.hpp

@@ -64,7 +64,7 @@ namespace detail
 		GLM_FUNC_QUALIFIER _swizzle_base2& operator= (vec<N, T, Q> const& that)
 		{
 			struct op {
-				GLM_FUNC_QUALIFIER void operator() (T& e, T& t) { e = t; }
+				GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e = t; }
 			};
 			_apply_op(that, op());
 			return *this;
@@ -73,7 +73,7 @@ namespace detail
 		GLM_FUNC_QUALIFIER void operator -= (vec<N, T, Q> const& that)
 		{
 			struct op {
-				GLM_FUNC_QUALIFIER void operator() (T& e, T& t) { e -= t; }
+				GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e -= t; }
 			};
 			_apply_op(that, op());
 		}
@@ -81,7 +81,7 @@ namespace detail
 		GLM_FUNC_QUALIFIER void operator += (vec<N, T, Q> const& that)
 		{
 			struct op {
-				GLM_FUNC_QUALIFIER void operator() (T& e, T& t) { e += t; }
+				GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e += t; }
 			};
 			_apply_op(that, op());
 		}
@@ -89,7 +89,7 @@ namespace detail
 		GLM_FUNC_QUALIFIER void operator *= (vec<N, T, Q> const& that)
 		{
 			struct op {
-				GLM_FUNC_QUALIFIER void operator() (T& e, T& t) { e *= t; }
+				GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e *= t; }
 			};
 			_apply_op(that, op());
 		}
@@ -97,7 +97,7 @@ namespace detail
 		GLM_FUNC_QUALIFIER void operator /= (vec<N, T, Q> const& that)
 		{
 			struct op {
-				GLM_FUNC_QUALIFIER void operator() (T& e, T& t) { e /= t; }
+				GLM_FUNC_QUALIFIER void operator() (T& e, T& t) const{ e /= t; }
 			};
 			_apply_op(that, op());
 		}
@@ -115,7 +115,7 @@ namespace detail
 
 	protected:
 		template<typename U>
-		GLM_FUNC_QUALIFIER void _apply_op(vec<N, T, Q> const& that, U op)
+		GLM_FUNC_QUALIFIER void _apply_op(vec<N, T, Q> const& that, const U& op)
 		{
 			// Make a copy of the data in this == &that.
 			// The copier should optimize out the copy in cases where the function is

+ 2 - 3
glm/detail/func_matrix_simd.inl

@@ -1,6 +1,3 @@
-/// @ref core
-/// @file glm/detail/func_matrix_simd.inl
-
 #if GLM_ARCH & GLM_ARCH_SSE2_BIT
 
 #include "type_mat4x4.hpp"
@@ -11,6 +8,7 @@
 namespace glm{
 namespace detail
 {
+#	if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE
 	template<qualifier Q>
 	struct compute_matrixCompMult<4, 4, float, Q, true>
 	{
@@ -26,6 +24,7 @@ namespace detail
 			return Result;
 		}
 	};
+#	endif
 
 	template<qualifier Q>
 	struct compute_transpose<4, 4, float, Q, true>

+ 3 - 3
glm/detail/setup.hpp

@@ -403,7 +403,7 @@
 #elif GLM_COMPILER & GLM_COMPILER_VC
 #	define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1]
 #else
-#	define GLM_STATIC_ASSERT(x, message)
+#	define GLM_STATIC_ASSERT(x, message) assert(x)
 #endif//GLM_LANG
 
 ///////////////////////////////////////////////////////////////////////////////////
@@ -448,7 +448,7 @@
 #define GLM_SWIZZLE_OPERATOR		1
 #define GLM_SWIZZLE_FUNCTION		2
 
-#if defined(GLM_FORCE_SWIZZLE) && !defined(GLM_FORCE_XYZW_ONLY) && (GLM_LANG & GLM_LANG_CXXMS_FLAG)
+#if defined(GLM_FORCE_SWIZZLE) && !defined(GLM_FORCE_XYZW_ONLY) && (GLM_LANG & GLM_LANG_CXX11_FLAG) && (GLM_LANG & GLM_LANG_CXXMS_FLAG)
 #	define GLM_CONFIG_SWIZZLE GLM_SWIZZLE_OPERATOR
 #elif defined(GLM_FORCE_SWIZZLE) && !defined(GLM_FORCE_XYZW_ONLY)
 #	define GLM_CONFIG_SWIZZLE GLM_SWIZZLE_FUNCTION
@@ -755,7 +755,7 @@ namespace detail
 ///////////////////////////////////////////////////////////////////////////////////
 // Use SIMD instruction sets
 
-#if (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (GLM_ARCH & GLM_ARCH_SIMD_BIT)
+#if GLM_HAS_ALIGNOF && (GLM_LANG & GLM_LANG_CXXMS_FLAG) && (GLM_ARCH & GLM_ARCH_SIMD_BIT)
 #	define GLM_CONFIG_SIMD GLM_ENABLE
 #else
 #	define GLM_CONFIG_SIMD GLM_DISABLE