canvas check for textures
parent
4f3f777762
commit
7b963ce085
|
@ -203,15 +203,18 @@ GameLib.D3.Texture.prototype.createInstance = function() {
|
|||
|
||||
} else if (this.typeId === GameLib.D3.Texture.TEXTURE_TYPE_NORMAL) {
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(this.image)) {
|
||||
if (
|
||||
GameLib.Utils.UndefinedOrNull(this.image) ||
|
||||
GameLib.Utils.UndefinedOrNull(this.image.instance)
|
||||
) {
|
||||
|
||||
this.instance = new THREE.Texture();
|
||||
|
||||
} else {
|
||||
|
||||
if (GameLib.Utils.UndefinedOrNull(this.image.instance)) {
|
||||
throw new Error('no image instance');
|
||||
}
|
||||
//if (GameLib.Utils.UndefinedOrNull(this.image.instance)) {
|
||||
// throw new Error('no image instance');
|
||||
//}
|
||||
|
||||
this.instance = new THREE.Texture(
|
||||
this.image.instance
|
||||
|
@ -304,7 +307,26 @@ GameLib.D3.Texture.prototype.updateInstance = function() {
|
|||
|
||||
} else if (this.typeId === GameLib.D3.Texture.TEXTURE_TYPE_CANVAS) {
|
||||
|
||||
console.log('todo : canvas change check here');
|
||||
if (
|
||||
GameLib.Utils.UndefinedOrNull(this.canvas) &&
|
||||
this.instance.canvas
|
||||
) {
|
||||
try {
|
||||
this.createInstance();
|
||||
imageChanged = true;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.canvas && this.canvas.instance && this.instance.image !== this.canvas.instance) {
|
||||
try {
|
||||
this.createInstance();
|
||||
imageChanged = true;
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (this.typeId === GameLib.D3.Texture.TEXTURE_TYPE_CUBE) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue