Adding constexpr qualifier for cross product
This commit is contained in:
parent
6ce6cd9e26
commit
ae6fa0872f
@ -67,7 +67,7 @@ namespace detail
|
|||||||
template<typename T, qualifier Q, bool Aligned>
|
template<typename T, qualifier Q, bool Aligned>
|
||||||
struct compute_cross
|
struct compute_cross
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER static vec<3, T, Q> call(vec<3, T, Q> const& x, vec<3, T, Q> const& y)
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<3, T, Q> call(vec<3, T, Q> const& x, vec<3, T, Q> const& y)
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' accepts only floating-point inputs");
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' accepts only floating-point inputs");
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ namespace detail
|
|||||||
|
|
||||||
// cross
|
// cross
|
||||||
template<typename T, qualifier Q>
|
template<typename T, qualifier Q>
|
||||||
GLM_FUNC_QUALIFIER vec<3, T, Q> cross(vec<3, T, Q> const& x, vec<3, T, Q> const& y)
|
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<3, T, Q> cross(vec<3, T, Q> const& x, vec<3, T, Q> const& y)
|
||||||
{
|
{
|
||||||
return detail::compute_cross<T, Q, detail::is_aligned<Q>::value>::call(x, y);
|
return detail::compute_cross<T, Q, detail::is_aligned<Q>::value>::call(x, y);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ namespace glm
|
|||||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cross.xml">GLSL cross man page</a>
|
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cross.xml">GLSL cross man page</a>
|
||||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||||
template<typename T, qualifier Q>
|
template<typename T, qualifier Q>
|
||||||
GLM_FUNC_DECL vec<3, T, Q> cross(vec<3, T, Q> const& x, vec<3, T, Q> const& y);
|
GLM_FUNC_DECL GLM_CONSTEXPR vec<3, T, Q> cross(vec<3, T, Q> const& x, vec<3, T, Q> const& y);
|
||||||
|
|
||||||
/// Returns a vector in the same direction as x but with length of 1.
|
/// Returns a vector in the same direction as x but with length of 1.
|
||||||
/// According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefined and generate an error.
|
/// According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefined and generate an error.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user