UNPKG

@babylonjs/core

Version:

Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.

151 lines (150 loc) 6.59 kB
import { type SubMesh } from "../../Meshes/subMesh.js"; import { type AbstractMesh } from "../../Meshes/abstractMesh.js"; import { type Mesh } from "../../Meshes/mesh.js"; import { type Effect } from "../../Materials/effect.js"; import { type Scene } from "../../scene.js"; import { type Matrix } from "../../Maths/math.vector.js"; import { type GaussianSplattingMesh } from "../../Meshes/GaussianSplatting/gaussianSplattingMesh.js"; import { type AbstractEngine } from "../../Engines/abstractEngine.js"; import { PushMaterial } from "../../Materials/pushMaterial.js"; import { ShadowDepthWrapper } from "../../Materials/shadowDepthWrapper.js"; import { ShaderMaterial } from "../../Materials/shaderMaterial.js"; import "../../Shaders/gaussianSplatting.fragment.js"; import "../../Shaders/gaussianSplatting.vertex.js"; import "../../ShadersWGSL/gaussianSplatting.fragment.js"; import "../../ShadersWGSL/gaussianSplatting.vertex.js"; import "../../Shaders/gaussianSplattingDepth.fragment.js"; import "../../Shaders/gaussianSplattingDepth.vertex.js"; import "../../ShadersWGSL/gaussianSplattingDepth.fragment.js"; import "../../ShadersWGSL/gaussianSplattingDepth.vertex.js"; import { ShaderLanguage } from "../shaderLanguage.js"; /** * Computes the maximum number of Gaussian Splatting compound parts supported by the given engine. * The limit is derived from the engine's maximum vertex uniform vectors capability. * @param engine - The engine to compute the limit for * @returns The maximum number of parts supported */ export declare function GetGaussianSplattingMaxPartCount(engine: AbstractEngine): number; /** * @deprecated Use {@link GetGaussianSplattingMaxPartCount} with an engine instance instead. */ export declare const GaussianSplattingMaxPartCount = 128; /** * GaussianSplattingMaterial material used to render Gaussian Splatting * @experimental */ export declare class GaussianSplattingMaterial extends PushMaterial { /** * Instantiates a Gaussian Splatting Material in the given scene * @param name The friendly name of the material * @param scene The scene to add the material to */ constructor(name: string, scene?: Scene); /** * Point spread function (default 0.3). Can be overriden per GS material */ static KernelSize: number; /** * Compensation */ static Compensation: boolean; /** * Point spread function (default 0.3). Can be overriden per GS material, otherwise, using default static `KernelSize` value */ kernelSize: number; private _compensation; private _isDirty; /** * Set compensation default value is `GaussianSplattingMaterial.Compensation` */ set compensation(value: boolean); /** * Get compensation */ get compensation(): boolean; /** * Gets a boolean indicating that current material needs to register RTT */ get hasRenderTargetTextures(): boolean; /** * Specifies whether or not this material should be rendered in alpha test mode. * @returns false */ needAlphaTesting(): boolean; /** * Specifies whether or not this material should be rendered in alpha blend mode. * @returns true */ needAlphaBlending(): boolean; protected static _Attribs: string[]; protected static _Samplers: string[]; protected static _UniformBuffers: string[]; protected static _Uniforms: string[]; private _sourceMesh; /** * Checks whether the material is ready to be rendered for a given mesh. * @param mesh The mesh to render * @param subMesh The submesh to check against * @returns true if all the dependencies are ready (Textures, Effects...) */ isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh): boolean; /** * GaussianSplattingMaterial belongs to a single mesh * @param mesh mesh this material belongs to */ setSourceMesh(mesh: GaussianSplattingMesh): void; /** * Gets the source mesh of this material, which is the Gaussian Splatting mesh that provides the data for rendering * @returns The Gaussian Splatting mesh that provides the data for rendering, or null if not set */ getSourceMesh(): GaussianSplattingMesh | null; /** * Bind material effect for a specific Gaussian Splatting mesh * @param mesh Gaussian splatting mesh * @param effect Splatting material or node material * @param scene scene that contains mesh and camera used for rendering */ static BindEffect(mesh: Mesh, effect: Effect, scene: Scene): void; /** * Binds the submesh to this material by preparing the effect and shader to draw * @param world defines the world transformation matrix * @param mesh defines the mesh containing the submesh * @param subMesh defines the submesh to bind the material to */ bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void; protected static _BindEffectUniforms(gsMesh: GaussianSplattingMesh, gsMaterial: GaussianSplattingMaterial, shaderMaterial: ShaderMaterial, scene: Scene): void; /** * Create a depth rendering material for a Gaussian Splatting mesh * @param scene scene it belongs to * @param shaderLanguage GLSL or WGSL * @param alphaBlendedDepth whether to enable alpha blended depth rendering * @param compoundMesh whether the mesh is a compound mesh * @returns depth rendering shader material */ makeDepthRenderingMaterial(scene: Scene, shaderLanguage: ShaderLanguage, alphaBlendedDepth?: boolean, compoundMesh?: boolean): ShaderMaterial; protected static _MakeGaussianSplattingShadowDepthWrapper(scene: Scene, shaderLanguage: ShaderLanguage): ShadowDepthWrapper; /** * Clones the material. * @param name The cloned name. * @returns The cloned material. */ clone(name: string): GaussianSplattingMaterial; /** * Serializes the current material to its JSON representation. * @returns The JSON representation. */ serialize(): any; /** * Gets the class name of the material * @returns "GaussianSplattingMaterial" */ getClassName(): string; /** * Parse a JSON input to create back a Gaussian Splatting material. * @param source The JSON data to parse * @param scene The scene to create the parsed material in * @param rootUrl The root url of the assets the material depends upon * @returns the instantiated GaussianSplattingMaterial. */ static Parse(source: any, scene: Scene, rootUrl: string): GaussianSplattingMaterial; }