Module glm::builtin [] [src]

Built-in funcions defined in GLSL specification chapter 8.

Functions

abs

Returns x if x ≥ 0, otherwise it returns –x.

acos

Returns an angle whose cosine is x.

acosh

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

all

Returns true only if all components of x are true.

any

Returns true if any component of x is true.

asin

Returns an angle whose sine is x.

asinh

Arc hyperbolic sine; returns the inverse of sinh.

atan

Returns an angle whose tangent is y_over_x.

atan2

Returns an angle whose tangent is y / x.

atanh

Arc hyperbolic tangent; returns the inverse of tanh.

bitCount

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

bitfieldExtract

Extracts bits [offset, offset + bits - 1] from value, returning them in the least significant bits of the result.

bitfieldInsert

Returns the insertion the bits least-significant bits of insert into base.

bitfieldReverse

Returns the reversal of the bits of value.

ceil

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

clamp

Returns min (max (x, min_val), max_val).

clamp_s

A variant of function clamp that uses scalar values as thresholds.

cos

The standard trigonometric cosine function.

cosh

Returns the hyperbolic cosine function (ex + e-x) / 2.

cross

Returns the cross product of x and y.

degrees

Converts radians to degrees, i.e., 180/π * radians.

determinant

Returns the determinant of m.

distance

Returns the distance between p0 and p1, i.e., length(p0 – p1).

dot

Returns the dot product of x and y, i.e., x[0] * y[0] + x[1] * y[1] + ....

equal

Returns the component-wise compare of x == y.

exp

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

exp2

Returns 2 raised to the power of x. i.e., 2x.

faceforward

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

findLSB

Returns the bit number of the least significant bit set to 1 in the binary representation of value.

findMSB

Returns the bit number of the most significant bit in the binary representation of value.

floatBitsToInt

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

floatBitsToUint

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

floor

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

fma

Computes and returns a * b + c.

fmod

Modulus. Returns x – y ∗ floor(x/y).

fract

Returns x – floor(x).

frexp

Splits x into a floating-point significand in the range [0.5, 1.0) and an integral exponent of two, such that: x = significand⋅2exponent.

greaterThan

Returns the component-wise compare of x > y.

greaterThanEqual

Returns the component-wise compare of x ≥ y.

imulExtended

Multiplies 32-bit integers x and y, producing a 64-bit result.

intBitsToFloat

Returns a floating-point value corresponding to a signed integer encoding of a floating-point value.

inverse

Returns a matrix that is the inverse of m.

inversesqrt

Returns the inverse of the square root of x. i.e., the value 1/sqrt(x).

isinf

Returns true if x holds a positive infinity or negative infinity. Returns false otherwise.

isnan

Returns true if x holds a NaN. Returns false otherwise.

ldexp

Builds a floating-point number from x and the corresponding integral exponent of two in exp, returning: significand ⋅ 2exponent.

length

Returns the length of vector x, i.e., sqrt(x[0]^2 + x[1]^2 + ...).

lessThan

Returns the component-wise compare of x < y.

lessThanEqual

Returns the component-wise compare of x ≤ y.

log

Returns the natural logarithm of x. i.e., the value y which satisfies x = ey.

log2

Returns the base 2 logarithm of x. i.e., the value y which satisfies x = 2y.

matrixCompMult

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

max

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

max_s

A variant of max that always uses a scalar value as the comparator.

min

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

min_s

A variant of function min that uses a scalar value as comparator.

mix

Returns the linear blend of x and y, i.e., x⋅(1−a)+y⋅a.

mix_bool

Selects which vector each returned component comes from.

mix_s

A variant of function mix that parameter a is a scalar.

mod_s

Modulus with a scalar number.

modf

Returns the fractional and integer parts of x.

noise1

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

noise2

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

noise3

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

noise4

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

normalize

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

not

Returns the component-wise logical complement of x.

notEqual

Returns the component-wise compare of x ≠ y.

outerProduct

Treats the first parameter c as a column vector (matrix with one column) and the second parameter r as a row vector (matrix with one row) and does a linear algebraic matrix multiply c * r, yielding a matrix whose number of rows is the number of components in c and whose number of columns is the number of components in r.

packDouble2x32

Returns a double-precision value obtained by packing the components of v into a 64-bit value.

packSnorm2x16

First, converts each component of the normalized floating-point value v into 16-bit integer values. Then, the results are packed into the returned 32-bit unsigned integer.

packSnorm4x8

First, converts each component of the normalized floating-point value v into 8-bit integer values. Then, the results are packed into the returned 32-bit unsigned integer.

packUnorm2x16

First, converts each component of the normalized floating-point value v into 16-bit integer values. Then, the results are packed into the returned 32-bit unsigned integer.

packUnorm4x8

First, converts each component of the normalized floating-point value v into 8-bit integer values. Then, the results are packed into the returned 32-bit unsigned integer.

pow

Returns x raised to the y power, i.e., xy.

radians

Converts degrees to radians, i.e., π/180 * degrees.

reflect

For the incident vector I and surface orientation N, returns the reflection direction: I - 2 ∗ dot(N, I) ∗ N.

refract

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

round

Returns a value equal to the nearest integer to x.

roundEven

Returns a value equal to the nearest integer to x.

sign

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

sin

The standard trigonometric sine function.

sinh

Returns the hyperbolic sine function (ex - e-x) / 2.

smoothstep

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.

smoothstep_s

A variant of smoothstep function that use scalar as edges.

sqrt

Returns the square root of x. i.e., the value sqrt(x).

step

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

step_s

A variant of step function that use scalar as the edge.

tan

The standard trigonometric tangent.

tanh

Returns the hyperbolic tangent function sinh(x)/cosh(x).

transpose

Returns a matrix that is the transpose of m.

trunc

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

uaddCarry

Adds 32-bit unsigned integer x and y, returning the sum modulus 232 and the carry bit.

uintBitsToFloat

Returns a floating-point value corresponding to a unsigned integer encoding of a floating-point value.

umulExtended

Multiplies 32-bit unsigned integers x and y, producing a 64-bit result.

unpackDouble2x32

Returns a two-component unsigned integer vector representation of v. The bit-level representation of v is preserved.

unpackSnorm2x16

First, unpacks a single 32-bit unsigned integer p into two 16-bit signed integers. Then, each component is converted to a normalized floating-point value to generate the returned two-component vector.

unpackSnorm4x8

First, unpacks a single 32-bit unsigned integer p into four 8-bit signed integers. Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.

unpackUnorm2x16

First, unpacks a single 32-bit unsigned integer p into a pair of 16-bit unsigned integers. Then, each component is converted to a normalized floating-point value to generate the returned two-component vector.

unpackUnorm4x8

First, unpacks a single 32-bit unsigned integer p into four 8-bit unsigned integers. Then, each component is converted to a normalized floating-point value to generate the returned four-component vector.

usubBorrow

Subtracts the 32-bit unsigned integer y from x, returning the difference and the borrow bit.