Options
All
  • Public
  • Public/Protected
  • All
Menu

A specialized subclass of the PointSource abstraction which is used to control the rendering of vision sources.

param object

The Token object that generates this vision source

Hierarchy

Index

Constructors

Properties

background: any

The current background mesh for this source

illumination: any

The current vision illumination mesh for this source

coloration: any

The current vision coloration mesh for this source

visionMode: VisionMode

The vision mode linked to this VisionSource

data: VisionSourceData = {}

The object of data which configures how the source is rendered

The constrained LOS polygon that is generated by the origin and radius of this source.

The animation configuration applied to this source

colorRGB: any

The restricted line-of-sight polygon that is generated by the origin and radius of this source.

radius: number

The maximum radius of emission for this source

The PlaceableObject which is the origin of this PointSource.

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

_resetUniforms: { background: boolean; illumination: boolean; coloration: boolean } = ...

Track which uniforms need to be reset

Type declaration

  • background: boolean
  • illumination: boolean
  • coloration: boolean
_shutdown: { background: boolean; illumination: boolean; coloration: boolean } = ...

To track if a source is temporarily shutdown to avoid glitches

Type declaration

  • background: boolean
  • illumination: boolean
  • coloration: boolean
sourceType: string = "sight"

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

EDGE_OFFSET: number = -2

The offset in pixels applied to create soft edges.

_appearanceKeys: string[] = ...

Keys in the VisionSourceData structure which, when modified, change the appearance of the source

Accessors

  • get isPreview(): boolean
  • Is this VisionSource a temporary preview which should not produce fog exploration?

    Returns boolean

  • get preferred(): number
  • If this vision source background is rendered into the lighting container.

    Returns number

  • 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

  • get elevation(): number
  • The elevation of the object bound to this base source, if any. Returns the canvas primary background elevation otherwise.

    Returns number

  • get isAnimated(): boolean
  • If the source is animated or not.

    Returns boolean

Methods

  • Initialize the source with provided object data.

    Parameters

    • data: any = {}

      Initial data provided to the point source.

    Returns VisionSource

    A reference to the initialized source.

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

    Returns void

  • refreshSource(): void
  • drawMeshes(): any
  • Render the containers used to represent this light source within the LightingLayer.

    Returns any

  • drawBackground(): any
  • Draw the background mesh which provide special vision.

    Returns any

    The rendered light container.

  • drawVision(): any
  • Draw the illumination mesh which provide vision.

    Returns any

    The rendered light container.

  • drawColor(): any
  • Draw and return a container used to depict the visible color tint of the light source on the LightingLayer

    Returns any

    An updated color container for the source

  • animateTime(dt: number): void
  • Generic time animation with Vision Sources.

    Parameters

    • dt: number

      Delta time.

    Returns void

  • 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

  • _initializeVisionMode(): void
  • Responsible for assigning the Vision Mode and handling exceptions based on vision special status.

    Returns void

  • Create a restricted FOV polygon by limiting the radius of the unrestricted LOS polygon.

    Returns PointSourcePolygon

  • _updateUniforms(): void
  • Update all layer uniforms.

    Returns 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

  • _initializeShaders(): void
  • Initialize the shaders used for this source, swapping to a different shader if the vision effect has changed.

    Returns void

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

    Returns void

  • _initializeData(data: any): any
  • Process new input data provided to the LightSource.

    Parameters

    • data: any

      Initial data provided to the vision source

    Returns any

    The changes compared to the prior data

  • _updateColorationUniforms(): void
  • Update shader uniforms by providing data from this PointSource

    Returns void

  • _updateIlluminationUniforms(): void
  • Update shader uniforms by providing data from this PointSource

    Returns void

  • _updateBackgroundUniforms(): void
  • Update shader uniforms by providing data from this PointSource

    Returns void

  • Update shader uniforms shared by all shader types

    Parameters

    Returns void