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