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) → {}
Name | Type | Description |
---|---|---|
renderer | PIXI.AbstractRenderer |
A reference to the current renderer |
Summary
Properties from BasePrepare
Array<Function> |
|
Array<Function> |
|
boolean |
|
Array<Function> |
|
Array<any> |
Collection of items to uploads at once. |
PIXI.AbstractRenderer |
Reference to the renderer. |
any |
|
Methods from BasePrepare
this |
|
void |
Destroys the plugin, don't use after this. |
this |
|
this |
|
Promise<void> |
|
void |
|
void |
|
Public Properties
addHooks: Array<Function>
Collection of additional hooks for finding assets.
uploadHooks: Array<Function>
Collection of additional hooks for processing assets.
Protected Properties
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(item: PIXI.DisplayObject | PIXI.Container | PIXI.BaseTexture | PIXI.Texture | PIXI.Graphics | PIXI.Text | unknown) → {this}
Manually add an item to the uploading queue.
Name | Type | Description |
---|---|---|
item | PIXI.DisplayObject | PIXI.Container | PIXI.BaseTexture | PIXI.Texture | PIXI.Graphics | PIXI.Text | unknown |
Object to add to the queue |
Type | Description |
---|---|
this |
Instance of plugin for chaining. |
destroy() → {void}
Destroys the plugin, don't use after this.
Type | Description |
---|---|
void |
registerFindHook(addHook: Function) → {this}
Adds hooks for finding items.
Name | Type | Description |
---|---|---|
addHook | Function |
Function call that takes two parameters: |
Type | Description |
---|---|
this |
Instance of plugin for chaining. |
registerUploadHook(uploadHook: Function) → {this}
Adds hooks for uploading items.
Name | Type | Description |
---|---|---|
uploadHook | Function |
Function call that takes two parameters: |
Type | Description |
---|---|
this |
Instance of plugin for chaining. |
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.
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 |
Type | Description |
---|---|
Promise<void> |
upload(item: PIXI.DisplayObject | PIXI.Container | PIXI.BaseTexture | PIXI.Texture | PIXI.Graphics | PIXI.Text, done: Function) → {void}
Use the Promise-based API instead.
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. |
Type | Description |
---|---|
void |
upload(done: Function) → {void}
Use the Promise-based API instead.
Name | Type | Attributes | Description |
---|---|---|---|
done | Function |
<optional> |
Callback when completed. |
Type | Description |
---|---|
void |