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

Module math

Module math 

Source
Expand description

Fixed-point math types for GTE inputs/outputs.

The PS1 GTE works in two flavours of fixed point:

  • 1.3.12 for matrix entries, normals, small vectors – 16-bit signed, divide by 4096 for real value. Range: roughly ±8.0 with 12 bits of fraction.
  • 19.12 / 31.0 for translations, colour bias, far colour – 32-bit signed stored raw.

Types here are POD (Copy, no_std, no heap). The GTE register wire format is always a packed u32, so the types mainly exist for static correctness – the actual register I/O happens through the write_data! / write_control! macros in psx-gte.

Structs§

Mat3I16
3×3 rotation / light matrix of i16 in 1.3.12. Laid out row-major so m[row][col] matches PSX-SPX notation (M_rc).
Vec3I16
3-component vector of i16 in 1.3.12 fixed point. Matches the GTE’s V0/V1/V2 input slots and the IR accumulators.
Vec3I32
3-component vector of i32 – used for translation / colour bias / far colour values (stored raw in 31.0 or 19.12 depending on which register, see the GTE spec).