aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/GLWorld.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/GLWorld.js')
-rwxr-xr-xjs/helper-classes/RDGE/GLWorld.js29
1 files changed, 12 insertions, 17 deletions
diff --git a/js/helper-classes/RDGE/GLWorld.js b/js/helper-classes/RDGE/GLWorld.js
index 1edd5cff..8017207f 100755
--- a/js/helper-classes/RDGE/GLWorld.js
+++ b/js/helper-classes/RDGE/GLWorld.js
@@ -136,13 +136,6 @@ function GLWorld( canvas, use3D )
136 var camMat = Matrix.I(4); 136 var camMat = Matrix.I(4);
137 camMat[14] = this.getViewDistance(); 137 camMat[14] = this.getViewDistance();
138 this.setCameraMat( camMat ); 138 this.setCameraMat( camMat );
139
140 //////////////////////////////////////////
141 // test call to SVG importer
142// console.log( "***** SVG TEST *****" );
143// var svgImporter = new SVGParse( this );
144// svgImporter.importSVG();
145 //////////////////////////////////////////
146 139
147 // post-load processing of the scene 140 // post-load processing of the scene
148 this.init = function() 141 this.init = function()
@@ -164,7 +157,7 @@ function GLWorld( canvas, use3D )
164 157
165 // change clear color 158 // change clear color
166 //this.renderer.setClearFlags(g_Engine.getContext().DEPTH_BUFFER_BIT); 159 //this.renderer.setClearFlags(g_Engine.getContext().DEPTH_BUFFER_BIT);
167 this.renderer.setClearColor([1.0, 1.0, 1.0, 0.0]); 160 this.renderer.setClearColor([0.0, 0.0, 0.0, 0.0]);
168 //this.renderer.NinjaWorld = this; 161 //this.renderer.NinjaWorld = this;
169 162
170 // create an empty scene graph 163 // create an empty scene graph
@@ -198,7 +191,9 @@ function GLWorld( canvas, use3D )
198 this.myScene.addNode(lightTr); 191 this.myScene.addNode(lightTr);
199 192
200 // Add the scene to the engine - necessary if you want the engine to draw for you 193 // Add the scene to the engine - necessary if you want the engine to draw for you
201 g_Engine.AddScene("myScene" + this._canvas.id, this.myScene); 194 //g_Engine.AddScene("myScene" + this._canvas.id, this.myScene);
195 var name = this._canvas.getAttribute( "data-RDGE-id" );
196 g_Engine.AddScene("myScene" + name, this.myScene);
202 } 197 }
203 198
204 // main code for handling user interaction and updating the scene 199 // main code for handling user interaction and updating the scene
@@ -227,11 +222,11 @@ function GLWorld( canvas, use3D )
227 } 222 }
228 223
229 // defining the draw function to control how the scene is rendered 224 // defining the draw function to control how the scene is rendered
230 this.draw = function() 225 this.draw = function()
231 { 226 {
232 if (this._useWebGL) 227 if (this._useWebGL)
233 { 228 {
234 g_Engine.setContext( this._canvas.uuid ); 229 g_Engine.setContext( this._canvas.rdgeid );
235 var ctx = g_Engine.getContext(); 230 var ctx = g_Engine.getContext();
236 var renderer = ctx.renderer; 231 var renderer = ctx.renderer;
237 if (renderer.unloadedTextureCount <= 0) 232 if (renderer.unloadedTextureCount <= 0)
@@ -391,12 +386,10 @@ function GLWorld( canvas, use3D )
391 if (this._useWebGL) 386 if (this._useWebGL)
392 { 387 {
393 rdgeStarted = true; 388 rdgeStarted = true;
394 this._canvas.rdgeid = this._canvas.uuid; 389 var id = this._canvas.getAttribute( "data-RDGE-id" );
390 this._canvas.rdgeid = id;
395 g_Engine.registerCanvas(this._canvas, this); 391 g_Engine.registerCanvas(this._canvas, this);
396 RDGEStart( this._canvas ); 392 RDGEStart( this._canvas );
397
398 //this._canvas.fpsTracker = new fpsTracker( '0' );
399 //this._canvas.task = new RDGETask(this._canvas, false);
400 this._canvas.task.stop() 393 this._canvas.task.stop()
401 } 394 }
402} 395}
@@ -765,7 +758,7 @@ GLWorld.prototype.render = function()
765 else 758 else
766 { 759 {
767// console.log( "GLWorld.render, " + this._worldCount ); 760// console.log( "GLWorld.render, " + this._worldCount );
768 g_Engine.setContext( this._canvas.uuid ); 761 g_Engine.setContext( this._canvas.rdgeId );
769 //this.draw(); 762 //this.draw();
770 this.restartRenderLoop(); 763 this.restartRenderLoop();
771 } 764 }
@@ -821,7 +814,9 @@ GLWorld.prototype.getShapeFromPoint = function( offsetX, offsetY )
821GLWorld.prototype.export = function() 814GLWorld.prototype.export = function()
822{ 815{
823 var exportStr = "GLWorld 1.0\n"; 816 var exportStr = "GLWorld 1.0\n";
824 exportStr += "id: " + this._canvas.rdgeid + "\n"; 817 var id = this.getCanvas().getAttribute( "data-RDGE-id" );
818 exportStr += "id: " + id + "\n";
819 //exportStr += "id: " + this._canvas.rdgeid + "\n";
825 exportStr += "fov: " + this._fov + "\n"; 820 exportStr += "fov: " + this._fov + "\n";
826 exportStr += "zNear: " + this._zNear + "\n"; 821 exportStr += "zNear: " + this._zNear + "\n";
827 exportStr += "zFar: " + this._zFar + "\n"; 822 exportStr += "zFar: " + this._zFar + "\n";