|
@@ -14,25 +14,27 @@ THREE.JSONLoader.prototype.constructor = THREE.JSONLoader;
|
|
THREE.JSONLoader.prototype.supr = THREE.Loader.prototype;
|
|
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 ) {
|
|
worker.onmessage = function ( event ) {
|
|
|
|
|
|
- scope.createModel( event.data, callback, texture_path );
|
|
|
|
|
|
+ scope.createModel( event.data, callback, texturePath );
|
|
scope.onLoadComplete();
|
|
scope.onLoadComplete();
|
|
|
|
|
|
};
|
|
};
|