Fixed space characters and improved forward declaration, including extensions

master
Christophe Riccio ago%!(EXTRA string=12 years)
parent 733cd31b0d
commit 4b4f3fbbaa
  1. 655
      glm/fwd.hpp
  2. 4
      glm/gtc/matrix_access.hpp
  3. 1
      glm/gtc/matrix_transform.inl
  4. 8
      glm/gtc/noise.hpp
  5. 35
      glm/gtc/quaternion.hpp
  6. 6
      glm/gtc/quaternion.inl
  7. 38
      glm/gtc/type_ptr.hpp
  8. 6
      glm/gtc/type_ptr.inl
  9. 30
      glm/gtc/ulp.hpp
  10. 70
      glm/gtc/ulp.inl

@ -34,4 +34,659 @@
#include "core/type_vec.hpp" #include "core/type_vec.hpp"
#include "core/type_mat.hpp" #include "core/type_mat.hpp"
//////////////////////
// GLM_GTC_quaternion
namespace glm{
namespace detail
{
template <typename T> struct tquat;
}//namespace detail
/// Quaternion of floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<float> quat;
/// Quaternion of half-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<detail::half> hquat;
/// Quaternion of single-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<float> fquat;
/// Quaternion of double-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<double> dquat;
/// Quaternion of low precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<lowp_float> lowp_quat;
/// Quaternion of medium precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<mediump_float> mediump_quat;
/// Quaternion of high precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<highp_float> highp_quat;
}//namespace glm
//////////////////////
// GLM_GTC_precision
namespace glm
{
/// @addtogroup gtc_type_precision
/// @{
/// 8 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int8 int8;
/// 16 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int16 int16;
/// 32 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int32 int32;
/// 64 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int64 int64;
/// 8 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int8 int8_t;
/// 16 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int16 int16_t;
/// 32 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int32 int32_t;
/// 64 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int64 int64_t;
/// 8 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int8 i8;
/// 16 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int16 i16;
/// 32 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int32 i32;
/// 64 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int64 i64;
/// 8 bit signed integer scalar type.
/// @see gtc_type_precision
typedef detail::tvec1<i8> i8vec1;
/// 8 bit signed integer vector of 2 components type.
/// @see gtc_type_precision
typedef detail::tvec2<i8> i8vec2;
/// 8 bit signed integer vector of 3 components type.
/// @see gtc_type_precision
typedef detail::tvec3<i8> i8vec3;
/// 8 bit signed integer vector of 4 components type.
/// @see gtc_type_precision
typedef detail::tvec4<i8> i8vec4;
/// 16 bit signed integer scalar type.
/// @see gtc_type_precision
typedef detail::tvec1<i16> i16vec1;
/// 16 bit signed integer vector of 2 components type.
/// @see gtc_type_precision
typedef detail::tvec2<i16> i16vec2;
/// 16 bit signed integer vector of 3 components type.
/// @see gtc_type_precision
typedef detail::tvec3<i16> i16vec3;
/// 16 bit signed integer vector of 4 components type.
/// @see gtc_type_precision
typedef detail::tvec4<i16> i16vec4;
/// 32 bit signed integer scalar type.
/// @see gtc_type_precision
typedef detail::tvec1<i32> i32vec1;
/// 32 bit signed integer vector of 2 components type.
/// @see gtc_type_precision
typedef detail::tvec2<i32> i32vec2;
/// 32 bit signed integer vector of 3 components type.
/// @see gtc_type_precision
typedef detail::tvec3<i32> i32vec3;
/// 32 bit signed integer vector of 4 components type.
/// @see gtc_type_precision
typedef detail::tvec4<i32> i32vec4;
/// 64 bit signed integer scalar type.
/// @see gtc_type_precision
typedef detail::tvec1<i64> i64vec1;
/// 64 bit signed integer vector of 2 components type.
/// @see gtc_type_precision
typedef detail::tvec2<i64> i64vec2;
/// 64 bit signed integer vector of 3 components type.
/// @see gtc_type_precision
typedef detail::tvec3<i64> i64vec3;
/// 64 bit signed integer vector of 4 components type.
/// @see gtc_type_precision
typedef detail::tvec4<i64> i64vec4;
/////////////////////////////
// Unsigned int vector types
/// 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 uint8;
/// 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 uint16;
/// 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 uint32;
/// 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 uint64;
/// 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 uint8_t;
/// 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 uint16_t;
/// 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 uint32_t;
/// 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 uint64_t;
/// 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 u8;
/// 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 u16;
/// 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 u32;
/// 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 u64;
/// 8 bit unsigned integer scalar type.
/// @see gtc_type_precision
typedef detail::tvec1<u8> u8vec1;
/// 8 bit unsigned integer vector of 2 components type.
/// @see gtc_type_precision
typedef detail::tvec2<u8> u8vec2;
/// 8 bit unsigned integer vector of 3 components type.
/// @see gtc_type_precision
typedef detail::tvec3<u8> u8vec3;
/// 8 bit unsigned integer vector of 4 components type.
/// @see gtc_type_precision
typedef detail::tvec4<u8> u8vec4;
/// 16 bit unsigned integer scalar type.
/// @see gtc_type_precision
typedef detail::tvec1<u16> u16vec1;
/// 16 bit unsigned integer vector of 2 components type.
/// @see gtc_type_precision
typedef detail::tvec2<u16> u16vec2;
/// 16 bit unsigned integer vector of 3 components type.
/// @see gtc_type_precision
typedef detail::tvec3<u16> u16vec3;
/// 16 bit unsigned integer vector of 4 components type.
/// @see gtc_type_precision
typedef detail::tvec4<u16> u16vec4;
/// 32 bit unsigned integer scalar type.
/// @see gtc_type_precision
typedef detail::tvec1<u32> u32vec1;
/// 32 bit unsigned integer vector of 2 components type.
/// @see gtc_type_precision
typedef detail::tvec2<u32> u32vec2;
/// 32 bit unsigned integer vector of 3 components type.
/// @see gtc_type_precision
typedef detail::tvec3<u32> u32vec3;
/// 32 bit unsigned integer vector of 4 components type.
/// @see gtc_type_precision
typedef detail::tvec4<u32> u32vec4;
/// 64 bit unsigned integer scalar type.
/// @see gtc_type_precision
typedef detail::tvec1<u64> u64vec1;
/// 64 bit unsigned integer vector of 2 components type.
/// @see gtc_type_precision
typedef detail::tvec2<u64> u64vec2;
/// 64 bit unsigned integer vector of 3 components type.
/// @see gtc_type_precision
typedef detail::tvec3<u64> u64vec3;
/// 64 bit unsigned integer vector of 4 components type.
/// @see gtc_type_precision
typedef detail::tvec4<u64> u64vec4;
//////////////////////
// Float vector types
/// 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float16 float16;
/// 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 float32;
/// 64 bit double-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 float64;
/// 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float16 float16_t;
/// 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 float32_t;
/// 64 bit double-precision floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 float64_t;
/// 16 bit half-precision floating-point scalar.
/// @see gtc_type_precision
typedef float16 f16;
/// 32 bit single-precision floating-point scalar.
/// @see gtc_type_precision
typedef float32 f32;
/// 64 bit double-precision floating-point scalar.
/// @see gtc_type_precision
typedef float64 f64;
/// Single-precision floating-point vector of 1 component.
/// @see gtc_type_precision
typedef detail::tvec1<float> fvec1;
/// Single-precision floating-point vector of 2 components.
/// @see gtc_type_precision
typedef detail::tvec2<float> fvec2;
/// Single-precision floating-point vector of 3 components.
/// @see gtc_type_precision
typedef detail::tvec3<float> fvec3;
/// Single-precision floating-point vector of 4 components.
/// @see gtc_type_precision
typedef detail::tvec4<float> fvec4;
/// Half-precision floating-point vector of 1 component.
/// @see gtc_type_precision
typedef detail::tvec1<f16> f16vec1;
/// Half-precision floating-point vector of 2 components.
/// @see gtc_type_precision
typedef detail::tvec2<f16> f16vec2;
/// Half-precision floating-point vector of 3 components.
/// @see gtc_type_precision
typedef detail::tvec3<f16> f16vec3;
/// Half-precision floating-point vector of 4 components.
/// @see gtc_type_precision
typedef detail::tvec4<f16> f16vec4;
/// Single-precision floating-point vector of 1 component.
/// @see gtc_type_precision
typedef detail::tvec1<f32> f32vec1;
/// Single-precision floating-point vector of 2 components.
/// @see gtc_type_precision
typedef detail::tvec2<f32> f32vec2;
/// Single-precision floating-point vector of 3 components.
/// @see gtc_type_precision
typedef detail::tvec3<f32> f32vec3;
/// Single-precision floating-point vector of 4 components.
/// @see gtc_type_precision
typedef detail::tvec4<f32> f32vec4;
/// Double-precision floating-point vector of 1 component.
/// @see gtc_type_precision
typedef detail::tvec1<f64> f64vec1;
/// Double-precision floating-point vector of 2 components.
/// @see gtc_type_precision
typedef detail::tvec2<f64> f64vec2;
/// Double-precision floating-point vector of 3 components.
/// @see gtc_type_precision
typedef detail::tvec3<f64> f64vec3;
/// Double-precision floating-point vector of 4 components.
/// @see gtc_type_precision
typedef detail::tvec4<f64> f64vec4;
//////////////////////
// Float matrix types
/// Single-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef detail::tmat1x1<f32> fmat1;
/// Single-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x2<f32> fmat2;
/// Single-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x3<f32> fmat3;
/// Single-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x4<f32> fmat4;
/// Single-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef f32 fmat1x1;
/// Single-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x2<f32> fmat2x2;
/// Single-precision floating-point 2x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x3<f32> fmat2x3;
/// Single-precision floating-point 2x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x4<f32> fmat2x4;
/// Single-precision floating-point 3x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x2<f32> fmat3x2;
/// Single-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x3<f32> fmat3x3;
/// Single-precision floating-point 3x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x4<f32> fmat3x4;
/// Single-precision floating-point 4x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x2<f32> fmat4x2;
/// Single-precision floating-point 4x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x3<f32> fmat4x3;
/// Single-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x4<f32> fmat4x4;
/// Half-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef detail::tmat1x1<f16> f16mat1;
/// Half-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x2<f16> f16mat2;
/// Half-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x3<f16> f16mat3;
/// Half-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x4<f16> f16mat4;
/// Half-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef f16 f16mat1x1;
/// Half-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x2<f16> f16mat2x2;
/// Half-precision floating-point 2x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x3<f16> f16mat2x3;
/// Half-precision floating-point 2x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x4<f16> f16mat2x4;
/// Half-precision floating-point 3x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x2<f16> f16mat3x2;
/// Half-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x3<f16> f16mat3x3;
/// Half-precision floating-point 3x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x4<f16> f16mat3x4;
/// Half-precision floating-point 4x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x2<f16> f16mat4x2;
/// Half-precision floating-point 4x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x3<f16> f16mat4x3;
/// Half-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x4<f16> f16mat4x4;
/// Single-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef detail::tmat1x1<f32> f32mat1;
/// Single-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x2<f32> f32mat2;
/// Single-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x3<f32> f32mat3;
/// Single-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x4<f32> f32mat4;
/// Single-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef f32 f32mat1x1;
/// Single-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x2<f32> f32mat2x2;
/// Single-precision floating-point 2x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x3<f32> f32mat2x3;
/// Single-precision floating-point 2x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x4<f32> f32mat2x4;
/// Single-precision floating-point 3x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x2<f32> f32mat3x2;
/// Single-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x3<f32> f32mat3x3;
/// Single-precision floating-point 3x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x4<f32> f32mat3x4;
/// Single-precision floating-point 4x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x2<f32> f32mat4x2;
/// Single-precision floating-point 4x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x3<f32> f32mat4x3;
/// Single-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x4<f32> f32mat4x4;
/// Double-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef detail::tmat1x1<f64> f64mat1;
/// Double-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x2<f64> f64mat2;
/// Double-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x3<f64> f64mat3;
/// Double-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x4<f64> f64mat4;
/// Double-precision floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef f64 f64mat1x1;
/// Double-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x2<f64> f64mat2x2;
/// Double-precision floating-point 2x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x3<f64> f64mat2x3;
/// Double-precision floating-point 2x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat2x4<f64> f64mat2x4;
/// Double-precision floating-point 3x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x2<f64> f64mat3x2;
/// Double-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x3<f64> f64mat3x3;
/// Double-precision floating-point 3x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat3x4<f64> f64mat3x4;
/// Double-precision floating-point 4x2 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x2<f64> f64mat4x2;
/// Double-precision floating-point 4x3 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x3<f64> f64mat4x3;
/// Double-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef detail::tmat4x4<f64> f64mat4x4;
//////////////////////////
// Quaternion types
/// Half-precision floating-point quaternion.
/// @see gtc_type_precision
typedef detail::tquat<f16> f16quat;
/// Single-precision floating-point quaternion.
/// @see gtc_type_precision
typedef detail::tquat<f32> f32quat;
/// Double-precision floating-point quaternion.
/// @see gtc_type_precision
typedef detail::tquat<f64> f64quat;
}//namespace glm
#endif//GLM_FWD_INCLUDED #endif//GLM_FWD_INCLUDED

@ -71,8 +71,8 @@ namespace glm
genType const & m, genType const & m,
int index); int index);
/// Set a specific column to a matrix. /// Set a specific column to a matrix.
/// @see gtc_matrix_access /// @see gtc_matrix_access
template <typename genType> template <typename genType>
genType column( genType column(
genType const & m, genType const & m,

@ -241,7 +241,6 @@ namespace glm
#else #else
valType const rad = glm::radians(fovy); valType const rad = glm::radians(fovy);
#endif #endif
valType range = tan(rad / valType(2)) * zNear; valType range = tan(rad / valType(2)) * zNear;
valType left = -range * aspect; valType left = -range * aspect;
valType right = range * aspect; valType right = range * aspect;

@ -54,22 +54,22 @@ namespace glm
/// @{ /// @{
/// Classic perlin noise. /// Classic perlin noise.
/// @see gtc_noise /// @see gtc_noise
template <typename T, template<typename> class vecType> template <typename T, template<typename> class vecType>
T perlin( T perlin(
vecType<T> const & p); vecType<T> const & p);
/// Periodic perlin noise. /// Periodic perlin noise.
/// @see gtc_noise /// @see gtc_noise
template <typename T, template<typename> class vecType> template <typename T, template<typename> class vecType>
T perlin( T perlin(
vecType<T> const & p, vecType<T> const & p,
vecType<T> const & rep); vecType<T> const & rep);
/// Simplex noise. /// Simplex noise.
/// @see gtc_noise /// @see gtc_noise
template <typename T, template<typename> class vecType> template <typename T, template<typename> class vecType>
T simplex( T simplex(
vecType<T> const & p); vecType<T> const & p);
/// @} /// @}

@ -338,41 +338,6 @@ namespace detail
valType const & angle, valType const & angle,
detail::tvec3<valType> const & axis); detail::tvec3<valType> const & axis);
/// Quaternion of floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<float> quat;
/// Quaternion of half-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<detail::half> hquat;
/// Quaternion of single-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<float> fquat;
/// Quaternion of double-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<double> dquat;
/// Quaternion of low precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<lowp_float> lowp_quat;
/// Quaternion of medium precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<mediump_float> mediump_quat;
/// Quaternion of high precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<highp_float> highp_quat;
/// @} /// @}
} //namespace glm } //namespace glm

@ -712,9 +712,9 @@ namespace detail
Result.z = biggestVal; Result.z = biggestVal;
break; break;
default: // Silence a -Wswitch-default warning in GCC. Should never actually get here. Assert is just for sanity. default: // Silence a -Wswitch-default warning in GCC. Should never actually get here. Assert is just for sanity.
assert(false); assert(false);
break; break;
} }
return Result; return Result;
} }

@ -75,90 +75,90 @@ namespace glm
/// @{ /// @{
/// Return the constant address to the data of the input parameter. /// Return the constant address to the data of the input parameter.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename genType> template<typename genType>
typename genType::value_type const * value_ptr(genType const & vec); typename genType::value_type const * value_ptr(genType const & vec);
/// Build a vector from a pointer. /// Build a vector from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tvec2<T> make_vec2(T const * const ptr); detail::tvec2<T> make_vec2(T const * const ptr);
/// Build a vector from a pointer. /// Build a vector from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tvec3<T> make_vec3(T const * const ptr); detail::tvec3<T> make_vec3(T const * const ptr);
/// Build a vector from a pointer. /// Build a vector from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tvec4<T> make_vec4(T const * const ptr); detail::tvec4<T> make_vec4(T const * const ptr);
/// Build a matrix from a pointer. /// Build a matrix from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tmat2x2<T> make_mat2x2(T const * const ptr); detail::tmat2x2<T> make_mat2x2(T const * const ptr);
/// Build a matrix from a pointer. /// Build a matrix from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tmat2x3<T> make_mat2x3(T const * const ptr); detail::tmat2x3<T> make_mat2x3(T const * const ptr);
/// Build a matrix from a pointer. /// Build a matrix from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tmat2x4<T> make_mat2x4(T const * const ptr); detail::tmat2x4<T> make_mat2x4(T const * const ptr);
/// Build a matrix from a pointer. /// Build a matrix from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tmat3x2<T> make_mat3x2(T const * const ptr); detail::tmat3x2<T> make_mat3x2(T const * const ptr);
/// Build a matrix from a pointer. /// Build a matrix from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tmat3x3<T> make_mat3x3(T const * const ptr); detail::tmat3x3<T> make_mat3x3(T const * const ptr);
/// Build a matrix from a pointer. /// Build a matrix from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tmat3x4<T> make_mat3x4(T const * const ptr); detail::tmat3x4<T> make_mat3x4(T const * const ptr);
/// Build a matrix from a pointer. /// Build a matrix from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tmat4x2<T> make_mat4x2( detail::tmat4x2<T> make_mat4x2(
T const * const ptr); T const * const ptr);
/// Build a matrix from a pointer. /// Build a matrix from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tmat4x3<T> make_mat4x3(T const * const ptr); detail::tmat4x3<T> make_mat4x3(T const * const ptr);
/// Build a matrix from a pointer. /// Build a matrix from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tmat4x4<T> make_mat4x4(T const * const ptr); detail::tmat4x4<T> make_mat4x4(T const * const ptr);
/// Build a matrix from a pointer. /// Build a matrix from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tmat2x2<T> make_mat2(T const * const ptr); detail::tmat2x2<T> make_mat2(T const * const ptr);
/// Build a matrix from a pointer. /// Build a matrix from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tmat3x3<T> make_mat3(T const * const ptr); detail::tmat3x3<T> make_mat3(T const * const ptr);
/// Build a matrix from a pointer. /// Build a matrix from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tmat4x4<T> make_mat4(T const * const ptr); detail::tmat4x4<T> make_mat4(T const * const ptr);
/// Build a quaternion from a pointer. /// Build a quaternion from a pointer.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
detail::tquat<T> make_quat(T const * const ptr); detail::tquat<T> make_quat(T const * const ptr);
/// @} /// @}
}//namespace glm }//namespace glm

@ -32,7 +32,7 @@ namespace glm
/// @{ /// @{
/// Return the constant address to the data of the input parameter. /// Return the constant address to the data of the input parameter.
/// @see gtc_type_ptr /// @see gtc_type_ptr
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
( (
@ -289,8 +289,8 @@ namespace glm
template<typename T> template<typename T>
GLM_FUNC_QUALIFIER T const * value_ptr GLM_FUNC_QUALIFIER T const * value_ptr
( (
detail::tquat<T> const & q detail::tquat<T> const & q
) )
{ {
return &(q[0]); return &(q[0]);
} }

@ -53,33 +53,33 @@ namespace glm
/// Return the next ULP value(s) after the input value(s). /// Return the next ULP value(s) after the input value(s).
/// @see gtc_ulp /// @see gtc_ulp
template <typename genType> template <typename genType>
genType next_float(genType const & x); genType next_float(genType const & x);
/// Return the previous ULP value(s) before the input value(s). /// Return the previous ULP value(s) before the input value(s).
/// @see gtc_ulp /// @see gtc_ulp
template <typename genType> template <typename genType>
genType prev_float(genType const & x); genType prev_float(genType const & x);
/// Return the value(s) ULP distance after the input value(s). /// Return the value(s) ULP distance after the input value(s).
/// @see gtc_ulp /// @see gtc_ulp
template <typename genType> template <typename genType>
genType next_float(genType const & x, uint const & Distance); genType next_float(genType const & x, uint const & Distance);
/// Return the value(s) ULP distance before the input value(s). /// Return the value(s) ULP distance before the input value(s).
/// @see gtc_ulp /// @see gtc_ulp
template <typename genType> template <typename genType>
genType prev_float(genType const & x, uint const & Distance); genType prev_float(genType const & x, uint const & Distance);
/// Return the distance in the number of ULP between 2 scalars. /// Return the distance in the number of ULP between 2 scalars.
/// @see gtc_ulp /// @see gtc_ulp
template <typename T> template <typename T>
uint float_distance(T const & x, T const & y); uint float_distance(T const & x, T const & y);
/// Return the distance in the number of ULP between 2 vectors. /// Return the distance in the number of ULP between 2 vectors.
/// @see gtc_ulp /// @see gtc_ulp
template<typename T, template<typename> class vecType> template<typename T, template<typename> class vecType>
vecType<uint> float_distance(vecType<T> const & x, vecType<T> const & y); vecType<uint> float_distance(vecType<T> const & x, vecType<T> const & y);
/// @} /// @}
}// namespace glm }// namespace glm

@ -58,34 +58,34 @@ typedef union
} parts; } parts;
} ieee_double_shape_type; } ieee_double_shape_type;
#define GLM_EXTRACT_WORDS(ix0,ix1,d) \ #define GLM_EXTRACT_WORDS(ix0,ix1,d) \
do { \ do { \
ieee_double_shape_type ew_u; \ ieee_double_shape_type ew_u; \
ew_u.value = (d); \ ew_u.value = (d); \
(ix0) = ew_u.parts.msw; \ (ix0) = ew_u.parts.msw; \
(ix1) = ew_u.parts.lsw; \ (ix1) = ew_u.parts.lsw; \
} while (0) } while (0)
#define GLM_GET_FLOAT_WORD(i,d) \ #define GLM_GET_FLOAT_WORD(i,d) \
do { \ do { \
ieee_float_shape_type gf_u; \ ieee_float_shape_type gf_u; \
gf_u.value = (d); \ gf_u.value = (d); \
(i) = gf_u.word; \ (i) = gf_u.word; \
} while (0) } while (0)
#define GLM_SET_FLOAT_WORD(d,i) \ #define GLM_SET_FLOAT_WORD(d,i) \
do { \ do { \
ieee_float_shape_type sf_u; \ ieee_float_shape_type sf_u; \
sf_u.word = (i); \ sf_u.word = (i); \
(d) = sf_u.value; \ (d) = sf_u.value; \
} while (0) } while (0)
#define GLM_INSERT_WORDS(d,ix0,ix1) \ #define GLM_INSERT_WORDS(d,ix0,ix1) \
do { \ do { \
ieee_double_shape_type iw_u; \ ieee_double_shape_type iw_u; \
iw_u.parts.msw = (ix0); \ iw_u.parts.msw = (ix0); \
iw_u.parts.lsw = (ix1); \ iw_u.parts.lsw = (ix1); \
(d) = iw_u.value; \ (d) = iw_u.value; \
} while (0) } while (0)
namespace glm{ namespace glm{
@ -98,28 +98,28 @@ namespace detail
GLM_GET_FLOAT_WORD(hx, x); GLM_GET_FLOAT_WORD(hx, x);
GLM_GET_FLOAT_WORD(hy, y); GLM_GET_FLOAT_WORD(hy, y);
ix = hx&0x7fffffff; // |x| ix = hx&0x7fffffff; // |x|
iy = hy&0x7fffffff; // |y| iy = hy&0x7fffffff; // |y|
if((ix>0x7f800000) || // x is nan if((ix>0x7f800000) || // x is nan
(iy>0x7f800000)) // y is nan (iy>0x7f800000)) // y is nan
return x+y; return x+y;
if(x==y) return y; // x=y, return y if(x==y) return y; // x=y, return y
if(ix==0) { // x == 0 if(ix==0) { // x == 0
GLM_SET_FLOAT_WORD(x,(hy&0x80000000)|1);// return +-minsubnormal GLM_SET_FLOAT_WORD(x,(hy&0x80000000)|1);// return +-minsubnormal
t = x*x; t = x*x;
if(t==x) return t; else return x; // raise underflow flag if(t==x) return t; else return x; // raise underflow flag
} }
if(hx>=0) { // x > 0 if(hx>=0) { // x > 0
if(hx>hy) { // x > y, x -= ulp if(hx>hy) { // x > y, x -= ulp
hx -= 1; hx -= 1;
} else { // x < y, x += ulp } else { // x < y, x += ulp
hx += 1; hx += 1;
} }
} else { // x < 0 } else { // x < 0
if(hy>=0||hx>hy){ // x < y, x -= ulp if(hy>=0||hx>hy){ // x < y, x -= ulp
hx -= 1; hx -= 1;
} else { // x > y, x += ulp } else { // x > y, x += ulp
hx += 1; hx += 1;
} }
} }

Loading…
Cancel
Save