Use length_t instead of int for vec and mat lengths #584
This commit is contained in:
@@ -32,62 +32,62 @@ 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
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <typename T, precision P, template <typename, precision> class vecIUType>
|
||||
template<typename T, precision P, template<typename, precision> class vecIUType>
|
||||
GLM_FUNC_DECL vecIUType<T, P> mask(vecIUType<T, P> 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.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> bitfieldRotateRight(vecType<D, T, P> const & In, int Shift);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> bitfieldRotateRight(vecType<L, T, P> 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.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> bitfieldRotateLeft(vecType<D, T, P> const & In, int Shift);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> bitfieldRotateLeft(vecType<L, T, P> 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.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> bitfieldFillOne(vecType<D, T, P> const & Value, int FirstBit, int BitCount);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> bitfieldFillOne(vecType<L, T, P> 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.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> bitfieldFillZero(vecType<D, T, P> const & Value, int FirstBit, int BitCount);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> bitfieldFillZero(vecType<L, T, P> 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.
|
||||
|
||||
@@ -6,16 +6,16 @@
|
||||
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);
|
||||
@@ -33,7 +33,7 @@ namespace detail
|
||||
return REG1 | (REG2 << 1);
|
||||
}
|
||||
|
||||
template <>
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave(glm::uint16 x, glm::uint16 y)
|
||||
{
|
||||
glm::uint32 REG1(x);
|
||||
@@ -54,7 +54,7 @@ namespace detail
|
||||
return REG1 | (REG2 << 1);
|
||||
}
|
||||
|
||||
template <>
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER glm::uint64 bitfieldInterleave(glm::uint32 x, glm::uint32 y)
|
||||
{
|
||||
glm::uint64 REG1(x);
|
||||
@@ -78,7 +78,7 @@ namespace detail
|
||||
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);
|
||||
@@ -104,7 +104,7 @@ namespace detail
|
||||
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);
|
||||
@@ -134,7 +134,7 @@ namespace detail
|
||||
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);
|
||||
@@ -164,7 +164,7 @@ namespace detail
|
||||
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);
|
||||
@@ -190,7 +190,7 @@ namespace detail
|
||||
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);
|
||||
@@ -222,7 +222,7 @@ namespace detail
|
||||
}
|
||||
}//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 <int D, typename T, precision P, template <int, typename, precision> class vecIUType>
|
||||
GLM_FUNC_QUALIFIER vecIUType<D, T, P> mask(vecIUType<D, T, P> const& v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecIUType>
|
||||
GLM_FUNC_QUALIFIER vecIUType<L, T, P> mask(vecIUType<L, T, P> const& v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'mask' accepts only integer values");
|
||||
|
||||
return detail::functor1<D, T, T, P>::call(mask, v);
|
||||
return detail::functor1<L, T, T, P>::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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldRotateRight(vecType<D, T, P> const & In, int Shift)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldRotateRight(vecType<L, T, P> 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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldRotateLeft(vecType<D, T, P> const& In, int Shift)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldRotateLeft(vecType<L, T, P> 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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldFillOne(vecType<D, T, P> const& Value, int FirstBit, int BitCount)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldFillOne(vecType<L, T, P> 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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> bitfieldFillZero(vecType<D, T, P> const& Value, int FirstBit, int BitCount)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> bitfieldFillZero(vecType<L, T, P> const& Value, int FirstBit, int BitCount)
|
||||
{
|
||||
return Value & static_cast<T>(~(mask(BitCount) << FirstBit));
|
||||
}
|
||||
|
||||
@@ -32,23 +32,23 @@ namespace glm
|
||||
|
||||
/// Convert a linear color to sRGB color using a standard gamma correction.
|
||||
/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> convertLinearToSRGB(vecType<D, T, P> const & ColorLinear);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> convertLinearToSRGB(vecType<L, T, P> const & ColorLinear);
|
||||
|
||||
/// Convert a linear color to sRGB color using a custom gamma correction.
|
||||
/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> convertLinearToSRGB(vecType<D, T, P> const & ColorLinear, T Gamma);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> convertLinearToSRGB(vecType<L, T, P> const & ColorLinear, T Gamma);
|
||||
|
||||
/// Convert a sRGB color to linear color using a standard gamma correction.
|
||||
/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> convertSRGBToLinear(vecType<D, T, P> const & ColorSRGB);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> convertSRGBToLinear(vecType<L, T, P> const & ColorSRGB);
|
||||
|
||||
/// Convert a sRGB color to linear color using a custom gamma correction.
|
||||
// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> convertSRGBToLinear(vecType<D, T, P> const & ColorSRGB, T Gamma);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> convertSRGBToLinear(vecType<L, T, P> const & ColorSRGB, T Gamma);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
||||
@@ -4,21 +4,21 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_rgbToSrgb
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const& ColorRGB, T GammaCorrection)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const& ColorRGB, T GammaCorrection)
|
||||
{
|
||||
vecType<D, T, P> const ClampedColor(clamp(ColorRGB, static_cast<T>(0), static_cast<T>(1)));
|
||||
vecType<L, T, P> const ClampedColor(clamp(ColorRGB, static_cast<T>(0), static_cast<T>(1)));
|
||||
|
||||
return mix(
|
||||
pow(ClampedColor, vecType<D, T, P>(GammaCorrection)) * static_cast<T>(1.055) - static_cast<T>(0.055),
|
||||
pow(ClampedColor, vecType<L, T, P>(GammaCorrection)) * static_cast<T>(1.055) - static_cast<T>(0.055),
|
||||
ClampedColor * static_cast<T>(12.92),
|
||||
lessThan(ClampedColor, vecType<D, T, P>(static_cast<T>(0.0031308))));
|
||||
lessThan(ClampedColor, vecType<L, T, P>(static_cast<T>(0.0031308))));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
struct compute_rgbToSrgb<4, T, P, vec>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<4, T, P> call(vec<4, T, P> const& ColorRGB, T GammaCorrection)
|
||||
@@ -27,19 +27,19 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_srgbToRgb
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const& ColorSRGB, T Gamma)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const& ColorSRGB, T Gamma)
|
||||
{
|
||||
return mix(
|
||||
pow((ColorSRGB + static_cast<T>(0.055)) * static_cast<T>(0.94786729857819905213270142180095), vecType<D, T, P>(Gamma)),
|
||||
pow((ColorSRGB + static_cast<T>(0.055)) * static_cast<T>(0.94786729857819905213270142180095), vecType<L, T, P>(Gamma)),
|
||||
ColorSRGB * static_cast<T>(0.07739938080495356037151702786378),
|
||||
lessThanEqual(ColorSRGB, vecType<D, T, P>(static_cast<T>(0.04045))));
|
||||
lessThanEqual(ColorSRGB, vecType<L, T, P>(static_cast<T>(0.04045))));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
struct compute_srgbToRgb<4, T, P, vec>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<4, T, P> call(vec<4, T, P> const& ColorSRGB, T Gamma)
|
||||
@@ -49,14 +49,14 @@ namespace detail
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> convertLinearToSRGB(vecType<D, T, P> const& ColorLinear)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> convertLinearToSRGB(vecType<L, T, P> const& ColorLinear)
|
||||
{
|
||||
return detail::compute_rgbToSrgb<D, T, P, vecType>::call(ColorLinear, static_cast<T>(0.41666));
|
||||
return detail::compute_rgbToSrgb<L, T, P, vecType>::call(ColorLinear, static_cast<T>(0.41666));
|
||||
}
|
||||
|
||||
// Based on Ian Taylor http://chilliant.blogspot.fr/2012/08/srgb-approximations-for-hlsl.html
|
||||
template <>
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER vec<3, float, lowp> convertLinearToSRGB(vec<3, float, lowp> const& ColorLinear)
|
||||
{
|
||||
vec<3, float, lowp> S1 = sqrt(ColorLinear);
|
||||
@@ -65,21 +65,21 @@ namespace detail
|
||||
return 0.662002687f * S1 + 0.684122060f * S2 - 0.323583601f * S3 - 0.0225411470f * ColorLinear;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> convertLinearToSRGB(vecType<D, T, P> const& ColorLinear, T Gamma)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> convertLinearToSRGB(vecType<L, T, P> const& ColorLinear, T Gamma)
|
||||
{
|
||||
return detail::compute_rgbToSrgb<D, T, P, vecType>::call(ColorLinear, static_cast<T>(1) / Gamma);
|
||||
return detail::compute_rgbToSrgb<L, T, P, vecType>::call(ColorLinear, static_cast<T>(1) / Gamma);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> convertSRGBToLinear(vecType<D, T, P> const& ColorSRGB)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> convertSRGBToLinear(vecType<L, T, P> const& ColorSRGB)
|
||||
{
|
||||
return detail::compute_srgbToRgb<D, T, P, vecType>::call(ColorSRGB, static_cast<T>(2.4));
|
||||
return detail::compute_srgbToRgb<L, T, P, vecType>::call(ColorSRGB, static_cast<T>(2.4));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> convertSRGBToLinear(vecType<D, T, P> const& ColorSRGB, T Gamma)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> convertSRGBToLinear(vecType<L, T, P> const& ColorSRGB, T Gamma)
|
||||
{
|
||||
return detail::compute_srgbToRgb<D, T, P, vecType>::call(ColorSRGB, Gamma);
|
||||
return detail::compute_srgbToRgb<L, T, P, vecType>::call(ColorSRGB, Gamma);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@@ -26,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();
|
||||
|
||||
/// @}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -30,17 +30,17 @@ namespace glm
|
||||
/// True if this expression is satisfied.
|
||||
///
|
||||
/// @see gtc_epsilon
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> epsilonEqual(
|
||||
vecType<D, T, P> const & x,
|
||||
vecType<D, T, P> const & y,
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> epsilonEqual(
|
||||
vecType<L, T, P> const& x,
|
||||
vecType<L, T, P> 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>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL bool epsilonEqual(
|
||||
genType const & x,
|
||||
genType const & y,
|
||||
@@ -50,7 +50,7 @@ namespace glm
|
||||
/// True if this expression is not satisfied.
|
||||
///
|
||||
/// @see gtc_epsilon
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL typename genType::boolType epsilonNotEqual(
|
||||
genType const & x,
|
||||
genType const & y,
|
||||
@@ -60,7 +60,7 @@ namespace glm
|
||||
/// True if this expression is not satisfied.
|
||||
///
|
||||
/// @see gtc_epsilon
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL bool epsilonNotEqual(
|
||||
genType const & x,
|
||||
genType const & y,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <>
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER bool epsilonEqual
|
||||
(
|
||||
float const & x,
|
||||
@@ -22,7 +22,7 @@ namespace glm
|
||||
return abs(x - y) < epsilon;
|
||||
}
|
||||
|
||||
template <>
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER bool epsilonEqual
|
||||
(
|
||||
double const & x,
|
||||
@@ -33,7 +33,7 @@ namespace glm
|
||||
return abs(x - y) < epsilon;
|
||||
}
|
||||
|
||||
template <>
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER bool epsilonNotEqual
|
||||
(
|
||||
float const & x,
|
||||
@@ -44,7 +44,7 @@ namespace glm
|
||||
return abs(x - y) >= epsilon;
|
||||
}
|
||||
|
||||
template <>
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER bool epsilonNotEqual
|
||||
(
|
||||
double const & x,
|
||||
@@ -55,51 +55,51 @@ namespace glm
|
||||
return abs(x - y) >= epsilon;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> epsilonEqual
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> epsilonEqual
|
||||
(
|
||||
vecType<D, T, P> const & x,
|
||||
vecType<D, T, P> const & y,
|
||||
vecType<L, T, P> const& x,
|
||||
vecType<L, T, P> const& y,
|
||||
T const & epsilon
|
||||
)
|
||||
{
|
||||
return lessThan(abs(x - y), vecType<D, T, P>(epsilon));
|
||||
return lessThan(abs(x - y), vecType<L, T, P>(epsilon));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> epsilonEqual
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> epsilonEqual
|
||||
(
|
||||
vecType<D, T, P> const & x,
|
||||
vecType<D, T, P> const & y,
|
||||
vecType<D, T, P> const & epsilon
|
||||
vecType<L, T, P> const& x,
|
||||
vecType<L, T, P> const& y,
|
||||
vecType<L, T, P> const& epsilon
|
||||
)
|
||||
{
|
||||
return lessThan(abs(x - y), vecType<D, T, P>(epsilon));
|
||||
return lessThan(abs(x - y), vecType<L, T, P>(epsilon));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> epsilonNotEqual
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> epsilonNotEqual
|
||||
(
|
||||
vecType<D, T, P> const & x,
|
||||
vecType<D, T, P> const & y,
|
||||
vecType<L, T, P> const& x,
|
||||
vecType<L, T, P> const& y,
|
||||
T const & epsilon
|
||||
)
|
||||
{
|
||||
return greaterThanEqual(abs(x - y), vecType<D, T, P>(epsilon));
|
||||
return greaterThanEqual(abs(x - y), vecType<L, T, P>(epsilon));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> epsilonNotEqual
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> epsilonNotEqual
|
||||
(
|
||||
vecType<D, T, P> const & x,
|
||||
vecType<D, T, P> const & y,
|
||||
vecType<D, T, P> const & epsilon
|
||||
vecType<L, T, P> const& x,
|
||||
vecType<L, T, P> const& y,
|
||||
vecType<L, T, P> const& epsilon
|
||||
)
|
||||
{
|
||||
return greaterThanEqual(abs(x - y), vecType<D, T, P>(epsilon));
|
||||
return greaterThanEqual(abs(x - y), vecType<L, T, P>(epsilon));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> epsilonEqual
|
||||
(
|
||||
tquat<T, P> const & x,
|
||||
@@ -111,7 +111,7 @@ namespace glm
|
||||
return lessThan(abs(v), vec<4, T, P>(epsilon));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> epsilonNotEqual
|
||||
(
|
||||
tquat<T, P> const & x,
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace glm
|
||||
/// 1D gauss function
|
||||
///
|
||||
/// @see gtc_epsilon
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL T gauss(
|
||||
T x,
|
||||
T ExpectedValue,
|
||||
@@ -39,7 +39,7 @@ namespace glm
|
||||
/// 2D gauss function
|
||||
///
|
||||
/// @see gtc_epsilon
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL T gauss(
|
||||
vec<2, T, P> const& Coord,
|
||||
vec<2, T, P> const& ExpectedValue,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T gauss
|
||||
(
|
||||
T x,
|
||||
@@ -16,7 +16,7 @@ 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, precision P>
|
||||
GLM_FUNC_QUALIFIER T gauss
|
||||
(
|
||||
vec<2, T, P> const& Coord,
|
||||
|
||||
@@ -32,7 +32,7 @@ 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
|
||||
@@ -43,7 +43,7 @@ namespace glm
|
||||
/// @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>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_DECL genIUType mod(genIUType x, genIUType y);
|
||||
|
||||
/// Modulus. Returns x % y
|
||||
@@ -55,8 +55,8 @@ namespace glm
|
||||
/// @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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> mod(vecType<D, T, P> const & x, T y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> mod(vecType<L, T, P> const & x, T y);
|
||||
|
||||
/// Modulus. Returns x % y
|
||||
/// for each component in x using the floating point value y.
|
||||
@@ -67,8 +67,8 @@ namespace glm
|
||||
/// @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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> mod(vecType<D, T, P> const & x, vecType<D, T, P> const & y);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> mod(vecType<L, T, P> const & x, vecType<L, 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
|
||||
@@ -80,8 +80,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
|
||||
/// @see gtc_integer
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, int, P> iround(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, int, P> iround(vecType<L, T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// The fraction 0.5 will round in a direction chosen by the
|
||||
@@ -93,8 +93,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
|
||||
/// @see gtc_integer
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, uint, P> uround(vecType<D, T, P> const & x);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, uint, P> uround(vecType<L, T, P> const & x);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
||||
@@ -4,19 +4,19 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_log2<D, T, P, vecType, false, Aligned>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool Aligned>
|
||||
struct compute_log2<L, T, P, vecType, false, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & vec)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const& v)
|
||||
{
|
||||
//Equivalent to return findMSB(vec); but save one function call in ASM with VC
|
||||
//return findMSB(vec);
|
||||
return vecType<D, T, P>(detail::compute_findMSB_vec<D, T, P, vecType, sizeof(T) * 8>::call(vec));
|
||||
return vecType<L, T, P>(detail::compute_findMSB_vec<L, T, P, vecType, sizeof(T) * 8>::call(v));
|
||||
}
|
||||
};
|
||||
|
||||
# if GLM_HAS_BITSCAN_WINDOWS
|
||||
template <precision P, bool Aligned>
|
||||
template<precision P, bool Aligned>
|
||||
struct compute_log2<4, int, P, vec, false, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<4, int, P> call(vec<4, int, P> const& v)
|
||||
@@ -33,7 +33,7 @@ namespace detail
|
||||
};
|
||||
# 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 +42,16 @@ namespace detail
|
||||
return static_cast<int>(x + static_cast<genType>(0.5));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, int, P> iround(vecType<D, T, P> const& x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, int, P> iround(vecType<L, T, P> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'iround' only accept floating-point inputs");
|
||||
assert(all(lessThanEqual(vecType<D, T, P>(0), x)));
|
||||
assert(all(lessThanEqual(vecType<L, T, P>(0), x)));
|
||||
|
||||
return vecType<D, int, P>(x + static_cast<T>(0.5));
|
||||
return vecType<L, int, P>(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 +60,12 @@ namespace detail
|
||||
return static_cast<uint>(x + static_cast<genType>(0.5));
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, uint, P> uround(vecType<D, T, P> const& x)
|
||||
template<glm::length_t L, typename T, precision P, template<glm::length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, uint, P> uround(vecType<L, T, P> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'uround' only accept floating-point inputs");
|
||||
assert(all(lessThanEqual(vecType<D, T, P>(0), x)));
|
||||
assert(all(lessThanEqual(vecType<L, T, P>(0), x)));
|
||||
|
||||
return vecType<D, uint, P>(x + static_cast<T>(0.5));
|
||||
return vecType<L, uint, P>(x + static_cast<T>(0.5));
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@@ -25,14 +25,14 @@ 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,
|
||||
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,
|
||||
length_t index,
|
||||
@@ -40,14 +40,14 @@ namespace glm
|
||||
|
||||
/// 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,
|
||||
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,
|
||||
length_t index,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType row
|
||||
(
|
||||
genType const & m,
|
||||
@@ -19,7 +19,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER typename genType::row_type row
|
||||
(
|
||||
genType const & m,
|
||||
@@ -34,7 +34,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType column
|
||||
(
|
||||
genType const & m,
|
||||
@@ -49,7 +49,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER typename genType::col_type column
|
||||
(
|
||||
genType const & m,
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_matrix_inverse
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType affineInverse(genType const & m);
|
||||
|
||||
/// Compute the inverse transpose of a matrix.
|
||||
@@ -40,7 +40,7 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_matrix_inverse
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType inverseTranspose(genType const & m);
|
||||
|
||||
/// @}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<3, 3, T, P> affineInverse(mat<3, 3, T, P> const & m)
|
||||
{
|
||||
mat<2, 2, T, P> const Inv(inverse(mat<2, 2, T, P>(m)));
|
||||
@@ -14,7 +14,7 @@ namespace glm
|
||||
vec<3, T, P>(-Inv * vec<2, T, P>(m[2]), static_cast<T>(1)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> affineInverse(mat<4, 4, T, P> const & m)
|
||||
{
|
||||
mat<3, 3, T, P> const Inv(inverse(mat<3, 3, T, P>(m)));
|
||||
@@ -26,7 +26,7 @@ namespace glm
|
||||
vec<4, T, P>(-Inv * vec<3, T, P>(m[3]), static_cast<T>(1)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<2, 2, T, P> inverseTranspose(mat<2, 2, T, P> const & m)
|
||||
{
|
||||
T Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1];
|
||||
@@ -40,7 +40,7 @@ namespace glm
|
||||
return Inverse;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<3, 3, T, P> inverseTranspose(mat<3, 3, T, P> const & m)
|
||||
{
|
||||
T Determinant =
|
||||
@@ -63,7 +63,7 @@ namespace glm
|
||||
return Inverse;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> inverseTranspose(mat<4, 4, T, P> const & m)
|
||||
{
|
||||
T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace glm
|
||||
/// @see gtc_matrix_transform
|
||||
/// @see - translate(mat<4, 4, T, P> const & m, T x, T y, T z)
|
||||
/// @see - translate(vec<3, T, P> const & v)
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> translate(
|
||||
mat<4, 4, T, P> const& m,
|
||||
vec<3, T, P> const & v);
|
||||
@@ -68,7 +68,7 @@ namespace glm
|
||||
/// @see gtc_matrix_transform
|
||||
/// @see - rotate(mat<4, 4, T, P> const & m, T angle, T x, T y, T z)
|
||||
/// @see - rotate(T angle, vec<3, T, P> const & v)
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> rotate(
|
||||
mat<4, 4, T, P> const& m,
|
||||
T angle,
|
||||
@@ -82,7 +82,7 @@ namespace glm
|
||||
/// @see gtc_matrix_transform
|
||||
/// @see - scale(mat<4, 4, T, P> const & m, T x, T y, T z)
|
||||
/// @see - scale(vec<3, T, P> const & v)
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> scale(
|
||||
mat<4, 4, T, P> const& m,
|
||||
vec<3, T, P> const & v);
|
||||
@@ -98,7 +98,7 @@ namespace glm
|
||||
/// @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>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> ortho(
|
||||
T left,
|
||||
T right,
|
||||
@@ -118,7 +118,7 @@ namespace glm
|
||||
/// @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>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoLH(
|
||||
T left,
|
||||
T right,
|
||||
@@ -138,7 +138,7 @@ namespace glm
|
||||
/// @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>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> orthoRH(
|
||||
T left,
|
||||
T right,
|
||||
@@ -156,7 +156,7 @@ namespace glm
|
||||
/// @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>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> ortho(
|
||||
T left,
|
||||
T right,
|
||||
@@ -173,7 +173,7 @@ namespace glm
|
||||
/// @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>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> frustum(
|
||||
T left,
|
||||
T right,
|
||||
@@ -192,7 +192,7 @@ namespace glm
|
||||
/// @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>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumLH(
|
||||
T left,
|
||||
T right,
|
||||
@@ -211,7 +211,7 @@ namespace glm
|
||||
/// @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>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> frustumRH(
|
||||
T left,
|
||||
T right,
|
||||
@@ -228,7 +228,7 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspective(
|
||||
T fovy,
|
||||
T aspect,
|
||||
@@ -243,7 +243,7 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveRH(
|
||||
T fovy,
|
||||
T aspect,
|
||||
@@ -258,7 +258,7 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveLH(
|
||||
T fovy,
|
||||
T aspect,
|
||||
@@ -274,7 +274,7 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFov(
|
||||
T fov,
|
||||
T width,
|
||||
@@ -291,7 +291,7 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovRH(
|
||||
T fov,
|
||||
T width,
|
||||
@@ -308,7 +308,7 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> perspectiveFovLH(
|
||||
T fov,
|
||||
T width,
|
||||
@@ -323,7 +323,7 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspective(
|
||||
T fovy, T aspect, T near);
|
||||
|
||||
@@ -334,7 +334,7 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveLH(
|
||||
T fovy, T aspect, T near);
|
||||
|
||||
@@ -345,7 +345,7 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> infinitePerspectiveRH(
|
||||
T fovy, T aspect, T near);
|
||||
|
||||
@@ -356,7 +356,7 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective(
|
||||
T fovy, T aspect, T near);
|
||||
|
||||
@@ -368,7 +368,7 @@ namespace glm
|
||||
/// @param ep
|
||||
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommanded), float or double.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL mat<4, 4, T, defaultp> tweakedInfinitePerspective(
|
||||
T fovy, T aspect, T near, T ep);
|
||||
|
||||
@@ -382,7 +382,7 @@ namespace glm
|
||||
/// @tparam T Native type used for the computation. Currently supported: half (not recommanded), float or double.
|
||||
/// @tparam U Currently supported: Floating-point types and integer types.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T, typename U, precision P>
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_DECL vec<3, T, P> project(
|
||||
vec<3, T, P> const & obj,
|
||||
mat<4, 4, T, P> const& model,
|
||||
@@ -399,7 +399,7 @@ namespace glm
|
||||
/// @tparam T Native type used for the computation. Currently supported: half (not recommanded), float or double.
|
||||
/// @tparam U Currently supported: Floating-point types and integer types.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T, typename U, precision P>
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_DECL vec<3, T, P> unProject(
|
||||
vec<3, T, P> const & win,
|
||||
mat<4, 4, T, P> const& model,
|
||||
@@ -414,7 +414,7 @@ namespace glm
|
||||
/// @tparam T Native type used for the computation. Currently supported: half (not recommanded), float or double.
|
||||
/// @tparam U Currently supported: Floating-point types and integer types.
|
||||
/// @see gtc_matrix_transform
|
||||
template <typename T, precision P, typename U>
|
||||
template<typename T, precision P, typename U>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> pickMatrix(
|
||||
vec<2, T, P> const & center,
|
||||
vec<2, T, P> const & delta,
|
||||
@@ -427,7 +427,7 @@ namespace glm
|
||||
/// @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>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> lookAt(
|
||||
vec<3, T, P> const & eye,
|
||||
vec<3, T, P> const & center,
|
||||
@@ -440,7 +440,7 @@ namespace glm
|
||||
/// @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>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> lookAtRH(
|
||||
vec<3, T, P> const & eye,
|
||||
vec<3, T, P> const & center,
|
||||
@@ -453,7 +453,7 @@ namespace glm
|
||||
/// @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>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> lookAtLH(
|
||||
vec<3, T, P> const & eye,
|
||||
vec<3, T, P> const & center,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> translate(mat<4, 4, T, P> const & m, vec<3, T, P> const & v)
|
||||
{
|
||||
mat<4, 4, T, P> Result(m);
|
||||
@@ -15,7 +15,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> rotate(mat<4, 4, T, P> const & m, T angle, vec<3, T, P> const & v)
|
||||
{
|
||||
T const a = angle;
|
||||
@@ -46,7 +46,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> rotate_slow(mat<4, 4, T, P> const & m, T angle, vec<3, T, P> const & v)
|
||||
{
|
||||
T const a = angle;
|
||||
@@ -75,7 +75,7 @@ namespace glm
|
||||
return m * Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> scale(mat<4, 4, T, P> const & m, vec<3, T, P> const & v)
|
||||
{
|
||||
mat<4, 4, T, P> Result(uninitialize);
|
||||
@@ -86,7 +86,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> scale_slow(mat<4, 4, T, P> const & m, vec<3, T, P> const & v)
|
||||
{
|
||||
mat<4, 4, T, P> Result(T(1));
|
||||
@@ -96,7 +96,7 @@ namespace glm
|
||||
return m * Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> ortho
|
||||
(
|
||||
T left, T right,
|
||||
@@ -111,7 +111,7 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoLH
|
||||
(
|
||||
T left, T right,
|
||||
@@ -136,7 +136,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> orthoRH
|
||||
(
|
||||
T left, T right,
|
||||
@@ -161,7 +161,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> ortho
|
||||
(
|
||||
T left, T right,
|
||||
@@ -177,7 +177,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustum
|
||||
(
|
||||
T left, T right,
|
||||
@@ -192,7 +192,7 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumLH
|
||||
(
|
||||
T left, T right,
|
||||
@@ -218,7 +218,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> frustumRH
|
||||
(
|
||||
T left, T right,
|
||||
@@ -244,7 +244,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
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
|
||||
@@ -254,7 +254,7 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveRH(T fovy, T aspect, T zNear, T zFar)
|
||||
{
|
||||
assert(abs(aspect - std::numeric_limits<T>::epsilon()) > static_cast<T>(0));
|
||||
@@ -277,7 +277,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveLH(T fovy, T aspect, T zNear, T zFar)
|
||||
{
|
||||
assert(abs(aspect - std::numeric_limits<T>::epsilon()) > static_cast<T>(0));
|
||||
@@ -300,7 +300,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
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
|
||||
@@ -310,7 +310,7 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovRH(T fov, T width, T height, T zNear, T zFar)
|
||||
{
|
||||
assert(width > static_cast<T>(0));
|
||||
@@ -337,7 +337,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, defaultp> perspectiveFovLH(T fov, T width, T height, T zNear, T zFar)
|
||||
{
|
||||
assert(width > static_cast<T>(0));
|
||||
@@ -364,7 +364,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
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
|
||||
@@ -374,7 +374,7 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
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;
|
||||
@@ -392,7 +392,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
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;
|
||||
@@ -411,7 +411,7 @@ namespace glm
|
||||
}
|
||||
|
||||
// Infinite projection matrix: http://www.terathon.com/gdc07_lengyel.pdf
|
||||
template <typename T>
|
||||
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;
|
||||
@@ -429,13 +429,13 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
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>
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> project
|
||||
(
|
||||
vec<3, T, P> const & obj,
|
||||
@@ -461,7 +461,7 @@ namespace glm
|
||||
return vec<3, T, P>(tmp);
|
||||
}
|
||||
|
||||
template <typename T, typename U, precision P>
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> unProject
|
||||
(
|
||||
vec<3, T, P> const & win,
|
||||
@@ -488,7 +488,7 @@ namespace glm
|
||||
return vec<3, T, P>(obj);
|
||||
}
|
||||
|
||||
template <typename T, precision P, typename U>
|
||||
template<typename T, precision P, typename U>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> pickMatrix(vec<2, T, P> const & center, vec<2, T, P> const & delta, vec<4, U, P> const & viewport)
|
||||
{
|
||||
assert(delta.x > static_cast<T>(0) && delta.y > static_cast<T>(0));
|
||||
@@ -507,7 +507,7 @@ namespace glm
|
||||
return scale(Result, vec<3, T, P>(static_cast<T>(viewport[2]) / delta.x, static_cast<T>(viewport[3]) / delta.y, static_cast<T>(1)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> lookAt(vec<3, T, P> const & eye, vec<3, T, P> const & center, vec<3, T, P> const & up)
|
||||
{
|
||||
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
|
||||
@@ -517,7 +517,7 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> lookAtRH
|
||||
(
|
||||
vec<3, T, P> const & eye,
|
||||
@@ -545,7 +545,7 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> lookAtLH
|
||||
(
|
||||
vec<3, T, P> const & eye,
|
||||
|
||||
@@ -37,22 +37,22 @@ namespace glm
|
||||
|
||||
/// Classic perlin noise.
|
||||
/// @see gtc_noise
|
||||
template <int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T perlin(
|
||||
vecType<D, T, P> const & p);
|
||||
vecType<L, T, P> const& p);
|
||||
|
||||
/// Periodic perlin noise.
|
||||
/// @see gtc_noise
|
||||
template <int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T perlin(
|
||||
vecType<D, T, P> const & p,
|
||||
vecType<D, T, P> const & rep);
|
||||
vecType<L, T, P> const& p,
|
||||
vecType<L, T, P> const& rep);
|
||||
|
||||
/// Simplex noise.
|
||||
/// @see gtc_noise
|
||||
template <int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T simplex(
|
||||
vecType<D, T, P> const & p);
|
||||
vecType<L, T, P> const& p);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
namespace glm{
|
||||
namespace gtc
|
||||
{
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, T, P> grad4(T const & j, vec<4, T, P> const & ip)
|
||||
{
|
||||
vec<3, T, P> pXYZ = floor(fract(vec<3, T, P>(j) * vec<3, T, P>(ip)) * T(7)) * ip[2] - T(1);
|
||||
@@ -21,7 +21,7 @@ namespace gtc
|
||||
}//namespace gtc
|
||||
|
||||
// Classic Perlin noise
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T perlin(vec<2, T, P> const & Position)
|
||||
{
|
||||
vec<4, T, P> Pi = glm::floor(vec<4, T, P>(Position.x, Position.y, Position.x, Position.y)) + vec<4, T, P>(0.0, 0.0, 1.0, 1.0);
|
||||
@@ -62,7 +62,7 @@ namespace gtc
|
||||
}
|
||||
|
||||
// Classic Perlin noise
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T perlin(vec<3, T, P> const & Position)
|
||||
{
|
||||
vec<3, T, P> Pi0 = floor(Position); // Integer part for indexing
|
||||
@@ -133,7 +133,7 @@ namespace gtc
|
||||
}
|
||||
/*
|
||||
// Classic Perlin noise
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T perlin(vec<3, T, P> const & P)
|
||||
{
|
||||
vec<3, T, P> Pi0 = floor(P); // Integer part for indexing
|
||||
@@ -206,7 +206,7 @@ namespace gtc
|
||||
}
|
||||
*/
|
||||
// Classic Perlin noise
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T perlin(vec<4, T, P> const & Position)
|
||||
{
|
||||
vec<4, T, P> Pi0 = floor(Position); // Integer part for indexing
|
||||
@@ -342,7 +342,7 @@ namespace gtc
|
||||
}
|
||||
|
||||
// Classic Perlin noise, periodic variant
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T perlin(vec<2, T, P> const & Position, vec<2, T, P> const & rep)
|
||||
{
|
||||
vec<4, T, P> Pi = floor(vec<4, T, P>(Position.x, Position.y, Position.x, Position.y)) + vec<4, T, P>(0.0, 0.0, 1.0, 1.0);
|
||||
@@ -384,7 +384,7 @@ namespace gtc
|
||||
}
|
||||
|
||||
// Classic Perlin noise, periodic variant
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T perlin(vec<3, T, P> const & Position, vec<3, T, P> const & rep)
|
||||
{
|
||||
vec<3, T, P> Pi0 = mod(floor(Position), rep); // Integer part, modulo period
|
||||
@@ -455,7 +455,7 @@ namespace gtc
|
||||
}
|
||||
|
||||
// Classic Perlin noise, periodic version
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T perlin(vec<4, T, P> const & Position, vec<4, T, P> const & rep)
|
||||
{
|
||||
vec<4, T, P> Pi0 = mod(floor(Position), rep); // Integer part modulo rep
|
||||
@@ -588,7 +588,7 @@ namespace gtc
|
||||
return T(2.2) * n_xyzw;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T simplex(glm::vec<2, T, P> const & v)
|
||||
{
|
||||
vec<4, T, P> const C = vec<4, T, P>(
|
||||
@@ -645,7 +645,7 @@ namespace gtc
|
||||
return T(130) * dot(m, g);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T simplex(vec<3, T, P> const & v)
|
||||
{
|
||||
vec<2, T, P> const C(1.0 / 6.0, 1.0 / 3.0);
|
||||
@@ -720,7 +720,7 @@ namespace gtc
|
||||
return T(42) * dot(m * m, vec<4, T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T simplex(vec<4, T, P> const & v)
|
||||
{
|
||||
vec<4, T, P> const C(
|
||||
|
||||
@@ -477,7 +477,7 @@ namespace glm
|
||||
/// @see gtc_packing
|
||||
/// @see vec<3, T, P> unpackRGBM(vec<4, T, P> 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 <int D, typename T, precision P>
|
||||
template<length_t L, typename T, precision P>
|
||||
GLM_FUNC_DECL vec<4, T, P> packRGBM(vec<3, T, P> 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.
|
||||
@@ -487,7 +487,7 @@ namespace glm
|
||||
/// @see gtc_packing
|
||||
/// @see vec<4, T, P> packRGBM(vec<3, float, P> 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 <int D, typename T, precision P>
|
||||
template<length_t L, typename T, precision P>
|
||||
GLM_FUNC_DECL vec<3, T, P> unpackRGBM(vec<4, T, P> const & rgbm);
|
||||
|
||||
/// Returns an unsigned integer vector obtained by converting the components of a floating-point vector
|
||||
@@ -496,48 +496,48 @@ namespace glm
|
||||
/// the forth component specifies the 16 most-significant bits.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vecType<D, float, P> unpackHalf(vecType<D, uint16, P> const & p)
|
||||
/// @see vecType<L, float, P> unpackHalf(vecType<L, uint16, P> 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 <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, uint16, P> packHalf(vecType<D, float, P> const & v);
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, uint16, P> packHalf(vecType<L, float, P> 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<D, uint16, P> packHalf(vecType<D, float, P> const & v)
|
||||
/// @see vecType<L, uint16, P> packHalf(vecType<L, float, P> 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 <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, float, P> unpackHalf(vecType<D, uint16, P> const & p);
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, float, P> unpackHalf(vecType<L, uint16, P> const & p);
|
||||
|
||||
/// Convert each component of the normalized floating-point vector into unsigned integer values.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vecType<D, floatType, P> unpackUnorm(vecType<D, intType, P> const & p);
|
||||
template <int D, typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, uintType, P> packUnorm(vecType<D, floatType, P> const & v);
|
||||
/// @see vecType<L, floatType, P> unpackUnorm(vecType<L, intType, P> const & p);
|
||||
template<length_t L, typename uintType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, uintType, P> packUnorm(vecType<L, floatType, P> const & v);
|
||||
|
||||
/// Convert each unsigned integer components of a vector to normalized floating-point values.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vecType<D, intType, P> packUnorm(vecType<D, floatType, P> const & v)
|
||||
template <int D, typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, floatType, P> unpackUnorm(vecType<D, uintType, P> const & v);
|
||||
/// @see vecType<L, intType, P> packUnorm(vecType<L, floatType, P> const & v)
|
||||
template<length_t L, typename uintType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, floatType, P> unpackUnorm(vecType<L, uintType, P> const & v);
|
||||
|
||||
/// Convert each component of the normalized floating-point vector into signed integer values.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vecType<D, floatType, P> unpackSnorm(vecType<D, intType, P> const & p);
|
||||
template <int D, typename intType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, intType, P> packSnorm(vecType<D, floatType, P> const & v);
|
||||
/// @see vecType<L, floatType, P> unpackSnorm(vecType<L, intType, P> const & p);
|
||||
template<length_t L, typename intType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, intType, P> packSnorm(vecType<L, floatType, P> const & v);
|
||||
|
||||
/// Convert each signed integer components of a vector to normalized floating-point values.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vecType<D, intType, P> packSnorm(vecType<D, floatType, P> const & v)
|
||||
template <int D, typename intType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, floatType, P> unpackSnorm(vecType<D, intType, P> const & v);
|
||||
/// @see vecType<L, intType, P> packSnorm(vecType<L, floatType, P> const & v)
|
||||
template<length_t L, typename intType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, floatType, P> unpackSnorm(vecType<L, intType, P> const & v);
|
||||
|
||||
/// Convert each component of the normalized floating-point vector into unsigned integer values.
|
||||
///
|
||||
|
||||
@@ -270,11 +270,11 @@ namespace detail
|
||||
uint32 pack;
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_half
|
||||
{};
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_half<1, P, vec>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<1, uint16, P> pack(vec<1, float, P> const & v)
|
||||
@@ -293,7 +293,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_half<2, P, vec>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<2, uint16, P> pack(vec<2, float, P> const & v)
|
||||
@@ -312,7 +312,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_half<3, P, vec>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<3, uint16, P> pack(vec<3, float, P> const & v)
|
||||
@@ -331,7 +331,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_half<4, P, vec>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<4, uint16, P> pack(vec<4, float, P> const & v)
|
||||
@@ -640,7 +640,7 @@ namespace detail
|
||||
}
|
||||
|
||||
// Based on Brian Karis http://graphicrants.blogspot.fr/2009/04/rgbm-color-encoding.html
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, T, P> packRGBM(vec<3, T, P> const & rgb)
|
||||
{
|
||||
vec<3, T, P> const Color(rgb * static_cast<T>(1.0 / 6.0));
|
||||
@@ -649,58 +649,58 @@ namespace detail
|
||||
return vec<4, T, P>(Color / Alpha, Alpha);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> unpackRGBM(vec<4, T, P> const & rgbm)
|
||||
{
|
||||
return vec<3, T, P>(rgbm.x, rgbm.y, rgbm.z) * rgbm.w * static_cast<T>(6);
|
||||
}
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, uint16, P> packHalf(vecType<D, float, P> const & v)
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, uint16, P> packHalf(vecType<L, float, P> const & v)
|
||||
{
|
||||
return detail::compute_half<D, P, vecType>::pack(v);
|
||||
return detail::compute_half<L, P, vecType>::pack(v);
|
||||
}
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, float, P> unpackHalf(vecType<D, uint16, P> const & v)
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, float, P> unpackHalf(vecType<L, uint16, P> const & v)
|
||||
{
|
||||
return detail::compute_half<D, P, vecType>::unpack(v);
|
||||
return detail::compute_half<L, P, vecType>::unpack(v);
|
||||
}
|
||||
|
||||
template <int D, typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, uintType, P> packUnorm(vecType<D, floatType, P> const & v)
|
||||
template<length_t L, typename uintType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, uintType, P> packUnorm(vecType<L, floatType, P> 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<D, uintType, P>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max())));
|
||||
return vecType<L, uintType, P>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max())));
|
||||
}
|
||||
|
||||
template <int D, typename uintType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, floatType, P> unpackUnorm(vecType<D, uintType, P> const & v)
|
||||
template<length_t L, typename uintType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, floatType, P> unpackUnorm(vecType<L, uintType, P> 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<D, float, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max()));
|
||||
return vecType<L, float, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max()));
|
||||
}
|
||||
|
||||
template <int D, typename intType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, intType, P> packSnorm(vecType<D, floatType, P> const & v)
|
||||
template<length_t L, typename intType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, intType, P> packSnorm(vecType<L, floatType, P> 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<D, intType, P>(round(clamp(v , static_cast<floatType>(-1), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<intType>::max())));
|
||||
return vecType<L, intType, P>(round(clamp(v , static_cast<floatType>(-1), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<intType>::max())));
|
||||
}
|
||||
|
||||
template <int D, typename intType, typename floatType, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, floatType, P> unpackSnorm(vecType<D, intType, P> const & v)
|
||||
template<length_t L, typename intType, typename floatType, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, floatType, P> unpackSnorm(vecType<L, intType, P> 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<D, 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(vecType<L, floatType, P>(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)
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace glm
|
||||
/// @addtogroup gtc_quaternion
|
||||
/// @{
|
||||
|
||||
template <typename T, precision P = defaultp>
|
||||
template<typename T, precision P = defaultp>
|
||||
struct tquat
|
||||
{
|
||||
// -- Implementation detail --
|
||||
@@ -79,7 +79,7 @@ namespace glm
|
||||
|
||||
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>
|
||||
template<precision Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, Q> const & q);
|
||||
|
||||
// -- Explicit basic constructors --
|
||||
@@ -90,7 +90,7 @@ namespace glm
|
||||
|
||||
// -- Conversion constructors --
|
||||
|
||||
template <typename U, precision Q>
|
||||
template<typename U, precision Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT tquat(tquat<U, Q> const & q);
|
||||
|
||||
/// Explicit conversion operators
|
||||
@@ -116,81 +116,81 @@ namespace glm
|
||||
|
||||
GLM_FUNC_DECL tquat<T, P> & operator=(tquat<T, P> const & m) GLM_DEFAULT;
|
||||
|
||||
template <typename U>
|
||||
template<typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator=(tquat<U, P> const & m);
|
||||
template <typename U>
|
||||
template<typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator+=(tquat<U, P> const & q);
|
||||
template <typename U>
|
||||
template<typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator-=(tquat<U, P> const & q);
|
||||
template <typename U>
|
||||
template<typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator*=(tquat<U, P> const & q);
|
||||
template <typename U>
|
||||
template<typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator*=(U s);
|
||||
template <typename U>
|
||||
template<typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator/=(U s);
|
||||
};
|
||||
|
||||
// -- Unary bit operators --
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator+(tquat<T, P> const & q);
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator-(tquat<T, P> const & q);
|
||||
|
||||
// -- Binary operators --
|
||||
|
||||
template <typename T, precision 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, precision 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, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<3, T, P> operator*(tquat<T, P> const & q, vec<3, T, P> const & v);
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<3, T, P> operator*(vec<3, T, P> const & v, tquat<T, P> const & q);
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<4, T, P> operator*(tquat<T, P> const & q, vec<4, T, P> const & v);
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<4, T, P> operator*(vec<4, T, P> const & v, tquat<T, P> const & q);
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator*(tquat<T, P> const & q, T const & s);
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator*(T const & s, tquat<T, P> const & q);
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator/(tquat<T, P> const & q, T const & s);
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL bool operator==(tquat<T, P> const & q1, tquat<T, P> const & q2);
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL bool operator!=(tquat<T, P> const & q1, tquat<T, P> const & q2);
|
||||
|
||||
/// Returns the length of the quaternion.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL T length(tquat<T, P> const & q);
|
||||
|
||||
/// Returns the normalized quaternion.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> normalize(tquat<T, P> const & q);
|
||||
|
||||
/// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ...
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL T dot(tquat<T, P> const & x, tquat<T, P> const & y);
|
||||
|
||||
/// Spherical linear interpolation of two quaternions.
|
||||
@@ -203,7 +203,7 @@ namespace glm
|
||||
/// @tparam T Value type used to build the quaternion. Supported: half, float or double.
|
||||
/// @see gtc_quaternion
|
||||
/// @see - slerp(tquat<T, P> const & x, tquat<T, P> const & y, T const & a)
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> mix(tquat<T, P> const & x, tquat<T, P> const & y, T a);
|
||||
|
||||
/// Linear interpolation of two quaternions.
|
||||
@@ -214,7 +214,7 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> lerp(tquat<T, P> const & x, tquat<T, P> const & y, T a);
|
||||
|
||||
/// Spherical linear interpolation of two quaternions.
|
||||
@@ -225,19 +225,19 @@ namespace glm
|
||||
/// @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.
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> slerp(tquat<T, P> const & x, tquat<T, P> const & y, T a);
|
||||
|
||||
/// Returns the q conjugate.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> conjugate(tquat<T, P> const & q);
|
||||
|
||||
/// Returns the q inverse.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> inverse(tquat<T, P> const & q);
|
||||
|
||||
/// Rotates a quaternion from a vector of 3 components axis and an angle.
|
||||
@@ -247,68 +247,68 @@ namespace glm
|
||||
/// @param axis Axis of the rotation
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> rotate(tquat<T, P> const & q, T const & angle, vec<3, T, P> 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.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<3, T, P> eulerAngles(tquat<T, P> const & x);
|
||||
|
||||
/// Returns roll value of euler angles expressed in radians.
|
||||
///
|
||||
/// @see gtx_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL T roll(tquat<T, P> const & x);
|
||||
|
||||
/// Returns pitch value of euler angles expressed in radians.
|
||||
///
|
||||
/// @see gtx_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL T pitch(tquat<T, P> const & x);
|
||||
|
||||
/// Returns yaw value of euler angles expressed in radians.
|
||||
///
|
||||
/// @see gtx_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL T yaw(tquat<T, P> const & x);
|
||||
|
||||
/// Converts a quaternion to a 3 * 3 matrix.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL mat<3, 3, T, P> mat3_cast(tquat<T, P> const & x);
|
||||
|
||||
/// Converts a quaternion to a 4 * 4 matrix.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> mat4_cast(tquat<T, P> const & x);
|
||||
|
||||
/// Converts a 3 * 3 matrix to a quaternion.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> quat_cast(mat<3, 3, T, P> const & x);
|
||||
|
||||
/// Converts a 4 * 4 matrix to a quaternion.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> quat_cast(mat<4, 4, T, P> const & x);
|
||||
|
||||
/// Returns the quaternion rotation angle.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL T angle(tquat<T, P> const & x);
|
||||
|
||||
/// Returns the q rotation axis.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<3, T, P> axis(tquat<T, P> const & x);
|
||||
|
||||
/// Build a quaternion from an angle and a normalized axis.
|
||||
@@ -317,7 +317,7 @@ namespace glm
|
||||
/// @param axis Axis of the quaternion, must be normalized.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL tquat<T, P> angleAxis(T const & angle, vec<3, T, P> const & axis);
|
||||
|
||||
/// Returns the component-wise comparison result of x < y.
|
||||
@@ -325,7 +325,7 @@ namespace glm
|
||||
/// @tparam quatType Floating-point quaternion types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> lessThan(tquat<T, P> const & x, tquat<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x <= y.
|
||||
@@ -333,7 +333,7 @@ namespace glm
|
||||
/// @tparam quatType Floating-point quaternion types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> lessThanEqual(tquat<T, P> const & x, tquat<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x > y.
|
||||
@@ -341,7 +341,7 @@ namespace glm
|
||||
/// @tparam quatType Floating-point quaternion types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> greaterThan(tquat<T, P> const & x, tquat<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x >= y.
|
||||
@@ -349,7 +349,7 @@ namespace glm
|
||||
/// @tparam quatType Floating-point quaternion types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> greaterThanEqual(tquat<T, P> const & x, tquat<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x == y.
|
||||
@@ -357,7 +357,7 @@ namespace glm
|
||||
/// @tparam quatType Floating-point quaternion types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> equal(tquat<T, P> const & x, tquat<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x != y.
|
||||
@@ -365,7 +365,7 @@ namespace glm
|
||||
/// @tparam quatType Floating-point quaternion types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> notEqual(tquat<T, P> const & x, tquat<T, P> const & y);
|
||||
|
||||
/// Returns true if x holds a NaN (not a number)
|
||||
@@ -377,7 +377,7 @@ namespace glm
|
||||
/// /!\ When using compiler fast math, this function may fail.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> isnan(tquat<T, P> const & x);
|
||||
|
||||
/// Returns true if x holds a positive infinity or negative
|
||||
@@ -387,7 +387,7 @@ namespace glm
|
||||
/// representations.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> isinf(tquat<T, P> const & x);
|
||||
|
||||
/// @}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P, bool Aligned>
|
||||
template<typename T, precision P, bool Aligned>
|
||||
struct compute_dot<tquat<T, P>, T, Aligned>
|
||||
{
|
||||
static GLM_FUNC_QUALIFIER T call(tquat<T, P> const& a, tquat<T, P> const& b)
|
||||
@@ -19,7 +19,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, bool Aligned>
|
||||
template<typename T, precision P, bool Aligned>
|
||||
struct compute_quat_add
|
||||
{
|
||||
static tquat<T, P> call(tquat<T, P> const& q, tquat<T, P> const& p)
|
||||
@@ -28,7 +28,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, bool Aligned>
|
||||
template<typename T, precision P, bool Aligned>
|
||||
struct compute_quat_sub
|
||||
{
|
||||
static tquat<T, P> call(tquat<T, P> const& q, tquat<T, P> const& p)
|
||||
@@ -37,7 +37,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, bool Aligned>
|
||||
template<typename T, precision P, bool Aligned>
|
||||
struct compute_quat_mul_scalar
|
||||
{
|
||||
static tquat<T, P> call(tquat<T, P> const& q, T s)
|
||||
@@ -46,7 +46,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, bool Aligned>
|
||||
template<typename T, precision P, bool Aligned>
|
||||
struct compute_quat_div_scalar
|
||||
{
|
||||
static tquat<T, P> call(tquat<T, P> const& q, T s)
|
||||
@@ -55,7 +55,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, bool Aligned>
|
||||
template<typename T, precision P, bool Aligned>
|
||||
struct compute_quat_mul_vec4
|
||||
{
|
||||
static vec<4, T, P> call(tquat<T, P> const & q, vec<4, T, P> const & v)
|
||||
@@ -67,14 +67,14 @@ namespace detail
|
||||
|
||||
// -- Component accesses --
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[](typename tquat<T, P>::length_type i)
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T const & tquat<T, P>::operator[](typename tquat<T, P>::length_type i) const
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
@@ -84,7 +84,7 @@ namespace detail
|
||||
// -- Implicit basic constructors --
|
||||
|
||||
# if !GLM_HAS_DEFAULTED_FUNCTIONS || !defined(GLM_FORCE_NO_CTOR_INIT)
|
||||
template <typename T, precision P>
|
||||
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)
|
||||
@@ -93,38 +93,38 @@ namespace detail
|
||||
# endif
|
||||
|
||||
# if !GLM_HAS_DEFAULTED_FUNCTIONS
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(tquat<T, P> 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>
|
||||
template<typename T, precision P>
|
||||
template<precision Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(tquat<T, Q> const & q)
|
||||
: x(q.x), y(q.y), z(q.z), w(q.w)
|
||||
{}
|
||||
|
||||
// -- Explicit basic constructors --
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR tquat<T, P>::tquat(ctor)
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(T const & s, vec<3, T, P> const & v)
|
||||
: x(v.x), y(v.y), z(v.z), w(s)
|
||||
{}
|
||||
|
||||
template <typename T, precision P>
|
||||
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)
|
||||
{}
|
||||
|
||||
// -- Conversion constructors --
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U, precision Q>
|
||||
template<typename T, precision P>
|
||||
template<typename U, precision Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(tquat<U, Q> const & q)
|
||||
: x(static_cast<T>(q.x))
|
||||
, y(static_cast<T>(q.y))
|
||||
@@ -132,7 +132,7 @@ namespace detail
|
||||
, w(static_cast<T>(q.w))
|
||||
{}
|
||||
|
||||
//template <typename valType>
|
||||
//template<typename valType>
|
||||
//GLM_FUNC_QUALIFIER tquat<valType>::tquat
|
||||
//(
|
||||
// valType const & pitch,
|
||||
@@ -150,7 +150,7 @@ namespace detail
|
||||
// this->z = c.x * c.y * s.z - s.x * s.y * c.z;
|
||||
//}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(vec<3, T, P> const & u, vec<3, T, P> const & v)
|
||||
{
|
||||
vec<3, T, P> const LocalW(cross(u, v));
|
||||
@@ -160,7 +160,7 @@ namespace detail
|
||||
*this = normalize(q);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(vec<3, T, P> const & eulerAngle)
|
||||
{
|
||||
vec<3, T, P> c = glm::cos(eulerAngle * T(0.5));
|
||||
@@ -172,39 +172,39 @@ namespace detail
|
||||
this->z = c.x * c.y * s.z - s.x * s.y * c.z;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(mat<3, 3, T, P> const & m)
|
||||
{
|
||||
*this = quat_cast(m);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(mat<4, 4, T, P> const & m)
|
||||
{
|
||||
*this = quat_cast(m);
|
||||
}
|
||||
|
||||
# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::operator mat<3, 3, T, P>()
|
||||
{
|
||||
return mat3_cast(*this);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::operator mat<4, 4, T, P>()
|
||||
{
|
||||
return mat4_cast(*this);
|
||||
}
|
||||
# endif//GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> conjugate(tquat<T, P> const & q)
|
||||
{
|
||||
return tquat<T, P>(q.w, -q.x, -q.y, -q.z);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> inverse(tquat<T, P> const & q)
|
||||
{
|
||||
return conjugate(q) / dot(q, q);
|
||||
@@ -213,7 +213,7 @@ namespace detail
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
# if !GLM_HAS_DEFAULTED_FUNCTIONS
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator=(tquat<T, P> const & q)
|
||||
{
|
||||
this->w = q.w;
|
||||
@@ -224,8 +224,8 @@ namespace detail
|
||||
}
|
||||
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
template<typename T, precision P>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator=(tquat<U, P> const & q)
|
||||
{
|
||||
this->w = static_cast<T>(q.w);
|
||||
@@ -235,22 +235,22 @@ namespace detail
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
template<typename T, precision P>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator+=(tquat<U, P> const& q)
|
||||
{
|
||||
return (*this = detail::compute_quat_add<T, P, detail::is_aligned<P>::value>::call(*this, tquat<T, P>(q)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
template<typename T, precision P>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator-=(tquat<U, P> const& q)
|
||||
{
|
||||
return (*this = detail::compute_quat_sub<T, P, detail::is_aligned<P>::value>::call(*this, tquat<T, P>(q)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
template<typename T, precision P>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator*=(tquat<U, P> const & r)
|
||||
{
|
||||
tquat<T, P> const p(*this);
|
||||
@@ -263,15 +263,15 @@ namespace detail
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
template<typename T, precision P>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator*=(U s)
|
||||
{
|
||||
return (*this = detail::compute_quat_mul_scalar<T, P, detail::is_aligned<P>::value>::call(*this, static_cast<U>(s)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template <typename U>
|
||||
template<typename T, precision P>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator/=(U s)
|
||||
{
|
||||
return (*this = detail::compute_quat_div_scalar<T, P, detail::is_aligned<P>::value>::call(*this, static_cast<U>(s)));
|
||||
@@ -279,13 +279,13 @@ namespace detail
|
||||
|
||||
// -- Unary bit operators --
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator+(tquat<T, P> const & q)
|
||||
{
|
||||
return q;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator-(tquat<T, P> const & q)
|
||||
{
|
||||
return tquat<T, P>(-q.w, -q.x, -q.y, -q.z);
|
||||
@@ -293,19 +293,19 @@ namespace detail
|
||||
|
||||
// -- Binary operators --
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator+(tquat<T, P> const & q, tquat<T, P> const & p)
|
||||
{
|
||||
return tquat<T, P>(q) += p;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator*(tquat<T, P> const & q, tquat<T, P> const & p)
|
||||
{
|
||||
return tquat<T, P>(q) *= p;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> operator*(tquat<T, P> const & q, vec<3, T, P> const & v)
|
||||
{
|
||||
vec<3, T, P> const QuatVector(q.x, q.y, q.z);
|
||||
@@ -315,38 +315,38 @@ namespace detail
|
||||
return v + ((uv * q.w) + uuv) * static_cast<T>(2);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> operator*(vec<3, T, P> const & v, tquat<T, P> const & q)
|
||||
{
|
||||
return glm::inverse(q) * v;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, T, P> operator*(tquat<T, P> const& q, vec<4, T, P> const& v)
|
||||
{
|
||||
return detail::compute_quat_mul_vec4<T, P, detail::is_aligned<P>::value>::call(q, v);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, T, P> operator*(vec<4, T, P> const & v, tquat<T, P> const & q)
|
||||
{
|
||||
return glm::inverse(q) * v;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator*(tquat<T, P> const & q, T const & s)
|
||||
{
|
||||
return tquat<T, P>(
|
||||
q.w * s, q.x * s, q.y * s, q.z * s);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator*(T const & s, tquat<T, P> const & q)
|
||||
{
|
||||
return q * s;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator/(tquat<T, P> const & q, T const & s)
|
||||
{
|
||||
return tquat<T, P>(
|
||||
@@ -355,13 +355,13 @@ namespace detail
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator==(tquat<T, P> const & q1, tquat<T, P> const & q2)
|
||||
{
|
||||
return (q1.x == q2.x) && (q1.y == q2.y) && (q1.z == q2.z) && (q1.w == q2.w);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER bool operator!=(tquat<T, P> const & q1, tquat<T, P> const & q2)
|
||||
{
|
||||
return (q1.x != q2.x) || (q1.y != q2.y) || (q1.z != q2.z) || (q1.w != q2.w);
|
||||
@@ -369,13 +369,13 @@ namespace detail
|
||||
|
||||
// -- Operations --
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T length(tquat<T, P> const & q)
|
||||
{
|
||||
return glm::sqrt(dot(q, q));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> normalize(tquat<T, P> const & q)
|
||||
{
|
||||
T len = length(q);
|
||||
@@ -385,7 +385,7 @@ namespace detail
|
||||
return tquat<T, P>(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> cross(tquat<T, P> const & q1, tquat<T, P> const & q2)
|
||||
{
|
||||
return tquat<T, P>(
|
||||
@@ -396,7 +396,7 @@ namespace detail
|
||||
}
|
||||
/*
|
||||
// (x * sin(1 - a) * angle / sin(angle)) + (y * sin(a) * angle / sin(angle))
|
||||
template <typename T, precision P>
|
||||
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)
|
||||
{
|
||||
if(a <= T(0)) return x;
|
||||
@@ -433,7 +433,7 @@ namespace detail
|
||||
k0 * x.z + k1 * y2.z);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> mix2
|
||||
(
|
||||
tquat<T, P> const & x,
|
||||
@@ -471,7 +471,7 @@ namespace detail
|
||||
}
|
||||
*/
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> mix(tquat<T, P> const & x, tquat<T, P> const & y, T a)
|
||||
{
|
||||
T cosTheta = dot(x, y);
|
||||
@@ -494,7 +494,7 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> lerp(tquat<T, P> const & x, tquat<T, P> const & y, T a)
|
||||
{
|
||||
// Lerp is only defined in [0, 1]
|
||||
@@ -504,7 +504,7 @@ namespace detail
|
||||
return x * (T(1) - a) + (y * a);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> slerp(tquat<T, P> const & x, tquat<T, P> const & y, T a)
|
||||
{
|
||||
tquat<T, P> z = y;
|
||||
@@ -537,7 +537,7 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> rotate(tquat<T, P> const & q, T const & angle, vec<3, T, P> const & v)
|
||||
{
|
||||
vec<3, T, P> Tmp = v;
|
||||
@@ -559,31 +559,31 @@ namespace detail
|
||||
//return gtc::quaternion::cross(q, tquat<T, P>(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> eulerAngles(tquat<T, P> const & x)
|
||||
{
|
||||
return vec<3, T, P>(pitch(x), yaw(x), roll(x));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T roll(tquat<T, P> 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));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T pitch(tquat<T, P> 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));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T yaw(tquat<T, P> const & q)
|
||||
{
|
||||
return asin(clamp(T(-2) * (q.x * q.z - q.w * q.y), T(-1), T(1)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<3, 3, T, P> mat3_cast(tquat<T, P> const & q)
|
||||
{
|
||||
mat<3, 3, T, P> Result(T(1));
|
||||
@@ -611,13 +611,13 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> mat4_cast(tquat<T, P> const & q)
|
||||
{
|
||||
return mat<4, 4, T, P>(mat3_cast(q));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> quat_cast(mat<3, 3, T, P> const & m)
|
||||
{
|
||||
T fourXSquaredMinus1 = m[0][0] - m[1][1] - m[2][2];
|
||||
@@ -681,19 +681,19 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> quat_cast(mat<4, 4, T, P> const & m4)
|
||||
{
|
||||
return quat_cast(mat<3, 3, T, P>(m4));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T angle(tquat<T, P> const & x)
|
||||
{
|
||||
return acos(x.w) * T(2);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> axis(tquat<T, P> const & x)
|
||||
{
|
||||
T tmp1 = static_cast<T>(1) - x.w * x.w;
|
||||
@@ -703,7 +703,7 @@ namespace detail
|
||||
return vec<3, T, P>(x.x * tmp2, x.y * tmp2, x.z * tmp2);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> angleAxis(T const & angle, vec<3, T, P> const & v)
|
||||
{
|
||||
tquat<T, P> Result(uninitialize);
|
||||
@@ -718,7 +718,7 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> lessThan(tquat<T, P> const & x, tquat<T, P> const & y)
|
||||
{
|
||||
vec<4, bool, P> Result(uninitialize);
|
||||
@@ -727,7 +727,7 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> lessThanEqual(tquat<T, P> const & x, tquat<T, P> const & y)
|
||||
{
|
||||
vec<4, bool, P> Result(uninitialize);
|
||||
@@ -736,7 +736,7 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> greaterThan(tquat<T, P> const & x, tquat<T, P> const & y)
|
||||
{
|
||||
vec<4, bool, P> Result(uninitialize);
|
||||
@@ -745,7 +745,7 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> greaterThanEqual(tquat<T, P> const & x, tquat<T, P> const & y)
|
||||
{
|
||||
vec<4, bool, P> Result(uninitialize);
|
||||
@@ -754,7 +754,7 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> equal(tquat<T, P> const & x, tquat<T, P> const & y)
|
||||
{
|
||||
vec<4, bool, P> Result(uninitialize);
|
||||
@@ -763,7 +763,7 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> notEqual(tquat<T, P> const & x, tquat<T, P> const & y)
|
||||
{
|
||||
vec<4, bool, P> Result(uninitialize);
|
||||
@@ -772,7 +772,7 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> isnan(tquat<T, P> const& q)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
|
||||
@@ -780,7 +780,7 @@ namespace detail
|
||||
return vec<4, bool, P>(isnan(q.x), isnan(q.y), isnan(q.z), isnan(q.w));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
template<typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> isinf(tquat<T, P> const& q)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isinf' only accept floating-point inputs");
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
/*
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_quat_mul<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q1, tquat<float, P> const& q2)
|
||||
@@ -61,7 +61,7 @@ namespace detail
|
||||
};
|
||||
*/
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_dot<tquat<float, P>, float, true>
|
||||
{
|
||||
static GLM_FUNC_QUALIFIER float call(tquat<float, P> const& x, tquat<float, P> const& y)
|
||||
@@ -70,7 +70,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_quat_add<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q, tquat<float, P> const& p)
|
||||
@@ -82,7 +82,7 @@ namespace detail
|
||||
};
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_quat_add<double, P, true>
|
||||
{
|
||||
static tquat<double, P> call(tquat<double, P> const & a, tquat<double, P> const & b)
|
||||
@@ -94,7 +94,7 @@ namespace detail
|
||||
};
|
||||
# endif
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_quat_sub<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q, tquat<float, P> const& p)
|
||||
@@ -106,7 +106,7 @@ namespace detail
|
||||
};
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_quat_sub<double, P, true>
|
||||
{
|
||||
static tquat<double, P> call(tquat<double, P> const & a, tquat<double, P> const & b)
|
||||
@@ -118,7 +118,7 @@ namespace detail
|
||||
};
|
||||
# endif
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_quat_mul_scalar<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q, float s)
|
||||
@@ -130,7 +130,7 @@ namespace detail
|
||||
};
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_quat_mul_scalar<double, P, true>
|
||||
{
|
||||
static tquat<double, P> call(tquat<double, P> const& q, double s)
|
||||
@@ -142,7 +142,7 @@ namespace detail
|
||||
};
|
||||
# endif
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_quat_div_scalar<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q, float s)
|
||||
@@ -154,7 +154,7 @@ namespace detail
|
||||
};
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_quat_div_scalar<double, P, true>
|
||||
{
|
||||
static tquat<double, P> call(tquat<double, P> const& q, double s)
|
||||
@@ -166,7 +166,7 @@ namespace detail
|
||||
};
|
||||
# endif
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_quat_mul_vec4<float, P, true>
|
||||
{
|
||||
static vec<4, float, P> call(tquat<float, P> const& q, vec<4, float, P> const& v)
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace glm
|
||||
/// @param Max
|
||||
/// @tparam genType Value type. Currently supported: float or double scalars.
|
||||
/// @see gtc_random
|
||||
template <typename genTYpe>
|
||||
template<typename genTYpe>
|
||||
GLM_FUNC_DECL genTYpe linearRand(
|
||||
genTYpe Min,
|
||||
genTYpe Max);
|
||||
@@ -44,17 +44,17 @@ namespace glm
|
||||
/// @tparam T Value type. Currently supported: float or double.
|
||||
/// @tparam vecType A vertor type: tvec1, tvec2, tvec3, tvec4 or compatible
|
||||
/// @see gtc_random
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> linearRand(
|
||||
vecType<D, T, P> const & Min,
|
||||
vecType<D, T, P> const & Max);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> linearRand(
|
||||
vecType<L, T, P> const& Min,
|
||||
vecType<L, T, P> const& Max);
|
||||
|
||||
/// Generate random numbers in the interval [Min, Max], according a gaussian distribution
|
||||
///
|
||||
/// @param Mean
|
||||
/// @param Deviation
|
||||
/// @see gtc_random
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType gaussRand(
|
||||
genType Mean,
|
||||
genType Deviation);
|
||||
@@ -63,7 +63,7 @@ namespace glm
|
||||
///
|
||||
/// @param Radius
|
||||
/// @see gtc_random
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL vec<2, T, defaultp> circularRand(
|
||||
T Radius);
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace glm
|
||||
///
|
||||
/// @param Radius
|
||||
/// @see gtc_random
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL vec<3, T, defaultp> sphericalRand(
|
||||
T Radius);
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace glm
|
||||
///
|
||||
/// @param Radius
|
||||
/// @see gtc_random
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL vec<2, T, defaultp> diskRand(
|
||||
T Radius);
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace glm
|
||||
///
|
||||
/// @param Radius
|
||||
/// @see gtc_random
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_DECL vec<3, T, defaultp> ballRand(
|
||||
T Radius);
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, class, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<int, class, precision> class vecType>
|
||||
struct compute_rand
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call();
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call();
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_rand<1, uint8, P, vec>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<1, uint8, P> call()
|
||||
@@ -26,7 +26,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_rand<2, uint8, P, vec>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<2, uint8, P> call()
|
||||
@@ -37,7 +37,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_rand<3, uint8, P, vec>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<3, uint8, P> call()
|
||||
@@ -49,7 +49,7 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
template<precision P>
|
||||
struct compute_rand<4, uint8, P, vec>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<4, uint8, P> call()
|
||||
@@ -62,200 +62,200 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_rand<D, uint16, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_rand<L, uint16, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint16, P> call()
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint16, P> call()
|
||||
{
|
||||
return
|
||||
(vecType<D, uint16, P>(compute_rand<D, uint8, P, vecType>::call()) << static_cast<uint16>(8)) |
|
||||
(vecType<D, uint16, P>(compute_rand<D, uint8, P, vecType>::call()) << static_cast<uint16>(0));
|
||||
(vecType<L, uint16, P>(compute_rand<L, uint8, P, vecType>::call()) << static_cast<uint16>(8)) |
|
||||
(vecType<L, uint16, P>(compute_rand<L, uint8, P, vecType>::call()) << static_cast<uint16>(0));
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_rand<D, uint32, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_rand<L, uint32, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint32, P> call()
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint32, P> call()
|
||||
{
|
||||
return
|
||||
(vecType<D, uint32, P>(compute_rand<D, uint16, P, vecType>::call()) << static_cast<uint32>(16)) |
|
||||
(vecType<D, uint32, P>(compute_rand<D, uint16, P, vecType>::call()) << static_cast<uint32>(0));
|
||||
(vecType<L, uint32, P>(compute_rand<L, uint16, P, vecType>::call()) << static_cast<uint32>(16)) |
|
||||
(vecType<L, uint32, P>(compute_rand<L, uint16, P, vecType>::call()) << static_cast<uint32>(0));
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_rand<D, uint64, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_rand<L, uint64, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint64, P> call()
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint64, P> call()
|
||||
{
|
||||
return
|
||||
(vecType<D, uint64, P>(compute_rand<D, uint32, P, vecType>::call()) << static_cast<uint64>(32)) |
|
||||
(vecType<D, uint64, P>(compute_rand<D, uint32, P, vecType>::call()) << static_cast<uint64>(0));
|
||||
(vecType<L, uint64, P>(compute_rand<L, uint32, P, vecType>::call()) << static_cast<uint64>(32)) |
|
||||
(vecType<L, uint64, P>(compute_rand<L, uint32, P, vecType>::call()) << static_cast<uint64>(0));
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & Min, vecType<D, T, P> const & Max);
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & Min, vecType<L, T, P> const & Max);
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, int8, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, int8, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, int8, P> call(vecType<D, int8, P> const & Min, vecType<D, int8, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, int8, P> call(vecType<L, int8, P> const & Min, vecType<L, int8, P> const & Max)
|
||||
{
|
||||
return (vecType<D, int8, P>(compute_rand<D, uint8, P, vecType>::call() % vecType<D, uint8, P>(Max + static_cast<int8>(1) - Min))) + Min;
|
||||
return (vecType<L, int8, P>(compute_rand<L, uint8, P, vecType>::call() % vecType<L, uint8, P>(Max + static_cast<int8>(1) - Min))) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, uint8, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, uint8, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint8, P> call(vecType<D, uint8, P> const & Min, vecType<D, uint8, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint8, P> call(vecType<L, uint8, P> const & Min, vecType<L, uint8, P> const & Max)
|
||||
{
|
||||
return (compute_rand<D, uint8, P, vecType>::call() % (Max + static_cast<uint8>(1) - Min)) + Min;
|
||||
return (compute_rand<L, uint8, P, vecType>::call() % (Max + static_cast<uint8>(1) - Min)) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, int16, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, int16, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, int16, P> call(vecType<D, int16, P> const & Min, vecType<D, int16, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, int16, P> call(vecType<L, int16, P> const & Min, vecType<L, int16, P> const & Max)
|
||||
{
|
||||
return (vecType<D, int16, P>(compute_rand<D, uint16, P, vecType>::call() % vecType<D, uint16, P>(Max + static_cast<int16>(1) - Min))) + Min;
|
||||
return (vecType<L, int16, P>(compute_rand<L, uint16, P, vecType>::call() % vecType<L, uint16, P>(Max + static_cast<int16>(1) - Min))) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, uint16, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, uint16, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint16, P> call(vecType<D, uint16, P> const & Min, vecType<D, uint16, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint16, P> call(vecType<L, uint16, P> const & Min, vecType<L, uint16, P> const & Max)
|
||||
{
|
||||
return (compute_rand<D, uint16, P, vecType>::call() % (Max + static_cast<uint16>(1) - Min)) + Min;
|
||||
return (compute_rand<L, uint16, P, vecType>::call() % (Max + static_cast<uint16>(1) - Min)) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, int32, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, int32, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, int32, P> call(vecType<D, int32, P> const & Min, vecType<D, int32, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, int32, P> call(vecType<L, int32, P> const & Min, vecType<L, int32, P> const & Max)
|
||||
{
|
||||
return (vecType<D, int32, P>(compute_rand<D, uint32, P, vecType>::call() % vecType<D, uint32, P>(Max + static_cast<int32>(1) - Min))) + Min;
|
||||
return (vecType<L, int32, P>(compute_rand<L, uint32, P, vecType>::call() % vecType<L, uint32, P>(Max + static_cast<int32>(1) - Min))) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, uint32, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, uint32, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint32, P> call(vecType<D, uint32, P> const & Min, vecType<D, uint32, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint32, P> call(vecType<L, uint32, P> const & Min, vecType<L, uint32, P> const & Max)
|
||||
{
|
||||
return (compute_rand<D, uint32, P, vecType>::call() % (Max + static_cast<uint32>(1) - Min)) + Min;
|
||||
return (compute_rand<L, uint32, P, vecType>::call() % (Max + static_cast<uint32>(1) - Min)) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, int64, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, int64, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, int64, P> call(vecType<D, int64, P> const & Min, vecType<D, int64, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, int64, P> call(vecType<L, int64, P> const & Min, vecType<L, int64, P> const & Max)
|
||||
{
|
||||
return (vecType<D, int64, P>(compute_rand<D, uint64, P, vecType>::call() % vecType<D, uint64, P>(Max + static_cast<int64>(1) - Min))) + Min;
|
||||
return (vecType<L, int64, P>(compute_rand<L, uint64, P, vecType>::call() % vecType<L, uint64, P>(Max + static_cast<int64>(1) - Min))) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, uint64, P, vecType>
|
||||
template<length_t L, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, uint64, P, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, uint64, P> call(vecType<D, uint64, P> const & Min, vecType<D, uint64, P> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, uint64, P> call(vecType<L, uint64, P> const & Min, vecType<L, uint64, P> const & Max)
|
||||
{
|
||||
return (compute_rand<D, uint64, P, vecType>::call() % (Max + static_cast<uint64>(1) - Min)) + Min;
|
||||
return (compute_rand<L, uint64, P, vecType>::call() % (Max + static_cast<uint64>(1) - Min)) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, float, lowp, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, float, lowp, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, float, lowp> call(vecType<D, float, lowp> const & Min, vecType<D, float, lowp> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, float, lowp> call(vecType<L, float, lowp> const & Min, vecType<L, float, lowp> const & Max)
|
||||
{
|
||||
return vecType<D, float, lowp>(compute_rand<D, uint8, lowp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint8>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, float, lowp>(compute_rand<L, uint8, lowp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint8>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, float, mediump, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, float, mediump, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, float, mediump> call(vecType<D, float, mediump> const & Min, vecType<D, float, mediump> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, float, mediump> call(vecType<L, float, mediump> const & Min, vecType<L, float, mediump> const & Max)
|
||||
{
|
||||
return vecType<D, float, mediump>(compute_rand<D, uint16, mediump, vecType>::call()) / static_cast<float>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, float, mediump>(compute_rand<L, uint16, mediump, vecType>::call()) / static_cast<float>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, float, highp, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, float, highp, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, float, highp> call(vecType<D, float, highp> const & Min, vecType<D, float, highp> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, float, highp> call(vecType<L, float, highp> const & Min, vecType<L, float, highp> const & Max)
|
||||
{
|
||||
return vecType<D, float, highp>(compute_rand<D, uint32, highp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, float, highp>(compute_rand<L, uint32, highp, vecType>::call()) / static_cast<float>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, double, lowp, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, double, lowp, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, double, lowp> call(vecType<D, double, lowp> const & Min, vecType<D, double, lowp> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, double, lowp> call(vecType<L, double, lowp> const & Min, vecType<L, double, lowp> const & Max)
|
||||
{
|
||||
return vecType<D, double, lowp>(compute_rand<D, uint16, lowp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, double, lowp>(compute_rand<L, uint16, lowp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint16>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, double, mediump, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, double, mediump, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, double, mediump> call(vecType<D, double, mediump> const & Min, vecType<D, double, mediump> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, double, mediump> call(vecType<L, double, mediump> const & Min, vecType<L, double, mediump> const & Max)
|
||||
{
|
||||
return vecType<D, double, mediump>(compute_rand<D, uint32, mediump, vecType>::call()) / static_cast<double>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, double, mediump>(compute_rand<L, uint32, mediump, vecType>::call()) / static_cast<double>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, double, highp, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, double, highp, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, double, highp> call(vecType<D, double, highp> const & Min, vecType<D, double, highp> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, double, highp> call(vecType<L, double, highp> const & Min, vecType<L, double, highp> const & Max)
|
||||
{
|
||||
return vecType<D, double, highp>(compute_rand<D, uint64, highp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, double, highp>(compute_rand<L, uint64, highp, vecType>::call()) / static_cast<double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, long double, lowp, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, long double, lowp, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, long double, lowp> call(vecType<D, long double, lowp> const & Min, vecType<D, long double, lowp> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, long double, lowp> call(vecType<L, long double, lowp> const & Min, vecType<L, long double, lowp> const & Max)
|
||||
{
|
||||
return vecType<D, long double, lowp>(compute_rand<D, uint32, lowp, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, long double, lowp>(compute_rand<L, uint32, lowp, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint32>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, long double, mediump, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, long double, mediump, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, long double, mediump> call(vecType<D, long double, mediump> const & Min, vecType<D, long double, mediump> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, long double, mediump> call(vecType<L, long double, mediump> const & Min, vecType<L, long double, mediump> const & Max)
|
||||
{
|
||||
return vecType<D, long double, mediump>(compute_rand<D, uint64, mediump, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, long double, mediump>(compute_rand<L, uint64, mediump, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, template <int, typename, precision> class vecType>
|
||||
struct compute_linearRand<D, long double, highp, vecType>
|
||||
template<length_t L, template<length_t, typename, precision> class vecType>
|
||||
struct compute_linearRand<L, long double, highp, vecType>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, long double, highp> call(vecType<D, long double, highp> const & Min, vecType<D, long double, highp> const & Max)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, long double, highp> call(vecType<L, long double, highp> const & Min, vecType<L, long double, highp> const & Max)
|
||||
{
|
||||
return vecType<D, long double, highp>(compute_rand<D, uint64, highp, vecType>::call()) / static_cast<long double>(std::numeric_limits<uint64>::max()) * (Max - Min) + Min;
|
||||
return vecType<L, long double, highp>(compute_rand<L, uint64, highp, vecType>::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<1, genType, highp, vec>::call(
|
||||
@@ -263,13 +263,13 @@ namespace detail
|
||||
vec<1, genType, highp>(Max)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> linearRand(vecType<D, T, P> const & Min, vecType<D, T, P> const & Max)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> linearRand(vecType<L, T, P> const & Min, vecType<L, T, P> const & Max)
|
||||
{
|
||||
return detail::compute_linearRand<D, T, P, vecType>::call(Min, Max);
|
||||
return detail::compute_linearRand<L, T, P, vecType>::call(Min, Max);
|
||||
}
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType gaussRand(genType Mean, genType Deviation)
|
||||
{
|
||||
genType w, x1, x2;
|
||||
@@ -285,13 +285,13 @@ namespace detail
|
||||
return x2 * Deviation * Deviation * sqrt((genType(-2) * log(w)) / w) + Mean;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> gaussRand(vecType<D, T, P> const & Mean, vecType<D, T, P> const & Deviation)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> gaussRand(vecType<L, T, P> const & Mean, vecType<L, T, P> const & Deviation)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(gaussRand, Mean, Deviation);
|
||||
return detail::functor2<L, T, P>::call(gaussRand, Mean, Deviation);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER vec<2, T, defaultp> diskRand(T Radius)
|
||||
{
|
||||
vec<2, T, defaultp> Result(T(0));
|
||||
@@ -309,7 +309,7 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, defaultp> ballRand(T Radius)
|
||||
{
|
||||
vec<3, T, defaultp> Result(T(0));
|
||||
@@ -327,14 +327,14 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER vec<2, T, defaultp> circularRand(T Radius)
|
||||
{
|
||||
T a = linearRand(T(0), T(6.283185307179586476925286766559f));
|
||||
return vec<2, T, defaultp>(cos(a), sin(a)) * Radius;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, defaultp> sphericalRand(T Radius)
|
||||
{
|
||||
T z = linearRand(T(-1), T(1));
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace glm
|
||||
/// @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.
|
||||
@@ -39,7 +39,7 @@ namespace glm
|
||||
/// @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.
|
||||
@@ -48,7 +48,7 @@ namespace glm
|
||||
/// @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.
|
||||
@@ -57,7 +57,7 @@ namespace glm
|
||||
/// @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.
|
||||
@@ -66,7 +66,7 @@ namespace glm
|
||||
/// @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.
|
||||
@@ -75,7 +75,7 @@ namespace glm
|
||||
/// @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.
|
||||
@@ -83,7 +83,7 @@ namespace glm
|
||||
/// @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.
|
||||
@@ -91,7 +91,7 @@ namespace glm
|
||||
/// @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.
|
||||
@@ -99,7 +99,7 @@ namespace glm
|
||||
/// @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.
|
||||
@@ -108,7 +108,7 @@ namespace glm
|
||||
/// @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.
|
||||
@@ -117,7 +117,7 @@ namespace glm
|
||||
/// @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.
|
||||
@@ -126,7 +126,7 @@ namespace glm
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see gtc_reciprocal
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType acoth(genType x);
|
||||
|
||||
/// @}
|
||||
|
||||
@@ -7,37 +7,37 @@
|
||||
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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> sec(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> sec(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sec' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(sec, x);
|
||||
return detail::functor1<L, T, T, P>::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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> csc(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> csc(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csc' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(csc, x);
|
||||
return detail::functor1<L, T, T, P>::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");
|
||||
@@ -46,45 +46,45 @@ namespace glm
|
||||
return glm::tan(pi_over_2 - angle);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> cot(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> cot(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cot' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(cot, x);
|
||||
return detail::functor1<L, T, T, P>::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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> asec(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> asec(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asec' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(asec, x);
|
||||
return detail::functor1<L, T, T, P>::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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> acsc(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> acsc(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsc' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(acsc, x);
|
||||
return detail::functor1<L, T, T, P>::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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> acot(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> acot(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acot' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(acot, x);
|
||||
return detail::functor1<L, T, T, P>::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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> sech(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> sech(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sech' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(sech, x);
|
||||
return detail::functor1<L, T, T, P>::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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> csch(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> csch(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csch' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(csch, x);
|
||||
return detail::functor1<L, T, T, P>::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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> coth(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> coth(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'coth' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(coth, x);
|
||||
return detail::functor1<L, T, T, P>::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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> asech(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> asech(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asech' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(asech, x);
|
||||
return detail::functor1<L, T, T, P>::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);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> acsch(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> acsch(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsch' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(acsch, x);
|
||||
return detail::functor1<L, T, T, P>::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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> acoth(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> acoth(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acoth' only accept floating-point inputs");
|
||||
return detail::functor1<D, T, T, P>::call(acoth, x);
|
||||
return detail::functor1<L, T, T, P>::call(acoth, x);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@@ -33,72 +33,72 @@ namespace glm
|
||||
/// Return true if the value is a power of two number.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <typename genIUType>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_DECL bool isPowerOfTwo(genIUType Value);
|
||||
|
||||
/// Return true if the value is a power of two number.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> isPowerOfTwo(vecType<D, T, P> const & value);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> isPowerOfTwo(vecType<L, T, P> const & value);
|
||||
|
||||
/// 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>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_DECL genIUType ceilPowerOfTwo(genIUType Value);
|
||||
|
||||
/// 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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> ceilPowerOfTwo(vecType<D, T, P> const & value);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> ceilPowerOfTwo(vecType<L, T, P> const & value);
|
||||
|
||||
/// 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>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_DECL genIUType floorPowerOfTwo(genIUType Value);
|
||||
|
||||
/// 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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> floorPowerOfTwo(vecType<D, T, P> const & value);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> floorPowerOfTwo(vecType<L, T, P> const & value);
|
||||
|
||||
/// Return the power of two number which value is the closet to the input value.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <typename genIUType>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_DECL genIUType roundPowerOfTwo(genIUType Value);
|
||||
|
||||
/// Return the power of two number which value is the closet to the input value.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> roundPowerOfTwo(vecType<D, T, P> const & value);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> roundPowerOfTwo(vecType<L, T, P> const & value);
|
||||
|
||||
/// Return true if the 'Value' is a multiple of 'Multiple'.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <typename genIUType>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_DECL bool isMultiple(genIUType Value, genIUType Multiple);
|
||||
|
||||
/// Return true if the 'Value' is a multiple of 'Multiple'.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> isMultiple(vecType<D, T, P> const & Value, T Multiple);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> isMultiple(vecType<L, T, P> const & Value, T Multiple);
|
||||
|
||||
/// Return true if the 'Value' is a multiple of 'Multiple'.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, bool, P> isMultiple(vecType<D, T, P> const & Value, vecType<D, T, P> const & Multiple);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, bool, P> isMultiple(vecType<L, T, P> const & Value, vecType<L, T, P> const & Multiple);
|
||||
|
||||
/// Higher multiple number of Source.
|
||||
///
|
||||
@@ -107,7 +107,7 @@ namespace glm
|
||||
/// @param Multiple Must be a null or positive value
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType ceilMultiple(genType Source, genType Multiple);
|
||||
|
||||
/// Higher multiple number of Source.
|
||||
@@ -117,8 +117,8 @@ namespace glm
|
||||
/// @param Multiple Must be a null or positive value
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> ceilMultiple(vecType<D, T, P> const & Source, vecType<D, T, P> const & Multiple);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> ceilMultiple(vecType<L, T, P> const & Source, vecType<L, T, P> const & Multiple);
|
||||
|
||||
/// Lower multiple number of Source.
|
||||
///
|
||||
@@ -127,7 +127,7 @@ namespace glm
|
||||
/// @param Multiple Must be a null or positive value
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType floorMultiple(
|
||||
genType Source,
|
||||
genType Multiple);
|
||||
@@ -139,10 +139,10 @@ namespace glm
|
||||
/// @param Multiple Must be a null or positive value
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> floorMultiple(
|
||||
vecType<D, T, P> const & Source,
|
||||
vecType<D, T, P> const & Multiple);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> floorMultiple(
|
||||
vecType<L, T, P> const& Source,
|
||||
vecType<L, T, P> const& Multiple);
|
||||
|
||||
/// Lower multiple number of Source.
|
||||
///
|
||||
@@ -151,7 +151,7 @@ namespace glm
|
||||
/// @param Multiple Must be a null or positive value
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType roundMultiple(
|
||||
genType Source,
|
||||
genType Multiple);
|
||||
@@ -163,10 +163,10 @@ namespace glm
|
||||
/// @param Multiple Must be a null or positive value
|
||||
///
|
||||
/// @see gtc_round
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<D, T, P> roundMultiple(
|
||||
vecType<D, T, P> const & Source,
|
||||
vecType<D, T, P> const & Multiple);
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<L, T, P> roundMultiple(
|
||||
vecType<L, T, P> const& Source,
|
||||
vecType<L, T, P> const& Multiple);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
||||
@@ -6,73 +6,73 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool compute = false>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool compute = false>
|
||||
struct compute_ceilShift
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_ceilShift<D, T, P, vecType, true>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_ceilShift<L, T, P, vecType, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & v, T Shift)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & v, T Shift)
|
||||
{
|
||||
return v | (v >> Shift);
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType, bool isSigned = true>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType, bool isSigned = true>
|
||||
struct compute_ceilPowerOfTwo
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
|
||||
|
||||
vecType<D, T, P> const Sign(sign(x));
|
||||
vecType<L, T, P> const Sign(sign(x));
|
||||
|
||||
vecType<D, T, P> v(abs(x));
|
||||
vecType<L, T, P> 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<D, T, P, vecType, sizeof(T) >= 2>::call(v, 8);
|
||||
v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 4>::call(v, 16);
|
||||
v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 8>::call(v, 32);
|
||||
v = compute_ceilShift<L, T, P, vecType, sizeof(T) >= 2>::call(v, 8);
|
||||
v = compute_ceilShift<L, T, P, vecType, sizeof(T) >= 4>::call(v, 16);
|
||||
v = compute_ceilShift<L, T, P, vecType, sizeof(T) >= 8>::call(v, 32);
|
||||
return (v + static_cast<T>(1)) * Sign;
|
||||
}
|
||||
};
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
struct compute_ceilPowerOfTwo<D, T, P, vecType, false>
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
struct compute_ceilPowerOfTwo<L, T, P, vecType, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<D, T, P> call(vecType<D, T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER static vecType<L, T, P> call(vecType<L, T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
|
||||
|
||||
vecType<D, T, P> v(x);
|
||||
vecType<L, T, P> 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<D, T, P, vecType, sizeof(T) >= 2>::call(v, 8);
|
||||
v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 4>::call(v, 16);
|
||||
v = compute_ceilShift<D, T, P, vecType, sizeof(T) >= 8>::call(v, 32);
|
||||
v = compute_ceilShift<L, T, P, vecType, sizeof(T) >= 2>::call(v, 8);
|
||||
v = compute_ceilShift<L, T, P, vecType, sizeof(T) >= 4>::call(v, 16);
|
||||
v = compute_ceilShift<L, T, P, vecType, 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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> isPowerOfTwo(vecType<D, T, P> const & Value)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> isPowerOfTwo(vecType<L, T, P> const & Value)
|
||||
{
|
||||
vecType<D, T, P> const Result(abs(Value));
|
||||
return equal(Result & (Result - 1), vecType<D, T, P>(0));
|
||||
vecType<L, T, P> const Result(abs(Value));
|
||||
return equal(Result & (Result - 1), vecType<L, T, P>(0));
|
||||
}
|
||||
|
||||
//////////////////
|
||||
// ceilPowerOfTwo
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER genType ceilPowerOfTwo(genType value)
|
||||
{
|
||||
return detail::compute_ceilPowerOfTwo<1, genType, defaultp, vec, std::numeric_limits<genType>::is_signed>::call(vec<1, genType, defaultp>(value)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> ceilPowerOfTwo(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> ceilPowerOfTwo(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::compute_ceilPowerOfTwo<D, T, P, vecType, std::numeric_limits<T>::is_signed>::call(v);
|
||||
return detail::compute_ceilPowerOfTwo<L, T, P, vecType, 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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> floorPowerOfTwo(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> floorPowerOfTwo(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(floorPowerOfTwo, v);
|
||||
return detail::functor1<L, T, T, P>::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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> roundPowerOfTwo(vecType<D, T, P> const & v)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> roundPowerOfTwo(vecType<L, T, P> const & v)
|
||||
{
|
||||
return detail::functor1<D, T, T, P>::call(roundPowerOfTwo, v);
|
||||
return detail::functor1<L, T, T, P>::call(roundPowerOfTwo, v);
|
||||
}
|
||||
|
||||
////////////////
|
||||
// isMultiple
|
||||
|
||||
template <typename genType>
|
||||
template<typename genType>
|
||||
GLM_FUNC_QUALIFIER bool isMultiple(genType Value, genType Multiple)
|
||||
{
|
||||
return isMultiple(vec<1, genType>(Value), vec<1, genType>(Multiple)).x;
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> isMultiple(vecType<D, T, P> const & Value, T Multiple)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> isMultiple(vecType<L, T, P> const & Value, T Multiple)
|
||||
{
|
||||
return (Value % Multiple) == vecType<D, T, P>(0);
|
||||
return (Value % Multiple) == vecType<L, T, P>(0);
|
||||
}
|
||||
|
||||
template <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, bool, P> isMultiple(vecType<D, T, P> const & Value, vecType<D, T, P> const & Multiple)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, bool, P> isMultiple(vecType<L, T, P> const & Value, vecType<L, T, P> const & Multiple)
|
||||
{
|
||||
return (Value % Multiple) == vecType<D, T, P>(0);
|
||||
return (Value % Multiple) == vecType<L, T, P>(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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> ceilMultiple(vecType<D, T, P> const & Source, vecType<D, T, P> const & Multiple)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> ceilMultiple(vecType<L, T, P> const & Source, vecType<L, T, P> const & Multiple)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(ceilMultiple, Source, Multiple);
|
||||
return detail::functor2<L, T, P>::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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> floorMultiple(vecType<D, T, P> const & Source, vecType<D, T, P> const & Multiple)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> floorMultiple(vecType<L, T, P> const & Source, vecType<L, T, P> const & Multiple)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(floorMultiple, Source, Multiple);
|
||||
return detail::functor2<L, T, P>::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 <int D, typename T, precision P, template <int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> roundMultiple(vecType<D, T, P> const & Source, vecType<D, T, P> const & Multiple)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> roundMultiple(vecType<L, T, P> const & Source, vecType<L, T, P> const & Multiple)
|
||||
{
|
||||
return detail::functor2<D, T, P>::call(roundMultiple, Source, Multiple);
|
||||
return detail::functor2<L, T, P>::call(roundMultiple, Source, Multiple);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@@ -60,7 +60,7 @@ 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
|
||||
|
||||
@@ -11,271 +11,199 @@ namespace glm
|
||||
/// 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
|
||||
(
|
||||
vec<2, T, P> const & vec
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(vec<2, T, P> const& v)
|
||||
{
|
||||
return &(vec.x);
|
||||
return &(v.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
|
||||
(
|
||||
vec<2, T, P> & vec
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(vec<2, T, P>& v)
|
||||
{
|
||||
return &(vec.x);
|
||||
return &(v.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
|
||||
(
|
||||
vec<3, T, P> const & vec
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr(vec<3, T, P> const& v)
|
||||
{
|
||||
return &(vec.x);
|
||||
return &(v.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
|
||||
(
|
||||
vec<3, T, P> & vec
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(vec<3, T, P>& v)
|
||||
{
|
||||
return &(vec.x);
|
||||
return &(v.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
|
||||
(
|
||||
vec<4, T, P> const & vec
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(vec<4, T, P> const& v)
|
||||
{
|
||||
return &(vec.x);
|
||||
return &(v.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
|
||||
(
|
||||
vec<4, T, P> & vec
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(vec<4, T, P>& v)
|
||||
{
|
||||
return &(vec.x);
|
||||
return &(v.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
|
||||
(
|
||||
mat<2, 2, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 2, T, P> 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
|
||||
(
|
||||
mat<2, 2, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 2, T, P>& 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
|
||||
(
|
||||
mat<3, 3, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 3, T, P> 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
|
||||
(
|
||||
mat<3, 3, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 3, T, P>& 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
|
||||
(
|
||||
mat<4, 4, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 4, T, P> const& m)
|
||||
{
|
||||
return &(mat[0].x);
|
||||
return &(m[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
|
||||
(
|
||||
mat<4, 4, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<4, 4, T, P>& 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
|
||||
(
|
||||
mat<2, 3, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 3, T, P> 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
|
||||
(
|
||||
mat<2, 3, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 3, T, P>& 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
|
||||
(
|
||||
mat<3, 2, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 2, T, P> 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
|
||||
(
|
||||
mat<3, 2, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 2, T, P>& 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
|
||||
(
|
||||
mat<2, 4, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 4, T, P> 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
|
||||
(
|
||||
mat<2, 4, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 4, T, P>& 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
|
||||
(
|
||||
mat<4, 2, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 2, T, P> 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
|
||||
(
|
||||
mat<4, 2, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<4, 2, T, P>& 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
|
||||
(
|
||||
mat<3, 4, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 4, T, P> 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
|
||||
(
|
||||
mat<3, 4, T, P> & mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 4, T, P>& 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
|
||||
(
|
||||
mat<4, 3, T, P> const& mat
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 3, T, P> 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(mat<4, 3, T, P> & mat)
|
||||
GLM_FUNC_QUALIFIER T * value_ptr(mat<4, 3, T, P>& m)
|
||||
{
|
||||
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
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr(tquat<T, P> const& q)
|
||||
{
|
||||
return &(q[0]);
|
||||
}
|
||||
@@ -283,18 +211,15 @@ namespace glm
|
||||
/// 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
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(tquat<T, P>& q)
|
||||
{
|
||||
return &(q[0]);
|
||||
}
|
||||
|
||||
/// Build a vector from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER vec<2, T, defaultp> make_vec2(T const * const ptr)
|
||||
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>));
|
||||
@@ -303,8 +228,8 @@ namespace glm
|
||||
|
||||
/// Build a vector from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, defaultp> make_vec3(T const * const ptr)
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, defaultp> make_vec3(T const *const ptr)
|
||||
{
|
||||
vec<3, T, defaultp> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(vec<3, T, defaultp>));
|
||||
@@ -313,8 +238,8 @@ namespace glm
|
||||
|
||||
/// Build a vector from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER vec<4, T, defaultp> make_vec4(T const * const ptr)
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER vec<4, T, defaultp> make_vec4(T const *const ptr)
|
||||
{
|
||||
vec<4, T, defaultp> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(vec<4, T, defaultp>));
|
||||
@@ -323,8 +248,8 @@ namespace glm
|
||||
|
||||
/// Build a matrix from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER mat<2, 2, 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)
|
||||
{
|
||||
mat<2, 2, T, defaultp> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(mat<2, 2, T, defaultp>));
|
||||
@@ -333,8 +258,8 @@ namespace glm
|
||||
|
||||
/// Build a matrix from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER mat<2, 3, 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)
|
||||
{
|
||||
mat<2, 3, T, defaultp> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(mat<2, 3, T, defaultp>));
|
||||
@@ -343,8 +268,8 @@ namespace glm
|
||||
|
||||
/// Build a matrix from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER mat<2, 4, 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)
|
||||
{
|
||||
mat<2, 4, T, defaultp> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(mat<2, 4, T, defaultp>));
|
||||
@@ -353,8 +278,8 @@ namespace glm
|
||||
|
||||
/// Build a matrix from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER mat<3, 2, 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)
|
||||
{
|
||||
mat<3, 2, T, defaultp> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(mat<3, 2, T, defaultp>));
|
||||
@@ -363,8 +288,8 @@ namespace glm
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER mat<3, 3, 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)
|
||||
{
|
||||
mat<3, 3, T, defaultp> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(mat<3, 3, T, defaultp>));
|
||||
@@ -373,8 +298,8 @@ namespace glm
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER mat<3, 4, 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)
|
||||
{
|
||||
mat<3, 4, T, defaultp> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(mat<3, 4, T, defaultp>));
|
||||
@@ -383,8 +308,8 @@ namespace glm
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 2, 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)
|
||||
{
|
||||
mat<4, 2, T, defaultp> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(mat<4, 2, T, defaultp>));
|
||||
@@ -393,8 +318,8 @@ namespace glm
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 3, 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)
|
||||
{
|
||||
mat<4, 3, T, defaultp> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(mat<4, 3, T, defaultp>));
|
||||
@@ -403,8 +328,8 @@ namespace glm
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, 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)
|
||||
{
|
||||
mat<4, 4, T, defaultp> Result;
|
||||
memcpy(value_ptr(Result), ptr, sizeof(mat<4, 4, T, defaultp>));
|
||||
@@ -413,32 +338,32 @@ namespace glm
|
||||
|
||||
//! Build a matrix from a pointer.
|
||||
/// @see gtc_type_ptr
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER mat<2, 2, 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 mat<3, 3, 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 mat<4, 4, 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>));
|
||||
|
||||
@@ -29,27 +29,27 @@ namespace glm
|
||||
|
||||
/// Return the next ULP value(s) after the input value(s).
|
||||
/// @see gtc_ulp
|
||||
template <typename genType>
|
||||
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>
|
||||
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>
|
||||
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>
|
||||
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>
|
||||
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.
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace detail
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <>
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER float next_float(float const & x)
|
||||
{
|
||||
# if GLM_HAS_CXX11_STL
|
||||
@@ -185,7 +185,7 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template <>
|
||||
template<>
|
||||
GLM_FUNC_QUALIFIER double next_float(double const & x)
|
||||
{
|
||||
# if GLM_HAS_CXX11_STL
|
||||
@@ -199,10 +199,10 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template<int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> next_float(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> next_float(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> Result(uninitialize);
|
||||
vecType<L, T, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = next_float(x[i]);
|
||||
return Result;
|
||||
@@ -234,16 +234,16 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template<int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> prev_float(vecType<D, T, P> const & x)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> prev_float(vecType<L, T, P> const & x)
|
||||
{
|
||||
vecType<D, T, P> Result(uninitialize);
|
||||
vecType<L, T, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = prev_float(x[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T next_float(T const & x, uint const & ulps)
|
||||
{
|
||||
T temp = x;
|
||||
@@ -252,16 +252,16 @@ namespace glm
|
||||
return temp;
|
||||
}
|
||||
|
||||
template<int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> next_float(vecType<D, T, P> const & x, vecType<D, uint, P> const & ulps)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> next_float(vecType<L, T, P> const & x, vecType<L, uint, P> const & ulps)
|
||||
{
|
||||
vecType<D, T, P> Result(uninitialize);
|
||||
vecType<L, T, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = next_float(x[i], ulps[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER T prev_float(T const & x, uint const & ulps)
|
||||
{
|
||||
T temp = x;
|
||||
@@ -270,16 +270,16 @@ namespace glm
|
||||
return temp;
|
||||
}
|
||||
|
||||
template<int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, T, P> prev_float(vecType<D, T, P> const & x, vecType<D, uint, P> const & ulps)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, T, P> prev_float(vecType<L, T, P> const & x, vecType<L, uint, P> const & ulps)
|
||||
{
|
||||
vecType<D, T, P> Result(uninitialize);
|
||||
vecType<L, T, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = prev_float(x[i], ulps[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
template<typename T>
|
||||
GLM_FUNC_QUALIFIER uint float_distance(T const & x, T const & y)
|
||||
{
|
||||
uint ulp = 0;
|
||||
@@ -310,10 +310,10 @@ namespace glm
|
||||
return ulp;
|
||||
}
|
||||
|
||||
template<int D, typename T, precision P, template<int, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<D, uint, P> float_distance(vecType<D, T, P> const & x, vecType<D, T, P> const & y)
|
||||
template<length_t L, typename T, precision P, template<length_t, typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<L, uint, P> float_distance(vecType<L, T, P> const & x, vecType<L, T, P> const & y)
|
||||
{
|
||||
vecType<D, uint, P> Result(uninitialize);
|
||||
vecType<L, uint, P> Result(uninitialize);
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = float_distance(x[i], y[i]);
|
||||
return Result;
|
||||
|
||||
Reference in New Issue
Block a user