@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.
891 lines (890 loc) • 32.4 kB
TypeScript
import type { IAnimatable } from "../Animations/animatable.interface.js";
import type { SmartArray } from "../Misc/smartArray.js";
import { Observable } from "../Misc/observable.js";
import type { Nullable } from "../types.js";
import type { Matrix } from "../Maths/math.vector.js";
import { SubMesh } from "../Meshes/subMesh.js";
import type { AbstractMesh } from "../Meshes/abstractMesh.js";
import { UniformBuffer } from "./uniformBuffer.js";
import type { Effect } from "./effect.js";
import type { BaseTexture } from "../Materials/Textures/baseTexture.js";
import type { RenderTargetTexture } from "../Materials/Textures/renderTargetTexture.js";
import type { MaterialDefines } from "./materialDefines.js";
import type { IInspectable } from "../Misc/iInspectable.js";
import { Plane } from "../Maths/math.plane.js";
import type { ShadowDepthWrapper } from "./shadowDepthWrapper.js";
import type { IMaterialContext } from "../Engines/IMaterialContext.js";
import { DrawWrapper } from "./drawWrapper.js";
import { MaterialStencilState } from "./materialStencilState.js";
import type { Scene } from "../scene.js";
import type { MaterialPluginDisposed, MaterialPluginIsReadyForSubMesh, MaterialPluginGetDefineNames, MaterialPluginBindForSubMesh, MaterialPluginGetActiveTextures, MaterialPluginHasTexture, MaterialPluginGetAnimatables, MaterialPluginPrepareDefines, MaterialPluginPrepareEffect, MaterialPluginPrepareUniformBuffer, MaterialPluginCreated, MaterialPluginFillRenderTargetTextures, MaterialPluginHasRenderTargetTextures, MaterialPluginHardBindForSubMesh } from "./materialPluginEvent.js";
import type { ShaderCustomProcessingFunction } from "../Engines/Processors/shaderProcessingOptions.js";
import type { IClipPlanesHolder } from "../Misc/interfaces/iClipPlanesHolder.js";
import type { PrePassRenderer } from "../Rendering/prePassRenderer.js";
import type { Mesh } from "../Meshes/mesh.js";
import type { Animation } from "../Animations/animation.js";
import { ShaderLanguage } from "./shaderLanguage.js";
import type { IAssetContainer } from "../IAssetContainer.js";
/**
* Options for compiling materials.
*/
export interface IMaterialCompilationOptions {
/**
* Defines whether clip planes are enabled.
*/
clipPlane: boolean;
/**
* Defines whether instances are enabled.
*/
useInstances: boolean;
}
/**
* Options passed when calling customShaderNameResolve
*/
export interface ICustomShaderNameResolveOptions {
/**
* If provided, will be called two times with the vertex and fragment code so that this code can be updated before it is compiled by the GPU
*/
processFinalCode?: Nullable<ShaderCustomProcessingFunction>;
}
/**
* Base class for the main features of a material in Babylon.js
*/
export declare class Material implements IAnimatable, IClipPlanesHolder {
/**
* Returns the triangle fill mode
*/
static readonly TriangleFillMode = 0;
/**
* Returns the wireframe mode
*/
static readonly WireFrameFillMode = 1;
/**
* Returns the point fill mode
*/
static readonly PointFillMode = 2;
/**
* Returns the point list draw mode
*/
static readonly PointListDrawMode = 3;
/**
* Returns the line list draw mode
*/
static readonly LineListDrawMode = 4;
/**
* Returns the line loop draw mode
*/
static readonly LineLoopDrawMode = 5;
/**
* Returns the line strip draw mode
*/
static readonly LineStripDrawMode = 6;
/**
* Returns the triangle strip draw mode
*/
static readonly TriangleStripDrawMode = 7;
/**
* Returns the triangle fan draw mode
*/
static readonly TriangleFanDrawMode = 8;
/**
* Stores the clock-wise side orientation
*/
static readonly ClockWiseSideOrientation = 0;
/**
* Stores the counter clock-wise side orientation
*/
static readonly CounterClockWiseSideOrientation = 1;
/**
* The dirty image processing flag value
*/
static readonly ImageProcessingDirtyFlag = 64;
/**
* The dirty texture flag value
*/
static readonly TextureDirtyFlag = 1;
/**
* The dirty light flag value
*/
static readonly LightDirtyFlag = 2;
/**
* The dirty fresnel flag value
*/
static readonly FresnelDirtyFlag = 4;
/**
* The dirty attribute flag value
*/
static readonly AttributesDirtyFlag = 8;
/**
* The dirty misc flag value
*/
static readonly MiscDirtyFlag = 16;
/**
* The dirty prepass flag value
*/
static readonly PrePassDirtyFlag = 32;
/**
* The all dirty flag value
*/
static readonly AllDirtyFlag = 127;
/**
* MaterialTransparencyMode: No transparency mode, Alpha channel is not use.
*/
static readonly MATERIAL_OPAQUE = 0;
/**
* MaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.
*/
static readonly MATERIAL_ALPHATEST = 1;
/**
* MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
*/
static readonly MATERIAL_ALPHABLEND = 2;
/**
* MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
* They are also discarded below the alpha cutoff threshold to improve performances.
*/
static readonly MATERIAL_ALPHATESTANDBLEND = 3;
/**
* The Whiteout method is used to blend normals.
* Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/
*/
static readonly MATERIAL_NORMALBLENDMETHOD_WHITEOUT = 0;
/**
* The Reoriented Normal Mapping method is used to blend normals.
* Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/
*/
static readonly MATERIAL_NORMALBLENDMETHOD_RNM = 1;
/**
* Event observable which raises global events common to all materials (like MaterialPluginEvent.Created)
*/
static OnEventObservable: Observable<Material>;
/**
* Custom callback helping to override the default shader used in the material.
*/
customShaderNameResolve: (shaderName: string, uniforms: string[], uniformBuffers: string[], samplers: string[], defines: MaterialDefines | string[], attributes?: string[], options?: ICustomShaderNameResolveOptions) => string;
/**
* Custom shadow depth material to use for shadow rendering instead of the in-built one
*/
shadowDepthWrapper: Nullable<ShadowDepthWrapper>;
/**
* Gets or sets a boolean indicating that the material is allowed (if supported) to do shader hot swapping.
* This means that the material can keep using a previous shader while a new one is being compiled.
* This is mostly used when shader parallel compilation is supported (true by default)
*/
allowShaderHotSwapping: boolean;
/** Shader language used by the material */
protected _shaderLanguage: ShaderLanguage;
protected _forceGLSL: boolean;
/** @internal */
get _supportGlowLayer(): boolean;
/** @internal */
set _glowModeEnabled(value: boolean);
/**
* Gets the shader language used in this material.
*/
get shaderLanguage(): ShaderLanguage;
/**
* The ID of the material
*/
id: string;
/**
* Gets or sets the unique id of the material
*/
uniqueId: number;
/** @internal */
_loadedUniqueId: string;
/**
* The name of the material
*/
name: string;
/**
* Gets or sets user defined metadata
*/
metadata: any;
/** @internal */
_internalMetadata: any;
/**
* For internal use only. Please do not use.
*/
reservedDataStore: any;
/**
* Specifies if the ready state should be checked on each call
*/
checkReadyOnEveryCall: boolean;
/**
* Specifies if the ready state should be checked once
*/
checkReadyOnlyOnce: boolean;
/**
* The state of the material
*/
state: string;
/**
* If the material can be rendered to several textures with MRT extension
*/
get canRenderToMRT(): boolean;
/**
* The alpha value of the material
*/
protected _alpha: number;
/**
* List of inspectable custom properties (used by the Inspector)
* @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility
*/
inspectableCustomProperties: IInspectable[];
/**
* Sets the alpha value of the material
*/
set alpha(value: number);
/**
* Gets the alpha value of the material
*/
get alpha(): number;
/**
* Specifies if back face culling is enabled
*/
protected _backFaceCulling: boolean;
/**
* Sets the culling state (true to enable culling, false to disable)
*/
set backFaceCulling(value: boolean);
/**
* Gets the culling state
*/
get backFaceCulling(): boolean;
/**
* Specifies if back or front faces should be culled (when culling is enabled)
*/
protected _cullBackFaces: boolean;
/**
* Sets the type of faces that should be culled (true for back faces, false for front faces)
*/
set cullBackFaces(value: boolean);
/**
* Gets the type of faces that should be culled
*/
get cullBackFaces(): boolean;
private _blockDirtyMechanism;
/**
* Block the dirty-mechanism for this specific material
* When set to false after being true the material will be marked as dirty.
*/
get blockDirtyMechanism(): boolean;
set blockDirtyMechanism(value: boolean);
/**
* This allows you to modify the material without marking it as dirty after every change.
* This function should be used if you need to make more than one dirty-enabling change to the material - adding a texture, setting a new fill mode and so on.
* The callback will pass the material as an argument, so you can make your changes to it.
* @param callback the callback to be executed that will update the material
*/
atomicMaterialsUpdate(callback: (material: this) => void): void;
/**
* Stores the value for side orientation
*/
sideOrientation: Nullable<number>;
/**
* Callback triggered when the material is compiled
*/
onCompiled: Nullable<(effect: Effect) => void>;
/**
* Callback triggered when an error occurs
*/
onError: Nullable<(effect: Effect, errors: string) => void>;
/**
* Callback triggered to get the render target textures
*/
getRenderTargetTextures: Nullable<() => SmartArray<RenderTargetTexture>>;
/**
* Gets a boolean indicating that current material needs to register RTT
*/
get hasRenderTargetTextures(): boolean;
/**
* Specifies if the material should be serialized
*/
doNotSerialize: boolean;
/**
* @internal
*/
_storeEffectOnSubMeshes: boolean;
/**
* Stores the animations for the material
*/
animations: Nullable<Array<Animation>>;
/**
* An event triggered when the material is disposed
*/
onDisposeObservable: Observable<Material>;
/**
* An observer which watches for dispose events
*/
private _onDisposeObserver;
private _onUnBindObservable;
/**
* Called during a dispose event
*/
set onDispose(callback: () => void);
private _onBindObservable;
/**
* An event triggered when the material is bound
*/
get onBindObservable(): Observable<AbstractMesh>;
/**
* An observer which watches for bind events
*/
private _onBindObserver;
/**
* Called during a bind event
*/
set onBind(callback: (Mesh: AbstractMesh) => void);
/**
* An event triggered when the material is unbound
*/
get onUnBindObservable(): Observable<Material>;
protected _onEffectCreatedObservable: Nullable<Observable<{
effect: Effect;
subMesh: Nullable<SubMesh>;
}>>;
/**
* An event triggered when the effect is (re)created
*/
get onEffectCreatedObservable(): Observable<{
effect: Effect;
subMesh: Nullable<SubMesh>;
}>;
/**
* Stores the value of the alpha mode
*/
private _alphaMode;
/**
* Sets the value of the alpha mode.
*
* | Value | Type | Description |
* | --- | --- | --- |
* | 0 | ALPHA_DISABLE | |
* | 1 | ALPHA_ADD | |
* | 2 | ALPHA_COMBINE | |
* | 3 | ALPHA_SUBTRACT | |
* | 4 | ALPHA_MULTIPLY | |
* | 5 | ALPHA_MAXIMIZED | |
* | 6 | ALPHA_ONEONE | |
* | 7 | ALPHA_PREMULTIPLIED | |
* | 8 | ALPHA_PREMULTIPLIED_PORTERDUFF | |
* | 9 | ALPHA_INTERPOLATE | |
* | 10 | ALPHA_SCREENMODE | |
*
*/
set alphaMode(value: number);
/**
* Gets the value of the alpha mode
*/
get alphaMode(): number;
/**
* Stores the state of the need depth pre-pass value
*/
private _needDepthPrePass;
/**
* Sets the need depth pre-pass value
*/
set needDepthPrePass(value: boolean);
/**
* Gets the depth pre-pass value
*/
get needDepthPrePass(): boolean;
/**
* Can this material render to prepass
*/
get isPrePassCapable(): boolean;
/**
* Specifies if depth writing should be disabled
*/
disableDepthWrite: boolean;
/**
* Specifies if color writing should be disabled
*/
disableColorWrite: boolean;
/**
* Specifies if depth writing should be forced
*/
forceDepthWrite: boolean;
/**
* Specifies the depth function that should be used. 0 means the default engine function
*/
depthFunction: number;
/**
* Specifies if there should be a separate pass for culling
*/
separateCullingPass: boolean;
/**
* Stores the state specifying if fog should be enabled
*/
private _fogEnabled;
/**
* Sets the state for enabling fog
*/
set fogEnabled(value: boolean);
/**
* Gets the value of the fog enabled state
*/
get fogEnabled(): boolean;
/**
* Stores the size of points
*/
pointSize: number;
/**
* Stores the z offset Factor value
*/
zOffset: number;
/**
* Stores the z offset Units value
*/
zOffsetUnits: number;
get wireframe(): boolean;
/**
* Sets the state of wireframe mode
*/
set wireframe(value: boolean);
/**
* Gets the value specifying if point clouds are enabled
*/
get pointsCloud(): boolean;
/**
* Sets the state of point cloud mode
*/
set pointsCloud(value: boolean);
/**
* Gets the material fill mode
*/
get fillMode(): number;
/**
* Sets the material fill mode
*/
set fillMode(value: number);
/**
* Gets or sets the active clipplane 1
*/
clipPlane: Nullable<Plane>;
/**
* Gets or sets the active clipplane 2
*/
clipPlane2: Nullable<Plane>;
/**
* Gets or sets the active clipplane 3
*/
clipPlane3: Nullable<Plane>;
/**
* Gets or sets the active clipplane 4
*/
clipPlane4: Nullable<Plane>;
/**
* Gets or sets the active clipplane 5
*/
clipPlane5: Nullable<Plane>;
/**
* Gets or sets the active clipplane 6
*/
clipPlane6: Nullable<Plane>;
/**
* Gives access to the stencil properties of the material
*/
readonly stencil: MaterialStencilState;
protected _useLogarithmicDepth: boolean;
/**
* In case the depth buffer does not allow enough depth precision for your scene (might be the case in large scenes)
* You can try switching to logarithmic depth.
* @see https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/logarithmicDepthBuffer
*/
get useLogarithmicDepth(): boolean;
set useLogarithmicDepth(value: boolean);
/**
* @internal
* Stores the effects for the material
*/
_materialContext: IMaterialContext | undefined;
protected _drawWrapper: DrawWrapper;
/** @internal */
_getDrawWrapper(): DrawWrapper;
/**
* @internal
*/
_setDrawWrapper(drawWrapper: DrawWrapper): void;
/**
* Specifies if uniform buffers should be used
*/
private _useUBO;
/**
* Stores a reference to the scene
*/
private _scene;
protected _needToBindSceneUbo: boolean;
/**
* Stores the fill mode state
*/
private _fillMode;
/**
* Specifies if the depth write state should be cached
*/
private _cachedDepthWriteState;
/**
* Specifies if the color write state should be cached
*/
private _cachedColorWriteState;
/**
* Specifies if the depth function state should be cached
*/
private _cachedDepthFunctionState;
/**
* Stores the uniform buffer
* @internal
*/
_uniformBuffer: UniformBuffer;
/** @internal */
_indexInSceneMaterialArray: number;
/** @internal */
meshMap: Nullable<{
[id: string]: AbstractMesh | undefined;
}>;
/** @internal */
_parentContainer: Nullable<IAssetContainer>;
/** @internal */
_dirtyCallbacks: {
[code: number]: () => void;
};
/** @internal */
_uniformBufferLayoutBuilt: boolean;
protected _eventInfo: MaterialPluginCreated & MaterialPluginDisposed & MaterialPluginHasTexture & MaterialPluginIsReadyForSubMesh & MaterialPluginGetDefineNames & MaterialPluginPrepareEffect & MaterialPluginPrepareDefines & MaterialPluginPrepareUniformBuffer & MaterialPluginBindForSubMesh & MaterialPluginGetAnimatables & MaterialPluginGetActiveTextures & MaterialPluginFillRenderTargetTextures & MaterialPluginHasRenderTargetTextures & MaterialPluginHardBindForSubMesh;
/** @internal */
_callbackPluginEventGeneric: (id: number, info: MaterialPluginGetActiveTextures | MaterialPluginGetAnimatables | MaterialPluginHasTexture | MaterialPluginDisposed | MaterialPluginGetDefineNames | MaterialPluginPrepareEffect | MaterialPluginPrepareUniformBuffer) => void;
/** @internal */
_callbackPluginEventIsReadyForSubMesh: (eventData: MaterialPluginIsReadyForSubMesh) => void;
/** @internal */
_callbackPluginEventPrepareDefines: (eventData: MaterialPluginPrepareDefines) => void;
/** @internal */
_callbackPluginEventPrepareDefinesBeforeAttributes: (eventData: MaterialPluginPrepareDefines) => void;
/** @internal */
_callbackPluginEventHardBindForSubMesh: (eventData: MaterialPluginHardBindForSubMesh) => void;
/** @internal */
_callbackPluginEventBindForSubMesh: (eventData: MaterialPluginBindForSubMesh) => void;
/** @internal */
_callbackPluginEventHasRenderTargetTextures: (eventData: MaterialPluginHasRenderTargetTextures) => void;
/** @internal */
_callbackPluginEventFillRenderTargetTextures: (eventData: MaterialPluginFillRenderTargetTextures) => void;
/**
* Creates a material instance
* @param name defines the name of the material
* @param scene defines the scene to reference
* @param doNotAdd specifies if the material should be added to the scene
* @param forceGLSL Use the GLSL code generation for the shader (even on WebGPU). Default is false
*/
constructor(name: string, scene?: Nullable<Scene>, doNotAdd?: boolean, forceGLSL?: boolean);
/** @internal */
_createUniformBuffer(): void;
/**
* Returns a string representation of the current material
* @param fullDetails defines a boolean indicating which levels of logging is desired
* @returns a string with material information
*/
toString(fullDetails?: boolean): string;
/**
* Gets the class name of the material
* @returns a string with the class name of the material
*/
getClassName(): string;
/** @internal */
get _isMaterial(): boolean;
/**
* Specifies if updates for the material been locked
*/
get isFrozen(): boolean;
/**
* Locks updates for the material
*/
freeze(): void;
/**
* Unlocks updates for the material
*/
unfreeze(): void;
/**
* Specifies if the material is ready to be used
* @param mesh defines the mesh to check
* @param useInstances specifies if instances should be used
* @returns a boolean indicating if the material is ready to be used
*/
isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean;
/**
* Specifies that the submesh is ready to be used
* @param mesh defines the mesh to check
* @param subMesh defines which submesh to check
* @param useInstances specifies that instances should be used
* @returns a boolean indicating that the submesh is ready or not
*/
isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
/**
* Returns the material effect
* @returns the effect associated with the material
*/
getEffect(): Nullable<Effect>;
/**
* Returns the current scene
* @returns a Scene
*/
getScene(): Scene;
/** @internal */
_getEffectiveOrientation(mesh: Mesh): number;
/**
* The transparency mode of the material.
*/
protected _transparencyMode: Nullable<number>;
/**
* Gets the current transparency mode.
*/
get transparencyMode(): Nullable<number>;
/**
* Sets the transparency mode of the material.
*
* | Value | Type | Description |
* | ----- | ----------------------------------- | ----------- |
* | 0 | OPAQUE | |
* | 1 | ALPHATEST | |
* | 2 | ALPHABLEND | |
* | 3 | ALPHATESTANDBLEND | |
*
*/
set transparencyMode(value: Nullable<number>);
protected get _hasTransparencyMode(): boolean;
protected get _transparencyModeIsBlend(): boolean;
protected get _transparencyModeIsTest(): boolean;
/**
* Returns true if alpha blending should be disabled.
*/
protected get _disableAlphaBlending(): boolean;
/**
* Specifies whether or not this material should be rendered in alpha blend mode.
* @returns a boolean specifying if alpha blending is needed
* @deprecated Please use needAlphaBlendingForMesh instead
*/
needAlphaBlending(): boolean;
/**
* Specifies if the mesh will require alpha blending
* @param mesh defines the mesh to check
* @returns a boolean specifying if alpha blending is needed for the mesh
*/
needAlphaBlendingForMesh(mesh: AbstractMesh): boolean;
/**
* Specifies whether or not this material should be rendered in alpha test mode.
* @returns a boolean specifying if an alpha test is needed.
* @deprecated Please use needAlphaTestingForMesh instead
*/
needAlphaTesting(): boolean;
/**
* Specifies if material alpha testing should be turned on for the mesh
* @param mesh defines the mesh to check
* @returns a boolean specifying if alpha testing should be turned on for the mesh
*/
needAlphaTestingForMesh(mesh: AbstractMesh): boolean;
/**
* Gets the texture used for the alpha test
* @returns the texture to use for alpha testing
*/
getAlphaTestTexture(): Nullable<BaseTexture>;
/**
* Marks the material to indicate that it needs to be re-calculated
* @param forceMaterialDirty - Forces the material to be marked as dirty for all components (same as this.markAsDirty(Material.AllDirtyFlag)). You should use this flag if the material is frozen and you want to force a recompilation.
*/
markDirty(forceMaterialDirty?: boolean): void;
/**
* @internal
*/
_preBind(effect?: Effect | DrawWrapper, overrideOrientation?: Nullable<number>): boolean;
/**
* Binds the material to the mesh
* @param world defines the world transformation matrix
* @param mesh defines the mesh to bind the material to
*/
bind(world: Matrix, mesh?: Mesh): void;
/**
* Initializes the uniform buffer layout for the shader.
*/
buildUniformLayout(): void;
/**
* Binds the submesh to the material
* @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;
/**
* Binds the world matrix to the material
* @param world defines the world transformation matrix
*/
bindOnlyWorldMatrix(world: Matrix): void;
/**
* Binds the view matrix to the effect
* @param effect defines the effect to bind the view matrix to
*/
bindView(effect: Effect): void;
/**
* Binds the view projection and projection matrices to the effect
* @param effect defines the effect to bind the view projection and projection matrices to
*/
bindViewProjection(effect: Effect): void;
/**
* Binds the view matrix to the effect
* @param effect defines the effect to bind the view matrix to
* @param variableName name of the shader variable that will hold the eye position
*/
bindEyePosition(effect: Effect, variableName?: string): void;
/**
* Processes to execute after binding the material to a mesh
* @param mesh defines the rendered mesh
* @param effect defines the effect used to bind the material
* @param _subMesh defines the subMesh that the material has been bound for
*/
protected _afterBind(mesh?: AbstractMesh, effect?: Nullable<Effect>, _subMesh?: SubMesh): void;
/**
* Unbinds the material from the mesh
*/
unbind(): void;
/**
* Returns the animatable textures.
* @returns - Array of animatable textures.
*/
getAnimatables(): IAnimatable[];
/**
* Gets the active textures from the material
* @returns an array of textures
*/
getActiveTextures(): BaseTexture[];
/**
* Specifies if the material uses a texture
* @param texture defines the texture to check against the material
* @returns a boolean specifying if the material uses the texture
*/
hasTexture(texture: BaseTexture): boolean;
/**
* Makes a duplicate of the material, and gives it a new name
* @param name defines the new name for the duplicated material
* @returns the cloned material
*/
clone(name: string): Nullable<Material>;
protected _clonePlugins(targetMaterial: Material, rootUrl: string): void;
/**
* Gets the meshes bound to the material
* @returns an array of meshes bound to the material
*/
getBindedMeshes(): AbstractMesh[];
/**
* Force shader compilation
* @param mesh defines the mesh associated with this material
* @param onCompiled defines a function to execute once the material is compiled
* @param options defines the options to configure the compilation
* @param onError defines a function to execute if the material fails compiling
*/
forceCompilation(mesh: AbstractMesh, onCompiled?: (material: Material) => void, options?: Partial<IMaterialCompilationOptions>, onError?: (reason: string) => void): void;
/**
* Force shader compilation
* @param mesh defines the mesh that will use this material
* @param options defines additional options for compiling the shaders
* @returns a promise that resolves when the compilation completes
*/
forceCompilationAsync(mesh: AbstractMesh, options?: Partial<IMaterialCompilationOptions>): Promise<void>;
private static readonly _AllDirtyCallBack;
private static readonly _ImageProcessingDirtyCallBack;
private static readonly _TextureDirtyCallBack;
private static readonly _FresnelDirtyCallBack;
private static readonly _MiscDirtyCallBack;
private static readonly _PrePassDirtyCallBack;
private static readonly _LightsDirtyCallBack;
private static readonly _AttributeDirtyCallBack;
private static _FresnelAndMiscDirtyCallBack;
private static _TextureAndMiscDirtyCallBack;
private static readonly _DirtyCallbackArray;
private static readonly _RunDirtyCallBacks;
/**
* Marks a define in the material to indicate that it needs to be re-computed
* @param flag defines a flag used to determine which parts of the material have to be marked as dirty
*/
markAsDirty(flag: number): void;
/**
* Resets the draw wrappers cache for all submeshes that are using this material
*/
resetDrawCache(): void;
/**
* Marks all submeshes of a material to indicate that their material defines need to be re-calculated
* @param func defines a function which checks material defines against the submeshes
*/
protected _markAllSubMeshesAsDirty(func: (defines: MaterialDefines) => void): void;
/**
* Indicates that the scene should check if the rendering now needs a prepass
*/
protected _markScenePrePassDirty(): void;
/**
* Indicates that we need to re-calculated for all submeshes
*/
protected _markAllSubMeshesAsAllDirty(): void;
/**
* Indicates that image processing needs to be re-calculated for all submeshes
*/
protected _markAllSubMeshesAsImageProcessingDirty(): void;
/**
* Indicates that textures need to be re-calculated for all submeshes
*/
protected _markAllSubMeshesAsTexturesDirty(): void;
/**
* Indicates that fresnel needs to be re-calculated for all submeshes
*/
protected _markAllSubMeshesAsFresnelDirty(): void;
/**
* Indicates that fresnel and misc need to be re-calculated for all submeshes
*/
protected _markAllSubMeshesAsFresnelAndMiscDirty(): void;
/**
* Indicates that lights need to be re-calculated for all submeshes
*/
protected _markAllSubMeshesAsLightsDirty(): void;
/**
* Indicates that attributes need to be re-calculated for all submeshes
*/
protected _markAllSubMeshesAsAttributesDirty(): void;
/**
* Indicates that misc needs to be re-calculated for all submeshes
*/
protected _markAllSubMeshesAsMiscDirty(): void;
/**
* Indicates that prepass needs to be re-calculated for all submeshes
*/
protected _markAllSubMeshesAsPrePassDirty(): void;
/**
* Indicates that textures and misc need to be re-calculated for all submeshes
*/
protected _markAllSubMeshesAsTexturesAndMiscDirty(): void;
protected _checkScenePerformancePriority(): void;
/**
* Sets the required values to the prepass renderer.
* @param prePassRenderer defines the prepass renderer to setup.
* @returns true if the pre pass is needed.
*/
setPrePassRenderer(prePassRenderer: PrePassRenderer): boolean;
/**
* Disposes the material
* @param _forceDisposeEffect kept for backward compat. We reference count the effect now.
* @param forceDisposeTextures specifies if textures should be forcefully disposed
* @param notBoundToMesh specifies if the material that is being disposed is known to be not bound to any mesh
*/
dispose(_forceDisposeEffect?: boolean, forceDisposeTextures?: boolean, notBoundToMesh?: boolean): void;
private _disposeMeshResources;
/**
* Serializes this material
* @returns the serialized material object
*/
serialize(): any;
protected _serializePlugins(serializationObject: any): void;
/**
* Creates a material from parsed material data
* @param parsedMaterial defines parsed material data
* @param scene defines the hosting scene
* @param rootUrl defines the root URL to use to load textures
* @returns a new material
*/
static Parse(parsedMaterial: any, scene: Scene, rootUrl: string): Nullable<Material>;
protected static _ParsePlugins(serializationObject: any, material: Material, scene: Scene, rootUrl: string): void;
}