Add static components and prec members to all vector and quaternion types
This commit is contained in:
@@ -8,14 +8,14 @@
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -54,7 +54,13 @@ namespace glm
|
||||
typedef tvec1<T, P> type;
|
||||
typedef tvec1<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
|
||||
# if GLM_HAS_CONSTEXPR
|
||||
static GLM_CONSTEXPR length_t components = 1;
|
||||
static GLM_CONSTEXPR precision prec = P;
|
||||
# else
|
||||
static const length_t components = 1;
|
||||
static const precision prec = P;
|
||||
# endif
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
@@ -120,7 +126,7 @@ namespace glm
|
||||
|
||||
//////////////////////////////////////
|
||||
// Conversion vector constructors
|
||||
|
||||
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, precision Q>
|
||||
GLM_FUNC_DECL explicit tvec1(tvec2<U, Q> const & v);
|
||||
@@ -157,23 +163,23 @@ namespace glm
|
||||
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator=(tvec1<T, P> const & v);
|
||||
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator+=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator+=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator-=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator-=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator*=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator*=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator/=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator/=(tvec1<U, P> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
@@ -187,29 +193,29 @@ namespace glm
|
||||
//////////////////////////////////////
|
||||
// Unary bit operators
|
||||
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator%=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator%=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator&=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator&=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator|=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator|=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator^=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator^=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator<<=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator<<=(tvec1<U, P> const & v);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator>>=(U const & s);
|
||||
template <typename U>
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tvec1<T, P> & operator>>=(tvec1<U, P> const & v);
|
||||
};
|
||||
|
||||
@@ -313,7 +319,7 @@ namespace glm
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec1<T, P> operator>>(tvec1<T, P> const & v1, tvec1<T, P> const & v2);
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec1<T, P> operator~(tvec1<T, P> const & v);
|
||||
}//namespace glm
|
||||
|
||||
|
||||
@@ -54,6 +54,13 @@ namespace glm
|
||||
typedef tvec2<T, P> type;
|
||||
typedef tvec2<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
# if GLM_HAS_CONSTEXPR
|
||||
static GLM_CONSTEXPR length_t components = 2;
|
||||
static GLM_CONSTEXPR precision prec = P;
|
||||
# else
|
||||
static const length_t components = 2;
|
||||
static const precision prec = P;
|
||||
# endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
@@ -54,6 +54,13 @@ namespace glm
|
||||
typedef tvec3<T, P> type;
|
||||
typedef tvec3<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
# if GLM_HAS_CONSTEXPR
|
||||
static GLM_CONSTEXPR length_t components = 3;
|
||||
static GLM_CONSTEXPR precision prec = P;
|
||||
# else
|
||||
static const length_t components = 3;
|
||||
static const precision prec = P;
|
||||
# endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
@@ -108,6 +108,13 @@ namespace detail
|
||||
typedef tvec4<T, P> type;
|
||||
typedef tvec4<bool, P> bool_type;
|
||||
typedef T value_type;
|
||||
# if GLM_HAS_CONSTEXPR
|
||||
static GLM_CONSTEXPR length_t components = 4;
|
||||
static GLM_CONSTEXPR precision prec = P;
|
||||
# else
|
||||
static const length_t components = 4;
|
||||
static const precision prec = P;
|
||||
# endif
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
@@ -64,6 +64,13 @@ namespace glm
|
||||
{
|
||||
typedef tquat<T, P> type;
|
||||
typedef T value_type;
|
||||
# if GLM_HAS_CONSTEXPR
|
||||
static GLM_CONSTEXPR length_t components = 4;
|
||||
static GLM_CONSTEXPR precision prec = P;
|
||||
# else
|
||||
static const length_t components = 4;
|
||||
static const precision prec = P;
|
||||
# endif
|
||||
|
||||
public:
|
||||
T x, y, z, w;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -63,10 +63,17 @@ namespace glm
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef glm::tquat<T, P> part_type;
|
||||
|
||||
# if GLM_HAS_CONSTEXPR
|
||||
static GLM_CONSTEXPR length_t components = 8;
|
||||
static GLM_CONSTEXPR precision prec = P;
|
||||
# else
|
||||
static const length_t components = 8;
|
||||
static const precision prec = P;
|
||||
# endif
|
||||
|
||||
public:
|
||||
glm::tquat<T, P> real, dual;
|
||||
|
||||
|
||||
//////////////////////////////////////
|
||||
// Component accesses
|
||||
|
||||
@@ -115,7 +122,7 @@ namespace glm
|
||||
|
||||
GLM_FUNC_DECL explicit tdualquat(tmat2x4<T, P> const & holder_mat);
|
||||
GLM_FUNC_DECL explicit tdualquat(tmat3x4<T, P> const & aug_mat);
|
||||
|
||||
|
||||
// Operators
|
||||
GLM_FUNC_DECL tdualquat<T, P> & operator=(tdualquat<T, P> const & m);
|
||||
|
||||
@@ -126,51 +133,51 @@ namespace glm
|
||||
template <typename U>
|
||||
GLM_FUNC_DECL tdualquat<T, P> & operator/=(U s);
|
||||
};
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator- (
|
||||
tquat<T, P> const & q);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tdualquat<T, P> operator+ (
|
||||
tdualquat<T, P> const & q,
|
||||
tdualquat<T, P> const & p);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tdualquat<T, P> operator* (
|
||||
tdualquat<T, P> const & q,
|
||||
tdualquat<T, P> const & p);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator* (
|
||||
tquat<T, P> const & q,
|
||||
tvec3<T, P> const & v);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec3<T, P> operator* (
|
||||
tvec3<T, P> const & v,
|
||||
tquat<T, P> const & q);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator* (
|
||||
tquat<T, P> const & q,
|
||||
tvec4<T, P> const & v);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tvec4<T, P> operator* (
|
||||
tvec4<T, P> const & v,
|
||||
tquat<T, P> const & q);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tdualquat<T, P> operator* (
|
||||
tdualquat<T, P> const & q,
|
||||
T const & s);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tdualquat<T, P> operator* (
|
||||
T const & s,
|
||||
tdualquat<T, P> const & q);
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL tdualquat<T, P> operator/ (
|
||||
tdualquat<T, P> const & q,
|
||||
@@ -227,17 +234,17 @@ namespace glm
|
||||
GLM_FUNC_DECL tdualquat<T, P> dualquat_cast(
|
||||
tmat3x4<T, P> const & x);
|
||||
|
||||
|
||||
|
||||
/// Dual-quaternion of low single-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<float, lowp> lowp_dualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of medium single-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<float, mediump> mediump_dualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of high single-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
@@ -248,40 +255,40 @@ namespace glm
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<float, lowp> lowp_fdualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of medium single-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<float, mediump> mediump_fdualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of high single-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<float, highp> highp_fdualquat;
|
||||
|
||||
|
||||
|
||||
|
||||
/// Dual-quaternion of low double-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<double, lowp> lowp_ddualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of medium double-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<double, mediump> mediump_ddualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of high double-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef tdualquat<double, highp> highp_ddualquat;
|
||||
|
||||
|
||||
|
||||
#if(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
|
||||
/// Dual-quaternion of floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
typedef highp_fdualquat dualquat;
|
||||
|
||||
|
||||
/// Dual-quaternion of single-precision floating-point numbers.
|
||||
///
|
||||
/// @see gtx_dual_quaternion
|
||||
@@ -298,7 +305,7 @@ namespace glm
|
||||
#else
|
||||
# error "GLM error: multiple default precision requested for single-precision floating-point types"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
|
||||
/// Dual-quaternion of default double-precision floating-point numbers.
|
||||
|
||||
@@ -75,6 +75,13 @@ namespace detail
|
||||
|
||||
typedef fquatSIMD type;
|
||||
typedef tquat<bool, defaultp> bool_type;
|
||||
# if GLM_HAS_CONSTEXPR
|
||||
static GLM_CONSTEXPR length_t components = 1;
|
||||
static GLM_CONSTEXPR precision prec = defaultp;
|
||||
# else
|
||||
static const length_t components = 1;
|
||||
static const precision prec = defaultp;
|
||||
# endif
|
||||
|
||||
#ifdef GLM_SIMD_ENABLE_XYZW_UNION
|
||||
union
|
||||
|
||||
@@ -98,6 +98,13 @@ namespace detail
|
||||
|
||||
typedef fvec4SIMD type;
|
||||
typedef tvec4<bool, highp> bool_type;
|
||||
# if GLM_HAS_CONSTEXPR
|
||||
static GLM_CONSTEXPR length_t components = 1;
|
||||
static GLM_CONSTEXPR precision prec = defaultp;
|
||||
# else
|
||||
static const length_t components = 1;
|
||||
static const precision prec = defaultp;
|
||||
# endif
|
||||
|
||||
#ifdef GLM_SIMD_ENABLE_XYZW_UNION
|
||||
union
|
||||
|
||||
Reference in New Issue
Block a user