Functions
Functions
GLM Core

The functions defined by the specification. More...

Functions

template<typename genFIType >
genFIType abs (genFIType const &x)
template<typename genType >
genType acos (genType const &x)
template<typename genType >
genType acosh (genType const &x)
template<template< typename > class vecType>
GLM_FUNC_QUALIFIER bool all (vecType< bool > const &v)
template<template< typename > class vecType>
GLM_FUNC_QUALIFIER bool any (vecType< bool > const &v)
template<typename genType >
genType asin (genType const &x)
template<typename genType >
genType asinh (genType const &x)
template<typename genType >
genType atan (genType const &y, genType const &x)
template<typename genType >
genType atan (genType const &y_over_x)
template<typename genType >
genType atanh (genType const &x)
template<typename T , template< typename > class C>
C< T >::signed_type bitCount (C< T > const &Value)
template<typename genIUType >
genIUType bitfieldExtract (genIUType const &Value, int const &Offset, int const &Bits)
template<typename genIUType >
genIUType bitfieldInsert (genIUType const &Base, genIUType const &Insert, int const &Offset, int const &Bits)
template<typename genIUType >
genIUType bitfieldReverse (genIUType const &value)
template<typename genType >
genType ceil (genType const &x)
template<typename genType >
genType clamp (genType const &x, genType const &minVal, genType const &maxVal)
template<typename genType >
genType cos (genType const &angle)
template<typename genType >
genType cosh (genType const &angle)
template<typename T >
detail::tvec3< T > cross (detail::tvec3< T > const &x, detail::tvec3< T > const &y)
template<typename genType >
genType degrees (genType const &radians)
template<typename T >
detail::tmat2x2< T >::value_type determinant (detail::tmat2x2< T > const &m)
template<typename T >
detail::tmat3x3< T >::value_type determinant (detail::tmat3x3< T > const &m)
template<typename T >
detail::tmat4x4< T >::value_type determinant (detail::tmat4x4< T > const &m)
template<typename genType >
genType::value_type distance (genType const &p0, genType const &p1)
template<typename genType >
genType::value_type dot (genType const &x, genType const &y)
template<typename T , template< typename > class vecType>
GLM_FUNC_QUALIFIER vecType< T >
::bool_type 
equal (vecType< T > const &x, vecType< T > const &y)
template<typename genType >
genType exp (genType const &x)
template<typename genType >
genType exp2 (genType const &x)
template<typename genType >
genType faceforward (genType const &N, genType const &I, genType const &Nref)
template<typename T , template< typename > class C>
C< T >::signed_type findLSB (C< T > const &Value)
template<typename T , template< typename > class C>
C< T >::signed_type findMSB (C< T > const &Value)
template<typename genType , typename genIType >
genIType floatBitsToInt (genType const &value)
template<typename genType , typename genUType >
genUType floatBitsToUint (genType const &value)
template<typename genType >
genType floor (genType const &x)
template<typename genType >
genType fma (genType const &a, genType const &b, genType const &c)
template<typename genType >
genType fract (genType const &x)
template<typename genType , typename genIType >
genType frexp (genType const &x, genIType &exp)
template<typename T , template< typename > class vecType>
GLM_FUNC_QUALIFIER vecType< T >
::bool_type 
greaterThan (vecType< T > const &x, vecType< T > const &y)
template<typename T , template< typename > class vecType>
GLM_FUNC_QUALIFIER vecType< T >
::bool_type 
greaterThanEqual (vecType< T > const &x, vecType< T > const &y)
template<typename genIType >
void imulExtended (genIType const &x, genIType const &y, genIType &msb, genIType &lsb)
template<typename genType , typename genIType >
genType intBitsToFloat (genIType const &value)
template<typename T >
detail::tmat3x3< T > inverse (detail::tmat3x3< T > const &m)
template<typename T >
detail::tmat4x4< T > inverse (detail::tmat4x4< T > const &m)
template<typename T >
detail::tmat2x2< T > inverse (detail::tmat2x2< T > const &m)
template<typename genType >
genType inversesqrt (genType const &x)
template<typename genType >
genType::bool_type isinf (genType const &x)
template<typename genType >
genType::bool_type isnan (genType const &x)
template<typename genType , typename genIType >
genType ldexp (genType const &x, genIType const &exp)
template<typename genType >
genType::value_type length (genType const &x)
template<typename T , template< typename > class vecType>
GLM_FUNC_QUALIFIER vecType< T >
::bool_type 
lessThan (vecType< T > const &x, vecType< T > const &y)
template<typename T , template< typename > class vecType>
GLM_FUNC_QUALIFIER vecType< T >
::bool_type 
lessThanEqual (vecType< T > const &x, vecType< T > const &y)
template<typename genType >
genType log (genType const &x)
template<typename genType >
genType log2 (genType const &x)
template<typename matType >
matType matrixCompMult (matType const &x, matType const &y)
template<typename genType >
genType max (genType const &x, genType const &y)
template<typename genType >
genType min (genType const &x, genType const &y)
template<typename genTypeT , typename genTypeU >
genTypeT mix (genTypeT const &x, genTypeT const &y, genTypeU const &a)
template<typename genType >
genType mod (genType const &x, genType const &y)
template<typename genType >
genType mod (genType const &x, typename genType::value_type const &y)
template<typename genType >
genType modf (genType const &x, genType &i)
template<typename genType >
genType::value_type noise1 (genType const &x)
template<typename genType >
detail::tvec2< typename
genType::value_type > 
noise2 (genType const &x)
template<typename genType >
detail::tvec3< typename
genType::value_type > 
noise3 (genType const &x)
template<typename genType >
detail::tvec4< typename
genType::value_type > 
noise4 (genType const &x)
template<typename genType >
genType normalize (genType const &x)
template<template< typename > class vecType>
GLM_FUNC_QUALIFIER vecType< bool > not_ (vecType< bool > const &v)
template<typename T , template< typename > class vecType>
GLM_FUNC_QUALIFIER vecType< T >
::bool_type 
notEqual (vecType< T > const &x, vecType< T > const &y)
template<typename vecType , typename matType >
matType outerProduct (vecType const &c, vecType const &r)
double packDouble2x32 (detail::tvec2< detail::uint32 > const &v)
detail::uint32 packSnorm4x8 (detail::tvec4< detail::float32 > const &v)
detail::uint32 packUnorm2x16 (detail::tvec2< detail::float32 > const &v)
detail::uint32 packUnorm4x8 (detail::tvec4< detail::float32 > const &v)
template<typename genType >
genType pow (genType const &x, genType const &y)
template<typename genType >
genType radians (genType const &degrees)
template<typename genType >
genType reflect (genType const &I, genType const &N)
template<typename genType >
genType refract (genType const &I, genType const &N, typename genType::value_type const &eta)
template<typename genType >
genType round (genType const &x)
template<typename genType >
genType roundEven (genType const &x)
template<typename genFIType >
genFIType sign (genFIType const &x)
template<typename genType >
genType sin (genType const &angle)
template<typename genType >
genType sinh (genType const &angle)
template<typename genType >
genType smoothstep (genType const &edge0, genType const &edge1, genType const &x)
template<typename genType >
genType sqrt (genType const &x)
template<typename genType >
genType step (genType const &edge, genType const &x)
template<typename genType >
genType tan (genType const &angle)
template<typename genType >
genType tanh (genType const &angle)
template<typename matType >
matType::transpose_type transpose (matType const &x)
template<typename genType >
genType trunc (genType const &x)
template<typename genUType >
genUType uaddCarry (genUType const &x, genUType const &y, genUType &carry)
template<typename genType , typename genUType >
genType uintBitsToFloat (genUType const &value)
template<typename genUType >
void umulExtended (genUType const &x, genUType const &y, genUType &msb, genUType &lsb)
detail::tvec2< detail::uint32 > unpackDouble2x32 (double const &v)
detail::tvec4< detail::float32 > unpackSnorm4x8 (detail::uint32 const &p)
detail::tvec2< detail::float32 > unpackUnorm2x16 (detail::uint32 const &p)
detail::tvec4< detail::float32 > unpackUnorm4x8 (detail::uint32 const &p)
template<typename genUType >
genUType usubBorrow (genUType const &x, genUType const &y, genUType &borrow)

Detailed Description

The functions defined by the specification.

< Define all geometric functions from Section 8.4 of GLSL 1.30.8 specification. Included in glm namespace.

< Define common functions from Section 8.3 of GLSL 1.30.8 specification. Included in glm namespace.


Function Documentation

genFIType glm::core::function::common::abs ( genFIType const &  x)

Returns x if x >= 0; otherwise, it returns -x.

genType glm::core::function::trigonometric::acos ( genType 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.

genType glm::core::function::trigonometric::acosh ( genType const &  x)

Arc hyperbolic cosine; returns the non-negative inverse of cosh.

Results are undefined if x < 1.

GLM_FUNC_QUALIFIER bool glm::core::function::vector_relational::all ( vecType< bool > const &  v)

Returns true if all components of x are true.

Definition at line 176 of file func_vector_relational.hpp.

GLM_FUNC_QUALIFIER bool glm::core::function::vector_relational::any ( vecType< bool > const &  v)

Returns true if any component of x is true.

Definition at line 160 of file func_vector_relational.hpp.

genType glm::core::function::trigonometric::asin ( genType const &  x)

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.

genType glm::core::function::trigonometric::asinh ( genType const &  x)

Arc hyperbolic sine; returns the inverse of sinh.

genType glm::core::function::trigonometric::atan ( genType const &  y,
genType 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.

Referenced by glm::gtx::compatibility::atan2().

genType glm::core::function::trigonometric::atan ( genType const &  y_over_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].

genType glm::core::function::trigonometric::atanh ( genType const &  x)

Arc hyperbolic tangent; returns the inverse of tanh.

Results are undefined if abs(x) >= 1.

C<T>::signed_type glm::core::function::integer::bitCount ( C< T > const &  Value)

Returns the number of bits set to 1 in the binary representation of value.

genIUType glm::core::function::integer::bitfieldExtract ( genIUType const &  Value,
int const &  Offset,
int const &  Bits 
)

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.

genIUType glm::core::function::integer::bitfieldInsert ( genIUType const &  Base,
genIUType const &  Insert,
int const &  Offset,
int const &  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.

genIUType glm::core::function::integer::bitfieldReverse ( genIUType const &  value)

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.

genType glm::core::function::common::ceil ( genType const &  x)

Returns a value equal to the nearest integer that is greater than or equal to x.

genType glm::core::function::common::clamp ( genType const &  x,
genType const &  minVal,
genType const &  maxVal 
)

Returns min(max(x, minVal), maxVal) for each component in x.

using the floating-point values minVal and maxVal.

Referenced by glm::gtx::compatibility::saturate().

genType glm::core::function::trigonometric::cos ( genType const &  angle)

The standard trigonometric cosine function.

The values returned by this function will range from [-1, 1].

genType glm::core::function::trigonometric::cosh ( genType const &  angle)

Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2.

detail::tvec3<T> glm::core::function::geometric::cross ( detail::tvec3< T > const &  x,
detail::tvec3< T > const &  y 
)

Returns the cross product of x and y.

genType glm::core::function::trigonometric::degrees ( genType const &  radians)

Converts radians to degrees and returns the result.

detail::tmat2x2<T>::value_type glm::core::function::matrix::determinant ( detail::tmat2x2< T > const &  m)

Return the determinant of a mat2 matrix.

detail::tmat3x3<T>::value_type glm::core::function::matrix::determinant ( detail::tmat3x3< T > const &  m)

Return the determinant of a mat3 matrix.

detail::tmat4x4<T>::value_type glm::core::function::matrix::determinant ( detail::tmat4x4< T > const &  m)

Return the determinant of a mat4 matrix.

genType::value_type glm::core::function::geometric::distance ( genType const &  p0,
genType const &  p1 
)

Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).

genType::value_type glm::core::function::geometric::dot ( genType const &  x,
genType const &  y 
)

Returns the dot product of x and y, i.e., result = x * y.

GLM_FUNC_QUALIFIER vecType<T>::bool_type glm::core::function::vector_relational::equal ( vecType< T > const &  x,
vecType< T > const &  y 
)

Returns the component-wise comparison of result x == y.

Definition at line 121 of file func_vector_relational.hpp.

genType glm::core::function::exponential::exp ( genType const &  x)

Returns the natural exponentiation of x, i.e., e^x.

genType glm::core::function::exponential::exp2 ( genType const &  x)

Returns 2 raised to the x power.

genType glm::core::function::geometric::faceforward ( genType const &  N,
genType const &  I,
genType const &  Nref 
)

If dot(Nref, I) < 0.0, return N, otherwise, return -N.

C<T>::signed_type glm::core::function::integer::findLSB ( C< T > const &  Value)

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.

C<T>::signed_type glm::core::function::integer::findMSB ( C< T > const &  Value)

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.

genIType glm::core::function::common::floatBitsToInt ( genType const &  value)

Returns a signed integer value representing the encoding of a floating-point value.

The floatingpoint value's bit-level representation is preserved.

genUType glm::core::function::common::floatBitsToUint ( genType const &  value)

Returns a unsigned integer value representing the encoding of a floating-point value.

The floatingpoint value's bit-level representation is preserved.

genType glm::core::function::common::floor ( genType const &  x)

Returns a value equal to the nearest integer that is less then or equal to x.

genType glm::core::function::common::fma ( genType const &  a,
genType const &  b,
genType const &  c 
)

Computes and returns a * b + c.

genType glm::core::function::common::fract ( genType const &  x)

Return x - floor(x).

genType glm::core::function::common::frexp ( genType const &  x,
genIType &  exp 
)

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.

GLM_FUNC_QUALIFIER vecType<T>::bool_type glm::core::function::vector_relational::greaterThan ( vecType< T > const &  x,
vecType< T > const &  y 
)

Returns the component-wise comparison of result x > y.

Definition at line 77 of file func_vector_relational.hpp.

GLM_FUNC_QUALIFIER vecType<T>::bool_type glm::core::function::vector_relational::greaterThanEqual ( vecType< T > const &  x,
vecType< T > const &  y 
)

Returns the component-wise comparison of result x >= y.

Definition at line 99 of file func_vector_relational.hpp.

void glm::core::function::integer::imulExtended ( genIType const &  x,
genIType const &  y,
genIType &  msb,
genIType &  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.

genType glm::core::function::common::intBitsToFloat ( genIType const &  value)

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.

detail::tmat3x3<T> glm::core::function::matrix::inverse ( detail::tmat3x3< T > const &  m)

Return the inverse of a mat3 matrix.

detail::tmat4x4<T> glm::core::function::matrix::inverse ( detail::tmat4x4< T > const &  m)

Return the inverse of a mat4 matrix.

detail::tmat2x2<T> glm::core::function::matrix::inverse ( detail::tmat2x2< T > const &  m)

Return the inverse of a mat2 matrix.

genType glm::core::function::exponential::inversesqrt ( genType const &  x)

Returns the reciprocal of the positive square root of x.

genType::bool_type glm::core::function::common::isinf ( genType 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.

genType::bool_type glm::core::function::common::isnan ( genType 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.

genType glm::core::function::common::ldexp ( genType const &  x,
genIType const &  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.

genType::value_type glm::core::function::geometric::length ( genType const &  x)

Returns the length of x, i.e., sqrt(x * x).

GLM_FUNC_QUALIFIER vecType<T>::bool_type glm::core::function::vector_relational::lessThan ( vecType< T > const &  x,
vecType< T > const &  y 
)

Returns the component-wise comparison result of x < y.

Definition at line 32 of file func_vector_relational.hpp.

GLM_FUNC_QUALIFIER vecType<T>::bool_type glm::core::function::vector_relational::lessThanEqual ( vecType< T > const &  x,
vecType< T > const &  y 
)

Returns the component-wise comparison of result x <= y.

Definition at line 55 of file func_vector_relational.hpp.

genType glm::core::function::exponential::log ( genType const &  x)

Returns the natural logarithm of x, i.e., returns the value y which satisfies the equation x = e^y.

Results are undefined if x <= 0.

genType glm::core::function::exponential::log2 ( genType const &  x)

Returns the base 2 log of x, i.e., returns the value y, which satisfies the equation x = 2 ^ y.

matType glm::core::function::matrix::matrixCompMult ( matType const &  x,
matType const &  y 
)

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].

genType glm::core::function::common::max ( genType const &  x,
genType const &  y 
)

Returns y if x < y; otherwise, it returns x.

genType glm::core::function::common::min ( genType const &  x,
genType const &  y 
)

Returns y if y < x; otherwise, it returns x.

genTypeT glm::core::function::common::mix ( genTypeT const &  x,
genTypeT const &  y,
genTypeU const &  a 
)
Returns:
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.
Parameters:
[in]xFloating point scalar or vector.
[in]yFloating point scalar or vector.
[in]aFloating point or boolean scalar or vector.

Referenced by glm::gtx::compatibility::lerp().

genType glm::core::function::common::mod ( genType const &  x,
genType const &  y 
)

Modulus.

Returns x - y * floor(x / y) for each component in x using the floating point value y.

genType glm::core::function::common::mod ( genType const &  x,
typename genType::value_type const &  y 
)

Modulus.

Returns x - y * floor(x / y) for each component in x using the floating point value y.

genType glm::core::function::common::modf ( genType const &  x,
genType &  i 
)

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.

genType::value_type glm::core::function::noise::noise1 ( genType const &  x)

Returns a 1D noise value based on the input value x.

detail::tvec2<typename genType::value_type> glm::core::function::noise::noise2 ( genType const &  x)

Returns a 2D noise value based on the input value x.

detail::tvec3<typename genType::value_type> glm::core::function::noise::noise3 ( genType const &  x)

Returns a 3D noise value based on the input value x.

detail::tvec4<typename genType::value_type> glm::core::function::noise::noise4 ( genType const &  x)

Returns a 4D noise value based on the input value x.

genType glm::core::function::geometric::normalize ( genType const &  x)

Returns a vector in the same direction as x but with length of 1.

GLM_FUNC_QUALIFIER vecType<bool> glm::core::function::vector_relational::not_ ( vecType< bool > 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.

Definition at line 193 of file func_vector_relational.hpp.

GLM_FUNC_QUALIFIER vecType<T>::bool_type glm::core::function::vector_relational::notEqual ( vecType< T > const &  x,
vecType< T > const &  y 
)

Returns the component-wise comparison of result x != y.

Definition at line 141 of file func_vector_relational.hpp.

matType glm::core::function::matrix::outerProduct ( vecType const &  c,
vecType const &  r 
)

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.

double glm::core::function::packing::packDouble2x32 ( detail::tvec2< detail::uint32 > const &  v)

Returns a double-precision 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.

detail::uint32 glm::core::function::packing::packSnorm4x8 ( detail::tvec4< detail::float32 > 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.

detail::uint32 glm::core::function::packing::packUnorm2x16 ( detail::tvec2< detail::float32 > 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: 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.

detail::uint32 glm::core::function::packing::packUnorm4x8 ( detail::tvec4< detail::float32 > 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.

genType glm::core::function::exponential::pow ( genType const &  x,
genType const &  y 
)

Returns x raised to the y power.

genType glm::core::function::trigonometric::radians ( genType const &  degrees)

Converts degrees to radians and returns the result.

genType glm::core::function::geometric::reflect ( genType const &  I,
genType const &  N 
)

For the incident vector I and surface orientation N, returns the reflection direction : result = I - 2.0 * dot(N, I) * N.

genType glm::core::function::geometric::refract ( genType const &  I,
genType const &  N,
typename genType::value_type const &  eta 
)

For the incident vector I and surface normal N, and the ratio of indices of refraction eta, return the refraction vector.

genType glm::core::function::common::round ( genType 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.

genType glm::core::function::common::roundEven ( genType 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.)

genFIType glm::core::function::common::sign ( genFIType const &  x)

Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.

genType glm::core::function::trigonometric::sin ( genType const &  angle)

The standard trigonometric sine function.

The values returned by this function will range from [-1, 1].

genType glm::core::function::trigonometric::sinh ( genType const &  angle)

Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2.

genType glm::core::function::common::smoothstep ( genType const &  edge0,
genType const &  edge1,
genType 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.

genType glm::core::function::exponential::sqrt ( genType const &  x)

Returns the positive square root of x.

genType glm::core::function::common::step ( genType const &  edge,
genType const &  x 
)

Returns 0.0 if x < edge, otherwise it returns 1.0.

genType glm::core::function::trigonometric::tan ( genType const &  angle)

The standard trigonometric tangent function.

genType glm::core::function::trigonometric::tanh ( genType const &  angle)

Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)

matType::transpose_type glm::core::function::matrix::transpose ( matType const &  x)

Returns the transposed matrix of x.

genType glm::core::function::common::trunc ( genType const &  x)

Returns a value equal to the nearest integer to x whose absolute value is not larger than the absolute value of x.

genUType glm::core::function::integer::uaddCarry ( genUType const &  x,
genUType const &  y,
genUType &  carry 
)

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.

genType glm::core::function::common::uintBitsToFloat ( genUType const &  value)

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.

void glm::core::function::integer::umulExtended ( genUType const &  x,
genUType const &  y,
genUType &  msb,
genUType &  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.

detail::tvec2<detail::uint32> glm::core::function::packing::unpackDouble2x32 ( double 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.

detail::tvec4<detail::float32> glm::core::function::packing::unpackSnorm4x8 ( detail::uint32 const &  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.

detail::tvec2<detail::float32> glm::core::function::packing::unpackUnorm2x16 ( detail::uint32 const &  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: 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.

detail::tvec4<detail::float32> glm::core::function::packing::unpackUnorm4x8 ( detail::uint32 const &  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.

genUType glm::core::function::integer::usubBorrow ( genUType const &  x,
genUType const &  y,
genUType &  borrow 
)

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.