mirror of
https://github.com/wahyd4/three.js.git
synced 2026-08-09 04:56:01 +10:00
JSONLoader.load( parameters ) to JSONLoader( url, callback, texturePath )
This commit is contained in:
@@ -14,25 +14,27 @@ THREE.JSONLoader.prototype.constructor = THREE.JSONLoader;
|
||||
THREE.JSONLoader.prototype.supr = THREE.Loader.prototype;
|
||||
|
||||
|
||||
/**
|
||||
* Load models generated by slim OBJ converter with ASCII option (converter_obj_three_slim.py -t ascii)
|
||||
* - parameters
|
||||
* - model (required)
|
||||
* - callback (required)
|
||||
* - texture_path (optional: if not specified, textures will be assumed to be in the same folder as JS model file)
|
||||
*/
|
||||
THREE.JSONLoader.prototype.load = function ( url, callback, texturePath ) {
|
||||
|
||||
THREE.JSONLoader.prototype.load = function ( parameters ) {
|
||||
var scope = this, worker;
|
||||
|
||||
var scope = this,
|
||||
url = parameters.model,
|
||||
callback = parameters.callback,
|
||||
texture_path = parameters.texture_path ? parameters.texture_path : this.extractUrlbase( url ),
|
||||
worker = new Worker( url );
|
||||
if ( url instanceof Object ) {
|
||||
|
||||
console.warn( 'DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath ).' );
|
||||
|
||||
var object = url;
|
||||
url = object.model;
|
||||
callback = object.callback;
|
||||
texturePath = object.texture_path;
|
||||
|
||||
}
|
||||
|
||||
worker = new Worker( url );
|
||||
texturePath = texturePath ? texturePath : this.extractUrlbase( url ),
|
||||
|
||||
worker.onmessage = function ( event ) {
|
||||
|
||||
scope.createModel( event.data, callback, texture_path );
|
||||
scope.createModel( event.data, callback, texturePath );
|
||||
scope.onLoadComplete();
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user