From cdc51e0c4369d1ef38ff8d6cc9440b91b2c90535 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 20 Jun 2024 19:34:20 +0200 Subject: feat(engine): make the matrix struct public --- engine/src/data_types.rs | 3 +-- engine/src/data_types/matrix.rs | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'engine/src') diff --git a/engine/src/data_types.rs b/engine/src/data_types.rs index 5cf15e4..b35839a 100644 --- a/engine/src/data_types.rs +++ b/engine/src/data_types.rs @@ -1,5 +1,4 @@ pub mod color; pub mod dimens; +pub mod matrix; pub mod vector; - -pub(crate) mod matrix; diff --git a/engine/src/data_types/matrix.rs b/engine/src/data_types/matrix.rs index 85a3721..c5cc63a 100644 --- a/engine/src/data_types/matrix.rs +++ b/engine/src/data_types/matrix.rs @@ -1,7 +1,6 @@ use crate::vector::Vec3; #[derive(Debug, Clone)] -#[repr(C)] pub struct Matrix { /// Items must be layed out this way for it to work with OpenGL shaders. @@ -10,6 +9,8 @@ pub struct Matrix impl Matrix { + /// Creates a new `ROWS` * `COLUMNS` matrix. + #[must_use] pub fn new() -> Self where Value: Default + Copy, @@ -25,6 +26,7 @@ impl Matrix *const Value { @@ -32,6 +34,17 @@ impl Matrix Default + for Matrix +where + Value: Copy + Default, +{ + fn default() -> Self + { + Self::new() + } +} + impl Matrix { /// Creates a new identity matrix. -- cgit v1.2.3-18-g5258