textures working nice

beta.r3js.org
-=yb4f310 2017-06-09 21:52:18 +02:00
parent 14da18f2e8
commit 8f40160d53
4 changed files with 14 additions and 12 deletions

View File

@ -63,7 +63,7 @@ GameLib.D3.Image.prototype.createInstance = function(update) {
loader.path = data.baseUrl;
loader.load(
this.path,
this.path + '?ts=' + Date.now(),
function ( image ) {
this.instance = image;
this.publish(

View File

@ -562,6 +562,7 @@ GameLib.D3.Material.prototype.updateStandardMaterialInstance = function() {
this.instance.visible = this.visible;
this.instance.side = this.side;
this.instance.color = this.color.instance;
// this.instance.specular = this.specular.instance; //standard material doesnt have specular color
this.instance.roughness = this.roughness;
this.instance.metalness = this.metalness;
this.instance.lightMapIntensity = this.lightMapIntensity;
@ -803,8 +804,6 @@ GameLib.D3.Material.prototype.createInstance = function(update) {
if (modified) {
data.texture.instance.needsUpdate = true;
this.publish(
GameLib.Event.MATERIAL_LOADED,
{

View File

@ -204,12 +204,12 @@ GameLib.D3.Texture.prototype.createInstance = function(update) {
return;
}
if (this.instance) {
/**
* The texture has already been loaded
*/
return;
}
// if (this.instance) {
// /**
// * The texture has already been loaded
// */
// return;
// }
if (data.imagePath === this.image.path) {
var instance = new THREE.Texture(
@ -229,7 +229,9 @@ GameLib.D3.Texture.prototype.createInstance = function(update) {
{
texture : this
}
)
);
this.instance.needsUpdate = true;
}
}
);

View File

@ -672,6 +672,7 @@ GameLib.GUI.prototype.buildControl = function(folder, object, property) {
function (value) {
if (object[property] instanceof GameLib.Color) {
object[property].fromHex(value);
object[property].updateInstance();
} else if (typeof this.initialValue === 'number') {
object[property] = Number(value);
} else {
@ -776,8 +777,8 @@ GameLib.GUI.prototype.buildSelectControl = function(folder, object, property, en
/**
* Old way of doing things
*/
//parentObject.buildIdToObject();
//object.updateInstance();
parentObject.buildIdToObject();
object.updateInstance();
}
/**