PIXI.BasePrepare

class BasePrepare

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.


 // 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);

 })

Constructor


new PIXI.BasePrepare(renderer: PIXI.AbstractRenderer) → {}
Parameters:
Name Type Description
renderer PIXI.AbstractRenderer

A reference to the current renderer

Summary


Properties from BasePrepare

Array<Function>
addHooks
Array<Function>
completes
boolean
ticking
Array<Function>
uploadHooks
Array<any>
protected queue

Collection of items to uploads at once.

PIXI.AbstractRenderer
protected renderer

Reference to the renderer.

any
protected uploadHookHelper

Public Properties


addHooks BasePrepare.ts:251
addHooks: Array<Function>

Collection of additional hooks for finding assets.

completes BasePrepare.ts:263
completes: Array<Function>

Callback to call after completed.

ticking BasePrepare.ts:269
ticking: boolean

If prepare is ticking (running).

uploadHooks BasePrepare.ts:257
uploadHooks: Array<Function>

Collection of additional hooks for processing assets.

Protected Properties


queue BasePrepare.ts:248
protected queue: Array

Collection of items to uploads at once.

renderer BasePrepare.ts:239
protected renderer: PIXI.AbstractRenderer

Reference to the renderer.

uploadHookHelper BasePrepare.ts:242
protected uploadHookHelper: any

The only real difference between CanvasPrepare and Prepare is what they pass to upload hooks. That different parameter is stored here.

Public Methods


add BasePrepare.ts:490
add(item: PIXI.DisplayObject | PIXI.Container | PIXI.BaseTexture | PIXI.Texture | PIXI.Graphics | PIXI.Text | unknown) → {this}

Manually add an item to the uploading queue.

Parameters:
Name Type Description
item PIXI.DisplayObject | PIXI.Container | PIXI.BaseTexture | PIXI.Texture | PIXI.Graphics | PIXI.Text | unknown

Object to add to the queue

Returns:
Type Description
this

Instance of plugin for chaining.

destroy BasePrepare.ts:520
destroy() → {void}

Destroys the plugin, don't use after this.

Returns:
Type Description
void
registerFindHook BasePrepare.ts:458
registerFindHook(addHook: Function) → {this}

Adds hooks for finding items.

Parameters:
Name Type Description
addHook Function

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

Returns:
Type Description
this

Instance of plugin for chaining.

registerUploadHook BasePrepare.ts:474
registerUploadHook(uploadHook: Function) → {this}

Adds hooks for uploading items.

Parameters:
Name Type Description
uploadHook Function

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

Returns:
Type Description
this

Instance of plugin for chaining.

upload BasePrepare.ts:316
upload(item: PIXI.DisplayObject | PIXI.Container | PIXI.BaseTexture | PIXI.Texture | PIXI.Graphics | PIXI.Text) → {Promise<void>}

Upload all the textures and graphics to the GPU.

Parameters:
Name Type Attributes Description
item PIXI.DisplayObject | PIXI.Container | PIXI.BaseTexture | PIXI.Texture | PIXI.Graphics | PIXI.Text

<optional>

Container or display object to search for items to upload or the items to upload themselves, or optionally ommitted, if items have been added using prepare.add.

Returns:
Type Description
Promise<void>
upload BasePrepare.ts:325
upload(item: PIXI.DisplayObject | PIXI.Container | PIXI.BaseTexture | PIXI.Texture | PIXI.Graphics | PIXI.Text, done: Function) → {void}
Deprecated: since version 6.5.0

Use the Promise-based API instead.

Parameters:
Name Type Attributes Description
item PIXI.DisplayObject | PIXI.Container | PIXI.BaseTexture | PIXI.Texture | PIXI.Graphics | PIXI.Text

<optional>

Item to upload.

done Function

<optional>

Callback when completed.

Returns:
Type Description
void
upload BasePrepare.ts:335
upload(done: Function) → {void}
Deprecated: since version 6.5.0

Use the Promise-based API instead.

Parameters:
Name Type Attributes Description
done Function

<optional>

Callback when completed.

Returns:
Type Description
void

Powered by webdoc!