aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE')
-rwxr-xr-xjs/helper-classes/RDGE/GLGeomObj.js46
-rwxr-xr-xjs/helper-classes/RDGE/GLRectangle.js10
-rwxr-xr-xjs/helper-classes/RDGE/GLWorld.js33
-rwxr-xr-xjs/helper-classes/RDGE/Materials/BumpMetalMaterial.js37
-rw-r--r--js/helper-classes/RDGE/Materials/DeformMaterial.js2
-rwxr-xr-xjs/helper-classes/RDGE/Materials/FlatMaterial.js34
-rw-r--r--js/helper-classes/RDGE/Materials/FlyMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/JuliaMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js2
-rwxr-xr-xjs/helper-classes/RDGE/Materials/LinearGradientMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/MandelMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/PlasmaMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/PulseMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/RadialBlurMaterial.js2
-rwxr-xr-xjs/helper-classes/RDGE/Materials/RadialGradientMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/ReliefTunnelMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/SquareTunnelMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/StarMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/TaperMaterial.js4
-rw-r--r--js/helper-classes/RDGE/Materials/TunnelMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/TwistMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/TwistVertMaterial.js2
-rwxr-xr-xjs/helper-classes/RDGE/Materials/UberMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/WaterMaterial.js2
-rw-r--r--js/helper-classes/RDGE/Materials/ZInvertMaterial.js2
-rw-r--r--js/helper-classes/RDGE/runtime/GLRuntime.js182
-rw-r--r--js/helper-classes/RDGE/runtime/RuntimeGeomObj.js274
-rw-r--r--js/helper-classes/RDGE/runtime/RuntimeMaterial.js140
28 files changed, 703 insertions, 95 deletions
diff --git a/js/helper-classes/RDGE/GLGeomObj.js b/js/helper-classes/RDGE/GLGeomObj.js
index c1ee01ba..955f0f39 100755
--- a/js/helper-classes/RDGE/GLGeomObj.js
+++ b/js/helper-classes/RDGE/GLGeomObj.js
@@ -158,6 +158,52 @@ function GLGeomObj()
158 return fillMaterial; 158 return fillMaterial;
159 } 159 }
160 160
161 this.exportMaterials = function()
162 {
163 var rtnStr = "";
164 if (this._materialArray && this._materialNodeArray)
165 {
166 var nMats = this._materialArray.length;
167 rtnStr += "nMaterials: " + nMats + "\n";
168 for (var i=0; i<nMats; i++)
169 {
170 var matNode = this._materialNodeArray[i];
171 rtnStr += "materialNodeName: " + matNode.name + "\n";
172
173 var material = this._materialArray[i];
174 rtnStr += material.export();
175 }
176 }
177 else
178 rtnStr += "nMaterials: 0\n" ;
179
180 return rtnStr;
181 }
182
183 this.importMaterials = function(importStr)
184 {
185 var nMaterials = Number( this.getPropertyFromString( "nMaterials: ", importStr ) );
186 for (var i=0; i<nMaterials; i++)
187 {
188 var mat;
189 var materialType = this.getPropertyFromString( "material: ", importStr );
190 switch (materialType)
191 {
192 case "flat": mat = new FlatMaterial(); break;
193
194 default:
195 console.log( "material type: " + materialType + " is not supported" );
196 break;
197 }
198
199 if (mat)
200 mat.import( importStr );
201
202 var endIndex = importStr.indexOf( "endMaterial\n" );
203 if (endIndex < 0) break;
204 importStr = importStr.substr( endIndex );
205 }
206 }
161 207
162 this.translate = function(v) 208 this.translate = function(v)
163 { 209 {
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js
index f44350df..2caa7080 100755
--- a/js/helper-classes/RDGE/GLRectangle.js
+++ b/js/helper-classes/RDGE/GLRectangle.js
@@ -166,6 +166,8 @@ function GLRectangle()
166 rtnStr += "flatMaterial"; 166 rtnStr += "flatMaterial";
167 rtnStr += "\n"; 167 rtnStr += "\n";
168 168
169 rtnStr += this.exportMaterials();
170
169 return rtnStr; 171 return rtnStr;
170 } 172 }
171 173
@@ -274,10 +276,10 @@ function GLRectangle()
274 brRadius = -z*(r-l)/(2.0*zn)*brRadiusNDC; 276 brRadius = -z*(r-l)/(2.0*zn)*brRadiusNDC;
275 277
276 // stroke 278 // stroke
277// var strokeMaterial = this.makeStrokeMaterial(); 279 var strokeMaterial = this.makeStrokeMaterial();
278// var strokePrim = this.createStroke([x,y], 2*xFill, 2*yFill, strokeSize, tlRadius, blRadius, brRadius, trRadius, strokeMaterial); 280 var strokePrim = this.createStroke([x,y], 2*xFill, 2*yFill, strokeSize, tlRadius, blRadius, brRadius, trRadius, strokeMaterial);
279// this._primArray.push( strokePrim ); 281 this._primArray.push( strokePrim );
280// this._materialNodeArray.push( strokeMaterial.getMaterialNode() ); 282 this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
281 283
282 // fill 284 // fill
283 tlRadius -= strokeSize; if (tlRadius < 0) tlRadius = 0.0; 285 tlRadius -= strokeSize; if (tlRadius < 0) tlRadius = 0.0;
diff --git a/js/helper-classes/RDGE/GLWorld.js b/js/helper-classes/RDGE/GLWorld.js
index 0ab3c242..d9e91404 100755
--- a/js/helper-classes/RDGE/GLWorld.js
+++ b/js/helper-classes/RDGE/GLWorld.js
@@ -13,7 +13,6 @@ var fragmentShaderSource = "";
13 13
14var rdgeStarted = false; 14var rdgeStarted = false;
15 15
16var nodeCounter = 0;
17var worldCounter = 0; 16var worldCounter = 0;
18 17
19 18
@@ -74,6 +73,10 @@ function GLWorld( canvas, use3D )
74 this._worldCount = worldCounter; 73 this._worldCount = worldCounter;
75 worldCounter++; 74 worldCounter++;
76 75
76 // keep a counter for generating node names
77 this._nodeCounter = 0;
78
79
77 /////////////////////////////////////////////////////////////////////// 80 ///////////////////////////////////////////////////////////////////////
78 // Property accessors 81 // Property accessors
79 /////////////////////////////////////////////////////////////////////// 82 ///////////////////////////////////////////////////////////////////////
@@ -392,6 +395,13 @@ function GLWorld( canvas, use3D )
392 RDGEStart( this._canvas ); 395 RDGEStart( this._canvas );
393 this._canvas.task.stop() 396 this._canvas.task.stop()
394 } 397 }
398
399 this.generateUniqueNodeID = function()
400 {
401 var str = String( this._nodeCounter );
402 this._nodeCounter++;
403 return str;
404 }
395} 405}
396 406
397 407
@@ -418,7 +428,7 @@ GLWorld.prototype.updateObject = function (obj)
418 ctrTrNode = obj.getTransformNode(); 428 ctrTrNode = obj.getTransformNode();
419 if (ctrTrNode == null) 429 if (ctrTrNode == null)
420 { 430 {
421 ctrTrNode = createTransformNode("objRootNode_" + nodeCounter++); 431 ctrTrNode = createTransformNode("objRootNode_" + this._nodeCounter++);
422 this._rootNode.insertAsChild( ctrTrNode ); 432 this._rootNode.insertAsChild( ctrTrNode );
423 obj.setTransformNode( ctrTrNode ); 433 obj.setTransformNode( ctrTrNode );
424 } 434 }
@@ -428,7 +438,7 @@ GLWorld.prototype.updateObject = function (obj)
428 }); 438 });
429 ctrTrNode.meshes = []; 439 ctrTrNode.meshes = [];
430 440
431 ctrTrNode.attachMeshNode(this.renderer.id + "_prim_" + nodeCounter++, prims[0]); 441 ctrTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prims[0]);
432 ctrTrNode.attachMaterial(materialNodes[0]); 442 ctrTrNode.attachMaterial(materialNodes[0]);
433 } 443 }
434 444
@@ -451,12 +461,12 @@ GLWorld.prototype.updateObject = function (obj)
451 } 461 }
452 else 462 else
453 { 463 {
454 childTrNode = createTransformNode("objNode_" + nodeCounter++); 464 childTrNode = createTransformNode("objNode_" + this._nodeCounter++);
455 ctrTrNode.insertAsChild(childTrNode); 465 ctrTrNode.insertAsChild(childTrNode);
456 } 466 }
457 467
458 // attach the instanced box goe 468 // attach the instanced box goe
459 childTrNode.attachMeshNode(this.renderer.id + "_prim_" + nodeCounter++, prim); 469 childTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prim);
460 childTrNode.attachMaterial(materialNodes[i]); 470 childTrNode.attachMaterial(materialNodes[i]);
461 } 471 }
462} 472}
@@ -821,6 +831,8 @@ GLWorld.prototype.export = function( exportForPublish )
821 exportStr += "zNear: " + this._zNear + "\n"; 831 exportStr += "zNear: " + this._zNear + "\n";
822 exportStr += "zFar: " + this._zFar + "\n"; 832 exportStr += "zFar: " + this._zFar + "\n";
823 exportStr += "viewDist: " + this._viewDist + "\n"; 833 exportStr += "viewDist: " + this._viewDist + "\n";
834 if (this._useWebGL)