From 219c4383e175af263141613afb9563120b2da3f3 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 21 Apr 2024 15:46:36 +0200 Subject: refactor(engine): make Transform fields public --- engine/src/transform.rs | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) (limited to 'engine') diff --git a/engine/src/transform.rs b/engine/src/transform.rs index f55f44e..ad67d4c 100644 --- a/engine/src/transform.rs +++ b/engine/src/transform.rs @@ -6,37 +6,12 @@ use crate::vector::Vec3; #[derive(Debug, Clone, Component)] pub struct Transform { - position: Vec3, - scale: Vec3, + pub position: Vec3, + pub scale: Vec3, } impl Transform { - #[must_use] - pub fn new() -> Self - { - Self { - position: Vec3::default(), - scale: Vec3 { x: 1.0, y: 1.0, z: 1.0 }, - } - } - - #[must_use] - pub fn position(&self) -> &Vec3 - { - &self.position - } - - pub fn set_position(&mut self, position: Vec3) - { - self.position = position; - } - - pub fn set_scale(&mut self, scale: Vec3) - { - self.scale = scale; - } - pub(crate) fn as_matrix(&self) -> Matrix { let mut matrix = Matrix::new_identity(); @@ -53,6 +28,9 @@ impl Default for Transform { fn default() -> Self { - Self::new() + Self { + position: Vec3::default(), + scale: Vec3 { x: 1.0, y: 1.0, z: 1.0 }, + } } } -- cgit v1.2.3-18-g5258