From ab4b753907bc80a969b0d4104d0b0731597e3bf0 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Wed, 8 Feb 2012 14:46:35 -0800 Subject: Removed unused rdge files from the compiler. switched the preloader to use the compiled version of rdge Updated the rdge binary. --- js/helper-classes/RDGE/Materials/UberMaterial.js | 12 ++--- js/helper-classes/RDGE/rdge-compiled.js | 57 +++++++++------------- .../RDGE/src/tools/compile-rdge-core.bat | 2 +- js/helper-classes/RDGE/src/tools/rdge-compiled.js | 49 ++++++++----------- js/preloader/Preloader.js | 6 +-- 5 files changed, 53 insertions(+), 73 deletions(-) diff --git a/js/helper-classes/RDGE/Materials/UberMaterial.js b/js/helper-classes/RDGE/Materials/UberMaterial.js index afb745d1..aa4c3d1c 100644 --- a/js/helper-classes/RDGE/Materials/UberMaterial.js +++ b/js/helper-classes/RDGE/Materials/UberMaterial.js @@ -151,10 +151,10 @@ function UberMaterial() { // ubershader material properties. 'material' : { - 'ambientColor' : this._ambientColor, // material ambient color - 'diffuseColor' : this._diffuseColor, // material diffuse color - 'specularColor' : this._specularColor, // material specular color - 'specularPower' : this._specularPower, // material specular power (shininess) + 'ambientColor' : this._ambientColor, // material ambient color + 'diffuseColor' : this._diffuseColor, // material diffuse color + 'specularColor' : this._specularColor, // material specular color + 'specularPower' : this._specularPower // material specular power (shininess) }, // ubershader supports up to four lights. @@ -162,7 +162,7 @@ function UberMaterial() 'light0' : this._lights[0], 'light1' : this._lights[1], 'light2' : this._lights[2], - 'light3' : this._lights[3], + 'light3' : this._lights[3] }, // uvTransform can be used to scale or offset the texture coordinates. @@ -178,7 +178,7 @@ function UberMaterial() 'specularMap' : this._specularMapOb, // optional environment map - 'environmentMap' : this._environmentMapOb, + 'environmentMap' : this._environmentMapOb }; this.updateAmbientColor = function() diff --git a/js/helper-classes/RDGE/rdge-compiled.js b/js/helper-classes/RDGE/rdge-compiled.js index e55516db..4301200f 100644 --- a/js/helper-classes/RDGE/rdge-compiled.js +++ b/js/helper-classes/RDGE/rdge-compiled.js @@ -1,10 +1,4 @@ -/* -This file contains proprietary software owned by Motorola Mobility, Inc.
-No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
-(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. -
*/ -vec2 = { string: function (a) { return "{ " + a[0] + ", " + a[1] + " }" }, verify: function (a) { return a == void 0 || a.length == void 0 || a.length < 2 ? !1 : typeof a[0] != "number" || typeof a[1] != "number" ? !1 : !0 }, copy: function (a) { return a.length == void 0 ? [a, a] : [a[0], a[1]] }, inplace_copy: function (a, b) { a[0] = b[0]; a[1] = b[1] }, zero: function () { return [0, 0] }, up: function () { return [0, 1] }, right: function () { return [1, 0] }, add: function (a, b) { return [a[0] + b[0], a[1] + b[1]] }, sub: function (a, b) { return [a[0] - b[0], a[1] - b[1]] }, mul: function (a, b) { - return [a[0] * b[0], +vec2={string:function(a){return"{ "+a[0]+", "+a[1]+" }"},verify:function(a){return a==void 0||a.length==void 0||a.length<2?!1:typeof a[0]!="number"||typeof a[1]!="number"?!1:!0},copy:function(a){return a.length==void 0?[a,a]:[a[0],a[1]]},inplace_copy:function(a,b){a[0]=b[0];a[1]=b[1]},zero:function(){return[0,0]},up:function(){return[0,1]},right:function(){return[1,0]},add:function(a,b){return[a[0]+b[0],a[1]+b[1]]},sub:function(a,b){return[a[0]-b[0],a[1]-b[1]]},mul:function(a,b){return[a[0]*b[0], a[1]*b[1]]},addMul:function(a,b,f){return f.length!=void 0&&f.length>=2?[a[0]+b[0]*f[0],a[1]+b[1]*f[1]]:[a[0]+b[0]*f,a[1]+b[1]*f]},scale:function(a,b){return b.length!=void 0&&b.length>=2?[a[0]*b[0],a[1]*b[1]]:[a[0]*b,a[1]*b]},negate:function(a){return[-a[0],-a[1]]},normalize:function(a){var b=Math.sqrt(a[0]*a[0],a[1]*a[1]);return Math.abs(1-b)>1.0E-4?(b=1/b,[a[0]*b,a[1]*b]):a},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]},perp:function(a){return[a[1],-a[0]]},lengthSq:function(a){return a[0]*a[0]+ a[1]*a[1]},length:function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])},min:function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1])]},max:function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1])]}};vec2.clamp=function(a,b,f){return vec2.min(f,vec2.max(a,b))};vec3={string:function(a){return"{ "+a[0]+", "+a[1]+", "+a[2]+" }"},verify:function(a){return a==void 0||a.length==void 0||a.length<3?!1:typeof a[0]!="number"||typeof a[1]!="number"||typeof a[2]!="number"?!1:!0},inplace_copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2]},copy:function(a){return a.length==void 0?[a,a,a]:[a[0],a[1],a[2]]},translation:function(a){return[a[12],a[13],a[14]]},basisX:function(a){return[a[0],a[1],a[2]]},basisY:function(a){return[a[4],a[5],a[6]]},basisZ:function(a){return[a[8], a[9],a[10]]},zero:function(){return[0,0,0]},up:function(){return[0,1,0]},forward:function(){return[0,0,1]},right:function(){return[1,0,0]},random:function(a,b){return[a[0]+(b[0]-a[0])*Math.random(),a[1]+(b[1]-a[1])*Math.random(),a[2]+(b[2]-a[2])*Math.random()]},xy:function(a){return[a[0],a[1]]},xz:function(a){return[a[0],a[2]]},add:function(a,b){return[a[0]+b[0],a[1]+b[1],a[2]+b[2]]},plusEqual:function(a,b){a[0]+=b[0];a[1]+=b[1];a[2]+=b[2]},sub:function(a,b){return[a[0]-b[0],a[1]-b[1],a[2]-b[2]]}, @@ -61,14 +55,15 @@ this.ctx.clearColor(1,0,0,1);this.clearColor=[1,0,0,1];this.clearFlags=this.ctx. 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)}; 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(); 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, -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)}; -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, -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= -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, -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, -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", -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"}}]}}}; -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"}}]}}; +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= +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, +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: +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); +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&& +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, +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"}, +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"}}]}}}; +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"}}]}}; 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"}}, 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"}}]}}; 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}"}, @@ -123,12 +118,12 @@ jshader=function(a){this.name=a;this.def=null;this.technique={};this.params={};t "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]= "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'+b+"");$(this.root).append('
');$(this.accordion).accordion({clearStyle:!0})} utilDbgPanel.prototype.appendLabel=function(a,b){var f=this.getCategorySelector(a);$(f).append('

'+b+"

")}; @@ -387,20 +382,12 @@ g_shadowColor[2],0,1,0.0010,function(a){var b=g_Engine.getContext().getScene();g this.appendLabel("Bloom","256x256 mip weight");this.appendNumber("Bloom",g_bloomIntensity2,0,1.5,0.01,function(a){g_Engine.getContext().getScene().renderGraph.blurQuater.shader.gaussianBlur.u_weight.set([a])});this.appendLabel("Bloom","128x128 mip weight");this.appendNumber("Bloom",g_bloomIntensity3,0,1.5,0.01,function(a){g_Engine.getContext().getScene().renderGraph.blurThreeQuater.shader.gaussianBlur.u_weight.set([a])});this.appendBoolean("Ambient Occlusion",g_showSSAO,"Enable SSAO",function(a){var b= g_Engine.getContext().getScene();b.renderGraph.depth_map.visibility=!a?0:1;b=g_Engine.getContext().getScene();b.renderGraph.finalPass.shader.screenQuad.u_ssaoRT.set("assets/images/black");b.renderGraph.finalPass.textures[1].enabled=a});this.appendLabel("Ambient Occlusion","Sampling radius");this.appendNumber("Ambient Occlusion",g_sampleRadius,0,5,1.0E-4,function(a){g_Engine.getContext().getScene().renderGraph.SSAO.shader.ssao.u_artVals.data[0]=a});this.appendLabel("Ambient Occlusion","Intensity"); this.appendNumber("Ambient Occlusion",g_intensity,0,3,1.0E-4,function(a){g_Engine.getContext().getScene().renderGraph.SSAO.shader.ssao.u_artVals.data[1]=a});this.appendLabel("Ambient Occlusion","Distance scaling");this.appendNumber("Ambient Occlusion",g_distScale,0,2,1.0E-4,function(a){g_Engine.getContext().getScene().renderGraph.SSAO.shader.ssao.u_artVals.data[2]=a});this.appendLabel("Ambient Occlusion","Bias");this.appendNumber("Ambient Occlusion",g_bias,0,0.5,1.0E-4,function(a){g_Engine.getContext().getScene().renderGraph.SSAO.shader.ssao.u_artVals.data[3]= -a})};ubershader=function(a){var b=new XMLHttpRequest;b.open("GET","assets/shaders/ub_vshader.glsl",!1);b.send(null);if(b.status==200)vshader=b.responseText;b.open("GET","assets/shaders/ub_fshader.glsl",!1);b.send(null);if(b.status==200)fshader=b.responseText;var f="";typeof a.material!="undefined"&&(f+="#define MATERIAL\n");if(typeof a.lighting!="undefined"){f+="#define LIGHTING\n";f+="#define SPECULAR\n";for(i=0;i<4;++i){var b=a.lighting["light"+i],g;if(typeof b!="undefined"){switch(b.type){case "directional":g= -0;break;case "point":g=1;break;case "spot":g=2}f+="#define LIGHT_"+i+" "+g+"\n";f+="#define LIGHT_"+i+"_SPECULAR\n"}}}typeof a.diffuseMap!="undefined"&&(f+="#define DIFFUSE_MAP\n");typeof a.normalMap!="undefined"&&(f+="#define NORMAL_MAP\n");typeof a.specularMap!="undefined"&&(f+="#define SPECULAR_MAP\n");typeof a.environmentMap!="undefined"&&(f+="#define ENVIRONMENT_MAP\n");vshader=f+vshader;fshader=f+fshader;uberJShader=new jshader;uberJShader.def={shaders:{defaultVShader:vshader,defaultFShader:fshader}, -techniques:{defaultTechnique:[{vshader:"defaultVShader",fshader:"defaultFShader",attributes:{a_pos:{type:"vec3"},a_normal:{type:"vec3"},a_texcoord:{type:"vec2"}},params:{specularColor:"u_specularColor"},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"FRONT"}}]}};uberJShader.init();g=uberJShader.defaultTechnique;typeof a.material!="undefined"&&(g.u_ambientColor.set(a.material.ambientColor),g.u_diffuseColor.set(a.material.diffuseColor),g.u_specularColor&&g.u_specularColor.set(a.material.specularColor), -g.u_specularPower&&g.u_specularPower.set([a.material.specularPower]));if(typeof a.lighting!="undefined")for(i=0;i<4;++i)b=a.lighting["light"+i],typeof b!="undefined"&&(b.type=="directional"?(paramBlock["u_light"+i+"Dir"]={type:"vec3"},g["u_light"+i+"Dir"].set(b.direction||[0,0,1])):(b.type=="spot"?(paramBlock["u_light"+i+"Spot"]={type:"vec2"},g["u_light"+i+"Position"].set(b.position||[0,0,0]),f=Math.PI/180,g["u_light"+i+"Spot"].set([Math.cos((b.spotInnerCutoff||45)*f),Math.cos((b.spotOuterCutoff|| -90)*f)])):g["u_light"+i+"Position"].set(b.position||[0,0,0]),g["u_light"+i+"Atten"].set(b.attenuation||[1,0,0])),g["u_light"+i+"Color"].set(b.diffuseColor||[1,1,1,1]),g["u_light"+i+"Specular"].set(b.specularColor||[1,1,1,1]));g.u_uvMatrix&&g.u_uvMatrix.set(a.uvTransform||mat4.identity());renderer=g_Engine.getContext().renderer;g.s_diffuseMap&&typeof a.diffuseMap!="undefined"&&g.s_diffuseMap.set(renderer.getTextureByName(a.diffuseMap.texture,a.diffuseMap.wrap,a.diffuseMap.mips));g.s_normalMap&&typeof a.normalMap!= -"undefined"&&g.s_normalMap.set(renderer.getTextureByName(a.normalMap.texture,a.normalMap.wrap,a.normalMap.mips));g.s_specMap&&typeof a.specularMap!="undefined"&&g.s_specMap.set(renderer.getTextureByName(a.specularMap.texture,a.specularMap.wrap));g.s_envMap&&typeof a.environmentMap!="undefined"&&g.s_envMap.set(renderer.getTextureByName(a.environmentMap.texture,a.environmentMap.wrap));g.u_envReflection&&g.u_envReflection.set([a.environmentMap.envReflection||1]);return uberJShader}; -/* ////////////////////////////////////////////////////////////////////////////// - RDGE v1.5 - - Copyright (c) 2008-2011 Human Engines Incorporated. - All Rights Reserved. - Human Engines Proprietary - -////////////////////////////////////////////////////////////////////////////// */ +a})}; +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ /* * A list of shared parameters that all shaders can support (the engine always try to bind these uniforms) diff --git a/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat b/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat index f4a556a7..b2933fa9 100644 --- a/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat +++ b/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat @@ -1,4 +1,4 @@ -java -jar ./compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --manage_closure_dependencies --js ../core/script/math/vec2.js --js ../core/script/math/vec3.js --js ../core/script/math/vec4.js --js ../core/script/math/mat4.js --js ../core/script/math/quat.js --js ../core/script/util/statTracker.js --js ../core/script/util/fpsTracker.js --js ../core/script/objectManager.js --js ../core/script/precompiled.js --js ../core/script/renderer.js --js ../core/script/renderUtils.js --js ../core/script/jshader.js --js ../core/script/jpass.js --js ../core/script/RenderProcs.js --js ../core/script/RenderInitProcs.js --js ../core/script/MeshManager.js --js ../core/script/TextureManager.js --js ../core/script/ShaderManager.js --js ../core/script/fx/blur.js --js ../core/script/fx/ssao.js --js ../core/script/ScreenQuad.js --js ../core/script/box.js --js ../core/script/camera.js --js ../core/script/shadowLight.js --js ../core/script/utilities.js --js ../core/script/input.js --js ../core/script/engine.js --js ../core/script/scenegraphNodes.js --js ../core/script/scenegraph.js --js ../core/script/lightmanager.js --js ../core/script/rendercontext.js --js ../core/script/animation.js --js ../core/script/particle.js --js ../core/script/run_state.js --js ../core/script/init_state.js --js ../core/script/runtime.js --js ../core/script/util/dbgpanel.js --js ../core/script/ubershader.js --js_output_file rdge-compiled.js +java -jar ./compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --manage_closure_dependencies --js ../core/script/math/vec2.js --js ../core/script/math/vec3.js --js ../core/script/math/vec4.js --js ../core/script/math/mat4.js --js ../core/script/math/quat.js --js ../core/script/util/statTracker.js --js ../core/script/util/fpsTracker.js --js ../core/script/objectManager.js --js ../core/script/precompiled.js --js ../core/script/renderer.js --js ../core/script/renderUtils.js --js ../core/script/jshader.js --js ../core/script/jpass.js --js ../core/script/RenderProcs.js --js ../core/script/RenderInitProcs.js --js ../core/script/MeshManager.js --js ../core/script/TextureManager.js --js ../core/script/ShaderManager.js --js ../core/script/fx/blur.js --js ../core/script/fx/ssao.js --js ../core/script/ScreenQuad.js --js ../core/script/box.js --js ../core/script/camera.js --js ../core/script/shadowLight.js --js ../core/script/utilities.js --js ../core/script/input.js --js ../core/script/engine.js --js ../core/script/scenegraphNodes.js --js ../core/script/scenegraph.js --js ../core/script/lightmanager.js --js ../core/script/rendercontext.js --js ../core/script/animation.js --js ../core/script/particle.js --js ../core/script/run_state.js --js ../core/script/init_state.js --js ../core/script/runtime.js --js ../core/script/util/dbgpanel.js --js_output_file rdge-compiled.js cd ../core/script type precompiled.js >> ../../tools/rdge-compiled.js pause 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. 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)}; 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(); 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, -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)}; -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, -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= -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, -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, -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", -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"}}]}}}; -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"}}]}}; +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= +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, +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: +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); +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&& +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, +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"}, +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"}}]}}}; +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"}}]}}; 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"}}, 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"}}]}}; 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 "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]= "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