image factory fixes
parent
bdbe1c7664
commit
ae2faff7af
|
@ -4,30 +4,30 @@
|
|||
* @returns {Function}
|
||||
* @constructor
|
||||
*/
|
||||
GameLib.D3.ImageFactory = function (graphics) {
|
||||
GameLib.D3.ImageFactory = function (graphics, baseUrl) {
|
||||
|
||||
graphics.isNotThreeThrow();
|
||||
|
||||
var promiseList = {};
|
||||
|
||||
return function(url, progressCallback) {
|
||||
return function(imagePath, progressCallback) {
|
||||
|
||||
if (!url) {
|
||||
console.log('Attempted to download bad URL : ' + url);
|
||||
throw new Error('Bad URL : ' + url);
|
||||
if (!imagePath) {
|
||||
console.log('Attempted to download bad URL : ' + imagePath);
|
||||
throw new Error('Bad URL : ' + imagePath);
|
||||
}
|
||||
|
||||
if (promiseList[url]) {
|
||||
return promiseList[url];
|
||||
if (promiseList[imagePath]) {
|
||||
return promiseList[imagePath];
|
||||
}
|
||||
|
||||
var defer = Q.defer();
|
||||
|
||||
promiseList[url] = defer.promise;
|
||||
promiseList[imagePath] = defer.promise;
|
||||
|
||||
GameLib.D3.ImageFactory.LoadImage(graphics, url, defer, progressCallback);
|
||||
GameLib.D3.ImageFactory.LoadImage(graphics, baseUrl + imagePath, defer, progressCallback);
|
||||
|
||||
return promiseList[url];
|
||||
return promiseList[imagePath];
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@ GameLib.D3.Scene.LoadScene = function(
|
|||
|
||||
var shapes = [];
|
||||
|
||||
var imageFactory = GameLib.D3.ImageFactory(graphics);
|
||||
var imageFactory = GameLib.D3.ImageFactory(graphics, uploadUrl);
|
||||
|
||||
if (scene.worlds && scene.worlds.length > 0) {
|
||||
console.warn('Implement physics worlds code here');
|
||||
|
@ -648,7 +648,9 @@ GameLib.D3.Scene.prototype.render = function(
|
|||
deltaTime,
|
||||
renderer
|
||||
) {
|
||||
renderer.render(this.instance, this.cameras[this.activeCameraIndex].instance);
|
||||
if(this.sceneCamera) {
|
||||
renderer.render(this.instance, this.sceneCamera);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue