Kaynağa Gözat

Added 3d sound support plus example.

Thanks to @mikaelemtinger ;)
alteredq 14 yıl önce
ebeveyn
işleme
7415759392

+ 215 - 207
build/Three.js

@@ -13,35 +13,36 @@ this.x+", "+this.y+", "+this.z+" )"}};THREE.Vector4=function(a,b,c,d){this.x=a||
 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.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
 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.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
 return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){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)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
 return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){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)},toString:function(){return"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=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(F,v,I,q){q=q.clone().subSelf(v);I=I.clone().subSelf(v);var J=F.clone().subSelf(v);F=q.dot(q);v=q.dot(I);q=q.dot(J);var e=I.dot(I);I=I.dot(J);J=1/(F*e-v*v);e=(e*q-v*I)*J;F=(F*I-v*q)*J;return e>0&&F>0&&e+F<1}var c,d,f,g,h,k,j,m,o,w,
-u,t=a.geometry,x=t.vertices,A=[];c=0;for(d=t.faces.length;c<d;c++){f=t.faces[c];w=this.origin.clone();u=this.direction.clone();j=a.globalMatrix;j.extractRotationMatrix(a.matrixRotation);g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());k=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;m=a.matrixRotation.multiplyVector3(f.normal.clone());o=u.dot(m);if(o<0){m=m.dot((new THREE.Vector3).sub(g,
-w))/o;w=w.addSelf(u.multiplyScalar(m));if(f instanceof THREE.Face3){if(b(w,g,h,k)){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}else if(f instanceof THREE.Face4&&(b(w,g,h,j)||b(w,h,k,j))){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}}return A}};
-THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,m,o,w){k=!1;b=j;c=m;d=o;f=w;a()};this.addPoint=function(j,m){if(k){k=!1;b=j;c=m;d=j;f=m}else{b=b<j?b:j;c=c<m?c:m;d=d>j?d:j;f=f>m?f:m}a()};
-this.add3Points=function(j,m,o,w,u,t){if(k){k=!1;b=j<o?j<u?j:u:o<u?o:u;c=m<w?m<t?m:t:w<t?w:t;d=j>o?j>u?j:u:o>u?o:u;f=m>w?m>t?m:t:w>t?w:t}else{b=j<o?j<u?j<b?j:b:u<b?u:b:o<u?o<b?o:b:u<b?u:b;c=m<w?m<t?m<c?m:c:t<c?t:c:w<t?w<c?w:c:t<c?t:c;d=j>o?j>u?j>d?j:d:u>d?u:d:o>u?o>d?o:d:u>d?u:d;f=m>w?m>t?m>f?m:f:t>f?t:f:w>t?w>f?w:f:t>f?t:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=b<j.getLeft()?b:j.getLeft();c=c<j.getTop()?c:j.getTop();d=d>j.getRight()?
+THREE.Ray.prototype={intersectScene:function(a){var b,c,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){c=d[a];c instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(c)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function b(G,v,I,o){o=o.clone().subSelf(v);I=I.clone().subSelf(v);var M=G.clone().subSelf(v);G=o.dot(o);v=o.dot(I);o=o.dot(M);var e=I.dot(I);I=I.dot(M);M=1/(G*e-v*v);e=(e*o-v*I)*M;G=(G*I-v*o)*M;return e>0&&G>0&&e+G<1}var c,d,f,g,h,k,j,m,n,w,
+q,p=a.geometry,x=p.vertices,A=[];c=0;for(d=p.faces.length;c<d;c++){f=p.faces[c];w=this.origin.clone();q=this.direction.clone();j=a.globalMatrix;j.extractRotationMatrix(a.matrixRotation);g=j.multiplyVector3(x[f.a].position.clone());h=j.multiplyVector3(x[f.b].position.clone());k=j.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?j.multiplyVector3(x[f.d].position.clone()):null;m=a.matrixRotation.multiplyVector3(f.normal.clone());n=q.dot(m);if(n<0){m=m.dot((new THREE.Vector3).sub(g,
+w))/n;w=w.addSelf(q.multiplyScalar(m));if(f instanceof THREE.Face3){if(b(w,g,h,k)){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}else if(f instanceof THREE.Face4&&(b(w,g,h,j)||b(w,h,k,j))){f={distance:this.origin.distanceTo(w),point:w,face:f,object:a};A.push(f)}}}return A}};
+THREE.Rectangle=function(){function a(){g=d-b;h=f-c}var b,c,d,f,g,h,k=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,m,n,w){k=!1;b=j;c=m;d=n;f=w;a()};this.addPoint=function(j,m){if(k){k=!1;b=j;c=m;d=j;f=m}else{b=b<j?b:j;c=c<m?c:m;d=d>j?d:j;f=f>m?f:m}a()};
+this.add3Points=function(j,m,n,w,q,p){if(k){k=!1;b=j<n?j<q?j:q:n<q?n:q;c=m<w?m<p?m:p:w<p?w:p;d=j>n?j>q?j:q:n>q?n:q;f=m>w?m>p?m:p:w>p?w:p}else{b=j<n?j<q?j<b?j:b:q<b?q:b:n<q?n<b?n:b:q<b?q:b;c=m<w?m<p?m<c?m:c:p<c?p:c:w<p?w<c?w:c:p<c?p:c;d=j>n?j>q?j>d?j:d:q>d?q:d:n>q?n>d?n:d:q>d?q:d;f=m>w?m>p?m>f?m:f:p>f?p:f:w>p?w>f?w:f:p>f?p:f}a()};this.addRectangle=function(j){if(k){k=!1;b=j.getLeft();c=j.getTop();d=j.getRight();f=j.getBottom()}else{b=b<j.getLeft()?b:j.getLeft();c=c<j.getTop()?c:j.getTop();d=d>j.getRight()?
 d:j.getRight();f=f>j.getBottom()?f:j.getBottom()}a()};this.inflate=function(j){b-=j;c-=j;d+=j;f+=j;a()};this.minSelf=function(j){b=b>j.getLeft()?b:j.getLeft();c=c>j.getTop()?c:j.getTop();d=d<j.getRight()?d:j.getRight();f=f<j.getBottom()?f:j.getBottom();a()};this.instersects=function(j){return Math.min(d,j.getRight())-Math.max(b,j.getLeft())>=0&&Math.min(f,j.getBottom())-Math.max(c,j.getTop())>=0};this.empty=function(){k=!0;f=d=c=b=0;a()};this.isEmpty=function(){return k};this.toString=function(){return"THREE.Rectangle ( left: "+
 d:j.getRight();f=f>j.getBottom()?f:j.getBottom()}a()};this.inflate=function(j){b-=j;c-=j;d+=j;f+=j;a()};this.minSelf=function(j){b=b>j.getLeft()?b:j.getLeft();c=c>j.getTop()?c:j.getTop();d=d<j.getRight()?d:j.getRight();f=f<j.getBottom()?f:j.getBottom();a()};this.instersects=function(j){return Math.min(d,j.getRight())-Math.max(b,j.getLeft())>=0&&Math.min(f,j.getBottom())-Math.max(c,j.getTop())>=0};this.empty=function(){k=!0;f=d=c=b=0;a()};this.isEmpty=function(){return k};this.toString=function(){return"THREE.Rectangle ( left: "+
 b+", right: "+d+", top: "+c+", bottom: "+f+", width: "+g+", height: "+h+" )"}};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}};
 b+", right: "+d+", top: "+c+", bottom: "+f+", width: "+g+", height: "+h+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
-THREE.Matrix4=function(a,b,c,d,f,g,h,k,j,m,o,w,u,t,x,A){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=d||0;this.n21=f||0;this.n22=g||1;this.n23=h||0;this.n24=k||0;this.n31=j||0;this.n32=m||0;this.n33=o||1;this.n34=w||0;this.n41=u||0;this.n42=t||0;this.n43=x||0;this.n44=A||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,c,d,f,g,h,k,j,m,o,w,u,t,x,A){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=o;this.n34=w;this.n41=u;this.n42=t;this.n43=x;this.n44=A;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
+THREE.Matrix4=function(a,b,c,d,f,g,h,k,j,m,n,w,q,p,x,A){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=d||0;this.n21=f||0;this.n22=g||1;this.n23=h||0;this.n24=k||0;this.n31=j||0;this.n32=m||0;this.n33=n||1;this.n34=w||0;this.n41=q||0;this.n42=p||0;this.n43=x||0;this.n44=A||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,c,d,f,g,h,k,j,m,n,w,q,p,x,A){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=n;this.n34=w;this.n41=q;this.n42=p;this.n43=x;this.n44=A;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
 a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1,f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();d.cross(c,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a);
 a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var d=THREE.Matrix4.__tmpVec1,f=THREE.Matrix4.__tmpVec2,g=THREE.Matrix4.__tmpVec3;g.sub(a,b).normalize();d.cross(c,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a);
 this.n31=g.x;this.n32=g.y;this.n33=g.z;this.n34=-g.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*
 this.n31=g.x;this.n32=g.y;this.n33=g.z;this.n34=-g.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,f=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*f;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*
 a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},crossVector:function(a){var b=new THREE.Vector4;b.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+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*c+this.n23*d+this.n24*f;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*f;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*
-a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,w=a.n32,u=a.n33,t=a.n34,x=a.n41,A=a.n42,F=a.n43,v=a.n44,I=b.n11,q=b.n12,J=b.n13,e=b.n14,aa=b.n21,L=b.n22,M=b.n23,V=b.n24,S=b.n31,Y=b.n32,Z=b.n33,G=b.n34,U=b.n41,na=b.n42,W=b.n43,ka=b.n44;this.n11=c*I+d*aa+f*S+g*U;this.n12=c*q+d*L+f*Y+g*na;this.n13=c*J+d*M+f*Z+g*W;this.n14=c*e+d*V+f*G+g*ka;this.n21=h*I+k*aa+j*S+m*U;this.n22=h*q+k*L+j*Y+m*na;this.n23=
-h*J+k*M+j*Z+m*W;this.n24=h*e+k*V+j*G+m*ka;this.n31=o*I+w*aa+u*S+t*U;this.n32=o*q+w*L+u*Y+t*na;this.n33=o*J+w*M+u*Z+t*W;this.n34=o*e+w*V+u*G+t*ka;this.n41=x*I+A*aa+F*S+v*U;this.n42=x*q+A*L+F*Y+v*na;this.n43=x*J+A*M+F*Z+v*W;this.n44=x*e+A*V+F*G+v*ka;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,o=a.n24,w=a.n31,u=a.n32,t=a.n33,x=a.n34,A=a.n41,F=a.n42,v=a.n43;a=a.n44;var I=b.n11,q=b.n12,J=b.n13,e=b.n14,aa=b.n21,L=b.n22,M=b.n23,V=b.n24,S=b.n31,
-Y=b.n32,Z=b.n33,G=b.n34,U=b.n41,na=b.n42,W=b.n43;b=b.n44;this.n11=d*I+f*aa+g*S+h*U;this.n12=d*q+f*L+g*Y+h*na;this.n13=d*J+f*M+g*Z+h*W;this.n14=d*e+f*V+g*G+h*b;this.n21=k*I+j*aa+m*S+o*U;this.n22=k*q+j*L+m*Y+o*na;this.n23=k*J+j*M+m*Z+o*W;this.n24=k*e+j*V+m*G+o*b;this.n31=w*I+u*aa+t*S+x*U;this.n32=w*q+u*L+t*Y+x*na;this.n33=w*J+u*M+t*Z+x*W;this.n34=w*e+u*V+t*G+x*b;this.n41=A*I+F*aa+v*S+a*U;this.n42=A*q+F*L+v*Y+a*na;this.n43=A*J+F*M+v*Z+a*W;this.n44=A*e+F*V+v*G+a*b;c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;
-c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,o=this.n32,w=this.n33,u=this.n34,t=this.n41,x=this.n42,A=this.n43,F=this.n44,v=a.n11,I=a.n21,q=a.n31,J=a.n41,e=a.n12,aa=a.n22,L=a.n32,M=a.n42,V=a.n13,S=a.n23,Y=a.n33,Z=a.n43,
-G=a.n14,U=a.n24,na=a.n34;a=a.n44;this.n11=b*v+c*I+d*q+f*J;this.n12=b*e+c*aa+d*L+f*M;this.n13=b*V+c*S+d*Y+f*Z;this.n14=b*G+c*U+d*na+f*a;this.n21=g*v+h*I+k*q+j*J;this.n22=g*e+h*aa+k*L+j*M;this.n23=g*V+h*S+k*Y+j*Z;this.n24=g*G+h*U+k*na+j*a;this.n31=m*v+o*I+w*q+u*J;this.n32=m*e+o*aa+w*L+u*M;this.n33=m*V+o*S+w*Y+u*Z;this.n34=m*G+o*U+w*na+u*a;this.n41=t*v+x*I+A*q+F*J;this.n42=t*e+x*aa+A*L+F*M;this.n43=t*V+x*S+A*Y+F*Z;this.n44=t*G+x*U+A*na+F*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,f=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,o=this.n33,w=this.n34,u=this.n41,t=this.n42,x=this.n43,A=this.n44;return d*h*m*u-c*k*m*u-d*g*o*u+b*k*o*u+c*g*w*u-b*h*w*u-d*h*j*t+c*k*j*t+d*f*o*t-a*k*o*t-c*f*w*t+a*h*w*t+d*g*j*x-b*k*
-j*x-d*f*m*x+a*k*m*x+b*f*w*x-a*g*w*x-c*g*j*A+b*h*j*A+c*f*m*A-a*h*m*A-b*f*o*A+a*g*o*A},transpose:function(){function a(b,c,d){var f=b[c];b[c]=b[d];b[d]=f}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=
-this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,
-b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,k=a.z,j=f*g,m=f*h;this.set(j*g+c,j*h-d*k,j*
-k+d*h,0,j*h+d*k,m*h+c,m*k-d*g,0,j*k-d*h,m*k+d*g,f*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(b);b=Math.sin(b);var h=a*d,k=c*d;this.n11=a*f;this.n12=c*b-h*g;this.n13=h*b+c*g;this.n21=d;this.n22=f*g;this.n23=-f*b;this.n31=-c*f;this.n32=k*g+a*b;this.n33=-k*b+a*g},setRotationFromQuaternion:function(a){var b=a.x,
-c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,k=d+d;a=b*g;var j=b*h;b*=k;var m=c*h;c*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(m+d);this.n12=j-f;this.n13=b+h;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;a.n23=
-this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};
-THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,o=a.n31,w=a.n32,u=a.n33,t=a.n34,x=a.n41,A=a.n42,F=a.n43,v=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=j*t*A-m*u*A+m*w*F-k*t*F-j*w*v+k*u*v;b.n12=g*u*A-f*t*A-g*w*F+d*t*F+f*w*v-d*u*v;b.n13=f*m*A-g*j*A+g*k*F-d*m*F-f*k*v+d*j*v;b.n14=g*j*w-f*m*w-g*k*u+d*m*u+f*k*t-d*j*t;b.n21=m*u*x-j*t*x-m*o*F+h*t*F+j*o*v-h*u*v;b.n22=f*t*x-g*u*x+g*o*F-c*t*F-f*o*v+c*u*v;b.n23=g*j*x-f*m*x-g*h*F+c*m*F+f*h*v-c*j*v;
-b.n24=f*m*o-g*j*o+g*h*u-c*m*u-f*h*t+c*j*t;b.n31=k*t*x-m*w*x+m*o*A-h*t*A-k*o*v+h*w*v;b.n32=g*w*x-d*t*x-g*o*A+c*t*A+d*o*v-c*w*v;b.n33=f*m*x-g*k*x+g*h*A-c*m*A-d*h*v+c*k*v;b.n34=g*k*o-d*m*o-g*h*w+c*m*w+d*h*t-c*k*t;b.n41=j*w*x-k*u*x-j*o*A+h*u*A+k*o*F-h*w*F;b.n42=d*u*x-f*w*x+f*o*A-c*u*A-d*o*F+c*w*F;b.n43=f*k*x-d*j*x-f*h*A+c*j*A+d*h*F-c*k*F;b.n44=d*j*o-f*k*o+f*h*w-c*j*w-d*h*u+c*k*u;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,o=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*k;c[5]=a*j;c[6]=a*m;c[7]=a*o;c[8]=a*w;return b};
+a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,n=a.n31,w=a.n32,q=a.n33,p=a.n34,x=a.n41,A=a.n42,G=a.n43,v=a.n44,I=b.n11,o=b.n12,M=b.n13,e=b.n14,ea=b.n21,O=b.n22,P=b.n23,W=b.n24,S=b.n31,aa=b.n32,ba=b.n33,H=b.n34,V=b.n41,la=b.n42,Y=b.n43,ka=b.n44;this.n11=c*I+d*ea+f*S+g*V;this.n12=c*o+d*O+f*aa+g*la;this.n13=c*M+d*P+f*ba+g*Y;this.n14=c*e+d*W+f*H+g*ka;this.n21=h*I+k*ea+j*S+m*V;this.n22=h*o+k*O+j*aa+m*la;
+this.n23=h*M+k*P+j*ba+m*Y;this.n24=h*e+k*W+j*H+m*ka;this.n31=n*I+w*ea+q*S+p*V;this.n32=n*o+w*O+q*aa+p*la;this.n33=n*M+w*P+q*ba+p*Y;this.n34=n*e+w*W+q*H+p*ka;this.n41=x*I+A*ea+G*S+v*V;this.n42=x*o+A*O+G*aa+v*la;this.n43=x*M+A*P+G*ba+v*Y;this.n44=x*e+A*W+G*H+v*ka;return this},multiplyToArray:function(a,b,c){var d=a.n11,f=a.n12,g=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,n=a.n24,w=a.n31,q=a.n32,p=a.n33,x=a.n34,A=a.n41,G=a.n42,v=a.n43;a=a.n44;var I=b.n11,o=b.n12,M=b.n13,e=b.n14,ea=b.n21,O=b.n22,P=b.n23,W=
+b.n24,S=b.n31,aa=b.n32,ba=b.n33,H=b.n34,V=b.n41,la=b.n42,Y=b.n43;b=b.n44;this.n11=d*I+f*ea+g*S+h*V;this.n12=d*o+f*O+g*aa+h*la;this.n13=d*M+f*P+g*ba+h*Y;this.n14=d*e+f*W+g*H+h*b;this.n21=k*I+j*ea+m*S+n*V;this.n22=k*o+j*O+m*aa+n*la;this.n23=k*M+j*P+m*ba+n*Y;this.n24=k*e+j*W+m*H+n*b;this.n31=w*I+q*ea+p*S+x*V;this.n32=w*o+q*O+p*aa+x*la;this.n33=w*M+q*P+p*ba+x*Y;this.n34=w*e+q*W+p*H+x*b;this.n41=A*I+G*ea+v*S+a*V;this.n42=A*o+G*O+v*aa+a*la;this.n43=A*M+G*P+v*ba+a*Y;this.n44=A*e+G*W+v*H+a*b;c[0]=this.n11;
+c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,d=this.n13,f=this.n14,g=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,n=this.n32,w=this.n33,q=this.n34,p=this.n41,x=this.n42,A=this.n43,G=this.n44,v=a.n11,I=a.n21,o=a.n31,M=a.n41,e=a.n12,ea=a.n22,O=a.n32,P=a.n42,W=
+a.n13,S=a.n23,aa=a.n33,ba=a.n43,H=a.n14,V=a.n24,la=a.n34;a=a.n44;this.n11=b*v+c*I+d*o+f*M;this.n12=b*e+c*ea+d*O+f*P;this.n13=b*W+c*S+d*aa+f*ba;this.n14=b*H+c*V+d*la+f*a;this.n21=g*v+h*I+k*o+j*M;this.n22=g*e+h*ea+k*O+j*P;this.n23=g*W+h*S+k*aa+j*ba;this.n24=g*H+h*V+k*la+j*a;this.n31=m*v+n*I+w*o+q*M;this.n32=m*e+n*ea+w*O+q*P;this.n33=m*W+n*S+w*aa+q*ba;this.n34=m*H+n*V+w*la+q*a;this.n41=p*v+x*I+A*o+G*M;this.n42=p*e+x*ea+A*O+G*P;this.n43=p*W+x*S+A*aa+G*ba;this.n44=p*H+x*V+A*la+G*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,f=this.n21,g=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,n=this.n33,w=this.n34,q=this.n41,p=this.n42,x=this.n43,A=this.n44;return d*h*m*q-c*k*m*q-d*g*n*q+b*k*n*q+c*g*w*q-b*h*w*q-d*h*j*p+c*k*j*p+d*f*n*p-a*k*n*p-c*f*w*p+a*h*w*p+
+d*g*j*x-b*k*j*x-d*f*m*x+a*k*m*x+b*f*w*x-a*g*w*x-c*g*j*A+b*h*j*A+c*f*m*A-a*h*m*A-b*f*n*A+a*g*n*A},transpose:function(){function a(b,c,d){var f=b[c];b[c]=b[d];b[d]=f}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");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(){var a=this.flat;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},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=
+this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);
+return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),f=1-c,g=a.x,h=a.y,k=a.z,j=f*
+g,m=f*h;this.set(j*g+c,j*h-d*k,j*k+d*h,0,j*h+d*k,m*h+c,m*k-d*g,0,j*k-d*h,m*k+d*g,f*k*k+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(-d);d=Math.sin(-d);var g=Math.cos(b);b=Math.sin(b);var h=a*d,k=c*d;this.n11=a*f;this.n12=c*b-h*g;this.n13=h*b+c*g;this.n21=d;this.n22=f*g;this.n23=-f*b;this.n31=-c*f;this.n32=k*g+a*b;this.n33=-k*b+a*g},setRotationFromQuaternion:function(a){var b=
+a.x,c=a.y,d=a.z,f=a.w,g=b+b,h=c+c,k=d+d;a=b*g;var j=b*h;b*=k;var m=c*h;c*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(m+d);this.n12=j-f;this.n13=b+h;this.n21=j+f;this.n22=1-(a+d);this.n23=c-g;this.n31=b-h;this.n32=c+g;this.n33=1-(a+m)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},extractRotationMatrix:function(a){a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=0;a.n21=this.n21;a.n22=this.n22;
+a.n23=this.n23;a.n24=0;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=0;a.n41=0;a.n42=0;a.n43=0;a.n44=1},extractPositionVector:function(a){a.x=this.n14;a.y=this.n24;a.z=this.n34},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};
+THREE.Matrix4.translationMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setTranslation(a,b,c);return d};THREE.Matrix4.scaleMatrix=function(a,b,c){var d=new THREE.Matrix4;d.setScale(a,b,c);return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};
+THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,d=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,n=a.n31,w=a.n32,q=a.n33,p=a.n34,x=a.n41,A=a.n42,G=a.n43,v=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=j*p*A-m*q*A+m*w*G-k*p*G-j*w*v+k*q*v;b.n12=g*q*A-f*p*A-g*w*G+d*p*G+f*w*v-d*q*v;b.n13=f*m*A-g*j*A+g*k*G-d*m*G-f*k*v+d*j*v;b.n14=g*j*w-f*m*w-g*k*q+d*m*q+f*k*p-d*j*p;b.n21=m*q*x-j*p*x-m*n*G+h*p*G+j*n*v-h*q*v;b.n22=f*p*x-g*q*x+g*n*G-c*p*G-f*n*v+c*q*v;b.n23=g*j*x-f*m*x-g*h*G+c*m*G+f*h*v-c*j*v;
+b.n24=f*m*n-g*j*n+g*h*q-c*m*q-f*h*p+c*j*p;b.n31=k*p*x-m*w*x+m*n*A-h*p*A-k*n*v+h*w*v;b.n32=g*w*x-d*p*x-g*n*A+c*p*A+d*n*v-c*w*v;b.n33=f*m*x-g*k*x+g*h*A-c*m*A-d*h*v+c*k*v;b.n34=g*k*n-d*m*n-g*h*w+c*m*w+d*h*p-c*k*p;b.n41=j*w*x-k*q*x-j*n*A+h*q*A+k*n*G-h*w*G;b.n42=d*q*x-f*w*x+f*n*A-c*q*A-d*n*G+c*w*G;b.n43=f*k*x-d*j*x-f*h*A+c*j*A+d*h*G-c*k*G;b.n44=d*j*n-f*k*n+f*h*w-c*j*w-d*h*q+c*k*q;b.multiplyScalar(1/a.determinant());return b};
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*d;c[1]=a*f;c[2]=a*g;c[3]=a*h;c[4]=a*k;c[5]=a*j;c[6]=a*m;c[7]=a*n;c[8]=a*w;return b};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
 THREE.Matrix4.makeFrustum=function(a,b,c,d,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*f/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var f;a=c*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,c,d)};
 THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,k,j,m;h=new THREE.Matrix4;k=b-a;j=c-d;m=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((b+a)/k);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((c+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
 THREE.Matrix4.makeOrtho=function(a,b,c,d,f,g){var h,k,j,m;h=new THREE.Matrix4;k=b-a;j=c-d;m=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((b+a)/k);h.n21=0;h.n22=2/j;h.n23=0;h.n24=-((c+d)/j);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+f)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
 THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrixRotation=new THREE.Matrix4;this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=
@@ -51,7 +52,7 @@ THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){
 THREE.Quaternion.prototype.set=function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(c);c=Math.sin(c);var h=a*b,k=d*f;this.w=h*g-k*c;this.x=h*c+k*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this};
 THREE.Quaternion.prototype.set=function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,c=a.x*b,d=a.y*b,f=a.z*b;a=Math.cos(d);d=Math.sin(d);b=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(c);c=Math.sin(c);var h=a*b,k=d*f;this.w=h*g-k*c;this.x=h*c+k*g;this.y=d*b*g+a*f*c;this.z=a*f*g-d*b*c;return this};
 THREE.Quaternion.prototype.calculateW=function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this};THREE.Quaternion.prototype.inverse=function(){this.x*=-1;this.y*=-1;this.z*=-1;return this};THREE.Quaternion.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)};
 THREE.Quaternion.prototype.calculateW=function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this};THREE.Quaternion.prototype.inverse=function(){this.x*=-1;this.y*=-1;this.z*=-1;return this};THREE.Quaternion.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)};
 THREE.Quaternion.prototype.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};THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=b*a+f*g+c*k-d*h;this.y=c*a+f*h+d*g-b*k;this.z=d*a+f*k+b*h-c*g;this.w=f*a-b*g-c*h-d*k;return this};
 THREE.Quaternion.prototype.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};THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.x,c=this.y,d=this.z,f=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=b*a+f*g+c*k-d*h;this.y=c*a+f*h+d*g-b*k;this.z=d*a+f*k+b*h-c*g;this.w=f*a-b*g-c*h-d*k;return this};
-THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,k=this.z,j=this.w,m=j*c+h*f-k*d,o=j*d+k*c-g*f,w=j*f+g*d-h*c;c=-g*c-h*d-k*f;b.x=m*j+c*-g+o*-k-w*-h;b.y=o*j+c*-h+w*-g-m*-k;b.z=w*j+c*-k+m*-h-o*-g;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){};
+THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var c=a.x,d=a.y,f=a.z,g=this.x,h=this.y,k=this.z,j=this.w,m=j*c+h*f-k*d,n=j*d+k*c-g*f,w=j*f+g*d-h*c;c=-g*c-h*d-k*f;b.x=m*j+c*-g+n*-k-w*-h;b.y=n*j+c*-h+w*-g-m*-k;b.z=w*j+c*-k+m*-h-n*-g;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){};
 THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
 THREE.Quaternion.slerp=function(a,b,c,d){var f=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(f)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}f=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;c.w=a.w*f+b.w*d;c.x=a.x*f+b.x*d;c.y=a.y*f+b.y*d;c.z=a.z*f+b.z*d;return c};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
 THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
 THREE.Face3=function(a,b,c,d,f){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
 THREE.Face3=function(a,b,c,d,f){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.materials=f instanceof Array?f:[f]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
@@ -61,12 +62,12 @@ THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.f
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){k.set(0,0,0);b=0;for(c=g.normal.length;b<c;b++)k.addSelf(g.vertexNormals[b]);k.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,
 c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,d,f,g,h,k=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){k.set(0,0,0);b=0;for(c=g.normal.length;b<c;b++)k.addSelf(g.vertexNormals[b]);k.divideScalar(3)}else{b=this.vertices[g.a];c=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,
 c.position);j.sub(b.position,c.position);k.crossSelf(j)}k.isZero()||k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
 c.position);j.sub(b.position,c.position);k.crossSelf(j)}k.isZero()||k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
 new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){d[c.a].addSelf(c.normal);d[c.b].addSelf(c.normal);d[c.c].addSelf(c.normal);d[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<
-b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(G,U,na,W,ka,ha,da){g=G.vertices[U].position;h=G.vertices[na].position;k=G.vertices[W].position;j=f[ka];m=f[ha];o=f[da];w=h.x-g.x;u=k.x-g.x;t=h.y-g.y;x=
-k.y-g.y;A=h.z-g.z;F=k.z-g.z;v=m.u-j.u;I=o.u-j.u;q=m.v-j.v;J=o.v-j.v;e=1/(v*J-I*q);M.set((J*w-q*u)*e,(J*t-q*x)*e,(J*A-q*F)*e);V.set((v*u-I*w)*e,(v*x-I*t)*e,(v*F-I*A)*e);aa[U].addSelf(M);aa[na].addSelf(M);aa[W].addSelf(M);L[U].addSelf(V);L[na].addSelf(V);L[W].addSelf(V)}var b,c,d,f,g,h,k,j,m,o,w,u,t,x,A,F,v,I,q,J,e,aa=[],L=[],M=new THREE.Vector3,V=new THREE.Vector3,S=new THREE.Vector3,Y=new THREE.Vector3,Z=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){aa[b]=new THREE.Vector3;L[b]=new THREE.Vector3}b=
+b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(d[c.a]);c.vertexNormals[1].copy(d[c.b]);c.vertexNormals[2].copy(d[c.c]);c.vertexNormals[3].copy(d[c.d])}}},computeTangents:function(){function a(H,V,la,Y,ka,ia,fa){g=H.vertices[V].position;h=H.vertices[la].position;k=H.vertices[Y].position;j=f[ka];m=f[ia];n=f[fa];w=h.x-g.x;q=k.x-g.x;p=h.y-g.y;x=
+k.y-g.y;A=h.z-g.z;G=k.z-g.z;v=m.u-j.u;I=n.u-j.u;o=m.v-j.v;M=n.v-j.v;e=1/(v*M-I*o);P.set((M*w-o*q)*e,(M*p-o*x)*e,(M*A-o*G)*e);W.set((v*q-I*w)*e,(v*x-I*p)*e,(v*G-I*A)*e);ea[V].addSelf(P);ea[la].addSelf(P);ea[Y].addSelf(P);O[V].addSelf(W);O[la].addSelf(W);O[Y].addSelf(W)}var b,c,d,f,g,h,k,j,m,n,w,q,p,x,A,G,v,I,o,M,e,ea=[],O=[],P=new THREE.Vector3,W=new THREE.Vector3,S=new THREE.Vector3,aa=new THREE.Vector3,ba=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){ea[b]=new THREE.Vector3;O[b]=new THREE.Vector3}b=
 0;for(c=this.faces.length;b<c;b++){d=this.faces[b];f=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
 0;for(c=this.faces.length;b<c;b++){d=this.faces[b];f=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c,0,1,2);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c,0,1,2);a(this,d.a,d.b,d.d,0,1,3);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2]);
-this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){Z.copy(this.vertices[b].normal);d=aa[b];S.copy(d);S.subSelf(Z.multiplyScalar(Z.dot(d))).normalize();Y.cross(this.vertices[b].normal,d);d=Y.dot(L[b]);d=d<0?-1:1;this.vertices[b].tangent.set(S.x,S.y,S.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
+this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){ba.copy(this.vertices[b].normal);d=ea[b];S.copy(d);S.subSelf(ba.multiplyScalar(ba.dot(d))).normalize();aa.cross(this.vertices[b].normal,d);d=aa.dot(O[b]);d=d<0?-1:1;this.vertices[b].tangent.set(S.x,S.y,S.z,d)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
 z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
-this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(o){var w=[];b=0;for(c=o.length;b<c;b++)o[b]==undefined?w.push("undefined"):w.push(o[b].id);return w.join("_")}var b,c,d,f,g,h,k,j,m={};d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];
+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}},sortFacesByMaterial:function(){function a(n){var w=[];b=0;for(c=n.length;b<c;b++)n[b]==undefined?w.push("undefined"):w.push(n[b].id);return w.join("_")}var b,c,d,f,g,h,k,j,m={};d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];
 h=g.materials;k=a(h);m[k]==undefined&&(m[k]={hash:k,counter:0});j=m[k].hash+"_"+m[k].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:h,vertices:0});g=g instanceof THREE.Face3?3:4;if(this.geometryChunks[j].vertices+g>65535){m[k].counter+=1;j=m[k].hash+"_"+m[k].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:h,vertices:0})}this.geometryChunks[j].faces.push(d);this.geometryChunks[j].vertices+=g}},toString:function(){return"THREE.Geometry ( vertices: "+
 h=g.materials;k=a(h);m[k]==undefined&&(m[k]={hash:k,counter:0});j=m[k].hash+"_"+m[k].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:h,vertices:0});g=g instanceof THREE.Face3?3:4;if(this.geometryChunks[j].vertices+g>65535){m[k].counter+=1;j=m[k].hash+"_"+m[k].counter;this.geometryChunks[j]==undefined&&(this.geometryChunks[j]={faces:[],materials:h,vertices:0})}this.geometryChunks[j].faces.push(d);this.geometryChunks[j].vertices+=g}},toString:function(){return"THREE.Geometry ( vertices: "+
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
 this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
 THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;d<a.length;d++)a[d].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var d=0;d<c.hierarchy.length;d++)for(var f=0;f<c.hierarchy[d].keys.length;f++){if(c.hierarchy[d].keys[f].time<0)c.hierarchy[d].keys[f].time=0;c.hierarchy[d].keys[f].index=f;if(c.hierarchy[d].keys[f].rot!==undefined&&!(c.hierarchy[d].keys[f].rot instanceof
 THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var d=0;d<a.length;d++)a[d].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var d=0;d<c.hierarchy.length;d++)for(var f=0;f<c.hierarchy[d].keys.length;f++){if(c.hierarchy[d].keys[f].time<0)c.hierarchy[d].keys[f].time=0;c.hierarchy[d].keys[f].index=f;if(c.hierarchy[d].keys[f].rot!==undefined&&!(c.hierarchy[d].keys[f].rot instanceof
@@ -74,17 +75,17 @@ THREE.Quaternion)){var g=c.hierarchy[d].keys[f].rot;c.hierarchy[d].keys[f].rot=n
 THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
 THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
 THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].matrixAutoUpdate=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
 THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].matrixAutoUpdate=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
 this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
 this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
-THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,d,f,g,h,k=this.data.JIT.hierarchy,j=(new Date).getTime()*0.0010-this.startTime+this.offset,m=j;if(j>this.data.length){for(;j>this.data.length;)j-=this.data.length;this.startTime=(new Date).getTime()*0.0010-j;j=(new Date).getTime()*0.0010-this.startTime}h=Math.min(parseInt(j*this.data.fps),parseInt(this.data.length*this.data.fps));for(var o=0,w=this.hierarchy.length;o<w;o++){g=this.hierarchy[o];if(k[o][h]!==
-undefined){g.skinMatrix=k[o][h];g.matrixAutoUpdate=!1;g.matrixNeedsUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,o*16)}else for(var u=0;u<3;u++){c=a[u];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[o].keys[0];f=this.getNextKeyWith(c,o,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,o,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.matrixAutoUpdate=!0;g.matrixNeedsUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];f=
-f[c];if(c==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)k[o][h]=this.hierarchy[o].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
+THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,d,f,g,h,k=this.data.JIT.hierarchy,j=(new Date).getTime()*0.0010-this.startTime+this.offset,m=j;if(j>this.data.length){for(;j>this.data.length;)j-=this.data.length;this.startTime=(new Date).getTime()*0.0010-j;j=(new Date).getTime()*0.0010-this.startTime}h=Math.min(parseInt(j*this.data.fps),parseInt(this.data.length*this.data.fps));for(var n=0,w=this.hierarchy.length;n<w;n++){g=this.hierarchy[n];if(k[n][h]!==
+undefined){g.skinMatrix=k[n][h];g.matrixAutoUpdate=!1;g.matrixNeedsUpdate=!1;g.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,n*16)}else for(var q=0;q<3;q++){c=a[q];d=g.prevKey[c];f=g.nextKey[c];if(f.time<m){if(j<m)if(this.loop){d=this.data.hierarchy[n].keys[0];f=this.getNextKeyWith(c,n,1)}else{this.stop();return}else{do{d=f;f=this.getNextKeyWith(c,n,f.index+1)}while(f.time<j)}g.prevKey[c]=d;g.nextKey[c]=f}g.matrixAutoUpdate=!0;g.matrixNeedsUpdate=!0;b=(j-d.time)/(f.time-d.time);d=d[c];f=
+f[c];if(c==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(d,f,g.quaternion,b)}else{c=c==="pos"?g.position:g.scale;c.x=d[0]+(f[0]-d[0])*b;c.y=d[1]+(f[1]-d[1])*b;c.z=d[2]+(f[2]-d[2])*b}}}if(k[0][h]===undefined){this.hierarchy[0].update(undefined,!0);for(n=0;n<this.hierarchy.length;n++)k[n][h]=this.hierarchy[n].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
 THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
 THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var d=this.data.hierarchy[b].keys;c<d.length;c++)if(d[c][a]!==undefined)return d[c];return this.data.hierarchy[b].keys[0]};
-THREE.Camera=function(a,b,c,d,f,g){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=g||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);
-this.target.position.addSelf(this.tmpVec)};this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera=function(a,b,c,d,f,g){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=d||2E3;this.screenCenterY=this.screenCenterX=0;this.target=g||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.tmpVec=new THREE.Vector3;this.translateX=function(h,k){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);if(k)this.tmpVec.y=
+0;this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};this.translateZ=function(h,k){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);if(k)this.tmpVec.y=0;this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
 THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
 THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0;THREE.Matrix4.makeInvert(this.globalMatrix,
 this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
 this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c)};
-THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,d=a.globalMatrix.n34,f=this.inverseMatrix,g=a.boundRadius*a.boundRadiusScale,h=f.n31*b+f.n32*c+f.n33*d+f.n34;if(h-g>-this.zNear)return!1;if(h+g<-this.zFar)return!1;h-=g;var k=this.projectionMatrix,j=1/(k.n43*h),m=j*this.screenCenterX,o=(f.n11*b+f.n12*c+f.n13*d+f.n14)*k.n11*m;g=k.n11*g*m;if(o+g<-this.screenCenterX)return!1;if(o-g>this.screenCenterX)return!1;b=(f.n21*b+f.n22*c+f.n23*d+f.n24)*k.n22*j*this.screenCenterY;
-if(b+g<-this.screenCenterY)return!1;if(b-g>this.screenCenterY)return!1;a.screenPosition.set(o,b,h,g);return!0};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.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,d=a.globalMatrix.n34,f=this.inverseMatrix,g=a.boundRadius*a.boundRadiusScale,h=f.n31*b+f.n32*c+f.n33*d+f.n34;if(h-g>-this.zNear)return!1;if(h+g<-this.zFar)return!1;h-=g;var k=this.projectionMatrix,j=1/(k.n43*h),m=j*this.screenCenterX,n=(f.n11*b+f.n12*c+f.n13*d+f.n14)*k.n11*m;g=k.n11*g*m;if(n+g<-this.screenCenterX)return!1;if(n-g>this.screenCenterX)return!1;b=(f.n21*b+f.n22*c+f.n23*d+f.n24)*k.n22*j*this.screenCenterY;
+if(b+g<-this.screenCenterY)return!1;if(b-g>this.screenCenterY)return!1;a.screenPosition.set(n,b,h,g);return!0};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.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.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.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!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.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!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.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
@@ -135,122 +136,128 @@ THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.matrixA
 THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
 THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
 THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
 d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
 d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[f].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
-THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};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 a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.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.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;
-THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
-THREE.Projector=function(){function a(L,M){return M.z-L.z}function b(L,M){var V=0,S=1,Y=L.z+L.w,Z=M.z+M.w,G=-L.z+L.w,U=-M.z+M.w;if(Y>=0&&Z>=0&&G>=0&&U>=0)return!0;else if(Y<0&&Z<0||G<0&&U<0)return!1;else{if(Y<0)V=Math.max(V,Y/(Y-Z));else Z<0&&(S=Math.min(S,Y/(Y-Z)));if(G<0)V=Math.max(V,G/(G-U));else U<0&&(S=Math.min(S,G/(G-U)));if(S<V)return!1;else{L.lerpSelf(M,V);M.lerpSelf(L,1-S);return!0}}}var c,d,f=[],g,h,k,j=[],m,o,w=[],u,t,x=[],A=new THREE.Vector4,F=new THREE.Vector4,v=new THREE.Matrix4,I=new THREE.Matrix4,
-q=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,e=new THREE.Vector4,aa;this.projectObjects=function(L,M,V){M=[];var S,Y,Z;d=0;Y=L.objects;L=0;for(S=Y.length;L<S;L++){Z=Y[L];var G;if(!(G=!Z.visible))if(G=Z instanceof THREE.Mesh){a:{G=void 0;for(var U=Z.globalMatrix,na=-Z.geometry.boundingSphere.radius*Math.max(Z.scale.x,Math.max(Z.scale.y,Z.scale.z)),W=0;W<6;W++){G=q[W].x*U.n14+q[W].y*U.n24+q[W].z*U.n34+q[W].w;if(G<=
-na){G=!1;break a}}G=!0}G=!G}if(!G){c=f[d]=f[d]||new THREE.RenderableObject;A.copy(Z.position);v.multiplyVector3(A);c.object=Z;c.z=A.z;M.push(c);d++}}V&&M.sort(a);return M};this.projectScene=function(L,M,V){var S=[],Y=M.zNear,Z=M.zFar,G,U,na,W,ka,ha,da,ra,ya,l,z,B,p,n,C,H;k=o=t=0;M.matrixAutoUpdate&&M.update();v.multiply(M.projectionMatrix,M.globalMatrix);q[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);q[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);q[2].set(v.n41+v.n21,v.n42+v.n22,
-v.n43+v.n23,v.n44+v.n24);q[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);q[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);q[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(G=0;G<6;G++){ha=q[G];ha.divideScalar(Math.sqrt(ha.x*ha.x+ha.y*ha.y+ha.z*ha.z))}L.update(undefined,!1,M);ha=this.projectObjects(L,M,!0);L=0;for(G=ha.length;L<G;L++){da=ha[L].object;if(da.visible){da.matrixAutoUpdate&&da.updateMatrix();ra=da.globalMatrix;ra.extractRotationMatrix(da.matrixRotation);z=
-da.matrixRotation;ya=da.materials;l=da.overdraw;if(da instanceof THREE.Mesh){B=da.geometry;p=B.vertices;U=0;for(na=p.length;U<na;U++){n=p[U];n.positionWorld.copy(n.position);ra.multiplyVector3(n.positionWorld);W=n.positionScreen;W.copy(n.positionWorld);v.multiplyVector4(W);W.x/=W.w;W.y/=W.w;n.__visible=W.z>Y&&W.z<Z}B=B.faces;U=0;for(na=B.length;U<na;U++){n=B[U];if(n instanceof THREE.Face3){W=p[n.a];ka=p[n.b];C=p[n.c];if(W.__visible&&ka.__visible&&C.__visible&&(da.doubleSided||da.flipSided!=(C.positionScreen.x-
-W.positionScreen.x)*(ka.positionScreen.y-W.positionScreen.y)-(C.positionScreen.y-W.positionScreen.y)*(ka.positionScreen.x-W.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(W.positionWorld);g.v2.positionWorld.copy(ka.positionWorld);g.v3.positionWorld.copy(C.positionWorld);g.v1.positionScreen.copy(W.positionScreen);g.v2.positionScreen.copy(ka.positionScreen);g.v3.positionScreen.copy(C.positionScreen);g.normalWorld.copy(n.normal);z.multiplyVector3(g.normalWorld);
-g.centroidWorld.copy(n.centroid);ra.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);C=n.vertexNormals;aa=g.vertexNormalsWorld;W=0;for(ka=C.length;W<ka;W++){H=aa[W]=aa[W]||new THREE.Vector3;H.copy(C[W]);z.multiplyVector3(H)}g.z=g.centroidScreen.z;g.meshMaterials=ya;g.faceMaterials=n.materials;g.overdraw=l;if(da.geometry.uvs[U]){g.uvs[0]=da.geometry.uvs[U][0];g.uvs[1]=da.geometry.uvs[U][1];g.uvs[2]=da.geometry.uvs[U][2]}S.push(g);k++}}else if(n instanceof
-THREE.Face4){W=p[n.a];ka=p[n.b];C=p[n.c];H=p[n.d];if(W.__visible&&ka.__visible&&C.__visible&&H.__visible&&(da.doubleSided||da.flipSided!=((H.positionScreen.x-W.positionScreen.x)*(ka.positionScreen.y-W.positionScreen.y)-(H.positionScreen.y-W.positionScreen.y)*(ka.positionScreen.x-W.positionScreen.x)<0||(ka.positionScreen.x-C.positionScreen.x)*(H.positionScreen.y-C.positionScreen.y)-(ka.positionScreen.y-C.positionScreen.y)*(H.positionScreen.x-C.positionScreen.x)<0))){g=j[k]=j[k]||new THREE.RenderableFace3;
-g.v1.positionWorld.copy(W.positionWorld);g.v2.positionWorld.copy(ka.positionWorld);g.v3.positionWorld.copy(H.positionWorld);g.v1.positionScreen.copy(W.positionScreen);g.v2.positionScreen.copy(ka.positionScreen);g.v3.positionScreen.copy(H.positionScreen);g.normalWorld.copy(n.normal);z.multiplyVector3(g.normalWorld);g.centroidWorld.copy(n.centroid);ra.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=ya;
-g.faceMaterials=n.materials;g.overdraw=l;if(da.geometry.uvs[U]){g.uvs[0]=da.geometry.uvs[U][0];g.uvs[1]=da.geometry.uvs[U][1];g.uvs[2]=da.geometry.uvs[U][3]}S.push(g);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(ka.positionWorld);h.v2.positionWorld.copy(C.positionWorld);h.v3.positionWorld.copy(H.positionWorld);h.v1.positionScreen.copy(ka.positionScreen);h.v2.positionScreen.copy(C.positionScreen);h.v3.positionScreen.copy(H.positionScreen);h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);
-h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=ya;h.faceMaterials=n.materials;h.overdraw=l;if(da.geometry.uvs[U]){h.uvs[0]=da.geometry.uvs[U][1];h.uvs[1]=da.geometry.uvs[U][2];h.uvs[2]=da.geometry.uvs[U][3]}S.push(h);k++}}}}else if(da instanceof THREE.Line){I.multiply(v,ra);p=da.geometry.vertices;n=p[0];n.positionScreen.copy(n.position);I.multiplyVector4(n.positionScreen);U=1;for(na=p.length;U<na;U++){W=p[U];W.positionScreen.copy(W.position);I.multiplyVector4(W.positionScreen);
-ka=p[U-1];J.copy(W.positionScreen);e.copy(ka.positionScreen);if(b(J,e)){J.multiplyScalar(1/J.w);e.multiplyScalar(1/e.w);m=w[o]=w[o]||new THREE.RenderableLine;m.v1.positionScreen.copy(J);m.v2.positionScreen.copy(e);m.z=Math.max(J.z,e.z);m.materials=da.materials;S.push(m);o++}}}else if(da instanceof THREE.Particle){F.set(da.position.x,da.position.y,da.position.z,1);v.multiplyVector4(F);F.z/=F.w;if(F.z>0&&F.z<1){u=x[t]=x[t]||new THREE.RenderableParticle;u.x=F.x/F.w;u.y=F.y/F.w;u.z=F.z;u.rotation=da.rotation.z;
-u.scale.x=da.scale.x*Math.abs(u.x-(F.x+M.projectionMatrix.n11)/(F.w+M.projectionMatrix.n14));u.scale.y=da.scale.y*Math.abs(u.y-(F.y+M.projectionMatrix.n22)/(F.w+M.projectionMatrix.n24));u.materials=da.materials;S.push(u);t++}}}}V&&S.sort(a);return S};this.unprojectVector=function(L,M){var V=THREE.Matrix4.makeInvert(M.globalMatrix);V.multiplySelf(THREE.Matrix4.makeInvert(M.projectionMatrix));V.multiplyVector3(L);return L}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,o,w,u,t,x,A;a=b.projectScene(h,k);j=0;for(m=a.length;j<m;j++){u=a[j];if(u instanceof THREE.RenderableParticle){x=u.x*f+f;A=u.y*g+g;o=0;for(w=u.material.length;o<w;o++){t=u.material[o];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=x+"px";t.style.top=A+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(sa){if(u!=sa)m.globalAlpha=u=sa}function b(sa){if(t!=sa){switch(sa){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}t=sa}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,j,m=f.getContext("2d"),o=new THREE.Color(0),w=0,u=1,t=0,x=null,A=null,F=1,v,I,q,J,e,aa,L,M,V,S=new THREE.Color,
-Y=new THREE.Color,Z=new THREE.Color,G=new THREE.Color,U=new THREE.Color,na,W,ka,ha,da,ra,ya,l,z,B=new THREE.Rectangle,p=new THREE.Rectangle,n=new THREE.Rectangle,C=!1,H=new THREE.Color,N=new THREE.Color,ba=new THREE.Color,y=new THREE.Color,E=Math.PI*2,D=new THREE.Vector3,P,T,oa,la,ja,ma,pa=16;P=document.createElement("canvas");P.width=P.height=2;T=P.getContext("2d");T.fillStyle="rgba(0,0,0,1)";T.fillRect(0,0,2,2);oa=T.getImageData(0,0,2,2);la=oa.data;ja=document.createElement("canvas");ja.width=ja.height=
-pa;ma=ja.getContext("2d");ma.translate(-pa/2,-pa/2);ma.scale(pa,pa);pa--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(sa,O){g=sa;h=O;k=g/2;j=h/2;f.width=g;f.height=h;B.set(-k,-j,k,j);u=1;t=0;A=x=null;F=1};this.setClearColor=function(sa,O){o=sa;w=O;p.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.setClearColorHex=function(sa,O){o.setHex(sa);w=O;p.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.clear=function(){m.setTransform(1,
-0,0,-1,k,j);if(!p.isEmpty()){p.inflate(1);p.minSelf(B);if(o.hex==0&&w==0)m.clearRect(p.getX(),p.getY(),p.getWidth(),p.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+w+")";m.fillRect(p.getX(),p.getY(),p.getWidth(),p.getHeight())}p.empty()}};this.render=function(sa,O){function Ia(Q){var fa,ga,R,ea=Q.lights;N.setRGB(0,0,0);ba.setRGB(0,0,0);y.setRGB(0,0,0);Q=0;for(fa=ea.length;Q<fa;Q++){ga=ea[Q];R=ga.color;if(ga instanceof
-THREE.AmbientLight){N.r+=R.r;N.g+=R.g;N.b+=R.b}else if(ga instanceof THREE.DirectionalLight){ba.r+=R.r;ba.g+=R.g;ba.b+=R.b}else if(ga instanceof THREE.PointLight){y.r+=R.r;y.g+=R.g;y.b+=R.b}}}function Ca(Q,fa,ga,R){var ea,qa,Aa,Ga,Ha=Q.lights;Q=0;for(ea=Ha.length;Q<ea;Q++){qa=Ha[Q];Aa=qa.color;Ga=qa.intensity;if(qa instanceof THREE.DirectionalLight){qa=ga.dot(qa.position)*Ga;if(qa>0){R.r+=Aa.r*qa;R.g+=Aa.g*qa;R.b+=Aa.b*qa}}else if(qa instanceof THREE.PointLight){D.sub(qa.position,fa);D.normalize();
-qa=ga.dot(D)*Ga;if(qa>0){R.r+=Aa.r*qa;R.g+=Aa.g*qa;R.b+=Aa.b*qa}}}}function Ja(Q,fa,ga){if(ga.opacity!=0){a(ga.opacity);b(ga.blending);var R,ea,qa,Aa,Ga,Ha;if(ga instanceof THREE.ParticleBasicMaterial){if(ga.map){Aa=ga.map.image;Ga=Aa.width>>1;Ha=Aa.height>>1;ea=fa.scale.x*k;qa=fa.scale.y*j;ga=ea*Ga;R=qa*Ha;n.set(Q.x-ga,Q.y-R,Q.x+ga,Q.y+R);if(B.instersects(n)){m.save();m.translate(Q.x,Q.y);m.rotate(-fa.rotation);m.scale(ea,-qa);m.translate(-Ga,-Ha);m.drawImage(Aa,0,0);m.restore()}}}else if(ga instanceof
-THREE.ParticleCircleMaterial){if(C){H.r=N.r+ba.r+y.r;H.g=N.g+ba.g+y.g;H.b=N.b+ba.b+y.b;S.r=ga.color.r*H.r;S.g=ga.color.g*H.g;S.b=ga.color.b*H.b;S.updateStyleString()}else S.__styleString=ga.color.__styleString;ga=fa.scale.x*k;R=fa.scale.y*j;n.set(Q.x-ga,Q.y-R,Q.x+ga,Q.y+R);if(B.instersects(n)){ea=S.__styleString;if(A!=ea)m.fillStyle=A=ea;m.save();m.translate(Q.x,Q.y);m.rotate(-fa.rotation);m.scale(ga,R);m.beginPath();m.arc(0,0,1,0,E,!0);m.closePath();m.fill();m.restore()}}}}function ca(Q,fa,ga,R){if(R.opacity!=
-0){a(R.opacity);b(R.blending);m.beginPath();m.moveTo(Q.positionScreen.x,Q.positionScreen.y);m.lineTo(fa.positionScreen.x,fa.positionScreen.y);m.closePath();if(R instanceof THREE.LineBasicMaterial){S.__styleString=R.color.__styleString;Q=R.linewidth;if(F!=Q)m.lineWidth=F=Q;Q=S.__styleString;if(x!=Q)m.strokeStyle=x=Q;m.stroke();n.inflate(R.linewidth*2)}}}function $(Q,fa,ga,R,ea,qa){if(ea.opacity!=0){a(ea.opacity);b(ea.blending);J=Q.positionScreen.x;e=Q.positionScreen.y;aa=fa.positionScreen.x;L=fa.positionScreen.y;
-M=ga.positionScreen.x;V=ga.positionScreen.y;m.beginPath();m.moveTo(J,e);m.lineTo(aa,L);m.lineTo(M,V);m.lineTo(J,e);m.closePath();if(ea instanceof THREE.MeshBasicMaterial)if(ea.map)ea.map.mapping instanceof THREE.UVMapping&&Fa(J,e,aa,L,M,V,ea.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);else if(ea.env_map){if(ea.env_map.mapping instanceof THREE.SphericalReflectionMapping){Q=O.globalMatrix;D.copy(R.vertexNormalsWorld[0]);ha=(D.x*Q.n11+D.y*Q.n12+D.z*Q.n13)*0.5+0.5;da=
--(D.x*Q.n21+D.y*Q.n22+D.z*Q.n23)*0.5+0.5;D.copy(R.vertexNormalsWorld[1]);ra=(D.x*Q.n11+D.y*Q.n12+D.z*Q.n13)*0.5+0.5;ya=-(D.x*Q.n21+D.y*Q.n22+D.z*Q.n23)*0.5+0.5;D.copy(R.vertexNormalsWorld[2]);l=(D.x*Q.n11+D.y*Q.n12+D.z*Q.n13)*0.5+0.5;z=-(D.x*Q.n21+D.y*Q.n22+D.z*Q.n23)*0.5+0.5;Fa(J,e,aa,L,M,V,ea.env_map.image,ha,da,ra,ya,l,z)}}else ea.wireframe?X(ea.color.__styleString,ea.wireframe_linewidth):ta(ea.color.__styleString);else if(ea instanceof THREE.MeshLambertMaterial){if(ea.map&&!ea.wireframe){ea.map.mapping instanceof
-THREE.UVMapping&&Fa(J,e,aa,L,M,V,ea.map.image,R.uvs[0].u,R.uvs[0].v,R.uvs[1].u,R.uvs[1].v,R.uvs[2].u,R.uvs[2].v);b(THREE.SubtractiveBlending)}if(C)if(!ea.wireframe&&ea.shading==THREE.SmoothShading&&R.vertexNormalsWorld.length==3){Y.r=Z.r=G.r=N.r;Y.g=Z.g=G.g=N.g;Y.b=Z.b=G.b=N.b;Ca(qa,R.v1.positionWorld,R.vertexNormalsWorld[0],Y);Ca(qa,R.v2.positionWorld,R.vertexNormalsWorld[1],Z);Ca(qa,R.v3.positionWorld,R.vertexNormalsWorld[2],G);U.r=(Z.r+G.r)*0.5;U.g=(Z.g+G.g)*0.5;U.b=(Z.b+G.b)*0.5;ka=Da(Y,Z,G,U);
-Fa(J,e,aa,L,M,V,ka,0,0,1,0,0,1)}else{H.r=N.r;H.g=N.g;H.b=N.b;Ca(qa,R.centroidWorld,R.normalWorld,H);S.r=ea.color.r*H.r;S.g=ea.color.g*H.g;S.b=ea.color.b*H.b;S.updateStyleString();ea.wireframe?X(S.__styleString,ea.wireframe_linewidth):ta(S.__styleString)}else ea.wireframe?X(ea.color.__styleString,ea.wireframe_linewidth):ta(ea.color.__styleString)}else if(ea instanceof THREE.MeshDepthMaterial){na=O.near;W=O.far;Y.r=Y.g=Y.b=1-K(Q.positionScreen.z,na,W);Z.r=Z.g=Z.b=1-K(fa.positionScreen.z,na,W);G.r=G.g=
-G.b=1-K(ga.positionScreen.z,na,W);U.r=(Z.r+G.r)*0.5;U.g=(Z.g+G.g)*0.5;U.b=(Z.b+G.b)*0.5;ka=Da(Y,Z,G,U);Fa(J,e,aa,L,M,V,ka,0,0,1,0,0,1)}else if(ea instanceof THREE.MeshNormalMaterial){S.r=Ea(R.normalWorld.x);S.g=Ea(R.normalWorld.y);S.b=Ea(R.normalWorld.z);S.updateStyleString();ea.wireframe?X(S.__styleString,ea.wireframe_linewidth):ta(S.__styleString)}}}function X(Q,fa){if(x!=Q)m.strokeStyle=x=Q;if(F!=fa)m.lineWidth=F=fa;m.stroke();n.inflate(fa*2)}function ta(Q){if(A!=Q)m.fillStyle=A=Q;m.fill()}function Fa(Q,
-fa,ga,R,ea,qa,Aa,Ga,Ha,La,Ba,Ma,Ta){var Na,Oa;Na=Aa.width-1;Oa=Aa.height-1;Ga*=Na;Ha*=Oa;La*=Na;Ba*=Oa;Ma*=Na;Ta*=Oa;ga-=Q;R-=fa;ea-=Q;qa-=fa;La-=Ga;Ba-=Ha;Ma-=Ga;Ta-=Ha;Na=La*Ta-Ma*Ba;if(Na!=0){Oa=1/Na;Na=(Ta*ga-Ba*ea)*Oa;Ba=(Ta*R-Ba*qa)*Oa;ga=(La*ea-Ma*ga)*Oa;R=(La*qa-Ma*R)*Oa;Q=Q-Na*Ga-ga*Ha;fa=fa-Ba*Ga-R*Ha;m.save();m.transform(Na,Ba,ga,R,Q,fa);m.clip();m.drawImage(Aa,0,0);m.restore()}}function Da(Q,fa,ga,R){var ea=~~(Q.r*255),qa=~~(Q.g*255);Q=~~(Q.b*255);var Aa=~~(fa.r*255),Ga=~~(fa.g*255);fa=
-~~(fa.b*255);var Ha=~~(ga.r*255),La=~~(ga.g*255);ga=~~(ga.b*255);var Ba=~~(R.r*255),Ma=~~(R.g*255);R=~~(R.b*255);la[0]=ea<0?0:ea>255?255:ea;la[1]=qa<0?0:qa>255?255:qa;la[2]=Q<0?0:Q>255?255:Q;la[4]=Aa<0?0:Aa>255?255:Aa;la[5]=Ga<0?0:Ga>255?255:Ga;la[6]=fa<0?0:fa>255?255:fa;la[8]=Ha<0?0:Ha>255?255:Ha;la[9]=La<0?0:La>255?255:La;la[10]=ga<0?0:ga>255?255:ga;la[12]=Ba<0?0:Ba>255?255:Ba;la[13]=Ma<0?0:Ma>255?255:Ma;la[14]=R<0?0:R>255?255:R;T.putImageData(oa,0,0);ma.drawImage(P,0,0);return ja}function K(Q,
-fa,ga){Q=(Q-fa)/(ga-fa);return Q*Q*(3-2*Q)}function Ea(Q){Q=(Q+1)*0.5;return Q<0?0:Q>1?1:Q}function Ra(Q,fa){var ga=fa.x-Q.x,R=fa.y-Q.y,ea=1/Math.sqrt(ga*ga+R*R);ga*=ea;R*=ea;fa.x+=ga;fa.y+=R;Q.x-=ga;Q.y-=R}var Pa,Ka,ia,wa,ua,xa,za,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(sa,O,this.sortElements);(C=sa.lights.length>0)&&Ia(sa);Pa=0;for(Ka=c.length;Pa<Ka;Pa++){ia=c[Pa];n.empty();if(ia instanceof THREE.RenderableParticle){v=ia;v.x*=k;v.y*=j;wa=0;for(ua=ia.materials.length;wa<
-ua;wa++)Ja(v,ia,ia.materials[wa],sa)}else if(ia instanceof THREE.RenderableLine){v=ia.v1;I=ia.v2;v.positionScreen.x*=k;v.positionScreen.y*=j;I.positionScreen.x*=k;I.positionScreen.y*=j;n.addPoint(v.positionScreen.x,v.positionScreen.y);n.addPoint(I.positionScreen.x,I.positionScreen.y);if(B.instersects(n)){wa=0;for(ua=ia.materials.length;wa<ua;)ca(v,I,ia,ia.materials[wa++],sa)}}else if(ia instanceof THREE.RenderableFace3){v=ia.v1;I=ia.v2;q=ia.v3;v.positionScreen.x*=k;v.positionScreen.y*=j;I.positionScreen.x*=
-k;I.positionScreen.y*=j;q.positionScreen.x*=k;q.positionScreen.y*=j;if(ia.overdraw){Ra(v.positionScreen,I.positionScreen);Ra(I.positionScreen,q.positionScreen);Ra(q.positionScreen,v.positionScreen)}n.add3Points(v.positionScreen.x,v.positionScreen.y,I.positionScreen.x,I.positionScreen.y,q.positionScreen.x,q.positionScreen.y);if(B.instersects(n)){wa=0;for(ua=ia.meshMaterials.length;wa<ua;){va=ia.meshMaterials[wa++];if(va instanceof THREE.MeshFaceMaterial){xa=0;for(za=ia.faceMaterials.length;xa<za;)(va=
-ia.faceMaterials[xa++])&&$(v,I,q,ia,va,sa)}else $(v,I,q,ia,va,sa)}}}p.addRectangle(n)}m.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(ha,da,ra){var ya,l,z,B;ya=0;for(l=ha.lights.length;ya<l;ya++){z=ha.lights[ya];if(z instanceof THREE.DirectionalLight){B=da.normalWorld.dot(z.position)*z.intensity;if(B>0){ra.r+=z.color.r*B;ra.g+=z.color.g*B;ra.b+=z.color.b*B}}else if(z instanceof THREE.PointLight){V.sub(z.position,da.centroidWorld);V.normalize();B=da.normalWorld.dot(V)*z.intensity;if(B>0){ra.r+=z.color.r*B;ra.g+=z.color.g*B;ra.b+=z.color.b*B}}}}function b(ha,da,ra,ya,l,z){G=d(U++);G.setAttribute("d",
-"M "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+da.positionScreen.x+" "+da.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)q.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(I){J.r=e.r;J.g=e.g;J.b=e.b;a(z,ya,J);q.r=l.color.r*J.r;q.g=l.color.g*J.g;q.b=l.color.b*J.b;q.updateStyleString()}else q.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){M=1-l.__2near/(l.__farPlusNear-
-ya.z*l.__farMinusNear);q.setRGB(M,M,M)}else l instanceof THREE.MeshNormalMaterial&&q.setRGB(f(ya.normalWorld.x),f(ya.normalWorld.y),f(ya.normalWorld.z));l.wireframe?G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+l.wireframe_linewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframe_linecap+"; stroke-linejoin: "+l.wireframe_linejoin):G.setAttribute("style","fill: "+q.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(G)}function c(ha,da,ra,ya,
-l,z,B){G=d(U++);G.setAttribute("d","M "+ha.positionScreen.x+" "+ha.positionScreen.y+" L "+da.positionScreen.x+" "+da.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+ya.positionScreen.x+","+ya.positionScreen.y+"z");if(z instanceof THREE.MeshBasicMaterial)q.__styleString=z.color.__styleString;else if(z instanceof THREE.MeshLambertMaterial)if(I){J.r=e.r;J.g=e.g;J.b=e.b;a(B,l,J);q.r=z.color.r*J.r;q.g=z.color.g*J.g;q.b=z.color.b*J.b;q.updateStyleString()}else q.__styleString=z.color.__styleString;
-else if(z instanceof THREE.MeshDepthMaterial){M=1-z.__2near/(z.__farPlusNear-l.z*z.__farMinusNear);q.setRGB(M,M,M)}else z instanceof THREE.MeshNormalMaterial&&q.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));z.wireframe?G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+z.wireframe_linewidth+"; stroke-opacity: "+z.opacity+"; stroke-linecap: "+z.wireframe_linecap+"; stroke-linejoin: "+z.wireframe_linejoin):G.setAttribute("style","fill: "+q.__styleString+
-"; fill-opacity: "+z.opacity);k.appendChild(G)}function d(ha){if(S[ha]==null){S[ha]=document.createElementNS("http://www.w3.org/2000/svg","path");ka==0&&S[ha].setAttribute("shape-rendering","crispEdges")}return S[ha]}function f(ha){return ha<0?Math.min((1+ha)*0.5,0.5):0.5+Math.min(ha*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,o,w,u,t,x,A,F=new THREE.Rectangle,v=new THREE.Rectangle,I=!1,q=new THREE.Color(16777215),J=new THREE.Color(16777215),
-e=new THREE.Color(0),aa=new THREE.Color(0),L=new THREE.Color(0),M,V=new THREE.Vector3,S=[],Y=[],Z=[],G,U,na,W,ka=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ha){switch(ha){case "high":ka=1;break;case "low":ka=0}};this.setSize=function(ha,da){j=ha;m=da;o=j/2;w=m/2;k.setAttribute("viewBox",-o+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);F.set(-o,-w,o,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
-this.render=function(ha,da){var ra,ya,l,z,B,p,n,C;this.autoClear&&this.clear();g=h.projectScene(ha,da,this.sortElements);W=na=U=0;if(I=ha.lights.length>0){n=ha.lights;e.setRGB(0,0,0);aa.setRGB(0,0,0);L.setRGB(0,0,0);ra=0;for(ya=n.length;ra<ya;ra++){l=n[ra];z=l.color;if(l instanceof THREE.AmbientLight){e.r+=z.r;e.g+=z.g;e.b+=z.b}else if(l instanceof THREE.DirectionalLight){aa.r+=z.r;aa.g+=z.g;aa.b+=z.b}else if(l instanceof THREE.PointLight){L.r+=z.r;L.g+=z.g;L.b+=z.b}}}ra=0;for(ya=g.length;ra<ya;ra++){n=
-g[ra];v.empty();if(n instanceof THREE.RenderableParticle){u=n;u.x*=o;u.y*=-w;l=0;for(z=n.materials.length;l<z;l++)if(C=n.materials[l]){B=u;p=n;var H=na++;if(Y[H]==null){Y[H]=document.createElementNS("http://www.w3.org/2000/svg","circle");ka==0&&Y[H].setAttribute("shape-rendering","crispEdges")}G=Y[H];G.setAttribute("cx",B.x);G.setAttribute("cy",B.y);G.setAttribute("r",p.scale.x*o);if(C instanceof THREE.ParticleCircleMaterial){if(I){J.r=e.r+aa.r+L.r;J.g=e.g+aa.g+L.g;J.b=e.b+aa.b+L.b;q.r=C.color.r*
-J.r;q.g=C.color.g*J.g;q.b=C.color.b*J.b;q.updateStyleString()}else q=C.color;G.setAttribute("style","fill: "+q.__styleString)}k.appendChild(G)}}else if(n instanceof THREE.RenderableLine){u=n.v1;t=n.v2;u.positionScreen.x*=o;u.positionScreen.y*=-w;t.positionScreen.x*=o;t.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);if(F.instersects(v)){l=0;for(z=n.materials.length;l<z;)if(C=n.materials[l++]){B=u;p=t;H=W++;if(Z[H]==null){Z[H]=
-document.createElementNS("http://www.w3.org/2000/svg","line");ka==0&&Z[H].setAttribute("shape-rendering","crispEdges")}G=Z[H];G.setAttribute("x1",B.positionScreen.x);G.setAttribute("y1",B.positionScreen.y);G.setAttribute("x2",p.positionScreen.x);G.setAttribute("y2",p.positionScreen.y);if(C instanceof THREE.LineBasicMaterial){q.__styleString=C.color.__styleString;G.setAttribute("style","fill: none; stroke: "+q.__styleString+"; stroke-width: "+C.linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+
-C.linecap+"; stroke-linejoin: "+C.linejoin);k.appendChild(G)}}}}else if(n instanceof THREE.RenderableFace3){u=n.v1;t=n.v2;x=n.v3;u.positionScreen.x*=o;u.positionScreen.y*=-w;t.positionScreen.x*=o;t.positionScreen.y*=-w;x.positionScreen.x*=o;x.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(x.positionScreen.x,x.positionScreen.y);if(F.instersects(v)){l=0;for(z=n.meshMaterials.length;l<z;){C=n.meshMaterials[l++];if(C instanceof
-THREE.MeshFaceMaterial){B=0;for(p=n.faceMaterials.length;B<p;)(C=n.faceMaterials[B++])&&b(u,t,x,n,C,ha)}else C&&b(u,t,x,n,C,ha)}}}else if(n instanceof THREE.RenderableFace4){u=n.v1;t=n.v2;x=n.v3;A=n.v4;u.positionScreen.x*=o;u.positionScreen.y*=-w;t.positionScreen.x*=o;t.positionScreen.y*=-w;x.positionScreen.x*=o;x.positionScreen.y*=-w;A.positionScreen.x*=o;A.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(x.positionScreen.x,
-x.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(F.instersects(v)){l=0;for(z=n.meshMaterials.length;l<z;){C=n.meshMaterials[l++];if(C instanceof THREE.MeshFaceMaterial){B=0;for(p=n.faceMaterials.length;B<p;)(C=n.faceMaterials[B++])&&c(u,t,x,A,n,C,ha)}else C&&c(u,t,x,A,n,C,ha)}}}}}};
-THREE.WebGLRenderer=function(a){function b(l,z,B){var p,n,C,H=l.vertices,N=H.length,ba=l.colors,y=ba.length,E=l.__vertexArray,D=l.__colorArray,P=l.__sortArray,T=l.__dirtyVertices,oa=l.__dirtyColors;if(B.sortParticles){U.multiplySelf(B.globalMatrix);for(p=0;p<N;p++){n=H[p].position;ha.copy(n);U.multiplyVector3(ha);P[p]=[ha.z,p]}P.sort(function(la,ja){return ja[0]-la[0]});for(p=0;p<N;p++){n=H[P[p][1]].position;C=p*3;E[C]=n.x;E[C+1]=n.y;E[C+2]=n.z}for(p=0;p<y;p++){C=p*3;color=ba[P[p][1]];D[C]=color.r;
-D[C+1]=color.g;D[C+2]=color.b}}else{if(T)for(p=0;p<N;p++){n=H[p].position;C=p*3;E[C]=n.x;E[C+1]=n.y;E[C+2]=n.z}if(oa)for(p=0;p<y;p++){color=ba[p];C=p*3;D[C]=color.r;D[C+1]=color.g;D[C+2]=color.b}}if(T||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,E,z)}if(oa||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,D,z)}}function c(l,z){l.fragment_shader=z.fragment_shader;l.vertex_shader=z.vertex_shader;l.uniforms=
-Uniforms.clone(z.uniforms)}function d(l,z,B,p,n){p.program||M.initMaterial(p,z,B);var C=p.program,H=C.uniforms,N=p.uniforms;if(C!=aa){e.useProgram(C);aa=C;e.uniformMatrix4fv(H.projectionMatrix,!1,na)}if(B&&(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial||p instanceof THREE.LineBasicMaterial||p instanceof THREE.ParticleBasicMaterial)){N.fogColor.value.setHex(B.color.hex);if(B instanceof THREE.Fog){N.fogNear.value=B.near;N.fogFar.value=
-B.far}else if(B instanceof THREE.FogExp2)N.fogDensity.value=B.density}if(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial){var ba,y,E=0,D=0,P=0,T,oa,la,ja=M.lights,ma=ja.directional.colors,pa=ja.directional.positions,sa=ja.point.colors,O=ja.point.positions,Ia=0,Ca=0;B=y=y=0;for(ba=z.length;B<ba;B++){y=z[B];T=y.color;oa=y.position;la=y.intensity;if(y instanceof THREE.AmbientLight){E+=T.r;D+=T.g;P+=T.b}else if(y instanceof THREE.DirectionalLight){y=Ia*3;ma[y]=T.r*la;ma[y+
-1]=T.g*la;ma[y+2]=T.b*la;pa[y]=oa.x;pa[y+1]=oa.y;pa[y+2]=oa.z;Ia+=1}else if(y instanceof THREE.PointLight){y=Ca*3;sa[y]=T.r*la;sa[y+1]=T.g*la;sa[y+2]=T.b*la;O[y]=oa.x;O[y+1]=oa.y;O[y+2]=oa.z;Ca+=1}}for(B=Ia*3;B<ma.length;B++)ma[B]=0;for(B=Ca*3;B<sa.length;B++)sa[B]=0;ja.point.length=Ca;ja.directional.length=Ia;ja.ambient[0]=E;ja.ambient[1]=D;ja.ambient[2]=P;z=M.lights;N.enableLighting.value=z.directional.length+z.point.length;N.ambientLightColor.value=z.ambient;N.directionalLightColor.value=z.directional.colors;
-N.directionalLightDirection.value=z.directional.positions;N.pointLightColor.value=z.point.colors;N.pointLightPosition.value=z.point.positions}if(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial){N.diffuse.value.setRGB(p.color.r*p.opacity,p.color.g*p.opacity,p.color.b*p.opacity);N.opacity.value=p.opacity;N.map.texture=p.map;N.light_map.texture=p.light_map;N.env_map.texture=p.env_map;N.reflectivity.value=p.reflectivity;N.refraction_ratio.value=
-p.refraction_ratio;N.combine.value=p.combine;N.useRefract.value=p.env_map&&p.env_map.mapping instanceof THREE.CubeRefractionMapping}if(p instanceof THREE.LineBasicMaterial){N.diffuse.value.setRGB(p.color.r*p.opacity,p.color.g*p.opacity,p.color.b*p.opacity);N.opacity.value=p.opacity}else if(p instanceof THREE.ParticleBasicMaterial){N.psColor.value.setRGB(p.color.r*p.opacity,p.color.g*p.opacity,p.color.b*p.opacity);N.opacity.value=p.opacity;N.size.value=p.size;N.map.texture=p.map}else if(p instanceof
-THREE.MeshPhongMaterial){N.ambient.value.setRGB(p.ambient.r,p.ambient.g,p.ambient.b);N.specular.value.setRGB(p.specular.r,p.specular.g,p.specular.b);N.shininess.value=p.shininess}else if(p instanceof THREE.MeshDepthMaterial){N.mNear.value=l.zNear;N.mFar.value=l.zFar;N.opacity.value=p.opacity}else if(p instanceof THREE.MeshNormalMaterial)N.opacity.value=p.opacity;for(var Ja in N)if(E=C.uniforms[Ja]){B=N[Ja];ba=B.type;z=B.value;if(ba=="i")e.uniform1i(E,z);else if(ba=="f")e.uniform1f(E,z);else if(ba==
-"fv1")e.uniform1fv(E,z);else if(ba=="fv")e.uniform3fv(E,z);else if(ba=="v2")e.uniform2f(E,z.x,z.y);else if(ba=="v3")e.uniform3f(E,z.x,z.y,z.z);else if(ba=="c")e.uniform3f(E,z.r,z.g,z.b);else if(ba=="t"){e.uniform1i(E,z);if(B=B.texture)if(B.image instanceof Array&&B.image.length==6){if(B.image.length==6){if(B.needsUpdate){if(!B.image.__webGLTextureCube)B.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,B.image.__webGLTextureCube);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,
-e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR);for(ba=0;ba<6;++ba)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+ba,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,B.image[ba]);e.generateMipmap(e.TEXTURE_CUBE_MAP);e.bindTexture(e.TEXTURE_CUBE_MAP,null);B.needsUpdate=!1}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_CUBE_MAP,B.image.__webGLTextureCube)}}else{if(B.needsUpdate){if(B.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,
-B.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,B.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,q(B.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,q(B.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,q(B.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,q(B.min_filter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}else{B.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);e.texImage2D(e.TEXTURE_2D,
-0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,B.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,q(B.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,q(B.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,q(B.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,q(B.min_filter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null);B.__wasSetOnce=!0}B.needsUpdate=!1}e.activeTexture(e.TEXTURE0+z);e.bindTexture(e.TEXTURE_2D,B.__webGLTexture)}}}e.uniformMatrix4fv(H.modelViewMatrix,
-!1,n._modelViewMatrixArray);e.uniformMatrix3fv(H.normalMatrix,!1,n._normalMatrixArray);(p instanceof THREE.MeshShaderMaterial||p instanceof THREE.MeshPhongMaterial||p.env_map)&&e.uniform3f(H.cameraPosition,l.position.x,l.position.y,l.position.z);(p instanceof THREE.MeshShaderMaterial||p.env_map||p.skinning)&&e.uniformMatrix4fv(H.objectMatrix,!1,n._objectMatrixArray);(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshShaderMaterial||p.skinning)&&e.uniformMatrix4fv(H.viewMatrix,
-!1,ka);if(p.skinning){e.uniformMatrix4fv(H.cameraInverseMatrix,!1,W);e.uniformMatrix4fv(H.boneGlobalMatrices,!1,n.boneMatrices)}return C}function f(l,z,B,p,n,C){l=d(l,z,B,p,C).attributes;e.bindBuffer(e.ARRAY_BUFFER,n.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0);if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,3,
-e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(n.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(n.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);
-if(p.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,
-4,e.FLOAT,!1,0,0)}if(C instanceof THREE.Mesh)if(p.wireframe){e.lineWidth(p.wireframe_linewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);e.drawElements(e.LINES,n.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,n.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(C instanceof THREE.Line){C=C.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(p.linewidth);e.drawArrays(C,0,n.__webGLLineCount)}else if(C instanceof
-THREE.ParticleSystem)e.drawArrays(e.POINTS,0,n.__webGLParticleCount);else C instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,n.__webGLVertexCount)}function g(l,z){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.position);e.vertexAttribPointer(z.attributes.position,
-3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(z.attributes.normal);e.vertexAttribPointer(z.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(V!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);V=l.doubleSided}if(S!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);S=l.flipSided}}function k(l){if(Z!=
-l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);Z=l}}function j(l){G[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);G[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);G[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);G[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);G[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);G[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var z;for(l=0;l<6;l++){z=G[l];z.divideScalar(Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z))}}
-function m(l){for(var z=l.globalMatrix,B=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),p=0;p<6;p++){l=G[p].x*z.n14+G[p].y*z.n24+G[p].z*z.n34+G[p].w;if(l<=B)return!1}return!0}function o(l,z){l.list[l.count]=z;l.count+=1}function w(l){var z,B,p=l.object,n=l.opaque,C=l.transparent;C.count=0;l=n.count=0;for(z=p.materials.length;l<z;l++){B=p.materials[l];B.opacity&&B.opacity<1||B.blending!=THREE.NormalBlending?o(C,B):o(n,B)}}function u(l){var z,B,p,n,C=l.object,H=
-l.buffer,N=l.opaque,ba=l.transparent;ba.count=0;l=N.count=0;for(p=C.materials.length;l<p;l++){z=C.materials[l];if(z instanceof THREE.MeshFaceMaterial){z=0;for(B=H.materials.length;z<B;z++)(n=H.materials[z])&&(n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?o(ba,n):o(N,n))}else{n=z;n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?o(ba,n):o(N,n)}}}function t(l,z){return z.z-l.z}function x(l,z,B,p,n){if(z[B]==undefined){l.push({buffer:p,object:n,opaque:{list:[],count:0},transparent:{list:[],
-count:0}});z[B]=1}}function A(l,z){l._modelViewMatrix.multiplyToArray(z.globalMatrix,l.globalMatrix,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}function F(l){if(l!=Y){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);
-break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}Y=l}}function v(l,z){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,
-l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,q(l.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,q(l.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,q(l.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,q(l.min_filter));e.texImage2D(e.TEXTURE_2D,0,q(l.format),l.width,l.height,0,q(l.format),q(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);
-e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var B,p,n;if(l){B=l.__webGLFramebuffer;p=l.width;n=l.height}else{B=null;p=J.width;n=J.height}if(B!=L){e.bindFramebuffer(e.FRAMEBUFFER,B);e.viewport(0,0,p,n);z&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);L=B}}function I(l,z){var B;if(l=="fragment")B=e.createShader(e.FRAGMENT_SHADER);else l==
-"vertex"&&(B=e.createShader(e.VERTEX_SHADER));e.shaderSource(B,z);e.compileShader(B);if(!e.getShaderParameter(B,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(B));return null}return B}function q(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;
+THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
+THREE.Sound3D=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 f;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==
+-1)f="audio/mpeg";else if(b.indexOf(".ogg")!==-1)f="audio/ogg";else b.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound3D=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound3D.prototype=new THREE.Object3D;THREE.Sound3D.prototype.constructor=THREE.Sound3D;THREE.Sound3D.prototype.supr=THREE.Object3D.prototype;
+THREE.Sound3D.prototype.onLoad=function(){var a=this.THREESound3D;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound3D.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound3D.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};
+THREE.Sound3D.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};THREE.Sound3D.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound3D.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
+THREE.Sound3D.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.localMatrix.setPosition(this.position);b=!0}if(b||this.matrixNeedsUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsUpdate=!1;b=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.globalMatrix,b,c)};THREE.Scene=function(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.sounds=[];this.fog=null};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.Sound3D)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else a instanceof THREE.Camera||a instanceof THREE.Bone||this.objects.indexOf(a)===-1&&this.objects.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.Sound3D){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);b!==-1&&this.objects.splice(b,1)}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;
+THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
+THREE.Projector=function(){function a(O,P){return P.z-O.z}function b(O,P){var W=0,S=1,aa=O.z+O.w,ba=P.z+P.w,H=-O.z+O.w,V=-P.z+P.w;if(aa>=0&&ba>=0&&H>=0&&V>=0)return!0;else if(aa<0&&ba<0||H<0&&V<0)return!1;else{if(aa<0)W=Math.max(W,aa/(aa-ba));else ba<0&&(S=Math.min(S,aa/(aa-ba)));if(H<0)W=Math.max(W,H/(H-V));else V<0&&(S=Math.min(S,H/(H-V)));if(S<W)return!1;else{O.lerpSelf(P,W);P.lerpSelf(O,1-S);return!0}}}var c,d,f=[],g,h,k,j=[],m,n,w=[],q,p,x=[],A=new THREE.Vector4,G=new THREE.Vector4,v=new THREE.Matrix4,
+I=new THREE.Matrix4,o=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],M=new THREE.Vector4,e=new THREE.Vector4,ea;this.projectObjects=function(O,P,W){P=[];var S,aa,ba;d=0;aa=O.objects;O=0;for(S=aa.length;O<S;O++){ba=aa[O];var H;if(!(H=!ba.visible))if(H=ba instanceof THREE.Mesh){a:{H=void 0;for(var V=ba.globalMatrix,la=-ba.geometry.boundingSphere.radius*Math.max(ba.scale.x,Math.max(ba.scale.y,ba.scale.z)),Y=0;Y<6;Y++){H=o[Y].x*V.n14+o[Y].y*
+V.n24+o[Y].z*V.n34+o[Y].w;if(H<=la){H=!1;break a}}H=!0}H=!H}if(!H){c=f[d]=f[d]||new THREE.RenderableObject;A.copy(ba.position);v.multiplyVector3(A);c.object=ba;c.z=A.z;P.push(c);d++}}W&&P.sort(a);return P};this.projectScene=function(O,P,W){var S=[],aa=P.zNear,ba=P.zFar,H,V,la,Y,ka,ia,fa,ra,xa,l,y,B,t,u,E,C;k=n=p=0;P.matrixAutoUpdate&&P.update();v.multiply(P.projectionMatrix,P.globalMatrix);o[0].set(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);o[1].set(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+
+v.n14);o[2].set(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);o[3].set(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);o[4].set(v.n41-v.n31,v.n42-v.n32,v.n43-v.n33,v.n44-v.n34);o[5].set(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);for(H=0;H<6;H++){ia=o[H];ia.divideScalar(Math.sqrt(ia.x*ia.x+ia.y*ia.y+ia.z*ia.z))}O.update(undefined,!1,P);ia=this.projectObjects(O,P,!0);O=0;for(H=ia.length;O<H;O++){fa=ia[O].object;if(fa.visible){fa.matrixAutoUpdate&&fa.updateMatrix();ra=fa.globalMatrix;ra.extractRotationMatrix(fa.matrixRotation);
+y=fa.matrixRotation;xa=fa.materials;l=fa.overdraw;if(fa instanceof THREE.Mesh){B=fa.geometry;t=B.vertices;V=0;for(la=t.length;V<la;V++){u=t[V];u.positionWorld.copy(u.position);ra.multiplyVector3(u.positionWorld);Y=u.positionScreen;Y.copy(u.positionWorld);v.multiplyVector4(Y);Y.x/=Y.w;Y.y/=Y.w;u.__visible=Y.z>aa&&Y.z<ba}B=B.faces;V=0;for(la=B.length;V<la;V++){u=B[V];if(u instanceof THREE.Face3){Y=t[u.a];ka=t[u.b];E=t[u.c];if(Y.__visible&&ka.__visible&&E.__visible&&(fa.doubleSided||fa.flipSided!=(E.positionScreen.x-
+Y.positionScreen.x)*(ka.positionScreen.y-Y.positionScreen.y)-(E.positionScreen.y-Y.positionScreen.y)*(ka.positionScreen.x-Y.positionScreen.x)<0)){g=j[k]=j[k]||new THREE.RenderableFace3;g.v1.positionWorld.copy(Y.positionWorld);g.v2.positionWorld.copy(ka.positionWorld);g.v3.positionWorld.copy(E.positionWorld);g.v1.positionScreen.copy(Y.positionScreen);g.v2.positionScreen.copy(ka.positionScreen);g.v3.positionScreen.copy(E.positionScreen);g.normalWorld.copy(u.normal);y.multiplyVector3(g.normalWorld);
+g.centroidWorld.copy(u.centroid);ra.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);E=u.vertexNormals;ea=g.vertexNormalsWorld;Y=0;for(ka=E.length;Y<ka;Y++){C=ea[Y]=ea[Y]||new THREE.Vector3;C.copy(E[Y]);y.multiplyVector3(C)}g.z=g.centroidScreen.z;g.meshMaterials=xa;g.faceMaterials=u.materials;g.overdraw=l;if(fa.geometry.uvs[V]){g.uvs[0]=fa.geometry.uvs[V][0];g.uvs[1]=fa.geometry.uvs[V][1];g.uvs[2]=fa.geometry.uvs[V][2]}S.push(g);k++}}else if(u instanceof
+THREE.Face4){Y=t[u.a];ka=t[u.b];E=t[u.c];C=t[u.d];if(Y.__visible&&ka.__visible&&E.__visible&&C.__visible&&(fa.doubleSided||fa.flipSided!=((C.positionScreen.x-Y.positionScreen.x)*(ka.positionScreen.y-Y.positionScreen.y)-(C.positionScreen.y-Y.positionScreen.y)*(ka.positionScreen.x-Y.positionScreen.x)<0||(ka.positionScreen.x-E.positionScreen.x)*(C.positionScreen.y-E.positionScreen.y)-(ka.positionScreen.y-E.positionScreen.y)*(C.positionScreen.x-E.positionScreen.x)<0))){g=j[k]=j[k]||new THREE.RenderableFace3;
+g.v1.positionWorld.copy(Y.positionWorld);g.v2.positionWorld.copy(ka.positionWorld);g.v3.positionWorld.copy(C.positionWorld);g.v1.positionScreen.copy(Y.positionScreen);g.v2.positionScreen.copy(ka.positionScreen);g.v3.positionScreen.copy(C.positionScreen);g.normalWorld.copy(u.normal);y.multiplyVector3(g.normalWorld);g.centroidWorld.copy(u.centroid);ra.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterials=xa;
+g.faceMaterials=u.materials;g.overdraw=l;if(fa.geometry.uvs[V]){g.uvs[0]=fa.geometry.uvs[V][0];g.uvs[1]=fa.geometry.uvs[V][1];g.uvs[2]=fa.geometry.uvs[V][3]}S.push(g);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(ka.positionWorld);h.v2.positionWorld.copy(E.positionWorld);h.v3.positionWorld.copy(C.positionWorld);h.v1.positionScreen.copy(ka.positionScreen);h.v2.positionScreen.copy(E.positionScreen);h.v3.positionScreen.copy(C.positionScreen);h.normalWorld.copy(g.normalWorld);h.centroidWorld.copy(g.centroidWorld);
+h.centroidScreen.copy(g.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=xa;h.faceMaterials=u.materials;h.overdraw=l;if(fa.geometry.uvs[V]){h.uvs[0]=fa.geometry.uvs[V][1];h.uvs[1]=fa.geometry.uvs[V][2];h.uvs[2]=fa.geometry.uvs[V][3]}S.push(h);k++}}}}else if(fa instanceof THREE.Line){I.multiply(v,ra);t=fa.geometry.vertices;u=t[0];u.positionScreen.copy(u.position);I.multiplyVector4(u.positionScreen);V=1;for(la=t.length;V<la;V++){Y=t[V];Y.positionScreen.copy(Y.position);I.multiplyVector4(Y.positionScreen);
+ka=t[V-1];M.copy(Y.positionScreen);e.copy(ka.positionScreen);if(b(M,e)){M.multiplyScalar(1/M.w);e.multiplyScalar(1/e.w);m=w[n]=w[n]||new THREE.RenderableLine;m.v1.positionScreen.copy(M);m.v2.positionScreen.copy(e);m.z=Math.max(M.z,e.z);m.materials=fa.materials;S.push(m);n++}}}else if(fa instanceof THREE.Particle){G.set(fa.position.x,fa.position.y,fa.position.z,1);v.multiplyVector4(G);G.z/=G.w;if(G.z>0&&G.z<1){q=x[p]=x[p]||new THREE.RenderableParticle;q.x=G.x/G.w;q.y=G.y/G.w;q.z=G.z;q.rotation=fa.rotation.z;
+q.scale.x=fa.scale.x*Math.abs(q.x-(G.x+P.projectionMatrix.n11)/(G.w+P.projectionMatrix.n14));q.scale.y=fa.scale.y*Math.abs(q.y-(G.y+P.projectionMatrix.n22)/(G.w+P.projectionMatrix.n24));q.materials=fa.materials;S.push(q);p++}}}}W&&S.sort(a);return S};this.unprojectVector=function(O,P){var W=THREE.Matrix4.makeInvert(P.globalMatrix);W.multiplySelf(THREE.Matrix4.makeInvert(P.projectionMatrix));W.multiplyVector3(O);return O}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;d=k;f=c/2;g=d/2};this.render=function(h,k){var j,m,n,w,q,p,x,A;a=b.projectScene(h,k);j=0;for(m=a.length;j<m;j++){q=a[j];if(q instanceof THREE.RenderableParticle){x=q.x*f+f;A=q.y*g+g;n=0;for(w=q.material.length;n<w;n++){p=q.material[n];if(p instanceof THREE.ParticleDOMMaterial){p=p.domElement;p.style.left=x+"px";p.style.top=A+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(ha){if(q!=ha)m.globalAlpha=q=ha}function b(ha){if(p!=ha){switch(ha){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}p=ha}}var c=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,j,m=f.getContext("2d"),n=new THREE.Color(0),w=0,q=1,p=0,x=null,A=null,G=1,v,I,o,M,e,ea,O,P,W,S=new THREE.Color,
+aa=new THREE.Color,ba=new THREE.Color,H=new THREE.Color,V=new THREE.Color,la,Y,ka,ia,fa,ra,xa,l,y,B=new THREE.Rectangle,t=new THREE.Rectangle,u=new THREE.Rectangle,E=!1,C=new THREE.Color,J=new THREE.Color,L=new THREE.Color,z=new THREE.Color,D=Math.PI*2,F=new THREE.Vector3,T,Q,ga,ma,sa,oa,na=16;T=document.createElement("canvas");T.width=T.height=2;Q=T.getContext("2d");Q.fillStyle="rgba(0,0,0,1)";Q.fillRect(0,0,2,2);ga=Q.getImageData(0,0,2,2);ma=ga.data;sa=document.createElement("canvas");sa.width=
+sa.height=na;oa=sa.getContext("2d");oa.translate(-na/2,-na/2);oa.scale(na,na);na--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ha,Ca){g=ha;h=Ca;k=g/2;j=h/2;f.width=g;f.height=h;B.set(-k,-j,k,j);q=1;p=0;A=x=null;G=1};this.setClearColor=function(ha,Ca){n=ha;w=Ca;t.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.setClearColorHex=function(ha,Ca){n.setHex(ha);w=Ca;t.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.clear=
+function(){m.setTransform(1,0,0,-1,k,j);if(!t.isEmpty()){t.inflate(1);t.minSelf(B);if(n.hex==0&&w==0)m.clearRect(t.getX(),t.getY(),t.getWidth(),t.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(n.r*255)+","+Math.floor(n.g*255)+","+Math.floor(n.b*255)+","+w+")";m.fillRect(t.getX(),t.getY(),t.getWidth(),t.getHeight())}t.empty()}};this.render=function(ha,Ca){function R(K){var ja,ca,U,X=K.lights;J.setRGB(0,0,0);L.setRGB(0,0,0);z.setRGB(0,0,0);K=0;for(ja=X.length;K<ja;K++){ca=
+X[K];U=ca.color;if(ca instanceof THREE.AmbientLight){J.r+=U.r;J.g+=U.g;J.b+=U.b}else if(ca instanceof THREE.DirectionalLight){L.r+=U.r;L.g+=U.g;L.b+=U.b}else if(ca instanceof THREE.PointLight){z.r+=U.r;z.g+=U.g;z.b+=U.b}}}function Ga(K,ja,ca,U){var X,qa,Da,Ea,Ia=K.lights;K=0;for(X=Ia.length;K<X;K++){qa=Ia[K];Da=qa.color;Ea=qa.intensity;if(qa instanceof THREE.DirectionalLight){qa=ca.dot(qa.position)*Ea;if(qa>0){U.r+=Da.r*qa;U.g+=Da.g*qa;U.b+=Da.b*qa}}else if(qa instanceof THREE.PointLight){F.sub(qa.position,
+ja);F.normalize();qa=ca.dot(F)*Ea;if(qa>0){U.r+=Da.r*qa;U.g+=Da.g*qa;U.b+=Da.b*qa}}}}function Ha(K,ja,ca){if(ca.opacity!=0){a(ca.opacity);b(ca.blending);var U,X,qa,Da,Ea,Ia;if(ca instanceof THREE.ParticleBasicMaterial){if(ca.map){Da=ca.map.image;Ea=Da.width>>1;Ia=Da.height>>1;X=ja.scale.x*k;qa=ja.scale.y*j;ca=X*Ea;U=qa*Ia;u.set(K.x-ca,K.y-U,K.x+ca,K.y+U);if(B.instersects(u)){m.save();m.translate(K.x,K.y);m.rotate(-ja.rotation);m.scale(X,-qa);m.translate(-Ea,-Ia);m.drawImage(Da,0,0);m.restore()}}}else if(ca instanceof
+THREE.ParticleCircleMaterial){if(E){C.r=J.r+L.r+z.r;C.g=J.g+L.g+z.g;C.b=J.b+L.b+z.b;S.r=ca.color.r*C.r;S.g=ca.color.g*C.g;S.b=ca.color.b*C.b;S.updateStyleString()}else S.__styleString=ca.color.__styleString;ca=ja.scale.x*k;U=ja.scale.y*j;u.set(K.x-ca,K.y-U,K.x+ca,K.y+U);if(B.instersects(u)){X=S.__styleString;if(A!=X)m.fillStyle=A=X;m.save();m.translate(K.x,K.y);m.rotate(-ja.rotation);m.scale(ca,U);m.beginPath();m.arc(0,0,1,0,D,!0);m.closePath();m.fill();m.restore()}}}}function La(K,ja,ca,U){if(U.opacity!=
+0){a(U.opacity);b(U.blending);m.beginPath();m.moveTo(K.positionScreen.x,K.positionScreen.y);m.lineTo(ja.positionScreen.x,ja.positionScreen.y);m.closePath();if(U instanceof THREE.LineBasicMaterial){S.__styleString=U.color.__styleString;K=U.linewidth;if(G!=K)m.lineWidth=G=K;K=S.__styleString;if(x!=K)m.strokeStyle=x=K;m.stroke();u.inflate(U.linewidth*2)}}}function da(K,ja,ca,U,X,qa){if(X.opacity!=0){a(X.opacity);b(X.blending);M=K.positionScreen.x;e=K.positionScreen.y;ea=ja.positionScreen.x;O=ja.positionScreen.y;
+P=ca.positionScreen.x;W=ca.positionScreen.y;m.beginPath();m.moveTo(M,e);m.lineTo(ea,O);m.lineTo(P,W);m.lineTo(M,e);m.closePath();if(X instanceof THREE.MeshBasicMaterial)if(X.map)X.map.mapping instanceof THREE.UVMapping&&ta(M,e,ea,O,P,W,X.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);else if(X.env_map){if(X.env_map.mapping instanceof THREE.SphericalReflectionMapping){K=Ca.globalMatrix;F.copy(U.vertexNormalsWorld[0]);ia=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;fa=-(F.x*
+K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;F.copy(U.vertexNormalsWorld[1]);ra=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;xa=-(F.x*K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;F.copy(U.vertexNormalsWorld[2]);l=(F.x*K.n11+F.y*K.n12+F.z*K.n13)*0.5+0.5;y=-(F.x*K.n21+F.y*K.n22+F.z*K.n23)*0.5+0.5;ta(M,e,ea,O,P,W,X.env_map.image,ia,fa,ra,xa,l,y)}}else X.wireframe?Z(X.color.__styleString,X.wireframe_linewidth):$(X.color.__styleString);else if(X instanceof THREE.MeshLambertMaterial){if(X.map&&!X.wireframe){X.map.mapping instanceof
+THREE.UVMapping&&ta(M,e,ea,O,P,W,X.map.image,U.uvs[0].u,U.uvs[0].v,U.uvs[1].u,U.uvs[1].v,U.uvs[2].u,U.uvs[2].v);b(THREE.SubtractiveBlending)}if(E)if(!X.wireframe&&X.shading==THREE.SmoothShading&&U.vertexNormalsWorld.length==3){aa.r=ba.r=H.r=J.r;aa.g=ba.g=H.g=J.g;aa.b=ba.b=H.b=J.b;Ga(qa,U.v1.positionWorld,U.vertexNormalsWorld[0],aa);Ga(qa,U.v2.positionWorld,U.vertexNormalsWorld[1],ba);Ga(qa,U.v3.positionWorld,U.vertexNormalsWorld[2],H);V.r=(ba.r+H.r)*0.5;V.g=(ba.g+H.g)*0.5;V.b=(ba.b+H.b)*0.5;ka=Ja(aa,
+ba,H,V);ta(M,e,ea,O,P,W,ka,0,0,1,0,0,1)}else{C.r=J.r;C.g=J.g;C.b=J.b;Ga(qa,U.centroidWorld,U.normalWorld,C);S.r=X.color.r*C.r;S.g=X.color.g*C.g;S.b=X.color.b*C.b;S.updateStyleString();X.wireframe?Z(S.__styleString,X.wireframe_linewidth):$(S.__styleString)}else X.wireframe?Z(X.color.__styleString,X.wireframe_linewidth):$(X.color.__styleString)}else if(X instanceof THREE.MeshDepthMaterial){la=Ca.near;Y=Ca.far;aa.r=aa.g=aa.b=1-Aa(K.positionScreen.z,la,Y);ba.r=ba.g=ba.b=1-Aa(ja.positionScreen.z,la,Y);
+H.r=H.g=H.b=1-Aa(ca.positionScreen.z,la,Y);V.r=(ba.r+H.r)*0.5;V.g=(ba.g+H.g)*0.5;V.b=(ba.b+H.b)*0.5;ka=Ja(aa,ba,H,V);ta(M,e,ea,O,P,W,ka,0,0,1,0,0,1)}else if(X instanceof THREE.MeshNormalMaterial){S.r=N(U.normalWorld.x);S.g=N(U.normalWorld.y);S.b=N(U.normalWorld.z);S.updateStyleString();X.wireframe?Z(S.__styleString,X.wireframe_linewidth):$(S.__styleString)}}}function Z(K,ja){if(x!=K)m.strokeStyle=x=K;if(G!=ja)m.lineWidth=G=ja;m.stroke();u.inflate(ja*2)}function $(K){if(A!=K)m.fillStyle=A=K;m.fill()}
+function ta(K,ja,ca,U,X,qa,Da,Ea,Ia,Ma,Ka,Fa,Sa){var Na,Oa;Na=Da.width-1;Oa=Da.height-1;Ea*=Na;Ia*=Oa;Ma*=Na;Ka*=Oa;Fa*=Na;Sa*=Oa;ca-=K;U-=ja;X-=K;qa-=ja;Ma-=Ea;Ka-=Ia;Fa-=Ea;Sa-=Ia;Na=Ma*Sa-Fa*Ka;if(Na!=0){Oa=1/Na;Na=(Sa*ca-Ka*X)*Oa;Ka=(Sa*U-Ka*qa)*Oa;ca=(Ma*X-Fa*ca)*Oa;U=(Ma*qa-Fa*U)*Oa;K=K-Na*Ea-ca*Ia;ja=ja-Ka*Ea-U*Ia;m.save();m.transform(Na,Ka,ca,U,K,ja);m.clip();m.drawImage(Da,0,0);m.restore()}}function Ja(K,ja,ca,U){var X=~~(K.r*255),qa=~~(K.g*255);K=~~(K.b*255);var Da=~~(ja.r*255),Ea=~~(ja.g*
+255);ja=~~(ja.b*255);var Ia=~~(ca.r*255),Ma=~~(ca.g*255);ca=~~(ca.b*255);var Ka=~~(U.r*255),Fa=~~(U.g*255);U=~~(U.b*255);ma[0]=X<0?0:X>255?255:X;ma[1]=qa<0?0:qa>255?255:qa;ma[2]=K<0?0:K>255?255:K;ma[4]=Da<0?0:Da>255?255:Da;ma[5]=Ea<0?0:Ea>255?255:Ea;ma[6]=ja<0?0:ja>255?255:ja;ma[8]=Ia<0?0:Ia>255?255:Ia;ma[9]=Ma<0?0:Ma>255?255:Ma;ma[10]=ca<0?0:ca>255?255:ca;ma[12]=Ka<0?0:Ka>255?255:Ka;ma[13]=Fa<0?0:Fa>255?255:Fa;ma[14]=U<0?0:U>255?255:U;Q.putImageData(ga,0,0);oa.drawImage(T,0,0);return sa}function Aa(K,
+ja,ca){K=(K-ja)/(ca-ja);return K*K*(3-2*K)}function N(K){K=(K+1)*0.5;return K<0?0:K>1?1:K}function Ba(K,ja){var ca=ja.x-K.x,U=ja.y-K.y,X=1/Math.sqrt(ca*ca+U*U);ca*=X;U*=X;ja.x+=ca;ja.y+=U;K.x-=ca;K.y-=U}var Pa,Ta,ua,pa,za,wa,ya,va;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=d.projectScene(ha,Ca,this.sortElements);(E=ha.lights.length>0)&&R(ha);Pa=0;for(Ta=c.length;Pa<Ta;Pa++){ua=c[Pa];u.empty();if(ua instanceof THREE.RenderableParticle){v=ua;v.x*=k;v.y*=j;pa=0;for(za=ua.materials.length;pa<
+za;pa++)Ha(v,ua,ua.materials[pa],ha)}else if(ua instanceof THREE.RenderableLine){v=ua.v1;I=ua.v2;v.positionScreen.x*=k;v.positionScreen.y*=j;I.positionScreen.x*=k;I.positionScreen.y*=j;u.addPoint(v.positionScreen.x,v.positionScreen.y);u.addPoint(I.positionScreen.x,I.positionScreen.y);if(B.instersects(u)){pa=0;for(za=ua.materials.length;pa<za;)La(v,I,ua,ua.materials[pa++],ha)}}else if(ua instanceof THREE.RenderableFace3){v=ua.v1;I=ua.v2;o=ua.v3;v.positionScreen.x*=k;v.positionScreen.y*=j;I.positionScreen.x*=
+k;I.positionScreen.y*=j;o.positionScreen.x*=k;o.positionScreen.y*=j;if(ua.overdraw){Ba(v.positionScreen,I.positionScreen);Ba(I.positionScreen,o.positionScreen);Ba(o.positionScreen,v.positionScreen)}u.add3Points(v.positionScreen.x,v.positionScreen.y,I.positionScreen.x,I.positionScreen.y,o.positionScreen.x,o.positionScreen.y);if(B.instersects(u)){pa=0;for(za=ua.meshMaterials.length;pa<za;){va=ua.meshMaterials[pa++];if(va instanceof THREE.MeshFaceMaterial){wa=0;for(ya=ua.faceMaterials.length;wa<ya;)(va=
+ua.faceMaterials[wa++])&&da(v,I,o,ua,va,ha)}else da(v,I,o,ua,va,ha)}}}t.addRectangle(u)}m.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(ia,fa,ra){var xa,l,y,B;xa=0;for(l=ia.lights.length;xa<l;xa++){y=ia.lights[xa];if(y instanceof THREE.DirectionalLight){B=fa.normalWorld.dot(y.position)*y.intensity;if(B>0){ra.r+=y.color.r*B;ra.g+=y.color.g*B;ra.b+=y.color.b*B}}else if(y instanceof THREE.PointLight){W.sub(y.position,fa.centroidWorld);W.normalize();B=fa.normalWorld.dot(W)*y.intensity;if(B>0){ra.r+=y.color.r*B;ra.g+=y.color.g*B;ra.b+=y.color.b*B}}}}function b(ia,fa,ra,xa,l,y){H=d(V++);H.setAttribute("d",
+"M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+"z");if(l instanceof THREE.MeshBasicMaterial)o.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshLambertMaterial)if(I){M.r=e.r;M.g=e.g;M.b=e.b;a(y,xa,M);o.r=l.color.r*M.r;o.g=l.color.g*M.g;o.b=l.color.b*M.b;o.updateStyleString()}else o.__styleString=l.color.__styleString;else if(l instanceof THREE.MeshDepthMaterial){P=1-l.__2near/(l.__farPlusNear-
+xa.z*l.__farMinusNear);o.setRGB(P,P,P)}else l instanceof THREE.MeshNormalMaterial&&o.setRGB(f(xa.normalWorld.x),f(xa.normalWorld.y),f(xa.normalWorld.z));l.wireframe?H.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+l.wireframe_linewidth+"; stroke-opacity: "+l.opacity+"; stroke-linecap: "+l.wireframe_linecap+"; stroke-linejoin: "+l.wireframe_linejoin):H.setAttribute("style","fill: "+o.__styleString+"; fill-opacity: "+l.opacity);k.appendChild(H)}function c(ia,fa,ra,xa,
+l,y,B){H=d(V++);H.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+fa.positionScreen.x+" "+fa.positionScreen.y+" L "+ra.positionScreen.x+","+ra.positionScreen.y+" L "+xa.positionScreen.x+","+xa.positionScreen.y+"z");if(y instanceof THREE.MeshBasicMaterial)o.__styleString=y.color.__styleString;else if(y instanceof THREE.MeshLambertMaterial)if(I){M.r=e.r;M.g=e.g;M.b=e.b;a(B,l,M);o.r=y.color.r*M.r;o.g=y.color.g*M.g;o.b=y.color.b*M.b;o.updateStyleString()}else o.__styleString=y.color.__styleString;
+else if(y instanceof THREE.MeshDepthMaterial){P=1-y.__2near/(y.__farPlusNear-l.z*y.__farMinusNear);o.setRGB(P,P,P)}else y instanceof THREE.MeshNormalMaterial&&o.setRGB(f(l.normalWorld.x),f(l.normalWorld.y),f(l.normalWorld.z));y.wireframe?H.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+y.wireframe_linewidth+"; stroke-opacity: "+y.opacity+"; stroke-linecap: "+y.wireframe_linecap+"; stroke-linejoin: "+y.wireframe_linejoin):H.setAttribute("style","fill: "+o.__styleString+
+"; fill-opacity: "+y.opacity);k.appendChild(H)}function d(ia){if(S[ia]==null){S[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");ka==0&&S[ia].setAttribute("shape-rendering","crispEdges")}return S[ia]}function f(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,n,w,q,p,x,A,G=new THREE.Rectangle,v=new THREE.Rectangle,I=!1,o=new THREE.Color(16777215),M=new THREE.Color(16777215),
+e=new THREE.Color(0),ea=new THREE.Color(0),O=new THREE.Color(0),P,W=new THREE.Vector3,S=[],aa=[],ba=[],H,V,la,Y,ka=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":ka=1;break;case "low":ka=0}};this.setSize=function(ia,fa){j=ia;m=fa;n=j/2;w=m/2;k.setAttribute("viewBox",-n+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);G.set(-n,-w,n,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
+this.render=function(ia,fa){var ra,xa,l,y,B,t,u,E;this.autoClear&&this.clear();g=h.projectScene(ia,fa,this.sortElements);Y=la=V=0;if(I=ia.lights.length>0){u=ia.lights;e.setRGB(0,0,0);ea.setRGB(0,0,0);O.setRGB(0,0,0);ra=0;for(xa=u.length;ra<xa;ra++){l=u[ra];y=l.color;if(l instanceof THREE.AmbientLight){e.r+=y.r;e.g+=y.g;e.b+=y.b}else if(l instanceof THREE.DirectionalLight){ea.r+=y.r;ea.g+=y.g;ea.b+=y.b}else if(l instanceof THREE.PointLight){O.r+=y.r;O.g+=y.g;O.b+=y.b}}}ra=0;for(xa=g.length;ra<xa;ra++){u=
+g[ra];v.empty();if(u instanceof THREE.RenderableParticle){q=u;q.x*=n;q.y*=-w;l=0;for(y=u.materials.length;l<y;l++)if(E=u.materials[l]){B=q;t=u;var C=la++;if(aa[C]==null){aa[C]=document.createElementNS("http://www.w3.org/2000/svg","circle");ka==0&&aa[C].setAttribute("shape-rendering","crispEdges")}H=aa[C];H.setAttribute("cx",B.x);H.setAttribute("cy",B.y);H.setAttribute("r",t.scale.x*n);if(E instanceof THREE.ParticleCircleMaterial){if(I){M.r=e.r+ea.r+O.r;M.g=e.g+ea.g+O.g;M.b=e.b+ea.b+O.b;o.r=E.color.r*
+M.r;o.g=E.color.g*M.g;o.b=E.color.b*M.b;o.updateStyleString()}else o=E.color;H.setAttribute("style","fill: "+o.__styleString)}k.appendChild(H)}}else if(u instanceof THREE.RenderableLine){q=u.v1;p=u.v2;q.positionScreen.x*=n;q.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;v.addPoint(q.positionScreen.x,q.positionScreen.y);v.addPoint(p.positionScreen.x,p.positionScreen.y);if(G.instersects(v)){l=0;for(y=u.materials.length;l<y;)if(E=u.materials[l++]){B=q;t=p;C=Y++;if(ba[C]==null){ba[C]=
+document.createElementNS("http://www.w3.org/2000/svg","line");ka==0&&ba[C].setAttribute("shape-rendering","crispEdges")}H=ba[C];H.setAttribute("x1",B.positionScreen.x);H.setAttribute("y1",B.positionScreen.y);H.setAttribute("x2",t.positionScreen.x);H.setAttribute("y2",t.positionScreen.y);if(E instanceof THREE.LineBasicMaterial){o.__styleString=E.color.__styleString;H.setAttribute("style","fill: none; stroke: "+o.__styleString+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+
+E.linecap+"; stroke-linejoin: "+E.linejoin);k.appendChild(H)}}}}else if(u instanceof THREE.RenderableFace3){q=u.v1;p=u.v2;x=u.v3;q.positionScreen.x*=n;q.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;x.positionScreen.x*=n;x.positionScreen.y*=-w;v.addPoint(q.positionScreen.x,q.positionScreen.y);v.addPoint(p.positionScreen.x,p.positionScreen.y);v.addPoint(x.positionScreen.x,x.positionScreen.y);if(G.instersects(v)){l=0;for(y=u.meshMaterials.length;l<y;){E=u.meshMaterials[l++];if(E instanceof
+THREE.MeshFaceMaterial){B=0;for(t=u.faceMaterials.length;B<t;)(E=u.faceMaterials[B++])&&b(q,p,x,u,E,ia)}else E&&b(q,p,x,u,E,ia)}}}else if(u instanceof THREE.RenderableFace4){q=u.v1;p=u.v2;x=u.v3;A=u.v4;q.positionScreen.x*=n;q.positionScreen.y*=-w;p.positionScreen.x*=n;p.positionScreen.y*=-w;x.positionScreen.x*=n;x.positionScreen.y*=-w;A.positionScreen.x*=n;A.positionScreen.y*=-w;v.addPoint(q.positionScreen.x,q.positionScreen.y);v.addPoint(p.positionScreen.x,p.positionScreen.y);v.addPoint(x.positionScreen.x,
+x.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(G.instersects(v)){l=0;for(y=u.meshMaterials.length;l<y;){E=u.meshMaterials[l++];if(E instanceof THREE.MeshFaceMaterial){B=0;for(t=u.faceMaterials.length;B<t;)(E=u.faceMaterials[B++])&&c(q,p,x,A,u,E,ia)}else E&&c(q,p,x,A,u,E,ia)}}}}}};
+THREE.WebGLRenderer=function(a){function b(l,y,B){var t,u,E,C=l.vertices,J=C.length,L=l.colors,z=L.length,D=l.__vertexArray,F=l.__colorArray,T=l.__sortArray,Q=l.__dirtyVertices,ga=l.__dirtyColors;if(B.sortParticles){V.multiplySelf(B.globalMatrix);for(t=0;t<J;t++){u=C[t].position;ia.copy(u);V.multiplyVector3(ia);T[t]=[ia.z,t]}T.sort(function(ma,sa){return sa[0]-ma[0]});for(t=0;t<J;t++){u=C[T[t][1]].position;E=t*3;D[E]=u.x;D[E+1]=u.y;D[E+2]=u.z}for(t=0;t<z;t++){E=t*3;color=L[T[t][1]];F[E]=color.r;F[E+
+1]=color.g;F[E+2]=color.b}}else{if(Q)for(t=0;t<J;t++){u=C[t].position;E=t*3;D[E]=u.x;D[E+1]=u.y;D[E+2]=u.z}if(ga)for(t=0;t<z;t++){color=L[t];E=t*3;F[E]=color.r;F[E+1]=color.g;F[E+2]=color.b}}if(Q||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,D,y)}if(ga||B.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,F,y)}}function c(l,y){l.fragment_shader=y.fragment_shader;l.vertex_shader=y.vertex_shader;l.uniforms=
+Uniforms.clone(y.uniforms)}function d(l,y,B,t,u){t.program||P.initMaterial(t,y,B);var E=t.program,C=E.uniforms,J=t.uniforms;if(E!=ea){e.useProgram(E);ea=E;e.uniformMatrix4fv(C.projectionMatrix,!1,la)}if(B&&(t instanceof THREE.MeshBasicMaterial||t instanceof THREE.MeshLambertMaterial||t instanceof THREE.MeshPhongMaterial||t instanceof THREE.LineBasicMaterial||t instanceof THREE.ParticleBasicMaterial)){J.fogColor.value.setHex(B.color.hex);if(B instanceof THREE.Fog){J.fogNear.value=B.near;J.fogFar.value=
+B.far}else if(B instanceof THREE.FogExp2)J.fogDensity.value=B.density}if(t instanceof THREE.MeshPhongMaterial||t instanceof THREE.MeshLambertMaterial){var L,z,D=0,F=0,T=0,Q,ga,ma,sa=P.lights,oa=sa.directional.colors,na=sa.directional.positions,ha=sa.point.colors,Ca=sa.point.positions,R=0,Ga=0;B=z=z=0;for(L=y.length;B<L;B++){z=y[B];Q=z.color;ga=z.position;ma=z.intensity;if(z instanceof THREE.AmbientLight){D+=Q.r;F+=Q.g;T+=Q.b}else if(z instanceof THREE.DirectionalLight){z=R*3;oa[z]=Q.r*ma;oa[z+1]=
+Q.g*ma;oa[z+2]=Q.b*ma;na[z]=ga.x;na[z+1]=ga.y;na[z+2]=ga.z;R+=1}else if(z instanceof THREE.PointLight){z=Ga*3;ha[z]=Q.r*ma;ha[z+1]=Q.g*ma;ha[z+2]=Q.b*ma;Ca[z]=ga.x;Ca[z+1]=ga.y;Ca[z+2]=ga.z;Ga+=1}}for(B=R*3;B<oa.length;B++)oa[B]=0;for(B=Ga*3;B<ha.length;B++)ha[B]=0;sa.point.length=Ga;sa.directional.length=R;sa.ambient[0]=D;sa.ambient[1]=F;sa.ambient[2]=T;y=P.lights;J.enableLighting.value=y.directional.length+y.point.length;J.ambientLightColor.value=y.ambient;J.directionalLightColor.value=y.directional.colors;
+J.directionalLightDirection.value=y.directional.positions;J.pointLightColor.value=y.point.colors;J.pointLightPosition.value=y.point.positions}if(t instanceof THREE.MeshBasicMaterial||t instanceof THREE.MeshLambertMaterial||t instanceof THREE.MeshPhongMaterial){J.diffuse.value.setRGB(t.color.r*t.opacity,t.color.g*t.opacity,t.color.b*t.opacity);J.opacity.value=t.opacity;J.map.texture=t.map;J.light_map.texture=t.light_map;J.env_map.texture=t.env_map;J.reflectivity.value=t.reflectivity;J.refraction_ratio.value=
+t.refraction_ratio;J.combine.value=t.combine;J.useRefract.value=t.env_map&&t.env_map.mapping instanceof THREE.CubeRefractionMapping}if(t instanceof THREE.LineBasicMaterial){J.diffuse.value.setRGB(t.color.r*t.opacity,t.color.g*t.opacity,t.color.b*t.opacity);J.opacity.value=t.opacity}else if(t instanceof THREE.ParticleBasicMaterial){J.psColor.value.setRGB(t.color.r*t.opacity,t.color.g*t.opacity,t.color.b*t.opacity);J.opacity.value=t.opacity;J.size.value=t.size;J.map.texture=t.map}else if(t instanceof
+THREE.MeshPhongMaterial){J.ambient.value.setRGB(t.ambient.r,t.ambient.g,t.ambient.b);J.specular.value.setRGB(t.specular.r,t.specular.g,t.specular.b);J.shininess.value=t.shininess}else if(t instanceof THREE.MeshDepthMaterial){J.mNear.value=l.zNear;J.mFar.value=l.zFar;J.opacity.value=t.opacity}else if(t instanceof THREE.MeshNormalMaterial)J.opacity.value=t.opacity;for(var Ha in J)if(D=E.uniforms[Ha]){B=J[Ha];L=B.type;y=B.value;if(L=="i")e.uniform1i(D,y);else if(L=="f")e.uniform1f(D,y);else if(L=="fv1")e.uniform1fv(D,
+y);else if(L=="fv")e.uniform3fv(D,y);else if(L=="v2")e.uniform2f(D,y.x,y.y);else if(L=="v3")e.uniform3f(D,y.x,y.y,y.z);else if(L=="c")e.uniform3f(D,y.r,y.g,y.b);else if(L=="t"){e.uniform1i(D,y);if(B=B.texture)if(B.image instanceof Array&&B.image.length==6){if(B.image.length==6){if(B.needsUpdate){if(!B.image.__webGLTextureCube)B.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,B.image.__webGLTextureCube);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);
+e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR);for(L=0;L<6;++L)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+L,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,B.image[L]);e.generateMipmap(e.TEXTURE_CUBE_MAP);e.bindTexture(e.TEXTURE_CUBE_MAP,null);B.needsUpdate=!1}e.activeTexture(e.TEXTURE0+y);e.bindTexture(e.TEXTURE_CUBE_MAP,B.image.__webGLTextureCube)}}else{if(B.needsUpdate){if(B.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,
+B.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,B.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o(B.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o(B.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o(B.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,o(B.min_filter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}else{B.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);e.texImage2D(e.TEXTURE_2D,
+0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,B.image);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o(B.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o(B.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o(B.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,o(B.min_filter));e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null);B.__wasSetOnce=!0}B.needsUpdate=!1}e.activeTexture(e.TEXTURE0+y);e.bindTexture(e.TEXTURE_2D,B.__webGLTexture)}}}e.uniformMatrix4fv(C.modelViewMatrix,
+!1,u._modelViewMatrixArray);e.uniformMatrix3fv(C.normalMatrix,!1,u._normalMatrixArray);(t instanceof THREE.MeshShaderMaterial||t instanceof THREE.MeshPhongMaterial||t.env_map)&&e.uniform3f(C.cameraPosition,l.position.x,l.position.y,l.position.z);(t instanceof THREE.MeshShaderMaterial||t.env_map||t.skinning)&&e.uniformMatrix4fv(C.objectMatrix,!1,u._objectMatrixArray);(t instanceof THREE.MeshPhongMaterial||t instanceof THREE.MeshLambertMaterial||t instanceof THREE.MeshShaderMaterial||t.skinning)&&e.uniformMatrix4fv(C.viewMatrix,
+!1,ka);if(t.skinning){e.uniformMatrix4fv(C.cameraInverseMatrix,!1,Y);e.uniformMatrix4fv(C.boneGlobalMatrices,!1,u.boneMatrices)}return E}function f(l,y,B,t,u,E){l=d(l,y,B,t,E).attributes;e.bindBuffer(e.ARRAY_BUFFER,u.__webGLVertexBuffer);e.vertexAttribPointer(l.position,3,e.FLOAT,!1,0,0);if(l.color>=0){e.bindBuffer(e.ARRAY_BUFFER,u.__webGLColorBuffer);e.vertexAttribPointer(l.color,3,e.FLOAT,!1,0,0)}if(l.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,u.__webGLNormalBuffer);e.vertexAttribPointer(l.normal,3,
+e.FLOAT,!1,0,0)}if(l.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,u.__webGLTangentBuffer);e.vertexAttribPointer(l.tangent,4,e.FLOAT,!1,0,0)}if(l.uv>=0)if(u.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,u.__webGLUVBuffer);e.vertexAttribPointer(l.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv)}else e.disableVertexAttribArray(l.uv);if(l.uv2>=0)if(u.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,u.__webGLUV2Buffer);e.vertexAttribPointer(l.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(l.uv2)}else e.disableVertexAttribArray(l.uv2);
+if(t.skinning&&l.skinVertexA>=0&&l.skinVertexB>=0&&l.skinIndex>=0&&l.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,u.__webGLSkinVertexABuffer);e.vertexAttribPointer(l.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,u.__webGLSkinVertexBBuffer);e.vertexAttribPointer(l.skinVertexB,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,u.__webGLSkinIndicesBuffer);e.vertexAttribPointer(l.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,u.__webGLSkinWeightsBuffer);e.vertexAttribPointer(l.skinWeight,
+4,e.FLOAT,!1,0,0)}if(E instanceof THREE.Mesh)if(t.wireframe){e.lineWidth(t.wireframe_linewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u.__webGLLineBuffer);e.drawElements(e.LINES,u.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,u.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,u.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(E instanceof THREE.Line){E=E.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(t.linewidth);e.drawArrays(E,0,u.__webGLLineCount)}else if(E instanceof
+THREE.ParticleSystem)e.drawArrays(e.POINTS,0,u.__webGLParticleCount);else E instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,u.__webGLVertexCount)}function g(l,y){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=e.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=e.createBuffer();if(l.hasPos){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,l.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(y.attributes.position);e.vertexAttribPointer(y.attributes.position,
+3,e.FLOAT,!1,0,0)}if(l.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,l.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,l.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(y.attributes.normal);e.vertexAttribPointer(y.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,l.count);l.count=0}function h(l){if(W!=l.doubleSided){l.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);W=l.doubleSided}if(S!=l.flipSided){l.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);S=l.flipSided}}function k(l){if(ba!=
+l){l?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ba=l}}function j(l){H[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);H[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+l.n14);H[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);H[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);H[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);H[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var y;for(l=0;l<6;l++){y=H[l];y.divideScalar(Math.sqrt(y.x*y.x+y.y*y.y+y.z*y.z))}}
+function m(l){for(var y=l.globalMatrix,B=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),t=0;t<6;t++){l=H[t].x*y.n14+H[t].y*y.n24+H[t].z*y.n34+H[t].w;if(l<=B)return!1}return!0}function n(l,y){l.list[l.count]=y;l.count+=1}function w(l){var y,B,t=l.object,u=l.opaque,E=l.transparent;E.count=0;l=u.count=0;for(y=t.materials.length;l<y;l++){B=t.materials[l];B.opacity&&B.opacity<1||B.blending!=THREE.NormalBlending?n(E,B):n(u,B)}}function q(l){var y,B,t,u,E=l.object,C=
+l.buffer,J=l.opaque,L=l.transparent;L.count=0;l=J.count=0;for(t=E.materials.length;l<t;l++){y=E.materials[l];if(y instanceof THREE.MeshFaceMaterial){y=0;for(B=C.materials.length;y<B;y++)(u=C.materials[y])&&(u.opacity&&u.opacity<1||u.blending!=THREE.NormalBlending?n(L,u):n(J,u))}else{u=y;u.opacity&&u.opacity<1||u.blending!=THREE.NormalBlending?n(L,u):n(J,u)}}}function p(l,y){return y.z-l.z}function x(l,y,B,t,u){if(y[B]==undefined){l.push({buffer:t,object:u,opaque:{list:[],count:0},transparent:{list:[],
+count:0}});y[B]=1}}function A(l,y){l._modelViewMatrix.multiplyToArray(y.globalMatrix,l.globalMatrix,l._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}function G(l){if(l!=aa){switch(l){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);
+break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}aa=l}}function v(l,y){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=e.createFramebuffer();l.__webGLRenderbuffer=e.createRenderbuffer();l.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,l.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,l.width,l.height);e.bindTexture(e.TEXTURE_2D,
+l.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,o(l.wrap_s));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,o(l.wrap_t));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,o(l.mag_filter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,o(l.min_filter));e.texImage2D(e.TEXTURE_2D,0,o(l.format),l.width,l.height,0,o(l.format),o(l.type),null);e.bindFramebuffer(e.FRAMEBUFFER,l.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,l.__webGLTexture,0);
+e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,l.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var B,t,u;if(l){B=l.__webGLFramebuffer;t=l.width;u=l.height}else{B=null;t=M.width;u=M.height}if(B!=O){e.bindFramebuffer(e.FRAMEBUFFER,B);e.viewport(0,0,t,u);y&&e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);O=B}}function I(l,y){var B;if(l=="fragment")B=e.createShader(e.FRAGMENT_SHADER);else l==
+"vertex"&&(B=e.createShader(e.VERTEX_SHADER));e.shaderSource(B,y);e.compileShader(B);if(!e.getShaderParameter(B,e.COMPILE_STATUS)){alert(e.getShaderInfoLog(B));return null}return B}function o(l){switch(l){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;
 case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;
 case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;
-case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var J=document.createElement("canvas"),e,aa=null,L=null,M=this,V=null,S=null,Y=null,Z=null,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],U=new THREE.Matrix4,na=new Float32Array(16),W=new Float32Array(16),ka=new Float32Array(16),ha=new THREE.Vector4,da=!0,
-ra=new THREE.Color(0),ya=0;if(a){if(a.antialias!==undefined)da=a.antialias;a.clearColor!==undefined&&ra.setHex(a.clearColor);if(a.clearAlpha!==undefined)ya=a.clearAlpha}this.domElement=J;this.autoClear=!0;this.sortObjects=!1;(function(l,z,B){try{e=J.getContext("experimental-webgl",{antialias:l})}catch(p){console.log(p)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);
-e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(z.r,z.g,z.b,B);_cullEnabled=!0})(da,ra,ya);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,z){J.width=l;J.height=z;e.viewport(0,0,J.width,J.height)};this.setClearColorHex=function(l,z){var B=new THREE.Color(l);e.clearColor(B.r,B.g,B.b,z)};this.setClearColor=function(l,z){e.clearColor(l.r,l.g,l.b,z)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|
-e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,z,B){var p,n;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof
-THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var C,H,N,ba;n=N=ba=0;for(C=z.length;n<C;n++){H=z[n];H instanceof THREE.DirectionalLight&&N++;H instanceof THREE.PointLight&&ba++}if(ba+N<=4)z=N;else{z=Math.ceil(4*N/(ba+N));ba=4-z}n={directional:z,point:ba};ba=l.fragment_shader;z=l.vertex_shader;C={fog:B,map:l.map,env_map:l.env_map,light_map:l.light_map,vertex_colors:l.vertex_colors,skinning:l.skinning,maxDirLights:n.directional,maxPointLights:n.point};B=e.createProgram();n=["#ifdef GL_ES\nprecision highp float;\n#endif",
-"#define MAX_DIR_LIGHTS "+C.maxDirLights,"#define MAX_POINT_LIGHTS "+C.maxPointLights,C.fog?"#define USE_FOG":"",C.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",C.map?"#define USE_MAP":"",C.env_map?"#define USE_ENVMAP":"",C.light_map?"#define USE_LIGHTMAP":"",C.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");C=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+C.maxDirLights,"#define MAX_POINT_LIGHTS "+
-C.maxPointLights,C.map?"#define USE_MAP":"",C.env_map?"#define USE_ENVMAP":"",C.light_map?"#define USE_LIGHTMAP":"",C.vertex_colors?"#define USE_COLOR":"",C.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
-e.attachShader(B,I("fragment",n+ba));e.attachShader(B,I("vertex",C+z));e.linkProgram(B);e.getProgramParameter(B,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(B,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");B.uniforms={};B.attributes={};l.program=B;B=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(p in l.uniforms)B.push(p);p=l.program;ba=0;for(z=B.length;ba<
-z;ba++){n=B[ba];p.uniforms[n]=e.getUniformLocation(p,n)}p=l.program;B=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];ba=0;for(z=B.length;ba<z;ba++){n=B[ba];p.attributes[n]=e.getAttribLocation(p,n)}p=l.program.attributes;e.enableVertexAttribArray(p.position);p.color>=0&&e.enableVertexAttribArray(p.color);p.normal>=0&&e.enableVertexAttribArray(p.normal);p.tangent>=0&&e.enableVertexAttribArray(p.tangent);if(l.skinning&&p.skinVertexA>=0&&p.skinVertexB>=
-0&&p.skinIndex>=0&&p.skinWeight>=0){e.enableVertexAttribArray(p.skinVertexA);e.enableVertexAttribArray(p.skinVertexB);e.enableVertexAttribArray(p.skinIndex);e.enableVertexAttribArray(p.skinWeight)}};this.render=function(l,z,B,p){var n,C,H,N,ba,y,E,D,P=l.lights,T=l.fog;z.matrixAutoUpdate&&z.update();z.globalMatrix.flattenToArray(ka);z.projectionMatrix.flattenToArray(na);z.inverseMatrix.flattenToArray(W);U.multiply(z.projectionMatrix,z.globalMatrix);j(U);THREE.AnimationHandler&&THREE.AnimationHandler.update();
-l.update(undefined,!1,z);this.initWebGLObjects(l,z);v(B,p!==undefined?p:!0);this.autoClear&&this.clear();ba=l.__webGLObjects.length;for(p=0;p<ba;p++){n=l.__webGLObjects[p];E=n.object;if(E.visible)if(!(E instanceof THREE.Mesh)||m(E)){E.globalMatrix.flattenToArray(E._objectMatrixArray);A(E,z);u(n);n.render=!0;if(this.sortObjects){ha.copy(E.position);U.multiplyVector3(ha);n.z=ha.z}}else n.render=!1;else n.render=!1}this.sortObjects&&l.__webGLObjects.sort(t);y=l.__webGLObjectsImmediate.length;for(p=0;p<
-y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){E.matrixAutoUpdate&&E.globalMatrix.flattenToArray(E._objectMatrixArray);A(E,z);w(n)}}F(THREE.NormalBlending);for(p=0;p<ba;p++){n=l.__webGLObjects[p];if(n.render){E=n.object;D=n.buffer;H=n.opaque;h(E);for(n=0;n<H.count;n++){N=H.list[n];k(N.depth_test);f(z,P,T,N,D,E)}}}for(p=0;p<y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){H=n.opaque;h(E);for(n=0;n<H.count;n++){N=H.list[n];k(N.depth_test);C=d(z,P,T,N,E);E.render(function(oa){g(oa,
-C)})}}}for(p=0;p<ba;p++){n=l.__webGLObjects[p];if(n.render){E=n.object;D=n.buffer;H=n.transparent;h(E);for(n=0;n<H.count;n++){N=H.list[n];F(N.blending);k(N.depth_test);f(z,P,T,N,D,E)}}}for(p=0;p<y;p++){n=l.__webGLObjectsImmediate[p];E=n.object;if(E.visible){H=n.transparent;h(E);for(n=0;n<H.count;n++){N=H.list[n];F(N.blending);k(N.depth_test);C=d(z,P,T,N,E);E.render(function(oa){g(oa,C)})}}}if(B&&B.min_filter!==THREE.NearestFilter&&B.min_filter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);
-e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(l){var z,B,p;if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap={};l.__webGLObjectsImmediate=[]}z=0;for(B=l.objects.length;z<B;z++){p=l.objects[z];var n=l,C=void 0,H=void 0,N=void 0,ba=void 0;H=p.geometry;if(n.__webGLObjectsMap[p.id]==undefined){n.__webGLObjectsMap[p.id]={};p._modelViewMatrix=new THREE.Matrix4;p._normalMatrixArray=new Float32Array(9);p._modelViewMatrixArray=new Float32Array(16);
-p._objectMatrixArray=new Float32Array(16);p.globalMatrix.flattenToArray(p._objectMatrixArray)}ba=n.__webGLObjectsMap[p.id];objlist=n.__webGLObjects;if(p instanceof THREE.Mesh){for(C in H.geometryChunks){N=H.geometryChunks[C];if(!N.__webGLVertexBuffer){n=N;n.__webGLVertexBuffer=e.createBuffer();n.__webGLNormalBuffer=e.createBuffer();n.__webGLTangentBuffer=e.createBuffer();n.__webGLColorBuffer=e.createBuffer();n.__webGLUVBuffer=e.createBuffer();n.__webGLUV2Buffer=e.createBuffer();n.__webGLSkinVertexABuffer=
-e.createBuffer();n.__webGLSkinVertexBBuffer=e.createBuffer();n.__webGLSkinIndicesBuffer=e.createBuffer();n.__webGLSkinWeightsBuffer=e.createBuffer();n.__webGLFaceBuffer=e.createBuffer();n.__webGLLineBuffer=e.createBuffer();n=N;var y=p,E=void 0,D=void 0,P=0,T=0,oa=0,la=y.geometry.faces,ja=n.faces;E=0;for(D=ja.length;E<D;E++){fi=ja[E];face=la[fi];if(face instanceof THREE.Face3){P+=3;T+=1;oa+=3}else if(face instanceof THREE.Face4){P+=4;T+=2;oa+=4}}n.__vertexArray=new Float32Array(P*3);n.__normalArray=
-new Float32Array(P*3);n.__tangentArray=new Float32Array(P*4);n.__colorArray=new Float32Array(P*3);n.__uvArray=new Float32Array(P*2);n.__uv2Array=new Float32Array(P*2);n.__skinVertexAArray=new Float32Array(P*4);n.__skinVertexBArray=new Float32Array(P*4);n.__skinIndexArray=new Float32Array(P*4);n.__skinWeightArray=new Float32Array(P*4);n.__faceArray=new Uint16Array(T*3);n.__lineArray=new Uint16Array(oa*2);D=E=n;P=void 0;la=void 0;var ma=void 0,pa=void 0;ma=void 0;ja=!1;P=0;for(la=y.materials.length;P<
-la;P++){ma=y.materials[P];if(ma instanceof THREE.MeshFaceMaterial){ma=0;for(pa=D.materials.length;ma<pa;ma++)if(D.materials[ma]&&D.materials[ma].shading!=undefined&&D.materials[ma].shading==THREE.SmoothShading){ja=!0;break}}else if(ma&&ma.shading!=undefined&&ma.shading==THREE.SmoothShading){ja=!0;break}if(ja)break}E.__needsSmoothNormals=ja;n.__webGLFaceCount=T*3;n.__webGLLineCount=oa*2;H.__dirtyVertices=!0;H.__dirtyElements=!0;H.__dirtyUvs=!0;H.__dirtyNormals=!0;H.__dirtyTangents=!0;H.__dirtyColors=
-!0}if(H.__dirtyVertices||H.__dirtyElements||H.__dirtyUvs||H.__dirtyNormals||H.__dirtyColors||H.__dirtyTangents){n=N;T=e.DYNAMIC_DRAW;oa=void 0;E=void 0;var sa=void 0,O=void 0,Ia=void 0,Ca=void 0,Ja=void 0;sa=void 0;var ca=void 0,$=void 0,X=void 0,ta=void 0;ca=void 0;$=void 0;X=void 0;O=void 0;ca=void 0;$=void 0;X=void 0;ta=void 0;ca=void 0;$=void 0;X=void 0;ta=void 0;ca=void 0;$=void 0;X=void 0;ta=void 0;ca=void 0;$=void 0;X=void 0;ta=void 0;ca=void 0;$=void 0;X=void 0;ta=void 0;O=void 0;Ca=void 0;
-Ia=void 0;Ja=void 0;var Fa=pa=ma=ja=la=P=y=D=0,Da=0,K=0,Ea=n.__vertexArray,Ra=n.__uvArray,Pa=n.__uv2Array,Ka=n.__normalArray,ia=n.__tangentArray,wa=n.__colorArray,ua=n.__skinVertexAArray,xa=n.__skinVertexBArray,za=n.__skinIndexArray,va=n.__skinWeightArray,Q=n.__faceArray,fa=n.__lineArray,ga=n.__needsSmoothNormals,R=p.geometry,ea=R.__dirtyVertices,qa=R.__dirtyElements,Aa=R.__dirtyUvs,Ga=R.__dirtyNormals,Ha=R.__dirtyTangents,La=R.__dirtyColors,Ba=R.vertices,Ma=n.faces,Ta=R.faces,Na=R.uvs,Oa=R.uvs2,
-Qa=R.colors,Ua=R.skinVerticesA,Va=R.skinVerticesB,Wa=R.skinIndices,Sa=R.skinWeights;oa=0;for(E=Ma.length;oa<E;oa++){sa=Ma[oa];O=Ta[sa];Ja=Na[sa];sa=Oa[sa];Ia=O.vertexNormals;Ca=O.normal;if(O instanceof THREE.Face3){if(ea){ca=Ba[O.a].position;$=Ba[O.b].position;X=Ba[O.c].position;Ea[y]=ca.x;Ea[y+1]=ca.y;Ea[y+2]=ca.z;Ea[y+3]=$.x;Ea[y+4]=$.y;Ea[y+5]=$.z;Ea[y+6]=X.x;Ea[y+7]=X.y;Ea[y+8]=X.z;y+=9}if(Sa.length){ca=Sa[O.a];$=Sa[O.b];X=Sa[O.c];va[K]=ca.x;va[K+1]=ca.y;va[K+2]=ca.z;va[K+3]=ca.w;va[K+4]=$.x;
-va[K+5]=$.y;va[K+6]=$.z;va[K+7]=$.w;va[K+8]=X.x;va[K+9]=X.y;va[K+10]=X.z;va[K+11]=X.w;ca=Wa[O.a];$=Wa[O.b];X=Wa[O.c];za[K]=ca.x;za[K+1]=ca.y;za[K+2]=ca.z;za[K+3]=ca.w;za[K+4]=$.x;za[K+5]=$.y;za[K+6]=$.z;za[K+7]=$.w;za[K+8]=X.x;za[K+9]=X.y;za[K+10]=X.z;za[K+11]=X.w;ca=Ua[O.a];$=Ua[O.b];X=Ua[O.c];ua[K]=ca.x;ua[K+1]=ca.y;ua[K+2]=ca.z;ua[K+3]=1;ua[K+4]=$.x;ua[K+5]=$.y;ua[K+6]=$.z;ua[K+7]=1;ua[K+8]=X.x;ua[K+9]=X.y;ua[K+10]=X.z;ua[K+11]=1;ca=Va[O.a];$=Va[O.b];X=Va[O.c];xa[K]=ca.x;xa[K+1]=ca.y;xa[K+2]=ca.z;
-xa[K+3]=1;xa[K+4]=$.x;xa[K+5]=$.y;xa[K+6]=$.z;xa[K+7]=1;xa[K+8]=X.x;xa[K+9]=X.y;xa[K+10]=X.z;xa[K+11]=1;K+=12}if(La&&Qa.length){ca=Qa[O.a];$=Qa[O.b];X=Qa[O.c];wa[Da]=ca.r;wa[Da+1]=ca.g;wa[Da+2]=ca.b;wa[Da+3]=$.r;wa[Da+4]=$.g;wa[Da+5]=$.b;wa[Da+6]=X.r;wa[Da+7]=X.g;wa[Da+8]=X.b;Da+=9}if(Ha&&R.hasTangents){ca=Ba[O.a].tangent;$=Ba[O.b].tangent;X=Ba[O.c].tangent;ia[pa]=ca.x;ia[pa+1]=ca.y;ia[pa+2]=ca.z;ia[pa+3]=ca.w;ia[pa+4]=$.x;ia[pa+5]=$.y;ia[pa+6]=$.z;ia[pa+7]=$.w;ia[pa+8]=X.x;ia[pa+9]=X.y;ia[pa+10]=
-X.z;ia[pa+11]=X.w;pa+=12}if(Ga)if(Ia.length==3&&ga)for(O=0;O<3;O++){Ca=Ia[O];Ka[ma]=Ca.x;Ka[ma+1]=Ca.y;Ka[ma+2]=Ca.z;ma+=3}else for(O=0;O<3;O++){Ka[ma]=Ca.x;Ka[ma+1]=Ca.y;Ka[ma+2]=Ca.z;ma+=3}if(Aa&&Ja)for(O=0;O<3;O++){Ia=Ja[O];Ra[P]=Ia.u;Ra[P+1]=Ia.v;P+=2}if(Aa&&sa)for(O=0;O<3;O++){Ja=sa[O];Pa[la]=Ja.u;Pa[la+1]=Ja.v;la+=2}if(qa){Q[ja]=D;Q[ja+1]=D+1;Q[ja+2]=D+2;ja+=3;fa[Fa]=D;fa[Fa+1]=D+1;fa[Fa+2]=D;fa[Fa+3]=D+2;fa[Fa+4]=D+1;fa[Fa+5]=D+2;Fa+=6;D+=3}}else if(O instanceof THREE.Face4){if(ea){ca=Ba[O.a].position;
-$=Ba[O.b].position;X=Ba[O.c].position;ta=Ba[O.d].position;Ea[y]=ca.x;Ea[y+1]=ca.y;Ea[y+2]=ca.z;Ea[y+3]=$.x;Ea[y+4]=$.y;Ea[y+5]=$.z;Ea[y+6]=X.x;Ea[y+7]=X.y;Ea[y+8]=X.z;Ea[y+9]=ta.x;Ea[y+10]=ta.y;Ea[y+11]=ta.z;y+=12}if(Sa.length){ca=Sa[O.a];$=Sa[O.b];X=Sa[O.c];ta=Sa[O.d];va[K]=ca.x;va[K+1]=ca.y;va[K+2]=ca.z;va[K+3]=ca.w;va[K+4]=$.x;va[K+5]=$.y;va[K+6]=$.z;va[K+7]=$.w;va[K+8]=X.x;va[K+9]=X.y;va[K+10]=X.z;va[K+11]=X.w;va[K+12]=ta.x;va[K+13]=ta.y;va[K+14]=ta.z;va[K+15]=ta.w;ca=Wa[O.a];$=Wa[O.b];X=Wa[O.c];
-ta=Wa[O.d];za[K]=ca.x;za[K+1]=ca.y;za[K+2]=ca.z;za[K+3]=ca.w;za[K+4]=$.x;za[K+5]=$.y;za[K+6]=$.z;za[K+7]=$.w;za[K+8]=X.x;za[K+9]=X.y;za[K+10]=X.z;za[K+11]=X.w;za[K+12]=ta.x;za[K+13]=ta.y;za[K+14]=ta.z;za[K+15]=ta.w;ca=Ua[O.a];$=Ua[O.b];X=Ua[O.c];ta=Ua[O.d];ua[K]=ca.x;ua[K+1]=ca.y;ua[K+2]=ca.z;ua[K+3]=1;ua[K+4]=$.x;ua[K+5]=$.y;ua[K+6]=$.z;ua[K+7]=1;ua[K+8]=X.x;ua[K+9]=X.y;ua[K+10]=X.z;ua[K+11]=1;ua[K+12]=ta.x;ua[K+13]=ta.y;ua[K+14]=ta.z;ua[K+15]=1;ca=Va[O.a];$=Va[O.b];X=Va[O.c];ta=Va[O.d];xa[K]=ca.x;
-xa[K+1]=ca.y;xa[K+2]=ca.z;xa[K+3]=1;xa[K+4]=$.x;xa[K+5]=$.y;xa[K+6]=$.z;xa[K+7]=1;xa[K+8]=X.x;xa[K+9]=X.y;xa[K+10]=X.z;xa[K+11]=1;xa[K+12]=ta.x;xa[K+13]=ta.y;xa[K+14]=ta.z;xa[K+15]=1;K+=16}if(La&&Qa.length){ca=Qa[O.a];$=Qa[O.b];X=Qa[O.c];ta=Qa[O.d];wa[Da]=ca.r;wa[Da+1]=ca.g;wa[Da+2]=ca.b;wa[Da+3]=$.r;wa[Da+4]=$.g;wa[Da+5]=$.b;wa[Da+6]=X.r;wa[Da+7]=X.g;wa[Da+8]=X.b;wa[Da+9]=ta.r;wa[Da+10]=ta.g;wa[Da+11]=ta.b;Da+=12}if(Ha&&R.hasTangents){ca=Ba[O.a].tangent;$=Ba[O.b].tangent;X=Ba[O.c].tangent;O=Ba[O.d].tangent;
-ia[pa]=ca.x;ia[pa+1]=ca.y;ia[pa+2]=ca.z;ia[pa+3]=ca.w;ia[pa+4]=$.x;ia[pa+5]=$.y;ia[pa+6]=$.z;ia[pa+7]=$.w;ia[pa+8]=X.x;ia[pa+9]=X.y;ia[pa+10]=X.z;ia[pa+11]=X.w;ia[pa+12]=O.x;ia[pa+13]=O.y;ia[pa+14]=O.z;ia[pa+15]=O.w;pa+=16}if(Ga)if(Ia.length==4&&ga)for(O=0;O<4;O++){Ca=Ia[O];Ka[ma]=Ca.x;Ka[ma+1]=Ca.y;Ka[ma+2]=Ca.z;ma+=3}else for(O=0;O<4;O++){Ka[ma]=Ca.x;Ka[ma+1]=Ca.y;Ka[ma+2]=Ca.z;ma+=3}if(Aa&&Ja)for(O=0;O<4;O++){Ia=Ja[O];Ra[P]=Ia.u;Ra[P+1]=Ia.v;P+=2}if(Aa&&sa)for(O=0;O<4;O++){Ja=sa[O];Pa[la]=Ja.u;
-Pa[la+1]=Ja.v;la+=2}if(qa){Q[ja]=D;Q[ja+1]=D+1;Q[ja+2]=D+2;Q[ja+3]=D;Q[ja+4]=D+2;Q[ja+5]=D+3;ja+=6;fa[Fa]=D;fa[Fa+1]=D+1;fa[Fa+2]=D;fa[Fa+3]=D+3;fa[Fa+4]=D+1;fa[Fa+5]=D+2;fa[Fa+6]=D+2;fa[Fa+7]=D+3;Fa+=8;D+=4}}}if(ea){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ea,T)}if(La&&Qa.length){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,wa,T)}if(Ga){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Ka,T)}if(Ha&&
-R.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,ia,T)}if(Aa&&P>0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,T)}if(Aa&&la>0){e.bindBuffer(e.ARRAY_BUFFER,n.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Pa,T)}if(qa){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Q,T);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,fa,T)}if(K>0){e.bindBuffer(e.ARRAY_BUFFER,
-n.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,ua,T);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,xa,T);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,za,T);e.bindBuffer(e.ARRAY_BUFFER,n.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,va,T)}}x(objlist,ba,C,N,p)}H.__dirtyVertices=!1;H.__dirtyElements=!1;H.__dirtyUvs=!1;H.__dirtyNormals=!1;H.__dirtyTangents=!1;H.__dirtyColors=!1}else if(p instanceof THREE.Ribbon){if(!H.__webGLVertexBuffer){C=
-H;C.__webGLVertexBuffer=e.createBuffer();C.__webGLColorBuffer=e.createBuffer();C=H;N=C.vertices.length;C.__vertexArray=new Float32Array(N*3);C.__colorArray=new Float32Array(N*3);C.__webGLVertexCount=N;H.__dirtyVertices=!0;H.__dirtyColors=!0}if(H.__dirtyVertices||H.__dirtyColors){C=H;N=e.DYNAMIC_DRAW;D=void 0;D=void 0;y=void 0;n=void 0;P=C.vertices;T=C.colors;la=P.length;oa=T.length;ja=C.__vertexArray;E=C.__colorArray;ma=C.__dirtyColors;if(C.__dirtyVertices){for(D=0;D<la;D++){y=P[D].position;n=D*3;
-ja[n]=y.x;ja[n+1]=y.y;ja[n+2]=y.z}e.bindBuffer(e.ARRAY_BUFFER,C.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ja,N)}if(ma){for(D=0;D<oa;D++){color=T[D];n=D*3;E[n]=color.r;E[n+1]=color.g;E[n+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,C.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,E,N)}}x(objlist,ba,0,H,p);H.__dirtyVertices=!1;H.__dirtyColors=!1}else if(p instanceof THREE.Line){if(!H.__webGLVertexBuffer){C=H;C.__webGLVertexBuffer=e.createBuffer();C.__webGLColorBuffer=e.createBuffer();C=H;N=C.vertices.length;
-C.__vertexArray=new Float32Array(N*3);C.__colorArray=new Float32Array(N*3);C.__webGLLineCount=N;H.__dirtyVertices=!0;H.__dirtyColors=!0}if(H.__dirtyVertices||H.__dirtyColors){C=H;N=e.DYNAMIC_DRAW;D=void 0;D=void 0;y=void 0;n=void 0;P=C.vertices;T=C.colors;la=P.length;oa=T.length;ja=C.__vertexArray;E=C.__colorArray;ma=C.__dirtyColors;if(C.__dirtyVertices){for(D=0;D<la;D++){y=P[D].position;n=D*3;ja[n]=y.x;ja[n+1]=y.y;ja[n+2]=y.z}e.bindBuffer(e.ARRAY_BUFFER,C.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,
-ja,N)}if(ma){for(D=0;D<oa;D++){color=T[D];n=D*3;E[n]=color.r;E[n+1]=color.g;E[n+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,C.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,E,N)}}x(objlist,ba,0,H,p);H.__dirtyVertices=!1;H.__dirtyColors=!1}else if(p instanceof THREE.ParticleSystem){if(!H.__webGLVertexBuffer){C=H;C.__webGLVertexBuffer=e.createBuffer();C.__webGLColorBuffer=e.createBuffer();C=H;N=C.vertices.length;C.__vertexArray=new Float32Array(N*3);C.__colorArray=new Float32Array(N*3);C.__sortArray=[];
-C.__webGLParticleCount=N;H.__dirtyVertices=!0;H.__dirtyColors=!0}(H.__dirtyVertices||H.__dirtyColors||p.sortParticles)&&b(H,e.DYNAMIC_DRAW,p,camera);x(objlist,ba,0,H,p);H.__dirtyVertices=!1;H.__dirtyColors=!1}else if(THREE.MarchingCubes!==undefined&&p instanceof THREE.MarchingCubes){H=ba;if(H[0]==undefined){n.__webGLObjectsImmediate.push({object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}});H[0]=1}}}};this.removeObject=function(l,z){var B,p;for(B=l.__webGLObjects.length-1;B>=0;B--){p=
-l.__webGLObjects[B].object;z==p&&l.__webGLObjects.splice(B,1)}};this.setFaceCulling=function(l,z){if(l){!z||z=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}var M=document.createElement("canvas"),e,ea=null,O=null,P=this,W=null,S=null,aa=null,ba=null,H=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],V=new THREE.Matrix4,la=new Float32Array(16),Y=new Float32Array(16),ka=new Float32Array(16),ia=new THREE.Vector4,fa=
+!0,ra=new THREE.Color(0),xa=0;if(a){if(a.antialias!==undefined)fa=a.antialias;a.clearColor!==undefined&&ra.setHex(a.clearColor);if(a.clearAlpha!==undefined)xa=a.clearAlpha}this.domElement=M;this.autoClear=!0;this.sortObjects=!1;(function(l,y,B){try{e=M.getContext("experimental-webgl",{antialias:l})}catch(t){console.log(t)}if(!e)throw"cannot create webgl context";e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);
+e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.clearColor(y.r,y.g,y.b,B);_cullEnabled=!0})(fa,ra,xa);this.context=e;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,y){M.width=l;M.height=y;e.viewport(0,0,M.width,M.height)};this.setClearColorHex=function(l,y){var B=new THREE.Color(l);e.clearColor(B.r,B.g,B.b,y)};this.setClearColor=function(l,y){e.clearColor(l.r,l.g,l.b,y)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|
+e.DEPTH_BUFFER_BIT)};this.initMaterial=function(l,y,B){var t,u;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof
+THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var E,C,J,L;u=J=L=0;for(E=y.length;u<E;u++){C=y[u];C instanceof THREE.DirectionalLight&&J++;C instanceof THREE.PointLight&&L++}if(L+J<=4)y=J;else{y=Math.ceil(4*J/(L+J));L=4-y}u={directional:y,point:L};L=l.fragment_shader;y=l.vertex_shader;E={fog:B,map:l.map,env_map:l.env_map,light_map:l.light_map,vertex_colors:l.vertex_colors,skinning:l.skinning,maxDirLights:u.directional,maxPointLights:u.point};B=e.createProgram();u=["#ifdef GL_ES\nprecision highp float;\n#endif",
+"#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,E.fog?"#define USE_FOG":"",E.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":"",E.light_map?"#define USE_LIGHTMAP":"",E.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");E=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+
+E.maxPointLights,E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":"",E.light_map?"#define USE_LIGHTMAP":"",E.vertex_colors?"#define USE_COLOR":"",E.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+e.attachShader(B,I("fragment",u+L));e.attachShader(B,I("vertex",E+y));e.linkProgram(B);e.getProgramParameter(B,e.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+e.getProgramParameter(B,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");B.uniforms={};B.attributes={};l.program=B;B=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(t in l.uniforms)B.push(t);t=l.program;L=0;for(y=B.length;L<
+y;L++){u=B[L];t.uniforms[u]=e.getUniformLocation(t,u)}t=l.program;B=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];L=0;for(y=B.length;L<y;L++){u=B[L];t.attributes[u]=e.getAttribLocation(t,u)}t=l.program.attributes;e.enableVertexAttribArray(t.position);t.color>=0&&e.enableVertexAttribArray(t.color);t.normal>=0&&e.enableVertexAttribArray(t.normal);t.tangent>=0&&e.enableVertexAttribArray(t.tangent);if(l.skinning&&t.skinVertexA>=0&&t.skinVertexB>=
+0&&t.skinIndex>=0&&t.skinWeight>=0){e.enableVertexAttribArray(t.skinVertexA);e.enableVertexAttribArray(t.skinVertexB);e.enableVertexAttribArray(t.skinIndex);e.enableVertexAttribArray(t.skinWeight)}};this.render=function(l,y,B,t){var u,E,C,J,L,z,D,F,T=l.lights,Q=l.fog;y.matrixAutoUpdate&&y.update();y.globalMatrix.flattenToArray(ka);y.projectionMatrix.flattenToArray(la);y.inverseMatrix.flattenToArray(Y);V.multiply(y.projectionMatrix,y.globalMatrix);j(V);THREE.AnimationHandler&&THREE.AnimationHandler.update();
+l.update(undefined,!1,y);this.initWebGLObjects(l,y);v(B,t!==undefined?t:!0);this.autoClear&&this.clear();L=l.__webGLObjects.length;for(t=0;t<L;t++){u=l.__webGLObjects[t];D=u.object;if(D.visible)if(!(D instanceof THREE.Mesh)||m(D)){D.globalMatrix.flattenToArray(D._objectMatrixArray);A(D,y);q(u);u.render=!0;if(this.sortObjects){ia.copy(D.position);V.multiplyVector3(ia);u.z=ia.z}}else u.render=!1;else u.render=!1}this.sortObjects&&l.__webGLObjects.sort(p);z=l.__webGLObjectsImmediate.length;for(t=0;t<
+z;t++){u=l.__webGLObjectsImmediate[t];D=u.object;if(D.visible){D.matrixAutoUpdate&&D.globalMatrix.flattenToArray(D._objectMatrixArray);A(D,y);w(u)}}G(THREE.NormalBlending);for(t=0;t<L;t++){u=l.__webGLObjects[t];if(u.render){D=u.object;F=u.buffer;C=u.opaque;h(D);for(u=0;u<C.count;u++){J=C.list[u];k(J.depth_test);f(y,T,Q,J,F,D)}}}for(t=0;t<z;t++){u=l.__webGLObjectsImmediate[t];D=u.object;if(D.visible){C=u.opaque;h(D);for(u=0;u<C.count;u++){J=C.list[u];k(J.depth_test);E=d(y,T,Q,J,D);D.render(function(ga){g(ga,
+E)})}}}for(t=0;t<L;t++){u=l.__webGLObjects[t];if(u.render){D=u.object;F=u.buffer;C=u.transparent;h(D);for(u=0;u<C.count;u++){J=C.list[u];G(J.blending);k(J.depth_test);f(y,T,Q,J,F,D)}}}for(t=0;t<z;t++){u=l.__webGLObjectsImmediate[t];D=u.object;if(D.visible){C=u.transparent;h(D);for(u=0;u<C.count;u++){J=C.list[u];G(J.blending);k(J.depth_test);E=d(y,T,Q,J,D);D.render(function(ga){g(ga,E)})}}}if(B&&B.min_filter!==THREE.NearestFilter&&B.min_filter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,B.__webGLTexture);
+e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(l,y){var B,t,u;if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap={};l.__webGLObjectsImmediate=[]}B=0;for(t=l.objects.length;B<t;B++){u=l.objects[B];var E=l,C=y,J=void 0,L=void 0,z=void 0,D=void 0;L=u.geometry;if(E.__webGLObjectsMap[u.id]==undefined){E.__webGLObjectsMap[u.id]={};u._modelViewMatrix=new THREE.Matrix4;u._normalMatrixArray=new Float32Array(9);u._modelViewMatrixArray=new Float32Array(16);
+u._objectMatrixArray=new Float32Array(16);u.globalMatrix.flattenToArray(u._objectMatrixArray)}D=E.__webGLObjectsMap[u.id];objlist=E.__webGLObjects;if(u instanceof THREE.Mesh){for(J in L.geometryChunks){z=L.geometryChunks[J];if(!z.__webGLVertexBuffer){C=z;C.__webGLVertexBuffer=e.createBuffer();C.__webGLNormalBuffer=e.createBuffer();C.__webGLTangentBuffer=e.createBuffer();C.__webGLColorBuffer=e.createBuffer();C.__webGLUVBuffer=e.createBuffer();C.__webGLUV2Buffer=e.createBuffer();C.__webGLSkinVertexABuffer=
+e.createBuffer();C.__webGLSkinVertexBBuffer=e.createBuffer();C.__webGLSkinIndicesBuffer=e.createBuffer();C.__webGLSkinWeightsBuffer=e.createBuffer();C.__webGLFaceBuffer=e.createBuffer();C.__webGLLineBuffer=e.createBuffer();C=z;var F=u,T=void 0,Q=void 0,ga=0,ma=E=0,sa=F.geometry.faces,oa=C.faces;T=0;for(Q=oa.length;T<Q;T++){fi=oa[T];face=sa[fi];if(face instanceof THREE.Face3){ga+=3;E+=1;ma+=3}else if(face instanceof THREE.Face4){ga+=4;E+=2;ma+=4}}C.__vertexArray=new Float32Array(ga*3);C.__normalArray=
+new Float32Array(ga*3);C.__tangentArray=new Float32Array(ga*4);C.__colorArray=new Float32Array(ga*3);C.__uvArray=new Float32Array(ga*2);C.__uv2Array=new Float32Array(ga*2);C.__skinVertexAArray=new Float32Array(ga*4);C.__skinVertexBArray=new Float32Array(ga*4);C.__skinIndexArray=new Float32Array(ga*4);C.__skinWeightArray=new Float32Array(ga*4);C.__faceArray=new Uint16Array(E*3);C.__lineArray=new Uint16Array(ma*2);Q=T=C;ga=void 0;sa=void 0;var na=void 0,ha=void 0;na=void 0;oa=!1;ga=0;for(sa=F.materials.length;ga<
+sa;ga++){na=F.materials[ga];if(na instanceof THREE.MeshFaceMaterial){na=0;for(ha=Q.materials.length;na<ha;na++)if(Q.materials[na]&&Q.materials[na].shading!=undefined&&Q.materials[na].shading==THREE.SmoothShading){oa=!0;break}}else if(na&&na.shading!=undefined&&na.shading==THREE.SmoothShading){oa=!0;break}if(oa)break}T.__needsSmoothNormals=oa;C.__webGLFaceCount=E*3;C.__webGLLineCount=ma*2;L.__dirtyVertices=!0;L.__dirtyElements=!0;L.__dirtyUvs=!0;L.__dirtyNormals=!0;L.__dirtyTangents=!0;L.__dirtyColors=
+!0}if(L.__dirtyVertices||L.__dirtyElements||L.__dirtyUvs||L.__dirtyNormals||L.__dirtyColors||L.__dirtyTangents){C=z;E=e.DYNAMIC_DRAW;ma=void 0;T=void 0;var Ca=void 0,R=void 0,Ga=void 0,Ha=void 0,La=void 0;Ca=void 0;var da=void 0,Z=void 0,$=void 0,ta=void 0;da=void 0;Z=void 0;$=void 0;R=void 0;da=void 0;Z=void 0;$=void 0;ta=void 0;da=void 0;Z=void 0;$=void 0;ta=void 0;da=void 0;Z=void 0;$=void 0;ta=void 0;da=void 0;Z=void 0;$=void 0;ta=void 0;da=void 0;Z=void 0;$=void 0;ta=void 0;R=void 0;Ha=void 0;
+Ga=void 0;La=void 0;var Ja=ha=na=oa=sa=ga=F=Q=0,Aa=0,N=0,Ba=C.__vertexArray,Pa=C.__uvArray,Ta=C.__uv2Array,ua=C.__normalArray,pa=C.__tangentArray,za=C.__colorArray,wa=C.__skinVertexAArray,ya=C.__skinVertexBArray,va=C.__skinIndexArray,K=C.__skinWeightArray,ja=C.__faceArray,ca=C.__lineArray,U=C.__needsSmoothNormals,X=u.geometry,qa=X.__dirtyVertices,Da=X.__dirtyElements,Ea=X.__dirtyUvs,Ia=X.__dirtyNormals,Ma=X.__dirtyTangents,Ka=X.__dirtyColors,Fa=X.vertices,Sa=C.faces,Na=X.faces,Oa=X.uvs,Xa=X.uvs2,
+Qa=X.colors,Ua=X.skinVerticesA,Va=X.skinVerticesB,Wa=X.skinIndices,Ra=X.skinWeights;ma=0;for(T=Sa.length;ma<T;ma++){Ca=Sa[ma];R=Na[Ca];La=Oa[Ca];Ca=Xa[Ca];Ga=R.vertexNormals;Ha=R.normal;if(R instanceof THREE.Face3){if(qa){da=Fa[R.a].position;Z=Fa[R.b].position;$=Fa[R.c].position;Ba[F]=da.x;Ba[F+1]=da.y;Ba[F+2]=da.z;Ba[F+3]=Z.x;Ba[F+4]=Z.y;Ba[F+5]=Z.z;Ba[F+6]=$.x;Ba[F+7]=$.y;Ba[F+8]=$.z;F+=9}if(Ra.length){da=Ra[R.a];Z=Ra[R.b];$=Ra[R.c];K[N]=da.x;K[N+1]=da.y;K[N+2]=da.z;K[N+3]=da.w;K[N+4]=Z.x;K[N+5]=
+Z.y;K[N+6]=Z.z;K[N+7]=Z.w;K[N+8]=$.x;K[N+9]=$.y;K[N+10]=$.z;K[N+11]=$.w;da=Wa[R.a];Z=Wa[R.b];$=Wa[R.c];va[N]=da.x;va[N+1]=da.y;va[N+2]=da.z;va[N+3]=da.w;va[N+4]=Z.x;va[N+5]=Z.y;va[N+6]=Z.z;va[N+7]=Z.w;va[N+8]=$.x;va[N+9]=$.y;va[N+10]=$.z;va[N+11]=$.w;da=Ua[R.a];Z=Ua[R.b];$=Ua[R.c];wa[N]=da.x;wa[N+1]=da.y;wa[N+2]=da.z;wa[N+3]=1;wa[N+4]=Z.x;wa[N+5]=Z.y;wa[N+6]=Z.z;wa[N+7]=1;wa[N+8]=$.x;wa[N+9]=$.y;wa[N+10]=$.z;wa[N+11]=1;da=Va[R.a];Z=Va[R.b];$=Va[R.c];ya[N]=da.x;ya[N+1]=da.y;ya[N+2]=da.z;ya[N+3]=1;
+ya[N+4]=Z.x;ya[N+5]=Z.y;ya[N+6]=Z.z;ya[N+7]=1;ya[N+8]=$.x;ya[N+9]=$.y;ya[N+10]=$.z;ya[N+11]=1;N+=12}if(Ka&&Qa.length){da=Qa[R.a];Z=Qa[R.b];$=Qa[R.c];za[Aa]=da.r;za[Aa+1]=da.g;za[Aa+2]=da.b;za[Aa+3]=Z.r;za[Aa+4]=Z.g;za[Aa+5]=Z.b;za[Aa+6]=$.r;za[Aa+7]=$.g;za[Aa+8]=$.b;Aa+=9}if(Ma&&X.hasTangents){da=Fa[R.a].tangent;Z=Fa[R.b].tangent;$=Fa[R.c].tangent;pa[ha]=da.x;pa[ha+1]=da.y;pa[ha+2]=da.z;pa[ha+3]=da.w;pa[ha+4]=Z.x;pa[ha+5]=Z.y;pa[ha+6]=Z.z;pa[ha+7]=Z.w;pa[ha+8]=$.x;pa[ha+9]=$.y;pa[ha+10]=$.z;pa[ha+
+11]=$.w;ha+=12}if(Ia)if(Ga.length==3&&U)for(R=0;R<3;R++){Ha=Ga[R];ua[na]=Ha.x;ua[na+1]=Ha.y;ua[na+2]=Ha.z;na+=3}else for(R=0;R<3;R++){ua[na]=Ha.x;ua[na+1]=Ha.y;ua[na+2]=Ha.z;na+=3}if(Ea&&La)for(R=0;R<3;R++){Ga=La[R];Pa[ga]=Ga.u;Pa[ga+1]=Ga.v;ga+=2}if(Ea&&Ca)for(R=0;R<3;R++){La=Ca[R];Ta[sa]=La.u;Ta[sa+1]=La.v;sa+=2}if(Da){ja[oa]=Q;ja[oa+1]=Q+1;ja[oa+2]=Q+2;oa+=3;ca[Ja]=Q;ca[Ja+1]=Q+1;ca[Ja+2]=Q;ca[Ja+3]=Q+2;ca[Ja+4]=Q+1;ca[Ja+5]=Q+2;Ja+=6;Q+=3}}else if(R instanceof THREE.Face4){if(qa){da=Fa[R.a].position;
+Z=Fa[R.b].position;$=Fa[R.c].position;ta=Fa[R.d].position;Ba[F]=da.x;Ba[F+1]=da.y;Ba[F+2]=da.z;Ba[F+3]=Z.x;Ba[F+4]=Z.y;Ba[F+5]=Z.z;Ba[F+6]=$.x;Ba[F+7]=$.y;Ba[F+8]=$.z;Ba[F+9]=ta.x;Ba[F+10]=ta.y;Ba[F+11]=ta.z;F+=12}if(Ra.length){da=Ra[R.a];Z=Ra[R.b];$=Ra[R.c];ta=Ra[R.d];K[N]=da.x;K[N+1]=da.y;K[N+2]=da.z;K[N+3]=da.w;K[N+4]=Z.x;K[N+5]=Z.y;K[N+6]=Z.z;K[N+7]=Z.w;K[N+8]=$.x;K[N+9]=$.y;K[N+10]=$.z;K[N+11]=$.w;K[N+12]=ta.x;K[N+13]=ta.y;K[N+14]=ta.z;K[N+15]=ta.w;da=Wa[R.a];Z=Wa[R.b];$=Wa[R.c];ta=Wa[R.d];va[N]=
+da.x;va[N+1]=da.y;va[N+2]=da.z;va[N+3]=da.w;va[N+4]=Z.x;va[N+5]=Z.y;va[N+6]=Z.z;va[N+7]=Z.w;va[N+8]=$.x;va[N+9]=$.y;va[N+10]=$.z;va[N+11]=$.w;va[N+12]=ta.x;va[N+13]=ta.y;va[N+14]=ta.z;va[N+15]=ta.w;da=Ua[R.a];Z=Ua[R.b];$=Ua[R.c];ta=Ua[R.d];wa[N]=da.x;wa[N+1]=da.y;wa[N+2]=da.z;wa[N+3]=1;wa[N+4]=Z.x;wa[N+5]=Z.y;wa[N+6]=Z.z;wa[N+7]=1;wa[N+8]=$.x;wa[N+9]=$.y;wa[N+10]=$.z;wa[N+11]=1;wa[N+12]=ta.x;wa[N+13]=ta.y;wa[N+14]=ta.z;wa[N+15]=1;da=Va[R.a];Z=Va[R.b];$=Va[R.c];ta=Va[R.d];ya[N]=da.x;ya[N+1]=da.y;ya[N+
+2]=da.z;ya[N+3]=1;ya[N+4]=Z.x;ya[N+5]=Z.y;ya[N+6]=Z.z;ya[N+7]=1;ya[N+8]=$.x;ya[N+9]=$.y;ya[N+10]=$.z;ya[N+11]=1;ya[N+12]=ta.x;ya[N+13]=ta.y;ya[N+14]=ta.z;ya[N+15]=1;N+=16}if(Ka&&Qa.length){da=Qa[R.a];Z=Qa[R.b];$=Qa[R.c];ta=Qa[R.d];za[Aa]=da.r;za[Aa+1]=da.g;za[Aa+2]=da.b;za[Aa+3]=Z.r;za[Aa+4]=Z.g;za[Aa+5]=Z.b;za[Aa+6]=$.r;za[Aa+7]=$.g;za[Aa+8]=$.b;za[Aa+9]=ta.r;za[Aa+10]=ta.g;za[Aa+11]=ta.b;Aa+=12}if(Ma&&X.hasTangents){da=Fa[R.a].tangent;Z=Fa[R.b].tangent;$=Fa[R.c].tangent;R=Fa[R.d].tangent;pa[ha]=
+da.x;pa[ha+1]=da.y;pa[ha+2]=da.z;pa[ha+3]=da.w;pa[ha+4]=Z.x;pa[ha+5]=Z.y;pa[ha+6]=Z.z;pa[ha+7]=Z.w;pa[ha+8]=$.x;pa[ha+9]=$.y;pa[ha+10]=$.z;pa[ha+11]=$.w;pa[ha+12]=R.x;pa[ha+13]=R.y;pa[ha+14]=R.z;pa[ha+15]=R.w;ha+=16}if(Ia)if(Ga.length==4&&U)for(R=0;R<4;R++){Ha=Ga[R];ua[na]=Ha.x;ua[na+1]=Ha.y;ua[na+2]=Ha.z;na+=3}else for(R=0;R<4;R++){ua[na]=Ha.x;ua[na+1]=Ha.y;ua[na+2]=Ha.z;na+=3}if(Ea&&La)for(R=0;R<4;R++){Ga=La[R];Pa[ga]=Ga.u;Pa[ga+1]=Ga.v;ga+=2}if(Ea&&Ca)for(R=0;R<4;R++){La=Ca[R];Ta[sa]=La.u;Ta[sa+
+1]=La.v;sa+=2}if(Da){ja[oa]=Q;ja[oa+1]=Q+1;ja[oa+2]=Q+2;ja[oa+3]=Q;ja[oa+4]=Q+2;ja[oa+5]=Q+3;oa+=6;ca[Ja]=Q;ca[Ja+1]=Q+1;ca[Ja+2]=Q;ca[Ja+3]=Q+3;ca[Ja+4]=Q+1;ca[Ja+5]=Q+2;ca[Ja+6]=Q+2;ca[Ja+7]=Q+3;Ja+=8;Q+=4}}}if(qa){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,E)}if(Ka&&Qa.length){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,za,E)}if(Ia){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,ua,E)}if(Ma&&
+X.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,pa,E)}if(Ea&&ga>0){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,E)}if(Ea&&sa>0){e.bindBuffer(e.ARRAY_BUFFER,C.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Ta,E)}if(Da){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ja,E);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ca,E)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,
+C.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,wa,E);e.bindBuffer(e.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,ya,E);e.bindBuffer(e.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,va,E);e.bindBuffer(e.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,K,E)}}x(objlist,D,J,z,u)}L.__dirtyVertices=!1;L.__dirtyElements=!1;L.__dirtyUvs=!1;L.__dirtyNormals=!1;L.__dirtyTangents=!1;L.__dirtyColors=!1}else if(u instanceof THREE.Ribbon){if(!L.__webGLVertexBuffer){J=
+L;J.__webGLVertexBuffer=e.createBuffer();J.__webGLColorBuffer=e.createBuffer();J=L;z=J.vertices.length;J.__vertexArray=new Float32Array(z*3);J.__colorArray=new Float32Array(z*3);J.__webGLVertexCount=z;L.__dirtyVertices=!0;L.__dirtyColors=!0}if(L.__dirtyVertices||L.__dirtyColors){J=L;z=e.DYNAMIC_DRAW;Q=void 0;Q=void 0;F=void 0;C=void 0;ga=J.vertices;E=J.colors;sa=ga.length;ma=E.length;oa=J.__vertexArray;T=J.__colorArray;na=J.__dirtyColors;if(J.__dirtyVertices){for(Q=0;Q<sa;Q++){F=ga[Q].position;C=
+Q*3;oa[C]=F.x;oa[C+1]=F.y;oa[C+2]=F.z}e.bindBuffer(e.ARRAY_BUFFER,J.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,oa,z)}if(na){for(Q=0;Q<ma;Q++){color=E[Q];C=Q*3;T[C]=color.r;T[C+1]=color.g;T[C+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,J.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,T,z)}}x(objlist,D,0,L,u);L.__dirtyVertices=!1;L.__dirtyColors=!1}else if(u instanceof THREE.Line){if(!L.__webGLVertexBuffer){J=L;J.__webGLVertexBuffer=e.createBuffer();J.__webGLColorBuffer=e.createBuffer();J=L;z=J.vertices.length;
+J.__vertexArray=new Float32Array(z*3);J.__colorArray=new Float32Array(z*3);J.__webGLLineCount=z;L.__dirtyVertices=!0;L.__dirtyColors=!0}if(L.__dirtyVertices||L.__dirtyColors){J=L;z=e.DYNAMIC_DRAW;Q=void 0;Q=void 0;F=void 0;C=void 0;ga=J.vertices;E=J.colors;sa=ga.length;ma=E.length;oa=J.__vertexArray;T=J.__colorArray;na=J.__dirtyColors;if(J.__dirtyVertices){for(Q=0;Q<sa;Q++){F=ga[Q].position;C=Q*3;oa[C]=F.x;oa[C+1]=F.y;oa[C+2]=F.z}e.bindBuffer(e.ARRAY_BUFFER,J.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,
+oa,z)}if(na){for(Q=0;Q<ma;Q++){color=E[Q];C=Q*3;T[C]=color.r;T[C+1]=color.g;T[C+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,J.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,T,z)}}x(objlist,D,0,L,u);L.__dirtyVertices=!1;L.__dirtyColors=!1}else if(u instanceof THREE.ParticleSystem){if(!L.__webGLVertexBuffer){J=L;J.__webGLVertexBuffer=e.createBuffer();J.__webGLColorBuffer=e.createBuffer();J=L;z=J.vertices.length;J.__vertexArray=new Float32Array(z*3);J.__colorArray=new Float32Array(z*3);J.__sortArray=[];
+J.__webGLParticleCount=z;L.__dirtyVertices=!0;L.__dirtyColors=!0}(L.__dirtyVertices||L.__dirtyColors||u.sortParticles)&&b(L,e.DYNAMIC_DRAW,u,C);x(objlist,D,0,L,u);L.__dirtyVertices=!1;L.__dirtyColors=!1}else if(THREE.MarchingCubes!==undefined&&u instanceof THREE.MarchingCubes){L=D;if(L[0]==undefined){E.__webGLObjectsImmediate.push({object:u,opaque:{list:[],count:0},transparent:{list:[],count:0}});L[0]=1}}}};this.removeObject=function(l,y){var B,t;for(B=l.__webGLObjects.length-1;B>=0;B--){t=l.__webGLObjects[B].object;
+y==t&&l.__webGLObjects.splice(B,1)}};this.setFaceCulling=function(l,y){if(l){!y||y=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(l=="back")e.cullFace(e.BACK);else l=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
 THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -271,20 +278,21 @@ THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specu
 THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
 THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
 THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
 THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
 THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",
 THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",
-THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};THREE.RenderableObject=function(){this.z=this.object=null};
-THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};
-THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
-var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.matrixAutoUpdate&&b.updateMatrix();for(var o=0,w=h.length;o<w;o++){var u=new THREE.Vertex(h[o].position.clone());c&&b.localMatrix.multiplyVector3(u.position);g.push(u)}o=0;for(w=j.length;o<w;o++){h=j[o];var t,x=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+
-d,h.b+d,h.c+d,h.d+d));t.centroid.copy(h.centroid);t.normal.copy(h.normal);c=0;for(g=x.length;c<g;c++){u=x[c];t.vertexNormals.push(u.clone())}t.materials=h.materials.slice();k.push(t)}o=0;for(w=f.length;o<w;o++){d=f[o];k=[];c=0;for(g=d.length;c<g;c++)k.push(new THREE.UV(d[c].u,d[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],g=new THREE.Texture(f,
-b);b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;c&&c(this)};f[b].src=a[b]}return g}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(o in L.objects)if(!G.objects[o]){A=L.objects[o];if(q=G.geometries[A.geometry]){aa=[];for(i=0;i<A.materials.length;i++)aa[i]=G.materials[A.materials[i]];F=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(q,aa);object.position.set(F[0],
-F[1],F[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;G.scene.addObject(object);G.objects[o]=object}}}function h(U){return function(na){G.geometries[U]=na;g();V-=1;k()}}function k(){d({total_models:Y,total_textures:Z,loaded_models:Y-V,loaded_textures:Z-S},G);V==0&&S==0&&c(G)}var j,m,o,w,u,t,x,A,F,v,I,q,J,e,aa,L,M,V,S,Y,Z,G;L=f.data;M=new THREE.Loader;S=V=0;G={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},
-fogs:{}};f=function(){S-=1;k()};for(u in L.cameras){v=L.cameras[u];if(v.type=="perspective")J=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){J=new THREE.Camera;J.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}F=v.position;v=v.target;J.position.set(F[0],F[1],F[2]);J.target.position.set(v[0],v[1],v[2]);G.cameras[u]=J}for(w in L.lights){u=L.lights[w];if(u.type=="directional"){F=u.direction;light=new THREE.DirectionalLight;light.position.set(F[0],
-F[1],F[2]);light.position.normalize()}else if(u.type=="point"){F=u.position;light=new THREE.PointLight;light.position.set(F[0],F[1],F[2])}v=u.color;i=u.intensity||1;light.color.setRGB(v[0]*i,v[1]*i,v[2]*i);G.scene.addLight(light);G.lights[w]=light}for(t in L.fogs){w=L.fogs[t];if(w.type=="linear")e=new THREE.Fog(0,w.near,w.far);else w.type=="exp2"&&(e=new THREE.FogExp2(0,w.density));v=w.color;e.color.setRGB(v[0],v[1],v[2]);G.fogs[t]=e}if(G.cameras&&L.defaults.camera)G.currentCamera=G.cameras[L.defaults.camera];
-if(G.fogs&&L.defaults.fog)G.scene.fog=G.fogs[L.defaults.fog];v=L.defaults.bgcolor;G.bgColor=new THREE.Color;G.bgColor.setRGB(v[0],v[1],v[2]);G.bgColorAlpha=L.defaults.bgalpha;for(j in L.geometries){t=L.geometries[j];if(t.type=="bin_mesh"||t.type=="ascii_mesh")V+=1}Y=V;for(j in L.geometries){t=L.geometries[j];if(t.type=="cube"){q=new Cube(t.width,t.height,t.depth,t.segments_width,t.segments_height,null,t.flipped,t.sides);G.geometries[j]=q}else if(t.type=="plane"){q=new Plane(t.width,t.height,t.segments_width,
-t.segments_height);G.geometries[j]=q}else if(t.type=="sphere"){q=new Sphere(t.radius,t.segments_width,t.segments_height);G.geometries[j]=q}else if(t.type=="cylinder"){q=new Cylinder(t.numSegs,t.topRad,t.botRad,t.height,t.topOffset,t.botOffset);G.geometries[j]=q}else if(t.type=="torus"){q=new Torus(t.radius,t.tube,t.segmentsR,t.segmentsT);G.geometries[j]=q}else if(t.type=="icosahedron"){q=new Icosahedron(t.subdivisions);G.geometries[j]=q}else if(t.type=="bin_mesh")M.loadBinary({model:t.url,callback:h(j)});
-else t.type=="ascii_mesh"&&M.loadAscii({model:t.url,callback:h(j)})}for(x in L.textures){j=L.textures[x];S+=j.url instanceof Array?j.url.length:1}Z=S;for(x in L.textures){j=L.textures[x];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){t=ImageUtils.loadArray(j.url,f);t=new THREE.Texture(t,j.mapping)}else{t=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.min_filter]!=undefined)t.min_filter=THREE[j.min_filter];if(THREE[j.mag_filter]!=
-undefined)t.mag_filter=THREE[j.mag_filter]}G.textures[x]=t}for(m in L.materials){x=L.materials[m];for(I in x.parameters)if(I=="env_map"||I=="map"||I=="light_map")x.parameters[I]=G.textures[x.parameters[I]];else if(I=="shading")x.parameters[I]=x.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")x.parameters[I]=THREE[x.parameters[I]]?THREE[x.parameters[I]]:THREE.NormalBlending;else I=="combine"&&(x.parameters[I]=x.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);
-x=new THREE[x.type](x.parameters);G.materials[m]=x}g();b(G)}},addMesh:function(a,b,c,d,f,g,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragment_shader:d.fragment_shader,vertex_shader:d.vertex_shader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,
+THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};
+THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var d,f=c.length;for(d=0;d<f;d++){a=c[d];a.globalMatrix.extractPositionVector(this.soundPosition);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
+THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};
+THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
+var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,d=a.vertices.length,f=c?b.geometry:b,g=a.vertices,h=f.vertices,k=a.faces,j=f.faces,m=a.uvs;f=f.uvs;c&&b.matrixAutoUpdate&&b.updateMatrix();for(var n=0,w=h.length;n<w;n++){var q=new THREE.Vertex(h[n].position.clone());c&&b.localMatrix.multiplyVector3(q.position);g.push(q)}n=0;for(w=j.length;n<w;n++){h=j[n];var p,x=h.vertexNormals;if(h instanceof THREE.Face3)p=new THREE.Face3(h.a+d,h.b+d,h.c+d);else h instanceof THREE.Face4&&(p=new THREE.Face4(h.a+
+d,h.b+d,h.c+d,h.d+d));p.centroid.copy(h.centroid);p.normal.copy(h.normal);c=0;for(g=x.length;c<g;c++){q=x[c];p.vertexNormals.push(q.clone())}p.materials=h.materials.slice();k.push(p)}n=0;for(w=f.length;n<w;n++){d=f[n];k=[];c=0;for(g=d.length;c<g;c++)k.push(new THREE.UV(d[c].u,d[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var d=new Image,f=new THREE.Texture(d,b);d.onload=function(){f.needsUpdate=!0;c&&c(this)};d.src=a;return f},loadTextureCube:function(a,b,c){var d,f=[],g=new THREE.Texture(f,
+b);b=f.loadCount=0;for(d=a.length;b<d;++b){f[b]=new Image;f[b].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;c&&c(this)};f[b].src=a[b]}return g}},SceneUtils={loadScene:function(a,b,c,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(n in O.objects)if(!H.objects[n]){A=O.objects[n];if(o=H.geometries[A.geometry]){ea=[];for(i=0;i<A.materials.length;i++)ea[i]=H.materials[A.materials[i]];G=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(o,ea);object.position.set(G[0],
+G[1],G[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;H.scene.addObject(object);H.objects[n]=object}}}function h(V){return function(la){H.geometries[V]=la;g();W-=1;k()}}function k(){d({total_models:aa,total_textures:ba,loaded_models:aa-W,loaded_textures:ba-S},H);W==0&&S==0&&c(H)}var j,m,n,w,q,p,x,A,G,v,I,o,M,e,ea,O,P,W,S,aa,ba,H;O=f.data;P=new THREE.Loader;S=W=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},
+lights:{},fogs:{}};f=function(){S-=1;k()};for(q in O.cameras){v=O.cameras[q];if(v.type=="perspective")M=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){M=new THREE.Camera;M.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}G=v.position;v=v.target;M.position.set(G[0],G[1],G[2]);M.target.position.set(v[0],v[1],v[2]);H.cameras[q]=M}for(w in O.lights){q=O.lights[w];if(q.type=="directional"){G=q.direction;light=new THREE.DirectionalLight;light.position.set(G[0],
+G[1],G[2]);light.position.normalize()}else if(q.type=="point"){G=q.position;light=new THREE.PointLight;light.position.set(G[0],G[1],G[2])}v=q.color;i=q.intensity||1;light.color.setRGB(v[0]*i,v[1]*i,v[2]*i);H.scene.addLight(light);H.lights[w]=light}for(p in O.fogs){w=O.fogs[p];if(w.type=="linear")e=new THREE.Fog(0,w.near,w.far);else w.type=="exp2"&&(e=new THREE.FogExp2(0,w.density));v=w.color;e.color.setRGB(v[0],v[1],v[2]);H.fogs[p]=e}if(H.cameras&&O.defaults.camera)H.currentCamera=H.cameras[O.defaults.camera];
+if(H.fogs&&O.defaults.fog)H.scene.fog=H.fogs[O.defaults.fog];v=O.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(v[0],v[1],v[2]);H.bgColorAlpha=O.defaults.bgalpha;for(j in O.geometries){p=O.geometries[j];if(p.type=="bin_mesh"||p.type=="ascii_mesh")W+=1}aa=W;for(j in O.geometries){p=O.geometries[j];if(p.type=="cube"){o=new Cube(p.width,p.height,p.depth,p.segments_width,p.segments_height,null,p.flipped,p.sides);H.geometries[j]=o}else if(p.type=="plane"){o=new Plane(p.width,p.height,p.segments_width,
+p.segments_height);H.geometries[j]=o}else if(p.type=="sphere"){o=new Sphere(p.radius,p.segments_width,p.segments_height);H.geometries[j]=o}else if(p.type=="cylinder"){o=new Cylinder(p.numSegs,p.topRad,p.botRad,p.height,p.topOffset,p.botOffset);H.geometries[j]=o}else if(p.type=="torus"){o=new Torus(p.radius,p.tube,p.segmentsR,p.segmentsT);H.geometries[j]=o}else if(p.type=="icosahedron"){o=new Icosahedron(p.subdivisions);H.geometries[j]=o}else if(p.type=="bin_mesh")P.loadBinary({model:p.url,callback:h(j)});
+else p.type=="ascii_mesh"&&P.loadAscii({model:p.url,callback:h(j)})}for(x in O.textures){j=O.textures[x];S+=j.url instanceof Array?j.url.length:1}ba=S;for(x in O.textures){j=O.textures[x];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){p=ImageUtils.loadArray(j.url,f);p=new THREE.Texture(p,j.mapping)}else{p=ImageUtils.loadTexture(j.url,j.mapping,f);if(THREE[j.min_filter]!=undefined)p.min_filter=THREE[j.min_filter];if(THREE[j.mag_filter]!=
+undefined)p.mag_filter=THREE[j.mag_filter]}H.textures[x]=p}for(m in O.materials){x=O.materials[m];for(I in x.parameters)if(I=="env_map"||I=="map"||I=="light_map")x.parameters[I]=H.textures[x.parameters[I]];else if(I=="shading")x.parameters[I]=x.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")x.parameters[I]=THREE[x.parameters[I]]?THREE[x.parameters[I]]:THREE.NormalBlending;else I=="combine"&&(x.parameters[I]=x.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);
+x=new THREE[x.type](x.parameters);H.materials[m]=x}g();b(H)}},addMesh:function(a,b,c,d,f,g,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragment_shader:d.fragment_shader,vertex_shader:d.vertex_shader,uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,
 b,b,1,1,null,!0),c);a.addObject(b);return b},addPanoramaCube:function(a,b,c){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,
 b,b,1,1,null,!0),c);a.addObject(b);return b},addPanoramaCube:function(a,b,c){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,
 b,b,1,1,d,!0),new THREE.MeshFaceMaterial);a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var d=b/2;b=new Plane(b,b);var f=Math.PI/2,g=Math.PI;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,d,0,f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
 b,b,1,1,d,!0),new THREE.MeshFaceMaterial);a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var d=b/2;b=new Plane(b,b);var f=Math.PI/2,g=Math.PI;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,d,0,f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
 SceneUtils.addMesh(a,b,1,0,-d,0,-f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 SceneUtils.addMesh(a,b,1,0,-d,0,-f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
@@ -296,38 +304,38 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying ve
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragment_shader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,k){function j(A,F,v,I,q,J,e,aa){var L,M,V=d||1,S=f||1,Y=V+1,Z=S+1,G=q/2,U=J/2;q/=V;var na=J/S,W=m.vertices.length;if(A=="x"&&F=="y"||A=="y"&&F=="x")L="z";else if(A=="x"&&F=="z"||A=="z"&&F=="x")L="y";
-else if(A=="z"&&F=="y"||A=="y"&&F=="z")L="x";for(M=0;M<Z;M++)for(J=0;J<Y;J++){var ka=new THREE.Vector3;ka[A]=(J*q-G)*v;ka[F]=(M*na-U)*I;ka[L]=e;m.vertices.push(new THREE.Vertex(ka))}for(M=0;M<S;M++)for(J=0;J<V;J++){m.faces.push(new THREE.Face4(J+Y*M+W,J+Y*(M+1)+W,J+1+Y*(M+1)+W,J+1+Y*M+W,null,aa));m.uvs.push([new THREE.UV(J/V,M/S),new THREE.UV(J/V,(M+1)/S),new THREE.UV((J+1)/V,(M+1)/S),new THREE.UV((J+1)/V,M/S)])}}THREE.Geometry.call(this);var m=this,o=a/2,w=b/2,u=c/2;h=h?-1:1;if(g!==undefined)if(g instanceof
-Array)this.materials=g;else{this.materials=[];for(var t=0;t<6;t++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var x in k)this.sides[x]!=undefined&&(this.sides[x]=k[x]);this.sides.px&&j("z","y",1*h,-1,c,b,-o,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,c,b,o,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,c,w,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,c,-w,this.materials[3]);this.sides.pz&&j("x","y",1*h,-1,
-a,b,u,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,b,-u,this.materials[5]);(function(){for(var A=[],F=[],v=0,I=m.vertices.length;v<I;v++){for(var q=m.vertices[v],J=!1,e=0,aa=A.length;e<aa;e++){var L=A[e];if(q.position.x==L.position.x&&q.position.y==L.position.y&&q.position.z==L.position.z){F[v]=e;J=!0;break}}if(!J){F[v]=A.length;A.push(new THREE.Vertex(q.position.clone()))}}v=0;for(I=m.faces.length;v<I;v++){q=m.faces[v];q.a=F[q.a];q.b=F[q.b];q.c=F[q.c];q.d=F[q.d]}m.vertices=A})();this.computeCentroids();
+fragment_shader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,d,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;c=Array(g);for(b=d=0;b<g;++b){c[b]=Math.exp(-((b-f)*(b-f))/(2*a*a));d+=c[b]}for(b=0;b<g;++b)c[b]/=d;return c}},Cube=function(a,b,c,d,f,g,h,k){function j(A,G,v,I,o,M,e,ea){var O,P,W=d||1,S=f||1,aa=W+1,ba=S+1,H=o/2,V=M/2;o/=W;var la=M/S,Y=m.vertices.length;if(A=="x"&&G=="y"||A=="y"&&G=="x")O="z";else if(A=="x"&&G=="z"||A=="z"&&G=="x")O="y";
+else if(A=="z"&&G=="y"||A=="y"&&G=="z")O="x";for(P=0;P<ba;P++)for(M=0;M<aa;M++){var ka=new THREE.Vector3;ka[A]=(M*o-H)*v;ka[G]=(P*la-V)*I;ka[O]=e;m.vertices.push(new THREE.Vertex(ka))}for(P=0;P<S;P++)for(M=0;M<W;M++){m.faces.push(new THREE.Face4(M+aa*P+Y,M+aa*(P+1)+Y,M+1+aa*(P+1)+Y,M+1+aa*P+Y,null,ea));m.uvs.push([new THREE.UV(M/W,P/S),new THREE.UV(M/W,(P+1)/S),new THREE.UV((M+1)/W,(P+1)/S),new THREE.UV((M+1)/W,P/S)])}}THREE.Geometry.call(this);var m=this,n=a/2,w=b/2,q=c/2;h=h?-1:1;if(g!==undefined)if(g instanceof
+Array)this.materials=g;else{this.materials=[];for(var p=0;p<6;p++)this.materials.push([g])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var x in k)this.sides[x]!=undefined&&(this.sides[x]=k[x]);this.sides.px&&j("z","y",1*h,-1,c,b,-n,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,c,b,n,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,c,w,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,c,-w,this.materials[3]);this.sides.pz&&j("x","y",1*h,-1,
+a,b,q,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,b,-q,this.materials[5]);(function(){for(var A=[],G=[],v=0,I=m.vertices.length;v<I;v++){for(var o=m.vertices[v],M=!1,e=0,ea=A.length;e<ea;e++){var O=A[e];if(o.position.x==O.position.x&&o.position.y==O.position.y&&o.position.z==O.position.z){G[v]=e;M=!0;break}}if(!M){G[v]=A.length;A.push(new THREE.Vertex(o.position.clone()))}}v=0;for(I=m.faces.length;v<I;v++){o=m.faces[v];o.a=G[o.a];o.b=G[o.b];o.c=G[o.c];o.d=G[o.d]}m.vertices=A})();this.computeCentroids();
 this.computeFaceNormals();this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
 this.computeFaceNormals();this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,b,c,d,f){function g(m,o,w){h.vertices.push(new THREE.Vertex(new THREE.Vector3(m,o,w)))}THREE.Geometry.call(this);var h=this,k=Math.PI,j;for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*b,Math.cos(2*k*j/a)*b,0);for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*c,Math.cos(2*k*j/a)*c,d);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(c!=0){g(0,0,-f);for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b!=0){g(0,0,d+f);for(j=a+a/2;j<
+var Cylinder=function(a,b,c,d,f){function g(m,n,w){h.vertices.push(new THREE.Vertex(new THREE.Vector3(m,n,w)))}THREE.Geometry.call(this);var h=this,k=Math.PI,j;for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*b,Math.cos(2*k*j/a)*b,0);for(j=0;j<a;j++)g(Math.sin(2*k*j/a)*c,Math.cos(2*k*j/a)*c,d);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(c!=0){g(0,0,-f);for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b!=0){g(0,0,d+f);for(j=a+a/2;j<
 2*a;j++)h.faces.push(new THREE.Face4((2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
 2*a;j++)h.faces.push(new THREE.Face4((2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
 var Plane=function(a,b,c,d){THREE.Geometry.call(this);var f,g=a/2,h=b/2;c=c||1;d=d||1;var k=c+1,j=d+1;a/=c;var m=b/d;for(f=0;f<j;f++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*m-h),0)));for(f=0;f<d;f++)for(b=0;b<c;b++){this.faces.push(new THREE.Face4(b+k*f,b+k*(f+1),b+1+k*(f+1),b+1+k*f));this.uvs.push([new THREE.UV(b/c,f/d),new THREE.UV(b/c,(f+1)/d),new THREE.UV((b+1)/c,(f+1)/d),new THREE.UV((b+1)/c,f/d)])}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
 var Plane=function(a,b,c,d){THREE.Geometry.call(this);var f,g=a/2,h=b/2;c=c||1;d=d||1;var k=c+1,j=d+1;a/=c;var m=b/d;for(f=0;f<j;f++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*m-h),0)));for(f=0;f<d;f++)for(b=0;b<c;b++){this.faces.push(new THREE.Face4(b+k*f,b+k*(f+1),b+1+k*(f+1),b+1+k*f));this.uvs.push([new THREE.UV(b/c,f/d),new THREE.UV(b/c,(f+1)/d),new THREE.UV((b+1)/c,(f+1)/d),new THREE.UV((b+1)/c,f/d)])}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(a,b,c){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c<h+1;c++){d=c/h;var k=a*Math.cos(d*f),j=a*Math.sin(d*f),m=[],o=0;for(d=0;d<g;d++){var w=2*d/g,u=j*Math.sin(w*f);w=j*Math.cos(w*f);(c==0||c==h)&&d>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,k,u)))-1);m.push(o)}b.push(m)}var t,x,A;f=b.length;for(c=0;c<f;c++){g=b[c].length;if(c>0)for(d=0;d<g;d++){m=d==g-1;h=b[c][m?0:d+1];k=b[c][m?g-1:d];j=b[c-1][m?g-1:d];m=b[c-1][m?
-0:d+1];u=c/(f-1);t=(c-1)/(f-1);x=(d+1)/g;w=d/g;o=new THREE.UV(1-x,u);u=new THREE.UV(1-w,u);w=new THREE.UV(1-w,t);var F=new THREE.UV(1-x,t);if(c<b.length-1){t=this.vertices[h].position.clone();x=this.vertices[k].position.clone();A=this.vertices[j].position.clone();t.normalize();x.normalize();A.normalize();this.faces.push(new THREE.Face3(h,k,j,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([o,u,w])}if(c>1){t=this.vertices[h].position.clone();
-x=this.vertices[j].position.clone();A=this.vertices[m].position.clone();t.normalize();x.normalize();A.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([o,w,F])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Sphere=function(a,b,c){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c<h+1;c++){d=c/h;var k=a*Math.cos(d*f),j=a*Math.sin(d*f),m=[],n=0;for(d=0;d<g;d++){var w=2*d/g,q=j*Math.sin(w*f);w=j*Math.cos(w*f);(c==0||c==h)&&d>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,k,q)))-1);m.push(n)}b.push(m)}var p,x,A;f=b.length;for(c=0;c<f;c++){g=b[c].length;if(c>0)for(d=0;d<g;d++){m=d==g-1;h=b[c][m?0:d+1];k=b[c][m?g-1:d];j=b[c-1][m?g-1:d];m=b[c-1][m?
+0:d+1];q=c/(f-1);p=(c-1)/(f-1);x=(d+1)/g;w=d/g;n=new THREE.UV(1-x,q);q=new THREE.UV(1-w,q);w=new THREE.UV(1-w,p);var G=new THREE.UV(1-x,p);if(c<b.length-1){p=this.vertices[h].position.clone();x=this.vertices[k].position.clone();A=this.vertices[j].position.clone();p.normalize();x.normalize();A.normalize();this.faces.push(new THREE.Face3(h,k,j,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([n,q,w])}if(c>1){p=this.vertices[h].position.clone();
+x=this.vertices[j].position.clone();A=this.vertices[m].position.clone();p.normalize();x.normalize();A.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([n,w,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
 var Torus=function(a,b,c,d){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){d=c/this.segmentsT*2*Math.PI;var f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
 var Torus=function(a,b,c,d){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){d=c/this.segmentsT*2*Math.PI;var f=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),this.tube*Math.sin(f))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
 1;c<=this.segmentsT;++c){d=(this.segmentsT+1)*b+c;f=(this.segmentsT+1)*b+c-1;var g=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(d,f,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
 1;c<=this.segmentsT;++c){d=(this.segmentsT+1)*b+c;f=(this.segmentsT+1)*b+c-1;var g=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(d,f,g,h));this.uvs.push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var Icosahedron=function(a){function b(w,u,t){var x=Math.sqrt(w*w+u*u+t*t);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(w/x,u/x,t/x)))-1}function c(w,u,t,x){x.faces.push(new THREE.Face3(w,u,t))}function d(w,u){var t=f.vertices[w].position,x=f.vertices[u].position;return b((t.x+x.x)/2,(t.y+x.y)/2,(t.z+x.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
-1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var j=d(g.faces[k].a,g.faces[k].b),m=d(g.faces[k].b,g.faces[k].c),o=d(g.faces[k].c,g.faces[k].a);c(g.faces[k].a,j,o,h);c(g.faces[k].b,m,j,h);c(g.faces[k].c,
-o,m,h);c(j,m,o,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
+var Icosahedron=function(a){function b(w,q,p){var x=Math.sqrt(w*w+q*q+p*p);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(w/x,q/x,p/x)))-1}function c(w,q,p,x){x.faces.push(new THREE.Face3(w,q,p))}function d(w,q){var p=f.vertices[w].position,x=f.vertices[q].position;return b((p.x+x.x)/2,(p.y+x.y)/2,(p.z+x.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
+1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,1,7,g);c(0,7,10,g);c(0,10,11,g);c(1,5,9,g);c(5,11,4,g);c(11,10,2,g);c(10,7,6,g);c(7,1,8,g);c(3,9,4,g);c(3,4,2,g);c(3,2,6,g);c(3,6,8,g);c(3,8,9,g);c(4,9,5,g);c(2,4,11,g);c(6,2,10,g);c(8,6,7,g);c(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var j=d(g.faces[k].a,g.faces[k].b),m=d(g.faces[k].b,g.faces[k].c),n=d(g.faces[k].c,g.faces[k].a);c(g.faces[k].a,j,n,h);c(g.faces[k].b,m,j,h);c(g.faces[k].c,
+n,m,h);c(j,m,n,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
 function LathedObject(a,b,c){THREE.Geometry.call(this);c=c||2*Math.PI;b=c/(b||12);for(var d=[],f=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));f[k]=this.vertices.length-1;d[k]=new THREE.Vector3(a[k].x,a[k].y,a[k].z)}for(var j=THREE.Matrix4.rotationZMatrix(b),m=0;m<=c+0.0010;m+=b){for(k=0;k<d.length;k++)if(m<c){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],
 function LathedObject(a,b,c){THREE.Geometry.call(this);c=c||2*Math.PI;b=c/(b||12);for(var d=[],f=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));f[k]=this.vertices.length-1;d[k]=new THREE.Vector3(a[k].x,a[k].y,a[k].z)}for(var j=THREE.Matrix4.rotationZMatrix(b),m=0;m<=c+0.0010;m+=b){for(k=0;k<d.length;k++)if(m<c){d[k]=j.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));g[k]=this.vertices.length-1}else g=h;m==0&&(h=f);for(k=0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],
 g[k+1],f[k+1],f[k]));this.uvs.push([new THREE.UV(m/c,k/a.length),new THREE.UV(m/c,(k+1)/a.length),new THREE.UV((m-b)/c,(k+1)/a.length),new THREE.UV((m-b)/c,k/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 g[k+1],f[k+1],f[k]));this.uvs.push([new THREE.UV(m/c,k/a.length),new THREE.UV(m/c,(k+1)/a.length),new THREE.UV((m-b)/c,(k+1)/a.length),new THREE.UV((m-b)/c,k/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(c){this.isolation=80;this.size=c;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
 THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(c){this.isolation=80;this.size=c;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,d,f){return c+(d-c)*f};this.VIntX=function(c,d,f,g,h,k,j,m,o,w){h=(h-o)/(w-o);o=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=j;d[g+2]=m;f[g]=this.lerp(o[c],o[c+3],h);f[g+1]=this.lerp(o[c+1],o[c+4],h);f[g+2]=this.lerp(o[c+2],o[c+5],h)};this.VIntY=function(c,d,f,g,h,k,j,m,o,w){h=(h-o)/(w-o);o=this.normal_cache;d[g]=k;d[g+1]=j+h*this.delta;d[g+
-2]=m;d=c+this.yd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.VIntZ=function(c,d,f,g,h,k,j,m,o,w){h=(h-o)/(w-o);o=this.normal_cache;d[g]=k;d[g+1]=j;d[g+2]=m+h*this.delta;d=c+this.zd*3;f[g]=this.lerp(o[c],o[d],h);f[g+1]=this.lerp(o[c+1],o[d+1],h);f[g+2]=this.lerp(o[c+2],o[d+2],h)};this.compNorm=function(c){var d=c*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[c-1]-this.field[c+1];this.normal_cache[d+1]=this.field[c-this.yd]-
-this.field[c+this.yd];this.normal_cache[d+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,d,f,g,h,k){var j=g+1,m=g+this.yd,o=g+this.zd,w=j+this.yd,u=j+this.zd,t=g+this.yd+this.zd,x=j+this.yd+this.zd,A=0,F=this.field[g],v=this.field[j],I=this.field[m],q=this.field[w],J=this.field[o],e=this.field[u],aa=this.field[t],L=this.field[x];F<h&&(A|=1);v<h&&(A|=2);I<h&&(A|=8);q<h&&(A|=4);J<h&&(A|=16);e<h&&(A|=32);aa<h&&(A|=128);L<h&&(A|=64);var M=THREE.edgeTable[A];if(M==0)return 0;
-var V=this.delta,S=c+V,Y=d+V;V=f+V;if(M&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,c,d,f,F,v)}if(M&2){this.compNorm(j);this.compNorm(w);this.VIntY(j*3,this.vlist,this.nlist,3,h,S,d,f,v,q)}if(M&4){this.compNorm(m);this.compNorm(w);this.VIntX(m*3,this.vlist,this.nlist,6,h,c,Y,f,I,q)}if(M&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,c,d,f,F,I)}if(M&16){this.compNorm(o);this.compNorm(u);this.VIntX(o*3,this.vlist,this.nlist,12,h,c,d,V,
-J,e)}if(M&32){this.compNorm(u);this.compNorm(x);this.VIntY(u*3,this.vlist,this.nlist,15,h,S,d,V,e,L)}if(M&64){this.compNorm(t);this.compNorm(x);this.VIntX(t*3,this.vlist,this.nlist,18,h,c,Y,V,aa,L)}if(M&128){this.compNorm(o);this.compNorm(t);this.VIntY(o*3,this.vlist,this.nlist,21,h,c,d,V,J,aa)}if(M&256){this.compNorm(g);this.compNorm(o);this.VIntZ(g*3,this.vlist,this.nlist,24,h,c,d,f,F,J)}if(M&512){this.compNorm(j);this.compNorm(u);this.VIntZ(j*3,this.vlist,this.nlist,27,h,S,d,f,v,e)}if(M&1024){this.compNorm(w);
-this.compNorm(x);this.VIntZ(w*3,this.vlist,this.nlist,30,h,S,Y,f,q,L)}if(M&2048){this.compNorm(m);this.compNorm(t);this.VIntZ(m*3,this.vlist,this.nlist,33,h,c,Y,f,I,aa)}A<<=4;for(h=g=0;THREE.triTable[A+h]!=-1;){c=A+h;d=c+1;f=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[d],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(c,d,f,g,h,k){var j=this.count*3;this.positionArray[j]=c[f];this.positionArray[j+1]=c[f+1];this.positionArray[j+2]=c[f+2];this.positionArray[j+
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,d,f){return c+(d-c)*f};this.VIntX=function(c,d,f,g,h,k,j,m,n,w){h=(h-n)/(w-n);n=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=j;d[g+2]=m;f[g]=this.lerp(n[c],n[c+3],h);f[g+1]=this.lerp(n[c+1],n[c+4],h);f[g+2]=this.lerp(n[c+2],n[c+5],h)};this.VIntY=function(c,d,f,g,h,k,j,m,n,w){h=(h-n)/(w-n);n=this.normal_cache;d[g]=k;d[g+1]=j+h*this.delta;d[g+
+2]=m;d=c+this.yd*3;f[g]=this.lerp(n[c],n[d],h);f[g+1]=this.lerp(n[c+1],n[d+1],h);f[g+2]=this.lerp(n[c+2],n[d+2],h)};this.VIntZ=function(c,d,f,g,h,k,j,m,n,w){h=(h-n)/(w-n);n=this.normal_cache;d[g]=k;d[g+1]=j;d[g+2]=m+h*this.delta;d=c+this.zd*3;f[g]=this.lerp(n[c],n[d],h);f[g+1]=this.lerp(n[c+1],n[d+1],h);f[g+2]=this.lerp(n[c+2],n[d+2],h)};this.compNorm=function(c){var d=c*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[c-1]-this.field[c+1];this.normal_cache[d+1]=this.field[c-this.yd]-
+this.field[c+this.yd];this.normal_cache[d+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,d,f,g,h,k){var j=g+1,m=g+this.yd,n=g+this.zd,w=j+this.yd,q=j+this.zd,p=g+this.yd+this.zd,x=j+this.yd+this.zd,A=0,G=this.field[g],v=this.field[j],I=this.field[m],o=this.field[w],M=this.field[n],e=this.field[q],ea=this.field[p],O=this.field[x];G<h&&(A|=1);v<h&&(A|=2);I<h&&(A|=8);o<h&&(A|=4);M<h&&(A|=16);e<h&&(A|=32);ea<h&&(A|=128);O<h&&(A|=64);var P=THREE.edgeTable[A];if(P==0)return 0;
+var W=this.delta,S=c+W,aa=d+W;W=f+W;if(P&1){this.compNorm(g);this.compNorm(j);this.VIntX(g*3,this.vlist,this.nlist,0,h,c,d,f,G,v)}if(P&2){this.compNorm(j);this.compNorm(w);this.VIntY(j*3,this.vlist,this.nlist,3,h,S,d,f,v,o)}if(P&4){this.compNorm(m);this.compNorm(w);this.VIntX(m*3,this.vlist,this.nlist,6,h,c,aa,f,I,o)}if(P&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,c,d,f,G,I)}if(P&16){this.compNorm(n);this.compNorm(q);this.VIntX(n*3,this.vlist,this.nlist,12,h,c,d,
+W,M,e)}if(P&32){this.compNorm(q);this.compNorm(x);this.VIntY(q*3,this.vlist,this.nlist,15,h,S,d,W,e,O)}if(P&64){this.compNorm(p);this.compNorm(x);this.VIntX(p*3,this.vlist,this.nlist,18,h,c,aa,W,ea,O)}if(P&128){this.compNorm(n);this.compNorm(p);this.VIntY(n*3,this.vlist,this.nlist,21,h,c,d,W,M,ea)}if(P&256){this.compNorm(g);this.compNorm(n);this.VIntZ(g*3,this.vlist,this.nlist,24,h,c,d,f,G,M)}if(P&512){this.compNorm(j);this.compNorm(q);this.VIntZ(j*3,this.vlist,this.nlist,27,h,S,d,f,v,e)}if(P&1024){this.compNorm(w);
+this.compNorm(x);this.VIntZ(w*3,this.vlist,this.nlist,30,h,S,aa,f,o,O)}if(P&2048){this.compNorm(m);this.compNorm(p);this.VIntZ(m*3,this.vlist,this.nlist,33,h,c,aa,f,I,ea)}A<<=4;for(h=g=0;THREE.triTable[A+h]!=-1;){c=A+h;d=c+1;f=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[d],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(c,d,f,g,h,k){var j=this.count*3;this.positionArray[j]=c[f];this.positionArray[j+1]=c[f+1];this.positionArray[j+2]=c[f+2];this.positionArray[j+
 3]=c[g];this.positionArray[j+4]=c[g+1];this.positionArray[j+5]=c[g+2];this.positionArray[j+6]=c[h];this.positionArray[j+7]=c[h+1];this.positionArray[j+8]=c[h+2];this.normalArray[j]=d[f];this.normalArray[j+1]=d[f+1];this.normalArray[j+2]=d[f+2];this.normalArray[j+3]=d[g];this.normalArray[j+4]=d[g+1];this.normalArray[j+5]=d[g+2];this.normalArray[j+6]=d[h];this.normalArray[j+7]=d[h+1];this.normalArray[j+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
 3]=c[g];this.positionArray[j+4]=c[g+1];this.positionArray[j+5]=c[g+2];this.positionArray[j+6]=c[h];this.positionArray[j+7]=c[h+1];this.positionArray[j+8]=c[h+2];this.normalArray[j]=d[f];this.normalArray[j+1]=d[f+1];this.normalArray[j+2]=d[f+2];this.normalArray[j+3]=d[g];this.normalArray[j+4]=d[g+1];this.normalArray[j+5]=d[g+2];this.normalArray[j+6]=d[h];this.normalArray[j+7]=d[h+1];this.normalArray[j+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
-function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;c(this)}};this.addBall=function(c,d,f,g,h){var k=this.size*Math.sqrt(g/h),j=f*this.size,m=d*this.size,o=c*this.size,w=Math.floor(j-k);w<1&&(w=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var u=Math.floor(m-k);u<1&&(u=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(o-k);t<1&&(t=1);k=Math.floor(o+k);
-k>this.size-1&&(k=this.size-1);for(var x,A,F,v,I,q;w<j;w++){o=this.size2*w;A=w/this.size-f;I=A*A;for(A=u;A<m;A++){F=o+this.size*A;x=A/this.size-d;q=x*x;for(x=t;x<k;x++){v=x/this.size-c;v=g/(1.0E-6+v*v+q+I)-h;v>0&&(this.field[F+x]+=v)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,o=this.yd,w=this.zd,u=this.field,t=m*Math.sqrt(c/d);t>m&&(t=m);for(f=0;f<t;f++){g=f/m;g*=g;k=c/(1.0E-4+g)-d;if(k>0)for(g=0;g<m;g++){j=f+g*o;for(h=0;h<m;h++)u[w*h+j]+=k}}};this.addPlaneY=function(c,d){var f,g,
-h,k,j,m,o=this.size,w=this.yd,u=this.zd,t=this.field,x=o*Math.sqrt(c/d);x>o&&(x=o);for(g=0;g<x;g++){f=g/o;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=g*w;for(f=0;f<o;f++){m=j+f;for(h=0;h<o;h++)t[u*h+m]+=k}}}};this.addPlaneZ=function(c,d){var f,g,h,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=zd*h;for(g=0;g<size;g++){m=j+g*yd;for(f=0;f<size;f++)field[m+f]+=k}}}};this.reset=function(){var c;
-for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var d,f,g,h,k,j,m,o,w,u=this.size-2;for(h=1;h<u;h++){w=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<u;g++){o=w+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<u;f++){k=(f-this.halfsize)/this.halfsize;d=o+f;this.polygonize(k,j,m,d,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,d=new THREE.Geometry;this.render(function(f){var g,h,k,j,m,o,w,u;for(g=
-0;g<f.count;g++){m=g*3;w=m+1;u=m+2;h=f.positionArray[m];k=f.positionArray[w];j=f.positionArray[u];o=new THREE.Vector3(h,k,j);h=f.normalArray[m];k=f.normalArray[w];j=f.normalArray[u];m=new THREE.Vector3(h,k,j);m.normalize();m=new THREE.Vertex(o,m);d.vertices.push(m)}nfaces=f.count/3;for(g=0;g<nfaces;g++){m=(c+g)*3;w=m+1;u=m+2;o=d.vertices[m].normal;h=d.vertices[w].normal;k=d.vertices[u].normal;m=new THREE.Face3(m,w,u,[o,h,k]);d.faces.push(m)}c+=nfaces;f.count=0});d.sortFacesByMaterial();return d};
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(c){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;c(this)}};this.addBall=function(c,d,f,g,h){var k=this.size*Math.sqrt(g/h),j=f*this.size,m=d*this.size,n=c*this.size,w=Math.floor(j-k);w<1&&(w=1);j=Math.floor(j+k);j>this.size-1&&(j=this.size-1);var q=Math.floor(m-k);q<1&&(q=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var p=Math.floor(n-k);p<1&&(p=1);k=Math.floor(n+k);
+k>this.size-1&&(k=this.size-1);for(var x,A,G,v,I,o;w<j;w++){n=this.size2*w;A=w/this.size-f;I=A*A;for(A=q;A<m;A++){G=n+this.size*A;x=A/this.size-d;o=x*x;for(x=p;x<k;x++){v=x/this.size-c;v=g/(1.0E-6+v*v+o+I)-h;v>0&&(this.field[G+x]+=v)}}}};this.addPlaneX=function(c,d){var f,g,h,k,j,m=this.size,n=this.yd,w=this.zd,q=this.field,p=m*Math.sqrt(c/d);p>m&&(p=m);for(f=0;f<p;f++){g=f/m;g*=g;k=c/(1.0E-4+g)-d;if(k>0)for(g=0;g<m;g++){j=f+g*n;for(h=0;h<m;h++)q[w*h+j]+=k}}};this.addPlaneY=function(c,d){var f,g,
+h,k,j,m,n=this.size,w=this.yd,q=this.zd,p=this.field,x=n*Math.sqrt(c/d);x>n&&(x=n);for(g=0;g<x;g++){f=g/n;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=g*w;for(f=0;f<n;f++){m=j+f;for(h=0;h<n;h++)p[q*h+m]+=k}}}};this.addPlaneZ=function(c,d){var f,g,h,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=c/(1.0E-4+f)-d;if(k>0){j=zd*h;for(g=0;g<size;g++){m=j+g*yd;for(f=0;f<size;f++)field[m+f]+=k}}}};this.reset=function(){var c;
+for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var d,f,g,h,k,j,m,n,w,q=this.size-2;for(h=1;h<q;h++){w=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<q;g++){n=w+this.size*g;j=(g-this.halfsize)/this.halfsize;for(f=1;f<q;f++){k=(f-this.halfsize)/this.halfsize;d=n+f;this.polygonize(k,j,m,d,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,d=new THREE.Geometry;this.render(function(f){var g,h,k,j,m,n,w,q;for(g=
+0;g<f.count;g++){m=g*3;w=m+1;q=m+2;h=f.positionArray[m];k=f.positionArray[w];j=f.positionArray[q];n=new THREE.Vector3(h,k,j);h=f.normalArray[m];k=f.normalArray[w];j=f.normalArray[q];m=new THREE.Vector3(h,k,j);m.normalize();m=new THREE.Vertex(n,m);d.vertices.push(m)}nfaces=f.count/3;for(g=0;g<nfaces;g++){m=(c+g)*3;w=m+1;q=m+2;n=d.vertices[m].normal;h=d.vertices[w].normal;k=d.vertices[q].normal;m=new THREE.Face3(m,w,q,[n,h,k]);d.faces.push(m)}c+=nfaces;f.count=0});d.sortFacesByMaterial();return d};
 this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
@@ -357,24 +365,24 @@ THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement
 b},loadAsciiOld:function(a,b){var c=document.createElement("script");c.type="text/javascript";c.onload=b;c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},loadAscii:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);b.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,c,d)};b.postMessage(a)},loadBinary:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:
 b},loadAsciiOld:function(a,b){var c=document.createElement("script");c.type="text/javascript";c.onload=b;c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},loadAscii:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);b.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,c,d)};b.postMessage(a)},loadBinary:function(a){var b=a.model,c=a.callback,d=a.texture_path?a.texture_path:
 THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,c,f,d,g)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,c,d,f,g){var h=new XMLHttpRequest,k=d+"/"+a,j=0;
 THREE.Loader.prototype.extractUrlbase(b),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,c,f,d,g)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,c,d,f,g){var h=new XMLHttpRequest,k=d+"/"+a,j=0;
 h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,c,f,b):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){j==0&&(j=h.getResponseHeader("Content-Length"));g({total:j,loaded:h.responseText.length})}}else h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
 h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,c,f,b):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){j==0&&(j=h.getResponseHeader("Content-Length"));g({total:j,loaded:h.responseText.length})}}else h.readyState==2&&(j=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
-createBinModel:function(a,b,c,d){var f=function(g){function h(y,E){var D=o(y,E),P=o(y,E+1),T=o(y,E+2),oa=o(y,E+3),la=(oa<<1&255|T>>7)-127;D|=(T&127)<<16|P<<8;if(D==0&&la==-127)return 0;return(1-2*(oa>>7))*(1+D*Math.pow(2,-23))*Math.pow(2,la)}function k(y,E){var D=o(y,E),P=o(y,E+1),T=o(y,E+2);return(o(y,E+3)<<24)+(T<<16)+(P<<8)+D}function j(y,E){var D=o(y,E);return(o(y,E+1)<<8)+D}function m(y,E){var D=o(y,E);return D>127?D-256:D}function o(y,E){return y.charCodeAt(E)&255}function w(y){var E,D,P;E=
-k(a,y);D=k(a,y+aa);P=k(a,y+L);y=j(a,y+M);THREE.Loader.prototype.f3(v,E,D,P,y)}function u(y){var E,D,P,T,oa,la;E=k(a,y);D=k(a,y+aa);P=k(a,y+L);T=j(a,y+M);oa=k(a,y+V);la=k(a,y+S);y=k(a,y+Y);THREE.Loader.prototype.f3n(v,J,E,D,P,T,oa,la,y)}function t(y){var E,D,P,T;E=k(a,y);D=k(a,y+Z);P=k(a,y+G);T=k(a,y+U);y=j(a,y+na);THREE.Loader.prototype.f4(v,E,D,P,T,y)}function x(y){var E,D,P,T,oa,la,ja,ma;E=k(a,y);D=k(a,y+Z);P=k(a,y+G);T=k(a,y+U);oa=j(a,y+na);la=k(a,y+W);ja=k(a,y+ka);ma=k(a,y+ha);y=k(a,y+da);THREE.Loader.prototype.f4n(v,
-J,E,D,P,T,oa,la,ja,ma,y)}function A(y){var E,D;E=k(a,y);D=k(a,y+ra);y=k(a,y+ya);THREE.Loader.prototype.uv3(v.uvs,e[E*2],e[E*2+1],e[D*2],e[D*2+1],e[y*2],e[y*2+1])}function F(y){var E,D,P;E=k(a,y);D=k(a,y+l);P=k(a,y+z);y=k(a,y+B);THREE.Loader.prototype.uv4(v.uvs,e[E*2],e[E*2+1],e[D*2],e[D*2+1],e[P*2],e[P*2+1],e[y*2],e[y*2+1])}var v=this,I=0,q,J=[],e=[],aa,L,M,V,S,Y,Z,G,U,na,W,ka,ha,da,ra,ya,l,z,B,p,n,C,H,N,ba;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);q={signature:a.substr(I,
-8),header_bytes:o(a,I+8),vertex_coordinate_bytes:o(a,I+9),normal_coordinate_bytes:o(a,I+10),uv_coordinate_bytes:o(a,I+11),vertex_index_bytes:o(a,I+12),normal_index_bytes:o(a,I+13),uv_index_bytes:o(a,I+14),material_index_bytes:o(a,I+15),nvertices:k(a,I+16),nnormals:k(a,I+16+4),nuvs:k(a,I+16+8),ntri_flat:k(a,I+16+12),ntri_smooth:k(a,I+16+16),ntri_flat_uv:k(a,I+16+20),ntri_smooth_uv:k(a,I+16+24),nquad_flat:k(a,I+16+28),nquad_smooth:k(a,I+16+32),nquad_flat_uv:k(a,I+16+36),nquad_smooth_uv:k(a,I+16+40)};
-I+=q.header_bytes;aa=q.vertex_index_bytes;L=q.vertex_index_bytes*2;M=q.vertex_index_bytes*3;V=q.vertex_index_bytes*3+q.material_index_bytes;S=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;Y=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;Z=q.vertex_index_bytes;G=q.vertex_index_bytes*2;U=q.vertex_index_bytes*3;na=q.vertex_index_bytes*4;W=q.vertex_index_bytes*4+q.material_index_bytes;ka=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;ha=q.vertex_index_bytes*
-4+q.material_index_bytes+q.normal_index_bytes*2;da=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;ra=q.uv_index_bytes;ya=q.uv_index_bytes*2;l=q.uv_index_bytes;z=q.uv_index_bytes*2;B=q.uv_index_bytes*3;g=q.vertex_index_bytes*3+q.material_index_bytes;ba=q.vertex_index_bytes*4+q.material_index_bytes;p=q.ntri_flat*g;n=q.ntri_smooth*(g+q.normal_index_bytes*3);C=q.ntri_flat_uv*(g+q.uv_index_bytes*3);H=q.ntri_smooth_uv*(g+q.normal_index_bytes*3+q.uv_index_bytes*3);N=q.nquad_flat*ba;
-g=q.nquad_smooth*(ba+q.normal_index_bytes*4);ba=q.nquad_flat_uv*(ba+q.uv_index_bytes*4);I+=function(y){for(var E,D,P,T=q.vertex_coordinate_bytes*3,oa=y+q.nvertices*T;y<oa;y+=T){E=h(a,y);D=h(a,y+q.vertex_coordinate_bytes);P=h(a,y+q.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,E,D,P)}return q.nvertices*T}(I);I+=function(y){for(var E,D,P,T=q.normal_coordinate_bytes*3,oa=y+q.nnormals*T;y<oa;y+=T){E=m(a,y);D=m(a,y+q.normal_coordinate_bytes);P=m(a,y+q.normal_coordinate_bytes*2);J.push(E/127,D/
-127,P/127)}return q.nnormals*T}(I);I+=function(y){for(var E,D,P=q.uv_coordinate_bytes*2,T=y+q.nuvs*P;y<T;y+=P){E=h(a,y);D=h(a,y+q.uv_coordinate_bytes);e.push(E,D)}return q.nuvs*P}(I);p=I+p;n=p+n;C=n+C;H=C+H;N=H+N;g=N+g;ba=g+ba;(function(y){var E,D=q.vertex_index_bytes*3+q.material_index_bytes,P=D+q.uv_index_bytes*3,T=y+q.ntri_flat_uv*P;for(E=y;E<T;E+=P){w(E);A(E+D)}return T-y})(n);(function(y){var E,D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,P=D+q.uv_index_bytes*3,T=y+
-q.ntri_smooth_uv*P;for(E=y;E<T;E+=P){u(E);A(E+D)}return T-y})(C);(function(y){var E,D=q.vertex_index_bytes*4+q.material_index_bytes,P=D+q.uv_index_bytes*4,T=y+q.nquad_flat_uv*P;for(E=y;E<T;E+=P){t(E);F(E+D)}return T-y})(g);(function(y){var E,D=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,P=D+q.uv_index_bytes*4,T=y+q.nquad_smooth_uv*P;for(E=y;E<T;E+=P){x(E);F(E+D)}return T-y})(ba);(function(y){var E,D=q.vertex_index_bytes*3+q.material_index_bytes,P=y+q.ntri_flat*D;for(E=y;E<
-P;E+=D)w(E);return P-y})(I);(function(y){var E,D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,P=y+q.ntri_smooth*D;for(E=y;E<P;E+=D)u(E);return P-y})(p);(function(y){var E,D=q.vertex_index_bytes*4+q.material_index_bytes,P=y+q.nquad_flat*D;for(E=y;E<P;E+=D)t(E);return P-y})(H);(function(y){var E,D=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,P=y+q.nquad_smooth*D;for(E=y;E<P;E+=D)x(E);return P-y})(N);this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
-f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},createModel:function(a,b,c){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){var h,k,j,m,o;h=0;for(k=a.vertices.length;h<k;h+=3){j=a.vertices[h];m=a.vertices[h+1];o=a.vertices[h+2];THREE.Loader.prototype.v(g,j,m,o)}if(a.colors){h=0;for(k=a.colors.length;h<k;h+=3){j=a.colors[h];m=a.colors[h+1];o=a.colors[h+2];THREE.Loader.prototype.vc(g,j,m,o)}}})();(function(){function h(x,
-A){THREE.Loader.prototype.f3(g,x[A],x[A+1],x[A+2],x[A+3])}function k(x,A){THREE.Loader.prototype.f3n(g,a.normals,x[A],x[A+1],x[A+2],x[A+3],x[A+4],x[A+5],x[A+6])}function j(x,A){THREE.Loader.prototype.f4(g,x[A],x[A+1],x[A+2],x[A+3],x[A+4])}function m(x,A){THREE.Loader.prototype.f4n(g,a.normals,x[A],x[A+1],x[A+2],x[A+3],x[A+4],x[A+5],x[A+6],x[A+7],x[A+8])}function o(x,A){var F,v,I,q,J,e,aa,L,M;F=x[A];v=x[A+1];I=x[A+2];q=a.uvs[F*2];aa=a.uvs[F*2+1];J=a.uvs[v*2];L=a.uvs[v*2+1];e=a.uvs[I*2];M=a.uvs[I*2+
-1];THREE.Loader.prototype.uv3(g.uvs,q,aa,J,L,e,M);if(a.uvs2&&a.uvs2.length){q=a.uvs2[F*2];aa=a.uvs2[F*2+1];J=a.uvs2[v*2];L=a.uvs2[v*2+1];e=a.uvs2[I*2];M=a.uvs2[I*2+1];THREE.Loader.prototype.uv3(g.uvs2,q,1-aa,J,1-L,e,1-M)}}function w(x,A){var F,v,I,q,J,e,aa,L,M,V,S,Y;F=x[A];v=x[A+1];I=x[A+2];q=x[A+3];J=a.uvs[F*2];M=a.uvs[F*2+1];e=a.uvs[v*2];V=a.uvs[v*2+1];aa=a.uvs[I*2];S=a.uvs[I*2+1];L=a.uvs[q*2];Y=a.uvs[q*2+1];THREE.Loader.prototype.uv4(g.uvs,J,M,e,V,aa,S,L,Y);if(a.uvs2){J=a.uvs2[F*2];M=a.uvs2[F*
-2+1];e=a.uvs2[v*2];V=a.uvs2[v*2+1];aa=a.uvs2[I*2];S=a.uvs2[I*2+1];L=a.uvs2[q*2];Y=a.uvs2[q*2+1];THREE.Loader.prototype.uv4(g.uvs2,J,1-M,e,1-V,aa,1-S,L,1-Y)}}var u,t;u=0;for(t=a.triangles_uv.length;u<t;u+=7){h(a.triangles_uv,u);o(a.triangles_uv,u+4)}u=0;for(t=a.triangles_n_uv.length;u<t;u+=10){k(a.triangles_n_uv,u);o(a.triangles_n_uv,u+7)}u=0;for(t=a.quads_uv.length;u<t;u+=9){j(a.quads_uv,u);w(a.quads_uv,u+5)}u=0;for(t=a.quads_n_uv.length;u<t;u+=13){m(a.quads_n_uv,u);w(a.quads_n_uv,u+9)}u=0;for(t=
-a.triangles.length;u<t;u+=4)h(a.triangles,u);u=0;for(t=a.triangles_n.length;u<t;u+=7)k(a.triangles_n,u);u=0;for(t=a.quads.length;u<t;u+=5)j(a.quads,u);u=0;for(t=a.quads_n.length;u<t;u+=9)m(a.quads_n,u)})();(function(){var h,k,j,m;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<k;h+=2){j=a.skinWeights[h];m=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,j,m,0,0)}}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<k;h+=2){j=a.skinIndices[h];m=a.skinIndices[h+1];THREE.Loader.prototype.si(g,j,m,0,0)}}THREE.Loader.prototype.bones(g,
-a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;b(new d(c))},bones:function(a,b){a.bones=b},animation:function(a,b){a.animation=b},si:function(a,b,c,d,f){a.skinIndices.push(new THREE.Vector4(b,c,d,f))},sw:function(a,b,c,d,f){a.skinWeights.push(new THREE.Vector4(b,c,d,f))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,d)))},
-vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,k,j){g=a.materials[g];var m=b[k*3],o=b[k*3+1];k=b[k*3+2];var w=b[j*3],u=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,o,k),new THREE.Vector3(w,u,j)],
-g))},f4n:function(a,b,c,d,f,g,h,k,j,m,o){h=a.materials[h];var w=b[j*3],u=b[j*3+1];j=b[j*3+2];var t=b[m*3],x=b[m*3+1];m=b[m*3+2];var A=b[o*3],F=b[o*3+1];o=b[o*3+2];a.faces.push(new THREE.Face4(c,d,f,g,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(w,u,j),new THREE.Vector3(t,x,m),new THREE.Vector3(A,F,o)],h))},uv3:function(a,b,c,d,f,g,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(d,f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,b,c,d,f,g,h,k,j){var m=[];m.push(new THREE.UV(b,
-c));m.push(new THREE.UV(d,f));m.push(new THREE.UV(g,h));m.push(new THREE.UV(k,j));a.push(m)},init_materials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(b[d],c)]},createMaterial:function(a,b){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,j){var m=new Image;m.onload=function(){if(!c(this.width)||!c(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),w=Math.pow(2,Math.round(Math.log(this.height)/
-Math.LN2));k.image.width=o;k.image.height=w;k.image.getContext("2d").drawImage(this,0,0,o,w)}else k.image=this;k.needsUpdate=!0};m.src=j}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,light_map:null,vertex_colors:a.vertex_colors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.map_diffuse&&b){h=document.createElement("canvas");g.map=new THREE.Texture(h);d(g.map,b+"/"+a.map_diffuse)}else if(a.col_diffuse){h=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*
+createBinModel:function(a,b,c,d){var f=function(g){function h(z,D){var F=n(z,D),T=n(z,D+1),Q=n(z,D+2),ga=n(z,D+3),ma=(ga<<1&255|Q>>7)-127;F|=(Q&127)<<16|T<<8;if(F==0&&ma==-127)return 0;return(1-2*(ga>>7))*(1+F*Math.pow(2,-23))*Math.pow(2,ma)}function k(z,D){var F=n(z,D),T=n(z,D+1),Q=n(z,D+2);return(n(z,D+3)<<24)+(Q<<16)+(T<<8)+F}function j(z,D){var F=n(z,D);return(n(z,D+1)<<8)+F}function m(z,D){var F=n(z,D);return F>127?F-256:F}function n(z,D){return z.charCodeAt(D)&255}function w(z){var D,F,T;D=
+k(a,z);F=k(a,z+ea);T=k(a,z+O);z=j(a,z+P);THREE.Loader.prototype.f3(v,D,F,T,z)}function q(z){var D,F,T,Q,ga,ma;D=k(a,z);F=k(a,z+ea);T=k(a,z+O);Q=j(a,z+P);ga=k(a,z+W);ma=k(a,z+S);z=k(a,z+aa);THREE.Loader.prototype.f3n(v,M,D,F,T,Q,ga,ma,z)}function p(z){var D,F,T,Q;D=k(a,z);F=k(a,z+ba);T=k(a,z+H);Q=k(a,z+V);z=j(a,z+la);THREE.Loader.prototype.f4(v,D,F,T,Q,z)}function x(z){var D,F,T,Q,ga,ma,sa,oa;D=k(a,z);F=k(a,z+ba);T=k(a,z+H);Q=k(a,z+V);ga=j(a,z+la);ma=k(a,z+Y);sa=k(a,z+ka);oa=k(a,z+ia);z=k(a,z+fa);
+THREE.Loader.prototype.f4n(v,M,D,F,T,Q,ga,ma,sa,oa,z)}function A(z){var D,F;D=k(a,z);F=k(a,z+ra);z=k(a,z+xa);THREE.Loader.prototype.uv3(v.uvs,e[D*2],e[D*2+1],e[F*2],e[F*2+1],e[z*2],e[z*2+1])}function G(z){var D,F,T;D=k(a,z);F=k(a,z+l);T=k(a,z+y);z=k(a,z+B);THREE.Loader.prototype.uv4(v.uvs,e[D*2],e[D*2+1],e[F*2],e[F*2+1],e[T*2],e[T*2+1],e[z*2],e[z*2+1])}var v=this,I=0,o,M=[],e=[],ea,O,P,W,S,aa,ba,H,V,la,Y,ka,ia,fa,ra,xa,l,y,B,t,u,E,C,J,L;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,
+d,g);o={signature:a.substr(I,8),header_bytes:n(a,I+8),vertex_coordinate_bytes:n(a,I+9),normal_coordinate_bytes:n(a,I+10),uv_coordinate_bytes:n(a,I+11),vertex_index_bytes:n(a,I+12),normal_index_bytes:n(a,I+13),uv_index_bytes:n(a,I+14),material_index_bytes:n(a,I+15),nvertices:k(a,I+16),nnormals:k(a,I+16+4),nuvs:k(a,I+16+8),ntri_flat:k(a,I+16+12),ntri_smooth:k(a,I+16+16),ntri_flat_uv:k(a,I+16+20),ntri_smooth_uv:k(a,I+16+24),nquad_flat:k(a,I+16+28),nquad_smooth:k(a,I+16+32),nquad_flat_uv:k(a,I+16+36),
+nquad_smooth_uv:k(a,I+16+40)};I+=o.header_bytes;ea=o.vertex_index_bytes;O=o.vertex_index_bytes*2;P=o.vertex_index_bytes*3;W=o.vertex_index_bytes*3+o.material_index_bytes;S=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes;aa=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*2;ba=o.vertex_index_bytes;H=o.vertex_index_bytes*2;V=o.vertex_index_bytes*3;la=o.vertex_index_bytes*4;Y=o.vertex_index_bytes*4+o.material_index_bytes;ka=o.vertex_index_bytes*4+o.material_index_bytes+
+o.normal_index_bytes;ia=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*2;fa=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*3;ra=o.uv_index_bytes;xa=o.uv_index_bytes*2;l=o.uv_index_bytes;y=o.uv_index_bytes*2;B=o.uv_index_bytes*3;g=o.vertex_index_bytes*3+o.material_index_bytes;L=o.vertex_index_bytes*4+o.material_index_bytes;t=o.ntri_flat*g;u=o.ntri_smooth*(g+o.normal_index_bytes*3);E=o.ntri_flat_uv*(g+o.uv_index_bytes*3);C=o.ntri_smooth_uv*(g+o.normal_index_bytes*
+3+o.uv_index_bytes*3);J=o.nquad_flat*L;g=o.nquad_smooth*(L+o.normal_index_bytes*4);L=o.nquad_flat_uv*(L+o.uv_index_bytes*4);I+=function(z){for(var D,F,T,Q=o.vertex_coordinate_bytes*3,ga=z+o.nvertices*Q;z<ga;z+=Q){D=h(a,z);F=h(a,z+o.vertex_coordinate_bytes);T=h(a,z+o.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,D,F,T)}return o.nvertices*Q}(I);I+=function(z){for(var D,F,T,Q=o.normal_coordinate_bytes*3,ga=z+o.nnormals*Q;z<ga;z+=Q){D=m(a,z);F=m(a,z+o.normal_coordinate_bytes);T=m(a,z+o.normal_coordinate_bytes*
+2);M.push(D/127,F/127,T/127)}return o.nnormals*Q}(I);I+=function(z){for(var D,F,T=o.uv_coordinate_bytes*2,Q=z+o.nuvs*T;z<Q;z+=T){D=h(a,z);F=h(a,z+o.uv_coordinate_bytes);e.push(D,F)}return o.nuvs*T}(I);t=I+t;u=t+u;E=u+E;C=E+C;J=C+J;g=J+g;L=g+L;(function(z){var D,F=o.vertex_index_bytes*3+o.material_index_bytes,T=F+o.uv_index_bytes*3,Q=z+o.ntri_flat_uv*T;for(D=z;D<Q;D+=T){w(D);A(D+F)}return Q-z})(u);(function(z){var D,F=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,T=F+o.uv_index_bytes*
+3,Q=z+o.ntri_smooth_uv*T;for(D=z;D<Q;D+=T){q(D);A(D+F)}return Q-z})(E);(function(z){var D,F=o.vertex_index_bytes*4+o.material_index_bytes,T=F+o.uv_index_bytes*4,Q=z+o.nquad_flat_uv*T;for(D=z;D<Q;D+=T){p(D);G(D+F)}return Q-z})(g);(function(z){var D,F=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,T=F+o.uv_index_bytes*4,Q=z+o.nquad_smooth_uv*T;for(D=z;D<Q;D+=T){x(D);G(D+F)}return Q-z})(L);(function(z){var D,F=o.vertex_index_bytes*3+o.material_index_bytes,T=z+o.ntri_flat*F;for(D=
+z;D<T;D+=F)w(D);return T-z})(I);(function(z){var D,F=o.vertex_index_bytes*3+o.material_index_bytes+o.normal_index_bytes*3,T=z+o.ntri_smooth*F;for(D=z;D<T;D+=F)q(D);return T-z})(t);(function(z){var D,F=o.vertex_index_bytes*4+o.material_index_bytes,T=z+o.nquad_flat*F;for(D=z;D<T;D+=F)p(D);return T-z})(C);(function(z){var D,F=o.vertex_index_bytes*4+o.material_index_bytes+o.normal_index_bytes*4,T=z+o.nquad_smooth*F;for(D=z;D<T;D+=F)x(D);return T-z})(J);this.computeCentroids();this.computeFaceNormals();
+this.sortFacesByMaterial()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(c))},createModel:function(a,b,c){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){var h,k,j,m,n;h=0;for(k=a.vertices.length;h<k;h+=3){j=a.vertices[h];m=a.vertices[h+1];n=a.vertices[h+2];THREE.Loader.prototype.v(g,j,m,n)}if(a.colors){h=0;for(k=a.colors.length;h<k;h+=3){j=a.colors[h];m=a.colors[h+1];n=a.colors[h+2];THREE.Loader.prototype.vc(g,
+j,m,n)}}})();(function(){function h(x,A){THREE.Loader.prototype.f3(g,x[A],x[A+1],x[A+2],x[A+3])}function k(x,A){THREE.Loader.prototype.f3n(g,a.normals,x[A],x[A+1],x[A+2],x[A+3],x[A+4],x[A+5],x[A+6])}function j(x,A){THREE.Loader.prototype.f4(g,x[A],x[A+1],x[A+2],x[A+3],x[A+4])}function m(x,A){THREE.Loader.prototype.f4n(g,a.normals,x[A],x[A+1],x[A+2],x[A+3],x[A+4],x[A+5],x[A+6],x[A+7],x[A+8])}function n(x,A){var G,v,I,o,M,e,ea,O,P;G=x[A];v=x[A+1];I=x[A+2];o=a.uvs[G*2];ea=a.uvs[G*2+1];M=a.uvs[v*2];O=
+a.uvs[v*2+1];e=a.uvs[I*2];P=a.uvs[I*2+1];THREE.Loader.prototype.uv3(g.uvs,o,ea,M,O,e,P);if(a.uvs2&&a.uvs2.length){o=a.uvs2[G*2];ea=a.uvs2[G*2+1];M=a.uvs2[v*2];O=a.uvs2[v*2+1];e=a.uvs2[I*2];P=a.uvs2[I*2+1];THREE.Loader.prototype.uv3(g.uvs2,o,1-ea,M,1-O,e,1-P)}}function w(x,A){var G,v,I,o,M,e,ea,O,P,W,S,aa;G=x[A];v=x[A+1];I=x[A+2];o=x[A+3];M=a.uvs[G*2];P=a.uvs[G*2+1];e=a.uvs[v*2];W=a.uvs[v*2+1];ea=a.uvs[I*2];S=a.uvs[I*2+1];O=a.uvs[o*2];aa=a.uvs[o*2+1];THREE.Loader.prototype.uv4(g.uvs,M,P,e,W,ea,S,O,
+aa);if(a.uvs2){M=a.uvs2[G*2];P=a.uvs2[G*2+1];e=a.uvs2[v*2];W=a.uvs2[v*2+1];ea=a.uvs2[I*2];S=a.uvs2[I*2+1];O=a.uvs2[o*2];aa=a.uvs2[o*2+1];THREE.Loader.prototype.uv4(g.uvs2,M,1-P,e,1-W,ea,1-S,O,1-aa)}}var q,p;q=0;for(p=a.triangles_uv.length;q<p;q+=7){h(a.triangles_uv,q);n(a.triangles_uv,q+4)}q=0;for(p=a.triangles_n_uv.length;q<p;q+=10){k(a.triangles_n_uv,q);n(a.triangles_n_uv,q+7)}q=0;for(p=a.quads_uv.length;q<p;q+=9){j(a.quads_uv,q);w(a.quads_uv,q+5)}q=0;for(p=a.quads_n_uv.length;q<p;q+=13){m(a.quads_n_uv,
+q);w(a.quads_n_uv,q+9)}q=0;for(p=a.triangles.length;q<p;q+=4)h(a.triangles,q);q=0;for(p=a.triangles_n.length;q<p;q+=7)k(a.triangles_n,q);q=0;for(p=a.quads.length;q<p;q+=5)j(a.quads,q);q=0;for(p=a.quads_n.length;q<p;q+=9)m(a.quads_n,q)})();(function(){var h,k,j,m;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<k;h+=2){j=a.skinWeights[h];m=a.skinWeights[h+1];THREE.Loader.prototype.sw(g,j,m,0,0)}}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<k;h+=2){j=a.skinIndices[h];m=a.skinIndices[h+1];THREE.Loader.prototype.si(g,
+j,m,0,0)}}THREE.Loader.prototype.bones(g,a.bones);THREE.Loader.prototype.animation(g,a.animation)})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;b(new d(c))},bones:function(a,b){a.bones=b},animation:function(a,b){a.animation=b},si:function(a,b,c,d,f){a.skinIndices.push(new THREE.Vector4(b,c,d,f))},sw:function(a,b,c,d,f){a.skinWeights.push(new THREE.Vector4(b,c,d,f))},v:function(a,b,c,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,
+c,d)))},vc:function(a,b,c,d){var f=new THREE.Color(16777215);f.setRGB(b,c,d);a.colors.push(f)},f3:function(a,b,c,d,f){a.faces.push(new THREE.Face3(b,c,d,null,a.materials[f]))},f4:function(a,b,c,d,f,g){a.faces.push(new THREE.Face4(b,c,d,f,null,a.materials[g]))},f3n:function(a,b,c,d,f,g,h,k,j){g=a.materials[g];var m=b[k*3],n=b[k*3+1];k=b[k*3+2];var w=b[j*3],q=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(c,d,f,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,n,k),new THREE.Vector3(w,
+q,j)],g))},f4n:function(a,b,c,d,f,g,h,k,j,m,n){h=a.materials[h];var w=b[j*3],q=b[j*3+1];j=b[j*3+2];var p=b[m*3],x=b[m*3+1];m=b[m*3+2];var A=b[n*3],G=b[n*3+1];n=b[n*3+2];a.faces.push(new THREE.Face4(c,d,f,g,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(w,q,j),new THREE.Vector3(p,x,m),new THREE.Vector3(A,G,n)],h))},uv3:function(a,b,c,d,f,g,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(d,f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,b,c,d,f,g,h,k,j){var m=[];m.push(new THREE.UV(b,
+c));m.push(new THREE.UV(d,f));m.push(new THREE.UV(g,h));m.push(new THREE.UV(k,j));a.push(m)},init_materials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(b[d],c)]},createMaterial:function(a,b){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,j){var m=new Image;m.onload=function(){if(!c(this.width)||!c(this.height)){var n=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),w=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));k.image.width=n;k.image.height=w;k.image.getContext("2d").drawImage(this,0,0,n,w)}else k.image=this;k.needsUpdate=!0};m.src=j}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,light_map:null,vertex_colors:a.vertex_colors};a.shading&&a.shading=="Phong"&&(f="MeshPhongMaterial");if(a.map_diffuse&&b){h=document.createElement("canvas");g.map=new THREE.Texture(h);d(g.map,b+"/"+a.map_diffuse)}else if(a.col_diffuse){h=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*
 255;g.color=h;g.opacity=a.transparency}else if(a.a_dbg_color)g.color=a.a_dbg_color;if(a.map_lightmap&&b){h=document.createElement("canvas");g.light_map=new THREE.Texture(h);d(g.light_map,b+"/"+a.map_lightmap)}return new THREE[f](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
 255;g.color=h;g.opacity=a.transparency}else if(a.a_dbg_color)g.color=a.a_dbg_color;if(a.map_lightmap&&b){h=document.createElement("canvas");g.light_map=new THREE.Texture(h);d(g.light_map,b+"/"+a.map_lightmap)}return new THREE[f](g)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};

+ 143 - 0
examples/js/CameraControl.js

@@ -0,0 +1,143 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ * @author alteredq / http://alteredqualia.com/
+ * @author paulirish / http://paulirish.com/
+ */
+
+function bind( scope, fn ) {
+	return function () {
+		fn.apply( scope, arguments );
+	};
+}
+
+CameraControlWASD = function ( camera, movement_speed, look_speed, nofly, look_vertical ) {
+
+	this.movement_speed = movement_speed !== undefined ? movement_speed : 1.0;
+	this.look_speed = look_speed !== undefined ? look_speed : 0.005;
+
+	this.nofly = nofly;
+	this.look_vertical = look_vertical;
+	
+	this.camera = camera;
+	
+	this.mouseX = 0;
+	this.mouseY = 0;
+	
+	this.lat = 0;
+	this.lon = 0;
+	this.phy = 0;
+	this.theta = 0;
+	
+	this.moveForward = false;
+	this.moveBackward = false;
+	this.moveLeft = false;
+	this.moveRight = false;
+	
+	this.windowHalfX = window.innerWidth / 2;
+	this.windowHalfY = window.innerHeight / 2;
+
+	this.onDocumentMouseDown = function ( event ) {
+		
+		event.preventDefault();
+		event.stopPropagation();
+
+		switch ( event.button ) {
+
+			case 0: this.moveForward = true; break;
+			case 2: this.moveBackward = true; break;
+
+		}
+
+	};
+
+	this.onDocumentMouseUp = function ( event ) {
+
+		event.preventDefault();
+		event.stopPropagation();
+
+		switch ( event.button ) {
+
+			case 0: this.moveForward = false; break;
+			case 2: this.moveBackward = false; break;
+
+		}
+
+	};
+
+	this.onDocumentMouseMove = function (event) {
+
+		this.mouseX = event.clientX - this.windowHalfX;
+		this.mouseY = event.clientY - this.windowHalfY;
+
+	};
+	
+	this.onDocumentKeyDown = function ( event ) {
+
+		switch( event.keyCode ) {
+
+			case 38: /*up*/
+			case 87: /*W*/ this.moveForward = true; break;
+
+			case 37: /*left*/
+			case 65: /*A*/ this.moveLeft = true; break;
+
+			case 40: /*down*/
+			case 83: /*S*/ this.moveBackward = true; break;
+
+			case 39: /*right*/
+			case 68: /*D*/ this.moveRight = true; break;
+
+		}
+
+	};
+
+	this.onDocumentKeyUp = function ( event ) {
+
+		switch( event.keyCode ) {
+
+			case 38: /*up*/
+			case 87: /*W*/ this.moveForward = false; break;
+
+			case 37: /*left*/
+			case 65: /*A*/ this.moveLeft = false; break;
+
+			case 40: /*down*/
+			case 83: /*S*/ this.moveBackward = false; break;
+
+			case 39: /*right*/
+			case 68: /*D*/ this.moveRight = false; break;
+
+		}
+
+	};
+	
+	this.update = function() {
+	
+		if ( this.moveForward )  this.camera.translateZ( - this.movement_speed, this.nofly );
+		if ( this.moveBackward ) this.camera.translateZ(   this.movement_speed, this.nofly  );
+		if ( this.moveLeft )     this.camera.translateX( - this.movement_speed, this.nofly  );
+		if ( this.moveRight )    this.camera.translateX(   this.movement_speed, this.nofly  );
+
+		this.lon += this.mouseX * this.look_speed;
+		if( this.look_vertical ) this.lat -= this.mouseY * this.look_speed;
+
+		this.lat = Math.max( - 85, Math.min( 85, this.lat ) );
+		this.phi = ( 90 - this.lat ) * Math.PI / 180;
+		this.theta = this.lon * Math.PI / 180;
+
+		this.camera.target.position.x = 100 * Math.sin( this.phi ) * Math.cos( this.theta ) + this.camera.position.x;
+		this.camera.target.position.y = 100 * Math.cos( this.phi ) + this.camera.position.y;
+		this.camera.target.position.z = 100 * Math.sin( this.phi ) * Math.sin( this.theta ) + this.camera.position.z;
+		
+	};
+	
+	
+	document.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );
+	
+	document.addEventListener( 'mousemove', bind( this, this.onDocumentMouseMove ), false );
+	document.addEventListener( 'mousedown', bind( this, this.onDocumentMouseDown ), false );
+	document.addEventListener( 'mouseup', bind( this, this.onDocumentMouseUp ), false );
+	document.addEventListener( 'keydown', bind( this, this.onDocumentKeyDown ), false );
+	document.addEventListener( 'keyup', bind( this, this.onDocumentKeyUp ), false );
+	
+};

+ 285 - 0
examples/misc_sound.html

@@ -0,0 +1,285 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js - misc - sound</title>
+		<meta charset="utf-8">
+		<style type="text/css">
+			body {
+				background-color: #000000;
+				margin: 0px;
+				overflow: hidden;
+				font-family:Monospace;
+				font-size:13px;
+				text-align:center;
+				font-weight: bold;
+				text-align:center;
+			}
+
+			a {
+				color:#0078ff;
+			}
+
+			#info {
+				color:#fff;
+				position: absolute;
+				top: 0px; width: 100%;
+				padding: 5px;
+				z-index:100;
+			}
+		</style>
+	</head>
+	<body>
+	
+		<div id="info">
+			<a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - webgl 3d sounds example - 
+			music by <a href="http://www.newgrounds.com/audio/listen/358232" target="_blank">larrylarrybb</a> and 
+			<a href="http://www.newgrounds.com/audio/listen/376737" target="_blank">skullbeatz</a> <br/><br/>
+			
+			navigate with WASD / arrows / mouse
+		</div>
+
+
+		<div id="container"></div> 
+		
+		<script type="text/javascript" src="js/ThreeSound.js"></script>
+
+		<script type="text/javascript" src="js/CameraControl.js"></script>
+		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
+		<script type="text/javascript" src="js/Detector.js"></script>
+		<script type="text/javascript" src="js/Stats.js"></script>
+
+		<script type="text/javascript">
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			var container, stats;
+			var camera, scene, renderer, soundRenderer;
+			var light, pointLight;
+			var cameraControl;
+
+			var mesh;
+			var material_sphere1, material_sphere2;
+			
+			var postprocessing = { enabled: true };
+			
+			init();
+			animate();
+
+			function init() {
+
+				container = document.getElementById( 'container' );
+
+				scene  = new THREE.Scene();
+				scene.fog = new THREE.FogExp2( 0x000000, 0.0035 );
+
+				camera = new THREE.Camera( 50, window.innerWidth / window.innerHeight, 1, 10000 );
+				camera.position.set( 0, 25, 0 );
+
+				light = new THREE.DirectionalLight( 0xffffff );
+				light.position.set( 0, 0.5, 1 );
+				light.position.normalize();
+				scene.addLight( light );
+
+				var sphere = new Sphere( 20, 32, 16 );
+				
+				material_sphere1 = new THREE.MeshLambertMaterial( { color: 0xffaa00, shading: THREE.FlatShading } );
+				material_sphere2 = new THREE.MeshLambertMaterial( { color: 0xff2200, shading: THREE.FlatShading } );
+				
+				var cube = new Cube( 5, 40, 5 );
+				var material_cube = new THREE.MeshLambertMaterial( { color: 0xffff00, shading: THREE.FlatShading } );
+				material_cube.color.setHSV( 0.1, 0.7, 1 );
+
+				// sound spheres
+				
+				var s = 1;
+				
+				var mesh1 = new THREE.Mesh( sphere, material_sphere1 );
+				mesh1.position.set( -250, 30, 0 );
+				mesh1.scale.set( s, s, s );
+			
+				var sound1 = new THREE.Sound3D( [ "sounds/358232_j_s_song.mp3", "sounds/358232_j_s_song.ogg" ] , 275, 20, true );
+				//var sound1 = new THREE.Sound3D( "sounds/358232_j_s_song.ogg", 275, 20, true );
+				sound1.play();
+
+				var dbg = new THREE.Mesh( cube, material_cube );
+				dbg.position.set( 0, -10 ,0 );
+				mesh1.addChild( dbg );
+				
+				mesh1.addChild( sound1 );
+				scene.addObject( mesh1 );
+				
+
+				var mesh2 = new THREE.Mesh( sphere, material_sphere2 );
+				mesh2.position.set( 250, 30, 0 );
+				mesh2.scale.set( s, s, s );
+				
+				var sound2 = new THREE.Sound3D( [ "sounds/376737_Skullbeatz___Bad_Cat_Maste.mp3", "sounds/376737_Skullbeatz___Bad_Cat_Maste.ogg" ], 275, 20, true );				
+				//var sound2 = new THREE.Sound3D( "sounds/376737_Skullbeatz___Bad_Cat_Maste.ogg", 275, 20, true );				
+				sound2.play();
+
+				var dbg = new THREE.Mesh( cube, material_cube );
+				dbg.position.set( 0, -10, 0 );
+				mesh2.addChild( dbg );
+
+				mesh2.addChild( sound2 );
+				scene.addObject( mesh2 );
+
+				// ground
+				
+				var material_wireframe = new THREE.MeshLambertMaterial( { color: 0xffaa00, wireframe: true, wireframe_linewidth: 1 } );
+				material_wireframe.color.setHSV( 0.1, 0.2, 0.25 );
+				
+				
+				var plane = new Plane( 1000, 1000, 100, 100 );
+				mesh = new THREE.Mesh( plane, material_wireframe );
+				mesh.position.y = 0.1;
+				mesh.rotation.x = -1.57;
+				scene.addObject( mesh );
+
+
+				renderer = new THREE.WebGLRenderer( { clearColor: 0x000000, clearAlpha: 1 } );
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
+				soundRenderer = new THREE.SoundRenderer();
+				
+				container.innerHTML = "";
+				container.appendChild( renderer.domElement );
+				container.appendChild( soundRenderer.domElement );
+
+				stats = new Stats();
+				stats.domElement.style.position = 'absolute';
+				stats.domElement.style.top = '0px';
+				//container.appendChild( stats.domElement );
+				
+				cameraControl = new CameraControlWASD( camera, 1, 0.002, true, false );
+				
+				initPostprocessing();
+				renderer.autoClear = false;
+				
+			}
+
+
+			function initPostprocessing() {
+
+				postprocessing.scene = new THREE.Scene();
+
+				postprocessing.camera = new THREE.Camera();
+				postprocessing.camera.projectionMatrix = THREE.Matrix4.makeOrtho( window.innerWidth / - 2, window.innerWidth / 2,  window.innerHeight / 2, window.innerHeight / - 2, -10000, 10000 );
+				postprocessing.camera.position.z = 100;
+
+				var pars = { min_filter: THREE.LinearFilter, mag_filter: THREE.LinearFilter };
+				postprocessing.rtTexture1 = new THREE.RenderTarget( window.innerWidth, window.innerHeight, pars );
+				postprocessing.rtTexture2 = new THREE.RenderTarget( 512, 512, pars );
+				postprocessing.rtTexture3 = new THREE.RenderTarget( 512, 512, pars );
+
+				var screen_shader = ShaderUtils.lib["screen"];
+				var screen_uniforms = Uniforms.clone( screen_shader.uniforms );
+
+				screen_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
+				screen_uniforms["opacity"].value = 1.0;
+
+				postprocessing.materialScreen = new THREE.MeshShaderMaterial( {
+
+					uniforms: screen_uniforms,
+					vertex_shader: screen_shader.vertex_shader,
+					fragment_shader: screen_shader.fragment_shader,
+					blending: THREE.AdditiveBlending
+
+				} );
+
+				var convolution_shader = ShaderUtils.lib["convolution"];
+				var convolution_uniforms = Uniforms.clone( convolution_shader.uniforms );
+
+				postprocessing.blurx = new THREE.Vector2( 0.001953125, 0.0 ),
+				postprocessing.blury = new THREE.Vector2( 0.0, 0.001953125 );
+
+				convolution_uniforms["tDiffuse"].texture = postprocessing.rtTexture1;
+				convolution_uniforms["uImageIncrement"].value = postprocessing.blurx;
+				convolution_uniforms["cKernel"].value = ShaderUtils.buildKernel( 4.0 );
+
+				postprocessing.materialConvolution = new THREE.MeshShaderMaterial( {
+
+					uniforms: convolution_uniforms,
+					vertex_shader:   "#define KERNEL_SIZE 25.0\n" + convolution_shader.vertex_shader,
+					fragment_shader: "#define KERNEL_SIZE 25\n"   + convolution_shader.fragment_shader
+
+				} );
+
+				postprocessing.quad = new THREE.Mesh( new Plane( window.innerWidth, window.innerHeight ), postprocessing.materialConvolution );
+				postprocessing.quad.position.z = -500;
+				postprocessing.scene.addObject( postprocessing.quad );
+
+			}
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+
+				render();
+				stats.update();
+
+			}
+
+			
+			function render() {
+
+				var time = new Date().getTime() * 0.005;
+				
+				material_sphere1.color.setHSV( 0.0, 0.3 + 0.7 * ( 1 + Math.cos(time) ) / 2, 1 );
+				material_sphere2.color.setHSV( 0.1, 0.3 + 0.7 * ( 1 + Math.sin(time) ) / 2, 1 );
+				
+				cameraControl.update();				
+				
+				if ( postprocessing.enabled ) {
+
+					renderer.clear();
+
+					// Render scene into texture
+
+					renderer.render( scene, camera, postprocessing.rtTexture1 );
+
+					// Render quad with blured scene into texture (convolution pass 1)
+
+					postprocessing.quad.materials = [ postprocessing.materialConvolution ];
+
+					postprocessing.materialConvolution.uniforms.tDiffuse.texture = postprocessing.rtTexture1;
+					postprocessing.materialConvolution.uniforms.uImageIncrement.value = postprocessing.blurx;
+
+					renderer.render( postprocessing.scene, postprocessing.camera, postprocessing.rtTexture2 );
+
+					// Render quad with blured scene into texture (convolution pass 2)
+
+					postprocessing.materialConvolution.uniforms.tDiffuse.texture = postprocessing.rtTexture2;
+					postprocessing.materialConvolution.uniforms.uImageIncrement.value = postprocessing.blury;
+
+					renderer.render( postprocessing.scene, postprocessing.camera, postprocessing.rtTexture3 );
+
+					// Render original scene with superimposed blur to texture
+
+					postprocessing.quad.materials = [ postprocessing.materialScreen ];
+
+					postprocessing.materialScreen.uniforms.tDiffuse.texture = postprocessing.rtTexture3;
+					postprocessing.materialScreen.uniforms.opacity.value = 1.3;
+
+					renderer.render( postprocessing.scene, postprocessing.camera, postprocessing.rtTexture1, false );
+
+					// Render to screen
+
+					postprocessing.materialScreen.uniforms.tDiffuse.texture = postprocessing.rtTexture1;
+					renderer.render( postprocessing.scene, postprocessing.camera );
+
+				} else {
+
+					renderer.clear();
+					renderer.render( scene, camera );
+
+				}
+
+				soundRenderer.render( scene, camera );
+
+			}
+
+		</script>
+
+	</body>
+</html>

BIN
examples/sounds/358232_j_s_song.mp3


BIN
examples/sounds/358232_j_s_song.ogg


BIN
examples/sounds/376737_Skullbeatz___Bad_Cat_Maste.mp3


BIN
examples/sounds/376737_Skullbeatz___Bad_Cat_Maste.ogg


+ 8 - 0
examples/sounds/readme.txt

@@ -0,0 +1,8 @@
+Music from Newgrounds Audio portal, licensed under 
+Creative Commons Attribution Noncommercial Share Alike
+
+Bad Cat [Master Version] by Skullbeatz
+http://www.newgrounds.com/audio/listen/376737
+
+The Sound of Epicness by larrylarrybb
+http://www.newgrounds.com/audio/listen/358232

+ 6 - 2
src/cameras/Camera.js

@@ -24,11 +24,13 @@ THREE.Camera = function( FOV, aspect, zNear, zFar, renderer, target ) {
 
 
 	this.tmpVec = new THREE.Vector3();
 	this.tmpVec = new THREE.Vector3();
 
 
-	this.translateX = function ( amount ) {
+	this.translateX = function ( amount, nofly ) {
 
 
 		this.tmpVec.sub( this.target.position, this.position ).normalize().multiplyScalar( amount );
 		this.tmpVec.sub( this.target.position, this.position ).normalize().multiplyScalar( amount );
 		this.tmpVec.crossSelf( this.up );
 		this.tmpVec.crossSelf( this.up );
 
 
+		if ( nofly ) this.tmpVec.y = 0;
+		
 		this.position.addSelf( this.tmpVec );
 		this.position.addSelf( this.tmpVec );
 		this.target.position.addSelf( this.tmpVec );
 		this.target.position.addSelf( this.tmpVec );
 
 
@@ -40,10 +42,12 @@ THREE.Camera = function( FOV, aspect, zNear, zFar, renderer, target ) {
 	};
 	};
 	*/
 	*/
 
 
-	this.translateZ = function ( amount ) {
+	this.translateZ = function ( amount, nofly ) {
 
 
 		this.tmpVec.sub( this.target.position, this.position ).normalize().multiplyScalar( amount );
 		this.tmpVec.sub( this.target.position, this.position ).normalize().multiplyScalar( amount );
 
 
+		if ( nofly ) this.tmpVec.y = 0;
+		
 		this.position.subSelf( this.tmpVec );
 		this.position.subSelf( this.tmpVec );
 		this.target.position.subSelf( this.tmpVec );
 		this.target.position.subSelf( this.tmpVec );
 
 

+ 8 - 0
src/core/Matrix4.js

@@ -591,6 +591,14 @@ THREE.Matrix4.prototype = {
 
 
 	},
 	},
 
 
+	extractPositionVector: function( v ) {
+		
+		v.x = this.n14;
+		v.y = this.n24;
+		v.z = this.n34;
+
+	},
+
 	toString: function() {
 	toString: function() {
 
 
 		return  "| " + this.n11 + " " + this.n12 + " " + this.n13 + " " + this.n14 + " |\n" +
 		return  "| " + this.n11 + " " + this.n12 + " " + this.n13 + " " + this.n14 + " |\n" +

+ 201 - 0
src/objects/Sound3D.js

@@ -0,0 +1,201 @@
+/**
+ * @author mikael emtinger / http://gomo.se/
+ */
+
+THREE.Sound3D = function( sources, radius, volume, loop ) {
+	
+	THREE.Object3D.call( this );
+	
+	// flags
+	
+	this.isLoaded     = false;
+	this.isAddedToDOM = false;
+	this.isPlaying    = false;
+	this.duration     = -1;
+	this.radius       = radius !== undefined ? Math.abs( radius ) : 100;
+	this.volume       = Math.min( 1, Math.max( 0, volume !== undefined ? volume : 1 ) );
+
+	
+	// dom
+
+	this.domElement        = document.createElement( "audio" );
+	this.domElement.volume = 0;
+	this.domElement.pan    = 0;
+	this.domElement.loop   = loop !== undefined ? loop : true;
+		
+	
+	// init sources
+		
+	this.sources = sources instanceof Array ? sources : [ sources ];
+	
+	var element, source, type,
+		s, sl = this.sources.length;
+	
+	for( s = 0; s < sl; s++ ) {
+		
+		source = this.sources[ s ];
+		source.toLowerCase();
+		
+			 if( source.indexOf( ".mp3" ) !== -1 ) type = "audio/mpeg";	
+		else if( source.indexOf( ".ogg" ) !== -1 ) type = "audio/ogg";
+		else if( source.indexOf( ".wav" ) !== -1 ) type = "audio/wav";
+
+		if( this.domElement.canPlayType( type ) ) {
+			
+			element     = document.createElement( "source" );
+			element.src = this.sources[ s ];
+			
+			this.domElement.THREESound3D = this;
+			this.domElement.appendChild( element );
+			this.domElement.addEventListener( "canplay", this.onLoad, true );
+			this.domElement.load();
+
+			break;
+
+		}
+
+	}
+
+};
+
+
+THREE.Sound3D.prototype             = new THREE.Object3D();
+THREE.Sound3D.prototype.constructor = THREE.Sound3D;
+THREE.Sound3D.prototype.supr        = THREE.Object3D.prototype;
+
+
+/*
+ * OnLoad
+ */
+
+THREE.Sound3D.prototype.onLoad = function( ) {
+	
+	var sound3D = this.THREESound3D;
+	
+	if( sound3D.isLoaded )
+		return;
+	
+	this.removeEventListener( "canplay", this.onLoad, true );
+	
+	sound3D.isLoaded = true;
+	sound3D.duration = this.duration;
+	
+	if( sound3D.isPlaying )
+		sound3D.play();
+
+};
+
+/*
+ * Add To DOM
+ */
+
+THREE.Sound3D.prototype.addToDOM = function( parent ) {
+	
+	this.isAddedToDOM = true;
+	parent.appendChild( this.domElement );
+
+};
+
+
+/*
+ * Play
+ */
+
+THREE.Sound3D.prototype.play = function( startTime ) {
+	
+	this.isPlaying = true;
+	
+	if( this.isLoaded ) {
+		
+		this.domElement.play();
+		
+		if( startTime )
+			this.domElement.currentTime = startTime % this.duration;
+
+	}
+
+};
+
+
+/*
+ * Pause
+ */
+
+THREE.Sound3D.prototype.pause = function() {
+	
+	this.isPlaying = false;
+	this.domElement.pause();
+
+};
+
+
+/*
+ * Stop
+ */
+
+THREE.Sound3D.prototype.stop = function(){
+
+	this.isPlaying = false;
+	this.domElement.pause();
+	this.domElement.currentTime = 0;
+
+};
+
+/*
+ * Calculate Volume and Pan
+ */
+
+THREE.Sound3D.prototype.calculateVolumeAndPan = function( cameraRelativePosition ) {
+	
+	var distance = cameraRelativePosition.length();	
+	
+	if( distance <= this.radius )
+		this.domElement.volume = this.volume * ( 1 - distance / this.radius );
+	else 
+		this.domElement.volume = 0;
+
+};
+
+
+/*
+ * Update
+ */
+
+THREE.Sound3D.prototype.update = function( parentGlobalMatrix, forceUpdate, camera ) {
+
+	// update local (rotation/scale is not used)
+
+	if( this.matrixAutoUpdate ) {
+		
+		this.localMatrix.setPosition( this.position );
+		forceUpdate = true;
+
+	}
+
+
+	// update global
+
+	if( forceUpdate || this.matrixNeedsUpdate ) {
+
+		if( parentGlobalMatrix )
+			this.globalMatrix.multiply( parentGlobalMatrix, this.localMatrix );
+		else
+			this.globalMatrix.copy( this.localMatrix );
+
+		this.matrixNeedsUpdate = false;
+		forceUpdate            = true;
+
+	}
+
+
+	// update children
+
+	var i, l = this.children.length;
+
+	for( i = 0; i < l; i++ )
+		this.children[ i ].update( this.globalMatrix, forceUpdate, camera );
+
+};
+
+
+

+ 53 - 0
src/renderers/SoundRenderer.js

@@ -0,0 +1,53 @@
+/**
+ * @author mikael emtinger / http://gomo.se/
+ */
+
+
+THREE.SoundRenderer = function() {
+	
+	this.volume        = 1;
+	this.domElement    = document.createElement( "div" );
+	this.domElement.id = "THREESound";
+	
+	this.cameraPosition = new THREE.Vector3();
+	this.soundPosition  = new THREE.Vector3();
+	
+	/*
+	 * Render
+	 */
+	
+	this.render = function( scene, camera, callSceneUpdate ) {
+		
+		if( callSceneUpdate )
+			scene.update( undefined, false, camera );
+		
+		
+		// loop through all sounds
+		
+		var sound;
+		var sounds = scene.sounds;
+		var s, l = sounds.length;
+		
+		//camera.globalMatrix.extractPositionVector( this.cameraPosition );
+		
+		for( s = 0; s < l; s++ ) {
+			
+			sound = sounds[ s ];
+			
+			sound.globalMatrix.extractPositionVector( this.soundPosition );
+			this.soundPosition.subSelf( camera.position );
+			
+			if( sound.isPlaying && sound.isLoaded ) {
+				
+				if( !sound.isAddedToDOM )
+					sound.addToDOM( this.domElement );
+				
+				sound.calculateVolumeAndPan( this.soundPosition );
+
+			}
+
+		}
+
+	}
+
+}

+ 13 - 1
src/scenes/Scene.js

@@ -13,6 +13,7 @@ THREE.Scene = function() {
 
 
 	this.objects = [];
 	this.objects = [];
 	this.lights  = [];
 	this.lights  = [];
+	this.sounds  = [];
 	this.fog     = null;
 	this.fog     = null;
 
 
 };
 };
@@ -34,12 +35,16 @@ THREE.Scene.prototype.addChild = function( child ) {
 
 
 THREE.Scene.prototype.addChildRecurse = function( child ) {
 THREE.Scene.prototype.addChildRecurse = function( child ) {
 	
 	
-	
 	if( child instanceof THREE.Light ) {
 	if( child instanceof THREE.Light ) {
 			
 			
 		if( this.lights.indexOf( child ) === -1 )
 		if( this.lights.indexOf( child ) === -1 )
 			this.lights.push( child );	
 			this.lights.push( child );	
 
 
+	} else if( child instanceof THREE.Sound3D ) {
+		
+		if( this.sounds.indexOf( child ) === -1 )
+			this.sounds.push( child );
+
 	} else if( !( child instanceof THREE.Camera || child instanceof THREE.Bone ) ) {
 	} else if( !( child instanceof THREE.Camera || child instanceof THREE.Bone ) ) {
 		
 		
 		if( this.objects.indexOf( child ) === -1 )
 		if( this.objects.indexOf( child ) === -1 )
@@ -73,6 +78,13 @@ THREE.Scene.prototype.removeChildRecurse = function( child ) {
 		if( i !== -1 )
 		if( i !== -1 )
 			this.lights.splice( i, 1 );
 			this.lights.splice( i, 1 );
 
 
+	} else if( child instanceof THREE.Sound3D ) {
+		
+		var i = this.sounds.indexOf( child );
+		
+		if( i !== -1 )
+			this.sounds.splice( i, 1 );
+
 	} else if( !( child instanceof THREE.Camera ) ) {
 	} else if( !( child instanceof THREE.Camera ) ) {
 		
 		
 		var i = this.objects.indexOf( child );
 		var i = this.objects.indexOf( child );

+ 2 - 0
utils/build.py

@@ -64,6 +64,7 @@ COMMON_FILES = [
 'objects/Bone.js',
 'objects/Bone.js',
 'objects/SkinnedMesh.js',
 'objects/SkinnedMesh.js',
 'objects/Ribbon.js',
 'objects/Ribbon.js',
+'objects/Sound3D.js',
 'scenes/Scene.js',
 'scenes/Scene.js',
 'scenes/Fog.js',
 'scenes/Fog.js',
 'scenes/FogExp2.js',
 'scenes/FogExp2.js',
@@ -72,6 +73,7 @@ COMMON_FILES = [
 'renderers/CanvasRenderer.js',
 'renderers/CanvasRenderer.js',
 'renderers/SVGRenderer.js',
 'renderers/SVGRenderer.js',
 'renderers/WebGLRenderer.js',
 'renderers/WebGLRenderer.js',
+'renderers/SoundRenderer.js',
 'renderers/renderables/RenderableObject.js',
 'renderers/renderables/RenderableObject.js',
 'renderers/renderables/RenderableFace3.js',
 'renderers/renderables/RenderableFace3.js',
 'renderers/renderables/RenderableParticle.js',
 'renderers/renderables/RenderableParticle.js',