Graphics Reference
In-Depth Information
function loadModel(model) {
var deferred = Q.defer();
var jsonLoader = new
THREE.JSONLoader();
jsonLoader.load(model,
function(loaded) {
console.log("Loaded model:
", model);
deferred.resolve(loaded);
}, null);
return deferred.promise;
}
function loadOthers(res) {
var deferred = Q.defer();
var xhrLoader = new
THREE.XHRLoader();
xhrLoader.load(res,
function(loaded) {
console.log("Loaded other:
", res);
deferred.resolve(loaded);
}, function(progress) {
deferred.notify(progress);
}, function(error) {
deferred.reject(error);
});
return deferred.promise;
}
6. In the loadOthers function, we are also provided with the progress
information. To make sure that the progress callback is handled cor-
rectly, we use the deferred.notify() function and pass in the
progress object:
Search WWH ::




Custom Search