diff options
Diffstat (limited to 'js/helper-classes/RDGE')
-rwxr-xr-x | js/helper-classes/RDGE/rdge-compiled.js | 12 | ||||
-rwxr-xr-x | js/helper-classes/RDGE/src/core/script/runtime.js | 6 |
2 files changed, 11 insertions, 7 deletions
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); | |||
248 | RDGE.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})}}}; | 248 | RDGE.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})}}}; |
249 | RDGE.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))}}}}; | 249 | RDGE.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))}}}}; |
250 | RDGE.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? | 250 | RDGE.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? |
251 | f.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? | 251 | f.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? |
252 | b[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})}}}; | 252 | b[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})}}}; |
253 | RDGE.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++}; | 253 | RDGE.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++}; |
254 | RDGE.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()}}; | 254 | RDGE.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()}}; |
255 | RDGE.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}; | 255 | RDGE.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}; |
256 | RDGE.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; | 256 | RDGE.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; |
257 | f.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()); | 257 | f.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()); |
258 | 0<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}; | 258 | 0<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}; |
259 | RDGE.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), | 259 | RDGE.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), |
260 | a=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)}; | 260 | a=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 | |||
312 | RDGE.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()}; | 312 | RDGE.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()}; |
313 | RDGE.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)}; | 313 | RDGE.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)}; |
314 | RDGE.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)))); | 314 | RDGE.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)))); |
315 | for(;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)}; | 315 | for(;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)}; |
316 | RDGE.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()}; | 316 | RDGE.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()}; |
317 | RDGE.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)}; | 317 | RDGE.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)}; |
318 | RDGE.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)}; | 318 | RDGE.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)}; |
319 | RDGE.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]|| | 319 | RDGE.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= | |||
323 | function(){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(){}; | 323 | function(){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(){}; |
324 | RDGE.core.RDGEState.prototype.onComplete=function(){}; | 324 | RDGE.core.RDGEState.prototype.onComplete=function(){}; |
325 | RDGE.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(){})}; | 325 | RDGE.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(){})}; |
326 | RDGE.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(){}; | 326 | RDGE.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(){}; |
327 | RDGE.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)}}(); | 327 | RDGE.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)}}(); |
328 | RDGE.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= | 328 | RDGE.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= |
329 | function(){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()}}}(); | 329 | function(){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(); |