浏览代码

Made dynamic objects work.

alteredq 14 年之前
父节点
当前提交
ea3961d6a6
共有 7 个文件被更改,包括 390 次插入347 次删除
  1. 192 191
      build/Three.js
  2. 1 1
      build/custom/ThreeCanvas.js
  3. 1 1
      build/custom/ThreeDOM.js
  4. 1 1
      build/custom/ThreeExtras.js
  5. 1 1
      build/custom/ThreeSVG.js
  6. 108 107
      build/custom/ThreeWebGL.js
  7. 86 45
      src/renderers/WebGLRenderer.js

+ 192 - 191
build/Three.js

@@ -11,33 +11,33 @@ a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-th
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,d){this.set(a||0,b||0,c||0,d||1)};
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 THREE.Vector4.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(E,w,F,u){u=u.clone().subSelf(w);F=F.clone().subSelf(w);var H=E.clone().subSelf(w);E=u.dot(u);w=u.dot(F);u=u.dot(H);var P=F.dot(F);F=F.dot(H);H=1/(E*P-w*w);P=(P*u-w*F)*H;E=(E*F-w*u)*H;return P>0&&E>0&&P+E<1}var c,d,f,g,h,k,j,m,o,y,
-p,q=a.geometry,A=q.vertices,C=[];c=0;for(d=q.faces.length;c<d;c++){f=q.faces[c];y=this.origin.clone();p=this.direction.clone();j=a.matrixWorld;g=j.multiplyVector3(A[f.a].position.clone());h=j.multiplyVector3(A[f.b].position.clone());k=j.multiplyVector3(A[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(A[f.d].position.clone()):null;m=a.matrixRotationWorld.multiplyVector3(f.normal.clone());o=p.dot(m);if(o<0){m=m.dot((new THREE.Vector3).sub(g,y))/o;y=y.addSelf(p.multiplyScalar(m));
-if(f instanceof THREE.Face3){if(b(y,g,h,k)){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};C.push(f)}}else if(f instanceof THREE.Face4&&(b(y,g,h,j)||b(y,h,k,j))){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};C.push(f)}}}return C}};
-THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,m,o,y){k=!1;b=j;c=m;d=o;f=y;a()};this.addPoint=function(j,m){if(k){k=!1;b=j;c=m;d=j;f=m}else{b=b<j?b:j;c=c<m?c:m;d=d>j?d:j;f=f>m?f:m}a()};
-this.add3Points=function(j,m,o,y,p,q){if(k){k=!1;b=j<o?j<p?j:p:o<p?o:p;c=m<y?m<q?m:q:y<q?y:q;d=j>o?j>p?j:p:o>p?o:p;f=m>y?m>q?m:q:y>q?y:q}else{b=j<o?j<p?j<b?j:b:p<b?p:b:o<p?o<b?o:b:p<b?p:b;c=m<y?m<q?m<c?m:c:q<c?q:c:y<q?y<c?y:c:q<c?q:c;d=j>o?j>p?j>d?j:d:p>d?p:d:o>p?o>d?o:d:p>d?p:d;f=m>y?m>q?m>f?m:f:q>f?q:f:y>q?y>f?y:f:q>f?q:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=b<j.getLeft()?b:j.getLeft();c=c<j.getTop()?c:j.getTop();d=d>j.getRight()?
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(F,w,H,u){u=u.clone().subSelf(w);H=H.clone().subSelf(w);var I=F.clone().subSelf(w);F=u.dot(u);w=u.dot(H);u=u.dot(I);var N=H.dot(H);H=H.dot(I);I=1/(F*N-w*w);N=(N*u-w*H)*I;F=(F*H-w*u)*I;return N>0&&F>0&&N+F<1}var c,d,f,g,h,k,j,m,o,z,
+q,t=a.geometry,B=t.vertices,C=[];c=0;for(d=t.faces.length;c<d;c++){f=t.faces[c];z=this.origin.clone();q=this.direction.clone();j=a.matrixWorld;g=j.multiplyVector3(B[f.a].position.clone());h=j.multiplyVector3(B[f.b].position.clone());k=j.multiplyVector3(B[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(B[f.d].position.clone()):null;m=a.matrixRotationWorld.multiplyVector3(f.normal.clone());o=q.dot(m);if(o<0){m=m.dot((new THREE.Vector3).sub(g,z))/o;z=z.addSelf(q.multiplyScalar(m));
+if(f instanceof THREE.Face3){if(b(z,g,h,k)){f={distance:this.origin.distanceTo(z),point:z,face:f,object:a};C.push(f)}}else if(f instanceof THREE.Face4&&(b(z,g,h,j)||b(z,h,k,j))){f={distance:this.origin.distanceTo(z),point:z,face:f,object:a};C.push(f)}}}return C}};
+THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,m,o,z){k=!1;b=j;c=m;d=o;f=z;a()};this.addPoint=function(j,m){if(k){k=!1;b=j;c=m;d=j;f=m}else{b=b<j?b:j;c=c<m?c:m;d=d>j?d:j;f=f>m?f:m}a()};
+this.add3Points=function(j,m,o,z,q,t){if(k){k=!1;b=j<o?j<q?j:q:o<q?o:q;c=m<z?m<t?m:t:z<t?z:t;d=j>o?j>q?j:q:o>q?o:q;f=m>z?m>t?m:t:z>t?z:t}else{b=j<o?j<q?j<b?j:b:q<b?q:b:o<q?o<b?o:b:q<b?q:b;c=m<z?m<t?m<c?m:c:t<c?t:c:z<t?z<c?z:c:t<c?t:c;d=j>o?j>q?j>d?j:d:q>d?q:d:o>q?o>d?o:d:q>d?q:d;f=m>z?m>t?m>f?m:f:t>f?t:f:z>t?z>f?z:f:t>f?t:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=b<j.getLeft()?b:j.getLeft();c=c<j.getTop()?c:j.getTop();d=d>j.getRight()?
 d:j.getRight();f=f>j.getBottom()?f:j.getBottom()}a()};this.inflate=function(j){b-=j;c-=j;d+=j;f+=j;a()};this.minSelf=function(j){b=b>j.getLeft()?b:j.getLeft();c=c>j.getTop()?c:j.getTop();d=d<j.getRight()?d:j.getRight();f=f<j.getBottom()?f:j.getBottom();a()};this.instersects=function(j){return Math.min(d,j.getRight())-Math.max(b,j.getLeft())>=0&&Math.min(f,j.getBottom())-Math.max(c,j.getTop())>=0};this.empty=function(){k=!0;f=d=c=b=0;a()};this.isEmpty=function(){return k}};
 d:j.getRight();f=f>j.getBottom()?f:j.getBottom()}a()};this.inflate=function(j){b-=j;c-=j;d+=j;f+=j;a()};this.minSelf=function(j){b=b>j.getLeft()?b:j.getLeft();c=c>j.getTop()?c:j.getTop();d=d<j.getRight()?d:j.getRight();f=f<j.getBottom()?f:j.getBottom();a()};this.instersects=function(j){return Math.min(d,j.getRight())-Math.max(b,j.getLeft())>=0&&Math.min(f,j.getBottom())-Math.max(c,j.getTop())>=0};this.empty=function(){k=!0;f=d=c=b=0;a()};this.isEmpty=function(){return k}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,f,g,h,k,j,m,o,y,p,q,A,C){this.set(a||1,b||0,c||0,d||0,f||0,g||1,h||0,k||0,j||0,m||0,o||1,y||0,p||0,q||0,A||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,f,g,h,k,j,m,o,y,p,q,A,C){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=o;this.n34=y;this.n41=p;this.n42=q;this.n43=A;this.n44=C;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1,
+THREE.Matrix4=function(a,b,c,d,f,g,h,k,j,m,o,z,q,t,B,C){this.set(a||1,b||0,c||0,d||0,f||0,g||1,h||0,k||0,j||0,m||0,o||1,z||0,q||0,t||0,B||0,C||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,c,d,f,g,h,k,j,m,o,z,q,t,B,C){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=o;this.n34=z;this.n41=q;this.n42=t;this.n43=B;this.n44=C;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1,
 f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();d.cross(c,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n14=a.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n24=a.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;this.n34=a.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*
 f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();d.cross(c,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n14=a.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n24=a.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;this.n34=a.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*
 b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},crossVector:function(a){var b=new THREE.Vector4;
 b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},crossVector:function(a){var b=new THREE.Vector4;
-b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,y=a.n32,p=a.n33,q=a.n34,A=a.n41,C=a.n42,E=a.n43,w=a.n44,F=b.n11,u=b.n12,H=b.n13,P=b.n14,e=b.n21,M=b.n22,N=b.n23,W=b.n24,S=b.n31,aa=b.n32,ca=b.n33,K=b.n34;this.n11=
-c*F+d*e+f*S;this.n12=c*u+d*M+f*aa;this.n13=c*H+d*N+f*ca;this.n14=c*P+d*W+f*K+g;this.n21=h*F+k*e+j*S;this.n22=h*u+k*M+j*aa;this.n23=h*H+k*N+j*ca;this.n24=h*P+k*W+j*K+m;this.n31=o*F+y*e+p*S;this.n32=o*u+y*M+p*aa;this.n33=o*H+y*N+p*ca;this.n34=o*P+y*W+p*K+q;this.n41=A*F+C*e+E*S;this.n42=A*u+C*M+E*aa;this.n43=A*H+C*N+E*ca;this.n44=A*P+C*W+E*K+w;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,o=a.n24,y=a.n31,p=a.n32,q=a.n33,A=a.n34,C=a.n41,E=a.n42,
-w=a.n43;a=a.n44;var F=b.n11,u=b.n12,H=b.n13,P=b.n14,e=b.n21,M=b.n22,N=b.n23,W=b.n24,S=b.n31,aa=b.n32,ca=b.n33,K=b.n34,Y=b.n41,oa=b.n42,ba=b.n43;b=b.n44;this.n11=d*F+f*e+g*S+h*Y;this.n12=d*u+f*M+g*aa+h*oa;this.n13=d*H+f*N+g*ca+h*ba;this.n14=d*P+f*W+g*K+h*b;this.n21=k*F+j*e+m*S+o*Y;this.n22=k*u+j*M+m*aa+o*oa;this.n23=k*H+j*N+m*ca+o*ba;this.n24=k*P+j*W+m*K+o*b;this.n31=y*F+p*e+q*S+A*Y;this.n32=y*u+p*M+q*aa+A*oa;this.n33=y*H+p*N+q*ca+A*ba;this.n34=y*P+p*W+q*K+A*b;this.n41=C*F+E*e+w*S+a*Y;this.n42=C*u+
-E*M+w*aa+a*oa;this.n43=C*H+E*N+w*ca+a*ba;this.n44=C*P+E*W+w*K+a*b;c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,o=this.n32,y=this.n33,p=this.n34,q=this.n41,A=this.n42,C=this.n43,
-E=this.n44,w=a.n11,F=a.n21,u=a.n31,H=a.n12,P=a.n22,e=a.n32,M=a.n13,N=a.n23,W=a.n33,S=a.n14,aa=a.n24;a=a.n34;this.n11=b*w+c*F+d*u;this.n12=b*H+c*P+d*e;this.n13=b*M+c*N+d*W;this.n14=b*S+c*aa+d*a+f;this.n21=g*w+h*F+k*u;this.n22=g*H+h*P+k*e;this.n23=g*M+h*N+k*W;this.n24=g*S+h*aa+k*a+j;this.n31=m*w+o*F+y*u;this.n32=m*H+o*P+y*e;this.n33=m*M+o*N+y*W;this.n34=m*S+o*aa+y*a+p;this.n41=q*w+A*F+C*u;this.n42=q*H+A*P+C*e;this.n43=q*M+A*N+C*W;this.n44=q*S+A*aa+C*a+E;return this},multiplyScalar:function(a){this.n11*=
-a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,o=this.n33,y=this.n34,p=this.n41,q=this.n42,A=this.n43,C=this.n44;return d*h*m*p-c*k*m*p-d*g*o*p+b*k*o*p+c*g*y*p-b*h*y*p-d*h*j*q+c*k*j*q+d*f*o*q-a*k*o*q-c*f*y*q+a*h*y*q+
-d*g*j*A-b*k*j*A-d*f*m*A+a*k*m*A+b*f*y*A-a*g*y*A-c*g*j*C+b*h*j*C+c*f*m*C-a*h*m*C-b*f*o*C+a*g*o*C},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;
+b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,z=a.n32,q=a.n33,t=a.n34,B=a.n41,C=a.n42,F=a.n43,w=a.n44,H=b.n11,u=b.n12,I=b.n13,N=b.n14,e=b.n21,L=b.n22,M=b.n23,V=b.n24,R=b.n31,aa=b.n32,ca=b.n33,J=b.n34;this.n11=
+c*H+d*e+f*R;this.n12=c*u+d*L+f*aa;this.n13=c*I+d*M+f*ca;this.n14=c*N+d*V+f*J+g;this.n21=h*H+k*e+j*R;this.n22=h*u+k*L+j*aa;this.n23=h*I+k*M+j*ca;this.n24=h*N+k*V+j*J+m;this.n31=o*H+z*e+q*R;this.n32=o*u+z*L+q*aa;this.n33=o*I+z*M+q*ca;this.n34=o*N+z*V+q*J+t;this.n41=B*H+C*e+F*R;this.n42=B*u+C*L+F*aa;this.n43=B*I+C*M+F*ca;this.n44=B*N+C*V+F*J+w;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,o=a.n24,z=a.n31,q=a.n32,t=a.n33,B=a.n34,C=a.n41,F=a.n42,
+w=a.n43;a=a.n44;var H=b.n11,u=b.n12,I=b.n13,N=b.n14,e=b.n21,L=b.n22,M=b.n23,V=b.n24,R=b.n31,aa=b.n32,ca=b.n33,J=b.n34,Y=b.n41,oa=b.n42,ba=b.n43;b=b.n44;this.n11=d*H+f*e+g*R+h*Y;this.n12=d*u+f*L+g*aa+h*oa;this.n13=d*I+f*M+g*ca+h*ba;this.n14=d*N+f*V+g*J+h*b;this.n21=k*H+j*e+m*R+o*Y;this.n22=k*u+j*L+m*aa+o*oa;this.n23=k*I+j*M+m*ca+o*ba;this.n24=k*N+j*V+m*J+o*b;this.n31=z*H+q*e+t*R+B*Y;this.n32=z*u+q*L+t*aa+B*oa;this.n33=z*I+q*M+t*ca+B*ba;this.n34=z*N+q*V+t*J+B*b;this.n41=C*H+F*e+w*R+a*Y;this.n42=C*u+
+F*L+w*aa+a*oa;this.n43=C*I+F*M+w*ca+a*ba;this.n44=C*N+F*V+w*J+a*b;c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,o=this.n32,z=this.n33,q=this.n34,t=this.n41,B=this.n42,C=this.n43,
+F=this.n44,w=a.n11,H=a.n21,u=a.n31,I=a.n12,N=a.n22,e=a.n32,L=a.n13,M=a.n23,V=a.n33,R=a.n14,aa=a.n24;a=a.n34;this.n11=b*w+c*H+d*u;this.n12=b*I+c*N+d*e;this.n13=b*L+c*M+d*V;this.n14=b*R+c*aa+d*a+f;this.n21=g*w+h*H+k*u;this.n22=g*I+h*N+k*e;this.n23=g*L+h*M+k*V;this.n24=g*R+h*aa+k*a+j;this.n31=m*w+o*H+z*u;this.n32=m*I+o*N+z*e;this.n33=m*L+o*M+z*V;this.n34=m*R+o*aa+z*a+q;this.n41=t*w+B*H+C*u;this.n42=t*I+B*N+C*e;this.n43=t*L+B*M+C*V;this.n44=t*R+B*aa+C*a+F;return this},multiplyScalar:function(a){this.n11*=
+a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,o=this.n33,z=this.n34,q=this.n41,t=this.n42,B=this.n43,C=this.n44;return d*h*m*q-c*k*m*q-d*g*o*q+b*k*o*q+c*g*z*q-b*h*z*q-d*h*j*t+c*k*j*t+d*f*o*t-a*k*o*t-c*f*z*t+a*h*z*t+
+d*g*j*B-b*k*j*B-d*f*m*B+a*k*m*B+b*f*z*B-a*g*z*B-c*g*j*C+b*h*j*C+c*f*m*C-a*h*m*C-b*f*o*C+a*g*o*C},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;
 a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flattenToArray(this.flat);return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,
 a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flattenToArray(this.flat);return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,
 b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,
 b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,
 0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,k=a.z,j=f*g,m=f*h;this.set(j*g+c,j*h-d*k,j*k+d*h,0,j*h+d*k,m*h+c,m*k-d*g,0,j*k-d*h,m*k+d*g,f*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=
 0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,k=a.z,j=f*g,m=f*h;this.set(j*g+c,j*h-d*k,j*k+d*h,0,j*h+d*k,m*h+c,m*k-d*g,0,j*k-d*h,m*k+d*g,f*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=
 a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=a*c,k=b*c;this.n11=f*g;this.n12=-f*d;this.n13=c;this.n21=k*g+a*d;this.n22=-k*d+a*g;this.n23=-b*f;this.n31=-h*g+b*d;this.n32=h*d+b*g;this.n33=a*f},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,k=d+d;a=b*g;var j=b*h;b*=k;var m=c*h;c*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(m+d);this.n12=j-f;this.n13=
 a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(b);b=Math.sin(b);var f=Math.cos(c);c=Math.sin(c);var g=Math.cos(d);d=Math.sin(d);var h=a*c,k=b*c;this.n11=f*g;this.n12=-f*d;this.n13=c;this.n21=k*g+a*d;this.n22=-k*d+a*g;this.n23=-b*f;this.n31=-h*g+b*d;this.n32=h*d+b*g;this.n33=a*f},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,k=d+d;a=b*g;var j=b*h;b*=k;var m=c*h;c*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(m+d);this.n12=j-f;this.n13=
 b+h;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this}};THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};
 b+h;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this}};THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};
 THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
 THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,y=a.n32,p=a.n33,q=a.n34,A=a.n41,C=a.n42,E=a.n43,w=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=j*q*C-m*p*C+m*y*E-k*q*E-j*y*w+k*p*w;b.n12=g*p*C-f*q*C-g*y*E+d*q*E+f*y*w-d*p*w;b.n13=f*m*C-g*j*C+g*k*E-d*m*E-f*k*w+d*j*w;b.n14=g*j*y-f*m*y-g*k*p+d*m*p+f*k*q-d*j*q;b.n21=m*p*A-j*q*A-m*o*E+h*q*E+j*o*w-h*p*w;b.n22=f*q*A-g*p*A+g*o*E-c*q*E-f*o*w+c*p*w;b.n23=g*j*A-f*m*A-g*h*E+c*m*E+f*h*w-c*j*w;
-b.n24=f*m*o-g*j*o+g*h*p-c*m*p-f*h*q+c*j*q;b.n31=k*q*A-m*y*A+m*o*C-h*q*C-k*o*w+h*y*w;b.n32=g*y*A-d*q*A-g*o*C+c*q*C+d*o*w-c*y*w;b.n33=f*m*A-g*k*A+g*h*C-c*m*C-d*h*w+c*k*w;b.n34=g*k*o-d*m*o-g*h*y+c*m*y+d*h*q-c*k*q;b.n41=j*y*A-k*p*A-j*o*C+h*p*C+k*o*E-h*y*E;b.n42=d*p*A-f*y*A+f*o*C-c*p*C-d*o*E+c*y*E;b.n43=f*k*A-d*j*A-f*h*C+c*j*C+d*h*E-c*k*E;b.n44=d*j*o-f*k*o+f*h*y-c*j*y-d*h*p+c*k*p;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*k;c[5]=a*j;c[6]=a*m;c[7]=a*o;c[8]=a*y;return b};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,z=a.n32,q=a.n33,t=a.n34,B=a.n41,C=a.n42,F=a.n43,w=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=j*t*C-m*q*C+m*z*F-k*t*F-j*z*w+k*q*w;b.n12=g*q*C-f*t*C-g*z*F+d*t*F+f*z*w-d*q*w;b.n13=f*m*C-g*j*C+g*k*F-d*m*F-f*k*w+d*j*w;b.n14=g*j*z-f*m*z-g*k*q+d*m*q+f*k*t-d*j*t;b.n21=m*q*B-j*t*B-m*o*F+h*t*F+j*o*w-h*q*w;b.n22=f*t*B-g*q*B+g*o*F-c*t*F-f*o*w+c*q*w;b.n23=g*j*B-f*m*B-g*h*F+c*m*F+f*h*w-c*j*w;
+b.n24=f*m*o-g*j*o+g*h*q-c*m*q-f*h*t+c*j*t;b.n31=k*t*B-m*z*B+m*o*C-h*t*C-k*o*w+h*z*w;b.n32=g*z*B-d*t*B-g*o*C+c*t*C+d*o*w-c*z*w;b.n33=f*m*B-g*k*B+g*h*C-c*m*C-d*h*w+c*k*w;b.n34=g*k*o-d*m*o-g*h*z+c*m*z+d*h*t-c*k*t;b.n41=j*z*B-k*q*B-j*o*C+h*q*C+k*o*F-h*z*F;b.n42=d*q*B-f*z*B+f*o*C-c*q*C-d*o*F+c*z*F;b.n43=f*k*B-d*j*B-f*h*C+c*j*C+d*h*F-c*k*F;b.n44=d*j*o-f*k*o+f*h*z-c*j*z-d*h*q+c*k*q;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*k;c[5]=a*j;c[6]=a*m;c[7]=a*o;c[8]=a*z;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,k,j,m;h=new THREE.Matrix4;k=b-a;j=c-d;m=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((b+a)/k);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((c+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
 THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,k,j,m;h=new THREE.Matrix4;k=b-a;j=c-d;m=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((b+a)/k);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((c+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixNeedsUpdate=!0;this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixNeedsUpdate=!0;this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
@@ -48,8 +48,8 @@ this.matrixWorld.n21*b;this.matrixRotationWorld.n31=this.matrixWorld.n31*b;this.
 THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
 THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(c);c=Math.sin(c);var h=a*b,k=d*f;this.w=h*g-k*c;this.x=h*c+k*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(c);c=Math.sin(c);var h=a*b,k=d*f;this.w=h*g-k*c;this.x=h*c+k*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=b*a+f*g+c*k-d*h;this.y=c*a+f*h+d*g-b*k;this.z=d*a+f*k+b*h-c*g;this.w=f*a-b*g-c*h-d*k;return this},
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=b*a+f*g+c*k-d*h;this.y=c*a+f*h+d*g-b*k;this.z=d*a+f*k+b*h-c*g;this.w=f*a-b*g-c*h-d*k;return this},
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,k=this.z,j=this.w,m=j*c+h*f-k*d,o=j*d+k*c-g*f,y=j*f+g*d-h*c;c=-g*c-h*d-k*f;b.x=m*j+c*-g+o*-k-y*-h;b.y=o*j+c*-h+y*-g-m*-k;b.z=y*j+c*-k+m*-h-o*-g;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
+multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,k=this.z,j=this.w,m=j*c+h*f-k*d,o=j*d+k*c-g*f,z=j*f+g*d-h*c;c=-g*c-h*d-k*f;b.x=m*j+c*-g+o*-k-z*-h;b.y=o*j+c*-h+z*-g-m*-k;b.z=z*j+c*-k+m*-h-o*-g;return b}};
+THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,f){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};THREE.Face4=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g]};
 THREE.Face3=function(a,b,c,d,f){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};THREE.Face4=function(a,b,c,d,f,g){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=g instanceof Array?g:[g]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
@@ -57,28 +57,28 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){k.set(0,0,0);b=0;for(c=g.normal.length;b<c;b++)k.addSelf(g.vertexNormals[b]);k.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){k.set(0,0,0);b=0;for(c=g.normal.length;b<c;b++)k.addSelf(g.vertexNormals[b]);k.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,
 c.position);j.sub(b.position,c.position);k.crossSelf(j)}k.isZero()||k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
 c.position);j.sub(b.position,c.position);k.crossSelf(j)}k.isZero()||k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(K,Y,oa,ba,la,ia,ga){g=K.vertices[Y].position;h=K.vertices[oa].position;k=K.vertices[ba].position;j=f[la];m=f[ia];o=f[ga];y=h.x-g.x;p=k.x-g.x;q=h.y-g.y;
-A=k.y-g.y;C=h.z-g.z;E=k.z-g.z;w=m.u-j.u;F=o.u-j.u;u=m.v-j.v;H=o.v-j.v;P=1/(w*H-F*u);N.set((H*y-u*p)*P,(H*q-u*A)*P,(H*C-u*E)*P);W.set((w*p-F*y)*P,(w*A-F*q)*P,(w*E-F*C)*P);e[Y].addSelf(N);e[oa].addSelf(N);e[ba].addSelf(N);M[Y].addSelf(W);M[oa].addSelf(W);M[ba].addSelf(W)}var b,c,d,f,g,h,k,j,m,o,y,p,q,A,C,E,w,F,u,H,P,e=[],M=[],N=new THREE.Vector3,W=new THREE.Vector3,S=new THREE.Vector3,aa=new THREE.Vector3,ca=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){e[b]=new THREE.Vector3;M[b]=new THREE.Vector3}b=
+b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(J,Y,oa,ba,la,ia,ga){g=J.vertices[Y].position;h=J.vertices[oa].position;k=J.vertices[ba].position;j=f[la];m=f[ia];o=f[ga];z=h.x-g.x;q=k.x-g.x;t=h.y-g.y;
+B=k.y-g.y;C=h.z-g.z;F=k.z-g.z;w=m.u-j.u;H=o.u-j.u;u=m.v-j.v;I=o.v-j.v;N=1/(w*I-H*u);M.set((I*z-u*q)*N,(I*t-u*B)*N,(I*C-u*F)*N);V.set((w*q-H*z)*N,(w*B-H*t)*N,(w*F-H*C)*N);e[Y].addSelf(M);e[oa].addSelf(M);e[ba].addSelf(M);L[Y].addSelf(V);L[oa].addSelf(V);L[ba].addSelf(V)}var b,c,d,f,g,h,k,j,m,o,z,q,t,B,C,F,w,H,u,I,N,e=[],L=[],M=new THREE.Vector3,V=new THREE.Vector3,R=new THREE.Vector3,aa=new THREE.Vector3,ca=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){e[b]=new THREE.Vector3;L[b]=new THREE.Vector3}b=
 0;for(c=this.faces.length;b<c;b++){d=this.faces[b];f=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
 0;for(c=this.faces.length;b<c;b++){d=this.faces[b];f=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
-this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){ca.copy(this.vertices[b].normal);d=e[b];S.copy(d);S.subSelf(ca.multiplyScalar(ca.dot(d))).normalize();aa.cross(this.vertices[b].normal,d);d=aa.dot(M[b]);d=d<0?-1:1;this.vertices[b].tangent.set(S.x,S.y,S.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){ca.copy(this.vertices[b].normal);d=e[b];R.copy(d);R.subSelf(ca.multiplyScalar(ca.dot(d))).normalize();aa.cross(this.vertices[b].normal,d);d=aa.dot(L[b]);d=d<0?-1:1;this.vertices[b].tangent.set(R.x,R.y,R.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){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 b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(){function a(p,q,A,C,E,w,F){p=(A-p)*0.5;C=(C-q)*0.5;return(2*(q-A)+p+C)*F+(-3*(q-A)-2*p-C)*w+p*E+q}var b=[],c={x:0,y:0,z:0},d,f,g,h,k,j,m,o,y;this.get2DPoint=function(p,q){d=(p.length-1)*q;f=Math.floor(d);g=d-f;b[0]=f==0?f:f-1;b[1]=f;b[2]=f>p.length-2?f:f+1;b[3]=f>p.length-3?f:f+2;j=p[b[0]];m=p[b[1]];o=p[b[2]];y=p[b[3]];h=g*g;k=g*h;c.x=a(j.x,m.x,o.x,y.x,g,h,k);c.y=a(j.y,m.y,o.y,y.y,g,h,k);c.z=a(j.z,m.z,o.z,y.z,g,h,k);return c}};
+THREE.Spline=function(){function a(q,t,B,C,F,w,H){q=(B-q)*0.5;C=(C-t)*0.5;return(2*(t-B)+q+C)*H+(-3*(t-B)-2*q-C)*w+q*F+t}var b=[],c={x:0,y:0,z:0},d,f,g,h,k,j,m,o,z;this.get2DPoint=function(q,t){d=(q.length-1)*t;f=Math.floor(d);g=d-f;b[0]=f==0?f:f-1;b[1]=f;b[2]=f>q.length-2?f:f+1;b[3]=f>q.length-3?f:f+2;j=q[b[0]];m=q[b[1]];o=q[b[2]];z=q[b[3]];h=g*g;k=g*h;c.x=a(j.x,m.x,o.x,z.x,g,h,k);c.y=a(j.y,m.y,o.y,z.y,g,h,k);c.z=a(j.z,m.z,o.z,z.z,g,h,k);return c}};
 THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;d<a.length;d++)a[d].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var d=0;d<c.hierarchy.length;d++)for(var f=0;f<c.hierarchy[d].keys.length;f++){if(c.hierarchy[d].keys[f].time<0)c.hierarchy[d].keys[f].time=0;c.hierarchy[d].keys[f].index=f;if(c.hierarchy[d].keys[f].rot!==undefined&&!(c.hierarchy[d].keys[f].rot instanceof
 THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;d<a.length;d++)a[d].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var d=0;d<c.hierarchy.length;d++)for(var f=0;f<c.hierarchy[d].keys.length;f++){if(c.hierarchy[d].keys[f].time<0)c.hierarchy[d].keys[f].time=0;c.hierarchy[d].keys[f].index=f;if(c.hierarchy[d].keys[f].rot!==undefined&&!(c.hierarchy[d].keys[f].rot instanceof
 THREE.Quaternion)){var g=c.hierarchy[d].keys[f].rot;c.hierarchy[d].keys[f].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}f=parseInt(c.length*c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(d=0;d<c.hierarchy.length;d++)c.JIT.hierarchy.push(Array(f));c.initialized=!0}};return b}();
 THREE.Quaternion)){var g=c.hierarchy[d].keys[f].rot;c.hierarchy[d].keys[f].rot=new THREE.Quaternion(g[0],g[1],g[2],g[3])}}f=parseInt(c.length*c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(d=0;d<c.hierarchy.length;d++)c.JIT.hierarchy.push(Array(f));c.initialized=!0}};return b}();
 THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
 THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
-THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.001;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].matrixAutoUpdate=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
+THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].matrixAutoUpdate=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
 this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
 this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
-THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,d,f,g,h,k=this.data.JIT.hierarchy,j=(new Date).getTime()*0.001-this.startTime+this.offset,m=j;if(j>this.data.length){for(;j>this.data.length;)j-=this.data.length;this.startTime=(new Date).getTime()*0.001-j;j=(new Date).getTime()*0.001-this.startTime}h=Math.min(parseInt(j*this.data.fps),parseInt(this.data.length*this.data.fps));for(var o=0,y=this.hierarchy.length;o<y;o++){g=this.hierarchy[o];if(k[o][h]!==undefined){g.skinMatrix=
-k[o][h];g.matrixAutoUpdate=!1;g.matrixNeedsUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,o*16)}else for(var p=0;p<3;p++){c=a[p];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[o].keys[0];f=this.getNextKeyWith(c,o,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,o,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.matrixAutoUpdate=!0;g.matrixNeedsUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];f=f[c];if(c==="rot"){if(b<
-0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)k[o][h]=this.hierarchy[o].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
+THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,d,f,g,h,k=this.data.JIT.hierarchy,j=(new Date).getTime()*0.0010-this.startTime+this.offset,m=j;if(j>this.data.length){for(;j>this.data.length;)j-=this.data.length;this.startTime=(new Date).getTime()*0.0010-j;j=(new Date).getTime()*0.0010-this.startTime}h=Math.min(parseInt(j*this.data.fps),parseInt(this.data.length*this.data.fps));for(var o=0,z=this.hierarchy.length;o<z;o++){g=this.hierarchy[o];if(k[o][h]!==
+undefined){g.skinMatrix=k[o][h];g.matrixAutoUpdate=!1;g.matrixNeedsUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,o*16)}else for(var q=0;q<3;q++){c=a[q];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[o].keys[0];f=this.getNextKeyWith(c,o,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,o,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.matrixAutoUpdate=!0;g.matrixNeedsUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];f=
+f[c];if(c==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)k[o][h]=this.hierarchy[o].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
 THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Camera=function(a,b,c,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);if(h)this.tmpVec.y=0;this.position.addSelf(this.tmpVec);
 THREE.Camera=function(a,b,c,d,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);if(h)this.tmpVec.y=0;this.position.addSelf(this.tmpVec);
 this.target.position.addSelf(this.tmpVec)};this.translateZ=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(h)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 this.target.position.addSelf(this.tmpVec)};this.translateZ=function(g,h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(h)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,
 this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};function bind(a,b){return function(){b.apply(a,arguments)}}function clamp_bottom(a,b){return a<b?b:a}function clamp(a,b,c){return a<b?b:a>c?c:a}
 this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};function bind(a,b){return function(){b.apply(a,arguments)}}function clamp_bottom(a,b){return a<b?b:a}function clamp(a,b,c){return a<b?b:a>c?c:a}
-THREE.QuakeCamera=function(a){THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==
+THREE.QuakeCamera=function(a){THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==
 undefined)this.autoForward=a.autoForward;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phy=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.windowHalfX=
 undefined)this.autoForward=a.autoForward;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phy=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.windowHalfX=
 window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=
 window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=
 !0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?(clamp(this.position.y,this.heightMin,this.heightMax)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&
 !0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?(clamp(this.position.y,this.heightMin,this.heightMax)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&
@@ -137,119 +137,120 @@ THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updat
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
-THREE.Projector=function(){function a(M,N){return N.z-M.z}function b(M,N){var W=0,S=1,aa=M.z+M.w,ca=N.z+N.w,K=-M.z+M.w,Y=-N.z+N.w;if(aa>=0&&ca>=0&&K>=0&&Y>=0)return!0;else if(aa<0&&ca<0||K<0&&Y<0)return!1;else{if(aa<0)W=Math.max(W,aa/(aa-ca));else ca<0&&(S=Math.min(S,aa/(aa-ca)));if(K<0)W=Math.max(W,K/(K-Y));else Y<0&&(S=Math.min(S,K/(K-Y)));if(S<W)return!1;else{M.lerpSelf(N,W);N.lerpSelf(M,1-S);return!0}}}var c,d,f=[],g,h,k,j=[],m,o,y=[],p,q,A=[],C=new THREE.Vector4,E=new THREE.Vector4,w=new THREE.Matrix4,
-F=new THREE.Matrix4,u=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,P=new THREE.Vector4,e;this.projectObjects=function(M,N,W){N=[];var S,aa,ca;d=0;aa=M.objects;M=0;for(S=aa.length;M<S;M++){ca=aa[M];var K;if(!(K=!ca.visible))if(K=ca instanceof THREE.Mesh){a:{K=void 0;for(var Y=ca.matrixWorld,oa=-ca.geometry.boundingSphere.radius*Math.max(ca.scale.x,Math.max(ca.scale.y,ca.scale.z)),ba=0;ba<6;ba++){K=u[ba].x*Y.n14+u[ba].y*
-Y.n24+u[ba].z*Y.n34+u[ba].w;if(K<=oa){K=!1;break a}}K=!0}K=!K}if(!K){c=f[d]=f[d]||new THREE.RenderableObject;C.copy(ca.position);w.multiplyVector3(C);c.object=ca;c.z=C.z;N.push(c);d++}}W&&N.sort(a);return N};this.projectScene=function(M,N,W){var S=[],aa=N.near,ca=N.far,K,Y,oa,ba,la,ia,ga,qa,ua,l,x,v,n,t,B,J;k=o=q=0;N.matrixAutoUpdate&&N.update();w.multiply(N.projectionMatrix,N.matrixWorldInverse);u[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);u[1].set(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,
-w.n44+w.n14);u[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);u[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);u[4].set(w.n41-w.n31,w.n42-w.n32,w.n43-w.n33,w.n44-w.n34);u[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(K=0;K<6;K++){ia=u[K];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}M.update(undefined,!1,N);ia=this.projectObjects(M,N,!0);M=0;for(K=ia.length;M<K;M++){ga=ia[M].object;if(ga.visible){qa=ga.matrixWorld;x=ga.matrixRotationWorld;ua=ga.materials;
-l=ga.overdraw;if(ga instanceof THREE.Mesh){v=ga.geometry;n=v.vertices;Y=0;for(oa=n.length;Y<oa;Y++){t=n[Y];t.positionWorld.copy(t.position);qa.multiplyVector3(t.positionWorld);ba=t.positionScreen;ba.copy(t.positionWorld);w.multiplyVector4(ba);ba.x/=ba.w;ba.y/=ba.w;t.__visible=ba.z>aa&&ba.z<ca}v=v.faces;Y=0;for(oa=v.length;Y<oa;Y++){t=v[Y];if(t instanceof THREE.Face3){ba=n[t.a];la=n[t.b];B=n[t.c];if(ba.__visible&&la.__visible&&B.__visible&&(ga.doubleSided||ga.flipSided!=(B.positionScreen.x-ba.positionScreen.x)*
-(la.positionScreen.y-ba.positionScreen.y)-(B.positionScreen.y-ba.positionScreen.y)*(la.positionScreen.x-ba.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ba.positionWorld);g.v2.positionWorld.copy(la.positionWorld);g.v3.positionWorld.copy(B.positionWorld);g.v1.positionScreen.copy(ba.positionScreen);g.v2.positionScreen.copy(la.positionScreen);g.v3.positionScreen.copy(B.positionScreen);g.normalWorld.copy(t.normal);x.multiplyVector3(g.normalWorld);g.centroidWorld.copy(t.centroid);
-qa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);B=t.vertexNormals;e=g.vertexNormalsWorld;ba=0;for(la=B.length;ba<la;ba++){J=e[ba]=e[ba]||new THREE.Vector3;J.copy(B[ba]);x.multiplyVector3(J)}g.z=g.centroidScreen.z;g.meshMaterials=ua;g.faceMaterials=t.materials;g.overdraw=l;if(ga.geometry.uvs[Y]){g.uvs[0]=ga.geometry.uvs[Y][0];g.uvs[1]=ga.geometry.uvs[Y][1];g.uvs[2]=ga.geometry.uvs[Y][2]}S.push(g);k++}}else if(t instanceof THREE.Face4){ba=
-n[t.a];la=n[t.b];B=n[t.c];J=n[t.d];if(ba.__visible&&la.__visible&&B.__visible&&J.__visible&&(ga.doubleSided||ga.flipSided!=((J.positionScreen.x-ba.positionScreen.x)*(la.positionScreen.y-ba.positionScreen.y)-(J.positionScreen.y-ba.positionScreen.y)*(la.positionScreen.x-ba.positionScreen.x)<0||(la.positionScreen.x-B.positionScreen.x)*(J.positionScreen.y-B.positionScreen.y)-(la.positionScreen.y-B.positionScreen.y)*(J.positionScreen.x-B.positionScreen.x)<0))){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ba.positionWorld);
-g.v2.positionWorld.copy(la.positionWorld);g.v3.positionWorld.copy(J.positionWorld);g.v1.positionScreen.copy(ba.positionScreen);g.v2.positionScreen.copy(la.positionScreen);g.v3.positionScreen.copy(J.positionScreen);g.normalWorld.copy(t.normal);x.multiplyVector3(g.normalWorld);g.centroidWorld.copy(t.centroid);qa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=ua;g.faceMaterials=t.materials;g.overdraw=
-l;if(ga.geometry.uvs[Y]){g.uvs[0]=ga.geometry.uvs[Y][0];g.uvs[1]=ga.geometry.uvs[Y][1];g.uvs[2]=ga.geometry.uvs[Y][3]}S.push(g);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(la.positionWorld);h.v2.positionWorld.copy(B.positionWorld);h.v3.positionWorld.copy(J.positionWorld);h.v1.positionScreen.copy(la.positionScreen);h.v2.positionScreen.copy(B.positionScreen);h.v3.positionScreen.copy(J.positionScreen);h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);
-h.z=h.centroidScreen.z;h.meshMaterials=ua;h.faceMaterials=t.materials;h.overdraw=l;if(ga.geometry.uvs[Y]){h.uvs[0]=ga.geometry.uvs[Y][1];h.uvs[1]=ga.geometry.uvs[Y][2];h.uvs[2]=ga.geometry.uvs[Y][3]}S.push(h);k++}}}}else if(ga instanceof THREE.Line){F.multiply(w,qa);n=ga.geometry.vertices;t=n[0];t.positionScreen.copy(t.position);F.multiplyVector4(t.positionScreen);Y=1;for(oa=n.length;Y<oa;Y++){ba=n[Y];ba.positionScreen.copy(ba.position);F.multiplyVector4(ba.positionScreen);la=n[Y-1];H.copy(ba.positionScreen);
-P.copy(la.positionScreen);if(b(H,P)){H.multiplyScalar(1/H.w);P.multiplyScalar(1/P.w);m=y[o]=y[o]||new THREE.RenderableLine;m.v1.positionScreen.copy(H);m.v2.positionScreen.copy(P);m.z=Math.max(H.z,P.z);m.materials=ga.materials;S.push(m);o++}}}else if(ga instanceof THREE.Particle){E.set(ga.position.x,ga.position.y,ga.position.z,1);w.multiplyVector4(E);E.z/=E.w;if(E.z>0&&E.z<1){p=A[q]=A[q]||new THREE.RenderableParticle;p.x=E.x/E.w;p.y=E.y/E.w;p.z=E.z;p.rotation=ga.rotation.z;p.scale.x=ga.scale.x*Math.abs(p.x-
-(E.x+N.projectionMatrix.n11)/(E.w+N.projectionMatrix.n14));p.scale.y=ga.scale.y*Math.abs(p.y-(E.y+N.projectionMatrix.n22)/(E.w+N.projectionMatrix.n24));p.materials=ga.materials;S.push(p);q++}}}}W&&S.sort(a);return S};this.unprojectVector=function(M,N){var W=N.matrixWorld.clone();W.multiplySelf(THREE.Matrix4.makeInvert(N.projectionMatrix));W.multiplyVector3(M);return M}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,o,y,p,q,A,C;a=b.projectScene(h,k);j=0;for(m=a.length;j<m;j++){p=a[j];if(p instanceof THREE.RenderableParticle){A=p.x*f+f;C=p.y*g+g;o=0;for(y=p.material.length;o<y;o++){q=p.material[o];if(q instanceof THREE.ParticleDOMMaterial){q=q.domElement;q.style.left=A+"px";q.style.top=C+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(ma){if(p!=ma)m.globalAlpha=p=ma}function b(ma){if(q!=ma){switch(ma){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}q=ma}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,j,m=f.getContext("2d"),o=new THREE.Color(0),y=0,p=1,q=0,A=null,C=null,E=1,w,F,u,H,P,e,M,N,W,S=new THREE.Color,
-aa=new THREE.Color,ca=new THREE.Color,K=new THREE.Color,Y=new THREE.Color,oa,ba,la,ia,ga,qa,ua,l,x,v=new THREE.Rectangle,n=new THREE.Rectangle,t=new THREE.Rectangle,B=!1,J=new THREE.Color,Q=new THREE.Color,G=new THREE.Color,z=new THREE.Color,D=Math.PI*2,I=new THREE.Vector3,T,U,ea,da,xa,R,Da=16;T=document.createElement("canvas");T.width=T.height=2;U=T.getContext("2d");U.fillStyle="rgba(0,0,0,1)";U.fillRect(0,0,2,2);ea=U.getImageData(0,0,2,2);da=ea.data;xa=document.createElement("canvas");xa.width=
-xa.height=Da;R=xa.getContext("2d");R.translate(-Da/2,-Da/2);R.scale(Da,Da);Da--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ma,Aa){g=ma;h=Aa;k=g/2;j=h/2;f.width=g;f.height=h;v.set(-k,-j,k,j);p=1;q=0;C=A=null;E=1};this.setClearColor=function(ma,Aa){o=ma;y=Aa};this.setClearColorHex=function(ma,Aa){o.setHex(ma);y=Aa};this.clear=function(){m.setTransform(1,0,0,-1,k,j);if(!n.isEmpty()){n.inflate(1);n.minSelf(v);if(o.hex==0&&y==0)m.clearRect(n.getX(),
-n.getY(),n.getWidth(),n.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+y+")";m.fillRect(n.getX(),n.getY(),n.getWidth(),n.getHeight())}n.empty()}};this.render=function(ma,Aa){function Z(O){var ka,ha,V,fa=O.lights;Q.setRGB(0,0,0);G.setRGB(0,0,0);z.setRGB(0,0,0);O=0;for(ka=fa.length;O<ka;O++){ha=fa[O];V=ha.color;if(ha instanceof THREE.AmbientLight){Q.r+=V.r;Q.g+=V.g;Q.b+=V.b}else if(ha instanceof THREE.DirectionalLight){G.r+=
-V.r;G.g+=V.g;G.b+=V.b}else if(ha instanceof THREE.PointLight){z.r+=V.r;z.g+=V.g;z.b+=V.b}}}function X(O,ka,ha,V){var fa,pa,Ca,va,Ea=O.lights;O=0;for(fa=Ea.length;O<fa;O++){pa=Ea[O];Ca=pa.color;va=pa.intensity;if(pa instanceof THREE.DirectionalLight){pa=ha.dot(pa.position)*va;if(pa>0){V.r+=Ca.r*pa;V.g+=Ca.g*pa;V.b+=Ca.b*pa}}else if(pa instanceof THREE.PointLight){I.sub(pa.position,ka);I.normalize();pa=ha.dot(I)*va;if(pa>0){V.r+=Ca.r*pa;V.g+=Ca.g*pa;V.b+=Ca.b*pa}}}}function $(O,ka,ha){if(ha.opacity!=
-0){a(ha.opacity);b(ha.blending);var V,fa,pa,Ca,va,Ea;if(ha instanceof THREE.ParticleBasicMaterial){if(ha.map){Ca=ha.map.image;va=Ca.width>>1;Ea=Ca.height>>1;fa=ka.scale.x*k;pa=ka.scale.y*j;ha=fa*va;V=pa*Ea;t.set(O.x-ha,O.y-V,O.x+ha,O.y+V);if(v.instersects(t)){m.save();m.translate(O.x,O.y);m.rotate(-ka.rotation);m.scale(fa,-pa);m.translate(-va,-Ea);m.drawImage(Ca,0,0);m.restore()}}}else if(ha instanceof THREE.ParticleCircleMaterial){if(B){J.r=Q.r+G.r+z.r;J.g=Q.g+G.g+z.g;J.b=Q.b+G.b+z.b;S.r=ha.color.r*
-J.r;S.g=ha.color.g*J.g;S.b=ha.color.b*J.b;S.updateStyleString()}else S.__styleString=ha.color.__styleString;ha=ka.scale.x*k;V=ka.scale.y*j;t.set(O.x-ha,O.y-V,O.x+ha,O.y+V);if(v.instersects(t)){fa=S.__styleString;if(C!=fa)m.fillStyle=C=fa;m.save();m.translate(O.x,O.y);m.rotate(-ka.rotation);m.scale(ha,V);m.beginPath();m.arc(0,0,1,0,D,!0);m.closePath();m.fill();m.restore()}}}}function sa(O,ka,ha,V){if(V.opacity!=0){a(V.opacity);b(V.blending);m.beginPath();m.moveTo(O.positionScreen.x,O.positionScreen.y);
-m.lineTo(ka.positionScreen.x,ka.positionScreen.y);m.closePath();if(V instanceof THREE.LineBasicMaterial){S.__styleString=V.color.__styleString;O=V.linewidth;if(E!=O)m.lineWidth=E=O;O=S.__styleString;if(A!=O)m.strokeStyle=A=O;m.stroke();t.inflate(V.linewidth*2)}}}function Fa(O,ka,ha,V,fa,pa){if(fa.opacity!=0){a(fa.opacity);b(fa.blending);H=O.positionScreen.x;P=O.positionScreen.y;e=ka.positionScreen.x;M=ka.positionScreen.y;N=ha.positionScreen.x;W=ha.positionScreen.y;m.beginPath();m.moveTo(H,P);m.lineTo(e,
-M);m.lineTo(N,W);m.lineTo(H,P);m.closePath();if(fa instanceof THREE.MeshBasicMaterial)if(fa.map)fa.map.mapping instanceof THREE.UVMapping&&ya(H,P,e,M,N,W,fa.map.image,V.uvs[0].u,V.uvs[0].v,V.uvs[1].u,V.uvs[1].v,V.uvs[2].u,V.uvs[2].v);else if(fa.envMap){if(fa.envMap.mapping instanceof THREE.SphericalReflectionMapping){O=Aa.matrixWorldInverse;I.copy(V.vertexNormalsWorld[0]);ia=(I.x*O.n11+I.y*O.n12+I.z*O.n13)*0.5+0.5;ga=-(I.x*O.n21+I.y*O.n22+I.z*O.n23)*0.5+0.5;I.copy(V.vertexNormalsWorld[1]);qa=(I.x*
-O.n11+I.y*O.n12+I.z*O.n13)*0.5+0.5;ua=-(I.x*O.n21+I.y*O.n22+I.z*O.n23)*0.5+0.5;I.copy(V.vertexNormalsWorld[2]);l=(I.x*O.n11+I.y*O.n12+I.z*O.n13)*0.5+0.5;x=-(I.x*O.n21+I.y*O.n22+I.z*O.n23)*0.5+0.5;ya(H,P,e,M,N,W,fa.envMap.image,ia,ga,qa,ua,l,x)}}else fa.wireframe?za(fa.color.__styleString,fa.wireframeLinewidth):L(fa.color.__styleString);else if(fa instanceof THREE.MeshLambertMaterial){if(fa.map&&!fa.wireframe){fa.map.mapping instanceof THREE.UVMapping&&ya(H,P,e,M,N,W,fa.map.image,V.uvs[0].u,V.uvs[0].v,
-V.uvs[1].u,V.uvs[1].v,V.uvs[2].u,V.uvs[2].v);b(THREE.SubtractiveBlending)}if(B)if(!fa.wireframe&&fa.shading==THREE.SmoothShading&&V.vertexNormalsWorld.length==3){aa.r=ca.r=K.r=Q.r;aa.g=ca.g=K.g=Q.g;aa.b=ca.b=K.b=Q.b;X(pa,V.v1.positionWorld,V.vertexNormalsWorld[0],aa);X(pa,V.v2.positionWorld,V.vertexNormalsWorld[1],ca);X(pa,V.v3.positionWorld,V.vertexNormalsWorld[2],K);Y.r=(ca.r+K.r)*0.5;Y.g=(ca.g+K.g)*0.5;Y.b=(ca.b+K.b)*0.5;la=Ra(aa,ca,K,Y);ya(H,P,e,M,N,W,la,0,0,1,0,0,1)}else{J.r=Q.r;J.g=Q.g;J.b=
-Q.b;X(pa,V.centroidWorld,V.normalWorld,J);S.r=fa.color.r*J.r;S.g=fa.color.g*J.g;S.b=fa.color.b*J.b;S.updateStyleString();fa.wireframe?za(S.__styleString,fa.wireframeLinewidth):L(S.__styleString)}else fa.wireframe?za(fa.color.__styleString,fa.wireframeLinewidth):L(fa.color.__styleString)}else if(fa instanceof THREE.MeshDepthMaterial){oa=Aa.near;ba=Aa.far;aa.r=aa.g=aa.b=1-Pa(O.positionScreen.z,oa,ba);ca.r=ca.g=ca.b=1-Pa(ka.positionScreen.z,oa,ba);K.r=K.g=K.b=1-Pa(ha.positionScreen.z,oa,ba);Y.r=(ca.r+
-K.r)*0.5;Y.g=(ca.g+K.g)*0.5;Y.b=(ca.b+K.b)*0.5;la=Ra(aa,ca,K,Y);ya(H,P,e,M,N,W,la,0,0,1,0,0,1)}else if(fa instanceof THREE.MeshNormalMaterial){S.r=Ia(V.normalWorld.x);S.g=Ia(V.normalWorld.y);S.b=Ia(V.normalWorld.z);S.updateStyleString();fa.wireframe?za(S.__styleString,fa.wireframeLinewidth):L(S.__styleString)}}}function za(O,ka){if(A!=O)m.strokeStyle=A=O;if(E!=ka)m.lineWidth=E=ka;m.stroke();t.inflate(ka*2)}function L(O){if(C!=O)m.fillStyle=C=O;m.fill()}function ya(O,ka,ha,V,fa,pa,Ca,va,Ea,Na,La,Oa,
-Ka){var Ga,Ja;Ga=Ca.width-1;Ja=Ca.height-1;va*=Ga;Ea*=Ja;Na*=Ga;La*=Ja;Oa*=Ga;Ka*=Ja;ha-=O;V-=ka;fa-=O;pa-=ka;Na-=va;La-=Ea;Oa-=va;Ka-=Ea;Ga=Na*Ka-Oa*La;if(Ga!=0){Ja=1/Ga;Ga=(Ka*ha-La*fa)*Ja;La=(Ka*V-La*pa)*Ja;ha=(Na*fa-Oa*ha)*Ja;V=(Na*pa-Oa*V)*Ja;O=O-Ga*va-ha*Ea;ka=ka-La*va-V*Ea;m.save();m.transform(Ga,La,ha,V,O,ka);m.clip();m.drawImage(Ca,0,0);m.restore()}}function Ra(O,ka,ha,V){var fa=~~(O.r*255),pa=~~(O.g*255);O=~~(O.b*255);var Ca=~~(ka.r*255),va=~~(ka.g*255);ka=~~(ka.b*255);var Ea=~~(ha.r*255),
-Na=~~(ha.g*255);ha=~~(ha.b*255);var La=~~(V.r*255),Oa=~~(V.g*255);V=~~(V.b*255);da[0]=fa<0?0:fa>255?255:fa;da[1]=pa<0?0:pa>255?255:pa;da[2]=O<0?0:O>255?255:O;da[4]=Ca<0?0:Ca>255?255:Ca;da[5]=va<0?0:va>255?255:va;da[6]=ka<0?0:ka>255?255:ka;da[8]=Ea<0?0:Ea>255?255:Ea;da[9]=Na<0?0:Na>255?255:Na;da[10]=ha<0?0:ha>255?255:ha;da[12]=La<0?0:La>255?255:La;da[13]=Oa<0?0:Oa>255?255:Oa;da[14]=V<0?0:V>255?255:V;U.putImageData(ea,0,0);R.drawImage(T,0,0);return xa}function Pa(O,ka,ha){O=(O-ka)/(ha-ka);return O*
-O*(3-2*O)}function Ia(O){O=(O+1)*0.5;return O<0?0:O>1?1:O}function ta(O,ka){var ha=ka.x-O.x,V=ka.y-O.y,fa=1/Math.sqrt(ha*ha+V*V);ha*=fa;V*=fa;ka.x+=ha;ka.y+=V;O.x-=ha;O.y-=V}var Ba,wa,ja,na,ra,Ma,Ha,Sa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(ma,Aa,this.sortElements);(B=ma.lights.length>0)&&Z(ma);Ba=0;for(wa=c.length;Ba<wa;Ba++){ja=c[Ba];t.empty();if(ja instanceof THREE.RenderableParticle){w=ja;w.x*=k;w.y*=j;na=0;for(ra=ja.materials.length;na<ra;na++)$(w,ja,ja.materials[na],
-ma)}else if(ja instanceof THREE.RenderableLine){w=ja.v1;F=ja.v2;w.positionScreen.x*=k;w.positionScreen.y*=j;F.positionScreen.x*=k;F.positionScreen.y*=j;t.addPoint(w.positionScreen.x,w.positionScreen.y);t.addPoint(F.positionScreen.x,F.positionScreen.y);if(v.instersects(t)){na=0;for(ra=ja.materials.length;na<ra;)sa(w,F,ja,ja.materials[na++],ma)}}else if(ja instanceof THREE.RenderableFace3){w=ja.v1;F=ja.v2;u=ja.v3;w.positionScreen.x*=k;w.positionScreen.y*=j;F.positionScreen.x*=k;F.positionScreen.y*=
-j;u.positionScreen.x*=k;u.positionScreen.y*=j;if(ja.overdraw){ta(w.positionScreen,F.positionScreen);ta(F.positionScreen,u.positionScreen);ta(u.positionScreen,w.positionScreen)}t.add3Points(w.positionScreen.x,w.positionScreen.y,F.positionScreen.x,F.positionScreen.y,u.positionScreen.x,u.positionScreen.y);if(v.instersects(t)){na=0;for(ra=ja.meshMaterials.length;na<ra;){Sa=ja.meshMaterials[na++];if(Sa instanceof THREE.MeshFaceMaterial){Ma=0;for(Ha=ja.faceMaterials.length;Ma<Ha;)(Sa=ja.faceMaterials[Ma++])&&
-Fa(w,F,u,ja,Sa,ma)}else Fa(w,F,u,ja,Sa,ma)}}}n.addRectangle(t)}m.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(ia,ga,qa){var ua,l,x,v;ua=0;for(l=ia.lights.length;ua<l;ua++){x=ia.lights[ua];if(x instanceof THREE.DirectionalLight){v=ga.normalWorld.dot(x.position)*x.intensity;if(v>0){qa.r+=x.color.r*v;qa.g+=x.color.g*v;qa.b+=x.color.b*v}}else if(x instanceof THREE.PointLight){W.sub(x.position,ga.centroidWorld);W.normalize();v=ga.normalWorld.dot(W)*x.intensity;if(v>0){qa.r+=x.color.r*v;qa.g+=x.color.g*v;qa.b+=x.color.b*v}}}}function b(ia,ga,qa,ua,l,x){K=d(Y++);K.setAttribute("d",
-"M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)u.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(F){H.r=P.r;H.g=P.g;H.b=P.b;a(x,ua,H);u.r=l.color.r*H.r;u.g=l.color.g*H.g;u.b=l.color.b*H.b;u.updateStyleString()}else u.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){N=1-l.__2near/(l.__farPlusNear-
-ua.z*l.__farMinusNear);u.setRGB(N,N,N)}else l instanceof THREE.MeshNormalMaterial&&u.setRGB(f(ua.normalWorld.x),f(ua.normalWorld.y),f(ua.normalWorld.z));l.wireframe?K.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):K.setAttribute("style","fill: "+u.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(K)}function c(ia,ga,qa,ua,l,
-x,v){K=d(Y++);K.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+" L "+ua.positionScreen.x+","+ua.positionScreen.y+"z");if(x instanceof THREE.MeshBasicMaterial)u.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshLambertMaterial)if(F){H.r=P.r;H.g=P.g;H.b=P.b;a(v,l,H);u.r=x.color.r*H.r;u.g=x.color.g*H.g;u.b=x.color.b*H.b;u.updateStyleString()}else u.__styleString=x.color.__styleString;
-else if(x instanceof THREE.MeshDepthMaterial){N=1-x.__2near/(x.__farPlusNear-l.z*x.__farMinusNear);u.setRGB(N,N,N)}else x instanceof THREE.MeshNormalMaterial&&u.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));x.wireframe?K.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+x.wireframeLinewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.wireframeLinecap+"; stroke-linejoin: "+x.wireframeLinejoin):K.setAttribute("style","fill: "+u.__styleString+
-"; fill-opacity: "+x.opacity);k.appendChild(K)}function d(ia){if(S[ia]==null){S[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");la==0&&S[ia].setAttribute("shape-rendering","crispEdges")}return S[ia]}function f(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,o,y,p,q,A,C,E=new THREE.Rectangle,w=new THREE.Rectangle,F=!1,u=new THREE.Color(16777215),H=new THREE.Color(16777215),
-P=new THREE.Color(0),e=new THREE.Color(0),M=new THREE.Color(0),N,W=new THREE.Vector3,S=[],aa=[],ca=[],K,Y,oa,ba,la=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":la=1;break;case "low":la=0}};this.setSize=function(ia,ga){j=ia;m=ga;o=j/2;y=m/2;k.setAttribute("viewBox",-o+" "+-y+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);E.set(-o,-y,o,y)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
-this.render=function(ia,ga){var qa,ua,l,x,v,n,t,B;this.autoClear&&this.clear();g=h.projectScene(ia,ga,this.sortElements);ba=oa=Y=0;if(F=ia.lights.length>0){t=ia.lights;P.setRGB(0,0,0);e.setRGB(0,0,0);M.setRGB(0,0,0);qa=0;for(ua=t.length;qa<ua;qa++){l=t[qa];x=l.color;if(l instanceof THREE.AmbientLight){P.r+=x.r;P.g+=x.g;P.b+=x.b}else if(l instanceof THREE.DirectionalLight){e.r+=x.r;e.g+=x.g;e.b+=x.b}else if(l instanceof THREE.PointLight){M.r+=x.r;M.g+=x.g;M.b+=x.b}}}qa=0;for(ua=g.length;qa<ua;qa++){t=
-g[qa];w.empty();if(t instanceof THREE.RenderableParticle){p=t;p.x*=o;p.y*=-y;l=0;for(x=t.materials.length;l<x;l++)if(B=t.materials[l]){v=p;n=t;var J=oa++;if(aa[J]==null){aa[J]=document.createElementNS("http://www.w3.org/2000/svg","circle");la==0&&aa[J].setAttribute("shape-rendering","crispEdges")}K=aa[J];K.setAttribute("cx",v.x);K.setAttribute("cy",v.y);K.setAttribute("r",n.scale.x*o);if(B instanceof THREE.ParticleCircleMaterial){if(F){H.r=P.r+e.r+M.r;H.g=P.g+e.g+M.g;H.b=P.b+e.b+M.b;u.r=B.color.r*
-H.r;u.g=B.color.g*H.g;u.b=B.color.b*H.b;u.updateStyleString()}else u=B.color;K.setAttribute("style","fill: "+u.__styleString)}k.appendChild(K)}}else if(t instanceof THREE.RenderableLine){p=t.v1;q=t.v2;p.positionScreen.x*=o;p.positionScreen.y*=-y;q.positionScreen.x*=o;q.positionScreen.y*=-y;w.addPoint(p.positionScreen.x,p.positionScreen.y);w.addPoint(q.positionScreen.x,q.positionScreen.y);if(E.instersects(w)){l=0;for(x=t.materials.length;l<x;)if(B=t.materials[l++]){v=p;n=q;J=ba++;if(ca[J]==null){ca[J]=
-document.createElementNS("http://www.w3.org/2000/svg","line");la==0&&ca[J].setAttribute("shape-rendering","crispEdges")}K=ca[J];K.setAttribute("x1",v.positionScreen.x);K.setAttribute("y1",v.positionScreen.y);K.setAttribute("x2",n.positionScreen.x);K.setAttribute("y2",n.positionScreen.y);if(B instanceof THREE.LineBasicMaterial){u.__styleString=B.color.__styleString;K.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+B.linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+
-B.linecap+"; stroke-linejoin: "+B.linejoin);k.appendChild(K)}}}}else if(t instanceof THREE.RenderableFace3){p=t.v1;q=t.v2;A=t.v3;p.positionScreen.x*=o;p.positionScreen.y*=-y;q.positionScreen.x*=o;q.positionScreen.y*=-y;A.positionScreen.x*=o;A.positionScreen.y*=-y;w.addPoint(p.positionScreen.x,p.positionScreen.y);w.addPoint(q.positionScreen.x,q.positionScreen.y);w.addPoint(A.positionScreen.x,A.positionScreen.y);if(E.instersects(w)){l=0;for(x=t.meshMaterials.length;l<x;){B=t.meshMaterials[l++];if(B instanceof
-THREE.MeshFaceMaterial){v=0;for(n=t.faceMaterials.length;v<n;)(B=t.faceMaterials[v++])&&b(p,q,A,t,B,ia)}else B&&b(p,q,A,t,B,ia)}}}else if(t instanceof THREE.RenderableFace4){p=t.v1;q=t.v2;A=t.v3;C=t.v4;p.positionScreen.x*=o;p.positionScreen.y*=-y;q.positionScreen.x*=o;q.positionScreen.y*=-y;A.positionScreen.x*=o;A.positionScreen.y*=-y;C.positionScreen.x*=o;C.positionScreen.y*=-y;w.addPoint(p.positionScreen.x,p.positionScreen.y);w.addPoint(q.positionScreen.x,q.positionScreen.y);w.addPoint(A.positionScreen.x,
-A.positionScreen.y);w.addPoint(C.positionScreen.x,C.positionScreen.y);if(E.instersects(w)){l=0;for(x=t.meshMaterials.length;l<x;){B=t.meshMaterials[l++];if(B instanceof THREE.MeshFaceMaterial){v=0;for(n=t.faceMaterials.length;v<n;)(B=t.faceMaterials[v++])&&c(p,q,A,C,t,B,ia)}else B&&c(p,q,A,C,t,B,ia)}}}}}};
-THREE.WebGLRenderer=function(a){function b(l,x,v){var n,t,B,J=l.vertices,Q=J.length,G=l.colors,z=G.length,D=l.__vertexArray,I=l.__colorArray,T=l.__sortArray,U=l.__dirtyVertices,ea=l.__dirtyColors;if(v.sortParticles){oa.multiplySelf(v.matrixWorld);for(n=0;n<Q;n++){t=J[n].position;ia.copy(t);oa.multiplyVector3(ia);T[n]=[ia.z,n]}T.sort(function(da,xa){return xa[0]-da[0]});for(n=0;n<Q;n++){t=J[T[n][1]].position;B=n*3;D[B]=t.x;D[B+1]=t.y;D[B+2]=t.z}for(n=0;n<z;n++){B=n*3;color=G[T[n][1]];I[B]=color.r;
-I[B+1]=color.g;I[B+2]=color.b}}else{if(U)for(n=0;n<Q;n++){t=J[n].position;B=n*3;D[B]=t.x;D[B+1]=t.y;D[B+2]=t.z}if(ea)for(n=0;n<z;n++){color=G[n];B=n*3;I[B]=color.r;I[B+1]=color.g;I[B+2]=color.b}}if(U||v.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,D,x)}if(ea||v.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,I,x)}}function c(l,x){l.fragmentShader=x.fragmentShader;l.vertexShader=x.vertexShader;l.uniforms=
-Uniforms.clone(x.uniforms)}function d(l,x,v,n,t){n.program||W.initMaterial(n,x,v);var B=n.program,J=B.uniforms,Q=n.uniforms;if(B!=M){e.useProgram(B);M=B;e.uniformMatrix4fv(J.projectionMatrix,!1,ba)}if(v&&(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial||n instanceof THREE.LineBasicMaterial||n instanceof THREE.ParticleBasicMaterial)){Q.fogColor.value.setHex(v.color.hex);if(v instanceof THREE.Fog){Q.fogNear.value=v.near;Q.fogFar.value=
-v.far}else if(v instanceof THREE.FogExp2)Q.fogDensity.value=v.density}if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial){var G,z,D=0,I=0,T=0,U,ea,da,xa=W.lights,R=xa.directional.colors,Da=xa.directional.positions,ma=xa.point.colors,Aa=xa.point.positions,Z=0,X=0;v=z=z=0;for(G=x.length;v<G;v++){z=x[v];U=z.color;ea=z.position;da=z.intensity;if(z instanceof THREE.AmbientLight){D+=U.r;I+=U.g;T+=U.b}else if(z instanceof THREE.DirectionalLight){z=Z*3;R[z]=U.r*da;R[z+1]=U.g*
-da;R[z+2]=U.b*da;Da[z]=ea.x;Da[z+1]=ea.y;Da[z+2]=ea.z;Z+=1}else if(z instanceof THREE.PointLight){z=X*3;ma[z]=U.r*da;ma[z+1]=U.g*da;ma[z+2]=U.b*da;Aa[z]=ea.x;Aa[z+1]=ea.y;Aa[z+2]=ea.z;X+=1}}for(v=Z*3;v<R.length;v++)R[v]=0;for(v=X*3;v<ma.length;v++)ma[v]=0;xa.point.length=X;xa.directional.length=Z;xa.ambient[0]=D;xa.ambient[1]=I;xa.ambient[2]=T;x=W.lights;Q.enableLighting.value=x.directional.length+x.point.length;Q.ambientLightColor.value=x.ambient;Q.directionalLightColor.value=x.directional.colors;
-Q.directionalLightDirection.value=x.directional.positions;Q.pointLightColor.value=x.point.colors;Q.pointLightPosition.value=x.point.positions}if(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial){Q.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);Q.opacity.value=n.opacity;Q.map.texture=n.map;Q.lightMap.texture=n.lightMap;Q.envMap.texture=n.envMap;Q.reflectivity.value=n.reflectivity;Q.refractionRatio.value=
-n.refractionRatio;Q.combine.value=n.combine;Q.useRefract.value=n.envMap&&n.envMap.mapping instanceof THREE.CubeRefractionMapping}if(n instanceof THREE.LineBasicMaterial){Q.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);Q.opacity.value=n.opacity}else if(n instanceof THREE.ParticleBasicMaterial){Q.psColor.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);Q.opacity.value=n.opacity;Q.size.value=n.size;Q.map.texture=n.map}else if(n instanceof THREE.MeshPhongMaterial){Q.ambient.value.setRGB(n.ambient.r,
-n.ambient.g,n.ambient.b);Q.specular.value.setRGB(n.specular.r,n.specular.g,n.specular.b);Q.shininess.value=n.shininess}else if(n instanceof THREE.MeshDepthMaterial){Q.mNear.value=l.near;Q.mFar.value=l.far;Q.opacity.value=n.opacity}else if(n instanceof THREE.MeshNormalMaterial)Q.opacity.value=n.opacity;for(var $ in Q)if(D=B.uniforms[$]){v=Q[$];G=v.type;x=v.value;if(G=="i")e.uniform1i(D,x);else if(G=="f")e.uniform1f(D,x);else if(G=="fv1")e.uniform1fv(D,x);else if(G=="fv")e.uniform3fv(D,x);else if(G==
-"v2")e.uniform2f(D,x.x,x.y);else if(G=="v3")e.uniform3f(D,x.x,x.y,x.z);else if(G=="c")e.uniform3f(D,x.r,x.g,x.b);else if(G=="t"){e.uniform1i(D,x);if(v=v.texture)if(v.image instanceof Array&&v.image.length==6){if(v.image.length==6){if(v.needsUpdate){if(!v.image.__webGLTextureCube)v.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,v.image.__webGLTextureCube);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,
-e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR);for(G=0;G<6;++G)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+G,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,v.image[G]);e.generateMipmap(e.TEXTURE_CUBE_MAP);e.bindTexture(e.TEXTURE_CUBE_MAP,null);v.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_CUBE_MAP,v.image.__webGLTextureCube)}}else{if(v.needsUpdate){if(v.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,
-v.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,v.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,H(v.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,H(v.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,H(v.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,H(v.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}else{v.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,v.__webGLTexture);e.texImage2D(e.TEXTURE_2D,
-0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,v.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,H(v.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,H(v.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,H(v.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,H(v.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null);v.__wasSetOnce=!0}v.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_2D,v.__webGLTexture)}}}e.uniformMatrix4fv(J.modelViewMatrix,
-!1,t._modelViewMatrixArray);e.uniformMatrix3fv(J.normalMatrix,!1,t._normalMatrixArray);(n instanceof THREE.MeshShaderMaterial||n instanceof THREE.MeshPhongMaterial||n.envMap)&&e.uniform3f(J.cameraPosition,l.position.x,l.position.y,l.position.z);(n instanceof THREE.MeshShaderMaterial||n.envMap||n.skinning)&&e.uniformMatrix4fv(J.objectMatrix,!1,t._objectMatrixArray);(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshShaderMaterial||n.skinning)&&e.uniformMatrix4fv(J.viewMatrix,
-!1,la);if(n.skinning){e.uniformMatrix4fv(J.cameraInverseMatrix,!1,la);e.uniformMatrix4fv(J.boneGlobalMatrices,!1,t.boneMatrices)}return B}function f(l,x,v,n,t,B){l=d(l,x,v,n,B).attributes;e.bindBuffer(e.ARRAY_BUFFER,t.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0);if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,
-3,e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(t.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(t.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);
-if(n.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,t.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,
-4,e.FLOAT,!1,0,0)}if(B instanceof THREE.Mesh)if(n.wireframe){e.lineWidth(n.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webGLLineBuffer);e.drawElements(e.LINES,t.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,t.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(B instanceof THREE.Line){B=B.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(n.linewidth);e.drawArrays(B,0,t.__webGLLineCount)}else if(B instanceof
-THREE.ParticleSystem)e.drawArrays(e.POINTS,0,t.__webGLParticleCount);else B instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,t.__webGLVertexCount)}function g(l,x){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(x.attributes.position);e.vertexAttribPointer(x.attributes.position,
-3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(x.attributes.normal);e.vertexAttribPointer(x.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(S!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);S=l.doubleSided}if(aa!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);aa=l.flipSided}}function k(l){if(K!=
-l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);K=l}}function j(l){Y[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);Y[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);Y[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);Y[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);Y[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);Y[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var x;for(l=0;l<6;l++){x=Y[l];x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z))}}
-function m(l){for(var x=l.matrixWorld,v=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),n=0;n<6;n++){l=Y[n].x*x.n14+Y[n].y*x.n24+Y[n].z*x.n34+Y[n].w;if(l<=v)return!1}return!0}function o(l,x){l.list[l.count]=x;l.count+=1}function y(l){var x,v,n=l.object,t=l.opaque,B=l.transparent;B.count=0;l=t.count=0;for(x=n.materials.length;l<x;l++){v=n.materials[l];v.opacity&&v.opacity<1||v.blending!=THREE.NormalBlending?o(B,v):o(t,v)}}function p(l){var x,v,n,t,B=l.object,J=l.buffer,
-Q=l.opaque,G=l.transparent;G.count=0;l=Q.count=0;for(n=B.materials.length;l<n;l++){x=B.materials[l];if(x instanceof THREE.MeshFaceMaterial){x=0;for(v=J.materials.length;x<v;x++)(t=J.materials[x])&&(t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?o(G,t):o(Q,t))}else{t=x;t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?o(G,t):o(Q,t)}}}function q(l,x){return x.z-l.z}function A(l,x){l._modelViewMatrix.multiplyToArray(x.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}
-function C(l){function x(I){var T=[];v=0;for(n=I.length;v<n;v++)I[v]==undefined?T.push("undefined"):T.push(I[v].id);return T.join("_")}var v,n,t,B,J,Q,G,z,D={};l.geometryGroups={};t=0;for(B=l.faces.length;t<B;t++){J=l.faces[t];Q=J.materials;G=x(Q);D[G]==undefined&&(D[G]={hash:G,counter:0});z=D[G].hash+"_"+D[G].counter;l.geometryGroups[z]==undefined&&(l.geometryGroups[z]={faces:[],materials:Q,vertices:0});J=J instanceof THREE.Face3?3:4;if(l.geometryGroups[z].vertices+J>65535){D[G].counter+=1;z=D[G].hash+
-"_"+D[G].counter;l.geometryGroups[z]==undefined&&(l.geometryGroups[z]={faces:[],materials:Q,vertices:0})}l.geometryGroups[z].faces.push(t);l.geometryGroups[z].vertices+=J}}function E(l,x,v){l.push({buffer:x,object:v,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function w(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);
-e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}ca=l}}function F(l,x){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,
-e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,H(l.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,H(l.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,H(l.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,H(l.minFilter));e.texImage2D(e.TEXTURE_2D,0,H(l.format),l.width,l.height,0,H(l.format),H(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,
-e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var v,n,t;if(l){v=l.__webGLFramebuffer;n=l.width;t=l.height}else{v=null;n=P.width;t=P.height}if(v!=N){e.bindFramebuffer(e.FRAMEBUFFER,v);e.viewport(0,0,n,t);x&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);N=v}}function u(l,x){var v;if(l==
-"fragment")v=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(v=e.createShader(e.VERTEX_SHADER));e.shaderSource(v,x);e.compileShader(v);if(!e.getShaderParameter(v,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(v));return null}return v}function H(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;
+THREE.Projector=function(){function a(L,M){return M.z-L.z}function b(L,M){var V=0,R=1,aa=L.z+L.w,ca=M.z+M.w,J=-L.z+L.w,Y=-M.z+M.w;if(aa>=0&&ca>=0&&J>=0&&Y>=0)return!0;else if(aa<0&&ca<0||J<0&&Y<0)return!1;else{if(aa<0)V=Math.max(V,aa/(aa-ca));else ca<0&&(R=Math.min(R,aa/(aa-ca)));if(J<0)V=Math.max(V,J/(J-Y));else Y<0&&(R=Math.min(R,J/(J-Y)));if(R<V)return!1;else{L.lerpSelf(M,V);M.lerpSelf(L,1-R);return!0}}}var c,d,f=[],g,h,k,j=[],m,o,z=[],q,t,B=[],C=new THREE.Vector4,F=new THREE.Vector4,w=new THREE.Matrix4,
+H=new THREE.Matrix4,u=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,N=new THREE.Vector4,e;this.projectObjects=function(L,M,V){M=[];var R,aa,ca;d=0;aa=L.objects;L=0;for(R=aa.length;L<R;L++){ca=aa[L];var J;if(!(J=!ca.visible))if(J=ca instanceof THREE.Mesh){a:{J=void 0;for(var Y=ca.matrixWorld,oa=-ca.geometry.boundingSphere.radius*Math.max(ca.scale.x,Math.max(ca.scale.y,ca.scale.z)),ba=0;ba<6;ba++){J=u[ba].x*Y.n14+u[ba].y*
+Y.n24+u[ba].z*Y.n34+u[ba].w;if(J<=oa){J=!1;break a}}J=!0}J=!J}if(!J){c=f[d]=f[d]||new THREE.RenderableObject;C.copy(ca.position);w.multiplyVector3(C);c.object=ca;c.z=C.z;M.push(c);d++}}V&&M.sort(a);return M};this.projectScene=function(L,M,V){var R=[],aa=M.near,ca=M.far,J,Y,oa,ba,la,ia,ga,qa,wa,l,x,y,n,p,D,E;k=o=t=0;M.matrixAutoUpdate&&M.update();w.multiply(M.projectionMatrix,M.matrixWorldInverse);u[0].set(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);u[1].set(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,
+w.n44+w.n14);u[2].set(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);u[3].set(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);u[4].set(w.n41-w.n31,w.n42-w.n32,w.n43-w.n33,w.n44-w.n34);u[5].set(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);for(J=0;J<6;J++){ia=u[J];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}L.update(undefined,!1,M);ia=this.projectObjects(L,M,!0);L=0;for(J=ia.length;L<J;L++){ga=ia[L].object;if(ga.visible){qa=ga.matrixWorld;x=ga.matrixRotationWorld;wa=ga.materials;
+l=ga.overdraw;if(ga instanceof THREE.Mesh){y=ga.geometry;n=y.vertices;Y=0;for(oa=n.length;Y<oa;Y++){p=n[Y];p.positionWorld.copy(p.position);qa.multiplyVector3(p.positionWorld);ba=p.positionScreen;ba.copy(p.positionWorld);w.multiplyVector4(ba);ba.x/=ba.w;ba.y/=ba.w;p.__visible=ba.z>aa&&ba.z<ca}y=y.faces;Y=0;for(oa=y.length;Y<oa;Y++){p=y[Y];if(p instanceof THREE.Face3){ba=n[p.a];la=n[p.b];D=n[p.c];if(ba.__visible&&la.__visible&&D.__visible&&(ga.doubleSided||ga.flipSided!=(D.positionScreen.x-ba.positionScreen.x)*
+(la.positionScreen.y-ba.positionScreen.y)-(D.positionScreen.y-ba.positionScreen.y)*(la.positionScreen.x-ba.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ba.positionWorld);g.v2.positionWorld.copy(la.positionWorld);g.v3.positionWorld.copy(D.positionWorld);g.v1.positionScreen.copy(ba.positionScreen);g.v2.positionScreen.copy(la.positionScreen);g.v3.positionScreen.copy(D.positionScreen);g.normalWorld.copy(p.normal);x.multiplyVector3(g.normalWorld);g.centroidWorld.copy(p.centroid);
+qa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);D=p.vertexNormals;e=g.vertexNormalsWorld;ba=0;for(la=D.length;ba<la;ba++){E=e[ba]=e[ba]||new THREE.Vector3;E.copy(D[ba]);x.multiplyVector3(E)}g.z=g.centroidScreen.z;g.meshMaterials=wa;g.faceMaterials=p.materials;g.overdraw=l;if(ga.geometry.uvs[Y]){g.uvs[0]=ga.geometry.uvs[Y][0];g.uvs[1]=ga.geometry.uvs[Y][1];g.uvs[2]=ga.geometry.uvs[Y][2]}R.push(g);k++}}else if(p instanceof THREE.Face4){ba=
+n[p.a];la=n[p.b];D=n[p.c];E=n[p.d];if(ba.__visible&&la.__visible&&D.__visible&&E.__visible&&(ga.doubleSided||ga.flipSided!=((E.positionScreen.x-ba.positionScreen.x)*(la.positionScreen.y-ba.positionScreen.y)-(E.positionScreen.y-ba.positionScreen.y)*(la.positionScreen.x-ba.positionScreen.x)<0||(la.positionScreen.x-D.positionScreen.x)*(E.positionScreen.y-D.positionScreen.y)-(la.positionScreen.y-D.positionScreen.y)*(E.positionScreen.x-D.positionScreen.x)<0))){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(ba.positionWorld);
+g.v2.positionWorld.copy(la.positionWorld);g.v3.positionWorld.copy(E.positionWorld);g.v1.positionScreen.copy(ba.positionScreen);g.v2.positionScreen.copy(la.positionScreen);g.v3.positionScreen.copy(E.positionScreen);g.normalWorld.copy(p.normal);x.multiplyVector3(g.normalWorld);g.centroidWorld.copy(p.centroid);qa.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);w.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=wa;g.faceMaterials=p.materials;g.overdraw=
+l;if(ga.geometry.uvs[Y]){g.uvs[0]=ga.geometry.uvs[Y][0];g.uvs[1]=ga.geometry.uvs[Y][1];g.uvs[2]=ga.geometry.uvs[Y][3]}R.push(g);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(la.positionWorld);h.v2.positionWorld.copy(D.positionWorld);h.v3.positionWorld.copy(E.positionWorld);h.v1.positionScreen.copy(la.positionScreen);h.v2.positionScreen.copy(D.positionScreen);h.v3.positionScreen.copy(E.positionScreen);h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);h.centroidScreen.copy(g.centroidScreen);
+h.z=h.centroidScreen.z;h.meshMaterials=wa;h.faceMaterials=p.materials;h.overdraw=l;if(ga.geometry.uvs[Y]){h.uvs[0]=ga.geometry.uvs[Y][1];h.uvs[1]=ga.geometry.uvs[Y][2];h.uvs[2]=ga.geometry.uvs[Y][3]}R.push(h);k++}}}}else if(ga instanceof THREE.Line){H.multiply(w,qa);n=ga.geometry.vertices;p=n[0];p.positionScreen.copy(p.position);H.multiplyVector4(p.positionScreen);Y=1;for(oa=n.length;Y<oa;Y++){ba=n[Y];ba.positionScreen.copy(ba.position);H.multiplyVector4(ba.positionScreen);la=n[Y-1];I.copy(ba.positionScreen);
+N.copy(la.positionScreen);if(b(I,N)){I.multiplyScalar(1/I.w);N.multiplyScalar(1/N.w);m=z[o]=z[o]||new THREE.RenderableLine;m.v1.positionScreen.copy(I);m.v2.positionScreen.copy(N);m.z=Math.max(I.z,N.z);m.materials=ga.materials;R.push(m);o++}}}else if(ga instanceof THREE.Particle){F.set(ga.position.x,ga.position.y,ga.position.z,1);w.multiplyVector4(F);F.z/=F.w;if(F.z>0&&F.z<1){q=B[t]=B[t]||new THREE.RenderableParticle;q.x=F.x/F.w;q.y=F.y/F.w;q.z=F.z;q.rotation=ga.rotation.z;q.scale.x=ga.scale.x*Math.abs(q.x-
+(F.x+M.projectionMatrix.n11)/(F.w+M.projectionMatrix.n14));q.scale.y=ga.scale.y*Math.abs(q.y-(F.y+M.projectionMatrix.n22)/(F.w+M.projectionMatrix.n24));q.materials=ga.materials;R.push(q);t++}}}}V&&R.sort(a);return R};this.unprojectVector=function(L,M){var V=M.matrixWorld.clone();V.multiplySelf(THREE.Matrix4.makeInvert(M.projectionMatrix));V.multiplyVector3(L);return L}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,o,z,q,t,B,C;a=b.projectScene(h,k);j=0;for(m=a.length;j<m;j++){q=a[j];if(q instanceof THREE.RenderableParticle){B=q.x*f+f;C=q.y*g+g;o=0;for(z=q.material.length;o<z;o++){t=q.material[o];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=B+"px";t.style.top=C+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(ma){if(q!=ma)m.globalAlpha=q=ma}function b(ma){if(t!=ma){switch(ma){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}t=ma}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,j,m=f.getContext("2d"),o=new THREE.Color(0),z=0,q=1,t=0,B=null,C=null,F=1,w,H,u,I,N,e,L,M,V,R=new THREE.Color,
+aa=new THREE.Color,ca=new THREE.Color,J=new THREE.Color,Y=new THREE.Color,oa,ba,la,ia,ga,qa,wa,l,x,y=new THREE.Rectangle,n=new THREE.Rectangle,p=new THREE.Rectangle,D=!1,E=new THREE.Color,O=new THREE.Color,T=new THREE.Color,v=new THREE.Color,A=Math.PI*2,G=new THREE.Vector3,S,W,da,ja,xa,P,Ea=16;S=document.createElement("canvas");S.width=S.height=2;W=S.getContext("2d");W.fillStyle="rgba(0,0,0,1)";W.fillRect(0,0,2,2);da=W.getImageData(0,0,2,2);ja=da.data;xa=document.createElement("canvas");xa.width=
+xa.height=Ea;P=xa.getContext("2d");P.translate(-Ea/2,-Ea/2);P.scale(Ea,Ea);Ea--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ma,Aa){g=ma;h=Aa;k=g/2;j=h/2;f.width=g;f.height=h;y.set(-k,-j,k,j);q=1;t=0;C=B=null;F=1};this.setClearColor=function(ma,Aa){o=ma;z=Aa};this.setClearColorHex=function(ma,Aa){o.setHex(ma);z=Aa};this.clear=function(){m.setTransform(1,0,0,-1,k,j);if(!n.isEmpty()){n.inflate(1);n.minSelf(y);if(o.hex==0&&z==0)m.clearRect(n.getX(),
+n.getY(),n.getWidth(),n.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+z+")";m.fillRect(n.getX(),n.getY(),n.getWidth(),n.getHeight())}n.empty()}};this.render=function(ma,Aa){function Z(Q){var fa,ha,U,ea=Q.lights;O.setRGB(0,0,0);T.setRGB(0,0,0);v.setRGB(0,0,0);Q=0;for(fa=ea.length;Q<fa;Q++){ha=ea[Q];U=ha.color;if(ha instanceof THREE.AmbientLight){O.r+=U.r;O.g+=U.g;O.b+=U.b}else if(ha instanceof THREE.DirectionalLight){T.r+=
+U.r;T.g+=U.g;T.b+=U.b}else if(ha instanceof THREE.PointLight){v.r+=U.r;v.g+=U.g;v.b+=U.b}}}function X(Q,fa,ha,U){var ea,pa,Da,Fa,ya=Q.lights;Q=0;for(ea=ya.length;Q<ea;Q++){pa=ya[Q];Da=pa.color;Fa=pa.intensity;if(pa instanceof THREE.DirectionalLight){pa=ha.dot(pa.position)*Fa;if(pa>0){U.r+=Da.r*pa;U.g+=Da.g*pa;U.b+=Da.b*pa}}else if(pa instanceof THREE.PointLight){G.sub(pa.position,fa);G.normalize();pa=ha.dot(G)*Fa;if(pa>0){U.r+=Da.r*pa;U.g+=Da.g*pa;U.b+=Da.b*pa}}}}function $(Q,fa,ha){if(ha.opacity!=
+0){a(ha.opacity);b(ha.blending);var U,ea,pa,Da,Fa,ya;if(ha instanceof THREE.ParticleBasicMaterial){if(ha.map){Da=ha.map.image;Fa=Da.width>>1;ya=Da.height>>1;ea=fa.scale.x*k;pa=fa.scale.y*j;ha=ea*Fa;U=pa*ya;p.set(Q.x-ha,Q.y-U,Q.x+ha,Q.y+U);if(y.instersects(p)){m.save();m.translate(Q.x,Q.y);m.rotate(-fa.rotation);m.scale(ea,-pa);m.translate(-Fa,-ya);m.drawImage(Da,0,0);m.restore()}}}else if(ha instanceof THREE.ParticleCircleMaterial){if(D){E.r=O.r+T.r+v.r;E.g=O.g+T.g+v.g;E.b=O.b+T.b+v.b;R.r=ha.color.r*
+E.r;R.g=ha.color.g*E.g;R.b=ha.color.b*E.b;R.updateStyleString()}else R.__styleString=ha.color.__styleString;ha=fa.scale.x*k;U=fa.scale.y*j;p.set(Q.x-ha,Q.y-U,Q.x+ha,Q.y+U);if(y.instersects(p)){ea=R.__styleString;if(C!=ea)m.fillStyle=C=ea;m.save();m.translate(Q.x,Q.y);m.rotate(-fa.rotation);m.scale(ha,U);m.beginPath();m.arc(0,0,1,0,A,!0);m.closePath();m.fill();m.restore()}}}}function ta(Q,fa,ha,U){if(U.opacity!=0){a(U.opacity);b(U.blending);m.beginPath();m.moveTo(Q.positionScreen.x,Q.positionScreen.y);
+m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(U instanceof THREE.LineBasicMaterial){R.__styleString=U.color.__styleString;Q=U.linewidth;if(F!=Q)m.lineWidth=F=Q;Q=R.__styleString;if(B!=Q)m.strokeStyle=B=Q;m.stroke();p.inflate(U.linewidth*2)}}}function ua(Q,fa,ha,U,ea,pa){if(ea.opacity!=0){a(ea.opacity);b(ea.blending);I=Q.positionScreen.x;N=Q.positionScreen.y;e=fa.positionScreen.x;L=fa.positionScreen.y;M=ha.positionScreen.x;V=ha.positionScreen.y;m.beginPath();m.moveTo(I,N);m.lineTo(e,
+L);m.lineTo(M,V);m.lineTo(I,N);m.closePath();if(ea instanceof THREE.MeshBasicMaterial)if(ea.map)ea.map.mapping instanceof THREE.UVMapping&&K(I,N,e,L,M,V,ea.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);else if(ea.envMap){if(ea.envMap.mapping instanceof THREE.SphericalReflectionMapping){Q=Aa.matrixWorldInverse;G.copy(U.vertexNormalsWorld[0]);ia=(G.x*Q.n11+G.y*Q.n12+G.z*Q.n13)*0.5+0.5;ga=-(G.x*Q.n21+G.y*Q.n22+G.z*Q.n23)*0.5+0.5;G.copy(U.vertexNormalsWorld[1]);qa=(G.x*
+Q.n11+G.y*Q.n12+G.z*Q.n13)*0.5+0.5;wa=-(G.x*Q.n21+G.y*Q.n22+G.z*Q.n23)*0.5+0.5;G.copy(U.vertexNormalsWorld[2]);l=(G.x*Q.n11+G.y*Q.n12+G.z*Q.n13)*0.5+0.5;x=-(G.x*Q.n21+G.y*Q.n22+G.z*Q.n23)*0.5+0.5;K(I,N,e,L,M,V,ea.envMap.image,ia,ga,qa,wa,l,x)}}else ea.wireframe?Ga(ea.color.__styleString,ea.wireframeLinewidth):za(ea.color.__styleString);else if(ea instanceof THREE.MeshLambertMaterial){if(ea.map&&!ea.wireframe){ea.map.mapping instanceof THREE.UVMapping&&K(I,N,e,L,M,V,ea.map.image,U.uvs[0].u,U.uvs[0].v,
+U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);b(THREE.SubtractiveBlending)}if(D)if(!ea.wireframe&&ea.shading==THREE.SmoothShading&&U.vertexNormalsWorld.length==3){aa.r=ca.r=J.r=O.r;aa.g=ca.g=J.g=O.g;aa.b=ca.b=J.b=O.b;X(pa,U.v1.positionWorld,U.vertexNormalsWorld[0],aa);X(pa,U.v2.positionWorld,U.vertexNormalsWorld[1],ca);X(pa,U.v3.positionWorld,U.vertexNormalsWorld[2],J);Y.r=(ca.r+J.r)*0.5;Y.g=(ca.g+J.g)*0.5;Y.b=(ca.b+J.b)*0.5;la=Ba(aa,ca,J,Y);K(I,N,e,L,M,V,la,0,0,1,0,0,1)}else{E.r=O.r;E.g=O.g;E.b=O.b;
+X(pa,U.centroidWorld,U.normalWorld,E);R.r=ea.color.r*E.r;R.g=ea.color.g*E.g;R.b=ea.color.b*E.b;R.updateStyleString();ea.wireframe?Ga(R.__styleString,ea.wireframeLinewidth):za(R.__styleString)}else ea.wireframe?Ga(ea.color.__styleString,ea.wireframeLinewidth):za(ea.color.__styleString)}else if(ea instanceof THREE.MeshDepthMaterial){oa=Aa.near;ba=Aa.far;aa.r=aa.g=aa.b=1-Pa(Q.positionScreen.z,oa,ba);ca.r=ca.g=ca.b=1-Pa(fa.positionScreen.z,oa,ba);J.r=J.g=J.b=1-Pa(ha.positionScreen.z,oa,ba);Y.r=(ca.r+
+J.r)*0.5;Y.g=(ca.g+J.g)*0.5;Y.b=(ca.b+J.b)*0.5;la=Ba(aa,ca,J,Y);K(I,N,e,L,M,V,la,0,0,1,0,0,1)}else if(ea instanceof THREE.MeshNormalMaterial){R.r=Qa(U.normalWorld.x);R.g=Qa(U.normalWorld.y);R.b=Qa(U.normalWorld.z);R.updateStyleString();ea.wireframe?Ga(R.__styleString,ea.wireframeLinewidth):za(R.__styleString)}}}function Ga(Q,fa){if(B!=Q)m.strokeStyle=B=Q;if(F!=fa)m.lineWidth=F=fa;m.stroke();p.inflate(fa*2)}function za(Q){if(C!=Q)m.fillStyle=C=Q;m.fill()}function K(Q,fa,ha,U,ea,pa,Da,Fa,ya,Na,La,Oa,
+Sa){var Ha,Ja;Ha=Da.width-1;Ja=Da.height-1;Fa*=Ha;ya*=Ja;Na*=Ha;La*=Ja;Oa*=Ha;Sa*=Ja;ha-=Q;U-=fa;ea-=Q;pa-=fa;Na-=Fa;La-=ya;Oa-=Fa;Sa-=ya;Ha=Na*Sa-Oa*La;if(Ha!=0){Ja=1/Ha;Ha=(Sa*ha-La*ea)*Ja;La=(Sa*U-La*pa)*Ja;ha=(Na*ea-Oa*ha)*Ja;U=(Na*pa-Oa*U)*Ja;Q=Q-Ha*Fa-ha*ya;fa=fa-La*Fa-U*ya;m.save();m.transform(Ha,La,ha,U,Q,fa);m.clip();m.drawImage(Da,0,0);m.restore()}}function Ba(Q,fa,ha,U){var ea=~~(Q.r*255),pa=~~(Q.g*255);Q=~~(Q.b*255);var Da=~~(fa.r*255),Fa=~~(fa.g*255);fa=~~(fa.b*255);var ya=~~(ha.r*255),
+Na=~~(ha.g*255);ha=~~(ha.b*255);var La=~~(U.r*255),Oa=~~(U.g*255);U=~~(U.b*255);ja[0]=ea<0?0:ea>255?255:ea;ja[1]=pa<0?0:pa>255?255:pa;ja[2]=Q<0?0:Q>255?255:Q;ja[4]=Da<0?0:Da>255?255:Da;ja[5]=Fa<0?0:Fa>255?255:Fa;ja[6]=fa<0?0:fa>255?255:fa;ja[8]=ya<0?0:ya>255?255:ya;ja[9]=Na<0?0:Na>255?255:Na;ja[10]=ha<0?0:ha>255?255:ha;ja[12]=La<0?0:La>255?255:La;ja[13]=Oa<0?0:Oa>255?255:Oa;ja[14]=U<0?0:U>255?255:U;W.putImageData(da,0,0);P.drawImage(S,0,0);return xa}function Pa(Q,fa,ha){Q=(Q-fa)/(ha-fa);return Q*
+Q*(3-2*Q)}function Qa(Q){Q=(Q+1)*0.5;return Q<0?0:Q>1?1:Q}function Ka(Q,fa){var ha=fa.x-Q.x,U=fa.y-Q.y,ea=1/Math.sqrt(ha*ha+U*U);ha*=ea;U*=ea;fa.x+=ha;fa.y+=U;Q.x-=ha;Q.y-=U}var sa,Ca,ka,na,ra,va,Ma,Ia;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(ma,Aa,this.sortElements);(D=ma.lights.length>0)&&Z(ma);sa=0;for(Ca=c.length;sa<Ca;sa++){ka=c[sa];p.empty();if(ka instanceof THREE.RenderableParticle){w=ka;w.x*=k;w.y*=j;na=0;for(ra=ka.materials.length;na<ra;na++)$(w,ka,ka.materials[na],
+ma)}else if(ka instanceof THREE.RenderableLine){w=ka.v1;H=ka.v2;w.positionScreen.x*=k;w.positionScreen.y*=j;H.positionScreen.x*=k;H.positionScreen.y*=j;p.addPoint(w.positionScreen.x,w.positionScreen.y);p.addPoint(H.positionScreen.x,H.positionScreen.y);if(y.instersects(p)){na=0;for(ra=ka.materials.length;na<ra;)ta(w,H,ka,ka.materials[na++],ma)}}else if(ka instanceof THREE.RenderableFace3){w=ka.v1;H=ka.v2;u=ka.v3;w.positionScreen.x*=k;w.positionScreen.y*=j;H.positionScreen.x*=k;H.positionScreen.y*=
+j;u.positionScreen.x*=k;u.positionScreen.y*=j;if(ka.overdraw){Ka(w.positionScreen,H.positionScreen);Ka(H.positionScreen,u.positionScreen);Ka(u.positionScreen,w.positionScreen)}p.add3Points(w.positionScreen.x,w.positionScreen.y,H.positionScreen.x,H.positionScreen.y,u.positionScreen.x,u.positionScreen.y);if(y.instersects(p)){na=0;for(ra=ka.meshMaterials.length;na<ra;){Ia=ka.meshMaterials[na++];if(Ia instanceof THREE.MeshFaceMaterial){va=0;for(Ma=ka.faceMaterials.length;va<Ma;)(Ia=ka.faceMaterials[va++])&&
+ua(w,H,u,ka,Ia,ma)}else ua(w,H,u,ka,Ia,ma)}}}n.addRectangle(p)}m.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(ia,ga,qa){var wa,l,x,y;wa=0;for(l=ia.lights.length;wa<l;wa++){x=ia.lights[wa];if(x instanceof THREE.DirectionalLight){y=ga.normalWorld.dot(x.position)*x.intensity;if(y>0){qa.r+=x.color.r*y;qa.g+=x.color.g*y;qa.b+=x.color.b*y}}else if(x instanceof THREE.PointLight){V.sub(x.position,ga.centroidWorld);V.normalize();y=ga.normalWorld.dot(V)*x.intensity;if(y>0){qa.r+=x.color.r*y;qa.g+=x.color.g*y;qa.b+=x.color.b*y}}}}function b(ia,ga,qa,wa,l,x){J=d(Y++);J.setAttribute("d",
+"M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)u.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(H){I.r=N.r;I.g=N.g;I.b=N.b;a(x,wa,I);u.r=l.color.r*I.r;u.g=l.color.g*I.g;u.b=l.color.b*I.b;u.updateStyleString()}else u.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){M=1-l.__2near/(l.__farPlusNear-
+wa.z*l.__farMinusNear);u.setRGB(M,M,M)}else l instanceof THREE.MeshNormalMaterial&&u.setRGB(f(wa.normalWorld.x),f(wa.normalWorld.y),f(wa.normalWorld.z));l.wireframe?J.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+l.wireframeLinewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframeLinecap+"; stroke-linejoin: "+l.wireframeLinejoin):J.setAttribute("style","fill: "+u.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(J)}function c(ia,ga,qa,wa,l,
+x,y){J=d(Y++);J.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+ga.positionScreen.x+" "+ga.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+" L "+wa.positionScreen.x+","+wa.positionScreen.y+"z");if(x instanceof THREE.MeshBasicMaterial)u.__styleString=x.color.__styleString;else if(x instanceof THREE.MeshLambertMaterial)if(H){I.r=N.r;I.g=N.g;I.b=N.b;a(y,l,I);u.r=x.color.r*I.r;u.g=x.color.g*I.g;u.b=x.color.b*I.b;u.updateStyleString()}else u.__styleString=x.color.__styleString;
+else if(x instanceof THREE.MeshDepthMaterial){M=1-x.__2near/(x.__farPlusNear-l.z*x.__farMinusNear);u.setRGB(M,M,M)}else x instanceof THREE.MeshNormalMaterial&&u.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));x.wireframe?J.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+x.wireframeLinewidth+"; stroke-opacity: "+x.opacity+"; stroke-linecap: "+x.wireframeLinecap+"; stroke-linejoin: "+x.wireframeLinejoin):J.setAttribute("style","fill: "+u.__styleString+
+"; fill-opacity: "+x.opacity);k.appendChild(J)}function d(ia){if(R[ia]==null){R[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");la==0&&R[ia].setAttribute("shape-rendering","crispEdges")}return R[ia]}function f(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,o,z,q,t,B,C,F=new THREE.Rectangle,w=new THREE.Rectangle,H=!1,u=new THREE.Color(16777215),I=new THREE.Color(16777215),
+N=new THREE.Color(0),e=new THREE.Color(0),L=new THREE.Color(0),M,V=new THREE.Vector3,R=[],aa=[],ca=[],J,Y,oa,ba,la=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":la=1;break;case "low":la=0}};this.setSize=function(ia,ga){j=ia;m=ga;o=j/2;z=m/2;k.setAttribute("viewBox",-o+" "+-z+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);F.set(-o,-z,o,z)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
+this.render=function(ia,ga){var qa,wa,l,x,y,n,p,D;this.autoClear&&this.clear();g=h.projectScene(ia,ga,this.sortElements);ba=oa=Y=0;if(H=ia.lights.length>0){p=ia.lights;N.setRGB(0,0,0);e.setRGB(0,0,0);L.setRGB(0,0,0);qa=0;for(wa=p.length;qa<wa;qa++){l=p[qa];x=l.color;if(l instanceof THREE.AmbientLight){N.r+=x.r;N.g+=x.g;N.b+=x.b}else if(l instanceof THREE.DirectionalLight){e.r+=x.r;e.g+=x.g;e.b+=x.b}else if(l instanceof THREE.PointLight){L.r+=x.r;L.g+=x.g;L.b+=x.b}}}qa=0;for(wa=g.length;qa<wa;qa++){p=
+g[qa];w.empty();if(p instanceof THREE.RenderableParticle){q=p;q.x*=o;q.y*=-z;l=0;for(x=p.materials.length;l<x;l++)if(D=p.materials[l]){y=q;n=p;var E=oa++;if(aa[E]==null){aa[E]=document.createElementNS("http://www.w3.org/2000/svg","circle");la==0&&aa[E].setAttribute("shape-rendering","crispEdges")}J=aa[E];J.setAttribute("cx",y.x);J.setAttribute("cy",y.y);J.setAttribute("r",n.scale.x*o);if(D instanceof THREE.ParticleCircleMaterial){if(H){I.r=N.r+e.r+L.r;I.g=N.g+e.g+L.g;I.b=N.b+e.b+L.b;u.r=D.color.r*
+I.r;u.g=D.color.g*I.g;u.b=D.color.b*I.b;u.updateStyleString()}else u=D.color;J.setAttribute("style","fill: "+u.__styleString)}k.appendChild(J)}}else if(p instanceof THREE.RenderableLine){q=p.v1;t=p.v2;q.positionScreen.x*=o;q.positionScreen.y*=-z;t.positionScreen.x*=o;t.positionScreen.y*=-z;w.addPoint(q.positionScreen.x,q.positionScreen.y);w.addPoint(t.positionScreen.x,t.positionScreen.y);if(F.instersects(w)){l=0;for(x=p.materials.length;l<x;)if(D=p.materials[l++]){y=q;n=t;E=ba++;if(ca[E]==null){ca[E]=
+document.createElementNS("http://www.w3.org/2000/svg","line");la==0&&ca[E].setAttribute("shape-rendering","crispEdges")}J=ca[E];J.setAttribute("x1",y.positionScreen.x);J.setAttribute("y1",y.positionScreen.y);J.setAttribute("x2",n.positionScreen.x);J.setAttribute("y2",n.positionScreen.y);if(D instanceof THREE.LineBasicMaterial){u.__styleString=D.color.__styleString;J.setAttribute("style","fill: none; stroke: "+u.__styleString+"; stroke-width: "+D.linewidth+"; stroke-opacity: "+D.opacity+"; stroke-linecap: "+
+D.linecap+"; stroke-linejoin: "+D.linejoin);k.appendChild(J)}}}}else if(p instanceof THREE.RenderableFace3){q=p.v1;t=p.v2;B=p.v3;q.positionScreen.x*=o;q.positionScreen.y*=-z;t.positionScreen.x*=o;t.positionScreen.y*=-z;B.positionScreen.x*=o;B.positionScreen.y*=-z;w.addPoint(q.positionScreen.x,q.positionScreen.y);w.addPoint(t.positionScreen.x,t.positionScreen.y);w.addPoint(B.positionScreen.x,B.positionScreen.y);if(F.instersects(w)){l=0;for(x=p.meshMaterials.length;l<x;){D=p.meshMaterials[l++];if(D instanceof
+THREE.MeshFaceMaterial){y=0;for(n=p.faceMaterials.length;y<n;)(D=p.faceMaterials[y++])&&b(q,t,B,p,D,ia)}else D&&b(q,t,B,p,D,ia)}}}else if(p instanceof THREE.RenderableFace4){q=p.v1;t=p.v2;B=p.v3;C=p.v4;q.positionScreen.x*=o;q.positionScreen.y*=-z;t.positionScreen.x*=o;t.positionScreen.y*=-z;B.positionScreen.x*=o;B.positionScreen.y*=-z;C.positionScreen.x*=o;C.positionScreen.y*=-z;w.addPoint(q.positionScreen.x,q.positionScreen.y);w.addPoint(t.positionScreen.x,t.positionScreen.y);w.addPoint(B.positionScreen.x,
+B.positionScreen.y);w.addPoint(C.positionScreen.x,C.positionScreen.y);if(F.instersects(w)){l=0;for(x=p.meshMaterials.length;l<x;){D=p.meshMaterials[l++];if(D instanceof THREE.MeshFaceMaterial){y=0;for(n=p.faceMaterials.length;y<n;)(D=p.faceMaterials[y++])&&c(q,t,B,C,p,D,ia)}else D&&c(q,t,B,C,p,D,ia)}}}}}};
+THREE.WebGLRenderer=function(a){function b(l,x,y){var n,p,D,E=l.vertices,O=E.length,T=l.colors,v=T.length,A=l.__vertexArray,G=l.__colorArray,S=l.__sortArray,W=l.__dirtyVertices,da=l.__dirtyColors;if(y.sortParticles){oa.multiplySelf(y.matrixWorld);for(n=0;n<O;n++){p=E[n].position;ia.copy(p);oa.multiplyVector3(ia);S[n]=[ia.z,n]}S.sort(function(ja,xa){return xa[0]-ja[0]});for(n=0;n<O;n++){p=E[S[n][1]].position;D=n*3;A[D]=p.x;A[D+1]=p.y;A[D+2]=p.z}for(n=0;n<v;n++){D=n*3;color=T[S[n][1]];G[D]=color.r;
+G[D+1]=color.g;G[D+2]=color.b}}else{if(W)for(n=0;n<O;n++){p=E[n].position;D=n*3;A[D]=p.x;A[D+1]=p.y;A[D+2]=p.z}if(da)for(n=0;n<v;n++){color=T[n];D=n*3;G[D]=color.r;G[D+1]=color.g;G[D+2]=color.b}}if(W||y.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,A,x)}if(da||y.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,G,x)}}function c(l,x){l.fragmentShader=x.fragmentShader;l.vertexShader=x.vertexShader;l.uniforms=
+Uniforms.clone(x.uniforms)}function d(l,x,y,n,p){n.program||V.initMaterial(n,x,y);var D=n.program,E=D.uniforms,O=n.uniforms;if(D!=L){e.useProgram(D);L=D;e.uniformMatrix4fv(E.projectionMatrix,!1,ba)}if(y&&(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial||n instanceof THREE.LineBasicMaterial||n instanceof THREE.ParticleBasicMaterial)){O.fogColor.value.setHex(y.color.hex);if(y instanceof THREE.Fog){O.fogNear.value=y.near;O.fogFar.value=
+y.far}else if(y instanceof THREE.FogExp2)O.fogDensity.value=y.density}if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial){var T,v,A=0,G=0,S=0,W,da,ja,xa=V.lights,P=xa.directional.colors,Ea=xa.directional.positions,ma=xa.point.colors,Aa=xa.point.positions,Z=0,X=0;y=v=v=0;for(T=x.length;y<T;y++){v=x[y];W=v.color;da=v.position;ja=v.intensity;if(v instanceof THREE.AmbientLight){A+=W.r;G+=W.g;S+=W.b}else if(v instanceof THREE.DirectionalLight){v=Z*3;P[v]=W.r*ja;P[v+1]=W.g*
+ja;P[v+2]=W.b*ja;Ea[v]=da.x;Ea[v+1]=da.y;Ea[v+2]=da.z;Z+=1}else if(v instanceof THREE.PointLight){v=X*3;ma[v]=W.r*ja;ma[v+1]=W.g*ja;ma[v+2]=W.b*ja;Aa[v]=da.x;Aa[v+1]=da.y;Aa[v+2]=da.z;X+=1}}for(y=Z*3;y<P.length;y++)P[y]=0;for(y=X*3;y<ma.length;y++)ma[y]=0;xa.point.length=X;xa.directional.length=Z;xa.ambient[0]=A;xa.ambient[1]=G;xa.ambient[2]=S;x=V.lights;O.enableLighting.value=x.directional.length+x.point.length;O.ambientLightColor.value=x.ambient;O.directionalLightColor.value=x.directional.colors;
+O.directionalLightDirection.value=x.directional.positions;O.pointLightColor.value=x.point.colors;O.pointLightPosition.value=x.point.positions}if(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial){O.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);O.opacity.value=n.opacity;O.map.texture=n.map;O.lightMap.texture=n.lightMap;O.envMap.texture=n.envMap;O.reflectivity.value=n.reflectivity;O.refractionRatio.value=
+n.refractionRatio;O.combine.value=n.combine;O.useRefract.value=n.envMap&&n.envMap.mapping instanceof THREE.CubeRefractionMapping}if(n instanceof THREE.LineBasicMaterial){O.diffuse.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);O.opacity.value=n.opacity}else if(n instanceof THREE.ParticleBasicMaterial){O.psColor.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);O.opacity.value=n.opacity;O.size.value=n.size;O.map.texture=n.map}else if(n instanceof THREE.MeshPhongMaterial){O.ambient.value.setRGB(n.ambient.r,
+n.ambient.g,n.ambient.b);O.specular.value.setRGB(n.specular.r,n.specular.g,n.specular.b);O.shininess.value=n.shininess}else if(n instanceof THREE.MeshDepthMaterial){O.mNear.value=l.near;O.mFar.value=l.far;O.opacity.value=n.opacity}else if(n instanceof THREE.MeshNormalMaterial)O.opacity.value=n.opacity;for(var $ in O)if(A=D.uniforms[$]){y=O[$];T=y.type;x=y.value;if(T=="i")e.uniform1i(A,x);else if(T=="f")e.uniform1f(A,x);else if(T=="fv1")e.uniform1fv(A,x);else if(T=="fv")e.uniform3fv(A,x);else if(T==
+"v2")e.uniform2f(A,x.x,x.y);else if(T=="v3")e.uniform3f(A,x.x,x.y,x.z);else if(T=="c")e.uniform3f(A,x.r,x.g,x.b);else if(T=="t"){e.uniform1i(A,x);if(y=y.texture)if(y.image instanceof Array&&y.image.length==6){if(y.image.length==6){if(y.needsUpdate){if(!y.image.__webGLTextureCube)y.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,y.image.__webGLTextureCube);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,
+e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR);for(T=0;T<6;++T)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+T,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,y.image[T]);e.generateMipmap(e.TEXTURE_CUBE_MAP);e.bindTexture(e.TEXTURE_CUBE_MAP,null);y.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_CUBE_MAP,y.image.__webGLTextureCube)}}else{if(y.needsUpdate){if(y.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,
+y.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,y.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,I(y.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,I(y.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,I(y.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,I(y.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}else{y.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,y.__webGLTexture);e.texImage2D(e.TEXTURE_2D,
+0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,y.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,I(y.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,I(y.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,I(y.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,I(y.minFilter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null);y.__wasSetOnce=!0}y.needsUpdate=!1}e.activeTexture(e.TEXTURE0+x);e.bindTexture(e.TEXTURE_2D,y.__webGLTexture)}}}e.uniformMatrix4fv(E.modelViewMatrix,
+!1,p._modelViewMatrixArray);e.uniformMatrix3fv(E.normalMatrix,!1,p._normalMatrixArray);(n instanceof THREE.MeshShaderMaterial||n instanceof THREE.MeshPhongMaterial||n.envMap)&&e.uniform3f(E.cameraPosition,l.position.x,l.position.y,l.position.z);(n instanceof THREE.MeshShaderMaterial||n.envMap||n.skinning)&&e.uniformMatrix4fv(E.objectMatrix,!1,p._objectMatrixArray);(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshShaderMaterial||n.skinning)&&e.uniformMatrix4fv(E.viewMatrix,
+!1,la);if(n.skinning){e.uniformMatrix4fv(E.cameraInverseMatrix,!1,la);e.uniformMatrix4fv(E.boneGlobalMatrices,!1,p.boneMatrices)}return D}function f(l,x,y,n,p,D){l=d(l,x,y,n,D).attributes;e.bindBuffer(e.ARRAY_BUFFER,p.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0);if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,
+3,e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(p.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(p.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);
+if(n.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,p.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,
+4,e.FLOAT,!1,0,0)}if(D instanceof THREE.Mesh)if(n.wireframe){e.lineWidth(n.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);e.drawElements(e.LINES,p.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,p.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(D instanceof THREE.Line){D=D.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(n.linewidth);e.drawArrays(D,0,p.__webGLLineCount)}else if(D instanceof
+THREE.ParticleSystem)e.drawArrays(e.POINTS,0,p.__webGLParticleCount);else D instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,p.__webGLVertexCount)}function g(l,x){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(x.attributes.position);e.vertexAttribPointer(x.attributes.position,
+3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(x.attributes.normal);e.vertexAttribPointer(x.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(R!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);R=l.doubleSided}if(aa!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);aa=l.flipSided}}function k(l){if(J!=
+l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);J=l}}function j(l){Y[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);Y[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);Y[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);Y[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);Y[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);Y[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var x;for(l=0;l<6;l++){x=Y[l];x.divideScalar(Math.sqrt(x.x*x.x+x.y*x.y+x.z*x.z))}}
+function m(l){for(var x=l.matrixWorld,y=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),n=0;n<6;n++){l=Y[n].x*x.n14+Y[n].y*x.n24+Y[n].z*x.n34+Y[n].w;if(l<=y)return!1}return!0}function o(l,x){l.list[l.count]=x;l.count+=1}function z(l){var x,y,n=l.object,p=l.opaque,D=l.transparent;D.count=0;l=p.count=0;for(x=n.materials.length;l<x;l++){y=n.materials[l];y.opacity&&y.opacity<1||y.blending!=THREE.NormalBlending?o(D,y):o(p,y)}}function q(l){var x,y,n,p,D=l.object,E=l.buffer,
+O=l.opaque,T=l.transparent;T.count=0;l=O.count=0;for(n=D.materials.length;l<n;l++){x=D.materials[l];if(x instanceof THREE.MeshFaceMaterial){x=0;for(y=E.materials.length;x<y;x++)(p=E.materials[x])&&(p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?o(T,p):o(O,p))}else{p=x;p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?o(T,p):o(O,p)}}}function t(l,x){return x.z-l.z}function B(l,x){l._modelViewMatrix.multiplyToArray(x.matrixWorldInverse,l.matrixWorld,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}
+function C(l){function x(G){var S=[];y=0;for(n=G.length;y<n;y++)G[y]==undefined?S.push("undefined"):S.push(G[y].id);return S.join("_")}var y,n,p,D,E,O,T,v,A={};l.geometryGroups={};p=0;for(D=l.faces.length;p<D;p++){E=l.faces[p];O=E.materials;T=x(O);A[T]==undefined&&(A[T]={hash:T,counter:0});v=A[T].hash+"_"+A[T].counter;l.geometryGroups[v]==undefined&&(l.geometryGroups[v]={faces:[],materials:O,vertices:0});E=E instanceof THREE.Face3?3:4;if(l.geometryGroups[v].vertices+E>65535){A[T].counter+=1;v=A[T].hash+
+"_"+A[T].counter;l.geometryGroups[v]==undefined&&(l.geometryGroups[v]={faces:[],materials:O,vertices:0})}l.geometryGroups[v].faces.push(p);l.geometryGroups[v].vertices+=E}}function F(l,x,y){l.push({buffer:x,object:y,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function w(l){if(l!=ca){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);
+e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}ca=l}}function H(l,x){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,
+e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,I(l.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,I(l.wrapT));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,I(l.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,I(l.minFilter));e.texImage2D(e.TEXTURE_2D,0,I(l.format),l.width,l.height,0,I(l.format),I(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,
+e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var y,n,p;if(l){y=l.__webGLFramebuffer;n=l.width;p=l.height}else{y=null;n=N.width;p=N.height}if(y!=M){e.bindFramebuffer(e.FRAMEBUFFER,y);e.viewport(0,0,n,p);x&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);M=y}}function u(l,x){var y;if(l==
+"fragment")y=e.createShader(e.FRAGMENT_SHADER);else l=="vertex"&&(y=e.createShader(e.VERTEX_SHADER));e.shaderSource(y,x);e.compileShader(y);if(!e.getShaderParameter(y,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(y));return null}return y}function I(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;
 case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;
 case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;
-case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var P=document.createElement("canvas"),e,M=null,N=null,W=this,S=null,aa=null,ca=null,K=null,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],oa=new THREE.Matrix4,ba=new Float32Array(16),la=new Float32Array(16),ia=new THREE.Vector4,
-ga=!0,qa=new THREE.Color(0),ua=0;if(a){if(a.antialias!==undefined)ga=a.antialias;a.clearColor!==undefined&&qa.setHex(a.clearColor);if(a.clearAlpha!==undefined)ua=a.clearAlpha}this.domElement=P;this.autoClear=!0;this.sortObjects=!1;(function(l,x,v){try{e=P.getContext("experimental-webgl",{antialias:l})}catch(n){console.log(n)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);
-e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(x.r,x.g,x.b,v);_cullEnabled=!0})(ga,qa,ua);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,x){P.width=l;P.height=x;e.viewport(0,0,P.width,P.height)};this.setClearColorHex=function(l,x){var v=new THREE.Color(l);e.clearColor(v.r,v.g,v.b,x)};this.setClearColor=function(l,x){e.clearColor(l.r,l.g,l.b,x)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|
-e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,x,v){var n,t;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof
-THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var B,J,Q,G;t=Q=G=0;for(B=x.length;t<B;t++){J=x[t];J instanceof THREE.DirectionalLight&&Q++;J instanceof THREE.PointLight&&G++}if(G+Q<=4)x=Q;else{x=Math.ceil(4*Q/(G+Q));G=4-x}t={directional:x,point:G};G=l.fragmentShader;x=l.vertexShader;B={fog:v,map:l.map,envMap:l.envMap,lightMap:l.lightMap,vertexColors:l.vertexColors,skinning:l.skinning,maxDirLights:t.directional,maxPointLights:t.point};v=e.createProgram();t=["#ifdef GL_ES\nprecision highp float;\n#endif",
-"#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+B.maxPointLights,B.fog?"#define USE_FOG":"",B.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",B.map?"#define USE_MAP":"",B.envMap?"#define USE_ENVMAP":"",B.lightMap?"#define USE_LIGHTMAP":"",B.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");B=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+B.maxDirLights,"#define MAX_POINT_LIGHTS "+
-B.maxPointLights,B.map?"#define USE_MAP":"",B.envMap?"#define USE_ENVMAP":"",B.lightMap?"#define USE_LIGHTMAP":"",B.vertexColors?"#define USE_COLOR":"",B.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-e.attachShader(v,u("fragment",t+G));e.attachShader(v,u("vertex",B+x));e.linkProgram(v);e.getProgramParameter(v,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(v,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");v.uniforms={};v.attributes={};l.program=v;v=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(n in l.uniforms)v.push(n);n=l.program;G=0;for(x=v.length;G<
-x;G++){t=v[G];n.uniforms[t]=e.getUniformLocation(n,t)}n=l.program;v=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];G=0;for(x=v.length;G<x;G++){t=v[G];n.attributes[t]=e.getAttribLocation(n,t)}n=l.program.attributes;e.enableVertexAttribArray(n.position);n.color>=0&&e.enableVertexAttribArray(n.color);n.normal>=0&&e.enableVertexAttribArray(n.normal);n.tangent>=0&&e.enableVertexAttribArray(n.tangent);if(l.skinning&&n.skinVertexA>=0&&n.skinVertexB>=
-0&&n.skinIndex>=0&&n.skinWeight>=0){e.enableVertexAttribArray(n.skinVertexA);e.enableVertexAttribArray(n.skinVertexB);e.enableVertexAttribArray(n.skinIndex);e.enableVertexAttribArray(n.skinWeight)}};this.render=function(l,x,v,n){var t,B,J,Q,G,z,D,I,T=l.lights,U=l.fog;x.matrixAutoUpdate&&x.update();x.matrixWorldInverse.flattenToArray(la);x.projectionMatrix.flattenToArray(ba);oa.multiply(x.projectionMatrix,x.matrixWorldInverse);j(oa);THREE.AnimationHandler&&THREE.AnimationHandler.update();l.update(undefined,
-!1,x);this.initWebGLObjects(l,x);F(v,n!==undefined?n:!0);this.autoClear&&this.clear();G=l.__webglObjects.length;for(n=0;n<G;n++){t=l.__webglObjects[n];D=t.object;if(D.visible)if(!(D instanceof THREE.Mesh)||m(D)){D.matrixWorld.flattenToArray(D._objectMatrixArray);A(D,x);p(t);t.render=!0;if(this.sortObjects){ia.copy(D.position);oa.multiplyVector3(ia);t.z=ia.z}}else t.render=!1;else t.render=!1}this.sortObjects&&l.__webglObjects.sort(q);z=l.__webglObjectsImmediate.length;for(n=0;n<z;n++){t=l.__webglObjectsImmediate[n];
-D=t.object;if(D.visible){D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray);A(D,x);y(t)}}w(THREE.NormalBlending);for(n=0;n<G;n++){t=l.__webglObjects[n];if(t.render){D=t.object;I=t.buffer;J=t.opaque;h(D);for(t=0;t<J.count;t++){Q=J.list[t];k(Q.depthTest);f(x,T,U,Q,I,D)}}}for(n=0;n<z;n++){t=l.__webglObjectsImmediate[n];D=t.object;if(D.visible){J=t.opaque;h(D);for(t=0;t<J.count;t++){Q=J.list[t];k(Q.depthTest);B=d(x,T,U,Q,D);D.render(function(ea){g(ea,B)})}}}for(n=0;n<G;n++){t=l.__webglObjects[n];
-if(t.render){D=t.object;I=t.buffer;J=t.transparent;h(D);for(t=0;t<J.count;t++){Q=J.list[t];w(Q.blending);k(Q.depthTest);f(x,T,U,Q,I,D)}}}for(n=0;n<z;n++){t=l.__webglObjectsImmediate[n];D=t.object;if(D.visible){J=t.transparent;h(D);for(t=0;t<J.count;t++){Q=J.list[t];w(Q.blending);k(Q.depthTest);B=d(x,T,U,Q,D);D.render(function(ea){g(ea,B)})}}}if(v&&v.minFilter!==THREE.NearestFilter&&v.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,v.__webGLTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,
-null)}};this.initWebGLObjects=function(l){if(!l.__webglObjects){l.__webglObjects=[];l.__webglObjectsImmediate=[]}for(;l.__objectsRemoved.length;){var x=l.__objectsRemoved[0],v=l,n=void 0,t=void 0;for(n=v.__webglObjects.length-1;n>=0;n--){t=v.__webglObjects[n].object;x==t&&v.__webglObjects.splice(n,1)}l.__objectsRemoved.splice(0,1)}for(;l.__objectsAdded.length;){x=l.__objectsAdded[0];var B=l;n=void 0;v=void 0;t=void 0;if(x._modelViewMatrix==undefined){x._modelViewMatrix=new THREE.Matrix4;x._normalMatrixArray=
-new Float32Array(9);x._modelViewMatrixArray=new Float32Array(16);x._objectMatrixArray=new Float32Array(16);x.matrixWorld.flattenToArray(x._objectMatrixArray)}objlist=B.__webglObjects;if(x instanceof THREE.Mesh){v=x.geometry;v.geometryGroups==undefined&&C(v);for(n in v.geometryGroups){t=v.geometryGroups[n];if(!t.__webGLVertexBuffer){B=t;B.__webGLVertexBuffer=e.createBuffer();B.__webGLNormalBuffer=e.createBuffer();B.__webGLTangentBuffer=e.createBuffer();B.__webGLColorBuffer=e.createBuffer();B.__webGLUVBuffer=
-e.createBuffer();B.__webGLUV2Buffer=e.createBuffer();B.__webGLSkinVertexABuffer=e.createBuffer();B.__webGLSkinVertexBBuffer=e.createBuffer();B.__webGLSkinIndicesBuffer=e.createBuffer();B.__webGLSkinWeightsBuffer=e.createBuffer();B.__webGLFaceBuffer=e.createBuffer();B.__webGLLineBuffer=e.createBuffer();B=t;var J=x,Q=void 0,G=void 0,z=0,D=0,I=0,T=J.geometry.faces,U=B.faces;Q=0;for(G=U.length;Q<G;Q++){fi=U[Q];face=T[fi];if(face instanceof THREE.Face3){z+=3;D+=1;I+=3}else if(face instanceof THREE.Face4){z+=
-4;D+=2;I+=4}}B.__vertexArray=new Float32Array(z*3);B.__normalArray=new Float32Array(z*3);B.__tangentArray=new Float32Array(z*4);B.__colorArray=new Float32Array(z*3);B.__uvArray=new Float32Array(z*2);B.__uv2Array=new Float32Array(z*2);B.__skinVertexAArray=new Float32Array(z*4);B.__skinVertexBArray=new Float32Array(z*4);B.__skinIndexArray=new Float32Array(z*4);B.__skinWeightArray=new Float32Array(z*4);B.__faceArray=new Uint16Array(D*3);B.__lineArray=new Uint16Array(I*2);G=Q=B;z=void 0;T=void 0;var ea=
-void 0,da=void 0;ea=void 0;U=!1;z=0;for(T=J.materials.length;z<T;z++){ea=J.materials[z];if(ea instanceof THREE.MeshFaceMaterial){ea=0;for(da=G.materials.length;ea<da;ea++)if(G.materials[ea]&&G.materials[ea].shading!=undefined&&G.materials[ea].shading==THREE.SmoothShading){U=!0;break}}else if(ea&&ea.shading!=undefined&&ea.shading==THREE.SmoothShading){U=!0;break}if(U)break}Q.__needsSmoothNormals=U;B.__webGLFaceCount=D*3;B.__webGLLineCount=I*2;v.__dirtyVertices=!0;v.__dirtyElements=!0;v.__dirtyUvs=
-!0;v.__dirtyNormals=!0;v.__dirtyTangents=!0;v.__dirtyColors=!0}if(v.__dirtyVertices||v.__dirtyElements||v.__dirtyUvs||v.__dirtyNormals||v.__dirtyColors||v.__dirtyTangents){B=t;D=e.DYNAMIC_DRAW;I=void 0;Q=void 0;var xa=void 0,R=void 0,Da=void 0,ma=void 0,Aa=void 0;xa=void 0;var Z=void 0,X=void 0,$=void 0,sa=void 0;Z=void 0;X=void 0;$=void 0;R=void 0;Z=void 0;X=void 0;$=void 0;sa=void 0;Z=void 0;X=void 0;$=void 0;sa=void 0;Z=void 0;X=void 0;$=void 0;sa=void 0;Z=void 0;X=void 0;$=void 0;sa=void 0;Z=
-void 0;X=void 0;$=void 0;sa=void 0;R=void 0;ma=void 0;Da=void 0;Aa=void 0;var Fa=da=ea=U=T=z=J=G=0,za=0,L=0,ya=B.__vertexArray,Ra=B.__uvArray,Pa=B.__uv2Array,Ia=B.__normalArray,ta=B.__tangentArray,Ba=B.__colorArray,wa=B.__skinVertexAArray,ja=B.__skinVertexBArray,na=B.__skinIndexArray,ra=B.__skinWeightArray,Ma=B.__faceArray,Ha=B.__lineArray,Sa=B.__needsSmoothNormals,O=x.geometry,ka=O.__dirtyVertices,ha=O.__dirtyElements,V=O.__dirtyUvs,fa=O.__dirtyNormals,pa=O.__dirtyTangents,Ca=O.__dirtyColors,va=
-O.vertices,Ea=B.faces,Na=O.faces,La=O.uvs,Oa=O.uvs2,Ka=O.colors,Ga=O.skinVerticesA,Ja=O.skinVerticesB,Ta=O.skinIndices,Qa=O.skinWeights;I=0;for(Q=Ea.length;I<Q;I++){xa=Ea[I];R=Na[xa];Aa=La[xa];xa=Oa[xa];Da=R.vertexNormals;ma=R.normal;if(R instanceof THREE.Face3){if(ka){Z=va[R.a].position;X=va[R.b].position;$=va[R.c].position;ya[J]=Z.x;ya[J+1]=Z.y;ya[J+2]=Z.z;ya[J+3]=X.x;ya[J+4]=X.y;ya[J+5]=X.z;ya[J+6]=$.x;ya[J+7]=$.y;ya[J+8]=$.z;J+=9}if(Qa.length){Z=Qa[R.a];X=Qa[R.b];$=Qa[R.c];ra[L]=Z.x;ra[L+1]=Z.y;
-ra[L+2]=Z.z;ra[L+3]=Z.w;ra[L+4]=X.x;ra[L+5]=X.y;ra[L+6]=X.z;ra[L+7]=X.w;ra[L+8]=$.x;ra[L+9]=$.y;ra[L+10]=$.z;ra[L+11]=$.w;Z=Ta[R.a];X=Ta[R.b];$=Ta[R.c];na[L]=Z.x;na[L+1]=Z.y;na[L+2]=Z.z;na[L+3]=Z.w;na[L+4]=X.x;na[L+5]=X.y;na[L+6]=X.z;na[L+7]=X.w;na[L+8]=$.x;na[L+9]=$.y;na[L+10]=$.z;na[L+11]=$.w;Z=Ga[R.a];X=Ga[R.b];$=Ga[R.c];wa[L]=Z.x;wa[L+1]=Z.y;wa[L+2]=Z.z;wa[L+3]=1;wa[L+4]=X.x;wa[L+5]=X.y;wa[L+6]=X.z;wa[L+7]=1;wa[L+8]=$.x;wa[L+9]=$.y;wa[L+10]=$.z;wa[L+11]=1;Z=Ja[R.a];X=Ja[R.b];$=Ja[R.c];ja[L]=Z.x;
-ja[L+1]=Z.y;ja[L+2]=Z.z;ja[L+3]=1;ja[L+4]=X.x;ja[L+5]=X.y;ja[L+6]=X.z;ja[L+7]=1;ja[L+8]=$.x;ja[L+9]=$.y;ja[L+10]=$.z;ja[L+11]=1;L+=12}if(Ca&&Ka.length){Z=Ka[R.a];X=Ka[R.b];$=Ka[R.c];Ba[za]=Z.r;Ba[za+1]=Z.g;Ba[za+2]=Z.b;Ba[za+3]=X.r;Ba[za+4]=X.g;Ba[za+5]=X.b;Ba[za+6]=$.r;Ba[za+7]=$.g;Ba[za+8]=$.b;za+=9}if(pa&&O.hasTangents){Z=va[R.a].tangent;X=va[R.b].tangent;$=va[R.c].tangent;ta[da]=Z.x;ta[da+1]=Z.y;ta[da+2]=Z.z;ta[da+3]=Z.w;ta[da+4]=X.x;ta[da+5]=X.y;ta[da+6]=X.z;ta[da+7]=X.w;ta[da+8]=$.x;ta[da+9]=
-$.y;ta[da+10]=$.z;ta[da+11]=$.w;da+=12}if(fa)if(Da.length==3&&Sa)for(R=0;R<3;R++){ma=Da[R];Ia[ea]=ma.x;Ia[ea+1]=ma.y;Ia[ea+2]=ma.z;ea+=3}else for(R=0;R<3;R++){Ia[ea]=ma.x;Ia[ea+1]=ma.y;Ia[ea+2]=ma.z;ea+=3}if(V&&Aa)for(R=0;R<3;R++){Da=Aa[R];Ra[z]=Da.u;Ra[z+1]=Da.v;z+=2}if(V&&xa)for(R=0;R<3;R++){Aa=xa[R];Pa[T]=Aa.u;Pa[T+1]=Aa.v;T+=2}if(ha){Ma[U]=G;Ma[U+1]=G+1;Ma[U+2]=G+2;U+=3;Ha[Fa]=G;Ha[Fa+1]=G+1;Ha[Fa+2]=G;Ha[Fa+3]=G+2;Ha[Fa+4]=G+1;Ha[Fa+5]=G+2;Fa+=6;G+=3}}else if(R instanceof THREE.Face4){if(ka){Z=
-va[R.a].position;X=va[R.b].position;$=va[R.c].position;sa=va[R.d].position;ya[J]=Z.x;ya[J+1]=Z.y;ya[J+2]=Z.z;ya[J+3]=X.x;ya[J+4]=X.y;ya[J+5]=X.z;ya[J+6]=$.x;ya[J+7]=$.y;ya[J+8]=$.z;ya[J+9]=sa.x;ya[J+10]=sa.y;ya[J+11]=sa.z;J+=12}if(Qa.length){Z=Qa[R.a];X=Qa[R.b];$=Qa[R.c];sa=Qa[R.d];ra[L]=Z.x;ra[L+1]=Z.y;ra[L+2]=Z.z;ra[L+3]=Z.w;ra[L+4]=X.x;ra[L+5]=X.y;ra[L+6]=X.z;ra[L+7]=X.w;ra[L+8]=$.x;ra[L+9]=$.y;ra[L+10]=$.z;ra[L+11]=$.w;ra[L+12]=sa.x;ra[L+13]=sa.y;ra[L+14]=sa.z;ra[L+15]=sa.w;Z=Ta[R.a];X=Ta[R.b];
-$=Ta[R.c];sa=Ta[R.d];na[L]=Z.x;na[L+1]=Z.y;na[L+2]=Z.z;na[L+3]=Z.w;na[L+4]=X.x;na[L+5]=X.y;na[L+6]=X.z;na[L+7]=X.w;na[L+8]=$.x;na[L+9]=$.y;na[L+10]=$.z;na[L+11]=$.w;na[L+12]=sa.x;na[L+13]=sa.y;na[L+14]=sa.z;na[L+15]=sa.w;Z=Ga[R.a];X=Ga[R.b];$=Ga[R.c];sa=Ga[R.d];wa[L]=Z.x;wa[L+1]=Z.y;wa[L+2]=Z.z;wa[L+3]=1;wa[L+4]=X.x;wa[L+5]=X.y;wa[L+6]=X.z;wa[L+7]=1;wa[L+8]=$.x;wa[L+9]=$.y;wa[L+10]=$.z;wa[L+11]=1;wa[L+12]=sa.x;wa[L+13]=sa.y;wa[L+14]=sa.z;wa[L+15]=1;Z=Ja[R.a];X=Ja[R.b];$=Ja[R.c];sa=Ja[R.d];ja[L]=Z.x;
-ja[L+1]=Z.y;ja[L+2]=Z.z;ja[L+3]=1;ja[L+4]=X.x;ja[L+5]=X.y;ja[L+6]=X.z;ja[L+7]=1;ja[L+8]=$.x;ja[L+9]=$.y;ja[L+10]=$.z;ja[L+11]=1;ja[L+12]=sa.x;ja[L+13]=sa.y;ja[L+14]=sa.z;ja[L+15]=1;L+=16}if(Ca&&Ka.length){Z=Ka[R.a];X=Ka[R.b];$=Ka[R.c];sa=Ka[R.d];Ba[za]=Z.r;Ba[za+1]=Z.g;Ba[za+2]=Z.b;Ba[za+3]=X.r;Ba[za+4]=X.g;Ba[za+5]=X.b;Ba[za+6]=$.r;Ba[za+7]=$.g;Ba[za+8]=$.b;Ba[za+9]=sa.r;Ba[za+10]=sa.g;Ba[za+11]=sa.b;za+=12}if(pa&&O.hasTangents){Z=va[R.a].tangent;X=va[R.b].tangent;$=va[R.c].tangent;R=va[R.d].tangent;
-ta[da]=Z.x;ta[da+1]=Z.y;ta[da+2]=Z.z;ta[da+3]=Z.w;ta[da+4]=X.x;ta[da+5]=X.y;ta[da+6]=X.z;ta[da+7]=X.w;ta[da+8]=$.x;ta[da+9]=$.y;ta[da+10]=$.z;ta[da+11]=$.w;ta[da+12]=R.x;ta[da+13]=R.y;ta[da+14]=R.z;ta[da+15]=R.w;da+=16}if(fa)if(Da.length==4&&Sa)for(R=0;R<4;R++){ma=Da[R];Ia[ea]=ma.x;Ia[ea+1]=ma.y;Ia[ea+2]=ma.z;ea+=3}else for(R=0;R<4;R++){Ia[ea]=ma.x;Ia[ea+1]=ma.y;Ia[ea+2]=ma.z;ea+=3}if(V&&Aa)for(R=0;R<4;R++){Da=Aa[R];Ra[z]=Da.u;Ra[z+1]=Da.v;z+=2}if(V&&xa)for(R=0;R<4;R++){Aa=xa[R];Pa[T]=Aa.u;Pa[T+1]=
-Aa.v;T+=2}if(ha){Ma[U]=G;Ma[U+1]=G+1;Ma[U+2]=G+2;Ma[U+3]=G;Ma[U+4]=G+2;Ma[U+5]=G+3;U+=6;Ha[Fa]=G;Ha[Fa+1]=G+1;Ha[Fa+2]=G;Ha[Fa+3]=G+3;Ha[Fa+4]=G+1;Ha[Fa+5]=G+2;Ha[Fa+6]=G+2;Ha[Fa+7]=G+3;Fa+=8;G+=4}}}if(ka){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ya,D)}if(Ca&&Ka.length){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,D)}if(fa){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Ia,D)}if(pa&&O.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,
-B.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ta,D)}if(V&&z>0){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,D)}if(V&&T>0){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Pa,D)}if(ha){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ma,D);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,B.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ha,D)}if(L>0){e.bindBuffer(e.ARRAY_BUFFER,B.__webGLSkinVertexABuffer);
-e.bufferData(e.ARRAY_BUFFER,wa,D);e.bindBuffer(e.ARRAY_BUFFER,B.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ja,D);e.bindBuffer(e.ARRAY_BUFFER,B.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,na,D);e.bindBuffer(e.ARRAY_BUFFER,B.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,ra,D)}}E(objlist,t,x)}v.__dirtyVertices=!1;v.__dirtyElements=!1;v.__dirtyUvs=!1;v.__dirtyNormals=!1;v.__dirtyTangents=!1;v.__dirtyColors=!1}else if(x instanceof THREE.Ribbon){v=x.geometry;if(!v.__webGLVertexBuffer){n=
-v;n.__webGLVertexBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=v;t=n.vertices.length;n.__vertexArray=new Float32Array(t*3);n.__colorArray=new Float32Array(t*3);n.__webGLVertexCount=t;v.__dirtyVertices=!0;v.__dirtyColors=!0}if(v.__dirtyVertices||v.__dirtyColors){n=v;t=e.DYNAMIC_DRAW;G=void 0;G=void 0;J=void 0;B=void 0;z=n.vertices;D=n.colors;T=z.length;I=D.length;U=n.__vertexArray;Q=n.__colorArray;ea=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<T;G++){J=z[G].position;B=G*3;U[B]=
-J.x;U[B+1]=J.y;U[B+2]=J.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,U,t)}if(ea){for(G=0;G<I;G++){color=D[G];B=G*3;Q[B]=color.r;Q[B+1]=color.g;Q[B+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,Q,t)}}E(objlist,v,x);v.__dirtyVertices=!1;v.__dirtyColors=!1}else if(x instanceof THREE.Line){v=x.geometry;if(!v.__webGLVertexBuffer){n=v;n.__webGLVertexBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=v;t=n.vertices.length;
-n.__vertexArray=new Float32Array(t*3);n.__colorArray=new Float32Array(t*3);n.__webGLLineCount=t;v.__dirtyVertices=!0;v.__dirtyColors=!0}if(v.__dirtyVertices||v.__dirtyColors){n=v;t=e.DYNAMIC_DRAW;G=void 0;G=void 0;J=void 0;B=void 0;z=n.vertices;D=n.colors;T=z.length;I=D.length;U=n.__vertexArray;Q=n.__colorArray;ea=n.__dirtyColors;if(n.__dirtyVertices){for(G=0;G<T;G++){J=z[G].position;B=G*3;U[B]=J.x;U[B+1]=J.y;U[B+2]=J.z}e.bindBuffer(e.ARRAY_BUFFER,n.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,
-U,t)}if(ea){for(G=0;G<I;G++){color=D[G];B=G*3;Q[B]=color.r;Q[B+1]=color.g;Q[B+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,Q,t)}}E(objlist,v,x);v.__dirtyVertices=!1;v.__dirtyColors=!1}else if(x instanceof THREE.ParticleSystem){v=x.geometry;if(!v.__webGLVertexBuffer){n=v;n.__webGLVertexBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=v;t=n.vertices.length;n.__vertexArray=new Float32Array(t*3);n.__colorArray=new Float32Array(t*3);n.__sortArray=
-[];n.__webGLParticleCount=t;v.__dirtyVertices=!0;v.__dirtyColors=!0}(v.__dirtyVertices||v.__dirtyColors||x.sortParticles)&&b(v,e.DYNAMIC_DRAW,x);E(objlist,v,x);v.__dirtyVertices=!1;v.__dirtyColors=!1}else THREE.MarchingCubes!==undefined&&x instanceof THREE.MarchingCubes&&B.__webglObjectsImmediate.push({object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}});l.__objectsAdded.splice(0,1)}};this.setFaceCulling=function(l,x){if(l){!x||x=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);
-else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var N=document.createElement("canvas"),e,L=null,M=null,V=this,R=null,aa=null,ca=null,J=null,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],oa=new THREE.Matrix4,ba=new Float32Array(16),la=new Float32Array(16),ia=new THREE.Vector4,
+ga=!0,qa=new THREE.Color(0),wa=0;if(a){if(a.antialias!==undefined)ga=a.antialias;a.clearColor!==undefined&&qa.setHex(a.clearColor);if(a.clearAlpha!==undefined)wa=a.clearAlpha}this.domElement=N;this.autoClear=!0;this.sortObjects=!1;(function(l,x,y){try{e=N.getContext("experimental-webgl",{antialias:l})}catch(n){console.log(n)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);
+e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(x.r,x.g,x.b,y);_cullEnabled=!0})(ga,qa,wa);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,x){N.width=l;N.height=x;e.viewport(0,0,N.width,N.height)};this.setClearColorHex=function(l,x){var y=new THREE.Color(l);e.clearColor(y.r,y.g,y.b,x)};this.setClearColor=function(l,x){e.clearColor(l.r,l.g,l.b,x)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|
+e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,x,y){var n,p;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof
+THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var D,E,O,T;p=O=T=0;for(D=x.length;p<D;p++){E=x[p];E instanceof THREE.DirectionalLight&&O++;E instanceof THREE.PointLight&&T++}if(T+O<=4)x=O;else{x=Math.ceil(4*O/(T+O));T=4-x}p={directional:x,point:T};T=l.fragmentShader;x=l.vertexShader;D={fog:y,map:l.map,envMap:l.envMap,lightMap:l.lightMap,vertexColors:l.vertexColors,skinning:l.skinning,maxDirLights:p.directional,maxPointLights:p.point};y=e.createProgram();p=["#ifdef GL_ES\nprecision highp float;\n#endif",
+"#define MAX_DIR_LIGHTS "+D.maxDirLights,"#define MAX_POINT_LIGHTS "+D.maxPointLights,D.fog?"#define USE_FOG":"",D.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",D.map?"#define USE_MAP":"",D.envMap?"#define USE_ENVMAP":"",D.lightMap?"#define USE_LIGHTMAP":"",D.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");D=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+D.maxDirLights,"#define MAX_POINT_LIGHTS "+
+D.maxPointLights,D.map?"#define USE_MAP":"",D.envMap?"#define USE_ENVMAP":"",D.lightMap?"#define USE_LIGHTMAP":"",D.vertexColors?"#define USE_COLOR":"",D.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+e.attachShader(y,u("fragment",p+T));e.attachShader(y,u("vertex",D+x));e.linkProgram(y);e.getProgramParameter(y,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(y,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");y.uniforms={};y.attributes={};l.program=y;y=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(n in l.uniforms)y.push(n);n=l.program;T=0;for(x=y.length;T<
+x;T++){p=y[T];n.uniforms[p]=e.getUniformLocation(n,p)}n=l.program;y=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];T=0;for(x=y.length;T<x;T++){p=y[T];n.attributes[p]=e.getAttribLocation(n,p)}n=l.program.attributes;e.enableVertexAttribArray(n.position);n.color>=0&&e.enableVertexAttribArray(n.color);n.normal>=0&&e.enableVertexAttribArray(n.normal);n.tangent>=0&&e.enableVertexAttribArray(n.tangent);if(l.skinning&&n.skinVertexA>=0&&n.skinVertexB>=
+0&&n.skinIndex>=0&&n.skinWeight>=0){e.enableVertexAttribArray(n.skinVertexA);e.enableVertexAttribArray(n.skinVertexB);e.enableVertexAttribArray(n.skinIndex);e.enableVertexAttribArray(n.skinWeight)}};this.render=function(l,x,y,n){var p,D,E,O,T,v,A,G,S=l.lights,W=l.fog;x.matrixAutoUpdate&&x.update();x.matrixWorldInverse.flattenToArray(la);x.projectionMatrix.flattenToArray(ba);oa.multiply(x.projectionMatrix,x.matrixWorldInverse);j(oa);THREE.AnimationHandler&&THREE.AnimationHandler.update();l.update(undefined,
+!1,x);this.initWebGLObjects(l,x);H(y,n!==undefined?n:!0);this.autoClear&&this.clear();T=l.__webglObjects.length;for(n=0;n<T;n++){p=l.__webglObjects[n];A=p.object;if(A.visible)if(!(A instanceof THREE.Mesh)||m(A)){A.matrixWorld.flattenToArray(A._objectMatrixArray);B(A,x);q(p);p.render=!0;if(this.sortObjects){ia.copy(A.position);oa.multiplyVector3(ia);p.z=ia.z}}else p.render=!1;else p.render=!1}this.sortObjects&&l.__webglObjects.sort(t);v=l.__webglObjectsImmediate.length;for(n=0;n<v;n++){p=l.__webglObjectsImmediate[n];
+A=p.object;if(A.visible){A.matrixAutoUpdate&&A.matrixWorld.flattenToArray(A._objectMatrixArray);B(A,x);z(p)}}w(THREE.NormalBlending);for(n=0;n<T;n++){p=l.__webglObjects[n];if(p.render){A=p.object;G=p.buffer;E=p.opaque;h(A);for(p=0;p<E.count;p++){O=E.list[p];k(O.depthTest);f(x,S,W,O,G,A)}}}for(n=0;n<v;n++){p=l.__webglObjectsImmediate[n];A=p.object;if(A.visible){E=p.opaque;h(A);for(p=0;p<E.count;p++){O=E.list[p];k(O.depthTest);D=d(x,S,W,O,A);A.render(function(da){g(da,D)})}}}for(n=0;n<T;n++){p=l.__webglObjects[n];
+if(p.render){A=p.object;G=p.buffer;E=p.transparent;h(A);for(p=0;p<E.count;p++){O=E.list[p];w(O.blending);k(O.depthTest);f(x,S,W,O,G,A)}}}for(n=0;n<v;n++){p=l.__webglObjectsImmediate[n];A=p.object;if(A.visible){E=p.transparent;h(A);for(p=0;p<E.count;p++){O=E.list[p];w(O.blending);k(O.depthTest);D=d(x,S,W,O,A);A.render(function(da){g(da,D)})}}}if(y&&y.minFilter!==THREE.NearestFilter&&y.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,y.__webGLTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,
+null)}};this.initWebGLObjects=function(l){if(!l.__webglObjects){l.__webglObjects=[];l.__webglObjectsImmediate=[]}for(;l.__objectsRemoved.length;){var x=l.__objectsRemoved[0],y=l,n=void 0,p=void 0;for(n=y.__webglObjects.length-1;n>=0;n--){p=y.__webglObjects[n].object;x==p&&y.__webglObjects.splice(n,1)}l.__objectsRemoved.splice(0,1)}for(;l.__objectsAdded.length;){x=l.__objectsAdded[0];var D=l;n=void 0;y=void 0;p=void 0;if(x._modelViewMatrix==undefined){x._modelViewMatrix=new THREE.Matrix4;x._normalMatrixArray=
+new Float32Array(9);x._modelViewMatrixArray=new Float32Array(16);x._objectMatrixArray=new Float32Array(16);x.matrixWorld.flattenToArray(x._objectMatrixArray)}objlist=D.__webglObjects;if(x instanceof THREE.Mesh){y=x.geometry;y.geometryGroups==undefined&&C(y);for(n in y.geometryGroups){p=y.geometryGroups[n];if(!p.__webGLVertexBuffer){D=p;D.__webGLVertexBuffer=e.createBuffer();D.__webGLNormalBuffer=e.createBuffer();D.__webGLTangentBuffer=e.createBuffer();D.__webGLColorBuffer=e.createBuffer();D.__webGLUVBuffer=
+e.createBuffer();D.__webGLUV2Buffer=e.createBuffer();D.__webGLSkinVertexABuffer=e.createBuffer();D.__webGLSkinVertexBBuffer=e.createBuffer();D.__webGLSkinIndicesBuffer=e.createBuffer();D.__webGLSkinWeightsBuffer=e.createBuffer();D.__webGLFaceBuffer=e.createBuffer();D.__webGLLineBuffer=e.createBuffer();D=p;var E=x,O=void 0,T=void 0,v=0,A=0,G=0,S=E.geometry.faces,W=D.faces;O=0;for(T=W.length;O<T;O++){fi=W[O];face=S[fi];if(face instanceof THREE.Face3){v+=3;A+=1;G+=3}else if(face instanceof THREE.Face4){v+=
+4;A+=2;G+=4}}D.__vertexArray=new Float32Array(v*3);D.__normalArray=new Float32Array(v*3);D.__tangentArray=new Float32Array(v*4);D.__colorArray=new Float32Array(v*3);D.__uvArray=new Float32Array(v*2);D.__uv2Array=new Float32Array(v*2);D.__skinVertexAArray=new Float32Array(v*4);D.__skinVertexBArray=new Float32Array(v*4);D.__skinIndexArray=new Float32Array(v*4);D.__skinWeightArray=new Float32Array(v*4);D.__faceArray=new Uint16Array(A*3);D.__lineArray=new Uint16Array(G*2);T=O=D;v=void 0;S=void 0;var da=
+void 0,ja=void 0;da=void 0;W=!1;v=0;for(S=E.materials.length;v<S;v++){da=E.materials[v];if(da instanceof THREE.MeshFaceMaterial){da=0;for(ja=T.materials.length;da<ja;da++)if(T.materials[da]&&T.materials[da].shading!=undefined&&T.materials[da].shading==THREE.SmoothShading){W=!0;break}}else if(da&&da.shading!=undefined&&da.shading==THREE.SmoothShading){W=!0;break}if(W)break}O.__needsSmoothNormals=W;D.__webGLFaceCount=A*3;D.__webGLLineCount=G*2;y.__dirtyVertices=!0;y.__dirtyElements=!0;y.__dirtyUvs=
+!0;y.__dirtyNormals=!0;y.__dirtyTangents=!0;y.__dirtyColors=!0}F(objlist,p,x)}}else if(x instanceof THREE.Ribbon){y=x.geometry;if(!y.__webGLVertexBuffer){n=y;n.__webGLVertexBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=y;p=n.vertices.length;n.__vertexArray=new Float32Array(p*3);n.__colorArray=new Float32Array(p*3);n.__webGLVertexCount=p;y.__dirtyVertices=!0;y.__dirtyColors=!0}F(objlist,y,x)}else if(x instanceof THREE.Line){y=x.geometry;if(!y.__webGLVertexBuffer){n=y;n.__webGLVertexBuffer=
+e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=y;p=n.vertices.length;n.__vertexArray=new Float32Array(p*3);n.__colorArray=new Float32Array(p*3);n.__webGLLineCount=p;y.__dirtyVertices=!0;y.__dirtyColors=!0}F(objlist,y,x)}else if(x instanceof THREE.ParticleSystem){y=x.geometry;if(!y.__webGLVertexBuffer){n=y;n.__webGLVertexBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n=y;p=n.vertices.length;n.__vertexArray=new Float32Array(p*3);n.__colorArray=new Float32Array(p*3);n.__sortArray=
+[];n.__webGLParticleCount=p;y.__dirtyVertices=!0;y.__dirtyColors=!0}F(objlist,y,x)}else THREE.MarchingCubes!==undefined&&x instanceof THREE.MarchingCubes&&D.__webglObjectsImmediate.push({object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}});l.__objectsAdded.splice(0,1)}x=0;for(y=l.__webglObjects.length;x<y;x++){p=void 0;n=void 0;A=void 0;D=void 0;D=l.__webglObjects[x].object;if(D instanceof THREE.Mesh){n=D.geometry;for(p in n.geometryGroups){A=n.geometryGroups[p];if(n.__dirtyVertices||
+n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents){G=e.DYNAMIC_DRAW;O=void 0;T=void 0;var xa=void 0,P=void 0,Ea=void 0,ma=void 0,Aa=void 0;xa=void 0;var Z=void 0,X=void 0,$=void 0,ta=void 0;Z=void 0;X=void 0;$=void 0;P=void 0;Z=void 0;X=void 0;$=void 0;ta=void 0;Z=void 0;X=void 0;$=void 0;ta=void 0;Z=void 0;X=void 0;$=void 0;ta=void 0;Z=void 0;X=void 0;$=void 0;ta=void 0;Z=void 0;X=void 0;$=void 0;ta=void 0;P=void 0;ma=void 0;Ea=void 0;Aa=void 0;var ua=ja=da=W=
+S=v=E=0,Ga=0,za=0,K=0,Ba=A.__vertexArray,Pa=A.__uvArray,Qa=A.__uv2Array,Ka=A.__normalArray,sa=A.__tangentArray,Ca=A.__colorArray,ka=A.__skinVertexAArray,na=A.__skinVertexBArray,ra=A.__skinIndexArray,va=A.__skinWeightArray,Ma=A.__faceArray,Ia=A.__lineArray,Q=A.__needsSmoothNormals,fa=D.geometry,ha=fa.__dirtyVertices,U=fa.__dirtyElements,ea=fa.__dirtyUvs,pa=fa.__dirtyNormals,Da=fa.__dirtyTangents,Fa=fa.__dirtyColors,ya=fa.vertices,Na=A.faces,La=fa.faces,Oa=fa.uvs,Sa=fa.uvs2,Ha=fa.colors,Ja=fa.skinVerticesA,
+Ta=fa.skinVerticesB,Ua=fa.skinIndices,Ra=fa.skinWeights;O=0;for(T=Na.length;O<T;O++){xa=Na[O];P=La[xa];Aa=Oa[xa];xa=Sa[xa];Ea=P.vertexNormals;ma=P.normal;if(P instanceof THREE.Face3){if(ha){Z=ya[P.a].position;X=ya[P.b].position;$=ya[P.c].position;Ba[v]=Z.x;Ba[v+1]=Z.y;Ba[v+2]=Z.z;Ba[v+3]=X.x;Ba[v+4]=X.y;Ba[v+5]=X.z;Ba[v+6]=$.x;Ba[v+7]=$.y;Ba[v+8]=$.z;v+=9}if(Ra.length){Z=Ra[P.a];X=Ra[P.b];$=Ra[P.c];va[K]=Z.x;va[K+1]=Z.y;va[K+2]=Z.z;va[K+3]=Z.w;va[K+4]=X.x;va[K+5]=X.y;va[K+6]=X.z;va[K+7]=X.w;va[K+
+8]=$.x;va[K+9]=$.y;va[K+10]=$.z;va[K+11]=$.w;Z=Ua[P.a];X=Ua[P.b];$=Ua[P.c];ra[K]=Z.x;ra[K+1]=Z.y;ra[K+2]=Z.z;ra[K+3]=Z.w;ra[K+4]=X.x;ra[K+5]=X.y;ra[K+6]=X.z;ra[K+7]=X.w;ra[K+8]=$.x;ra[K+9]=$.y;ra[K+10]=$.z;ra[K+11]=$.w;Z=Ja[P.a];X=Ja[P.b];$=Ja[P.c];ka[K]=Z.x;ka[K+1]=Z.y;ka[K+2]=Z.z;ka[K+3]=1;ka[K+4]=X.x;ka[K+5]=X.y;ka[K+6]=X.z;ka[K+7]=1;ka[K+8]=$.x;ka[K+9]=$.y;ka[K+10]=$.z;ka[K+11]=1;Z=Ta[P.a];X=Ta[P.b];$=Ta[P.c];na[K]=Z.x;na[K+1]=Z.y;na[K+2]=Z.z;na[K+3]=1;na[K+4]=X.x;na[K+5]=X.y;na[K+6]=X.z;na[K+
+7]=1;na[K+8]=$.x;na[K+9]=$.y;na[K+10]=$.z;na[K+11]=1;K+=12}if(Fa&&Ha.length){Z=Ha[P.a];X=Ha[P.b];$=Ha[P.c];Ca[za]=Z.r;Ca[za+1]=Z.g;Ca[za+2]=Z.b;Ca[za+3]=X.r;Ca[za+4]=X.g;Ca[za+5]=X.b;Ca[za+6]=$.r;Ca[za+7]=$.g;Ca[za+8]=$.b;za+=9}if(Da&&fa.hasTangents){Z=ya[P.a].tangent;X=ya[P.b].tangent;$=ya[P.c].tangent;sa[ua]=Z.x;sa[ua+1]=Z.y;sa[ua+2]=Z.z;sa[ua+3]=Z.w;sa[ua+4]=X.x;sa[ua+5]=X.y;sa[ua+6]=X.z;sa[ua+7]=X.w;sa[ua+8]=$.x;sa[ua+9]=$.y;sa[ua+10]=$.z;sa[ua+11]=$.w;ua+=12}if(pa)if(Ea.length==3&&Q)for(P=0;P<
+3;P++){ma=Ea[P];Ka[ja]=ma.x;Ka[ja+1]=ma.y;Ka[ja+2]=ma.z;ja+=3}else for(P=0;P<3;P++){Ka[ja]=ma.x;Ka[ja+1]=ma.y;Ka[ja+2]=ma.z;ja+=3}if(ea&&Aa)for(P=0;P<3;P++){Ea=Aa[P];Pa[S]=Ea.u;Pa[S+1]=Ea.v;S+=2}if(ea&&xa)for(P=0;P<3;P++){Aa=xa[P];Qa[W]=Aa.u;Qa[W+1]=Aa.v;W+=2}if(U){Ma[da]=E;Ma[da+1]=E+1;Ma[da+2]=E+2;da+=3;Ia[Ga]=E;Ia[Ga+1]=E+1;Ia[Ga+2]=E;Ia[Ga+3]=E+2;Ia[Ga+4]=E+1;Ia[Ga+5]=E+2;Ga+=6;E+=3}}else if(P instanceof THREE.Face4){if(ha){Z=ya[P.a].position;X=ya[P.b].position;$=ya[P.c].position;ta=ya[P.d].position;
+Ba[v]=Z.x;Ba[v+1]=Z.y;Ba[v+2]=Z.z;Ba[v+3]=X.x;Ba[v+4]=X.y;Ba[v+5]=X.z;Ba[v+6]=$.x;Ba[v+7]=$.y;Ba[v+8]=$.z;Ba[v+9]=ta.x;Ba[v+10]=ta.y;Ba[v+11]=ta.z;v+=12}if(Ra.length){Z=Ra[P.a];X=Ra[P.b];$=Ra[P.c];ta=Ra[P.d];va[K]=Z.x;va[K+1]=Z.y;va[K+2]=Z.z;va[K+3]=Z.w;va[K+4]=X.x;va[K+5]=X.y;va[K+6]=X.z;va[K+7]=X.w;va[K+8]=$.x;va[K+9]=$.y;va[K+10]=$.z;va[K+11]=$.w;va[K+12]=ta.x;va[K+13]=ta.y;va[K+14]=ta.z;va[K+15]=ta.w;Z=Ua[P.a];X=Ua[P.b];$=Ua[P.c];ta=Ua[P.d];ra[K]=Z.x;ra[K+1]=Z.y;ra[K+2]=Z.z;ra[K+3]=Z.w;ra[K+4]=
+X.x;ra[K+5]=X.y;ra[K+6]=X.z;ra[K+7]=X.w;ra[K+8]=$.x;ra[K+9]=$.y;ra[K+10]=$.z;ra[K+11]=$.w;ra[K+12]=ta.x;ra[K+13]=ta.y;ra[K+14]=ta.z;ra[K+15]=ta.w;Z=Ja[P.a];X=Ja[P.b];$=Ja[P.c];ta=Ja[P.d];ka[K]=Z.x;ka[K+1]=Z.y;ka[K+2]=Z.z;ka[K+3]=1;ka[K+4]=X.x;ka[K+5]=X.y;ka[K+6]=X.z;ka[K+7]=1;ka[K+8]=$.x;ka[K+9]=$.y;ka[K+10]=$.z;ka[K+11]=1;ka[K+12]=ta.x;ka[K+13]=ta.y;ka[K+14]=ta.z;ka[K+15]=1;Z=Ta[P.a];X=Ta[P.b];$=Ta[P.c];ta=Ta[P.d];na[K]=Z.x;na[K+1]=Z.y;na[K+2]=Z.z;na[K+3]=1;na[K+4]=X.x;na[K+5]=X.y;na[K+6]=X.z;na[K+
+7]=1;na[K+8]=$.x;na[K+9]=$.y;na[K+10]=$.z;na[K+11]=1;na[K+12]=ta.x;na[K+13]=ta.y;na[K+14]=ta.z;na[K+15]=1;K+=16}if(Fa&&Ha.length){Z=Ha[P.a];X=Ha[P.b];$=Ha[P.c];ta=Ha[P.d];Ca[za]=Z.r;Ca[za+1]=Z.g;Ca[za+2]=Z.b;Ca[za+3]=X.r;Ca[za+4]=X.g;Ca[za+5]=X.b;Ca[za+6]=$.r;Ca[za+7]=$.g;Ca[za+8]=$.b;Ca[za+9]=ta.r;Ca[za+10]=ta.g;Ca[za+11]=ta.b;za+=12}if(Da&&fa.hasTangents){Z=ya[P.a].tangent;X=ya[P.b].tangent;$=ya[P.c].tangent;P=ya[P.d].tangent;sa[ua]=Z.x;sa[ua+1]=Z.y;sa[ua+2]=Z.z;sa[ua+3]=Z.w;sa[ua+4]=X.x;sa[ua+
+5]=X.y;sa[ua+6]=X.z;sa[ua+7]=X.w;sa[ua+8]=$.x;sa[ua+9]=$.y;sa[ua+10]=$.z;sa[ua+11]=$.w;sa[ua+12]=P.x;sa[ua+13]=P.y;sa[ua+14]=P.z;sa[ua+15]=P.w;ua+=16}if(pa)if(Ea.length==4&&Q)for(P=0;P<4;P++){ma=Ea[P];Ka[ja]=ma.x;Ka[ja+1]=ma.y;Ka[ja+2]=ma.z;ja+=3}else for(P=0;P<4;P++){Ka[ja]=ma.x;Ka[ja+1]=ma.y;Ka[ja+2]=ma.z;ja+=3}if(ea&&Aa)for(P=0;P<4;P++){Ea=Aa[P];Pa[S]=Ea.u;Pa[S+1]=Ea.v;S+=2}if(ea&&xa)for(P=0;P<4;P++){Aa=xa[P];Qa[W]=Aa.u;Qa[W+1]=Aa.v;W+=2}if(U){Ma[da]=E;Ma[da+1]=E+1;Ma[da+2]=E+2;Ma[da+3]=E;Ma[da+
+4]=E+2;Ma[da+5]=E+3;da+=6;Ia[Ga]=E;Ia[Ga+1]=E+1;Ia[Ga+2]=E;Ia[Ga+3]=E+3;Ia[Ga+4]=E+1;Ia[Ga+5]=E+2;Ia[Ga+6]=E+2;Ia[Ga+7]=E+3;Ga+=8;E+=4}}}if(ha){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,G)}if(Fa&&Ha.length){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,Ca,G)}if(pa){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Ka,G)}if(Da&&fa.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,
+sa,G)}if(ea&&S>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,G)}if(ea&&W>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Qa,G)}if(U){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ma,G);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,A.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ia,G)}if(K>0){e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ka,G);e.bindBuffer(e.ARRAY_BUFFER,
+A.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,na,G);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,ra,G);e.bindBuffer(e.ARRAY_BUFFER,A.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,va,G)}}}n.__dirtyVertices=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(D instanceof THREE.Ribbon){n=D.geometry;if(n.__dirtyVertices||n.__dirtyColors){p=n;D=e.DYNAMIC_DRAW;E=void 0;E=void 0;v=void 0;A=void 0;
+S=p.vertices;G=p.colors;W=S.length;O=G.length;da=p.__vertexArray;T=p.__colorArray;ja=p.__dirtyColors;if(p.__dirtyVertices){for(E=0;E<W;E++){v=S[E].position;A=E*3;da[A]=v.x;da[A+1]=v.y;da[A+2]=v.z}e.bindBuffer(e.ARRAY_BUFFER,p.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,da,D)}if(ja){for(E=0;E<O;E++){color=G[E];A=E*3;T[A]=color.r;T[A+1]=color.g;T[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,p.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,T,D)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(D instanceof
+THREE.Line){n=D.geometry;if(n.__dirtyVertices||n.__dirtyColors){p=n;D=e.DYNAMIC_DRAW;E=void 0;E=void 0;v=void 0;A=void 0;S=p.vertices;G=p.colors;W=S.length;O=G.length;da=p.__vertexArray;T=p.__colorArray;ja=p.__dirtyColors;if(p.__dirtyVertices){for(E=0;E<W;E++){v=S[E].position;A=E*3;da[A]=v.x;da[A+1]=v.y;da[A+2]=v.z}e.bindBuffer(e.ARRAY_BUFFER,p.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,da,D)}if(ja){for(E=0;E<O;E++){color=G[E];A=E*3;T[A]=color.r;T[A+1]=color.g;T[A+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,
+p.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,T,D)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(D instanceof THREE.ParticleSystem){n=D.geometry;(n.__dirtyVertices||n.__dirtyColors||D.sortParticles)&&b(n,e.DYNAMIC_DRAW,D);n.__dirtyVertices=!1;n.__dirtyColors=!1}}};this.setFaceCulling=function(l,x){if(l){!x||x=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};
+this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
 map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
@@ -273,17 +274,17 @@ THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"ve
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,f=c.length;for(d=0;d<f;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,f=c.length;for(d=0;d<f;d++){a=c[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
 THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
 THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
-var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.matrixAutoUpdate&&b.updateMatrix();for(var o=0,y=h.length;o<y;o++){var p=new THREE.Vertex(h[o].position.clone());c&&b.matrix.multiplyVector3(p.position);g.push(p)}o=0;for(y=j.length;o<y;o++){h=j[o];var q,A=h.vertexNormals;if(h instanceof THREE.Face3)q=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(q=new THREE.Face4(h.a+
-d,h.b+d,h.c+d,h.d+d));q.centroid.copy(h.centroid);q.normal.copy(h.normal);c=0;for(g=A.length;c<g;c++){p=A[c];q.vertexNormals.push(p.clone())}q.materials=h.materials.slice();k.push(q)}o=0;for(y=f.length;o<y;o++){d=f[o];k=[];c=0;for(g=d.length;c<g;c++)k.push(new THREE.UV(d[c].u,d[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],g=new THREE.Texture(f,
-b);b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;c&&c(this)};f[b].src=a[b]}return g}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(o in M.objects)if(!K.objects[o]){C=M.objects[o];if(u=K.geometries[C.geometry]){e=[];for(i=0;i<C.materials.length;i++)e[i]=K.materials[C.materials[i]];E=C.position;r=C.rotation;s=C.scale;object=new THREE.Mesh(u,e);object.position.set(E[0],
-E[1],E[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=C.visible;K.scene.addObject(object);K.objects[o]=object}}}function h(Y){return function(oa){K.geometries[Y]=oa;g();W-=1;k()}}function k(){d({total_models:aa,total_textures:ca,loaded_models:aa-W,loaded_textures:ca-S},K);W==0&&S==0&&c(K)}var j,m,o,y,p,q,A,C,E,w,F,u,H,P,e,M,N,W,S,aa,ca,K;M=f.data;N=new THREE.Loader;S=W=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
-lights:{},fogs:{}};f=function(){S-=1;k()};for(p in M.cameras){w=M.cameras[p];if(w.type=="perspective")H=new THREE.Camera(w.fov,w.aspect,w.near,w.far);else if(w.type=="ortho"){H=new THREE.Camera;H.projectionMatrix=THREE.Matrix4.makeOrtho(w.left,w.right,w.top,w.bottom,w.near,w.far)}E=w.position;w=w.target;H.position.set(E[0],E[1],E[2]);H.target.position.set(w[0],w[1],w[2]);K.cameras[p]=H}for(y in M.lights){p=M.lights[y];if(p.type=="directional"){E=p.direction;light=new THREE.DirectionalLight;light.position.set(E[0],
-E[1],E[2]);light.position.normalize()}else if(p.type=="point"){E=p.position;light=new THREE.PointLight;light.position.set(E[0],E[1],E[2])}w=p.color;i=p.intensity||1;light.color.setRGB(w[0]*i,w[1]*i,w[2]*i);K.scene.addLight(light);K.lights[y]=light}for(q in M.fogs){y=M.fogs[q];if(y.type=="linear")P=new THREE.Fog(0,y.near,y.far);else y.type=="exp2"&&(P=new THREE.FogExp2(0,y.density));w=y.color;P.color.setRGB(w[0],w[1],w[2]);K.fogs[q]=P}if(K.cameras&&M.defaults.camera)K.currentCamera=K.cameras[M.defaults.camera];
-if(K.fogs&&M.defaults.fog)K.scene.fog=K.fogs[M.defaults.fog];w=M.defaults.bgcolor;K.bgColor=new THREE.Color;K.bgColor.setRGB(w[0],w[1],w[2]);K.bgColorAlpha=M.defaults.bgalpha;for(j in M.geometries){q=M.geometries[j];if(q.type=="bin_mesh"||q.type=="ascii_mesh")W+=1}aa=W;for(j in M.geometries){q=M.geometries[j];if(q.type=="cube"){u=new Cube(q.width,q.height,q.depth,q.segmentsWidth,q.segmentsHeight,null,q.flipped,q.sides);K.geometries[j]=u}else if(q.type=="plane"){u=new Plane(q.width,q.height,q.segmentsWidth,
-q.segmentsHeight);K.geometries[j]=u}else if(q.type=="sphere"){u=new Sphere(q.radius,q.segmentsWidth,q.segmentsHeight);K.geometries[j]=u}else if(q.type=="cylinder"){u=new Cylinder(q.numSegs,q.topRad,q.botRad,q.height,q.topOffset,q.botOffset);K.geometries[j]=u}else if(q.type=="torus"){u=new Torus(q.radius,q.tube,q.segmentsR,q.segmentsT);K.geometries[j]=u}else if(q.type=="icosahedron"){u=new Icosahedron(q.subdivisions);K.geometries[j]=u}else if(q.type=="bin_mesh")N.loadBinary({model:q.url,callback:h(j)});
-else q.type=="ascii_mesh"&&N.loadAscii({model:q.url,callback:h(j)})}for(A in M.textures){j=M.textures[A];S+=j.url instanceof Array?j.url.length:1}ca=S;for(A in M.textures){j=M.textures[A];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)q=ImageUtils.loadTextureCube(j.url,j.mapping,f);else{q=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.minFilter]!=undefined)q.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)q.magFilter=
-THREE[j.magFilter]}K.textures[A]=q}for(m in M.materials){A=M.materials[m];for(F in A.parameters)if(F=="envMap"||F=="map"||F=="lightMap")A.parameters[F]=K.textures[A.parameters[F]];else if(F=="shading")A.parameters[F]=A.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")A.parameters[F]=THREE[A.parameters[F]]?THREE[A.parameters[F]]:THREE.NormalBlending;else F=="combine"&&(A.parameters[F]=A.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);
-K.materials[m]=A}g();b(K)}},addMesh:function(a,b,c,d,f,g,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,null,!0),c);a.addObject(b);
+var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.matrixAutoUpdate&&b.updateMatrix();for(var o=0,z=h.length;o<z;o++){var q=new THREE.Vertex(h[o].position.clone());c&&b.matrix.multiplyVector3(q.position);g.push(q)}o=0;for(z=j.length;o<z;o++){h=j[o];var t,B=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
+d,h.b+d,h.c+d,h.d+d));t.centroid.copy(h.centroid);t.normal.copy(h.normal);c=0;for(g=B.length;c<g;c++){q=B[c];t.vertexNormals.push(q.clone())}t.materials=h.materials.slice();k.push(t)}o=0;for(z=f.length;o<z;o++){d=f[o];k=[];c=0;for(g=d.length;c<g;c++)k.push(new THREE.UV(d[c].u,d[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],g=new THREE.Texture(f,
+b);b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;c&&c(this)};f[b].src=a[b]}return g}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(o in L.objects)if(!J.objects[o]){C=L.objects[o];if(u=J.geometries[C.geometry]){e=[];for(i=0;i<C.materials.length;i++)e[i]=J.materials[C.materials[i]];F=C.position;r=C.rotation;s=C.scale;object=new THREE.Mesh(u,e);object.position.set(F[0],
+F[1],F[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=C.visible;J.scene.addObject(object);J.objects[o]=object}}}function h(Y){return function(oa){J.geometries[Y]=oa;g();V-=1;k()}}function k(){d({total_models:aa,total_textures:ca,loaded_models:aa-V,loaded_textures:ca-R},J);V==0&&R==0&&c(J)}var j,m,o,z,q,t,B,C,F,w,H,u,I,N,e,L,M,V,R,aa,ca,J;L=f.data;M=new THREE.Loader;R=V=0;J={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
+lights:{},fogs:{}};f=function(){R-=1;k()};for(q in L.cameras){w=L.cameras[q];if(w.type=="perspective")I=new THREE.Camera(w.fov,w.aspect,w.near,w.far);else if(w.type=="ortho"){I=new THREE.Camera;I.projectionMatrix=THREE.Matrix4.makeOrtho(w.left,w.right,w.top,w.bottom,w.near,w.far)}F=w.position;w=w.target;I.position.set(F[0],F[1],F[2]);I.target.position.set(w[0],w[1],w[2]);J.cameras[q]=I}for(z in L.lights){q=L.lights[z];if(q.type=="directional"){F=q.direction;light=new THREE.DirectionalLight;light.position.set(F[0],
+F[1],F[2]);light.position.normalize()}else if(q.type=="point"){F=q.position;light=new THREE.PointLight;light.position.set(F[0],F[1],F[2])}w=q.color;i=q.intensity||1;light.color.setRGB(w[0]*i,w[1]*i,w[2]*i);J.scene.addLight(light);J.lights[z]=light}for(t in L.fogs){z=L.fogs[t];if(z.type=="linear")N=new THREE.Fog(0,z.near,z.far);else z.type=="exp2"&&(N=new THREE.FogExp2(0,z.density));w=z.color;N.color.setRGB(w[0],w[1],w[2]);J.fogs[t]=N}if(J.cameras&&L.defaults.camera)J.currentCamera=J.cameras[L.defaults.camera];
+if(J.fogs&&L.defaults.fog)J.scene.fog=J.fogs[L.defaults.fog];w=L.defaults.bgcolor;J.bgColor=new THREE.Color;J.bgColor.setRGB(w[0],w[1],w[2]);J.bgColorAlpha=L.defaults.bgalpha;for(j in L.geometries){t=L.geometries[j];if(t.type=="bin_mesh"||t.type=="ascii_mesh")V+=1}aa=V;for(j in L.geometries){t=L.geometries[j];if(t.type=="cube"){u=new Cube(t.width,t.height,t.depth,t.segmentsWidth,t.segmentsHeight,null,t.flipped,t.sides);J.geometries[j]=u}else if(t.type=="plane"){u=new Plane(t.width,t.height,t.segmentsWidth,
+t.segmentsHeight);J.geometries[j]=u}else if(t.type=="sphere"){u=new Sphere(t.radius,t.segmentsWidth,t.segmentsHeight);J.geometries[j]=u}else if(t.type=="cylinder"){u=new Cylinder(t.numSegs,t.topRad,t.botRad,t.height,t.topOffset,t.botOffset);J.geometries[j]=u}else if(t.type=="torus"){u=new Torus(t.radius,t.tube,t.segmentsR,t.segmentsT);J.geometries[j]=u}else if(t.type=="icosahedron"){u=new Icosahedron(t.subdivisions);J.geometries[j]=u}else if(t.type=="bin_mesh")M.loadBinary({model:t.url,callback:h(j)});
+else t.type=="ascii_mesh"&&M.loadAscii({model:t.url,callback:h(j)})}for(B in L.textures){j=L.textures[B];R+=j.url instanceof Array?j.url.length:1}ca=R;for(B in L.textures){j=L.textures[B];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array)t=ImageUtils.loadTextureCube(j.url,j.mapping,f);else{t=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.minFilter]!=undefined)t.minFilter=THREE[j.minFilter];if(THREE[j.magFilter]!=undefined)t.magFilter=
+THREE[j.magFilter]}J.textures[B]=t}for(m in L.materials){B=L.materials[m];for(H in B.parameters)if(H=="envMap"||H=="map"||H=="lightMap")B.parameters[H]=J.textures[B.parameters[H]];else if(H=="shading")B.parameters[H]=B.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")B.parameters[H]=THREE[B.parameters[H]]?THREE[B.parameters[H]]:THREE.NormalBlending;else H=="combine"&&(B.parameters[H]=B.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);B=new THREE[B.type](B.parameters);
+J.materials[m]=B}g();b(J)}},addMesh:function(a,b,c,d,f,g,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,null,!0),c);a.addObject(b);
 return b},addPanoramaCube:function(a,b,c){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,b,b,1,1,d,!0),new THREE.MeshFaceMaterial);
 return b},addPanoramaCube:function(a,b,c){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,b,b,1,1,d,!0),new THREE.MeshFaceMaterial);
 a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var d=b/2;b=new Plane(b,b);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,d,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
 a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var d=b/2;b=new Plane(b,b);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,d,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
 SceneUtils.addMesh(a,b,1,0,-d,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 SceneUtils.addMesh(a,b,1,0,-d,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
@@ -295,39 +296,39 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,k){function j(C,E,w,F,u,H,P,e){var M,N,W=d||1,S=f||1,aa=W+1,ca=S+1,K=u/2,Y=H/2;u/=W;var oa=H/S,ba=m.vertices.length;if(C=="x"&&E=="y"||C=="y"&&E=="x")M="z";else if(C=="x"&&E=="z"||C=="z"&&E=="x")M="y";
-else if(C=="z"&&E=="y"||C=="y"&&E=="z")M="x";for(N=0;N<ca;N++)for(H=0;H<aa;H++){var la=new THREE.Vector3;la[C]=(H*u-K)*w;la[E]=(N*oa-Y)*F;la[M]=P;m.vertices.push(new THREE.Vertex(la))}for(N=0;N<S;N++)for(H=0;H<W;H++){m.faces.push(new THREE.Face4(H+aa*N+ba,H+aa*(N+1)+ba,H+1+aa*(N+1)+ba,H+1+aa*N+ba,null,e));m.uvs.push([new THREE.UV(H/W,N/S),new THREE.UV(H/W,(N+1)/S),new THREE.UV((H+1)/W,(N+1)/S),new THREE.UV((H+1)/W,N/S)])}}THREE.Geometry.call(this);var m=this,o=a/2,y=b/2,p=c/2;h=h?-1:1;if(g!==undefined)if(g instanceof
-Array)this.materials=g;else{this.materials=[];for(var q=0;q<6;q++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var A in k)this.sides[A]!=undefined&&(this.sides[A]=k[A]);this.sides.px&&j("z","y",1*h,-1,c,b,-o,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,c,b,o,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,c,y,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,c,-y,this.materials[3]);this.sides.pz&&j("x","y",1*h,-1,
-a,b,p,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,b,-p,this.materials[5]);(function(){for(var C=[],E=[],w=0,F=m.vertices.length;w<F;w++){for(var u=m.vertices[w],H=!1,P=0,e=C.length;P<e;P++){var M=C[P];if(u.position.x==M.position.x&&u.position.y==M.position.y&&u.position.z==M.position.z){E[w]=P;H=!0;break}}if(!H){E[w]=C.length;C.push(new THREE.Vertex(u.position.clone()))}}w=0;for(F=m.faces.length;w<F;w++){u=m.faces[w];u.a=E[u.a];u.b=E[u.b];u.c=E[u.c];u.d=E[u.d]}m.vertices=C})();this.computeCentroids();
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,k){function j(C,F,w,H,u,I,N,e){var L,M,V=d||1,R=f||1,aa=V+1,ca=R+1,J=u/2,Y=I/2;u/=V;var oa=I/R,ba=m.vertices.length;if(C=="x"&&F=="y"||C=="y"&&F=="x")L="z";else if(C=="x"&&F=="z"||C=="z"&&F=="x")L="y";
+else if(C=="z"&&F=="y"||C=="y"&&F=="z")L="x";for(M=0;M<ca;M++)for(I=0;I<aa;I++){var la=new THREE.Vector3;la[C]=(I*u-J)*w;la[F]=(M*oa-Y)*H;la[L]=N;m.vertices.push(new THREE.Vertex(la))}for(M=0;M<R;M++)for(I=0;I<V;I++){m.faces.push(new THREE.Face4(I+aa*M+ba,I+aa*(M+1)+ba,I+1+aa*(M+1)+ba,I+1+aa*M+ba,null,e));m.uvs.push([new THREE.UV(I/V,M/R),new THREE.UV(I/V,(M+1)/R),new THREE.UV((I+1)/V,(M+1)/R),new THREE.UV((I+1)/V,M/R)])}}THREE.Geometry.call(this);var m=this,o=a/2,z=b/2,q=c/2;h=h?-1:1;if(g!==undefined)if(g instanceof
+Array)this.materials=g;else{this.materials=[];for(var t=0;t<6;t++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var B in k)this.sides[B]!=undefined&&(this.sides[B]=k[B]);this.sides.px&&j("z","y",1*h,-1,c,b,-o,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,c,b,o,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,c,z,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,c,-z,this.materials[3]);this.sides.pz&&j("x","y",1*h,-1,
+a,b,q,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,b,-q,this.materials[5]);(function(){for(var C=[],F=[],w=0,H=m.vertices.length;w<H;w++){for(var u=m.vertices[w],I=!1,N=0,e=C.length;N<e;N++){var L=C[N];if(u.position.x==L.position.x&&u.position.y==L.position.y&&u.position.z==L.position.z){F[w]=N;I=!0;break}}if(!I){F[w]=C.length;C.push(new THREE.Vertex(u.position.clone()))}}w=0;for(H=m.faces.length;w<H;w++){u=m.faces[w];u.a=F[u.a];u.b=F[u.b];u.c=F[u.c];u.d=F[u.d]}m.vertices=C})();this.computeCentroids();
 this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
 this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,b,c,d,f){function g(m,o,y){h.vertices.push(new THREE.Vertex(new THREE.Vector3(m,o,y)))}THREE.Geometry.call(this);var h=this,k=Math.PI,j;for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*b,Math.cos(2*k*j/a)*b,0);for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*c,Math.cos(2*k*j/a)*c,d);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(c!=0){g(0,0,-f);for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b!=0){g(0,0,d+f);for(j=a+a/2;j<
+var Cylinder=function(a,b,c,d,f){function g(m,o,z){h.vertices.push(new THREE.Vertex(new THREE.Vector3(m,o,z)))}THREE.Geometry.call(this);var h=this,k=Math.PI,j;for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*b,Math.cos(2*k*j/a)*b,0);for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*c,Math.cos(2*k*j/a)*c,d);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(c!=0){g(0,0,-f);for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b!=0){g(0,0,d+f);for(j=a+a/2;j<
 2*a;j++)h.faces.push(new THREE.Face4((2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
 2*a;j++)h.faces.push(new THREE.Face4((2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
 var Plane=function(a,b,c,d){THREE.Geometry.call(this);var f,g=a/2,h=b/2;c=c||1;d=d||1;var k=c+1,j=d+1;a/=c;var m=b/d;for(f=0;f<j;f++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*m-h),0)));for(f=0;f<d;f++)for(b=0;b<c;b++){this.faces.push(new THREE.Face4(b+k*f,b+k*(f+1),b+1+k*(f+1),b+1+k*f));this.uvs.push([new THREE.UV(b/c,f/d),new THREE.UV(b/c,(f+1)/d),new THREE.UV((b+1)/c,(f+1)/d),new THREE.UV((b+1)/c,f/d)])}this.computeCentroids();this.computeFaceNormals()};
 var Plane=function(a,b,c,d){THREE.Geometry.call(this);var f,g=a/2,h=b/2;c=c||1;d=d||1;var k=c+1,j=d+1;a/=c;var m=b/d;for(f=0;f<j;f++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*m-h),0)));for(f=0;f<d;f++)for(b=0;b<c;b++){this.faces.push(new THREE.Face4(b+k*f,b+k*(f+1),b+1+k*(f+1),b+1+k*f));this.uvs.push([new THREE.UV(b/c,f/d),new THREE.UV(b/c,(f+1)/d),new THREE.UV((b+1)/c,(f+1)/d),new THREE.UV((b+1)/c,f/d)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(a,b,c){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c<h+1;c++){d=c/h;var k=a*Math.cos(d*f),j=a*Math.sin(d*f),m=[],o=0;for(d=0;d<g;d++){var y=2*d/g,p=j*Math.sin(y*f);y=j*Math.cos(y*f);(c==0||c==h)&&d>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(y,k,p)))-1);m.push(o)}b.push(m)}var q,A,C;f=b.length;for(c=0;c<f;c++){g=b[c].length;if(c>0)for(d=0;d<g;d++){m=d==g-1;h=b[c][m?0:d+1];k=b[c][m?g-1:d];j=b[c-1][m?g-1:d];m=b[c-1][m?
-0:d+1];p=c/(f-1);q=(c-1)/(f-1);A=(d+1)/g;y=d/g;o=new THREE.UV(1-A,p);p=new THREE.UV(1-y,p);y=new THREE.UV(1-y,q);var E=new THREE.UV(1-A,q);if(c<b.length-1){q=this.vertices[h].position.clone();A=this.vertices[k].position.clone();C=this.vertices[j].position.clone();q.normalize();A.normalize();C.normalize();this.faces.push(new THREE.Face3(h,k,j,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(C.x,C.y,C.z)]));this.uvs.push([o,p,y])}if(c>1){q=this.vertices[h].position.clone();
-A=this.vertices[j].position.clone();C=this.vertices[m].position.clone();q.normalize();A.normalize();C.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(C.x,C.y,C.z)]));this.uvs.push([o,y,E])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Sphere=function(a,b,c){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c<h+1;c++){d=c/h;var k=a*Math.cos(d*f),j=a*Math.sin(d*f),m=[],o=0;for(d=0;d<g;d++){var z=2*d/g,q=j*Math.sin(z*f);z=j*Math.cos(z*f);(c==0||c==h)&&d>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(z,k,q)))-1);m.push(o)}b.push(m)}var t,B,C;f=b.length;for(c=0;c<f;c++){g=b[c].length;if(c>0)for(d=0;d<g;d++){m=d==g-1;h=b[c][m?0:d+1];k=b[c][m?g-1:d];j=b[c-1][m?g-1:d];m=b[c-1][m?
+0:d+1];q=c/(f-1);t=(c-1)/(f-1);B=(d+1)/g;z=d/g;o=new THREE.UV(1-B,q);q=new THREE.UV(1-z,q);z=new THREE.UV(1-z,t);var F=new THREE.UV(1-B,t);if(c<b.length-1){t=this.vertices[h].position.clone();B=this.vertices[k].position.clone();C=this.vertices[j].position.clone();t.normalize();B.normalize();C.normalize();this.faces.push(new THREE.Face3(h,k,j,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(C.x,C.y,C.z)]));this.uvs.push([o,q,z])}if(c>1){t=this.vertices[h].position.clone();
+B=this.vertices[j].position.clone();C=this.vertices[m].position.clone();t.normalize();B.normalize();C.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(C.x,C.y,C.z)]));this.uvs.push([o,z,F])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
 var Torus=function(a,b,c,d){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){d=c/this.segmentsT*2*Math.PI;var f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
 var Torus=function(a,b,c,d){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){d=c/this.segmentsT*2*Math.PI;var f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
 1;c<=this.segmentsT;++c){d=(this.segmentsT+1)*b+c;f=(this.segmentsT+1)*b+c-1;var g=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(d,f,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
 1;c<=this.segmentsT;++c){d=(this.segmentsT+1)*b+c;f=(this.segmentsT+1)*b+c-1;var g=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(d,f,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var Icosahedron=function(a){function b(y,p,q){var A=Math.sqrt(y*y+p*p+q*q);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(y/A,p/A,q/A)))-1}function c(y,p,q,A){A.faces.push(new THREE.Face3(y,p,q))}function d(y,p){var q=f.vertices[y].position,A=f.vertices[p].position;return b((q.x+A.x)/2,(q.y+A.y)/2,(q.z+A.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
+var Icosahedron=function(a){function b(z,q,t){var B=Math.sqrt(z*z+q*q+t*t);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(z/B,q/B,t/B)))-1}function c(z,q,t,B){B.faces.push(new THREE.Face3(z,q,t))}function d(z,q){var t=f.vertices[z].position,B=f.vertices[q].position;return b((t.x+B.x)/2,(t.y+B.y)/2,(t.z+B.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
 1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var j=d(g.faces[k].a,g.faces[k].b),m=d(g.faces[k].b,g.faces[k].c),o=d(g.faces[k].c,g.faces[k].a);c(g.faces[k].a,j,o,h);c(g.faces[k].b,m,j,h);c(g.faces[k].c,
 1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var j=d(g.faces[k].a,g.faces[k].b),m=d(g.faces[k].b,g.faces[k].c),o=d(g.faces[k].c,g.faces[k].a);c(g.faces[k].a,j,o,h);c(g.faces[k].b,m,j,h);c(g.faces[k].c,
 o,m,h);c(j,m,o,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
 o,m,h);c(j,m,o,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function LathedObject(a,b,c){THREE.Geometry.call(this);this.nsteps=b||12;this.latheAngle=c||2*Math.PI;b=this.latheAngle/this.nsteps;for(var d=[],f=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));f[k]=this.vertices.length-1;d[k]=new THREE.Vector3(a[k].x,a[k].y,a[k].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.001;m+=this.stepSize){for(k=0;k<d.length;k++)if(m<c){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));
+function LathedObject(a,b,c){THREE.Geometry.call(this);this.nsteps=b||12;this.latheAngle=c||2*Math.PI;b=this.latheAngle/this.nsteps;for(var d=[],f=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));f[k]=this.vertices.length-1;d[k]=new THREE.Vector3(a[k].x,a[k].y,a[k].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),m=0;m<=this.latheAngle+0.0010;m+=this.stepSize){for(k=0;k<d.length;k++)if(m<c){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));
 g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.uvs.push([new THREE.UV(m/c,k/a.length),new THREE.UV(m/c,(k+1)/a.length),new THREE.UV((m-b)/c,(k+1)/a.length),new THREE.UV((m-b)/c,k/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
 g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.uvs.push([new THREE.UV(m/c,k/a.length),new THREE.UV(m/c,(k+1)/a.length),new THREE.UV((m-b)/c,(k+1)/a.length),new THREE.UV((m-b)/c,k/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
 if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(c){this.isolation=80;this.size=c;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(c){this.isolation=80;this.size=c;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,d,f){return c+(d-c)*f};this.VIntX=function(c,d,f,g,h,k,j,m,o,y){h=(h-o)/(y-o);o=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=j;d[g+2]=m;f[g]=this.lerp(o[c],o[c+3],h);f[g+1]=this.lerp(o[c+1],o[c+4],h);f[g+2]=this.lerp(o[c+2],o[c+5],h)};this.VIntY=function(c,d,f,g,h,k,j,m,o,y){h=(h-o)/(y-o);o=this.normal_cache;d[g]=k;d[g+1]=j+h*this.delta;d[g+
-2]=m;d=c+this.yd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.VIntZ=function(c,d,f,g,h,k,j,m,o,y){h=(h-o)/(y-o);o=this.normal_cache;d[g]=k;d[g+1]=j;d[g+2]=m+h*this.delta;d=c+this.zd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.compNorm=function(c){var d=c*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[c-1]-this.field[c+1];this.normal_cache[d+1]=this.field[c-this.yd]-
-this.field[c+this.yd];this.normal_cache[d+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,d,f,g,h,k){var j=g+1,m=g+this.yd,o=g+this.zd,y=j+this.yd,p=j+this.zd,q=g+this.yd+this.zd,A=j+this.yd+this.zd,C=0,E=this.field[g],w=this.field[j],F=this.field[m],u=this.field[y],H=this.field[o],P=this.field[p],e=this.field[q],M=this.field[A];E<h&&(C|=1);w<h&&(C|=2);F<h&&(C|=8);u<h&&(C|=4);H<h&&(C|=16);P<h&&(C|=32);e<h&&(C|=128);M<h&&(C|=64);var N=THREE.edgeTable[C];if(N==0)return 0;
-var W=this.delta,S=c+W,aa=d+W;W=f+W;if(N&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,c,d,f,E,w)}if(N&2){this.compNorm(j);this.compNorm(y);this.VIntY(j*3,this.vlist,this.nlist,3,h,S,d,f,w,u)}if(N&4){this.compNorm(m);this.compNorm(y);this.VIntX(m*3,this.vlist,this.nlist,6,h,c,aa,f,F,u)}if(N&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,c,d,f,E,F)}if(N&16){this.compNorm(o);this.compNorm(p);this.VIntX(o*3,this.vlist,this.nlist,12,h,c,d,
-W,H,P)}if(N&32){this.compNorm(p);this.compNorm(A);this.VIntY(p*3,this.vlist,this.nlist,15,h,S,d,W,P,M)}if(N&64){this.compNorm(q);this.compNorm(A);this.VIntX(q*3,this.vlist,this.nlist,18,h,c,aa,W,e,M)}if(N&128){this.compNorm(o);this.compNorm(q);this.VIntY(o*3,this.vlist,this.nlist,21,h,c,d,W,H,e)}if(N&256){this.compNorm(g);this.compNorm(o);this.VIntZ(g*3,this.vlist,this.nlist,24,h,c,d,f,E,H)}if(N&512){this.compNorm(j);this.compNorm(p);this.VIntZ(j*3,this.vlist,this.nlist,27,h,S,d,f,w,P)}if(N&1024){this.compNorm(y);
-this.compNorm(A);this.VIntZ(y*3,this.vlist,this.nlist,30,h,S,aa,f,u,M)}if(N&2048){this.compNorm(m);this.compNorm(q);this.VIntZ(m*3,this.vlist,this.nlist,33,h,c,aa,f,F,e)}C<<=4;for(h=g=0;THREE.triTable[C+h]!=-1;){c=C+h;d=c+1;f=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[d],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(c,d,f,g,h,k){var j=this.count*3;this.positionArray[j]=c[f];this.positionArray[j+1]=c[f+1];this.positionArray[j+2]=c[f+2];this.positionArray[j+
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,d,f){return c+(d-c)*f};this.VIntX=function(c,d,f,g,h,k,j,m,o,z){h=(h-o)/(z-o);o=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=j;d[g+2]=m;f[g]=this.lerp(o[c],o[c+3],h);f[g+1]=this.lerp(o[c+1],o[c+4],h);f[g+2]=this.lerp(o[c+2],o[c+5],h)};this.VIntY=function(c,d,f,g,h,k,j,m,o,z){h=(h-o)/(z-o);o=this.normal_cache;d[g]=k;d[g+1]=j+h*this.delta;d[g+
+2]=m;d=c+this.yd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.VIntZ=function(c,d,f,g,h,k,j,m,o,z){h=(h-o)/(z-o);o=this.normal_cache;d[g]=k;d[g+1]=j;d[g+2]=m+h*this.delta;d=c+this.zd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.compNorm=function(c){var d=c*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[c-1]-this.field[c+1];this.normal_cache[d+1]=this.field[c-this.yd]-
+this.field[c+this.yd];this.normal_cache[d+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,d,f,g,h,k){var j=g+1,m=g+this.yd,o=g+this.zd,z=j+this.yd,q=j+this.zd,t=g+this.yd+this.zd,B=j+this.yd+this.zd,C=0,F=this.field[g],w=this.field[j],H=this.field[m],u=this.field[z],I=this.field[o],N=this.field[q],e=this.field[t],L=this.field[B];F<h&&(C|=1);w<h&&(C|=2);H<h&&(C|=8);u<h&&(C|=4);I<h&&(C|=16);N<h&&(C|=32);e<h&&(C|=128);L<h&&(C|=64);var M=THREE.edgeTable[C];if(M==0)return 0;
+var V=this.delta,R=c+V,aa=d+V;V=f+V;if(M&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,c,d,f,F,w)}if(M&2){this.compNorm(j);this.compNorm(z);this.VIntY(j*3,this.vlist,this.nlist,3,h,R,d,f,w,u)}if(M&4){this.compNorm(m);this.compNorm(z);this.VIntX(m*3,this.vlist,this.nlist,6,h,c,aa,f,H,u)}if(M&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,c,d,f,F,H)}if(M&16){this.compNorm(o);this.compNorm(q);this.VIntX(o*3,this.vlist,this.nlist,12,h,c,d,
+V,I,N)}if(M&32){this.compNorm(q);this.compNorm(B);this.VIntY(q*3,this.vlist,this.nlist,15,h,R,d,V,N,L)}if(M&64){this.compNorm(t);this.compNorm(B);this.VIntX(t*3,this.vlist,this.nlist,18,h,c,aa,V,e,L)}if(M&128){this.compNorm(o);this.compNorm(t);this.VIntY(o*3,this.vlist,this.nlist,21,h,c,d,V,I,e)}if(M&256){this.compNorm(g);this.compNorm(o);this.VIntZ(g*3,this.vlist,this.nlist,24,h,c,d,f,F,I)}if(M&512){this.compNorm(j);this.compNorm(q);this.VIntZ(j*3,this.vlist,this.nlist,27,h,R,d,f,w,N)}if(M&1024){this.compNorm(z);
+this.compNorm(B);this.VIntZ(z*3,this.vlist,this.nlist,30,h,R,aa,f,u,L)}if(M&2048){this.compNorm(m);this.compNorm(t);this.VIntZ(m*3,this.vlist,this.nlist,33,h,c,aa,f,H,e)}C<<=4;for(h=g=0;THREE.triTable[C+h]!=-1;){c=C+h;d=c+1;f=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[d],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(c,d,f,g,h,k){var j=this.count*3;this.positionArray[j]=c[f];this.positionArray[j+1]=c[f+1];this.positionArray[j+2]=c[f+2];this.positionArray[j+
 3]=c[g];this.positionArray[j+4]=c[g+1];this.positionArray[j+5]=c[g+2];this.positionArray[j+6]=c[h];this.positionArray[j+7]=c[h+1];this.positionArray[j+8]=c[h+2];this.normalArray[j]=d[f];this.normalArray[j+1]=d[f+1];this.normalArray[j+2]=d[f+2];this.normalArray[j+3]=d[g];this.normalArray[j+4]=d[g+1];this.normalArray[j+5]=d[g+2];this.normalArray[j+6]=d[h];this.normalArray[j+7]=d[h+1];this.normalArray[j+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
 3]=c[g];this.positionArray[j+4]=c[g+1];this.positionArray[j+5]=c[g+2];this.positionArray[j+6]=c[h];this.positionArray[j+7]=c[h+1];this.positionArray[j+8]=c[h+2];this.normalArray[j]=d[f];this.normalArray[j+1]=d[f+1];this.normalArray[j+2]=d[f+2];this.normalArray[j+3]=d[g];this.normalArray[j+4]=d[g+1];this.normalArray[j+5]=d[g+2];this.normalArray[j+6]=d[h];this.normalArray[j+7]=d[h+1];this.normalArray[j+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
-function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;c(this)}};this.addBall=function(c,d,f,g,h){var k=this.size*Math.sqrt(g/h),j=f*this.size,m=d*this.size,o=c*this.size,y=Math.floor(j-k);y<1&&(y=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var p=Math.floor(m-k);p<1&&(p=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var q=Math.floor(o-k);q<1&&(q=1);k=Math.floor(o+k);
-k>this.size-1&&(k=this.size-1);for(var A,C,E,w,F,u;y<j;y++){o=this.size2*y;C=y/this.size-f;F=C*C;for(C=p;C<m;C++){E=o+this.size*C;A=C/this.size-d;u=A*A;for(A=q;A<k;A++){w=A/this.size-c;w=g/(1.0E-6+w*w+u+F)-h;w>0&&(this.field[E+A]+=w)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,o=this.yd,y=this.zd,p=this.field,q=m*Math.sqrt(c/d);q>m&&(q=m);for(f=0;f<q;f++){g=f/m;g*=g;k=c/(1.0E-4+g)-d;if(k>0)for(g=0;g<m;g++){j=f+g*o;for(h=0;h<m;h++)p[y*h+j]+=k}}};this.addPlaneY=function(c,d){var f,g,
-h,k,j,m,o=this.size,y=this.yd,p=this.zd,q=this.field,A=o*Math.sqrt(c/d);A>o&&(A=o);for(g=0;g<A;g++){f=g/o;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=g*y;for(f=0;f<o;f++){m=j+f;for(h=0;h<o;h++)q[p*h+m]+=k}}}};this.addPlaneZ=function(c,d){var f,g,h,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=zd*h;for(g=0;g<size;g++){m=j+g*yd;for(f=0;f<size;f++)field[m+f]+=k}}}};this.reset=function(){var c;
-for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var d,f,g,h,k,j,m,o,y,p=this.size-2;for(h=1;h<p;h++){y=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<p;g++){o=y+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<p;f++){k=(f-this.halfsize)/this.halfsize;d=o+f;this.polygonize(k,j,m,d,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,d=new THREE.Geometry;this.render(function(f){var g,h,k,j,m,o,y,p;for(g=
-0;g<f.count;g++){m=g*3;y=m+1;p=m+2;h=f.positionArray[m];k=f.positionArray[y];j=f.positionArray[p];o=new THREE.Vector3(h,k,j);h=f.normalArray[m];k=f.normalArray[y];j=f.normalArray[p];m=new THREE.Vector3(h,k,j);m.normalize();m=new THREE.Vertex(o,m);d.vertices.push(m)}nfaces=f.count/3;for(g=0;g<nfaces;g++){m=(c+g)*3;y=m+1;p=m+2;o=d.vertices[m].normal;h=d.vertices[y].normal;k=d.vertices[p].normal;m=new THREE.Face3(m,y,p,[o,h,k]);d.faces.push(m)}c+=nfaces;f.count=0});return d};this.init(a)};
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;c(this)}};this.addBall=function(c,d,f,g,h){var k=this.size*Math.sqrt(g/h),j=f*this.size,m=d*this.size,o=c*this.size,z=Math.floor(j-k);z<1&&(z=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var q=Math.floor(m-k);q<1&&(q=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(o-k);t<1&&(t=1);k=Math.floor(o+k);
+k>this.size-1&&(k=this.size-1);for(var B,C,F,w,H,u;z<j;z++){o=this.size2*z;C=z/this.size-f;H=C*C;for(C=q;C<m;C++){F=o+this.size*C;B=C/this.size-d;u=B*B;for(B=t;B<k;B++){w=B/this.size-c;w=g/(1.0E-6+w*w+u+H)-h;w>0&&(this.field[F+B]+=w)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,o=this.yd,z=this.zd,q=this.field,t=m*Math.sqrt(c/d);t>m&&(t=m);for(f=0;f<t;f++){g=f/m;g*=g;k=c/(1.0E-4+g)-d;if(k>0)for(g=0;g<m;g++){j=f+g*o;for(h=0;h<m;h++)q[z*h+j]+=k}}};this.addPlaneY=function(c,d){var f,g,
+h,k,j,m,o=this.size,z=this.yd,q=this.zd,t=this.field,B=o*Math.sqrt(c/d);B>o&&(B=o);for(g=0;g<B;g++){f=g/o;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=g*z;for(f=0;f<o;f++){m=j+f;for(h=0;h<o;h++)t[q*h+m]+=k}}}};this.addPlaneZ=function(c,d){var f,g,h,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=zd*h;for(g=0;g<size;g++){m=j+g*yd;for(f=0;f<size;f++)field[m+f]+=k}}}};this.reset=function(){var c;
+for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var d,f,g,h,k,j,m,o,z,q=this.size-2;for(h=1;h<q;h++){z=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<q;g++){o=z+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<q;f++){k=(f-this.halfsize)/this.halfsize;d=o+f;this.polygonize(k,j,m,d,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,d=new THREE.Geometry;this.render(function(f){var g,h,k,j,m,o,z,q;for(g=
+0;g<f.count;g++){m=g*3;z=m+1;q=m+2;h=f.positionArray[m];k=f.positionArray[z];j=f.positionArray[q];o=new THREE.Vector3(h,k,j);h=f.normalArray[m];k=f.normalArray[z];j=f.normalArray[q];m=new THREE.Vector3(h,k,j);m.normalize();m=new THREE.Vertex(o,m);d.vertices.push(m)}nfaces=f.count/3;for(g=0;g<nfaces;g++){m=(c+g)*3;z=m+1;q=m+2;o=d.vertices[m].normal;h=d.vertices[z].normal;k=d.vertices[q].normal;m=new THREE.Face3(m,z,q,[o,h,k]);d.faces.push(m)}c+=nfaces;f.count=0});return d};this.init(a)};
 THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
@@ -357,24 +358,24 @@ THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement
 b},loadAsciiOld:function(a,b){var c=document.createElement("script");c.type="text/javascript";c.onload=b;c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},loadAscii:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);b.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,c,d)};b.postMessage(a)},loadBinary:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:
 b},loadAsciiOld:function(a,b){var c=document.createElement("script");c.type="text/javascript";c.onload=b;c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},loadAscii:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);b.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,c,d)};b.postMessage(a)},loadBinary:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:
 THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,c,f,d,g)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,c,d,f,g){var h=new XMLHttpRequest,k=d+"/"+a,j=0;
 THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,c,f,d,g)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,c,d,f,g){var h=new XMLHttpRequest,k=d+"/"+a,j=0;
 h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,c,f,b):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){j==0&&(j=h.getResponseHeader("Content-Length"));g({total:j,loaded:h.responseText.length})}}else h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
 h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,c,f,b):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){j==0&&(j=h.getResponseHeader("Content-Length"));g({total:j,loaded:h.responseText.length})}}else h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
-createBinModel:function(a,b,c,d){var f=function(g){function h(z,D){var I=o(z,D),T=o(z,D+1),U=o(z,D+2),ea=o(z,D+3),da=(ea<<1&255|U>>7)-127;I|=(U&127)<<16|T<<8;if(I==0&&da==-127)return 0;return(1-2*(ea>>7))*(1+I*Math.pow(2,-23))*Math.pow(2,da)}function k(z,D){var I=o(z,D),T=o(z,D+1),U=o(z,D+2);return(o(z,D+3)<<24)+(U<<16)+(T<<8)+I}function j(z,D){var I=o(z,D);return(o(z,D+1)<<8)+I}function m(z,D){var I=o(z,D);return I>127?I-256:I}function o(z,D){return z.charCodeAt(D)&255}function y(z){var D,I,T;D=
-k(a,z);I=k(a,z+e);T=k(a,z+M);z=j(a,z+N);THREE.Loader.prototype.f3(w,D,I,T,z)}function p(z){var D,I,T,U,ea,da;D=k(a,z);I=k(a,z+e);T=k(a,z+M);U=j(a,z+N);ea=k(a,z+W);da=k(a,z+S);z=k(a,z+aa);THREE.Loader.prototype.f3n(w,H,D,I,T,U,ea,da,z)}function q(z){var D,I,T,U;D=k(a,z);I=k(a,z+ca);T=k(a,z+K);U=k(a,z+Y);z=j(a,z+oa);THREE.Loader.prototype.f4(w,D,I,T,U,z)}function A(z){var D,I,T,U,ea,da,xa,R;D=k(a,z);I=k(a,z+ca);T=k(a,z+K);U=k(a,z+Y);ea=j(a,z+oa);da=k(a,z+ba);xa=k(a,z+la);R=k(a,z+ia);z=k(a,z+ga);THREE.Loader.prototype.f4n(w,
-H,D,I,T,U,ea,da,xa,R,z)}function C(z){var D,I;D=k(a,z);I=k(a,z+qa);z=k(a,z+ua);THREE.Loader.prototype.uv3(w.uvs,P[D*2],P[D*2+1],P[I*2],P[I*2+1],P[z*2],P[z*2+1])}function E(z){var D,I,T;D=k(a,z);I=k(a,z+l);T=k(a,z+x);z=k(a,z+v);THREE.Loader.prototype.uv4(w.uvs,P[D*2],P[D*2+1],P[I*2],P[I*2+1],P[T*2],P[T*2+1],P[z*2],P[z*2+1])}var w=this,F=0,u,H=[],P=[],e,M,N,W,S,aa,ca,K,Y,oa,ba,la,ia,ga,qa,ua,l,x,v,n,t,B,J,Q,G;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,d,g);u={signature:a.substr(F,
-8),header_bytes:o(a,F+8),vertex_coordinate_bytes:o(a,F+9),normal_coordinate_bytes:o(a,F+10),uv_coordinate_bytes:o(a,F+11),vertex_index_bytes:o(a,F+12),normal_index_bytes:o(a,F+13),uv_index_bytes:o(a,F+14),material_index_bytes:o(a,F+15),nvertices:k(a,F+16),nnormals:k(a,F+16+4),nuvs:k(a,F+16+8),ntri_flat:k(a,F+16+12),ntri_smooth:k(a,F+16+16),ntri_flat_uv:k(a,F+16+20),ntri_smooth_uv:k(a,F+16+24),nquad_flat:k(a,F+16+28),nquad_smooth:k(a,F+16+32),nquad_flat_uv:k(a,F+16+36),nquad_smooth_uv:k(a,F+16+40)};
-F+=u.header_bytes;e=u.vertex_index_bytes;M=u.vertex_index_bytes*2;N=u.vertex_index_bytes*3;W=u.vertex_index_bytes*3+u.material_index_bytes;S=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes;aa=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*2;ca=u.vertex_index_bytes;K=u.vertex_index_bytes*2;Y=u.vertex_index_bytes*3;oa=u.vertex_index_bytes*4;ba=u.vertex_index_bytes*4+u.material_index_bytes;la=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes;ia=
-u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*2;ga=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*3;qa=u.uv_index_bytes;ua=u.uv_index_bytes*2;l=u.uv_index_bytes;x=u.uv_index_bytes*2;v=u.uv_index_bytes*3;g=u.vertex_index_bytes*3+u.material_index_bytes;G=u.vertex_index_bytes*4+u.material_index_bytes;n=u.ntri_flat*g;t=u.ntri_smooth*(g+u.normal_index_bytes*3);B=u.ntri_flat_uv*(g+u.uv_index_bytes*3);J=u.ntri_smooth_uv*(g+u.normal_index_bytes*3+u.uv_index_bytes*
-3);Q=u.nquad_flat*G;g=u.nquad_smooth*(G+u.normal_index_bytes*4);G=u.nquad_flat_uv*(G+u.uv_index_bytes*4);F+=function(z){for(var D,I,T,U=u.vertex_coordinate_bytes*3,ea=z+u.nvertices*U;z<ea;z+=U){D=h(a,z);I=h(a,z+u.vertex_coordinate_bytes);T=h(a,z+u.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(w,D,I,T)}return u.nvertices*U}(F);F+=function(z){for(var D,I,T,U=u.normal_coordinate_bytes*3,ea=z+u.nnormals*U;z<ea;z+=U){D=m(a,z);I=m(a,z+u.normal_coordinate_bytes);T=m(a,z+u.normal_coordinate_bytes*2);
-H.push(D/127,I/127,T/127)}return u.nnormals*U}(F);F+=function(z){for(var D,I,T=u.uv_coordinate_bytes*2,U=z+u.nuvs*T;z<U;z+=T){D=h(a,z);I=h(a,z+u.uv_coordinate_bytes);P.push(D,I)}return u.nuvs*T}(F);n=F+n;t=n+t;B=t+B;J=B+J;Q=J+Q;g=Q+g;G=g+G;(function(z){var D,I=u.vertex_index_bytes*3+u.material_index_bytes,T=I+u.uv_index_bytes*3,U=z+u.ntri_flat_uv*T;for(D=z;D<U;D+=T){y(D);C(D+I)}return U-z})(t);(function(z){var D,I=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*3,T=I+u.uv_index_bytes*
-3,U=z+u.ntri_smooth_uv*T;for(D=z;D<U;D+=T){p(D);C(D+I)}return U-z})(B);(function(z){var D,I=u.vertex_index_bytes*4+u.material_index_bytes,T=I+u.uv_index_bytes*4,U=z+u.nquad_flat_uv*T;for(D=z;D<U;D+=T){q(D);E(D+I)}return U-z})(g);(function(z){var D,I=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*4,T=I+u.uv_index_bytes*4,U=z+u.nquad_smooth_uv*T;for(D=z;D<U;D+=T){A(D);E(D+I)}return U-z})(G);(function(z){var D,I=u.vertex_index_bytes*3+u.material_index_bytes,T=z+u.ntri_flat*I;for(D=
-z;D<T;D+=I)y(D);return T-z})(F);(function(z){var D,I=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*3,T=z+u.ntri_smooth*I;for(D=z;D<T;D+=I)p(D);return T-z})(n);(function(z){var D,I=u.vertex_index_bytes*4+u.material_index_bytes,T=z+u.nquad_flat*I;for(D=z;D<T;D+=I)q(D);return T-z})(J);(function(z){var D,I=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*4,T=z+u.nquad_smooth*I;for(D=z;D<T;D+=I)A(D);return T-z})(Q);this.computeCentroids();this.computeFaceNormals()};
-f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},createModel:function(a,b,c){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){var h,k,j,m,o;h=0;for(k=a.vertices.length;h<k;h+=3){j=a.vertices[h];m=a.vertices[h+1];o=a.vertices[h+2];THREE.Loader.prototype.v(g,j,m,o)}if(a.colors){h=0;for(k=a.colors.length;h<k;h+=3){j=a.colors[h];m=a.colors[h+1];o=a.colors[h+2];THREE.Loader.prototype.vc(g,j,m,o)}}})();(function(){function h(A,
-C){THREE.Loader.prototype.f3(g,A[C],A[C+1],A[C+2],A[C+3])}function k(A,C){THREE.Loader.prototype.f3n(g,a.normals,A[C],A[C+1],A[C+2],A[C+3],A[C+4],A[C+5],A[C+6])}function j(A,C){THREE.Loader.prototype.f4(g,A[C],A[C+1],A[C+2],A[C+3],A[C+4])}function m(A,C){THREE.Loader.prototype.f4n(g,a.normals,A[C],A[C+1],A[C+2],A[C+3],A[C+4],A[C+5],A[C+6],A[C+7],A[C+8])}function o(A,C){var E,w,F,u,H,P,e,M,N;E=A[C];w=A[C+1];F=A[C+2];u=a.uvs[E*2];e=a.uvs[E*2+1];H=a.uvs[w*2];M=a.uvs[w*2+1];P=a.uvs[F*2];N=a.uvs[F*2+1];
-THREE.Loader.prototype.uv3(g.uvs,u,e,H,M,P,N);if(a.uvs2&&a.uvs2.length){u=a.uvs2[E*2];e=a.uvs2[E*2+1];H=a.uvs2[w*2];M=a.uvs2[w*2+1];P=a.uvs2[F*2];N=a.uvs2[F*2+1];THREE.Loader.prototype.uv3(g.uvs2,u,1-e,H,1-M,P,1-N)}}function y(A,C){var E,w,F,u,H,P,e,M,N,W,S,aa;E=A[C];w=A[C+1];F=A[C+2];u=A[C+3];H=a.uvs[E*2];N=a.uvs[E*2+1];P=a.uvs[w*2];W=a.uvs[w*2+1];e=a.uvs[F*2];S=a.uvs[F*2+1];M=a.uvs[u*2];aa=a.uvs[u*2+1];THREE.Loader.prototype.uv4(g.uvs,H,N,P,W,e,S,M,aa);if(a.uvs2){H=a.uvs2[E*2];N=a.uvs2[E*2+1];P=
-a.uvs2[w*2];W=a.uvs2[w*2+1];e=a.uvs2[F*2];S=a.uvs2[F*2+1];M=a.uvs2[u*2];aa=a.uvs2[u*2+1];THREE.Loader.prototype.uv4(g.uvs2,H,1-N,P,1-W,e,1-S,M,1-aa)}}var p,q;p=0;for(q=a.trianglesUvs.length;p<q;p+=7){h(a.trianglesUvs,p);o(a.trianglesUvs,p+4)}p=0;for(q=a.trianglesNormalsUvs.length;p<q;p+=10){k(a.trianglesNormalsUvs,p);o(a.trianglesNormalsUvs,p+7)}p=0;for(q=a.quadsUvs.length;p<q;p+=9){j(a.quadsUvs,p);y(a.quadsUvs,p+5)}p=0;for(q=a.quadsNormalsUvs.length;p<q;p+=13){m(a.quadsNormalsUvs,p);y(a.quadsNormalsUvs,
-p+9)}p=0;for(q=a.triangles.length;p<q;p+=4)h(a.triangles,p);p=0;for(q=a.trianglesNormals.length;p<q;p+=7)k(a.trianglesNormals,p);p=0;for(q=a.quads.length;p<q;p+=5)j(a.quads,p);p=0;for(q=a.quadsNormals.length;p<q;p+=9)m(a.quadsNormals,p)})();(function(){var h,k,j,m;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<k;h+=2){j=a.skinWeights[h];m=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,j,m,0,0)}}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<k;h+=2){j=a.skinIndices[h];m=a.skinIndices[h+1];
+createBinModel:function(a,b,c,d){var f=function(g){function h(v,A){var G=o(v,A),S=o(v,A+1),W=o(v,A+2),da=o(v,A+3),ja=(da<<1&255|W>>7)-127;G|=(W&127)<<16|S<<8;if(G==0&&ja==-127)return 0;return(1-2*(da>>7))*(1+G*Math.pow(2,-23))*Math.pow(2,ja)}function k(v,A){var G=o(v,A),S=o(v,A+1),W=o(v,A+2);return(o(v,A+3)<<24)+(W<<16)+(S<<8)+G}function j(v,A){var G=o(v,A);return(o(v,A+1)<<8)+G}function m(v,A){var G=o(v,A);return G>127?G-256:G}function o(v,A){return v.charCodeAt(A)&255}function z(v){var A,G,S;A=
+k(a,v);G=k(a,v+e);S=k(a,v+L);v=j(a,v+M);THREE.Loader.prototype.f3(w,A,G,S,v)}function q(v){var A,G,S,W,da,ja;A=k(a,v);G=k(a,v+e);S=k(a,v+L);W=j(a,v+M);da=k(a,v+V);ja=k(a,v+R);v=k(a,v+aa);THREE.Loader.prototype.f3n(w,I,A,G,S,W,da,ja,v)}function t(v){var A,G,S,W;A=k(a,v);G=k(a,v+ca);S=k(a,v+J);W=k(a,v+Y);v=j(a,v+oa);THREE.Loader.prototype.f4(w,A,G,S,W,v)}function B(v){var A,G,S,W,da,ja,xa,P;A=k(a,v);G=k(a,v+ca);S=k(a,v+J);W=k(a,v+Y);da=j(a,v+oa);ja=k(a,v+ba);xa=k(a,v+la);P=k(a,v+ia);v=k(a,v+ga);THREE.Loader.prototype.f4n(w,
+I,A,G,S,W,da,ja,xa,P,v)}function C(v){var A,G;A=k(a,v);G=k(a,v+qa);v=k(a,v+wa);THREE.Loader.prototype.uv3(w.uvs,N[A*2],N[A*2+1],N[G*2],N[G*2+1],N[v*2],N[v*2+1])}function F(v){var A,G,S;A=k(a,v);G=k(a,v+l);S=k(a,v+x);v=k(a,v+y);THREE.Loader.prototype.uv4(w.uvs,N[A*2],N[A*2+1],N[G*2],N[G*2+1],N[S*2],N[S*2+1],N[v*2],N[v*2+1])}var w=this,H=0,u,I=[],N=[],e,L,M,V,R,aa,ca,J,Y,oa,ba,la,ia,ga,qa,wa,l,x,y,n,p,D,E,O,T;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,d,g);u={signature:a.substr(H,
+8),header_bytes:o(a,H+8),vertex_coordinate_bytes:o(a,H+9),normal_coordinate_bytes:o(a,H+10),uv_coordinate_bytes:o(a,H+11),vertex_index_bytes:o(a,H+12),normal_index_bytes:o(a,H+13),uv_index_bytes:o(a,H+14),material_index_bytes:o(a,H+15),nvertices:k(a,H+16),nnormals:k(a,H+16+4),nuvs:k(a,H+16+8),ntri_flat:k(a,H+16+12),ntri_smooth:k(a,H+16+16),ntri_flat_uv:k(a,H+16+20),ntri_smooth_uv:k(a,H+16+24),nquad_flat:k(a,H+16+28),nquad_smooth:k(a,H+16+32),nquad_flat_uv:k(a,H+16+36),nquad_smooth_uv:k(a,H+16+40)};
+H+=u.header_bytes;e=u.vertex_index_bytes;L=u.vertex_index_bytes*2;M=u.vertex_index_bytes*3;V=u.vertex_index_bytes*3+u.material_index_bytes;R=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes;aa=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*2;ca=u.vertex_index_bytes;J=u.vertex_index_bytes*2;Y=u.vertex_index_bytes*3;oa=u.vertex_index_bytes*4;ba=u.vertex_index_bytes*4+u.material_index_bytes;la=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes;ia=
+u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*2;ga=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*3;qa=u.uv_index_bytes;wa=u.uv_index_bytes*2;l=u.uv_index_bytes;x=u.uv_index_bytes*2;y=u.uv_index_bytes*3;g=u.vertex_index_bytes*3+u.material_index_bytes;T=u.vertex_index_bytes*4+u.material_index_bytes;n=u.ntri_flat*g;p=u.ntri_smooth*(g+u.normal_index_bytes*3);D=u.ntri_flat_uv*(g+u.uv_index_bytes*3);E=u.ntri_smooth_uv*(g+u.normal_index_bytes*3+u.uv_index_bytes*
+3);O=u.nquad_flat*T;g=u.nquad_smooth*(T+u.normal_index_bytes*4);T=u.nquad_flat_uv*(T+u.uv_index_bytes*4);H+=function(v){for(var A,G,S,W=u.vertex_coordinate_bytes*3,da=v+u.nvertices*W;v<da;v+=W){A=h(a,v);G=h(a,v+u.vertex_coordinate_bytes);S=h(a,v+u.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(w,A,G,S)}return u.nvertices*W}(H);H+=function(v){for(var A,G,S,W=u.normal_coordinate_bytes*3,da=v+u.nnormals*W;v<da;v+=W){A=m(a,v);G=m(a,v+u.normal_coordinate_bytes);S=m(a,v+u.normal_coordinate_bytes*2);
+I.push(A/127,G/127,S/127)}return u.nnormals*W}(H);H+=function(v){for(var A,G,S=u.uv_coordinate_bytes*2,W=v+u.nuvs*S;v<W;v+=S){A=h(a,v);G=h(a,v+u.uv_coordinate_bytes);N.push(A,G)}return u.nuvs*S}(H);n=H+n;p=n+p;D=p+D;E=D+E;O=E+O;g=O+g;T=g+T;(function(v){var A,G=u.vertex_index_bytes*3+u.material_index_bytes,S=G+u.uv_index_bytes*3,W=v+u.ntri_flat_uv*S;for(A=v;A<W;A+=S){z(A);C(A+G)}return W-v})(p);(function(v){var A,G=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*3,S=G+u.uv_index_bytes*
+3,W=v+u.ntri_smooth_uv*S;for(A=v;A<W;A+=S){q(A);C(A+G)}return W-v})(D);(function(v){var A,G=u.vertex_index_bytes*4+u.material_index_bytes,S=G+u.uv_index_bytes*4,W=v+u.nquad_flat_uv*S;for(A=v;A<W;A+=S){t(A);F(A+G)}return W-v})(g);(function(v){var A,G=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*4,S=G+u.uv_index_bytes*4,W=v+u.nquad_smooth_uv*S;for(A=v;A<W;A+=S){B(A);F(A+G)}return W-v})(T);(function(v){var A,G=u.vertex_index_bytes*3+u.material_index_bytes,S=v+u.ntri_flat*G;for(A=
+v;A<S;A+=G)z(A);return S-v})(H);(function(v){var A,G=u.vertex_index_bytes*3+u.material_index_bytes+u.normal_index_bytes*3,S=v+u.ntri_smooth*G;for(A=v;A<S;A+=G)q(A);return S-v})(n);(function(v){var A,G=u.vertex_index_bytes*4+u.material_index_bytes,S=v+u.nquad_flat*G;for(A=v;A<S;A+=G)t(A);return S-v})(E);(function(v){var A,G=u.vertex_index_bytes*4+u.material_index_bytes+u.normal_index_bytes*4,S=v+u.nquad_smooth*G;for(A=v;A<S;A+=G)B(A);return S-v})(O);this.computeCentroids();this.computeFaceNormals()};
+f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},createModel:function(a,b,c){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){var h,k,j,m,o;h=0;for(k=a.vertices.length;h<k;h+=3){j=a.vertices[h];m=a.vertices[h+1];o=a.vertices[h+2];THREE.Loader.prototype.v(g,j,m,o)}if(a.colors){h=0;for(k=a.colors.length;h<k;h+=3){j=a.colors[h];m=a.colors[h+1];o=a.colors[h+2];THREE.Loader.prototype.vc(g,j,m,o)}}})();(function(){function h(B,
+C){THREE.Loader.prototype.f3(g,B[C],B[C+1],B[C+2],B[C+3])}function k(B,C){THREE.Loader.prototype.f3n(g,a.normals,B[C],B[C+1],B[C+2],B[C+3],B[C+4],B[C+5],B[C+6])}function j(B,C){THREE.Loader.prototype.f4(g,B[C],B[C+1],B[C+2],B[C+3],B[C+4])}function m(B,C){THREE.Loader.prototype.f4n(g,a.normals,B[C],B[C+1],B[C+2],B[C+3],B[C+4],B[C+5],B[C+6],B[C+7],B[C+8])}function o(B,C){var F,w,H,u,I,N,e,L,M;F=B[C];w=B[C+1];H=B[C+2];u=a.uvs[F*2];e=a.uvs[F*2+1];I=a.uvs[w*2];L=a.uvs[w*2+1];N=a.uvs[H*2];M=a.uvs[H*2+1];
+THREE.Loader.prototype.uv3(g.uvs,u,e,I,L,N,M);if(a.uvs2&&a.uvs2.length){u=a.uvs2[F*2];e=a.uvs2[F*2+1];I=a.uvs2[w*2];L=a.uvs2[w*2+1];N=a.uvs2[H*2];M=a.uvs2[H*2+1];THREE.Loader.prototype.uv3(g.uvs2,u,1-e,I,1-L,N,1-M)}}function z(B,C){var F,w,H,u,I,N,e,L,M,V,R,aa;F=B[C];w=B[C+1];H=B[C+2];u=B[C+3];I=a.uvs[F*2];M=a.uvs[F*2+1];N=a.uvs[w*2];V=a.uvs[w*2+1];e=a.uvs[H*2];R=a.uvs[H*2+1];L=a.uvs[u*2];aa=a.uvs[u*2+1];THREE.Loader.prototype.uv4(g.uvs,I,M,N,V,e,R,L,aa);if(a.uvs2){I=a.uvs2[F*2];M=a.uvs2[F*2+1];N=
+a.uvs2[w*2];V=a.uvs2[w*2+1];e=a.uvs2[H*2];R=a.uvs2[H*2+1];L=a.uvs2[u*2];aa=a.uvs2[u*2+1];THREE.Loader.prototype.uv4(g.uvs2,I,1-M,N,1-V,e,1-R,L,1-aa)}}var q,t;q=0;for(t=a.trianglesUvs.length;q<t;q+=7){h(a.trianglesUvs,q);o(a.trianglesUvs,q+4)}q=0;for(t=a.trianglesNormalsUvs.length;q<t;q+=10){k(a.trianglesNormalsUvs,q);o(a.trianglesNormalsUvs,q+7)}q=0;for(t=a.quadsUvs.length;q<t;q+=9){j(a.quadsUvs,q);z(a.quadsUvs,q+5)}q=0;for(t=a.quadsNormalsUvs.length;q<t;q+=13){m(a.quadsNormalsUvs,q);z(a.quadsNormalsUvs,
+q+9)}q=0;for(t=a.triangles.length;q<t;q+=4)h(a.triangles,q);q=0;for(t=a.trianglesNormals.length;q<t;q+=7)k(a.trianglesNormals,q);q=0;for(t=a.quads.length;q<t;q+=5)j(a.quads,q);q=0;for(t=a.quadsNormals.length;q<t;q+=9)m(a.quadsNormals,q)})();(function(){var h,k,j,m;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<k;h+=2){j=a.skinWeights[h];m=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,j,m,0,0)}}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<k;h+=2){j=a.skinIndices[h];m=a.skinIndices[h+1];
 THREE.Loader.prototype.si(g,j,m,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;b(new d(c))},bones:function(a,b){a.bones=b},animation:function(a,b){a.animation=b},si:function(a,b,c,d,f){a.skinIndices.push(new THREE.Vector4(b,c,d,f))},sw:function(a,b,c,d,f){a.skinWeights.push(new THREE.Vector4(b,c,d,f))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,
 THREE.Loader.prototype.si(g,j,m,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;b(new d(c))},bones:function(a,b){a.bones=b},animation:function(a,b){a.animation=b},si:function(a,b,c,d,f){a.skinIndices.push(new THREE.Vector4(b,c,d,f))},sw:function(a,b,c,d,f){a.skinWeights.push(new THREE.Vector4(b,c,d,f))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,
-c,d)))},vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,k,j){g=a.materials[g];var m=b[k*3],o=b[k*3+1];k=b[k*3+2];var y=b[j*3],p=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,o,k),new THREE.Vector3(y,
-p,j)],g))},f4n:function(a,b,c,d,f,g,h,k,j,m,o){h=a.materials[h];var y=b[j*3],p=b[j*3+1];j=b[j*3+2];var q=b[m*3],A=b[m*3+1];m=b[m*3+2];var C=b[o*3],E=b[o*3+1];o=b[o*3+2];a.faces.push(new THREE.Face4(c,d,f,g,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(y,p,j),new THREE.Vector3(q,A,m),new THREE.Vector3(C,E,o)],h))},uv3:function(a,b,c,d,f,g,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(d,f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,b,c,d,f,g,h,k,j){var m=[];m.push(new THREE.UV(b,
-c));m.push(new THREE.UV(d,f));m.push(new THREE.UV(g,h));m.push(new THREE.UV(k,j));a.push(m)},init_materials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(b[d],c)]},createMaterial:function(a,b){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,j){var m=new Image;m.onload=function(){if(!c(this.width)||!c(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),y=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));k.image.width=o;k.image.height=y;k.image.getContext("2d").drawImage(this,0,0,o,y)}else k.image=this;k.needsUpdate=!0};m.src=j}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.mapDiffuse&&b){h=document.createElement("canvas");g.map=new THREE.Texture(h);d(g.map,b+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*
+c,d)))},vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,k,j){g=a.materials[g];var m=b[k*3],o=b[k*3+1];k=b[k*3+2];var z=b[j*3],q=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,o,k),new THREE.Vector3(z,
+q,j)],g))},f4n:function(a,b,c,d,f,g,h,k,j,m,o){h=a.materials[h];var z=b[j*3],q=b[j*3+1];j=b[j*3+2];var t=b[m*3],B=b[m*3+1];m=b[m*3+2];var C=b[o*3],F=b[o*3+1];o=b[o*3+2];a.faces.push(new THREE.Face4(c,d,f,g,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(z,q,j),new THREE.Vector3(t,B,m),new THREE.Vector3(C,F,o)],h))},uv3:function(a,b,c,d,f,g,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(d,f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,b,c,d,f,g,h,k,j){var m=[];m.push(new THREE.UV(b,
+c));m.push(new THREE.UV(d,f));m.push(new THREE.UV(g,h));m.push(new THREE.UV(k,j));a.push(m)},init_materials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(b[d],c)]},createMaterial:function(a,b){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,j){var m=new Image;m.onload=function(){if(!c(this.width)||!c(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),z=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));k.image.width=o;k.image.height=z;k.image.getContext("2d").drawImage(this,0,0,o,z)}else k.image=this;k.needsUpdate=!0};m.src=j}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.mapDiffuse&&b){h=document.createElement("canvas");g.map=new THREE.Texture(h);d(g.map,b+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*
 255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&b){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);d(g.lightMap,b+"/"+a.mapLightmap)}return new THREE[f](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
 255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&b){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);d(g.lightMap,b+"/"+a.mapLightmap)}return new THREE[f](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -49,7 +49,7 @@ THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,j=d*e;this.w=g*f-j*c;this.x=g*c+j*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,j=d*e;this.w=g*f-j*c;this.x=g*c+j*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,j=a.z;a=a.w;this.x=b*a+e*f+c*j-d*g;this.y=c*a+e*g+d*f-b*j;this.z=d*a+e*j+b*g-c*f;this.w=e*a-b*f-c*g-d*j;return this},
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,j=a.z;a=a.w;this.x=b*a+e*f+c*j-d*g;this.y=c*a+e*g+d*f-b*j;this.z=d*a+e*j+b*g-c*f;this.w=e*a-b*f-c*g-d*j;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,j=this.z,h=this.w,i=h*c+g*e-j*d,n=h*d+j*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-j*e;b.x=i*h+c*-f+n*-j-m*-g;b.y=n*h+c*-g+m*-f-i*-j;b.z=m*h+c*-j+i*-g-n*-f;return b}};
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,j=this.z,h=this.w,i=h*c+g*e-j*d,n=h*d+j*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-j*e;b.x=i*h+c*-f+n*-j-m*-g;b.y=n*h+c*-g+m*-f-i*-j;b.z=m*h+c*-j+i*-g-n*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 1 - 1
build/custom/ThreeDOM.js

@@ -49,7 +49,7 @@ THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,n=h*d+i*c-f*e,l=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+n*-i-l*-g;b.y=n*h+c*-g+l*-f-j*-i;b.z=l*h+c*-i+j*-g-n*-f;return b}};
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,j=h*c+g*e-i*d,n=h*d+i*c-f*e,l=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+n*-i-l*-g;b.y=n*h+c*-g+l*-f-j*-i;b.z=l*h+c*-i+j*-g-n*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};

+ 1 - 1
build/custom/ThreeExtras.js

@@ -38,7 +38,7 @@ var Torus=function(a,d,b,f){this.radius=a||100;this.tube=d||40;this.segmentsR=b|
 var Icosahedron=function(a){function d(v,q,n){var p=Math.sqrt(v*v+q*q+n*n);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(v/p,q/p,n/p)))-1}function b(v,q,n,p){p.faces.push(new THREE.Face3(v,q,n))}function f(v,q){var n=g.vertices[v].position,p=g.vertices[q].position;return d((n.x+p.x)/2,(n.y+p.y)/2,(n.z+p.z)/2)}var g=this,c=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
 var Icosahedron=function(a){function d(v,q,n){var p=Math.sqrt(v*v+q*q+n*n);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(v/p,q/p,n/p)))-1}function b(v,q,n,p){p.faces.push(new THREE.Face3(v,q,n))}function f(v,q){var n=g.vertices[v].position,p=g.vertices[q].position;return d((n.x+p.x)/2,(n.y+p.y)/2,(n.z+p.z)/2)}var g=this,c=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;d(-1,a,0);d(1,a,0);d(-1,-a,0);d(1,-a,0);d(0,-1,a);d(0,1,a);d(0,-1,-a);d(0,
 1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,c);b(0,5,1,c);b(0,1,7,c);b(0,7,10,c);b(0,10,11,c);b(1,5,9,c);b(5,11,4,c);b(11,10,2,c);b(10,7,6,c);b(7,1,8,c);b(3,9,4,c);b(3,4,2,c);b(3,2,6,c);b(3,6,8,c);b(3,8,9,c);b(4,9,5,c);b(2,4,11,c);b(6,2,10,c);b(8,6,7,c);b(9,8,1,c);for(a=0;a<this.subdivisions;a++){e=new THREE.Geometry;for(var h in c.faces){var j=f(c.faces[h].a,c.faces[h].b),l=f(c.faces[h].b,c.faces[h].c),m=f(c.faces[h].c,c.faces[h].a);b(c.faces[h].a,j,m,e);b(c.faces[h].b,l,j,e);b(c.faces[h].c,
 1,-a);d(a,0,-1);d(a,0,1);d(-a,0,-1);d(-a,0,1);b(0,11,5,c);b(0,5,1,c);b(0,1,7,c);b(0,7,10,c);b(0,10,11,c);b(1,5,9,c);b(5,11,4,c);b(11,10,2,c);b(10,7,6,c);b(7,1,8,c);b(3,9,4,c);b(3,4,2,c);b(3,2,6,c);b(3,6,8,c);b(3,8,9,c);b(4,9,5,c);b(2,4,11,c);b(6,2,10,c);b(8,6,7,c);b(9,8,1,c);for(a=0;a<this.subdivisions;a++){e=new THREE.Geometry;for(var h in c.faces){var j=f(c.faces[h].a,c.faces[h].b),l=f(c.faces[h].b,c.faces[h].c),m=f(c.faces[h].c,c.faces[h].a);b(c.faces[h].a,j,m,e);b(c.faces[h].b,l,j,e);b(c.faces[h].c,
 m,l,e);b(j,l,m,e)}c.faces=e.faces}g.faces=c.faces;delete c;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
 m,l,e);b(j,l,m,e)}c.faces=e.faces}g.faces=c.faces;delete c;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function LathedObject(a,d,b){THREE.Geometry.call(this);this.nsteps=d||12;this.latheAngle=b||2*Math.PI;d=this.latheAngle/this.nsteps;for(var f=[],g=[],c=[],e=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));g[h]=this.vertices.length-1;f[h]=new THREE.Vector3(a[h].x,a[h].y,a[h].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),l=0;l<=this.latheAngle+0.001;l+=this.stepSize){for(h=0;h<f.length;h++)if(l<b){f[h]=j.multiplyVector3(f[h].clone());this.vertices.push(new THREE.Vertex(f[h]));
+function LathedObject(a,d,b){THREE.Geometry.call(this);this.nsteps=d||12;this.latheAngle=b||2*Math.PI;d=this.latheAngle/this.nsteps;for(var f=[],g=[],c=[],e=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));g[h]=this.vertices.length-1;f[h]=new THREE.Vector3(a[h].x,a[h].y,a[h].z)}for(var j=THREE.Matrix4.rotationZMatrix(this.stepSize),l=0;l<=this.latheAngle+0.0010;l+=this.stepSize){for(h=0;h<f.length;h++)if(l<b){f[h]=j.multiplyVector3(f[h].clone());this.vertices.push(new THREE.Vertex(f[h]));
 c[h]=this.vertices.length-1}else c=e;l==0&&(e=g);for(h=0;h<g.length-1;h++){this.faces.push(new THREE.Face4(c[h],c[h+1],g[h+1],g[h]));this.uvs.push([new THREE.UV(l/b,h/a.length),new THREE.UV(l/b,(h+1)/a.length),new THREE.UV((l-d)/b,(h+1)/a.length),new THREE.UV((l-d)/b,h/a.length)])}g=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
 c[h]=this.vertices.length-1}else c=e;l==0&&(e=g);for(h=0;h<g.length-1;h++){this.faces.push(new THREE.Face4(c[h],c[h+1],g[h+1],g[h]));this.uvs.push([new THREE.UV(l/b,h/a.length),new THREE.UV(l/b,(h+1)/a.length),new THREE.UV((l-d)/b,(h+1)/a.length),new THREE.UV((l-d)/b,h/a.length)])}g=c;c=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;
 if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 THREE.MarchingCubes=function(a,d){THREE.Object3D.call(this);this.materials=d instanceof Array?d:[d];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=

+ 1 - 1
build/custom/ThreeSVG.js

@@ -49,7 +49,7 @@ THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 THREE.Quaternion.prototype={set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-e);e=Math.sin(-e);var f=Math.cos(c);c=Math.sin(c);var g=a*b,i=d*e;this.w=g*f-i*c;this.x=g*c+i*f;this.y=d*b*f+a*e*c;this.z=a*e*f-d*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 -1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,d=this.z,e=this.w,f=a.x,g=a.y,i=a.z;a=a.w;this.x=b*a+e*f+c*i-d*g;this.y=c*a+e*g+d*f-b*i;this.z=d*a+e*i+b*g-c*f;this.w=e*a-b*f-c*g-d*i;return this},
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,l=h*c+g*e-i*d,n=h*d+i*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=l*h+c*-f+n*-i-m*-g;b.y=n*h+c*-g+m*-f-l*-i;b.z=m*h+c*-i+l*-g-n*-f;return b}};
 multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,e=a.z,f=this.x,g=this.y,i=this.z,h=this.w,l=h*c+g*e-i*d,n=h*d+i*c-f*e,m=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=l*h+c*-f+n*-i-m*-g;b.y=n*h+c*-g+m*-f-l*-i;b.z=m*h+c*-i+l*-g-n*-f;return b}};
-THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
+THREE.Quaternion.slerp=function(a,b,c,d){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var f=Math.acos(e),g=Math.sqrt(1-e*e);if(Math.abs(g)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*e+b.w*d;c.x=a.x*e+b.x*d;c.y=a.y*e+b.y*d;c.z=a.z*e+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.Face3=function(a,b,c,d,e){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=e instanceof Array?e:[e]};THREE.Face4=function(a,b,c,d,e,f){this.a=a;this.b=b;this.c=c;this.d=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=f instanceof Array?f:[f]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};

+ 108 - 107
build/custom/ThreeWebGL.js

@@ -1,6 +1,6 @@
 // ThreeWebGL.js r33 - http://github.com/mrdoob/three.js
 // ThreeWebGL.js r33 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,h,m,j,p,o;if(d==0)e=h=m=0;else{j=Math.floor(a*6);p=a*6-j;a=d*(1-b);o=d*(1-b*p);b=d*(1-b*(1-p));switch(j){case 1:e=o;h=d;m=a;break;case 2:e=a;h=d;m=b;break;case 3:e=a;h=o;m=d;break;case 4:e=b;h=a;m=d;break;case 5:e=d;h=a;m=o;break;case 6:case 0:e=d;h=b;m=a}}this.r=e;this.g=h;this.b=m;if(this.autoUpdate){this.updateHex();
+THREE.Color.prototype={autoUpdate:!0,setRGB:function(a,b,d){this.r=a;this.g=b;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,d){var e,h,m,k,o,n;if(d==0)e=h=m=0;else{k=Math.floor(a*6);o=a*6-k;a=d*(1-b);n=d*(1-b*o);b=d*(1-b*(1-o));switch(k){case 1:e=n;h=d;m=a;break;case 2:e=a;h=d;m=b;break;case 3:e=a;h=n;m=d;break;case 4:e=b;h=a;m=d;break;case 5:e=d;h=a;m=n;break;case 6:case 0:e=d;h=b;m=a}}this.r=e;this.g=h;this.b=m;if(this.autoUpdate){this.updateHex();
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2=function(a,b){this.set(a||0,b||0)};
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
@@ -11,60 +11,60 @@ a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-th
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,d,e){this.set(a||0,b||0,d||0,e||1)};
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,d,e){this.set(a||0,b||0,d||0,e||1)};
 THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,h=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(d)))}h.sort(function(m,j){return m.distance-j.distance});return h},intersectObject:function(a){function b(K,H,R,O){O=O.clone().subSelf(H);R=R.clone().subSelf(H);var M=K.clone().subSelf(H);K=O.dot(O);H=O.dot(R);O=O.dot(M);var N=R.dot(R);R=R.dot(M);M=1/(K*N-H*H);N=(N*O-H*R)*M;K=(K*R-H*O)*M;return N>0&&K>0&&N+K<1}var d,e,h,m,j,p,o,t,w,v,
-C,D=a.geometry,F=D.vertices,G=[];d=0;for(e=D.faces.length;d<e;d++){h=D.faces[d];v=this.origin.clone();C=this.direction.clone();o=a.matrixWorld;m=o.multiplyVector3(F[h.a].position.clone());j=o.multiplyVector3(F[h.b].position.clone());p=o.multiplyVector3(F[h.c].position.clone());o=h instanceof THREE.Face4?o.multiplyVector3(F[h.d].position.clone()):null;t=a.matrixRotationWorld.multiplyVector3(h.normal.clone());w=C.dot(t);if(w<0){t=t.dot((new THREE.Vector3).sub(m,v))/w;v=v.addSelf(C.multiplyScalar(t));
-if(h instanceof THREE.Face3){if(b(v,m,j,p)){h={distance:this.origin.distanceTo(v),point:v,face:h,object:a};G.push(h)}}else if(h instanceof THREE.Face4&&(b(v,m,j,o)||b(v,j,p,o))){h={distance:this.origin.distanceTo(v),point:v,face:h,object:a};G.push(h)}}}return G}};
-THREE.Rectangle=function(){function a(){m=e-b;j=h-d}var b,d,e,h,m,j,p=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return m};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(o,t,w,v){p=!1;b=o;d=t;e=w;h=v;a()};this.addPoint=function(o,t){if(p){p=!1;b=o;d=t;e=o;h=t}else{b=b<o?b:o;d=d<t?d:t;e=e>o?e:o;h=h>t?h:t}a()};
-this.add3Points=function(o,t,w,v,C,D){if(p){p=!1;b=o<w?o<C?o:C:w<C?w:C;d=t<v?t<D?t:D:v<D?v:D;e=o>w?o>C?o:C:w>C?w:C;h=t>v?t>D?t:D:v>D?v:D}else{b=o<w?o<C?o<b?o:b:C<b?C:b:w<C?w<b?w:b:C<b?C:b;d=t<v?t<D?t<d?t:d:D<d?D:d:v<D?v<d?v:d:D<d?D:d;e=o>w?o>C?o>e?o:e:C>e?C:e:w>C?w>e?w:e:C>e?C:e;h=t>v?t>D?t>h?t:h:D>h?D:h:v>D?v>h?v:h:D>h?D:h}a()};this.addRectangle=function(o){if(p){p=!1;b=o.getLeft();d=o.getTop();e=o.getRight();h=o.getBottom()}else{b=b<o.getLeft()?b:o.getLeft();d=d<o.getTop()?d:o.getTop();e=e>o.getRight()?
-e:o.getRight();h=h>o.getBottom()?h:o.getBottom()}a()};this.inflate=function(o){b-=o;d-=o;e+=o;h+=o;a()};this.minSelf=function(o){b=b>o.getLeft()?b:o.getLeft();d=d>o.getTop()?d:o.getTop();e=e<o.getRight()?e:o.getRight();h=h<o.getBottom()?h:o.getBottom();a()};this.instersects=function(o){return Math.min(e,o.getRight())-Math.max(b,o.getLeft())>=0&&Math.min(h,o.getBottom())-Math.max(d,o.getTop())>=0};this.empty=function(){p=!0;h=e=d=b=0;a()};this.isEmpty=function(){return p}};
+THREE.Ray.prototype={intersectScene:function(a){var b,d,e=a.objects,h=[];a=0;for(b=e.length;a<b;a++){d=e[a];d instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(d)))}h.sort(function(m,k){return m.distance-k.distance});return h},intersectObject:function(a){function b(J,H,R,P){P=P.clone().subSelf(H);R=R.clone().subSelf(H);var L=J.clone().subSelf(H);J=P.dot(P);H=P.dot(R);P=P.dot(L);var N=R.dot(R);R=R.dot(L);L=1/(J*N-H*H);N=(N*P-H*R)*L;J=(J*R-H*P)*L;return N>0&&J>0&&N+J<1}var d,e,h,m,k,o,n,t,y,w,
+C,D=a.geometry,F=D.vertices,G=[];d=0;for(e=D.faces.length;d<e;d++){h=D.faces[d];w=this.origin.clone();C=this.direction.clone();n=a.matrixWorld;m=n.multiplyVector3(F[h.a].position.clone());k=n.multiplyVector3(F[h.b].position.clone());o=n.multiplyVector3(F[h.c].position.clone());n=h instanceof THREE.Face4?n.multiplyVector3(F[h.d].position.clone()):null;t=a.matrixRotationWorld.multiplyVector3(h.normal.clone());y=C.dot(t);if(y<0){t=t.dot((new THREE.Vector3).sub(m,w))/y;w=w.addSelf(C.multiplyScalar(t));
+if(h instanceof THREE.Face3){if(b(w,m,k,o)){h={distance:this.origin.distanceTo(w),point:w,face:h,object:a};G.push(h)}}else if(h instanceof THREE.Face4&&(b(w,m,k,n)||b(w,k,o,n))){h={distance:this.origin.distanceTo(w),point:w,face:h,object:a};G.push(h)}}}return G}};
+THREE.Rectangle=function(){function a(){m=e-b;k=h-d}var b,d,e,h,m,k,o=!0;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return m};this.getHeight=function(){return k};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(n,t,y,w){o=!1;b=n;d=t;e=y;h=w;a()};this.addPoint=function(n,t){if(o){o=!1;b=n;d=t;e=n;h=t}else{b=b<n?b:n;d=d<t?d:t;e=e>n?e:n;h=h>t?h:t}a()};
+this.add3Points=function(n,t,y,w,C,D){if(o){o=!1;b=n<y?n<C?n:C:y<C?y:C;d=t<w?t<D?t:D:w<D?w:D;e=n>y?n>C?n:C:y>C?y:C;h=t>w?t>D?t:D:w>D?w:D}else{b=n<y?n<C?n<b?n:b:C<b?C:b:y<C?y<b?y:b:C<b?C:b;d=t<w?t<D?t<d?t:d:D<d?D:d:w<D?w<d?w:d:D<d?D:d;e=n>y?n>C?n>e?n:e:C>e?C:e:y>C?y>e?y:e:C>e?C:e;h=t>w?t>D?t>h?t:h:D>h?D:h:w>D?w>h?w:h:D>h?D:h}a()};this.addRectangle=function(n){if(o){o=!1;b=n.getLeft();d=n.getTop();e=n.getRight();h=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();d=d<n.getTop()?d:n.getTop();e=e>n.getRight()?
+e:n.getRight();h=h>n.getBottom()?h:n.getBottom()}a()};this.inflate=function(n){b-=n;d-=n;e+=n;h+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();d=d>n.getTop()?d:n.getTop();e=e<n.getRight()?e:n.getRight();h=h<n.getBottom()?h:n.getBottom();a()};this.instersects=function(n){return Math.min(e,n.getRight())-Math.max(b,n.getLeft())>=0&&Math.min(h,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){o=!0;h=e=d=b=0;a()};this.isEmpty=function(){return o}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,d,e,h,m,j,p,o,t,w,v,C,D,F,G){this.set(a||1,b||0,d||0,e||0,h||0,m||1,j||0,p||0,o||0,t||0,w||1,v||0,C||0,D||0,F||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,d,e,h,m,j,p,o,t,w,v,C,D,F,G){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=h;this.n22=m;this.n23=j;this.n24=p;this.n31=o;this.n32=t;this.n33=w;this.n34=v;this.n41=C;this.n42=D;this.n43=F;this.n44=G;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,
+THREE.Matrix4=function(a,b,d,e,h,m,k,o,n,t,y,w,C,D,F,G){this.set(a||1,b||0,d||0,e||0,h||0,m||1,k||0,o||0,n||0,t||0,y||1,w||0,C||0,D||0,F||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,b,d,e,h,m,k,o,n,t,y,w,C,D,F,G){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=h;this.n22=m;this.n23=k;this.n24=o;this.n31=n;this.n32=t;this.n33=y;this.n34=w;this.n41=C;this.n42=D;this.n43=F;this.n44=G;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(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,d){var e=THREE.Matrix4.__tmpVec1,
 h=THREE.Matrix4.__tmpVec2,m=THREE.Matrix4.__tmpVec3;m.sub(a,b).normalize();e.cross(d,m).normalize();h.cross(m,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=m.x;this.n14=a.x;this.n21=e.y;this.n22=h.y;this.n23=m.y;this.n24=a.y;this.n31=e.z;this.n32=h.z;this.n33=m.z;this.n34=a.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,h=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*h;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*h;a.z=(this.n31*
 h=THREE.Matrix4.__tmpVec2,m=THREE.Matrix4.__tmpVec3;m.sub(a,b).normalize();e.cross(d,m).normalize();h.cross(m,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=m.x;this.n14=a.x;this.n21=e.y;this.n22=h.y;this.n23=m.y;this.n24=a.y;this.n31=e.z;this.n32=h.z;this.n33=m.z;this.n34=a.z;return this},multiplyVector3:function(a){var b=a.x,d=a.y,e=a.z,h=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*h;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*h;a.z=(this.n31*
 b+this.n32*d+this.n33*e+this.n34)*h;return a},multiplyVector3OnlyZ:function(a){var b=a.x,d=a.y;a=a.z;return(this.n31*b+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*d+this.n43*a+this.n44))},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,h=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*h;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*h;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*h;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*h;return a},crossVector:function(a){var b=new THREE.Vector4;
 b+this.n32*d+this.n33*e+this.n34)*h;return a},multiplyVector3OnlyZ:function(a){var b=a.x,d=a.y;a=a.z;return(this.n31*b+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*d+this.n43*a+this.n44))},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,h=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*h;a.y=this.n21*b+this.n22*d+this.n23*e+this.n24*h;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*h;a.w=this.n41*b+this.n42*d+this.n43*e+this.n44*h;return a},crossVector:function(a){var b=new THREE.Vector4;
-b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,h=a.n13,m=a.n14,j=a.n21,p=a.n22,o=a.n23,t=a.n24,w=a.n31,v=a.n32,C=a.n33,D=a.n34,F=a.n41,G=a.n42,K=a.n43,H=a.n44,R=b.n11,O=b.n12,M=b.n13,N=b.n14,c=b.n21,Y=b.n22,ba=b.n23,Z=b.n24,$=b.n31,ga=b.n32,ja=b.n33,ka=b.n34;this.n11=
-d*R+e*c+h*$;this.n12=d*O+e*Y+h*ga;this.n13=d*M+e*ba+h*ja;this.n14=d*N+e*Z+h*ka+m;this.n21=j*R+p*c+o*$;this.n22=j*O+p*Y+o*ga;this.n23=j*M+p*ba+o*ja;this.n24=j*N+p*Z+o*ka+t;this.n31=w*R+v*c+C*$;this.n32=w*O+v*Y+C*ga;this.n33=w*M+v*ba+C*ja;this.n34=w*N+v*Z+C*ka+D;this.n41=F*R+G*c+K*$;this.n42=F*O+G*Y+K*ga;this.n43=F*M+G*ba+K*ja;this.n44=F*N+G*Z+K*ka+H;return this},multiplyToArray:function(a,b,d){var e=a.n11,h=a.n12,m=a.n13,j=a.n14,p=a.n21,o=a.n22,t=a.n23,w=a.n24,v=a.n31,C=a.n32,D=a.n33,F=a.n34,G=a.n41,
-K=a.n42,H=a.n43;a=a.n44;var R=b.n11,O=b.n12,M=b.n13,N=b.n14,c=b.n21,Y=b.n22,ba=b.n23,Z=b.n24,$=b.n31,ga=b.n32,ja=b.n33,ka=b.n34,ha=b.n41,pa=b.n42,sa=b.n43;b=b.n44;this.n11=e*R+h*c+m*$+j*ha;this.n12=e*O+h*Y+m*ga+j*pa;this.n13=e*M+h*ba+m*ja+j*sa;this.n14=e*N+h*Z+m*ka+j*b;this.n21=p*R+o*c+t*$+w*ha;this.n22=p*O+o*Y+t*ga+w*pa;this.n23=p*M+o*ba+t*ja+w*sa;this.n24=p*N+o*Z+t*ka+w*b;this.n31=v*R+C*c+D*$+F*ha;this.n32=v*O+C*Y+D*ga+F*pa;this.n33=v*M+C*ba+D*ja+F*sa;this.n34=v*N+C*Z+D*ka+F*b;this.n41=G*R+K*c+
-H*$+a*ha;this.n42=G*O+K*Y+H*ga+a*pa;this.n43=G*M+K*ba+H*ja+a*sa;this.n44=G*N+K*Z+H*ka+a*b;d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,h=this.n14,m=this.n21,j=this.n22,p=this.n23,o=this.n24,t=this.n31,w=this.n32,v=this.n33,C=this.n34,D=this.n41,
-F=this.n42,G=this.n43,K=this.n44,H=a.n11,R=a.n21,O=a.n31,M=a.n12,N=a.n22,c=a.n32,Y=a.n13,ba=a.n23,Z=a.n33,$=a.n14,ga=a.n24;a=a.n34;this.n11=b*H+d*R+e*O;this.n12=b*M+d*N+e*c;this.n13=b*Y+d*ba+e*Z;this.n14=b*$+d*ga+e*a+h;this.n21=m*H+j*R+p*O;this.n22=m*M+j*N+p*c;this.n23=m*Y+j*ba+p*Z;this.n24=m*$+j*ga+p*a+o;this.n31=t*H+w*R+v*O;this.n32=t*M+w*N+v*c;this.n33=t*Y+w*ba+v*Z;this.n34=t*$+w*ga+v*a+C;this.n41=D*H+F*R+G*O;this.n42=D*M+F*N+G*c;this.n43=D*Y+F*ba+G*Z;this.n44=D*$+F*ga+G*a+K;return this},multiplyScalar:function(a){this.n11*=
-a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,h=this.n21,m=this.n22,j=this.n23,p=this.n24,o=this.n31,t=this.n32,w=this.n33,v=this.n34,C=this.n41,D=this.n42,F=this.n43,G=this.n44;return e*j*t*C-d*p*t*C-e*m*w*C+b*p*w*C+d*m*v*C-b*j*v*C-e*j*o*D+d*p*o*D+e*h*w*D-a*p*w*D-d*h*v*D+a*j*v*D+
-e*m*o*F-b*p*o*F-e*h*t*F+a*p*t*F+b*h*v*F-a*m*v*F-d*m*o*G+b*j*o*G+d*h*t*G-a*j*t*G-b*h*w*G+a*m*w*G},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;
-a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flattenToArray(this.flat);return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,
-b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,
-0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),h=1-d,m=a.x,j=a.y,p=a.z,o=h*m,t=h*j;this.set(o*m+d,o*j-e*p,o*p+e*j,0,o*j+e*p,t*j+d,t*p-e*m,0,o*p-e*j,t*p+e*m,h*p*p+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=
-a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var h=Math.cos(d);d=Math.sin(d);var m=Math.cos(e);e=Math.sin(e);var j=a*d,p=b*d;this.n11=h*m;this.n12=-h*e;this.n13=d;this.n21=p*m+a*e;this.n22=-p*e+a*m;this.n23=-b*h;this.n31=-j*m+b*e;this.n32=j*e+b*m;this.n33=a*h},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,e=a.z,h=a.w,m=b+b,j=d+d,p=e+e;a=b*m;var o=b*j;b*=p;var t=d*j;d*=p;e*=p;m*=h;j*=h;h*=p;this.n11=1-(t+e);this.n12=o-h;this.n13=
-b+j;this.n21=o+h;this.n22=1-(a+e);this.n23=d-m;this.n31=b-j;this.n32=d+m;this.n33=1-(a+t)},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e};THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};
+b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var d=a.n11,e=a.n12,h=a.n13,m=a.n14,k=a.n21,o=a.n22,n=a.n23,t=a.n24,y=a.n31,w=a.n32,C=a.n33,D=a.n34,F=a.n41,G=a.n42,J=a.n43,H=a.n44,R=b.n11,P=b.n12,L=b.n13,N=b.n14,c=b.n21,Z=b.n22,ca=b.n23,$=b.n24,aa=b.n31,ha=b.n32,ka=b.n33,la=b.n34;this.n11=
+d*R+e*c+h*aa;this.n12=d*P+e*Z+h*ha;this.n13=d*L+e*ca+h*ka;this.n14=d*N+e*$+h*la+m;this.n21=k*R+o*c+n*aa;this.n22=k*P+o*Z+n*ha;this.n23=k*L+o*ca+n*ka;this.n24=k*N+o*$+n*la+t;this.n31=y*R+w*c+C*aa;this.n32=y*P+w*Z+C*ha;this.n33=y*L+w*ca+C*ka;this.n34=y*N+w*$+C*la+D;this.n41=F*R+G*c+J*aa;this.n42=F*P+G*Z+J*ha;this.n43=F*L+G*ca+J*ka;this.n44=F*N+G*$+J*la+H;return this},multiplyToArray:function(a,b,d){var e=a.n11,h=a.n12,m=a.n13,k=a.n14,o=a.n21,n=a.n22,t=a.n23,y=a.n24,w=a.n31,C=a.n32,D=a.n33,F=a.n34,G=
+a.n41,J=a.n42,H=a.n43;a=a.n44;var R=b.n11,P=b.n12,L=b.n13,N=b.n14,c=b.n21,Z=b.n22,ca=b.n23,$=b.n24,aa=b.n31,ha=b.n32,ka=b.n33,la=b.n34,ia=b.n41,qa=b.n42,ta=b.n43;b=b.n44;this.n11=e*R+h*c+m*aa+k*ia;this.n12=e*P+h*Z+m*ha+k*qa;this.n13=e*L+h*ca+m*ka+k*ta;this.n14=e*N+h*$+m*la+k*b;this.n21=o*R+n*c+t*aa+y*ia;this.n22=o*P+n*Z+t*ha+y*qa;this.n23=o*L+n*ca+t*ka+y*ta;this.n24=o*N+n*$+t*la+y*b;this.n31=w*R+C*c+D*aa+F*ia;this.n32=w*P+C*Z+D*ha+F*qa;this.n33=w*L+C*ca+D*ka+F*ta;this.n34=w*N+C*$+D*la+F*b;this.n41=
+G*R+J*c+H*aa+a*ia;this.n42=G*P+J*Z+H*ha+a*qa;this.n43=G*L+J*ca+H*ka+a*ta;this.n44=G*N+J*$+H*la+a*b;d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,h=this.n14,m=this.n21,k=this.n22,o=this.n23,n=this.n24,t=this.n31,y=this.n32,w=this.n33,C=this.n34,
+D=this.n41,F=this.n42,G=this.n43,J=this.n44,H=a.n11,R=a.n21,P=a.n31,L=a.n12,N=a.n22,c=a.n32,Z=a.n13,ca=a.n23,$=a.n33,aa=a.n14,ha=a.n24;a=a.n34;this.n11=b*H+d*R+e*P;this.n12=b*L+d*N+e*c;this.n13=b*Z+d*ca+e*$;this.n14=b*aa+d*ha+e*a+h;this.n21=m*H+k*R+o*P;this.n22=m*L+k*N+o*c;this.n23=m*Z+k*ca+o*$;this.n24=m*aa+k*ha+o*a+n;this.n31=t*H+y*R+w*P;this.n32=t*L+y*N+w*c;this.n33=t*Z+y*ca+w*$;this.n34=t*aa+y*ha+w*a+C;this.n41=D*H+F*R+G*P;this.n42=D*L+F*N+G*c;this.n43=D*Z+F*ca+G*$;this.n44=D*aa+F*ha+G*a+J;return this},
+multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,d=this.n13,e=this.n14,h=this.n21,m=this.n22,k=this.n23,o=this.n24,n=this.n31,t=this.n32,y=this.n33,w=this.n34,C=this.n41,D=this.n42,F=this.n43,G=this.n44;return e*k*t*C-d*o*t*C-e*m*y*C+b*o*y*C+d*m*w*C-b*k*w*C-e*k*n*D+d*o*
+n*D+e*h*y*D-a*o*y*D-d*h*w*D+a*k*w*D+e*m*n*F-b*o*n*F-e*h*t*F+a*o*t*F+b*h*w*F-a*m*w*F-d*m*n*G+b*k*n*G+d*h*t*G-a*k*t*G-b*h*y*G+a*m*y*G},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=
+this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flattenToArray(this.flat);return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;
+a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var b=
+Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var d=Math.cos(b),e=Math.sin(b),h=1-d,m=a.x,k=a.y,o=a.z,n=h*m,t=h*k;this.set(n*m+d,n*k-e*o,n*o+e*k,0,n*k+e*o,t*k+d,t*o-e*m,0,n*o-e*k,t*o+e*m,h*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=
+a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,d=a.y,e=a.z;a=Math.cos(b);b=Math.sin(b);var h=Math.cos(d);d=Math.sin(d);var m=Math.cos(e);e=Math.sin(e);var k=a*d,o=b*d;this.n11=h*m;this.n12=-h*e;this.n13=d;this.n21=o*m+a*e;this.n22=-o*e+a*m;this.n23=-b*h;this.n31=-k*m+b*e;this.n32=k*e+b*m;this.n33=a*h},setRotationFromQuaternion:function(a){var b=a.x,d=a.y,e=a.z,h=a.w,m=b+b,k=d+d,o=e+e;a=b*m;var n=b*k;b*=o;var t=d*k;d*=o;e*=o;m*=h;k*=h;h*=o;this.n11=1-(t+e);this.n12=
+n-h;this.n13=b+k;this.n21=n+h;this.n22=1-(a+e);this.n23=d-m;this.n31=b-k;this.n32=d+m;this.n33=1-(a+t)},scale:function(a){var b=a.x,d=a.y;a=a.z;this.n11*=b;this.n12*=d;this.n13*=a;this.n21*=b;this.n22*=d;this.n23*=a;this.n31*=b;this.n32*=d;this.n33*=a;this.n41*=b;this.n42*=d;this.n43*=a;return this}};THREE.Matrix4.translationMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e};THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);return e};
 THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var d=new THREE.Matrix4;d.setRotAxis(a,b);return d};
 THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var d=new THREE.Matrix4;d.setRotAxis(a,b);return d};
-THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,h=a.n13,m=a.n14,j=a.n21,p=a.n22,o=a.n23,t=a.n24,w=a.n31,v=a.n32,C=a.n33,D=a.n34,F=a.n41,G=a.n42,K=a.n43,H=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=o*D*G-t*C*G+t*v*K-p*D*K-o*v*H+p*C*H;b.n12=m*C*G-h*D*G-m*v*K+e*D*K+h*v*H-e*C*H;b.n13=h*t*G-m*o*G+m*p*K-e*t*K-h*p*H+e*o*H;b.n14=m*o*v-h*t*v-m*p*C+e*t*C+h*p*D-e*o*D;b.n21=t*C*F-o*D*F-t*w*K+j*D*K+o*w*H-j*C*H;b.n22=h*D*F-m*C*F+m*w*K-d*D*K-h*w*H+d*C*H;b.n23=m*o*F-h*t*F-m*j*K+d*t*K+h*j*H-d*o*H;
-b.n24=h*t*w-m*o*w+m*j*C-d*t*C-h*j*D+d*o*D;b.n31=p*D*F-t*v*F+t*w*G-j*D*G-p*w*H+j*v*H;b.n32=m*v*F-e*D*F-m*w*G+d*D*G+e*w*H-d*v*H;b.n33=h*t*F-m*p*F+m*j*G-d*t*G-e*j*H+d*p*H;b.n34=m*p*w-e*t*w-m*j*v+d*t*v+e*j*D-d*p*D;b.n41=o*v*F-p*C*F-o*w*G+j*C*G+p*w*K-j*v*K;b.n42=e*C*F-h*v*F+h*w*G-d*C*G-e*w*K+d*v*K;b.n43=h*p*F-e*o*F-h*j*G+d*o*G+e*j*K-d*p*K;b.n44=e*o*w-h*p*w+h*j*v-d*o*v-e*j*C+d*p*C;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,m=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,w=-a.n23*a.n11+a.n21*a.n13,v=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*j+a.n31*t;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*h;d[2]=a*m;d[3]=a*j;d[4]=a*p;d[5]=a*o;d[6]=a*t;d[7]=a*w;d[8]=a*v;return b};
-THREE.Matrix4.makeFrustum=function(a,b,d,e,h,m){var j;j=new THREE.Matrix4;j.n11=2*h/(b-a);j.n12=0;j.n13=(b+a)/(b-a);j.n14=0;j.n21=0;j.n22=2*h/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(m+h)/(m-h);j.n34=-2*m*h/(m-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,d,e){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*b,a*b,h,a,d,e)};
-THREE.Matrix4.makeOrtho=function(a,b,d,e,h,m){var j,p,o,t;j=new THREE.Matrix4;p=b-a;o=d-e;t=m-h;j.n11=2/p;j.n12=0;j.n13=0;j.n14=-((b+a)/p);j.n21=0;j.n22=2/o;j.n23=0;j.n24=-((d+e)/o);j.n31=0;j.n32=0;j.n33=-2/t;j.n34=-((m+h)/t);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
+THREE.Matrix4.makeInvert=function(a,b){var d=a.n11,e=a.n12,h=a.n13,m=a.n14,k=a.n21,o=a.n22,n=a.n23,t=a.n24,y=a.n31,w=a.n32,C=a.n33,D=a.n34,F=a.n41,G=a.n42,J=a.n43,H=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*D*G-t*C*G+t*w*J-o*D*J-n*w*H+o*C*H;b.n12=m*C*G-h*D*G-m*w*J+e*D*J+h*w*H-e*C*H;b.n13=h*t*G-m*n*G+m*o*J-e*t*J-h*o*H+e*n*H;b.n14=m*n*w-h*t*w-m*o*C+e*t*C+h*o*D-e*n*D;b.n21=t*C*F-n*D*F-t*y*J+k*D*J+n*y*H-k*C*H;b.n22=h*D*F-m*C*F+m*y*J-d*D*J-h*y*H+d*C*H;b.n23=m*n*F-h*t*F-m*k*J+d*t*J+h*k*H-d*n*H;
+b.n24=h*t*y-m*n*y+m*k*C-d*t*C-h*k*D+d*n*D;b.n31=o*D*F-t*w*F+t*y*G-k*D*G-o*y*H+k*w*H;b.n32=m*w*F-e*D*F-m*y*G+d*D*G+e*y*H-d*w*H;b.n33=h*t*F-m*o*F+m*k*G-d*t*G-e*k*H+d*o*H;b.n34=m*o*y-e*t*y-m*k*w+d*t*w+e*k*D-d*o*D;b.n41=n*w*F-o*C*F-n*y*G+k*C*G+o*y*J-k*w*J;b.n42=e*C*F-h*w*F+h*y*G-d*C*G-e*y*J+d*w*J;b.n43=h*o*F-e*n*F-h*k*G+d*n*G+e*k*J-d*o*J;b.n44=e*n*y-h*o*y+h*k*w-d*n*w-e*k*C+d*o*C;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,d=b.m,e=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,m=a.n32*a.n21-a.n31*a.n22,k=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,y=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*k+a.n31*t;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*h;d[2]=a*m;d[3]=a*k;d[4]=a*o;d[5]=a*n;d[6]=a*t;d[7]=a*y;d[8]=a*w;return b};
+THREE.Matrix4.makeFrustum=function(a,b,d,e,h,m){var k;k=new THREE.Matrix4;k.n11=2*h/(b-a);k.n12=0;k.n13=(b+a)/(b-a);k.n14=0;k.n21=0;k.n22=2*h/(e-d);k.n23=(e+d)/(e-d);k.n24=0;k.n31=0;k.n32=0;k.n33=-(m+h)/(m-h);k.n34=-2*m*h/(m-h);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,d,e){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*b,a*b,h,a,d,e)};
+THREE.Matrix4.makeOrtho=function(a,b,d,e,h,m){var k,o,n,t;k=new THREE.Matrix4;o=b-a;n=d-e;t=m-h;k.n11=2/o;k.n12=0;k.n13=0;k.n14=-((b+a)/o);k.n21=0;k.n22=2/n;k.n23=0;k.n24=-((d+e)/n);k.n31=0;k.n32=0;k.n33=-2/t;k.n34=-((m+h)/t);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixNeedsUpdate=!0;this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixNeedsUpdate=!0;this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
 this.visible=!0};
 this.visible=!0};
 THREE.Object3D.prototype={addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);
 THREE.Object3D.prototype={addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);
 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))}return!0},update:function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);b=1/this.scale.x;a=1/this.scale.y;var e=1/this.scale.z;this.matrixRotationWorld.n11=this.matrixWorld.n11*b;this.matrixRotationWorld.n21=
 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))}return!0},update:function(a,b,d){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);b=1/this.scale.x;a=1/this.scale.y;var e=1/this.scale.z;this.matrixRotationWorld.n11=this.matrixWorld.n11*b;this.matrixRotationWorld.n21=
 this.matrixWorld.n21*b;this.matrixRotationWorld.n31=this.matrixWorld.n31*b;this.matrixRotationWorld.n12=this.matrixWorld.n12*a;this.matrixRotationWorld.n22=this.matrixWorld.n22*a;this.matrixRotationWorld.n32=this.matrixWorld.n32*a;this.matrixRotationWorld.n13=this.matrixWorld.n13*e;this.matrixRotationWorld.n23=this.matrixWorld.n23*e;this.matrixRotationWorld.n33=this.matrixWorld.n33*e;this.matrixNeedsUpdate=!1;b=!0}a=0;for(e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,b,d)}}};
 this.matrixWorld.n21*b;this.matrixRotationWorld.n31=this.matrixWorld.n31*b;this.matrixRotationWorld.n12=this.matrixWorld.n12*a;this.matrixRotationWorld.n22=this.matrixWorld.n22*a;this.matrixRotationWorld.n32=this.matrixWorld.n32*a;this.matrixRotationWorld.n13=this.matrixWorld.n13*e;this.matrixRotationWorld.n23=this.matrixWorld.n23*e;this.matrixRotationWorld.n33=this.matrixWorld.n33*e;this.matrixNeedsUpdate=!1;b=!0}a=0;for(e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,b,d)}}};
 THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,d,e){this.set(a||0,b||0,d||0,e!==undefined?e:1)};
 THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,d,e){this.set(a||0,b||0,d||0,e!==undefined?e:1)};
-THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,h=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-h);h=Math.sin(-h);var m=Math.cos(d);d=Math.sin(d);var j=a*b,p=e*h;this.w=j*m-p*d;this.x=j*d+p*m;this.y=e*b*m+a*h*d;this.z=a*h*m-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,h=this.w,m=a.x,j=a.y,p=a.z;a=a.w;this.x=b*a+h*m+d*p-e*j;this.y=d*a+h*j+e*m-b*p;this.z=e*a+h*p+b*j-d*m;this.w=h*a-b*m-d*j-e*p;return this},
-multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,h=a.z,m=this.x,j=this.y,p=this.z,o=this.w,t=o*d+j*h-p*e,w=o*e+p*d-m*h,v=o*h+m*e-j*d;d=-m*d-j*e-p*h;b.x=t*o+d*-m+w*-p-v*-j;b.y=w*o+d*-j+v*-m-t*-p;b.z=v*o+d*-p+t*-j-w*-m;return b}};
-THREE.Quaternion.slerp=function(a,b,d,e){var h=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(h)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var m=Math.acos(h),j=Math.sqrt(1-h*h);if(Math.abs(j)<0.001){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}h=Math.sin((1-e)*m)/j;e=Math.sin(e*m)/j;d.w=a.w*h+b.w*e;d.x=a.x*h+b.x*e;d.y=a.y*h+b.y*e;d.z=a.z*h+b.z*e;return d};
+THREE.Quaternion.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;this.w=e;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,d=a.x*b,e=a.y*b,h=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-h);h=Math.sin(-h);var m=Math.cos(d);d=Math.sin(d);var k=a*b,o=e*h;this.w=k*m-o*d;this.x=k*d+o*m;this.y=e*b*m+a*h*d;this.z=a*h*m-e*b*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,d=this.y,e=this.z,h=this.w,m=a.x,k=a.y,o=a.z;a=a.w;this.x=b*a+h*m+d*o-e*k;this.y=d*a+h*k+e*m-b*o;this.z=e*a+h*o+b*k-d*m;this.w=h*a-b*m-d*k-e*o;return this},
+multiplyVector3:function(a,b){b||(b=a);var d=a.x,e=a.y,h=a.z,m=this.x,k=this.y,o=this.z,n=this.w,t=n*d+k*h-o*e,y=n*e+o*d-m*h,w=n*h+m*e-k*d;d=-m*d-k*e-o*h;b.x=t*n+d*-m+y*-o-w*-k;b.y=y*n+d*-k+w*-m-t*-o;b.z=w*n+d*-o+t*-k-y*-m;return b}};
+THREE.Quaternion.slerp=function(a,b,d,e){var h=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(h)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.0010){d.w=0.5*(a.w+b.w);d.x=0.5*(a.x+b.x);d.y=0.5*(a.y+b.y);d.z=0.5*(a.z+b.z);return d}h=Math.sin((1-e)*m)/k;e=Math.sin(e*m)/k;d.w=a.w*h+b.w*e;d.x=a.x*h+b.x*e;d.y=a.y*h+b.y*e;d.z=a.z*h+b.z*e;return d};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};
 THREE.Face3=function(a,b,d,e,h){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=h instanceof Array?h:[h]};THREE.Face4=function(a,b,d,e,h,m){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=m instanceof Array?m:[m]};
 THREE.Face3=function(a,b,d,e,h){this.a=a;this.b=b;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=h instanceof Array?h:[h]};THREE.Face4=function(a,b,d,e,h,m){this.a=a;this.b=b;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=m instanceof Array?m:[m]};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.UV=function(a,b){this.set(a||0,b||0)};THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
 THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
-d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,h,m,j,p=new THREE.Vector3,o=new THREE.Vector3;e=0;for(h=this.vertices.length;e<h;e++){m=this.vertices[e];m.normal.set(0,0,0)}e=0;for(h=this.faces.length;e<h;e++){m=this.faces[e];if(a&&m.vertexNormals.length){p.set(0,0,0);b=0;for(d=m.normal.length;b<d;b++)p.addSelf(m.vertexNormals[b]);p.divideScalar(3)}else{b=this.vertices[m.a];d=this.vertices[m.b];j=this.vertices[m.c];p.sub(j.position,
-d.position);o.sub(b.position,d.position);p.crossSelf(o)}p.isZero()||p.normalize();m.normal.copy(p)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,h,m,k,o=new THREE.Vector3,n=new THREE.Vector3;e=0;for(h=this.vertices.length;e<h;e++){m=this.vertices[e];m.normal.set(0,0,0)}e=0;for(h=this.faces.length;e<h;e++){m=this.faces[e];if(a&&m.vertexNormals.length){o.set(0,0,0);b=0;for(d=m.normal.length;b<d;b++)o.addSelf(m.vertexNormals[b]);o.divideScalar(3)}else{b=this.vertices[m.a];d=this.vertices[m.b];k=this.vertices[m.c];o.sub(k.position,
+d.position);n.sub(b.position,d.position);o.crossSelf(n)}o.isZero()||o.normalize();m.normal.copy(o)}},computeVertexNormals:function(){var a,b,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(ka,ha,pa,sa,Ba,wa,Ea){m=ka.vertices[ha].position;j=ka.vertices[pa].position;p=ka.vertices[sa].position;o=h[Ba];t=h[wa];w=h[Ea];v=j.x-m.x;C=p.x-m.x;D=j.y-
-m.y;F=p.y-m.y;G=j.z-m.z;K=p.z-m.z;H=t.u-o.u;R=w.u-o.u;O=t.v-o.v;M=w.v-o.v;N=1/(H*M-R*O);ba.set((M*v-O*C)*N,(M*D-O*F)*N,(M*G-O*K)*N);Z.set((H*C-R*v)*N,(H*F-R*D)*N,(H*K-R*G)*N);c[ha].addSelf(ba);c[pa].addSelf(ba);c[sa].addSelf(ba);Y[ha].addSelf(Z);Y[pa].addSelf(Z);Y[sa].addSelf(Z)}var b,d,e,h,m,j,p,o,t,w,v,C,D,F,G,K,H,R,O,M,N,c=[],Y=[],ba=new THREE.Vector3,Z=new THREE.Vector3,$=new THREE.Vector3,ga=new THREE.Vector3,ja=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){c[b]=new THREE.Vector3;
-Y[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];h=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
-this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){ja.copy(this.vertices[b].normal);e=c[b];$.copy(e);$.subSelf(ja.multiplyScalar(ja.dot(e))).normalize();ga.cross(this.vertices[b].normal,e);e=ga.dot(Y[b]);e=e<0?-1:1;this.vertices[b].tangent.set($.x,$.y,$.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(la,ia,qa,ta,Ca,xa,Fa){m=la.vertices[ia].position;k=la.vertices[qa].position;o=la.vertices[ta].position;n=h[Ca];t=h[xa];y=h[Fa];w=k.x-m.x;C=o.x-m.x;D=k.y-
+m.y;F=o.y-m.y;G=k.z-m.z;J=o.z-m.z;H=t.u-n.u;R=y.u-n.u;P=t.v-n.v;L=y.v-n.v;N=1/(H*L-R*P);ca.set((L*w-P*C)*N,(L*D-P*F)*N,(L*G-P*J)*N);$.set((H*C-R*w)*N,(H*F-R*D)*N,(H*J-R*G)*N);c[ia].addSelf(ca);c[qa].addSelf(ca);c[ta].addSelf(ca);Z[ia].addSelf($);Z[qa].addSelf($);Z[ta].addSelf($)}var b,d,e,h,m,k,o,n,t,y,w,C,D,F,G,J,H,R,P,L,N,c=[],Z=[],ca=new THREE.Vector3,$=new THREE.Vector3,aa=new THREE.Vector3,ha=new THREE.Vector3,ka=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){c[b]=new THREE.Vector3;
+Z[b]=new THREE.Vector3}b=0;for(d=this.faces.length;b<d;b++){e=this.faces[b];h=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
+this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(d=this.vertices.length;b<d;b++){ka.copy(this.vertices[b].normal);e=c[b];aa.copy(e);aa.subSelf(ka.multiplyScalar(ka.dot(e))).normalize();ha.cross(this.vertices[b].normal,e);e=ha.dot(Z[b]);e=e<0?-1:1;this.vertices[b].tangent.set(aa.x,aa.y,aa.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){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 b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,d=this.vertices.length;b<d;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
 this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.Camera=function(a,b,d,e,h){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=e||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(m,j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(m);this.tmpVec.crossSelf(this.up);if(j)this.tmpVec.y=0;this.position.addSelf(this.tmpVec);
-this.target.position.addSelf(this.tmpVec)};this.translateZ=function(m,j){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(m);if(j)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera=function(a,b,d,e,h){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=d||0.1;this.far=e||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(m,k){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(m);this.tmpVec.crossSelf(this.up);if(k)this.tmpVec.y=0;this.position.addSelf(this.tmpVec);
+this.target.position.addSelf(this.tmpVec)};this.translateZ=function(m,k){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(m);if(k)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
 THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,
 THREE.Camera.prototype.update=function(a,b,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,
 this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
 this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
@@ -111,76 +111,77 @@ THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)th
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
 THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,d){d&&a.update(undefined,!1,b);d=a.sounds;var e,h=d.length;for(e=0;e<h;e++){a=d[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,d){d&&a.update(undefined,!1,b);d=a.sounds;var e,h=d.length;for(e=0;e<h;e++){a=d[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
-THREE.WebGLRenderer=function(a){function b(f,k,i){var g,l,n,y=f.vertices,u=y.length,r=f.colors,z=r.length,x=f.__vertexArray,P=f.__colorArray,Q=f.__sortArray,I=f.__dirtyVertices,J=f.__dirtyColors;if(i.sortParticles){pa.multiplySelf(i.matrixWorld);for(g=0;g<u;g++){l=y[g].position;wa.copy(l);pa.multiplyVector3(wa);Q[g]=[wa.z,g]}Q.sort(function(L,ca){return ca[0]-L[0]});for(g=0;g<u;g++){l=y[Q[g][1]].position;n=g*3;x[n]=l.x;x[n+1]=l.y;x[n+2]=l.z}for(g=0;g<z;g++){n=g*3;color=r[Q[g][1]];P[n]=color.r;P[n+
-1]=color.g;P[n+2]=color.b}}else{if(I)for(g=0;g<u;g++){l=y[g].position;n=g*3;x[n]=l.x;x[n+1]=l.y;x[n+2]=l.z}if(J)for(g=0;g<z;g++){color=r[g];n=g*3;P[n]=color.r;P[n+1]=color.g;P[n+2]=color.b}}if(I||i.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,x,k)}if(J||i.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,P,k)}}function d(f,k){f.fragmentShader=k.fragmentShader;f.vertexShader=k.vertexShader;f.uniforms=Uniforms.clone(k.uniforms)}
-function e(f,k,i,g,l){g.program||Z.initMaterial(g,k,i);var n=g.program,y=n.uniforms,u=g.uniforms;if(n!=Y){c.useProgram(n);Y=n;c.uniformMatrix4fv(y.projectionMatrix,!1,sa)}if(i&&(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial||g instanceof THREE.LineBasicMaterial||g instanceof THREE.ParticleBasicMaterial)){u.fogColor.value.setHex(i.color.hex);if(i instanceof THREE.Fog){u.fogNear.value=i.near;u.fogFar.value=i.far}else if(i instanceof
-THREE.FogExp2)u.fogDensity.value=i.density}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial){var r,z,x=0,P=0,Q=0,I,J,L,ca=Z.lights,s=ca.directional.colors,la=ca.directional.positions,da=ca.point.colors,ma=ca.point.positions,A=0,B=0;i=z=z=0;for(r=k.length;i<r;i++){z=k[i];I=z.color;J=z.position;L=z.intensity;if(z instanceof THREE.AmbientLight){x+=I.r;P+=I.g;Q+=I.b}else if(z instanceof THREE.DirectionalLight){z=A*3;s[z]=I.r*L;s[z+1]=I.g*L;s[z+2]=I.b*L;la[z]=J.x;la[z+1]=
-J.y;la[z+2]=J.z;A+=1}else if(z instanceof THREE.PointLight){z=B*3;da[z]=I.r*L;da[z+1]=I.g*L;da[z+2]=I.b*L;ma[z]=J.x;ma[z+1]=J.y;ma[z+2]=J.z;B+=1}}for(i=A*3;i<s.length;i++)s[i]=0;for(i=B*3;i<da.length;i++)da[i]=0;ca.point.length=B;ca.directional.length=A;ca.ambient[0]=x;ca.ambient[1]=P;ca.ambient[2]=Q;k=Z.lights;u.enableLighting.value=k.directional.length+k.point.length;u.ambientLightColor.value=k.ambient;u.directionalLightColor.value=k.directional.colors;u.directionalLightDirection.value=k.directional.positions;
-u.pointLightColor.value=k.point.colors;u.pointLightPosition.value=k.point.positions}if(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial){u.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);u.opacity.value=g.opacity;u.map.texture=g.map;u.lightMap.texture=g.lightMap;u.envMap.texture=g.envMap;u.reflectivity.value=g.reflectivity;u.refractionRatio.value=g.refractionRatio;u.combine.value=g.combine;u.useRefract.value=
-g.envMap&&g.envMap.mapping instanceof THREE.CubeRefractionMapping}if(g instanceof THREE.LineBasicMaterial){u.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);u.opacity.value=g.opacity}else if(g instanceof THREE.ParticleBasicMaterial){u.psColor.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);u.opacity.value=g.opacity;u.size.value=g.size;u.map.texture=g.map}else if(g instanceof THREE.MeshPhongMaterial){u.ambient.value.setRGB(g.ambient.r,g.ambient.g,
-g.ambient.b);u.specular.value.setRGB(g.specular.r,g.specular.g,g.specular.b);u.shininess.value=g.shininess}else if(g instanceof THREE.MeshDepthMaterial){u.mNear.value=f.near;u.mFar.value=f.far;u.opacity.value=g.opacity}else if(g instanceof THREE.MeshNormalMaterial)u.opacity.value=g.opacity;for(var E in u)if(x=n.uniforms[E]){i=u[E];r=i.type;k=i.value;if(r=="i")c.uniform1i(x,k);else if(r=="f")c.uniform1f(x,k);else if(r=="fv1")c.uniform1fv(x,k);else if(r=="fv")c.uniform3fv(x,k);else if(r=="v2")c.uniform2f(x,
-k.x,k.y);else if(r=="v3")c.uniform3f(x,k.x,k.y,k.z);else if(r=="c")c.uniform3f(x,k.r,k.g,k.b);else if(r=="t"){c.uniform1i(x,k);if(i=i.texture)if(i.image instanceof Array&&i.image.length==6){if(i.image.length==6){if(i.needsUpdate){if(!i.image.__webGLTextureCube)i.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,i.image.__webGLTextureCube);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);
-c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(r=0;r<6;++r)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,i.image[r]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);i.needsUpdate=!1}c.activeTexture(c.TEXTURE0+k);c.bindTexture(c.TEXTURE_CUBE_MAP,i.image.__webGLTextureCube)}}else{if(i.needsUpdate){if(i.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,
-i.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,i.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,M(i.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,M(i.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,M(i.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,M(i.minFilter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}else{i.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,i.__webGLTexture);c.texImage2D(c.TEXTURE_2D,
-0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,i.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,M(i.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,M(i.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,M(i.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,M(i.minFilter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null);i.__wasSetOnce=!0}i.needsUpdate=!1}c.activeTexture(c.TEXTURE0+k);c.bindTexture(c.TEXTURE_2D,i.__webGLTexture)}}}c.uniformMatrix4fv(y.modelViewMatrix,
-!1,l._modelViewMatrixArray);c.uniformMatrix3fv(y.normalMatrix,!1,l._normalMatrixArray);(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.envMap)&&c.uniform3f(y.cameraPosition,f.position.x,f.position.y,f.position.z);(g instanceof THREE.MeshShaderMaterial||g.envMap||g.skinning)&&c.uniformMatrix4fv(y.objectMatrix,!1,l._objectMatrixArray);(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial||g.skinning)&&c.uniformMatrix4fv(y.viewMatrix,
-!1,Ba);if(g.skinning){c.uniformMatrix4fv(y.cameraInverseMatrix,!1,Ba);c.uniformMatrix4fv(y.boneGlobalMatrices,!1,l.boneMatrices)}return n}function h(f,k,i,g,l,n){f=e(f,k,i,g,n).attributes;c.bindBuffer(c.ARRAY_BUFFER,l.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0);if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,
-3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(l.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(l.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);
-if(g.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,l.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,l.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,l.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,
-4,c.FLOAT,!1,0,0)}if(n instanceof THREE.Mesh)if(g.wireframe){c.lineWidth(g.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,l.__webGLLineBuffer);c.drawElements(c.LINES,l.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,l.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,l.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(n instanceof THREE.Line){n=n.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(g.linewidth);c.drawArrays(n,0,l.__webGLLineCount)}else if(n instanceof
-THREE.ParticleSystem)c.drawArrays(c.POINTS,0,l.__webGLParticleCount);else n instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,l.__webGLVertexCount)}function m(f,k){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(k.attributes.position);c.vertexAttribPointer(k.attributes.position,
-3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(k.attributes.normal);c.vertexAttribPointer(k.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function j(f){if($!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);$=f.doubleSided}if(ga!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);ga=f.flipSided}}function p(f){if(ka!=
-f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);ka=f}}function o(f){ha[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);ha[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);ha[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);ha[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);ha[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);ha[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var k;for(f=0;f<6;f++){k=ha[f];k.divideScalar(Math.sqrt(k.x*k.x+k.y*k.y+k.z*
-k.z))}}function t(f){for(var k=f.matrixWorld,i=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),g=0;g<6;g++){f=ha[g].x*k.n14+ha[g].y*k.n24+ha[g].z*k.n34+ha[g].w;if(f<=i)return!1}return!0}function w(f,k){f.list[f.count]=k;f.count+=1}function v(f){var k,i,g=f.object,l=f.opaque,n=f.transparent;n.count=0;f=l.count=0;for(k=g.materials.length;f<k;f++){i=g.materials[f];i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?w(n,i):w(l,i)}}function C(f){var k,i,g,l,n=f.object,
-y=f.buffer,u=f.opaque,r=f.transparent;r.count=0;f=u.count=0;for(g=n.materials.length;f<g;f++){k=n.materials[f];if(k instanceof THREE.MeshFaceMaterial){k=0;for(i=y.materials.length;k<i;k++)(l=y.materials[k])&&(l.opacity&&l.opacity<1||l.blending!=THREE.NormalBlending?w(r,l):w(u,l))}else{l=k;l.opacity&&l.opacity<1||l.blending!=THREE.NormalBlending?w(r,l):w(u,l)}}}function D(f,k){return k.z-f.z}function F(f,k){f._modelViewMatrix.multiplyToArray(k.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);
-THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function G(f){function k(P){var Q=[];i=0;for(g=P.length;i<g;i++)P[i]==undefined?Q.push("undefined"):Q.push(P[i].id);return Q.join("_")}var i,g,l,n,y,u,r,z,x={};f.geometryGroups={};l=0;for(n=f.faces.length;l<n;l++){y=f.faces[l];u=y.materials;r=k(u);x[r]==undefined&&(x[r]={hash:r,counter:0});z=x[r].hash+"_"+x[r].counter;f.geometryGroups[z]==undefined&&(f.geometryGroups[z]={faces:[],materials:u,vertices:0});y=y instanceof
-THREE.Face3?3:4;if(f.geometryGroups[z].vertices+y>65535){x[r].counter+=1;z=x[r].hash+"_"+x[r].counter;f.geometryGroups[z]==undefined&&(f.geometryGroups[z]={faces:[],materials:u,vertices:0})}f.geometryGroups[z].faces.push(l);f.geometryGroups[z].vertices+=y}}function K(f,k,i){f.push({buffer:k,object:i,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function H(f){if(f!=ja){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,
-c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}ja=f}}function R(f,k){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=c.createFramebuffer();f.__webGLRenderbuffer=c.createRenderbuffer();f.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,
-f.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.bindTexture(c.TEXTURE_2D,f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,M(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,M(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,M(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,M(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,M(f.format),f.width,f.height,0,M(f.format),M(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,
-f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var i,g,l;if(f){i=f.__webGLFramebuffer;g=f.width;l=f.height}else{i=null;g=N.width;l=N.height}if(i!=ba){c.bindFramebuffer(c.FRAMEBUFFER,i);c.viewport(0,0,g,l);k&&c.clear(c.COLOR_BUFFER_BIT|
-c.DEPTH_BUFFER_BIT);ba=i}}function O(f,k){var i;if(f=="fragment")i=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(i=c.createShader(c.VERTEX_SHADER));c.shaderSource(i,k);c.compileShader(i);if(!c.getShaderParameter(i,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(i));return null}return i}function M(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;
+THREE.WebGLRenderer=function(a){function b(f,l,i){var g,j,p,u=f.vertices,x=u.length,z=f.colors,v=z.length,r=f.__vertexArray,K=f.__colorArray,O=f.__sortArray,M=f.__dirtyVertices,I=f.__dirtyColors;if(i.sortParticles){qa.multiplySelf(i.matrixWorld);for(g=0;g<x;g++){j=u[g].position;xa.copy(j);qa.multiplyVector3(xa);O[g]=[xa.z,g]}O.sort(function(Q,da){return da[0]-Q[0]});for(g=0;g<x;g++){j=u[O[g][1]].position;p=g*3;r[p]=j.x;r[p+1]=j.y;r[p+2]=j.z}for(g=0;g<v;g++){p=g*3;color=z[O[g][1]];K[p]=color.r;K[p+
+1]=color.g;K[p+2]=color.b}}else{if(M)for(g=0;g<x;g++){j=u[g].position;p=g*3;r[p]=j.x;r[p+1]=j.y;r[p+2]=j.z}if(I)for(g=0;g<v;g++){color=z[g];p=g*3;K[p]=color.r;K[p+1]=color.g;K[p+2]=color.b}}if(M||i.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,r,l)}if(I||i.sortParticles){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,K,l)}}function d(f,l){f.fragmentShader=l.fragmentShader;f.vertexShader=l.vertexShader;f.uniforms=Uniforms.clone(l.uniforms)}
+function e(f,l,i,g,j){g.program||$.initMaterial(g,l,i);var p=g.program,u=p.uniforms,x=g.uniforms;if(p!=Z){c.useProgram(p);Z=p;c.uniformMatrix4fv(u.projectionMatrix,!1,ta)}if(i&&(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial||g instanceof THREE.LineBasicMaterial||g instanceof THREE.ParticleBasicMaterial)){x.fogColor.value.setHex(i.color.hex);if(i instanceof THREE.Fog){x.fogNear.value=i.near;x.fogFar.value=i.far}else if(i instanceof
+THREE.FogExp2)x.fogDensity.value=i.density}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial){var z,v,r=0,K=0,O=0,M,I,Q,da=$.lights,s=da.directional.colors,ma=da.directional.positions,ea=da.point.colors,na=da.point.positions,A=0,B=0;i=v=v=0;for(z=l.length;i<z;i++){v=l[i];M=v.color;I=v.position;Q=v.intensity;if(v instanceof THREE.AmbientLight){r+=M.r;K+=M.g;O+=M.b}else if(v instanceof THREE.DirectionalLight){v=A*3;s[v]=M.r*Q;s[v+1]=M.g*Q;s[v+2]=M.b*Q;ma[v]=I.x;ma[v+1]=
+I.y;ma[v+2]=I.z;A+=1}else if(v instanceof THREE.PointLight){v=B*3;ea[v]=M.r*Q;ea[v+1]=M.g*Q;ea[v+2]=M.b*Q;na[v]=I.x;na[v+1]=I.y;na[v+2]=I.z;B+=1}}for(i=A*3;i<s.length;i++)s[i]=0;for(i=B*3;i<ea.length;i++)ea[i]=0;da.point.length=B;da.directional.length=A;da.ambient[0]=r;da.ambient[1]=K;da.ambient[2]=O;l=$.lights;x.enableLighting.value=l.directional.length+l.point.length;x.ambientLightColor.value=l.ambient;x.directionalLightColor.value=l.directional.colors;x.directionalLightDirection.value=l.directional.positions;
+x.pointLightColor.value=l.point.colors;x.pointLightPosition.value=l.point.positions}if(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial){x.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);x.opacity.value=g.opacity;x.map.texture=g.map;x.lightMap.texture=g.lightMap;x.envMap.texture=g.envMap;x.reflectivity.value=g.reflectivity;x.refractionRatio.value=g.refractionRatio;x.combine.value=g.combine;x.useRefract.value=
+g.envMap&&g.envMap.mapping instanceof THREE.CubeRefractionMapping}if(g instanceof THREE.LineBasicMaterial){x.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);x.opacity.value=g.opacity}else if(g instanceof THREE.ParticleBasicMaterial){x.psColor.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);x.opacity.value=g.opacity;x.size.value=g.size;x.map.texture=g.map}else if(g instanceof THREE.MeshPhongMaterial){x.ambient.value.setRGB(g.ambient.r,g.ambient.g,
+g.ambient.b);x.specular.value.setRGB(g.specular.r,g.specular.g,g.specular.b);x.shininess.value=g.shininess}else if(g instanceof THREE.MeshDepthMaterial){x.mNear.value=f.near;x.mFar.value=f.far;x.opacity.value=g.opacity}else if(g instanceof THREE.MeshNormalMaterial)x.opacity.value=g.opacity;for(var E in x)if(r=p.uniforms[E]){i=x[E];z=i.type;l=i.value;if(z=="i")c.uniform1i(r,l);else if(z=="f")c.uniform1f(r,l);else if(z=="fv1")c.uniform1fv(r,l);else if(z=="fv")c.uniform3fv(r,l);else if(z=="v2")c.uniform2f(r,
+l.x,l.y);else if(z=="v3")c.uniform3f(r,l.x,l.y,l.z);else if(z=="c")c.uniform3f(r,l.r,l.g,l.b);else if(z=="t"){c.uniform1i(r,l);if(i=i.texture)if(i.image instanceof Array&&i.image.length==6){if(i.image.length==6){if(i.needsUpdate){if(!i.image.__webGLTextureCube)i.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,i.image.__webGLTextureCube);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);
+c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(z=0;z<6;++z)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+z,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,i.image[z]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);i.needsUpdate=!1}c.activeTexture(c.TEXTURE0+l);c.bindTexture(c.TEXTURE_CUBE_MAP,i.image.__webGLTextureCube)}}else{if(i.needsUpdate){if(i.__wasSetOnce){c.bindTexture(c.TEXTURE_2D,
+i.__webGLTexture);c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,i.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,L(i.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,L(i.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,L(i.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,L(i.minFilter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}else{i.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,i.__webGLTexture);c.texImage2D(c.TEXTURE_2D,
+0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,i.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,L(i.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,L(i.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,L(i.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,L(i.minFilter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null);i.__wasSetOnce=!0}i.needsUpdate=!1}c.activeTexture(c.TEXTURE0+l);c.bindTexture(c.TEXTURE_2D,i.__webGLTexture)}}}c.uniformMatrix4fv(u.modelViewMatrix,
+!1,j._modelViewMatrixArray);c.uniformMatrix3fv(u.normalMatrix,!1,j._normalMatrixArray);(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.envMap)&&c.uniform3f(u.cameraPosition,f.position.x,f.position.y,f.position.z);(g instanceof THREE.MeshShaderMaterial||g.envMap||g.skinning)&&c.uniformMatrix4fv(u.objectMatrix,!1,j._objectMatrixArray);(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial||g.skinning)&&c.uniformMatrix4fv(u.viewMatrix,
+!1,Ca);if(g.skinning){c.uniformMatrix4fv(u.cameraInverseMatrix,!1,Ca);c.uniformMatrix4fv(u.boneGlobalMatrices,!1,j.boneMatrices)}return p}function h(f,l,i,g,j,p){f=e(f,l,i,g,p).attributes;c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);c.vertexAttribPointer(f.position,3,c.FLOAT,!1,0,0);if(f.color>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLColorBuffer);c.vertexAttribPointer(f.color,3,c.FLOAT,!1,0,0)}if(f.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLNormalBuffer);c.vertexAttribPointer(f.normal,
+3,c.FLOAT,!1,0,0)}if(f.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLTangentBuffer);c.vertexAttribPointer(f.tangent,4,c.FLOAT,!1,0,0)}if(f.uv>=0)if(j.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLUVBuffer);c.vertexAttribPointer(f.uv,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv)}else c.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(j.__webGLUV2Buffer){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLUV2Buffer);c.vertexAttribPointer(f.uv2,2,c.FLOAT,!1,0,0);c.enableVertexAttribArray(f.uv2)}else c.disableVertexAttribArray(f.uv2);
+if(g.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinVertexABuffer);c.vertexAttribPointer(f.skinVertexA,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinVertexBBuffer);c.vertexAttribPointer(f.skinVertexB,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinIndicesBuffer);c.vertexAttribPointer(f.skinIndex,4,c.FLOAT,!1,0,0);c.bindBuffer(c.ARRAY_BUFFER,j.__webGLSkinWeightsBuffer);c.vertexAttribPointer(f.skinWeight,
+4,c.FLOAT,!1,0,0)}if(p instanceof THREE.Mesh)if(g.wireframe){c.lineWidth(g.wireframeLinewidth);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);c.drawElements(c.LINES,j.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,j.__webGLFaceCount,c.UNSIGNED_SHORT,0)}else if(p instanceof THREE.Line){p=p.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(g.linewidth);c.drawArrays(p,0,j.__webGLLineCount)}else if(p instanceof
+THREE.ParticleSystem)c.drawArrays(c.POINTS,0,j.__webGLParticleCount);else p instanceof THREE.Ribbon&&c.drawArrays(c.TRIANGLE_STRIP,0,j.__webGLVertexCount)}function m(f,l){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=c.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=c.createBuffer();if(f.hasPos){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,f.positionArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(l.attributes.position);c.vertexAttribPointer(l.attributes.position,
+3,c.FLOAT,!1,0,0)}if(f.hasNormal){c.bindBuffer(c.ARRAY_BUFFER,f.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,f.normalArray,c.DYNAMIC_DRAW);c.enableVertexAttribArray(l.attributes.normal);c.vertexAttribPointer(l.attributes.normal,3,c.FLOAT,!1,0,0)}c.drawArrays(c.TRIANGLES,0,f.count);f.count=0}function k(f){if(aa!=f.doubleSided){f.doubleSided?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE);aa=f.doubleSided}if(ha!=f.flipSided){f.flipSided?c.frontFace(c.CW):c.frontFace(c.CCW);ha=f.flipSided}}function o(f){if(la!=
+f){f?c.enable(c.DEPTH_TEST):c.disable(c.DEPTH_TEST);la=f}}function n(f){ia[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);ia[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);ia[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);ia[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);ia[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);ia[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var l;for(f=0;f<6;f++){l=ia[f];l.divideScalar(Math.sqrt(l.x*l.x+l.y*l.y+l.z*
+l.z))}}function t(f){for(var l=f.matrixWorld,i=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),g=0;g<6;g++){f=ia[g].x*l.n14+ia[g].y*l.n24+ia[g].z*l.n34+ia[g].w;if(f<=i)return!1}return!0}function y(f,l){f.list[f.count]=l;f.count+=1}function w(f){var l,i,g=f.object,j=f.opaque,p=f.transparent;p.count=0;f=j.count=0;for(l=g.materials.length;f<l;f++){i=g.materials[f];i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?y(p,i):y(j,i)}}function C(f){var l,i,g,j,p=f.object,
+u=f.buffer,x=f.opaque,z=f.transparent;z.count=0;f=x.count=0;for(g=p.materials.length;f<g;f++){l=p.materials[f];if(l instanceof THREE.MeshFaceMaterial){l=0;for(i=u.materials.length;l<i;l++)(j=u.materials[l])&&(j.opacity&&j.opacity<1||j.blending!=THREE.NormalBlending?y(z,j):y(x,j))}else{j=l;j.opacity&&j.opacity<1||j.blending!=THREE.NormalBlending?y(z,j):y(x,j)}}}function D(f,l){return l.z-f.z}function F(f,l){f._modelViewMatrix.multiplyToArray(l.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);
+THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function G(f){function l(K){var O=[];i=0;for(g=K.length;i<g;i++)K[i]==undefined?O.push("undefined"):O.push(K[i].id);return O.join("_")}var i,g,j,p,u,x,z,v,r={};f.geometryGroups={};j=0;for(p=f.faces.length;j<p;j++){u=f.faces[j];x=u.materials;z=l(x);r[z]==undefined&&(r[z]={hash:z,counter:0});v=r[z].hash+"_"+r[z].counter;f.geometryGroups[v]==undefined&&(f.geometryGroups[v]={faces:[],materials:x,vertices:0});u=u instanceof
+THREE.Face3?3:4;if(f.geometryGroups[v].vertices+u>65535){r[z].counter+=1;v=r[z].hash+"_"+r[z].counter;f.geometryGroups[v]==undefined&&(f.geometryGroups[v]={faces:[],materials:x,vertices:0})}f.geometryGroups[v].faces.push(j);f.geometryGroups[v].vertices+=u}}function J(f,l,i){f.push({buffer:l,object:i,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function H(f){if(f!=ka){switch(f){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,
+c.ZERO);break;case THREE.BillboardBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.SRC_ALPHA,c.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:c.blendEquation(c.FUNC_REVERSE_SUBTRACT);c.blendFunc(c.ONE,c.ONE);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}ka=f}}function R(f,l){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=c.createFramebuffer();f.__webGLRenderbuffer=c.createRenderbuffer();f.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,
+f.__webGLRenderbuffer);c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,f.width,f.height);c.bindTexture(c.TEXTURE_2D,f.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,L(f.wrapS));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,L(f.wrapT));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,L(f.magFilter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,L(f.minFilter));c.texImage2D(c.TEXTURE_2D,0,L(f.format),f.width,f.height,0,L(f.format),L(f.type),null);c.bindFramebuffer(c.FRAMEBUFFER,
+f.__webGLFramebuffer);c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,f.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,f.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}var i,g,j;if(f){i=f.__webGLFramebuffer;g=f.width;j=f.height}else{i=null;g=N.width;j=N.height}if(i!=ca){c.bindFramebuffer(c.FRAMEBUFFER,i);c.viewport(0,0,g,j);l&&c.clear(c.COLOR_BUFFER_BIT|
+c.DEPTH_BUFFER_BIT);ca=i}}function P(f,l){var i;if(f=="fragment")i=c.createShader(c.FRAGMENT_SHADER);else f=="vertex"&&(i=c.createShader(c.VERTEX_SHADER));c.shaderSource(i,l);c.compileShader(i);if(!c.getShaderParameter(i,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(i));return null}return i}function L(f){switch(f){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;case THREE.NearestFilter:return c.NEAREST;
 case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;
 case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;case THREE.IntType:return c.INT;
-case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var N=document.createElement("canvas"),c,Y=null,ba=null,Z=this,$=null,ga=null,ja=null,ka=null,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],
-pa=new THREE.Matrix4,sa=new Float32Array(16),Ba=new Float32Array(16),wa=new THREE.Vector4,Ea=!0,Ka=new THREE.Color(0),La=0;if(a){if(a.antialias!==undefined)Ea=a.antialias;a.clearColor!==undefined&&Ka.setHex(a.clearColor);if(a.clearAlpha!==undefined)La=a.clearAlpha}this.domElement=N;this.autoClear=!0;this.sortObjects=!1;(function(f,k,i){try{c=N.getContext("experimental-webgl",{antialias:f})}catch(g){console.log(g)}if(!c)throw"cannot create webgl context";c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);
-c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(k.r,k.g,k.b,i);_cullEnabled=!0})(Ea,Ka,La);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,k){N.width=f;N.height=k;c.viewport(0,0,N.width,N.height)};this.setClearColorHex=function(f,k){var i=new THREE.Color(f);c.clearColor(i.r,i.g,i.b,k)};this.setClearColor=
-function(f,k){c.clearColor(f.r,f.g,f.b,k)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,k,i){var g,l;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);
-else if(f instanceof THREE.LineBasicMaterial)d(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);var n,y,u,r;l=u=r=0;for(n=k.length;l<n;l++){y=k[l];y instanceof THREE.DirectionalLight&&u++;y instanceof THREE.PointLight&&r++}if(r+u<=4)k=u;else{k=Math.ceil(4*u/(r+u));r=4-k}l={directional:k,point:r};r=f.fragmentShader;k=f.vertexShader;n={fog:i,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,skinning:f.skinning,maxDirLights:l.directional,
-maxPointLights:l.point};i=c.createProgram();l=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,n.fog?"#define USE_FOG":"",n.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");n=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
-0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+n.maxDirLights,"#define MAX_POINT_LIGHTS "+n.maxPointLights,n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.lightMap?"#define USE_LIGHTMAP":"",n.vertexColors?"#define USE_COLOR":"",n.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-c.attachShader(i,O("fragment",l+r));c.attachShader(i,O("vertex",n+k));c.linkProgram(i);c.getProgramParameter(i,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(i,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");i.uniforms={};i.attributes={};f.program=i;i=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(g in f.uniforms)i.push(g);g=f.program;r=0;for(k=i.length;r<
-k;r++){l=i[r];g.uniforms[l]=c.getUniformLocation(g,l)}g=f.program;i=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];r=0;for(k=i.length;r<k;r++){l=i[r];g.attributes[l]=c.getAttribLocation(g,l)}g=f.program.attributes;c.enableVertexAttribArray(g.position);g.color>=0&&c.enableVertexAttribArray(g.color);g.normal>=0&&c.enableVertexAttribArray(g.normal);g.tangent>=0&&c.enableVertexAttribArray(g.tangent);if(f.skinning&&g.skinVertexA>=0&&g.skinVertexB>=
-0&&g.skinIndex>=0&&g.skinWeight>=0){c.enableVertexAttribArray(g.skinVertexA);c.enableVertexAttribArray(g.skinVertexB);c.enableVertexAttribArray(g.skinIndex);c.enableVertexAttribArray(g.skinWeight)}};this.render=function(f,k,i,g){var l,n,y,u,r,z,x,P,Q=f.lights,I=f.fog;k.matrixAutoUpdate&&k.update();k.matrixWorldInverse.flattenToArray(Ba);k.projectionMatrix.flattenToArray(sa);pa.multiply(k.projectionMatrix,k.matrixWorldInverse);o(pa);THREE.AnimationHandler&&THREE.AnimationHandler.update();f.update(undefined,
-!1,k);this.initWebGLObjects(f,k);R(i,g!==undefined?g:!0);this.autoClear&&this.clear();r=f.__webglObjects.length;for(g=0;g<r;g++){l=f.__webglObjects[g];x=l.object;if(x.visible)if(!(x instanceof THREE.Mesh)||t(x)){x.matrixWorld.flattenToArray(x._objectMatrixArray);F(x,k);C(l);l.render=!0;if(this.sortObjects){wa.copy(x.position);pa.multiplyVector3(wa);l.z=wa.z}}else l.render=!1;else l.render=!1}this.sortObjects&&f.__webglObjects.sort(D);z=f.__webglObjectsImmediate.length;for(g=0;g<z;g++){l=f.__webglObjectsImmediate[g];
-x=l.object;if(x.visible){x.matrixAutoUpdate&&x.matrixWorld.flattenToArray(x._objectMatrixArray);F(x,k);v(l)}}H(THREE.NormalBlending);for(g=0;g<r;g++){l=f.__webglObjects[g];if(l.render){x=l.object;P=l.buffer;y=l.opaque;j(x);for(l=0;l<y.count;l++){u=y.list[l];p(u.depthTest);h(k,Q,I,u,P,x)}}}for(g=0;g<z;g++){l=f.__webglObjectsImmediate[g];x=l.object;if(x.visible){y=l.opaque;j(x);for(l=0;l<y.count;l++){u=y.list[l];p(u.depthTest);n=e(k,Q,I,u,x);x.render(function(J){m(J,n)})}}}for(g=0;g<r;g++){l=f.__webglObjects[g];
-if(l.render){x=l.object;P=l.buffer;y=l.transparent;j(x);for(l=0;l<y.count;l++){u=y.list[l];H(u.blending);p(u.depthTest);h(k,Q,I,u,P,x)}}}for(g=0;g<z;g++){l=f.__webglObjectsImmediate[g];x=l.object;if(x.visible){y=l.transparent;j(x);for(l=0;l<y.count;l++){u=y.list[l];H(u.blending);p(u.depthTest);n=e(k,Q,I,u,x);x.render(function(J){m(J,n)})}}}if(i&&i.minFilter!==THREE.NearestFilter&&i.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,i.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,
-null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[]}for(;f.__objectsRemoved.length;){var k=f.__objectsRemoved[0],i=f,g=void 0,l=void 0;for(g=i.__webglObjects.length-1;g>=0;g--){l=i.__webglObjects[g].object;k==l&&i.__webglObjects.splice(g,1)}f.__objectsRemoved.splice(0,1)}for(;f.__objectsAdded.length;){k=f.__objectsAdded[0];var n=f;g=void 0;i=void 0;l=void 0;if(k._modelViewMatrix==undefined){k._modelViewMatrix=new THREE.Matrix4;k._normalMatrixArray=
-new Float32Array(9);k._modelViewMatrixArray=new Float32Array(16);k._objectMatrixArray=new Float32Array(16);k.matrixWorld.flattenToArray(k._objectMatrixArray)}objlist=n.__webglObjects;if(k instanceof THREE.Mesh){i=k.geometry;i.geometryGroups==undefined&&G(i);for(g in i.geometryGroups){l=i.geometryGroups[g];if(!l.__webGLVertexBuffer){n=l;n.__webGLVertexBuffer=c.createBuffer();n.__webGLNormalBuffer=c.createBuffer();n.__webGLTangentBuffer=c.createBuffer();n.__webGLColorBuffer=c.createBuffer();n.__webGLUVBuffer=
-c.createBuffer();n.__webGLUV2Buffer=c.createBuffer();n.__webGLSkinVertexABuffer=c.createBuffer();n.__webGLSkinVertexBBuffer=c.createBuffer();n.__webGLSkinIndicesBuffer=c.createBuffer();n.__webGLSkinWeightsBuffer=c.createBuffer();n.__webGLFaceBuffer=c.createBuffer();n.__webGLLineBuffer=c.createBuffer();n=l;var y=k,u=void 0,r=void 0,z=0,x=0,P=0,Q=y.geometry.faces,I=n.faces;u=0;for(r=I.length;u<r;u++){fi=I[u];face=Q[fi];if(face instanceof THREE.Face3){z+=3;x+=1;P+=3}else if(face instanceof THREE.Face4){z+=
-4;x+=2;P+=4}}n.__vertexArray=new Float32Array(z*3);n.__normalArray=new Float32Array(z*3);n.__tangentArray=new Float32Array(z*4);n.__colorArray=new Float32Array(z*3);n.__uvArray=new Float32Array(z*2);n.__uv2Array=new Float32Array(z*2);n.__skinVertexAArray=new Float32Array(z*4);n.__skinVertexBArray=new Float32Array(z*4);n.__skinIndexArray=new Float32Array(z*4);n.__skinWeightArray=new Float32Array(z*4);n.__faceArray=new Uint16Array(x*3);n.__lineArray=new Uint16Array(P*2);r=u=n;z=void 0;Q=void 0;var J=
-void 0,L=void 0;J=void 0;I=!1;z=0;for(Q=y.materials.length;z<Q;z++){J=y.materials[z];if(J instanceof THREE.MeshFaceMaterial){J=0;for(L=r.materials.length;J<L;J++)if(r.materials[J]&&r.materials[J].shading!=undefined&&r.materials[J].shading==THREE.SmoothShading){I=!0;break}}else if(J&&J.shading!=undefined&&J.shading==THREE.SmoothShading){I=!0;break}if(I)break}u.__needsSmoothNormals=I;n.__webGLFaceCount=x*3;n.__webGLLineCount=P*2;i.__dirtyVertices=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=
-!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}if(i.__dirtyVertices||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents){n=l;x=c.DYNAMIC_DRAW;P=void 0;u=void 0;var ca=void 0,s=void 0,la=void 0,da=void 0,ma=void 0;ca=void 0;var A=void 0,B=void 0,E=void 0,S=void 0;A=void 0;B=void 0;E=void 0;s=void 0;A=void 0;B=void 0;E=void 0;S=void 0;A=void 0;B=void 0;E=void 0;S=void 0;A=void 0;B=void 0;E=void 0;S=void 0;A=void 0;B=void 0;E=void 0;S=void 0;A=void 0;B=void 0;E=void 0;
-S=void 0;s=void 0;da=void 0;la=void 0;ma=void 0;var na=L=J=I=Q=z=y=r=0,aa=0,q=0,ea=n.__vertexArray,Ca=n.__uvArray,Da=n.__uv2Array,ra=n.__normalArray,T=n.__tangentArray,fa=n.__colorArray,U=n.__skinVertexAArray,V=n.__skinVertexBArray,W=n.__skinIndexArray,X=n.__skinWeightArray,ta=n.__faceArray,oa=n.__lineArray,Ma=n.__needsSmoothNormals,ia=k.geometry,Fa=ia.__dirtyVertices,Ga=ia.__dirtyElements,Aa=ia.__dirtyUvs,Ha=ia.__dirtyNormals,Ia=ia.__dirtyTangents,Ja=ia.__dirtyColors,qa=ia.vertices,Na=n.faces,Oa=
-ia.faces,Pa=ia.uvs,Qa=ia.uvs2,ua=ia.colors,xa=ia.skinVerticesA,ya=ia.skinVerticesB,za=ia.skinIndices,va=ia.skinWeights;P=0;for(u=Na.length;P<u;P++){ca=Na[P];s=Oa[ca];ma=Pa[ca];ca=Qa[ca];la=s.vertexNormals;da=s.normal;if(s instanceof THREE.Face3){if(Fa){A=qa[s.a].position;B=qa[s.b].position;E=qa[s.c].position;ea[y]=A.x;ea[y+1]=A.y;ea[y+2]=A.z;ea[y+3]=B.x;ea[y+4]=B.y;ea[y+5]=B.z;ea[y+6]=E.x;ea[y+7]=E.y;ea[y+8]=E.z;y+=9}if(va.length){A=va[s.a];B=va[s.b];E=va[s.c];X[q]=A.x;X[q+1]=A.y;X[q+2]=A.z;X[q+3]=
-A.w;X[q+4]=B.x;X[q+5]=B.y;X[q+6]=B.z;X[q+7]=B.w;X[q+8]=E.x;X[q+9]=E.y;X[q+10]=E.z;X[q+11]=E.w;A=za[s.a];B=za[s.b];E=za[s.c];W[q]=A.x;W[q+1]=A.y;W[q+2]=A.z;W[q+3]=A.w;W[q+4]=B.x;W[q+5]=B.y;W[q+6]=B.z;W[q+7]=B.w;W[q+8]=E.x;W[q+9]=E.y;W[q+10]=E.z;W[q+11]=E.w;A=xa[s.a];B=xa[s.b];E=xa[s.c];U[q]=A.x;U[q+1]=A.y;U[q+2]=A.z;U[q+3]=1;U[q+4]=B.x;U[q+5]=B.y;U[q+6]=B.z;U[q+7]=1;U[q+8]=E.x;U[q+9]=E.y;U[q+10]=E.z;U[q+11]=1;A=ya[s.a];B=ya[s.b];E=ya[s.c];V[q]=A.x;V[q+1]=A.y;V[q+2]=A.z;V[q+3]=1;V[q+4]=B.x;V[q+5]=B.y;
-V[q+6]=B.z;V[q+7]=1;V[q+8]=E.x;V[q+9]=E.y;V[q+10]=E.z;V[q+11]=1;q+=12}if(Ja&&ua.length){A=ua[s.a];B=ua[s.b];E=ua[s.c];fa[aa]=A.r;fa[aa+1]=A.g;fa[aa+2]=A.b;fa[aa+3]=B.r;fa[aa+4]=B.g;fa[aa+5]=B.b;fa[aa+6]=E.r;fa[aa+7]=E.g;fa[aa+8]=E.b;aa+=9}if(Ia&&ia.hasTangents){A=qa[s.a].tangent;B=qa[s.b].tangent;E=qa[s.c].tangent;T[L]=A.x;T[L+1]=A.y;T[L+2]=A.z;T[L+3]=A.w;T[L+4]=B.x;T[L+5]=B.y;T[L+6]=B.z;T[L+7]=B.w;T[L+8]=E.x;T[L+9]=E.y;T[L+10]=E.z;T[L+11]=E.w;L+=12}if(Ha)if(la.length==3&&Ma)for(s=0;s<3;s++){da=la[s];
-ra[J]=da.x;ra[J+1]=da.y;ra[J+2]=da.z;J+=3}else for(s=0;s<3;s++){ra[J]=da.x;ra[J+1]=da.y;ra[J+2]=da.z;J+=3}if(Aa&&ma)for(s=0;s<3;s++){la=ma[s];Ca[z]=la.u;Ca[z+1]=la.v;z+=2}if(Aa&&ca)for(s=0;s<3;s++){ma=ca[s];Da[Q]=ma.u;Da[Q+1]=ma.v;Q+=2}if(Ga){ta[I]=r;ta[I+1]=r+1;ta[I+2]=r+2;I+=3;oa[na]=r;oa[na+1]=r+1;oa[na+2]=r;oa[na+3]=r+2;oa[na+4]=r+1;oa[na+5]=r+2;na+=6;r+=3}}else if(s instanceof THREE.Face4){if(Fa){A=qa[s.a].position;B=qa[s.b].position;E=qa[s.c].position;S=qa[s.d].position;ea[y]=A.x;ea[y+1]=A.y;
-ea[y+2]=A.z;ea[y+3]=B.x;ea[y+4]=B.y;ea[y+5]=B.z;ea[y+6]=E.x;ea[y+7]=E.y;ea[y+8]=E.z;ea[y+9]=S.x;ea[y+10]=S.y;ea[y+11]=S.z;y+=12}if(va.length){A=va[s.a];B=va[s.b];E=va[s.c];S=va[s.d];X[q]=A.x;X[q+1]=A.y;X[q+2]=A.z;X[q+3]=A.w;X[q+4]=B.x;X[q+5]=B.y;X[q+6]=B.z;X[q+7]=B.w;X[q+8]=E.x;X[q+9]=E.y;X[q+10]=E.z;X[q+11]=E.w;X[q+12]=S.x;X[q+13]=S.y;X[q+14]=S.z;X[q+15]=S.w;A=za[s.a];B=za[s.b];E=za[s.c];S=za[s.d];W[q]=A.x;W[q+1]=A.y;W[q+2]=A.z;W[q+3]=A.w;W[q+4]=B.x;W[q+5]=B.y;W[q+6]=B.z;W[q+7]=B.w;W[q+8]=E.x;W[q+
-9]=E.y;W[q+10]=E.z;W[q+11]=E.w;W[q+12]=S.x;W[q+13]=S.y;W[q+14]=S.z;W[q+15]=S.w;A=xa[s.a];B=xa[s.b];E=xa[s.c];S=xa[s.d];U[q]=A.x;U[q+1]=A.y;U[q+2]=A.z;U[q+3]=1;U[q+4]=B.x;U[q+5]=B.y;U[q+6]=B.z;U[q+7]=1;U[q+8]=E.x;U[q+9]=E.y;U[q+10]=E.z;U[q+11]=1;U[q+12]=S.x;U[q+13]=S.y;U[q+14]=S.z;U[q+15]=1;A=ya[s.a];B=ya[s.b];E=ya[s.c];S=ya[s.d];V[q]=A.x;V[q+1]=A.y;V[q+2]=A.z;V[q+3]=1;V[q+4]=B.x;V[q+5]=B.y;V[q+6]=B.z;V[q+7]=1;V[q+8]=E.x;V[q+9]=E.y;V[q+10]=E.z;V[q+11]=1;V[q+12]=S.x;V[q+13]=S.y;V[q+14]=S.z;V[q+15]=
-1;q+=16}if(Ja&&ua.length){A=ua[s.a];B=ua[s.b];E=ua[s.c];S=ua[s.d];fa[aa]=A.r;fa[aa+1]=A.g;fa[aa+2]=A.b;fa[aa+3]=B.r;fa[aa+4]=B.g;fa[aa+5]=B.b;fa[aa+6]=E.r;fa[aa+7]=E.g;fa[aa+8]=E.b;fa[aa+9]=S.r;fa[aa+10]=S.g;fa[aa+11]=S.b;aa+=12}if(Ia&&ia.hasTangents){A=qa[s.a].tangent;B=qa[s.b].tangent;E=qa[s.c].tangent;s=qa[s.d].tangent;T[L]=A.x;T[L+1]=A.y;T[L+2]=A.z;T[L+3]=A.w;T[L+4]=B.x;T[L+5]=B.y;T[L+6]=B.z;T[L+7]=B.w;T[L+8]=E.x;T[L+9]=E.y;T[L+10]=E.z;T[L+11]=E.w;T[L+12]=s.x;T[L+13]=s.y;T[L+14]=s.z;T[L+15]=s.w;
-L+=16}if(Ha)if(la.length==4&&Ma)for(s=0;s<4;s++){da=la[s];ra[J]=da.x;ra[J+1]=da.y;ra[J+2]=da.z;J+=3}else for(s=0;s<4;s++){ra[J]=da.x;ra[J+1]=da.y;ra[J+2]=da.z;J+=3}if(Aa&&ma)for(s=0;s<4;s++){la=ma[s];Ca[z]=la.u;Ca[z+1]=la.v;z+=2}if(Aa&&ca)for(s=0;s<4;s++){ma=ca[s];Da[Q]=ma.u;Da[Q+1]=ma.v;Q+=2}if(Ga){ta[I]=r;ta[I+1]=r+1;ta[I+2]=r+2;ta[I+3]=r;ta[I+4]=r+2;ta[I+5]=r+3;I+=6;oa[na]=r;oa[na+1]=r+1;oa[na+2]=r;oa[na+3]=r+3;oa[na+4]=r+1;oa[na+5]=r+2;oa[na+6]=r+2;oa[na+7]=r+3;na+=8;r+=4}}}if(Fa){c.bindBuffer(c.ARRAY_BUFFER,
-n.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,ea,x)}if(Ja&&ua.length){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,fa,x)}if(Ha){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,ra,x)}if(Ia&&ia.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,T,x)}if(Aa&&z>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Ca,x)}if(Aa&&Q>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLUV2Buffer);
-c.bufferData(c.ARRAY_BUFFER,Da,x)}if(Ga){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ta,x);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,oa,x)}if(q>0){c.bindBuffer(c.ARRAY_BUFFER,n.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,U,x);c.bindBuffer(c.ARRAY_BUFFER,n.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,V,x);c.bindBuffer(c.ARRAY_BUFFER,n.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,
-W,x);c.bindBuffer(c.ARRAY_BUFFER,n.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,X,x)}}K(objlist,l,k)}i.__dirtyVertices=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyTangents=!1;i.__dirtyColors=!1}else if(k instanceof THREE.Ribbon){i=k.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;l=g.vertices.length;g.__vertexArray=new Float32Array(l*3);g.__colorArray=new Float32Array(l*3);g.__webGLVertexCount=
-l;i.__dirtyVertices=!0;i.__dirtyColors=!0}if(i.__dirtyVertices||i.__dirtyColors){g=i;l=c.DYNAMIC_DRAW;r=void 0;r=void 0;y=void 0;n=void 0;z=g.vertices;x=g.colors;Q=z.length;P=x.length;I=g.__vertexArray;u=g.__colorArray;J=g.__dirtyColors;if(g.__dirtyVertices){for(r=0;r<Q;r++){y=z[r].position;n=r*3;I[n]=y.x;I[n+1]=y.y;I[n+2]=y.z}c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,I,l)}if(J){for(r=0;r<P;r++){color=x[r];n=r*3;u[n]=color.r;u[n+1]=color.g;u[n+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,
-g.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,u,l)}}K(objlist,i,k);i.__dirtyVertices=!1;i.__dirtyColors=!1}else if(k instanceof THREE.Line){i=k.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;l=g.vertices.length;g.__vertexArray=new Float32Array(l*3);g.__colorArray=new Float32Array(l*3);g.__webGLLineCount=l;i.__dirtyVertices=!0;i.__dirtyColors=!0}if(i.__dirtyVertices||i.__dirtyColors){g=i;l=c.DYNAMIC_DRAW;r=void 0;r=void 0;
-y=void 0;n=void 0;z=g.vertices;x=g.colors;Q=z.length;P=x.length;I=g.__vertexArray;u=g.__colorArray;J=g.__dirtyColors;if(g.__dirtyVertices){for(r=0;r<Q;r++){y=z[r].position;n=r*3;I[n]=y.x;I[n+1]=y.y;I[n+2]=y.z}c.bindBuffer(c.ARRAY_BUFFER,g.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,I,l)}if(J){for(r=0;r<P;r++){color=x[r];n=r*3;u[n]=color.r;u[n+1]=color.g;u[n+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,g.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,u,l)}}K(objlist,i,k);i.__dirtyVertices=!1;i.__dirtyColors=
-!1}else if(k instanceof THREE.ParticleSystem){i=k.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;l=g.vertices.length;g.__vertexArray=new Float32Array(l*3);g.__colorArray=new Float32Array(l*3);g.__sortArray=[];g.__webGLParticleCount=l;i.__dirtyVertices=!0;i.__dirtyColors=!0}(i.__dirtyVertices||i.__dirtyColors||k.sortParticles)&&b(i,c.DYNAMIC_DRAW,k);K(objlist,i,k);i.__dirtyVertices=!1;i.__dirtyColors=!1}else THREE.MarchingCubes!==
-undefined&&k instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}};this.setFaceCulling=function(f,k){if(f){!k||k=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
-0}};
-THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
-envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
-map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",
-lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
+case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var N=document.createElement("canvas"),c,Z=null,ca=null,$=this,aa=null,ha=null,ka=null,la=null,ia=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],
+qa=new THREE.Matrix4,ta=new Float32Array(16),Ca=new Float32Array(16),xa=new THREE.Vector4,Fa=!0,La=new THREE.Color(0),Ma=0;if(a){if(a.antialias!==undefined)Fa=a.antialias;a.clearColor!==undefined&&La.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ma=a.clearAlpha}this.domElement=N;this.autoClear=!0;this.sortObjects=!1;(function(f,l,i){try{c=N.getContext("experimental-webgl",{antialias:f})}catch(g){console.log(g)}if(!c)throw"cannot create webgl context";c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);
+c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(l.r,l.g,l.b,i);_cullEnabled=!0})(Fa,La,Ma);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,l){N.width=f;N.height=l;c.viewport(0,0,N.width,N.height)};this.setClearColorHex=function(f,l){var i=new THREE.Color(f);c.clearColor(i.r,i.g,i.b,l)};this.setClearColor=
+function(f,l){c.clearColor(f.r,f.g,f.b,l)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,l,i){var g,j;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);
+else if(f instanceof THREE.LineBasicMaterial)d(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);var p,u,x,z;j=x=z=0;for(p=l.length;j<p;j++){u=l[j];u instanceof THREE.DirectionalLight&&x++;u instanceof THREE.PointLight&&z++}if(z+x<=4)l=x;else{l=Math.ceil(4*x/(z+x));z=4-l}j={directional:l,point:z};z=f.fragmentShader;l=f.vertexShader;p={fog:i,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,skinning:f.skinning,maxDirLights:j.directional,
+maxPointLights:j.point};i=c.createProgram();j=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+p.maxDirLights,"#define MAX_POINT_LIGHTS "+p.maxPointLights,p.fog?"#define USE_FOG":"",p.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",p.map?"#define USE_MAP":"",p.envMap?"#define USE_ENVMAP":"",p.lightMap?"#define USE_LIGHTMAP":"",p.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");p=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
+0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+p.maxDirLights,"#define MAX_POINT_LIGHTS "+p.maxPointLights,p.map?"#define USE_MAP":"",p.envMap?"#define USE_ENVMAP":"",p.lightMap?"#define USE_LIGHTMAP":"",p.vertexColors?"#define USE_COLOR":"",p.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+c.attachShader(i,P("fragment",j+z));c.attachShader(i,P("vertex",p+l));c.linkProgram(i);c.getProgramParameter(i,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(i,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");i.uniforms={};i.attributes={};f.program=i;i=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(g in f.uniforms)i.push(g);g=f.program;z=0;for(l=i.length;z<
+l;z++){j=i[z];g.uniforms[j]=c.getUniformLocation(g,j)}g=f.program;i=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];z=0;for(l=i.length;z<l;z++){j=i[z];g.attributes[j]=c.getAttribLocation(g,j)}g=f.program.attributes;c.enableVertexAttribArray(g.position);g.color>=0&&c.enableVertexAttribArray(g.color);g.normal>=0&&c.enableVertexAttribArray(g.normal);g.tangent>=0&&c.enableVertexAttribArray(g.tangent);if(f.skinning&&g.skinVertexA>=0&&g.skinVertexB>=
+0&&g.skinIndex>=0&&g.skinWeight>=0){c.enableVertexAttribArray(g.skinVertexA);c.enableVertexAttribArray(g.skinVertexB);c.enableVertexAttribArray(g.skinIndex);c.enableVertexAttribArray(g.skinWeight)}};this.render=function(f,l,i,g){var j,p,u,x,z,v,r,K,O=f.lights,M=f.fog;l.matrixAutoUpdate&&l.update();l.matrixWorldInverse.flattenToArray(Ca);l.projectionMatrix.flattenToArray(ta);qa.multiply(l.projectionMatrix,l.matrixWorldInverse);n(qa);THREE.AnimationHandler&&THREE.AnimationHandler.update();f.update(undefined,
+!1,l);this.initWebGLObjects(f,l);R(i,g!==undefined?g:!0);this.autoClear&&this.clear();z=f.__webglObjects.length;for(g=0;g<z;g++){j=f.__webglObjects[g];r=j.object;if(r.visible)if(!(r instanceof THREE.Mesh)||t(r)){r.matrixWorld.flattenToArray(r._objectMatrixArray);F(r,l);C(j);j.render=!0;if(this.sortObjects){xa.copy(r.position);qa.multiplyVector3(xa);j.z=xa.z}}else j.render=!1;else j.render=!1}this.sortObjects&&f.__webglObjects.sort(D);v=f.__webglObjectsImmediate.length;for(g=0;g<v;g++){j=f.__webglObjectsImmediate[g];
+r=j.object;if(r.visible){r.matrixAutoUpdate&&r.matrixWorld.flattenToArray(r._objectMatrixArray);F(r,l);w(j)}}H(THREE.NormalBlending);for(g=0;g<z;g++){j=f.__webglObjects[g];if(j.render){r=j.object;K=j.buffer;u=j.opaque;k(r);for(j=0;j<u.count;j++){x=u.list[j];o(x.depthTest);h(l,O,M,x,K,r)}}}for(g=0;g<v;g++){j=f.__webglObjectsImmediate[g];r=j.object;if(r.visible){u=j.opaque;k(r);for(j=0;j<u.count;j++){x=u.list[j];o(x.depthTest);p=e(l,O,M,x,r);r.render(function(I){m(I,p)})}}}for(g=0;g<z;g++){j=f.__webglObjects[g];
+if(j.render){r=j.object;K=j.buffer;u=j.transparent;k(r);for(j=0;j<u.count;j++){x=u.list[j];H(x.blending);o(x.depthTest);h(l,O,M,x,K,r)}}}for(g=0;g<v;g++){j=f.__webglObjectsImmediate[g];r=j.object;if(r.visible){u=j.transparent;k(r);for(j=0;j<u.count;j++){x=u.list[j];H(x.blending);o(x.depthTest);p=e(l,O,M,x,r);r.render(function(I){m(I,p)})}}}if(i&&i.minFilter!==THREE.NearestFilter&&i.minFilter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,i.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,
+null)}};this.initWebGLObjects=function(f){if(!f.__webglObjects){f.__webglObjects=[];f.__webglObjectsImmediate=[]}for(;f.__objectsRemoved.length;){var l=f.__objectsRemoved[0],i=f,g=void 0,j=void 0;for(g=i.__webglObjects.length-1;g>=0;g--){j=i.__webglObjects[g].object;l==j&&i.__webglObjects.splice(g,1)}f.__objectsRemoved.splice(0,1)}for(;f.__objectsAdded.length;){l=f.__objectsAdded[0];var p=f;g=void 0;i=void 0;j=void 0;if(l._modelViewMatrix==undefined){l._modelViewMatrix=new THREE.Matrix4;l._normalMatrixArray=
+new Float32Array(9);l._modelViewMatrixArray=new Float32Array(16);l._objectMatrixArray=new Float32Array(16);l.matrixWorld.flattenToArray(l._objectMatrixArray)}objlist=p.__webglObjects;if(l instanceof THREE.Mesh){i=l.geometry;i.geometryGroups==undefined&&G(i);for(g in i.geometryGroups){j=i.geometryGroups[g];if(!j.__webGLVertexBuffer){p=j;p.__webGLVertexBuffer=c.createBuffer();p.__webGLNormalBuffer=c.createBuffer();p.__webGLTangentBuffer=c.createBuffer();p.__webGLColorBuffer=c.createBuffer();p.__webGLUVBuffer=
+c.createBuffer();p.__webGLUV2Buffer=c.createBuffer();p.__webGLSkinVertexABuffer=c.createBuffer();p.__webGLSkinVertexBBuffer=c.createBuffer();p.__webGLSkinIndicesBuffer=c.createBuffer();p.__webGLSkinWeightsBuffer=c.createBuffer();p.__webGLFaceBuffer=c.createBuffer();p.__webGLLineBuffer=c.createBuffer();p=j;var u=l,x=void 0,z=void 0,v=0,r=0,K=0,O=u.geometry.faces,M=p.faces;x=0;for(z=M.length;x<z;x++){fi=M[x];face=O[fi];if(face instanceof THREE.Face3){v+=3;r+=1;K+=3}else if(face instanceof THREE.Face4){v+=
+4;r+=2;K+=4}}p.__vertexArray=new Float32Array(v*3);p.__normalArray=new Float32Array(v*3);p.__tangentArray=new Float32Array(v*4);p.__colorArray=new Float32Array(v*3);p.__uvArray=new Float32Array(v*2);p.__uv2Array=new Float32Array(v*2);p.__skinVertexAArray=new Float32Array(v*4);p.__skinVertexBArray=new Float32Array(v*4);p.__skinIndexArray=new Float32Array(v*4);p.__skinWeightArray=new Float32Array(v*4);p.__faceArray=new Uint16Array(r*3);p.__lineArray=new Uint16Array(K*2);z=x=p;v=void 0;O=void 0;var I=
+void 0,Q=void 0;I=void 0;M=!1;v=0;for(O=u.materials.length;v<O;v++){I=u.materials[v];if(I instanceof THREE.MeshFaceMaterial){I=0;for(Q=z.materials.length;I<Q;I++)if(z.materials[I]&&z.materials[I].shading!=undefined&&z.materials[I].shading==THREE.SmoothShading){M=!0;break}}else if(I&&I.shading!=undefined&&I.shading==THREE.SmoothShading){M=!0;break}if(M)break}x.__needsSmoothNormals=M;p.__webGLFaceCount=r*3;p.__webGLLineCount=K*2;i.__dirtyVertices=!0;i.__dirtyElements=!0;i.__dirtyUvs=!0;i.__dirtyNormals=
+!0;i.__dirtyTangents=!0;i.__dirtyColors=!0}J(objlist,j,l)}}else if(l instanceof THREE.Ribbon){i=l.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;j=g.vertices.length;g.__vertexArray=new Float32Array(j*3);g.__colorArray=new Float32Array(j*3);g.__webGLVertexCount=j;i.__dirtyVertices=!0;i.__dirtyColors=!0}J(objlist,i,l)}else if(l instanceof THREE.Line){i=l.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();
+g.__webGLColorBuffer=c.createBuffer();g=i;j=g.vertices.length;g.__vertexArray=new Float32Array(j*3);g.__colorArray=new Float32Array(j*3);g.__webGLLineCount=j;i.__dirtyVertices=!0;i.__dirtyColors=!0}J(objlist,i,l)}else if(l instanceof THREE.ParticleSystem){i=l.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=c.createBuffer();g.__webGLColorBuffer=c.createBuffer();g=i;j=g.vertices.length;g.__vertexArray=new Float32Array(j*3);g.__colorArray=new Float32Array(j*3);g.__sortArray=[];g.__webGLParticleCount=
+j;i.__dirtyVertices=!0;i.__dirtyColors=!0}J(objlist,i,l)}else THREE.MarchingCubes!==undefined&&l instanceof THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:l,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,1)}l=0;for(i=f.__webglObjects.length;l<i;l++){j=void 0;g=void 0;r=void 0;p=void 0;p=f.__webglObjects[l].object;if(p instanceof THREE.Mesh){g=p.geometry;for(j in g.geometryGroups){r=g.geometryGroups[j];if(g.__dirtyVertices||g.__dirtyElements||g.__dirtyUvs||
+g.__dirtyNormals||g.__dirtyColors||g.__dirtyTangents){K=c.DYNAMIC_DRAW;x=void 0;z=void 0;var da=void 0,s=void 0,ma=void 0,ea=void 0,na=void 0;da=void 0;var A=void 0,B=void 0,E=void 0,S=void 0;A=void 0;B=void 0;E=void 0;s=void 0;A=void 0;B=void 0;E=void 0;S=void 0;A=void 0;B=void 0;E=void 0;S=void 0;A=void 0;B=void 0;E=void 0;S=void 0;A=void 0;B=void 0;E=void 0;S=void 0;A=void 0;B=void 0;E=void 0;S=void 0;s=void 0;ea=void 0;ma=void 0;na=void 0;var T=Q=I=M=O=v=u=0,oa=0,ba=0,q=0,fa=r.__vertexArray,Da=
+r.__uvArray,Ea=r.__uv2Array,sa=r.__normalArray,U=r.__tangentArray,ga=r.__colorArray,V=r.__skinVertexAArray,W=r.__skinVertexBArray,X=r.__skinIndexArray,Y=r.__skinWeightArray,ua=r.__faceArray,pa=r.__lineArray,Na=r.__needsSmoothNormals,ja=p.geometry,Ga=ja.__dirtyVertices,Ha=ja.__dirtyElements,Ba=ja.__dirtyUvs,Ia=ja.__dirtyNormals,Ja=ja.__dirtyTangents,Ka=ja.__dirtyColors,ra=ja.vertices,Oa=r.faces,Pa=ja.faces,Qa=ja.uvs,Ra=ja.uvs2,va=ja.colors,ya=ja.skinVerticesA,za=ja.skinVerticesB,Aa=ja.skinIndices,
+wa=ja.skinWeights;x=0;for(z=Oa.length;x<z;x++){da=Oa[x];s=Pa[da];na=Qa[da];da=Ra[da];ma=s.vertexNormals;ea=s.normal;if(s instanceof THREE.Face3){if(Ga){A=ra[s.a].position;B=ra[s.b].position;E=ra[s.c].position;fa[v]=A.x;fa[v+1]=A.y;fa[v+2]=A.z;fa[v+3]=B.x;fa[v+4]=B.y;fa[v+5]=B.z;fa[v+6]=E.x;fa[v+7]=E.y;fa[v+8]=E.z;v+=9}if(wa.length){A=wa[s.a];B=wa[s.b];E=wa[s.c];Y[q]=A.x;Y[q+1]=A.y;Y[q+2]=A.z;Y[q+3]=A.w;Y[q+4]=B.x;Y[q+5]=B.y;Y[q+6]=B.z;Y[q+7]=B.w;Y[q+8]=E.x;Y[q+9]=E.y;Y[q+10]=E.z;Y[q+11]=E.w;A=Aa[s.a];
+B=Aa[s.b];E=Aa[s.c];X[q]=A.x;X[q+1]=A.y;X[q+2]=A.z;X[q+3]=A.w;X[q+4]=B.x;X[q+5]=B.y;X[q+6]=B.z;X[q+7]=B.w;X[q+8]=E.x;X[q+9]=E.y;X[q+10]=E.z;X[q+11]=E.w;A=ya[s.a];B=ya[s.b];E=ya[s.c];V[q]=A.x;V[q+1]=A.y;V[q+2]=A.z;V[q+3]=1;V[q+4]=B.x;V[q+5]=B.y;V[q+6]=B.z;V[q+7]=1;V[q+8]=E.x;V[q+9]=E.y;V[q+10]=E.z;V[q+11]=1;A=za[s.a];B=za[s.b];E=za[s.c];W[q]=A.x;W[q+1]=A.y;W[q+2]=A.z;W[q+3]=1;W[q+4]=B.x;W[q+5]=B.y;W[q+6]=B.z;W[q+7]=1;W[q+8]=E.x;W[q+9]=E.y;W[q+10]=E.z;W[q+11]=1;q+=12}if(Ka&&va.length){A=va[s.a];B=va[s.b];
+E=va[s.c];ga[ba]=A.r;ga[ba+1]=A.g;ga[ba+2]=A.b;ga[ba+3]=B.r;ga[ba+4]=B.g;ga[ba+5]=B.b;ga[ba+6]=E.r;ga[ba+7]=E.g;ga[ba+8]=E.b;ba+=9}if(Ja&&ja.hasTangents){A=ra[s.a].tangent;B=ra[s.b].tangent;E=ra[s.c].tangent;U[T]=A.x;U[T+1]=A.y;U[T+2]=A.z;U[T+3]=A.w;U[T+4]=B.x;U[T+5]=B.y;U[T+6]=B.z;U[T+7]=B.w;U[T+8]=E.x;U[T+9]=E.y;U[T+10]=E.z;U[T+11]=E.w;T+=12}if(Ia)if(ma.length==3&&Na)for(s=0;s<3;s++){ea=ma[s];sa[Q]=ea.x;sa[Q+1]=ea.y;sa[Q+2]=ea.z;Q+=3}else for(s=0;s<3;s++){sa[Q]=ea.x;sa[Q+1]=ea.y;sa[Q+2]=ea.z;Q+=
+3}if(Ba&&na)for(s=0;s<3;s++){ma=na[s];Da[O]=ma.u;Da[O+1]=ma.v;O+=2}if(Ba&&da)for(s=0;s<3;s++){na=da[s];Ea[M]=na.u;Ea[M+1]=na.v;M+=2}if(Ha){ua[I]=u;ua[I+1]=u+1;ua[I+2]=u+2;I+=3;pa[oa]=u;pa[oa+1]=u+1;pa[oa+2]=u;pa[oa+3]=u+2;pa[oa+4]=u+1;pa[oa+5]=u+2;oa+=6;u+=3}}else if(s instanceof THREE.Face4){if(Ga){A=ra[s.a].position;B=ra[s.b].position;E=ra[s.c].position;S=ra[s.d].position;fa[v]=A.x;fa[v+1]=A.y;fa[v+2]=A.z;fa[v+3]=B.x;fa[v+4]=B.y;fa[v+5]=B.z;fa[v+6]=E.x;fa[v+7]=E.y;fa[v+8]=E.z;fa[v+9]=S.x;fa[v+10]=
+S.y;fa[v+11]=S.z;v+=12}if(wa.length){A=wa[s.a];B=wa[s.b];E=wa[s.c];S=wa[s.d];Y[q]=A.x;Y[q+1]=A.y;Y[q+2]=A.z;Y[q+3]=A.w;Y[q+4]=B.x;Y[q+5]=B.y;Y[q+6]=B.z;Y[q+7]=B.w;Y[q+8]=E.x;Y[q+9]=E.y;Y[q+10]=E.z;Y[q+11]=E.w;Y[q+12]=S.x;Y[q+13]=S.y;Y[q+14]=S.z;Y[q+15]=S.w;A=Aa[s.a];B=Aa[s.b];E=Aa[s.c];S=Aa[s.d];X[q]=A.x;X[q+1]=A.y;X[q+2]=A.z;X[q+3]=A.w;X[q+4]=B.x;X[q+5]=B.y;X[q+6]=B.z;X[q+7]=B.w;X[q+8]=E.x;X[q+9]=E.y;X[q+10]=E.z;X[q+11]=E.w;X[q+12]=S.x;X[q+13]=S.y;X[q+14]=S.z;X[q+15]=S.w;A=ya[s.a];B=ya[s.b];E=ya[s.c];
+S=ya[s.d];V[q]=A.x;V[q+1]=A.y;V[q+2]=A.z;V[q+3]=1;V[q+4]=B.x;V[q+5]=B.y;V[q+6]=B.z;V[q+7]=1;V[q+8]=E.x;V[q+9]=E.y;V[q+10]=E.z;V[q+11]=1;V[q+12]=S.x;V[q+13]=S.y;V[q+14]=S.z;V[q+15]=1;A=za[s.a];B=za[s.b];E=za[s.c];S=za[s.d];W[q]=A.x;W[q+1]=A.y;W[q+2]=A.z;W[q+3]=1;W[q+4]=B.x;W[q+5]=B.y;W[q+6]=B.z;W[q+7]=1;W[q+8]=E.x;W[q+9]=E.y;W[q+10]=E.z;W[q+11]=1;W[q+12]=S.x;W[q+13]=S.y;W[q+14]=S.z;W[q+15]=1;q+=16}if(Ka&&va.length){A=va[s.a];B=va[s.b];E=va[s.c];S=va[s.d];ga[ba]=A.r;ga[ba+1]=A.g;ga[ba+2]=A.b;ga[ba+
+3]=B.r;ga[ba+4]=B.g;ga[ba+5]=B.b;ga[ba+6]=E.r;ga[ba+7]=E.g;ga[ba+8]=E.b;ga[ba+9]=S.r;ga[ba+10]=S.g;ga[ba+11]=S.b;ba+=12}if(Ja&&ja.hasTangents){A=ra[s.a].tangent;B=ra[s.b].tangent;E=ra[s.c].tangent;s=ra[s.d].tangent;U[T]=A.x;U[T+1]=A.y;U[T+2]=A.z;U[T+3]=A.w;U[T+4]=B.x;U[T+5]=B.y;U[T+6]=B.z;U[T+7]=B.w;U[T+8]=E.x;U[T+9]=E.y;U[T+10]=E.z;U[T+11]=E.w;U[T+12]=s.x;U[T+13]=s.y;U[T+14]=s.z;U[T+15]=s.w;T+=16}if(Ia)if(ma.length==4&&Na)for(s=0;s<4;s++){ea=ma[s];sa[Q]=ea.x;sa[Q+1]=ea.y;sa[Q+2]=ea.z;Q+=3}else for(s=
+0;s<4;s++){sa[Q]=ea.x;sa[Q+1]=ea.y;sa[Q+2]=ea.z;Q+=3}if(Ba&&na)for(s=0;s<4;s++){ma=na[s];Da[O]=ma.u;Da[O+1]=ma.v;O+=2}if(Ba&&da)for(s=0;s<4;s++){na=da[s];Ea[M]=na.u;Ea[M+1]=na.v;M+=2}if(Ha){ua[I]=u;ua[I+1]=u+1;ua[I+2]=u+2;ua[I+3]=u;ua[I+4]=u+2;ua[I+5]=u+3;I+=6;pa[oa]=u;pa[oa+1]=u+1;pa[oa+2]=u;pa[oa+3]=u+3;pa[oa+4]=u+1;pa[oa+5]=u+2;pa[oa+6]=u+2;pa[oa+7]=u+3;oa+=8;u+=4}}}if(Ga){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,fa,K)}if(Ka&&va.length){c.bindBuffer(c.ARRAY_BUFFER,
+r.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,ga,K)}if(Ia){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,sa,K)}if(Ja&&ja.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,U,K)}if(Ba&&O>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,Da,K)}if(Ba&&M>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLUV2Buffer);c.bufferData(c.ARRAY_BUFFER,Ea,K)}if(Ha){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webGLFaceBuffer);
+c.bufferData(c.ELEMENT_ARRAY_BUFFER,ua,K);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,r.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,pa,K)}if(q>0){c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinVertexABuffer);c.bufferData(c.ARRAY_BUFFER,V,K);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinVertexBBuffer);c.bufferData(c.ARRAY_BUFFER,W,K);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinIndicesBuffer);c.bufferData(c.ARRAY_BUFFER,X,K);c.bindBuffer(c.ARRAY_BUFFER,r.__webGLSkinWeightsBuffer);c.bufferData(c.ARRAY_BUFFER,Y,
+K)}}}g.__dirtyVertices=!1;g.__dirtyElements=!1;g.__dirtyUvs=!1;g.__dirtyNormals=!1;g.__dirtyTangents=!1;g.__dirtyColors=!1}else if(p instanceof THREE.Ribbon){g=p.geometry;if(g.__dirtyVertices||g.__dirtyColors){j=g;p=c.DYNAMIC_DRAW;u=void 0;u=void 0;v=void 0;r=void 0;O=j.vertices;K=j.colors;M=O.length;x=K.length;I=j.__vertexArray;z=j.__colorArray;Q=j.__dirtyColors;if(j.__dirtyVertices){for(u=0;u<M;u++){v=O[u].position;r=u*3;I[r]=v.x;I[r+1]=v.y;I[r+2]=v.z}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);
+c.bufferData(c.ARRAY_BUFFER,I,p)}if(Q){for(u=0;u<x;u++){color=K[u];r=u*3;z[r]=color.r;z[r+1]=color.g;z[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,z,p)}}g.__dirtyVertices=!1;g.__dirtyColors=!1}else if(p instanceof THREE.Line){g=p.geometry;if(g.__dirtyVertices||g.__dirtyColors){j=g;p=c.DYNAMIC_DRAW;u=void 0;u=void 0;v=void 0;r=void 0;O=j.vertices;K=j.colors;M=O.length;x=K.length;I=j.__vertexArray;z=j.__colorArray;Q=j.__dirtyColors;if(j.__dirtyVertices){for(u=
+0;u<M;u++){v=O[u].position;r=u*3;I[r]=v.x;I[r+1]=v.y;I[r+2]=v.z}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,I,p)}if(Q){for(u=0;u<x;u++){color=K[u];r=u*3;z[r]=color.r;z[r+1]=color.g;z[r+2]=color.b}c.bindBuffer(c.ARRAY_BUFFER,j.__webGLColorBuffer);c.bufferData(c.ARRAY_BUFFER,z,p)}}g.__dirtyVertices=!1;g.__dirtyColors=!1}else if(p instanceof THREE.ParticleSystem){g=p.geometry;(g.__dirtyVertices||g.__dirtyColors||p.sortParticles)&&b(g,c.DYNAMIC_DRAW,p);g.__dirtyVertices=
+!1;g.__dirtyColors=!1}}};this.setFaceCulling=function(f,l){if(f){!l||l=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(f=="back")c.cullFace(c.BACK);else f=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
+envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
+envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
+map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
+lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
 lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
 lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
 lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
 lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse  = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse  += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse  = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse  += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
 color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position  = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
 color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position  = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position  = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};

+ 86 - 45
src/renderers/WebGLRenderer.js

@@ -2095,14 +2095,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		}
 		}
 
 
-		/*
-		for ( var o = 0, ol = scene.__objectsAdded.length; o < ol; o ++ ) {
-
-			addObject( scene.__objectsAdded[ o ], scene );
-
-		}
-		*/
-
 		while ( scene.__objectsRemoved.length ) {
 		while ( scene.__objectsRemoved.length ) {
 
 
 			removeObject( scene.__objectsRemoved[ 0 ], scene );
 			removeObject( scene.__objectsRemoved[ 0 ], scene );
@@ -2117,6 +2109,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 		}
 		}
 
 
+		// update must be called after objects adding / removal
+		
+		for ( var o = 0, ol = scene.__webglObjects.length; o < ol; o ++ ) {
+
+			updateObject( scene.__webglObjects[ o ], scene );
+
+		}
+		
+
 	};
 	};
 
 
 	function addObject( object, scene ) {
 	function addObject( object, scene ) {
@@ -2169,27 +2170,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 				}
 				}
 
 
-				if ( geometry.__dirtyVertices || geometry.__dirtyElements ||
-					geometry.__dirtyUvs || geometry.__dirtyNormals ||
-					geometry.__dirtyColors || geometry.__dirtyTangents ) {
-
-					setMeshBuffers( geometryGroup, object, _gl.DYNAMIC_DRAW );
-
-				}
-
 				// create separate wrapper per each use of VBO
 				// create separate wrapper per each use of VBO
 
 
 				addBuffer( objlist, geometryGroup, object );
 				addBuffer( objlist, geometryGroup, object );
 
 
 			}
 			}
 
 
-			geometry.__dirtyVertices = false;
-			geometry.__dirtyElements = false;
-			geometry.__dirtyUvs = false;
-			geometry.__dirtyNormals = false;
-			geometry.__dirtyTangents = false;
-			geometry.__dirtyColors = false;
-
 		} else if ( object instanceof THREE.Ribbon ) {
 		} else if ( object instanceof THREE.Ribbon ) {
 
 
 			geometry = object.geometry;
 			geometry = object.geometry;
@@ -2204,17 +2190,8 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			}
 			}
 
 
-			if( geometry.__dirtyVertices || geometry.__dirtyColors ) {
-
-				setRibbonBuffers( geometry, _gl.DYNAMIC_DRAW );
-
-			}
-
 			addBuffer( objlist, geometry, object );
 			addBuffer( objlist, geometry, object );
 
 
-			geometry.__dirtyVertices = false;
-			geometry.__dirtyColors = false;
-
 		} else if ( object instanceof THREE.Line ) {
 		} else if ( object instanceof THREE.Line ) {
 
 
 			geometry = object.geometry;
 			geometry = object.geometry;
@@ -2229,52 +2206,116 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 
 			}
 			}
 
 
-			if( geometry.__dirtyVertices ||  geometry.__dirtyColors ) {
+			addBuffer( objlist, geometry, object );
 
 
-				setLineBuffers( geometry, _gl.DYNAMIC_DRAW );
+		} else if ( object instanceof THREE.ParticleSystem ) {
+
+			geometry = object.geometry;
+
+			if ( ! geometry.__webGLVertexBuffer ) {
+
+				createParticleBuffers( geometry );
+				initParticleBuffers( geometry );
+
+				geometry.__dirtyVertices = true;
+				geometry.__dirtyColors = true;
 
 
 			}
 			}
 
 
 			addBuffer( objlist, geometry, object );
 			addBuffer( objlist, geometry, object );
 
 
+		} else if ( THREE.MarchingCubes !== undefined && object instanceof THREE.MarchingCubes ) {
+
+			addBufferImmediate( scene.__webglObjectsImmediate, object );
+
+		}/*else if ( object instanceof THREE.Particle ) {
+
+		}*/
+
+	};
+
+	function updateObject( webGLObject, scene ) {
+
+		var g, geometry, geometryGroup, webGLObject, object;
+
+		object = webGLObject.object;
+
+		if ( object instanceof THREE.Mesh ) {
+
+			geometry = object.geometry;
+
+			// check all geometry groups
+
+			for ( g in geometry.geometryGroups ) {
+
+				geometryGroup = geometry.geometryGroups[ g ];
+
+				if ( geometry.__dirtyVertices || geometry.__dirtyElements ||
+					geometry.__dirtyUvs || geometry.__dirtyNormals ||
+					geometry.__dirtyColors || geometry.__dirtyTangents ) {
+
+					setMeshBuffers( geometryGroup, object, _gl.DYNAMIC_DRAW );
+
+				}
+
+			}
+
 			geometry.__dirtyVertices = false;
 			geometry.__dirtyVertices = false;
+			geometry.__dirtyElements = false;
+			geometry.__dirtyUvs = false;
+			geometry.__dirtyNormals = false;
+			geometry.__dirtyTangents = false;
 			geometry.__dirtyColors = false;
 			geometry.__dirtyColors = false;
 
 
-		} else if ( object instanceof THREE.ParticleSystem ) {
+		} else if ( object instanceof THREE.Ribbon ) {
 
 
 			geometry = object.geometry;
 			geometry = object.geometry;
 
 
-			if ( ! geometry.__webGLVertexBuffer ) {
+			if( geometry.__dirtyVertices || geometry.__dirtyColors ) {
 
 
-				createParticleBuffers( geometry );
-				initParticleBuffers( geometry );
+				setRibbonBuffers( geometry, _gl.DYNAMIC_DRAW );
 
 
-				geometry.__dirtyVertices = true;
-				geometry.__dirtyColors = true;
+			}
+
+			geometry.__dirtyVertices = false;
+			geometry.__dirtyColors = false;
+
+		} else if ( object instanceof THREE.Line ) {
+
+			geometry = object.geometry;
+
+			if( geometry.__dirtyVertices ||  geometry.__dirtyColors ) {
+
+				setLineBuffers( geometry, _gl.DYNAMIC_DRAW );
 
 
 			}
 			}
 
 
+			geometry.__dirtyVertices = false;
+			geometry.__dirtyColors = false;
+
+		} else if ( object instanceof THREE.ParticleSystem ) {
+
+			geometry = object.geometry;
+
 			if ( geometry.__dirtyVertices || geometry.__dirtyColors || object.sortParticles ) {
 			if ( geometry.__dirtyVertices || geometry.__dirtyColors || object.sortParticles ) {
 
 
 				setParticleBuffers( geometry, _gl.DYNAMIC_DRAW, object );
 				setParticleBuffers( geometry, _gl.DYNAMIC_DRAW, object );
 
 
 			}
 			}
 
 
-			addBuffer( objlist, geometry, object );
-
 			geometry.__dirtyVertices = false;
 			geometry.__dirtyVertices = false;
 			geometry.__dirtyColors = false;
 			geometry.__dirtyColors = false;
 
 
 		} else if ( THREE.MarchingCubes !== undefined && object instanceof THREE.MarchingCubes ) {
 		} else if ( THREE.MarchingCubes !== undefined && object instanceof THREE.MarchingCubes ) {
 
 
-			addBufferImmediate( scene.__webglObjectsImmediate, object );
-
+			// it updates itself in render callback
+			
 		}/*else if ( object instanceof THREE.Particle ) {
 		}/*else if ( object instanceof THREE.Particle ) {
 
 
 		}*/
 		}*/
 
 
 	};
 	};
-
+	
 	function sortFacesByMaterial( geometry ) {
 	function sortFacesByMaterial( geometry ) {
 
 
 		// TODO
 		// TODO