CLASSES
TagsA - Z

Material

Material

Description

class Material

Constructor

new Material(name, scene, doNotAdd)

Create a new Material. Everything to know about material can be found here : http://doc.babylonjs.com/tutorials/Materials And here : http://blogs.msdn.com/b/eternalcoding/archive/2013/07/01/babylon-js-unleash-the-standardmaterial-for-your-babylon-js-game.aspx

Parameters

Name Type Description
name string Name of the material
scene Scene
optional doNotAdd boolean Not add the material

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

ID of the material

name : string

Name of the material

checkReadyOnEveryCall : boolean

True to check if the material is ready on every call

checkReadyOnlyOnce : boolean

True to check if the material is ready only once

state : string

State of the material

alpha : number

Alpha of the material

backFaceCulling : boolean

True to not render material on back face

Default value : true

sideOrientation : number

onCompiled : Effect) => void

Callback function on compiled

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

Callback function on error

getRenderTargetTextures : () => SmartArray<RenderTargetTexture>

Get the render target textures

doNotSerialize : boolean

storeEffectOnSubMeshes : boolean

onDisposeObservable : Observable<Material>

An event triggered when the material is disposed.

@type {BABYLON.Observable}

onDispose : () => void

Callback function on dispose

onBindObservable : Observable<AbstractMesh>

An event triggered when the material is bound.

@type {BABYLON.Observable}

onBind : AbstractMesh) => void

onUnBindObservable : Observable<Material>

An event triggered when the material is unbound.

@type {BABYLON.Observable}

alphaMode : number

disableDepthWrite : boolean

fogEnabled : boolean

pointSize : number

zOffset : number

wireframe : boolean

True if this material should be rendered in wireframe ; False otherwise

Default value : False

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

markAsDirty(flag) void

Child classes can use it to update shaders

Parameters

Name Type Description
flag number

getClassName() string

freeze() void

unfreeze() void

isReady(mesh, useInstances) boolean

Function to know if material is ready @return boolean True if ready ; False if not

Parameters

Name Type Description
optional mesh AbstractMesh The mesh to bind
optional useInstances boolean

isReadyForSubMesh(mesh, subMesh, useInstances) boolean

Parameters

Name Type Description
mesh AbstractMesh The mesh to bind
subMesh SubMesh
optional useInstances boolean

getEffect() Effect

Get effect of the material @return Effect The effect

getScene() Scene

Get the scene which contain the material @return Scene The scene which contain the material

needAlphaBlending() boolean

Function to know if alpha is necessary (1.0 = no transparency) @return boolean True if alpha blending is needed ; False if not

needAlphaTesting() boolean

Function to know if alpha testing is necessary

getAlphaTestTexture() BaseTexture

Function to get the alpha test texture @return BaseTexture The alpha test texture

markDirty() void

bind(world, mesh) void

Function to bind the material

Parameters

Name Type Description
world Matrix The world matrix
optional mesh Mesh The mesh to bind

bindForSubMesh(world, mesh, subMesh) void

Parameters

Name Type Description
world Matrix The world matrix
mesh Mesh The mesh to bind
subMesh SubMesh

bindOnlyWorldMatrix(world) void

Function to bind only the world matrix

Parameters

Name Type Description
world Matrix The 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

Function to unbind

clone(name) Material

Parameters

Name Type Description
name string Name of the material

getBindedMeshes() AbstractMesh[]

dispose(forceDisposeEffect, forceDisposeTextures) void

Parameters

Name Type Description
optional forceDisposeEffect boolean True to force the dispose
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