diff options
author | John Mayhew | 2012-04-03 16:27:01 -0700 |
---|---|---|
committer | John Mayhew | 2012-04-03 16:27:01 -0700 |
commit | 7433f0bfbc3a7ea44320550ed2c1d90dc5e6f170 (patch) | |
tree | b0f2b79c8624e26327995991077a89b7969ded94 /assets | |
parent | 18609d375e7aab9cb48c9b3f5b291f85cbd28683 (diff) | |
download | ninja-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 'assets')
-rw-r--r-- | assets/canvas-runtime.js | 38 | ||||
-rwxr-xr-x | assets/rdge-compiled.js | 12 |
2 files changed, 18 insertions, 32 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js index 6278fdac..a35f473d 100644 --- a/assets/canvas-runtime.js +++ b/assets/canvas-runtime.js | |||
@@ -104,6 +104,7 @@ NinjaCvsRt.GLRuntime = function ( canvas, jObj, assetPath ) | |||
104 | this._initialized = false; | 104 | this._initialized = false; |
105 | 105 | ||
106 | this._useWebGL = false; | 106 | this._useWebGL = false; |
107 | this._assetPath = undefined; | ||
107 | 108 | ||
108 | // view parameters | 109 | // view parameters |
109 | this._fov = 45.0; | 110 | this._fov = 45.0; |
@@ -120,13 +121,17 @@ NinjaCvsRt.GLRuntime = function ( canvas, jObj, assetPath ) | |||
120 | // all "live" materials | 121 | // all "live" materials |
121 | this._materials = []; | 122 | this._materials = []; |
122 | 123 | ||
123 | // provide the mapping for the asset directory | 124 | // provide the mapping for the asset directory |
124 | if (assetPath) | 125 | if (assetPath) |
125 | { | 126 | { |
126 | this._assetPath = assetPath.slice(); | 127 | this._assetPath = assetPath.slice(); |
127 | if (this._assetPath[this._assetPath.length-1] != '/') | 128 | if (this._assetPath[this._assetPath.length-1] != '/') |
128 | this._assetPath += '/'; | 129 | this._assetPath += '/'; |
129 | } | 130 | } |
131 | |||
132 | if(this._assetPath !== undefined) { | ||
133 | RDGE.globals.engine.setAssetPath(this._assetPath); | ||
134 | } | ||
130 | 135 | ||
131 | /////////////////////////////////////////////////////////////////////// | 136 | /////////////////////////////////////////////////////////////////////// |
132 | // accessors | 137 | // accessors |
@@ -366,21 +371,6 @@ NinjaCvsRt.GLRuntime = function ( canvas, jObj, assetPath ) | |||
366 | } | 371 | } |
367 | }; | 372 | }; |
368 | 373 | ||
369 | this.remapAssetFolder = function( url ) | ||
370 | { | ||
371 | // var searchStr = "assets/"; | ||
372 | // var index = url.indexOf( searchStr ); | ||
373 | // var rtnPath = url; | ||
374 | // if (index >= 0) | ||
375 | // { | ||
376 | // rtnPath = url.substr( index + searchStr.length ); | ||
377 | // rtnPath = this._assetPath + rtnPath; | ||
378 | // } | ||
379 | // return rtnPath; | ||
380 | |||
381 | return url; | ||
382 | }; | ||
383 | |||
384 | this.findMaterialNode = function( nodeName, node ) | 374 | this.findMaterialNode = function( nodeName, node ) |
385 | { | 375 | { |
386 | if (node.transformNode) | 376 | if (node.transformNode) |
@@ -1257,7 +1247,6 @@ NinjaCvsRt.RuntimePulseMaterial = function () | |||
1257 | technique.u_resolution.set( res ); | 1247 | technique.u_resolution.set( res ); |
1258 | 1248 | ||
1259 | var wrap = 'REPEAT', mips = true; | 1249 | var wrap = 'REPEAT', mips = true; |
1260 | this._texMap = world.remapAssetFolder( this._texMap ); | ||
1261 | var tex = renderer.getTextureByName(this._texMap, wrap, mips ); | 1250 | var tex = renderer.getTextureByName(this._texMap, wrap, mips ); |
1262 | if (tex) | 1251 | if (tex) |
1263 | technique.u_tex0.set( tex ); | 1252 | technique.u_tex0.set( tex ); |
@@ -1399,19 +1388,16 @@ NinjaCvsRt.RuntimeBumpMetalMaterial = function () | |||
1399 | var wrap = 'REPEAT', mips = true; | 1388 | var wrap = 'REPEAT', mips = true; |
1400 | if (this._diffuseTexture) | 1389 | if (this._diffuseTexture) |
1401 | { | 1390 | { |
1402 | this._diffuseTexture = world.remapAssetFolder( this._diffuseTexture ); | ||
1403 | tex = renderer.getTextureByName(this._diffuseTexture, wrap, mips ); | 1391 | tex = renderer.getTextureByName(this._diffuseTexture, wrap, mips ); |
1404 | if (tex) technique.u_colMap.set( tex ); | 1392 | if (tex) technique.u_colMap.set( tex ); |
1405 | } | 1393 | } |
1406 | if (this._normalTexture) | 1394 | if (this._normalTexture) |
1407 | { | 1395 | { |
1408 | this._normalTexture = world.remapAssetFolder( this._normalTexture ); | ||
1409 | tex = renderer.getTextureByName(this._normalTexture, wrap, mips ); | 1396 | tex = renderer.getTextureByName(this._normalTexture, wrap, mips ); |
1410 | if (tex) technique.u_normalMap.set( tex ); | 1397 | if (tex) technique.u_normalMap.set( tex ); |
1411 | } | 1398 | } |
1412 | if (this._specularTexture) | 1399 | if (this._specularTexture) |
1413 | { | 1400 | { |
1414 | this._specularTexture = world.remapAssetFolder( this._specularTexture ); | ||
1415 | tex = renderer.getTextureByName(this._specularTexture, wrap, mips ); | 1401 | tex = renderer.getTextureByName(this._specularTexture, wrap, mips ); |
1416 | technique.u_glowMap.set( tex ); | 1402 | technique.u_glowMap.set( tex ); |
1417 | } | 1403 | } |
diff --git a/assets/rdge-compiled.js b/assets/rdge-compiled.js index 66bf5a42..0bbcb05b 100755 --- a/assets/rdge-compiled.js +++ b/assets/rdge-compiled.js | |||
@@ -107,11 +107,11 @@ t);this.def[t]=null;break}for(var n in RDGE.rdgeGlobalParameters){l=new globalPa | |||
107 | 0,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= | 107 | 0,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= |
108 | this[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]= | 108 | this[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]= |
109 | l;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}; | 109 | l;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}; |
110 | this.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, | 110 | this.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", |
111 | 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);window.console.log("Error in program linking:"+a);this.ctx.deleteProgram(c); | 111 | d,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); |
112 | 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);this.technique.passes[h].params[d.name]&& | 112 | window.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); |
113 | 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],c.offset[1])}c.depthWrite&& | 113 | this.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], |
114 | 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): | 114 | c.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): |
115 | this.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)}}; | 115 | this.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)}}; |
116 | this.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, | 116 | this.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, |
117 | c=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}; | 117 | c=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 | |||
212 | RDGE.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+ | 212 | RDGE.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]= |
214 | a;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= | 214 | a;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= |
215 | contextManager.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}}; | 215 | contextManager.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}}; |
216 | RDGE.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]); | 216 | RDGE.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]); |
217 | else{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= | 217 | else{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))}}; |