Constrain a value to lie between two further values.
clamp(+3, +0, +2); // results in +2;
The number to clamp.
Minimum number operand.
Maximum number operand.
Constrain a two-component vector to lie between two further two-component vectors.
let a: vec2 = vec2.fromValues(2, 2);
clamp2(a, a, [0, 0], [1, 1]);
The receiving vector.
The vector to clamp.
Minimum vector operand.
Maximum vector operand.
Constrain a three-component vector to lie between two further three-component vectors.
let a: vec3 = vec3.fromValues(2, 2, 2);
clamp3(a, a, [0, 0, 0], [1, 1, 1]);
-The receiving vector.
The vector to clamp.
Minimum vector operand.
Maximum vector operand.
Constrain a four-component vector to lie between two further four-component vectors.
let a: vec4 = vec4.fromValues(2, 2, 2, 2);
clamp4(a, a, [0, 0, 0, 0], [1, 1, 1, 1]);
The receiving vector.
The vector to clamp.
Minimum vector operand.
Maximum vector operand.
Decodes three 8bit components of a vec3 to a 24bit floating point number.
Vector with three 8bit unsigned int components (uint8x3).
Unpacks a 24bit unsigned int from a three component byte vector.
let uint8x3: vec3 = vec3.fromValues(173, 209, 3);
decode_uint24_from_rgb8(uint8x3); // should return 250285
byte (uint8) vector with packed uint24 data
Unpacks a 32bit unsigned int from a four component byte vector.
let uint8x4: vec4 = vec4.fromValues(173, 209, 3, 23);
decode_uint24_from_rgba8(uint8x4); // should return xxx
byte (uint8) vector with packed uint32 data
Packs a 24bit unsigned int into a three component byte vector.
let uint8x3: vec3 = vec3.create();
encode_uint24_in_rgb8(uint8x3, 250285); // should result in [ 173, 209, 3 ]
byte (uint8) vector with packed uint24 data
uint24 number
Packs a 32bit unsigned int into a four component byte vector.
let uint8x4: vec3 = vec4.create();
encode_uint24_in_rgb8(uint8x4, 250285); // should result in [ 173, 209, 3, 0 ]
byte (uint8) vector with packed uint32 data
uint32 number
Compute the fractional part of the argument.
fract(+1.23); // results in +0.23
fract(-1.23); // results in -0.23
The number to compute the fractional part of.
Constructs a vec3 from a vec4 with division by the w component applied. If the w component is zero, division skipped.
const v4: vec4 = vec4.fromValues(2, 4, 6, 2);
const v3: vec3 = fromVec4(v4); // v3 is [1, 2, 3]
The vector to be transformed to a vec3.
A mat2 placeholder to overcome the gl-matrix out interface.
A mat3 placeholder to overcome the gl-matrix out interface.
A mat4 placeholder to overcome the gl-matrix out interface.
Performs a mix as specified in GLSL.
The first value.
The second value.
The interpolation value (usually between 0 and 1).
Parses a vec2 from a string.
String in the format '
Parses a vec3 from a string.
String in the format '
Parses a vec4 from a string.
String in the format '
Extract the sign of the parameter as specified in GLSL.
Value from which to extract the sign.
A vec2 placeholder to overcome the gl-matrix out interface.
A vec3 placeholder to overcome the gl-matrix out interface.
A vec4 placeholder to overcome the gl-matrix out interface.
Namespace that comprises various gl-matrix extensions (also cleans up documentation).