Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    A specialized subclass of RenderedEffectSource which represents a source of point-based vision.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _visionModeActivated: boolean = false

    The vision mode activation flag for handlers

    The animation configuration applied to this source

    blinded: Record<string, boolean> = {}

    Records of blinding strings with a boolean value. By default, if any of this record is true, the source is blinded.

    colorRGB: [r: number, g: number, b: number] | null = null

    The color of the source as an RGB vector.

    data: VisionSourceData = ...

    The data of this source.

    layers: {
        background: RenderedEffectSourceLayer;
        coloration: RenderedEffectSourceLayer;
        illumination: RenderedEffectSourceLayer;
    } = ...

    Track the status of rendering layers

    The polygon of light perception.

    The unconstrained LOS polygon.

    object: object | null

    Some other object which is responsible for this source.

    The geometric shape of the effect source which is generated later.

    sourceId: string

    The source id linked to this effect source.

    suppression: Record<string, boolean> = {}

    Records of suppression strings with a boolean value. If any of this record is true, the source is suppressed.

    visionMode: VisionMode | null = null

    The vision mode linked to this VisionSource

    visionModeOverrides: object = {}

    Data overrides that could happen with blindness vision mode.

    _flags: Record<string, number | boolean> = {}

    A collection of boolean flags which control rendering and refresh behavior for the source.

    _geometry: Geometry | null = null

    PIXI Geometry generated to draw meshes.

    _initializeShaderKeys: string[] = ...
    _refreshUniformsKeys: string[] = ...
    defaultData: {
        animation: {};
        attenuation: number;
        brightness: number;
        color: null;
        contrast: number;
        disabled: boolean;
        elevation: number;
        level: string;
        lightRadius: null;
        preview: boolean;
        saturation: number;
        seed: null;
        visionMode: string;
        x: number;
        y: number;
    } = ...

    Effect source default data.

    Type Declaration

    • animation: {}
    • attenuation: number
    • brightness: number
    • color: null
    • contrast: number
    • disabled: boolean

      Whether or not the source is disabled

    • elevation: number

      The elevation of the point source

    • level: string

      The ID of the Level the point source is in

    • lightRadius: null
    • preview: boolean
    • saturation: number
    • seed: null
    • visionMode: string
    • x: number

      The x-coordinate of the source location

    • y: number

      The y-coordinate of the source location

    EDGE_OFFSET: number = -2

    The offset in pixels applied to create soft edges.

    effectsCollection: string = "visionSources"
    sourceType: string = "sight"

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

    _brightLightingLevel: LightingLevel = LIGHTING_LEVELS.BRIGHT

    The corresponding lighting levels for bright light.

    _dimLightingLevel: LightingLevel = LIGHTING_LEVELS.DIM

    The corresponding lighting levels for dim light.

    Accessors

    • get active(): boolean

      Is this source currently active? A source is active if it is attached to an effect collection and is not disabled or suppressed.

      Returns boolean

    • get attached(): boolean

      Is this source attached to an effect collection?

      Returns boolean

    • get background(): PointSourceMesh

      A convenience accessor to the background layer mesh.

      Returns PointSourceMesh

    • get coloration(): PointSourceMesh

      A convenience accessor to the coloration layer mesh.

      Returns PointSourceMesh

    • get elevation(): number

      The elevation bound to this source.

      Returns number

    • get fov(): Polygon

      An alias for the shape of the vision source.

      Returns Polygon

    • get hasActiveLayer(): boolean

      Has the rendered source at least one active layer?

      Returns boolean

    • get illumination(): PointSourceMesh

      A convenience accessor to the illumination layer mesh.

      Returns PointSourceMesh

    • get isAnimated(): boolean

      Is the rendered source animated?

      Returns boolean

    • get isBlinded(): boolean

      Is this source temporarily blinded?

      Returns boolean

    • get isPreview(): boolean

      Is this RenderedEffectSource a temporary preview?

      Returns boolean

    • get level(): documents.Level

      The level this source is in.

      Returns documents.Level

    • get lightRadius(): number

      Light perception radius of this vision source, taking into account if the source is blinded.

      Returns number

    • get preferred(): boolean

      If this vision source background is rendered into the lighting container.

      Returns boolean

    • get radius(): any

      Returns any

    • get suppressed(): boolean

      Is this source temporarily suppressed?

      Returns boolean

    • get updateId(): number

      Returns the update ID associated with this source. The update ID is increased whenever the shape of the source changes.

      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 _layers(): {
          background: {
              blendMode: string;
              defaultShader: typeof BackgroundVisionShader;
          };
          coloration: {
              blendMode: string;
              defaultShader: typeof ColorationVisionShader;
          };
          illumination: {
              blendMode: string;
              defaultShader: typeof IlluminationVisionShader;
          };
      }

      Returns {
          background: {
              blendMode: string;
              defaultShader: typeof BackgroundVisionShader;
          };
          coloration: {
              blendMode: string;
              defaultShader: typeof ColorationVisionShader;
          };
          illumination: {
              blendMode: string;
              defaultShader: typeof IlluminationVisionShader;
          };
      }

    Methods

    • Returns any

    • Subclass specific data initialization steps.

      Parameters

      • data: any

        Provided data for configuration

      Returns void

    • Add this BaseEffectSource instance to the active collection.

      Returns void

    • Animate the PointSource, if an animation is enabled and if it currently has rendered containers.

      Parameters

      • dt: number

        Delta time.

      Returns any

    • Generic time-based animation used for Rendered Point Sources.

      Parameters

      • dt: number

        Delta time.

      • Optionaloptions: { intensity?: number; reverse?: boolean; speed?: number } = {}

        Options which affect the time animation

        • Optionalintensity?: number

          The animation intensity, from 1 to 10

        • Optionalreverse?: boolean

          Reverse the animation direction

        • Optionalspeed?: number

          The animation speed, from 0 to 10

      Returns void

    • Render the containers used to represent this light source within the LightingLayer

      Returns Record<string, Mesh<MeshMaterial> | null>

    • Initialize and configure the source using provided data.

      Parameters

      • data: Partial<VisionSourceData> = {}

        Provided data for configuration

      • options: { reset?: boolean } = {}

        Additional options which modify source initialization

        • Optionalreset?: boolean

          Should source data be reset to default values before applying changes?

      Returns PointVisionSource

      The initialized source

    • Refresh the state and uniforms of the source. Only active sources are refreshed.

      Returns void

    • Remove this BaseEffectSource instance from the active collection.

      Returns void

    • Protected

      Create a Mesh for a certain rendered layer of this source.

      Parameters

      • layerId: string

        The layer key in layers to draw

      Returns Mesh<MeshMaterial> | null

      The drawn mesh for this layer, or null if no mesh is required

    • Protected

      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

    • Protected

      Responsible for assigning the Vision Mode and calling the activation and deactivation handlers.

      Returns void

    • Protected

      Update layer uniforms according to vision mode uniforms, if any.

      Parameters

      • shader: AdaptiveVisionShader

        The shader being updated.

      • vmUniforms: Record<string, any>

        The targeted layer.

      Returns void