Types
Variables
Functions
eul->matrix(arg0: matrix, arg1: euler-angles) => matrixsource
Convert euler angles to rotation matrix.
eul->quat(arg0: quaternion, arg1: euler-angles) => quaternionsource
Convert euler angles to quaternion
matrix->eul(arg0: euler-angles, arg1: matrix, arg2: int) => euler-anglessource
Conver matrix to euler angles. Takes some weird flag for what kind of euler angles
quat->eul(arg0: euler-angles, arg1: quaternion, arg2: int) => euler-anglessource
Convert quaternion to euler angles. The last argument is euler flags
set-eul!(arg0: euler-angles, arg1: float, arg2: float, arg3: float, arg4: int) => euler-anglessource
Set the euler angles. The 4th argument is for flags.
Types
rgba: uint32source
xyzw: uint128source
xyzwh: uint128source
Functions
fractional-part(x: float) => floatsource
Get the fractional part of a float
lerp(minimum: float, maximum: float, amount: float) => floatsource
Interpolate between minimum and maximum. The output is not clamped.
lerp-clamp(minimum: float, maximum: float, amount: float) => floatsource
Interpolate between minimum and maximum, but saturate the amount to [0, 1]
lerp-scale(min-out: float, max-out: float, in: float, min-in: float, max-in: float) => floatsource
Interpolate from [min-in, max-in] to [min-out, max-out].
If the output is out of range, it will be clamped.
This is not a great implementation.
log2(x: int) => intsource
Straight out of Bit Twiddling Hacks graphics.stanford.edu.
This website is old enough that they possibly used this back
in 1999.
rand-uint31-gen(gen: random-generator) => uintsource
Generate a supposedly random integer.
Note, this might not quite be right.
But the highest bit is always zero, like it says
and it looks kinda random to me.
rand-vu-float-range(minimum: float, maximum: float) => floatsource
Get a random number in the given range.
TODO: is this inclusive? I think it's [min, max)
rand-vu-init(seed: float) => floatsource
Initialize the VU0 random generator
rand-vu-int-count(maximum: int) => intsource
Get an integer in [0, maximum)
rand-vu-int-range(first: int, second: int) => intsource
Get an integer the given range. Inclusive of both?
It looks like they actually did this right??
rand-vu-nostep() => floatsource
Get the number currently in the random generator.
This will be equal to the last call of (rand-vu)
This will not update the random generator
rand-vu-percent?(prob: float) => symbolsource
Get a boolean that's true with the given probability.
seek(x: float, target: float, diff: float) => floatsource
Move x toward target by at most diff, with floats
seekl(x: int, target: int, diff: int) => intsource
Move x toward a target by at most diff, with integers
truncate(x: float) => floatsource
Truncate a floating point number to an integer value.
Positive values round down and negative values round up.
Variables
*_vu-reg-R_*: intsource
Types
matrix: structuresource
Functions
matrix-copy!(dst: matrix, src: matrix) => matrixsource
Copy src to dst
Functions
column-scale-matrix!(dst: matrix, scale: vector, src: matrix) => matrixsource
Scale an existing matrix. Okay for dst = src. The scaling is applied column-wise.
Meaning the x component of scale will scale the first column of src.
matrix*!(dst: matrix, src1: matrix, src2: matrix) => matrixsource
Set dst = src1 * src2. It is okay for any arguments to be the same data.
This is a moderately efficient implementation.
matrix+!(dst: matrix, src1: matrix, src2: matrix) => matrixsource
Set dst = src1 + src2. It is okay for any arguments to be the same data.
This is not an efficient implementation.
matrix-!(dst: matrix, src1: matrix, src2: matrix) => matrixsource
Set dst = src1 - src1. It is okay for any arugments to be the same data.
This is not an efficient implementation.
matrix-3x3-determinant(mat: matrix) => floatsource
Compute the determinant of a 3x3 matrix
matrix-3x3-inverse!(dst: matrix, src: matrix) => matrixsource
Compute the inverse of a 3x3 matrix. Not very efficient.
Requires src != dst.
matrix-3x3-inverse-transpose!(dst: matrix, src: matrix) => matrixsource
Invert and transpose.
Requires dst != src.
matrix-4x4-determinant(dst: matrix) => floatsource
Take the determinant of a 4x4 matrix, but this is wrong.
matrix-4x4-inverse!(dst: matrix, src: matrix) => matrixsource
Invert a 4x4 matrix. This assumes that the input is a homogeneous transform.
Src and dst can be the same.
matrix-4x4-inverse-transpose!(dst: matrix, src: matrix) => matrixsource
Invert and transpose an entire 4x4. I think has no restrictions, other than dst != src. Unused.
The answer is wrong. The determinant function is wrong.
matrix-axis-angle!(dst: matrix, axis: vector, angle-deg: float) => nonesource
Create an axis-angle rotation matrix.
matrix-axis-sin-cos!(dst: matrix, axis: vector, s: float, c: float) => matrixsource
Create an axis-angle rotation matrix. But given the sin/cos of the angle.
matrix-axis-sin-cos-vu!(dst: matrix, axis: vector, s: float, c: float) => nonesource
Create an axis-angle rotation matrix. But given the sin/cos of the angle.
matrix-identity!(dst: matrix) => matrixsource
Set dst to the identity matrix.
matrix-inv-scale!(dst: matrix, scale: vector) => matrixsource
Set dst to a homogeneous transform with only a scale.
The x,y,z components of scale are inverted and used as the x,y,z scaling factors
matrix-inverse-of-rot-trans!(dst: matrix, src: matrix) => matrixsource
Set dst = src^-1, assuming src is a homogeneous tranform with only rotation/translation.
NOTE: THIS FUNCTION REQUIRES dst != src
matrix-lerp!(dst: matrix, src1: matrix, src2: matrix, alpha: float) => matrixsource
Lerp an entire matrix, coefficient-wise.
matrix-rotate-x!(dst: matrix, rot-deg: float) => matrixsource
Set dst to a homogeneous transform matrix for a rotation around the x-axis (degrees)
matrix-rotate-xyz!(dst: matrix, rot-xyz-deg: vector) => matrixsource
Rotate in x,y,z order
matrix-rotate-y!(dst: matrix, rot-deg: float) => matrixsource
Set dst to a homoegeneous transform matrix for a rotation around the y axis (degrees)
matrix-rotate-yx!(dst: matrix, rot-y-deg: float, rot-x-deg: float) => matrixsource
Rotate by y then x.
matrix-rotate-yxy!(dst: matrix, rots-deg: vector) => matrixsource
Rotate. I believe in yxy order? Compared to the other rotations, this one
is quite a bit more optimized and avoid repeated trig operations.
matrix-rotate-yxz!(dst: matrix, rot-xyz-deg: vector) => matrixsource
Rotate in y,x,z order.
matrix-rotate-yzx!(dst: matrix, rot-xyz-deg: vector) => matrixsource
Rotate in y,z,x order
matrix-rotate-z!(dst: matrix, rot-deg: float) => matrixsource
Set dst to a homogeneous transform matrix for a rotation around the z-axis (degrees)
matrix-rotate-zxy!(dst: matrix, rot-xyz-deg: vector) => matrixsource
Rotate in z,x,y order
matrix-rotate-zyx!(dst: matrix, rot-xyz-deg: vector) => matrixsource
Rotate in z,y,x order.
matrix-scale!(dst: matrix, scale: vector) => matrixsource
Set dst to a homogenous transform with only a scale. The x,y,z components
of scale become the x,y,z scaling factors
matrix-translate!(dst: matrix, trans: vector) => matrixsource
Set dst to a homogeneous transform with only a translation of trans