diff --git a/src/core/math/Matrix3.h b/src/core/math/Matrix3.h index b206d484dfcc17ce47a11b667f75b2cfc176b1f4..665c6529ee6bd898fd2d353950a25255eb4921c0 100644 --- a/src/core/math/Matrix3.h +++ b/src/core/math/Matrix3.h @@ -95,11 +95,11 @@ private: public: //**Constructors***************************************************************************************************** - explicit inline Matrix3() = default; - explicit inline Matrix3( Type init ); - explicit inline Matrix3( const Vector3<Type>& a, const Vector3<Type>& b, const Vector3<Type>& c ); - explicit inline Matrix3( Type xx, Type xy, Type xz, Type yx, Type yy, Type yz, Type zx, Type zy, Type zz ); - explicit inline Matrix3( const Type* init ); + explicit inline constexpr Matrix3() = default; + explicit inline constexpr Matrix3( Type init ); + explicit inline constexpr Matrix3( const Vector3<Type>& a, const Vector3<Type>& b, const Vector3<Type>& c ); + explicit inline constexpr Matrix3( Type xx, Type xy, Type xz, Type yx, Type yy, Type yz, Type zx, Type zy, Type zz ); + explicit inline constexpr Matrix3( const Type* init ); template< typename Axis, typename Angle > explicit Matrix3( Vector3<Axis> axis, Angle angle ); @@ -274,7 +274,7 @@ static_assert( std::is_trivially_copyable<Matrix3<real_t>>::value, "Matrix3<real // \param init Initial value for all matrix elements. */ template< typename Type > -inline Matrix3<Type>::Matrix3( Type init ) +inline constexpr Matrix3<Type>::Matrix3( Type init ) { v_[0] = v_[1] = v_[2] = v_[3] = v_[4] = v_[5] = v_[6] = v_[7] = v_[8] = init; } @@ -289,7 +289,7 @@ inline Matrix3<Type>::Matrix3( Type init ) // \param c The third column of the matrix. //********************************************************************************************************************** template< typename Type > -inline Matrix3<Type>::Matrix3( const Vector3<Type>& a, const Vector3<Type>& b, const Vector3<Type>& c ) +inline constexpr Matrix3<Type>::Matrix3( const Vector3<Type>& a, const Vector3<Type>& b, const Vector3<Type>& c ) { v_[0] = a[0]; v_[1] = b[0]; v_[2] = c[0]; v_[3] = a[1]; v_[4] = b[1]; v_[5] = c[1]; @@ -313,9 +313,9 @@ inline Matrix3<Type>::Matrix3( const Vector3<Type>& a, const Vector3<Type>& b, c // \param zz The initial value for the zz-component. */ template< typename Type > -inline Matrix3<Type>::Matrix3( Type xx, Type xy, Type xz, - Type yx, Type yy, Type yz, - Type zx, Type zy, Type zz ) +inline constexpr Matrix3<Type>::Matrix3( Type xx, Type xy, Type xz, + Type yx, Type yy, Type yz, + Type zx, Type zy, Type zz ) { v_[0] = xx; v_[1] = xy; v_[2] = xz; v_[3] = yx; v_[4] = yy; v_[5] = yz; @@ -333,7 +333,7 @@ inline Matrix3<Type>::Matrix3( Type xx, Type xy, Type xz, // The array is assumed to have at least nine valid elements. */ template< typename Type > -inline Matrix3<Type>::Matrix3( const Type* init ) +inline constexpr Matrix3<Type>::Matrix3( const Type* init ) { v_[0] = init[0]; v_[1] = init[1]; diff --git a/src/core/math/Vector3.h b/src/core/math/Vector3.h index 7bc9e87af1f534aa694f1c8302dd4b9124b15a2b..8bc4e3233cd650905c39adedcdc4e6922ba6799e 100644 --- a/src/core/math/Vector3.h +++ b/src/core/math/Vector3.h @@ -101,15 +101,15 @@ public: //******************************************************************************************************************* //**Constructors***************************************************************************************************** - explicit inline Vector3() = default; - explicit inline Vector3( Type init ); - template< typename Other > explicit inline Vector3( Other init ); - explicit inline Vector3( Type x, Type y, Type z ); - explicit inline Vector3( const Type* init ); - inline Vector3( const Vector3& v ) = default; + explicit inline constexpr Vector3() = default; + explicit inline constexpr Vector3( Type init ); + template< typename Other > explicit inline constexpr Vector3( Other init ); + explicit inline constexpr Vector3( Type x, Type y, Type z ); + explicit inline constexpr Vector3( const Type* init ); + inline constexpr Vector3( const Vector3& v ) = default; template< typename Other > - inline Vector3( const Vector3<Other>& v ); + inline constexpr Vector3( const Vector3<Other>& v ); //******************************************************************************************************************* //**Destructor******************************************************************************************************* @@ -208,7 +208,7 @@ Vector3<T> & normalize( Vector3<T> & v ); // \param init Initial value for all vector elements. */ template< typename Type > -inline Vector3<Type>::Vector3( Type init ) +inline constexpr Vector3<Type>::Vector3( Type init ) { v_[0] = v_[1] = v_[2] = init; } @@ -223,7 +223,7 @@ inline Vector3<Type>::Vector3( Type init ) */ template< typename Type > template< typename Other > -inline Vector3<Type>::Vector3( Other init ) +inline constexpr Vector3<Type>::Vector3( Other init ) { static_assert( std::is_arithmetic<Other>::value, "Vector3 only accepts arithmetic data types in Vector3( Other init )"); @@ -241,7 +241,7 @@ inline Vector3<Type>::Vector3( Other init ) // \param z The initial value for the z-component. */ template< typename Type > -inline Vector3<Type>::Vector3( Type x, Type y, Type z ) +inline constexpr Vector3<Type>::Vector3( Type x, Type y, Type z ) { v_[0] = x; v_[1] = y; @@ -259,7 +259,7 @@ inline Vector3<Type>::Vector3( Type x, Type y, Type z ) // The array is assumed to have at least three valid elements. */ template< typename Type > -inline Vector3<Type>::Vector3( const Type* init ) +inline constexpr Vector3<Type>::Vector3( const Type* init ) { v_[0] = init[0]; v_[1] = init[1]; @@ -276,7 +276,7 @@ inline Vector3<Type>::Vector3( const Type* init ) */ template< typename Type > template< typename Other > -inline Vector3<Type>::Vector3( const Vector3<Other>& v ) +inline constexpr Vector3<Type>::Vector3( const Vector3<Other>& v ) { v_[0] = numeric_cast<Type>( v.v_[0] ); v_[1] = numeric_cast<Type>( v.v_[1] );