diff options
author | hwc487 | 2012-02-08 14:46:35 -0800 |
---|---|---|
committer | hwc487 | 2012-02-08 14:46:35 -0800 |
commit | ab4b753907bc80a969b0d4104d0b0731597e3bf0 (patch) | |
tree | 693e901a8bb1f760523492ea36bd30226d33be4b /js/helper-classes/RDGE/src/tools/rdge-compiled.js | |
parent | 064d74fb2694318615f513c83772276cec34bb86 (diff) | |
download | ninja-ab4b753907bc80a969b0d4104d0b0731597e3bf0.tar.gz |
Removed unused rdge files from the compiler.
switched the preloader to use the compiled version of rdge
Updated the rdge binary.
Diffstat (limited to 'js/helper-classes/RDGE/src/tools/rdge-compiled.js')
-rw-r--r-- | js/helper-classes/RDGE/src/tools/rdge-compiled.js | 49 |
1 files changed, 21 insertions, 28 deletions
diff --git a/js/helper-classes/RDGE/src/tools/rdge-compiled.js b/js/helper-classes/RDGE/src/tools/rdge-compiled.js index 91dd637a..4301200f 100644 --- a/js/helper-classes/RDGE/src/tools/rdge-compiled.js +++ b/js/helper-classes/RDGE/src/tools/rdge-compiled.js | |||
@@ -55,14 +55,15 @@ this.ctx.clearColor(1,0,0,1);this.clearColor=[1,0,0,1];this.clearFlags=this.ctx. | |||
55 | 5123;this.INT=5124;this.UNSIGNED_INT=5125;this.FLOAT=5126;this.VS_ELEMENT_FLOAT4=4;this.VS_ELEMENT_FLOAT3=this.VS_ELEMENT_NORM=this.VS_ELEMENT_POS=3;this.VS_ELEMENT_UV=this.VS_ELEMENT_FLOAT2=2;this.VS_ELEMENT_FLOAT=1;this.MAX_ELEM_TYPES=7;this.BUFFER_STATIC=35040;this.BUFFER_DYNAMIC=35044;this.BUFFER_STREAM=35048;this.MAX_MATERIAL_LIGHTS=4;this.usedTextureUnits=5;this.vpY=this.vpX=0;this.vpWidth=a.width;this.vpHeight=a.height;this.cameraMan=new cameraManager;this.buffers=[];this.cullBackFace=function(){this.ctx.cullFace(this.ctx.Back)}; | 55 | 5123;this.INT=5124;this.UNSIGNED_INT=5125;this.FLOAT=5126;this.VS_ELEMENT_FLOAT4=4;this.VS_ELEMENT_FLOAT3=this.VS_ELEMENT_NORM=this.VS_ELEMENT_POS=3;this.VS_ELEMENT_UV=this.VS_ELEMENT_FLOAT2=2;this.VS_ELEMENT_FLOAT=1;this.MAX_ELEM_TYPES=7;this.BUFFER_STATIC=35040;this.BUFFER_DYNAMIC=35044;this.BUFFER_STREAM=35048;this.MAX_MATERIAL_LIGHTS=4;this.usedTextureUnits=5;this.vpY=this.vpX=0;this.vpWidth=a.width;this.vpHeight=a.height;this.cameraMan=new cameraManager;this.buffers=[];this.cullBackFace=function(){this.ctx.cullFace(this.ctx.Back)}; |
56 | this.cullFrontFace=function(){this.ctx.cullFace(this.ctx.FRONT)};this.disableCulling=function(){this.ctx.disable(this.ctx.CULL_FACE)};this.enableCulling=function(){this.ctx.enable(this.ctx.CULL_FACE)};this.enablePolyOffsetFill=function(){this.ctx.enable(this.ctx.POLYGON_OFFSET_FILL)};this.disablePolyOffsetFill=function(){this.ctx.enable(this.ctx.POLYGON_OFFSET_FILL)};this.enablePointSprites=function(){};this.disablePointSprites=function(){};this.setClearColor=function(a){this.clearColor=a.slice(); | 56 | this.cullFrontFace=function(){this.ctx.cullFace(this.ctx.FRONT)};this.disableCulling=function(){this.ctx.disable(this.ctx.CULL_FACE)};this.enableCulling=function(){this.ctx.enable(this.ctx.CULL_FACE)};this.enablePolyOffsetFill=function(){this.ctx.enable(this.ctx.POLYGON_OFFSET_FILL)};this.disablePolyOffsetFill=function(){this.ctx.enable(this.ctx.POLYGON_OFFSET_FILL)};this.enablePointSprites=function(){};this.disablePointSprites=function(){};this.setClearColor=function(a){this.clearColor=a.slice(); |
57 | this.ctx.clearColor(a[0],a[1],a[2],a[3])};this.setClearFlags=function(a){this.clearFlags=a};this._clear=function(){this.ctx.clear(this.clearFlags)};this.clear=function(a){this.ctx.clear(a)};this.flush=function(){this.ctx.flush()};this.setViewPort=function(a,b,h,l){this.vpX=a;this.vpY=b;this.vpWidth=h;this.vpHeight=l;this.ctx.viewport(this.vpX,this.vpY,this.vpWidth,this.vpHeight)};this.cameraManager=function(){return this.cameraMan};this.textureMap=[];this.rttMap=[];this.getTextureByName=function(a, | 57 | this.ctx.clearColor(a[0],a[1],a[2],a[3])};this.setClearFlags=function(a){this.clearFlags=a};this._clear=function(){this.ctx.clear(this.clearFlags)};this.clear=function(a){this.ctx.clear(a)};this.flush=function(){this.ctx.flush()};this.setViewPort=function(a,b,h,l){this.vpX=a;this.vpY=b;this.vpWidth=h;this.vpHeight=l;this.ctx.viewport(this.vpX,this.vpY,this.vpWidth,this.vpHeight)};this.cameraManager=function(){return this.cameraMan};this.textureMap=[];this.rttMap=[];this.getTextureByName=function(a, |
58 | b,h){var l=a.split(".")[1],n=this.textureMap[a];if(n===void 0)n=this.createTexture(a+(l?"":".png"),b,h),this.textureMap[a]=n,n.lookUpName=a;return n};_texparams=function(a,b){this.wrap=a;this.mips=b};this.createTexture=function(a,b,h){var l=this.ctx.createTexture();b===void 0&&(b="CLAMP");h===void 0&&(h=!0);if(l)l.image=new Image,l.image.src=a,l.image.context=g_Engine.getContext(),l.texparams=new _texparams(b,h),l.image.onload=function(){this.context.ctxStateManager.RDGEInitState.loadTexture(l)}; | 58 | b,h){var l=a.split(".")[1],n=this.textureMap[a];n===void 0?(n=this.createTexture(a+(l?"":".png"),b,h),this.textureMap[a]=n,n.lookUpName=a,n.previouslyReferenced=!1):n.previouslyReferenced=!0;return n};this.unloadedTextureCount=0;_texparams=function(a,b){this.wrap=a;this.mips=b};this.createTexture=function(a,b,h){var l=this.ctx.createTexture();this.unloadedTextureCount++;b===void 0&&(b="CLAMP");h===void 0&&(h=!0);if(l)l.image=new Image,l.image.src=a,l.image.context=g_Engine.getContext(),l.texparams= |
59 | return l};this.commitTexture=function(a){this.ctx.bindTexture(this.ctx.TEXTURE_2D,a);this.ctx.texImage2D(this.ctx.TEXTURE_2D,0,this.ctx.RGBA,this.ctx.RGBA,this.ctx.UNSIGNED_BYTE,a.image);a.texparams.mips&&this.ctx.generateMipmap(this.ctx.TEXTURE_2D);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_MAG_FILTER,this.ctx.LINEAR);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_MIN_FILTER,a.texparams.mips?this.ctx.LINEAR_MIPMAP_LINEAR:this.ctx.LINEAR);this.ctx.texParameteri(this.ctx.TEXTURE_2D, | 59 | new _texparams(b,h),l.image.onload=function(){this.context.ctxStateManager.RDGEInitState.loadTexture(l);this.context.renderer.unloadedTextureCount--;l.callback&&l.callback(l);this.context.renderer.unloadedTextureCount<0&&console.log("more textures loaded then created...")},l.image.onerror=function(){this.context.renderer.unloadedTextureCount--;l.callback&&l.callback(l);this.context.renderer.unloadedTextureCount<0&&console.log("more textures loaded then created...")};return l};this.commitTexture=function(a){this.ctx.bindTexture(this.ctx.TEXTURE_2D, |
60 | this.ctx.TEXTURE_WRAP_S,a.texparams.wrap==="REPEAT"?this.ctx.REPEAT:this.ctx.CLAMP_TO_EDGE);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_WRAP_T,a.texparams.wrap==="REPEAT"?this.ctx.REPEAT:this.ctx.CLAMP_TO_EDGE);this.ctx.bindTexture(this.ctx.TEXTURE_2D,null)};this.verify=function(a){var b=this.ctx.getError();b!=0&&window.console.log("GLError ( "+a+") : "+b)};this.createRenderTargetTexture=function(a,b,h,l){var n=this.ctx,o=n.createFramebuffer();n.bindFramebuffer(n.FRAMEBUFFER,o);o.width= | 60 | a);this.ctx.texImage2D(this.ctx.TEXTURE_2D,0,this.ctx.RGBA,this.ctx.RGBA,this.ctx.UNSIGNED_BYTE,a.image);a.texparams.mips&&this.ctx.generateMipmap(this.ctx.TEXTURE_2D);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_MAG_FILTER,this.ctx.LINEAR);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_MIN_FILTER,a.texparams.mips?this.ctx.LINEAR_MIPMAP_LINEAR:this.ctx.LINEAR);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_WRAP_S,a.texparams.wrap==="REPEAT"?this.ctx.REPEAT: |
61 | b;o.height=h;b=n.createTexture();n.bindTexture(n.TEXTURE_2D,b);try{n.texImage2D(n.TEXTURE_2D,0,n.RGBA,o.width,o.height,0,n.RGBA,n.UNSIGNED_BYTE,null)}catch(p){h=new WebctxUnsignedByteArray(o.width*o.height*4),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,o.width,o.height,0,n.RGBA,n.UNSIGNED_BYTE,h)}n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,l?n.LINEAR_MIPMAP_NEAREST:n.LINEAR);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D, | 61 | this.ctx.CLAMP_TO_EDGE);this.ctx.texParameteri(this.ctx.TEXTURE_2D,this.ctx.TEXTURE_WRAP_T,a.texparams.wrap==="REPEAT"?this.ctx.REPEAT:this.ctx.CLAMP_TO_EDGE);this.ctx.bindTexture(this.ctx.TEXTURE_2D,null)};this.verify=function(a){var b=this.ctx.getError();b!=0&&window.console.log("GLError ( "+a+") : "+b)};this.createRenderTargetTexture=function(a,b,h,l){var n=this.ctx,o=n.createFramebuffer();n.bindFramebuffer(n.FRAMEBUFFER,o);o.width=b;o.height=h;b=n.createTexture();n.bindTexture(n.TEXTURE_2D,b); |
62 | n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);l&&n.generateMipmap(n.TEXTURE_2D);l=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,l);n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,o.width,o.height);n.getError(n.bindFramebuffer(n.FRAMEBUFFER,o));n.getError(n.bindRenderbuffer(n.RENDERBUFFER,l));n.getError(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,o.width,o.height));n.bindRenderbuffer(n.RENDERBUFFER,null);n.getError(n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D, | 62 | try{n.texImage2D(n.TEXTURE_2D,0,n.RGBA,o.width,o.height,0,n.RGBA,n.UNSIGNED_BYTE,null)}catch(p){h=new WebctxUnsignedByteArray(o.width*o.height*4),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,o.width,o.height,0,n.RGBA,n.UNSIGNED_BYTE,h)}n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.LINEAR);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,l?n.LINEAR_MIPMAP_NEAREST:n.LINEAR);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);l&& |
63 | b,0));n.getError(n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,l));n.bindFramebuffer(n.FRAMEBUFFER,null);n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null);b.id="RT_"+nodeIdGen.getId();b.frameBuffer=o;this.textureMap[a]&&window.console.log("Notification: render target: "+a+" has overwritten an existing render target");return this.textureMap[a]=b};this.defaultShaderDefintion={shaders:{defaultVShader:"assets/shaders/test_vshader.glsl", | 63 | n.generateMipmap(n.TEXTURE_2D);l=n.createRenderbuffer();n.bindRenderbuffer(n.RENDERBUFFER,l);n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,o.width,o.height);n.getError(n.bindFramebuffer(n.FRAMEBUFFER,o));n.getError(n.bindRenderbuffer(n.RENDERBUFFER,l));n.getError(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,o.width,o.height));n.bindRenderbuffer(n.RENDERBUFFER,null);n.getError(n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b,0));n.getError(n.framebufferRenderbuffer(n.FRAMEBUFFER, |
64 | defaultFShader:"assets/shaders/test_fshader.glsl"},techniques:{defaultTechnique:[{vshader:"defaultVShader",fshader:"defaultFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}}; | 64 | n.DEPTH_ATTACHMENT,n.RENDERBUFFER,l));n.bindFramebuffer(n.FRAMEBUFFER,null);n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null);b.id="RT_"+nodeIdGen.getId();b.frameBuffer=o;this.textureMap[a]&&window.console.log("Notification: render target: "+a+" has overwritten an existing render target");return this.textureMap[a]=b};this.defaultShaderDefintion={shaders:{defaultVShader:"assets/shaders/test_vshader.glsl",defaultFShader:"assets/shaders/test_fshader.glsl"}, |
65 | rdgeDefaultShaderDefintion={shaders:{defaultVShader:"assets/shaders/test_vshader.glsl",defaultFShader:"assets/shaders/test_fshader.glsl"},techniques:{defaultTechnique:[{vshader:"defaultVShader",fshader:"defaultFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}; | 65 | techniques:{defaultTechnique:[{vshader:"defaultVShader",fshader:"defaultFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}}; |
66 | rdgeDefaultShaderDefintion={shaders:{defaultVShader:"assets/shaders/Basic.vert.glsl",defaultFShader:"assets/shaders/Basic.frag.glsl"},techniques:{defaultTechnique:[{vshader:"defaultVShader",fshader:"defaultFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}; | ||
66 | rdgeDepthMapShaderDef={shaders:{depthMapVShader:"assets/shaders/depthMap_vshader.glsl",depthMapFShader:"assets/shaders/depthMap_fshader.glsl"},techniques:{shadowDepthMap:[{vshader:"depthMapVShader",fshader:"depthMapFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}],depthMap:[{vshader:"depthMapVShader",fshader:"depthMapFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}}, | 67 | rdgeDepthMapShaderDef={shaders:{depthMapVShader:"assets/shaders/depthMap_vshader.glsl",depthMapFShader:"assets/shaders/depthMap_fshader.glsl"},techniques:{shadowDepthMap:[{vshader:"depthMapVShader",fshader:"depthMapFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}],depthMap:[{vshader:"depthMapVShader",fshader:"depthMapFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}}, |
67 | params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}};rdgeViewSpaceNormalsShader={shaders:{normalsVShader:"assets/shaders/norm_depth_vshader.glsl",normalsFShader:"assets/shaders/norm_depth_fshader.glsl"},techniques:{depthMapWNormal:[{vshader:"normalsVShader",fshader:"normalsFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}; | 68 | params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}};rdgeViewSpaceNormalsShader={shaders:{normalsVShader:"assets/shaders/norm_depth_vshader.glsl",normalsFShader:"assets/shaders/norm_depth_fshader.glsl"},techniques:{depthMapWNormal:[{vshader:"normalsVShader",fshader:"normalsFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}; |
68 | rdgeScreenQuadShaderDef={shaders:{screenQuadVShader:"\t\t\t\tattribute vec3 a_pos;\t\t\t\tattribute vec2 a_uv;\t\t\t\tuniform float u_inv_viewport_width;\t\t\t\tuniform float u_inv_viewport_height;\t\t\t\tvarying vec2 vTexcoord;\t\t\t\tvoid main()\t\t\t\t{\t\t\t\t\tgl_Position = vec4(a_pos.xy, 0.0, 1.0);\t\t\t\t\t\t\t\tvTexcoord.x = 0.5 * (1.0 + a_pos.x + u_inv_viewport_width);\t\t\t\tvTexcoord.y = 0.5 * (1.0 - a_pos.y + u_inv_viewport_height);\t\t\t\t}",screenQuadFShader:"\t\t\t\tprecision highp float;\t\t\t\tuniform sampler2D u_mainRT;\t\t\t\tuniform sampler2D u_glowFinal;\t\t\t\tuniform sampler2D u_ssaoRT;\t\t\t\tuniform sampler2D u_shadowMap;\t\t\t\tvarying vec2 vTexcoord;\t\t\t\tvoid main()\t\t\t\t{\t\t\t\t vec2 tex = vec2(vTexcoord.x, 1.0 - vTexcoord.y);\t\t\t\t vec4 glowTexel = texture2D(u_glowFinal, tex);\t\t\t\t vec4 ssaoTexel = texture2D(u_ssaoRT, tex);\t\t\t\t vec4 smapCoef = texture2D(u_shadowMap, tex);\t\t\t\t ssaoTexel.a = 0.0;\t\t\t\t vec4 texel\t\t= texture2D(u_mainRT, tex);\t\t\t\t gl_FragColor = vec4(texel.r*((1.0 - glowTexel.r)*smapCoef.r), texel.g*((1.0 - glowTexel.g)*smapCoef.g), texel.b*((1.0 - glowTexel.b)*smapCoef.b), texel.a) + glowTexel - ssaoTexel;\t\t\t\t}"}, | 69 | rdgeScreenQuadShaderDef={shaders:{screenQuadVShader:"\t\t\t\tattribute vec3 a_pos;\t\t\t\tattribute vec2 a_uv;\t\t\t\tuniform float u_inv_viewport_width;\t\t\t\tuniform float u_inv_viewport_height;\t\t\t\tvarying vec2 vTexcoord;\t\t\t\tvoid main()\t\t\t\t{\t\t\t\t\tgl_Position = vec4(a_pos.xy, 0.0, 1.0);\t\t\t\t\t\t\t\tvTexcoord.x = 0.5 * (1.0 + a_pos.x + u_inv_viewport_width);\t\t\t\tvTexcoord.y = 0.5 * (1.0 - a_pos.y + u_inv_viewport_height);\t\t\t\t}",screenQuadFShader:"\t\t\t\tprecision highp float;\t\t\t\tuniform sampler2D u_mainRT;\t\t\t\tuniform sampler2D u_glowFinal;\t\t\t\tuniform sampler2D u_ssaoRT;\t\t\t\tuniform sampler2D u_shadowMap;\t\t\t\tvarying vec2 vTexcoord;\t\t\t\tvoid main()\t\t\t\t{\t\t\t\t vec2 tex = vec2(vTexcoord.x, 1.0 - vTexcoord.y);\t\t\t\t vec4 glowTexel = texture2D(u_glowFinal, tex);\t\t\t\t vec4 ssaoTexel = texture2D(u_ssaoRT, tex);\t\t\t\t vec4 smapCoef = texture2D(u_shadowMap, tex);\t\t\t\t ssaoTexel.a = 0.0;\t\t\t\t vec4 texel\t\t= texture2D(u_mainRT, tex);\t\t\t\t gl_FragColor = vec4(texel.r*((1.0 - glowTexel.r)*smapCoef.r), texel.g*((1.0 - glowTexel.g)*smapCoef.g), texel.b*((1.0 - glowTexel.b)*smapCoef.b), texel.a) + glowTexel - ssaoTexel;\t\t\t\t}"}, |
@@ -117,12 +118,12 @@ jshader=function(a){this.name=a;this.def=null;this.technique={};this.params={};t | |||
117 | "int",paramTypeNameMapping[a.FLOAT]="float",paramTypeNameMapping[a.FLOAT_VEC2]="vec2",paramTypeNameMapping[a.FLOAT_VEC3]="vec3",paramTypeNameMapping[a.FLOAT_VEC4]="vec4",paramTypeNameMapping[a.INT_VEC2]="vec2",paramTypeNameMapping[a.INT_VEC3]="vec3",paramTypeNameMapping[a.INT_VEC4]="vec4",paramTypeNameMapping[a.BOOL_VEC2]="vec2",paramTypeNameMapping[a.BOOL_VEC3]="vec3",paramTypeNameMapping[a.BOOL_VEC4]="vec4",paramTypeNameMapping[a.FLOAT_MAT2]="mat2",paramTypeNameMapping[a.FLOAT_MAT3]="mat3",paramTypeNameMapping[a.FLOAT_MAT4]= | 118 | "int",paramTypeNameMapping[a.FLOAT]="float",paramTypeNameMapping[a.FLOAT_VEC2]="vec2",paramTypeNameMapping[a.FLOAT_VEC3]="vec3",paramTypeNameMapping[a.FLOAT_VEC4]="vec4",paramTypeNameMapping[a.INT_VEC2]="vec2",paramTypeNameMapping[a.INT_VEC3]="vec3",paramTypeNameMapping[a.INT_VEC4]="vec4",paramTypeNameMapping[a.BOOL_VEC2]="vec2",paramTypeNameMapping[a.BOOL_VEC3]="vec3",paramTypeNameMapping[a.BOOL_VEC4]="vec4",paramTypeNameMapping[a.FLOAT_MAT2]="mat2",paramTypeNameMapping[a.FLOAT_MAT3]="mat3",paramTypeNameMapping[a.FLOAT_MAT4]= |
118 | "mat4",paramTypeNameMapping[a.SAMPLER_2D]="tex2d",paramTypeNameMapping[a.SAMPLER_CUBE]="texCube";this.bindParameters=function(a){for(var f=a.defParamsList,g=a.lightParams,h=a.lightContext,l=f.length,n=0,o=Array(2),p=0,n=0;n<l;++n)if(f[n].type=="tex2d"||f[n].type=="texCube")o[0]=p++,o[1]=f[n].data[0],bindMap[f[n].type](this.ctx,f[n].loc,o);else bindMap[f[n].type](this.ctx,f[n].loc,rdgeGlobalParameters[f[n].name].data);f=rdgeConstants.MAX_MATERIAL_LIGHTS;for(l=0;l<f;++l)if(h[l]!=null&&g[l]){n=g[l].length; | 119 | "mat4",paramTypeNameMapping[a.SAMPLER_2D]="tex2d",paramTypeNameMapping[a.SAMPLER_CUBE]="texCube";this.bindParameters=function(a){for(var f=a.defParamsList,g=a.lightParams,h=a.lightContext,l=f.length,n=0,o=Array(2),p=0,n=0;n<l;++n)if(f[n].type=="tex2d"||f[n].type=="texCube")o[0]=p++,o[1]=f[n].data[0],bindMap[f[n].type](this.ctx,f[n].loc,o);else bindMap[f[n].type](this.ctx,f[n].loc,rdgeGlobalParameters[f[n].name].data);f=rdgeConstants.MAX_MATERIAL_LIGHTS;for(l=0;l<f;++l)if(h[l]!=null&&g[l]){n=g[l].length; |
119 | for(p=0;p<n;++p)lightDataMap[g[l][p].dataIndex](this.ctx,g[l][p].loc,h[l])}p=this.renderer.usedTextureUnits;f=a.paramsList;l=f.length;for(n=0;n<l;++n)if(f[n].type=="tex2d"||f[n].type=="texCube")o[0]=p++,o[1]=f[n].data[0],bindMap[f[n].type](this.ctx,f[n].loc,o);else bindMap[f[n].type](this.ctx,f[n].loc,f[n].data)};createJShaderTexture=function(a,f){var g=null,g=typeof f.data=="string"?a.canvas.renderer.getTextureByName(f.data,f.wrap,f.repeat,f.mips):a.canvas.renderer.getTextureByName(f.data.lookUpName, | 120 | for(p=0;p<n;++p)lightDataMap[g[l][p].dataIndex](this.ctx,g[l][p].loc,h[l])}p=this.renderer.usedTextureUnits;f=a.paramsList;l=f.length;for(n=0;n<l;++n)if(f[n].type=="tex2d"||f[n].type=="texCube")o[0]=p++,o[1]=f[n].data[0],bindMap[f[n].type](this.ctx,f[n].loc,o);else bindMap[f[n].type](this.ctx,f[n].loc,f[n].data)};createJShaderTexture=function(a,f){var g=null,g=typeof f.data=="string"?a.canvas.renderer.getTextureByName(f.data,f.wrap,f.repeat,f.mips):a.canvas.renderer.getTextureByName(f.data.lookUpName, |
120 | f.wrap,f.repeat,f.mips);return[g]};paramType=function(a,f,g,h,l){this.loc=a.getUniformLocation(h,f);this.loc==null&&window.console.log("ctx:"+a.canvas.id+", technique: "+l+", uniform: "+f+" was not found, jshader param will have no affect");f=g[f];this.type=f.type;if(f.data==void 0)switch(f.type){case "vec4":this.data=vec4.zero();break;case "vec3":this.data=vec3.zero();break;case "vec2":this.data=vec2.zero();break;case "mat4":this.data=mat4.zero();break;case "mat3":this.data=Array(9);break;case "mat2":this.data= | 121 | f.wrap,f.repeat,f.mips);return[g]};paramType=function(a,f,g,h,l){this.loc=a.getUniformLocation(h,f);this.loc==null&&window.console.log("ctx:"+a.canvas.rdgeid+", technique: "+l+", uniform: "+f+" was not found, jshader param will have no affect");f=g[f];this.type=f.type;if(f.data==void 0)switch(f.type){case "vec4":this.data=vec4.zero();break;case "vec3":this.data=vec3.zero();break;case "vec2":this.data=vec2.zero();break;case "mat4":this.data=mat4.zero();break;case "mat3":this.data=Array(9);break;case "mat2":this.data= |
121 | [0,0,0,0];break;case "float":this.data=[0];break;case "int":this.data=[0];break;case "tex2d":this.data=[a.canvas.renderer.getTextureByName("assets/images/white.png")];break;case "texCube":this.data=[a.canvas.renderer.getTextureByName("assets/images/white.png")]}else this.data=f.type=="tex2d"||f.type=="texCube"?createJShaderTexture(a,f):f.data.slice();this.get=function(){return this.data.slice()};this.set=function(f){if(this.type=="tex2d"||this.type=="texCube")typeof f=="string"&&(f=a.canvas.renderer.getTextureByName(f)), | 122 | [0,0,0,0];break;case "float":this.data=[0];break;case "int":this.data=[0];break;case "tex2d":this.data=[a.canvas.renderer.getTextureByName("assets/images/white.png")];break;case "texCube":this.data=[a.canvas.renderer.getTextureByName("assets/images/white.png")]}else this.data=f.type=="tex2d"||f.type=="texCube"?createJShaderTexture(a,f):f.data.slice();this.get=function(){return this.data.slice()};this.set=function(f){if(this.type=="tex2d"||this.type=="texCube")typeof f=="string"&&(f=a.canvas.renderer.getTextureByName(f)), |
122 | this.data[0]=f;else for(var g=this.data.length,h=0;h<g;++h)this.data[h]=f[h]}};globalParam=function(a,f,g,h){this.type=g.type;this.data=g.data;this.loc=a.getUniformLocation(h,f);if(this.data)this.data=g.type=="tex2d"||g.type=="texCube"?createJShaderTexture(a,g):g.data.slice();else switch(g.type){case "vec4":this.data=vec4.zero();break;case "vec3":this.data=vec3.zero();break;case "vec2":this.data=vec2.zero();break;case "mat4":this.data=mat4.zero();break;case "mat3":this.data=Array(9);break;case "mat2":this.data= | 123 | this.data[0]=f;else for(var g=this.data.length,h=0;h<g;++h)this.data[h]=f[h]}};globalParam=function(a,f,g,h){this.type=g.type;this.data=g.data;this.loc=a.getUniformLocation(h,f);if(this.data)this.data=g.type=="tex2d"||g.type=="texCube"?createJShaderTexture(a,g):g.data.slice();else switch(g.type){case "vec4":this.data=vec4.zero();break;case "vec3":this.data=vec3.zero();break;case "vec2":this.data=vec2.zero();break;case "mat4":this.data=mat4.zero();break;case "mat3":this.data=Array(9);break;case "mat2":this.data= |
123 | [0,0,0,0];break;case "float":this.data=[0];break;case "int":this.data=[0];break;case "tex2d":this.data=[a.canvas.renderer.getTextureByName("assets/images/white.png")];break;case "texCube":this.data=[a.canvas.renderer.getTextureByName("assets/images/white.png")]}this.get=function(){return this.data.slice()};this.set=function(f){if(this.type=="tex2d"||this.type=="texCube")typeof f=="string"&&(f=a.canvas.renderer.getTextureByName(f)),this.data[0]=f;else for(var g=this.data.length,h=0;h<g;++h)this.data[h]= | 124 | [0,0,0,0];break;case "float":this.data=[0];break;case "int":this.data=[0];break;case "tex2d":this.data=[a.canvas.renderer.getTextureByName("assets/images/white.png")];break;case "texCube":this.data=[a.canvas.renderer.getTextureByName("assets/images/white.png")]}this.get=function(){return this.data.slice()};this.set=function(f){if(this.type=="tex2d"||this.type=="texCube")typeof f=="string"&&(f=a.canvas.renderer.getTextureByName(f)),this.data[0]=f;else for(var g=this.data.length,h=0;h<g;++h)this.data[h]= |
124 | f[h]}};this.init=function(){var a=this.def.techniques,f=null;for(t in a){var f=t,g=a[t];this[t]={passes:[]};for(var h=g.length,l=0;l<h;){var n=this.buildProgram(g[l]);this.ctx.useProgram(n);var o=this.ctx.getProgramParameter(n,this.ctx.ACTIVE_ATTRIBUTES);for(j=0;j<o;++j){var p=this.ctx.getActiveAttrib(n,j);g[l].attributes[p.name]={type:paramTypeNameMapping[p.type]}}o=this.ctx.getProgramParameter(n,this.ctx.ACTIVE_UNIFORMS);for(j=0;j<o;++j)p=this.ctx.getActiveUniform(n,j),rdgeGlobalParameters[p.name]|| | 125 | f[h]}};this.init=function(){var a=this.def.techniques,f=null;for(t in a){var f=t,g=a[t];this[t]={passes:[]};for(var h=g.length,l=0;l<h;){var n=this.buildProgram(g[l]);this.ctx.useProgram(n);var o=this.ctx.getProgramParameter(n,this.ctx.ACTIVE_ATTRIBUTES);for(j=0;j<o;++j){var p=this.ctx.getActiveAttrib(n,j);g[l].attributes[p.name]={type:paramTypeNameMapping[p.type]}}o=this.ctx.getProgramParameter(n,this.ctx.ACTIVE_UNIFORMS);for(j=0;j<o;++j)p=this.ctx.getActiveUniform(n,j),rdgeGlobalParameters[p.name]|| |
125 | (g[l].params[p.name]={type:paramTypeNameMapping[p.type]});n.ctxId=this.ctx.canvas.id;if(n)this[t].passes.push({program:n,params:{},defParams:{},states:g[l].states,attributes:g[l].attribPairs});else{this.renderer.console.log("Build errors found in technique: "+t);this.def[t]=null;break}for(var q in rdgeGlobalParameters)if(o=new globalParam(this.ctx,q,rdgeGlobalParameters[q],n),o.loc!=null)o.loc.ctxID=this.ctx.canvas.id,this[t].passes[l].defParams[q]=o,this.global[q]=o;this[t].passes[l].lightParams= | 126 | (g[l].params[p.name]={type:paramTypeNameMapping[p.type]});n.ctxId=this.ctx.canvas.rdgeid;if(n)this[t].passes.push({program:n,params:{},defParams:{},states:g[l].states,attributes:g[l].attribPairs});else{this.renderer.console.log("Build errors found in technique: "+t);this.def[t]=null;break}for(var q in rdgeGlobalParameters)if(o=new globalParam(this.ctx,q,rdgeGlobalParameters[q],n),o.loc!=null)o.loc.ctxID=this.ctx.canvas.rdgeid,this[t].passes[l].defParams[q]=o,this.global[q]=o;this[t].passes[l].lightParams= |
126 | [null,null,null,null];this[t].passes[l].lightContext=[null,null,null,null];if(!this[t].passes[l].paramsList)this[t].passes[l].paramsList=[];o=rdgeConstants.MAX_MATERIAL_LIGHTS;for(p=0;p<o;++p){this[t].passes[l].lightParams[p]=null;var r=0,s;for(s in g_Engine.lightManager.lightUniforms[p])loc=this.ctx.getUniformLocation(n,s),loc!=null&&(this[t].passes[l].lightParams[p]||(this[t].passes[l].lightParams[p]=[]),this[t].passes[l].lightParams[p].push({loc:loc,name:s,dataIndex:r})),r++}for(q in g[l].params)typeof g[l].params[q]!= | 127 | [null,null,null,null];this[t].passes[l].lightContext=[null,null,null,null];if(!this[t].passes[l].paramsList)this[t].passes[l].paramsList=[];o=rdgeConstants.MAX_MATERIAL_LIGHTS;for(p=0;p<o;++p){this[t].passes[l].lightParams[p]=null;var r=0,s;for(s in g_Engine.lightManager.lightUniforms[p])loc=this.ctx.getUniformLocation(n,s),loc!=null&&(this[t].passes[l].lightParams[p]||(this[t].passes[l].lightParams[p]=[]),this[t].passes[l].lightParams[p].push({loc:loc,name:s,dataIndex:r})),r++}for(q in g[l].params)typeof g[l].params[q]!= |
127 | "string"&&(o=new paramType(this.ctx,q,g[l].params,n,t),this[t].passes[l].params[q]=o,this[t][q]=o);for(q in g[l].params)typeof g[l].params[q]=="string"&&(this[t][q]=this[t].passes[l].params[q]);l++}}for(t in a){h=this[t].passes.length;for(l=0;l<h;++l){this[t].passes[l].defParamsList=[];for(q in this[t].passes[l].params)g=this[t].passes[l].params[q],g.name=q,this[t].passes[l].paramsList.push(g);for(q in this[t].passes[l].defParams)g=this[t].passes[l].defParams[q],g.name=q,this[t].passes[l].defParamsList.push(g)}}this.setTechnique(f)}; | 128 | "string"&&(o=new paramType(this.ctx,q,g[l].params,n,t),this[t].passes[l].params[q]=o,this[t][q]=o);for(q in g[l].params)typeof g[l].params[q]=="string"&&(this[t][q]=this[t].passes[l].params[q]);l++}}for(t in a){h=this[t].passes.length;for(l=0;l<h;++l){this[t].passes[l].defParamsList=[];for(q in this[t].passes[l].params)g=this[t].passes[l].params[q],g.name=q,this[t].passes[l].paramsList.push(g);for(q in this[t].passes[l].defParams)g=this[t].passes[l].defParams[q],g.name=q,this[t].passes[l].defParamsList.push(g)}}this.setTechnique(f)}; |
128 | this.initLocalParameter=function(a,f){var g=this.def.techniques;for(t in g)for(var h=g[t],l=h.length,n=0;n<l;){var o=new paramType(this.ctx,a,f,h[n].program,t);if(o){h[n][a]=o;if(!h[n].paramsList)h[n].paramsList=[];h[n].paramsList.push(o)}n++}};this.buildShader=function(a,f){var g="#define PC\n";g+=f;f=g;g=this.ctx.createShader(a);if(g==null)return this.renderer.console.log("*** Error: unable to create shader '"+a+"'"),null;this.ctx.shaderSource(g,f);this.ctx.compileShader(g);if(!this.ctx.getShaderParameter(g, | 129 | this.initLocalParameter=function(a,f){var g=this.def.techniques;for(t in g)for(var h=g[t],l=h.length,n=0;n<l;){var o=new paramType(this.ctx,a,f,h[n].program,t);if(o){h[n][a]=o;if(!h[n].paramsList)h[n].paramsList=[];h[n].paramsList.push(o)}n++}};this.buildShader=function(a,f){var g="#define PC\n";g+=f;f=g;g=this.ctx.createShader(a);if(g==null)return this.renderer.console.log("*** Error: unable to create shader '"+a+"'"),null;this.ctx.shaderSource(g,f);this.ctx.compileShader(g);if(!this.ctx.getShaderParameter(g, |
@@ -241,9 +242,9 @@ Engine.prototype.init=function(a,b,f){this.GlInit(f);globalParamFuncSet=function | |||
241 | h;for(h in a)rdgeGlobalParameters[h]=new globalParamFuncSet(a[h])}this.lastWindowWidth=window.innerWidth;this.lastWindowHeight=window.innerHeight;this.defaultContext=new 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=!0};Engine.prototype.Shutdown=function(){this.PopAll()}; | 242 | h;for(h in a)rdgeGlobalParameters[h]=new globalParamFuncSet(a[h])}this.lastWindowWidth=window.innerWidth;this.lastWindowHeight=window.innerHeight;this.defaultContext=new 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=!0};Engine.prototype.Shutdown=function(){this.PopAll()}; |
242 | Engine.prototype.GlInit=function(){for(var a=document.getElementsByTagName("canvas"),b=a.length,f=0;f<b;++f){var g;a[f].getAttribute("rdge")=="true"&&(g=a[f],this.registerCanvas(g))}};Engine.prototype.loadScene=function(a){var b="assets_web/mesh/"+a+".json";contextManager.currentCtx.stateMan.currentState().name=="RunState"&&(contextManager.currentCtx.stateMan.PushState(contextManager.currentCtx.stateMan.RDGEInitState),contextManager.currentCtx.loadScene(b,a))};Engine.prototype.getScene=function(a){return contextManager.currentCtx.sceneGraphMap[a]}; | 243 | Engine.prototype.GlInit=function(){for(var a=document.getElementsByTagName("canvas"),b=a.length,f=0;f<b;++f){var g;a[f].getAttribute("rdge")=="true"&&(g=a[f],this.registerCanvas(g))}};Engine.prototype.loadScene=function(a){var b="assets_web/mesh/"+a+".json";contextManager.currentCtx.stateMan.currentState().name=="RunState"&&(contextManager.currentCtx.stateMan.PushState(contextManager.currentCtx.stateMan.RDGEInitState),contextManager.currentCtx.loadScene(b,a))};Engine.prototype.getScene=function(a){return contextManager.currentCtx.sceneGraphMap[a]}; |
243 | Engine.prototype.AddScene=function(a,b){contextManager.currentCtx.sceneGraphMap[a]=b;contextManager.currentCtx.currentScene=a};Engine.prototype.createRDGEPanel=function(){var a=new utilDbgPanel("tools","WebGL Viewer Settings");a.appendLabel("","");return panelObjectManager.addObject(a)};Engine.prototype.getRDGEPanel=function(a){return panelObjectManager.handleToObject(a)}; | 244 | Engine.prototype.AddScene=function(a,b){contextManager.currentCtx.sceneGraphMap[a]=b;contextManager.currentCtx.currentScene=a};Engine.prototype.createRDGEPanel=function(){var a=new utilDbgPanel("tools","WebGL Viewer Settings");a.appendLabel("","");return panelObjectManager.addObject(a)};Engine.prototype.getRDGEPanel=function(a){return panelObjectManager.handleToObject(a)}; |
244 | Engine.prototype.registerCanvas=function(a,b){if(!a||!this.getContext(a.id)){a.renderer=new _renderer(a);this.canvasToRendererMap[a.id]=a;a.renderer.id=a.id;var f=new stateManager,g=new contextDef;g.id=a.id;g.renderer=a.renderer;g.ctxStateManager=f;g.fpsTracker=new fpsTracker(a.id);g.renderer.mvMatrix=mat4.identity();g.renderer.invMvMatrix=mat4.identity();g.renderer.projectionMatrix=mat4.identity();g.renderer.normalMatrix=mat4.identity();a.rdgeCtxHandle=contextManager.addObject(g);contextManager.currentCtx= | 245 | Engine.prototype.registerCanvas=function(a,b){if(!a||!this.getContext(a.rdgeid)){a.renderer=new _renderer(a);this.canvasToRendererMap[a.rdgeid]=a;a.renderer.id=a.rdgeid;var f=new stateManager,g=new contextDef;g.id=a.rdgeid;g.renderer=a.renderer;g.ctxStateManager=f;g.fpsTracker=new fpsTracker(a.rdgeid);g.renderer.mvMatrix=mat4.identity();g.renderer.invMvMatrix=mat4.identity();g.renderer.projectionMatrix=mat4.identity();g.renderer.normalMatrix=mat4.identity();a.rdgeCtxHandle=contextManager.addObject(g); |
245 | g;var h;if(b)h=b;else{var l=a.getAttribute("rdgerun");if(l){if(!isValidObj(l))return;try{h=new (eval(l))}catch(n){window.console.error('The provided RDGE state object "'+l+'" is not defined')}}else h={},validateUserState(h)}l=a.getAttribute("rdgescene");f.RDGEInitState=new LoadState(h,g);f.RDGERunState=new RunState(h,g);validateUserState(h);l?(f.RDGEInitState.sceneName=l,f.PushState(f.RDGERunState,"noInit"),g.startUpState=f.RDGEInitState):g.startUpState=f.RDGERunState;this.initializeComplete&&g.ctxStateManager.PushState(g.startUpState)}}; | 246 | contextManager.currentCtx=g;var h;if(b)h=b;else{var l=a.getAttribute("rdgerun");if(l){if(!isValidObj(l))return;try{h=new (eval(l))}catch(n){window.console.error('The provided RDGE state object "'+l+'" is not defined')}}else h={},validateUserState(h)}l=a.getAttribute("rdgescene");f.RDGEInitState=new LoadState(h,g);f.RDGERunState=new RunState(h,g);validateUserState(h);l?(f.RDGEInitState.sceneName=l,f.PushState(f.RDGERunState,"noInit"),g.startUpState=f.RDGEInitState):g.startUpState=f.RDGERunState;this.initializeComplete&& |
246 | Engine.prototype.unregisterCanvas=function(a){stat.closePage(a.id+"_fps");contextManager.removeObject(a.rdgeCtxHandle)};Engine.prototype.getCanvas=function(a){return this.canvasToRendererMap[a]};nodeIdGen={counter:0};nodeIdGen.getId=function(){return"gen_"+nodeIdGen.counter++};function createTransformNode(a){node={name:a};node.transformNodeTemplate=new transformNodeTemplate(node);return node}function createMaterialNode(a){node={name:a};node.materialNodeTemplate=new materialNodeTemplate(node);return node} | 247 | g.ctxStateManager.PushState(g.startUpState)}};Engine.prototype.unregisterCanvas=function(a){stat.closePage(a.rdgeid+"_fps");contextManager.removeObject(a.rdgeCtxHandle)};Engine.prototype.getCanvas=function(a){return this.canvasToRendererMap[a]};nodeIdGen={counter:0};nodeIdGen.getId=function(){return"gen_"+nodeIdGen.counter++};function createTransformNode(a){node={name:a};node.transformNodeTemplate=new transformNodeTemplate(node);return node}function createMaterialNode(a){node={name:a};node.materialNodeTemplate=new materialNodeTemplate(node);return node} |
247 | function createMeshNode(a,b){meshNode={mesh:{},meshNodeTemplate:{}};var f=g_Engine.getContext().renderer;b.built||f.createPrimitive(b);var g=g_meshMan.getModelByName(a);if(g)f.buffers[g.primitive.buffersID]||f.createPrimitive(g.primitive);else return meshNode.mesh.meshNodeTemplate=new meshNodeTemplate(meshNode.mesh,b,a),g_meshMan.modelMap[a]=meshNode.mesh,meshNode;meshNode.mesh.meshNodeTemplate=new meshNodeTemplate(meshNode.mesh,g.primitive,a);return meshNode} | 248 | function createMeshNode(a,b){meshNode={mesh:{},meshNodeTemplate:{}};var f=g_Engine.getContext().renderer;b.built||f.createPrimitive(b);var g=g_meshMan.getModelByName(a);if(g)f.buffers[g.primitive.buffersID]||f.createPrimitive(g.primitive);else return meshNode.mesh.meshNodeTemplate=new meshNodeTemplate(meshNode.mesh,b,a),g_meshMan.modelMap[a]=meshNode.mesh,meshNode;meshNode.mesh.meshNodeTemplate=new meshNodeTemplate(meshNode.mesh,g.primitive,a);return meshNode} |
248 | function createLightNode(a){node={name:a};node.lightNodeTemplate=new lightNodeTemplate(node);return node}function createScreenQuadNode(){var a=createTransformNode();a.attachMeshNode("screenQuad",createScreenAlignedQuad());return a}function verifyTransformNode(a){if(a.transformNodeTemplate==void 0)a.transformNodeTemplate=new transformNodeTemplate(a)}function verifyMaterialNode(a){if(a.materialNodeTemplate==void 0)a.materialNodeTemplate=new materialNodeTemplate(a)} | 249 | function createLightNode(a){node={name:a};node.lightNodeTemplate=new lightNodeTemplate(node);return node}function createScreenQuadNode(){var a=createTransformNode();a.attachMeshNode("screenQuad",createScreenAlignedQuad());return a}function verifyTransformNode(a){if(a.transformNodeTemplate==void 0)a.transformNodeTemplate=new transformNodeTemplate(a)}function verifyMaterialNode(a){if(a.materialNodeTemplate==void 0)a.materialNodeTemplate=new materialNodeTemplate(a)} |
249 | function verifyLightNode(a){if(a.lightNodeTemplate==void 0)a.lightNodeTemplate=new lightNodeTemplate(a)} | 250 | function verifyLightNode(a){if(a.lightNodeTemplate==void 0)a.lightNodeTemplate=new lightNodeTemplate(a)} |
@@ -365,7 +366,7 @@ sceneRequestDef=function(a,b){this.name=b;this.addr=a;this.requestComplete=this. | |||
365 | function validateUserState(a){if(!a.init)a.init=function(){};if(!a.update)a.update=function(a){var f=g_Engine.getContext().currentScene,f=g_Engine.getScene(f);f!=null&&f.update(a)};if(!a.draw)a.draw=function(){var a=g_Engine.getContext().currentScene,a=g_Engine.getScene(a);a!=null&&a.render()};if(!a.resize)a.resize=function(){};if(!a.shutdown)a.shutdown=function(){};if(!a.onComplete)a.onComplete=function(){}} | 366 | function validateUserState(a){if(!a.init)a.init=function(){};if(!a.update)a.update=function(a){var f=g_Engine.getContext().currentScene,f=g_Engine.getScene(f);f!=null&&f.update(a)};if(!a.draw)a.draw=function(){var a=g_Engine.getContext().currentScene,a=g_Engine.getScene(a);a!=null&&a.render()};if(!a.resize)a.resize=function(){};if(!a.shutdown)a.shutdown=function(){};if(!a.onComplete)a.onComplete=function(){}} |
366 | function RDGEStart(a){var b=a;typeof a==="string"&&(b=document.getElementById(a));if(b)g_Engine.registerCanvas(b),b.task=new RDGETask(b,!0),g_shaderMan||(g_shaderMan=new ShaderManager),g_meshMan||(g_meshMan=new MeshManager),g_Engine.initializeComplete||g_Engine.init()}function RDGEStop(){RDGEShutdown!=void 0&&RDGEShutdown()}function IRuntime(){this.Shutdown=this.Draw=this.Update=this.Resize=this.ReInit=this.init=null}g_poolList=[]; | 367 | function RDGEStart(a){var b=a;typeof a==="string"&&(b=document.getElementById(a));if(b)g_Engine.registerCanvas(b),b.task=new RDGETask(b,!0),g_shaderMan||(g_shaderMan=new ShaderManager),g_meshMan||(g_meshMan=new MeshManager),g_Engine.initializeComplete||g_Engine.init()}function RDGEStop(){RDGEShutdown!=void 0&&RDGEShutdown()}function IRuntime(){this.Shutdown=this.Draw=this.Update=this.Resize=this.ReInit=this.init=null}g_poolList=[]; |
367 | function ConnPoll(){for(var a=g_poolList.length,b=0;b<a;++b)g_poolList[b].Poll()}RDGERequestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}(); | 368 | function ConnPoll(){for(var a=g_poolList.length,b=0;b<a;++b)g_poolList[b].Poll()}RDGERequestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){window.setTimeout(a,1E3/60)}}(); |
368 | RDGETask=function(){var a={};return function(b,f){this.id=b.id;this.lastTime=this.currTime=0;this.running=!1;this.context=null;if(b){this.context=g_Engine.ctxMan.handleToObject(b.rdgeCtxHandle);a[this.id]=function(){if(g.running)g.currTime=(new Date).getTime(),g.step((g.currTime-g.lastTime)/1E3),RDGERequestAnimationFrame(a[g.id],b),g.lastTime=g.currTime};this.start=function(){this.running=!0;this.lastTime=this.currTime=(new Date).getTime();a[this.id]()};this.stop=function(){this.running=!1};this.kill= | 369 | RDGETask=function(){var a={};return function(b,f){this.id=b.rdgeid;this.lastTime=this.currTime=0;this.running=!1;this.context=null;if(b){this.context=g_Engine.ctxMan.handleToObject(b.rdgeCtxHandle);a[this.id]=function(){if(g.running)g.currTime=(new Date).getTime(),g.step((g.currTime-g.lastTime)/1E3),RDGERequestAnimationFrame(a[g.id],b),g.lastTime=g.currTime};this.start=function(){this.running=!0;this.lastTime=this.currTime=(new Date).getTime();a[this.id]()};this.stop=function(){this.running=!1};this.kill= |
369 | function(){this.running=!1;a[this.id]=null};this.step=function(a){contextManager.currentCtx=this.context;this.context.fpsTracker.sample();this.context.ctxStateManager.tick(a)};var g=this;f&&g.start()}}}();var g_dbgPanel=null; | 370 | function(){this.running=!1;a[this.id]=null};this.step=function(a){contextManager.currentCtx=this.context;this.context.fpsTracker.sample();this.context.ctxStateManager.tick(a)};var g=this;f&&g.start()}}}();var g_dbgPanel=null; |
370 | function utilDbgPanel(a,b){this.id=a;this.root="#"+a;this.accordion=this.root+" .dbgpanel-accordion";this.categories={};this.counter=0;$(this.root).addClass("dbgpanel-outer ui-widget-content");$(this.root).draggable({handle:this.root,containment:"body"});$(this.root).resizable({minWidth:$(this.root).width(),minHeight:$(this.root).height()});$(this.root).append('<h3 class="dbgpanel-title">'+b+"</h3>");$(this.root).append('<div class="dbgpanel-accordion" />');$(this.accordion).accordion({clearStyle:!0})} | 371 | function utilDbgPanel(a,b){this.id=a;this.root="#"+a;this.accordion=this.root+" .dbgpanel-accordion";this.categories={};this.counter=0;$(this.root).addClass("dbgpanel-outer ui-widget-content");$(this.root).draggable({handle:this.root,containment:"body"});$(this.root).resizable({minWidth:$(this.root).width(),minHeight:$(this.root).height()});$(this.root).append('<h3 class="dbgpanel-title">'+b+"</h3>");$(this.root).append('<div class="dbgpanel-accordion" />');$(this.accordion).accordion({clearStyle:!0})} |
371 | utilDbgPanel.prototype.appendLabel=function(a,b){var f=this.getCategorySelector(a);$(f).append('<p class="dbgpanel-label">'+b+"</p>")}; | 372 | utilD |