Add IDENTITY and ZERO constants for all matrices

- Tests, too
master
Jesse Talavera-Greenberg ago%!(EXTRA string=10 years)
parent d1cdb46cfb
commit 9604a7549f
  1. 4
      glm/detail/type_mat2x2.hpp
  2. 7
      glm/detail/type_mat2x2.inl
  3. 5
      glm/detail/type_mat2x3.hpp
  4. 7
      glm/detail/type_mat2x3.inl
  5. 5
      glm/detail/type_mat2x4.hpp
  6. 7
      glm/detail/type_mat2x4.inl
  7. 5
      glm/detail/type_mat3x2.hpp
  8. 7
      glm/detail/type_mat3x2.inl
  9. 5
      glm/detail/type_mat3x3.hpp
  10. 8
      glm/detail/type_mat3x3.inl
  11. 5
      glm/detail/type_mat3x4.hpp
  12. 7
      glm/detail/type_mat3x4.inl
  13. 5
      glm/detail/type_mat4x2.hpp
  14. 7
      glm/detail/type_mat4x2.inl
  15. 5
      glm/detail/type_mat4x3.hpp
  16. 7
      glm/detail/type_mat4x3.inl
  17. 5
      glm/detail/type_mat4x4.hpp
  18. 7
      glm/detail/type_mat4x4.inl
  19. 11
      test/core/core_type_mat2x2.cpp
  20. 12
      test/core/core_type_mat2x3.cpp
  21. 11
      test/core/core_type_mat2x4.cpp
  22. 12
      test/core/core_type_mat3x2.cpp
  23. 11
      test/core/core_type_mat3x3.cpp
  24. 11
      test/core/core_type_mat3x4.cpp
  25. 11
      test/core/core_type_mat4x2.cpp
  26. 11
      test/core/core_type_mat4x3.cpp
  27. 11
      test/core/core_type_mat4x4.cpp

@ -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];

@ -50,6 +50,13 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x2<T, P> tmat2x2<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x2<T, P> tmat2x2<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

@ -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];

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x3<T, P> tmat2x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x3<T, P> tmat2x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

@ -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];

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat2x4<T, P> tmat2x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat2x4<T, P> tmat2x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

@ -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];

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x2<T, P> tmat3x2<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x2<T, P> tmat3x2<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

@ -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 <typename U, precision Q>
friend tvec3<U, Q> operator/(tmat3x3<U, Q> const & m, tvec3<U, Q> const & v);
template <typename U, precision Q>

@ -56,6 +56,14 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x3<T, P> tmat3x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x3<T, P> tmat3x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

@ -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];

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat3x4<T, P> tmat3x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat3x4<T, P> tmat3x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

@ -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];

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat4x2<T, P> tmat4x2<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat4x2<T, P> tmat4x2<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

@ -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];

@ -32,6 +32,13 @@
namespace glm
{
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat4x3<T, P> tmat4x3<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat4x3<T, P> tmat4x3<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

@ -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 <typename U, precision Q>
friend tvec4<U, Q> operator/(tmat4x4<U, Q> const & m, tvec4<U, Q> const & v);
template <typename U, precision Q>

@ -92,6 +92,13 @@ namespace detail
}
}//namespace detail
# ifdef GLM_STATIC_CONST_MEMBERS
template<typename T, precision P>
const tmat4x4<T, P> tmat4x4<T, P>::ZERO(static_cast<T>(0));
template<typename T, precision P>
const tmat4x4<T, P> tmat4x4<T, P>::IDENTITY(static_cast<T>(1));
# endif
// -- Constructors --
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>
@ -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();

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -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 <typename genType>
@ -147,6 +158,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -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();

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -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 <typename genType>
@ -152,6 +163,7 @@ int main()
Error += cast::test();
Error += test_ctr();
Error += test_static_const();
Error += test_operators();
return Error;

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
#include <glm/vector_relational.hpp>
@ -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 <typename genType>
@ -210,6 +220,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_mat3x3();
Error += test_operators();

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -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 <typename genType>
@ -151,6 +161,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -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 <typename genType>
@ -155,6 +165,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/vector_relational.hpp>
#include <glm/mat2x2.hpp>
#include <glm/mat2x3.hpp>
@ -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 <typename genType>
@ -155,6 +165,7 @@ int main()
#endif
Error += cast::test();
Error += test_static_const();
Error += test_ctr();
Error += test_operators();

@ -29,6 +29,7 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#define GLM_SIMD
#include <glm/gtc/epsilon.hpp>
#include <glm/matrix.hpp>
@ -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 <typename genType>
@ -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();

Loading…
Cancel
Save