Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Layer

This represents a full screen 2d layer. This can be useful to display a picture in the background of your scene for instance.

see

https://www.babylonjs-playground.com/#08A2BS#1

Hierarchy

  • Layer

Index

Constructors

constructor

  • Instantiates a new layer. This represents a full screen 2d layer. This can be useful to display a picture in the background of your scene for instance.

    see

    https://www.babylonjs-playground.com/#08A2BS#1

    Parameters

    • name: string

      Define the name of the layer in the scene

    • imgUrl: Nullable<string>

      Define the url of the texture to display in the layer

    • scene: Nullable<Scene>

      Define the scene the layer belongs to

    • Optional isBackground: boolean

      Defines whether the layer is displayed in front or behind the scene

    • Optional color: Color4

      Defines a color for the layer

    Returns Layer

Properties

alphaBlendingModeSearch playground for alphaBlendingMode

alphaBlendingMode: number

Define the alpha blending mode used in the layer in case the texture or color has an alpha.

alphaTestSearch playground for alphaTest

alphaTest: boolean

Define if the layer should alpha test or alpha blend with the rest of the scene. Alpha test will not mix with the background color in case of transparency. It will either use the texture color or the background depending on the alpha value of the current pixel.

colorSearch playground for color

color: Color4

Define the color of the layer (instead of texture).

isBackgroundSearch playground for isBackground

isBackground: boolean

Is the layer in background or foreground.

layerMaskSearch playground for layerMask

layerMask: number

Define a mask to restrict the layer to only some of the scene cameras.

nameSearch playground for name

name: string

Define the name of the layer.

offsetSearch playground for offset

offset: Vector2

Define an offset for the layer in order to shift the texture.

onAfterRenderObservableSearch playground for onAfterRenderObservable

onAfterRenderObservable: Observable<Layer>

An event triggered after rendering the scene

onBeforeRenderObservableSearch playground for onBeforeRenderObservable

onBeforeRenderObservable: Observable<Layer>

An event triggered before rendering the scene

onDisposeObservableSearch playground for onDisposeObservable

onDisposeObservable: Observable<Layer>

An event triggered when the layer is disposed.

renderOnlyInRenderTargetTexturesSearch playground for renderOnlyInRenderTargetTextures

renderOnlyInRenderTargetTextures: boolean

Define if the layer is only used in renderTarget or if it also renders in the main frame buffer of the canvas.

renderTargetTexturesSearch playground for renderTargetTextures

renderTargetTextures: RenderTargetTexture[]

Define the list of render target the layer is visible into.

scaleSearch playground for scale

scale: Vector2

Define the scale of the layer in order to zoom in out of the texture.

textureSearch playground for texture

texture: Nullable<Texture>

Define the texture the layer should display.

Accessors

onAfterRender

  • set onAfterRender(callback: () => void): any
  • Back compatibility with callback before the onAfterRenderObservable existed. The set callback will be triggered just after rendering the layer.

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns any

onBeforeRender

  • set onBeforeRender(callback: () => void): any
  • Back compatibility with callback before the onBeforeRenderObservable existed. The set callback will be triggered just before rendering the layer.

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns any

onDispose

  • set onDispose(callback: () => void): any
  • Back compatibility with callback before the onDisposeObservable existed. The set callback will be triggered when the layer has been disposed.

    Parameters

    • callback: () => void
        • (): void
        • Returns void

    Returns any

Methods

disposeSearch playground for dispose

  • dispose(): void
  • Disposes and releases the associated ressources.

    Returns void

renderSearch playground for render

  • render(): void
  • Renders the layer in the scene.

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Static method