Constructor
new TextureLoader()
Members
(static) loader :TextureLoader
A global reference to the singleton texture loader
Type:
cache :Map.<string, {tex: PIXI.Texture, time: number}>
The cached mapping of textures
Type:
- Map.<string, {tex: PIXI.Texture, time: number}>
CACHE_TTL :number
The duration in milliseconds for which a texture will remain cached
Type:
- number
Methods
(static) loadSceneTextures(scene, optionsopt) → {Promise.<void>}
Load all the textures which are required for a particular Scene
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
scene |
Scene | The Scene to load |
||||||||||||
options |
object |
<optional> |
{}
|
Additional options that configure texture loading Properties
|
Returns:
- Type
- Promise.<void>
expireCache()
Expire (and destroy) textures from the cache which have not been used for more than CACHE_TTL milliseconds.
getCache(src)
Retrieve a texture from the texture cache
Parameters:
Name | Type | Description |
---|---|---|
src |
string | The source URL |
(async) load(sources, optionsopt) → {Promise}
Load an Array of provided source URL paths
Parameters:
Name | Type | Attributes | Default | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
sources |
Array.<string> | The source URLs to load |
|||||||||||||||||
options |
object |
<optional> |
{}
|
Additional options which modify loading Properties
|
Returns:
A Promise which resolves once all textures are loaded
- Type
- Promise
(async) loadImageTexture(src) → {Promise.<PIXI.Texture>}
Load an image texture from a provided source url
Parameters:
Name | Type | Description |
---|---|---|
src |
string |
Returns:
- Type
- Promise.<PIXI.Texture>
(async) loadTexture(src) → {Promise.<PIXI.Texture>}
Load a single texture on-demand from a given source URL path
Parameters:
Name | Type | Description |
---|---|---|
src |
string | The source texture path to load |
Returns:
The loaded texture object
- Type
- Promise.<PIXI.Texture>
(async) loadVideoTexture(src) → {Promise.<PIXI.Texture>}
Load a video texture from a provided source url
Parameters:
Name | Type | Description |
---|---|---|
src |
string |
Returns:
- Type
- Promise.<PIXI.Texture>
setCache(src, tex)
Add an image url to the texture cache
Parameters:
Name | Type | Description |
---|---|---|
src |
string | The source URL |
tex |
PIXI.Texture | The readied texture |