UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

89 lines (88 loc) 3.69 kB
/** * A render pass used to render multiple gsplats to a work buffer render target. * * @ignore */ export class GSplatWorkBufferRenderPass extends RenderPass { constructor(device: any, workBuffer: any, colorOnly?: boolean); /** * Array of GSplatInfo objects to render in this pass. * * @type {GSplatInfo[]} */ splats: GSplatInfo[]; /** @type {number[][]|undefined} */ colorsByLod: number[][] | undefined; /** * The camera node used for rendering. * * @type {GraphNode} */ cameraNode: GraphNode; /** @type {GSplatWorkBuffer} */ workBuffer: GSplatWorkBuffer; /** @type {boolean} */ colorOnly: boolean; /** * True when any splat in the current pass sources geometry from the work buffer (see * GSplatResourceBase#supportsWorkBufferGeometry). Computed in update(); gates the * work-buffer-geometry uniform setup in execute() so non-opted-in passes skip it. * * @type {boolean} */ _usesWorkBufferGeometry: boolean; /** @type {Float32Array} */ _modelScaleData: Float32Array; /** @type {Float32Array} */ _modelRotationData: Float32Array; /** @type {Float32Array} */ _cameraPositionData: Float32Array; /** @type {Int32Array} */ _textureSize: Int32Array; /** * Shared grow-only texture holding packed sub-draw data for all partial renders in a frame. * * @type {Texture} */ _subDrawTexture: Texture; /** * Flat array of interleaved [baseOffset, count] pairs, parallel to this.splats. * For splat at index i: _partialData[i*2] = base offset into _subDrawTexture, * _partialData[i*2+1] = sub-draw count (0 means use splat's own sub-draws). * * @type {number[]} */ _partialData: number[]; /** * Initialize the render pass with the specified render target. * * @param {RenderTarget} renderTarget - The target to render to. */ init(renderTarget: RenderTarget): void; /** * Update the render pass with splats to render and camera. * * @param {GSplatInfo[]} splats - Array of GSplatInfo objects to render. * @param {GraphNode} cameraNode - The camera node for rendering. * @param {number[][]|undefined} colorsByLod - Optional array of RGB colors per LOD index. * @param {Set<number>|null} [changedAllocIds] - Set of changed allocIds for partial render. * @returns {boolean} True if there are splats to render, false otherwise. */ update(splats: GSplatInfo[], cameraNode: GraphNode, colorsByLod: number[][] | undefined, changedAllocIds?: Set<number> | null): boolean; /** * Render a single splat info object. Optionally renders only a subset of sub-draws * using an override texture and count (for partial work buffer updates). * * @param {GSplatInfo} splatInfo - The splat info to render. * @param {Texture} [overrideSubDrawTexture] - Override sub-draw texture for partial renders. * @param {number} [overrideSubDrawCount] - Override sub-draw count for partial renders. * @param {number} [subDrawBase] - Base offset into the sub-draw texture. */ renderSplat(splatInfo: GSplatInfo, overrideSubDrawTexture?: Texture, overrideSubDrawCount?: number, subDrawBase?: number): void; } import { RenderPass } from '../../platform/graphics/render-pass.js'; import type { GSplatInfo } from './gsplat-info.js'; import type { GraphNode } from '../graph-node.js'; import type { GSplatWorkBuffer } from './gsplat-work-buffer.js'; import { Texture } from '../../platform/graphics/texture.js'; import type { RenderTarget } from '../../platform/graphics/render-target.js';