From 46defc9bd11bf077efd672c72787a3b67da1a178 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Mon, 12 Mar 2012 14:59:08 -0700 Subject: Uber material changes for IO --- js/helper-classes/RDGE/src/core/script/MeshManager.js | 2 +- js/helper-classes/RDGE/src/core/script/run_state.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'js/helper-classes') diff --git a/js/helper-classes/RDGE/src/core/script/MeshManager.js b/js/helper-classes/RDGE/src/core/script/MeshManager.js index 43813078..7dfc79d4 100755 --- a/js/helper-classes/RDGE/src/core/script/MeshManager.js +++ b/js/helper-classes/RDGE/src/core/script/MeshManager.js @@ -69,7 +69,7 @@ MeshManager.prototype.deleteMesh = function (name) if (model) { g_Engine.ctxMan.forEach(function(context) - { + { context.renderer.deletePrimitive(model.primitive); }); diff --git a/js/helper-classes/RDGE/src/core/script/run_state.js b/js/helper-classes/RDGE/src/core/script/run_state.js index acdb6797..a5981caa 100755 --- a/js/helper-classes/RDGE/src/core/script/run_state.js +++ b/js/helper-classes/RDGE/src/core/script/run_state.js @@ -30,9 +30,9 @@ RunState.prototype.Init = function() this.userRunState.init(); } - if (this.hasUserState && this.userRunState && this.userRunState.onRunState) - this.userRunState.onRunState(); - + if (this.hasUserState && this.userRunState && this.userRunState.onRunState) + this.userRunState.onRunState(); + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -97,11 +97,11 @@ RunState.prototype.ReInit = function() if(!this.initialized) { this.Init(); - } - else - { - if (this.hasUserState && this.userRunState && this.userRunState.onRunState) - this.userRunState.onRunState(); + } + else + { + if (this.hasUserState && this.userRunState && this.userRunState.onRunState) + this.userRunState.onRunState(); } } -- cgit v1.2.3 From 9b40878fcc82d3ec08361e30d2029de261f0f80e Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 13 Mar 2012 16:32:46 -0700 Subject: Fixed BumpMetal material --- js/helper-classes/3D/vec-utils.js | 71 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) (limited to 'js/helper-classes') diff --git a/js/helper-classes/3D/vec-utils.js b/js/helper-classes/3D/vec-utils.js index 3db95ab7..e6db4a8d 100755 --- a/js/helper-classes/3D/vec-utils.js +++ b/js/helper-classes/3D/vec-utils.js @@ -191,5 +191,74 @@ var VecUtils = exports.VecUtils = Object.create(Object.prototype, return vec; } - } + }, + + matI : + { + value: function(dimen) + { + var mat = []; + for (var i=0; i --- .../RDGE/src/tools/compile-rdge-core.bat | 4 - .../RDGE/src/tools/compile-rdge-core.sh | 3 - js/helper-classes/RDGE/src/tools/compiler.jar | Bin 4927265 -> 0 bytes js/helper-classes/RDGE/src/tools/rdge-compiled.js | 452 ------- js/helper-classes/backup-delete/GLAnchorPoint.js | 168 --- js/helper-classes/backup-delete/GLBrushStroke.js | 561 --------- js/helper-classes/backup-delete/GLCircle.js | 711 ----------- js/helper-classes/backup-delete/GLGeomObj.js | 324 ----- js/helper-classes/backup-delete/GLLight.js | 30 - js/helper-classes/backup-delete/GLLine.js | 507 -------- js/helper-classes/backup-delete/GLMaterial.js | 308 ----- js/helper-classes/backup-delete/GLPath.js | 232 ---- js/helper-classes/backup-delete/GLRectangle.js | 1238 ------------------- js/helper-classes/backup-delete/GLSubpath.js | 1286 -------------------- js/helper-classes/backup-delete/GLWorld.js | 1029 ---------------- .../backup-delete/Materials/BumpMetalMaterial.js | 307 ----- .../backup-delete/Materials/DeformMaterial.js | 133 -- .../backup-delete/Materials/FlatMaterial.js | 165 --- .../backup-delete/Materials/FlyMaterial.js | 133 -- .../backup-delete/Materials/JuliaMaterial.js | 150 --- .../Materials/KeleidoscopeMaterial.js | 149 --- .../Materials/LinearGradientMaterial.js | 379 ------ .../backup-delete/Materials/MandelMaterial.js | 151 --- .../backup-delete/Materials/PlasmaMaterial.js | 134 -- .../backup-delete/Materials/PulseMaterial.js | 266 ---- .../backup-delete/Materials/RadialBlurMaterial.js | 257 ---- .../Materials/RadialGradientMaterial.js | 305 ----- .../Materials/ReliefTunnelMaterial.js | 133 -- .../Materials/SquareTunnelMaterial.js | 133 -- .../backup-delete/Materials/StarMaterial.js | 133 -- .../backup-delete/Materials/TaperMaterial.js | 223 ---- .../backup-delete/Materials/TunnelMaterial.js | 133 -- .../backup-delete/Materials/TwistMaterial.js | 149 --- .../backup-delete/Materials/TwistVertMaterial.js | 248 ---- .../backup-delete/Materials/UberMaterial.js | 744 ----------- .../backup-delete/Materials/WaterMaterial.js | 133 -- .../backup-delete/Materials/ZInvertMaterial.js | 133 -- .../backup-delete/MaterialsLibrary.js | 230 ---- js/helper-classes/backup-delete/ParseUtils.js | 84 -- js/helper-classes/backup-delete/glUtils.js | 319 ----- 40 files changed, 12177 deletions(-) delete mode 100644 js/helper-classes/RDGE/src/tools/compile-rdge-core.bat delete mode 100644 js/helper-classes/RDGE/src/tools/compile-rdge-core.sh delete mode 100644 js/helper-classes/RDGE/src/tools/compiler.jar delete mode 100644 js/helper-classes/RDGE/src/tools/rdge-compiled.js delete mode 100755 js/helper-classes/backup-delete/GLAnchorPoint.js delete mode 100755 js/helper-classes/backup-delete/GLBrushStroke.js delete mode 100755 js/helper-classes/backup-delete/GLCircle.js delete mode 100755 js/helper-classes/backup-delete/GLGeomObj.js delete mode 100755 js/helper-classes/backup-delete/GLLight.js delete mode 100755 js/helper-classes/backup-delete/GLLine.js delete mode 100755 js/helper-classes/backup-delete/GLMaterial.js delete mode 100755 js/helper-classes/backup-delete/GLPath.js delete mode 100755 js/helper-classes/backup-delete/GLRectangle.js delete mode 100755 js/helper-classes/backup-delete/GLSubpath.js delete mode 100755 js/helper-classes/backup-delete/GLWorld.js delete mode 100755 js/helper-classes/backup-delete/Materials/BumpMetalMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/DeformMaterial.js delete mode 100755 js/helper-classes/backup-delete/Materials/FlatMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/FlyMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/JuliaMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/KeleidoscopeMaterial.js delete mode 100755 js/helper-classes/backup-delete/Materials/LinearGradientMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/MandelMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/PlasmaMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/PulseMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/RadialBlurMaterial.js delete mode 100755 js/helper-classes/backup-delete/Materials/RadialGradientMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/ReliefTunnelMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/SquareTunnelMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/StarMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/TaperMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/TunnelMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/TwistMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/TwistVertMaterial.js delete mode 100755 js/helper-classes/backup-delete/Materials/UberMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/WaterMaterial.js delete mode 100644 js/helper-classes/backup-delete/Materials/ZInvertMaterial.js delete mode 100755 js/helper-classes/backup-delete/MaterialsLibrary.js delete mode 100755 js/helper-classes/backup-delete/ParseUtils.js delete mode 100755 js/helper-classes/backup-delete/glUtils.js (limited to 'js/helper-classes') diff --git a/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat b/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat deleted file mode 100644 index b2933fa9..00000000 --- a/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat +++ /dev/null @@ -1,4 +0,0 @@ -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/compile-rdge-core.sh b/js/helper-classes/RDGE/src/tools/compile-rdge-core.sh deleted file mode 100644 index 1a2c4676..00000000 --- a/js/helper-classes/RDGE/src/tools/compile-rdge-core.sh +++ /dev/null @@ -1,3 +0,0 @@ -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 - -cat ../core/script/precompiled.js >> ./rdge-compiled.js diff --git a/js/helper-classes/RDGE/src/tools/compiler.jar b/js/helper-classes/RDGE/src/tools/compiler.jar deleted file mode 100644 index f361e9cd..00000000 Binary files a/js/helper-classes/RDGE/src/tools/compiler.jar and /dev/null differ diff --git a/js/helper-classes/RDGE/src/tools/rdge-compiled.js b/js/helper-classes/RDGE/src/tools/rdge-compiled.js deleted file mode 100644 index d1040d73..00000000 --- a/js/helper-classes/RDGE/src/tools/rdge-compiled.js +++ /dev/null @@ -1,452 +0,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]]}, -mul:function(a,b){return[a[0]*b[0],a[1]*b[1],a[2]*b[2]]},addMul:function(a,b,f){return f.length!=void 0&&f.length>=3?[a[0]+b[0]*f[0],a[1]+b[1]*f[1],a[2]+b[2]*f[2]]:[a[0]+b[0]*f,a[1]+b[1]*f,a[2]+b[2]*f]},plusEqualMul:function(a,b,f){f.length!==void 0&&f.length>=3?(a[0]+=b[0]*f[0],a[1]+=b[1]*f[1],a[2]+=b[2]*f[2]):(a[0]+=b[0]*f,a[1]+=b[1]*f,a[2]+=b[2]*f)},scale:function(a,b){return b.length!==void 0&&b.length>=3?[a[0]*b[0],a[1]*b[1],a[2]*b[2]]:[a[0]*b,a[1]*b,a[2]*b]},inplace_scale:function(a,b){b.length!== -void 0&&b.length>=3?(a[0]*=b[0],a[1]*=b[1],a[2]*=b[2]):(a[0]*=b,a[1]*=b,a[2]*=b)},negate:function(a){return[-a[0],-a[1],-a[2]]},inplace_negate:function(a){a[0]=-a[0];a[1]=-a[1];a[2]=-a[2]},normalize:function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return Math.abs(1-b)>1.0E-4?(b=1/b,[a[0]*b,a[1]*b,a[2]*b]):a},cross:function(a,b){return[a[1]*b[2]-b[1]*a[2],a[2]*b[0]-b[2]*a[0],a[0]*b[1]-b[0]*a[1]]},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]},lengthSq:function(a){return a[0]*a[0]+ -a[1]*a[1]+a[2]*a[2]},length:function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2])},distanceSq:function(a,b){var f=[a[0]-b[0],a[1]-b[1],a[2]-b[2]];return f[0]*f[0]+f[1]*f[1]+f[2]*f[2]},distance:function(a,b){var f=[a[0]-b[0],a[1]-b[1],a[2]-b[2]];return Math.sqrt(f[0]*f[0]+f[1]*f[1]+f[2]*f[2])}};vec3.angle=function(a,b){return Math.acos(vec3.dot(a,b))/(vec3.length(a)*vec3.length(b))};vec3.direction=function(a,b){return vec3.normalize(vec3.sub(b,a))}; -vec3.abs=function(a){return[Math.abs(a[0]),Math.abs(a[1]),Math.abs(a[2])]};vec3.min=function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1]),Math.min(a[2],b[2])]};vec3.max=function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1]),Math.max(a[2],b[2])]};vec3.clamp=function(a,b,f){return vec3.min(f,vec3.max(a,b))};vec3.equal=function(a,b,f){f||(f=0.0010);return vec3.distanceSq(a,b)=4?[a[0]+b[0]* -f[0],a[1]+b[1]*f[1],a[2]+b[2]*f[2],a[3]+b[3]*f[3]]:[a[0]+b[0]*f,a[1]+b[1]*f,a[2]+b[2]*f,a[3]+b[3]*f]},scale:function(a,b){return b.length!=void 0&&b.length>=4?[a[0]*b[0],a[1]*b[1],a[2]*b[2],a[3]*b[3]]:[a[0]*b,a[1]*b,a[2]*b,a[3]*b]},negate:function(a){return[-a[0],-a[1],-a[2],-a[3]]},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]},normalize:function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]);return Math.abs(1-b)>1.0E-4?(b=1/b,[a[0]*b,a[1]*b,a[2]*b,a[3]*b]):a},lengthSq:function(a){return a[0]* -a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]},length:function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3])},abs:function(a){return[Math.abs(a[0]),Math.abs(a[1]),Math.abs(a[2]),Math.abs(a[3])]},min:function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1]),Math.min(a[2],b[2]),Math.min(a[3],b[3])]},max:function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1]),Math.max(a[2],b[2]),Math.min(a[3],b[3])]}};vec4.clamp=function(a,b,f){return vec4.min(f,vec4.max(a,b))}; -vec4.equal=function(a,b,f){f||(f=0.0010);return vec4.distanceSq(a,b)=4?b[3]:1;return[a[0]*f+a[4]*g+a[8]*h+a[12]*l,a[1]*f+a[5]*g+a[9]*h+a[13]*l,a[2]*f+a[6]*g+a[10]*h+a[14]*l,a[3]*f+a[7]*g+a[11]*h+a[15]*l]};mat4.transformVector=function(a,b){var a=mat4.inverse(a),f=b[0],g=b[1],h=b[2],l=b.length>=4?b[3]:0;return[a[0]*f+a[1]*g+a[2]*h+a[3]*l,a[4]*f+a[5]*g+a[6]*h+a[7]*l,a[8]*f+a[9]*g+a[10]*h+a[11]*l,a[12]*f+a[13]*g+a[14]*h+a[15]*l]}; -mat4.transformPoint4x3=function(a,b){var f=b[0],g=b[1],h=b[2];return[a[0]*f+a[4]*g+a[8]*h+a[12],a[1]*f+a[5]*g+a[9]*h+a[13],a[2]*f+a[6]*g+a[10]*h+a[14],1]};mat4.transformVector4x3=function(a,b){var a=mat4.inverse(a),f=b[0],g=b[1],h=b[2];return[a[0]*f+a[1]*g+a[2]*h,a[4]*f+a[5]*g+a[6]*h,a[8]*f+a[9]*g+a[10]*h,0]};mat4.getRow=function(a,b){b*=4;return[a[b],a[b+1],a[b+2],a[b+3]]};mat4.getCol=function(a,b){return[a[b],a[b+4],a[b+8],a[b+12]]}; -mat4.setRow=function(a,b,f){b*=4;a[b+0]=f[0];a[b+1]=f[1];a[b+2]=f[2];f.length>=4&&(a[b+3]=f[3]);return a};mat4.setCol=function(a,b,f){a[b+0]=f[0];a[b+4]=f[1];a[b+8]=f[2];f.length>=4&&(a[b+12]=f[3]);return a};mat4.rotate=function(a,b,f){return mat4.mul(a,mat4.angleAxis(b,f))};mat4.rotateX=function(a,b){return mat4.mul(a,mat4.angleAxis(b,vec3.basisX(a)))};mat4.rotateY=function(a,b){return mat4.mul(a,mat4.angleAxis(b,vec3.basisY(a)))};mat4.rotateZ=function(a,b){return mat4.mul(a,mat4.angleAxis(b,vec3.basisZ(a)))}; -mat4.scale=function(a,b){var f=mat4.identity();b.length==void 0&&(b=[b,b,b]);f[0]=b[0];f[5]=b[1];f[10]=b[2];return mat4.mul(a,f)};mat4.scaleX=function(a,b){return mat4.scale(a,[b,1,1])};mat4.scaleY=function(a,b){return mat4.scale(a,[1,b,1])};mat4.scaleZ=function(a,b){return mat4.scale(a,[1,1,b])};mat4.translate=function(a,b){matT=mat4.identity();matT[12]=b[0];matT[13]=b[1];matT[14]=b[2];return mat4.mul(a,matT)};mat4.translateX=function(a,b){return mat4.translate(a,[b,0,0])}; -mat4.translateY=function(a,b){return mat4.translate(a,[0,b,0])};mat4.translateZ=function(a,b){return mat4.translate(a,[0,0,b])};quat={string:function(a){return"{ "+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+" }"},verify:function(a){return a==void 0||a.length==void 0||a.length<4?!1:typeof a[0]!="number"||typeof a[1]!="number"||typeof a[2]!="number"||typeof a[3]!="number"?!1:!0},identity:function(){return[0,0,0,1]},add:function(a,b){return[a[0]+b[0],a[1]+b[1],a[2]+b[2],a[3]+b[3]]},sub:function(a,b){return[a[0]-b[0],a[1]-b[1],a[2]-b[2],a[3]-b[3]]},mul:function(a,b){return[a[3]*b[3]-a[0]*b[0]-a[1]*b[1]-a[2]*b[2],a[3]*b[0]+a[0]*b[3]+a[1]* -b[2]-a[2]*b[1],a[3]*b[1]-a[0]*b[2]+a[1]*b[3]+a[2]*b[0],a[3]*b[2]+a[0]*b[1]-a[1]*b[0]+a[2]*b[3]]},addMul:function(a,b,f){return f.length!=void 0&&f.length>=4?[a[0]+b[0]*f[0],a[1]+b[1]*f[1],a[2]+b[2]*f[2],a[3]+b[3]*f[3]]:[a[0]+b[0]*f,a[1]+b[1]*f,a[2]+b[2]*f,a[3]+b[3]*f]},scale:function(a,b){return b.length!=void 0&&b.length>=4?[a[0]*b[0],a[1]*a[1],a[2]*b[2],a[3]*b[3]]:[a[0]*b,a[1]*b,a[2]*b,a[3]*b]},lengthSq:function(a){return a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]},length:function(a){return Math.sqrt(a[0]* -a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3])},normalize:function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]);return Math.abs(1-b)>1.0E-4?(b=1/b,[a[0]*b,a[1]*b,a[2]*b,a[3]*b]):a},inverse:function(a){var b=vec4.lengthSq(a);return b>1.0E-5?(b=1/b,[a[0]*-b,a[1]*-b,a[2]*-b,a[3]]):a},dot:function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]}};quat.applyRotation=function(a,b){return mat4.transformPoint(quat.toMatrix(a),b)}; -quat.lerp=function(a,b,f){return quat.normalize([a[0]+(b[0]-a[0])*f,a[1]+(b[1]-a[1])*f,a[2]+(b[2]-a[2])*f,a[3]+(b[3]-a[3])*f])};quat.slerp=function(a,b,f){var g=quat.dot(a,b);if(g>=0.9)return quat.lerp(a,b,f);var h=Math.sqrt(Math.abs(1-g*g));if(h<0.0010)return a;var g=g<0?-1:1,l=Math.asin(h),n=1/h,h=Math.sin((1-f)*l)*n,f=Math.sin(f*l)*n*g;quat.scale(a,h);quat.scale(b,f);return quat.normalize(quat.add(a,b))}; -quat.toMatrix=function(a){var b=2*a[0],f=2*a[1],g=2*a[2],h=b*a[3],l=f*a[3],n=g*a[3];b*=a[0];var o=f*a[0],p=g*a[0];f*=a[1];var q=g*a[1],a=g*a[2];return[1-(f+a),o+n,p-l,0,o-n,1-(b+a),q+h,0,p+l,q-h,1-(b+f),0,0,0,0,1]};var stat=function(){pages={};dlgId="";self=function(a,b,f,g,h){h==void 0&&(h=!0);category=!a?"default":a;pages[category]||(pages[category]=[]);pages[category].push(this);this.name=b;this.value=this.defValue=f;this.func=g;this.reset=h;this.reportInterval=500;stat.dirty=!0;stat.find=function(a,b){var f=pages[a];for(i=0;i'+a+"");g+="";for(a in pages)pages[a]&&(g+='
',g+="
");g+="";f.innerHTML=g;$("#stat_tabs").tabs();stat.dirty=!1}for(a in pages)f=document.getElementById(a),stat.report(f,a,b)};stat.report=function(a,b){b||(b="default");var f=pages[b];if(f){outputHTML='';var g=0;for(i=0;i', -outputHTML+=f[i].func?f[i].name+" : "+f[i].func(f[i].value):f[i].name+" : "+f[i].value,outputHTML+="",g++>=3&&(outputHTML+="",g=0),f[i].reset)f[i].value=f[i].defValue;outputHTML+="
";a.innerHTML=outputHTML}}};setInterval(function(){self.reportAll("RDGE_STATS")},500);return self}(); -dbCanvas=function(a,b){this.front=document.createElement("canvas");this.front.setAttribute("width",a);this.front.setAttribute("height",b);this.front.setAttribute("style","position:absolute; margin: 0.0em; padding: 0.0em;");this.front.ctx=this.front.getContext("2d");this.back=document.createElement("canvas");this.back.setAttribute("width",a);this.back.setAttribute("height",b);this.front.setAttribute("style","position:absolute; margin: 0.0em; padding: 0.0em;");this.back.ctx=this.back.getContext("2d"); -this.swap=function(){var a=this.front;this.front=this.back;this.back=a;this.front.style.visibility="visible";this.back.style.visibility="hidden"}};function getCanvasDimensions(a){var b={x:0,y:0};b.width=a.width;b.height=a.height;if(a.offsetParent){do b.x+=a.offsetLeft,b.y+=a.offsetTop;while(a=a.offsetParent)}return b} -graph2D=function(a,b,f,g,h,l,n){this.style=n||{bgcolor:"#000"};this.sampleRes=512;this.scale=1;this.rangeMin=h;this.rangeMax=l;this.offsetY=0;this.canvas=document.createElement("canvas");this.canvas.setAttribute("width",f);this.canvas.setAttribute("height",g-32);this.canvas.setAttribute("style","position:absolute; margin: 0.0em; padding: 0.0em;");o=this;this.onclick=function(a){for(var b=getCanvasDimensions(o.canvas),f=a.clientX-b.x,a=a.clientY-b.y,b=0;bg.x+g.w)&&!(a>g.y+g.h)&&!(athis.sampleRes&&b.samples.shift();b.samples.push(b.stat.value)}};this.draw=function(){var a=this.canvas,b=this.ctx,f=a.width,g=a.height,h=this.rangeMin*this.scale,l=1/(this.rangeMax*this.scale-h),n=16+Math.floor(this.tracked.length/4+0.5)* -16;b.fillStyle=this.style.bgcolor;b.strokeStyle=this.style.bgcolor;b.fillRect(0,0,f,g-n);for(a=0;athis.maxSamples&&this.samples.shift();this.timeStampMS= -a;for(var f=0,g=-1E10,a=1E10,h=this.samples.length-1;h>=0;)f+=this.samples[h],g=Math.max(g,this.samples[h]),a=Math.min(a,this.samples[h]),h--;f=this.samples.length>0?f/this.samples.length:0;f=f>0?1E3/f:0;g=g>0?1E3/g:0;a=a>0?1E3/a:0;h=this.samples[this.samples.length-1];this.fpsRaw.value=(h>0?1E3/h:0).toFixed(2);this.fpsAvg.value=f.toFixed(2);this.fpsMin.value=g.toFixed(2);this.fpsMax.value=a.toFixed(2)}};objectManager=function(){this.guidCounter=0;this.objects=[];this.numObjects=0;this.freelist=[];this.reset=function(){this.objects=[];this.freelist=[];this.guidCounter=0};this.validHandle=function(a){return this.handleToIndex(a)!=-1};this.handleToIndex=function(a){var b=a>>16&65535;return this.objects[b]!=null&&a==this.objects[b].handle?b:-1};this.handleToObject=function(a){a=this.handleToIndex(a);return a!=-1?this.objects[a]:null};this.addObject=function(a){var b=this.objects.length;this.freelist.length> -0&&(b=this.freelist.pop());if(++this.guidCounter>=65535)this.guidCounter=1;a.handle=b<<16|++this.guidCounter;this.objects[b]=a;return a.handle};this.removeObject=function(a){a=this.handleToIndex(a);if(a!=-1){if(this.objects[a].onremove!=void 0)this.objects[a].onremove();this.objects[a]=null;this.freelist.push(a)}}};rdgeGlobalParameters={u_projMatrix:{type:"mat4",data:mat4.identity()},u_mvMatrix:{type:"mat4",data:mat4.identity()},u_invMvMatrix:{type:"mat4",data:mat4.identity()},u_normalMatrix:{type:"mat4",data:mat4.identity()},u_worldMatrix:{type:"mat4",data:mat4.identity()},u_viewMatrix:{type:"mat4",data:mat4.identity()},u_invViewMatrix:{type:"mat4",data:mat4.identity()},u_invWorldMatrix:{type:"mat4",data:mat4.identity()},u_inv_viewport_width:{type:"float",data:[1]},u_inv_viewport_height:{type:"float",data:[1]}, -u_lightPos:{type:"vec3",data:[-20,50,20]},u_lightDiff:{type:"vec4",data:[0.8,0.8,0.8,1]},u_lightAmb:{type:"vec4",data:[1,1,1,1]},rdge_lights:{u_light0Pos:{type:"vec3",data:[-20,50,20]},u_light0Diff:{type:"vec4",data:[0.8,0.8,0.8,1]},u_light0Amb:{type:"vec4",data:[8.0E-4,8.0E-4,8.0E-4,1]},u_light0Spec:{type:"vec4",data:[1,1,1,1]},u_light1Pos:{type:"vec3",data:[0,0,0]},u_light1Diff:{type:"vec4",data:[0,0,0,0]},u_light1Amb:{type:"vec4",data:[0.5,0.5,0.5,1]},u_light1Spec:{type:"vec4",data:[1,1,1,1]}, -u_light2Pos:{type:"vec3",data:[0,0,0]},u_light2Diff:{type:"vec4",data:[0,0,0,1]},u_light2Amb:{type:"vec4",data:[0.5,0.5,0.5,1]},u_light2Spec:{type:"vec4",data:[1,1,1,1]},u_light3Pos:{type:"vec3",data:[0,0,0]},u_light3Diff:{type:"vec4",data:[0.8,0.8,0.8,1]},u_light3Amb:{type:"vec4",data:[0.5,0.5,0.5,1]},u_light3Spec:{type:"vec4",data:[1,1,1,1]}},colMap:{type:"tex2d",data:"assets/images/white.png"},u_matAmbient:{type:"vec4",data:[1,1,1,1]},u_matDiffuse:{type:"vec4",data:[1,1,1,1]},u_matSpecular:{type:"vec4", -data:[1,1,1,1]},u_matShininess:{type:"float",data:[128]},u_matEmission:{type:"float",data:[0,0,0,1]},u_frustumFarZ:{type:"float",data:[1E3]},u_shadowLightWorld:{type:"mat4",data:mat4.identity()},u_shadowBiasMatrix:{type:"mat4",data:mat4.identity()},u_vShadowLight:{type:"mat4",data:mat4.identity()},u_shadowBPV:{type:"mat4",data:mat4.identity()},u_farZ:{type:"float",data:[1E3]},u_shadowLightFarZ:{type:"float",data:[1E3]},u_cameraFTR:{type:"vec3",data:[0,0,0]}};g_renderStats={};g_renderStats.numDrawCalls=new stat("rendering","numDrawCalls",0,null,!1);g_renderStats.numTriangles=new stat("rendering","numTriangles",0,null,!1);g_renderStats.numVerts=new stat("rendering","numVerts",0,null,!1);g_renderStats.numPasses=new stat("rendering","numPasses",0,null,!1);g_renderStats.reset=function(){g_renderStats.numTriangles.value=0;g_renderStats.numDrawCalls.value=0;g_renderStats.numVerts.value=0;g_renderStats.numPasses.value=0}; -rdgeConstants={colorBuffer:16384,depthBuffer:256,stencilBuffer:1024,BUFFER_STATIC:0,BUFFER_DYNAMIC:1,BUFFER_STREAM:2,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,VS_ELEMENT_FLOAT4:4,VS_ELEMENT_POS:3,VS_ELEMENT_NORM:3,VS_ELEMENT_FLOAT3:3,VS_ELEMENT_FLOAT2:2,VS_ELEMENT_UV:2,VS_ELEMENT_FLOAT:1,MAX_ELEM_TYPES:7,BUFFER_STATIC:35040,BUFFER_DYNAMIC:35044,BUFFER_STREAM:35048, -MAX_MATERIAL_LIGHTS:4,categoryEnumeration:{BACKGROUND:0,OPAQUE:1,TRANSPARENT:2,ADDITIVE:3,TRANSLUCENT:4,FOREGROUND:5,MAX_CAT:6},nodeType:{TRNODE:0,MESHNODE:1,MATNODE:2,LIGHTNODE:3}};rdgeId=0;function getBufferID(){return rdgeId++} -_renderer=function(a){try{this.ctx=a.getContext("experimental-webgl",{preserveDrawingBuffer:!0});if(!this.ctx)this.ctx=a.getContext("webgl",{preserveDrawingBuffer:!0});if(!this.ctx)this.ctx=a.getContext("webkit-3d",{preserveDrawingBuffer:!0});if(!this.ctx)this.ctx=a.getContext("moz-webgl",{preserveDrawingBuffer:!0})}catch(b){}if(!this.ctx)return window.console.log("Could not create GL context"),null;this.ctx.viewport(0,0,a.width,a.height);this.console="console"in window?window.console:{log:function(){}}; -this.ctx.clearColor(1,0,0,1);this.clearColor=[1,0,0,1];this.clearFlags=this.ctx.COLOR_BUFFER_BIT|this.ctx.DEPTH_BUFFER_BIT;this.colorBuffer=this.ctx.COLOR_BUFFER_BIT;this.depthBuffer=this.ctx.DEPTH_BUFFER_BIT;this.stencilBuffer=this.ctx.STENCIL_BUFFER_BIT;this.BUFFER_STATIC=0;this.BUFFER_DYNAMIC=1;this.BUFFER_STREAM=2;this.POINTS=0;this.LINES=1;this.LINE_LOOP=2;this.LINE_STRIP=3;this.TRIANGLES=4;this.TRIANGLE_STRIP=5;this.TRIANGLE_FAN=6;this.BYTE=5120;this.UNSIGNED_BYTE=5121;this.SHORT=5122;this.UNSIGNED_SHORT= -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],l=l?"":".png",n=this.textureMap[a];n===void 0?(a=g_Engine.remapAssetFolder(a),n=this.createTexture(a+l,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}"}, -techniques:{screenQuad:[{vshader:"screenQuadVShader",fshader:"screenQuadFShader",attributes:{a_pos:{type:"vec3"},a_uv:{type:"vec2"}},params:{u_mainRT:{type:"tex2d"},u_glowFinal:{type:"tex2d",data:"assets/images/black"},u_ssaoRT:{type:"tex2d",data:"assets/images/black"},u_shadowMap:{type:"tex2d",data:"assets/images/white"}},states:{blendEnabled:!0,srcBlend:"SRC_ALPHA",dstcBlend:"ONE_MINUS_SRC_ALPHA"}}]}}; -rdgeGlowMapShader={shaders:{createGlowVShader:"assets/shaders/glowMap_vshader.glsl",createGlowFShader:"assets/shaders/glowMap_fshader.glsl"},techniques:{createGlowMap:[{vshader:"createGlowVShader",fshader:"createGlowFShader",attributes:{vert:{type:"vec3"},normal:{type:"vec3"},texcoord:{type:"vec2"}},params:{},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}; -rdgeGaussianBlurShader={shaders:{blurVShader:"assets/shaders/separableBlur_vshader.glsl",blurFShader:"assets/shaders/separableBlur_fshader.glsl"},techniques:{gaussianBlur:[{vshader:"blurVShader",fshader:"blurFShader",attributes:{vert:{type:"vec3"},texcoord:{type:"vec2"}},params:{vCoeffs:{type:"vec3",data:[0.3125,0.375,0.3125]},vOffset:{type:"vec2",data:[0.00617,0.00617]},u_weight:{type:"float",data:[1]},sTexture:{type:"tex2d"}},states:{culling:!1}}]}}; -rdgeSSAOShader={shaders:{blurVShader:"assets/shaders/ssao_vshader.glsl",blurFShader:"assets/shaders/ssaohr_fshader.glsl"},techniques:{ssao:[{vshader:"blurVShader",fshader:"blurFShader",attributes:{vert:{type:"vec3"},texcoord:{type:"vec2"}},params:{u_normalsRT:{type:"tex2d"},u_depthMap:{type:"tex2d"},sRandMap:{type:"tex2d",data:"assets/images/random_normal.png",wrap:"REPEAT",mips:!1},u_cameraFTR:{type:"vec3"},u_artVals:{type:"vec4",data:[0.36,0.75,0.6,0.05]},u_randMapSize:{type:"float",data:[64]}, -u_screenSize:{type:"vec2",data:[1024,1024]}},states:{culling:!1}}]}};rdgeShadowMapShader={shaders:{shadowMapVShader:"assets/shaders/shadowMap_vshader.glsl",shadowMapFShader:"assets/shaders/shadowMap_fshader.glsl"},techniques:{shadowMap:[{vshader:"shadowMapVShader",fshader:"shadowMapFShader",attributes:{a_pos:{type:"vec3"},a_uv:{type:"vec2"}},params:{u_lightSize:{type:"float",data:[7.93]},u_shadowColor:{type:"vec4",data:[0.922,0.7373,0.4824,0.5]}},states:{depthEnable:!0,blendEnable:!1,culling:!0,cullFace:"BACK"}}]}}; -rdgeNoiseBlurShader={shaders:{blurVShader:"assets/shaders/noiseBlur_vshader.glsl",blurFShader:"assets/shaders/noiseBlur_fshader.glsl"},techniques:{blur:[{vshader:"blurVShader",fshader:"blurFShader",attributes:{a_pos:{type:"vec3"},a_uv:{type:"vec2"}},params:{u_blurSourceMap:{type:"tex2d"}},states:{culling:!1}}]}}; -function rdgePrimitiveDefinition(){this.type=rdgeConstants.TRIANGLE_STRIP;this.vertexDefinition={};this.bufferStreams=[];this.streamUsage=[];this.indexUsage=rdgeConstants.BUFFER_STREAM;this.indexBuffer=[];this.setCount=0;this.indexOffsets=[];this.indexCount=this.triCount=this.posCount=0;this.indexElementSize=rdgeConstants.UNSIGNED_SHORT;this.bufferHandles=[];this.buffersID=-1;this.indexHandle=null;this.useDoubleBuffer=!1;this.frontBufferIndex=this.doubleBufferOffset=0;this.update=function(a){if(!this.bufferStreams[a])return null; -this.bufferStreams[a].dirty=!0;return this.bufferStreams[a]};this.flip=function(a){if(this.useDoubleBuffer===!0)for(var b=0,f=this.bufferStreams.length;b-1)){b.push(g.bufferIndex);g.debugName=f+" buffer";if(g.type==this.VS_ELEMENT_POS)a.posCount=a.bufferStreams[g.bufferIndex].length,a.positions=a.bufferStreams[g.bufferIndex];this.buffers[a.buffersID][g.bufferIndex]==void 0?(a.bufferStreams[g.bufferIndex].type=f+" PrimaryBuffer",a.forceVertexCount?(this.buffers[a.buffersID][g.bufferIndex]=this.createBufferFLOAT32(4* -a.forceVertexCount,g.bufferUsage),this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,new Float32Array(a.bufferStreams[g.bufferIndex]),g.bufferUsage)):this.buffers[a.buffersID][g.bufferIndex]=this.createBufferFLOAT32(a.bufferStreams[g.bufferIndex],g.bufferUsage)):(this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.buffers[a.buffersID][g.bufferIndex]),this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,new Float32Array(a.bufferStreams[g.bufferIndex]),g.bufferUsage));if(a.useDoubleBuffer===!0)a.doubleBufferOffset= -a.bufferStreams.length,a.bufferStreams[g.bufferIndex].type=f+" SecondaryBuffer",this.buffers[a.buffersID][a.doubleBufferOffset+g.bufferIndex]==void 0?a.forceVertexCount?(this.buffers[a.buffersID][a.doubleBufferOffset+g.bufferIndex]=this.createBufferFLOAT32(4*a.prim.forceVertexCount,g.bufferUsage),this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,new Float32Array(a.bufferStreams[g.bufferIndex]),g.bufferUsage)):this.buffers[a.buffersID][a.doubleBufferOffset+g.bufferIndex]=this.createBufferFLOAT32(a.bufferStreams[g.bufferIndex], -g.bufferUsage):(this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.buffers[a.buffersID][a.doubleBufferOffset+g.bufferIndex]),this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,new Float32Array(a.bufferStreams[g.bufferIndex]),g.bufferUsage))}}a.indexBuffer.length>0?(b=a.indexBuffer.length,a.indexBuffer.debugName="index Buffer",this.buffers[a.buffersID].indexHandle==void 0?a.forceIndexCount?(this.buffers[a.buffersID].indexHandle=this.createIndexBufferUINT16(2*a.forceIndexCount,a.indexUsage),this.ctx.bufferSubData(this.ctx.ELEMENT_ARRAY_BUFFER, -0,new Float32Array(a.indexBuffer),a.indexUsage)):this.buffers[a.buffersID].indexHandle=this.createIndexBufferUINT16(a.indexBuffer,a.indexUsage):(this.ctx.bindBuffer(this.ctx.ELEMENT_ARRAY_BUFFER,this.buffers[a.buffersID].indexHandle),this.ctx.bufferSubData(this.ctx.ELEMENT_ARRAY_BUFFER,0,new Float32Array(a.indexBuffer),a.indexUsage)),a.indexCount=b,a.triCount=b/3):a.triCount=a.posCount/3}else this.createPrimitive(a)}; -_renderer.prototype.deletePrimitive=function(a){var b=this.buffers[a.buffersID];if(b){var f=this;b.forEach(function(a){f.ctx.deleteBuffer(a)});delete this.buffers[a.buffersID]}};_renderer.prototype.getPrimitiveBuffer=function(a,b){return this.buffers[a.buffersID][b]}; -_renderer.prototype.drawPrimitive=function(a,b,f){g_renderStats.numDrawCalls.value++;g_renderStats.numTriangles.value+=Math.floor(a.triCount);g_renderStats.numVerts.value+=Math.floor(a.coordCount/3);a.indexCount?this.drawIndexedPrimitive(a,b,f):this.drawNonIndexedPrimitive(a,b,f);a.useDoubleBuffer===!0&&a.flip(this)}; -_renderer.prototype.drawIndexedPrimitive=function(a,b,f){var g=b=0,h=a.buffersID,l="",n=f.length,o=0,p=a.frontBufferIndex*a.doubleBufferOffset;for(g_Engine.getContext();o0;)for(var b=Math.min(this.lineBuffer.length,this.maxLines),f=0;b>0;){var g=this.lineBuffer.shift(),h=f*6,l=f*8;this.posBufferData[h+0]=g[0][0];this.posBufferData[h+1]=g[0][1];this.posBufferData[h+2]=g[0][2];this.posBufferData[h+3]=g[1][0];this.posBufferData[h+4]=g[1][1];this.posBufferData[h+ -5]=g[1][2];this.colorBufferData[l+0]=g[2][0];this.colorBufferData[l+1]=g[2][1];this.colorBufferData[l+2]=g[2][2];this.colorBufferData[l+3]=g[2][3];this.colorBufferData[l+4]=g[3][0];this.colorBufferData[l+5]=g[3][1];this.colorBufferData[l+6]=g[3][2];this.colorBufferData[l+7]=g[3][3];b--;f++;if(b<=0){this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.posBufferObject);this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,null);this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,this.posBufferData);this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER, -this.colorBufferObject);this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,null);this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,this.colorBufferData);this.ctx.disable(this.ctx.DEPTH_TEST);this.shader.begin();this.shader.beginPass(0);this.ctx.enableVertexAttribArray(0);this.ctx.enableVertexAttribArray(1);this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.posBufferObject);this.ctx.vertexAttribPointer(0,3,this.ctx.FLOAT,!1,0,0);this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.colorBufferObject);this.ctx.vertexAttribPointer(1, -4,this.ctx.FLOAT,!1,0,0);this.ctx.drawArrays(this.ctx.LINES,0,f*2);this.shader.endPass();this.shader.end();this.ctx.enable(this.ctx.DEPTH_TEST);a++;this.ctx.finish();this.ctx.flush();break}}};renderUtils={createBox:function(){var a=g_Engine.getContext().renderer,b=new rdgePrimitiveDefinition;b.vertexDefinition={vert:{type:rdgeConstants.VS_ELEMENT_POS,bufferIndex:0,bufferUsage:rdgeConstants.BUFFER_STATIC},a_pos:{type:rdgeConstants.VS_ELEMENT_POS,bufferIndex:0,bufferUsage:rdgeConstants.BUFFER_STATIC},normal:{type:rdgeConstants.VS_ELEMENT_FLOAT3,bufferIndex:1,bufferUsage:rdgeConstants.BUFFER_STATIC},a_nrm:{type:rdgeConstants.VS_ELEMENT_FLOAT3,bufferIndex:1,bufferUsage:rdgeConstants.BUFFER_STATIC}, -texcoord:{type:rdgeConstants.VS_ELEMENT_FLOAT2,bufferIndex:2,bufferUsage:rdgeConstants.BUFFER_STATIC},a_uv:{type:rdgeConstants.VS_ELEMENT_FLOAT2,bufferIndex:2,bufferUsage:rdgeConstants.BUFFER_STATIC}};b.bufferStreams=[[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0, -0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],[1,1,0,1,0,0,1,0,0,1,0,0,1,0,1,1,1,0,1,1,0,1,0,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,1]];b.streamUsage=[rdgeConstants.BUFFER_STATIC,rdgeConstants.BUFFER_STATIC,rdgeConstants.BUFFER_STATIC];b.indexUsage=rdgeConstants.B