Browse Source

Wrap tvec3's static constants in GLM_STATIC_CONST_MEMBERS

- Fixed the indentation, too
Jesse Talavera-Greenberg 10 years ago
parent
commit
8be318970c
3 changed files with 21 additions and 16 deletions
  1. 2 0
      glm/detail/type_vec3.hpp
  2. 18 16
      glm/detail/type_vec3.inl
  3. 1 0
      test/core/core_type_vec3.cpp

+ 2 - 0
glm/detail/type_vec3.hpp

@@ -58,6 +58,7 @@ namespace glm
 			static GLM_RELAXED_CONSTEXPR precision prec = P;
 #		endif//GLM_META_PROG_HELPERS
 
+#		ifdef GLM_STATIC_CONST_MEMBERS
 		static const type ZERO;
 		static const type X;
 		static const type Y;
@@ -66,6 +67,7 @@ namespace glm
 		static const type XZ;
 		static const type YZ;
 		static const type XYZ;
+#		endif
 
 		// -- Data --
 

+ 18 - 16
glm/detail/type_vec3.inl

@@ -32,30 +32,32 @@
 
 namespace glm
 {
-template <typename T, precision P>
-const tvec3<T, P> tvec3<T, P>::ZERO = tvec3<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
 
-template <typename T, precision P>
-const tvec3<T, P> tvec3<T, P>::X = tvec3<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
+#	ifdef GLM_STATIC_CONST_MEMBERS
+	template <typename T, precision P>
+	const tvec3<T, P> tvec3<T, P>::ZERO = tvec3<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
 
-template <typename T, precision P>
-const tvec3<T, P> tvec3<T, P>::Y = tvec3<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
+	template <typename T, precision P>
+	const tvec3<T, P> tvec3<T, P>::X = tvec3<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
 
-template <typename T, precision P>
-const tvec3<T, P> tvec3<T, P>::Z = tvec3<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
+	template <typename T, precision P>
+	const tvec3<T, P> tvec3<T, P>::Y = tvec3<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
 
-template <typename T, precision P>
-const tvec3<T, P> tvec3<T, P>::XY = tvec3<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
+	template <typename T, precision P>
+	const tvec3<T, P> tvec3<T, P>::Z = tvec3<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
 
-template <typename T, precision P>
-const tvec3<T, P> tvec3<T, P>::XZ = tvec3<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
+	template <typename T, precision P>
+	const tvec3<T, P> tvec3<T, P>::XY = tvec3<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
 
-template <typename T, precision P>
-const tvec3<T, P> tvec3<T, P>::YZ = tvec3<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
+	template <typename T, precision P>
+	const tvec3<T, P> tvec3<T, P>::XZ = tvec3<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
 
-template <typename T, precision P>
-const tvec3<T, P> tvec3<T, P>::XYZ = tvec3<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
+	template <typename T, precision P>
+	const tvec3<T, P> tvec3<T, P>::YZ = tvec3<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
 
+	template <typename T, precision P>
+	const tvec3<T, P> tvec3<T, P>::XYZ = tvec3<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
+#	endif
 	// -- Implicit basic constructors --
 
 #	if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

+ 1 - 0
test/core/core_type_vec3.cpp

@@ -33,6 +33,7 @@
 #	define GLM_META_PROG_HELPERS
 #endif
 #define GLM_SWIZZLE
+#define GLM_STATIC_CONST_MEMBERS
 #include <glm/vector_relational.hpp>
 #include <glm/geometric.hpp>
 #include <glm/vec2.hpp>