Options
All
  • Public
  • Public/Protected
  • All
Menu

The prepare manager provides functionality to upload content to the GPU.

BasePrepare handles basic queuing functionality and is extended by PIXI.Prepare and {@link PIXI.CanvasPrepare} to provide preparation capabilities specific to their respective renderers.

example

// Create a sprite const sprite = PIXI.Sprite.from('something.png');

// Load object into GPU app.renderer.plugins.prepare.upload(sprite, () => {

//Texture(s) has been uploaded to GPU
app.stage.addChild(sprite);

})

abstract
memberof

PIXI

Hierarchy

Index

Constructors

constructor

  • Parameters

    Returns BasePrepare

Properties

addHooks

addHooks: any[]

completes

completes: any[]

Private delayedTick

delayedTick: any

Private limiter

limiter: any

Protected queue

queue: any[]

Protected renderer

ticking

ticking: boolean

Protected uploadHookHelper

uploadHookHelper: any

uploadHooks

uploadHooks: any[]

Methods

add

  • Manually add an item to the uploading queue.

    Parameters

    Returns BasePrepare

    Instance of plugin for chaining.

destroy

  • destroy(): void
  • Destroys the plugin, don't use after this.

    Returns void

Private prepareItems

  • prepareItems(): void
  • Actually prepare items. This is handled outside of the tick because it will take a while and we do NOT want to block the current animation frame from rendering.

    Returns void

registerFindHook

  • Adds hooks for finding items.

    Parameters

    • addHook: IFindHook

      Function call that takes two parameters: item:*, queue:Array function must return true if it was able to add item to the queue.

    Returns BasePrepare

    Instance of plugin for chaining.

registerUploadHook

  • registerUploadHook(uploadHook: IUploadHook): BasePrepare
  • Adds hooks for uploading items.

    Parameters

    • uploadHook: IUploadHook

      Function call that takes two parameters: prepare:CanvasPrepare, item:* and function must return true if it was able to handle upload of item.

    Returns BasePrepare

    Instance of plugin for chaining.

Private tick

  • tick(): void
  • Handle tick update

    Returns void

upload

  • Upload all the textures and graphics to the GPU.

    Parameters

    • item: IDisplayObjectExtended | IUploadHook | IFindHook | (() => void)

      - Either the container or display object to search for items to upload, the items to upload themselves, or the callback function, if items have been added using prepare.add.

    • Optional done: () => void
        • (): void
        • Returns void

    Returns void

Generated using TypeDoc