diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index 13840689..78faf314 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -61,6 +61,10 @@ 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 IDENTITY; +# endif private: col_type value[2]; diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index 202839f4..b7f09d7d 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -50,6 +50,13 @@ namespace detail } }//namespace detail +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat2x2 tmat2x2::ZERO(static_cast(0)); + + template + const tmat2x2 tmat2x2::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index 755c7cb9..0477c0f9 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -57,6 +57,11 @@ 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 IDENTITY; +# endif + private: col_type value[2]; diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index 267f0c0c..23018c19 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat2x3 tmat2x3::ZERO(static_cast(0)); + + template + const tmat2x3 tmat2x3::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 4cba2cb8..36840f12 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -57,6 +57,11 @@ 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 IDENTITY; +# endif + private: col_type value[2]; diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index 766640e4..ebb9170c 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat2x4 tmat2x4::ZERO(static_cast(0)); + + template + const tmat2x4 tmat2x4::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index 52890f19..06549837 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -57,6 +57,11 @@ 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 IDENTITY; +# endif + private: col_type value[3]; diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index d112a054..7e3ff4be 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat3x2 tmat3x2::ZERO(static_cast(0)); + + template + const tmat3x2 tmat3x2::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 58b2e7fe..4ef3708d 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -56,6 +56,11 @@ 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 IDENTITY; +# endif + template friend tvec3 operator/(tmat3x3 const & m, tvec3 const & v); template diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index 6f936036..ec6f3eb6 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -56,6 +56,14 @@ namespace detail } }//namespace detail +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat3x3 tmat3x3::ZERO(static_cast(0)); + + template + const tmat3x3 tmat3x3::IDENTITY(static_cast(1)); +# endif + // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 4bf6ab18..f9c7b908 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -57,6 +57,11 @@ 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 IDENTITY; +# endif + private: col_type value[3]; diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index 8862df47..16ff84d3 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat3x4 tmat3x4::ZERO(static_cast(0)); + + template + const tmat3x4 tmat3x4::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index 5c050e26..b3c27261 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -57,6 +57,11 @@ 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 IDENTITY; +# endif + private: col_type value[4]; diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index d012b884..187b4579 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat4x2 tmat4x2::ZERO(static_cast(0)); + + template + const tmat4x2 tmat4x2::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index 74b8364b..7a870a86 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -57,6 +57,11 @@ 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 IDENTITY; +# endif + private: col_type value[4]; diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index e7368619..da76cdcc 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat4x3 tmat4x3::ZERO(static_cast(0)); + + template + const tmat4x3 tmat4x3::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index e00b3ac3..fa585e5b 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -56,6 +56,11 @@ 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 IDENTITY; +# endif + template friend tvec4 operator/(tmat4x4 const & m, tvec4 const & v); template diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index c075122b..1d463836 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -92,6 +92,13 @@ namespace detail } }//namespace detail +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tmat4x4 tmat4x4::ZERO(static_cast(0)); + + template + const tmat4x4 tmat4x4::IDENTITY(static_cast(1)); +# endif // -- Constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index 943290bb..f59e1c96 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -59,6 +59,10 @@ 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; +# endif // -- Data -- # if GLM_HAS_ANONYMOUS_UNION diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index 39485782..0da79982 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -32,6 +32,13 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tvec1 tvec1::X(static_cast(1)); + + template + const tvec1 tvec1::ZERO(static_cast(0)); +# endif // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 521e8ccc..ddd45564 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -58,6 +58,13 @@ 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; + static const type XY; +# endif + // -- Data -- # if GLM_HAS_ANONYMOUS_UNION diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index 39d0549e..1bcaf772 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -28,6 +28,19 @@ namespace glm { +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tvec2 tvec2::ZERO(static_cast(0), static_cast(0)); + + template + const tvec2 tvec2::X(static_cast(1), static_cast(0)); + + template + const tvec2 tvec2::Y(static_cast(0), static_cast(1)); + + template + const tvec2 tvec2::XY(static_cast(1), static_cast(1)); +# endif // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index 98dd74f8..d08b7c29 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -58,6 +58,17 @@ 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; + static const type Z; + static const type XY; + static const type XZ; + static const type YZ; + static const type XYZ; +# endif + // -- Data -- # if GLM_HAS_ANONYMOUS_UNION diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index 1e5081d4..f231a682 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -32,6 +32,32 @@ namespace glm { + +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tvec3 tvec3::ZERO(static_cast(0), static_cast(0), static_cast(0)); + + template + const tvec3 tvec3::X(static_cast(1), static_cast(0), static_cast(0)); + + template + const tvec3 tvec3::Y(static_cast(0), static_cast(1), static_cast(0)); + + template + const tvec3 tvec3::Z(static_cast(0), static_cast(0), static_cast(1)); + + template + const tvec3 tvec3::XY(static_cast(1), static_cast(1), static_cast(0)); + + template + const tvec3 tvec3::XZ(static_cast(1), static_cast(0), static_cast(1)); + + template + const tvec3 tvec3::YZ(static_cast(0), static_cast(1), static_cast(1)); + + template + const tvec3 tvec3::XYZ(static_cast(1), static_cast(1), static_cast(1)); +# endif // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 2d110c31..489ef6f8 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -112,6 +112,25 @@ namespace detail 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; + static const type Z; + static const type W; + static const type XY; + static const type XZ; + static const type XW; + static const type YZ; + static const type YW; + static const type ZW; + static const type XYZ; + static const type XYW; + static const type XZW; + static const type YZW; + static const type XYZW; +# endif + // -- Data -- # if GLM_HAS_ANONYMOUS_UNION && GLM_NOT_BUGGY_VC32BITS diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 80c75945..23b8c8b3 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -32,6 +32,72 @@ namespace glm { + +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tvec4 tvec4::ZERO + (static_cast(0), static_cast(0), static_cast(0), static_cast(0)); + + template + const tvec4 tvec4::X + (static_cast(1), static_cast(0), static_cast(0), static_cast(0)); + + template + const tvec4 tvec4::Y + (static_cast(0), static_cast(1), static_cast(0), static_cast(0)); + + template + const tvec4 tvec4::Z + (static_cast(0), static_cast(0), static_cast(1), static_cast(0)); + + template + const tvec4 tvec4::W + (static_cast(0), static_cast(0), static_cast(0), static_cast(1)); + + template + const tvec4 tvec4::XY + (static_cast(1), static_cast(1), static_cast(0), static_cast(0)); + + template + const tvec4 tvec4::XZ + (static_cast(1), static_cast(0), static_cast(1), static_cast(0)); + + template + const tvec4 tvec4::XW + (static_cast(1), static_cast(0), static_cast(0), static_cast(1)); + + template + const tvec4 tvec4::YZ + (static_cast(0), static_cast(1), static_cast(1), static_cast(0)); + + template + const tvec4 tvec4::YW + (static_cast(0), static_cast(1), static_cast(0), static_cast(1)); + + template + const tvec4 tvec4::ZW + (static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + + template + const tvec4 tvec4::XYZ + (static_cast(1), static_cast(1), static_cast(1), static_cast(0)); + + template + const tvec4 tvec4::XYW + (static_cast(1), static_cast(1), static_cast(0), static_cast(1)); + + template + const tvec4 tvec4::XZW + (static_cast(1), static_cast(0), static_cast(1), static_cast(1)); + + template + const tvec4 tvec4::YZW + (static_cast(0), static_cast(1), static_cast(1), static_cast(1)); + + template + const tvec4 tvec4::XYZW + (static_cast(1), static_cast(1), static_cast(1), static_cast(1)); +# endif // -- Implicit basic constructors -- # if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 25df0f22..f5711c64 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -76,6 +76,26 @@ namespace glm T x, y, z, w; +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; + static const type X; + static const type Y; + static const type Z; + static const type W; + static const type XY; + static const type XZ; + static const type XW; + static const type YZ; + static const type YW; + static const type ZW; + static const type XYZ; + static const type XYW; + static const type XZW; + static const type YZW; + static const type XYZW; +# endif + // -- Component accesses -- # ifdef GLM_FORCE_SIZE_FUNC diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 4c8565bc..4ee7f802 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -49,6 +49,73 @@ namespace detail }; }//namespace detail +# ifdef GLM_STATIC_CONST_MEMBERS + template + const tquat tquat::ZERO + (static_cast(0), static_cast(0), static_cast(0), static_cast(0)); + + template const tquat tquat::IDENTITY; + + template + const tquat tquat::X + (static_cast(0), static_cast(1), static_cast(0), static_cast(0)); + + template + const tquat tquat::Y + (static_cast(0), static_cast(0), static_cast(1), static_cast(0)); + + template + const tquat tquat::Z + (static_cast(0), static_cast(0), static_cast(0), static_cast(1)); + + template + const tquat tquat::W + (static_cast(1), static_cast(0), static_cast(0), static_cast(0)); + + template + const tquat tquat::XY + (static_cast(0), static_cast(1), static_cast(1), static_cast(0)); + + template + const tquat tquat::XZ + (static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + + template + const tquat tquat::XW + (static_cast(1), static_cast(1), static_cast(0), static_cast(0)); + + template + const tquat tquat::YZ + (static_cast(0), static_cast(0), static_cast(1), static_cast(1)); + + template + const tquat tquat::YW + (static_cast(1), static_cast(0), static_cast(1), static_cast(0)); + + template + const tquat tquat::ZW + (static_cast(1), static_cast(0), static_cast(0), static_cast(1)); + + template + const tquat tquat::XYZ + (static_cast(0), static_cast(1), static_cast(1), static_cast(1)); + + template + const tquat tquat::XYW + (static_cast(1), static_cast(1), static_cast(1), static_cast(0)); + + template + const tquat tquat::XZW + (static_cast(1), static_cast(1), static_cast(0), static_cast(1)); + + template + const tquat tquat::YZW + (static_cast(1), static_cast(0), static_cast(1), static_cast(1)); + + template + const tquat tquat::XYZW + (static_cast(1), static_cast(1), static_cast(1), static_cast(1)); +# endif // -- Component accesses -- # ifdef GLM_FORCE_SIZE_FUNC diff --git a/glm/gtx/simd_mat4.hpp b/glm/gtx/simd_mat4.hpp index 04198333..e1567610 100644 --- a/glm/gtx/simd_mat4.hpp +++ b/glm/gtx/simd_mat4.hpp @@ -83,6 +83,11 @@ namespace detail static GLM_RELAXED_CONSTEXPR precision prec = defaultp; # endif//GLM_META_PROG_HELPERS +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; +# endif + GLM_FUNC_DECL length_t length() const; fvec4SIMD Data[4]; diff --git a/glm/gtx/simd_mat4.inl b/glm/gtx/simd_mat4.inl index 13dcb20f..c436ab1f 100644 --- a/glm/gtx/simd_mat4.inl +++ b/glm/gtx/simd_mat4.inl @@ -61,6 +61,11 @@ GLM_FUNC_QUALIFIER fvec4SIMD const & fmat4x4SIMD::operator[] return this->Data[i]; } +#ifdef GLM_STATIC_CONST_MEMBERS + const fmat4x4SIMD fmat4x4SIMD::ZERO(static_cast(0)); + const fmat4x4SIMD fmat4x4SIMD::IDENTITY(static_cast(1)); +#endif + ////////////////////////////////////////////////////////////// // Constructors diff --git a/glm/gtx/simd_quat.hpp b/glm/gtx/simd_quat.hpp index 97075ba6..16782081 100644 --- a/glm/gtx/simd_quat.hpp +++ b/glm/gtx/simd_quat.hpp @@ -91,6 +91,26 @@ namespace detail __m128 Data; #endif +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type IDENTITY; + static const type X; + static const type Y; + static const type Z; + static const type W; + static const type XY; + static const type XZ; + static const type XW; + static const type YZ; + static const type YW; + static const type ZW; + static const type XYZ; + static const type XYW; + static const type XZW; + static const type YZW; + static const type XYZW; +# endif + ////////////////////////////////////// // Implicit basic constructors diff --git a/glm/gtx/simd_quat.inl b/glm/gtx/simd_quat.inl index 2fcc7fe4..c301988a 100644 --- a/glm/gtx/simd_quat.inl +++ b/glm/gtx/simd_quat.inl @@ -51,6 +51,25 @@ void print(const fvec4SIMD &v) } #endif +# ifdef GLM_STATIC_CONST_MEMBERS + const fquatSIMD fquatSIMD::ZERO(0, 0, 0, 0); + const fquatSIMD fquatSIMD::IDENTITY(1, 0, 0, 0); + const fquatSIMD fquatSIMD::X(0, 1, 0, 0); + const fquatSIMD fquatSIMD::Y(0, 0, 1, 0); + const fquatSIMD fquatSIMD::Z(0, 0, 0, 1); + const fquatSIMD fquatSIMD::W(1, 0, 0, 0); + const fquatSIMD fquatSIMD::XY(0, 1, 1, 0); + const fquatSIMD fquatSIMD::XZ(0, 1, 0, 1); + const fquatSIMD fquatSIMD::XW(1, 1, 0, 0); + const fquatSIMD fquatSIMD::YZ(0, 0, 1, 1); + const fquatSIMD fquatSIMD::YW(1, 0, 1, 0); + const fquatSIMD fquatSIMD::ZW(1, 0, 0, 1); + const fquatSIMD fquatSIMD::XYZ(0, 1, 1, 1); + const fquatSIMD fquatSIMD::XYW(1, 1, 1, 0); + const fquatSIMD fquatSIMD::XZW(1, 1, 0, 1); + const fquatSIMD fquatSIMD::YZW(1, 0, 1, 1); + const fquatSIMD fquatSIMD::XYZW(1, 1, 1, 1); +# endif ////////////////////////////////////// // Implicit basic constructors diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index cb084852..3877f821 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -114,6 +114,25 @@ namespace detail __m128 Data; #endif +# ifdef GLM_STATIC_CONST_MEMBERS + static const type ZERO; + static const type X; + static const type Y; + static const type Z; + static const type W; + static const type XY; + static const type XZ; + static const type XW; + static const type YZ; + static const type YW; + static const type ZW; + static const type XYZ; + static const type XYW; + static const type XZW; + static const type YZW; + static const type XYZW; +# endif + ////////////////////////////////////// // Implicit basic constructors @@ -167,15 +186,15 @@ namespace detail ////////////////////////////////////// // Swizzle operators - template + template fvec4SIMD& swizzle(); - template + template fvec4SIMD swizzle() const; - template + template fvec4SIMD swizzle() const; - template + template fvec4SIMD swizzle() const; - template + template fvec4SIMD swizzle() const; }; }//namespace detail diff --git a/glm/gtx/simd_vec4.inl b/glm/gtx/simd_vec4.inl index e375073f..b1413eea 100644 --- a/glm/gtx/simd_vec4.inl +++ b/glm/gtx/simd_vec4.inl @@ -16,6 +16,25 @@ struct shuffle_mask enum{value = Value}; }; +# ifdef GLM_STATIC_CONST_MEMBERS + const fvec4SIMD fvec4SIMD::ZERO(0, 0, 0, 0); + const fvec4SIMD fvec4SIMD::X(1, 0, 0, 0); + const fvec4SIMD fvec4SIMD::Y(0, 1, 0, 0); + const fvec4SIMD fvec4SIMD::Z(0, 0, 1, 0); + const fvec4SIMD fvec4SIMD::W(0, 0, 0, 1); + const fvec4SIMD fvec4SIMD::XY(1, 1, 0, 0); + const fvec4SIMD fvec4SIMD::XZ(1, 0, 1, 0); + const fvec4SIMD fvec4SIMD::XW(1, 0, 0, 1); + const fvec4SIMD fvec4SIMD::YZ(0, 1, 1, 0); + const fvec4SIMD fvec4SIMD::YW(0, 1, 0, 1); + const fvec4SIMD fvec4SIMD::ZW(0, 0, 1, 1); + const fvec4SIMD fvec4SIMD::XYZ(1, 1, 1, 0); + const fvec4SIMD fvec4SIMD::XYW(1, 1, 0, 1); + const fvec4SIMD fvec4SIMD::XZW(1, 0, 1, 1); + const fvec4SIMD fvec4SIMD::YZW(0, 1, 1, 1); + const fvec4SIMD fvec4SIMD::XYZW(1, 1, 1, 1); +# endif + ////////////////////////////////////// // Implicit basic constructors @@ -167,21 +186,21 @@ GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::operator--() ////////////////////////////////////// // Swizzle operators -template +template GLM_FUNC_QUALIFIER fvec4SIMD fvec4SIMD::swizzle() const { __m128 Data = _mm_shuffle_ps( this->Data, this->Data, - shuffle_mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value); + shuffle_mask<(W_ << 6) | (Z_ << 4) | (Y_ << 2) | (X_ << 0)>::value); return fvec4SIMD(Data); } -template +template GLM_FUNC_QUALIFIER fvec4SIMD& fvec4SIMD::swizzle() { this->Data = _mm_shuffle_ps( this->Data, this->Data, - shuffle_mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value); + shuffle_mask<(W_ << 6) | (Z_ << 4) | (Y_ << 2) | (X_ << 0)>::value); return *this; } diff --git a/test/core/core_type_mat2x2.cpp b/test/core/core_type_mat2x2.cpp index a682640b..9e36e54d 100644 --- a/test/core/core_type_mat2x2.cpp +++ b/test/core/core_type_mat2x2.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -86,6 +87,15 @@ int test_inverse() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat2x2(1) == glm::mat2x2::IDENTITY ? 0 : 1; + Error += glm::mat2x2(0) == glm::mat2x2::ZERO ? 0 : 1; + + return Error; +} + int test_ctr() { int Error(0); @@ -173,6 +183,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_operators(); Error += test_inverse(); diff --git a/test/core/core_type_mat2x3.cpp b/test/core/core_type_mat2x3.cpp index 59b06be0..34e2d9a8 100644 --- a/test/core/core_type_mat2x3.cpp +++ b/test/core/core_type_mat2x3.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -102,6 +103,16 @@ int test_ctr() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat2x3(1) == glm::mat2x3::IDENTITY ? 0 : 1; + Error += glm::mat2x3(0) == glm::mat2x3::ZERO ? 0 : 1; + + return Error; +} + + namespace cast { template @@ -147,6 +158,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat2x4.cpp b/test/core/core_type_mat2x4.cpp index f6f706cf..9ad9a47c 100644 --- a/test/core/core_type_mat2x4.cpp +++ b/test/core/core_type_mat2x4.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -98,6 +99,15 @@ int test_ctr() }; #endif//GLM_HAS_INITIALIZER_LISTS + + return Error; +} + +int test_static_const() { + int Error(0); + + Error += glm::mat2x4(1) == glm::mat2x4::IDENTITY ? 0 : 1; + Error += glm::mat2x4(0) == glm::mat2x4::ZERO ? 0 : 1; return Error; } @@ -147,6 +157,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat3x2.cpp b/test/core/core_type_mat3x2.cpp index b6611d23..e68c2638 100644 --- a/test/core/core_type_mat3x2.cpp +++ b/test/core/core_type_mat3x2.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -106,6 +107,16 @@ int test_ctr() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat3x2(1) == glm::mat3x2::IDENTITY ? 0 : 1; + Error += glm::mat3x2(0) == glm::mat3x2::ZERO ? 0 : 1; + + return Error; +} + + namespace cast { template @@ -152,6 +163,7 @@ int main() Error += cast::test(); Error += test_ctr(); + Error += test_static_const(); Error += test_operators(); return Error; diff --git a/test/core/core_type_mat3x3.cpp b/test/core/core_type_mat3x3.cpp index 89ec2be8..f9ece80f 100644 --- a/test/core/core_type_mat3x3.cpp +++ b/test/core/core_type_mat3x3.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -165,6 +166,15 @@ int test_ctr() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat3x3(1) == glm::mat3x3::IDENTITY ? 0 : 1; + Error += glm::mat3x3(0) == glm::mat3x3::ZERO ? 0 : 1; + + return Error; +} + namespace cast { template @@ -210,6 +220,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_mat3x3(); Error += test_operators(); diff --git a/test/core/core_type_mat3x4.cpp b/test/core/core_type_mat3x4.cpp index a76bb21e..bde2e89d 100644 --- a/test/core/core_type_mat3x4.cpp +++ b/test/core/core_type_mat3x4.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -106,6 +107,15 @@ int test_ctr() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat3x4(1) == glm::mat3x4::IDENTITY ? 0 : 1; + Error += glm::mat3x4(0) == glm::mat3x4::ZERO ? 0 : 1; + + return Error; +} + namespace cast { template @@ -151,6 +161,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat4x2.cpp b/test/core/core_type_mat4x2.cpp index 3b38e6d2..78cd9170 100644 --- a/test/core/core_type_mat4x2.cpp +++ b/test/core/core_type_mat4x2.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -110,6 +111,15 @@ int test_ctr() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat4x2(1) == glm::mat4x2::IDENTITY ? 0 : 1; + Error += glm::mat4x2(0) == glm::mat4x2::ZERO ? 0 : 1; + + return Error; +} + namespace cast { template @@ -155,6 +165,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat4x3.cpp b/test/core/core_type_mat4x3.cpp index 8a7e0542..677fcf03 100644 --- a/test/core/core_type_mat4x3.cpp +++ b/test/core/core_type_mat4x3.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -110,6 +111,15 @@ int test_ctr() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat4x3(1) == glm::mat4x3::IDENTITY ? 0 : 1; + Error += glm::mat4x3(0) == glm::mat4x3::ZERO ? 0 : 1; + + return Error; +} + namespace cast { template @@ -155,6 +165,7 @@ int main() #endif Error += cast::test(); + Error += test_static_const(); Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index 6b7b36e3..f3fa5aaf 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/test/core/core_type_mat4x4.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #define GLM_SIMD #include #include @@ -283,6 +284,15 @@ int perf_mul() return Error; } +int test_static_const() { + int Error(0); + + Error += glm::mat4x4(1) == glm::mat4x4::IDENTITY ? 0 : 1; + Error += glm::mat4x4(0) == glm::mat4x4::ZERO ? 0 : 1; + + return Error; +} + namespace cast { template @@ -339,6 +349,7 @@ int main() Error += cast::test(); Error += test_ctr(); + Error += test_static_const(); Error += test_inverse_dmat4x4(); Error += test_inverse_mat4x4(); Error += test_operators(); diff --git a/test/core/core_type_vec1.cpp b/test/core/core_type_vec1.cpp index 711a16a6..32c23670 100644 --- a/test/core/core_type_vec1.cpp +++ b/test/core/core_type_vec1.cpp @@ -32,6 +32,7 @@ #if !(GLM_COMPILER & GLM_COMPILER_GCC) # define GLM_META_PROG_HELPERS #endif +#define GLM_STATIC_CONST_MEMBERS #define GLM_SWIZZLE #include #include @@ -166,6 +167,18 @@ int test_vec1_operator_increment() return Error; } +int test_vec1_static_const() { + int Error = 0; + + Error += (glm::vec1(1.0f) == glm::vec1::X) ? 0 : 1; + Error += (glm::ivec1(1) == glm::ivec1::X) ? 0 : 1; + Error += (glm::dvec1(1.0) == glm::dvec1::X) ? 0 : 1; + Error += (glm::bvec1(false) == glm::bvec1::ZERO) ? 0 : 1; + Error += (glm::uvec1(0) == glm::uvec1::ZERO) ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -178,6 +191,7 @@ int main() assert(glm::vec1::components == 1); # endif + Error += test_vec1_static_const(); Error += test_vec1_size(); Error += test_vec1_ctor(); Error += test_vec1_operators(); diff --git a/test/core/core_type_vec2.cpp b/test/core/core_type_vec2.cpp index 69b5957e..11065ea1 100644 --- a/test/core/core_type_vec2.cpp +++ b/test/core/core_type_vec2.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #if !(GLM_COMPILER & GLM_COMPILER_GCC) # define GLM_META_PROG_HELPERS #endif @@ -40,6 +41,7 @@ # include #endif + int test_vec2_operators() { int Error = 0; @@ -331,6 +333,17 @@ int test_operator_increment() return Error; } +int test_vec2_static_const() { + int Error(0); + + Error += (glm::ivec2(0, 0) == glm::ivec2::ZERO) ? 0 : 1; + Error += (glm::vec2(1, 0) == glm::vec2::X) ? 0 : 1; + Error += (glm::bvec2(false, true) == glm::bvec2::Y) ? 0 : 1; + Error += (glm::dvec2(1, 1) == glm::dvec2::XY) ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -343,6 +356,7 @@ int main() assert(glm::vec2::components == 2); # endif + Error += test_vec2_static_const(); Error += test_vec2_size(); Error += test_vec2_ctor(); Error += test_vec2_operators(); diff --git a/test/core/core_type_vec3.cpp b/test/core/core_type_vec3.cpp index 727e90d7..8b0c8d09 100644 --- a/test/core/core_type_vec3.cpp +++ b/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 #include #include @@ -493,6 +494,21 @@ int test_operator_increment() return Error; } +int test_vec3_static_const() { + int Error(0); + + Error += (glm::ivec3(0, 0, 0) == glm::ivec3::ZERO) ? 0 : 1; + Error += (glm::vec3(1, 0, 0) == glm::vec3::X) ? 0 : 1; + Error += (glm::bvec3(false, true, false) == glm::bvec3::Y) ? 0 : 1; + Error += (glm::bvec3(false, false, true) == glm::bvec3::Z) ? 0 : 1; + Error += (glm::dvec3(1, 1, 0) == glm::dvec3::XY) ? 0 : 1; + Error += (glm::vec3(1, 0, 1) == glm::vec3::XZ) ? 0 : 1; + Error += (glm::uvec3(0u, 1u, 1u) == glm::uvec3::YZ) ? 0 : 1; + Error += (glm::dvec3(1, 1, 1) == glm::dvec3::XYZ) ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -505,6 +521,7 @@ int main() assert(glm::vec3::components == 3); # endif + Error += test_vec3_static_const(); Error += test_vec3_ctor(); Error += test_vec3_operators(); Error += test_vec3_size(); diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index cc72ddaa..5c48eccd 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -33,6 +33,7 @@ # define GLM_META_PROG_HELPERS #endif #define GLM_SWIZZLE +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -376,6 +377,28 @@ int test_operator_increment() return Error; } +int test_vec4_static_const() { + int Error(0); + + Error += (glm::ivec4(0, 0, 0, 0) == glm::ivec4::ZERO) ? 0 : 1; + Error += (glm::vec4(1, 0, 0, 0) == glm::vec4::X) ? 0 : 1; + Error += (glm::bvec4(false, true, false, false) == glm::bvec4::Y) ? 0 : 1; + Error += (glm::bvec4(false, false, true, false) == glm::bvec4::Z) ? 0 : 1; + Error += (glm::uvec4(0u, 0u, 0u, 1u) == glm::uvec4::W) ? 0 : 1; + Error += (glm::dvec4(1, 1, 0, 0) == glm::dvec4::XY) ? 0 : 1; + Error += (glm::vec4(1, 0, 1, 0) == glm::vec4::XZ) ? 0 : 1; + Error += (glm::vec4(1, 0, 0, 1) == glm::vec4::XW) ? 0 : 1; + Error += (glm::uvec4(0u, 1u, 1u, 0u) == glm::uvec4::YZ) ? 0 : 1; + Error += (glm::vec4(0, 1, 0, 1) == glm::vec4::YW) ? 0 : 1; + Error += (glm::dvec4(1, 1, 1, 0) == glm::dvec4::XYZ) ? 0 : 1; + Error += (glm::vec4(1, 1, 0, 1) == glm::vec4::XYW) ? 0 : 1; + Error += (glm::vec4(1, 0, 1, 1) == glm::vec4::XZW) ? 0 : 1; + Error += (glm::vec4(0, 1, 1, 1) == glm::vec4::YZW) ? 0 : 1; + Error += (glm::vec4(1, 1, 1, 1) == glm::vec4::XYZW) ? 0 : 1; + + return Error; +} + struct AoS { glm::vec4 A; @@ -486,6 +509,7 @@ int main() Error += test_vec4_perf_SoA(Size); # endif//NDEBUG + Error += test_vec4_static_const(); Error += test_vec4_ctor(); Error += test_vec4_size(); Error += test_vec4_operators(); diff --git a/test/gtx/gtx_simd_mat4.cpp b/test/gtx/gtx_simd_mat4.cpp index 11230466..6a9a42df 100644 --- a/test/gtx/gtx_simd_mat4.cpp +++ b/test/gtx/gtx_simd_mat4.cpp @@ -29,6 +29,7 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS #include #include #include @@ -252,6 +253,15 @@ int test_compute_gtx() return 0; } +int test_static_const() { + int Error(0); + + Error += glm::mat4_cast(glm::simdMat4(static_cast(1))) == glm::mat4_cast(glm::simdMat4::IDENTITY) ? 0 : 1; + Error += glm::mat4_cast(glm::simdMat4(static_cast(0))) == glm::mat4_cast(glm::simdMat4::ZERO) ? 0 : 1; + + return Error; +} + int main() { int Error = 0; @@ -313,7 +323,7 @@ int main() Error += test_compute_glm(); Error += test_compute_gtx(); - + Error += test_static_const(); float Det = glm::determinant(glm::simdMat4(1.0)); Error += Det == 1.0f ? 0 : 1; diff --git a/test/gtx/gtx_simd_vec4.cpp b/test/gtx/gtx_simd_vec4.cpp index b86eb272..e18a7e39 100644 --- a/test/gtx/gtx_simd_vec4.cpp +++ b/test/gtx/gtx_simd_vec4.cpp @@ -29,6 +29,8 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#define GLM_STATIC_CONST_MEMBERS + #include #include #include