mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-04-26 03:51:46 +00:00
Move documented description above Lua example
This commit is contained in:
parent
64659afd82
commit
e9df872213
3 changed files with 451 additions and 451 deletions
|
|
@ -1248,6 +1248,10 @@ def doc_function(fname, function):
|
|||
rtype, rlink = translate_type_to_lua(function['type'])
|
||||
param_str = ', '.join([x['identifier'] for x in function['params']])
|
||||
|
||||
if description != "":
|
||||
s += '\n### Description\n'
|
||||
s += f'{description}\n'
|
||||
|
||||
s += "\n### Lua Example\n"
|
||||
if rtype != None:
|
||||
s += "`local %sValue = %s(%s)`\n" % (rtype.replace('`', '').split(' ')[0], fid, param_str)
|
||||
|
|
@ -1288,10 +1292,6 @@ def doc_function(fname, function):
|
|||
|
||||
s += '\n### C Prototype\n'
|
||||
s += '`%s`\n' % function['line'].strip()
|
||||
|
||||
if description != "":
|
||||
s += '\n### Description\n'
|
||||
s += f'{description}\n'
|
||||
|
||||
s += '\n[:arrow_up_small:](#)\n\n<br />\n'
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@
|
|||
|
||||
## [anim_spline_init](#anim_spline_init)
|
||||
|
||||
### Description
|
||||
Initializes a spline-based animation for the `MarioState` structure `m` using the provided array of 3D signed-integer vectors `keyFrames`. This sets up the animation so that it can be advanced by polling
|
||||
|
||||
### Lua Example
|
||||
`anim_spline_init(m, keyFrames)`
|
||||
|
||||
|
|
@ -28,15 +31,15 @@
|
|||
### C Prototype
|
||||
`void anim_spline_init(struct MarioState* m, Vec4s *keyFrames);`
|
||||
|
||||
### Description
|
||||
Initializes a spline-based animation for the `MarioState` structure `m` using the provided array of 3D signed-integer vectors `keyFrames`. This sets up the animation so that it can be advanced by polling
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [anim_spline_poll](#anim_spline_poll)
|
||||
|
||||
### Description
|
||||
Advances the spline-based animation associated with `m` and stores the current interpolated position in `result`. It returns the animation's status, allowing the caller to determine if the animation is ongoing or has completed
|
||||
|
||||
### Lua Example
|
||||
`local integerValue = anim_spline_poll(m, result)`
|
||||
|
||||
|
|
@ -52,15 +55,15 @@ Initializes a spline-based animation for the `MarioState` structure `m` using th
|
|||
### C Prototype
|
||||
`s32 anim_spline_poll(struct MarioState* m, Vec3f result);`
|
||||
|
||||
### Description
|
||||
Advances the spline-based animation associated with `m` and stores the current interpolated position in `result`. It returns the animation's status, allowing the caller to determine if the animation is ongoing or has completed
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [approach_f32](#approach_f32)
|
||||
|
||||
### Description
|
||||
Similar to `approach_s32`, but operates on floating-point numbers. It moves `current` toward `target` by increasing it by `inc` if below target, or decreasing it by `dec` if above target, creating a smooth interpolation
|
||||
|
||||
### Lua Example
|
||||
`local numberValue = approach_f32(current, target, inc, dec)`
|
||||
|
||||
|
|
@ -78,15 +81,15 @@ Advances the spline-based animation associated with `m` and stores the current i
|
|||
### C Prototype
|
||||
`f32 approach_f32(f32 current, f32 target, f32 inc, f32 dec);`
|
||||
|
||||
### Description
|
||||
Similar to `approach_s32`, but operates on floating-point numbers. It moves `current` toward `target` by increasing it by `inc` if below target, or decreasing it by `dec` if above target, creating a smooth interpolation
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [approach_s32](#approach_s32)
|
||||
|
||||
### Description
|
||||
Gradually moves an integer `current` value toward a `target` value, increasing it by `inc` if it is too low, or decreasing it by `dec` if it is too high. This is often used for smooth transitions or animations
|
||||
|
||||
### Lua Example
|
||||
`local integerValue = approach_s32(current, target, inc, dec)`
|
||||
|
||||
|
|
@ -104,15 +107,15 @@ Similar to `approach_s32`, but operates on floating-point numbers. It moves `cur
|
|||
### C Prototype
|
||||
`s32 approach_s32(s32 current, s32 target, s32 inc, s32 dec);`
|
||||
|
||||
### Description
|
||||
Gradually moves an integer `current` value toward a `target` value, increasing it by `inc` if it is too low, or decreasing it by `dec` if it is too high. This is often used for smooth transitions or animations
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [atan2s](#atan2s)
|
||||
|
||||
### Description
|
||||
Computes the arctangent of y/x and returns the angle as a signed 16-bit integer, typically representing a direction in the SM64 fixed-point angle format. This can be used to find an angle between x and y coordinates
|
||||
|
||||
### Lua Example
|
||||
`local integerValue = atan2s(y, x)`
|
||||
|
||||
|
|
@ -128,15 +131,15 @@ Gradually moves an integer `current` value toward a `target` value, increasing i
|
|||
### C Prototype
|
||||
`s16 atan2s(f32 y, f32 x);`
|
||||
|
||||
### Description
|
||||
Computes the arctangent of y/x and returns the angle as a signed 16-bit integer, typically representing a direction in the SM64 fixed-point angle format. This can be used to find an angle between x and y coordinates
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [coss](#coss)
|
||||
|
||||
### Description
|
||||
Calculates the cosine of the given angle, where the angle is specified as a signed 16-bit integer representing a fixed-point "SM64 angle". The function returns a floating-point value corresponding to cos(angle)
|
||||
|
||||
### Lua Example
|
||||
`local numberValue = coss(sm64Angle)`
|
||||
|
||||
|
|
@ -151,15 +154,15 @@ Computes the arctangent of y/x and returns the angle as a signed 16-bit integer,
|
|||
### C Prototype
|
||||
`f32 coss(s16 sm64Angle);`
|
||||
|
||||
### Description
|
||||
Calculates the cosine of the given angle, where the angle is specified as a signed 16-bit integer representing a fixed-point "SM64 angle". The function returns a floating-point value corresponding to cos(angle)
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [find_vector_perpendicular_to_plane](#find_vector_perpendicular_to_plane)
|
||||
|
||||
### Description
|
||||
Determines a vector that is perpendicular (normal) to the plane defined by three given 3D floating-point points `a`, `b`, and `c`. The resulting perpendicular vector is stored in `dest`
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = find_vector_perpendicular_to_plane(dest, a, b, c)`
|
||||
|
||||
|
|
@ -177,15 +180,15 @@ Calculates the cosine of the given angle, where the angle is specified as a sign
|
|||
### C Prototype
|
||||
`void *find_vector_perpendicular_to_plane(Vec3f dest, Vec3f a, Vec3f b, Vec3f c);`
|
||||
|
||||
### Description
|
||||
Determines a vector that is perpendicular (normal) to the plane defined by three given 3D floating-point points `a`, `b`, and `c`. The resulting perpendicular vector is stored in `dest`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [get_pos_from_transform_mtx](#get_pos_from_transform_mtx)
|
||||
|
||||
### Description
|
||||
Extracts the position (translation component) from the transformation matrix `objMtx` relative to the coordinate system defined by `camMtx` and stores that 3D position in `dest`. This can be used to get the object's coordinates in camera space
|
||||
|
||||
### Lua Example
|
||||
`get_pos_from_transform_mtx(dest, objMtx, camMtx)`
|
||||
|
||||
|
|
@ -202,15 +205,15 @@ Determines a vector that is perpendicular (normal) to the plane defined by three
|
|||
### C Prototype
|
||||
`void get_pos_from_transform_mtx(Vec3f dest, Mat4 objMtx, Mat4 camMtx);`
|
||||
|
||||
### Description
|
||||
Extracts the position (translation component) from the transformation matrix `objMtx` relative to the coordinate system defined by `camMtx` and stores that 3D position in `dest`. This can be used to get the object's coordinates in camera space
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_align_terrain_normal](#mtxf_align_terrain_normal)
|
||||
|
||||
### Description
|
||||
Aligns `dest` so that it fits the orientation of a terrain surface defined by its normal vector `upDir`. The transformation is positioned at `pos` and oriented with a given `yaw`. This is often used to make objects sit naturally on uneven ground
|
||||
|
||||
### Lua Example
|
||||
`mtxf_align_terrain_normal(dest, upDir, pos, yaw)`
|
||||
|
||||
|
|
@ -228,15 +231,15 @@ Extracts the position (translation component) from the transformation matrix `ob
|
|||
### C Prototype
|
||||
`void mtxf_align_terrain_normal(Mat4 dest, Vec3f upDir, Vec3f pos, s16 yaw);`
|
||||
|
||||
### Description
|
||||
Aligns `dest` so that it fits the orientation of a terrain surface defined by its normal vector `upDir`. The transformation is positioned at `pos` and oriented with a given `yaw`. This is often used to make objects sit naturally on uneven ground
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_align_terrain_triangle](#mtxf_align_terrain_triangle)
|
||||
|
||||
### Description
|
||||
Aligns `mtx` to fit onto a terrain triangle at `pos`, applying a given `yaw` and scaling by `radius`. This helps position objects so they match the orientation of the terrain's surface
|
||||
|
||||
### Lua Example
|
||||
`mtxf_align_terrain_triangle(mtx, pos, yaw, radius)`
|
||||
|
||||
|
|
@ -254,15 +257,15 @@ Aligns `dest` so that it fits the orientation of a terrain surface defined by it
|
|||
### C Prototype
|
||||
`void mtxf_align_terrain_triangle(Mat4 mtx, Vec3f pos, s16 yaw, f32 radius);`
|
||||
|
||||
### Description
|
||||
Aligns `mtx` to fit onto a terrain triangle at `pos`, applying a given `yaw` and scaling by `radius`. This helps position objects so they match the orientation of the terrain's surface
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_billboard](#mtxf_billboard)
|
||||
|
||||
### Description
|
||||
Transforms a 4x4 floating-point matrix `mtx` into a "billboard" oriented toward the camera or a given direction. The billboard is placed at `position` and rotated by `angle`. This is useful for objects that should always face the viewer
|
||||
|
||||
### Lua Example
|
||||
`mtxf_billboard(dest, mtx, position, angle)`
|
||||
|
||||
|
|
@ -280,15 +283,15 @@ Aligns `mtx` to fit onto a terrain triangle at `pos`, applying a given `yaw` and
|
|||
### C Prototype
|
||||
`void mtxf_billboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle);`
|
||||
|
||||
### Description
|
||||
Transforms a 4x4 floating-point matrix `mtx` into a "billboard" oriented toward the camera or a given direction. The billboard is placed at `position` and rotated by `angle`. This is useful for objects that should always face the viewer
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_copy](#mtxf_copy)
|
||||
|
||||
### Description
|
||||
Copies the 4x4 floating-point matrix `src` into `dest`. After this operation, `dest` contains the same matrix values as `src`
|
||||
|
||||
### Lua Example
|
||||
`mtxf_copy(dest, src)`
|
||||
|
||||
|
|
@ -304,15 +307,15 @@ Transforms a 4x4 floating-point matrix `mtx` into a "billboard" oriented toward
|
|||
### C Prototype
|
||||
`void mtxf_copy(Mat4 dest, Mat4 src);`
|
||||
|
||||
### Description
|
||||
Copies the 4x4 floating-point matrix `src` into `dest`. After this operation, `dest` contains the same matrix values as `src`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_cylboard](#mtxf_cylboard)
|
||||
|
||||
### Description
|
||||
Creates a "cylindrical billboard" transformation from the 4x4 matrix `mtx` placed at `position` with a given `angle`. Unlike a full billboard, this might allow rotation around one axis while still facing the viewer on others
|
||||
|
||||
### Lua Example
|
||||
`mtxf_cylboard(dest, mtx, position, angle)`
|
||||
|
||||
|
|
@ -330,15 +333,15 @@ Copies the 4x4 floating-point matrix `src` into `dest`. After this operation, `d
|
|||
### C Prototype
|
||||
`void mtxf_cylboard(Mat4 dest, Mat4 mtx, Vec3f position, s16 angle);`
|
||||
|
||||
### Description
|
||||
Creates a "cylindrical billboard" transformation from the 4x4 matrix `mtx` placed at `position` with a given `angle`. Unlike a full billboard, this might allow rotation around one axis while still facing the viewer on others
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_identity](#mtxf_identity)
|
||||
|
||||
### Description
|
||||
Sets the 4x4 floating-point matrix `mtx` to the identity matrix. The identity matrix leaves points unchanged when they are transformed by it which is useful for matrix math
|
||||
|
||||
### Lua Example
|
||||
`mtxf_identity(mtx)`
|
||||
|
||||
|
|
@ -353,15 +356,15 @@ Creates a "cylindrical billboard" transformation from the 4x4 matrix `mtx` place
|
|||
### C Prototype
|
||||
`void mtxf_identity(Mat4 mtx);`
|
||||
|
||||
### Description
|
||||
Sets the 4x4 floating-point matrix `mtx` to the identity matrix. The identity matrix leaves points unchanged when they are transformed by it which is useful for matrix math
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_inverse](#mtxf_inverse)
|
||||
|
||||
### Description
|
||||
Inverts the 4x4 floating-point matrix `src` and stores the inverse in `dest`. Applying the inverse transformation undoes whatever `src` did, returning points back to their original coordinate space
|
||||
|
||||
### Lua Example
|
||||
`mtxf_inverse(dest, src)`
|
||||
|
||||
|
|
@ -377,15 +380,15 @@ Sets the 4x4 floating-point matrix `mtx` to the identity matrix. The identity ma
|
|||
### C Prototype
|
||||
`void mtxf_inverse(Mat4 dest, Mat4 src);`
|
||||
|
||||
### Description
|
||||
Inverts the 4x4 floating-point matrix `src` and stores the inverse in `dest`. Applying the inverse transformation undoes whatever `src` did, returning points back to their original coordinate space
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_lookat](#mtxf_lookat)
|
||||
|
||||
### Description
|
||||
Adjusts the 4x4 floating-point matrix `mtx` so that it represents a viewing transformation looking from the point `from` toward the point `to`, with a given roll angle. This creates a view matrix oriented toward `to`
|
||||
|
||||
### Lua Example
|
||||
`mtxf_lookat(mtx, from, to, roll)`
|
||||
|
||||
|
|
@ -403,15 +406,15 @@ Inverts the 4x4 floating-point matrix `src` and stores the inverse in `dest`. Ap
|
|||
### C Prototype
|
||||
`void mtxf_lookat(Mat4 mtx, Vec3f from, Vec3f to, s16 roll);`
|
||||
|
||||
### Description
|
||||
Adjusts the 4x4 floating-point matrix `mtx` so that it represents a viewing transformation looking from the point `from` toward the point `to`, with a given roll angle. This creates a view matrix oriented toward `to`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_mul](#mtxf_mul)
|
||||
|
||||
### Description
|
||||
Multiplies two 4x4 floating-point matrices `a` and `b` (in that order), storing the product in `dest`. This can be used for combining multiple transformations into one
|
||||
|
||||
### Lua Example
|
||||
`mtxf_mul(dest, a, b)`
|
||||
|
||||
|
|
@ -428,15 +431,15 @@ Adjusts the 4x4 floating-point matrix `mtx` so that it represents a viewing tran
|
|||
### C Prototype
|
||||
`void mtxf_mul(Mat4 dest, Mat4 a, Mat4 b);`
|
||||
|
||||
### Description
|
||||
Multiplies two 4x4 floating-point matrices `a` and `b` (in that order), storing the product in `dest`. This can be used for combining multiple transformations into one
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_mul_vec3s](#mtxf_mul_vec3s)
|
||||
|
||||
### Description
|
||||
Multiplies the 4x4 floating-point matrix `mtx` by a 3D signed-integer vector `b`, potentially interpreting `b` as angles or translations depending on usage, and modifies `mtx` accordingly
|
||||
|
||||
### Lua Example
|
||||
`mtxf_mul_vec3s(mtx, b)`
|
||||
|
||||
|
|
@ -452,15 +455,15 @@ Multiplies two 4x4 floating-point matrices `a` and `b` (in that order), storing
|
|||
### C Prototype
|
||||
`void mtxf_mul_vec3s(Mat4 mtx, Vec3s b);`
|
||||
|
||||
### Description
|
||||
Multiplies the 4x4 floating-point matrix `mtx` by a 3D signed-integer vector `b`, potentially interpreting `b` as angles or translations depending on usage, and modifies `mtx` accordingly
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_rotate_xy](#mtxf_rotate_xy)
|
||||
|
||||
### Description
|
||||
Rotates the matrix `mtx` in the XY plane by the given `angle`. Rotating in the XY plane typically means pivoting around the Z axis
|
||||
|
||||
### Lua Example
|
||||
`mtxf_rotate_xy(mtx, angle)`
|
||||
|
||||
|
|
@ -476,15 +479,15 @@ Multiplies the 4x4 floating-point matrix `mtx` by a 3D signed-integer vector `b`
|
|||
### C Prototype
|
||||
`void mtxf_rotate_xy(Mtx *mtx, s16 angle);`
|
||||
|
||||
### Description
|
||||
Rotates the matrix `mtx` in the XY plane by the given `angle`. Rotating in the XY plane typically means pivoting around the Z axis
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_rotate_xyz_and_translate](#mtxf_rotate_xyz_and_translate)
|
||||
|
||||
### Description
|
||||
Rotates `dest` using angles in XYZ order, and then translates it by the 3D floating-point vector `b` and applies the rotations described by `c`. This sets up `dest` with a specific orientation and position in space
|
||||
|
||||
### Lua Example
|
||||
`mtxf_rotate_xyz_and_translate(dest, b, c)`
|
||||
|
||||
|
|
@ -501,15 +504,15 @@ Rotates the matrix `mtx` in the XY plane by the given `angle`. Rotating in the X
|
|||
### C Prototype
|
||||
`void mtxf_rotate_xyz_and_translate(Mat4 dest, Vec3f b, Vec3s c);`
|
||||
|
||||
### Description
|
||||
Rotates `dest` using angles in XYZ order, and then translates it by the 3D floating-point vector `b` and applies the rotations described by `c`. This sets up `dest` with a specific orientation and position in space
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_rotate_zxy_and_translate](#mtxf_rotate_zxy_and_translate)
|
||||
|
||||
### Description
|
||||
Rotates `dest` according to the angles in `rotate` using ZXY order, and then translates it by the 3D floating-point vector `translate`. This effectively positions and orients `dest` in 3D space
|
||||
|
||||
### Lua Example
|
||||
`mtxf_rotate_zxy_and_translate(dest, translate, rotate)`
|
||||
|
||||
|
|
@ -526,15 +529,15 @@ Rotates `dest` using angles in XYZ order, and then translates it by the 3D float
|
|||
### C Prototype
|
||||
`void mtxf_rotate_zxy_and_translate(Mat4 dest, Vec3f translate, Vec3s rotate);`
|
||||
|
||||
### Description
|
||||
Rotates `dest` according to the angles in `rotate` using ZXY order, and then translates it by the 3D floating-point vector `translate`. This effectively positions and orients `dest` in 3D space
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_scale_vec3f](#mtxf_scale_vec3f)
|
||||
|
||||
### Description
|
||||
Scales the 4x4 floating-point matrix `mtx` by the scaling factors found in the 3D floating-point vector `s`, and stores the result in `dest`. This enlarges or shrinks objects in 3D space
|
||||
|
||||
### Lua Example
|
||||
`mtxf_scale_vec3f(dest, mtx, s)`
|
||||
|
||||
|
|
@ -551,15 +554,15 @@ Rotates `dest` according to the angles in `rotate` using ZXY order, and then tra
|
|||
### C Prototype
|
||||
`void mtxf_scale_vec3f(Mat4 dest, Mat4 mtx, Vec3f s);`
|
||||
|
||||
### Description
|
||||
Scales the 4x4 floating-point matrix `mtx` by the scaling factors found in the 3D floating-point vector `s`, and stores the result in `dest`. This enlarges or shrinks objects in 3D space
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_to_mtx](#mtxf_to_mtx)
|
||||
|
||||
### Description
|
||||
Converts the floating-point matrix `src` into a fixed-point (integer-based) matrix suitable for the `Mtx` format, and stores the result in `dest`
|
||||
|
||||
### Lua Example
|
||||
`mtxf_to_mtx(dest, src)`
|
||||
|
||||
|
|
@ -575,15 +578,15 @@ Scales the 4x4 floating-point matrix `mtx` by the scaling factors found in the 3
|
|||
### C Prototype
|
||||
`void mtxf_to_mtx(Mtx *dest, Mat4 src);`
|
||||
|
||||
### Description
|
||||
Converts the floating-point matrix `src` into a fixed-point (integer-based) matrix suitable for the `Mtx` format, and stores the result in `dest`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [mtxf_translate](#mtxf_translate)
|
||||
|
||||
### Description
|
||||
Applies a translation to the 4x4 floating-point matrix `dest` by adding the coordinates in the 3D floating-point vector `b`. This shifts any transformed point by `b`
|
||||
|
||||
### Lua Example
|
||||
`mtxf_translate(dest, b)`
|
||||
|
||||
|
|
@ -599,15 +602,15 @@ Converts the floating-point matrix `src` into a fixed-point (integer-based) matr
|
|||
### C Prototype
|
||||
`void mtxf_translate(Mat4 dest, Vec3f b);`
|
||||
|
||||
### Description
|
||||
Applies a translation to the 4x4 floating-point matrix `dest` by adding the coordinates in the 3D floating-point vector `b`. This shifts any transformed point by `b`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [not_zero](#not_zero)
|
||||
|
||||
### Description
|
||||
Checks if `value` is zero. If not, it returns `value`. If it is zero, it returns the `replacement` value. This function ensures that a zero value can be substituted with a fallback value if needed
|
||||
|
||||
### Lua Example
|
||||
`local numberValue = not_zero(value, replacement)`
|
||||
|
||||
|
|
@ -623,15 +626,15 @@ Applies a translation to the 4x4 floating-point matrix `dest` by adding the coor
|
|||
### C Prototype
|
||||
`f32 not_zero(f32 value, f32 replacement);`
|
||||
|
||||
### Description
|
||||
Checks if `value` is zero. If not, it returns `value`. If it is zero, it returns the `replacement` value. This function ensures that a zero value can be substituted with a fallback value if needed
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [sins](#sins)
|
||||
|
||||
### Description
|
||||
Calculates the sine of the given angle, where the angle is specified as a signed 16-bit integer representing a fixed-point "SM64 angle". This function returns a floating-point result corresponding to sin(angle)
|
||||
|
||||
### Lua Example
|
||||
`local numberValue = sins(sm64Angle)`
|
||||
|
||||
|
|
@ -646,15 +649,15 @@ Checks if `value` is zero. If not, it returns `value`. If it is zero, it returns
|
|||
### C Prototype
|
||||
`f32 sins(s16 sm64Angle);`
|
||||
|
||||
### Description
|
||||
Calculates the sine of the given angle, where the angle is specified as a signed 16-bit integer representing a fixed-point "SM64 angle". This function returns a floating-point result corresponding to sin(angle)
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [spline_get_weights](#spline_get_weights)
|
||||
|
||||
### Description
|
||||
Computes spline interpolation weights for a given parameter `t` and stores these weights in `result`. This is used in spline-based animations to find intermediate positions between keyframes
|
||||
|
||||
### Lua Example
|
||||
`spline_get_weights(m, result, t, c)`
|
||||
|
||||
|
|
@ -672,15 +675,15 @@ Calculates the sine of the given angle, where the angle is specified as a signed
|
|||
### C Prototype
|
||||
`void spline_get_weights(struct MarioState* m, Vec4f result, f32 t, UNUSED s32 c);`
|
||||
|
||||
### Description
|
||||
Computes spline interpolation weights for a given parameter `t` and stores these weights in `result`. This is used in spline-based animations to find intermediate positions between keyframes
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_add](#vec3f_add)
|
||||
|
||||
### Description
|
||||
Adds the components of the 3D floating-point vector `a` to `dest`. After this operation, `dest.x` will be `dest.x + a.x`, and similarly for the y and z components
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3f_add(dest, a)`
|
||||
|
||||
|
|
@ -696,15 +699,15 @@ Computes spline interpolation weights for a given parameter `t` and stores these
|
|||
### C Prototype
|
||||
`void *vec3f_add(Vec3f dest, Vec3f a);`
|
||||
|
||||
### Description
|
||||
Adds the components of the 3D floating-point vector `a` to `dest`. After this operation, `dest.x` will be `dest.x + a.x`, and similarly for the y and z components
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_combine](#vec3f_combine)
|
||||
|
||||
### Description
|
||||
Takes two 3D floating-point vectors `vecA` and `vecB`, multiplies them by `sclA` and `sclB` respectively, and then adds the scaled vectors together. The final combined vector is stored in `dest`
|
||||
|
||||
### Lua Example
|
||||
`vec3f_combine(dest, vecA, vecB, sclA, sclB)`
|
||||
|
||||
|
|
@ -723,15 +726,15 @@ Adds the components of the 3D floating-point vector `a` to `dest`. After this op
|
|||
### C Prototype
|
||||
`void vec3f_combine(Vec3f dest, Vec3f vecA, Vec3f vecB, f32 sclA, f32 sclB);`
|
||||
|
||||
### Description
|
||||
Takes two 3D floating-point vectors `vecA` and `vecB`, multiplies them by `sclA` and `sclB` respectively, and then adds the scaled vectors together. The final combined vector is stored in `dest`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_copy](#vec3f_copy)
|
||||
|
||||
### Description
|
||||
Copies the contents of a 3D floating-point vector (`src`) into another 3D floating-point vector (`dest`). After this operation, `dest` will have the same x, y, and z values as `src`
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3f_copy(dest, src)`
|
||||
|
||||
|
|
@ -747,15 +750,15 @@ Takes two 3D floating-point vectors `vecA` and `vecB`, multiplies them by `sclA`
|
|||
### C Prototype
|
||||
`void *vec3f_copy(Vec3f dest, Vec3f src);`
|
||||
|
||||
### Description
|
||||
Copies the contents of a 3D floating-point vector (`src`) into another 3D floating-point vector (`dest`). After this operation, `dest` will have the same x, y, and z values as `src`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_cross](#vec3f_cross)
|
||||
|
||||
### Description
|
||||
Computes the cross product of two 3D floating-point vectors `a` and `b`. The cross product is a vector perpendicular to both `a` and `b`. The result is stored in `dest`
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3f_cross(dest, a, b)`
|
||||
|
||||
|
|
@ -772,15 +775,15 @@ Copies the contents of a 3D floating-point vector (`src`) into another 3D floati
|
|||
### C Prototype
|
||||
`void *vec3f_cross(Vec3f dest, Vec3f a, Vec3f b);`
|
||||
|
||||
### Description
|
||||
Computes the cross product of two 3D floating-point vectors `a` and `b`. The cross product is a vector perpendicular to both `a` and `b`. The result is stored in `dest`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_dif](#vec3f_dif)
|
||||
|
||||
### Description
|
||||
Subtracts the components of the 3D floating-point vector `b` from the components of `a` and stores the result in `dest`. For example, `dest.x = a.x - b.x` This results in a vector that represents the difference between `a` and `b`.
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3f_dif(dest, a, b)`
|
||||
|
||||
|
|
@ -797,15 +800,15 @@ Computes the cross product of two 3D floating-point vectors `a` and `b`. The cro
|
|||
### C Prototype
|
||||
`void *vec3f_dif(Vec3f dest, Vec3f a, Vec3f b);`
|
||||
|
||||
### Description
|
||||
Subtracts the components of the 3D floating-point vector `b` from the components of `a` and stores the result in `dest`. For example, `dest.x = a.x - b.x` This results in a vector that represents the difference between `a` and `b`.
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_dist](#vec3f_dist)
|
||||
|
||||
### Description
|
||||
Calculates the distance between two 3D floating-point points `v1` and `v2`. The distance is the length of the vector `v2 - v1`, i.e., sqrt((v2.x - v1.x)² + (v2.y - v1.y)² + (v2.z - v1.z)²)
|
||||
|
||||
### Lua Example
|
||||
`local numberValue = vec3f_dist(v1, v2)`
|
||||
|
||||
|
|
@ -821,15 +824,15 @@ Subtracts the components of the 3D floating-point vector `b` from the components
|
|||
### C Prototype
|
||||
`f32 vec3f_dist(Vec3f v1, Vec3f v2);`
|
||||
|
||||
### Description
|
||||
Calculates the distance between two 3D floating-point points `v1` and `v2`. The distance is the length of the vector `v2 - v1`, i.e., sqrt((v2.x - v1.x)² + (v2.y - v1.y)² + (v2.z - v1.z)²)
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_dot](#vec3f_dot)
|
||||
|
||||
### Description
|
||||
Computes the dot product of the two 3D floating-point vectors `a` and `b`. The dot product is a scalar value defined by (a.x * b.x + a.y * b.y + a.z * b.z), representing how aligned the two vectors are
|
||||
|
||||
### Lua Example
|
||||
`local numberValue = vec3f_dot(a, b)`
|
||||
|
||||
|
|
@ -845,15 +848,15 @@ Calculates the distance between two 3D floating-point points `v1` and `v2`. The
|
|||
### C Prototype
|
||||
`f32 vec3f_dot(Vec3f a, Vec3f b);`
|
||||
|
||||
### Description
|
||||
Computes the dot product of the two 3D floating-point vectors `a` and `b`. The dot product is a scalar value defined by (a.x * b.x + a.y * b.y + a.z * b.z), representing how aligned the two vectors are
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_get_dist_and_angle](#vec3f_get_dist_and_angle)
|
||||
|
||||
### Description
|
||||
Calculates the distance between two points in 3D space (`from` and `to`), as well as the pitch and yaw angles that describe the direction from `from` to `to`. The results are stored in `dist`, `pitch`, and `yaw`
|
||||
|
||||
### Lua Example
|
||||
`vec3f_get_dist_and_angle(from, to, dist, pitch, yaw)`
|
||||
|
||||
|
|
@ -872,15 +875,15 @@ Computes the dot product of the two 3D floating-point vectors `a` and `b`. The d
|
|||
### C Prototype
|
||||
`void vec3f_get_dist_and_angle(Vec3f from, Vec3f to, f32 *dist, s16 *pitch, s16 *yaw);`
|
||||
|
||||
### Description
|
||||
Calculates the distance between two points in 3D space (`from` and `to`), as well as the pitch and yaw angles that describe the direction from `from` to `to`. The results are stored in `dist`, `pitch`, and `yaw`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_length](#vec3f_length)
|
||||
|
||||
### Description
|
||||
Calculates the length (magnitude) of the 3D floating-point vector `a`. The length is defined as sqrt(x² + y² + z²) for the vector components (x, y, z)
|
||||
|
||||
### Lua Example
|
||||
`local numberValue = vec3f_length(a)`
|
||||
|
||||
|
|
@ -895,15 +898,15 @@ Calculates the distance between two points in 3D space (`from` and `to`), as wel
|
|||
### C Prototype
|
||||
`f32 vec3f_length(Vec3f a);`
|
||||
|
||||
### Description
|
||||
Calculates the length (magnitude) of the 3D floating-point vector `a`. The length is defined as sqrt(x² + y² + z²) for the vector components (x, y, z)
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_mul](#vec3f_mul)
|
||||
|
||||
### Description
|
||||
Multiplies each component of the 3D floating-point vector `dest` by the scalar value `a`. For instance, `dest.x = dest.x * a`, and similarly for y and z. This scales the vector `dest` by `a`
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3f_mul(dest, a)`
|
||||
|
||||
|
|
@ -919,15 +922,15 @@ Calculates the length (magnitude) of the 3D floating-point vector `a`. The lengt
|
|||
### C Prototype
|
||||
`void *vec3f_mul(Vec3f dest, f32 a);`
|
||||
|
||||
### Description
|
||||
Multiplies each component of the 3D floating-point vector `dest` by the scalar value `a`. For instance, `dest.x = dest.x * a`, and similarly for y and z. This scales the vector `dest` by `a`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_normalize](#vec3f_normalize)
|
||||
|
||||
### Description
|
||||
Normalizes the 3D floating-point vector `dest` so that its length (magnitude) becomes 1, while retaining its direction. This effectively scales `dest` so that it lies on the unit sphere
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3f_normalize(dest)`
|
||||
|
||||
|
|
@ -942,15 +945,15 @@ Multiplies each component of the 3D floating-point vector `dest` by the scalar v
|
|||
### C Prototype
|
||||
`void *vec3f_normalize(Vec3f dest);`
|
||||
|
||||
### Description
|
||||
Normalizes the 3D floating-point vector `dest` so that its length (magnitude) becomes 1, while retaining its direction. This effectively scales `dest` so that it lies on the unit sphere
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_project](#vec3f_project)
|
||||
|
||||
### Description
|
||||
Projects the 3D floating-point vector `vec` onto another 3D floating-point vector `onto`. The resulting projection, stored in `out`, represents how much of `vec` lies along the direction of `onto`
|
||||
|
||||
### Lua Example
|
||||
`vec3f_project(vec, onto, out)`
|
||||
|
||||
|
|
@ -967,15 +970,15 @@ Normalizes the 3D floating-point vector `dest` so that its length (magnitude) be
|
|||
### C Prototype
|
||||
`void vec3f_project(Vec3f vec, Vec3f onto, Vec3f out);`
|
||||
|
||||
### Description
|
||||
Projects the 3D floating-point vector `vec` onto another 3D floating-point vector `onto`. The resulting projection, stored in `out`, represents how much of `vec` lies along the direction of `onto`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_rotate_zxy](#vec3f_rotate_zxy)
|
||||
|
||||
### Description
|
||||
Rotates the 3D floating-point vector `v` by the angles specified in the 3D signed-integer vector `rotate`, applying the rotations in the order Z, then X, then Y. The rotated vector replaces `v`
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3f_rotate_zxy(v, rotate)`
|
||||
|
||||
|
|
@ -991,15 +994,15 @@ Projects the 3D floating-point vector `vec` onto another 3D floating-point vecto
|
|||
### C Prototype
|
||||
`void *vec3f_rotate_zxy(Vec3f v, Vec3s rotate);`
|
||||
|
||||
### Description
|
||||
Rotates the 3D floating-point vector `v` by the angles specified in the 3D signed-integer vector `rotate`, applying the rotations in the order Z, then X, then Y. The rotated vector replaces `v`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_set](#vec3f_set)
|
||||
|
||||
### Description
|
||||
Sets the values of the 3D floating-point vector `dest` to the given x, y, and z values. After this function, `dest` will have values (x, y, z)
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3f_set(dest, x, y, z)`
|
||||
|
||||
|
|
@ -1017,9 +1020,6 @@ Rotates the 3D floating-point vector `v` by the angles specified in the 3D signe
|
|||
### C Prototype
|
||||
`void *vec3f_set(Vec3f dest, f32 x, f32 y, f32 z);`
|
||||
|
||||
### Description
|
||||
Sets the values of the 3D floating-point vector `dest` to the given x, y, and z values. After this function, `dest` will have values (x, y, z)
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
|
@ -1050,6 +1050,9 @@ Sets the values of the 3D floating-point vector `dest` to the given x, y, and z
|
|||
|
||||
## [vec3f_sum](#vec3f_sum)
|
||||
|
||||
### Description
|
||||
Adds the corresponding components of two 3D floating-point vectors `a` and `b`, and stores the result in `dest`. For example, `dest.x = a.x + b.x`, `dest.y = a.y + b.y`, and `dest.z = a.z + b.z`
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3f_sum(dest, a, b)`
|
||||
|
||||
|
|
@ -1066,15 +1069,15 @@ Sets the values of the 3D floating-point vector `dest` to the given x, y, and z
|
|||
### C Prototype
|
||||
`void *vec3f_sum(Vec3f dest, Vec3f a, Vec3f b);`
|
||||
|
||||
### Description
|
||||
Adds the corresponding components of two 3D floating-point vectors `a` and `b`, and stores the result in `dest`. For example, `dest.x = a.x + b.x`, `dest.y = a.y + b.y`, and `dest.z = a.z + b.z`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3f_to_vec3s](#vec3f_to_vec3s)
|
||||
|
||||
### Description
|
||||
Converts a 3D floating-point vector `a` (Vec3f) into a 3D signed-integer vector and stores it in `dest`. After this operation, `dest` will contain the integer versions of `a`'s floating-point components
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3f_to_vec3s(dest, a)`
|
||||
|
||||
|
|
@ -1090,15 +1093,15 @@ Adds the corresponding components of two 3D floating-point vectors `a` and `b`,
|
|||
### C Prototype
|
||||
`void *vec3f_to_vec3s(Vec3s dest, Vec3f a);`
|
||||
|
||||
### Description
|
||||
Converts a 3D floating-point vector `a` (Vec3f) into a 3D signed-integer vector and stores it in `dest`. After this operation, `dest` will contain the integer versions of `a`'s floating-point components
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3s_add](#vec3s_add)
|
||||
|
||||
### Description
|
||||
Adds the components of a 3D signed-integer vector `a` to the corresponding components of `dest`. After this operation, each component of `dest` is increased by the corresponding component in `a`
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3s_add(dest, a)`
|
||||
|
||||
|
|
@ -1114,15 +1117,15 @@ Converts a 3D floating-point vector `a` (Vec3f) into a 3D signed-integer vector
|
|||
### C Prototype
|
||||
`void *vec3s_add(Vec3s dest, Vec3s a);`
|
||||
|
||||
### Description
|
||||
Adds the components of a 3D signed-integer vector `a` to the corresponding components of `dest`. After this operation, each component of `dest` is increased by the corresponding component in `a`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3s_copy](#vec3s_copy)
|
||||
|
||||
### Description
|
||||
Copies the components of one 3D signed-integer vector (`src`) to another (`dest`). After this function, `dest` will have the same x, y, and z integer values as `src`
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3s_copy(dest, src)`
|
||||
|
||||
|
|
@ -1138,15 +1141,15 @@ Adds the components of a 3D signed-integer vector `a` to the corresponding compo
|
|||
### C Prototype
|
||||
`void *vec3s_copy(Vec3s dest, Vec3s src);`
|
||||
|
||||
### Description
|
||||
Copies the components of one 3D signed-integer vector (`src`) to another (`dest`). After this function, `dest` will have the same x, y, and z integer values as `src`
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3s_set](#vec3s_set)
|
||||
|
||||
### Description
|
||||
Sets the 3D signed-integer vector `dest` to the specified integer values (x, y, z), so that `dest` becomes (x, y, z).
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3s_set(dest, x, y, z)`
|
||||
|
||||
|
|
@ -1164,15 +1167,15 @@ Copies the components of one 3D signed-integer vector (`src`) to another (`dest`
|
|||
### C Prototype
|
||||
`void *vec3s_set(Vec3s dest, s16 x, s16 y, s16 z);`
|
||||
|
||||
### Description
|
||||
Sets the 3D signed-integer vector `dest` to the specified integer values (x, y, z), so that `dest` becomes (x, y, z).
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3s_sum](#vec3s_sum)
|
||||
|
||||
### Description
|
||||
Adds the components of two 3D signed-integer vectors `a` and `b` together and stores the resulting vector in `dest`. For example, `dest.x = a.x + b.x`, and similarly for y and z
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3s_sum(dest, a, b)`
|
||||
|
||||
|
|
@ -1189,15 +1192,15 @@ Sets the 3D signed-integer vector `dest` to the specified integer values (x, y,
|
|||
### C Prototype
|
||||
`void *vec3s_sum(Vec3s dest, Vec3s a, Vec3s b);`
|
||||
|
||||
### Description
|
||||
Adds the components of two 3D signed-integer vectors `a` and `b` together and stores the resulting vector in `dest`. For example, `dest.x = a.x + b.x`, and similarly for y and z
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
||||
## [vec3s_to_vec3f](#vec3s_to_vec3f)
|
||||
|
||||
### Description
|
||||
Converts a 3D signed-integer vector `a` (vec3s) into a 3D floating-point vector and stores it in `dest`. After this operation, `dest` will contain the floating-point equivalents of `a`'s integer components
|
||||
|
||||
### Lua Example
|
||||
`local voidValue = vec3s_to_vec3f(dest, a)`
|
||||
|
||||
|
|
@ -1213,9 +1216,6 @@ Adds the components of two 3D signed-integer vectors `a` and `b` together and st
|
|||
### C Prototype
|
||||
`void *vec3s_to_vec3f(Vec3f dest, Vec3s a);`
|
||||
|
||||
### Description
|
||||
Converts a 3D signed-integer vector `a` (vec3s) into a 3D floating-point vector and stores it in `dest`. After this operation, `dest` will contain the floating-point equivalents of `a`'s integer components
|
||||
|
||||
[:arrow_up_small:](#)
|
||||
|
||||
<br />
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue