diff options
Diffstat (limited to 'js/helper-classes/RDGE/Materials/UberMaterial.js')
-rw-r--r-- | js/helper-classes/RDGE/Materials/UberMaterial.js | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/js/helper-classes/RDGE/Materials/UberMaterial.js b/js/helper-classes/RDGE/Materials/UberMaterial.js index 8385f2d6..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 |
@@ -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' } |
524 | }, | 524 | }, |
525 | 'params' : paramBlock, | 525 | 'params' : paramBlock, |
526 | 'states' : { | 526 | 'states' : { |
527 | 'depthEnable' : true, | 527 | 'depthEnable' : true, |
528 | 'blendEnable' : false, | 528 | 'blendEnable' : false, |
529 | 'culling' : true, | 529 | 'culling' : true, |
530 | 'cullFace' : "FRONT", | 530 | 'cullFace' : "FRONT" |
531 | }, | 531 | } |
532 | }] | 532 | }] |
533 | } | 533 | } |
534 | } | 534 | }; |
535 | // initialize the jshader | 535 | // initialize the jshader |
536 | try | 536 | try |
537 | { | 537 | { |
@@ -584,7 +584,7 @@ function UberMaterial() | |||
584 | } | 584 | } |
585 | technique.u_uvMatrix.set(caps.uvTransform || mat4.identity()); | 585 | technique.u_uvMatrix.set(caps.uvTransform || mat4.identity()); |
586 | 586 | ||
587 | renderer = g_Engine.getContext().renderer; | 587 | var renderer = g_Engine.getContext().renderer; |
588 | if(this._useDiffuseMap) { | 588 | if(this._useDiffuseMap) { |
589 | var tex = renderer.getTextureByName(caps.diffuseMap.texture, caps.diffuseMap.wrap, caps.diffuseMap.mips); | 589 | var tex = renderer.getTextureByName(caps.diffuseMap.texture, caps.diffuseMap.wrap, caps.diffuseMap.mips); |
590 | this.registerTexture( tex ); | 590 | this.registerTexture( tex ); |
@@ -608,7 +608,7 @@ function UberMaterial() | |||
608 | } | 608 | } |
60 |