aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE
diff options
context:
space:
mode:
authorJohn Mayhew2012-04-03 16:27:01 -0700
committerJohn Mayhew2012-04-03 16:27:01 -0700
commit7433f0bfbc3a7ea44320550ed2c1d90dc5e6f170 (patch)
treeb0f2b79c8624e26327995991077a89b7969ded94 /js/helper-classes/RDGE
parent18609d375e7aab9cb48c9b3f5b291f85cbd28683 (diff)
downloadninja-7433f0bfbc3a7ea44320550ed2c1d90dc5e6f170.tar.gz
Removed the dependence on an "assets" directory for the RDGE runtime. Now Ninja does not need to create duplicate files when it sets up the users Ninja Projects directory for RDGE support.
Diffstat (limited to 'js/helper-classes/RDGE')
-rwxr-xr-xjs/helper-classes/RDGE/rdge-compiled.js12
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/engine.js174
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/jshader.js6
3 files changed, 96 insertions, 96 deletions
diff --git a/js/helper-classes/RDGE/rdge-compiled.js b/js/helper-classes/RDGE/rdge-compiled.js
index 66bf5a42..0bbcb05b 100755
--- a/js/helper-classes/RDGE/rdge-compiled.js
+++ b/js/helper-classes/RDGE/rdge-compiled.js
@@ -107,11 +107,11 @@ t);this.def[t]=null;break}for(var n in RDGE.rdgeGlobalParameters){l=new globalPa
1070,o;for(o in RDGE.globals.engine.lightManager.lightUniforms[m]){loc=this.ctx.getUniformLocation(h,o);if(loc!=null){this[t].passes[g].lightParams[m]||(this[t].passes[g].lightParams[m]=[]);this[t].passes[g].lightParams[m].push({loc:loc,name:o,dataIndex:p})}p++}}for(n in d[g].params)if(typeof d[g].params[n]!="string"){l=new paramType(this.ctx,n,d[g].params,h,t);this[t].passes[g].params[n]=l;this[t][n]=l}for(n in d[g].params)typeof d[g].params[n]=="string"&&(this[t][n]=this[t].passes[g].params[n]);g++}}for(t in a){f= 1070,o;for(o in RDGE.globals.engine.lightManager.lightUniforms[m]){loc=this.ctx.getUniformLocation(h,o);if(loc!=null){this[t].passes[g].lightParams[m]||(this[t].passes[g].lightParams[m]=[]);this[t].passes[g].lightParams[m].push({loc:loc,name:o,dataIndex:p})}p++}}for(n in d[g].params)if(typeof d[g].params[n]!="string"){l=new paramType(this.ctx,n,d[g].params,h,t);this[t].passes[g].params[n]=l;this[t][n]=l}for(n in d[g].params)typeof d[g].params[n]=="string"&&(this[t][n]=this[t].passes[g].params[n]);g++}}for(t in a){f=
108this[t].passes.length;for(g=0;g<f;++g){this[t].passes[g].defParamsList=[];for(n in this[t].passes[g].params){d=this[t].passes[g].params[n];d.name=n;this[t].passes[g].paramsList.push(d)}for(n in this[t].passes[g].defParams){d=this[t].passes[g].defParams[n];d.name=n;this[t].passes[g].defParamsList.push(d)}}}this.setTechnique(c)};this.initLocalParameter=function(a,c){var d=this.def.techniques;for(t in d)for(var f=d[t],g=f.length,h=0;h<g;){var l=new paramType(this.ctx,a,c,f[h].program,t);if(l){f[h][a]= 108this[t].passes.length;for(g=0;g<f;++g){this[t].passes[g].defParamsList=[];for(n in this[t].passes[g].params){d=this[t].passes[g].params[n];d.name=n;this[t].passes[g].paramsList.push(d)}for(n in this[t].passes[g].defParams){d=this[t].passes[g].defParams[n];d.name=n;this[t].passes[g].defParamsList.push(d)}}}this.setTechnique(c)};this.initLocalParameter=function(a,c){var d=this.def.techniques;for(t in d)for(var f=d[t],g=f.length,h=0;h<g;){var l=new paramType(this.ctx,a,c,f[h].program,t);if(l){f[h][a]=
109l;if(!f[h].paramsList)f[h].paramsList=[];f[h].paramsList.push(l)}h++}};this.buildShader=function(a,c){var c="#define PC\n"+c,d=this.ctx.createShader(a);if(d==null){this.renderer.console.log("*** Error: unable to create shader '"+a+"'");return null}this.ctx.shaderSource(d,c);this.ctx.compileShader(d);if(!this.ctx.getShaderParameter(d,this.ctx.COMPILE_STATUS)){var f=this.ctx.getShaderInfoLog(d);window.console.error("*** Error compiling shader '"+a+"':"+f);this.ctx.deleteShader(d);return null}return d}; 109l;if(!f[h].paramsList)f[h].paramsList=[];f[h].paramsList.push(l)}h++}};this.buildShader=function(a,c){var c="#define PC\n"+c,d=this.ctx.createShader(a);if(d==null){this.renderer.console.log("*** Error: unable to create shader '"+a+"'");return null}this.ctx.shaderSource(d,c);this.ctx.compileShader(d);if(!this.ctx.getShaderParameter(d,this.ctx.COMPILE_STATUS)){var f=this.ctx.getShaderInfoLog(d);window.console.error("*** Error compiling shader '"+a+"':"+f);this.ctx.deleteShader(d);return null}return d};
110this.buildProgram=function(a){window.console.log("building shader pair: <"+a.vshader+", "+a.fshader+">");var c=this.def.shaders[a.vshader],d=this.def.shaders[a.fshader];this.ctx.useProgram(null);var f=null,g=null;if(c.indexOf("{")!=-1)g=c;else{g=new XMLHttpRequest;g.open("GET",c,false);g.send(null);g=g.responseText}f=this.buildShader(this.ctx.VERTEX_SHADER,g);g=null;if(c.indexOf("{")!=-1)g=d;else{g=new XMLHttpRequest;g.open("GET",d,false);g.send(null);g=g.responseText}g=this.buildShader(this.ctx.FRAGMENT_SHADER, 110this.buildProgram=function(a){window.console.log("building shader pair: <"+a.vshader+", "+a.fshader+">");var c=RDGE.globals.engine.remapAssetFolder(this.def.shaders[a.vshader]),d=RDGE.globals.engine.remapAssetFolder(this.def.shaders[a.fshader]);this.ctx.useProgram(null);var f=null,g=null;if(c.indexOf("{")!=-1)g=c;else{g=new XMLHttpRequest;g.open("GET",c,false);g.send(null);g=g.responseText}f=this.buildShader(this.ctx.VERTEX_SHADER,g);g=null;if(c.indexOf("{")!=-1)g=d;else{g=new XMLHttpRequest;g.open("GET",
111g);if(!f||!g)return null;this.compiledShaders[a.vshader]=f;this.compiledShaders[a.fshader]=g;c=this.ctx.createProgram();if(!c)return null;this.ctx.attachShader(c,f);this.ctx.attachShader(c,g);d=0;a.attribPairs=[];for(var h in a.attributes){a.attribPairs.push({loc:d,name:h});this.ctx.bindAttribLocation(c,d++,h)}this.ctx.linkProgram(c);if(!this.ctx.getProgramParameter(c,this.ctx.LINK_STATUS)){a=this.ctx.getProgramInfoLog(c);window.console.log("Error in program linking:"+a);this.ctx.deleteProgram(c); 111d,false);g.send(null);g=g.responseText}g=this.buildShader(this.ctx.FRAGMENT_SHADER,g);if(!f||!g)return null;this.compiledShaders[a.vshader]=f;this.compiledShaders[a.fshader]=g;c=this.ctx.createProgram();if(!c)return null;this.ctx.attachShader(c,f);this.ctx.attachShader(c,g);d=0;a.attribPairs=[];for(var h in a.attributes){a.attribPairs.push({loc:d,name:h});this.ctx.bindAttribLocation(c,d++,h)}this.ctx.linkProgram(c);if(!this.ctx.getProgramParameter(c,this.ctx.LINK_STATUS)){a=this.ctx.getProgramInfoLog(c);
112this.ctx.deleteProgram(g);this.ctx.deleteProgram(f);return null}return c};this.setLightContext=function(a){for(t in this.technique)for(var c=this.technique.passes.length,d=0;d<c;++d)this.technique.passes[d].lightContext=a.slice()};this.setTextureContext=function(a){for(var c=this.technique.passes.length,d=null,f=0,g=a.length;f<g;++f)for(var h=0;h<c;++h){d=a[f];this.technique.passes[h].defParams[d.name]&&this.technique.passes[h].defParams[d.name].set(d.handle);this.technique.passes[h].params[d.name]&& 112window.console.log("Error in program linking:"+a);this.ctx.deleteProgram(c);this.ctx.deleteProgram(g);this.ctx.deleteProgram(f);return null}return c};this.setLightContext=function(a){for(t in this.technique)for(var c=this.technique.passes.length,d=0;d<c;++d)this.technique.passes[d].lightContext=a.slice()};this.setTextureContext=function(a){for(var c=this.technique.passes.length,d=null,f=0,g=a.length;f<g;++f)for(var h=0;h<c;++h){d=a[f];this.technique.passes[h].defParams[d.name]&&this.technique.passes[h].defParams[d.name].set(d.handle);
113this.technique.passes[h].params[d.name].set(d.data[0])}};this.setTechnique=function(a){if(this[a]!=void 0){this.technique=this[a];return true}this.ctx.console.log("Failed to set technique:"+a);return false};this.beginRenderState=function(a){var c=this.technique.passes[a].states;if(c!=void 0){if(c.depthEnable!=void 0?c.depthEnable:1){c.depthFunc&&this.ctx.depthFunc(this.ctx[c.depthFunc]);if(c.offset){this.ctx.enable(this.ctx.POLYGON_OFFSET_FILL);this.ctx.polygonOffset(c.offset[0],c.offset[1])}c.depthWrite&& 113this.technique.passes[h].params[d.name]&&this.technique.passes[h].params[d.name].set(d.data[0])}};this.setTechnique=function(a){if(this[a]!=void 0){this.technique=this[a];return true}this.ctx.console.log("Failed to set technique:"+a);return false};this.beginRenderState=function(a){var c=this.technique.passes[a].states;if(c!=void 0){if(c.depthEnable!=void 0?c.depthEnable:1){c.depthFunc&&this.ctx.depthFunc(this.ctx[c.depthFunc]);if(c.offset){this.ctx.enable(this.ctx.POLYGON_OFFSET_FILL);this.ctx.polygonOffset(c.offset[0],
114this.ctx.depthMask(c.depthWrite);c.depthRangeMin&&this.ctx.depthRange(c.depthRangeMin);c.depthRangeMax&&this.ctx.depthRange(c.depthRangeMax)}else{this.ctx.disable(this.ctx.DEPTH_TEST);this.ctx.depthFunc(this.ctx[c.depthFunc]);this.ctx.depthMask(true)}if(c.blendEnable!=void 0&&c.blendEnable){var d=c.srcBlend!=void 0?c.srcBlend:"ONE",f=c.dstBlend!=void 0?c.dstBlend:"ZERO";this.ctx.enable(this.ctx.BLEND);this.ctx.blendFunc(this.ctx[d],this.ctx[f])}c.culling&&(c.culling?this.ctx.enable(this.ctx.CULL_FACE): 114c.offset[1])}c.depthWrite&&this.ctx.depthMask(c.depthWrite);c.depthRangeMin&&this.ctx.depthRange(c.depthRangeMin);c.depthRangeMax&&this.ctx.depthRange(c.depthRangeMax)}else{this.ctx.disable(this.ctx.DEPTH_TEST);this.ctx.depthFunc(this.ctx[c.depthFunc]);this.ctx.depthMask(true)}if(c.blendEnable!=void 0&&c.blendEnable){var d=c.srcBlend!=void 0?c.srcBlend:"ONE",f=c.dstBlend!=void 0?c.dstBlend:"ZERO";this.ctx.enable(this.ctx.BLEND);this.ctx.blendFunc(this.ctx[d],this.ctx[f])}c.culling&&(c.culling?this.ctx.enable(this.ctx.CULL_FACE):
115this.ctx.disable(this.ctx.CULL_FACE));c.cullFace&&this.ctx.cullFace(this.ctx[c.cullFace]);c.pointsprite&&(c.pointsprite===true?this.renderer.enablePointSprites():this.renderer.disablePointSprites());this.resetRS=this.technique.passes[a].states.reset==void 0||this.technique.passes[a].states.reset==true}};this.endRenderState=function(){var a=this.ctx;if(this.resetRS){a.enable(this.ctx.DEPTH_TEST);a.disable(this.ctx.BLEND);a.depthFunc(this.ctx.LESS);a.disable(this.ctx.POLYGON_OFFSET_FILL);a.disable(this.ctx.CULL_FACE)}}; 115this.ctx.disable(this.ctx.CULL_FACE));c.cullFace&&this.ctx.cullFace(this.ctx[c.cullFace]);c.pointsprite&&(c.pointsprite===true?this.renderer.enablePointSprites():this.renderer.disablePointSprites());this.resetRS=this.technique.passes[a].states.reset==void 0||this.technique.passes[a].states.reset==true}};this.endRenderState=function(){var a=this.ctx;if(this.resetRS){a.enable(this.ctx.DEPTH_TEST);a.disable(this.ctx.BLEND);a.depthFunc(this.ctx.LESS);a.disable(this.ctx.POLYGON_OFFSET_FILL);a.disable(this.ctx.CULL_FACE)}};
116this.begin=function(){this.currentPass=null;return this.def==null||this.technique==null?0:this.technique.passes.length};this.beginPass=function(a){this.currentPass=this.technique.passes[a];this.ctx.useProgram(this.currentPass.program);this.bindParameters(this.currentPass);this.beginRenderState(a);return this.currentPass};this.endPass=function(){this.endRenderState();this.ctx.useProgram(null)};this.end=function(){};this.exportShader=function(){for(t in this.def.techniques)for(var a=this[t].passes.length, 116this.begin=function(){this.currentPass=null;return this.def==null||this.technique==null?0:this.technique.passes.length};this.beginPass=function(a){this.currentPass=this.technique.passes[a];this.ctx.useProgram(this.currentPass.program);this.bindParameters(this.currentPass);this.beginRenderState(a);return this.currentPass};this.endPass=function(){this.endRenderState();this.ctx.useProgram(null)};this.end=function(){};this.exportShader=function(){for(t in this.def.techniques)for(var a=this[t].passes.length,
117c=0;c<a;++c){this[t].passes[c].paramsList=[];this[t].passes[c].defParamsList=[];for(var d in this[t].passes[c].params){var f=this.def.techniques[t][c];if(f&&this[t].passes[c].params[d].type!="tex2d"&&this[t].passes[c].params[d]!="texCube")f.params[d].data=this[t].passes[c].params[d].data}}return JSON.stringify(this.def)}};RDGE=RDGE||{};RDGE.jpassGeoSet={BACKGROUND:1,OPAQUE:2,TRANSPARENT:4,ADDITIVE:8,TRANSLUCENT:16,FOREGROUND:32,ALL:127,SCREEN_QUAD:128,SHADOW:256,MAXSETS:9}; 117c=0;c<a;++c){this[t].passes[c].paramsList=[];this[t].passes[c].defParamsList=[];for(var d in this[t].passes[c].params){var f=this.def.techniques[t][c];if(f&&this[t].passes[c].params[d].type!="tex2d"&&this[t].passes[c].params[d]!="texCube")f.params[d].data=this[t].passes[c].params[d].data}}return JSON.stringify(this.def)}};RDGE=RDGE||{};RDGE.jpassGeoSet={BACKGROUND:1,OPAQUE:2,TRANSPARENT:4,ADDITIVE:8,TRANSLUCENT:16,FOREGROUND:32,ALL:127,SCREEN_QUAD:128,SHADOW:256,MAXSETS:9};
@@ -212,7 +212,7 @@ RDGE.stateManager=function(){this.stateStack=[];this.stateTop=void 0;this.RDGERu
212RDGE.Engine=function(){this._assetPath="assets/";this.sceneMap=[];this.stateTop=void 0;this.lastWindowWidth=window.innerWidth;this.lastWindowHeight=window.innerHeight;this.lightManager=this.defaultContext=null;clearColor=[0,0,0,0];this.initializeComplete=!1;this.RDGECanvas=null;this.canvasToRendererMap={};this.canvasNameToStateStack={};this.canvasCtxList=[];invalidObj=/([()]|function)/;isValidObj=function(a){return invalidObj.test(a)?(window.console.error("invalid object name passed to RDGE, "+a+ 212RDGE.Engine=function(){this._assetPath="assets/";this.sceneMap=[];this.stateTop=void 0;this.lastWindowWidth=window.innerWidth;this.lastWindowHeight=window.innerHeight;this.lightManager=this.defaultContext=null;clearColor=[0,0,0,0];this.initializeComplete=!1;this.RDGECanvas=null;this.canvasToRendererMap={};this.canvasNameToStateStack={};this.canvasCtxList=[];invalidObj=/([()]|function)/;isValidObj=function(a){return invalidObj.test(a)?(window.console.error("invalid object name passed to RDGE, "+a+
213" - looks like a function"),!1):!0};contextDef=function(){this.startUpState=this.ctxStateManager=this.renderer=this.id=null;this.sceneGraphMap=[];this.currentScene=null;this.getScene=function(){return this.sceneGraphMap[this.currentScene]};this.debug={frameCounter:0,mat4CallCount:0}};this.ctxMan=contextManager=new RDGE.objectManager;contextManager.currentCtx=null;contextManager._addObject=contextManager.addObject;contextManager.contextMap={};contextManager.addObject=function(a){this.contextMap[a.id]= 213" - looks like a function"),!1):!0};contextDef=function(){this.startUpState=this.ctxStateManager=this.renderer=this.id=null;this.sceneGraphMap=[];this.currentScene=null;this.getScene=function(){return this.sceneGraphMap[this.currentScene]};this.debug={frameCounter:0,mat4CallCount:0}};this.ctxMan=contextManager=new RDGE.objectManager;contextManager.currentCtx=null;contextManager._addObject=contextManager.addObject;contextManager.contextMap={};contextManager.addObject=function(a){this.contextMap[a.id]=
214a;return this._addObject(a)};contextManager.start=function(){for(var a=this.objects.length,b=0;b<a;++b)contextManager.currentCtx=this.objects[b],this.objects[b].ctxStateManager.PushState(this.objects[b].startUpState)};contextManager.forEach=function(a){for(var b=this.objects.length,c=0;c<b;++c)a(this.objects[c])};this.getContext=function(a){return a?contextManager.contextMap[a]:contextManager.currentCtx};this.clearContext=function(a){contextManager.contextMap[a]=void 0};this.setContext=function(a){contextManager.currentCtx= 214a;return this._addObject(a)};contextManager.start=function(){for(var a=this.objects.length,b=0;b<a;++b)contextManager.currentCtx=this.objects[b],this.objects[b].ctxStateManager.PushState(this.objects[b].startUpState)};contextManager.forEach=function(a){for(var b=this.objects.length,c=0;c<b;++c)a(this.objects[c])};this.getContext=function(a){return a?contextManager.contextMap[a]:contextManager.currentCtx};this.clearContext=function(a){contextManager.contextMap[a]=void 0};this.setContext=function(a){contextManager.currentCtx=
215contextManager.contextMap[a]};this.tickContext=function(a){var b=contextManager.currentCtx;contextManager.currentCtx=contextManager.contextMap[a];this.objects[i].ctxStateManager.tick(dt);contextManager.currentCtx=b};this.remapAssetFolder=function(a){var b=a.indexOf("assets/"),c=a;0<=b&&(c=a.substr(b+7),c=this._assetPath+c);return c}}; 215contextManager.contextMap[a]};this.tickContext=function(a){var b=contextManager.currentCtx;contextManager.currentCtx=contextManager.contextMap[a];this.objects[i].ctxStateManager.tick(dt);contextManager.currentCtx=b};this.setAssetPath=function(a){this._assetPath=a.slice()};this.remapAssetFolder=function(a){var b=a.indexOf("assets/"),c=a;0<=b&&(c=a.substr(b+7),c=this._assetPath+c);return c}};
216RDGE.Engine.prototype.init=function(a,b,c){this.GlInit(c);globalParamFuncSet=function(a){this.data=a.data;this.type=a.type;this.set=function(a){for(var b=this.data?this.data.length:0,c=0;c<b;++c)this.data[c]=a[c]};this.get=function(){return void 0==this.data.length?this.data:this.data.slice()}};this.lightManager=new RDGE.LightManager(RDGE.rdgeGlobalParameters.rdge_lights);for(var d in RDGE.rdgeGlobalParameters)if("rdge_lights"!=d)RDGE.rdgeGlobalParameters[d]=new globalParamFuncSet(RDGE.rdgeGlobalParameters[d]); 216RDGE.Engine.prototype.init=function(a,b,c){this.GlInit(c);globalParamFuncSet=function(a){this.data=a.data;this.type=a.type;this.set=function(a){for(var b=this.data?this.data.length:0,c=0;c<b;++c)this.data[c]=a[c]};this.get=function(){return void 0==this.data.length?this.data:this.data.slice()}};this.lightManager=new RDGE.LightManager(RDGE.rdgeGlobalParameters.rdge_lights);for(var d in RDGE.rdgeGlobalParameters)if("rdge_lights"!=d)RDGE.rdgeGlobalParameters[d]=new globalParamFuncSet(RDGE.rdgeGlobalParameters[d]);
217else{var a=RDGE.rdgeGlobalParameters[d],f;for(f in a)RDGE.rdgeGlobalParameters[f]=new globalParamFuncSet(a[f])}this.lastWindowWidth=window.innerWidth;this.lastWindowHeight=window.innerHeight;this.defaultContext=new RDGE.RenderContext;this.defaultContext.uniforms=[{name:"u_matAmbient",value:[0.02,0.02,0.02,1]},{name:"u_matDiffuse",value:[1,1,1,1]},{name:"u_matSpecular",value:[1,1,1,1]},{name:"u_matShininess",value:[128]},{name:"u_matEmission",value:[0,0,0,1]}];contextManager.start();this.initializeComplete= 217else{var a=RDGE.rdgeGlobalParameters[d],f;for(f in a)RDGE.rdgeGlobalParameters[f]=new globalParamFuncSet(a[f])}this.lastWindowWidth=window.innerWidth;this.lastWindowHeight=window.innerHeight;this.defaultContext=new RDGE.RenderContext;this.defaultContext.uniforms=[{name:"u_matAmbient",value:[0.02,0.02,0.02,1]},{name:"u_matDiffuse",value:[1,1,1,1]},{name:"u_matSpecular",value:[1,1,1,1]},{name:"u_matShininess",value:[128]},{name:"u_matEmission",value:[0,0,0,1]}];contextManager.start();this.initializeComplete=
218!0};RDGE.Engine.prototype.Shutdown=function(){this.PopAll()};RDGE.Engine.prototype.GlInit=function(){for(var a=document.getElementsByTagName("canvas"),b=a.length,c=0;c<b;++c){var d;"true"==a[c].getAttribute("rdge")&&(d=a[c],this.registerCanvas(d))}}; 218!0};RDGE.Engine.prototype.Shutdown=function(){this.PopAll()};RDGE.Engine.prototype.GlInit=function(){for(var a=document.getElementsByTagName("canvas"),b=a.length,c=0;c<b;++c){var d;"true"==a[c].getAttribute("rdge")&&(d=a[c],this.registerCanvas(d))}};
diff --git a/js/helper-classes/RDGE/src/core/script/engine.js b/js/helper-classes/RDGE/src/core/script/engine.js
index cf576702..d437d5f8 100755
--- a/js/helper-classes/RDGE/src/core/script/engine.js
+++ b/js/helper-classes/RDGE/src/core/script/engine.js
@@ -76,151 +76,151 @@ RDGE.stateManager = function () {
76 }; 76 };
77}; 77};
78 78
79RDGE.Engine = function() { 79RDGE.Engine = function () {
80 this._assetPath = "assets/"; 80 this._assetPath = "assets/";
81 81
82 // map of scene graphs to names 82 // map of scene graphs to names
83 this.sceneMap = []; 83 this.sceneMap = [];
84 84
85 // number of states on the stack 85 // number of states on the stack
86 this.stateTop = undefined; 86 this.stateTop = undefined;
87 87
88 // size of the browser window 88 // size of the browser window
89 this.lastWindowWidth = window.innerWidth; 89 this.lastWindowWidth = window.innerWidth;
90 this.lastWindowHeight = window.innerHeight; 90 this.lastWindowHeight = window.innerHeight;
91 91
92 this.defaultContext = null; 92 this.defaultContext = null;
93 93
94 this.lightManager = null; 94 this.lightManager = null;
95 95
96 clearColor = [0.0, 0.0, 0.0, 0.0]; 96 clearColor = [0.0, 0.0, 0.0, 0.0];
97 97
98 this.initializeComplete = false; 98 this.initializeComplete = false;
99 99
100 this.RDGECanvas = null; 100 this.RDGECanvas = null;
101 101
102 /* 102 /*
103 * a map of canvas names to renderer 103 * a map of canvas names to renderer
104 */ 104 */
105 this.canvasToRendererMap = {}; 105 this.canvasToRendererMap = {};
106 106
107 /* 107 /*
108 * states to canvas map - maps a state stack to the canvas context it belongs to 108 * states to canvas map - maps a state stack to the canvas context it belongs to
109 */ 109 */
110 this.canvasNameToStateStack = {}; 110 this.canvasNameToStateStack = {};
111 111
112 /* 112 /*
113 * the list of context's that are active 113 * the list of context's that are active
114 */ 114 */
115 this.canvasCtxList = []; 115 this.canvasCtxList = [];
116 116
117 /* 117 /*
118 * regex object to verify runtime object is not some sort of exploit 118 * regex object to verify runtime object is not some sort of exploit
119 */ 119 */
120 invalidObj = new RegExp("([()]|function)"); 120 invalidObj = new RegExp("([()]|function)");
121 121
122 isValidObj = function (name) { 122 isValidObj = function (name) {
123 // do a quick test make sure user isn't trying to execute a function 123 // do a quick test make sure user isn't trying to execute a function
124 if (invalidObj.test(name)) { 124 if (invalidObj.test(name)) {
125 window.console.error("invalid object name passed to RDGE, " + name + " - looks like a function"); 125 window.console.error("invalid object name passed to RDGE, " + name + " - looks like a function");
126 return false; 126 return false;
127 } 127 }
128 128
129 return true; 129 return true;
130 }; 130 };
131 131
132 /* 132 /*
133 * The context definition - every context shares these parameters 133 * The context definition - every context shares these parameters
134 */ 134 */
135 contextDef = function () { 135 contextDef = function () {
136 this.id = null; 136 this.id = null;
137 this.renderer = null; 137 this.renderer = null;
138 this.ctxStateManager = null; 138 this.ctxStateManager = null;
139 this.startUpState = null; 139 this.startUpState = null;
140 this.sceneGraphMap = []; 140 this.sceneGraphMap = [];
141 this.currentScene = null; 141 this.currentScene = null;
142 this.getScene = function () { 142 this.getScene = function () {
143 return this.sceneGraphMap[this.currentScene]; 143 return this.sceneGraphMap[this.currentScene];
144 } 144 }
145 this.debug = 145 this.debug =
146 { 146 {
147 'frameCounter' : 0, 147 'frameCounter': 0,
148 'mat4CallCount': 0 148 'mat4CallCount': 0
149 } 149 }
150 }; 150 };
151 151
152 // maintains the contexts