Options
All
  • Public
  • Public/Protected
  • All
Menu

A special type of PIXI.Container which draws its contents to a cached RenderTexture. This is accomplished by overriding the Container#render method to draw to our own special RenderTexture.

Hierarchy

Index

Constructors

  • Construct a CachedContainer.

    Parameters

    • sprite: any

    Returns CachedContainer

Accessors

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

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

    Parameters

    • sprite: any

    Returns void

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

    Returns RenderTexture

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

    Parameters

    • mode: ALPHA_MODES

    Returns void

Properties

clearColor: number[] = ...

An RGBA array used to define the clear color of the RenderTexture

displayed: boolean = false

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

_renderPaths: Map<RenderTexture, any> = ...

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

#onResize: ((arg0: Renderer) => any)

Type declaration

    • (arg0: Renderer): any
    • A bound resize function which fires on the renderer resize event.

      Parameters

      • arg0: Renderer

      Returns any

#backup: { sourceFrame: Rectangle; renderTexture: RenderTexture } = ...

An object which stores a reference to the normal renderer target and source frame. We track this so we can restore them after rendering our cached texture.

Type declaration

  • sourceFrame: Rectangle
  • renderTexture: RenderTexture
#renderTexture: RenderTexture
#sprite: any
textureConfiguration: { multisample: MSAA_QUALITY; scaleMode: SCALE_MODES; format: FORMATS } = {}

The texture configuration to use for this cached container

abstract

Type declaration

  • multisample: MSAA_QUALITY
  • scaleMode: SCALE_MODES
  • format: FORMATS

Methods

  • createRenderTexture([options={}]?: { renderFunction: Function; clearColor: number[] }): RenderTexture
  • Create a render texture, provide a render method and an optional clear color.

    Parameters

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

      Optional parameters.

      • renderFunction: Function
      • clearColor: number[]

    Returns RenderTexture

    A reference to the created render texture.

  • removeRenderTexture(renderTexture: RenderTexture, destroy?: boolean): void
  • Remove a previously created render texture.

    Parameters

    • renderTexture: RenderTexture

      The render texture to remove.

    • destroy: boolean = true

    Returns void

  • Clear the cached container, removing its current contents.

    Parameters

    • destroy: boolean = true

    Returns CachedContainer

    A reference to the cleared container for chaining.

  • destroy(options: any): void
  • inheritdoc

    Parameters

    • options: any

    Returns void

  • render(renderer: any): void
  • inheritdoc

    Parameters

    • renderer: any

    Returns void

  • #renderSecondary(renderer: Renderer): void
  • Custom rendering for secondary render textures

    Parameters

    • renderer: Renderer

      The active canvas renderer.

    Returns void

  • #bind(renderer: Renderer, tex: RenderTexture, clearColor: number[]): void
  • 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.

    • clearColor: number[]

    Returns void

  • #bindPrimaryBuffer(renderer: Renderer): void
  • Bind the primary render texture to the renderer, replacing and saving the original buffer and source frame.

    Parameters

    • renderer: Renderer

      The active canvas renderer.

    Returns void

  • #bindOriginalBuffer(renderer: Renderer): void
  • Remove the render texture from the Renderer, re-binding the original buffer.

    Parameters

    • renderer: Renderer

      The active canvas renderer.

    Returns void

  • #resize(renderer: Renderer): void
  • Resize bound render texture(s) when the dimensions or resolution of the Renderer have changed.

    Parameters

    • renderer: Renderer

      The active canvas renderer.

    Returns void

  • resizeRenderTexture(renderer: Renderer, rt: RenderTexture): 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