playcanvas
Version:
PlayCanvas WebGL game engine
98 lines (97 loc) • 3.94 kB
TypeScript
/**
* Base class for a GSplat resource and defines common properties.
*
* @ignore
*/
export class GSplatResourceBase {
static createMesh(device: any): Mesh;
static createInstanceIndices(device: any, splatCount: any): VertexBuffer;
static get instanceSize(): number;
constructor(device: any, gsplatData: any);
/** @type {GraphicsDevice} */
device: GraphicsDevice;
/** @type {GSplatData | GSplatCompressedData | GSplatSogsData} */
gsplatData: GSplatData | GSplatCompressedData | GSplatSogsData;
/** @type {Float32Array} */
centers: Float32Array;
/** @type {BoundingBox} */
aabb: BoundingBox;
/** @type {Mesh} */
mesh: Mesh;
/** @type {VertexBuffer} */
instanceIndices: VertexBuffer;
/** @type {number} */
id: number;
/** @type {Map<string, WorkBufferRenderInfo>} */
workBufferRenderInfos: Map<string, WorkBufferRenderInfo>;
/**
* @type {number}
* @private
*/
private _refCount;
destroy(): void;
/**
* Increments the reference count.
*
* @ignore
*/
incRefCount(): void;
/**
* Decrements the reference count.
*
* @ignore
*/
decRefCount(): void;
/**
* Gets the current reference count. This represents how many times this resource is currently
* being used internally by the engine. For {@link GSplatComponent#asset|assets} assigned to
* {@link GSplatComponent#unified|unified} gsplat components, this tracks active usage during
* rendering and sorting operations.
*
* Resources should not be unloaded while the reference count is non-zero, as they are still
* in use by the rendering pipeline.
*
* @type {number}
*/
get refCount(): number;
/**
* Get or create a QuadRender for rendering to work buffer.
*
* @param {boolean} useIntervals - Whether to use intervals.
* @param {number} colorTextureFormat - The format of the color texture (RGBA16F or RGBA16U).
* @param {boolean} colorOnly - Whether to render only color (not full MRT).
* @returns {WorkBufferRenderInfo} The WorkBufferRenderInfo instance.
*/
getWorkBufferRenderInfo(useIntervals: boolean, colorTextureFormat: number, colorOnly?: boolean): WorkBufferRenderInfo;
get numSplats(): any;
configureMaterial(material: any): void;
configureMaterialDefines(defines: any): void;
/**
* Evaluates the size of the texture based on the number of splats.
*
* @param {number} count - Number of gaussians.
* @returns {Vec2} Returns a Vec2 object representing the size of the texture.
*/
evalTextureSize(count: number): Vec2;
/**
* Creates a new texture with the specified parameters.
*
* @param {string} name - The name of the texture to be created.
* @param {number} format - The pixel format of the texture.
* @param {Vec2} size - The size of the texture in a Vec2 object, containing width (x) and height (y).
* @param {Uint8Array|Uint16Array|Uint32Array} [data] - The initial data to fill the texture with.
* @returns {Texture} The created texture instance.
*/
createTexture(name: string, format: number, size: Vec2, data?: Uint8Array | Uint16Array | Uint32Array): Texture;
instantiate(): void;
}
import type { GraphicsDevice } from '../../platform/graphics/graphics-device.js';
import type { GSplatData } from './gsplat-data.js';
import type { GSplatCompressedData } from './gsplat-compressed-data.js';
import type { GSplatSogsData } from './gsplat-sogs-data.js';
import { BoundingBox } from '../../core/shape/bounding-box.js';
import { Mesh } from '../mesh.js';
import { VertexBuffer } from '../../platform/graphics/vertex-buffer.js';
import { WorkBufferRenderInfo } from '../gsplat-unified/gsplat-work-buffer.js';
import { Vec2 } from '../../core/math/vec2.js';
import { Texture } from '../../platform/graphics/texture.js';