aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
authorhwc4872012-02-01 13:05:32 -0800
committerhwc4872012-02-01 13:05:32 -0800
commitb2ce8b819cc85a558d862c04965b7e65a6ce8640 (patch)
tree520fb12c07ba78f93d22f693369db45248c448d1 /js/helper-classes
parentaa1b4b78d9e1b9cc15529dbf7196b7ac8a88e260 (diff)
downloadninja-b2ce8b819cc85a558d862c04965b7e65a6ce8640.tar.gz
changes to allow minimal rendering ofnon-animated materials.
Diffstat (limited to 'js/helper-classes')
-rw-r--r--js/helper-classes/3D/snap-manager.js11
-rw-r--r--js/helper-classes/RDGE/GLRectangle.js8
-rw-r--r--js/helper-classes/RDGE/GLWorld.js32
-rw-r--r--js/helper-classes/RDGE/Materials/FlatMaterial.js41
-rw-r--r--js/helper-classes/RDGE/src/core/script/engine.js18
-rw-r--r--js/helper-classes/RDGE/src/core/script/jshader.js6
-rw-r--r--js/helper-classes/RDGE/src/core/script/runtime.js4
7 files changed, 68 insertions, 52 deletions
diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js
index 3ed96082..8819f637 100644
--- a/js/helper-classes/3D/snap-manager.js
+++ b/js/helper-classes/3D/snap-manager.js
@@ -1780,7 +1780,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1780 var mergedSnap = this.mergeHitRecords( hitRecs ); 1780 var mergedSnap = this.mergeHitRecords( hitRecs );
1781 if (mergedSnap) 1781 if (mergedSnap)
1782 { 1782 {
1783 while (hitRecs.length > 0) hitRecs.pop(); 1783 while (hitRecs.length > 0) hitRecs.pop();
1784 hitRecs.push( mergedSnap ); 1784 hitRecs.push( mergedSnap );
1785 //console.log( "merged snaps" ); 1785 //console.log( "merged snaps" );
1786 } 1786 }
@@ -1836,6 +1836,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1836 hSnap.setLocalPoint( localPt ); 1836 hSnap.setLocalPoint( localPt );
1837 hSnap.setScreenPoint( scrPt ); 1837 hSnap.setScreenPoint( scrPt );
1838 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); 1838 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED );
1839 hSnap.setElement( stage );
1840 hSnap.setPlane( [0,0,1,0] );
1841 hSnap.setPlaneMatrix( Matrix.I(4) );
1839 if (vSnap.hasAssociatedScreenPoint() ) 1842 if (vSnap.hasAssociatedScreenPoint() )
1840 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); 1843 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() );
1841 if (vSnap.hasAssociatedScreenPoint2() ) 1844 if (vSnap.hasAssociatedScreenPoint2() )
@@ -1882,6 +1885,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1882 hSnap.setLocalPoint( localPt ); 1885 hSnap.setLocalPoint( localPt );
1883 hSnap.setScreenPoint( scrPt ); 1886 hSnap.setScreenPoint( scrPt );
1884 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); 1887 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED );
1888 hSnap.setElement( stage );
1889 hSnap.setPlane( [0,0,1,0] );
1890 hSnap.setPlaneMatrix( Matrix.I(4) );
1885 if (vSnap.hasAssociatedScreenPoint() ) 1891 if (vSnap.hasAssociatedScreenPoint() )
1886 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); 1892 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() );
1887 if (vSnap.hasAssociatedScreenPoint2() ) 1893 if (vSnap.hasAssociatedScreenPoint2() )
@@ -1934,6 +1940,9 @@ var SnapManager = exports.SnapManager = Montage.create(Component, {
1934 hSnap.setLocalPoint( localPt ); 1940 hSnap.setLocalPoint( localPt );
1935 hSnap.setScreenPoint( scrPt ); 1941 hSnap.setScreenPoint( scrPt );
1936 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED ); 1942 hSnap.setType( hSnap.SNAP_TYPE_ALIGN_MERGED );
1943 hSnap.setElement( stage );
1944 hSnap.setPlane( [0,0,1,0] );
1945 hSnap.setPlaneMatrix( Matrix.I(4) );
1937 if (vSnap.hasAssociatedScreenPoint() ) 1946 if (vSnap.hasAssociatedScreenPoint() )
1938 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() ); 1947 hSnap.setAssociatedScreenPoint( vSnap.getAssociatedScreenPoint() );
1939 if (vSnap.hasAssociatedScreenPoint2() ) 1948 if (vSnap.hasAssociatedScreenPoint2() )
diff --git a/js/helper-classes/RDGE/GLRectangle.js b/js/helper-classes/RDGE/GLRectangle.js
index bc3b1478..1bb4bcac 100644
--- a/js/helper-classes/RDGE/GLRectangle.js
+++ b/js/helper-classes/RDGE/GLRectangle.js
@@ -279,10 +279,10 @@ function GLRectangle()
279 brRadius = -z*(r-l)/(2.0*zn)*brRadiusNDC; 279 brRadius = -z*(r-l)/(2.0*zn)*brRadiusNDC;
280 280
281 // stroke 281 // stroke
282// var strokeMaterial = this.makeStrokeMaterial(); 282 var strokeMaterial = this.makeStrokeMaterial();
283// prim = this.createStroke([x,y], 2*xFill, 2*yFill, strokeSize, tlRadius, blRadius, brRadius, trRadius, strokeMaterial) 283 prim = this.createStroke([x,y], 2*xFill, 2*yFill, strokeSize, tlRadius, blRadius, brRadius, trRadius, strokeMaterial)
284// this._primArray.push( prim ); 284 this._primArray.push( prim );
285// this._materialNodeArray.push( strokeMaterial.getMaterialNode() ); 285 this._materialNodeArray.push( strokeMaterial.getMaterialNode() );
286 286
287 // fill 287 // fill
288 tlRadius -= strokeSize; if (tlRadius < 0) tlRadius = 0.0; 288 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 b84bb585..0dc34034 100644
--- a/js/helper-classes/RDGE/GLWorld.js
+++ b/js/helper-classes/RDGE/GLWorld.js
@@ -240,6 +240,7 @@ function GLWorld( canvas, use3D )
240 if (renderer != aRenderer) console.log( "***** DIFFERENT RENDERERS *****" ); 240 if (renderer != aRenderer) console.log( "***** DIFFERENT RENDERERS *****" );
241 renderer.disableCulling(); 241 renderer.disableCulling();
242 this.myScene.render(); 242 this.myScene.render();
243 console.log( "render" );
243 244
244 if (this._firstRender) 245 if (this._firstRender)
245 { 246 {
@@ -247,15 +248,15 @@ function GLWorld( canvas, use3D )
247 248
248 if (!this.hasAnimatedMaterials()) 249 if (!this.hasAnimatedMaterials())
249 { 250 {
250 this.myScene.render(); 251 //this.myScene.render();
251 //this._canvas.task.stop(); 252 //this._canvas.task.stop();
252 this._renderCount = 3; 253 this._renderCount = 10;
253 } 254 }
254 } 255 }
255 else if (this._renderCount >= 0) 256 else if (this._renderCount >= 0)
256 { 257 {
257 this._renderCount--; 258 this._renderCount--;
258 if (this._renderCount == 0) 259 if (this._renderCount <= 0)
259 this._canvas.task.stop(); 260 this._canvas.task.stop();
260 } 261 }
261 262
@@ -270,6 +271,7 @@ function GLWorld( canvas, use3D )
270 this.onRunState = function() 271 this.onRunState = function()
271 { 272 {
272 console.log( "GLWorld.onRunState" ); 273 console.log( "GLWorld.onRunState" );
274 this.restartRenderLoop();
273 } 275 }
274 276
275 this.onLoadState = function() 277 this.onLoadState = function()
@@ -387,16 +389,13 @@ function GLWorld( canvas, use3D )
387 { 389 {
388 rdgeStarted = true; 390 rdgeStarted = true;
389 391
390 // TODO - temporary fix for RDGE id's 392 this._canvas.rdgeid = this._canvas.uuid;
391 this._canvas.id = this._canvas.uuid;
392
393 g_Engine.registerCanvas(this._canvas, this); 393 g_Engine.registerCanvas(this._canvas, this);
394 RDGEStart( this._canvas ); 394 RDGEStart( this._canvas );
395 395
396 //this._canvas.fpsTracker = new fpsTracker( '0' ); 396 //this._canvas.fpsTracker = new fpsTracker( '0' );
397 this._canvas.task = new RDGETask(this._canvas, false); 397 //this._canvas.task = new RDGETask(this._canvas, false);
398 this._canvas.task.stop() 398 this._canvas.task.stop()
399 //this._canvas.task.start()
400 } 399 }
401} 400}
402 401
@@ -508,11 +507,16 @@ GLWorld.prototype.addObject = function( obj )
508 507
509GLWorld.prototype.restartRenderLoop = function() 508GLWorld.prototype.restartRenderLoop = function()
510{ 509{
510 console.log( "restartRenderLoop" );
511
511 this._firstRender = true; 512 this._firstRender = true;
512 if (this._allMapsLoaded) 513 if (this._canvas.task)
513 this._canvas.task.start(); 514 {
514 else 515 if (this._allMapsLoaded)
515 this._canvas.task.stop(); 516 this._canvas.task.start();
517 else
518 this._canvas.task.stop();
519 }
516} 520}
517 521
518//append to the list of objects if obj doesn't already exist 522//append to the list of objects if obj doesn't already exist
@@ -563,7 +567,7 @@ GLWorld.prototype.clearTree = function()
563 { 567 {
564 var root = this._rootNode; 568 var root = this._rootNode;
565 root.children = new Array(); 569 root.children = new Array();
566 g_Engine.unregisterCanvas( this._canvas.id ) 570 g_Engine.unregisterCanvas( this._canvas.rdgeid )
567 571
568 this.update( 0 ); 572 this.update( 0 );
569 this.draw(); 573 this.draw();
@@ -805,7 +809,7 @@ GLWorld.prototype.getShapeFromPoint = function( offsetX, offsetY )
805GLWorld.prototype.export = function() 809GLWorld.prototype.export = function()
806{ 810{
807 var exportStr = "GLWorld 1.0\n"; 811 var exportStr = "GLWorld 1.0\n";
808 exportStr += "id: " + this._canvas.id + "\n"; 812 exportStr += "id: " + this._canvas.rdgeid + "\n";
809 exportStr += "fov: " + this._fov + "\n"; 813 exportStr += "fov: " + this._fov + "\n";
810 exportStr += "zNear: " + this._zNear + "\n"; 814 exportStr += "zNear: " + this._zNear + "\n";
811 exportStr += "zFar: " + this._zFar + "\n"; 815 exportStr += "zFar: " + this._zFar + "\n";
diff --git a/js/helper-classes/RDGE/Materials/FlatMaterial.js b/js/helper-classes/RDGE/Materials/FlatMaterial.js
index f342eef8..3e3ae25e 100644
--- a/js/helper-classes/RDGE/Materials/FlatMaterial.js
+++ b/js/helper-classes/RDGE/Materials/FlatMaterial.js
@@ -50,6 +50,12 @@ function FlatMaterial()
50 // set up the material node 50 // set up the material node
51 this._materialNode = createMaterialNode("flatMaterial"); 51 this._materialNode = createMaterialNode("flatMaterial");
52 this._materialNode.setShader(this._shader); 52 this._materialNode.setShader(this._shader);
53
54 // initialize the taper properties
55// this._shader.colorMe.u_limit1.set( [0.25] );
56// this._shader.colorMe.u_limit2.set( [0.5] );
57// this._shader.colorMe.u_limit3.set( [0.75] );
58// this._shader.colorMe.u_taperAmount.set( [0.5] );
53 } 59 }
54 60