Reduce dependencies, added scalar EXT extensions

This commit is contained in:
Christophe Riccio 2018-08-12 23:27:02 +02:00
parent 2a20695ce5
commit a21401d2a4
57 changed files with 785 additions and 612 deletions

View File

@ -12,9 +12,7 @@
#pragma once
#include "detail/setup.hpp"
#include "detail/qualifier.hpp"
#include "detail/type_int.hpp"
#include "detail/_fixes.hpp"
namespace glm

View File

@ -1,6 +1,3 @@
/// @ref core
/// @file glm/detail/_features.hpp
#pragma once
// #define GLM_CXX98_EXCEPTIONS

View File

@ -1,6 +1,3 @@
/// @ref core
/// @file glm/detail/_fixes.hpp
#include <cmath>
//! Workaround for compatibility with other libraries

View File

@ -1,11 +1,5 @@
/// @ref core
/// @file glm/detail/_noise.hpp
#pragma once
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
#include "../common.hpp"
namespace glm{
@ -44,43 +38,43 @@ namespace detail
template<typename T>
GLM_FUNC_QUALIFIER T taylorInvSqrt(T const& r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
return static_cast<T>(1.79284291400159) - static_cast<T>(0.85373472095314) * r;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> taylorInvSqrt(vec<2, T, Q> const& r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
return static_cast<T>(1.79284291400159) - static_cast<T>(0.85373472095314) * r;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<3, T, Q> taylorInvSqrt(vec<3, T, Q> const& r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
return static_cast<T>(1.79284291400159) - static_cast<T>(0.85373472095314) * r;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<4, T, Q> taylorInvSqrt(vec<4, T, Q> const& r)
{
return T(1.79284291400159) - T(0.85373472095314) * r;
return static_cast<T>(1.79284291400159) - static_cast<T>(0.85373472095314) * r;
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> fade(vec<2, T, Q> const& t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
return (t * t * t) * (t * (t * static_cast<T>(6) - static_cast<T>(15)) + static_cast<T>(10));
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<3, T, Q> fade(vec<3, T, Q> const& t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
return (t * t * t) * (t * (t * static_cast<T>(6) - static_cast<T>(15)) + static_cast<T>(10));
}
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<4, T, Q> fade(vec<4, T, Q> const& t)
{
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
return (t * t * t) * (t * (t * static_cast<T>(6) - static_cast<T>(15)) + static_cast<T>(10));
}
}//namespace detail
}//namespace glm

View File

@ -1,6 +1,3 @@
/// @ref core
/// @file glm/detail/_swizzle.hpp
#pragma once
namespace glm{

View File

@ -1,6 +1,3 @@
/// @ref core
/// @file glm/detail/_swizzle_func.hpp
#pragma once
#define GLM_SWIZZLE_GEN_VEC2_ENTRY(T, P, CONST, A, B) \

View File

@ -1,6 +1,3 @@
/// @ref core
/// @file glm/detail/_vectorize.hpp
#pragma once
namespace glm{

View File

@ -30,9 +30,9 @@ namespace glm
// abs
template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR int32 abs(int32 x)
GLM_FUNC_QUALIFIER GLM_CONSTEXPR int abs(int x)
{
int32 const y = x >> 31;
int const y = x >> (sizeof(int) * 8 - 1);
return (x ^ y) - y;
}
@ -155,7 +155,7 @@ namespace detail
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& x)
{
T const Shift(static_cast<T>(sizeof(T) * 8 - 1));
vec<L, T, Q> const y(vec<L, typename make_unsigned<T>::type, Q>(-x) >> typename make_unsigned<T>::type(Shift));
vec<L, T, Q> const y(vec<L, typename detail::make_unsigned<T>::type, Q>(-x) >> typename detail::make_unsigned<T>::type(Shift));
return (x >> Shift) | y;
}

View File

@ -1,11 +1,5 @@
/// @ref core
/// @file glm/detail/func_geometric.inl
#include "../exponential.hpp"
#include "../common.hpp"
#include "type_vec2.hpp"
#include "type_vec4.hpp"
#include "type_float.hpp"
namespace glm{
namespace detail

View File

@ -1,10 +1,5 @@
/// @ref core
#include "type_vec1.hpp"
#include "type_vec2.hpp"
#include "type_vec3.hpp"
#include "type_vec4.hpp"
#include "type_int.hpp"
#include "_vectorize.hpp"
#if(GLM_ARCH & GLM_ARCH_X86 && GLM_COMPILER & GLM_COMPILER_VC)
# include <intrin.h>
@ -180,31 +175,29 @@ namespace detail
// uaddCarry
GLM_FUNC_QUALIFIER uint uaddCarry(uint const& x, uint const& y, uint & Carry)
{
uint64 const Value64(static_cast<uint64>(x) + static_cast<uint64>(y));
uint64 const Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
detail::uint64 const Value64(static_cast<detail::uint64>(x) + static_cast<detail::uint64>(y));
detail::uint64 const Max32((static_cast<detail::uint64>(1) << static_cast<detail::uint64>(32)) - static_cast<detail::uint64>(1));
Carry = Value64 > Max32 ? 1u : 0u;
return static_cast<uint32>(Value64 % (Max32 + static_cast<uint64>(1)));
return static_cast<uint>(Value64 % (Max32 + static_cast<detail::uint64>(1)));
}
template<length_t L, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, uint, Q> uaddCarry(vec<L, uint, Q> const& x, vec<L, uint, Q> const& y, vec<L, uint, Q>& Carry)
{
vec<L, uint64, Q> Value64(vec<L, uint64, Q>(x) + vec<L, uint64, Q>(y));
vec<L, uint64, Q> Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
Carry = mix(vec<L, uint32, Q>(0), vec<L, uint32, Q>(1), greaterThan(Value64, Max32));
return vec<L, uint32, Q>(Value64 % (Max32 + static_cast<uint64>(1)));
vec<L, detail::uint64, Q> Value64(vec<L, detail::uint64, Q>(x) + vec<L, detail::uint64, Q>(y));
vec<L, detail::uint64, Q> Max32((static_cast<detail::uint64>(1) << static_cast<detail::uint64>(32)) - static_cast<detail::uint64>(1));
Carry = mix(vec<L, uint, Q>(0), vec<L, uint, Q>(1), greaterThan(Value64, Max32));
return vec<L, uint, Q>(Value64 % (Max32 + static_cast<detail::uint64>(1)));
}
// usubBorrow
GLM_FUNC_QUALIFIER uint usubBorrow(uint const& x, uint const& y, uint & Borrow)
{
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
Borrow = x >= y ? static_cast<uint32>(0) : static_cast<uint32>(1);
Borrow = x >= y ? static_cast<uint>(0) : static_cast<uint>(1);
if(y >= x)
return y - x;
else
return static_cast<uint32>((static_cast<int64>(1) << static_cast<int64>(32)) + (static_cast<int64>(y) - static_cast<int64>(x)));
return static_cast<uint>((static_cast<detail::int64>(1) << static_cast<detail::int64>(32)) + (static_cast<detail::int64>(y) - static_cast<detail::int64>(x)));
}
template<length_t L, qualifier Q>
@ -212,48 +205,40 @@ namespace detail
{
Borrow = mix(vec<L, uint, Q>(1), vec<L, uint, Q>(0), greaterThanEqual(x, y));
vec<L, uint, Q> const YgeX(y - x);
vec<L, uint, Q> const XgeY(vec<L, uint32, Q>((static_cast<int64>(1) << static_cast<int64>(32)) + (vec<L, int64, Q>(y) - vec<L, int64, Q>(x))));
vec<L, uint, Q> const XgeY(vec<L, uint, Q>((static_cast<detail::int64>(1) << static_cast<detail::int64>(32)) + (vec<L, detail::int64, Q>(y) - vec<L, detail::int64, Q>(x))));
return mix(XgeY, YgeX, greaterThanEqual(y, x));
}
// umulExtended
GLM_FUNC_QUALIFIER void umulExtended(uint const& x, uint const& y, uint & msb, uint & lsb)
{
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
uint64 Value64 = static_cast<uint64>(x) * static_cast<uint64>(y);
msb = static_cast<uint>(Value64 >> static_cast<uint64>(32));
detail::uint64 Value64 = static_cast<detail::uint64>(x) * static_cast<detail::uint64>(y);
msb = static_cast<uint>(Value64 >> static_cast<detail::uint64>(32));
lsb = static_cast<uint>(Value64);
}
template<length_t L, qualifier Q>
GLM_FUNC_QUALIFIER void umulExtended(vec<L, uint, Q> const& x, vec<L, uint, Q> const& y, vec<L, uint, Q>& msb, vec<L, uint, Q>& lsb)
{
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
vec<L, uint64, Q> Value64(vec<L, uint64, Q>(x) * vec<L, uint64, Q>(y));
msb = vec<L, uint32, Q>(Value64 >> static_cast<uint64>(32));
lsb = vec<L, uint32, Q>(Value64);
vec<L, detail::uint64, Q> Value64(vec<L, detail::uint64, Q>(x) * vec<L, detail::uint64, Q>(y));
msb = vec<L, uint, Q>(Value64 >> static_cast<detail::uint64>(32));
lsb = vec<L, uint, Q>(Value64);
}
// imulExtended
GLM_FUNC_QUALIFIER void imulExtended(int x, int y, int& msb, int& lsb)
{
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
int64 Value64 = static_cast<int64>(x) * static_cast<int64>(y);
msb = static_cast<int>(Value64 >> static_cast<int64>(32));
detail::int64 Value64 = static_cast<detail::int64>(x) * static_cast<detail::int64>(y);
msb = static_cast<int>(Value64 >> static_cast<detail::int64>(32));
lsb = static_cast<int>(Value64);
}
template<length_t L, qualifier Q>
GLM_FUNC_QUALIFIER void imulExtended(vec<L, int, Q> const& x, vec<L, int, Q> const& y, vec<L, int, Q>& msb, vec<L, int, Q>& lsb)
{
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
vec<L, int64, Q> Value64(vec<L, int64, Q>(x) * vec<L, int64, Q>(y));
lsb = vec<L, int32, Q>(Value64 & static_cast<int64>(0xFFFFFFFF));
msb = vec<L, int32, Q>((Value64 >> static_cast<int64>(32)) & static_cast<int64>(0xFFFFFFFF));
vec<L, detail::int64, Q> Value64(vec<L, detail::int64, Q>(x) * vec<L, detail::int64, Q>(y));
lsb = vec<L, int, Q>(Value64 & static_cast<detail::int64>(0xFFFFFFFF));
msb = vec<L, int, Q>((Value64 >> static_cast<detail::int64>(32)) & static_cast<detail::int64>(0xFFFFFFFF));
}
// bitfieldExtract

View File

@ -3,7 +3,6 @@
#include "../common.hpp"
#include "type_half.hpp"
#include "../fwd.hpp"
namespace glm
{

View File

@ -1,6 +1,3 @@
/// @ref core
/// @file glm/detail/func_packing_simd.inl
namespace glm{
namespace detail
{

View File

@ -1,6 +1,3 @@
/// @ref core
/// @file glm/detail/func_trigonometric.inl
#include "_vectorize.hpp"
#include <cmath>
#include <limits>

View File

@ -1,7 +1,3 @@
/// @ref core
#include "compute_vector_relational.hpp"
namespace glm
{
template<length_t L, typename T, qualifier Q>

View File

@ -1,6 +1,3 @@
/// @ref core
/// @file glm/detail/func_vector_relational_simd.inl
namespace glm{
namespace detail
{

View File

@ -3,10 +3,13 @@
#define GLM_FORCE_MESSAGES
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/glm.hpp>
#include <glm/gtx/dual_quaternion.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/gtc/quaternion.hpp>
#include <glm/gtx/dual_quaternion.hpp>
#include <glm/ext/scalar_float_sized.hpp>
#include <glm/ext/scalar_int_sized.hpp>
#include <glm/ext/scalar_uint_sized.hpp>
#include <glm/glm.hpp>
namespace glm
{

View File

@ -1,10 +1,6 @@
/// @ref core
/// @file glm/detail/qualifier.hpp
#pragma once
#include "setup.hpp"
#include "type_int.hpp"
namespace glm
{

View File

@ -335,6 +335,7 @@
((GLM_COMPILER & GLM_COMPILER_CUDA))))
#endif
//
#if defined(GLM_FORCE_PURE)
# define GLM_HAS_BITSCAN_WINDOWS 0
#else
@ -569,6 +570,153 @@ namespace glm
# define GLM_COUNTOF(arr) sizeof(arr) / sizeof(arr[0])
#endif
///////////////////////////////////////////////////////////////////////////////////
// uint
namespace glm{
namespace detail
{
template<typename T>
struct is_int
{
enum test {value = 0};
};
template<>
struct is_int<unsigned int>
{
enum test {value = ~0};
};
template<>
struct is_int<signed int>
{
enum test {value = ~0};
};
}//namespace detail
typedef unsigned int uint;
}//namespace glm
///////////////////////////////////////////////////////////////////////////////////
// 64-bit int
#if GLM_HAS_EXTENDED_INTEGER_TYPE
# include <cstdint>
#endif
namespace glm{
namespace detail
{
# if GLM_HAS_EXTENDED_INTEGER_TYPE
typedef std::uint64_t uint64;
typedef std::int64_t int64;
# elif (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available
typedef uint64_t uint64;
typedef int64_t int64;
# elif GLM_COMPILER & GLM_COMPILER_VC
typedef unsigned __int64 uint64;
typedef signed __int64 int64;
# elif GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic ignored "-Wlong-long"
__extension__ typedef unsigned long long uint64;
__extension__ typedef signed long long int64;
# elif (GLM_COMPILER & GLM_COMPILER_CLANG)
# pragma clang diagnostic ignored "-Wc++11-long-long"
typedef unsigned long long uint64;
typedef signed long long int64;
# else//unknown compiler
typedef unsigned long long uint64;
typedef signed long long int64;
# endif
}//namespace detail
}//namespace glm
///////////////////////////////////////////////////////////////////////////////////
// make_unsigned
#if GLM_HAS_MAKE_SIGNED
# include <type_traits>
namespace glm{
namespace detail
{
using std::make_unsigned;
}//namespace detail
}//namespace glm
#else
namespace glm{
namespace detail
{
template<typename genType>
struct make_unsigned
{};
template<>
struct make_unsigned<char>
{
typedef unsigned char type;
};
template<>
struct make_unsigned<short>
{
typedef unsigned short type;
};
template<>
struct make_unsigned<int>
{
typedef unsigned int type;
};
template<>
struct make_unsigned<long>
{
typedef unsigned long type;
};
template<>
struct make_unsigned<int64>
{
typedef uint64 type;
};
template<>
struct make_unsigned<unsigned char>
{
typedef unsigned char type;
};
template<>
struct make_unsigned<unsigned short>
{
typedef unsigned short type;
};
template<>
struct make_unsigned<unsigned int>
{
typedef unsigned int type;
};
template<>
struct make_unsigned<unsigned long>
{
typedef unsigned long type;
};
template<>
struct make_unsigned<uint64>
{
typedef uint64 type;
};
}//namespace detail
}//namespace glm
#endif
///////////////////////////////////////////////////////////////////////////////////
// Configure the use of defaulted initialized types

View File

@ -1,6 +1,3 @@
/// @ref core
/// @file glm/detail/type_half.hpp
#pragma once
#include "setup.hpp"

View File

@ -1,5 +1,3 @@
/// @ref core
namespace glm{
namespace detail
{
@ -22,12 +20,12 @@ namespace detail
f(f_)
{}
GLM_FUNC_QUALIFIER uif32(uint32 i_) :
GLM_FUNC_QUALIFIER uif32(unsigned int i_) :
i(i_)
{}
float f;
uint32 i;
unsigned int i;
};
GLM_FUNC_QUALIFIER float toFloat32(hdata value)

View File

@ -1,298 +0,0 @@
/// @ref core
/// @file glm/detail/type_int.hpp
#pragma once
#include "setup.hpp"
#if GLM_HAS_MAKE_SIGNED
# include <type_traits>
#endif
#if GLM_HAS_EXTENDED_INTEGER_TYPE
# include <cstdint>
#endif
namespace glm{
namespace detail
{
# if GLM_HAS_EXTENDED_INTEGER_TYPE
typedef std::int8_t int8;
typedef std::int16_t int16;
typedef std::int32_t int32;
typedef std::int64_t int64;
typedef std::uint8_t uint8;
typedef std::uint16_t uint16;
typedef std::uint32_t uint32;
typedef std::uint64_t uint64;
# else
# if(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) // C99 detected, 64 bit types available
typedef int64_t sint64;
typedef uint64_t uint64;
# elif GLM_COMPILER & GLM_COMPILER_VC
typedef signed __int64 sint64;
typedef unsigned __int64 uint64;
# elif GLM_COMPILER & GLM_COMPILER_GCC
# pragma GCC diagnostic ignored "-Wlong-long"
__extension__ typedef signed long long sint64;
__extension__ typedef unsigned long long uint64;
# elif (GLM_COMPILER & GLM_COMPILER_CLANG)
# pragma clang diagnostic ignored "-Wc++11-long-long"
typedef signed long long sint64;
typedef unsigned long long uint64;
# else//unknown compiler
typedef signed long long sint64;
typedef unsigned long long uint64;
# endif//GLM_COMPILER
typedef signed char int8;
typedef signed short int16;
typedef signed int int32;
typedef sint64 int64;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef uint64 uint64;
#endif//
typedef signed int lowp_int_t;
typedef signed int mediump_int_t;
typedef signed int highp_int_t;
typedef unsigned int lowp_uint_t;
typedef unsigned int mediump_uint_t;
typedef unsigned int highp_uint_t;
# if GLM_HAS_MAKE_SIGNED
using std::make_signed;
using std::make_unsigned;
# else//GLM_HAS_MAKE_SIGNED
template<typename genType>
struct make_signed
{};
template<>
struct make_signed<char>
{
typedef char type;
};
template<>
struct make_signed<short>
{
typedef short type;
};
template<>
struct make_signed<int>
{
typedef int type;
};
template<>
struct make_signed<long>
{
typedef long type;
};
template<>
struct make_signed<unsigned char>
{
typedef char type;
};
template<>
struct make_signed<unsigned short>
{
typedef short type;
};
template<>
struct make_signed<unsigned int>
{
typedef int type;
};
template<>
struct make_signed<unsigned long>
{
typedef long type;
};
template<typename genType>
struct make_unsigned
{};
template<>
struct make_unsigned<char>
{
typedef unsigned char type;
};
template<>
struct make_unsigned<short>
{
typedef unsigned short type;
};
template<>
struct make_unsigned<int>
{
typedef unsigned int type;
};
template<>
struct make_unsigned<long>
{
typedef unsigned long type;
};
template<>
struct make_unsigned<unsigned char>
{
typedef unsigned char type;
};
template<>
struct make_unsigned<unsigned short>
{
typedef unsigned short type;
};
template<>
struct make_unsigned<unsigned int>
{
typedef unsigned int type;
};
template<>
struct make_unsigned<unsigned long>
{
typedef unsigned long type;
};
template<>
struct make_signed<long long>
{
typedef long long type;
};
template<>
struct make_signed<unsigned long long>
{
typedef long long type;
};
template<>
struct make_unsigned<long long>
{
typedef unsigned long long type;
};
template<>
struct make_unsigned<unsigned long long>
{
typedef unsigned long long type;
};
# endif//GLM_HAS_MAKE_SIGNED
}//namespace detail
typedef detail::int8 int8;
typedef detail::int16 int16;
typedef detail::int32 int32;
typedef detail::int64 int64;
typedef detail::uint8 uint8;
typedef detail::uint16 uint16;
typedef detail::uint32 uint32;
typedef detail::uint64 uint64;
/// @addtogroup core_precision
/// @{
/// Low qualifier signed integer.
/// There is no guarantee on the actual qualifier.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::lowp_int_t lowp_int;
/// Medium qualifier signed integer.
/// There is no guarantee on the actual qualifier.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::mediump_int_t mediump_int;
/// High qualifier signed integer.
/// There is no guarantee on the actual qualifier.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::highp_int_t highp_int;
/// Low qualifier unsigned integer.
/// There is no guarantee on the actual qualifier.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::lowp_uint_t lowp_uint;
/// Medium qualifier unsigned integer.
/// There is no guarantee on the actual qualifier.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::mediump_uint_t mediump_uint;
/// High qualifier unsigned integer.
/// There is no guarantee on the actual qualifier.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::highp_uint_t highp_uint;
#if GLM_CONFIG_PRECISION_INT == GLM_LOWP
typedef lowp_int int_t;
#elif GLM_CONFIG_PRECISION_INT == GLM_MEDIUMP
typedef mediump_int int_t;
#else
typedef highp_int int_t;
#endif
#if GLM_CONFIG_PRECISION_UINT == GLM_LOWP
typedef lowp_uint uint_t;
#elif GLM_CONFIG_PRECISION_UINT == GLM_MEDIUMP
typedef mediump_uint uint_t;
#else
typedef highp_uint uint_t;
#endif
/// Unsigned integer type.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.3 Integers</a>
typedef unsigned int uint;
/// @}
////////////////////
// check type sizes
#ifndef GLM_STATIC_ASSERT_NULL
GLM_STATIC_ASSERT(sizeof(glm::int8) == 1, "int8 size isn't 1 byte on this platform");
GLM_STATIC_ASSERT(sizeof(glm::int16) == 2, "int16 size isn't 2 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::int32) == 4, "int32 size isn't 4 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::int64) == 8, "int64 size isn't 8 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::uint8) == 1, "uint8 size isn't 1 byte on this platform");
GLM_STATIC_ASSERT(sizeof(glm::uint16) == 2, "uint16 size isn't 2 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::uint32) == 4, "uint32 size isn't 4 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform");
#endif//GLM_STATIC_ASSERT_NULL
}//namespace glm

View File

@ -5,36 +5,6 @@
namespace glm{
namespace detail
{
template<typename T>
struct is_int
{
enum test {value = 0};
};
template<>
struct is_int<uint32>
{
enum test {value = ~0};
};
template<>
struct is_int<int32>
{
enum test {value = ~0};
};
template<>
struct is_int<uint64>
{
enum test {value = ~0};
};
template<>
struct is_int<int64>
{
enum test {value = ~0};
};
template<typename T, qualifier Q, bool Aligned>
struct compute_vec4_add
{

View File

@ -13,8 +13,105 @@
# pragma message("GLM: All extensions included (not recommended)")
#endif//GLM_MESSAGES
#include "./ext/matrix_double2x2.hpp"
#include "./ext/matrix_double2x2_precision.hpp"
#include "./ext/matrix_double2x3.hpp"
#include "./ext/matrix_double2x3_precision.hpp"
#include "./ext/matrix_double2x4.hpp"
#include "./ext/matrix_double2x4_precision.hpp"
#include "./ext/matrix_double3x2.hpp"
#include "./ext/matrix_double3x2_precision.hpp"
#include "./ext/matrix_double3x3.hpp"
#include "./ext/matrix_double3x3_precision.hpp"
#include "./ext/matrix_double3x4.hpp"
#include "./ext/matrix_double3x4_precision.hpp"
#include "./ext/matrix_double4x2.hpp"
#include "./ext/matrix_double4x2_precision.hpp"
#include "./ext/matrix_double4x3.hpp"
#include "./ext/matrix_double4x3_precision.hpp"
#include "./ext/matrix_double4x4.hpp"
#include "./ext/matrix_double4x4_precision.hpp"
#include "./ext/matrix_float2x2.hpp"
#include "./ext/matrix_float2x2_precision.hpp"
#include "./ext/matrix_float2x3.hpp"
#include "./ext/matrix_float2x3_precision.hpp"
#include "./ext/matrix_float2x4.hpp"
#include "./ext/matrix_float2x4_precision.hpp"
#include "./ext/matrix_float3x2.hpp"
#include "./ext/matrix_float3x2_precision.hpp"
#include "./ext/matrix_float3x3.hpp"
#include "./ext/matrix_float3x3_precision.hpp"
#include "./ext/matrix_float3x4.hpp"
#include "./ext/matrix_float3x4_precision.hpp"
#include "./ext/matrix_float4x2.hpp"
#include "./ext/matrix_float4x2_precision.hpp"
#include "./ext/matrix_float4x3.hpp"
#include "./ext/matrix_float4x3_precision.hpp"
#include "./ext/matrix_float4x4.hpp"
#include "./ext/matrix_float4x4_precision.hpp"
#include "./ext/matrix_relational.hpp"
#include "./ext/quaternion_double.hpp"
#include "./ext/quaternion_double_precision.hpp"
#include "./ext/quaternion_float.hpp"
#include "./ext/quaternion_float_precision.hpp"
#include "./ext/quaternion_geometric.hpp"
#include "./ext/quaternion_relational.hpp"
#include "./ext/scalar_constants.hpp"
#include "./ext/scalar_float_sized.hpp"
#include "./ext/scalar_int_sized.hpp"
#include "./ext/scalar_relational.hpp"
#include "./ext/vector_bool1.hpp"
#include "./ext/vector_bool1_precision.hpp"
#include "./ext/vector_bool2.hpp"
#include "./ext/vector_bool2_precision.hpp"
#include "./ext/vector_bool3.hpp"
#include "./ext/vector_bool3_precision.hpp"
#include "./ext/vector_bool4.hpp"
#include "./ext/vector_bool4_precision.hpp"
#include "./ext/vector_double1.hpp"
#include "./ext/vector_double1_precision.hpp"
#include "./ext/vector_double2.hpp"
#include "./ext/vector_double2_precision.hpp"
#include "./ext/vector_double3.hpp"
#include "./ext/vector_double3_precision.hpp"
#include "./ext/vector_double4.hpp"
#include "./ext/vector_double4_precision.hpp"
#include "./ext/vector_float1.hpp"
#include "./ext/vector_float1_precision.hpp"
#include "./ext/vector_float2.hpp"
#include "./ext/vector_float2_precision.hpp"
#include "./ext/vector_float3.hpp"
#include "./ext/vector_float3_precision.hpp"
#include "./ext/vector_float4.hpp"
#include "./ext/vector_float4_precision.hpp"
#include "./ext/vector_int1.hpp"
#include "./ext/vector_int1_precision.hpp"
#include "./ext/vector_int2.hpp"
#include "./ext/vector_int2_precision.hpp"
#include "./ext/vector_int3.hpp"
#include "./ext/vector_int3_precision.hpp"
#include "./ext/vector_int4.hpp"
#include "./ext/vector_int4_precision.hpp"
#include "./ext/vector_relational.hpp"
#include "./ext/vector_uint1.hpp"
#include "./ext/vector_uint1_precision.hpp"
#include "./ext/vector_uint2.hpp"
#include "./ext/vector_uint2_precision.hpp"
#include "./ext/vector_uint3.hpp"
#include "./ext/vector_uint3_precision.hpp"
#include "./ext/vector_uint4.hpp"
#include "./ext/vector_uint4_precision.hpp"
#include "./gtc/bitfield.hpp"
#include "./gtc/color_space.hpp"
#include "./gtc/constants.hpp"

View File

@ -0,0 +1,40 @@
/// @ref ext_scalar_constants
/// @file glm/ext/scalar_constants.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_scalar_constants GLM_EXT_scalar_constants
/// @ingroup ext
///
/// Include <glm/ext/scalar_constants.hpp> to use the features of this extension.
///
/// Provide a list of constants and precomputed useful values.
#pragma once
// Dependencies
#include "../detail/setup.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_scalar_constants extension included")
#endif
namespace glm
{
/// @addtogroup ext_scalar_constants
/// @{
/// Return the epsilon constant for floating point types.
/// @see ext_scalar_constants
template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType epsilon();
/// Return the pi constant for floating point types.
/// @see ext_scalar_constants
template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType pi();
/// @}
} //namespace glm
#include "scalar_constants.inl"

View File

@ -0,0 +1,18 @@
#include <limits>
namespace glm
{
template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType epsilon()
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'epsilon' only accepts floating-point inputs");
return std::numeric_limits<genType>::epsilon();
}
template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType pi()
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'epsilon' only accepts floating-point inputs");
return static_cast<genType>(3.14159265358979323846264338327950288);
}
} //namespace glm

View File

@ -1,5 +1,14 @@
/// @ref core
/// @file glm/detail/type_float.hpp
/// @ref ext_scalar_double
/// @file glm/ext/scalar_double.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_scalar_double GLM_EXT_scalar_double
/// @ingroup ext
///
/// Include <glm/ext/scalar_double.hpp> to use the features of this extension.
///
/// Exposes double scalar type.
#pragma once
@ -59,12 +68,9 @@ namespace detail
////////////////////
// check type sizes
#ifndef GLM_STATIC_ASSERT_NULL
GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform");
# ifndef GLM_FORCE_SINGLE_ONLY
GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform");
# endif//GLM_FORCE_SINGLE_ONLY
#endif//GLM_STATIC_ASSERT_NULL
/// @}

View File

@ -0,0 +1,45 @@
/// @ref ext_scalar_float_sized
/// @file glm/ext/scalar_float_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_scalar_float_sized GLM_EXT_scalar_float_sized
/// @ingroup ext
///
/// Include <glm/ext/scalar_float_sized.hpp> to use the features of this extension.
///
/// Exposes float scalar type.
#pragma once
#include "../detail/setup.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_scalar_float_sized extension included")
#endif
namespace glm
{
/// @addtogroup ext_scalar_float
/// @{
/// Low qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
///
/// @see ext_vector_relational
typedef float float32;
# ifndef GLM_FORCE_SINGLE_ONLY
/// Low qualifier floating-point numbers.
/// There is no guarantee on the actual qualifier.
///
/// @see ext_vector_relational
typedef double float64;
# endif//GLM_FORCE_SINGLE_ONLY
/// @}
}//namespace glm

View File

@ -0,0 +1,74 @@
/// @ref ext_scalar_int_sized
/// @file glm/ext/scalar_int_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_scalar_int_sized GLM_EXT_scalar_int_sized
/// @ingroup ext
///
/// Include <glm/ext/scalar_int_sized.hpp> to use the features of this extension.
///
/// Exposes signed integer scalar type.
#pragma once
#include "../detail/setup.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_scalar_int_sized extension included")
#endif
namespace glm{
namespace detail
{
# if GLM_HAS_EXTENDED_INTEGER_TYPE
typedef std::int8_t int8;
typedef std::int16_t int16;
typedef std::int32_t int32;
# else
typedef char int8;
typedef short int16;
typedef int int32;
#endif//
template<>
struct is_int<int8>
{
enum test {value = ~0};
};
template<>
struct is_int<int16>
{
enum test {value = ~0};
};
template<>
struct is_int<int64>
{
enum test {value = ~0};
};
}//namespace detail
/// @addtogroup ext_scalar_int_sized
/// @{
/// 8 bit signed integer type.
/// @see ext_scalar_int_sized
typedef detail::int8 int8;
/// 16 bit signed integer type.
/// @see ext_scalar_int_sized
typedef detail::int16 int16;
/// 32 bit signed integer type.
/// @see ext_scalar_int_sized
typedef detail::int32 int32;
/// 64 bit signed integer type.
/// @see ext_scalar_int_sized
typedef detail::int64 int64;
/// @}
}//namespace glm

View File

@ -0,0 +1,74 @@
/// @ref ext_scalar_uint_sized
/// @file glm/ext/scalar_uint_sized.hpp
///
/// @see core (dependence)
///
/// @defgroup ext_scalar_uint_sized GLM_EXT_scalar_uint_sized
/// @ingroup ext
///
/// Include <glm/ext/scalar_uint_sized.hpp> to use the features of this extension.
///
/// Exposes unsigned integer scalar type.
#pragma once
#include "../detail/setup.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_scalar_uint_sized extension included")
#endif
namespace glm{
namespace detail
{
# if GLM_HAS_EXTENDED_INTEGER_TYPE
typedef std::uint8_t uint8;
typedef std::uint16_t uint16;
typedef std::uint32_t uint32;
# else
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
#endif
template<>
struct is_int<uint8>
{
enum test {value = ~0};
};
template<>
struct is_int<uint16>
{
enum test {value = ~0};
};
template<>
struct is_int<uint64>
{
enum test {value = ~0};
};
}//namespace detail
/// @addtogroup ext_scalar_uint_sized
/// @{
/// 8 bit unsigned integer type.
/// @see ext_scalar_uint_sized
typedef detail::uint8 uint8;
/// 16 bit unsigned integer type.
/// @see ext_scalar_uint_sized
typedef detail::uint16 uint16;
/// 32 bit unsigned integer type.
/// @see ext_scalar_uint_sized
typedef detail::uint32 uint32;
/// 64 bit unsigned integer type.
/// @see ext_scalar_uint_sized
typedef detail::uint64 uint64;
/// @}
}//namespace glm

View File

@ -24,14 +24,14 @@ namespace glm
/// @{
# if GLM_CONFIG_PRECISION_UINT == GLM_LOWP
typedef vec<1, uint, lowp> uvec1;
typedef vec<1, unsigned int, lowp> uvec1;
# elif GLM_CONFIG_PRECISION_UINT == GLM_MEDIUMP
typedef vec<1, uint, mediump> uvec1;
# else
typedef vec<1, unsigned int, mediump> uvec1;
# elif GLM_CONFIG_PRECISION_UINT == GLM_HIGHP
/// 1 component vector of unsigned integer numbers.
///
/// @see ext_vector_uint1 extension.
typedef vec<1, uint, highp> uvec1;
typedef vec<1, unsigned int, highp> uvec1;
# endif
/// @}

View File

@ -26,17 +26,17 @@ namespace glm
/// 1 component vector of unsigned integer values.
///
/// @see ext_vec1
typedef vec<1, uint, highp> highp_uvec1;
typedef vec<1, unsigned int, highp> highp_uvec1;
/// 1 component vector of unsigned integer values.
///
/// @see ext_vec1
typedef vec<1, uint, mediump> mediump_uvec1;
typedef vec<1, unsigned int, mediump> mediump_uvec1;
/// 1 component vector of unsigned integer values.
///
/// @see ext_vec1
typedef vec<1, uint, lowp> lowp_uvec1;
typedef vec<1, unsigned int, lowp> lowp_uvec1;
/// @}
}//namespace glm

View File

@ -9,15 +9,15 @@ namespace glm
/// @addtogroup core
/// @{
# if(defined(GLM_PRECISION_LOWP_UINT))
typedef vec<2, uint, lowp> uvec2;
# elif(defined(GLM_PRECISION_MEDIUMP_UINT))
typedef vec<2, uint, mediump> uvec2;
# else //defined(GLM_PRECISION_HIGHP_UINT)
# if GLM_CONFIG_PRECISION_UINT == GLM_LOWP
typedef vec<2, unsigned int, lowp> uvec2;
# elif GLM_CONFIG_PRECISION_UINT == GLM_MEDIUMP
typedef vec<2, unsigned int, mediump> uvec2;
# elif GLM_CONFIG_PRECISION_UINT == GLM_HIGHP
/// 2 components vector of unsigned integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef vec<2, uint, highp> uvec2;
typedef vec<2, unsigned int, highp> uvec2;
# endif//GLM_PRECISION
/// @}

View File

@ -13,19 +13,19 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef vec<2, uint, highp> highp_uvec2;
typedef vec<2, unsigned int, highp> highp_uvec2;
/// 2 components vector of medium qualifier unsigned integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef vec<2, uint, mediump> mediump_uvec2;
typedef vec<2, unsigned int, mediump> mediump_uvec2;
/// 2 components vector of low qualifier unsigned integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef vec<2, uint, lowp> lowp_uvec2;
typedef vec<2, unsigned int, lowp> lowp_uvec2;
/// @}
}//namespace glm

View File

@ -10,14 +10,14 @@ namespace glm
/// @{
# if(defined(GLM_PRECISION_LOWP_UINT))
typedef vec<3, uint, lowp> uvec3;
typedef vec<3, unsigned int, lowp> uvec3;
# elif(defined(GLM_PRECISION_MEDIUMP_UINT))
typedef vec<3, uint, mediump> uvec3;
typedef vec<3, unsigned int, mediump> uvec3;
# else //defined(GLM_PRECISION_HIGHP_UINT)
/// 3 components vector of unsigned integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef vec<3, uint, highp> uvec3;
typedef vec<3, unsigned int, highp> uvec3;
# endif//GLM_PRECISION
/// @}

View File

@ -14,19 +14,19 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef vec<3, uint, highp> highp_uvec3;
typedef vec<3, unsigned int, highp> highp_uvec3;
/// 3 components vector of medium qualifier unsigned integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef vec<3, uint, mediump> mediump_uvec3;
typedef vec<3, unsigned int, mediump> mediump_uvec3;
/// 3 components vector of low qualifier unsigned integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef vec<3, uint, lowp> lowp_uvec3;
typedef vec<3, unsigned int, lowp> lowp_uvec3;
/// @}
}//namespace glm

View File

@ -10,14 +10,14 @@ namespace glm
/// @{
# if(defined(GLM_PRECISION_LOWP_UINT))
typedef vec<4, uint, lowp> uvec4;
typedef vec<4, unsigned int, lowp> uvec4;
# elif(defined(GLM_PRECISION_MEDIUMP_UINT))
typedef vec<4, uint, mediump> uvec4;
typedef vec<4, unsigned int, mediump> uvec4;
# else //defined(GLM_PRECISION_HIGHP_UINT)
/// 4 components vector of unsigned integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef vec<4, uint, highp> uvec4;
typedef vec<4, unsigned int, highp> uvec4;
# endif//GLM_PRECISION
/// @}

View File

@ -13,19 +13,19 @@ namespace glm
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef vec<4, uint, highp> highp_uvec4;
typedef vec<4, unsigned int, highp> highp_uvec4;
/// 4 components vector of medium qualifier unsigned integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef vec<4, uint, mediump> mediump_uvec4;
typedef vec<4, unsigned int, mediump> mediump_uvec4;
/// 4 components vector of low qualifier unsigned integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef vec<4, uint, lowp> lowp_uvec4;
typedef vec<4, unsigned int, lowp> lowp_uvec4;
/// @}
}//namespace glm

View File

@ -16,8 +16,9 @@
#pragma once
// Dependencies
#include "../ext/scalar_int_sized.hpp"
#include "../ext/scalar_uint_sized.hpp"
#include "../detail/qualifier.hpp"
#include "../detail/type_int.hpp"
#include "../detail/_vectorize.hpp"
#include "type_precision.hpp"
#include <limits>

View File

@ -13,7 +13,7 @@
#pragma once
// Dependencies
#include "../detail/setup.hpp"
#include "../ext/scalar_constants.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_GTC_constants extension included")
@ -24,11 +24,6 @@ namespace glm
/// @addtogroup gtc_constants
/// @{
/// Return the epsilon constant for floating point types.
/// @see gtc_constants
template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType epsilon();
/// Return 0.
/// @see gtc_constants
template<typename genType>
@ -39,11 +34,6 @@ namespace glm
template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType one();
/// Return the pi constant.
/// @see gtc_constants
template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType pi();
/// Return pi * 2.
/// @see gtc_constants
template<typename genType>

View File

@ -1,15 +1,7 @@
/// @ref gtc_constants
#include <limits>
namespace glm
{
template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType epsilon()
{
return std::numeric_limits<genType>::epsilon();
}
template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType zero()
{
@ -22,12 +14,6 @@ namespace glm
return genType(1);
}
template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType pi()
{
return genType(3.14159265358979323846264338327950288);
}
template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_pi()
{

View File

@ -14,8 +14,9 @@
#pragma once
// Dependency:
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../ext/scalar_int_sized.hpp"
#include "../ext/scalar_uint_sized.hpp"
#include "../detail/qualifier.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_GTC_random extension included")

View File

@ -1,5 +1,3 @@
/// @ref gtc_random
#include "../geometric.hpp"
#include "../exponential.hpp"
#include "../trigonometric.hpp"

View File

@ -19,18 +19,21 @@
// Dependency:
#include "../gtc/quaternion.hpp"
#include "../gtc/vec1.hpp"
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
#include "../mat2x2.hpp"
#include "../mat2x3.hpp"
#include "../mat2x4.hpp"
#include "../mat3x2.hpp"
#include "../mat3x3.hpp"
#include "../mat3x4.hpp"
#include "../mat4x2.hpp"
#include "../mat4x3.hpp"
#include "../mat4x4.hpp"
#include "../ext/scalar_float_sized.hpp"
#include "../ext/scalar_int_sized.hpp"
#include "../ext/scalar_uint_sized.hpp"
#include "../detail/type_vec2.hpp"
#include "../detail/type_vec3.hpp"
#include "../detail/type_vec4.hpp"
#include "../detail/type_mat2x2.hpp"
#include "../detail/type_mat2x3.hpp"
#include "../detail/type_mat2x4.hpp"
#include "../detail/type_mat3x2.hpp"
#include "../detail/type_mat3x3.hpp"
#include "../detail/type_mat3x4.hpp"
#include "../detail/type_mat4x2.hpp"
#include "../detail/type_mat4x3.hpp"
#include "../detail/type_mat4x4.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_GTC_type_precision extension included")
@ -738,19 +741,19 @@ namespace glm
/// Low 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 lowp_float32;
typedef float32 lowp_float32;
/// Low 64 bit double-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 lowp_float64;
typedef float64 lowp_float64;
/// Low 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 lowp_float32_t;
typedef float32 lowp_float32_t;
/// Low 64 bit double-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 lowp_float64_t;
typedef float64 lowp_float64_t;
/// Low 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
@ -762,19 +765,19 @@ namespace glm
/// Low 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 lowp_float32;
typedef float32 lowp_float32;
/// Low 64 bit double-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 lowp_float64;
typedef float64 lowp_float64;
/// Low 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 lowp_float32_t;
typedef float32 lowp_float32_t;
/// Low 64 bit double-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 lowp_float64_t;
typedef float64 lowp_float64_t;
/// Low 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
@ -787,19 +790,19 @@ namespace glm
/// Low 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 lowp_float32;
typedef float32 lowp_float32;
/// Low 64 bit double-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 lowp_float64;
typedef float64 lowp_float64;
/// Low 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 lowp_float32_t;
typedef float32 lowp_float32_t;
/// Low 64 bit double-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 lowp_float64_t;
typedef float64 lowp_float64_t;
/// Low 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
@ -812,19 +815,19 @@ namespace glm
/// Medium 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 mediump_float32;
typedef float32 mediump_float32;
/// Medium 64 bit double-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 mediump_float64;
typedef float64 mediump_float64;
/// Medium 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 mediump_float32_t;
typedef float32 mediump_float32_t;
/// Medium 64 bit double-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 mediump_float64_t;
typedef float64 mediump_float64_t;
/// Medium 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
@ -837,19 +840,19 @@ namespace glm
/// High 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 highp_float32;
typedef float32 highp_float32;
/// High 64 bit double-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 highp_float64;
typedef float64 highp_float64;
/// High 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 highp_float32_t;
typedef float32 highp_float32_t;
/// High 64 bit double-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 highp_float64_t;
typedef float64 highp_float64_t;
/// High 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
@ -1943,24 +1946,17 @@ namespace glm
/// 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 float32;
/// 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float32 float32_t;
typedef float32 float32_t;
/// 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef float32 f32;
# ifndef GLM_FORCE_SINGLE_ONLY
/// 64 bit double-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 float64;
/// 64 bit double-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef detail::float64 float64_t;
typedef float64 float64_t;
/// 64 bit double-qualifier floating-point scalar.
/// @see gtc_type_precision

View File

@ -15,9 +15,6 @@
#pragma once
// Dependencies
#include "../detail/setup.hpp"
#include "../detail/qualifier.hpp"
#include "../detail/type_int.hpp"
#include "../gtc/constants.hpp"
#include "../ext/vector_relational.hpp"

View File

@ -7,7 +7,6 @@
/// software is freely granted, provided that this notice
/// is preserved.
#include "../detail/type_int.hpp"
#include "epsilon.hpp"
#include <cmath>
#include <cfloat>
@ -30,8 +29,8 @@ typedef union
double value;
struct
{
glm::detail::int32 lsw;
glm::detail::int32 msw;
int lsw;
int msw;
} parts;
} ieee_double_shape_type;
@ -71,7 +70,7 @@ namespace detail
GLM_FUNC_QUALIFIER float nextafterf(float x, float y)
{
volatile float t;
glm::detail::int32 hx, hy, ix, iy;
int hx, hy, ix, iy;
GLM_GET_FLOAT_WORD(hx, x);
GLM_GET_FLOAT_WORD(hy, y);
@ -125,8 +124,8 @@ namespace detail
GLM_FUNC_QUALIFIER double nextafter(double x, double y)
{
volatile double t;
glm::detail::int32 hx, hy, ix, iy;
glm::detail::uint32 lx, ly;
int hx, hy, ix, iy;
unsigned int lx, ly;
GLM_EXTRACT_WORDS(hx, lx, x);
GLM_EXTRACT_WORDS(hy, ly, y);

View File

@ -19,9 +19,7 @@
// Dependency:
#include "../glm.hpp"
#include "../gtc/constants.hpp"
#include "../detail/setup.hpp"
#include "../detail/qualifier.hpp"
#include "../detail/type_int.hpp"
#ifndef GLM_ENABLE_EXPERIMENTAL
# error "GLM: GLM_GTX_easing is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."

View File

@ -13,8 +13,8 @@
#pragma once
// Dependencies
#include "../ext/scalar_uint_sized.hpp"
#include "../detail/setup.hpp"
#include "../detail/type_int.hpp"
#ifndef GLM_ENABLE_EXPERIMENTAL
# error "GLM: GLM_GTX_raw_data is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."

View File

@ -14,7 +14,6 @@
#pragma once
#include "detail/setup.hpp"
#include "detail/qualifier.hpp"
#include "common.hpp"
#include "vector_relational.hpp"

View File

@ -10,7 +10,6 @@ glmCreateTestGTC(core_force_xyzw_only)
glmCreateTestGTC(core_type_aligned)
glmCreateTestGTC(core_type_cast)
glmCreateTestGTC(core_type_ctor)
glmCreateTestGTC(core_type_float)
glmCreateTestGTC(core_type_int)
glmCreateTestGTC(core_type_length)
glmCreateTestGTC(core_type_mat2x2)

View File

@ -8,6 +8,8 @@
#include <glm/ext/vector_uint2.hpp>
#include <glm/ext/vector_uint3.hpp>
#include <glm/ext/vector_uint4.hpp>
#include <glm/ext/scalar_int_sized.hpp>
#include <glm/ext/scalar_uint_sized.hpp>
#include <vector>
#include <ctime>
#include <cstdio>

View File

@ -1,31 +0,0 @@
#include <glm/glm.hpp>
int test_float_size()
{
return
sizeof(glm::float_t) != sizeof(glm::lowp_float) &&
sizeof(glm::float_t) != sizeof(glm::mediump_float) &&
sizeof(glm::float_t) != sizeof(glm::highp_float);
}
int test_float_precision()
{
return (
sizeof(glm::lowp_float) <= sizeof(glm::mediump_float) &&
sizeof(glm::mediump_float) <= sizeof(glm::highp_float)) ? 0 : 1;
}
int test_vec2()
{
return 0;
}
int main()
{
int Error = 0;
Error += test_float_size();
Error += test_float_precision();
return Error;
}

View File

@ -1,34 +1,5 @@
#include <glm/glm.hpp>
static int test_int_size()
{
return
sizeof(glm::int_t) != sizeof(glm::lowp_int) &&
sizeof(glm::int_t) != sizeof(glm::mediump_int) &&
sizeof(glm::int_t) != sizeof(glm::highp_int);
}
static int test_uint_size()
{
return
sizeof(glm::uint_t) != sizeof(glm::lowp_uint) &&
sizeof(glm::uint_t) != sizeof(glm::mediump_uint) &&
sizeof(glm::uint_t) != sizeof(glm::highp_uint);
}
static int test_int_precision()
{
return (
sizeof(glm::lowp_int) <= sizeof(glm::mediump_int) &&
sizeof(glm::mediump_int) <= sizeof(glm::highp_int)) ? 0 : 1;
}
static int test_uint_precision()
{
return (
sizeof(glm::lowp_uint) <= sizeof(glm::mediump_uint) &&
sizeof(glm::mediump_uint) <= sizeof(glm::highp_uint)) ? 0 : 1;
}
#include <glm/ext/scalar_int_sized.hpp>
static int test_bit_operator()
{
@ -49,10 +20,6 @@ int main()
{
int Error = 0;
Error += test_int_size();
Error += test_int_precision();
Error += test_uint_size();
Error += test_uint_precision();
Error += test_bit_operator();
return Error;

View File

@ -2,6 +2,10 @@ glmCreateTestGTC(ext_matrix_relational)
glmCreateTestGTC(ext_quaternion_geometric)
glmCreateTestGTC(ext_quaternion_relational)
glmCreateTestGTC(ext_quaternion_type)
glmCreateTestGTC(ext_scalar_constants)
glmCreateTestGTC(ext_scalar_float_sized)
glmCreateTestGTC(ext_scalar_int_sized)
glmCreateTestGTC(ext_scalar_uint_sized)
glmCreateTestGTC(ext_scalar_relational)
glmCreateTestGTC(ext_vec1)
glmCreateTestGTC(ext_vector_vec1)

View File

@ -0,0 +1,36 @@
#include <glm/ext/scalar_constants.hpp>
template <typename valType>
static int test_epsilon()
{
int Error = 0;
valType const Test = glm::epsilon<valType>();
Error += Test > static_cast<valType>(0) ? 0 : 1;
return Error;
}
template <typename valType>
static int test_pi()
{
int Error = 0;
valType const Test = glm::pi<valType>();
Error += Test > static_cast<valType>(3.14) ? 0 : 1;
Error += Test < static_cast<valType>(3.15) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
Error += test_epsilon<float>();
Error += test_epsilon<double>();
Error += test_pi<float>();
Error += test_pi<double>();
return Error;
}

View File

@ -0,0 +1,37 @@
#include <glm/ext/scalar_float_sized.hpp>
GLM_STATIC_ASSERT(sizeof(glm::float32) == 4, "float32 size isn't 4 bytes on this platform");
#ifndef GLM_FORCE_SINGLE_ONLY
GLM_STATIC_ASSERT(sizeof(glm::float64) == 8, "float64 size isn't 8 bytes on this platform");
#endif//GLM_FORCE_SINGLE_ONLY
static int test_float_size()
{
int Error = 0;
Error += sizeof(glm::float32) == sizeof(float) ? 0 : 1;
Error += sizeof(glm::float64) == sizeof(double) ? 0 : 1;
return Error;
}
static int test_float_precision()
{
int Error = 0;
Error += sizeof(float) <= sizeof(double) ? 0 : 1;
Error += sizeof(glm::float32) < sizeof(glm::float64) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
Error += test_float_size();
Error += test_float_precision();
return Error;
}

View File

@ -0,0 +1,42 @@
#include <glm/ext/scalar_int_sized.hpp>
GLM_STATIC_ASSERT(sizeof(glm::int8) == 1, "int8 size isn't 1 byte on this platform");
GLM_STATIC_ASSERT(sizeof(glm::int16) == 2, "int16 size isn't 2 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::int32) == 4, "int32 size isn't 4 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::int64) == 8, "int64 size isn't 8 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::int16) == sizeof(short), "signed short size isn't 4 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::int32) == sizeof(int), "signed int size isn't 4 bytes on this platform");
static int test_size()
{
int Error = 0;
Error += sizeof(glm::int8) == 1 ? 0 : 1;
Error += sizeof(glm::int16) == 2 ? 0 : 1;
Error += sizeof(glm::int32) == 4 ? 0 : 1;
Error += sizeof(glm::int64) == 8 ? 0 : 1;
return Error;
}
static int test_comp()
{
int Error = 0;
Error += sizeof(glm::int8) < sizeof(glm::int16) ? 0 : 1;
Error += sizeof(glm::int16) < sizeof(glm::int32) ? 0 : 1;
Error += sizeof(glm::int32) < sizeof(glm::int64) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
Error += test_size();
Error += test_comp();
return Error;
}

View File

@ -0,0 +1,42 @@
#include <glm/ext/scalar_uint_sized.hpp>
GLM_STATIC_ASSERT(sizeof(glm::uint8) == 1, "uint8 size isn't 1 byte on this platform");
GLM_STATIC_ASSERT(sizeof(glm::uint16) == 2, "uint16 size isn't 2 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::uint32) == 4, "uint32 size isn't 4 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::uint64) == 8, "uint64 size isn't 8 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::uint16) == sizeof(unsigned short), "unsigned short size isn't 4 bytes on this platform");
GLM_STATIC_ASSERT(sizeof(glm::uint32) == sizeof(unsigned int), "unsigned int size isn't 4 bytes on this platform");
static int test_size()
{
int Error = 0;
Error += sizeof(glm::uint8) == 1 ? 0 : 1;
Error += sizeof(glm::uint16) == 2 ? 0 : 1;
Error += sizeof(glm::uint32) == 4 ? 0 : 1;
Error += sizeof(glm::uint64) == 8 ? 0 : 1;
return Error;
}
static int test_comp()
{
int Error = 0;
Error += sizeof(glm::uint8) < sizeof(glm::uint16) ? 0 : 1;
Error += sizeof(glm::uint16) < sizeof(glm::uint32) ? 0 : 1;
Error += sizeof(glm::uint32) < sizeof(glm::uint64) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
Error += test_size();
Error += test_comp();
return Error;
}