UNPKG

playcanvas

Version:

PlayCanvas WebGL game engine

105 lines (104 loc) 3.63 kB
/** * GSplatManager manages the rendering of splats using a work buffer, where all active splats are * stored and rendered from. * * @ignore */ export class GSplatManager { constructor(device: any, director: any, layer: any, cameraNode: any); /** @type {GraphicsDevice} */ device: GraphicsDevice; /** @type {GraphNode} */ node: GraphNode; /** @type {number} */ cooldownTicks: number; /** @type {GSplatWorkBuffer} */ workBuffer: GSplatWorkBuffer; /** @type {GSplatRenderer} */ renderer: GSplatRenderer; /** * A map of versioned world states, keyed by version. * * @type {Map<number, GSplatWorldState>} */ worldStates: Map<number, GSplatWorldState>; /** * The version of the last world state. * * @type {number} */ lastWorldStateVersion: number; /** @type {GSplatUnifiedSorter} */ sorter: GSplatUnifiedSorter; /** @type {number} */ sortedVersion: number; /** @type {number} */ framesTillFullUpdate: number; /** @type {Vec3} */ lastCameraPos: Vec3; /** @type {Vec3} */ lastCameraFwd: Vec3; /** @type {GraphNode} */ cameraNode: GraphNode; /** @type {Scene} */ scene: Scene; /** * Layer placements, only non-octree placements are included. * * @type {GSplatPlacement[]} */ layerPlacements: GSplatPlacement[]; /** @type {boolean} */ layerPlacementsDirty: boolean; /** @type {Map<GSplatPlacement, GSplatOctreeInstance>} */ octreeInstances: Map<GSplatPlacement, GSplatOctreeInstance>; /** * Octree instances scheduled for destruction. We collect their releases and destroy them * when creating the next world state * * @type {GSplatOctreeInstance[]} */ octreeInstancesToDestroy: GSplatOctreeInstance[]; director: any; destroy(): void; createSorter(): GSplatUnifiedSorter; /** * Supply the manager with the placements to use. This is used to update the manager when the * layer's placements have changed, called infrequently. * * @param {GSplatPlacement[]} placements - The placements to reconcile with. */ reconcile(placements: GSplatPlacement[]): void; updateWorldState(): void; onSorted(count: any, version: any, orderData: any): void; /** * Tests if the camera has moved or rotated enough to require LOD update. * * @returns {boolean} True if camera moved/rotated over thresholds, otherwise false. */ testCameraMoved(): boolean; update(): number; /** * Sorts the splats of the given world state. * * @param {GSplatWorldState} lastState - The last world state. */ sort(lastState: GSplatWorldState): void; /** * Prepares sort parameters data for the sorter worker. * * @param {GSplatWorldState} worldState - The world state containing all needed data. * @returns {object} - Data for sorter worker. */ prepareSortParameters(worldState: GSplatWorldState): object; } import type { GraphicsDevice } from '../../platform/graphics/graphics-device.js'; import { GraphNode } from '../graph-node.js'; import { GSplatWorkBuffer } from './gsplat-work-buffer.js'; import { GSplatRenderer } from './gsplat-renderer.js'; import { GSplatWorldState } from './gsplat-world-state.js'; import { GSplatUnifiedSorter } from './gsplat-unified-sorter.js'; import { Vec3 } from '../../core/math/vec3.js'; import type { Scene } from '../scene.js'; import type { GSplatPlacement } from './gsplat-placement.js'; import { GSplatOctreeInstance } from './gsplat-octree-instance.js';