diff --git a/glm/detail/type_vec4_simd.inl b/glm/detail/type_vec4_simd.inl index 22bc545a..27117443 100644 --- a/glm/detail/type_vec4_simd.inl +++ b/glm/detail/type_vec4_simd.inl @@ -342,23 +342,14 @@ namespace detail # if !GLM_HAS_DEFAULTED_FUNCTIONS template<> GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_lowp>::vec() -# ifndef GLM_FORCE_NO_CTOR_INIT - : data(_mm_setzero_ps()) -# endif {} template<> GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_mediump>::vec() -# ifndef GLM_FORCE_NO_CTOR_INIT - : data(_mm_setzero_ps()) -# endif {} template<> GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_highp>::vec() -# ifndef GLM_FORCE_NO_CTOR_INIT - : data(_mm_setzero_ps()) -# endif {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 7c346794..cf74f4a7 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -133,6 +133,12 @@ namespace glm template GLM_FUNC_DECL bool operator!=(tdualquat const & q1, tdualquat const & q2); + /// Creates an identity dual quaternion. + /// + /// @see gtx_dual_quaternion + template + GLM_FUNC_DECL tdualquat dual_quat_identity(); + /// Returns the normalized quaternion. /// /// @see gtx_dual_quaternion diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index 0565caa3..031e4976 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -218,6 +218,14 @@ namespace glm // -- Operations -- + template + GLM_FUNC_QUALIFIER tdualquat dual_quat_identity() + { + return tdualquat( + tquat(static_cast(1), static_cast(0), static_cast(0), static_cast(0)), + tquat(static_cast(0), static_cast(0), static_cast(0), static_cast(0))); + } + template GLM_FUNC_QUALIFIER tdualquat normalize(tdualquat const & q) { diff --git a/glm/gtx/quaternion.hpp b/glm/gtx/quaternion.hpp index cce10892..dc9d5268 100644 --- a/glm/gtx/quaternion.hpp +++ b/glm/gtx/quaternion.hpp @@ -32,6 +32,12 @@ namespace glm /// @addtogroup gtx_quaternion /// @{ + /// Create an identity quaternion. + /// + /// @see gtx_quaternion + template + GLM_FUNC_DECL tquat quat_identity(); + /// Compute a cross product between a quaternion and a vector. /// /// @see gtx_quaternion diff --git a/glm/gtx/quaternion.inl b/glm/gtx/quaternion.inl index c69426bb..a3b94a4b 100644 --- a/glm/gtx/quaternion.inl +++ b/glm/gtx/quaternion.inl @@ -6,6 +6,12 @@ namespace glm { + template + GLM_FUNC_QUALIFIER tquat quat_identity() + { + return tquat(static_cast(1), static_cast(0), static_cast(0), static_cast(0)); + } + template GLM_FUNC_QUALIFIER vec<3, T, P> cross(vec<3, T, P> const& v, tquat const& q) { diff --git a/readme.md b/readme.md index 84f02007..7a6a8e90 100644 --- a/readme.md +++ b/readme.md @@ -101,6 +101,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Removed GLM_MESSAGES, use GLM_FORCE_MESSAGES instead - Removed GLM_DEPTH_ZERO_TO_ONE, use GLM_FORCE_DEPTH_ZERO_TO_ONE instead - Removed GLM_LEFT_HANDED, use GLM_FORCE_LEFT_HANDED instead +- Removed GLM_FORCE_NO_CTOR_INIT --- ### [GLM 0.9.8.5](https://github.com/g-truc/glm/tree/0.9.8) - 2017-0X-XX diff --git a/test/core/core_type_ctor.cpp b/test/core/core_type_ctor.cpp index e9e73e4c..7ee8a3fb 100644 --- a/test/core/core_type_ctor.cpp +++ b/test/core/core_type_ctor.cpp @@ -1,4 +1,3 @@ -#define GLM_FORCE_NO_CTOR_INIT #include #include #include @@ -76,14 +75,6 @@ int test_vec4_ctor() { int Error = 0; -# ifndef GLM_FORCE_NO_CTOR_INIT - { - glm::vec4 A; - glm::vec4 B(0); - Error += glm::all(glm::equal(A, B)) ? 0 : 1; - } -# endif//GLM_FORCE_NO_CTOR_INIT - # if GLM_HAS_DEFAULTED_FUNCTIONS { union pack @@ -316,7 +307,7 @@ int test_quat_ctor() { int Error = 0; -# if GLM_HAS_DEFAULTED_FUNCTIONS && defined(GLM_FORCE_NO_CTOR_INIT) +# if GLM_HAS_DEFAULTED_FUNCTIONS { union pack { diff --git a/test/gtc/gtc_quaternion.cpp b/test/gtc/gtc_quaternion.cpp index db410fc4..1b004a0d 100644 --- a/test/gtc/gtc_quaternion.cpp +++ b/test/gtc/gtc_quaternion.cpp @@ -135,7 +135,7 @@ int test_quat_slerp() float const Epsilon = 0.0001f;//glm::epsilon(); float sqrt2 = sqrt(2.0f)/2.0f; - glm::quat id; + glm::quat id(static_cast(1), static_cast(0), static_cast(0), static_cast(0)); glm::quat Y90rot(sqrt2, 0.0f, sqrt2, 0.0f); glm::quat Y180rot(0.0f, 0.0f, 1.0f, 0.0f); @@ -211,16 +211,12 @@ int test_quat_mul() glm::quat temp5 = glm::normalize(temp1 * temp2); glm::vec3 temp6 = temp5 * glm::vec3(0.0, 1.0, 0.0) * glm::inverse(temp5); -# ifndef GLM_FORCE_NO_CTOR_INIT - { - glm::quat temp7; + glm::quat temp7(1.0f, glm::vec3(0.0, 1.0, 0.0)); - temp7 *= temp5; - temp7 *= glm::inverse(temp5); + temp7 *= temp5; + temp7 *= glm::inverse(temp5); - Error += temp7 != glm::quat(); - } -# endif + Error += temp7 != glm::quat(1.0f, glm::vec3(0.0, 1.0, 0.0)); return Error; } diff --git a/test/gtx/gtx_dual_quaternion.cpp b/test/gtx/gtx_dual_quaternion.cpp index fd17c199..1e868744 100644 --- a/test/gtx/gtx_dual_quaternion.cpp +++ b/test/gtx/gtx_dual_quaternion.cpp @@ -22,10 +22,10 @@ float myfrand() // returns values from -1 to 1 inclusive int test_dquat_type() { glm::dvec3 vA; - glm::dquat dqA,dqB; - glm::ddualquat C(dqA,dqB); + glm::dquat dqA, dqB; + glm::ddualquat C(dqA, dqB); glm::ddualquat B(dqA); - glm::ddualquat D(dqA,vA); + glm::ddualquat D(dqA, vA); return 0; } @@ -67,7 +67,7 @@ int test_inverse() float const Epsilon = 0.0001f; - glm::dualquat dqid; + glm::dualquat dqid = glm::dual_quat_identity(); glm::mat4x4 mid(1.0f); for (int j = 0; j < 100; ++j)