EffectLayer

The effect layer Helps adding post process effect blended with the main pass.

This can be for instance use to generate glow or higlight effects on the scene.

The effect layer class can not be used directly and is intented to inherited from to be customized per effects.

Hierarchy

Index

Constructors

constructor

  • Instantiates a new effect Layer and references it in the scene.

    Parameters

    • name: string

      The name of the layer

    • scene: Scene

      The scene to use the layer in

    Returns EffectLayer

Properties

camera

camera: Nullable<Camera>

Gets the camera attached to the layer.

isEnabled

isEnabled: boolean

Specifies wether the highlight layer is enabled or not.

name

name: string

The name of the layer

neutralColor

neutralColor: Color4

The clear color of the texture used to generate the glow map.

onAfterComposeObservable

onAfterComposeObservable: Observable<EffectLayer>

An event triggered when the generated texture has been merged in the scene.

onBeforeComposeObservable

onBeforeComposeObservable: Observable<EffectLayer>

An event triggered when the generated texture is being merged in the scene.

onBeforeRenderMainTextureObservable

onBeforeRenderMainTextureObservable: Observable<EffectLayer>

An event triggered when the effect layer is about rendering the main texture with the glowy parts.

onDisposeObservable

onDisposeObservable: Observable<EffectLayer>

An event triggered when the effect layer has been disposed.

onSizeChangedObservable

onSizeChangedObservable: Observable<EffectLayer>

An event triggered when the efffect layer changes its size.

Methods

dispose

  • dispose(): void
  • Dispose the highlight layer and free resources.

    Returns void

disposeMesh

  • disposeMesh(mesh: Mesh): void
  • Free any resources and references associated to a mesh. Internal use

    Parameters

    • mesh: Mesh

      The mesh to free.

    Returns void

getClassName

  • getClassName(): string
  • Gets the class name of the effect layer

    Returns string

    the string with the class name of the effect layer

Abstract getEffectName

  • getEffectName(): string
  • Get the effect name of the layer.

    Returns string

    The effect name

hasMesh

  • Determine if a given mesh will be used in the current effect.

    Parameters

    Returns boolean

    true if the mesh will be used

Abstract isReady

  • isReady(subMesh: SubMesh, useInstances: boolean): boolean
  • Checks for the readiness of the element composing the layer.

    Parameters

    • subMesh: SubMesh

      the mesh to check for

    • useInstances: boolean

      specify wether or not to use instances to render the mesh

    Returns boolean

    true if ready otherwise, false

Abstract needStencil

  • needStencil(): boolean
  • Returns wether or nood the layer needs stencil enabled during the mesh rendering.

    Returns boolean

    true if the effect requires stencil during the main canvas render pass.

render

  • render(): void
  • Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.

    Returns void

Optional Abstract serialize

  • serialize(): any
  • Serializes this layer (Glow or Highlight for example)

    Returns any

    a serialized layer object

shouldRender

  • shouldRender(): boolean
  • Returns true if the layer contains information to display, otherwise false.

    Returns boolean

    true if the glow layer should be rendered

Static Parse

  • Creates an effect layer from parsed effect layer data

    Parameters

    • parsedEffectLayer: any

      defines effect layer data

    • scene: Scene

      defines the current scene

    • rootUrl: string

      defines the root URL containing the effect layer information

    Returns EffectLayer

    a parsed effect Layer

Generated using TypeDoc