rustial_renderer_wgpu/gpu/
vertex.rs1use bytemuck::{Pod, Zeroable};
4
5#[repr(C)]
7#[derive(Debug, Clone, Copy, Pod, Zeroable)]
8pub struct TileVertex {
9 pub position: [f32; 3],
11 pub uv: [f32; 2],
13 pub opacity: f32,
15}
16
17impl TileVertex {
18 pub fn layout() -> wgpu::VertexBufferLayout<'static> {
20 wgpu::VertexBufferLayout {
21 array_stride: std::mem::size_of::<TileVertex>() as wgpu::BufferAddress,
22 step_mode: wgpu::VertexStepMode::Vertex,
23 attributes: &[
24 wgpu::VertexAttribute {
25 offset: 0,
26 shader_location: 0,
27 format: wgpu::VertexFormat::Float32x3,
28 },
29 wgpu::VertexAttribute {
30 offset: 12,
31 shader_location: 1,
32 format: wgpu::VertexFormat::Float32x2,
33 },
34 wgpu::VertexAttribute {
35 offset: 20,
36 shader_location: 2,
37 format: wgpu::VertexFormat::Float32,
38 },
39 ],
40 }
41 }
42}