rustial_renderer_wgpu/gpu/
vector_vertex.rs1use bytemuck::{Pod, Zeroable};
4
5#[repr(C)]
7#[derive(Debug, Clone, Copy, Pod, Zeroable)]
8pub struct VectorVertex {
9 pub position: [f32; 3],
11 pub color: [f32; 4],
13}
14
15impl VectorVertex {
16 pub fn layout() -> wgpu::VertexBufferLayout<'static> {
18 wgpu::VertexBufferLayout {
19 array_stride: std::mem::size_of::<VectorVertex>() as wgpu::BufferAddress,
20 step_mode: wgpu::VertexStepMode::Vertex,
21 attributes: &[
22 wgpu::VertexAttribute {
23 offset: 0,
24 shader_location: 0,
25 format: wgpu::VertexFormat::Float32x3,
26 },
27 wgpu::VertexAttribute {
28 offset: std::mem::size_of::<[f32; 3]>() as wgpu::BufferAddress,
29 shader_location: 1,
30 format: wgpu::VertexFormat::Float32x4,
31 },
32 ],
33 }
34 }
35}