aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/rdge-compiled.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/rdge-compiled.js')
-rw-r--r--js/helper-classes/RDGE/rdge-compiled.js102
1 files changed, 51 insertions, 51 deletions
diff --git a/js/helper-classes/RDGE/rdge-compiled.js b/js/helper-classes/RDGE/rdge-compiled.js
index 4b74aa17..e55516db 100644
--- a/js/helper-classes/RDGE/rdge-compiled.js
+++ b/js/helper-classes/RDGE/rdge-compiled.js
@@ -19,14 +19,14 @@ vec4.equal=function(a,b,f){f||(f=0.0010);return vec4.distanceSq(a,b)<f*f};vec4.l
19mat4={string:function(a){var b="{ ";b+=a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", ";b+=a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", ";b+=a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", ";b+=a[12]+", "+a[13]+", "+a[14]+", "+a[15]+" }";return b},toCSSString:function(a,b){var f=10;b&&(f=b);var g="matrix3d(";g+=a[0].toFixed(10)+", "+a[1].toFixed(10)+", "+a[2].toFixed(10)+", "+a[3].toFixed(10)+", ";g+=a[4].toFixed(10)+", "+a[5].toFixed(10)+", "+a[6].toFixed(10)+", "+a[7].toFixed(10)+", ";g+=a[8].toFixed(10)+", "+a[9].toFixed(10)+ 19mat4={string:function(a){var b="{ ";b+=a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", ";b+=a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", ";b+=a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", ";b+=a[12]+", "+a[13]+", "+a[14]+", "+a[15]+" }";return b},toCSSString:function(a,b){var f=10;b&&(f=b);var g="matrix3d(";g+=a[0].toFixed(10)+", "+a[1].toFixed(10)+", "+a[2].toFixed(10)+", "+a[3].toFixed(10)+", ";g+=a[4].toFixed(10)+", "+a[5].toFixed(10)+", "+a[6].toFixed(10)+", "+a[7].toFixed(10)+", ";g+=a[8].toFixed(10)+", "+a[9].toFixed(10)+
20", "+a[10].toFixed(10)+", "+a[11].toFixed(10)+", ";g+=a[12].toFixed(10)*f+", "+(600-a[13].toFixed(10)*f)+", "+a[14].toFixed(10)*f+", "+a[15].toFixed(10)+")";return g},verify:function(a){if(a==void 0||a.length==void 0||a.length<16)return!1;for(var b=16;b--;)if(typeof a[b]!="number")return!1;return!0},copy:function(a){return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]},inplace_copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]= 20", "+a[10].toFixed(10)+", "+a[11].toFixed(10)+", ";g+=a[12].toFixed(10)*f+", "+(600-a[13].toFixed(10)*f)+", "+a[14].toFixed(10)*f+", "+a[15].toFixed(10)+")";return g},verify:function(a){if(a==void 0||a.length==void 0||a.length<16)return!1;for(var b=16;b--;)if(typeof a[b]!="number")return!1;return!0},copy:function(a){return[a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11],a[12],a[13],a[14],a[15]]},inplace_copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=
21b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15]},identity:function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},zero:function(){return[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},basis:function(a,b,f,g){return g==null||g==void 0?[a[0],a[1],a[2],0,b[0],b[1],b[2],0,f[0],f[1],f[2],0,0,0,0,1]:[a[0],a[1],a[2],a.length==4?a[3]:0,b[0],b[1],b[2],b.length==4?b[3]:0,f[0],f[1],f[2],f.length==4?f[3]:0,g[0],g[1],g[2],g.length==4?g[3]:1]},angleAxis:function(a,b){a*= 21b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15]},identity:function(){return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]},zero:function(){return[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},basis:function(a,b,f,g){return g==null||g==void 0?[a[0],a[1],a[2],0,b[0],b[1],b[2],0,f[0],f[1],f[2],0,0,0,0,1]:[a[0],a[1],a[2],a.length==4?a[3]:0,b[0],b[1],b[2],b.length==4?b[3]:0,f[0],f[1],f[2],f.length==4?f[3]:0,g[0],g[1],g[2],g.length==4?g[3]:1]},angleAxis:function(a,b){a*=
22Math.PI/180;a/=2;var f=Math.sin(a),g=Math.cos(a),h=f*f;vec3.normalize(b);vec3.lengthSq(b)<=0&&(b=[0,0,0,1]);var l=mat4.identity();if(b[0]==1&&b[1]==0&&b[2]==0)l[5]=1-2*h,l[6]=2*f*g,l[9]=-2*f*g,l[10]=1-2*h;else if(b[0]==0&&b[1]==1&&b[2]==0)l[0]=1-2*h,l[2]=-2*f*g,l[8]=2*f*g,l[10]=1-2*h;else if(b[0]==0&&b[1]==0&&b[2]==1)l[0]=1-2*h,l[1]=2*f*g,l[4]=-2*f*g,l[5]=1-2*h;else{var n=b[0],o=b[1],q=b[2],p=n*n,r=o*o,s=q*q;l[0]=1-2*(r+s)*h;l[1]=2*(n*o*h+q*f*g);l[2]=2*(n*q*h-o*f*g);l[4]=2*(o*n*h-q*f*g);l[5]=1-2* 22Math.PI/180;a/=2;var f=Math.sin(a),g=Math.cos(a),h=f*f;vec3.normalize(b);vec3.lengthSq(b)<=0&&(b=[0,0,0,1]);var l=mat4.identity();if(b[0]==1&&b[1]==0&&b[2]==0)l[5]=1-2*h,l[6]=2*f*g,l[9]=-2*f*g,l[10]=1-2*h;else if(b[0]==0&&b[1]==1&&b[2]==0)l[0]=1-2*h,l[2]=-2*f*g,l[8]=2*f*g,l[10]=1-2*h;else if(b[0]==0&&b[1]==0&&b[2]==1)l[0]=1-2*h,l[1]=2*f*g,l[4]=-2*f*g,l[5]=1-2*h;else{var n=b[0],o=b[1],p=b[2],q=n*n,r=o*o,s=p*p;l[0]=1-2*(r+s)*h;l[1]=2*(n*o*h+p*f*g);l[2]=2*(n*p*h-o*f*g);l[4]=2*(o*n*h-p*f*g);l[5]=1-2*
23(s+p)*h;l[6]=2*(o*q*h+n*f*g);l[8]=2*(q*n*h+o*f*g);l[9]=2*(q*o*h-n*f*g);l[10]=1-2*(p+r)*h}return l}};mat4.lookAt=function(a,b,f){b=vec3.normalize(vec3.sub(a,b));vec3.length(b)<1.0E-4&&(b=[0,0,1]);var f=vec3.normalize(vec3.cross(f,b)),g=vec3.normalize(vec3.cross(b,f)),h=mat4.identity();mat4.setRow(h,0,f);mat4.setRow(h,1,g);mat4.setRow(h,2,b);mat4.setRow(h,3,a);return h}; 23(s+q)*h;l[6]=2*(o*p*h+n*f*g);l[8]=2*(p*n*h+o*f*g);l[9]=2*(p*o*h-n*f*g);l[10]=1-2*(q+r)*h}return l}};mat4.lookAt=function(a,b,f){b=vec3.normalize(vec3.sub(a,b));vec3.length(b)<1.0E-4&&(b=[0,0,1]);var f=vec3.normalize(vec3.cross(f,b)),g=vec3.normalize(vec3.cross(b,f)),h=mat4.identity();mat4.setRow(h,0,f);mat4.setRow(h,1,g);mat4.setRow(h,2,b);mat4.setRow(h,3,a);return h};
24mat4.frustum=function(a,b,f,g,h,l){var n=b-a,o=g-f,q=l-h,p=2*h,r=mat4.zero();r[0]=p/n;r[5]=p/o;r[8]=(b+a)/n;r[9]=(g+f)/o;r[10]=-(l+h)/q;r[11]=-1;r[14]=-(p*l)/q;return r};mat4.perspective=function(a,b,f,g){var a=Math.tan(a*Math.PI/360)*f,h=-a;return mat4.frustum(b*h,b*a,h,a,f,g)};mat4.orthographic=function(a,b,f,g,h,l){var n=(a+b)/(a-b),o=(f+g)/(f-g),q=(l+h)/(l-h),p=mat4.zero();p[0]=2/(a-b);p[5]=2/(f-g);p[10]=-2/(l-h);p[12]=n;p[13]=o;p[14]=q;p[15]=1;return p}; 24mat4.frustum=function(a,b,f,g,h,l){var n=b-a,o=g-f,p=l-h,q=2*h,r=mat4.zero();r[0]=q/n;r[5]=q/o;r[8]=(b+a)/n;r[9]=(g+f)/o;r[10]=-(l+h)/p;r[11]=-1;r[14]=-(q*l)/p;return r};mat4.perspective=function(a,b,f,g){var a=Math.tan(a*Math.PI/360)*f,h=-a;return mat4.frustum(b*h,b*a,h,a,f,g)};mat4.orthographic=function(a,b,f,g,h,l){var n=(a+b)/(a-b),o=(f+g)/(f-g),p=(l+h)/(l-h),q=mat4.zero();q[0]=2/(a-b);q[5]=2/(f-g);q[10]=-2/(l-h);q[12]=n;q[13]=o;q[14]=p;q[15]=1;return q};
25mat4.mul=function(a,b){var f=a[0],g=a[1],h=a[2],l=a[3],n=a[4],o=a[5],q=a[6],p=a[7],r=a[8],s=a[9],u=a[10],v=a[11],x=a[12],w=a[13],y=a[14],z=a[15],A=b[0],C=b[1],D=b[2],B=b[3],E=b[4],F=b[5],G=b[6],H=b[7],I=b[8],J=b[9],K=b[10],L=b[11],M=b[12],N=b[13],O=b[14],P=b[15];return[f*A+g*E+h*I+l*M,f*C+g*F+h*J+l*N,f*D+g*G+h*K+l*O,f*B+g*H+h*L+l*P,n*A+o*E+q*I+p*M,n*C+o*F+q*J+p*N,n*D+o*G+q*K+p*O,n*B+o*H+q*L+p*P,r*A+s*E+u*I+v*M,r*C+s*F+u*J+v*N,r*D+s*G+u*K+v*O,r*B+s*H+u*L+v*P,x*A+w*E+y*I+z*M,x*C+w*F+y*J+z*N,x*D+w*G+ 25mat4.mul=function(a,b){var f=a[0],g=a[1],h=a[2],l=a[3],n=a[4],o=a[5],p=a[6],q=a[7],r=a[8],s=a[9],u=a[10],v=a[11],x=a[12],w=a[13],y=a[14],z=a[15],A=b[0],C=b[1],D=b[2],B=b[3],E=b[4],F=b[5],G=b[6],H=b[7],I=b[8],J=b[9],K=b[10],L=b[11],M=b[12],N=b[13],O=b[14],P=b[15];return[f*A+g*E+h*I+l*M,f*C+g*F+h*J+l*N,f*D+g*G+h*K+l*O,f*B+g*H+h*L+l*P,n*A+o*E+p*I+q*M,n*C+o*F+p*J+q*N,n*D+o*G+p*K+q*O,n*B+o*H+p*L+q*P,r*A+s*E+u*I+v*M,r*C+s*F+u*J+v*N,r*D+s*G+u*K+v*O,r*B+s*H+u*L+v*P,x*A+w*E+y*I+z*M,x*C+w*F+y*J+z*N,x*D+w*G+
26y*K+z*O,x*B+w*H+y*L+z*P]};mat4.mul4x3=function(a,b){var f=a[0],g=a[1],h=a[2],l=a[4],n=a[5],o=a[6],q=a[8],p=a[9],r=a[10],s=a[12],u=a[13],v=a[14],x=b[0],w=b[1],y=b[2],z=b[4],A=b[5],C=b[6],D=b[8],B=b[9],E=b[10];return[f*x+g*z+h*D,f*w+g*A+h*B,f*y+g*C+h*E,0,l*x+n*z+o*D,l*w+n*A+o*B,l*y+n*C+o*E,0,q*x+p*z+r*D,q*w+p*A+r*B,q*y+p*C+r*E,0,s*x+u*z+v*D+b[12],s*w+u*A+v*B+b[13],s*y+u*C+v*E+b[14],1]};mat4._det2x2=function(a,b,f,g){return a*g-b*f}; 26y*K+z*O,x*B+w*H+y*L+z*P]};mat4.mul4x3=function(a,b){var f=a[0],g=a[1],h=a[2],l=a[4],n=a[5],o=a[6],p=a[8],q=a[9],r=a[10],s=a[12],u=a[13],v=a[14],x=b[0],w=b[1],y=b[2],z=b[4],A=b[5],C=b[6],D=b[8],B=b[9],E=b[10];return[f*x+g*z+h*D,f*w+g*A+h*B,f*y+g*C+h*E,0,l*x+n*z+o*D,l*w+n*A+o*B,l*y+n*C+o*E,0,p*x+q*z+r*D,p*w+q*A+r*B,p*y+q*C+r*E,0,s*x+u*z+v*D+b[12],s*w+u*A+v*B+b[13],s*y+u*C+v*E+b[14],1]};mat4._det2x2=function(a,b,f,g){return a*g-b*f};
27mat4._det3x3=function(a,b,f,g,h,l,n,o,q){return a*mat4._det2x2(h,l,o,q)-g*mat4._det2x2(b,f,o,q)+n*mat4._det2x2(b,f,h,l)};mat4._det4x4=function(a){var b=a[1],f=a[2],g=a[3],h=a[4],l=a[5],n=a[6],o=a[7],q=a[8],p=a[9],r=a[10],s=a[11],u=a[12],v=a[13],x=a[14],w=a[15];return a[0]*mat4._det3x3(l,p,v,n,r,x,o,s,w)-b*mat4._det3x3(h,q,u,n,r,x,o,s,w)+f*mat4._det3x3(h,q,u,l,p,v,o,s,w)-g*mat4._det3x3(h,q,u,l,p,v,n,r,x)}; 27mat4._det3x3=function(a,b,f,g,h,l,n,o,p){return a*mat4._det2x2(h,l,o,p)-g*mat4._det2x2(b,f,o,p)+n*mat4._det2x2(b,f,h,l)};mat4._det4x4=function(a){var b=a[1],f=a[2],g=a[3],h=a[4],l=a[5],n=a[6],o=a[7],p=a[8],q=a[9],r=a[10],s=a[11],u=a[12],v=a[13],x=a[14],w=a[15];return a[0]*mat4._det3x3(l,q,v,n,r,x,o,s,w)-b*mat4._det3x3(h,p,u,n,r,x,o,s,w)+f*mat4._det3x3(h,p,u,l,q,v,o,s,w)-g*mat4._det3x3(h,p,u,l,q,v,n,r,x)};
28mat4._adjoint=function(a){var b=a[0],f=a[1],g=a[2],h=a[3],l=a[4],n=a[5],o=a[6],q=a[7],p=a[8],r=a[9],s=a[10],u=a[11],v=a[12],x=a[13],w=a[14],a=a[15];return[mat4._det3x3(n,r,x,o,s,w,q,u,a),-mat4._det3x3(f,r,x,g,s,w,h,u,a),mat4._det3x3(f,n,x,g,o,w,h,q,a),-mat4._det3x3(f,n,r,g,o,s,h,q,u),-mat4._det3x3(l,p,v,o,s,w,q,u,a),mat4._det3x3(b,p,v,g,s,w,h,u,a),-mat4._det3x3(b,l,v,g,o,w,h,q,a),mat4._det3x3(b,l,p,g,o,s,h,q,u),mat4._det3x3(l,p,v,n,r,x,q,u,a),-mat4._det3x3(b,p,v,f,r,x,h,u,a),mat4._det3x3(b,l,v,f, 28mat4._adjoint=function(a){var b=a[0],f=a[1],g=a[2],h=a[3],l=a[4],n=a[5],o=a[6],p=a[7],q=a[8],r=a[9],s=a[10],u=a[11],v=a[12],x=a[13],w=a[14],a=a[15];return[mat4._det3x3(n,r,x,o,s,w,p,u,a),-mat4._det3x3(f,r,x,g,s,w,h,u,a),mat4._det3x3(f,n,x,g,o,w,h,p,a),-mat4._det3x3(f,n,r,g,o,s,h,p,u),-mat4._det3x3(l,q,v,o,s,w,p,u,a),mat4._det3x3(b,q,v,g,s,w,h,u,a),-mat4._det3x3(b,l,v,g,o,w,h,p,a),mat4._det3x3(b,l,q,g,o,s,h,p,u),mat4._det3x3(l,q,v,n,r,x,p,u,a),-mat4._det3x3(b,q,v,f,r,x,h,u,a),mat4._det3x3(b,l,v,f,
29n,x,h,q,a),-mat4._det3x3(b,l,p,f,n,r,h,q,u),-mat4._det3x3(l,p,v,n,r,x,o,s,w),mat4._det3x3(b,p,v,f,r,x,g,s,w),-mat4._det3x3(b,l,v,f,n,x,g,o,w),mat4._det3x3(b,l,p,f,n,r,g,o,s)]};mat4.inverse=function(a){var b=mat4._det4x4(a);if(Math.abs(b)<1.0E-8)return null;a=mat4._adjoint(a);b=1/b;return[a[0]*b,a[1]*b,a[2]*b,a[3]*b,a[4]*b,a[5]*b,a[6]*b,a[7]*b,a[8]*b,a[9]*b,a[10]*b,a[11]*b,a[12]*b,a[13]*b,a[14]*b,a[15]*b]}; 29n,x,h,p,a),-mat4._det3x3(b,l,q,f,n,r,h,p,u),-mat4._det3x3(l,q,v,n,r,x,o,s,w),mat4._det3x3(b,q,v,f,r,x,g,s,w),-mat4._det3x3(b,l,v,f,n,x,g,o,w),mat4._det3x3(b,l,q,f,n,r,g,o,s)]};mat4.inverse=function(a){var b=mat4._det4x4(a);if(Math.abs(b)<1.0E-8)return null;a=mat4._adjoint(a);b=1/b;return[a[0]*b,a[1]*b,a[2]*b,a[3]*b,a[4]*b,a[5]*b,a[6]*b,a[7]*b,a[8]*b,a[9]*b,a[10]*b,a[11]*b,a[12]*b,a[13]*b,a[14]*b,a[15]*b]};
30mat4.rigidInverse=function(a){out=mat4.transpose3x3(a);out[12]=-vec3.dot([out[0],out[4],out[8]],[a[12],a[13],a[14]]);out[13]=-vec3.dot([out[1],out[5],out[9]],[a[12],a[13],a[14]]);out[14]=-vec3.dot([out[2],out[6],out[10]],[a[12],a[13],a[14]]);return out};mat4.transpose=function(a){return[a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]]};mat4.transpose3x3=function(a){return[a[0],a[4],a[8],a[3],a[1],a[5],a[9],a[7],a[2],a[6],a[10],a[11],a[12],a[13],a[14],a[15]]}; 30mat4.rigidInverse=function(a){out=mat4.transpose3x3(a);out[12]=-vec3.dot([out[0],out[4],out[8]],[a[12],a[13],a[14]]);out[13]=-vec3.dot([out[1],out[5],out[9]],[a[12],a[13],a[14]]);out[14]=-vec3.dot([out[2],out[6],out[10]],[a[12],a[13],a[14]]);return out};mat4.transpose=function(a){return[a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]]};mat4.transpose3x3=function(a){return[a[0],a[4],a[8],a[3],a[1],a[5],a[9],a[7],a[2],a[6],a[10],a[11],a[12],a[13],a[14],a[15]]};
31mat4.transformPoint=function(a,b){var f=b[0],g=b[1],h=b[2],l=b.length>=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]}; 31mat4.transformPoint=function(a,b){var f=b[0],g=b[1],h=b[2],l=b.length>=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]};
32mat4.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]]}; 32mat4.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]]};
@@ -36,7 +36,7 @@ mat4.translateY=function(a,b){return mat4.translate(a,[0,b,0])};mat4.translateZ=
36b[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]* 36b[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]*
37a[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)}; 37a[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)};
38quat.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))}; 38quat.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))};
39quat.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],q=g*a[0];f*=a[1];var p=g*a[1],a=g*a[2];return[1-(f+a),o+n,q-l,0,o-n,1-(b+a),p+h,0,q+l,p-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<f.length;++i)if(f[i].name==b)return f[i];return null};stat.closePage=function(a){pages[a]=null;stat.dirty=!0};stat.reportAll=function(b){if(stat.dirty==!0){var f=document.getElementById(b); 39quat.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<f.length;++i)if(f[i].name==b)return f[i];return null};stat.closePage=function(a){pages[a]=null;stat.dirty=!0};stat.reportAll=function(b){if(stat.dirty==!0){var f=document.getElementById(b);
40if(!f)return;var g='<div id="stat_tabs">';g+="<ul>";for(a in pages)pages[a]&&(g+='<li><a href="#'+a+'">'+a+"</a></li>");g+="</ul>";for(a in pages)pages[a]&&(g+='<div id="'+a+'">',g+="</div>");g+="</div>";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='<table width="100%" cellspacing = 1 border = 0><tr>';var g=0;for(i=0;i<f.length;++i)if(outputHTML+='<td width=200 align=center bgcolor="#3F3F3F">', 40if(!f)return;var g='<div id="stat_tabs">';g+="<ul>";for(a in pages)pages[a]&&(g+='<li><a href="#'+a+'">'+a+"</a></li>");g+="</ul>";for(a in pages)pages[a]&&(g+='<div id="'+a+'">',g+="</div>");g+="</div>";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='<table width="100%" cellspacing = 1 border = 0><tr>';var g=0;for(i=0;i<f.length;++i)if(outputHTML+='<td width=200 align=center bgcolor="#3F3F3F">',
41outputHTML+=f[i].func?f[i].name+" : "+f[i].func(f[i].value):f[i].name+" : "+f[i].value,outputHTML+="</td>",g++>=3&&(outputHTML+="</tr><tr>",g=0),f[i].reset)f[i].value=f[i].defValue;outputHTML+="</tr></table>";a.innerHTML=outputHTML}}};setInterval(function(){self.reportAll("RDGE_STATS")},500);return self}(); 41outputHTML+=f[i].func?f[i].name+" : "+f[i].func(f[i].value):f[i].name+" : "+f[i].value,outputHTML+="</td>",g++>=3&&(outputHTML+="</tr><tr>",g=0),f[i].reset)f[i].value=f[i].defValue;outputHTML+="</tr></table>";a.innerHTML=outputHTML}}};setInterval(function(){self.reportAll("RDGE_STATS")},500);return self}();
42dbCanvas=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"); 42dbCanvas=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");
@@ -64,7 +64,7 @@ this.ctx.clearColor(a[0],a[1],a[2],a[3])};this.setClearFlags=function(a){this.cl
64b,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)}; 64b,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)};
65return 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, 65return 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,
66this.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= 66this.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=
67b;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(q){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, 67b;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,
68n.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, 68n.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,
69b,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", 69b,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",
70defaultFShader:"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"}}]}}}; 70defaultFShader:"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"}}]}}};
@@ -91,61 +91,60 @@ g.bufferUsage):(this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.buffers[a.buffers
910,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)}; 910,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)};
92_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]}; 92_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]};
93_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)}; 93_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)};
94_renderer.prototype.drawIndexedPrimitive=function(a,b,f){var g=b=0,h=a.buffersID,l="",n=f.length,o=0,q=a.frontBufferIndex*a.doubleBufferOffset;for(g_Engine.getContext();o<n;++o)if(g=f[o].loc,l=f[o].name,a.vertexDefinition[l])b=a.vertexDefinition[l].bufferIndex,this.ctx.enableVertexAttribArray(g),this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.buffers[h][q+b]),this.ctx.vertexAttribPointer(g,a.vertexDefinition[l].type,this.FLOAT,!1,0,0);this.ctx.bindBuffer(this.ctx.ELEMENT_ARRAY_BUFFER,this.buffers[h].indexHandle); 94_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();o<n;++o)if(g=f[o].loc,l=f[o].name,a.vertexDefinition[l])b=a.vertexDefinition[l].bufferIndex,this.ctx.enableVertexAttribArray(g),this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.buffers[h][p+b]),this.ctx.vertexAttribPointer(g,a.vertexDefinition[l].type,this.FLOAT,!1,0,0);this.ctx.bindBuffer(this.ctx.ELEMENT_ARRAY_BUFFER,this.buffers[h].indexHandle);
95this.ctx.drawElements(a.type,a.indexCount,a.indexElementSize,0);for(o=0;o<n;++o)this.ctx.disableVertexAttribArray(f[o].loc)}; 95this.ctx.drawElements(a.type,a.indexCount,a.indexElementSize,0);for(o=0;o<n;++o)this.ctx.disableVertexAttribArray(f[o].loc)};
96_renderer.prototype.drawIndexedPrimitiveWireFrame=function(a,b,f){for(var g=b=0,h=a.buffersID,l="",n=f.length,o=0,q=a.frontBufferIndex*a.doubleBufferOffset;o<n;++o)if(g=f[o].loc,l=f[o].name,a.vertexDefinition[l])b=a.vertexDefinition[l].bufferIndex,this.ctx.enableVertexAttribArray(g),this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.buffers[h][q+b]),this.ctx.vertexAttribPointer(g,a.vertexDefinition[l].type,this.FLOAT,!1,0,0);this.ctx.bindBuffer(this.ctx.ELEMENT_ARRAY_BUFFER,this.buffers[h].indexHandle); 96_renderer.prototype.drawIndexedPrimitiveWireFrame=function(a,b,f){for(var g=b=0,h=a.buffersID,l="",n=f.length,o=0,p=a.frontBufferIndex*a.doubleBufferOffset;o<n;++o)if(g=f[o].loc,l=f[o].name,a.vertexDefinition[l])b=a.vertexDefinition[l].bufferIndex,this.ctx.enableVertexAttribArray(g),this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.buffers[h][p+b]),this.ctx.vertexAttribPointer(g,a.vertexDefinition[l].type,this.FLOAT,!1,0,0);this.ctx.bindBuffer(this.ctx.ELEMENT_ARRAY_BUFFER,this.buffers[h].indexHandle);
97this.ctx.drawElements(this.LINE_LOOP,a.indexCount,a.indexElementSize,0);for(o=0;o<n;++o)this.ctx.disableVertexAttribArray(f[o].loc)}; 97this.ctx.drawElements(this.LINE_LOOP,a.indexCount,a.indexElementSize,0);for(o=0;o<n;++o)this.ctx.disableVertexAttribArray(f[o].loc)};
98_renderer.prototype.drawNonIndexedPrimitive=function(a,b,f){for(var g=b=0,h=a.buffersID,l="",n=f.length,o=0,q=a.frontBufferIndex*a.doubleBufferOffset;o<n;++o)g=f[o].loc,l=f[o].name,b=a.vertexDefinition[l].bufferIndex,a.vertexDefinition[l]&&(this.ctx.enableVertexAttribArray(g),this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.buffers[h][q+b]),this.ctx.vertexAttribPointer(g,a.vertexDefinition[l].type,this.FLOAT,!1,0,0));this.ctx.drawArrays(a.type,0,a.triCount);for(o=0;o<n;++o)this.ctx.disableVertexAttribArray(f[o].loc)}; 98_renderer.prototype.drawNonIndexedPrimitive=function(a,b,f){for(var g=b=0,h=a.buffersID,l="",n=f.length,o=0,p=a.frontBufferIndex*a.doubleBufferOffset;o<n;++o)g=f[o].loc,l=f[o].name,b=a.vertexDefinition[l].bufferIndex,a.vertexDefinition[l]&&(this.ctx.enableVertexAttribArray(g),this.ctx.bindBuffer(this.ctx.ARRAY_BUFFER,this.buffers[h][p+b]),this.ctx.vertexAttribPointer(g,a.vertexDefinition[l].type,this.FLOAT,!1,0,0));this.ctx.drawArrays(a.type,0,a.triCount);for(o=0;o<n;++o)this.ctx.disableVertexAttribArray(f[o].loc)};
99_renderer.prototype.drawIndexedPrimitiveSet=function(a){window.alert("drawIndexedPrimitiveSet is not implemented");for(var b=0;b<a.setCount;++b)this.ctx.drawElements(a.type[b],mesh.numIndices[b],a.indexElementSize[b],a.indexOffsets[b])}; 99_renderer.prototype.drawIndexedPrimitiveSet=function(a){window.alert("drawIndexedPrimitiveSet is not implemented");for(var b=0;b<a.setCount;++b)this.ctx.drawElements(a.type[b],mesh.numIndices[b],a.indexElementSize[b],a.indexOffsets[b])};
100renderDebug=function(a){this.renderer=g_Engine.getContext().renderer;this.ctx=g_Engine.getContext().renderer.ctx;this.hidden=!1;this.maxLines=a;this.lineBuffer=[];this.posBufferData=new Float32Array(3*this.maxLines);this.colorBufferData=new Float32Array(4*this.maxLines);this.posBufferObject=renderer.createBufferFLOAT32(this.posBufferData,this.renderer.BUFFER_DYNAMIC);this.colorBufferObject=renderer.createBufferFLOAT32(this.colorBufferData,this.renderer.BUFFER_DYNAMIC);this.shader=new jshader;this.shader.def= 100renderDebug=function(a){this.renderer=g_Engine.getContext().renderer;this.ctx=g_Engine.getContext().renderer.ctx;this.hidden=!1;this.maxLines=a;this.lineBuffer=[];this.posBufferData=new Float32Array(3*this.maxLines);this.colorBufferData=new Float32Array(4*this.maxLines);this.posBufferObject=renderer.createBufferFLOAT32(this.posBufferData,this.renderer.BUFFER_DYNAMIC);this.colorBufferObject=renderer.createBufferFLOAT32(this.colorBufferData,this.renderer.BUFFER_DYNAMIC);this.shader=new jshader;this.shader.def=
101{shaders:{defaultVShader:"\t\t\t\tuniform mat4 u_mvMatrix;\t\t\t\tuniform mat4 u_projMatrix;\t\t\t\tattribute vec3\ta_pos;\t\t\t\tattribute vec4 a_color;\t\t\t\tvarying vec4 v_color;\t\t\t\tvoid main() {\t\t\t\t\tgl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\t\t\t\t\tv_color = a_color;\t\t\t\t}",defaultFShader:"\t\t\t\tprecision mediump float;\t\t\t\tvarying vec4 v_color;\t\t\t\tvoid main() {\t\t\t\t\tgl_FragColor = v_color;\t\t\t\t\tgl_FragColor.a = 1.0;\t\t\t\t}"},techniques:{defaultTechnique:[{vshader:"defaultVShader", 101{shaders:{defaultVShader:"\t\t\t\tuniform mat4 u_mvMatrix;\t\t\t\tuniform mat4 u_projMatrix;\t\t\t\tattribute vec3\ta_pos;\t\t\t\tattribute vec4 a_color;\t\t\t\tvarying vec4 v_color;\t\t\t\tvoid main() {\t\t\t\t\tgl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\t\t\t\t\tv_color = a_color;\t\t\t\t}",defaultFShader:"\t\t\t\tprecision mediump float;\t\t\t\tvarying vec4 v_color;\t\t\t\tvoid main() {\t\t\t\t\tgl_FragColor = v_color;\t\t\t\t\tgl_FragColor.a = 1.0;\t\t\t\t}"},techniques:{defaultTechnique:[{vshader:"defaultVShader",
102fshader:"defaultFShader",attributes:{a_pos:{type:"vec3"},a_color:{type:"vec4"}},params:{u_projMat:{type:"mat4"},u_viewMat:{type:"mat4"}}}]}};this.shader.init()};renderDebug.prototype.hide=function(){this.hidden=!0};renderDebug.prototype.show=function(){this.hidden=!1};renderDebug.prototype.line=function(a,b,f,g){this.hidden||(f==void 0&&(f=[1,1,1,1]),g==void 0&&(g=f),this.lineBuffer.push([a,b,f,g]))}; 102fshader:"defaultFShader",attributes:{a_pos:{type:"vec3"},a_color:{type:"vec4"}},params:{u_projMat:{type:"mat4"},u_viewMat:{type:"mat4"}}}]}};this.shader.init()};renderDebug.prototype.hide=function(){this.hidden=!0};renderDebug.prototype.show=function(){this.hidden=!1};renderDebug.prototype.line=function(a,b,f,g){this.hidden||(f==void 0&&(f=[1,1,1,1]),g==void 0&&(g=f),this.lineBuffer.push([a,b,f,g]))};
103renderDebug.prototype.box=function(a,b,f){this.line([a[0],a[1],a[2]],[b[0],a[1],a[2]],f,f);this.line([b[0],a[1],a[2]],[b[0],b[1],a[2]],f,f);this.line([b[0],b[1],a[2]],[a[0],b[1],a[2]],f,f);this.line([a[0],b[1],a[2]],[a[0],a[1],a[2]],f,f);this.line([a[0],a[1],b[2]],[b[0],a[1],b[2]],f,f);this.line([b[0],a[1],b[2]],[b[0],b[1],b[2]],f,f);this.line([b[0],b[1],b[2]],[a[0],b[1],b[2]],f,f);this.line([a[0],b[1],b[2]],[a[0],a[1],b[2]],f,f);this.line([b[0],a[1],a[2]],[b[0],a[1],b[2]],f,f);this.line([b[0],b[1], 103renderDebug.prototype.box=function(a,b,f){this.line([a[0],a[1],a[2]],[b[0],a[1],a[2]],f,f);this.line([b[0],a[1],a[2]],[b[0],b[1],a[2]],f,f);this.line([b[0],b[1],a[2]],[a[0],b[1],a[2]],f,f);this.line([a[0],b[1],a[2]],[a[0],a[1],a[2]],f,f);this.line([a[0],a[1],b[2]],[b[0],a[1],b[2]],f,f);this.line([b[0],a[1],b[2]],[b[0],b[1],b[2]],f,f);this.line([b[0],b[1],b[2]],[a[0],b[1],b[2]],f,f);this.line([a[0],b[1],b[2]],[a[0],a[1],b[2]],f,f);this.line([b[0],a[1],a[2]],[b[0],a[1],b[2]],f,f);this.line([b[0],b[1],
104a[2]],[b[0],b[1],b[2]],f,f);this.line([a[0],b[1],a[2]],[a[0],b[1],b[2]],f,f);this.line([a[0],a[1],a[2]],[a[0],a[1],b[2]],f,f)};renderDebug.prototype.frustum=function(a,b){this.line(a[0],a[1],b,b);this.line(a[1],a[2],b,b);this.line(a[2],a[3],b,b);this.line(a[3],a[4],b,b);this.line(a[4],a[5],b,b);this.line(a[5],a[6],b,b);this.line(a[6],a[7],b,b)}; 104a[2]],[b[0],b[1],b[2]],f,f);this.line([a[0],b[1],a[2]],[a[0],b[1],b[2]],f,f);this.line([a[0],a[1],a[2]],[a[0],a[1],b[2]],f,f)};renderDebug.prototype.frustum=function(a,b){this.line(a[0],a[1],b,b);this.line(a[1],a[2],b,b);this.line(a[2],a[3],b,b);this.line(a[3],a[4],b,b);this.line(a[4],a[5],b,b);this.line(a[5],a[6],b,b);this.line(a[6],a[7],b,b)};
105renderDebug.prototype.sphere=function(a,b,f){for(var g=0,h=Math.PI/8,l=0,n=2*Math.PI/8;g<Math.PI;){for(var o=Math.sin(g),q=Math.cos(g);l<2*Math.PI;){var p=Math.sin(l),r=Math.cos(l),s=a[0]+r*o*b,u=a[1]+q*b,v=a[2]+p*o*b;l+=n;var p=Math.sin(l),r=Math.cos(l),r=a[0]+r*o*b,x=a[1]+q*b,p=a[2]+p*o*b;l+=n;this.line([s,u,v],[r,x,p],f)}g+=h}}; 105renderDebug.prototype.sphere=function(a,b,f){for(var g=0,h=Math.PI/8,l=0,n=2*Math.PI/8;g<Math.PI;){for(var o=Math.sin(g),p=Math.cos(g);l<2*Math.PI;){var q=Math.sin(l),r=Math.cos(l),s=a[0]+r*o*b,u=a[1]+p*b,v=a[2]+q*o*b;l+=n;var q=Math.sin(l),r=Math.cos(l),r=a[0]+r*o*b,x=a[1]+p*b,q=a[2]+q*o*b;l+=n;this.line([s,u,v],[r,x,q],f)}g+=h}};
106renderDebug.prototype.flush=function(){var a=0,b=this.renderer.cameraManager().getActiveCamera();mat4.inplace_copy(this.ctx.projectionMatrix,b.proj);for(mat4.inplace_copy(this.ctx.mvMatrix,b.view);this.lineBuffer.length>0;)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+ 106renderDebug.prototype.flush=function(){var a=0,b=this.renderer.cameraManager().getActiveCamera();mat4.inplace_copy(this.ctx.projectionMatrix,b.proj);for(mat4.inplace_copy(this.ctx.mvMatrix,b.view);this.lineBuffer.length>0;)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+
1075]=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, 1075]=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,
108this.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, 108this.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,
1094,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}, 1094,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()