use crate::{TyQuaternion, TyVector3};
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct TyTransform<T> {
pub position: TyVector3<T>,
pub rotation: TyQuaternion<T>,
pub scale: TyVector3<T>,
}
impl<T> TyTransform<T> {
pub fn new(position: TyVector3<T>, rotation: TyQuaternion<T>, scale: TyVector3<T>) -> Self {
Self {
position,
rotation,
scale,
}
}
}
macro_rules! impl_ty_transform_float {
($t:ty) => {
impl Default for TyTransform<$t> {
fn default() -> Self {
Self {
position: TyVector3::new(0.0, 0.0, 0.0),
rotation: TyQuaternion::<$t>::identity(),
scale: TyVector3::new(1.0, 1.0, 1.0),
}
}
}
};
}
impl_ty_transform_float!(f32);
impl_ty_transform_float!(f64);