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