Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Hierarchy

  • any
    • PrimaryCanvasGroup

Index

Constructors

  • Parameters

    • sprite: any

    Returns PrimaryCanvasGroup

Properties

interactive: boolean
interactiveChildren: boolean
tokensRenderTexture: any
clearColor: number[] = ...
override
videoMeshes: Set<SpriteMesh> = ...

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

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.

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, TileMesh | TileSprite> = ...

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

sortDirty: boolean
#elevation: { min: number; max: number } = ...

Track the current elevation range which is present in the Scene.

Type declaration

  • min: number
  • max: number
groupName: string = "primary"
override
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

Methods

  • refreshPrimarySpriteMesh(): void
  • Refresh the primary mesh.

    Returns void

  • draw(): Promise<void>
  • Draw the canvas group and all its component layers.

    Returns Promise<void>

  • tearDown(): Promise<void>
  • Remove and destroy all children from the group. Clear container references to rendered objects.

    Returns Promise<void>

  • Draw the SpriteMesh for a specific Token object.

    Parameters

    • token: Token

      The Token being added

    Returns TokenMesh

    The added TokenMesh

  • removeToken(token: Token): void
  • Remove a TokenMesh from the group.

    Parameters

    • token: Token

      The Token being removed

    Returns void

  • Draw the SpriteMesh for a specific Token object.

    Parameters

    • tile: Tile

      The Tile being added

    Returns TileMesh | TileSprite

    The added TileMesh or TileSprite

  • removeTile(tile: Tile): void
  • Remove a TokenMesh from the group.

    Parameters

    • tile: Tile

      The Tile being removed

    Returns void

  • Add a DrawingShape to the group.

    Parameters

    • drawing: Drawing

      The Drawing being added

    Returns DrawingShape

    The created DrawingShape instance

  • removeDrawing(drawing: Drawing): void
  • Remove a DrawingShape from the group.

    Parameters

    • drawing: Drawing

      The Drawing being removed

    Returns void

  • mapElevationAlpha(elevation: number): number
  • Map a zIndex to an elevation ratio to draw as an intensity to the occlusion mask.

    Parameters

    • elevation: number

      A current elevation (or zIndex) in distance units.

    Returns number

    The color intensity for this elevation on the range [0.19, 1.0]

  • sortChildren(): void
  • Override the default PIXI.Container behavior for how objects in this container are sorted.

    override

    Returns void

  • _renderTokens(renderer: Renderer): void
  • Render all tokens in their own render texture.

    Parameters

    • renderer: Renderer

      The renderer to use.

    Returns void

  • #drawBackground(): void
  • Draw the Scene background image.

    Returns void

  • #drawForeground(): void
  • Draw the Scene foreground image.

    Returns void

  • #drawSceneMesh(mesh: SpriteMesh, texture: any): void
  • Draw a SpriteMesh texture that fills the entire Scene rectangle.

    Parameters

    • mesh: SpriteMesh

      The target SpriteMesh

    • texture: any

      The loaded Texture or null

    Returns void

  • _sortObjects(a: any, b: any): number
  • The sorting function used to order objects inside the Primary Canvas Group. Overrides the default sorting function defined for the PIXI.Container. Sort TokenMesh above other objects, then DrawingShape, all else held equal.

    Parameters

    • a: any

      An object to display

    • b: any

      Some other object to display

    Returns number