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.

see

LightSource

param object

The linked scene.

Hierarchy

Index

Constructors

Accessors

  • get elevation(): number
  • override

    Returns number

  • get disabled(): boolean
  • To know if a light source is completely disabled.

    Returns boolean

  • get isAnimated(): boolean
  • override

    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 sourceType(): string
  • The type of source represented by this data structure.

    Returns string

Methods

  • _createPolygon(): any
  • _initializeFlags(): void
  • _isSuppressed(): boolean
  • Initialize the source with provided object data.

    Parameters

    • data: any = {}

      Initial data provided to the point source.

    Returns LightSource

    A reference to the initialized source.

  • _getPolygonConfiguration(): { type: string; angle: any; density: number; radius: number; rotation: any; source: GlobalLightSource }
  • _createMeshes(): void
  • destroy(): void
  • Steps that must be performed when the base source is destroyed.

    Returns void

  • refreshSource(): void
  • updateVisibility(): boolean
  • Update the visible state of the component channels of this LightSource.

    Returns boolean

    Is any channel of this light source active?

  • drawMeshes(): { background: Mesh; light: Mesh; color: Mesh }
  • Render the containers used to represent this light source within the LightingLayer

    Returns { background: Mesh; light: Mesh; color: Mesh }

    • background: Mesh
    • light: Mesh
    • color: Mesh
  • drawBackground(): any
  • Create a Mesh for the background component of this source which will be added to CanvasBackgroundEffects.

    Returns any

    The background mesh for this LightSource, or null

  • drawLight(): any
  • Create a Mesh for the illumination component of this source which will be added to CanvasIlluminationEffects.

    Returns any

    The illumination mesh for this LightSource, or null

  • drawColor(): any
  • Create a Mesh for the coloration component of this source which will be added to CanvasColorationEffects.

    Returns any

    The coloration mesh for this LightSource, or null

  • 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

  • animateTime(dt: number, [options={}]?: { speed: number; intensity: number; reverse: boolean }): void
  • Emanate waves of light from the source origin point

    Parameters

    • dt: number

      Delta time

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

      Additional options which modify the 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?

  • containsPoint(point: Point): boolean
  • A point is contained with the area of the source if it is within both the FOV circle and the LOS polygon.

    Parameters

    • point: Point

      The point to test

    Returns boolean

    Is the point contained

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

    Parameters

    • dt: number

      Delta time.

    Returns any

  • _initializeData(data: any): any
  • Initialize the PointSource with new input data

    Parameters

    • data: any

      Initial data provided to the light source

    Returns any

    The changes compared to the prior data

  • _updateUniforms(): void
  • _updateLosGeometry(polygon: Polygon): void
  • Create or update the source geometry with a polygon shape Triangulate the form and create buffers

    Parameters

    Returns void

  • _initializeMeshes(polygon: Polygon): void
  • _createMesh(shaderCls: Function): Mesh
  • Create a new Mesh for this source using a provided shader class

    Parameters

    • shaderCls: Function

      The subclass of AdaptiveLightingShader being used for this Mesh

    Returns Mesh

    The created Mesh

  • _updateMesh(mesh: Mesh): Mesh
  • Update the position and size of the mesh each time it is drawn.

    Parameters

    • mesh: Mesh

      The Mesh being updated

    Returns Mesh

    The updated Mesh

Properties

The object type for a Light Source. This is a Scene in the case of a global light source This is an AmbientLight placeable object when the source is provided by an AmbientLightDocument This is a Token placeable object when the source is provided by a TokenDocument

background: any

The light or darkness container for this source

illumination: any

The light or darkness container for this source

coloration: any

This visible color container for this source

The computed polygon which expresses the area of effect of this light source

data: any = {}

The object of data which configures how the source is rendered

isDarkness: boolean = false

Internal flag for whether this is a darkness source

preview: boolean = false

To know if a light source is a preview or not. False by default.

ratio: number

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

animation: any

The animation configuration applied to this source

colorRGB: any
radius: number

The maximum radius of emission for this source

_noise: SmoothNoise
active: boolean = false

A flag for whether this source is currently rendered or not.

losMask: any = ...

A Graphics object with pre-computed geometry used for masking based on line-of-sight.

_flags: Object = {}

Additional information which controls whether certain behaviors of the source must be enforced

_meshesInit: boolean = false

To track meshes initialization

#visibility: { background: boolean; illumination: boolean; coloration: boolean; any: boolean } = ...

Record the current visibility state of this LightSource and its respective channels.

Type declaration

  • background: boolean
  • illumination: boolean
  • coloration: boolean
  • any: boolean
sourceType: string = "light"

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

EDGE_OFFSET: number = -8

The offset in pixels applied to create soft edges.