2023-02-01 13:42:25 +00:00
|
|
|
use utilities::impl_reprc;
|
2023-01-16 11:58:59 +00:00
|
|
|
use vulkan_rs::prelude::*;
|
2023-01-16 09:53:52 +00:00
|
|
|
|
|
|
|
use std::mem;
|
|
|
|
|
2023-02-01 13:42:25 +00:00
|
|
|
impl_reprc!(
|
|
|
|
pub struct TexturedVertex {
|
|
|
|
#[assume_reprc]
|
|
|
|
position: cgmath::Vector4<f32>,
|
|
|
|
#[assume_reprc]
|
|
|
|
texture_coordinates: cgmath::Vector2<f32>,
|
|
|
|
}
|
|
|
|
);
|
2023-01-16 09:53:52 +00:00
|
|
|
|
2023-01-27 12:46:54 +00:00
|
|
|
impl VertexInputDescription for TexturedVertex {
|
|
|
|
fn bindings() -> Vec<VkVertexInputBindingDescription> {
|
|
|
|
vec![VkVertexInputBindingDescription {
|
2023-01-16 09:53:52 +00:00
|
|
|
binding: 0,
|
|
|
|
stride: mem::size_of::<TexturedVertex>() as u32,
|
|
|
|
inputRate: VK_VERTEX_INPUT_RATE_VERTEX,
|
2023-01-27 12:46:54 +00:00
|
|
|
}]
|
|
|
|
}
|
2023-01-16 09:53:52 +00:00
|
|
|
|
2023-01-27 12:46:54 +00:00
|
|
|
fn attributes() -> Vec<VkVertexInputAttributeDescription> {
|
|
|
|
vec![
|
2023-01-16 09:53:52 +00:00
|
|
|
VkVertexInputAttributeDescription {
|
|
|
|
location: 0,
|
|
|
|
binding: 0,
|
|
|
|
format: VK_FORMAT_R32G32B32A32_SFLOAT,
|
|
|
|
offset: 0,
|
|
|
|
},
|
|
|
|
VkVertexInputAttributeDescription {
|
|
|
|
location: 1,
|
|
|
|
binding: 0,
|
|
|
|
format: VK_FORMAT_R32G32_SFLOAT,
|
|
|
|
offset: 16, // mem::size_of::<cgmath::Vector4<f32>>() as u32
|
|
|
|
},
|
2023-01-27 12:46:54 +00:00
|
|
|
]
|
2023-01-16 09:53:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for TexturedVertex {
|
|
|
|
fn default() -> TexturedVertex {
|
|
|
|
TexturedVertex {
|
|
|
|
position: cgmath::Vector4::zero(),
|
|
|
|
texture_coordinates: cgmath::Vector2::zero(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|