[name]

A loader for loading a .babylon resource.

Example

// instantiate a loader var loader = new v3d.BabylonLoader(); // load a Babylon resource loader.load( // resource URL 'models/babylon/skull.babylon', // Function when resource is loaded function(object) { scene.add(object); }, // Function called when download progresses function(xhr) { console.log((xhr.loaded / xhr.total * 100) + '% loaded'); }, // Function called when download errors function(xhr) { console.log('An error happened'); } ); [example:webgl_loader_babylon]

Constructor

[name]([page: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]([page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError])

[page:String url] — required
[page:function onLoad] — Will be called when load completes. The argument will be the loaded [page:Object3D].
[page:function onProgress] — Will be called while load progresses. The argument will be the XMLHttpRequest instance, which contains .[page:Integer total] and .[page:Integer loaded] bytes.
[page:function onError] — Will be called when load errors.
Begin loading from url and call onLoad with the parsed response content.

[method:Object3D parse]([page: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.
[sourceHint]