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.path = data.baseUrl;
loader.load( loader.load(
this.path, this.path + '?ts=' + Date.now(),
function ( image ) { function ( image ) {
this.instance = image; this.instance = image;
this.publish( this.publish(

View File

@ -562,6 +562,7 @@ GameLib.D3.Material.prototype.updateStandardMaterialInstance = function() {
this.instance.visible = this.visible; this.instance.visible = this.visible;
this.instance.side = this.side; this.instance.side = this.side;
this.instance.color = this.color.instance; 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.roughness = this.roughness;
this.instance.metalness = this.metalness; this.instance.metalness = this.metalness;
this.instance.lightMapIntensity = this.lightMapIntensity; this.instance.lightMapIntensity = this.lightMapIntensity;
@ -803,8 +804,6 @@ GameLib.D3.Material.prototype.createInstance = function(update) {
if (modified) { if (modified) {
data.texture.instance.needsUpdate = true;
this.publish( this.publish(
GameLib.Event.MATERIAL_LOADED, GameLib.Event.MATERIAL_LOADED,
{ {

View File

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

View File

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