aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-06-25 11:53:19 -0700
committerJose Antonio Marquez2012-06-25 11:53:19 -0700
commit245e70117f9605dc5603328c97685b2e5a10f220 (patch)
tree063b1b147b246bd93b259a2d84d3bc70928f4174 /js/helper-classes
parente74b08a510176d163da9e0bdd771d9b28176a12a (diff)
parentde38cd3479bd5865e058938095120fa3526fc9b3 (diff)
downloadninja-245e70117f9605dc5603328c97685b2e5a10f220.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into Document
Diffstat (limited to 'js/helper-classes')
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js32
-rwxr-xr-xjs/helper-classes/RDGE/rdge-compiled.js12
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/runtime.js6
3 files changed, 42 insertions, 8 deletions
diff --git a/js/helper-classes/3D/draw-utils.js b/js/helper-classes/3D/draw-utils.js
index bd47ffc3..87151964 100755
--- a/js/helper-classes/3D/draw-utils.js
+++ b/js/helper-classes/3D/draw-utils.js
@@ -1185,8 +1185,38 @@ var DrawUtils = exports.DrawUtils = Montage.create(Component, {
1185 var context = this.application.ninja.stage.gridContext; 1185 var context = this.application.ninja.stage.gridContext;
1186 var stage = this.application.ninja.stage; 1186 var stage = this.application.ninja.stage;
1187 var stageRoot = this.application.ninja.currentDocument.model.documentRoot; 1187 var stageRoot = this.application.ninja.currentDocument.model.documentRoot;
1188 var bounds3D = this.viewUtils.getElementBoundsInGlobal(stageRoot);
1189 1188
1189 // draw an outline around the template body if stage has any transforms
1190 if(stage.currentDocument.model.views.design._template && !MathUtils.isIdentityMatrix(this.viewUtils.getMatrixFromElement(stageRoot))) {
1191 var saveContext = this.getDrawingSurfaceElement();
1192 this.setDrawingSurfaceElement(this.application.ninja.stage.gridCanvas);
1193
1194 var stagePt = MathUtils.getPointOnPlane([0,0,1,0]);
1195 var stageMat = this.getPlaneToWorldMatrix([0,0,1], stagePt);
1196 var width = this.snapManager.getStageWidth(),
1197 height = this.snapManager.getStageHeight(),
1198 pt0 = [0, 0, 0],
1199 pt1 = [0, height, 0],
1200 delta = [width, 0, 0];
1201
1202 this._gridLineArray.length = 0;
1203 this.drawGridLines(pt0, pt1, delta, stageMat, 2);
1204
1205 pt0 = [0, 0, 0];
1206 pt1 = [width, 0, 0];
1207 delta = [0, height, 0];
1208 this.drawGridLines(pt0, pt1, delta, stageMat, 2);
1209
1210 this._lineColor = "red";
1211 for (var i = 0; i < 4; i++) {
1212 this.drawIntersectedLine(this._gridLineArray[i], this._drawingContext);
1213 }
1214
1215 this.setDrawingSurfaceElement(saveContext);
1216 }
1217
1218 // draw reference lines across origin
1219 var bounds3D = this.viewUtils.getElementBoundsInGlobal(stageRoot);
1190 var l = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [0, 0, 0], [0, stage.canvas.height, 0], 0.1); 1220 var l = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [0, 0, 0], [0, stage.canvas.height, 0], 0.1);
1191 if(!l) return; 1221 if(!l) return;
1192 var r = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [stage.canvas.width, 0, 0], [stage.canvas.width, stage.canvas.height, 0], 0.1); 1222 var r = MathUtils.segSegIntersection2D(bounds3D[0], bounds3D[3], [stage.canvas.width, 0, 0], [stage.canvas.width, stage.canvas.height, 0], 0.1);
diff --git a/js/helper-classes/RDGE/rdge-compiled.js b/js/helper-classes/RDGE/rdge-compiled.js
index 0bbcb05b..53a99c35 100755
--- a/js/helper-classes/RDGE/rdge-compiled.js
+++ b/js/helper-classes/RDGE/rdge-compiled.js
@@ -248,13 +248,13 @@ RDGE.SceneGraph.prototype.insertAbove=function(a,b){RDGE.verifyTransformNode(a);
248RDGE.SceneGraph.prototype._TraverseDFHelper=function(a,b,c){if("undefined"!=b.children){var d=[];for(d.push({node:b,parent:null});0<d.length;){c=d.pop();b=c.node;c=c.parent;if(void 0!==b.transformNode&&(b=b.transformNode,!1===a.process(b,c)))continue;if(void 0!==b.children)for(c=0;c<b.children.length;++c)d.push({node:b.children[c],parent:b})}}}; 248RDGE.SceneGraph.prototype._TraverseDFHelper=function(a,b,c){if("undefined"!=b.children){var d=[];for(d.push({node:b,parent:null});0<d.length;){c=d.pop();b=c.node;c=c.parent;if(void 0!==b.transformNode&&(b=b.transformNode,!1===a.process(b,c)))continue;if(void 0!==b.children)for(c=0;c<b.children.length;++c)d.push({node:b.children[c],parent:b})}}};
249RDGE.SceneGraph.prototype._TraverseDFPostOrderHelper=function(a,b,c){if("undefined"!=b.children){var d=[];d.push({node:b,parent:null});for(b=d.length;0<b;){for(var b=d.length,c=g.children[b-1],c=void 0==c.children?0:c.children.length,f=0;f<c;++f)d.push({node:g.children[f],parent:g});if(!(0<c)){var c=d.pop(),g=c.node,c=c.parent;void 0!==g.transformNode&&(g=g.transformNode,a.process(g,c))}}}}; 249RDGE.SceneGraph.prototype._TraverseDFPostOrderHelper=function(a,b,c){if("undefined"!=b.children){var d=[];d.push({node:b,parent:null});for(b=d.length;0<b;){for(var b=d.length,c=g.children[b-1],c=void 0==c.children?0:c.children.length,f=0;f<c;++f)d.push({node:g.children[f],parent:g});if(!(0<c)){var c=d.pop(),g=c.node,c=c.parent;void 0!==g.transformNode&&(g=g.transformNode,a.process(g,c))}}}};
250RDGE.SceneGraph.prototype.BuildBVHHelper=function(a){if("undefined"!=a.children){a.bbox_world?a.bbox_world.reset():a.bbox_world=new RDGE.box;void 0==a.local&&(a.local=RDGE.mat4.identity());var b=[],c=0;a.id="root";b.push({node:a,xfrm:RDGE.mat4.identity(),parent:null,visited:!1});for(var a=b.length,d=0;0<a;){var a=b.length,d=a-1,f=void 0==b[d].node.transformNode?b[d].node:b[d].node.transformNode,g=b[d].xfrm,h=b[d].parent,d=b[d].visited;void 0==f.id&&(f.id="id"+c);if(!d){if(void 0!==f.local&&(f.bbox_world? 250RDGE.SceneGraph.prototype.BuildBVHHelper=function(a){if("undefined"!=a.children){a.bbox_world?a.bbox_world.reset():a.bbox_world=new RDGE.box;void 0==a.local&&(a.local=RDGE.mat4.identity());var b=[],c=0;a.id="root";b.push({node:a,xfrm:RDGE.mat4.identity(),parent:null,visited:!1});for(var a=b.length,d=0;0<a;){var a=b.length,d=a-1,f=void 0==b[d].node.transformNode?b[d].node:b[d].node.transformNode,g=b[d].xfrm,h=b[d].parent,d=b[d].visited;void 0==f.id&&(f.id="id"+c);if(!d){if(void 0!==f.local&&(f.bbox_world?
251f.bbox_world.reset():f.bbox_world=new RDGE.box,d=this.GetBBoxForNode(f),f.world=RDGE.mat4.mul(f.local,g),d&&(f.bbox_world=d.transform(f.world)),!d||!d.isValid()))g=new RDGE.box,g.set(0,0),f.bbox_world=g;g=void 0==f.children?0:f.children.length;for(d=0;d<g;++d)b.push({node:f.children[d],xfrm:f.world,parent:f,visited:!1});c++;if(0<g)continue}h&&h.bbox_world&&h.bbox_world.isValid()&&f.bbox_world&&f.bbox_world.isValid()&&h.bbox_world.addBox(f.bbox_world);b.pop();a=b.length;if(0<a&&(void 0==b[a-1].node.transformNode? 251f.bbox_world.reset():f.bbox_world=new RDGE.box,d=this.GetBBoxForNode(f),f.world=RDGE.mat4.mul(f.local,g),d&&(f.bbox_world=d.transform(f.world)),!d||!d.isValid()))g=new RDGE.box,g.set(0,0),f.bbox_world=g;g=void 0==f.children?0:f.children.length;for(d=0;d<g;++d)b.push({node:f.children[d],xfrm:f.world,parent:f,visited:!1});c++;if(0<g)continue}h&&(h.bbox_world&&h.bbox_world.isValid()&&f.bbox_world&&f.bbox_world.isValid())&&h.bbox_world.addBox(f.bbox_world);b.pop();a=b.length;if(0<a&&(void 0==b[a-1].node.transformNode?
252b[a-1].node:b[a-1].node.transformNode).id==h.id)b[a-1].visited=!0}}};RDGE.SceneGraph.prototype._TraverseBFHelper=function(a,b){if("undefined"!=b.children){var c=[];for(c.push({node:b,parent:null});0<c.length;){var d=c.shift(),f=d.node,d=d.parent;void 0!==f.transformNode&&(f=f.transformNode,a.process(f,d));if(void 0!==f.children)for(d=0;d<f.children.length;++d)c.push({node:f.children[d],parent:f})}}}; 252b[a-1].node:b[a-1].node.transformNode).id==h.id)b[a-1].visited=!0}}};RDGE.SceneGraph.prototype._TraverseBFHelper=function(a,b){if("undefined"!=b.children){var c=[];for(c.push({node:b,parent:null});0<c.length;){var d=c.shift(),f=d.node,d=d.parent;void 0!==f.transformNode&&(f=f.transformNode,a.process(f,d));if(void 0!==f.children)for(d=0;d<f.children.length;++d)c.push({node:f.children[d],parent:f})}}};
253RDGE.SceneGraph.prototype.update=function(a){var b=RDGE.globals.engine.getContext().renderer;RDGE.globals.engine.getContext().debug.mat4CallCount=0;for(var c=this.animstack.length-1;0<=c;)this.animstack[c].step(a),--c;this.BuildBVHHelper(this.scene);RDGE.g_particleSystemManager.update(a);a=b.cameraManager().getActiveCamera();void 0!==a&&null!=a&&null!=a.controller&&void 0!==a.controller.world&&a.setWorld(a.controller.world);this.tick++}; 253RDGE.SceneGraph.prototype.update=function(a){var b=RDGE.globals.engine.getContext().renderer;RDGE.globals.engine.getContext().debug.mat4CallCount=0;for(var c=this.animstack.length-1;0<=c;)this.animstack[c].step(a),--c;this.BuildBVHHelper(this.scene);RDGE.g_particleSystemManager.update(a);a=b.cameraManager().getActiveCamera();void 0!==a&&(null!=a&&null!=a.controller&&void 0!==a.controller.world)&&a.setWorld(a.controller.world);this.tick++};
254RDGE.SceneGraph.prototype.render=function(a,b){if(0!=this.scene.children.length){var c=RDGE.globals.engine.getContext().renderer;RDGE.rdgeGlobalParameters.u_shadowLightFarZ.set([this.mainLight.zFar()]);this.renderList=this._RenderDFHelper(c,a,this.scene,b);this.shadowsEnabled&&(this.Traverse(this.shadowCuller,!0),this.shadowRenderList=this.shadowCuller.result);this.renderGraph.render(this);RDGE.g_particleSystemManager.render()}}; 254RDGE.SceneGraph.prototype.render=function(a,b){if(0!=this.scene.children.length){var c=RDGE.globals.engine.getContext().renderer;RDGE.rdgeGlobalParameters.u_shadowLightFarZ.set([this.mainLight.zFar()]);this.renderList=this._RenderDFHelper(c,a,this.scene,b);this.shadowsEnabled&&(this.Traverse(this.shadowCuller,!0),this.shadowRenderList=this.shadowCuller.result);this.renderGraph.render(this);RDGE.g_particleSystemManager.render()}};
255RDGE.SceneGraph.prototype.GetBBoxForNode=function(a){var b=null;if(a.materialNode&&a.materialNode.meshNode){var c=null,c=RDGE.globals.meshMan.getModelByName(a.materialNode.meshNode.mesh.name);null!=c&&(b=c.bbox)}return b}; 255RDGE.SceneGraph.prototype.GetBBoxForNode=function(a){var b=null;if(a.materialNode&&a.materialNode.meshNode){var c=null,c=RDGE.globals.meshMan.getModelByName(a.materialNode.meshNode.mesh.name);null!=c&&(b=c.bbox)}return b};
256RDGE.SceneGraph.prototype._RenderDFHelper=function(a,b,c){renderList=[];renderList[this.bckTypes.BACKGROUND]=[];renderList[this.bckTypes.OPAQUE]=[];renderList[this.bckTypes.TRANSPARENT]=[];renderList[this.bckTypes.ADDITIVE]=[];renderList[this.bckTypes.TRANSLUCENT]=[];renderList[this.bckTypes.FOREGROUND]=[];if("undefined"!=c.children){b=[];b.push({node:c,curCtx:RDGE.globals.engine.defaultContext});for(a=a.cameraManager().getActiveCamera();0<b.length;){var d=b.pop(),c=d.node,f=new RDGE.RenderContext; 256RDGE.SceneGraph.prototype._RenderDFHelper=function(a,b,c){renderList=[];renderList[this.bckTypes.BACKGROUND]=[];renderList[this.bckTypes.OPAQUE]=[];renderList[this.bckTypes.TRANSPARENT]=[];renderList[this.bckTypes.ADDITIVE]=[];renderList[this.bckTypes.TRANSLUCENT]=[];renderList[this.bckTypes.FOREGROUND]=[];if("undefined"!=c.children){b=[];b.push({node:c,curCtx:RDGE.globals.engine.defaultContext});for(a=a.cameraManager().getActiveCamera();0<b.length;){var d=b.pop(),c=d.node,f=new RDGE.RenderContext;
257f.Load(d.curCtx);if(void 0!==c.transformNode){c=c.transformNode;if(void 0!==c.hide&&!0==c.hide)continue;if(this.frustumCulling&&c.bbox_world&&c.bbox_world.isValid()&&!c.bbox_world.isVisible(a.frustum))continue;f.shaderProg=this.jdefShaderProgram;d=RDGE.rdgeConstants.categoryEnumeration.OPAQUE;if(c.materialNode){d=c.materialNode.sortCategory;void 0!==c.materialNode.shaderProgram&&(f.shaderProg=c.materialNode.shaderProgram);void 0!==c.materialNode.textureList&&(f.textureList=c.materialNode.textureList.slice()); 257f.Load(d.curCtx);if(void 0!==c.transformNode){c=c.transformNode;if(void 0!==c.hide&&!0==c.hide)continue;if(this.frustumCulling&&(c.bbox_world&&c.bbox_world.isValid())&&!c.bbox_world.isVisible(a.frustum))continue;f.shaderProg=this.jdefShaderProgram;d=RDGE.rdgeConstants.categoryEnumeration.OPAQUE;if(c.materialNode){d=c.materialNode.sortCategory;void 0!==c.materialNode.shaderProgram&&(f.shaderProg=c.materialNode.shaderProgram);void 0!==c.materialNode.textureList&&(f.textureList=c.materialNode.textureList.slice());
2580<c.materialNode.uniforms.length&&(f.uniforms=c.materialNode.uniforms.slice());for(var g=c.materialNode.lightChannel.length,h=0;h<g;++h)c.materialNode.lightChannel[h]&&(f.lights[h]=c.materialNode.lightChannel[h])}this.sortFunc[d](renderList[d],{context:f,node:c,parent:parent})}if(void 0!==c.children){d=c.children.length;for(g=0;g<d;++g)b.push({node:c.children[g],curCtx:f})}}}return renderList}; 2580<c.materialNode.uniforms.length&&(f.uniforms=c.materialNode.uniforms.slice());for(var g=c.materialNode.lightChannel.length,h=0;h<g;++h)c.materialNode.lightChannel[h]&&(f.lights[h]=c.materialNode.lightChannel[h])}this.sortFunc[d](renderList[d],{context:f,node:c,parent:parent})}if(void 0!==c.children){d=c.children.length;for(g=0;g<d;++g)b.push({node:c.children[g],curCtx:f})}}}return renderList};
259RDGE.SceneGraph.prototype.enableShadows=function(a){a?(a=RDGE.globals.engine.getContext().renderer,this.shadowCuller=new shadowCullPass(this.mainLight,RDGE.rdgeConstants.categoryEnumeration.OPAQUE,function(a,c){return a<c}),this.mainLight.init(),this.mainLight.setPerspective(45,a.vpWidth/a.vpHeight,1,200),this.mainLight.setLookAt([-60,17,-15],[-5,-5,15],RDGE.vec3.up()),RDGE.rdgeGlobalParameters.u_shadowLightWorld.set(this.mainLight.world),RDGE.rdgeGlobalParameters.u_vShadowLight.set(this.mainLight.view), 259RDGE.SceneGraph.prototype.enableShadows=function(a){a?(a=RDGE.globals.engine.getContext().renderer,this.shadowCuller=new shadowCullPass(this.mainLight,RDGE.rdgeConstants.categoryEnumeration.OPAQUE,function(a,c){return a<c}),this.mainLight.init(),this.mainLight.setPerspective(45,a.vpWidth/a.vpHeight,1,200),this.mainLight.setLookAt([-60,17,-15],[-5,-5,15],RDGE.vec3.up()),RDGE.rdgeGlobalParameters.u_shadowLightWorld.set(this.mainLight.world),RDGE.rdgeGlobalParameters.u_vShadowLight.set(this.mainLight.view),
260a=RDGE.mat4.identity(),a=RDGE.mat4.scale(a,[0.5,0.5,0.5]),a=RDGE.mat4.translate(a,[0.5,0.5,0.5]),RDGE.rdgeGlobalParameters.u_shadowBiasMatrix.set(a),a=RDGE.mat4.mul(this.mainLight.proj,a),a=RDGE.mat4.mul(this.mainLight.view,a),RDGE.rdgeGlobalParameters.u_shadowBPV.set(a),this.shadowsEnabled=!0):(this.mainLight=null,this.shadowsEnabled=!1)}; 260a=RDGE.mat4.identity(),a=RDGE.mat4.scale(a,[0.5,0.5,0.5]),a=RDGE.mat4.translate(a,[0.5,0.5,0.5]),RDGE.rdgeGlobalParameters.u_shadowBiasMatrix.set(a),a=RDGE.mat4.mul(this.mainLight.proj,a),a=RDGE.mat4.mul(this.mainLight.view,a),RDGE.rdgeGlobalParameters.u_shadowBPV.set(a),this.shadowsEnabled=!0):(this.mainLight=null,this.shadowsEnabled=!1)};
@@ -312,8 +312,8 @@ RDGE.RunState.prototype.LeaveState=function(){if(void 0!=this.userRunState.onCom
312RDGE.LoadState.prototype.loadTexture=function(a){"LoadState"!=this.stateManager.currentState().name&&this.stateManager.PushState(this.stateManager.RDGEInitState,"noInit");this.textureLoadQueue.push(a)};RDGE.LoadState.prototype.Init=function(){this.sceneName&&this.loadScene("assets_web/mesh/"+this.sceneName+".json",this.sceneName);if(this.hasUserState&&this.userRunState&&this.userRunState.onLoadState)this.userRunState.onLoadState()}; 312RDGE.LoadState.prototype.loadTexture=function(a){"LoadState"!=this.stateManager.currentState().name&&this.stateManager.PushState(this.stateManager.RDGEInitState,"noInit");this.textureLoadQueue.push(a)};RDGE.LoadState.prototype.Init=function(){this.sceneName&&this.loadScene("assets_web/mesh/"+this.sceneName+".json",this.sceneName);if(this.hasUserState&&this.userRunState&&this.userRunState.onLoadState)this.userRunState.onLoadState()};
313RDGE.LoadState.prototype.ReInit=function(){if(this.hasUserState&&this.userRunState&&this.userRunState.onLoadState)this.userRunState.onLoadState()};RDGE.LoadState.prototype.Resize=function(){RDGE.globals.engine.lastWindowWidth==window.innerWidth&&RDGE.globals.engine.lastWindowHeight==window.innerHeight&&(this.userRunState.resize(),RDGE.globals.engine.lastWindowWidth=window.innerWidth,RDGE.globals.engine.lastWindowHeight=window.innerHeight)}; 313RDGE.LoadState.prototype.ReInit=function(){if(this.hasUserState&&this.userRunState&&this.userRunState.onLoadState)this.userRunState.onLoadState()};RDGE.LoadState.prototype.Resize=function(){RDGE.globals.engine.lastWindowWidth==window.innerWidth&&RDGE.globals.engine.lastWindowHeight==window.innerHeight&&(this.userRunState.resize(),RDGE.globals.engine.lastWindowWidth=window.innerWidth,RDGE.globals.engine.lastWindowHeight=window.innerHeight)};
314RDGE.LoadState.prototype.Update=function(a){var b=this.sceneLoadQueue.length-1;-1<b&&(b=this.sceneLoadQueue[b],RDGE.globals.meshMan.processMeshData(),b.doSceneRequest?b.requestScene():b.requestComplete&&(b.sceneBeginProcessing?(b.scene=new RDGE.SceneGraph(b.rawData),b.scene.enableShadows(!0),RDGE.globals.engine.AddScene(b.name,b.scene),b.scene.Traverse(b.sceneProcessor,!1),b.sceneBeginProcessing=!1):b.processingComplete()&&(b=this.sceneLoadQueue.shift(),this.userRunState.onComplete(b.name,b.scene)))); 314RDGE.LoadState.prototype.Update=function(a){var b=this.sceneLoadQueue.length-1;-1<b&&(b=this.sceneLoadQueue[b],RDGE.globals.meshMan.processMeshData(),b.doSceneRequest?b.requestScene():b.requestComplete&&(b.sceneBeginProcessing?(b.scene=new RDGE.SceneGraph(b.rawData),b.scene.enableShadows(!0),RDGE.globals.engine.AddScene(b.name,b.scene),b.scene.Traverse(b.sceneProcessor,!1),b.sceneBeginProcessing=!1):b.processingComplete()&&(b=this.sceneLoadQueue.shift(),this.userRunState.onComplete(b.name,b.scene))));
315for(;0<this.textureLoadQueue.length;)this.renderer.commitTexture(this.textureLoadQueue.shift());0==this.sceneLoadQueue.length&&0==this.textureLoadQueue.length&&RDGE.globals.engine.getContext().ctxStateManager.PopState();RDGE.globals.engine.getContext().getScene()&&"not-ready"!=RDGE.globals.engine.getContext().getScene()&&this.stateManager.RDGERunState.initialized&&this.userRunState.update(a)}; 315for(;0<this.textureLoadQueue.length;)this.renderer.commitTexture(this.textureLoadQueue.shift());0==this.sceneLoadQueue.length&&0==this.textureLoadQueue.length&&RDGE.globals.engine.getContext().ctxStateManager.PopState();RDGE.globals.engine.getContext().getScene()&&("not-ready"!=RDGE.globals.engine.getContext().getScene()&&this.stateManager.RDGERunState.initialized)&&this.userRunState.update(a)};
316RDGE.LoadState.prototype.Draw=function(){this.renderer._clear();RDGE.globals.engine.getContext().getScene()&&"not-ready"!=RDGE.globals.engine.getContext().getScene()&&this.stateManager.RDGERunState.initialized&&this.userRunState.draw()};RDGE.LoadState.prototype.Shutdown=function(){};RDGE.LoadState.prototype.LeaveState=function(){if(void 0!=this.userRunState.onComplete)this.userRunState.onComplete()}; 316RDGE.LoadState.prototype.Draw=function(){this.renderer._clear();RDGE.globals.engine.getContext().getScene()&&("not-ready"!=RDGE.globals.engine.getContext().getScene()&&this.stateManager.RDGERunState.initialized)&&this.userRunState.draw()};RDGE.LoadState.prototype.Shutdown=function(){};RDGE.LoadState.prototype.LeaveState=function(){if(void 0!=this.userRunState.onComplete)this.userRunState.onComplete()};
317RDGE.LoadState.prototype.MakeSceneRequest=function(a,b){this.hasScene=!0;this.lastSceneName=b;var c=new XMLHttpRequest;c.initState=this;RDGE.globals.engine.getContext().sceneGraphMap[b]="not-ready";c.onreadystatechange=function(){4==c.readyState&&(200==c.status||-1==window.location.href.indexOf("http")?(this.initState.scene=eval("("+c.responseText+")"),this.initState.loadingDone=!0):alert("An error has occured making the request"))};c.open("GET",a,!0);c.send(null)}; 317RDGE.LoadState.prototype.MakeSceneRequest=function(a,b){this.hasScene=!0;this.lastSceneName=b;var c=new XMLHttpRequest;c.initState=this;RDGE.globals.engine.getContext().sceneGraphMap[b]="not-ready";c.onreadystatechange=function(){4==c.readyState&&(200==c.status||-1==window.location.href.indexOf("http")?(this.initState.scene=eval("("+c.responseText+")"),this.initState.loadingDone=!0):alert("An error has occured making the request"))};c.open("GET",a,!0);c.send(null)};
318RDGE.SetupScene=function(){this.renderer=RDGE.globals.engine.getContext().renderer;this.meshLoadingMap=[];this.onMeshLoaded=function(a){this.meshLoadingMap[a]&&(this.meshLoadingMap[a].stillLoading=!1)};RDGE.globals.meshMan.addOnLoadedCallback(this)}; 318RDGE.SetupScene=function(){this.renderer=RDGE.globals.engine.getContext().renderer;this.meshLoadingMap=[];this.onMeshLoaded=function(a){this.meshLoadingMap[a]&&(this.meshLoadingMap[a].stillLoading=!1)};RDGE.globals.meshMan.addOnLoadedCallback(this)};
319RDGE.SetupScene.prototype.process=function(a,b){RDGE.verifyTransformNode(a);a.parent=b;void 0!==a.local&&(a.local=RDGE.mat4.transpose(a.local));if("undefined"!=((a.materialNode||{}).meshNode||{})&&void 0!==a.materialNode){var c=RDGE.globals.meshMan.loadMesh(a.materialNode.meshNode.mesh);a.meshes.push(a.materialNode.meshNode);null==c?this.meshLoadingMap[a.materialNode.meshNode.mesh.name]={stillLoading:!0,remotelyLoading:!1}:c.primitive?this.renderer.createPrimitive(c.primitive):this.meshLoadingMap[a.materialNode.meshNode.mesh.name]|| 319RDGE.SetupScene.prototype.process=function(a,b){RDGE.verifyTransformNode(a);a.parent=b;void 0!==a.local&&(a.local=RDGE.mat4.transpose(a.local));if("undefined"!=((a.materialNode||{}).meshNode||{})&&void 0!==a.materialNode){var c=RDGE.globals.meshMan.loadMesh(a.materialNode.meshNode.mesh);a.meshes.push(a.materialNode.meshNode);null==c?this.meshLoadingMap[a.materialNode.meshNode.mesh.name]={stillLoading:!0,remotelyLoading:!1}:c.primitive?this.renderer.createPrimitive(c.primitive):this.meshLoadingMap[a.materialNode.meshNode.mesh.name]||
@@ -323,7 +323,7 @@ RDGE.sceneRequestDef=function(a,b){this.name=b;this.addr=a;this.requestComplete=
323function(){this.doSceneRequest=!1;var b=new XMLHttpRequest;b.handler=this;RDGE.globals.engine.getContext().sceneGraphMap[name]="not-ready";b.onreadystatechange=function(){4==b.readyState&&(200==b.status||-1==window.location.href.indexOf("http")?(this.handler.rawData=eval("("+b.responseText+")"),this.handler.requestComplete=!0,this.handler.sceneBeginProcessing=!0):alert("An error has occured making the request"))};b.open("GET",a,!0);b.send(null)}};RDGE=RDGE||{};RDGE.core=RDGE.core||{};RDGE.utilities=RDGE.utilities||{};RDGE.globals=function(){return{engine:new RDGE.Engine,width:0,height:0,cam:null,shaderMan:null,meshMan:null,poolList:[],gl:null}}();RDGE.core.RDGEState=function(){};RDGE.core.RDGEState.prototype.init=function(){};RDGE.core.RDGEState.prototype.update=function(){};RDGE.core.RDGEState.prototype.draw=function(){};RDGE.core.RDGEState.prototype.resize=function(){};RDGE.core.RDGEState.prototype.shutdown=function(){}; 323function(){this.doSceneRequest=!1;var b=new XMLHttpRequest;b.handler=this;RDGE.globals.engine.getContext().sceneGraphMap[name]="not-ready";b.onreadystatechange=function(){4==b.readyState&&(200==b.status||-1==window.location.href.indexOf("http")?(this.handler.rawData=eval("("+b.responseText+")"),this.handler.requestComplete=!0,this.handler.sceneBeginProcessing=!0):alert("An error has occured making the request"))};b.open("GET",a,!0);b.send(null)}};RDGE=RDGE||{};RDGE.core=RDGE.core||{};RDGE.utilities=RDGE.utilities||{};RDGE.globals=function(){return{engine:new RDGE.Engine,width:0,height:0,cam:null,shaderMan:null,meshMan:null,poolList:[],gl:null}}();RDGE.core.RDGEState=function(){};RDGE.core.RDGEState.prototype.init=function(){};RDGE.core.RDGEState.prototype.update=function(){};RDGE.core.RDGEState.prototype.draw=function(){};RDGE.core.RDGEState.prototype.resize=function(){};RDGE.core.RDGEState.prototype.shutdown=function(){};
324RDGE.core.RDGEState.prototype.onComplete=function(){}; 324RDGE.core.RDGEState.prototype.onComplete=function(){};
325RDGE.utilities.validateUserState=function(a){a.init||(a.init=function(){});a.update||(a.update=function(a){var c=RDGE.globals.engine.getContext().currentScene,c=RDGE.globals.engine.getScene(c);c!=null&&c.update(a)});a.draw||(a.draw=function(){var a=RDGE.globals.engine.getContext().currentScene,a=RDGE.globals.engine.getScene(a);a!=null&&a.render()});a.resize||(a.resize=function(){});a.shutdown||(a.shutdown=function(){});a.onComplete||(a.onComplete=function(){})}; 325RDGE.utilities.validateUserState=function(a){a.init||(a.init=function(){});a.update||(a.update=function(a){var c=RDGE.globals.engine.getContext().currentScene,c=RDGE.globals.engine.getScene(c);c!=null&&c.update(a)});a.draw||(a.draw=function(){var a=RDGE.globals.engine.getContext().currentScene,a=RDGE.globals.engine.getScene(a);a!=null&&a.render()});a.resize||(a.resize=function(){});a.shutdown||(a.shutdown=function(){});a.onComplete||(a.onComplete=function(){})};
326RDGE.RDGEStart=function(a){var b=a;"string"===typeof a&&(b=document.getElementById(a));b&&(RDGE.globals.engine.registerCanvas(b),b.task=new RDGE.RDGETask(b,!0),RDGE.globals.shaderMan||(RDGE.globals.shaderMan=new RDGE.ShaderManager),RDGE.globals.meshMan||(RDGE.globals.meshMan=new RDGE.MeshManager),RDGE.globals.engine.initializeComplete||RDGE.globals.engine.init())};RDGE.RDGEStop=function(){}; 326RDGE.RDGEStart=function(a){var b=a;"string"===typeof a&&(b=document.getElementById(a));b&&(RDGE.globals.engine.registerCanvas(b),b.task||(b.task=new RDGE.RDGETask(b,!1)),RDGE.globals.shaderMan||(RDGE.globals.shaderMan=new RDGE.ShaderManager),RDGE.globals.meshMan||(RDGE.globals.meshMan=new RDGE.MeshManager),RDGE.globals.engine.initializeComplete||RDGE.globals.engine.init())};RDGE.RDGEStop=function(){};
327RDGE.RequestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}();RDGERequestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}(); 327RDGE.RequestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}();RDGERequestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}();
328RDGE.RDGETask=function(){var a={};return function(b,c){this.id=b.rdgeid;this.lastTime=this.currTime=0;this.running=!1;this.context=null;if(b){this.context=RDGE.globals.engine.ctxMan.handleToObject(b.rdgeCtxHandle);a[this.id]=function(){d.running&&(d.currTime=(new Date).getTime(),d.step((d.currTime-d.lastTime)/1E3),RDGERequestAnimationFrame(a[d.id],b),d.lastTime=d.currTime)};this.start=function(){this.running||(this.running=!0,this.lastTime=this.currTime=(new Date).getTime(),a[this.id]())};this.stop= 328RDGE.RDGETask=function(){var a={};return function(b,c){this.id=b.rdgeid;this.lastTime=this.currTime=0;this.running=!1;this.context=null;if(b){this.context=RDGE.globals.engine.ctxMan.handleToObject(b.rdgeCtxHandle);a[this.id]=function(){d.running&&(d.currTime=(new Date).getTime(),d.step((d.currTime-d.lastTime)/1E3),RDGERequestAnimationFrame(a[d.id],b),d.lastTime=d.currTime)};this.start=function(){this.running||(this.running=!0,this.lastTime=this.currTime=(new Date).getTime(),a[this.id]())};this.stop=
329function(){this.running=!1};this.kill=function(){this.running=!1;a[this.id]=null};this.step=function(a){contextManager.currentCtx=this.context;this.context.ctxStateManager.tick(a)};var d=this;c&&d.start()}}}(); 329function(){this.running=!1};this.kill=function(){this.running=!1;a[this.id]=null};this.step=function(a){contextManager.currentCtx=this.context;this.context.ctxStateManager.tick(a)};var d=this;c&&d.start()}}}();
diff --git a/js/helper-classes/RDGE/src/core/script/runtime.js b/js/helper-classes/RDGE/src/core/script/runtime.js
index eb327d1f..274c1f8a 100755
--- a/js/helper-classes/RDGE/src/core/script/runtime.js
+++ b/js/helper-classes/RDGE/src/core/script/runtime.js
@@ -94,7 +94,11 @@ RDGE.RDGEStart = function (canvasOrID) {
94 94
95 RDGE.globals.engine.registerCanvas(canvas); 95 RDGE.globals.engine.registerCanvas(canvas);
96 96
97 canvas.task = new RDGE.RDGETask(canvas, true); 97 if (!canvas.task)
98 {
99 //canvas.task = new RDGE.RDGETask(canvas, true);
100 canvas.task = new RDGE.RDGETask(canvas, false);
101 }
98 102
99 if (!RDGE.globals.shaderMan) 103 if (!RDGE.globals.shaderMan)
100 RDGE.globals.shaderMan = new RDGE.ShaderManager(); 104 RDGE.globals.shaderMan = new RDGE.ShaderManager();