Banjo API 0.0.1
Multi-purpose C99 API
|
Linear math function. More...
The Math group provides usual facilities for linear math, including
The scalar type is float
by is aliased as bj_real_t
using a typedef.
This library is a direct conversion of linmath.h by Wolfgang Draxinger.
Macros | |
#define | bj_real_t float |
Alias for float type. | |
#define | bj_quat_add bj_vec4_add |
Alias for bj_vec4_add, adds two quaternions. | |
#define | bj_quat_sub bj_vec4_sub |
Alias for bj_vec4_sub, subtracts two quaternions. | |
#define | bj_quat_norm bj_vec4_normalize |
Alias for bj_vec4_normalize, normalizes a quaternion. | |
#define | bj_quat_scale bj_vec4_scale |
Alias for bj_vec4_scale, scales a quaternion by a scalar. | |
#define | bj_quat_dot bj_vec4_dot |
Alias for bj_vec4_dot, computes the dot product of two quaternions. | |
Typedefs | |
typedef bj_real_t | bj_vec2[2] |
Defines a 2D vector type. | |
typedef bj_real_t | bj_vec3[3] |
Defines a 3D vector type. | |
typedef bj_real_t | bj_vec4[4] |
Defines a 4D vector type. | |
typedef bj_vec4 | bj_mat4[4] |
Defines a 4x4 matrix type. | |
typedef bj_real_t | bj_quat[4] |
Defines a quaternion type. | |
Functions | |
BJ_INLINE void | bj_vec2_set (bj_vec2 res, bj_real_t a, bj_real_t b) |
Directly set the scalar values of a bj_vec2 object. | |
BJ_INLINE void | bj_vec2_apply (bj_vec2 res, const bj_vec2 a, bj_real_t(*f)(bj_real_t)) |
Invoke the given function to each scalar of the bj_vec2. | |
BJ_INLINE void | bj_vec2_add (bj_vec2 res, const bj_vec2 lhs, const bj_vec2 rhs) |
Set res to the result of lhs +rhs . | |
BJ_INLINE void | bj_vec2_sub (bj_vec2 res, const bj_vec2 lhs, const bj_vec2 rhs) |
Set res to the result of lhs -rhs . | |
BJ_INLINE void | bj_vec2_scale (bj_vec2 res, const bj_vec2 v, bj_real_t s) |
Set res to the result of multiplying v by s . | |
BJ_INLINE void | bj_vec2_scale_each (bj_vec2 res, const bj_vec2 v, const bj_vec2 s) |
Multiply each scalar of v by the respecting scalar in s . | |
BJ_INLINE bj_real_t | bj_vec2_dot (const bj_vec2 a, const bj_vec2 b) |
Computes the dot product of a abnd b | |
BJ_INLINE bj_real_t | bj_vec2_len (const bj_vec2 v) |
Computes the length of the vec2. | |
BJ_INLINE void | bj_vec2_normalize (bj_vec2 res, const bj_vec2 v) |
Normalizes the provided vec2. | |
BJ_INLINE void | bj_vec2_min (bj_vec2 res, const bj_vec2 a, const bj_vec2 b) |
Computes the component-wise minimum of two 2D vectors. | |
BJ_INLINE void | bj_vec2_max (bj_vec2 res, const bj_vec2 a, const bj_vec2 b) |
Computes the component-wise maximum of two 2D vectors. | |
BJ_INLINE void | bj_vec2_copy (bj_vec2 res, const bj_vec2 src) |
Copies the contents of one 2D vector to another. | |
BJ_INLINE void | bj_vec3_set (bj_vec2 res, bj_real_t a, bj_real_t b, bj_real_t c) |
Directly set the scalar values of a bj_vec3 object. | |
BJ_INLINE void | bj_vec3_apply (bj_vec3 res, const bj_vec3 a, bj_real_t(*f)(bj_real_t)) |
Invoke the given function to each scalar of the bj_vec3. | |
BJ_INLINE void | bj_vec3_add (bj_vec3 res, const bj_vec3 lhs, const bj_vec3 rhs) |
Set res to the result of lhs +rhs . | |
BJ_INLINE void | bj_vec3_sub (bj_vec3 res, const bj_vec3 lhs, const bj_vec3 rhs) |
Set res to the result of lhs -rhs . | |
BJ_INLINE void | bj_vec3_scale (bj_vec3 res, const bj_vec3 v, bj_real_t s) |
Set res to the result of multiplying v by s . | |
BJ_INLINE bj_real_t | bj_vec3_dot (const bj_vec3 a, const bj_vec3 b) |
Computes the dot product of a abnd b | |
BJ_INLINE bj_real_t | bj_vec3_len (const bj_vec3 v) |
Computes the length of the vec3. | |
BJ_INLINE void | bj_vec3_normalize (bj_vec3 res, const bj_vec3 v) |
Normalizes the provided vec3. | |
BJ_INLINE void | bj_vec3_min (bj_vec3 res, const bj_vec3 a, const bj_vec3 b) |
Computes the component-wise minimum of two 3D vectors. | |
BJ_INLINE void | bj_vec3_max (bj_vec3 res, const bj_vec3 a, const bj_vec3 b) |
Computes the component-wise maximum of two 3D vectors. | |
BJ_INLINE void | bj_vec3_copy (bj_vec3 res, const bj_vec3 src) |
Copies the contents of one 3D vector to another. | |
BJ_INLINE void | bj_vec3_cross (bj_vec3 res, const bj_vec3 l, const bj_vec3 r) |
Computes the 3D cross product of two 3D vectors. | |
BJ_INLINE void | bj_vec3_reflect (bj_vec3 res, const bj_vec3 v, const bj_vec3 n) |
Reflects a 3D vector around a given normal. | |
BJ_INLINE void | bj_vec4_set (bj_vec2 res, bj_real_t a, bj_real_t b, bj_real_t c, bj_real_t d) |
Directly set the scalar values of a bj_vec4 object. | |
BJ_INLINE void | bj_vec4_apply (bj_vec4 res, const bj_vec4 a, bj_real_t(*f)(bj_real_t)) |
Invoke the given function to each scalar of the bj_vec4. | |
BJ_INLINE void | bj_vec4_add (bj_vec4 res, const bj_vec4 lhs, const bj_vec4 rhs) |
Set res to the result of lhs +rhs . | |
BJ_INLINE void | bj_vec4_sub (bj_vec4 res, const bj_vec4 lhs, const bj_vec4 rhs) |
Set res to the result of lhs -rhs . | |
BJ_INLINE void | bj_vec4_scale (bj_vec4 res, const bj_vec4 v, bj_real_t s) |
Set res to the result of multiplying v by s . | |
BJ_INLINE bj_real_t | bj_vec4_dot (const bj_vec4 a, const bj_vec4 b) |
Computes the dot product of a abnd b | |
BJ_INLINE bj_real_t | bj_vec4_len (const bj_vec4 v) |
Computes the length of the vec4. | |
BJ_INLINE void | bj_vec4_normalize (bj_vec4 res, const bj_vec4 v) |
Normalizes the provided vec4. | |
BJ_INLINE void | bj_vec4_min (bj_vec4 res, const bj_vec4 a, const bj_vec4 b) |
Computes the component-wise minimum of two 4D vectors. | |
BJ_INLINE void | bj_vec4_max (bj_vec4 res, const bj_vec4 a, const bj_vec4 b) |
Computes the component-wise maximum of two 4D vectors. | |
BJ_INLINE void | bj_vec4_copy (bj_vec4 res, const bj_vec4 src) |
Copies the contents of one 4D vector to another. | |
BJ_INLINE void | bj_vec4_cross (bj_vec4 res, const bj_vec4 l, const bj_vec4 r) |
Computes the 3D cross product of two 4D vectors, assuming w = 1.0. | |
BJ_INLINE void | bj_vec4_reflect (bj_vec4 res, const bj_vec4 v, const bj_vec4 n) |
Reflects a 4D vector around a given normal. | |
BJ_INLINE void | bj_mat4_identity (bj_mat4 mat) |
Initializes a 4x4 matrix to the identity matrix. | |
BJ_INLINE void | bj_mat4_copy (bj_mat4 to, const bj_mat4 from) |
Copies a 4x4 matrix from one to another. | |
BJ_INLINE void | bj_mat4_row (bj_vec4 res, const bj_mat4 mat, int r) |
Retrieves a specific row from a 4x4 matrix. | |
BJ_INLINE void | bj_mat4_col (bj_vec4 res, const bj_mat4 mat, int c) |
Retrieves a specific column from a 4x4 matrix. | |
BJ_INLINE void | bj_mat4_transpose (bj_mat4 res, const bj_mat4 mat) |
Transposes a 4x4 matrix. | |
BJ_INLINE void | bj_mat4_add (bj_mat4 res, const bj_mat4 lhs, const bj_mat4 rhs) |
Adds two 4x4 matrices. | |
BJ_INLINE void | bj_mat4_sub (bj_mat4 res, const bj_mat4 lhs, const bj_mat4 rhs) |
Subtracts one 4x4 matrix from another. | |
BJ_INLINE void | bj_mat4_scale (bj_mat4 res, const bj_mat4 lhs, bj_real_t k) |
Scales a 4x4 matrix by a scalar. | |
BJ_INLINE void | bj_mat4_scale_xyz (bj_mat4 res, const bj_mat4 mat, bj_real_t x, bj_real_t y, bj_real_t z) |
Scales the X, Y, and Z components of a 4x4 matrix. | |
BJ_INLINE void | bj_mat4_mul (bj_mat4 res, const bj_mat4 lhs, const bj_mat4 rhs) |
Multiplies two 4x4 matrices. | |
BJ_INLINE void | bj_mat4_mul_vec4 (bj_vec4 res, const bj_mat4 mat, const bj_vec4 v) |
Multiplies a 4x4 matrix by a 4D vector. | |
BJ_INLINE void | bj_mat4_translation (bj_mat4 res, bj_real_t x, bj_real_t y, bj_real_t z) |
Creates a 4x4 translation matrix. | |
BJ_INLINE void | bj_mat4_translation_inplace (bj_mat4 M, bj_real_t x, bj_real_t y, bj_real_t z) |
Applies a translation transformation to a 4x4 matrix in-place. | |
BJ_INLINE void | bj_mat4_mul_outer (bj_mat4 res, const bj_vec3 a, const bj_vec3 b) |
Computes the outer product of two 3D vectors and stores the result in a 4x4 matrix. | |
BJ_INLINE void | bj_mat4_rotate (bj_mat4 res, const bj_mat4 mat, bj_real_t x, bj_real_t y, bj_real_t z, bj_real_t angle) |
Rotates a 4x4 matrix by a given axis and angle. | |
BJ_INLINE void | bj_ma4_rotate_x (bj_mat4 res, const bj_mat4 mat, bj_real_t angle) |
Rotates a 4x4 matrix around the X axis by a given angle. | |
BJ_INLINE void | bj_ma4_rotate_y (bj_mat4 res, const bj_mat4 mat, bj_real_t angle) |
Rotates a 4x4 matrix around the Y axis by a given angle. | |
BJ_INLINE void | bj_ma4_rotate_z (bj_mat4 res, const bj_mat4 mat, bj_real_t angle) |
Rotates a 4x4 matrix around the Z-axis by a given angle. | |
BJ_INLINE void | bj_mat4_rotate_arcball (bj_mat4 R, const bj_mat4 M, bj_vec2 const _a, bj_vec2 const _b, bj_real_t s) |
Rotates a matrix based on arcball-style rotation from two 2D vectors. | |
BJ_INLINE void | bj_mat4_inverse (bj_mat4 res, const bj_mat4 mat) |
Inverts a 4x4 matrix. | |
BJ_INLINE void | bj_mat4_orthonormalize (bj_mat4 res, const bj_mat4 mat) |
Orthonormalizes the rows of a 4x4 matrix. | |
BJ_INLINE void | bj_mat4_frustum (bj_mat4 fmat, bj_real_t l, bj_real_t r, bj_real_t b, bj_real_t t, bj_real_t n, bj_real_t f) |
Generates a perspective projection matrix for a frustum. | |
BJ_INLINE void | bj_mat4_ortho (bj_mat4 omat, bj_real_t l, bj_real_t r, bj_real_t b, bj_real_t t, bj_real_t n, bj_real_t f) |
Generates an orthographic projection matrix. | |
BJ_INLINE void | bj_mat4_perspective (bj_mat4 pmat, bj_real_t y_fov, bj_real_t aspect, bj_real_t n, bj_real_t f) |
Generates a perspective projection matrix based on field of view. | |
BJ_INLINE void | bj_mat4_lookat (bj_mat4 m, const bj_vec3 eye, const bj_vec3 center, const bj_vec3 up) |
Generates a look-at matrix. | |
BJ_INLINE void | bj_quat_identity (bj_quat q) |
Sets a quaternion to the identity quaternion. | |
BJ_INLINE void | bj_quat_mul (bj_quat res, const bj_quat p, const bj_quat q) |
Multiplies two quaternions. | |
BJ_INLINE void | bj_quat_conjugate (bj_quat res, const bj_quat q) |
Computes the conjugate of a quaternion. | |
BJ_INLINE void | bj_quat_rotation (bj_quat res, bj_real_t angle, const bj_vec3 axis) |
Creates a rotation quaternion based on an angle and axis. | |
BJ_INLINE void | bj_quat_mul_vec3 (bj_vec3 res, const bj_quat q, const bj_vec3 v) |
Applies a quaternion rotation to a 3D vector. | |
BJ_INLINE void | bj_mat4_from_quat (bj_mat4 res, const bj_quat q) |
Converts a quaternion to a 4x4 rotation matrix. | |
BJ_INLINE void | bj_mat4_rotate_from_quat (bj_mat4 R, const bj_mat4 M, const bj_quat q) |
Applies a quaternion rotation to each column of a matrix. | |
BJ_INLINE void | bj_quat_from_mat4 (bj_quat q, const bj_mat4 M) |
Converts a 4x4 rotation matrix to a quaternion. | |
typedef bj_vec4 bj_mat4[4] |
typedef bj_real_t bj_quat[4] |
This type represents a quaternion with four components, each of type bj_real_t
. Quaternions are used for representing rotations in 3D space.
bj_real_t
values. typedef bj_real_t bj_vec2[2] |
This type represents a 2D vector with two components, each of type bj_real_t
. It is commonly used for storing 2D coordinates, directions, or other 2D data.
bj_real_t
values. typedef bj_real_t bj_vec3[3] |
This type represents a 3D vector with three components, each of type bj_real_t
. It is commonly used for storing 3D coordinates, directions, or other 3D data.
bj_real_t
values. typedef bj_real_t bj_vec4[4] |
This type represents a 4D vector with four components, each of type bj_real_t
. It is commonly used for storing 4D homogeneous coordinates or other 4D data.
bj_real_t
values. This function performs a rotation of matrix mat around the X axis by angle (in radians), and stores the resulting matrix in res.
res | The resulting rotated matrix. |
mat | The matrix to rotate. |
angle | The angle to rotate by (in radians). |
This function performs a rotation of matrix mat around the Y axis by angle (in radians), and stores the resulting matrix in res.
res | The resulting rotated matrix. |
mat | The matrix to rotate. |
angle | The angle to rotate by (in radians). |
This function applies a rotation to the input matrix around the Z-axis by a specified angle and stores the result in the output matrix.
mat | The 4x4 matrix to rotate. |
angle | The angle (in radians) to rotate the matrix around the Z-axis. |
res | The resulting rotated matrix. |
Computes the element-wise addition of two matrices lhs and rhs and stores the result in res.
res | The resulting matrix after addition. |
lhs | The left-hand matrix to add. |
rhs | The right-hand matrix to add. |
Extracts the column at index c from matrix mat and stores it in res.
res | The resulting column vector. |
mat | The matrix from which to extract the column. |
c | The column index (0-based) to extract. |
Copies the entire contents of the matrix from to the matrix to.
to | The destination matrix. |
from | The source matrix to copy from. |
This function converts the given quaternion into a 4x4 rotation matrix.
res | The resulting 4x4 rotation matrix. |
q | The quaternion to convert. |
BJ_INLINE void bj_mat4_frustum | ( | bj_mat4 | fmat, |
bj_real_t | l, | ||
bj_real_t | r, | ||
bj_real_t | b, | ||
bj_real_t | t, | ||
bj_real_t | n, | ||
bj_real_t | f ) |
This function generates a perspective projection matrix based on a frustum defined by the left, right, bottom, top, near, and far clipping planes.
l | The left plane of the frustum. |
r | The right plane of the frustum. |
b | The bottom plane of the frustum. |
t | The top plane of the frustum. |
n | The near plane of the frustum. |
f | The far plane of the frustum. |
fmat | The resulting perspective projection matrix. |
BJ_INLINE void bj_mat4_identity | ( | bj_mat4 | mat | ) |
Sets all diagonal elements of the matrix to 1.0 and all off-diagonal elements to 0.0.
mat | The matrix to be initialized as the identity matrix. |
This function calculates the inverse of the given 4x4 matrix and stores it in the result matrix. It uses a standard matrix inversion method for 4x4 matrices.
mat | The matrix to invert. |
res | The resulting inverted matrix. |
BJ_INLINE void bj_mat4_lookat | ( | bj_mat4 | m, |
const bj_vec3 | eye, | ||
const bj_vec3 | center, | ||
const bj_vec3 | up ) |
This function generates a view matrix that transforms coordinates from world space to camera space based on the eye position, center (target) position, and up vector.
eye | The position of the camera. |
center | The target position the camera is looking at. |
up | The up vector of the camera. |
m | The resulting look-at matrix. |
Computes the matrix product of lhs and rhs and stores the result in res.
res | The resulting matrix after multiplication. |
lhs | The left-hand matrix. |
rhs | The right-hand matrix. |
Computes the outer product of vectors a and b and stores the result in matrix res. The result is a matrix where elements are the products of corresponding components of the vectors.
res | The resulting 4x4 matrix from the outer product. |
a | The first 3D vector. |
b | The second 3D vector. |
Computes the matrix-vector product of matrix mat and vector v and stores the result in res.
res | The resulting vector after multiplication. |
mat | The matrix to multiply. |
v | The vector to multiply. |
BJ_INLINE void bj_mat4_ortho | ( | bj_mat4 | omat, |
bj_real_t | l, | ||
bj_real_t | r, | ||
bj_real_t | b, | ||
bj_real_t | t, | ||
bj_real_t | n, | ||
bj_real_t | f ) |
This function generates an orthographic projection matrix for the specified left, right, bottom, top, near, and far clipping planes.
l | The left plane of the orthographic projection. |
r | The right plane of the orthographic projection. |
b | The bottom plane of the orthographic projection. |
t | The top plane of the orthographic projection. |
n | The near plane of the orthographic projection. |
f | The far plane of the orthographic projection. |
omat | The resulting orthographic projection matrix. |
This function orthonormalizes the rows of the matrix, ensuring that the matrix rows are orthogonal and normalized.
mat | The 4x4 matrix to orthonormalize. |
res | The resulting orthonormalized 4x4 matrix. |
BJ_INLINE void bj_mat4_perspective | ( | bj_mat4 | pmat, |
bj_real_t | y_fov, | ||
bj_real_t | aspect, | ||
bj_real_t | n, | ||
bj_real_t | f ) |
This function generates a perspective projection matrix based on the field of view (y_fov), aspect ratio, and near and far clipping planes.
y_fov | The vertical field of view in radians. |
aspect | The aspect ratio (width / height). |
n | The near clipping plane. |
f | The far clipping plane. |
pmat | The resulting perspective projection matrix. |
BJ_INLINE void bj_mat4_rotate | ( | bj_mat4 | res, |
const bj_mat4 | mat, | ||
bj_real_t | x, | ||
bj_real_t | y, | ||
bj_real_t | z, | ||
bj_real_t | angle ) |
This function performs a 3D rotation on matrix mat around an arbitrary axis (x, y, z) by angle (in radians), and stores the resulting matrix in res. The axis vector is normalized before the rotation.
res | The resulting rotated matrix. |
mat | The matrix to rotate. |
x | The X component of the axis of rotation. |
y | The Y component of the axis of rotation. |
z | The Z component of the axis of rotation. |
angle | The angle to rotate by (in radians). |
BJ_INLINE void bj_mat4_rotate_arcball | ( | bj_mat4 | R, |
const bj_mat4 | M, | ||
bj_vec2 const | _a, | ||
bj_vec2 const | _b, | ||
bj_real_t | s ) |
This function computes the rotation matrix that represents the arcball rotation based on two 2D input vectors (a, b), the input matrix, and a scaling factor. It normalizes the vectors and calculates the rotation axis and angle, applying the rotation to the matrix.
M | The input matrix to rotate. |
_a | The first 2D vector for the arcball rotation. |
_b | The second 2D vector for the arcball rotation. |
s | A scaling factor for the rotation angle. |
R | The resulting rotation matrix. |
This function applies the rotation represented by the given quaternion to each column of the given matrix, transforming it into the rotated matrix.
R | The resulting rotated matrix. |
M | The matrix to rotate. |
q | The quaternion representing the rotation. |
Extracts the row at index r from matrix mat and stores it in res.
res | The resulting row vector. |
mat | The matrix from which to extract the row. |
r | The row index (0-based) to extract. |
Multiplies each element of the matrix lhs by the scalar k and stores the result in res.
res | The resulting scaled matrix. |
lhs | The matrix to scale. |
k | The scalar by which to scale the matrix. |
BJ_INLINE void bj_mat4_scale_xyz | ( | bj_mat4 | res, |
const bj_mat4 | mat, | ||
bj_real_t | x, | ||
bj_real_t | y, | ||
bj_real_t | z ) |
Scales the X, Y, and Z components of the matrix mat by x, y, and z respectively. The W component is left unchanged and copied directly from mat.
res | The resulting scaled matrix. |
mat | The matrix to scale. |
x | The scaling factor for the X component. |
y | The scaling factor for the Y component. |
z | The scaling factor for the Z component. |
Computes the element-wise subtraction of two matrices lhs and rhs and stores the result in res.
res | The resulting matrix after subtraction. |
lhs | The matrix to subtract from. |
rhs | The matrix to subtract. |
Creates a translation matrix that translates a point by x, y, and z in 3D space.
res | The resulting translation matrix. |
x | The translation distance along the X axis. |
y | The translation distance along the Y axis. |
z | The translation distance along the Z axis. |
This function adds a translation by x, y, and z to the matrix M in-place. The translation vector is applied by modifying the last column of the matrix.
[in,out] | M | The matrix to apply the translation to (modified in-place). |
x | The translation distance along the X axis. | |
y | The translation distance along the Y axis. | |
z | The translation distance along the Z axis. |
Computes the transpose of matrix mat and stores it in res. The rows of mat become the columns of res.
res | The transposed matrix. |
mat | The matrix to transpose. |
This function computes the conjugate of the given quaternion, which involves negating the vector part (x, y, z) of the quaternion while keeping the scalar part unchanged.
res | The resulting conjugated quaternion. |
q | The quaternion to conjugate. |
This function converts the given 4x4 rotation matrix into a quaternion.
q | The resulting quaternion. |
M | The 4x4 rotation matrix to convert. |
BJ_INLINE void bj_quat_identity | ( | bj_quat | q | ) |
This function sets the given quaternion to the identity quaternion (0, 0, 0, 1).
q | The quaternion to set as the identity. |
This function computes the product of two quaternions, following the quaternion multiplication rules, and stores the result in the output quaternion.
res | The resulting quaternion after multiplication. |
p | The first quaternion. |
q | The second quaternion. |
This function rotates a 3D vector using the given quaternion, which represents the rotation.
res | The resulting rotated vector. |
q | The quaternion representing the rotation. |
v | The 3D vector to rotate. |
This function generates a quaternion representing a rotation of the specified angle (in radians) around the given axis.
res | The resulting rotation quaternion. |
angle | The angle (in radians) of rotation. |
axis | The axis around which the rotation occurs. |
res | The destination vec2 |
lhs | The first source vec2 |
rhs | The second source vec2 |
res | A location to the target vec2 |
a | A location to the source vec2 |
f | The map function |
res | The destination vector. |
src | The source vector to copy. |
a | The first vec2 |
b | The second vec2 |
res | The result vector, where each component is the maximum of a and b. |
a | The first input vector. |
b | The second input vector. |
res | The result vector, where each component is the minimum of a and b. |
a | The first input vector. |
b | The second input vector. |
res | The resulting vec2 |
v | The vec2 |
res | The destination vec2 |
v | The source vec2 |
s | The factor value |
res | The destination vec2 |
v | The source vec2 |
s | The scalar vec2 |
res | A location to the target vec4 |
a | The first scalar value |
b | The second scalar value |
res | The destination vec2 |
lhs | The first source vec2 |
rhs | The second source vec2 |
res | The destination vec3 |
lhs | The first source vec3 |
rhs | The second source vec3 |
res | A location to the target vec3 |
a | A location to the source vec3 |
f | The map function |
res | The destination vector. |
src | The source vector to copy. |
res | The resulting vector (cross product of l and r). |
l | The left-hand input vector. |
r | The right-hand input vector. |
a | The first vec3 |
b | The second vec3 |
res | The result vector, where each component is the maximum of a and b. |
a | The first input vector. |
b | The second input vector. |
res | The result vector, where each component is the minimum of a and b. |
a | The first input vector. |
b | The second input vector. |
res | The resulting vec3 |
v | The vec3 |
Computes the reflection of vector v across the normal vector n. Assumes both vectors are 3D, and uses all three components.
res | The reflected vector. |
v | The incident vector. |
n | The normal vector (should be normalized). |
res | The destination vec3 |
v | The source vec3 |
s | The factor value |
res | A location to the target vec4 |
a | The first scalar value |
b | The second scalar value |
c | The third scalar value |
res | The destination vec3 |
lhs | The first source vec3 |
rhs | The second source vec3 |
res | The destination vec4 |
lhs | The first source vec4 |
rhs | The second source vec4 |
res | A location to the target vec4 |
a | A location to the source vec4 |
f | The map function |
res | The destination vector. |
src | The source vector to copy. |
Only the x, y, and z components are used for the cross product. The w component of the result is set to 1.0.
res | The resulting vector. |
l | The left-hand input vector. |
r | The right-hand input vector. |
a | The first vec4 |
b | The second vec4 |
res | The result vector, where each component is the maximum of a and b. |
a | The first input vector. |
b | The second input vector. |
res | The result vector, where each component is the minimum of a and b. |
a | The first input vector. |
b | The second input vector. |
res | The resulting vec4 |
v | The vec4 |
Computes the reflection of vector v across the normal vector n. Assumes both vectors are 4D, and uses all four components.
res | The reflected vector. |
v | The incident vector. |
n | The normal vector (should be normalized). |
res | The destination vec2 |
v | The source vec2 |
s | The factor value |
res | A location to the target vec4 |
a | The first scalar value |
b | The second scalar value |
c | The third scalar value |
d | The fourth scalar value |