1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Vertex type for the dedicated fill GPU pipeline.
use bytemuck::{Pod, Zeroable};
/// A vertex for fill geometry with position and per-vertex color.
///
/// This is structurally identical to [`super::vector_vertex::VectorVertex`]
/// but exists as a separate type so the fill pipeline can evolve
/// independently (e.g. UV for fill-pattern, per-feature ID).
#[repr(C)]
#[derive(Debug, Clone, Copy, Pod, Zeroable)]
pub struct FillVertex {
/// Position `[x, y, z]` in camera-relative meters.
pub position: [f32; 3],
/// Per-vertex RGBA color.
pub color: [f32; 4],
}
impl FillVertex {
/// Vertex buffer layout for the fill pipeline.
pub fn layout() -> wgpu::VertexBufferLayout<'static> {
wgpu::VertexBufferLayout {
array_stride: std::mem::size_of::<FillVertex>() as wgpu::BufferAddress,
step_mode: wgpu::VertexStepMode::Vertex,
attributes: &[
wgpu::VertexAttribute {
offset: 0,
shader_location: 0,
format: wgpu::VertexFormat::Float32x3,
},
wgpu::VertexAttribute {
offset: std::mem::size_of::<[f32; 3]>() as wgpu::BufferAddress,
shader_location: 1,
format: wgpu::VertexFormat::Float32x4,
},
],
}
}
}