#[repr(C)]pub struct Mat3I16 {
pub m: [[i16; 3]; 3],
}Expand description
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).
Fields§
§m: [[i16; 3]; 3]Row-major 3×3 cells.
Implementations§
Source§impl Mat3I16
impl Mat3I16
Sourcepub fn mul(&self, other: &Self) -> Self
pub fn mul(&self, other: &Self) -> Self
Matrix × matrix, with 1.3.12 fixed-point scaling applied so the
output stays in 1.3.12. Saturates each cell to i16 range –
rotation compositions stay well within, but callers doing
scale-by-100 before compose should watch for truncation.
Sourcepub fn rotate_xyz(x: u16, y: u16, z: u16) -> Self
pub fn rotate_xyz(x: u16, y: u16, z: u16) -> Self
Compose X, then Y, then Z rotations using the PS1 matrix convention.
Angles use the same 256-per-revolution units as Self::rotate_x.
The explicit order matters for camera/model transforms with more than
one non-zero Euler component.
Sourcepub fn scale_rows_q12(&self, scale: [i32; 3]) -> Self
pub fn scale_rows_q12(&self, scale: [i32; 3]) -> Self
Scale matrix rows by independent Q12 factors.
This matches the classic PS1 ScaleMatrixL convention: row 0 receives
X, row 1 receives Y, and row 2 receives Z. Results saturate like the
GTE IR registers instead of wrapping at i16 boundaries.
Sourcepub fn scale_columns_q12(&self, scale: [i32; 3]) -> Self
pub fn scale_columns_q12(&self, scale: [i32; 3]) -> Self
Scale matrix columns by independent Q12 factors.
This matches the classic PS1 ScaleMatrix convention: column 0
receives X, column 1 receives Y, and column 2 receives Z.
Sourcepub fn transform(&self, v: Vec3I16) -> [i32; 3]
pub fn transform(&self, v: Vec3I16) -> [i32; 3]
Matrix × vector, with 1.3.12 scaling. Returns i32 per
component so the caller can inspect the un-saturated product
(useful for normal generation / light calculations before
feeding back into the GTE as V0).
Sourcepub fn transform_i32(&self, v: [i32; 3]) -> [i32; 3]
pub fn transform_i32(&self, v: [i32; 3]) -> [i32; 3]
Matrix times a wide vector, using wrapping i32 dot products followed by an arithmetic Q12 shift. Inputs should keep each dot product in i32 when a non-wrapping result is required.
Sourcepub fn rotate_x_q12(angle: u16) -> Self
pub fn rotate_x_q12(angle: u16) -> Self
X rotation in 4096-per-turn units, with interpolated Q12 trig.
Sourcepub fn rotate_y_q12(angle: u16) -> Self
pub fn rotate_y_q12(angle: u16) -> Self
Y rotation in 4096-per-turn units, with interpolated Q12 trig.
Sourcepub const fn rotate_x(angle: u16) -> Self
pub const fn rotate_x(angle: u16) -> Self
Rotation around the X axis by angle (256-per-revolution units).
| 1 0 0 |
| 0 cos -sin |
| 0 sin cos |Trait Implementations§
impl Copy for Mat3I16
impl Eq for Mat3I16
impl StructuralPartialEq for Mat3I16
Auto Trait Implementations§
impl Freeze for Mat3I16
impl RefUnwindSafe for Mat3I16
impl Send for Mat3I16
impl Sync for Mat3I16
impl Unpin for Mat3I16
impl UnsafeUnpin for Mat3I16
impl UnwindSafe for Mat3I16
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)