use crate::render3d::math::{Mat4, Quat, Vec3};
#[derive(Debug, Clone, Copy)]
pub struct Transform {
pub position: Vec3,
pub rotation: Quat,
pub scale: Vec3,
}
impl Default for Transform {
fn default() -> Self {
Self {
position: Vec3::ZERO,
rotation: Quat::IDENTITY,
scale: Vec3::ONE,
}
}
}
impl Transform {
pub fn from_position(position: Vec3) -> Self {
Self {
position,
..Default::default()
}
}
pub fn matrix(&self) -> Mat4 {
Mat4::from_scale_rotation_translation(self.scale, self.rotation, self.position)
}
}