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

BasePrepare handles basic queuing functionality and is extended by PIXI.Prepare and 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.prepare.upload(sprite, () => {
// Texture(s) has been uploaded to GPU
app.stage.addChild(sprite);
});

Abstract

Memberof

PIXI

Hierarchy (view full)

Constructors

  • Parameters

    Returns BasePrepare

Properties

addHooks: any[]

Collection of additional hooks for finding assets.

completes: any[]

Callback to call after completed.

ticking: boolean

If prepare is ticking (running).

uploadHooks: any[]

Collection of additional hooks for processing assets.

uploadsPerFrame: number

The default maximum uploads per frame.

Static

Methods

  • Destroys the plugin, don't use after this.

    Returns void

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

    Instance of plugin for chaining.

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

    Instance of plugin for chaining.

  • Upload all the textures and graphics to the GPU.

    Parameters

    Returns Promise<void>

    Method

    PIXI.BasePrepare#upload

Generated using TypeDoc