use crate::matrix::Matrix; use crate::vector::Vec3; #[derive(Debug, Clone)] pub struct Transform { position: Vec3, scale: Vec3, } impl Transform { pub fn new() -> Self { Self { position: Vec3::default(), scale: Vec3 { x: 1.0, y: 1.0, z: 1.0 }, } } 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 fn as_matrix(&self) -> Matrix { let mut matrix = Matrix::new_identity(); matrix.translate(&self.position); matrix.scale(&self.scale); matrix } }