You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.4 KiB
64 lines
1.4 KiB
9 months ago
|
use memoffset::offset_of;
|
||
|
use ash::vk;
|
||
|
|
||
|
#[repr(C)]
|
||
|
#[derive(Clone, Debug, Copy)]
|
||
|
pub struct Particle {
|
||
|
pos: [f32; 2],
|
||
|
vel: [f32; 4],
|
||
|
color: [f32; 4],
|
||
|
}
|
||
|
|
||
|
impl Particle {
|
||
|
|
||
|
}
|
||
|
|
||
|
#[repr(C)]
|
||
|
#[derive(Clone, Debug, Copy)]
|
||
|
pub struct Vertex {
|
||
|
pos: [f32; 2],
|
||
|
color: [f32; 3],
|
||
|
}
|
||
|
|
||
|
impl Vertex {
|
||
|
pub fn get_binding_description() -> [vk::VertexInputBindingDescription; 1] {
|
||
|
[vk::VertexInputBindingDescription {
|
||
|
binding: 0,
|
||
|
stride: std::mem::size_of::<Vertex>() as u32,
|
||
|
input_rate: vk::VertexInputRate::VERTEX,
|
||
|
}]
|
||
|
}
|
||
|
|
||
|
pub fn get_attribute_descriptions() -> [vk::VertexInputAttributeDescription; 2] {
|
||
|
[
|
||
|
vk::VertexInputAttributeDescription {
|
||
|
binding: 0,
|
||
|
location: 0,
|
||
|
format: vk::Format::R32G32_SFLOAT,
|
||
|
offset: offset_of!(Vertex, pos) as u32,
|
||
|
},
|
||
|
vk::VertexInputAttributeDescription {
|
||
|
binding: 0,
|
||
|
location: 1,
|
||
|
format: vk::Format::R32G32B32_SFLOAT,
|
||
|
offset: offset_of!(Vertex, color) as u32,
|
||
|
},
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub const TRI_VERT_DATA: [Vertex; 3] = [
|
||
|
Vertex {
|
||
|
pos: [0.0, -0.5],
|
||
|
color: [1.0, 1.0, 1.0],
|
||
|
},
|
||
|
Vertex {
|
||
|
pos: [0.5, 0.5],
|
||
|
color: [0.0, 1.0, 0.0],
|
||
|
},
|
||
|
Vertex {
|
||
|
pos: [-0.5, 0.5],
|
||
|
color: [0.0, 0.0, 1.0],
|
||
|
},
|
||
|
];
|