CPU-side orthographic depth-buffer rasterisation and edge visibility
tests for the drawings pipeline.
Rasterises source SceneModel triangles
into an orthographic HLEDepthBuffer along an arbitrary
projection basis. Downstream stages use the
resulting point and edge tests to drop occluded geometry.
The depth buffer carries "distance-toward-camera" values in row-major
pixel order. When built with withOwners: true, it also carries a
parallel per-pixel owner buffer that maps every frontmost pixel back
to the SceneMesh that produced it; the
sibling fills extractor reads this owner buffer to trace
per-object silhouettes.
Entry points
buildHLEDepthBuffer — rasterise the source model into a
depth buffer (and optionally an owner buffer).
isPointVisible — test a single world-space point against
the buffer.
visibleEdgeSegments — sample an edge and return its
visible sub-segments as world-space endpoint pairs.
Usage
buildDrawing calls this internally. Use it directly when custom
annotation or overlay geometry needs the same visibility test.
// Test an annotation line for visibility against the model. constsegments = visibleEdgeSegments( buffer, [ 10, 5, 0 ], // edge start [ 10, 5, 20 ], // edge end 8, // sample count 0.01// depth-bias tolerance (world units) );
for (const { a, b } ofsegments) { // Emit each visible sub-segment as a LinesPrimitive geometry. }
Resolution and memory
Buffer memory is 4 × width × height bytes (Float32 depths) plus an
equal-size Int32 owner buffer when withOwners: true. At the default
2048-pixel longer axis, peak memory is ~16 MB for the depth buffer
and another ~16 MB for owners. For high-resolution drawings on dense
models, use the tile-at-a-time fills extractor to keep peak memory
bounded
at O(tileSize²) regardless of resolution.
Hidden-Line Elimination
CPU-side orthographic depth-buffer rasterisation and edge visibility tests for the drawings pipeline.
Rasterises source SceneModel triangles into an orthographic HLEDepthBuffer along an arbitrary projection basis. Downstream stages use the resulting point and edge tests to drop occluded geometry.
The depth buffer carries "distance-toward-camera" values in row-major pixel order. When built with
withOwners: true, it also carries a parallel per-pixel owner buffer that maps every frontmost pixel back to the SceneMesh that produced it; the siblingfillsextractor reads this owner buffer to trace per-object silhouettes.Entry points
Usage
buildDrawing calls this internally. Use it directly when custom annotation or overlay geometry needs the same visibility test.
Resolution and memory
Buffer memory is
4 × width × heightbytes (Float32 depths) plus an equal-size Int32 owner buffer whenwithOwners: true. At the default 2048-pixel longer axis, peak memory is ~16 MB for the depth buffer and another ~16 MB for owners. For high-resolution drawings on dense models, use the tile-at-a-timefillsextractor to keep peak memory bounded atO(tileSize²)regardless ofresolution.