IShadowGenerator

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

Hierarchy

  • IShadowGenerator

Implemented by

Index

Methods

bindShadowLight

Find examples in Playground
  • 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 unifroms 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 binfing the information for

    Returns void

dispose

Find examples in Playground
  • dispose(): void
  • Disposes the Shadow map and related Textures and effects.

    Returns void

forceCompilation

Find examples in Playground
  • forceCompilation(onCompiled?: function, options?: Partial<object>): void
  • Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects.

    Parameters

    • Optional onCompiled: function

      Callback triggered at the and of the effects compilation

    • Optional options: Partial<object>

      Sets of optional options forcing the compilation with different modes

    Returns void

forceCompilationAsync

Find examples in Playground
  • forceCompilationAsync(options?: Partial<object>): Promise<void>
  • Forces all the attached effect to compile to enable rendering only once ready vs. lazyly compiling effects.

    Parameters

    • Optional options: Partial<object>

      Sets of optional options forcing the compilation with different modes

    Returns Promise<void>

    A promise that resolves when the compilation completes

getShadowMap

Find examples in Playground
  • 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

getShadowMapForRendering

Find examples in Playground
  • Gets the RTT used during rendering (can be a blurred version of the shadow map or the shadow map itself).

    Returns Nullable<RenderTargetTexture>

    The render target texture if the shadow map is present otherwise, null

getTransformMatrix

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

    Returns Matrix

    The transform matrix used to create the shadow map

isReady

Find examples in Playground
  • isReady(subMesh: SubMesh, useInstances: boolean): boolean
  • Determine wheter 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 wether will draw in the map using instances

    Returns boolean

    true if ready otherwise, false

prepareDefines

Find examples in Playground
  • 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

recreateShadowMap

Find examples in Playground
  • 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

serialize

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

    Returns any

    The serialized JSON object

Generated using TypeDoc