use cgmath::{Euler, Matrix4, Rad, SquareMatrix, Vector3, Zero};
#[derive(Debug)]
pub struct ModelData {
pub position: Vector3<f32>,
pub rotation: Euler<Rad<f32>>,
pub scale: f32,
pub groups: Vec<ModelDataGroup>,
}
impl Default for ModelData {
fn default() -> ModelData {
Self {
position: Vector3::zero(),
rotation: Euler::new(Rad(0.0), Rad(0.0), Rad(0.0)),
scale: 1.0,
groups: Vec::new(),
}
}
}
impl ModelData {
pub(crate) fn matrix(&self) -> Matrix4<f32> {
Matrix4::from_translation(self.position)
* Matrix4::from(self.rotation)
* Matrix4::from_scale(self.scale)
}
}
#[derive(Debug, Clone)]
pub struct ModelDataGroup {
pub matrix: Matrix4<f32>,
}
impl Default for ModelDataGroup {
fn default() -> Self {
Self {
matrix: Matrix4::identity(),
}
}
}