@pmndrs/bvh
    Preparing search index...

    Class GpuTopLevel

    Index
    counters: GpuTopLevelCounters = ...
    latestRelativeCost: number = 0

    Relative SAH cost of the refit tree: from the last quality check, or the diagnostics readback when on.

    • get buffer(): GPUBuffer

      The tracer's top-level buffer: header, instance records, nodes. Bind it as bvhTraceTopLevel.

      Returns GPUBuffer

    • get building(): boolean

      True while a shape that adds or removes instances is being built or waits to be swapped in. Quality checks don't count.

      Returns boolean

    • get instanceCount(): number

      Records in the current shape (instances rays can see once traced, hidden ones included).

      Returns number

    • Whether slot holds a merged static group's record.

      Parameters

      • slot: number

      Returns boolean

    • Compiles the gather and the refit, and starts the shape worker (so its module loads while they compile).

      Returns Promise<void>

    • Puts an instance in slot (adding it, or replacing what the slot held), or removes it (null). Adding or removing needs a new shape (built off the frame, so the instance appears a frame or two later); replacing one with the same slot only rewrites its entry. Throws for a merged instance whose transform isn't the identity, or that would replace a merged one with another transform.

      Parameters

      Returns void

    • A mesh's object box, which shape builds use until its tree is placed (and after, unless the tree gives another).

      Parameters

      • meshSlot: number
      • bounds: ArrayLike<number>

      Returns void

    • A mesh's tree was placed (or replaced), or released (null). The mesh table reaches the GPU at the next update.

      Parameters

      Returns void

    • Moves an instance. Throws for a merged static group's record: its transform is baked into its mesh.

      Parameters

      • slot: number
      • objectToWorld: Mat4

      Returns void

    • Brings the top level up to this frame: writes the changed instance and mesh entries, swaps in an arrived shape, starts a build or quality check if one is due, and records the refit pass (gather, then refit) when anything it depends on changed. Call before anything traces in encoder.

      Parameters

      Returns void

    • Resolves once no shape build is pending (the last may still wait for the next update to be swapped in).

      Returns Promise<void>