aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/document/html-document.js2
-rwxr-xr-xjs/helper-classes/3D/math-utils.js5
-rwxr-xr-xjs/helper-classes/RDGE/Materials/UberMaterial.js36
-rw-r--r--js/helper-classes/RDGE/runtime/RuntimeMaterial.js1
4 files changed, 41 insertions, 3 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index f1b99866..1f335f79 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -185,7 +185,7 @@ exports.HTMLDocument = Montage.create(TextDocument, {
185 var elt = this.documentRoot; 185 var elt = this.documentRoot;
186 if (elt) 186 if (elt)
187 { 187 {
188 var loadForRuntime = true; 188 var loadForRuntime = false;
189 if (loadForRuntime) 189 if (loadForRuntime)
190 { 190 {
191 //console.log( "load canvas data: " , value ); 191 //console.log( "load canvas data: " , value );
diff --git a/js/helper-classes/3D/math-utils.js b/js/helper-classes/3D/math-utils.js
index 37044763..f084cf9f 100755
--- a/js/helper-classes/3D/math-utils.js
+++ b/js/helper-classes/3D/math-utils.js
@@ -709,7 +709,10 @@ var MathUtilsClass = exports.MathUtilsClass = Object.create(Object.prototype, {
709 // the area of the polygon is the length of the normal 709 // the area of the polygon is the length of the normal
710 var area = VecUtils.vecMag(3, normal ); 710 var area = VecUtils.vecMag(3, normal );
711 if (this.fpSign(area) != 0) 711 if (this.fpSign(area) != 0)
712 vec3.scale(normal, 1.0/area); 712 {
713 //vec3.scale(normal, 1.0/area);
714 normal = VecUtils.vecNormalize(3, normal, 1.0);
715 }
713 716
714 return normal; 717 return normal;
715 } 718 }
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