phaser - v4.0.0-rc.4
    Preparing search index...

    Provides methods for enabling lighting effects on a Game Object.

    This should only be applied to GameObjects that have RenderNodes.

    interface Lighting {
        lighting: boolean;
        selfShadow: Object;
        setLighting(enable: boolean): this;
        setSelfShadow(
            enabled?: boolean,
            penumbra?: number,
            diffuseFlatThreshold?: number,
        ): this;
    }

    Implemented by

    Index

    Properties

    lighting: boolean

    Should this GameObject use lighting?

    This flag is used to set up WebGL shaders for rendering.

    selfShadow: Object

    Should this GameObject use self-shadowing? Self-shadowing is only enabled if lighting is enabled.

    The game config option render.selfShadow is used if this is not a boolean.

    This flag is used to set up WebGL shaders for rendering.

    Methods

    • Sets whether this GameObject should use lighting.

      Parameters

      • enable: boolean

        true to use lighting, or false to disable it.

      Returns this

    • Sets whether this GameObject should use self-shadowing. Self-shadowing is only enabled if lighting is also enabled.

      Parameters

      • Optionalenabled: boolean

        true to use self-shadowing, false to disable it, null to use the game default from config.render.selfShadow, or undefined to keep the setting.

      • Optionalpenumbra: number

        The penumbra value for the shadow. Lower is sharper but more jagged. Default is 0.5.

      • OptionaldiffuseFlatThreshold: number

        The texture brightness threshold at which the diffuse lighting will be considered flat. Range is 0-1. Default is 1/3.

      Returns this