[name]

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

Example

// 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 / xhr.total * 100) + '% loaded'); }, // called when loading has errors function(xhr) { console.log('An error happened'); } ); [example:webgl_loader_babylon]

Constructor

[name]([param:LoadingManager manager])

[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager v3d.DefaultLoadingManager].

Creates a new [name].

Properties

Methods

[method:null load]([param:String url], [param:Function onLoad], [param:Function onProgress], [param:Function onError])

[page:String url] — A string containing the path/URL of the .babylon file.
[page:function onLoad] — (optional) A function to be called after loading is successfully completed. The function receives the loaded [page:Object3D] as an argument.
[page:function onProgress] — (optional) A function to be called while the loading is in progress. The argument will be the XMLHttpRequest instance, which contains [page:Integer total] and [page:Integer loaded] bytes.
[page:function 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.

[method:Object3D parse]([param:Object json])

[page:Object json] — The JSON structure to parse.

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

[method:BabylonLoader setPath]([param:String path])

[page:String path] — Base path.

Set the base path for the file.

[sourceHint]