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