global functions
- glm::abs()
- glm::ceil()
- glm::clamp()
- glm::floatBitsToInt()
- glm::floatBitsToUint()
- glm::floor()
- glm::fma()
- glm::fract()
- glm::frexp()
- glm::intBitsToFloat()
- glm::isinf()
- glm::isnan()
- glm::ldexp()
- glm::max()
- glm::min()
- glm::mix()
- glm::mod()
- glm::modf()
- glm::round()
- glm::roundEven()
- glm::sign()
- glm::smoothstep()
- glm::step()
- glm::trunc()
- glm::uintBitsToFloat()
glm::abs(...)
genType glm::abs(genType x)
Documentation from code comments
Returns x if x >= 0; otherwise, it returns -x.
Type parameters:
genType floating-point or signed integer; scalar or vector types.
See also: GLSL abs man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::ceil(...)
vecType< T, P > glm::ceil(const vecType< T, P > &x=P)
Documentation from code comments
Returns a value equal to the nearest integer that is greater than or equal to x.
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL ceil man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::clamp(...)
vecType< T, P > glm::clamp(const vecType< T, P > &x=P, const vecType< T, P > &minVal=P, const vecType< T, P > &maxVal=P)
glm::clamp(...)
genType glm::clamp(genType x, genType minVal, genType maxVal)
Documentation from code comments
Returns min(max(x, minVal), maxVal) for each component in x using the floating-point values minVal and maxVal.
Type parameters:
genType Floating-point or integer; scalar or vector types.
See also: GLSL clamp man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::floatBitsToInt(...)
int glm::floatBitsToInt(const float &v)
Documentation from code comments
Returns a signed integer value representing the encoding of a floating-point value. The floating-point value's bit-level representation is preserved.
See also: GLSL floatBitsToInt man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::floatBitsToInt(...)
vecType< int, P > glm::floatBitsToInt(const vecType< float, P > &v=P)
Documentation from code comments
Returns a signed integer value representing the encoding of a floating-point value. The floatingpoint value's bit-level representation is preserved.
See also: GLSL floatBitsToInt man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::floatBitsToUint(...)
glm::uint glm::floatBitsToUint(const float &v)
Documentation from code comments
Returns a unsigned integer value representing the encoding of a floating-point value. The floatingpoint value's bit-level representation is preserved.
See also: GLSL floatBitsToUint man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::floatBitsToUint(...)
vecType< glm::uint, P > glm::floatBitsToUint(const vecType< float, P > &v=P)
Documentation from code comments
Returns a unsigned integer value representing the encoding of a floating-point value. The floatingpoint value's bit-level representation is preserved.
See also: GLSL floatBitsToUint man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::floor(...)
vecType< T, P > glm::floor(const vecType< T, P > &x=P)
Documentation from code comments
Returns a value equal to the nearest integer that is less then or equal to x.
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL floor man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::fma(...)
genType glm::fma(const genType &a, const genType &b, const genType &c)
Documentation from code comments
Computes and returns a * b + c.
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL fma man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::fract(...)
genType glm::fract(genType x)
Documentation from code comments
Return x - floor(x).
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL fract man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::frexp(...)
genType glm::frexp(const genType &x, genIType &exp)
Documentation from code comments
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.
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL frexp man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::intBitsToFloat(...)
float glm::intBitsToFloat(const int &v)
Documentation from code comments
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 also: GLSL intBitsToFloat man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::intBitsToFloat(...)
vecType< float, P > glm::intBitsToFloat(const vecType< int, P > &v=P)
Documentation from code comments
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 also: GLSL intBitsToFloat man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::isinf(...)
vecType< bool, P > glm::isinf(const vecType< T, P > &x=P)
Documentation from code comments
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.
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL isinf man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::isnan(...)
vecType< bool, P > glm::isnan(const vecType< T, P > &x=P)
Documentation from code comments
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.
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL isnan man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::ldexp(...)
genType glm::ldexp(const genType &x, const genIType &exp)
Documentation from code comments
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.
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL ldexp man page;
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::max(...)
genType glm::max(genType x, genType y)
Documentation from code comments
Returns y if x < y; otherwise, it returns x.
Type parameters:
genType Floating-point or integer; scalar or vector types.
See also: GLSL max man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::min(...)
genType glm::min(genType x, genType y)
Documentation from code comments
Returns y if y < x; otherwise, it returns x.
Type parameters:
genType Floating-point or integer; scalar or vector types.
See also: GLSL min man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::mix(...)
vecType< T, P > glm::mix(const vecType< T, P > &x=P, const vecType< T, P > &y=P, const vecType< U, P > &a=P)
Documentation from code comments
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 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 also: GLSL mix man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
Parameters:
x Value to interpolate.
y Value to interpolate.
a Interpolant.
Type parameters:
genTypeT Floating point scalar or vector.
genTypeU Floating point or boolean scalar or vector. It can't be a vector if it is the length of genTypeT.
#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); // Teturns 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.
glm::mod(...)
genType glm::mod(genType x, genType y)
Documentation from code comments
Modulus. Returns x - y * floor(x / y) for each component in x using the floating point value y.
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL mod man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::modf(...)
genType glm::modf(genType x, genType &i)
Documentation from code comments
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.
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL modf man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::round(...)
vecType< T, P > glm::round(const vecType< T, P > &x=P)
Documentation from code comments
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.
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL round man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::roundEven(...)
vecType< T, P > glm::roundEven(const vecType< T, P > &x=P)
Documentation from code comments
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.)
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL roundEven man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
See also: New round to even technique
glm::sign(...)
vecType< T, P > glm::sign(const vecType< T, P > &x=P)
Documentation from code comments
Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
Type parameters:
genType Floating-point or signed integer; scalar or vector types.
See also: GLSL sign man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::smoothstep(...)
vecType< T, P > glm::smoothstep(const vecType< T, P > &edge0=P, const vecType< T, P > &edge1=P, const vecType< T, P > &x=P)
glm::smoothstep(...)
genType glm::smoothstep(genType edge0, genType edge1, genType x)
Documentation from code comments
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.
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL smoothstep man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::step(...)
vecType< T, P > glm::step(const vecType< T, P > &edge=P, const vecType< T, P > &x=P)
Documentation from code comments
Returns 0.0 if x < edge, otherwise it returns 1.0.
See also: GLSL step man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::step(...)
vecType< T, P > glm::step(T edge, const vecType< T, P > &x=P)
Documentation from code comments
Returns 0.0 if x < edge, otherwise it returns 1.0.
See also: GLSL step man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::step(...)
genType glm::step(genType edge, genType x)
Documentation from code comments
Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType.
See also: GLSL step man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::trunc(...)
vecType< T, P > glm::trunc(const vecType< T, P > &x=P)
Documentation from code comments
Returns a value equal to the nearest integer to x whose absolute value is not larger than the absolute value of x.
Type parameters:
genType Floating-point scalar or vector types.
See also: GLSL trunc man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::uintBitsToFloat(...)
float glm::uintBitsToFloat(const glm::uint &v)
Documentation from code comments
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 also: GLSL uintBitsToFloat man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
glm::uintBitsToFloat(...)
vecType< float, P > glm::uintBitsToFloat(const vecType< glm::uint, P > &v=P)
Documentation from code comments
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 also: GLSL uintBitsToFloat man page
See also: GLSL 4.20.8 specification, section 8.3 Common Functions
Last updated 토요일, 17 8월 2024 20:48:17 UTC - 99bfb4fd7929e233b87b05758efc36f91505592e
If you have any doubt about the usage of this module you can ask in the forum.
If you want to contribute better documentation or start documenting this section you can do so here
If you find anything wrong with this docs you can report any error by opening an issue