This commit is contained in:
Christophe Riccio 2014-01-01 14:05:48 +01:00
commit 4f2d7a97e0
34 changed files with 161 additions and 240 deletions

View File

@ -37,6 +37,8 @@
#define GLM_FUNC_COMMON_INCLUDED #define GLM_FUNC_COMMON_INCLUDED
#include "setup.hpp" #include "setup.hpp"
#include "precision.hpp"
#include "type_int.hpp"
#include "_fixes.hpp" #include "_fixes.hpp"
namespace glm namespace glm

View File

@ -92,10 +92,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat2x2(
U const & x);
template <typename U, typename V, typename M, typename N> template <typename U, typename V, typename M, typename N>
GLM_FUNC_DECL explicit tmat2x2( GLM_FUNC_DECL explicit tmat2x2(
U const & x1, V const & y1, U const & x1, V const & y1,

View File

@ -154,18 +154,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec2<T, P>(static_cast<T>(s), Zero);
this->value[1] = tvec2<T, P>(Zero, value_type(s));
}
template <typename T, precision P> template <typename T, precision P>
template <typename X1, typename Y1, typename X2, typename Y2> template <typename X1, typename Y1, typename X2, typename Y2>
GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2 GLM_FUNC_QUALIFIER tmat2x2<T, P>::tmat2x2

View File

@ -82,10 +82,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat2x3(
U const & x);
template <typename X1, typename Y1, typename Z1, typename X2, typename Y2, typename Z2> template <typename X1, typename Y1, typename Z1, typename X2, typename Y2, typename Z2>
GLM_FUNC_DECL explicit tmat2x3( GLM_FUNC_DECL explicit tmat2x3(
X1 const & x1, Y1 const & y1, Z1 const & z1, X1 const & x1, Y1 const & y1, Z1 const & z1,

View File

@ -153,18 +153,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x3<T, P>::tmat2x3
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec3<T, P>(static_cast<T>(s), Zero, Zero);
this->value[1] = tvec3<T, P>(Zero, value_type(s), Zero);
}
template <typename T, precision P> template <typename T, precision P>
template < template <
typename X1, typename Y1, typename Z1, typename X1, typename Y1, typename Z1,

View File

@ -82,10 +82,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat2x4(
U const & x);
template < template <
typename X1, typename Y1, typename Z1, typename W1, typename X1, typename Y1, typename Z1, typename W1,
typename X2, typename Y2, typename Z2, typename W2> typename X2, typename Y2, typename Z2, typename W2>

View File

@ -156,18 +156,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat2x4<T, P>::tmat2x4
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec4<T, P>(static_cast<T>(s), Zero, Zero, Zero);
this->value[1] = tvec4<T, P>(Zero, value_type(s), Zero, Zero);
}
template <typename T, precision P> template <typename T, precision P>
template < template <
typename X1, typename Y1, typename Z1, typename W1, typename X1, typename Y1, typename Z1, typename W1,

View File

@ -84,10 +84,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat3x2(
U const & x);
template< template<
typename X1, typename Y1, typename X1, typename Y1,
typename X2, typename Y2, typename X2, typename Y2,

View File

@ -163,19 +163,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x2<T, P>::tmat3x2
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec2<T, P>(static_cast<T>(s), Zero);
this->value[1] = tvec2<T, P>(Zero, value_type(s));
this->value[2] = tvec2<T, P>(Zero);
}
template <typename T, precision P> template <typename T, precision P>
template < template <
typename X1, typename Y1, typename X1, typename Y1,

View File

@ -93,10 +93,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat3x3(
U const & x);
template< template<
typename X1, typename Y1, typename Z1, typename X1, typename Y1, typename Z1,
typename X2, typename Y2, typename Z2, typename X2, typename Y2, typename Z2,

View File

@ -166,19 +166,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x3<T, P>::tmat3x3
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec3<T, P>(static_cast<T>(s), Zero, Zero);
this->value[1] = tvec3<T, P>(Zero, value_type(s), Zero);
this->value[2] = tvec3<T, P>(Zero, Zero, value_type(s));
}
template <typename T, precision P> template <typename T, precision P>
template < template <
typename X1, typename Y1, typename Z1, typename X1, typename Y1, typename Z1,

View File

@ -84,10 +84,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat3x4(
U const & x);
template< template<
typename X1, typename Y1, typename Z1, typename W1, typename X1, typename Y1, typename Z1, typename W1,
typename X2, typename Y2, typename Z2, typename W2, typename X2, typename Y2, typename Z2, typename W2,

View File

@ -139,19 +139,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat3x4<T, P>::tmat3x4
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec4<T, P>(static_cast<T>(s), Zero, Zero, Zero);
this->value[1] = tvec4<T, P>(Zero, value_type(s), Zero, Zero);
this->value[2] = tvec4<T, P>(Zero, Zero, value_type(s), Zero);
}
template <typename T, precision P> template <typename T, precision P>
template < template <
typename X1, typename Y1, typename Z1, typename W1, typename X1, typename Y1, typename Z1, typename W1,

View File

@ -86,9 +86,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat4x2(
U const & x);
template< template<
typename X1, typename Y1, typename X1, typename Y1,

View File

@ -144,19 +144,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x2<T, P>::tmat4x2
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec2<T, P>(static_cast<T>(s), Zero);
this->value[1] = tvec2<T, P>(Zero, value_type(s));
this->value[2] = tvec2<T, P>(Zero, Zero);
this->value[3] = tvec2<T, P>(Zero, Zero);
}
template <typename T, precision P> template <typename T, precision P>
template < template <

View File

@ -86,9 +86,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat4x3(
U const & x);
template < template <
typename X1, typename Y1, typename Z1, typename X1, typename Y1, typename Z1,

View File

@ -169,19 +169,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x3<T, P>::tmat4x3
(
U const & s
)
{
value_type const Zero(0);
this->value[0] = tvec3<T, P>(static_cast<T>(s), Zero, Zero);
this->value[1] = tvec3<T, P>(Zero, value_type(s), Zero);
this->value[2] = tvec3<T, P>(Zero, Zero, value_type(s));
this->value[3] = tvec3<T, P>(Zero, Zero, Zero);
}
template <typename T, precision P> template <typename T, precision P>
template < template <

View File

@ -99,9 +99,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversions // Conversions
template <typename U>
GLM_FUNC_DECL explicit tmat4x4(
U const & x);
template < template <
typename X1, typename Y1, typename Z1, typename W1, typename X1, typename Y1, typename Z1, typename W1,

View File

@ -191,22 +191,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tmat4x4<T, P>::tmat4x4
(
U const & s
)
{
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || std::numeric_limits<U>::is_integer, "*mat4x4 constructor only takes float and integer types");
value_type const Zero(0);
this->value[0] = tvec4<T, P>(static_cast<T>(s), Zero, Zero, Zero);
this->value[1] = tvec4<T, P>(Zero, value_type(s), Zero, Zero);
this->value[2] = tvec4<T, P>(Zero, Zero, value_type(s), Zero);
this->value[3] = tvec4<T, P>(Zero, Zero, Zero, value_type(s));
}
template <typename T, precision P> template <typename T, precision P>
template < template <
typename X1, typename Y1, typename Z1, typename W1, typename X1, typename Y1, typename Z1, typename W1,

View File

@ -137,10 +137,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion constructors // Conversion constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
GLM_FUNC_DECL explicit tvec2(
U const & x);
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, typename V> template <typename U, typename V>
GLM_FUNC_DECL explicit tvec2( GLM_FUNC_DECL explicit tvec2(

View File

@ -111,16 +111,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion scalar constructors // Conversion scalar constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2
(
U const & x
) :
x(static_cast<T>(x)),
y(static_cast<T>(x))
{}
template <typename T, precision P> template <typename T, precision P>
template <typename U, typename V> template <typename U, typename V>
GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2 GLM_FUNC_QUALIFIER tvec2<T, P>::tvec2

View File

@ -128,10 +128,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion scalar constructors // Conversion scalar constructors
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
GLM_FUNC_DECL explicit tvec3(
U const & x);
//! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U, typename V, typename W> template <typename U, typename V, typename W>
GLM_FUNC_DECL explicit tvec3( GLM_FUNC_DECL explicit tvec3(

View File

@ -118,17 +118,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion scalar constructors // Conversion scalar constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3
(
U const & s
) :
x(static_cast<T>(s)),
y(static_cast<T>(s)),
z(static_cast<T>(s))
{}
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, typename C> template <typename A, typename B, typename C>
GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3 GLM_FUNC_QUALIFIER tvec3<T, P>::tvec3

View File

@ -168,10 +168,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion scalar constructors // Conversion scalar constructors
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
GLM_FUNC_DECL explicit tvec4(
U const & x);
/// Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// 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> template <typename A, typename B, typename C, typename D>
GLM_FUNC_DECL explicit tvec4( GLM_FUNC_DECL explicit tvec4(

View File

@ -181,29 +181,6 @@ namespace detail
////////////////////////////////////// //////////////////////////////////////
// Conversion scalar constructors // Conversion scalar constructors
template <typename T, precision P>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4(U const & x) :
x(static_cast<T>(x)),
y(static_cast<T>(x)),
z(static_cast<T>(x)),
w(static_cast<T>(x))
{}
#if((GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2))
template <>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4(U const & x) :
data(_mm_set_ps(static_cast<float>(x), static_cast<float>(x), static_cast<float>(x), static_cast<float>(x)))
{}
template <>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<float, mediump>::tvec4(U const & x) :
data(_mm_set_ps(static_cast<float>(x), static_cast<float>(x), static_cast<float>(x), static_cast<float>(x)))
{}
#endif
template <typename T, precision P> template <typename T, precision P>
template <typename A, typename B, typename C, typename D> template <typename A, typename B, typename C, typename D>
GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4 GLM_FUNC_QUALIFIER tvec4<T, P>::tvec4

View File

@ -28,6 +28,7 @@
#include "../geometric.hpp" #include "../geometric.hpp"
#include "../trigonometric.hpp" #include "../trigonometric.hpp"
#include "../matrix.hpp"
namespace glm namespace glm
{ {

View File

@ -74,7 +74,7 @@ namespace glm
/// @see vec4 unpackUnorm4x8(uint32 p) /// @see vec4 unpackUnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL float unpackUnorm1x8(uint8 pdf); GLM_FUNC_DECL float unpackUnorm1x8(uint8 const & p);
/// First, converts each component of the normalized floating-point value v into 8-bit integer values. /// First, converts each component of the normalized floating-point value v into 8-bit integer values.
/// Then, the results are packed into the returned 16-bit unsigned integer. /// Then, the results are packed into the returned 16-bit unsigned integer.
@ -106,7 +106,7 @@ namespace glm
/// @see vec4 unpackUnorm4x8(uint32 p) /// @see vec4 unpackUnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 p); GLM_FUNC_DECL vec2 unpackUnorm2x8(uint16 const & p);
/// First, converts the normalized floating-point value v into 8-bit integer value. /// First, converts the normalized floating-point value v into 8-bit integer value.
/// Then, the results are packed into the returned 8-bit unsigned integer. /// Then, the results are packed into the returned 8-bit unsigned integer.
@ -132,7 +132,7 @@ namespace glm
/// @see vec4 unpackSnorm4x8(uint32 p) /// @see vec4 unpackSnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL float unpackSnorm1x8(uint8 p); GLM_FUNC_DECL float unpackSnorm1x8(uint8 const & p);
/// First, converts each component of the normalized floating-point value v into 8-bit integer values. /// First, converts each component of the normalized floating-point value v into 8-bit integer values.
/// Then, the results are packed into the returned 16-bit unsigned integer. /// Then, the results are packed into the returned 16-bit unsigned integer.
@ -164,7 +164,7 @@ namespace glm
/// @see vec4 unpackSnorm4x8(uint32 p) /// @see vec4 unpackSnorm4x8(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 p); GLM_FUNC_DECL vec2 unpackSnorm2x8(uint16 const & p);
/// First, converts the normalized floating-point value v into a 16-bit integer value. /// First, converts the normalized floating-point value v into a 16-bit integer value.
/// Then, the results are packed into the returned 16-bit unsigned integer. /// Then, the results are packed into the returned 16-bit unsigned integer.
@ -177,7 +177,7 @@ namespace glm
/// @see uint64 packSnorm4x16(vec4 const & v) /// @see uint64 packSnorm4x16(vec4 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL uint16 packUnorm1x16(float v); GLM_FUNC_DECL uint16 packUnorm1x16(float const & v);
/// First, unpacks a single 16-bit unsigned integer p into a of 16-bit unsigned integers. /// First, unpacks a single 16-bit unsigned integer p into a of 16-bit unsigned integers.
/// Then, the value is converted to a normalized floating-point value to generate the returned scalar. /// Then, the value is converted to a normalized floating-point value to generate the returned scalar.
@ -190,7 +190,7 @@ namespace glm
/// @see vec4 unpackUnorm4x16(uint64 p) /// @see vec4 unpackUnorm4x16(uint64 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL float unpackUnorm1x16(uint16 p); GLM_FUNC_DECL float unpackUnorm1x16(uint16 const & p);
/// First, converts each component of the normalized floating-point value v into 16-bit integer values. /// First, converts each component of the normalized floating-point value v into 16-bit integer values.
/// Then, the results are packed into the returned 64-bit unsigned integer. /// Then, the results are packed into the returned 64-bit unsigned integer.
@ -235,7 +235,7 @@ namespace glm
/// @see uint64 packSnorm4x16(vec4 const & v) /// @see uint64 packSnorm4x16(vec4 const & v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL uint16 packSnorm1x16(float v); GLM_FUNC_DECL uint16 packSnorm1x16(float const & v);
/// First, unpacks a single 16-bit unsigned integer p into a single 16-bit signed integers. /// First, unpacks a single 16-bit unsigned integer p into a single 16-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned scalar. /// Then, each component is converted to a normalized floating-point value to generate the returned scalar.
@ -248,7 +248,7 @@ namespace glm
/// @see vec4 unpackSnorm4x16(uint64 p) /// @see vec4 unpackSnorm4x16(uint64 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm1x16.xml">GLSL unpackSnorm4x8 man page</a> /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm1x16.xml">GLSL unpackSnorm4x8 man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a> /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
GLM_FUNC_DECL float unpackSnorm1x16(uint16 p); GLM_FUNC_DECL float unpackSnorm1x16(uint16 const & p);
/// First, converts each component of the normalized floating-point value v into 16-bit integer values. /// First, converts each component of the normalized floating-point value v into 16-bit integer values.
/// Then, the results are packed into the returned 64-bit unsigned integer. /// Then, the results are packed into the returned 64-bit unsigned integer.

View File

@ -225,7 +225,7 @@ namespace detail
GLM_FUNC_QUALIFIER float unpackUnorm1x8(uint8 const & p) GLM_FUNC_QUALIFIER float unpackUnorm1x8(uint8 const & p)
{ {
float Unpack(static_cast<float>(p)); float Unpack(static_cast<float>(p));
return Unpack * float(0.0039215686274509803921568627451); // 1 / 255 return Unpack * static_cast<float>(0.0039215686274509803921568627451); // 1 / 255
} }
GLM_FUNC_QUALIFIER uint16 packUnorm2x8(vec2 const & v) GLM_FUNC_QUALIFIER uint16 packUnorm2x8(vec2 const & v)

View File

@ -48,6 +48,9 @@ GLM 0.9.5.1: 2014-XX-XX
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Fixed angle and orientedAngle that sometimes return NaN values (#145) - Fixed angle and orientedAngle that sometimes return NaN values (#145)
- Deprecated degrees for function parameters and display a message - Deprecated degrees for function parameters and display a message
- Added possible static_cast conversion of GLM types (#72)
- Fixed error 'inverse' is not a member of 'glm' from glm::unProject (#146)
- Fixed mismatch of GTC_packing declaration and definition prototypes
================================================================================ ================================================================================
GLM 0.9.5.0: 2013-12-25 GLM 0.9.5.0: 2013-12-25

View File

@ -7,12 +7,38 @@
// File : test/core/func_exponential.cpp // File : test/core/func_exponential.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/common.hpp>
#include <glm/exponential.hpp> #include <glm/exponential.hpp>
#include <glm/gtc/ulp.hpp>
namespace inversesqrt
{
int test()
{
int Error(0);
glm::uint ulp(0);
float diff(0.0f);
for(float f = 0.001f; f < 10.f; f *= 1.001f)
{
glm::lowp_fvec1 lowp_v = glm::inversesqrt(glm::lowp_fvec1(f));
float defaultp_v = glm::inversesqrt(f);
ulp = glm::max(glm::float_distance(lowp_v.x, defaultp_v), ulp);
diff = glm::abs(lowp_v.x - defaultp_v);
}
return Error;
}
}//namespace inversesqrt
int main() int main()
{ {
int Failed = 0; int Error(0);
return Failed; Error += inversesqrt::test();
return Error;
} }

View File

@ -27,8 +27,9 @@ int test_vec2_cast()
glm::mediump_vec2 G = static_cast<glm::mediump_vec2>(A); glm::mediump_vec2 G = static_cast<glm::mediump_vec2>(A);
glm::highp_vec2 H = static_cast<glm::highp_vec2>(A); glm::highp_vec2 H = static_cast<glm::highp_vec2>(A);
//my_vec2 I; my_vec2 I;
//glm::vec2 J = static_cast<glm::vec2>(I); glm::vec2 J = static_cast<glm::vec2>(I);
glm::vec2 K(7.8);
int Error(0); int Error(0);

View File

@ -7,15 +7,21 @@
// File : test/gtc/matrix_transform.cpp // File : test/gtc/matrix_transform.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#define GLM_FORCE_RADIANS
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/constants.hpp>
int main() int main()
{ {
int Error = 0; int Error = 0;
glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.0f); glm::mat4 Projection = glm::perspective(glm::pi<float>() * 0.25f, 4.0f / 3.0f, 0.1f, 100.0f);
glm::mat4 Pick = glm::pickMatrix(glm::vec2(1, 2), glm::vec2(3, 4), glm::ivec4(0, 0, 320, 240)); glm::mat4 Pick = glm::pickMatrix(glm::vec2(1, 2), glm::vec2(3, 4), glm::ivec4(0, 0, 320, 240));
glm::lowp_vec3 v(1.0);
glm::lowp_mat4 m(0);
glm::lowp_mat4 t = glm::translate(m, v);
return Error; return Error;
} }

View File

@ -11,9 +11,97 @@
#include <glm/gtc/type_precision.hpp> #include <glm/gtc/type_precision.hpp>
#include <glm/gtx/spline.hpp> #include <glm/gtx/spline.hpp>
namespace catmullRom
{
int test()
{
int Error(0);
glm::vec2 Result2 = glm::catmullRom(
glm::vec2(0.0f, 0.0f),
glm::vec2(1.0f, 0.0f),
glm::vec2(1.0f, 1.0f),
glm::vec2(0.0f, 1.0f), 0.5f);
glm::vec3 Result3 = glm::catmullRom(
glm::vec3(0.0f, 0.0f, 0.0f),
glm::vec3(1.0f, 0.0f, 0.0f),
glm::vec3(1.0f, 1.0f, 0.0f),
glm::vec3(0.0f, 1.0f, 0.0f), 0.5f);
glm::vec4 Result4 = glm::catmullRom(
glm::vec4(0.0f, 0.0f, 0.0f, 1.0f),
glm::vec4(1.0f, 0.0f, 0.0f, 1.0f),
glm::vec4(1.0f, 1.0f, 0.0f, 1.0f),
glm::vec4(0.0f, 1.0f, 0.0f, 1.0f), 0.5f);
return Error;
}
}//catmullRom
namespace hermite
{
int test()
{
int Error(0);
glm::vec2 Result2 = glm::hermite(
glm::vec2(0.0f, 0.0f),
glm::vec2(1.0f, 0.0f),
glm::vec2(1.0f, 1.0f),
glm::vec2(0.0f, 1.0f), 0.5f);
glm::vec3 Result3 = glm::hermite(
glm::vec3(0.0f, 0.0f, 0.0f),
glm::vec3(1.0f, 0.0f, 0.0f),
glm::vec3(1.0f, 1.0f, 0.0f),
glm::vec3(0.0f, 1.0f, 0.0f), 0.5f);
glm::vec4 Result4 = glm::hermite(
glm::vec4(0.0f, 0.0f, 0.0f, 1.0f),
glm::vec4(1.0f, 0.0f, 0.0f, 1.0f),
glm::vec4(1.0f, 1.0f, 0.0f, 1.0f),
glm::vec4(0.0f, 1.0f, 0.0f, 1.0f), 0.5f);
return Error;
}
}//catmullRom
namespace cubic
{
int test()
{
int Error(0);
glm::vec2 Result2 = glm::cubic(
glm::vec2(0.0f, 0.0f),
glm::vec2(1.0f, 0.0f),
glm::vec2(1.0f, 1.0f),
glm::vec2(0.0f, 1.0f), 0.5f);
glm::vec3 Result3 = glm::cubic(
glm::vec3(0.0f, 0.0f, 0.0f),
glm::vec3(1.0f, 0.0f, 0.0f),
glm::vec3(1.0f, 1.0f, 0.0f),
glm::vec3(0.0f, 1.0f, 0.0f), 0.5f);
glm::vec4 Result = glm::cubic(
glm::vec4(0.0f, 0.0f, 0.0f, 1.0f),
glm::vec4(1.0f, 0.0f, 0.0f, 1.0f),
glm::vec4(1.0f, 1.0f, 0.0f, 1.0f),
glm::vec4(0.0f, 1.0f, 0.0f, 1.0f), 0.5f);
return Error;
}
}//catmullRom
int main() int main()
{ {
int Error(0); int Error(0);
Error += catmullRom::test();
Error += hermite::test();
Error += cubic::test();
return Error; return Error;
} }