playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
79 lines (78 loc) • 3.15 kB
TypeScript
/** @ignore */
export class GSplatInstance {
/**
* @param {GSplatResourceBase} resource - The splat instance.
* @param {object} [options] - Options for the instance.
* @param {ShaderMaterial|null} [options.material] - The material instance.
* @param {boolean} [options.highQualitySH] - Whether to use the high quality or the approximate spherical harmonic calculation. Only applies to SOG data.
* @param {import('../scene.js').Scene} [options.scene] - The scene to fire sort timing events on.
*/
constructor(resource: GSplatResourceBase, options?: {
material?: ShaderMaterial | null;
highQualitySH?: boolean;
scene?: import("../scene.js").Scene;
});
/** @type {GSplatResourceBase} */
resource: GSplatResourceBase;
/** @type {Texture|undefined} */
orderTexture: Texture | undefined;
/** @type {StorageBuffer|undefined} */
orderBuffer: StorageBuffer | undefined;
/** @type {ShaderMaterial} */
_material: ShaderMaterial;
/** @type {MeshInstance} */
meshInstance: MeshInstance;
options: {};
/** @type {GSplatSorter|null} */
sorter: GSplatSorter | null;
lastCameraPosition: Vec3;
lastCameraDirection: Vec3;
/** @type {GSplatResolveSH|null} */
resolveSH: GSplatResolveSH | null;
/**
* List of cameras this instance is visible for. Updated every frame by the renderer.
*
* @type {Camera[]}
* @ignore
*/
cameras: Camera[];
destroy(): void;
/**
* Set order data parameters on the material.
*
* @param {ShaderMaterial} material - The material to configure.
*/
setMaterialOrderData(material: ShaderMaterial): void;
/**
* @param {ShaderMaterial} value - The material instance.
*/
set material(value: ShaderMaterial);
get material(): ShaderMaterial;
/**
* Configure the material with gsplat instance and resource properties.
*
* @param {ShaderMaterial} material - The material to configure.
* @param {object} [options] - Object for passing optional arguments.
* @param {boolean} [options.dither] - Specify true to configure the material for dithered rendering (stochastic alpha).
*/
configureMaterial(material: ShaderMaterial, options?: {
dither?: boolean;
}): void;
/**
* Sorts the GS vertices based on the given camera.
* @param {GraphNode} cameraNode - The camera node used for sorting.
*/
sort(cameraNode: GraphNode): void;
update(): void;
setHighQualitySH(value: any): void;
}
import { GSplatResourceBase } from './gsplat-resource-base.js';
import type { Texture } from '../../platform/graphics/texture.js';
import { StorageBuffer } from '../../platform/graphics/storage-buffer.js';
import { ShaderMaterial } from '../materials/shader-material.js';
import { MeshInstance } from '../mesh-instance.js';
import { GSplatSorter } from './gsplat-sorter.js';
import { Vec3 } from '../../core/math/vec3.js';
import { GSplatResolveSH } from './gsplat-resolve-sh.js';
import type { Camera } from '../camera.js';
import type { GraphNode } from '../graph-node.js';