playcanvas-opti-pixel - v1.2.0
    Preparing search index...

    Class WebgpuHZBTester

    Interface for working with an occlusion culling testing system. Allows registering BoundingBox objects, enqueueing them for testing, and checking if the object is occluded by other scene geometry.

    Implements

    Index
    _ocTesterType: "gpu_indirect_draw_oct"
    computeDebugName: string = "WebgpuHZBTesterCompute"
    shaderDebugName: string = "WebgpuHZBTesterShader"
    • Adds the object to the queue for occlusion testing.

      Parameters

      • id: number

        The unique identifier returned earlier by the lock() method.

      • slot: number

        The slot value obtained from device.getIndirectDrawSlot or your internal index.

      • primitive: IPrimitive

        The mesh primitive for draw.

      • instanceCount: number

        The number of instances to draw.

      • firstInstance: number = 0

        The first instance to draw.

      • Optionalextra: number[]

        The extra data.

      Returns number

      A queue index, or -1 if internal verification inconsistencies occur (e.g., the tester is unavailable or waiting for synchronization).

    • Registers a BoundingBox for subsequent occlusion testing.

      Parameters

      • boundingBox: BoundingBox

        The bounds of the object in local or world coordinates.

      • Optionalmatrix: Mat4

        Optional transformation matrix (if a local BoundingBox is used).

      • extra1: number = 0

        Optional extra data 1.

      • extra2: number = 0

        Optional extra data 2.

      Returns number

      A unique identifier for the registered object.

    • Registers a BoundingBox for subsequent occlusion testing.

      Parameters

      • data: ArrayLike<number>

        The array containing the bounding box data (min and max points) in local or world coordinates [minX, maxX, minY, maxY, minZ, maxZ].

      • offset: number

        The offset in the array where the bounding box data starts.

      • Optionalmatrix: Mat4

        Optional transformation matrix (if a local BoundingBox is used).

      • Optionalextra1: number

        Optional extra data 1.

      • Optionalextra2: number

        Optional extra data 2.

      Returns number

      A unique identifier for the registered object.

    • Parameters

      • Optionaldefines: Map<string, string>
      • Optionalincludes: Map<string, string>

      Returns void

    • Parameters

      • count: number
      • viewProjection: Mat4
      • cameraPosition: Vec3
      • aabbStore: IAABBStore
      • indirectDrawQueueBuffer: VertexBuffer | StorageBuffer
      • indirectDataBuffer: IndirectDataBuffer
      • indirectDrawBuffer: StorageBuffer
      • debugName: string = "TestHZB"

      Returns void