aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/bump-metal-material.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-03-13 11:15:34 -0700
committerValerio Virgillito2012-03-13 11:15:34 -0700
commitf6b958360d82854bdaf51848e7fd715d1f633179 (patch)
tree80f6c08bb730089bdd3f26310df8d2363f9ba863 /js/lib/rdge/materials/bump-metal-material.js
parentc24f58c10231c30d3a8a4c9fb9a4f395dd746180 (diff)
parent4d7b86f55c504ee4e8c2460cf6b60cb9a2cf18f0 (diff)
downloadninja-f6b958360d82854bdaf51848e7fd715d1f633179.tar.gz
Merge pull request #105 from joseeight/FileIO-Build-Candidate
File I/O adding webGL/canvas data functionality
Diffstat (limited to 'js/lib/rdge/materials/bump-metal-material.js')
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js10
1 files changed, 7 insertions, 3 deletions
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() {
75 this.setProperty = function( prop, value ) 75 this.setProperty = function( prop, value )
76 { 76 {
77 // every material should do something with the "color" property 77 // every material should do something with the "color" property
78 if (prop === "color") prop = "lightDiff"; 78 if (prop === "color") return;
79 79
80 // make sure we have legitimate imput 80 // make sure we have legitimate imput
81 var ok = this.validateProperty( prop, value ); 81 var ok = this.validateProperty( prop, value );
@@ -116,7 +116,7 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
116 this._shader['default'].u_light0Diff.set( this.getLightDiff() ); 116 this._shader['default'].u_light0Diff.set( this.getLightDiff() );
117 117
118 // set up the material node 118 // set up the material node
119 this._materialNode = createMaterialNode( this.getShaderName() ); 119 this._materialNode = createMaterialNode( this.getShaderName() + "_" + world.generateUniqueNodeID() );
120 this._materialNode.setShader(this._shader); 120 this._materialNode.setShader(this._shader);
121 121
122 // set some image maps 122 // set some image maps
@@ -158,10 +158,14 @@ var BumpMetalMaterial = function BumpMetalMaterial() {
158 var exportStr = "material: " + this.getShaderName() + "\n"; 158 var exportStr = "material: " + this.getShaderName() + "\n";
159 exportStr += "name: " + this.getName() + "\n"; 159 exportStr += "name: " + this.getName() + "\n";
160 160
161 var world = this.getWorld();
162 if (!world)
163 throw new Error( "no world in material.export, " + this.getName() );
164
161 exportStr += "lightDiff: " + this.getLightDiff() + "\n"; 165 exportStr += "lightDiff: " + this.getLightDiff() + "\n";
162 exportStr += "diffuseTexture: " + this.getDiffuseTexture() + "\n"; 166 exportStr += "diffuseTexture: " + this.getDiffuseTexture() + "\n";
163 exportStr += "specularTexture: " + this.getSpecularTexture() + "\n"; 167 exportStr += "specularTexture: " + this.getSpecularTexture() + "\n";
164 exportStr += "normalMap: " + this.getNormalTexture() + "\n"; 168 exportStr += "normalMap: " + this.getNormalTexture() + "\n";
165 169
166 // every material needs to terminate like this 170 // every material needs to terminate like this
167 exportStr += "endMaterial\n"; 171 exportStr += "endMaterial\n";