Options
All
  • Public
  • Public/Protected
  • All
Menu

The visibility Layer which implements dynamic vision, lighting, and fog of war This layer uses an event-driven workflow to perform the minimal required calculation in response to changes.

see

PointSource

property

{PIXI.Graphics} unexplored The unexplored background which spans the entire canvas

property

{PIXI.Container} explored The exploration container which tracks exploration progress

property

{PIXI.Container} revealed A container of regions which have previously been revealed

property

{PIXI.Sprite} saved The saved fog exploration texture

property

{PIXI.Container} pending Pending exploration which has not yet been committed to the texture

property

{CanvasVisionContainer} vision The container of current vision exploration

Hierarchy

Index

Constructors

Properties

vision: Container

The current vision container which provides line-of-sight for vision sources and field-of-view of light sources.

los: any

The canonical line-of-sight polygon which defines current Token visibility.

fogOverlay: Sprite

The optional fog overlay sprite that should be drawn instead of the unexplored color in the fog of war.

visionModeData: { source: VisionSource; activeLightingOptions: any } = ...

The active vision source data object

Type declaration

lightingVisibility: { illumination: number; background: number; coloration: number; any: boolean } = ...

Define whether each lighting layer is enabled, required, or disabled by this vision mode. The value for each lighting channel is a number in LIGHTING_VISIBILITY

Type declaration

  • illumination: number
  • background: number
  • coloration: number
  • any: boolean
explored: any
revealed: any
saved: any
pending: any
filterArea: any
visible: boolean
options: { name: string } = ...

Options for this layer instance.

Type declaration

  • name: string
interactiveChildren: boolean = false
renderable: boolean
#fogOverlayDimensions: number[]

Dimensions of the fog overlay texture and base texture used for tiling texture into the visibility filter.

#initialized: boolean = false

Accessors

  • get initialized(): boolean
  • A status flag for whether the layer initialization workflow has succeeded.

    Returns boolean

  • get tokenVision(): boolean
  • Does the currently viewed Scene support Token field of vision?

    Returns boolean

  • get name(): string
  • The canonical name of the CanvasLayer

    Returns string

  • get layerOptions(): { name: string }
  • Customize behaviors of this CanvasLayer by modifying some behaviors at a class level.

    Returns { name: string }

    • name: string
  • Return a reference to the active instance of this canvas layer

    Returns CanvasLayer

Methods

  • initializeSources(): void
  • Initialize all Token vision sources which are present on this layer

    Returns void

  • _draw(options: any): Promise<void>
  • _tearDown(options: any): Promise<void>
  • refresh([options]?: { forceUpdateFog: boolean }): void
  • Update the display of the sight layer. Organize sources into rendering queues and draw lighting containers for each source

    Parameters

    • [options]: { forceUpdateFog: boolean } = {}

      Options which affect how visibility is refreshed

      • forceUpdateFog: boolean

    Returns void

  • restrictVisibility(): void
  • Restrict the visibility of certain canvas assets (like Tokens or DoorControls) based on the visibility polygon These assets should only be displayed if they are visible given the current player's field of view

    Returns void

  • testVisibility(point: Point, [options]?: { tolerance: number; object: DisplayObject }): boolean
  • Test whether a target point on the Canvas is visible based on the current vision and LOS polygons.

    Parameters

    • point: Point

      The point in space to test, an object with coordinates x and y.

    • [options]: { tolerance: number; object: DisplayObject } = {}

      Additional options which modify visibility testing.

      • tolerance: number
      • object: DisplayObject

    Returns boolean

    Whether the point is currently visible.

  • Draw the canvas layer, rendering its internal components and returning a Promise. The Promise resolves to the drawn layer once its contents are successfully rendered.

    Parameters

    • options: any = {}

    Returns Promise<CanvasLayer>

  • Deconstruct data used in the current layer in preparation to re-draw the canvas

    Parameters

    • options: any = {}

    Returns Promise<CanvasLayer>

  • Identify whether there is one singular vision source active (excluding previews).

    Parameters

    • sources: Collection<string, VisionSource>

      The current sources

    Returns VisionSource

    A singular source, or null

  • Call activation and deactivation handlers for the vision modes whose state has changed.

    Parameters

    • sources: Collection<string, VisionSource>

      The new collection of active sources

    • priorSources: Set<VisionSource>

      The set of previously active sources

    Returns void

  • #configureLightingVisibility(): void
  • Configure the visibility of individual lighting channels based on the currently active vision source(s).

    Returns void

  • #updateLightingPostProcessing(): void
  • Update the lighting according to vision mode options.

    Returns void

  • #updateTintPostProcessing(): void
  • Refresh the tint of the post processing filters.

    Returns void

  • #drawFogOverlay(): Promise<void>
  • Load the scene fog overlay if provided and attach the fog overlay sprite to this layer.

    Returns Promise<void>