No more default initialization of vector, matrix and quaternion types

master
Christophe Riccio ago%!(EXTRA string=8 years)
parent c834d06c27
commit 4cf8a10af2
  1. 6
      glm/detail/setup.hpp
  2. 2
      glm/detail/type_mat2x2.hpp
  3. 9
      glm/detail/type_mat2x2.inl
  4. 2
      glm/detail/type_mat2x3.hpp
  5. 9
      glm/detail/type_mat2x3.inl
  6. 2
      glm/detail/type_mat2x4.hpp
  7. 9
      glm/detail/type_mat2x4.inl
  8. 2
      glm/detail/type_mat3x2.hpp
  9. 10
      glm/detail/type_mat3x2.inl
  10. 2
      glm/detail/type_mat3x3.hpp
  11. 10
      glm/detail/type_mat3x3.inl
  12. 2
      glm/detail/type_mat3x4.hpp
  13. 10
      glm/detail/type_mat3x4.inl
  14. 2
      glm/detail/type_mat4x2.hpp
  15. 11
      glm/detail/type_mat4x2.inl
  16. 2
      glm/detail/type_mat4x3.hpp
  17. 11
      glm/detail/type_mat4x3.inl
  18. 2
      glm/detail/type_mat4x4.hpp
  19. 11
      glm/detail/type_mat4x4.inl
  20. 2
      glm/detail/type_vec1.hpp
  21. 5
      glm/detail/type_vec1.inl
  22. 2
      glm/detail/type_vec2.hpp
  23. 5
      glm/detail/type_vec2.inl
  24. 2
      glm/detail/type_vec3.hpp
  25. 5
      glm/detail/type_vec3.inl
  26. 2
      glm/detail/type_vec4.hpp
  27. 5
      glm/detail/type_vec4.inl
  28. 2
      glm/gtc/quaternion.hpp
  29. 11
      glm/gtc/quaternion.inl
  30. 2
      glm/gtx/dual_quaternion.hpp
  31. 6
      glm/gtx/dual_quaternion.inl
  32. 51
      manual.md
  33. 1
      readme.md

@ -692,14 +692,8 @@
#if GLM_HAS_DEFAULTED_FUNCTIONS #if GLM_HAS_DEFAULTED_FUNCTIONS
# define GLM_DEFAULT = default # define GLM_DEFAULT = default
# ifdef GLM_FORCE_NO_CTOR_INIT
# define GLM_DEFAULT_CTOR = default
# else
# define GLM_DEFAULT_CTOR
# endif
#else #else
# define GLM_DEFAULT # define GLM_DEFAULT
# define GLM_DEFAULT_CTOR
#endif #endif
#if GLM_HAS_CONSTEXPR || GLM_HAS_CONSTEXPR_PARTIAL #if GLM_HAS_CONSTEXPR || GLM_HAS_CONSTEXPR_PARTIAL

@ -34,7 +34,7 @@ namespace glm
// -- Constructors -- // -- 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; GLM_FUNC_DECL mat(mat<2, 2, T, P> const & m) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL mat(mat<2, 2, T, Q> const & m); GLM_FUNC_DECL mat(mat<2, 2, T, Q> const & m);

@ -7,15 +7,10 @@ namespace glm
{ {
// -- Constructors -- // -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER mat<2, 2, T, P>::mat() 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 # endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS

@ -35,7 +35,7 @@ namespace glm
// -- Constructors -- // -- 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; GLM_FUNC_DECL mat(mat<2, 3, T, P> const & m) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL mat(mat<2, 3, T, Q> const & m); GLM_FUNC_DECL mat(mat<2, 3, T, Q> const & m);

@ -5,15 +5,10 @@ namespace glm
{ {
// -- Constructors -- // -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER mat<2, 3, T, P>::mat() 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 # endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS

@ -35,7 +35,7 @@ namespace glm
// -- Constructors -- // -- 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; GLM_FUNC_DECL mat(mat<2, 4, T, P> const & m) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL mat(mat<2, 4, T, Q> const & m); GLM_FUNC_DECL mat(mat<2, 4, T, Q> const & m);

@ -5,15 +5,10 @@ namespace glm
{ {
// -- Constructors -- // -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER mat<2, 4, T, P>::mat() 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 # endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS

@ -35,7 +35,7 @@ namespace glm
// -- Constructors -- // -- 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; GLM_FUNC_DECL mat(mat<3, 2, T, P> const & m) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL mat(mat<3, 2, T, Q> const & m); GLM_FUNC_DECL mat(mat<3, 2, T, Q> const & m);

@ -5,16 +5,10 @@ namespace glm
{ {
// -- Constructors -- // -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER mat<3, 2, T, P>::mat() 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 # endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS

@ -34,7 +34,7 @@ namespace glm
// -- Constructors -- // -- 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; GLM_FUNC_DECL mat(mat<3, 3, T, P> const & m) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL mat(mat<3, 3, T, Q> const & m); GLM_FUNC_DECL mat(mat<3, 3, T, Q> const & m);

@ -7,16 +7,10 @@ namespace glm
{ {
// -- Constructors -- // -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER mat<3, 3, T, P>::mat() 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 # endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS

@ -35,7 +35,7 @@ namespace glm
// -- Constructors -- // -- 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; GLM_FUNC_DECL mat(mat<3, 4, T, P> const & m) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL mat(mat<3, 4, T, Q> const & m); GLM_FUNC_DECL mat(mat<3, 4, T, Q> const & m);

@ -5,16 +5,10 @@ namespace glm
{ {
// -- Constructors -- // -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER mat<3, 4, T, P>::mat() 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 # endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS

@ -35,7 +35,7 @@ namespace glm
// -- Constructors -- // -- 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; GLM_FUNC_DECL mat(mat<4, 2, T, P> const & m) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL mat(mat<4, 2, T, Q> const & m); GLM_FUNC_DECL mat(mat<4, 2, T, Q> const & m);

@ -5,17 +5,10 @@ namespace glm
{ {
// -- Constructors -- // -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER mat<4, 2, T, P>::mat() 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 # endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS

@ -35,7 +35,7 @@ namespace glm
// -- Constructors -- // -- 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; GLM_FUNC_DECL mat(mat<4, 3, T, P> const & m) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL mat(mat<4, 3, T, Q> const & m); GLM_FUNC_DECL mat(mat<4, 3, T, Q> const & m);

@ -5,17 +5,10 @@ namespace glm
{ {
// -- Constructors -- // -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER mat<4, 3, T, P>::mat() 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 # endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS

@ -34,7 +34,7 @@ namespace glm
// -- Constructors -- // -- 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; GLM_FUNC_DECL mat(mat<4, 4, T, P> const& m) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL mat(mat<4, 4, T, Q> const& m); GLM_FUNC_DECL mat(mat<4, 4, T, Q> const& m);

@ -7,17 +7,10 @@ namespace glm
{ {
// -- Constructors -- // -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER mat<4, 4, T, P>::mat() 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 # endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS

@ -85,7 +85,7 @@ namespace glm
// -- Implicit basic constructors -- // -- 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; GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec const& v) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, T, Q> const& v);

@ -5,12 +5,9 @@ namespace glm
{ {
// -- Implicit basic constructors -- // -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<1, T, P>::vec() 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 # endif//!GLM_HAS_DEFAULTED_FUNCTIONS

@ -86,7 +86,7 @@ namespace glm
// -- Implicit basic constructors -- // -- 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; GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec const& v) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<2, T, Q> const& v);

@ -5,12 +5,9 @@ namespace glm
{ {
// -- Implicit basic constructors -- // -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<2, T, P>::vec() 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 # endif//!GLM_HAS_DEFAULTED_FUNCTIONS

@ -86,7 +86,7 @@ namespace glm
// -- Implicit basic constructors -- // -- 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; GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec const & v) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<3, T, Q> const & v); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<3, T, Q> const & v);

@ -5,12 +5,9 @@ namespace glm
{ {
// -- Implicit basic constructors -- // -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<3, T, P>::vec() 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 # endif//!GLM_HAS_DEFAULTED_FUNCTIONS

@ -89,7 +89,7 @@ namespace glm
// -- Implicit basic constructors -- // -- 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; GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec(vec<4, T, P> const& v) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec(vec<4, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec(vec<4, T, Q> const& v);

@ -154,12 +154,9 @@ namespace detail
// -- Implicit basic constructors -- // -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, T, P>::vec() 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 # endif//!GLM_HAS_DEFAULTED_FUNCTIONS

@ -77,7 +77,7 @@ namespace glm
// -- Implicit basic constructors -- // -- 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<T, P> const& q) GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, P> const& q) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, Q> const& q); GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, Q> const& q);

@ -83,12 +83,9 @@ namespace detail
// -- Implicit basic constructors -- // -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat() GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat()
# ifndef GLM_FORCE_NO_CTOR_INIT
: x(0), y(0), z(0), w(1)
# endif
{} {}
# endif # endif
@ -294,19 +291,19 @@ namespace detail
// -- Binary operators -- // -- Binary operators --
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> operator+(tquat<T, P> const & q, tquat<T, P> const & p) GLM_FUNC_QUALIFIER tquat<T, P> operator+(tquat<T, P> const & q, tquat<T, P> const & p)
{ {
return tquat<T, P>(q) += p; return tquat<T, P>(q) += p;
} }
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER tquat<T, P> operator*(tquat<T, P> const & q, tquat<T, P> const & p) GLM_FUNC_QUALIFIER tquat<T, P> operator*(tquat<T, P> const & q, tquat<T, P> const & p)
{ {
return tquat<T, P>(q) *= p; return tquat<T, P>(q) *= p;
} }
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER vec<3, T, P> operator*(tquat<T, P> const & q, vec<3, T, P> const & v) GLM_FUNC_QUALIFIER vec<3, T, P> operator*(tquat<T, P> 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 QuatVector(q.x, q.y, q.z);
vec<3, T, P> const uv(glm::cross(QuatVector, v)); vec<3, T, P> const uv(glm::cross(QuatVector, v));

@ -56,7 +56,7 @@ namespace glm
// -- Implicit basic constructors -- // -- 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<T, P> const & d) GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, P> const & d) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, Q> const & d); GLM_FUNC_DECL GLM_CONSTEXPR tdualquat(tdualquat<T, Q> const & d);

@ -24,13 +24,9 @@ namespace glm
// -- Implicit basic constructors -- // -- Implicit basic constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT) # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat<T, P>::tdualquat() GLM_FUNC_QUALIFIER GLM_CONSTEXPR tdualquat<T, P>::tdualquat()
# ifndef GLM_FORCE_NO_CTOR_INIT
: real(tquat<T, P>())
, dual(tquat<T, P>(0, 0, 0, 0))
# endif
{} {}
# endif # endif

@ -22,9 +22,8 @@
+ [3.4. SIMD support](#section3_4) + [3.4. SIMD support](#section3_4)
+ [3.5. Force inline](#section3_5) + [3.5. Force inline](#section3_5)
+ [3.6. Vector and matrix static size](#section3_6) + [3.6. Vector and matrix static size](#section3_6)
+ [3.7. Disabling default constructor initialization](#section3_7) + [3.7. Requiring explicit conversions](#section3_7)
+ [3.8. Requiring explicit conversions](#section3_8) + [3.8. Removing genType restriction](#section3_8)
+ [3.9. Removing genType restriction](#section3_9)
+ [4. Stable extensions](#section4) + [4. Stable extensions](#section4)
+ [4.1. GLM_GTC_bitfield](#section4_1) + [4.1. GLM_GTC_bitfield](#section4_1)
+ [4.2. GLM_GTC_color_space](#section4_2) + [4.2. GLM_GTC_color_space](#section4_2)
@ -469,49 +468,7 @@ void foo(vec4 const & v)
} }
``` ```
### <a name="section3_7"></a> 3.7. Disabling default constructor initialization ### <a name="section3_7"></a> 3.7. Requiring explicit conversions
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 &lt;glm/glm.hpp&gt; or other GLM include.
GLM default behavior:
```cpp
#include <glm/glm.hpp>
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 <glm/glm.hpp>
void foo()
{
glm::vec4 v; // v is filled with garbage
...
}
```
Alternatively, GLM allows to explicitly not initialize a variable:
```cpp
#include <glm/glm.hpp>
void foo()
{
glm::vec4 v(glm::uninitialize);
...
}
```
### <a name="section3_8"></a> 3.8. Require explicit conversions
GLSL supports implicit conversions of vector and matrix types. For example, an ivec4 can be implicitly converted into vec4. 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()
} }
``` ```
### <a name="section3_9"></a> 3.9. Removing genType restriction ### <a name="section3_8"></a> 3.8. Removing genType restriction
By default GLM only supports basic types as genType for vector, matrix and quaternion types: By default GLM only supports basic types as genType for vector, matrix and quaternion types:

@ -64,6 +64,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Added quatLookAt to GTX_quaternion #659 - Added quatLookAt to GTX_quaternion #659
#### Improvements: #### Improvements:
- No more default initialization of vector, matrix and quaternion types
- Added lowp variant of GTC_color_space convertLinearToSRGB #419 - Added lowp variant of GTC_color_space convertLinearToSRGB #419
- Replaced the manual by a markdown version #458 - Replaced the manual by a markdown version #458
- Optimized GTC_packing implementation - Optimized GTC_packing implementation

Loading…
Cancel
Save