texture fixes - compile time stuff - done with multiple deep reflection
parent
8a932fc9e0
commit
c8c0d45e18
|
@ -58,4 +58,4 @@ console.log("Loading editor library...");
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
// This gets injected by gulp
|
// This gets injected by gulp
|
||||||
console.log("Compiled at", __DATE__);
|
console.log("GameLib compiled at", __DATE__);
|
||||||
|
|
|
@ -66,87 +66,87 @@ GameLib.D3.API.Texture = function(
|
||||||
}
|
}
|
||||||
this.imagePath = imagePath;
|
this.imagePath = imagePath;
|
||||||
|
|
||||||
if (typeof wrapS == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(wrapS)) {
|
||||||
wrapS = GameLib.D3.Texture.TYPE_REPEAT_WRAPPING;
|
wrapS = GameLib.D3.Texture.TYPE_REPEAT_WRAPPING;
|
||||||
}
|
}
|
||||||
this.wrapS = wrapS;
|
this.wrapS = wrapS;
|
||||||
|
|
||||||
if (typeof wrapT == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(wrapT)) {
|
||||||
wrapT = GameLib.D3.Texture.TYPE_REPEAT_WRAPPING;
|
wrapT = GameLib.D3.Texture.TYPE_REPEAT_WRAPPING;
|
||||||
}
|
}
|
||||||
this.wrapT = wrapT;
|
this.wrapT = wrapT;
|
||||||
|
|
||||||
if (typeof repeat == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(repeat)) {
|
||||||
repeat = new GameLib.D3.API.Vector2(1, 1);
|
repeat = new GameLib.D3.API.Vector2(1, 1);
|
||||||
}
|
}
|
||||||
this.repeat = repeat;
|
this.repeat = repeat;
|
||||||
|
|
||||||
if (typeof data == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(data)) {
|
||||||
data = null;
|
data = null;
|
||||||
}
|
}
|
||||||
this.data = data;
|
this.data = data;
|
||||||
|
|
||||||
if (typeof format == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(format)) {
|
||||||
format = GameLib.D3.Texture.TYPE_RGBA_FORMAT;
|
format = GameLib.D3.Texture.TYPE_RGBA_FORMAT;
|
||||||
}
|
}
|
||||||
this.format = format;
|
this.format = format;
|
||||||
|
|
||||||
if (typeof mapping == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(mapping)) {
|
||||||
mapping = GameLib.D3.Texture.TYPE_UV_MAPPING;
|
mapping = GameLib.D3.Texture.TYPE_UV_MAPPING;
|
||||||
}
|
}
|
||||||
this.mapping = mapping;
|
this.mapping = mapping;
|
||||||
|
|
||||||
if (typeof magFilter == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(magFilter)) {
|
||||||
magFilter = GameLib.D3.Texture.TYPE_LINEAR_FILTER;
|
magFilter = GameLib.D3.Texture.TYPE_LINEAR_FILTER;
|
||||||
}
|
}
|
||||||
this.magFilter = magFilter;
|
this.magFilter = magFilter;
|
||||||
|
|
||||||
if (typeof minFilter == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(minFilter)) {
|
||||||
minFilter = GameLib.D3.Texture.TYPE_LINEAR_MIPMAP_LINEAR_FILTER;
|
minFilter = GameLib.D3.Texture.TYPE_LINEAR_MIPMAP_LINEAR_FILTER;
|
||||||
}
|
}
|
||||||
this.minFilter = minFilter;
|
this.minFilter = minFilter;
|
||||||
|
|
||||||
if (typeof textureType == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(textureType)) {
|
||||||
textureType = GameLib.D3.Texture.TYPE_UNSIGNED_BYTE;
|
textureType = GameLib.D3.Texture.TYPE_UNSIGNED_BYTE;
|
||||||
}
|
}
|
||||||
this.textureType = textureType;
|
this.textureType = textureType;
|
||||||
|
|
||||||
if (typeof anisotropy == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(anisotropy)) {
|
||||||
anisotropy = 1;
|
anisotropy = 1;
|
||||||
}
|
}
|
||||||
this.anisotropy = anisotropy;
|
this.anisotropy = anisotropy;
|
||||||
|
|
||||||
if (typeof offset == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(offset)) {
|
||||||
offset = new GameLib.D3.API.Vector2(0, 0);
|
offset = new GameLib.D3.API.Vector2(0, 0);
|
||||||
}
|
}
|
||||||
this.offset = offset;
|
this.offset = offset;
|
||||||
|
|
||||||
if (typeof generateMipmaps == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(generateMipmaps)) {
|
||||||
generateMipmaps = true;
|
generateMipmaps = true;
|
||||||
}
|
}
|
||||||
this.generateMipmaps = generateMipmaps;
|
this.generateMipmaps = generateMipmaps;
|
||||||
|
|
||||||
if (typeof flipY == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(flipY)) {
|
||||||
flipY = true;
|
flipY = true;
|
||||||
}
|
}
|
||||||
this.flipY = flipY;
|
this.flipY = flipY;
|
||||||
|
|
||||||
if (typeof mipmaps == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(mipmaps)) {
|
||||||
mipmaps = [];
|
mipmaps = [];
|
||||||
}
|
}
|
||||||
this.mipmaps = mipmaps;
|
this.mipmaps = mipmaps;
|
||||||
|
|
||||||
if (typeof unpackAlignment == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(unpackAlignment)) {
|
||||||
unpackAlignment = 4;
|
unpackAlignment = 4;
|
||||||
}
|
}
|
||||||
this.unpackAlignment = unpackAlignment;
|
this.unpackAlignment = unpackAlignment;
|
||||||
|
|
||||||
if (typeof premultiplyAlpha == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(premultiplyAlpha)) {
|
||||||
premultiplyAlpha = false;
|
premultiplyAlpha = false;
|
||||||
}
|
}
|
||||||
this.premultiplyAlpha = premultiplyAlpha;
|
this.premultiplyAlpha = premultiplyAlpha;
|
||||||
|
|
||||||
if (typeof encoding == 'undefined') {
|
if (GameLib.D3.Utils.UndefinedOrNull(encoding)) {
|
||||||
encoding = GameLib.D3.Texture.TYPE_LINEAR_ENCODING;
|
encoding = GameLib.D3.Texture.TYPE_LINEAR_ENCODING;
|
||||||
}
|
}
|
||||||
this.encoding = encoding;
|
this.encoding = encoding;
|
||||||
|
|
|
@ -118,15 +118,24 @@ GameLib.D3.Light.prototype.createInstance = function(update) {
|
||||||
|
|
||||||
instance.name = this.name;
|
instance.name = this.name;
|
||||||
|
|
||||||
instance.position.copy(this.position.instance);
|
instance.position.x = this.position.x;
|
||||||
|
instance.position.y = this.position.y;
|
||||||
|
instance.position.z = this.position.z;
|
||||||
|
|
||||||
instance.scale.copy(this.scale.instance);
|
instance.scale.x = this.scale.x;
|
||||||
|
instance.scale.y = this.scale.y;
|
||||||
|
instance.scale.z = this.scale.z;
|
||||||
|
|
||||||
if (instance.target) {
|
if (instance.target) {
|
||||||
instance.target.position.copy(this.targetPosition.instance);
|
instance.target.position.x = this.targetPosition.x;
|
||||||
|
instance.target.position.y = this.targetPosition.y;
|
||||||
|
instance.target.position.z = this.targetPosition.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.quaternion.copy(this.quaternion.instance);
|
instance.quaternion.x = this.quaternion.x;
|
||||||
|
instance.quaternion.y = this.quaternion.y;
|
||||||
|
instance.quaternion.z = this.quaternion.z;
|
||||||
|
instance.quaternion.w = this.quaternion.w;
|
||||||
|
|
||||||
instance.intensity = this.intensity;
|
instance.intensity = this.intensity;
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,12 @@ GameLib.D3.Texture.prototype.createInstance = function(update) {
|
||||||
|
|
||||||
if (update) {
|
if (update) {
|
||||||
instance = this.instance;
|
instance = this.instance;
|
||||||
|
instance.mapping = this.mapping;
|
||||||
|
instance.wrapS = this.wrapS;
|
||||||
|
instance.wrapT = this.wrapT;
|
||||||
|
instance.magFilter = this.magFilter;
|
||||||
|
instance.minFilter = this.minFilter;
|
||||||
|
instance.anisotropy = this.anisotropy;
|
||||||
} else {
|
} else {
|
||||||
instance = new this.graphics.instance.Texture(
|
instance = new this.graphics.instance.Texture(
|
||||||
this.imageInstance,
|
this.imageInstance,
|
||||||
|
@ -172,12 +178,14 @@ GameLib.D3.Texture.prototype.createInstance = function(update) {
|
||||||
instance.name = this.name;
|
instance.name = this.name;
|
||||||
instance.flipY = this.flipY;
|
instance.flipY = this.flipY;
|
||||||
instance.encoding = this.encoding;
|
instance.encoding = this.encoding;
|
||||||
instance.flipY = this.flipY;
|
instance.offset.x = this.offset.x;
|
||||||
instance.offset.copy(this.offset.instance);
|
instance.offset.y = this.offset.y;
|
||||||
instance.repeat.copy(this.repeat.instance);
|
instance.repeat.x = this.repeat.x;
|
||||||
|
instance.repeat.y = this.repeat.y;
|
||||||
instance.mipmaps = this.mipmaps;
|
instance.mipmaps = this.mipmaps;
|
||||||
instance.unpackAlignment = this.unpackAlignment;
|
instance.unpackAlignment = this.unpackAlignment;
|
||||||
instance.premultiplyAlpha = this.premultiplyAlpha;
|
instance.premultiplyAlpha = this.premultiplyAlpha;
|
||||||
|
instance.textureType = this.textureType;
|
||||||
instance.needsUpdate = true;
|
instance.needsUpdate = true;
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
|
|
Loading…
Reference in New Issue