summaryrefslogtreecommitdiffstats
path: root/external/include/glm/gtc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--external/include/glm/gtc/bitfield.hpp111
-rw-r--r--external/include/glm/gtc/bitfield.inl246
-rw-r--r--external/include/glm/gtc/color_encoding.inl65
-rw-r--r--external/include/glm/gtc/color_space.hpp30
-rw-r--r--external/include/glm/gtc/color_space.inl70
-rw-r--r--external/include/glm/gtc/constants.hpp67
-rw-r--r--external/include/glm/gtc/constants.inl60
-rw-r--r--external/include/glm/gtc/epsilon.hpp41
-rw-r--r--external/include/glm/gtc/epsilon.inl112
-rw-r--r--external/include/glm/gtc/functions.hpp53
-rw-r--r--external/include/glm/gtc/integer.hpp67
-rw-r--r--external/include/glm/gtc/integer.inl46
-rw-r--r--external/include/glm/gtc/matrix_access.hpp25
-rw-r--r--external/include/glm/gtc/matrix_access.inl22
-rw-r--r--external/include/glm/gtc/matrix_integer.hpp297
-rw-r--r--external/include/glm/gtc/matrix_inverse.hpp19
-rw-r--r--external/include/glm/gtc/matrix_inverse.inl48
-rw-r--r--external/include/glm/gtc/matrix_transform.hpp832
-rw-r--r--external/include/glm/gtc/matrix_transform.inl737
-rw-r--r--external/include/glm/gtc/noise.hpp29
-rw-r--r--external/include/glm/gtc/noise.inl904
-rw-r--r--external/include/glm/gtc/packing.hpp551
-rw-r--r--external/include/glm/gtc/packing.inl341
-rw-r--r--external/include/glm/gtc/quaternion.hpp358
-rw-r--r--external/include/glm/gtc/quaternion.inl533
-rw-r--r--external/include/glm/gtc/quaternion_simd.inl88
-rw-r--r--external/include/glm/gtc/random.hpp91
-rw-r--r--external/include/glm/gtc/random.inl310
-rw-r--r--external/include/glm/gtc/reciprocal.hpp84
-rw-r--r--external/include/glm/gtc/reciprocal.inl100
-rw-r--r--external/include/glm/gtc/round.hpp136
-rw-r--r--external/include/glm/gtc/round.inl158
-rw-r--r--external/include/glm/gtc/type_aligned.hpp588
-rw-r--r--external/include/glm/gtc/type_precision.hpp606
-rw-r--r--external/include/glm/gtc/type_ptr.hpp126
-rw-r--r--external/include/glm/gtc/type_ptr.inl621
-rw-r--r--external/include/glm/gtc/ulp.hpp38
-rw-r--r--external/include/glm/gtc/ulp.inl136
-rw-r--r--external/include/glm/gtc/vec1.hpp152
-rw-r--r--external/include/glm/gtx/functions.inl (renamed from external/include/glm/gtc/functions.inl)18
40 files changed, 4847 insertions, 4069 deletions
diff --git a/external/include/glm/gtc/bitfield.hpp b/external/include/glm/gtc/bitfield.hpp
index 38a38b6..9dcec53 100644
--- a/external/include/glm/gtc/bitfield.hpp
+++ b/external/include/glm/gtc/bitfield.hpp
@@ -6,16 +6,17 @@
///
/// @defgroup gtc_bitfield GLM_GTC_bitfield
/// @ingroup gtc
-///
-/// @brief Allow to perform bit operations on integer values
-///
-/// <glm/gtc/bitfield.hpp> need to be included to use these functionalities.
+///
+/// Include <glm/gtc/bitfield.hpp> to use the features of this extension.
+///
+/// Allow to perform bit operations on integer values
+
+#include "../detail/setup.hpp"
#pragma once
// Dependencies
-#include "../detail/setup.hpp"
-#include "../detail/precision.hpp"
+#include "../detail/qualifier.hpp"
#include "../detail/type_int.hpp"
#include "../detail/_vectorize.hpp"
#include <limits>
@@ -32,172 +33,192 @@ namespace glm
/// Build a mask of 'count' bits
///
/// @see gtc_bitfield
- template <typename genIUType>
+ template<typename genIUType>
GLM_FUNC_DECL genIUType mask(genIUType Bits);
-
+
/// Build a mask of 'count' bits
///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Signed and unsigned integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
/// @see gtc_bitfield
- template <typename T, precision P, template <typename, precision> class vecIUType>
- GLM_FUNC_DECL vecIUType<T, P> mask(vecIUType<T, P> const & v);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> mask(vec<L, T, Q> const& v);
/// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.
///
/// @see gtc_bitfield
- template <typename genIUType>
+ template<typename genIUType>
GLM_FUNC_DECL genIUType bitfieldRotateRight(genIUType In, int Shift);
/// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.
///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Signed and unsigned integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
/// @see gtc_bitfield
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> bitfieldRotateRight(vecType<T, P> const & In, int Shift);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> bitfieldRotateRight(vec<L, T, Q> const& In, int Shift);
/// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.
///
/// @see gtc_bitfield
- template <typename genIUType>
+ template<typename genIUType>
GLM_FUNC_DECL genIUType bitfieldRotateLeft(genIUType In, int Shift);
/// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.
///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Signed and unsigned integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
/// @see gtc_bitfield
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> bitfieldRotateLeft(vecType<T, P> const & In, int Shift);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> bitfieldRotateLeft(vec<L, T, Q> const& In, int Shift);
/// Set to 1 a range of bits.
///
/// @see gtc_bitfield
- template <typename genIUType>
+ template<typename genIUType>
GLM_FUNC_DECL genIUType bitfieldFillOne(genIUType Value, int FirstBit, int BitCount);
/// Set to 1 a range of bits.
///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Signed and unsigned integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
/// @see gtc_bitfield
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> bitfieldFillOne(vecType<T, P> const & Value, int FirstBit, int BitCount);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> bitfieldFillOne(vec<L, T, Q> const& Value, int FirstBit, int BitCount);
/// Set to 0 a range of bits.
///
/// @see gtc_bitfield
- template <typename genIUType>
+ template<typename genIUType>
GLM_FUNC_DECL genIUType bitfieldFillZero(genIUType Value, int FirstBit, int BitCount);
/// Set to 0 a range of bits.
///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Signed and unsigned integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
/// @see gtc_bitfield
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> bitfieldFillZero(vecType<T, P> const & Value, int FirstBit, int BitCount);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> bitfieldFillZero(vec<L, T, Q> const& Value, int FirstBit, int BitCount);
/// Interleaves the bits of x and y.
/// The first bit is the first bit of x followed by the first bit of y.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL int16 bitfieldInterleave(int8 x, int8 y);
/// Interleaves the bits of x and y.
/// The first bit is the first bit of x followed by the first bit of y.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL uint16 bitfieldInterleave(uint8 x, uint8 y);
/// Interleaves the bits of x and y.
/// The first bit is the first bit of x followed by the first bit of y.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL int32 bitfieldInterleave(int16 x, int16 y);
/// Interleaves the bits of x and y.
/// The first bit is the first bit of x followed by the first bit of y.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL uint32 bitfieldInterleave(uint16 x, uint16 y);
/// Interleaves the bits of x and y.
/// The first bit is the first bit of x followed by the first bit of y.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y);
/// Interleaves the bits of x and y.
/// The first bit is the first bit of x followed by the first bit of y.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y);
/// Interleaves the bits of x, y and z.
/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z);
/// Interleaves the bits of x, y and z.
/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z);
/// Interleaves the bits of x, y and z.
/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z);
- /// Interleaves the bits of x, y and z.
+ /// Interleaves the bits of x, y and z.
/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z);
- /// Interleaves the bits of x, y and z.
+ /// Interleaves the bits of x, y and z.
/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y, int32 z);
- /// Interleaves the bits of x, y and z.
+ /// Interleaves the bits of x, y and z.
/// The first bit is the first bit of x followed by the first bit of y and the first bit of z.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y, uint32 z);
- /// Interleaves the bits of x, y, z and w.
+ /// Interleaves the bits of x, y, z and w.
/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z, int8 w);
- /// Interleaves the bits of x, y, z and w.
+ /// Interleaves the bits of x, y, z and w.
/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w);
- /// Interleaves the bits of x, y, z and w.
+ /// Interleaves the bits of x, y, z and w.
/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z, int16 w);
- /// Interleaves the bits of x, y, z and w.
+ /// Interleaves the bits of x, y, z and w.
/// The first bit is the first bit of x followed by the first bit of y, the first bit of z and finally the first bit of w.
/// The other bits are interleaved following the previous sequence.
- ///
+ ///
/// @see gtc_bitfield
GLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w);
diff --git a/external/include/glm/gtc/bitfield.inl b/external/include/glm/gtc/bitfield.inl
index 490cfb3..9735740 100644
--- a/external/include/glm/gtc/bitfield.inl
+++ b/external/include/glm/gtc/bitfield.inl
@@ -6,165 +6,165 @@
namespace glm{
namespace detail
{
- template <typename PARAM, typename RET>
+ template<typename PARAM, typename RET>
GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y);
- template <typename PARAM, typename RET>
+ template<typename PARAM, typename RET>
GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y, PARAM z);
- template <typename PARAM, typename RET>
+ template<typename PARAM, typename RET>
GLM_FUNC_DECL RET bitfieldInterleave(PARAM x, PARAM y, PARAM z, PARAM w);
- template <>
+ template<>
GLM_FUNC_QUALIFIER glm::uint16 bitfieldInterleave(glm::uint8 x, glm::uint8 y)
{
glm::uint16 REG1(x);
glm::uint16 REG2(y);
- REG1 = ((REG1 << 4) | REG1) & glm::uint16(0x0F0F);
- REG2 = ((REG2 << 4) | REG2) & glm::uint16(0x0F0F);
+ REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint16>(0x0F0F);
+ REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint16>(0x0F0F);
- REG1 = ((REG1 << 2) | REG1) & glm::uint16(0x3333);
- REG2 = ((REG2 << 2) | REG2) & glm::uint16(0x3333);
+ REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint16>(0x3333);
+ REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint16>(0x3333);
- REG1 = ((REG1 << 1) | REG1) & glm::uint16(0x5555);
- REG2 = ((REG2 << 1) | REG2) & glm::uint16(0x5555);
+ REG1 = ((REG1 << 1) | REG1) & static_cast<glm::uint16>(0x5555);
+ REG2 = ((REG2 << 1) | REG2) & static_cast<glm::uint16>(0x5555);
- return REG1 | (REG2 << 1);
+ return REG1 | static_cast<glm::uint16>(REG2 << 1);
}
- template <>
+ template<>
GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint16 x, glm::uint16 y)
{
glm::uint32 REG1(x);
glm::uint32 REG2(y);
- REG1 = ((REG1 << 8) | REG1) & glm::uint32(0x00FF00FF);
- REG2 = ((REG2 << 8) | REG2) & glm::uint32(0x00FF00FF);
+ REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint32>(0x00FF00FF);
+ REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint32>(0x00FF00FF);
- REG1 = ((REG1 << 4) | REG1) & glm::uint32(0x0F0F0F0F);
- REG2 = ((REG2 << 4) | REG2) & glm::uint32(0x0F0F0F0F);
+ REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint32>(0x0F0F0F0F);
+ REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint32>(0x0F0F0F0F);
- REG1 = ((REG1 << 2) | REG1) & glm::uint32(0x33333333);
- REG2 = ((REG2 << 2) | REG2) & glm::uint32(0x33333333);
+ REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint32>(0x33333333);
+ REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint32>(0x33333333);
- REG1 = ((REG1 << 1) | REG1) & glm::uint32(0x55555555);
- REG2 = ((REG2 << 1) | REG2) & glm::uint32(0x55555555);
+ REG1 = ((REG1 << 1) | REG1) & static_cast<glm::uint32>(0x55555555);
+ REG2 = ((REG2 << 1) | REG2) & static_cast<glm::uint32>(0x55555555);
return REG1 | (REG2 << 1);
}
- template <>
+ template<>
GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y)
{
glm::uint64 REG1(x);
glm::uint64 REG2(y);
- REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFFull);
- REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFFull);
+ REG1 = ((REG1 << 16) | REG1) & static_cast<glm::uint64>(0x0000FFFF0000FFFFull);
+ REG2 = ((REG2 << 16) | REG2) & static_cast<glm::uint64>(0x0000FFFF0000FFFFull);
- REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FFull);
- REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FFull);
+ REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint64>(0x00FF00FF00FF00FFull);
+ REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint64>(0x00FF00FF00FF00FFull);
- REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0Full);
- REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0Full);
+ REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint64>(0x0F0F0F0F0F0F0F0Full);
+ REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint64>(0x0F0F0F0F0F0F0F0Full);
- REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333ull);
- REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333ull);
+ REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint64>(0x3333333333333333ull);
+ REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint64>(0x3333333333333333ull);
- REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555ull);
- REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555ull);
+ REG1 = ((REG1 << 1) | REG1) & static_cast<glm::uint64>(0x5555555555555555ull);
+ REG2 = ((REG2 << 1) | REG2) & static_cast<glm::uint64>(0x5555555555555555ull);
return REG1 | (REG2 << 1);
}
- template <>
+ template<>
GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint8 x, glm::uint8 y, glm::uint8 z)
{
glm::uint32 REG1(x);
glm::uint32 REG2(y);
glm::uint32 REG3(z);
- REG1 = ((REG1 << 16) | REG1) & glm::uint32(0x00FF0000FF0000FF);
- REG2 = ((REG2 << 16) | REG2) & glm::uint32(0x00FF0000FF0000FF);
- REG3 = ((REG3 << 16) | REG3) & glm::uint32(0x00FF0000FF0000FF);
+ REG1 = ((REG1 << 16) | REG1) & static_cast<glm::uint32>(0xFF0000FFu);
+ REG2 = ((REG2 << 16) | REG2) & static_cast<glm::uint32>(0xFF0000FFu);
+ REG3 = ((REG3 << 16) | REG3) & static_cast<glm::uint32>(0xFF0000FFu);
- REG1 = ((REG1 << 8) | REG1) & glm::uint32(0xF00F00F00F00F00F);
- REG2 = ((REG2 << 8) | REG2) & glm::uint32(0xF00F00F00F00F00F);
- REG3 = ((REG3 << 8) | REG3) & glm::uint32(0xF00F00F00F00F00F);
+ REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint32>(0x0F00F00Fu);
+ REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint32>(0x0F00F00Fu);
+ REG3 = ((REG3 << 8) | REG3) & static_cast<glm::uint32>(0x0F00F00Fu);
- REG1 = ((REG1 << 4) | REG1) & glm::uint32(0x30C30C30C30C30C3);
- REG2 = ((REG2 << 4) | REG2) & glm::uint32(0x30C30C30C30C30C3);
- REG3 = ((REG3 << 4) | REG3) & glm::uint32(0x30C30C30C30C30C3);
+ REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint32>(0xC30C30C3u);
+ REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint32>(0xC30C30C3u);
+ REG3 = ((REG3 << 4) | REG3) & static_cast<glm::uint32>(0xC30C30C3u);
- REG1 = ((REG1 << 2) | REG1) & glm::uint32(0x9249249249249249);
- REG2 = ((REG2 << 2) | REG2) & glm::uint32(0x9249249249249249);
- REG3 = ((REG3 << 2) | REG3) & glm::uint32(0x9249249249249249);
+ REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint32>(0x49249249u);
+ REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint32>(0x49249249u);
+ REG3 = ((REG3 << 2) | REG3) & static_cast<glm::uint32>(0x49249249u);
return REG1 | (REG2 << 1) | (REG3 << 2);
}
-
- template <>
+
+ template<>
GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint16 x, glm::uint16 y, glm::uint16 z)
{
glm::uint64 REG1(x);
glm::uint64 REG2(y);
glm::uint64 REG3(z);
- REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFFull);
- REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFFull);
- REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFFull);
+ REG1 = ((REG1 << 32) | REG1) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
+ REG2 = ((REG2 << 32) | REG2) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
+ REG3 = ((REG3 << 32) | REG3) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
- REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FFull);
- REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FFull);
- REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FFull);
+ REG1 = ((REG1 << 16) | REG1) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
+ REG2 = ((REG2 << 16) | REG2) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
+ REG3 = ((REG3 << 16) | REG3) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
- REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00Full);
- REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00Full);
- REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00Full);
+ REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
+ REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
+ REG3 = ((REG3 << 8) | REG3) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
- REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3ull);
- REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3ull);
- REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3ull);
+ REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
+ REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
+ REG3 = ((REG3 << 4) | REG3) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
- REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249ull);
- REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249ull);
- REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249ull);
+ REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint64>(0x9249249249249249ull);
+ REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint64>(0x9249249249249249ull);
+ REG3 = ((REG3 << 2) | REG3) & static_cast<glm::uint64>(0x9249249249249249ull);
return REG1 | (REG2 << 1) | (REG3 << 2);
}
- template <>
+ template<>
GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y, glm::uint32 z)
{
glm::uint64 REG1(x);
glm::uint64 REG2(y);
glm::uint64 REG3(z);
- REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFFull);
- REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFFull);
- REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFFull);
+ REG1 = ((REG1 << 32) | REG1) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
+ REG2 = ((REG2 << 32) | REG2) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
+ REG3 = ((REG3 << 32) | REG3) & static_cast<glm::uint64>(0xFFFF00000000FFFFull);
- REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FFull);
- REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FFull);
- REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FFull);
+ REG1 = ((REG1 << 16) | REG1) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
+ REG2 = ((REG2 << 16) | REG2) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
+ REG3 = ((REG3 << 16) | REG3) & static_cast<glm::uint64>(0x00FF0000FF0000FFull);
- REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00Full);
- REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00Full);
- REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00Full);
+ REG1 = ((REG1 << 8) | REG1) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
+ REG2 = ((REG2 << 8) | REG2) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
+ REG3 = ((REG3 << 8) | REG3) & static_cast<glm::uint64>(0xF00F00F00F00F00Full);
- REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3ull);
- REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3ull);
- REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3ull);
+ REG1 = ((REG1 << 4) | REG1) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
+ REG2 = ((REG2 << 4) | REG2) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
+ REG3 = ((REG3 << 4) | REG3) & static_cast<glm::uint64>(0x30C30C30C30C30C3ull);
- REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249ull);
- REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249ull);
- REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249ull);
+ REG1 = ((REG1 << 2) | REG1) & static_cast<glm::uint64>(0x9249249249249249ull);
+ REG2 = ((REG2 << 2) | REG2) & static_cast<glm::uint64>(0x9249249249249249ull);
+ REG3 = ((REG3 << 2) | REG3) & static_cast<glm::uint64>(0x9249249249249249ull);
return REG1 | (REG2 << 1) | (REG3 << 2);
}
- template <>
+ template<>
GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint8 x, glm::uint8 y, glm::uint8 z, glm::uint8 w)
{
glm::uint32 REG1(x);
@@ -172,25 +172,25 @@ namespace detail
glm::uint32 REG3(z);
glm::uint32 REG4(w);
- REG1 = ((REG1 << 12) | REG1) & glm::uint32(0x000F000F000F000F);
- REG2 = ((REG2 << 12) | REG2) & glm::uint32(0x000F000F000F000F);
- REG3 = ((REG3 << 12) | REG3) & glm::uint32(0x000F000F000F000F);
- REG4 = ((REG4 << 12) | REG4) & glm::uint32(0x000F000F000F000F);
+ REG1 = ((REG1 << 12) | REG1) & static_cast<glm::uint32>(0x000F000Fu);
+ REG2 = ((REG2 << 12) | REG2) & static_cast<glm::uint32>(0x000F000Fu);
+ REG3 = ((REG3 << 12) | REG3) & static_cast<glm::uint32>(0x000F000Fu);
+ REG4 = ((REG4 << 12) | REG4) & static_cast<glm::uint32>(0x000F000Fu);
- REG1 = ((REG1 << 6) | REG1) & glm::uint32(0x0303030303030303);
- REG2 = ((REG2 << 6) | REG2) & glm::uint32(0x0303030303030303);
- REG3 = ((REG3 << 6) | REG3) & glm::uint32(0x0303030303030303);
- REG4 = ((REG4 << 6) | REG4) & glm::uint32(0x0303030303030303);
+ REG1 = ((REG1 << 6) | REG1) & static_cast<glm::uint32>(0x03030303u);
+ REG2 = ((REG2 << 6) | REG2) & static_cast<glm::uint32>(0x03030303u);
+ REG3 = ((REG3 << 6) | REG3) & static_cast<glm::uint32>(0x03030303u);
+ REG4 = ((REG4 << 6) | REG4) & static_cast<glm::uint32>(0x03030303u);
- REG1 = ((REG1 << 3) | REG1) & glm::uint32(0x1111111111111111);
- REG2 = ((REG2 << 3) | REG2) & glm::uint32(0x1111111111111111);
- REG3 = ((REG3 << 3) | REG3) & glm::uint32(0x1111111111111111);
- REG4 = ((REG4 << 3) | REG4) & glm::uint32(0x1111111111111111);
+ REG1 = ((REG1 << 3) | REG1) & static_cast<glm::uint32>(0x11111111u);
+ REG2 = ((REG2 << 3) | REG2) & static_cast<glm::uint32>(0x11111111u);
+ REG3 = ((REG3 << 3) | REG3) & static_cast<glm::uint32>(0x11111111u);
+ REG4 = ((REG4 << 3) | REG4) & static_cast<glm::uint32>(0x11111111u);
return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3);
}
- template <>
+ template<>
GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint16 x, glm::uint16 y, glm::uint16 z, glm::uint16 w)
{
glm::uint64 REG1(x);
@@ -198,31 +198,31 @@ namespace detail
glm::uint64 REG3(z);
glm::uint64 REG4(w);
- REG1 = ((REG1 << 24) | REG1) & glm::uint64(0x000000FF000000FFull);
- REG2 = ((REG2 << 24) | REG2) & glm::uint64(0x000000FF000000FFull);
- REG3 = ((REG3 << 24) | REG3) & glm::uint64(0x000000FF000000FFull);
- REG4 = ((REG4 << 24) | REG4) & glm::uint64(0x000000FF000000FFull);
+ REG1 = ((REG1 << 24) | REG1) & static_cast<glm::uint64>(0x000000FF000000FFull);
+ REG2 = ((REG2 << 24) | REG2) & static_cast<glm::uint64>(0x000000FF000000FFull);
+ REG3 = ((REG3 << 24) | REG3) & static_cast<glm::uint64>(0x000000FF000000FFull);
+ REG4 = ((REG4 << 24) | REG4) & static_cast<glm::uint64>(0x000000FF000000FFull);
- REG1 = ((REG1 << 12) | REG1) & glm::uint64(0x000F000F000F000Full);
- REG2 = ((REG2 << 12) | REG2) & glm::uint64(0x000F000F000F000Full);
- REG3 = ((REG3 << 12) | REG3) & glm::uint64(0x000F000F000F000Full);
- REG4 = ((REG4 << 12) | REG4) & glm::uint64(0x000F000F000F000Full);
+ REG1 = ((REG1 << 12) | REG1) & static_cast<glm::uint64>(0x000F000F000F000Full);
+ REG2 = ((REG2 << 12) | REG2) & static_cast<glm::uint64>(0x000F000F000F000Full);
+ REG3 = ((REG3 << 12) | REG3) & static_cast<glm::uint64>(0x000F000F000F000Full);
+ REG4 = ((REG4 << 12) | REG4) & static_cast<glm::uint64>(0x000F000F000F000Full);
- REG1 = ((REG1 << 6) | REG1) & glm::uint64(0x0303030303030303ull);
- REG2 = ((REG2 << 6) | REG2) & glm::uint64(0x0303030303030303ull);
- REG3 = ((REG3 << 6) | REG3) & glm::uint64(0x0303030303030303ull);
- REG4 = ((REG4 << 6) | REG4) & glm::uint64(0x0303030303030303ull);
+ REG1 = ((REG1 << 6) | REG1) & static_cast<glm::uint64>(0x0303030303030303ull);
+ REG2 = ((REG2 << 6) | REG2) & static_cast<glm::uint64>(0x0303030303030303ull);
+ REG3 = ((REG3 << 6) | REG3) & static_cast<glm::uint64>(0x0303030303030303ull);
+ REG4 = ((REG4 << 6) | REG4) & static_cast<glm::uint64>(0x0303030303030303ull);
- REG1 = ((REG1 << 3) | REG1) & glm::uint64(0x1111111111111111ull);
- REG2 = ((REG2 << 3) | REG2) & glm::uint64(0x1111111111111111ull);
- REG3 = ((REG3 << 3) | REG3) & glm::uint64(0x1111111111111111ull);
- REG4 = ((REG4 << 3) | REG4) & glm::uint64(0x1111111111111111ull);
+ REG1 = ((REG1 << 3) | REG1) & static_cast<glm::uint64>(0x1111111111111111ull);
+ REG2 = ((REG2 << 3) | REG2) & static_cast<glm::uint64>(0x1111111111111111ull);
+ REG3 = ((REG3 << 3) | REG3) & static_cast<glm::uint64>(0x1111111111111111ull);
+ REG4 = ((REG4 << 3) | REG4) & static_cast<glm::uint64>(0x1111111111111111ull);
return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3);
}
}//namespace detail
- template <typename genIUType>
+ template<typename genIUType>
GLM_FUNC_QUALIFIER genIUType mask(genIUType Bits)
{
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'mask' accepts only integer values");
@@ -230,15 +230,15 @@ namespace detail
return Bits >= sizeof(genIUType) * 8 ? ~static_cast<genIUType>(0) : (static_cast<genIUType>(1) << Bits) - static_cast<genIUType>(1);
}
- template <typename T, precision P, template <typename, precision> class vecIUType>
- GLM_FUNC_QUALIFIER vecIUType<T, P> mask(vecIUType<T, P> const& v)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> mask(vec<L, T, Q> const& v)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'mask' accepts only integer values");
- return detail::functor1<T, T, P, vecIUType>::call(mask, v);
+ return detail::functor1<L, T, T, Q>::call(mask, v);
}
- template <typename genIType>
+ template<typename genIType>
GLM_FUNC_QUALIFIER genIType bitfieldRotateRight(genIType In, int Shift)
{
GLM_STATIC_ASSERT(std::numeric_limits<genIType>::is_integer, "'bitfieldRotateRight' accepts only integer values");
@@ -247,8 +247,8 @@ namespace detail
return (In << static_cast<genIType>(Shift)) | (In >> static_cast<genIType>(BitSize - Shift));
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> bitfieldRotateRight(vecType<T, P> const & In, int Shift)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldRotateRight(vec<L, T, Q> const& In, int Shift)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldRotateRight' accepts only integer values");
@@ -256,7 +256,7 @@ namespace detail
return (In << static_cast<T>(Shift)) | (In >> static_cast<T>(BitSize - Shift));
}
- template <typename genIType>
+ template<typename genIType>
GLM_FUNC_QUALIFIER genIType bitfieldRotateLeft(genIType In, int Shift)
{
GLM_STATIC_ASSERT(std::numeric_limits<genIType>::is_integer, "'bitfieldRotateLeft' accepts only integer values");
@@ -265,8 +265,8 @@ namespace detail
return (In >> static_cast<genIType>(Shift)) | (In << static_cast<genIType>(BitSize - Shift));
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> bitfieldRotateLeft(vecType<T, P> const& In, int Shift)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldRotateLeft(vec<L, T, Q> const& In, int Shift)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldRotateLeft' accepts only integer values");
@@ -274,26 +274,26 @@ namespace detail
return (In >> static_cast<T>(Shift)) | (In << static_cast<T>(BitSize - Shift));
}
- template <typename genIUType>
+ template<typename genIUType>
GLM_FUNC_QUALIFIER genIUType bitfieldFillOne(genIUType Value, int FirstBit, int BitCount)
{
return Value | static_cast<genIUType>(mask(BitCount) << FirstBit);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> bitfieldFillOne(vecType<T, P> const& Value, int FirstBit, int BitCount)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldFillOne(vec<L, T, Q> const& Value, int FirstBit, int BitCount)
{
return Value | static_cast<T>(mask(BitCount) << FirstBit);
}
- template <typename genIUType>
+ template<typename genIUType>
GLM_FUNC_QUALIFIER genIUType bitfieldFillZero(genIUType Value, int FirstBit, int BitCount)
{
return Value & static_cast<genIUType>(~(mask(BitCount) << FirstBit));
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> bitfieldFillZero(vecType<T, P> const& Value, int FirstBit, int BitCount)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldFillZero(vec<L, T, Q> const& Value, int FirstBit, int BitCount)
{
return Value & static_cast<T>(~(mask(BitCount) << FirstBit));
}
diff --git a/external/include/glm/gtc/color_encoding.inl b/external/include/glm/gtc/color_encoding.inl
deleted file mode 100644
index 68570cb..0000000
--- a/external/include/glm/gtc/color_encoding.inl
+++ /dev/null
@@ -1,65 +0,0 @@
-/// @ref gtc_color_encoding
-/// @file glm/gtc/color_encoding.inl
-
-namespace glm
-{
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec3<T, P> convertLinearSRGBToD65XYZ(tvec3<T, P> const& ColorLinearSRGB)
- {
- tvec3<T, P> const M(0.490f, 0.17697f, 0.2f);
- tvec3<T, P> const N(0.31f, 0.8124f, 0.01063f);
- tvec3<T, P> const O(0.490f, 0.01f, 0.99f);
-
- return (M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB) * static_cast<T>(5.650675255693055f);
- }
-
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec3<T, P> convertD65XYZToLinearSRGB(tvec3<T, P> const& ColorD65XYZ)
- {
- tvec3<T, P> const M(0.41847f, -0.091169f, 0.0009209f);
- tvec3<T, P> const N(-0.15866f, 0.25243f, 0.015708f);
- tvec3<T, P> const O(0.0009209f, -0.0025498f, 0.1786f);
-
- return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ;
- }
-
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec3<T, P> convertLinearSRGBToD50XYZ(tvec3<T, P> const& ColorLinearSRGB)
- {
- tvec3<T, P> const M(0.436030342570117f, 0.222438466210245f, 0.013897440074263f);
- tvec3<T, P> const N(0.385101860087134f, 0.716942745571917f, 0.097076381494207f);
- tvec3<T, P> const O(0.143067806654203f, 0.060618777416563f, 0.713926257896652f);
-
- return M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB;
- }
-
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec3<T, P> convertD50XYZToLinearSRGB(tvec3<T, P> const& ColorD50XYZ)
- {
- tvec3<T, P> const M();
- tvec3<T, P> const N();
- tvec3<T, P> const O();
-
- return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ;
- }
-
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec3<T, P> convertD65XYZToD50XYZ(tvec3<T, P> const& ColorD65XYZ)
- {
- tvec3<T, P> const M(+1.047844353856414f, +0.029549007606644f, -0.009250984365223f);
- tvec3<T, P> const N(+0.022898981050086f, +0.990508028941971f, +0.015072338237051f);
- tvec3<T, P> const O(-0.050206647741605f, -0.017074711360960f, +0.751717835079977f);
-
- return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ;
- }
-
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec3<T, P> convertD50XYZToD65XYZ(tvec3<T, P> const& ColorD50XYZ)
- {
- tvec3<T, P> const M();
- tvec3<T, P> const N();
- tvec3<T, P> const O();
-
- return M * ColorD50XYZ + N * ColorD50XYZ + O * ColorD50XYZ;
- }
-}//namespace glm
diff --git a/external/include/glm/gtc/color_space.hpp b/external/include/glm/gtc/color_space.hpp
index 08ece8f..56cbc8f 100644
--- a/external/include/glm/gtc/color_space.hpp
+++ b/external/include/glm/gtc/color_space.hpp
@@ -7,15 +7,15 @@
/// @defgroup gtc_color_space GLM_GTC_color_space
/// @ingroup gtc
///
-/// @brief Allow to perform bit operations on integer values
+/// Include <glm/gtc/color_space.hpp> to use the features of this extension.
///
-/// <glm/gtc/color.hpp> need to be included to use these functionalities.
+/// Allow to perform bit operations on integer values
#pragma once
// Dependencies
#include "../detail/setup.hpp"
-#include "../detail/precision.hpp"
+#include "../detail/qualifier.hpp"
#include "../exponential.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
@@ -31,24 +31,24 @@ namespace glm
/// @{
/// Convert a linear color to sRGB color using a standard gamma correction.
- /// IEC 61966-2-1:1999 specification https://www.w3.org/Graphics/Color/srgb
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> convertLinearToSRGB(vecType<T, P> const & ColorLinear);
+ /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> convertLinearToSRGB(vec<L, T, Q> const& ColorLinear);
/// Convert a linear color to sRGB color using a custom gamma correction.
- /// IEC 61966-2-1:1999 specification https://www.w3.org/Graphics/Color/srgb
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> convertLinearToSRGB(vecType<T, P> const & ColorLinear, T Gamma);
+ /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> convertLinearToSRGB(vec<L, T, Q> const& ColorLinear, T Gamma);
/// Convert a sRGB color to linear color using a standard gamma correction.
- /// IEC 61966-2-1:1999 specification https://www.w3.org/Graphics/Color/srgb
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> convertSRGBToLinear(vecType<T, P> const & ColorSRGB);
+ /// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> convertSRGBToLinear(vec<L, T, Q> const& ColorSRGB);
/// Convert a sRGB color to linear color using a custom gamma correction.
- // IEC 61966-2-1:1999 specification https://www.w3.org/Graphics/Color/srgb
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> convertSRGBToLinear(vecType<T, P> const & ColorSRGB, T Gamma);
+ // IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> convertSRGBToLinear(vec<L, T, Q> const& ColorSRGB, T Gamma);
/// @}
} //namespace glm
diff --git a/external/include/glm/gtc/color_space.inl b/external/include/glm/gtc/color_space.inl
index c9a44ef..53241ac 100644
--- a/external/include/glm/gtc/color_space.inl
+++ b/external/include/glm/gtc/color_space.inl
@@ -4,72 +4,82 @@
namespace glm{
namespace detail
{
- template <typename T, precision P, template <typename, precision> class vecType>
+ template<length_t L, typename T, qualifier Q>
struct compute_rgbToSrgb
{
- GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const& ColorRGB, T GammaCorrection)
+ GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& ColorRGB, T GammaCorrection)
{
- vecType<T, P> const ClampedColor(clamp(ColorRGB, static_cast<T>(0), static_cast<T>(1)));
+ vec<L, T, Q> const ClampedColor(clamp(ColorRGB, static_cast<T>(0), static_cast<T>(1)));
return mix(
- pow(ClampedColor, vecType<T, P>(GammaCorrection)) * static_cast<T>(1.055) - static_cast<T>(0.055),
+ pow(ClampedColor, vec<L, T, Q>(GammaCorrection)) * static_cast<T>(1.055) - static_cast<T>(0.055),
ClampedColor * static_cast<T>(12.92),
- lessThan(ClampedColor, vecType<T, P>(static_cast<T>(0.0031308))));
+ lessThan(ClampedColor, vec<L, T, Q>(static_cast<T>(0.0031308))));
}
};
- template <typename T, precision P>
- struct compute_rgbToSrgb<T, P, tvec4>
+ template<typename T, qualifier Q>
+ struct compute_rgbToSrgb<4, T, Q>
{
- GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorRGB, T GammaCorrection)
+ GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& ColorRGB, T GammaCorrection)
{
- return tvec4<T, P>(compute_rgbToSrgb<T, P, tvec3>::call(tvec3<T, P>(ColorRGB), GammaCorrection), ColorRGB.w);
+ return vec<4, T, Q>(compute_rgbToSrgb<3, T, Q>::call(vec<3, T, Q>(ColorRGB), GammaCorrection), ColorRGB.w);
}
};
- template <typename T, precision P, template <typename, precision> class vecType>
+ template<length_t L, typename T, qualifier Q>
struct compute_srgbToRgb
{
- GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const& ColorSRGB, T Gamma)
+ GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& ColorSRGB, T Gamma)
{
return mix(
- pow((ColorSRGB + static_cast<T>(0.055)) * static_cast<T>(0.94786729857819905213270142180095), vecType<T, P>(Gamma)),
+ pow((ColorSRGB + static_cast<T>(0.055)) * static_cast<T>(0.94786729857819905213270142180095), vec<L, T, Q>(Gamma)),
ColorSRGB * static_cast<T>(0.07739938080495356037151702786378),
- lessThanEqual(ColorSRGB, vecType<T, P>(static_cast<T>(0.04045))));
+ lessThanEqual(ColorSRGB, vec<L, T, Q>(static_cast<T>(0.04045))));
}
};
- template <typename T, precision P>
- struct compute_srgbToRgb<T, P, tvec4>
+ template<typename T, qualifier Q>
+ struct compute_srgbToRgb<4, T, Q>
{
- GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorSRGB, T Gamma)
+ GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& ColorSRGB, T Gamma)
{
- return tvec4<T, P>(compute_srgbToRgb<T, P, tvec3>::call(tvec3<T, P>(ColorSRGB), Gamma), ColorSRGB.w);
+ return vec<4, T, Q>(compute_srgbToRgb<3, T, Q>::call(vec<3, T, Q>(ColorSRGB), Gamma), ColorSRGB.w);
}
};
}//namespace detail
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> convertLinearToSRGB(vecType<T, P> const& ColorLinear)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> convertLinearToSRGB(vec<L, T, Q> const& ColorLinear)
{
- return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorLinear, static_cast<T>(0.41666));
+ return detail::compute_rgbToSrgb<L, T, Q>::call(ColorLinear, static_cast<T>(0.41666));
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> convertLinearToSRGB(vecType<T, P> const& ColorLinear, T Gamma)
+ // Based on Ian Taylor http://chilliant.blogspot.fr/2012/08/srgb-approximations-for-hlsl.html
+ template<>
+ GLM_FUNC_QUALIFIER vec<3, float, lowp> convertLinearToSRGB(vec<3, float, lowp> const& ColorLinear)
{
- return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorLinear, static_cast<T>(1) / Gamma);
+ vec<3, float, lowp> S1 = sqrt(ColorLinear);
+ vec<3, float, lowp> S2 = sqrt(S1);
+ vec<3, float, lowp> S3 = sqrt(S2);
+ return 0.662002687f * S1 + 0.684122060f * S2 - 0.323583601f * S3 - 0.0225411470f * ColorLinear;
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> convertSRGBToLinear(vecType<T, P> const& ColorSRGB)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> convertLinearToSRGB(vec<L, T, Q> const& ColorLinear, T Gamma)
{
- return detail::compute_srgbToRgb<T, P, vecType>::call(ColorSRGB, static_cast<T>(2.4));
+ return detail::compute_rgbToSrgb<L, T, Q>::call(ColorLinear, static_cast<T>(1) / Gamma);
}
-
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> convertSRGBToLinear(vecType<T, P> const& ColorSRGB, T Gamma)
+
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> convertSRGBToLinear(vec<L, T, Q> const& ColorSRGB)
+ {
+ return detail::compute_srgbToRgb<L, T, Q>::call(ColorSRGB, static_cast<T>(2.4));
+ }
+
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> convertSRGBToLinear(vec<L, T, Q> const& ColorSRGB, T Gamma)
{
- return detail::compute_srgbToRgb<T, P, vecType>::call(ColorSRGB, Gamma);
+ return detail::compute_srgbToRgb<L, T, Q>::call(ColorSRGB, Gamma);
}
}//namespace glm
diff --git a/external/include/glm/gtc/constants.hpp b/external/include/glm/gtc/constants.hpp
index d3358c7..f55f619 100644
--- a/external/include/glm/gtc/constants.hpp
+++ b/external/include/glm/gtc/constants.hpp
@@ -2,14 +2,13 @@
/// @file glm/gtc/constants.hpp
///
/// @see core (dependence)
-/// @see gtc_half_float (dependence)
///
/// @defgroup gtc_constants GLM_GTC_constants
/// @ingroup gtc
-///
-/// @brief Provide a list of constants and precomputed useful values.
-///
-/// <glm/gtc/constants.hpp> need to be included to use these features.
+///
+/// Include <glm/gtc/constants.hpp> to use the features of this extension.
+///
+/// Provide a list of constants and precomputed useful values.
#pragma once
@@ -27,147 +26,147 @@ namespace glm
/// Return the epsilon constant for floating point types.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType epsilon();
/// Return 0.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType zero();
/// Return 1.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType one();
/// Return the pi constant.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType pi();
/// Return pi * 2.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType two_pi();
/// Return square root of pi.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType root_pi();
/// Return pi / 2.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType half_pi();
/// Return pi / 2 * 3.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType three_over_two_pi();
/// Return pi / 4.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType quarter_pi();
/// Return 1 / pi.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType one_over_pi();
/// Return 1 / (pi * 2).
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType one_over_two_pi();
/// Return 2 / pi.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType two_over_pi();
/// Return 4 / pi.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType four_over_pi();
/// Return 2 / sqrt(pi).
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType two_over_root_pi();
/// Return 1 / sqrt(2).
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType one_over_root_two();
/// Return sqrt(pi / 2).
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType root_half_pi();
/// Return sqrt(2 * pi).
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType root_two_pi();
/// Return sqrt(ln(4)).
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType root_ln_four();
/// Return e constant.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType e();
/// Return Euler's constant.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType euler();
/// Return sqrt(2).
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType root_two();
/// Return sqrt(3).
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType root_three();
/// Return sqrt(5).
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType root_five();
/// Return ln(2).
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType ln_two();
/// Return ln(10).
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType ln_ten();
/// Return ln(ln(2)).
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType ln_ln_two();
/// Return 1 / 3.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType third();
/// Return 2 / 3.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType two_thirds();
/// Return the golden ratio constant.
/// @see gtc_constants
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL GLM_CONSTEXPR genType golden_ratio();
/// @}
diff --git a/external/include/glm/gtc/constants.inl b/external/include/glm/gtc/constants.inl
index cb451d0..b1d277c 100644
--- a/external/include/glm/gtc/constants.inl
+++ b/external/include/glm/gtc/constants.inl
@@ -5,175 +5,175 @@
namespace glm
{
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType epsilon()
{
return std::numeric_limits<genType>::epsilon();
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType zero()
{
return genType(0);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one()
{
return genType(1);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType pi()
{
return genType(3.14159265358979323846264338327950288);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_pi()
{
return genType(6.28318530717958647692528676655900576);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_pi()
{
return genType(1.772453850905516027);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType half_pi()
{
return genType(1.57079632679489661923132169163975144);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType three_over_two_pi()
{
- return genType(4.71238898038468985769396507491925432);
+ return genType(4.71238898038468985769396507491925432);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType quarter_pi()
{
return genType(0.785398163397448309615660845819875721);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one_over_pi()
{
return genType(0.318309886183790671537767526745028724);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one_over_two_pi()
{
return genType(0.159154943091895335768883763372514362);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_over_pi()
{
return genType(0.636619772367581343075535053490057448);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType four_over_pi()
{
return genType(1.273239544735162686151070106980114898);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_over_root_pi()
{
return genType(1.12837916709551257389615890312154517);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType one_over_root_two()
{
return genType(0.707106781186547524400844362104849039);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_half_pi()
{
return genType(1.253314137315500251);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_two_pi()
{
return genType(2.506628274631000502);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_ln_four()
{
return genType(1.17741002251547469);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType e()
{
return genType(2.71828182845904523536);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType euler()
{
return genType(0.577215664901532860606);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_two()
{
return genType(1.41421356237309504880168872420969808);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_three()
{
return genType(1.73205080756887729352744634150587236);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType root_five()
{
return genType(2.23606797749978969640917366873127623);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_two()
{
return genType(0.693147180559945309417232121458176568);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_ten()
{
return genType(2.30258509299404568401799145468436421);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType ln_ln_two()
{
return genType(-0.3665129205816643);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType third()
{
return genType(0.3333333333333333333333333333333333333333);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType two_thirds()
{
return genType(0.666666666666666666666666666666666666667);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR genType golden_ratio()
{
return genType(1.61803398874989484820458683436563811);
diff --git a/external/include/glm/gtc/epsilon.hpp b/external/include/glm/gtc/epsilon.hpp
index 289f5b7..dce03ef 100644
--- a/external/include/glm/gtc/epsilon.hpp
+++ b/external/include/glm/gtc/epsilon.hpp
@@ -1,22 +1,21 @@
/// @ref gtc_epsilon
/// @file glm/gtc/epsilon.hpp
-///
+///
/// @see core (dependence)
-/// @see gtc_half_float (dependence)
/// @see gtc_quaternion (dependence)
///
/// @defgroup gtc_epsilon GLM_GTC_epsilon
/// @ingroup gtc
-///
-/// @brief Comparison functions for a user defined epsilon values.
-///
-/// <glm/gtc/epsilon.hpp> need to be included to use these functionalities.
+///
+/// Include <glm/gtc/epsilon.hpp> to use the features of this extension.
+///
+/// Comparison functions for a user defined epsilon values.
#pragma once
// Dependencies
#include "../detail/setup.hpp"
-#include "../detail/precision.hpp"
+#include "../detail/qualifier.hpp"
#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_GTC_epsilon extension included")
@@ -31,41 +30,29 @@ namespace glm
/// True if this expression is satisfied.
///
/// @see gtc_epsilon
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<bool, P> epsilonEqual(
- vecType<T, P> const & x,
- vecType<T, P> const & y,
- T const & epsilon);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, bool, Q> epsilonEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T const& epsilon);
/// Returns the component-wise comparison of |x - y| < epsilon.
/// True if this expression is satisfied.
///
/// @see gtc_epsilon
- template <typename genType>
- GLM_FUNC_DECL bool epsilonEqual(
- genType const & x,
- genType const & y,
- genType const & epsilon);
+ template<typename genType>
+ GLM_FUNC_DECL bool epsilonEqual(genType const& x, genType const& y, genType const& epsilon);
/// Returns the component-wise comparison of |x - y| < epsilon.
/// True if this expression is not satisfied.
///
/// @see gtc_epsilon
- template <typename genType>
- GLM_FUNC_DECL typename genType::boolType epsilonNotEqual(
- genType const & x,
- genType const & y,
- typename genType::value_type const & epsilon);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, bool, Q> epsilonNotEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T const& epsilon);
/// Returns the component-wise comparison of |x - y| >= epsilon.
/// True if this expression is not satisfied.
///
/// @see gtc_epsilon
- template <typename genType>
- GLM_FUNC_DECL bool epsilonNotEqual(
- genType const & x,
- genType const & y,
- genType const & epsilon);
+ template<typename genType>
+ GLM_FUNC_DECL bool epsilonNotEqual(genType const& x, genType const& y, genType const& epsilon);
/// @}
}//namespace glm
diff --git a/external/include/glm/gtc/epsilon.inl b/external/include/glm/gtc/epsilon.inl
index b5577d9..2478cab 100644
--- a/external/include/glm/gtc/epsilon.inl
+++ b/external/include/glm/gtc/epsilon.inl
@@ -5,121 +5,79 @@
#include "quaternion.hpp"
#include "../vector_relational.hpp"
#include "../common.hpp"
-#include "../vec2.hpp"
-#include "../vec3.hpp"
-#include "../vec4.hpp"
+#include "../detail/type_vec.hpp"
namespace glm
{
- template <>
+ template<>
GLM_FUNC_QUALIFIER bool epsilonEqual
(
- float const & x,
- float const & y,
- float const & epsilon
+ float const& x,
+ float const& y,
+ float const& epsilon
)
{
return abs(x - y) < epsilon;
}
- template <>
+ template<>
GLM_FUNC_QUALIFIER bool epsilonEqual
(
- double const & x,
- double const & y,
- double const & epsilon
+ double const& x,
+ double const& y,
+ double const& epsilon
)
{
return abs(x - y) < epsilon;
}
- template <>
- GLM_FUNC_QUALIFIER bool epsilonNotEqual
- (
- float const & x,
- float const & y,
- float const & epsilon
- )
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> epsilonEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T const& epsilon)
{
- return abs(x - y) >= epsilon;
+ return lessThan(abs(x - y), vec<L, T, Q>(epsilon));
}
- template <>
- GLM_FUNC_QUALIFIER bool epsilonNotEqual
- (
- double const & x,
- double const & y,
- double const & epsilon
- )
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> epsilonEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon)
{
- return abs(x - y) >= epsilon;
+ return lessThan(abs(x - y), vec<L, T, Q>(epsilon));
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<bool, P> epsilonEqual
- (
- vecType<T, P> const & x,
- vecType<T, P> const & y,
- T const & epsilon
- )
+ template<>
+ GLM_FUNC_QUALIFIER bool epsilonNotEqual(float const& x, float const& y, float const& epsilon)
{
- return lessThan(abs(x - y), vecType<T, P>(epsilon));
+ return abs(x - y) >= epsilon;
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<bool, P> epsilonEqual
- (
- vecType<T, P> const & x,
- vecType<T, P> const & y,
- vecType<T, P> const & epsilon
- )
+ template<>
+ GLM_FUNC_QUALIFIER bool epsilonNotEqual(double const& x, double const& y, double const& epsilon)
{
- return lessThan(abs(x - y), vecType<T, P>(epsilon));
+ return abs(x - y) >= epsilon;
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<bool, P> epsilonNotEqual
- (
- vecType<T, P> const & x,
- vecType<T, P> const & y,
- T const & epsilon
- )
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> epsilonNotEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T const& epsilon)
{
- return greaterThanEqual(abs(x - y), vecType<T, P>(epsilon));
+ return greaterThanEqual(abs(x - y), vec<L, T, Q>(epsilon));
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<bool, P> epsilonNotEqual
- (
- vecType<T, P> const & x,
- vecType<T, P> const & y,
- vecType<T, P> const & epsilon
- )
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> epsilonNotEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon)
{
- return greaterThanEqual(abs(x - y), vecType<T, P>(epsilon));
+ return greaterThanEqual(abs(x - y), vec<L, T, Q>(epsilon));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec4<bool, P> epsilonEqual
- (
- tquat<T, P> const & x,
- tquat<T, P> const & y,
- T const & epsilon
- )
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> epsilonEqual(tquat<T, Q> const& x, tquat<T, Q> const& y, T const& epsilon)
{
- tvec4<T, P> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
- return lessThan(abs(v), tvec4<T, P>(epsilon));
+ vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
+ return lessThan(abs(v), vec<4, T, Q>(epsilon));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec4<bool, P> epsilonNotEqual
- (
- tquat<T, P> const & x,
- tquat<T, P> const & y,
- T const & epsilon
- )
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> epsilonNotEqual(tquat<T, Q> const& x, tquat<T, Q> const& y, T const& epsilon)
{
- tvec4<T, P> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
- return greaterThanEqual(abs(v), tvec4<T, P>(epsilon));
+ vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
+ return greaterThanEqual(abs(v), vec<4, T, Q>(epsilon));
}
}//namespace glm
diff --git a/external/include/glm/gtc/functions.hpp b/external/include/glm/gtc/functions.hpp
deleted file mode 100644
index ab1590b..0000000
--- a/external/include/glm/gtc/functions.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/// @ref gtc_functions
-/// @file glm/gtc/functions.hpp
-///
-/// @see core (dependence)
-/// @see gtc_half_float (dependence)
-/// @see gtc_quaternion (dependence)
-///
-/// @defgroup gtc_functions GLM_GTC_functions
-/// @ingroup gtc
-///
-/// @brief List of useful common functions.
-///
-/// <glm/gtc/functions.hpp> need to be included to use these functionalities.
-
-#pragma once
-
-// Dependencies
-#include "../detail/setup.hpp"
-#include "../detail/precision.hpp"
-#include "../detail/type_vec2.hpp"
-
-#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
-# pragma message("GLM: GLM_GTC_functions extension included")
-#endif
-
-namespace glm
-{
- /// @addtogroup gtc_functions
- /// @{
-
- /// 1D gauss function
- ///
- /// @see gtc_epsilon
- template <typename T>
- GLM_FUNC_DECL T gauss(
- T x,
- T ExpectedValue,
- T StandardDeviation);
-
- /// 2D gauss function
- ///
- /// @see gtc_epsilon
- template <typename T, precision P>
- GLM_FUNC_DECL T gauss(
- tvec2<T, P> const& Coord,
- tvec2<T, P> const& ExpectedValue,
- tvec2<T, P> const& StandardDeviation);
-
- /// @}
-}//namespace glm
-
-#include "functions.inl"
-
diff --git a/external/include/glm/gtc/integer.hpp b/external/include/glm/gtc/integer.hpp
index 69ffb1d..1d28c32 100644
--- a/external/include/glm/gtc/integer.hpp
+++ b/external/include/glm/gtc/integer.hpp
@@ -7,18 +7,18 @@
/// @defgroup gtc_integer GLM_GTC_integer
/// @ingroup gtc
///
-/// @brief Allow to perform bit operations on integer values
+/// Include <glm/gtc/integer.hpp> to use the features of this extension.
///
-/// <glm/gtc/integer.hpp> need to be included to use these functionalities.
+/// @brief Allow to perform bit operations on integer values
#pragma once
// Dependencies
#include "../detail/setup.hpp"
-#include "../detail/precision.hpp"
-#include "../detail/func_common.hpp"
-#include "../detail/func_integer.hpp"
-#include "../detail/func_exponential.hpp"
+#include "../detail/qualifier.hpp"
+#include "../common.hpp"
+#include "../integer.hpp"
+#include "../exponential.hpp"
#include <limits>
#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
@@ -32,69 +32,32 @@ namespace glm
/// Returns the log2 of x for integer values. Can be reliably using to compute mipmap count from the texture size.
/// @see gtc_integer
- template <typename genIUType>
+ template<typename genIUType>
GLM_FUNC_DECL genIUType log2(genIUType x);
- /// Modulus. Returns x % y
- /// for each component in x using the floating point value y.
- ///
- /// @tparam genIUType Integer-point scalar or vector types.
- ///
- /// @see gtc_integer
- /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
- /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
- template <typename genIUType>
- GLM_FUNC_DECL genIUType mod(genIUType x, genIUType y);
-
- /// Modulus. Returns x % y
- /// for each component in x using the floating point value y.
- ///
- /// @tparam T Integer scalar types.
- /// @tparam vecType vector types.
- ///
- /// @see gtc_integer
- /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
- /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> mod(vecType<T, P> const & x, T y);
-
- /// Modulus. Returns x % y
- /// for each component in x using the floating point value y.
- ///
- /// @tparam T Integer scalar types.
- /// @tparam vecType vector types.
- ///
- /// @see gtc_integer
- /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
- /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> mod(vecType<T, P> const & x, vecType<T, P> const & y);
-
/// Returns a value equal to the nearest integer to x.
/// The fraction 0.5 will round in a direction chosen by the
/// implementation, presumably the direction that is fastest.
- ///
+ ///
/// @param x The values of the argument must be greater or equal to zero.
/// @tparam T floating point scalar types.
- /// @tparam vecType vector types.
- ///
+ ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
/// @see gtc_integer
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<int, P> iround(vecType<T, P> const & x);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, int, Q> iround(vec<L, T, Q> const& x);
/// Returns a value equal to the nearest integer to x.
/// The fraction 0.5 will round in a direction chosen by the
/// implementation, presumably the direction that is fastest.
- ///
+ ///
/// @param x The values of the argument must be greater or equal to zero.
/// @tparam T floating point scalar types.
- /// @tparam vecType vector types.
- ///
+ ///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
/// @see gtc_integer
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<uint, P> uround(vecType<T, P> const & x);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, uint, Q> uround(vec<L, T, Q> const& x);
/// @}
} //namespace glm
diff --git a/external/include/glm/gtc/integer.inl b/external/include/glm/gtc/integer.inl
index 7ce2918..9d4b618 100644
--- a/external/include/glm/gtc/integer.inl
+++ b/external/include/glm/gtc/integer.inl
@@ -4,36 +4,34 @@
namespace glm{
namespace detail
{
- template <typename T, precision P, template <typename, precision> class vecType, bool Aligned>
- struct compute_log2<T, P, vecType, false, Aligned>
+ template<length_t L, typename T, qualifier Q, bool Aligned>
+ struct compute_log2<L, T, Q, false, Aligned>
{
- GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & vec)
+ GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v)
{
//Equivalent to return findMSB(vec); but save one function call in ASM with VC
//return findMSB(vec);
- return vecType<T, P>(detail::compute_findMSB_vec<T, P, vecType, sizeof(T) * 8>::call(vec));
+ return vec<L, T, Q>(detail::compute_findMSB_vec<L, T, Q, sizeof(T) * 8>::call(v));
}
};
# if GLM_HAS_BITSCAN_WINDOWS
- template <precision P, bool Aligned>
- struct compute_log2<int, P, tvec4, false, Aligned>
+ template<qualifier Q, bool Aligned>
+ struct compute_log2<4, int, Q, false, Aligned>
{
- GLM_FUNC_QUALIFIER static tvec4<int, P> call(tvec4<int, P> const & vec)
+ GLM_FUNC_QUALIFIER static vec<4, int, Q> call(vec<4, int, Q> const& v)
{
- tvec4<int, P> Result(glm::uninitialize);
-
- _BitScanReverse(reinterpret_cast<unsigned long*>(&Result.x), vec.x);
- _BitScanReverse(reinterpret_cast<unsigned long*>(&Result.y), vec.y);
- _BitScanReverse(reinterpret_cast<unsigned long*>(&Result.z), vec.z);
- _BitScanReverse(reinterpret_cast<unsigned long*>(&Result.w), vec.w);
-
+ vec<4, int, Q> Result;
+ _BitScanReverse(reinterpret_cast<unsigned long*>(&Result.x), v.x);
+ _BitScanReverse(reinterpret_cast<unsigned long*>(&Result.y), v.y);
+ _BitScanReverse(reinterpret_cast<unsigned long*>(&Result.z), v.z);
+ _BitScanReverse(reinterpret_cast<unsigned long*>(&Result.w), v.w);
return Result;
}
};
# endif//GLM_HAS_BITSCAN_WINDOWS
}//namespace detail
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER int iround(genType x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'iround' only accept floating-point inputs");
@@ -42,16 +40,16 @@ namespace detail
return static_cast<int>(x + static_cast<genType>(0.5));
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<int, P> iround(vecType<T, P> const& x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, int, Q> iround(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'iround' only accept floating-point inputs");
- assert(all(lessThanEqual(vecType<T, P>(0), x)));
+ assert(all(lessThanEqual(vec<L, T, Q>(0), x)));
- return vecType<int, P>(x + static_cast<T>(0.5));
+ return vec<L, int, Q>(x + static_cast<T>(0.5));
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER uint uround(genType x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'uround' only accept floating-point inputs");
@@ -60,12 +58,12 @@ namespace detail
return static_cast<uint>(x + static_cast<genType>(0.5));
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<uint, P> uround(vecType<T, P> const& x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, uint, Q> uround(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'uround' only accept floating-point inputs");
- assert(all(lessThanEqual(vecType<T, P>(0), x)));
+ assert(all(lessThanEqual(vec<L, T, Q>(0), x)));
- return vecType<uint, P>(x + static_cast<T>(0.5));
+ return vec<L, uint, Q>(x + static_cast<T>(0.5));
}
}//namespace glm
diff --git a/external/include/glm/gtc/matrix_access.hpp b/external/include/glm/gtc/matrix_access.hpp
index e4156ef..3a67cff 100644
--- a/external/include/glm/gtc/matrix_access.hpp
+++ b/external/include/glm/gtc/matrix_access.hpp
@@ -5,9 +5,10 @@
///
/// @defgroup gtc_matrix_access GLM_GTC_matrix_access
/// @ingroup gtc
-///
+///
+/// Include <glm/gtc/matrix_access.hpp> to use the features of this extension.
+///
/// Defines functions to access rows or columns of a matrix easily.
-/// <glm/gtc/matrix_access.hpp> need to be included to use these functionalities.
#pragma once
@@ -25,33 +26,33 @@ namespace glm
/// Get a specific row of a matrix.
/// @see gtc_matrix_access
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL typename genType::row_type row(
- genType const & m,
+ genType const& m,
length_t index);
/// Set a specific row to a matrix.
/// @see gtc_matrix_access
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType row(
- genType const & m,
+ genType const& m,
length_t index,
- typename genType::row_type const & x);
+ typename genType::row_type const& x);
/// Get a specific column of a matrix.
/// @see gtc_matrix_access
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL typename genType::col_type column(
- genType const & m,
+ genType const& m,
length_t index);
/// Set a specific column to a matrix.
/// @see gtc_matrix_access
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType column(
- genType const & m,
+ genType const& m,
length_t index,
- typename genType::col_type const & x);
+ typename genType::col_type const& x);
/// @}
}//namespace glm
diff --git a/external/include/glm/gtc/matrix_access.inl b/external/include/glm/gtc/matrix_access.inl
index 831b940..176136a 100644
--- a/external/include/glm/gtc/matrix_access.inl
+++ b/external/include/glm/gtc/matrix_access.inl
@@ -3,12 +3,12 @@
namespace glm
{
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType row
(
- genType const & m,
+ genType const& m,
length_t index,
- typename genType::row_type const & x
+ typename genType::row_type const& x
)
{
assert(index >= 0 && index < m[0].length());
@@ -19,27 +19,27 @@ namespace glm
return Result;
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER typename genType::row_type row
(
- genType const & m,
+ genType const& m,
length_t index
)
{
assert(index >= 0 && index < m[0].length());
- typename genType::row_type Result;
+ typename genType::row_type Result(0);
for(length_t i = 0; i < m.length(); ++i)
Result[i] = m[i][index];
return Result;
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType column
(
- genType const & m,
+ genType const& m,
length_t index,
- typename genType::col_type const & x
+ typename genType::col_type const& x
)
{
assert(index >= 0 && index < m.length());
@@ -49,10 +49,10 @@ namespace glm
return Result;
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER typename genType::col_type column
(
- genType const & m,
+ genType const& m,
length_t index
)
{
diff --git a/external/include/glm/gtc/matrix_integer.hpp b/external/include/glm/gtc/matrix_integer.hpp
index fdc816d..59aec12 100644
--- a/external/include/glm/gtc/matrix_integer.hpp
+++ b/external/include/glm/gtc/matrix_integer.hpp
@@ -6,8 +6,9 @@
/// @defgroup gtc_matrix_integer GLM_GTC_matrix_integer
/// @ingroup gtc
///
+/// Include <glm/gtc/matrix_integer.hpp> to use the features of this extension.
+///
/// Defines a number of matrices with integer types.
-/// <glm/gtc/matrix_integer.hpp> need to be included to use these functionalities.
#pragma once
@@ -31,302 +32,302 @@ namespace glm
/// @addtogroup gtc_matrix_integer
/// @{
- /// High-precision signed integer 2x2 matrix.
+ /// High-qualifier signed integer 2x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x2<int, highp> highp_imat2;
+ typedef mat<2, 2, int, highp> highp_imat2;
- /// High-precision signed integer 3x3 matrix.
+ /// High-qualifier signed integer 3x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x3<int, highp> highp_imat3;
+ typedef mat<3, 3, int, highp> highp_imat3;
- /// High-precision signed integer 4x4 matrix.
+ /// High-qualifier signed integer 4x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x4<int, highp> highp_imat4;
+ typedef mat<4, 4, int, highp> highp_imat4;
- /// High-precision signed integer 2x2 matrix.
+ /// High-qualifier signed integer 2x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x2<int, highp> highp_imat2x2;
+ typedef mat<2, 2, int, highp> highp_imat2x2;
- /// High-precision signed integer 2x3 matrix.
+ /// High-qualifier signed integer 2x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x3<int, highp> highp_imat2x3;
+ typedef mat<2, 3, int, highp> highp_imat2x3;
- /// High-precision signed integer 2x4 matrix.
+ /// High-qualifier signed integer 2x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x4<int, highp> highp_imat2x4;
+ typedef mat<2, 4, int, highp> highp_imat2x4;
- /// High-precision signed integer 3x2 matrix.
+ /// High-qualifier signed integer 3x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x2<int, highp> highp_imat3x2;
+ typedef mat<3, 2, int, highp> highp_imat3x2;
- /// High-precision signed integer 3x3 matrix.
+ /// High-qualifier signed integer 3x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x3<int, highp> highp_imat3x3;
+ typedef mat<3, 3, int, highp> highp_imat3x3;
- /// High-precision signed integer 3x4 matrix.
+ /// High-qualifier signed integer 3x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x4<int, highp> highp_imat3x4;
+ typedef mat<3, 4, int, highp> highp_imat3x4;
- /// High-precision signed integer 4x2 matrix.
+ /// High-qualifier signed integer 4x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x2<int, highp> highp_imat4x2;
+ typedef mat<4, 2, int, highp> highp_imat4x2;
- /// High-precision signed integer 4x3 matrix.
+ /// High-qualifier signed integer 4x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x3<int, highp> highp_imat4x3;
+ typedef mat<4, 3, int, highp> highp_imat4x3;
- /// High-precision signed integer 4x4 matrix.
+ /// High-qualifier signed integer 4x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x4<int, highp> highp_imat4x4;
+ typedef mat<4, 4, int, highp> highp_imat4x4;
- /// Medium-precision signed integer 2x2 matrix.
+ /// Medium-qualifier signed integer 2x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x2<int, mediump> mediump_imat2;
+ typedef mat<2, 2, int, mediump> mediump_imat2;
- /// Medium-precision signed integer 3x3 matrix.
+ /// Medium-qualifier signed integer 3x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x3<int, mediump> mediump_imat3;
+ typedef mat<3, 3, int, mediump> mediump_imat3;
- /// Medium-precision signed integer 4x4 matrix.
+ /// Medium-qualifier signed integer 4x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x4<int, mediump> mediump_imat4;
+ typedef mat<4, 4, int, mediump> mediump_imat4;
- /// Medium-precision signed integer 2x2 matrix.
+ /// Medium-qualifier signed integer 2x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x2<int, mediump> mediump_imat2x2;
+ typedef mat<2, 2, int, mediump> mediump_imat2x2;
- /// Medium-precision signed integer 2x3 matrix.
+ /// Medium-qualifier signed integer 2x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x3<int, mediump> mediump_imat2x3;
+ typedef mat<2, 3, int, mediump> mediump_imat2x3;
- /// Medium-precision signed integer 2x4 matrix.
+ /// Medium-qualifier signed integer 2x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x4<int, mediump> mediump_imat2x4;
+ typedef mat<2, 4, int, mediump> mediump_imat2x4;
- /// Medium-precision signed integer 3x2 matrix.
+ /// Medium-qualifier signed integer 3x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x2<int, mediump> mediump_imat3x2;
+ typedef mat<3, 2, int, mediump> mediump_imat3x2;
- /// Medium-precision signed integer 3x3 matrix.
+ /// Medium-qualifier signed integer 3x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x3<int, mediump> mediump_imat3x3;
+ typedef mat<3, 3, int, mediump> mediump_imat3x3;
- /// Medium-precision signed integer 3x4 matrix.
+ /// Medium-qualifier signed integer 3x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x4<int, mediump> mediump_imat3x4;
+ typedef mat<3, 4, int, mediump> mediump_imat3x4;
- /// Medium-precision signed integer 4x2 matrix.
+ /// Medium-qualifier signed integer 4x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x2<int, mediump> mediump_imat4x2;
+ typedef mat<4, 2, int, mediump> mediump_imat4x2;
- /// Medium-precision signed integer 4x3 matrix.
+ /// Medium-qualifier signed integer 4x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x3<int, mediump> mediump_imat4x3;
+ typedef mat<4, 3, int, mediump> mediump_imat4x3;
- /// Medium-precision signed integer 4x4 matrix.
+ /// Medium-qualifier signed integer 4x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x4<int, mediump> mediump_imat4x4;
+ typedef mat<4, 4, int, mediump> mediump_imat4x4;
- /// Low-precision signed integer 2x2 matrix.
+ /// Low-qualifier signed integer 2x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x2<int, lowp> lowp_imat2;
-
- /// Low-precision signed integer 3x3 matrix.
+ typedef mat<2, 2, int, lowp> lowp_imat2;
+
+ /// Low-qualifier signed integer 3x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x3<int, lowp> lowp_imat3;
+ typedef mat<3, 3, int, lowp> lowp_imat3;
- /// Low-precision signed integer 4x4 matrix.
+ /// Low-qualifier signed integer 4x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x4<int, lowp> lowp_imat4;
+ typedef mat<4, 4, int, lowp> lowp_imat4;
- /// Low-precision signed integer 2x2 matrix.
+ /// Low-qualifier signed integer 2x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x2<int, lowp> lowp_imat2x2;
+ typedef mat<2, 2, int, lowp> lowp_imat2x2;
- /// Low-precision signed integer 2x3 matrix.
+ /// Low-qualifier signed integer 2x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x3<int, lowp> lowp_imat2x3;
+ typedef mat<2, 3, int, lowp> lowp_imat2x3;
- /// Low-precision signed integer 2x4 matrix.
+ /// Low-qualifier signed integer 2x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x4<int, lowp> lowp_imat2x4;
+ typedef mat<2, 4, int, lowp> lowp_imat2x4;
- /// Low-precision signed integer 3x2 matrix.
+ /// Low-qualifier signed integer 3x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x2<int, lowp> lowp_imat3x2;
+ typedef mat<3, 2, int, lowp> lowp_imat3x2;
- /// Low-precision signed integer 3x3 matrix.
+ /// Low-qualifier signed integer 3x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x3<int, lowp> lowp_imat3x3;
+ typedef mat<3, 3, int, lowp> lowp_imat3x3;
- /// Low-precision signed integer 3x4 matrix.
+ /// Low-qualifier signed integer 3x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x4<int, lowp> lowp_imat3x4;
+ typedef mat<3, 4, int, lowp> lowp_imat3x4;
- /// Low-precision signed integer 4x2 matrix.
+ /// Low-qualifier signed integer 4x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x2<int, lowp> lowp_imat4x2;
+ typedef mat<4, 2, int, lowp> lowp_imat4x2;
- /// Low-precision signed integer 4x3 matrix.
+ /// Low-qualifier signed integer 4x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x3<int, lowp> lowp_imat4x3;
+ typedef mat<4, 3, int, lowp> lowp_imat4x3;
- /// Low-precision signed integer 4x4 matrix.
+ /// Low-qualifier signed integer 4x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x4<int, lowp> lowp_imat4x4;
+ typedef mat<4, 4, int, lowp> lowp_imat4x4;
- /// High-precision unsigned integer 2x2 matrix.
+ /// High-qualifier unsigned integer 2x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x2<uint, highp> highp_umat2;
+ typedef mat<2, 2, uint, highp> highp_umat2;
- /// High-precision unsigned integer 3x3 matrix.
+ /// High-qualifier unsigned integer 3x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x3<uint, highp> highp_umat3;
+ typedef mat<3, 3, uint, highp> highp_umat3;
- /// High-precision unsigned integer 4x4 matrix.
+ /// High-qualifier unsigned integer 4x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x4<uint, highp> highp_umat4;
+ typedef mat<4, 4, uint, highp> highp_umat4;
- /// High-precision unsigned integer 2x2 matrix.
+ /// High-qualifier unsigned integer 2x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x2<uint, highp> highp_umat2x2;
+ typedef mat<2, 2, uint, highp> highp_umat2x2;
- /// High-precision unsigned integer 2x3 matrix.
+ /// High-qualifier unsigned integer 2x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x3<uint, highp> highp_umat2x3;
+ typedef mat<2, 3, uint, highp> highp_umat2x3;
- /// High-precision unsigned integer 2x4 matrix.
+ /// High-qualifier unsigned integer 2x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x4<uint, highp> highp_umat2x4;
+ typedef mat<2, 4, uint, highp> highp_umat2x4;
- /// High-precision unsigned integer 3x2 matrix.
+ /// High-qualifier unsigned integer 3x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x2<uint, highp> highp_umat3x2;
+ typedef mat<3, 2, uint, highp> highp_umat3x2;
- /// High-precision unsigned integer 3x3 matrix.
+ /// High-qualifier unsigned integer 3x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x3<uint, highp> highp_umat3x3;
+ typedef mat<3, 3, uint, highp> highp_umat3x3;
- /// High-precision unsigned integer 3x4 matrix.
+ /// High-qualifier unsigned integer 3x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x4<uint, highp> highp_umat3x4;
+ typedef mat<3, 4, uint, highp> highp_umat3x4;
- /// High-precision unsigned integer 4x2 matrix.
+ /// High-qualifier unsigned integer 4x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x2<uint, highp> highp_umat4x2;
+ typedef mat<4, 2, uint, highp> highp_umat4x2;
- /// High-precision unsigned integer 4x3 matrix.
+ /// High-qualifier unsigned integer 4x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x3<uint, highp> highp_umat4x3;
+ typedef mat<4, 3, uint, highp> highp_umat4x3;
- /// High-precision unsigned integer 4x4 matrix.
+ /// High-qualifier unsigned integer 4x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x4<uint, highp> highp_umat4x4;
+ typedef mat<4, 4, uint, highp> highp_umat4x4;
- /// Medium-precision unsigned integer 2x2 matrix.
+ /// Medium-qualifier unsigned integer 2x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x2<uint, mediump> mediump_umat2;
+ typedef mat<2, 2, uint, mediump> mediump_umat2;
- /// Medium-precision unsigned integer 3x3 matrix.
+ /// Medium-qualifier unsigned integer 3x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x3<uint, mediump> mediump_umat3;
+ typedef mat<3, 3, uint, mediump> mediump_umat3;
- /// Medium-precision unsigned integer 4x4 matrix.
+ /// Medium-qualifier unsigned integer 4x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x4<uint, mediump> mediump_umat4;
+ typedef mat<4, 4, uint, mediump> mediump_umat4;
- /// Medium-precision unsigned integer 2x2 matrix.
+ /// Medium-qualifier unsigned integer 2x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x2<uint, mediump> mediump_umat2x2;
+ typedef mat<2, 2, uint, mediump> mediump_umat2x2;
- /// Medium-precision unsigned integer 2x3 matrix.
+ /// Medium-qualifier unsigned integer 2x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x3<uint, mediump> mediump_umat2x3;
+ typedef mat<2, 3, uint, mediump> mediump_umat2x3;
- /// Medium-precision unsigned integer 2x4 matrix.
+ /// Medium-qualifier unsigned integer 2x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x4<uint, mediump> mediump_umat2x4;
+ typedef mat<2, 4, uint, mediump> mediump_umat2x4;
- /// Medium-precision unsigned integer 3x2 matrix.
+ /// Medium-qualifier unsigned integer 3x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x2<uint, mediump> mediump_umat3x2;
+ typedef mat<3, 2, uint, mediump> mediump_umat3x2;
- /// Medium-precision unsigned integer 3x3 matrix.
+ /// Medium-qualifier unsigned integer 3x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x3<uint, mediump> mediump_umat3x3;
+ typedef mat<3, 3, uint, mediump> mediump_umat3x3;
- /// Medium-precision unsigned integer 3x4 matrix.
+ /// Medium-qualifier unsigned integer 3x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x4<uint, mediump> mediump_umat3x4;
+ typedef mat<3, 4, uint, mediump> mediump_umat3x4;
- /// Medium-precision unsigned integer 4x2 matrix.
+ /// Medium-qualifier unsigned integer 4x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x2<uint, mediump> mediump_umat4x2;
+ typedef mat<4, 2, uint, mediump> mediump_umat4x2;
- /// Medium-precision unsigned integer 4x3 matrix.
+ /// Medium-qualifier unsigned integer 4x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x3<uint, mediump> mediump_umat4x3;
+ typedef mat<4, 3, uint, mediump> mediump_umat4x3;
- /// Medium-precision unsigned integer 4x4 matrix.
+ /// Medium-qualifier unsigned integer 4x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x4<uint, mediump> mediump_umat4x4;
+ typedef mat<4, 4, uint, mediump> mediump_umat4x4;
- /// Low-precision unsigned integer 2x2 matrix.
+ /// Low-qualifier unsigned integer 2x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x2<uint, lowp> lowp_umat2;
-
- /// Low-precision unsigned integer 3x3 matrix.
+ typedef mat<2, 2, uint, lowp> lowp_umat2;
+
+ /// Low-qualifier unsigned integer 3x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x3<uint, lowp> lowp_umat3;
+ typedef mat<3, 3, uint, lowp> lowp_umat3;
- /// Low-precision unsigned integer 4x4 matrix.
+ /// Low-qualifier unsigned integer 4x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x4<uint, lowp> lowp_umat4;
+ typedef mat<4, 4, uint, lowp> lowp_umat4;
- /// Low-precision unsigned integer 2x2 matrix.
+ /// Low-qualifier unsigned integer 2x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x2<uint, lowp> lowp_umat2x2;
+ typedef mat<2, 2, uint, lowp> lowp_umat2x2;
- /// Low-precision unsigned integer 2x3 matrix.
+ /// Low-qualifier unsigned integer 2x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x3<uint, lowp> lowp_umat2x3;
+ typedef mat<2, 3, uint, lowp> lowp_umat2x3;
- /// Low-precision unsigned integer 2x4 matrix.
+ /// Low-qualifier unsigned integer 2x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat2x4<uint, lowp> lowp_umat2x4;
+ typedef mat<2, 4, uint, lowp> lowp_umat2x4;
- /// Low-precision unsigned integer 3x2 matrix.
+ /// Low-qualifier unsigned integer 3x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x2<uint, lowp> lowp_umat3x2;
+ typedef mat<3, 2, uint, lowp> lowp_umat3x2;
- /// Low-precision unsigned integer 3x3 matrix.
+ /// Low-qualifier unsigned integer 3x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x3<uint, lowp> lowp_umat3x3;
+ typedef mat<3, 3, uint, lowp> lowp_umat3x3;
- /// Low-precision unsigned integer 3x4 matrix.
+ /// Low-qualifier unsigned integer 3x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat3x4<uint, lowp> lowp_umat3x4;
+ typedef mat<3, 4, uint, lowp> lowp_umat3x4;
- /// Low-precision unsigned integer 4x2 matrix.
+ /// Low-qualifier unsigned integer 4x2 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x2<uint, lowp> lowp_umat4x2;
+ typedef mat<4, 2, uint, lowp> lowp_umat4x2;
- /// Low-precision unsigned integer 4x3 matrix.
+ /// Low-qualifier unsigned integer 4x3 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x3<uint, lowp> lowp_umat4x3;
+ typedef mat<4, 3, uint, lowp> lowp_umat4x3;
- /// Low-precision unsigned integer 4x4 matrix.
+ /// Low-qualifier unsigned integer 4x4 matrix.
/// @see gtc_matrix_integer
- typedef tmat4x4<uint, lowp> lowp_umat4x4;
+ typedef mat<4, 4, uint, lowp> lowp_umat4x4;
#if(defined(GLM_PRECISION_HIGHP_INT))
typedef highp_imat2 imat2;
@@ -432,7 +433,7 @@ namespace glm
typedef lowp_umat4x3 umat4x3;
typedef lowp_umat4x4 umat4x4;
#else //if(defined(GLM_PRECISION_MEDIUMP_UINT))
-
+
/// Unsigned integer 2x2 matrix.
/// @see gtc_matrix_integer
typedef mediump_umat2 umat2;
diff --git a/external/include/glm/gtc/matrix_inverse.hpp b/external/include/glm/gtc/matrix_inverse.hpp
index 589381d..97e8d89 100644
--- a/external/include/glm/gtc/matrix_inverse.hpp
+++ b/external/include/glm/gtc/matrix_inverse.hpp
@@ -6,8 +6,9 @@
/// @defgroup gtc_matrix_inverse GLM_GTC_matrix_inverse
/// @ingroup gtc
///
+/// Include <glm/gtc/matrix_integer.hpp> to use the features of this extension.
+///
/// Defines additional matrix inverting functions.
-/// <glm/gtc/matrix_inverse.hpp> need to be included to use these functionalities.
#pragma once
@@ -28,20 +29,20 @@ namespace glm
/// @{
/// Fast matrix inverse for affine matrix.
- ///
+ ///
/// @param m Input matrix to invert.
- /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate.
+ /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-qualifier floating point value is highly innacurate.
/// @see gtc_matrix_inverse
- template <typename genType>
- GLM_FUNC_DECL genType affineInverse(genType const & m);
+ template<typename genType>
+ GLM_FUNC_DECL genType affineInverse(genType const& m);
/// Compute the inverse transpose of a matrix.
- ///
+ ///
/// @param m Input matrix to invert transpose.
- /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-precision floating point value is highly innacurate.
+ /// @tparam genType Squared floating-point matrix: half, float or double. Inverse of matrix based of half-qualifier floating point value is highly innacurate.
/// @see gtc_matrix_inverse
- template <typename genType>
- GLM_FUNC_DECL genType inverseTranspose(genType const & m);
+ template<typename genType>
+ GLM_FUNC_DECL genType inverseTranspose(genType const& m);
/// @}
}//namespace glm
diff --git a/external/include/glm/gtc/matrix_inverse.inl b/external/include/glm/gtc/matrix_inverse.inl
index 36c9bf7..592e690 100644
--- a/external/include/glm/gtc/matrix_inverse.inl
+++ b/external/include/glm/gtc/matrix_inverse.inl
@@ -3,35 +3,35 @@
namespace glm
{
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat3x3<T, P> affineInverse(tmat3x3<T, P> const & m)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<3, 3, T, Q> affineInverse(mat<3, 3, T, Q> const& m)
{
- tmat2x2<T, P> const Inv(inverse(tmat2x2<T, P>(m)));
+ mat<2, 2, T, Q> const Inv(inverse(mat<2, 2, T, Q>(m)));
- return tmat3x3<T, P>(
- tvec3<T, P>(Inv[0], static_cast<T>(0)),
- tvec3<T, P>(Inv[1], static_cast<T>(0)),
- tvec3<T, P>(-Inv * tvec2<T, P>(m[2]), static_cast<T>(1)));
+ return mat<3, 3, T, Q>(
+ vec<3, T, Q>(Inv[0], static_cast<T>(0)),
+ vec<3, T, Q>(Inv[1], static_cast<T>(0)),
+ vec<3, T, Q>(-Inv * vec<2, T, Q>(m[2]), static_cast<T>(1)));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat4x4<T, P> affineInverse(tmat4x4<T, P> const & m)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> affineInverse(mat<4, 4, T, Q> const& m)
{
- tmat3x3<T, P> const Inv(inverse(tmat3x3<T, P>(m)));
+ mat<3, 3, T, Q> const Inv(inverse(mat<3, 3, T, Q>(m)));
- return tmat4x4<T, P>(
- tvec4<T, P>(Inv[0], static_cast<T>(0)),
- tvec4<T, P>(Inv[1], static_cast<T>(0)),
- tvec4<T, P>(Inv[2], static_cast<T>(0)),
- tvec4<T, P>(-Inv * tvec3<T, P>(m[3]), static_cast<T>(1)));
+ return mat<4, 4, T, Q>(
+ vec<4, T, Q>(Inv[0], static_cast<T>(0)),
+ vec<4, T, Q>(Inv[1], static_cast<T>(0)),
+ vec<4, T, Q>(Inv[2], static_cast<T>(0)),
+ vec<4, T, Q>(-Inv * vec<3, T, Q>(m[3]), static_cast<T>(1)));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat2x2<T, P> inverseTranspose(tmat2x2<T, P> const & m)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<2, 2, T, Q> inverseTranspose(mat<2, 2, T, Q> const& m)
{
T Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1];
- tmat2x2<T, P> Inverse(
+ mat<2, 2, T, Q> Inverse(
+ m[1][1] / Determinant,
- m[0][1] / Determinant,
- m[1][0] / Determinant,
@@ -40,15 +40,15 @@ namespace glm
return Inverse;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat3x3<T, P> inverseTranspose(tmat3x3<T, P> const & m)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<3, 3, T, Q> inverseTranspose(mat<3, 3, T, Q> const& m)
{
T Determinant =
+ m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1])
- m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0])
+ m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]);
- tmat3x3<T, P> Inverse(uninitialize);
+ mat<3, 3, T, Q> Inverse;
Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]);
Inverse[0][1] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]);
Inverse[0][2] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]);
@@ -63,8 +63,8 @@ namespace glm
return Inverse;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat4x4<T, P> inverseTranspose(tmat4x4<T, P> const & m)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> inverseTranspose(mat<4, 4, T, Q> const& m)
{
T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
@@ -86,7 +86,7 @@ namespace glm
T SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];
T SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];
- tmat4x4<T, P> Inverse(uninitialize);
+ mat<4, 4, T, Q> Inverse;
Inverse[0][0] = + (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02);
Inverse[0][1] = - (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04);
Inverse[0][2] = + (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05);
diff --git a/external/include/glm/gtc/matrix_transform.hpp b/external/include/glm/gtc/matrix_transform.hpp
index c97b89a..a9d5cd0 100644
--- a/external/include/glm/gtc/matrix_transform.hpp
+++ b/external/include/glm/gtc/matrix_transform.hpp
@@ -4,19 +4,19 @@
/// @see core (dependence)
/// @see gtx_transform
/// @see gtx_transform2
-///
+///
/// @defgroup gtc_matrix_transform GLM_GTC_matrix_transform
/// @ingroup gtc
///
-/// @brief Defines functions that generate common transformation matrices.
+/// Include <glm/gtc/matrix_transform.hpp> to use the features of this extension.
+///
+/// Defines functions that generate common transformation matrices.
///
/// The matrices generated by this extension use standard OpenGL fixed-function
/// conventions. For example, the lookAt function generates a transform from world
-/// space into the specific eye space that the projective matrix functions
+/// space into the specific eye space that the projective matrix functions
/// (perspective, ortho, etc) are designed to expect. The OpenGL compatibility
/// specifications defines the particular layout of this eye space.
-///
-/// <glm/gtc/matrix_transform.hpp> need to be included to use these functionalities.
#pragma once
@@ -37,10 +37,10 @@ namespace glm
/// @{
/// Builds a translation 4 * 4 matrix created from a vector of 3 components.
- ///
+ ///
/// @param m Input matrix multiplied by this translation matrix.
/// @param v Coordinates of a translation vector.
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
/// @code
/// #include <glm/glm.hpp>
/// #include <glm/gtc/matrix_transform.hpp>
@@ -52,412 +52,674 @@ namespace glm
/// // m[3][0] == 1.0f, m[3][1] == 1.0f, m[3][2] == 1.0f, m[3][3] == 1.0f
/// @endcode
/// @see gtc_matrix_transform
- /// @see - translate(tmat4x4<T, P> const & m, T x, T y, T z)
- /// @see - translate(tvec3<T, P> const & v)
- template <typename T, precision P>
- GLM_FUNC_DECL tmat4x4<T, P> translate(
- tmat4x4<T, P> const & m,
- tvec3<T, P> const & v);
-
- /// Builds a rotation 4 * 4 matrix created from an axis vector and an angle.
- ///
+ /// @see - translate(mat<4, 4, T, Q> const& m, T x, T y, T z)
+ /// @see - translate(vec<3, T, Q> const& v)
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glTranslate.xml">glTranslate man page</a>
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL mat<4, 4, T, Q> translate(
+ mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v);
+
+ /// Builds a rotation 4 * 4 matrix created from an axis vector and an angle.
+ ///
/// @param m Input matrix multiplied by this rotation matrix.
/// @param angle Rotation angle expressed in radians.
/// @param axis Rotation axis, recommended to be normalized.
/// @tparam T Value type used to build the matrix. Supported: half, float or double.
/// @see gtc_matrix_transform
- /// @see - rotate(tmat4x4<T, P> const & m, T angle, T x, T y, T z)
- /// @see - rotate(T angle, tvec3<T, P> const & v)
- template <typename T, precision P>
- GLM_FUNC_DECL tmat4x4<T, P> rotate(
- tmat4x4<T, P> const & m,
- T angle,
- tvec3<T, P> const & axis);
-
- /// Builds a scale 4 * 4 matrix created from 3 scalars.
- ///
+ /// @see - rotate(mat<4, 4, T, Q> const& m, T angle, T x, T y, T z)
+ /// @see - rotate(T angle, vec<3, T, Q> const& v)
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glRotate.xml">glRotate man page</a>
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL mat<4, 4, T, Q> rotate(
+ mat<4, 4, T, Q> const& m, T angle, vec<3, T, Q> const& axis);
+
+ /// Builds a scale 4 * 4 matrix created from 3 scalars.
+ ///
/// @param m Input matrix multiplied by this scale matrix.
/// @param v Ratio of scaling for each axis.
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
- /// @see gtc_matrix_transform
- /// @see - scale(tmat4x4<T, P> const & m, T x, T y, T z)
- /// @see - scale(tvec3<T, P> const & v)
- template <typename T, precision P>
- GLM_FUNC_DECL tmat4x4<T, P> scale(
- tmat4x4<T, P> const & m,
- tvec3<T, P> const & v);
-
- /// Creates a matrix for an orthographic parallel viewing volume, using the default handedness.
- ///
- /// @param left
- /// @param right
- /// @param bottom
- /// @param top
- /// @param zNear
- /// @param zFar
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
- /// @see gtc_matrix_transform
- /// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top)
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> ortho(
- T left,
- T right,
- T bottom,
- T top,
- T zNear,
- T zFar);
-
- /// Creates a matrix for an orthographic parallel viewing volume, using left-handedness.
- ///
- /// @param left
- /// @param right
- /// @param bottom
- /// @param top
- /// @param zNear
- /// @param zFar
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
- /// @see gtc_matrix_transform
- /// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top)
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> orthoLH(
- T left,
- T right,
- T bottom,
- T top,
- T zNear,
- T zFar);
-
- /// Creates a matrix for an orthographic parallel viewing volume, using right-handedness.
- ///
- /// @param left
- /// @param right
- /// @param bottom
- /// @param top
- /// @param zNear
- /// @param zFar
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
- /// @see gtc_matrix_transform
- /// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top)
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> orthoRH(
- T left,
- T right,
- T bottom,
- T top,
- T zNear,
- T zFar);
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ /// @see - scale(mat<4, 4, T, Q> const& m, T x, T y, T z)
+ /// @see - scale(vec<3, T, Q> const& v)
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glScale.xml">glScale man page</a>
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL mat<4, 4, T, Q> scale(
+ mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v);
/// Creates a matrix for projecting two-dimensional coordinates onto the screen.
///
- /// @param left
- /// @param right
- /// @param bottom
- /// @param top
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
- /// @see gtc_matrix_transform
- /// @see - glm::ortho(T const & left, T const & right, T const & bottom, T const & top, T const & zNear, T const & zFar)
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> ortho(
- T left,
- T right,
- T bottom,
- T top);
-
- /// Creates a frustum matrix with default handedness.
- ///
- /// @param left
- /// @param right
- /// @param bottom
- /// @param top
- /// @param near
- /// @param far
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
- /// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> frustum(
- T left,
- T right,
- T bottom,
- T top,
- T near,
- T far);
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top, T const& zNear, T const& zFar)
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluOrtho2D.xml">gluOrtho2D man page</a>
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> ortho(
+ T left, T right, T bottom, T top);
+
+ /// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH_ZO(
+ T left, T right, T bottom, T top, T zNear, T zFar);
+
+ /// Creates a matrix for an orthographic parallel viewing volume using right-handed coordinates.
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH_NO(
+ T left, T right, T bottom, T top, T zNear, T zFar);
+
+ /// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH_ZO(
+ T left, T right, T bottom, T top, T zNear, T zFar);
+
+ /// Creates a matrix for an orthographic parallel viewing volume, using right-handed coordinates.
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH_NO(
+ T left, T right, T bottom, T top, T zNear, T zFar);
+
+ /// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoZO(
+ T left, T right, T bottom, T top, T zNear, T zFar);
+
+ /// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoNO(
+ T left, T right, T bottom, T top, T zNear, T zFar);
+
+ /// Creates a matrix for an orthographic parallel viewing volume, using left-handed coordinates.
+ /// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH(
+ T left, T right, T bottom, T top, T zNear, T zFar);
+
+ /// Creates a matrix for an orthographic parallel viewing volume, using right-handed coordinates.
+ /// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH(
+ T left, T right, T bottom, T top, T zNear, T zFar);
+
+ /// Creates a matrix for an orthographic parallel viewing volume, using the default handedness and default near and far clip planes definition.
+ /// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ /// @see - glm::ortho(T const& left, T const& right, T const& bottom, T const& top)
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glOrtho.xml">glOrtho man page</a>
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> ortho(
+ T left, T right, T bottom, T top, T zNear, T zFar);
/// Creates a left handed frustum matrix.
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
- /// @param left
- /// @param right
- /// @param bottom
- /// @param top
- /// @param near
- /// @param far
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
- /// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> frustumLH(
- T left,
- T right,
- T bottom,
- T top,
- T near,
- T far);
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH_ZO(
+ T left, T right, T bottom, T top, T near, T far);
+
+ /// Creates a left handed frustum matrix.
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH_NO(
+ T left, T right, T bottom, T top, T near, T far);
/// Creates a right handed frustum matrix.
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
- /// @param left
- /// @param right
- /// @param bottom
- /// @param top
- /// @param near
- /// @param far
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
- /// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> frustumRH(
- T left,
- T right,
- T bottom,
- T top,
- T near,
- T far);
-
- /// Creates a matrix for a symetric perspective-view frustum based on the default handedness.
- ///
- /// @param fovy Specifies the field of view angle in the y direction. Expressed in radians.
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH_ZO(
+ T left, T right, T bottom, T top, T near, T far);
+
+ /// Creates a right handed frustum matrix.
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH_NO(
+ T left, T right, T bottom, T top, T near, T far);
+
+ /// Creates a frustum matrix using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumZO(
+ T left, T right, T bottom, T top, T near, T far);
+
+ /// Creates a frustum matrix using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumNO(
+ T left, T right, T bottom, T top, T near, T far);
+
+ /// Creates a left handed frustum matrix.
+ /// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH(
+ T left, T right, T bottom, T top, T near, T far);
+
+ /// Creates a right handed frustum matrix.
+ /// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH(
+ T left, T right, T bottom, T top, T near, T far);
+
+ /// Creates a frustum matrix with default handedness, using the default handedness and default near and far clip planes definition.
+ /// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
+ ///
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/glFrustum.xml">glFrustum man page</a>
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> frustum(
+ T left, T right, T bottom, T top, T near, T far);
+
+
+ /// Creates a matrix for a right handed, symetric perspective-view frustum.
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ ///
+ /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
/// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> perspective(
- T fovy,
- T aspect,
- T near,
- T far);
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH_ZO(
+ T fovy, T aspect, T near, T far);
/// Creates a matrix for a right handed, symetric perspective-view frustum.
- ///
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
/// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> perspectiveRH(
- T fovy,
- T aspect,
- T near,
- T far);
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH_NO(
+ T fovy, T aspect, T near, T far);
/// Creates a matrix for a left handed, symetric perspective-view frustum.
- ///
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ ///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
/// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> perspectiveLH(
- T fovy,
- T aspect,
- T near,
- T far);
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH_ZO(
+ T fovy, T aspect, T near, T far);
- /// Builds a perspective projection matrix based on a field of view and the default handedness.
- ///
+ /// Creates a matrix for a left handed, symetric perspective-view frustum.
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
+ /// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
+ /// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
+ /// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH_NO(
+ T fovy, T aspect, T near, T far);
+
+ /// Creates a matrix for a symetric perspective-view frustum using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ ///
+ /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
+ /// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
+ /// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
+ /// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveZO(
+ T fovy, T aspect, T near, T far);
+
+ /// Creates a matrix for a symetric perspective-view frustum using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
+ /// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
+ /// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
+ /// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveNO(
+ T fovy, T aspect, T near, T far);
+
+ /// Creates a matrix for a right handed, symetric perspective-view frustum.
+ /// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
+ /// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
+ /// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
+ /// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH(
+ T fovy, T aspect, T near, T far);
+
+ /// Creates a matrix for a left handed, symetric perspective-view frustum.
+ /// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
+ /// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
+ /// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
+ /// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH(
+ T fovy, T aspect, T near, T far);
+
+ /// Creates a matrix for a symetric perspective-view frustum based on the default handedness and default near and far clip planes definition.
+ /// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
+ ///
+ /// @param fovy Specifies the field of view angle in the y direction. Expressed in radians.
+ /// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
+ /// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
+ /// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPerspective.xml">gluPerspective man page</a>
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspective(
+ T fovy, T aspect, T near, T far);
+
+ /// Builds a perspective projection matrix based on a field of view using right-handed coordinates.
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ ///
+ /// @param fov Expressed in radians.
+ /// @param width Width of the viewport
+ /// @param height Height of the viewport
+ /// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
+ /// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH_ZO(
+ T fov, T width, T height, T near, T far);
+
+ /// Builds a perspective projection matrix based on a field of view using right-handed coordinates.
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
/// @param fov Expressed in radians.
- /// @param width
- /// @param height
+ /// @param width Width of the viewport
+ /// @param height Height of the viewport
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
/// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> perspectiveFov(
- T fov,
- T width,
- T height,
- T near,
- T far);
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH_NO(
+ T fov, T width, T height, T near, T far);
+
+ /// Builds a perspective projection matrix based on a field of view using left-handed coordinates.
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ ///
+ /// @param fov Expressed in radians.
+ /// @param width Width of the viewport
+ /// @param height Height of the viewport
+ /// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
+ /// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH_ZO(
+ T fov, T width, T height, T near, T far);
+
+ /// Builds a perspective projection matrix based on a field of view using left-handed coordinates.
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @param fov Expressed in radians.
+ /// @param width Width of the viewport
+ /// @param height Height of the viewport
+ /// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
+ /// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH_NO(
+ T fov, T width, T height, T near, T far);
+
+ /// Builds a perspective projection matrix based on a field of view using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ ///
+ /// @param fov Expressed in radians.
+ /// @param width Width of the viewport
+ /// @param height Height of the viewport
+ /// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
+ /// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovZO(
+ T fov, T width, T height, T near, T far);
+
+ /// Builds a perspective projection matrix based on a field of view using left-handed coordinates if GLM_FORCE_LEFT_HANDED if defined or right-handed coordinates otherwise.
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @param fov Expressed in radians.
+ /// @param width Width of the viewport
+ /// @param height Height of the viewport
+ /// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
+ /// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovNO(
+ T fov, T width, T height, T near, T far);
/// Builds a right handed perspective projection matrix based on a field of view.
- ///
+ /// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
/// @param fov Expressed in radians.
- /// @param width
- /// @param height
+ /// @param width Width of the viewport
+ /// @param height Height of the viewport
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
/// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> perspectiveFovRH(
- T fov,
- T width,
- T height,
- T near,
- T far);
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH(
+ T fov, T width, T height, T near, T far);
/// Builds a left handed perspective projection matrix based on a field of view.
- ///
+ /// If GLM_FORCE_DEPTH_ZERO_TO_ONE is defined, the near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ /// Otherwise, the near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
/// @param fov Expressed in radians.
- /// @param width
- /// @param height
+ /// @param width Width of the viewport
+ /// @param height Height of the viewport
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
/// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
/// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> perspectiveFovLH(
- T fov,
- T width,
- T height,
- T near,
- T far);
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH(
+ T fov, T width, T height, T near, T far);
- /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite with default handedness.
+ /// Builds a perspective projection matrix based on a field of view and the default handedness and default near and far clip planes definition.
+ /// To change default handedness use GLM_FORCE_LEFT_HANDED. To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
+ ///
+ /// @param fov Expressed in radians.
+ /// @param width Width of the viewport
+ /// @param height Height of the viewport
+ /// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
+ /// @param far Specifies the distance from the viewer to the far clipping plane (always positive).
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
+ /// @see gtc_matrix_transform
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFov(
+ T fov, T width, T height, T near, T far);
+
+ /// Creates a matrix for a left handed, symmetric perspective-view frustum with far plane at infinite.
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
/// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> infinitePerspective(
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveLH(
T fovy, T aspect, T near);
- /// Creates a matrix for a left handed, symmetric perspective-view frustum with far plane at infinite.
+ /// Creates a matrix for a right handed, symmetric perspective-view frustum with far plane at infinite.
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
/// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> infinitePerspectiveLH(
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveRH(
T fovy, T aspect, T near);
- /// Creates a matrix for a right handed, symmetric perspective-view frustum with far plane at infinite.
+ /// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite with default handedness.
///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
/// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> infinitePerspectiveRH(
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspective(
T fovy, T aspect, T near);
/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.
- ///
+ ///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
/// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> tweakedInfinitePerspective(
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective(
T fovy, T aspect, T near);
/// Creates a matrix for a symmetric perspective-view frustum with far plane at infinite for graphics hardware that doesn't support depth clamping.
- ///
+ ///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.
/// @param aspect Specifies the aspect ratio that determines the field of view in the x direction. The aspect ratio is the ratio of x (width) to y (height).
/// @param near Specifies the distance from the viewer to the near clipping plane (always positive).
- /// @param ep
- /// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
+ /// @param ep Epsilon
+ /// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
/// @see gtc_matrix_transform
- template <typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> tweakedInfinitePerspective(
+ template<typename T>
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective(
T fovy, T aspect, T near, T ep);
/// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.
- ///
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
+ ///
+ /// @param obj Specify the object coordinates.
+ /// @param model Specifies the current modelview matrix
+ /// @param proj Specifies the current projection matrix
+ /// @param viewport Specifies the current viewport
+ /// @return Return the computed window coordinates.
+ /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
+ /// @tparam U Currently supported: Floating-point types and integer types.
+ /// @see gtc_matrix_transform
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluProject.xml">gluProject man page</a>
+ template<typename T, typename U, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> projectZO(
+ vec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);
+
+ /// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates.
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @param obj Specify the object coordinates.
+ /// @param model Specifies the current modelview matrix
+ /// @param proj Specifies the current projection matrix
+ /// @param viewport Specifies the current viewport
+ /// @return Return the computed window coordinates.
+ /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
+ /// @tparam U Currently supported: Floating-point types and integer types.
+ /// @see gtc_matrix_transform
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluProject.xml">gluProject man page</a>
+ template<typename T, typename U, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> projectNO(
+ vec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);
+
+ /// Map the specified object coordinates (obj.x, obj.y, obj.z) into window coordinates using default near and far clip planes definition.
+ /// To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
+ ///
/// @param obj Specify the object coordinates.
/// @param model Specifies the current modelview matrix
/// @param proj Specifies the current projection matrix
/// @param viewport Specifies the current viewport
/// @return Return the computed window coordinates.
- /// @tparam T Native type used for the computation. Currently supported: half (not recommanded), float or double.
+ /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
/// @tparam U Currently supported: Floating-point types and integer types.
/// @see gtc_matrix_transform
- template <typename T, typename U, precision P>
- GLM_FUNC_DECL tvec3<T, P> project(
- tvec3<T, P> const & obj,
- tmat4x4<T, P> const & model,
- tmat4x4<T, P> const & proj,
- tvec4<U, P> const & viewport);
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluProject.xml">gluProject man page</a>
+ template<typename T, typename U, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> project(
+ vec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);
/// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.
+ /// The near and far clip planes correspond to z normalized device coordinates of 0 and +1 respectively. (Direct3D clip volume definition)
///
/// @param win Specify the window coordinates to be mapped.
/// @param model Specifies the modelview matrix
/// @param proj Specifies the projection matrix
/// @param viewport Specifies the viewport
/// @return Returns the computed object coordinates.
- /// @tparam T Native type used for the computation. Currently supported: half (not recommanded), float or double.
+ /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
/// @tparam U Currently supported: Floating-point types and integer types.
/// @see gtc_matrix_transform
- template <typename T, typename U, precision P>
- GLM_FUNC_DECL tvec3<T, P> unProject(
- tvec3<T, P> const & win,
- tmat4x4<T, P> const & model,
- tmat4x4<T, P> const & proj,
- tvec4<U, P> const & viewport);
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluUnProject.xml">gluUnProject man page</a>
+ template<typename T, typename U, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> unProjectZO(
+ vec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);
+
+ /// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.
+ /// The near and far clip planes correspond to z normalized device coordinates of -1 and +1 respectively. (OpenGL clip volume definition)
+ ///
+ /// @param win Specify the window coordinates to be mapped.
+ /// @param model Specifies the modelview matrix
+ /// @param proj Specifies the projection matrix
+ /// @param viewport Specifies the viewport
+ /// @return Returns the computed object coordinates.
+ /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
+ /// @tparam U Currently supported: Floating-point types and integer types.
+ /// @see gtc_matrix_transform
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluUnProject.xml">gluUnProject man page</a>
+ template<typename T, typename U, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> unProjectNO(
+ vec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);
+
+ /// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates using default near and far clip planes definition.
+ /// To change default near and far clip planes definition use GLM_FORCE_DEPTH_ZERO_TO_ONE.
+ ///
+ /// @param win Specify the window coordinates to be mapped.
+ /// @param model Specifies the modelview matrix
+ /// @param proj Specifies the projection matrix
+ /// @param viewport Specifies the viewport
+ /// @return Returns the computed object coordinates.
+ /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
+ /// @tparam U Currently supported: Floating-point types and integer types.
+ /// @see gtc_matrix_transform
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluUnProject.xml">gluUnProject man page</a>
+ template<typename T, typename U, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> unProject(
+ vec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport);
/// Define a picking region
///
- /// @param center
- /// @param delta
- /// @param viewport
- /// @tparam T Native type used for the computation. Currently supported: half (not recommanded), float or double.
+ /// @param center Specify the center of a picking region in window coordinates.
+ /// @param delta Specify the width and height, respectively, of the picking region in window coordinates.
+ /// @param viewport Rendering viewport
+ /// @tparam T Native type used for the computation. Currently supported: half (not recommended), float or double.
/// @tparam U Currently supported: Floating-point types and integer types.
/// @see gtc_matrix_transform
- template <typename T, precision P, typename U>
- GLM_FUNC_DECL tmat4x4<T, P> pickMatrix(
- tvec2<T, P> const & center,
- tvec2<T, P> const & delta,
- tvec4<U, P> const & viewport);
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluPickMatrix.xml">gluPickMatrix man page</a>
+ template<typename T, qualifier Q, typename U>
+ GLM_FUNC_DECL mat<4, 4, T, Q> pickMatrix(
+ vec<2, T, Q> const& center, vec<2, T, Q> const& delta, vec<4, U, Q> const& viewport);
- /// Build a look at view matrix based on the default handedness.
+ /// Build a right handed look at view matrix.
///
/// @param eye Position of the camera
/// @param center Position where the camera is looking at
/// @param up Normalized up vector, how the camera is oriented. Typically (0, 0, 1)
/// @see gtc_matrix_transform
- /// @see - frustum(T const & left, T const & right, T const & bottom, T const & top, T const & nearVal, T const & farVal) frustum(T const & left, T const & right, T const & bottom, T const & top, T const & nearVal, T const & farVal)
- template <typename T, precision P>
- GLM_FUNC_DECL tmat4x4<T, P> lookAt(
- tvec3<T, P> const & eye,
- tvec3<T, P> const & center,
- tvec3<T, P> const & up);
+ /// @see - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL mat<4, 4, T, Q> lookAtRH(
+ vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);
- /// Build a right handed look at view matrix.
+ /// Build a left handed look at view matrix.
///
/// @param eye Position of the camera
/// @param center Position where the camera is looking at
/// @param up Normalized up vector, how the camera is oriented. Typically (0, 0, 1)
/// @see gtc_matrix_transform
- /// @see - frustum(T const & left, T const & right, T const & bottom, T const & top, T const & nearVal, T const & farVal) frustum(T const & left, T const & right, T const & bottom, T const & top, T const & nearVal, T const & farVal)
- template <typename T, precision P>
- GLM_FUNC_DECL tmat4x4<T, P> lookAtRH(
- tvec3<T, P> const & eye,
- tvec3<T, P> const & center,
- tvec3<T, P> const & up);
+ /// @see - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL mat<4, 4, T, Q> lookAtLH(
+ vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);
- /// Build a left handed look at view matrix.
+ /// Build a look at view matrix based on the default handedness.
///
/// @param eye Position of the camera
/// @param center Position where the camera is looking at
/// @param up Normalized up vector, how the camera is oriented. Typically (0, 0, 1)
/// @see gtc_matrix_transform
- /// @see - frustum(T const & left, T const & right, T const & bottom, T const & top, T const & nearVal, T const & farVal) frustum(T const & left, T const & right, T const & bottom, T const & top, T const & nearVal, T const & farVal)
- template <typename T, precision P>
- GLM_FUNC_DECL tmat4x4<T, P> lookAtLH(
- tvec3<T, P> const & eye,
- tvec3<T, P> const & center,
- tvec3<T, P> const & up);
+ /// @see - frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal) frustum(T const& left, T const& right, T const& bottom, T const& top, T const& nearVal, T const& farVal)
+ /// @see <a href="https://www.khronos.org/registry/OpenGL-Refpages/gl2.1/xhtml/gluLookAt.xml">gluLookAt man page</a>
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL mat<4, 4, T, Q> lookAt(
+ vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up);
/// @}
}//namespace glm
diff --git a/external/include/glm/gtc/matrix_transform.inl b/external/include/glm/gtc/matrix_transform.inl
index b9ff418..12623d7 100644
--- a/external/include/glm/gtc/matrix_transform.inl
+++ b/external/include/glm/gtc/matrix_transform.inl
@@ -7,25 +7,25 @@
namespace glm
{
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat4x4<T, P> translate(tmat4x4<T, P> const & m, tvec3<T, P> const & v)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> translate(mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v)
{
- tmat4x4<T, P> Result(m);
+ mat<4, 4, T, Q> Result(m);
Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3];
return Result;
}
-
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat4x4<T, P> rotate(tmat4x4<T, P> const & m, T angle, tvec3<T, P> const & v)
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotate(mat<4, 4, T, Q> const& m, T angle, vec<3, T, Q> const& v)
{
T const a = angle;
T const c = cos(a);
T const s = sin(a);
- tvec3<T, P> axis(normalize(v));
- tvec3<T, P> temp((T(1) - c) * axis);
+ vec<3, T, Q> axis(normalize(v));
+ vec<3, T, Q> temp((T(1) - c) * axis);
- tmat4x4<T, P> Rotate(uninitialize);
+ mat<4, 4, T, Q> Rotate;
Rotate[0][0] = c + temp[0] * axis[0];
Rotate[0][1] = temp[0] * axis[1] + s * axis[2];
Rotate[0][2] = temp[0] * axis[2] - s * axis[1];
@@ -38,23 +38,23 @@ namespace glm
Rotate[2][1] = temp[2] * axis[1] - s * axis[0];
Rotate[2][2] = c + temp[2] * axis[2];
- tmat4x4<T, P> Result(uninitialize);
+ mat<4, 4, T, Q> Result;
Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2];
Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2];
Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2];
Result[3] = m[3];
return Result;
}
-
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat4x4<T, P> rotate_slow(tmat4x4<T, P> const & m, T angle, tvec3<T, P> const & v)
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotate_slow(mat<4, 4, T, Q> const& m, T angle, vec<3, T, Q> const& v)
{
T const a = angle;
T const c = cos(a);
T const s = sin(a);
- tmat4x4<T, P> Result;
+ mat<4, 4, T, Q> Result;
- tvec3<T, P> axis = normalize(v);
+ vec<3, T, Q> axis = normalize(v);
Result[0][0] = c + (static_cast<T>(1) - c) * axis.x * axis.x;
Result[0][1] = (static_cast<T>(1) - c) * axis.x * axis.y + s * axis.z;
@@ -71,14 +71,14 @@ namespace glm
Result[2][2] = c + (static_cast<T>(1) - c) * axis.z * axis.z;
Result[2][3] = static_cast<T>(0);
- Result[3] = tvec4<T, P>(0, 0, 0, 1);
+ Result[3] = vec<4, T, Q>(0, 0, 0, 1);
return m * Result;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat4x4<T, P> scale(tmat4x4<T, P> const & m, tvec3<T, P> const & v)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> scale(mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v)
{
- tmat4x4<T, P> Result(uninitialize);
+ mat<4, 4, T, Q> Result;
Result[0] = m[0] * v[0];
Result[1] = m[1] * v[1];
Result[2] = m[2] * v[2];
@@ -86,296 +86,497 @@ namespace glm
return Result;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat4x4<T, P> scale_slow(tmat4x4<T, P> const & m, tvec3<T, P> const & v)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> scale_slow(mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v)
{
- tmat4x4<T, P> Result(T(1));
+ mat<4, 4, T, Q> Result(T(1));
Result[0][0] = v.x;
Result[1][1] = v.y;
Result[2][2] = v.z;
return m * Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> ortho
- (
- T left, T right,
- T bottom, T top,
- T zNear, T zFar
- )
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> ortho(T left, T right, T bottom, T top)
{
-# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
- return orthoLH(left, right, bottom, top, zNear, zFar);
-# else
- return orthoRH(left, right, bottom, top, zNear, zFar);
-# endif
+ mat<4, 4, T, defaultp> Result(static_cast<T>(1));
+ Result[0][0] = static_cast<T>(2) / (right - left);
+ Result[1][1] = static_cast<T>(2) / (top - bottom);
+ Result[3][0] = - (right + left) / (right - left);
+ Result[3][1] = - (top + bottom) / (top - bottom);
+ return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> orthoLH
- (
- T left, T right,
- T bottom, T top,
- T zNear, T zFar
- )
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoLH_ZO(T left, T right, T bottom, T top, T zNear, T zFar)
{
- tmat4x4<T, defaultp> Result(1);
+ mat<4, 4, T, defaultp> Result(1);
Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom);
+ Result[2][2] = static_cast<T>(1) / (zFar - zNear);
Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom);
-
-# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
- Result[2][2] = static_cast<T>(1) / (zFar - zNear);
- Result[3][2] = - zNear / (zFar - zNear);
-# else
- Result[2][2] = static_cast<T>(2) / (zFar - zNear);
- Result[3][2] = - (zFar + zNear) / (zFar - zNear);
-# endif
-
+ Result[3][2] = - zNear / (zFar - zNear);
return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> orthoRH
- (
- T left, T right,
- T bottom, T top,
- T zNear, T zFar
- )
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoLH_NO(T left, T right, T bottom, T top, T zNear, T zFar)
{
- tmat4x4<T, defaultp> Result(1);
+ mat<4, 4, T, defaultp> Result(1);
Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom);
+ Result[2][2] = static_cast<T>(2) / (zFar - zNear);
Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom);
+ Result[3][2] = - (zFar + zNear) / (zFar - zNear);
+ return Result;
+ }
-# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
- Result[2][2] = - static_cast<T>(1) / (zFar - zNear);
- Result[3][2] = - zNear / (zFar - zNear);
-# else
- Result[2][2] = - static_cast<T>(2) / (zFar - zNear);
- Result[3][2] = - (zFar + zNear) / (zFar - zNear);
-# endif
-
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoRH_ZO(T left, T right, T bottom, T top, T zNear, T zFar)
+ {
+ mat<4, 4, T, defaultp> Result(1);
+ Result[0][0] = static_cast<T>(2) / (right - left);
+ Result[1][1] = static_cast<T>(2) / (top - bottom);
+ Result[2][2] = - static_cast<T>(1) / (zFar - zNear);
+ Result[3][0] = - (right + left) / (right - left);
+ Result[3][1] = - (top + bottom) / (top - bottom);
+ Result[3][2] = - zNear / (zFar - zNear);
return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> ortho
- (
- T left, T right,
- T bottom, T top
- )
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoRH_NO(T left, T right, T bottom, T top, T zNear, T zFar)
{
- tmat4x4<T, defaultp> Result(static_cast<T>(1));
+ mat<4, 4, T, defaultp> Result(1);
Result[0][0] = static_cast<T>(2) / (right - left);
Result[1][1] = static_cast<T>(2) / (top - bottom);
- Result[2][2] = - static_cast<T>(1);
+ Result[2][2] = - static_cast<T>(2) / (zFar - zNear);
Result[3][0] = - (right + left) / (right - left);
Result[3][1] = - (top + bottom) / (top - bottom);
+ Result[3][2] = - (zFar + zNear) / (zFar - zNear);
return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> frustum
- (
- T left, T right,
- T bottom, T top,
- T nearVal, T farVal
- )
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoZO(T left, T right, T bottom, T top, T zNear, T zFar)
+ {
+# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
+ return orthoLH_ZO(left, right, bottom, top, zNear, zFar);
+# else
+ return orthoRH_ZO(left, right, bottom, top, zNear, zFar);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoNO(T left, T right, T bottom, T top, T zNear, T zFar)
{
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
- return frustumLH(left, right, bottom, top, nearVal, farVal);
+ return orthoLH_NO(left, right, bottom, top, zNear, zFar);
# else
- return frustumRH(left, right, bottom, top, nearVal, farVal);
+ return orthoRH_NO(left, right, bottom, top, zNear, zFar);
# endif
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> frustumLH
- (
- T left, T right,
- T bottom, T top,
- T nearVal, T farVal
- )
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoLH(T left, T right, T bottom, T top, T zNear, T zFar)
{
- tmat4x4<T, defaultp> Result(0);
+# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return orthoLH_ZO(left, right, bottom, top, zNear, zFar);
+# else
+ return orthoLH_NO(left, right, bottom, top, zNear, zFar);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoRH(T left, T right, T bottom, T top, T zNear, T zFar)
+ {
+# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return orthoRH_ZO(left, right, bottom, top, zNear, zFar);
+# else
+ return orthoRH_NO(left, right, bottom, top, zNear, zFar);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> ortho(T left, T right, T bottom, T top, T zNear, T zFar)
+ {
+# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return orthoLH_ZO(left, right, bottom, top, zNear, zFar);
+# elif GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_NEGATIVE_ONE_TO_ONE
+ return orthoLH_NO(left, right, bottom, top, zNear, zFar);
+# elif GLM_COORDINATE_SYSTEM == GLM_RIGHT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return orthoRH_ZO(left, right, bottom, top, zNear, zFar);
+# elif GLM_COORDINATE_SYSTEM == GLM_RIGHT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_NEGATIVE_ONE_TO_ONE
+ return orthoRH_NO(left, right, bottom, top, zNear, zFar);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumLH_ZO(T left, T right, T bottom, T top, T nearVal, T farVal)
+ {
+ mat<4, 4, T, defaultp> Result(0);
Result[0][0] = (static_cast<T>(2) * nearVal) / (right - left);
Result[1][1] = (static_cast<T>(2) * nearVal) / (top - bottom);
Result[2][0] = (right + left) / (right - left);
Result[2][1] = (top + bottom) / (top - bottom);
+ Result[2][2] = farVal / (farVal - nearVal);
Result[2][3] = static_cast<T>(1);
+ Result[3][2] = -(farVal * nearVal) / (farVal - nearVal);
+ return Result;
+ }
-# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
- Result[2][2] = farVal / (farVal - nearVal);
- Result[3][2] = -(farVal * nearVal) / (farVal - nearVal);
-# else
- Result[2][2] = (farVal + nearVal) / (farVal - nearVal);
- Result[3][2] = - (static_cast<T>(2) * farVal * nearVal) / (farVal - nearVal);
-# endif
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumLH_NO(T left, T right, T bottom, T top, T nearVal, T farVal)
+ {
+ mat<4, 4, T, defaultp> Result(0);
+ Result[0][0] = (static_cast<T>(2) * nearVal) / (right - left);
+ Result[1][1] = (static_cast<T>(2) * nearVal) / (top - bottom);
+ Result[2][0] = (right + left) / (right - left);
+ Result[2][1] = (top + bottom) / (top - bottom);
+ Result[2][2] = (farVal + nearVal) / (farVal - nearVal);
+ Result[2][3] = static_cast<T>(1);
+ Result[3][2] = - (static_cast<T>(2) * farVal * nearVal) / (farVal - nearVal);
+ return Result;
+ }
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumRH_ZO(T left, T right, T bottom, T top, T nearVal, T farVal)
+ {
+ mat<4, 4, T, defaultp> Result(0);
+ Result[0][0] = (static_cast<T>(2) * nearVal) / (right - left);
+ Result[1][1] = (static_cast<T>(2) * nearVal) / (top - bottom);
+ Result[2][0] = (right + left) / (right - left);
+ Result[2][1] = (top + bottom) / (top - bottom);
+ Result[2][2] = farVal / (nearVal - farVal);
+ Result[2][3] = static_cast<T>(-1);
+ Result[3][2] = -(farVal * nearVal) / (farVal - nearVal);
return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> frustumRH
- (
- T left, T right,
- T bottom, T top,
- T nearVal, T farVal
- )
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumRH_NO(T left, T right, T bottom, T top, T nearVal, T farVal)
{
- tmat4x4<T, defaultp> Result(0);
+ mat<4, 4, T, defaultp> Result(0);
Result[0][0] = (static_cast<T>(2) * nearVal) / (right - left);
Result[1][1] = (static_cast<T>(2) * nearVal) / (top - bottom);
Result[2][0] = (right + left) / (right - left);
Result[2][1] = (top + bottom) / (top - bottom);
+ Result[2][2] = - (farVal + nearVal) / (farVal - nearVal);
Result[2][3] = static_cast<T>(-1);
+ Result[3][2] = - (static_cast<T>(2) * farVal * nearVal) / (farVal - nearVal);
+ return Result;
+ }
-# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
- Result[2][2] = farVal / (nearVal - farVal);
- Result[3][2] = -(farVal * nearVal) / (farVal - nearVal);
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumZO(T left, T right, T bottom, T top, T nearVal, T farVal)
+ {
+# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
+ return frustumLH_ZO(left, right, bottom, top, nearVal, farVal);
# else
- Result[2][2] = - (farVal + nearVal) / (farVal - nearVal);
- Result[3][2] = - (static_cast<T>(2) * farVal * nearVal) / (farVal - nearVal);
+ return frustumRH_ZO(left, right, bottom, top, nearVal, farVal);
# endif
-
- return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> perspective(T fovy, T aspect, T zNear, T zFar)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumNO(T left, T right, T bottom, T top, T nearVal, T farVal)
{
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
- return perspectiveLH(fovy, aspect, zNear, zFar);
+ return frustumLH_NO(left, right, bottom, top, nearVal, farVal);
+# else
+ return frustumRH_NO(left, right, bottom, top, nearVal, farVal);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumLH(T left, T right, T bottom, T top, T nearVal, T farVal)
+ {
+# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return frustumLH_ZO(left, right, bottom, top, nearVal, farVal);
# else
- return perspectiveRH(fovy, aspect, zNear, zFar);
+ return frustumLH_NO(left, right, bottom, top, nearVal, farVal);
# endif
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> perspectiveRH(T fovy, T aspect, T zNear, T zFar)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumRH(T left, T right, T bottom, T top, T nearVal, T farVal)
+ {
+# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return frustumRH_ZO(left, right, bottom, top, nearVal, farVal);
+# else
+ return frustumRH_NO(left, right, bottom, top, nearVal, farVal);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustum(T left, T right, T bottom, T top, T nearVal, T farVal)
+ {
+# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return frustumLH_ZO(left, right, bottom, top, nearVal, farVal);
+# elif GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_NEGATIVE_ONE_TO_ONE
+ return frustumLH_NO(left, right, bottom, top, nearVal, farVal);
+# elif GLM_COORDINATE_SYSTEM == GLM_RIGHT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return frustumRH_ZO(left, right, bottom, top, nearVal, farVal);
+# elif GLM_COORDINATE_SYSTEM == GLM_RIGHT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_NEGATIVE_ONE_TO_ONE
+ return frustumRH_NO(left, right, bottom, top, nearVal, farVal);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveRH_ZO(T fovy, T aspect, T zNear, T zFar)
{
assert(abs(aspect - std::numeric_limits<T>::epsilon()) > static_cast<T>(0));
T const tanHalfFovy = tan(fovy / static_cast<T>(2));
- tmat4x4<T, defaultp> Result(static_cast<T>(0));
+ mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = static_cast<T>(1) / (aspect * tanHalfFovy);
Result[1][1] = static_cast<T>(1) / (tanHalfFovy);
+ Result[2][2] = zFar / (zNear - zFar);
Result[2][3] = - static_cast<T>(1);
+ Result[3][2] = -(zFar * zNear) / (zFar - zNear);
+ return Result;
+ }
-# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
- Result[2][2] = zFar / (zNear - zFar);
- Result[3][2] = -(zFar * zNear) / (zFar - zNear);
-# else
- Result[2][2] = - (zFar + zNear) / (zFar - zNear);
- Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
-# endif
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveRH_NO(T fovy, T aspect, T zNear, T zFar)
+ {
+ assert(abs(aspect - std::numeric_limits<T>::epsilon()) > static_cast<T>(0));
+
+ T const tanHalfFovy = tan(fovy / static_cast<T>(2));
+ mat<4, 4, T, defaultp> Result(static_cast<T>(0));
+ Result[0][0] = static_cast<T>(1) / (aspect * tanHalfFovy);
+ Result[1][1] = static_cast<T>(1) / (tanHalfFovy);
+ Result[2][2] = - (zFar + zNear) / (zFar - zNear);
+ Result[2][3] = - static_cast<T>(1);
+ Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
return Result;
}
-
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> perspectiveLH(T fovy, T aspect, T zNear, T zFar)
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveLH_ZO(T fovy, T aspect, T zNear, T zFar)
{
assert(abs(aspect - std::numeric_limits<T>::epsilon()) > static_cast<T>(0));
T const tanHalfFovy = tan(fovy / static_cast<T>(2));
-
- tmat4x4<T, defaultp> Result(static_cast<T>(0));
+
+ mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = static_cast<T>(1) / (aspect * tanHalfFovy);
Result[1][1] = static_cast<T>(1) / (tanHalfFovy);
+ Result[2][2] = zFar / (zFar - zNear);
Result[2][3] = static_cast<T>(1);
+ Result[3][2] = -(zFar * zNear) / (zFar - zNear);
+ return Result;
+ }
-# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
- Result[2][2] = zFar / (zFar - zNear);
- Result[3][2] = -(zFar * zNear) / (zFar - zNear);
-# else
- Result[2][2] = (zFar + zNear) / (zFar - zNear);
- Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
-# endif
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveLH_NO(T fovy, T aspect, T zNear, T zFar)
+ {
+ assert(abs(aspect - std::numeric_limits<T>::epsilon()) > static_cast<T>(0));
+
+ T const tanHalfFovy = tan(fovy / static_cast<T>(2));
+ mat<4, 4, T, defaultp> Result(static_cast<T>(0));
+ Result[0][0] = static_cast<T>(1) / (aspect * tanHalfFovy);
+ Result[1][1] = static_cast<T>(1) / (tanHalfFovy);
+ Result[2][2] = (zFar + zNear) / (zFar - zNear);
+ Result[2][3] = static_cast<T>(1);
+ Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> perspectiveFov(T fov, T width, T height, T zNear, T zFar)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveZO(T fovy, T aspect, T zNear, T zFar)
+ {
+# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
+ return perspectiveLH_ZO(fovy, aspect, zNear, zFar);
+# else
+ return perspectiveRH_ZO(fovy, aspect, zNear, zFar);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveNO(T fovy, T aspect, T zNear, T zFar)
{
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
- return perspectiveFovLH(fov, width, height, zNear, zFar);
+ return perspectiveLH_NO(fovy, aspect, zNear, zFar);
+# else
+ return perspectiveRH_NO(fovy, aspect, zNear, zFar);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveLH(T fovy, T aspect, T zNear, T zFar)
+ {
+# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return perspectiveLH_ZO(fovy, aspect, zNear, zFar);
# else
- return perspectiveFovRH(fov, width, height, zNear, zFar);
+ return perspectiveLH_NO(fovy, aspect, zNear, zFar);
# endif
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> perspectiveFovRH(T fov, T width, T height, T zNear, T zFar)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveRH(T fovy, T aspect, T zNear, T zFar)
+ {
+# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return perspectiveRH_ZO(fovy, aspect, zNear, zFar);
+# else
+ return perspectiveRH_NO(fovy, aspect, zNear, zFar);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspective(T fovy, T aspect, T zNear, T zFar)
+ {
+# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return perspectiveLH_ZO(fovy, aspect, zNear, zFar);
+# elif GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_NEGATIVE_ONE_TO_ONE
+ return perspectiveLH_NO(fovy, aspect, zNear, zFar);
+# elif GLM_COORDINATE_SYSTEM == GLM_RIGHT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return perspectiveRH_ZO(fovy, aspect, zNear, zFar);
+# elif GLM_COORDINATE_SYSTEM == GLM_RIGHT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_NEGATIVE_ONE_TO_ONE
+ return perspectiveRH_NO(fovy, aspect, zNear, zFar);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovRH_ZO(T fov, T width, T height, T zNear, T zFar)
{
assert(width > static_cast<T>(0));
assert(height > static_cast<T>(0));
assert(fov > static_cast<T>(0));
-
+
T const rad = fov;
T const h = glm::cos(static_cast<T>(0.5) * rad) / glm::sin(static_cast<T>(0.5) * rad);
T const w = h * height / width; ///todo max(width , Height) / min(width , Height)?
- tmat4x4<T, defaultp> Result(static_cast<T>(0));
+ mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = w;
Result[1][1] = h;
+ Result[2][2] = zFar / (zNear - zFar);
Result[2][3] = - static_cast<T>(1);
+ Result[3][2] = -(zFar * zNear) / (zFar - zNear);
+ return Result;
+ }
-# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
- Result[2][2] = zFar / (zNear - zFar);
- Result[3][2] = -(zFar * zNear) / (zFar - zNear);
-# else
- Result[2][2] = - (zFar + zNear) / (zFar - zNear);
- Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
-# endif
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovRH_NO(T fov, T width, T height, T zNear, T zFar)
+ {
+ assert(width > static_cast<T>(0));
+ assert(height > static_cast<T>(0));
+ assert(fov > static_cast<T>(0));
+
+ T const rad = fov;
+ T const h = glm::cos(static_cast<T>(0.5) * rad) / glm::sin(static_cast<T>(0.5) * rad);
+ T const w = h * height / width; ///todo max(width , Height) / min(width , Height)?
+ mat<4, 4, T, defaultp> Result(static_cast<T>(0));
+ Result[0][0] = w;
+ Result[1][1] = h;
+ Result[2][2] = - (zFar + zNear) / (zFar - zNear);
+ Result[2][3] = - static_cast<T>(1);
+ Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> perspectiveFovLH(T fov, T width, T height, T zNear, T zFar)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovLH_ZO(T fov, T width, T height, T zNear, T zFar)
{
assert(width > static_cast<T>(0));
assert(height > static_cast<T>(0));
assert(fov > static_cast<T>(0));
-
+
T const rad = fov;
T const h = glm::cos(static_cast<T>(0.5) * rad) / glm::sin(static_cast<T>(0.5) * rad);
T const w = h * height / width; ///todo max(width , Height) / min(width , Height)?
- tmat4x4<T, defaultp> Result(static_cast<T>(0));
+ mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = w;
Result[1][1] = h;
+ Result[2][2] = zFar / (zFar - zNear);
Result[2][3] = static_cast<T>(1);
+ Result[3][2] = -(zFar * zNear) / (zFar - zNear);
+ return Result;
+ }
-# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
- Result[2][2] = zFar / (zFar - zNear);
- Result[3][2] = -(zFar * zNear) / (zFar - zNear);
-# else
- Result[2][2] = (zFar + zNear) / (zFar - zNear);
- Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
-# endif
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovLH_NO(T fov, T width, T height, T zNear, T zFar)
+ {
+ assert(width > static_cast<T>(0));
+ assert(height > static_cast<T>(0));
+ assert(fov > static_cast<T>(0));
+
+ T const rad = fov;
+ T const h = glm::cos(static_cast<T>(0.5) * rad) / glm::sin(static_cast<T>(0.5) * rad);
+ T const w = h * height / width; ///todo max(width , Height) / min(width , Height)?
+ mat<4, 4, T, defaultp> Result(static_cast<T>(0));
+ Result[0][0] = w;
+ Result[1][1] = h;
+ Result[2][2] = (zFar + zNear) / (zFar - zNear);
+ Result[2][3] = static_cast<T>(1);
+ Result[3][2] = - (static_cast<T>(2) * zFar * zNear) / (zFar - zNear);
return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> infinitePerspective(T fovy, T aspect, T zNear)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovZO(T fov, T width, T height, T zNear, T zFar)
{
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
- return infinitePerspectiveLH(fovy, aspect, zNear);
+ return perspectiveFovLH_ZO(fov, width, height, zNear, zFar);
# else
- return infinitePerspectiveRH(fovy, aspect, zNear);
+ return perspectiveFovRH_ZO(fov, width, height, zNear, zFar);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovNO(T fov, T width, T height, T zNear, T zFar)
+ {
+# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
+ return perspectiveFovLH_NO(fov, width, height, zNear, zFar);
+# else
+ return perspectiveFovRH_NO(fov, width, height, zNear, zFar);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovLH(T fov, T width, T height, T zNear, T zFar)
+ {
+# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return perspectiveFovLH_ZO(fov, width, height, zNear, zFar);
+# else
+ return perspectiveFovLH_NO(fov, width, height, zNear, zFar);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovRH(T fov, T width, T height, T zNear, T zFar)
+ {
+# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return perspectiveFovRH_ZO(fov, width, height, zNear, zFar);
+# else
+ return perspectiveFovRH_NO(fov, width, height, zNear, zFar);
# endif
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> infinitePerspectiveRH(T fovy, T aspect, T zNear)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFov(T fov, T width, T height, T zNear, T zFar)
+ {
+# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return perspectiveFovLH_ZO(fov, width, height, zNear, zFar);
+# elif GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_NEGATIVE_ONE_TO_ONE
+ return perspectiveFovLH_NO(fov, width, height, zNear, zFar);
+# elif GLM_COORDINATE_SYSTEM == GLM_RIGHT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return perspectiveFovRH_ZO(fov, width, height, zNear, zFar);
+# elif GLM_COORDINATE_SYSTEM == GLM_RIGHT_HANDED && GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_NEGATIVE_ONE_TO_ONE
+ return perspectiveFovRH_NO(fov, width, height, zNear, zFar);
+# endif
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> infinitePerspectiveRH(T fovy, T aspect, T zNear)
{
T const range = tan(fovy / static_cast<T>(2)) * zNear;
T const left = -range * aspect;
@@ -383,7 +584,7 @@ namespace glm
T const bottom = -range;
T const top = range;
- tmat4x4<T, defaultp> Result(static_cast<T>(0));
+ mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = (static_cast<T>(2) * zNear) / (right - left);
Result[1][1] = (static_cast<T>(2) * zNear) / (top - bottom);
Result[2][2] = - static_cast<T>(1);
@@ -392,8 +593,8 @@ namespace glm
return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> infinitePerspectiveLH(T fovy, T aspect, T zNear)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> infinitePerspectiveLH(T fovy, T aspect, T zNear)
{
T const range = tan(fovy / static_cast<T>(2)) * zNear;
T const left = -range * aspect;
@@ -401,7 +602,7 @@ namespace glm
T const bottom = -range;
T const top = range;
- tmat4x4<T, defaultp> Result(T(0));
+ mat<4, 4, T, defaultp> Result(T(0));
Result[0][0] = (static_cast<T>(2) * zNear) / (right - left);
Result[1][1] = (static_cast<T>(2) * zNear) / (top - bottom);
Result[2][2] = static_cast<T>(1);
@@ -410,17 +611,27 @@ namespace glm
return Result;
}
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> infinitePerspective(T fovy, T aspect, T zNear)
+ {
+# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
+ return infinitePerspectiveLH(fovy, aspect, zNear);
+# else
+ return infinitePerspectiveRH(fovy, aspect, zNear);
+# endif
+ }
+
// Infinite projection matrix: http://www.terathon.com/gdc07_lengyel.pdf
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> tweakedInfinitePerspective(T fovy, T aspect, T zNear, T ep)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> tweakedInfinitePerspective(T fovy, T aspect, T zNear, T ep)
{
- T const range = tan(fovy / static_cast<T>(2)) * zNear;
+ T const range = tan(fovy / static_cast<T>(2)) * zNear;
T const left = -range * aspect;
T const right = range * aspect;
T const bottom = -range;
T const top = range;
- tmat4x4<T, defaultp> Result(static_cast<T>(0));
+ mat<4, 4, T, defaultp> Result(static_cast<T>(0));
Result[0][0] = (static_cast<T>(2) * zNear) / (right - left);
Result[1][1] = (static_cast<T>(2) * zNear) / (top - bottom);
Result[2][2] = ep - static_cast<T>(1);
@@ -429,107 +640,124 @@ namespace glm
return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> tweakedInfinitePerspective(T fovy, T aspect, T zNear)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> tweakedInfinitePerspective(T fovy, T aspect, T zNear)
{
return tweakedInfinitePerspective(fovy, aspect, zNear, epsilon<T>());
}
- template <typename T, typename U, precision P>
- GLM_FUNC_QUALIFIER tvec3<T, P> project
- (
- tvec3<T, P> const & obj,
- tmat4x4<T, P> const & model,
- tmat4x4<T, P> const & proj,
- tvec4<U, P> const & viewport
- )
+ template<typename T, typename U, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<3, T, Q> projectZO(vec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport)
{
- tvec4<T, P> tmp = tvec4<T, P>(obj, static_cast<T>(1));
+ vec<4, T, Q> tmp = vec<4, T, Q>(obj, static_cast<T>(1));
tmp = model * tmp;
tmp = proj * tmp;
tmp /= tmp.w;
-# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
- tmp.x = tmp.x * static_cast<T>(0.5) + static_cast<T>(0.5);
- tmp.y = tmp.y * static_cast<T>(0.5) + static_cast<T>(0.5);
-# else
- tmp = tmp * static_cast<T>(0.5) + static_cast<T>(0.5);
-# endif
+ tmp.x = tmp.x * static_cast<T>(0.5) + static_cast<T>(0.5);
+ tmp.y = tmp.y * static_cast<T>(0.5) + static_cast<T>(0.5);
+
tmp[0] = tmp[0] * T(viewport[2]) + T(viewport[0]);
tmp[1] = tmp[1] * T(viewport[3]) + T(viewport[1]);
- return tvec3<T, P>(tmp);
+ return vec<3, T, Q>(tmp);
}
- template <typename T, typename U, precision P>
- GLM_FUNC_QUALIFIER tvec3<T, P> unProject
- (
- tvec3<T, P> const & win,
- tmat4x4<T, P> const & model,
- tmat4x4<T, P> const & proj,
- tvec4<U, P> const & viewport
- )
+ template<typename T, typename U, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<3, T, Q> projectNO(vec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport)
{
- tmat4x4<T, P> Inverse = inverse(proj * model);
+ vec<4, T, Q> tmp = vec<4, T, Q>(obj, static_cast<T>(1));
+ tmp = model * tmp;
+ tmp = proj * tmp;
- tvec4<T, P> tmp = tvec4<T, P>(win, T(1));
- tmp.x = (tmp.x - T(viewport[0])) / T(viewport[2]);
- tmp.y = (tmp.y - T(viewport[1])) / T(viewport[3]);
+ tmp /= tmp.w;
+ tmp = tmp * static_cast<T>(0.5) + static_cast<T>(0.5);
+ tmp[0] = tmp[0] * T(viewport[2]) + T(viewport[0]);
+ tmp[1] = tmp[1] * T(viewport[3]) + T(viewport[1]);
+
+ return vec<3, T, Q>(tmp);
+ }
+
+ template<typename T, typename U, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<3, T, Q> project(vec<3, T, Q> const& obj, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport)
+ {
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
- tmp.x = tmp.x * static_cast<T>(2) - static_cast<T>(1);
- tmp.y = tmp.y * static_cast<T>(2) - static_cast<T>(1);
+ return projectZO(obj, model, proj, viewport);
# else
- tmp = tmp * static_cast<T>(2) - static_cast<T>(1);
+ return projectNO(obj, model, proj, viewport);
# endif
+ }
+
+ template<typename T, typename U, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<3, T, Q> unProjectZO(vec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport)
+ {
+ mat<4, 4, T, Q> Inverse = inverse(proj * model);
+
+ vec<4, T, Q> tmp = vec<4, T, Q>(win, T(1));
+ tmp.x = (tmp.x - T(viewport[0])) / T(viewport[2]);
+ tmp.y = (tmp.y - T(viewport[1])) / T(viewport[3]);
+ tmp.x = tmp.x * static_cast<T>(2) - static_cast<T>(1);
+ tmp.y = tmp.y * static_cast<T>(2) - static_cast<T>(1);
+
+ vec<4, T, Q> obj = Inverse * tmp;
+ obj /= obj.w;
+
+ return vec<3, T, Q>(obj);
+ }
+
+ template<typename T, typename U, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<3, T, Q> unProjectNO(vec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport)
+ {
+ mat<4, 4, T, Q> Inverse = inverse(proj * model);
+
+ vec<4, T, Q> tmp = vec<4, T, Q>(win, T(1));
+ tmp.x = (tmp.x - T(viewport[0])) / T(viewport[2]);
+ tmp.y = (tmp.y - T(viewport[1])) / T(viewport[3]);
+ tmp = tmp * static_cast<T>(2) - static_cast<T>(1);
- tvec4<T, P> obj = Inverse * tmp;
+ vec<4, T, Q> obj = Inverse * tmp;
obj /= obj.w;
- return tvec3<T, P>(obj);
+ return vec<3, T, Q>(obj);
+ }
+
+ template<typename T, typename U, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<3, T, Q> unProject(vec<3, T, Q> const& win, mat<4, 4, T, Q> const& model, mat<4, 4, T, Q> const& proj, vec<4, U, Q> const& viewport)
+ {
+# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
+ return unProjectZO(win, model, proj, viewport);
+# else
+ return unProjectNO(win, model, proj, viewport);
+# endif
}
- template <typename T, precision P, typename U>
- GLM_FUNC_QUALIFIER tmat4x4<T, P> pickMatrix(tvec2<T, P> const & center, tvec2<T, P> const & delta, tvec4<U, P> const & viewport)
+ template<typename T, qualifier Q, typename U>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> pickMatrix(vec<2, T, Q> const& center, vec<2, T, Q> const& delta, vec<4, U, Q> const& viewport)
{
assert(delta.x > static_cast<T>(0) && delta.y > static_cast<T>(0));
- tmat4x4<T, P> Result(static_cast<T>(1));
+ mat<4, 4, T, Q> Result(static_cast<T>(1));
if(!(delta.x > static_cast<T>(0) && delta.y > static_cast<T>(0)))
return Result; // Error
- tvec3<T, P> Temp(
+ vec<3, T, Q> Temp(
(static_cast<T>(viewport[2]) - static_cast<T>(2) * (center.x - static_cast<T>(viewport[0]))) / delta.x,
(static_cast<T>(viewport[3]) - static_cast<T>(2) * (center.y - static_cast<T>(viewport[1]))) / delta.y,
static_cast<T>(0));
// Translate and scale the picked region to the entire window
Result = translate(Result, Temp);
- return scale(Result, tvec3<T, P>(static_cast<T>(viewport[2]) / delta.x, static_cast<T>(viewport[3]) / delta.y, static_cast<T>(1)));
+ return scale(Result, vec<3, T, Q>(static_cast<T>(viewport[2]) / delta.x, static_cast<T>(viewport[3]) / delta.y, static_cast<T>(1)));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat4x4<T, P> lookAt(tvec3<T, P> const & eye, tvec3<T, P> const & center, tvec3<T, P> const & up)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> lookAtRH(vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up)
{
-# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
- return lookAtLH(eye, center, up);
-# else
- return lookAtRH(eye, center, up);
-# endif
- }
-
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat4x4<T, P> lookAtRH
- (
- tvec3<T, P> const & eye,
- tvec3<T, P> const & center,
- tvec3<T, P> const & up
- )
- {
- tvec3<T, P> const f(normalize(center - eye));
- tvec3<T, P> const s(normalize(cross(f, up)));
- tvec3<T, P> const u(cross(s, f));
+ vec<3, T, Q> const f(normalize(center - eye));
+ vec<3, T, Q> const s(normalize(cross(f, up)));
+ vec<3, T, Q> const u(cross(s, f));
- tmat4x4<T, P> Result(1);
+ mat<4, 4, T, Q> Result(1);
Result[0][0] = s.x;
Result[1][0] = s.y;
Result[2][0] = s.z;
@@ -545,19 +773,14 @@ namespace glm
return Result;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat4x4<T, P> lookAtLH
- (
- tvec3<T, P> const & eye,
- tvec3<T, P> const & center,
- tvec3<T, P> const & up
- )
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> lookAtLH(vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up)
{
- tvec3<T, P> const f(normalize(center - eye));
- tvec3<T, P> const s(normalize(cross(up, f)));
- tvec3<T, P> const u(cross(f, s));
+ vec<3, T, Q> const f(normalize(center - eye));
+ vec<3, T, Q> const s(normalize(cross(up, f)));
+ vec<3, T, Q> const u(cross(f, s));
- tmat4x4<T, P> Result(1);
+ mat<4, 4, T, Q> Result(1);
Result[0][0] = s.x;
Result[1][0] = s.y;
Result[2][0] = s.z;
@@ -572,4 +795,14 @@ namespace glm
Result[3][2] = -dot(f, eye);
return Result;
}
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> lookAt(vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up)
+ {
+# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
+ return lookAtLH(eye, center, up);
+# else
+ return lookAtRH(eye, center, up);
+# endif
+ }
}//namespace glm
diff --git a/external/include/glm/gtc/noise.hpp b/external/include/glm/gtc/noise.hpp
index aec4f18..7b1ca40 100644
--- a/external/include/glm/gtc/noise.hpp
+++ b/external/include/glm/gtc/noise.hpp
@@ -6,18 +6,19 @@
/// @defgroup gtc_noise GLM_GTC_noise
/// @ingroup gtc
///
-/// Defines 2D, 3D and 4D procedural noise functions
-/// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise":
-/// https://github.com/ashima/webgl-noise
-/// Following Stefan Gustavson's paper "Simplex noise demystified":
+/// Include <glm/gtc/noise.hpp> to use the features of this extension.
+///
+/// Defines 2D, 3D and 4D procedural noise functions
+/// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise":
+/// https://github.com/ashima/webgl-noise
+/// Following Stefan Gustavson's paper "Simplex noise demystified":
/// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
-/// <glm/gtc/noise.hpp> need to be included to use these functionalities.
#pragma once
// Dependencies
#include "../detail/setup.hpp"
-#include "../detail/precision.hpp"
+#include "../detail/qualifier.hpp"
#include "../detail/_noise.hpp"
#include "../geometric.hpp"
#include "../common.hpp"
@@ -37,22 +38,22 @@ namespace glm
/// Classic perlin noise.
/// @see gtc_noise
- template <typename T, precision P, template<typename, precision> class vecType>
+ template<length_t L, typename T, qualifier Q>
GLM_FUNC_DECL T perlin(
- vecType<T, P> const & p);
-
+ vec<L, T, Q> const& p);
+
/// Periodic perlin noise.
/// @see gtc_noise
- template <typename T, precision P, template<typename, precision> class vecType>
+ template<length_t L, typename T, qualifier Q>
GLM_FUNC_DECL T perlin(
- vecType<T, P> const & p,
- vecType<T, P> const & rep);
+ vec<L, T, Q> const& p,
+ vec<L, T, Q> const& rep);
/// Simplex noise.
/// @see gtc_noise
- template <typename T, precision P, template<typename, precision> class vecType>
+ template<length_t L, typename T, qualifier Q>
GLM_FUNC_DECL T simplex(
- vecType<T, P> const & p);
+ vec<L, T, Q> const& p);
/// @}
}//namespace glm
diff --git a/external/include/glm/gtc/noise.inl b/external/include/glm/gtc/noise.inl
index 4f2731c..00a80ab 100644
--- a/external/include/glm/gtc/noise.inl
+++ b/external/include/glm/gtc/noise.inl
@@ -1,643 +1,643 @@
/// @ref gtc_noise
/// @file glm/gtc/noise.inl
///
-// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise":
-// https://github.com/ashima/webgl-noise
-// Following Stefan Gustavson's paper "Simplex noise demystified":
+// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise":
+// https://github.com/ashima/webgl-noise
+// Following Stefan Gustavson's paper "Simplex noise demystified":
// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
namespace glm{
namespace gtc
{
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec4<T, P> grad4(T const & j, tvec4<T, P> const & ip)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, T, Q> grad4(T const& j, vec<4, T, Q> const& ip)
{
- tvec3<T, P> pXYZ = floor(fract(tvec3<T, P>(j) * tvec3<T, P>(ip)) * T(7)) * ip[2] - T(1);
- T pW = static_cast<T>(1.5) - dot(abs(pXYZ), tvec3<T, P>(1));
- tvec4<T, P> s = tvec4<T, P>(lessThan(tvec4<T, P>(pXYZ, pW), tvec4<T, P>(0.0)));
- pXYZ = pXYZ + (tvec3<T, P>(s) * T(2) - T(1)) * s.w;
- return tvec4<T, P>(pXYZ, pW);
+ vec<3, T, Q> pXYZ = floor(fract(vec<3, T, Q>(j) * vec<3, T, Q>(ip)) * T(7)) * ip[2] - T(1);
+ T pW = static_cast<T>(1.5) - dot(abs(pXYZ), vec<3, T, Q>(1));
+ vec<4, T, Q> s = vec<4, T, Q>(lessThan(vec<4, T, Q>(pXYZ, pW), vec<4, T, Q>(0.0)));
+ pXYZ = pXYZ + (vec<3, T, Q>(s) * T(2) - T(1)) * s.w;
+ return vec<4, T, Q>(pXYZ, pW);
}
}//namespace gtc
// Classic Perlin noise
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T perlin(tvec2<T, P> const & Position)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T perlin(vec<2, T, Q> const& Position)
{
- tvec4<T, P> Pi = glm::floor(tvec4<T, P>(Position.x, Position.y, Position.x, Position.y)) + tvec4<T, P>(0.0, 0.0, 1.0, 1.0);
- tvec4<T, P> Pf = glm::fract(tvec4<T, P>(Position.x, Position.y, Position.x, Position.y)) - tvec4<T, P>(0.0, 0.0, 1.0, 1.0);
- Pi = mod(Pi, tvec4<T, P>(289)); // To avoid truncation effects in permutation
- tvec4<T, P> ix(Pi.x, Pi.z, Pi.x, Pi.z);
- tvec4<T, P> iy(Pi.y, Pi.y, Pi.w, Pi.w);
- tvec4<T, P> fx(Pf.x, Pf.z, Pf.x, Pf.z);
- tvec4<T, P> fy(Pf.y, Pf.y, Pf.w, Pf.w);
-
- tvec4<T, P> i = detail::permute(detail::permute(ix) + iy);
-
- tvec4<T, P> gx = static_cast<T>(2) * glm::fract(i / T(41)) - T(1);
- tvec4<T, P> gy = glm::abs(gx) - T(0.5);
- tvec4<T, P> tx = glm::floor(gx + T(0.5));
+ vec<4, T, Q> Pi = glm::floor(vec<4, T, Q>(Position.x, Position.y, Position.x, Position.y)) + vec<4, T, Q>(0.0, 0.0, 1.0, 1.0);
+ vec<4, T, Q> Pf = glm::fract(vec<4, T, Q>(Position.x, Position.y, Position.x, Position.y)) - vec<4, T, Q>(0.0, 0.0, 1.0, 1.0);
+ Pi = mod(Pi, vec<4, T, Q>(289)); // To avoid truncation effects in permutation
+ vec<4, T, Q> ix(Pi.x, Pi.z, Pi.x, Pi.z);
+ vec<4, T, Q> iy(Pi.y, Pi.y, Pi.w, Pi.w);
+ vec<4, T, Q> fx(Pf.x, Pf.z, Pf.x, Pf.z);
+ vec<4, T, Q> fy(Pf.y, Pf.y, Pf.w, Pf.w);
+
+ vec<4, T, Q> i = detail::permute(detail::permute(ix) + iy);
+
+ vec<4, T, Q> gx = static_cast<T>(2) * glm::fract(i / T(41)) - T(1);
+ vec<4, T, Q> gy = glm::abs(gx) - T(0.5);
+ vec<4, T, Q> tx = glm::floor(gx + T(0.5));
gx = gx - tx;
- tvec2<T, P> g00(gx.x, gy.x);
- tvec2<T, P> g10(gx.y, gy.y);
- tvec2<T, P> g01(gx.z, gy.z);
- tvec2<T, P> g11(gx.w, gy.w);
+ vec<2, T, Q> g00(gx.x, gy.x);
+ vec<2, T, Q> g10(gx.y, gy.y);
+ vec<2, T, Q> g01(gx.z, gy.z);
+ vec<2, T, Q> g11(gx.w, gy.w);
- tvec4<T, P> norm = detail::taylorInvSqrt(tvec4<T, P>(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
+ vec<4, T, Q> norm = detail::taylorInvSqrt(vec<4, T, Q>(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
g00 *= norm.x;
g01 *= norm.y;
g10 *= norm.z;
g11 *= norm.w;
- T n00 = dot(g00, tvec2<T, P>(fx.x, fy.x));
- T n10 = dot(g10, tvec2<T, P>(fx.y, fy.y));
- T n01 = dot(g01, tvec2<T, P>(fx.z, fy.z));
- T n11 = dot(g11, tvec2<T, P>(fx.w, fy.w));
+ T n00 = dot(g00, vec<2, T, Q>(fx.x, fy.x));
+ T n10 = dot(g10, vec<2, T, Q>(fx.y, fy.y));
+ T n01 = dot(g01, vec<2, T, Q>(fx.z, fy.z));
+ T n11 = dot(g11, vec<2, T, Q>(fx.w, fy.w));
- tvec2<T, P> fade_xy = detail::fade(tvec2<T, P>(Pf.x, Pf.y));
- tvec2<T, P> n_x = mix(tvec2<T, P>(n00, n01), tvec2<T, P>(n10, n11), fade_xy.x);
+ vec<2, T, Q> fade_xy = detail::fade(vec<2, T, Q>(Pf.x, Pf.y));
+ vec<2, T, Q> n_x = mix(vec<2, T, Q>(n00, n01), vec<2, T, Q>(n10, n11), fade_xy.x);
T n_xy = mix(n_x.x, n_x.y, fade_xy.y);
return T(2.3) * n_xy;
}
// Classic Perlin noise
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T perlin(tvec3<T, P> const & Position)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T perlin(vec<3, T, Q> const& Position)
{
- tvec3<T, P> Pi0 = floor(Position); // Integer part for indexing
- tvec3<T, P> Pi1 = Pi0 + T(1); // Integer part + 1
+ vec<3, T, Q> Pi0 = floor(Position); // Integer part for indexing
+ vec<3, T, Q> Pi1 = Pi0 + T(1); // Integer part + 1
Pi0 = detail::mod289(Pi0);
Pi1 = detail::mod289(Pi1);
- tvec3<T, P> Pf0 = fract(Position); // Fractional part for interpolation
- tvec3<T, P> Pf1 = Pf0 - T(1); // Fractional part - 1.0
- tvec4<T, P> ix(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
- tvec4<T, P> iy = tvec4<T, P>(tvec2<T, P>(Pi0.y), tvec2<T, P>(Pi1.y));
- tvec4<T, P> iz0(Pi0.z);
- tvec4<T, P> iz1(Pi1.z);
-
- tvec4<T, P> ixy = detail::permute(detail::permute(ix) + iy);
- tvec4<T, P> ixy0 = detail::permute(ixy + iz0);
- tvec4<T, P> ixy1 = detail::permute(ixy + iz1);
-
- tvec4<T, P> gx0 = ixy0 * T(1.0 / 7.0);
- tvec4<T, P> gy0 = fract(floor(gx0) * T(1.0 / 7.0)) - T(0.5);
+ vec<3, T, Q> Pf0 = fract(Position); // Fractional part for interpolation
+ vec<3, T, Q> Pf1 = Pf0 - T(1); // Fractional part - 1.0
+ vec<4, T, Q> ix(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
+ vec<4, T, Q> iy = vec<4, T, Q>(vec<2, T, Q>(Pi0.y), vec<2, T, Q>(Pi1.y));
+ vec<4, T, Q> iz0(Pi0.z);
+ vec<4, T, Q> iz1(Pi1.z);
+
+ vec<4, T, Q> ixy = detail::permute(detail::permute(ix) + iy);
+ vec<4, T, Q> ixy0 = detail::permute(ixy + iz0);
+ vec<4, T, Q> ixy1 = detail::permute(ixy + iz1);
+
+ vec<4, T, Q> gx0 = ixy0 * T(1.0 / 7.0);
+ vec<4, T, Q> gy0 = fract(floor(gx0) * T(1.0 / 7.0)) - T(0.5);
gx0 = fract(gx0);
- tvec4<T, P> gz0 = tvec4<T, P>(0.5) - abs(gx0) - abs(gy0);
- tvec4<T, P> sz0 = step(gz0, tvec4<T, P>(0.0));
+ vec<4, T, Q> gz0 = vec<4, T, Q>(0.5) - abs(gx0) - abs(gy0);
+ vec<4, T, Q> sz0 = step(gz0, vec<4, T, Q>(0.0));
gx0 -= sz0 * (step(T(0), gx0) - T(0.5));
gy0 -= sz0 * (step(T(0), gy0) - T(0.5));
- tvec4<T, P> gx1 = ixy1 * T(1.0 / 7.0);
- tvec4<T, P> gy1 = fract(floor(gx1) * T(1.0 / 7.0)) - T(0.5);
+ vec<4, T, Q> gx1 = ixy1 * T(1.0 / 7.0);
+ vec<4, T, Q> gy1 = fract(floor(gx1) * T(1.0 / 7.0)) - T(0.5);
gx1 = fract(gx1);
- tvec4<T, P> gz1 = tvec4<T, P>(0.5) - abs(gx1) - abs(gy1);
- tvec4<T, P> sz1 = step(gz1, tvec4<T, P>(0.0));
+ vec<4, T, Q> gz1 = vec<4, T, Q>(0.5) - abs(gx1) - abs(gy1);
+ vec<4, T, Q> sz1 = step(gz1, vec<4, T, Q>(0.0));
gx1 -= sz1 * (step(T(0), gx1) - T(0.5));
gy1 -= sz1 * (step(T(0), gy1) - T(0.5));
- tvec3<T, P> g000(gx0.x, gy0.x, gz0.x);
- tvec3<T, P> g100(gx0.y, gy0.y, gz0.y);
- tvec3<T, P> g010(gx0.z, gy0.z, gz0.z);
- tvec3<T, P> g110(gx0.w, gy0.w, gz0.w);
- tvec3<T, P> g001(gx1.x, gy1.x, gz1.x);
- tvec3<T, P> g101(gx1.y, gy1.y, gz1.y);
- tvec3<T, P> g011(gx1.z, gy1.z, gz1.z);
- tvec3<T, P> g111(gx1.w, gy1.w, gz1.w);
+ vec<3, T, Q> g000(gx0.x, gy0.x, gz0.x);
+ vec<3, T, Q> g100(gx0.y, gy0.y, gz0.y);
+ vec<3, T, Q> g010(gx0.z, gy0.z, gz0.z);
+ vec<3, T, Q> g110(gx0.w, gy0.w, gz0.w);
+ vec<3, T, Q> g001(gx1.x, gy1.x, gz1.x);
+ vec<3, T, Q> g101(gx1.y, gy1.y, gz1.y);
+ vec<3, T, Q> g011(gx1.z, gy1.z, gz1.z);
+ vec<3, T, Q> g111(gx1.w, gy1.w, gz1.w);
- tvec4<T, P> norm0 = detail::taylorInvSqrt(tvec4<T, P>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
+ vec<4, T, Q> norm0 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
g000 *= norm0.x;
g010 *= norm0.y;
g100 *= norm0.z;
g110 *= norm0.w;
- tvec4<T, P> norm1 = detail::taylorInvSqrt(tvec4<T, P>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
+ vec<4, T, Q> norm1 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
g001 *= norm1.x;
g011 *= norm1.y;
g101 *= norm1.z;
g111 *= norm1.w;
T n000 = dot(g000, Pf0);
- T n100 = dot(g100, tvec3<T, P>(Pf1.x, Pf0.y, Pf0.z));
- T n010 = dot(g010, tvec3<T, P>(Pf0.x, Pf1.y, Pf0.z));
- T n110 = dot(g110, tvec3<T, P>(Pf1.x, Pf1.y, Pf0.z));
- T n001 = dot(g001, tvec3<T, P>(Pf0.x, Pf0.y, Pf1.z));
- T n101 = dot(g101, tvec3<T, P>(Pf1.x, Pf0.y, Pf1.z));
- T n011 = dot(g011, tvec3<T, P>(Pf0.x, Pf1.y, Pf1.z));
+ T n100 = dot(g100, vec<3, T, Q>(Pf1.x, Pf0.y, Pf0.z));
+ T n010 = dot(g010, vec<3, T, Q>(Pf0.x, Pf1.y, Pf0.z));
+ T n110 = dot(g110, vec<3, T, Q>(Pf1.x, Pf1.y, Pf0.z));
+ T n001 = dot(g001, vec<3, T, Q>(Pf0.x, Pf0.y, Pf1.z));
+ T n101 = dot(g101, vec<3, T, Q>(Pf1.x, Pf0.y, Pf1.z));
+ T n011 = dot(g011, vec<3, T, Q>(Pf0.x, Pf1.y, Pf1.z));
T n111 = dot(g111, Pf1);
- tvec3<T, P> fade_xyz = detail::fade(Pf0);
- tvec4<T, P> n_z = mix(tvec4<T, P>(n000, n100, n010, n110), tvec4<T, P>(n001, n101, n011, n111), fade_xyz.z);
- tvec2<T, P> n_yz = mix(tvec2<T, P>(n_z.x, n_z.y), tvec2<T, P>(n_z.z, n_z.w), fade_xyz.y);
- T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
+ vec<3, T, Q> fade_xyz = detail::fade(Pf0);
+ vec<4, T, Q> n_z = mix(vec<4, T, Q>(n000, n100, n010, n110), vec<4, T, Q>(n001, n101, n011, n111), fade_xyz.z);
+ vec<2, T, Q> n_yz = mix(vec<2, T, Q>(n_z.x, n_z.y), vec<2, T, Q>(n_z.z, n_z.w), fade_xyz.y);
+ T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
return T(2.2) * n_xyz;
}
/*
// Classic Perlin noise
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T perlin(tvec3<T, P> const & P)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T perlin(vec<3, T, Q> const& P)
{
- tvec3<T, P> Pi0 = floor(P); // Integer part for indexing
- tvec3<T, P> Pi1 = Pi0 + T(1); // Integer part + 1
+ vec<3, T, Q> Pi0 = floor(P); // Integer part for indexing
+ vec<3, T, Q> Pi1 = Pi0 + T(1); // Integer part + 1
Pi0 = mod(Pi0, T(289));
Pi1 = mod(Pi1, T(289));
- tvec3<T, P> Pf0 = fract(P); // Fractional part for interpolation
- tvec3<T, P> Pf1 = Pf0 - T(1); // Fractional part - 1.0
- tvec4<T, P> ix(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
- tvec4<T, P> iy(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
- tvec4<T, P> iz0(Pi0.z);
- tvec4<T, P> iz1(Pi1.z);
-
- tvec4<T, P> ixy = permute(permute(ix) + iy);
- tvec4<T, P> ixy0 = permute(ixy + iz0);
- tvec4<T, P> ixy1 = permute(ixy + iz1);
-
- tvec4<T, P> gx0 = ixy0 / T(7);
- tvec4<T, P> gy0 = fract(floor(gx0) / T(7)) - T(0.5);
+ vec<3, T, Q> Pf0 = fract(P); // Fractional part for interpolation
+ vec<3, T, Q> Pf1 = Pf0 - T(1); // Fractional part - 1.0
+ vec<4, T, Q> ix(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
+ vec<4, T, Q> iy(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
+ vec<4, T, Q> iz0(Pi0.z);
+ vec<4, T, Q> iz1(Pi1.z);
+
+ vec<4, T, Q> ixy = permute(permute(ix) + iy);
+ vec<4, T, Q> ixy0 = permute(ixy + iz0);
+ vec<4, T, Q> ixy1 = permute(ixy + iz1);
+
+ vec<4, T, Q> gx0 = ixy0 / T(7);
+ vec<4, T, Q> gy0 = fract(floor(gx0) / T(7)) - T(0.5);
gx0 = fract(gx0);
- tvec4<T, P> gz0 = tvec4<T, P>(0.5) - abs(gx0) - abs(gy0);
- tvec4<T, P> sz0 = step(gz0, tvec4<T, P>(0.0));
+ vec<4, T, Q> gz0 = vec<4, T, Q>(0.5) - abs(gx0) - abs(gy0);
+ vec<4, T, Q> sz0 = step(gz0, vec<4, T, Q>(0.0));
gx0 -= sz0 * (step(0.0, gx0) - T(0.5));
gy0 -= sz0 * (step(0.0, gy0) - T(0.5));
- tvec4<T, P> gx1 = ixy1 / T(7);
- tvec4<T, P> gy1 = fract(floor(gx1) / T(7)) - T(0.5);
+ vec<4, T, Q> gx1 = ixy1 / T(7);
+ vec<4, T, Q> gy1 = fract(floor(gx1) / T(7)) - T(0.5);
gx1 = fract(gx1);
- tvec4<T, P> gz1 = tvec4<T, P>(0.5) - abs(gx1) - abs(gy1);
- tvec4<T, P> sz1 = step(gz1, tvec4<T, P>(0.0));
+ vec<4, T, Q> gz1 = vec<4, T, Q>(0.5) - abs(gx1) - abs(gy1);
+ vec<4, T, Q> sz1 = step(gz1, vec<4, T, Q>(0.0));
gx1 -= sz1 * (step(T(0), gx1) - T(0.5));
gy1 -= sz1 * (step(T(0), gy1) - T(0.5));
- tvec3<T, P> g000(gx0.x, gy0.x, gz0.x);
- tvec3<T, P> g100(gx0.y, gy0.y, gz0.y);
- tvec3<T, P> g010(gx0.z, gy0.z, gz0.z);
- tvec3<T, P> g110(gx0.w, gy0.w, gz0.w);
- tvec3<T, P> g001(gx1.x, gy1.x, gz1.x);
- tvec3<T, P> g101(gx1.y, gy1.y, gz1.y);
- tvec3<T, P> g011(gx1.z, gy1.z, gz1.z);
- tvec3<T, P> g111(gx1.w, gy1.w, gz1.w);
+ vec<3, T, Q> g000(gx0.x, gy0.x, gz0.x);
+ vec<3, T, Q> g100(gx0.y, gy0.y, gz0.y);
+ vec<3, T, Q> g010(gx0.z, gy0.z, gz0.z);
+ vec<3, T, Q> g110(gx0.w, gy0.w, gz0.w);
+ vec<3, T, Q> g001(gx1.x, gy1.x, gz1.x);
+ vec<3, T, Q> g101(gx1.y, gy1.y, gz1.y);
+ vec<3, T, Q> g011(gx1.z, gy1.z, gz1.z);
+ vec<3, T, Q> g111(gx1.w, gy1.w, gz1.w);
- tvec4<T, P> norm0 = taylorInvSqrt(tvec4<T, P>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
+ vec<4, T, Q> norm0 = taylorInvSqrt(vec<4, T, Q>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
g000 *= norm0.x;
g010 *= norm0.y;
g100 *= norm0.z;
g110 *= norm0.w;
- tvec4<T, P> norm1 = taylorInvSqrt(tvec4<T, P>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
+ vec<4, T, Q> norm1 = taylorInvSqrt(vec<4, T, Q>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
g001 *= norm1.x;
g011 *= norm1.y;
g101 *= norm1.z;
g111 *= norm1.w;
T n000 = dot(g000, Pf0);
- T n100 = dot(g100, tvec3<T, P>(Pf1.x, Pf0.y, Pf0.z));
- T n010 = dot(g010, tvec3<T, P>(Pf0.x, Pf1.y, Pf0.z));
- T n110 = dot(g110, tvec3<T, P>(Pf1.x, Pf1.y, Pf0.z));
- T n001 = dot(g001, tvec3<T, P>(Pf0.x, Pf0.y, Pf1.z));
- T n101 = dot(g101, tvec3<T, P>(Pf1.x, Pf0.y, Pf1.z));
- T n011 = dot(g011, tvec3<T, P>(Pf0.x, Pf1.y, Pf1.z));
+ T n100 = dot(g100, vec<3, T, Q>(Pf1.x, Pf0.y, Pf0.z));
+ T n010 = dot(g010, vec<3, T, Q>(Pf0.x, Pf1.y, Pf0.z));
+ T n110 = dot(g110, vec<3, T, Q>(Pf1.x, Pf1.y, Pf0.z));
+ T n001 = dot(g001, vec<3, T, Q>(Pf0.x, Pf0.y, Pf1.z));
+ T n101 = dot(g101, vec<3, T, Q>(Pf1.x, Pf0.y, Pf1.z));
+ T n011 = dot(g011, vec<3, T, Q>(Pf0.x, Pf1.y, Pf1.z));
T n111 = dot(g111, Pf1);
- tvec3<T, P> fade_xyz = fade(Pf0);
- tvec4<T, P> n_z = mix(tvec4<T, P>(n000, n100, n010, n110), tvec4<T, P>(n001, n101, n011, n111), fade_xyz.z);
- tvec2<T, P> n_yz = mix(
- tvec2<T, P>(n_z.x, n_z.y),
- tvec2<T, P>(n_z.z, n_z.w), fade_xyz.y);
- T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
+ vec<3, T, Q> fade_xyz = fade(Pf0);
+ vec<4, T, Q> n_z = mix(vec<4, T, Q>(n000, n100, n010, n110), vec<4, T, Q>(n001, n101, n011, n111), fade_xyz.z);
+ vec<2, T, Q> n_yz = mix(
+ vec<2, T, Q>(n_z.x, n_z.y),
+ vec<2, T, Q>(n_z.z, n_z.w), fade_xyz.y);
+ T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
return T(2.2) * n_xyz;
}
*/
// Classic Perlin noise
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T perlin(tvec4<T, P> const & Position)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T perlin(vec<4, T, Q> const& Position)
{
- tvec4<T, P> Pi0 = floor(Position); // Integer part for indexing
- tvec4<T, P> Pi1 = Pi0 + T(1); // Integer part + 1
- Pi0 = mod(Pi0, tvec4<T, P>(289));
- Pi1 = mod(Pi1, tvec4<T, P>(289));
- tvec4<T, P> Pf0 = fract(Position); // Fractional part for interpolation
- tvec4<T, P> Pf1 = Pf0 - T(1); // Fractional part - 1.0
- tvec4<T, P> ix(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
- tvec4<T, P> iy(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
- tvec4<T, P> iz0(Pi0.z);
- tvec4<T, P> iz1(Pi1.z);
- tvec4<T, P> iw0(Pi0.w);
- tvec4<T, P> iw1(Pi1.w);
-
- tvec4<T, P> ixy = detail::permute(detail::permute(ix) + iy);
- tvec4<T, P> ixy0 = detail::permute(ixy + iz0);
- tvec4<T, P> ixy1 = detail::permute(ixy + iz1);
- tvec4<T, P> ixy00 = detail::permute(ixy0 + iw0);
- tvec4<T, P> ixy01 = detail::permute(ixy0 + iw1);
- tvec4<T, P> ixy10 = detail::permute(ixy1 + iw0);
- tvec4<T, P> ixy11 = detail::permute(ixy1 + iw1);
-
- tvec4<T, P> gx00 = ixy00 / T(7);
- tvec4<T, P> gy00 = floor(gx00) / T(7);
- tvec4<T, P> gz00 = floor(gy00) / T(6);
+ vec<4, T, Q> Pi0 = floor(Position); // Integer part for indexing
+ vec<4, T, Q> Pi1 = Pi0 + T(1); // Integer part + 1
+ Pi0 = mod(Pi0, vec<4, T, Q>(289));
+ Pi1 = mod(Pi1, vec<4, T, Q>(289));
+ vec<4, T, Q> Pf0 = fract(Position); // Fractional part for interpolation
+ vec<4, T, Q> Pf1 = Pf0 - T(1); // Fractional part - 1.0
+ vec<4, T, Q> ix(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
+ vec<4, T, Q> iy(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
+ vec<4, T, Q> iz0(Pi0.z);
+ vec<4, T, Q> iz1(Pi1.z);
+ vec<4, T, Q> iw0(Pi0.w);
+ vec<4, T, Q> iw1(Pi1.w);
+
+ vec<4, T, Q> ixy = detail::permute(detail::permute(ix) + iy);
+ vec<4, T, Q> ixy0 = detail::permute(ixy + iz0);
+ vec<4, T, Q> ixy1 = detail::permute(ixy + iz1);
+ vec<4, T, Q> ixy00 = detail::permute(ixy0 + iw0);
+ vec<4, T, Q> ixy01 = detail::permute(ixy0 + iw1);
+ vec<4, T, Q> ixy10 = detail::permute(ixy1 + iw0);
+ vec<4, T, Q> ixy11 = detail::permute(ixy1 + iw1);
+
+ vec<4, T, Q> gx00 = ixy00 / T(7);
+ vec<4, T, Q> gy00 = floor(gx00) / T(7);
+ vec<4, T, Q> gz00 = floor(gy00) / T(6);
gx00 = fract(gx00) - T(0.5);
gy00 = fract(gy00) - T(0.5);
gz00 = fract(gz00) - T(0.5);
- tvec4<T, P> gw00 = tvec4<T, P>(0.75) - abs(gx00) - abs(gy00) - abs(gz00);
- tvec4<T, P> sw00 = step(gw00, tvec4<T, P>(0.0));
+ vec<4, T, Q> gw00 = vec<4, T, Q>(0.75) - abs(gx00) - abs(gy00) - abs(gz00);
+ vec<4, T, Q> sw00 = step(gw00, vec<4, T, Q>(0.0));
gx00 -= sw00 * (step(T(0), gx00) - T(0.5));
gy00 -= sw00 * (step(T(0), gy00) - T(0.5));
- tvec4<T, P> gx01 = ixy01 / T(7);
- tvec4<T, P> gy01 = floor(gx01) / T(7);
- tvec4<T, P> gz01 = floor(gy01) / T(6);
+ vec<4, T, Q> gx01 = ixy01 / T(7);
+ vec<4, T, Q> gy01 = floor(gx01) / T(7);
+ vec<4, T, Q> gz01 = floor(gy01) / T(6);
gx01 = fract(gx01) - T(0.5);
gy01 = fract(gy01) - T(0.5);
gz01 = fract(gz01) - T(0.5);
- tvec4<T, P> gw01 = tvec4<T, P>(0.75) - abs(gx01) - abs(gy01) - abs(gz01);
- tvec4<T, P> sw01 = step(gw01, tvec4<T, P>(0.0));
+ vec<4, T, Q> gw01 = vec<4, T, Q>(0.75) - abs(gx01) - abs(gy01) - abs(gz01);
+ vec<4, T, Q> sw01 = step(gw01, vec<4, T, Q>(0.0));
gx01 -= sw01 * (step(T(0), gx01) - T(0.5));
gy01 -= sw01 * (step(T(0), gy01) - T(0.5));
- tvec4<T, P> gx10 = ixy10 / T(7);
- tvec4<T, P> gy10 = floor(gx10) / T(7);
- tvec4<T, P> gz10 = floor(gy10) / T(6);
+ vec<4, T, Q> gx10 = ixy10 / T(7);
+ vec<4, T, Q> gy10 = floor(gx10) / T(7);
+ vec<4, T, Q> gz10 = floor(gy10) / T(6);
gx10 = fract(gx10) - T(0.5);
gy10 = fract(gy10) - T(0.5);
gz10 = fract(gz10) - T(0.5);
- tvec4<T, P> gw10 = tvec4<T, P>(0.75) - abs(gx10) - abs(gy10) - abs(gz10);
- tvec4<T, P> sw10 = step(gw10, tvec4<T, P>(0));
+ vec<4, T, Q> gw10 = vec<4, T, Q>(0.75) - abs(gx10) - abs(gy10) - abs(gz10);
+ vec<4, T, Q> sw10 = step(gw10, vec<4, T, Q>(0));
gx10 -= sw10 * (step(T(0), gx10) - T(0.5));
gy10 -= sw10 * (step(T(0), gy10) - T(0.5));
- tvec4<T, P> gx11 = ixy11 / T(7);
- tvec4<T, P> gy11 = floor(gx11) / T(7);
- tvec4<T, P> gz11 = floor(gy11) / T(6);
+ vec<4, T, Q> gx11 = ixy11 / T(7);
+ vec<4, T, Q> gy11 = floor(gx11) / T(7);
+ vec<4, T, Q> gz11 = floor(gy11) / T(6);
gx11 = fract(gx11) - T(0.5);
gy11 = fract(gy11) - T(0.5);
gz11 = fract(gz11) - T(0.5);
- tvec4<T, P> gw11 = tvec4<T, P>(0.75) - abs(gx11) - abs(gy11) - abs(gz11);
- tvec4<T, P> sw11 = step(gw11, tvec4<T, P>(0.0));
+ vec<4, T, Q> gw11 = vec<4, T, Q>(0.75) - abs(gx11) - abs(gy11) - abs(gz11);
+ vec<4, T, Q> sw11 = step(gw11, vec<4, T, Q>(0.0));
gx11 -= sw11 * (step(T(0), gx11) - T(0.5));
gy11 -= sw11 * (step(T(0), gy11) - T(0.5));
- tvec4<T, P> g0000(gx00.x, gy00.x, gz00.x, gw00.x);
- tvec4<T, P> g1000(gx00.y, gy00.y, gz00.y, gw00.y);
- tvec4<T, P> g0100(gx00.z, gy00.z, gz00.z, gw00.z);
- tvec4<T, P> g1100(gx00.w, gy00.w, gz00.w, gw00.w);
- tvec4<T, P> g0010(gx10.x, gy10.x, gz10.x, gw10.x);
- tvec4<T, P> g1010(gx10.y, gy10.y, gz10.y, gw10.y);
- tvec4<T, P> g0110(gx10.z, gy10.z, gz10.z, gw10.z);
- tvec4<T, P> g1110(gx10.w, gy10.w, gz10.w, gw10.w);
- tvec4<T, P> g0001(gx01.x, gy01.x, gz01.x, gw01.x);
- tvec4<T, P> g1001(gx01.y, gy01.y, gz01.y, gw01.y);
- tvec4<T, P> g0101(gx01.z, gy01.z, gz01.z, gw01.z);
- tvec4<T, P> g1101(gx01.w, gy01.w, gz01.w, gw01.w);
- tvec4<T, P> g0011(gx11.x, gy11.x, gz11.x, gw11.x);
- tvec4<T, P> g1011(gx11.y, gy11.y, gz11.y, gw11.y);
- tvec4<T, P> g0111(gx11.z, gy11.z, gz11.z, gw11.z);
- tvec4<T, P> g1111(gx11.w, gy11.w, gz11.w, gw11.w);
-
- tvec4<T, P> norm00 = detail::taylorInvSqrt(tvec4<T, P>(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
+ vec<4, T, Q> g0000(gx00.x, gy00.x, gz00.x, gw00.x);
+ vec<4, T, Q> g1000(gx00.y, gy00.y, gz00.y, gw00.y);
+ vec<4, T, Q> g0100(gx00.z, gy00.z, gz00.z, gw00.z);
+ vec<4, T, Q> g1100(gx00.w, gy00.w, gz00.w, gw00.w);
+ vec<4, T, Q> g0010(gx10.x, gy10.x, gz10.x, gw10.x);
+ vec<4, T, Q> g1010(gx10.y, gy10.y, gz10.y, gw10.y);
+ vec<4, T, Q> g0110(gx10.z, gy10.z, gz10.z, gw10.z);
+ vec<4, T, Q> g1110(gx10.w, gy10.w, gz10.w, gw10.w);
+ vec<4, T, Q> g0001(gx01.x, gy01.x, gz01.x, gw01.x);
+ vec<4, T, Q> g1001(gx01.y, gy01.y, gz01.y, gw01.y);
+ vec<4, T, Q> g0101(gx01.z, gy01.z, gz01.z, gw01.z);
+ vec<4, T, Q> g1101(gx01.w, gy01.w, gz01.w, gw01.w);
+ vec<4, T, Q> g0011(gx11.x, gy11.x, gz11.x, gw11.x);
+ vec<4, T, Q> g1011(gx11.y, gy11.y, gz11.y, gw11.y);
+ vec<4, T, Q> g0111(gx11.z, gy11.z, gz11.z, gw11.z);
+ vec<4, T, Q> g1111(gx11.w, gy11.w, gz11.w, gw11.w);
+
+ vec<4, T, Q> norm00 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
g0000 *= norm00.x;
g0100 *= norm00.y;
g1000 *= norm00.z;
g1100 *= norm00.w;
- tvec4<T, P> norm01 = detail::taylorInvSqrt(tvec4<T, P>(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
+ vec<4, T, Q> norm01 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
g0001 *= norm01.x;
g0101 *= norm01.y;
g1001 *= norm01.z;
g1101 *= norm01.w;
- tvec4<T, P> norm10 = detail::taylorInvSqrt(tvec4<T, P>(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));
+ vec<4, T, Q> norm10 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));
g0010 *= norm10.x;
g0110 *= norm10.y;
g1010 *= norm10.z;
g1110 *= norm10.w;
- tvec4<T, P> norm11 = detail::taylorInvSqrt(tvec4<T, P>(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));
+ vec<4, T, Q> norm11 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));
g0011 *= norm11.x;
g0111 *= norm11.y;
g1011 *= norm11.z;
g1111 *= norm11.w;
T n0000 = dot(g0000, Pf0);
- T n1000 = dot(g1000, tvec4<T, P>(Pf1.x, Pf0.y, Pf0.z, Pf0.w));
- T n0100 = dot(g0100, tvec4<T, P>(Pf0.x, Pf1.y, Pf0.z, Pf0.w));
- T n1100 = dot(g1100, tvec4<T, P>(Pf1.x, Pf1.y, Pf0.z, Pf0.w));
- T n0010 = dot(g0010, tvec4<T, P>(Pf0.x, Pf0.y, Pf1.z, Pf0.w));
- T n1010 = dot(g1010, tvec4<T, P>(Pf1.x, Pf0.y, Pf1.z, Pf0.w));
- T n0110 = dot(g0110, tvec4<T, P>(Pf0.x, Pf1.y, Pf1.z, Pf0.w));
- T n1110 = dot(g1110, tvec4<T, P>(Pf1.x, Pf1.y, Pf1.z, Pf0.w));
- T n0001 = dot(g0001, tvec4<T, P>(Pf0.x, Pf0.y, Pf0.z, Pf1.w));
- T n1001 = dot(g1001, tvec4<T, P>(Pf1.x, Pf0.y, Pf0.z, Pf1.w));
- T n0101 = dot(g0101, tvec4<T, P>(Pf0.x, Pf1.y, Pf0.z, Pf1.w));
- T n1101 = dot(g1101, tvec4<T, P>(Pf1.x, Pf1.y, Pf0.z, Pf1.w));
- T n0011 = dot(g0011, tvec4<T, P>(Pf0.x, Pf0.y, Pf1.z, Pf1.w));
- T n1011 = dot(g1011, tvec4<T, P>(Pf1.x, Pf0.y, Pf1.z, Pf1.w));
- T n0111 = dot(g0111, tvec4<T, P>(Pf0.x, Pf1.y, Pf1.z, Pf1.w));
+ T n1000 = dot(g1000, vec<4, T, Q>(Pf1.x, Pf0.y, Pf0.z, Pf0.w));
+ T n0100 = dot(g0100, vec<4, T, Q>(Pf0.x, Pf1.y, Pf0.z, Pf0.w));
+ T n1100 = dot(g1100, vec<4, T, Q>(Pf1.x, Pf1.y, Pf0.z, Pf0.w));
+ T n0010 = dot(g0010, vec<4, T, Q>(Pf0.x, Pf0.y, Pf1.z, Pf0.w));
+ T n1010 = dot(g1010, vec<4, T, Q>(Pf1.x, Pf0.y, Pf1.z, Pf0.w));
+ T n0110 = dot(g0110, vec<4, T, Q>(Pf0.x, Pf1.y, Pf1.z, Pf0.w));
+ T n1110 = dot(g1110, vec<4, T, Q>(Pf1.x, Pf1.y, Pf1.z, Pf0.w));
+ T n0001 = dot(g0001, vec<4, T, Q>(Pf0.x, Pf0.y, Pf0.z, Pf1.w));
+ T n1001 = dot(g1001, vec<4, T, Q>(Pf1.x, Pf0.y, Pf0.z, Pf1.w));
+ T n0101 = dot(g0101, vec<4, T, Q>(Pf0.x, Pf1.y, Pf0.z, Pf1.w));
+ T n1101 = dot(g1101, vec<4, T, Q>(Pf1.x, Pf1.y, Pf0.z, Pf1.w));
+ T n0011 = dot(g0011, vec<4, T, Q>(Pf0.x, Pf0.y, Pf1.z, Pf1.w));
+ T n1011 = dot(g1011, vec<4, T, Q>(Pf1.x, Pf0.y, Pf1.z, Pf1.w));
+ T n0111 = dot(g0111, vec<4, T, Q>(Pf0.x, Pf1.y, Pf1.z, Pf1.w));
T n1111 = dot(g1111, Pf1);
- tvec4<T, P> fade_xyzw = detail::fade(Pf0);
- tvec4<T, P> n_0w = mix(tvec4<T, P>(n0000, n1000, n0100, n1100), tvec4<T, P>(n0001, n1001, n0101, n1101), fade_xyzw.w);
- tvec4<T, P> n_1w = mix(tvec4<T, P>(n0010, n1010, n0110, n1110), tvec4<T, P>(n0011, n1011, n0111, n1111), fade_xyzw.w);
- tvec4<T, P> n_zw = mix(n_0w, n_1w, fade_xyzw.z);
- tvec2<T, P> n_yzw = mix(tvec2<T, P>(n_zw.x, n_zw.y), tvec2<T, P>(n_zw.z, n_zw.w), fade_xyzw.y);
+ vec<4, T, Q> fade_xyzw = detail::fade(Pf0);
+ vec<4, T, Q> n_0w = mix(vec<4, T, Q>(n0000, n1000, n0100, n1100), vec<4, T, Q>(n0001, n1001, n0101, n1101), fade_xyzw.w);
+ vec<4, T, Q> n_1w = mix(vec<4, T, Q>(n0010, n1010, n0110, n1110), vec<4, T, Q>(n0011, n1011, n0111, n1111), fade_xyzw.w);
+ vec<4, T, Q> n_zw = mix(n_0w, n_1w, fade_xyzw.z);
+ vec<2, T, Q> n_yzw = mix(vec<2, T, Q>(n_zw.x, n_zw.y), vec<2, T, Q>(n_zw.z, n_zw.w), fade_xyzw.y);
T n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x);
return T(2.2) * n_xyzw;
}
// Classic Perlin noise, periodic variant
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T perlin(tvec2<T, P> const & Position, tvec2<T, P> const & rep)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T perlin(vec<2, T, Q> const& Position, vec<2, T, Q> const& rep)
{
- tvec4<T, P> Pi = floor(tvec4<T, P>(Position.x, Position.y, Position.x, Position.y)) + tvec4<T, P>(0.0, 0.0, 1.0, 1.0);
- tvec4<T, P> Pf = fract(tvec4<T, P>(Position.x, Position.y, Position.x, Position.y)) - tvec4<T, P>(0.0, 0.0, 1.0, 1.0);
- Pi = mod(Pi, tvec4<T, P>(rep.x, rep.y, rep.x, rep.y)); // To create noise with explicit period
- Pi = mod(Pi, tvec4<T, P>(289)); // To avoid truncation effects in permutation
- tvec4<T, P> ix(Pi.x, Pi.z, Pi.x, Pi.z);
- tvec4<T, P> iy(Pi.y, Pi.y, Pi.w, Pi.w);
- tvec4<T, P> fx(Pf.x, Pf.z, Pf.x, Pf.z);
- tvec4<T, P> fy(Pf.y, Pf.y, Pf.w, Pf.w);
-
- tvec4<T, P> i = detail::permute(detail::permute(ix) + iy);
-
- tvec4<T, P> gx = static_cast<T>(2) * fract(i / T(41)) - T(1);
- tvec4<T, P> gy = abs(gx) - T(0.5);
- tvec4<T, P> tx = floor(gx + T(0.5));
+ vec<4, T, Q> Pi = floor(vec<4, T, Q>(Position.x, Position.y, Position.x, Position.y)) + vec<4, T, Q>(0.0, 0.0, 1.0, 1.0);
+ vec<4, T, Q> Pf = fract(vec<4, T, Q>(Position.x, Position.y, Position.x, Position.y)) - vec<4, T, Q>(0.0, 0.0, 1.0, 1.0);
+ Pi = mod(Pi, vec<4, T, Q>(rep.x, rep.y, rep.x, rep.y)); // To create noise with explicit period
+ Pi = mod(Pi, vec<4, T, Q>(289)); // To avoid truncation effects in permutation
+ vec<4, T, Q> ix(Pi.x, Pi.z, Pi.x, Pi.z);
+ vec<4, T, Q> iy(Pi.y, Pi.y, Pi.w, Pi.w);
+ vec<4, T, Q> fx(Pf.x, Pf.z, Pf.x, Pf.z);
+ vec<4, T, Q> fy(Pf.y, Pf.y, Pf.w, Pf.w);
+
+ vec<4, T, Q> i = detail::permute(detail::permute(ix) + iy);
+
+ vec<4, T, Q> gx = static_cast<T>(2) * fract(i / T(41)) - T(1);
+ vec<4, T, Q> gy = abs(gx) - T(0.5);
+ vec<4, T, Q> tx = floor(gx + T(0.5));
gx = gx - tx;
- tvec2<T, P> g00(gx.x, gy.x);
- tvec2<T, P> g10(gx.y, gy.y);
- tvec2<T, P> g01(gx.z, gy.z);
- tvec2<T, P> g11(gx.w, gy.w);
+ vec<2, T, Q> g00(gx.x, gy.x);
+ vec<2, T, Q> g10(gx.y, gy.y);
+ vec<2, T, Q> g01(gx.z, gy.z);
+ vec<2, T, Q> g11(gx.w, gy.w);
- tvec4<T, P> norm = detail::taylorInvSqrt(tvec4<T, P>(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
+ vec<4, T, Q> norm = detail::taylorInvSqrt(vec<4, T, Q>(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11)));
g00 *= norm.x;
g01 *= norm.y;
g10 *= norm.z;
g11 *= norm.w;
- T n00 = dot(g00, tvec2<T, P>(fx.x, fy.x));
- T n10 = dot(g10, tvec2<T, P>(fx.y, fy.y));
- T n01 = dot(g01, tvec2<T, P>(fx.z, fy.z));
- T n11 = dot(g11, tvec2<T, P>(fx.w, fy.w));
+ T n00 = dot(g00, vec<2, T, Q>(fx.x, fy.x));
+ T n10 = dot(g10, vec<2, T, Q>(fx.y, fy.y));
+ T n01 = dot(g01, vec<2, T, Q>(fx.z, fy.z));
+ T n11 = dot(g11, vec<2, T, Q>(fx.w, fy.w));
- tvec2<T, P> fade_xy = detail::fade(tvec2<T, P>(Pf.x, Pf.y));
- tvec2<T, P> n_x = mix(tvec2<T, P>(n00, n01), tvec2<T, P>(n10, n11), fade_xy.x);
+ vec<2, T, Q> fade_xy = detail::fade(vec<2, T, Q>(Pf.x, Pf.y));
+ vec<2, T, Q> n_x = mix(vec<2, T, Q>(n00, n01), vec<2, T, Q>(n10, n11), fade_xy.x);
T n_xy = mix(n_x.x, n_x.y, fade_xy.y);
return T(2.3) * n_xy;
}
// Classic Perlin noise, periodic variant
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T perlin(tvec3<T, P> const & Position, tvec3<T, P> const & rep)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T perlin(vec<3, T, Q> const& Position, vec<3, T, Q> const& rep)
{
- tvec3<T, P> Pi0 = mod(floor(Position), rep); // Integer part, modulo period
- tvec3<T, P> Pi1 = mod(Pi0 + tvec3<T, P>(T(1)), rep); // Integer part + 1, mod period
- Pi0 = mod(Pi0, tvec3<T, P>(289));
- Pi1 = mod(Pi1, tvec3<T, P>(289));
- tvec3<T, P> Pf0 = fract(Position); // Fractional part for interpolation
- tvec3<T, P> Pf1 = Pf0 - tvec3<T, P>(T(1)); // Fractional part - 1.0
- tvec4<T, P> ix = tvec4<T, P>(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
- tvec4<T, P> iy = tvec4<T, P>(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
- tvec4<T, P> iz0(Pi0.z);
- tvec4<T, P> iz1(Pi1.z);
-
- tvec4<T, P> ixy = detail::permute(detail::permute(ix) + iy);
- tvec4<T, P> ixy0 = detail::permute(ixy + iz0);
- tvec4<T, P> ixy1 = detail::permute(ixy + iz1);
-
- tvec4<T, P> gx0 = ixy0 / T(7);
- tvec4<T, P> gy0 = fract(floor(gx0) / T(7)) - T(0.5);
+ vec<3, T, Q> Pi0 = mod(floor(Position), rep); // Integer part, modulo period
+ vec<3, T, Q> Pi1 = mod(Pi0 + vec<3, T, Q>(T(1)), rep); // Integer part + 1, mod period
+ Pi0 = mod(Pi0, vec<3, T, Q>(289));
+ Pi1 = mod(Pi1, vec<3, T, Q>(289));
+ vec<3, T, Q> Pf0 = fract(Position); // Fractional part for interpolation
+ vec<3, T, Q> Pf1 = Pf0 - vec<3, T, Q>(T(1)); // Fractional part - 1.0
+ vec<4, T, Q> ix = vec<4, T, Q>(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
+ vec<4, T, Q> iy = vec<4, T, Q>(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
+ vec<4, T, Q> iz0(Pi0.z);
+ vec<4, T, Q> iz1(Pi1.z);
+
+ vec<4, T, Q> ixy = detail::permute(detail::permute(ix) + iy);
+ vec<4, T, Q> ixy0 = detail::permute(ixy + iz0);
+ vec<4, T, Q> ixy1 = detail::permute(ixy + iz1);
+
+ vec<4, T, Q> gx0 = ixy0 / T(7);
+ vec<4, T, Q> gy0 = fract(floor(gx0) / T(7)) - T(0.5);
gx0 = fract(gx0);
- tvec4<T, P> gz0 = tvec4<T, P>(0.5) - abs(gx0) - abs(gy0);
- tvec4<T, P> sz0 = step(gz0, tvec4<T, P>(0));
+ vec<4, T, Q> gz0 = vec<4, T, Q>(0.5) - abs(gx0) - abs(gy0);
+ vec<4, T, Q> sz0 = step(gz0, vec<4, T, Q>(0));
gx0 -= sz0 * (step(T(0), gx0) - T(0.5));
gy0 -= sz0 * (step(T(0), gy0) - T(0.5));
- tvec4<T, P> gx1 = ixy1 / T(7);
- tvec4<T, P> gy1 = fract(floor(gx1) / T(7)) - T(0.5);
+ vec<4, T, Q> gx1 = ixy1 / T(7);
+ vec<4, T, Q> gy1 = fract(floor(gx1) / T(7)) - T(0.5);
gx1 = fract(gx1);
- tvec4<T, P> gz1 = tvec4<T, P>(0.5) - abs(gx1) - abs(gy1);
- tvec4<T, P> sz1 = step(gz1, tvec4<T, P>(T(0)));
+ vec<4, T, Q> gz1 = vec<4, T, Q>(0.5) - abs(gx1) - abs(gy1);
+ vec<4, T, Q> sz1 = step(gz1, vec<4, T, Q>(T(0)));
gx1 -= sz1 * (step(T(0), gx1) - T(0.5));
gy1 -= sz1 * (step(T(0), gy1) - T(0.5));
- tvec3<T, P> g000 = tvec3<T, P>(gx0.x, gy0.x, gz0.x);
- tvec3<T, P> g100 = tvec3<T, P>(gx0.y, gy0.y, gz0.y);
- tvec3<T, P> g010 = tvec3<T, P>(gx0.z, gy0.z, gz0.z);
- tvec3<T, P> g110 = tvec3<T, P>(gx0.w, gy0.w, gz0.w);
- tvec3<T, P> g001 = tvec3<T, P>(gx1.x, gy1.x, gz1.x);
- tvec3<T, P> g101 = tvec3<T, P>(gx1.y, gy1.y, gz1.y);
- tvec3<T, P> g011 = tvec3<T, P>(gx1.z, gy1.z, gz1.z);
- tvec3<T, P> g111 = tvec3<T, P>(gx1.w, gy1.w, gz1.w);
+ vec<3, T, Q> g000 = vec<3, T, Q>(gx0.x, gy0.x, gz0.x);
+ vec<3, T, Q> g100 = vec<3, T, Q>(gx0.y, gy0.y, gz0.y);
+ vec<3, T, Q> g010 = vec<3, T, Q>(gx0.z, gy0.z, gz0.z);
+ vec<3, T, Q> g110 = vec<3, T, Q>(gx0.w, gy0.w, gz0.w);
+ vec<3, T, Q> g001 = vec<3, T, Q>(gx1.x, gy1.x, gz1.x);
+ vec<3, T, Q> g101 = vec<3, T, Q>(gx1.y, gy1.y, gz1.y);
+ vec<3, T, Q> g011 = vec<3, T, Q>(gx1.z, gy1.z, gz1.z);
+ vec<3, T, Q> g111 = vec<3, T, Q>(gx1.w, gy1.w, gz1.w);
- tvec4<T, P> norm0 = detail::taylorInvSqrt(tvec4<T, P>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
+ vec<4, T, Q> norm0 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g000, g000), dot(g010, g010), dot(g100, g100), dot(g110, g110)));
g000 *= norm0.x;
g010 *= norm0.y;
g100 *= norm0.z;
g110 *= norm0.w;
- tvec4<T, P> norm1 = detail::taylorInvSqrt(tvec4<T, P>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
+ vec<4, T, Q> norm1 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g001, g001), dot(g011, g011), dot(g101, g101), dot(g111, g111)));
g001 *= norm1.x;
g011 *= norm1.y;
g101 *= norm1.z;
g111 *= norm1.w;
T n000 = dot(g000, Pf0);
- T n100 = dot(g100, tvec3<T, P>(Pf1.x, Pf0.y, Pf0.z));
- T n010 = dot(g010, tvec3<T, P>(Pf0.x, Pf1.y, Pf0.z));
- T n110 = dot(g110, tvec3<T, P>(Pf1.x, Pf1.y, Pf0.z));
- T n001 = dot(g001, tvec3<T, P>(Pf0.x, Pf0.y, Pf1.z));
- T n101 = dot(g101, tvec3<T, P>(Pf1.x, Pf0.y, Pf1.z));
- T n011 = dot(g011, tvec3<T, P>(Pf0.x, Pf1.y, Pf1.z));
+ T n100 = dot(g100, vec<3, T, Q>(Pf1.x, Pf0.y, Pf0.z));
+ T n010 = dot(g010, vec<3, T, Q>(Pf0.x, Pf1.y, Pf0.z));
+ T n110 = dot(g110, vec<3, T, Q>(Pf1.x, Pf1.y, Pf0.z));
+ T n001 = dot(g001, vec<3, T, Q>(Pf0.x, Pf0.y, Pf1.z));
+ T n101 = dot(g101, vec<3, T, Q>(Pf1.x, Pf0.y, Pf1.z));
+ T n011 = dot(g011, vec<3, T, Q>(Pf0.x, Pf1.y, Pf1.z));
T n111 = dot(g111, Pf1);
- tvec3<T, P> fade_xyz = detail::fade(Pf0);
- tvec4<T, P> n_z = mix(tvec4<T, P>(n000, n100, n010, n110), tvec4<T, P>(n001, n101, n011, n111), fade_xyz.z);
- tvec2<T, P> n_yz = mix(tvec2<T, P>(n_z.x, n_z.y), tvec2<T, P>(n_z.z, n_z.w), fade_xyz.y);
+ vec<3, T, Q> fade_xyz = detail::fade(Pf0);
+ vec<4, T, Q> n_z = mix(vec<4, T, Q>(n000, n100, n010, n110), vec<4, T, Q>(n001, n101, n011, n111), fade_xyz.z);
+ vec<2, T, Q> n_yz = mix(vec<2, T, Q>(n_z.x, n_z.y), vec<2, T, Q>(n_z.z, n_z.w), fade_xyz.y);
T n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
return T(2.2) * n_xyz;
}
// Classic Perlin noise, periodic version
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T perlin(tvec4<T, P> const & Position, tvec4<T, P> const & rep)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T perlin(vec<4, T, Q> const& Position, vec<4, T, Q> const& rep)
{
- tvec4<T, P> Pi0 = mod(floor(Position), rep); // Integer part modulo rep
- tvec4<T, P> Pi1 = mod(Pi0 + T(1), rep); // Integer part + 1 mod rep
- tvec4<T, P> Pf0 = fract(Position); // Fractional part for interpolation
- tvec4<T, P> Pf1 = Pf0 - T(1); // Fractional part - 1.0
- tvec4<T, P> ix = tvec4<T, P>(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
- tvec4<T, P> iy = tvec4<T, P>(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
- tvec4<T, P> iz0(Pi0.z);
- tvec4<T, P> iz1(Pi1.z);
- tvec4<T, P> iw0(Pi0.w);
- tvec4<T, P> iw1(Pi1.w);
-
- tvec4<T, P> ixy = detail::permute(detail::permute(ix) + iy);
- tvec4<T, P> ixy0 = detail::permute(ixy + iz0);
- tvec4<T, P> ixy1 = detail::permute(ixy + iz1);
- tvec4<T, P> ixy00 = detail::permute(ixy0 + iw0);
- tvec4<T, P> ixy01 = detail::permute(ixy0 + iw1);
- tvec4<T, P> ixy10 = detail::permute(ixy1 + iw0);
- tvec4<T, P> ixy11 = detail::permute(ixy1 + iw1);
-
- tvec4<T, P> gx00 = ixy00 / T(7);
- tvec4<T, P> gy00 = floor(gx00) / T(7);
- tvec4<T, P> gz00 = floor(gy00) / T(6);
+ vec<4, T, Q> Pi0 = mod(floor(Position), rep); // Integer part modulo rep
+ vec<4, T, Q> Pi1 = mod(Pi0 + T(1), rep); // Integer part + 1 mod rep
+ vec<4, T, Q> Pf0 = fract(Position); // Fractional part for interpolation
+ vec<4, T, Q> Pf1 = Pf0 - T(1); // Fractional part - 1.0
+ vec<4, T, Q> ix = vec<4, T, Q>(Pi0.x, Pi1.x, Pi0.x, Pi1.x);
+ vec<4, T, Q> iy = vec<4, T, Q>(Pi0.y, Pi0.y, Pi1.y, Pi1.y);
+ vec<4, T, Q> iz0(Pi0.z);
+ vec<4, T, Q> iz1(Pi1.z);
+ vec<4, T, Q> iw0(Pi0.w);
+ vec<4, T, Q> iw1(Pi1.w);
+
+ vec<4, T, Q> ixy = detail::permute(detail::permute(ix) + iy);
+ vec<4, T, Q> ixy0 = detail::permute(ixy + iz0);
+ vec<4, T, Q> ixy1 = detail::permute(ixy + iz1);
+ vec<4, T, Q> ixy00 = detail::permute(ixy0 + iw0);
+ vec<4, T, Q> ixy01 = detail::permute(ixy0 + iw1);
+ vec<4, T, Q> ixy10 = detail::permute(ixy1 + iw0);
+ vec<4, T, Q> ixy11 = detail::permute(ixy1 + iw1);
+
+ vec<4, T, Q> gx00 = ixy00 / T(7);
+ vec<4, T, Q> gy00 = floor(gx00) / T(7);
+ vec<4, T, Q> gz00 = floor(gy00) / T(6);
gx00 = fract(gx00) - T(0.5);
gy00 = fract(gy00) - T(0.5);
gz00 = fract(gz00) - T(0.5);
- tvec4<T, P> gw00 = tvec4<T, P>(0.75) - abs(gx00) - abs(gy00) - abs(gz00);
- tvec4<T, P> sw00 = step(gw00, tvec4<T, P>(0));
+ vec<4, T, Q> gw00 = vec<4, T, Q>(0.75) - abs(gx00) - abs(gy00) - abs(gz00);
+ vec<4, T, Q> sw00 = step(gw00, vec<4, T, Q>(0));
gx00 -= sw00 * (step(T(0), gx00) - T(0.5));
gy00 -= sw00 * (step(T(0), gy00) - T(0.5));
- tvec4<T, P> gx01 = ixy01 / T(7);
- tvec4<T, P> gy01 = floor(gx01) / T(7);
- tvec4<T, P> gz01 = floor(gy01) / T(6);
+ vec<4, T, Q> gx01 = ixy01 / T(7);
+ vec<4, T, Q> gy01 = floor(gx01) / T(7);
+ vec<4, T, Q> gz01 = floor(gy01) / T(6);
gx01 = fract(gx01) - T(0.5);
gy01 = fract(gy01) - T(0.5);
gz01 = fract(gz01) - T(0.5);
- tvec4<T, P> gw01 = tvec4<T, P>(0.75) - abs(gx01) - abs(gy01) - abs(gz01);
- tvec4<T, P> sw01 = step(gw01, tvec4<T, P>(0.0));
+ vec<4, T, Q> gw01 = vec<4, T, Q>(0.75) - abs(gx01) - abs(gy01) - abs(gz01);
+ vec<4, T, Q> sw01 = step(gw01, vec<4, T, Q>(0.0));
gx01 -= sw01 * (step(T(0), gx01) - T(0.5));
gy01 -= sw01 * (step(T(0), gy01) - T(0.5));
- tvec4<T, P> gx10 = ixy10 / T(7);
- tvec4<T, P> gy10 = floor(gx10) / T(7);
- tvec4<T, P> gz10 = floor(gy10) / T(6);
+ vec<4, T, Q> gx10 = ixy10 / T(7);
+ vec<4, T, Q> gy10 = floor(gx10) / T(7);
+ vec<4, T, Q> gz10 = floor(gy10) / T(6);
gx10 = fract(gx10) - T(0.5);
gy10 = fract(gy10) - T(0.5);
gz10 = fract(gz10) - T(0.5);
- tvec4<T, P> gw10 = tvec4<T, P>(0.75) - abs(gx10) - abs(gy10) - abs(gz10);
- tvec4<T, P> sw10 = step(gw10, tvec4<T, P>(0.0));
+ vec<4, T, Q> gw10 = vec<4, T, Q>(0.75) - abs(gx10) - abs(gy10) - abs(gz10);
+ vec<4, T, Q> sw10 = step(gw10, vec<4, T, Q>(0.0));
gx10 -= sw10 * (step(T(0), gx10) - T(0.5));
gy10 -= sw10 * (step(T(0), gy10) - T(0.5));
- tvec4<T, P> gx11 = ixy11 / T(7);
- tvec4<T, P> gy11 = floor(gx11) / T(7);
- tvec4<T, P> gz11 = floor(gy11) / T(6);
+ vec<4, T, Q> gx11 = ixy11 / T(7);
+ vec<4, T, Q> gy11 = floor(gx11) / T(7);
+ vec<4, T, Q> gz11 = floor(gy11) / T(6);
gx11 = fract(gx11) - T(0.5);
gy11 = fract(gy11) - T(0.5);
gz11 = fract(gz11) - T(0.5);
- tvec4<T, P> gw11 = tvec4<T, P>(0.75) - abs(gx11) - abs(gy11) - abs(gz11);
- tvec4<T, P> sw11 = step(gw11, tvec4<T, P>(T(0)));
+ vec<4, T, Q> gw11 = vec<4, T, Q>(0.75) - abs(gx11) - abs(gy11) - abs(gz11);
+ vec<4, T, Q> sw11 = step(gw11, vec<4, T, Q>(T(0)));
gx11 -= sw11 * (step(T(0), gx11) - T(0.5));
gy11 -= sw11 * (step(T(0), gy11) - T(0.5));
- tvec4<T, P> g0000(gx00.x, gy00.x, gz00.x, gw00.x);
- tvec4<T, P> g1000(gx00.y, gy00.y, gz00.y, gw00.y);
- tvec4<T, P> g0100(gx00.z, gy00.z, gz00.z, gw00.z);
- tvec4<T, P> g1100(gx00.w, gy00.w, gz00.w, gw00.w);
- tvec4<T, P> g0010(gx10.x, gy10.x, gz10.x, gw10.x);
- tvec4<T, P> g1010(gx10.y, gy10.y, gz10.y, gw10.y);
- tvec4<T, P> g0110(gx10.z, gy10.z, gz10.z, gw10.z);
- tvec4<T, P> g1110(gx10.w, gy10.w, gz10.w, gw10.w);
- tvec4<T, P> g0001(gx01.x, gy01.x, gz01.x, gw01.x);
- tvec4<T, P> g1001(gx01.y, gy01.y, gz01.y, gw01.y);
- tvec4<T, P> g0101(gx01.z, gy01.z, gz01.z, gw01.z);
- tvec4<T, P> g1101(gx01.w, gy01.w, gz01.w, gw01.w);
- tvec4<T, P> g0011(gx11.x, gy11.x, gz11.x, gw11.x);
- tvec4<T, P> g1011(gx11.y, gy11.y, gz11.y, gw11.y);
- tvec4<T, P> g0111(gx11.z, gy11.z, gz11.z, gw11.z);
- tvec4<T, P> g1111(gx11.w, gy11.w, gz11.w, gw11.w);
-
- tvec4<T, P> norm00 = detail::taylorInvSqrt(tvec4<T, P>(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
+ vec<4, T, Q> g0000(gx00.x, gy00.x, gz00.x, gw00.x);
+ vec<4, T, Q> g1000(gx00.y, gy00.y, gz00.y, gw00.y);
+ vec<4, T, Q> g0100(gx00.z, gy00.z, gz00.z, gw00.z);
+ vec<4, T, Q> g1100(gx00.w, gy00.w, gz00.w, gw00.w);
+ vec<4, T, Q> g0010(gx10.x, gy10.x, gz10.x, gw10.x);
+ vec<4, T, Q> g1010(gx10.y, gy10.y, gz10.y, gw10.y);
+ vec<4, T, Q> g0110(gx10.z, gy10.z, gz10.z, gw10.z);
+ vec<4, T, Q> g1110(gx10.w, gy10.w, gz10.w, gw10.w);
+ vec<4, T, Q> g0001(gx01.x, gy01.x, gz01.x, gw01.x);
+ vec<4, T, Q> g1001(gx01.y, gy01.y, gz01.y, gw01.y);
+ vec<4, T, Q> g0101(gx01.z, gy01.z, gz01.z, gw01.z);
+ vec<4, T, Q> g1101(gx01.w, gy01.w, gz01.w, gw01.w);
+ vec<4, T, Q> g0011(gx11.x, gy11.x, gz11.x, gw11.x);
+ vec<4, T, Q> g1011(gx11.y, gy11.y, gz11.y, gw11.y);
+ vec<4, T, Q> g0111(gx11.z, gy11.z, gz11.z, gw11.z);
+ vec<4, T, Q> g1111(gx11.w, gy11.w, gz11.w, gw11.w);
+
+ vec<4, T, Q> norm00 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0000, g0000), dot(g0100, g0100), dot(g1000, g1000), dot(g1100, g1100)));
g0000 *= norm00.x;
g0100 *= norm00.y;
g1000 *= norm00.z;
g1100 *= norm00.w;
- tvec4<T, P> norm01 = detail::taylorInvSqrt(tvec4<T, P>(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
+ vec<4, T, Q> norm01 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0001, g0001), dot(g0101, g0101), dot(g1001, g1001), dot(g1101, g1101)));
g0001 *= norm01.x;
g0101 *= norm01.y;
g1001 *= norm01.z;
g1101 *= norm01.w;
- tvec4<T, P> norm10 = detail::taylorInvSqrt(tvec4<T, P>(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));
+ vec<4, T, Q> norm10 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0010, g0010), dot(g0110, g0110), dot(g1010, g1010), dot(g1110, g1110)));
g0010 *= norm10.x;
g0110 *= norm10.y;
g1010 *= norm10.z;
g1110 *= norm10.w;
- tvec4<T, P> norm11 = detail::taylorInvSqrt(tvec4<T, P>(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));
+ vec<4, T, Q> norm11 = detail::taylorInvSqrt(vec<4, T, Q>(dot(g0011, g0011), dot(g0111, g0111), dot(g1011, g1011), dot(g1111, g1111)));
g0011 *= norm11.x;
g0111 *= norm11.y;
g1011 *= norm11.z;
g1111 *= norm11.w;
T n0000 = dot(g0000, Pf0);
- T n1000 = dot(g1000, tvec4<T, P>(Pf1.x, Pf0.y, Pf0.z, Pf0.w));
- T n0100 = dot(g0100, tvec4<T, P>(Pf0.x, Pf1.y, Pf0.z, Pf0.w));
- T n1100 = dot(g1100, tvec4<T, P>(Pf1.x, Pf1.y, Pf0.z, Pf0.w));
- T n0010 = dot(g0010, tvec4<T, P>(Pf0.x, Pf0.y, Pf1.z, Pf0.w));
- T n1010 = dot(g1010, tvec4<T, P>(Pf1.x, Pf0.y, Pf1.z, Pf0.w));
- T n0110 = dot(g0110, tvec4<T, P>(Pf0.x, Pf1.y, Pf1.z, Pf0.w));
- T n1110 = dot(g1110, tvec4<T, P>(Pf1.x, Pf1.y, Pf1.z, Pf0.w));
- T n0001 = dot(g0001, tvec4<T, P>(Pf0.x, Pf0.y, Pf0.z, Pf1.w));
- T n1001 = dot(g1001, tvec4<T, P>(Pf1.x, Pf0.y, Pf0.z, Pf1.w));
- T n0101 = dot(g0101, tvec4<T, P>(Pf0.x, Pf1.y, Pf0.z, Pf1.w));
- T n1101 = dot(g1101, tvec4<T, P>(Pf1.x, Pf1.y, Pf0.z, Pf1.w));
- T n0011 = dot(g0011, tvec4<T, P>(Pf0.x, Pf0.y, Pf1.z, Pf1.w));
- T n1011 = dot(g1011, tvec4<T, P>(Pf1.x, Pf0.y, Pf1.z, Pf1.w));
- T n0111 = dot(g0111, tvec4<T, P>(Pf0.x, Pf1.y, Pf1.z, Pf1.w));
+ T n1000 = dot(g1000, vec<4, T, Q>(Pf1.x, Pf0.y, Pf0.z, Pf0.w));
+ T n0100 = dot(g0100, vec<4, T, Q>(Pf0.x, Pf1.y, Pf0.z, Pf0.w));
+ T n1100 = dot(g1100, vec<4, T, Q>(Pf1.x, Pf1.y, Pf0.z, Pf0.w));
+ T n0010 = dot(g0010, vec<4, T, Q>(Pf0.x, Pf0.y, Pf1.z, Pf0.w));
+ T n1010 = dot(g1010, vec<4, T, Q>(Pf1.x, Pf0.y, Pf1.z, Pf0.w));
+ T n0110 = dot(g0110, vec<4, T, Q>(Pf0.x, Pf1.y, Pf1.z, Pf0.w));
+ T n1110 = dot(g1110, vec<4, T, Q>(Pf1.x, Pf1.y, Pf1.z, Pf0.w));
+ T n0001 = dot(g0001, vec<4, T, Q>(Pf0.x, Pf0.y, Pf0.z, Pf1.w));
+ T n1001 = dot(g1001, vec<4, T, Q>(Pf1.x, Pf0.y, Pf0.z, Pf1.w));
+ T n0101 = dot(g0101, vec<4, T, Q>(Pf0.x, Pf1.y, Pf0.z, Pf1.w));
+ T n1101 = dot(g1101, vec<4, T, Q>(Pf1.x, Pf1.y, Pf0.z, Pf1.w));
+ T n0011 = dot(g0011, vec<4, T, Q>(Pf0.x, Pf0.y, Pf1.z, Pf1.w));
+ T n1011 = dot(g1011, vec<4, T, Q>(Pf1.x, Pf0.y, Pf1.z, Pf1.w));
+ T n0111 = dot(g0111, vec<4, T, Q>(Pf0.x, Pf1.y, Pf1.z, Pf1.w));
T n1111 = dot(g1111, Pf1);
- tvec4<T, P> fade_xyzw = detail::fade(Pf0);
- tvec4<T, P> n_0w = mix(tvec4<T, P>(n0000, n1000, n0100, n1100), tvec4<T, P>(n0001, n1001, n0101, n1101), fade_xyzw.w);
- tvec4<T, P> n_1w = mix(tvec4<T, P>(n0010, n1010, n0110, n1110), tvec4<T, P>(n0011, n1011, n0111, n1111), fade_xyzw.w);
- tvec4<T, P> n_zw = mix(n_0w, n_1w, fade_xyzw.z);
- tvec2<T, P> n_yzw = mix(tvec2<T, P>(n_zw.x, n_zw.y), tvec2<T, P>(n_zw.z, n_zw.w), fade_xyzw.y);
+ vec<4, T, Q> fade_xyzw = detail::fade(Pf0);
+ vec<4, T, Q> n_0w = mix(vec<4, T, Q>(n0000, n1000, n0100, n1100), vec<4, T, Q>(n0001, n1001, n0101, n1101), fade_xyzw.w);
+ vec<4, T, Q> n_1w = mix(vec<4, T, Q>(n0010, n1010, n0110, n1110), vec<4, T, Q>(n0011, n1011, n0111, n1111), fade_xyzw.w);
+ vec<4, T, Q> n_zw = mix(n_0w, n_1w, fade_xyzw.z);
+ vec<2, T, Q> n_yzw = mix(vec<2, T, Q>(n_zw.x, n_zw.y), vec<2, T, Q>(n_zw.z, n_zw.w), fade_xyzw.y);
T n_xyzw = mix(n_yzw.x, n_yzw.y, fade_xyzw.x);
return T(2.2) * n_xyzw;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T simplex(glm::tvec2<T, P> const & v)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T simplex(glm::vec<2, T, Q> const& v)
{
- tvec4<T, P> const C = tvec4<T, P>(
+ vec<4, T, Q> const C = vec<4, T, Q>(
T( 0.211324865405187), // (3.0 - sqrt(3.0)) / 6.0
T( 0.366025403784439), // 0.5 * (sqrt(3.0) - 1.0)
T(-0.577350269189626), // -1.0 + 2.0 * C.x
T( 0.024390243902439)); // 1.0 / 41.0
// First corner
- tvec2<T, P> i = floor(v + dot(v, tvec2<T, P>(C[1])));
- tvec2<T, P> x0 = v - i + dot(i, tvec2<T, P>(C[0]));
+ vec<2, T, Q> i = floor(v + dot(v, vec<2, T, Q>(C[1])));
+ vec<2, T, Q> x0 = v - i + dot(i, vec<2, T, Q>(C[0]));
// Other corners
//i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0
//i1.y = 1.0 - i1.x;
- tvec2<T, P> i1 = (x0.x > x0.y) ? tvec2<T, P>(1, 0) : tvec2<T, P>(0, 1);
+ vec<2, T, Q> i1 = (x0.x > x0.y) ? vec<2, T, Q>(1, 0) : vec<2, T, Q>(0, 1);
// x0 = x0 - 0.0 + 0.0 * C.xx ;
// x1 = x0 - i1 + 1.0 * C.xx ;
// x2 = x0 - 1.0 + 2.0 * C.xx ;
- tvec4<T, P> x12 = tvec4<T, P>(x0.x, x0.y, x0.x, x0.y) + tvec4<T, P>(C.x, C.x, C.z, C.z);
- x12 = tvec4<T, P>(tvec2<T, P>(x12) - i1, x12.z, x12.w);
+ vec<4, T, Q> x12 = vec<4, T, Q>(x0.x, x0.y, x0.x, x0.y) + vec<4, T, Q>(C.x, C.x, C.z, C.z);
+ x12 = vec<4, T, Q>(vec<2, T, Q>(x12) - i1, x12.z, x12.w);
// Permutations
- i = mod(i, tvec2<T, P>(289)); // Avoid truncation effects in permutation
- tvec3<T, P> p = detail::permute(
- detail::permute(i.y + tvec3<T, P>(T(0), i1.y, T(1)))
- + i.x + tvec3<T, P>(T(0), i1.x, T(1)));
+ i = mod(i, vec<2, T, Q>(289)); // Avoid truncation effects in permutation
+ vec<3, T, Q> p = detail::permute(
+ detail::permute(i.y + vec<3, T, Q>(T(0), i1.y, T(1)))
+ + i.x + vec<3, T, Q>(T(0), i1.x, T(1)));
- tvec3<T, P> m = max(tvec3<T, P>(0.5) - tvec3<T, P>(
+ vec<3, T, Q> m = max(vec<3, T, Q>(0.5) - vec<3, T, Q>(
dot(x0, x0),
- dot(tvec2<T, P>(x12.x, x12.y), tvec2<T, P>(x12.x, x12.y)),
- dot(tvec2<T, P>(x12.z, x12.w), tvec2<T, P>(x12.z, x12.w))), tvec3<T, P>(0));
+ dot(vec<2, T, Q>(x12.x, x12.y), vec<2, T, Q>(x12.x, x12.y)),
+ dot(vec<2, T, Q>(x12.z, x12.w), vec<2, T, Q>(x12.z, x12.w))), vec<3, T, Q>(0));
m = m * m ;
m = m * m ;
// Gradients: 41 points uniformly over a line, mapped onto a diamond.
// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)
- tvec3<T, P> x = static_cast<T>(2) * fract(p * C.w) - T(1);
- tvec3<T, P> h = abs(x) - T(0.5);
- tvec3<T, P> ox = floor(x + T(0.5));
- tvec3<T, P> a0 = x - ox;
+ vec<3, T, Q> x = static_cast<T>(2) * fract(p * C.w) - T(1);
+ vec<3, T, Q> h = abs(x) - T(0.5);
+ vec<3, T, Q> ox = floor(x + T(0.5));
+ vec<3, T, Q> a0 = x - ox;
// Normalise gradients implicitly by scaling m
// Inlined for speed: m *= taylorInvSqrt( a0*a0 + h*h );
m *= static_cast<T>(1.79284291400159) - T(0.85373472095314) * (a0 * a0 + h * h);
// Compute final noise value at P
- tvec3<T, P> g;
+ vec<3, T, Q> g;
g.x = a0.x * x0.x + h.x * x0.y;
//g.yz = a0.yz * x12.xz + h.yz * x12.yw;
g.y = a0.y * x12.x + h.y * x12.y;
@@ -645,85 +645,85 @@ namespace gtc
return T(130) * dot(m, g);
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T simplex(tvec3<T, P> const & v)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T simplex(vec<3, T, Q> const& v)
{
- tvec2<T, P> const C(1.0 / 6.0, 1.0 / 3.0);
- tvec4<T, P> const D(0.0, 0.5, 1.0, 2.0);
+ vec<2, T, Q> const C(1.0 / 6.0, 1.0 / 3.0);
+ vec<4, T, Q> const D(0.0, 0.5, 1.0, 2.0);
// First corner
- tvec3<T, P> i(floor(v + dot(v, tvec3<T, P>(C.y))));
- tvec3<T, P> x0(v - i + dot(i, tvec3<T, P>(C.x)));
+ vec<3, T, Q> i(floor(v + dot(v, vec<3, T, Q>(C.y))));
+ vec<3, T, Q> x0(v - i + dot(i, vec<3, T, Q>(C.x)));
// Other corners
- tvec3<T, P> g(step(tvec3<T, P>(x0.y, x0.z, x0.x), x0));
- tvec3<T, P> l(T(1) - g);
- tvec3<T, P> i1(min(g, tvec3<T, P>(l.z, l.x, l.y)));
- tvec3<T, P> i2(max(g, tvec3<T, P>(l.z, l.x, l.y)));
+ vec<3, T, Q> g(step(vec<3, T, Q>(x0.y, x0.z, x0.x), x0));
+ vec<3, T, Q> l(T(1) - g);
+ vec<3, T, Q> i1(min(g, vec<3, T, Q>(l.z, l.x, l.y)));
+ vec<3, T, Q> i2(max(g, vec<3, T, Q>(l.z, l.x, l.y)));
// x0 = x0 - 0.0 + 0.0 * C.xxx;
// x1 = x0 - i1 + 1.0 * C.xxx;
// x2 = x0 - i2 + 2.0 * C.xxx;
// x3 = x0 - 1.0 + 3.0 * C.xxx;
- tvec3<T, P> x1(x0 - i1 + C.x);
- tvec3<T, P> x2(x0 - i2 + C.y); // 2.0*C.x = 1/3 = C.y
- tvec3<T, P> x3(x0 - D.y); // -1.0+3.0*C.x = -0.5 = -D.y
+ vec<3, T, Q> x1(x0 - i1 + C.x);
+ vec<3, T, Q> x2(x0 - i2 + C.y); // 2.0*C.x = 1/3 = C.y
+ vec<3, T, Q> x3(x0 - D.y); // -1.0+3.0*C.x = -0.5 = -D.y
// Permutations
i = detail::mod289(i);
- tvec4<T, P> p(detail::permute(detail::permute(detail::permute(
- i.z + tvec4<T, P>(T(0), i1.z, i2.z, T(1))) +
- i.y + tvec4<T, P>(T(0), i1.y, i2.y, T(1))) +
- i.x + tvec4<T, P>(T(0), i1.x, i2.x, T(1))));
+ vec<4, T, Q> p(detail::permute(detail::permute(detail::permute(
+ i.z + vec<4, T, Q>(T(0), i1.z, i2.z, T(1))) +
+ i.y + vec<4, T, Q>(T(0), i1.y, i2.y, T(1))) +
+ i.x + vec<4, T, Q>(T(0), i1.x, i2.x, T(1))));
// Gradients: 7x7 points over a square, mapped onto an octahedron.
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
T n_ = static_cast<T>(0.142857142857); // 1.0/7.0
- tvec3<T, P> ns(n_ * tvec3<T, P>(D.w, D.y, D.z) - tvec3<T, P>(D.x, D.z, D.x));
+ vec<3, T, Q> ns(n_ * vec<3, T, Q>(D.w, D.y, D.z) - vec<3, T, Q>(D.x, D.z, D.x));
- tvec4<T, P> j(p - T(49) * floor(p * ns.z * ns.z)); // mod(p,7*7)
+ vec<4, T, Q> j(p - T(49) * floor(p * ns.z * ns.z)); // mod(p,7*7)
- tvec4<T, P> x_(floor(j * ns.z));
- tvec4<T, P> y_(floor(j - T(7) * x_)); // mod(j,N)
+ vec<4, T, Q> x_(floor(j * ns.z));
+ vec<4, T, Q> y_(floor(j - T(7) * x_)); // mod(j,N)
- tvec4<T, P> x(x_ * ns.x + ns.y);
- tvec4<T, P> y(y_ * ns.x + ns.y);
- tvec4<T, P> h(T(1) - abs(x) - abs(y));
+ vec<4, T, Q> x(x_ * ns.x + ns.y);
+ vec<4, T, Q> y(y_ * ns.x + ns.y);
+ vec<4, T, Q> h(T(1) - abs(x) - abs(y));
- tvec4<T, P> b0(x.x, x.y, y.x, y.y);
- tvec4<T, P> b1(x.z, x.w, y.z, y.w);
+ vec<4, T, Q> b0(x.x, x.y, y.x, y.y);
+ vec<4, T, Q> b1(x.z, x.w, y.z, y.w);
// vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;
// vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;
- tvec4<T, P> s0(floor(b0) * T(2) + T(1));
- tvec4<T, P> s1(floor(b1) * T(2) + T(1));
- tvec4<T, P> sh(-step(h, tvec4<T, P>(0.0)));
+ vec<4, T, Q> s0(floor(b0) * T(2) + T(1));
+ vec<4, T, Q> s1(floor(b1) * T(2) + T(1));
+ vec<4, T, Q> sh(-step(h, vec<4, T, Q>(0.0)));
- tvec4<T, P> a0 = tvec4<T, P>(b0.x, b0.z, b0.y, b0.w) + tvec4<T, P>(s0.x, s0.z, s0.y, s0.w) * tvec4<T, P>(sh.x, sh.x, sh.y, sh.y);
- tvec4<T, P> a1 = tvec4<T, P>(b1.x, b1.z, b1.y, b1.w) + tvec4<T, P>(s1.x, s1.z, s1.y, s1.w) * tvec4<T, P>(sh.z, sh.z, sh.w, sh.w);
+ vec<4, T, Q> a0 = vec<4, T, Q>(b0.x, b0.z, b0.y, b0.w) + vec<4, T, Q>(s0.x, s0.z, s0.y, s0.w) * vec<4, T, Q>(sh.x, sh.x, sh.y, sh.y);
+ vec<4, T, Q> a1 = vec<4, T, Q>(b1.x, b1.z, b1.y, b1.w) + vec<4, T, Q>(s1.x, s1.z, s1.y, s1.w) * vec<4, T, Q>(sh.z, sh.z, sh.w, sh.w);
- tvec3<T, P> p0(a0.x, a0.y, h.x);
- tvec3<T, P> p1(a0.z, a0.w, h.y);
- tvec3<T, P> p2(a1.x, a1.y, h.z);
- tvec3<T, P> p3(a1.z, a1.w, h.w);
+ vec<3, T, Q> p0(a0.x, a0.y, h.x);
+ vec<3, T, Q> p1(a0.z, a0.w, h.y);
+ vec<3, T, Q> p2(a1.x, a1.y, h.z);
+ vec<3, T, Q> p3(a1.z, a1.w, h.w);
// Normalise gradients
- tvec4<T, P> norm = detail::taylorInvSqrt(tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
+ vec<4, T, Q> norm = detail::taylorInvSqrt(vec<4, T, Q>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
// Mix final noise value
- tvec4<T, P> m = max(T(0.6) - tvec4<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), tvec4<T, P>(0));
+ vec<4, T, Q> m = max(T(0.6) - vec<4, T, Q>(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), vec<4, T, Q>(0));
m = m * m;
- return T(42) * dot(m * m, tvec4<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
+ return T(42) * dot(m * m, vec<4, T, Q>(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T simplex(tvec4<T, P> const & v)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T simplex(vec<4, T, Q> const& v)
{
- tvec4<T, P> const C(
+ vec<4, T, Q> const C(
0.138196601125011, // (5 - sqrt(5))/20 G4
0.276393202250021, // 2 * G4
0.414589803375032, // 3 * G4
@@ -733,63 +733,63 @@ namespace gtc
T const F4 = static_cast<T>(0.309016994374947451);
// First corner
- tvec4<T, P> i = floor(v + dot(v, vec4(F4)));
- tvec4<T, P> x0 = v - i + dot(i, vec4(C.x));
+ vec<4, T, Q> i = floor(v + dot(v, vec4(F4)));
+ vec<4, T, Q> x0 = v - i + dot(i, vec4(C.x));
// Other corners
// Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)
- tvec4<T, P> i0;
- tvec3<T, P> isX = step(tvec3<T, P>(x0.y, x0.z, x0.w), tvec3<T, P>(x0.x));
- tvec3<T, P> isYZ = step(tvec3<T, P>(x0.z, x0.w, x0.w), tvec3<T, P>(x0.y, x0.y, x0.z));
+ vec<4, T, Q> i0;
+ vec<3, T, Q> isX = step(vec<3, T, Q>(x0.y, x0.z, x0.w), vec<3, T, Q>(x0.x));
+ vec<3, T, Q> isYZ = step(vec<3, T, Q>(x0.z, x0.w, x0.w), vec<3, T, Q>(x0.y, x0.y, x0.z));
// i0.x = dot(isX, vec3(1.0));
//i0.x = isX.x + isX.y + isX.z;
//i0.yzw = static_cast<T>(1) - isX;
- i0 = tvec4<T, P>(isX.x + isX.y + isX.z, T(1) - isX);
+ i0 = vec<4, T, Q>(isX.x + isX.y + isX.z, T(1) - isX);
// i0.y += dot(isYZ.xy, vec2(1.0));
i0.y += isYZ.x + isYZ.y;
- //i0.zw += 1.0 - tvec2<T, P>(isYZ.x, isYZ.y);
+ //i0.zw += 1.0 - vec<2, T, Q>(isYZ.x, isYZ.y);
i0.z += static_cast<T>(1) - isYZ.x;
i0.w += static_cast<T>(1) - isYZ.y;
i0.z += isYZ.z;
i0.w += static_cast<T>(1) - isYZ.z;
// i0 now contains the unique values 0,1,2,3 in each channel
- tvec4<T, P> i3 = clamp(i0, T(0), T(1));
- tvec4<T, P> i2 = clamp(i0 - T(1), T(0), T(1));
- tvec4<T, P> i1 = clamp(i0 - T(2), T(0), T(1));
+ vec<4, T, Q> i3 = clamp(i0, T(0), T(1));
+ vec<4, T, Q> i2 = clamp(i0 - T(1), T(0), T(1));
+ vec<4, T, Q> i1 = clamp(i0 - T(2), T(0), T(1));
// x0 = x0 - 0.0 + 0.0 * C.xxxx
// x1 = x0 - i1 + 0.0 * C.xxxx
// x2 = x0 - i2 + 0.0 * C.xxxx
// x3 = x0 - i3 + 0.0 * C.xxxx
// x4 = x0 - 1.0 + 4.0 * C.xxxx
- tvec4<T, P> x1 = x0 - i1 + C.x;
- tvec4<T, P> x2 = x0 - i2 + C.y;
- tvec4<T, P> x3 = x0 - i3 + C.z;
- tvec4<T, P> x4 = x0 + C.w;
+ vec<4, T, Q> x1 = x0 - i1 + C.x;
+ vec<4, T, Q> x2 = x0 - i2 + C.y;
+ vec<4, T, Q> x3 = x0 - i3 + C.z;
+ vec<4, T, Q> x4 = x0 + C.w;
// Permutations
- i = mod(i, tvec4<T, P>(289));
+ i = mod(i, vec<4, T, Q>(289));
T j0 = detail::permute(detail::permute(detail::permute(detail::permute(i.w) + i.z) + i.y) + i.x);
- tvec4<T, P> j1 = detail::permute(detail::permute(detail::permute(detail::permute(
- i.w + tvec4<T, P>(i1.w, i2.w, i3.w, T(1))) +
- i.z + tvec4<T, P>(i1.z, i2.z, i3.z, T(1))) +
- i.y + tvec4<T, P>(i1.y, i2.y, i3.y, T(1))) +
- i.x + tvec4<T, P>(i1.x, i2.x, i3.x, T(1)));
+ vec<4, T, Q> j1 = detail::permute(detail::permute(detail::permute(detail::permute(
+ i.w + vec<4, T, Q>(i1.w, i2.w, i3.w, T(1))) +
+ i.z + vec<4, T, Q>(i1.z, i2.z, i3.z, T(1))) +
+ i.y + vec<4, T, Q>(i1.y, i2.y, i3.y, T(1))) +
+ i.x + vec<4, T, Q>(i1.x, i2.x, i3.x, T(1)));
// Gradients: 7x7x6 points over a cube, mapped onto a 4-cross polytope
// 7*7*6 = 294, which is close to the ring size 17*17 = 289.
- tvec4<T, P> ip = tvec4<T, P>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
+ vec<4, T, Q> ip = vec<4, T, Q>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
- tvec4<T, P> p0 = gtc::grad4(j0, ip);
- tvec4<T, P> p1 = gtc::grad4(j1.x, ip);
- tvec4<T, P> p2 = gtc::grad4(j1.y, ip);
- tvec4<T, P> p3 = gtc::grad4(j1.z, ip);
- tvec4<T, P> p4 = gtc::grad4(j1.w, ip);
+ vec<4, T, Q> p0 = gtc::grad4(j0, ip);
+ vec<4, T, Q> p1 = gtc::grad4(j1.x, ip);
+ vec<4, T, Q> p2 = gtc::grad4(j1.y, ip);
+ vec<4, T, Q> p3 = gtc::grad4(j1.z, ip);
+ vec<4, T, Q> p4 = gtc::grad4(j1.w, ip);
// Normalise gradients
- tvec4<T, P> norm = detail::taylorInvSqrt(tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
+ vec<4, T, Q> norm = detail::taylorInvSqrt(vec<4, T, Q>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
@@ -797,12 +797,12 @@ namespace gtc
p4 *= detail::taylorInvSqrt(dot(p4, p4));
// Mix contributions from the five corners
- tvec3<T, P> m0 = max(T(0.6) - tvec3<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2)), tvec3<T, P>(0));
- tvec2<T, P> m1 = max(T(0.6) - tvec2<T, P>(dot(x3, x3), dot(x4, x4) ), tvec2<T, P>(0));
+ vec<3, T, Q> m0 = max(T(0.6) - vec<3, T, Q>(dot(x0, x0), dot(x1, x1), dot(x2, x2)), vec<3, T, Q>(0));
+ vec<2, T, Q> m1 = max(T(0.6) - vec<2, T, Q>(dot(x3, x3), dot(x4, x4) ), vec<2, T, Q>(0));
m0 = m0 * m0;
m1 = m1 * m1;
- return T(49) *
- (dot(m0 * m0, tvec3<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) +
- dot(m1 * m1, tvec2<T, P>(dot(p3, x3), dot(p4, x4))));
+ return T(49) *
+ (dot(m0 * m0, vec<3, T, Q>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) +
+ dot(m1 * m1, vec<2, T, Q>(dot(p3, x3), dot(p4, x4))));
}
}//namespace glm
diff --git a/external/include/glm/gtc/packing.hpp b/external/include/glm/gtc/packing.hpp
index 1389d95..96070c2 100644
--- a/external/include/glm/gtc/packing.hpp
+++ b/external/include/glm/gtc/packing.hpp
@@ -6,10 +6,10 @@
/// @defgroup gtc_packing GLM_GTC_packing
/// @ingroup gtc
///
-/// @brief This extension provides a set of function to convert vertors to packed
-/// formats.
+/// Include <glm/gtc/packing.hpp> to use the features of this extension.
///
-/// <glm/gtc/packing.hpp> need to be included to use these features.
+/// This extension provides a set of function to convert vertors to packed
+/// formats.
#pragma once
@@ -32,17 +32,17 @@ namespace glm
/// packUnorm1x8: round(clamp(c, 0, +1) * 255.0)
///
/// @see gtc_packing
- /// @see uint16 packUnorm2x8(vec2 const & v)
- /// @see uint32 packUnorm4x8(vec4 const & v)
+ /// @see uint16 packUnorm2x8(vec2 const& v)
+ /// @see uint32 packUnorm4x8(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/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 uint8 packUnorm1x8(float v);
/// Convert a single 8-bit integer to a normalized floating-point value.
- ///
+ ///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackUnorm4x8: f / 255.0
- ///
+ ///
/// @see gtc_packing
/// @see vec2 unpackUnorm2x8(uint16 p)
/// @see vec4 unpackUnorm4x8(uint32 p)
@@ -60,28 +60,28 @@ namespace glm
/// the last component will be written to the most significant bits.
///
/// @see gtc_packing
- /// @see uint8 packUnorm1x8(float const & v)
- /// @see uint32 packUnorm4x8(vec4 const & v)
+ /// @see uint8 packUnorm1x8(float const& v)
+ /// @see uint32 packUnorm4x8(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/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 packUnorm2x8(vec2 const & v);
+ GLM_FUNC_DECL uint16 packUnorm2x8(vec2 const& v);
- /// First, unpacks a single 16-bit unsigned integer p into a pair of 8-bit unsigned integers.
+ /// First, unpacks a single 16-bit unsigned integer p into a pair of 8-bit unsigned integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned two-component vector.
- ///
+ ///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackUnorm4x8: f / 255.0
- ///
- /// The first component of the returned vector will be extracted from the least significant bits of the input;
+ ///
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits.
- ///
+ ///
/// @see gtc_packing
/// @see float unpackUnorm1x8(uint8 v)
/// @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/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);
-
+
/// 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.
///
@@ -89,25 +89,25 @@ namespace glm
/// packSnorm1x8: round(clamp(s, -1, +1) * 127.0)
///
/// @see gtc_packing
- /// @see uint16 packSnorm2x8(vec2 const & v)
- /// @see uint32 packSnorm4x8(vec4 const & v)
+ /// @see uint16 packSnorm2x8(vec2 const& v)
+ /// @see uint32 packSnorm4x8(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/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 uint8 packSnorm1x8(float s);
- /// First, unpacks a single 8-bit unsigned integer p into a single 8-bit signed integers.
+ /// First, unpacks a single 8-bit unsigned integer p into a single 8-bit signed integers.
/// Then, the value is converted to a normalized floating-point value to generate the returned scalar.
- ///
+ ///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackSnorm1x8: clamp(f / 127.0, -1, +1)
- ///
+ ///
/// @see gtc_packing
/// @see vec2 unpackSnorm2x8(uint16 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/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);
-
+
/// 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.
///
@@ -118,28 +118,28 @@ namespace glm
/// the last component will be written to the most significant bits.
///
/// @see gtc_packing
- /// @see uint8 packSnorm1x8(float const & v)
- /// @see uint32 packSnorm4x8(vec4 const & v)
+ /// @see uint8 packSnorm1x8(float const& v)
+ /// @see uint32 packSnorm4x8(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/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 packSnorm2x8(vec2 const & v);
+ GLM_FUNC_DECL uint16 packSnorm2x8(vec2 const& v);
- /// First, unpacks a single 16-bit unsigned integer p into a pair of 8-bit signed integers.
+ /// First, unpacks a single 16-bit unsigned integer p into a pair of 8-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned two-component vector.
- ///
+ ///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackSnorm2x8: clamp(f / 127.0, -1, +1)
- ///
- /// The first component of the returned vector will be extracted from the least significant bits of the input;
+ ///
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits.
- ///
+ ///
/// @see gtc_packing
/// @see float unpackSnorm1x8(uint8 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/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);
-
+
/// 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.
///
@@ -147,18 +147,18 @@ namespace glm
/// packUnorm1x16: round(clamp(c, 0, +1) * 65535.0)
///
/// @see gtc_packing
- /// @see uint16 packSnorm1x16(float const & v)
- /// @see uint64 packSnorm4x16(vec4 const & v)
+ /// @see uint16 packSnorm1x16(float 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/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);
- /// 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.
- ///
+ ///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
- /// unpackUnorm1x16: f / 65535.0
- ///
+ /// unpackUnorm1x16: f / 65535.0
+ ///
/// @see gtc_packing
/// @see vec2 unpackUnorm2x16(uint32 p)
/// @see vec4 unpackUnorm4x16(uint64 p)
@@ -176,21 +176,21 @@ namespace glm
/// the last component will be written to the most significant bits.
///
/// @see gtc_packing
- /// @see uint16 packUnorm1x16(float const & v)
- /// @see uint32 packUnorm2x16(vec2 const & v)
+ /// @see uint16 packUnorm1x16(float const& v)
+ /// @see uint32 packUnorm2x16(vec2 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/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 uint64 packUnorm4x16(vec4 const & v);
+ GLM_FUNC_DECL uint64 packUnorm4x16(vec4 const& v);
- /// First, unpacks a single 64-bit unsigned integer p into four 16-bit unsigned integers.
+ /// First, unpacks a single 64-bit unsigned integer p into four 16-bit unsigned integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.
- ///
+ ///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
- /// unpackUnormx4x16: f / 65535.0
- ///
- /// The first component of the returned vector will be extracted from the least significant bits of the input;
+ /// unpackUnormx4x16: f / 65535.0
+ ///
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits.
- ///
+ ///
/// @see gtc_packing
/// @see float unpackUnorm1x16(uint16 p)
/// @see vec2 unpackUnorm2x16(uint32 p)
@@ -205,18 +205,18 @@ namespace glm
/// packSnorm1x8: round(clamp(s, -1, +1) * 32767.0)
///
/// @see gtc_packing
- /// @see uint32 packSnorm2x16(vec2 const & v)
- /// @see uint64 packSnorm4x16(vec4 const & v)
+ /// @see uint32 packSnorm2x16(vec2 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/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);
- /// 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.
- ///
+ ///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackSnorm1x16: clamp(f / 32767.0, -1, +1)
- ///
+ ///
/// @see gtc_packing
/// @see vec2 unpackSnorm2x16(uint32 p)
/// @see vec4 unpackSnorm4x16(uint64 p)
@@ -234,122 +234,122 @@ namespace glm
/// the last component will be written to the most significant bits.
///
/// @see gtc_packing
- /// @see uint16 packSnorm1x16(float const & v)
- /// @see uint32 packSnorm2x16(vec2 const & v)
+ /// @see uint16 packSnorm1x16(float const& v)
+ /// @see uint32 packSnorm2x16(vec2 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/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 uint64 packSnorm4x16(vec4 const & v);
+ GLM_FUNC_DECL uint64 packSnorm4x16(vec4 const& v);
- /// First, unpacks a single 64-bit unsigned integer p into four 16-bit signed integers.
+ /// First, unpacks a single 64-bit unsigned integer p into four 16-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.
- ///
+ ///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackSnorm4x16: clamp(f / 32767.0, -1, +1)
- ///
- /// The first component of the returned vector will be extracted from the least significant bits of the input;
+ ///
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits.
- ///
+ ///
/// @see gtc_packing
/// @see float unpackSnorm1x16(uint16 p)
/// @see vec2 unpackSnorm2x16(uint32 p)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.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>
GLM_FUNC_DECL vec4 unpackSnorm4x16(uint64 p);
-
+
/// Returns an unsigned integer obtained by converting the components of a floating-point scalar
/// to the 16-bit floating-point representation found in the OpenGL Specification,
/// and then packing this 16-bit value into a 16-bit unsigned integer.
///
/// @see gtc_packing
- /// @see uint32 packHalf2x16(vec2 const & v)
- /// @see uint64 packHalf4x16(vec4 const & v)
+ /// @see uint32 packHalf2x16(vec2 const& v)
+ /// @see uint64 packHalf4x16(vec4 const& v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 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>
GLM_FUNC_DECL uint16 packHalf1x16(float v);
-
+
/// Returns a floating-point scalar with components obtained by unpacking a 16-bit unsigned integer into a 16-bit value,
/// interpreted as a 16-bit floating-point number according to the OpenGL Specification,
/// and converting it to 32-bit floating-point values.
///
/// @see gtc_packing
- /// @see vec2 unpackHalf2x16(uint32 const & v)
- /// @see vec4 unpackHalf4x16(uint64 const & v)
+ /// @see vec2 unpackHalf2x16(uint32 const& v)
+ /// @see vec4 unpackHalf4x16(uint64 const& v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 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>
GLM_FUNC_DECL float unpackHalf1x16(uint16 v);
- /// Returns an unsigned integer obtained by converting the components of a four-component floating-point vector
- /// to the 16-bit floating-point representation found in the OpenGL Specification,
+ /// Returns an unsigned integer obtained by converting the components of a four-component floating-point vector
+ /// to the 16-bit floating-point representation found in the OpenGL Specification,
/// and then packing these four 16-bit values into a 64-bit unsigned integer.
- /// The first vector component specifies the 16 least-significant bits of the result;
+ /// The first vector component specifies the 16 least-significant bits of the result;
/// the forth component specifies the 16 most-significant bits.
- ///
+ ///
/// @see gtc_packing
- /// @see uint16 packHalf1x16(float const & v)
- /// @see uint32 packHalf2x16(vec2 const & v)
+ /// @see uint16 packHalf1x16(float const& v)
+ /// @see uint32 packHalf2x16(vec2 const& v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 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>
- GLM_FUNC_DECL uint64 packHalf4x16(vec4 const & v);
-
+ GLM_FUNC_DECL uint64 packHalf4x16(vec4 const& v);
+
/// Returns a four-component floating-point vector with components obtained by unpacking a 64-bit unsigned integer into four 16-bit values,
- /// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification,
+ /// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification,
/// and converting them to 32-bit floating-point values.
- /// The first component of the vector is obtained from the 16 least-significant bits of v;
+ /// The first component of the vector is obtained from the 16 least-significant bits of v;
/// the forth component is obtained from the 16 most-significant bits of v.
- ///
+ ///
/// @see gtc_packing
- /// @see float unpackHalf1x16(uint16 const & v)
- /// @see vec2 unpackHalf2x16(uint32 const & v)
+ /// @see float unpackHalf1x16(uint16 const& v)
+ /// @see vec2 unpackHalf2x16(uint32 const& v)
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 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>
GLM_FUNC_DECL vec4 unpackHalf4x16(uint64 p);
- /// Returns an unsigned integer obtained by converting the components of a four-component signed integer vector
- /// to the 10-10-10-2-bit signed integer representation found in the OpenGL Specification,
+ /// Returns an unsigned integer obtained by converting the components of a four-component signed integer vector
+ /// to the 10-10-10-2-bit signed integer representation found in the OpenGL Specification,
/// and then packing these four values into a 32-bit unsigned integer.
- /// The first vector component specifies the 10 least-significant bits of the result;
+ /// The first vector component specifies the 10 least-significant bits of the result;
/// the forth component specifies the 2 most-significant bits.
- ///
+ ///
/// @see gtc_packing
- /// @see uint32 packI3x10_1x2(uvec4 const & v)
- /// @see uint32 packSnorm3x10_1x2(vec4 const & v)
- /// @see uint32 packUnorm3x10_1x2(vec4 const & v)
- /// @see ivec4 unpackI3x10_1x2(uint32 const & p)
- GLM_FUNC_DECL uint32 packI3x10_1x2(ivec4 const & v);
+ /// @see uint32 packI3x10_1x2(uvec4 const& v)
+ /// @see uint32 packSnorm3x10_1x2(vec4 const& v)
+ /// @see uint32 packUnorm3x10_1x2(vec4 const& v)
+ /// @see ivec4 unpackI3x10_1x2(uint32 const& p)
+ GLM_FUNC_DECL uint32 packI3x10_1x2(ivec4 const& v);
- /// Unpacks a single 32-bit unsigned integer p into three 10-bit and one 2-bit signed integers.
- ///
- /// The first component of the returned vector will be extracted from the least significant bits of the input;
+ /// Unpacks a single 32-bit unsigned integer p into three 10-bit and one 2-bit signed integers.
+ ///
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits.
- ///
+ ///
/// @see gtc_packing
- /// @see uint32 packU3x10_1x2(uvec4 const & v)
- /// @see vec4 unpackSnorm3x10_1x2(uint32 const & p);
- /// @see uvec4 unpackI3x10_1x2(uint32 const & p);
+ /// @see uint32 packU3x10_1x2(uvec4 const& v)
+ /// @see vec4 unpackSnorm3x10_1x2(uint32 const& p);
+ /// @see uvec4 unpackI3x10_1x2(uint32 const& p);
GLM_FUNC_DECL ivec4 unpackI3x10_1x2(uint32 p);
- /// Returns an unsigned integer obtained by converting the components of a four-component unsigned integer vector
- /// to the 10-10-10-2-bit unsigned integer representation found in the OpenGL Specification,
+ /// Returns an unsigned integer obtained by converting the components of a four-component unsigned integer vector
+ /// to the 10-10-10-2-bit unsigned integer representation found in the OpenGL Specification,
/// and then packing these four values into a 32-bit unsigned integer.
- /// The first vector component specifies the 10 least-significant bits of the result;
+ /// The first vector component specifies the 10 least-significant bits of the result;
/// the forth component specifies the 2 most-significant bits.
- ///
+ ///
/// @see gtc_packing
- /// @see uint32 packI3x10_1x2(ivec4 const & v)
- /// @see uint32 packSnorm3x10_1x2(vec4 const & v)
- /// @see uint32 packUnorm3x10_1x2(vec4 const & v)
- /// @see ivec4 unpackU3x10_1x2(uint32 const & p)
- GLM_FUNC_DECL uint32 packU3x10_1x2(uvec4 const & v);
+ /// @see uint32 packI3x10_1x2(ivec4 const& v)
+ /// @see uint32 packSnorm3x10_1x2(vec4 const& v)
+ /// @see uint32 packUnorm3x10_1x2(vec4 const& v)
+ /// @see ivec4 unpackU3x10_1x2(uint32 const& p)
+ GLM_FUNC_DECL uint32 packU3x10_1x2(uvec4 const& v);
- /// Unpacks a single 32-bit unsigned integer p into three 10-bit and one 2-bit unsigned integers.
- ///
- /// The first component of the returned vector will be extracted from the least significant bits of the input;
+ /// Unpacks a single 32-bit unsigned integer p into three 10-bit and one 2-bit unsigned integers.
+ ///
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits.
- ///
+ ///
/// @see gtc_packing
- /// @see uint32 packU3x10_1x2(uvec4 const & v)
- /// @see vec4 unpackSnorm3x10_1x2(uint32 const & p);
- /// @see uvec4 unpackI3x10_1x2(uint32 const & p);
+ /// @see uint32 packU3x10_1x2(uvec4 const& v)
+ /// @see vec4 unpackSnorm3x10_1x2(uint32 const& p);
+ /// @see uvec4 unpackI3x10_1x2(uint32 const& p);
GLM_FUNC_DECL uvec4 unpackU3x10_1x2(uint32 p);
/// First, converts the first three components of the normalized floating-point value v into 10-bit signed integer values.
@@ -360,31 +360,31 @@ namespace glm
/// packSnorm3x10_1x2(xyz): round(clamp(c, -1, +1) * 511.0)
/// packSnorm3x10_1x2(w): round(clamp(c, -1, +1) * 1.0)
///
- /// The first vector component specifies the 10 least-significant bits of the result;
+ /// The first vector component specifies the 10 least-significant bits of the result;
/// the forth component specifies the 2 most-significant bits.
///
/// @see gtc_packing
- /// @see vec4 unpackSnorm3x10_1x2(uint32 const & p)
- /// @see uint32 packUnorm3x10_1x2(vec4 const & v)
- /// @see uint32 packU3x10_1x2(uvec4 const & v)
- /// @see uint32 packI3x10_1x2(ivec4 const & v)
- GLM_FUNC_DECL uint32 packSnorm3x10_1x2(vec4 const & v);
+ /// @see vec4 unpackSnorm3x10_1x2(uint32 const& p)
+ /// @see uint32 packUnorm3x10_1x2(vec4 const& v)
+ /// @see uint32 packU3x10_1x2(uvec4 const& v)
+ /// @see uint32 packI3x10_1x2(ivec4 const& v)
+ GLM_FUNC_DECL uint32 packSnorm3x10_1x2(vec4 const& v);
- /// First, unpacks a single 32-bit unsigned integer p into four 16-bit signed integers.
+ /// First, unpacks a single 32-bit unsigned integer p into four 16-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.
- ///
+ ///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackSnorm3x10_1x2(xyz): clamp(f / 511.0, -1, +1)
/// unpackSnorm3x10_1x2(w): clamp(f / 511.0, -1, +1)
- ///
- /// The first component of the returned vector will be extracted from the least significant bits of the input;
+ ///
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits.
- ///
+ ///
/// @see gtc_packing
- /// @see uint32 packSnorm3x10_1x2(vec4 const & v)
- /// @see vec4 unpackUnorm3x10_1x2(uint32 const & p))
- /// @see uvec4 unpackI3x10_1x2(uint32 const & p)
- /// @see uvec4 unpackU3x10_1x2(uint32 const & p)
+ /// @see uint32 packSnorm3x10_1x2(vec4 const& v)
+ /// @see vec4 unpackUnorm3x10_1x2(uint32 const& p))
+ /// @see uvec4 unpackI3x10_1x2(uint32 const& p)
+ /// @see uvec4 unpackU3x10_1x2(uint32 const& p)
GLM_FUNC_DECL vec4 unpackSnorm3x10_1x2(uint32 p);
/// First, converts the first three components of the normalized floating-point value v into 10-bit unsigned integer values.
@@ -395,52 +395,52 @@ namespace glm
/// packUnorm3x10_1x2(xyz): round(clamp(c, 0, +1) * 1023.0)
/// packUnorm3x10_1x2(w): round(clamp(c, 0, +1) * 3.0)
///
- /// The first vector component specifies the 10 least-significant bits of the result;
+ /// The first vector component specifies the 10 least-significant bits of the result;
/// the forth component specifies the 2 most-significant bits.
///
/// @see gtc_packing
- /// @see vec4 unpackUnorm3x10_1x2(uint32 const & p)
- /// @see uint32 packUnorm3x10_1x2(vec4 const & v)
- /// @see uint32 packU3x10_1x2(uvec4 const & v)
- /// @see uint32 packI3x10_1x2(ivec4 const & v)
- GLM_FUNC_DECL uint32 packUnorm3x10_1x2(vec4 const & v);
+ /// @see vec4 unpackUnorm3x10_1x2(uint32 const& p)
+ /// @see uint32 packUnorm3x10_1x2(vec4 const& v)
+ /// @see uint32 packU3x10_1x2(uvec4 const& v)
+ /// @see uint32 packI3x10_1x2(ivec4 const& v)
+ GLM_FUNC_DECL uint32 packUnorm3x10_1x2(vec4 const& v);
- /// First, unpacks a single 32-bit unsigned integer p into four 16-bit signed integers.
+ /// First, unpacks a single 32-bit unsigned integer p into four 16-bit signed integers.
/// Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.
- ///
+ ///
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
/// unpackSnorm3x10_1x2(xyz): clamp(f / 1023.0, 0, +1)
/// unpackSnorm3x10_1x2(w): clamp(f / 3.0, 0, +1)
- ///
- /// The first component of the returned vector will be extracted from the least significant bits of the input;
+ ///
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits.
- ///
+ ///
/// @see gtc_packing
- /// @see uint32 packSnorm3x10_1x2(vec4 const & v)
- /// @see vec4 unpackInorm3x10_1x2(uint32 const & p))
- /// @see uvec4 unpackI3x10_1x2(uint32 const & p)
- /// @see uvec4 unpackU3x10_1x2(uint32 const & p)
+ /// @see uint32 packSnorm3x10_1x2(vec4 const& v)
+ /// @see vec4 unpackInorm3x10_1x2(uint32 const& p))
+ /// @see uvec4 unpackI3x10_1x2(uint32 const& p)
+ /// @see uvec4 unpackU3x10_1x2(uint32 const& p)
GLM_FUNC_DECL vec4 unpackUnorm3x10_1x2(uint32 p);
/// First, converts the first two components of the normalized floating-point value v into 11-bit signless floating-point values.
/// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value.
/// Then, the results are packed into the returned 32-bit unsigned integer.
///
- /// The first vector component specifies the 11 least-significant bits of the result;
+ /// The first vector component specifies the 11 least-significant bits of the result;
/// the last component specifies the 10 most-significant bits.
///
/// @see gtc_packing
- /// @see vec3 unpackF2x11_1x10(uint32 const & p)
- GLM_FUNC_DECL uint32 packF2x11_1x10(vec3 const & v);
+ /// @see vec3 unpackF2x11_1x10(uint32 const& p)
+ GLM_FUNC_DECL uint32 packF2x11_1x10(vec3 const& v);
- /// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value .
+ /// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value .
/// Then, each component is converted to a normalized floating-point value to generate the returned three-component vector.
- ///
- /// The first component of the returned vector will be extracted from the least significant bits of the input;
+ ///
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits.
- ///
+ ///
/// @see gtc_packing
- /// @see uint32 packF2x11_1x10(vec3 const & v)
+ /// @see uint32 packF2x11_1x10(vec3 const& v)
GLM_FUNC_DECL vec3 unpackF2x11_1x10(uint32 p);
@@ -448,131 +448,280 @@ namespace glm
/// Then, converts the third component of the normalized floating-point value v into a 10-bit signless floating-point value.
/// Then, the results are packed into the returned 32-bit unsigned integer.
///
- /// The first vector component specifies the 11 least-significant bits of the result;
+ /// The first vector component specifies the 11 least-significant bits of the result;
/// the last component specifies the 10 most-significant bits.
///
+ /// packF3x9_E1x5 allows encoding into RGBE / RGB9E5 format
+ ///
/// @see gtc_packing
- /// @see vec3 unpackF3x9_E1x5(uint32 const & p)
- GLM_FUNC_DECL uint32 packF3x9_E1x5(vec3 const & v);
+ /// @see vec3 unpackF3x9_E1x5(uint32 const& p)
+ GLM_FUNC_DECL uint32 packF3x9_E1x5(vec3 const& v);
- /// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value .
+ /// First, unpacks a single 32-bit unsigned integer p into two 11-bit signless floating-point values and one 10-bit signless floating-point value .
/// Then, each component is converted to a normalized floating-point value to generate the returned three-component vector.
- ///
- /// The first component of the returned vector will be extracted from the least significant bits of the input;
+ ///
+ /// The first component of the returned vector will be extracted from the least significant bits of the input;
/// the last component will be extracted from the most significant bits.
- ///
+ ///
+ /// unpackF3x9_E1x5 allows decoding RGBE / RGB9E5 data
+ ///
/// @see gtc_packing
- /// @see uint32 packF3x9_E1x5(vec3 const & v)
+ /// @see uint32 packF3x9_E1x5(vec3 const& v)
GLM_FUNC_DECL vec3 unpackF3x9_E1x5(uint32 p);
/// Returns an unsigned integer vector obtained by converting the components of a floating-point vector
/// to the 16-bit floating-point representation found in the OpenGL Specification.
- /// The first vector component specifies the 16 least-significant bits of the result;
+ /// The first vector component specifies the 16 least-significant bits of the result;
+ /// the forth component specifies the 16 most-significant bits.
+ ///
+ /// @see gtc_packing
+ /// @see vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& p)
+ /// @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>
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, T, Q> packRGBM(vec<3, T, Q> const& rgb);
+
+ /// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.
+ /// The first component of the vector is obtained from the 16 least-significant bits of v;
+ /// the forth component is obtained from the 16 most-significant bits of v.
+ ///
+ /// @see gtc_packing
+ /// @see vec<4, T, Q> packRGBM(vec<3, float, Q> const& v)
+ /// @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>
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& rgbm);
+
+ /// Returns an unsigned integer vector obtained by converting the components of a floating-point vector
+ /// to the 16-bit floating-point representation found in the OpenGL Specification.
+ /// The first vector component specifies the 16 least-significant bits of the result;
/// the forth component specifies the 16 most-significant bits.
- ///
+ ///
/// @see gtc_packing
- /// @see vecType<float, P> unpackHalf(vecType<uint16, P> const & p)
+ /// @see vec<L, float, Q> unpackHalf(vec<L, uint16, Q> const& p)
/// @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>
- template <precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<uint16, P> packHalf(vecType<float, P> const & v);
+ template<length_t L, qualifier Q>
+ GLM_FUNC_DECL vec<L, uint16, Q> packHalf(vec<L, float, Q> const& v);
/// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.
/// The first component of the vector is obtained from the 16 least-significant bits of v;
/// the forth component is obtained from the 16 most-significant bits of v.
- ///
+ ///
/// @see gtc_packing
- /// @see vecType<uint16, P> packHalf(vecType<float, P> const & v)
+ /// @see vec<L, uint16, Q> packHalf(vec<L, float, Q> const& v)
/// @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>
- template <precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<float, P> unpackHalf(vecType<uint16, P> const & p);
+ template<length_t L, qualifier Q>
+ GLM_FUNC_DECL vec<L, float, Q> unpackHalf(vec<L, uint16, Q> const& p);
/// Convert each component of the normalized floating-point vector into unsigned integer values.
///
/// @see gtc_packing
- /// @see vecType<floatType, P> unpackUnorm(vecType<intType, P> const & p);
- template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<uintType, P> packUnorm(vecType<floatType, P> const & v);
+ /// @see vec<L, floatType, Q> unpackUnorm(vec<L, intType, Q> const& p);
+ template<typename uintType, length_t L, typename floatType, qualifier Q>
+ GLM_FUNC_DECL vec<L, uintType, Q> packUnorm(vec<L, floatType, Q> const& v);
- /// Convert each unsigned integer components of a vector to normalized floating-point values.
- ///
+ /// Convert a packed integer to a normalized floating-point vector.
+ ///
/// @see gtc_packing
- /// @see vecType<intType, P> packUnorm(vecType<floatType, P> const & v)
- template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<floatType, P> unpackUnorm(vecType<uintType, P> const & v);
+ /// @see vec<L, intType, Q> packUnorm(vec<L, floatType, Q> const& v)
+ template<typename floatType, length_t L, typename uintType, qualifier Q>
+ GLM_FUNC_DECL vec<L, floatType, Q> unpackUnorm(vec<L, uintType, Q> const& v);
/// Convert each component of the normalized floating-point vector into signed integer values.
///
/// @see gtc_packing
- /// @see vecType<floatType, P> unpackSnorm(vecType<intType, P> const & p);
- template <typename intType, typename floatType, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<intType, P> packSnorm(vecType<floatType, P> const & v);
+ /// @see vec<L, floatType, Q> unpackSnorm(vec<L, intType, Q> const& p);
+ template<typename intType, length_t L, typename floatType, qualifier Q>
+ GLM_FUNC_DECL vec<L, intType, Q> packSnorm(vec<L, floatType, Q> const& v);
- /// Convert each signed integer components of a vector to normalized floating-point values.
- ///
+ /// Convert a packed integer to a normalized floating-point vector.
+ ///
/// @see gtc_packing
- /// @see vecType<intType, P> packSnorm(vecType<floatType, P> const & v)
- template <typename intType, typename floatType, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<floatType, P> unpackSnorm(vecType<intType, P> const & v);
+ /// @see vec<L, intType, Q> packSnorm(vec<L, floatType, Q> const& v)
+ template<typename floatType, length_t L, typename intType, qualifier Q>
+ GLM_FUNC_DECL vec<L, floatType, Q> unpackSnorm(vec<L, intType, Q> const& v);
/// Convert each component of the normalized floating-point vector into unsigned integer values.
///
/// @see gtc_packing
/// @see vec2 unpackUnorm2x4(uint8 p)
- GLM_FUNC_DECL uint8 packUnorm2x4(vec2 const & v);
+ GLM_FUNC_DECL uint8 packUnorm2x4(vec2 const& v);
- /// Convert each unsigned integer components of a vector to normalized floating-point values.
- ///
+ /// Convert a packed integer to a normalized floating-point vector.
+ ///
/// @see gtc_packing
- /// @see uint8 packUnorm2x4(vec2 const & v)
+ /// @see uint8 packUnorm2x4(vec2 const& v)
GLM_FUNC_DECL vec2 unpackUnorm2x4(uint8 p);
/// Convert each component of the normalized floating-point vector into unsigned integer values.
///
/// @see gtc_packing
/// @see vec4 unpackUnorm4x4(uint16 p)
- GLM_FUNC_DECL uint16 packUnorm4x4(vec4 const & v);
+ GLM_FUNC_DECL uint16 packUnorm4x4(vec4 const& v);
- /// Convert each unsigned integer components of a vector to normalized floating-point values.
- ///
+ /// Convert a packed integer to a normalized floating-point vector.
+ ///
/// @see gtc_packing
- /// @see uint16 packUnorm4x4(vec4 const & v)
+ /// @see uint16 packUnorm4x4(vec4 const& v)
GLM_FUNC_DECL vec4 unpackUnorm4x4(uint16 p);
/// Convert each component of the normalized floating-point vector into unsigned integer values.
///
/// @see gtc_packing
/// @see vec3 unpackUnorm1x5_1x6_1x5(uint16 p)
- GLM_FUNC_DECL uint16 packUnorm1x5_1x6_1x5(vec3 const & v);
+ GLM_FUNC_DECL uint16 packUnorm1x5_1x6_1x5(vec3 const& v);
- /// Convert each unsigned integer components of a vector to normalized floating-point values.
- ///
+ /// Convert a packed integer to a normalized floating-point vector.
+ ///
/// @see gtc_packing
- /// @see uint16 packUnorm1x5_1x6_1x5(vec3 const & v)
+ /// @see uint16 packUnorm1x5_1x6_1x5(vec3 const& v)
GLM_FUNC_DECL vec3 unpackUnorm1x5_1x6_1x5(uint16 p);
/// Convert each component of the normalized floating-point vector into unsigned integer values.
///
/// @see gtc_packing
/// @see vec4 unpackUnorm3x5_1x1(uint16 p)
- GLM_FUNC_DECL uint16 packUnorm3x5_1x1(vec4 const & v);
+ GLM_FUNC_DECL uint16 packUnorm3x5_1x1(vec4 const& v);
- /// Convert each unsigned integer components of a vector to normalized floating-point values.
- ///
+ /// Convert a packed integer to a normalized floating-point vector.
+ ///
/// @see gtc_packing
- /// @see uint16 packUnorm3x5_1x1(vec4 const & v)
+ /// @see uint16 packUnorm3x5_1x1(vec4 const& v)
GLM_FUNC_DECL vec4 unpackUnorm3x5_1x1(uint16 p);
/// Convert each component of the normalized floating-point vector into unsigned integer values.
///
/// @see gtc_packing
/// @see vec3 unpackUnorm2x3_1x2(uint8 p)
- GLM_FUNC_DECL uint8 packUnorm2x3_1x2(vec3 const & v);
+ GLM_FUNC_DECL uint8 packUnorm2x3_1x2(vec3 const& v);
- /// Convert each unsigned integer components of a vector to normalized floating-point values.
- ///
+ /// Convert a packed integer to a normalized floating-point vector.
+ ///
/// @see gtc_packing
- /// @see uint8 packUnorm2x3_1x2(vec3 const & v)
+ /// @see uint8 packUnorm2x3_1x2(vec3 const& v)
GLM_FUNC_DECL vec3 unpackUnorm2x3_1x2(uint8 p);
+
+
+
+ /// Convert each component from an integer vector into a packed unsigned integer.
+ ///
+ /// @see gtc_packing
+ /// @see i8vec2 unpackInt2x8(int16 p)
+ GLM_FUNC_DECL int16 packInt2x8(i8vec2 const& v);
+
+ /// Convert a packed integer into an integer vector.
+ ///
+ /// @see gtc_packing
+ /// @see int16 packInt2x8(i8vec2 const& v)
+ GLM_FUNC_DECL i8vec2 unpackInt2x8(int16 p);
+
+ /// Convert each component from an integer vector into a packed unsigned integer.
+ ///
+ /// @see gtc_packing
+ /// @see u8vec2 unpackInt2x8(uint16 p)
+ GLM_FUNC_DECL uint16 packUint2x8(u8vec2 const& v);
+
+ /// Convert a packed integer into an integer vector.
+ ///
+ /// @see gtc_packing
+ /// @see uint16 packInt2x8(u8vec2 const& v)
+ GLM_FUNC_DECL u8vec2 unpackUint2x8(uint16 p);
+
+ /// Convert each component from an integer vector into a packed unsigned integer.
+ ///
+ /// @see gtc_packing
+ /// @see i8vec4 unpackInt4x8(int32 p)
+ GLM_FUNC_DECL int32 packInt4x8(i8vec4 const& v);
+
+ /// Convert a packed integer into an integer vector.
+ ///
+ /// @see gtc_packing
+ /// @see int32 packInt2x8(i8vec4 const& v)
+ GLM_FUNC_DECL i8vec4 unpackInt4x8(int32 p);
+
+ /// Convert each component from an integer vector into a packed unsigned integer.
+ ///
+ /// @see gtc_packing
+ /// @see u8vec4 unpackUint4x8(uint32 p)
+ GLM_FUNC_DECL uint32 packUint4x8(u8vec4 const& v);
+
+ /// Convert a packed integer into an integer vector.
+ ///
+ /// @see gtc_packing
+ /// @see uint32 packUint4x8(u8vec2 const& v)
+ GLM_FUNC_DECL u8vec4 unpackUint4x8(uint32 p);
+
+ /// Convert each component from an integer vector into a packed unsigned integer.
+ ///
+ /// @see gtc_packing
+ /// @see i16vec2 unpackInt2x16(int p)
+ GLM_FUNC_DECL int packInt2x16(i16vec2 const& v);
+
+ /// Convert a packed integer into an integer vector.
+ ///
+ /// @see gtc_packing
+ /// @see int packInt2x16(i16vec2 const& v)
+ GLM_FUNC_DECL i16vec2 unpackInt2x16(int p);
+
+ /// Convert each component from an integer vector into a packed unsigned integer.
+ ///
+ /// @see gtc_packing
+ /// @see i16vec4 unpackInt4x16(int64 p)
+ GLM_FUNC_DECL int64 packInt4x16(i16vec4 const& v);
+
+ /// Convert a packed integer into an integer vector.
+ ///
+ /// @see gtc_packing
+ /// @see int64 packInt4x16(i16vec4 const& v)
+ GLM_FUNC_DECL i16vec4 unpackInt4x16(int64 p);
+
+ /// Convert each component from an integer vector into a packed unsigned integer.
+ ///
+ /// @see gtc_packing
+ /// @see u16vec2 unpackUint2x16(uint p)
+ GLM_FUNC_DECL uint packUint2x16(u16vec2 const& v);
+
+ /// Convert a packed integer into an integer vector.
+ ///
+ /// @see gtc_packing
+ /// @see uint packUint2x16(u16vec2 const& v)
+ GLM_FUNC_DECL u16vec2 unpackUint2x16(uint p);
+
+ /// Convert each component from an integer vector into a packed unsigned integer.
+ ///
+ /// @see gtc_packing
+ /// @see u16vec4 unpackUint4x16(uint64 p)
+ GLM_FUNC_DECL uint64 packUint4x16(u16vec4 const& v);
+
+ /// Convert a packed integer into an integer vector.
+ ///
+ /// @see gtc_packing
+ /// @see uint64 packUint4x16(u16vec4 const& v)
+ GLM_FUNC_DECL u16vec4 unpackUint4x16(uint64 p);
+
+ /// Convert each component from an integer vector into a packed unsigned integer.
+ ///
+ /// @see gtc_packing
+ /// @see i32vec2 unpackInt2x32(int p)
+ GLM_FUNC_DECL int64 packInt2x32(i32vec2 const& v);
+
+ /// Convert a packed integer into an integer vector.
+ ///
+ /// @see gtc_packing
+ /// @see int packInt2x16(i32vec2 const& v)
+ GLM_FUNC_DECL i32vec2 unpackInt2x32(int64 p);
+
+ /// Convert each component from an integer vector into a packed unsigned integer.
+ ///
+ /// @see gtc_packing
+ /// @see u32vec2 unpackUint2x32(int p)
+ GLM_FUNC_DECL uint64 packUint2x32(u32vec2 const& v);
+
+ /// Convert a packed integer into an integer vector.
+ ///
+ /// @see gtc_packing
+ /// @see int packUint2x16(u32vec2 const& v)
+ GLM_FUNC_DECL u32vec2 unpackUint2x32(uint64 p);
+
+
/// @}
}// namespace glm
diff --git a/external/include/glm/gtc/packing.inl b/external/include/glm/gtc/packing.inl
index 618fb9e..c12c140 100644
--- a/external/include/glm/gtc/packing.inl
+++ b/external/include/glm/gtc/packing.inl
@@ -2,6 +2,7 @@
/// @file glm/gtc/packing.inl
#include "../common.hpp"
+#include "../vector_relational.hpp"
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
@@ -270,83 +271,83 @@ namespace detail
uint32 pack;
};
- template <precision P, template <typename, precision> class vecType>
+ template<length_t L, qualifier Q>
struct compute_half
{};
- template <precision P>
- struct compute_half<P, tvec1>
+ template<qualifier Q>
+ struct compute_half<1, Q>
{
- GLM_FUNC_QUALIFIER static tvec1<uint16, P> pack(tvec1<float, P> const & v)
+ GLM_FUNC_QUALIFIER static vec<1, uint16, Q> pack(vec<1, float, Q> const& v)
{
int16 const Unpack(detail::toFloat16(v.x));
- u16vec1 Packed(uninitialize);
+ u16vec1 Packed;
memcpy(&Packed, &Unpack, sizeof(Packed));
return Packed;
}
- GLM_FUNC_QUALIFIER static tvec1<float, P> unpack(tvec1<uint16, P> const & v)
+ GLM_FUNC_QUALIFIER static vec<1, float, Q> unpack(vec<1, uint16, Q> const& v)
{
- i16vec1 Unpack(uninitialize);
+ i16vec1 Unpack;
memcpy(&Unpack, &v, sizeof(Unpack));
- return tvec1<float, P>(detail::toFloat32(v.x));
+ return vec<1, float, Q>(detail::toFloat32(v.x));
}
};
- template <precision P>
- struct compute_half<P, tvec2>
+ template<qualifier Q>
+ struct compute_half<2, Q>
{
- GLM_FUNC_QUALIFIER static tvec2<uint16, P> pack(tvec2<float, P> const & v)
+ GLM_FUNC_QUALIFIER static vec<2, uint16, Q> pack(vec<2, float, Q> const& v)
{
- tvec2<int16, P> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y));
- u16vec2 Packed(uninitialize);
+ vec<2, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y));
+ u16vec2 Packed;
memcpy(&Packed, &Unpack, sizeof(Packed));
return Packed;
}
- GLM_FUNC_QUALIFIER static tvec2<float, P> unpack(tvec2<uint16, P> const & v)
+ GLM_FUNC_QUALIFIER static vec<2, float, Q> unpack(vec<2, uint16, Q> const& v)
{
- i16vec2 Unpack(uninitialize);
+ i16vec2 Unpack;
memcpy(&Unpack, &v, sizeof(Unpack));
- return tvec2<float, P>(detail::toFloat32(v.x), detail::toFloat32(v.y));
+ return vec<2, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y));
}
};
- template <precision P>
- struct compute_half<P, tvec3>
+ template<qualifier Q>
+ struct compute_half<3, Q>
{
- GLM_FUNC_QUALIFIER static tvec3<uint16, P> pack(tvec3<float, P> const & v)
+ GLM_FUNC_QUALIFIER static vec<3, uint16, Q> pack(vec<3, float, Q> const& v)
{
- tvec3<int16, P> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z));
- u16vec3 Packed(uninitialize);
+ vec<3, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z));
+ u16vec3 Packed;
memcpy(&Packed, &Unpack, sizeof(Packed));
return Packed;
}
- GLM_FUNC_QUALIFIER static tvec3<float, P> unpack(tvec3<uint16, P> const & v)
+ GLM_FUNC_QUALIFIER static vec<3, float, Q> unpack(vec<3, uint16, Q> const& v)
{
- i16vec3 Unpack(uninitialize);
+ i16vec3 Unpack;
memcpy(&Unpack, &v, sizeof(Unpack));
- return tvec3<float, P>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z));
+ return vec<3, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z));
}
};
- template <precision P>
- struct compute_half<P, tvec4>
+ template<qualifier Q>
+ struct compute_half<4, Q>
{
- GLM_FUNC_QUALIFIER static tvec4<uint16, P> pack(tvec4<float, P> const & v)
+ GLM_FUNC_QUALIFIER static vec<4, uint16, Q> pack(vec<4, float, Q> const& v)
{
- tvec4<int16, P> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z), detail::toFloat16(v.w));
- u16vec4 Packed(uninitialize);
+ vec<4, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z), detail::toFloat16(v.w));
+ u16vec4 Packed;
memcpy(&Packed, &Unpack, sizeof(Packed));
return Packed;
}
- GLM_FUNC_QUALIFIER static tvec4<float, P> unpack(tvec4<uint16, P> const & v)
+ GLM_FUNC_QUALIFIER static vec<4, float, Q> unpack(vec<4, uint16, Q> const& v)
{
- i16vec4 Unpack(uninitialize);
+ i16vec4 Unpack;
memcpy(&Unpack, &v, sizeof(Unpack));
- return tvec4<float, P>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z), detail::toFloat32(v.w));
+ return vec<4, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z), detail::toFloat32(v.w));
}
};
}//namespace detail
@@ -355,14 +356,14 @@ namespace detail
{
return static_cast<uint8>(round(clamp(v, 0.0f, 1.0f) * 255.0f));
}
-
+
GLM_FUNC_QUALIFIER float unpackUnorm1x8(uint8 p)
{
float const Unpack(p);
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)
{
u8vec2 const Topack(round(clamp(v, 0.0f, 1.0f) * 255.0f));
@@ -370,10 +371,10 @@ namespace detail
memcpy(&Unpack, &Topack, sizeof(Unpack));
return Unpack;
}
-
+
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x8(uint16 p)
{
- u8vec2 Unpack(uninitialize);
+ u8vec2 Unpack;
memcpy(&Unpack, &p, sizeof(Unpack));
return vec2(Unpack) * float(0.0039215686274509803921568627451); // 1 / 255
}
@@ -385,7 +386,7 @@ namespace detail
memcpy(&Packed, &Topack, sizeof(Packed));
return Packed;
}
-
+
GLM_FUNC_QUALIFIER float unpackSnorm1x8(uint8 p)
{
int8 Unpack = 0;
@@ -394,18 +395,18 @@ namespace detail
static_cast<float>(Unpack) * 0.00787401574803149606299212598425f, // 1.0f / 127.0f
-1.0f, 1.0f);
}
-
- GLM_FUNC_QUALIFIER uint16 packSnorm2x8(vec2 const & v)
+
+ GLM_FUNC_QUALIFIER uint16 packSnorm2x8(vec2 const& v)
{
i8vec2 const Topack(round(clamp(v, -1.0f, 1.0f) * 127.0f));
uint16 Packed = 0;
memcpy(&Packed, &Topack, sizeof(Packed));
return Packed;
}
-
+
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x8(uint16 p)
{
- i8vec2 Unpack(uninitialize);
+ i8vec2 Unpack;
memcpy(&Unpack, &p, sizeof(Unpack));
return clamp(
vec2(Unpack) * 0.00787401574803149606299212598425f, // 1.0f / 127.0f
@@ -423,7 +424,7 @@ namespace detail
return Unpack * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
}
- GLM_FUNC_QUALIFIER uint64 packUnorm4x16(vec4 const & v)
+ GLM_FUNC_QUALIFIER uint64 packUnorm4x16(vec4 const& v)
{
u16vec4 const Topack(round(clamp(v , 0.0f, 1.0f) * 65535.0f));
uint64 Packed = 0;
@@ -433,7 +434,7 @@ namespace detail
GLM_FUNC_QUALIFIER vec4 unpackUnorm4x16(uint64 p)
{
- u16vec4 Unpack(uninitialize);
+ u16vec4 Unpack;
memcpy(&Unpack, &p, sizeof(Unpack));
return vec4(Unpack) * 1.5259021896696421759365224689097e-5f; // 1.0 / 65535.0
}
@@ -451,11 +452,11 @@ namespace detail
int16 Unpack = 0;
memcpy(&Unpack, &p, sizeof(Unpack));
return clamp(
- static_cast<float>(Unpack) * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
+ static_cast<float>(Unpack) * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
-1.0f, 1.0f);
}
- GLM_FUNC_QUALIFIER uint64 packSnorm4x16(vec4 const & v)
+ GLM_FUNC_QUALIFIER uint64 packSnorm4x16(vec4 const& v)
{
i16vec4 const Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
uint64 Packed = 0;
@@ -465,7 +466,7 @@ namespace detail
GLM_FUNC_QUALIFIER vec4 unpackSnorm4x16(uint64 p)
{
- i16vec4 Unpack(uninitialize);
+ i16vec4 Unpack;
memcpy(&Unpack, &p, sizeof(Unpack));
return clamp(
vec4(Unpack) * 3.0518509475997192297128208258309e-5f, //1.0f / 32767.0f,
@@ -487,7 +488,7 @@ namespace detail
return detail::toFloat32(Unpack);
}
- GLM_FUNC_QUALIFIER uint64 packHalf4x16(glm::vec4 const & v)
+ GLM_FUNC_QUALIFIER uint64 packHalf4x16(glm::vec4 const& v)
{
i16vec4 const Unpack(
detail::toFloat16(v.x),
@@ -501,7 +502,7 @@ namespace detail
GLM_FUNC_QUALIFIER glm::vec4 unpackHalf4x16(uint64 v)
{
- i16vec4 Unpack(uninitialize);
+ i16vec4 Unpack;
memcpy(&Unpack, &v, sizeof(Unpack));
return vec4(
detail::toFloat32(Unpack.x),
@@ -510,14 +511,14 @@ namespace detail
detail::toFloat32(Unpack.w));
}
- GLM_FUNC_QUALIFIER uint32 packI3x10_1x2(ivec4 const & v)
+ GLM_FUNC_QUALIFIER uint32 packI3x10_1x2(ivec4 const& v)
{
detail::i10i10i10i2 Result;
Result.data.x = v.x;
Result.data.y = v.y;
Result.data.z = v.z;
Result.data.w = v.w;
- return Result.pack;
+ return Result.pack;
}
GLM_FUNC_QUALIFIER ivec4 unpackI3x10_1x2(uint32 v)
@@ -531,14 +532,14 @@ namespace detail
Unpack.data.w);
}
- GLM_FUNC_QUALIFIER uint32 packU3x10_1x2(uvec4 const & v)
+ GLM_FUNC_QUALIFIER uint32 packU3x10_1x2(uvec4 const& v)
{
detail::u10u10u10u2 Result;
Result.data.x = v.x;
Result.data.y = v.y;
Result.data.z = v.z;
Result.data.w = v.w;
- return Result.pack;
+ return Result.pack;
}
GLM_FUNC_QUALIFIER uvec4 unpackU3x10_1x2(uint32 v)
@@ -552,13 +553,15 @@ namespace detail
Unpack.data.w);
}
- GLM_FUNC_QUALIFIER uint32 packSnorm3x10_1x2(vec4 const & v)
+ GLM_FUNC_QUALIFIER uint32 packSnorm3x10_1x2(vec4 const& v)
{
+ ivec4 const Pack(round(clamp(v,-1.0f, 1.0f) * vec4(511.f, 511.f, 511.f, 1.f)));
+
detail::i10i10i10i2 Result;
- Result.data.x = int(round(clamp(v.x,-1.0f, 1.0f) * 511.f));
- Result.data.y = int(round(clamp(v.y,-1.0f, 1.0f) * 511.f));
- Result.data.z = int(round(clamp(v.z,-1.0f, 1.0f) * 511.f));
- Result.data.w = int(round(clamp(v.w,-1.0f, 1.0f) * 1.f));
+ Result.data.x = Pack.x;
+ Result.data.y = Pack.y;
+ Result.data.z = Pack.z;
+ Result.data.w = Pack.w;
return Result.pack;
}
@@ -566,15 +569,13 @@ namespace detail
{
detail::i10i10i10i2 Unpack;
Unpack.pack = v;
- vec4 Result;
- Result.x = clamp(float(Unpack.data.x) / 511.f, -1.0f, 1.0f);
- Result.y = clamp(float(Unpack.data.y) / 511.f, -1.0f, 1.0f);
- Result.z = clamp(float(Unpack.data.z) / 511.f, -1.0f, 1.0f);
- Result.w = clamp(float(Unpack.data.w) / 1.f, -1.0f, 1.0f);
- return Result;
+
+ vec4 const Result(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w);
+
+ return clamp(Result * vec4(1.f / 511.f, 1.f / 511.f, 1.f / 511.f, 1.f), -1.0f, 1.0f);
}
- GLM_FUNC_QUALIFIER uint32 packUnorm3x10_1x2(vec4 const & v)
+ GLM_FUNC_QUALIFIER uint32 packUnorm3x10_1x2(vec4 const& v)
{
uvec4 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec4(1023.f, 1023.f, 1023.f, 3.f)));
@@ -595,7 +596,7 @@ namespace detail
return vec4(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w) * ScaleFactors;
}
- GLM_FUNC_QUALIFIER uint32 packF2x11_1x10(vec3 const & v)
+ GLM_FUNC_QUALIFIER uint32 packF2x11_1x10(vec3 const& v)
{
return
((detail::floatTo11bit(v.x) & ((1 << 11) - 1)) << 0) |
@@ -611,15 +612,15 @@ namespace detail
detail::packed10bitToFloat(v >> 22));
}
- GLM_FUNC_QUALIFIER uint32 packF3x9_E1x5(vec3 const & v)
+ GLM_FUNC_QUALIFIER uint32 packF3x9_E1x5(vec3 const& v)
{
float const SharedExpMax = (pow(2.0f, 9.0f - 1.0f) / pow(2.0f, 9.0f)) * pow(2.0f, 31.f - 15.f);
vec3 const Color = clamp(v, 0.0f, SharedExpMax);
float const MaxColor = max(Color.x, max(Color.y, Color.z));
float const ExpSharedP = max(-15.f - 1.f, floor(log2(MaxColor))) + 1.0f + 15.f;
- float const MaxShared = floor(MaxColor / pow(2.0f, (ExpSharedP - 16.f - 9.f)) + 0.5f);
- float const ExpShared = MaxShared == pow(2.0f, 9.0f) ? ExpSharedP + 1.0f : ExpSharedP;
+ float const MaxShared = floor(MaxColor / pow(2.0f, (ExpSharedP - 15.f - 9.f)) + 0.5f);
+ float const ExpShared = detail::compute_equal<float>::call(MaxShared, pow(2.0f, 9.0f)) ? ExpSharedP + 1.0f : ExpSharedP;
uvec3 const ColorComp(floor(Color / pow(2.f, (ExpShared - 15.f - 9.f)) + 0.5f));
@@ -639,55 +640,71 @@ namespace detail
return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * pow(2.0f, Unpack.data.w - 15.f - 9.f);
}
- template <precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<uint16, P> packHalf(vecType<float, P> const & v)
+ // Based on Brian Karis http://graphicrants.blogspot.fr/2009/04/rgbm-color-encoding.html
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, T, Q> packRGBM(vec<3, T, Q> const& rgb)
{
- return detail::compute_half<P, vecType>::pack(v);
+ vec<3, T, Q> const Color(rgb * static_cast<T>(1.0 / 6.0));
+ T Alpha = clamp(max(max(Color.x, Color.y), max(Color.z, static_cast<T>(1e-6))), static_cast<T>(0), static_cast<T>(1));
+ Alpha = ceil(Alpha * static_cast<T>(255.0)) / static_cast<T>(255.0);
+ return vec<4, T, Q>(Color / Alpha, Alpha);
}
- template <precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<float, P> unpackHalf(vecType<uint16, P> const & v)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& rgbm)
{
- return detail::compute_half<P, vecType>::unpack(v);
+ return vec<3, T, Q>(rgbm.x, rgbm.y, rgbm.z) * rgbm.w * static_cast<T>(6);
}
- template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<uintType, P> packUnorm(vecType<floatType, P> const & v)
+ template<length_t L, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, uint16, Q> packHalf(vec<L, float, Q> const& v)
+ {
+ return detail::compute_half<L, Q>::pack(v);
+ }
+
+ template<length_t L, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, float, Q> unpackHalf(vec<L, uint16, Q> const& v)
+ {
+ return detail::compute_half<L, Q>::unpack(v);
+ }
+
+ template<typename uintType, length_t L, typename floatType, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, uintType, Q> packUnorm(vec<L, floatType, Q> const& v)
{
GLM_STATIC_ASSERT(std::numeric_limits<uintType>::is_integer, "uintType must be an integer type");
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
- return vecType<uintType, P>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max())));
+ return vec<L, uintType, Q>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max())));
}
- template <typename uintType, typename floatType, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<floatType, P> unpackUnorm(vecType<uintType, P> const & v)
+ template<typename floatType, length_t L, typename uintType, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, floatType, Q> unpackUnorm(vec<L, uintType, Q> const& v)
{
GLM_STATIC_ASSERT(std::numeric_limits<uintType>::is_integer, "uintType must be an integer type");
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
- return vecType<float, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max()));
+ return vec<L, float, Q>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max()));
}
- template <typename intType, typename floatType, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<intType, P> packSnorm(vecType<floatType, P> const & v)
+ template<typename intType, length_t L, typename floatType, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, intType, Q> packSnorm(vec<L, floatType, Q> const& v)
{
GLM_STATIC_ASSERT(std::numeric_limits<intType>::is_integer, "uintType must be an integer type");
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
- return vecType<intType, P>(round(clamp(v , static_cast<floatType>(-1), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<intType>::max())));
+ return vec<L, intType, Q>(round(clamp(v , static_cast<floatType>(-1), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<intType>::max())));
}
- template <typename intType, typename floatType, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<floatType, P> unpackSnorm(vecType<intType, P> const & v)
+ template<typename floatType, length_t L, typename intType, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, floatType, Q> unpackSnorm(vec<L, intType, Q> const& v)
{
GLM_STATIC_ASSERT(std::numeric_limits<intType>::is_integer, "uintType must be an integer type");
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
- return clamp(vecType<floatType, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<intType>::max())), static_cast<floatType>(-1), static_cast<floatType>(1));
+ return clamp(vec<L, floatType, Q>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<intType>::max())), static_cast<floatType>(-1), static_cast<floatType>(1));
}
- GLM_FUNC_QUALIFIER uint8 packUnorm2x4(vec2 const & v)
+ GLM_FUNC_QUALIFIER uint8 packUnorm2x4(vec2 const& v)
{
u32vec2 const Unpack(round(clamp(v, 0.0f, 1.0f) * 15.0f));
detail::u4u4 Result;
@@ -704,7 +721,7 @@ namespace detail
return vec2(Unpack.data.x, Unpack.data.y) * ScaleFactor;
}
- GLM_FUNC_QUALIFIER uint16 packUnorm4x4(vec4 const & v)
+ GLM_FUNC_QUALIFIER uint16 packUnorm4x4(vec4 const& v)
{
u32vec4 const Unpack(round(clamp(v, 0.0f, 1.0f) * 15.0f));
detail::u4u4u4u4 Result;
@@ -723,7 +740,7 @@ namespace detail
return vec4(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w) * ScaleFactor;
}
- GLM_FUNC_QUALIFIER uint16 packUnorm1x5_1x6_1x5(vec3 const & v)
+ GLM_FUNC_QUALIFIER uint16 packUnorm1x5_1x6_1x5(vec3 const& v)
{
u32vec3 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec3(31.f, 63.f, 31.f)));
detail::u5u6u5 Result;
@@ -741,7 +758,7 @@ namespace detail
return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * ScaleFactor;
}
- GLM_FUNC_QUALIFIER uint16 packUnorm3x5_1x1(vec4 const & v)
+ GLM_FUNC_QUALIFIER uint16 packUnorm3x5_1x1(vec4 const& v)
{
u32vec4 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec4(31.f, 31.f, 31.f, 1.f)));
detail::u5u5u5u1 Result;
@@ -760,7 +777,7 @@ namespace detail
return vec4(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w) * ScaleFactor;
}
- GLM_FUNC_QUALIFIER uint8 packUnorm2x3_1x2(vec3 const & v)
+ GLM_FUNC_QUALIFIER uint8 packUnorm2x3_1x2(vec3 const& v)
{
u32vec3 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec3(7.f, 7.f, 3.f)));
detail::u3u3u2 Result;
@@ -777,5 +794,145 @@ namespace detail
Unpack.pack = v;
return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * ScaleFactor;
}
+
+ GLM_FUNC_QUALIFIER int16 packInt2x8(i8vec2 const& v)
+ {
+ int16 Pack = 0;
+ memcpy(&Pack, &v, sizeof(Pack));
+ return Pack;
+ }
+
+ GLM_FUNC_QUALIFIER i8vec2 unpackInt2x8(int16 p)
+ {
+ i8vec2 Unpack;
+ memcpy(&Unpack, &p, sizeof(Unpack));
+ return Unpack;
+ }
+
+ GLM_FUNC_QUALIFIER uint16 packUint2x8(u8vec2 const& v)
+ {
+ uint16 Pack = 0;
+ memcpy(&Pack, &v, sizeof(Pack));
+ return Pack;
+ }
+
+ GLM_FUNC_QUALIFIER u8vec2 unpackUint2x8(uint16 p)
+ {
+ u8vec2 Unpack;
+ memcpy(&Unpack, &p, sizeof(Unpack));
+ return Unpack;
+ }
+
+ GLM_FUNC_QUALIFIER int32 packInt4x8(i8vec4 const& v)
+ {
+ int32 Pack = 0;
+ memcpy(&Pack, &v, sizeof(Pack));
+ return Pack;
+ }
+
+ GLM_FUNC_QUALIFIER i8vec4 unpackInt4x8(int32 p)
+ {
+ i8vec4 Unpack;
+ memcpy(&Unpack, &p, sizeof(Unpack));
+ return Unpack;
+ }
+
+ GLM_FUNC_QUALIFIER uint32 packUint4x8(u8vec4 const& v)
+ {
+ uint32 Pack = 0;
+ memcpy(&Pack, &v, sizeof(Pack));
+ return Pack;
+ }
+
+ GLM_FUNC_QUALIFIER u8vec4 unpackUint4x8(uint32 p)
+ {
+ u8vec4 Unpack;
+ memcpy(&Unpack, &p, sizeof(Unpack));
+ return Unpack;
+ }
+
+ GLM_FUNC_QUALIFIER int packInt2x16(i16vec2 const& v)
+ {
+ int Pack = 0;
+ memcpy(&Pack, &v, sizeof(Pack));
+ return Pack;
+ }
+
+ GLM_FUNC_QUALIFIER i16vec2 unpackInt2x16(int p)
+ {
+ i16vec2 Unpack;
+ memcpy(&Unpack, &p, sizeof(Unpack));
+ return Unpack;
+ }
+
+ GLM_FUNC_QUALIFIER int64 packInt4x16(i16vec4 const& v)
+ {
+ int64 Pack = 0;
+ memcpy(&Pack, &v, sizeof(Pack));
+ return Pack;
+ }
+
+ GLM_FUNC_QUALIFIER i16vec4 unpackInt4x16(int64 p)
+ {
+ i16vec4 Unpack;
+ memcpy(&Unpack, &p, sizeof(Unpack));
+ return Unpack;
+ }
+
+ GLM_FUNC_QUALIFIER uint packUint2x16(u16vec2 const& v)
+ {
+ uint Pack = 0;
+ memcpy(&Pack, &v, sizeof(Pack));
+ return Pack;
+ }
+
+ GLM_FUNC_QUALIFIER u16vec2 unpackUint2x16(uint p)
+ {
+ u16vec2 Unpack;
+ memcpy(&Unpack, &p, sizeof(Unpack));
+ return Unpack;
+ }
+
+ GLM_FUNC_QUALIFIER uint64 packUint4x16(u16vec4 const& v)
+ {
+ uint64 Pack = 0;
+ memcpy(&Pack, &v, sizeof(Pack));
+ return Pack;
+ }
+
+ GLM_FUNC_QUALIFIER u16vec4 unpackUint4x16(uint64 p)
+ {
+ u16vec4 Unpack;
+ memcpy(&Unpack, &p, sizeof(Unpack));
+ return Unpack;
+ }
+
+ GLM_FUNC_QUALIFIER int64 packInt2x32(i32vec2 const& v)
+ {
+ int64 Pack = 0;
+ memcpy(&Pack, &v, sizeof(Pack));
+ return Pack;
+ }
+
+ GLM_FUNC_QUALIFIER i32vec2 unpackInt2x32(int64 p)
+ {
+ i32vec2 Unpack;
+ memcpy(&Unpack, &p, sizeof(Unpack));
+ return Unpack;
+ }
+
+ GLM_FUNC_QUALIFIER uint64 packUint2x32(u32vec2 const& v)
+ {
+ uint64 Pack = 0;
+ memcpy(&Pack, &v, sizeof(Pack));
+ return Pack;
+ }
+
+ GLM_FUNC_QUALIFIER u32vec2 unpackUint2x32(uint64 p)
+ {
+ u32vec2 Unpack;
+ memcpy(&Unpack, &p, sizeof(Unpack));
+ return Unpack;
+ }
}//namespace glm
diff --git a/external/include/glm/gtc/quaternion.hpp b/external/include/glm/gtc/quaternion.hpp
index 8af1c8b..25f741c 100644
--- a/external/include/glm/gtc/quaternion.hpp
+++ b/external/include/glm/gtc/quaternion.hpp
@@ -2,15 +2,14 @@
/// @file glm/gtc/quaternion.hpp
///
/// @see core (dependence)
-/// @see gtc_half_float (dependence)
/// @see gtc_constants (dependence)
///
/// @defgroup gtc_quaternion GLM_GTC_quaternion
/// @ingroup gtc
///
-/// @brief Defines a templated quaternion type and several quaternion operations.
+/// Include <glm/gtc/quaternion.hpp> to use the features of this extension.
///
-/// <glm/gtc/quaternion.hpp> need to be included to use these functionalities.
+/// Defines a templated quaternion type and several quaternion operations.
#pragma once
@@ -30,12 +29,12 @@ namespace glm
/// @addtogroup gtc_quaternion
/// @{
- template <typename T, precision P = defaultp>
+ template<typename T, qualifier Q = defaultp>
struct tquat
{
// -- Implementation detail --
- typedef tquat<T, P> type;
+ typedef tquat<T, Q> type;
typedef T value_type;
// -- Data --
@@ -50,13 +49,13 @@ namespace glm
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# endif
-
+
union
{
struct { T x, y, z, w;};
- typename detail::storage<T, sizeof(T) * 4, detail::is_aligned<P>::value>::type data;
+ typename detail::storage<T, sizeof(T) * 4, detail::is_aligned<Q>::value>::type data;
};
-
+
# if GLM_COMPILER & GLM_COMPILER_CLANG
# pragma clang diagnostic pop
# endif
@@ -71,33 +70,32 @@ namespace glm
typedef length_t length_type;
/// Return the count of components of a quaternion
- GLM_FUNC_DECL static length_type length(){return 4;}
+ GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 4;}
GLM_FUNC_DECL T & operator[](length_type i);
- GLM_FUNC_DECL T const & operator[](length_type i) const;
+ GLM_FUNC_DECL T const& operator[](length_type i) const;
// -- Implicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR tquat() GLM_DEFAULT_CTOR;
- GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, P> const & q) GLM_DEFAULT;
- template <precision Q>
- GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, Q> const & q);
+ GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, Q> const& q) GLM_DEFAULT;
+ template<qualifier P>
+ GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, P> const& q);
// -- Explicit basic constructors --
- GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tquat(ctor);
- GLM_FUNC_DECL GLM_CONSTEXPR tquat(T const & s, tvec3<T, P> const & v);
- GLM_FUNC_DECL GLM_CONSTEXPR tquat(T const & w, T const & x, T const & y, T const & z);
+ GLM_FUNC_DECL GLM_CONSTEXPR tquat(T s, vec<3, T, Q> const& v);
+ GLM_FUNC_DECL GLM_CONSTEXPR tquat(T w, T x, T y, T z);
// -- Conversion constructors --
- template <typename U, precision Q>
- GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tquat(tquat<U, Q> const & q);
+ template<typename U, qualifier P>
+ GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tquat(tquat<U, P> const& q);
/// Explicit conversion operators
# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
- GLM_FUNC_DECL explicit operator tmat3x3<T, P>();
- GLM_FUNC_DECL explicit operator tmat4x4<T, P>();
+ GLM_FUNC_DECL explicit operator mat<3, 3, T, Q>();
+ GLM_FUNC_DECL explicit operator mat<4, 4, T, Q>();
# endif
/// Create a quaternion from two normalized axis
@@ -106,290 +104,332 @@ namespace glm
/// @param v A second normalized axis
/// @see gtc_quaternion
/// @see http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors
- GLM_FUNC_DECL tquat(tvec3<T, P> const & u, tvec3<T, P> const & v);
+ GLM_FUNC_DECL tquat(vec<3, T, Q> const& u, vec<3, T, Q> const& v);
/// Build a quaternion from euler angles (pitch, yaw, roll), in radians.
- GLM_FUNC_DECL GLM_EXPLICIT tquat(tvec3<T, P> const & eulerAngles);
- GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat3x3<T, P> const & m);
- GLM_FUNC_DECL GLM_EXPLICIT tquat(tmat4x4<T, P> const & m);
+ GLM_FUNC_DECL GLM_EXPLICIT tquat(vec<3, T, Q> const& eulerAngles);
+ GLM_FUNC_DECL GLM_EXPLICIT tquat(mat<3, 3, T, Q> const& q);
+ GLM_FUNC_DECL GLM_EXPLICIT tquat(mat<4, 4, T, Q> const& q);
// -- Unary arithmetic operators --
- GLM_FUNC_DECL tquat<T, P> & operator=(tquat<T, P> const & m) GLM_DEFAULT;
-
- template <typename U>
- GLM_FUNC_DECL tquat<T, P> & operator=(tquat<U, P> const & m);
- template <typename U>
- GLM_FUNC_DECL tquat<T, P> & operator+=(tquat<U, P> const & q);
- template <typename U>
- GLM_FUNC_DECL tquat<T, P> & operator-=(tquat<U, P> const & q);
- template <typename U>
- GLM_FUNC_DECL tquat<T, P> & operator*=(tquat<U, P> const & q);
- template <typename U>
- GLM_FUNC_DECL tquat<T, P> & operator*=(U s);
- template <typename U>
- GLM_FUNC_DECL tquat<T, P> & operator/=(U s);
+ GLM_FUNC_DECL tquat<T, Q> & operator=(tquat<T, Q> const& q) GLM_DEFAULT;
+
+ template<typename U>
+ GLM_FUNC_DECL tquat<T, Q> & operator=(tquat<U, Q> const& q);
+ template<typename U>
+ GLM_FUNC_DECL tquat<T, Q> & operator+=(tquat<U, Q> const& q);
+ template<typename U>
+ GLM_FUNC_DECL tquat<T, Q> & operator-=(tquat<U, Q> const& q);
+ template<typename U>
+ GLM_FUNC_DECL tquat<T, Q> & operator*=(tquat<U, Q> const& q);
+ template<typename U>
+ GLM_FUNC_DECL tquat<T, Q> & operator*=(U s);
+ template<typename U>
+ GLM_FUNC_DECL tquat<T, Q> & operator/=(U s);
};
// -- Unary bit operators --
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> operator+(tquat<T, P> const & q);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> operator+(tquat<T, Q> const& q);
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> operator-(tquat<T, P> const & q);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> operator-(tquat<T, Q> const& q);
// -- Binary operators --
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> operator+(tquat<T, P> const & q, tquat<T, P> const & p);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> operator+(tquat<T, Q> const& q, tquat<T, Q> const& p);
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> operator*(tquat<T, P> const & q, tquat<T, P> const & p);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> operator-(tquat<T, Q> const& q, tquat<T, Q> const& p);
- template <typename T, precision P>
- GLM_FUNC_DECL tvec3<T, P> operator*(tquat<T, P> const & q, tvec3<T, P> const & v);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> operator*(tquat<T, Q> const& q, tquat<T, Q> const& p);
- template <typename T, precision P>
- GLM_FUNC_DECL tvec3<T, P> operator*(tvec3<T, P> const & v, tquat<T, P> const & q);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> operator*(tquat<T, Q> const& q, vec<3, T, Q> const& v);
- template <typename T, precision P>
- GLM_FUNC_DECL tvec4<T, P> operator*(tquat<T, P> const & q, tvec4<T, P> const & v);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> operator*(vec<3, T, Q> const& v, tquat<T, Q> const& q);
- template <typename T, precision P>
- GLM_FUNC_DECL tvec4<T, P> operator*(tvec4<T, P> const & v, tquat<T, P> const & q);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, T, Q> operator*(tquat<T, Q> const& q, vec<4, T, Q> const& v);
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> operator*(tquat<T, P> const & q, T const & s);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, T, Q> operator*(vec<4, T, Q> const& v, tquat<T, Q> const& q);
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> operator*(T const & s, tquat<T, P> const & q);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> operator*(tquat<T, Q> const& q, T const& s);
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> operator/(tquat<T, P> const & q, T const & s);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> operator*(T const& s, tquat<T, Q> const& q);
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> operator/(tquat<T, Q> const& q, T const& s);
// -- Boolean operators --
- template <typename T, precision P>
- GLM_FUNC_DECL bool operator==(tquat<T, P> const & q1, tquat<T, P> const & q2);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL bool operator==(tquat<T, Q> const& q1, tquat<T, Q> const& q2);
- template <typename T, precision P>
- GLM_FUNC_DECL bool operator!=(tquat<T, P> const & q1, tquat<T, P> const & q2);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL bool operator!=(tquat<T, Q> const& q1, tquat<T, Q> const& q2);
/// Returns the length of the quaternion.
- ///
+ ///
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL T length(tquat<T, P> const & q);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL T length(tquat<T, Q> const& q);
/// Returns the normalized quaternion.
- ///
+ ///
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> normalize(tquat<T, P> const & q);
-
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> normalize(tquat<T, Q> const& q);
+
/// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ...
- ///
+ ///
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P, template <typename, precision> class quatType>
- GLM_FUNC_DECL T dot(quatType<T, P> const & x, quatType<T, P> const & y);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL T dot(tquat<T, Q> const& x, tquat<T, Q> const& y);
/// Spherical linear interpolation of two quaternions.
/// The interpolation is oriented and the rotation is performed at constant speed.
/// For short path spherical linear interpolation, use the slerp function.
- ///
+ ///
/// @param x A quaternion
/// @param y A quaternion
/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
- /// @tparam T Value type used to build the quaternion. Supported: half, float or double.
+ /// @tparam T Floating-point scalar types.
+ ///
+ /// @see - slerp(tquat<T, Q> const& x, tquat<T, Q> const& y, T const& a)
/// @see gtc_quaternion
- /// @see - slerp(tquat<T, P> const & x, tquat<T, P> const & y, T const & a)
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> mix(tquat<T, P> const & x, tquat<T, P> const & y, T a);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> mix(tquat<T, Q> const& x, tquat<T, Q> const& y, T a);
/// Linear interpolation of two quaternions.
/// The interpolation is oriented.
- ///
+ ///
/// @param x A quaternion
/// @param y A quaternion
/// @param a Interpolation factor. The interpolation is defined in the range [0, 1].
- /// @tparam T Value type used to build the quaternion. Supported: half, float or double.
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> lerp(tquat<T, P> const & x, tquat<T, P> const & y, T a);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> lerp(tquat<T, Q> const& x, tquat<T, Q> const& y, T a);
/// Spherical linear interpolation of two quaternions.
/// The interpolation always take the short path and the rotation is performed at constant speed.
- ///
+ ///
/// @param x A quaternion
/// @param y A quaternion
/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
- /// @tparam T Value type used to build the quaternion. Supported: half, float or double.
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> slerp(tquat<T, P> const & x, tquat<T, P> const & y, T a);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> slerp(tquat<T, Q> const& x, tquat<T, Q> const& y, T a);
/// Returns the q conjugate.
- ///
+ ///
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> conjugate(tquat<T, P> const & q);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> conjugate(tquat<T, Q> const& q);
/// Returns the q inverse.
- ///
+ ///
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> inverse(tquat<T, P> const & q);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> inverse(tquat<T, Q> const& q);
/// Rotates a quaternion from a vector of 3 components axis and an angle.
- ///
+ ///
/// @param q Source orientation
/// @param angle Angle expressed in radians.
/// @param axis Axis of the rotation
- ///
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> rotate(tquat<T, P> const & q, T const & angle, tvec3<T, P> const & axis);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> rotate(tquat<T, Q> const& q, T const& angle, vec<3, T, Q> const& axis);
/// Returns euler angles, pitch as x, yaw as y, roll as z.
- /// The result is expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise.
- ///
+ /// The result is expressed in radians.
+ ///
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tvec3<T, P> eulerAngles(tquat<T, P> const & x);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> eulerAngles(tquat<T, Q> const& x);
/// Returns roll value of euler angles expressed in radians.
///
- /// @see gtx_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL T roll(tquat<T, P> const & x);
+ /// @tparam T Floating-point scalar types.
+ ///
+ /// @see gtc_quaternion
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL T roll(tquat<T, Q> const& x);
/// Returns pitch value of euler angles expressed in radians.
///
- /// @see gtx_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL T pitch(tquat<T, P> const & x);
+ /// @tparam T Floating-point scalar types.
+ ///
+ /// @see gtc_quaternion
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL T pitch(tquat<T, Q> const& x);
/// Returns yaw value of euler angles expressed in radians.
///
- /// @see gtx_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL T yaw(tquat<T, P> const & x);
+ /// @tparam T Floating-point scalar types.
+ ///
+ /// @see gtc_quaternion
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL T yaw(tquat<T, Q> const& x);
/// Converts a quaternion to a 3 * 3 matrix.
- ///
+ ///
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tmat3x3<T, P> mat3_cast(tquat<T, P> const & x);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL mat<3, 3, T, Q> mat3_cast(tquat<T, Q> const& x);
/// Converts a quaternion to a 4 * 4 matrix.
- ///
+ ///
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tmat4x4<T, P> mat4_cast(tquat<T, P> const & x);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL mat<4, 4, T, Q> mat4_cast(tquat<T, Q> const& x);
- /// Converts a 3 * 3 matrix to a quaternion.
- ///
+ /// Converts a pure rotation 3 * 3 matrix to a quaternion.
+ ///
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> quat_cast(tmat3x3<T, P> const & x);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> quat_cast(mat<3, 3, T, Q> const& x);
- /// Converts a 4 * 4 matrix to a quaternion.
- ///
+ /// Converts a pure rotation 4 * 4 matrix to a quaternion.
+ ///
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> quat_cast(tmat4x4<T, P> const & x);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> quat_cast(mat<4, 4, T, Q> const& x);
/// Returns the quaternion rotation angle.
///
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL T angle(tquat<T, P> const & x);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL T angle(tquat<T, Q> const& x);
/// Returns the q rotation axis.
///
+ /// @tparam T Floating-point scalar types.
+ ///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tvec3<T, P> axis(tquat<T, P> const & x);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> axis(tquat<T, Q> const& x);
/// Build a quaternion from an angle and a normalized axis.
///
/// @param angle Angle expressed in radians.
/// @param axis Axis of the quaternion, must be normalized.
+ /// @tparam T Floating-point scalar types.
///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tquat<T, P> angleAxis(T const & angle, tvec3<T, P> const & axis);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL tquat<T, Q> angleAxis(T const& angle, vec<3, T, Q> const& axis);
/// Returns the component-wise comparison result of x < y.
- ///
- /// @tparam quatType Floating-point quaternion types.
+ ///
+ /// @tparam T Floating-point scalar types.
///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tvec4<bool, P> lessThan(tquat<T, P> const & x, tquat<T, P> const & y);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, bool, Q> lessThan(tquat<T, Q> const& x, tquat<T, Q> const& y);
/// Returns the component-wise comparison of result x <= y.
///
- /// @tparam quatType Floating-point quaternion types.
+ /// @tparam T Floating-point scalar types.
///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tvec4<bool, P> lessThanEqual(tquat<T, P> const & x, tquat<T, P> const & y);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, bool, Q> lessThanEqual(tquat<T, Q> const& x, tquat<T, Q> const& y);
/// Returns the component-wise comparison of result x > y.
///
- /// @tparam quatType Floating-point quaternion types.
+ /// @tparam T Floating-point scalar types.
///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tvec4<bool, P> greaterThan(tquat<T, P> const & x, tquat<T, P> const & y);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, bool, Q> greaterThan(tquat<T, Q> const& x, tquat<T, Q> const& y);
/// Returns the component-wise comparison of result x >= y.
///
- /// @tparam quatType Floating-point quaternion types.
+ /// @tparam T Floating-point scalar types.
///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tvec4<bool, P> greaterThanEqual(tquat<T, P> const & x, tquat<T, P> const & y);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, bool, Q> greaterThanEqual(tquat<T, Q> const& x, tquat<T, Q> const& y);
/// Returns the component-wise comparison of result x == y.
///
- /// @tparam quatType Floating-point quaternion types.
+ /// @tparam T Floating-point scalar types.
///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tvec4<bool, P> equal(tquat<T, P> const & x, tquat<T, P> const & y);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, bool, Q> equal(tquat<T, Q> const& x, tquat<T, Q> const& y);
/// Returns the component-wise comparison of result x != y.
- ///
- /// @tparam quatType Floating-point quaternion types.
+ ///
+ /// @tparam T Floating-point scalar types.
///
/// @see gtc_quaternion
- template <typename T, precision P>
- GLM_FUNC_DECL tvec4<bool, P> notEqual(tquat<T, P> const & x, tquat<T, P> const & y);
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, bool, Q> notEqual(tquat<T, Q> const& x, tquat<T, Q> const& y);
/// Returns true if x holds a NaN (not a number)
/// representation in the underlying implementation's set of
/// floating point representations. Returns false otherwise,
/// including for implementations with no NaN
/// representations.
- ///
+ ///
/// /!\ When using compiler fast math, this function may fail.
- ///
- /// @tparam genType Floating-point scalar or vector types.
- template <typename T, precision P>
- GLM_FUNC_DECL tvec4<bool, P> isnan(tquat<T, P> const & x);
+ ///
+ /// @tparam T Floating-point scalar types.
+ ///
+ /// @see gtc_quaternion
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, bool, Q> isnan(tquat<T, Q> const& x);
/// Returns true if x holds a positive infinity or negative
/// infinity representation in the underlying implementation's
/// set of floating point representations. Returns false
/// otherwise, including for implementations with no infinity
/// representations.
- ///
- /// @tparam genType Floating-point scalar or vector types.
- template <typename T, precision P>
- GLM_FUNC_DECL tvec4<bool, P> isinf(tquat<T, P> const & x);
+ ///
+ /// @tparam T Floating-point scalar types.
+ ///
+ /// @see gtc_quaternion
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, bool, Q> isinf(tquat<T, Q> const& x);
/// @}
} //namespace glm
diff --git a/external/include/glm/gtc/quaternion.inl b/external/include/glm/gtc/quaternion.inl
index c9b2af7..df4a5f7 100644
--- a/external/include/glm/gtc/quaternion.inl
+++ b/external/include/glm/gtc/quaternion.inl
@@ -4,78 +4,80 @@
#include "../trigonometric.hpp"
#include "../geometric.hpp"
#include "../exponential.hpp"
+#include "../detail/compute_vector_relational.hpp"
+#include "epsilon.hpp"
#include <limits>
namespace glm{
namespace detail
{
- template <typename T, precision P, bool Aligned>
- struct compute_dot<tquat, T, P, Aligned>
+ template<typename T, qualifier Q, bool Aligned>
+ struct compute_dot<tquat<T, Q>, T, Aligned>
{
- static GLM_FUNC_QUALIFIER T call(tquat<T, P> const& x, tquat<T, P> const& y)
+ static GLM_FUNC_QUALIFIER T call(tquat<T, Q> const& a, tquat<T, Q> const& b)
{
- tvec4<T, P> tmp(x.x * y.x, x.y * y.y, x.z * y.z, x.w * y.w);
+ vec<4, T, Q> tmp(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w);
return (tmp.x + tmp.y) + (tmp.z + tmp.w);
}
};
- template <typename T, precision P, bool Aligned>
+ template<typename T, qualifier Q, bool Aligned>
struct compute_quat_add
{
- static tquat<T, P> call(tquat<T, P> const& q, tquat<T, P> const& p)
+ static tquat<T, Q> call(tquat<T, Q> const& q, tquat<T, Q> const& p)
{
- return tquat<T, P>(q.w + p.w, q.x + p.x, q.y + p.y, q.z + p.z);
+ return tquat<T, Q>(q.w + p.w, q.x + p.x, q.y + p.y, q.z + p.z);
}
};
- template <typename T, precision P, bool Aligned>
+ template<typename T, qualifier Q, bool Aligned>
struct compute_quat_sub
{
- static tquat<T, P> call(tquat<T, P> const& q, tquat<T, P> const& p)
+ static tquat<T, Q> call(tquat<T, Q> const& q, tquat<T, Q> const& p)
{
- return tquat<T, P>(q.w - p.w, q.x - p.x, q.y - p.y, q.z - p.z);
+ return tquat<T, Q>(q.w - p.w, q.x - p.x, q.y - p.y, q.z - p.z);
}
};
- template <typename T, precision P, bool Aligned>
+ template<typename T, qualifier Q, bool Aligned>
struct compute_quat_mul_scalar
{
- static tquat<T, P> call(tquat<T, P> const& q, T s)
+ static tquat<T, Q> call(tquat<T, Q> const& q, T s)
{
- return tquat<T, P>(q.w * s, q.x * s, q.y * s, q.z * s);
+ return tquat<T, Q>(q.w * s, q.x * s, q.y * s, q.z * s);
}
};
- template <typename T, precision P, bool Aligned>
+ template<typename T, qualifier Q, bool Aligned>
struct compute_quat_div_scalar
{
- static tquat<T, P> call(tquat<T, P> const& q, T s)
+ static tquat<T, Q> call(tquat<T, Q> const& q, T s)
{
- return tquat<T, P>(q.w / s, q.x / s, q.y / s, q.z / s);
+ return tquat<T, Q>(q.w / s, q.x / s, q.y / s, q.z / s);
}
};
- template <typename T, precision P, bool Aligned>
+ template<typename T, qualifier Q, bool Aligned>
struct compute_quat_mul_vec4
{
- static tvec4<T, P> call(tquat<T, P> const & q, tvec4<T, P> const & v)
+ static vec<4, T, Q> call(tquat<T, Q> const& q, vec<4, T, Q> const& v)
{
- return tvec4<T, P>(q * tvec3<T, P>(v), v.w);
+ return vec<4, T, Q>(q * vec<3, T, Q>(v), v.w);
}
};
}//namespace detail
// -- Component accesses --
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[](typename tquat<T, P>::length_type i)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T & tquat<T, Q>::operator[](typename tquat<T, Q>::length_type i)
{
assert(i >= 0 && i < this->length());
return (&x)[i];
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[](typename tquat<T, P>::length_type i) const
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const& tquat<T, Q>::operator[](typename tquat<T, Q>::length_type i) const
{
assert(i >= 0 && i < this->length());
return (&x)[i];
@@ -83,129 +85,139 @@ namespace detail
// -- Implicit basic constructors --
-# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat()
-# ifndef GLM_FORCE_NO_CTOR_INIT
- : x(0), y(0), z(0), w(1)
+# if !GLM_HAS_DEFAULTED_FUNCTIONS || defined(GLM_FORCE_CTOR_INIT)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, Q>::tquat()
+# ifdef GLM_FORCE_CTOR_INIT
+ : x(0), y(0), z(0), w(1)
# endif
{}
# endif
# if !GLM_HAS_DEFAULTED_FUNCTIONS
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, Q>::tquat(tquat<T, Q> const& q)
: x(q.x), y(q.y), z(q.z), w(q.w)
{}
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
- template <typename T, precision P>
- template <precision Q>
- GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(tquat<T, Q> const & q)
+ template<typename T, qualifier Q>
+ template<qualifier P>
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, Q>::tquat(tquat<T, P> const& q)
: x(q.x), y(q.y), z(q.z), w(q.w)
{}
// -- Explicit basic constructors --
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tquat<T, P>::tquat(ctor)
- {}
-
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(T const & s, tvec3<T, P> const & v)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, Q>::tquat(T s, vec<3, T, Q> const& v)
: x(v.x), y(v.y), z(v.z), w(s)
{}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(T const & w, T const & x, T const & y, T const & z)
- : x(x), y(y), z(z), w(w)
+ template <typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, Q>::tquat(T _w, T _x, T _y, T _z)
+ : x(_x), y(_y), z(_z), w(_w)
{}
// -- Conversion constructors --
- template <typename T, precision P>
- template <typename U, precision Q>
- GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(tquat<U, Q> const & q)
+ template<typename T, qualifier Q>
+ template<typename U, qualifier P>
+ GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, Q>::tquat(tquat<U, P> const& q)
: x(static_cast<T>(q.x))
, y(static_cast<T>(q.y))
, z(static_cast<T>(q.z))
, w(static_cast<T>(q.w))
{}
- //template <typename valType>
+ //template<typename valType>
//GLM_FUNC_QUALIFIER tquat<valType>::tquat
//(
- // valType const & pitch,
- // valType const & yaw,
- // valType const & roll
+ // valType const& pitch,
+ // valType const& yaw,
+ // valType const& roll
//)
//{
- // tvec3<valType> eulerAngle(pitch * valType(0.5), yaw * valType(0.5), roll * valType(0.5));
- // tvec3<valType> c = glm::cos(eulerAngle * valType(0.5));
- // tvec3<valType> s = glm::sin(eulerAngle * valType(0.5));
- //
+ // vec<3, valType> eulerAngle(pitch * valType(0.5), yaw * valType(0.5), roll * valType(0.5));
+ // vec<3, valType> c = glm::cos(eulerAngle * valType(0.5));
+ // vec<3, valType> s = glm::sin(eulerAngle * valType(0.5));
+ //
// this->w = c.x * c.y * c.z + s.x * s.y * s.z;
// this->x = s.x * c.y * c.z - c.x * s.y * s.z;
// this->y = c.x * s.y * c.z + s.x * c.y * s.z;
// this->z = c.x * c.y * s.z - s.x * s.y * c.z;
//}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P>::tquat(tvec3<T, P> const & u, tvec3<T, P> const & v)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q>::tquat(vec<3, T, Q> const& u, vec<3, T, Q> const& v)
{
- tvec3<T, P> const LocalW(cross(u, v));
- T Dot = detail::compute_dot<tvec3, T, P, detail::is_aligned<P>::value>::call(u, v);
- tquat<T, P> q(T(1) + Dot, LocalW.x, LocalW.y, LocalW.z);
+ T norm_u_norm_v = sqrt(dot(u, u) * dot(v, v));
+ T real_part = norm_u_norm_v + dot(u, v);
+ vec<3, T, Q> t;
+
+ if(real_part < static_cast<T>(1.e-6f) * norm_u_norm_v)
+ {
+ // If u and v are exactly opposite, rotate 180 degrees
+ // around an arbitrary orthogonal axis. Axis normalisation
+ // can happen later, when we normalise the quaternion.
+ real_part = static_cast<T>(0);
+ t = abs(u.x) > abs(u.z) ? vec<3, T, Q>(-u.y, u.x, static_cast<T>(0)) : vec<3, T, Q>(static_cast<T>(0), -u.z, u.y);
+ }
+ else
+ {
+ // Otherwise, build quaternion the standard way.
+ t = cross(u, v);
+ }
- *this = normalize(q);
+ *this = normalize(tquat<T, Q>(real_part, t.x, t.y, t.z));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P>::tquat(tvec3<T, P> const & eulerAngle)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q>::tquat(vec<3, T, Q> const& eulerAngle)
{
- tvec3<T, P> c = glm::cos(eulerAngle * T(0.5));
- tvec3<T, P> s = glm::sin(eulerAngle * T(0.5));
-
+ vec<3, T, Q> c = glm::cos(eulerAngle * T(0.5));
+ vec<3, T, Q> s = glm::sin(eulerAngle * T(0.5));
+
this->w = c.x * c.y * c.z + s.x * s.y * s.z;
this->x = s.x * c.y * c.z - c.x * s.y * s.z;
this->y = c.x * s.y * c.z + s.x * c.y * s.z;
this->z = c.x * c.y * s.z - s.x * s.y * c.z;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P>::tquat(tmat3x3<T, P> const & m)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q>::tquat(mat<3, 3, T, Q> const& m)
{
*this = quat_cast(m);
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P>::tquat(tmat4x4<T, P> const & m)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q>::tquat(mat<4, 4, T, Q> const& m)
{
*this = quat_cast(m);
}
# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P>::operator tmat3x3<T, P>()
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q>::operator mat<3, 3, T, Q>()
{
return mat3_cast(*this);
}
-
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P>::operator tmat4x4<T, P>()
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q>::operator mat<4, 4, T, Q>()
{
return mat4_cast(*this);
}
# endif//GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> conjugate(tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> conjugate(tquat<T, Q> const& q)
{
- return tquat<T, P>(q.w, -q.x, -q.y, -q.z);
+ return tquat<T, Q>(q.w, -q.x, -q.y, -q.z);
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> inverse(tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> inverse(tquat<T, Q> const& q)
{
return conjugate(q) / dot(q, q);
}
@@ -213,8 +225,8 @@ namespace detail
// -- Unary arithmetic operators --
# if !GLM_HAS_DEFAULTED_FUNCTIONS
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator=(tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator=(tquat<T, Q> const& q)
{
this->w = q.w;
this->x = q.x;
@@ -224,9 +236,9 @@ namespace detail
}
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
- template <typename T, precision P>
- template <typename U>
- GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator=(tquat<U, P> const & q)
+ template<typename T, qualifier Q>
+ template<typename U>
+ GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator=(tquat<U, Q> const& q)
{
this->w = static_cast<T>(q.w);
this->x = static_cast<T>(q.x);
@@ -235,26 +247,26 @@ namespace detail
return *this;
}
- template <typename T, precision P>
- template <typename U>
- GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator+=(tquat<U, P> const& q)
+ template<typename T, qualifier Q>
+ template<typename U>
+ GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator+=(tquat<U, Q> const& q)
{
- return (*this = detail::compute_quat_add<T, P, detail::is_aligned<P>::value>::call(*this, tquat<T, P>(q)));
+ return (*this = detail::compute_quat_add<T, Q, detail::is_aligned<Q>::value>::call(*this, tquat<T, Q>(q)));
}
- template <typename T, precision P>
- template <typename U>
- GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator-=(tquat<U, P> const& q)
+ template<typename T, qualifier Q>
+ template<typename U>
+ GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator-=(tquat<U, Q> const& q)
{
- return (*this = detail::compute_quat_sub<T, P, detail::is_aligned<P>::value>::call(*this, tquat<T, P>(q)));
+ return (*this = detail::compute_quat_sub<T, Q, detail::is_aligned<Q>::value>::call(*this, tquat<T, Q>(q)));
}
- template <typename T, precision P>
- template <typename U>
- GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator*=(tquat<U, P> const & r)
+ template<typename T, qualifier Q>
+ template<typename U>
+ GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator*=(tquat<U, Q> const& r)
{
- tquat<T, P> const p(*this);
- tquat<T, P> const q(r);
+ tquat<T, Q> const p(*this);
+ tquat<T, Q> const q(r);
this->w = p.w * q.w - p.x * q.x - p.y * q.y - p.z * q.z;
this->x = p.w * q.x + p.x * q.w + p.y * q.z - p.z * q.y;
@@ -263,132 +275,145 @@ namespace detail
return *this;
}
- template <typename T, precision P>
- template <typename U>
- GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator*=(U s)
+ template<typename T, qualifier Q>
+ template<typename U>
+ GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator*=(U s)
{
- return (*this = detail::compute_quat_mul_scalar<T, P, detail::is_aligned<P>::value>::call(*this, static_cast<U>(s)));
+ return (*this = detail::compute_quat_mul_scalar<T, Q, detail::is_aligned<Q>::value>::call(*this, static_cast<U>(s)));
}
- template <typename T, precision P>
- template <typename U>
- GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator/=(U s)
+ template<typename T, qualifier Q>
+ template<typename U>
+ GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator/=(U s)
{
- return (*this = detail::compute_quat_div_scalar<T, P, detail::is_aligned<P>::value>::call(*this, static_cast<U>(s)));
+ return (*this = detail::compute_quat_div_scalar<T, Q, detail::is_aligned<Q>::value>::call(*this, static_cast<U>(s)));
}
// -- Unary bit operators --
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> operator+(tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> operator+(tquat<T, Q> const& q)
{
return q;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> operator-(tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> operator-(tquat<T, Q> const& q)
{
- return tquat<T, P>(-q.w, -q.x, -q.y, -q.z);
+ return tquat<T, Q>(-q.w, -q.x, -q.y, -q.z);
}
// -- Binary operators --
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> operator+(tquat<T, P> const & q, tquat<T, P> const & p)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> operator+(tquat<T, Q> const& q, tquat<T, Q> const& p)
{
- return tquat<T, P>(q) += p;
+ return tquat<T, Q>(q) += p;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> operator*(tquat<T, P> const & q, tquat<T, P> const & p)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> operator-(tquat<T, Q> const& q, tquat<T, Q> const& p)
{
- return tquat<T, P>(q) *= p;
+ return tquat<T, Q>(q) -= p;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec3<T, P> operator*(tquat<T, P> const & q, tvec3<T, P> const & v)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> operator*(tquat<T, Q> const& q, tquat<T, Q> const& p)
{
- tvec3<T, P> const QuatVector(q.x, q.y, q.z);
- tvec3<T, P> const uv(glm::cross(QuatVector, v));
- tvec3<T, P> const uuv(glm::cross(QuatVector, uv));
+ return tquat<T, Q>(q) *= p;
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<3, T, Q> operator*(tquat<T, Q> const& q, vec<3, T, Q> const& v)
+ {
+ vec<3, T, Q> const QuatVector(q.x, q.y, q.z);
+ vec<3, T, Q> const uv(glm::cross(QuatVector, v));
+ vec<3, T, Q> const uuv(glm::cross(QuatVector, uv));
return v + ((uv * q.w) + uuv) * static_cast<T>(2);
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec3<T, P> operator*(tvec3<T, P> const & v, tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<3, T, Q> operator*(vec<3, T, Q> const& v, tquat<T, Q> const& q)
{
return glm::inverse(q) * v;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec4<T, P> operator*(tquat<T, P> const& q, tvec4<T, P> const& v)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, T, Q> operator*(tquat<T, Q> const& q, vec<4, T, Q> const& v)
{
- return detail::compute_quat_mul_vec4<T, P, detail::is_aligned<P>::value>::call(q, v);
+ return detail::compute_quat_mul_vec4<T, Q, detail::is_aligned<Q>::value>::call(q, v);
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec4<T, P> operator*(tvec4<T, P> const & v, tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, T, Q> operator*(vec<4, T, Q> const& v, tquat<T, Q> const& q)
{
return glm::inverse(q) * v;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> operator*(tquat<T, P> const & q, T const & s)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> operator*(tquat<T, Q> const& q, T const& s)
{
- return tquat<T, P>(
+ return tquat<T, Q>(
q.w * s, q.x * s, q.y * s, q.z * s);
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> operator*(T const & s, tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> operator*(T const& s, tquat<T, Q> const& q)
{
return q * s;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> operator/(tquat<T, P> const & q, T const & s)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> operator/(tquat<T, Q> const& q, T const& s)
{
- return tquat<T, P>(
+ return tquat<T, Q>(
q.w / s, q.x / s, q.y / s, q.z / s);
}
// -- Boolean operators --
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER bool operator==(tquat<T, P> const & q1, tquat<T, P> const & q2)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER bool operator==(tquat<T, Q> const& q1, tquat<T, Q> const& q2)
{
- return (q1.x == q2.x) && (q1.y == q2.y) && (q1.z == q2.z) && (q1.w == q2.w);
+ return all(epsilonEqual(q1, q2, epsilon<T>()));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER bool operator!=(tquat<T, P> const & q1, tquat<T, P> const & q2)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER bool operator!=(tquat<T, Q> const& q1, tquat<T, Q> const& q2)
{
- return (q1.x != q2.x) || (q1.y != q2.y) || (q1.z != q2.z) || (q1.w != q2.w);
+ return any(epsilonNotEqual(q1, q2, epsilon<T>()));
}
// -- Operations --
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T length(tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T dot(tquat<T, Q> const& x, tquat<T, Q> const& y)
+ {
+ GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs");
+ return detail::compute_dot<tquat<T, Q>, T, detail::is_aligned<Q>::value>::call(x, y);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T length(tquat<T, Q> const& q)
{
return glm::sqrt(dot(q, q));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> normalize(tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> normalize(tquat<T, Q> const& q)
{
T len = length(q);
if(len <= T(0)) // Problem
- return tquat<T, P>(1, 0, 0, 0);
+ return tquat<T, Q>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
T oneOverLen = T(1) / len;
- return tquat<T, P>(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen);
+ return tquat<T, Q>(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen);
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> cross(tquat<T, P> const & q1, tquat<T, P> const & q2)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> cross(tquat<T, Q> const& q1, tquat<T, Q> const& q2)
{
- return tquat<T, P>(
+ return tquat<T, Q>(
q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z,
q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y,
q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z,
@@ -396,14 +421,14 @@ namespace detail
}
/*
// (x * sin(1 - a) * angle / sin(angle)) + (y * sin(a) * angle / sin(angle))
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> mix(tquat<T, P> const & x, tquat<T, P> const & y, T const & a)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> mix(tquat<T, Q> const& x, tquat<T, Q> const& y, T const& a)
{
if(a <= T(0)) return x;
if(a >= T(1)) return y;
float fCos = dot(x, y);
- tquat<T, P> y2(y); //BUG!!! tquat<T, P> y2;
+ tquat<T, Q> y2(y); //BUG!!! tquat<T, Q> y2;
if(fCos < T(0))
{
y2 = -y;
@@ -426,19 +451,19 @@ namespace detail
k1 = sin((T(0) + a) * fAngle) * fOneOverSin;
}
- return tquat<T, P>(
+ return tquat<T, Q>(
k0 * x.w + k1 * y2.w,
k0 * x.x + k1 * y2.x,
k0 * x.y + k1 * y2.y,
k0 * x.z + k1 * y2.z);
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> mix2
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> mix2
(
- tquat<T, P> const & x,
- tquat<T, P> const & y,
- T const & a
+ tquat<T, Q> const& x,
+ tquat<T, Q> const& y,
+ T const& a
)
{
bool flip = false;
@@ -466,13 +491,13 @@ namespace detail
if(flip)
alpha = -alpha;
-
+
return normalize(beta * x + alpha * y);
}
*/
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> mix(tquat<T, P> const & x, tquat<T, P> const & y, T a)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> mix(tquat<T, Q> const& x, tquat<T, Q> const& y, T a)
{
T cosTheta = dot(x, y);
@@ -480,7 +505,7 @@ namespace detail
if(cosTheta > T(1) - epsilon<T>())
{
// Linear interpolation
- return tquat<T, P>(
+ return tquat<T, Q>(
mix(x.w, y.w, a),
mix(x.x, y.x, a),
mix(x.y, y.y, a),
@@ -494,8 +519,8 @@ namespace detail
}
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> lerp(tquat<T, P> const & x, tquat<T, P> const & y, T a)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> lerp(tquat<T, Q> const& x, tquat<T, Q> const& y, T a)
{
// Lerp is only defined in [0, 1]
assert(a >= static_cast<T>(0));
@@ -504,14 +529,14 @@ namespace detail
return x * (T(1) - a) + (y * a);
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> slerp(tquat<T, P> const & x, tquat<T, P> const & y, T a)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> slerp(tquat<T, Q> const& x, tquat<T, Q> const& y, T a)
{
- tquat<T, P> z = y;
+ tquat<T, Q> z = y;
T cosTheta = dot(x, y);
- // If cosTheta < 0, the interpolation will take the long way around the sphere.
+ // If cosTheta < 0, the interpolation will take the long way around the sphere.
// To fix this, one quat must be negated.
if (cosTheta < T(0))
{
@@ -523,7 +548,7 @@ namespace detail
if(cosTheta > T(1) - epsilon<T>())
{
// Linear interpolation
- return tquat<T, P>(
+ return tquat<T, Q>(
mix(x.w, z.w, a),
mix(x.x, z.x, a),
mix(x.y, z.y, a),
@@ -537,10 +562,10 @@ namespace detail
}
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> rotate(tquat<T, P> const & q, T const & angle, tvec3<T, P> const & v)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> rotate(tquat<T, Q> const& q, T const& angle, vec<3, T, Q> const& v)
{
- tvec3<T, P> Tmp = v;
+ vec<3, T, Q> Tmp = v;
// Axis of rotation must be normalised
T len = glm::length(Tmp);
@@ -555,38 +580,45 @@ namespace detail
T const AngleRad(angle);
T const Sin = sin(AngleRad * T(0.5));
- return q * tquat<T, P>(cos(AngleRad * T(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin);
- //return gtc::quaternion::cross(q, tquat<T, P>(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin));
+ return q * tquat<T, Q>(cos(AngleRad * T(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin);
+ //return gtc::quaternion::cross(q, tquat<T, Q>(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec3<T, P> eulerAngles(tquat<T, P> const & x)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<3, T, Q> eulerAngles(tquat<T, Q> const& x)
{
- return tvec3<T, P>(pitch(x), yaw(x), roll(x));
+ return vec<3, T, Q>(pitch(x), yaw(x), roll(x));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T roll(tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T roll(tquat<T, Q> const& q)
{
- return T(atan(T(2) * (q.x * q.y + q.w * q.z), q.w * q.w + q.x * q.x - q.y * q.y - q.z * q.z));
+ return static_cast<T>(atan(static_cast<T>(2) * (q.x * q.y + q.w * q.z), q.w * q.w + q.x * q.x - q.y * q.y - q.z * q.z));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T pitch(tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T pitch(tquat<T, Q> const& q)
{
- return T(atan(T(2) * (q.y * q.z + q.w * q.x), q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z));
+ //return T(atan(T(2) * (q.y * q.z + q.w * q.x), q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z));
+ const T y = static_cast<T>(2) * (q.y * q.z + q.w * q.x);
+ const T x = q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z;
+
+ if(detail::compute_equal<T>::call(y, static_cast<T>(0)) && detail::compute_equal<T>::call(x, static_cast<T>(0))) //avoid atan2(0,0) - handle singularity - Matiis
+ return static_cast<T>(static_cast<T>(2) * atan(q.x,q.w));
+
+ return static_cast<T>(atan(y,x));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T yaw(tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T yaw(tquat<T, Q> const& q)
{
- return asin(clamp(T(-2) * (q.x * q.z - q.w * q.y), T(-1), T(1)));
+ return asin(clamp(static_cast<T>(-2) * (q.x * q.z - q.w * q.y), static_cast<T>(-1), static_cast<T>(1)));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat3x3<T, P> mat3_cast(tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<3, 3, T, Q> mat3_cast(tquat<T, Q> const& q)
{
- tmat3x3<T, P> Result(T(1));
+ mat<3, 3, T, Q> Result(T(1));
T qxx(q.x * q.x);
T qyy(q.y * q.y);
T qzz(q.z * q.z);
@@ -611,14 +643,14 @@ namespace detail
return Result;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tmat4x4<T, P> mat4_cast(tquat<T, P> const & q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, Q> mat4_cast(tquat<T, Q> const& q)
{
- return tmat4x4<T, P>(mat3_cast(q));
+ return mat<4, 4, T, Q>(mat3_cast(q));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> quat_cast(tmat3x3<T, P> const & m)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> quat_cast(mat<3, 3, T, Q> const& m)
{
T fourXSquaredMinus1 = m[0][0] - m[1][1] - m[2][2];
T fourYSquaredMinus1 = m[1][1] - m[0][0] - m[2][2];
@@ -643,70 +675,51 @@ namespace detail
biggestIndex = 3;
}
- T biggestVal = sqrt(fourBiggestSquaredMinus1 + T(1)) * T(0.5);
+ T biggestVal = sqrt(fourBiggestSquaredMinus1 + static_cast<T>(1)) * static_cast<T>(0.5);
T mult = static_cast<T>(0.25) / biggestVal;
- tquat<T, P> Result(uninitialize);
switch(biggestIndex)
{
case 0:
- Result.w = biggestVal;
- Result.x = (m[1][2] - m[2][1]) * mult;
- Result.y = (m[2][0] - m[0][2]) * mult;
- Result.z = (m[0][1] - m[1][0]) * mult;
- break;
+ return tquat<T, Q>(biggestVal, (m[1][2] - m[2][1]) * mult, (m[2][0] - m[0][2]) * mult, (m[0][1] - m[1][0]) * mult);
case 1:
- Result.w = (m[1][2] - m[2][1]) * mult;
- Result.x = biggestVal;
- Result.y = (m[0][1] + m[1][0]) * mult;
- Result.z = (m[2][0] + m[0][2]) * mult;
- break;
+ return tquat<T, Q>((m[1][2] - m[2][1]) * mult, biggestVal, (m[0][1] + m[1][0]) * mult, (m[2][0] + m[0][2]) * mult);
case 2:
- Result.w = (m[2][0] - m[0][2]) * mult;
- Result.x = (m[0][1] + m[1][0]) * mult;
- Result.y = biggestVal;
- Result.z = (m[1][2] + m[2][1]) * mult;
- break;
+ return tquat<T, Q>((m[2][0] - m[0][2]) * mult, (m[0][1] + m[1][0]) * mult, biggestVal, (m[1][2] + m[2][1]) * mult);
case 3:
- Result.w = (m[0][1] - m[1][0]) * mult;
- Result.x = (m[2][0] + m[0][2]) * mult;
- Result.y = (m[1][2] + m[2][1]) * mult;
- Result.z = biggestVal;
- break;
-
- default: // Silence a -Wswitch-default warning in GCC. Should never actually get here. Assert is just for sanity.
+ return tquat<T, Q>((m[0][1] - m[1][0]) * mult, (m[2][0] + m[0][2]) * mult, (m[1][2] + m[2][1]) * mult, biggestVal);
+ default: // Silence a -Wswitch-default warning in GCC. Should never actually get here. Assert is just for sanity.
assert(false);
- break;
+ return tquat<T, Q>(1, 0, 0, 0);
}
- return Result;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> quat_cast(tmat4x4<T, P> const & m4)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> quat_cast(mat<4, 4, T, Q> const& m4)
{
- return quat_cast(tmat3x3<T, P>(m4));
+ return quat_cast(mat<3, 3, T, Q>(m4));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER T angle(tquat<T, P> const & x)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T angle(tquat<T, Q> const& x)
{
- return acos(x.w) * T(2);
+ return acos(x.w) * static_cast<T>(2);
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec3<T, P> axis(tquat<T, P> const & x)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<3, T, Q> axis(tquat<T, Q> const& x)
{
T tmp1 = static_cast<T>(1) - x.w * x.w;
if(tmp1 <= static_cast<T>(0))
- return tvec3<T, P>(0, 0, 1);
+ return vec<3, T, Q>(0, 0, 1);
T tmp2 = static_cast<T>(1) / sqrt(tmp1);
- return tvec3<T, P>(x.x * tmp2, x.y * tmp2, x.z * tmp2);
+ return vec<3, T, Q>(x.x * tmp2, x.y * tmp2, x.z * tmp2);
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tquat<T, P> angleAxis(T const & angle, tvec3<T, P> const & v)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER tquat<T, Q> angleAxis(T const& angle, vec<3, T, Q> const& v)
{
- tquat<T, P> Result(uninitialize);
+ tquat<T, Q> Result;
T const a(angle);
T const s = glm::sin(a * static_cast<T>(0.5));
@@ -718,74 +731,74 @@ namespace detail
return Result;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec4<bool, P> lessThan(tquat<T, P> const & x, tquat<T, P> const & y)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> lessThan(tquat<T, Q> const& x, tquat<T, Q> const& y)
{
- tvec4<bool, P> Result(uninitialize);
+ vec<4, bool, Q> Result;
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] < y[i];
return Result;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec4<bool, P> lessThanEqual(tquat<T, P> const & x, tquat<T, P> const & y)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> lessThanEqual(tquat<T, Q> const& x, tquat<T, Q> const& y)
{
- tvec4<bool, P> Result(uninitialize);
+ vec<4, bool, Q> Result;
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] <= y[i];
return Result;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec4<bool, P> greaterThan(tquat<T, P> const & x, tquat<T, P> const & y)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> greaterThan(tquat<T, Q> const& x, tquat<T, Q> const& y)
{
- tvec4<bool, P> Result(uninitialize);
+ vec<4, bool, Q> Result;
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] > y[i];
return Result;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec4<bool, P> greaterThanEqual(tquat<T, P> const & x, tquat<T, P> const & y)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> greaterThanEqual(tquat<T, Q> const& x, tquat<T, Q> const& y)
{
- tvec4<bool, P> Result(uninitialize);
+ vec<4, bool, Q> Result;
for(length_t i = 0; i < x.length(); ++i)
Result[i] = x[i] >= y[i];
return Result;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec4<bool, P> equal(tquat<T, P> const & x, tquat<T, P> const & y)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> equal(tquat<T, Q> const& x, tquat<T, Q> const& y)
{
- tvec4<bool, P> Result(uninitialize);
+ vec<4, bool, Q> Result;
for(length_t i = 0; i < x.length(); ++i)
- Result[i] = x[i] == y[i];
+ Result[i] = detail::compute_equal<T>::call(x[i], y[i]);
return Result;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec4<bool, P> notEqual(tquat<T, P> const & x, tquat<T, P> const & y)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(tquat<T, Q> const& x, tquat<T, Q> const& y)
{
- tvec4<bool, P> Result(uninitialize);
+ vec<4, bool, Q> Result;
for(length_t i = 0; i < x.length(); ++i)
- Result[i] = x[i] != y[i];
+ Result[i] = !detail::compute_equal<T>::call(x[i], y[i]);
return Result;
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec4<bool, P> isnan(tquat<T, P> const& q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> isnan(tquat<T, Q> const& q)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
- return tvec4<bool, P>(isnan(q.x), isnan(q.y), isnan(q.z), isnan(q.w));
+ return vec<4, bool, Q>(isnan(q.x), isnan(q.y), isnan(q.z), isnan(q.w));
}
- template <typename T, precision P>
- GLM_FUNC_QUALIFIER tvec4<bool, P> isinf(tquat<T, P> const& q)
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<4, bool, Q> isinf(tquat<T, Q> const& q)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isinf' only accept floating-point inputs");
- return tvec4<bool, P>(isinf(q.x), isinf(q.y), isinf(q.z), isinf(q.w));
+ return vec<4, bool, Q>(isinf(q.x), isinf(q.y), isinf(q.z), isinf(q.w));
}
}//namespace glm
diff --git a/external/include/glm/gtc/quaternion_simd.inl b/external/include/glm/gtc/quaternion_simd.inl
index cca874b..06ca7b7 100644
--- a/external/include/glm/gtc/quaternion_simd.inl
+++ b/external/include/glm/gtc/quaternion_simd.inl
@@ -7,10 +7,10 @@ namespace glm{
namespace detail
{
/*
- template <precision P>
- struct compute_quat_mul<float, P, true>
+ template<qualifier Q>
+ struct compute_quat_mul<float, Q, true>
{
- static tquat<float, P> call(tquat<float, P> const& q1, tquat<float, P> const& q2)
+ static tquat<float, Q> call(tquat<float, Q> const& q1, tquat<float, Q> const& q2)
{
// SSE2 STATS: 11 shuffle, 8 mul, 8 add
// SSE4 STATS: 3 shuffle, 4 mul, 4 dpps
@@ -51,7 +51,7 @@ namespace detail
//
//return _mm_shuffle_ps(xxyy, zzww, _MM_SHUFFLE(2, 0, 2, 0));
- tquat<float, P> Result(uninitialize);
+ tquat<float, Q> Result;
_mm_store_ss(&Result.x, add4);
_mm_store_ss(&Result.y, add5);
_mm_store_ss(&Result.z, add6);
@@ -61,122 +61,122 @@ namespace detail
};
*/
- template <precision P>
- struct compute_dot<tquat, float, P, true>
+ template<qualifier Q>
+ struct compute_dot<tquat<float, Q>, float, true>
{
- static GLM_FUNC_QUALIFIER float call(tquat<float, P> const& x, tquat<float, P> const& y)
+ static GLM_FUNC_QUALIFIER float call(tquat<float, Q> const& x, tquat<float, Q> const& y)
{
return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data));
}
};
- template <precision P>
- struct compute_quat_add<float, P, true>
+ template<qualifier Q>
+ struct compute_quat_add<float, Q, true>
{
- static tquat<float, P> call(tquat<float, P> const& q, tquat<float, P> const& p)
+ static tquat<float, Q> call(tquat<float, Q> const& q, tquat<float, Q> const& p)
{
- tquat<float, P> Result(uninitialize);
+ tquat<float, Q> Result;
Result.data = _mm_add_ps(q.data, p.data);
return Result;
}
};
# if GLM_ARCH & GLM_ARCH_AVX_BIT
- template <precision P>
- struct compute_quat_add<double, P, true>
+ template<qualifier Q>
+ struct compute_quat_add<double, Q, true>
{
- static tquat<double, P> call(tquat<double, P> const & a, tquat<double, P> const & b)
+ static tquat<double, Q> call(tquat<double, Q> const& a, tquat<double, Q> const& b)
{
- tquat<double, P> Result(uninitialize);
+ tquat<double, Q> Result;
Result.data = _mm256_add_pd(a.data, b.data);
return Result;
}
};
# endif
- template <precision P>
- struct compute_quat_sub<float, P, true>
+ template<qualifier Q>
+ struct compute_quat_sub<float, Q, true>
{
- static tquat<float, P> call(tquat<float, P> const& q, tquat<float, P> const& p)
+ static tquat<float, Q> call(tquat<float, Q> const& q, tquat<float, Q> const& p)
{
- tvec4<float, P> Result(uninitialize);
+ vec<4, float, Q> Result;
Result.data = _mm_sub_ps(q.data, p.data);
return Result;
}
};
# if GLM_ARCH & GLM_ARCH_AVX_BIT
- template <precision P>
- struct compute_quat_sub<double, P, true>
+ template<qualifier Q>
+ struct compute_quat_sub<double, Q, true>
{
- static tquat<double, P> call(tquat<double, P> const & a, tquat<double, P> const & b)
+ static tquat<double, Q> call(tquat<double, Q> const& a, tquat<double, Q> const& b)
{
- tquat<double, P> Result(uninitialize);
+ tquat<double, Q> Result;
Result.data = _mm256_sub_pd(a.data, b.data);
return Result;
}
};
# endif
- template <precision P>
- struct compute_quat_mul_scalar<float, P, true>
+ template<qualifier Q>
+ struct compute_quat_mul_scalar<float, Q, true>
{
- static tquat<float, P> call(tquat<float, P> const& q, float s)
+ static tquat<float, Q> call(tquat<float, Q> const& q, float s)
{
- tvec4<float, P> Result(uninitialize);
+ vec<4, float, Q> Result;
Result.data = _mm_mul_ps(q.data, _mm_set_ps1(s));
return Result;
}
};
# if GLM_ARCH & GLM_ARCH_AVX_BIT
- template <precision P>
- struct compute_quat_mul_scalar<double, P, true>
+ template<qualifier Q>
+ struct compute_quat_mul_scalar<double, Q, true>
{
- static tquat<double, P> call(tquat<double, P> const& q, double s)
+ static tquat<double, Q> call(tquat<double, Q> const& q, double s)
{
- tquat<double, P> Result(uninitialize);
+ tquat<double, Q> Result;
Result.data = _mm256_mul_pd(q.data, _mm_set_ps1(s));
return Result;
}
};
# endif
- template <precision P>
- struct compute_quat_div_scalar<float, P, true>
+ template<qualifier Q>
+ struct compute_quat_div_scalar<float, Q, true>
{
- static tquat<float, P> call(tquat<float, P> const& q, float s)
+ static tquat<float, Q> call(tquat<float, Q> const& q, float s)
{
- tvec4<float, P> Result(uninitialize);
+ vec<4, float, Q> Result;
Result.data = _mm_div_ps(q.data, _mm_set_ps1(s));
return Result;
}
};
# if GLM_ARCH & GLM_ARCH_AVX_BIT
- template <precision P>
- struct compute_quat_div_scalar<double, P, true>
+ template<qualifier Q>
+ struct compute_quat_div_scalar<double, Q, true>
{
- static tquat<double, P> call(tquat<double, P> const& q, double s)
+ static tquat<double, Q> call(tquat<double, Q> const& q, double s)
{
- tquat<double, P> Result(uninitialize);
+ tquat<double, Q> Result;
Result.data = _mm256_div_pd(q.data, _mm_set_ps1(s));
return Result;
}
};
# endif
- template <precision P>
- struct compute_quat_mul_vec4<float, P, true>
+ template<qualifier Q>
+ struct compute_quat_mul_vec4<float, Q, true>
{
- static tvec4<float, P> call(tquat<float, P> const& q, tvec4<float, P> const& v)
+ static vec<4, float, Q> call(tquat<float, Q> const& q, vec<4, float, Q> const& v)
{
__m128 const q_wwww = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 3, 3, 3));
__m128 const q_swp0 = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 0, 2, 1));
__m128 const q_swp1 = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 1, 0, 2));
__m128 const v_swp0 = _mm_shuffle_ps(v.data, v.data, _MM_SHUFFLE(3, 0, 2, 1));
__m128 const v_swp1 = _mm_shuffle_ps(v.data, v.data, _MM_SHUFFLE(3, 1, 0, 2));
-
+
__m128 uv = _mm_sub_ps(_mm_mul_ps(q_swp0, v_swp1), _mm_mul_ps(q_swp1, v_swp0));
__m128 uv_swp0 = _mm_shuffle_ps(uv, uv, _MM_SHUFFLE(3, 0, 2, 1));
__m128 uv_swp1 = _mm_shuffle_ps(uv, uv, _MM_SHUFFLE(3, 1, 0, 2));
@@ -186,7 +186,7 @@ namespace detail
uv = _mm_mul_ps(uv, _mm_mul_ps(q_wwww, two));
uuv = _mm_mul_ps(uuv, two);
- tvec4<float, P> Result(uninitialize);
+ vec<4, float, Q> Result;
Result.data = _mm_add_ps(v.Data, _mm_add_ps(uv, uuv));
return Result;
}
diff --git a/external/include/glm/gtc/random.hpp b/external/include/glm/gtc/random.hpp
index fa3956e..9156e43 100644
--- a/external/include/glm/gtc/random.hpp
+++ b/external/include/glm/gtc/random.hpp
@@ -2,15 +2,14 @@
/// @file glm/gtc/random.hpp
///
/// @see core (dependence)
-/// @see gtc_half_float (dependence)
/// @see gtx_random (extended)
///
/// @defgroup gtc_random GLM_GTC_random
/// @ingroup gtc
///
-/// @brief Generate random number from various distribution methods.
+/// Include <glm/gtc/random.hpp> to use the features of this extension.
///
-/// <glm/gtc/random.hpp> need to be included to use these functionalities.
+/// Generate random number from various distribution methods.
#pragma once
@@ -26,72 +25,56 @@ namespace glm
{
/// @addtogroup gtc_random
/// @{
-
- /// Generate random numbers in the interval [Min, Max], according a linear distribution
- ///
- /// @param Min
- /// @param Max
+
+ /// Generate random numbers in the interval [Min, Max], according a linear distribution
+ ///
+ /// @param Min Minimum value included in the sampling
+ /// @param Max Maximum value included in the sampling
/// @tparam genType Value type. Currently supported: float or double scalars.
/// @see gtc_random
- template <typename genTYpe>
- GLM_FUNC_DECL genTYpe linearRand(
- genTYpe Min,
- genTYpe Max);
+ template<typename genType>
+ GLM_FUNC_DECL genType linearRand(genType Min, genType Max);
- /// Generate random numbers in the interval [Min, Max], according a linear distribution
- ///
- /// @param Min
- /// @param Max
+ /// Generate random numbers in the interval [Min, Max], according a linear distribution
+ ///
+ /// @param Min Minimum value included in the sampling
+ /// @param Max Maximum value included in the sampling
/// @tparam T Value type. Currently supported: float or double.
- /// @tparam vecType A vertor type: tvec1, tvec2, tvec3, tvec4 or compatible
+ ///
/// @see gtc_random
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> linearRand(
- vecType<T, P> const & Min,
- vecType<T, P> const & Max);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> linearRand(vec<L, T, Q> const& Min, vec<L, T, Q> const& Max);
- /// Generate random numbers in the interval [Min, Max], according a gaussian distribution
- ///
- /// @param Mean
- /// @param Deviation
+ /// Generate random numbers in the interval [Min, Max], according a gaussian distribution
+ ///
/// @see gtc_random
- template <typename genType>
- GLM_FUNC_DECL genType gaussRand(
- genType Mean,
- genType Deviation);
-
+ template<typename genType>
+ GLM_FUNC_DECL genType gaussRand(genType Mean, genType Deviation);
+
/// Generate a random 2D vector which coordinates are regulary distributed on a circle of a given radius
- ///
- /// @param Radius
+ ///
/// @see gtc_random
- template <typename T>
- GLM_FUNC_DECL tvec2<T, defaultp> circularRand(
- T Radius);
-
+ template<typename T>
+ GLM_FUNC_DECL vec<2, T, defaultp> circularRand(T Radius);
+
/// Generate a random 3D vector which coordinates are regulary distributed on a sphere of a given radius
- ///
- /// @param Radius
+ ///
/// @see gtc_random
- template <typename T>
- GLM_FUNC_DECL tvec3<T, defaultp> sphericalRand(
- T Radius);
-
+ template<typename T>
+ GLM_FUNC_DECL vec<3, T, defaultp> sphericalRand(T Radius);
+
/// Generate a random 2D vector which coordinates are regulary distributed within the area of a disk of a given radius
- ///
- /// @param Radius
+ ///
/// @see gtc_random
- template <typename T>
- GLM_FUNC_DECL tvec2<T, defaultp> diskRand(
- T Radius);
-
+ template<typename T>
+ GLM_FUNC_DECL vec<2, T, defaultp> diskRand(T Radius);
+
/// Generate a random 3D vector which coordinates are regulary distributed within the volume of a ball of a given radius
- ///
- /// @param Radius
+ ///
/// @see gtc_random
- template <typename T>
- GLM_FUNC_DECL tvec3<T, defaultp> ballRand(
- T Radius);
-
+ template<typename T>
+ GLM_FUNC_DECL vec<3, T, defaultp> ballRand(T Radius);
+
/// @}
}//namespace glm
diff --git a/external/include/glm/gtc/random.inl b/external/include/glm/gtc/random.inl
index ad5926e..5301c59 100644
--- a/external/include/glm/gtc/random.inl
+++ b/external/include/glm/gtc/random.inl
@@ -3,58 +3,61 @@
#include "../geometric.hpp"
#include "../exponential.hpp"
+#include "../trigonometric.hpp"
+#include "../ext/vec1.hpp"
#include <cstdlib>
#include <ctime>
#include <cassert>
+#include <cmath>
namespace glm{
namespace detail
{
- template <typename T, precision P, template <class, precision> class vecType>
+ template <length_t L, typename T, qualifier Q>
struct compute_rand
{
- GLM_FUNC_QUALIFIER static vecType<T, P> call();
+ GLM_FUNC_QUALIFIER static vec<L, T, Q> call();
};
- template <precision P>
- struct compute_rand<uint8, P, tvec1>
+ template <qualifier P>
+ struct compute_rand<1, uint8, P>
{
- GLM_FUNC_QUALIFIER static tvec1<uint8, P> call()
+ GLM_FUNC_QUALIFIER static vec<1, uint8, P> call()
{
- return tvec1<uint8, P>(
+ return vec<1, uint8, P>(
std::rand() % std::numeric_limits<uint8>::max());
}
};
- template <precision P>
- struct compute_rand<uint8, P, tvec2>
+ template <qualifier P>
+ struct compute_rand<2, uint8, P>
{
- GLM_FUNC_QUALIFIER static tvec2<uint8, P> call()
+ GLM_FUNC_QUALIFIER static vec<2, uint8, P> call()
{
- return tvec2<uint8, P>(
+ return vec<2, uint8, P>(
std::rand() % std::numeric_limits<uint8>::max(),
std::rand() % std::numeric_limits<uint8>::max());
}
};
- template <precision P>
- struct compute_rand<uint8, P, tvec3>
+ template <qualifier P>
+ struct compute_rand<3, uint8, P>
{
- GLM_FUNC_QUALIFIER static tvec3<uint8, P> call()
+ GLM_FUNC_QUALIFIER static vec<3, uint8, P> call()
{
- return tvec3<uint8, P>(
+ return vec<3, uint8, P>(
std::rand() % std::numeric_limits<uint8>::max(),
std::rand() % std::numeric_limits<uint8>::max(),
std::rand() % std::numeric_limits<uint8>::max());
}
};
- template <precision P>
- struct compute_rand<uint8, P, tvec4>
+ template <qualifier P>
+ struct compute_rand<4, uint8, P>
{
- GLM_FUNC_QUALIFIER static tvec4<uint8, P> call()
+ GLM_FUNC_QUALIFIER static vec<4, uint8, P> call()
{
- return tvec4<uint8, P>(
+ return vec<4, uint8, P>(
std::rand() % std::numeric_limits<uint8>::max(),
std::rand() % std::numeric_limits<uint8>::max(),
std::rand() % std::numeric_limits<uint8>::max(),
@@ -62,289 +65,234 @@ namespace detail
}
};
- template <precision P, template <class, precision> class vecType>
- struct compute_rand<uint16, P, vecType>
+ template <length_t L, qualifier Q>
+ struct compute_rand<L, uint16, Q>
{
- GLM_FUNC_QUALIFIER static vecType<uint16, P> call()
+ GLM_FUNC_QUALIFIER static vec<L, uint16, Q> call()
{
return
- (vecType<uint16, P>(compute_rand<uint8, P, vecType>::call()) << static_cast<uint16>(8)) |
- (vecType<uint16, P>(compute_rand<uint8, P, vecType>::call()) << static_cast<uint16>(0));
+ (vec<L, uint16, Q>(compute_rand<L, uint8, Q>::call()) << static_cast<uint16>(8)) |
+ (vec<L, uint16, Q>(compute_rand<L, uint8, Q>::call()) << static_cast<uint16>(0));
}
};
- template <precision P, template <class, precision> class vecType>
- struct compute_rand<uint32, P, vecType>
+ template <length_t L, qualifier Q>
+ struct compute_rand<L, uint32, Q>
{
- GLM_FUNC_QUALIFIER static vecType<uint32, P> call()
+ GLM_FUNC_QUALIFIER static vec<L, uint32, Q> call()
{
return
- (vecType<uint32, P>(compute_rand<uint16, P, vecType>::call()) << static_cast<uint32>(16)) |
- (vecType<uint32, P>(compute_rand<uint16, P, vecType>::call()) << static_cast<uint32>(0));
+ (vec<L, uint32, Q>(compute_rand<L, uint16, Q>::call()) << static_cast<uint32>(16)) |
+ (vec<L, uint32, Q>(compute_rand<L, uint16, Q>::call()) << static_cast<uint32>(0));
}
};
- template <precision P, template <class, precision> class vecType>
- struct compute_rand<uint64, P, vecType>
+ template <length_t L, qualifier Q>
+ struct compute_rand<L, uint64, Q>
{
- GLM_FUNC_QUALIFIER static vecType<uint64, P> call()
+ GLM_FUNC_QUALIFIER static vec<L, uint64, Q> call()
{
return
- (vecType<uint64, P>(compute_rand<uint32, P, vecType>::call()) << static_cast<uint64>(32)) |
- (vecType<uint64, P>(compute_rand<uint32, P, vecType>::call()) << static_cast<uint64>(0));
+ (vec<L, uint64, Q>(compute_rand<L, uint32, Q>::call()) << static_cast<uint64>(32)) |
+ (vec<L, uint64, Q>(compute_rand<L, uint32, Q>::call()) << static_cast<uint64>(0));
}
};
- template <typename T, precision P, template <class, precision> class vecType>
+ template <length_t L, typename T, qualifier Q>
struct compute_linearRand
{
- GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & Min, vecType<T, P> const & Max);
+ GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& Min, vec<L, T, Q> const& Max);
};
- template <precision P, template <class, precision> class vecType>
- struct compute_linearRand<int8, P, vecType>
+ template<length_t L, qualifier Q>
+ struct compute_linearRand<L, int8, Q>
{
- GLM_FUNC_QUALIFIER static vecType<int8, P> call(vecType<int8, P> const & Min, vecType<int8, P> const & Max)
+ GLM_FUNC_QUALIFIER static vec<L, int8, Q> call(vec<L, int8, Q> const& Min, vec<L, int8, Q> const& Max)
{
- return (vecType<int8, P>(compute_rand<uint8, P, vecType>::call() % vecType<uint8, P>(Max + static_cast<int8>(1) - Min))) + Min;
+ return (vec<L, int8, Q>(compute_rand<L, uint8, Q>::call() % vec<L, uint8, Q>(Max + static_cast<int8>(1) - Min))) + Min;
}
};
- template <precision P, template <class, precision> class vecType>
- struct compute_linearRand<uint8, P, vecType>
+ template<length_t L, qualifier Q>
+ struct compute_linearRand<L, uint8, Q>
{
- GLM_FUNC_QUALIFIER static vecType<uint8, P> call(vecType<uint8, P> const & Min, vecType<uint8, P> const & Max)
+ GLM_FUNC_QUALIFIER static vec<L, uint8, Q> call(vec<L, uint8, Q> const& Min, vec<L, uint8, Q> const& Max)
{
- return (compute_rand<uint8, P, vecType>::call() % (Max + static_cast<uint8>(1) - Min)) + Min;
+ return (compute_rand<L, uint8, Q>::call() % (Max + static_cast<uint8>(1) - Min)) + Min;
}
};
- template <precision P, template <class, precision> class vecType>
- struct compute_linearRand<int16, P, vecType>
+ template<length_t L, qualifier Q>
+ struct compute_linearRand<L, int16, Q>
{
- GLM_FUNC_QUALIFIER static vecType<int16, P> call(vecType<int16, P> const & Min, vecType<int16, P> const & Max)
+ GLM_FUNC_QUALIFIER static vec<L, int16, Q> call(vec<L, int16, Q> const& Min, vec<L, int16, Q> const& Max)
{
- return (vecType<int16, P>(compute_rand<uint16, P, vecType>::call() % vecType<uint16, P>(Max + static_cast<int16>(1) - Min))) + Min;
+ return (vec<L, int16, Q>(compute_rand<L, uint16, Q>::call() % vec<L, uint16, Q>(Max + static_cast<int16>(1) - Min))) + Min;
}
};
- template <precision P, template <class, precision> class vecType>
- struct compute_linearRand<uint16, P, vecType>
+ template<length_t L, qualifier Q>
+ struct compute_linearRand<L, uint16, Q>
{
- GLM_FUNC_QUALIFIER static vecType<uint16, P> call(vecType<uint16, P> const & Min, vecType<uint16, P> const & Max)
+ GLM_FUNC_QUALIFIER static vec<L, uint16, Q> call(vec<L, uint16, Q> const& Min, vec<L, uint16, Q> const& Max)
{
- return (compute_rand<uint16, P, vecType>::call() % (Max + static_cast<uint16>(1) - Min)) + Min;
+ return (compute_rand<L, uint16, Q>::call() % (Max + static_cast<uint16>(1) - Min)) + Min;
}
};
- template <precision P, template <class, precision> class vecType>
- struct compute_linearRand<int32, P, vecType>
+ template<length_t L, qualifier Q>
+ struct compute_linearRand<L, int32, Q>
{
- GLM_FUNC_QUALIFIER static vecType<int32, P> call(vecType<int32, P> const & Min, vecType<int32, P> const & Max)
+ GLM_FUNC_QUALIFIER static vec<L, int32, Q> call(vec<L, int32, Q> const& Min, vec<L, int32, Q> const& Max)
{
- return (vecType<int32, P>(compute_rand<uint32, P, vecType>::call() % vecType<uint32, P>(Max + static_cast<int32>(1) - Min))) + Min;
+ return (vec<L, int32, Q>(compute_rand<L, uint32, Q>::call() % vec<L, uint32, Q>(Max + static_cast<int32>(1) - Min))) + Min;
}
};
- template <precision P, template <class, precision> class vecType>
- struct compute_linearRand<uint32, P, vecType>
+ template<length_t L, qualifier Q>
+ struct compute_linearRand<L, uint32, Q>
{
- GLM_FUNC_QUALIFIER static vecType<uint32, P> call(vecType<uint32, P> const & Min, vecType<uint32, P> const & Max)
+ GLM_FUNC_QUALIFIER static vec<L, uint32, Q> call(vec<L, uint32, Q> const& Min, vec<L, uint32, Q> const& Max)
{
- return (compute_rand<uint32, P, vecType>::call() % (Max + static_cast<uint32>(1) - Min)) + Min;
- }
- };
-
- template <precision P, template <class, precision> class vecType>
- struct compute_linearRand<int64, P, vecType>
- {
- GLM_FUNC_QUALIFIER static vecType<int64, P> call(vecType<int64, P> const & Min, vecType<int64, P> const & Max)
- {
- return (vecType<int64, P>(compute_rand<uint64, P, vecType>::call() % vecType<uint64, P>(Max + static_cast<int64>(1) - Min))) + Min;
- }
- };
-
- template <precision P, template <class, precision> class vecType>
- struct compute_linearRand<uint64, P, vecType>
- {
- GLM_FUNC_QUALIFIER static vecType<uint64, P> call(vecType<uint64, P> const & Min, vecType<uint64, P> const & Max)
- {
- return (compute_rand<uint64, P, vecType>::call() % (Max + static_cast<uint64>(1) - Min)) + Min;
- }
- };
-
- template <template <class, precision> class vecType>
- struct compute_linearRand<float, lowp, vecType>
- {
- GLM_FUNC_QUALIFIER static vecType<float, lowp> call(vecType<float, lowp> const & Min, vecType<float, lowp> const & Max)
- {
- return vecType<float, lowp>(compute_rand<uint8, lowp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint8>::max()) * (Max - Min) + Min;
+ return (compute_rand<L, uint32, Q>::call() % (Max + static_cast<uint32>(1) - Min)) + Min;
}
};
- template <template <class, precision> class vecType>
- struct compute_linearRand<float, mediump, vecType>
+ template<length_t L, qualifier Q>
+ struct compute_linearRand<L, int64, Q>
{
- GLM_FUNC_QUALIFIER static vecType<float, mediump> call(vecType<float, mediump> const & Min, vecType<float, mediump> const & Max)
+ GLM_FUNC_QUALIFIER static vec<L, int64, Q> call(vec<L, int64, Q> const& Min, vec<L, int64, Q> const& Max)
{
- return vecType<float, mediump>(compute_rand<uint16, mediump, vecType>::call()) / static_cast<float>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min;
+ return (vec<L, int64, Q>(compute_rand<L, uint64, Q>::call() % vec<L, uint64, Q>(Max + static_cast<int64>(1) - Min))) + Min;
}
};
- template <template <class, precision> class vecType>
- struct compute_linearRand<float, highp, vecType>
+ template<length_t L, qualifier Q>
+ struct compute_linearRand<L, uint64, Q>
{
- GLM_FUNC_QUALIFIER static vecType<float, highp> call(vecType<float, highp> const & Min, vecType<float, highp> const & Max)
+ GLM_FUNC_QUALIFIER static vec<L, uint64, Q> call(vec<L, uint64, Q> const& Min, vec<L, uint64, Q> const& Max)
{
- return vecType<float, highp>(compute_rand<uint32, highp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
+ return (compute_rand<L, uint64, Q>::call() % (Max + static_cast<uint64>(1) - Min)) + Min;
}
};
- template <template <class, precision> class vecType>
- struct compute_linearRand<double, lowp, vecType>
+ template<length_t L, qualifier Q>
+ struct compute_linearRand<L, float, Q>
{
- GLM_FUNC_QUALIFIER static vecType<double, lowp> call(vecType<double, lowp> const & Min, vecType<double, lowp> const & Max)
+ GLM_FUNC_QUALIFIER static vec<L, float, Q> call(vec<L, float, Q> const& Min, vec<L, float, Q> const& Max)
{
- return vecType<double, lowp>(compute_rand<uint16, lowp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min;
+ return vec<L, float, Q>(compute_rand<L, uint32, Q>::call()) / static_cast<float>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
}
};
- template <template <class, precision> class vecType>
- struct compute_linearRand<double, mediump, vecType>
+ template<length_t L, qualifier Q>
+ struct compute_linearRand<L, double, Q>
{
- GLM_FUNC_QUALIFIER static vecType<double, mediump> call(vecType<double, mediump> const & Min, vecType<double, mediump> const & Max)
+ GLM_FUNC_QUALIFIER static vec<L, double, Q> call(vec<L, double, Q> const& Min, vec<L, double, Q> const& Max)
{
- return vecType<double, mediump>(compute_rand<uint32, mediump, vecType>::call()) / static_cast<double>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
+ return vec<L, double, Q>(compute_rand<L, uint64, Q>::call()) / static_cast<double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
}
};
- template <template <class, precision> class vecType>
- struct compute_linearRand<double, highp, vecType>
+ template<length_t L, qualifier Q>
+ struct compute_linearRand<L, long double, Q>
{
- GLM_FUNC_QUALIFIER static vecType<double, highp> call(vecType<double, highp> const & Min, vecType<double, highp> const & Max)
+ GLM_FUNC_QUALIFIER static vec<L, long double, Q> call(vec<L, long double, Q> const& Min, vec<L, long double, Q> const& Max)
{
- return vecType<double, highp>(compute_rand<uint64, highp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
- }
- };
-
- template <template <class, precision> class vecType>
- struct compute_linearRand<long double, lowp, vecType>
- {
- GLM_FUNC_QUALIFIER static vecType<long double, lowp> call(vecType<long double, lowp> const & Min, vecType<long double, lowp> const & Max)
- {
- return vecType<long double, lowp>(compute_rand<uint32, lowp, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
- }
- };
-
- template <template <class, precision> class vecType>
- struct compute_linearRand<long double, mediump, vecType>
- {
- GLM_FUNC_QUALIFIER static vecType<long double, mediump> call(vecType<long double, mediump> const & Min, vecType<long double, mediump> const & Max)
- {
- return vecType<long double, mediump>(compute_rand<uint64, mediump, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
- }
- };
-
- template <template <class, precision> class vecType>
- struct compute_linearRand<long double, highp, vecType>
- {
- GLM_FUNC_QUALIFIER static vecType<long double, highp> call(vecType<long double, highp> const & Min, vecType<long double, highp> const & Max)
- {
- return vecType<long double, highp>(compute_rand<uint64, highp, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
+ return vec<L, long double, Q>(compute_rand<L, uint64, Q>::call()) / static_cast<long double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
}
};
}//namespace detail
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType linearRand(genType Min, genType Max)
{
- return detail::compute_linearRand<genType, highp, tvec1>::call(
- tvec1<genType, highp>(Min),
- tvec1<genType, highp>(Max)).x;
+ return detail::compute_linearRand<1, genType, highp>::call(
+ vec<1, genType, highp>(Min),
+ vec<1, genType, highp>(Max)).x;
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> linearRand(vecType<T, P> const & Min, vecType<T, P> const & Max)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> linearRand(vec<L, T, Q> const& Min, vec<L, T, Q> const& Max)
{
- return detail::compute_linearRand<T, P, vecType>::call(Min, Max);
+ return detail::compute_linearRand<L, T, Q>::call(Min, Max);
}
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType gaussRand(genType Mean, genType Deviation)
{
genType w, x1, x2;
-
+
do
{
x1 = linearRand(genType(-1), genType(1));
x2 = linearRand(genType(-1), genType(1));
-
+
w = x1 * x1 + x2 * x2;
} while(w > genType(1));
-
+
return x2 * Deviation * Deviation * sqrt((genType(-2) * log(w)) / w) + Mean;
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> gaussRand(vecType<T, P> const & Mean, vecType<T, P> const & Deviation)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> gaussRand(vec<L, T, Q> const& Mean, vec<L, T, Q> const& Deviation)
{
- return detail::functor2<T, P, vecType>::call(gaussRand, Mean, Deviation);
+ return detail::functor2<L, T, Q>::call(gaussRand, Mean, Deviation);
}
- template <typename T>
- GLM_FUNC_QUALIFIER tvec2<T, defaultp> diskRand(T Radius)
- {
- tvec2<T, defaultp> Result(T(0));
+ template<typename T>
+ GLM_FUNC_QUALIFIER vec<2, T, defaultp> diskRand(T Radius)
+ {
+ vec<2, T, defaultp> Result(T(0));
T LenRadius(T(0));
-
+
do
{
Result = linearRand(
- tvec2<T, defaultp>(-Radius),
- tvec2<T, defaultp>(Radius));
+ vec<2, T, defaultp>(-Radius),
+ vec<2, T, defaultp>(Radius));
LenRadius = length(Result);
}
while(LenRadius > Radius);
-
+
return Result;
}
-
- template <typename T>
- GLM_FUNC_QUALIFIER tvec3<T, defaultp> ballRand(T Radius)
- {
- tvec3<T, defaultp> Result(T(0));
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER vec<3, T, defaultp> ballRand(T Radius)
+ {
+ vec<3, T, defaultp> Result(T(0));
T LenRadius(T(0));
-
+
do
{
Result = linearRand(
- tvec3<T, defaultp>(-Radius),
- tvec3<T, defaultp>(Radius));
+ vec<3, T, defaultp>(-Radius),
+ vec<3, T, defaultp>(Radius));
LenRadius = length(Result);
}
while(LenRadius > Radius);
-
+
return Result;
}
-
- template <typename T>
- GLM_FUNC_QUALIFIER tvec2<T, defaultp> circularRand(T Radius)
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER vec<2, T, defaultp> circularRand(T Radius)
{
- T a = linearRand(T(0), T(6.283185307179586476925286766559f));
- return tvec2<T, defaultp>(cos(a), sin(a)) * Radius;
+ T a = linearRand(T(0), static_cast<T>(6.283185307179586476925286766559));
+ return vec<2, T, defaultp>(glm::cos(a), glm::sin(a)) * Radius;
}
-
- template <typename T>
- GLM_FUNC_QUALIFIER tvec3<T, defaultp> sphericalRand(T Radius)
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER vec<3, T, defaultp> sphericalRand(T Radius)
{
- T z = linearRand(T(-1), T(1));
- T a = linearRand(T(0), T(6.283185307179586476925286766559f));
-
- T r = sqrt(T(1) - z * z);
-
- T x = r * cos(a);
- T y = r * sin(a);
-
- return tvec3<T, defaultp>(x, y, z) * Radius;
+ T theta = linearRand(T(0), T(6.283185307179586476925286766559f));
+ T phi = std::acos(linearRand(T(-1.0f), T(1.0f)));
+
+ T x = std::sin(phi) * std::cos(theta);
+ T y = std::sin(phi) * std::sin(theta);
+ T z = std::cos(phi);
+
+ return vec<3, T, defaultp>(x, y, z) * Radius;
}
}//namespace glm
diff --git a/external/include/glm/gtc/reciprocal.hpp b/external/include/glm/gtc/reciprocal.hpp
index c14a4fe..1a2e516 100644
--- a/external/include/glm/gtc/reciprocal.hpp
+++ b/external/include/glm/gtc/reciprocal.hpp
@@ -6,9 +6,9 @@
/// @defgroup gtc_reciprocal GLM_GTC_reciprocal
/// @ingroup gtc
///
-/// @brief Define secant, cosecant and cotangent functions.
+/// Include <glm/gtc/reciprocal.hpp> to use the features of this extension.
///
-/// <glm/gtc/reciprocal.hpp> need to be included to use these features.
+/// Define secant, cosecant and cotangent functions.
#pragma once
@@ -26,107 +26,107 @@ namespace glm
/// Secant function.
/// hypotenuse / adjacent or 1 / cos(x)
- ///
+ ///
/// @tparam genType Floating-point scalar or vector types.
- ///
+ ///
/// @see gtc_reciprocal
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType sec(genType angle);
/// Cosecant function.
/// hypotenuse / opposite or 1 / sin(x)
- ///
+ ///
/// @tparam genType Floating-point scalar or vector types.
- ///
+ ///
/// @see gtc_reciprocal
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType csc(genType angle);
-
+
/// Cotangent function.
/// adjacent / opposite or 1 / tan(x)
- ///
+ ///
/// @tparam genType Floating-point scalar or vector types.
- ///
+ ///
/// @see gtc_reciprocal
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType cot(genType angle);
/// Inverse secant function.
- ///
+ ///
/// @return Return an angle expressed in radians.
/// @tparam genType Floating-point scalar or vector types.
- ///
+ ///
/// @see gtc_reciprocal
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType asec(genType x);
/// Inverse cosecant function.
- ///
+ ///
/// @return Return an angle expressed in radians.
/// @tparam genType Floating-point scalar or vector types.
- ///
+ ///
/// @see gtc_reciprocal
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType acsc(genType x);
-
+
/// Inverse cotangent function.
- ///
+ ///
/// @return Return an angle expressed in radians.
/// @tparam genType Floating-point scalar or vector types.
- ///
+ ///
/// @see gtc_reciprocal
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType acot(genType x);
/// Secant hyperbolic function.
- ///
+ ///
/// @tparam genType Floating-point scalar or vector types.
- ///
+ ///
/// @see gtc_reciprocal
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType sech(genType angle);
/// Cosecant hyperbolic function.
- ///
+ ///
/// @tparam genType Floating-point scalar or vector types.
- ///
+ ///
/// @see gtc_reciprocal
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType csch(genType angle);
-
+
/// Cotangent hyperbolic function.
- ///
+ ///
/// @tparam genType Floating-point scalar or vector types.
- ///
+ ///
/// @see gtc_reciprocal
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType coth(genType angle);
/// Inverse secant hyperbolic function.
- ///
+ ///
/// @return Return an angle expressed in radians.
/// @tparam genType Floating-point scalar or vector types.
- ///
+ ///
/// @see gtc_reciprocal
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType asech(genType x);
/// Inverse cosecant hyperbolic function.
- ///
+ ///
/// @return Return an angle expressed in radians.
/// @tparam genType Floating-point scalar or vector types.
- ///
+ ///
/// @see gtc_reciprocal
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType acsch(genType x);
-
+
/// Inverse cotangent hyperbolic function.
- ///
+ ///
/// @return Return an angle expressed in radians.
/// @tparam genType Floating-point scalar or vector types.
- ///
+ ///
/// @see gtc_reciprocal
- template <typename genType>
+ template<typename genType>
GLM_FUNC_DECL genType acoth(genType x);
/// @}
diff --git a/external/include/glm/gtc/reciprocal.inl b/external/include/glm/gtc/reciprocal.inl
index c625ac9..b0a8a7d 100644
--- a/external/include/glm/gtc/reciprocal.inl
+++ b/external/include/glm/gtc/reciprocal.inl
@@ -7,84 +7,84 @@
namespace glm
{
// sec
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType sec(genType angle)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sec' only accept floating-point values");
return genType(1) / glm::cos(angle);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> sec(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> sec(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sec' only accept floating-point inputs");
- return detail::functor1<T, T, P, vecType>::call(sec, x);
+ return detail::functor1<L, T, T, Q>::call(sec, x);
}
// csc
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType csc(genType angle)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'csc' only accept floating-point values");
return genType(1) / glm::sin(angle);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> csc(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> csc(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csc' only accept floating-point inputs");
- return detail::functor1<T, T, P, vecType>::call(csc, x);
+ return detail::functor1<L, T, T, Q>::call(csc, x);
}
// cot
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType cot(genType angle)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'cot' only accept floating-point values");
-
+
genType const pi_over_2 = genType(3.1415926535897932384626433832795 / 2.0);
return glm::tan(pi_over_2 - angle);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> cot(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> cot(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cot' only accept floating-point inputs");
- return detail::functor1<T, T, P, vecType>::call(cot, x);
+ return detail::functor1<L, T, T, Q>::call(cot, x);
}
// asec
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType asec(genType x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asec' only accept floating-point values");
return acos(genType(1) / x);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> asec(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> asec(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asec' only accept floating-point inputs");
- return detail::functor1<T, T, P, vecType>::call(asec, x);
+ return detail::functor1<L, T, T, Q>::call(asec, x);
}
// acsc
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType acsc(genType x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acsc' only accept floating-point values");
return asin(genType(1) / x);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> acsc(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> acsc(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsc' only accept floating-point inputs");
- return detail::functor1<T, T, P, vecType>::call(acsc, x);
+ return detail::functor1<L, T, T, Q>::call(acsc, x);
}
// acot
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType acot(genType x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acot' only accept floating-point values");
@@ -93,100 +93,100 @@ namespace glm
return pi_over_2 - atan(x);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> acot(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> acot(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acot' only accept floating-point inputs");
- return detail::functor1<T, T, P, vecType>::call(acot, x);
+ return detail::functor1<L, T, T, Q>::call(acot, x);
}
// sech
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType sech(genType angle)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sech' only accept floating-point values");
return genType(1) / glm::cosh(angle);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> sech(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> sech(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sech' only accept floating-point inputs");
- return detail::functor1<T, T, P, vecType>::call(sech, x);
+ return detail::functor1<L, T, T, Q>::call(sech, x);
}
// csch
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType csch(genType angle)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'csch' only accept floating-point values");
return genType(1) / glm::sinh(angle);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> csch(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> csch(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csch' only accept floating-point inputs");
- return detail::functor1<T, T, P, vecType>::call(csch, x);
+ return detail::functor1<L, T, T, Q>::call(csch, x);
}
// coth
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType coth(genType angle)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'coth' only accept floating-point values");
return glm::cosh(angle) / glm::sinh(angle);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> coth(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> coth(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'coth' only accept floating-point inputs");
- return detail::functor1<T, T, P, vecType>::call(coth, x);
+ return detail::functor1<L, T, T, Q>::call(coth, x);
}
// asech
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType asech(genType x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asech' only accept floating-point values");
return acosh(genType(1) / x);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> asech(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> asech(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asech' only accept floating-point inputs");
- return detail::functor1<T, T, P, vecType>::call(asech, x);
+ return detail::functor1<L, T, T, Q>::call(asech, x);
}
// acsch
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType acsch(genType x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acsch' only accept floating-point values");
- return acsch(genType(1) / x);
+ return asinh(genType(1) / x);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> acsch(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> acsch(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsch' only accept floating-point inputs");
- return detail::functor1<T, T, P, vecType>::call(acsch, x);
+ return detail::functor1<L, T, T, Q>::call(acsch, x);
}
// acoth
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType acoth(genType x)
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acoth' only accept floating-point values");
return atanh(genType(1) / x);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> acoth(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> acoth(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acoth' only accept floating-point inputs");
- return detail::functor1<T, T, P, vecType>::call(acoth, x);
+ return detail::functor1<L, T, T, Q>::call(acoth, x);
}
}//namespace glm
diff --git a/external/include/glm/gtc/round.hpp b/external/include/glm/gtc/round.hpp
index a583592..d8d04c3 100644
--- a/external/include/glm/gtc/round.hpp
+++ b/external/include/glm/gtc/round.hpp
@@ -7,15 +7,15 @@
/// @defgroup gtc_round GLM_GTC_round
/// @ingroup gtc
///
-/// @brief rounding value to specific boundings
+/// Include <glm/gtc/round.hpp> to use the features of this extension.
///
-/// <glm/gtc/round.hpp> need to be included to use these functionalities.
+/// Rounding value to specific boundings
#pragma once
// Dependencies
#include "../detail/setup.hpp"
-#include "../detail/precision.hpp"
+#include "../detail/qualifier.hpp"
#include "../detail/_vectorize.hpp"
#include "../vector_relational.hpp"
#include "../common.hpp"
@@ -33,140 +33,168 @@ namespace glm
/// Return true if the value is a power of two number.
///
/// @see gtc_round
- template <typename genIUType>
- GLM_FUNC_DECL bool isPowerOfTwo(genIUType Value);
+ template<typename genIUType>
+ GLM_FUNC_DECL bool isPowerOfTwo(genIUType v);
/// Return true if the value is a power of two number.
///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
/// @see gtc_round
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<bool, P> isPowerOfTwo(vecType<T, P> const & value);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, bool, Q> isPowerOfTwo(vec<L, T, Q> const& v);
/// Return the power of two number which value is just higher the input value,
/// round up to a power of two.
///
/// @see gtc_round
- template <typename genIUType>
- GLM_FUNC_DECL genIUType ceilPowerOfTwo(genIUType Value);
+ template<typename genIUType>
+ GLM_FUNC_DECL genIUType ceilPowerOfTwo(genIUType v);
/// Return the power of two number which value is just higher the input value,
/// round up to a power of two.
///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
/// @see gtc_round
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> ceilPowerOfTwo(vecType<T, P> const & value);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> ceilPowerOfTwo(vec<L, T, Q> const& v);
/// Return the power of two number which value is just lower the input value,
/// round down to a power of two.
///
/// @see gtc_round
- template <typename genIUType>
- GLM_FUNC_DECL genIUType floorPowerOfTwo(genIUType Value);
+ template<typename genIUType>
+ GLM_FUNC_DECL genIUType floorPowerOfTwo(genIUType v);
/// Return the power of two number which value is just lower the input value,
/// round down to a power of two.
///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
/// @see gtc_round
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> floorPowerOfTwo(vecType<T, P> const & value);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> floorPowerOfTwo(vec<L, T, Q> const& v);
/// Return the power of two number which value is the closet to the input value.
///
/// @see gtc_round
- template <typename genIUType>
- GLM_FUNC_DECL genIUType roundPowerOfTwo(genIUType Value);
+ template<typename genIUType>
+ GLM_FUNC_DECL genIUType roundPowerOfTwo(genIUType v);
/// Return the power of two number which value is the closet to the input value.
///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
/// @see gtc_round
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> roundPowerOfTwo(vecType<T, P> const & value);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> roundPowerOfTwo(vec<L, T, Q> const& v);
/// Return true if the 'Value' is a multiple of 'Multiple'.
///
/// @see gtc_round
- template <typename genIUType>
- GLM_FUNC_DECL bool isMultiple(genIUType Value, genIUType Multiple);
+ template<typename genIUType>
+ GLM_FUNC_DECL bool isMultiple(genIUType v, genIUType Multiple);
/// Return true if the 'Value' is a multiple of 'Multiple'.
///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
/// @see gtc_round
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<bool, P> isMultiple(vecType<T, P> const & Value, T Multiple);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, bool, Q> isMultiple(vec<L, T, Q> const& v, T Multiple);
/// Return true if the 'Value' is a multiple of 'Multiple'.
///
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
/// @see gtc_round
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<bool, P> isMultiple(vecType<T, P> const & Value, vecType<T, P> const & Multiple);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, bool, Q> isMultiple(vec<L, T, Q> const& v, vec<L, T, Q> const& Multiple);
/// Higher multiple number of Source.
///
/// @tparam genType Floating-point or integer scalar or vector types.
- /// @param Source
+ ///
+ /// @param v Source value to which is applied the function
/// @param Multiple Must be a null or positive value
///
/// @see gtc_round
- template <typename genType>
- GLM_FUNC_DECL genType ceilMultiple(genType Source, genType Multiple);
+ template<typename genType>
+ GLM_FUNC_DECL genType ceilMultiple(genType v, genType Multiple);
/// Higher multiple number of Source.
///
- /// @tparam genType Floating-point or integer scalar or vector types.
- /// @param Source
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @param v Source values to which is applied the function
/// @param Multiple Must be a null or positive value
///
/// @see gtc_round
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> ceilMultiple(vecType<T, P> const & Source, vecType<T, P> const & Multiple);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> ceilMultiple(vec<L, T, Q> const& v, vec<L, T, Q> const& Multiple);
/// Lower multiple number of Source.
///
/// @tparam genType Floating-point or integer scalar or vector types.
- /// @param Source
+ ///
+ /// @param v Source value to which is applied the function
/// @param Multiple Must be a null or positive value
///
/// @see gtc_round
- template <typename genType>
- GLM_FUNC_DECL genType floorMultiple(
- genType Source,
- genType Multiple);
+ template<typename genType>
+ GLM_FUNC_DECL genType floorMultiple(genType v, genType Multiple);
/// Lower multiple number of Source.
///
- /// @tparam genType Floating-point or integer scalar or vector types.
- /// @param Source
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @param v Source values to which is applied the function
/// @param Multiple Must be a null or positive value
///
/// @see gtc_round
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> floorMultiple(
- vecType<T, P> const & Source,
- vecType<T, P> const & Multiple);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> floorMultiple(vec<L, T, Q> const& v, vec<L, T, Q> const& Multiple);
/// Lower multiple number of Source.
///
/// @tparam genType Floating-point or integer scalar or vector types.
- /// @param Source
+ ///
+ /// @param v Source value to which is applied the function
/// @param Multiple Must be a null or positive value
///
/// @see gtc_round
- template <typename genType>
- GLM_FUNC_DECL genType roundMultiple(
- genType Source,
- genType Multiple);
+ template<typename genType>
+ GLM_FUNC_DECL genType roundMultiple(genType v, genType Multiple);
/// Lower multiple number of Source.
///
- /// @tparam genType Floating-point or integer scalar or vector types.
- /// @param Source
+ /// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
+ /// @tparam T Floating-point or integer scalar types
+ /// @tparam Q Value from qualifier enum
+ ///
+ /// @param v Source values to which is applied the function
/// @param Multiple Must be a null or positive value
///
/// @see gtc_round
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_DECL vecType<T, P> roundMultiple(
- vecType<T, P> const & Source,
- vecType<T, P> const & Multiple);
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_DECL vec<L, T, Q> roundMultiple(vec<L, T, Q> const& v, vec<L, T, Q> const& Multiple);
/// @}
} //namespace glm
diff --git a/external/include/glm/gtc/round.inl b/external/include/glm/gtc/round.inl
index f583c40..d4e9392 100644
--- a/external/include/glm/gtc/round.inl
+++ b/external/include/glm/gtc/round.inl
@@ -1,78 +1,78 @@
/// @ref gtc_round
/// @file glm/gtc/round.inl
-#include "../detail/func_integer.hpp"
+#include "../integer.hpp"
namespace glm{
namespace detail
{
- template <typename T, precision P, template <typename, precision> class vecType, bool compute = false>
+ template<length_t L, typename T, qualifier Q, bool compute = false>
struct compute_ceilShift
{
- GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T)
+ GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v, T)
{
return v;
}
};
- template <typename T, precision P, template <typename, precision> class vecType>
- struct compute_ceilShift<T, P, vecType, true>
+ template<length_t L, typename T, qualifier Q>
+ struct compute_ceilShift<L, T, Q, true>
{
- GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Shift)
+ GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v, T Shift)
{
return v | (v >> Shift);
}
};
- template <typename T, precision P, template <typename, precision> class vecType, bool isSigned = true>
+ template<length_t L, typename T, qualifier Q, bool isSigned = true>
struct compute_ceilPowerOfTwo
{
- GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
+ GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
- vecType<T, P> const Sign(sign(x));
+ vec<L, T, Q> const Sign(sign(x));
- vecType<T, P> v(abs(x));
+ vec<L, T, Q> v(abs(x));
v = v - static_cast<T>(1);
v = v | (v >> static_cast<T>(1));
v = v | (v >> static_cast<T>(2));
v = v | (v >> static_cast<T>(4));
- v = compute_ceilShift<T, P, vecType, sizeof(T) >= 2>::call(v, 8);
- v = compute_ceilShift<T, P, vecType, sizeof(T) >= 4>::call(v, 16);
- v = compute_ceilShift<T, P, vecType, sizeof(T) >= 8>::call(v, 32);
+ v = compute_ceilShift<L, T, Q, sizeof(T) >= 2>::call(v, 8);
+ v = compute_ceilShift<L, T, Q, sizeof(T) >= 4>::call(v, 16);
+ v = compute_ceilShift<L, T, Q, sizeof(T) >= 8>::call(v, 32);
return (v + static_cast<T>(1)) * Sign;
}
};
- template <typename T, precision P, template <typename, precision> class vecType>
- struct compute_ceilPowerOfTwo<T, P, vecType, false>
+ template<length_t L, typename T, qualifier Q>
+ struct compute_ceilPowerOfTwo<L, T, Q, false>
{
- GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x)
+ GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& x)
{
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
- vecType<T, P> v(x);
+ vec<L, T, Q> v(x);
v = v - static_cast<T>(1);
v = v | (v >> static_cast<T>(1));
v = v | (v >> static_cast<T>(2));
v = v | (v >> static_cast<T>(4));
- v = compute_ceilShift<T, P, vecType, sizeof(T) >= 2>::call(v, 8);
- v = compute_ceilShift<T, P, vecType, sizeof(T) >= 4>::call(v, 16);
- v = compute_ceilShift<T, P, vecType, sizeof(T) >= 8>::call(v, 32);
+ v = compute_ceilShift<L, T, Q, sizeof(T) >= 2>::call(v, 8);
+ v = compute_ceilShift<L, T, Q, sizeof(T) >= 4>::call(v, 16);
+ v = compute_ceilShift<L, T, Q, sizeof(T) >= 8>::call(v, 32);
return v + static_cast<T>(1);
}
};
- template <bool is_float, bool is_signed>
+ template<bool is_float, bool is_signed>
struct compute_ceilMultiple{};
- template <>
+ template<>
struct compute_ceilMultiple<true, true>
{
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
{
if(Source > genType(0))
@@ -82,10 +82,10 @@ namespace detail
}
};
- template <>
+ template<>
struct compute_ceilMultiple<false, false>
{
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
{
genType Tmp = Source - genType(1);
@@ -93,10 +93,10 @@ namespace detail
}
};
- template <>
+ template<>
struct compute_ceilMultiple<false, true>
{
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
{
if(Source > genType(0))
@@ -109,13 +109,13 @@ namespace detail
}
};
- template <bool is_float, bool is_signed>
+ template<bool is_float, bool is_signed>
struct compute_floorMultiple{};
- template <>
+ template<>
struct compute_floorMultiple<true, true>
{
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
{
if(Source >= genType(0))
@@ -125,10 +125,10 @@ namespace detail
}
};
- template <>
+ template<>
struct compute_floorMultiple<false, false>
{
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
{
if(Source >= genType(0))
@@ -141,10 +141,10 @@ namespace detail
}
};
- template <>
+ template<>
struct compute_floorMultiple<false, true>
{
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
{
if(Source >= genType(0))
@@ -157,13 +157,13 @@ namespace detail
}
};
- template <bool is_float, bool is_signed>
+ template<bool is_float, bool is_signed>
struct compute_roundMultiple{};
- template <>
+ template<>
struct compute_roundMultiple<true, true>
{
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
{
if(Source >= genType(0))
@@ -176,10 +176,10 @@ namespace detail
}
};
- template <>
+ template<>
struct compute_roundMultiple<false, false>
{
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
{
if(Source >= genType(0))
@@ -192,10 +192,10 @@ namespace detail
}
};
- template <>
+ template<>
struct compute_roundMultiple<false, true>
{
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER static genType call(genType Source, genType Multiple)
{
if(Source >= genType(0))
@@ -212,54 +212,54 @@ namespace detail
////////////////
// isPowerOfTwo
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER bool isPowerOfTwo(genType Value)
{
genType const Result = glm::abs(Value);
return !(Result & (Result - 1));
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<bool, P> isPowerOfTwo(vecType<T, P> const & Value)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> isPowerOfTwo(vec<L, T, Q> const& Value)
{
- vecType<T, P> const Result(abs(Value));
- return equal(Result & (Result - 1), vecType<T, P>(0));
+ vec<L, T, Q> const Result(abs(Value));
+ return equal(Result & (Result - 1), vec<L, T, Q>(0));
}
//////////////////
// ceilPowerOfTwo
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType ceilPowerOfTwo(genType value)
{
- return detail::compute_ceilPowerOfTwo<genType, defaultp, tvec1, std::numeric_limits<genType>::is_signed>::call(tvec1<genType, defaultp>(value)).x;
+ return detail::compute_ceilPowerOfTwo<1, genType, defaultp, std::numeric_limits<genType>::is_signed>::call(vec<1, genType, defaultp>(value)).x;
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> ceilPowerOfTwo(vecType<T, P> const & v)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> ceilPowerOfTwo(vec<L, T, Q> const& v)
{
- return detail::compute_ceilPowerOfTwo<T, P, vecType, std::numeric_limits<T>::is_signed>::call(v);
+ return detail::compute_ceilPowerOfTwo<L, T, Q, std::numeric_limits<T>::is_signed>::call(v);
}
///////////////////
// floorPowerOfTwo
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType floorPowerOfTwo(genType value)
{
return isPowerOfTwo(value) ? value : static_cast<genType>(1) << findMSB(value);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> floorPowerOfTwo(vecType<T, P> const & v)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> floorPowerOfTwo(vec<L, T, Q> const& v)
{
- return detail::functor1<T, T, P, vecType>::call(floorPowerOfTwo, v);
+ return detail::functor1<L, T, T, Q>::call(floorPowerOfTwo, v);
}
///////////////////
// roundPowerOfTwo
- template <typename genIUType>
+ template<typename genIUType>
GLM_FUNC_QUALIFIER genIUType roundPowerOfTwo(genIUType value)
{
if(isPowerOfTwo(value))
@@ -270,75 +270,75 @@ namespace detail
return (next - value) < (value - prev) ? next : prev;
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> roundPowerOfTwo(vecType<T, P> const & v)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> roundPowerOfTwo(vec<L, T, Q> const& v)
{
- return detail::functor1<T, T, P, vecType>::call(roundPowerOfTwo, v);
+ return detail::functor1<L, T, T, Q>::call(roundPowerOfTwo, v);
}
////////////////
// isMultiple
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER bool isMultiple(genType Value, genType Multiple)
{
- return isMultiple(tvec1<genType>(Value), tvec1<genType>(Multiple)).x;
+ return isMultiple(vec<1, genType>(Value), vec<1, genType>(Multiple)).x;
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<bool, P> isMultiple(vecType<T, P> const & Value, T Multiple)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> isMultiple(vec<L, T, Q> const& Value, T Multiple)
{
- return (Value % Multiple) == vecType<T, P>(0);
+ return (Value % Multiple) == vec<L, T, Q>(0);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<bool, P> isMultiple(vecType<T, P> const & Value, vecType<T, P> const & Multiple)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, bool, Q> isMultiple(vec<L, T, Q> const& Value, vec<L, T, Q> const& Multiple)
{
- return (Value % Multiple) == vecType<T, P>(0);
+ return (Value % Multiple) == vec<L, T, Q>(0);
}
//////////////////////
// ceilMultiple
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType ceilMultiple(genType Source, genType Multiple)
{
return detail::compute_ceilMultiple<std::numeric_limits<genType>::is_iec559, std::numeric_limits<genType>::is_signed>::call(Source, Multiple);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> ceilMultiple(vecType<T, P> const & Source, vecType<T, P> const & Multiple)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> ceilMultiple(vec<L, T, Q> const& Source, vec<L, T, Q> const& Multiple)
{
- return detail::functor2<T, P, vecType>::call(ceilMultiple, Source, Multiple);
+ return detail::functor2<L, T, Q>::call(ceilMultiple, Source, Multiple);
}
//////////////////////
// floorMultiple
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType floorMultiple(genType Source, genType Multiple)
{
return detail::compute_floorMultiple<std::numeric_limits<genType>::is_iec559, std::numeric_limits<genType>::is_signed>::call(Source, Multiple);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> floorMultiple(vecType<T, P> const & Source, vecType<T, P> const & Multiple)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> floorMultiple(vec<L, T, Q> const& Source, vec<L, T, Q> const& Multiple)
{
- return detail::functor2<T, P, vecType>::call(floorMultiple, Source, Multiple);
+ return detail::functor2<L, T, Q>::call(floorMultiple, Source, Multiple);
}
//////////////////////
// roundMultiple
- template <typename genType>
+ template<typename genType>
GLM_FUNC_QUALIFIER genType roundMultiple(genType Source, genType Multiple)
{
return detail::compute_roundMultiple<std::numeric_limits<genType>::is_iec559, std::numeric_limits<genType>::is_signed>::call(Source, Multiple);
}
- template <typename T, precision P, template <typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> roundMultiple(vecType<T, P> const & Source, vecType<T, P> const & Multiple)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> roundMultiple(vec<L, T, Q> const& Source, vec<L, T, Q> const& Multiple)
{
- return detail::functor2<T, P, vecType>::call(roundMultiple, Source, Multiple);
+ return detail::functor2<L, T, Q>::call(roundMultiple, Source, Multiple);
}
}//namespace glm
diff --git a/external/include/glm/gtc/type_aligned.hpp b/external/include/glm/gtc/type_aligned.hpp
index 2e4503c..7e51ce1 100644
--- a/external/include/glm/gtc/type_aligned.hpp
+++ b/external/include/glm/gtc/type_aligned.hpp
@@ -6,8 +6,9 @@
/// @defgroup gtc_type_aligned GLM_GTC_type_aligned
/// @ingroup gtc
///
-/// @brief Aligned types.
-/// <glm/gtc/type_aligned.hpp> need to be included to use these features.
+/// Include <glm/gtc/type_aligned.hpp> to use the features of this extension.
+///
+/// Aligned types allowing SIMD optimizations of vectors and matrices types
#pragma once
@@ -25,214 +26,376 @@
namespace glm
{
- template <typename T, precision P> struct tvec1;
- template <typename T, precision P> struct tvec2;
- template <typename T, precision P> struct tvec3;
- template <typename T, precision P> struct tvec4;
/// @addtogroup gtc_type_aligned
/// @{
// -- *vec1 --
- typedef tvec1<float, aligned_highp> aligned_highp_vec1;
- typedef tvec1<float, aligned_mediump> aligned_mediump_vec1;
- typedef tvec1<float, aligned_lowp> aligned_lowp_vec1;
- typedef tvec1<double, aligned_highp> aligned_highp_dvec1;
- typedef tvec1<double, aligned_mediump> aligned_mediump_dvec1;
- typedef tvec1<double, aligned_lowp> aligned_lowp_dvec1;
- typedef tvec1<int, aligned_highp> aligned_highp_ivec1;
- typedef tvec1<int, aligned_mediump> aligned_mediump_ivec1;
- typedef tvec1<int, aligned_lowp> aligned_lowp_ivec1;
- typedef tvec1<uint, aligned_highp> aligned_highp_uvec1;
- typedef tvec1<uint, aligned_mediump> aligned_mediump_uvec1;
- typedef tvec1<uint, aligned_lowp> aligned_lowp_uvec1;
- typedef tvec1<bool, aligned_highp> aligned_highp_bvec1;
- typedef tvec1<bool, aligned_mediump> aligned_mediump_bvec1;
- typedef tvec1<bool, aligned_lowp> aligned_lowp_bvec1;
-
- typedef tvec1<float, packed_highp> packed_highp_vec1;
- typedef tvec1<float, packed_mediump> packed_mediump_vec1;
- typedef tvec1<float, packed_lowp> packed_lowp_vec1;
- typedef tvec1<double, packed_highp> packed_highp_dvec1;
- typedef tvec1<double, packed_mediump> packed_mediump_dvec1;
- typedef tvec1<double, packed_lowp> packed_lowp_dvec1;
- typedef tvec1<int, packed_highp> packed_highp_ivec1;
- typedef tvec1<int, packed_mediump> packed_mediump_ivec1;
- typedef tvec1<int, packed_lowp> packed_lowp_ivec1;
- typedef tvec1<uint, packed_highp> packed_highp_uvec1;
- typedef tvec1<uint, packed_mediump> packed_mediump_uvec1;
- typedef tvec1<uint, packed_lowp> packed_lowp_uvec1;
- typedef tvec1<bool, packed_highp> packed_highp_bvec1;
- typedef tvec1<bool, packed_mediump> packed_mediump_bvec1;
- typedef tvec1<bool, packed_lowp> packed_lowp_bvec1;
+ /// 1 component vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<1, float, aligned_highp> aligned_highp_vec1;
+
+ /// 1 component vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<1, float, aligned_mediump> aligned_mediump_vec1;
+
+ /// 1 component vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<1, float, aligned_lowp> aligned_lowp_vec1;
+
+ /// 1 component vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<1, double, aligned_highp> aligned_highp_dvec1;
+
+ /// 1 component vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<1, double, aligned_mediump> aligned_mediump_dvec1;
+
+ /// 1 component vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<1, double, aligned_lowp> aligned_lowp_dvec1;
+
+ /// 1 component vector aligned in memory of signed integer numbers.
+ typedef vec<1, int, aligned_highp> aligned_highp_ivec1;
+
+ /// 1 component vector aligned in memory of signed integer numbers.
+ typedef vec<1, int, aligned_mediump> aligned_mediump_ivec1;
+
+ /// 1 component vector aligned in memory of signed integer numbers.
+ typedef vec<1, int, aligned_lowp> aligned_lowp_ivec1;
+
+ /// 1 component vector aligned in memory of unsigned integer numbers.
+ typedef vec<1, uint, aligned_highp> aligned_highp_uvec1;
+
+ /// 1 component vector aligned in memory of unsigned integer numbers.
+ typedef vec<1, uint, aligned_mediump> aligned_mediump_uvec1;
+
+ /// 1 component vector aligned in memory of unsigned integer numbers.
+ typedef vec<1, uint, aligned_lowp> aligned_lowp_uvec1;
+
+ /// 1 component vector aligned in memory of bool values.
+ typedef vec<1, bool, aligned_highp> aligned_highp_bvec1;
+
+ /// 1 component vector aligned in memory of bool values.
+ typedef vec<1, bool, aligned_mediump> aligned_mediump_bvec1;
+
+ /// 1 component vector aligned in memory of bool values.
+ typedef vec<1, bool, aligned_lowp> aligned_lowp_bvec1;
+
+ /// 1 component vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<1, float, packed_highp> packed_highp_vec1;
+
+ /// 1 component vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<1, float, packed_mediump> packed_mediump_vec1;
+
+ /// 1 component vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<1, float, packed_lowp> packed_lowp_vec1;
+
+ /// 1 component vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<1, double, packed_highp> packed_highp_dvec1;
+
+ /// 1 component vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<1, double, packed_mediump> packed_mediump_dvec1;
+
+ /// 1 component vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<1, double, packed_lowp> packed_lowp_dvec1;
+
+ /// 1 component vector tightly packed in memory of signed integer numbers.
+ typedef vec<1, int, packed_highp> packed_highp_ivec1;
+
+ /// 1 component vector tightly packed in memory of signed integer numbers.
+ typedef vec<1, int, packed_mediump> packed_mediump_ivec1;
+
+ /// 1 component vector tightly packed in memory of signed integer numbers.
+ typedef vec<1, int, packed_lowp> packed_lowp_ivec1;
+
+ /// 1 component vector tightly packed in memory of unsigned integer numbers.
+ typedef vec<1, uint, packed_highp> packed_highp_uvec1;
+
+ /// 1 component vector tightly packed in memory of unsigned integer numbers.
+ typedef vec<1, uint, packed_mediump> packed_mediump_uvec1;
+
+ /// 1 component vector tightly packed in memory of unsigned integer numbers.
+ typedef vec<1, uint, packed_lowp> packed_lowp_uvec1;
+
+ /// 1 component vector tightly packed in memory of bool values.
+ typedef vec<1, bool, packed_highp> packed_highp_bvec1;
+
+ /// 1 component vector tightly packed in memory of bool values.
+ typedef vec<1, bool, packed_mediump> packed_mediump_bvec1;
+
+ /// 1 component vector tightly packed in memory of bool values.
+ typedef vec<1, bool, packed_lowp> packed_lowp_bvec1;
// -- *vec2 --
- /// 2 components vector of high single-precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<float, aligned_highp> aligned_highp_vec2;
+ /// 2 components vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<2, float, aligned_highp> aligned_highp_vec2;
+
+ /// 2 components vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<2, float, aligned_mediump> aligned_mediump_vec2;
+
+ /// 2 components vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<2, float, aligned_lowp> aligned_lowp_vec2;
+
+ /// 2 components vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<2, double, aligned_highp> aligned_highp_dvec2;
+
+ /// 2 components vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<2, double, aligned_mediump> aligned_mediump_dvec2;
+
+ /// 2 components vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<2, double, aligned_lowp> aligned_lowp_dvec2;
+
+ /// 2 components vector aligned in memory of signed integer numbers.
+ typedef vec<2, int, aligned_highp> aligned_highp_ivec2;
- /// 2 components vector of medium single-precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<float, aligned_mediump> aligned_mediump_vec2;
+ /// 2 components vector aligned in memory of signed integer numbers.
+ typedef vec<2, int, aligned_mediump> aligned_mediump_ivec2;
- /// 2 components vector of low single-precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<float, aligned_lowp> aligned_lowp_vec2;
+ /// 2 components vector aligned in memory of signed integer numbers.
+ typedef vec<2, int, aligned_lowp> aligned_lowp_ivec2;
- /// 2 components vector of high double-precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<double, aligned_highp> aligned_highp_dvec2;
+ /// 2 components vector aligned in memory of unsigned integer numbers.
+ typedef vec<2, uint, aligned_highp> aligned_highp_uvec2;
- /// 2 components vector of medium double-precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<double, aligned_mediump> aligned_mediump_dvec2;
+ /// 2 components vector aligned in memory of unsigned integer numbers.
+ typedef vec<2, uint, aligned_mediump> aligned_mediump_uvec2;
- /// 2 components vector of low double-precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<double, aligned_lowp> aligned_lowp_dvec2;
+ /// 2 components vector aligned in memory of unsigned integer numbers.
+ typedef vec<2, uint, aligned_lowp> aligned_lowp_uvec2;
- /// 2 components vector of high precision signed integer numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<int, aligned_highp> aligned_highp_ivec2;
+ /// 2 components vector aligned in memory of bool values.
+ typedef vec<2, bool, aligned_highp> aligned_highp_bvec2;
- /// 2 components vector of medium precision signed integer numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<int, aligned_mediump> aligned_mediump_ivec2;
+ /// 2 components vector aligned in memory of bool values.
+ typedef vec<2, bool, aligned_mediump> aligned_mediump_bvec2;
- /// 2 components vector of low precision signed integer numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<int, aligned_lowp> aligned_lowp_ivec2;
+ /// 2 components vector aligned in memory of bool values.
+ typedef vec<2, bool, aligned_lowp> aligned_lowp_bvec2;
- /// 2 components vector of high precision unsigned integer numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<uint, aligned_highp> aligned_highp_uvec2;
+ /// 2 components vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<2, float, packed_highp> packed_highp_vec2;
- /// 2 components vector of medium precision unsigned integer numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<uint, aligned_mediump> aligned_mediump_uvec2;
+ /// 2 components vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<2, float, packed_mediump> packed_mediump_vec2;
- /// 2 components vector of low precision unsigned integer numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<uint, aligned_lowp> aligned_lowp_uvec2;
+ /// 2 components vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<2, float, packed_lowp> packed_lowp_vec2;
- /// 2 components vector of high precision bool numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<bool, aligned_highp> aligned_highp_bvec2;
+ /// 2 components vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<2, double, packed_highp> packed_highp_dvec2;
- /// 2 components vector of medium precision bool numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<bool, aligned_mediump> aligned_mediump_bvec2;
+ /// 2 components vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<2, double, packed_mediump> packed_mediump_dvec2;
- /// 2 components vector of low precision bool numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec2<bool, aligned_lowp> aligned_lowp_bvec2;
+ /// 2 components vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<2, double, packed_lowp> packed_lowp_dvec2;
+
+ /// 2 components vector tightly packed in memory of signed integer numbers.
+ typedef vec<2, int, packed_highp> packed_highp_ivec2;
+
+ /// 2 components vector tightly packed in memory of signed integer numbers.
+ typedef vec<2, int, packed_mediump> packed_mediump_ivec2;
+
+ /// 2 components vector tightly packed in memory of signed integer numbers.
+ typedef vec<2, int, packed_lowp> packed_lowp_ivec2;
+
+ /// 2 components vector tightly packed in memory of unsigned integer numbers.
+ typedef vec<2, uint, packed_highp> packed_highp_uvec2;
+
+ /// 2 components vector tightly packed in memory of unsigned integer numbers.
+ typedef vec<2, uint, packed_mediump> packed_mediump_uvec2;
+
+ /// 2 components vector tightly packed in memory of unsigned integer numbers.
+ typedef vec<2, uint, packed_lowp> packed_lowp_uvec2;
+
+ /// 2 components vector tightly packed in memory of bool values.
+ typedef vec<2, bool, packed_highp> packed_highp_bvec2;
+
+ /// 2 components vector tightly packed in memory of bool values.
+ typedef vec<2, bool, packed_mediump> packed_mediump_bvec2;
+
+ /// 2 components vector tightly packed in memory of bool values.
+ typedef vec<2, bool, packed_lowp> packed_lowp_bvec2;
// -- *vec3 --
- /// 3 components vector of high single-precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec3<float, aligned_highp> aligned_highp_vec3;
+ /// 3 components vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<3, float, aligned_highp> aligned_highp_vec3;
+
+ /// 3 components vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<3, float, aligned_mediump> aligned_mediump_vec3;
+
+ /// 3 components vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<3, float, aligned_lowp> aligned_lowp_vec3;
+
+ /// 3 components vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<3, double, aligned_highp> aligned_highp_dvec3;
- /// 3 components vector of medium single-precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec3<float, aligned_mediump> aligned_mediump_vec3;
+ /// 3 components vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<3, double, aligned_mediump> aligned_mediump_dvec3;
- /// 3 components vector of low single-precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec3<float, aligned_lowp> aligned_lowp_vec3;
+ /// 3 components vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<3, double, aligned_lowp> aligned_lowp_dvec3;
- /// 3 components vector of high double-precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec3<double, aligned_highp> aligned_highp_dvec3;
+ /// 3 components vector aligned in memory of signed integer numbers.
+ typedef vec<3, int, aligned_highp> aligned_highp_ivec3;
- /// 3 components vector of medium double-precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec3<double, aligned_mediump> aligned_mediump_dvec3;
+ /// 3 components vector aligned in memory of signed integer numbers.
+ typedef vec<3, int, aligned_mediump> aligned_mediump_ivec3;
- /// 3 components vector of low double-precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec3<double, aligned_lowp> aligned_lowp_dvec3;
+ /// 3 components vector aligned in memory of signed integer numbers.
+ typedef vec<3, int, aligned_lowp> aligned_lowp_ivec3;
- /// 3 components vector of high precision signed integer numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec3<int, aligned_highp> aligned_highp_ivec3;
+ /// 3 components vector aligned in memory of unsigned integer numbers.
+ typedef vec<3, uint, aligned_highp> aligned_highp_uvec3;
- /// 3 components vector of medium precision signed integer numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec3<int, aligned_mediump> aligned_mediump_ivec3;
+ /// 3 components vector aligned in memory of unsigned integer numbers.
+ typedef vec<3, uint, aligned_mediump> aligned_mediump_uvec3;
- /// 3 components vector of low precision signed integer numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec3<int, aligned_lowp> aligned_lowp_ivec3;
+ /// 3 components vector aligned in memory of unsigned integer numbers.
+ typedef vec<3, uint, aligned_lowp> aligned_lowp_uvec3;
- /// 3 components vector of high precision unsigned integer numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec3<uint, aligned_highp> aligned_highp_uvec3;
+ /// 3 components vector aligned in memory of bool values.
+ typedef vec<3, bool, aligned_highp> aligned_highp_bvec3;
- /// 3 components vector of medium precision unsigned integer numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec3<uint, aligned_mediump> aligned_mediump_uvec3;
+ /// 3 components vector aligned in memory of bool values.
+ typedef vec<3, bool, aligned_mediump> aligned_mediump_bvec3;
- /// 3 components vector of low precision unsigned integer numbers.
- /// There is no guarantee on the actual precision.
- typedef tvec3<uint, aligned_lowp> aligned_lowp_uvec3;
+ /// 3 components vector aligned in memory of bool values.
+ typedef vec<3, bool, aligned_lowp> aligned_lowp_bvec3;
- /// 3 components vector of high precision bool numbers.
- typedef tvec3<bool, aligned_highp> aligned_highp_bvec3;
+ /// 3 components vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<3, float, packed_highp> packed_highp_vec3;
- /// 3 components vector of medium precision bool numbers.
- typedef tvec3<bool, aligned_mediump> aligned_mediump_bvec3;
+ /// 3 components vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<3, float, packed_mediump> packed_mediump_vec3;
- /// 3 components vector of low precision bool numbers.
- typedef tvec3<bool, aligned_lowp> aligned_lowp_bvec3;
+ /// 3 components vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<3, float, packed_lowp> packed_lowp_vec3;
+
+ /// 3 components vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<3, double, packed_highp> packed_highp_dvec3;
+
+ /// 3 components vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<3, double, packed_mediump> packed_mediump_dvec3;
+
+ /// 3 components vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<3, double, packed_lowp> packed_lowp_dvec3;
+
+ /// 3 components vector tightly packed in memory of signed integer numbers.
+ typedef vec<3, int, packed_highp> packed_highp_ivec3;
+
+ /// 3 components vector tightly packed in memory of signed integer numbers.
+ typedef vec<3, int, packed_mediump> packed_mediump_ivec3;
+
+ /// 3 components vector tightly packed in memory of signed integer numbers.
+ typedef vec<3, int, packed_lowp> packed_lowp_ivec3;
+
+ /// 3 components vector tightly packed in memory of unsigned integer numbers.
+ typedef vec<3, uint, packed_highp> packed_highp_uvec3;
+
+ /// 3 components vector tightly packed in memory of unsigned integer numbers.
+ typedef vec<3, uint, packed_mediump> packed_mediump_uvec3;
+
+ /// 3 components vector tightly packed in memory of unsigned integer numbers.
+ typedef vec<3, uint, packed_lowp> packed_lowp_uvec3;
+
+ /// 3 components vector tightly packed in memory of bool values.
+ typedef vec<3, bool, packed_highp> packed_highp_bvec3;
+
+ /// 3 components vector tightly packed in memory of bool values.
+ typedef vec<3, bool, packed_mediump> packed_mediump_bvec3;
+
+ /// 3 components vector tightly packed in memory of bool values.
+ typedef vec<3, bool, packed_lowp> packed_lowp_bvec3;
// -- *vec4 --
- /// 4 components vector of high single-precision floating-point numbers.
- typedef tvec4<float, aligned_highp> aligned_highp_vec4;
+ /// 4 components vector aligned in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<4, float, aligned_highp> aligned_highp_vec4;
+
+ /// 4 components vector aligned in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<4, float, aligned_mediump> aligned_mediump_vec4;
+
+ /// 4 components vector aligned in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<4, float, aligned_lowp> aligned_lowp_vec4;
+
+ /// 4 components vector aligned in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<4, double, aligned_highp> aligned_highp_dvec4;
+
+ /// 4 components vector aligned in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<4, double, aligned_mediump> aligned_mediump_dvec4;
+
+ /// 4 components vector aligned in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<4, double, aligned_lowp> aligned_lowp_dvec4;
+
+ /// 4 components vector aligned in memory of signed integer numbers.
+ typedef vec<4, int, aligned_highp> aligned_highp_ivec4;
+
+ /// 4 components vector aligned in memory of signed integer numbers.
+ typedef vec<4, int, aligned_mediump> aligned_mediump_ivec4;
+
+ /// 4 components vector aligned in memory of signed integer numbers.
+ typedef vec<4, int, aligned_lowp> aligned_lowp_ivec4;
+
+ /// 4 components vector aligned in memory of unsigned integer numbers.
+ typedef vec<4, uint, aligned_highp> aligned_highp_uvec4;
+
+ /// 4 components vector aligned in memory of unsigned integer numbers.
+ typedef vec<4, uint, aligned_mediump> aligned_mediump_uvec4;
+
+ /// 4 components vector aligned in memory of unsigned integer numbers.
+ typedef vec<4, uint, aligned_lowp> aligned_lowp_uvec4;
+
+ /// 4 components vector aligned in memory of bool values.
+ typedef vec<4, bool, aligned_highp> aligned_highp_bvec4;
- /// 4 components vector of medium single-precision floating-point numbers.
- typedef tvec4<float, aligned_mediump> aligned_mediump_vec4;
+ /// 4 components vector aligned in memory of bool values.
+ typedef vec<4, bool, aligned_mediump> aligned_mediump_bvec4;
- /// 4 components vector of low single-precision floating-point numbers.
- typedef tvec4<float, aligned_lowp> aligned_lowp_vec4;
+ /// 4 components vector aligned in memory of bool values.
+ typedef vec<4, bool, aligned_lowp> aligned_lowp_bvec4;
- /// 4 components vector of high double-precision floating-point numbers.
- typedef tvec4<double, aligned_highp> aligned_highp_dvec4;
+ /// 4 components vector tightly packed in memory of single-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<4, float, packed_highp> packed_highp_vec4;
- /// 4 components vector of medium double-precision floating-point numbers.
- typedef tvec4<double, aligned_mediump> aligned_mediump_dvec4;
+ /// 4 components vector tightly packed in memory of single-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<4, float, packed_mediump> packed_mediump_vec4;
- /// 4 components vector of low double-precision floating-point numbers.
- typedef tvec4<double, aligned_lowp> aligned_lowp_dvec4;
+ /// 4 components vector tightly packed in memory of single-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<4, float, packed_lowp> packed_lowp_vec4;
- /// 4 components vector of high precision signed integer numbers.
- typedef tvec4<int, aligned_highp> aligned_highp_ivec4;
+ /// 4 components vector tightly packed in memory of double-precision floating-point numbers using high precision arithmetic in term of ULPs.
+ typedef vec<4, double, packed_highp> packed_highp_dvec4;
- /// 4 components vector of medium precision signed integer numbers.
- typedef tvec4<int, aligned_mediump> aligned_mediump_ivec4;
+ /// 4 components vector tightly packed in memory of double-precision floating-point numbers using medium precision arithmetic in term of ULPs.
+ typedef vec<4, double, packed_mediump> packed_mediump_dvec4;
- /// 4 components vector of low precision signed integer numbers.
- typedef tvec4<int, aligned_lowp> aligned_lowp_ivec4;
+ /// 4 components vector tightly packed in memory of double-precision floating-point numbers using low precision arithmetic in term of ULPs.
+ typedef vec<4, double, packed_lowp> packed_lowp_dvec4;
- /// 4 components vector of high precision unsigned integer numbers.
- typedef tvec4<uint, aligned_highp> aligned_highp_uvec4;
+ /// 4 components vector tightly packed in memory of signed integer numbers.
+ typedef vec<4, int, packed_highp> packed_highp_ivec4;
- /// 4 components vector of medium precision unsigned integer numbers.
- typedef tvec4<uint, aligned_mediump> aligned_mediump_uvec4;
+ /// 4 components vector tightly packed in memory of signed integer numbers.
+ typedef vec<4, int, packed_mediump> packed_mediump_ivec4;
- /// 4 components vector of low precision unsigned integer numbers.
- typedef tvec4<uint, aligned_lowp> aligned_lowp_uvec4;
+ /// 4 components vector tightly packed in memory of signed integer numbers.
+ typedef vec<4, int, packed_lowp> packed_lowp_ivec4;
- /// 4 components vector of high precision bool numbers.
- typedef tvec4<bool, aligned_highp> aligned_highp_bvec4;
+ /// 4 components vector tightly packed in memory of unsigned integer numbers.
+ typedef vec<4, uint, packed_highp> packed_highp_uvec4;
- /// 4 components vector of medium precision bool numbers.
- typedef tvec4<bool, aligned_mediump> aligned_mediump_bvec4;
+ /// 4 components vector tightly packed in memory of unsigned integer numbers.
+ typedef vec<4, uint, packed_mediump> packed_mediump_uvec4;
- /// 4 components vector of low precision bool numbers.
- typedef tvec4<bool, aligned_lowp> aligned_lowp_bvec4;
+ /// 4 components vector tightly packed in memory of unsigned integer numbers.
+ typedef vec<4, uint, packed_lowp> packed_lowp_uvec4;
+
+ /// 4 components vector tightly packed in memory of bool values.
+ typedef vec<4, bool, packed_highp> packed_highp_bvec4;
+
+ /// 4 components vector tightly packed in memory of bool values.
+ typedef vec<4, bool, packed_mediump> packed_mediump_bvec4;
+
+ /// 4 components vector tightly packed in memory of bool values.
+ typedef vec<4, bool, packed_lowp> packed_lowp_bvec4;
// -- default --
@@ -241,23 +404,43 @@ namespace glm
typedef aligned_lowp_vec2 aligned_vec2;
typedef aligned_lowp_vec3 aligned_vec3;
typedef aligned_lowp_vec4 aligned_vec4;
+ typedef packed_lowp_vec1 packed_vec1;
+ typedef packed_lowp_vec2 packed_vec2;
+ typedef packed_lowp_vec3 packed_vec3;
+ typedef packed_lowp_vec4 packed_vec4;
#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
typedef aligned_mediump_vec1 aligned_vec1;
typedef aligned_mediump_vec2 aligned_vec2;
typedef aligned_mediump_vec3 aligned_vec3;
typedef aligned_mediump_vec4 aligned_vec4;
+ typedef packed_mediump_vec1 packed_vec1;
+ typedef packed_mediump_vec2 packed_vec2;
+ typedef packed_mediump_vec3 packed_vec3;
+ typedef packed_mediump_vec4 packed_vec4;
#else //defined(GLM_PRECISION_HIGHP_FLOAT)
- /// 1 component vector of floating-point numbers.
+ /// 1 component vector aligned in memory of single-precision floating-point numbers.
typedef aligned_highp_vec1 aligned_vec1;
- /// 2 components vector of floating-point numbers.
+ /// 2 components vector aligned in memory of single-precision floating-point numbers.
typedef aligned_highp_vec2 aligned_vec2;
- /// 3 components vector of floating-point numbers.
+ /// 3 components vector aligned in memory of single-precision floating-point numbers.
typedef aligned_highp_vec3 aligned_vec3;
- /// 4 components vector of floating-point numbers.
+ /// 4 components vector aligned in memory of single-precision floating-point numbers.
typedef aligned_highp_vec4 aligned_vec4;
+
+ /// 1 component vector tightly packed in memory of single-precision floating-point numbers.
+ typedef packed_highp_vec1 packed_vec1;
+
+ /// 2 components vector tightly packed in memory of single-precision floating-point numbers.
+ typedef packed_highp_vec2 packed_vec2;
+
+ /// 3 components vector tightly packed in memory of single-precision floating-point numbers.
+ typedef packed_highp_vec3 packed_vec3;
+
+ /// 4 components vector tightly packed in memory of single-precision floating-point numbers.
+ typedef packed_highp_vec4 packed_vec4;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_LOWP_DOUBLE))
@@ -265,23 +448,43 @@ namespace glm
typedef aligned_lowp_dvec2 aligned_dvec2;
typedef aligned_lowp_dvec3 aligned_dvec3;
typedef aligned_lowp_dvec4 aligned_dvec4;
+ typedef packed_lowp_dvec1 packed_dvec1;
+ typedef packed_lowp_dvec2 packed_dvec2;
+ typedef packed_lowp_dvec3 packed_dvec3;
+ typedef packed_lowp_dvec4 packed_dvec4;
#elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
typedef aligned_mediump_dvec1 aligned_dvec1;
typedef aligned_mediump_dvec2 aligned_dvec2;
typedef aligned_mediump_dvec3 aligned_dvec3;
typedef aligned_mediump_dvec4 aligned_dvec4;
+ typedef packed_mediump_dvec1 packed_dvec1;
+ typedef packed_mediump_dvec2 packed_dvec2;
+ typedef packed_mediump_dvec3 packed_dvec3;
+ typedef packed_mediump_dvec4 packed_dvec4;
#else //defined(GLM_PRECISION_HIGHP_DOUBLE)
- /// 1 component vector of double-precision floating-point numbers.
+ /// 1 component vector aligned in memory of double-precision floating-point numbers.
typedef aligned_highp_dvec1 aligned_dvec1;
- /// 2 components vector of double-precision floating-point numbers.
+ /// 2 components vector aligned in memory of double-precision floating-point numbers.
typedef aligned_highp_dvec2 aligned_dvec2;
- /// 3 components vector of double-precision floating-point numbers.
+ /// 3 components vector aligned in memory of double-precision floating-point numbers.
typedef aligned_highp_dvec3 aligned_dvec3;
- /// 4 components vector of double-precision floating-point numbers.
+ /// 4 components vector aligned in memory of double-precision floating-point numbers.
typedef aligned_highp_dvec4 aligned_dvec4;
+
+ /// 1 component vector tightly packed in memory of double-precision floating-point numbers.
+ typedef packed_highp_dvec1 packed_dvec1;
+
+ /// 2 components vector tightly packed in memory of double-precision floating-point numbers.
+ typedef packed_highp_dvec2 packed_dvec2;
+
+ /// 3 components vector tightly packed in memory of double-precision floating-point numbers.
+ typedef packed_highp_dvec3 packed_dvec3;
+
+ /// 4 components vector tightly packed in memory of double-precision floating-point numbers.
+ typedef packed_highp_dvec4 packed_dvec4;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_LOWP_INT))
@@ -295,17 +498,30 @@ namespace glm
typedef aligned_mediump_ivec3 aligned_ivec3;
typedef aligned_mediump_ivec4 aligned_ivec4;
#else //defined(GLM_PRECISION_HIGHP_INT)
- /// 1 component vector of signed integer numbers.
+ /// 1 component vector aligned in memory of signed integer numbers.
typedef aligned_highp_ivec1 aligned_ivec1;
- /// 2 components vector of signed integer numbers.
+ /// 2 components vector aligned in memory of signed integer numbers.
typedef aligned_highp_ivec2 aligned_ivec2;
- /// 3 components vector of signed integer numbers.
+ /// 3 components vector aligned in memory of signed integer numbers.
typedef aligned_highp_ivec3 aligned_ivec3;
- /// 4 components vector of signed integer numbers.
+ /// 4 components vector aligned in memory of signed integer numbers.
typedef aligned_highp_ivec4 aligned_ivec4;
+
+ /// 1 component vector tightly packed in memory of signed integer numbers.
+ typedef packed_highp_ivec1 packed_ivec1;
+
+ /// 2 components vector tightly packed in memory of signed integer numbers.
+ typedef packed_highp_ivec2 packed_ivec2;
+
+ /// 3 components vector tightly packed in memory of signed integer numbers.
+ typedef packed_highp_ivec3 packed_ivec3;
+
+ /// 4 components vector tightly packed in memory of signed integer numbers.
+ typedef packed_highp_ivec4 packed_ivec4;
+
#endif//GLM_PRECISION
// -- Unsigned integer definition --
@@ -321,17 +537,29 @@ namespace glm
typedef aligned_mediump_uvec3 aligned_uvec3;
typedef aligned_mediump_uvec4 aligned_uvec4;
#else //defined(GLM_PRECISION_HIGHP_UINT)
- /// 1 component vector of unsigned integer numbers.
+ /// 1 component vector aligned in memory of unsigned integer numbers.
typedef aligned_highp_uvec1 aligned_uvec1;
- /// 2 components vector of unsigned integer numbers.
+ /// 2 components vector aligned in memory of unsigned integer numbers.
typedef aligned_highp_uvec2 aligned_uvec2;
- /// 3 components vector of unsigned integer numbers.
+ /// 3 components vector aligned in memory of unsigned integer numbers.
typedef aligned_highp_uvec3 aligned_uvec3;
- /// 4 components vector of unsigned integer numbers.
+ /// 4 components vector aligned in memory of unsigned integer numbers.
typedef aligned_highp_uvec4 aligned_uvec4;
+
+ /// 1 component vector tightly packed in memory of unsigned integer numbers.
+ typedef packed_highp_uvec1 packed_uvec1;
+
+ /// 2 components vector tightly packed in memory of unsigned integer numbers.
+ typedef packed_highp_uvec2 packed_uvec2;
+
+ /// 3 components vector tightly packed in memory of unsigned integer numbers.
+ typedef packed_highp_uvec3 packed_uvec3;
+
+ /// 4 components vector tightly packed in memory of unsigned integer numbers.
+ typedef packed_highp_uvec4 packed_uvec4;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_LOWP_BOOL))
@@ -345,17 +573,29 @@ namespace glm
typedef aligned_mediump_bvec3 aligned_bvec3;
typedef aligned_mediump_bvec4 aligned_bvec4;
#else //defined(GLM_PRECISION_HIGHP_BOOL)
- /// 1 component vector of boolean.
+ /// 1 component vector aligned in memory of bool values.
typedef aligned_highp_bvec1 aligned_bvec1;
- /// 2 components vector of boolean.
+ /// 2 components vector aligned in memory of bool values.
typedef aligned_highp_bvec2 aligned_bvec2;
- /// 3 components vector of boolean.
+ /// 3 components vector aligned in memory of bool values.
typedef aligned_highp_bvec3 aligned_bvec3;
- /// 4 components vector of boolean.
+ /// 4 components vector aligned in memory of bool values.
typedef aligned_highp_bvec4 aligned_bvec4;
+
+ /// 1 components vector tightly packed in memory of bool values.
+ typedef packed_highp_bvec1 packed_bvec1;
+
+ /// 2 components vector tightly packed in memory of bool values.
+ typedef packed_highp_bvec2 packed_bvec2;
+
+ /// 3 components vector tightly packed in memory of bool values.
+ typedef packed_highp_bvec3 packed_bvec3;
+
+ /// 4 components vector tightly packed in memory of bool values.
+ typedef packed_highp_bvec4 packed_bvec4;
#endif//GLM_PRECISION
/// @}
diff --git a/external/include/glm/gtc/type_precision.hpp b/external/include/glm/gtc/type_precision.hpp
index a2dbb66..a4524fe 100644
--- a/external/include/glm/gtc/type_precision.hpp
+++ b/external/include/glm/gtc/type_precision.hpp
@@ -2,18 +2,17 @@
/// @file glm/gtc/type_precision.hpp
///
/// @see core (dependence)
-/// @see gtc_half_float (dependence)
/// @see gtc_quaternion (dependence)
///
/// @defgroup gtc_type_precision GLM_GTC_type_precision
/// @ingroup gtc
///
-/// @brief Defines specific C++-based precision types.
-///
-/// @ref core_precision defines types based on GLSL's precision qualifiers. This
-/// extension defines types based on explicitly-sized C++ data types.
+/// Include <glm/gtc/type_precision.hpp> to use the features of this extension.
+///
+/// Defines specific C++-based qualifier types.
///
-/// <glm/gtc/type_precision.hpp> need to be included to use these functionalities.
+/// @ref core_precision defines types based on GLSL's qualifier qualifiers. This
+/// extension defines types based on explicitly-sized C++ data types.
#pragma once
@@ -40,128 +39,128 @@
namespace glm
{
///////////////////////////
- // Signed int vector types
+ // Signed int vector types
/// @addtogroup gtc_type_precision
/// @{
- /// Low precision 8 bit signed integer type.
+ /// Low qualifier 8 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int8 lowp_int8;
-
- /// Low precision 16 bit signed integer type.
+
+ /// Low qualifier 16 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int16 lowp_int16;
- /// Low precision 32 bit signed integer type.
+ /// Low qualifier 32 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int32 lowp_int32;
- /// Low precision 64 bit signed integer type.
+ /// Low qualifier 64 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int64 lowp_int64;
- /// Low precision 8 bit signed integer type.
+ /// Low qualifier 8 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int8 lowp_int8_t;
-
- /// Low precision 16 bit signed integer type.
+
+ /// Low qualifier 16 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int16 lowp_int16_t;
- /// Low precision 32 bit signed integer type.
+ /// Low qualifier 32 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int32 lowp_int32_t;
- /// Low precision 64 bit signed integer type.
+ /// Low qualifier 64 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int64 lowp_int64_t;
- /// Low precision 8 bit signed integer type.
+ /// Low qualifier 8 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int8 lowp_i8;
-
- /// Low precision 16 bit signed integer type.
+
+ /// Low qualifier 16 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int16 lowp_i16;
- /// Low precision 32 bit signed integer type.
+ /// Low qualifier 32 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int32 lowp_i32;
- /// Low precision 64 bit signed integer type.
+ /// Low qualifier 64 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int64 lowp_i64;
- /// Medium precision 8 bit signed integer type.
+ /// Medium qualifier 8 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int8 mediump_int8;
-
- /// Medium precision 16 bit signed integer type.
+
+ /// Medium qualifier 16 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int16 mediump_int16;
- /// Medium precision 32 bit signed integer type.
+ /// Medium qualifier 32 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int32 mediump_int32;
- /// Medium precision 64 bit signed integer type.
+ /// Medium qualifier 64 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int64 mediump_int64;
- /// Medium precision 8 bit signed integer type.
+ /// Medium qualifier 8 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int8 mediump_int8_t;
-
- /// Medium precision 16 bit signed integer type.
+
+ /// Medium qualifier 16 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int16 mediump_int16_t;
- /// Medium precision 32 bit signed integer type.
+ /// Medium qualifier 32 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int32 mediump_int32_t;
- /// Medium precision 64 bit signed integer type.
+ /// Medium qualifier 64 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int64 mediump_int64_t;
- /// Medium precision 8 bit signed integer type.
+ /// Medium qualifier 8 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int8 mediump_i8;
-
- /// Medium precision 16 bit signed integer type.
+
+ /// Medium qualifier 16 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int16 mediump_i16;
- /// Medium precision 32 bit signed integer type.
+ /// Medium qualifier 32 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int32 mediump_i32;
- /// Medium precision 64 bit signed integer type.
+ /// Medium qualifier 64 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int64 mediump_i64;
- /// High precision 8 bit signed integer type.
+ /// High qualifier 8 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int8 highp_int8;
-
- /// High precision 16 bit signed integer type.
+
+ /// High qualifier 16 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int16 highp_int16;
- /// High precision 32 bit signed integer type.
+ /// High qualifier 32 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int32 highp_int32;
- /// High precision 64 bit signed integer type.
+ /// High qualifier 64 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int64 highp_int64;
- /// High precision 8 bit signed integer type.
+ /// High qualifier 8 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int8 highp_int8_t;
-
- /// High precision 16 bit signed integer type.
+
+ /// High qualifier 16 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int16 highp_int16_t;
@@ -169,31 +168,31 @@ namespace glm
/// @see gtc_type_precision
typedef detail::int32 highp_int32_t;
- /// High precision 64 bit signed integer type.
+ /// High qualifier 64 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int64 highp_int64_t;
- /// High precision 8 bit signed integer type.
+ /// High qualifier 8 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int8 highp_i8;
-
- /// High precision 16 bit signed integer type.
+
+ /// High qualifier 16 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int16 highp_i16;
- /// High precision 32 bit signed integer type.
+ /// High qualifier 32 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int32 highp_i32;
- /// High precision 64 bit signed integer type.
+ /// High qualifier 64 bit signed integer type.
/// @see gtc_type_precision
typedef detail::int64 highp_i64;
-
+
/// 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;
@@ -215,7 +214,7 @@ namespace glm
/// 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;
@@ -232,7 +231,7 @@ namespace glm
/// 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;
@@ -248,232 +247,232 @@ namespace glm
/// 8 bit signed integer scalar type.
/// @see gtc_type_precision
- typedef tvec1<i8, defaultp> i8vec1;
-
+ typedef vec<1, i8, defaultp> i8vec1;
+
/// 8 bit signed integer vector of 2 components type.
/// @see gtc_type_precision
- typedef tvec2<i8, defaultp> i8vec2;
+ typedef vec<2, i8, defaultp> i8vec2;
/// 8 bit signed integer vector of 3 components type.
/// @see gtc_type_precision
- typedef tvec3<i8, defaultp> i8vec3;
+ typedef vec<3, i8, defaultp> i8vec3;
/// 8 bit signed integer vector of 4 components type.
/// @see gtc_type_precision
- typedef tvec4<i8, defaultp> i8vec4;
+ typedef vec<4, i8, defaultp> i8vec4;
/// 16 bit signed integer scalar type.
/// @see gtc_type_precision
- typedef tvec1<i16, defaultp> i16vec1;
-
+ typedef vec<1, i16, defaultp> i16vec1;
+
/// 16 bit signed integer vector of 2 components type.
/// @see gtc_type_precision
- typedef tvec2<i16, defaultp> i16vec2;
+ typedef vec<2, i16, defaultp> i16vec2;
/// 16 bit signed integer vector of 3 components type.
/// @see gtc_type_precision
- typedef tvec3<i16, defaultp> i16vec3;
+ typedef vec<3, i16, defaultp> i16vec3;
/// 16 bit signed integer vector of 4 components type.
/// @see gtc_type_precision
- typedef tvec4<i16, defaultp> i16vec4;
+ typedef vec<4, i16, defaultp> i16vec4;
/// 32 bit signed integer scalar type.
/// @see gtc_type_precision
- typedef tvec1<i32, defaultp> i32vec1;
-
+ typedef vec<1, i32, defaultp> i32vec1;
+
/// 32 bit signed integer vector of 2 components type.
/// @see gtc_type_precision
- typedef tvec2<i32, defaultp> i32vec2;
+ typedef vec<2, i32, defaultp> i32vec2;
/// 32 bit signed integer vector of 3 components type.
/// @see gtc_type_precision
- typedef tvec3<i32, defaultp> i32vec3;
+ typedef vec<3, i32, defaultp> i32vec3;
/// 32 bit signed integer vector of 4 components type.
/// @see gtc_type_precision
- typedef tvec4<i32, defaultp> i32vec4;
+ typedef vec<4, i32, defaultp> i32vec4;
/// 64 bit signed integer scalar type.
/// @see gtc_type_precision
- typedef tvec1<i64, defaultp> i64vec1;
-
+ typedef vec<1, i64, defaultp> i64vec1;
+
/// 64 bit signed integer vector of 2 components type.
/// @see gtc_type_precision
- typedef tvec2<i64, defaultp> i64vec2;
+ typedef vec<2, i64, defaultp> i64vec2;
/// 64 bit signed integer vector of 3 components type.
/// @see gtc_type_precision
- typedef tvec3<i64, defaultp> i64vec3;
+ typedef vec<3, i64, defaultp> i64vec3;
/// 64 bit signed integer vector of 4 components type.
/// @see gtc_type_precision
- typedef tvec4<i64, defaultp> i64vec4;
+ typedef vec<4, i64, defaultp> i64vec4;
/////////////////////////////
// Unsigned int vector types
- /// Low precision 8 bit unsigned integer type.
+ /// Low qualifier 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 lowp_uint8;
-
- /// Low precision 16 bit unsigned integer type.
+
+ /// Low qualifier 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 lowp_uint16;
- /// Low precision 32 bit unsigned integer type.
+ /// Low qualifier 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 lowp_uint32;
- /// Low precision 64 bit unsigned integer type.
+ /// Low qualifier 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 lowp_uint64;
- /// Low precision 8 bit unsigned integer type.
+ /// Low qualifier 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 lowp_uint8_t;
-
- /// Low precision 16 bit unsigned integer type.
+
+ /// Low qualifier 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 lowp_uint16_t;
- /// Low precision 32 bit unsigned integer type.
+ /// Low qualifier 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 lowp_uint32_t;
- /// Low precision 64 bit unsigned integer type.
+ /// Low qualifier 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 lowp_uint64_t;
- /// Low precision 8 bit unsigned integer type.
+ /// Low qualifier 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 lowp_u8;
-
- /// Low precision 16 bit unsigned integer type.
+
+ /// Low qualifier 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 lowp_u16;
- /// Low precision 32 bit unsigned integer type.
+ /// Low qualifier 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 lowp_u32;
- /// Low precision 64 bit unsigned integer type.
+ /// Low qualifier 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 lowp_u64;
-
- /// Medium precision 8 bit unsigned integer type.
+
+ /// Medium qualifier 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 mediump_uint8;
-
- /// Medium precision 16 bit unsigned integer type.
+
+ /// Medium qualifier 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 mediump_uint16;
- /// Medium precision 32 bit unsigned integer type.
+ /// Medium qualifier 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 mediump_uint32;
- /// Medium precision 64 bit unsigned integer type.
+ /// Medium qualifier 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 mediump_uint64;
- /// Medium precision 8 bit unsigned integer type.
+ /// Medium qualifier 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 mediump_uint8_t;
-
- /// Medium precision 16 bit unsigned integer type.
+
+ /// Medium qualifier 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 mediump_uint16_t;
- /// Medium precision 32 bit unsigned integer type.
+ /// Medium qualifier 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 mediump_uint32_t;
- /// Medium precision 64 bit unsigned integer type.
+ /// Medium qualifier 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 mediump_uint64_t;
- /// Medium precision 8 bit unsigned integer type.
+ /// Medium qualifier 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 mediump_u8;
-
- /// Medium precision 16 bit unsigned integer type.
+
+ /// Medium qualifier 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 mediump_u16;
- /// Medium precision 32 bit unsigned integer type.
+ /// Medium qualifier 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 mediump_u32;
- /// Medium precision 64 bit unsigned integer type.
+ /// Medium qualifier 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 mediump_u64;
-
- /// High precision 8 bit unsigned integer type.
+
+ /// High qualifier 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 highp_uint8;
-
- /// High precision 16 bit unsigned integer type.
+
+ /// High qualifier 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 highp_uint16;
- /// High precision 32 bit unsigned integer type.
+ /// High qualifier 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 highp_uint32;
- /// High precision 64 bit unsigned integer type.
+ /// High qualifier 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 highp_uint64;
- /// High precision 8 bit unsigned integer type.
+ /// High qualifier 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 highp_uint8_t;
-
- /// High precision 16 bit unsigned integer type.
+
+ /// High qualifier 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 highp_uint16_t;
- /// High precision 32 bit unsigned integer type.
+ /// High qualifier 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 highp_uint32_t;
- /// High precision 64 bit unsigned integer type.
+ /// High qualifier 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 highp_uint64_t;
- /// High precision 8 bit unsigned integer type.
+ /// High qualifier 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 highp_u8;
-
- /// High precision 16 bit unsigned integer type.
+
+ /// High qualifier 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 highp_u16;
- /// High precision 32 bit unsigned integer type.
+ /// High qualifier 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 highp_u32;
- /// High precision 64 bit unsigned integer type.
+ /// High qualifier 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 highp_u64;
- /// Default precision 8 bit unsigned integer type.
+ /// Default qualifier 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 uint8;
-
- /// Default precision 16 bit unsigned integer type.
+
+ /// Default qualifier 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 uint16;
- /// Default precision 32 bit unsigned integer type.
+ /// Default qualifier 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 uint32;
- /// Default precision 64 bit unsigned integer type.
+ /// Default qualifier 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 uint64;
@@ -483,378 +482,385 @@ namespace glm
using std::uint32_t;
using std::uint64_t;
#else
- /// Default precision 8 bit unsigned integer type.
+ /// Default qualifier 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 uint8_t;
-
- /// Default precision 16 bit unsigned integer type.
+
+ /// Default qualifier 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 uint16_t;
- /// Default precision 32 bit unsigned integer type.
+ /// Default qualifier 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 uint32_t;
- /// Default precision 64 bit unsigned integer type.
+ /// Default qualifier 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 uint64_t;
#endif
- /// Default precision 8 bit unsigned integer type.
+ /// Default qualifier 8 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint8 u8;
-
- /// Default precision 16 bit unsigned integer type.
+
+ /// Default qualifier 16 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint16 u16;
- /// Default precision 32 bit unsigned integer type.
+ /// Default qualifier 32 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint32 u32;
- /// Default precision 64 bit unsigned integer type.
+ /// Default qualifier 64 bit unsigned integer type.
/// @see gtc_type_precision
typedef detail::uint64 u64;
- /// Default precision 8 bit unsigned integer scalar type.
+ /// Default qualifier 8 bit unsigned integer scalar type.
/// @see gtc_type_precision
- typedef tvec1<u8, defaultp> u8vec1;
-
- /// Default precision 8 bit unsigned integer vector of 2 components type.
+ typedef vec<1, u8, defaultp> u8vec1;
+
+ /// Default qualifier 8 bit unsigned integer vector of 2 components type.
/// @see gtc_type_precision
- typedef tvec2<u8, defaultp> u8vec2;
+ typedef vec<2, u8, defaultp> u8vec2;
- /// Default precision 8 bit unsigned integer vector of 3 components type.
+ /// Default qualifier 8 bit unsigned integer vector of 3 components type.
/// @see gtc_type_precision
- typedef tvec3<u8, defaultp> u8vec3;
+ typedef vec<3, u8, defaultp> u8vec3;
- /// Default precision 8 bit unsigned integer vector of 4 components type.
+ /// Default qualifier 8 bit unsigned integer vector of 4 components type.
/// @see gtc_type_precision
- typedef tvec4<u8, defaultp> u8vec4;
+ typedef vec<4, u8, defaultp> u8vec4;
- /// Default precision 16 bit unsigned integer scalar type.
+ /// Default qualifier 16 bit unsigned integer scalar type.
/// @see gtc_type_precision
- typedef tvec1<u16, defaultp> u16vec1;
-
- /// Default precision 16 bit unsigned integer vector of 2 components type.
+ typedef vec<1, u16, defaultp> u16vec1;
+
+ /// Default qualifier 16 bit unsigned integer vector of 2 components type.
/// @see gtc_type_precision
- typedef tvec2<u16, defaultp> u16vec2;
+ typedef vec<2, u16, defaultp> u16vec2;
- /// Default precision 16 bit unsigned integer vector of 3 components type.
+ /// Default qualifier 16 bit unsigned integer vector of 3 components type.
/// @see gtc_type_precision
- typedef tvec3<u16, defaultp> u16vec3;
+ typedef vec<3, u16, defaultp> u16vec3;
- /// Default precision 16 bit unsigned integer vector of 4 components type.
+ /// Default qualifier 16 bit unsigned integer vector of 4 components type.
/// @see gtc_type_precision
- typedef tvec4<u16, defaultp> u16vec4;
+ typedef vec<4, u16, defaultp> u16vec4;
- /// Default precision 32 bit unsigned integer scalar type.
+ /// Default qualifier 32 bit unsigned integer scalar type.
/// @see gtc_type_precision
- typedef tvec1<u32, defaultp> u32vec1;
-
- /// Default precision 32 bit unsigned integer vector of 2 components type.
+ typedef vec<1, u32, defaultp> u32vec1;
+
+ /// Default qualifier 32 bit unsigned integer vector of 2 components type.
/// @see gtc_type_precision
- typedef tvec2<u32, defaultp> u32vec2;
+ typedef vec<2, u32, defaultp> u32vec2;
- /// Default precision 32 bit unsigned integer vector of 3 components type.
+ /// Default qualifier 32 bit unsigned integer vector of 3 components type.
/// @see gtc_type_precision
- typedef tvec3<u32, defaultp> u32vec3;
+ typedef vec<3, u32, defaultp> u32vec3;
- /// Default precision 32 bit unsigned integer vector of 4 components type.
+ /// Default qualifier 32 bit unsigned integer vector of 4 components type.
/// @see gtc_type_precision
- typedef tvec4<u32, defaultp> u32vec4;
+ typedef vec<4, u32, defaultp> u32vec4;
- /// Default precision 64 bit unsigned integer scalar type.
+ /// Default qualifier 64 bit unsigned integer scalar type.
/// @see gtc_type_precision
- typedef tvec1<u64, defaultp> u64vec1;
-
- /// Default precision 64 bit unsigned integer vector of 2 components type.
+ typedef vec<1, u64, defaultp> u64vec1;
+
+ /// Default qualifier 64 bit unsigned integer vector of 2 components type.
/// @see gtc_type_precision
- typedef tvec2<u64, defaultp> u64vec2;
+ typedef vec<2, u64, defaultp> u64vec2;
- /// Default precision 64 bit unsigned integer vector of 3 components type.
+ /// Default qualifier 64 bit unsigned integer vector of 3 components type.
/// @see gtc_type_precision
- typedef tvec3<u64, defaultp> u64vec3;
+ typedef vec<3, u64, defaultp> u64vec3;
- /// Default precision 64 bit unsigned integer vector of 4 components type.
+ /// Default qualifier 64 bit unsigned integer vector of 4 components type.
/// @see gtc_type_precision
- typedef tvec4<u64, defaultp> u64vec4;
+ typedef vec<4, u64, defaultp> u64vec4;
//////////////////////
// Float vector types
- /// 32 bit single-precision floating-point scalar.
+ /// 32 bit single-qualifier 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;
-
-
- /// 32 bit single-precision floating-point scalar.
+ /// 32 bit single-qualifier 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;
-
-
- /// 32 bit single-precision floating-point scalar.
+ /// 32 bit single-qualifier floating-point scalar.
/// @see gtc_type_precision
typedef float32 f32;
- /// 64 bit double-precision floating-point scalar.
- /// @see gtc_type_precision
- typedef float64 f64;
+# 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;
- /// Single-precision floating-point vector of 1 component.
- /// @see gtc_type_precision
- typedef tvec1<float, defaultp> fvec1;
+ /// 64 bit double-qualifier floating-point scalar.
+ /// @see gtc_type_precision
+ typedef float64 f64;
+# endif//GLM_FORCE_SINGLE_ONLY
- /// Single-precision floating-point vector of 2 components.
+ /// Single-qualifier floating-point vector of 1 component.
/// @see gtc_type_precision
- typedef tvec2<float, defaultp> fvec2;
+ typedef vec<1, float, defaultp> fvec1;
- /// Single-precision floating-point vector of 3 components.
+ /// Single-qualifier floating-point vector of 2 components.
/// @see gtc_type_precision
- typedef tvec3<float, defaultp> fvec3;
+ typedef vec<2, float, defaultp> fvec2;
- /// Single-precision floating-point vector of 4 components.
+ /// Single-qualifier floating-point vector of 3 components.
/// @see gtc_type_precision
- typedef tvec4<float, defaultp> fvec4;
+ typedef vec<3, float, defaultp> fvec3;
-
- /// Single-precision floating-point vector of 1 component.
+ /// Single-qualifier floating-point vector of 4 components.
/// @see gtc_type_precision
- typedef tvec1<f32, defaultp> f32vec1;
+ typedef vec<4, float, defaultp> fvec4;
- /// Single-precision floating-point vector of 2 components.
- /// @see gtc_type_precision
- typedef tvec2<f32, defaultp> f32vec2;
- /// Single-precision floating-point vector of 3 components.
+ /// Single-qualifier floating-point vector of 1 component.
/// @see gtc_type_precision
- typedef tvec3<f32, defaultp> f32vec3;
+ typedef vec<1, f32, defaultp> f32vec1;
- /// Single-precision floating-point vector of 4 components.
+ /// Single-qualifier floating-point vector of 2 components.
/// @see gtc_type_precision
- typedef tvec4<f32, defaultp> f32vec4;
-
+ typedef vec<2, f32, defaultp> f32vec2;
- /// Double-precision floating-point vector of 1 component.
+ /// Single-qualifier floating-point vector of 3 components.
/// @see gtc_type_precision
- typedef tvec1<f64, defaultp> f64vec1;
+ typedef vec<3, f32, defaultp> f32vec3;
- /// Double-precision floating-point vector of 2 components.
+ /// Single-qualifier floating-point vector of 4 components.
/// @see gtc_type_precision
- typedef tvec2<f64, defaultp> f64vec2;
+ typedef vec<4, f32, defaultp> f32vec4;
- /// Double-precision floating-point vector of 3 components.
- /// @see gtc_type_precision
- typedef tvec3<f64, defaultp> f64vec3;
+# ifndef GLM_FORCE_SINGLE_ONLY
+ /// Double-qualifier floating-point vector of 1 component.
+ /// @see gtc_type_precision
+ typedef vec<1, f64, defaultp> f64vec1;
- /// Double-precision floating-point vector of 4 components.
- /// @see gtc_type_precision
- typedef tvec4<f64, defaultp> f64vec4;
+ /// Double-qualifier floating-point vector of 2 components.
+ /// @see gtc_type_precision
+ typedef vec<2, f64, defaultp> f64vec2;
+
+ /// Double-qualifier floating-point vector of 3 components.
+ /// @see gtc_type_precision
+ typedef vec<3, f64, defaultp> f64vec3;
+
+ /// Double-qualifier floating-point vector of 4 components.
+ /// @see gtc_type_precision
+ typedef vec<4, f64, defaultp> f64vec4;
+# endif//GLM_FORCE_SINGLE_ONLY
//////////////////////
- // Float matrix types
+ // Float matrix types
- /// Single-precision floating-point 1x1 matrix.
+ /// Single-qualifier floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef detail::tmat1x1<f32> fmat1;
- /// Single-precision floating-point 2x2 matrix.
+ /// Single-qualifier floating-point 2x2 matrix.
/// @see gtc_type_precision
- typedef tmat2x2<f32, defaultp> fmat2;
+ typedef mat<2, 2, f32, defaultp> fmat2;
- /// Single-precision floating-point 3x3 matrix.
+ /// Single-qualifier floating-point 3x3 matrix.
/// @see gtc_type_precision
- typedef tmat3x3<f32, defaultp> fmat3;
+ typedef mat<3, 3, f32, defaultp> fmat3;
- /// Single-precision floating-point 4x4 matrix.
+ /// Single-qualifier floating-point 4x4 matrix.
/// @see gtc_type_precision
- typedef tmat4x4<f32, defaultp> fmat4;
+ typedef mat<4, 4, f32, defaultp> fmat4;
- /// Single-precision floating-point 1x1 matrix.
+ /// Single-qualifier floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef f32 fmat1x1;
- /// Single-precision floating-point 2x2 matrix.
+ /// Single-qualifier floating-point 2x2 matrix.
/// @see gtc_type_precision
- typedef tmat2x2<f32, defaultp> fmat2x2;
+ typedef mat<2, 2, f32, defaultp> fmat2x2;
- /// Single-precision floating-point 2x3 matrix.
+ /// Single-qualifier floating-point 2x3 matrix.
/// @see gtc_type_precision
- typedef tmat2x3<f32, defaultp> fmat2x3;
+ typedef mat<2, 3, f32, defaultp> fmat2x3;
- /// Single-precision floating-point 2x4 matrix.
+ /// Single-qualifier floating-point 2x4 matrix.
/// @see gtc_type_precision
- typedef tmat2x4<f32, defaultp> fmat2x4;
+ typedef mat<2, 4, f32, defaultp> fmat2x4;
- /// Single-precision floating-point 3x2 matrix.
+ /// Single-qualifier floating-point 3x2 matrix.
/// @see gtc_type_precision
- typedef tmat3x2<f32, defaultp> fmat3x2;
+ typedef mat<3, 2, f32, defaultp> fmat3x2;
- /// Single-precision floating-point 3x3 matrix.
+ /// Single-qualifier floating-point 3x3 matrix.
/// @see gtc_type_precision
- typedef tmat3x3<f32, defaultp> fmat3x3;
+ typedef mat<3, 3, f32, defaultp> fmat3x3;
- /// Single-precision floating-point 3x4 matrix.
+ /// Single-qualifier floating-point 3x4 matrix.
/// @see gtc_type_precision
- typedef tmat3x4<f32, defaultp> fmat3x4;
+ typedef mat<3, 4, f32, defaultp> fmat3x4;
- /// Single-precision floating-point 4x2 matrix.
+ /// Single-qualifier floating-point 4x2 matrix.
/// @see gtc_type_precision
- typedef tmat4x2<f32, defaultp> fmat4x2;
+ typedef mat<4, 2, f32, defaultp> fmat4x2;
- /// Single-precision floating-point 4x3 matrix.
+ /// Single-qualifier floating-point 4x3 matrix.
/// @see gtc_type_precision
- typedef tmat4x3<f32, defaultp> fmat4x3;
+ typedef mat<4, 3, f32, defaultp> fmat4x3;
- /// Single-precision floating-point 4x4 matrix.
+ /// Single-qualifier floating-point 4x4 matrix.
/// @see gtc_type_precision
- typedef tmat4x4<f32, defaultp> fmat4x4;
+ typedef mat<4, 4, f32, defaultp> fmat4x4;
- /// Single-precision floating-point 1x1 matrix.
+ /// Single-qualifier floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef detail::tmat1x1<f32, defaultp> f32mat1;
- /// Single-precision floating-point 2x2 matrix.
+ /// Single-qualifier floating-point 2x2 matrix.
/// @see gtc_type_precision
- typedef tmat2x2<f32, defaultp> f32mat2;
+ typedef mat<2, 2, f32, defaultp> f32mat2;
- /// Single-precision floating-point 3x3 matrix.
+ /// Single-qualifier floating-point 3x3 matrix.
/// @see gtc_type_precision
- typedef tmat3x3<f32, defaultp> f32mat3;
+ typedef mat<3, 3, f32, defaultp> f32mat3;
- /// Single-precision floating-point 4x4 matrix.
+ /// Single-qualifier floating-point 4x4 matrix.
/// @see gtc_type_precision
- typedef tmat4x4<f32, defaultp> f32mat4;
+ typedef mat<4, 4, f32, defaultp> f32mat4;
- /// Single-precision floating-point 1x1 matrix.
+ /// Single-qualifier floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef f32 f32mat1x1;
- /// Single-precision floating-point 2x2 matrix.
+ /// Single-qualifier floating-point 2x2 matrix.
/// @see gtc_type_precision
- typedef tmat2x2<f32, defaultp> f32mat2x2;
+ typedef mat<2, 2, f32, defaultp> f32mat2x2;
- /// Single-precision floating-point 2x3 matrix.
+ /// Single-qualifier floating-point 2x3 matrix.
/// @see gtc_type_precision
- typedef tmat2x3<f32, defaultp> f32mat2x3;
+ typedef mat<2, 3, f32, defaultp> f32mat2x3;
- /// Single-precision floating-point 2x4 matrix.
+ /// Single-qualifier floating-point 2x4 matrix.
/// @see gtc_type_precision
- typedef tmat2x4<f32, defaultp> f32mat2x4;
+ typedef mat<2, 4, f32, defaultp> f32mat2x4;
- /// Single-precision floating-point 3x2 matrix.
+ /// Single-qualifier floating-point 3x2 matrix.
/// @see gtc_type_precision
- typedef tmat3x2<f32, defaultp> f32mat3x2;
+ typedef mat<3, 2, f32, defaultp> f32mat3x2;
- /// Single-precision floating-point 3x3 matrix.
+ /// Single-qualifier floating-point 3x3 matrix.
/// @see gtc_type_precision
- typedef tmat3x3<f32, defaultp> f32mat3x3;
+ typedef mat<3, 3, f32, defaultp> f32mat3x3;
- /// Single-precision floating-point 3x4 matrix.
+ /// Single-qualifier floating-point 3x4 matrix.
/// @see gtc_type_precision
- typedef tmat3x4<f32, defaultp> f32mat3x4;
+ typedef mat<3, 4, f32, defaultp> f32mat3x4;
- /// Single-precision floating-point 4x2 matrix.
+ /// Single-qualifier floating-point 4x2 matrix.
/// @see gtc_type_precision
- typedef tmat4x2<f32, defaultp> f32mat4x2;
+ typedef mat<4, 2, f32, defaultp> f32mat4x2;
- /// Single-precision floating-point 4x3 matrix.
+ /// Single-qualifier floating-point 4x3 matrix.
/// @see gtc_type_precision
- typedef tmat4x3<f32, defaultp> f32mat4x3;
+ typedef mat<4, 3, f32, defaultp> f32mat4x3;
- /// Single-precision floating-point 4x4 matrix.
+ /// Single-qualifier floating-point 4x4 matrix.
/// @see gtc_type_precision
- typedef tmat4x4<f32, defaultp> f32mat4x4;
+ typedef mat<4, 4, f32, defaultp> f32mat4x4;
- /// Double-precision floating-point 1x1 matrix.
+# ifndef GLM_FORCE_SINGLE_ONLY
+
+ /// Double-qualifier floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef detail::tmat1x1<f64, defaultp> f64mat1;
- /// Double-precision floating-point 2x2 matrix.
+ /// Double-qualifier floating-point 2x2 matrix.
/// @see gtc_type_precision
- typedef tmat2x2<f64, defaultp> f64mat2;
+ typedef mat<2, 2, f64, defaultp> f64mat2;
- /// Double-precision floating-point 3x3 matrix.
+ /// Double-qualifier floating-point 3x3 matrix.
/// @see gtc_type_precision
- typedef tmat3x3<f64, defaultp> f64mat3;
+ typedef mat<3, 3, f64, defaultp> f64mat3;
- /// Double-precision floating-point 4x4 matrix.
+ /// Double-qualifier floating-point 4x4 matrix.
/// @see gtc_type_precision
- typedef tmat4x4<f64, defaultp> f64mat4;
+ typedef mat<4, 4, f64, defaultp> f64mat4;
- /// Double-precision floating-point 1x1 matrix.
+ /// Double-qualifier floating-point 1x1 matrix.
/// @see gtc_type_precision
//typedef f64 f64mat1x1;
- /// Double-precision floating-point 2x2 matrix.
+ /// Double-qualifier floating-point 2x2 matrix.
/// @see gtc_type_precision
- typedef tmat2x2<f64, defaultp> f64mat2x2;
+ typedef mat<2, 2, f64, defaultp> f64mat2x2;
- /// Double-precision floating-point 2x3 matrix.
+ /// Double-qualifier floating-point 2x3 matrix.
/// @see gtc_type_precision
- typedef tmat2x3<f64, defaultp> f64mat2x3;
+ typedef mat<2, 3, f64, defaultp> f64mat2x3;
- /// Double-precision floating-point 2x4 matrix.
+ /// Double-qualifier floating-point 2x4 matrix.
/// @see gtc_type_precision
- typedef tmat2x4<f64, defaultp> f64mat2x4;
+ typedef mat<2, 4, f64, defaultp> f64mat2x4;
- /// Double-precision floating-point 3x2 matrix.
+ /// Double-qualifier floating-point 3x2 matrix.
/// @see gtc_type_precision
- typedef tmat3x2<f64, defaultp> f64mat3x2;
+ typedef mat<3, 2, f64, defaultp> f64mat3x2;
- /// Double-precision floating-point 3x3 matrix.
+ /// Double-qualifier floating-point 3x3 matrix.
/// @see gtc_type_precision
- typedef tmat3x3<f64, defaultp> f64mat3x3;
+ typedef mat<3, 3, f64, defaultp> f64mat3x3;
- /// Double-precision floating-point 3x4 matrix.
+ /// Double-qualifier floating-point 3x4 matrix.
/// @see gtc_type_precision
- typedef tmat3x4<f64, defaultp> f64mat3x4;
+ typedef mat<3, 4, f64, defaultp> f64mat3x4;
- /// Double-precision floating-point 4x2 matrix.
+ /// Double-qualifier floating-point 4x2 matrix.
/// @see gtc_type_precision
- typedef tmat4x2<f64, defaultp> f64mat4x2;
+ typedef mat<4, 2, f64, defaultp> f64mat4x2;
- /// Double-precision floating-point 4x3 matrix.
+ /// Double-qualifier floating-point 4x3 matrix.
/// @see gtc_type_precision
- typedef tmat4x3<f64, defaultp> f64mat4x3;
+ typedef mat<4, 3, f64, defaultp> f64mat4x3;
- /// Double-precision floating-point 4x4 matrix.
+ /// Double-qualifier floating-point 4x4 matrix.
/// @see gtc_type_precision
- typedef tmat4x4<f64, defaultp> f64mat4x4;
+ typedef mat<4, 4, f64, defaultp> f64mat4x4;
+# endif//GLM_FORCE_SINGLE_ONLY
//////////////////////////
// Quaternion types
- /// Single-precision floating-point quaternion.
+ /// Single-qualifier floating-point quaternion.
/// @see gtc_type_precision
typedef tquat<f32, defaultp> f32quat;
- /// Double-precision floating-point quaternion.
+# ifndef GLM_FORCE_SINGLE_ONLY
+
+ /// Double-qualifier floating-point quaternion.
/// @see gtc_type_precision
typedef tquat<f64, defaultp> f64quat;
+# endif//GLM_FORCE_SINGLE_ONLY
+
/// @}
}//namespace glm
diff --git a/external/include/glm/gtc/type_ptr.hpp b/external/include/glm/gtc/type_ptr.hpp
index 008665e..5c15cc4 100644
--- a/external/include/glm/gtc/type_ptr.hpp
+++ b/external/include/glm/gtc/type_ptr.hpp
@@ -2,19 +2,20 @@
/// @file glm/gtc/type_ptr.hpp
///
/// @see core (dependence)
-/// @see gtc_half_float (dependence)
/// @see gtc_quaternion (dependence)
///
/// @defgroup gtc_type_ptr GLM_GTC_type_ptr
/// @ingroup gtc
///
-/// @brief Handles the interaction between pointers and vector, matrix types.
+/// Include <glm/gtc/type_ptr.hpp> to use the features of this extension.
+///
+/// Handles the interaction between pointers and vector, matrix types.
///
/// This extension defines an overloaded function, glm::value_ptr, which
/// takes any of the \ref core_template "core template types". It returns
/// a pointer to the memory layout of the object. Matrix types store their values
/// in column-major order.
-///
+///
/// This is useful for uploading data to matrices or copying data to buffer objects.
///
/// Example:
@@ -29,12 +30,13 @@
/// glUniformMatrix4fv(uniformMatrixLoc, 1, GL_FALSE, glm::value_ptr(someMatrix));
/// @endcode
///
-/// <glm/gtc/type_ptr.hpp> need to be included to use these functionalities.
+/// <glm/gtc/type_ptr.hpp> need to be included to use the features of this extension.
#pragma once
// Dependency:
#include "../gtc/quaternion.hpp"
+#include "../gtc/vec1.hpp"
#include "../vec2.hpp"
#include "../vec3.hpp"
#include "../vec4.hpp"
@@ -61,82 +63,162 @@ namespace glm
/// Return the constant address to the data of the input parameter.
/// @see gtc_type_ptr
template<typename genType>
- GLM_FUNC_DECL typename genType::value_type const * value_ptr(genType const & vec);
+ GLM_FUNC_DECL typename genType::value_type const * value_ptr(genType const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<1, T, Q> make_vec1(vec<1, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<1, T, Q> make_vec1(vec<2, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<1, T, Q> make_vec1(vec<3, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<1, T, Q> make_vec1(vec<4, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<2, T, Q> make_vec2(vec<1, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<2, T, Q> make_vec2(vec<2, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<2, T, Q> make_vec2(vec<3, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<2, T, Q> make_vec2(vec<4, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> make_vec3(vec<1, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> make_vec3(vec<2, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> make_vec3(vec<3, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<3, T, Q> make_vec3(vec<4, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, T, Q> make_vec4(vec<1, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, T, Q> make_vec4(vec<2, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, T, Q> make_vec4(vec<3, T, Q> const& v);
+
+ /// Build a vector from a pointer.
+ /// @see gtc_type_ptr
+ template <typename T, qualifier Q>
+ GLM_FUNC_DECL vec<4, T, Q> make_vec4(vec<4, T, Q> const& v);
/// Build a vector from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tvec2<T, defaultp> make_vec2(T const * const ptr);
+ GLM_FUNC_DECL vec<2, T, defaultp> make_vec2(T const * const ptr);
/// Build a vector from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tvec3<T, defaultp> make_vec3(T const * const ptr);
+ GLM_FUNC_DECL vec<3, T, defaultp> make_vec3(T const * const ptr);
/// Build a vector from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tvec4<T, defaultp> make_vec4(T const * const ptr);
+ GLM_FUNC_DECL vec<4, T, defaultp> make_vec4(T const * const ptr);
/// Build a matrix from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tmat2x2<T, defaultp> make_mat2x2(T const * const ptr);
+ GLM_FUNC_DECL mat<2, 2, T, defaultp> make_mat2x2(T const * const ptr);
/// Build a matrix from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tmat2x3<T, defaultp> make_mat2x3(T const * const ptr);
+ GLM_FUNC_DECL mat<2, 3, T, defaultp> make_mat2x3(T const * const ptr);
/// Build a matrix from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tmat2x4<T, defaultp> make_mat2x4(T const * const ptr);
+ GLM_FUNC_DECL mat<2, 4, T, defaultp> make_mat2x4(T const * const ptr);
/// Build a matrix from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tmat3x2<T, defaultp> make_mat3x2(T const * const ptr);
+ GLM_FUNC_DECL mat<3, 2, T, defaultp> make_mat3x2(T const * const ptr);
/// Build a matrix from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tmat3x3<T, defaultp> make_mat3x3(T const * const ptr);
+ GLM_FUNC_DECL mat<3, 3, T, defaultp> make_mat3x3(T const * const ptr);
/// Build a matrix from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tmat3x4<T, defaultp> make_mat3x4(T const * const ptr);
+ GLM_FUNC_DECL mat<3, 4, T, defaultp> make_mat3x4(T const * const ptr);
/// Build a matrix from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tmat4x2<T, defaultp> make_mat4x2(T const * const ptr);
+ GLM_FUNC_DECL mat<4, 2, T, defaultp> make_mat4x2(T const * const ptr);
/// Build a matrix from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tmat4x3<T, defaultp> make_mat4x3(T const * const ptr);
+ GLM_FUNC_DECL mat<4, 3, T, defaultp> make_mat4x3(T const * const ptr);
/// Build a matrix from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> make_mat4x4(T const * const ptr);
-
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> make_mat4x4(T const * const ptr);
+
/// Build a matrix from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tmat2x2<T, defaultp> make_mat2(T const * const ptr);
+ GLM_FUNC_DECL mat<2, 2, T, defaultp> make_mat2(T const * const ptr);
/// Build a matrix from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tmat3x3<T, defaultp> make_mat3(T const * const ptr);
-
+ GLM_FUNC_DECL mat<3, 3, T, defaultp> make_mat3(T const * const ptr);
+
/// Build a matrix from a pointer.
/// @see gtc_type_ptr
template<typename T>
- GLM_FUNC_DECL tmat4x4<T, defaultp> make_mat4(T const * const ptr);
+ GLM_FUNC_DECL mat<4, 4, T, defaultp> make_mat4(T const * const ptr);
/// Build a quaternion from a pointer.
/// @see gtc_type_ptr
diff --git a/external/include/glm/gtc/type_ptr.inl b/external/include/glm/gtc/type_ptr.inl
index 3aa6ae6..7a9e21e 100644
--- a/external/include/glm/gtc/type_ptr.inl
+++ b/external/include/glm/gtc/type_ptr.inl
@@ -8,437 +8,374 @@ namespace glm
/// @addtogroup gtc_type_ptr
/// @{
- /// Return the constant address to the data of the vector input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T const * value_ptr
- (
- tvec2<T, P> const & vec
- )
- {
- return &(vec.x);
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const* value_ptr(vec<2, T, Q> const& v)
+ {
+ return &(v.x);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T* value_ptr(vec<2, T, Q>& v)
+ {
+ return &(v.x);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const * value_ptr(vec<3, T, Q> const& v)
+ {
+ return &(v.x);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T* value_ptr(vec<3, T, Q>& v)
+ {
+ return &(v.x);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const* value_ptr(vec<4, T, Q> const& v)
+ {
+ return &(v.x);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T* value_ptr(vec<4, T, Q>& v)
+ {
+ return &(v.x);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 2, T, Q> const& m)
+ {
+ return &(m[0].x);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 2, T, Q>& m)
+ {
+ return &(m[0].x);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 3, T, Q> const& m)
+ {
+ return &(m[0].x);
}
- //! Return the address to the data of the vector input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T * value_ptr
- (
- tvec2<T, P> & vec
- )
- {
- return &(vec.x);
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 3, T, Q>& m)
+ {
+ return &(m[0].x);
}
- /// Return the constant address to the data of the vector input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T const * value_ptr
- (
- tvec3<T, P> const & vec
- )
- {
- return &(vec.x);
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 4, T, Q> const& m)
+ {
+ return &(m[0].x);
}
- //! Return the address to the data of the vector input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T * value_ptr
- (
- tvec3<T, P> & vec
- )
- {
- return &(vec.x);
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T* value_ptr(mat<4, 4, T, Q>& m)
+ {
+ return &(m[0].x);
}
-
- /// Return the constant address to the data of the vector input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T const * value_ptr
- (
- tvec4<T, P> const & vec
- )
- {
- return &(vec.x);
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 3, T, Q> const& m)
+ {
+ return &(m[0].x);
}
- //! Return the address to the data of the vector input.
- //! From GLM_GTC_type_ptr extension.
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T * value_ptr
- (
- tvec4<T, P> & vec
- )
- {
- return &(vec.x);
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 3, T, Q>& m)
+ {
+ return &(m[0].x);
}
- /// Return the constant address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T const * value_ptr
- (
- tmat2x2<T, P> const & mat
- )
- {
- return &(mat[0].x);
- }
-
- //! Return the address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T * value_ptr
- (
- tmat2x2<T, P> & mat
- )
- {
- return &(mat[0].x);
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 2, T, Q> const& m)
+ {
+ return &(m[0].x);
}
-
- /// Return the constant address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T const * value_ptr
- (
- tmat3x3<T, P> const & mat
- )
- {
- return &(mat[0].x);
- }
-
- //! Return the address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T * value_ptr
- (
- tmat3x3<T, P> & mat
- )
- {
- return &(mat[0].x);
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 2, T, Q>& m)
+ {
+ return &(m[0].x);
}
-
- /// Return the constant address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T const * value_ptr
- (
- tmat4x4<T, P> const & mat
- )
- {
- return &(mat[0].x);
- }
-
- //! Return the address to the data of the matrix input.
- //! From GLM_GTC_type_ptr extension.
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T * value_ptr
- (
- tmat4x4<T, P> & mat
- )
- {
- return &(mat[0].x);
- }
-
- /// Return the constant address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T const * value_ptr
- (
- tmat2x3<T, P> const & mat
- )
- {
- return &(mat[0].x);
- }
-
- //! Return the address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T * value_ptr
- (
- tmat2x3<T, P> & mat
- )
- {
- return &(mat[0].x);
- }
-
- /// Return the constant address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T const * value_ptr
- (
- tmat3x2<T, P> const & mat
- )
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 4, T, Q> const& m)
{
- return &(mat[0].x);
- }
-
- //! Return the address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T * value_ptr
- (
- tmat3x2<T, P> & mat
- )
- {
- return &(mat[0].x);
- }
-
- /// Return the constant address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T const * value_ptr
- (
- tmat2x4<T, P> const & mat
- )
- {
- return &(mat[0].x);
- }
-
- //! Return the address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T * value_ptr
- (
- tmat2x4<T, P> & mat
- )
+ return &(m[0].x);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 4, T, Q>& m)
{
- return &(mat[0].x);
- }
-
- /// Return the constant address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T const * value_ptr
- (
- tmat4x2<T, P> const & mat
- )
- {
- return &(mat[0].x);
- }
-
- //! Return the address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T * value_ptr
- (
- tmat4x2<T, P> & mat
- )
+ return &(m[0].x);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 2, T, Q> const& m)
+ {
+ return &(m[0].x);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T* value_ptr(mat<4, 2, T, Q>& m)
+ {
+ return &(m[0].x);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 4, T, Q> const& m)
+ {
+ return &(m[0].x);
+ }
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 4, T, Q>& m)
{
- return &(mat[0].x);
+ return &(m[0].x);
}
-
- /// Return the constant address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T const * value_ptr
- (
- tmat3x4<T, P> const & mat
- )
+
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 3, T, Q> const& m)
{
- return &(mat[0].x);
- }
+ return &(m[0].x);
+ }
- //! Return the address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T * value_ptr
- (
- tmat3x4<T, P> & mat
- )
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T * value_ptr(mat<4, 3, T, Q>& m)
{
- return &(mat[0].x);
- }
-
- /// Return the constant address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T const * value_ptr
- (
- tmat4x3<T, P> const & mat
- )
- {
- return &(mat[0].x);
- }
-
- /// Return the address to the data of the matrix input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T * value_ptr(tmat4x3<T, P> & mat)
- {
- return &(mat[0].x);
+ return &(m[0].x);
}
- /// Return the constant address to the data of the input parameter.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T const * value_ptr
- (
- tquat<T, P> const & q
- )
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T const * value_ptr(tquat<T, Q> const& q)
{
return &(q[0]);
}
- /// Return the address to the data of the quaternion input.
- /// @see gtc_type_ptr
- template<typename T, precision P>
- GLM_FUNC_QUALIFIER T * value_ptr
- (
- tquat<T, P> & q
- )
+ template<typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER T* value_ptr(tquat<T, Q>& q)
{
return &(q[0]);
}
- /// Build a vector from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tvec2<T, defaultp> make_vec2(T const * const ptr)
+ template <typename T, qualifier Q>
+ inline vec<1, T, Q> make_vec1(vec<1, T, Q> const& v)
{
- tvec2<T, defaultp> Result;
- memcpy(value_ptr(Result), ptr, sizeof(tvec2<T, defaultp>));
+ return v;
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<1, T, Q> make_vec1(vec<2, T, Q> const& v)
+ {
+ return vec<1, T, Q>(v);
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<1, T, Q> make_vec1(vec<3, T, Q> const& v)
+ {
+ return vec<1, T, Q>(v);
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<1, T, Q> make_vec1(vec<4, T, Q> const& v)
+ {
+ return vec<1, T, Q>(v);
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<2, T, Q> make_vec2(vec<1, T, Q> const& v)
+ {
+ return vec<2, T, Q>(v.x, static_cast<T>(0));
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<2, T, Q> make_vec2(vec<2, T, Q> const& v)
+ {
+ return v;
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<2, T, Q> make_vec2(vec<3, T, Q> const& v)
+ {
+ return vec<2, T, Q>(v);
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<2, T, Q> make_vec2(vec<4, T, Q> const& v)
+ {
+ return vec<2, T, Q>(v);
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<3, T, Q> make_vec3(vec<1, T, Q> const& v)
+ {
+ return vec<3, T, Q>(v.x, static_cast<T>(0), static_cast<T>(0));
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<3, T, Q> make_vec3(vec<2, T, Q> const& v)
+ {
+ return vec<3, T, Q>(v.x, v.y, static_cast<T>(0));
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<3, T, Q> make_vec3(vec<3, T, Q> const& v)
+ {
+ return v;
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<3, T, Q> make_vec3(vec<4, T, Q> const& v)
+ {
+ return vec<3, T, Q>(v);
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<4, T, Q> make_vec4(vec<1, T, Q> const& v)
+ {
+ return vec<4, T, Q>(v.x, static_cast<T>(0), static_cast<T>(0), static_cast<T>(1));
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<4, T, Q> make_vec4(vec<2, T, Q> const& v)
+ {
+ return vec<4, T, Q>(v.x, v.y, static_cast<T>(0), static_cast<T>(1));
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<4, T, Q> make_vec4(vec<3, T, Q> const& v)
+ {
+ return vec<4, T, Q>(v.x, v.y, v.z, static_cast<T>(1));
+ }
+
+ template <typename T, qualifier Q>
+ inline vec<4, T, Q> make_vec4(vec<4, T, Q> const& v)
+ {
+ return v;
+ }
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER vec<2, T, defaultp> make_vec2(T const *const ptr)
+ {
+ vec<2, T, defaultp> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(vec<2, T, defaultp>));
return Result;
}
- /// Build a vector from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tvec3<T, defaultp> make_vec3(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER vec<3, T, defaultp> make_vec3(T const *const ptr)
{
- tvec3<T, defaultp> Result;
- memcpy(value_ptr(Result), ptr, sizeof(tvec3<T, defaultp>));
+ vec<3, T, defaultp> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(vec<3, T, defaultp>));
return Result;
}
- /// Build a vector from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tvec4<T, defaultp> make_vec4(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER vec<4, T, defaultp> make_vec4(T const *const ptr)
{
- tvec4<T, defaultp> Result;
- memcpy(value_ptr(Result), ptr, sizeof(tvec4<T, defaultp>));
+ vec<4, T, defaultp> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(vec<4, T, defaultp>));
return Result;
}
- /// Build a matrix from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tmat2x2<T, defaultp> make_mat2x2(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<2, 2, T, defaultp> make_mat2x2(T const *const ptr)
{
- tmat2x2<T, defaultp> Result;
- memcpy(value_ptr(Result), ptr, sizeof(tmat2x2<T, defaultp>));
+ mat<2, 2, T, defaultp> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(mat<2, 2, T, defaultp>));
return Result;
}
- /// Build a matrix from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tmat2x3<T, defaultp> make_mat2x3(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<2, 3, T, defaultp> make_mat2x3(T const *const ptr)
{
- tmat2x3<T, defaultp> Result;
- memcpy(value_ptr(Result), ptr, sizeof(tmat2x3<T, defaultp>));
+ mat<2, 3, T, defaultp> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(mat<2, 3, T, defaultp>));
return Result;
}
- /// Build a matrix from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tmat2x4<T, defaultp> make_mat2x4(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<2, 4, T, defaultp> make_mat2x4(T const *const ptr)
{
- tmat2x4<T, defaultp> Result;
- memcpy(value_ptr(Result), ptr, sizeof(tmat2x4<T, defaultp>));
+ mat<2, 4, T, defaultp> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(mat<2, 4, T, defaultp>));
return Result;
}
- /// Build a matrix from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tmat3x2<T, defaultp> make_mat3x2(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<3, 2, T, defaultp> make_mat3x2(T const *const ptr)
{
- tmat3x2<T, defaultp> Result;
- memcpy(value_ptr(Result), ptr, sizeof(tmat3x2<T, defaultp>));
+ mat<3, 2, T, defaultp> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(mat<3, 2, T, defaultp>));
return Result;
}
- //! Build a matrix from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tmat3x3<T, defaultp> make_mat3x3(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<3, 3, T, defaultp> make_mat3x3(T const *const ptr)
{
- tmat3x3<T, defaultp> Result;
- memcpy(value_ptr(Result), ptr, sizeof(tmat3x3<T, defaultp>));
+ mat<3, 3, T, defaultp> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(mat<3, 3, T, defaultp>));
return Result;
}
- //! Build a matrix from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tmat3x4<T, defaultp> make_mat3x4(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<3, 4, T, defaultp> make_mat3x4(T const *const ptr)
{
- tmat3x4<T, defaultp> Result;
- memcpy(value_ptr(Result), ptr, sizeof(tmat3x4<T, defaultp>));
+ mat<3, 4, T, defaultp> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(mat<3, 4, T, defaultp>));
return Result;
}
- //! Build a matrix from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x2<T, defaultp> make_mat4x2(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 2, T, defaultp> make_mat4x2(T const *const ptr)
{
- tmat4x2<T, defaultp> Result;
- memcpy(value_ptr(Result), ptr, sizeof(tmat4x2<T, defaultp>));
+ mat<4, 2, T, defaultp> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(mat<4, 2, T, defaultp>));
return Result;
}
- //! Build a matrix from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x3<T, defaultp> make_mat4x3(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 3, T, defaultp> make_mat4x3(T const *const ptr)
{
- tmat4x3<T, defaultp> Result;
- memcpy(value_ptr(Result), ptr, sizeof(tmat4x3<T, defaultp>));
+ mat<4, 3, T, defaultp> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(mat<4, 3, T, defaultp>));
return Result;
}
- //! Build a matrix from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> make_mat4x4(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> make_mat4x4(T const *const ptr)
{
- tmat4x4<T, defaultp> Result;
- memcpy(value_ptr(Result), ptr, sizeof(tmat4x4<T, defaultp>));
+ mat<4, 4, T, defaultp> Result;
+ memcpy(value_ptr(Result), ptr, sizeof(mat<4, 4, T, defaultp>));
return Result;
}
- //! Build a matrix from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tmat2x2<T, defaultp> make_mat2(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<2, 2, T, defaultp> make_mat2(T const *const ptr)
{
return make_mat2x2(ptr);
}
- //! Build a matrix from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tmat3x3<T, defaultp> make_mat3(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<3, 3, T, defaultp> make_mat3(T const *const ptr)
{
return make_mat3x3(ptr);
}
-
- //! Build a matrix from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tmat4x4<T, defaultp> make_mat4(T const * const ptr)
+
+ template<typename T>
+ GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> make_mat4(T const *const ptr)
{
return make_mat4x4(ptr);
}
- //! Build a quaternion from a pointer.
- /// @see gtc_type_ptr
- template <typename T>
- GLM_FUNC_QUALIFIER tquat<T, defaultp> make_quat(T const * const ptr)
+ template<typename T>
+ GLM_FUNC_QUALIFIER tquat<T, defaultp> make_quat(T const *const ptr)
{
tquat<T, defaultp> Result;
memcpy(value_ptr(Result), ptr, sizeof(tquat<T, defaultp>));
diff --git a/external/include/glm/gtc/ulp.hpp b/external/include/glm/gtc/ulp.hpp
index a82fa4e..4ed48d5 100644
--- a/external/include/glm/gtc/ulp.hpp
+++ b/external/include/glm/gtc/ulp.hpp
@@ -6,17 +6,19 @@
/// @defgroup gtc_ulp GLM_GTC_ulp
/// @ingroup gtc
///
-/// @brief Allow the measurement of the accuracy of a function against a reference
-/// implementation. This extension works on floating-point data and provide results
+/// Include <glm/gtc/ulp.hpp> to use the features of this extension.
+///
+/// Allow the measurement of the accuracy of a function against a reference
+/// implementation. This extension works on floating-point data and provide results
/// in ULP.
-/// <glm/gtc/ulp.hpp> need to be included to use these features.
#pragma once
// Dependencies
#include "../detail/setup.hpp"
-#include "../detail/precision.hpp"
+#include "../detail/qualifier.hpp"
#include "../detail/type_int.hpp"
+#include "../detail/compute_vector_relational.hpp"
#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_GTC_ulp extension included")
@@ -29,34 +31,34 @@ namespace glm
/// Return the next ULP value(s) after the input value(s).
/// @see gtc_ulp
- template <typename genType>
- GLM_FUNC_DECL genType next_float(genType const & x);
+ template<typename genType>
+ GLM_FUNC_DECL genType next_float(genType const& x);
/// Return the previous ULP value(s) before the input value(s).
/// @see gtc_ulp
- template <typename genType>
- GLM_FUNC_DECL genType prev_float(genType const & x);
+ template<typename genType>
+ GLM_FUNC_DECL genType prev_float(genType const& x);
/// Return the value(s) ULP distance after the input value(s).
/// @see gtc_ulp
- template <typename genType>
- GLM_FUNC_DECL genType next_float(genType const & x, uint const & Distance);
+ template<typename genType>
+ GLM_FUNC_DECL genType next_float(genType const& x, uint const& Distance);
/// Return the value(s) ULP distance before the input value(s).
/// @see gtc_ulp
- template <typename genType>
- GLM_FUNC_DECL genType prev_float(genType const & x, uint const & Distance);
-
+ template<typename genType>
+ GLM_FUNC_DECL genType prev_float(genType const& x, uint const& Distance);
+
/// Return the distance in the number of ULP between 2 scalars.
/// @see gtc_ulp
- template <typename T>
- GLM_FUNC_DECL uint float_distance(T const & x, T const & y);
+ template<typename T>
+ GLM_FUNC_DECL uint float_distance(T const& x, T const& y);
/// Return the distance in the number of ULP between 2 vectors.
/// @see gtc_ulp
- template<typename T, template<typename> class vecType>
- GLM_FUNC_DECL vecType<uint> float_distance(vecType<T> const & x, vecType<T> const & y);
-
+ template<typename T, qualifier Q>
+ GLM_FUNC_DECL vec<2, uint, Q> float_distance(vec<2, T, Q> const& x, vec<2, T, Q> const& y);
+
/// @}
}// namespace glm
diff --git a/external/include/glm/gtc/ulp.inl b/external/include/glm/gtc/ulp.inl
index 54c914a..620be36 100644
--- a/external/include/glm/gtc/ulp.inl
+++ b/external/include/glm/gtc/ulp.inl
@@ -9,6 +9,7 @@
/// is preserved.
#include "../detail/type_int.hpp"
+#include "epsilon.hpp"
#include <cmath>
#include <cfloat>
#include <limits>
@@ -78,33 +79,42 @@ namespace detail
ix = hx&0x7fffffff; // |x|
iy = hy&0x7fffffff; // |y|
- if((ix>0x7f800000) || // x is nan
- (iy>0x7f800000)) // y is nan
+ if((ix>0x7f800000) || // x is nan
+ (iy>0x7f800000)) // y is nan
return x+y;
- if(x==y) return y; // x=y, return y
- if(ix==0) { // x == 0
+ if(compute_equal<float>::call(x, y))
+ return y; // x=y, return y
+ if(ix==0)
+ { // x == 0
GLM_SET_FLOAT_WORD(x,(hy&0x80000000)|1);// return +-minsubnormal
t = x*x;
- if(t==x) return t; else return x; // raise underflow flag
+ if(detail::compute_equal<float>::call(t, x))
+ return t;
+ else
+ return x; // raise underflow flag
}
- if(hx>=0) { // x > 0
- if(hx>hy) { // x > y, x -= ulp
+ if(hx>=0)
+ { // x > 0
+ if(hx>hy) // x > y, x -= ulp
hx -= 1;
- } else { // x < y, x += ulp
+ else // x < y, x += ulp
hx += 1;
- }
- } else { // x < 0
- if(hy>=0||hx>hy){ // x < y, x -= ulp
+ }
+ else
+ { // x < 0
+ if(hy>=0||hx>hy) // x < y, x -= ulp
hx -= 1;
- } else { // x > y, x += ulp
+ else // x > y, x += ulp
hx += 1;
- }
}
hy = hx&0x7f800000;
- if(hy>=0x7f800000) return x+x; // overflow
- if(hy<0x00800000) { // underflow
+ if(hy>=0x7f800000)
+ return x+x; // overflow
+ if(hy<0x00800000) // underflow
+ {
t = x*x;
- if(t!=x) { // raise underflow flag
+ if(!detail::compute_equal<float>::call(t, x))
+ { // raise underflow flag
GLM_SET_FLOAT_WORD(y,hx);
return y;
}
@@ -121,27 +131,32 @@ namespace detail
GLM_EXTRACT_WORDS(hx, lx, x);
GLM_EXTRACT_WORDS(hy, ly, y);
- ix = hx & 0x7fffffff; // |x|
- iy = hy & 0x7fffffff; // |y|
+ ix = hx & 0x7fffffff; // |x|
+ iy = hy & 0x7fffffff; // |y|
- if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || // x is nan
- ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) // y is nan
+ if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || // x is nan
+ ((iy>=0x7ff00000)&&((iy-0x7ff00000)|ly)!=0)) // y is nan
return x+y;
- if(x==y) return y; // x=y, return y
- if((ix|lx)==0) { // x == 0
- GLM_INSERT_WORDS(x, hy & 0x80000000, 1); // return +-minsubnormal
+ if(detail::compute_equal<double>::call(x, y))
+ return y; // x=y, return y
+ if((ix|lx)==0)
+ { // x == 0
+ GLM_INSERT_WORDS(x, hy & 0x80000000, 1); // return +-minsubnormal
t = x*x;
- if(t==x) return t; else return x; // raise underflow flag
+ if(detail::compute_equal<double>::call(t, x))
+ return t;
+ else
+ return x; // raise underflow flag
}
- if(hx>=0) { // x > 0
- if(hx>hy||((hx==hy)&&(lx>ly))) { // x > y, x -= ulp
+ if(hx>=0) { // x > 0
+ if(hx>hy||((hx==hy)&&(lx>ly))) { // x > y, x -= ulp
if(lx==0) hx -= 1;
lx -= 1;
} else { // x < y, x += ulp
lx += 1;
if(lx==0) hx += 1;
}
- } else { // x < 0
+ } else { // x < 0
if(hy>=0||hx>hy||((hx==hy)&&(lx>ly))){// x < y, x -= ulp
if(lx==0) hx -= 1;
lx -= 1;
@@ -151,10 +166,13 @@ namespace detail
}
}
hy = hx&0x7ff00000;
- if(hy>=0x7ff00000) return x+x; // overflow
- if(hy<0x00100000) { // underflow
+ if(hy>=0x7ff00000)
+ return x+x; // overflow
+ if(hy<0x00100000)
+ { // underflow
t = x*x;
- if(t!=x) { // raise underflow flag
+ if(!detail::compute_equal<double>::call(t, x))
+ { // raise underflow flag
GLM_INSERT_WORDS(y,hx,lx);
return y;
}
@@ -171,8 +189,8 @@ namespace detail
namespace glm
{
- template <>
- GLM_FUNC_QUALIFIER float next_float(float const & x)
+ template<>
+ GLM_FUNC_QUALIFIER float next_float(float const& x)
{
# if GLM_HAS_CXX11_STL
return std::nextafter(x, std::numeric_limits<float>::max());
@@ -185,8 +203,8 @@ namespace glm
# endif
}
- template <>
- GLM_FUNC_QUALIFIER double next_float(double const & x)
+ template<>
+ GLM_FUNC_QUALIFIER double next_float(double const& x)
{
# if GLM_HAS_CXX11_STL
return std::nextafter(x, std::numeric_limits<double>::max());
@@ -199,16 +217,16 @@ namespace glm
# endif
}
- template<typename T, precision P, template<typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> next_float(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> next_float(vec<L, T, Q> const& x)
{
- vecType<T, P> Result(uninitialize);
+ vec<L, T, Q> Result;
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = next_float(x[i]);
return Result;
}
- GLM_FUNC_QUALIFIER float prev_float(float const & x)
+ GLM_FUNC_QUALIFIER float prev_float(float const& x)
{
# if GLM_HAS_CXX11_STL
return std::nextafter(x, std::numeric_limits<float>::min());
@@ -221,7 +239,7 @@ namespace glm
# endif
}
- GLM_FUNC_QUALIFIER double prev_float(double const & x)
+ GLM_FUNC_QUALIFIER double prev_float(double const& x)
{
# if GLM_HAS_CXX11_STL
return std::nextafter(x, std::numeric_limits<double>::min());
@@ -234,17 +252,17 @@ namespace glm
# endif
}
- template<typename T, precision P, template<typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> prev_float(vecType<T, P> const & x)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> prev_float(vec<L, T, Q> const& x)
{
- vecType<T, P> Result(uninitialize);
+ vec<L, T, Q> Result;
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = prev_float(x[i]);
return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER T next_float(T const & x, uint const & ulps)
+ template<typename T>
+ GLM_FUNC_QUALIFIER T next_float(T const& x, uint const& ulps)
{
T temp = x;
for(uint i = 0; i < ulps; ++i)
@@ -252,17 +270,17 @@ namespace glm
return temp;
}
- template<typename T, precision P, template<typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> next_float(vecType<T, P> const & x, vecType<uint, P> const & ulps)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> next_float(vec<L, T, Q> const& x, vec<L, uint, Q> const& ulps)
{
- vecType<T, P> Result(uninitialize);
+ vec<L, T, Q> Result;
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = next_float(x[i], ulps[i]);
return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER T prev_float(T const & x, uint const & ulps)
+ template<typename T>
+ GLM_FUNC_QUALIFIER T prev_float(T const& x, uint const& ulps)
{
T temp = x;
for(uint i = 0; i < ulps; ++i)
@@ -270,24 +288,24 @@ namespace glm
return temp;
}
- template<typename T, precision P, template<typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<T, P> prev_float(vecType<T, P> const & x, vecType<uint, P> const & ulps)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, T, Q> prev_float(vec<L, T, Q> const& x, vec<L, uint, Q> const& ulps)
{
- vecType<T, P> Result(uninitialize);
+ vec<L, T, Q> Result;
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = prev_float(x[i], ulps[i]);
return Result;
}
- template <typename T>
- GLM_FUNC_QUALIFIER uint float_distance(T const & x, T const & y)
+ template<typename T>
+ GLM_FUNC_QUALIFIER uint float_distance(T const& x, T const& y)
{
uint ulp = 0;
if(x < y)
{
T temp = x;
- while(temp != y)// && ulp < std::numeric_limits<std::size_t>::max())
+ while(glm::epsilonNotEqual(temp, y, glm::epsilon<T>()))// && ulp < std::numeric_limits<std::size_t>::max())
{
++ulp;
temp = next_float(temp);
@@ -296,7 +314,7 @@ namespace glm
else if(y < x)
{
T temp = y;
- while(temp != x)// && ulp < std::numeric_limits<std::size_t>::max())
+ while(glm::epsilonNotEqual(temp, x, glm::epsilon<T>()))// && ulp < std::numeric_limits<std::size_t>::max())
{
++ulp;
temp = next_float(temp);
@@ -310,10 +328,10 @@ namespace glm
return ulp;
}
- template<typename T, precision P, template<typename, precision> class vecType>
- GLM_FUNC_QUALIFIER vecType<uint, P> float_distance(vecType<T, P> const & x, vecType<T, P> const & y)
+ template<length_t L, typename T, qualifier Q>
+ GLM_FUNC_QUALIFIER vec<L, uint, Q> float_distance(vec<L, T, Q> const& x, vec<L, T, Q> const& y)
{
- vecType<uint, P> Result(uninitialize);
+ vec<L, uint, Q> Result;
for(length_t i = 0, n = Result.length(); i < n; ++i)
Result[i] = float_distance(x[i], y[i]);
return Result;
diff --git a/external/include/glm/gtc/vec1.hpp b/external/include/glm/gtc/vec1.hpp
index f84ff97..44da3ab 100644
--- a/external/include/glm/gtc/vec1.hpp
+++ b/external/include/glm/gtc/vec1.hpp
@@ -5,160 +5,18 @@
///
/// @defgroup gtc_vec1 GLM_GTC_vec1
/// @ingroup gtc
-///
-/// @brief Add vec1, ivec1, uvec1 and bvec1 types.
-/// <glm/gtc/vec1.hpp> need to be included to use these functionalities.
+///
+/// Include <glm/gtc/vec1.hpp> to use the features of this extension.
+///
+/// Add vec1, ivec1, uvec1 and bvec1 types.
#pragma once
// Dependency:
-#include "../glm.hpp"
-#include "../detail/type_vec1.hpp"
+#include "../ext/vec1.hpp"
#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_GTC_vec1 extension included")
#endif
-namespace glm
-{
- /// 1 component vector of high precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef highp_vec1_t highp_vec1;
-
- /// 1 component vector of medium precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef mediump_vec1_t mediump_vec1;
-
- /// 1 component vector of low precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef lowp_vec1_t lowp_vec1;
-
- /// 1 component vector of high precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef highp_dvec1_t highp_dvec1;
-
- /// 1 component vector of medium precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef mediump_dvec1_t mediump_dvec1;
-
- /// 1 component vector of low precision floating-point numbers.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef lowp_dvec1_t lowp_dvec1;
-
- /// 1 component vector of high precision signed integer numbers.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef highp_ivec1_t highp_ivec1;
-
- /// 1 component vector of medium precision signed integer numbers.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef mediump_ivec1_t mediump_ivec1;
-
- /// 1 component vector of low precision signed integer numbers.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef lowp_ivec1_t lowp_ivec1;
-
- /// 1 component vector of high precision unsigned integer numbers.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef highp_uvec1_t highp_uvec1;
-
- /// 1 component vector of medium precision unsigned integer numbers.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef mediump_uvec1_t mediump_uvec1;
-
- /// 1 component vector of low precision unsigned integer numbers.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef lowp_uvec1_t lowp_uvec1;
-
- /// 1 component vector of high precision boolean.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef highp_bvec1_t highp_bvec1;
-
- /// 1 component vector of medium precision boolean.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef mediump_bvec1_t mediump_bvec1;
-
- /// 1 component vector of low precision boolean.
- /// There is no guarantee on the actual precision.
- /// @see gtc_vec1 extension.
- typedef lowp_bvec1_t lowp_bvec1;
-
- //////////////////////////
- // vec1 definition
-
-#if(defined(GLM_PRECISION_HIGHP_BOOL))
- typedef highp_bvec1 bvec1;
-#elif(defined(GLM_PRECISION_MEDIUMP_BOOL))
- typedef mediump_bvec1 bvec1;
-#elif(defined(GLM_PRECISION_LOWP_BOOL))
- typedef lowp_bvec1 bvec1;
-#else
- /// 1 component vector of boolean.
- /// @see gtc_vec1 extension.
- typedef highp_bvec1 bvec1;
-#endif//GLM_PRECISION
-
-#if(defined(GLM_PRECISION_HIGHP_FLOAT))
- typedef highp_vec1 vec1;
-#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
- typedef mediump_vec1 vec1;
-#elif(defined(GLM_PRECISION_LOWP_FLOAT))
- typedef lowp_vec1 vec1;
-#else
- /// 1 component vector of floating-point numbers.
- /// @see gtc_vec1 extension.
- typedef highp_vec1 vec1;
-#endif//GLM_PRECISION
-
-#if(defined(GLM_PRECISION_HIGHP_DOUBLE))
- typedef highp_dvec1 dvec1;
-#elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
- typedef mediump_dvec1 dvec1;
-#elif(defined(GLM_PRECISION_LOWP_DOUBLE))
- typedef lowp_dvec1 dvec1;
-#else
- /// 1 component vector of floating-point numbers.
- /// @see gtc_vec1 extension.
- typedef highp_dvec1 dvec1;
-#endif//GLM_PRECISION
-
-#if(defined(GLM_PRECISION_HIGHP_INT))
- typedef highp_ivec1 ivec1;
-#elif(defined(GLM_PRECISION_MEDIUMP_INT))
- typedef mediump_ivec1 ivec1;
-#elif(defined(GLM_PRECISION_LOWP_INT))
- typedef lowp_ivec1 ivec1;
-#else
- /// 1 component vector of signed integer numbers.
- /// @see gtc_vec1 extension.
- typedef highp_ivec1 ivec1;
-#endif//GLM_PRECISION
-
-#if(defined(GLM_PRECISION_HIGHP_UINT))
- typedef highp_uvec1 uvec1;
-#elif(defined(GLM_PRECISION_MEDIUMP_UINT))
- typedef mediump_uvec1 uvec1;
-#elif(defined(GLM_PRECISION_LOWP_UINT))
- typedef lowp_uvec1 uvec1;
-#else
- /// 1 component vector of unsigned integer numbers.
- /// @see gtc_vec1 extension.
- typedef highp_uvec1 uvec1;
-#endif//GLM_PRECISION
-
-}// namespace glm
-
#include "vec1.inl"
diff --git a/external/include/glm/gtc/functions.inl b/external/include/glm/gtx/functions.inl
index 1dbc496..ac1e112 100644
--- a/external/include/glm/gtc/functions.inl
+++ b/external/include/glm/gtx/functions.inl
@@ -1,11 +1,11 @@
-/// @ref gtc_functions
-/// @file glm/gtc/functions.inl
+/// @ref gtx_functions
+/// @file glm/gtx/functions.inl
-#include "../detail/func_exponential.hpp"
+#include "../exponential.hpp"
namespace glm
{
- template <typename T>
+ template<typename T>
GLM_FUNC_QUALIFIER T gauss
(
T x,
@@ -16,15 +16,15 @@ namespace glm
return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast<T>(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast<T>(6.28318530717958647692528676655900576)));
}
- template <typename T, precision P>
+ template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER T gauss
(
- tvec2<T, P> const& Coord,
- tvec2<T, P> const& ExpectedValue,
- tvec2<T, P> const& StandardDeviation
+ vec<2, T, Q> const& Coord,
+ vec<2, T, Q> const& ExpectedValue,
+ vec<2, T, Q> const& StandardDeviation
)
{
- tvec2<T, P> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast<T>(2) * StandardDeviation * StandardDeviation);
+ vec<2, T, Q> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast<T>(2) * StandardDeviation * StandardDeviation);
return exp(-(Squared.x + Squared.y));
}
}//namespace glm