提交 2a597765 编写于 作者: M Mr.doob

Merge pull request #5423 from vincent/dev

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