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

    Class RenderedEffectSourceAbstract

    An abstract class which extends the base PointSource to provide common functionality for rendering. This class is extended by both the LightSource and VisionSource subclasses.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    The animation configuration applied to this source

    colorRGB: [number, number, number] | null = null

    The color of the source as an RGB vector.

    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.

    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.

    defaultData: {
        animation: {};
        color: null;
        disabled: boolean;
        elevation: number;
        level: string;
        preview: boolean;
        seed: null;
        x: number;
        y: number;
    } = ...

    Effect source default data.

    Type Declaration

    • animation: {}
    • color: null
    • 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

    • preview: boolean
    • seed: null
    • 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

    The target collection into the effects canvas group.

    sourceType: string

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

    _initializeShaderKeys: string[] = ...

    Keys of the data object which require shaders to be re-initialized.

    _refreshUniformsKeys: string[] = []

    Keys of the data object which require uniforms to be refreshed.

    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 elevation(): number

      The elevation bound to this source.

      Returns number

    • get hasActiveLayer(): boolean

      Has the rendered source at least one active layer?

      Returns boolean

    • get isAnimated(): boolean

      Is the rendered source animated?

      Returns boolean

    • get isPreview(): boolean

      Is this RenderedEffectSource a temporary preview?

      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

    Methods

    • 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

    • 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>

    • 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

      Configure which shaders are used for each rendered layer.

      Returns Record<string, typeof AdaptiveLightingShader>

      An object whose keys are layer identifiers and whose values are shader classes.

    • Protected

      Create the polygon shape (or shapes) for this source using configured data.

      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

      Decide whether to render soft edges with a blur.

      Returns void

    • Protected

      Update shader uniforms used for the background layer.

      Returns void

    • Protected

      Update shader uniforms used for the coloration layer.

      Returns void

    • Protected

      Update shader uniforms used by every rendered layer.

      Parameters

      • shader: AbstractBaseShader

      Returns void

    • 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

      Update shader uniforms used for the illumination layer.

      Returns void