diff options
author | Nivesh Rajbhandari | 2012-02-22 11:36:19 -0800 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-02-22 11:36:19 -0800 |
commit | f775fb752cac57a0c1f6c42c8c60f5ff329eab32 (patch) | |
tree | 62ef5c4e57ed4fe3601eb90d8881b94053df8f3d /js/helper-classes/RDGE/GLWorld.js | |
parent | eb8223a286e3703a0b7995f5472aaec8dcffd7f8 (diff) | |
download | ninja-f775fb752cac57a0c1f6c42c8c60f5ff329eab32.tar.gz |
Revert "Integrating canvas-2d drawing and WebGL fixes, including adding back WebGL materials."
This reverts commit 96a0a8c916533eb5625816192ed38488f639326d.
Diffstat (limited to 'js/helper-classes/RDGE/GLWorld.js')
-rwxr-xr-x | js/helper-classes/RDGE/GLWorld.js | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/js/helper-classes/RDGE/GLWorld.js b/js/helper-classes/RDGE/GLWorld.js index 1edd5cff..c8327064 100755 --- a/js/helper-classes/RDGE/GLWorld.js +++ b/js/helper-classes/RDGE/GLWorld.js | |||
@@ -163,7 +163,7 @@ function GLWorld( canvas, use3D ) | |||
163 | this.renderer.cameraManager().setActiveCamera(cam); | 163 | this.renderer.cameraManager().setActiveCamera(cam); |
164 | 164 | ||
165 | // change clear color | 165 | // change clear color |
166 | //this.renderer.setClearFlags(g_Engine.getContext().DEPTH_BUFFER_BIT); | 166 | this.renderer.setClearFlags(g_Engine.getContext().DEPTH_BUFFER_BIT); |
167 | this.renderer.setClearColor([1.0, 1.0, 1.0, 0.0]); | 167 | this.renderer.setClearColor([1.0, 1.0, 1.0, 0.0]); |
168 | //this.renderer.NinjaWorld = this; | 168 | //this.renderer.NinjaWorld = this; |
169 | 169 | ||
@@ -206,7 +206,6 @@ function GLWorld( canvas, use3D ) | |||
206 | { | 206 | { |
207 | if (!dt) dt = 0.2; | 207 | if (!dt) dt = 0.2; |
208 | 208 | ||
209 | dt = 0.01; // use our own internal throttle | ||
210 | this.elapsed += dt; | 209 | this.elapsed += dt; |
211 | 210 | ||
212 | if (this._useWebGL) | 211 | if (this._useWebGL) |
@@ -233,35 +232,39 @@ function GLWorld( canvas, use3D ) | |||
233 | { | 232 | { |
234 | g_Engine.setContext( this._canvas.uuid ); | 233 | g_Engine.setContext( this._canvas.uuid ); |
235 | var ctx = g_Engine.getContext(); | 234 | var ctx = g_Engine.getContext(); |
235 | var ctx1 = g_Engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle); | ||
236 | if (ctx1 != ctx) | ||
237 | console.log( "***** different contexts (2) *****" ); | ||
238 | var aRenderer = ctx1.renderer; | ||
236 | var renderer = ctx.renderer; | 239 | var renderer = ctx.renderer; |
240 | if (renderer != aRenderer) | ||
241 | { | ||
242 | console.log( "***** DIFFERENT RENDERERS *****" ); | ||
243 | renderer = aRenderer; | ||
244 | } | ||
245 | |||
237 | if (renderer.unloadedTextureCount <= 0) | 246 | if (renderer.unloadedTextureCount <= 0) |
238 | { | 247 | { |
239 | renderer.disableCulling(); | 248 | renderer.disableCulling(); |
240 | //console.log( "GLWorld.draw " + renderer._world._worldCount ); | 249 | //console.log( "GLWorld.draw " + renderer._world._worldCount ); |
241 | renderer._clear(); | ||
242 | this.myScene.render(); | 250 | this.myScene.render(); |
243 | 251 | ||
244 | if (this._firstRender) | 252 | if (this._firstRender) |
245 | { | 253 | { |
246 | if (this._canvas.task) | 254 | this._firstRender = false; |
247 | { | ||
248 | this._firstRender = false; | ||
249 | 255 | ||
250 | if (!this.hasAnimatedMaterials()) | 256 | if (!this.hasAnimatedMaterials()) |
251 | { | 257 | { |
252 | this._canvas.task.stop(); | 258 | //this.myScene.render(); |
253 | //this._renderCount = 10; | 259 | this._canvas.task.stop(); |
254 | } | 260 | //this._renderCount = 10; |
255 | } | 261 | } |
256 | } | 262 | } |
257 | else if (this._renderCount >= 0) | 263 | else if (this._renderCount >= 0) |
258 | { | 264 | { |
259 | if (this._canvas.task) | 265 | this._renderCount--; |
260 | { | 266 | if (this._renderCount <= 0) |
261 | this._renderCount--; | 267 | this._canvas.task.stop(); |
262 | if (this._renderCount <= 0) | ||
263 | this._canvas.task.stop(); | ||
264 | } | ||
265 | } | 268 | } |
266 | } | 269 | } |
267 | } | 270 | } |
@@ -391,9 +394,11 @@ function GLWorld( canvas, use3D ) | |||
391 | if (this._useWebGL) | 394 | if (this._useWebGL) |
392 | { | 395 | { |
393 | rdgeStarted = true; | 396 | rdgeStarted = true; |
394 | this._canvas.rdgeid = this._canvas.uuid; | 397 | |
395 | g_Engine.registerCanvas(this._canvas, this); | 398 | this._canvas.rdgeid = this._canvas.uuid; |
396 | RDGEStart( this._canvas ); | 399 | |
400 | g_Engine.registerCanvas(this._canvas, this); | ||
401 | RDGEStart( this._canvas ); | ||
397 | 402 | ||
398 | //this._canvas.fpsTracker = new fpsTracker( '0' ); | 403 | //this._canvas.fpsTracker = new fpsTracker( '0' ); |
399 | //this._canvas.task = new RDGETask(this._canvas, false); | 404 | //this._canvas.task = new RDGETask(this._canvas, false); |