Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

Module transform

Module transform 

Source
Expand description

Composable 3D transform math operating on Mat3I16 / Vec3I16.

Lives next to the type definitions because the inherent impls belong in the same crate as the type. Higher-level GTE register access (write_data! / write_control! macros) lives in psx-gte, which re-exports this module so callers can keep importing it from there.

The PS1 has no hardware sin/cos – rotations use the shared psx_math::sincos::SIN_TABLE lookup. Angles are in 256-per-revolution units (u16 with implicit wrap at 256) rather than radians or degrees, matching the convention most PSX homebrew uses. A full turn fits in a single byte, which indexes every sixteenth entry of the SDK’s Q0.12 sine table.

Fixed-point conventions (inherited from the GTE):

  • Matrix cells: 1.3.12 signed – 0x1000 = 1.0.
  • Translation / screen offset / H: integers in engine-chosen scaling; the math here just passes them through.
  • Vectors: 1.3.12 i16; accumulator outputs are i32 in MAC or i16 in IR post-saturation.

Functions§

cos_1_3_12
Cosine of angle in 256-per-revolution units, returned in 1.3.12.
sin_1_3_12
Sine of angle in 256-per-revolution units, returned in 1.3.12.