提交 b86249bb 编写于 作者: V Vincent Lark

passing event handlers. see #4807 #4803

上级 37c74314
......@@ -53,7 +53,7 @@ THREE.AssimpJSONLoader.prototype = {
scene = scope.parse( json );
onLoad( scene );
} );
}, onProgress, onError );
},
setCrossOrigin: function ( value ) {
......
......@@ -22,7 +22,7 @@ THREE.BabylonLoader.prototype = {
onLoad( scope.parse( JSON.parse( text ) ) );
} );
}, onProgress, onError );
},
......
......@@ -26,7 +26,7 @@ THREE.MTLLoader.prototype = {
onLoad( scope.parse( text ) );
} );
}, onProgress, onError );
},
......
......@@ -22,7 +22,7 @@ THREE.OBJLoader.prototype = {
onLoad( scope.parse( text ) );
} );
}, onProgress, onError );
},
......
......@@ -45,9 +45,9 @@ THREE.OBJMTLLoader.prototype = {
onLoad( object );
} );
}, onProgress, onError );
} );
}, onProgress, onError );
},
......
......@@ -12,7 +12,7 @@ THREE.PDBLoader.prototype = {
constructor: THREE.PDBLoader,
load: function ( url, onLoad ) {
load: function ( url, onLoad, onProgress, onError ) {
var scope = this;
......@@ -23,7 +23,7 @@ THREE.PDBLoader.prototype = {
var json = scope.parsePDB( text );
scope.createModel( json, onLoad );
} );
}, onProgress, onError );
},
......
......@@ -25,7 +25,7 @@ THREE.SVGLoader.prototype = {
onLoad( doc.firstChild );
} );
}, onProgress, onError );
}
};
\ No newline at end of file
};
......@@ -32,7 +32,7 @@ THREE.SceneLoader.prototype = {
scope.parse( JSON.parse( text ), onLoad, url );
} );
}, onProgress, onError );
},
......
......@@ -9,7 +9,7 @@ THREE.TGALoader.prototype = {
constructor: THREE.TGALoader,
load: function ( url, onLoad, onError ) {
load: function ( url, onLoad, onError, onProgress ) {
var scope = this;
......@@ -24,7 +24,7 @@ THREE.TGALoader.prototype = {
if ( onLoad ) onLoad( texture );
} );
}, onProgress, onError );
return texture;
......
......@@ -80,6 +80,16 @@
// init scene
init();
var onProgress = function ( xhr ) {
if ( xhr.lengthComputable ) {
var percentComplete = xhr.loaded / xhr.total * 100;
console.log( Math.round(percentComplete, 2) + '% downloaded' );
}
};
var onError = function ( xhr ) {
};
// Load jeep model using the AssimpJSONLoader
var loader1 = new THREE.AssimpJSONLoader();
loader1.load( 'models/assimp/jeep/jeep.assimp.json', function ( assimpjson ) {
......@@ -88,8 +98,7 @@
assimpjson.updateMatrix();
scene.add(assimpjson);
} );
}, onProgress, onError );
// load interior model
var loader2 = new THREE.AssimpJSONLoader();
......@@ -100,7 +109,7 @@
scene.add( assimpjson );
} );
}, onProgress, onError );
animate();
......
......@@ -79,6 +79,17 @@
var texture = new THREE.Texture();
var onProgress = function ( xhr ) {
if ( xhr.lengthComputable ) {
var percentComplete = xhr.loaded / xhr.total * 100;
console.log( Math.round(percentComplete, 2) + '% downloaded' );
}
};
var onError = function ( xhr ) {
};
var loader = new THREE.ImageLoader( manager );
loader.load( 'textures/UV_Grid_Sm.jpg', function ( image ) {
......@@ -105,7 +116,7 @@
object.position.y = - 80;
scene.add( object );
} );
}, onProgress, onError );
//
......
......@@ -76,6 +76,17 @@
// model
var onProgress = function ( xhr ) {
if ( xhr.lengthComputable ) {
var percentComplete = xhr.loaded / xhr.total * 100;
console.log( Math.round(percentComplete, 2) + '% downloaded' );
}
};
var onError = function ( xhr ) {
};
THREE.Loader.Handlers.add( /\.dds$/i, new THREE.DDSLoader() );
var loader = new THREE.OBJMTLLoader();
......@@ -84,7 +95,7 @@
object.position.y = - 80;
scene.add( object );
} );
}, onProgress, onError );
//
......
......@@ -181,6 +181,16 @@
//
var onProgress = function ( xhr ) {
if ( xhr.lengthComputable ) {
var percentComplete = xhr.loaded / xhr.total * 100;
console.log( Math.round(percentComplete, 2) + '% downloaded' );
}
};
var onError = function ( xhr ) {
};
function loadMolecule( url ) {
while( root.children.length > 0 ) {
......@@ -244,7 +254,7 @@
render();
} );
}, onProgress, onError );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册