Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IShadowGenerator

Interface to implement to create a shadow generator compatible with BJS.

Hierarchy

  • IShadowGenerator

Implemented by

Index

Properties

idSearch playground for id

id: string

Gets or set the id of the shadow generator. It will be the one from the light if not defined

Methods

bindShadowLightSearch playground for bindShadowLight

  • bindShadowLight(lightIndex: string, effect: Effect): void
  • Binds the shadow related information inside of an effect (information like near, far, darkness... defined in the generator but impacting the effect). It implies the uniforms available on the materials are the standard BJS ones.

    Parameters

    • lightIndex: string

      Index of the light in the enabled light list of the material owning the effect

    • effect: Effect

      The effect we are binding the information for

    Returns void

disposeSearch playground for dispose

  • dispose(): void
  • Disposes the Shadow map and related Textures and effects.

    Returns void

forceCompilationSearch playground for forceCompilation

  • forceCompilation(onCompiled?: (generator: IShadowGenerator) => void, options?: Partial<{ useInstances: boolean }>): void
  • Forces all the attached effect to compile to enable rendering only once ready vs. lazily compiling effects.

    Parameters

    • Optional onCompiled: (generator: IShadowGenerator) => void

      Callback triggered at the and of the effects compilation

    • Optional options: Partial<{ useInstances: boolean }>

      Sets of optional options forcing the compilation with different modes

    Returns void

forceCompilationAsyncSearch playground for forceCompilationAsync

  • forceCompilationAsync(options?: Partial<{ useInstances: boolean }>): Promise<void>
  • Forces all the attached effect to compile to enable rendering only once ready vs. lazily compiling effects.

    Parameters

    • Optional options: Partial<{ useInstances: boolean }>

      Sets of optional options forcing the compilation with different modes

    Returns Promise<void>

    A promise that resolves when the compilation completes

getShadowMapSearch playground for getShadowMap

  • Gets the main RTT containing the shadow map (usually storing depth from the light point of view).

    Returns Nullable<RenderTargetTexture>

    The render target texture if present otherwise, null

getTransformMatrixSearch playground for getTransformMatrix

  • getTransformMatrix(): Matrix
  • Gets the transformation matrix used to project the meshes into the map from the light point of view. (eq to shadow projection matrix * light transform matrix)

    Returns Matrix

    The transform matrix used to create the shadow map

isReadySearch playground for isReady

  • isReady(subMesh: SubMesh, useInstances: boolean, isTransparent: boolean): boolean
  • Determine whether the shadow generator is ready or not (mainly all effects and related post processes needs to be ready).

    Parameters

    • subMesh: SubMesh

      The submesh we want to render in the shadow map

    • useInstances: boolean

      Defines whether will draw in the map using instances

    • isTransparent: boolean

      Indicates that isReady is called for a transparent subMesh

    Returns boolean

    true if ready otherwise, false

prepareDefinesSearch playground for prepareDefines

  • Prepare all the defines in a material relying on a shadow map at the specified light index.

    Parameters

    • defines: MaterialDefines

      Defines of the material we want to update

    • lightIndex: number

      Index of the light in the enabled light list of the material

    Returns void

recreateShadowMapSearch playground for recreateShadowMap

  • recreateShadowMap(): void
  • Recreates the shadow map dependencies like RTT and post processes. This can be used during the switch between Cube and 2D textures for instance.

    Returns void

serializeSearch playground for serialize

  • serialize(): any
  • Serializes the shadow generator setup to a json object.

    Returns any

    The serialized JSON object

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method