@pmndrs/bvh
    Preparing search index...

    Class BvhSceneRaycaster

    The CPU scene of a three scene; see the file comment.

    Index
    root: Object3D<Object3DEventMap> | readonly Object3D<Object3DEventMap>[]
    • get instanceCount(): number

      Instances (objects, instances of instanced and batched meshes, and groups) in the scene.

      Returns number

    • The sources (object, instance, group) whose world box meets frustum (three's Frustum.intersectsBox test, on the boxes the walk uses), each object or instance once. layers (a camera's) limits them to objects on its layers 0-7.

      Parameters

      • frustum: Frustum
      • Optionallayers: { mask: number }

      Returns BvhThreeSource[]

    • What raycaster.intersectObject(root, true) returns (see the file comment), appended to intersects and sorted by distance.

      Parameters

      • raycaster: Raycaster
      • intersects: Intersection<Object3D<Object3DEventMap>>[] = []

      Returns Intersection<Object3D<Object3DEventMap>>[]

    • three-mesh-bvh's ObjectBVH.shapecast(callbacks) (PARITY 5.3): a walk over the scene's world boxes (the top level the raycast uses, one box per object, instance or group, as of the last update) with three-mesh-bvh's contract: intersectsBounds(box, isLeaf, score, depth, nodeIndex) with a Box3 (scratch, valid during the call) decides which boxes to enter (CONTAINED takes a box's subtree whole), boundsTraverseOrder(box) which child first, and intersectsObject(object, instanceId, contained, depth, source) gets each object in an entered leaf: instanceId is the InstancedMesh or BatchedMesh instance, else 0 as in three-mesh-bvh; source is ours (a multi-material mesh with multiMaterial: 'groups' comes once per group). intersectsRange(offset, count, contained, depth, nodeIndex, box) gets top-level positions (cpuScene.instanceAt). A truthy return from either stops the cast; returns true when stopped. Hidden objects are left out as in the raycast (includeHidden).

      Parameters

      Returns boolean

    • Reads the scene again (call updateMatrixWorld() first): needed after objects move or change and after geometry edits (see the file comment). Rebuilds only the top level when the meshes are the same; builds trees for new geometry or ranges, or edited positions or index, and drops unused ones. Returns whether meshes changed.

      Returns boolean