Wrap tquat's, simdQuat's and simdVec4's static constants in GLM_STATIC_CONST_MEMBERS

- Also, fixed indentation
This commit is contained in:
Jesse Talavera-Greenberg 2015-10-05 18:27:07 -04:00
parent 5df08dfc78
commit d1cdb46cfb
7 changed files with 94 additions and 81 deletions

View file

@ -76,6 +76,7 @@ namespace glm
T x, y, z, w;
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
@ -92,6 +93,7 @@ namespace glm
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
// -- Component accesses --

View file

@ -49,69 +49,71 @@ namespace detail
};
}//namespace detail
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::ZERO =
tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
# ifdef GLM_STATIC_CONST_MEMBERS
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::ZERO =
tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::X =
tquat<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::X =
tquat<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::Y =
tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::Y =
tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::Z =
tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::Z =
tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::W =
tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::W =
tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XY =
tquat<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XY =
tquat<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XZ =
tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XZ =
tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YZ =
tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YZ =
tquat<T, P>(static_cast<T>(0), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::ZW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::ZW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYZ =
tquat<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYZ =
tquat<T, P>(static_cast<T>(0), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(0));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XZW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XZW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(0), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YZW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::YZW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYZW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
template <typename T, precision P>
const tquat<T, P> tquat<T, P>::XYZW =
tquat<T, P>(static_cast<T>(1), static_cast<T>(1), static_cast<T>(1), static_cast<T>(1));
# endif
// -- Component accesses --
# ifdef GLM_FORCE_SIZE_FUNC

View file

@ -91,6 +91,7 @@ namespace detail
__m128 Data;
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
@ -107,6 +108,7 @@ namespace detail
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
//////////////////////////////////////
// Implicit basic constructors

View file

@ -51,23 +51,24 @@ void print(const fvec4SIMD &v)
}
#endif
const fquatSIMD fquatSIMD::ZERO = fquatSIMD(0, 0, 0, 0);
const fquatSIMD fquatSIMD::X = fquatSIMD(0, 1, 0, 0);
const fquatSIMD fquatSIMD::Y = fquatSIMD(0, 0, 1, 0);
const fquatSIMD fquatSIMD::Z = fquatSIMD(0, 0, 0, 1);
const fquatSIMD fquatSIMD::W = fquatSIMD(1, 0, 0, 0);
const fquatSIMD fquatSIMD::XY = fquatSIMD(0, 1, 1, 0);
const fquatSIMD fquatSIMD::XZ = fquatSIMD(0, 1, 0, 1);
const fquatSIMD fquatSIMD::XW = fquatSIMD(1, 1, 0, 0);
const fquatSIMD fquatSIMD::YZ = fquatSIMD(0, 0, 1, 1);
const fquatSIMD fquatSIMD::YW = fquatSIMD(1, 0, 1, 0);
const fquatSIMD fquatSIMD::ZW = fquatSIMD(1, 0, 0, 1);
const fquatSIMD fquatSIMD::XYZ = fquatSIMD(0, 1, 1, 1);
const fquatSIMD fquatSIMD::XYW = fquatSIMD(1, 1, 1, 0);
const fquatSIMD fquatSIMD::XZW = fquatSIMD(1, 1, 0, 1);
const fquatSIMD fquatSIMD::YZW = fquatSIMD(1, 0, 1, 1);
const fquatSIMD fquatSIMD::XYZW = fquatSIMD(1, 1, 1, 1);
# ifdef GLM_STATIC_CONST_MEMBERS
const fquatSIMD fquatSIMD::ZERO = fquatSIMD(0, 0, 0, 0);
const fquatSIMD fquatSIMD::X = fquatSIMD(0, 1, 0, 0);
const fquatSIMD fquatSIMD::Y = fquatSIMD(0, 0, 1, 0);
const fquatSIMD fquatSIMD::Z = fquatSIMD(0, 0, 0, 1);
const fquatSIMD fquatSIMD::W = fquatSIMD(1, 0, 0, 0);
const fquatSIMD fquatSIMD::XY = fquatSIMD(0, 1, 1, 0);
const fquatSIMD fquatSIMD::XZ = fquatSIMD(0, 1, 0, 1);
const fquatSIMD fquatSIMD::XW = fquatSIMD(1, 1, 0, 0);
const fquatSIMD fquatSIMD::YZ = fquatSIMD(0, 0, 1, 1);
const fquatSIMD fquatSIMD::YW = fquatSIMD(1, 0, 1, 0);
const fquatSIMD fquatSIMD::ZW = fquatSIMD(1, 0, 0, 1);
const fquatSIMD fquatSIMD::XYZ = fquatSIMD(0, 1, 1, 1);
const fquatSIMD fquatSIMD::XYW = fquatSIMD(1, 1, 1, 0);
const fquatSIMD fquatSIMD::XZW = fquatSIMD(1, 1, 0, 1);
const fquatSIMD fquatSIMD::YZW = fquatSIMD(1, 0, 1, 1);
const fquatSIMD fquatSIMD::XYZW = fquatSIMD(1, 1, 1, 1);
# endif
//////////////////////////////////////
// Implicit basic constructors

View file

@ -114,6 +114,7 @@ namespace detail
__m128 Data;
#endif
# ifdef GLM_STATIC_CONST_MEMBERS
static const type ZERO;
static const type X;
static const type Y;
@ -130,6 +131,7 @@ namespace detail
static const type XZW;
static const type YZW;
static const type XYZW;
# endif
//////////////////////////////////////
// Implicit basic constructors

View file

@ -16,22 +16,24 @@ struct shuffle_mask
enum{value = Value};
};
const fvec4SIMD fvec4SIMD::ZERO = fvec4SIMD(0, 0, 0, 0);
const fvec4SIMD fvec4SIMD::X = fvec4SIMD(1, 0, 0, 0);
const fvec4SIMD fvec4SIMD::Y = fvec4SIMD(0, 1, 0, 0);
const fvec4SIMD fvec4SIMD::Z = fvec4SIMD(0, 0, 1, 0);
const fvec4SIMD fvec4SIMD::W = fvec4SIMD(0, 0, 0, 1);
const fvec4SIMD fvec4SIMD::XY = fvec4SIMD(1, 1, 0, 0);
const fvec4SIMD fvec4SIMD::XZ = fvec4SIMD(1, 0, 1, 0);
const fvec4SIMD fvec4SIMD::XW = fvec4SIMD(1, 0, 0, 1);
const fvec4SIMD fvec4SIMD::YZ = fvec4SIMD(0, 1, 1, 0);
const fvec4SIMD fvec4SIMD::YW = fvec4SIMD(0, 1, 0, 1);
const fvec4SIMD fvec4SIMD::ZW = fvec4SIMD(0, 0, 1, 1);
const fvec4SIMD fvec4SIMD::XYZ = fvec4SIMD(1, 1, 1, 0);
const fvec4SIMD fvec4SIMD::XYW = fvec4SIMD(1, 1, 0, 1);
const fvec4SIMD fvec4SIMD::XZW = fvec4SIMD(1, 0, 1, 1);
const fvec4SIMD fvec4SIMD::YZW = fvec4SIMD(0, 1, 1, 1);
const fvec4SIMD fvec4SIMD::XYZW = fvec4SIMD(1, 1, 1, 1);
# ifdef GLM_STATIC_CONST_MEMBERS
const fvec4SIMD fvec4SIMD::ZERO = fvec4SIMD(0, 0, 0, 0);
const fvec4SIMD fvec4SIMD::X = fvec4SIMD(1, 0, 0, 0);
const fvec4SIMD fvec4SIMD::Y = fvec4SIMD(0, 1, 0, 0);
const fvec4SIMD fvec4SIMD::Z = fvec4SIMD(0, 0, 1, 0);
const fvec4SIMD fvec4SIMD::W = fvec4SIMD(0, 0, 0, 1);
const fvec4SIMD fvec4SIMD::XY = fvec4SIMD(1, 1, 0, 0);
const fvec4SIMD fvec4SIMD::XZ = fvec4SIMD(1, 0, 1, 0);
const fvec4SIMD fvec4SIMD::XW = fvec4SIMD(1, 0, 0, 1);
const fvec4SIMD fvec4SIMD::YZ = fvec4SIMD(0, 1, 1, 0);
const fvec4SIMD fvec4SIMD::YW = fvec4SIMD(0, 1, 0, 1);
const fvec4SIMD fvec4SIMD::ZW = fvec4SIMD(0, 0, 1, 1);
const fvec4SIMD fvec4SIMD::XYZ = fvec4SIMD(1, 1, 1, 0);
const fvec4SIMD fvec4SIMD::XYW = fvec4SIMD(1, 1, 0, 1);
const fvec4SIMD fvec4SIMD::XZW = fvec4SIMD(1, 0, 1, 1);
const fvec4SIMD fvec4SIMD::YZW = fvec4SIMD(0, 1, 1, 1);
const fvec4SIMD fvec4SIMD::XYZW = fvec4SIMD(1, 1, 1, 1);
# endif
//////////////////////////////////////
// Implicit basic constructors

View file

@ -29,6 +29,8 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/glm.hpp>
#include <glm/gtx/simd_vec4.hpp>
#include <cstdio>