@pmndrs/bvh
    Preparing search index...

    Class CpuSceneBvh

    The scene's instances, the mesh trees and a CPU walk over them; see the file comment.

    Index
    meshes: readonly MeshBvh[]
    • get instanceCount(): number

      Instances in the top level (hidden ones and ones whose transform can't be inverted aren't).

      Returns number

    • The instanceIndex of the instance record at a top-level position (what traverse ranges count).

      Parameters

      • position: number

      Returns number

    • The instanceIndex of every instance whose world box meets box ([minX, minY, minZ, maxX, maxY, maxZ]).

      Parameters

      • box: ArrayLike<number>
      • options: { mask?: number } = {}

      Returns number[]

    • The instanceIndex of every instance whose world box meets the planes (is not wholly outside any of them), as three's Frustum.intersectsBox tests a box. Walks the top level, skipping subtrees outside a plane and taking subtrees inside every plane whole. With mask, only instances it names (as rays do).

      Parameters

      Returns number[]

    • three-mesh-bvh's ObjectBVH.shapecast(callbacks) over the instances (PARITY 5.3): traverse, with each entered leaf's (or contained box's) instances handed to intersectsInstance by instanceIndex. Boxes come as a BvhBox3 (a scratch object, valid during the call). intersectsRange, when given, is asked first and a truthy answer stops the cast; with neither, a cast stops at the first contained box, as three-mesh-bvh's does. Returns true when a callback stopped it.

      Parameters

      Returns boolean

    • The top level's walk with three-mesh-bvh's shapecast contract (CpuMeshBvh.traverse's callbacks, step for step: depth first, the root's box never asked about, each child scored once by boundsTraverseOrder and the lower score entered first, a falsy intersectsBounds skipping the box, BVH_CONTAINED reporting the box's subtree as one range, a truthy intersectsRange stopping the walk). Boxes are the instances' world boxes (the ones rays test), ranges are top-level positions (instanceAt maps them), and nodeIndex is the child slot (parentNode * 2 + side). One instance per leaf. Returns true when it was stopped.

      Parameters

      Returns boolean