Readonlyclosest(point, maxDistance = 1e30) => BvhClosestPointHit struct node: the
scene's triangle point nearest to a world-space point (bvhClosestPoint).
Throws unless made with queries: true.
ReadonlyclosestAs closestPoint with a u32 instance mask; throws with rayMasks: false or without queries.
ReadonlymoduleThe walk (bvhTraceClosest, bvhTraceAny, BvhRay, BvhHit, ...): include it in a wgslFn to call it from WGSL.
ReadonlynodeThe source's node format, compiled into the walk.
ReadonlypositionReadonlyqueriesWhether the module has the spatial queries (queries: true).
ReadonlyrayReadonlysourceReadonlystorageThe storage nodes, for reading the layout directly (positions only for indexed leaves).
Readonlytrace(origin, direction, tMin = 0, tMax = 1e30) => bool node: anything in [tMin, tMax].
ReadonlytraceAs traceAny with a u32 ray mask; throws with rayMasks: false.
Readonlytrace(origin, direction, tMin = 0, tMax = 1e30) => BvhTraceHit struct node.
ReadonlytraceAs traceClosest with a u32 ray mask; throws with rayMasks: false.
ReadonlytriangleThe source's triangle format, compiled into the walk.
The version bound now (the source's at the last update).
Releases the stand-in attributes. The source's buffers are not destroyed (they are the source's).
three-mesh-bvh's getShapecastFn (PARITY 8.6): a scene shapecast whose
box and triangle tests are three function nodes (BvhShapecastFnOptions:
wgslFns, or TSL Fns with setLayout), compiled into the trace
module's shapecast walk (the one traceModuleWgsl({ shapecast }) stamps
for WGSL hooks: world space, every instance, node and triangle format).
Returns a TSL function (shape?, mask?) => bool, true when the triangle
hook stopped the cast; mask (a u32, default every instance) only
with rayMasks. Needs queries: true (the walk's types and helpers).
The hooks are functions of their own in the shader. A TSL Fn with a
layout is cached across shaders by three, so its body must depend only
on its arguments: pass per-call data as the shape. State a hook keeps
between calls (a best distance, a count) needs a wgslFn writing its own
var<private> or a storage buffer. The triangle hook may call the
module's other walks (bvhTraceAny, bvhClosestPoint, ...); the bounds
and keep hooks must not.
Rebinds the storage nodes when the source's buffers were replaced
(version changed, or a buffer object differs). Returns true when it rebound.
Throws when three bound something other than our buffers to a stand-in
it used (a three version whose internals differ; see threeInternals).
three-mesh-bvh's await bvh.updateAsync() (PARITY 8.4): with a
SceneTrees source, updateSceneTreesAsync (the sync walked,
every build started and waited for, the trees placed) and then
update; with fixed buffers (an upload), just update.
Our trace buffers in three's node system; see the file comment.
const bvh = new BvhTraceNodes(renderer, sceneTrees); // each frame: sync.update(); sceneTrees.update(encoder); submit; bvh.update(); renderer.compute(...)