From 15c899b46f088844c4bc7aaa99a15f090016b46a Mon Sep 17 00:00:00 2001 From: alteredq Date: Wed, 12 Oct 2011 14:05:30 +0200 Subject: [PATCH] Added renderer.shadowMapAutoUpdate parameter. This is for being able to render shadowmap just once per frame - all dynamic cubemap faces and full scene can share the same shadowmap (at least until we don't have camera-specific fine-tuned shadowmaps). --- build/Three.js | 286 +++++++++++++-------------- build/custom/ThreeWebGL.js | 54 ++--- examples/webgl_shading_physical.html | 3 + src/renderers/WebGLRenderer.js | 10 +- 4 files changed, 182 insertions(+), 171 deletions(-) diff --git a/build/Three.js b/build/Three.js index f2a09d76..3d50806a 100644 --- a/build/Three.js +++ b/build/Three.js @@ -16,20 +16,20 @@ c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3}; THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c0&&b>0&&k+b<1}for(var f,h=[],k=0,m=b.children.length;kb.scale.x)return[];f={distance:k,point:b.position,face:null,object:b};h.push(f)}else if(b instanceof THREE.Mesh){k=c(this.origin, -this.direction,b.matrixWorld.getPosition());if(k==null||k>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return h;for(var n,u,t,w,o,x,v,z,A=b.geometry,y=A.vertices,k=0,m=A.faces.length;k0:x<0)))if(x=o.dot((new THREE.Vector3).sub(n,v))/x,v=v.addSelf(z.multiplyScalar(x)),f instanceof THREE.Face3)e(v,n,u,t)&&(f={distance:this.origin.distanceTo(v),point:v,face:f,object:b},h.push(f));else if(f instanceof THREE.Face4&&(e(v,n,u,w)||e(v,u,t,w)))f={distance:this.origin.distanceTo(v),point:v,face:f,object:b},h.push(f)}return h}}; +this.direction,b.matrixWorld.getPosition());if(k==null||k>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return h;for(var n,u,t,w,o,x,v,A,z=b.geometry,y=z.vertices,k=0,m=z.faces.length;k0:x<0)))if(x=o.dot((new THREE.Vector3).sub(n,v))/x,v=v.addSelf(A.multiplyScalar(x)),f instanceof THREE.Face3)e(v,n,u,t)&&(f={distance:this.origin.distanceTo(v),point:v,face:f,object:b},h.push(f));else if(f instanceof THREE.Face4&&(e(v,n,u,w)||e(v,u,t,w)))f={distance:this.origin.distanceTo(v),point:v,face:f,object:b},h.push(f)}return h}}; THREE.Rectangle=function(){function b(){k=f-c;m=h-e}var c,e,f,h,k,m,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return m};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,m,w,o){n=!1;c=k;e=m;f=w;h=o;b()};this.addPoint=function(k,m){n?(n=!1,c=k,e=m,f=k,h=m):(c=ck?f:k,h=h>m?h:m);b()};this.add3Points= function(k,m,w,o,x,v){n?(n=!1,c=kw?k>x?k:x:w>x?w:x,h=m>o?m>v?m:v:o>v?o:v):(c=kw?k>x?k>f?k:f:x>f?x:f:w>x?w>f?w:f:x>f?x:f,h=m>o?m>v?m>h?m:h:v>h?v:h:o>v?o>h?o:h:v>h?v:h);b()};this.addRectangle=function(k){n?(n=!1,c=k.getLeft(),e=k.getTop(),f=k.getRight(),h=k.getBottom()):(c=ck.getRight()?f:k.getRight(),h=h> k.getBottom()?h:k.getBottom());b()};this.inflate=function(k){c-=k;e-=k;f+=k;h+=k;b()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();e=e>k.getTop()?e:k.getTop();f=f=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){n=!0;h=f=e=c=0;b()};this.isEmpty=function(){return n}};THREE.Matrix3=function(){this.m=[]}; THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}}; -THREE.Matrix4=function(b,c,e,f,h,k,m,n,u,t,w,o,x,v,z,A){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,k!==void 0?k:1,m||0,n||0,u||0,t||0,w!==void 0?w:1,o||0,x||0,v||0,z||0,A!==void 0?A:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; -THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,u,t,w,o,x,v,z,A){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=m;this.n24=n;this.n31=u;this.n32=t;this.n33=w;this.n34=o;this.n41=x;this.n42=v;this.n43=z;this.n44=A;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, +THREE.Matrix4=function(b,c,e,f,h,k,m,n,u,t,w,o,x,v,A,z){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,k!==void 0?k:1,m||0,n||0,u||0,t||0,w!==void 0?w:1,o||0,x||0,v||0,A||0,z!==void 0?z:1);this.flat=Array(16);this.m33=new THREE.Matrix3}; +THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,u,t,w,o,x,v,A,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=m;this.n24=n;this.n31=u;this.n32=t;this.n33=w;this.n34=o;this.n41=x;this.n42=v;this.n43=A;this.n44=z;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b, c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*h; b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+ -e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,u=b.n23,t=b.n24,w=b.n31,o=b.n32,x=b.n33,v=b.n34,z=b.n41,A=b.n42,y=b.n43,E=b.n44,F=c.n11,C=c.n12, -G=c.n13,J=c.n14,M=c.n21,K=c.n22,B=c.n23,L=c.n24,Y=c.n31,H=c.n32,T=c.n33,Q=c.n34,Z=c.n41,$=c.n42,P=c.n43,p=c.n44;this.n11=e*F+f*M+h*Y+k*Z;this.n12=e*C+f*K+h*H+k*$;this.n13=e*G+f*B+h*T+k*P;this.n14=e*J+f*L+h*Q+k*p;this.n21=m*F+n*M+u*Y+t*Z;this.n22=m*C+n*K+u*H+t*$;this.n23=m*G+n*B+u*T+t*P;this.n24=m*J+n*L+u*Q+t*p;this.n31=w*F+o*M+x*Y+v*Z;this.n32=w*C+o*K+x*H+v*$;this.n33=w*G+o*B+x*T+v*P;this.n34=w*J+o*L+x*Q+v*p;this.n41=z*F+A*M+y*Y+E*Z;this.n42=z*C+A*K+y*H+E*$;this.n43=z*G+A*B+y*T+E*P;this.n44=z*J+A* +e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,u=b.n23,t=b.n24,w=b.n31,o=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,E=b.n44,F=c.n11,C=c.n12, +G=c.n13,J=c.n14,M=c.n21,K=c.n22,B=c.n23,L=c.n24,Y=c.n31,H=c.n32,T=c.n33,Q=c.n34,Z=c.n41,$=c.n42,P=c.n43,p=c.n44;this.n11=e*F+f*M+h*Y+k*Z;this.n12=e*C+f*K+h*H+k*$;this.n13=e*G+f*B+h*T+k*P;this.n14=e*J+f*L+h*Q+k*p;this.n21=m*F+n*M+u*Y+t*Z;this.n22=m*C+n*K+u*H+t*$;this.n23=m*G+n*B+u*T+t*P;this.n24=m*J+n*L+u*Q+t*p;this.n31=w*F+o*M+x*Y+v*Z;this.n32=w*C+o*K+x*H+v*$;this.n33=w*G+o*B+x*T+v*P;this.n34=w*J+o*L+x*Q+v*p;this.n41=A*F+z*M+y*Y+E*Z;this.n42=A*C+z*K+y*H+E*$;this.n43=A*G+z*B+y*T+E*P;this.n44=A*J+z* L+y*Q+E*p;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*= -b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,k=this.n22,m=this.n23,n=this.n24,u=this.n31,t=this.n32,w=this.n33,o=this.n34,x=this.n41,v=this.n42,z=this.n43,A=this.n44;return f*m*t*x-e*n*t*x-f*k*w*x+c*n*w*x+e*k*o*x-c*m*o*x-f*m*u*v+e*n*u*v+f*h*w*v-b*n*w*v-e*h*o*v+b*m*o*v+f*k*u*z-c*n*u*z-f*h*t*z+b*n*t*z+c*h*o*z-b*k*o*z-e*k*u*A+c*m*u*A+e*h*t*A-b*m*t*A-c*h*w*A+b*k*w*A}, +b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,h=this.n21,k=this.n22,m=this.n23,n=this.n24,u=this.n31,t=this.n32,w=this.n33,o=this.n34,x=this.n41,v=this.n42,A=this.n43,z=this.n44;return f*m*t*x-e*n*t*x-f*k*w*x+c*n*w*x+e*k*o*x-c*m*o*x-f*m*u*v+e*n*u*v+f*h*w*v-b*n*w*v-e*h*o*v+b*m*o*v+f*k*u*A-c*n*u*A-f*h*t*A+b*n*t*A+c*h*o*A-b*k*o*A-e*k*u*z+c*m*u*z+e*h*t*z-b*m*t*z-c*h*w*z+b*k*w*z}, transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34; b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(b){b[0]=this.n11; b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34; @@ -42,8 +42,8 @@ b.x,e=b.y,f=b.z,h=b.w,k=c+c,m=e+e,n=f+f,b=c*k,u=c*m;c*=n;var t=e*m;e*=n;f*=n;k*= f.identity();f.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(f,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,k=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);k.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length(); e.y=h.length();e.z=k.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var e=1/c.x,f=1/c.y,h=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*h;this.n23= b.n23*h;this.n33=b.n33*h}}; -THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,u=b.n23,t=b.n24,w=b.n31,o=b.n32,x=b.n33,v=b.n34,z=b.n41,A=b.n42,y=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=u*v*A-t*x*A+t*o*y-n*v*y-u*o*E+n*x*E;c.n12=k*x*A-h*v*A-k*o*y+f*v*y+h*o*E-f*x*E;c.n13=h*t*A-k*u*A+k*n*y-f*t*y-h*n*E+f*u*E;c.n14=k*u*o-h*t*o-k*n*x+f*t*x+h*n*v-f*u*v;c.n21=t*x*z-u*v*z-t*w*y+m*v*y+u*w*E-m*x*E;c.n22=h*v*z-k*x*z+k*w*y-e*v*y-h*w*E+e*x*E;c.n23=k*u*z-h*t*z-k*m*y+e*t*y+h*m*E-e*u*E;c.n24= -h*t*w-k*u*w+k*m*x-e*t*x-h*m*v+e*u*v;c.n31=n*v*z-t*o*z+t*w*A-m*v*A-n*w*E+m*o*E;c.n32=k*o*z-f*v*z-k*w*A+e*v*A+f*w*E-e*o*E;c.n33=h*t*z-k*n*z+k*m*A-e*t*A-f*m*E+e*n*E;c.n34=k*n*w-f*t*w-k*m*o+e*t*o+f*m*v-e*n*v;c.n41=u*o*z-n*x*z-u*w*A+m*x*A+n*w*y-m*o*y;c.n42=f*x*z-h*o*z+h*w*A-e*x*A-f*w*y+e*o*y;c.n43=h*n*z-f*u*z-h*m*A+e*u*A+f*m*y-e*n*y;c.n44=f*u*w-h*n*w+h*m*o-e*u*o-f*m*x+e*n*x;c.multiplyScalar(1/b.determinant());return c}; +THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,u=b.n23,t=b.n24,w=b.n31,o=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=u*v*z-t*x*z+t*o*y-n*v*y-u*o*E+n*x*E;c.n12=k*x*z-h*v*z-k*o*y+f*v*y+h*o*E-f*x*E;c.n13=h*t*z-k*u*z+k*n*y-f*t*y-h*n*E+f*u*E;c.n14=k*u*o-h*t*o-k*n*x+f*t*x+h*n*v-f*u*v;c.n21=t*x*A-u*v*A-t*w*y+m*v*y+u*w*E-m*x*E;c.n22=h*v*A-k*x*A+k*w*y-e*v*y-h*w*E+e*x*E;c.n23=k*u*A-h*t*A-k*m*y+e*t*y+h*m*E-e*u*E;c.n24= +h*t*w-k*u*w+k*m*x-e*t*x-h*m*v+e*u*v;c.n31=n*v*A-t*o*A+t*w*z-m*v*z-n*w*E+m*o*E;c.n32=k*o*A-f*v*A-k*w*z+e*v*z+f*w*E-e*o*E;c.n33=h*t*A-k*n*A+k*m*z-e*t*z-f*m*E+e*n*E;c.n34=k*n*w-f*t*w-k*m*o+e*t*o+f*m*v-e*n*v;c.n41=u*o*A-n*x*A-u*w*z+m*x*z+n*w*y-m*o*y;c.n42=f*x*A-h*o*A+h*w*z-e*x*z-f*w*y+e*o*y;c.n43=h*n*A-f*u*A-h*m*z+e*u*z+f*m*y-e*n*y;c.n44=f*u*w-h*n*w+h*m*o-e*u*o-f*m*x+e*n*x;c.multiplyScalar(1/b.determinant());return c}; THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,k=b.n32*b.n21-b.n31*b.n22,m=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,u=-b.n32*b.n11+b.n31*b.n12,t=b.n23*b.n12-b.n22*b.n13,w=-b.n23*b.n11+b.n21*b.n13,o=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*m+b.n31*t;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*k;e[3]=b*m;e[4]=b*n;e[5]=b*u;e[6]=b*t;e[7]=b*w;e[8]=b*o;return c}; THREE.Matrix4.makeFrustum=function(b,c,e,f,h,k){var m;m=new THREE.Matrix4;m.n11=2*h/(c-b);m.n12=0;m.n13=(c+b)/(c-b);m.n14=0;m.n21=0;m.n22=2*h/(f-e);m.n23=(f+e)/(f-e);m.n24=0;m.n31=0;m.n32=0;m.n33=-(k+h)/(k-h);m.n34=-2*k*h/(k-h);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)}; THREE.Matrix4.makeOrtho=function(b,c,e,f,h,k){var m,n,u,t;m=new THREE.Matrix4;n=c-b;u=e-f;t=k-h;m.n11=2/n;m.n12=0;m.n13=0;m.n14=-((c+b)/n);m.n21=0;m.n22=2/u;m.n23=0;m.n24=-((e+f)/u);m.n31=0;m.n32=0;m.n33=-2/t;m.n34=-((k+h)/t);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4; @@ -54,16 +54,16 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&& this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),fG&&m.positionScreen.z0&&K.z<1))ia=C[F]=C[F]||new THREE.RenderableParticle,F++,E=ia,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=U.rotation.z,E.scale.x=U.scale.x*Math.abs(E.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),E.scale.y=U.scale.y*Math.abs(E.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),E.materials=U.materials,J.push(E);h&&J.sort(c);return J}}; THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)}; THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=Math.PI/360,e=b.x*c,f=b.y*c,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),k=Math.cos(e),e=Math.sin(e),m=b*c,n=f*h;this.w=m*k-n*e;this.x=m*e+n*k;this.y=f*c*k+b*h*e;this.z=b*h*k-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e); @@ -79,8 +79,8 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid e,f,h,k,m,n=new THREE.Vector3,u=new THREE.Vector3;f=0;for(h=this.faces.length;f0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y, this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;cthis.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.ythis.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.zthis.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+ -Math.floor(z.b*255)+","+A+")"),v.fillRect(Math.floor(S.getX()),Math.floor(S.getY()),Math.floor(S.getWidth()),Math.floor(S.getHeight()))),S.empty())};this.render=function(b,u){function t(b){var c,e,f,k=b.lights;N.setRGB(0,0,0);ma.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=k.length;b0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+ +Math.floor(A.b*255)+","+z+")"),v.fillRect(Math.floor(S.getX()),Math.floor(S.getY()),Math.floor(S.getWidth()),Math.floor(S.getHeight()))),S.empty())};this.render=function(b,u){function t(b){var c,e,f,k=b.lights;N.setRGB(0,0,0);ma.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=k.length;b>1,xa=t.height>>1,m=k.scale.x*o,u=k.scale.y*x,p=m*w,n=u*xa,O.set(b.x-p,b.y-n,b.x+p,b.y+n),za.intersects(O)&&(v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(m,-u),v.translate(-w,-xa),v.drawImage(t,0,0),v.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(p=k.scale.x*o,n=k.scale.y*x,O.set(b.x-p,b.y-n,b.x+p,b.y+n),za.intersects(O)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(p,n),m.program(v), v.restore()))}function eb(b,k,h,m){c(m.opacity);e(m.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(k.positionScreen.x,k.positionScreen.y);v.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(G!=b)v.lineWidth=G=b;b=m.linecap;if(J!=b)v.lineCap=J=b;b=m.linejoin;if(M!=b)v.lineJoin=M=b;f(m.color.getContextStyle());v.stroke();O.inflate(m.linewidth*2)}}function y(b,f,h,m,n,t,o,v,xa){k.info.render.vertices+=3;k.info.render.faces++;c(v.opacity);e(v.blending); Q=b.positionScreen.x;Z=b.positionScreen.y;$=f.positionScreen.x;P=f.positionScreen.y;p=h.positionScreen.x;V=h.positionScreen.y;F(Q,Z,$,P,p,V);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(ra=o.uvs[0],ab(Q,Z,$,P,p,V,ra[m].u,ra[m].v,ra[n].u,ra[n].v,ra[t].u,ra[t].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,oa.copy(o.vertexNormalsWorld[0]),sa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,ya= @@ -164,35 +164,35 @@ Q=b.positionScreen.x;Z=b.positionScreen.y;$=f.positionScreen.x;P=f.positionScree (v.map.mapping instanceof THREE.UVMapping&&(ra=o.uvs[0],ab(Q,Z,$,P,p,V,ra[m].u,ra[m].v,ra[n].u,ra[n].v,ra[t].u,ra[t].v,v.map)),e(THREE.SubtractiveBlending)),da?!v.wireframe&&v.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(W.r=U.r=ia.r=N.r,W.g=U.g=ia.g=N.g,W.b=U.b=ia.b=N.b,w(xa,o.v1.positionWorld,o.vertexNormalsWorld[0],W),w(xa,o.v2.positionWorld,o.vertexNormalsWorld[1],U),w(xa,o.v3.positionWorld,o.vertexNormalsWorld[2],ia),W.r=Math.max(0,Math.min(v.color.r*W.r,1)),W.g=Math.max(0,Math.min(v.color.g* W.g,1)),W.b=Math.max(0,Math.min(v.color.b*W.b,1)),U.r=Math.max(0,Math.min(v.color.r*U.r,1)),U.g=Math.max(0,Math.min(v.color.g*U.g,1)),U.b=Math.max(0,Math.min(v.color.b*U.b,1)),ia.r=Math.max(0,Math.min(v.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(v.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(v.color.b*ia.b,1)),ja.r=(U.r+ia.r)*0.5,ja.g=(U.g+ia.g)*0.5,ja.b=(U.b+ia.b)*0.5,pa=Ya(W,U,ia,ja),Ua(Q,Z,$,P,p,V,0,0,1,0,0,1,pa)):(qa.r=N.r,qa.g=N.g,qa.b=N.b,w(xa,o.centroidWorld,o.normalWorld,qa),aa.r=Math.max(0,Math.min(v.color.r* qa.r,1)),aa.g=Math.max(0,Math.min(v.color.g*qa.g,1)),aa.b=Math.max(0,Math.min(v.color.b*qa.b,1)),v.wireframe?Na(aa,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):C(aa)):v.wireframe?Na(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):C(v.color);else if(v instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,W.r=W.g=W.b=1-Qa(b.positionScreen.z,la,ca),U.r=U.g=U.b=1-Qa(f.positionScreen.z,la,ca),ia.r=ia.g=ia.b=1-Qa(h.positionScreen.z,la,ca),ja.r=(U.r+ia.r)*0.5,ja.g=(U.g+ -ia.g)*0.5,ja.b=(U.b+ia.b)*0.5,pa=Ya(W,U,ia,ja),Ua(Q,Z,$,P,p,V,0,0,1,0,0,1,pa);else if(v instanceof THREE.MeshNormalMaterial)aa.r=Va(o.normalWorld.x),aa.g=Va(o.normalWorld.y),aa.b=Va(o.normalWorld.z),v.wireframe?Na(aa,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):C(aa)}function z(b,f,h,m,n,t,v,o,xa){k.info.render.vertices+=4;k.info.render.faces++;c(o.opacity);e(o.blending);if(o.map||o.envMap)y(b,f,m,0,1,3,v,o,xa),y(n,h,t,1,2,3,v,o,xa);else if(Q=b.positionScreen.x,Z=b.positionScreen.y, +ia.g)*0.5,ja.b=(U.b+ia.b)*0.5,pa=Ya(W,U,ia,ja),Ua(Q,Z,$,P,p,V,0,0,1,0,0,1,pa);else if(v instanceof THREE.MeshNormalMaterial)aa.r=Va(o.normalWorld.x),aa.g=Va(o.normalWorld.y),aa.b=Va(o.normalWorld.z),v.wireframe?Na(aa,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):C(aa)}function A(b,f,h,m,n,t,v,o,xa){k.info.render.vertices+=4;k.info.render.faces++;c(o.opacity);e(o.blending);if(o.map||o.envMap)y(b,f,m,0,1,3,v,o,xa),y(n,h,t,1,2,3,v,o,xa);else if(Q=b.positionScreen.x,Z=b.positionScreen.y, $=f.positionScreen.x,P=f.positionScreen.y,p=h.positionScreen.x,V=h.positionScreen.y,fa=m.positionScreen.x,ea=m.positionScreen.y,ha=n.positionScreen.x,ga=n.positionScreen.y,ka=t.positionScreen.x,na=t.positionScreen.y,o instanceof THREE.MeshBasicMaterial)E(Q,Z,$,P,p,V,fa,ea),o.wireframe?Na(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):C(o.color);else if(o instanceof THREE.MeshLambertMaterial)da?!o.wireframe&&o.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==4?(W.r= U.r=ia.r=ja.r=N.r,W.g=U.g=ia.g=ja.g=N.g,W.b=U.b=ia.b=ja.b=N.b,w(xa,v.v1.positionWorld,v.vertexNormalsWorld[0],W),w(xa,v.v2.positionWorld,v.vertexNormalsWorld[1],U),w(xa,v.v4.positionWorld,v.vertexNormalsWorld[3],ia),w(xa,v.v3.positionWorld,v.vertexNormalsWorld[2],ja),W.r=Math.max(0,Math.min(o.color.r*W.r,1)),W.g=Math.max(0,Math.min(o.color.g*W.g,1)),W.b=Math.max(0,Math.min(o.color.b*W.b,1)),U.r=Math.max(0,Math.min(o.color.r*U.r,1)),U.g=Math.max(0,Math.min(o.color.g*U.g,1)),U.b=Math.max(0,Math.min(o.color.b* U.b,1)),ia.r=Math.max(0,Math.min(o.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(o.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(o.color.b*ia.b,1)),ja.r=Math.max(0,Math.min(o.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(o.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(o.color.b*ja.b,1)),pa=Ya(W,U,ia,ja),F(Q,Z,$,P,fa,ea),Ua(Q,Z,$,P,fa,ea,0,0,1,0,0,1,pa),F(ha,ga,p,V,ka,na),Ua(ha,ga,p,V,ka,na,1,0,1,1,0,1,pa)):(qa.r=N.r,qa.g=N.g,qa.b=N.b,w(xa,v.centroidWorld,v.normalWorld,qa),aa.r=Math.max(0,Math.min(o.color.r*qa.r, 1)),aa.g=Math.max(0,Math.min(o.color.g*qa.g,1)),aa.b=Math.max(0,Math.min(o.color.b*qa.b,1)),E(Q,Z,$,P,p,V,fa,ea),o.wireframe?Na(aa,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):C(aa)):(E(Q,Z,$,P,p,V,fa,ea),o.wireframe?Na(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):C(o.color));else if(o instanceof THREE.MeshNormalMaterial)aa.r=Va(v.normalWorld.x),aa.g=Va(v.normalWorld.y),aa.b=Va(v.normalWorld.z),E(Q,Z,$,P,p,V,fa,ea),o.wireframe?Na(aa,o.wireframeLinewidth,o.wireframeLinecap, o.wireframeLinejoin):C(aa);else if(o instanceof THREE.MeshDepthMaterial)la=u.near,ca=u.far,W.r=W.g=W.b=1-Qa(b.positionScreen.z,la,ca),U.r=U.g=U.b=1-Qa(f.positionScreen.z,la,ca),ia.r=ia.g=ia.b=1-Qa(m.positionScreen.z,la,ca),ja.r=ja.g=ja.b=1-Qa(h.positionScreen.z,la,ca),pa=Ya(W,U,ia,ja),F(Q,Z,$,P,fa,ea),Ua(Q,Z,$,P,fa,ea,0,0,1,0,0,1,pa),F(ha,ga,p,V,ka,na),Ua(ha,ga,p,V,ka,na,1,0,1,1,0,1,pa)}function F(b,c,e,f,k,h){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(b,c);v.closePath()}function E(b, c,e,f,k,h,m,p){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(m,p);v.lineTo(b,c);v.closePath()}function Na(b,c,e,k){if(G!=c)v.lineWidth=G=c;if(J!=e)v.lineCap=J=e;if(M!=k)v.lineJoin=M=k;f(b.getContextStyle());v.stroke();O.inflate(c*2)}function C(b){h(b.getContextStyle());v.fill()}function ab(b,c,e,f,k,m,p,n,u,o,t,xa,w){if(w.image.width!=0){if(w.needsUpdate==!0||ta[w.id]==void 0){var x=w.wrapS==THREE.RepeatWrapping,S=w.wrapT==THREE.RepeatWrapping;ta[w.id]=v.createPattern(w.image,x&& -S?"repeat":x&&!S?"repeat-x":!x&&S?"repeat-y":"no-repeat");w.needsUpdate=!1}h(ta[w.id]);var x=w.offset.x/w.repeat.x,S=w.offset.y/w.repeat.y,A=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,p=(p+x)*A,n=(n+S)*w,u=(u+x)*A,o=(o+S)*w,t=(t+x)*A,xa=(xa+S)*w;e-=b;f-=c;k-=b;m-=c;u-=p;o-=n;t-=p;xa-=n;x=1/(u*xa-t*o);w=(xa*e-o*k)*x;o=(xa*f-o*m)*x;e=(u*k-t*e)*x;f=(u*m-t*f)*x;b=b-w*p-e*n;c=c-o*p-f*n;v.save();v.transform(w,o,e,f,b,c);v.fill();v.restore()}}function Ua(b,c,e,f,k,h,m,p,n,u,o,t,w){var xa, +S?"repeat":x&&!S?"repeat-x":!x&&S?"repeat-y":"no-repeat");w.needsUpdate=!1}h(ta[w.id]);var x=w.offset.x/w.repeat.x,S=w.offset.y/w.repeat.y,z=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,p=(p+x)*z,n=(n+S)*w,u=(u+x)*z,o=(o+S)*w,t=(t+x)*z,xa=(xa+S)*w;e-=b;f-=c;k-=b;m-=c;u-=p;o-=n;t-=p;xa-=n;x=1/(u*xa-t*o);w=(xa*e-o*k)*x;o=(xa*f-o*m)*x;e=(u*k-t*e)*x;f=(u*m-t*f)*x;b=b-w*p-e*n;c=c-o*p-f*n;v.save();v.transform(w,o,e,f,b,c);v.fill();v.restore()}}function Ua(b,c,e,f,k,h,m,p,n,u,o,t,w){var xa, x;xa=w.width-1;x=w.height-1;m*=xa;p*=x;n*=xa;u*=x;o*=xa;t*=x;e-=b;f-=c;k-=b;h-=c;n-=m;u-=p;o-=m;t-=p;x=1/(n*t-o*u);xa=(t*e-u*k)*x;u=(t*f-u*h)*x;e=(n*k-o*e)*x;f=(n*h-o*f)*x;b=b-xa*m-e*p;c=c-u*m-f*p;v.save();v.transform(xa,u,e,f,b,c);v.clip();v.drawImage(w,0,0);v.restore()}function Ya(b,c,e,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),u=~~(e.g*255),e=~~(e.b*255),o=~~(f.r*255),t=~~(f.g*255),f=~~(f.b*255);va[0]=k<0?0:k>255?255:k;va[1]=h<0?0: h>255?255:h;va[2]=b<0?0:b>255?255:b;va[4]=m<0?0:m>255?255:m;va[5]=p<0?0:p>255?255:p;va[6]=c<0?0:c>255?255:c;va[8]=n<0?0:n>255?255:n;va[9]=u<0?0:u>255?255:u;va[10]=e<0?0:e>255?255:e;va[12]=o<0?0:o>255?255:o;va[13]=t<0?0:t>255?255:t;va[14]=f<0?0:f>255?255:f;Ia.putImageData(Ba,0,0);Ha.drawImage(Ea,0,0);return Ka}function Qa(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Va(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Oa(b,c){var e=c.x-b.x,f=c.y-b.y,k=e*e+f*f;k!=0&&(k=1/Math.sqrt(k),e*=k,f*=k,c.x+= -e,c.y+=f,b.x-=e,b.y-=f)}var Za,bb,wa,Ja,Pa,Wa,$a,Aa;this.autoClear?this.clear():v.setTransform(1,0,0,-1,o,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,u,this.sortElements);(da=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za0)&&t(b);Za=0;for(bb=m.length;Za0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m)):h instanceof THREE.PointLight&&(Y.sub(h.position,c.centroidWorld),Y.normalize(),m=c.normalWorld.dot(Y)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m))}function c(c,e,m,n,o,t){k.info.render.vertices+=3;k.info.render.faces++;Q=f(Z++); Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?G.copy(o.color):o instanceof THREE.MeshLambertMaterial?C?(J.r=M.r,J.g=M.g,J.b=M.b,b(t,n,J),G.r=Math.max(0,Math.min(o.color.r*J.r,1)),G.g=Math.max(0,Math.min(o.color.g*J.g,1)),G.b=Math.max(0,Math.min(o.color.b*J.b,1))):G.copy(o.color):o instanceof THREE.MeshDepthMaterial?(L=1-o.__2near/(o.__farPlusNear- n.z*o.__farMinusNear),G.setRGB(L,L,L)):o instanceof THREE.MeshNormalMaterial&&G.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));o.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+o.opacity);u.appendChild(Q)}function e(c,e,m,n,o,t,v){k.info.render.vertices+= 4;k.info.render.faces++;Q=f(Z++);Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?G.copy(t.color):t instanceof THREE.MeshLambertMaterial?C?(J.r=M.r,J.g=M.g,J.b=M.b,b(v,o,J),G.r=Math.max(0,Math.min(t.color.r*J.r,1)),G.g=Math.max(0,Math.min(t.color.g*J.g,1)),G.b=Math.max(0,Math.min(t.color.b*J.b,1))): G.copy(t.color):t instanceof THREE.MeshDepthMaterial?(L=1-t.__2near/(t.__farPlusNear-o.z*t.__farMinusNear),G.setRGB(L,L,L)):t instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));t.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+ -"; fill-opacity: "+t.opacity);u.appendChild(Q)}function f(b){H[b]==null&&(H[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),P==0&&H[b].setAttribute("shape-rendering","crispEdges"));return H[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,w,o,x,v,z,A,y,E=new THREE.Rectangle,F=new THREE.Rectangle,C=!1,G=new THREE.Color(16777215),J=new THREE.Color(16777215),M=new THREE.Color(0), +"; fill-opacity: "+t.opacity);u.appendChild(Q)}function f(b){H[b]==null&&(H[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),P==0&&H[b].setAttribute("shape-rendering","crispEdges"));return H[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,w,o,x,v,A,z,y,E=new THREE.Rectangle,F=new THREE.Rectangle,C=!1,G=new THREE.Color(16777215),J=new THREE.Color(16777215),M=new THREE.Color(0), K=new THREE.Color(0),B=new THREE.Color(0),L,Y=new THREE.Vector3,H=[],T=[],Q,Z,$,P=1;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":P=1;break;case "low":P=0}};this.setSize=function(b,c){t=b;w=c;o=t/2;x=w/2;u.setAttribute("viewBox",-o+" "+-x+" "+t+" "+w);u.setAttribute("width",t);u.setAttribute("height",w);E.set(-o,-x,o,x)};this.clear=function(){for(;u.childNodes.length>0;)u.removeChild(u.childNodes[0])}; this.render=function(b,f){var h,t,w,G,H,L,J,W;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);$=Z=0;if(C=b.lights.length>0){J=b.lights;M.setRGB(0,0,0);K.setRGB(0,0,0);B.setRGB(0,0,0);h=0;for(t=J.length;h=0)c&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglVertexBuffer),p.vertexAttribPointer(b.position,3,p.FLOAT,!1,0,0));else if(m.morphTargetBase){f=h.program.attributes;m.morphTargetBase!== -1?(p.bindBuffer(p.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[m.morphTargetBase]),p.vertexAttribPointer(f.position,3,p.FLOAT,!1,0,0)):f.position>=0&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglVertexBuffer),p.vertexAttribPointer(f.position,3,p.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var o=0,t=m.morphTargetForcedOrder,u=m.morphTargetInfluences;ov&&(w=x,v=u[w]);p.bindBuffer(p.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[w]);p.vertexAttribPointer(f["morphTarget"+o],3,p.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[o]=v;t[w]=1;v=-1;o++}}h.program.uniforms.morphTargetInfluences!==null&&p.uniform1fv(h.program.uniforms.morphTargetInfluences, +p.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[o]=u[t[o]],o++;else{var t=[],v=-1,w=0,u=m.morphTargetInfluences,x,z=u.length,o=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);ov&&(w=x,v=u[w]);p.bindBuffer(p.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[w]);p.vertexAttribPointer(f["morphTarget"+o],3,p.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[o]=v;t[w]=1;v=-1;o++}}h.program.uniforms.morphTargetInfluences!==null&&p.uniform1fv(h.program.uniforms.morphTargetInfluences, m.__webglMorphTargetInfluences)}if(c){if(k.__webglCustomAttributes)for(n in k.__webglCustomAttributes)b[n]>=0&&(f=k.__webglCustomAttributes[n],p.bindBuffer(p.ARRAY_BUFFER,f.buffer),p.vertexAttribPointer(b[n],f.size,p.FLOAT,!1,0,0));b.color>=0&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglColorBuffer),p.vertexAttribPointer(b.color,3,p.FLOAT,!1,0,0));b.normal>=0&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglNormalBuffer),p.vertexAttribPointer(b.normal,3,p.FLOAT,!1,0,0));b.tangent>=0&&(p.bindBuffer(p.ARRAY_BUFFER, k.__webglTangentBuffer),p.vertexAttribPointer(b.tangent,4,p.FLOAT,!1,0,0));b.uv>=0&&(k.__webglUVBuffer?(p.bindBuffer(p.ARRAY_BUFFER,k.__webglUVBuffer),p.vertexAttribPointer(b.uv,2,p.FLOAT,!1,0,0),p.enableVertexAttribArray(b.uv)):p.disableVertexAttribArray(b.uv));b.uv2>=0&&(k.__webglUV2Buffer?(p.bindBuffer(p.ARRAY_BUFFER,k.__webglUV2Buffer),p.vertexAttribPointer(b.uv2,2,p.FLOAT,!1,0,0),p.enableVertexAttribArray(b.uv2)):p.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>= 0&&b.skinIndex>=0&&b.skinWeight>=0&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglSkinVertexABuffer),p.vertexAttribPointer(b.skinVertexA,4,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),p.vertexAttribPointer(b.skinVertexB,4,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),p.vertexAttribPointer(b.skinIndex,4,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,k.__webglSkinWeightsBuffer),p.vertexAttribPointer(b.skinWeight,4,p.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(h.wireframe? @@ -253,12 +253,12 @@ p.DYNAMIC_DRAW),p.enableVertexAttribArray(c.attributes.position),p.vertexAttribP b.normalArray,p.DYNAMIC_DRAW);p.enableVertexAttribArray(c.attributes.normal);p.vertexAttribPointer(c.attributes.normal,3,p.FLOAT,!1,0,0)}p.drawArrays(p.TRIANGLES,0,b.count);b.count=0}function k(b){if(na!=b.doubleSided)b.doubleSided?p.disable(p.CULL_FACE):p.enable(p.CULL_FACE),na=b.doubleSided;if(aa!=b.flipSided)b.flipSided?p.frontFace(p.CW):p.frontFace(p.CCW),aa=b.flipSided}function m(b){U!=b&&(b?p.enable(p.DEPTH_TEST):p.disable(p.DEPTH_TEST),U=b)}function n(b){ia!=b&&(p.depthMask(b),ia=b)}function u(b, c,e){ja!=b&&(b?p.enable(p.POLYGON_OFFSET_FILL):p.disable(p.POLYGON_OFFSET_FILL),ja=b);if(b&&(ta!=c||la!=e))p.polygonOffset(c,e),ta=c,la=e}function t(b){ya[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ya[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ya[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ya[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ya[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ya[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34); for(var c,b=0;b<6;b++)c=ya[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function w(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ya[f].x*c.n14+ya[f].y*c.n24+ya[f].z*c.n34+ya[f].w,b<=e)return!1;return!0}function o(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,k=b.opaque,h=b.transparent;h.count=0;b=k.count=0;for(c=f.materials.length;b0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);O=0;X.vertices[O++]=-1;X.vertices[O++]=-1;X.vertices[O++]=0;X.vertices[O++]=1;X.vertices[O++]=1;X.vertices[O++]=-1;X.vertices[O++]=1;X.vertices[O++]=1;X.vertices[O++]=1;X.vertices[O++]=1;X.vertices[O++]=1;X.vertices[O++]=0;X.vertices[O++]=-1; X.vertices[O++]=1;X.vertices[O++]=0;O=X.vertices[O++]=0;X.faces[O++]=0;X.faces[O++]=1;X.faces[O++]=2;X.faces[O++]=0;X.faces[O++]=2;X.faces[O++]=3;X.vertexBuffer=p.createBuffer();X.elementBuffer=p.createBuffer();p.bindBuffer(p.ARRAY_BUFFER,X.vertexBuffer);p.bufferData(p.ARRAY_BUFFER,X.vertices,p.STATIC_DRAW);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,X.elementBuffer);p.bufferData(p.ELEMENT_ARRAY_BUFFER,X.faces,p.STATIC_DRAW);X.program=p.createProgram();p.attachShader(X.program,Q("fragment",THREE.ShaderLib.sprite.fragmentShader)); p.attachShader(X.program,Q("vertex",THREE.ShaderLib.sprite.vertexShader));p.linkProgram(X.program);X.attributes={};X.uniforms={};X.attributes.position=p.getAttribLocation(X.program,"position");X.attributes.uv=p.getAttribLocation(X.program,"uv");X.uniforms.uvOffset=p.getUniformLocation(X.program,"uvOffset");X.uniforms.uvScale=p.getUniformLocation(X.program,"uvScale");X.uniforms.rotation=p.getUniformLocation(X.program,"rotation");X.uniforms.scale=p.getUniformLocation(X.program,"scale");X.uniforms.alignment= @@ -290,58 +290,58 @@ p.deleteBuffer(c.__webglFaceBuffer);p.deleteBuffer(c.__webglLineBuffer);if(c.num else if(b instanceof THREE.ParticleSystem)b=b.geometry,p.deleteBuffer(b.__webglVertexBuffer),p.deleteBuffer(b.__webglColorBuffer),P.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,p.deleteTexture(b.__webglTexture),P.info.memory.textures--};this.initMaterial=function(b,c,e,f){var k,h,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":b instanceof THREE.MeshLambertMaterial? n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var o=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(o.uniforms);b.vertexShader=o.vertexShader;b.fragmentShader=o.fragmentShader}var t,u,v;t=v=o=0;for(u=c.length;t=0&&p.enableVertexAttribArray(x.position);x.color>=0&&p.enableVertexAttribArray(x.color);x.normal>=0&&p.enableVertexAttribArray(x.normal);x.tangent>=0&&p.enableVertexAttribArray(x.tangent); -b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(p.enableVertexAttribArray(x.skinVertexA),p.enableVertexAttribArray(x.skinVertexB),p.enableVertexAttribArray(x.skinIndex),p.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(h in b.attributes)x[h]!==void 0&&x[h]>=0&&p.enableVertexAttribArray(x[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(p.enableVertexAttribArray(x[A]),b.numSupportedMorphTargets++); -b.uniformsList=[];for(k in b.uniforms)b.uniformsList.push([b.uniforms[k],k])};this.clearTarget=function(b,c,e,f){H(b);this.clear(c,e,f)};this.render=function(b,c,o,S){var O,da,F,C,G,qa,B,la,J=b.lights,ca=b.fog;ha=-1;this.shadowMapEnabled&&A(b,c);P.info.render.calls=0;P.info.render.vertices=0;P.info.render.faces=0;if(c.matrixAutoUpdate){for(G=c;G.parent;)G=G.parent;G.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Fa);c.projectionMatrix.flattenToArray(Ga);Ca.multiply(c.projectionMatrix, -c.matrixWorldInverse);t(Ca);this.initWebGLObjects(b);H(o);(this.autoClear||S)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);G=b.__webglObjects.length;for(S=0;S=0;S--)if(O=b.__webglObjects[S],O.render){B=O.object;la=O.buffer;F=O.opaque;k(B);for(O=0;O0||x.faceVertexUvs.length>0)m.__uvArray=new Float32Array(o* -2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(o*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(o*4),m.__skinVertexBArray=new Float32Array(o*4),m.__skinIndexArray=new Float32Array(o*4),m.__skinWeightArray=new Float32Array(o*4);m.__faceArray=new Uint16Array(A*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(S*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];x=0;for(y= -m.numMorphTargets;x=0&&p.enableVertexAttribArray(x.position);x.color>=0&&p.enableVertexAttribArray(x.color);x.normal>=0&&p.enableVertexAttribArray(x.normal);x.tangent>=0&&p.enableVertexAttribArray(x.tangent); +b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(p.enableVertexAttribArray(x.skinVertexA),p.enableVertexAttribArray(x.skinVertexB),p.enableVertexAttribArray(x.skinIndex),p.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(h in b.attributes)x[h]!==void 0&&x[h]>=0&&p.enableVertexAttribArray(x[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h=0&&(p.enableVertexAttribArray(x[y]),b.numSupportedMorphTargets++); +b.uniformsList=[];for(k in b.uniforms)b.uniformsList.push([b.uniforms[k],k])};this.clearTarget=function(b,c,e,f){H(b);this.clear(c,e,f)};this.updateShadowMap=function(b,c){z(b,c)};this.render=function(b,c,o,S){var O,da,F,C,G,qa,B,la,J=b.lights,ca=b.fog;ha=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&z(b,c);P.info.render.calls=0;P.info.render.vertices=0;P.info.render.faces=0;if(c.matrixAutoUpdate){for(G=c;G.parent;)G=G.parent;G.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Fa); +c.projectionMatrix.flattenToArray(Ga);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);t(Ca);this.initWebGLObjects(b);H(o);(this.autoClear||S)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);G=b.__webglObjects.length;for(S=0;S=0;S--)if(O=b.__webglObjects[S],O.render){B=O.object;la=O.buffer;F=O.opaque;k(B);for(O=0;O0||x.faceVertexUvs.length> +0)m.__uvArray=new Float32Array(o*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(o*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(o*4),m.__skinVertexBArray=new Float32Array(o*4),m.__skinIndexArray=new Float32Array(o*4),m.__skinWeightArray=new Float32Array(o*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(S*2);if(m.numMorphTargets){m.__morphTargetsArrays= +[];x=0;for(z=m.numMorphTargets;x=0;h--)f[h]==k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&G(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglColorBuffer),p.bufferData(p.ARRAY_BUFFER,ea,A));Ga&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglNormalBuffer),p.bufferData(p.ARRAY_BUFFER,ga,A));Da&&va.hasTangents&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglTangentBuffer),p.bufferData(p.ARRAY_BUFFER,ha,A));Ha&&ra>0&&(p.bindBuffer(p.ARRAY_BUFFER, -t.__webglUVBuffer),p.bufferData(p.ARRAY_BUFFER,ia,A));Ha&&T>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglUV2Buffer),p.bufferData(p.ARRAY_BUFFER,Ea,A));Ca&&(p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,Ba,A),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,ta,A));R>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinVertexABuffer),p.bufferData(p.ARRAY_BUFFER,ja,A),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinVertexBBuffer), -p.bufferData(p.ARRAY_BUFFER,sa,A),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),p.bufferData(p.ARRAY_BUFFER,aa,A),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),p.bufferData(p.ARRAY_BUFFER,fa,A));S&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}k.__dirtyVertices= -!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;C(m)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=p.DYNAMIC_DRAW;n=x=S=S=void 0;u=h.vertices;o=h.colors;v=u.length;t=o.length;y=h.__vertexArray;A=h.__colorArray;z=h.__dirtyColors;if(h.__dirtyVertices){for(S=0;S0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglColorBuffer),p.bufferData(p.ARRAY_BUFFER,ea,y));Ga&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglNormalBuffer),p.bufferData(p.ARRAY_BUFFER,ga,y));Da&&va.hasTangents&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglTangentBuffer),p.bufferData(p.ARRAY_BUFFER,ha,y));Ha&&ra>0&&(p.bindBuffer(p.ARRAY_BUFFER, +t.__webglUVBuffer),p.bufferData(p.ARRAY_BUFFER,ia,y));Ha&&T>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglUV2Buffer),p.bufferData(p.ARRAY_BUFFER,Ea,y));Ca&&(p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,Ba,y),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,ta,y));R>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinVertexABuffer),p.bufferData(p.ARRAY_BUFFER,ja,y),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinVertexBBuffer), +p.bufferData(p.ARRAY_BUFFER,sa,y),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),p.bufferData(p.ARRAY_BUFFER,aa,y),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),p.bufferData(p.ARRAY_BUFFER,fa,y));S&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}k.__dirtyVertices= +!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;C(m)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=p.DYNAMIC_DRAW;n=x=S=S=void 0;u=h.vertices;o=h.colors;v=u.length;t=o.length;z=h.__vertexArray;y=h.__colorArray;A=h.__dirtyColors;if(h.__dirtyVertices){for(S=0;S1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=m;c.v=k;return c}, clamp:function(b,c,e){return be?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0}; -THREE.GeometryUtils={merge:function(b,c){var e,f,h=b.vertices.length,k=c instanceof THREE.Mesh?c.geometry:c,m=b.vertices,n=k.vertices,u=b.faces,t=k.faces,w=b.faceVertexUvs[0],k=k.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),e=c.matrix,f=new THREE.Matrix4,f.extractRotation(e,c.scale);for(var o=0,x=n.length;o1&&(f=1-f,h=1-h);k=1-f-h;m.copy(b);m.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);m.addSelf(n);n.copy(e);n.multiplyScalar(k);m.addSelf(n);return m},randomPointInFace:function(b,c,e){var f,h,k;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,k=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,k);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;k=c.vertices[b.c].position;var c=c.vertices[b.d].position, @@ -362,8 +362,8 @@ b?c(e,k-1):t[k]e?e:b},mapLinear:function(b,c,e,f,h){return(b-c)*(h-f)/(e-c)+f}};THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,h=b.children.length;for(f=0;f0?(m=e[e.length-1],v=m.x,z=m.y):(m=this.actions[f-1].args,v=m[m.length-2],z=m[m.length-1]);for(m=1;m<=b;m++)A=m/b,k=THREE.Shape.Utils.b2(A,v,o,n),A=THREE.Shape.Utils.b2(A,z,x, -u),e.push(new THREE.Vector2(k,A));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];u=k[5];o=k[0];x=k[1];t=k[2];w=k[3];e.length>0?(m=e[e.length-1],v=m.x,z=m.y):(m=this.actions[f-1].args,v=m[m.length-2],z=m[m.length-1]);for(m=1;m<=b;m++)A=m/b,k=THREE.Shape.Utils.b3(A,v,o,t,n),A=THREE.Shape.Utils.b3(A,z,x,w,u),e.push(new THREE.Vector2(k,A));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];A=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m); -for(m=1;m<=A;m++)e.push(k.getPointAt(m/A));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];u=k[1];t=k[2];o=k[3];A=k[4];x=!!k[5];w=m[m.length-2];v=m[m.length-1];m.length==0&&(w=v=0);z=A-o;var y=b*2;for(m=1;m<=y;m++)A=m/y,x||(A=1-A),A=o+A*z,k=w+n+t*Math.cos(A),A=v+u+t*Math.sin(A),e.push(new THREE.Vector2(k,A))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; +THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,h,k,m,n,u,t,w,o,x,v,A,z;f=0;for(h=this.actions.length;f0?(m=e[e.length-1],v=m.x,A=m.y):(m=this.actions[f-1].args,v=m[m.length-2],A=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b2(z,v,o,n),z=THREE.Shape.Utils.b2(z,A,x, +u),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];u=k[5];o=k[0];x=k[1];t=k[2];w=k[3];e.length>0?(m=e[e.length-1],v=m.x,A=m.y):(m=this.actions[f-1].args,v=m[m.length-2],A=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b3(z,v,o,t,n),z=THREE.Shape.Utils.b3(z,A,x,w,u),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];z=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m); +for(m=1;m<=z;m++)e.push(k.getPointAt(m/z));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];u=k[1];t=k[2];o=k[3];z=k[4];x=!!k[5];w=m[m.length-2];v=m[m.length-1];m.length==0&&(w=v=0);A=z-o;var y=b*2;for(m=1;m<=y;m++)z=m/y,x||(z=1-z),z=o+z*A,k=w+n+t*Math.cos(z),z=v+u+t*Math.sin(z),e.push(new THREE.Vector2(k,z))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)}; THREE.Path.prototype.nltransform=function(b,c,e,f,h,k){var m=this.getPoints(),n,u,t,w,o;n=0;for(u=m.length;n=0?n-1:e.length-1;k=m-1>=0?m-1:t.length-1;var A=[t[m],e[n],e[h]];o=THREE.FontUtils.Triangulate.area(A);var y=[t[m],t[k],e[n]];x=THREE.FontUtils.Triangulate.area(y);v=n;w=m;n+=1;m+=-1;n< -0&&(n+=e.length);n%=e.length;m<0&&(m+=t.length);m%=t.length;h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:t.length-1;A=[t[m],e[n],e[h]];A=THREE.FontUtils.Triangulate.area(A);y=[t[m],t[k],e[n]];y=THREE.FontUtils.Triangulate.area(y);o+x>A+y&&(n=v,m=w,n<0&&(n+=e.length),n%=e.length,m<0&&(m+=t.length),m%=t.length,h=n-1>=0?n-1:e.length-1,k=m-1>=0?m-1:t.length-1);o=e.slice(0,n);x=e.slice(n);v=t.slice(m);w=t.slice(0,m);k=[t[m],t[k],e[n]];z.push([t[m],e[n],e[h]]);z.push(k);e=o.concat(v).concat(w).concat(x)}return{shape:e, -isolatedPts:z,allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),k,m,n,u,t={};k=0;for(m=f.length;k=0?n-1:e.length-1;k=m-1>=0?m-1:t.length-1;var z=[t[m],e[n],e[h]];o=THREE.FontUtils.Triangulate.area(z);var y=[t[m],t[k],e[n]];x=THREE.FontUtils.Triangulate.area(y);v=n;w=m;n+=1;m+=-1;n< +0&&(n+=e.length);n%=e.length;m<0&&(m+=t.length);m%=t.length;h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:t.length-1;z=[t[m],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);y=[t[m],t[k],e[n]];y=THREE.FontUtils.Triangulate.area(y);o+x>z+y&&(n=v,m=w,n<0&&(n+=e.length),n%=e.length,m<0&&(m+=t.length),m%=t.length,h=n-1>=0?n-1:e.length-1,k=m-1>=0?m-1:t.length-1);o=e.slice(0,n);x=e.slice(n);v=t.slice(m);w=t.slice(0,m);k=[t[m],t[k],e[n]];A.push([t[m],e[n],e[h]]);A.push(k);e=o.concat(v).concat(w).concat(x)}return{shape:e, +isolatedPts:A,allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),k,m,n,u,t={};k=0;for(m=f.length;k1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]= this.getPrevKeyWith("pos",v,m.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",v,n.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e=== "rot")THREE.Quaternion.slerp(h,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f}}if(this.JITCompile&&w[0][t]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v0||this.autoForward&&!(u<0)?1:u));this.object.translateX(b*t);this.object.translateY(b*w);m&&(this.roll+=this.rollSpeed*this.delta*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize(); else if(this.forward.y0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;nb&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(H=b.length;--H>=0;){ka=H;na=H-1;na<0&&(na=b.length- 1);for(var c=0,e=v+w*2,c=0;c=0;Q--){Z=Q/w;$=u*(1-Z);Z=t*Math.sin(Z*Math.PI/2);H=0;for(T=F.length;H=0;Q--){Z=Q/w;$=u*(1-Z);Z=t*Math.sin(Z*Math.PI/2);H=0;for(T=F.length;H0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,n,x)))-1);t.push(w)}c.push(t)}for(var v,z,A,h=c.length,e=0;e0)for(f=0;f1&&(v= -this.vertices[m].position.clone(),z=this.vertices[u].position.clone(),A=this.vertices[t].position.clone(),v.normalize(),z.normalize(),A.normalize(),this.faces.push(new THREE.Face3(m,u,t,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([w,o,y]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry; +THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,k=Math.max(3,c||8),m=Math.max(2,e||6),c=[],e=0;e0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,n,x)))-1);t.push(w)}c.push(t)}for(var v,A,z,h=c.length,e=0;e0)for(f=0;f1&&(v= +this.vertices[m].position.clone(),A=this.vertices[u].position.clone(),z=this.vertices[t].position.clone(),v.normalize(),A.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,u,t,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,o,y]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry; THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry; THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var f=e[e.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,e,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry; THREE.TextGeometry.prototype.constructor=THREE.TextGeometry; THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c= -this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),k=h.length,m=[],b=0;b0)for(t=0;t2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}u=t;h<=u&&(u=0);t=u+1;h<=t&&(t=0);w=t+1;h<=w&&(w=0);var x;a:{x=b;var v=u,z=t,A=w,y=h,E=m,F=void 0,C=void 0,G=void 0, -J=void 0,M=void 0,K=void 0,B=void 0,L=void 0,Y=void 0,C=x[E[v]].x,G=x[E[v]].y,J=x[E[z]].x,M=x[E[z]].y,K=x[E[A]].x,B=x[E[A]].y;if(1.0E-10>(J-C)*(B-G)-(M-G)*(K-C))x=!1;else{for(F=0;F=0&&Q>=0&&$>=0){x=!1;break a}}x= +this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),k=h.length,m=[],b=0;b0)for(t=0;t2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}u=t;h<=u&&(u=0);t=u+1;h<=t&&(t=0);w=t+1;h<=w&&(w=0);var x;a:{x=b;var v=u,A=t,z=w,y=h,E=m,F=void 0,C=void 0,G=void 0, +J=void 0,M=void 0,K=void 0,B=void 0,L=void 0,Y=void 0,C=x[E[v]].x,G=x[E[v]].y,J=x[E[A]].x,M=x[E[A]].y,K=x[E[z]].x,B=x[E[z]].y;if(1.0E-10>(J-C)*(B-G)-(M-G)*(K-C))x=!1;else{for(F=0;F=0&&Q>=0&&$>=0){x=!1;break a}}x= !0}}if(x){k.push([b[m[u]],b[m[t]],b[m[w]]]);n.push([m[u],m[t],m[w]]);u=t;for(w=t+1;w0;)this.smooth(b)}; THREE.SubdivisionModifier.prototype.smooth=function(b){function c(b,c,e,f,n,t){var u=new THREE.Face4(b,c,e,f,null,n.color,n.material);if(m.useOldVertexColors){u.vertexColors=[];for(var v,p,w,x=0;x<4;x++){w=t[x];v=new THREE.Color;v.setRGB(0,0,0);for(var y=0;y>7)-127;f|=(h&127)<<16|k<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,c){var e=w(b,c),f=w(b,c+1),k=w(b,c+2);return(w(b,c+3)<<24)+(k<<16)+(f<<8)+e}function u(b,c){var e=w(b,c);return(w(b,c+1)<<8)+e}function t(b,c){var e=w(b,c);return e>127?e-256:e}function w(b,c){return b.charCodeAt(c)&255}function o(c){var e, f,k;e=h(b,c);f=h(b,c+M);k=h(b,c+K);c=u(b,c+B);E.faces.push(new THREE.Face3(e,f,k,null,null,E.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+M);k=h(b,c+K);m=u(b,c+B);o=h(b,c+L);p=h(b,c+Y);c=h(b,c+H);m=E.materials[m];var t=G[p*3],v=G[p*3+1];p=G[p*3+2];var w=G[c*3],x=G[c*3+1],c=G[c*3+2];E.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(t,v,p),new THREE.Vector3(w,x,c)],null,m))}function v(c){var e,f,k,m;e=h(b,c);f=h(b,c+T);k=h(b,c+Q);m=h(b, -c+Z);c=u(b,c+$);E.faces.push(new THREE.Face4(e,f,k,m,null,null,E.materials[c]))}function z(c){var e,f,k,m,o,t,v,w;e=h(b,c);f=h(b,c+T);k=h(b,c+Q);m=h(b,c+Z);o=u(b,c+$);t=h(b,c+P);v=h(b,c+p);w=h(b,c+V);c=h(b,c+fa);o=E.materials[o];var x=G[v*3],y=G[v*3+1];v=G[v*3+2];var S=G[w*3],A=G[w*3+1];w=G[w*3+2];var z=G[c*3],B=G[c*3+1],c=G[c*3+2];E.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(G[t*3],G[t*3+1],G[t*3+2]),new THREE.Vector3(x,y,v),new THREE.Vector3(S,A,w),new THREE.Vector3(z,B,c)],null,o))} -function A(c){var e,f,k,m;e=h(b,c);f=h(b,c+ea);k=h(b,c+ha);c=J[e*2];m=J[e*2+1];e=J[f*2];var o=E.faceVertexUvs[0];f=J[f*2+1];var p=J[k*2];k=J[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function y(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ga);k=h(b,c+ka);m=h(b,c+na);c=J[e*2];o=J[e*2+1];e=J[f*2];p=J[f*2+1];f=J[k*2];var t=E.faceVertexUvs[0];k=J[k*2+1];var u=J[m*2];m=J[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f, +c+Z);c=u(b,c+$);E.faces.push(new THREE.Face4(e,f,k,m,null,null,E.materials[c]))}function A(c){var e,f,k,m,o,t,v,w;e=h(b,c);f=h(b,c+T);k=h(b,c+Q);m=h(b,c+Z);o=u(b,c+$);t=h(b,c+P);v=h(b,c+p);w=h(b,c+V);c=h(b,c+fa);o=E.materials[o];var x=G[v*3],y=G[v*3+1];v=G[v*3+2];var S=G[w*3],z=G[w*3+1];w=G[w*3+2];var A=G[c*3],B=G[c*3+1],c=G[c*3+2];E.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(G[t*3],G[t*3+1],G[t*3+2]),new THREE.Vector3(x,y,v),new THREE.Vector3(S,z,w),new THREE.Vector3(A,B,c)],null,o))} +function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+ea);k=h(b,c+ha);c=J[e*2];m=J[e*2+1];e=J[f*2];var o=E.faceVertexUvs[0];f=J[f*2+1];var p=J[k*2];k=J[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function y(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ga);k=h(b,c+ka);m=h(b,c+na);c=J[e*2];o=J[e*2+1];e=J[f*2];p=J[f*2+1];f=J[k*2];var t=E.faceVertexUvs[0];k=J[k*2+1];var u=J[m*2];m=J[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f, k));v.push(new THREE.UV(u,m));t.push(v)}var E=this,F=0,C,G=[],J=[],M,K,B,L,Y,H,T,Q,Z,$,P,p,V,fa,ea,ha,ga,ka,na,aa,W,U,ia,ja,ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,c);C={signature:b.substr(F,8),header_bytes:w(b,F+8),vertex_coordinate_bytes:w(b,F+9),normal_coordinate_bytes:w(b,F+10),uv_coordinate_bytes:w(b,F+11),vertex_index_bytes:w(b,F+12),normal_index_bytes:w(b,F+13),uv_index_bytes:w(b,F+14),material_index_bytes:w(b,F+15),nvertices:h(b,F+16),nnormals:h(b,F+16+4),nuvs:h(b, F+16+8),ntri_flat:h(b,F+16+12),ntri_smooth:h(b,F+16+16),ntri_flat_uv:h(b,F+16+20),ntri_smooth_uv:h(b,F+16+24),nquad_flat:h(b,F+16+28),nquad_smooth:h(b,F+16+32),nquad_flat_uv:h(b,F+16+36),nquad_smooth_uv:h(b,F+16+40)};F+=C.header_bytes;M=C.vertex_index_bytes;K=C.vertex_index_bytes*2;B=C.vertex_index_bytes*3;L=C.vertex_index_bytes*3+C.material_index_bytes;Y=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;H=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;T=C.vertex_index_bytes; Q=C.vertex_index_bytes*2;Z=C.vertex_index_bytes*3;$=C.vertex_index_bytes*4;P=C.vertex_index_bytes*4+C.material_index_bytes;p=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;V=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;fa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;ea=C.uv_index_bytes;ha=C.uv_index_bytes*2;ga=C.uv_index_bytes;ka=C.uv_index_bytes*2;na=C.uv_index_bytes*3;c=C.vertex_index_bytes*3+C.material_index_bytes;ta=C.vertex_index_bytes* 4+C.material_index_bytes;aa=C.ntri_flat*c;W=C.ntri_smooth*(c+C.normal_index_bytes*3);U=C.ntri_flat_uv*(c+C.uv_index_bytes*3);ia=C.ntri_smooth_uv*(c+C.normal_index_bytes*3+C.uv_index_bytes*3);ja=C.nquad_flat*ta;c=C.nquad_smooth*(ta+C.normal_index_bytes*4);ta=C.nquad_flat_uv*(ta+C.uv_index_bytes*4);F+=function(c){for(var f,k,h,n=C.vertex_coordinate_bytes*3,o=c+C.nvertices*n;c=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];for(y=0;y=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];for(y=0;y1){o=new THREE.MeshFaceMaterial;for(j=0;j=0,m=k.indexOf("(")>=0,n;if(h)f=k.split("."),k=f.shift(),f.shift();else if(m){n=k.split("(");k=n.shift(); for(f=0;fc){u=t.output[p];break}m=u!==void 0?u instanceof THREE.Matrix4? m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14,c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};o.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b1&&(Y=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,Y);object.name=v;object.position.set(C[0],C[1],C[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=F.visible;V.scene.add(object);V.objects[v]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),V.scene.collisions.colliders.push(b)); if(F.castsShadow)b=new THREE.ShadowVolume(M),V.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},V.triggers[object.name]=b)}}else C=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(C[0],C[1],C[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0], s[1],s[2]),object.visible=F.visible!==void 0?F.visible:!1,V.scene.add(object),V.objects[v]=object,V.empties[v]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},V.triggers[object.name]=b)}function u(b){return function(c){V.geometries[b]=c;n();Z-=1;e.onLoadComplete();w()}}function t(b){return function(c){V.geometries[b]=c}}function w(){e.callbackProgress({totalModels:P,totalTextures:p,loadedModels:P-Z,loadedTextures:p-$},V);e.onLoadProgress();Z==0&&$==0&&c(V)}var o,x, -v,z,A,y,E,F,C,G,J,M,K,B,L,Y,H,T,Q,Z,$,P,p,V;T=b.data;L=new THREE.BinaryLoader;Q=new THREE.JSONLoader;$=Z=0;V={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in T.objects)if(F=T.objects[v],F.meshCollider){b=!0;break}if(b)V.scene.collisions=new THREE.CollisionSystem;if(T.transform){b=T.transform.position;G=T.transform.rotation;var fa=T.transform.scale;b&&V.scene.position.set(b[0],b[1],b[2]);G&&V.scene.rotation.set(G[0], -G[1],G[2]);fa&&V.scene.scale.set(fa[0],fa[1],fa[2]);(b||G||fa)&&V.scene.updateMatrix()}b=function(){$-=1;w();e.onLoadComplete()};for(A in T.cameras)G=T.cameras[A],G.type=="perspective"?K=new THREE.PerspectiveCamera(G.fov,G.aspect,G.near,G.far):G.type=="ortho"&&(K=new THREE.OrthographicCamera(G.left,G.right,G.top,G.bottom,G.near,G.far)),C=G.position,G=G.target,K.position.set(C[0],C[1],C[2]),K.target=new THREE.Vector3(G[0],G[1],G[2]),V.cameras[A]=K;for(z in T.lights)A=T.lights[z],K=A.color!==void 0? -A.color:16777215,G=A.intensity!==void 0?A.intensity:1,A.type=="directional"?(C=A.direction,H=new THREE.DirectionalLight(K,G),H.position.set(C[0],C[1],C[2]),H.position.normalize()):A.type=="point"?(C=A.position,d=A.distance,H=new THREE.PointLight(K,G,d),H.position.set(C[0],C[1],C[2])):A.type=="ambient"&&(H=new THREE.AmbientLight(K)),V.scene.add(H),V.lights[z]=H;for(y in T.fogs)z=T.fogs[y],z.type=="linear"?B=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(B=new THREE.FogExp2(0,z.density)),G=z.color, +v,A,z,y,E,F,C,G,J,M,K,B,L,Y,H,T,Q,Z,$,P,p,V;T=b.data;L=new THREE.BinaryLoader;Q=new THREE.JSONLoader;$=Z=0;V={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in T.objects)if(F=T.objects[v],F.meshCollider){b=!0;break}if(b)V.scene.collisions=new THREE.CollisionSystem;if(T.transform){b=T.transform.position;G=T.transform.rotation;var fa=T.transform.scale;b&&V.scene.position.set(b[0],b[1],b[2]);G&&V.scene.rotation.set(G[0], +G[1],G[2]);fa&&V.scene.scale.set(fa[0],fa[1],fa[2]);(b||G||fa)&&V.scene.updateMatrix()}b=function(){$-=1;w();e.onLoadComplete()};for(z in T.cameras)G=T.cameras[z],G.type=="perspective"?K=new THREE.PerspectiveCamera(G.fov,G.aspect,G.near,G.far):G.type=="ortho"&&(K=new THREE.OrthographicCamera(G.left,G.right,G.top,G.bottom,G.near,G.far)),C=G.position,G=G.target,K.position.set(C[0],C[1],C[2]),K.target=new THREE.Vector3(G[0],G[1],G[2]),V.cameras[z]=K;for(A in T.lights)z=T.lights[A],K=z.color!==void 0? +z.color:16777215,G=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(C=z.direction,H=new THREE.DirectionalLight(K,G),H.position.set(C[0],C[1],C[2]),H.position.normalize()):z.type=="point"?(C=z.position,d=z.distance,H=new THREE.PointLight(K,G,d),H.position.set(C[0],C[1],C[2])):z.type=="ambient"&&(H=new THREE.AmbientLight(K)),V.scene.add(H),V.lights[A]=H;for(y in T.fogs)A=T.fogs[y],A.type=="linear"?B=new THREE.Fog(0,A.near,A.far):A.type=="exp2"&&(B=new THREE.FogExp2(0,A.density)),G=A.color, B.color.setRGB(G[0],G[1],G[2]),V.fogs[y]=B;if(V.cameras&&T.defaults.camera)V.currentCamera=V.cameras[T.defaults.camera];if(V.fogs&&T.defaults.fog)V.scene.fog=V.fogs[T.defaults.fog];G=T.defaults.bgcolor;V.bgColor=new THREE.Color;V.bgColor.setRGB(G[0],G[1],G[2]);V.bgColorAlpha=T.defaults.bgalpha;for(o in T.geometries)if(y=T.geometries[o],y.type=="bin_mesh"||y.type=="ascii_mesh")Z+=1,e.onLoadStart();P=Z;for(o in T.geometries)y=T.geometries[o],y.type=="cube"?(M=new THREE.CubeGeometry(y.width,y.height, y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),V.geometries[o]=M):y.type=="plane"?(M=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),V.geometries[o]=M):y.type=="sphere"?(M=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),V.geometries[o]=M):y.type=="cylinder"?(M=new THREE.CylinderGeometry(y.topRad,y.botRad,y.height,y.radSegs,y.heightSegs),V.geometries[o]=M):y.type=="torus"?(M=new THREE.TorusGeometry(y.radius,y.tube,y.segmentsR, y.segmentsT),V.geometries[o]=M):y.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(y.subdivisions),V.geometries[o]=M):y.type=="bin_mesh"?L.load({model:f(y.url,T.urlBaseType),callback:u(o)}):y.type=="ascii_mesh"?Q.load({model:f(y.url,T.urlBaseType),callback:u(o)}):y.type=="embedded_mesh"&&(y=T.embeds[y.id])&&Q.createModel(y,t(o),"");for(E in T.textures)if(o=T.textures[E],o.url instanceof Array){$+=o.url.length;for(L=0;L=this.maxCount-3&&n(this)};this.begin=function(){this.count=0; this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;cthis.size-1&&(u=this.size-1);var x=Math.floor(t-n);x<1&&(x=1);t=Math.floor(t+n);t>this.size-1&&(t=this.size-1);var v=Math.floor(w-n);v<1&&(v=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size- -1);for(var z,A,y,E,F,C;o0&&(this.field[y+z]+=E)}}};this.addPlaneX=function(b,c){var h,k,m,n,u,t=this.size,w=this.yd,o=this.zd,x=this.field,v=t*Math.sqrt(b/c);v>t&&(v=t);for(h=0;h0)for(k=0;kw&&(z=w);for(k=0;k0){u=k*o;for(h=0;hsize&&(dist=size);for(m=0;m0){u=zd*m;for(k=0;k0&&(this.field[y+A]+=E)}}};this.addPlaneX=function(b,c){var h,k,m,n,u,t=this.size,w=this.yd,o=this.zd,x=this.field,v=t*Math.sqrt(b/c);v>t&&(v=t);for(h=0;h0)for(k=0;kw&&(A=w);for(k=0;k0){u=k*o;for(h=0;hsize&&(dist=size);for(m=0;m0){u=zd*m;for(k=0;k0,r={};r.vertices=new Float32Array(16);r.faces=new Uint16Array(6);Q=0;r.vertices[Q++]=-1;r.vertices[Q++]=-1;r.vertices[Q++]=0;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=-1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=0;r.vertices[Q++]= --1;r.vertices[Q++]=1;r.vertices[Q++]=0;Q=r.vertices[Q++]=0;r.faces[Q++]=0;r.faces[Q++]=1;r.faces[Q++]=2;r.faces[Q++]=0;r.faces[Q++]=2;r.faces[Q++]=3;r.vertexBuffer=f.createBuffer();r.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,r.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,r.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,r.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,r.faces,f.STATIC_DRAW);r.program=f.createProgram();f.attachShader(r.program,Z("fragment",THREE.ShaderLib.sprite.fragmentShader)); -f.attachShader(r.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));f.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.position=f.getAttribLocation(r.program,"position");r.attributes.uv=f.getAttribLocation(r.program,"uv");r.uniforms.uvOffset=f.getUniformLocation(r.program,"uvOffset");r.uniforms.uvScale=f.getUniformLocation(r.program,"uvScale");r.uniforms.rotation=f.getUniformLocation(r.program,"rotation");r.uniforms.scale=f.getUniformLocation(r.program,"scale");r.uniforms.alignment= -f.getUniformLocation(r.program,"alignment");r.uniforms.color=f.getUniformLocation(r.program,"color");r.uniforms.map=f.getUniformLocation(r.program,"map");r.uniforms.opacity=f.getUniformLocation(r.program,"opacity");r.uniforms.useScreenCoordinates=f.getUniformLocation(r.program,"useScreenCoordinates");r.uniforms.affectedByDistance=f.getUniformLocation(r.program,"affectedByDistance");r.uniforms.screenPosition=f.getUniformLocation(r.program,"screenPosition");r.uniforms.modelViewMatrix=f.getUniformLocation(r.program, -"modelViewMatrix");r.uniforms.projectionMatrix=f.getUniformLocation(r.program,"projectionMatrix");var cb=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c,d,e){Aa=b;Ea=c;va=d;Ka=e;f.viewport(Aa,Ea,va,Ka)};this.setScissor=function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.setClearColorHex=function(b,c){wa.setHex(b);Ba=c;f.clearColor(wa.r,wa.g,wa.b, -Ba)};this.setClearColor=function(b,c){wa.copy(b);Ba=c;f.clearColor(wa.r,wa.g,wa.b,Ba)};this.getClearColor=function(){return wa};this.getClearAlpha=function(){return Ba};this.clear=function(b,c,d){var e=0;if(b==void 0||b)e|=f.COLOR_BUFFER_BIT;if(c==void 0||c)e|=f.DEPTH_BUFFER_BIT;if(d==void 0||d)e|=f.STENCIL_BUFFER_BIT;f.clear(e)};this.getContext=function(){return f};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray, -delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];f.deleteBuffer(c.__webglVertexBuffer);f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer);f.deleteBuffer(c.__webglUV2Buffer);f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer);f.deleteBuffer(c.__webglSkinWeightsBuffer); -f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d0,r={};r.vertices=new Float32Array(16);r.faces=new Uint16Array(6);Q=0;r.vertices[Q++]=-1;r.vertices[Q++]=-1;r.vertices[Q++]=0;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=-1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]=1;r.vertices[Q++]= +0;r.vertices[Q++]=-1;r.vertices[Q++]=1;r.vertices[Q++]=0;Q=r.vertices[Q++]=0;r.faces[Q++]=0;r.faces[Q++]=1;r.faces[Q++]=2;r.faces[Q++]=0;r.faces[Q++]=2;r.faces[Q++]=3;r.vertexBuffer=f.createBuffer();r.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,r.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,r.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,r.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,r.faces,f.STATIC_DRAW);r.program=f.createProgram();f.attachShader(r.program,Z("fragment", +THREE.ShaderLib.sprite.fragmentShader));f.attachShader(r.program,Z("vertex",THREE.ShaderLib.sprite.vertexShader));f.linkProgram(r.program);r.attributes={};r.uniforms={};r.attributes.position=f.getAttribLocation(r.program,"position");r.attributes.uv=f.getAttribLocation(r.program,"uv");r.uniforms.uvOffset=f.getUniformLocation(r.program,"uvOffset");r.uniforms.uvScale=f.getUniformLocation(r.program,"uvScale");r.uniforms.rotation=f.getUniformLocation(r.program,"rotation");r.uniforms.scale=f.getUniformLocation(r.program, +"scale");r.uniforms.alignment=f.getUniformLocation(r.program,"alignment");r.uniforms.color=f.getUniformLocation(r.program,"color");r.uniforms.map=f.getUniformLocation(r.program,"map");r.uniforms.opacity=f.getUniformLocation(r.program,"opacity");r.uniforms.useScreenCoordinates=f.getUniformLocation(r.program,"useScreenCoordinates");r.uniforms.affectedByDistance=f.getUniformLocation(r.program,"affectedByDistance");r.uniforms.screenPosition=f.getUniformLocation(r.program,"screenPosition");r.uniforms.modelViewMatrix= +f.getUniformLocation(r.program,"modelViewMatrix");r.uniforms.projectionMatrix=f.getUniformLocation(r.program,"projectionMatrix");var cb=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c,d,e){Aa=b;Ea=c;va=d;Ka=e;f.viewport(Aa,Ea,va,Ka)};this.setScissor=function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.setClearColorHex=function(b,c){wa.setHex(b); +Ba=c;f.clearColor(wa.r,wa.g,wa.b,Ba)};this.setClearColor=function(b,c){wa.copy(b);Ba=c;f.clearColor(wa.r,wa.g,wa.b,Ba)};this.getClearColor=function(){return wa};this.getClearAlpha=function(){return Ba};this.clear=function(b,c,d){var e=0;if(b==void 0||b)e|=f.COLOR_BUFFER_BIT;if(c==void 0||c)e|=f.DEPTH_BUFFER_BIT;if(d==void 0||d)e|=f.STENCIL_BUFFER_BIT;f.clear(e)};this.getContext=function(){return f};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray, +delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=b.geometry.geometryGroups[g];f.deleteBuffer(c.__webglVertexBuffer);f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer);f.deleteBuffer(c.__webglUV2Buffer);f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer); +f.deleteBuffer(c.__webglSkinWeightsBuffer);f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d=0&&f.enableVertexAttribArray(s.position);s.color>=0&&f.enableVertexAttribArray(s.color);s.normal>=0&&f.enableVertexAttribArray(s.normal);s.tangent>=0&&f.enableVertexAttribArray(s.tangent); b.skinning&&s.skinVertexA>=0&&s.skinVertexB>=0&&s.skinIndex>=0&&s.skinWeight>=0&&(f.enableVertexAttribArray(s.skinVertexA),f.enableVertexAttribArray(s.skinVertexB),f.enableVertexAttribArray(s.skinIndex),f.enableVertexAttribArray(s.skinWeight));if(b.attributes)for(i in b.attributes)s[i]!==void 0&&s[i]>=0&&f.enableVertexAttribArray(s[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i=0&&(f.enableVertexAttribArray(s[v]),b.numSupportedMorphTargets++); -b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,f){V(b);this.clear(c,d,f)};this.render=function(b,c,t,r){var I,v,Da,S,x,Ua,z,Qa,Ra=b.lights,M=b.fog;na=-1;this.shadowMapEnabled&&y(b,c);H.info.render.calls=0;H.info.render.vertices=0;H.info.render.faces=0;if(c.matrixAutoUpdate){for(x=c;x.parent;)x=x.parent;x.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Xa);c.projectionMatrix.flattenToArray(Wa);Fa.multiply(c.projectionMatrix, -c.matrixWorldInverse);p(Fa);this.initWebGLObjects(b);V(t);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);x=b.__webglObjects.length;for(r=0;r=0;r--)if(I=b.__webglObjects[r],I.render){z=I.object;Qa=I.buffer;Da=I.opaque;i(z);for(I=0;I0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n* +b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,d,f){V(b);this.clear(c,d,f)};this.updateShadowMap=function(b,c){y(b,c)};this.render=function(b,c,t,r){var I,v,Da,S,x,Ua,z,Qa,Ra=b.lights,M=b.fog;na=-1;this.shadowMapEnabled&&this.shadowMapAutoUpdate&&y(b,c);H.info.render.calls=0;H.info.render.vertices=0;H.info.render.faces=0;if(c.matrixAutoUpdate){for(x=c;x.parent;)x=x.parent;x.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Xa); +c.projectionMatrix.flattenToArray(Wa);Fa.multiply(c.projectionMatrix,c.matrixWorldInverse);p(Fa);this.initWebGLObjects(b);V(t);(this.autoClear||r)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);x=b.__webglObjects.length;for(r=0;r=0;r--)if(I=b.__webglObjects[r],I.render){z=I.object;Qa=I.buffer;Da=I.opaque;i(z);for(I=0;I0||t.faceVertexUvs.length>0)j.__uvArray=new Float32Array(n* 2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(n*2)}if(k.geometry.skinWeights.length&&k.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(n*4),j.__skinVertexBArray=new Float32Array(n*4),j.__skinIndexArray=new Float32Array(n*4),j.__skinWeightArray=new Float32Array(n*4);j.__faceArray=new Uint16Array(v*3+(k.geometry.edgeFaces?k.geometry.edgeFaces.length*6:0));j.__lineArray=new Uint16Array(B*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];t=0;for(r= j.numMorphTargets;t