Options
All
  • Public
  • Public/Protected
  • All
Menu

A specialized subclass of the LightSource which is used to render global light source linked to the scene.

Hierarchy

Index

Constructors

Methods

  • _createPolygon(): any
  • _configureSoftEdges(): void
  • _initialize(data: any): void
  • _configure(changes: any): void
  • _initializeBlending(): void
  • _updateColorationUniforms(): void
  • _updateIlluminationUniforms(): void
  • _updateBackgroundUniforms(): void
  • animateTorch(dt: number, [options={}]?: { speed: number; intensity: number; reverse: boolean }): void
  • An animation with flickering ratio and light intensity.

    Parameters

    • dt: number

      Delta time

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

      Additional options which modify the flame animation

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

    Returns void

  • animateFlickering(dt: number, [options={}]?: { speed: number; intensity: number; amplification: number; reverse: boolean }): void
  • An animation with flickering ratio and light intensity

    Parameters

    • dt: number

      Delta time

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

      Additional options which modify the flame animation

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

    Returns void

  • animatePulse(dt: number, [options={}]?: { speed: number; intensity: number; reverse: boolean }): void
  • A basic "pulse" animation which expands and contracts.

    Parameters

    • dt: number

      Delta time

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

      Additional options which modify the pulse animation

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

    Returns void

  • Can this LightSource theoretically detect a certain object based on its properties? This check should not consider the relative positions of either object, only their state.

    Parameters

    Returns boolean

    Can the target object theoretically be detected by this vision source?

  • 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

  • _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
  • #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

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

Properties

data: PointSourceData = ...

The object of data which configures how the source is rendered

ratio: number = 0

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

animation: any

The animation configuration applied to this source

computedAttenuation: number
cachedAttenuation: any
_noise: SmoothNoise
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
sourceType: string = "light"

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

_initializeShaderKeys: string[] = ...
override
_refreshUniformsKeys: string[] = ...
override
EDGE_OFFSET: number = -8

The offset in pixels applied to create soft edges.

Accessors

  • get isDarkness(): boolean
  • Is this darkness?

    Returns boolean

  • 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