2
0
Эх сурвалжийг харах

Object3D::matrixNeedsUpdate ⟶ Object3D::matrixWorldNeedsUpdate
Object3D::lookAt works! (and Vector3.setRotationFromMatrix too!)

Next: Object3D::translate...

Mr.doob 14 жил өмнө
parent
commit
1a115ae86f

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 167 - 166
build/Three.js


+ 30 - 29
build/custom/ThreeCanvas.js

@@ -8,7 +8,8 @@ this.length());return this},length:function(){return Math.sqrt(this.lengthSq())}
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
 b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.set(c*a.z-d*a.y,d*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
-this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},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},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},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*
 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,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(s,k,G,F){F=F.clone().subSelf(k);G=G.clone().subSelf(k);var K=s.clone().subSelf(k);s=F.dot(F);k=F.dot(G);F=F.dot(K);var I=G.dot(G);G=G.dot(K);K=1/(s*I-k*k);I=(I*F-k*G)*K;s=(s*G-k*F)*K;return I>0&&s>0&&I+s<1}var c,d,e,f,g,j,h,i,p,n,
@@ -19,30 +20,30 @@ this.add3Points=function(h,i,p,n,o,q){if(j){j=!1;b=h<p?h<o?h:o:p<o?p:o;c=i<n?i<q
 d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){j=!0;e=d=c=b=0;a()};this.isEmpty=function(){return j}};
 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,e,f,g,j,h,i,p,n,o,q,u,v){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,j||0,h||0,i||0,p||1,n||0,o||0,q||0,u||0,v||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,j,h,i,p,n,o,q,u,v){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=j;this.n31=h;this.n32=i;this.n33=p;this.n34=n;this.n41=o;this.n42=q;this.n43=u;this.n44=v;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,
-e=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();d.cross(c,f).normalize();e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n14=a.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n24=a.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;this.n34=a.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=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)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*
-b+this.n32*c+this.n33*d+this.n34)*e;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,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;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,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,p=a.n31,n=a.n32,o=a.n33,q=a.n34,u=a.n41,v=a.n42,s=a.n43,k=a.n44,G=b.n11,F=b.n12,K=b.n13,I=b.n14,S=b.n21,C=b.n22,A=b.n23,L=b.n24,y=b.n31,M=b.n32,D=b.n33,x=b.n34;this.n11=c*
-G+d*S+e*y;this.n12=c*F+d*C+e*M;this.n13=c*K+d*A+e*D;this.n14=c*I+d*L+e*x+f;this.n21=g*G+j*S+h*y;this.n22=g*F+j*C+h*M;this.n23=g*K+j*A+h*D;this.n24=g*I+j*L+h*x+i;this.n31=p*G+n*S+o*y;this.n32=p*F+n*C+o*M;this.n33=p*K+n*A+o*D;this.n34=p*I+n*L+o*x+q;this.n41=u*G+v*S+s*y;this.n42=u*F+v*C+s*M;this.n43=u*K+v*A+s*D;this.n44=u*I+v*L+s*x+k;return this},multiplyToArray:function(a,b,c){this.multiply(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){this.multiply(this,a);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,e=this.n21,
-f=this.n22,g=this.n23,j=this.n24,h=this.n31,i=this.n32,p=this.n33,n=this.n34,o=this.n41,q=this.n42,u=this.n43,v=this.n44;return d*g*i*o-c*j*i*o-d*f*p*o+b*j*p*o+c*f*n*o-b*g*n*o-d*g*h*q+c*j*h*q+d*e*p*q-a*j*p*q-c*e*n*q+a*g*n*q+d*f*h*u-b*j*h*u-d*e*i*u+a*j*i*u+b*e*n*u-a*f*n*u-c*f*h*v+b*g*h*v+c*e*i*v-a*g*i*v-b*e*p*v+a*f*p*v},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.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=
-this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(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},
-setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,j=a.z,h=e*f,i=e*g;this.set(h*f+c,h*g-d*j,h*j+d*g,0,h*g+d*j,i*g+c,i*j-d*f,0,h*j-d*g,
-i*j+d*f,e*j*j+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 e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,j=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=j*f+a*d;this.n22=-j*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,j=d+d;a=
-b*f;var h=b*g;b*=j;var i=c*g;c*=j;d*=j;f*=e;g*=e;e*=j;this.n11=1-(i+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i)},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},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/
-b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
+THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,j,h,i,p,n,o,q,u,v){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=j;this.n31=h;this.n32=i;this.n33=p;this.n34=n;this.n41=o;this.n42=q;this.n43=u;this.n44=v;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.__v1,
+e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();d.cross(c,f).normalize();e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=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)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;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,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;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,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,p=a.n31,n=a.n32,o=a.n33,q=a.n34,u=a.n41,v=a.n42,s=a.n43,k=a.n44,G=b.n11,F=b.n12,K=b.n13,I=b.n14,S=b.n21,C=b.n22,A=b.n23,L=b.n24,y=b.n31,M=b.n32,D=b.n33,x=b.n34;this.n11=c*G+d*S+e*y;this.n12=c*F+d*C+e*M;this.n13=c*
+K+d*A+e*D;this.n14=c*I+d*L+e*x+f;this.n21=g*G+j*S+h*y;this.n22=g*F+j*C+h*M;this.n23=g*K+j*A+h*D;this.n24=g*I+j*L+h*x+i;this.n31=p*G+n*S+o*y;this.n32=p*F+n*C+o*M;this.n33=p*K+n*A+o*D;this.n34=p*I+n*L+o*x+q;this.n41=u*G+v*S+s*y;this.n42=u*F+v*C+s*M;this.n43=u*K+v*A+s*D;this.n44=u*I+v*L+s*x+k;return this},multiplyToArray:function(a,b,c){this.multiply(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){this.multiply(this,a);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,e=this.n21,f=this.n22,g=this.n23,j=this.n24,
+h=this.n31,i=this.n32,p=this.n33,n=this.n34,o=this.n41,q=this.n42,u=this.n43,v=this.n44;return d*g*i*o-c*j*i*o-d*f*p*o+b*j*p*o+c*f*n*o-b*g*n*o-d*g*h*q+c*j*h*q+d*e*p*q-a*j*p*q-c*e*n*q+a*g*n*q+d*f*h*u-b*j*h*u-d*e*i*u+a*j*i*u+b*e*n*u-a*f*n*u-c*f*h*v+b*g*h*v+c*e*i*v-a*g*i*v-b*e*p*v+a*f*p*v},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.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;
+this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(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},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,j=a.z,h=e*f,i=e*g;this.set(h*f+c,h*g-d*j,h*j+d*g,0,h*g+d*j,i*g+c,i*j-d*f,0,h*j-d*g,i*j+d*f,e*j*j+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 e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,j=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=j*f+a*d;this.n22=-j*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,j=d+d;a=b*f;var h=b*g;b*=j;var i=c*g;
+c*=j;d*=j;f*=e;g*=e;e*=j;this.n11=1-(i+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+i);return this},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},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=
+a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,j=a.n22,h=a.n23,i=a.n24,p=a.n31,n=a.n32,o=a.n33,q=a.n34,u=a.n41,v=a.n42,s=a.n43,k=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*q*v-i*o*v+i*n*s-j*q*s-h*n*k+j*o*k;b.n12=f*o*v-e*q*v-f*n*s+d*q*s+e*n*k-d*o*k;b.n13=e*i*v-f*h*v+f*j*s-d*i*s-e*j*k+d*h*k;b.n14=f*h*n-e*i*n-f*j*o+d*i*o+e*j*q-d*h*q;b.n21=i*o*u-h*q*u-i*p*s+g*q*s+h*p*k-g*o*k;b.n22=e*q*u-f*o*u+f*p*s-c*q*s-e*p*k+c*o*k;b.n23=f*h*u-e*i*u-f*g*s+c*i*s+e*g*k-c*h*k;
 b.n24=e*i*p-f*h*p+f*g*o-c*i*o-e*g*q+c*h*q;b.n31=j*q*u-i*n*u+i*p*v-g*q*v-j*p*k+g*n*k;b.n32=f*n*u-d*q*u-f*p*v+c*q*v+d*p*k-c*n*k;b.n33=e*i*u-f*j*u+f*g*v-c*i*v-d*g*k+c*j*k;b.n34=f*j*p-d*i*p-f*g*n+c*i*n+d*g*q-c*j*q;b.n41=h*n*u-j*o*u-h*p*v+g*o*v+j*p*s-g*n*s;b.n42=d*o*u-e*n*u+e*p*v-c*o*v-d*p*s+c*n*s;b.n43=e*j*u-d*h*u-e*g*v+c*h*v+d*g*s-c*j*s;b.n44=d*h*p-e*j*p+e*g*n-c*h*n-d*g*o+c*j*o;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,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,j=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,i=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*i;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*j;c[5]=a*h;c[6]=a*i;c[7]=a*p;c[8]=a*n;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,j,h,i;g=new THREE.Matrix4;j=b-a;h=c-d;i=f-e;g.n11=2/j;g.n12=0;g.n13=0;g.n14=-((b+a)/j);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};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;
-this.visible=!0};
-THREE.Object3D.prototype={translateX:function(){},translateY:function(){},translateZ:function(){},lookAt:function(){},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,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,
-this.scale);this.matrixNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}}};THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,j,h,i;g=new THREE.Matrix4;j=b-a;h=c-d;i=f-e;g.n11=2/j;g.n12=0;g.n13=0;g.n14=-((b+a)/j);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/i;g.n34=-((f+e)/i);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
+!0};
+THREE.Object3D.prototype={lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},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,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,
+this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}}};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,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},
 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,p=h*d+j*c-f*e,n=h*e+f*d-g*c;c=-f*c-g*d-j*e;b.x=i*h+c*-f+p*-j-n*-g;b.y=p*h+c*-g+n*-f-i*-j;b.z=n*h+c*-j+i*-g-p*-f;return b}};
@@ -60,12 +61,12 @@ for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.uvs[b];if(d instanceof T
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){D.copy(this.vertices[b].normal);d=S[b];y.copy(d);y.subSelf(D.multiplyScalar(D.dot(d))).normalize();M.cross(this.vertices[b].normal,d);d=M.dot(C[b]);d=d<0?-1:1;this.vertices[b].tangent.set(y.x,y.y,y.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>
 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.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;var f=new THREE.Vector3;this.translateX=function(g,j){f.sub(this.target.position,this.position).normalize().multiplyScalar(g);f.crossSelf(this.up);if(j)f.y=0;this.position.addSelf(f);this.target.position.addSelf(f)};this.translateZ=
-function(g,j){f.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(j)f.y=0;this.position.subSelf(f);this.target.position.subSelf(f)};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.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)};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;
-THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
-THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
+THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix();var f=new THREE.Vector3;this.translateX=function(g,j){f.sub(this.target.position,this.position).normalize().multiplyScalar(g);f.crossSelf(this.up);if(j)f.y=0;this.position.addSelf(f);this.target.position.addSelf(f)};this.translateZ=
+function(g,j){f.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(j)f.y=0;this.position.subSelf(f);this.target.position.subSelf(f)}};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.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);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.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
+!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)};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;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
+THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
@@ -89,13 +90,13 @@ THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.Clam
 THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
 THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
+THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
 b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
 THREE.Sound=function(a,b,c,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var e;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)e=
 "audio/mpeg";else if(b.indexOf(".ogg")!==-1)e="audio/ogg";else b.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};
+THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};
 THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;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])};

+ 28 - 27
build/custom/ThreeDOM.js

@@ -8,7 +8,8 @@ this.length());return this},length:function(){return Math.sqrt(this.lengthSq())}
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
 b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.set(c*a.z-d*a.y,d*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
-this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},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},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},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*
 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,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(p,k,D,z){z=z.clone().subSelf(k);D=D.clone().subSelf(k);var G=p.clone().subSelf(k);p=z.dot(z);k=z.dot(D);z=z.dot(G);var H=D.dot(D);D=D.dot(G);G=1/(p*H-k*k);H=(H*z-k*D)*G;p=(p*D-k*z)*G;return H>0&&p>0&&H+p<1}var c,d,e,f,g,i,h,j,n,m,
@@ -19,30 +20,30 @@ this.add3Points=function(h,j,n,m,l,o){if(i){i=!1;b=h<n?h<l?h:l:n<l?n:l;c=j<m?j<o
 d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 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,e,f,g,i,h,j,n,m,l,o,q,r){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,i||0,h||0,j||0,n||1,m||0,l||0,o||0,q||0,r||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,i,h,j,n,m,l,o,q,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=n;this.n34=m;this.n41=l;this.n42=o;this.n43=q;this.n44=r;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,
-e=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();d.cross(c,f).normalize();e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n14=a.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n24=a.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;this.n34=a.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=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)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*
-b+this.n32*c+this.n33*d+this.n34)*e;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,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;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,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,n=a.n31,m=a.n32,l=a.n33,o=a.n34,q=a.n41,r=a.n42,p=a.n43,k=a.n44,D=b.n11,z=b.n12,G=b.n13,H=b.n14,M=b.n21,x=b.n22,v=b.n23,E=b.n24,B=b.n31,F=b.n32,A=b.n33,w=b.n34;this.n11=c*
-D+d*M+e*B;this.n12=c*z+d*x+e*F;this.n13=c*G+d*v+e*A;this.n14=c*H+d*E+e*w+f;this.n21=g*D+i*M+h*B;this.n22=g*z+i*x+h*F;this.n23=g*G+i*v+h*A;this.n24=g*H+i*E+h*w+j;this.n31=n*D+m*M+l*B;this.n32=n*z+m*x+l*F;this.n33=n*G+m*v+l*A;this.n34=n*H+m*E+l*w+o;this.n41=q*D+r*M+p*B;this.n42=q*z+r*x+p*F;this.n43=q*G+r*v+p*A;this.n44=q*H+r*E+p*w+k;return this},multiplyToArray:function(a,b,c){this.multiply(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){this.multiply(this,a);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,e=this.n21,
-f=this.n22,g=this.n23,i=this.n24,h=this.n31,j=this.n32,n=this.n33,m=this.n34,l=this.n41,o=this.n42,q=this.n43,r=this.n44;return d*g*j*l-c*i*j*l-d*f*n*l+b*i*n*l+c*f*m*l-b*g*m*l-d*g*h*o+c*i*h*o+d*e*n*o-a*i*n*o-c*e*m*o+a*g*m*o+d*f*h*q-b*i*h*q-d*e*j*q+a*i*j*q+b*e*m*q-a*f*m*q-c*f*h*r+b*g*h*r+c*e*j*r-a*g*j*r-b*e*n*r+a*f*n*r},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.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=
-this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(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},
-setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,h=e*f,j=e*g;this.set(h*f+c,h*g-d*i,h*i+d*g,0,h*g+d*i,j*g+c,j*i-d*f,0,h*i-d*g,
-j*i+d*f,e*i*i+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 e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,i=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=i*f+a*d;this.n22=-i*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d;a=
-b*f;var h=b*g;b*=i;var j=c*g;c*=i;d*=i;f*=e;g*=e;e*=i;this.n11=1-(j+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j)},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},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/
-b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
+THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,i,h,j,n,m,l,o,q,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=j;this.n33=n;this.n34=m;this.n41=l;this.n42=o;this.n43=q;this.n44=r;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.__v1,
+e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();d.cross(c,f).normalize();e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=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)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;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,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;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,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,n=a.n31,m=a.n32,l=a.n33,o=a.n34,q=a.n41,r=a.n42,p=a.n43,k=a.n44,D=b.n11,z=b.n12,G=b.n13,H=b.n14,M=b.n21,x=b.n22,v=b.n23,E=b.n24,B=b.n31,F=b.n32,A=b.n33,w=b.n34;this.n11=c*D+d*M+e*B;this.n12=c*z+d*x+e*F;this.n13=c*
+G+d*v+e*A;this.n14=c*H+d*E+e*w+f;this.n21=g*D+i*M+h*B;this.n22=g*z+i*x+h*F;this.n23=g*G+i*v+h*A;this.n24=g*H+i*E+h*w+j;this.n31=n*D+m*M+l*B;this.n32=n*z+m*x+l*F;this.n33=n*G+m*v+l*A;this.n34=n*H+m*E+l*w+o;this.n41=q*D+r*M+p*B;this.n42=q*z+r*x+p*F;this.n43=q*G+r*v+p*A;this.n44=q*H+r*E+p*w+k;return this},multiplyToArray:function(a,b,c){this.multiply(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){this.multiply(this,a);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,e=this.n21,f=this.n22,g=this.n23,i=this.n24,
+h=this.n31,j=this.n32,n=this.n33,m=this.n34,l=this.n41,o=this.n42,q=this.n43,r=this.n44;return d*g*j*l-c*i*j*l-d*f*n*l+b*i*n*l+c*f*m*l-b*g*m*l-d*g*h*o+c*i*h*o+d*e*n*o-a*i*n*o-c*e*m*o+a*g*m*o+d*f*h*q-b*i*h*q-d*e*j*q+a*i*j*q+b*e*m*q-a*f*m*q-c*f*h*r+b*g*h*r+c*e*j*r-a*g*j*r-b*e*n*r+a*f*n*r},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.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;
+this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(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},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,h=e*f,j=e*g;this.set(h*f+c,h*g-d*i,h*i+d*g,0,h*g+d*i,j*g+c,j*i-d*f,0,h*i-d*g,j*i+d*f,e*i*i+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 e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,i=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=i*f+a*d;this.n22=-i*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d;a=b*f;var h=b*g;b*=i;var j=c*g;
+c*=i;d*=i;f*=e;g*=e;e*=i;this.n11=1-(j+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+j);return this},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},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=
+a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,j=a.n24,n=a.n31,m=a.n32,l=a.n33,o=a.n34,q=a.n41,r=a.n42,p=a.n43,k=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*o*r-j*l*r+j*m*p-i*o*p-h*m*k+i*l*k;b.n12=f*l*r-e*o*r-f*m*p+d*o*p+e*m*k-d*l*k;b.n13=e*j*r-f*h*r+f*i*p-d*j*p-e*i*k+d*h*k;b.n14=f*h*m-e*j*m-f*i*l+d*j*l+e*i*o-d*h*o;b.n21=j*l*q-h*o*q-j*n*p+g*o*p+h*n*k-g*l*k;b.n22=e*o*q-f*l*q+f*n*p-c*o*p-e*n*k+c*l*k;b.n23=f*h*q-e*j*q-f*g*p+c*j*p+e*g*k-c*h*k;
 b.n24=e*j*n-f*h*n+f*g*l-c*j*l-e*g*o+c*h*o;b.n31=i*o*q-j*m*q+j*n*r-g*o*r-i*n*k+g*m*k;b.n32=f*m*q-d*o*q-f*n*r+c*o*r+d*n*k-c*m*k;b.n33=e*j*q-f*i*q+f*g*r-c*j*r-d*g*k+c*i*k;b.n34=f*i*n-d*j*n-f*g*m+c*j*m+d*g*o-c*i*o;b.n41=h*m*q-i*l*q-h*n*r+g*l*r+i*n*p-g*m*p;b.n42=d*l*q-e*m*q+e*n*r-c*l*r-d*n*p+c*m*p;b.n43=e*i*q-d*h*q-e*g*r+c*h*r+d*g*p-c*i*p;b.n44=d*h*n-e*i*n+e*g*m-c*h*m-d*g*l+c*i*l;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,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,j=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*j;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*j;c[7]=a*n;c[8]=a*m;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-d;j=f-e;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+e)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};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;
-this.visible=!0};
-THREE.Object3D.prototype={translateX:function(){},translateY:function(){},translateZ:function(){},lookAt:function(){},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,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,
-this.scale);this.matrixNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}}};THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,i,h,j;g=new THREE.Matrix4;i=b-a;h=c-d;j=f-e;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/j;g.n34=-((f+e)/j);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
+!0};
+THREE.Object3D.prototype={lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},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,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,
+this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}}};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,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},
 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,m=h*e+f*d-g*c;c=-f*c-g*d-i*e;b.x=j*h+c*-f+n*-i-m*-g;b.y=n*h+c*-g+m*-f-j*-i;b.z=m*h+c*-i+j*-g-n*-f;return b}};
@@ -50,18 +51,18 @@ 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;i
 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.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.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;var f=new THREE.Vector3;this.translateX=function(g,i){f.sub(this.target.position,this.position).normalize().multiplyScalar(g);f.crossSelf(this.up);if(i)f.y=0;this.position.addSelf(f);this.target.position.addSelf(f)};this.translateZ=
-function(g,i){f.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(i)f.y=0;this.position.subSelf(f);this.target.position.subSelf(f)};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.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)};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
+THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix();var f=new THREE.Vector3;this.translateX=function(g,i){f.sub(this.target.position,this.position).normalize().multiplyScalar(g);f.crossSelf(this.up);if(i)f.y=0;this.position.addSelf(f);this.target.position.addSelf(f)};this.translateZ=
+function(g,i){f.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(i)f.y=0;this.position.subSelf(f);this.target.position.subSelf(f)}};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.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);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.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
+!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)};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
+THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
 b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
 THREE.Sound=function(a,b,c,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var e;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)e=
 "audio/mpeg";else if(b.indexOf(".ogg")!==-1)e="audio/ogg";else b.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};
+THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};
 THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;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])};

+ 30 - 29
build/custom/ThreeSVG.js

@@ -8,7 +8,8 @@ this.length());return this},length:function(){return Math.sqrt(this.lengthSq())}
 THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
 b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.set(c*a.z-d*a.y,d*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
-this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},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},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},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*
 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,e=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(f,g){return f.distance-g.distance});return e},intersectObject:function(a){function b(u,j,J,q){q=q.clone().subSelf(j);J=J.clone().subSelf(j);var A=u.clone().subSelf(j);u=q.dot(q);j=q.dot(J);q=q.dot(A);var F=J.dot(J);J=J.dot(A);A=1/(u*F-j*j);F=(F*q-j*J)*A;u=(u*J-j*q)*A;return F>0&&u>0&&F+u<1}var c,d,e,f,g,i,h,l,n,m,
@@ -19,30 +20,30 @@ this.add3Points=function(h,l,n,m,k,o){if(i){i=!1;b=h<n?h<k?h:k:n<k?n:k;c=l<m?l<o
 d:h.getRight();e=e>h.getBottom()?e:h.getBottom()}a()};this.inflate=function(h){b-=h;c-=h;d+=h;e+=h;a()};this.minSelf=function(h){b=b>h.getLeft()?b:h.getLeft();c=c>h.getTop()?c:h.getTop();d=d<h.getRight()?d:h.getRight();e=e<h.getBottom()?e:h.getBottom();a()};this.instersects=function(h){return Math.min(d,h.getRight())-Math.max(b,h.getLeft())>=0&&Math.min(e,h.getBottom())-Math.max(c,h.getTop())>=0};this.empty=function(){i=!0;e=d=c=b=0;a()};this.isEmpty=function(){return i}};
 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,e,f,g,i,h,l,n,m,k,o,r,v){this.set(a||1,b||0,c||0,d||0,e||0,f||1,g||0,i||0,h||0,l||0,n||1,m||0,k||0,o||0,r||0,v||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,i,h,l,n,m,k,o,r,v){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=l;this.n33=n;this.n34=m;this.n41=k;this.n42=o;this.n43=r;this.n44=v;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,
-e=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();d.cross(c,f).normalize();e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n14=a.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n24=a.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;this.n34=a.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=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)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*
-b+this.n32*c+this.n33*d+this.n34)*e;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,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;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,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,l=a.n24,n=a.n31,m=a.n32,k=a.n33,o=a.n34,r=a.n41,v=a.n42,u=a.n43,j=a.n44,J=b.n11,q=b.n12,A=b.n13,F=b.n14,R=b.n21,B=b.n22,z=b.n23,L=b.n24,G=b.n31,N=b.n32,H=b.n33,s=b.n34;this.n11=c*
-J+d*R+e*G;this.n12=c*q+d*B+e*N;this.n13=c*A+d*z+e*H;this.n14=c*F+d*L+e*s+f;this.n21=g*J+i*R+h*G;this.n22=g*q+i*B+h*N;this.n23=g*A+i*z+h*H;this.n24=g*F+i*L+h*s+l;this.n31=n*J+m*R+k*G;this.n32=n*q+m*B+k*N;this.n33=n*A+m*z+k*H;this.n34=n*F+m*L+k*s+o;this.n41=r*J+v*R+u*G;this.n42=r*q+v*B+u*N;this.n43=r*A+v*z+u*H;this.n44=r*F+v*L+u*s+j;return this},multiplyToArray:function(a,b,c){this.multiply(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){this.multiply(this,a);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,e=this.n21,
-f=this.n22,g=this.n23,i=this.n24,h=this.n31,l=this.n32,n=this.n33,m=this.n34,k=this.n41,o=this.n42,r=this.n43,v=this.n44;return d*g*l*k-c*i*l*k-d*f*n*k+b*i*n*k+c*f*m*k-b*g*m*k-d*g*h*o+c*i*h*o+d*e*n*o-a*i*n*o-c*e*m*o+a*g*m*o+d*f*h*r-b*i*h*r-d*e*l*r+a*i*l*r+b*e*m*r-a*f*m*r-c*f*h*v+b*g*h*v+c*e*l*v-a*g*l*v-b*e*n*v+a*f*n*v},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.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=
-this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(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},
-setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,h=e*f,l=e*g;this.set(h*f+c,h*g-d*i,h*i+d*g,0,h*g+d*i,l*g+c,l*i-d*f,0,h*i-d*g,
-l*i+d*f,e*i*i+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 e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,i=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=i*f+a*d;this.n22=-i*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d;a=
-b*f;var h=b*g;b*=i;var l=c*g;c*=i;d*=i;f*=e;g*=e;e*=i;this.n11=1-(l+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+l)},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},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/
-b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
+THREE.Matrix4.prototype={set:function(a,b,c,d,e,f,g,i,h,l,n,m,k,o,r,v){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=f;this.n23=g;this.n24=i;this.n31=h;this.n32=l;this.n33=n;this.n34=m;this.n41=k;this.n42=o;this.n43=r;this.n44=v;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.__v1,
+e=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();d.cross(c,f).normalize();e.cross(f,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=f.x;this.n21=d.y;this.n22=e.y;this.n23=f.y;this.n31=d.z;this.n32=e.z;this.n33=f.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,e=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)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;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,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;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,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,l=a.n24,n=a.n31,m=a.n32,k=a.n33,o=a.n34,r=a.n41,v=a.n42,u=a.n43,j=a.n44,J=b.n11,q=b.n12,A=b.n13,F=b.n14,R=b.n21,B=b.n22,z=b.n23,L=b.n24,G=b.n31,N=b.n32,H=b.n33,s=b.n34;this.n11=c*J+d*R+e*G;this.n12=c*q+d*B+e*N;this.n13=c*
+A+d*z+e*H;this.n14=c*F+d*L+e*s+f;this.n21=g*J+i*R+h*G;this.n22=g*q+i*B+h*N;this.n23=g*A+i*z+h*H;this.n24=g*F+i*L+h*s+l;this.n31=n*J+m*R+k*G;this.n32=n*q+m*B+k*N;this.n33=n*A+m*z+k*H;this.n34=n*F+m*L+k*s+o;this.n41=r*J+v*R+u*G;this.n42=r*q+v*B+u*N;this.n43=r*A+v*z+u*H;this.n44=r*F+v*L+u*s+j;return this},multiplyToArray:function(a,b,c){this.multiply(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){this.multiply(this,a);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,e=this.n21,f=this.n22,g=this.n23,i=this.n24,
+h=this.n31,l=this.n32,n=this.n33,m=this.n34,k=this.n41,o=this.n42,r=this.n43,v=this.n44;return d*g*l*k-c*i*l*k-d*f*n*k+b*i*n*k+c*f*m*k-b*g*m*k-d*g*h*o+c*i*h*o+d*e*n*o-a*i*n*o-c*e*m*o+a*g*m*o+d*f*h*r-b*i*h*r-d*e*l*r+a*i*l*r+b*e*m*r-a*f*m*r-c*f*h*v+b*g*h*v+c*e*l*v-a*g*l*v-b*e*n*v+a*f*n*v},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.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;
+this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(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},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,f=a.x,g=a.y,i=a.z,h=e*f,l=e*g;this.set(h*f+c,h*g-d*i,h*i+d*g,0,h*g+d*i,l*g+c,l*i-d*f,0,h*i-d*g,l*i+d*f,e*i*i+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 e=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var g=a*c,i=b*c;this.n11=e*f;this.n12=-e*d;this.n13=c;this.n21=i*f+a*d;this.n22=-i*d+a*f;this.n23=-b*e;this.n31=-g*f+b*d;this.n32=g*d+b*f;this.n33=a*e;return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,e=a.w,f=b+b,g=c+c,i=d+d;a=b*f;var h=b*g;b*=i;var l=c*g;
+c*=i;d*=i;f*=e;g*=e;e*=i;this.n11=1-(l+d);this.n12=h-e;this.n13=b+g;this.n21=h+e;this.n22=1-(a+d);this.n23=c-f;this.n31=b-g;this.n32=c+f;this.n33=1-(a+l);return this},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},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,d=1/b.y,e=1/b.z;this.n11=
+a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
 THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,e=a.n13,f=a.n14,g=a.n21,i=a.n22,h=a.n23,l=a.n24,n=a.n31,m=a.n32,k=a.n33,o=a.n34,r=a.n41,v=a.n42,u=a.n43,j=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=h*o*v-l*k*v+l*m*u-i*o*u-h*m*j+i*k*j;b.n12=f*k*v-e*o*v-f*m*u+d*o*u+e*m*j-d*k*j;b.n13=e*l*v-f*h*v+f*i*u-d*l*u-e*i*j+d*h*j;b.n14=f*h*m-e*l*m-f*i*k+d*l*k+e*i*o-d*h*o;b.n21=l*k*r-h*o*r-l*n*u+g*o*u+h*n*j-g*k*j;b.n22=e*o*r-f*k*r+f*n*u-c*o*u-e*n*j+c*k*j;b.n23=f*h*r-e*l*r-f*g*u+c*l*u+e*g*j-c*h*j;
 b.n24=e*l*n-f*h*n+f*g*k-c*l*k-e*g*o+c*h*o;b.n31=i*o*r-l*m*r+l*n*v-g*o*v-i*n*j+g*m*j;b.n32=f*m*r-d*o*r-f*n*v+c*o*v+d*n*j-c*m*j;b.n33=e*l*r-f*i*r+f*g*v-c*l*v-d*g*j+c*i*j;b.n34=f*i*n-d*l*n-f*g*m+c*l*m+d*g*o-c*i*o;b.n41=h*m*r-i*k*r-h*n*v+g*k*v+i*n*u-g*m*u;b.n42=d*k*r-e*m*r+e*n*v-c*k*v-d*n*u+c*m*u;b.n43=e*i*r-d*h*r-e*g*v+c*h*v+d*g*u-c*i*u;b.n44=d*h*n-e*i*n+e*g*m-c*h*m-d*g*k+c*i*k;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,e=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,g=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,h=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*g+a.n31*l;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*e;c[2]=a*f;c[3]=a*g;c[4]=a*i;c[5]=a*h;c[6]=a*l;c[7]=a*n;c[8]=a*m;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,e,f){var g;g=new THREE.Matrix4;g.n11=2*e/(b-a);g.n12=0;g.n13=(b+a)/(b-a);g.n14=0;g.n21=0;g.n22=2*e/(d-c);g.n23=(d+c)/(d-c);g.n24=0;g.n31=0;g.n32=0;g.n33=-(f+e)/(f-e);g.n34=-2*f*e/(f-e);g.n41=0;g.n42=0;g.n43=-1;g.n44=0;return g};THREE.Matrix4.makePerspective=function(a,b,c,d){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,d)};
-THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,i,h,l;g=new THREE.Matrix4;i=b-a;h=c-d;l=f-e;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/l;g.n34=-((f+e)/l);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};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;
-this.visible=!0};
-THREE.Object3D.prototype={translateX:function(){},translateY:function(){},translateZ:function(){},lookAt:function(){},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,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,
-this.scale);this.matrixNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}}};THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==undefined?d:1)};
+THREE.Matrix4.makeOrtho=function(a,b,c,d,e,f){var g,i,h,l;g=new THREE.Matrix4;i=b-a;h=c-d;l=f-e;g.n11=2/i;g.n12=0;g.n13=0;g.n14=-((b+a)/i);g.n21=0;g.n22=2/h;g.n23=0;g.n24=-((c+d)/h);g.n31=0;g.n32=0;g.n33=-2/l;g.n34=-((f+e)/l);g.n41=0;g.n42=0;g.n43=0;g.n44=1;return g};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
+!0};
+THREE.Object3D.prototype={lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},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,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,
+this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,b,c)}}};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,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},
 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}};
@@ -60,12 +61,12 @@ for(c=this.faces.length;b<c;b++){d=this.faces[b];e=this.uvs[b];if(d instanceof T
 this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){H.copy(this.vertices[b].normal);d=R[b];G.copy(d);G.subSelf(H.multiplyScalar(H.dot(d))).normalize();N.cross(this.vertices[b].normal,d);d=N.dot(B[b]);d=d<0?-1:1;this.vertices[b].tangent.set(G.x,G.y,G.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>
 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.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;var f=new THREE.Vector3;this.translateX=function(g,i){f.sub(this.target.position,this.position).normalize().multiplyScalar(g);f.crossSelf(this.up);if(i)f.y=0;this.position.addSelf(f);this.target.position.addSelf(f)};this.translateZ=
-function(g,i){f.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(i)f.y=0;this.position.subSelf(f);this.target.position.subSelf(f)};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.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)};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;
-THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
-THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};
+THREE.Camera=function(a,b,c,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix();var f=new THREE.Vector3;this.translateX=function(g,i){f.sub(this.target.position,this.position).normalize().multiplyScalar(g);f.crossSelf(this.up);if(i)f.y=0;this.position.addSelf(f);this.target.position.addSelf(f)};this.translateZ=
+function(g,i){f.sub(this.target.position,this.position).normalize().multiplyScalar(g);if(i)f.y=0;this.position.subSelf(f);this.target.position.subSelf(f)}};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.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);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.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
+!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)};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;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
+THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
@@ -87,13 +88,13 @@ undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexCo
 THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
+THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
 b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
 THREE.Sound=function(a,b,c,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var e;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)e=
 "audio/mpeg";else if(b.indexOf(".ogg")!==-1)e="audio/ogg";else b.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};
+THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,b,c)};
 THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;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])};

+ 66 - 65
build/custom/ThreeWebGL.js

@@ -8,10 +8,11 @@ this.length());return this},length:function(){return Math.sqrt(this.lengthSq())}
 THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
 c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,d=this.y,e=this.z;this.set(d*a.z-e*a.y,e*a.x-c*a.z,c*a.y-d*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
-this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},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,c,d,e){this.set(a||0,c||0,d||0,e||1)};
+this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-a.n23/c,a.n33/c);this.z=Math.atan2(-a.n13/c,a.n11/c)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},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,c,d,e){this.set(a||0,c||0,d||0,e||1)};
 THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;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,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.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,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.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,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,h=[];a=0;for(c=e.length;a<c;a++){d=e[a];d instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(d)))}h.sort(function(l,m){return l.distance-m.distance});return h},intersectObject:function(a){function c(L,M,Z,X){X=X.clone().subSelf(M);Z=Z.clone().subSelf(M);var P=L.clone().subSelf(M);L=X.dot(X);M=X.dot(Z);X=X.dot(P);var W=Z.dot(Z);Z=Z.dot(P);P=1/(L*W-M*M);W=(W*X-M*Z)*P;L=(L*Z-M*X)*P;return W>0&&L>0&&W+L<1}var d,e,h,l,m,q,n,w,A,y,
+THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,h=[];a=0;for(c=e.length;a<c;a++){d=e[a];d instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(d)))}h.sort(function(l,m){return l.distance-m.distance});return h},intersectObject:function(a){function c(L,M,Z,X){X=X.clone().subSelf(M);Z=Z.clone().subSelf(M);var O=L.clone().subSelf(M);L=X.dot(X);M=X.dot(Z);X=X.dot(O);var W=Z.dot(Z);Z=Z.dot(O);O=1/(L*W-M*M);W=(W*X-M*Z)*O;L=(L*Z-M*X)*O;return W>0&&L>0&&W+L<1}var d,e,h,l,m,q,n,w,A,y,
 D,E=a.geometry,F=E.vertices,H=[];d=0;for(e=E.faces.length;d<e;d++){h=E.faces[d];y=this.origin.clone();D=this.direction.clone();n=a.matrixWorld;l=n.multiplyVector3(F[h.a].position.clone());m=n.multiplyVector3(F[h.b].position.clone());q=n.multiplyVector3(F[h.c].position.clone());n=h instanceof THREE.Face4?n.multiplyVector3(F[h.d].position.clone()):null;w=a.matrixRotationWorld.multiplyVector3(h.normal.clone());A=D.dot(w);if(A<0){w=w.dot((new THREE.Vector3).sub(l,y))/A;y=y.addSelf(D.multiplyScalar(w));
 if(h instanceof THREE.Face3){if(c(y,l,m,q)){h={distance:this.origin.distanceTo(y),point:y,face:h,object:a};H.push(h)}}else if(h instanceof THREE.Face4&&(c(y,l,m,n)||c(y,m,q,n))){h={distance:this.origin.distanceTo(y),point:y,face:h,object:a};H.push(h)}}}return H}};
 THREE.Rectangle=function(){function a(){l=e-c;m=h-d}var c,d,e,h,l,m,q=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return l};this.getHeight=function(){return m};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(n,w,A,y){q=!1;c=n;d=w;e=A;h=y;a()};this.addPoint=function(n,w){if(q){q=!1;c=n;d=w;e=n;h=w}else{c=c<n?c:n;d=d<w?d:w;e=e>n?e:n;h=h>w?h:w}a()};
@@ -19,30 +20,30 @@ this.add3Points=function(n,w,A,y,D,E){if(q){q=!1;c=n<A?n<D?n:D:A<D?A:D;d=w<y?w<E
 e:n.getRight();h=h>n.getBottom()?h:n.getBottom()}a()};this.inflate=function(n){c-=n;d-=n;e+=n;h+=n;a()};this.minSelf=function(n){c=c>n.getLeft()?c: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(c,n.getLeft())>=0&&Math.min(h,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){q=!0;h=e=d=c=0;a()};this.isEmpty=function(){return q}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
 THREE.Matrix4=function(a,c,d,e,h,l,m,q,n,w,A,y,D,E,F,H){this.set(a||1,c||0,d||0,e||0,h||0,l||1,m||0,q||0,n||0,w||0,A||1,y||0,D||0,E||0,F||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,c,d,e,h,l,m,q,n,w,A,y,D,E,F,H){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=l;this.n23=m;this.n24=q;this.n31=n;this.n32=w;this.n33=A;this.n34=y;this.n41=D;this.n42=E;this.n43=F;this.n44=H;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,c,d){var e=THREE.Matrix4.__tmpVec1,
-h=THREE.Matrix4.__tmpVec2,l=THREE.Matrix4.__tmpVec3;l.sub(a,c).normalize();e.cross(d,l).normalize();h.cross(l,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=l.x;this.n14=a.x;this.n21=e.y;this.n22=h.y;this.n23=l.y;this.n24=a.y;this.n31=e.z;this.n32=h.z;this.n33=l.z;this.n34=a.z;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,h=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*h;a.z=(this.n31*
-c+this.n32*d+this.n33*e+this.n34)*h;return a},multiplyVector3OnlyZ:function(a){var c=a.x,d=a.y;a=a.z;return(this.n31*c+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*c+this.n42*d+this.n43*a+this.n44))},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23*e+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*h;return a},crossVector:function(a){var c=new THREE.Vector4;
-c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,h=a.n13,l=a.n14,m=a.n21,q=a.n22,n=a.n23,w=a.n24,A=a.n31,y=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44,Z=c.n11,X=c.n12,P=c.n13,W=c.n14,b=c.n21,ka=c.n22,oa=c.n23,la=c.n24,ma=c.n31,ra=c.n32,pa=c.n33,qa=c.n34;this.n11=
-d*Z+e*b+h*ma;this.n12=d*X+e*ka+h*ra;this.n13=d*P+e*oa+h*pa;this.n14=d*W+e*la+h*qa+l;this.n21=m*Z+q*b+n*ma;this.n22=m*X+q*ka+n*ra;this.n23=m*P+q*oa+n*pa;this.n24=m*W+q*la+n*qa+w;this.n31=A*Z+y*b+D*ma;this.n32=A*X+y*ka+D*ra;this.n33=A*P+y*oa+D*pa;this.n34=A*W+y*la+D*qa+E;this.n41=F*Z+H*b+L*ma;this.n42=F*X+H*ka+L*ra;this.n43=F*P+H*oa+L*pa;this.n44=F*W+H*la+L*qa+M;return this},multiplyToArray:function(a,c,d){this.multiply(a,c);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){this.multiply(this,a);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,c=this.n12,
-d=this.n13,e=this.n14,h=this.n21,l=this.n22,m=this.n23,q=this.n24,n=this.n31,w=this.n32,A=this.n33,y=this.n34,D=this.n41,E=this.n42,F=this.n43,H=this.n44;return e*m*w*D-d*q*w*D-e*l*A*D+c*q*A*D+d*l*y*D-c*m*y*D-e*m*n*E+d*q*n*E+e*h*A*E-a*q*A*E-d*h*y*E+a*m*y*E+e*l*n*F-c*q*n*F-e*h*w*F+a*q*w*F+c*h*y*F-a*l*y*F-d*l*n*H+c*m*n*H+d*h*w*H-a*m*w*H-c*h*A*H+a*l*A*H},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.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;
-this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(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,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,
-0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),h=1-d,l=a.x,m=a.y,q=a.z,n=h*l,w=h*m;this.set(n*l+d,n*m-e*q,n*
-q+e*m,0,n*m+e*q,w*m+d,w*q-e*l,0,n*q-e*m,w*q+e*l,h*q*q+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 c=a.x,d=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var l=Math.cos(e);e=Math.sin(e);var m=a*d,q=c*d;this.n11=h*l;this.n12=-h*e;this.n13=d;this.n21=q*l+a*e;this.n22=-q*e+a*l;this.n23=-c*h;this.n31=-m*l+c*e;this.n32=m*e+c*l;this.n33=a*h},setRotationFromQuaternion:function(a){var c=a.x,
-d=a.y,e=a.z,h=a.w,l=c+c,m=d+d,q=e+e;a=c*l;var n=c*m;c*=q;var w=d*m;d*=q;e*=q;l*=h;m*=h;h*=q;this.n11=1-(w+e);this.n12=n-h;this.n13=c+m;this.n21=n+h;this.n22=1-(a+e);this.n23=d-l;this.n31=c-m;this.n32=d+l;this.n33=1-(a+w)},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=d;this.n13*=a;this.n21*=c;this.n22*=d;this.n23*=a;this.n31*=c;this.n32*=d;this.n33*=a;this.n41*=c;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,
-c){var d=1/c.x,e=1/c.y,h=1/c.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*h;this.n23=a.n23*h;this.n33=a.n33*h}};
+THREE.Matrix4.prototype={set:function(a,c,d,e,h,l,m,q,n,w,A,y,D,E,F,H){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=l;this.n23=m;this.n24=q;this.n31=n;this.n32=w;this.n33=A;this.n34=y;this.n41=D;this.n42=E;this.n43=F;this.n44=H;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,c,d){var e=THREE.Matrix4.__v1,
+h=THREE.Matrix4.__v2,l=THREE.Matrix4.__v3;l.sub(a,c).normalize();e.cross(d,l).normalize();h.cross(l,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=l.x;this.n21=e.y;this.n22=h.y;this.n23=l.y;this.n31=e.z;this.n32=h.z;this.n33=l.z;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,h=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*h;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*h;return a},
+multiplyVector3OnlyZ:function(a){var c=a.x,d=a.y;a=a.z;return(this.n31*c+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*c+this.n42*d+this.n43*a+this.n44))},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23*e+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*h;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+
+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,h=a.n13,l=a.n14,m=a.n21,q=a.n22,n=a.n23,w=a.n24,A=a.n31,y=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44,Z=c.n11,X=c.n12,O=c.n13,W=c.n14,b=c.n21,ka=c.n22,oa=c.n23,la=c.n24,ma=c.n31,ra=c.n32,pa=c.n33,qa=c.n34;this.n11=d*Z+e*b+h*ma;this.n12=d*X+e*ka+h*ra;this.n13=
+d*O+e*oa+h*pa;this.n14=d*W+e*la+h*qa+l;this.n21=m*Z+q*b+n*ma;this.n22=m*X+q*ka+n*ra;this.n23=m*O+q*oa+n*pa;this.n24=m*W+q*la+n*qa+w;this.n31=A*Z+y*b+D*ma;this.n32=A*X+y*ka+D*ra;this.n33=A*O+y*oa+D*pa;this.n34=A*W+y*la+D*qa+E;this.n41=F*Z+H*b+L*ma;this.n42=F*X+H*ka+L*ra;this.n43=F*O+H*oa+L*pa;this.n44=F*W+H*la+L*qa+M;return this},multiplyToArray:function(a,c,d){this.multiply(a,c);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){this.multiply(this,a);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,c=this.n12,d=this.n13,e=this.n14,h=this.n21,l=this.n22,
+m=this.n23,q=this.n24,n=this.n31,w=this.n32,A=this.n33,y=this.n34,D=this.n41,E=this.n42,F=this.n43,H=this.n44;return e*m*w*D-d*q*w*D-e*l*A*D+c*q*A*D+d*l*y*D-c*m*y*D-e*m*n*E+d*q*n*E+e*h*A*E-a*q*A*E-d*h*y*E+a*m*y*E+e*l*n*F-c*q*n*F-e*h*w*F+a*q*w*F+c*h*y*F-a*l*y*F-d*l*n*H+c*m*n*H+d*h*w*H-a*m*w*H-c*h*A*H+a*l*A*H},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.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;
+this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(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,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var c=
+Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),h=1-d,l=a.x,m=a.y,q=a.z,n=h*l,w=h*m;this.set(n*l+d,n*m-e*q,n*q+e*m,0,n*m+e*q,w*m+d,w*q-e*l,0,n*q-e*m,w*q+e*l,h*q*q+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 c=a.x,d=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var l=Math.cos(e);e=Math.sin(e);var m=a*d,q=c*d;this.n11=h*l;this.n12=-h*e;this.n13=d;this.n21=q*l+a*e;this.n22=-q*e+a*l;this.n23=-c*h;this.n31=-m*l+c*e;this.n32=m*e+c*l;this.n33=a*h;return this},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,e=a.z,h=a.w,l=c+c,m=d+d,q=e+e;a=c*l;var n=c*m;c*=q;var w=d*m;
+d*=q;e*=q;l*=h;m*=h;h*=q;this.n11=1-(w+e);this.n12=n-h;this.n13=c+m;this.n21=n+h;this.n22=1-(a+e);this.n23=d-l;this.n31=c-m;this.n32=d+l;this.n33=1-(a+w);return this},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=d;this.n13*=a;this.n21*=c;this.n22*=d;this.n23*=a;this.n31*=c;this.n32*=d;this.n33*=a;this.n41*=c;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var d=1/c.x,e=1/c.y,h=1/c.z;this.n11=
+a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*h;this.n23=a.n23*h;this.n33=a.n33*h}};
 THREE.Matrix4.makeInvert=function(a,c){var d=a.n11,e=a.n12,h=a.n13,l=a.n14,m=a.n21,q=a.n22,n=a.n23,w=a.n24,A=a.n31,y=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=n*E*H-w*D*H+w*y*L-q*E*L-n*y*M+q*D*M;c.n12=l*D*H-h*E*H-l*y*L+e*E*L+h*y*M-e*D*M;c.n13=h*w*H-l*n*H+l*q*L-e*w*L-h*q*M+e*n*M;c.n14=l*n*y-h*w*y-l*q*D+e*w*D+h*q*E-e*n*E;c.n21=w*D*F-n*E*F-w*A*L+m*E*L+n*A*M-m*D*M;c.n22=h*E*F-l*D*F+l*A*L-d*E*L-h*A*M+d*D*M;c.n23=l*n*F-h*w*F-l*m*L+d*w*L+h*m*M-d*n*M;
 c.n24=h*w*A-l*n*A+l*m*D-d*w*D-h*m*E+d*n*E;c.n31=q*E*F-w*y*F+w*A*H-m*E*H-q*A*M+m*y*M;c.n32=l*y*F-e*E*F-l*A*H+d*E*H+e*A*M-d*y*M;c.n33=h*w*F-l*q*F+l*m*H-d*w*H-e*m*M+d*q*M;c.n34=l*q*A-e*w*A-l*m*y+d*w*y+e*m*E-d*q*E;c.n41=n*y*F-q*D*F-n*A*H+m*D*H+q*A*L-m*y*L;c.n42=e*D*F-h*y*F+h*A*H-d*D*H-e*A*L+d*y*L;c.n43=h*q*F-e*n*F-h*m*H+d*n*H+e*m*L-d*q*L;c.n44=e*n*A-h*q*A+h*m*y-d*n*y-e*m*D+d*q*D;c.multiplyScalar(1/a.determinant());return c};
 THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,e=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,l=a.n32*a.n21-a.n31*a.n22,m=-a.n33*a.n12+a.n32*a.n13,q=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,w=a.n23*a.n12-a.n22*a.n13,A=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*m+a.n31*w;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*h;d[2]=a*l;d[3]=a*m;d[4]=a*q;d[5]=a*n;d[6]=a*w;d[7]=a*A;d[8]=a*y;return c};
 THREE.Matrix4.makeFrustum=function(a,c,d,e,h,l){var m;m=new THREE.Matrix4;m.n11=2*h/(c-a);m.n12=0;m.n13=(c+a)/(c-a);m.n14=0;m.n21=0;m.n22=2*h/(e-d);m.n23=(e+d)/(e-d);m.n24=0;m.n31=0;m.n32=0;m.n33=-(l+h)/(l-h);m.n34=-2*l*h/(l-h);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(a,c,d,e){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,e)};
-THREE.Matrix4.makeOrtho=function(a,c,d,e,h,l){var m,q,n,w;m=new THREE.Matrix4;q=c-a;n=d-e;w=l-h;m.n11=2/q;m.n12=0;m.n13=0;m.n14=-((c+a)/q);m.n21=0;m.n22=2/n;m.n23=0;m.n24=-((d+e)/n);m.n31=0;m.n32=0;m.n33=-2/w;m.n34=-((l+h)/w);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};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;
-this.visible=!0};
-THREE.Object3D.prototype={translateX:function(){},translateY:function(){},translateZ:function(){},lookAt:function(){},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 c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,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,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,
-this.scale);this.matrixNeedsUpdate=!1;c=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,c,d)}}};THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,c,d,e){this.set(a||0,c||0,d||0,e!==undefined?e:1)};
+THREE.Matrix4.makeOrtho=function(a,c,d,e,h,l){var m,q,n,w;m=new THREE.Matrix4;q=c-a;n=d-e;w=l-h;m.n11=2/q;m.n12=0;m.n13=0;m.n14=-((c+a)/q);m.n21=0;m.n22=2/n;m.n23=0;m.n24=-((d+e)/n);m.n31=0;m.n32=0;m.n33=-2/w;m.n34=-((l+h)/w);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
+!0};
+THREE.Object3D.prototype={lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},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 c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,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,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,
+this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,c,d)}}};THREE.Quaternion=function(a,c,d,e){this.set(a||0,c||0,d||0,e!==undefined?e:1)};
 THREE.Quaternion.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,d=a.x*c,e=a.y*c,h=a.z*c;a=Math.cos(e);e=Math.sin(e);c=Math.cos(-h);h=Math.sin(-h);var l=Math.cos(d);d=Math.sin(d);var m=a*c,q=e*h;this.w=m*l-q*d;this.x=m*d+q*l;this.y=e*c*l+a*h*d;this.z=a*h*l-e*c*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 c=this.x,d=this.y,e=this.z,h=this.w,l=a.x,m=a.y,q=a.z;a=a.w;this.x=c*a+h*l+d*q-e*m;this.y=d*a+h*m+e*l-c*q;this.z=e*a+h*q+c*m-d*l;this.w=h*a-c*l-d*m-e*q;return this},
 multiplyVector3:function(a,c){c||(c=a);var d=a.x,e=a.y,h=a.z,l=this.x,m=this.y,q=this.z,n=this.w,w=n*d+m*h-q*e,A=n*e+q*d-l*h,y=n*h+l*e-m*d;d=-l*d-m*e-q*h;c.x=w*n+d*-l+A*-q-y*-m;c.y=A*n+d*-m+y*-l-w*-q;c.z=y*n+d*-q+w*-m-A*-l;return c}};
@@ -55,17 +56,17 @@ d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},co
 d.position);n.sub(c.position,d.position);q.crossSelf(n)}q.isZero()||q.normalize();l.normal.copy(q)}},computeVertexNormals:function(){var a,c,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;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(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;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(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<
 c;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(qa,ha,ua,Aa,Ca,wa,Fa){l=qa.vertices[ha].position;m=qa.vertices[ua].position;q=qa.vertices[Aa].position;n=h[Ca];w=h[wa];A=h[Fa];y=m.x-l.x;D=q.x-l.x;E=m.y-
-l.y;F=q.y-l.y;H=m.z-l.z;L=q.z-l.z;M=w.u-n.u;Z=A.u-n.u;X=w.v-n.v;P=A.v-n.v;W=1/(M*P-Z*X);oa.set((P*y-X*D)*W,(P*E-X*F)*W,(P*H-X*L)*W);la.set((M*D-Z*y)*W,(M*F-Z*E)*W,(M*L-Z*H)*W);b[ha].addSelf(oa);b[ua].addSelf(oa);b[Aa].addSelf(oa);ka[ha].addSelf(la);ka[ua].addSelf(la);ka[Aa].addSelf(la)}var c,d,e,h,l,m,q,n,w,A,y,D,E,F,H,L,M,Z,X,P,W,b=[],ka=[],oa=new THREE.Vector3,la=new THREE.Vector3,ma=new THREE.Vector3,ra=new THREE.Vector3,pa=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){b[c]=new THREE.Vector3;
+l.y;F=q.y-l.y;H=m.z-l.z;L=q.z-l.z;M=w.u-n.u;Z=A.u-n.u;X=w.v-n.v;O=A.v-n.v;W=1/(M*O-Z*X);oa.set((O*y-X*D)*W,(O*E-X*F)*W,(O*H-X*L)*W);la.set((M*D-Z*y)*W,(M*F-Z*E)*W,(M*L-Z*H)*W);b[ha].addSelf(oa);b[ua].addSelf(oa);b[Aa].addSelf(oa);ka[ha].addSelf(la);ka[ua].addSelf(la);ka[Aa].addSelf(la)}var c,d,e,h,l,m,q,n,w,A,y,D,E,F,H,L,M,Z,X,O,W,b=[],ka=[],oa=new THREE.Vector3,la=new THREE.Vector3,ma=new THREE.Vector3,ra=new THREE.Vector3,pa=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){b[c]=new THREE.Vector3;
 ka[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];h=this.uvs[c];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])}}c=0;for(d=this.vertices.length;c<d;c++){pa.copy(this.vertices[c].normal);e=b[c];ma.copy(e);ma.subSelf(pa.multiplyScalar(pa.dot(e))).normalize();ra.cross(this.vertices[c].normal,e);e=ra.dot(ka[c]);e=e<0?-1:1;this.vertices[c].tangent.set(ma.x,ma.y,ma.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 c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];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,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.Camera=function(a,c,d,e,h){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||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;var l=new THREE.Vector3;this.translateX=function(m,q){l.sub(this.target.position,this.position).normalize().multiplyScalar(m);l.crossSelf(this.up);if(q)l.y=0;this.position.addSelf(l);this.target.position.addSelf(l)};this.translateZ=
-function(m,q){l.sub(this.target.position,this.position).normalize().multiplyScalar(m);if(q)l.y=0;this.position.subSelf(l);this.target.position.subSelf(l)};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.update=function(a,c,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);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,
-this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,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;
-THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
-THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
+THREE.Camera=function(a,c,d,e,h){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=d||0.1;this.far=e||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix();var l=new THREE.Vector3;this.translateX=function(m,q){l.sub(this.target.position,this.position).normalize().multiplyScalar(m);l.crossSelf(this.up);if(q)l.y=0;this.position.addSelf(l);this.target.position.addSelf(l)};this.translateZ=
+function(m,q){l.sub(this.target.position,this.position).normalize().multiplyScalar(m);if(q)l.y=0;this.position.subSelf(l);this.target.position.subSelf(l)}};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.update=function(a,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
+!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,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;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
+THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
@@ -95,13 +96,13 @@ var Uniforms={clone:function(a){var c,d,e,h={};for(c in a){h[c]={};for(d in a[c]
 THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixNeedsUpdate=!1;c=!0}var e,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<h;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,c,d):a.update(this.matrixWorld,!0,d)}}else for(e=0;e<h;e++)this.children[e].update(this.skinMatrix,
+THREE.Bone.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<h;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,c,d):a.update(this.matrixWorld,!0,d)}}else for(e=0;e<h;e++)this.children[e].update(this.skinMatrix,
 c,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
 THREE.Sound=function(a,c,d,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var h;d=this.sources.length;for(a=0;a<d;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)h=
 "audio/mpeg";else if(c.indexOf(".ogg")!==-1)h="audio/ogg";else c.indexOf(".wav")!==-1&&(h="audio/wav");if(this.domElement.canPlayType(h)){h=document.createElement("source");h.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(h);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,c,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;c=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,c,d)};
+THREE.Sound.prototype.update=function(a,c,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,c,d)};
 THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;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 c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
 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 c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
@@ -115,35 +116,35 @@ I.y;t[s+2]=I.z;ea+=1}else if(s instanceof THREE.PointLight){s=z*3;ca[s]=N.r*K;ca
 r.pointLightColor.value=j.point.colors;r.pointLightPosition.value=j.point.positions}if(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity;r.map.texture=g.map;r.lightMap.texture=g.lightMap;r.envMap.texture=g.envMap;r.reflectivity.value=g.reflectivity;r.refractionRatio.value=g.refractionRatio;r.combine.value=g.combine;r.useRefract.value=
 g.envMap&&g.envMap.mapping instanceof THREE.CubeRefractionMapping}if(g instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity}else if(g instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity;r.size.value=g.size;r.map.texture=g.map}else if(g instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(g.ambient.r,g.ambient.g,
 g.ambient.b);r.specular.value.setRGB(g.specular.r,g.specular.g,g.specular.b);r.shininess.value=g.shininess}else if(g instanceof THREE.MeshDepthMaterial){r.mNear.value=f.near;r.mFar.value=f.far;r.opacity.value=g.opacity}else if(g instanceof THREE.MeshNormalMaterial)r.opacity.value=g.opacity;for(var B in r)if(v=u.uniforms[B]){k=r[B];x=k.type;j=k.value;if(x=="i")b.uniform1i(v,j);else if(x=="f")b.uniform1f(v,j);else if(x=="fv1")b.uniform1fv(v,j);else if(x=="fv")b.uniform3fv(v,j);else if(x=="v2")b.uniform2f(v,
-j.x,j.y);else if(x=="v3")b.uniform3f(v,j.x,j.y,j.z);else if(x=="c")b.uniform3f(v,j.r,j.g,j.b);else if(x=="t"){b.uniform1i(v,j);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){try{if((k.image.width&k.image.width-1)!=0||(k.image.height&k.image.height-1)!=0)throw"Texture not power of 2: "+k.image.src;}catch(C){console.error(C)}if(!k.image.__webGLTextureCube)k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);
-b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(x=0;x<6;++x)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[x]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+
-j);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{if(k.needsUpdate){try{if((k.image.width&k.image.width-1)!=0||(k.image.height&k.image.height-1)!=0)throw"Texture not power of 2: "+k.image.src;}catch(O){console.error(O)}if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,P(k.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,P(k.wrapT));b.texParameteri(b.TEXTURE_2D,
-b.TEXTURE_MAG_FILTER,P(k.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,P(k.minFilter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}else{k.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,P(k.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,P(k.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,P(k.magFilter));
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,P(k.minFilter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null);k.__wasSetOnce=!0}k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+j);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}b.uniformMatrix4fv(o.modelViewMatrix,!1,i._modelViewMatrixArray);b.uniformMatrix3fv(o.normalMatrix,!1,i._normalMatrixArray);(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.envMap)&&b.uniform3f(o.cameraPosition,f.position.x,f.position.y,
-f.position.z);(g instanceof THREE.MeshShaderMaterial||g.envMap||g.skinning)&&b.uniformMatrix4fv(o.objectMatrix,!1,i._objectMatrixArray);(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial||g.skinning)&&b.uniformMatrix4fv(o.viewMatrix,!1,Ca);if(g.skinning){b.uniformMatrix4fv(o.cameraInverseMatrix,!1,Ca);b.uniformMatrix4fv(o.boneGlobalMatrices,!1,i.boneMatrices)}return u}function h(f,j,k,g,i,u){f=e(f,j,k,g,u).attributes;b.bindBuffer(b.ARRAY_BUFFER,
-i.__webGLVertexBuffer);b.vertexAttribPointer(f.position,3,b.FLOAT,!1,0,0);if(f.color>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLColorBuffer);b.vertexAttribPointer(f.color,3,b.FLOAT,!1,0,0)}if(f.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLNormalBuffer);b.vertexAttribPointer(f.normal,3,b.FLOAT,!1,0,0)}if(f.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLTangentBuffer);b.vertexAttribPointer(f.tangent,4,b.FLOAT,!1,0,0)}if(f.uv>=0)if(i.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUVBuffer);
-b.vertexAttribPointer(f.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(f.uv)}else b.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(i.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUV2Buffer);b.vertexAttribPointer(f.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(f.uv2)}else b.disableVertexAttribArray(f.uv2);if(g.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);b.vertexAttribPointer(f.skinVertexA,4,b.FLOAT,
-!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);b.vertexAttribPointer(f.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);b.vertexAttribPointer(f.skinIndex,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);b.vertexAttribPointer(f.skinWeight,4,b.FLOAT,!1,0,0)}if(u instanceof THREE.Mesh)if(g.wireframe){b.lineWidth(g.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);b.drawElements(b.LINES,i.__webGLLineCount,
-b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,i.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(u instanceof THREE.Line){u=u.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(g.linewidth);b.drawArrays(u,0,i.__webGLLineCount)}else if(u instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,i.__webGLParticleCount);else u instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,i.__webGLVertexCount)}function l(f,j){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=
-b.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=b.createBuffer();if(f.hasPos){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,f.positionArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(j.attributes.position);b.vertexAttribPointer(j.attributes.position,3,b.FLOAT,!1,0,0)}if(f.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,f.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(j.attributes.normal);b.vertexAttribPointer(j.attributes.normal,
-3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,f.count);f.count=0}function m(f){if(ma!=f.doubleSided){f.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);ma=f.doubleSided}if(ra!=f.flipSided){f.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);ra=f.flipSided}}function q(f){if(qa!=f){f?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);qa=f}}function n(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 j;for(f=0;f<6;f++){j=ha[f];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z*j.z))}}function w(f){for(var j=f.matrixWorld,k=-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*j.n14+ha[g].y*j.n24+ha[g].z*j.n34+ha[g].w;if(f<=k)return!1}return!0}function A(f,
-j){f.list[f.count]=j;f.count+=1}function y(f){var j,k,g=f.object,i=f.opaque,u=f.transparent;u.count=0;f=i.count=0;for(j=g.materials.length;f<j;f++){k=g.materials[f];k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?A(u,k):A(i,k)}}function D(f){var j,k,g,i,u=f.object,o=f.buffer,r=f.opaque,x=f.transparent;x.count=0;f=r.count=0;for(g=u.materials.length;f<g;f++){j=u.materials[f];if(j instanceof THREE.MeshFaceMaterial){j=0;for(k=o.materials.length;j<k;j++)(i=o.materials[j])&&(i.opacity&&i.opacity<
-1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i))}else{i=j;i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i)}}}function E(f,j){return j.z-f.z}function F(f,j){f._modelViewMatrix.multiplyToArray(j.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function H(f){function j(J){var Q=[];k=0;for(g=J.length;k<g;k++)J[k]==undefined?Q.push("undefined"):Q.push(J[k].id);return Q.join("_")}var k,
-g,i,u,o,r,x,s,v={};f.geometryGroups={};i=0;for(u=f.faces.length;i<u;i++){o=f.faces[i];r=o.materials;x=j(r);v[x]==undefined&&(v[x]={hash:x,counter:0});s=v[x].hash+"_"+v[x].counter;f.geometryGroups[s]==undefined&&(f.geometryGroups[s]={faces:[],materials:r,vertices:0});o=o instanceof THREE.Face3?3:4;if(f.geometryGroups[s].vertices+o>65535){v[x].counter+=1;s=v[x].hash+"_"+v[x].counter;f.geometryGroups[s]==undefined&&(f.geometryGroups[s]={faces:[],materials:r,vertices:0})}f.geometryGroups[s].faces.push(i);
-f.geometryGroups[s].vertices+=o}}function L(f,j,k){f.push({buffer:j,object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(f){if(f!=pa){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:b.blendEquation(b.FUNC_REVERSE_SUBTRACT);
-b.blendFunc(b.ONE,b.ONE);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}pa=f}}function Z(f,j){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=b.createFramebuffer();f.__webGLRenderbuffer=b.createRenderbuffer();f.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,f.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,f.width,f.height);b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,
-P(f.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,P(f.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,P(f.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,P(f.minFilter));b.texImage2D(b.TEXTURE_2D,0,P(f.format),f.width,f.height,0,P(f.format),P(f.type),null);b.bindFramebuffer(b.FRAMEBUFFER,f.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,f.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,
-f.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var k,g,i;if(f){k=f.__webGLFramebuffer;g=f.width;i=f.height}else{k=null;g=W.width;i=W.height}if(k!=oa){b.bindFramebuffer(b.FRAMEBUFFER,k);b.viewport(0,0,g,i);j&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);oa=k}}function X(f,j){var k;if(f=="fragment")k=b.createShader(b.FRAGMENT_SHADER);else f=="vertex"&&(k=b.createShader(b.VERTEX_SHADER));b.shaderSource(k,j);b.compileShader(k);
-if(!b.getShaderParameter(k,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(k));return null}return k}function P(f){switch(f){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;
-case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;
-case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var W=document.createElement("canvas"),b,ka=null,oa=null,la=this,ma=null,ra=null,pa=null,qa=null,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,Aa=new Float32Array(16),Ca=new Float32Array(16),wa=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=W;this.autoClear=!0;this.sortObjects=!0;(function(f,j,k){try{if(!(b=W.getContext("experimental-webgl",{antialias:f})))throw"Error creating WebGL context.";}catch(g){console.error(g)}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(j.r,j.g,j.b,k);_cullEnabled=!0})(Fa,La,Ma);this.context=b;this.lights=
-{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,j){W.width=f;W.height=j;b.viewport(0,0,W.width,W.height)};this.setClearColorHex=function(f,j){var k=new THREE.Color(f);b.clearColor(k.r,k.g,k.b,j)};this.setClearColor=function(f,j){b.clearColor(f.r,f.g,f.b,j)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,j,k){var g,i;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 u,o,r,x;i=r=x=0;for(u=j.length;i<u;i++){o=j[i];o instanceof
-THREE.DirectionalLight&&r++;o instanceof THREE.PointLight&&x++}if(x+r<=4)j=r;else{j=Math.ceil(4*r/(x+r));x=4-j}i={directional:j,point:x};x=f.fragmentShader;j=f.vertexShader;u={fog:k,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,skinning:f.skinning,maxDirLights:i.directional,maxPointLights:i.point};k=b.createProgram();i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.fog?"#define USE_FOG":
-"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?
-"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"",u.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");
+j.x,j.y);else if(x=="v3")b.uniform3f(v,j.x,j.y,j.z);else if(x=="c")b.uniform3f(v,j.r,j.g,j.b);else if(x=="t"){b.uniform1i(v,j);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(!k.image.__webGLTextureCube)k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
+b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);(k.image.width&k.image.width-1)==0&&(k.image.height&k.image.height-1)==0?b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR):b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR);for(x=0;x<6;++x)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[x]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+
+j);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image);if((k.image.width&k.image.width-1)==0&&(k.image.height&k.image.height-1)==0){b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,O(k.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,O(k.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,O(k.magFilter));b.texParameteri(b.TEXTURE_2D,
+b.TEXTURE_MIN_FILTER,O(k.minFilter));b.generateMipmap(b.TEXTURE_2D)}else{b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE)}b.bindTexture(b.TEXTURE_2D,null)}else{k.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);if((k.image.width&k.image.width-1)==0&&(k.image.height&k.image.height-
+1)==0){b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,O(k.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,O(k.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,O(k.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,O(k.minFilter));b.generateMipmap(b.TEXTURE_2D)}else{b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE)}b.bindTexture(b.TEXTURE_2D,
+null);k.__wasSetOnce=!0}k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+j);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}b.uniformMatrix4fv(o.modelViewMatrix,!1,i._modelViewMatrixArray);b.uniformMatrix3fv(o.normalMatrix,!1,i._normalMatrixArray);(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.envMap)&&b.uniform3f(o.cameraPosition,f.position.x,f.position.y,f.position.z);(g instanceof THREE.MeshShaderMaterial||g.envMap||g.skinning)&&b.uniformMatrix4fv(o.objectMatrix,!1,i._objectMatrixArray);
+(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial||g.skinning)&&b.uniformMatrix4fv(o.viewMatrix,!1,Ca);if(g.skinning){b.uniformMatrix4fv(o.cameraInverseMatrix,!1,Ca);b.uniformMatrix4fv(o.boneGlobalMatrices,!1,i.boneMatrices)}return u}function h(f,j,k,g,i,u){f=e(f,j,k,g,u).attributes;b.bindBuffer(b.ARRAY_BUFFER,i.__webGLVertexBuffer);b.vertexAttribPointer(f.position,3,b.FLOAT,!1,0,0);if(f.color>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLColorBuffer);
+b.vertexAttribPointer(f.color,3,b.FLOAT,!1,0,0)}if(f.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLNormalBuffer);b.vertexAttribPointer(f.normal,3,b.FLOAT,!1,0,0)}if(f.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLTangentBuffer);b.vertexAttribPointer(f.tangent,4,b.FLOAT,!1,0,0)}if(f.uv>=0)if(i.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUVBuffer);b.vertexAttribPointer(f.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(f.uv)}else b.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(i.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,
+i.__webGLUV2Buffer);b.vertexAttribPointer(f.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(f.uv2)}else b.disableVertexAttribArray(f.uv2);if(g.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);b.vertexAttribPointer(f.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);b.vertexAttribPointer(f.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);b.vertexAttribPointer(f.skinIndex,
+4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);b.vertexAttribPointer(f.skinWeight,4,b.FLOAT,!1,0,0)}if(u instanceof THREE.Mesh)if(g.wireframe){b.lineWidth(g.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);b.drawElements(b.LINES,i.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,i.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(u instanceof THREE.Line){u=u.type==THREE.LineStrip?
+b.LINE_STRIP:b.LINES;b.lineWidth(g.linewidth);b.drawArrays(u,0,i.__webGLLineCount)}else if(u instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,i.__webGLParticleCount);else u instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,i.__webGLVertexCount)}function l(f,j){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=b.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=b.createBuffer();if(f.hasPos){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,f.positionArray,
+b.DYNAMIC_DRAW);b.enableVertexAttribArray(j.attributes.position);b.vertexAttribPointer(j.attributes.position,3,b.FLOAT,!1,0,0)}if(f.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,f.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(j.attributes.normal);b.vertexAttribPointer(j.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,f.count);f.count=0}function m(f){if(ma!=f.doubleSided){f.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);ma=
+f.doubleSided}if(ra!=f.flipSided){f.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);ra=f.flipSided}}function q(f){if(qa!=f){f?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);qa=f}}function n(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 j;for(f=0;f<6;f++){j=ha[f];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z*j.z))}}function w(f){for(var j=f.matrixWorld,k=-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*j.n14+ha[g].y*j.n24+ha[g].z*j.n34+ha[g].w;if(f<=k)return!1}return!0}function A(f,j){f.list[f.count]=j;f.count+=1}function y(f){var j,k,g=f.object,i=f.opaque,u=f.transparent;u.count=0;f=i.count=0;for(j=g.materials.length;f<j;f++){k=
+g.materials[f];k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?A(u,k):A(i,k)}}function D(f){var j,k,g,i,u=f.object,o=f.buffer,r=f.opaque,x=f.transparent;x.count=0;f=r.count=0;for(g=u.materials.length;f<g;f++){j=u.materials[f];if(j instanceof THREE.MeshFaceMaterial){j=0;for(k=o.materials.length;j<k;j++)(i=o.materials[j])&&(i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i))}else{i=j;i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i)}}}function E(f,j){return j.z-
+f.z}function F(f,j){f._modelViewMatrix.multiplyToArray(j.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function H(f){function j(J){var Q=[];k=0;for(g=J.length;k<g;k++)J[k]==undefined?Q.push("undefined"):Q.push(J[k].id);return Q.join("_")}var k,g,i,u,o,r,x,s,v={};f.geometryGroups={};i=0;for(u=f.faces.length;i<u;i++){o=f.faces[i];r=o.materials;x=j(r);v[x]==undefined&&(v[x]={hash:x,counter:0});s=v[x].hash+
+"_"+v[x].counter;f.geometryGroups[s]==undefined&&(f.geometryGroups[s]={faces:[],materials:r,vertices:0});o=o instanceof THREE.Face3?3:4;if(f.geometryGroups[s].vertices+o>65535){v[x].counter+=1;s=v[x].hash+"_"+v[x].counter;f.geometryGroups[s]==undefined&&(f.geometryGroups[s]={faces:[],materials:r,vertices:0})}f.geometryGroups[s].faces.push(i);f.geometryGroups[s].vertices+=o}}function L(f,j,k){f.push({buffer:j,object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(f){if(f!=pa){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);
+b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:b.blendEquation(b.FUNC_REVERSE_SUBTRACT);b.blendFunc(b.ONE,b.ONE);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}pa=f}}function Z(f,j){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=b.createFramebuffer();f.__webGLRenderbuffer=
+b.createRenderbuffer();f.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,f.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,f.width,f.height);b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,O(f.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,O(f.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,O(f.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,O(f.minFilter));b.texImage2D(b.TEXTURE_2D,
+0,O(f.format),f.width,f.height,0,O(f.format),O(f.type),null);b.bindFramebuffer(b.FRAMEBUFFER,f.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,f.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,f.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var k,g,i;if(f){k=f.__webGLFramebuffer;g=f.width;i=f.height}else{k=null;g=W.width;i=W.height}if(k!=
+oa){b.bindFramebuffer(b.FRAMEBUFFER,k);b.viewport(0,0,g,i);j&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);oa=k}}function X(f,j){var k;if(f=="fragment")k=b.createShader(b.FRAGMENT_SHADER);else f=="vertex"&&(k=b.createShader(b.VERTEX_SHADER));b.shaderSource(k,j);b.compileShader(k);if(!b.getShaderParameter(k,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(k));return null}return k}function O(f){switch(f){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;
+case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;
+case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var W=document.createElement("canvas"),b,ka=null,oa=null,la=this,ma=null,ra=null,pa=null,qa=null,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
+new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,Aa=new Float32Array(16),Ca=new Float32Array(16),wa=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=W;this.autoClear=!0;this.sortObjects=!0;(function(f,j,k){try{if(!(b=W.getContext("experimental-webgl",{antialias:f})))throw"Error creating WebGL context.";}catch(g){console.error(g)}b.clearColor(0,
+0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(j.r,j.g,j.b,k);_cullEnabled=!0})(Fa,La,Ma);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,j){W.width=f;W.height=j;b.viewport(0,0,W.width,W.height)};this.setClearColorHex=function(f,j){var k=new THREE.Color(f);
+b.clearColor(k.r,k.g,k.b,j)};this.setClearColor=function(f,j){b.clearColor(f.r,f.g,f.b,j)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,j,k){var g,i;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 u,o,r,x;i=r=x=0;for(u=j.length;i<u;i++){o=j[i];o instanceof THREE.DirectionalLight&&r++;o instanceof THREE.PointLight&&x++}if(x+r<=4)j=r;else{j=Math.ceil(4*r/(x+r));x=4-j}i={directional:j,point:x};x=f.fragmentShader;j=f.vertexShader;u={fog:k,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,
+skinning:f.skinning,maxDirLights:i.directional,maxPointLights:i.point};k=b.createProgram();i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
+u=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"",u.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");
 b.attachShader(k,X("fragment",i+x));b.attachShader(k,X("vertex",u+j));b.linkProgram(k);b.getProgramParameter(k,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(k,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");k.uniforms={};k.attributes={};f.program=k;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(g in f.uniforms)k.push(g);g=f.program;x=0;for(j=k.length;x<
 j;x++){i=k[x];g.uniforms[i]=b.getUniformLocation(g,i)}g=f.program;k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];x=0;for(j=k.length;x<j;x++){i=k[x];g.attributes[i]=b.getAttribLocation(g,i)}g=f.program.attributes;b.enableVertexAttribArray(g.position);g.color>=0&&b.enableVertexAttribArray(g.color);g.normal>=0&&b.enableVertexAttribArray(g.normal);g.tangent>=0&&b.enableVertexAttribArray(g.tangent);if(f.skinning&&g.skinVertexA>=0&&g.skinVertexB>=
 0&&g.skinIndex>=0&&g.skinWeight>=0){b.enableVertexAttribArray(g.skinVertexA);b.enableVertexAttribArray(g.skinVertexB);b.enableVertexAttribArray(g.skinIndex);b.enableVertexAttribArray(g.skinWeight)}};this.render=function(f,j,k,g){var i,u,o,r,x,s,v,J,Q=f.lights,N=f.fog;j.matrixAutoUpdate&&j.update();j.matrixWorldInverse.flattenToArray(Ca);j.projectionMatrix.flattenToArray(Aa);ua.multiply(j.projectionMatrix,j.matrixWorldInverse);n(ua);f.update(undefined,!1,j);this.initWebGLObjects(f,j);Z(k,g!==undefined?
@@ -158,15 +159,15 @@ K.shading==THREE.SmoothShading){I=!0;break}if(I)break}x.__needsSmoothNormals=I;o
 new Float32Array(u*3);g.__webGLVertexCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else if(j instanceof THREE.Line){i=j.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=b.createBuffer();g.__webGLColorBuffer=b.createBuffer();g=i;u=g.vertices.length;g.__vertexArray=new Float32Array(u*3);g.__colorArray=new Float32Array(u*3);g.__webGLLineCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else if(j instanceof THREE.ParticleSystem){i=j.geometry;
 if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=b.createBuffer();g.__webGLColorBuffer=b.createBuffer();g=i;u=g.vertices.length;g.__vertexArray=new Float32Array(u*3);g.__colorArray=new Float32Array(u*3);g.__sortArray=[];g.__webGLParticleCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else THREE.MarchingCubes!==undefined&&j instanceof THREE.MarchingCubes&&k.__webglObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,
 1)}for(;f.__objectsRemoved.length;){j=f.__objectsRemoved[0];k=f;i=void 0;g=void 0;for(i=k.__webglObjects.length-1;i>=0;i--){g=k.__webglObjects[i].object;j==g&&k.__webglObjects.splice(i,1)}f.__objectsRemoved.splice(0,1)}j=0;for(k=f.__webglObjects.length;j<k;j++){g=f.__webglObjects[j].object;u=void 0;i=void 0;o=void 0;if(g instanceof THREE.Mesh){i=g.geometry;for(u in i.geometryGroups){o=i.geometryGroups[u];if(i.__dirtyVertices||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents){J=
-b.DYNAMIC_DRAW;Q=void 0;x=void 0;var fa=void 0,t=void 0,ca=void 0,ba=void 0,ea=void 0;fa=void 0;var z=void 0,B=void 0,C=void 0,O=void 0;z=void 0;B=void 0;C=void 0;t=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;t=void 0;ba=void 0;ca=void 0;ea=void 0;var ga=G=K=I=N=v=r=s=0,Y=0,p=0,$=o.__vertexArray,Da=o.__uvArray,Ea=o.__uv2Array,na=o.__normalArray,R=o.__tangentArray,
+b.DYNAMIC_DRAW;Q=void 0;x=void 0;var fa=void 0,t=void 0,ca=void 0,ba=void 0,ea=void 0;fa=void 0;var z=void 0,B=void 0,C=void 0,P=void 0;z=void 0;B=void 0;C=void 0;t=void 0;z=void 0;B=void 0;C=void 0;P=void 0;z=void 0;B=void 0;C=void 0;P=void 0;z=void 0;B=void 0;C=void 0;P=void 0;z=void 0;B=void 0;C=void 0;P=void 0;z=void 0;B=void 0;C=void 0;P=void 0;t=void 0;ba=void 0;ca=void 0;ea=void 0;var ga=G=K=I=N=v=r=s=0,Y=0,p=0,$=o.__vertexArray,Da=o.__uvArray,Ea=o.__uv2Array,na=o.__normalArray,R=o.__tangentArray,
 aa=o.__colorArray,S=o.__skinVertexAArray,T=o.__skinVertexBArray,U=o.__skinIndexArray,V=o.__skinWeightArray,sa=o.__faceArray,ia=o.__lineArray,Na=o.__needsSmoothNormals,da=g.geometry,Ga=da.__dirtyVertices,Ha=da.__dirtyElements,Ba=da.__dirtyUvs,Ia=da.__dirtyNormals,Ja=da.__dirtyTangents,Ka=da.__dirtyColors,ja=da.vertices,Oa=o.faces,Pa=da.faces,Qa=da.uvs,Ra=da.uvs2,ta=da.colors,xa=da.skinVerticesA,ya=da.skinVerticesB,za=da.skinIndices,va=da.skinWeights;Q=0;for(x=Oa.length;Q<x;Q++){fa=Oa[Q];t=Pa[fa];ea=
 Qa[fa];fa=Ra[fa];ca=t.vertexNormals;ba=t.normal;if(t instanceof THREE.Face3){if(Ga){z=ja[t.a].position;B=ja[t.b].position;C=ja[t.c].position;$[r]=z.x;$[r+1]=z.y;$[r+2]=z.z;$[r+3]=B.x;$[r+4]=B.y;$[r+5]=B.z;$[r+6]=C.x;$[r+7]=C.y;$[r+8]=C.z;r+=9}if(va.length){z=va[t.a];B=va[t.b];C=va[t.c];V[p]=z.x;V[p+1]=z.y;V[p+2]=z.z;V[p+3]=z.w;V[p+4]=B.x;V[p+5]=B.y;V[p+6]=B.z;V[p+7]=B.w;V[p+8]=C.x;V[p+9]=C.y;V[p+10]=C.z;V[p+11]=C.w;z=za[t.a];B=za[t.b];C=za[t.c];U[p]=z.x;U[p+1]=z.y;U[p+2]=z.z;U[p+3]=z.w;U[p+4]=B.x;
 U[p+5]=B.y;U[p+6]=B.z;U[p+7]=B.w;U[p+8]=C.x;U[p+9]=C.y;U[p+10]=C.z;U[p+11]=C.w;z=xa[t.a];B=xa[t.b];C=xa[t.c];S[p]=z.x;S[p+1]=z.y;S[p+2]=z.z;S[p+3]=1;S[p+4]=B.x;S[p+5]=B.y;S[p+6]=B.z;S[p+7]=1;S[p+8]=C.x;S[p+9]=C.y;S[p+10]=C.z;S[p+11]=1;z=ya[t.a];B=ya[t.b];C=ya[t.c];T[p]=z.x;T[p+1]=z.y;T[p+2]=z.z;T[p+3]=1;T[p+4]=B.x;T[p+5]=B.y;T[p+6]=B.z;T[p+7]=1;T[p+8]=C.x;T[p+9]=C.y;T[p+10]=C.z;T[p+11]=1;p+=12}if(Ka&&ta.length){z=ta[t.a];B=ta[t.b];C=ta[t.c];aa[Y]=z.r;aa[Y+1]=z.g;aa[Y+2]=z.b;aa[Y+3]=B.r;aa[Y+4]=B.g;
 aa[Y+5]=B.b;aa[Y+6]=C.r;aa[Y+7]=C.g;aa[Y+8]=C.b;Y+=9}if(Ja&&da.hasTangents){z=ja[t.a].tangent;B=ja[t.b].tangent;C=ja[t.c].tangent;R[G]=z.x;R[G+1]=z.y;R[G+2]=z.z;R[G+3]=z.w;R[G+4]=B.x;R[G+5]=B.y;R[G+6]=B.z;R[G+7]=B.w;R[G+8]=C.x;R[G+9]=C.y;R[G+10]=C.z;R[G+11]=C.w;G+=12}if(Ia)if(ca.length==3&&Na)for(t=0;t<3;t++){ba=ca[t];na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}else for(t=0;t<3;t++){na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}if(Ba&&ea)for(t=0;t<3;t++){ca=ea[t];Da[v]=ca.u;Da[v+1]=ca.v;v+=2}if(Ba&&fa)for(t=
-0;t<3;t++){ea=fa[t];Ea[N]=ea.u;Ea[N+1]=ea.v;N+=2}if(Ha){sa[I]=s;sa[I+1]=s+1;sa[I+2]=s+2;I+=3;ia[ga]=s;ia[ga+1]=s+1;ia[ga+2]=s;ia[ga+3]=s+2;ia[ga+4]=s+1;ia[ga+5]=s+2;ga+=6;s+=3}}else if(t instanceof THREE.Face4){if(Ga){z=ja[t.a].position;B=ja[t.b].position;C=ja[t.c].position;O=ja[t.d].position;$[r]=z.x;$[r+1]=z.y;$[r+2]=z.z;$[r+3]=B.x;$[r+4]=B.y;$[r+5]=B.z;$[r+6]=C.x;$[r+7]=C.y;$[r+8]=C.z;$[r+9]=O.x;$[r+10]=O.y;$[r+11]=O.z;r+=12}if(va.length){z=va[t.a];B=va[t.b];C=va[t.c];O=va[t.d];V[p]=z.x;V[p+1]=
-z.y;V[p+2]=z.z;V[p+3]=z.w;V[p+4]=B.x;V[p+5]=B.y;V[p+6]=B.z;V[p+7]=B.w;V[p+8]=C.x;V[p+9]=C.y;V[p+10]=C.z;V[p+11]=C.w;V[p+12]=O.x;V[p+13]=O.y;V[p+14]=O.z;V[p+15]=O.w;z=za[t.a];B=za[t.b];C=za[t.c];O=za[t.d];U[p]=z.x;U[p+1]=z.y;U[p+2]=z.z;U[p+3]=z.w;U[p+4]=B.x;U[p+5]=B.y;U[p+6]=B.z;U[p+7]=B.w;U[p+8]=C.x;U[p+9]=C.y;U[p+10]=C.z;U[p+11]=C.w;U[p+12]=O.x;U[p+13]=O.y;U[p+14]=O.z;U[p+15]=O.w;z=xa[t.a];B=xa[t.b];C=xa[t.c];O=xa[t.d];S[p]=z.x;S[p+1]=z.y;S[p+2]=z.z;S[p+3]=1;S[p+4]=B.x;S[p+5]=B.y;S[p+6]=B.z;S[p+
-7]=1;S[p+8]=C.x;S[p+9]=C.y;S[p+10]=C.z;S[p+11]=1;S[p+12]=O.x;S[p+13]=O.y;S[p+14]=O.z;S[p+15]=1;z=ya[t.a];B=ya[t.b];C=ya[t.c];O=ya[t.d];T[p]=z.x;T[p+1]=z.y;T[p+2]=z.z;T[p+3]=1;T[p+4]=B.x;T[p+5]=B.y;T[p+6]=B.z;T[p+7]=1;T[p+8]=C.x;T[p+9]=C.y;T[p+10]=C.z;T[p+11]=1;T[p+12]=O.x;T[p+13]=O.y;T[p+14]=O.z;T[p+15]=1;p+=16}if(Ka&&ta.length){z=ta[t.a];B=ta[t.b];C=ta[t.c];O=ta[t.d];aa[Y]=z.r;aa[Y+1]=z.g;aa[Y+2]=z.b;aa[Y+3]=B.r;aa[Y+4]=B.g;aa[Y+5]=B.b;aa[Y+6]=C.r;aa[Y+7]=C.g;aa[Y+8]=C.b;aa[Y+9]=O.r;aa[Y+10]=O.g;
-aa[Y+11]=O.b;Y+=12}if(Ja&&da.hasTangents){z=ja[t.a].tangent;B=ja[t.b].tangent;C=ja[t.c].tangent;t=ja[t.d].tangent;R[G]=z.x;R[G+1]=z.y;R[G+2]=z.z;R[G+3]=z.w;R[G+4]=B.x;R[G+5]=B.y;R[G+6]=B.z;R[G+7]=B.w;R[G+8]=C.x;R[G+9]=C.y;R[G+10]=C.z;R[G+11]=C.w;R[G+12]=t.x;R[G+13]=t.y;R[G+14]=t.z;R[G+15]=t.w;G+=16}if(Ia)if(ca.length==4&&Na)for(t=0;t<4;t++){ba=ca[t];na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}else for(t=0;t<4;t++){na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}if(Ba&&ea)for(t=0;t<4;t++){ca=ea[t];Da[v]=ca.u;
+0;t<3;t++){ea=fa[t];Ea[N]=ea.u;Ea[N+1]=ea.v;N+=2}if(Ha){sa[I]=s;sa[I+1]=s+1;sa[I+2]=s+2;I+=3;ia[ga]=s;ia[ga+1]=s+1;ia[ga+2]=s;ia[ga+3]=s+2;ia[ga+4]=s+1;ia[ga+5]=s+2;ga+=6;s+=3}}else if(t instanceof THREE.Face4){if(Ga){z=ja[t.a].position;B=ja[t.b].position;C=ja[t.c].position;P=ja[t.d].position;$[r]=z.x;$[r+1]=z.y;$[r+2]=z.z;$[r+3]=B.x;$[r+4]=B.y;$[r+5]=B.z;$[r+6]=C.x;$[r+7]=C.y;$[r+8]=C.z;$[r+9]=P.x;$[r+10]=P.y;$[r+11]=P.z;r+=12}if(va.length){z=va[t.a];B=va[t.b];C=va[t.c];P=va[t.d];V[p]=z.x;V[p+1]=
+z.y;V[p+2]=z.z;V[p+3]=z.w;V[p+4]=B.x;V[p+5]=B.y;V[p+6]=B.z;V[p+7]=B.w;V[p+8]=C.x;V[p+9]=C.y;V[p+10]=C.z;V[p+11]=C.w;V[p+12]=P.x;V[p+13]=P.y;V[p+14]=P.z;V[p+15]=P.w;z=za[t.a];B=za[t.b];C=za[t.c];P=za[t.d];U[p]=z.x;U[p+1]=z.y;U[p+2]=z.z;U[p+3]=z.w;U[p+4]=B.x;U[p+5]=B.y;U[p+6]=B.z;U[p+7]=B.w;U[p+8]=C.x;U[p+9]=C.y;U[p+10]=C.z;U[p+11]=C.w;U[p+12]=P.x;U[p+13]=P.y;U[p+14]=P.z;U[p+15]=P.w;z=xa[t.a];B=xa[t.b];C=xa[t.c];P=xa[t.d];S[p]=z.x;S[p+1]=z.y;S[p+2]=z.z;S[p+3]=1;S[p+4]=B.x;S[p+5]=B.y;S[p+6]=B.z;S[p+
+7]=1;S[p+8]=C.x;S[p+9]=C.y;S[p+10]=C.z;S[p+11]=1;S[p+12]=P.x;S[p+13]=P.y;S[p+14]=P.z;S[p+15]=1;z=ya[t.a];B=ya[t.b];C=ya[t.c];P=ya[t.d];T[p]=z.x;T[p+1]=z.y;T[p+2]=z.z;T[p+3]=1;T[p+4]=B.x;T[p+5]=B.y;T[p+6]=B.z;T[p+7]=1;T[p+8]=C.x;T[p+9]=C.y;T[p+10]=C.z;T[p+11]=1;T[p+12]=P.x;T[p+13]=P.y;T[p+14]=P.z;T[p+15]=1;p+=16}if(Ka&&ta.length){z=ta[t.a];B=ta[t.b];C=ta[t.c];P=ta[t.d];aa[Y]=z.r;aa[Y+1]=z.g;aa[Y+2]=z.b;aa[Y+3]=B.r;aa[Y+4]=B.g;aa[Y+5]=B.b;aa[Y+6]=C.r;aa[Y+7]=C.g;aa[Y+8]=C.b;aa[Y+9]=P.r;aa[Y+10]=P.g;
+aa[Y+11]=P.b;Y+=12}if(Ja&&da.hasTangents){z=ja[t.a].tangent;B=ja[t.b].tangent;C=ja[t.c].tangent;t=ja[t.d].tangent;R[G]=z.x;R[G+1]=z.y;R[G+2]=z.z;R[G+3]=z.w;R[G+4]=B.x;R[G+5]=B.y;R[G+6]=B.z;R[G+7]=B.w;R[G+8]=C.x;R[G+9]=C.y;R[G+10]=C.z;R[G+11]=C.w;R[G+12]=t.x;R[G+13]=t.y;R[G+14]=t.z;R[G+15]=t.w;G+=16}if(Ia)if(ca.length==4&&Na)for(t=0;t<4;t++){ba=ca[t];na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}else for(t=0;t<4;t++){na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}if(Ba&&ea)for(t=0;t<4;t++){ca=ea[t];Da[v]=ca.u;
 Da[v+1]=ca.v;v+=2}if(Ba&&fa)for(t=0;t<4;t++){ea=fa[t];Ea[N]=ea.u;Ea[N+1]=ea.v;N+=2}if(Ha){sa[I]=s;sa[I+1]=s+1;sa[I+2]=s+2;sa[I+3]=s;sa[I+4]=s+2;sa[I+5]=s+3;I+=6;ia[ga]=s;ia[ga+1]=s+1;ia[ga+2]=s;ia[ga+3]=s+3;ia[ga+4]=s+1;ia[ga+5]=s+2;ia[ga+6]=s+2;ia[ga+7]=s+3;ga+=8;s+=4}}}if(Ga){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,$,J)}if(Ka&&ta.length){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,aa,J)}if(Ia){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLNormalBuffer);
 b.bufferData(b.ARRAY_BUFFER,na,J)}if(Ja&&da.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,R,J)}if(Ba&&v>0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Da,J)}if(Ba&&N>0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,Ea,J)}if(Ha){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,sa,J);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,
 ia,J)}if(p>0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);b.bufferData(b.ARRAY_BUFFER,S,J);b.bindBuffer(b.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);b.bufferData(b.ARRAY_BUFFER,T,J);b.bindBuffer(b.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);b.bufferData(b.ARRAY_BUFFER,U,J);b.bindBuffer(b.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);b.bufferData(b.ARRAY_BUFFER,V,J)}}}i.__dirtyVertices=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyTangents=!1;i.__dirtyColors=!1}else if(g instanceof

+ 0 - 1
examples/canvas_lights_pointlights.html

@@ -100,7 +100,6 @@
 			function animate() {
 
 				requestAnimationFrame( animate );
-
 				render();
 
 			}

+ 0 - 31
examples/webgl_performance.html

@@ -159,37 +159,6 @@
 
 			}
 
-			function generateTexture( r, g, b ) {
-
-				var canvas = document.createElement( 'canvas' );
-				canvas.loaded = true;
-				canvas.width = 256;
-				canvas.height = 256;
-
-				var context = canvas.getContext( '2d' );
-				var image = context.getImageData( 0, 0, 256, 256 );
-
-				var x = 0, y = 0, p;
-
-				for ( var i = 0, j = 0, l = image.data.length; i < l; i += 4, j ++ ) {
-
-					x = j % 256;
-					y = x == 0 ? y + 1 : y;
-					p = Math.floor( x ^ y );
-
-					image.data[ i ] = ~~ p * r;
-					image.data[ i + 1 ] = ~~ p * g;
-					image.data[ i + 2 ] = ~~ p * b;
-					image.data[ i + 3 ] = 255;
-
-				}
-
-				context.putImageData( image, 0, 0 );
-
-				return canvas;
-
-			}
-
 			function onDocumentMouseMove(event) {
 
 				mouseX = ( event.clientX - windowHalfX ) * 10;

+ 4 - 4
src/animation/Animation.js

@@ -170,14 +170,14 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 				object.skinMatrix.flattenToArrayOffset( this.root.boneMatrices, h * 16 );
 				
 				object.matrixAutoUpdate = false;
-				object.matrixNeedsUpdate = false;
+				object.matrixWorldNeedsUpdate = false;
 			}
 			else {
 			
 				object.matrix = JIThierarchy[ h ][ frame ];
 				
 				object.matrixAutoUpdate = false;
-				object.matrixNeedsUpdate = true;
+				object.matrixWorldNeedsUpdate = true;
 			}
 			
 		// use interpolation
@@ -245,13 +245,13 @@ THREE.Animation.prototype.update = function( deltaTimeMS ) {
 
 
 				object.matrixAutoUpdate = true;
-				object.matrixNeedsUpdate = true;
+				object.matrixWorldNeedsUpdate = true;
 
 				scale = ( currentTime - prevKey.time ) / ( nextKey.time - prevKey.time );
 				prevXYZ = prevKey[ type ];
 				nextXYZ = nextKey[ type ];
 
-				
+
 				// check scale error
 
 				if ( scale < 0 || scale > 1 ) {

+ 5 - 98
src/cameras/Camera.js

@@ -12,19 +12,14 @@ THREE.Camera = function ( fov, aspect, near, far, target ) {
 	this.near = near || 0.1;
 	this.far = far || 2000;
 
-	/*
-	this.screenCenterX = 0;
-	this.screenCenterY = 0;
-	*/
-
 	this.target = target || new THREE.Object3D();
 	this.useTarget = true;
 
-	this.up = new THREE.Vector3( 0, 1, 0 );
-
 	this.matrixWorldInverse = new THREE.Matrix4();
 	this.projectionMatrix   = null;
 
+	this.updateProjectionMatrix();
+
 	// movement
 
 	var vector = new THREE.Vector3();
@@ -41,12 +36,6 @@ THREE.Camera = function ( fov, aspect, near, far, target ) {
 
 	};
 
-	/* TODO
-	this.translateY = function ( amount ) {
-
-	};
-	*/
-
 	this.translateZ = function ( amount, noFly ) {
 
 		vector.sub( this.target.position, this.position ).normalize().multiplyScalar( amount );
@@ -58,8 +47,6 @@ THREE.Camera = function ( fov, aspect, near, far, target ) {
 
 	};
 
-	this.updateProjectionMatrix();
-
 }
 
 THREE.Camera.prototype = new THREE.Object3D();
@@ -67,12 +54,6 @@ THREE.Camera.prototype.constructor = THREE.Camera;
 THREE.Camera.prototype.supr = THREE.Object3D.prototype;
 
 
-/*
- * Update projection matrix
- *
- * TODO: make it work also for ortho camera
-*/
-
 THREE.Camera.prototype.updateProjectionMatrix = function () {
 
 	this.projectionMatrix = THREE.Matrix4.makePerspective( this.fov, this.aspect, this.near, this.far );
@@ -80,10 +61,6 @@ THREE.Camera.prototype.updateProjectionMatrix = function () {
 }
 
 
-/*
- * Update
- */
-
 THREE.Camera.prototype.update = function( parentMatrixWorld, forceUpdate, camera ) {
 
 	if ( this.useTarget ) {
@@ -91,6 +68,7 @@ THREE.Camera.prototype.update = function( parentMatrixWorld, forceUpdate, camera
 		// local
 
 		this.matrix.lookAt( this.position, this.target.position, this.up );
+		this.matrix.setPosition( this.position );
 
 
 		// global
@@ -117,7 +95,7 @@ THREE.Camera.prototype.update = function( parentMatrixWorld, forceUpdate, camera
 
 		}
 
-		if ( forceUpdate || this.matrixNeedsUpdate ) {
+		if ( forceUpdate || this.matrixWorldNeedsUpdate ) {
 
 			if ( parentMatrixWorld ) {
 
@@ -129,7 +107,7 @@ THREE.Camera.prototype.update = function( parentMatrixWorld, forceUpdate, camera
 
 			}
 
-			this.matrixNeedsUpdate = false;
+			this.matrixWorldNeedsUpdate = false;
 			forceUpdate = true;
 
 			THREE.Matrix4.makeInvert( this.matrixWorld, this.matrixWorldInverse );
@@ -147,74 +125,3 @@ THREE.Camera.prototype.update = function( parentMatrixWorld, forceUpdate, camera
 	}
 
 };
-
-/*
- * FrustumContains
- * Checks object against projected image (as opposed to ordinary 3D frustum check)
- *
- * TODO: make it work also for ortho camera
- */
-
-/*
-THREE.Camera.prototype.frustumContains = function( object3D ) {
-
-	// object pos
-
-	var vx0 = object3D.matrixWorld.n14,
-	vy0 = object3D.matrixWorld.n24,
-	vz0 = object3D.matrixWorld.n34;
-
-	// check z
-
-	var inverse = this.matrixWorldInverse;
-	var radius = object3D.boundRadius * object3D.boundRadiusScale;
-	var vz1 = ( inverse.n31 * vx0 + inverse.n32 * vy0 + inverse.n33 * vz0 + inverse.n34 );
-
-	if( vz1 - radius > - this.near ) {
-
-		return false;
-
-	}
-
-	if( vz1 + radius < - this.far ) {
-
-		return false;
-
-	}
-
-	// check x
-
-	vz1 -= radius;
-
-	var perspective      = this.projectionMatrix;
-	var ooZ              = 1 / ( perspective.n43 * vz1 );
-	var ooZscreenCenterX = ooZ * this.screenCenterX;
-	var vx1              = ( inverse.n11 * vx0 + inverse.n12 * vy0 + inverse.n13 * vz0 + inverse.n14 ) * perspective.n11 * ooZscreenCenterX;
-	radius               = perspective.n11 * radius * ooZscreenCenterX;
-
-	if( vx1 + radius < -this.screenCenterX )
-		return false;
-
-	if( vx1 - radius > this.screenCenterX )
-		return false;
-
-
-	// check y
-
-	var vy1 = ( inverse.n21 * vx0 + inverse.n22 * vy0 + inverse.n23 * vz0 + inverse.n24 ) * perspective.n22 * ooZ * this.screenCenterY;
-
-	if( vy1 + radius < -this.screenCenterY )
-		return false;
-
-	if( vy1 - radius > this.screenCenterY )
-		return false;
-
-
-	// inside
-
-	object3D.positionScreen.set( vx1, vy1, vz1, radius );
-
-	return true;
-
-};
-*/

+ 11 - 9
src/core/Matrix4.js

@@ -69,17 +69,15 @@ THREE.Matrix4.prototype = {
 
 	lookAt : function ( eye, center, up ) {
 
-		var x = THREE.Matrix4.__tmpVec1,
-		y = THREE.Matrix4.__tmpVec2,
-		z = THREE.Matrix4.__tmpVec3;
+		var x = THREE.Matrix4.__v1, y = THREE.Matrix4.__v2, z = THREE.Matrix4.__v3;
 
 		z.sub( eye, center ).normalize();
 		x.cross( up, z ).normalize();
 		y.cross( z, x ).normalize();
 
-		this.n11 = x.x; this.n12 = y.x; this.n13 = z.x; this.n14 = eye.x;
-		this.n21 = x.y; this.n22 = y.y; this.n23 = z.y; this.n24 = eye.y;
-		this.n31 = x.z; this.n32 = y.z; this.n33 = z.z; this.n34 = eye.z;
+		this.n11 = x.x; this.n12 = y.x; this.n13 = z.x; // this.n14 = eye.x;
+		this.n21 = x.y; this.n22 = y.y; this.n23 = z.y; // this.n24 = eye.y;
+		this.n31 = x.z; this.n32 = y.z; this.n33 = z.z; // this.n34 = eye.z;
 
 		return this;
 
@@ -478,6 +476,8 @@ THREE.Matrix4.prototype = {
 		this.n32 = ad * f + b * e;
 		this.n33 = a * c;
 
+		return this;
+
 	},
 
 	setRotationFromQuaternion : function( q ) {
@@ -500,6 +500,8 @@ THREE.Matrix4.prototype = {
 		this.n32 = yz + wx;
 		this.n33 = 1 - ( xx + yy );
 
+		return this;
+
 	},
 
 	scale : function ( v ) {
@@ -666,6 +668,6 @@ THREE.Matrix4.makeOrtho = function ( left, right, top, bottom, near, far ) {
 
 };
 
-THREE.Matrix4.__tmpVec1 = new THREE.Vector3();
-THREE.Matrix4.__tmpVec2 = new THREE.Vector3();
-THREE.Matrix4.__tmpVec3 = new THREE.Vector3();
+THREE.Matrix4.__v1 = new THREE.Vector3();
+THREE.Matrix4.__v2 = new THREE.Vector3();
+THREE.Matrix4.__v3 = new THREE.Vector3();

+ 30 - 14
src/core/Object3D.js

@@ -6,21 +6,23 @@
 
 THREE.Object3D = function() {
 
-	this.id = THREE.Object3DCounter.value ++;
-
 	this.parent = undefined;
 	this.children = [];
 
+	this.up = new THREE.Vector3( 0.0, 1.0, 0.0 );
+
 	this.position = new THREE.Vector3();
-	this.positionScreen = new THREE.Vector4();
 	this.rotation = new THREE.Vector3();
 	this.scale = new THREE.Vector3( 1.0, 1.0, 1.0 );
 
+	this.rotationAutoUpdate = true;
+
 	this.matrix = new THREE.Matrix4();
 	this.matrixWorld = new THREE.Matrix4();
 	this.matrixRotationWorld = new THREE.Matrix4();
-	this.matrixNeedsUpdate = true;
+
 	this.matrixAutoUpdate = true;
+	this.matrixWorldNeedsUpdate = true;
 
 	this.quaternion = new THREE.Quaternion();
 	this.useQuaternion = false;
@@ -35,6 +37,7 @@ THREE.Object3D = function() {
 
 THREE.Object3D.prototype = {
 
+	/*
 	translateX : function () {
 
 		
@@ -52,11 +55,20 @@ THREE.Object3D.prototype = {
 		
 
 	},
+	*/
+
+	lookAt : function ( target ) {
+
+		// TODO: Add hierarchy support.
+
+		this.matrix.lookAt( this.position, target, this.up );
+
+		if ( this.rotationAutoUpdate ) {
+
+			this.rotation.setRotationFromMatrix( this.matrix );
+
+		}
 
-	lookAt : function ( object ) {
-	
-		
-	
 	},
 
 	addChild: function ( child ) {
@@ -76,12 +88,18 @@ THREE.Object3D.prototype = {
 
 			var scene = this;
 
-			while( scene instanceof THREE.Scene === false && scene !== undefined )
+			while ( scene instanceof THREE.Scene === false && scene !== undefined ) {
+
 				scene = scene.parent;
 
-			if( scene !== undefined ) 
+			}
+
+			if ( scene !== undefined )  {
+
 				scene.addChildRecurse( child );
 
+			}
+
 		}
 
 	},
@@ -136,7 +154,7 @@ THREE.Object3D.prototype = {
 
 			// update matrixWorld
 
-			if ( forceUpdate || this.matrixNeedsUpdate ) {
+			if ( forceUpdate || this.matrixWorldNeedsUpdate ) {
 
 				if ( parentMatrixWorld ) {
 
@@ -150,7 +168,7 @@ THREE.Object3D.prototype = {
 
 				this.matrixRotationWorld.extractRotation( this.matrixWorld, this.scale );
 
-				this.matrixNeedsUpdate = false;
+				this.matrixWorldNeedsUpdate = false;
 				forceUpdate = true;
 
 			}
@@ -168,5 +186,3 @@ THREE.Object3D.prototype = {
 	}
 
 }
-
-THREE.Object3DCounter = { value: 0 };

+ 15 - 3
src/core/Vector3.js

@@ -288,13 +288,25 @@ THREE.Vector3.prototype = {
 
 	},
 
-	/*
 	setRotationFromMatrix : function ( m ) {
 
-		
+		this.y = Math.asin( m.n13 );
+
+		var yc = Math.cos( this.y );
+
+		if ( Math.abs( yc ) > 0.00001 ) {
+
+			this.x = Math.atan2( - m.n23 / yc, m.n33 / yc );
+			this.z = Math.atan2( - m.n13 / yc, m.n11 / yc );
+
+		} else {
+
+			this.x = 0;
+			this.z = Math.atan2( m.n21, m.n22 );
+
+		}
 
 	},
-	*/
 
 	setLength : function ( l ) {
 

+ 2 - 2
src/objects/Bone.js

@@ -33,7 +33,7 @@ THREE.Bone.prototype.update = function( parentSkinMatrix, forceUpdate, camera )
 
 	// update skin matrix
 
-	if ( forceUpdate || this.matrixNeedsUpdate ) {
+	if ( forceUpdate || this.matrixWorldNeedsUpdate ) {
 
 		if( parentSkinMatrix ) {
 
@@ -45,7 +45,7 @@ THREE.Bone.prototype.update = function( parentSkinMatrix, forceUpdate, camera )
 
 		}
 
-		this.matrixNeedsUpdate = false;
+		this.matrixWorldNeedsUpdate = false;
 		forceUpdate = true;
 
 	}

+ 2 - 2
src/objects/LOD.js

@@ -60,7 +60,7 @@ THREE.LOD.prototype.update = function ( parentMatrixWorld, forceUpdate, camera )
 
 	// update global
 
-	if ( forceUpdate || this.matrixNeedsUpdate ) {
+	if ( forceUpdate || this.matrixWorldNeedsUpdate ) {
 
 		if ( parentMatrixWorld ) {
 
@@ -72,7 +72,7 @@ THREE.LOD.prototype.update = function ( parentMatrixWorld, forceUpdate, camera )
 
 		}
 
-		this.matrixNeedsUpdate = false;
+		this.matrixWorldNeedsUpdate = false;
 		forceUpdate = true;
 
 	}

+ 2 - 2
src/objects/SkinnedMesh.js

@@ -101,7 +101,7 @@ THREE.SkinnedMesh.prototype.update = function ( parentMatrixWorld, forceUpdate,
 
 		// update global
 
-		if ( forceUpdate || this.matrixNeedsUpdate ) {
+		if ( forceUpdate || this.matrixWorldNeedsUpdate ) {
 
 			if ( parentMatrixWorld ) {
 
@@ -113,7 +113,7 @@ THREE.SkinnedMesh.prototype.update = function ( parentMatrixWorld, forceUpdate,
 
 			}
 
-			this.matrixNeedsUpdate = false;
+			this.matrixWorldNeedsUpdate = false;
 			forceUpdate = true;
 
 		}

+ 2 - 2
src/objects/Sound.js

@@ -159,7 +159,7 @@ THREE.Sound.prototype.update = function ( parentMatrixWorld, forceUpdate, camera
 
 	// update global
 
-	if ( forceUpdate || this.matrixNeedsUpdate ) {
+	if ( forceUpdate || this.matrixWorldNeedsUpdate ) {
 
 		if ( parentMatrixWorld ) {
 
@@ -171,7 +171,7 @@ THREE.Sound.prototype.update = function ( parentMatrixWorld, forceUpdate, camera
 
 		}
 
-		this.matrixNeedsUpdate = false;
+		this.matrixWorldNeedsUpdate = false;
 		forceUpdate = true;
 
 	}

+ 42 - 37
src/renderers/WebGLRenderer.js

@@ -2721,33 +2721,31 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		if ( texture.needsUpdate ) {
 
-			try  {
+			if ( !texture.__wasSetOnce ) {
 
-				if ( !isPowerOfTwo( texture.image.width ) || !isPowerOfTwo( texture.image.height ) ) {
+				texture.__webGLTexture = _gl.createTexture();
 
-					throw 'Texture not power of 2: ' + texture.image.src;
+				_gl.bindTexture( _gl.TEXTURE_2D, texture.__webGLTexture );
+				_gl.texImage2D( _gl.TEXTURE_2D, 0, _gl.RGBA, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image );
 
-				}
+				if ( isPowerOfTwo( texture.image.width ) && isPowerOfTwo( texture.image.height ) ) {
 
-			} catch ( e ) {
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) );
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) );
 
-				console.error( e );
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) );
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) );
 
-			}
+					_gl.generateMipmap( _gl.TEXTURE_2D );
 
-			if ( !texture.__wasSetOnce ) {
+				} else {
 
-				texture.__webGLTexture = _gl.createTexture();
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR );
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
 
-				_gl.bindTexture( _gl.TEXTURE_2D, texture.__webGLTexture );
-				_gl.texImage2D( _gl.TEXTURE_2D, 0, _gl.RGBA, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image );
-
-				_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) );
-				_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) );
+				}
 
-				_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) );
-				_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) );
-				_gl.generateMipmap( _gl.TEXTURE_2D );
 				_gl.bindTexture( _gl.TEXTURE_2D, null );
 
 				texture.__wasSetOnce = true;
@@ -2757,12 +2755,24 @@ THREE.WebGLRenderer = function ( parameters ) {
 				_gl.bindTexture( _gl.TEXTURE_2D, texture.__webGLTexture );
 				_gl.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, _gl.RGBA, _gl.UNSIGNED_BYTE, texture.image );
 
-				_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) );
-				_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) );
+				if ( isPowerOfTwo( texture.image.width ) && isPowerOfTwo( texture.image.height ) ) {
+
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, paramThreeToGL( texture.wrapS ) );
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, paramThreeToGL( texture.wrapT ) );
+
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) );
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) );
+
+					_gl.generateMipmap( _gl.TEXTURE_2D );
+
+				} else {
+
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR );
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );
+					_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
+
+				}
 
-				_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, paramThreeToGL( texture.magFilter ) );
-				_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, paramThreeToGL( texture.minFilter ) );
-				_gl.generateMipmap( _gl.TEXTURE_2D );
 				_gl.bindTexture( _gl.TEXTURE_2D, null );
 
 			}
@@ -2782,20 +2792,6 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			if ( texture.needsUpdate ) {
 
-				try  {
-
-					if ( !isPowerOfTwo( texture.image.width ) || !isPowerOfTwo( texture.image.height ) ) {
-
-						throw 'Texture not power of 2: ' + texture.image.src;
-
-					}
-
-				} catch ( e ) {
-
-					console.error( e );
-
-				}
-
 				if ( !texture.image.__webGLTextureCube ) {
 
 					texture.image.__webGLTextureCube = _gl.createTexture();
@@ -2808,7 +2804,16 @@ THREE.WebGLRenderer = function ( parameters ) {
 				_gl.texParameteri( _gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
 
 				_gl.texParameteri( _gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MAG_FILTER, _gl.LINEAR );
-				_gl.texParameteri( _gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR_MIPMAP_LINEAR );
+
+				if ( isPowerOfTwo( texture.image.width ) && isPowerOfTwo( texture.image.height ) ) {
+
+					_gl.texParameteri( _gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR_MIPMAP_LINEAR );
+
+				} else {
+
+					_gl.texParameteri( _gl.TEXTURE_CUBE_MAP, _gl.TEXTURE_MIN_FILTER, _gl.LINEAR );
+
+				}
 
 				for ( var i = 0; i < 6; ++i ) {
 

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно