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.

78 lines (77 loc) 2.89 kB
import type { Material } from "../Materials/material.js"; import { MaterialPluginBase } from "../Materials/materialPluginBase.js"; import type { Lattice } from "./lattice.js"; import { ShaderLanguage } from "../Materials/shaderLanguage.js"; import type { UniformBuffer } from "../Materials/uniformBuffer.js"; /** * Material plugin to add hardware accelerated lattice support * @see [webgl2](https://playground.babylonjs.com/#HBZD72#5) * @see [webgpu](https://playground.babylonjs.com/#HBZD72#6) */ export declare class LatticePluginMaterial extends MaterialPluginBase { private _lattice; private _latticeDataTexture; private _latticeData; private _code; /** * Create a new LatticePluginMaterial * @param lattice defines the lattice this plugin is associated with * @param material defines the material this plugin is associated with */ constructor(lattice: Lattice, material: Material); /** * Get the class name of the plugin * @returns the string "LatticePluginMaterial" */ getClassName(): string; /** * Defines if the plugin supports the specified shader language * @param shaderLanguage defines the shader language to check * @returns true if supported, false otherwise */ isCompatible(shaderLanguage: ShaderLanguage): boolean; /** * Must be called when the lattice data was updated */ refreshData(): void; /** * Gets the description of the uniforms to add to the ubo (if engine supports ubos) or to inject directly in the vertex/fragment shaders (if engine does not support ubos) * @param shaderLanguage The shader language to use. * @returns the description of the uniforms */ getUniforms(shaderLanguage?: ShaderLanguage): { ubo: { name: string; size: number; type: string; arraySize?: number; }[]; vertex?: string; fragment?: string; }; /** * Binds the material data. * @param uniformBuffer defines the Uniform buffer to fill in. */ bindForSubMesh(uniformBuffer: UniformBuffer): void; /** * Gets the samplers used by the plugin. * @param samplers list that the sampler names should be added to. */ getSamplers(samplers: string[]): void; private _prepareCode; /** * Returns a list of custom shader code fragments to customize the shader. * @param shaderType "vertex" or "fragment" * @param shaderLanguage The shader language to use. * @returns null if no code to be added, or a list of pointName =\> code. */ getCustomCode(shaderType: string, shaderLanguage?: ShaderLanguage): { CUSTOM_VERTEX_DEFINITIONS: string; CUSTOM_VERTEX_UPDATE_POSITION: string; } | null; /** * Disposes the resources of the material. */ dispose(): void; }