import type { Nullable } from "../types"; import type { Scene } from "../scene"; import type { AbstractMesh } from "../Meshes/abstractMesh"; import type { SubMesh } from "../Meshes/subMesh"; import type { BaseTexture } from "../Materials/Textures/baseTexture"; import { Material } from "../Materials/material"; /** * A multi-material is used to apply different materials to different parts of the same object without the need of * separate meshes. This can be use to improve performances. * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials */ export declare class MultiMaterial extends Material { private _subMaterials; /** @internal */ _waitingSubMaterialsUniqueIds: string[]; /** * Gets or Sets the list of Materials used within the multi material. * They need to be ordered according to the submeshes order in the associated mesh */ get subMaterials(): Nullable[]; set subMaterials(value: Nullable[]); /** * Function used to align with Node.getChildren() * @returns the list of Materials used within the multi material */ getChildren(): Nullable[]; /** * Instantiates a new Multi Material * A multi-material is used to apply different materials to different parts of the same object without the need of * separate meshes. This can be use to improve performances. * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials * @param name Define the name in the scene * @param scene Define the scene the material belongs to */ constructor(name: string, scene?: Scene); private _hookArray; /** * Get one of the submaterial by its index in the submaterials array * @param index The index to look the sub material at * @returns The Material if the index has been defined */ getSubMaterial(index: number): Nullable; /** * Get the list of active textures for the whole sub materials list. * @returns All the textures that will be used during the rendering */ getActiveTextures(): BaseTexture[]; /** * Specifies if any sub-materials of this multi-material use a given texture. * @param texture Defines the texture to check against this multi-material's sub-materials. * @returns A boolean specifying if any sub-material of this multi-material uses the texture. */ hasTexture(texture: BaseTexture): boolean; /** * Gets the current class name of the material e.g. "MultiMaterial" * Mainly use in serialization. * @returns the class name */ getClassName(): string; /** * Checks if the material is ready to render the requested sub mesh * @param mesh Define the mesh the submesh belongs to * @param subMesh Define the sub mesh to look readiness for * @param useInstances Define whether or not the material is used with instances * @returns true if ready, otherwise false */ isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean; /** * Clones the current material and its related sub materials * @param name Define the name of the newly cloned material * @param cloneChildren Define if submaterial will be cloned or shared with the parent instance * @returns the cloned material */ clone(name: string, cloneChildren?: boolean): MultiMaterial; /** * Serializes the materials into a JSON representation. * @returns the JSON representation */ serialize(): any; /** * Dispose the material and release its associated resources * @param forceDisposeEffect Define if we want to force disposing the associated effect (if false the shader is not released and could be reuse later on) * @param forceDisposeTextures Define if we want to force disposing the associated textures (if false, they will not be disposed and can still be use elsewhere in the app) * @param forceDisposeChildren Define if we want to force disposing the associated submaterials (if false, they will not be disposed and can still be use elsewhere in the app) */ dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean, forceDisposeChildren?: boolean): void; /** * Creates a MultiMaterial from parsed MultiMaterial data. * @param parsedMultiMaterial defines parsed MultiMaterial data. * @param scene defines the hosting scene * @returns a new MultiMaterial */ static ParseMultiMaterial(parsedMultiMaterial: any, scene: Scene): MultiMaterial; }