Per-source-object filled silhouette extraction for the drawings
pipeline. Uses the hle depth buffer so fill boundaries align with
the projected wireframe.
Derives one FillPolygons record per source
SceneMesh that contributed at least one
frontmost pixel to the depth buffer's owner field. Each record carries
flat world-space positions and indices that can be passed to
SceneModel.createGeometry.
Internally the extractor:
Histograms owner pixels to skip empties.
Marching-squares-traces each owner's visibility mask into
closed contours.
Simplifies the contour via Douglas-Peucker (default ε = 0.25 px).
Triangulates the simplified polygon with earcut.
Lifts the 2D vertices back to world space on the projection plane.
Wireframe edges and fills derive from the same depth buffer, so their
boundaries use the same visibility result.
Entry points
Two extractors return the same shape. Pick by memory budget:
extractFills — consumes an already-built
HLEDepthBuffer (from the sibling hle submodule) and
triangulates each owner's mask in-memory. Use it when the projection
already has a depth buffer.
extractFillsTiled — rasterises tile-at-a-time so peak memory
stays bounded at O(tileSize²) rather than O(resolution²). Used by
the projector at high resolutions on dense scenes.
for (const { sourceObjectId, sourceMeshId, positions, indices } offills) { // Emit one TrianglesPrimitive geometry per source mesh. }
Tile-at-a-time, bounded memory
For high-resolution drawings on large source models, the tiled
extractor walks the projection plane in tileSize × tileSize chunks.
Peak memory stays O(tileSize²) regardless of resolution.
Passing a SceneCollisionIndex
narrows the per-tile candidate set from O(N × T) to O(log N × T).
This is usually worth it once N (source SceneObjects) crosses ~1000.
Filled-Polygon Extraction
Per-source-object filled silhouette extraction for the drawings pipeline. Uses the
hledepth buffer so fill boundaries align with the projected wireframe.Derives one FillPolygons record per source SceneMesh that contributed at least one frontmost pixel to the depth buffer's owner field. Each record carries flat world-space
positionsandindicesthat can be passed to SceneModel.createGeometry.Internally the extractor:
Wireframe edges and fills derive from the same depth buffer, so their boundaries use the same visibility result.
Entry points
Two extractors return the same shape. Pick by memory budget:
HLEDepthBuffer(from the siblinghlesubmodule) and triangulates each owner's mask in-memory. Use it when the projection already has a depth buffer.O(tileSize²)rather thanO(resolution²). Used by the projector at high resolutions on dense scenes.Usage
From an existing depth buffer
Tile-at-a-time, bounded memory
For high-resolution drawings on large source models, the tiled extractor walks the projection plane in
tileSize × tileSizechunks. Peak memory staysO(tileSize²)regardless ofresolution.Passing a SceneCollisionIndex narrows the per-tile candidate set from
O(N × T)toO(log N × T). This is usually worth it onceN(source SceneObjects) crosses ~1000.Picking a tile size
tileSize = 1024(default) — bounds peak memory at ~16 MB.tileSize = 512— bounds peak memory at ~4 MB.tileSize = 0(or>= resolution) — disables tiling and uses a single buffer. Use for small models where per-tile overhead is not useful.