pub struct VectorMeshData {Show 20 fields
pub positions: Vec<[f64; 3]>,
pub colors: Vec<[f32; 4]>,
pub normals: Vec<[f32; 3]>,
pub indices: Vec<u32>,
pub render_mode: VectorRenderMode,
pub line_distances: Vec<f32>,
pub line_normals: Vec<[f32; 2]>,
pub line_cap_joins: Vec<f32>,
pub line_params: [f32; 4],
pub circle_instances: Vec<CircleInstanceData>,
pub heatmap_points: Vec<[f64; 4]>,
pub heatmap_intensity: f32,
pub fill_translate: [f32; 2],
pub fill_opacity: f32,
pub fill_antialias: bool,
pub fill_outline_color: [f32; 4],
pub fill_pattern: Option<Arc<PatternImage>>,
pub fill_pattern_uvs: Vec<[f32; 2]>,
pub line_pattern: Option<Arc<PatternImage>>,
pub line_pattern_uvs: Vec<[f32; 2]>,
}Expand description
CPU-side mesh data for vector rendering, ready for GPU upload.
Produced by VectorLayer::tessellate and consumed by renderers.
One instance per visible vector layer per frame.
All positions are in Web Mercator world space (f64 for precision). The renderer converts them to camera-relative f32 before uploading.
Fields§
§positions: Vec<[f64; 3]>Vertex positions in world space [x, y, z] (f64 for precision).
colors: Vec<[f32; 4]>Per-vertex colour [r, g, b, a] (0–1 range, linear).
normals: Vec<[f32; 3]>Per-vertex surface normals [nx, ny, nz].
Empty for flat geometry (fills, lines, circles). Populated for
3-D geometry such as fill-extrusions where per-face normals are
needed for proper lighting. When non-empty, the length must
equal positions.len().
indices: Vec<u32>Triangle indices into positions / colors / normals.
render_mode: VectorRenderModeHigh-level render family that produced this mesh.
Renderers use this to select the appropriate GPU pipeline (e.g. lit fill-extrusion vs. flat fill).
line_distances: Vec<f32>Per-vertex distance along the polyline centreline (meters in world
space). Non-empty only for VectorRenderMode::Line. The GPU line
shader uses this for dash-pattern evaluation.
line_normals: Vec<[f32; 2]>Per-vertex extrusion normal [nx, ny] (unit-length direction
perpendicular to the line centreline). Non-empty only for
VectorRenderMode::Line.
line_cap_joins: Vec<f32>Per-vertex cap/join flag. 1.0 for round cap/join fan vertices,
0.0 for ribbon body and non-round cap/join vertices. The GPU
line shader uses this to switch between linear edge AA and
SDF circle-based AA. Non-empty only for VectorRenderMode::Line.
line_params: [f32; 4]Line style parameters [dash_length, gap_length, half_width, cap_round].
Uniform across all vertices in a single mesh. cap_round is 1.0
for round caps and 0.0 for butt caps.
circle_instances: Vec<CircleInstanceData>Per-instance circle data: [center_x, center_y, center_z, radius]
in world space (f64 centre, f32 radius).
heatmap_points: Vec<[f64; 4]>Per-point heatmap data: [x, y, weight, radius] in world space.
heatmap_intensity: f32Heatmap intensity multiplier.
fill_translate: [f32; 2]Fill-layer pixel translate offset [tx, ty].
fill_opacity: f32Fill-layer opacity (separate from vertex alpha).
fill_antialias: boolWhether fill edges should be antialiased.
fill_outline_color: [f32; 4]Outline colour override for fill outlines.
When [0,0,0,0], the outline uses the fill colour.
fill_pattern: Option<Arc<PatternImage>>Optional pattern image for fill-pattern rendering.
When present, the renderer creates a repeating texture and
uses fill_pattern_uvs to sample it. Non-empty only for
VectorRenderMode::Fill with a pattern set.
fill_pattern_uvs: Vec<[f32; 2]>Per-vertex pattern UV coordinates [u, v].
Populated only when fill_pattern is Some. The coordinates
are in pattern-tile units: (0,0) is the pattern origin,
(1,1) is one full pattern repetition. Values outside [0,1]
repeat via the GPU’s Repeat address mode.
line_pattern: Option<Arc<PatternImage>>Optional pattern image for line-pattern rendering.
When present, the renderer creates a repeating texture and
uses line_pattern_uvs to sample it. Non-empty only for
VectorRenderMode::Line with a pattern set.
line_pattern_uvs: Vec<[f32; 2]>Per-vertex pattern UV coordinates [u, v] for line-pattern rendering.
U maps along the line centreline (distance / pattern_width),
V maps across the line width (0.0 = left edge, 1.0 = right edge).
Values outside [0,1] on the U axis repeat via the GPU’s Repeat
address mode.
Implementations§
Source§impl VectorMeshData
impl VectorMeshData
Sourcepub fn vertex_count(&self) -> usize
pub fn vertex_count(&self) -> usize
Number of vertices.
Sourcepub fn index_count(&self) -> usize
pub fn index_count(&self) -> usize
Number of triangle indices (always a multiple of 3 in valid meshes).
Sourcepub fn triangle_count(&self) -> usize
pub fn triangle_count(&self) -> usize
Number of triangles.
Sourcepub fn has_normals(&self) -> bool
pub fn has_normals(&self) -> bool
Whether this mesh carries per-vertex normals for lighting.
Sourcepub fn merge(&mut self, other: &VectorMeshData)
pub fn merge(&mut self, other: &VectorMeshData)
Append another mesh into this one, adjusting indices.
Trait Implementations§
Source§impl Clone for VectorMeshData
impl Clone for VectorMeshData
Source§fn clone(&self) -> VectorMeshData
fn clone(&self) -> VectorMeshData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more