KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
Matrices

SH4-optimized matrix and linear algebra routines More...

Files

file  matrix.h
 Basic matrix operations.
 
file  matrix3d.h
 3D matrix operations.
 
file  vec3f.h
 Basic matrix operations.
 
file  vector.h
 Primitive matrix, vector, and point types.
 

Data Structures

struct  vec3f_t
 3D floating-point vector More...
 
struct  vector_t
 4-part vector type. More...
 

Macros

#define mat_trans_single(x, y, z)
 Macro to transform a single vertex by the internal matrix.
 
#define mat_trans_single4(x, y, z, w)
 Macro to transform a single vertex by the internal matrix.
 
#define mat_trans_single3(x, y, z)
 Macro to transform a single vertex by the internal matrix.
 
#define mat_trans_nodiv(x, y, z, w)
 Macro to transform a single vertex by the internal matrix with no perspective division.
 
#define mat_trans_single3_nodiv(x, y, z)
 Macro to transform a single 3d vertex coordinate by the internal matrix with no perspective division.
 
#define mat_trans_single3_nomod(x, y, z, x2, y2, z2)
 Macro to transform a single 3d vertex coordinate by the internal matrix with perspective division.
 
#define mat_trans_single3_nodiv_nomod(x, y, z, x2, y2, z2)
 Macro to transform a single 3d vertex coordinate by the internal matrix.
 
#define mat_trans_single3_nodivw(x, y, z, w)
 Macro to transform a single 3d vertex coordinate by the internal matrix.
 
#define mat_trans_single3_nodiv_div(x, y, z, xd, yd, zd)
 Macro to transform a single 3d vertex coordinate by the internal matrix both with and without perspective division.
 
#define mat_trans_normal3(x, y, z)
 Macro to transform a single vertex normal by the internal matrix.
 
#define mat_trans_normal3_nomod(x, y, z, x2, y2, z2)
 Macro to transform a single vertex normal by the internal matrix.
 

Typedefs

typedef float matrix_t[4][4]
 Basic 4x4 matrix type.
 
typedef vector_t point_t
 4-part point type (alias to the vector_t type).
 

Functions

void mat_store (matrix_t *out)
 Copy the internal matrix to a memory one.
 
void mat_load (const matrix_t *src)
 Copy a memory matrix into the internal one.
 
void mat_identity (void)
 Clear the internal matrix to identity.
 
void mat_apply (const matrix_t *src)
 Apply a matrix.
 
void mat_transform (const vector_t *invecs, vector_t *outvecs, int veccnt, int stride)
 Transform vectors by the internal matrix.
 
void mat_transform_sq (void *input, void *output, int veccnt)
 Transform vectors by the internal matrix into the store queues.
 
void mat_rotate_x (float r)
 Rotate around the X-axis.
 
void mat_rotate_y (float r)
 Rotate around the Y-axis.
 
void mat_rotate_z (float r)
 Rotate around the Z-axis.
 
void mat_rotate (float xr, float yr, float zr)
 Rotate around all axes.
 
void mat_translate (float x, float y, float z)
 Perform a 3D translation.
 
void mat_scale (float x, float y, float z)
 Perform a 3D scale operation.
 
void mat_perspective (float xcenter, float ycenter, float cot_fovy_2, float znear, float zfar)
 Set up a perspective view frustum.
 
void mat_lookat (const point_t *eye, const point_t *center, const vector_t *up)
 Set up a "camera".
 
static float vec_fipr (vec3f_t vec)
 
static float vec_dot (vec3f_t vec1, vec3f_t vec2)
 Function to return the scalar dot product of two 3d vectors.
 
static float vec_length (vec3f_t vec)
 Macro to return scalar Euclidean length of a 3d vector.
 
static float vec_distance (vec3f_t vec1, vec3f_t vec2)
 Function to return the Euclidean distance between two 3d vectors.
 
static vec3f_t vec_normalize (vec3f_t vec)
 Function to return the normalized version of a vector.
 
static vec3f_t vec_sub_normalize (vec3f_t vec1, vec3f_t vec2)
 Function to return the normalized version of a vector minus another vector.
 
static vec3f_t vec_rotr_xy (vec3f_t vec, vec3f_t origin, float angle)
 Macro to rotate a vector about its origin on the x, y plane.
 
static vec3f_t vec_rotr_xz (vec3f_t vec, vec3f_t origin, float angle)
 Macro to rotate a vector about its origin on the x, z plane.
 
static vec3f_t vec_rotr_yz (vec3f_t vec, vec3f_t origin, float angle)
 Macro to rotate a vector about its origin on the y, z plane.
 
static vec3f_t vec_rotd_xy (vec3f_t vec, vec3f_t origin, float angle)
 Macro to rotate a vector about its origin on the x, y plane.
 
static vec3f_t vec_rotd_xz (vec3f_t vec, vec3f_t origin, float angle)
 Macro to rotate a vector about its origin on the x, z plane.
 
static vec3f_t vec_rotd_yz (vec3f_t vec, vec3f_t origin, float angle)
 Macro to rotate a vector about its origin on the y, z plane.
 

Detailed Description

SH4-optimized matrix and linear algebra routines

Macro Definition Documentation

◆ mat_trans_nodiv

#define mat_trans_nodiv ( x,
y,
z,
w )
Value:
{ \
register float __x __asm__("fr0") = (x); \
register float __y __asm__("fr1") = (y); \
register float __z __asm__("fr2") = (z); \
register float __w __asm__("fr3") = (w); \
__asm__ __volatile__( \
"ftrv xmtrx,fv0\n" \
: "=f" (__x), "=f" (__y), "=f" (__z), "=f" (__w) \
: "0" (__x), "1" (__y), "2" (__z), "3" (__w) ); \
x = __x; y = __y; z = __z; w = __w; \
}

Macro to transform a single vertex by the internal matrix with no perspective division.

This macro is an inline assembly operation to transform a single vertex. It works most efficiently if the x value is in fr0, y is in fr1, z is in fr2, and w is in fr3 before using the macro. This macro is similar to mat_trans_single(), but this one does not do any perspective division.

Parameters
xThe X coordinate to transform.
yThe Y coordinate to transform.
zThe Z coordinate to transform.
wThe W coordinate to transform.

◆ mat_trans_normal3

#define mat_trans_normal3 ( x,
y,
z )
Value:
{ \
register float __x __asm__("fr8") = (x); \
register float __y __asm__("fr9") = (y); \
register float __z __asm__("fr10") = (z); \
__asm__ __volatile__( \
"fldi0 fr11\n" \
"ftrv xmtrx, fv8\n" \
: "=f" (__x), "=f" (__y), "=f" (__z) \
: "0" (__x), "1" (__y), "2" (__z) \
: "fr11" ); \
x = __x; y = __y; z = __z; \
}

Macro to transform a single vertex normal by the internal matrix.

This macro is an inline assembly operation to transform a 3 float vertex normal. It works most efficiently if the x value is in fr8, y is in fr9, and z is in fr10 before using the macro. This macro is similar to mat_trans_nodiv(), but this one sets the W component to 0 in order to transform a vertex normal, rather than 1 for a vertex position.

Parameters
xThe X normal to transform.
yThe Y normal to transform.
zThe Z normal to transform.

◆ mat_trans_normal3_nomod

#define mat_trans_normal3_nomod ( x,
y,
z,
x2,
y2,
z2 )
Value:
{ \
register float __x __asm__("fr8") = (x); \
register float __y __asm__("fr9") = (y); \
register float __z __asm__("fr10") = (z); \
__asm__ __volatile__( \
"fldi0 fr11\n" \
"ftrv xmtrx, fv8\n" \
: "=f" (__x), "=f" (__y), "=f" (__z) \
: "0" (__x), "1" (__y), "2" (__z) \
: "fr11" ); \
x2 = __x; y2 = __y; z2 = __z; \
}

Macro to transform a single vertex normal by the internal matrix.

This macro is an inline assembly operation to transform a 3 float vertex normal. It works most efficiently if the x value is in fr8, y is in fr9, and z is in fr10 before using the macro. This macro is similar to mat_trans_normal3(), but this one does not modify the input operands, instead storing the transformed vector to the output operands.

Parameters
xThe X normal to input transform.
yThe Y normal to input transform.
zThe Z normal to input transform.
x2The X normal to output transform.
y2The Y normal to output transform.
z2The Z normal to output transform.

◆ mat_trans_single

#define mat_trans_single ( x,
y,
z )
Value:
{ \
register float __x __asm__("fr0") = (x); \
register float __y __asm__("fr1") = (y); \
register float __z __asm__("fr2") = (z); \
__asm__ __volatile__( \
"fldi1 fr3\n" \
"ftrv xmtrx,fv0\n" \
"fldi1 fr2\n" \
"fdiv fr3,fr2\n" \
"fmul fr2,fr0\n" \
"fmul fr2,fr1\n" \
: "=f" (__x), "=f" (__y), "=f" (__z) \
: "0" (__x), "1" (__y), "2" (__z) \
: "fr3" ); \
x = __x; y = __y; z = __z; \
}

Macro to transform a single vertex by the internal matrix.

This macro is an inline assembly operation to transform a single vertex. It works most efficiently if the x value is in fr0, y is in fr1, and z is in fr2 before using the macro.

Parameters
xThe X coordinate to transform.
yThe Y coordinate to transform.
zThe Z coordinate to transform.

◆ mat_trans_single3

#define mat_trans_single3 ( x,
y,
z )
Value:
{ \
register float __x __asm__("fr0") = (x); \
register float __y __asm__("fr1") = (y); \
register float __z __asm__("fr2") = (z); \
__asm__ __volatile__( \
"fldi1 fr3\n" \
"ftrv xmtrx,fv0\n" \
"fdiv fr3,fr0\n" \
"fdiv fr3,fr1\n" \
"fdiv fr3,fr2\n" \
: "=f" (__x), "=f" (__y), "=f" (__z) \
: "0" (__x), "1" (__y), "2" (__z) \
: "fr3" ); \
x = __x; y = __y; z = __z; \
}

Macro to transform a single vertex by the internal matrix.

This macro is an inline assembly operation to transform a single vertex. It works most efficiently if the x value is in fr0, y is in fr1, and z is in fr2 before using the macro. This macro is similar to mat_trans_single(), but this one leaves z/w instead of 1/w for the z component.

Parameters
xThe X coordinate to transform.
yThe Y coordinate to transform.
zThe Z coordinate to transform.

◆ mat_trans_single3_nodiv

#define mat_trans_single3_nodiv ( x,
y,
z )
Value:
{ \
register float __x __asm__("fr12") = (x); \
register float __y __asm__("fr13") = (y); \
register float __z __asm__("fr14") = (z); \
__asm__ __volatile__( \
"fldi1 fr15\n" \
"ftrv xmtrx, fv12\n" \
: "=f" (__x), "=f" (__y), "=f" (__z) \
: "0" (__x), "1" (__y), "2" (__z) \
: "fr15" ); \
x = __x; y = __y; z = __z; \
}

Macro to transform a single 3d vertex coordinate by the internal matrix with no perspective division.

This macro is an inline assembly operation to transform a 3 float vertex coordinate. It works most efficiently if the x value is in fr12, y is in fr13, and z is in fr14 before using the macro. This macro is similar to mat_trans_nodiv(), but this one sets the W component to 1 for use with a 3d vector.

Parameters
xThe X coordinate to transform.
yThe Y coordinate to transform.
zThe Z coordinate to transform.

◆ mat_trans_single3_nodiv_div

#define mat_trans_single3_nodiv_div ( x,
y,
z,
xd,
yd,
zd )
Value:
{ \
register float __x __asm__("fr0") = (x); \
register float __y __asm__("fr1") = (y); \
register float __z __asm__("fr2") = (z); \
register float __xd __asm__("fr4"); \
register float __yd __asm__("fr5"); \
register float __zd __asm__("fr6"); \
__asm__ __volatile__( \
"fldi1 fr3\n" \
"ftrv xmtrx, fv0\n" \
"fmov fr0, fr4\n" \
"fmov fr1, fr5\n" \
"fmov fr3, fr7\n" \
"fldi1 fr6\n" \
"fdiv fr7, fr6\n" \
"fmul fr6, fr4\n" \
"fmul fr6, fr5\n" \
: "=f" (__x), "=f" (__y), "=f" (__z), \
"=f" (__xd), "=f" (__yd), "=f" (__zd) \
: "0" (__x), "1" (__y), "2" (__z) \
: "fr3" ); \
x = __x; y = __y; z = __z; xd = __xd; yd = __yd; zd = __zd; \
}

Macro to transform a single 3d vertex coordinate by the internal matrix both with and without perspective division.

This macro is an inline assembly operation to transform a 3 float vertex coordinate. It works most efficiently if the x value is in fr0, y is in fr1, and z is in fr2 before using the macro. This macro is similar to mat_trans_single(), but this one is used for transforming input vertex with and without perspective division.

Parameters
xThe X coordinate to transform without perspective divide.
yThe Y coordinate to transform without perspective divide.
zThe Z coordinate to transform without perspective divide.
xdThe X coordinate to output transform with perspective divide.
ydThe Y coordinate to output transform with perspective divide.
zdThe Z coordinate to output transform with perspective divide.

◆ mat_trans_single3_nodiv_nomod

#define mat_trans_single3_nodiv_nomod ( x,
y,
z,
x2,
y2,
z2 )
Value:
{ \
register float __x __asm__("fr12") = (x); \
register float __y __asm__("fr13") = (y); \
register float __z __asm__("fr14") = (z); \
__asm__ __volatile__( \
"fldi1 fr15\n" \
"ftrv xmtrx, fv12\n" \
: "=f" (__x), "=f" (__y), "=f" (__z) \
: "0" (__x), "1" (__y), "2" (__z) \
: "fr15" ); \
x2 = __x; y2 = __y; z2 = __z; \
}

Macro to transform a single 3d vertex coordinate by the internal matrix.

This macro is an inline assembly operation to transform a 3 float vertex coordinate. It works most efficiently if the x value is in fr12, y is in fr13, and z is in fr14 before using the macro. This macro is similar to mat_trans_single3_nodiv(), but this one does not modify the input operands, instead storing the transformed vector to the output operands.

Parameters
xThe X coordinate to input transform.
yThe Y coordinate to input transform.
zThe Z coordinate to input transform.
x2The X coordinate to output transform.
y2The Y coordinate to output transform.
z2The Z coordinate to output transform.

◆ mat_trans_single3_nodivw

#define mat_trans_single3_nodivw ( x,
y,
z,
w )
Value:
{ \
register float __x __asm__("fr12") = (x); \
register float __y __asm__("fr13") = (y); \
register float __z __asm__("fr14") = (z); \
register float __w __asm__("fr15") = 1.0f; \
__asm__ __volatile__( \
"ftrv xmtrx, fv12\n" \
: "=f" (__x), "=f" (__y), "=f" (__z), "=f" (__w) \
: "0" (__x), "1" (__y), "2" (__z), "3" (__w) ); \
x = __x; y = __y; z = __z; w = __w; \
}

Macro to transform a single 3d vertex coordinate by the internal matrix.

This macro is an inline assembly operation to transform a 3 float vertex coordinate. It works most efficiently if the x value is in fr12, y is in fr13, and z is in fr14 before using the macro. This macro is similar to mat_trans_single3_nodiv(), but this one stores the W component of transform for later perspective divide.

Parameters
xThe X coordinate to transform.
yThe Y coordinate to transform.
zThe Z coordinate to transform.
wThe W coordinate output of transform.

◆ mat_trans_single3_nomod

#define mat_trans_single3_nomod ( x,
y,
z,
x2,
y2,
z2 )
Value:
{ \
register float __x __asm__("fr12") = (x); \
register float __y __asm__("fr13") = (y); \
register float __z __asm__("fr14") = (z); \
__asm__ __volatile__( \
"fldi1 fr15\n" \
"ftrv xmtrx, fv12\n" \
"fldi1 fr14\n" \
"fdiv fr15, fr14\n" \
"fmul fr14, fr12\n" \
"fmul fr14, fr13\n" \
: "=f" (__x), "=f" (__y), "=f" (__z) \
: "0" (__x), "1" (__y), "2" (__z) \
: "fr15" ); \
x2 = __x; y2 = __y; z2 = __z; \
}

Macro to transform a single 3d vertex coordinate by the internal matrix with perspective division.

This macro is an inline assembly operation to transform a 3 float vertex coordinate. It works most efficiently if the x value is in fr12, y is in fr13, and z is in fr14 before using the macro. This macro is similar to mat_trans_single(), but this one does not modify the input operands, instead storing the transformed vector to the output operands.

Parameters
xThe X coordinate to input transform.
yThe Y coordinate to input transform.
zThe Z coordinate to input transform.
x2The X coordinate to output transform.
y2The Y coordinate to output transform.
z2The Z coordinate to output transform.

◆ mat_trans_single4

#define mat_trans_single4 ( x,
y,
z,
w )
Value:
{ \
register float __x __asm__("fr0") = (x); \
register float __y __asm__("fr1") = (y); \
register float __z __asm__("fr2") = (z); \
register float __w __asm__("fr3") = (w); \
__asm__ __volatile__( \
"ftrv xmtrx,fv0\n" \
"fdiv fr3,fr0\n" \
"fdiv fr3,fr1\n" \
"fdiv fr3,fr2\n" \
"fldi1 fr4\n" \
"fdiv fr3,fr4\n" \
"fmov fr4,fr3\n" \
: "=f" (__x), "=f" (__y), "=f" (__z), "=f" (__w) \
: "0" (__x), "1" (__y), "2" (__z), "3" (__w) \
: "fr4" ); \
x = __x; y = __y; z = __z; w = __w; \
}

Macro to transform a single vertex by the internal matrix.

This macro is an inline assembly operation to transform a single vertex. It works most efficiently if the x value is in fr0, y is in fr1, z is in fr2, and w is in fr3 before using the macro. This macro is similar to mat_trans_single(), but this one allows an input to and preserves the Z/W value.

Parameters
xThe X coordinate to transform.
yThe Y coordinate to transform.
zThe Z coordinate to transform.
wThe W coordinate to transform.

Typedef Documentation

◆ matrix_t

typedef float matrix_t[4][4]

Basic 4x4 matrix type.

Warning
This type must always be allocated on 8-byte boundaries, or else the API operating on it will crash on unaligned accesses. Keep this in mind with heap allocation, where you must ensure alignment manually.

◆ point_t

typedef vector_t point_t

4-part point type (alias to the vector_t type).

Function Documentation

◆ mat_apply()

void mat_apply ( const matrix_t * src)

Apply a matrix.

This function multiplies a matrix in memory onto the internal matrix.

Warning
src MUST be at least 8-byte aligned!
Note
For best performance, 32-byte alignment of src is recommended.
Parameters
srcA pointer to the matrix to multiply.

◆ mat_identity()

void mat_identity ( void )

Clear the internal matrix to identity.

This function clears the internal matrix to a standard identity matrix.

◆ mat_load()

void mat_load ( const matrix_t * src)

Copy a memory matrix into the internal one.

This function loads the internal matrix with the values of one in memory.

Warning
out MUST be at least 8-byte aligned!
Note
For best performance, 32-byte alignment of out is recommended.
Parameters
srcA pointer to where to load the matrix from (must be at least 8-byte aligned, should be 32-byte aligned).

◆ mat_lookat()

void mat_lookat ( const point_t * eye,
const point_t * center,
const vector_t * up )

Set up a "camera".

This function acts as the similarly named GL function to set up a "camera" by doing rotations/translations.

Parameters
eyeThe eye coordinate.
centerThe center coordinate.
upThe up vector.

◆ mat_perspective()

void mat_perspective ( float xcenter,
float ycenter,
float cot_fovy_2,
float znear,
float zfar )

Set up a perspective view frustum.

This function sets up a perspective view frustum for basic 3D usage.

Parameters
xcenterCenter of the X direction.
ycenterCenter of the Y direction.
cot_fovy_21.0 / tan(view_angle / 2).
znearNear Z-plane.
zfarFar Z-plane.

◆ mat_rotate()

void mat_rotate ( float xr,
float yr,
float zr )

Rotate around all axes.

This function sets up a rotation matrix around the X-axis, then around the Y, then around the Z.

Parameters
xrThe angle to rotate around the X-axis, in radians.
yrThe angle to rotate around the Y-axis, in radians.
zrThe angle to rotate around the Z-axis, in radians.

◆ mat_rotate_x()

void mat_rotate_x ( float r)

Rotate around the X-axis.

This function sets up a rotation matrix around the X-axis.

Parameters
rThe angle to rotate, in radians.

◆ mat_rotate_y()

void mat_rotate_y ( float r)

Rotate around the Y-axis.

This function sets up a rotation matrix around the Y-axis.

Parameters
rThe angle to rotate, in radians.

◆ mat_rotate_z()

void mat_rotate_z ( float r)

Rotate around the Z-axis.

This function sets up a rotation matrix around the Z-axis.

Parameters
rThe angle to rotate, in radians.

◆ mat_scale()

void mat_scale ( float x,
float y,
float z )

Perform a 3D scale operation.

This function sets up a scaling matrix with the specified parameters.

Parameters
xThe ratio to scale in X.
yThe ratio to scale in Y.
zThe ratio to scale in Z.

◆ mat_store()

void mat_store ( matrix_t * out)

Copy the internal matrix to a memory one.

This function stores the current internal matrix to one in memory.

Warning
out MUST be at least 8-byte aligned!
Note
For best performance, 32-byte alignment of out is recommended.
Parameters
outA pointer to where to store the matrix (must be at least 8-byte aligned, should be 32-byte aligned).

◆ mat_transform()

void mat_transform ( const vector_t * invecs,
vector_t * outvecs,
int veccnt,
int stride )

Transform vectors by the internal matrix.

This function transforms zero or more sets of vectors by the current internal matrix. Each vector is 3 single-precision floats long.

Parameters
invecsThe list of input vectors.
outvecsThe list of output vectors.
veccntHow many vectors are in the list.
strideNumber of bytes between vectors.

◆ mat_transform_sq()

void mat_transform_sq ( void * input,
void * output,
int veccnt )

Transform vectors by the internal matrix into the store queues.

This function transforms one or more sets of vertices using the current internal matrix directly into the store queues. Each vertex is exactly 32-bytes long, and the non-xyz data that is with it will be copied over with the transformed coordinates. This is perfect, for instance, for transforming pvr_vertex_t vertices.

Note
sq_lock() must have been called beforehand
Parameters
inputThe list of input vertices.
outputThe output pointer (SQ address)
veccntThe number of vertices to transform.
Author
Jim Ursetto

◆ mat_translate()

void mat_translate ( float x,
float y,
float z )

Perform a 3D translation.

This function sets up a translation matrix with the specified parameters.

Parameters
xThe amount to translate in X.
yThe amount to translate in Y.
zThe amount to translate in Z.

◆ vec_distance()

static float vec_distance ( vec3f_t vec1,
vec3f_t vec2 )
inlinestatic

Function to return the Euclidean distance between two 3d vectors.

This macro is an inline assembly operation using the SH4's fast (approximate) math instructions, and returns a single-precision floating-point value.

Parameters
vec1The first vector.
vec2The second vector.
Returns
The result of the calculation.

References vec_length(), vec3f_t::x, vec3f_t::y, and vec3f_t::z.

◆ vec_dot()

static float vec_dot ( vec3f_t vec1,
vec3f_t vec2 )
inlinestatic

Function to return the scalar dot product of two 3d vectors.

This macro is an inline assembly operation using the SH4's fast (approximate) math instructions, and returns a single-precision floating-point value.

Parameters
vec1The first vector.
vec2The second vector.
Returns
The result of the calculation.

References fipr(), vec3f_t::x, vec3f_t::y, and vec3f_t::z.

◆ vec_fipr()

static float vec_fipr ( vec3f_t vec)
inlinestatic

◆ vec_length()

static float vec_length ( vec3f_t vec)
inlinestatic

Macro to return scalar Euclidean length of a 3d vector.

This macro is an inline assembly operation using the SH4's fast (approximate) math instructions, and returns a single-precision floating-point value.

Parameters
vecThe vector.
Returns
The result of the calculation.

References vec_fipr().

Referenced by vec_distance(), and vec_normalize().

◆ vec_normalize()

static vec3f_t vec_normalize ( vec3f_t vec)
inlinestatic

Function to return the normalized version of a vector.

This macro is an inline assembly operation using the SH4's fast (approximate) math instructions to calculate a vector that is in the same direction as the input vector but with a Euclidean length of one.

Parameters
vecThe source vector.
Returns
The normalized vector.

References vec_length(), vec3f_t::x, vec3f_t::y, and vec3f_t::z.

Referenced by vec_sub_normalize().

◆ vec_rotd_xy()

static vec3f_t vec_rotd_xy ( vec3f_t vec,
vec3f_t origin,
float angle )
inlinestatic

Macro to rotate a vector about its origin on the x, y plane.

This macro is an inline assembly operation using the SH4's fast (approximate) math instructions.

Parameters
vecThe source vector.
originThe origin vector.
angleThe angle (in degrees) of rotation.

References vec_rotr_xy().

◆ vec_rotd_xz()

static vec3f_t vec_rotd_xz ( vec3f_t vec,
vec3f_t origin,
float angle )
inlinestatic

Macro to rotate a vector about its origin on the x, z plane.

This macro is an inline assembly operation using the SH4's fast (approximate) math instructions.

Parameters
vecThe source vector.
originThe origin vector.
angleThe angle (in degrees) of rotation.

References vec_rotr_xz().

◆ vec_rotd_yz()

static vec3f_t vec_rotd_yz ( vec3f_t vec,
vec3f_t origin,
float angle )
inlinestatic

Macro to rotate a vector about its origin on the y, z plane.

This macro is an inline assembly operation using the SH4's fast (approximate) math instructions.

Parameters
vecThe source vector.
originThe origin vector.
angleThe angle (in degrees) of rotation.

References vec_rotr_yz().

◆ vec_rotr_xy()

static vec3f_t vec_rotr_xy ( vec3f_t vec,
vec3f_t origin,
float angle )
inlinestatic

Macro to rotate a vector about its origin on the x, y plane.

This macro is an inline assembly operation using the SH4's fast (approximate) math instructions.

Parameters
vecThe source vector.
originThe origin vector.
angleThe angle (in radians) of rotation.

References vec3f_t::x, vec3f_t::y, and vec3f_t::z.

Referenced by vec_rotd_xy().

◆ vec_rotr_xz()

static vec3f_t vec_rotr_xz ( vec3f_t vec,
vec3f_t origin,
float angle )
inlinestatic

Macro to rotate a vector about its origin on the x, z plane.

This macro is an inline assembly operation using the SH4's fast (approximate) math instructions.

Parameters
vecThe source vector.
originThe origin vector.
angleThe angle (in radians) of rotation.

References vec3f_t::x, vec3f_t::y, and vec3f_t::z.

Referenced by vec_rotd_xz().

◆ vec_rotr_yz()

static vec3f_t vec_rotr_yz ( vec3f_t vec,
vec3f_t origin,
float angle )
inlinestatic

Macro to rotate a vector about its origin on the y, z plane.

This macro is an inline assembly operation using the SH4's fast (approximate) math instructions.

Parameters
vecThe source vector.
originThe origin vector.
angleThe angle (in radians) of rotation.

References vec3f_t::x, vec3f_t::y, and vec3f_t::z.

Referenced by vec_rotd_yz().

◆ vec_sub_normalize()

static vec3f_t vec_sub_normalize ( vec3f_t vec1,
vec3f_t vec2 )
inlinestatic

Function to return the normalized version of a vector minus another vector.

This macro is an inline assembly operation using the SH4's fast (approximate) math instructions.

Parameters
vec1The first vector.
vec2The second vector.
Returns
The normalized vector.

References vec_normalize(), vec3f_t::x, vec3f_t::y, and vec3f_t::z.