Per-source-object filled silhouette extraction for the drawings
pipeline. Shares the hle depth buffer so fill
boundaries coincide exactly with the wireframe edges.
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 ready to feed straight into
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.
Because both the wireframe edges and these fills derive from the same
depth buffer, their pixel-accurate boundaries coincide: the wireframe
sits exactly on the fill silhouette, with no halo at occlusion edges.
Entry points
Two extractors with the same output shape — pick the one that matches
the call site's memory budget:
extractFills — consumes an already-built
HLEDepthBuffer (from the sibling hle submodule) and
triangulates each owner's mask in-memory. Right for single-pass
projections that already paid for the 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 very high resolutions on dense BIM 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.
Filled-Polygon Extraction
Per-source-object filled silhouette extraction for the drawings pipeline. Shares the
hledepth buffer so fill boundaries coincide exactly with the wireframe edges.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
positionsandindicesready to feed straight into SceneModel.createGeometry.Internally the extractor:
Because both the wireframe edges and these fills derive from the same depth buffer, their pixel-accurate boundaries coincide: the wireframe sits exactly on the fill silhouette, with no halo at occlusion edges.
Entry points
Two extractors with the same output shape — pick the one that matches the call site's memory budget:
HLEDepthBuffer(from the siblinghlesubmodule) and triangulates each owner's mask in-memory. Right for single-pass projections that already paid for the depth buffer.O(tileSize²)rather thanO(resolution²). Used by the projector at very high resolutions on dense BIM 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)— worth it onceN(source SceneObjects) crosses ~1000.Picking a tile size
tileSize = 1024(default) — bounds peak memory at ~16 MB. Right for desktop and most laptop GPUs.tileSize = 512— bounds peak memory at ~4 MB. Right for mobile or when several drawings build concurrently.tileSize = 0(or>= resolution) — disables tiling and uses a single buffer. Right for small models where per-tile overhead doesn't pay back.