feat: attempt to implement math library
Adds many files, but the next thing is to implement the MeshRegistry properly.
This commit is contained in:
1 parent
9e4f531bd4
commit
e7659ba387
18 files changed
+1232
-136
No files matched your search
@@ -0,0 +1,29 @@
|
||||
use vulkano::buffer::BufferContents;
|
||||
use vulkano::pipeline::graphics::vertex_input::Vertex;
|
||||
use crate::common::instance::MeshInstance;
|
||||
|
||||
/// A transformation matrix for a mesh that can be passed into the shaders.
|
||||
#[derive(BufferContents, Vertex)]
|
||||
#[repr(C)]
|
||||
pub struct GpuInstance {
|
||||
#[format(R32G32B32A32_SFLOAT)]
|
||||
pub transform_col1: [f32; 4],
|
||||
#[format(R32G32B32A32_SFLOAT)]
|
||||
pub transform_col2: [f32; 4],
|
||||
#[format(R32G32B32A32_SFLOAT)]
|
||||
pub transform_col3: [f32; 4],
|
||||
#[format(R32G32B32A32_SFLOAT)]
|
||||
pub transform_col4: [f32; 4],
|
||||
}
|
||||
|
||||
impl Into<GpuInstance> for MeshInstance {
|
||||
fn into(self) -> GpuInstance {
|
||||
let m = self.transform_matrix();
|
||||
GpuInstance {
|
||||
transform_col1: m.column(0).into(),
|
||||
transform_col2: m.column(1).into(),
|
||||
transform_col3: m.column(2).into(),
|
||||
transform_col4: m.column(3).into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user