From e065244ac75d1d0f25fd5c75cb58e714a13fe16b Mon Sep 17 00:00:00 2001 From: Jonathan Duran Date: Wed, 14 Mar 2012 08:59:17 -0700 Subject: Squashed commit of the following: merge master into timeline Signed-off-by: Jonathan Duran --- js/lib/rdge/materials/bump-metal-material.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'js/lib/rdge/materials/bump-metal-material.js') diff --git a/js/lib/rdge/materials/bump-metal-material.js b/js/lib/rdge/materials/bump-metal-material.js index 61126952..fa6f5300 100755 --- a/js/lib/rdge/materials/bump-metal-material.js +++ b/js/lib/rdge/materials/bump-metal-material.js @@ -75,7 +75,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() { this.setProperty = function( prop, value ) { // every material should do something with the "color" property - if (prop === "color") prop = "lightDiff"; + if (prop === "color") return; // make sure we have legitimate imput var ok = this.validateProperty( prop, value ); @@ -116,7 +116,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() { this._shader['default'].u_light0Diff.set( this.getLightDiff() ); // set up the material node - this._materialNode = createMaterialNode( this.getShaderName() ); + this._materialNode = createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() ); this._materialNode.setShader(this._shader); // set some image maps @@ -158,10 +158,14 @@ var BumpMetalMaterial = function BumpMetalMaterial() { var exportStr = "material: " + this.getShaderName() + "\n"; exportStr += "name: " + this.getName() + "\n"; + var world = this.getWorld(); + if (!world) + throw new Error( "no world in material.export, " + this.getName() ); + exportStr += "lightDiff: " + this.getLightDiff() + "\n"; exportStr += "diffuseTexture: " + this.getDiffuseTexture() + "\n"; exportStr += "specularTexture: " + this.getSpecularTexture() + "\n"; - exportStr += "normalMap: " + this.getNormalTexture() + "\n"; + exportStr += "normalMap: " + this.getNormalTexture() + "\n"; // every material needs to terminate like this exportStr += "endMaterial\n"; -- cgit v1.2.3