mirror of
https://github.com/g-truc/glm.git
synced 2024-11-10 12:41:54 +00:00
Fixed bug #14, fixed constexpr
This commit is contained in:
parent
841f91e830
commit
8a291a9dc2
@ -55,128 +55,128 @@ namespace glm
|
|||||||
/// Return the epsilon constant for floating point types.
|
/// Return the epsilon constant for floating point types.
|
||||||
/// @todo Implement epsilon for half-precision floating point type.
|
/// @todo Implement epsilon for half-precision floating point type.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T epsilon();
|
genType epsilon();
|
||||||
|
|
||||||
/// Return 0.
|
/// Return 0.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T zero();
|
genType zero();
|
||||||
|
|
||||||
/// Return 1.
|
/// Return 1.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T one();
|
genType one();
|
||||||
|
|
||||||
/// Return the pi constant.
|
/// Return the pi constant.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T pi();
|
genType pi();
|
||||||
|
|
||||||
/// Return square root of pi.
|
/// Return square root of pi.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T root_pi();
|
genType root_pi();
|
||||||
|
|
||||||
/// Return pi / 2.
|
/// Return pi / 2.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T half_pi();
|
genType half_pi();
|
||||||
|
|
||||||
/// Return pi / 4.
|
/// Return pi / 4.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T quarter_pi();
|
genType quarter_pi();
|
||||||
|
|
||||||
/// Return 1 / pi.
|
/// Return 1 / pi.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T one_over_pi();
|
genType one_over_pi();
|
||||||
|
|
||||||
/// Return 2 / pi.
|
/// Return 2 / pi.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T two_over_pi();
|
genType two_over_pi();
|
||||||
|
|
||||||
/// Return 2 / sqrt(pi).
|
/// Return 2 / sqrt(pi).
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T two_over_root_pi();
|
genType two_over_root_pi();
|
||||||
|
|
||||||
/// Return 1 / sqrt(2).
|
/// Return 1 / sqrt(2).
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T one_over_root_two();
|
genType one_over_root_two();
|
||||||
|
|
||||||
/// Return sqrt(pi / 2).
|
/// Return sqrt(pi / 2).
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T root_half_pi();
|
genType root_half_pi();
|
||||||
|
|
||||||
/// Return sqrt(2 * pi).
|
/// Return sqrt(2 * pi).
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T root_two_pi();
|
genType root_two_pi();
|
||||||
|
|
||||||
/// Return sqrt(ln(4)).
|
/// Return sqrt(ln(4)).
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T root_ln_four();
|
genType root_ln_four();
|
||||||
|
|
||||||
/// Return e constant.
|
/// Return e constant.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T e();
|
genType e();
|
||||||
|
|
||||||
/// Return Euler's constant.
|
/// Return Euler's constant.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T euler();
|
genType euler();
|
||||||
|
|
||||||
/// Return sqrt(2).
|
/// Return sqrt(2).
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T root_two();
|
genType root_two();
|
||||||
|
|
||||||
/// Return sqrt(3).
|
/// Return sqrt(3).
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T root_three();
|
genType root_three();
|
||||||
|
|
||||||
/// Return sqrt(5).
|
/// Return sqrt(5).
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T root_five();
|
genType root_five();
|
||||||
|
|
||||||
/// Return ln(2).
|
/// Return ln(2).
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T ln_two();
|
genType ln_two();
|
||||||
|
|
||||||
/// Return ln(10).
|
/// Return ln(10).
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T ln_ten();
|
genType ln_ten();
|
||||||
|
|
||||||
/// Return ln(ln(2)).
|
/// Return ln(ln(2)).
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T ln_ln_two();
|
genType ln_ln_two();
|
||||||
|
|
||||||
/// Return 1 / 3.
|
/// Return 1 / 3.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T third();
|
genType third();
|
||||||
|
|
||||||
/// Return 2 / 3.
|
/// Return 2 / 3.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T two_thirds();
|
genType two_thirds();
|
||||||
|
|
||||||
/// Return the golden ratio constant.
|
/// Return the golden ratio constant.
|
||||||
/// @see gtc_constants
|
/// @see gtc_constants
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_CONSTEXPR T golden_ratio();
|
genType golden_ratio();
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
} //namespace glm
|
} //namespace glm
|
||||||
|
@ -28,159 +28,159 @@
|
|||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T epsilon()
|
GLM_FUNC_QUALIFIER genType epsilon()
|
||||||
{
|
{
|
||||||
return std::numeric_limits<T>::epsilon();
|
return std::numeric_limits<genType>::epsilon();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR half epsilon()
|
GLM_FUNC_QUALIFIER half epsilon()
|
||||||
{
|
{
|
||||||
return half(1.19209290e-007);
|
return half(1.19209290e-007);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T zero()
|
GLM_FUNC_QUALIFIER genType zero()
|
||||||
{
|
{
|
||||||
return T(0);
|
return genType(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T one()
|
GLM_FUNC_QUALIFIER genType one()
|
||||||
{
|
{
|
||||||
return T(1);
|
return genType(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T pi()
|
GLM_FUNC_QUALIFIER genType pi()
|
||||||
{
|
{
|
||||||
return T(3.14159265358979323846264338327950288);
|
return genType(3.14159265358979323846264338327950288);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T root_pi()
|
GLM_FUNC_QUALIFIER genType root_pi()
|
||||||
{
|
{
|
||||||
return T(1.772453850905516027);
|
return genType(1.772453850905516027);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T half_pi()
|
GLM_FUNC_QUALIFIER genType half_pi()
|
||||||
{
|
{
|
||||||
return T(1.57079632679489661923132169163975144);
|
return genType(1.57079632679489661923132169163975144);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T quarter_pi()
|
GLM_FUNC_QUALIFIER genType quarter_pi()
|
||||||
{
|
{
|
||||||
return T(0.785398163397448309615660845819875721);
|
return genType(0.785398163397448309615660845819875721);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T one_over_pi()
|
GLM_FUNC_QUALIFIER genType one_over_pi()
|
||||||
{
|
{
|
||||||
return T(0.318309886183790671537767526745028724);
|
return genType(0.318309886183790671537767526745028724);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T two_over_pi()
|
GLM_FUNC_QUALIFIER genType two_over_pi()
|
||||||
{
|
{
|
||||||
return T(0.636619772367581343075535053490057448);
|
return genType(0.636619772367581343075535053490057448);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T two_over_root_pi()
|
GLM_FUNC_QUALIFIER genType two_over_root_pi()
|
||||||
{
|
{
|
||||||
return T(1.12837916709551257389615890312154517);
|
return genType(1.12837916709551257389615890312154517);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T one_over_root_two()
|
GLM_FUNC_QUALIFIER genType one_over_root_two()
|
||||||
{
|
{
|
||||||
return T(0.707106781186547524400844362104849039);
|
return genType(0.707106781186547524400844362104849039);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T root_half_pi()
|
GLM_FUNC_QUALIFIER genType root_half_pi()
|
||||||
{
|
{
|
||||||
return T(1.253314137315500251);
|
return genType(1.253314137315500251);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T root_two_pi()
|
GLM_FUNC_QUALIFIER genType root_two_pi()
|
||||||
{
|
{
|
||||||
return T(2.506628274631000502);
|
return genType(2.506628274631000502);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T root_ln_four()
|
GLM_FUNC_QUALIFIER genType root_ln_four()
|
||||||
{
|
{
|
||||||
return T(1.17741002251547469);
|
return genType(1.17741002251547469);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T e()
|
GLM_FUNC_QUALIFIER genType e()
|
||||||
{
|
{
|
||||||
return T(2.71828182845904523536);
|
return genType(2.71828182845904523536);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T euler()
|
GLM_FUNC_QUALIFIER genType euler()
|
||||||
{
|
{
|
||||||
return T(0.577215664901532860606);
|
return genType(0.577215664901532860606);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T root_two()
|
GLM_FUNC_QUALIFIER genType root_two()
|
||||||
{
|
{
|
||||||
return T(1.41421356237309504880168872420969808);
|
return genType(1.41421356237309504880168872420969808);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T root_three()
|
GLM_FUNC_QUALIFIER genType root_three()
|
||||||
{
|
{
|
||||||
return T(1.73205080756887729352744634150587236);
|
return genType(1.73205080756887729352744634150587236);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T root_five()
|
GLM_FUNC_QUALIFIER genType root_five()
|
||||||
{
|
{
|
||||||
return T(2.23606797749978969640917366873127623);
|
return genType(2.23606797749978969640917366873127623);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T ln_two()
|
GLM_FUNC_QUALIFIER genType ln_two()
|
||||||
{
|
{
|
||||||
return T(0.693147180559945309417232121458176568);
|
return genType(0.693147180559945309417232121458176568);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T ln_ten()
|
GLM_FUNC_QUALIFIER genType ln_ten()
|
||||||
{
|
{
|
||||||
return T(2.30258509299404568401799145468436421);
|
return genType(2.30258509299404568401799145468436421);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T ln_ln_two()
|
GLM_FUNC_QUALIFIER genType ln_ln_two()
|
||||||
{
|
{
|
||||||
return T(-0.3665129205816643);
|
return genType(-0.3665129205816643);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T third()
|
GLM_FUNC_QUALIFIER genType third()
|
||||||
{
|
{
|
||||||
return T(0.3333333333333333333333333333333333333333);
|
return genType(0.3333333333333333333333333333333333333333);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T two_thirds()
|
GLM_FUNC_QUALIFIER genType two_thirds()
|
||||||
{
|
{
|
||||||
return T(0.666666666666666666666666666666666666667);
|
return genType(0.666666666666666666666666666666666666667);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename genType>
|
||||||
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T golden_ratio()
|
GLM_FUNC_QUALIFIER genType golden_ratio()
|
||||||
{
|
{
|
||||||
return T(1.61803398874989484820458683436563811);
|
return genType(1.61803398874989484820458683436563811);
|
||||||
}
|
}
|
||||||
} //namespace glm
|
} //namespace glm
|
||||||
|
Loading…
Reference in New Issue
Block a user