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

    A specialized subclass of the BaseLightSource which renders a source of darkness as a point-based effect.

    PointEffectSource

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    The animation configuration applied to this source

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

    The color of the source as an RGB vector.

    data: any = ...

    The data of this source.

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

    Track the status of rendering layers

    object: object | null

    Some other object which is responsible for this source.

    ratio: number = 1

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

    shape: Polygon

    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.

    _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.

    _padding: number = ...

    Padding applied on the darkness source shape for visual appearance only. Note: for now, padding is increased radius. It might evolve in a future release.

    _visualShape: SourceShape

    The optional geometric shape is solely utilized for visual representation regarding darkness sources. Used only when an additional radius is added for visuals.

    _brightLightingLevel: -2 = LIGHTING_LEVELS.DARKNESS
    _dimLightingLevel: -1 = LIGHTING_LEVELS.HALFDARK
    _initializeShaderKeys: string[] = ...
    _refreshUniformsKeys: string[] = ...
    defaultData: {
        alpha: number;
        animation: {};
        attenuation: number;
        bright: number;
        color: null;
        coloration: number;
        contrast: number;
        dim: number;
        disabled: boolean;
        elevation: number;
        level: string;
        luminosity: number;
        preview: boolean;
        saturation: number;
        seed: null;
        shadows: number;
        vision: boolean;
        x: number;
        y: number;
    } = ...

    Effect source default data.

    Type Declaration

    • alpha: number
    • animation: {}
    • attenuation: number
    • bright: number
    • color: null
    • coloration: number
    • contrast: number
    • dim: 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

    • luminosity: number
    • preview: boolean
    • saturation: number
    • seed: null
    • shadows: number
    • vision: boolean
    • x: number

      The x-coordinate of the source location

    • y: number

      The y-coordinate of the source location

    EDGE_OFFSET: number = -8

    The offset in pixels applied to create soft edges.

    effectsCollection: string = "darknessSources"
    sourceType: string = "darkness"

    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 darkness(): PointSourceMesh

      A convenience accessor to the darkness layer mesh.

      Returns PointSourceMesh

    • get elevation(): number

      The elevation bound to this source.

      Returns number

    • get level(): documents.Level

      The level this source is in.

      Returns documents.Level

    • get requiresEdges(): boolean

      Returns boolean

    • 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(): {
          darkness: {
              blendMode: string;
              defaultShader: typeof AdaptiveDarknessShader;
          };
      }

      Returns {
          darkness: {
              blendMode: string;
              defaultShader: typeof AdaptiveDarknessShader;
          };
      }

    Methods

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

      Parameters

      • layerId: any

        The layer key in layers to draw

      Returns Mesh<MeshMaterial> | null

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

    • Returns {
          direction: 1;
          light: 20;
          object: object | null;
          priority: any;
          sight: 20;
          type: string;
      }

    • Returns any

    • 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

    • An animation with flickering ratio and light intensity

      Parameters

      • dt: number

        Delta time

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

        Additional options which modify the flame animation

        • Optionalamplification?: number

          Noise amplification (>1) or dampening (<1)

        • 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

    • A basic "pulse" animation which expands and contracts.

      Parameters

      • dt: number

        Delta time

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

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

    • A sound-reactive animation that uses bass/mid/treble blending to control certain shader uniforms. "speed" is interpreted as how quickly we adapt to changes in audio. No time-based pulsing is used by default, but we incorporate dt into smoothing so that behavior is consistent across varying frame rates.

      Parameters

      • dt: number

        The delta time since the last frame, in milliseconds.

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

        Additional options for customizing the audio reaction.

        • Optionalintensity?: number

          A blend factor in [0..10] that transitions from bass (near 0) to treble (near 10) Mid frequencies dominate around intensity=5.

        • Optionalreverse?: boolean

          Whether to invert the final amplitude as 1 - amplitude.

        • Optionalspeed?: number

          A smoothing factor in [0..10], effectively updates/second.

      Returns void

    • 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

    • An animation with flickering ratio and light intensity.

      Parameters

      • dt: number

        Delta time

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

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

    • Steps that must be performed when the source is destroyed.

      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: any = {}

        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 PointDarknessSource

      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

      Specific configuration for a layer.

      Parameters

      • layer: object
      • layerId: string

      Returns void

    • Protected

      Update the uniforms of the shader on the darkness layer.

      Returns void