Class: AssetLoader

AssetLoader()

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

Constructor

new AssetLoader()

Source:

Classes

AssetLoader

Methods

assetInfos()

Returns object containing information about all assets loaded by this AssetLoader. Object contains one field that is asset (relative) url, and the value is info object. That's manifest.asset.extras of GLTF file, present in Sketchfab models. Contains author, license, source, and title fields.
Source:

(async) createAsset()

Internal
Source:

dump()

Returns all assets currently loaded from the server, with spatial coordinates of all instances. Note that this does not return object loaded before joining the server, e.g. in world.js, user's own avatar, etc.
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