CPU-side orthographic depth-buffer rasterisation and edge-visibility
testing for the drawings pipeline.
Rasterises every triangle of a source SceneModel
into an orthographic HLEDepthBuffer along an arbitrary
projection basis, then exposes point and edge
visibility tests downstream stages use 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
The orchestrating buildDrawing entry point hides these calls,
but they are also useful standalone — for instance to test custom
annotation geometry against a model's visibility along an arbitrary
direction.
// 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 — fine for a single drawing on a desktop.
For very-high-resolution drawings on dense BIM models, prefer the
tile-at-a-time fills extractor which keeps peak memory bounded
at O(tileSize²) regardless of resolution.
Hidden-Line Elimination
CPU-side orthographic depth-buffer rasterisation and edge-visibility testing for the drawings pipeline.
Rasterises every triangle of a source SceneModel into an orthographic HLEDepthBuffer along an arbitrary projection basis, then exposes point and edge visibility tests downstream stages use 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
The orchestrating buildDrawing entry point hides these calls, but they are also useful standalone — for instance to test custom annotation geometry against a model's visibility along an arbitrary direction.
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 — fine for a single drawing on a desktop. For very-high-resolution drawings on dense BIM models, prefer the tile-at-a-timefillsextractor which keeps peak memory bounded atO(tileSize²)regardless ofresolution.