From 4cf8a10af2bba678c2ad136006e6ec41118b6746 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 24 Jul 2017 12:46:54 +0200 Subject: [PATCH] No more default initialization of vector, matrix and quaternion types --- glm/detail/setup.hpp | 6 ----- glm/detail/type_mat2x2.hpp | 2 +- glm/detail/type_mat2x2.inl | 9 ++----- glm/detail/type_mat2x3.hpp | 2 +- glm/detail/type_mat2x3.inl | 11 +++----- glm/detail/type_mat2x4.hpp | 2 +- glm/detail/type_mat2x4.inl | 9 ++----- glm/detail/type_mat3x2.hpp | 2 +- glm/detail/type_mat3x2.inl | 10 ++------ glm/detail/type_mat3x3.hpp | 2 +- glm/detail/type_mat3x3.inl | 10 ++------ glm/detail/type_mat3x4.hpp | 2 +- glm/detail/type_mat3x4.inl | 10 ++------ glm/detail/type_mat4x2.hpp | 2 +- glm/detail/type_mat4x2.inl | 11 ++------ glm/detail/type_mat4x3.hpp | 2 +- glm/detail/type_mat4x3.inl | 11 ++------ glm/detail/type_mat4x4.hpp | 2 +- glm/detail/type_mat4x4.inl | 11 ++------ glm/detail/type_vec1.hpp | 2 +- glm/detail/type_vec1.inl | 5 +--- glm/detail/type_vec2.hpp | 2 +- glm/detail/type_vec2.inl | 5 +--- glm/detail/type_vec3.hpp | 2 +- glm/detail/type_vec3.inl | 5 +--- glm/detail/type_vec4.hpp | 2 +- glm/detail/type_vec4.inl | 5 +--- glm/gtc/quaternion.hpp | 2 +- glm/gtc/quaternion.inl | 11 +++----- glm/gtx/dual_quaternion.hpp | 2 +- glm/gtx/dual_quaternion.inl | 6 +---- manual.md | 51 +++---------------------------------- readme.md | 1 + 33 files changed, 48 insertions(+), 169 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index e07fd90a..2e0b2d0d 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -692,14 +692,8 @@ #if GLM_HAS_DEFAULTED_FUNCTIONS # define GLM_DEFAULT = default -# ifdef GLM_FORCE_NO_CTOR_INIT -# define GLM_DEFAULT_CTOR = default -# else -# define GLM_DEFAULT_CTOR -# endif #else # define GLM_DEFAULT -# define GLM_DEFAULT_CTOR #endif #if GLM_HAS_CONSTEXPR || GLM_HAS_CONSTEXPR_PARTIAL diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index 3ec4ed19..2ad233d6 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -34,7 +34,7 @@ namespace glm // -- Constructors -- - GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL mat() GLM_DEFAULT; GLM_FUNC_DECL mat(mat<2, 2, T, P> const & m) GLM_DEFAULT; template GLM_FUNC_DECL mat(mat<2, 2, T, Q> const & m); diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index cfd7a868..fb909e5e 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -7,15 +7,10 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER mat<2, 2, T, P>::mat() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0); - this->value[1] = col_type(0, 1); -# endif - } + {} # endif # if !GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index bcaae3bd..30ae1ac4 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -35,7 +35,7 @@ namespace glm // -- Constructors -- - GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL mat() GLM_DEFAULT; GLM_FUNC_DECL mat(mat<2, 3, T, P> const & m) GLM_DEFAULT; template GLM_FUNC_DECL mat(mat<2, 3, T, Q> const & m); diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index e18ab386..fb2d1d04 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -5,15 +5,10 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) - template +# if !GLM_HAS_DEFAULTED_FUNCTIONS + template GLM_FUNC_QUALIFIER mat<2, 3, T, P>::mat() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0, 0); - this->value[1] = col_type(0, 1, 0); -# endif - } + {} # endif # if !GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index dc4d2087..20c1a65b 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -35,7 +35,7 @@ namespace glm // -- Constructors -- - GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL mat() GLM_DEFAULT; GLM_FUNC_DECL mat(mat<2, 4, T, P> const & m) GLM_DEFAULT; template GLM_FUNC_DECL mat(mat<2, 4, T, Q> const & m); diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index ee9c3c42..c7526ce0 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -5,15 +5,10 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER mat<2, 4, T, P>::mat() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0, 0, 0); - this->value[1] = col_type(0, 1, 0, 0); -# endif - } + {} # endif # if !GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index a488c970..0258d06d 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -35,7 +35,7 @@ namespace glm // -- Constructors -- - GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL mat() GLM_DEFAULT; GLM_FUNC_DECL mat(mat<3, 2, T, P> const & m) GLM_DEFAULT; template GLM_FUNC_DECL mat(mat<3, 2, T, Q> const & m); diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index 9f66a015..0f5ea0ac 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -5,16 +5,10 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER mat<3, 2, T, P>::mat() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0); - this->value[1] = col_type(0, 1); - this->value[2] = col_type(0, 0); -# endif - } + {} # endif # if !GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index 6e7f70e4..4e1d7e9f 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -34,7 +34,7 @@ namespace glm // -- Constructors -- - GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL mat() GLM_DEFAULT; GLM_FUNC_DECL mat(mat<3, 3, T, P> const & m) GLM_DEFAULT; template GLM_FUNC_DECL mat(mat<3, 3, T, Q> const & m); diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index f4b4ad8e..8fee082b 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -7,16 +7,10 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER mat<3, 3, T, P>::mat() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0, 0); - this->value[1] = col_type(0, 1, 0); - this->value[2] = col_type(0, 0, 1); -# endif - } + {} # endif # if !GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 8437bc07..6775ab2e 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -35,7 +35,7 @@ namespace glm // -- Constructors -- - GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL mat() GLM_DEFAULT; GLM_FUNC_DECL mat(mat<3, 4, T, P> const & m) GLM_DEFAULT; template GLM_FUNC_DECL mat(mat<3, 4, T, Q> const & m); diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index 73f4aebb..f931cc60 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -5,16 +5,10 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER mat<3, 4, T, P>::mat() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0, 0, 0); - this->value[1] = col_type(0, 1, 0, 0); - this->value[2] = col_type(0, 0, 1, 0); -# endif - } + {} # endif # if !GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index ab999dfe..9f875183 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -35,7 +35,7 @@ namespace glm // -- Constructors -- - GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL mat() GLM_DEFAULT; GLM_FUNC_DECL mat(mat<4, 2, T, P> const & m) GLM_DEFAULT; template GLM_FUNC_DECL mat(mat<4, 2, T, Q> const & m); diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index 68d34630..7b8986d8 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -5,17 +5,10 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER mat<4, 2, T, P>::mat() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0); - this->value[1] = col_type(0, 1); - this->value[2] = col_type(0, 0); - this->value[3] = col_type(0, 0); -# endif - } + {} # endif # if !GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index c6ac5595..e3926e3e 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -35,7 +35,7 @@ namespace glm // -- Constructors -- - GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL mat() GLM_DEFAULT; GLM_FUNC_DECL mat(mat<4, 3, T, P> const & m) GLM_DEFAULT; template GLM_FUNC_DECL mat(mat<4, 3, T, Q> const & m); diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index b3c8d87e..a304a033 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -5,17 +5,10 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER mat<4, 3, T, P>::mat() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0, 0); - this->value[1] = col_type(0, 1, 0); - this->value[2] = col_type(0, 0, 1); - this->value[3] = col_type(0, 0, 0); -# endif - } + {} # endif # if !GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index 17063ac2..4b1d9d41 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -34,7 +34,7 @@ namespace glm // -- Constructors -- - GLM_FUNC_DECL mat() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL mat() GLM_DEFAULT; GLM_FUNC_DECL mat(mat<4, 4, T, P> const& m) GLM_DEFAULT; template GLM_FUNC_DECL mat(mat<4, 4, T, Q> const& m); diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index 880ce931..bce3cc71 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -7,17 +7,10 @@ namespace glm { // -- Constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER mat<4, 4, T, P>::mat() - { -# ifndef GLM_FORCE_NO_CTOR_INIT - this->value[0] = col_type(1, 0, 0, 0); - this->value[1] = col_type(0, 1, 0, 0); - this->value[2] = col_type(0, 0, 1, 0); - this->value[3] = col_type(0, 0, 0, 1); -# endif - } + {} # endif # if !GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index e05ae88d..db047f51 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -85,7 +85,7 @@ namespace glm // -- Implicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec const& v) GLM_DEFAULT; template GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, T, Q> const& v); diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index e3f56b25..283f3593 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -5,12 +5,9 @@ namespace glm { // -- Implicit basic constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<1, T, P>::vec() -# ifndef GLM_FORCE_NO_CTOR_INIT - : x(0) -# endif {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index bf6966e9..c6ae942f 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -86,7 +86,7 @@ namespace glm // -- Implicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec const& v) GLM_DEFAULT; template GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, T, Q> const& v); diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index fa6c2902..4fdb8e04 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -5,12 +5,9 @@ namespace glm { // -- Implicit basic constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<2, T, P>::vec() -# ifndef GLM_FORCE_NO_CTOR_INIT - : x(0), y(0) -# endif {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index 814c5a90..81db2bf5 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -86,7 +86,7 @@ namespace glm // -- Implicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec const & v) GLM_DEFAULT; template GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<3, T, Q> const & v); diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index e5524ab3..a02e14e1 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -5,12 +5,9 @@ namespace glm { // -- Implicit basic constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<3, T, P>::vec() -# ifndef GLM_FORCE_NO_CTOR_INIT - : x(0), y(0), z(0) -# endif {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 141b20d7..95fb2fb1 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -89,7 +89,7 @@ namespace glm // -- Implicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec() GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec(vec<4, T, P> const& v) GLM_DEFAULT; template GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec(vec<4, T, Q> const& v); diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index e333de19..214236b4 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -154,12 +154,9 @@ namespace detail // -- Implicit basic constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, T, P>::vec() -# ifndef GLM_FORCE_NO_CTOR_INIT - : x(0), y(0), z(0), w(0) -# endif {} # endif//!GLM_HAS_DEFAULTED_FUNCTIONS diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index b10873cd..de8d2050 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -77,7 +77,7 @@ namespace glm // -- Implicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR tquat() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL GLM_CONSTEXPR tquat() GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat const& q) GLM_DEFAULT; template GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat const& q); diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index 08c3cb88..cbe4667d 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -83,12 +83,9 @@ namespace detail // -- Implicit basic constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat::tquat() -# ifndef GLM_FORCE_NO_CTOR_INIT - : x(0), y(0), z(0), w(1) -# endif {} # endif @@ -294,19 +291,19 @@ namespace detail // -- Binary operators -- template - GLM_FUNC_QUALIFIER tquat operator+(tquat const & q, tquat const & p) + GLM_FUNC_QUALIFIER tquat operator+(tquat const & q, tquat const & p) { return tquat(q) += p; } template - GLM_FUNC_QUALIFIER tquat operator*(tquat const & q, tquat const & p) + GLM_FUNC_QUALIFIER tquat operator*(tquat const & q, tquat const & p) { return tquat(q) *= p; } template - GLM_FUNC_QUALIFIER vec<3, T, P> operator*(tquat const & q, vec<3, T, P> const & v) + GLM_FUNC_QUALIFIER vec<3, T, P> operator*(tquat const & q, vec<3, T, P> const & v) { vec<3, T, P> const QuatVector(q.x, q.y, q.z); vec<3, T, P> const uv(glm::cross(QuatVector, v)); diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index d7a27c9e..7c346794 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -56,7 +56,7 @@ namespace glm // -- Implicit basic constructors -- - GLM_FUNC_DECL GLM_CONSTEXPR tdualquat() GLM_DEFAULT_CTOR; + GLM_FUNC_DECL GLM_CONSTEXPR tdualquat() GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat const & d) GLM_DEFAULT; template GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat const & d); diff --git a/glm/gtx/dual_quaternion.inl b/glm/gtx/dual_quaternion.inl index 86915284..0565caa3 100644 --- a/glm/gtx/dual_quaternion.inl +++ b/glm/gtx/dual_quaternion.inl @@ -24,13 +24,9 @@ namespace glm // -- Implicit basic constructors -- -# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) +# if !GLM_HAS_DEFAULTED_FUNCTIONS template GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat::tdualquat() -# ifndef GLM_FORCE_NO_CTOR_INIT - : real(tquat()) - , dual(tquat(0, 0, 0, 0)) -# endif {} # endif diff --git a/manual.md b/manual.md index cecd6951..31a33063 100644 --- a/manual.md +++ b/manual.md @@ -22,9 +22,8 @@ + [3.4. SIMD support](#section3_4) + [3.5. Force inline](#section3_5) + [3.6. Vector and matrix static size](#section3_6) -+ [3.7. Disabling default constructor initialization](#section3_7) -+ [3.8. Requiring explicit conversions](#section3_8) -+ [3.9. Removing genType restriction](#section3_9) ++ [3.7. Requiring explicit conversions](#section3_7) ++ [3.8. Removing genType restriction](#section3_8) + [4. Stable extensions](#section4) + [4.1. GLM_GTC_bitfield](#section4_1) + [4.2. GLM_GTC_color_space](#section4_2) @@ -469,49 +468,7 @@ void foo(vec4 const & v) } ``` -### 3.7. Disabling default constructor initialization - -By default and following GLSL specifications, vector and matrix default constructors initialize the components to zero. This is a reliable behavior but initialization has a cost and it’s not always necessary. -This behavior can be disabled at compilation time by define GLM\_FORCE\_NO\_CTOR\_INIT before any inclusion of <glm/glm.hpp> or other GLM include. - -GLM default behavior: - -```cpp -#include - -void foo() -{ - glm::vec4 v; // v is (0.0f, 0.0f, 0.0f, 0.0f) - ... -} -``` - -GLM behavior using GLM\_FORCE\_NO\_CTOR\_INIT: - -```cpp -#define GLM_FORCE_NO_CTOR_INIT -#include - -void foo() -{ - glm::vec4 v; // v is filled with garbage - ... -} -``` - -Alternatively, GLM allows to explicitly not initialize a variable: - -```cpp -#include - -void foo() -{ - glm::vec4 v(glm::uninitialize); - ... -} -``` - -### 3.8. Require explicit conversions +### 3.7. Requiring explicit conversions GLSL supports implicit conversions of vector and matrix types. For example, an ivec4 can be implicitly converted into vec4. @@ -548,7 +505,7 @@ void foo() } ``` -### 3.9. Removing genType restriction +### 3.8. Removing genType restriction By default GLM only supports basic types as genType for vector, matrix and quaternion types: diff --git a/readme.md b/readme.md index 48bf30cd..84f02007 100644 --- a/readme.md +++ b/readme.md @@ -64,6 +64,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Added quatLookAt to GTX_quaternion #659 #### Improvements: +- No more default initialization of vector, matrix and quaternion types - Added lowp variant of GTC_color_space convertLinearToSRGB #419 - Replaced the manual by a markdown version #458 - Optimized GTC_packing implementation