use crate::matrix::Matrix; use crate::vector::Vec3; #[derive(Debug, Clone)] pub struct Transform { translation: Vec3, scaling: Vec3, } impl Transform { pub fn new() -> Self { Self { translation: Vec3::default(), scaling: Vec3 { x: 1.0, y: 1.0, z: 1.0, }, } } pub fn set_translation(&mut self, translation: Vec3) { self.translation = translation; } pub fn set_scaling(&mut self, scaling: Vec3) { self.scaling = scaling; } pub fn as_matrix(&self) -> Matrix { let mut matrix = Matrix::new_identity(); matrix.translate(&self.translation); matrix.scale(&self.scaling); matrix } }