Inheritance: Loader →
A loader for loading a JSON resource in the JSON Object/Scene format. The files are internally loaded via FileLoader.
const loader = new THREE.ObjectLoader();
const obj = await loader.loadAsync( 'models/json/example.json' );
scene.add( obj );
// Alternatively, to parse a previously loaded JSON structure
const object = await loader.parseAsync( a_json_object );
scene.add( object );
Constructs a new object loader.
manager
The loading manager.
Starts loading from the given URL and pass the loaded 3D object to the onLoad() callback.
url
The path/URL of the file to be loaded. This can also be a data URI.
onLoad
Executed when the loading process has been finished.
onProgress
Executed while the loading is in progress.
onError
Executed when errors occur.
Overrides: Loader#load
Async version of ObjectLoader#load.
url
The path/URL of the file to be loaded. This can also be a data URI.
onProgress
Executed while the loading is in progress.
Overrides: Loader#loadAsync
Returns: A Promise that resolves with the loaded 3D object.
Parses the given JSON. This is used internally by ObjectLoader#load but can also be used directly to parse a previously loaded JSON structure.
json
The serialized 3D object.
onLoad
Executed when all resources (e.g. textures) have been fully loaded.
Overrides: Loader#parse
Returns: The parsed 3D object.
Async version of ObjectLoader#parse.
json
The serialized 3D object.
Returns: A Promise that resolves with the parsed 3D object.