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

Mixes

CanvasGroupMixin

Hierarchy (view full)

Properties

clearColor: number[] = ...
_backgroundColor: [red: number, green: number, blue: number]

The background color in RGB.

videoMeshes: Set<SpriteMesh> = ...

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

hoverFadeElevation: number = 0

Occludable objects above this elevation are faded on hover.

background: SpriteMesh

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

foreground: SpriteMesh

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

quadtree: CanvasQuadtree = ...

A Quadtree which partitions and organizes primary canvas objects.

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

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

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

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

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

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

The ambience filter which is applying post-processing effects.

displayed: boolean = false

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

autoRender: boolean = true

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

renderDirty: boolean = true

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

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

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

Type declaration

  • renderFunction: Function
  • clearColor: number[]
#hoveredObjects: PrimaryCanvasObjec[] = []

The objects that are currently hovered in reverse sort order.

#tilingSpriteError: boolean = false

Trace the tiling sprite error to avoid multiple warning. FIXME: Remove when the deprecation period for the tiling sprite error is over.

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

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

Type declaration

  • SCENE: 0
  • TILES: 500
  • DRAWINGS: 600
  • TOKENS: 700
  • WEATHER: 1000
groupName: string = "primary"
textureConfiguration: {
    scaleMode: any;
    format: any;
    multisample: any;
} = ...

Type declaration

  • scaleMode: any
  • format: any
  • multisample: any
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.

Accessors

  • get backgroundSource(): HTMLImageElement | HTMLVideoElement
  • Return the base HTML image or video element which provides the background texture.

    Returns HTMLImageElement | HTMLVideoElement

  • get foregroundSource(): HTMLImageElement | HTMLVideoElement
  • Return the base HTML image or video element which provides the foreground texture.

    Returns HTMLImageElement | HTMLVideoElement

  • get sprite(): any
  • 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 any

  • get renderTexture(): RenderTexture
  • The primary render texture bound to this cached container.

    Returns RenderTexture

  • set alphaMode(mode): void
  • Set the alpha mode of the cached container render texture.

    Parameters

    • mode: ALPHA_MODES

    Returns void

Methods

  • Refresh the primary mesh.

    Returns void

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

    Returns void

  • Parameters

    • options: any

    Returns Promise<void>

    Inherit Doc

  • Parameters

    • renderer: any

    Returns void

    Inherit Doc

  • Parameters

    • options: any

    Returns Promise<void>

    Inherit Doc

  • Remove a TokenMesh from the group.

    Parameters

    • token: Token

      The Token being removed

    Returns void

  • Remove a TokenMesh from the group.

    Parameters

    • tile: Tile

      The Tile being removed

    Returns void

  • Remove a PrimaryGraphics from the group.

    Parameters

    • drawing: Drawing

      The Drawing being removed

    Returns void

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

    Returns void

  • Internal

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

    Returns void

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

    Parameters

    • Optional options: {
          renderFunction: Function;
          clearColor: number[];
      } = {}

      Optional parameters.

      • renderFunction: Function

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

      • clearColor: number[]

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

    Returns RenderTexture

    A reference to the created render texture.

  • Remove a previously created render texture.

    Parameters

    • renderTexture: RenderTexture

      The render texture to remove.

    • Optional destroy: boolean = true

      Should the render texture be destroyed?

    Returns void

  • Clear the cached container, removing its current contents.

    Parameters

    • Optional destroy: boolean = true

      Tell children that we should destroy texture as well.

    Returns CachedContainer

    A reference to the cleared container for chaining.

  • Parameters

    • renderer: any

    Returns void

    Inherit Doc

  • Protected

    Custom rendering for secondary render textures

    Parameters

    • renderer: Renderer

      The active canvas renderer.

    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.

    • Optional clearColor: number[]

      A custom clear color.

    Returns void

  • Create the ambience filter bound to the primary group.

    Returns void

  • Draw the Scene background image.

    Returns void

  • Draw the Scene foreground image.

    Returns void

  • Draw a PrimarySpriteMesh that fills the entire Scene rectangle.

    Parameters

    • mesh: PrimarySpriteMesh

      The target PrimarySpriteMesh

    • texture: any

      The loaded Texture or null

    Returns void

  • Draw the Scene padding.

    Returns void

  • Called when a child is added.

    Parameters

    • child: DisplayObject

    Returns void

  • Called when a child is removed.

    Parameters

    • child: DisplayObject

    Returns void

  • Update the hovered objects. Returns the hovered objects.

    Returns void

  • 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

  • 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