mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-14 18:40:43 +00:00
Add glm 0.9.2
This commit is contained in:
parent
21545e1a24
commit
c4b531ed5e
218 changed files with 46187 additions and 0 deletions
365
ExternalLibs/glm/gtc/half_float.hpp
Normal file
365
ExternalLibs/glm/gtc/half_float.hpp
Normal file
|
@ -0,0 +1,365 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2009-04-29
|
||||
// Updated : 2010-02-07
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/half_float.hpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_gtc_half_float
|
||||
#define glm_gtc_half_float
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTC_half_float extension included")
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
#ifndef _MSC_EXTENSIONS
|
||||
template <>
|
||||
struct tvec2<thalf>
|
||||
{
|
||||
enum ctor{null};
|
||||
typedef thalf value_type;
|
||||
typedef std::size_t size_type;
|
||||
static size_type value_size();
|
||||
|
||||
typedef tvec2<thalf> type;
|
||||
typedef tvec2<bool> bool_type;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
thalf x, y;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
thalf & operator[](size_type i);
|
||||
thalf const & operator[](size_type i) const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
||||
tvec2();
|
||||
tvec2(tvec2<thalf> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Explicit basic constructors
|
||||
|
||||
explicit tvec2(ctor);
|
||||
explicit tvec2(
|
||||
thalf const & s);
|
||||
explicit tvec2(
|
||||
thalf const & s1,
|
||||
thalf const & s2);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
||||
tvec2(tref2<thalf> const & r);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion scalar constructors
|
||||
|
||||
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U>
|
||||
explicit tvec2(U const & x);
|
||||
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, typename V>
|
||||
explicit tvec2(U const & x, V const & y);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion vector constructors
|
||||
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U>
|
||||
explicit tvec2(tvec2<U> const & v);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U>
|
||||
explicit tvec2(tvec3<U> const & v);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U>
|
||||
explicit tvec2(tvec4<U> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
tvec2<thalf>& operator= (tvec2<thalf> const & v);
|
||||
|
||||
tvec2<thalf>& operator+=(thalf const & s);
|
||||
tvec2<thalf>& operator+=(tvec2<thalf> const & v);
|
||||
tvec2<thalf>& operator-=(thalf const & s);
|
||||
tvec2<thalf>& operator-=(tvec2<thalf> const & v);
|
||||
tvec2<thalf>& operator*=(thalf const & s);
|
||||
tvec2<thalf>& operator*=(tvec2<thalf> const & v);
|
||||
tvec2<thalf>& operator/=(thalf const & s);
|
||||
tvec2<thalf>& operator/=(tvec2<thalf> const & v);
|
||||
tvec2<thalf>& operator++();
|
||||
tvec2<thalf>& operator--();
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle operators
|
||||
|
||||
thalf swizzle(comp X) const;
|
||||
tvec2<thalf> swizzle(comp X, comp Y) const;
|
||||
tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
|
||||
tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
|
||||
tref2<thalf> swizzle(comp X, comp Y);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct tvec3<thalf>
|
||||
{
|
||||
enum ctor{null};
|
||||
typedef thalf value_type;
|
||||
typedef std::size_t size_type;
|
||||
static size_type value_size();
|
||||
|
||||
typedef tvec3<thalf> type;
|
||||
typedef tvec3<bool> bool_type;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
thalf x, y, z;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
thalf & operator[](size_type i);
|
||||
thalf const & operator[](size_type i) const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
||||
tvec3();
|
||||
tvec3(tvec3<thalf> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Explicit basic constructors
|
||||
|
||||
explicit tvec3(ctor);
|
||||
explicit tvec3(
|
||||
thalf const & s);
|
||||
explicit tvec3(
|
||||
thalf const & s1,
|
||||
thalf const & s2,
|
||||
thalf const & s3);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
||||
tvec3(tref3<thalf> const & r);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion scalar constructors
|
||||
|
||||
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U>
|
||||
explicit tvec3(U const & x);
|
||||
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U, typename V, typename W>
|
||||
explicit tvec3(U const & x, V const & y, W const & z);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion vector constructors
|
||||
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B>
|
||||
explicit tvec3(tvec2<A> const & v, B const & s);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B>
|
||||
explicit tvec3(A const & s, tvec2<B> const & v);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U>
|
||||
explicit tvec3(tvec3<U> const & v);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U>
|
||||
explicit tvec3(tvec4<U> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
tvec3<thalf>& operator= (tvec3<thalf> const & v);
|
||||
|
||||
tvec3<thalf>& operator+=(thalf const & s);
|
||||
tvec3<thalf>& operator+=(tvec3<thalf> const & v);
|
||||
tvec3<thalf>& operator-=(thalf const & s);
|
||||
tvec3<thalf>& operator-=(tvec3<thalf> const & v);
|
||||
tvec3<thalf>& operator*=(thalf const & s);
|
||||
tvec3<thalf>& operator*=(tvec3<thalf> const & v);
|
||||
tvec3<thalf>& operator/=(thalf const & s);
|
||||
tvec3<thalf>& operator/=(tvec3<thalf> const & v);
|
||||
tvec3<thalf>& operator++();
|
||||
tvec3<thalf>& operator--();
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle operators
|
||||
|
||||
thalf swizzle(comp X) const;
|
||||
tvec2<thalf> swizzle(comp X, comp Y) const;
|
||||
tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
|
||||
tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
|
||||
tref3<thalf> swizzle(comp X, comp Y, comp Z);
|
||||
};
|
||||
|
||||
template <>
|
||||
struct tvec4<thalf>
|
||||
{
|
||||
enum ctor{null};
|
||||
typedef thalf value_type;
|
||||
typedef std::size_t size_type;
|
||||
static size_type value_size();
|
||||
|
||||
typedef tvec4<thalf> type;
|
||||
typedef tvec4<bool> bool_type;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Data
|
||||
|
||||
thalf x, y, z, w;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
thalf & operator[](size_type i);
|
||||
thalf const & operator[](size_type i) const;
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
||||
tvec4();
|
||||
tvec4(tvec4<thalf> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Explicit basic constructors
|
||||
|
||||
explicit tvec4(ctor);
|
||||
explicit tvec4(
|
||||
thalf const & s);
|
||||
explicit tvec4(
|
||||
thalf const & s0,
|
||||
thalf const & s1,
|
||||
thalf const & s2,
|
||||
thalf const & s3);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
||||
tvec4(tref4<thalf> const & r);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion scalar constructors
|
||||
|
||||
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U>
|
||||
explicit tvec4(U const & x);
|
||||
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, typename C, typename D>
|
||||
explicit tvec4(A const & x, B const & y, C const & z, D const & w);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion vector constructors
|
||||
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, typename C>
|
||||
explicit tvec4(tvec2<A> const & v, B const & s1, C const & s2);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, typename C>
|
||||
explicit tvec4(A const & s1, tvec2<B> const & v, C const & s2);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B, typename C>
|
||||
explicit tvec4(A const & s1, B const & s2, tvec2<C> const & v);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B>
|
||||
explicit tvec4(tvec3<A> const & v, B const & s);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B>
|
||||
explicit tvec4(A const & s, tvec3<B> const & v);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename A, typename B>
|
||||
explicit tvec4(tvec2<A> const & v1, tvec2<B> const & v2);
|
||||
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
|
||||
template <typename U>
|
||||
explicit tvec4(tvec4<U> const & v);
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
tvec4<thalf>& operator= (tvec4<thalf> const & v);
|
||||
|
||||
tvec4<thalf>& operator+=(thalf const & s);
|
||||
tvec4<thalf>& operator+=(tvec4<thalf> const & v);
|
||||
tvec4<thalf>& operator-=(thalf const & s);
|
||||
tvec4<thalf>& operator-=(tvec4<thalf> const & v);
|
||||
tvec4<thalf>& operator*=(thalf const & s);
|
||||
tvec4<thalf>& operator*=(tvec4<thalf> const & v);
|
||||
tvec4<thalf>& operator/=(thalf const & s);
|
||||
tvec4<thalf>& operator/=(tvec4<thalf> const & v);
|
||||
tvec4<thalf>& operator++();
|
||||
tvec4<thalf>& operator--();
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle operators
|
||||
|
||||
thalf swizzle(comp X) const;
|
||||
tvec2<thalf> swizzle(comp X, comp Y) const;
|
||||
tvec3<thalf> swizzle(comp X, comp Y, comp Z) const;
|
||||
tvec4<thalf> swizzle(comp X, comp Y, comp Z, comp W) const;
|
||||
tref4<thalf> swizzle(comp X, comp Y, comp Z, comp W);
|
||||
};
|
||||
#endif//_MSC_EXTENSIONS
|
||||
}
|
||||
//namespace detail
|
||||
|
||||
namespace gtc{
|
||||
namespace half_float ///< GLM_GTC_half_float extension: Add support for half precision floating-point types
|
||||
{
|
||||
/// \addtogroup gtc_half_float
|
||||
///@{
|
||||
|
||||
/// Type for half-precision floating-point numbers.
|
||||
/// From GLM_GTC_half_float extension.
|
||||
typedef detail::thalf half;
|
||||
|
||||
/// Vector of 2 half-precision floating-point numbers.
|
||||
/// From GLM_GTC_half_float extension.
|
||||
typedef detail::tvec2<detail::thalf> hvec2;
|
||||
|
||||
/// Vector of 3 half-precision floating-point numbers.
|
||||
/// From GLM_GTC_half_float extension.
|
||||
typedef detail::tvec3<detail::thalf> hvec3;
|
||||
|
||||
/// Vector of 4 half-precision floating-point numbers.
|
||||
/// From GLM_GTC_half_float extension.
|
||||
typedef detail::tvec4<detail::thalf> hvec4;
|
||||
|
||||
/// 2 * 2 matrix of half-precision floating-point numbers.
|
||||
/// From GLM_GTC_half_float extension.
|
||||
typedef detail::tmat2x2<detail::thalf> hmat2;
|
||||
|
||||
/// 3 * 3 matrix of half-precision floating-point numbers.
|
||||
/// From GLM_GTC_half_float extension.
|
||||
typedef detail::tmat3x3<detail::thalf> hmat3;
|
||||
|
||||
/// 4 * 4 matrix of half-precision floating-point numbers.
|
||||
/// From GLM_GTC_half_float extension.
|
||||
typedef detail::tmat4x4<detail::thalf> hmat4;
|
||||
|
||||
/// @}
|
||||
|
||||
}// namespace half_float
|
||||
}// namespace gtc
|
||||
}// namespace glm
|
||||
|
||||
#include "half_float.inl"
|
||||
|
||||
namespace glm{using namespace gtc::half_float;}
|
||||
|
||||
#endif//glm_gtc_half_float
|
975
ExternalLibs/glm/gtc/half_float.inl
Normal file
975
ExternalLibs/glm/gtc/half_float.inl
Normal file
|
@ -0,0 +1,975 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2005-12-21
|
||||
// Updated : 2010-02-07
|
||||
// Licence : This source is under MIT licence
|
||||
// File : glm/gtc/half_float.inl
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace detail{
|
||||
|
||||
#ifndef _MSC_EXTENSIONS
|
||||
|
||||
//////////////////////////////////////
|
||||
// hvec2
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf>::size_type tvec2<thalf>::value_size()
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
GLM_FUNC_QUALIFIER thalf & tvec2<thalf>::operator[](tvec2<thalf>::size_type i)
|
||||
{
|
||||
assert(/*i >= tvec2<thalf>::size_type(0) && */i < tvec2<thalf>::value_size());
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER thalf const & tvec2<thalf>::operator[](tvec2<thalf>::size_type i) const
|
||||
{
|
||||
assert(/*i >= tvec2<thalf>::size_type(0) && */i < tvec2<thalf>::value_size());
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2() :
|
||||
x(thalf(0.f)),
|
||||
y(thalf(0.f))
|
||||
{}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
|
||||
(
|
||||
tvec2<thalf> const & v
|
||||
) :
|
||||
x(v.x),
|
||||
y(v.y)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Explicit basic constructors
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
|
||||
(
|
||||
thalf const & s
|
||||
) :
|
||||
x(s),
|
||||
y(s)
|
||||
{}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
|
||||
(
|
||||
thalf const & s1,
|
||||
thalf const & s2
|
||||
) :
|
||||
x(s1),
|
||||
y(s2)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
|
||||
(
|
||||
tref2<thalf> const & r
|
||||
) :
|
||||
x(r.x),
|
||||
y(r.y)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion scalar constructors
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
|
||||
(
|
||||
U const & x
|
||||
) :
|
||||
x(thalf(x)),
|
||||
y(thalf(x))
|
||||
{}
|
||||
|
||||
template <typename U, typename V>
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
|
||||
(
|
||||
U const & x,
|
||||
V const & y
|
||||
) :
|
||||
x(thalf(x)),
|
||||
y(thalf(y))
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion vector constructors
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
|
||||
(
|
||||
tvec2<U> const & v
|
||||
) :
|
||||
x(thalf(v.x)),
|
||||
y(thalf(v.y))
|
||||
{}
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
|
||||
(
|
||||
tvec3<U> const & v
|
||||
) :
|
||||
x(thalf(v.x)),
|
||||
y(thalf(v.y))
|
||||
{}
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf>::tvec2
|
||||
(
|
||||
tvec4<U> const & v
|
||||
) :
|
||||
x(thalf(v.x)),
|
||||
y(thalf(v.y))
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator=
|
||||
(
|
||||
tvec2<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x = v.x;
|
||||
this->y = v.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator+=
|
||||
(
|
||||
thalf const & s
|
||||
)
|
||||
{
|
||||
this->x += s;
|
||||
this->y += s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator+=
|
||||
(
|
||||
tvec2<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x += v.x;
|
||||
this->y += v.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator-=
|
||||
(
|
||||
thalf const & s
|
||||
)
|
||||
{
|
||||
this->x -= s;
|
||||
this->y -= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator-=
|
||||
(
|
||||
tvec2<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x -= v.x;
|
||||
this->y -= v.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf>& tvec2<thalf>::operator*=
|
||||
(
|
||||
thalf const & s
|
||||
)
|
||||
{
|
||||
this->x *= s;
|
||||
this->y *= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator*=
|
||||
(
|
||||
tvec2<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x *= v.x;
|
||||
this->y *= v.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator/=
|
||||
(
|
||||
thalf const & s
|
||||
)
|
||||
{
|
||||
this->x /= s;
|
||||
this->y /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator/=
|
||||
(
|
||||
tvec2<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x /= v.x;
|
||||
this->y /= v.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf> & tvec2<thalf>::operator++()
|
||||
{
|
||||
++this->x;
|
||||
++this->y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf>& tvec2<thalf>::operator--()
|
||||
{
|
||||
--this->x;
|
||||
--this->y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle operators
|
||||
|
||||
GLM_FUNC_QUALIFIER thalf tvec2<thalf>::swizzle(comp x) const
|
||||
{
|
||||
return (*this)[x];
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf> tvec2<thalf>::swizzle(comp x, comp y) const
|
||||
{
|
||||
return tvec2<thalf>(
|
||||
(*this)[x],
|
||||
(*this)[y]);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> tvec2<thalf>::swizzle(comp x, comp y, comp z) const
|
||||
{
|
||||
return tvec3<thalf>(
|
||||
(*this)[x],
|
||||
(*this)[y],
|
||||
(*this)[z]);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf> tvec2<thalf>::swizzle(comp x, comp y, comp z, comp w) const
|
||||
{
|
||||
return tvec4<thalf>(
|
||||
(*this)[x],
|
||||
(*this)[y],
|
||||
(*this)[z],
|
||||
(*this)[w]);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tref2<thalf> tvec2<thalf>::swizzle(comp x, comp y)
|
||||
{
|
||||
return tref2<thalf>(
|
||||
(*this)[x],
|
||||
(*this)[y]);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// hvec3
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf>::size_type tvec3<thalf>::value_size()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
GLM_FUNC_QUALIFIER thalf & tvec3<thalf>::operator[]
|
||||
(
|
||||
tvec3<thalf>::size_type i
|
||||
)
|
||||
{
|
||||
assert(/*i >= tvec3<thalf>::size_type(0) &&*/ i < tvec3<thalf>::value_size());
|
||||
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER thalf const & tvec3<thalf>::operator[]
|
||||
(
|
||||
tvec3<thalf>::size_type i
|
||||
) const
|
||||
{
|
||||
assert(/*i >= tvec3<thalf>::size_type(0) &&*/ i < tvec3<thalf>::value_size());
|
||||
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3() :
|
||||
x(thalf(0)),
|
||||
y(thalf(0)),
|
||||
z(thalf(0))
|
||||
{}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
|
||||
(
|
||||
tvec3<thalf> const & v
|
||||
) :
|
||||
x(v.x),
|
||||
y(v.y),
|
||||
z(v.z)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Explicit basic constructors
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
|
||||
(
|
||||
thalf const & s
|
||||
) :
|
||||
x(s),
|
||||
y(s),
|
||||
z(s)
|
||||
{}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
|
||||
(
|
||||
thalf const & s0,
|
||||
thalf const & s1,
|
||||
thalf const & s2
|
||||
) :
|
||||
x(s0),
|
||||
y(s1),
|
||||
z(s2)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
|
||||
(
|
||||
tref3<thalf> const & r
|
||||
) :
|
||||
x(r.x),
|
||||
y(r.y),
|
||||
z(r.z)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion scalar constructors
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
|
||||
(
|
||||
U const & x
|
||||
) :
|
||||
x(thalf(x)),
|
||||
y(thalf(x)),
|
||||
z(thalf(x))
|
||||
{}
|
||||
|
||||
template <typename A, typename B, typename C>
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
|
||||
(
|
||||
A const & x,
|
||||
B const & y,
|
||||
C const & z
|
||||
) :
|
||||
x(thalf(x)),
|
||||
y(thalf(y)),
|
||||
z(thalf(z))
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion vector constructors
|
||||
|
||||
template <typename A, typename B>
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
|
||||
(
|
||||
tvec2<A> const & v,
|
||||
B const & s
|
||||
) :
|
||||
x(thalf(v.x)),
|
||||
y(thalf(v.y)),
|
||||
z(thalf(s))
|
||||
{}
|
||||
|
||||
template <typename A, typename B>
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
|
||||
(
|
||||
A const & s,
|
||||
tvec2<B> const & v
|
||||
) :
|
||||
x(thalf(s)),
|
||||
y(thalf(v.x)),
|
||||
z(thalf(v.y))
|
||||
{}
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
|
||||
(
|
||||
tvec3<U> const & v
|
||||
) :
|
||||
x(thalf(v.x)),
|
||||
y(thalf(v.y)),
|
||||
z(thalf(v.z))
|
||||
{}
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf>::tvec3
|
||||
(
|
||||
tvec4<U> const & v
|
||||
) :
|
||||
x(thalf(v.x)),
|
||||
y(thalf(v.y)),
|
||||
z(thalf(v.z))
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator=
|
||||
(
|
||||
tvec3<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x = v.x;
|
||||
this->y = v.y;
|
||||
this->z = v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator+=
|
||||
(
|
||||
thalf const & s
|
||||
)
|
||||
{
|
||||
this->x += s;
|
||||
this->y += s;
|
||||
this->z += s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator+=
|
||||
(
|
||||
tvec3<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x += v.x;
|
||||
this->y += v.y;
|
||||
this->z += v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator-=
|
||||
(
|
||||
thalf const & s
|
||||
)
|
||||
{
|
||||
this->x -= s;
|
||||
this->y -= s;
|
||||
this->z -= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator-=
|
||||
(
|
||||
tvec3<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x -= v.x;
|
||||
this->y -= v.y;
|
||||
this->z -= v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator*=
|
||||
(
|
||||
thalf const & s
|
||||
)
|
||||
{
|
||||
this->x *= s;
|
||||
this->y *= s;
|
||||
this->z *= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator*=
|
||||
(
|
||||
tvec3<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x *= v.x;
|
||||
this->y *= v.y;
|
||||
this->z *= v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator/=
|
||||
(
|
||||
thalf const & s
|
||||
)
|
||||
{
|
||||
this->x /= s;
|
||||
this->y /= s;
|
||||
this->z /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator/=
|
||||
(
|
||||
tvec3<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x /= v.x;
|
||||
this->y /= v.y;
|
||||
this->z /= v.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator++()
|
||||
{
|
||||
++this->x;
|
||||
++this->y;
|
||||
++this->z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> & tvec3<thalf>::operator--()
|
||||
{
|
||||
--this->x;
|
||||
--this->y;
|
||||
--this->z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle operators
|
||||
|
||||
GLM_FUNC_QUALIFIER thalf tvec3<thalf>::swizzle(comp x) const
|
||||
{
|
||||
return (*this)[x];
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf> tvec3<thalf>::swizzle(comp x, comp y) const
|
||||
{
|
||||
return tvec2<thalf>(
|
||||
(*this)[x],
|
||||
(*this)[y]);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> tvec3<thalf>::swizzle(comp x, comp y, comp z) const
|
||||
{
|
||||
return tvec3<thalf>(
|
||||
(*this)[x],
|
||||
(*this)[y],
|
||||
(*this)[z]);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf> tvec3<thalf>::swizzle(comp x, comp y, comp z, comp w) const
|
||||
{
|
||||
return tvec4<thalf>(
|
||||
(*this)[x],
|
||||
(*this)[y],
|
||||
(*this)[z],
|
||||
(*this)[w]);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tref3<thalf> tvec3<thalf>::swizzle(comp x, comp y, comp z)
|
||||
{
|
||||
return tref3<thalf>(
|
||||
(*this)[x],
|
||||
(*this)[y],
|
||||
(*this)[z]);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// hvec4
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::size_type tvec4<thalf>::value_size()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Accesses
|
||||
|
||||
GLM_FUNC_QUALIFIER thalf & tvec4<thalf>::operator[]
|
||||
(
|
||||
tvec4<thalf>::size_type i
|
||||
)
|
||||
{
|
||||
assert(/*i >= tvec4<thalf>::size_type(0) && */i < tvec4<thalf>::value_size());
|
||||
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER thalf const & tvec4<thalf>::operator[]
|
||||
(
|
||||
tvec4<thalf>::size_type i
|
||||
) const
|
||||
{
|
||||
assert(/*i >= tvec4<thalf>::size_type(0) && */i < tvec4<thalf>::value_size());
|
||||
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Implicit basic constructors
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4() :
|
||||
x(thalf(0)),
|
||||
y(thalf(0)),
|
||||
z(thalf(0)),
|
||||
w(thalf(0))
|
||||
{}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
||||
(
|
||||
tvec4<thalf> const & v
|
||||
) :
|
||||
x(v.x),
|
||||
y(v.y),
|
||||
z(v.z),
|
||||
w(v.w)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Explicit basic constructors
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
||||
(
|
||||
thalf const & s
|
||||
) :
|
||||
x(s),
|
||||
y(s),
|
||||
z(s),
|
||||
w(s)
|
||||
{}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
||||
(
|
||||
thalf const & s1,
|
||||
thalf const & s2,
|
||||
thalf const & s3,
|
||||
thalf const & s4
|
||||
) :
|
||||
x(s1),
|
||||
y(s2),
|
||||
z(s3),
|
||||
w(s4)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle constructors
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
||||
(
|
||||
tref4<thalf> const & r
|
||||
) :
|
||||
x(r.x),
|
||||
y(r.y),
|
||||
z(r.z),
|
||||
w(r.w)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion scalar constructors
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
||||
(
|
||||
U const & x
|
||||
) :
|
||||
x(thalf(x)),
|
||||
y(thalf(x)),
|
||||
z(thalf(x)),
|
||||
w(thalf(x))
|
||||
{}
|
||||
|
||||
template <typename A, typename B, typename C, typename D>
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
||||
(
|
||||
A const & x,
|
||||
B const & y,
|
||||
C const & z,
|
||||
D const & w
|
||||
) :
|
||||
x(thalf(x)),
|
||||
y(thalf(y)),
|
||||
z(thalf(z)),
|
||||
w(thalf(w))
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Convertion vector constructors
|
||||
|
||||
template <typename A, typename B, typename C>
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
||||
(
|
||||
tvec2<A> const & v,
|
||||
B const & s1,
|
||||
C const & s2
|
||||
) :
|
||||
x(thalf(v.x)),
|
||||
y(thalf(v.y)),
|
||||
z(thalf(s1)),
|
||||
w(thalf(s2))
|
||||
{}
|
||||
|
||||
template <typename A, typename B, typename C>
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
||||
(
|
||||
A const & s1,
|
||||
tvec2<B> const & v,
|
||||
C const & s2
|
||||
) :
|
||||
x(thalf(s1)),
|
||||
y(thalf(v.x)),
|
||||
z(thalf(v.y)),
|
||||
w(thalf(s2))
|
||||
{}
|
||||
|
||||
template <typename A, typename B, typename C>
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
||||
(
|
||||
A const & s1,
|
||||
B const & s2,
|
||||
tvec2<C> const & v
|
||||
) :
|
||||
x(thalf(s1)),
|
||||
y(thalf(s2)),
|
||||
z(thalf(v.x)),
|
||||
w(thalf(v.y))
|
||||
{}
|
||||
|
||||
template <typename A, typename B>
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
||||
(
|
||||
tvec3<A> const & v,
|
||||
B const & s
|
||||
) :
|
||||
x(thalf(v.x)),
|
||||
y(thalf(v.y)),
|
||||
z(thalf(v.z)),
|
||||
w(thalf(s))
|
||||
{}
|
||||
|
||||
template <typename A, typename B>
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
||||
(
|
||||
A const & s,
|
||||
tvec3<B> const & v
|
||||
) :
|
||||
x(thalf(s)),
|
||||
y(thalf(v.x)),
|
||||
z(thalf(v.y)),
|
||||
w(thalf(v.z))
|
||||
{}
|
||||
|
||||
template <typename A, typename B>
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
||||
(
|
||||
tvec2<A> const & v1,
|
||||
tvec2<B> const & v2
|
||||
) :
|
||||
x(thalf(v1.x)),
|
||||
y(thalf(v1.y)),
|
||||
z(thalf(v2.x)),
|
||||
w(thalf(v2.y))
|
||||
{}
|
||||
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>::tvec4
|
||||
(
|
||||
tvec4<U> const & v
|
||||
) :
|
||||
x(thalf(v.x)),
|
||||
y(thalf(v.y)),
|
||||
z(thalf(v.z)),
|
||||
w(thalf(v.w))
|
||||
{}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Unary arithmetic operators
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator=
|
||||
(
|
||||
tvec4<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x = v.x;
|
||||
this->y = v.y;
|
||||
this->z = v.z;
|
||||
this->w = v.w;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator+=
|
||||
(
|
||||
thalf const & s
|
||||
)
|
||||
{
|
||||
this->x += s;
|
||||
this->y += s;
|
||||
this->z += s;
|
||||
this->w += s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator+=
|
||||
(
|
||||
tvec4<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x += v.x;
|
||||
this->y += v.y;
|
||||
this->z += v.z;
|
||||
this->w += v.w;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator-=
|
||||
(
|
||||
thalf const & s
|
||||
)
|
||||
{
|
||||
this->x -= s;
|
||||
this->y -= s;
|
||||
this->z -= s;
|
||||
this->w -= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator-=
|
||||
(
|
||||
tvec4<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x -= v.x;
|
||||
this->y -= v.y;
|
||||
this->z -= v.z;
|
||||
this->w -= v.w;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator*=
|
||||
(
|
||||
thalf const & s
|
||||
)
|
||||
{
|
||||
this->x *= s;
|
||||
this->y *= s;
|
||||
this->z *= s;
|
||||
this->w *= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator*=
|
||||
(
|
||||
tvec4<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x *= v.x;
|
||||
this->y *= v.y;
|
||||
this->z *= v.z;
|
||||
this->w *= v.w;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator/=
|
||||
(
|
||||
thalf const & s
|
||||
)
|
||||
{
|
||||
this->x /= s;
|
||||
this->y /= s;
|
||||
this->z /= s;
|
||||
this->w /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator/=
|
||||
(
|
||||
tvec4<thalf> const & v
|
||||
)
|
||||
{
|
||||
this->x /= v.x;
|
||||
this->y /= v.y;
|
||||
this->z /= v.z;
|
||||
this->w /= v.w;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator++()
|
||||
{
|
||||
++this->x;
|
||||
++this->y;
|
||||
++this->z;
|
||||
++this->w;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf>& tvec4<thalf>::operator--()
|
||||
{
|
||||
--this->x;
|
||||
--this->y;
|
||||
--this->z;
|
||||
--this->w;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Swizzle operators
|
||||
|
||||
GLM_FUNC_QUALIFIER thalf tvec4<thalf>::swizzle(comp x) const
|
||||
{
|
||||
return (*this)[x];
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec2<thalf> tvec4<thalf>::swizzle(comp x, comp y) const
|
||||
{
|
||||
return tvec2<thalf>(
|
||||
(*this)[x],
|
||||
(*this)[y]);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec3<thalf> tvec4<thalf>::swizzle(comp x, comp y, comp z) const
|
||||
{
|
||||
return tvec3<thalf>(
|
||||
(*this)[x],
|
||||
(*this)[y],
|
||||
(*this)[z]);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tvec4<thalf> tvec4<thalf>::swizzle(comp x, comp y, comp z, comp w) const
|
||||
{
|
||||
return tvec4<thalf>(
|
||||
(*this)[x],
|
||||
(*this)[y],
|
||||
(*this)[z],
|
||||
(*this)[w]);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER tref4<thalf> tvec4<thalf>::swizzle(comp x, comp y, comp z, comp w)
|
||||
{
|
||||
return tref4<thalf>(
|
||||
(*this)[x],
|
||||
(*this)[y],
|
||||
(*this)[z],
|
||||
(*this)[w]);
|
||||
}
|
||||
|
||||
#endif//_MSC_EXTENSIONS
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
70
ExternalLibs/glm/gtc/matrix_access.hpp
Normal file
70
ExternalLibs/glm/gtc/matrix_access.hpp
Normal file
|
@ -0,0 +1,70 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2005-12-27
|
||||
// Updated : 2010-11-12
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/matrix_access.hpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Dependency:
|
||||
// - GLM core
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_gtc_matrix_access
|
||||
#define glm_gtc_matrix_access
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTC_matrix_access extension included")
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace gtc{
|
||||
namespace matrix_access ///< GLM_GTC_matrix_access extension: Set a column or a row of a matrix
|
||||
{
|
||||
/// \addtogroup gtc_matrix_access
|
||||
///@{
|
||||
|
||||
//! Get a specific row of a matrix.
|
||||
//! From GLM_GTC_matrix_access extension.
|
||||
template <typename genType>
|
||||
typename genType::row_type row(
|
||||
genType const & m,
|
||||
int index);
|
||||
|
||||
//! Set a specific row to a matrix.
|
||||
//! From GLM_GTC_matrix_access extension.
|
||||
template <typename genType>
|
||||
genType row(
|
||||
genType const & m,
|
||||
int index,
|
||||
typename genType::row_type const & x);
|
||||
|
||||
//! Get a specific column of a matrix.
|
||||
//! From GLM_GTC_matrix_access extension.
|
||||
template <typename genType>
|
||||
typename genType::col_type column(
|
||||
genType const & m,
|
||||
int index);
|
||||
|
||||
//! Set a specific column to a matrix.
|
||||
//! From GLM_GTC_matrix_access extension.
|
||||
template <typename genType>
|
||||
genType column(
|
||||
genType const & m,
|
||||
int index,
|
||||
typename genType::col_type const & x);
|
||||
|
||||
///@}
|
||||
|
||||
}//namespace matrix_access
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
||||
|
||||
#include "matrix_access.inl"
|
||||
|
||||
namespace glm{using namespace gtc::matrix_access;}
|
||||
|
||||
#endif//glm_gtc_matrix_access
|
59
ExternalLibs/glm/gtc/matrix_access.inl
Normal file
59
ExternalLibs/glm/gtc/matrix_access.inl
Normal file
|
@ -0,0 +1,59 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2005-12-27
|
||||
// Updated : 2010-11-12
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/matrix_access.inl
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace gtc{
|
||||
namespace matrix_access
|
||||
{
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType row(
|
||||
genType const & m,
|
||||
int index,
|
||||
typename genType::row_type const & x)
|
||||
{
|
||||
genType Result = m;
|
||||
for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
|
||||
Result[i][index] = x[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER typename genType::row_type row(
|
||||
genType const & m,
|
||||
int index)
|
||||
{
|
||||
typename genType::row_type Result;
|
||||
for(typename genType::size_type i = 0; i < genType::row_size(); ++i)
|
||||
Result[i] = m[i][index];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType column(
|
||||
genType const & m,
|
||||
int index,
|
||||
typename genType::col_type const & x)
|
||||
{
|
||||
genType Result = m;
|
||||
Result[index] = x;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER typename genType::col_type column(
|
||||
genType const & m,
|
||||
int index)
|
||||
{
|
||||
return m[index];
|
||||
}
|
||||
|
||||
}//namespace matrix_access
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
||||
|
204
ExternalLibs/glm/gtc/matrix_integer.hpp
Normal file
204
ExternalLibs/glm/gtc/matrix_integer.hpp
Normal file
|
@ -0,0 +1,204 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2011-01-20
|
||||
// Updated : 2011-01-20
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/matrix_integer.hpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Dependency:
|
||||
// - GLM core
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_gtc_matrix_integer
|
||||
#define glm_gtc_matrix_integer
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTC_matrix_integer extension included")
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace gtc{
|
||||
namespace matrix_integer ///< GLM_GTC_matrix_integer extension: Add integer matrices
|
||||
{
|
||||
/// \addtogroup gtc_matrix_integer
|
||||
///@{
|
||||
|
||||
typedef detail::tmat2x2<highp_int> highp_imat2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x3<highp_int> highp_imat3; //!< \brief High-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x4<highp_int> highp_imat4; //!< \brief High-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
|
||||
typedef detail::tmat2x2<highp_int> highp_imat2x2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat2x3<highp_int> highp_imat2x3; //!< \brief High-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat2x4<highp_int> highp_imat2x4; //!< \brief High-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x2<highp_int> highp_imat3x2; //!< \brief High-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x3<highp_int> highp_imat3x3; //!< \brief High-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x4<highp_int> highp_imat3x4; //!< \brief High-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x2<highp_int> highp_imat4x2; //!< \brief High-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x3<highp_int> highp_imat4x3; //!< \brief High-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x4<highp_int> highp_imat4x4; //!< \brief High-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
|
||||
typedef detail::tmat2x2<mediump_int> mediump_imat2; //!< \brief Medium-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x3<mediump_int> mediump_imat3; //!< \brief Medium-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x4<mediump_int> mediump_imat4; //!< \brief Medium-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
|
||||
typedef detail::tmat2x2<mediump_int> mediump_imat2x2; //!< \brief Medium-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat2x3<mediump_int> mediump_imat2x3; //!< \brief Medium-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat2x4<mediump_int> mediump_imat2x4; //!< \brief Medium-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x2<mediump_int> mediump_imat3x2; //!< \brief Medium-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x3<mediump_int> mediump_imat3x3; //!< \brief Medium-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x4<mediump_int> mediump_imat3x4; //!< \brief Medium-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x2<mediump_int> mediump_imat4x2; //!< \brief Medium-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x3<mediump_int> mediump_imat4x3; //!< \brief Medium-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x4<mediump_int> mediump_imat4x4; //!< \brief Medium-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
|
||||
typedef detail::tmat2x2<lowp_int> lowp_imat2; //!< \brief Low-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x3<lowp_int> lowp_imat3; //!< \brief Low-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x4<lowp_int> lowp_imat4; //!< \brief Low-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
|
||||
typedef detail::tmat2x2<lowp_int> lowp_imat2x2; //!< \brief Low-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat2x3<lowp_int> lowp_imat2x3; //!< \brief Low-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat2x4<lowp_int> lowp_imat2x4; //!< \brief Low-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x2<lowp_int> lowp_imat3x2; //!< \brief Low-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x3<lowp_int> lowp_imat3x3; //!< \brief Low-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x4<lowp_int> lowp_imat3x4; //!< \brief Low-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x2<lowp_int> lowp_imat4x2; //!< \brief Low-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x3<lowp_int> lowp_imat4x3; //!< \brief Low-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x4<lowp_int> lowp_imat4x4; //!< \brief Low-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
|
||||
typedef detail::tmat2x2<highp_uint> highp_umat2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x3<highp_uint> highp_umat3; //!< \brief High-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x4<highp_uint> highp_umat4; //!< \brief High-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
|
||||
typedef detail::tmat2x2<highp_uint> highp_umat2x2; //!< \brief High-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat2x3<highp_uint> highp_umat2x3; //!< \brief High-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat2x4<highp_uint> highp_umat2x4; //!< \brief High-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x2<highp_uint> highp_umat3x2; //!< \brief High-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x3<highp_uint> highp_umat3x3; //!< \brief High-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x4<highp_uint> highp_umat3x4; //!< \brief High-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x2<highp_uint> highp_umat4x2; //!< \brief High-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x3<highp_uint> highp_umat4x3; //!< \brief High-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x4<highp_uint> highp_umat4x4; //!< \brief High-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
|
||||
typedef detail::tmat2x2<mediump_uint> mediump_umat2; //!< \brief Medium-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x3<mediump_uint> mediump_umat3; //!< \brief Medium-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x4<mediump_uint> mediump_umat4; //!< \brief Medium-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
|
||||
typedef detail::tmat2x2<mediump_uint> mediump_umat2x2; //!< \brief Medium-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat2x3<mediump_uint> mediump_umat2x3; //!< \brief Medium-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat2x4<mediump_uint> mediump_umat2x4; //!< \brief Medium-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x2<mediump_uint> mediump_umat3x2; //!< \brief Medium-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x3<mediump_uint> mediump_umat3x3; //!< \brief Medium-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x4<mediump_uint> mediump_umat3x4; //!< \brief Medium-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x2<mediump_uint> mediump_umat4x2; //!< \brief Medium-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x3<mediump_uint> mediump_umat4x3; //!< \brief Medium-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x4<mediump_uint> mediump_umat4x4; //!< \brief Medium-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
|
||||
typedef detail::tmat2x2<lowp_uint> lowp_umat2; //!< \brief Low-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x3<lowp_uint> lowp_umat3; //!< \brief Low-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x4<lowp_uint> lowp_umat4; //!< \brief Low-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
|
||||
typedef detail::tmat2x2<lowp_uint> lowp_umat2x2; //!< \brief Low-precision signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat2x3<lowp_uint> lowp_umat2x3; //!< \brief Low-precision signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat2x4<lowp_uint> lowp_umat2x4; //!< \brief Low-precision signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x2<lowp_uint> lowp_umat3x2; //!< \brief Low-precision signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x3<lowp_uint> lowp_umat3x3; //!< \brief Low-precision signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat3x4<lowp_uint> lowp_umat3x4; //!< \brief Low-precision signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x2<lowp_uint> lowp_umat4x2; //!< \brief Low-precision signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x3<lowp_uint> lowp_umat4x3; //!< \brief Low-precision signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef detail::tmat4x4<lowp_uint> lowp_umat4x4; //!< \brief Low-precision signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
|
||||
#if(defined(GLM_PRECISION_HIGHP_INT))
|
||||
typedef highp_imat2 imat2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_imat3 imat3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_imat4 imat4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_imat2x2 imat2x2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_imat2x3 imat2x3; //!< \brief Signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_imat2x4 imat2x4; //!< \brief Signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_imat3x2 imat3x2; //!< \brief Signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_imat3x3 imat3x3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_imat3x4 imat3x4; //!< \brief Signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_imat4x2 imat4x2; //!< \brief Signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_imat4x3 imat4x3; //!< \brief Signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_imat4x4 imat4x4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
#elif(defined(GLM_PRECISION_LOWP_INT))
|
||||
typedef lowp_imat2 imat2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_imat3 imat3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_imat4 imat4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_imat2x2 imat2x2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_imat2x3 imat2x3; //!< \brief Signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_imat2x4 imat2x4; //!< \brief Signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_imat3x2 imat3x2; //!< \brief Signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_imat3x3 imat3x3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_imat3x4 imat3x4; //!< \brief Signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_imat4x2 imat4x2; //!< \brief Signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_imat4x3 imat4x3; //!< \brief Signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_imat4x4 imat4x4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
#else //if(defined(GLM_PRECISION_MEDIUMP_INT))
|
||||
typedef mediump_imat2 imat2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_imat3 imat3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_imat4 imat4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_imat2x2 imat2x2; //!< \brief Signed integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_imat2x3 imat2x3; //!< \brief Signed integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_imat2x4 imat2x4; //!< \brief Signed integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_imat3x2 imat3x2; //!< \brief Signed integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_imat3x3 imat3x3; //!< \brief Signed integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_imat3x4 imat3x4; //!< \brief Signed integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_imat4x2 imat4x2; //!< \brief Signed integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_imat4x3 imat4x3; //!< \brief Signed integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_imat4x4 imat4x4; //!< \brief Signed integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
#endif//GLM_PRECISION
|
||||
|
||||
#if(defined(GLM_PRECISION_HIGHP_UINT))
|
||||
typedef highp_umat2 umat2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_umat3 umat3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_umat4 umat4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_umat2x2 umat2x2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_umat2x3 umat2x3; //!< \brief Unsigned integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_umat2x4 umat2x4; //!< \brief Unsigned integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_umat3x2 umat3x2; //!< \brief Unsigned integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_umat3x3 umat3x3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_umat3x4 umat3x4; //!< \brief Unsigned integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_umat4x2 umat4x2; //!< \brief Unsigned integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_umat4x3 umat4x3; //!< \brief Unsigned integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef highp_umat4x4 umat4x4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
#elif(defined(GLM_PRECISION_LOWP_UINT))
|
||||
typedef lowp_umat2 umat2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_umat3 umat3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_umat4 umat4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_umat2x2 umat2x2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_umat2x3 umat2x3; //!< \brief Unsigned integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_umat2x4 umat2x4; //!< \brief Unsigned integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_umat3x2 umat3x2; //!< \brief Unsigned integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_umat3x3 umat3x3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_umat3x4 umat3x4; //!< \brief Unsigned integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_umat4x2 umat4x2; //!< \brief Unsigned integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_umat4x3 umat4x3; //!< \brief Unsigned integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef lowp_umat4x4 umat4x4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
#else //if(defined(GLM_PRECISION_MEDIUMP_UINT))
|
||||
typedef mediump_umat2 umat2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_umat3 umat3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_umat4 umat4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_umat2x2 umat2x2; //!< \brief Unsigned integer 2x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_umat2x3 umat2x3; //!< \brief Unsigned integer 2x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_umat2x4 umat2x4; //!< \brief Unsigned integer 2x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_umat3x2 umat3x2; //!< \brief Unsigned integer 3x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_umat3x3 umat3x3; //!< \brief Unsigned integer 3x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_umat3x4 umat3x4; //!< \brief Unsigned integer 3x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_umat4x2 umat4x2; //!< \brief Unsigned integer 4x2 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_umat4x3 umat4x3; //!< \brief Unsigned integer 4x3 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
typedef mediump_umat4x4 umat4x4; //!< \brief Unsigned integer 4x4 matrix. (from GLM_GTC_matrix_integer extension)
|
||||
#endif//GLM_PRECISION
|
||||
|
||||
///@}
|
||||
|
||||
}//namespace matrix_integer
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
||||
|
||||
namespace glm{using namespace gtc::matrix_integer;}
|
||||
|
||||
#endif//glm_gtc_matrix_integer
|
51
ExternalLibs/glm/gtc/matrix_inverse.hpp
Normal file
51
ExternalLibs/glm/gtc/matrix_inverse.hpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2005-12-21
|
||||
// Updated : 2010-12-13
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/matrix_inverse.hpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Dependency:
|
||||
// - GLM core
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_gtc_matrix_inverse
|
||||
#define glm_gtc_matrix_inverse
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTC_matrix_inverse extension included")
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace gtc{
|
||||
namespace matrix_inverse ///< GLM_GTC_matrix_inverse extension: Inverse matrix functions
|
||||
{
|
||||
/// \addtogroup gtc_matrix_inverse
|
||||
///@{
|
||||
|
||||
//! Fast matrix inverse for affine matrix.
|
||||
//! From GLM_GTC_matrix_inverse extension.
|
||||
template <typename genType>
|
||||
genType affineInverse(genType const & m);
|
||||
|
||||
//! Compute the inverse transpose of a matrix.
|
||||
//! From GLM_GTC_matrix_inverse extension.
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER typename genType::value_type inverseTranspose(
|
||||
genType const & m);
|
||||
|
||||
///@}
|
||||
|
||||
}//namespace matrix_inverse
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
||||
|
||||
#include "matrix_inverse.inl"
|
||||
|
||||
namespace glm{using namespace gtc::matrix_inverse;}
|
||||
|
||||
#endif//glm_gtc_matrix_inverse
|
139
ExternalLibs/glm/gtc/matrix_inverse.inl
Normal file
139
ExternalLibs/glm/gtc/matrix_inverse.inl
Normal file
|
@ -0,0 +1,139 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2005-12-21
|
||||
// Updated : 2010-12-13
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/matrix_inverse.inl
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace gtc{
|
||||
namespace matrix_inverse
|
||||
{
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T> affineInverse
|
||||
(
|
||||
detail::tmat3x3<T> const & m
|
||||
)
|
||||
{
|
||||
detail::tmat3x3<T> Result(m);
|
||||
Result[2] = detail::tvec3<T>(0, 0, 1);
|
||||
Result = transpose(Result);
|
||||
detail::tvec3<T> Translation = Result * detail::tvec3<T>(-detail::tvec2<T>(m[2]), m[2][2]);
|
||||
Result[2] = Translation;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> affineInverse
|
||||
(
|
||||
detail::tmat4x4<T> const & m
|
||||
)
|
||||
{
|
||||
detail::tmat4x4<T> Result(m);
|
||||
Result[3] = detail::tvec4<T>(0, 0, 0, 1);
|
||||
Result = transpose(Result);
|
||||
detail::tvec4<T> Translation = Result * detail::tvec4<T>(-detail::tvec3<T>(m[3]), m[3][3]);
|
||||
Result[3] = Translation;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x2<valType> inverseTranspose(
|
||||
detail::tmat2x2<valType> const & m)
|
||||
{
|
||||
valType Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1];
|
||||
|
||||
detail::tmat2x2<valType> Inverse(
|
||||
+ m[1][1] / Determinant,
|
||||
- m[0][1] / Determinant,
|
||||
- m[1][0] / Determinant,
|
||||
+ m[0][0] / Determinant);
|
||||
|
||||
return Inverse;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<valType> inverseTranspose(
|
||||
detail::tmat3x3<valType> const & m)
|
||||
{
|
||||
valType Determinant =
|
||||
+ m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1])
|
||||
- m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0])
|
||||
+ m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]);
|
||||
|
||||
detail::tmat3x3<valType> Inverse;
|
||||
Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]);
|
||||
Inverse[0][1] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]);
|
||||
Inverse[0][2] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]);
|
||||
Inverse[1][0] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]);
|
||||
Inverse[1][1] = + (m[0][0] * m[2][2] - m[2][0] * m[0][2]);
|
||||
Inverse[1][2] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]);
|
||||
Inverse[2][0] = + (m[0][1] * m[1][2] - m[1][1] * m[0][2]);
|
||||
Inverse[2][1] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]);
|
||||
Inverse[2][2] = + (m[0][0] * m[1][1] - m[1][0] * m[0][1]);
|
||||
Inverse /= Determinant;
|
||||
|
||||
return Inverse;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> inverseTranspose(
|
||||
detail::tmat4x4<valType> const & m)
|
||||
{
|
||||
valType SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
||||
valType SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
|
||||
valType SubFactor02 = m[2][1] * m[3][2] - m[3][1] * m[2][2];
|
||||
valType SubFactor03 = m[2][0] * m[3][3] - m[3][0] * m[2][3];
|
||||
valType SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
|
||||
valType SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
|
||||
valType SubFactor06 = m[1][2] * m[3][3] - m[3][2] * m[1][3];
|
||||
valType SubFactor07 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
|
||||
valType SubFactor08 = m[1][1] * m[3][2] - m[3][1] * m[1][2];
|
||||
valType SubFactor09 = m[1][0] * m[3][3] - m[3][0] * m[1][3];
|
||||
valType SubFactor10 = m[1][0] * m[3][2] - m[3][0] * m[1][2];
|
||||
valType SubFactor11 = m[1][1] * m[3][3] - m[3][1] * m[1][3];
|
||||
valType SubFactor12 = m[1][0] * m[3][1] - m[3][0] * m[1][1];
|
||||
valType SubFactor13 = m[1][2] * m[2][3] - m[2][2] * m[1][3];
|
||||
valType SubFactor14 = m[1][1] * m[2][3] - m[2][1] * m[1][3];
|
||||
valType SubFactor15 = m[1][1] * m[2][2] - m[2][1] * m[1][2];
|
||||
valType SubFactor16 = m[1][0] * m[2][3] - m[2][0] * m[1][3];
|
||||
valType SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];
|
||||
valType SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];
|
||||
|
||||
detail::tmat4x4<valType> Inverse;
|
||||
Inverse[0][0] = + (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02);
|
||||
Inverse[0][1] = - (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04);
|
||||
Inverse[0][2] = + (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05);
|
||||
Inverse[0][3] = - (m[1][0] * SubFactor02 - m[1][1] * SubFactor04 + m[1][2] * SubFactor05);
|
||||
|
||||
Inverse[1][0] = - (m[0][1] * SubFactor00 - m[0][2] * SubFactor01 + m[0][3] * SubFactor02);
|
||||
Inverse[1][1] = + (m[0][0] * SubFactor00 - m[0][2] * SubFactor03 + m[0][3] * SubFactor04);
|
||||
Inverse[1][2] = - (m[0][0] * SubFactor01 - m[0][1] * SubFactor03 + m[0][3] * SubFactor05);
|
||||
Inverse[1][3] = + (m[0][0] * SubFactor02 - m[0][1] * SubFactor04 + m[0][2] * SubFactor05);
|
||||
|
||||
Inverse[2][0] = + (m[0][1] * SubFactor06 - m[0][2] * SubFactor07 + m[0][3] * SubFactor08);
|
||||
Inverse[2][1] = - (m[0][0] * SubFactor06 - m[0][2] * SubFactor09 + m[0][3] * SubFactor10);
|
||||
Inverse[2][2] = + (m[0][0] * SubFactor11 - m[0][1] * SubFactor09 + m[0][3] * SubFactor12);
|
||||
Inverse[2][3] = - (m[0][0] * SubFactor08 - m[0][1] * SubFactor10 + m[0][2] * SubFactor12);
|
||||
|
||||
Inverse[3][0] = - (m[0][1] * SubFactor13 - m[0][2] * SubFactor14 + m[0][3] * SubFactor15);
|
||||
Inverse[3][1] = + (m[0][0] * SubFactor13 - m[0][2] * SubFactor16 + m[0][3] * SubFactor17);
|
||||
Inverse[3][2] = - (m[0][0] * SubFactor14 - m[0][1] * SubFactor16 + m[0][3] * SubFactor18);
|
||||
Inverse[3][3] = + (m[0][0] * SubFactor15 - m[0][1] * SubFactor17 + m[0][2] * SubFactor18);
|
||||
|
||||
valType Determinant =
|
||||
+ m[0][0] * Inverse[0][0]
|
||||
+ m[0][1] * Inverse[0][1]
|
||||
+ m[0][2] * Inverse[0][2]
|
||||
+ m[0][3] * Inverse[0][3];
|
||||
|
||||
Inverse /= Determinant;
|
||||
|
||||
return Inverse;
|
||||
}
|
||||
|
||||
}//namespace matrix_inverse
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
158
ExternalLibs/glm/gtc/matrix_transform.hpp
Normal file
158
ExternalLibs/glm/gtc/matrix_transform.hpp
Normal file
|
@ -0,0 +1,158 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2009-04-29
|
||||
// Updated : 2009-04-29
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/matrix_transform.hpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Dependency:
|
||||
// - GLM core
|
||||
// - GLM_GTC_matrix_operation
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_gtc_matrix_transform
|
||||
#define glm_gtc_matrix_transform
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTC_matrix_transform extension included")
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace gtc{
|
||||
namespace matrix_transform ///< GLM_GTC_matrix_transform extension: Add transformation matrices
|
||||
{
|
||||
/// \addtogroup gtc_matrix_transform
|
||||
///@{
|
||||
|
||||
//! Builds a translation 4 * 4 matrix created from a vector of 3 components.
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> translate(
|
||||
detail::tmat4x4<T> const & m,
|
||||
detail::tvec3<T> const & v);
|
||||
|
||||
//! Builds a rotation 4 * 4 matrix created from an axis vector and an angle expressed in degrees.
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> rotate(
|
||||
detail::tmat4x4<T> const & m,
|
||||
T const & angle,
|
||||
detail::tvec3<T> const & v);
|
||||
|
||||
//! Builds a scale 4 * 4 matrix created from 3 scalars.
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> scale(
|
||||
detail::tmat4x4<T> const & m,
|
||||
detail::tvec3<T> const & v);
|
||||
|
||||
//! Creates a matrix for an orthographic parallel viewing volume.
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> ortho(
|
||||
T const & left,
|
||||
T const & right,
|
||||
T const & bottom,
|
||||
T const & top,
|
||||
T const & zNear,
|
||||
T const & zFar);
|
||||
|
||||
//! Creates a matrix for projecting two-dimensional coordinates onto the screen.
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> ortho(
|
||||
T const & left,
|
||||
T const & right,
|
||||
T const & bottom,
|
||||
T const & top);
|
||||
|
||||
//! Creates a frustum matrix.
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> frustum(
|
||||
T const & left,
|
||||
T const & right,
|
||||
T const & bottom,
|
||||
T const & top,
|
||||
T const & nearVal,
|
||||
T const & farVal);
|
||||
|
||||
//! Creates a matrix for a symetric perspective-view frustum.
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> perspective(
|
||||
T const & fovy,
|
||||
T const & aspect,
|
||||
T const & zNear,
|
||||
T const & zFar);
|
||||
|
||||
//! Builds a perspective projection matrix based on a field of view
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename valType>
|
||||
detail::tmat4x4<valType> perspectiveFov(
|
||||
valType const & fov,
|
||||
valType const & width,
|
||||
valType const & height,
|
||||
valType const & zNear,
|
||||
valType const & zFar);
|
||||
|
||||
//! Creates a matrix for a symmetric perspective-view frustum with far plane at infinite .
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> infinitePerspective(
|
||||
T fovy, T aspect, T zNear);
|
||||
|
||||
//! Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> tweakedInfinitePerspective(
|
||||
T fovy, T aspect, T zNear);
|
||||
|
||||
//! Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename T, typename U>
|
||||
detail::tvec3<T> project(
|
||||
detail::tvec3<T> const & obj,
|
||||
detail::tmat4x4<T> const & model,
|
||||
detail::tmat4x4<T> const & proj,
|
||||
detail::tvec4<U> const & viewport);
|
||||
|
||||
//! Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename T, typename U>
|
||||
detail::tvec3<T> unProject(
|
||||
detail::tvec3<T> const & win,
|
||||
detail::tmat4x4<T> const & model,
|
||||
detail::tmat4x4<T> const & proj,
|
||||
detail::tvec4<U> const & viewport);
|
||||
|
||||
//! Define a picking region
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename T, typename U>
|
||||
detail::tmat4x4<T> pickMatrix(
|
||||
detail::tvec2<T> const & center,
|
||||
detail::tvec2<T> const & delta,
|
||||
detail::tvec4<U> const & viewport);
|
||||
|
||||
//! Build a look at view matrix.
|
||||
//! From GLM_GTC_matrix_transform extension.
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> lookAt(
|
||||
detail::tvec3<T> const & eye,
|
||||
detail::tvec3<T> const & center,
|
||||
detail::tvec3<T> const & up);
|
||||
|
||||
///@}
|
||||
}//namespace matrix_transform
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
||||
|
||||
#include "matrix_transform.inl"
|
||||
|
||||
namespace glm{using namespace gtc::matrix_transform;}
|
||||
|
||||
#endif//glm_gtc_matrix_transform
|
397
ExternalLibs/glm/gtc/matrix_transform.inl
Normal file
397
ExternalLibs/glm/gtc/matrix_transform.inl
Normal file
|
@ -0,0 +1,397 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2009-04-29
|
||||
// Updated : 2009-04-29
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/matrix_transform.inl
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace gtc{
|
||||
namespace matrix_transform
|
||||
{
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> translate
|
||||
(
|
||||
detail::tmat4x4<T> const & m,
|
||||
detail::tvec3<T> const & v
|
||||
)
|
||||
{
|
||||
detail::tmat4x4<T> Result(m);
|
||||
Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> rotate
|
||||
(
|
||||
detail::tmat4x4<T> const & m,
|
||||
T const & angle,
|
||||
detail::tvec3<T> const & v
|
||||
)
|
||||
{
|
||||
T a = radians(angle);
|
||||
T c = cos(a);
|
||||
T s = sin(a);
|
||||
|
||||
detail::tvec3<T> axis = normalize(v);
|
||||
|
||||
detail::tvec3<T> temp = (T(1) - c) * axis;
|
||||
|
||||
detail::tmat4x4<T> Rotate(detail::tmat4x4<T>::null);
|
||||
Rotate[0][0] = c + temp[0] * axis[0];
|
||||
Rotate[0][1] = 0 + temp[0] * axis[1] + s * axis[2];
|
||||
Rotate[0][2] = 0 + temp[0] * axis[2] - s * axis[1];
|
||||
|
||||
Rotate[1][0] = 0 + temp[1] * axis[0] - s * axis[2];
|
||||
Rotate[1][1] = c + temp[1] * axis[1];
|
||||
Rotate[1][2] = 0 + temp[1] * axis[2] + s * axis[0];
|
||||
|
||||
Rotate[2][0] = 0 + temp[2] * axis[0] + s * axis[1];
|
||||
Rotate[2][1] = 0 + temp[2] * axis[1] - s * axis[0];
|
||||
Rotate[2][2] = c + temp[2] * axis[2];
|
||||
|
||||
detail::tmat4x4<T> Result(detail::tmat4x4<T>::null);
|
||||
Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2];
|
||||
Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2];
|
||||
Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2];
|
||||
Result[3] = m[3];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> scale
|
||||
(
|
||||
detail::tmat4x4<T> const & m,
|
||||
detail::tvec3<T> const & v
|
||||
)
|
||||
{
|
||||
detail::tmat4x4<T> Result(detail::tmat4x4<T>::null);
|
||||
Result[0] = m[0] * v[0];
|
||||
Result[1] = m[1] * v[1];
|
||||
Result[2] = m[2] * v[2];
|
||||
Result[3] = m[3];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> translate_slow
|
||||
(
|
||||
detail::tmat4x4<T> const & m,
|
||||
detail::tvec3<T> const & v
|
||||
)
|
||||
{
|
||||
detail::tmat4x4<T> Result(T(1));
|
||||
Result[3] = detail::tvec4<T>(v, T(1));
|
||||
return m * Result;
|
||||
|
||||
//detail::tmat4x4<valType> Result(m);
|
||||
Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3];
|
||||
//Result[3][0] = m[0][0] * v[0] + m[1][0] * v[1] + m[2][0] * v[2] + m[3][0];
|
||||
//Result[3][1] = m[0][1] * v[0] + m[1][1] * v[1] + m[2][1] * v[2] + m[3][1];
|
||||
//Result[3][2] = m[0][2] * v[0] + m[1][2] * v[1] + m[2][2] * v[2] + m[3][2];
|
||||
//Result[3][3] = m[0][3] * v[0] + m[1][3] * v[1] + m[2][3] * v[2] + m[3][3];
|
||||
//return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> rotate_slow
|
||||
(
|
||||
detail::tmat4x4<T> const & m,
|
||||
T const & angle,
|
||||
detail::tvec3<T> const & v
|
||||
)
|
||||
{
|
||||
T a = radians(angle);
|
||||
T c = cos(a);
|
||||
T s = sin(a);
|
||||
detail::tmat4x4<T> Result;
|
||||
|
||||
detail::tvec3<T> axis = normalize(v);
|
||||
|
||||
Result[0][0] = c + (1 - c) * axis.x * axis.x;
|
||||
Result[0][1] = (1 - c) * axis.x * axis.y + s * axis.z;
|
||||
Result[0][2] = (1 - c) * axis.x * axis.z - s * axis.y;
|
||||
Result[0][3] = 0;
|
||||
|
||||
Result[1][0] = (1 - c) * axis.y * axis.x - s * axis.z;
|
||||
Result[1][1] = c + (1 - c) * axis.y * axis.y;
|
||||
Result[1][2] = (1 - c) * axis.y * axis.z + s * axis.x;
|
||||
Result[1][3] = 0;
|
||||
|
||||
Result[2][0] = (1 - c) * axis.z * axis.x + s * axis.y;
|
||||
Result[2][1] = (1 - c) * axis.z * axis.y - s * axis.x;
|
||||
Result[2][2] = c + (1 - c) * axis.z * axis.z;
|
||||
Result[2][3] = 0;
|
||||
|
||||
Result[3] = detail::tvec4<T>(0, 0, 0, 1);
|
||||
return m * Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> scale_slow
|
||||
(
|
||||
detail::tmat4x4<T> const & m,
|
||||
detail::tvec3<T> const & v
|
||||
)
|
||||
{
|
||||
detail::tmat4x4<T> Result(T(1));
|
||||
Result[0][0] = v.x;
|
||||
Result[1][1] = v.y;
|
||||
Result[2][2] = v.z;
|
||||
return m * Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> ortho
|
||||
(
|
||||
valType const & left,
|
||||
valType const & right,
|
||||
valType const & bottom,
|
||||
valType const & top,
|
||||
valType const & zNear,
|
||||
valType const & zFar
|
||||
)
|
||||
{
|
||||
detail::tmat4x4<valType> Result(1);
|
||||
Result[0][0] = valType(2) / (right - left);
|
||||
Result[1][1] = valType(2) / (top - bottom);
|
||||
Result[2][2] = - valType(2) / (zFar - zNear);
|
||||
Result[3][0] = - (right + left) / (right - left);
|
||||
Result[3][1] = - (top + bottom) / (top - bottom);
|
||||
Result[3][2] = - (zFar + zNear) / (zFar - zNear);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> ortho(
|
||||
valType const & left,
|
||||
valType const & right,
|
||||
valType const & bottom,
|
||||
valType const & top)
|
||||
{
|
||||
detail::tmat4x4<valType> Result(1);
|
||||
Result[0][0] = valType(2) / (right - left);
|
||||
Result[1][1] = valType(2) / (top - bottom);
|
||||
Result[2][2] = - valType(1);
|
||||
Result[3][0] = - (right + left) / (right - left);
|
||||
Result[3][1] = - (top + bottom) / (top - bottom);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> frustum
|
||||
(
|
||||
valType const & left,
|
||||
valType const & right,
|
||||
valType const & bottom,
|
||||
valType const & top,
|
||||
valType const & nearVal,
|
||||
valType const & farVal
|
||||
)
|
||||
{
|
||||
detail::tmat4x4<valType> Result(0);
|
||||
Result[0][0] = (valType(2) * nearVal) / (right - left);
|
||||
Result[1][1] = (valType(2) * nearVal) / (top - bottom);
|
||||
Result[2][0] = (right + left) / (right - left);
|
||||
Result[2][1] = (top + bottom) / (top - bottom);
|
||||
Result[2][2] = -(farVal + nearVal) / (farVal - nearVal);
|
||||
Result[2][3] = valType(-1);
|
||||
Result[3][2] = -(valType(2) * farVal * nearVal) / (farVal - nearVal);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> perspective
|
||||
(
|
||||
valType const & fovy,
|
||||
valType const & aspect,
|
||||
valType const & zNear,
|
||||
valType const & zFar
|
||||
)
|
||||
{
|
||||
valType range = tan(radians(fovy / valType(2))) * zNear;
|
||||
valType left = -range * aspect;
|
||||
valType right = range * aspect;
|
||||
valType bottom = -range;
|
||||
valType top = range;
|
||||
|
||||
detail::tmat4x4<valType> Result(valType(0));
|
||||
Result[0][0] = (valType(2) * zNear) / (right - left);
|
||||
Result[1][1] = (valType(2) * zNear) / (top - bottom);
|
||||
Result[2][2] = - (zFar + zNear) / (zFar - zNear);
|
||||
Result[2][3] = - valType(1);
|
||||
Result[3][2] = - (valType(2) * zFar * zNear) / (zFar - zNear);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename valType>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<valType> perspectiveFov
|
||||
(
|
||||
valType const & fov,
|
||||
valType const & width,
|
||||
valType const & height,
|
||||
valType const & zNear,
|
||||
valType const & zFar
|
||||
)
|
||||
{
|
||||
valType rad = glm::radians(fov);
|
||||
valType h = glm::cos(valType(0.5) * rad) / glm::sin(valType(0.5) * rad);
|
||||
valType w = h * height / width;
|
||||
|
||||
detail::tmat4x4<valType> Result(valType(0));
|
||||
Result[0][0] = w;
|
||||
Result[1][1] = h;
|
||||
Result[2][2] = (zFar + zNear) / (zFar - zNear);
|
||||
Result[2][3] = valType(1);
|
||||
Result[3][2] = -(valType(2) * zFar * zNear) / (zFar - zNear);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> infinitePerspective
|
||||
(
|
||||
T fovy,
|
||||
T aspect,
|
||||
T zNear
|
||||
)
|
||||
{
|
||||
T range = tan(radians(fovy / T(2))) * zNear;
|
||||
T left = -range * aspect;
|
||||
T right = range * aspect;
|
||||
T bottom = -range;
|
||||
T top = range;
|
||||
|
||||
detail::tmat4x4<T> Result(T(0));
|
||||
Result[0][0] = (T(2) * zNear) / (right - left);
|
||||
Result[1][1] = (T(2) * zNear) / (top - bottom);
|
||||
Result[2][2] = - T(1);
|
||||
Result[2][3] = - T(1);
|
||||
Result[3][2] = - T(2) * zNear;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> tweakedInfinitePerspective
|
||||
(
|
||||
T fovy,
|
||||
T aspect,
|
||||
T zNear
|
||||
)
|
||||
{
|
||||
T range = tan(radians(fovy / T(2))) * zNear;
|
||||
T left = -range * aspect;
|
||||
T right = range * aspect;
|
||||
T bottom = -range;
|
||||
T top = range;
|
||||
|
||||
detail::tmat4x4<T> Result(T(0));
|
||||
Result[0][0] = (T(2) * zNear) / (right - left);
|
||||
Result[1][1] = (T(2) * zNear) / (top - bottom);
|
||||
Result[2][2] = T(0.0001) - T(1);
|
||||
Result[2][3] = T(-1);
|
||||
Result[3][2] = - (T(0.0001) - T(2)) * zNear;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T> project
|
||||
(
|
||||
detail::tvec3<T> const & obj,
|
||||
detail::tmat4x4<T> const & model,
|
||||
detail::tmat4x4<T> const & proj,
|
||||
detail::tvec4<U> const & viewport
|
||||
)
|
||||
{
|
||||
detail::tvec4<T> tmp = detail::tvec4<T>(obj, T(1));
|
||||
tmp = model * tmp;
|
||||
tmp = proj * tmp;
|
||||
|
||||
tmp /= tmp.w;
|
||||
tmp = tmp * T(0.5) + T(0.5);
|
||||
tmp[0] = tmp[0] * T(viewport[2]) + T(viewport[0]);
|
||||
tmp[1] = tmp[1] * T(viewport[3]) + T(viewport[1]);
|
||||
|
||||
return detail::tvec3<T>(tmp);
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T> unProject
|
||||
(
|
||||
detail::tvec3<T> const & win,
|
||||
detail::tmat4x4<T> const & model,
|
||||
detail::tmat4x4<T> const & proj,
|
||||
detail::tvec4<U> const & viewport
|
||||
)
|
||||
{
|
||||
detail::tmat4x4<T> inverse = glm::inverse(proj * model);
|
||||
|
||||
detail::tvec4<T> tmp = detail::tvec4<T>(win, T(1));
|
||||
tmp.x = (tmp.x - T(viewport[0])) / T(viewport[2]);
|
||||
tmp.y = (tmp.y - T(viewport[1])) / T(viewport[3]);
|
||||
tmp = tmp * T(2) - T(1);
|
||||
|
||||
detail::tvec4<T> obj = inverse * tmp;
|
||||
obj /= obj.w;
|
||||
|
||||
return detail::tvec3<T>(obj);
|
||||
}
|
||||
|
||||
template <typename T, typename U>
|
||||
detail::tmat4x4<T> pickMatrix
|
||||
(
|
||||
detail::tvec2<T> const & center,
|
||||
detail::tvec2<T> const & delta,
|
||||
detail::tvec4<U> const & viewport
|
||||
)
|
||||
{
|
||||
assert(delta.x > T(0) && delta.y > T(0));
|
||||
detail::tmat4x4<T> Result(1.0f);
|
||||
|
||||
if(!(delta.x > T(0) && delta.y > T(0)))
|
||||
return Result; // Error
|
||||
|
||||
detail::tvec3<T> Temp(
|
||||
(T(viewport[2]) - T(2) * (center.x - T(viewport[0]))) / delta.x,
|
||||
(T(viewport[3]) - T(2) * (center.y - T(viewport[1]))) / delta.y,
|
||||
T(0));
|
||||
|
||||
// Translate and scale the picked region to the entire window
|
||||
Result = translate(Result, Temp);
|
||||
return scale(Result, detail::tvec3<T>(T(viewport[2]) / delta.x, T(viewport[3]) / delta.y, T(1)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> lookAt
|
||||
(
|
||||
detail::tvec3<T> const & eye,
|
||||
detail::tvec3<T> const & center,
|
||||
detail::tvec3<T> const & up
|
||||
)
|
||||
{
|
||||
detail::tvec3<T> f = normalize(center - eye);
|
||||
detail::tvec3<T> u = normalize(up);
|
||||
detail::tvec3<T> s = normalize(cross(f, u));
|
||||
u = cross(s, f);
|
||||
|
||||
detail::tmat4x4<T> Result(1);
|
||||
Result[0][0] = s.x;
|
||||
Result[1][0] = s.y;
|
||||
Result[2][0] = s.z;
|
||||
Result[0][1] = u.x;
|
||||
Result[1][1] = u.y;
|
||||
Result[2][1] = u.z;
|
||||
Result[0][2] =-f.x;
|
||||
Result[1][2] =-f.y;
|
||||
Result[2][2] =-f.z;
|
||||
/* Test this instead of translate3D
|
||||
Result[3][0] =-dot(s, eye);
|
||||
Result[3][1] =-dot(y, eye);
|
||||
Result[3][2] = dot(f, eye);
|
||||
*/
|
||||
return gtc::matrix_transform::translate(Result, -eye);
|
||||
}
|
||||
}//namespace matrix_transform
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
229
ExternalLibs/glm/gtc/quaternion.hpp
Normal file
229
ExternalLibs/glm/gtc/quaternion.hpp
Normal file
|
@ -0,0 +1,229 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2009-05-21
|
||||
// Updated : 2010-02-04
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/quaternion.hpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Dependency:
|
||||
// - GLM core
|
||||
// - GLM_GTC_half_float
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// ToDo:
|
||||
// - Study constructors with angles and axis
|
||||
// - Study constructors with vec3 that are the imaginary component of quaternion
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_gtc_quaternion
|
||||
#define glm_gtc_quaternion
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
#include "../gtc/half_float.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTC_quaternion extension included")
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
//! \brief Template for quaternion.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
/// \ingroup gtc_quaternion
|
||||
template <typename T>
|
||||
struct tquat// : public genType<T, tquat>
|
||||
{
|
||||
typedef T value_type;
|
||||
|
||||
public:
|
||||
value_type x, y, z, w;
|
||||
|
||||
// Constructors
|
||||
tquat();
|
||||
explicit tquat(
|
||||
value_type const & s,
|
||||
tvec3<T> const & v);
|
||||
explicit tquat(
|
||||
value_type const & w,
|
||||
value_type const & x,
|
||||
value_type const & y,
|
||||
value_type const & z);
|
||||
|
||||
// Convertions
|
||||
//explicit tquat(valType const & pitch, valType const & yaw, valType const & roll);
|
||||
//! pitch, yaw, roll
|
||||
explicit tquat(
|
||||
tvec3<T> const & eulerAngles);
|
||||
explicit tquat(
|
||||
tmat3x3<T> const & m);
|
||||
explicit tquat(
|
||||
tmat4x4<T> const & m);
|
||||
|
||||
// Accesses
|
||||
value_type & operator[](int i);
|
||||
value_type const & operator[](int i) const;
|
||||
|
||||
// Operators
|
||||
tquat<T> & operator*=(value_type const & s);
|
||||
tquat<T> & operator/=(value_type const & s);
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
detail::tquat<T> operator- (
|
||||
detail::tquat<T> const & q);
|
||||
|
||||
template <typename T>
|
||||
detail::tquat<T> operator* (
|
||||
detail::tquat<T> const & q,
|
||||
detail::tquat<T> const & p);
|
||||
|
||||
template <typename T>
|
||||
detail::tvec3<T> operator* (
|
||||
detail::tquat<T> const & q,
|
||||
detail::tvec3<T> const & v);
|
||||
|
||||
template <typename T>
|
||||
detail::tvec3<T> operator* (
|
||||
detail::tvec3<T> const & v,
|
||||
detail::tquat<T> const & q);
|
||||
|
||||
template <typename T>
|
||||
detail::tvec4<T> operator* (
|
||||
detail::tquat<T> const & q,
|
||||
detail::tvec4<T> const & v);
|
||||
|
||||
template <typename T>
|
||||
detail::tvec4<T> operator* (
|
||||
detail::tvec4<T> const & v,
|
||||
detail::tquat<T> const & q);
|
||||
|
||||
template <typename T>
|
||||
detail::tquat<T> operator* (
|
||||
detail::tquat<T> const & q,
|
||||
typename detail::tquat<T>::value_type const & s);
|
||||
|
||||
template <typename T>
|
||||
detail::tquat<T> operator* (
|
||||
typename detail::tquat<T>::value_type const & s,
|
||||
detail::tquat<T> const & q);
|
||||
|
||||
template <typename T>
|
||||
detail::tquat<T> operator/ (
|
||||
detail::tquat<T> const & q,
|
||||
typename detail::tquat<T>::value_type const & s);
|
||||
|
||||
} //namespace detail
|
||||
|
||||
namespace gtc{
|
||||
namespace quaternion ///< GLM_GTC_quaternion extension: Quaternion types and functions
|
||||
{
|
||||
/// \addtogroup gtc_quaternion
|
||||
///@{
|
||||
|
||||
//! Returns the length of the quaternion x.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
template <typename T>
|
||||
typename detail::tquat<T>::value_type length(
|
||||
detail::tquat<T> const & q);
|
||||
|
||||
//! Returns the normalized quaternion of from x.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
template <typename T>
|
||||
detail::tquat<T> normalize(
|
||||
detail::tquat<T> const & q);
|
||||
|
||||
//! Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ...
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
template <typename T>
|
||||
typename detail::tquat<T>::value_type dot(
|
||||
detail::tquat<T> const & q1,
|
||||
detail::tquat<T> const & q2);
|
||||
|
||||
//! Returns the cross product of q1 and q2.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
template <typename T>
|
||||
GLM_DEPRECATED detail::tquat<T> cross(
|
||||
detail::tquat<T> const & q1,
|
||||
detail::tquat<T> const & q2);
|
||||
|
||||
//! Returns a SLERP interpolated quaternion of x and y according a.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
template <typename T>
|
||||
detail::tquat<T> mix(
|
||||
detail::tquat<T> const & x,
|
||||
detail::tquat<T> const & y,
|
||||
typename detail::tquat<T>::value_type const & a);
|
||||
|
||||
//! Returns the q conjugate.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
template <typename T>
|
||||
detail::tquat<T> conjugate(
|
||||
detail::tquat<T> const & q);
|
||||
|
||||
//! Returns the q inverse.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
template <typename T>
|
||||
detail::tquat<T> inverse(
|
||||
detail::tquat<T> const & q);
|
||||
|
||||
//! Rotates a quaternion from an vector of 3 components axis and an angle expressed in degrees.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
template <typename T>
|
||||
detail::tquat<T> rotate(
|
||||
detail::tquat<T> const & q,
|
||||
typename detail::tquat<T>::value_type const & angle,
|
||||
detail::tvec3<T> const & v);
|
||||
|
||||
//! Converts a quaternion to a 3 * 3 matrix.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
template <typename T>
|
||||
detail::tmat3x3<T> mat3_cast(
|
||||
detail::tquat<T> const & x);
|
||||
|
||||
//! Converts a quaternion to a 4 * 4 matrix.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
template <typename T>
|
||||
detail::tmat4x4<T> mat4_cast(
|
||||
detail::tquat<T> const & x);
|
||||
|
||||
//! Converts a 3 * 3 matrix to a quaternion.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
template <typename T>
|
||||
detail::tquat<T> quat_cast(
|
||||
detail::tmat3x3<T> const & x);
|
||||
|
||||
//! Converts a 4 * 4 matrix to a quaternion.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
template <typename T>
|
||||
detail::tquat<T> quat_cast(
|
||||
detail::tmat4x4<T> const & x);
|
||||
|
||||
//! Quaternion of floating-point numbers.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
typedef detail::tquat<float> quat;
|
||||
|
||||
//! Quaternion of half-precision floating-point numbers.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
typedef detail::tquat<detail::thalf> hquat;
|
||||
|
||||
//! Quaternion of single-precision floating-point numbers.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
typedef detail::tquat<float> fquat;
|
||||
|
||||
//! Quaternion of double-precision floating-point numbers.
|
||||
//! From GLM_GTC_quaternion extension.
|
||||
typedef detail::tquat<double> dquat;
|
||||
|
||||
///@}
|
||||
|
||||
} //namespace quaternion
|
||||
} //namespace gtc
|
||||
} //namespace glm
|
||||
|
||||
#include "quaternion.inl"
|
||||
|
||||
namespace glm{using namespace gtc::quaternion;}
|
||||
|
||||
#endif//glm_gtc_quaternion
|
570
ExternalLibs/glm/gtc/quaternion.inl
Normal file
570
ExternalLibs/glm/gtc/quaternion.inl
Normal file
|
@ -0,0 +1,570 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2009-05-21
|
||||
// Updated : 2010-02-04
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/quaternion.inl
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace glm{
|
||||
namespace detail{
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tquat<T>::tquat() :
|
||||
x(0),
|
||||
y(0),
|
||||
z(0),
|
||||
w(1)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tquat<T>::tquat
|
||||
(
|
||||
value_type const & s,
|
||||
tvec3<T> const & v
|
||||
) :
|
||||
x(v.x),
|
||||
y(v.y),
|
||||
z(v.z),
|
||||
w(s)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tquat<T>::tquat
|
||||
(
|
||||
value_type const & w,
|
||||
value_type const & x,
|
||||
value_type const & y,
|
||||
value_type const & z
|
||||
) :
|
||||
x(x),
|
||||
y(y),
|
||||
z(z),
|
||||
w(w)
|
||||
{}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// tquat conversions
|
||||
|
||||
//template <typename valType>
|
||||
//GLM_FUNC_QUALIFIER tquat<valType>::tquat
|
||||
//(
|
||||
// valType const & pitch,
|
||||
// valType const & yaw,
|
||||
// valType const & roll
|
||||
//)
|
||||
//{
|
||||
// tvec3<valType> eulerAngle(pitch * valType(0.5), yaw * valType(0.5), roll * valType(0.5));
|
||||
// tvec3<valType> c = glm::cos(eulerAngle * valType(0.5));
|
||||
// tvec3<valType> s = glm::sin(eulerAngle * valType(0.5));
|
||||
//
|
||||
// this->w = c.x * c.y * c.z + s.x * s.y * s.z;
|
||||
// this->x = s.x * c.y * c.z - c.x * s.y * s.z;
|
||||
// this->y = c.x * s.y * c.z + s.x * c.y * s.z;
|
||||
// this->z = c.x * c.y * s.z - s.x * s.y * c.z;
|
||||
//}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tquat<T>::tquat
|
||||
(
|
||||
tvec3<T> const & eulerAngle
|
||||
)
|
||||
{
|
||||
tvec3<T> c = glm::cos(eulerAngle * value_type(0.5));
|
||||
tvec3<T> s = glm::sin(eulerAngle * value_type(0.5));
|
||||
|
||||
this->w = c.x * c.y * c.z + s.x * s.y * s.z;
|
||||
this->x = s.x * c.y * c.z - c.x * s.y * s.z;
|
||||
this->y = c.x * s.y * c.z + s.x * c.y * s.z;
|
||||
this->z = c.x * c.y * s.z - s.x * s.y * c.z;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tquat<T>::tquat
|
||||
(
|
||||
tmat3x3<T> const & m
|
||||
)
|
||||
{
|
||||
*this = toQuat(m);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tquat<T>::tquat
|
||||
(
|
||||
tmat4x4<T> const & m
|
||||
)
|
||||
{
|
||||
*this = toQuat(m);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// tquat<T> accesses
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER typename tquat<T>::value_type & tquat<T>::operator [] (int i)
|
||||
{
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER typename tquat<T>::value_type const & tquat<T>::operator [] (int i) const
|
||||
{
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// tquat<valType> operators
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tquat<T> & tquat<T>::operator *=
|
||||
(
|
||||
value_type const & s
|
||||
)
|
||||
{
|
||||
this->w *= s;
|
||||
this->x *= s;
|
||||
this->y *= s;
|
||||
this->z *= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER tquat<T> & tquat<T>::operator /=
|
||||
(
|
||||
value_type const & s
|
||||
)
|
||||
{
|
||||
this->w /= s;
|
||||
this->x /= s;
|
||||
this->y /= s;
|
||||
this->z /= s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// tquat<valType> external operators
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> operator-
|
||||
(
|
||||
detail::tquat<T> const & q
|
||||
)
|
||||
{
|
||||
return detail::tquat<T>(-q.w, -q.x, -q.y, -q.z);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> operator*
|
||||
(
|
||||
detail::tquat<T> const & q,
|
||||
detail::tquat<T> const & p
|
||||
)
|
||||
{
|
||||
return detail::tquat<T>(
|
||||
q.w * p.w - q.x * p.x - q.y * p.y - q.z * p.z,
|
||||
q.w * p.x + q.x * p.w + q.y * p.z - q.z * p.y,
|
||||
q.w * p.y + q.y * p.w + q.z * p.x - q.x * p.z,
|
||||
q.w * p.z + q.z * p.w + q.x * p.y - q.y * p.x);
|
||||
}
|
||||
|
||||
// Transformation
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T> operator*
|
||||
(
|
||||
detail::tquat<T> const & q,
|
||||
detail::tvec3<T> const & v
|
||||
)
|
||||
{
|
||||
typename detail::tquat<T>::value_type Two(2);
|
||||
|
||||
detail::tvec3<T> uv, uuv;
|
||||
detail::tvec3<T> QuatVector(q.x, q.y, q.z);
|
||||
uv = glm::cross(QuatVector, v);
|
||||
uuv = glm::cross(QuatVector, uv);
|
||||
uv *= (Two * q.w);
|
||||
uuv *= Two;
|
||||
|
||||
return v + uv + uuv;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T> operator*
|
||||
(
|
||||
detail::tvec3<T> const & v,
|
||||
detail::tquat<T> const & q
|
||||
)
|
||||
{
|
||||
return gtc::quaternion::inverse(q) * v;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T> operator*
|
||||
(
|
||||
detail::tquat<T> const & q,
|
||||
detail::tvec4<T> const & v
|
||||
)
|
||||
{
|
||||
return detail::tvec4<T>(q * detail::tvec3<T>(v), v.w);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T> operator*
|
||||
(
|
||||
detail::tvec4<T> const & v,
|
||||
detail::tquat<T> const & q
|
||||
)
|
||||
{
|
||||
return gtc::quaternion::inverse(q) * v;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> operator*
|
||||
(
|
||||
detail::tquat<T> const & q,
|
||||
typename detail::tquat<T>::value_type const & s
|
||||
)
|
||||
{
|
||||
return detail::tquat<T>(
|
||||
q.w * s, q.x * s, q.y * s, q.z * s);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> operator*
|
||||
(
|
||||
typename detail::tquat<T>::value_type const & s,
|
||||
detail::tquat<T> const & q
|
||||
)
|
||||
{
|
||||
return q * s;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> operator/
|
||||
(
|
||||
detail::tquat<T> const & q,
|
||||
typename detail::tquat<T>::value_type const & s
|
||||
)
|
||||
{
|
||||
return detail::tquat<T>(
|
||||
q.w / s, q.x / s, q.y / s, q.z / s);
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// Boolean operators
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER bool operator==
|
||||
(
|
||||
detail::tquat<T> const & q1,
|
||||
detail::tquat<T> const & q2
|
||||
)
|
||||
{
|
||||
return (q1.x == q2.x) && (q1.y == q2.y) && (q1.z == q2.z) && (q1.w == q2.w);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER bool operator!=
|
||||
(
|
||||
detail::tquat<T> const & q1,
|
||||
detail::tquat<T> const & q2
|
||||
)
|
||||
{
|
||||
return (q1.x != q2.x) || (q1.y != q2.y) || (q1.z != q2.z) || (q1.w != q2.w);
|
||||
}
|
||||
|
||||
}//namespace detail
|
||||
|
||||
namespace gtc{
|
||||
namespace quaternion{
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER typename detail::tquat<T>::value_type length
|
||||
(
|
||||
detail::tquat<T> const & q
|
||||
)
|
||||
{
|
||||
return glm::sqrt(dot(q, q));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> normalize
|
||||
(
|
||||
detail::tquat<T> const & q
|
||||
)
|
||||
{
|
||||
typename detail::tquat<T>::value_type len = length(q);
|
||||
if(len <= typename detail::tquat<T>::value_type(0)) // Problem
|
||||
return detail::tquat<T>(1, 0, 0, 0);
|
||||
typename detail::tquat<T>::value_type oneOverLen = typename detail::tquat<T>::value_type(1) / len;
|
||||
return detail::tquat<T>(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER typename detail::tquat<T>::value_type dot
|
||||
(
|
||||
detail::tquat<T> const & q1,
|
||||
detail::tquat<T> const & q2
|
||||
)
|
||||
{
|
||||
return q1.x * q2.x + q1.y * q2.y + q1.z * q2.z + q1.w * q2.w;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> cross
|
||||
(
|
||||
detail::tquat<T> const & q1,
|
||||
detail::tquat<T> const & q2
|
||||
)
|
||||
{
|
||||
return detail::tquat<T>(
|
||||
q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z,
|
||||
q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y,
|
||||
q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z,
|
||||
q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x);
|
||||
}
|
||||
/*
|
||||
// (x * sin(1 - a) * angle / sin(angle)) + (y * sin(a) * angle / sin(angle))
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> mix
|
||||
(
|
||||
detail::tquat<T> const & x,
|
||||
detail::tquat<T> const & y,
|
||||
typename detail::tquat<T>::value_type const & a
|
||||
)
|
||||
{
|
||||
if(a <= typename detail::tquat<T>::value_type(0)) return x;
|
||||
if(a >= typename detail::tquat<T>::value_type(1)) return y;
|
||||
|
||||
float fCos = dot(x, y);
|
||||
detail::tquat<T> y2(y); //BUG!!! tquat<T> y2;
|
||||
if(fCos < typename detail::tquat<T>::value_type(0))
|
||||
{
|
||||
y2 = -y;
|
||||
fCos = -fCos;
|
||||
}
|
||||
|
||||
//if(fCos > 1.0f) // problem
|
||||
float k0, k1;
|
||||
if(fCos > typename detail::tquat<T>::value_type(0.9999))
|
||||
{
|
||||
k0 = typename detail::tquat<T>::value_type(1) - a;
|
||||
k1 = typename detail::tquat<T>::value_type(0) + a; //BUG!!! 1.0f + a;
|
||||
}
|
||||
else
|
||||
{
|
||||
typename detail::tquat<T>::value_type fSin = sqrt(T(1) - fCos * fCos);
|
||||
typename detail::tquat<T>::value_type fAngle = atan(fSin, fCos);
|
||||
typename detail::tquat<T>::value_type fOneOverSin = T(1) / fSin;
|
||||
k0 = sin((typename detail::tquat<T>::value_type(1) - a) * fAngle) * fOneOverSin;
|
||||
k1 = sin((typename detail::tquat<T>::value_type(0) + a) * fAngle) * fOneOverSin;
|
||||
}
|
||||
|
||||
return detail::tquat<T>(
|
||||
k0 * x.w + k1 * y2.w,
|
||||
k0 * x.x + k1 * y2.x,
|
||||
k0 * x.y + k1 * y2.y,
|
||||
k0 * x.z + k1 * y2.z);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> mix2
|
||||
(
|
||||
detail::tquat<T> const & x,
|
||||
detail::tquat<T> const & y,
|
||||
T const & a
|
||||
)
|
||||
{
|
||||
bool flip = false;
|
||||
if(a <= T(0)) return x;
|
||||
if(a >= T(1)) return y;
|
||||
|
||||
T cos_t = dot(x, y);
|
||||
if(cos_t < T(0))
|
||||
{
|
||||
cos_t = -cos_t;
|
||||
flip = true;
|
||||
}
|
||||
|
||||
T alpha(0), beta(0);
|
||||
|
||||
if(T(1) - cos_t < 1e-7)
|
||||
beta = T(1) - alpha;
|
||||
else
|
||||
{
|
||||
T theta = acos(cos_t);
|
||||
T sin_t = sin(theta);
|
||||
beta = sin(theta * (T(1) - alpha)) / sin_t;
|
||||
alpha = sin(alpha * theta) / sin_t;
|
||||
}
|
||||
|
||||
if(flip)
|
||||
alpha = -alpha;
|
||||
|
||||
return normalize(beta * x + alpha * y);
|
||||
}
|
||||
*/
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> mix
|
||||
(
|
||||
detail::tquat<T> const & x,
|
||||
detail::tquat<T> const & y,
|
||||
T const & a
|
||||
)
|
||||
{
|
||||
T angle = acos(dot(x, y));
|
||||
return (sin((1 - a) * angle) * x + sin(a * angle) * y) / sin(angle);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> conjugate
|
||||
(
|
||||
detail::tquat<T> const & q
|
||||
)
|
||||
{
|
||||
return detail::tquat<T>(q.w, -q.x, -q.y, -q.z);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> inverse
|
||||
(
|
||||
detail::tquat<T> const & q
|
||||
)
|
||||
{
|
||||
return gtc::quaternion::conjugate(q) / gtc::quaternion::dot(q, q);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> rotate
|
||||
(
|
||||
detail::tquat<T> const & q,
|
||||
typename detail::tquat<T>::value_type const & angle,
|
||||
detail::tvec3<T> const & v
|
||||
)
|
||||
{
|
||||
detail::tvec3<T> Tmp = v;
|
||||
|
||||
// Axis of rotation must be normalised
|
||||
typename detail::tquat<T>::value_type len = glm::core::function::geometric::length(Tmp);
|
||||
if(abs(len - typename detail::tquat<T>::value_type(1)) > typename detail::tquat<T>::value_type(0.001))
|
||||
{
|
||||
T oneOverLen = T(1) / len;
|
||||
Tmp.x *= oneOverLen;
|
||||
Tmp.y *= oneOverLen;
|
||||
Tmp.z *= oneOverLen;
|
||||
}
|
||||
|
||||
typename detail::tquat<T>::value_type AngleRad = radians(angle);
|
||||
typename detail::tquat<T>::value_type fSin = sin(AngleRad * T(0.5));
|
||||
|
||||
return gtc::quaternion::cross(q, detail::tquat<T>(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T> mat3_cast
|
||||
(
|
||||
detail::tquat<T> const & q
|
||||
)
|
||||
{
|
||||
detail::tmat3x3<T> Result(typename detail::tquat<T>::value_type(1));
|
||||
Result[0][0] = 1 - 2 * q.y * q.y - 2 * q.z * q.z;
|
||||
Result[0][1] = 2 * q.x * q.y + 2 * q.w * q.z;
|
||||
Result[0][2] = 2 * q.x * q.z - 2 * q.w * q.y;
|
||||
|
||||
Result[1][0] = 2 * q.x * q.y - 2 * q.w * q.z;
|
||||
Result[1][1] = 1 - 2 * q.x * q.x - 2 * q.z * q.z;
|
||||
Result[1][2] = 2 * q.y * q.z + 2 * q.w * q.x;
|
||||
|
||||
Result[2][0] = 2 * q.x * q.z + 2 * q.w * q.y;
|
||||
Result[2][1] = 2 * q.y * q.z - 2 * q.w * q.x;
|
||||
Result[2][2] = 1 - 2 * q.x * q.x - 2 * q.y * q.y;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> mat4_cast
|
||||
(
|
||||
detail::tquat<T> const & q
|
||||
)
|
||||
{
|
||||
return detail::tmat4x4<T>(mat3_cast(q));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> quat_cast
|
||||
(
|
||||
detail::tmat3x3<T> const & m
|
||||
)
|
||||
{
|
||||
typename detail::tquat<T>::value_type fourXSquaredMinus1 = m[0][0] - m[1][1] - m[2][2];
|
||||
typename detail::tquat<T>::value_type fourYSquaredMinus1 = m[1][1] - m[0][0] - m[2][2];
|
||||
typename detail::tquat<T>::value_type fourZSquaredMinus1 = m[2][2] - m[0][0] - m[1][1];
|
||||
typename detail::tquat<T>::value_type fourWSquaredMinus1 = m[0][0] + m[1][1] + m[2][2];
|
||||
|
||||
int biggestIndex = 0;
|
||||
typename detail::tquat<T>::value_type fourBiggestSquaredMinus1 = fourWSquaredMinus1;
|
||||
if(fourXSquaredMinus1 > fourBiggestSquaredMinus1)
|
||||
{
|
||||
fourBiggestSquaredMinus1 = fourXSquaredMinus1;
|
||||
biggestIndex = 1;
|
||||
}
|
||||
if(fourYSquaredMinus1 > fourBiggestSquaredMinus1)
|
||||
{
|
||||
fourBiggestSquaredMinus1 = fourYSquaredMinus1;
|
||||
biggestIndex = 2;
|
||||
}
|
||||
if(fourZSquaredMinus1 > fourBiggestSquaredMinus1)
|
||||
{
|
||||
fourBiggestSquaredMinus1 = fourZSquaredMinus1;
|
||||
biggestIndex = 3;
|
||||
}
|
||||
|
||||
typename detail::tquat<T>::value_type biggestVal = sqrt(fourBiggestSquaredMinus1 + typename detail::tquat<T>::value_type(1)) * typename detail::tquat<T>::value_type(0.5);
|
||||
typename detail::tquat<T>::value_type mult = typename detail::tquat<T>::value_type(0.25) / biggestVal;
|
||||
|
||||
detail::tquat<T> Result;
|
||||
switch(biggestIndex)
|
||||
{
|
||||
case 0:
|
||||
Result.w = biggestVal;
|
||||
Result.x = (m[1][2] - m[2][1]) * mult;
|
||||
Result.y = (m[2][0] - m[0][2]) * mult;
|
||||
Result.z = (m[0][1] - m[1][0]) * mult;
|
||||
break;
|
||||
case 1:
|
||||
Result.w = (m[1][2] - m[2][1]) * mult;
|
||||
Result.x = biggestVal;
|
||||
Result.y = (m[0][1] + m[1][0]) * mult;
|
||||
Result.z = (m[2][0] + m[0][2]) * mult;
|
||||
break;
|
||||
case 2:
|
||||
Result.w = (m[2][0] - m[0][2]) * mult;
|
||||
Result.x = (m[0][1] + m[1][0]) * mult;
|
||||
Result.y = biggestVal;
|
||||
Result.z = (m[1][2] + m[2][1]) * mult;
|
||||
break;
|
||||
case 3:
|
||||
Result.w = (m[0][1] - m[1][0]) * mult;
|
||||
Result.x = (m[2][0] + m[0][2]) * mult;
|
||||
Result.y = (m[1][2] + m[2][1]) * mult;
|
||||
Result.z = biggestVal;
|
||||
break;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tquat<T> quat_cast
|
||||
(
|
||||
detail::tmat4x4<T> const & m4
|
||||
)
|
||||
{
|
||||
return quat_cast(detail::tmat3x3<T>(m4));
|
||||
}
|
||||
|
||||
}//namespace quaternion
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
354
ExternalLibs/glm/gtc/swizzle.hpp
Normal file
354
ExternalLibs/glm/gtc/swizzle.hpp
Normal file
|
@ -0,0 +1,354 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2010-02-20
|
||||
// Updated : 2010-02-20
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/swizzle.hpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Dependency:
|
||||
// - GLM core
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_gtc_swizzle
|
||||
#define glm_gtc_swizzle
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
#include "../gtc/type_precision.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTC_swizzle extension included")
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace gtc{
|
||||
namespace swizzle ///< GLM_GTC_swizzle extension
|
||||
{
|
||||
using namespace gtc::half_float;
|
||||
|
||||
template <typename T, template <typename> class vecType>
|
||||
T const & swizzle(
|
||||
vecType<T> const & v,
|
||||
comp x);
|
||||
|
||||
template <typename T, template <typename> class vecType>
|
||||
detail::tvec2<T> const & swizzle(
|
||||
vecType<T> const & v,
|
||||
comp x, comp y);
|
||||
|
||||
template <typename T, template <typename> class vecType>
|
||||
detail::tvec3<T> const & swizzle(
|
||||
vecType<T> const & v,
|
||||
comp x, comp y, comp z);
|
||||
|
||||
template <typename T, template <typename> class vecType>
|
||||
detail::tvec4<T> const & swizzle(
|
||||
vecType<T> const & v,
|
||||
comp x, comp y, comp z, comp w);
|
||||
|
||||
template <typename T, template <typename> class vecType>
|
||||
T & swizzle(
|
||||
vecType<T> & v,
|
||||
comp x);
|
||||
|
||||
template <typename T, template <typename> class vecType>
|
||||
detail::tref2<T> swizzle(
|
||||
vecType<T> & v,
|
||||
comp x, comp y);
|
||||
|
||||
template <typename T, template <typename> class vecType>
|
||||
detail::tref3<T> swizzle(
|
||||
vecType<T> & v,
|
||||
comp x, comp y, comp z);
|
||||
|
||||
template <typename T, template <typename> class vecType>
|
||||
detail::tref4<T> swizzle(
|
||||
vecType<T> & v,
|
||||
comp x, comp y, comp z, comp w);
|
||||
|
||||
# define static_swizzle1_const(TYPE, SIZE) \
|
||||
template <comp x> \
|
||||
GLM_FUNC_QUALIFIER TYPE swizzle(detail::tvec##SIZE<TYPE> const & v) \
|
||||
{return v[x];}
|
||||
|
||||
# define static_swizzle1_ref(TYPE, SIZE) \
|
||||
template <comp x> \
|
||||
GLM_FUNC_QUALIFIER TYPE& swizzle(detail::tvec##SIZE<TYPE> & v) \
|
||||
{return v[x];}
|
||||
|
||||
static_swizzle1_ref(detail::float16, 2)
|
||||
static_swizzle1_ref(detail::float16, 3)
|
||||
static_swizzle1_ref(detail::float16, 4)
|
||||
static_swizzle1_ref(detail::float32, 2)
|
||||
static_swizzle1_ref(detail::float32, 3)
|
||||
static_swizzle1_ref(detail::float32, 4)
|
||||
static_swizzle1_ref(detail::float64, 2)
|
||||
static_swizzle1_ref(detail::float64, 3)
|
||||
static_swizzle1_ref(detail::float64, 4)
|
||||
|
||||
static_swizzle1_ref(detail::int8, 2)
|
||||
static_swizzle1_ref(detail::int8, 3)
|
||||
static_swizzle1_ref(detail::int8, 4)
|
||||
static_swizzle1_ref(detail::int16, 2)
|
||||
static_swizzle1_ref(detail::int16, 3)
|
||||
static_swizzle1_ref(detail::int16, 4)
|
||||
static_swizzle1_ref(detail::int32, 2)
|
||||
static_swizzle1_ref(detail::int32, 3)
|
||||
static_swizzle1_ref(detail::int32, 4)
|
||||
static_swizzle1_ref(detail::int64, 2)
|
||||
static_swizzle1_ref(detail::int64, 3)
|
||||
static_swizzle1_ref(detail::int64, 4)
|
||||
|
||||
static_swizzle1_ref(detail::uint8, 2)
|
||||
static_swizzle1_ref(detail::uint8, 3)
|
||||
static_swizzle1_ref(detail::uint8, 4)
|
||||
static_swizzle1_ref(detail::uint16, 2)
|
||||
static_swizzle1_ref(detail::uint16, 3)
|
||||
static_swizzle1_ref(detail::uint16, 4)
|
||||
static_swizzle1_ref(detail::uint32, 2)
|
||||
static_swizzle1_ref(detail::uint32, 3)
|
||||
static_swizzle1_ref(detail::uint32, 4)
|
||||
static_swizzle1_ref(detail::uint64, 2)
|
||||
static_swizzle1_ref(detail::uint64, 3)
|
||||
static_swizzle1_ref(detail::uint64, 4)
|
||||
/*
|
||||
# define static_swizzle2_const(TYPE) \
|
||||
template <comp x, comp y> \
|
||||
GLM_FUNC_QUALIFIER TYPE swizzle(TYPE const & v) \
|
||||
{return TYPE(v[x], v[y]);}
|
||||
|
||||
# define static_swizzle3_const(TYPE) \
|
||||
template <comp x, comp y, comp z> \
|
||||
GLM_FUNC_QUALIFIER TYPE swizzle(TYPE const & v) \
|
||||
{return TYPE(v[x], v[y], v[z]);}
|
||||
|
||||
# define static_swizzle4_const(TYPE) \
|
||||
template <comp x, comp y, comp z, comp w> \
|
||||
GLM_FUNC_QUALIFIER TYPE swizzle(TYPE const & v) \
|
||||
{return TYPE(v[x], v[y], v[z], v[w]);}
|
||||
*/
|
||||
|
||||
# define static_swizzle2_const(TYPE, SIZE) \
|
||||
template <comp x, comp y> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<TYPE> swizzle(detail::tvec##SIZE<TYPE> const & v) \
|
||||
{return detail::tvec2<TYPE>(v[x], v[y]);}
|
||||
|
||||
# define static_swizzle3_const(TYPE, SIZE) \
|
||||
template <comp x, comp y, comp z> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<TYPE> swizzle(detail::tvec##SIZE<TYPE> const & v) \
|
||||
{return detail::tvec3<TYPE>(v[x], v[y], v[z]);}
|
||||
|
||||
# define static_swizzle4_const(TYPE, SIZE) \
|
||||
template <comp x, comp y, comp z, comp w> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<TYPE> swizzle(detail::tvec##SIZE<TYPE> const & v) \
|
||||
{return detail::tvec4<TYPE>(v[x], v[y], v[z], v[w]);}
|
||||
|
||||
|
||||
static_swizzle2_const(glm::f16, 2)
|
||||
static_swizzle2_const(glm::f16, 3)
|
||||
static_swizzle2_const(glm::f16, 4)
|
||||
static_swizzle2_const(glm::f32, 2)
|
||||
static_swizzle2_const(glm::f32, 3)
|
||||
static_swizzle2_const(glm::f32, 4)
|
||||
static_swizzle2_const(glm::f64, 2)
|
||||
static_swizzle2_const(glm::f64, 3)
|
||||
static_swizzle2_const(glm::f64, 4)
|
||||
|
||||
static_swizzle2_const(glm::i8, 2)
|
||||
static_swizzle2_const(glm::i8, 3)
|
||||
static_swizzle2_const(glm::i8, 4)
|
||||
static_swizzle2_const(glm::i16, 2)
|
||||
static_swizzle2_const(glm::i16, 3)
|
||||
static_swizzle2_const(glm::i16, 4)
|
||||
static_swizzle2_const(glm::i32, 2)
|
||||
static_swizzle2_const(glm::i32, 3)
|
||||
static_swizzle2_const(glm::i32, 4)
|
||||
static_swizzle2_const(glm::i64, 2)
|
||||
static_swizzle2_const(glm::i64, 3)
|
||||
static_swizzle2_const(glm::i64, 4)
|
||||
|
||||
static_swizzle2_const(glm::u8, 2)
|
||||
static_swizzle2_const(glm::u8, 3)
|
||||
static_swizzle2_const(glm::u8, 4)
|
||||
static_swizzle2_const(glm::u16, 2)
|
||||
static_swizzle2_const(glm::u16, 3)
|
||||
static_swizzle2_const(glm::u16, 4)
|
||||
static_swizzle2_const(glm::u32, 2)
|
||||
static_swizzle2_const(glm::u32, 3)
|
||||
static_swizzle2_const(glm::u32, 4)
|
||||
static_swizzle2_const(glm::u64, 2)
|
||||
static_swizzle2_const(glm::u64, 3)
|
||||
static_swizzle2_const(glm::u64, 4)
|
||||
|
||||
static_swizzle3_const(glm::f16, 2)
|
||||
static_swizzle3_const(glm::f16, 3)
|
||||
static_swizzle3_const(glm::f16, 4)
|
||||
static_swizzle3_const(glm::f32, 2)
|
||||
static_swizzle3_const(glm::f32, 3)
|
||||
static_swizzle3_const(glm::f32, 4)
|
||||
static_swizzle3_const(glm::f64, 2)
|
||||
static_swizzle3_const(glm::f64, 3)
|
||||
static_swizzle3_const(glm::f64, 4)
|
||||
|
||||
static_swizzle3_const(glm::i8, 2)
|
||||
static_swizzle3_const(glm::i8, 3)
|
||||
static_swizzle3_const(glm::i8, 4)
|
||||
static_swizzle3_const(glm::i16, 2)
|
||||
static_swizzle3_const(glm::i16, 3)
|
||||
static_swizzle3_const(glm::i16, 4)
|
||||
static_swizzle3_const(glm::i32, 2)
|
||||
static_swizzle3_const(glm::i32, 3)
|
||||
static_swizzle3_const(glm::i32, 4)
|
||||
static_swizzle3_const(glm::i64, 2)
|
||||
static_swizzle3_const(glm::i64, 3)
|
||||
static_swizzle3_const(glm::i64, 4)
|
||||
|
||||
static_swizzle3_const(glm::u8, 2)
|
||||
static_swizzle3_const(glm::u8, 3)
|
||||
static_swizzle3_const(glm::u8, 4)
|
||||
static_swizzle3_const(glm::u16, 2)
|
||||
static_swizzle3_const(glm::u16, 3)
|
||||
static_swizzle3_const(glm::u16, 4)
|
||||
static_swizzle3_const(glm::u32, 2)
|
||||
static_swizzle3_const(glm::u32, 3)
|
||||
static_swizzle3_const(glm::u32, 4)
|
||||
static_swizzle3_const(glm::u64, 2)
|
||||
static_swizzle3_const(glm::u64, 3)
|
||||
static_swizzle3_const(glm::u64, 4)
|
||||
|
||||
static_swizzle4_const(glm::f16, 2)
|
||||
static_swizzle4_const(glm::f16, 3)
|
||||
static_swizzle4_const(glm::f16, 4)
|
||||
static_swizzle4_const(glm::f32, 2)
|
||||
static_swizzle4_const(glm::f32, 3)
|
||||
static_swizzle4_const(glm::f32, 4)
|
||||
static_swizzle4_const(glm::f64, 2)
|
||||
static_swizzle4_const(glm::f64, 3)
|
||||
static_swizzle4_const(glm::f64, 4)
|
||||
|
||||
static_swizzle4_const(glm::i8, 2)
|
||||
static_swizzle4_const(glm::i8, 3)
|
||||
static_swizzle4_const(glm::i8, 4)
|
||||
static_swizzle4_const(glm::i16, 2)
|
||||
static_swizzle4_const(glm::i16, 3)
|
||||
static_swizzle4_const(glm::i16, 4)
|
||||
static_swizzle4_const(glm::i32, 2)
|
||||
static_swizzle4_const(glm::i32, 3)
|
||||
static_swizzle4_const(glm::i32, 4)
|
||||
static_swizzle4_const(glm::i64, 2)
|
||||
static_swizzle4_const(glm::i64, 3)
|
||||
static_swizzle4_const(glm::i64, 4)
|
||||
|
||||
static_swizzle4_const(glm::u8, 2)
|
||||
static_swizzle4_const(glm::u8, 3)
|
||||
static_swizzle4_const(glm::u8, 4)
|
||||
static_swizzle4_const(glm::u16, 2)
|
||||
static_swizzle4_const(glm::u16, 3)
|
||||
static_swizzle4_const(glm::u16, 4)
|
||||
static_swizzle4_const(glm::u32, 2)
|
||||
static_swizzle4_const(glm::u32, 3)
|
||||
static_swizzle4_const(glm::u32, 4)
|
||||
static_swizzle4_const(glm::u64, 2)
|
||||
static_swizzle4_const(glm::u64, 3)
|
||||
static_swizzle4_const(glm::u64, 4)
|
||||
|
||||
# define static_swizzle2_ref(TYPE, SIZE) \
|
||||
template <glm::comp x, glm::comp y> \
|
||||
GLM_FUNC_QUALIFIER glm::detail::tref2<TYPE> swizzle(detail::tvec##SIZE<TYPE> & v) \
|
||||
{return glm::detail::tref2<TYPE>(v[x], v[y]);}
|
||||
|
||||
# define static_swizzle3_ref(TYPE, SIZE) \
|
||||
template <glm::comp x, glm::comp y, glm::comp z> \
|
||||
GLM_FUNC_QUALIFIER glm::detail::tref3<TYPE> swizzle(detail::tvec##SIZE<TYPE> & v) \
|
||||
{return glm::detail::tref3<TYPE>(v[x], v[y], v[z]);}
|
||||
|
||||
# define static_swizzle4_ref(TYPE, SIZE) \
|
||||
template <glm::comp x, glm::comp y, glm::comp z, glm::comp w> \
|
||||
GLM_FUNC_QUALIFIER glm::detail::tref4<TYPE> swizzle(detail::tvec##SIZE<TYPE> & v) \
|
||||
{return glm::detail::tref4<TYPE>(v[x], v[y], v[z], v[w]);}
|
||||
|
||||
static_swizzle2_ref(glm::f16, 2)
|
||||
static_swizzle2_ref(glm::f16, 3)
|
||||
static_swizzle2_ref(glm::f16, 4)
|
||||
static_swizzle2_ref(glm::f32, 2)
|
||||
static_swizzle2_ref(glm::f32, 3)
|
||||
static_swizzle2_ref(glm::f32, 4)
|
||||
static_swizzle2_ref(glm::f64, 2)
|
||||
static_swizzle2_ref(glm::f64, 3)
|
||||
static_swizzle2_ref(glm::f64, 4)
|
||||
|
||||
static_swizzle2_ref(glm::i8, 2)
|
||||
static_swizzle2_ref(glm::i8, 3)
|
||||
static_swizzle2_ref(glm::i8, 4)
|
||||
static_swizzle2_ref(glm::i16, 2)
|
||||
static_swizzle2_ref(glm::i16, 3)
|
||||
static_swizzle2_ref(glm::i16, 4)
|
||||
static_swizzle2_ref(glm::i32, 2)
|
||||
static_swizzle2_ref(glm::i32, 3)
|
||||
static_swizzle2_ref(glm::i32, 4)
|
||||
static_swizzle2_ref(glm::i64, 2)
|
||||
static_swizzle2_ref(glm::i64, 3)
|
||||
static_swizzle2_ref(glm::i64, 4)
|
||||
|
||||
static_swizzle2_ref(glm::u8, 2)
|
||||
static_swizzle2_ref(glm::u8, 3)
|
||||
static_swizzle2_ref(glm::u8, 4)
|
||||
static_swizzle2_ref(glm::u16, 2)
|
||||
static_swizzle2_ref(glm::u16, 3)
|
||||
static_swizzle2_ref(glm::u16, 4)
|
||||
static_swizzle2_ref(glm::u32, 2)
|
||||
static_swizzle2_ref(glm::u32, 3)
|
||||
static_swizzle2_ref(glm::u32, 4)
|
||||
static_swizzle2_ref(glm::u64, 2)
|
||||
static_swizzle2_ref(glm::u64, 3)
|
||||
static_swizzle2_ref(glm::u64, 4)
|
||||
|
||||
static_swizzle3_ref(glm::f16, 3)
|
||||
static_swizzle3_ref(glm::f16, 4)
|
||||
static_swizzle3_ref(glm::f32, 3)
|
||||
static_swizzle3_ref(glm::f32, 4)
|
||||
static_swizzle3_ref(glm::f64, 3)
|
||||
static_swizzle3_ref(glm::f64, 4)
|
||||
|
||||
static_swizzle3_ref(glm::i8, 3)
|
||||
static_swizzle3_ref(glm::i8, 4)
|
||||
static_swizzle3_ref(glm::i16, 3)
|
||||
static_swizzle3_ref(glm::i16, 4)
|
||||
static_swizzle3_ref(glm::i32, 3)
|
||||
static_swizzle3_ref(glm::i32, 4)
|
||||
static_swizzle3_ref(glm::i64, 3)
|
||||
static_swizzle3_ref(glm::i64, 4)
|
||||
|
||||
static_swizzle3_ref(glm::u8, 3)
|
||||
static_swizzle3_ref(glm::u8, 4)
|
||||
static_swizzle3_ref(glm::u16, 3)
|
||||
static_swizzle3_ref(glm::u16, 4)
|
||||
static_swizzle3_ref(glm::u32, 3)
|
||||
static_swizzle3_ref(glm::u32, 4)
|
||||
static_swizzle3_ref(glm::u64, 3)
|
||||
static_swizzle3_ref(glm::u64, 4)
|
||||
|
||||
static_swizzle4_ref(glm::f16, 4)
|
||||
static_swizzle4_ref(glm::f32, 4)
|
||||
static_swizzle4_ref(glm::f64, 4)
|
||||
|
||||
static_swizzle4_ref(glm::i8, 4)
|
||||
static_swizzle4_ref(glm::i16, 4)
|
||||
static_swizzle4_ref(glm::i32, 4)
|
||||
static_swizzle4_ref(glm::i64, 4)
|
||||
|
||||
static_swizzle4_ref(glm::u8, 4)
|
||||
static_swizzle4_ref(glm::u16, 4)
|
||||
static_swizzle4_ref(glm::u32, 4)
|
||||
static_swizzle4_ref(glm::u64, 4)
|
||||
|
||||
}//namespace swizzle
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
||||
|
||||
#include "swizzle.inl"
|
||||
|
||||
namespace glm{using namespace gtc::swizzle;}
|
||||
|
||||
#endif//glm_gtc_swizzle
|
177
ExternalLibs/glm/gtc/swizzle.inl
Normal file
177
ExternalLibs/glm/gtc/swizzle.inl
Normal file
|
@ -0,0 +1,177 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2011-01-15
|
||||
// Updated : 2011-01-15
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/swizzle.inl
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Dependency:
|
||||
// - GLM core
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm{
|
||||
namespace gtc{
|
||||
namespace swizzle{
|
||||
|
||||
template <typename T, template <typename> class vecType>
|
||||
GLM_FUNC_QUALIFIER T swizzle
|
||||
(
|
||||
vecType<T> const & v,
|
||||
comp x
|
||||
)
|
||||
{
|
||||
assert(int(x) < int(vecType<T>::value_size));
|
||||
return v[x];
|
||||
}
|
||||
|
||||
template <typename T, template <typename> class vecType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T> swizzle
|
||||
(
|
||||
vecType<T> const & v,
|
||||
comp x, comp y
|
||||
)
|
||||
{
|
||||
return detail::tvec2<T>(
|
||||
v[x],
|
||||
v[y]);
|
||||
}
|
||||
|
||||
template <typename T, template <typename> class vecType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T> swizzle
|
||||
(
|
||||
vecType<T> const & v,
|
||||
comp x, comp y, comp z
|
||||
)
|
||||
{
|
||||
return detail::tvec3<T>(
|
||||
v[x],
|
||||
v[y],
|
||||
v[z]);
|
||||
}
|
||||
|
||||
template <typename T, template <typename> class vecType>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T> swizzle
|
||||
(
|
||||
vecType<T> const & v,
|
||||
comp x, comp y, comp z, comp w
|
||||
)
|
||||
{
|
||||
return detail::tvec4<T>(v[x], v[y], v[z], v[w]);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T& swizzle
|
||||
(
|
||||
detail::tvec4<T> & v,
|
||||
comp x
|
||||
)
|
||||
{
|
||||
return v[x];
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tref2<T> swizzle
|
||||
(
|
||||
detail::tvec4<T> & v,
|
||||
comp x, comp y
|
||||
)
|
||||
{
|
||||
return detail::tref2<T>(v[x], v[y]);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tref3<T> swizzle
|
||||
(
|
||||
detail::tvec4<T> & v,
|
||||
comp x, comp y, comp z
|
||||
)
|
||||
{
|
||||
return detail::tref3<T>(v[x], v[y], v[z]);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tref4<T> swizzle
|
||||
(
|
||||
detail::tvec4<T> & v,
|
||||
comp x, comp y, comp z, comp w
|
||||
)
|
||||
{
|
||||
return detail::tref4<T>(v[x], v[y], v[z], v[w]);
|
||||
}
|
||||
/*
|
||||
template <comp x>
|
||||
GLM_FUNC_QUALIFIER float& swizzle
|
||||
(
|
||||
detail::tvec4<float> & v
|
||||
)
|
||||
{
|
||||
return v[x];
|
||||
}
|
||||
|
||||
template <comp x>
|
||||
GLM_FUNC_QUALIFIER int& swizzle
|
||||
(
|
||||
detail::tvec4<int> & v
|
||||
)
|
||||
{
|
||||
return v[x];
|
||||
}
|
||||
|
||||
template <comp x, comp y>
|
||||
GLM_FUNC_QUALIFIER detail::tref2<float> swizzle
|
||||
(
|
||||
detail::tvec4<float> & v
|
||||
)
|
||||
{
|
||||
return detail::tref2<float>(v[x], v[y]);
|
||||
}
|
||||
|
||||
template <comp x, comp y>
|
||||
GLM_FUNC_QUALIFIER detail::tref2<int> swizzle
|
||||
(
|
||||
detail::tvec4<int> & v
|
||||
)
|
||||
{
|
||||
return detail::tref2<int>(v[x], v[y]);
|
||||
}
|
||||
|
||||
template <comp x, comp y, comp z>
|
||||
GLM_FUNC_QUALIFIER detail::tref3<float> swizzle
|
||||
(
|
||||
detail::tvec4<float> & v
|
||||
)
|
||||
{
|
||||
return detail::tref3<float>(v[x], v[y], v[z]);
|
||||
}
|
||||
|
||||
template <comp x, comp y, comp z>
|
||||
GLM_FUNC_QUALIFIER detail::tref3<int> swizzle
|
||||
(
|
||||
detail::tvec4<int> & v
|
||||
)
|
||||
{
|
||||
return detail::tref3<int>(v[x], v[y], v[z]);
|
||||
}
|
||||
|
||||
template <comp x, comp y, comp z, comp w>
|
||||
GLM_FUNC_QUALIFIER detail::tref4<float> swizzle
|
||||
(
|
||||
detail::tvec4<float> & v
|
||||
)
|
||||
{
|
||||
return detail::tref4<float>(v[x], v[y], v[z], v[w]);
|
||||
}
|
||||
|
||||
template <comp x, comp y, comp z, comp w>
|
||||
GLM_FUNC_QUALIFIER detail::tref4<int> swizzle
|
||||
(
|
||||
detail::tvec4<int> & v
|
||||
)
|
||||
{
|
||||
return detail::tref4<int>(v[x], v[y], v[z], v[w]);
|
||||
}
|
||||
*/
|
||||
}//namespace swizzle
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
220
ExternalLibs/glm/gtc/type_precision.hpp
Normal file
220
ExternalLibs/glm/gtc/type_precision.hpp
Normal file
|
@ -0,0 +1,220 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2009-06-04
|
||||
// Updated : 2009-06-04
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/type_precision.hpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Dependency:
|
||||
// - GLM core
|
||||
// - GLM_GTC_half
|
||||
// - GLM_GTC_quaternion
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_gtc_type_precision
|
||||
#define glm_gtc_type_precision
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
#include "../gtc/half_float.hpp"
|
||||
#include "../gtc/quaternion.hpp"
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTC_type_precision extension included")
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace gtc{
|
||||
namespace type_precision ///< GLM_GTC_type_precision extension: Defined types with specific size.
|
||||
{
|
||||
///////////////////////////
|
||||
// Dependences
|
||||
|
||||
using namespace gtc::half_float;
|
||||
using namespace gtc::quaternion;
|
||||
|
||||
///////////////////////////
|
||||
// Signed int vector types
|
||||
|
||||
/// \addtogroup gtc_type_precision
|
||||
///@{
|
||||
|
||||
typedef detail::int8 int8; //!< \brief 8bit signed integer. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::int16 int16; //!< \brief 16bit signed integer. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::int32 int32; //!< \brief 32bit signed integer. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::int64 int64; //!< \brief 64bit signed integer. (from GLM_GTC_type_precision extension)
|
||||
|
||||
typedef int8 i8; //!< \brief 8bit signed integer. (from GLM_GTC_type_precision extension)
|
||||
typedef int16 i16; //!< \brief 16bit signed integer. (from GLM_GTC_type_precision extension)
|
||||
typedef int32 i32; //!< \brief 32bit signed integer. (from GLM_GTC_type_precision extension)
|
||||
typedef int64 i64; //!< \brief 64bit signed integer. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef i8 i8vec1; //!< \brief 8bit signed integer scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec2<i8> i8vec2; //!< \brief 8bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec3<i8> i8vec3; //!< \brief 8bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec4<i8> i8vec4; //!< \brief 8bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef i16 i16vec1; //!< \brief 16bit signed integer scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec2<i16> i16vec2; //!< \brief 16bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec3<i16> i16vec3; //!< \brief 16bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec4<i16> i16vec4; //!< \brief 16bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef i32 i32vec1; //!< \brief 32bit signed integer scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec2<i32> i32vec2; //!< \brief 32bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec3<i32> i32vec3; //!< \brief 32bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec4<i32> i32vec4; //!< \brief 32bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef i64 i64vec1; //!< \brief 32bit signed integer scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec2<i64> i64vec2; //!< \brief 64bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec3<i64> i64vec3; //!< \brief 64bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec4<i64> i64vec4; //!< \brief 64bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension)
|
||||
|
||||
/////////////////////////////
|
||||
// Unsigned int vector types
|
||||
|
||||
typedef detail::uint8 uint8; //!< \brief 8bit unsigned integer. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::uint16 uint16; //!< \brief 16bit unsigned integer. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::uint32 uint32; //!< \brief 32bit unsigned integer. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::uint64 uint64; //!< \brief 64bit unsigned integer. (from GLM_GTC_type_precision extension)
|
||||
|
||||
typedef uint8 u8; //!< \brief 8bit unsigned integer. (from GLM_GTC_type_precision extension)
|
||||
typedef uint16 u16; //!< \brief 16bit unsigned integer. (from GLM_GTC_type_precision extension)
|
||||
typedef uint32 u32; //!< \brief 32bit unsigned integer. (from GLM_GTC_type_precision extension)
|
||||
typedef uint64 u64; //!< \brief 64bit unsigned integer. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef u8 u8vec1; //!< \brief 8bit unsigned integer scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec2<u8> u8vec2; //!< \brief 8bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec3<u8> u8vec3; //!< \brief 8bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec4<u8> u8vec4; //!< \brief 8bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef u16 u16vec1; //!< \brief 16bit unsigned integer scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec2<u16> u16vec2; //!< \brief 16bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec3<u16> u16vec3; //!< \brief 16bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec4<u16> u16vec4; //!< \brief 16bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef u32 u32vec1; //!< \brief 32bit unsigned integer scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec2<u32> u32vec2; //!< \brief 32bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec3<u32> u32vec3; //!< \brief 32bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec4<u32> u32vec4; //!< \brief 32bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef u64 u64vec1; //!< \brief 64bit unsigned integer scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec2<u64> u64vec2; //!< \brief 64bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec3<u64> u64vec3; //!< \brief 64bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec4<u64> u64vec4; //!< \brief 64bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//////////////////////
|
||||
// Float vector types
|
||||
|
||||
typedef detail::float16 float16; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::float32 float32; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::float64 float64; //!< \brief Double-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
|
||||
typedef float16 f16; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef float32 f32; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef float64 f64; //!< \brief Double-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
|
||||
typedef detail::tvec2<float> fvec2; //!< Vector of 2 single-precision floating-point numbers. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec3<float> fvec3; //!< Vector of 3 single-precision floating-point numbers. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec4<float> fvec4; //!< Vector of 4 single-precision floating-point numbers. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef f16 f16vec1; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec2<f16> f16vec2; //!< \brief Half-precision floating-point vector of 2 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec3<f16> f16vec3; //!< \brief Half-precision floating-point vector of 3 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec4<f16> f16vec4; //!< \brief Half-precision floating-point vector of 4 components. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef f32 f32vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec2<f32> f32vec2; //!< \brief Single-precision floating-point vector of 2 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec3<f32> f32vec3; //!< \brief Single-precision floating-point vector of 3 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec4<f32> f32vec4; //!< \brief Single-precision floating-point vector of 4 components. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef f64 f64vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec2<f64> f64vec2; //!< \brief Double-precision floating-point vector of 2 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec3<f64> f64vec3; //!< \brief Double-precision floating-point vector of 3 components. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tvec4<f64> f64vec4; //!< \brief Double-precision floating-point vector of 4 components. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//////////////////////
|
||||
// Float matrix types
|
||||
|
||||
//typedef f32 fmat1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x2<f32> fmat2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x3<f32> fmat3; //!< \brief Single-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x4<f32> fmat4; //!< \brief Single-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef f32 fmat1x1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x2<f32> fmat2x2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x3<f32> fmat2x3; //!< \brief Single-precision floating-point 2x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x4<f32> fmat2x4; //!< \brief Single-precision floating-point 2x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x2<f32> fmat3x2; //!< \brief Single-precision floating-point 3x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x3<f32> fmat3x3; //!< \brief Single-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x4<f32> fmat3x4; //!< \brief Single-precision floating-point 3x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x2<f32> fmat4x2; //!< \brief Single-precision floating-point 4x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x3<f32> fmat4x3; //!< \brief Single-precision floating-point 4x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x4<f32> fmat4x4; //!< \brief Single-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef f16 f16mat1; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x2<f16> f16mat2; //!< \brief Half-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x3<f16> f16mat3; //!< \brief Half-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x4<f16> f16mat4; //!< \brief Half-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef f16 f16mat1x1; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x2<f16> f16mat2x2; //!< \brief Half-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x3<f16> f16mat2x3; //!< \brief Half-precision floating-point 2x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x4<f16> f16mat2x4; //!< \brief Half-precision floating-point 2x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x2<f16> f16mat3x2; //!< \brief Half-precision floating-point 3x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x3<f16> f16mat3x3; //!< \brief Half-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x4<f16> f16mat3x4; //!< \brief Half-precision floating-point 3x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x2<f16> f16mat4x2; //!< \brief Half-precision floating-point 4x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x3<f16> f16mat4x3; //!< \brief Half-precision floating-point 4x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x4<f16> f16mat4x4; //!< \brief Half-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef f32 f32mat1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x2<f32> f32mat2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x3<f32> f32mat3; //!< \brief Single-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x4<f32> f32mat4; //!< \brief Single-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef f32 f32mat1x1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x2<f32> f32mat2x2; //!< \brief Single-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x3<f32> f32mat2x3; //!< \brief Single-precision floating-point 2x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x4<f32> f32mat2x4; //!< \brief Single-precision floating-point 2x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x2<f32> f32mat3x2; //!< \brief Single-precision floating-point 3x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x3<f32> f32mat3x3; //!< \brief Single-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x4<f32> f32mat3x4; //!< \brief Single-precision floating-point 3x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x2<f32> f32mat4x2; //!< \brief Single-precision floating-point 4x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x3<f32> f32mat4x3; //!< \brief Single-precision floating-point 4x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x4<f32> f32mat4x4; //!< \brief Single-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef f64 f64mat1; //!< \brief Double-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x2<f64> f64mat2; //!< \brief Double-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x3<f64> f64mat3; //!< \brief Double-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x4<f64> f64mat4; //!< \brief Double-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//typedef f64 f64mat1x1; //!< \brief Double-precision floating-point scalar. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x2<f64> f64mat2x2; //!< \brief Double-precision floating-point 2x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x3<f64> f64mat2x3; //!< \brief Double-precision floating-point 2x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat2x4<f64> f64mat2x4; //!< \brief Double-precision floating-point 2x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x2<f64> f64mat3x2; //!< \brief Double-precision floating-point 3x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x3<f64> f64mat3x3; //!< \brief Double-precision floating-point 3x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat3x4<f64> f64mat3x4; //!< \brief Double-precision floating-point 3x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x2<f64> f64mat4x2; //!< \brief Double-precision floating-point 4x2 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x3<f64> f64mat4x3; //!< \brief Double-precision floating-point 4x3 matrix. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tmat4x4<f64> f64mat4x4; //!< \brief Double-precision floating-point 4x4 matrix. (from GLM_GTC_type_precision extension)
|
||||
|
||||
//////////////////////////
|
||||
// Float quaternion types
|
||||
|
||||
typedef detail::tquat<f16> f16quat; //!< \brief Half-precision floating-point quaternion. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tquat<f32> f32quat; //!< \brief Single-precision floating-point quaternion. (from GLM_GTC_type_precision extension)
|
||||
typedef detail::tquat<f64> f64quat; //!< \brief Double-precision floating-point quaternion. (from GLM_GTC_type_precision extension)
|
||||
|
||||
///@}
|
||||
|
||||
}//namespace type_precision
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
||||
|
||||
#include "type_precision.inl"
|
||||
|
||||
namespace glm{using namespace gtc::type_precision;}
|
||||
|
||||
#endif//glm_gtc_type_precision
|
13
ExternalLibs/glm/gtc/type_precision.inl
Normal file
13
ExternalLibs/glm/gtc/type_precision.inl
Normal file
|
@ -0,0 +1,13 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2009-06-14
|
||||
// Updated : 2009-06-14
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/type_precision.inl
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace glm
|
||||
{
|
||||
|
||||
}
|
449
ExternalLibs/glm/gtc/type_ptr.hpp
Normal file
449
ExternalLibs/glm/gtc/type_ptr.hpp
Normal file
|
@ -0,0 +1,449 @@
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2009-05-06
|
||||
// Updated : 2010-04-30
|
||||
// Licence : This source is under MIT License
|
||||
// File : glm/gtc/type_ptr.hpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Dependency:
|
||||
// - GLM core
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_gtc_type_ptr
|
||||
#define glm_gtc_type_ptr
|
||||
|
||||
// Dependency:
|
||||
#include "../glm.hpp"
|
||||
#include <cstring>
|
||||
|
||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||
# pragma message("GLM: GLM_GTC_type_ptr extension included")
|
||||
#endif
|
||||
|
||||
namespace glm{
|
||||
namespace gtc{
|
||||
namespace type_ptr ///< GLM_GTC_type_ptr extension: Get access to vectors & matrices value type address.
|
||||
{
|
||||
|
||||
/// \addtogroup gtc_type_ptr
|
||||
///@{
|
||||
|
||||
//! Get the const address of the vector content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
detail::tvec2<T> const & vec
|
||||
)
|
||||
{
|
||||
return &(vec.x);
|
||||
}
|
||||
|
||||
//! Get the address of the vector content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
detail::tvec2<T> & vec
|
||||
)
|
||||
{
|
||||
return &(vec.x);
|
||||
}
|
||||
|
||||
//! Get the const address of the vector content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
detail::tvec3<T> const & vec
|
||||
)
|
||||
{
|
||||
return &(vec.x);
|
||||
}
|
||||
|
||||
//! Get the address of the vector content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
detail::tvec3<T> & vec
|
||||
)
|
||||
{
|
||||
return &(vec.x);
|
||||
}
|
||||
|
||||
//! Get the const address of the vector content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
detail::tvec4<T> const & vec
|
||||
)
|
||||
{
|
||||
return &(vec.x);
|
||||
}
|
||||
|
||||
//! Get the address of the vector content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
detail::tvec4<T> & vec
|
||||
)
|
||||
{
|
||||
return &(vec.x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
detail::tmat2x2<T> const & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
detail::tmat2x2<T> & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
detail::tmat3x3<T> const & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
detail::tmat3x3<T> & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
detail::tmat4x4<T> const & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
detail::tmat4x4<T> & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
detail::tmat2x3<T> const & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
detail::tmat2x3<T> & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
detail::tmat3x2<T> const & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
detail::tmat3x2<T> & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
detail::tmat2x4<T> const & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
detail::tmat2x4<T> & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
detail::tmat4x2<T> const & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
detail::tmat4x2<T> & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
detail::tmat3x4<T> const & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr
|
||||
(
|
||||
detail::tmat3x4<T> & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the const address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr
|
||||
(
|
||||
detail::tmat4x3<T> const & mat
|
||||
)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Get the address of the matrix content.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr(detail::tmat4x3<T> & mat)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
}
|
||||
|
||||
//! Build a vector from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T> make_vec2(T const * const ptr)
|
||||
{
|
||||
detail::tvec2<T> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tvec2<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
//! Build a vector from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T> make_vec3(T const * const ptr)
|
||||
{
|
||||
detail::tvec3<T> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tvec3<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
//! Build a vector from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T> make_vec4(T const * const ptr)
|
||||
{
|
||||
detail::tvec4<T> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tvec4<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x2<T> make_mat2x2(T const * const ptr)
|
||||
{
|
||||
detail::tmat2x2<T> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x2<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x3<T> make_mat2x3(T const * const ptr)
|
||||
{
|
||||
detail::tmat2x3<T> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x3<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x4<T> make_mat2x4(T const * const ptr)
|
||||
{
|
||||
detail::tmat2x4<T> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat2x4<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x2<T> make_mat3x2(T const * const ptr)
|
||||
{
|
||||
detail::tmat3x2<T> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x2<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T> make_mat3x3(T const * const ptr)
|
||||
{
|
||||
detail::tmat3x3<T> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x3<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x4<T> make_mat3x4(T const * const ptr)
|
||||
{
|
||||
detail::tmat3x4<T> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat3x4<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x2<T> make_mat4x2(T const * const ptr)
|
||||
{
|
||||
detail::tmat4x2<T> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x2<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x3<T> make_mat4x3(T const * const ptr)
|
||||
{
|
||||
detail::tmat4x3<T> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x3<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> make_mat4x4(T const * const ptr)
|
||||
{
|
||||
detail::tmat4x4<T> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(detail::tmat4x4<T>));
|
||||
return Result;
|
||||
}
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat2x2<T> make_mat2(T const * const ptr)
|
||||
{
|
||||
return make_mat2x2(ptr);
|
||||
}
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat3x3<T> make_mat3(T const * const ptr)
|
||||
{
|
||||
return make_mat3x3(ptr);
|
||||
}
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> make_mat4(T const * const ptr)
|
||||
{
|
||||
return make_mat4x4(ptr);
|
||||
}
|
||||
|
||||
///@}
|
||||
|
||||
}//namespace type_ptr
|
||||
}//namespace gtc
|
||||
}//namespace glm
|
||||
|
||||
#include "type_ptr.inl"
|
||||
|
||||
namespace glm{using namespace gtc::type_ptr;}
|
||||
|
||||
#endif//glm_gtx_type_ptr
|
||||
|
0
ExternalLibs/glm/gtc/type_ptr.inl
Normal file
0
ExternalLibs/glm/gtc/type_ptr.inl
Normal file
Loading…
Add table
Add a link
Reference in a new issue