Added progress callback to ColladaLoader.

This commit is contained in:
Erik Kitson
2011-11-24 10:22:39 -08:00
parent fe8e1b881f
commit 298afecf80
+17 -1
View File
@@ -49,7 +49,9 @@ THREE.ColladaLoader = function () {
var TO_RADIANS = Math.PI / 180;
function load ( url, readyCallback ) {
function load ( url, readyCallback, progressCallback ) {
var length = 0;
if ( document.implementation && document.implementation.createDocument ) {
@@ -83,6 +85,20 @@ THREE.ColladaLoader = function () {
}
} else if ( req.readyState == 3 ) {
if ( progressCallback ) {
if ( length == 0 ) {
length = req.getResponseHeader( "Content-Length" );
}
progressCallback( { total: length, loaded: req.responseText.length } );
}
}
}