The primary Canvas group which generally contains tangible physical objects which exist within the Scene. This group is a foundry.canvas.containers.CachedContainer which is rendered to the Scene as a foundry.canvas.containers.SpriteMesh. This allows the rendered result of the Primary Canvas Group to be affected by a foundry.canvas.rendering.shaders.BaseSamplerShader.

CanvasGroupMixin

Hierarchy (View Summary)

Properties

The ambience filter which is applying post-processing effects.

_backgroundColor: [red: number, green: number, blue: number]

The background color in RGB.

autoRender: boolean = true

If true, the Container is rendered every frame. If false, the Container is rendered only if CachedContainer#renderDirty is true.

background: PrimarySpriteMesh

The primary background image configured for the Scene, rendered as a SpriteMesh.

clearColor: number[] = ...
displayed: boolean = false

Should our Container also be displayed on screen, in addition to being drawn to the cached RenderTexture?

drawings: Collection<string, PrimaryGraphics> = ...

The collection of PrimaryDrawingContainer objects which are rendered in the Scene.

foreground: PrimarySpriteMesh

The primary foreground image configured for the Scene, rendered as a SpriteMesh.

hoverFadeElevation: number = 0

Occludable objects above this elevation are faded on hover.

quadtree: CanvasQuadtree = ...

A Quadtree which partitions and organizes primary canvas objects.

renderDirty: boolean = true

Does the Container need to be rendered? Set to false after the Container is rendered.

tiles: Collection<string, PrimarySpriteMesh> = ...

The collection of SpriteMesh objects which are rendered in the Scene.

tokens: Collection<string, PrimarySpriteMesh> = ...

The collection of SpriteMesh objects which are rendered in the Scene.

videoMeshes: Set<PrimarySpriteMesh> = ...

Track the set of HTMLVideoElements which are currently playing as part of this group.

_renderPaths: Map<
    RenderTexture,
    { clearColor: number[]; renderFunction: Function },
> = ...

A map of render textures, linked to their render function and an optional RGBA clear color.

BACKGROUND_ELEVATION: number = 0

Allow API users to override the default elevation of the background layer. This is a temporary solution until more formal support for scene levels is added in a future release.

groupName: string = "primary"
SORT_LAYERS: Readonly<
    { DRAWINGS: 600; SCENE: 0; TILES: 500; TOKENS: 700; WEATHER: 1000 },
> = ...

Sort order to break ties on the group/layer level.

textureConfiguration: {
    format: FORMATS;
    multisample: MSAA_QUALITY;
    scaleMode: SCALE_MODES;
} = ...

Accessors

  • set alphaMode(mode: ALPHA_MODES): void

    Set the alpha mode of the cached container render texture.

    Parameters

    • mode: ALPHA_MODES

    Returns void

  • get backgroundSource(): null | HTMLImageElement | HTMLVideoElement

    Return the base HTML image or video element which provides the background texture.

    Returns null | HTMLImageElement | HTMLVideoElement

  • get foregroundSource(): null | HTMLImageElement | HTMLVideoElement

    Return the base HTML image or video element which provides the foreground texture.

    Returns null | HTMLImageElement | HTMLVideoElement

  • get renderTexture(): RenderTexture

    The primary render texture bound to this cached container.

    Returns RenderTexture

  • get sprite(): SpriteMesh | Sprite

    A PIXI.Sprite or SpriteMesh which is bound to this CachedContainer. The RenderTexture from this Container is associated with the Sprite which is automatically rendered.

    Returns SpriteMesh | Sprite

Methods

  • Parameters

    • options: any

    Returns Promise<void>

  • Internal

    Handle mousemove events on the primary group to update the hovered state of its children.

    Parameters

    • currentPos: Point

      Current mouse position

    • hasMouseMoved: boolean

      Has the mouse been moved (or it is a simulated mouse move event)?

    Returns void

  • Parameters

    • renderer: any

    Returns void

  • Parameters

    • options: any

    Returns Promise<void>

  • Add a PrimaryGraphics to the group.

    Parameters

    • drawing: Drawing

      The Drawing being added

    Returns PrimaryGraphics

    The created PrimaryGraphics instance

  • Draw the SpriteMesh for a specific Token object.

    Parameters

    • tile: Tile

      The Tile being added

    Returns PrimarySpriteMesh

    The added PrimarySpriteMesh

  • Draw the SpriteMesh for a specific Token object.

    Parameters

    • token: Token

      The Token being added

    Returns PrimarySpriteMesh

    The added PrimarySpriteMesh

  • Clear the cached container, removing its current contents.

    Parameters

    • Optionaldestroy: boolean = true

      Tell children that we should destroy texture as well.

    Returns PrimaryCanvasGroup

    A reference to the cleared container for chaining.

  • Create a render texture, provide a render method and an optional clear color.

    Parameters

    • Optionaloptions: { clearColor?: number[]; renderFunction?: Function } = {}

      Optional parameters.

      • OptionalclearColor?: number[]

        An optional clear color to clear the RT before rendering into it.

      • OptionalrenderFunction?: Function

        Render function that will be called to render into the RT.

    Returns RenderTexture

    A reference to the created render texture.

  • Parameters

    • options: any

    Returns void

  • Refresh the primary mesh.

    Returns void

  • Remove a PrimaryGraphics from the group.

    Parameters

    • drawing: Drawing

      The Drawing being removed

    Returns void

  • Remove a previously created render texture.

    Parameters

    • renderTexture: RenderTexture

      The render texture to remove.

    • Optionaldestroy: boolean = true

      Should the render texture be destroyed?

    Returns void

  • Remove a TokenMesh from the group.

    Parameters

    • tile: Tile

      The Tile being removed

    Returns void

  • Remove a TokenMesh from the group.

    Parameters

    • token: Token

      The Token being removed

    Returns void

  • Parameters

    • renderer: any

    Returns void

  • Override the default PIXI.Container behavior for how objects in this container are sorted.

    Returns void

  • Update this group. Calculates the canvas transform and bounds of all its children and updates the quadtree.

    Returns void

  • Protected

    Bind a render texture to this renderer. Must be called after bindPrimaryBuffer and before bindInitialBuffer.

    Parameters

    • renderer: Renderer

      The active canvas renderer.

    • tex: RenderTexture

      The texture to bind.

    • OptionalclearColor: number[]

      A custom clear color.

    Returns void

  • Protected

    Custom rendering for secondary render textures

    Parameters

    • renderer: Renderer

      The active canvas renderer.

    Returns void

  • Internal

    The sorting function used to order objects inside the Primary Canvas Group. Overrides the default sorting function defined for the PIXI.Container. Sort Tokens PCO above other objects except WeatherEffects, then Drawings PCO, all else held equal.

    Parameters

    • a: any

      An object to display

    • b: any

      Some other object to display

    Returns number

  • Resize a render texture passed as a parameter with the renderer.

    Parameters

    • renderer: Renderer

      The active canvas renderer.

    • rt: RenderTexture

      The render texture to resize.

    Returns void