use bytemuck::{Pod, Zeroable};
#[repr(C)]
#[derive(Debug, Clone, Copy, Zeroable, Pod)]
pub struct Uniforms {
transform: [f32; 16],
scale: f32,
_padding: [f32; 3],
}
impl Uniforms {
pub fn new(transformation: [f32; 16], scale: f32) -> Uniforms {
Self {
transform: transformation,
scale,
_padding: [0.0; 3],
}
}
}
impl Default for Uniforms {
fn default() -> Self {
let identity_matrix: [f32; 16] = [
1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0,
1.0,
];
Self {
transform: identity_matrix,
scale: 1.0,
_padding: [0.0; 3],
}
}
}