A loader for loading a .babylon resource.
The .babylon file format used by Babylon.js.


// instantiate a loader var loader = new v3d.BabylonLoader(); // load a Babylon resource loader.load( // resource URL 'models/babylon/skull.babylon', // called when resource is loaded function(object) { scene.add(object); }, // called when loading is in progress function(xhr) { console.log((xhr.loaded / * 100) + '% loaded'); }, // called when loading has errors function(xhr) { console.log('An error happened'); } ); webgl_loader_babylon


BabylonLoader(manager : LoadingManager)

manager — The loadingManager for the loader to use. Default is v3d.DefaultLoadingManager.

Creates a new BabylonLoader.



.load (url : String, onLoad : Function, onProgress : Function, onError : Function) : null

url — A string containing the path/URL of the .babylon file.
onLoad — (optional) A function to be called after loading is successfully completed. The function receives the loaded Object3D as an argument.
onProgress — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, which contains total and loaded bytes.
onError — (optional) A function to be called if an error occurs during loading. The function receives the error as an argument.

Begin loading from url and call onLoad with the parsed response content.

.parse (json : Object) : Object3D

json — The JSON structure to parse.

Parse a JSON structure and return an object or a scene.
Found objects are converted to Mesh with a BufferGeometry and a default MeshPhongMaterial.
Lights are parsed accordingly.

.setPath (path : String) : BabylonLoader

path — Base path.

Set the base path for the file.


For more info on how to obtain the source code of this module see this page.