Struct ssbh_lib::Matrix4x4 [−][src]
pub struct Matrix4x4 { pub row1: Vector4, pub row2: Vector4, pub row3: Vector4, pub row4: Vector4, }
Expand description
A row-major 4x4 matrix of contiguous floats.
Fields
row1: Vector4
row2: Vector4
row3: Vector4
row4: Vector4
Implementations
The identity transformation matrix.
use ssbh_lib::{Vector4, Matrix4x4}; let m = Matrix4x4::identity(); assert_eq!(Vector4::new(1f32, 0f32, 0f32, 0f32), m.row1); assert_eq!(Vector4::new(0f32, 1f32, 0f32, 0f32), m.row2); assert_eq!(Vector4::new(0f32, 0f32, 1f32, 0f32), m.row3); assert_eq!(Vector4::new(0f32, 0f32, 0f32, 1f32), m.row4);
Converts the elements to a 2d array in row-major order.
use ssbh_lib::{Vector4, Matrix4x4}; let m = Matrix4x4 { row1: Vector4::new(1f32, 2f32, 3f32, 4f32), row2: Vector4::new(5f32, 6f32, 7f32, 8f32), row3: Vector4::new(9f32, 10f32, 11f32, 12f32), row4: Vector4::new(13f32, 14f32, 15f32, 16f32), }; assert_eq!( [ [1f32, 2f32, 3f32, 4f32], [5f32, 6f32, 7f32, 8f32], [9f32, 10f32, 11f32, 12f32], [13f32, 14f32, 15f32, 16f32], ], m.to_rows_array(), );
Creates the matrix from a 2d array in row-major order.
let elements = [ [1f32, 2f32, 3f32, 4f32], [5f32, 6f32, 7f32, 8f32], [9f32, 10f32, 11f32, 12f32], [13f32, 14f32, 15f32, 16f32], ]; let m = Matrix4x4::from_rows_array(&elements); assert_eq!(elements, m.to_rows_array());
Trait Implementations
The type of arguments needed to be supplied in order to read this type, usually a tuple. Read more
fn read_options<R: Read + Seek>(
__binread_generated_var_reader: &mut R,
__binread_generated_var_options: &ReadOptions,
__binread_generated_var_arguments: Self::Args
) -> BinResult<Self>
[src]
fn read_options<R: Read + Seek>(
__binread_generated_var_reader: &mut R,
__binread_generated_var_options: &ReadOptions,
__binread_generated_var_arguments: Self::Args
) -> BinResult<Self>
[src]Read the type from the reader
Read the type from the reader while assuming no arguments have been passed Read more
Read the type from the reader using the specified arguments
fn after_parse<R>(
&mut self,
&mut R,
&ReadOptions,
Self::Args
) -> Result<(), Error> where
R: Read + Seek,
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]Deserialize this value from the given Serde deserializer. Read more
Writes the byte representation of self
to writer
and update data_ptr
as needed to ensure the next relative offset is correctly calculated.
The offset in bytes between successive elements in an array of this type. This should include any alignment or padding. For most types, this is simply the value of std::mem::size_of. Read more
The alignment of the relative_offset for types stored in a RelPtr64.
Auto Trait Implementations
impl RefUnwindSafe for Matrix4x4
impl UnwindSafe for Matrix4x4