aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE
diff options
context:
space:
mode:
authorhwc4872012-03-06 11:41:09 -0800
committerhwc4872012-03-06 11:41:09 -0800
commit182f05f2f7a8f43f1589c9b8c15bf00d6e983676 (patch)
tree9cb03f47344379ee501290ac87cadea91dcca443 /js/helper-classes/RDGE
parentcf61d1545bffb25a807706fb56b2fe7f291adc2c (diff)
downloadninja-182f05f2f7a8f43f1589c9b8c15bf00d6e983676.tar.gz
File IO
Diffstat (limited to 'js/helper-classes/RDGE')
-rwxr-xr-xjs/helper-classes/RDGE/Materials/UberMaterial.js36
-rw-r--r--js/helper-classes/RDGE/runtime/RuntimeMaterial.js1
2 files changed, 36 insertions, 1 deletions
diff --git a/js/helper-classes/RDGE/Materials/UberMaterial.js b/js/helper-classes/RDGE/Materials/UberMaterial.js
index 825f88ca..570d3326 100755
--- a/js/helper-classes/RDGE/Materials/UberMaterial.js
+++ b/js/helper-classes/RDGE/Materials/UberMaterial.js
@@ -30,6 +30,8 @@ function UberMaterial()
30 this._specularPower = 32.0; 30 this._specularPower = 32.0;
31 this._environmentAmount = 0.2; // 0 .. 1 31 this._environmentAmount = 0.2; // 0 .. 1
32 32
33 this._MAX_LIGHTS = 4;
34
33 // set the default maps 35 // set the default maps
34 this._diffuseMapOb = { 'texture' : 'assets/images/rocky-diffuse.jpg', 'wrap' : 'REPEAT' }; 36 this._diffuseMapOb = { 'texture' : 'assets/images/rocky-diffuse.jpg', 'wrap' : 'REPEAT' };
35 this._normalMapOb = { 'texture' : 'assets/images/rocky-normal.jpg', 'wrap' : 'REPEAT' }; 37 this._normalMapOb = { 'texture' : 'assets/images/rocky-normal.jpg', 'wrap' : 'REPEAT' };
@@ -428,6 +430,40 @@ function UberMaterial()
428 this._materialNode.setShader(this._shader); 430 this._materialNode.setShader(this._shader);
429 }; 431 };
430 432
433 this.export = function()
434 {
435 // every material needs the base type and instance name
436 var exportStr = "material: " + this.getShaderName() + "\n";
437 exportStr += "name: " + this.getName() + "\n";
438
439 // export the material properties
440 if (typeof caps.material != 'undefined')
441 {
442 exportStr += "material: true\n";
443 exportStr += "ambientColor: " + caps.material.ambientColor + "\n";
444 exportStr += "diffuseColor: " + caps.material.diffuseColor + "\n";
445 exportStr += "specularColor: " + caps.material.specularColor + "\n";
446 exportStr += "specularPower: " + caps.material.specularPower + "\n";
447 }
448
449 if (typeof caps.lighting != 'undefined')
450 {
451 var light = caps.lighting['light' + i];
452 var t;
453 for (var i=0; i<this._MAX_LIGHTS; i++)
454 {
455 if (typeof light != 'undefined')
456 {
457 }
458 }
459 }
460
461 // every material needs to terminate like this
462 exportStr += "endMaterial\n";
463
464 return exportStr;
465 }
466
431 this.buildUberShader = function(caps) 467 this.buildUberShader = function(caps)
432 { 468 {
433 var preproc = ""; 469 var preproc = "";
diff --git a/js/helper-classes/RDGE/runtime/RuntimeMaterial.js b/js/helper-classes/RDGE/runtime/RuntimeMaterial.js
index 0f10cfbe..6c57d102 100644
--- a/js/helper-classes/RDGE/runtime/RuntimeMaterial.js
+++ b/js/helper-classes/RDGE/runtime/RuntimeMaterial.js
@@ -44,7 +44,6 @@ function RuntimeMaterial( world )
44 } 44 }
45} 45}
46 46
47
48function RuntimeFlatMaterial() 47function RuntimeFlatMaterial()
49{ 48{
50 // inherit the members of RuntimeMaterial 49 // inherit the members of RuntimeMaterial