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

    Interface ILODRender

    Renderer for LOD objects using GPU instancing.

    Responsible for preparing meshes, collecting instances, computing bounding boxes, and updating rendering parameters.

    interface ILODRender {
        meshes: MeshInstance[];
        sortObjects: boolean;
        computeMaxMeshBoundingBox(): BoundingBox | null;
        destroy(): void;
        end(): void;
        enqueue(index: number, opacity: number, extraPad?: number): void;
        resize(newCapacity: number): void;
        sort(reversed: boolean, buf: Uint32Array, depthStore: Uint32Array): void;
        start(): void;
    }
    Index
    meshes: MeshInstance[]

    The mesh instances used by this LOD renderer. All meshes share the same instancing buffer.

    sortObjects: boolean

    Whether objects should be sorted before rendering. Usually enabled for transparent materials.

    • Computes the combined bounding box for all meshes.

      If root is defined, the bounding box is converted to the root local space (root scale kept, translation and rotation stripped) so it can be used for frustum culling without updating matrices on the CPU.

      Returns BoundingBox | null

      The bounding box for all meshes, or null if there are no meshes.

    • Finalizes the frame and applies the collected data to the meshes.

      Updates instancing counts and, when needed, local matrices relative to the root entity, keeping the root scale.

      Returns void

    • Enqueues an instance for rendering.

      Parameters

      • index: number

        The instance index in the buffer.

      • opacity: number

        Opacity value in the range from 0 to 1.

      • OptionalextraPad: number

        The extra value. Default is 0.

      Returns void

    • Resize instances capacity

      Parameters

      • newCapacity: number

      Returns void

    • Sorts the collected instances.

      Parameters

      • reversed: boolean

        If true, sorts in reverse order.

      • buf: Uint32Array

        Buffer of indices used during sorting.

      • depthStore: Uint32Array

        Temporary buffer for depth values.

      Returns void

    • Starts collecting instances for the next render pass. Clears the internal list of queued objects.

      Returns void