aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/Materials/UberMaterial.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/Materials/UberMaterial.js')
-rw-r--r--js/helper-classes/RDGE/Materials/UberMaterial.js56
1 files changed, 28 insertions, 28 deletions
diff --git a/js/helper-classes/RDGE/Materials/UberMaterial.js b/js/helper-classes/RDGE/Materials/UberMaterial.js
index 73356b03..c7855c95 100644
--- a/js/helper-classes/RDGE/Materials/UberMaterial.js
+++ b/js/helper-classes/RDGE/Materials/UberMaterial.js
@@ -21,7 +21,7 @@ function UberMaterial()
21 /////////////////////////////////////////////////////////////////////// 21 ///////////////////////////////////////////////////////////////////////
22 this._name = "UberMaterial"; 22 this._name = "UberMaterial";
23 this._shaderName = "uber"; 23 this._shaderName = "uber";
24 this.getShaderName = function() { return this._shaderName; } 24 this.getShaderName = function() { return this._shaderName; };
25 25
26 // set some default values 26 // set some default values
27 this._ambientColor = [ 0.0, 0.0, 0.0, 1.0 ]; 27 this._ambientColor = [ 0.0, 0.0, 0.0, 1.0 ];
@@ -99,7 +99,7 @@ function UberMaterial()
99 break; 99 break;
100 } 100 }
101 } 101 }
102 } 102 };
103 /////////////////////////////////////////////////////////////////////// 103 ///////////////////////////////////////////////////////////////////////
104 104
105 // define the 4 lights 105 // define the 4 lights
@@ -151,10 +151,10 @@ function UberMaterial()
151 { 151 {
152 // ubershader material properties. 152 // ubershader material properties.
153 'material' : { 153 'material' : {
154 'ambientColor' : this._ambientColor, // material ambient color 154 'ambientColor' : this._ambientColor, // material ambient color
155 'diffuseColor' : this._diffuseColor, // material diffuse color 155 'diffuseColor' : this._diffuseColor, // material diffuse color
156 'specularColor' : this._specularColor, // material specular color 156 'specularColor' : this._specularColor, // material specular color
157 'specularPower' : this._specularPower, // material specular power (shininess) 157 'specularPower' : this._specularPower // material specular power (shininess)
158 }, 158 },
159 159
160 // ubershader supports up to four lights. 160 // ubershader supports up to four lights.
@@ -162,7 +162,7 @@ function UberMaterial()
162 'light0' : this._lights[0], 162 'light0' : this._lights[0],
163 'light1' : this._lights[1], 163 'light1' : this._lights[1],
164 'light2' : this._lights[2], 164 'light2' : this._lights[2],
165 'light3' : this._lights[3], 165 'light3' : this._lights[3]
166 }, 166 },
167 167
168 // uvTransform can be used to scale or offset the texture coordinates. 168 // uvTransform can be used to scale or offset the texture coordinates.
@@ -178,7 +178,7 @@ function UberMaterial()
178 'specularMap' : this._specularMapOb, 178 'specularMap' : this._specularMapOb,
179 179
180 // optional environment map 180 // optional environment map
181 'environmentMap' : this._environmentMapOb, 181 'environmentMap' : this._environmentMapOb
182 }; 182 };
183 183
184 this.updateAmbientColor = function() 184 this.updateAmbientColor = function()
@@ -190,7 +190,7 @@ function UberMaterial()
190 var technique = material.shaderProgram.defaultTechnique; 190 var technique = material.shaderProgram.defaultTechnique;
191 technique.u_ambientColor.set(this._ambientColor); 191 technique.u_ambientColor.set(this._ambientColor);
192 } 192 }
193 } 193 };
194 194
195 this.updateDiffuseColor = function() 195 this.updateDiffuseColor = function()
196 { 196 {
@@ -202,7 +202,7 @@ function UberMaterial()
202 var technique = material.shaderProgram.defaultTechnique; 202 var technique = material.shaderProgram.defaultTechnique;
203 technique.u_diffuseColor.set(this._diffuseColor); 203 technique.u_diffuseColor.set(this._diffuseColor);
204 } 204 }
205 } 205 };
206 206
207 this.updateSpecularColor = function( value ) 207 this.updateSpecularColor = function( value )
208 { 208 {
@@ -214,7 +214,7 @@ function UberMaterial()
214 var technique = material.shaderProgram.defaultTechnique; 214 var technique = material.shaderProgram.defaultTechnique;
215 technique.u_specularColor.set(this._specularColor); 215 technique.u_specularColor.set(this._specularColor);
216 } 216 }
217 } 217 };
218 218
219 this.updateSpecularPower = function( value) 219 this.updateSpecularPower = function( value)
220 { 220 {
@@ -226,7 +226,7 @@ function UberMaterial()
226 var technique = material.shaderProgram.defaultTechnique; 226 var technique = material.shaderProgram.defaultTechnique;
227 technique.u_specularPower.set([this._specularPower]); 227 technique.u_specularPower.set([this._specularPower]);
228 } 228 }
229 } 229 };
230 230
231 this.updateEnvironmentAmount = function(value) 231 this.updateEnvironmentAmount = function(value)
232 { 232 {
@@ -238,7 +238,7 @@ function UberMaterial()
238 var technique = material.shaderProgram.defaultTechnique; 238 var technique = material.shaderProgram.defaultTechnique;
239 technique.u_envReflection.set([this._environmentMapOb.envReflection]); 239 technique.u_envReflection.set([this._environmentMapOb.envReflection]);
240 } 240 }
241 } 241 };
242 242
243 this.updateEnvironmentMap = function() 243 this.updateEnvironmentMap = function()
244 { 244 {
@@ -276,7 +276,7 @@ function UberMaterial()
276 } 276 }
277 } 277 }
278 } 278 }
279 } 279 };
280 280
281 this.updateDiffuseMap = function(value) 281 this.updateDiffuseMap = function(value)
282 { 282 {
@@ -314,7 +314,7 @@ function UberMaterial()
314 } 314 }
315 } 315 }
316 } 316 }
317 } 317 };
318 318
319 this.updateSpecularMap = function() 319 this.updateSpecularMap = function()
320 { 320 {
@@ -352,7 +352,7 @@ function UberMaterial()
352 } 352 }
353 } 353 }
354 } 354 }
355 } 355 };
356 356
357 this.updateNormalMap = function(value) 357 this.updateNormalMap = function(value)
358 { 358 {
@@ -390,7 +390,7 @@ function UberMaterial()
390 } 390 }
391 } 391 }
392 } 392 }
393 } 393 };
394 394
395 // duplcate method requirde 395 // duplcate method requirde
396 this.dup = function() 396 this.dup = function()
@@ -413,7 +413,7 @@ function UberMaterial()
413 newMat.setProperty( propNames[i], propValues[i] ); 413 newMat.setProperty( propNames[i], propValues[i] );
414 414
415 return newMat; 415 return newMat;
416 } 416 };
417 417
418 this.init = function( world ) 418 this.init = function( world )
419 { 419 {
@@ -426,7 +426,7 @@ function UberMaterial()
426 // set up the material node 426 // set up the material node
427 this._materialNode = createMaterialNode("uberMaterial"); 427 this._materialNode = createMaterialNode("uberMaterial");
428 this._materialNode.setShader(this._shader); 428 this._materialNode.setShader(this._shader);
429 } 429 };
430 430
431 this.buildUberShader = function(caps) 431 this.buildUberShader = function(caps)
432 { 432 {
@@ -446,7 +446,7 @@ function UberMaterial()
446 { 446 {
447 preproc += '#define LIGHTING\n'; 447 preproc += '#define LIGHTING\n';
448 preproc += '#define SPECULAR\n'; 448 preproc += '#define SPECULAR\n';
449 for(i = 0; i < 4; ++i) { 449 for(var i = 0; i < 4; ++i) {
450 var light = caps.lighting['light' + i]; 450 var light = caps.lighting['light' + i];
451 var t; 451 var t;
452 if (typeof light != 'undefined') { 452 if (typeof light != 'undefined') {
@@ -507,7 +507,7 @@ function UberMaterial()
507 var fshader = preproc + uberFShader; 507 var fshader = preproc + uberFShader;
508 508
509 // build output jshader 509 // build output jshader
510 uberJShader = new jshader(); 510 var uberJShader = new jshader();
511 uberJShader.def = { 511 uberJShader.def = {
512 'shaders': { 512 'shaders': {
513 'defaultVShader': vshader, 513 'defaultVShader': vshader,
@@ -520,18 +520,18 @@ function UberMaterial()
520 'attributes' : { 520 'attributes' : {
521 'a_pos' : { 'type' : 'vec3' }, 521 'a_pos' : { 'type' : 'vec3' },
522 'a_normal' : { 'type' : 'vec3' }, 522 'a_normal' : { 'type' : 'vec3' },
523 'a_texcoord' : { 'type' : 'vec2' }, 523 'a_texcoord' : { 'type' : 'vec2' }