From 1a3c7d0d5c4ee40af189459749a459990fd08b7e Mon Sep 17 00:00:00 2001 From: John Mayhew Date: Tue, 3 Apr 2012 09:38:55 -0700 Subject: removed unnecessary files from the RDGE build. Added back the build batch and shell script files for building the compiled version of RDGE Corrected the build scripts to not include the precompiled.js file twice. --- js/helper-classes/RDGE/precompiled.js | 17 - .../RDGE/src/tools/compile-rdge-core.bat | 1 + .../RDGE/src/tools/compile-rdge-core.sh | 1 + js/helper-classes/RDGE/src/tools/rdge-compiled.js | 402 --------------------- 4 files changed, 2 insertions(+), 419 deletions(-) delete mode 100755 js/helper-classes/RDGE/precompiled.js create mode 100644 js/helper-classes/RDGE/src/tools/compile-rdge-core.bat create mode 100644 js/helper-classes/RDGE/src/tools/compile-rdge-core.sh delete mode 100644 js/helper-classes/RDGE/src/tools/rdge-compiled.js (limited to 'js/helper-classes') diff --git a/js/helper-classes/RDGE/precompiled.js b/js/helper-classes/RDGE/precompiled.js deleted file mode 100755 index 7932444c..00000000 --- a/js/helper-classes/RDGE/precompiled.js +++ /dev/null @@ -1,17 +0,0 @@ -/* -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) - * These parameters are compiled into all jshaders and can be set from any jshader - * with a call to jshader.global.u_matDiffuse.set([1,0,0,1]) if the jshader depends on that parameter. - * To set directly call rdgeGlobalParameters.'param'.set(x), for example rdgeGlobalParameters.u_lightPos.set([1,1,1]) - * The values can be added to a jshaders params list - this will creating local jshader memory that binds to the parameter - * this parameter can be used to set the value for that shader but will not override the global setting - * The values set here are the default global values. - * note: the rdge_lights substructure can be ignored, the final parameter list contains only the uniform objects - */ - diff --git a/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat b/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat new file mode 100644 index 00000000..50a9a460 --- /dev/null +++ b/js/helper-classes/RDGE/src/tools/compile-rdge-core.bat @@ -0,0 +1 @@ +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/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/ShaderManager.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/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/particle.js --js ../core/script/run_state.js --js ../core/script/init_state.js --js ../core/script/runtime.js --js_output_file ../../rdge-compiled.js diff --git a/js/helper-classes/RDGE/src/tools/compile-rdge-core.sh b/js/helper-classes/RDGE/src/tools/compile-rdge-core.sh new file mode 100644 index 00000000..ed6d521a --- /dev/null +++ b/js/helper-classes/RDGE/src/tools/compile-rdge-core.sh @@ -0,0 +1 @@ +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/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/ShaderManager.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/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/particle.js --js ../core/script/run_state.js --js ../core/script/init_state.js --js ../core/script/runtime.js --js_output_file rdge-compiled.js 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 50f4e5c9..00000000 --- a/js/helper-classes/RDGE/src/tools/rdge-compiled.js +++ /dev/null @@ -1,402 +0,0 @@ -var RDGE=RDGE||{};RDGE.vec2={};RDGE.vec2.string=function(a){return"{ "+a[0]+", "+a[1]+" }"};RDGE.vec2.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};RDGE.vec2.copy=function(a){return a.length==void 0?[a,a]:[a[0],a[1]]};RDGE.vec2.inplace_copy=function(a,b){a[0]=b[0];a[1]=b[1]};RDGE.vec2.zero=function(){return[0,0]};RDGE.vec2.up=function(){return[0,1]};RDGE.vec2.right=function(){return[1,0]}; -RDGE.vec2.add=function(a,b){return[a[0]+b[0],a[1]+b[1]]};RDGE.vec2.sub=function(a,b){return[a[0]-b[0],a[1]-b[1]]};RDGE.vec2.mul=function(a,b){return[a[0]*b[0],a[1]*b[1]]};RDGE.vec2.addMul=function(a,b,c){return c.length!=void 0&&c.length>=2?[a[0]+b[0]*c[0],a[1]+b[1]*c[1]]:[a[0]+b[0]*c,a[1]+b[1]*c]};RDGE.vec2.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]};RDGE.vec2.negate=function(a){return[-a[0],-a[1]]}; -RDGE.vec2.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};RDGE.vec2.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]};RDGE.vec2.perp=function(a){return[a[1],-a[0]]};RDGE.vec2.lengthSq=function(a){return a[0]*a[0]+a[1]*a[1]};RDGE.vec2.length=function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1])};RDGE.vec2.min=function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1])]};RDGE.vec2.max=function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1])]}; -RDGE.vec2.clamp=function(a,b,c){return RDGE.vec2.min(c,RDGE.vec2.max(a,b))};RDGE=RDGE||{};RDGE.vec3={};RDGE.vec3.string=function(a){return"{ "+a[0]+", "+a[1]+", "+a[2]+" }"};RDGE.vec3.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};RDGE.vec3.inplace_copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2]};RDGE.vec3.copy=function(a){return a.length==void 0?[a,a,a]:[a[0],a[1],a[2]]};RDGE.vec3.translation=function(a){return[a[12],a[13],a[14]]}; -RDGE.vec3.basisX=function(a){return[a[0],a[1],a[2]]};RDGE.vec3.basisY=function(a){return[a[4],a[5],a[6]]};RDGE.vec3.basisZ=function(a){return[a[8],a[9],a[10]]};RDGE.vec3.zero=function(){return[0,0,0]};RDGE.vec3.up=function(){return[0,1,0]};RDGE.vec3.forward=function(){return[0,0,1]};RDGE.vec3.right=function(){return[1,0,0]};RDGE.vec3.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()]};RDGE.vec3.xy=function(a){return[a[0],a[1]]}; -RDGE.vec3.xz=function(a){return[a[0],a[2]]};RDGE.vec3.add=function(a,b){return[a[0]+b[0],a[1]+b[1],a[2]+b[2]]};RDGE.vec3.plusEqual=function(a,b){a[0]+=b[0];a[1]+=b[1];a[2]+=b[2]};RDGE.vec3.sub=function(a,b){return[a[0]-b[0],a[1]-b[1],a[2]-b[2]]};RDGE.vec3.mul=function(a,b){return[a[0]*b[0],a[1]*b[1],a[2]*b[2]]};RDGE.vec3.addMul=function(a,b,c){return c.length!=void 0&&c.length>=3?[a[0]+b[0]*c[0],a[1]+b[1]*c[1],a[2]+b[2]*c[2]]:[a[0]+b[0]*c,a[1]+b[1]*c,a[2]+b[2]*c]}; -RDGE.vec3.plusEqualMul=function(a,b,c){c.length!==void 0&&c.length>=3?(a[0]+=b[0]*c[0],a[1]+=b[1]*c[1],a[2]+=b[2]*c[2]):(a[0]+=b[0]*c,a[1]+=b[1]*c,a[2]+=b[2]*c)};RDGE.vec3.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]};RDGE.vec3.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)};RDGE.vec3.negate=function(a){return[-a[0],-a[1],-a[2]]}; -RDGE.vec3.inplace_negate=function(a){a[0]=-a[0];a[1]=-a[1];a[2]=-a[2]};RDGE.vec3.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};RDGE.vec3.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]]};RDGE.vec3.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]};RDGE.vec3.lengthSq=function(a){return a[0]*a[0]+a[1]*a[1]+a[2]*a[2]}; -RDGE.vec3.length=function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2])};RDGE.vec3.distanceSq=function(a,b){var c=[a[0]-b[0],a[1]-b[1],a[2]-b[2]];return c[0]*c[0]+c[1]*c[1]+c[2]*c[2]};RDGE.vec3.distance=function(a,b){var c=[a[0]-b[0],a[1]-b[1],a[2]-b[2]];return Math.sqrt(c[0]*c[0]+c[1]*c[1]+c[2]*c[2])};RDGE.vec3.angle=function(a,b){return Math.acos(RDGE.vec3.dot(a,b))/(RDGE.vec3.length(a)*RDGE.vec3.length(b))};RDGE.vec3.direction=function(a,b){return RDGE.vec3.normalize(RDGE.vec3.sub(b,a))}; -RDGE.vec3.abs=function(a){return[Math.abs(a[0]),Math.abs(a[1]),Math.abs(a[2])]};RDGE.vec3.min=function(a,b){return[Math.min(a[0],b[0]),Math.min(a[1],b[1]),Math.min(a[2],b[2])]};RDGE.vec3.max=function(a,b){return[Math.max(a[0],b[0]),Math.max(a[1],b[1]),Math.max(a[2],b[2])]};RDGE.vec3.clamp=function(a,b,c){return RDGE.vec3.min(c,RDGE.vec3.max(a,b))};RDGE.vec3.equal=function(a,b,c){c||(c=0.0010);return RDGE.vec3.distanceSq(a,b)=4?[a[0]+b[0]*c[0],a[1]+b[1]*c[1],a[2]+b[2]*c[2],a[3]+b[3]*c[3]]:[a[0]+b[0]*c,a[1]+b[1]*c,a[2]+b[2]*c,a[3]+b[3]*c]};RDGE.vec4.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]}; -RDGE.vec4.negate=function(a){return[-a[0],-a[1],-a[2],-a[3]]};RDGE.vec4.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};RDGE.vec4.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};RDGE.vec4.lengthSq=function(a){return a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]};RDGE.vec4.length=function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3])}; -RDGE.vec4.abs=function(a){return[Math.abs(a[0]),Math.abs(a[1]),Math.abs(a[2]),Math.abs(a[3])]};RDGE.vec4.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])]};RDGE.vec4.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])]};RDGE.vec4.clamp=function(a,b,c){return RDGE.vec4.min(c,RDGE.vec4.max(a,b))};RDGE.vec4.equal=function(a,b,c){c||(c=0.0010);return RDGE.vec4.distanceSq(a,b)=4?b[3]:1;return[a[0]*c+a[4]*d+a[8]*f+a[12]*g,a[1]*c+a[5]*d+a[9]*f+a[13]*g,a[2]*c+a[6]*d+a[10]*f+a[14]*g,a[3]*c+a[7]*d+a[11]*f+a[15]*g]}; -RDGE.mat4.transformVector=function(a,b){var a=RDGE.mat4.inverse(a),c=b[0],d=b[1],f=b[2],g=b.length>=4?b[3]:0;return[a[0]*c+a[1]*d+a[2]*f+a[3]*g,a[4]*c+a[5]*d+a[6]*f+a[7]*g,a[8]*c+a[9]*d+a[10]*f+a[11]*g,a[12]*c+a[13]*d+a[14]*f+a[15]*g]};RDGE.mat4.transformPoint4x3=function(a,b){var c=b[0],d=b[1],f=b[2];return[a[0]*c+a[4]*d+a[8]*f+a[12],a[1]*c+a[5]*d+a[9]*f+a[13],a[2]*c+a[6]*d+a[10]*f+a[14],1]}; -RDGE.mat4.transformVector4x3=function(a,b){var a=RDGE.mat4.inverse(a),c=b[0],d=b[1],f=b[2];return[a[0]*c+a[1]*d+a[2]*f,a[4]*c+a[5]*d+a[6]*f,a[8]*c+a[9]*d+a[10]*f,0]};RDGE.mat4.getRow=function(a,b){b*=4;return[a[b],a[b+1],a[b+2],a[b+3]]};RDGE.mat4.getCol=function(a,b){return[a[b],a[b+4],a[b+8],a[b+12]]};RDGE.mat4.setRow=function(a,b,c){b*=4;a[b+0]=c[0];a[b+1]=c[1];a[b+2]=c[2];c.length>=4&&(a[b+3]=c[3]);return a}; -RDGE.mat4.setCol=function(a,b,c){a[b+0]=c[0];a[b+4]=c[1];a[b+8]=c[2];c.length>=4&&(a[b+12]=c[3]);return a};RDGE.mat4.rotate=function(a,b,c){return RDGE.mat4.mul(a,RDGE.mat4.angleAxis(b,c))};RDGE.mat4.rotateX=function(a,b){return RDGE.mat4.mul(a,RDGE.mat4.angleAxis(b,RDGE.vec3.basisX(a)))};RDGE.mat4.rotateY=function(a,b){return RDGE.mat4.mul(a,RDGE.mat4.angleAxis(b,RDGE.vec3.basisY(a)))};RDGE.mat4.rotateZ=function(a,b){return RDGE.mat4.mul(a,RDGE.mat4.angleAxis(b,RDGE.vec3.basisZ(a)))}; -RDGE.mat4.scale=function(a,b){var c=RDGE.mat4.identity();b.length==void 0&&(b=[b,b,b]);c[0]=b[0];c[5]=b[1];c[10]=b[2];return RDGE.mat4.mul(a,c)};RDGE.mat4.scaleX=function(a,b){return RDGE.mat4.scale(a,[b,1,1])};RDGE.mat4.scaleY=function(a,b){return RDGE.mat4.scale(a,[1,b,1])};RDGE.mat4.scaleZ=function(a,b){return RDGE.mat4.scale(a,[1,1,b])};RDGE.mat4.translate=function(a,b){matT=RDGE.mat4.identity();matT[12]=b[0];matT[13]=b[1];matT[14]=b[2];return RDGE.mat4.mul(a,matT)}; -RDGE.mat4.translateX=function(a,b){return RDGE.mat4.translate(a,[b,0,0])};RDGE.mat4.translateY=function(a,b){return RDGE.mat4.translate(a,[0,b,0])};RDGE.mat4.translateZ=function(a,b){return RDGE.mat4.translate(a,[0,0,b])};RDGE=RDGE||{};RDGE.quat={};RDGE.quat.string=function(a){return"{ "+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+" }"};RDGE.quat.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};RDGE.quat.identity=function(){return[0,0,0,1]};RDGE.quat.add=function(a,b){return[a[0]+b[0],a[1]+b[1],a[2]+b[2],a[3]+b[3]]};RDGE.quat.sub=function(a,b){return[a[0]-b[0],a[1]-b[1],a[2]-b[2],a[3]-b[3]]}; -RDGE.quat.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]]};RDGE.quat.addMul=function(a,b,c){return c.length!=void 0&&c.length>=4?[a[0]+b[0]*c[0],a[1]+b[1]*c[1],a[2]+b[2]*c[2],a[3]+b[3]*c[3]]:[a[0]+b[0]*c,a[1]+b[1]*c,a[2]+b[2]*c,a[3]+b[3]*c]}; -RDGE.quat.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]};RDGE.quat.lengthSq=function(a){return a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3]};RDGE.quat.length=function(a){return Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]+a[3]*a[3])};RDGE.quat.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}; -RDGE.quat.inverse=function(a){var b=RDGE.vec4.lengthSq(a);return b>1.0E-5?(b=1/b,[a[0]*-b,a[1]*-b,a[2]*-b,a[3]]):a};RDGE.quat.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};RDGE.quat.applyRotation=function(a,b){return RDGE.mat4.transformPoint(RDGE.quat.toMatrix(a),b)};RDGE.quat.lerp=function(a,b,c){return RDGE.quat.normalize([a[0]+(b[0]-a[0])*c,a[1]+(b[1]-a[1])*c,a[2]+(b[2]-a[2])*c,a[3]+(b[3]-a[3])*c])}; -RDGE.quat.slerp=function(a,b,c){var d=RDGE.quat.dot(a,b);if(d>=0.9)return RDGE.quat.lerp(a,b,c);var f=Math.sqrt(Math.abs(1-d*d));if(f<0.0010)return a;var d=d<0?-1:1,g=Math.asin(f),h=1/f,f=Math.sin((1-c)*g)*h,c=Math.sin(c*g)*h*d;RDGE.quat.scale(a,f);RDGE.quat.scale(b,c);return RDGE.quat.normalize(RDGE.quat.add(a,b))}; -RDGE.quat.toMatrix=function(a){var b=2*a[0],c=2*a[1],d=2*a[2],f=b*a[3],g=c*a[3],h=d*a[3];b*=a[0];var l=c*a[0],m=d*a[0];c*=a[1];var n=d*a[1],a=d*a[2];return[1-(c+a),l+h,m-g,0,l-h,1-(b+a),n+f,0,m+g,n-f,1-(b+c),0,0,0,0,1]};RDGE=RDGE||{}; -RDGE.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)}}};RDGE=RDGE||{}; -RDGE.rdgeGlobalParameters={u_projMatrix:{type:"mat4",data:RDGE.mat4.identity()},u_mvMatrix:{type:"mat4",data:RDGE.mat4.identity()},u_invMvMatrix:{type:"mat4",data:RDGE.mat4.identity()},u_normalMatrix:{type:"mat4",data:RDGE.mat4.identity()},u_worldMatrix:{type:"mat4",data:RDGE.mat4.identity()},u_viewMatrix:{type:"mat4",data:RDGE.mat4.identity()},u_invViewMatrix:{type:"mat4",data:RDGE.mat4.identity()},u_invWorldMatrix:{type:"mat4",data:RDGE.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:RDGE.mat4.identity()},u_shadowBiasMatrix:{type:"mat4",data:RDGE.mat4.identity()},u_vShadowLight:{type:"mat4",data:RDGE.mat4.identity()},u_shadowBPV:{type:"mat4",data:RDGE.mat4.identity()},u_farZ:{type:"float",data:[1E3]},u_shadowLightFarZ:{type:"float",data:[1E3]},u_cameraFTR:{type:"vec3", -data:[0,0,0]}};RDGE=RDGE||{}; -RDGE.rdgeConstants=function(){return{colorBuffer:16384,depthBuffer:256,stencilBuffer:1024,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}}}(); -RDGE._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 RDGE.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,f,g){this.vpX=a;this.vpY=b;this.vpWidth=f;this.vpHeight=g;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,f){var g=a.split(".")[1],h=this.textureMap[a];h===void 0?(h=this.createTexture(a+(g?"":".png"),b,f),this.textureMap[a]=h,h.lookUpName=a,h.previouslyReferenced=!1):h.previouslyReferenced=!0;return h};this.unloadedTextureCount=0;_texparams=function(a,b){this.wrap=a;this.mips=b};this.createTexture=function(a,b,f){var g=this.ctx.createTexture();this.unloadedTextureCount++;b===void 0&&(b="CLAMP");f===void 0&&(f=!0);if(g)g.image=new Image,g.image.src=a,g.image.context= -RDGE.globals.engine.getContext(),g.texparams=new _texparams(b,f),g.image.onload=function(){this.context.ctxStateManager.RDGEInitState.loadTexture(g);this.context.renderer.unloadedTextureCount--;g.callback&&g.callback(g);this.context.renderer.unloadedTextureCount<0&&console.log("more textures loaded then created...")},g.image.onerror=function(){this.context.renderer.unloadedTextureCount--;g.callback&&g.callback(g);this.context.renderer.unloadedTextureCount<0&&console.log("more textures loaded then created...")}; -return g};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,f,g){var h=this.ctx,l=h.createFramebuffer();h.bindFramebuffer(h.FRAMEBUFFER,l);l.width= -b;l.height=f;b=h.createTexture();h.bindTexture(h.TEXTURE_2D,b);try{h.texImage2D(h.TEXTURE_2D,0,h.RGBA,l.width,l.height,0,h.RGBA,h.UNSIGNED_BYTE,null)}catch(m){f=new WebctxUnsignedByteArray(l.width*l.height*4),h.texImage2D(h.TEXTURE_2D,0,h.RGBA,l.width,l.height,0,h.RGBA,h.UNSIGNED_BYTE,f)}h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.LINEAR);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,g?h.LINEAR_MIPMAP_NEAREST:h.LINEAR);h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE);h.texParameteri(h.TEXTURE_2D, -h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE);g&&h.generateMipmap(h.TEXTURE_2D);g=h.createRenderbuffer();h.bindRenderbuffer(h.RENDERBUFFER,g);h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_COMPONENT16,l.width,l.height);h.getError(h.bindFramebuffer(h.FRAMEBUFFER,l));h.getError(h.bindRenderbuffer(h.RENDERBUFFER,g));h.getError(h.renderbufferStorage(h.RENDERBUFFER,h.DEPTH_COMPONENT16,l.width,l.height));h.bindRenderbuffer(h.RENDERBUFFER,null);h.getError(h.framebufferTexture2D(h.FRAMEBUFFER,h.COLOR_ATTACHMENT0,h.TEXTURE_2D, -b,0));h.getError(h.framebufferRenderbuffer(h.FRAMEBUFFER,h.DEPTH_ATTACHMENT,h.RENDERBUFFER,g));h.bindFramebuffer(h.FRAMEBUFFER,null);h.bindTexture(h.TEXTURE_2D,null);h.bindRenderbuffer(h.RENDERBUFFER,null);h.bindFramebuffer(h.FRAMEBUFFER,null);b.id="RT_"+RDGE.nodeIdGen.getId();b.frameBuffer=l;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"}}]}}}; -RDGE.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"}}]}}; -RDGE.rdgePrimitiveDefinition=function(){this.type=RDGE.rdgeConstants.TRIANGLE_STRIP;this.vertexDefinition={};this.bufferStreams=[];this.streamUsage=[];this.indexUsage=RDGE.rdgeConstants.BUFFER_STREAM;this.indexBuffer=[];this.setCount=0;this.indexOffsets=[];this.indexCount=this.triCount=this.posCount=0;this.indexElementSize=RDGE.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,c=this.bufferStreams.length;b-1)){b.push(d.bufferIndex);d.debugName=c+" buffer";if(d.type==this.VS_ELEMENT_POS)a.posCount=a.bufferStreams[d.bufferIndex].length,a.positions=a.bufferStreams[d.bufferIndex];this.buffers[a.buffersID][d.bufferIndex]==void 0?(a.bufferStreams[d.bufferIndex].type=c+" PrimaryBuffer",a.forceVertexCount?(this.buffers[a.buffersID][d.bufferIndex]= -this.createBufferFLOAT32(4*a.forceVertexCount,d.bufferUsage),this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,new Float32Array(a.bufferStreams[d.bufferIndex]),d.bufferUsage)):this.buffers[a.buffersID][d.bufferIndex]=this.createBufferFLOAT32(a.bufferStreams[d.bufferIndex],d.bufferUsage)):(this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.buffers[a.buffersID][d.bufferIndex]),this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,new Float32Array(a.bufferStreams[d.bufferIndex]),d.bufferUsage));if(a.useDoubleBuffer=== -!0)a.doubleBufferOffset=a.bufferStreams.length,a.bufferStreams[d.bufferIndex].type=c+" SecondaryBuffer",this.buffers[a.buffersID][a.doubleBufferOffset+d.bufferIndex]==void 0?a.forceVertexCount?(this.buffers[a.buffersID][a.doubleBufferOffset+d.bufferIndex]=this.createBufferFLOAT32(4*a.prim.forceVertexCount,d.bufferUsage),this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,new Float32Array(a.bufferStreams[d.bufferIndex]),d.bufferUsage)):this.buffers[a.buffersID][a.doubleBufferOffset+d.bufferIndex]=this.createBufferFLOAT32(a.bufferStreams[d.bufferIndex], -d.bufferUsage):(this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.buffers[a.buffersID][a.doubleBufferOffset+d.bufferIndex]),this.ctx.bufferSubData(this.ctx.ARRAY_BUFFER,0,new Float32Array(a.bufferStreams[d.bufferIndex]),d.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)}; -RDGE._renderer.prototype.deletePrimitive=function(a){var b=this.buffers[a.buffersID];if(b){var c=this;b.forEach(function(a){c.ctx.deleteBuffer(a)});delete this.buffers[a.buffersID]}};RDGE._renderer.prototype.getPrimitiveBuffer=function(a,b){return this.buffers[a.buffersID][b]};RDGE._renderer.prototype.drawPrimitive=function(a,b,c){a.indexCount?this.drawIndexedPrimitive(a,b,c):this.drawNonIndexedPrimitive(a,b,c);a.useDoubleBuffer===!0&&a.flip(this)}; -RDGE._renderer.prototype.drawIndexedPrimitive=function(a,b,c){var d=b=0,f=a.buffersID,g="",h=c.length,l=0,m=a.frontBufferIndex*a.doubleBufferOffset;for(RDGE.globals.engine.getContext();l");var c=this.def.shaders[a.vshader], -d=this.def.shaders[a.fshader];this.ctx.useProgram(null);var f=null,g=null;c.indexOf("{")!=-1?g=c:(g=new XMLHttpRequest,g.open("GET",c,!1),g.send(null),g=g.responseText);f=this.buildShader(this.ctx.VERTEX_SHADER,g);g=null;c.indexOf("{")!=-1?g=d:(g=new XMLHttpRequest,g.open("GET",d,!1),g.send(null),g=g.responseText);g=this.buildShader(this.ctx.FRAGMENT_SHADER,g);if(!f||!g)return null;this.compiledShaders[a.vshader]=f;this.compiledShaders[a.fshader]=g;c=this.ctx.createProgram();if(!c)return null;this.ctx.attachShader(c, -f);this.ctx.attachShader(c,g);d=0;a.attribPairs=[];for(var h in a.attributes)a.attribPairs.push({loc:d,name:h}),this.ctx.bindAttribLocation(c,d++,h);this.ctx.linkProgram(c);return!this.ctx.getProgramParameter(c,this.ctx.LINK_STATUS)?(a=this.ctx.getProgramInfoLog(c),window.console.log("Error in program linking:"+a),this.ctx.deleteProgram(c),this.ctx.deleteProgram(g),this.ctx.deleteProgram(f),null):c};this.setLightContext=function(a){for(t in this.technique)for(var c=this.technique.passes.length,d= -0;d