Class: AssetLoader

AssetLoader()

Loads assets from GLTF files and keeps references, creates clones of already loaded assets.

Constructor

new AssetLoader()

Source:

Classes

AssetLoader

Methods

(async) createAsset()

Internal
Source:

dump()

Returns all currently loaded assets, with spatial coordinates of all instances.
Source:

(async) loadAsset(url, callback, failure, progress)

Load or instantiate an AssetContainer from given URL. Used to load avatars, all heavy lifting is done elsewhere.
Parameters:
Name Type Description
url URL to load from
callback optional callback to be executed after successfull load; takes url, AssetContainer and GLTF metadata parameters
failure optional callback to be called with exception
progress optional ProgressIndicator instance
Source:
Returns:
promise

loadObject(obj, callback, failure)

Load or instantiate mesh of a VRObject: if loaded, create a container root and add all objects to scene; if already loaded, instantiate. Utility method that calls this.loadAsset() and post-processes the result to match VRObject and Mesh. Called from WorldManager for pretty everything except avatars.
Parameters:
Name Type Description
obj VRObject to load
callback function executed on success
failure function executed on failure
Source:

unloadObject(obj)

Remove a loaded VRObject from the scene.
Parameters:
Name Type Description
obj VRObject to remove
Source:
Returns:
number of remaining instances