Mario Kart 64
Loading...
Searching...
No Matches
math_util.c File Reference
#include <ultra64.h>
#include <mk64.h>
#include <macros.h>
#include <math_util.h>
#include <main.h>
#include "buffers.h"
#include <PR/rcp.h>
#include "buffers/trig_tables.h"
#include "math.h"
#include "memory.h"
Include dependency graph for math_util.c:

Functions

UNUSED s32 func_802B4F60 (UNUSED s32 arg0, Vec3f arg1, UNUSED s32 arg2, UNUSED f32 arg3, UNUSED f32 arg4)
 
UNUSED void func_802B4FF0 ()
 
s32 render_set_position (Mat4 mtx, s32 mode)
 
f32 dist_squared_bugged (Vec3f from, Vec3f to)
 
s32 get_xz_angle_between_points (Vec3f pointFrom, Vec3f pointTo)
 
UNUSED u32 func_802B5258 (Vec3f arg0, Vec3s arg1)
 
void vec3f_set (Vec3f dest, f32 coordX, f32 coordY, f32 coordZ)
 
void vec3s_set (Vec3s dest, s16 coordX, s16 coordY, s16 coordZ)
 
void * vec3f_copy_return (Vec3f dest, Vec3f src)
 
void vec3s_copy (Vec3s dest, Vec3s src)
 
UNUSED void * vec3f_set_return (Vec3f dest, f32 x, f32 y, f32 z)
 
void mtxf_copy (Mat4 src, Mat4 dest)
 
void mtxf_copy_n_element (s32 *dest, s32 *src, s32 n)
 
void mtxf_identity (Mat4 mtx)
 
void add_translate_mat4_vec3f (Mat4 src, Mat4 dest, Vec3f translate)
 
UNUSED void add_translate_mat4_vec3f_lite (Mat4 mat, Mat4 dest, Vec3f pos)
 
void mtxf_translate (Mat4 dest, Vec3f translate)
 
void mtxf_projection (Mat4 projMtx, u16 *arg1, f32 vertFov, f32 aspectRatio, f32 near, f32 far, f32 homogeneousScale)
 
void mtxf_lookat (Mat4 mtx, Vec3f from, Vec3f to)
 Create a lookat matrix (convert to coordinates relative to camera)
 
void mtxf_rotate_x (Mat4 mtx, s16 angle)
 
void mtxf_rotate_y (Mat4 mtx, s16 angle)
 
void mtxf_s16_rotate_z (Mat4 mtx, s16 angle)
 
UNUSED void func_802B5B14 (Vec3f b, Vec3s rotate)
 
void vec_unit_z_rotX_rotY (s16 rotY, s16 rotX, Vec3f arg2)
 
UNUSED void func_802B5D30 (s16 arg0, s16 arg1, s32 arg2)
 
void set_course_lighting (Lights1 *lightAddr, s16 rotateAngleY, s16 rotateAngleX, s32 lightCount)
 
void mtxf_scale (Mat4 mtx, f32 coef)
 
void mtxf_rotate_zxy_translate (Mat4 dest, Vec3f translate, Vec3s orientation)
 
UNUSED void func_802B60B4 (Mat4 arg0, Vec3s arg1, Vec3s arg2)
 
UNUSED void func_802B6214 (Mat4 arg0, Vec3s arg1, Vec3s arg2)
 
UNUSED void func_802B6374 (Vec3f arg0)
 
void mtxf_transform_vec3f_mat3 (Vec3f vec, Mat3 mtx)
 
void mtxf_transform_vec3f_mat4 (Vec3f vec, Mat4 mat)
 
UNUSED void func_802B64B0 (UNUSED s32 arg0, UNUSED s32 arg1, UNUSED s32 arg2, UNUSED s32 arg3)
 
void vec3f_rotate_y (Vec3f vec, s16 rotAngleY)
 
void calculate_orientation_matrix (Mat3 dest, f32 axisZ, f32 cosAxisY, f32 axisX, s16 rotationAngle)
 
UNUSED void func_802B68F8 (Mat3 matrix, f32 arg1, f32 arg2, f32 arg3)
 
void calculate_rotation_matrix (Mat3 destMatrix, s16 rotationAngle, f32 axisX, f32 axisY, f32 axisZ)
 
UNUSED void func_802B6BC0 (Mat4 arg0, s16 arg1, f32 arg2, f32 arg3, f32 arg4)
 
UNUSED void func_802B6D58 (Mat4 arg0, Vec3f arg1, Vec3f arg2)
 
void mtxf_multiplication (Mat4 dest, Mat4 mtxLeft, Mat4 mtxRight)
 Multiply two 4x4 matrices.
 
void mtxf_to_mtx (Mtx *dest, Mat4 src)
 
u16 atan2_lookup (f32 y, f32 x)
 
u16 atan2s (f32 y, f32 x)
 
f32 atan2f (f32 y, f32 x)
 
UNUSED f32 func_802B79F0 (f32 arg0, f32 arg1)
 
UNUSED u16 func_802B7B50 (f32 arg0, f32 arg1)
 
UNUSED void func_802B7C18 (f32 arg0)
 
s16 atan1s (f32 tan)
 
UNUSED void func_802B7C6C (f32 arg0)
 
s16 asin1s (f32 value)
 
f32 acos1f (f32 value)
 
UNUSED s16 func_802B7D28 (f32 arg0)
 
u16 random_u16 (void)
 
u16 random_int (u16 arg0)
 
s16 get_angle_between_coords (f32 fromY, f32 fromX, f32 toY, f32 toX)
 
void planar_angles (Vec3f from, Vec3f to, Vec3s rotAngles)
 
f32 sins (u16 angle)
 
f32 coss (u16 angle)
 
s32 is_between_angle (u16 angleCCW, u16 angleCW, u16 angleToCheck)
 
f32 distance_if_visible (Vec3f cameraPos, Vec3f objectPos, u16 orientationY, f32 preloadDistanceSquared, f32 fovDegrees, f32 maxDistanceSquared)
 
UNUSED void func_802B8414 (uintptr_t addr, Mat4 arg1, s16 arg2, s16 arg3, s32 arg4)
 
UNUSED void func_802B8614 (Player *arg0)
 

Variables

UNUSED s32 D_802B91C0 [2] = { 13, 13 }
 
Vec3f D_802B91C8 = { 0.0f, 0.0f, 0.0f }
 

Function Documentation

◆ acos1f()

f32 acos1f ( f32 value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_translate_mat4_vec3f()

void add_translate_mat4_vec3f ( Mat4 src,
Mat4 dest,
Vec3f translate )
Here is the caller graph for this function:

◆ add_translate_mat4_vec3f_lite()

UNUSED void add_translate_mat4_vec3f_lite ( Mat4 mat,
Mat4 dest,
Vec3f pos )

◆ asin1s()

s16 asin1s ( f32 value)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atan1s()

s16 atan1s ( f32 tan)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atan2_lookup()

u16 atan2_lookup ( f32 y,
f32 x )
Here is the caller graph for this function:

◆ atan2f()

f32 atan2f ( f32 y,
f32 x )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ atan2s()

u16 atan2s ( f32 y,
f32 x )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculate_orientation_matrix()

void calculate_orientation_matrix ( Mat3 dest,
f32 axisZ,
f32 cosAxisY,
f32 axisX,
s16 rotationAngle )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ calculate_rotation_matrix()

void calculate_rotation_matrix ( Mat3 destMatrix,
s16 rotationAngle,
f32 axisX,
f32 axisY,
f32 axisZ )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ coss()

f32 coss ( u16 angle)

◆ dist_squared_bugged()

f32 dist_squared_bugged ( Vec3f from,
Vec3f to )
Here is the caller graph for this function:

◆ distance_if_visible()

f32 distance_if_visible ( Vec3f cameraPos,
Vec3f objectPos,
u16 orientationY,
f32 preloadDistanceSquared,
f32 fovDegrees,
f32 maxDistanceSquared )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ func_802B4F60()

UNUSED s32 func_802B4F60 ( UNUSED s32 arg0,
Vec3f arg1,
UNUSED s32 arg2,
UNUSED f32 arg3,
UNUSED f32 arg4 )
Here is the call graph for this function:

◆ func_802B4FF0()

UNUSED void func_802B4FF0 ( )

◆ func_802B5258()

UNUSED u32 func_802B5258 ( Vec3f arg0,
Vec3s arg1 )
Here is the call graph for this function:

◆ func_802B5B14()

UNUSED void func_802B5B14 ( Vec3f b,
Vec3s rotate )
Here is the call graph for this function:

◆ func_802B5D30()

UNUSED void func_802B5D30 ( s16 arg0,
s16 arg1,
s32 arg2 )
Here is the call graph for this function:

◆ func_802B60B4()

UNUSED void func_802B60B4 ( Mat4 arg0,
Vec3s arg1,
Vec3s arg2 )
Here is the call graph for this function:

◆ func_802B6214()

UNUSED void func_802B6214 ( Mat4 arg0,
Vec3s arg1,
Vec3s arg2 )
Here is the call graph for this function:

◆ func_802B6374()

UNUSED void func_802B6374 ( Vec3f arg0)
Here is the call graph for this function:

◆ func_802B64B0()

UNUSED void func_802B64B0 ( UNUSED s32 arg0,
UNUSED s32 arg1,
UNUSED s32 arg2,
UNUSED s32 arg3 )

◆ func_802B68F8()

UNUSED void func_802B68F8 ( Mat3 matrix,
f32 arg1,
f32 arg2,
f32 arg3 )
Here is the call graph for this function:

◆ func_802B6BC0()

UNUSED void func_802B6BC0 ( Mat4 arg0,
s16 arg1,
f32 arg2,
f32 arg3,
f32 arg4 )
Here is the call graph for this function:

◆ func_802B6D58()

UNUSED void func_802B6D58 ( Mat4 arg0,
Vec3f arg1,
Vec3f arg2 )
Here is the call graph for this function:

◆ func_802B79F0()

UNUSED f32 func_802B79F0 ( f32 arg0,
f32 arg1 )
Here is the call graph for this function:

◆ func_802B7B50()

UNUSED u16 func_802B7B50 ( f32 arg0,
f32 arg1 )
Here is the call graph for this function:

◆ func_802B7C18()

UNUSED void func_802B7C18 ( f32 arg0)
Here is the call graph for this function:

◆ func_802B7C6C()

UNUSED void func_802B7C6C ( f32 arg0)
Here is the call graph for this function:

◆ func_802B7D28()

UNUSED s16 func_802B7D28 ( f32 arg0)
Here is the call graph for this function:

◆ func_802B8414()

UNUSED void func_802B8414 ( uintptr_t addr,
Mat4 arg1,
s16 arg2,
s16 arg3,
s32 arg4 )
Here is the call graph for this function:

◆ func_802B8614()

UNUSED void func_802B8614 ( Player * arg0)
Here is the call graph for this function:

◆ get_angle_between_coords()

s16 get_angle_between_coords ( f32 fromY,
f32 fromX,
f32 toY,
f32 toX )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_xz_angle_between_points()

s32 get_xz_angle_between_points ( Vec3f pointFrom,
Vec3f pointTo )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_between_angle()

s32 is_between_angle ( u16 angleCCW,
u16 angleCW,
u16 angleToCheck )
Here is the caller graph for this function:

◆ mtxf_copy()

void mtxf_copy ( Mat4 src,
Mat4 dest )

◆ mtxf_copy_n_element()

void mtxf_copy_n_element ( s32 * dest,
s32 * src,
s32 n )
Here is the caller graph for this function:

◆ mtxf_identity()

void mtxf_identity ( Mat4 mtx)
Here is the caller graph for this function:

◆ mtxf_lookat()

void mtxf_lookat ( Mat4 mtx,
Vec3f from,
Vec3f to )

Create a lookat matrix (convert to coordinates relative to camera)

Parameters
mtxDummy matrix overwritten with lookat matrix
fromWhere the camera is looking from
toWhere the camera is looking to
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mtxf_multiplication()

void mtxf_multiplication ( Mat4 dest,
Mat4 mtxLeft,
Mat4 mtxRight )

Multiply two 4x4 matrices.

Parameters
destResult of multiplication is saved here
mtxLeftLeft matrix in product
mtxRightRight matrix to product
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mtxf_projection()

void mtxf_projection ( Mat4 projMtx,
u16 * arg1,
f32 vertFov,
f32 aspectRatio,
f32 near,
f32 far,
f32 homogeneousScale )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mtxf_rotate_x()

void mtxf_rotate_x ( Mat4 mtx,
s16 angle )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mtxf_rotate_y()

void mtxf_rotate_y ( Mat4 mtx,
s16 angle )
Here is the call graph for this function:

◆ mtxf_rotate_zxy_translate()

void mtxf_rotate_zxy_translate ( Mat4 dest,
Vec3f translate,
Vec3s orientation )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mtxf_s16_rotate_z()

void mtxf_s16_rotate_z ( Mat4 mtx,
s16 angle )
Here is the call graph for this function:

◆ mtxf_scale()

void mtxf_scale ( Mat4 mtx,
f32 coef )
Here is the caller graph for this function:

◆ mtxf_to_mtx()

void mtxf_to_mtx ( Mtx * dest,
Mat4 src )

Convert float matrix 'src' to fixed point matrix 'dest'. The float matrix may not contain entries larger than 65536 or the console crashes. The fixed point matrix has entries with a 16-bit integer part, so the floating point numbers are multiplied by 2^16 before being cast to a s32 integer. If this doesn't fit, the N64 and iQue consoles will throw an exception. On Wii and Wii U Virtual Console the value will simply be clamped and no crashes occur.

float-to-integer conversion responsible for PU crashes

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mtxf_transform_vec3f_mat3()

void mtxf_transform_vec3f_mat3 ( Vec3f vec,
Mat3 mtx )
Here is the caller graph for this function:

◆ mtxf_transform_vec3f_mat4()

void mtxf_transform_vec3f_mat4 ( Vec3f vec,
Mat4 mat )
Here is the caller graph for this function:

◆ mtxf_translate()

void mtxf_translate ( Mat4 dest,
Vec3f translate )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ planar_angles()

void planar_angles ( Vec3f from,
Vec3f to,
Vec3s rotAngles )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ random_int()

u16 random_int ( u16 arg0)
Here is the call graph for this function:

◆ random_u16()

u16 random_u16 ( void )
Here is the caller graph for this function:

◆ render_set_position()

s32 render_set_position ( Mat4 mtx,
s32 mode )

Inserts matrix into the rsp. Position, rotation and mode of where to render the next object and check number of object already render Note that gMatrixObjectCount gets reset at the beginning of the game loop. So no cleanup needs to be performed.

Here is the call graph for this function:

◆ set_course_lighting()

void set_course_lighting ( Lights1 * lightAddr,
s16 rotateAngleY,
s16 rotateAngleX,
s32 lightCount )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sins()

f32 sins ( u16 angle)

◆ vec3f_copy_return()

void * vec3f_copy_return ( Vec3f dest,
Vec3f src )
Warning
function returns address of local variable
Here is the caller graph for this function:

◆ vec3f_rotate_y()

void vec3f_rotate_y ( Vec3f vec,
s16 rotAngleY )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vec3f_set()

void vec3f_set ( Vec3f dest,
f32 coordX,
f32 coordY,
f32 coordZ )
Here is the caller graph for this function:

◆ vec3f_set_return()

UNUSED void * vec3f_set_return ( Vec3f dest,
f32 x,
f32 y,
f32 z )

◆ vec3s_copy()

void vec3s_copy ( Vec3s dest,
Vec3s src )
Here is the caller graph for this function:

◆ vec3s_set()

void vec3s_set ( Vec3s dest,
s16 coordX,
s16 coordY,
s16 coordZ )
Here is the caller graph for this function:

◆ vec_unit_z_rotX_rotY()

void vec_unit_z_rotX_rotY ( s16 rotY,
s16 rotX,
Vec3f arg2 )
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ D_802B91C0

UNUSED s32 D_802B91C0[2] = { 13, 13 }

◆ D_802B91C8

Vec3f D_802B91C8 = { 0.0f, 0.0f, 0.0f }