Material

Material

Description

class Material

Constructor

new Material(name, scene, doNotAdd)

Parameters

Name Type Description
name string
scene Scene
optional doNotAdd boolean

Members

static TriangleFillMode : number

static WireFrameFillMode : number

static PointFillMode : number

static ClockWiseSideOrientation : number

static CounterClockWiseSideOrientation : number

static TextureDirtyFlag : number

static LightDirtyFlag : number

static FresnelDirtyFlag : number

static AttributesDirtyFlag : number

static MiscDirtyFlag : number

id : string

name : string

checkReadyOnEveryCall : boolean

checkReadyOnlyOnce : boolean

state : string

alpha : number

backFaceCulling : boolean

sideOrientation : number

onCompiled : (effect: Effect) => void

Parameters

Name Type Description
effect Effect

onError : (effect: Effect, errors: string) => void

Parameters

Name Type Description
effect Effect
errors string

getRenderTargetTextures : () => SmartArray<RenderTargetTexture>

doNotSerialize : boolean

storeEffectOnSubMeshes : boolean

animations : Array<Animation>

onDisposeObservable : Observable<Material>

An event triggered when the material is disposed.

@type {BABYLON.Observable}

onDispose : () => void

onBindObservable : Observable<AbstractMesh>

An event triggered when the material is bound.

@type {BABYLON.Observable}

onBind : (Mesh: AbstractMesh) => void

Parameters

Name Type Description
Mesh AbstractMesh

onUnBindObservable : Observable<Material>

An event triggered when the material is unbound.

@type {BABYLON.Observable}

alphaMode : number

needDepthPrePass : boolean

disableDepthWrite : boolean

forceDepthWrite : boolean

separateCullingPass : boolean

fogEnabled : boolean

pointSize : number

zOffset : number

wireframe : boolean

pointsCloud : boolean

fillMode : number

isFrozen : boolean

Methods

toString(fullDetails) string

subclasses should override adding information pertainent to themselves

Parameters

Name Type Description
optional fullDetails boolean

getClassName() string

Child classes can use it to update shaders

freeze() void

unfreeze() void

isReady(mesh, useInstances) boolean

Parameters

Name Type Description
optional mesh AbstractMesh
optional useInstances boolean

isReadyForSubMesh(mesh, subMesh, useInstances) boolean

Parameters

Name Type Description
mesh AbstractMesh
subMesh BaseSubMesh
optional useInstances boolean

getEffect() Nullable<Effect>

getScene() Scene

needAlphaBlending() boolean

needAlphaBlendingForMesh(mesh) boolean

Parameters

Name Type Description
mesh AbstractMesh

needAlphaTesting() boolean

getAlphaTestTexture() Nullable<BaseTexture>

markDirty() void

bind(world, mesh) void

Parameters

Name Type Description
world Matrix
optional mesh Mesh

bindForSubMesh(world, mesh, subMesh) void

Parameters

Name Type Description
world Matrix
mesh Mesh
subMesh SubMesh

bindOnlyWorldMatrix(world) void

Parameters

Name Type Description
world Matrix

bindSceneUniformBuffer(effect, sceneUbo) void

Parameters

Name Type Description
effect Effect
sceneUbo UniformBuffer

bindView(effect) void

Parameters

Name Type Description
effect Effect

bindViewProjection(effect) void

Parameters

Name Type Description
effect Effect

unbind() void

getActiveTextures() BaseTexture[]

hasTexture(texture) boolean

Parameters

Name Type Description
texture BaseTexture

clone(name) Nullable<Material>

Parameters

Name Type Description
name string

getBindedMeshes() AbstractMesh[]

forceCompilation(mesh, onCompiled, options) void

Force shader compilation including textures ready check

Parameters

Name Type Description
mesh AbstractMesh
optional onCompiled material Material

|

markAsDirty(flag) void

Parameters

Name Type Description
flag number

dispose(forceDisposeEffect, forceDisposeTextures) void

Parameters

Name Type Description
optional forceDisposeEffect boolean
optional forceDisposeTextures boolean

serialize() any

static ParseMultiMaterial(parsedMultiMaterial, scene) MultiMaterial

Parameters

Name Type Description
parsedMultiMaterial any
scene Scene

static Parse(parsedMaterial, scene, rootUrl) any

Parameters

Name Type Description
parsedMaterial any
scene Scene
rootUrl string