Renamed P (for precision) template argument to Q (for qualifier)
This commit is contained in:
@@ -38,9 +38,13 @@ namespace glm
|
||||
|
||||
/// Build a mask of 'count' bits
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Signed and unsigned integer scalar types
|
||||
/// @tparam P Value from qualifier enum
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template<typename T, qualifier P, template<typename, qualifier> class vecIUType>
|
||||
GLM_FUNC_DECL vecIUType<T, P> mask(vecIUType<T, P> const& v);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> mask(vec<L, T, Q> const& v);
|
||||
|
||||
/// Rotate all bits to the right. All the bits dropped in the right side are inserted back on the left side.
|
||||
///
|
||||
@@ -51,8 +55,8 @@ namespace glm
|
||||
/// 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<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> bitfieldRotateRight(vec<L, T, P> const& In, int Shift);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> bitfieldRotateRight(vec<L, T, Q> const& In, int Shift);
|
||||
|
||||
/// Rotate all bits to the left. All the bits dropped in the left side are inserted back on the right side.
|
||||
///
|
||||
@@ -63,8 +67,8 @@ namespace glm
|
||||
/// 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<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> bitfieldRotateLeft(vec<L, T, P> const& In, int Shift);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> bitfieldRotateLeft(vec<L, T, Q> const& In, int Shift);
|
||||
|
||||
/// Set to 1 a range of bits.
|
||||
///
|
||||
@@ -75,8 +79,8 @@ namespace glm
|
||||
/// Set to 1 a range of bits.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> bitfieldFillOne(vec<L, T, P> const& Value, int FirstBit, int BitCount);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> bitfieldFillOne(vec<L, T, Q> const& Value, int FirstBit, int BitCount);
|
||||
|
||||
/// Set to 0 a range of bits.
|
||||
///
|
||||
@@ -87,8 +91,8 @@ namespace glm
|
||||
/// Set to 0 a range of bits.
|
||||
///
|
||||
/// @see gtc_bitfield
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> bitfieldFillZero(vec<L, T, P> const& Value, int FirstBit, int BitCount);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> bitfieldFillZero(vec<L, T, Q> const& Value, int FirstBit, int BitCount);
|
||||
|
||||
/// Interleaves the bits of x and y.
|
||||
/// The first bit is the first bit of x followed by the first bit of y.
|
||||
|
||||
@@ -230,12 +230,12 @@ namespace detail
|
||||
return Bits >= sizeof(genIUType) * 8 ? ~static_cast<genIUType>(0) : (static_cast<genIUType>(1) << Bits) - static_cast<genIUType>(1);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P, template<length_t, typename, qualifier> class vecIUType>
|
||||
GLM_FUNC_QUALIFIER vecIUType<L, T, P> mask(vecIUType<L, T, P> const& v)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> mask(vec<L, T, Q> const& v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'mask' accepts only integer values");
|
||||
|
||||
return detail::functor1<L, T, T, P>::call(mask, v);
|
||||
return detail::functor1<L, T, T, Q>::call(mask, v);
|
||||
}
|
||||
|
||||
template<typename genIType>
|
||||
@@ -247,8 +247,8 @@ namespace detail
|
||||
return (In << static_cast<genIType>(Shift)) | (In >> static_cast<genIType>(BitSize - Shift));
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> bitfieldRotateRight(vec<L, T, P> const& In, int Shift)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldRotateRight(vec<L, T, Q> const& In, int Shift)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldRotateRight' accepts only integer values");
|
||||
|
||||
@@ -265,8 +265,8 @@ namespace detail
|
||||
return (In >> static_cast<genIType>(Shift)) | (In << static_cast<genIType>(BitSize - Shift));
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> bitfieldRotateLeft(vec<L, T, P> const& In, int Shift)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldRotateLeft(vec<L, T, Q> const& In, int Shift)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldRotateLeft' accepts only integer values");
|
||||
|
||||
@@ -280,8 +280,8 @@ namespace detail
|
||||
return Value | static_cast<genIUType>(mask(BitCount) << FirstBit);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> bitfieldFillOne(vec<L, T, P> const& Value, int FirstBit, int BitCount)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldFillOne(vec<L, T, Q> const& Value, int FirstBit, int BitCount)
|
||||
{
|
||||
return Value | static_cast<T>(mask(BitCount) << FirstBit);
|
||||
}
|
||||
@@ -292,8 +292,8 @@ namespace detail
|
||||
return Value & static_cast<genIUType>(~(mask(BitCount) << FirstBit));
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> bitfieldFillZero(vec<L, T, P> const& Value, int FirstBit, int BitCount)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> bitfieldFillZero(vec<L, T, Q> const& Value, int FirstBit, int BitCount)
|
||||
{
|
||||
return Value & static_cast<T>(~(mask(BitCount) << FirstBit));
|
||||
}
|
||||
|
||||
@@ -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<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> convertLinearToSRGB(vec<L, T, P> const& ColorLinear);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> convertLinearToSRGB(vec<L, T, Q> const& ColorLinear);
|
||||
|
||||
/// Convert a linear color to sRGB color using a custom gamma correction.
|
||||
/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> convertLinearToSRGB(vec<L, T, P> const& ColorLinear, T Gamma);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> convertLinearToSRGB(vec<L, T, Q> const& ColorLinear, T Gamma);
|
||||
|
||||
/// Convert a sRGB color to linear color using a standard gamma correction.
|
||||
/// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> convertSRGBToLinear(vec<L, T, P> const& ColorSRGB);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> convertSRGBToLinear(vec<L, T, Q> const& ColorSRGB);
|
||||
|
||||
/// Convert a sRGB color to linear color using a custom gamma correction.
|
||||
// IEC 61966-2-1:1999 / Rec. 709 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> convertSRGBToLinear(vec<L, T, P> const& ColorSRGB, T Gamma);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> convertSRGBToLinear(vec<L, T, Q> const& ColorSRGB, T Gamma);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
||||
@@ -4,55 +4,55 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template<length_t L, typename T, qualifier P>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
struct compute_rgbToSrgb
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, P> call(vec<L, T, P> const& ColorRGB, T GammaCorrection)
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& ColorRGB, T GammaCorrection)
|
||||
{
|
||||
vec<L, T, P> const ClampedColor(clamp(ColorRGB, static_cast<T>(0), static_cast<T>(1)));
|
||||
vec<L, T, Q> const ClampedColor(clamp(ColorRGB, static_cast<T>(0), static_cast<T>(1)));
|
||||
|
||||
return mix(
|
||||
pow(ClampedColor, vec<L, T, P>(GammaCorrection)) * static_cast<T>(1.055) - static_cast<T>(0.055),
|
||||
pow(ClampedColor, vec<L, T, Q>(GammaCorrection)) * static_cast<T>(1.055) - static_cast<T>(0.055),
|
||||
ClampedColor * static_cast<T>(12.92),
|
||||
lessThan(ClampedColor, vec<L, T, P>(static_cast<T>(0.0031308))));
|
||||
lessThan(ClampedColor, vec<L, T, Q>(static_cast<T>(0.0031308))));
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, qualifier P>
|
||||
struct compute_rgbToSrgb<4, T, P>
|
||||
template<typename T, qualifier Q>
|
||||
struct compute_rgbToSrgb<4, T, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<4, T, P> call(vec<4, T, P> const& ColorRGB, T GammaCorrection)
|
||||
GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& ColorRGB, T GammaCorrection)
|
||||
{
|
||||
return vec<4, T, P>(compute_rgbToSrgb<3, T, P>::call(vec<3, T, P>(ColorRGB), GammaCorrection), ColorRGB.w);
|
||||
return vec<4, T, Q>(compute_rgbToSrgb<3, T, Q>::call(vec<3, T, Q>(ColorRGB), GammaCorrection), ColorRGB.w);
|
||||
}
|
||||
};
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
struct compute_srgbToRgb
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, P> call(vec<L, T, P> const& ColorSRGB, T Gamma)
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& ColorSRGB, T Gamma)
|
||||
{
|
||||
return mix(
|
||||
pow((ColorSRGB + static_cast<T>(0.055)) * static_cast<T>(0.94786729857819905213270142180095), vec<L, T, P>(Gamma)),
|
||||
pow((ColorSRGB + static_cast<T>(0.055)) * static_cast<T>(0.94786729857819905213270142180095), vec<L, T, Q>(Gamma)),
|
||||
ColorSRGB * static_cast<T>(0.07739938080495356037151702786378),
|
||||
lessThanEqual(ColorSRGB, vec<L, T, P>(static_cast<T>(0.04045))));
|
||||
lessThanEqual(ColorSRGB, vec<L, T, Q>(static_cast<T>(0.04045))));
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, qualifier P>
|
||||
struct compute_srgbToRgb<4, T, P>
|
||||
template<typename T, qualifier Q>
|
||||
struct compute_srgbToRgb<4, T, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<4, T, P> call(vec<4, T, P> const& ColorSRGB, T Gamma)
|
||||
GLM_FUNC_QUALIFIER static vec<4, T, Q> call(vec<4, T, Q> const& ColorSRGB, T Gamma)
|
||||
{
|
||||
return vec<4, T, P>(compute_srgbToRgb<3, T, P>::call(vec<3, T, P>(ColorSRGB), Gamma), ColorSRGB.w);
|
||||
return vec<4, T, Q>(compute_srgbToRgb<3, T, Q>::call(vec<3, T, Q>(ColorSRGB), Gamma), ColorSRGB.w);
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> convertLinearToSRGB(vec<L, T, P> const& ColorLinear)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> convertLinearToSRGB(vec<L, T, Q> const& ColorLinear)
|
||||
{
|
||||
return detail::compute_rgbToSrgb<L, T, P>::call(ColorLinear, static_cast<T>(0.41666));
|
||||
return detail::compute_rgbToSrgb<L, T, Q>::call(ColorLinear, static_cast<T>(0.41666));
|
||||
}
|
||||
|
||||
// Based on Ian Taylor http://chilliant.blogspot.fr/2012/08/srgb-approximations-for-hlsl.html
|
||||
@@ -65,21 +65,21 @@ namespace detail
|
||||
return 0.662002687f * S1 + 0.684122060f * S2 - 0.323583601f * S3 - 0.0225411470f * ColorLinear;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> convertLinearToSRGB(vec<L, T, P> const& ColorLinear, T Gamma)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> convertLinearToSRGB(vec<L, T, Q> const& ColorLinear, T Gamma)
|
||||
{
|
||||
return detail::compute_rgbToSrgb<L, T, P>::call(ColorLinear, static_cast<T>(1) / Gamma);
|
||||
return detail::compute_rgbToSrgb<L, T, Q>::call(ColorLinear, static_cast<T>(1) / Gamma);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> convertSRGBToLinear(vec<L, T, P> const& ColorSRGB)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> convertSRGBToLinear(vec<L, T, Q> const& ColorSRGB)
|
||||
{
|
||||
return detail::compute_srgbToRgb<L, T, P>::call(ColorSRGB, static_cast<T>(2.4));
|
||||
return detail::compute_srgbToRgb<L, T, Q>::call(ColorSRGB, static_cast<T>(2.4));
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> convertSRGBToLinear(vec<L, T, P> const& ColorSRGB, T Gamma)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> convertSRGBToLinear(vec<L, T, Q> const& ColorSRGB, T Gamma)
|
||||
{
|
||||
return detail::compute_srgbToRgb<L, T, P>::call(ColorSRGB, Gamma);
|
||||
return detail::compute_srgbToRgb<L, T, Q>::call(ColorSRGB, Gamma);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@@ -30,8 +30,8 @@ namespace glm
|
||||
/// True if this expression is satisfied.
|
||||
///
|
||||
/// @see gtc_epsilon
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, bool, P> epsilonEqual(vec<L, T, P> const& x, vec<L, T, P> const& y, T const& epsilon);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> epsilonEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T const& epsilon);
|
||||
|
||||
/// Returns the component-wise comparison of |x - y| < epsilon.
|
||||
/// True if this expression is satisfied.
|
||||
@@ -44,8 +44,8 @@ namespace glm
|
||||
/// True if this expression is not satisfied.
|
||||
///
|
||||
/// @see gtc_epsilon
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, bool, P> epsilonNotEqual(vec<L, T, P> const& x, vec<L, T, P> const& y, T const& epsilon);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> epsilonNotEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T const& epsilon);
|
||||
|
||||
/// Returns the component-wise comparison of |x - y| >= epsilon.
|
||||
/// True if this expression is not satisfied.
|
||||
|
||||
@@ -33,16 +33,16 @@ namespace glm
|
||||
return abs(x - y) < epsilon;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, P> epsilonEqual(vec<L, T, P> const& x, vec<L, T, P> const& y, T const& epsilon)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, Q> epsilonEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T const& epsilon)
|
||||
{
|
||||
return lessThan(abs(x - y), vec<L, T, P>(epsilon));
|
||||
return lessThan(abs(x - y), vec<L, T, Q>(epsilon));
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, P> epsilonEqual(vec<L, T, P> const& x, vec<L, T, P> const& y, vec<L, T, P> const& epsilon)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, Q> epsilonEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon)
|
||||
{
|
||||
return lessThan(abs(x - y), vec<L, T, P>(epsilon));
|
||||
return lessThan(abs(x - y), vec<L, T, Q>(epsilon));
|
||||
}
|
||||
|
||||
template<>
|
||||
@@ -57,29 +57,29 @@ namespace glm
|
||||
return abs(x - y) >= epsilon;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, P> epsilonNotEqual(vec<L, T, P> const& x, vec<L, T, P> const& y, T const& epsilon)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, Q> epsilonNotEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, T const& epsilon)
|
||||
{
|
||||
return greaterThanEqual(abs(x - y), vec<L, T, P>(epsilon));
|
||||
return greaterThanEqual(abs(x - y), vec<L, T, Q>(epsilon));
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, P> epsilonNotEqual(vec<L, T, P> const& x, vec<L, T, P> const& y, vec<L, T, P> const& epsilon)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, Q> epsilonNotEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, T, Q> const& epsilon)
|
||||
{
|
||||
return greaterThanEqual(abs(x - y), vec<L, T, P>(epsilon));
|
||||
return greaterThanEqual(abs(x - y), vec<L, T, Q>(epsilon));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> epsilonEqual(tquat<T, P> const& x, tquat<T, P> const& y, T const& epsilon)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, Q> epsilonEqual(tquat<T, Q> const& x, tquat<T, Q> const& y, T const& epsilon)
|
||||
{
|
||||
vec<4, T, P> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
|
||||
return lessThan(abs(v), vec<4, T, P>(epsilon));
|
||||
vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
|
||||
return lessThan(abs(v), vec<4, T, Q>(epsilon));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> epsilonNotEqual(tquat<T, P> const& x, tquat<T, P> const& y, T const& epsilon)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, Q> epsilonNotEqual(tquat<T, Q> const& x, tquat<T, Q> const& y, T const& epsilon)
|
||||
{
|
||||
vec<4, T, P> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
|
||||
return greaterThanEqual(abs(v), vec<4, T, P>(epsilon));
|
||||
vec<4, T, Q> v(x.x - y.x, x.y - y.y, x.z - y.z, x.w - y.w);
|
||||
return greaterThanEqual(abs(v), vec<4, T, Q>(epsilon));
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@@ -39,11 +39,11 @@ namespace glm
|
||||
/// 2D gauss function
|
||||
///
|
||||
/// @see gtc_epsilon
|
||||
template<typename T, qualifier P>
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T gauss(
|
||||
vec<2, T, P> const& Coord,
|
||||
vec<2, T, P> const& ExpectedValue,
|
||||
vec<2, T, P> const& StandardDeviation);
|
||||
vec<2, T, Q> const& Coord,
|
||||
vec<2, T, Q> const& ExpectedValue,
|
||||
vec<2, T, Q> const& StandardDeviation);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
@@ -16,15 +16,15 @@ namespace glm
|
||||
return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast<T>(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast<T>(6.28318530717958647692528676655900576)));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T gauss
|
||||
(
|
||||
vec<2, T, P> const& Coord,
|
||||
vec<2, T, P> const& ExpectedValue,
|
||||
vec<2, T, P> const& StandardDeviation
|
||||
vec<2, T, Q> const& Coord,
|
||||
vec<2, T, Q> const& ExpectedValue,
|
||||
vec<2, T, Q> const& StandardDeviation
|
||||
)
|
||||
{
|
||||
vec<2, T, P> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast<T>(2) * StandardDeviation * StandardDeviation);
|
||||
vec<2, T, Q> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast<T>(2) * StandardDeviation * StandardDeviation);
|
||||
return exp(-(Squared.x + Squared.y));
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@@ -54,8 +54,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<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> mod(vec<L, T, P> const& x, T y);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> mod(vec<L, T, Q> const& x, T y);
|
||||
|
||||
/// Modulus. Returns x % y
|
||||
/// for each component in x using the floating point value y.
|
||||
@@ -65,8 +65,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<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> mod(vec<L, T, P> const& x, vec<L, T, P> const& y);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> mod(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// The fraction 0.5 will round in a direction chosen by the
|
||||
@@ -77,8 +77,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<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, int, P> iround(vec<L, T, P> const& x);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, int, Q> iround(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// The fraction 0.5 will round in a direction chosen by the
|
||||
@@ -89,8 +89,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<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, uint, P> uround(vec<L, T, P> const& x);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, uint, Q> uround(vec<L, T, Q> const& x);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
||||
@@ -4,24 +4,24 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template<length_t L, typename T, qualifier P, bool Aligned>
|
||||
struct compute_log2<L, T, P, false, Aligned>
|
||||
template<length_t L, typename T, qualifier Q, bool Aligned>
|
||||
struct compute_log2<L, T, Q, false, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, P> call(vec<L, T, P> const& v)
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v)
|
||||
{
|
||||
//Equivalent to return findMSB(vec); but save one function call in ASM with VC
|
||||
//return findMSB(vec);
|
||||
return vec<L, T, P>(detail::compute_findMSB_vec<L, T, P, sizeof(T) * 8>::call(v));
|
||||
return vec<L, T, Q>(detail::compute_findMSB_vec<L, T, Q, sizeof(T) * 8>::call(v));
|
||||
}
|
||||
};
|
||||
|
||||
# if GLM_HAS_BITSCAN_WINDOWS
|
||||
template<qualifier P, bool Aligned>
|
||||
struct compute_log2<4, int, P, false, Aligned>
|
||||
template<qualifier Q, bool Aligned>
|
||||
struct compute_log2<4, int, Q, false, Aligned>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<4, int, P> call(vec<4, int, P> const& v)
|
||||
GLM_FUNC_QUALIFIER static vec<4, int, Q> call(vec<4, int, Q> const& v)
|
||||
{
|
||||
vec<4, int, P> Result;
|
||||
vec<4, int, Q> Result;
|
||||
_BitScanReverse(reinterpret_cast<unsigned long*>(&Result.x), v.x);
|
||||
_BitScanReverse(reinterpret_cast<unsigned long*>(&Result.y), v.y);
|
||||
_BitScanReverse(reinterpret_cast<unsigned long*>(&Result.z), v.z);
|
||||
@@ -40,13 +40,13 @@ namespace detail
|
||||
return static_cast<int>(x + static_cast<genType>(0.5));
|
||||
}
|
||||
|
||||
template<glm::length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, int, P> iround(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, int, Q> iround(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'iround' only accept floating-point inputs");
|
||||
assert(all(lessThanEqual(vec<L, T, P>(0), x)));
|
||||
assert(all(lessThanEqual(vec<L, T, Q>(0), x)));
|
||||
|
||||
return vec<L, int, P>(x + static_cast<T>(0.5));
|
||||
return vec<L, int, Q>(x + static_cast<T>(0.5));
|
||||
}
|
||||
|
||||
template<typename genType>
|
||||
@@ -58,12 +58,12 @@ namespace detail
|
||||
return static_cast<uint>(x + static_cast<genType>(0.5));
|
||||
}
|
||||
|
||||
template<glm::length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, uint, P> uround(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, uint, Q> uround(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'uround' only accept floating-point inputs");
|
||||
assert(all(lessThanEqual(vec<L, T, P>(0), x)));
|
||||
assert(all(lessThanEqual(vec<L, T, Q>(0), x)));
|
||||
|
||||
return vec<L, uint, P>(x + static_cast<T>(0.5));
|
||||
return vec<L, uint, Q>(x + static_cast<T>(0.5));
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@@ -3,35 +3,35 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER mat<3, 3, T, P> affineInverse(mat<3, 3, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<3, 3, T, Q> affineInverse(mat<3, 3, T, Q> const& m)
|
||||
{
|
||||
mat<2, 2, T, P> const Inv(inverse(mat<2, 2, T, P>(m)));
|
||||
mat<2, 2, T, Q> const Inv(inverse(mat<2, 2, T, Q>(m)));
|
||||
|
||||
return mat<3, 3, T, P>(
|
||||
vec<3, T, P>(Inv[0], static_cast<T>(0)),
|
||||
vec<3, T, P>(Inv[1], static_cast<T>(0)),
|
||||
vec<3, T, P>(-Inv * vec<2, T, P>(m[2]), static_cast<T>(1)));
|
||||
return mat<3, 3, T, Q>(
|
||||
vec<3, T, Q>(Inv[0], static_cast<T>(0)),
|
||||
vec<3, T, Q>(Inv[1], static_cast<T>(0)),
|
||||
vec<3, T, Q>(-Inv * vec<2, T, Q>(m[2]), static_cast<T>(1)));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> affineInverse(mat<4, 4, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> affineInverse(mat<4, 4, T, Q> const& m)
|
||||
{
|
||||
mat<3, 3, T, P> const Inv(inverse(mat<3, 3, T, P>(m)));
|
||||
mat<3, 3, T, Q> const Inv(inverse(mat<3, 3, T, Q>(m)));
|
||||
|
||||
return mat<4, 4, T, P>(
|
||||
vec<4, T, P>(Inv[0], static_cast<T>(0)),
|
||||
vec<4, T, P>(Inv[1], static_cast<T>(0)),
|
||||
vec<4, T, P>(Inv[2], static_cast<T>(0)),
|
||||
vec<4, T, P>(-Inv * vec<3, T, P>(m[3]), static_cast<T>(1)));
|
||||
return mat<4, 4, T, Q>(
|
||||
vec<4, T, Q>(Inv[0], static_cast<T>(0)),
|
||||
vec<4, T, Q>(Inv[1], static_cast<T>(0)),
|
||||
vec<4, T, Q>(Inv[2], static_cast<T>(0)),
|
||||
vec<4, T, Q>(-Inv * vec<3, T, Q>(m[3]), static_cast<T>(1)));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER mat<2, 2, T, P> inverseTranspose(mat<2, 2, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<2, 2, T, Q> inverseTranspose(mat<2, 2, T, Q> const& m)
|
||||
{
|
||||
T Determinant = m[0][0] * m[1][1] - m[1][0] * m[0][1];
|
||||
|
||||
mat<2, 2, T, P> Inverse(
|
||||
mat<2, 2, T, Q> Inverse(
|
||||
+ m[1][1] / Determinant,
|
||||
- m[0][1] / Determinant,
|
||||
- m[1][0] / Determinant,
|
||||
@@ -40,15 +40,15 @@ namespace glm
|
||||
return Inverse;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER mat<3, 3, T, P> inverseTranspose(mat<3, 3, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<3, 3, T, Q> inverseTranspose(mat<3, 3, T, Q> const& m)
|
||||
{
|
||||
T Determinant =
|
||||
+ m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1])
|
||||
- m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0])
|
||||
+ m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]);
|
||||
|
||||
mat<3, 3, T, P> Inverse;
|
||||
mat<3, 3, T, Q> Inverse;
|
||||
Inverse[0][0] = + (m[1][1] * m[2][2] - m[2][1] * m[1][2]);
|
||||
Inverse[0][1] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]);
|
||||
Inverse[0][2] = + (m[1][0] * m[2][1] - m[2][0] * m[1][1]);
|
||||
@@ -63,8 +63,8 @@ namespace glm
|
||||
return Inverse;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> inverseTranspose(mat<4, 4, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> inverseTranspose(mat<4, 4, T, Q> const& m)
|
||||
{
|
||||
T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
||||
T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
|
||||
@@ -86,7 +86,7 @@ namespace glm
|
||||
T SubFactor17 = m[1][0] * m[2][2] - m[2][0] * m[1][2];
|
||||
T SubFactor18 = m[1][0] * m[2][1] - m[2][0] * m[1][1];
|
||||
|
||||
mat<4, 4, T, P> Inverse;
|
||||
mat<4, 4, T, Q> Inverse;
|
||||
Inverse[0][0] = + (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02);
|
||||
Inverse[0][1] = - (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04);
|
||||
Inverse[0][2] = + (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05);
|
||||
|
||||
@@ -52,12 +52,12 @@ namespace glm
|
||||
/// // m[3][0] == 1.0f, m[3][1] == 1.0f, m[3][2] == 1.0f, m[3][3] == 1.0f
|
||||
/// @endcode
|
||||
/// @see gtc_matrix_transform
|
||||
/// @see - translate(mat<4, 4, T, P> const& m, T x, T y, T z)
|
||||
/// @see - translate(vec<3, T, P> const& v)
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> translate(
|
||||
mat<4, 4, T, P> const& m,
|
||||
vec<3, T, P> const& v);
|
||||
/// @see - translate(mat<4, 4, T, Q> const& m, T x, T y, T z)
|
||||
/// @see - translate(vec<3, T, Q> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL mat<4, 4, T, Q> translate(
|
||||
mat<4, 4, T, Q> const& m,
|
||||
vec<3, T, Q> const& v);
|
||||
|
||||
/// Builds a rotation 4 * 4 matrix created from an axis vector and an angle.
|
||||
///
|
||||
@@ -66,13 +66,13 @@ namespace glm
|
||||
/// @param axis Rotation axis, recommended to be normalized.
|
||||
/// @tparam T Value type used to build the matrix. Supported: half, float or double.
|
||||
/// @see gtc_matrix_transform
|
||||
/// @see - rotate(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, qualifier P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> rotate(
|
||||
mat<4, 4, T, P> const& m,
|
||||
/// @see - rotate(mat<4, 4, T, Q> const& m, T angle, T x, T y, T z)
|
||||
/// @see - rotate(T angle, vec<3, T, Q> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL mat<4, 4, T, Q> rotate(
|
||||
mat<4, 4, T, Q> const& m,
|
||||
T angle,
|
||||
vec<3, T, P> const& axis);
|
||||
vec<3, T, Q> const& axis);
|
||||
|
||||
/// Builds a scale 4 * 4 matrix created from 3 scalars.
|
||||
///
|
||||
@@ -80,12 +80,12 @@ namespace glm
|
||||
/// @param v Ratio of scaling for each axis.
|
||||
/// @tparam T Value type used to build the matrix. Currently supported: half (not recommended), float or double.
|
||||
/// @see gtc_matrix_transform
|
||||
/// @see - scale(mat<4, 4, T, P> const& m, T x, T y, T z)
|
||||
/// @see - scale(vec<3, T, P> const& v)
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> scale(
|
||||
mat<4, 4, T, P> const& m,
|
||||
vec<3, T, P> const& v);
|
||||
/// @see - scale(mat<4, 4, T, Q> const& m, T x, T y, T z)
|
||||
/// @see - scale(vec<3, T, Q> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL mat<4, 4, T, Q> scale(
|
||||
mat<4, 4, T, Q> const& m,
|
||||
vec<3, T, Q> const& v);
|
||||
|
||||
/// Creates a matrix for an orthographic parallel viewing volume, using the default handedness.
|
||||
///
|
||||
@@ -382,12 +382,12 @@ 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, qualifier P>
|
||||
GLM_FUNC_DECL vec<3, T, P> project(
|
||||
vec<3, T, P> const& obj,
|
||||
mat<4, 4, T, P> const& model,
|
||||
mat<4, 4, T, P> const& proj,
|
||||
vec<4, U, P> const& viewport);
|
||||
template<typename T, typename U, qualifier Q>
|
||||
GLM_FUNC_DECL vec<3, T, Q> project(
|
||||
vec<3, T, Q> const& obj,
|
||||
mat<4, 4, T, Q> const& model,
|
||||
mat<4, 4, T, Q> const& proj,
|
||||
vec<4, U, Q> const& viewport);
|
||||
|
||||
/// Map the specified window coordinates (win.x, win.y, win.z) into object coordinates.
|
||||
///
|
||||
@@ -399,12 +399,12 @@ 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, qualifier P>
|
||||
GLM_FUNC_DECL vec<3, T, P> unProject(
|
||||
vec<3, T, P> const& win,
|
||||
mat<4, 4, T, P> const& model,
|
||||
mat<4, 4, T, P> const& proj,
|
||||
vec<4, U, P> const& viewport);
|
||||
template<typename T, typename U, qualifier Q>
|
||||
GLM_FUNC_DECL vec<3, T, Q> unProject(
|
||||
vec<3, T, Q> const& win,
|
||||
mat<4, 4, T, Q> const& model,
|
||||
mat<4, 4, T, Q> const& proj,
|
||||
vec<4, U, Q> const& viewport);
|
||||
|
||||
/// Define a picking region
|
||||
///
|
||||
@@ -414,11 +414,11 @@ 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, qualifier P, typename U>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> pickMatrix(
|
||||
vec<2, T, P> const& center,
|
||||
vec<2, T, P> const& delta,
|
||||
vec<4, U, P> const& viewport);
|
||||
template<typename T, qualifier Q, typename U>
|
||||
GLM_FUNC_DECL mat<4, 4, T, Q> pickMatrix(
|
||||
vec<2, T, Q> const& center,
|
||||
vec<2, T, Q> const& delta,
|
||||
vec<4, U, Q> const& viewport);
|
||||
|
||||
/// Build a look at view matrix based on the default handedness.
|
||||
///
|
||||
@@ -427,11 +427,11 @@ 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, qualifier P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> lookAt(
|
||||
vec<3, T, P> const& eye,
|
||||
vec<3, T, P> const& center,
|
||||
vec<3, T, P> const& up);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL mat<4, 4, T, Q> lookAt(
|
||||
vec<3, T, Q> const& eye,
|
||||
vec<3, T, Q> const& center,
|
||||
vec<3, T, Q> const& up);
|
||||
|
||||
/// Build a right handed look at view matrix.
|
||||
///
|
||||
@@ -440,11 +440,11 @@ 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, qualifier P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> lookAtRH(
|
||||
vec<3, T, P> const& eye,
|
||||
vec<3, T, P> const& center,
|
||||
vec<3, T, P> const& up);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL mat<4, 4, T, Q> lookAtRH(
|
||||
vec<3, T, Q> const& eye,
|
||||
vec<3, T, Q> const& center,
|
||||
vec<3, T, Q> const& up);
|
||||
|
||||
/// Build a left handed look at view matrix.
|
||||
///
|
||||
@@ -453,11 +453,11 @@ 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, qualifier P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> lookAtLH(
|
||||
vec<3, T, P> const& eye,
|
||||
vec<3, T, P> const& center,
|
||||
vec<3, T, P> const& up);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL mat<4, 4, T, Q> lookAtLH(
|
||||
vec<3, T, Q> const& eye,
|
||||
vec<3, T, Q> const& center,
|
||||
vec<3, T, Q> const& up);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
@@ -7,25 +7,25 @@
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> translate(mat<4, 4, T, P> const& m, vec<3, T, P> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> translate(mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v)
|
||||
{
|
||||
mat<4, 4, T, P> Result(m);
|
||||
mat<4, 4, T, Q> Result(m);
|
||||
Result[3] = m[0] * v[0] + m[1] * v[1] + m[2] * v[2] + m[3];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier 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)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotate(mat<4, 4, T, Q> const& m, T angle, vec<3, T, Q> const& v)
|
||||
{
|
||||
T const a = angle;
|
||||
T const c = cos(a);
|
||||
T const s = sin(a);
|
||||
|
||||
vec<3, T, P> axis(normalize(v));
|
||||
vec<3, T, P> temp((T(1) - c) * axis);
|
||||
vec<3, T, Q> axis(normalize(v));
|
||||
vec<3, T, Q> temp((T(1) - c) * axis);
|
||||
|
||||
mat<4, 4, T, P> Rotate;
|
||||
mat<4, 4, T, Q> Rotate;
|
||||
Rotate[0][0] = c + temp[0] * axis[0];
|
||||
Rotate[0][1] = temp[0] * axis[1] + s * axis[2];
|
||||
Rotate[0][2] = temp[0] * axis[2] - s * axis[1];
|
||||
@@ -38,7 +38,7 @@ namespace glm
|
||||
Rotate[2][1] = temp[2] * axis[1] - s * axis[0];
|
||||
Rotate[2][2] = c + temp[2] * axis[2];
|
||||
|
||||
mat<4, 4, T, P> Result;
|
||||
mat<4, 4, T, Q> Result;
|
||||
Result[0] = m[0] * Rotate[0][0] + m[1] * Rotate[0][1] + m[2] * Rotate[0][2];
|
||||
Result[1] = m[0] * Rotate[1][0] + m[1] * Rotate[1][1] + m[2] * Rotate[1][2];
|
||||
Result[2] = m[0] * Rotate[2][0] + m[1] * Rotate[2][1] + m[2] * Rotate[2][2];
|
||||
@@ -46,15 +46,15 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier 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)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> rotate_slow(mat<4, 4, T, Q> const& m, T angle, vec<3, T, Q> const& v)
|
||||
{
|
||||
T const a = angle;
|
||||
T const c = cos(a);
|
||||
T const s = sin(a);
|
||||
mat<4, 4, T, P> Result;
|
||||
mat<4, 4, T, Q> Result;
|
||||
|
||||
vec<3, T, P> axis = normalize(v);
|
||||
vec<3, T, Q> axis = normalize(v);
|
||||
|
||||
Result[0][0] = c + (static_cast<T>(1) - c) * axis.x * axis.x;
|
||||
Result[0][1] = (static_cast<T>(1) - c) * axis.x * axis.y + s * axis.z;
|
||||
@@ -71,14 +71,14 @@ namespace glm
|
||||
Result[2][2] = c + (static_cast<T>(1) - c) * axis.z * axis.z;
|
||||
Result[2][3] = static_cast<T>(0);
|
||||
|
||||
Result[3] = vec<4, T, P>(0, 0, 0, 1);
|
||||
Result[3] = vec<4, T, Q>(0, 0, 0, 1);
|
||||
return m * Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> scale(mat<4, 4, T, P> const& m, vec<3, T, P> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> scale(mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v)
|
||||
{
|
||||
mat<4, 4, T, P> Result;
|
||||
mat<4, 4, T, Q> Result;
|
||||
Result[0] = m[0] * v[0];
|
||||
Result[1] = m[1] * v[1];
|
||||
Result[2] = m[2] * v[2];
|
||||
@@ -86,10 +86,10 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> scale_slow(mat<4, 4, T, P> const& m, vec<3, T, P> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> scale_slow(mat<4, 4, T, Q> const& m, vec<3, T, Q> const& v)
|
||||
{
|
||||
mat<4, 4, T, P> Result(T(1));
|
||||
mat<4, 4, T, Q> Result(T(1));
|
||||
Result[0][0] = v.x;
|
||||
Result[1][1] = v.y;
|
||||
Result[2][2] = v.z;
|
||||
@@ -435,16 +435,16 @@ namespace glm
|
||||
return tweakedInfinitePerspective(fovy, aspect, zNear, epsilon<T>());
|
||||
}
|
||||
|
||||
template<typename T, typename U, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> project
|
||||
template<typename T, typename U, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, Q> project
|
||||
(
|
||||
vec<3, T, P> const& obj,
|
||||
mat<4, 4, T, P> const& model,
|
||||
mat<4, 4, T, P> const& proj,
|
||||
vec<4, U, P> const& viewport
|
||||
vec<3, T, Q> const& obj,
|
||||
mat<4, 4, T, Q> const& model,
|
||||
mat<4, 4, T, Q> const& proj,
|
||||
vec<4, U, Q> const& viewport
|
||||
)
|
||||
{
|
||||
vec<4, T, P> tmp = vec<4, T, P>(obj, static_cast<T>(1));
|
||||
vec<4, T, Q> tmp = vec<4, T, Q>(obj, static_cast<T>(1));
|
||||
tmp = model * tmp;
|
||||
tmp = proj * tmp;
|
||||
|
||||
@@ -458,21 +458,21 @@ namespace glm
|
||||
tmp[0] = tmp[0] * T(viewport[2]) + T(viewport[0]);
|
||||
tmp[1] = tmp[1] * T(viewport[3]) + T(viewport[1]);
|
||||
|
||||
return vec<3, T, P>(tmp);
|
||||
return vec<3, T, Q>(tmp);
|
||||
}
|
||||
|
||||
template<typename T, typename U, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> unProject
|
||||
template<typename T, typename U, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, Q> unProject
|
||||
(
|
||||
vec<3, T, P> const& win,
|
||||
mat<4, 4, T, P> const& model,
|
||||
mat<4, 4, T, P> const& proj,
|
||||
vec<4, U, P> const& viewport
|
||||
vec<3, T, Q> const& win,
|
||||
mat<4, 4, T, Q> const& model,
|
||||
mat<4, 4, T, Q> const& proj,
|
||||
vec<4, U, Q> const& viewport
|
||||
)
|
||||
{
|
||||
mat<4, 4, T, P> Inverse = inverse(proj * model);
|
||||
mat<4, 4, T, Q> Inverse = inverse(proj * model);
|
||||
|
||||
vec<4, T, P> tmp = vec<4, T, P>(win, T(1));
|
||||
vec<4, T, Q> tmp = vec<4, T, Q>(win, T(1));
|
||||
tmp.x = (tmp.x - T(viewport[0])) / T(viewport[2]);
|
||||
tmp.y = (tmp.y - T(viewport[1])) / T(viewport[3]);
|
||||
# if GLM_DEPTH_CLIP_SPACE == GLM_DEPTH_ZERO_TO_ONE
|
||||
@@ -482,33 +482,33 @@ namespace glm
|
||||
tmp = tmp * static_cast<T>(2) - static_cast<T>(1);
|
||||
# endif
|
||||
|
||||
vec<4, T, P> obj = Inverse * tmp;
|
||||
vec<4, T, Q> obj = Inverse * tmp;
|
||||
obj /= obj.w;
|
||||
|
||||
return vec<3, T, P>(obj);
|
||||
return vec<3, T, Q>(obj);
|
||||
}
|
||||
|
||||
template<typename T, qualifier 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)
|
||||
template<typename T, qualifier Q, typename U>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> pickMatrix(vec<2, T, Q> const& center, vec<2, T, Q> const& delta, vec<4, U, Q> const& viewport)
|
||||
{
|
||||
assert(delta.x > static_cast<T>(0) && delta.y > static_cast<T>(0));
|
||||
mat<4, 4, T, P> Result(static_cast<T>(1));
|
||||
mat<4, 4, T, Q> Result(static_cast<T>(1));
|
||||
|
||||
if(!(delta.x > static_cast<T>(0) && delta.y > static_cast<T>(0)))
|
||||
return Result; // Error
|
||||
|
||||
vec<3, T, P> Temp(
|
||||
vec<3, T, Q> Temp(
|
||||
(static_cast<T>(viewport[2]) - static_cast<T>(2) * (center.x - static_cast<T>(viewport[0]))) / delta.x,
|
||||
(static_cast<T>(viewport[3]) - static_cast<T>(2) * (center.y - static_cast<T>(viewport[1]))) / delta.y,
|
||||
static_cast<T>(0));
|
||||
|
||||
// Translate and scale the picked region to the entire window
|
||||
Result = translate(Result, Temp);
|
||||
return scale(Result, vec<3, T, P>(static_cast<T>(viewport[2]) / delta.x, static_cast<T>(viewport[3]) / delta.y, static_cast<T>(1)));
|
||||
return scale(Result, vec<3, T, Q>(static_cast<T>(viewport[2]) / delta.x, static_cast<T>(viewport[3]) / delta.y, static_cast<T>(1)));
|
||||
}
|
||||
|
||||
template<typename T, qualifier 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)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> lookAt(vec<3, T, Q> const& eye, vec<3, T, Q> const& center, vec<3, T, Q> const& up)
|
||||
{
|
||||
# if GLM_COORDINATE_SYSTEM == GLM_LEFT_HANDED
|
||||
return lookAtLH(eye, center, up);
|
||||
@@ -517,19 +517,19 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> lookAtRH
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> lookAtRH
|
||||
(
|
||||
vec<3, T, P> const& eye,
|
||||
vec<3, T, P> const& center,
|
||||
vec<3, T, P> const& up
|
||||
vec<3, T, Q> const& eye,
|
||||
vec<3, T, Q> const& center,
|
||||
vec<3, T, Q> const& up
|
||||
)
|
||||
{
|
||||
vec<3, T, P> const f(normalize(center - eye));
|
||||
vec<3, T, P> const s(normalize(cross(f, up)));
|
||||
vec<3, T, P> const u(cross(s, f));
|
||||
vec<3, T, Q> const f(normalize(center - eye));
|
||||
vec<3, T, Q> const s(normalize(cross(f, up)));
|
||||
vec<3, T, Q> const u(cross(s, f));
|
||||
|
||||
mat<4, 4, T, P> Result(1);
|
||||
mat<4, 4, T, Q> Result(1);
|
||||
Result[0][0] = s.x;
|
||||
Result[1][0] = s.y;
|
||||
Result[2][0] = s.z;
|
||||
@@ -545,19 +545,19 @@ namespace glm
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> lookAtLH
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> lookAtLH
|
||||
(
|
||||
vec<3, T, P> const& eye,
|
||||
vec<3, T, P> const& center,
|
||||
vec<3, T, P> const& up
|
||||
vec<3, T, Q> const& eye,
|
||||
vec<3, T, Q> const& center,
|
||||
vec<3, T, Q> const& up
|
||||
)
|
||||
{
|
||||
vec<3, T, P> const f(normalize(center - eye));
|
||||
vec<3, T, P> const s(normalize(cross(up, f)));
|
||||
vec<3, T, P> const u(cross(f, s));
|
||||
vec<3, T, Q> const f(normalize(center - eye));
|
||||
vec<3, T, Q> const s(normalize(cross(up, f)));
|
||||
vec<3, T, Q> const u(cross(f, s));
|
||||
|
||||
mat<4, 4, T, P> Result(1);
|
||||
mat<4, 4, T, Q> Result(1);
|
||||
Result[0][0] = s.x;
|
||||
Result[1][0] = s.y;
|
||||
Result[2][0] = s.z;
|
||||
|
||||
@@ -37,22 +37,22 @@ namespace glm
|
||||
|
||||
/// Classic perlin noise.
|
||||
/// @see gtc_noise
|
||||
template<length_t L, typename T, qualifier P>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T perlin(
|
||||
vec<L, T, P> const& p);
|
||||
vec<L, T, Q> const& p);
|
||||
|
||||
/// Periodic perlin noise.
|
||||
/// @see gtc_noise
|
||||
template<length_t L, typename T, qualifier P>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T perlin(
|
||||
vec<L, T, P> const& p,
|
||||
vec<L, T, P> const& rep);
|
||||
vec<L, T, Q> const& p,
|
||||
vec<L, T, Q> const& rep);
|
||||
|
||||
/// Simplex noise.
|
||||
/// @see gtc_noise
|
||||
template<length_t L, typename T, qualifier P>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T simplex(
|
||||
vec<L, T, P> const& p);
|
||||
vec<L, T, Q> const& p);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -475,20 +475,20 @@ namespace glm
|
||||
/// the forth component specifies the 16 most-significant bits.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vec<3, T, P> unpackRGBM(vec<4, T, P> const& p)
|
||||
/// @see vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& p)
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<4, T, P> packRGBM(vec<3, T, P> const& rgb);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<4, T, Q> packRGBM(vec<3, T, Q> const& rgb);
|
||||
|
||||
/// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.
|
||||
/// The first component of the vector is obtained from the 16 least-significant bits of v;
|
||||
/// the forth component is obtained from the 16 most-significant bits of v.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vec<4, T, P> packRGBM(vec<3, float, P> const& v)
|
||||
/// @see vec<4, T, Q> packRGBM(vec<3, float, Q> const& v)
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<3, T, P> unpackRGBM(vec<4, T, P> const& rgbm);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& rgbm);
|
||||
|
||||
/// Returns an unsigned integer vector obtained by converting the components of a floating-point vector
|
||||
/// to the 16-bit floating-point representation found in the OpenGL Specification.
|
||||
@@ -496,48 +496,48 @@ namespace glm
|
||||
/// the forth component specifies the 16 most-significant bits.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vec<L, float, P> unpackHalf(vec<L, uint16, P> const& p)
|
||||
/// @see vec<L, float, Q> unpackHalf(vec<L, uint16, Q> const& p)
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
template<length_t L, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, uint16, P> packHalf(vec<L, float, P> const& v);
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, uint16, Q> packHalf(vec<L, float, Q> const& v);
|
||||
|
||||
/// Returns a floating-point vector with components obtained by reinterpreting an integer vector as 16-bit floating-point numbers and converting them to 32-bit floating-point values.
|
||||
/// The first component of the vector is obtained from the 16 least-significant bits of v;
|
||||
/// the forth component is obtained from the 16 most-significant bits of v.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vec<L, uint16, P> packHalf(vec<L, float, P> const& v)
|
||||
/// @see vec<L, uint16, Q> packHalf(vec<L, float, Q> const& v)
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
template<length_t L, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, float, P> unpackHalf(vec<L, uint16, P> const& p);
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, float, Q> unpackHalf(vec<L, uint16, Q> const& p);
|
||||
|
||||
/// Convert each component of the normalized floating-point vector into unsigned integer values.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vec<L, floatType, P> unpackUnorm(vec<L, intType, P> const& p);
|
||||
template<typename uintType, length_t L, typename floatType, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, uintType, P> packUnorm(vec<L, floatType, P> const& v);
|
||||
/// @see vec<L, floatType, Q> unpackUnorm(vec<L, intType, Q> const& p);
|
||||
template<typename uintType, length_t L, typename floatType, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, uintType, Q> packUnorm(vec<L, floatType, Q> const& v);
|
||||
|
||||
/// Convert a packed integer to a normalized floating-point vector.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vec<L, intType, P> packUnorm(vec<L, floatType, P> const& v)
|
||||
template<typename floatType, length_t L, typename uintType, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, floatType, P> unpackUnorm(vec<L, uintType, P> const& v);
|
||||
/// @see vec<L, intType, Q> packUnorm(vec<L, floatType, Q> const& v)
|
||||
template<typename floatType, length_t L, typename uintType, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, floatType, Q> unpackUnorm(vec<L, uintType, Q> const& v);
|
||||
|
||||
/// Convert each component of the normalized floating-point vector into signed integer values.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vec<L, floatType, P> unpackSnorm(vec<L, intType, P> const& p);
|
||||
template<typename intType, length_t L, typename floatType, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, intType, P> packSnorm(vec<L, floatType, P> const& v);
|
||||
/// @see vec<L, floatType, Q> unpackSnorm(vec<L, intType, Q> const& p);
|
||||
template<typename intType, length_t L, typename floatType, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, intType, Q> packSnorm(vec<L, floatType, Q> const& v);
|
||||
|
||||
/// Convert a packed integer to a normalized floating-point vector.
|
||||
///
|
||||
/// @see gtc_packing
|
||||
/// @see vec<L, intType, P> packSnorm(vec<L, floatType, P> const& v)
|
||||
template<typename floatType, length_t L, typename intType, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, floatType, P> unpackSnorm(vec<L, intType, P> const& v);
|
||||
/// @see vec<L, intType, Q> packSnorm(vec<L, floatType, Q> const& v)
|
||||
template<typename floatType, length_t L, typename intType, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, floatType, Q> unpackSnorm(vec<L, intType, Q> const& v);
|
||||
|
||||
/// Convert each component of the normalized floating-point vector into unsigned integer values.
|
||||
///
|
||||
|
||||
@@ -271,14 +271,14 @@ namespace detail
|
||||
uint32 pack;
|
||||
};
|
||||
|
||||
template<length_t L, qualifier P>
|
||||
template<length_t L, qualifier Q>
|
||||
struct compute_half
|
||||
{};
|
||||
|
||||
template<qualifier P>
|
||||
struct compute_half<1, P>
|
||||
template<qualifier Q>
|
||||
struct compute_half<1, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<1, uint16, P> pack(vec<1, float, P> const& v)
|
||||
GLM_FUNC_QUALIFIER static vec<1, uint16, Q> pack(vec<1, float, Q> const& v)
|
||||
{
|
||||
int16 const Unpack(detail::toFloat16(v.x));
|
||||
u16vec1 Packed;
|
||||
@@ -286,68 +286,68 @@ namespace detail
|
||||
return Packed;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER static vec<1, float, P> unpack(vec<1, uint16, P> const& v)
|
||||
GLM_FUNC_QUALIFIER static vec<1, float, Q> unpack(vec<1, uint16, Q> const& v)
|
||||
{
|
||||
i16vec1 Unpack;
|
||||
memcpy(&Unpack, &v, sizeof(Unpack));
|
||||
return vec<1, float, P>(detail::toFloat32(v.x));
|
||||
return vec<1, float, Q>(detail::toFloat32(v.x));
|
||||
}
|
||||
};
|
||||
|
||||
template<qualifier P>
|
||||
struct compute_half<2, P>
|
||||
template<qualifier Q>
|
||||
struct compute_half<2, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<2, uint16, P> pack(vec<2, float, P> const& v)
|
||||
GLM_FUNC_QUALIFIER static vec<2, uint16, Q> pack(vec<2, float, Q> const& v)
|
||||
{
|
||||
vec<2, int16, P> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y));
|
||||
vec<2, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y));
|
||||
u16vec2 Packed;
|
||||
memcpy(&Packed, &Unpack, sizeof(Packed));
|
||||
return Packed;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER static vec<2, float, P> unpack(vec<2, uint16, P> const& v)
|
||||
GLM_FUNC_QUALIFIER static vec<2, float, Q> unpack(vec<2, uint16, Q> const& v)
|
||||
{
|
||||
i16vec2 Unpack;
|
||||
memcpy(&Unpack, &v, sizeof(Unpack));
|
||||
return vec<2, float, P>(detail::toFloat32(v.x), detail::toFloat32(v.y));
|
||||
return vec<2, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y));
|
||||
}
|
||||
};
|
||||
|
||||
template<qualifier P>
|
||||
struct compute_half<3, P>
|
||||
template<qualifier Q>
|
||||
struct compute_half<3, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<3, uint16, P> pack(vec<3, float, P> const& v)
|
||||
GLM_FUNC_QUALIFIER static vec<3, uint16, Q> pack(vec<3, float, Q> const& v)
|
||||
{
|
||||
vec<3, int16, P> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z));
|
||||
vec<3, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z));
|
||||
u16vec3 Packed;
|
||||
memcpy(&Packed, &Unpack, sizeof(Packed));
|
||||
return Packed;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER static vec<3, float, P> unpack(vec<3, uint16, P> const& v)
|
||||
GLM_FUNC_QUALIFIER static vec<3, float, Q> unpack(vec<3, uint16, Q> const& v)
|
||||
{
|
||||
i16vec3 Unpack;
|
||||
memcpy(&Unpack, &v, sizeof(Unpack));
|
||||
return vec<3, float, P>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z));
|
||||
return vec<3, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z));
|
||||
}
|
||||
};
|
||||
|
||||
template<qualifier P>
|
||||
struct compute_half<4, P>
|
||||
template<qualifier Q>
|
||||
struct compute_half<4, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<4, uint16, P> pack(vec<4, float, P> const& v)
|
||||
GLM_FUNC_QUALIFIER static vec<4, uint16, Q> pack(vec<4, float, Q> const& v)
|
||||
{
|
||||
vec<4, int16, P> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z), detail::toFloat16(v.w));
|
||||
vec<4, int16, Q> const Unpack(detail::toFloat16(v.x), detail::toFloat16(v.y), detail::toFloat16(v.z), detail::toFloat16(v.w));
|
||||
u16vec4 Packed;
|
||||
memcpy(&Packed, &Unpack, sizeof(Packed));
|
||||
return Packed;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER static vec<4, float, P> unpack(vec<4, uint16, P> const& v)
|
||||
GLM_FUNC_QUALIFIER static vec<4, float, Q> unpack(vec<4, uint16, Q> const& v)
|
||||
{
|
||||
i16vec4 Unpack;
|
||||
memcpy(&Unpack, &v, sizeof(Unpack));
|
||||
return vec<4, float, P>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z), detail::toFloat32(v.w));
|
||||
return vec<4, float, Q>(detail::toFloat32(v.x), detail::toFloat32(v.y), detail::toFloat32(v.z), detail::toFloat32(v.w));
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
@@ -641,67 +641,67 @@ namespace detail
|
||||
}
|
||||
|
||||
// Based on Brian Karis http://graphicrants.blogspot.fr/2009/04/rgbm-color-encoding.html
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<4, T, P> packRGBM(vec<3, T, P> const& rgb)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, T, Q> packRGBM(vec<3, T, Q> const& rgb)
|
||||
{
|
||||
vec<3, T, P> const Color(rgb * static_cast<T>(1.0 / 6.0));
|
||||
vec<3, T, Q> const Color(rgb * static_cast<T>(1.0 / 6.0));
|
||||
T Alpha = clamp(max(max(Color.x, Color.y), max(Color.z, static_cast<T>(1e-6))), static_cast<T>(0), static_cast<T>(1));
|
||||
Alpha = ceil(Alpha * static_cast<T>(255.0)) / static_cast<T>(255.0);
|
||||
return vec<4, T, P>(Color / Alpha, Alpha);
|
||||
return vec<4, T, Q>(Color / Alpha, Alpha);
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> unpackRGBM(vec<4, T, P> const& rgbm)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, Q> unpackRGBM(vec<4, T, Q> const& rgbm)
|
||||
{
|
||||
return vec<3, T, P>(rgbm.x, rgbm.y, rgbm.z) * rgbm.w * static_cast<T>(6);
|
||||
return vec<3, T, Q>(rgbm.x, rgbm.y, rgbm.z) * rgbm.w * static_cast<T>(6);
|
||||
}
|
||||
|
||||
template<length_t L, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, uint16, P> packHalf(vec<L, float, P> const& v)
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, uint16, Q> packHalf(vec<L, float, Q> const& v)
|
||||
{
|
||||
return detail::compute_half<L, P>::pack(v);
|
||||
return detail::compute_half<L, Q>::pack(v);
|
||||
}
|
||||
|
||||
template<length_t L, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, float, P> unpackHalf(vec<L, uint16, P> const& v)
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, float, Q> unpackHalf(vec<L, uint16, Q> const& v)
|
||||
{
|
||||
return detail::compute_half<L, P>::unpack(v);
|
||||
return detail::compute_half<L, Q>::unpack(v);
|
||||
}
|
||||
|
||||
template<typename uintType, length_t L, typename floatType, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, uintType, P> packUnorm(vec<L, floatType, P> const& v)
|
||||
template<typename uintType, length_t L, typename floatType, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, uintType, Q> packUnorm(vec<L, floatType, Q> const& v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<uintType>::is_integer, "uintType must be an integer type");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
|
||||
|
||||
return vec<L, uintType, P>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max())));
|
||||
return vec<L, uintType, Q>(round(clamp(v, static_cast<floatType>(0), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<uintType>::max())));
|
||||
}
|
||||
|
||||
template<typename floatType, length_t L, typename uintType, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, floatType, P> unpackUnorm(vec<L, uintType, P> const& v)
|
||||
template<typename floatType, length_t L, typename uintType, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, floatType, Q> unpackUnorm(vec<L, uintType, Q> const& v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<uintType>::is_integer, "uintType must be an integer type");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
|
||||
|
||||
return vec<L, float, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max()));
|
||||
return vec<L, float, Q>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<uintType>::max()));
|
||||
}
|
||||
|
||||
template<typename intType, length_t L, typename floatType, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, intType, P> packSnorm(vec<L, floatType, P> const& v)
|
||||
template<typename intType, length_t L, typename floatType, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, intType, Q> packSnorm(vec<L, floatType, Q> const& v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<intType>::is_integer, "uintType must be an integer type");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
|
||||
|
||||
return vec<L, intType, P>(round(clamp(v , static_cast<floatType>(-1), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<intType>::max())));
|
||||
return vec<L, intType, Q>(round(clamp(v , static_cast<floatType>(-1), static_cast<floatType>(1)) * static_cast<floatType>(std::numeric_limits<intType>::max())));
|
||||
}
|
||||
|
||||
template<typename floatType, length_t L, typename intType, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, floatType, P> unpackSnorm(vec<L, intType, P> const& v)
|
||||
template<typename floatType, length_t L, typename intType, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, floatType, Q> unpackSnorm(vec<L, intType, Q> const& v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<intType>::is_integer, "uintType must be an integer type");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<floatType>::is_iec559, "floatType must be a floating point type");
|
||||
|
||||
return clamp(vec<L, floatType, P>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<intType>::max())), static_cast<floatType>(-1), static_cast<floatType>(1));
|
||||
return clamp(vec<L, floatType, Q>(v) * (static_cast<floatType>(1) / static_cast<floatType>(std::numeric_limits<intType>::max())), static_cast<floatType>(-1), static_cast<floatType>(1));
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER uint8 packUnorm2x4(vec2 const& v)
|
||||
|
||||
@@ -29,12 +29,12 @@ namespace glm
|
||||
/// @addtogroup gtc_quaternion
|
||||
/// @{
|
||||
|
||||
template<typename T, qualifier P = defaultp>
|
||||
template<typename T, qualifier Q = defaultp>
|
||||
struct tquat
|
||||
{
|
||||
// -- Implementation detail --
|
||||
|
||||
typedef tquat<T, P> type;
|
||||
typedef tquat<T, Q> type;
|
||||
typedef T value_type;
|
||||
|
||||
// -- Data --
|
||||
@@ -78,13 +78,13 @@ namespace glm
|
||||
// -- Implicit basic constructors --
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR tquat() GLM_DEFAULT;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, P> const& q) GLM_DEFAULT;
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, Q> const& q) GLM_DEFAULT;
|
||||
template<qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR tquat(tquat<T, Q> const& q);
|
||||
|
||||
// -- Explicit basic constructors --
|
||||
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR tquat(T s, vec<3, T, P> const& v);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR tquat(T s, vec<3, T, Q> const& v);
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR tquat(T w, T x, T y, T z);
|
||||
|
||||
// -- Conversion constructors --
|
||||
@@ -94,8 +94,8 @@ namespace glm
|
||||
|
||||
/// Explicit conversion operators
|
||||
# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
|
||||
GLM_FUNC_DECL explicit operator mat<3, 3, T, P>();
|
||||
GLM_FUNC_DECL explicit operator mat<4, 4, T, P>();
|
||||
GLM_FUNC_DECL explicit operator mat<3, 3, T, Q>();
|
||||
GLM_FUNC_DECL explicit operator mat<4, 4, T, Q>();
|
||||
# endif
|
||||
|
||||
/// Create a quaternion from two normalized axis
|
||||
@@ -104,99 +104,99 @@ namespace glm
|
||||
/// @param v A second normalized axis
|
||||
/// @see gtc_quaternion
|
||||
/// @see http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors
|
||||
GLM_FUNC_DECL tquat(vec<3, T, P> const& u, vec<3, T, P> const& v);
|
||||
GLM_FUNC_DECL tquat(vec<3, T, Q> const& u, vec<3, T, Q> const& v);
|
||||
|
||||
/// Build a quaternion from euler angles (pitch, yaw, roll), in radians.
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tquat(vec<3, T, P> const& eulerAngles);
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tquat(mat<3, 3, T, P> const& q);
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tquat(mat<4, 4, T, P> const& q);
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tquat(vec<3, T, Q> const& eulerAngles);
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tquat(mat<3, 3, T, Q> const& q);
|
||||
GLM_FUNC_DECL GLM_EXPLICIT tquat(mat<4, 4, T, Q> const& q);
|
||||
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
GLM_FUNC_DECL tquat<T, P> & operator=(tquat<T, P> const& q) GLM_DEFAULT;
|
||||
GLM_FUNC_DECL tquat<T, Q> & operator=(tquat<T, Q> const& q) GLM_DEFAULT;
|
||||
|
||||
template<typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator=(tquat<U, P> const& q);
|
||||
GLM_FUNC_DECL tquat<T, Q> & operator=(tquat<U, Q> const& q);
|
||||
template<typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator+=(tquat<U, P> const& q);
|
||||
GLM_FUNC_DECL tquat<T, Q> & operator+=(tquat<U, Q> const& q);
|
||||
template<typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator-=(tquat<U, P> const& q);
|
||||
GLM_FUNC_DECL tquat<T, Q> & operator-=(tquat<U, Q> const& q);
|
||||
template<typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator*=(tquat<U, P> const& q);
|
||||
GLM_FUNC_DECL tquat<T, Q> & operator*=(tquat<U, Q> const& q);
|
||||
template<typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator*=(U s);
|
||||
GLM_FUNC_DECL tquat<T, Q> & operator*=(U s);
|
||||
template<typename U>
|
||||
GLM_FUNC_DECL tquat<T, P> & operator/=(U s);
|
||||
GLM_FUNC_DECL tquat<T, Q> & operator/=(U s);
|
||||
};
|
||||
|
||||
// -- Unary bit operators --
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator+(tquat<T, P> const& q);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> operator+(tquat<T, Q> const& q);
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator-(tquat<T, P> const& q);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> operator-(tquat<T, Q> const& q);
|
||||
|
||||
// -- Binary operators --
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator+(tquat<T, P> const& q, tquat<T, P> const& p);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> operator+(tquat<T, Q> const& q, tquat<T, Q> const& p);
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator*(tquat<T, P> const& q, tquat<T, P> const& p);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> operator*(tquat<T, Q> const& q, tquat<T, Q> const& p);
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<3, T, P> operator*(tquat<T, P> const& q, vec<3, T, P> const& v);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<3, T, Q> operator*(tquat<T, Q> const& q, vec<3, T, Q> const& v);
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<3, T, P> operator*(vec<3, T, P> const& v, tquat<T, P> const& q);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<3, T, Q> operator*(vec<3, T, Q> const& v, tquat<T, Q> const& q);
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<4, T, P> operator*(tquat<T, P> const& q, vec<4, T, P> const& v);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<4, T, Q> operator*(tquat<T, Q> const& q, vec<4, T, Q> const& v);
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<4, T, P> operator*(vec<4, T, P> const& v, tquat<T, P> const& q);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<4, T, Q> operator*(vec<4, T, Q> const& v, tquat<T, Q> const& q);
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator*(tquat<T, P> const& q, T const& s);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> operator*(tquat<T, Q> const& q, T const& s);
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator*(T const& s, tquat<T, P> const& q);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> operator*(T const& s, tquat<T, Q> const& q);
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> operator/(tquat<T, P> const& q, T const& s);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> operator/(tquat<T, Q> const& q, T const& s);
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL bool operator==(tquat<T, P> const& q1, tquat<T, P> const& q2);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL bool operator==(tquat<T, Q> const& q1, tquat<T, Q> const& q2);
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL bool operator!=(tquat<T, P> const& q1, tquat<T, P> const& q2);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL bool operator!=(tquat<T, Q> const& q1, tquat<T, Q> const& q2);
|
||||
|
||||
/// Returns the length of the quaternion.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL T length(tquat<T, P> const& q);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T length(tquat<T, Q> const& q);
|
||||
|
||||
/// Returns the normalized quaternion.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> normalize(tquat<T, P> const& q);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> normalize(tquat<T, Q> const& q);
|
||||
|
||||
/// Returns dot product of q1 and q2, i.e., q1[0] * q2[0] + q1[1] * q2[1] + ...
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL T dot(tquat<T, P> const& x, tquat<T, P> const& y);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T dot(tquat<T, Q> const& x, tquat<T, Q> const& y);
|
||||
|
||||
/// Spherical linear interpolation of two quaternions.
|
||||
/// The interpolation is oriented and the rotation is performed at constant speed.
|
||||
@@ -207,10 +207,10 @@ namespace glm
|
||||
/// @param a Interpolation factor. The interpolation is defined beyond the range [0, 1].
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see - slerp(tquat<T, P> const& x, tquat<T, P> const& y, T const& a)
|
||||
/// @see - slerp(tquat<T, Q> const& x, tquat<T, Q> const& y, T const& a)
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> mix(tquat<T, P> const& x, tquat<T, P> const& y, T a);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> mix(tquat<T, Q> const& x, tquat<T, Q> const& y, T a);
|
||||
|
||||
/// Linear interpolation of two quaternions.
|
||||
/// The interpolation is oriented.
|
||||
@@ -221,8 +221,8 @@ namespace glm
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> lerp(tquat<T, P> const& x, tquat<T, P> const& y, T a);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> lerp(tquat<T, Q> const& x, tquat<T, Q> const& y, T a);
|
||||
|
||||
/// Spherical linear interpolation of two quaternions.
|
||||
/// The interpolation always take the short path and the rotation is performed at constant speed.
|
||||
@@ -233,24 +233,24 @@ namespace glm
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> slerp(tquat<T, P> const& x, tquat<T, P> const& y, T a);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> slerp(tquat<T, Q> const& x, tquat<T, Q> const& y, T a);
|
||||
|
||||
/// Returns the q conjugate.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> conjugate(tquat<T, P> const& q);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> conjugate(tquat<T, Q> const& q);
|
||||
|
||||
/// Returns the q inverse.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> inverse(tquat<T, P> const& q);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> inverse(tquat<T, Q> const& q);
|
||||
|
||||
/// Rotates a quaternion from a vector of 3 components axis and an angle.
|
||||
///
|
||||
@@ -260,8 +260,8 @@ namespace glm
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> rotate(tquat<T, P> const& q, T const& angle, vec<3, T, P> const& axis);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> rotate(tquat<T, Q> const& q, T const& angle, vec<3, T, Q> const& axis);
|
||||
|
||||
/// Returns euler angles, pitch as x, yaw as y, roll as z.
|
||||
/// The result is expressed in radians.
|
||||
@@ -269,80 +269,80 @@ namespace glm
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<3, T, P> eulerAngles(tquat<T, P> const& x);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<3, T, Q> eulerAngles(tquat<T, Q> const& x);
|
||||
|
||||
/// Returns roll value of euler angles expressed in radians.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL T roll(tquat<T, P> const& x);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T roll(tquat<T, Q> const& x);
|
||||
|
||||
/// Returns pitch value of euler angles expressed in radians.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL T pitch(tquat<T, P> const& x);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T pitch(tquat<T, Q> const& x);
|
||||
|
||||
/// Returns yaw value of euler angles expressed in radians.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL T yaw(tquat<T, P> const& x);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T yaw(tquat<T, Q> const& x);
|
||||
|
||||
/// Converts a quaternion to a 3 * 3 matrix.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL mat<3, 3, T, P> mat3_cast(tquat<T, P> const& x);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL mat<3, 3, T, Q> mat3_cast(tquat<T, Q> const& x);
|
||||
|
||||
/// Converts a quaternion to a 4 * 4 matrix.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL mat<4, 4, T, P> mat4_cast(tquat<T, P> const& x);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL mat<4, 4, T, Q> mat4_cast(tquat<T, Q> const& x);
|
||||
|
||||
/// Converts a 3 * 3 matrix to a quaternion.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> quat_cast(mat<3, 3, T, P> const& x);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> quat_cast(mat<3, 3, T, Q> const& x);
|
||||
|
||||
/// Converts a 4 * 4 matrix to a quaternion.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> quat_cast(mat<4, 4, T, P> const& x);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> quat_cast(mat<4, 4, T, Q> const& x);
|
||||
|
||||
/// Returns the quaternion rotation angle.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL T angle(tquat<T, P> const& x);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T angle(tquat<T, Q> const& x);
|
||||
|
||||
/// Returns the q rotation axis.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<3, T, P> axis(tquat<T, P> const& x);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<3, T, Q> axis(tquat<T, Q> const& x);
|
||||
|
||||
/// Build a quaternion from an angle and a normalized axis.
|
||||
///
|
||||
@@ -351,56 +351,56 @@ namespace glm
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL tquat<T, P> angleAxis(T const& angle, vec<3, T, P> const& axis);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL tquat<T, Q> angleAxis(T const& angle, vec<3, T, Q> const& axis);
|
||||
|
||||
/// Returns the component-wise comparison result of x < y.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> lessThan(tquat<T, P> const& x, tquat<T, P> const& y);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<4, bool, Q> lessThan(tquat<T, Q> const& x, tquat<T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x <= y.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> lessThanEqual(tquat<T, P> const& x, tquat<T, P> const& y);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<4, bool, Q> lessThanEqual(tquat<T, Q> const& x, tquat<T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x > y.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> greaterThan(tquat<T, P> const& x, tquat<T, P> const& y);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<4, bool, Q> greaterThan(tquat<T, Q> const& x, tquat<T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x >= y.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> greaterThanEqual(tquat<T, P> const& x, tquat<T, P> const& y);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<4, bool, Q> greaterThanEqual(tquat<T, Q> const& x, tquat<T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x == y.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> equal(tquat<T, P> const& x, tquat<T, P> const& y);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<4, bool, Q> equal(tquat<T, Q> const& x, tquat<T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x != y.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> notEqual(tquat<T, P> const& x, tquat<T, P> const& y);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<4, bool, Q> notEqual(tquat<T, Q> const& x, tquat<T, Q> const& y);
|
||||
|
||||
/// Returns true if x holds a NaN (not a number)
|
||||
/// representation in the underlying implementation's set of
|
||||
@@ -413,8 +413,8 @@ namespace glm
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> isnan(tquat<T, P> const& x);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<4, bool, Q> isnan(tquat<T, Q> const& x);
|
||||
|
||||
/// Returns true if x holds a positive infinity or negative
|
||||
/// infinity representation in the underlying implementation's
|
||||
@@ -425,8 +425,8 @@ namespace glm
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see gtc_quaternion
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<4, bool, P> isinf(tquat<T, P> const& x);
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<4, bool, Q> isinf(tquat<T, Q> const& x);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
||||
@@ -11,73 +11,73 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template<typename T, qualifier P, bool Aligned>
|
||||
struct compute_dot<tquat<T, P>, T, Aligned>
|
||||
template<typename T, qualifier Q, bool Aligned>
|
||||
struct compute_dot<tquat<T, Q>, T, Aligned>
|
||||
{
|
||||
static GLM_FUNC_QUALIFIER T call(tquat<T, P> const& a, tquat<T, P> const& b)
|
||||
static GLM_FUNC_QUALIFIER T call(tquat<T, Q> const& a, tquat<T, Q> const& b)
|
||||
{
|
||||
vec<4, T, P> tmp(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w);
|
||||
vec<4, T, Q> tmp(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w);
|
||||
return (tmp.x + tmp.y) + (tmp.z + tmp.w);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, qualifier P, bool Aligned>
|
||||
template<typename T, qualifier Q, bool Aligned>
|
||||
struct compute_quat_add
|
||||
{
|
||||
static tquat<T, P> call(tquat<T, P> const& q, tquat<T, P> const& p)
|
||||
static tquat<T, Q> call(tquat<T, Q> const& q, tquat<T, Q> const& p)
|
||||
{
|
||||
return tquat<T, P>(q.w + p.w, q.x + p.x, q.y + p.y, q.z + p.z);
|
||||
return tquat<T, Q>(q.w + p.w, q.x + p.x, q.y + p.y, q.z + p.z);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, qualifier P, bool Aligned>
|
||||
template<typename T, qualifier Q, bool Aligned>
|
||||
struct compute_quat_sub
|
||||
{
|
||||
static tquat<T, P> call(tquat<T, P> const& q, tquat<T, P> const& p)
|
||||
static tquat<T, Q> call(tquat<T, Q> const& q, tquat<T, Q> const& p)
|
||||
{
|
||||
return tquat<T, P>(q.w - p.w, q.x - p.x, q.y - p.y, q.z - p.z);
|
||||
return tquat<T, Q>(q.w - p.w, q.x - p.x, q.y - p.y, q.z - p.z);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, qualifier P, bool Aligned>
|
||||
template<typename T, qualifier Q, bool Aligned>
|
||||
struct compute_quat_mul_scalar
|
||||
{
|
||||
static tquat<T, P> call(tquat<T, P> const& q, T s)
|
||||
static tquat<T, Q> call(tquat<T, Q> const& q, T s)
|
||||
{
|
||||
return tquat<T, P>(q.w * s, q.x * s, q.y * s, q.z * s);
|
||||
return tquat<T, Q>(q.w * s, q.x * s, q.y * s, q.z * s);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, qualifier P, bool Aligned>
|
||||
template<typename T, qualifier Q, bool Aligned>
|
||||
struct compute_quat_div_scalar
|
||||
{
|
||||
static tquat<T, P> call(tquat<T, P> const& q, T s)
|
||||
static tquat<T, Q> call(tquat<T, Q> const& q, T s)
|
||||
{
|
||||
return tquat<T, P>(q.w / s, q.x / s, q.y / s, q.z / s);
|
||||
return tquat<T, Q>(q.w / s, q.x / s, q.y / s, q.z / s);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T, qualifier P, bool Aligned>
|
||||
template<typename T, qualifier Q, bool Aligned>
|
||||
struct compute_quat_mul_vec4
|
||||
{
|
||||
static vec<4, T, P> call(tquat<T, P> const& q, vec<4, T, P> const& v)
|
||||
static vec<4, T, Q> call(tquat<T, Q> const& q, vec<4, T, Q> const& v)
|
||||
{
|
||||
return vec<4, T, P>(q * vec<3, T, P>(v), v.w);
|
||||
return vec<4, T, Q>(q * vec<3, T, Q>(v), v.w);
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
// -- Component accesses --
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T & tquat<T, P>::operator[](typename tquat<T, P>::length_type i)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T & tquat<T, Q>::operator[](typename tquat<T, Q>::length_type i)
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
return (&x)[i];
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const& tquat<T, P>::operator[](typename tquat<T, P>::length_type i) const
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const& tquat<T, Q>::operator[](typename tquat<T, Q>::length_type i) const
|
||||
{
|
||||
assert(i >= 0 && i < this->length());
|
||||
return (&x)[i];
|
||||
@@ -86,41 +86,41 @@ namespace detail
|
||||
// -- Implicit basic constructors --
|
||||
|
||||
# if !GLM_HAS_DEFAULTED_FUNCTIONS
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat()
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, Q>::tquat()
|
||||
{}
|
||||
# endif
|
||||
|
||||
# if !GLM_HAS_DEFAULTED_FUNCTIONS
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, Q>::tquat(tquat<T, Q> const& q)
|
||||
: x(q.x), y(q.y), z(q.z), w(q.w)
|
||||
{}
|
||||
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
|
||||
|
||||
template<typename T, qualifier P>
|
||||
template<qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(tquat<T, Q> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
template<qualifier P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, Q>::tquat(tquat<T, P> const& q)
|
||||
: x(q.x), y(q.y), z(q.z), w(q.w)
|
||||
{}
|
||||
|
||||
// -- Explicit basic constructors --
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(T s, vec<3, T, P> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, Q>::tquat(T s, vec<3, T, Q> const& v)
|
||||
: x(v.x), y(v.y), z(v.z), w(s)
|
||||
{}
|
||||
|
||||
template <typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(T _w, T _x, T _y, T _z)
|
||||
template <typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, Q>::tquat(T _w, T _x, T _y, T _z)
|
||||
: x(_x), y(_y), z(_z), w(_w)
|
||||
{}
|
||||
|
||||
// -- Conversion constructors --
|
||||
|
||||
template<typename T, qualifier P>
|
||||
template<typename U, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, P>::tquat(tquat<U, Q> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U, qualifier P>
|
||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR tquat<T, Q>::tquat(tquat<U, P> const& q)
|
||||
: x(static_cast<T>(q.x))
|
||||
, y(static_cast<T>(q.y))
|
||||
, z(static_cast<T>(q.z))
|
||||
@@ -145,21 +145,21 @@ namespace detail
|
||||
// this->z = c.x * c.y * s.z - s.x * s.y * c.z;
|
||||
//}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(vec<3, T, P> const& u, vec<3, T, P> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q>::tquat(vec<3, T, Q> const& u, vec<3, T, Q> const& v)
|
||||
{
|
||||
vec<3, T, P> const LocalW(cross(u, v));
|
||||
T Dot = detail::compute_dot<vec<3, T, P>, T, detail::is_aligned<P>::value>::call(u, v);
|
||||
tquat<T, P> q(T(1) + Dot, LocalW.x, LocalW.y, LocalW.z);
|
||||
vec<3, T, Q> const LocalW(cross(u, v));
|
||||
T Dot = detail::compute_dot<vec<3, T, Q>, T, detail::is_aligned<Q>::value>::call(u, v);
|
||||
tquat<T, Q> q(T(1) + Dot, LocalW.x, LocalW.y, LocalW.z);
|
||||
|
||||
*this = normalize(q);
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(vec<3, T, P> const& eulerAngle)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q>::tquat(vec<3, T, Q> const& eulerAngle)
|
||||
{
|
||||
vec<3, T, P> c = glm::cos(eulerAngle * T(0.5));
|
||||
vec<3, T, P> s = glm::sin(eulerAngle * T(0.5));
|
||||
vec<3, T, Q> c = glm::cos(eulerAngle * T(0.5));
|
||||
vec<3, T, Q> s = glm::sin(eulerAngle * T(0.5));
|
||||
|
||||
this->w = c.x * c.y * c.z + s.x * s.y * s.z;
|
||||
this->x = s.x * c.y * c.z - c.x * s.y * s.z;
|
||||
@@ -167,40 +167,40 @@ namespace detail
|
||||
this->z = c.x * c.y * s.z - s.x * s.y * c.z;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(mat<3, 3, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q>::tquat(mat<3, 3, T, Q> const& m)
|
||||
{
|
||||
*this = quat_cast(m);
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::tquat(mat<4, 4, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q>::tquat(mat<4, 4, T, Q> const& m)
|
||||
{
|
||||
*this = quat_cast(m);
|
||||
}
|
||||
|
||||
# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::operator mat<3, 3, T, P>()
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q>::operator mat<3, 3, T, Q>()
|
||||
{
|
||||
return mat3_cast(*this);
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P>::operator mat<4, 4, T, P>()
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q>::operator mat<4, 4, T, Q>()
|
||||
{
|
||||
return mat4_cast(*this);
|
||||
}
|
||||
# endif//GLM_HAS_EXPLICIT_CONVERSION_OPERATORS
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> conjugate(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> conjugate(tquat<T, Q> const& q)
|
||||
{
|
||||
return tquat<T, P>(q.w, -q.x, -q.y, -q.z);
|
||||
return tquat<T, Q>(q.w, -q.x, -q.y, -q.z);
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> inverse(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> inverse(tquat<T, Q> const& q)
|
||||
{
|
||||
return conjugate(q) / dot(q, q);
|
||||
}
|
||||
@@ -208,8 +208,8 @@ namespace detail
|
||||
// -- Unary arithmetic operators --
|
||||
|
||||
# if !GLM_HAS_DEFAULTED_FUNCTIONS
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator=(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator=(tquat<T, Q> const& q)
|
||||
{
|
||||
this->w = q.w;
|
||||
this->x = q.x;
|
||||
@@ -219,9 +219,9 @@ namespace detail
|
||||
}
|
||||
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
|
||||
|
||||
template<typename T, qualifier P>
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator=(tquat<U, P> const& q)
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator=(tquat<U, Q> const& q)
|
||||
{
|
||||
this->w = static_cast<T>(q.w);
|
||||
this->x = static_cast<T>(q.x);
|
||||
@@ -230,26 +230,26 @@ namespace detail
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator+=(tquat<U, P> const& q)
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator+=(tquat<U, Q> const& q)
|
||||
{
|
||||
return (*this = detail::compute_quat_add<T, P, detail::is_aligned<P>::value>::call(*this, tquat<T, P>(q)));
|
||||
return (*this = detail::compute_quat_add<T, Q, detail::is_aligned<Q>::value>::call(*this, tquat<T, Q>(q)));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator-=(tquat<U, P> const& q)
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator-=(tquat<U, Q> const& q)
|
||||
{
|
||||
return (*this = detail::compute_quat_sub<T, P, detail::is_aligned<P>::value>::call(*this, tquat<T, P>(q)));
|
||||
return (*this = detail::compute_quat_sub<T, Q, detail::is_aligned<Q>::value>::call(*this, tquat<T, Q>(q)));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator*=(tquat<U, P> const& r)
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator*=(tquat<U, Q> const& r)
|
||||
{
|
||||
tquat<T, P> const p(*this);
|
||||
tquat<T, P> const q(r);
|
||||
tquat<T, Q> const p(*this);
|
||||
tquat<T, Q> const q(r);
|
||||
|
||||
this->w = p.w * q.w - p.x * q.x - p.y * q.y - p.z * q.z;
|
||||
this->x = p.w * q.x + p.x * q.w + p.y * q.z - p.z * q.y;
|
||||
@@ -258,132 +258,132 @@ namespace detail
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator*=(U s)
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator*=(U s)
|
||||
{
|
||||
return (*this = detail::compute_quat_mul_scalar<T, P, detail::is_aligned<P>::value>::call(*this, static_cast<U>(s)));
|
||||
return (*this = detail::compute_quat_mul_scalar<T, Q, detail::is_aligned<Q>::value>::call(*this, static_cast<U>(s)));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
template<typename T, qualifier Q>
|
||||
template<typename U>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> & tquat<T, P>::operator/=(U s)
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> & tquat<T, Q>::operator/=(U s)
|
||||
{
|
||||
return (*this = detail::compute_quat_div_scalar<T, P, detail::is_aligned<P>::value>::call(*this, static_cast<U>(s)));
|
||||
return (*this = detail::compute_quat_div_scalar<T, Q, detail::is_aligned<Q>::value>::call(*this, static_cast<U>(s)));
|
||||
}
|
||||
|
||||
// -- Unary bit operators --
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator+(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> operator+(tquat<T, Q> const& q)
|
||||
{
|
||||
return q;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator-(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> operator-(tquat<T, Q> const& q)
|
||||
{
|
||||
return tquat<T, P>(-q.w, -q.x, -q.y, -q.z);
|
||||
return tquat<T, Q>(-q.w, -q.x, -q.y, -q.z);
|
||||
}
|
||||
|
||||
// -- Binary operators --
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator+(tquat<T, P> const& q, tquat<T, P> const& p)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> operator+(tquat<T, Q> const& q, tquat<T, Q> const& p)
|
||||
{
|
||||
return tquat<T, P>(q) += p;
|
||||
return tquat<T, Q>(q) += p;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator*(tquat<T, P> const& q, tquat<T, P> const& p)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> operator*(tquat<T, Q> const& q, tquat<T, Q> const& p)
|
||||
{
|
||||
return tquat<T, P>(q) *= p;
|
||||
return tquat<T, Q>(q) *= p;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> operator*(tquat<T, P> const& q, vec<3, T, P> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, Q> operator*(tquat<T, Q> const& q, vec<3, T, Q> const& v)
|
||||
{
|
||||
vec<3, T, P> const QuatVector(q.x, q.y, q.z);
|
||||
vec<3, T, P> const uv(glm::cross(QuatVector, v));
|
||||
vec<3, T, P> const uuv(glm::cross(QuatVector, uv));
|
||||
vec<3, T, Q> const QuatVector(q.x, q.y, q.z);
|
||||
vec<3, T, Q> const uv(glm::cross(QuatVector, v));
|
||||
vec<3, T, Q> const uuv(glm::cross(QuatVector, uv));
|
||||
|
||||
return v + ((uv * q.w) + uuv) * static_cast<T>(2);
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> operator*(vec<3, T, P> const& v, tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, Q> operator*(vec<3, T, Q> const& v, tquat<T, Q> const& q)
|
||||
{
|
||||
return glm::inverse(q) * v;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<4, T, P> operator*(tquat<T, P> const& q, vec<4, T, P> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, T, Q> operator*(tquat<T, Q> const& q, vec<4, T, Q> const& v)
|
||||
{
|
||||
return detail::compute_quat_mul_vec4<T, P, detail::is_aligned<P>::value>::call(q, v);
|
||||
return detail::compute_quat_mul_vec4<T, Q, detail::is_aligned<Q>::value>::call(q, v);
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<4, T, P> operator*(vec<4, T, P> const& v, tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, T, Q> operator*(vec<4, T, Q> const& v, tquat<T, Q> const& q)
|
||||
{
|
||||
return glm::inverse(q) * v;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator*(tquat<T, P> const& q, T const& s)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> operator*(tquat<T, Q> const& q, T const& s)
|
||||
{
|
||||
return tquat<T, P>(
|
||||
return tquat<T, Q>(
|
||||
q.w * s, q.x * s, q.y * s, q.z * s);
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator*(T const& s, tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> operator*(T const& s, tquat<T, Q> const& q)
|
||||
{
|
||||
return q * s;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> operator/(tquat<T, P> const& q, T const& s)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> operator/(tquat<T, Q> const& q, T const& s)
|
||||
{
|
||||
return tquat<T, P>(
|
||||
return tquat<T, Q>(
|
||||
q.w / s, q.x / s, q.y / s, q.z / s);
|
||||
}
|
||||
|
||||
// -- Boolean operators --
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER bool operator==(tquat<T, P> const& q1, tquat<T, P> const& q2)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER bool operator==(tquat<T, Q> const& q1, tquat<T, Q> const& q2)
|
||||
{
|
||||
return all(epsilonEqual(q1, q2, epsilon<T>()));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER bool operator!=(tquat<T, P> const& q1, tquat<T, P> const& q2)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER bool operator!=(tquat<T, Q> const& q1, tquat<T, Q> const& q2)
|
||||
{
|
||||
return any(epsilonNotEqual(q1, q2, epsilon<T>()));
|
||||
}
|
||||
|
||||
// -- Operations --
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T length(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T length(tquat<T, Q> const& q)
|
||||
{
|
||||
return glm::sqrt(dot(q, q));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> normalize(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> normalize(tquat<T, Q> const& q)
|
||||
{
|
||||
T len = length(q);
|
||||
if(len <= T(0)) // Problem
|
||||
return tquat<T, P>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
|
||||
return tquat<T, Q>(static_cast<T>(1), static_cast<T>(0), static_cast<T>(0), static_cast<T>(0));
|
||||
T oneOverLen = T(1) / len;
|
||||
return tquat<T, P>(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen);
|
||||
return tquat<T, Q>(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen);
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> cross(tquat<T, P> const& q1, tquat<T, P> const& q2)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> cross(tquat<T, Q> const& q1, tquat<T, Q> const& q2)
|
||||
{
|
||||
return tquat<T, P>(
|
||||
return tquat<T, Q>(
|
||||
q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z,
|
||||
q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y,
|
||||
q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z,
|
||||
@@ -391,14 +391,14 @@ namespace detail
|
||||
}
|
||||
/*
|
||||
// (x * sin(1 - a) * angle / sin(angle)) + (y * sin(a) * angle / sin(angle))
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> mix(tquat<T, P> const& x, tquat<T, P> const& y, T const& a)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> mix(tquat<T, Q> const& x, tquat<T, Q> const& y, T const& a)
|
||||
{
|
||||
if(a <= T(0)) return x;
|
||||
if(a >= T(1)) return y;
|
||||
|
||||
float fCos = dot(x, y);
|
||||
tquat<T, P> y2(y); //BUG!!! tquat<T, P> y2;
|
||||
tquat<T, Q> y2(y); //BUG!!! tquat<T, Q> y2;
|
||||
if(fCos < T(0))
|
||||
{
|
||||
y2 = -y;
|
||||
@@ -421,18 +421,18 @@ namespace detail
|
||||
k1 = sin((T(0) + a) * fAngle) * fOneOverSin;
|
||||
}
|
||||
|
||||
return tquat<T, P>(
|
||||
return tquat<T, Q>(
|
||||
k0 * x.w + k1 * y2.w,
|
||||
k0 * x.x + k1 * y2.x,
|
||||
k0 * x.y + k1 * y2.y,
|
||||
k0 * x.z + k1 * y2.z);
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> mix2
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> mix2
|
||||
(
|
||||
tquat<T, P> const& x,
|
||||
tquat<T, P> const& y,
|
||||
tquat<T, Q> const& x,
|
||||
tquat<T, Q> const& y,
|
||||
T const& a
|
||||
)
|
||||
{
|
||||
@@ -466,8 +466,8 @@ namespace detail
|
||||
}
|
||||
*/
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> mix(tquat<T, P> const& x, tquat<T, P> const& y, T a)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> mix(tquat<T, Q> const& x, tquat<T, Q> const& y, T a)
|
||||
{
|
||||
T cosTheta = dot(x, y);
|
||||
|
||||
@@ -475,7 +475,7 @@ namespace detail
|
||||
if(cosTheta > T(1) - epsilon<T>())
|
||||
{
|
||||
// Linear interpolation
|
||||
return tquat<T, P>(
|
||||
return tquat<T, Q>(
|
||||
mix(x.w, y.w, a),
|
||||
mix(x.x, y.x, a),
|
||||
mix(x.y, y.y, a),
|
||||
@@ -489,8 +489,8 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> lerp(tquat<T, P> const& x, tquat<T, P> const& y, T a)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> lerp(tquat<T, Q> const& x, tquat<T, Q> const& y, T a)
|
||||
{
|
||||
// Lerp is only defined in [0, 1]
|
||||
assert(a >= static_cast<T>(0));
|
||||
@@ -499,10 +499,10 @@ namespace detail
|
||||
return x * (T(1) - a) + (y * a);
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> slerp(tquat<T, P> const& x, tquat<T, P> const& y, T a)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> slerp(tquat<T, Q> const& x, tquat<T, Q> const& y, T a)
|
||||
{
|
||||
tquat<T, P> z = y;
|
||||
tquat<T, Q> z = y;
|
||||
|
||||
T cosTheta = dot(x, y);
|
||||
|
||||
@@ -518,7 +518,7 @@ namespace detail
|
||||
if(cosTheta > T(1) - epsilon<T>())
|
||||
{
|
||||
// Linear interpolation
|
||||
return tquat<T, P>(
|
||||
return tquat<T, Q>(
|
||||
mix(x.w, z.w, a),
|
||||
mix(x.x, z.x, a),
|
||||
mix(x.y, z.y, a),
|
||||
@@ -532,10 +532,10 @@ namespace detail
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> rotate(tquat<T, P> const& q, T const& angle, vec<3, T, P> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> rotate(tquat<T, Q> const& q, T const& angle, vec<3, T, Q> const& v)
|
||||
{
|
||||
vec<3, T, P> Tmp = v;
|
||||
vec<3, T, Q> Tmp = v;
|
||||
|
||||
// Axis of rotation must be normalised
|
||||
T len = glm::length(Tmp);
|
||||
@@ -550,24 +550,24 @@ namespace detail
|
||||
T const AngleRad(angle);
|
||||
T const Sin = sin(AngleRad * T(0.5));
|
||||
|
||||
return q * tquat<T, P>(cos(AngleRad * T(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin);
|
||||
//return gtc::quaternion::cross(q, tquat<T, P>(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin));
|
||||
return q * tquat<T, Q>(cos(AngleRad * T(0.5)), Tmp.x * Sin, Tmp.y * Sin, Tmp.z * Sin);
|
||||
//return gtc::quaternion::cross(q, tquat<T, Q>(cos(AngleRad * T(0.5)), Tmp.x * fSin, Tmp.y * fSin, Tmp.z * fSin));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> eulerAngles(tquat<T, P> const& x)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, Q> eulerAngles(tquat<T, Q> const& x)
|
||||
{
|
||||
return vec<3, T, P>(pitch(x), yaw(x), roll(x));
|
||||
return vec<3, T, Q>(pitch(x), yaw(x), roll(x));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T roll(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T roll(tquat<T, Q> const& q)
|
||||
{
|
||||
return static_cast<T>(atan(static_cast<T>(2) * (q.x * q.y + q.w * q.z), q.w * q.w + q.x * q.x - q.y * q.y - q.z * q.z));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T pitch(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T pitch(tquat<T, Q> const& q)
|
||||
{
|
||||
//return T(atan(T(2) * (q.y * q.z + q.w * q.x), q.w * q.w - q.x * q.x - q.y * q.y + q.z * q.z));
|
||||
const T y = static_cast<T>(2) * (q.y * q.z + q.w * q.x);
|
||||
@@ -579,16 +579,16 @@ namespace detail
|
||||
return static_cast<T>(atan(y,x));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T yaw(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T yaw(tquat<T, Q> const& q)
|
||||
{
|
||||
return asin(clamp(static_cast<T>(-2) * (q.x * q.z - q.w * q.y), static_cast<T>(-1), static_cast<T>(1)));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER mat<3, 3, T, P> mat3_cast(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<3, 3, T, Q> mat3_cast(tquat<T, Q> const& q)
|
||||
{
|
||||
mat<3, 3, T, P> Result(T(1));
|
||||
mat<3, 3, T, Q> Result(T(1));
|
||||
T qxx(q.x * q.x);
|
||||
T qyy(q.y * q.y);
|
||||
T qzz(q.z * q.z);
|
||||
@@ -613,14 +613,14 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, P> mat4_cast(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER mat<4, 4, T, Q> mat4_cast(tquat<T, Q> const& q)
|
||||
{
|
||||
return mat<4, 4, T, P>(mat3_cast(q));
|
||||
return mat<4, 4, T, Q>(mat3_cast(q));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> quat_cast(mat<3, 3, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> quat_cast(mat<3, 3, T, Q> const& m)
|
||||
{
|
||||
T fourXSquaredMinus1 = m[0][0] - m[1][1] - m[2][2];
|
||||
T fourYSquaredMinus1 = m[1][1] - m[0][0] - m[2][2];
|
||||
@@ -648,7 +648,7 @@ namespace detail
|
||||
T biggestVal = sqrt(fourBiggestSquaredMinus1 + static_cast<T>(1)) * static_cast<T>(0.5);
|
||||
T mult = static_cast<T>(0.25) / biggestVal;
|
||||
|
||||
tquat<T, P> Result;
|
||||
tquat<T, Q> Result;
|
||||
switch(biggestIndex)
|
||||
{
|
||||
case 0:
|
||||
@@ -683,32 +683,32 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> quat_cast(mat<4, 4, T, P> const& m4)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> quat_cast(mat<4, 4, T, Q> const& m4)
|
||||
{
|
||||
return quat_cast(mat<3, 3, T, P>(m4));
|
||||
return quat_cast(mat<3, 3, T, Q>(m4));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T angle(tquat<T, P> const& x)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T angle(tquat<T, Q> const& x)
|
||||
{
|
||||
return acos(x.w) * static_cast<T>(2);
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, P> axis(tquat<T, P> const& x)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<3, T, Q> axis(tquat<T, Q> const& x)
|
||||
{
|
||||
T tmp1 = static_cast<T>(1) - x.w * x.w;
|
||||
if(tmp1 <= static_cast<T>(0))
|
||||
return vec<3, T, P>(0, 0, 1);
|
||||
return vec<3, T, Q>(0, 0, 1);
|
||||
T tmp2 = static_cast<T>(1) / sqrt(tmp1);
|
||||
return vec<3, T, P>(x.x * tmp2, x.y * tmp2, x.z * tmp2);
|
||||
return vec<3, T, Q>(x.x * tmp2, x.y * tmp2, x.z * tmp2);
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER tquat<T, P> angleAxis(T const& angle, vec<3, T, P> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER tquat<T, Q> angleAxis(T const& angle, vec<3, T, Q> const& v)
|
||||
{
|
||||
tquat<T, P> Result;
|
||||
tquat<T, Q> Result;
|
||||
|
||||
T const a(angle);
|
||||
T const s = glm::sin(a * static_cast<T>(0.5));
|
||||
@@ -720,74 +720,74 @@ namespace detail
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> lessThan(tquat<T, P> const& x, tquat<T, P> const& y)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, Q> lessThan(tquat<T, Q> const& x, tquat<T, Q> const& y)
|
||||
{
|
||||
vec<4, bool, P> Result;
|
||||
vec<4, bool, Q> Result;
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] < y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> lessThanEqual(tquat<T, P> const& x, tquat<T, P> const& y)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, Q> lessThanEqual(tquat<T, Q> const& x, tquat<T, Q> const& y)
|
||||
{
|
||||
vec<4, bool, P> Result;
|
||||
vec<4, bool, Q> Result;
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] <= y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> greaterThan(tquat<T, P> const& x, tquat<T, P> const& y)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, Q> greaterThan(tquat<T, Q> const& x, tquat<T, Q> const& y)
|
||||
{
|
||||
vec<4, bool, P> Result;
|
||||
vec<4, bool, Q> Result;
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] > y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> greaterThanEqual(tquat<T, P> const& x, tquat<T, P> const& y)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, Q> greaterThanEqual(tquat<T, Q> const& x, tquat<T, Q> const& y)
|
||||
{
|
||||
vec<4, bool, P> Result;
|
||||
vec<4, bool, Q> Result;
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = x[i] >= y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> equal(tquat<T, P> const& x, tquat<T, P> const& y)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, Q> equal(tquat<T, Q> const& x, tquat<T, Q> const& y)
|
||||
{
|
||||
vec<4, bool, P> Result;
|
||||
vec<4, bool, Q> Result;
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = detail::compute_equal<T>::call(x[i], y[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> notEqual(tquat<T, P> const& x, tquat<T, P> const& y)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, Q> notEqual(tquat<T, Q> const& x, tquat<T, Q> const& y)
|
||||
{
|
||||
vec<4, bool, P> Result;
|
||||
vec<4, bool, Q> Result;
|
||||
for(length_t i = 0; i < x.length(); ++i)
|
||||
Result[i] = !detail::compute_equal<T>::call(x[i], y[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> isnan(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, Q> isnan(tquat<T, Q> const& q)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isnan' only accept floating-point inputs");
|
||||
|
||||
return vec<4, bool, P>(isnan(q.x), isnan(q.y), isnan(q.z), isnan(q.w));
|
||||
return vec<4, bool, Q>(isnan(q.x), isnan(q.y), isnan(q.z), isnan(q.w));
|
||||
}
|
||||
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, P> isinf(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<4, bool, Q> isinf(tquat<T, Q> const& q)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'isinf' only accept floating-point inputs");
|
||||
|
||||
return vec<4, bool, P>(isinf(q.x), isinf(q.y), isinf(q.z), isinf(q.w));
|
||||
return vec<4, bool, Q>(isinf(q.x), isinf(q.y), isinf(q.z), isinf(q.w));
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
/*
|
||||
template<qualifier P>
|
||||
template<qualifier Q>
|
||||
struct compute_quat_mul<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q1, tquat<float, P> const& q2)
|
||||
static tquat<float, P> call(tquat<float, Q> const& q1, tquat<float, Q> const& q2)
|
||||
{
|
||||
// SSE2 STATS: 11 shuffle, 8 mul, 8 add
|
||||
// SSE4 STATS: 3 shuffle, 4 mul, 4 dpps
|
||||
@@ -61,19 +61,19 @@ namespace detail
|
||||
};
|
||||
*/
|
||||
|
||||
template<qualifier P>
|
||||
template<qualifier Q>
|
||||
struct compute_dot<tquat<float, P>, float, true>
|
||||
{
|
||||
static GLM_FUNC_QUALIFIER float call(tquat<float, P> const& x, tquat<float, P> const& y)
|
||||
static GLM_FUNC_QUALIFIER float call(tquat<float, Q> const& x, tquat<float, Q> const& y)
|
||||
{
|
||||
return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data));
|
||||
}
|
||||
};
|
||||
|
||||
template<qualifier P>
|
||||
template<qualifier Q>
|
||||
struct compute_quat_add<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q, tquat<float, P> const& p)
|
||||
static tquat<float, P> call(tquat<float, Q> const& q, tquat<float, Q> const& p)
|
||||
{
|
||||
tquat<float, P> Result;
|
||||
Result.data = _mm_add_ps(q.data, p.data);
|
||||
@@ -82,10 +82,10 @@ namespace detail
|
||||
};
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||
template<qualifier P>
|
||||
template<qualifier Q>
|
||||
struct compute_quat_add<double, P, true>
|
||||
{
|
||||
static tquat<double, P> call(tquat<double, P> const& a, tquat<double, P> const& b)
|
||||
static tquat<double, P> call(tquat<double, Q> const& a, tquat<double, Q> const& b)
|
||||
{
|
||||
tquat<double, P> Result;
|
||||
Result.data = _mm256_add_pd(a.data, b.data);
|
||||
@@ -94,10 +94,10 @@ namespace detail
|
||||
};
|
||||
# endif
|
||||
|
||||
template<qualifier P>
|
||||
template<qualifier Q>
|
||||
struct compute_quat_sub<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q, tquat<float, P> const& p)
|
||||
static tquat<float, P> call(tquat<float, Q> const& q, tquat<float, Q> const& p)
|
||||
{
|
||||
vec<4, float, P> Result;
|
||||
Result.data = _mm_sub_ps(q.data, p.data);
|
||||
@@ -106,10 +106,10 @@ namespace detail
|
||||
};
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||
template<qualifier P>
|
||||
template<qualifier Q>
|
||||
struct compute_quat_sub<double, P, true>
|
||||
{
|
||||
static tquat<double, P> call(tquat<double, P> const& a, tquat<double, P> const& b)
|
||||
static tquat<double, P> call(tquat<double, Q> const& a, tquat<double, Q> const& b)
|
||||
{
|
||||
tquat<double, P> Result;
|
||||
Result.data = _mm256_sub_pd(a.data, b.data);
|
||||
@@ -118,10 +118,10 @@ namespace detail
|
||||
};
|
||||
# endif
|
||||
|
||||
template<qualifier P>
|
||||
template<qualifier Q>
|
||||
struct compute_quat_mul_scalar<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q, float s)
|
||||
static tquat<float, P> call(tquat<float, Q> const& q, float s)
|
||||
{
|
||||
vec<4, float, P> Result;
|
||||
Result.data = _mm_mul_ps(q.data, _mm_set_ps1(s));
|
||||
@@ -130,10 +130,10 @@ namespace detail
|
||||
};
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||
template<qualifier P>
|
||||
template<qualifier Q>
|
||||
struct compute_quat_mul_scalar<double, P, true>
|
||||
{
|
||||
static tquat<double, P> call(tquat<double, P> const& q, double s)
|
||||
static tquat<double, P> call(tquat<double, Q> const& q, double s)
|
||||
{
|
||||
tquat<double, P> Result;
|
||||
Result.data = _mm256_mul_pd(q.data, _mm_set_ps1(s));
|
||||
@@ -142,10 +142,10 @@ namespace detail
|
||||
};
|
||||
# endif
|
||||
|
||||
template<qualifier P>
|
||||
template<qualifier Q>
|
||||
struct compute_quat_div_scalar<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q, float s)
|
||||
static tquat<float, P> call(tquat<float, Q> const& q, float s)
|
||||
{
|
||||
vec<4, float, P> Result;
|
||||
Result.data = _mm_div_ps(q.data, _mm_set_ps1(s));
|
||||
@@ -154,10 +154,10 @@ namespace detail
|
||||
};
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||
template<qualifier P>
|
||||
template<qualifier Q>
|
||||
struct compute_quat_div_scalar<double, P, true>
|
||||
{
|
||||
static tquat<double, P> call(tquat<double, P> const& q, double s)
|
||||
static tquat<double, P> call(tquat<double, Q> const& q, double s)
|
||||
{
|
||||
tquat<double, P> Result;
|
||||
Result.data = _mm256_div_pd(q.data, _mm_set_ps1(s));
|
||||
@@ -166,10 +166,10 @@ namespace detail
|
||||
};
|
||||
# endif
|
||||
|
||||
template<qualifier P>
|
||||
template<qualifier Q>
|
||||
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)
|
||||
static vec<4, float, P> call(tquat<float, Q> const& q, vec<4, float, Q> const& v)
|
||||
{
|
||||
__m128 const q_wwww = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 3, 3, 3));
|
||||
__m128 const q_swp0 = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 0, 2, 1));
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace glm
|
||||
/// @tparam T Value type. Currently supported: float or double.
|
||||
///
|
||||
/// @see gtc_random
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> linearRand(vec<L, T, P> const& Min, vec<L, T, P> const& Max);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> linearRand(vec<L, T, Q> const& Min, vec<L, T, Q> const& Max);
|
||||
|
||||
/// Generate random numbers in the interval [Min, Max], according a gaussian distribution
|
||||
///
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <length_t L, typename T, qualifier P>
|
||||
template <length_t L, typename T, qualifier Q>
|
||||
struct compute_rand
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, P> call();
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call();
|
||||
};
|
||||
|
||||
template <qualifier P>
|
||||
@@ -64,114 +64,114 @@ namespace detail
|
||||
}
|
||||
};
|
||||
|
||||
template <length_t L, qualifier P>
|
||||
struct compute_rand<L, uint16, P>
|
||||
template <length_t L, qualifier Q>
|
||||
struct compute_rand<L, uint16, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint16, P> call()
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint16, Q> call()
|
||||
{
|
||||
return
|
||||
(vec<L, uint16, P>(compute_rand<L, uint8, P>::call()) << static_cast<uint16>(8)) |
|
||||
(vec<L, uint16, P>(compute_rand<L, uint8, P>::call()) << static_cast<uint16>(0));
|
||||
(vec<L, uint16, Q>(compute_rand<L, uint8, Q>::call()) << static_cast<uint16>(8)) |
|
||||
(vec<L, uint16, Q>(compute_rand<L, uint8, Q>::call()) << static_cast<uint16>(0));
|
||||
}
|
||||
};
|
||||
|
||||
template <length_t L, qualifier P>
|
||||
struct compute_rand<L, uint32, P>
|
||||
template <length_t L, qualifier Q>
|
||||
struct compute_rand<L, uint32, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint32, P> call()
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint32, Q> call()
|
||||
{
|
||||
return
|
||||
(vec<L, uint32, P>(compute_rand<L, uint16, P>::call()) << static_cast<uint32>(16)) |
|
||||
(vec<L, uint32, P>(compute_rand<L, uint16, P>::call()) << static_cast<uint32>(0));
|
||||
(vec<L, uint32, Q>(compute_rand<L, uint16, Q>::call()) << static_cast<uint32>(16)) |
|
||||
(vec<L, uint32, Q>(compute_rand<L, uint16, Q>::call()) << static_cast<uint32>(0));
|
||||
}
|
||||
};
|
||||
|
||||
template <length_t L, qualifier P>
|
||||
struct compute_rand<L, uint64, P>
|
||||
template <length_t L, qualifier Q>
|
||||
struct compute_rand<L, uint64, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint64, P> call()
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint64, Q> call()
|
||||
{
|
||||
return
|
||||
(vec<L, uint64, P>(compute_rand<L, uint32, P>::call()) << static_cast<uint64>(32)) |
|
||||
(vec<L, uint64, P>(compute_rand<L, uint32, P>::call()) << static_cast<uint64>(0));
|
||||
(vec<L, uint64, Q>(compute_rand<L, uint32, Q>::call()) << static_cast<uint64>(32)) |
|
||||
(vec<L, uint64, Q>(compute_rand<L, uint32, Q>::call()) << static_cast<uint64>(0));
|
||||
}
|
||||
};
|
||||
|
||||
template <length_t L, typename T, qualifier P>
|
||||
template <length_t L, typename T, qualifier Q>
|
||||
struct compute_linearRand
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, P> call(vec<L, T, P> const& Min, vec<L, T, P> const& Max);
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& Min, vec<L, T, Q> const& Max);
|
||||
};
|
||||
|
||||
template<length_t L, qualifier P>
|
||||
struct compute_linearRand<L, int8, P>
|
||||
template<length_t L, qualifier Q>
|
||||
struct compute_linearRand<L, int8, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, int8, P> call(vec<L, int8, P> const& Min, vec<L, int8, P> const& Max)
|
||||
GLM_FUNC_QUALIFIER static vec<L, int8, Q> call(vec<L, int8, Q> const& Min, vec<L, int8, Q> const& Max)
|
||||
{
|
||||
return (vec<L, int8, P>(compute_rand<L, uint8, P>::call() % vec<L, uint8, P>(Max + static_cast<int8>(1) - Min))) + Min;
|
||||
return (vec<L, int8, Q>(compute_rand<L, uint8, Q>::call() % vec<L, uint8, Q>(Max + static_cast<int8>(1) - Min))) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template<length_t L, qualifier P>
|
||||
struct compute_linearRand<L, uint8, P>
|
||||
template<length_t L, qualifier Q>
|
||||
struct compute_linearRand<L, uint8, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint8, P> call(vec<L, uint8, P> const& Min, vec<L, uint8, P> const& Max)
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint8, Q> call(vec<L, uint8, Q> const& Min, vec<L, uint8, Q> const& Max)
|
||||
{
|
||||
return (compute_rand<L, uint8, P>::call() % (Max + static_cast<uint8>(1) - Min)) + Min;
|
||||
return (compute_rand<L, uint8, Q>::call() % (Max + static_cast<uint8>(1) - Min)) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template<length_t L, qualifier P>
|
||||
struct compute_linearRand<L, int16, P>
|
||||
template<length_t L, qualifier Q>
|
||||
struct compute_linearRand<L, int16, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, int16, P> call(vec<L, int16, P> const& Min, vec<L, int16, P> const& Max)
|
||||
GLM_FUNC_QUALIFIER static vec<L, int16, Q> call(vec<L, int16, Q> const& Min, vec<L, int16, Q> const& Max)
|
||||
{
|
||||
return (vec<L, int16, P>(compute_rand<L, uint16, P>::call() % vec<L, uint16, P>(Max + static_cast<int16>(1) - Min))) + Min;
|
||||
return (vec<L, int16, Q>(compute_rand<L, uint16, Q>::call() % vec<L, uint16, Q>(Max + static_cast<int16>(1) - Min))) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template<length_t L, qualifier P>
|
||||
struct compute_linearRand<L, uint16, P>
|
||||
template<length_t L, qualifier Q>
|
||||
struct compute_linearRand<L, uint16, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint16, P> call(vec<L, uint16, P> const& Min, vec<L, uint16, P> const& Max)
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint16, Q> call(vec<L, uint16, Q> const& Min, vec<L, uint16, Q> const& Max)
|
||||
{
|
||||
return (compute_rand<L, uint16, P>::call() % (Max + static_cast<uint16>(1) - Min)) + Min;
|
||||
return (compute_rand<L, uint16, Q>::call() % (Max + static_cast<uint16>(1) - Min)) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template<length_t L, qualifier P>
|
||||
struct compute_linearRand<L, int32, P>
|
||||
template<length_t L, qualifier Q>
|
||||
struct compute_linearRand<L, int32, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, int32, P> call(vec<L, int32, P> const& Min, vec<L, int32, P> const& Max)
|
||||
GLM_FUNC_QUALIFIER static vec<L, int32, Q> call(vec<L, int32, Q> const& Min, vec<L, int32, Q> const& Max)
|
||||
{
|
||||
return (vec<L, int32, P>(compute_rand<L, uint32, P>::call() % vec<L, uint32, P>(Max + static_cast<int32>(1) - Min))) + Min;
|
||||
return (vec<L, int32, Q>(compute_rand<L, uint32, Q>::call() % vec<L, uint32, Q>(Max + static_cast<int32>(1) - Min))) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template<length_t L, qualifier P>
|
||||
struct compute_linearRand<L, uint32, P>
|
||||
template<length_t L, qualifier Q>
|
||||
struct compute_linearRand<L, uint32, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint32, P> call(vec<L, uint32, P> const& Min, vec<L, uint32, P> const& Max)
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint32, Q> call(vec<L, uint32, Q> const& Min, vec<L, uint32, Q> const& Max)
|
||||
{
|
||||
return (compute_rand<L, uint32, P>::call() % (Max + static_cast<uint32>(1) - Min)) + Min;
|
||||
return (compute_rand<L, uint32, Q>::call() % (Max + static_cast<uint32>(1) - Min)) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template<length_t L, qualifier P>
|
||||
struct compute_linearRand<L, int64, P>
|
||||
template<length_t L, qualifier Q>
|
||||
struct compute_linearRand<L, int64, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, int64, P> call(vec<L, int64, P> const& Min, vec<L, int64, P> const& Max)
|
||||
GLM_FUNC_QUALIFIER static vec<L, int64, Q> call(vec<L, int64, Q> const& Min, vec<L, int64, Q> const& Max)
|
||||
{
|
||||
return (vec<L, int64, P>(compute_rand<L, uint64, P>::call() % vec<L, uint64, P>(Max + static_cast<int64>(1) - Min))) + Min;
|
||||
return (vec<L, int64, Q>(compute_rand<L, uint64, Q>::call() % vec<L, uint64, Q>(Max + static_cast<int64>(1) - Min))) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
template<length_t L, qualifier P>
|
||||
struct compute_linearRand<L, uint64, P>
|
||||
template<length_t L, qualifier Q>
|
||||
struct compute_linearRand<L, uint64, Q>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint64, P> call(vec<L, uint64, P> const& Min, vec<L, uint64, P> const& Max)
|
||||
GLM_FUNC_QUALIFIER static vec<L, uint64, Q> call(vec<L, uint64, Q> const& Min, vec<L, uint64, Q> const& Max)
|
||||
{
|
||||
return (compute_rand<L, uint64, P>::call() % (Max + static_cast<uint64>(1) - Min)) + Min;
|
||||
return (compute_rand<L, uint64, Q>::call() % (Max + static_cast<uint64>(1) - Min)) + Min;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -265,10 +265,10 @@ namespace detail
|
||||
vec<1, genType, highp>(Max)).x;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> linearRand(vec<L, T, P> const& Min, vec<L, T, P> const& Max)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> linearRand(vec<L, T, Q> const& Min, vec<L, T, Q> const& Max)
|
||||
{
|
||||
return detail::compute_linearRand<L, T, P>::call(Min, Max);
|
||||
return detail::compute_linearRand<L, T, Q>::call(Min, Max);
|
||||
}
|
||||
|
||||
template<typename genType>
|
||||
@@ -287,10 +287,10 @@ namespace detail
|
||||
return x2 * Deviation * Deviation * sqrt((genType(-2) * log(w)) / w) + Mean;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> gaussRand(vec<L, T, P> const& Mean, vec<L, T, P> const& Deviation)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> gaussRand(vec<L, T, Q> const& Mean, vec<L, T, Q> const& Deviation)
|
||||
{
|
||||
return detail::functor2<L, T, P>::call(gaussRand, Mean, Deviation);
|
||||
return detail::functor2<L, T, Q>::call(gaussRand, Mean, Deviation);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
||||
@@ -14,11 +14,11 @@ namespace glm
|
||||
return genType(1) / glm::cos(angle);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> sec(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> sec(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sec' only accept floating-point inputs");
|
||||
return detail::functor1<L, T, T, P>::call(sec, x);
|
||||
return detail::functor1<L, T, T, Q>::call(sec, x);
|
||||
}
|
||||
|
||||
// csc
|
||||
@@ -29,11 +29,11 @@ namespace glm
|
||||
return genType(1) / glm::sin(angle);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> csc(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> csc(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csc' only accept floating-point inputs");
|
||||
return detail::functor1<L, T, T, P>::call(csc, x);
|
||||
return detail::functor1<L, T, T, Q>::call(csc, x);
|
||||
}
|
||||
|
||||
// cot
|
||||
@@ -46,11 +46,11 @@ namespace glm
|
||||
return glm::tan(pi_over_2 - angle);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> cot(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> cot(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cot' only accept floating-point inputs");
|
||||
return detail::functor1<L, T, T, P>::call(cot, x);
|
||||
return detail::functor1<L, T, T, Q>::call(cot, x);
|
||||
}
|
||||
|
||||
// asec
|
||||
@@ -61,11 +61,11 @@ namespace glm
|
||||
return acos(genType(1) / x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> asec(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> asec(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asec' only accept floating-point inputs");
|
||||
return detail::functor1<L, T, T, P>::call(asec, x);
|
||||
return detail::functor1<L, T, T, Q>::call(asec, x);
|
||||
}
|
||||
|
||||
// acsc
|
||||
@@ -76,11 +76,11 @@ namespace glm
|
||||
return asin(genType(1) / x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> acsc(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acsc(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsc' only accept floating-point inputs");
|
||||
return detail::functor1<L, T, T, P>::call(acsc, x);
|
||||
return detail::functor1<L, T, T, Q>::call(acsc, x);
|
||||
}
|
||||
|
||||
// acot
|
||||
@@ -93,11 +93,11 @@ namespace glm
|
||||
return pi_over_2 - atan(x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> acot(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acot(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acot' only accept floating-point inputs");
|
||||
return detail::functor1<L, T, T, P>::call(acot, x);
|
||||
return detail::functor1<L, T, T, Q>::call(acot, x);
|
||||
}
|
||||
|
||||
// sech
|
||||
@@ -108,11 +108,11 @@ namespace glm
|
||||
return genType(1) / glm::cosh(angle);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> sech(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> sech(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sech' only accept floating-point inputs");
|
||||
return detail::functor1<L, T, T, P>::call(sech, x);
|
||||
return detail::functor1<L, T, T, Q>::call(sech, x);
|
||||
}
|
||||
|
||||
// csch
|
||||
@@ -123,11 +123,11 @@ namespace glm
|
||||
return genType(1) / glm::sinh(angle);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> csch(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> csch(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'csch' only accept floating-point inputs");
|
||||
return detail::functor1<L, T, T, P>::call(csch, x);
|
||||
return detail::functor1<L, T, T, Q>::call(csch, x);
|
||||
}
|
||||
|
||||
// coth
|
||||
@@ -138,11 +138,11 @@ namespace glm
|
||||
return glm::cosh(angle) / glm::sinh(angle);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> coth(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> coth(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'coth' only accept floating-point inputs");
|
||||
return detail::functor1<L, T, T, P>::call(coth, x);
|
||||
return detail::functor1<L, T, T, Q>::call(coth, x);
|
||||
}
|
||||
|
||||
// asech
|
||||
@@ -153,11 +153,11 @@ namespace glm
|
||||
return acosh(genType(1) / x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> asech(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> asech(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'asech' only accept floating-point inputs");
|
||||
return detail::functor1<L, T, T, P>::call(asech, x);
|
||||
return detail::functor1<L, T, T, Q>::call(asech, x);
|
||||
}
|
||||
|
||||
// acsch
|
||||
@@ -168,11 +168,11 @@ namespace glm
|
||||
return acsch(genType(1) / x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> acsch(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acsch(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acsch' only accept floating-point inputs");
|
||||
return detail::functor1<L, T, T, P>::call(acsch, x);
|
||||
return detail::functor1<L, T, T, Q>::call(acsch, x);
|
||||
}
|
||||
|
||||
// acoth
|
||||
@@ -183,10 +183,10 @@ namespace glm
|
||||
return atanh(genType(1) / x);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> acoth(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> acoth(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'acoth' only accept floating-point inputs");
|
||||
return detail::functor1<L, T, T, P>::call(acoth, x);
|
||||
return detail::functor1<L, T, T, Q>::call(acoth, x);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace glm
|
||||
/// Return true if the value is a power of two number.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, bool, P> isPowerOfTwo(vec<L, T, P> const& value);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> isPowerOfTwo(vec<L, T, Q> const& value);
|
||||
|
||||
/// Return the power of two number which value is just higher the input value,
|
||||
/// round up to a power of two.
|
||||
@@ -53,8 +53,8 @@ namespace glm
|
||||
/// round up to a power of two.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> ceilPowerOfTwo(vec<L, T, P> const& value);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> ceilPowerOfTwo(vec<L, T, Q> const& value);
|
||||
|
||||
/// Return the power of two number which value is just lower the input value,
|
||||
/// round down to a power of two.
|
||||
@@ -67,8 +67,8 @@ namespace glm
|
||||
/// round down to a power of two.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> floorPowerOfTwo(vec<L, T, P> const& value);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> floorPowerOfTwo(vec<L, T, Q> const& value);
|
||||
|
||||
/// Return the power of two number which value is the closet to the input value.
|
||||
///
|
||||
@@ -79,8 +79,8 @@ namespace glm
|
||||
/// Return the power of two number which value is the closet to the input value.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> roundPowerOfTwo(vec<L, T, P> const& value);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> roundPowerOfTwo(vec<L, T, Q> const& value);
|
||||
|
||||
/// Return true if the 'Value' is a multiple of 'Multiple'.
|
||||
///
|
||||
@@ -91,14 +91,14 @@ namespace glm
|
||||
/// Return true if the 'Value' is a multiple of 'Multiple'.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, bool, P> isMultiple(vec<L, T, P> const& Value, T Multiple);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> isMultiple(vec<L, T, Q> const& Value, T Multiple);
|
||||
|
||||
/// Return true if the 'Value' is a multiple of 'Multiple'.
|
||||
///
|
||||
/// @see gtc_round
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, bool, P> isMultiple(vec<L, T, P> const& Value, vec<L, T, P> const& Multiple);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> isMultiple(vec<L, T, Q> const& Value, vec<L, T, Q> const& Multiple);
|
||||
|
||||
/// Higher multiple number of Source.
|
||||
///
|
||||
@@ -115,8 +115,8 @@ namespace glm
|
||||
/// @param Multiple Must be a null or positive value
|
||||
///
|
||||
/// @see gtc_round
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> ceilMultiple(vec<L, T, P> const& Source, vec<L, T, P> const& Multiple);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> ceilMultiple(vec<L, T, Q> const& Source, vec<L, T, Q> const& Multiple);
|
||||
|
||||
/// Lower multiple number of Source.
|
||||
///
|
||||
@@ -133,8 +133,8 @@ namespace glm
|
||||
/// @param Multiple Must be a null or positive value
|
||||
///
|
||||
/// @see gtc_round
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> floorMultiple(vec<L, T, P> const& Source, vec<L, T, P> const& Multiple);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> floorMultiple(vec<L, T, Q> const& Source, vec<L, T, Q> const& Multiple);
|
||||
|
||||
/// Lower multiple number of Source.
|
||||
///
|
||||
@@ -151,8 +151,8 @@ namespace glm
|
||||
/// @param Multiple Must be a null or positive value
|
||||
///
|
||||
/// @see gtc_round
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_DECL vec<L, T, P> roundMultiple(vec<L, T, P> const& Source, vec<L, T, P> const& Multiple);
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> roundMultiple(vec<L, T, Q> const& Source, vec<L, T, Q> const& Multiple);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
||||
@@ -6,62 +6,62 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template<length_t L, typename T, qualifier P, bool compute = false>
|
||||
template<length_t L, typename T, qualifier Q, bool compute = false>
|
||||
struct compute_ceilShift
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, P> call(vec<L, T, P> const& v, T)
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
struct compute_ceilShift<L, T, P, true>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
struct compute_ceilShift<L, T, Q, true>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, P> call(vec<L, T, P> const& v, T Shift)
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v, T Shift)
|
||||
{
|
||||
return v | (v >> Shift);
|
||||
}
|
||||
};
|
||||
|
||||
template<length_t L, typename T, qualifier P, bool isSigned = true>
|
||||
template<length_t L, typename T, qualifier Q, bool isSigned = true>
|
||||
struct compute_ceilPowerOfTwo
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, P> call(vec<L, T, P> const& x)
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
|
||||
|
||||
vec<L, T, P> const Sign(sign(x));
|
||||
vec<L, T, Q> const Sign(sign(x));
|
||||
|
||||
vec<L, T, P> v(abs(x));
|
||||
vec<L, T, Q> v(abs(x));
|
||||
|
||||
v = v - static_cast<T>(1);
|
||||
v = v | (v >> static_cast<T>(1));
|
||||
v = v | (v >> static_cast<T>(2));
|
||||
v = v | (v >> static_cast<T>(4));
|
||||
v = compute_ceilShift<L, T, P, sizeof(T) >= 2>::call(v, 8);
|
||||
v = compute_ceilShift<L, T, P, sizeof(T) >= 4>::call(v, 16);
|
||||
v = compute_ceilShift<L, T, P, sizeof(T) >= 8>::call(v, 32);
|
||||
v = compute_ceilShift<L, T, Q, sizeof(T) >= 2>::call(v, 8);
|
||||
v = compute_ceilShift<L, T, Q, sizeof(T) >= 4>::call(v, 16);
|
||||
v = compute_ceilShift<L, T, Q, sizeof(T) >= 8>::call(v, 32);
|
||||
return (v + static_cast<T>(1)) * Sign;
|
||||
}
|
||||
};
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
struct compute_ceilPowerOfTwo<L, T, P, false>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
struct compute_ceilPowerOfTwo<L, T, Q, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, P> call(vec<L, T, P> const& x)
|
||||
GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(!std::numeric_limits<T>::is_iec559, "'ceilPowerOfTwo' only accept integer scalar or vector inputs");
|
||||
|
||||
vec<L, T, P> v(x);
|
||||
vec<L, T, Q> v(x);
|
||||
|
||||
v = v - static_cast<T>(1);
|
||||
v = v | (v >> static_cast<T>(1));
|
||||
v = v | (v >> static_cast<T>(2));
|
||||
v = v | (v >> static_cast<T>(4));
|
||||
v = compute_ceilShift<L, T, P, sizeof(T) >= 2>::call(v, 8);
|
||||
v = compute_ceilShift<L, T, P, sizeof(T) >= 4>::call(v, 16);
|
||||
v = compute_ceilShift<L, T, P, sizeof(T) >= 8>::call(v, 32);
|
||||
v = compute_ceilShift<L, T, Q, sizeof(T) >= 2>::call(v, 8);
|
||||
v = compute_ceilShift<L, T, Q, sizeof(T) >= 4>::call(v, 16);
|
||||
v = compute_ceilShift<L, T, Q, sizeof(T) >= 8>::call(v, 32);
|
||||
return v + static_cast<T>(1);
|
||||
}
|
||||
};
|
||||
@@ -219,11 +219,11 @@ namespace detail
|
||||
return !(Result & (Result - 1));
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, P> isPowerOfTwo(vec<L, T, P> const& Value)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, Q> isPowerOfTwo(vec<L, T, Q> const& Value)
|
||||
{
|
||||
vec<L, T, P> const Result(abs(Value));
|
||||
return equal(Result & (Result - 1), vec<L, T, P>(0));
|
||||
vec<L, T, Q> const Result(abs(Value));
|
||||
return equal(Result & (Result - 1), vec<L, T, Q>(0));
|
||||
}
|
||||
|
||||
//////////////////
|
||||
@@ -235,10 +235,10 @@ namespace detail
|
||||
return detail::compute_ceilPowerOfTwo<1, genType, defaultp, std::numeric_limits<genType>::is_signed>::call(vec<1, genType, defaultp>(value)).x;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> ceilPowerOfTwo(vec<L, T, P> const& v)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> ceilPowerOfTwo(vec<L, T, Q> const& v)
|
||||
{
|
||||
return detail::compute_ceilPowerOfTwo<L, T, P, std::numeric_limits<T>::is_signed>::call(v);
|
||||
return detail::compute_ceilPowerOfTwo<L, T, Q, std::numeric_limits<T>::is_signed>::call(v);
|
||||
}
|
||||
|
||||
///////////////////
|
||||
@@ -250,10 +250,10 @@ namespace detail
|
||||
return isPowerOfTwo(value) ? value : static_cast<genType>(1) << findMSB(value);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> floorPowerOfTwo(vec<L, T, P> const& v)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> floorPowerOfTwo(vec<L, T, Q> const& v)
|
||||
{
|
||||
return detail::functor1<L, T, T, P>::call(floorPowerOfTwo, v);
|
||||
return detail::functor1<L, T, T, Q>::call(floorPowerOfTwo, v);
|
||||
}
|
||||
|
||||
///////////////////
|
||||
@@ -270,10 +270,10 @@ namespace detail
|
||||
return (next - value) < (value - prev) ? next : prev;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> roundPowerOfTwo(vec<L, T, P> const& v)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> roundPowerOfTwo(vec<L, T, Q> const& v)
|
||||
{
|
||||
return detail::functor1<L, T, T, P>::call(roundPowerOfTwo, v);
|
||||
return detail::functor1<L, T, T, Q>::call(roundPowerOfTwo, v);
|
||||
}
|
||||
|
||||
////////////////
|
||||
@@ -285,16 +285,16 @@ namespace detail
|
||||
return isMultiple(vec<1, genType>(Value), vec<1, genType>(Multiple)).x;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, P> isMultiple(vec<L, T, P> const& Value, T Multiple)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, Q> isMultiple(vec<L, T, Q> const& Value, T Multiple)
|
||||
{
|
||||
return (Value % Multiple) == vec<L, T, P>(0);
|
||||
return (Value % Multiple) == vec<L, T, Q>(0);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, P> isMultiple(vec<L, T, P> const& Value, vec<L, T, P> const& Multiple)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, bool, Q> isMultiple(vec<L, T, Q> const& Value, vec<L, T, Q> const& Multiple)
|
||||
{
|
||||
return (Value % Multiple) == vec<L, T, P>(0);
|
||||
return (Value % Multiple) == vec<L, T, Q>(0);
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
@@ -306,10 +306,10 @@ namespace detail
|
||||
return detail::compute_ceilMultiple<std::numeric_limits<genType>::is_iec559, std::numeric_limits<genType>::is_signed>::call(Source, Multiple);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> ceilMultiple(vec<L, T, P> const& Source, vec<L, T, P> const& Multiple)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> ceilMultiple(vec<L, T, Q> const& Source, vec<L, T, Q> const& Multiple)
|
||||
{
|
||||
return detail::functor2<L, T, P>::call(ceilMultiple, Source, Multiple);
|
||||
return detail::functor2<L, T, Q>::call(ceilMultiple, Source, Multiple);
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
@@ -321,10 +321,10 @@ namespace detail
|
||||
return detail::compute_floorMultiple<std::numeric_limits<genType>::is_iec559, std::numeric_limits<genType>::is_signed>::call(Source, Multiple);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> floorMultiple(vec<L, T, P> const& Source, vec<L, T, P> const& Multiple)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> floorMultiple(vec<L, T, Q> const& Source, vec<L, T, Q> const& Multiple)
|
||||
{
|
||||
return detail::functor2<L, T, P>::call(floorMultiple, Source, Multiple);
|
||||
return detail::functor2<L, T, Q>::call(floorMultiple, Source, Multiple);
|
||||
}
|
||||
|
||||
//////////////////////
|
||||
@@ -336,9 +336,9 @@ namespace detail
|
||||
return detail::compute_roundMultiple<std::numeric_limits<genType>::is_iec559, std::numeric_limits<genType>::is_signed>::call(Source, Multiple);
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> roundMultiple(vec<L, T, P> const& Source, vec<L, T, P> const& Multiple)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> roundMultiple(vec<L, T, Q> const& Source, vec<L, T, Q> const& Multiple)
|
||||
{
|
||||
return detail::functor2<L, T, P>::call(roundMultiple, Source, Multiple);
|
||||
return detail::functor2<L, T, Q>::call(roundMultiple, Source, Multiple);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@@ -10,208 +10,208 @@ namespace glm
|
||||
|
||||
/// Return the constant address to the data of the vector input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(vec<2, T, P> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(vec<2, T, Q> const& v)
|
||||
{
|
||||
return &(v.x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the vector input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(vec<2, T, P>& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(vec<2, T, Q>& v)
|
||||
{
|
||||
return &(v.x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the vector input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr(vec<3, T, P> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr(vec<3, T, Q> const& v)
|
||||
{
|
||||
return &(v.x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the vector input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(vec<3, T, P>& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(vec<3, T, Q>& v)
|
||||
{
|
||||
return &(v.x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the vector input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(vec<4, T, P> const& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(vec<4, T, Q> const& v)
|
||||
{
|
||||
return &(v.x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the vector input.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(vec<4, T, P>& v)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(vec<4, T, Q>& v)
|
||||
{
|
||||
return &(v.x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 2, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 2, T, Q> const& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 2, T, P>& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 2, T, Q>& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 3, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 3, T, Q> const& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 3, T, P>& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 3, T, Q>& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 4, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 4, T, Q> const& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
//! From GLM_GTC_type_ptr extension.
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<4, 4, T, P>& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<4, 4, T, Q>& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 3, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 3, T, Q> const& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 3, T, P>& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 3, T, Q>& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 2, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 2, T, Q> const& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 2, T, P>& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 2, T, Q>& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 4, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<2, 4, T, Q> const& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 4, T, P>& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<2, 4, T, Q>& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 2, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 2, T, Q> const& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<4, 2, T, P>& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<4, 2, T, Q>& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 4, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<3, 4, T, Q> const& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
//! Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 4, T, P>& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(mat<3, 4, T, Q>& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 3, T, P> const& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const* value_ptr(mat<4, 3, T, Q> const& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the address to the data of the matrix input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr(mat<4, 3, T, P>& m)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T * value_ptr(mat<4, 3, T, Q>& m)
|
||||
{
|
||||
return &(m[0].x);
|
||||
}
|
||||
|
||||
/// Return the constant address to the data of the input parameter.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr(tquat<T, P> const& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T const * value_ptr(tquat<T, Q> const& q)
|
||||
{
|
||||
return &(q[0]);
|
||||
}
|
||||
|
||||
/// Return the address to the data of the quaternion input.
|
||||
/// @see gtc_type_ptr
|
||||
template<typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(tquat<T, P>& q)
|
||||
template<typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER T* value_ptr(tquat<T, Q>& q)
|
||||
{
|
||||
return &(q[0]);
|
||||
}
|
||||
|
||||
@@ -217,10 +217,10 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> next_float(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> next_float(vec<L, T, Q> const& x)
|
||||
{
|
||||
vec<L, T, P> Result;
|
||||
vec<L, T, Q> Result;
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = next_float(x[i]);
|
||||
return Result;
|
||||
@@ -252,10 +252,10 @@ namespace glm
|
||||
# endif
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> prev_float(vec<L, T, P> const& x)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> prev_float(vec<L, T, Q> const& x)
|
||||
{
|
||||
vec<L, T, P> Result;
|
||||
vec<L, T, Q> Result;
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = prev_float(x[i]);
|
||||
return Result;
|
||||
@@ -270,10 +270,10 @@ namespace glm
|
||||
return temp;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> next_float(vec<L, T, P> const& x, vec<L, uint, P> const& ulps)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> next_float(vec<L, T, Q> const& x, vec<L, uint, Q> const& ulps)
|
||||
{
|
||||
vec<L, T, P> Result;
|
||||
vec<L, T, Q> Result;
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = next_float(x[i], ulps[i]);
|
||||
return Result;
|
||||
@@ -288,10 +288,10 @@ namespace glm
|
||||
return temp;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, P> prev_float(vec<L, T, P> const& x, vec<L, uint, P> const& ulps)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, T, Q> prev_float(vec<L, T, Q> const& x, vec<L, uint, Q> const& ulps)
|
||||
{
|
||||
vec<L, T, P> Result;
|
||||
vec<L, T, Q> Result;
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = prev_float(x[i], ulps[i]);
|
||||
return Result;
|
||||
@@ -328,10 +328,10 @@ namespace glm
|
||||
return ulp;
|
||||
}
|
||||
|
||||
template<length_t L, typename T, qualifier P>
|
||||
GLM_FUNC_QUALIFIER vec<L, uint, P> float_distance(vec<L, T, P> const& x, vec<L, T, P> const& y)
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_QUALIFIER vec<L, uint, Q> float_distance(vec<L, T, Q> const& x, vec<L, T, Q> const& y)
|
||||
{
|
||||
vec<L, uint, P> Result;
|
||||
vec<L, uint, Q> Result;
|
||||
for(length_t i = 0, n = Result.length(); i < n; ++i)
|
||||
Result[i] = float_distance(x[i], y[i]);
|
||||
return Result;
|
||||
|
||||
Reference in New Issue
Block a user