TODO - Re-document after ESM refactor. An abstract base class which defines a framework for effect sources which originate radially from a specific point. This abstraction is used by the LightSource, VisionSource, SoundSource, and MovementSource subclasses.

Example: A standard PointSource lifecycle:

const source = new PointSource({object}); // Create the point source
source.initialize(data); // Configure the point source with new data
source.refresh(); // Refresh the point source
source.destroy(); // Destroy the point source

Abstract

Type Parameters

  • SourceData
  • SourceShape

Hierarchy (view full)

Constructors

Properties

object: object

Some other object which is responsible for this source.

sourceId: string

The source id linked to this effect source.

data: SourceData = ...

The data of this source.

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.

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

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

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

defaultData: SourceData = ...

Effect source default data.

Accessors

  • 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

  • Initialize and configure the source using provided data.

    Parameters

    • data: Partial<SourceData> = {}

      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

  • Subclass specific data initialization steps.

    Parameters

    • data: Partial<SourceData>

      Provided data for configuration

    Returns void

    Abstract

  • 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

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

    Returns void

    Abstract

  • Protected

    Subclass specific configuration steps. Occurs after data initialization and shape computation. Only called if the source is attached and not disabled.

    Parameters

    • changes: Partial<SourceData>

      Changes to the source data which were applied

    Returns void

  • Protected

    Subclass-specific refresh steps.

    Returns void

    Abstract

  • Protected

    Subclass specific destruction steps.

    Returns void