Donner 0.5.0
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
donner::geode::EncodedPath Struct Reference

GPU-ready encoded path data produced by the Slug band decomposition algorithm. More...

#include "donner/svg/renderer/geode/GeodePathEncoder.h"

Collaboration diagram for donner::geode::EncodedPath:
[legend]

Classes

struct  Curve
 A quadratic Bézier curve segment (3 control points) stored as floats for GPU consumption. More...
struct  Band
 Metadata for one horizontal band. More...
struct  Vertex
 Vertex for the band bounding quad (input to the Slug vertex shader). More...

Public Member Functions

bool empty () const
 Returns true if the encoded path has no bands (empty or degenerate path).

Public Attributes

std::vector< Curvecurves
 All quadratic curves, sorted by band.
std::vector< Bandbands
 Band metadata.
std::vector< Vertexvertices
 Bounding quad vertices (6 per band).
Box2d pathBounds
 Axis-aligned bounding box of the path.

Detailed Description

GPU-ready encoded path data produced by the Slug band decomposition algorithm.

This struct contains all the data needed by the Slug vertex and fragment shaders to render a filled path. It is produced by GeodePathEncoder::encode() and consumed by the GPU pipeline.

The data is organized as:

  • Curves: Quadratic Bézier control points (3 × Vector2f per curve), packed contiguously.
  • Bands: Horizontal slices through the path. Each band references a contiguous range of curves and has a bounding quad for rasterization.
  • Vertices: The bounding quads for each band (6 vertices per band = 2 triangles), with position, outward normal, and band index attributes for the vertex shader.

Class Documentation

◆ donner::geode::EncodedPath::Curve

struct donner::geode::EncodedPath::Curve

A quadratic Bézier curve segment (3 control points) stored as floats for GPU consumption.

Class Members
float p0x
float p0y Start point.
float p1x
float p1y Control point.
float p2x
float p2y End point.

◆ donner::geode::EncodedPath::Band

struct donner::geode::EncodedPath::Band

Metadata for one horizontal band.

Layout matches the WGSL Band struct in shaders/slug_fill.wgsl exactly (8 × 4 bytes = 32 bytes per band). Two trailing pad fields are required because storage buffer struct stride must be 16-byte aligned, and without them WGSL would round the struct to 32 bytes anyway.

Class Members
float _pad0 Padding to match WGSL stride.
float _pad1 Padding to match WGSL stride.
uint32_t curveCount Number of curves intersecting this band.
uint32_t curveStart Index of the first curve in this band's curve range.
float xMax Right extent of curves in this band.
float xMin Left extent of curves in this band.
float yMax Top edge of the band (in path space).
float yMin Bottom edge of the band (in path space).

◆ donner::geode::EncodedPath::Vertex

struct donner::geode::EncodedPath::Vertex

Vertex for the band bounding quad (input to the Slug vertex shader).

Class Members
uint32_t bandIndex Which band this vertex belongs to.
float normalX
float normalY Outward normal (for dynamic half-pixel dilation).
float posX
float posY Position in path space.

The documentation for this struct was generated from the following file: