mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 10:14:35 +00:00
Improve API documentation
This commit is contained in:
parent
d93a3be4ac
commit
2240849164
548
glm/common.hpp
548
glm/common.hpp
@ -1,8 +1,550 @@
|
||||
/// @ref core
|
||||
/// @file glm/common.hpp
|
||||
|
||||
#include "detail/setup.hpp"
|
||||
///
|
||||
/// @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>
|
||||
///
|
||||
/// @defgroup core_func_common Common functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/common.hpp> to use these core features.
|
||||
///
|
||||
/// These all operate component-wise. The description is per component.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "detail/func_common.hpp"
|
||||
#include "detail/setup.hpp"
|
||||
#include "detail/qualifier.hpp"
|
||||
#include "detail/type_int.hpp"
|
||||
#include "detail/_fixes.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_common
|
||||
/// @{
|
||||
|
||||
/// Returns x if x >= 0; otherwise, it returns -x.
|
||||
///
|
||||
/// @tparam genType floating-point or signed integer; scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs 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>
|
||||
/// @see qualifier
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType abs(genType x);
|
||||
|
||||
/// Returns x if x >= 0; otherwise, it returns -x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or signed integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> abs(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> sign(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns a value equal to the nearest integer that is less then or equal to x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> floor(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x
|
||||
/// whose absolute value is not larger than the absolute value of x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> trunc(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// The fraction 0.5 will round in a direction chosen by the
|
||||
/// implementation, presumably the direction that is fastest.
|
||||
/// This includes the possibility that round(x) returns the
|
||||
/// same value as roundEven(x) for all values of x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> round(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// A fractional part of 0.5 will round toward the nearest even
|
||||
/// integer. (Both 3.5 and 4.5 for x will return 4.0.)
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/roundEven.xml">GLSL roundEven 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>
|
||||
/// @see <a href="http://developer.amd.com/documentation/articles/pages/New-Round-to-Even-Technique.aspx">New round to even technique</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> roundEven(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns a value equal to the nearest integer
|
||||
/// that is greater than or equal to x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ceil.xml">GLSL ceil 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> ceil(vec<L, T, Q> const& x);
|
||||
|
||||
/// Return x - floor(x).
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType fract(genType x);
|
||||
|
||||
/// Return x - floor(x).
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> fract(vec<L, T, Q> const& x);
|
||||
|
||||
/// Modulus. Returns x - y * floor(x / y)
|
||||
/// for each component in x using the floating point value y.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType mod(genType x, genType y);
|
||||
|
||||
/// Modulus. Returns x - y * floor(x / y)
|
||||
/// for each component in x using the floating point value y.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> mod(vec<L, T, Q> const& x, T y);
|
||||
|
||||
/// Modulus. Returns x - y * floor(x / y)
|
||||
/// for each component in x using the floating point value y.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> mod(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the fractional part of x and sets i to the integer
|
||||
/// part (as a whole number floating point value). Both the
|
||||
/// return value and the output parameter will have the same
|
||||
/// sign as x.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/modf.xml">GLSL modf man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType modf(genType x, genType& i);
|
||||
|
||||
/// Returns y if y < x; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam genType Floating-point or integer; scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType min(genType x, genType y);
|
||||
|
||||
/// Returns y if y < x; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> min(vec<L, T, Q> const& x, T y);
|
||||
|
||||
/// Returns y if y < x; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> min(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns y if x < y; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam genType Floating-point or integer; scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType max(genType x, genType y);
|
||||
|
||||
/// Returns y if x < y; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> max(vec<L, T, Q> const& x, T y);
|
||||
|
||||
/// Returns y if x < y; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> max(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns min(max(x, minVal), maxVal) for each component in x
|
||||
/// using the floating-point values minVal and maxVal.
|
||||
///
|
||||
/// @tparam genType Floating-point or integer; scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal);
|
||||
|
||||
/// Returns min(max(x, minVal), maxVal) for each component in x
|
||||
/// using the floating-point values minVal and maxVal.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> clamp(vec<L, T, Q> const& x, T minVal, T maxVal);
|
||||
|
||||
/// Returns min(max(x, minVal), maxVal) for each component in x
|
||||
/// using the floating-point values minVal and maxVal.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> clamp(vec<L, T, Q> const& x, vec<L, T, Q> const& minVal, vec<L, T, Q> const& maxVal);
|
||||
|
||||
/// If genTypeU is a floating scalar or vector:
|
||||
/// Returns x * (1.0 - a) + y * a, i.e., the linear blend of
|
||||
/// x and y using the floating-point value a.
|
||||
/// The value for a is not restricted to the range [0, 1].
|
||||
///
|
||||
/// If genTypeU is a boolean scalar or vector:
|
||||
/// Selects which vector each returned component comes
|
||||
/// from. For a component of 'a' that is false, the
|
||||
/// corresponding component of 'x' is returned. For a
|
||||
/// component of 'a' that is true, the corresponding
|
||||
/// component of 'y' is returned. Components of 'x' and 'y' that
|
||||
/// are not selected are allowed to be invalid floating point
|
||||
/// values and will have no effect on the results. Thus, this
|
||||
/// provides different functionality than
|
||||
/// genType mix(genType x, genType y, genType(a))
|
||||
/// where a is a Boolean vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mix.xml">GLSL mix 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>
|
||||
///
|
||||
/// @param[in] x Value to interpolate.
|
||||
/// @param[in] y Value to interpolate.
|
||||
/// @param[in] a Interpolant.
|
||||
///
|
||||
/// @tparam genTypeT Floating point scalar or vector.
|
||||
/// @tparam genTypeU Floating point or boolean scalar or vector. It can't be a vector if it is the length of genTypeT.
|
||||
///
|
||||
/// @code
|
||||
/// #include <glm/glm.hpp>
|
||||
/// ...
|
||||
/// float a;
|
||||
/// bool b;
|
||||
/// glm::dvec3 e;
|
||||
/// glm::dvec3 f;
|
||||
/// glm::vec4 g;
|
||||
/// glm::vec4 h;
|
||||
/// ...
|
||||
/// glm::vec4 r = glm::mix(g, h, a); // Interpolate with a floating-point scalar two vectors.
|
||||
/// glm::vec4 s = glm::mix(g, h, b); // Returns g or h;
|
||||
/// glm::dvec3 t = glm::mix(e, f, a); // Types of the third parameter is not required to match with the first and the second.
|
||||
/// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter.
|
||||
/// @endcode
|
||||
template<typename genTypeT, typename genTypeU>
|
||||
GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a);
|
||||
|
||||
template<length_t L, typename T, typename U, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> mix(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, U, Q> const& a);
|
||||
|
||||
template<length_t L, typename T, typename U, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> mix(vec<L, T, Q> const& x, vec<L, T, Q> const& y, U a);
|
||||
|
||||
/// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType step(genType edge, genType x);
|
||||
|
||||
/// Returns 0.0 if x < edge, otherwise it returns 1.0.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> step(T edge, vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns 0.0 if x < edge, otherwise it returns 1.0.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> step(vec<L, T, Q> const& edge, vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
|
||||
/// performs smooth Hermite interpolation between 0 and 1
|
||||
/// when edge0 < x < edge1. This is useful in cases where
|
||||
/// you would want a threshold function with a smooth
|
||||
/// transition. This is equivalent to:
|
||||
/// genType t;
|
||||
/// t = clamp ((x - edge0) / (edge1 - edge0), 0, 1);
|
||||
/// return t * t * (3 - 2 * t);
|
||||
/// Results are undefined if edge0 >= edge1.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/smoothstep.xml">GLSL smoothstep man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType smoothstep(genType edge0, genType edge1, genType x);
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> smoothstep(T edge0, T edge1, vec<L, T, Q> const& x);
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> smoothstep(vec<L, T, Q> const& edge0, vec<L, T, Q> const& edge1, vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns true if x holds a NaN (not a number)
|
||||
/// representation in the underlying implementation's set of
|
||||
/// floating point representations. Returns false otherwise,
|
||||
/// including for implementations with no NaN
|
||||
/// representations.
|
||||
///
|
||||
/// /!\ When using compiler fast math, this function may fail.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan 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 Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> isnan(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns true if x holds a positive infinity or negative
|
||||
/// infinity representation in the underlying implementation's
|
||||
/// set of floating point representations. Returns false
|
||||
/// otherwise, including for implementations with no infinity
|
||||
/// representations.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isinf.xml">GLSL isinf 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 Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> isinf(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns a signed integer value representing
|
||||
/// the encoding of a floating-point value. The floating-point
|
||||
/// value's bit-level representation is preserved.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt 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>
|
||||
GLM_FUNC_DECL int floatBitsToInt(float const& v);
|
||||
|
||||
/// Returns a signed integer value representing
|
||||
/// the encoding of a floating-point value. The floatingpoint
|
||||
/// value's bit-level representation is preserved.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt 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, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, int, Q> floatBitsToInt(vec<L, float, Q> const& v);
|
||||
|
||||
/// Returns a unsigned integer value representing
|
||||
/// the encoding of a floating-point value. The floatingpoint
|
||||
/// value's bit-level representation is preserved.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint 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>
|
||||
GLM_FUNC_DECL uint floatBitsToUint(float const& v);
|
||||
|
||||
/// Returns a unsigned integer value representing
|
||||
/// the encoding of a floating-point value. The floatingpoint
|
||||
/// value's bit-level representation is preserved.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint 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, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, uint, Q> floatBitsToUint(vec<L, float, Q> const& v);
|
||||
|
||||
/// Returns a floating-point value corresponding to a signed
|
||||
/// integer encoding of a floating-point value.
|
||||
/// If an inf or NaN is passed in, it will not signal, and the
|
||||
/// resulting floating point value is unspecified. Otherwise,
|
||||
/// the bit-level representation is preserved.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat 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>
|
||||
GLM_FUNC_DECL float intBitsToFloat(int const& v);
|
||||
|
||||
/// Returns a floating-point value corresponding to a signed
|
||||
/// integer encoding of a floating-point value.
|
||||
/// If an inf or NaN is passed in, it will not signal, and the
|
||||
/// resulting floating point value is unspecified. Otherwise,
|
||||
/// the bit-level representation is preserved.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat 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, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, float, Q> intBitsToFloat(vec<L, int, Q> const& v);
|
||||
|
||||
/// Returns a floating-point value corresponding to a
|
||||
/// unsigned integer encoding of a floating-point value.
|
||||
/// If an inf or NaN is passed in, it will not signal, and the
|
||||
/// resulting floating point value is unspecified. Otherwise,
|
||||
/// the bit-level representation is preserved.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat 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>
|
||||
GLM_FUNC_DECL float uintBitsToFloat(uint const& v);
|
||||
|
||||
/// Returns a floating-point value corresponding to a
|
||||
/// unsigned integer encoding of a floating-point value.
|
||||
/// If an inf or NaN is passed in, it will not signal, and the
|
||||
/// resulting floating point value is unspecified. Otherwise,
|
||||
/// the bit-level representation is preserved.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat 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, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, float, Q> uintBitsToFloat(vec<L, uint, Q> const& v);
|
||||
|
||||
/// Computes and returns a * b + c.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fma.xml">GLSL fma man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType fma(genType const& a, genType const& b, genType const& c);
|
||||
|
||||
/// Splits x into a floating-point significand in the range
|
||||
/// [0.5, 1.0) and an integral exponent of two, such that:
|
||||
/// x = significand * exp(2, exponent)
|
||||
///
|
||||
/// The significand is returned by the function and the
|
||||
/// exponent is returned in the parameter exp. For a
|
||||
/// floating-point value of zero, the significant and exponent
|
||||
/// are both zero. For a floating-point value that is an
|
||||
/// infinity or is not a number, the results are undefined.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/frexp.xml">GLSL frexp man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType, typename genIType>
|
||||
GLM_FUNC_DECL genType frexp(genType const& x, genIType& exp);
|
||||
|
||||
/// Builds a floating-point number from x and the
|
||||
/// corresponding integral exponent of two in exp, returning:
|
||||
/// significand * exp(2, exponent)
|
||||
///
|
||||
/// If this product is too large to be represented in the
|
||||
/// floating-point type, the result is undefined.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ldexp.xml">GLSL ldexp man page</a>;
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType, typename genIType>
|
||||
GLM_FUNC_DECL genType ldexp(genType const& x, genIType const& exp);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "detail/func_common.inl"
|
||||
|
||||
|
@ -1,550 +0,0 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_common.hpp
|
||||
///
|
||||
/// @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>
|
||||
///
|
||||
/// @defgroup core_func_common Common functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/common.hpp> to use these core features.
|
||||
///
|
||||
/// These all operate component-wise. The description is per component.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
#include "qualifier.hpp"
|
||||
#include "type_int.hpp"
|
||||
#include "_fixes.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_common
|
||||
/// @{
|
||||
|
||||
/// Returns x if x >= 0; otherwise, it returns -x.
|
||||
///
|
||||
/// @tparam genType floating-point or signed integer; scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs 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>
|
||||
/// @see qualifier
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType abs(genType x);
|
||||
|
||||
/// Returns x if x >= 0; otherwise, it returns -x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or signed integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> abs(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> sign(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns a value equal to the nearest integer that is less then or equal to x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> floor(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x
|
||||
/// whose absolute value is not larger than the absolute value of x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> trunc(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// The fraction 0.5 will round in a direction chosen by the
|
||||
/// implementation, presumably the direction that is fastest.
|
||||
/// This includes the possibility that round(x) returns the
|
||||
/// same value as roundEven(x) for all values of x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> round(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// A fractional part of 0.5 will round toward the nearest even
|
||||
/// integer. (Both 3.5 and 4.5 for x will return 4.0.)
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/roundEven.xml">GLSL roundEven 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>
|
||||
/// @see <a href="http://developer.amd.com/documentation/articles/pages/New-Round-to-Even-Technique.aspx">New round to even technique</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> roundEven(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns a value equal to the nearest integer
|
||||
/// that is greater than or equal to x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ceil.xml">GLSL ceil 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> ceil(vec<L, T, Q> const& x);
|
||||
|
||||
/// Return x - floor(x).
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType fract(genType x);
|
||||
|
||||
/// Return x - floor(x).
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> fract(vec<L, T, Q> const& x);
|
||||
|
||||
/// Modulus. Returns x - y * floor(x / y)
|
||||
/// for each component in x using the floating point value y.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType mod(genType x, genType y);
|
||||
|
||||
/// Modulus. Returns x - y * floor(x / y)
|
||||
/// for each component in x using the floating point value y.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> mod(vec<L, T, Q> const& x, T y);
|
||||
|
||||
/// Modulus. Returns x - y * floor(x / y)
|
||||
/// for each component in x using the floating point value y.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> mod(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the fractional part of x and sets i to the integer
|
||||
/// part (as a whole number floating point value). Both the
|
||||
/// return value and the output parameter will have the same
|
||||
/// sign as x.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/modf.xml">GLSL modf man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType modf(genType x, genType& i);
|
||||
|
||||
/// Returns y if y < x; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam genType Floating-point or integer; scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType min(genType x, genType y);
|
||||
|
||||
/// Returns y if y < x; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> min(vec<L, T, Q> const& x, T y);
|
||||
|
||||
/// Returns y if y < x; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> min(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns y if x < y; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam genType Floating-point or integer; scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType max(genType x, genType y);
|
||||
|
||||
/// Returns y if x < y; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> max(vec<L, T, Q> const& x, T y);
|
||||
|
||||
/// Returns y if x < y; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> max(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns min(max(x, minVal), maxVal) for each component in x
|
||||
/// using the floating-point values minVal and maxVal.
|
||||
///
|
||||
/// @tparam genType Floating-point or integer; scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal);
|
||||
|
||||
/// Returns min(max(x, minVal), maxVal) for each component in x
|
||||
/// using the floating-point values minVal and maxVal.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> clamp(vec<L, T, Q> const& x, T minVal, T maxVal);
|
||||
|
||||
/// Returns min(max(x, minVal), maxVal) for each component in x
|
||||
/// using the floating-point values minVal and maxVal.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point or integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> clamp(vec<L, T, Q> const& x, vec<L, T, Q> const& minVal, vec<L, T, Q> const& maxVal);
|
||||
|
||||
/// If genTypeU is a floating scalar or vector:
|
||||
/// Returns x * (1.0 - a) + y * a, i.e., the linear blend of
|
||||
/// x and y using the floating-point value a.
|
||||
/// The value for a is not restricted to the range [0, 1].
|
||||
///
|
||||
/// If genTypeU is a boolean scalar or vector:
|
||||
/// Selects which vector each returned component comes
|
||||
/// from. For a component of 'a' that is false, the
|
||||
/// corresponding component of 'x' is returned. For a
|
||||
/// component of 'a' that is true, the corresponding
|
||||
/// component of 'y' is returned. Components of 'x' and 'y' that
|
||||
/// are not selected are allowed to be invalid floating point
|
||||
/// values and will have no effect on the results. Thus, this
|
||||
/// provides different functionality than
|
||||
/// genType mix(genType x, genType y, genType(a))
|
||||
/// where a is a Boolean vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mix.xml">GLSL mix 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>
|
||||
///
|
||||
/// @param[in] x Value to interpolate.
|
||||
/// @param[in] y Value to interpolate.
|
||||
/// @param[in] a Interpolant.
|
||||
///
|
||||
/// @tparam genTypeT Floating point scalar or vector.
|
||||
/// @tparam genTypeU Floating point or boolean scalar or vector. It can't be a vector if it is the length of genTypeT.
|
||||
///
|
||||
/// @code
|
||||
/// #include <glm/glm.hpp>
|
||||
/// ...
|
||||
/// float a;
|
||||
/// bool b;
|
||||
/// glm::dvec3 e;
|
||||
/// glm::dvec3 f;
|
||||
/// glm::vec4 g;
|
||||
/// glm::vec4 h;
|
||||
/// ...
|
||||
/// glm::vec4 r = glm::mix(g, h, a); // Interpolate with a floating-point scalar two vectors.
|
||||
/// glm::vec4 s = glm::mix(g, h, b); // Returns g or h;
|
||||
/// glm::dvec3 t = glm::mix(e, f, a); // Types of the third parameter is not required to match with the first and the second.
|
||||
/// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter.
|
||||
/// @endcode
|
||||
template<typename genTypeT, typename genTypeU>
|
||||
GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a);
|
||||
|
||||
template<length_t L, typename T, typename U, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> mix(vec<L, T, Q> const& x, vec<L, T, Q> const& y, vec<L, U, Q> const& a);
|
||||
|
||||
template<length_t L, typename T, typename U, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> mix(vec<L, T, Q> const& x, vec<L, T, Q> const& y, U a);
|
||||
|
||||
/// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType step(genType edge, genType x);
|
||||
|
||||
/// Returns 0.0 if x < edge, otherwise it returns 1.0.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> step(T edge, vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns 0.0 if x < edge, otherwise it returns 1.0.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step 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 Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> step(vec<L, T, Q> const& edge, vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
|
||||
/// performs smooth Hermite interpolation between 0 and 1
|
||||
/// when edge0 < x < edge1. This is useful in cases where
|
||||
/// you would want a threshold function with a smooth
|
||||
/// transition. This is equivalent to:
|
||||
/// genType t;
|
||||
/// t = clamp ((x - edge0) / (edge1 - edge0), 0, 1);
|
||||
/// return t * t * (3 - 2 * t);
|
||||
/// Results are undefined if edge0 >= edge1.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/smoothstep.xml">GLSL smoothstep man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType smoothstep(genType edge0, genType edge1, genType x);
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> smoothstep(T edge0, T edge1, vec<L, T, Q> const& x);
|
||||
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> smoothstep(vec<L, T, Q> const& edge0, vec<L, T, Q> const& edge1, vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns true if x holds a NaN (not a number)
|
||||
/// representation in the underlying implementation's set of
|
||||
/// floating point representations. Returns false otherwise,
|
||||
/// including for implementations with no NaN
|
||||
/// representations.
|
||||
///
|
||||
/// /!\ When using compiler fast math, this function may fail.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan 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 Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> isnan(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns true if x holds a positive infinity or negative
|
||||
/// infinity representation in the underlying implementation's
|
||||
/// set of floating point representations. Returns false
|
||||
/// otherwise, including for implementations with no infinity
|
||||
/// representations.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isinf.xml">GLSL isinf 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 Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> isinf(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns a signed integer value representing
|
||||
/// the encoding of a floating-point value. The floating-point
|
||||
/// value's bit-level representation is preserved.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt 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>
|
||||
GLM_FUNC_DECL int floatBitsToInt(float const& v);
|
||||
|
||||
/// Returns a signed integer value representing
|
||||
/// the encoding of a floating-point value. The floatingpoint
|
||||
/// value's bit-level representation is preserved.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt 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, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, int, Q> floatBitsToInt(vec<L, float, Q> const& v);
|
||||
|
||||
/// Returns a unsigned integer value representing
|
||||
/// the encoding of a floating-point value. The floatingpoint
|
||||
/// value's bit-level representation is preserved.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint 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>
|
||||
GLM_FUNC_DECL uint floatBitsToUint(float const& v);
|
||||
|
||||
/// Returns a unsigned integer value representing
|
||||
/// the encoding of a floating-point value. The floatingpoint
|
||||
/// value's bit-level representation is preserved.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint 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, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, uint, Q> floatBitsToUint(vec<L, float, Q> const& v);
|
||||
|
||||
/// Returns a floating-point value corresponding to a signed
|
||||
/// integer encoding of a floating-point value.
|
||||
/// If an inf or NaN is passed in, it will not signal, and the
|
||||
/// resulting floating point value is unspecified. Otherwise,
|
||||
/// the bit-level representation is preserved.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat 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>
|
||||
GLM_FUNC_DECL float intBitsToFloat(int const& v);
|
||||
|
||||
/// Returns a floating-point value corresponding to a signed
|
||||
/// integer encoding of a floating-point value.
|
||||
/// If an inf or NaN is passed in, it will not signal, and the
|
||||
/// resulting floating point value is unspecified. Otherwise,
|
||||
/// the bit-level representation is preserved.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/intBitsToFloat.xml">GLSL intBitsToFloat 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, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, float, Q> intBitsToFloat(vec<L, int, Q> const& v);
|
||||
|
||||
/// Returns a floating-point value corresponding to a
|
||||
/// unsigned integer encoding of a floating-point value.
|
||||
/// If an inf or NaN is passed in, it will not signal, and the
|
||||
/// resulting floating point value is unspecified. Otherwise,
|
||||
/// the bit-level representation is preserved.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat 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>
|
||||
GLM_FUNC_DECL float uintBitsToFloat(uint const& v);
|
||||
|
||||
/// Returns a floating-point value corresponding to a
|
||||
/// unsigned integer encoding of a floating-point value.
|
||||
/// If an inf or NaN is passed in, it will not signal, and the
|
||||
/// resulting floating point value is unspecified. Otherwise,
|
||||
/// the bit-level representation is preserved.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uintBitsToFloat.xml">GLSL uintBitsToFloat 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, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, float, Q> uintBitsToFloat(vec<L, uint, Q> const& v);
|
||||
|
||||
/// Computes and returns a * b + c.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fma.xml">GLSL fma man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL genType fma(genType const& a, genType const& b, genType const& c);
|
||||
|
||||
/// Splits x into a floating-point significand in the range
|
||||
/// [0.5, 1.0) and an integral exponent of two, such that:
|
||||
/// x = significand * exp(2, exponent)
|
||||
///
|
||||
/// The significand is returned by the function and the
|
||||
/// exponent is returned in the parameter exp. For a
|
||||
/// floating-point value of zero, the significant and exponent
|
||||
/// are both zero. For a floating-point value that is an
|
||||
/// infinity or is not a number, the results are undefined.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/frexp.xml">GLSL frexp man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType, typename genIType>
|
||||
GLM_FUNC_DECL genType frexp(genType const& x, genIType& exp);
|
||||
|
||||
/// Builds a floating-point number from x and the
|
||||
/// corresponding integral exponent of two in exp, returning:
|
||||
/// significand * exp(2, exponent)
|
||||
///
|
||||
/// If this product is too large to be represented in the
|
||||
/// floating-point type, the result is undefined.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ldexp.xml">GLSL ldexp man page</a>;
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template<typename genType, typename genIType>
|
||||
GLM_FUNC_DECL genType ldexp(genType const& x, genIType const& exp);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_common.inl"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_common.inl
|
||||
|
||||
#include "func_vector_relational.hpp"
|
||||
#include "../vector_relational.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
|
@ -1,108 +0,0 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_exponential.hpp
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
///
|
||||
/// @defgroup core_func_exponential Exponential functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/exponential.hpp> to use these core features.
|
||||
///
|
||||
/// These all operate component-wise. The description is per component.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "type_vec1.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include <cmath>
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_exponential
|
||||
/// @{
|
||||
|
||||
/// Returns 'base' raised to the power 'exponent'.
|
||||
///
|
||||
/// @param base Floating point value. pow function is defined for input values of 'base' defined in the range (inf-, inf+) in the limit of the type qualifier.
|
||||
/// @param exponent Floating point value representing the 'exponent'.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> pow(vec<L, T, Q> const& base, vec<L, T, Q> const& exponent);
|
||||
|
||||
/// Returns the natural exponentiation of x, i.e., e^x.
|
||||
///
|
||||
/// @param v exp function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type qualifier.
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> exp(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the natural logarithm of v, i.e.,
|
||||
/// returns the value y which satisfies the equation x = e^y.
|
||||
/// Results are undefined if v <= 0.
|
||||
///
|
||||
/// @param v log function is defined for input values of v defined in the range (0, inf+) in the limit of the type qualifier.
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log.xml">GLSL log man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> log(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns 2 raised to the v power.
|
||||
///
|
||||
/// @param v exp2 function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type qualifier.
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp2.xml">GLSL exp2 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> exp2(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the base 2 log of x, i.e., returns the value y,
|
||||
/// which satisfies the equation x = 2 ^ y.
|
||||
///
|
||||
/// @param v log2 function is defined for input values of v defined in the range (0, inf+) in the limit of the type qualifier.
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> log2(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the positive square root of v.
|
||||
///
|
||||
/// @param v sqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type qualifier.
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> sqrt(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the reciprocal of the positive square root of v.
|
||||
///
|
||||
/// @param v inversesqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type qualifier.
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inversesqrt.xml">GLSL inversesqrt man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> inversesqrt(vec<L, T, Q> const& v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_exponential.inl"
|
@ -1,7 +1,7 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_exponential.inl
|
||||
|
||||
#include "func_vector_relational.hpp"
|
||||
#include "../vector_relational.hpp"
|
||||
#include "_vectorize.hpp"
|
||||
#include <limits>
|
||||
#include <cmath>
|
||||
|
@ -1,116 +0,0 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_geometric.hpp
|
||||
///
|
||||
/// @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>
|
||||
///
|
||||
/// @defgroup core_func_geometric Geometric functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/geometric.hpp> to use these core features.
|
||||
///
|
||||
/// These operate on vectors as vectors, not component-wise.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "type_vec3.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_geometric
|
||||
/// @{
|
||||
|
||||
/// Returns the length of x, i.e., sqrt(x * x).
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/length.xml">GLSL length 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T length(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/distance.xml">GLSL distance 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T distance(vec<L, T, Q> const& p0, vec<L, T, Q> const& p1);
|
||||
|
||||
/// Returns the dot product of x and y, i.e., result = x * y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/dot.xml">GLSL dot 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T dot(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the cross product of x and y.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @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>
|
||||
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);
|
||||
|
||||
/// 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.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/normalize.xml">GLSL normalize 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> normalize(vec<L, T, Q> const& x);
|
||||
|
||||
/// If dot(Nref, I) < 0.0, return N, otherwise, return -N.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/faceforward.xml">GLSL faceforward 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> faceforward(
|
||||
vec<L, T, Q> const& N,
|
||||
vec<L, T, Q> const& I,
|
||||
vec<L, T, Q> const& Nref);
|
||||
|
||||
/// For the incident vector I and surface orientation N,
|
||||
/// returns the reflection direction : result = I - 2.0 * dot(N, I) * N.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/reflect.xml">GLSL reflect 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> reflect(
|
||||
vec<L, T, Q> const& I,
|
||||
vec<L, T, Q> const& N);
|
||||
|
||||
/// For the incident vector I and surface normal N,
|
||||
/// and the ratio of indices of refraction eta,
|
||||
/// return the refraction vector.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/refract.xml">GLSL refract 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> refract(
|
||||
vec<L, T, Q> const& I,
|
||||
vec<L, T, Q> const& N,
|
||||
T eta);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_geometric.inl"
|
@ -1,8 +1,8 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_geometric.inl
|
||||
|
||||
#include "func_exponential.hpp"
|
||||
#include "func_common.hpp"
|
||||
#include "../exponential.hpp"
|
||||
#include "../common.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
#include "type_float.hpp"
|
||||
|
@ -1,211 +0,0 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_integer.hpp
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
///
|
||||
/// @defgroup core_func_integer Integer functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/integer.hpp> to use these core features.
|
||||
///
|
||||
/// These all operate component-wise. The description is per component.
|
||||
/// The notation [a, b] means the set of bits from bit-number a through bit-number
|
||||
/// b, inclusive. The lowest-order bit is bit 0.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
#include "qualifier.hpp"
|
||||
#include "func_common.hpp"
|
||||
#include "func_vector_relational.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_integer
|
||||
/// @{
|
||||
|
||||
/// Adds 32-bit unsigned integer x and y, returning the sum
|
||||
/// modulo pow(2, 32). The value carry is set to 0 if the sum was
|
||||
/// less than pow(2, 32), or to 1 otherwise.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uaddCarry.xml">GLSL uaddCarry man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, uint, Q> uaddCarry(
|
||||
vec<L, uint, Q> const& x,
|
||||
vec<L, uint, Q> const& y,
|
||||
vec<L, uint, Q> & carry);
|
||||
|
||||
/// Subtracts the 32-bit unsigned integer y from x, returning
|
||||
/// the difference if non-negative, or pow(2, 32) plus the difference
|
||||
/// otherwise. The value borrow is set to 0 if x >= y, or to 1 otherwise.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/usubBorrow.xml">GLSL usubBorrow man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, uint, Q> usubBorrow(
|
||||
vec<L, uint, Q> const& x,
|
||||
vec<L, uint, Q> const& y,
|
||||
vec<L, uint, Q> & borrow);
|
||||
|
||||
/// Multiplies 32-bit integers x and y, producing a 64-bit
|
||||
/// result. The 32 least-significant bits are returned in lsb.
|
||||
/// The 32 most-significant bits are returned in msb.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/umulExtended.xml">GLSL umulExtended man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL void umulExtended(
|
||||
vec<L, uint, Q> const& x,
|
||||
vec<L, uint, Q> const& y,
|
||||
vec<L, uint, Q> & msb,
|
||||
vec<L, uint, Q> & lsb);
|
||||
|
||||
/// Multiplies 32-bit integers x and y, producing a 64-bit
|
||||
/// result. The 32 least-significant bits are returned in lsb.
|
||||
/// The 32 most-significant bits are returned in msb.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/imulExtended.xml">GLSL imulExtended man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL void imulExtended(
|
||||
vec<L, int, Q> const& x,
|
||||
vec<L, int, Q> const& y,
|
||||
vec<L, int, Q> & msb,
|
||||
vec<L, int, Q> & lsb);
|
||||
|
||||
/// Extracts bits [offset, offset + bits - 1] from value,
|
||||
/// returning them in the least significant bits of the result.
|
||||
/// For unsigned data types, the most significant bits of the
|
||||
/// result will be set to zero. For signed data types, the
|
||||
/// most significant bits will be set to the value of bit offset + base - 1.
|
||||
///
|
||||
/// If bits is zero, the result will be zero. The result will be
|
||||
/// undefined if offset or bits is negative, or if the sum of
|
||||
/// offset and bits is greater than the number of bits used
|
||||
/// to store the operand.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldExtract.xml">GLSL bitfieldExtract man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> bitfieldExtract(
|
||||
vec<L, T, Q> const& Value,
|
||||
int Offset,
|
||||
int Bits);
|
||||
|
||||
/// Returns the insertion the bits least-significant bits of insert into base.
|
||||
///
|
||||
/// The result will have bits [offset, offset + bits - 1] taken
|
||||
/// from bits [0, bits - 1] of insert, and all other bits taken
|
||||
/// directly from the corresponding bits of base. If bits is
|
||||
/// zero, the result will simply be base. The result will be
|
||||
/// undefined if offset or bits is negative, or if the sum of
|
||||
/// offset and bits is greater than the number of bits used to
|
||||
/// store the operand.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldInsert.xml">GLSL bitfieldInsert man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> bitfieldInsert(
|
||||
vec<L, T, Q> const& Base,
|
||||
vec<L, T, Q> const& Insert,
|
||||
int Offset,
|
||||
int Bits);
|
||||
|
||||
/// Returns the reversal of the bits of value.
|
||||
/// The bit numbered n of the result will be taken from bit (bits - 1) - n of value,
|
||||
/// where bits is the total number of bits used to represent value.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldReverse.xml">GLSL bitfieldReverse man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> bitfieldReverse(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the number of bits set to 1 in the binary representation of value.
|
||||
///
|
||||
/// @tparam genType Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitCount.xml">GLSL bitCount man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL int bitCount(genType v);
|
||||
|
||||
/// Returns the number of bits set to 1 in the binary representation of value.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitCount.xml">GLSL bitCount man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, int, Q> bitCount(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the bit number of the least significant bit set to
|
||||
/// 1 in the binary representation of value.
|
||||
/// If value is zero, -1 will be returned.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findLSB.xml">GLSL findLSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_DECL int findLSB(genIUType x);
|
||||
|
||||
/// Returns the bit number of the least significant bit set to
|
||||
/// 1 in the binary representation of value.
|
||||
/// If value is zero, -1 will be returned.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findLSB.xml">GLSL findLSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, int, Q> findLSB(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the bit number of the most significant bit in the binary representation of value.
|
||||
/// For positive integers, the result will be the bit number of the most significant bit set to 1.
|
||||
/// For negative integers, the result will be the bit number of the most significant
|
||||
/// bit set to 0. For a value of zero or negative one, -1 will be returned.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findMSB.xml">GLSL findMSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_DECL int findMSB(genIUType x);
|
||||
|
||||
/// Returns the bit number of the most significant bit in the binary representation of value.
|
||||
/// For positive integers, the result will be the bit number of the most significant bit set to 1.
|
||||
/// For negative integers, the result will be the bit number of the most significant
|
||||
/// bit set to 0. For a value of zero or negative one, -1 will be returned.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findMSB.xml">GLSL findMSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, int, Q> findMSB(vec<L, T, Q> const& v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_integer.inl"
|
@ -1,164 +0,0 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_matrix.hpp
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
///
|
||||
/// @defgroup core_func_matrix Matrix functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/matrix.hpp> to use these core features.
|
||||
///
|
||||
/// For each of the following built-in matrix functions, there is both a
|
||||
/// single-qualifier floating point version, where all arguments and return values
|
||||
/// are single qualifier, and a double-qualifier floating version, where all
|
||||
/// arguments and return values are double qualifier. Only the single-qualifier
|
||||
/// floating point version is shown.
|
||||
|
||||
#pragma once
|
||||
|
||||
// Dependencies
|
||||
#include "../detail/qualifier.hpp"
|
||||
#include "../detail/setup.hpp"
|
||||
#include "../detail/type_mat.hpp"
|
||||
#include "../vec2.hpp"
|
||||
#include "../vec3.hpp"
|
||||
#include "../vec4.hpp"
|
||||
#include "../mat2x2.hpp"
|
||||
#include "../mat2x3.hpp"
|
||||
#include "../mat2x4.hpp"
|
||||
#include "../mat3x2.hpp"
|
||||
#include "../mat3x3.hpp"
|
||||
#include "../mat3x4.hpp"
|
||||
#include "../mat4x2.hpp"
|
||||
#include "../mat4x3.hpp"
|
||||
#include "../mat4x4.hpp"
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<2, 2, T, Q>
|
||||
{
|
||||
typedef mat<2, 2, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<2, 3, T, Q>
|
||||
{
|
||||
typedef mat<3, 2, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<2, 4, T, Q>
|
||||
{
|
||||
typedef mat<4, 2, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<3, 2, T, Q>
|
||||
{
|
||||
typedef mat<2, 3, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<3, 3, T, Q>
|
||||
{
|
||||
typedef mat<3, 3, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<3, 4, T, Q>
|
||||
{
|
||||
typedef mat<4, 3, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<4, 2, T, Q>
|
||||
{
|
||||
typedef mat<2, 4, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<4, 3, T, Q>
|
||||
{
|
||||
typedef mat<3, 4, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<4, 4, T, Q>
|
||||
{
|
||||
typedef mat<4, 4, T, Q> type;
|
||||
};
|
||||
|
||||
}//namespace detail
|
||||
|
||||
/// @addtogroup core_func_matrix
|
||||
/// @{
|
||||
|
||||
/// Multiply matrix x by matrix y component-wise, i.e.,
|
||||
/// result[i][j] is the scalar product of x[i][j] and y[i][j].
|
||||
///
|
||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||
/// @tparam T Floating-point or signed integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL mat<C, R, T, Q> matrixCompMult(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y);
|
||||
|
||||
/// Treats the first parameter c as a column vector
|
||||
/// and the second parameter r as a row vector
|
||||
/// and does a linear algebraic matrix multiply c * r.
|
||||
///
|
||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||
/// @tparam T Floating-point or signed integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL typename detail::outerProduct_trait<C, R, T, Q>::type outerProduct(vec<C, T, Q> const& c, vec<R, T, Q> const& r);
|
||||
|
||||
/// Returns the transposed matrix of x
|
||||
///
|
||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||
/// @tparam T Floating-point or signed integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL typename mat<C, R, T, Q>::transpose_type transpose(mat<C, R, T, Q> const& x);
|
||||
|
||||
/// Return the determinant of a squared matrix.
|
||||
///
|
||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||
/// @tparam T Floating-point or signed integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T determinant(mat<C, R, T, Q> const& m);
|
||||
|
||||
/// Return the inverse of a squared matrix.
|
||||
///
|
||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||
/// @tparam T Floating-point or signed integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL mat<C, R, T, Q> inverse(mat<C, R, T, Q> const& m);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_matrix.inl"
|
@ -4,7 +4,7 @@
|
||||
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||
|
||||
#include "type_mat4x4.hpp"
|
||||
#include "func_geometric.hpp"
|
||||
#include "../geometric.hpp"
|
||||
#include "../simd/matrix.h"
|
||||
#include <cstring>
|
||||
|
||||
|
@ -1,170 +0,0 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_packing.hpp
|
||||
///
|
||||
/// @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>
|
||||
/// @see gtc_packing
|
||||
///
|
||||
/// @defgroup core_func_packing Floating-Point Pack and Unpack Functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/packing.hpp> to use these core features.
|
||||
///
|
||||
/// These functions do not operate component-wise, rather as described in each case.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_packing
|
||||
/// @{
|
||||
|
||||
/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
|
||||
/// Then, the results are packed into the returned 32-bit unsigned integer.
|
||||
///
|
||||
/// The conversion for component c of v to fixed point is done as follows:
|
||||
/// packUnorm2x16: round(clamp(c, 0, +1) * 65535.0)
|
||||
///
|
||||
/// The first component of the vector will be written to the least significant bits of the output;
|
||||
/// the last component will be written to the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm2x16.xml">GLSL packUnorm2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL uint packUnorm2x16(vec2 const& v);
|
||||
|
||||
/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
|
||||
/// Then, the results are packed into the returned 32-bit unsigned integer.
|
||||
///
|
||||
/// The conversion for component c of v to fixed point is done as follows:
|
||||
/// packSnorm2x16: round(clamp(v, -1, +1) * 32767.0)
|
||||
///
|
||||
/// The first component of the vector will be written to the least significant bits of the output;
|
||||
/// the last component will be written to the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm2x16.xml">GLSL packSnorm2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL uint packSnorm2x16(vec2 const& v);
|
||||
|
||||
/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
|
||||
/// Then, the results are packed into the returned 32-bit unsigned integer.
|
||||
///
|
||||
/// The conversion for component c of v to fixed point is done as follows:
|
||||
/// packUnorm4x8: round(clamp(c, 0, +1) * 255.0)
|
||||
///
|
||||
/// The first component of the vector will be written to the least significant bits of the output;
|
||||
/// the last component will be written to the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL uint packUnorm4x8(vec4 const& v);
|
||||
|
||||
/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
|
||||
/// Then, the results are packed into the returned 32-bit unsigned integer.
|
||||
///
|
||||
/// The conversion for component c of v to fixed point is done as follows:
|
||||
/// packSnorm4x8: round(clamp(c, -1, +1) * 127.0)
|
||||
///
|
||||
/// The first component of the vector will be written to the least significant bits of the output;
|
||||
/// the last component will be written to the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL uint packSnorm4x8(vec4 const& v);
|
||||
|
||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||
///
|
||||
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
|
||||
/// unpackUnorm2x16: f / 65535.0
|
||||
///
|
||||
/// The first component of the returned vector will be extracted from the least significant bits of the input;
|
||||
/// the last component will be extracted from the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec2 unpackUnorm2x16(uint p);
|
||||
|
||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||
///
|
||||
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
|
||||
/// unpackSnorm2x16: clamp(f / 32767.0, -1, +1)
|
||||
///
|
||||
/// The first component of the returned vector will be extracted from the least significant bits of the input;
|
||||
/// the last component will be extracted from the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec2 unpackSnorm2x16(uint p);
|
||||
|
||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||
///
|
||||
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
|
||||
/// unpackUnorm4x8: f / 255.0
|
||||
///
|
||||
/// The first component of the returned vector will be extracted from the least significant bits of the input;
|
||||
/// the last component will be extracted from the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec4 unpackUnorm4x8(uint p);
|
||||
|
||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||
///
|
||||
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
|
||||
/// unpackSnorm4x8: clamp(f / 127.0, -1, +1)
|
||||
///
|
||||
/// The first component of the returned vector will be extracted from the least significant bits of the input;
|
||||
/// the last component will be extracted from the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec4 unpackSnorm4x8(uint p);
|
||||
|
||||
/// Returns a double-qualifier value obtained by packing the components of v into a 64-bit value.
|
||||
/// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified.
|
||||
/// Otherwise, the bit- level representation of v is preserved.
|
||||
/// The first vector component specifies the 32 least significant bits;
|
||||
/// the second component specifies the 32 most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packDouble2x32.xml">GLSL packDouble2x32 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL double packDouble2x32(uvec2 const& v);
|
||||
|
||||
/// Returns a two-component unsigned integer vector representation of v.
|
||||
/// The bit-level representation of v is preserved.
|
||||
/// The first component of the vector contains the 32 least significant bits of the double;
|
||||
/// the second component consists the 32 most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackDouble2x32.xml">GLSL unpackDouble2x32 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL uvec2 unpackDouble2x32(double v);
|
||||
|
||||
/// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector
|
||||
/// to the 16-bit floating-point representation found in the OpenGL Specification,
|
||||
/// and then packing these two 16- bit integers into a 32-bit unsigned integer.
|
||||
/// The first vector component specifies the 16 least-significant bits of the result;
|
||||
/// the second component specifies the 16 most-significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL uint packHalf2x16(vec2 const& v);
|
||||
|
||||
/// Returns a two-component floating-point vector with components obtained by unpacking a 32-bit unsigned integer into a pair of 16-bit values,
|
||||
/// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification,
|
||||
/// and converting them to 32-bit floating-point values.
|
||||
/// The first component of the vector is obtained from the 16 least-significant bits of v;
|
||||
/// the second component is obtained from the 16 most-significant bits of v.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec2 unpackHalf2x16(uint v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_packing.inl"
|
@ -1,7 +1,7 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_packing.inl
|
||||
|
||||
#include "func_common.hpp"
|
||||
#include "../common.hpp"
|
||||
#include "type_half.hpp"
|
||||
#include "../fwd.hpp"
|
||||
|
||||
|
@ -1,208 +0,0 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_trigonometric.hpp
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
///
|
||||
/// @defgroup core_func_trigonometric Angle and Trigonometry Functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/trigonometric.hpp> to use these core features.
|
||||
///
|
||||
/// Function parameters specified as angle are assumed to be in units of radians.
|
||||
/// In no case will any of these functions result in a divide by zero error. If
|
||||
/// the divisor of a ratio is 0, then results will be undefined.
|
||||
///
|
||||
/// These all operate component-wise. The description is per component.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
#include "qualifier.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_trigonometric
|
||||
/// @{
|
||||
|
||||
/// Converts degrees to radians and returns the result.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> radians(vec<L, T, Q> const& degrees);
|
||||
|
||||
/// Converts radians to degrees and returns the result.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> degrees(vec<L, T, Q> const& radians);
|
||||
|
||||
/// The standard trigonometric sine function.
|
||||
/// The values returned by this function will range from [-1, 1].
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> sin(vec<L, T, Q> const& angle);
|
||||
|
||||
/// The standard trigonometric cosine function.
|
||||
/// The values returned by this function will range from [-1, 1].
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> cos(vec<L, T, Q> const& angle);
|
||||
|
||||
/// The standard trigonometric tangent function.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> tan(vec<L, T, Q> const& angle);
|
||||
|
||||
/// Arc sine. Returns an angle whose sine is x.
|
||||
/// The range of values returned by this function is [-PI/2, PI/2].
|
||||
/// Results are undefined if |x| > 1.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> asin(vec<L, T, Q> const& x);
|
||||
|
||||
/// Arc cosine. Returns an angle whose sine is x.
|
||||
/// The range of values returned by this function is [0, PI].
|
||||
/// Results are undefined if |x| > 1.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> acos(vec<L, T, Q> const& x);
|
||||
|
||||
/// Arc tangent. Returns an angle whose tangent is y/x.
|
||||
/// The signs of x and y are used to determine what
|
||||
/// quadrant the angle is in. The range of values returned
|
||||
/// by this function is [-PI, PI]. Results are undefined
|
||||
/// if x and y are both 0.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> atan(vec<L, T, Q> const& y, vec<L, T, Q> const& x);
|
||||
|
||||
/// Arc tangent. Returns an angle whose tangent is y_over_x.
|
||||
/// The range of values returned by this function is [-PI/2, PI/2].
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> atan(vec<L, T, Q> const& y_over_x);
|
||||
|
||||
/// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> sinh(vec<L, T, Q> const& angle);
|
||||
|
||||
/// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> cosh(vec<L, T, Q> const& angle);
|
||||
|
||||
/// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> tanh(vec<L, T, Q> const& angle);
|
||||
|
||||
/// Arc hyperbolic sine; returns the inverse of sinh.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> asinh(vec<L, T, Q> const& x);
|
||||
|
||||
/// Arc hyperbolic cosine; returns the non-negative inverse
|
||||
/// of cosh. Results are undefined if x < 1.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> acosh(vec<L, T, Q> const& x);
|
||||
|
||||
/// Arc hyperbolic tangent; returns the inverse of tanh.
|
||||
/// Results are undefined if abs(x) >= 1.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> atanh(vec<L, T, Q> const& x);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_trigonometric.inl"
|
@ -1,119 +0,0 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/func_vector_relational.hpp
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
///
|
||||
/// @defgroup core_func_vector_relational Vector Relational Functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/relational.hpp> to use these core features.
|
||||
///
|
||||
/// Relational and equality operators (<, <=, >, >=, ==, !=) are defined to
|
||||
/// operate on scalars and produce scalar Boolean results. For vector results,
|
||||
/// use the following built-in functions.
|
||||
///
|
||||
/// In all cases, the sizes of all the input and return vectors for any particular
|
||||
/// call must match.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "qualifier.hpp"
|
||||
#include "setup.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_vector_relational
|
||||
/// @{
|
||||
|
||||
/// Returns the component-wise comparison result of x < y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T A floating-point or integer scalar type.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> lessThan(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x <= y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T A floating-point or integer scalar type.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> lessThanEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x > y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T A floating-point or integer scalar type.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> greaterThan(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x >= y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T A floating-point or integer scalar type.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> greaterThanEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x == y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T A floating-point, integer or bool scalar type.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x != y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T A floating-point, integer or bool scalar type.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns true if any component of x is true.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/any.xml">GLSL any man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL bool any(vec<L, bool, Q> const& v);
|
||||
|
||||
/// Returns true if all components of x are true.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/all.xml">GLSL all man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL bool all(vec<L, bool, Q> const& v);
|
||||
|
||||
/// Returns the component-wise logical complement of x.
|
||||
/// /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/not.xml">GLSL not man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> not_(vec<L, bool, Q> const& v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_vector_relational.inl"
|
@ -1,7 +1,7 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/type_mat2x2.inl
|
||||
|
||||
#include "func_matrix.hpp"
|
||||
#include "../matrix.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/type_mat3x3.inl
|
||||
|
||||
#include "func_matrix.hpp"
|
||||
#include "../matrix.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
/// @ref core
|
||||
/// @file glm/detail/type_mat4x4.inl
|
||||
|
||||
#include "func_matrix.hpp"
|
||||
#include "../matrix.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
|
@ -1,8 +1,108 @@
|
||||
/// @ref core
|
||||
/// @file glm/exponential.hpp
|
||||
|
||||
#include "detail/setup.hpp"
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
///
|
||||
/// @defgroup core_func_exponential Exponential functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/exponential.hpp> to use these core features.
|
||||
///
|
||||
/// These all operate component-wise. The description is per component.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "detail/func_exponential.hpp"
|
||||
#include "detail/type_vec1.hpp"
|
||||
#include "detail/type_vec2.hpp"
|
||||
#include "detail/type_vec3.hpp"
|
||||
#include "detail/type_vec4.hpp"
|
||||
#include <cmath>
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_exponential
|
||||
/// @{
|
||||
|
||||
/// Returns 'base' raised to the power 'exponent'.
|
||||
///
|
||||
/// @param base Floating point value. pow function is defined for input values of 'base' defined in the range (inf-, inf+) in the limit of the type qualifier.
|
||||
/// @param exponent Floating point value representing the 'exponent'.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> pow(vec<L, T, Q> const& base, vec<L, T, Q> const& exponent);
|
||||
|
||||
/// Returns the natural exponentiation of x, i.e., e^x.
|
||||
///
|
||||
/// @param v exp function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type qualifier.
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> exp(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the natural logarithm of v, i.e.,
|
||||
/// returns the value y which satisfies the equation x = e^y.
|
||||
/// Results are undefined if v <= 0.
|
||||
///
|
||||
/// @param v log function is defined for input values of v defined in the range (0, inf+) in the limit of the type qualifier.
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log.xml">GLSL log man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> log(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns 2 raised to the v power.
|
||||
///
|
||||
/// @param v exp2 function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type qualifier.
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp2.xml">GLSL exp2 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> exp2(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the base 2 log of x, i.e., returns the value y,
|
||||
/// which satisfies the equation x = 2 ^ y.
|
||||
///
|
||||
/// @param v log2 function is defined for input values of v defined in the range (0, inf+) in the limit of the type qualifier.
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> log2(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the positive square root of v.
|
||||
///
|
||||
/// @param v sqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type qualifier.
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> sqrt(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the reciprocal of the positive square root of v.
|
||||
///
|
||||
/// @param v inversesqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type qualifier.
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inversesqrt.xml">GLSL inversesqrt man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> inversesqrt(vec<L, T, Q> const& v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "detail/func_exponential.inl"
|
||||
|
@ -2,19 +2,18 @@
|
||||
///
|
||||
/// @ref core (Dependence)
|
||||
///
|
||||
/// @defgroup gtc GTC Extensions (Stable)
|
||||
/// @defgroup gtc Stable extensions
|
||||
///
|
||||
/// @brief Functions and types that the GLSL specification doesn't define, but useful to have for a C++ program.
|
||||
/// @brief Additional features not specified by GLSL specification.
|
||||
///
|
||||
/// GTC extensions aim to be stable.
|
||||
///
|
||||
/// Even if it's highly unrecommended, it's possible to include all the extensions at once by
|
||||
/// including <glm/ext.hpp>. Otherwise, each extension needs to be included a specific file.
|
||||
///
|
||||
/// @defgroup gtx GTX Extensions (Experimental)
|
||||
/// @defgroup gtx Experimental extensions
|
||||
///
|
||||
/// @brief Functions and types that the GLSL specification doesn't define, but
|
||||
/// useful to have for a C++ program.
|
||||
/// @brief Experimental features not specified by GLSL specification.
|
||||
///
|
||||
/// Experimental extensions are useful functions and types, but the development of
|
||||
/// their API and functionality is not necessarily stable. They can change
|
||||
|
@ -1,8 +1,116 @@
|
||||
/// @ref core
|
||||
/// @file glm/geometric.hpp
|
||||
|
||||
#include "detail/setup.hpp"
|
||||
///
|
||||
/// @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>
|
||||
///
|
||||
/// @defgroup core_func_geometric Geometric functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/geometric.hpp> to use these core features.
|
||||
///
|
||||
/// These operate on vectors as vectors, not component-wise.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "detail/func_geometric.hpp"
|
||||
#include "detail/type_vec3.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_geometric
|
||||
/// @{
|
||||
|
||||
/// Returns the length of x, i.e., sqrt(x * x).
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/length.xml">GLSL length 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T length(vec<L, T, Q> const& x);
|
||||
|
||||
/// Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/distance.xml">GLSL distance 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T distance(vec<L, T, Q> const& p0, vec<L, T, Q> const& p1);
|
||||
|
||||
/// Returns the dot product of x and y, i.e., result = x * y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/dot.xml">GLSL dot 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T dot(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the cross product of x and y.
|
||||
///
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @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>
|
||||
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);
|
||||
|
||||
/// 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.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/normalize.xml">GLSL normalize 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> normalize(vec<L, T, Q> const& x);
|
||||
|
||||
/// If dot(Nref, I) < 0.0, return N, otherwise, return -N.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/faceforward.xml">GLSL faceforward 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> faceforward(
|
||||
vec<L, T, Q> const& N,
|
||||
vec<L, T, Q> const& I,
|
||||
vec<L, T, Q> const& Nref);
|
||||
|
||||
/// For the incident vector I and surface orientation N,
|
||||
/// returns the reflection direction : result = I - 2.0 * dot(N, I) * N.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/reflect.xml">GLSL reflect 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> reflect(
|
||||
vec<L, T, Q> const& I,
|
||||
vec<L, T, Q> const& N);
|
||||
|
||||
/// For the incident vector I and surface normal N,
|
||||
/// and the ratio of indices of refraction eta,
|
||||
/// return the refraction vector.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Floating-point scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/refract.xml">GLSL refract 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>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> refract(
|
||||
vec<L, T, Q> const& I,
|
||||
vec<L, T, Q> const& N,
|
||||
T eta);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "detail/func_geometric.inl"
|
||||
|
@ -1,9 +1,9 @@
|
||||
/// @ref core
|
||||
/// @file glm/glm.hpp
|
||||
///
|
||||
/// @defgroup core GLM Core
|
||||
/// @defgroup core Core features
|
||||
///
|
||||
/// @brief The core of GLM, which implements exactly and only the GLSL specification to the degree possible.
|
||||
/// @brief Features that implement in C++ the GLSL specification as closely as possible.
|
||||
///
|
||||
/// The GLM core consists of @ref core_types "C++ types that mirror GLSL types" and
|
||||
/// C++ functions that mirror the GLSL functions. It also includes
|
||||
|
@ -16,9 +16,9 @@
|
||||
// Dependencies
|
||||
#include "../detail/setup.hpp"
|
||||
#include "../detail/qualifier.hpp"
|
||||
#include "../detail/func_common.hpp"
|
||||
#include "../detail/func_integer.hpp"
|
||||
#include "../detail/func_exponential.hpp"
|
||||
#include "../common.hpp"
|
||||
#include "../integer.hpp"
|
||||
#include "../exponential.hpp"
|
||||
#include <limits>
|
||||
|
||||
#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/// @ref gtc_round
|
||||
/// @file glm/gtc/round.inl
|
||||
|
||||
#include "../detail/func_integer.hpp"
|
||||
#include "../integer.hpp"
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
|
@ -3,7 +3,7 @@
|
||||
///
|
||||
/// @see core (dependence)
|
||||
///
|
||||
/// @defgroup gtx_extented_min_max GLM_GTX_extented_min_max
|
||||
/// @defgroup gtx_extended_min_max GLM_GTX_extented_min_max
|
||||
/// @ingroup gtx
|
||||
///
|
||||
/// Include <glm/gtx/extented_min_max.hpp> to use the features of this extension.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/// @ref gtx_functions
|
||||
/// @file glm/gtx/functions.inl
|
||||
|
||||
#include "../detail/func_exponential.hpp"
|
||||
#include "../exponential.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
|
@ -14,7 +14,7 @@
|
||||
#pragma once
|
||||
|
||||
// Dependency:
|
||||
#include "../detail/func_geometric.hpp"
|
||||
#include "../geometric.hpp"
|
||||
#include "../gtx/quaternion.hpp"
|
||||
|
||||
#ifndef GLM_ENABLE_EXPERIMENTAL
|
||||
|
209
glm/integer.hpp
209
glm/integer.hpp
@ -1,8 +1,211 @@
|
||||
/// @ref core
|
||||
/// @file glm/integer.hpp
|
||||
|
||||
#include "detail/setup.hpp"
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
///
|
||||
/// @defgroup core_func_integer Integer functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/integer.hpp> to use these core features.
|
||||
///
|
||||
/// These all operate component-wise. The description is per component.
|
||||
/// The notation [a, b] means the set of bits from bit-number a through bit-number
|
||||
/// b, inclusive. The lowest-order bit is bit 0.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "detail/func_integer.hpp"
|
||||
#include "detail/setup.hpp"
|
||||
#include "detail/qualifier.hpp"
|
||||
#include "common.hpp"
|
||||
#include "vector_relational.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_integer
|
||||
/// @{
|
||||
|
||||
/// Adds 32-bit unsigned integer x and y, returning the sum
|
||||
/// modulo pow(2, 32). The value carry is set to 0 if the sum was
|
||||
/// less than pow(2, 32), or to 1 otherwise.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uaddCarry.xml">GLSL uaddCarry man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, uint, Q> uaddCarry(
|
||||
vec<L, uint, Q> const& x,
|
||||
vec<L, uint, Q> const& y,
|
||||
vec<L, uint, Q> & carry);
|
||||
|
||||
/// Subtracts the 32-bit unsigned integer y from x, returning
|
||||
/// the difference if non-negative, or pow(2, 32) plus the difference
|
||||
/// otherwise. The value borrow is set to 0 if x >= y, or to 1 otherwise.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/usubBorrow.xml">GLSL usubBorrow man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, uint, Q> usubBorrow(
|
||||
vec<L, uint, Q> const& x,
|
||||
vec<L, uint, Q> const& y,
|
||||
vec<L, uint, Q> & borrow);
|
||||
|
||||
/// Multiplies 32-bit integers x and y, producing a 64-bit
|
||||
/// result. The 32 least-significant bits are returned in lsb.
|
||||
/// The 32 most-significant bits are returned in msb.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/umulExtended.xml">GLSL umulExtended man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL void umulExtended(
|
||||
vec<L, uint, Q> const& x,
|
||||
vec<L, uint, Q> const& y,
|
||||
vec<L, uint, Q> & msb,
|
||||
vec<L, uint, Q> & lsb);
|
||||
|
||||
/// Multiplies 32-bit integers x and y, producing a 64-bit
|
||||
/// result. The 32 least-significant bits are returned in lsb.
|
||||
/// The 32 most-significant bits are returned in msb.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/imulExtended.xml">GLSL imulExtended man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL void imulExtended(
|
||||
vec<L, int, Q> const& x,
|
||||
vec<L, int, Q> const& y,
|
||||
vec<L, int, Q> & msb,
|
||||
vec<L, int, Q> & lsb);
|
||||
|
||||
/// Extracts bits [offset, offset + bits - 1] from value,
|
||||
/// returning them in the least significant bits of the result.
|
||||
/// For unsigned data types, the most significant bits of the
|
||||
/// result will be set to zero. For signed data types, the
|
||||
/// most significant bits will be set to the value of bit offset + base - 1.
|
||||
///
|
||||
/// If bits is zero, the result will be zero. The result will be
|
||||
/// undefined if offset or bits is negative, or if the sum of
|
||||
/// offset and bits is greater than the number of bits used
|
||||
/// to store the operand.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldExtract.xml">GLSL bitfieldExtract man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> bitfieldExtract(
|
||||
vec<L, T, Q> const& Value,
|
||||
int Offset,
|
||||
int Bits);
|
||||
|
||||
/// Returns the insertion the bits least-significant bits of insert into base.
|
||||
///
|
||||
/// The result will have bits [offset, offset + bits - 1] taken
|
||||
/// from bits [0, bits - 1] of insert, and all other bits taken
|
||||
/// directly from the corresponding bits of base. If bits is
|
||||
/// zero, the result will simply be base. The result will be
|
||||
/// undefined if offset or bits is negative, or if the sum of
|
||||
/// offset and bits is greater than the number of bits used to
|
||||
/// store the operand.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldInsert.xml">GLSL bitfieldInsert man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> bitfieldInsert(
|
||||
vec<L, T, Q> const& Base,
|
||||
vec<L, T, Q> const& Insert,
|
||||
int Offset,
|
||||
int Bits);
|
||||
|
||||
/// Returns the reversal of the bits of value.
|
||||
/// The bit numbered n of the result will be taken from bit (bits - 1) - n of value,
|
||||
/// where bits is the total number of bits used to represent value.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldReverse.xml">GLSL bitfieldReverse man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> bitfieldReverse(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the number of bits set to 1 in the binary representation of value.
|
||||
///
|
||||
/// @tparam genType Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitCount.xml">GLSL bitCount man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<typename genType>
|
||||
GLM_FUNC_DECL int bitCount(genType v);
|
||||
|
||||
/// Returns the number of bits set to 1 in the binary representation of value.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitCount.xml">GLSL bitCount man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, int, Q> bitCount(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the bit number of the least significant bit set to
|
||||
/// 1 in the binary representation of value.
|
||||
/// If value is zero, -1 will be returned.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findLSB.xml">GLSL findLSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_DECL int findLSB(genIUType x);
|
||||
|
||||
/// Returns the bit number of the least significant bit set to
|
||||
/// 1 in the binary representation of value.
|
||||
/// If value is zero, -1 will be returned.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findLSB.xml">GLSL findLSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, int, Q> findLSB(vec<L, T, Q> const& v);
|
||||
|
||||
/// Returns the bit number of the most significant bit in the binary representation of value.
|
||||
/// For positive integers, the result will be the bit number of the most significant bit set to 1.
|
||||
/// For negative integers, the result will be the bit number of the most significant
|
||||
/// bit set to 0. For a value of zero or negative one, -1 will be returned.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findMSB.xml">GLSL findMSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<typename genIUType>
|
||||
GLM_FUNC_DECL int findMSB(genIUType x);
|
||||
|
||||
/// Returns the bit number of the most significant bit in the binary representation of value.
|
||||
/// For positive integers, the result will be the bit number of the most significant bit set to 1.
|
||||
/// For negative integers, the result will be the bit number of the most significant
|
||||
/// bit set to 0. For a value of zero or negative one, -1 will be returned.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findMSB.xml">GLSL findMSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, int, Q> findMSB(vec<L, T, Q> const& v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "detail/func_integer.inl"
|
||||
|
162
glm/matrix.hpp
162
glm/matrix.hpp
@ -1,8 +1,164 @@
|
||||
/// @ref core
|
||||
/// @file glm/matrix.hpp
|
||||
|
||||
#include "detail/setup.hpp"
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
///
|
||||
/// @defgroup core_func_matrix Matrix functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/matrix.hpp> to use these core features.
|
||||
///
|
||||
/// For each of the following built-in matrix functions, there is both a
|
||||
/// single-qualifier floating point version, where all arguments and return values
|
||||
/// are single qualifier, and a double-qualifier floating version, where all
|
||||
/// arguments and return values are double qualifier. Only the single-qualifier
|
||||
/// floating point version is shown.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "detail/func_matrix.hpp"
|
||||
// Dependencies
|
||||
#include "detail/qualifier.hpp"
|
||||
#include "detail/setup.hpp"
|
||||
#include "detail/type_mat.hpp"
|
||||
#include "vec2.hpp"
|
||||
#include "vec3.hpp"
|
||||
#include "vec4.hpp"
|
||||
#include "mat2x2.hpp"
|
||||
#include "mat2x3.hpp"
|
||||
#include "mat2x4.hpp"
|
||||
#include "mat3x2.hpp"
|
||||
#include "mat3x3.hpp"
|
||||
#include "mat3x4.hpp"
|
||||
#include "mat4x2.hpp"
|
||||
#include "mat4x3.hpp"
|
||||
#include "mat4x4.hpp"
|
||||
|
||||
namespace glm {
|
||||
namespace detail
|
||||
{
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<2, 2, T, Q>
|
||||
{
|
||||
typedef mat<2, 2, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<2, 3, T, Q>
|
||||
{
|
||||
typedef mat<3, 2, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<2, 4, T, Q>
|
||||
{
|
||||
typedef mat<4, 2, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<3, 2, T, Q>
|
||||
{
|
||||
typedef mat<2, 3, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<3, 3, T, Q>
|
||||
{
|
||||
typedef mat<3, 3, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<3, 4, T, Q>
|
||||
{
|
||||
typedef mat<4, 3, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<4, 2, T, Q>
|
||||
{
|
||||
typedef mat<2, 4, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<4, 3, T, Q>
|
||||
{
|
||||
typedef mat<3, 4, T, Q> type;
|
||||
};
|
||||
|
||||
template<typename T, qualifier Q>
|
||||
struct outerProduct_trait<4, 4, T, Q>
|
||||
{
|
||||
typedef mat<4, 4, T, Q> type;
|
||||
};
|
||||
|
||||
}//namespace detail
|
||||
|
||||
/// @addtogroup core_func_matrix
|
||||
/// @{
|
||||
|
||||
/// Multiply matrix x by matrix y component-wise, i.e.,
|
||||
/// result[i][j] is the scalar product of x[i][j] and y[i][j].
|
||||
///
|
||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||
/// @tparam T Floating-point or signed integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL mat<C, R, T, Q> matrixCompMult(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y);
|
||||
|
||||
/// Treats the first parameter c as a column vector
|
||||
/// and the second parameter r as a row vector
|
||||
/// and does a linear algebraic matrix multiply c * r.
|
||||
///
|
||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||
/// @tparam T Floating-point or signed integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL typename detail::outerProduct_trait<C, R, T, Q>::type outerProduct(vec<C, T, Q> const& c, vec<R, T, Q> const& r);
|
||||
|
||||
/// Returns the transposed matrix of x
|
||||
///
|
||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||
/// @tparam T Floating-point or signed integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL typename mat<C, R, T, Q>::transpose_type transpose(mat<C, R, T, Q> const& x);
|
||||
|
||||
/// Return the determinant of a squared matrix.
|
||||
///
|
||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||
/// @tparam T Floating-point or signed integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL T determinant(mat<C, R, T, Q> const& m);
|
||||
|
||||
/// Return the inverse of a squared matrix.
|
||||
///
|
||||
/// @tparam C Integer between 1 and 4 included that qualify the number a column
|
||||
/// @tparam R Integer between 1 and 4 included that qualify the number a row
|
||||
/// @tparam T Floating-point or signed integer scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
template<length_t C, length_t R, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL mat<C, R, T, Q> inverse(mat<C, R, T, Q> const& m);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "detail/func_matrix.inl"
|
||||
|
168
glm/packing.hpp
168
glm/packing.hpp
@ -1,8 +1,170 @@
|
||||
/// @ref core
|
||||
/// @file glm/packing.hpp
|
||||
|
||||
#include "detail/setup.hpp"
|
||||
///
|
||||
/// @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>
|
||||
/// @see gtc_packing
|
||||
///
|
||||
/// @defgroup core_func_packing Floating-Point Pack and Unpack Functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/packing.hpp> to use these core features.
|
||||
///
|
||||
/// These functions do not operate component-wise, rather as described in each case.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "detail/func_packing.hpp"
|
||||
#include "detail/type_vec2.hpp"
|
||||
#include "detail/type_vec4.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_packing
|
||||
/// @{
|
||||
|
||||
/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
|
||||
/// Then, the results are packed into the returned 32-bit unsigned integer.
|
||||
///
|
||||
/// The conversion for component c of v to fixed point is done as follows:
|
||||
/// packUnorm2x16: round(clamp(c, 0, +1) * 65535.0)
|
||||
///
|
||||
/// The first component of the vector will be written to the least significant bits of the output;
|
||||
/// the last component will be written to the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm2x16.xml">GLSL packUnorm2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL uint packUnorm2x16(vec2 const& v);
|
||||
|
||||
/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
|
||||
/// Then, the results are packed into the returned 32-bit unsigned integer.
|
||||
///
|
||||
/// The conversion for component c of v to fixed point is done as follows:
|
||||
/// packSnorm2x16: round(clamp(v, -1, +1) * 32767.0)
|
||||
///
|
||||
/// The first component of the vector will be written to the least significant bits of the output;
|
||||
/// the last component will be written to the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm2x16.xml">GLSL packSnorm2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL uint packSnorm2x16(vec2 const& v);
|
||||
|
||||
/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
|
||||
/// Then, the results are packed into the returned 32-bit unsigned integer.
|
||||
///
|
||||
/// The conversion for component c of v to fixed point is done as follows:
|
||||
/// packUnorm4x8: round(clamp(c, 0, +1) * 255.0)
|
||||
///
|
||||
/// The first component of the vector will be written to the least significant bits of the output;
|
||||
/// the last component will be written to the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packUnorm4x8.xml">GLSL packUnorm4x8 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL uint packUnorm4x8(vec4 const& v);
|
||||
|
||||
/// First, converts each component of the normalized floating-point value v into 8- or 16-bit integer values.
|
||||
/// Then, the results are packed into the returned 32-bit unsigned integer.
|
||||
///
|
||||
/// The conversion for component c of v to fixed point is done as follows:
|
||||
/// packSnorm4x8: round(clamp(c, -1, +1) * 127.0)
|
||||
///
|
||||
/// The first component of the vector will be written to the least significant bits of the output;
|
||||
/// the last component will be written to the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packSnorm4x8.xml">GLSL packSnorm4x8 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL uint packSnorm4x8(vec4 const& v);
|
||||
|
||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||
///
|
||||
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
|
||||
/// unpackUnorm2x16: f / 65535.0
|
||||
///
|
||||
/// The first component of the returned vector will be extracted from the least significant bits of the input;
|
||||
/// the last component will be extracted from the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm2x16.xml">GLSL unpackUnorm2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec2 unpackUnorm2x16(uint p);
|
||||
|
||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||
///
|
||||
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
|
||||
/// unpackSnorm2x16: clamp(f / 32767.0, -1, +1)
|
||||
///
|
||||
/// The first component of the returned vector will be extracted from the least significant bits of the input;
|
||||
/// the last component will be extracted from the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm2x16.xml">GLSL unpackSnorm2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec2 unpackSnorm2x16(uint p);
|
||||
|
||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||
///
|
||||
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
|
||||
/// unpackUnorm4x8: f / 255.0
|
||||
///
|
||||
/// The first component of the returned vector will be extracted from the least significant bits of the input;
|
||||
/// the last component will be extracted from the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackUnorm4x8.xml">GLSL unpackUnorm4x8 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec4 unpackUnorm4x8(uint p);
|
||||
|
||||
/// First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers, four 8-bit unsigned integers, or four 8-bit signed integers.
|
||||
/// Then, each component is converted to a normalized floating-point value to generate the returned two- or four-component vector.
|
||||
///
|
||||
/// The conversion for unpacked fixed-point value f to floating point is done as follows:
|
||||
/// unpackSnorm4x8: clamp(f / 127.0, -1, +1)
|
||||
///
|
||||
/// The first component of the returned vector will be extracted from the least significant bits of the input;
|
||||
/// the last component will be extracted from the most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackSnorm4x8.xml">GLSL unpackSnorm4x8 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec4 unpackSnorm4x8(uint p);
|
||||
|
||||
/// Returns a double-qualifier value obtained by packing the components of v into a 64-bit value.
|
||||
/// If an IEEE 754 Inf or NaN is created, it will not signal, and the resulting floating point value is unspecified.
|
||||
/// Otherwise, the bit- level representation of v is preserved.
|
||||
/// The first vector component specifies the 32 least significant bits;
|
||||
/// the second component specifies the 32 most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packDouble2x32.xml">GLSL packDouble2x32 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL double packDouble2x32(uvec2 const& v);
|
||||
|
||||
/// Returns a two-component unsigned integer vector representation of v.
|
||||
/// The bit-level representation of v is preserved.
|
||||
/// The first component of the vector contains the 32 least significant bits of the double;
|
||||
/// the second component consists the 32 most significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackDouble2x32.xml">GLSL unpackDouble2x32 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL uvec2 unpackDouble2x32(double v);
|
||||
|
||||
/// Returns an unsigned integer obtained by converting the components of a two-component floating-point vector
|
||||
/// to the 16-bit floating-point representation found in the OpenGL Specification,
|
||||
/// and then packing these two 16- bit integers into a 32-bit unsigned integer.
|
||||
/// The first vector component specifies the 16 least-significant bits of the result;
|
||||
/// the second component specifies the 16 most-significant bits.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/packHalf2x16.xml">GLSL packHalf2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL uint packHalf2x16(vec2 const& v);
|
||||
|
||||
/// Returns a two-component floating-point vector with components obtained by unpacking a 32-bit unsigned integer into a pair of 16-bit values,
|
||||
/// interpreting those values as 16-bit floating-point numbers according to the OpenGL Specification,
|
||||
/// and converting them to 32-bit floating-point values.
|
||||
/// The first component of the vector is obtained from the 16 least-significant bits of v;
|
||||
/// the second component is obtained from the 16 most-significant bits of v.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/unpackHalf2x16.xml">GLSL unpackHalf2x16 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
GLM_FUNC_DECL vec2 unpackHalf2x16(uint v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "detail/func_packing.inl"
|
||||
|
@ -1,8 +1,208 @@
|
||||
/// @ref core
|
||||
/// @file glm/trigonometric.hpp
|
||||
|
||||
#include "detail/setup.hpp"
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
///
|
||||
/// @defgroup core_func_trigonometric Angle and Trigonometry Functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/trigonometric.hpp> to use these core features.
|
||||
///
|
||||
/// Function parameters specified as angle are assumed to be in units of radians.
|
||||
/// In no case will any of these functions result in a divide by zero error. If
|
||||
/// the divisor of a ratio is 0, then results will be undefined.
|
||||
///
|
||||
/// These all operate component-wise. The description is per component.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "detail/func_trigonometric.hpp"
|
||||
#include "detail/setup.hpp"
|
||||
#include "detail/qualifier.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_trigonometric
|
||||
/// @{
|
||||
|
||||
/// Converts degrees to radians and returns the result.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> radians(vec<L, T, Q> const& degrees);
|
||||
|
||||
/// Converts radians to degrees and returns the result.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL GLM_CONSTEXPR vec<L, T, Q> degrees(vec<L, T, Q> const& radians);
|
||||
|
||||
/// The standard trigonometric sine function.
|
||||
/// The values returned by this function will range from [-1, 1].
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> sin(vec<L, T, Q> const& angle);
|
||||
|
||||
/// The standard trigonometric cosine function.
|
||||
/// The values returned by this function will range from [-1, 1].
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> cos(vec<L, T, Q> const& angle);
|
||||
|
||||
/// The standard trigonometric tangent function.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> tan(vec<L, T, Q> const& angle);
|
||||
|
||||
/// Arc sine. Returns an angle whose sine is x.
|
||||
/// The range of values returned by this function is [-PI/2, PI/2].
|
||||
/// Results are undefined if |x| > 1.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> asin(vec<L, T, Q> const& x);
|
||||
|
||||
/// Arc cosine. Returns an angle whose sine is x.
|
||||
/// The range of values returned by this function is [0, PI].
|
||||
/// Results are undefined if |x| > 1.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> acos(vec<L, T, Q> const& x);
|
||||
|
||||
/// Arc tangent. Returns an angle whose tangent is y/x.
|
||||
/// The signs of x and y are used to determine what
|
||||
/// quadrant the angle is in. The range of values returned
|
||||
/// by this function is [-PI, PI]. Results are undefined
|
||||
/// if x and y are both 0.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> atan(vec<L, T, Q> const& y, vec<L, T, Q> const& x);
|
||||
|
||||
/// Arc tangent. Returns an angle whose tangent is y_over_x.
|
||||
/// The range of values returned by this function is [-PI/2, PI/2].
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> atan(vec<L, T, Q> const& y_over_x);
|
||||
|
||||
/// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> sinh(vec<L, T, Q> const& angle);
|
||||
|
||||
/// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> cosh(vec<L, T, Q> const& angle);
|
||||
|
||||
/// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> tanh(vec<L, T, Q> const& angle);
|
||||
|
||||
/// Arc hyperbolic sine; returns the inverse of sinh.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> asinh(vec<L, T, Q> const& x);
|
||||
|
||||
/// Arc hyperbolic cosine; returns the non-negative inverse
|
||||
/// of cosh. Results are undefined if x < 1.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> acosh(vec<L, T, Q> const& x);
|
||||
|
||||
/// Arc hyperbolic tangent; returns the inverse of tanh.
|
||||
/// Results are undefined if abs(x) >= 1.
|
||||
///
|
||||
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
|
||||
/// @tparam T Floating-point scalar types
|
||||
/// @tparam Q Value from qualifier enum
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, T, Q> atanh(vec<L, T, Q> const& x);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "detail/func_trigonometric.inl"
|
||||
|
@ -1,8 +1,119 @@
|
||||
/// @ref core
|
||||
/// @file glm/vector_relational.hpp
|
||||
|
||||
#include "detail/setup.hpp"
|
||||
/// @file glm/detail/func_vector_relational.hpp
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
///
|
||||
/// @defgroup core_func_vector_relational Vector Relational Functions
|
||||
/// @ingroup core
|
||||
///
|
||||
/// Include <glm/vector_relational.hpp> to use these core features.
|
||||
///
|
||||
/// Relational and equality operators (<, <=, >, >=, ==, !=) are defined to
|
||||
/// operate on scalars and produce scalar Boolean results. For vector results,
|
||||
/// use the following built-in functions.
|
||||
///
|
||||
/// In all cases, the sizes of all the input and return vectors for any particular
|
||||
/// call must match.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "detail/func_vector_relational.hpp"
|
||||
#include "detail/qualifier.hpp"
|
||||
#include "detail/setup.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_vector_relational
|
||||
/// @{
|
||||
|
||||
/// Returns the component-wise comparison result of x < y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T A floating-point or integer scalar type.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> lessThan(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x <= y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T A floating-point or integer scalar type.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> lessThanEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x > y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T A floating-point or integer scalar type.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> greaterThan(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x >= y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T A floating-point or integer scalar type.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> greaterThanEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x == y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T A floating-point, integer or bool scalar type.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns the component-wise comparison of result x != y.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
/// @tparam T A floating-point, integer or bool scalar type.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, typename T, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
|
||||
|
||||
/// Returns true if any component of x is true.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/any.xml">GLSL any man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL bool any(vec<L, bool, Q> const& v);
|
||||
|
||||
/// Returns true if all components of x are true.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/all.xml">GLSL all man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL bool all(vec<L, bool, Q> const& v);
|
||||
|
||||
/// Returns the component-wise logical complement of x.
|
||||
/// /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
|
||||
///
|
||||
/// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/not.xml">GLSL not man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template<length_t L, qualifier Q>
|
||||
GLM_FUNC_DECL vec<L, bool, Q> not_(vec<L, bool, Q> const& v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "detail/func_vector_relational.inl"
|
||||
|
@ -11,6 +11,7 @@ endfunction()
|
||||
|
||||
add_subdirectory(bug)
|
||||
add_subdirectory(core)
|
||||
add_subdirectory(ext)
|
||||
add_subdirectory(gtc)
|
||||
add_subdirectory(gtx)
|
||||
|
||||
|
1
test/ext/CMakeLists.txt
Normal file
1
test/ext/CMakeLists.txt
Normal file
@ -0,0 +1 @@
|
||||
glmCreateTestGTC(ext_vec1)
|
8
test/ext/ext_vec1.cpp
Normal file
8
test/ext/ext_vec1.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
#include <glm/gtc/vec1.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
return Error;
|
||||
}
|
Loading…
Reference in New Issue
Block a user