An abstract class which extends the base PointSource to provide common functionality for rendering. This class is extended by both the LightSource and VisionSource subclasses.

Abstract

Hierarchy (view full)

Constructors

Properties

The animation configuration applied to this source

layers: {
    background: RenderedEffectSourceLayer;
    coloration: RenderedEffectSourceLayer;
    illumination: RenderedEffectSourceLayer;
} = ...

Track the status of rendering layers

Type declaration

colorRGB: [number, number, number] = null

The color of the source as an RGB vector.

object: object

Some other object which is responsible for this source.

sourceId: string

The source id linked to this effect source.

The data of this source.

shape: any

The geometric shape of the effect source which is generated later.

suppression: Record<string, boolean> = {}

Records of suppression strings with a boolean value. If any of this record is true, the source is suppressed.

_geometry: any = null

PIXI Geometry generated to draw meshes.

_flags: Record<string, number | boolean> = {}

A collection of boolean flags which control rendering and refresh behavior for the source.

#updateUniformsFunctions: Function[] = ...

Array of update uniforms functions.

EDGE_OFFSET: number = -8

The offset in pixels applied to create soft edges.

defaultData: any = ...

Effect source default data.

sourceType: string

The type of source represented by this data structure. Each subclass must implement this attribute.

effectsCollection: string

The target collection into the effects canvas group.

Abstract

_initializeShaderKeys: string[] = ...

Keys of the data object which require shaders to be re-initialized.

_refreshUniformsKeys: string[] = []

Keys of the data object which require uniforms to be refreshed.

Accessors

  • get isAnimated(): boolean
  • Is the rendered source animated?

    Returns boolean

  • get hasActiveLayer(): boolean
  • Has the rendered source at least one active layer?

    Returns boolean

  • get isPreview(): boolean
  • Is this RenderedEffectSource a temporary preview?

    Returns boolean

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

    Returns PointSourceMesh

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

    Returns PointSourceMesh

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

    Returns PointSourceMesh

  • get x(): number
  • The x-coordinate of the point source origin.

    Returns number

  • get y(): number
  • The y-coordinate of the point source origin.

    Returns number

  • get elevation(): number
  • The elevation bound to this source.

    Returns number

  • get effectsCollection(): Collection<string, BaseEffectSource<any, any>>
  • The EffectsCanvasGroup collection linked to this effect source.

    Returns Collection<string, BaseEffectSource<any, any>>

  • get updateId(): number
  • Returns the update ID associated with this source. The update ID is increased whenever the shape of the source changes.

    Returns number

  • get active(): boolean
  • Is this source currently active? A source is active if it is attached to an effect collection and is not disabled or suppressed.

    Returns boolean

  • get attached(): boolean
  • Is this source attached to an effect collection?

    Returns boolean

  • get suppressed(): boolean
  • Is this source temporarily suppressed?

    Returns boolean

Methods

  • Subclass specific data initialization steps.

    Parameters

    • data: any

      Provided data for configuration

    Returns void

    Abstract

  • Render the containers used to represent this light source within the LightingLayer

    Returns {
        background: Mesh;
        coloration: Mesh;
        illumination: Mesh;
    }

    • background: Mesh
    • coloration: Mesh
    • illumination: Mesh
  • Animate the PointSource, if an animation is enabled and if it currently has rendered containers.

    Parameters

    • dt: number

      Delta time.

    Returns any

  • Generic time-based animation used for Rendered Point Sources.

    Parameters

    • dt: number

      Delta time.

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

      Options which affect the time 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

  • Initialize and configure the source using provided data.

    Parameters

    • data: Partial<BaseEffectSourceData & RenderedEffectSourceData> = {}

      Provided data for configuration

    • options: {
          behaviors: object;
          reset: boolean;
      } = {}

      Additional options which modify source initialization

      • behaviors: object

        An object containing optional behaviors to apply.

      • reset: boolean

        Should source data be reset to default values before applying changes?

    Returns BaseEffectSource<any, any>

    The initialized source

  • Refresh the state and uniforms of the source. Only active sources are refreshed.

    Returns void

  • Steps that must be performed when the source is destroyed.

    Returns void

  • Add this BaseEffectSource instance to the active collection.

    Returns void

  • Remove this BaseEffectSource instance from the active collection.

    Returns void

  • Protected

    Decide whether to render soft edges with a blur.

    Returns void

  • Protected

    Specific configuration for a layer.

    Parameters

    • layer: object
    • layerId: string

    Returns void

  • Protected

    Create the geometry for the source shape that is used in shaders and compute its bounds for culling purpose. Triangulate the form and create buffers.

    Returns void

    Abstract

  • Protected

    Create a Mesh for a certain rendered layer of this source.

    Parameters

    • layerId: string

      The layer key in layers to draw

    Returns any

    The drawn mesh for this layer, or null if no mesh is required

  • Protected

    Update shader uniforms used by every rendered layer.

    Parameters

    • shader: AbstractBaseShader

    Returns void

  • Protected

    Update shader uniforms used for the background layer.

    Returns void

  • Protected

    Update shader uniforms used for the coloration layer.

    Returns void

  • Protected

    Update shader uniforms used for the illumination layer.

    Returns void

  • Protected

    Create the polygon shape (or shapes) for this source using configured data.

    Returns void

    Abstract

  • Private

    Configure which shaders are used for each rendered layer.

    Returns {
        background: AdaptiveLightingShader;
        coloration: AdaptiveLightingShader;
        illumination: AdaptiveLightingShader;
    }

    • background: AdaptiveLightingShader
    • coloration: AdaptiveLightingShader
    • illumination: AdaptiveLightingShader
  • Initialize the shaders used for this source, swapping to a different shader if the animation has changed.

    Returns void

  • Initialize the geometry and the meshes.

    Returns void

  • Create meshes for each layer of the RenderedEffectSource that is drawn to the canvas.

    Returns void

  • Create a new Mesh for this source using a provided shader class

    Parameters

    • shaderCls: any

      The shader class used for this mesh

    Returns PointSourceMesh

    The created Mesh

  • Update uniforms for all rendered layers.

    Returns void

  • Update the visible state of the component channels of this RenderedEffectSource.

    Returns boolean

    Is there an active layer?

  • 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

  • Create a new shader using a provider shader class

    Parameters

    • cls: any

      The shader class to create

    • container: PointSourceMesh

      The container which requires a new shader

    Returns AdaptiveLightingShader

    The shader instance used