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

Hierarchy

  • CanvasGroup<this>
    • CanvasVisibility

Properties

explored: Container<DisplayObject>

The exploration container which tracks exploration progress.

layers: Record<string, CanvasLayer>

A mapping of CanvasLayer classes which belong to this group.

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

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

visibilityOverlay: Sprite

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

vision: CanvasVisionContainer

The currently revealed vision.

visionModeData: {
    activeLightingOptions: object;
    source: null | PointVisionSource;
} = ...

The active vision source data object

groupName: string = "visibility"
tearDownChildren: boolean = true

If this canvas group should teardown non-layers children.

Accessors

  • set explorationRect(rect: any): void

    Optional overrides for exploration sprite dimensions.

    Parameters

    • rect: any

    Returns void

  • get hookName(): string

    The name used by hooks to construct their hook string. Note: You should override this getter if hookName should not return the class constructor name.

    Returns string

  • get initialized(): boolean

    A status flag for whether the group initialization workflow has succeeded.

    Returns boolean

  • get name(): string

    The canonical name of the canvas group is the name of the constructor that is the immediate child of the defined base class.

    Returns string

  • get needsContainment(): boolean
    Internal

    Indicates whether containment filtering is required when rendering vision into a texture.

    Returns boolean

  • get tokenVision(): boolean

    Does the currently viewed Scene support Token field of vision?

    Returns boolean

Methods

  • Internal

    Create the visibility test config.

    Parameters

    • point: Point | ElevatedPoint

      The point in space to test

    • Optionaloptions: { object?: null | object; tolerance?: number } = {}

      Additional options which modify visibility testing.

      • Optionalobject?: null | object

        An optional reference to the object whose visibility is being tested

      • Optionaltolerance?: number

        A numeric radial offset which allows for a non-exact match. For example, if tolerance is 2 then the test will pass if the point is within 2px of a vision polygon.

    Returns CanvasVisibilityTestConfiguration

  • Parameters

    • options: any

    Returns Promise<void>

  • Parameters

    • options: any

    Returns Promise<void>

  • Draw the canvas group and all its components.

    Parameters

    • Optionaloptions: object = {}

    Returns Promise<CanvasVisibility>

    A Promise which resolves once the group is fully drawn

  • Initialize all Token vision sources which are present on this group.

    Returns void

  • Initialize the vision mode.

    Returns void

  • Update the display of the visibility group. Organize sources into rendering queues and draw lighting containers for each source

    Returns void

  • Update vision (and fog if necessary)

    Returns void

  • Reset the exploration container with the fog sprite

    Returns 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

  • Remove and destroy all layers from the base canvas.

    Parameters

    • Optionaloptions: object = {}

    Returns Promise<CanvasVisibility>

  • Test whether a target point on the Canvas is visible based on the current vision and LOS polygons.

    Parameters

    • point: Point | ElevatedPoint

      The point in space to test

    • Optionaloptions: { object?: null | object; tolerance?: number } = {}

      Additional options which modify visibility testing.

      • Optionalobject?: null | object

        An optional reference to the object whose visibility is being tested

      • Optionaltolerance?: number

        A numeric radial offset which allows for a non-exact match. For example, if tolerance is 2 then the test will pass if the point is within 2px of a vision polygon.

    Returns boolean

    Whether the point is currently visible.

  • Protected

    Create CanvasLayer instances which belong to the canvas group.

    Returns {}