A specialized subclass of the BaseLightSource which renders a source of darkness as a point-based effect.

Mixes

Hierarchy (view full)

Constructors

Properties

edges: Edge[] = []

The Edge instances added by this darkness source.

ratio: number = 1

A ratio of dim:bright as part of the source radius

_visualShape: SourceShape

The optional geometric shape is solely utilized for visual representation regarding darkness sources. Used only when an additional radius is added for visuals.

_padding: number = ...

Padding applied on the darkness source shape for visual appearance only. Note: for now, padding is increased radius. It might evolve in a future release.

#borderDistance: number = 0

The normalized border distance.

effectsCollection: string = "darknessSources"
_dimLightingLevel: number = LIGHTING_LEVELS.HALFDARK
_brightLightingLevel: number = LIGHTING_LEVELS.DARKNESS
sourceType: string = "light"
_initializeShaderKeys: string[] = ...
_refreshUniformsKeys: string[] = ...
defaultData: any = ...

Effect source default data.

EDGE_OFFSET: number = -8

The offset in pixels applied to create soft edges.

Accessors

  • get darkness(): PointSourceMesh
  • A convenience accessor to the darkness layer mesh.

    Returns PointSourceMesh

  • get ANIMATIONS(): any
  • Returns any

  • get _layers(): {
        darkness: {
            defaultShader: any;
            blendMode: string;
        };
    }
  • Returns {
        darkness: {
            defaultShader: any;
            blendMode: string;
        };
    }

    • darkness: {
          defaultShader: any;
          blendMode: string;
      }
      • defaultShader: any
      • blendMode: string

Methods

  • Returns void

    Inherit Doc

  • Parameters

    • changes: any

    Returns void

    Inherit Doc

  • Returns any

    Inherit Doc

  • Returns void

  • Update the uniforms of the shader on the darkness layer.

    Returns void

  • Returns void

    Inherit Doc

  • An animation with flickering ratio and light intensity.

    Parameters

    • dt: number

      Delta time

    • Optional options: {
          speed: number;
          intensity: number;
          reverse: boolean;
      } = {}

      Additional options which modify the flame animation

      • speed: number

        The animation speed, from 0 to 10

      • intensity: number

        The animation intensity, from 1 to 10

      • reverse: boolean

        Reverse the animation direction

    Returns void

  • An animation with flickering ratio and light intensity

    Parameters

    • dt: number

      Delta time

    • Optional options: {
          speed: number;
          intensity: number;
          amplification: number;
          reverse: boolean;
      } = {}

      Additional options which modify the flame animation

      • speed: number

        The animation speed, from 0 to 10

      • intensity: number

        The animation intensity, from 1 to 10

      • amplification: number

        Noise amplification (>1) or dampening (<1)

      • reverse: boolean

        Reverse the animation direction

    Returns void

  • A basic "pulse" animation which expands and contracts.

    Parameters

    • dt: number

      Delta time

    • Optional options: {
          speed: number;
          intensity: number;
          reverse: boolean;
      } = {}

      Additional options which modify the pulse animation

      • speed: number

        The animation speed, from 0 to 10

      • intensity: number

        The animation intensity, from 1 to 10

      • reverse: boolean

        Reverse the animation direction

    Returns void

  • Create a radius constrained polygon from the visual shape polygon. If the visual shape is not created, no polygon is created.

    Parameters

    • radius: number

      The radius to constraint to.

    Returns PointSourcePolygon

    The new polygon or null if no visual shape is present.

  • Create the Edge instances that correspond to this darkness source.

    Returns void

  • Remove edges from the active Edges collection.

    Returns void

  • Get corrected level according to level and active vision mode data.

    Parameters

    • level: LIGHTING_LEVELS

    Returns number

    The corrected level.

  • Get corrected color according to level, dim color, bright color and background color.

    Parameters

    • level: LIGHTING_LEVELS
    • colorDim: typeof Color
    • colorBright: typeof Color
    • Optional colorBackground: typeof Color

    Returns typeof Color