AssetManager

Load async assets (gltf, JSON, ...) from a config file and create render data, sounds, and native objects.

Constructor

new AssetManager()

Initialize the native render data.

Classes

AssetManager

Members

conf :AssetManagerConfig

renderData :Object.<string, RenderData>

Type:

sounds :Object.<string, SoundsConfig>

Type:

Methods

createRenderData(idRenderData) → {RenderData}

Return new renderData corresponding to the id passed

Parameters:
NameTypeDescription
idRenderDatastring

Id of the renderData

Returns:
  • A clone of the renderData object
Type: 
RenderData

createSound(idSound, optionsopt) → {Howl}

Create a a new Howl object with the given idSound and options.

Parameters:
NameTypeAttributesDefaultDescription
idSoundstring

Id of sounds in config

optionsobject<optional>
{}

Arguments to create Howl object.

Properties
NameTypeDescription
loopboolean

Set to true to automatically loop the sound forever.

Returns:
  • Used to control the sound
Type: 
Howl

initNativeRenderData()

Build native objects (procedural objects) and stores them in this.renderData object.

loadFromConfig(config, parentDivopt) → {Promise}

Load a 3D render data from a config. Then create the LoadingView process.

Parameters:
NameTypeAttributesDefaultDescription
configAssetManagerConfig

configuration details

parentDivHTMLDivElement<optional>
document.body

where to add the loadingView

Returns:

promise processed to load assets

Type: 
Promise