playcanvas
Version:
PlayCanvas WebGL game engine
69 lines (68 loc) • 2.66 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 SOGS data.
*/
constructor(resource: GSplatResourceBase, options?: {
material?: ShaderMaterial | null;
highQualitySH?: boolean;
});
/** @type {GSplatResourceBase} */
resource: GSplatResourceBase;
/** @type {Texture} */
orderTexture: Texture;
/** @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;
/**
* @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;
updateViewport(cameraNode: any): 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 { 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';