Skip to main content

Crate bevy_pf_vector

Crate bevy_pf_vector 

Source
Expand description

bevy_pf_vector — a vector/UI rendering engine for bevy_pf.

Original engine, one narrow bet: HUD content has mostly-static topology, so paths are tessellated once (lyon) and redrawn as GPU-instanced geometry. Read ARCHITECTURE.md before extending this.

Re-exports§

pub use painter::PainterConfig;
pub use painter::VectorPainter;
pub use painter::VectorPainterQueue;
pub use path::Brush;
pub use path::DashPattern;
pub use path::FillRule;
pub use path::GradientStop;
pub use path::LineCap;
pub use path::LineJoin;
pub use path::PathCommand;
pub use path::PathStyle;
pub use path::StrokeStyle;

Modules§

painter
Immediate-mode painting: a per-frame command queue over the same tessellate-once machinery as retained VectorShape entities.
path
Path authoring types: outlines in verb form (what lyon/kurbo consume) plus fill/stroke styling with full brush support. These are the data half of the public API; rendering lives in render.rs.
render
Render-world half of the engine: extract, tessellate-on-first-sight, persistent buffers, pipelines, and the vector pass itself.
tess
Path → triangle mesh, via lyon. Runs once per unique geometry (content hash), never per frame — the engine’s entire premise.

Structs§

ClippedBy
Clips the entity’s rendering to the referenced VectorClipShape entity (and that clip’s own ancestors, if it is itself clipped).
HudTransform
Flat 2D transform for HUD elements. Use INSTEAD of animating Transform: entities animated through this component never dirty the transform hierarchy, so Bevy’s propagation systems have nothing to do — the last engine-controllable frame cost for large animated HUDs. Entities without a parent/children relationship should prefer it; Transform-driven entities (hierarchies like a compass with tick children) keep working unchanged, and when both are present this one wins.
PfVectorPlugin
StraightAlphaTarget
Marks a camera whose target is a TRANSPARENT texture that something else will composite as STRAIGHT alpha — bevy_pf’s shape atlas, sampled by bevy_ui ImageNodes, is the case this exists for.
VectorShape
A vector shape authored as a path outline plus style. Topology is treated as static: the path is tessellated once when the component is added; if the component is mutated, the shape re-tessellates that frame (priced per changed shape). For continuously parameter-animated primitives, prefer VectorPrimitive — those never tessellate at all.

Enums§

VectorClipShape
A clip region. Entities with this component don’t render; content references them via ClippedBy. Clips nest by putting ClippedBy on a clip entity itself (up to 4 levels). Evaluated analytically in the fragment shader — clip edges are antialiased and clipping costs no extra draw calls, state changes, or stencil passes.
VectorPrimitive
Parametric primitives evaluated entirely in the vertex shader from a canonical mesh — animating their parameters costs one instance write per frame, no tessellation, and all instances of a primitive kind draw in a single instanced call. The gauge/meter fast path.