aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--assets/canvas-runtime.js1
-rwxr-xr-xassets/rdge-compiled.js12
-rwxr-xr-xjs/controllers/elements/body-controller.js20
-rwxr-xr-xjs/document/helpers/url-parser.js2
-rwxr-xr-xjs/document/mediators/template.js9
-rwxr-xr-xjs/document/views/design.js7
-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
-rw-r--r--js/io/system/ninjalibrary.json2
-rwxr-xr-xjs/io/templates/files/html.txt6
11 files changed, 91 insertions, 18 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js
index 13b36540..c441a98d 100644
--- a/assets/canvas-runtime.js
+++ b/assets/canvas-runtime.js
@@ -186,6 +186,7 @@ NinjaCvsRt.GLRuntime = Object.create(Object.prototype, {
186 this._canvas.rdgeid = id; 186 this._canvas.rdgeid = id;
187 RDGE.globals.engine.registerCanvas(this._canvas, this); 187 RDGE.globals.engine.registerCanvas(this._canvas, this);
188 RDGE.RDGEStart( this._canvas ); 188 RDGE.RDGEStart( this._canvas );
189 this._canvas.task.start();
189 } 190 }
190 else 191 else
191 { 192 {
diff --git a/assets/rdge-compiled.js b/assets/rdge-compiled.js
index 0bbcb05b..53a99c35 100755
--- a/assets/rdge-compiled.js
+++ b/assets/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/controllers/elements/body-controller.js b/js/controllers/elements/body-controller.js
index 0ca6c417..604b22d0 100755
--- a/js/controllers/elements/body-controller.js
+++ b/js/controllers/elements/body-controller.js
@@ -19,6 +19,14 @@ exports.BodyController = Montage.create(ElementController, {
19 el.elementModel.props3D.matrix3d = mat; 19 el.elementModel.props3D.matrix3d = mat;
20 el.elementModel.props3D.perspectiveDist = dist; 20 el.elementModel.props3D.perspectiveDist = dist;
21 21
22 if(this.application.ninja.currentDocument.model.views.design._template) {
23 if(!MathUtils.isIdentityMatrix(mat)) {
24 el.parentNode.style.backgroundColor = "transparent";
25 } else {
26 el.parentNode.style.removeProperty("background-color");
27 }
28 }
29
22 this.application.ninja.stage.updatedStage = true; 30 this.application.ninja.stage.updatedStage = true;
23 31
24 if(update3DModel) { 32 if(update3DModel) {
@@ -32,7 +40,11 @@ exports.BodyController = Montage.create(ElementController, {
32 switch(p) { 40 switch(p) {
33 case "background" : 41 case "background" :
34 case "background-color": 42 case "background-color":
35 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color")); 43 if(this.application.ninja.currentDocument.model.views.design._template) {
44 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el.parentNode, "background-color"));
45 } else {
46 return this.application.ninja.colorController.getColorObjFromCss(this.application.ninja.stylesController.getElementStyle(el, "background-color"));
47 }
36 case "border": 48 case "border":
37 return 0; 49 return 0;
38 case "height": 50 case "height":
@@ -51,7 +63,11 @@ exports.BodyController = Montage.create(ElementController, {
51 switch(p) { 63 switch(p) {
52 case "background": 64 case "background":
53 case "background-color": 65 case "background-color":
54 this.application.ninja.stylesController.setElementStyle(el, "background-color", value); 66 if(this.application.ninja.currentDocument.model.views.design._template) {
67 this.application.ninja.stylesController.setElementStyle(el.parentNode, "background-color", value);
68 } else {
69 this.application.ninja.stylesController.setElementStyle(el, "background-color", value);
70 }
55 break; 71 break;
56 case "overflow": 72 case "overflow":
57 case "width": 73 case "width":
diff --git a/js/document/helpers/url-parser.js b/js/document/helpers/url-parser.js
index 5e71d148..7bded27d 100755
--- a/js/document/helpers/url-parser.js
+++ b/js/document/helpers/url-parser.js
@@ -53,7 +53,7 @@ exports.UrlParser = Montage.create(Component, {
53 //Getting file URI (not URL since we must load through I/O API) 53 //Getting file URI (not URL since we must load through I/O API)
54 var css = {}, file; 54 var css = {}, file;
55 css.cssUrl = href.split(this.application.ninja.coreIoApi.rootUrl)[1]; 55 css.cssUrl = href.split(this.application.ninja.coreIoApi.rootUrl)[1];
56 css.fileUri = this.application.ninja.coreIoApi.cloudData.root + css.cssUrl; 56 css.fileUri = this.application.ninja.coreIoApi.cloudData.root + unescape(css.cssUrl);
57 //Loading data from CSS file 57 //Loading data from CSS file
58 file = this.application.ninja.coreIoApi.readFile({uri: css.fileUri}); 58