ShaderMaterial

Hierarchy

Implements

Index

Constructors

constructor

  • new ShaderMaterial(name: string, scene: Scene, shaderPath: any, options: any): ShaderMaterial

Properties

alpha

alpha: number

Sets the alpha value of the material

alphaMode

alphaMode: number

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

animations

animations: Array<Animation>

Stores the animations for the material

backFaceCulling

backFaceCulling: boolean

Sets the back-face culling state

checkReadyOnEveryCall

checkReadyOnEveryCall: boolean

Specifies if the ready state should be checked on each call

checkReadyOnlyOnce

checkReadyOnlyOnce: boolean

Specifies if the ready state should be checked once

disableDepthWrite

disableDepthWrite: boolean

Specifies if depth writing should be disabled

doNotSerialize

doNotSerialize: boolean

Specifies if the material should be serialized

fillMode

fillMode: number

Sets the material fill mode

fogEnabled

fogEnabled: boolean

Sets the state for enabling fog

forceDepthWrite

forceDepthWrite: boolean

Specifies if depth writing should be forced

getRenderTargetTextures

getRenderTargetTextures: function

Callback triggered to get the render target textures

id

id: string

The ID of the material

isFrozen

isFrozen: boolean

Specifies if updates for the material been locked

name

name: string

The name of the material

needDepthPrePass

needDepthPrePass: boolean

Sets the need depth pre-pass value

onBind

onBind: function

Called during a bind event

Type declaration

onBindObservable

onBindObservable: Observable<AbstractMesh>

An event triggered when the material is bound

onCompiled

onCompiled: function

Callback triggered when the material is compiled

Type declaration

    • Parameters

      Returns void

onDispose

onDispose: function

Called during a dispose event

Type declaration

    • (): void
    • Returns void

onDisposeObservable

onDisposeObservable: Observable<Material>

An event triggered when the material is disposed

onError

onError: function

Callback triggered when an error occurs

Type declaration

    • (effect: Effect, errors: string): void
    • Parameters

      • effect: Effect
      • errors: string

      Returns void

onUnBindObservable

onUnBindObservable: Observable<Material>

An event triggered when the material is unbound

pointSize

pointSize: number

Stores the size of points

pointsCloud

pointsCloud: boolean

Sets the state of point cloud mode

separateCullingPass

separateCullingPass: boolean

Specifies if there should be a separate pass for culling

sideOrientation

sideOrientation: number

Stores the value for side orientation

state

state: string

The state of the material

storeEffectOnSubMeshes

storeEffectOnSubMeshes: boolean

Specifies if the effect should be stored on sub meshes

uniqueId

uniqueId: number

Gets or sets the unique id of the material

wireframe

wireframe: boolean

Sets the state of wireframe mode

zOffset

zOffset: number

Stores the z offset value

Static AttributesDirtyFlag

AttributesDirtyFlag: number

Returns the dirty attributes flag value

Static ClockWiseSideOrientation

ClockWiseSideOrientation: number

Returns the clock-wise side orientation

Static CounterClockWiseSideOrientation

CounterClockWiseSideOrientation: number

Returns the counter clock-wise side orientation

Static FresnelDirtyFlag

FresnelDirtyFlag: number

Returns the dirty fresnel flag value

Static LightDirtyFlag

LightDirtyFlag: number

Returns the dirty light flag value

Static LineListDrawMode

LineListDrawMode: number

Returns the line list draw mode

Static LineLoopDrawMode

LineLoopDrawMode: number

Returns the line loop draw mode

Static LineStripDrawMode

LineStripDrawMode: number

Returns the line strip draw mode

Static MiscDirtyFlag

MiscDirtyFlag: number

Returns the dirty misc flag value

Static PointFillMode

PointFillMode: number

Returns the point fill mode

Static PointListDrawMode

PointListDrawMode: number

Returns the point list draw mode

Static TextureDirtyFlag

TextureDirtyFlag: number

Returns the dirty texture flag value

Static TriangleFanDrawMode

TriangleFanDrawMode: number

Returns the triangle fan draw mode

Static TriangleFillMode

TriangleFillMode: number

Returns the triangle fill mode

Static TriangleStripDrawMode

TriangleStripDrawMode: number

Returns the triangle strip draw mode

Static WireFrameFillMode

WireFrameFillMode: number

Returns the wireframe mode

Methods

bind

bindForSubMesh

  • Binds the submesh to the material

    Parameters

    • world: Matrix

      defines the world transformation matrix

    • mesh: Mesh

      defines the mesh containing the submesh

    • subMesh: SubMesh

      defines the submesh to bind the material to

    Returns void

bindOnlyWorldMatrix

  • bindOnlyWorldMatrix(world: Matrix): void

bindSceneUniformBuffer

  • Binds the scene's uniform buffer to the effect.

    Parameters

    • effect: Effect

      defines the effect to bind to the scene uniform buffer

    • sceneUbo: UniformBuffer

      defines the uniform buffer storing scene data

    Returns void

bindView

  • bindView(effect: Effect): void
  • Binds the view matrix to the effect

    Parameters

    • effect: Effect

      defines the effect to bind the view matrix to

    Returns void

bindViewProjection

  • bindViewProjection(effect: Effect): void
  • Binds the view projection matrix to the effect

    Parameters

    • effect: Effect

      defines the effect to bind the view projection matrix to

    Returns void

clone

dispose

  • dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void
  • Parameters

    • Optional forceDisposeEffect: boolean
    • Optional forceDisposeTextures: boolean

    Returns void

forceCompilation

  • forceCompilation(mesh: AbstractMesh, onCompiled?: function, options?: Partial<object>): void
  • Force shader compilation

    Parameters

    • mesh: AbstractMesh

      defines the mesh associated with this material

    • Optional onCompiled: function

      defines a function to execute once the material is compiled

    • Optional options: Partial<object>

      defines the options to configure the compilation

    Returns void

forceCompilationAsync

  • forceCompilationAsync(mesh: AbstractMesh, options?: Partial<object>): Promise<void>
  • Force shader compilation

    Parameters

    • mesh: AbstractMesh

      defines the mesh that will use this material

    • Optional options: Partial<object>

      defines additional options for compiling the shaders

    Returns Promise<void>

    a promise that resolves when the compilation completes

freeze

  • freeze(): void
  • Locks updates for the material

    Returns void

getActiveTextures

getAlphaTestTexture

getBindedMeshes

getClassName

  • getClassName(): string

getEffect

getScene

hasTexture

isReady

  • isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean

isReadyForSubMesh

  • Specifies that the submesh is ready to be used

    Parameters

    • mesh: AbstractMesh

      defines the mesh to check

    • subMesh: BaseSubMesh

      defines which submesh to check

    • Optional useInstances: boolean

      specifies that instances should be used

    Returns boolean

    a boolean indicating that the submesh is ready or not

markAsDirty

  • markAsDirty(flag: number): void
  • Marks a define in the material to indicate that it needs to be re-computed

    Parameters

    • flag: number

      defines a flag used to determine which parts of the material have to be marked as dirty

    Returns void

markDirty

  • markDirty(): void
  • Marks the material to indicate that it needs to be re-calculated

    Returns void

needAlphaBlending

  • needAlphaBlending(): boolean

needAlphaBlendingForMesh

  • Specifies if the mesh will require alpha blending

    Parameters

    Returns boolean

    a boolean specifying if alpha blending is needed for the mesh

needAlphaTesting

  • needAlphaTesting(): boolean

serialize

  • serialize(): any

setArray2

setArray3

setColor3

setColor3Array

setColor4

setFloat

setFloats

setInt

setMatrix

setMatrix2x2

setMatrix3x3

setTexture

setTextureArray

setVector2

setVector3

setVector4

toString

  • toString(fullDetails?: boolean): string
  • Returns a string representation of the current material

    Parameters

    • Optional fullDetails: boolean

      defines a boolean indicating which levels of logging is desired

    Returns string

    a string with material information

unbind

  • unbind(): void
  • Unbinds the material from the mesh

    Returns void

unfreeze

  • unfreeze(): void
  • Unlocks updates for the material

    Returns void

Static Parse

Static ParseMultiMaterial

  • Creates a MultiMaterial from parsed MultiMaterial data.

    Parameters

    • parsedMultiMaterial: any

      defines parsed MultiMaterial data.

    • scene: Scene

      defines the hosting scene

    Returns MultiMaterial

    a new MultiMaterial

Generated using TypeDoc