texture fixes - compile time stuff - done with multiple deep reflection

beta.r3js.org
Theunis J. Botha 2016-12-06 19:34:22 +01:00
parent 8a932fc9e0
commit c8c0d45e18
4 changed files with 44 additions and 27 deletions

View File

@ -58,4 +58,4 @@ console.log("Loading editor library...");
//#endif
// This gets injected by gulp
console.log("Compiled at", __DATE__);
console.log("GameLib compiled at", __DATE__);

View File

@ -66,87 +66,87 @@ GameLib.D3.API.Texture = function(
}
this.imagePath = imagePath;
if (typeof wrapS == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(wrapS)) {
wrapS = GameLib.D3.Texture.TYPE_REPEAT_WRAPPING;
}
this.wrapS = wrapS;
if (typeof wrapT == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(wrapT)) {
wrapT = GameLib.D3.Texture.TYPE_REPEAT_WRAPPING;
}
this.wrapT = wrapT;
if (typeof repeat == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(repeat)) {
repeat = new GameLib.D3.API.Vector2(1, 1);
}
this.repeat = repeat;
if (typeof data == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(data)) {
data = null;
}
this.data = data;
if (typeof format == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(format)) {
format = GameLib.D3.Texture.TYPE_RGBA_FORMAT;
}
this.format = format;
if (typeof mapping == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(mapping)) {
mapping = GameLib.D3.Texture.TYPE_UV_MAPPING;
}
this.mapping = mapping;
if (typeof magFilter == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(magFilter)) {
magFilter = GameLib.D3.Texture.TYPE_LINEAR_FILTER;
}
this.magFilter = magFilter;
if (typeof minFilter == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(minFilter)) {
minFilter = GameLib.D3.Texture.TYPE_LINEAR_MIPMAP_LINEAR_FILTER;
}
this.minFilter = minFilter;
if (typeof textureType == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(textureType)) {
textureType = GameLib.D3.Texture.TYPE_UNSIGNED_BYTE;
}
this.textureType = textureType;
if (typeof anisotropy == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(anisotropy)) {
anisotropy = 1;
}
this.anisotropy = anisotropy;
if (typeof offset == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(offset)) {
offset = new GameLib.D3.API.Vector2(0, 0);
}
this.offset = offset;
if (typeof generateMipmaps == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(generateMipmaps)) {
generateMipmaps = true;
}
this.generateMipmaps = generateMipmaps;
if (typeof flipY == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(flipY)) {
flipY = true;
}
this.flipY = flipY;
if (typeof mipmaps == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(mipmaps)) {
mipmaps = [];
}
this.mipmaps = mipmaps;
if (typeof unpackAlignment == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(unpackAlignment)) {
unpackAlignment = 4;
}
this.unpackAlignment = unpackAlignment;
if (typeof premultiplyAlpha == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(premultiplyAlpha)) {
premultiplyAlpha = false;
}
this.premultiplyAlpha = premultiplyAlpha;
if (typeof encoding == 'undefined') {
if (GameLib.D3.Utils.UndefinedOrNull(encoding)) {
encoding = GameLib.D3.Texture.TYPE_LINEAR_ENCODING;
}
this.encoding = encoding;

View File

@ -118,15 +118,24 @@ GameLib.D3.Light.prototype.createInstance = function(update) {
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) {
instance.target.position.copy(this.targetPosition.instance);
}
if (instance.target) {
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;

View File

@ -155,6 +155,12 @@ GameLib.D3.Texture.prototype.createInstance = function(update) {
if (update) {
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 {
instance = new this.graphics.instance.Texture(
this.imageInstance,
@ -172,12 +178,14 @@ GameLib.D3.Texture.prototype.createInstance = function(update) {
instance.name = this.name;
instance.flipY = this.flipY;
instance.encoding = this.encoding;
instance.flipY = this.flipY;
instance.offset.copy(this.offset.instance);
instance.repeat.copy(this.repeat.instance);
instance.offset.x = this.offset.x;
instance.offset.y = this.offset.y;
instance.repeat.x = this.repeat.x;
instance.repeat.y = this.repeat.y;
instance.mipmaps = this.mipmaps;
instance.unpackAlignment = this.unpackAlignment;
instance.premultiplyAlpha = this.premultiplyAlpha;
instance.textureType = this.textureType;
instance.needsUpdate = true;
return instance;