Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Hierarchy

Index

Constructors

Properties

The animation configuration applied to this source

data: PointSourceData = ...

The object of data which configures how the source is rendered

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

Track the status of rendering layers

Type declaration

colorRGB: [number, number, number] = null

The color of the source as a RGB vector.

object: any

The polygonal shape of the point source, generated from its origin, radius, and other data.

_flags: Object = {}

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

#geometry: any = null

PIXI Geometry generated to draw meshes.

#hasActiveLayer: boolean = false
#updateId: number = 0
#active: boolean = false
#initialized: boolean = false
EDGE_OFFSET: number = -8

The offset in pixels applied to create soft edges.

sourceType: string

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

_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

  • A convenience accessor to the background layer mesh.

    Returns PointSourceMesh

  • A convenience accessor to the coloration layer mesh.

    Returns PointSourceMesh

  • A convenience accessor to the illumination layer mesh.

    Returns PointSourceMesh

  • 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 RenderedPointSource a temporary preview?

    Returns boolean

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

    Returns number

  • get active(): boolean
  • Is this point source currently active? Returns false if the source is disabled, temporarily suppressed, or not initialized.

    Returns boolean

  • get disabled(): boolean
  • Is this source currently disabled? Returns false if the source hasn't been initialized yet.

    Returns boolean

  • get initialized(): boolean
  • Has this point source been initialized?

    Returns boolean

  • 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 radius(): number
  • A convenience reference to the radius of the source.

    Returns number

Methods

  • _initialize(data: any): void
  • _configure(changes: any): void
  • drawMeshes(): { background: Mesh; coloration: Mesh; illumination: Mesh }
  • 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
  • _refresh(): void
  • _isActive(): boolean
  • Test whether this source should be active under current conditions?

    Returns boolean

  • _destroy(): void
  • animate(dt: number): any
  • Animate the PointSource, if an animation is enabled and if it currently has rendered containers.

    Parameters

    • dt: number

      Delta time.

    Returns any

  • animateTime(dt: number, [options]?: { speed: number; intensity: number; reverse: boolean }): void
  • Generic time-based animation used for Rendered Point Sources.

    Parameters

    • dt: number

      Delta time.

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

      Options which affect the time animation

      • speed: number
      • intensity: number
      • reverse: boolean

    Returns void

  • Initialize and configure the PointSource using provided data.

    Parameters

    • data: any = {}

      Provided data for configuration

    Returns PointSource

    The configured source

  • refresh(): void
  • Refresh the state and uniforms of the PointSource.

    Returns void

  • destroy(): void
  • Steps that must be performed when the base source is destroyed.

    Returns void

  • _configureSoftEdges(): void
  • Decide whether to render soft edges with a blur.

    Returns void

  • _configureColorAttributes(color: number): void
  • Configure the derived color attributes and associated flag.

    Parameters

    • color: number

      The color to configure (usually a color coming for the rendered point source data) or null if no color is configured for this rendered source.

    Returns void

  • _configureLayer(layer: any, layerId: string): void
  • Specific configuration for a layer.

    Parameters

    • layer: any
    • layerId: string

    Returns void

  • _initializeBlending(): void
  • Initialize the blend mode and vertical sorting of this source relative to others in the container.

    Returns void

  • _updateBackgroundUniforms(): void
  • Update shader uniforms used for the background layer.

    Returns void

  • _updateColorationUniforms(): void
  • Update shader uniforms used for the coloration layer.

    Returns void

  • _updateIlluminationUniforms(): void
  • Update shader uniforms used for the illumination layer.

    Returns void

  • #initializeShaders(): void
  • Initialize the shaders used for this source, swapping to a different shader if the animation has changed.

    Returns void

  • #initializeMeshes(): boolean
  • Create or update the source geometry and create meshes if necessary

    Returns boolean

    True if the shaders need to be initialized.

  • #createMeshes(): void
  • Create meshes for each layer of the RenderedPointSource that is drawn to the canvas.

    Returns void

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

    Parameters

    Returns PointSourceMesh

    The created Mesh

  • #updateGeometry(): void
  • 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

  • #drawMesh(layerId: string): any
  • Create a Mesh for the background component of this source which will be added to CanvasBackgroundEffects.

    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

  • #updateUniforms(): void
  • Update uniforms for all rendered layers.

    Returns void

  • #updateVisibleLayers(): void
  • Update the visible state of the component channels of this RenderedPointSource.

    Returns void