Browse Source

Merged with mrdoob's branch.

alteredq 14 years ago
parent
commit
4f80bbf808

+ 311 - 298
build/Three.js

@@ -1,88 +1,88 @@
 // Three.js r37 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var d,e,g,h,j,k;if(b==0)d=e=g=0;else{h=Math.floor(a*6);j=a*6-h;a=b*(1-c);k=b*(1-c*j);c=b*(1-c*(1-j));switch(h){case 1:d=k;e=b;g=a;break;case 2:d=a;e=b;g=c;break;case 3:d=a;e=k;g=b;break;case 4:d=c;e=a;g=b;break;case 5:d=b;e=a;
-g=k;break;case 6:case 0:d=b;e=c;g=a}}this.r=d;this.g=e;this.b=g;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
+THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var e,f,g,h,k,m;if(b==0)e=f=g=0;else{h=Math.floor(a*6);k=a*6-h;a=b*(1-c);m=b*(1-c*k);c=b*(1-c*(1-k));switch(h){case 1:e=m;f=b;g=a;break;case 2:e=a;f=b;g=c;break;case 3:e=a;f=m;g=b;break;case 4:e=c;f=a;g=b;break;case 5:e=b;f=a;
+g=m;break;case 6:case 0:e=b;f=c;g=a}}this.r=e;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
 255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,c){this.set(a||0,c||0)};
 THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
 this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,c,b){this.set(a||0,c||0,b||0)};
 THREE.Vector3.prototype={set:function(a,c,b){this.x=a;this.y=c;this.z=b;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
-c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,b=this.y,d=this.z;this.set(b*a.z-d*a.y,d*a.x-c*a.z,c*a.y-b*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
+c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,b=this.y,e=this.z;this.set(b*a.z-e*a.y,e*a.x-c*a.z,c*a.y-b*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
 a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,b=this.y-a.y;a=this.z-a.z;return c*c+b*b+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
 this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-a.n23/c,a.n33/c);this.z=Math.atan2(-a.n13/c,a.n11/c)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
-1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,d){this.set(a||0,c||0,b||0,d||1)};
-THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
+1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,e){this.set(a||0,c||0,b||0,e||1)};
+THREE.Vector4.prototype={set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
 a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,e=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(b)))}e.sort(function(g,h){return g.distance-h.distance});return e},intersectObject:function(a){function c(F,G,L,A){A=A.clone().subSelf(G);L=L.clone().subSelf(G);var P=F.clone().subSelf(G);F=A.dot(A);G=A.dot(L);A=A.dot(P);var R=L.dot(L);L=L.dot(P);P=1/(F*R-G*G);R=(R*A-G*L)*P;F=(F*L-G*A)*P;return R>0&&F>0&&R+F<1}var b,d,e,g,h,j,k,m,t,x,
-z,y=a.geometry,B=y.vertices,I=[];b=0;for(d=y.faces.length;b<d;b++){e=y.faces[b];x=this.origin.clone();z=this.direction.clone();k=a.matrixWorld;g=k.multiplyVector3(B[e.a].position.clone());h=k.multiplyVector3(B[e.b].position.clone());j=k.multiplyVector3(B[e.c].position.clone());k=e instanceof THREE.Face4?k.multiplyVector3(B[e.d].position.clone()):null;m=a.matrixRotationWorld.multiplyVector3(e.normal.clone());t=z.dot(m);if(t<0){m=m.dot((new THREE.Vector3).sub(g,x))/t;x=x.addSelf(z.multiplyScalar(m));
-if(e instanceof THREE.Face3){if(c(x,g,h,j)){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};I.push(e)}}else if(e instanceof THREE.Face4&&(c(x,g,h,k)||c(x,h,j,k))){e={distance:this.origin.distanceTo(x),point:x,face:e,object:a};I.push(e)}}}return I}};
-THREE.Rectangle=function(){function a(){g=d-c;h=e-b}var c,b,d,e,g,h,j=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(k,m,t,x){j=!1;c=k;b=m;d=t;e=x;a()};this.addPoint=function(k,m){if(j){j=!1;c=k;b=m;d=k;e=m}else{c=c<k?c:k;b=b<m?b:m;d=d>k?d:k;e=e>m?e:m}a()};
-this.add3Points=function(k,m,t,x,z,y){if(j){j=!1;c=k<t?k<z?k:z:t<z?t:z;b=m<x?m<y?m:y:x<y?x:y;d=k>t?k>z?k:z:t>z?t:z;e=m>x?m>y?m:y:x>y?x:y}else{c=k<t?k<z?k<c?k:c:z<c?z:c:t<z?t<c?t:c:z<c?z:c;b=m<x?m<y?m<b?m:b:y<b?y:b:x<y?x<b?x:b:y<b?y:b;d=k>t?k>z?k>d?k:d:z>d?z:d:t>z?t>d?t:d:z>d?z:d;e=m>x?m>y?m>e?m:e:y>e?y:e:x>y?x>e?x:e:y>e?y:e}a()};this.addRectangle=function(k){if(j){j=!1;c=k.getLeft();b=k.getTop();d=k.getRight();e=k.getBottom()}else{c=c<k.getLeft()?c:k.getLeft();b=b<k.getTop()?b:k.getTop();d=d>k.getRight()?
-d:k.getRight();e=e>k.getBottom()?e:k.getBottom()}a()};this.inflate=function(k){c-=k;b-=k;d+=k;e+=k;a()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();b=b>k.getTop()?b:k.getTop();d=d<k.getRight()?d:k.getRight();e=e<k.getBottom()?e:k.getBottom();a()};this.instersects=function(k){return Math.min(d,k.getRight())-Math.max(c,k.getLeft())>=0&&Math.min(e,k.getBottom())-Math.max(b,k.getTop())>=0};this.empty=function(){j=!0;e=d=b=c=0;a()};this.isEmpty=function(){return j}};
+THREE.Ray.prototype={intersectScene:function(a){var c,b,e=a.objects,f=[];a=0;for(c=e.length;a<c;a++){b=e[a];b instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(b)))}f.sort(function(g,h){return g.distance-h.distance});return f},intersectObject:function(a){function c(I,F,M,D){D=D.clone().subSelf(F);M=M.clone().subSelf(F);var Q=I.clone().subSelf(F);I=D.dot(D);F=D.dot(M);D=D.dot(Q);var R=M.dot(M);M=M.dot(Q);Q=1/(I*R-F*F);R=(R*D-F*M)*Q;I=(I*M-F*D)*Q;return R>0&&I>0&&R+I<1}var b,e,f,g,h,k,m,n,p,x,
+z,y=a.geometry,B=y.vertices,H=[];b=0;for(e=y.faces.length;b<e;b++){f=y.faces[b];x=this.origin.clone();z=this.direction.clone();m=a.matrixWorld;g=m.multiplyVector3(B[f.a].position.clone());h=m.multiplyVector3(B[f.b].position.clone());k=m.multiplyVector3(B[f.c].position.clone());m=f instanceof THREE.Face4?m.multiplyVector3(B[f.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(f.normal.clone());p=z.dot(n);if(p<0){n=n.dot((new THREE.Vector3).sub(g,x))/p;x=x.addSelf(z.multiplyScalar(n));
+if(f instanceof THREE.Face3){if(c(x,g,h,k)){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};H.push(f)}}else if(f instanceof THREE.Face4&&(c(x,g,h,m)||c(x,h,k,m))){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};H.push(f)}}}return H}};
+THREE.Rectangle=function(){function a(){g=e-c;h=f-b}var c,b,e,f,g,h,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(m,n,p,x){k=!1;c=m;b=n;e=p;f=x;a()};this.addPoint=function(m,n){if(k){k=!1;c=m;b=n;e=m;f=n}else{c=c<m?c:m;b=b<n?b:n;e=e>m?e:m;f=f>n?f:n}a()};
+this.add3Points=function(m,n,p,x,z,y){if(k){k=!1;c=m<p?m<z?m:z:p<z?p:z;b=n<x?n<y?n:y:x<y?x:y;e=m>p?m>z?m:z:p>z?p:z;f=n>x?n>y?n:y:x>y?x:y}else{c=m<p?m<z?m<c?m:c:z<c?z:c:p<z?p<c?p:c:z<c?z:c;b=n<x?n<y?n<b?n:b:y<b?y:b:x<y?x<b?x:b:y<b?y:b;e=m>p?m>z?m>e?m:e:z>e?z:e:p>z?p>e?p:e:z>e?z:e;f=n>x?n>y?n>f?n:f:y>f?y:f:x>y?x>f?x:f:y>f?y:f}a()};this.addRectangle=function(m){if(k){k=!1;c=m.getLeft();b=m.getTop();e=m.getRight();f=m.getBottom()}else{c=c<m.getLeft()?c:m.getLeft();b=b<m.getTop()?b:m.getTop();e=e>m.getRight()?
+e:m.getRight();f=f>m.getBottom()?f:m.getBottom()}a()};this.inflate=function(m){c-=m;b-=m;e+=m;f+=m;a()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();b=b>m.getTop()?b:m.getTop();e=e<m.getRight()?e:m.getRight();f=f<m.getBottom()?f:m.getBottom();a()};this.instersects=function(m){return Math.min(e,m.getRight())-Math.max(c,m.getLeft())>=0&&Math.min(f,m.getBottom())-Math.max(b,m.getTop())>=0};this.empty=function(){k=!0;f=e=b=c=0;a()};this.isEmpty=function(){return k}};
 THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
-THREE.Matrix4=function(a,c,b,d,e,g,h,j,k,m,t,x,z,y,B,I){this.set(a||1,c||0,b||0,d||0,e||0,g||1,h||0,j||0,k||0,m||0,t||1,x||0,z||0,y||0,B||0,I||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,c,b,d,e,g,h,j,k,m,t,x,z,y,B,I){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=e;this.n22=g;this.n23=h;this.n24=j;this.n31=k;this.n32=m;this.n33=t;this.n34=x;this.n41=z;this.n42=y;this.n43=B;this.n44=I;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var d=THREE.Matrix4.__v1,
-e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;d.cross(b,g).normalize();if(d.length()===0){g.x+=1.0E-4;d.cross(b,g).normalize()}e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,e=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*e;a.y=(this.n21*c+this.n22*b+this.n23*
-d+this.n24)*e;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,e=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*e;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*e;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*e;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();
-return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,t=a.n31,x=a.n32,z=a.n33,y=a.n34,B=a.n41,I=a.n42,F=a.n43,G=a.n44,L=c.n11,A=c.n12,P=c.n13,R=c.n14,M=c.n21,ia=c.n22,
-f=c.n23,ea=c.n24,W=c.n31,da=c.n32,X=c.n33,va=c.n34;this.n11=b*L+d*M+e*W;this.n12=b*A+d*ia+e*da;this.n13=b*P+d*f+e*X;this.n14=b*R+d*ea+e*va+g;this.n21=h*L+j*M+k*W;this.n22=h*A+j*ia+k*da;this.n23=h*P+j*f+k*X;this.n24=h*R+j*ea+k*va+m;this.n31=t*L+x*M+z*W;this.n32=t*A+x*ia+z*da;this.n33=t*P+x*f+z*X;this.n34=t*R+x*ea+z*va+y;this.n41=B*L+I*M+F*W;this.n42=B*A+I*ia+F*da;this.n43=B*P+I*f+F*X;this.n44=B*R+I*ea+F*va+G;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;
-b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},
-determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,e=this.n21,g=this.n22,h=this.n23,j=this.n24,k=this.n31,m=this.n32,t=this.n33,x=this.n34,z=this.n41,y=this.n42,B=this.n43,I=this.n44;return d*h*m*z-b*j*m*z-d*g*t*z+c*j*t*z+b*g*x*z-c*h*x*z-d*h*k*y+b*j*k*y+d*e*t*y-a*j*t*y-b*e*x*y+a*h*x*y+d*g*k*B-c*j*k*B-d*e*m*B+a*j*m*B+c*e*x*B-a*g*x*B-b*g*k*I+c*h*k*I+b*e*m*I-a*h*m*I-c*e*t*I+a*g*t*I},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=
+THREE.Matrix4=function(a,c,b,e,f,g,h,k,m,n,p,x,z,y,B,H){this.set(a||1,c||0,b||0,e||0,f||0,g||1,h||0,k||0,m||0,n||0,p||1,x||0,z||0,y||0,B||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,c,b,e,f,g,h,k,m,n,p,x,z,y,B,H){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=m;this.n32=n;this.n33=p;this.n34=x;this.n41=z;this.n42=y;this.n43=B;this.n44=H;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var e=THREE.Matrix4.__v1,
+f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;e.cross(b,g).normalize();if(e.length()===0){g.x+=1.0E-4;e.cross(b,g).normalize()}f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,f=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*f;a.y=(this.n21*c+this.n22*b+this.n23*
+e+this.n24)*f;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,f=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*f;a.y=this.n21*c+this.n22*b+this.n23*e+this.n24*f;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*f;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();
+return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,m=a.n23,n=a.n24,p=a.n31,x=a.n32,z=a.n33,y=a.n34,B=a.n41,H=a.n42,I=a.n43,F=a.n44,M=c.n11,D=c.n12,Q=c.n13,R=c.n14,P=c.n21,ka=c.n22,
+$=c.n23,d=c.n24,X=c.n31,da=c.n32,Y=c.n33,ua=c.n34;this.n11=b*M+e*P+f*X;this.n12=b*D+e*ka+f*da;this.n13=b*Q+e*$+f*Y;this.n14=b*R+e*d+f*ua+g;this.n21=h*M+k*P+m*X;this.n22=h*D+k*ka+m*da;this.n23=h*Q+k*$+m*Y;this.n24=h*R+k*d+m*ua+n;this.n31=p*M+x*P+z*X;this.n32=p*D+x*ka+z*da;this.n33=p*Q+x*$+z*Y;this.n34=p*R+x*d+z*ua+y;this.n41=B*M+H*P+I*X;this.n42=B*D+H*ka+I*da;this.n43=B*Q+H*$+I*Y;this.n44=B*R+H*d+I*ua+F;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=
+this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},
+determinant:function(){var a=this.n11,c=this.n12,b=this.n13,e=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,m=this.n31,n=this.n32,p=this.n33,x=this.n34,z=this.n41,y=this.n42,B=this.n43,H=this.n44;return e*h*n*z-b*k*n*z-e*g*p*z+c*k*p*z+b*g*x*z-c*h*x*z-e*h*m*y+b*k*m*y+e*f*p*y-a*k*p*y-b*f*x*y+a*h*x*y+e*g*m*B-c*k*m*B-e*f*n*B+a*k*n*B+c*f*x*B-a*g*x*B-b*g*m*H+c*h*m*H+b*f*n*H-a*h*n*H-c*f*p*H+a*g*p*H},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=
 a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;
 this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;
 a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},
-setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),e=1-b,g=a.x,h=a.y,j=
-a.z,k=e*g,m=e*h;this.set(k*g+b,k*h-d*j,k*j+d*h,0,k*h+d*j,m*h+b,m*j-d*g,0,k*j-d*h,m*j+d*g,e*j*j+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,d=a.z;a=Math.cos(c);c=Math.sin(c);var e=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var h=a*b,j=c*b;this.n11=e*g;this.n12=-e*d;this.n13=b;this.n21=j*g+a*d;this.n22=-j*d+a*g;this.n23=-c*e;this.n31=-h*g+c*d;this.n32=h*d+c*g;this.n33=a*e;return this},
-setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,e=a.w,g=c+c,h=b+b,j=d+d;a=c*g;var k=c*h;c*=j;var m=b*h;b*=j;d*=j;g*=e;h*=e;e*=j;this.n11=1-(m+d);this.n12=k-e;this.n13=c+h;this.n21=k+e;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+m);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=
-a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var b=1/c.x,d=1/c.y,e=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,j=a.n22,k=a.n23,m=a.n24,t=a.n31,x=a.n32,z=a.n33,y=a.n34,B=a.n41,I=a.n42,F=a.n43,G=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=k*y*I-m*z*I+m*x*F-j*y*F-k*x*G+j*z*G;c.n12=g*z*I-e*y*I-g*x*F+d*y*F+e*x*G-d*z*G;c.n13=e*m*I-g*k*I+g*j*F-d*m*F-e*j*G+d*k*G;c.n14=g*k*x-e*m*x-g*j*z+d*m*z+e*j*y-d*k*y;c.n21=m*z*B-k*y*B-m*t*F+h*y*F+k*t*G-h*z*G;c.n22=e*y*B-g*z*B+g*t*F-b*y*F-e*t*G+b*z*G;c.n23=g*k*B-e*m*B-g*h*F+b*m*F+e*h*G-b*k*G;
-c.n24=e*m*t-g*k*t+g*h*z-b*m*z-e*h*y+b*k*y;c.n31=j*y*B-m*x*B+m*t*I-h*y*I-j*t*G+h*x*G;c.n32=g*x*B-d*y*B-g*t*I+b*y*I+d*t*G-b*x*G;c.n33=e*m*B-g*j*B+g*h*I-b*m*I-d*h*G+b*j*G;c.n34=g*j*t-d*m*t-g*h*x+b*m*x+d*h*y-b*j*y;c.n41=k*x*B-j*z*B-k*t*I+h*z*I+j*t*F-h*x*F;c.n42=d*z*B-e*x*B+e*t*I-b*z*I-d*t*F+b*x*F;c.n43=e*j*B-d*k*B-e*h*I+b*k*I+d*h*F-b*j*F;c.n44=d*k*t-e*j*t+e*h*x-b*k*x-d*h*z+b*j*z;c.multiplyScalar(1/a.determinant());return c};
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,e=-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,j=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,t=-a.n23*a.n11+a.n21*a.n13,x=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;b[0]=a*d;b[1]=a*e;b[2]=a*g;b[3]=a*h;b[4]=a*j;b[5]=a*k;b[6]=a*m;b[7]=a*t;b[8]=a*x;return c};
-THREE.Matrix4.makeFrustum=function(a,c,b,d,e,g){var h;h=new THREE.Matrix4;h.n11=2*e/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*e/(d-b);h.n23=(d+b)/(d-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+e)/(g-e);h.n34=-2*g*e/(g-e);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,d){var e;a=b*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*c,a*c,e,a,b,d)};
-THREE.Matrix4.makeOrtho=function(a,c,b,d,e,g){var h,j,k,m;h=new THREE.Matrix4;j=c-a;k=b-d;m=g-e;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((b+d)/k);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((g+e)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),f=1-b,g=a.x,h=a.y,k=
+a.z,m=f*g,n=f*h;this.set(m*g+b,m*h-e*k,m*k+e*h,0,m*h+e*k,n*h+b,n*k-e*g,0,m*k-e*h,n*k+e*g,f*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(b);b=Math.sin(b);var g=Math.cos(e);e=Math.sin(e);var h=a*b,k=c*b;this.n11=f*g;this.n12=-f*e;this.n13=b;this.n21=k*g+a*e;this.n22=-k*e+a*g;this.n23=-c*f;this.n31=-h*g+c*e;this.n32=h*e+c*g;this.n33=a*f;return this},
+setRotationFromQuaternion:function(a){var c=a.x,b=a.y,e=a.z,f=a.w,g=c+c,h=b+b,k=e+e;a=c*g;var m=c*h;c*=k;var n=b*h;b*=k;e*=k;g*=f;h*=f;f*=k;this.n11=1-(n+e);this.n12=m-f;this.n13=c+h;this.n21=m+f;this.n22=1-(a+e);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+n);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=
+a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var b=1/c.x,e=1/c.y,f=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
+THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,m=a.n23,n=a.n24,p=a.n31,x=a.n32,z=a.n33,y=a.n34,B=a.n41,H=a.n42,I=a.n43,F=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*y*H-n*z*H+n*x*I-k*y*I-m*x*F+k*z*F;c.n12=g*z*H-f*y*H-g*x*I+e*y*I+f*x*F-e*z*F;c.n13=f*n*H-g*m*H+g*k*I-e*n*I-f*k*F+e*m*F;c.n14=g*m*x-f*n*x-g*k*z+e*n*z+f*k*y-e*m*y;c.n21=n*z*B-m*y*B-n*p*I+h*y*I+m*p*F-h*z*F;c.n22=f*y*B-g*z*B+g*p*I-b*y*I-f*p*F+b*z*F;c.n23=g*m*B-f*n*B-g*h*I+b*n*I+f*h*F-b*m*F;
+c.n24=f*n*p-g*m*p+g*h*z-b*n*z-f*h*y+b*m*y;c.n31=k*y*B-n*x*B+n*p*H-h*y*H-k*p*F+h*x*F;c.n32=g*x*B-e*y*B-g*p*H+b*y*H+e*p*F-b*x*F;c.n33=f*n*B-g*k*B+g*h*H-b*n*H-e*h*F+b*k*F;c.n34=g*k*p-e*n*p-g*h*x+b*n*x+e*h*y-b*k*y;c.n41=m*x*B-k*z*B-m*p*H+h*z*H+k*p*I-h*x*I;c.n42=e*z*B-f*x*B+f*p*H-b*z*H-e*p*I+b*x*I;c.n43=f*k*B-e*m*B-f*h*H+b*m*H+e*h*I-b*k*I;c.n44=e*m*p-f*k*p+f*h*x-b*m*x-e*h*z+b*k*z;c.multiplyScalar(1/a.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,e=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,m=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*h+a.n31*n;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*e;b[1]=a*f;b[2]=a*g;b[3]=a*h;b[4]=a*k;b[5]=a*m;b[6]=a*n;b[7]=a*p;b[8]=a*x;return c};
+THREE.Matrix4.makeFrustum=function(a,c,b,e,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*f/(e-b);h.n23=(e+b)/(e-b);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,c,b,e){var f;a=b*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,b,e)};
+THREE.Matrix4.makeOrtho=function(a,c,b,e,f,g){var h,k,m,n;h=new THREE.Matrix4;k=c-a;m=b-e;n=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((c+a)/k);h.n21=0;h.n22=2/m;h.n23=0;h.n24=-((b+e)/m);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((g+f)/n);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
 THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
 undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
-1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
-c,b)}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?d:1)};
-THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,e=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-e);e=Math.sin(-e);var g=Math.cos(b);b=Math.sin(b);var h=a*c,j=d*e;this.w=h*g-j*b;this.x=h*b+j*g;this.y=d*c*g+a*e*b;this.z=a*e*g-d*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,d=this.z,e=this.w,g=a.x,h=a.y,j=a.z;a=a.w;this.x=c*a+e*g+b*j-d*h;this.y=b*a+e*h+d*g-c*j;this.z=d*a+e*j+c*h-b*g;this.w=e*a-c*g-b*h-d*j;return this},
-multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,e=a.z,g=this.x,h=this.y,j=this.z,k=this.w,m=k*b+h*e-j*d,t=k*d+j*b-g*e,x=k*e+g*d-h*b;b=-g*b-h*d-j*e;c.x=m*k+b*-g+t*-j-x*-h;c.y=t*k+b*-h+x*-g-m*-j;c.z=x*k+b*-j+m*-h-t*-g;return c}};
-THREE.Quaternion.slerp=function(a,c,b,d){var e=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(e)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(e),h=Math.sqrt(1-e*e);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}e=Math.sin((1-d)*g)/h;d=Math.sin(d*g)/h;b.w=a.w*e+c.w*d;b.x=a.x*e+c.x*d;b.y=a.y*e+c.y*d;b.z=a.z*e+c.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Face3=function(a,c,b,d,e,g){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,c,b,d,e,g,h){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
+1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
+c,b)}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==undefined?e:1)};
+THREE.Quaternion.prototype={set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,e=a.y*c,f=a.z*c;a=Math.cos(e);e=Math.sin(e);c=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(b);b=Math.sin(b);var h=a*c,k=e*f;this.w=h*g-k*b;this.x=h*b+k*g;this.y=e*c*g+a*f*b;this.z=a*f*g-e*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,e=this.z,f=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=c*a+f*g+b*k-e*h;this.y=b*a+f*h+e*g-c*k;this.z=e*a+f*k+c*h-b*g;this.w=f*a-c*g-b*h-e*k;return this},
+multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,f=a.z,g=this.x,h=this.y,k=this.z,m=this.w,n=m*b+h*f-k*e,p=m*e+k*b-g*f,x=m*f+g*e-h*b;b=-g*b-h*e-k*f;c.x=n*m+b*-g+p*-k-x*-h;c.y=p*m+b*-h+x*-g-n*-k;c.z=x*m+b*-k+n*-h-p*-g;return c}};
+THREE.Quaternion.slerp=function(a,c,b,e){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.0010){b.w=0.5*(a.w+c.w);b.x=0.5*(a.x+c.x);b.y=0.5*(a.y+c.y);b.z=0.5*(a.z+c.z);return b}f=Math.sin((1-e)*g)/h;e=Math.sin(e*g)/h;b.w=a.w*f+c.w*e;b.x=a.x*f+c.x*e;b.y=a.y*f+c.y*e;b.z=a.z*f+c.z*e;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,c,b,e,f,g){this.a=a;this.b=c;this.c=b;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,c,b,e,f,g,h){this.a=a;this.b=c;this.c=b;this.d=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
 THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
 THREE.Geometry.prototype={computeCentroids:function(){var a,c,b;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];b.centroid.set(0,0,0);if(b instanceof THREE.Face3){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);b.centroid.divideScalar(3)}else if(b instanceof THREE.Face4){b.centroid.addSelf(this.vertices[b.a].position);b.centroid.addSelf(this.vertices[b.b].position);b.centroid.addSelf(this.vertices[b.c].position);
-b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,d,e,g,h,j=new THREE.Vector3,k=new THREE.Vector3;d=0;for(e=this.faces.length;d<e;d++){g=this.faces[d];if(a&&g.vertexNormals.length){j.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)j.addSelf(g.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];j.sub(h.position,b.position);k.sub(c.position,b.position);j.crossSelf(k)}j.isZero()||
-j.normalize();g.normal.copy(j)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices==undefined){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{d=
-this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){d[b.a].addSelf(b.normal);d[b.b].addSelf(b.normal);d[b.c].addSelf(b.normal);d[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(d[b.a]);
-b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(d[b.a]);b.vertexNormals[1].copy(d[b.b]);b.vertexNormals[2].copy(d[b.c]);b.vertexNormals[3].copy(d[b.d])}}},computeTangents:function(){function a(U,fa,Y,S,O,ga,sa){j=U.vertices[fa].position;k=U.vertices[Y].position;m=U.vertices[S].position;t=h[O];x=h[ga];z=h[sa];y=k.x-j.x;B=m.x-j.x;I=k.y-j.y;F=m.y-j.y;G=k.z-j.z;L=m.z-j.z;A=x.u-t.u;P=z.u-t.u;R=x.v-t.v;M=z.v-t.v;ia=1/(A*M-P*R);da.set((M*
-y-R*B)*ia,(M*I-R*F)*ia,(M*G-R*L)*ia);X.set((A*B-P*y)*ia,(A*F-P*I)*ia,(A*L-P*G)*ia);ea[fa].addSelf(da);ea[Y].addSelf(da);ea[S].addSelf(da);W[fa].addSelf(X);W[Y].addSelf(X);W[S].addSelf(X)}var c,b,d,e,g,h,j,k,m,t,x,z,y,B,I,F,G,L,A,P,R,M,ia,f,ea=[],W=[],da=new THREE.Vector3,X=new THREE.Vector3,va=new THREE.Vector3,wa=new THREE.Vector3,Ca=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){ea[c]=new THREE.Vector3;W[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];h=this.faceVertexUvs[0][c];
-if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.c,0,1,2);a(this,g.a,g.b,g.d,0,1,3)}}var ja=["a","b","c","d"];c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];for(d=0;d<g.vertexNormals.length;d++){Ca.copy(g.vertexNormals[d]);e=g[ja[d]];f=ea[e];va.copy(f);va.subSelf(Ca.multiplyScalar(Ca.dot(f))).normalize();wa.cross(g.vertexNormals[d],f);e=wa.dot(W[e]);e=e<0?-1:1;g.vertexTangents[d]=new THREE.Vector4(va.x,va.y,va.z,e)}}this.hasTangents=!0},
+b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,e,f,g,h,k=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(a&&g.vertexNormals.length){k.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)k.addSelf(g.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,b.position);m.sub(c.position,b.position);k.crossSelf(m)}k.isZero()||
+k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=
+this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){e[b.a].addSelf(b.normal);e[b.b].addSelf(b.normal);e[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){e[b.a].addSelf(b.normal);e[b.b].addSelf(b.normal);e[b.c].addSelf(b.normal);e[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(e[b.a]);
+b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(e[b.a]);b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c]);b.vertexNormals[3].copy(e[b.d])}}},computeTangents:function(){function a(W,ia,Z,S,N,ha,ra){k=W.vertices[ia].position;m=W.vertices[Z].position;n=W.vertices[S].position;p=h[N];x=h[ha];z=h[ra];y=m.x-k.x;B=n.x-k.x;H=m.y-k.y;I=n.y-k.y;F=m.z-k.z;M=n.z-k.z;D=x.u-p.u;Q=z.u-p.u;R=x.v-p.v;P=z.v-p.v;ka=1/(D*P-Q*R);da.set((P*
+y-R*B)*ka,(P*H-R*I)*ka,(P*F-R*M)*ka);Y.set((D*B-Q*y)*ka,(D*I-Q*H)*ka,(D*M-Q*F)*ka);d[ia].addSelf(da);d[Z].addSelf(da);d[S].addSelf(da);X[ia].addSelf(Y);X[Z].addSelf(Y);X[S].addSelf(Y)}var c,b,e,f,g,h,k,m,n,p,x,z,y,B,H,I,F,M,D,Q,R,P,ka,$,d=[],X=[],da=new THREE.Vector3,Y=new THREE.Vector3,ua=new THREE.Vector3,va=new THREE.Vector3,za=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){d[c]=new THREE.Vector3;X[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];h=this.faceVertexUvs[0][c];
+if(g instanceof THREE.Face3)a(this,g.a,g.b,g.c,0,1,2);else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.c,0,1,2);a(this,g.a,g.b,g.d,0,1,3)}}var ma=["a","b","c","d"];c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];for(e=0;e<g.vertexNormals.length;e++){za.copy(g.vertexNormals[e]);f=g[ma[e]];$=d[f];ua.copy($);ua.subSelf(za.multiplyScalar(za.dot($))).normalize();va.cross(g.vertexNormals[e],$);f=va.dot(X[f]);f=f<0?-1:1;g.vertexTangents[e]=new THREE.Vector4(ua.x,ua.y,ua.z,f)}}this.hasTangents=!0},
 computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,b=this.vertices.length;c<b;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=
 a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
-THREE.Spline=function(a){function c(y,B,I,F,G,L,A){y=(I-y)*0.5;F=(F-B)*0.5;return(2*(B-I)+y+F)*A+(-3*(B-I)-2*y-F)*L+y*G+B}this.points=a;var b=[],d={x:0,y:0,z:0},e,g,h,j,k,m,t,x,z;this.initFromArray=function(y){this.points=[];for(var B=0;B<y.length;B++)this.points[B]={x:y[B][0],y:y[B][1],z:y[B][2]}};this.getPoint=function(y){e=(this.points.length-1)*y;g=Math.floor(e);h=e-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;m=this.points[b[0]];t=this.points[b[1]];
-x=this.points[b[2]];z=this.points[b[3]];j=h*h;k=h*j;d.x=c(m.x,t.x,x.x,z.x,h,j,k);d.y=c(m.y,t.y,x.y,z.y,h,j,k);d.z=c(m.z,t.z,x.z,z.z,h,j,k);return d};this.getControlPointsArray=function(){var y,B,I=this.points.length,F=[];for(y=0;y<I;y++){B=this.points[y];F[y]=[B.x,B.y,B.z]}return F};this.getLength=function(y){var B,I,F=B=B=0,G=new THREE.Vector3,L=new THREE.Vector3,A=[],P=0;A[0]=0;y||(y=100);I=this.points.length*y;G.copy(this.points[0]);for(y=1;y<I;y++){B=y/I;position=this.getPoint(B);L.copy(position);
-P+=L.distanceTo(G);G.copy(position);B*=this.points.length-1;B=Math.floor(B);if(B!=F){A[B]=P;F=B}}A[A.length]=P;return{chunks:A,total:P}};this.reparametrizeByArcLength=function(y){var B,I,F,G,L,A,P=[],R=new THREE.Vector3,M=this.getLength();P.push(R.copy(this.points[0]).clone());for(B=1;B<this.points.length;B++){I=M.chunks[B]-M.chunks[B-1];A=Math.ceil(y*I/M.total);G=(B-1)/(this.points.length-1);L=B/(this.points.length-1);for(I=1;I<A-1;I++){F=G+I*(1/A)*(L-G);position=this.getPoint(F);P.push(R.copy(position).clone())}P.push(R.copy(this.points[B]).clone())}this.points=
-P}};
-THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(e){for(var g=0;g<a.length;g++)a[g].update(e)};b.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};b.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};b.add=function(e){c[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");c[e.name]=e;if(e.initialized!==!0){for(var g=0;g<e.hierarchy.length;g++){for(var h=0;h<e.hierarchy[g].keys.length;h++){if(e.hierarchy[g].keys[h].time<0)e.hierarchy[g].keys[h].time=
-0;if(e.hierarchy[g].keys[h].rot!==undefined&&!(e.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var j=e.hierarchy[g].keys[h].rot;e.hierarchy[g].keys[h].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(e.hierarchy[g].keys[0].morphTargets!==undefined){j={};for(h=0;h<e.hierarchy[g].keys.length;h++)for(var k=0;k<e.hierarchy[g].keys[h].morphTargets.length;k++){var m=e.hierarchy[g].keys[h].morphTargets[k];j[m]=-1}e.hierarchy[g].usedMorphTargets=j;for(h=0;h<e.hierarchy[g].keys.length;h++){var t=
-{};for(m in j){for(k=0;k<e.hierarchy[g].keys[h].morphTargets.length;k++)if(e.hierarchy[g].keys[h].morphTargets[k]===m){t[m]=e.hierarchy[g].keys[h].morphTargetsInfluences[k];break}k===e.hierarchy[g].keys[h].morphTargets.length&&(t[m]=0)}e.hierarchy[g].keys[h].morphTargetsInfluences=t}}for(h=1;h<e.hierarchy[g].keys.length;h++)if(e.hierarchy[g].keys[h].time===e.hierarchy[g].keys[h-1].time){e.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<e.hierarchy[g].keys.length;h++)e.hierarchy[g].keys[h].index=h}h=parseInt(e.length*
-e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(g=0;g<e.hierarchy.length;g++)e.JIT.hierarchy.push(Array(h));e.initialized=!0}};b.get=function(e){if(typeof e==="string")if(c[e])return c[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};b.parse=function(e){var g=[];if(e instanceof THREE.SkinnedMesh)for(var h=0;h<e.bones.length;h++)g.push(e.bones[h]);else d(e,g);return g};var d=function(e,g){g.push(e);for(var h=0;h<e.children.length;h++)d(e.children[h],g)};b.LINEAR=
-0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,d=this.hierarchy.length,e;for(b=0;b<d;b++){e=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
-e instanceof THREE.Bone?e.skinMatrix:e.matrix}var g=e.animationCache.prevKey;e=e.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];e.pos=this.getNextKeyWith("pos",b,1);e.rot=this.getNextKeyWith("rot",b,1);e.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.Spline=function(a){function c(y,B,H,I,F,M,D){y=(H-y)*0.5;I=(I-B)*0.5;return(2*(B-H)+y+I)*D+(-3*(B-H)-2*y-I)*M+y*F+B}this.points=a;var b=[],e={x:0,y:0,z:0},f,g,h,k,m,n,p,x,z;this.initFromArray=function(y){this.points=[];for(var B=0;B<y.length;B++)this.points[B]={x:y[B][0],y:y[B][1],z:y[B][2]}};this.getPoint=function(y){f=(this.points.length-1)*y;g=Math.floor(f);h=f-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;n=this.points[b[0]];p=this.points[b[1]];
+x=this.points[b[2]];z=this.points[b[3]];k=h*h;m=h*k;e.x=c(n.x,p.x,x.x,z.x,h,k,m);e.y=c(n.y,p.y,x.y,z.y,h,k,m);e.z=c(n.z,p.z,x.z,z.z,h,k,m);return e};this.getControlPointsArray=function(){var y,B,H=this.points.length,I=[];for(y=0;y<H;y++){B=this.points[y];I[y]=[B.x,B.y,B.z]}return I};this.getLength=function(y){var B,H,I=B=B=0,F=new THREE.Vector3,M=new THREE.Vector3,D=[],Q=0;D[0]=0;y||(y=100);H=this.points.length*y;F.copy(this.points[0]);for(y=1;y<H;y++){B=y/H;position=this.getPoint(B);M.copy(position);
+Q+=M.distanceTo(F);F.copy(position);B*=this.points.length-1;B=Math.floor(B);if(B!=I){D[B]=Q;I=B}}D[D.length]=Q;return{chunks:D,total:Q}};this.reparametrizeByArcLength=function(y){var B,H,I,F,M,D,Q=[],R=new THREE.Vector3,P=this.getLength();Q.push(R.copy(this.points[0]).clone());for(B=1;B<this.points.length;B++){H=P.chunks[B]-P.chunks[B-1];D=Math.ceil(y*H/P.total);F=(B-1)/(this.points.length-1);M=B/(this.points.length-1);for(H=1;H<D-1;H++){I=F+H*(1/D)*(M-F);position=this.getPoint(I);Q.push(R.copy(position).clone())}Q.push(R.copy(this.points[B]).clone())}this.points=
+Q}};
+THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(f){for(var g=0;g<a.length;g++)a[g].update(f)};b.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};b.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};b.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var g=0;g<f.hierarchy.length;g++){for(var h=0;h<f.hierarchy[g].keys.length;h++){if(f.hierarchy[g].keys[h].time<0)f.hierarchy[g].keys[h].time=
+0;if(f.hierarchy[g].keys[h].rot!==undefined&&!(f.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var k=f.hierarchy[g].keys[h].rot;f.hierarchy[g].keys[h].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){k={};for(h=0;h<f.hierarchy[g].keys.length;h++)for(var m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++){var n=f.hierarchy[g].keys[h].morphTargets[m];k[n]=-1}f.hierarchy[g].usedMorphTargets=k;for(h=0;h<f.hierarchy[g].keys.length;h++){var p=
+{};for(n in k){for(m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++)if(f.hierarchy[g].keys[h].morphTargets[m]===n){p[n]=f.hierarchy[g].keys[h].morphTargetsInfluences[m];break}m===f.hierarchy[g].keys[h].morphTargets.length&&(p[n]=0)}f.hierarchy[g].keys[h].morphTargetsInfluences=p}}for(h=1;h<f.hierarchy[g].keys.length;h++)if(f.hierarchy[g].keys[h].time===f.hierarchy[g].keys[h-1].time){f.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<f.hierarchy[g].keys.length;h++)f.hierarchy[g].keys[h].index=h}h=parseInt(f.length*
+f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(g=0;g<f.hierarchy.length;g++)f.JIT.hierarchy.push(Array(h));f.initialized=!0}};b.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};b.parse=function(f){var g=[];if(f instanceof THREE.SkinnedMesh)for(var h=0;h<f.bones.length;h++)g.push(f.bones[h]);else e(f,g);return g};var e=function(f,g){g.push(f);for(var h=0;h<f.children.length;h++)e(f.children[h],g)};b.LINEAR=
+0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,e=this.hierarchy.length,f;for(b=0;b<e;b++){f=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
+f instanceof THREE.Bone?f.skinMatrix:f.matrix}var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,e,g,h,j,k,m,t=this.data.JIT.hierarchy,x,z;this.currentTime+=a*this.timeScale;z=this.currentTime;x=this.currentTime%=this.data.length;m=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var y=0,B=this.hierarchy.length;y<B;y++){a=this.hierarchy[y];k=a.animationCache;if(this.JITCompile&&t[y][m]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=t[y][m];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=t[y][m];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var I=0;I<3;I++){b=c[I];h=k.prevKey[b];j=k.nextKey[b];if(j.time<=z){if(x<z)if(this.loop){h=this.data.hierarchy[y].keys[0];for(j=this.getNextKeyWith(b,y,1);j.time<x;){h=j;j=this.getNextKeyWith(b,y,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,y,j.index+1)}while(j.time<
-x)}k.prevKey[b]=h;k.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(x-h.time)/(j.time-h.time);e=h[b];g=j[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+y);d=d<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",y,h.index-1).pos;this.points[1]=e;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",y,j.index+1).pos;d=d*0.33+0.33;e=this.interpolateCatmullRom(this.points,d);b.x=e[0];b.y=e[1];b.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){d=this.interpolateCatmullRom(this.points,d*1.01);this.target.set(d[0],d[1],d[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();d=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,d,0)}}}else if(b===
-"rot")THREE.Quaternion.slerp(e,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=e[0]+(g[0]-e[0])*d;b.y=e[1]+(g[1]-e[1])*d;b.z=e[2]+(g[2]-e[2])*d}}}}if(this.JITCompile&&t[0][m]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y<this.hierarchy.length;y++)t[y][m]=this.hierarchy[y]instanceof THREE.Bone?this.hierarchy[y].skinMatrix.clone():this.hierarchy[y].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],e,g,h,j,k,m;e=(a.length-1)*c;g=Math.floor(e);e-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];j=a[b[1]];k=a[b[2]];m=a[b[3]];b=e*e;h=e*b;d[0]=this.interpolate(g[0],j[0],k[0],m[0],e,b,h);d[1]=this.interpolate(g[1],j[1],k[1],m[1],e,b,h);d[2]=this.interpolate(g[2],j[2],k[2],m[2],e,b,h);return d};
-THREE.Animation.prototype.interpolate=function(a,c,b,d,e,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*e+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<d.length-1?b:d.length-1;else b%=d.length;for(;b<d.length;b++)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==undefined)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
-THREE.Camera=function(a,c,b,d,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,f,g,h,k,m,n,p=this.data.JIT.hierarchy,x,z;this.currentTime+=a*this.timeScale;z=this.currentTime;x=this.currentTime%=this.data.length;n=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var y=0,B=this.hierarchy.length;y<B;y++){a=this.hierarchy[y];m=a.animationCache;if(this.JITCompile&&p[y][n]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=p[y][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=p[y][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var H=0;H<3;H++){b=c[H];h=m.prevKey[b];k=m.nextKey[b];if(k.time<=z){if(x<z)if(this.loop){h=this.data.hierarchy[y].keys[0];for(k=this.getNextKeyWith(b,y,1);k.time<x;){h=k;k=this.getNextKeyWith(b,y,k.index+1)}}else{this.stop();return}else{do{h=k;k=this.getNextKeyWith(b,y,k.index+1)}while(k.time<
+x)}m.prevKey[b]=h;m.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(x-h.time)/(k.time-h.time);f=h[b];g=k[b];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+y);e=e<0?0:1}if(b==="pos"){b=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",y,h.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",y,k.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);b.x=f[0];b.y=f[1];b.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(b===
+"rot")THREE.Quaternion.slerp(f,g,a.quaternion,e);else if(b==="scl"){b=a.scale;b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}}}}if(this.JITCompile&&p[0][n]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y<this.hierarchy.length;y++)p[y][n]=this.hierarchy[y]instanceof THREE.Bone?this.hierarchy[y].skinMatrix.clone():this.hierarchy[y].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],f,g,h,k,m,n;f=(a.length-1)*c;g=Math.floor(f);f-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];k=a[b[1]];m=a[b[2]];n=a[b[3]];b=f*f;h=f*b;e[0]=this.interpolate(g[0],k[0],m[0],n[0],f,b,h);e[1]=this.interpolate(g[1],k[1],m[1],n[1],f,b,h);e[2]=this.interpolate(g[2],k[2],m[2],n[2],f,b,h);return e};
+THREE.Animation.prototype.interpolate=function(a,c,b,e,f,g,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-3*(c-b)-2*a-e)*g+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<e.length-1?b:e.length-1;else b%=e.length;for(;b<e.length;b++)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
+THREE.Camera=function(a,c,b,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
 THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
 THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
 !1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};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;
@@ -110,89 +110,96 @@ undefined)this.wireframeLinewidth=a.wireframeLinewidth}};THREE.MeshFaceMaterial=
 THREE.MeshShaderMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.vertexShader=this.fragmentShader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.lights=!1;this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;if(a){if(a.fragmentShader!==undefined)this.fragmentShader=a.fragmentShader;if(a.vertexShader!==
 undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframeLinewidth!==undefined)this.wireframeLinewidth=a.wireframeLinewidth;if(a.wireframeLinecap!==undefined)this.wireframeLinecap=a.wireframeLinecap;
 if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
-THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
-a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
+THREE.ShadowVolumeDynamicMaterial=function(){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=
+!1};
+THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=a.sizeAttenuation;
+if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.ParticleCanvasMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.program=function(){};this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.program!==undefined)this.program=a.program;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleDOMMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.domElement=a};
-THREE.Texture=function(a,c,b,d,e,g){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=b!==undefined?b:THREE.ClampToEdgeWrapping;this.wrapT=d!==undefined?d:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
+THREE.Texture=function(a,c,b,e,f,g){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=b!==undefined?b:THREE.ClampToEdgeWrapping;this.wrapT=e!==undefined?e:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
 THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
 THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
 THREE.RenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==undefined?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==undefined?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==undefined?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==undefined?b.minFilter:THREE.LinearMipMapLinearFilter;this.format=b.format!==undefined?b.format:THREE.RGBFormat;this.type=b.type!==undefined?b.type:THREE.UnsignedByteType};
-var Uniforms={clone:function(a){var c,b,d,e={};for(c in a){e[c]={};for(b in a[c]){d=a[c][b];e[c][b]=d instanceof THREE.Color||d instanceof THREE.Vector3||d instanceof THREE.Texture?d.clone():d}}return e},merge:function(a){var c,b,d,e={};for(c=0;c<a.length;c++){d=this.clone(a[c]);for(b in d)e[b]=d[b]}return e}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
+var Uniforms={clone:function(a){var c,b,e,f={};for(c in a){f[c]={};for(b in a[c]){e=a[c][b];f[c][b]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return f},merge:function(a){var c,b,e,f={};for(c=0;c<a.length;c++){e=this.clone(a[c]);for(b in e)f[b]=e[b]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
 THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,b){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=b!=undefined?b:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
 THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var b=0;b<this.geometry.morphTargets.length;b++){this.morphTargetInfluences.push(0);
 this.morphTargetDictionary[this.geometry.morphTargets[b].name]=b}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.skinMatrix,c,b):a.update(this.matrixWorld,!0,b)}}else for(d=0;d<e;d++)this.children[d].update(this.skinMatrix,
+THREE.Bone.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,c,b):a.update(this.matrixWorld,!0,b)}}else for(e=0;e<f;e++)this.children[e].update(this.skinMatrix,
 c,b)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
-THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,d,e,g,h,j;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){e=this.geometry.bones[b];g=e.pos;h=e.rotq;j=e.scl;d=this.addBone();d.name=e.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[3]);d.useQuaternion=!0;j!==undefined?d.scale.set(j[0],j[1],j[2]):d.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){e=this.geometry.bones[b];
-d=this.bones[b];e.parent===-1?this.addChild(d):this.bones[e.parent].addChild(d)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
-THREE.SkinnedMesh.prototype.update=function(a,c,b){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d,e=this.children.length;for(d=0;d<e;d++){a=this.children[d];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,b):a.update(this.matrixWorld,c,b)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<b;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
+THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var b,e,f,g,h,k;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){f=this.geometry.bones[b];g=f.pos;h=f.rotq;k=f.scl;e=this.addBone();e.name=f.name;e.position.set(g[0],g[1],g[2]);e.quaternion.set(h[0],h[1],h[2],h[3]);e.useQuaternion=!0;k!==undefined?e.scale.set(k[0],k[1],k[2]):e.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){f=this.geometry.bones[b];
+e=this.bones[b];f.parent===-1?this.addChild(e):this.bones[f.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
+THREE.SkinnedMesh.prototype.update=function(a,c,b){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e,f=this.children.length;for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,b):a.update(this.matrixWorld,c,b)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<b;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
 c*16)}};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,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){b=this.geometry.vertices[a].position;var e=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
-d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[e].multiplyVector3(d));d=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[g].multiplyVector3(d));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=b;this.geometry.skinWeights[a].y+=b}}}};
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){b=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,g=this.geometry.skinIndices[a].y;
+e=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesA.push(c[f].multiplyVector3(e));e=new THREE.Vector3(b.x,b.y,b.z);this.geometry.skinVerticesB.push(c[g].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){b=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=b;this.geometry.skinWeights[a].y+=b}}}};
 THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
-THREE.Sound=function(a,c,b,d){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,b!==undefined?b:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=d!==undefined?d:!0;this.sources=a instanceof Array?a:[a];var e;b=this.sources.length;for(a=0;a<b;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)e=
-"audio/mpeg";else if(c.indexOf(".ogg")!==-1)e="audio/ogg";else c.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
+THREE.Sound=function(a,c,b,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,b!==undefined?b:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var f;b=this.sources.length;for(a=0;a<b;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)f=
+"audio/mpeg";else if(c.indexOf(".ogg")!==-1)f="audio/ogg";else c.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,c,b){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var d=this.children.length;for(a=0;a<d;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
+THREE.Sound.prototype.update=function(a,c,b){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
 THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,c){c===undefined&&(c=0);c=Math.abs(c);for(var b=0;b<this.LODs.length;b++)if(c<this.LODs[b].visibleAtDistance)break;this.LODs.splice(b,0,{visibleAtDistance:c,object3D:a});this.addChild(a)};
-THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){a=b.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var d=1;d<this.LODs.length;d++)if(a>=this.LODs[d].visibleAtDistance){this.LODs[d-1].object3D.visible=
-!1;this.LODs[d].object3D.visible=!0}else break;for(;d<this.LODs.length;d++)this.LODs[d].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
+THREE.LOD.prototype.update=function(a,c,b){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){a=b.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(a>=this.LODs[e].visibleAtDistance){this.LODs[e-1].object3D.visible=
+!1;this.LODs[e].object3D.visible=!0}else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.ShadowVolume=function(a,c){THREE.Mesh.call(this,a.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);a.addChild(this);this.calculateShadowVolumeGeometry(a.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
+THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(a){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=a.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,b=this.geometry.faces,e=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var g=f.length,h,k,m,n,p,x=["a","b","c","d"];for(m=0;m<g;m++){k=c.length;h=f[m];if(h instanceof THREE.Face4){n=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{n=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(h.normal);b.push(k);for(k=
+0;k<n;k++){p=a[h[x[k]]];c.push(new THREE.Vertex(p.position.clone()))}}for(g=0;g<f.length-1;g++){a=b[g];for(h=g+1;h<f.length;h++){k=b[h];k=this.facesShareEdge(c,a,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);e.push(k)}}}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,b){var e,f,g,h,k,m,n,p,x,z,y,B,H,I=0,F=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=b instanceof THREE.Face4?4:3;for(B=0;B<e;B++){g=c[F[B]];k=a[g];for(H=0;H<f;H++){h=b[F[H]];m=a[h];if(Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4){I++;if(I===1){n=k;p=m;x=g;z=h;y=F[B]}if(I===2){y+=F[B];return y==="ad"||y==="ac"?{faces:[c,b],vertices:[n,p,m,k],indices:[x,
+z,h,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,b],vertices:[n,k,m,p],indices:[x,g,h,z],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
 THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
 THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
 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,c,b){this.color=new THREE.Color(a);this.near=c||1;this.far=b||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
-THREE.Projector=function(){function a(){var da=k[j]=k[j]||new THREE.RenderableVertex;j++;return da}function c(da,X){return X.z-da.z}function b(da,X){var va=0,wa=1,Ca=da.z+da.w,ja=X.z+X.w,U=-da.z+da.w,fa=-X.z+X.w;if(Ca>=0&&ja>=0&&U>=0&&fa>=0)return!0;else if(Ca<0&&ja<0||U<0&&fa<0)return!1;else{if(Ca<0)va=Math.max(va,Ca/(Ca-ja));else ja<0&&(wa=Math.min(wa,Ca/(Ca-ja)));if(U<0)va=Math.max(va,U/(U-fa));else fa<0&&(wa=Math.min(wa,U/(U-fa)));if(wa<va)return!1;else{da.lerpSelf(X,va);X.lerpSelf(da,1-wa);return!0}}}
-var d,e,g=[],h,j,k=[],m,t,x=[],z,y=[],B,I,F=[],G,L,A=[],P=new THREE.Vector4,R=new THREE.Vector4,M=new THREE.Matrix4,ia=new THREE.Matrix4,f=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ea=new THREE.Vector4,W=new THREE.Vector4;this.projectVector=function(da,X){M.multiply(X.projectionMatrix,X.matrixWorldInverse);M.multiplyVector3(da);return da};this.unprojectVector=function(da,X){M.multiply(X.matrixWorld,THREE.Matrix4.makeInvert(X.projectionMatrix));
-M.multiplyVector3(da);return da};this.projectObjects=function(da,X,va){X=[];var wa,Ca,ja;e=0;Ca=da.objects;da=0;for(wa=Ca.length;da<wa;da++){ja=Ca[da];var U;if(!(U=!ja.visible))if(U=ja instanceof THREE.Mesh){a:{U=void 0;for(var fa=ja.matrixWorld,Y=-ja.geometry.boundingSphere.radius*Math.max(ja.scale.x,Math.max(ja.scale.y,ja.scale.z)),S=0;S<6;S++){U=f[S].x*fa.n14+f[S].y*fa.n24+f[S].z*fa.n34+f[S].w;if(U<=Y){U=!1;break a}}U=!0}U=!U}if(!U){U=g[e]=g[e]||new THREE.RenderableObject;e++;d=U;P.copy(ja.position);
-M.multiplyVector3(P);d.object=ja;d.z=P.z;X.push(d)}}va&&X.sort(c);return X};this.projectScene=function(da,X,va){var wa=[],Ca=X.near,ja=X.far,U,fa,Y,S,O,ga,sa,ma,ta,za,Ma,bb,n,D,p,o,w;L=I=z=t=0;X.matrixAutoUpdate&&X.updateMatrix();da.update(undefined,!1,X);M.multiply(X.projectionMatrix,X.matrixWorldInverse);f[0].set(M.n41-M.n11,M.n42-M.n12,M.n43-M.n13,M.n44-M.n14);f[1].set(M.n41+M.n11,M.n42+M.n12,M.n43+M.n13,M.n44+M.n14);f[2].set(M.n41+M.n21,M.n42+M.n22,M.n43+M.n23,M.n44+M.n24);f[3].set(M.n41-M.n21,
-M.n42-M.n22,M.n43-M.n23,M.n44-M.n24);f[4].set(M.n41-M.n31,M.n42-M.n32,M.n43-M.n33,M.n44-M.n34);f[5].set(M.n41+M.n31,M.n42+M.n32,M.n43+M.n33,M.n44+M.n34);for(U=0;U<6;U++){ta=f[U];ta.divideScalar(Math.sqrt(ta.x*ta.x+ta.y*ta.y+ta.z*ta.z))}ta=this.projectObjects(da,X,!0);da=0;for(U=ta.length;da<U;da++){za=ta[da].object;if(za.visible){Ma=za.matrixWorld;bb=za.matrixRotationWorld;n=za.materials;D=za.overdraw;j=0;if(za instanceof THREE.Mesh){p=za.geometry;S=p.vertices;o=p.faces;p=p.faceVertexUvs;fa=0;for(Y=
-S.length;fa<Y;fa++){h=a();h.positionWorld.copy(S[fa].position);Ma.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);M.multiplyVector4(h.positionScreen);h.positionScreen.x/=h.positionScreen.w;h.positionScreen.y/=h.positionScreen.w;h.visible=h.positionScreen.z>Ca&&h.positionScreen.z<ja}S=0;for(fa=o.length;S<fa;S++){Y=o[S];if(Y instanceof THREE.Face3){O=k[Y.a];ga=k[Y.b];sa=k[Y.c];if(O.visible&&ga.visible&&sa.visible&&(za.doubleSided||za.flipSided!=(sa.positionScreen.x-O.positionScreen.x)*
-(ga.positionScreen.y-O.positionScreen.y)-(sa.positionScreen.y-O.positionScreen.y)*(ga.positionScreen.x-O.positionScreen.x)<0)){ma=x[t]=x[t]||new THREE.RenderableFace3;t++;m=ma;m.v1.copy(O);m.v2.copy(ga);m.v3.copy(sa)}else continue}else if(Y instanceof THREE.Face4){O=k[Y.a];ga=k[Y.b];sa=k[Y.c];ma=k[Y.d];if(O.visible&&ga.visible&&sa.visible&&ma.visible&&(za.doubleSided||za.flipSided!=((ma.positionScreen.x-O.positionScreen.x)*(ga.positionScreen.y-O.positionScreen.y)-(ma.positionScreen.y-O.positionScreen.y)*
-(ga.positionScreen.x-O.positionScreen.x)<0||(ga.positionScreen.x-sa.positionScreen.x)*(ma.positionScreen.y-sa.positionScreen.y)-(ga.positionScreen.y-sa.positionScreen.y)*(ma.positionScreen.x-sa.positionScreen.x)<0))){w=y[z]=y[z]||new THREE.RenderableFace4;z++;m=w;m.v1.copy(O);m.v2.copy(ga);m.v3.copy(sa);m.v4.copy(ma)}else continue}m.normalWorld.copy(Y.normal);bb.multiplyVector3(m.normalWorld);m.centroidWorld.copy(Y.centroid);Ma.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);
-M.multiplyVector3(m.centroidScreen);sa=Y.vertexNormals;O=0;for(ga=sa.length;O<ga;O++){ma=m.vertexNormalsWorld[O];ma.copy(sa[O]);bb.multiplyVector3(ma)}O=0;for(ga=p.length;O<ga;O++)if(w=p[O][S]){sa=0;for(ma=w.length;sa<ma;sa++)m.uvs[O][sa]=w[sa]}m.meshMaterials=n;m.faceMaterials=Y.materials;m.overdraw=D;m.z=m.centroidScreen.z;wa.push(m)}}else if(za instanceof THREE.Line){ia.multiply(M,Ma);S=za.geometry.vertices;O=a();O.positionScreen.copy(S[0].position);ia.multiplyVector4(O.positionScreen);fa=1;for(Y=
-S.length;fa<Y;fa++){O=a();O.positionScreen.copy(S[fa].position);ia.multiplyVector4(O.positionScreen);ga=k[j-2];ea.copy(O.positionScreen);W.copy(ga.positionScreen);if(b(ea,W)){ea.multiplyScalar(1/ea.w);W.multiplyScalar(1/W.w);Ma=F[I]=F[I]||new THREE.RenderableLine;I++;B=Ma;B.v1.positionScreen.copy(ea);B.v2.positionScreen.copy(W);B.z=Math.max(ea.z,W.z);B.materials=za.materials;wa.push(B)}}}else if(za instanceof THREE.Particle){R.set(za.position.x,za.position.y,za.position.z,1);M.multiplyVector4(R);
-R.z/=R.w;if(R.z>0&&R.z<1){Ma=A[L]=A[L]||new THREE.RenderableParticle;L++;G=Ma;G.x=R.x/R.w;G.y=R.y/R.w;G.z=R.z;G.rotation=za.rotation.z;G.scale.x=za.scale.x*Math.abs(G.x-(R.x+X.projectionMatrix.n11)/(R.w+X.projectionMatrix.n14));G.scale.y=za.scale.y*Math.abs(G.y-(R.y+X.projectionMatrix.n22)/(R.w+X.projectionMatrix.n24));G.materials=za.materials;wa.push(G)}}}}va&&wa.sort(c);return wa}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,e,g;this.domElement=document.createElement("div");this.setSize=function(h,j){b=h;d=j;e=b/2;g=d/2};this.render=function(h,j){var k,m,t,x,z,y,B,I;a=c.projectScene(h,j);k=0;for(m=a.length;k<m;k++){z=a[k];if(z instanceof THREE.RenderableParticle){B=z.x*e+e;I=z.y*g+g;t=0;for(x=z.material.length;t<x;t++){y=z.material[t];if(y instanceof THREE.ParticleDOMMaterial){y=y.domElement;y.style.left=B+"px";y.style.top=I+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(Ea){if(z!=Ea)m.globalAlpha=z=Ea}function c(Ea){if(y!=Ea){switch(Ea){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}y=Ea}}var b=null,d=new THREE.Projector,e=document.createElement("canvas"),g,h,j,k,m=e.getContext("2d"),t=new THREE.Color(0),x=0,z=1,y=0,B=null,I=null,F=1,G,L,A,P,R=new THREE.RenderableVertex,
-M=new THREE.RenderableVertex,ia,f,ea,W,da,X,va,wa,Ca,ja,U,fa,Y=new THREE.Color,S=new THREE.Color,O=new THREE.Color,ga=new THREE.Color,sa=new THREE.Color,ma,ta,za,Ma,bb,n,D,p,o,w,E=new THREE.Rectangle,C=new THREE.Rectangle,H=new THREE.Rectangle,aa=!1,Q=new THREE.Color,K=new THREE.Color,ra=new THREE.Color,Fa=new THREE.Color,ca=new THREE.Vector3,Ba,na,Ha,Na,ya,Ja,Z=16;Ba=document.createElement("canvas");Ba.width=Ba.height=2;na=Ba.getContext("2d");na.fillStyle="rgba(0,0,0,1)";na.fillRect(0,0,2,2);Ha=
-na.getImageData(0,0,2,2);Na=Ha.data;ya=document.createElement("canvas");ya.width=ya.height=Z;Ja=ya.getContext("2d");Ja.translate(-Z/2,-Z/2);Ja.scale(Z,Z);Z--;this.domElement=e;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(Ea,Da){g=Ea;h=Da;j=g/2;k=h/2;e.width=g;e.height=h;E.set(-j,-k,j,k);z=1;y=0;I=B=null;F=1};this.setClearColor=function(Ea,Da){t=Ea;x=Da};this.setClearColorHex=function(Ea,Da){t.setHex(Ea);x=Da};this.clear=function(){m.setTransform(1,0,0,-1,j,k);if(!C.isEmpty()){C.inflate(1);
-C.minSelf(E);if(t.hex==0&&x==0)m.clearRect(C.getX(),C.getY(),C.getWidth(),C.getHeight());else{c(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+x+")";m.fillRect(C.getX(),C.getY(),C.getWidth(),C.getHeight())}C.empty()}};this.render=function(Ea,Da){function Za(J){var $,V,ha,Aa=J.lights;K.setRGB(0,0,0);ra.setRGB(0,0,0);Fa.setRGB(0,0,0);J=0;for($=Aa.length;J<$;J++){V=Aa[J];ha=V.color;if(V instanceof THREE.AmbientLight){K.r+=ha.r;K.g+=
-ha.g;K.b+=ha.b}else if(V instanceof THREE.DirectionalLight){ra.r+=ha.r;ra.g+=ha.g;ra.b+=ha.b}else if(V instanceof THREE.PointLight){Fa.r+=ha.r;Fa.g+=ha.g;Fa.b+=ha.b}}}function ua(J,$,V,ha){var Aa,qa,pa,T,La=J.lights;J=0;for(Aa=La.length;J<Aa;J++){qa=La[J];pa=qa.color;T=qa.intensity;if(qa instanceof THREE.DirectionalLight){qa=V.dot(qa.position)*T;if(qa>0){ha.r+=pa.r*qa;ha.g+=pa.g*qa;ha.b+=pa.b*qa}}else if(qa instanceof THREE.PointLight){ca.sub(qa.position,$);ca.normalize();qa=V.dot(ca)*T;if(qa>0){ha.r+=
-pa.r*qa;ha.g+=pa.g*qa;ha.b+=pa.b*qa}}}}function ka(J,$,V){a(V.opacity);c(V.blending);var ha,Aa,qa,pa,T,La;if(V instanceof THREE.ParticleBasicMaterial){if(V.map){pa=V.map.image;T=pa.width>>1;La=pa.height>>1;V=$.scale.x*j;qa=$.scale.y*k;ha=V*T;Aa=qa*La;H.set(J.x-ha,J.y-Aa,J.x+ha,J.y+Aa);if(E.instersects(H)){m.save();m.translate(J.x,J.y);m.rotate(-$.rotation);m.scale(V,-qa);m.translate(-T,-La);m.drawImage(pa,0,0);m.restore()}}}else if(V instanceof THREE.ParticleCanvasMaterial){if(aa){Q.r=K.r+ra.r+Fa.r;
-Q.g=K.g+ra.g+Fa.g;Q.b=K.b+ra.b+Fa.b;Y.r=V.color.r*Q.r;Y.g=V.color.g*Q.g;Y.b=V.color.b*Q.b;Y.updateStyleString()}else Y.__styleString=V.color.__styleString;ha=$.scale.x*j;Aa=$.scale.y*k;H.set(J.x-ha,J.y-Aa,J.x+ha,J.y+Aa);if(E.instersects(H)){m.save();m.translate(J.x,J.y);m.rotate(-$.rotation);m.scale(ha,Aa);V.program(m,Y);m.restore()}}}function la(J,$,V,ha){a(ha.opacity);c(ha.blending);m.beginPath();m.moveTo(J.positionScreen.x,J.positionScreen.y);m.lineTo($.positionScreen.x,$.positionScreen.y);m.closePath();
-if(ha instanceof THREE.LineBasicMaterial){Y.__styleString=ha.color.__styleString;J=ha.linewidth;if(F!=J)m.lineWidth=F=J;J=Y.__styleString;if(B!=J)m.strokeStyle=B=J;m.stroke();H.inflate(ha.linewidth*2)}}function oa(J,$,V,ha,Aa,qa,pa,T,La){a(T.opacity);c(T.blending);ia=J.positionScreen.x;f=J.positionScreen.y;ea=$.positionScreen.x;W=$.positionScreen.y;da=V.positionScreen.x;X=V.positionScreen.y;Ta(ia,f,ea,W,da,X);if(T instanceof THREE.MeshBasicMaterial)if(T.map){if(T.map.mapping instanceof THREE.UVMapping){Ma=
-pa.uvs[0];Ua(ia,f,ea,W,da,X,T.map.image,Ma[ha].u,Ma[ha].v,Ma[Aa].u,Ma[Aa].v,Ma[qa].u,Ma[qa].v)}}else if(T.envMap){if(T.envMap.mapping instanceof THREE.SphericalReflectionMapping){J=Da.matrixWorldInverse;ca.copy(pa.vertexNormalsWorld[0]);bb=(ca.x*J.n11+ca.y*J.n12+ca.z*J.n13)*0.5+0.5;n=-(ca.x*J.n21+ca.y*J.n22+ca.z*J.n23)*0.5+0.5;ca.copy(pa.vertexNormalsWorld[1]);D=(ca.x*J.n11+ca.y*J.n12+ca.z*J.n13)*0.5+0.5;p=-(ca.x*J.n21+ca.y*J.n22+ca.z*J.n23)*0.5+0.5;ca.copy(pa.vertexNormalsWorld[2]);o=(ca.x*J.n11+
-ca.y*J.n12+ca.z*J.n13)*0.5+0.5;w=-(ca.x*J.n21+ca.y*J.n22+ca.z*J.n23)*0.5+0.5;Ua(ia,f,ea,W,da,X,T.envMap.image,bb,n,D,p,o,w)}}else T.wireframe?Oa(T.color.__styleString,T.wireframeLinewidth):Ya(T.color.__styleString);else if(T instanceof THREE.MeshLambertMaterial){if(T.map&&!T.wireframe){if(T.map.mapping instanceof THREE.UVMapping){Ma=pa.uvs[0];Ua(ia,f,ea,W,da,X,T.map.image,Ma[ha].u,Ma[ha].v,Ma[Aa].u,Ma[Aa].v,Ma[qa].u,Ma[qa].v)}c(THREE.SubtractiveBlending)}if(aa)if(!T.wireframe&&T.shading==THREE.SmoothShading&&
-pa.vertexNormalsWorld.length==3){S.r=O.r=ga.r=K.r;S.g=O.g=ga.g=K.g;S.b=O.b=ga.b=K.b;ua(La,pa.v1.positionWorld,pa.vertexNormalsWorld[0],S);ua(La,pa.v2.positionWorld,pa.vertexNormalsWorld[1],O);ua(La,pa.v3.positionWorld,pa.vertexNormalsWorld[2],ga);sa.r=(O.r+ga.r)*0.5;sa.g=(O.g+ga.g)*0.5;sa.b=(O.b+ga.b)*0.5;za=Ka(S,O,ga,sa);Ua(ia,f,ea,W,da,X,za,0,0,1,0,0,1)}else{Q.r=K.r;Q.g=K.g;Q.b=K.b;ua(La,pa.centroidWorld,pa.normalWorld,Q);Y.r=T.color.r*Q.r;Y.g=T.color.g*Q.g;Y.b=T.color.b*Q.b;Y.updateStyleString();
-T.wireframe?Oa(Y.__styleString,T.wireframeLinewidth):Ya(Y.__styleString)}else T.wireframe?Oa(T.color.__styleString,T.wireframeLinewidth):Ya(T.color.__styleString)}else if(T instanceof THREE.MeshDepthMaterial){ma=Da.near;ta=Da.far;S.r=S.g=S.b=1-Wa(J.positionScreen.z,ma,ta);O.r=O.g=O.b=1-Wa($.positionScreen.z,ma,ta);ga.r=ga.g=ga.b=1-Wa(V.positionScreen.z,ma,ta);sa.r=(O.r+ga.r)*0.5;sa.g=(O.g+ga.g)*0.5;sa.b=(O.b+ga.b)*0.5;za=Ka(S,O,ga,sa);Ua(ia,f,ea,W,da,X,za,0,0,1,0,0,1)}else if(T instanceof THREE.MeshNormalMaterial){Y.r=
-Pa(pa.normalWorld.x);Y.g=Pa(pa.normalWorld.y);Y.b=Pa(pa.normalWorld.z);Y.updateStyleString();T.wireframe?Oa(Y.__styleString,T.wireframeLinewidth):Ya(Y.__styleString)}}function Qa(J,$,V,ha,Aa,qa,pa,T,La){a(T.opacity);c(T.blending);if(T.map||T.envMap){oa(J,$,ha,0,1,3,pa,T,La);oa(Aa,V,qa,1,2,3,pa,T,La)}else{ia=J.positionScreen.x;f=J.positionScreen.y;ea=$.positionScreen.x;W=$.positionScreen.y;da=V.positionScreen.x;X=V.positionScreen.y;va=ha.positionScreen.x;wa=ha.positionScreen.y;Ca=Aa.positionScreen.x;
-ja=Aa.positionScreen.y;U=qa.positionScreen.x;fa=qa.positionScreen.y;if(T instanceof THREE.MeshBasicMaterial){gb(ia,f,ea,W,da,X,va,wa);T.wireframe?Oa(T.color.__styleString,T.wireframeLinewidth):Ya(T.color.__styleString)}else if(T instanceof THREE.MeshLambertMaterial)if(aa)if(!T.wireframe&&T.shading==THREE.SmoothShading&&pa.vertexNormalsWorld.length==4){S.r=O.r=ga.r=sa.r=K.r;S.g=O.g=ga.g=sa.g=K.g;S.b=O.b=ga.b=sa.b=K.b;ua(La,pa.v1.positionWorld,pa.vertexNormalsWorld[0],S);ua(La,pa.v2.positionWorld,pa.vertexNormalsWorld[1],
-O);ua(La,pa.v4.positionWorld,pa.vertexNormalsWorld[3],ga);ua(La,pa.v3.positionWorld,pa.vertexNormalsWorld[2],sa);za=Ka(S,O,ga,sa);Ta(ia,f,ea,W,va,wa);Ua(ia,f,ea,W,va,wa,za,0,0,1,0,0,1);Ta(Ca,ja,da,X,U,fa);Ua(Ca,ja,da,X,U,fa,za,1,0,1,1,0,1)}else{Q.r=K.r;Q.g=K.g;Q.b=K.b;ua(La,pa.centroidWorld,pa.normalWorld,Q);Y.r=T.color.r*Q.r;Y.g=T.color.g*Q.g;Y.b=T.color.b*Q.b;Y.updateStyleString();gb(ia,f,ea,W,da,X,va,wa);T.wireframe?Oa(Y.__styleString,T.wireframeLinewidth):Ya(Y.__styleString)}else{gb(ia,f,ea,W,
-da,X,va,wa);T.wireframe?Oa(T.color.__styleString,T.wireframeLinewidth):Ya(T.color.__styleString)}else if(T instanceof THREE.MeshNormalMaterial){Y.r=Pa(pa.normalWorld.x);Y.g=Pa(pa.normalWorld.y);Y.b=Pa(pa.normalWorld.z);Y.updateStyleString();gb(ia,f,ea,W,da,X,va,wa);T.wireframe?Oa(Y.__styleString,T.wireframeLinewidth):Ya(Y.__styleString)}else if(T instanceof THREE.MeshDepthMaterial){ma=Da.near;ta=Da.far;S.r=S.g=S.b=1-Wa(J.positionScreen.z,ma,ta);O.r=O.g=O.b=1-Wa($.positionScreen.z,ma,ta);ga.r=ga.g=
-ga.b=1-Wa(ha.positionScreen.z,ma,ta);sa.r=sa.g=sa.b=1-Wa(V.positionScreen.z,ma,ta);za=Ka(S,O,ga,sa);Ta(ia,f,ea,W,va,wa);Ua(ia,f,ea,W,va,wa,za,0,0,1,0,0,1);Ta(Ca,ja,da,X,U,fa);Ua(Ca,ja,da,X,U,fa,za,1,0,1,1,0,1)}}}function Ta(J,$,V,ha,Aa,qa){m.beginPath();m.moveTo(J,$);m.lineTo(V,ha);m.lineTo(Aa,qa);m.lineTo(J,$);m.closePath()}function gb(J,$,V,ha,Aa,qa,pa,T){m.beginPath();m.moveTo(J,$);m.lineTo(V,ha);m.lineTo(Aa,qa);m.lineTo(pa,T);m.lineTo(J,$);m.closePath()}function Oa(J,$){if(B!=J)m.strokeStyle=
-B=J;if(F!=$)m.lineWidth=F=$;m.stroke();H.inflate($*2)}function Ya(J){if(I!=J)m.fillStyle=I=J;m.fill()}function Ua(J,$,V,ha,Aa,qa,pa,T,La,db,$a,eb,ib){var cb,fb;cb=pa.width-1;fb=pa.height-1;T*=cb;La*=fb;db*=cb;$a*=fb;eb*=cb;ib*=fb;V-=J;ha-=$;Aa-=J;qa-=$;db-=T;$a-=La;eb-=T;ib-=La;cb=db*ib-eb*$a;if(cb!=0){fb=1/cb;cb=(ib*V-$a*Aa)*fb;$a=(ib*ha-$a*qa)*fb;V=(db*Aa-eb*V)*fb;ha=(db*qa-eb*ha)*fb;J=J-cb*T-V*La;$=$-$a*T-ha*La;m.save();m.transform(cb,$a,V,ha,J,$);m.clip();m.drawImage(pa,0,0);m.restore()}}function Ka(J,
-$,V,ha){var Aa=~~(J.r*255),qa=~~(J.g*255);J=~~(J.b*255);var pa=~~($.r*255),T=~~($.g*255);$=~~($.b*255);var La=~~(V.r*255),db=~~(V.g*255);V=~~(V.b*255);var $a=~~(ha.r*255),eb=~~(ha.g*255);ha=~~(ha.b*255);Na[0]=Aa<0?0:Aa>255?255:Aa;Na[1]=qa<0?0:qa>255?255:qa;Na[2]=J<0?0:J>255?255:J;Na[4]=pa<0?0:pa>255?255:pa;Na[5]=T<0?0:T>255?255:T;Na[6]=$<0?0:$>255?255:$;Na[8]=La<0?0:La>255?255:La;Na[9]=db<0?0:db>255?255:db;Na[10]=V<0?0:V>255?255:V;Na[12]=$a<0?0:$a>255?255:$a;Na[13]=eb<0?0:eb>255?255:eb;Na[14]=ha<
-0?0:ha>255?255:ha;na.putImageData(Ha,0,0);Ja.drawImage(Ba,0,0);return ya}function Wa(J,$,V){J=(J-$)/(V-$);return J*J*(3-2*J)}function Pa(J){J=(J+1)*0.5;return J<0?0:J>1?1:J}function N(J,$){var V=$.x-J.x,ha=$.y-J.y,Aa=1/Math.sqrt(V*V+ha*ha);V*=Aa;ha*=Aa;$.x+=V;$.y+=ha;J.x-=V;J.y-=ha}var Ra,Va,Ga,ab,Xa,Ia,Sa,xa;this.autoClear?this.clear():m.setTransform(1,0,0,-1,j,k);b=d.projectScene(Ea,Da,this.sortElements);(aa=Ea.lights.length>0)&&Za(Ea);Ra=0;for(Va=b.length;Ra<Va;Ra++){Ga=b[Ra];H.empty();if(Ga instanceof
-THREE.RenderableParticle){G=Ga;G.x*=j;G.y*=k;ab=0;for(Xa=Ga.materials.length;ab<Xa;){xa=Ga.materials[ab++];xa.opacity!=0&&ka(G,Ga,xa,Ea)}}else if(Ga instanceof THREE.RenderableLine){G=Ga.v1;L=Ga.v2;G.positionScreen.x*=j;G.positionScreen.y*=k;L.positionScreen.x*=j;L.positionScreen.y*=k;H.addPoint(G.positionScreen.x,G.positionScreen.y);H.addPoint(L.positionScreen.x,L.positionScreen.y);if(E.instersects(H)){ab=0;for(Xa=Ga.materials.length;ab<Xa;){xa=Ga.materials[ab++];xa.opacity!=0&&la(G,L,Ga,xa,Ea)}}}else if(Ga instanceof
-THREE.RenderableFace3){G=Ga.v1;L=Ga.v2;A=Ga.v3;G.positionScreen.x*=j;G.positionScreen.y*=k;L.positionScreen.x*=j;L.positionScreen.y*=k;A.positionScreen.x*=j;A.positionScreen.y*=k;if(Ga.overdraw){N(G.positionScreen,L.positionScreen);N(L.positionScreen,A.positionScreen);N(A.positionScreen,G.positionScreen)}H.add3Points(G.positionScreen.x,G.positionScreen.y,L.positionScreen.x,L.positionScreen.y,A.positionScreen.x,A.positionScreen.y);if(E.instersects(H)){ab=0;for(Xa=Ga.meshMaterials.length;ab<Xa;){xa=
-Ga.meshMaterials[ab++];if(xa instanceof THREE.MeshFaceMaterial){Ia=0;for(Sa=Ga.faceMaterials.length;Ia<Sa;)(xa=Ga.faceMaterials[Ia++])&&xa.opacity!=0&&oa(G,L,A,0,1,2,Ga,xa,Ea)}else xa.opacity!=0&&oa(G,L,A,0,1,2,Ga,xa,Ea)}}}else if(Ga instanceof THREE.RenderableFace4){G=Ga.v1;L=Ga.v2;A=Ga.v3;P=Ga.v4;G.positionScreen.x*=j;G.positionScreen.y*=k;L.positionScreen.x*=j;L.positionScreen.y*=k;A.positionScreen.x*=j;A.positionScreen.y*=k;P.positionScreen.x*=j;P.positionScreen.y*=k;R.positionScreen.copy(L.positionScreen);
-M.positionScreen.copy(P.positionScreen);if(Ga.overdraw){N(G.positionScreen,L.positionScreen);N(L.positionScreen,P.positionScreen);N(P.positionScreen,G.positionScreen);N(A.positionScreen,R.positionScreen);N(A.positionScreen,M.positionScreen)}H.addPoint(G.positionScreen.x,G.positionScreen.y);H.addPoint(L.positionScreen.x,L.positionScreen.y);H.addPoint(A.positionScreen.x,A.positionScreen.y);H.addPoint(P.positionScreen.x,P.positionScreen.y);if(E.instersects(H)){ab=0;for(Xa=Ga.meshMaterials.length;ab<
-Xa;){xa=Ga.meshMaterials[ab++];if(xa instanceof THREE.MeshFaceMaterial){Ia=0;for(Sa=Ga.faceMaterials.length;Ia<Sa;)(xa=Ga.faceMaterials[Ia++])&&xa.opacity!=0&&Qa(G,L,A,P,R,M,Ga,xa,Ea)}else xa.opacity!=0&&Qa(G,L,A,P,R,M,Ga,xa,Ea)}}}C.addRectangle(H)}m.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(ja,U,fa){var Y,S,O,ga;Y=0;for(S=ja.lights.length;Y<S;Y++){O=ja.lights[Y];if(O instanceof THREE.DirectionalLight){ga=U.normalWorld.dot(O.position)*O.intensity;if(ga>0){fa.r+=O.color.r*ga;fa.g+=O.color.g*ga;fa.b+=O.color.b*ga}}else if(O instanceof THREE.PointLight){ea.sub(O.position,U.centroidWorld);ea.normalize();ga=U.normalWorld.dot(ea)*O.intensity;if(ga>0){fa.r+=O.color.r*ga;fa.g+=O.color.g*ga;fa.b+=O.color.b*ga}}}}function c(ja,U,fa,Y,S,O){X=d(va++);X.setAttribute("d",
-"M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+U.positionScreen.x+" "+U.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)A.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(L){P.r=R.r;P.g=R.g;P.b=R.b;a(O,Y,P);A.r=S.color.r*P.r;A.g=S.color.g*P.g;A.b=S.color.b*P.b;A.updateStyleString()}else A.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){f=1-S.__2near/(S.__farPlusNear-
-Y.z*S.__farMinusNear);A.setRGB(f,f,f)}else S instanceof THREE.MeshNormalMaterial&&A.setRGB(e(Y.normalWorld.x),e(Y.normalWorld.y),e(Y.normalWorld.z));S.wireframe?X.setAttribute("style","fill: none; stroke: "+A.__styleString+"; stroke-width: "+S.wireframeLinewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframeLinecap+"; stroke-linejoin: "+S.wireframeLinejoin):X.setAttribute("style","fill: "+A.__styleString+"; fill-opacity: "+S.opacity);j.appendChild(X)}function b(ja,U,fa,Y,S,O,ga){X=
-d(va++);X.setAttribute("d","M "+ja.positionScreen.x+" "+ja.positionScreen.y+" L "+U.positionScreen.x+" "+U.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+" L "+Y.positionScreen.x+","+Y.positionScreen.y+"z");if(O instanceof THREE.MeshBasicMaterial)A.__styleString=O.color.__styleString;else if(O instanceof THREE.MeshLambertMaterial)if(L){P.r=R.r;P.g=R.g;P.b=R.b;a(ga,S,P);A.r=O.color.r*P.r;A.g=O.color.g*P.g;A.b=O.color.b*P.b;A.updateStyleString()}else A.__styleString=O.color.__styleString;
-else if(O instanceof THREE.MeshDepthMaterial){f=1-O.__2near/(O.__farPlusNear-S.z*O.__farMinusNear);A.setRGB(f,f,f)}else O instanceof THREE.MeshNormalMaterial&&A.setRGB(e(S.normalWorld.x),e(S.normalWorld.y),e(S.normalWorld.z));O.wireframe?X.setAttribute("style","fill: none; stroke: "+A.__styleString+"; stroke-width: "+O.wireframeLinewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.wireframeLinecap+"; stroke-linejoin: "+O.wireframeLinejoin):X.setAttribute("style","fill: "+A.__styleString+
-"; fill-opacity: "+O.opacity);j.appendChild(X)}function d(ja){if(W[ja]==null){W[ja]=document.createElementNS("http://www.w3.org/2000/svg","path");Ca==0&&W[ja].setAttribute("shape-rendering","crispEdges")}return W[ja]}function e(ja){return ja<0?Math.min((1+ja)*0.5,0.5):0.5+Math.min(ja*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,t,x,z,y,B,I,F=new THREE.Rectangle,G=new THREE.Rectangle,L=!1,A=new THREE.Color(16777215),P=new THREE.Color(16777215),
-R=new THREE.Color(0),M=new THREE.Color(0),ia=new THREE.Color(0),f,ea=new THREE.Vector3,W=[],da=[],X,va,wa,Ca=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ja){switch(ja){case "high":Ca=1;break;case "low":Ca=0}};this.setSize=function(ja,U){k=ja;m=U;t=k/2;x=m/2;j.setAttribute("viewBox",-t+" "+-x+" "+k+" "+m);j.setAttribute("width",k);j.setAttribute("height",m);F.set(-t,-x,t,x)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};
-this.render=function(ja,U){var fa,Y,S,O,ga,sa,ma,ta;this.autoClear&&this.clear();g=h.projectScene(ja,U,this.sortElements);wa=va=0;if(L=ja.lights.length>0){ma=ja.lights;R.setRGB(0,0,0);M.setRGB(0,0,0);ia.setRGB(0,0,0);fa=0;for(Y=ma.length;fa<Y;fa++){S=ma[fa];O=S.color;if(S instanceof THREE.AmbientLight){R.r+=O.r;R.g+=O.g;R.b+=O.b}else if(S instanceof THREE.DirectionalLight){M.r+=O.r;M.g+=O.g;M.b+=O.b}else if(S instanceof THREE.PointLight){ia.r+=O.r;ia.g+=O.g;ia.b+=O.b}}}fa=0;for(Y=g.length;fa<Y;fa++){ma=
-g[fa];G.empty();if(ma instanceof THREE.RenderableParticle){z=ma;z.x*=t;z.y*=-x;S=0;for(O=ma.materials.length;S<O;)S++}else if(ma instanceof THREE.RenderableLine){z=ma.v1;y=ma.v2;z.positionScreen.x*=t;z.positionScreen.y*=-x;y.positionScreen.x*=t;y.positionScreen.y*=-x;G.addPoint(z.positionScreen.x,z.positionScreen.y);G.addPoint(y.positionScreen.x,y.positionScreen.y);if(F.instersects(G)){S=0;for(O=ma.materials.length;S<O;)if((ta=ma.materials[S++])&&ta.opacity!=0){ga=z;sa=y;var za=wa++;if(da[za]==null){da[za]=
-document.createElementNS("http://www.w3.org/2000/svg","line");Ca==0&&da[za].setAttribute("shape-rendering","crispEdges")}X=da[za];X.setAttribute("x1",ga.positionScreen.x);X.setAttribute("y1",ga.positionScreen.y);X.setAttribute("x2",sa.positionScreen.x);X.setAttribute("y2",sa.positionScreen.y);if(ta instanceof THREE.LineBasicMaterial){A.__styleString=ta.color.__styleString;X.setAttribute("style","fill: none; stroke: "+A.__styleString+"; stroke-width: "+ta.linewidth+"; stroke-opacity: "+ta.opacity+
-"; stroke-linecap: "+ta.linecap+"; stroke-linejoin: "+ta.linejoin);j.appendChild(X)}}}}else if(ma instanceof THREE.RenderableFace3){z=ma.v1;y=ma.v2;B=ma.v3;z.positionScreen.x*=t;z.positionScreen.y*=-x;y.positionScreen.x*=t;y.positionScreen.y*=-x;B.positionScreen.x*=t;B.positionScreen.y*=-x;G.addPoint(z.positionScreen.x,z.positionScreen.y);G.addPoint(y.positionScreen.x,y.positionScreen.y);G.addPoint(B.positionScreen.x,B.positionScreen.y);if(F.instersects(G)){S=0;for(O=ma.meshMaterials.length;S<O;){ta=
-ma.meshMaterials[S++];if(ta instanceof THREE.MeshFaceMaterial){ga=0;for(sa=ma.faceMaterials.length;ga<sa;)(ta=ma.faceMaterials[ga++])&&ta.opacity!=0&&c(z,y,B,ma,ta,ja)}else ta&&ta.opacity!=0&&c(z,y,B,ma,ta,ja)}}}else if(ma instanceof THREE.RenderableFace4){z=ma.v1;y=ma.v2;B=ma.v3;I=ma.v4;z.positionScreen.x*=t;z.positionScreen.y*=-x;y.positionScreen.x*=t;y.positionScreen.y*=-x;B.positionScreen.x*=t;B.positionScreen.y*=-x;I.positionScreen.x*=t;I.positionScreen.y*=-x;G.addPoint(z.positionScreen.x,z.positionScreen.y);
-G.addPoint(y.positionScreen.x,y.positionScreen.y);G.addPoint(B.positionScreen.x,B.positionScreen.y);G.addPoint(I.positionScreen.x,I.positionScreen.y);if(F.instersects(G)){S=0;for(O=ma.meshMaterials.length;S<O;){ta=ma.meshMaterials[S++];if(ta instanceof THREE.MeshFaceMaterial){ga=0;for(sa=ma.faceMaterials.length;ga<sa;)(ta=ma.faceMaterials[ga++])&&ta.opacity!=0&&b(z,y,B,I,ma,ta,ja)}else ta&&ta.opacity!=0&&b(z,y,B,I,ma,ta,ja)}}}}}};
+THREE.Projector=function(){function a(){var da=m[k]=m[k]||new THREE.RenderableVertex;k++;return da}function c(da,Y){return Y.z-da.z}function b(da,Y){var ua=0,va=1,za=da.z+da.w,ma=Y.z+Y.w,W=-da.z+da.w,ia=-Y.z+Y.w;if(za>=0&&ma>=0&&W>=0&&ia>=0)return!0;else if(za<0&&ma<0||W<0&&ia<0)return!1;else{if(za<0)ua=Math.max(ua,za/(za-ma));else ma<0&&(va=Math.min(va,za/(za-ma)));if(W<0)ua=Math.max(ua,W/(W-ia));else ia<0&&(va=Math.min(va,W/(W-ia)));if(va<ua)return!1;else{da.lerpSelf(Y,ua);Y.lerpSelf(da,1-va);return!0}}}
+var e,f,g=[],h,k,m=[],n,p,x=[],z,y=[],B,H,I=[],F,M,D=[],Q=new THREE.Vector4,R=new THREE.Vector4,P=new THREE.Matrix4,ka=new THREE.Matrix4,$=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],d=new THREE.Vector4,X=new THREE.Vector4;this.projectVector=function(da,Y){P.multiply(Y.projectionMatrix,Y.matrixWorldInverse);P.multiplyVector3(da);return da};this.unprojectVector=function(da,Y){P.multiply(Y.matrixWorld,THREE.Matrix4.makeInvert(Y.projectionMatrix));
+P.multiplyVector3(da);return da};this.projectObjects=function(da,Y,ua){Y=[];var va,za,ma;f=0;za=da.objects;da=0;for(va=za.length;da<va;da++){ma=za[da];var W;if(!(W=!ma.visible))if(W=ma instanceof THREE.Mesh){a:{W=void 0;for(var ia=ma.matrixWorld,Z=-ma.geometry.boundingSphere.radius*Math.max(ma.scale.x,Math.max(ma.scale.y,ma.scale.z)),S=0;S<6;S++){W=$[S].x*ia.n14+$[S].y*ia.n24+$[S].z*ia.n34+$[S].w;if(W<=Z){W=!1;break a}}W=!0}W=!W}if(!W){W=g[f]=g[f]||new THREE.RenderableObject;f++;e=W;Q.copy(ma.position);
+P.multiplyVector3(Q);e.object=ma;e.z=Q.z;Y.push(e)}}ua&&Y.sort(c);return Y};this.projectScene=function(da,Y,ua){var va=[],za=Y.near,ma=Y.far,W,ia,Z,S,N,ha,ra,na,qa,xa,Da,$a,ab,Ia,j,t,w;M=H=z=p=0;Y.matrixAutoUpdate&&Y.updateMatrix();da.update(undefined,!1,Y);P.multiply(Y.projectionMatrix,Y.matrixWorldInverse);$[0].set(P.n41-P.n11,P.n42-P.n12,P.n43-P.n13,P.n44-P.n14);$[1].set(P.n41+P.n11,P.n42+P.n12,P.n43+P.n13,P.n44+P.n14);$[2].set(P.n41+P.n21,P.n42+P.n22,P.n43+P.n23,P.n44+P.n24);$[3].set(P.n41-P.n21,
+P.n42-P.n22,P.n43-P.n23,P.n44-P.n24);$[4].set(P.n41-P.n31,P.n42-P.n32,P.n43-P.n33,P.n44-P.n34);$[5].set(P.n41+P.n31,P.n42+P.n32,P.n43+P.n33,P.n44+P.n34);for(W=0;W<6;W++){qa=$[W];qa.divideScalar(Math.sqrt(qa.x*qa.x+qa.y*qa.y+qa.z*qa.z))}qa=this.projectObjects(da,Y,!0);da=0;for(W=qa.length;da<W;da++){xa=qa[da].object;if(xa.visible){Da=xa.matrixWorld;$a=xa.matrixRotationWorld;ab=xa.materials;Ia=xa.overdraw;k=0;if(xa instanceof THREE.Mesh){j=xa.geometry;S=j.vertices;t=j.faces;j=j.faceVertexUvs;ia=0;for(Z=
+S.length;ia<Z;ia++){h=a();h.positionWorld.copy(S[ia].position);Da.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);P.multiplyVector4(h.positionScreen);h.positionScreen.x/=h.positionScreen.w;h.positionScreen.y/=h.positionScreen.w;h.visible=h.positionScreen.z>za&&h.positionScreen.z<ma}S=0;for(ia=t.length;S<ia;S++){Z=t[S];if(Z instanceof THREE.Face3){N=m[Z.a];ha=m[Z.b];ra=m[Z.c];if(N.visible&&ha.visible&&ra.visible&&(xa.doubleSided||xa.flipSided!=(ra.positionScreen.x-N.positionScreen.x)*
+(ha.positionScreen.y-N.positionScreen.y)-(ra.positionScreen.y-N.positionScreen.y)*(ha.positionScreen.x-N.positionScreen.x)<0)){na=x[p]=x[p]||new THREE.RenderableFace3;p++;n=na;n.v1.copy(N);n.v2.copy(ha);n.v3.copy(ra)}else continue}else if(Z instanceof THREE.Face4){N=m[Z.a];ha=m[Z.b];ra=m[Z.c];na=m[Z.d];if(N.visible&&ha.visible&&ra.visible&&na.visible&&(xa.doubleSided||xa.flipSided!=((na.positionScreen.x-N.positionScreen.x)*(ha.positionScreen.y-N.positionScreen.y)-(na.positionScreen.y-N.positionScreen.y)*
+(ha.positionScreen.x-N.positionScreen.x)<0||(ha.positionScreen.x-ra.positionScreen.x)*(na.positionScreen.y-ra.positionScreen.y)-(ha.positionScreen.y-ra.positionScreen.y)*(na.positionScreen.x-ra.positionScreen.x)<0))){w=y[z]=y[z]||new THREE.RenderableFace4;z++;n=w;n.v1.copy(N);n.v2.copy(ha);n.v3.copy(ra);n.v4.copy(na)}else continue}n.normalWorld.copy(Z.normal);$a.multiplyVector3(n.normalWorld);n.centroidWorld.copy(Z.centroid);Da.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);
+P.multiplyVector3(n.centroidScreen);ra=Z.vertexNormals;N=0;for(ha=ra.length;N<ha;N++){na=n.vertexNormalsWorld[N];na.copy(ra[N]);$a.multiplyVector3(na)}N=0;for(ha=j.length;N<ha;N++)if(w=j[N][S]){ra=0;for(na=w.length;ra<na;ra++)n.uvs[N][ra]=w[ra]}n.meshMaterials=ab;n.faceMaterials=Z.materials;n.overdraw=Ia;n.z=n.centroidScreen.z;va.push(n)}}else if(xa instanceof THREE.Line){ka.multiply(P,Da);S=xa.geometry.vertices;N=a();N.positionScreen.copy(S[0].position);ka.multiplyVector4(N.positionScreen);ia=1;
+for(Z=S.length;ia<Z;ia++){N=a();N.positionScreen.copy(S[ia].position);ka.multiplyVector4(N.positionScreen);ha=m[k-2];d.copy(N.positionScreen);X.copy(ha.positionScreen);if(b(d,X)){d.multiplyScalar(1/d.w);X.multiplyScalar(1/X.w);Da=I[H]=I[H]||new THREE.RenderableLine;H++;B=Da;B.v1.positionScreen.copy(d);B.v2.positionScreen.copy(X);B.z=Math.max(d.z,X.z);B.materials=xa.materials;va.push(B)}}}else if(xa instanceof THREE.Particle){R.set(xa.position.x,xa.position.y,xa.position.z,1);P.multiplyVector4(R);
+R.z/=R.w;if(R.z>0&&R.z<1){Da=D[M]=D[M]||new THREE.RenderableParticle;M++;F=Da;F.x=R.x/R.w;F.y=R.y/R.w;F.z=R.z;F.rotation=xa.rotation.z;F.scale.x=xa.scale.x*Math.abs(F.x-(R.x+Y.projectionMatrix.n11)/(R.w+Y.projectionMatrix.n14));F.scale.y=xa.scale.y*Math.abs(F.y-(R.y+Y.projectionMatrix.n22)/(R.w+Y.projectionMatrix.n24));F.materials=xa.materials;va.push(F)}}}}ua&&va.sort(c);return va}};
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,e,f,g;this.domElement=document.createElement("div");this.setSize=function(h,k){b=h;e=k;f=b/2;g=e/2};this.render=function(h,k){var m,n,p,x,z,y,B,H;a=c.projectScene(h,k);m=0;for(n=a.length;m<n;m++){z=a[m];if(z instanceof THREE.RenderableParticle){B=z.x*f+f;H=z.y*g+g;p=0;for(x=z.material.length;p<x;p++){y=z.material[p];if(y instanceof THREE.ParticleDOMMaterial){y=y.domElement;y.style.left=B+"px";y.style.top=H+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(U){if(z!=U)n.globalAlpha=z=U}function c(U){if(y!=U){switch(U){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}y=U}}var b=null,e=new THREE.Projector,f=document.createElement("canvas"),g,h,k,m,n=f.getContext("2d"),p=new THREE.Color(0),x=0,z=1,y=0,B=null,H=null,I=1,F,M,D,Q,R=new THREE.RenderableVertex,
+P=new THREE.RenderableVertex,ka,$,d,X,da,Y,ua,va,za,ma,W,ia,Z=new THREE.Color,S=new THREE.Color,N=new THREE.Color,ha=new THREE.Color,ra=new THREE.Color,na,qa,xa,Da,$a,ab,Ia,j,t,w,o=new THREE.Rectangle,C=new THREE.Rectangle,G=new THREE.Rectangle,J=!1,E=new THREE.Color,A=new THREE.Color,V=new THREE.Color,K=new THREE.Color,T=new THREE.Vector3,ja,pa,sa,Ba,ya,Fa,fa=16;ja=document.createElement("canvas");ja.width=ja.height=2;pa=ja.getContext("2d");pa.fillStyle="rgba(0,0,0,1)";pa.fillRect(0,0,2,2);sa=pa.getImageData(0,
+0,2,2);Ba=sa.data;ya=document.createElement("canvas");ya.width=ya.height=fa;Fa=ya.getContext("2d");Fa.translate(-fa/2,-fa/2);Fa.scale(fa,fa);fa--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(U,la){g=U;h=la;k=g/2;m=h/2;f.width=g;f.height=h;o.set(-k,-m,k,m);z=1;y=0;H=B=null;I=1};this.setClearColor=function(U,la){p=U;x=la};this.setClearColorHex=function(U,la){p.setHex(U);x=la};this.clear=function(){n.setTransform(1,0,0,-1,k,m);if(!C.isEmpty()){C.inflate(1);
+C.minSelf(o);if(p.hex==0&&x==0)n.clearRect(C.getX(),C.getY(),C.getWidth(),C.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+x+")";n.fillRect(C.getX(),C.getY(),C.getWidth(),C.getHeight())}C.empty()}};this.render=function(U,la){function Ma(L){var aa,oa,ea,ta=L.lights;A.setRGB(0,0,0);V.setRGB(0,0,0);K.setRGB(0,0,0);L=0;for(aa=ta.length;L<aa;L++){oa=ta[L];ea=oa.color;if(oa instanceof THREE.AmbientLight){A.r+=ea.r;
+A.g+=ea.g;A.b+=ea.b}else if(oa instanceof THREE.DirectionalLight){V.r+=ea.r;V.g+=ea.g;V.b+=ea.b}else if(oa instanceof THREE.PointLight){K.r+=ea.r;K.g+=ea.g;K.b+=ea.b}}}function Ha(L,aa,oa,ea){var ta,Aa,ga,ca,La=L.lights;L=0;for(ta=La.length;L<ta;L++){Aa=La[L];ga=Aa.color;ca=Aa.intensity;if(Aa instanceof THREE.DirectionalLight){Aa=oa.dot(Aa.position)*ca;if(Aa>0){ea.r+=ga.r*Aa;ea.g+=ga.g*Aa;ea.b+=ga.b*Aa}}else if(Aa instanceof THREE.PointLight){T.sub(Aa.position,aa);T.normalize();Aa=oa.dot(T)*ca;if(Aa>
+0){ea.r+=ga.r*Aa;ea.g+=ga.g*Aa;ea.b+=ga.b*Aa}}}}function fb(L,aa,oa){a(oa.opacity);c(oa.blending);var ea,ta,Aa,ga,ca,La;if(oa instanceof THREE.ParticleBasicMaterial){if(oa.map){ga=oa.map.image;ca=ga.width>>1;La=ga.height>>1;oa=aa.scale.x*k;Aa=aa.scale.y*m;ea=oa*ca;ta=Aa*La;G.set(L.x-ea,L.y-ta,L.x+ea,L.y+ta);if(o.instersects(G)){n.save();n.translate(L.x,L.y);n.rotate(-aa.rotation);n.scale(oa,-Aa);n.translate(-ca,-La);n.drawImage(ga,0,0);n.restore()}}}else if(oa instanceof THREE.ParticleCanvasMaterial){if(J){E.r=
+A.r+V.r+K.r;E.g=A.g+V.g+K.g;E.b=A.b+V.b+K.b;Z.r=oa.color.r*E.r;Z.g=oa.color.g*E.g;Z.b=oa.color.b*E.b;Z.updateStyleString()}else Z.__styleString=oa.color.__styleString;ea=aa.scale.x*k;ta=aa.scale.y*m;G.set(L.x-ea,L.y-ta,L.x+ea,L.y+ta);if(o.instersects(G)){n.save();n.translate(L.x,L.y);n.rotate(-aa.rotation);n.scale(ea,ta);oa.program(n,Z);n.restore()}}}function Ua(L,aa,oa,ea){a(ea.opacity);c(ea.blending);n.beginPath();n.moveTo(L.positionScreen.x,L.positionScreen.y);n.lineTo(aa.positionScreen.x,aa.positionScreen.y);
+n.closePath();if(ea instanceof THREE.LineBasicMaterial){Z.__styleString=ea.color.__styleString;L=ea.linewidth;if(I!=L)n.lineWidth=I=L;L=Z.__styleString;if(B!=L)n.strokeStyle=B=L;n.stroke();G.inflate(ea.linewidth*2)}}function Ja(L,aa,oa,ea,ta,Aa,ga,ca,La){a(ca.opacity);c(ca.blending);ka=L.positionScreen.x;$=L.positionScreen.y;d=aa.positionScreen.x;X=aa.positionScreen.y;da=oa.positionScreen.x;Y=oa.positionScreen.y;cb(ka,$,d,X,da,Y);if(ca instanceof THREE.MeshBasicMaterial)if(ca.map){if(ca.map.mapping instanceof
+THREE.UVMapping){Da=ga.uvs[0];Ea(ka,$,d,X,da,Y,ca.map.image,Da[ea].u,Da[ea].v,Da[ta].u,Da[ta].v,Da[Aa].u,Da[Aa].v)}}else if(ca.envMap){if(ca.envMap.mapping instanceof THREE.SphericalReflectionMapping){L=la.matrixWorldInverse;T.copy(ga.vertexNormalsWorld[0]);$a=(T.x*L.n11+T.y*L.n12+T.z*L.n13)*0.5+0.5;ab=-(T.x*L.n21+T.y*L.n22+T.z*L.n23)*0.5+0.5;T.copy(ga.vertexNormalsWorld[1]);Ia=(T.x*L.n11+T.y*L.n12+T.z*L.n13)*0.5+0.5;j=-(T.x*L.n21+T.y*L.n22+T.z*L.n23)*0.5+0.5;T.copy(ga.vertexNormalsWorld[2]);t=(T.x*
+L.n11+T.y*L.n12+T.z*L.n13)*0.5+0.5;w=-(T.x*L.n21+T.y*L.n22+T.z*L.n23)*0.5+0.5;Ea(ka,$,d,X,da,Y,ca.envMap.image,$a,ab,Ia,j,t,w)}}else ca.wireframe?Qa(ca.color.__styleString,ca.wireframeLinewidth):Va(ca.color.__styleString);else if(ca instanceof THREE.MeshLambertMaterial){if(ca.map&&!ca.wireframe){if(ca.map.mapping instanceof THREE.UVMapping){Da=ga.uvs[0];Ea(ka,$,d,X,da,Y,ca.map.image,Da[ea].u,Da[ea].v,Da[ta].u,Da[ta].v,Da[Aa].u,Da[Aa].v)}c(THREE.SubtractiveBlending)}if(J)if(!ca.wireframe&&ca.shading==
+THREE.SmoothShading&&ga.vertexNormalsWorld.length==3){S.r=N.r=ha.r=A.r;S.g=N.g=ha.g=A.g;S.b=N.b=ha.b=A.b;Ha(La,ga.v1.positionWorld,ga.vertexNormalsWorld[0],S);Ha(La,ga.v2.positionWorld,ga.vertexNormalsWorld[1],N);Ha(La,ga.v3.positionWorld,ga.vertexNormalsWorld[2],ha);ra.r=(N.r+ha.r)*0.5;ra.g=(N.g+ha.g)*0.5;ra.b=(N.b+ha.b)*0.5;xa=Wa(S,N,ha,ra);Ea(ka,$,d,X,da,Y,xa,0,0,1,0,0,1)}else{E.r=A.r;E.g=A.g;E.b=A.b;Ha(La,ga.centroidWorld,ga.normalWorld,E);Z.r=ca.color.r*E.r;Z.g=ca.color.g*E.g;Z.b=ca.color.b*
+E.b;Z.updateStyleString();ca.wireframe?Qa(Z.__styleString,ca.wireframeLinewidth):Va(Z.__styleString)}else ca.wireframe?Qa(ca.color.__styleString,ca.wireframeLinewidth):Va(ca.color.__styleString)}else if(ca instanceof THREE.MeshDepthMaterial){na=la.near;qa=la.far;S.r=S.g=S.b=1-Na(L.positionScreen.z,na,qa);N.r=N.g=N.b=1-Na(aa.positionScreen.z,na,qa);ha.r=ha.g=ha.b=1-Na(oa.positionScreen.z,na,qa);ra.r=(N.r+ha.r)*0.5;ra.g=(N.g+ha.g)*0.5;ra.b=(N.b+ha.b)*0.5;xa=Wa(S,N,ha,ra);Ea(ka,$,d,X,da,Y,xa,0,0,1,0,
+0,1)}else if(ca instanceof THREE.MeshNormalMaterial){Z.r=O(ga.normalWorld.x);Z.g=O(ga.normalWorld.y);Z.b=O(ga.normalWorld.z);Z.updateStyleString();ca.wireframe?Qa(Z.__styleString,ca.wireframeLinewidth):Va(Z.__styleString)}}function Sa(L,aa,oa,ea,ta,Aa,ga,ca,La){a(ca.opacity);c(ca.blending);if(ca.map||ca.envMap){Ja(L,aa,ea,0,1,3,ga,ca,La);Ja(ta,oa,Aa,1,2,3,ga,ca,La)}else{ka=L.positionScreen.x;$=L.positionScreen.y;d=aa.positionScreen.x;X=aa.positionScreen.y;da=oa.positionScreen.x;Y=oa.positionScreen.y;
+ua=ea.positionScreen.x;va=ea.positionScreen.y;za=ta.positionScreen.x;ma=ta.positionScreen.y;W=Aa.positionScreen.x;ia=Aa.positionScreen.y;if(ca instanceof THREE.MeshBasicMaterial){eb(ka,$,d,X,da,Y,ua,va);ca.wireframe?Qa(ca.color.__styleString,ca.wireframeLinewidth):Va(ca.color.__styleString)}else if(ca instanceof THREE.MeshLambertMaterial)if(J)if(!ca.wireframe&&ca.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==4){S.r=N.r=ha.r=ra.r=A.r;S.g=N.g=ha.g=ra.g=A.g;S.b=N.b=ha.b=ra.b=A.b;Ha(La,
+ga.v1.positionWorld,ga.vertexNormalsWorld[0],S);Ha(La,ga.v2.positionWorld,ga.vertexNormalsWorld[1],N);Ha(La,ga.v4.positionWorld,ga.vertexNormalsWorld[3],ha);Ha(La,ga.v3.positionWorld,ga.vertexNormalsWorld[2],ra);xa=Wa(S,N,ha,ra);cb(ka,$,d,X,ua,va);Ea(ka,$,d,X,ua,va,xa,0,0,1,0,0,1);cb(za,ma,da,Y,W,ia);Ea(za,ma,da,Y,W,ia,xa,1,0,1,1,0,1)}else{E.r=A.r;E.g=A.g;E.b=A.b;Ha(La,ga.centroidWorld,ga.normalWorld,E);Z.r=ca.color.r*E.r;Z.g=ca.color.g*E.g;Z.b=ca.color.b*E.b;Z.updateStyleString();eb(ka,$,d,X,da,
+Y,ua,va);ca.wireframe?Qa(Z.__styleString,ca.wireframeLinewidth):Va(Z.__styleString)}else{eb(ka,$,d,X,da,Y,ua,va);ca.wireframe?Qa(ca.color.__styleString,ca.wireframeLinewidth):Va(ca.color.__styleString)}else if(ca instanceof THREE.MeshNormalMaterial){Z.r=O(ga.normalWorld.x);Z.g=O(ga.normalWorld.y);Z.b=O(ga.normalWorld.z);Z.updateStyleString();eb(ka,$,d,X,da,Y,ua,va);ca.wireframe?Qa(Z.__styleString,ca.wireframeLinewidth):Va(Z.__styleString)}else if(ca instanceof THREE.MeshDepthMaterial){na=la.near;
+qa=la.far;S.r=S.g=S.b=1-Na(L.positionScreen.z,na,qa);N.r=N.g=N.b=1-Na(aa.positionScreen.z,na,qa);ha.r=ha.g=ha.b=1-Na(ea.positionScreen.z,na,qa);ra.r=ra.g=ra.b=1-Na(oa.positionScreen.z,na,qa);xa=Wa(S,N,ha,ra);cb(ka,$,d,X,ua,va);Ea(ka,$,d,X,ua,va,xa,0,0,1,0,0,1);cb(za,ma,da,Y,W,ia);Ea(za,ma,da,Y,W,ia,xa,1,0,1,1,0,1)}}}function cb(L,aa,oa,ea,ta,Aa){n.beginPath();n.moveTo(L,aa);n.lineTo(oa,ea);n.lineTo(ta,Aa);n.lineTo(L,aa);n.closePath()}function eb(L,aa,oa,ea,ta,Aa,ga,ca){n.beginPath();n.moveTo(L,aa);
+n.lineTo(oa,ea);n.lineTo(ta,Aa);n.lineTo(ga,ca);n.lineTo(L,aa);n.closePath()}function Qa(L,aa){if(B!=L)n.strokeStyle=B=L;if(I!=aa)n.lineWidth=I=aa;n.stroke();G.inflate(aa*2)}function Va(L){if(H!=L)n.fillStyle=H=L;n.fill()}function Ea(L,aa,oa,ea,ta,Aa,ga,ca,La,Ya,Za,db,hb){var bb,Xa;bb=ga.width-1;Xa=ga.height-1;ca*=bb;La*=Xa;Ya*=bb;Za*=Xa;db*=bb;hb*=Xa;oa-=L;ea-=aa;ta-=L;Aa-=aa;Ya-=ca;Za-=La;db-=ca;hb-=La;bb=Ya*hb-db*Za;if(bb!=0){Xa=1/bb;bb=(hb*oa-Za*ta)*Xa;Za=(hb*ea-Za*Aa)*Xa;oa=(Ya*ta-db*oa)*Xa;
+ea=(Ya*Aa-db*ea)*Xa;L=L-bb*ca-oa*La;aa=aa-Za*ca-ea*La;n.save();n.transform(bb,Za,oa,ea,L,aa);n.clip();n.drawImage(ga,0,0);n.restore()}}function Wa(L,aa,oa,ea){var ta=~~(L.r*255),Aa=~~(L.g*255);L=~~(L.b*255);var ga=~~(aa.r*255),ca=~~(aa.g*255);aa=~~(aa.b*255);var La=~~(oa.r*255),Ya=~~(oa.g*255);oa=~~(oa.b*255);var Za=~~(ea.r*255),db=~~(ea.g*255);ea=~~(ea.b*255);Ba[0]=ta<0?0:ta>255?255:ta;Ba[1]=Aa<0?0:Aa>255?255:Aa;Ba[2]=L<0?0:L>255?255:L;Ba[4]=ga<0?0:ga>255?255:ga;Ba[5]=ca<0?0:ca>255?255:ca;Ba[6]=
+aa<0?0:aa>255?255:aa;Ba[8]=La<0?0:La>255?255:La;Ba[9]=Ya<0?0:Ya>255?255:Ya;Ba[10]=oa<0?0:oa>255?255:oa;Ba[12]=Za<0?0:Za>255?255:Za;Ba[13]=db<0?0:db>255?255:db;Ba[14]=ea<0?0:ea>255?255:ea;pa.putImageData(sa,0,0);Fa.drawImage(ja,0,0);return ya}function Na(L,aa,oa){L=(L-aa)/(oa-aa);return L*L*(3-2*L)}function O(L){L=(L+1)*0.5;return L<0?0:L>1?1:L}function Oa(L,aa){var oa=aa.x-L.x,ea=aa.y-L.y,ta=1/Math.sqrt(oa*oa+ea*ea);oa*=ta;ea*=ta;aa.x+=oa;aa.y+=ea;L.x-=oa;L.y-=ea}var Ra,jb,Ca,Ta,Ga,Pa,Ka,wa;this.autoClear?
+this.clear():n.setTransform(1,0,0,-1,k,m);b=e.projectScene(U,la,this.sortElements);(J=U.lights.length>0)&&Ma(U);Ra=0;for(jb=b.length;Ra<jb;Ra++){Ca=b[Ra];G.empty();if(Ca instanceof THREE.RenderableParticle){F=Ca;F.x*=k;F.y*=m;Ta=0;for(Ga=Ca.materials.length;Ta<Ga;){wa=Ca.materials[Ta++];wa.opacity!=0&&fb(F,Ca,wa,U)}}else if(Ca instanceof THREE.RenderableLine){F=Ca.v1;M=Ca.v2;F.positionScreen.x*=k;F.positionScreen.y*=m;M.positionScreen.x*=k;M.positionScreen.y*=m;G.addPoint(F.positionScreen.x,F.positionScreen.y);
+G.addPoint(M.positionScreen.x,M.positionScreen.y);if(o.instersects(G)){Ta=0;for(Ga=Ca.materials.length;Ta<Ga;){wa=Ca.materials[Ta++];wa.opacity!=0&&Ua(F,M,Ca,wa,U)}}}else if(Ca instanceof THREE.RenderableFace3){F=Ca.v1;M=Ca.v2;D=Ca.v3;F.positionScreen.x*=k;F.positionScreen.y*=m;M.positionScreen.x*=k;M.positionScreen.y*=m;D.positionScreen.x*=k;D.positionScreen.y*=m;if(Ca.overdraw){Oa(F.positionScreen,M.positionScreen);Oa(M.positionScreen,D.positionScreen);Oa(D.positionScreen,F.positionScreen)}G.add3Points(F.positionScreen.x,
+F.positionScreen.y,M.positionScreen.x,M.positionScreen.y,D.positionScreen.x,D.positionScreen.y);if(o.instersects(G)){Ta=0;for(Ga=Ca.meshMaterials.length;Ta<Ga;){wa=Ca.meshMaterials[Ta++];if(wa instanceof THREE.MeshFaceMaterial){Pa=0;for(Ka=Ca.faceMaterials.length;Pa<Ka;)(wa=Ca.faceMaterials[Pa++])&&wa.opacity!=0&&Ja(F,M,D,0,1,2,Ca,wa,U)}else wa.opacity!=0&&Ja(F,M,D,0,1,2,Ca,wa,U)}}}else if(Ca instanceof THREE.RenderableFace4){F=Ca.v1;M=Ca.v2;D=Ca.v3;Q=Ca.v4;F.positionScreen.x*=k;F.positionScreen.y*=
+m;M.positionScreen.x*=k;M.positionScreen.y*=m;D.positionScreen.x*=k;D.positionScreen.y*=m;Q.positionScreen.x*=k;Q.positionScreen.y*=m;R.positionScreen.copy(M.positionScreen);P.positionScreen.copy(Q.positionScreen);if(Ca.overdraw){Oa(F.positionScreen,M.positionScreen);Oa(M.positionScreen,Q.positionScreen);Oa(Q.positionScreen,F.positionScreen);Oa(D.positionScreen,R.positionScreen);Oa(D.positionScreen,P.positionScreen)}G.addPoint(F.positionScreen.x,F.positionScreen.y);G.addPoint(M.positionScreen.x,M.positionScreen.y);
+G.addPoint(D.positionScreen.x,D.positionScreen.y);G.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(o.instersects(G)){Ta=0;for(Ga=Ca.meshMaterials.length;Ta<Ga;){wa=Ca.meshMaterials[Ta++];if(wa instanceof THREE.MeshFaceMaterial){Pa=0;for(Ka=Ca.faceMaterials.length;Pa<Ka;)(wa=Ca.faceMaterials[Pa++])&&wa.opacity!=0&&Sa(F,M,D,Q,R,P,Ca,wa,U)}else wa.opacity!=0&&Sa(F,M,D,Q,R,P,Ca,wa,U)}}}C.addRectangle(G)}n.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(ma,W,ia){var Z,S,N,ha;Z=0;for(S=ma.lights.length;Z<S;Z++){N=ma.lights[Z];if(N instanceof THREE.DirectionalLight){ha=W.normalWorld.dot(N.position)*N.intensity;if(ha>0){ia.r+=N.color.r*ha;ia.g+=N.color.g*ha;ia.b+=N.color.b*ha}}else if(N instanceof THREE.PointLight){d.sub(N.position,W.centroidWorld);d.normalize();ha=W.normalWorld.dot(d)*N.intensity;if(ha>0){ia.r+=N.color.r*ha;ia.g+=N.color.g*ha;ia.b+=N.color.b*ha}}}}function c(ma,W,ia,Z,S,N){Y=e(ua++);Y.setAttribute("d",
+"M "+ma.positionScreen.x+" "+ma.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+ia.positionScreen.x+","+ia.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)D.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(M){Q.r=R.r;Q.g=R.g;Q.b=R.b;a(N,Z,Q);D.r=S.color.r*Q.r;D.g=S.color.g*Q.g;D.b=S.color.b*Q.b;D.updateStyleString()}else D.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){$=1-S.__2near/(S.__farPlusNear-
+Z.z*S.__farMinusNear);D.setRGB($,$,$)}else S instanceof THREE.MeshNormalMaterial&&D.setRGB(f(Z.normalWorld.x),f(Z.normalWorld.y),f(Z.normalWorld.z));S.wireframe?Y.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+S.wireframeLinewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframeLinecap+"; stroke-linejoin: "+S.wireframeLinejoin):Y.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+S.opacity);k.appendChild(Y)}function b(ma,W,ia,Z,S,N,ha){Y=
+e(ua++);Y.setAttribute("d","M "+ma.positionScreen.x+" "+ma.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+ia.positionScreen.x+","+ia.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");if(N instanceof THREE.MeshBasicMaterial)D.__styleString=N.color.__styleString;else if(N instanceof THREE.MeshLambertMaterial)if(M){Q.r=R.r;Q.g=R.g;Q.b=R.b;a(ha,S,Q);D.r=N.color.r*Q.r;D.g=N.color.g*Q.g;D.b=N.color.b*Q.b;D.updateStyleString()}else D.__styleString=N.color.__styleString;
+else if(N instanceof THREE.MeshDepthMaterial){$=1-N.__2near/(N.__farPlusNear-S.z*N.__farMinusNear);D.setRGB($,$,$)}else N instanceof THREE.MeshNormalMaterial&&D.setRGB(f(S.normalWorld.x),f(S.normalWorld.y),f(S.normalWorld.z));N.wireframe?Y.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+N.wireframeLinewidth+"; stroke-opacity: "+N.opacity+"; stroke-linecap: "+N.wireframeLinecap+"; stroke-linejoin: "+N.wireframeLinejoin):Y.setAttribute("style","fill: "+D.__styleString+
+"; fill-opacity: "+N.opacity);k.appendChild(Y)}function e(ma){if(X[ma]==null){X[ma]=document.createElementNS("http://www.w3.org/2000/svg","path");za==0&&X[ma].setAttribute("shape-rendering","crispEdges")}return X[ma]}function f(ma){return ma<0?Math.min((1+ma)*0.5,0.5):0.5+Math.min(ma*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,n,p,x,z,y,B,H,I=new THREE.Rectangle,F=new THREE.Rectangle,M=!1,D=new THREE.Color(16777215),Q=new THREE.Color(16777215),
+R=new THREE.Color(0),P=new THREE.Color(0),ka=new THREE.Color(0),$,d=new THREE.Vector3,X=[],da=[],Y,ua,va,za=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ma){switch(ma){case "high":za=1;break;case "low":za=0}};this.setSize=function(ma,W){m=ma;n=W;p=m/2;x=n/2;k.setAttribute("viewBox",-p+" "+-x+" "+m+" "+n);k.setAttribute("width",m);k.setAttribute("height",n);I.set(-p,-x,p,x)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
+this.render=function(ma,W){var ia,Z,S,N,ha,ra,na,qa;this.autoClear&&this.clear();g=h.projectScene(ma,W,this.sortElements);va=ua=0;if(M=ma.lights.length>0){na=ma.lights;R.setRGB(0,0,0);P.setRGB(0,0,0);ka.setRGB(0,0,0);ia=0;for(Z=na.length;ia<Z;ia++){S=na[ia];N=S.color;if(S instanceof THREE.AmbientLight){R.r+=N.r;R.g+=N.g;R.b+=N.b}else if(S instanceof THREE.DirectionalLight){P.r+=N.r;P.g+=N.g;P.b+=N.b}else if(S instanceof THREE.PointLight){ka.r+=N.r;ka.g+=N.g;ka.b+=N.b}}}ia=0;for(Z=g.length;ia<Z;ia++){na=
+g[ia];F.empty();if(na instanceof THREE.RenderableParticle){z=na;z.x*=p;z.y*=-x;S=0;for(N=na.materials.length;S<N;)S++}else if(na instanceof THREE.RenderableLine){z=na.v1;y=na.v2;z.positionScreen.x*=p;z.positionScreen.y*=-x;y.positionScreen.x*=p;y.positionScreen.y*=-x;F.addPoint(z.positionScreen.x,z.positionScreen.y);F.addPoint(y.positionScreen.x,y.positionScreen.y);if(I.instersects(F)){S=0;for(N=na.materials.length;S<N;)if((qa=na.materials[S++])&&qa.opacity!=0){ha=z;ra=y;var xa=va++;if(da[xa]==null){da[xa]=
+document.createElementNS("http://www.w3.org/2000/svg","line");za==0&&da[xa].setAttribute("shape-rendering","crispEdges")}Y=da[xa];Y.setAttribute("x1",ha.positionScreen.x);Y.setAttribute("y1",ha.positionScreen.y);Y.setAttribute("x2",ra.positionScreen.x);Y.setAttribute("y2",ra.positionScreen.y);if(qa instanceof THREE.LineBasicMaterial){D.__styleString=qa.color.__styleString;Y.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+qa.linewidth+"; stroke-opacity: "+qa.opacity+
+"; stroke-linecap: "+qa.linecap+"; stroke-linejoin: "+qa.linejoin);k.appendChild(Y)}}}}else if(na instanceof THREE.RenderableFace3){z=na.v1;y=na.v2;B=na.v3;z.positionScreen.x*=p;z.positionScreen.y*=-x;y.positionScreen.x*=p;y.positionScreen.y*=-x;B.positionScreen.x*=p;B.positionScreen.y*=-x;F.addPoint(z.positionScreen.x,z.positionScreen.y);F.addPoint(y.positionScreen.x,y.positionScreen.y);F.addPoint(B.positionScreen.x,B.positionScreen.y);if(I.instersects(F)){S=0;for(N=na.meshMaterials.length;S<N;){qa=
+na.meshMaterials[S++];if(qa instanceof THREE.MeshFaceMaterial){ha=0;for(ra=na.faceMaterials.length;ha<ra;)(qa=na.faceMaterials[ha++])&&qa.opacity!=0&&c(z,y,B,na,qa,ma)}else qa&&qa.opacity!=0&&c(z,y,B,na,qa,ma)}}}else if(na instanceof THREE.RenderableFace4){z=na.v1;y=na.v2;B=na.v3;H=na.v4;z.positionScreen.x*=p;z.positionScreen.y*=-x;y.positionScreen.x*=p;y.positionScreen.y*=-x;B.positionScreen.x*=p;B.positionScreen.y*=-x;H.positionScreen.x*=p;H.positionScreen.y*=-x;F.addPoint(z.positionScreen.x,z.positionScreen.y);
+F.addPoint(y.positionScreen.x,y.positionScreen.y);F.addPoint(B.positionScreen.x,B.positionScreen.y);F.addPoint(H.positionScreen.x,H.positionScreen.y);if(I.instersects(F)){S=0;for(N=na.meshMaterials.length;S<N;){qa=na.meshMaterials[S++];if(qa instanceof THREE.MeshFaceMaterial){ha=0;for(ra=na.faceMaterials.length;ha<ra;)(qa=na.faceMaterials[ha++])&&qa.opacity!=0&&b(z,y,B,H,na,qa,ma)}else qa&&qa.opacity!=0&&b(z,y,B,H,na,qa,ma)}}}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -206,115 +213,122 @@ default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = pr
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f",
 value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",
 value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
-THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
-value:1}},fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,
-THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,
-THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),
-fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,
-THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
-THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",
+THREE.ShaderLib={shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, 0.5 );\n}"},shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos      = objectMatrix * vec4( position, 1.0 );\nvec3 norm     = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position   = projectionMatrix * viewMatrix * ( pos + extruded );\n}",fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},
+depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},
+fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,
+THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,
+THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
+THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",
+THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",
+THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.lights_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.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.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function c(n,D,p){var o,w,E,C=n.vertices,H=C.length,aa=n.colors,Q=aa.length,K=n.__vertexArray,ra=n.__colorArray,Fa=n.__sortArray,ca=n.__dirtyVertices,Ba=n.__dirtyColors;if(p.sortParticles){O.multiplySelf(p.matrixWorld);for(o=0;o<H;o++){w=C[o].position;ma.copy(w);O.multiplyVector3(ma);Fa[o]=[ma.z,o]}Fa.sort(function(na,Ha){return Ha[0]-na[0]});for(o=0;o<H;o++){w=C[Fa[o][1]].position;E=o*3;K[E]=w.x;K[E+1]=w.y;K[E+2]=w.z}for(o=0;o<Q;o++){E=o*3;color=aa[Fa[o][1]];ra[E]=
-color.r;ra[E+1]=color.g;ra[E+2]=color.b}}else{if(ca)for(o=0;o<H;o++){w=C[o].position;E=o*3;K[E]=w.x;K[E+1]=w.y;K[E+2]=w.z}if(Ba)for(o=0;o<Q;o++){color=aa[o];E=o*3;ra[E]=color.r;ra[E+1]=color.g;ra[E+2]=color.b}}if(ca||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,K,D)}if(Ba||p.sortParticles){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,ra,D)}}function b(n,D){n.fragmentShader=D.fragmentShader;n.vertexShader=D.vertexShader;
-n.uniforms=Uniforms.clone(D.uniforms)}function d(n,D,p,o,w){o.program||da.initMaterial(o,D,p,w);var E=o.program,C=E.uniforms,H=o.uniforms;if(E!=ea){f.useProgram(E);ea=E}f.uniformMatrix4fv(C.projectionMatrix,!1,ga);if(p&&(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial||o instanceof THREE.LineBasicMaterial||o instanceof THREE.ParticleBasicMaterial)){H.fogColor.value.setHex(p.color.hex);if(p instanceof THREE.Fog){H.fogNear.value=p.near;
-H.fogFar.value=p.far}else if(p instanceof THREE.FogExp2)H.fogDensity.value=p.density}if(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o.lights){var aa,Q,K=0,ra=0,Fa=0,ca,Ba,na,Ha=ta,Na=Ha.directional.colors,ya=Ha.directional.positions,Ja=Ha.point.colors,Z=Ha.point.positions,Ea=0,Da=0;p=Q=Q=0;for(aa=D.length;p<aa;p++){Q=D[p];ca=Q.color;Ba=Q.position;na=Q.intensity;if(Q instanceof THREE.AmbientLight){K+=ca.r;ra+=ca.g;Fa+=ca.b}else if(Q instanceof THREE.DirectionalLight){Q=
-Ea*3;Na[Q]=ca.r*na;Na[Q+1]=ca.g*na;Na[Q+2]=ca.b*na;ya[Q]=Ba.x;ya[Q+1]=Ba.y;ya[Q+2]=Ba.z;Ea+=1}else if(Q instanceof THREE.PointLight){Q=Da*3;Ja[Q]=ca.r*na;Ja[Q+1]=ca.g*na;Ja[Q+2]=ca.b*na;Z[Q]=Ba.x;Z[Q+1]=Ba.y;Z[Q+2]=Ba.z;Da+=1}}for(p=Ea*3;p<Na.length;p++)Na[p]=0;for(p=Da*3;p<Ja.length;p++)Ja[p]=0;Ha.point.length=Da;Ha.directional.length=Ea;Ha.ambient[0]=K;Ha.ambient[1]=ra;Ha.ambient[2]=Fa;D=ta;H.enableLighting.value=D.directional.length+D.point.length;H.ambientLightColor.value=D.ambient;H.directionalLightColor.value=
-D.directional.colors;H.directionalLightDirection.value=D.directional.positions;H.pointLightColor.value=D.point.colors;H.pointLightPosition.value=D.point.positions}if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial){H.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);H.opacity.value=o.opacity;H.map.texture=o.map;H.lightMap.texture=o.lightMap;H.envMap.texture=o.envMap;H.reflectivity.value=o.reflectivity;
-H.refractionRatio.value=o.refractionRatio;H.combine.value=o.combine;H.useRefract.value=o.envMap&&o.envMap.mapping instanceof THREE.CubeRefractionMapping}if(o instanceof THREE.LineBasicMaterial){H.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);H.opacity.value=o.opacity}else if(o instanceof THREE.ParticleBasicMaterial){H.psColor.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);H.opacity.value=o.opacity;H.size.value=o.size;H.scale.value=ia.height/
-2;H.map.texture=o.map}else if(o instanceof THREE.MeshPhongMaterial){H.ambient.value.setRGB(o.ambient.r,o.ambient.g,o.ambient.b);H.specular.value.setRGB(o.specular.r,o.specular.g,o.specular.b);H.shininess.value=o.shininess}else if(o instanceof THREE.MeshDepthMaterial){H.mNear.value=n.near;H.mFar.value=n.far;H.opacity.value=o.opacity}else if(o instanceof THREE.MeshNormalMaterial)H.opacity.value=o.opacity;for(var Za in H)if(K=E.uniforms[Za]){p=H[Za];aa=p.type;D=p.value;if(aa=="i")f.uniform1i(K,D);else if(aa==
-"f")f.uniform1f(K,D);else if(aa=="fv1")f.uniform1fv(K,D);else if(aa=="fv")f.uniform3fv(K,D);else if(aa=="v2")f.uniform2f(K,D.x,D.y);else if(aa=="v3")f.uniform3f(K,D.x,D.y,D.z);else if(aa=="c")f.uniform3f(K,D.r,D.g,D.b);else if(aa=="t"){f.uniform1i(K,D);if(p=p.texture)if(p.image instanceof Array&&p.image.length==6){if(p.image.length==6){if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(aa=0;aa<6;++aa)f.texSubImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+
-aa,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image[aa])}else{p.image.__webGLTextureCube=f.createTexture();f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube);for(aa=0;aa<6;++aa)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+aa,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image[aa]);p.__wasSetOnce=!0}L(f.TEXTURE_CUBE_MAP,p,p.image[0]);f.bindTexture(f.TEXTURE_CUBE_MAP,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+D);f.bindTexture(f.TEXTURE_CUBE_MAP,p.image.__webGLTextureCube)}}else{if(p.needsUpdate){if(p.__wasSetOnce){f.bindTexture(f.TEXTURE_2D,
-p.__webGLTexture);f.texSubImage2D(f.TEXTURE_2D,0,0,0,f.RGBA,f.UNSIGNED_BYTE,p.image)}else{p.__webGLTexture=f.createTexture();f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,p.image);p.__wasSetOnce=!0}L(f.TEXTURE_2D,p,p.image);f.bindTexture(f.TEXTURE_2D,null);p.needsUpdate=!1}f.activeTexture(f.TEXTURE0+D);f.bindTexture(f.TEXTURE_2D,p.__webGLTexture)}}}f.uniformMatrix4fv(C.modelViewMatrix,!1,w._modelViewMatrixArray);f.uniformMatrix3fv(C.normalMatrix,
-!1,w._normalMatrixArray);(o instanceof THREE.MeshShaderMaterial||o instanceof THREE.MeshPhongMaterial||o.envMap)&&f.uniform3f(C.cameraPosition,n.position.x,n.position.y,n.position.z);(o instanceof THREE.MeshShaderMaterial||o.envMap||o.skinning)&&f.uniformMatrix4fv(C.objectMatrix,!1,w._objectMatrixArray);(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshShaderMaterial||o.skinning)&&f.uniformMatrix4fv(C.viewMatrix,!1,sa);if(o.skinning){f.uniformMatrix4fv(C.cameraInverseMatrix,
-!1,sa);f.uniformMatrix4fv(C.boneGlobalMatrices,!1,w.boneMatrices)}return E}function e(n,D,p,o,w,E){if(o.opacity!=0){n=d(n,D,p,o,E).attributes;if(o.morphTargets){D=o.program.attributes;E.morphTargetBase!==-1?f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[E.morphTargetBase]):f.bindBuffer(f.ARRAY_BUFFER,w.__webGLVertexBuffer);f.vertexAttribPointer(D.position,3,f.FLOAT,!1,0,0);if(E.morphTargetForcedOrder.length){p=0;for(var C=E.morphTargetForcedOrder,H=E.morphTargetInfluences;p<o.numSupportedMorphTargets&&
-p<C.length;){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[C[p]]);f.vertexAttribPointer(D["morphTarget"+p],3,f.FLOAT,!1,0,0);E.__webGLMorphTargetInfluences[p]=H[C[p]];p++}}else{C=[];var aa=-1,Q=0;H=E.morphTargetInfluences;var K,ra=H.length;p=0;for(E.morphTargetBase!==-1&&(C[E.morphTargetBase]=!0);p<o.numSupportedMorphTargets;){for(K=0;K<ra;K++)if(!C[K]&&H[K]>aa){Q=K;aa=H[Q]}f.bindBuffer(f.ARRAY_BUFFER,w.__webGLMorphTargetsBuffers[Q]);f.vertexAttribPointer(D["morphTarget"+p],3,f.FLOAT,!1,
-0,0);E.__webGLMorphTargetInfluences[p]=aa;C[Q]=1;aa=-1;p++}}f.uniform1fv(o.program.uniforms.morphTargetInfluences,E.__webGLMorphTargetInfluences)}else{f.bindBuffer(f.ARRAY_BUFFER,w.__webGLVertexBuffer);f.vertexAttribPointer(n.position,3,f.FLOAT,!1,0,0)}if(n.color>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLColorBuffer);f.vertexAttribPointer(n.color,3,f.FLOAT,!1,0,0)}if(n.normal>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLNormalBuffer);f.vertexAttribPointer(n.normal,3,f.FLOAT,!1,0,0)}if(n.tangent>=0){f.bindBuffer(f.ARRAY_BUFFER,
-w.__webGLTangentBuffer);f.vertexAttribPointer(n.tangent,4,f.FLOAT,!1,0,0)}if(n.uv>=0)if(w.__webGLUVBuffer){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLUVBuffer);f.vertexAttribPointer(n.uv,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(n.uv)}else f.disableVertexAttribArray(n.uv);if(n.uv2>=0)if(w.__webGLUV2Buffer){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLUV2Buffer);f.vertexAttribPointer(n.uv2,2,f.FLOAT,!1,0,0);f.enableVertexAttribArray(n.uv2)}else f.disableVertexAttribArray(n.uv2);if(o.skinning&&n.skinVertexA>=0&&
-n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0){f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinVertexABuffer);f.vertexAttribPointer(n.skinVertexA,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinVertexBBuffer);f.vertexAttribPointer(n.skinVertexB,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinIndicesBuffer);f.vertexAttribPointer(n.skinIndex,4,f.FLOAT,!1,0,0);f.bindBuffer(f.ARRAY_BUFFER,w.__webGLSkinWeightsBuffer);f.vertexAttribPointer(n.skinWeight,4,f.FLOAT,!1,0,0)}if(E instanceof
-THREE.Mesh)if(o.wireframe){f.lineWidth(o.wireframeLinewidth);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,w.__webGLLineBuffer);f.drawElements(f.LINES,w.__webGLLineCount,f.UNSIGNED_SHORT,0)}else{f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,w.__webGLFaceBuffer);f.drawElements(f.TRIANGLES,w.__webGLFaceCount,f.UNSIGNED_SHORT,0)}else if(E instanceof THREE.Line){E=E.type==THREE.LineStrip?f.LINE_STRIP:f.LINES;f.lineWidth(o.linewidth);f.drawArrays(E,0,w.__webGLLineCount)}else if(E instanceof THREE.ParticleSystem)f.drawArrays(f.POINTS,
-0,w.__webGLParticleCount);else E instanceof THREE.Ribbon&&f.drawArrays(f.TRIANGLE_STRIP,0,w.__webGLVertexCount)}}function g(n,D){if(!n.__webGLVertexBuffer)n.__webGLVertexBuffer=f.createBuffer();if(!n.__webGLNormalBuffer)n.__webGLNormalBuffer=f.createBuffer();if(n.hasPos){f.bindBuffer(f.ARRAY_BUFFER,n.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,n.positionArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(D.attributes.position);f.vertexAttribPointer(D.attributes.position,3,f.FLOAT,!1,0,0)}if(n.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,
-n.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,n.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(D.attributes.normal);f.vertexAttribPointer(D.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,n.count);n.count=0}function h(n){if(X!=n.doubleSided){n.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE);X=n.doubleSided}if(va!=n.flipSided){n.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW);va=n.flipSided}}function j(n){if(Ca!=n){n?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST);
-Ca=n}}function k(n){S[0].set(n.n41-n.n11,n.n42-n.n12,n.n43-n.n13,n.n44-n.n14);S[1].set(n.n41+n.n11,n.n42+n.n12,n.n43+n.n13,n.n44+n.n14);S[2].set(n.n41+n.n21,n.n42+n.n22,n.n43+n.n23,n.n44+n.n24);S[3].set(n.n41-n.n21,n.n42-n.n22,n.n43-n.n23,n.n44-n.n24);S[4].set(n.n41-n.n31,n.n42-n.n32,n.n43-n.n33,n.n44-n.n34);S[5].set(n.n41+n.n31,n.n42+n.n32,n.n43+n.n33,n.n44+n.n34);var D;for(n=0;n<6;n++){D=S[n];D.divideScalar(Math.sqrt(D.x*D.x+D.y*D.y+D.z*D.z))}}function m(n){for(var D=n.matrixWorld,p=-n.geometry.boundingSphere.radius*
-Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),o=0;o<6;o++){n=S[o].x*D.n14+S[o].y*D.n24+S[o].z*D.n34+S[o].w;if(n<=p)return!1}return!0}function t(n,D){n.list[n.count]=D;n.count+=1}function x(n){var D,p,o=n.object,w=n.opaque,E=n.transparent;E.count=0;n=w.count=0;for(D=o.materials.length;n<D;n++){p=o.materials[n];p.opacity&&p.opacity<1||p.blending!=THREE.NormalBlending?t(E,p):t(w,p)}}function z(n){var D,p,o,w,E=n.object,C=n.buffer,H=n.opaque,aa=n.transparent;aa.count=0;n=H.count=0;for(o=E.materials.length;n<
-o;n++){D=E.materials[n];if(D instanceof THREE.MeshFaceMaterial){D=0;for(p=C.materials.length;D<p;D++)(w=C.materials[D])&&(w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(aa,w):t(H,w))}else{w=D;w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?t(aa,w):t(H,w)}}}function y(n,D){return D.z-n.z}function B(n,D){n._modelViewMatrix.multiplyToArray(D.matrixWorldInverse,n.matrixWorld,n._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(n._modelViewMatrix).transposeIntoArray(n._normalMatrixArray)}
-function I(n){function D(Fa){var ca=[];p=0;for(o=Fa.length;p<o;p++)Fa[p]==undefined?ca.push("undefined"):ca.push(Fa[p].id);return ca.join("_")}var p,o,w,E,C,H,aa,Q,K={},ra=n.morphTargets!==undefined?n.morphTargets.length:0;n.geometryGroups={};w=0;for(E=n.faces.length;w<E;w++){C=n.faces[w];H=C.materials;aa=D(H);K[aa]==undefined&&(K[aa]={hash:aa,counter:0});Q=K[aa].hash+"_"+K[aa].counter;n.geometryGroups[Q]==undefined&&(n.geometryGroups[Q]={faces:[],materials:H,vertices:0,numMorphTargets:ra});C=C instanceof
-THREE.Face3?3:4;if(n.geometryGroups[Q].vertices+C>65535){K[aa].counter+=1;Q=K[aa].hash+"_"+K[aa].counter;n.geometryGroups[Q]==undefined&&(n.geometryGroups[Q]={faces:[],materials:H,vertices:0,numMorphTargets:ra})}n.geometryGroups[Q].faces.push(w);n.geometryGroups[Q].vertices+=C}}function F(n,D,p){n.push({buffer:D,object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function G(n){if(n!=wa){switch(n){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE);break;
-case THREE.SubtractiveBlending:f.blendFunc(f.DST_COLOR,f.ZERO);break;case THREE.BillboardBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:f.blendEquation(f.FUNC_REVERSE_SUBTRACT);f.blendFunc(f.ONE,f.ONE);break;default:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA)}wa=n}}function L(n,D,p){if((p.width&p.width-1)==0&&(p.height&p.height-1)==0){f.texParameteri(n,f.TEXTURE_WRAP_S,M(D.wrapS));f.texParameteri(n,
-f.TEXTURE_WRAP_T,M(D.wrapT));f.texParameteri(n,f.TEXTURE_MAG_FILTER,M(D.magFilter));f.texParameteri(n,f.TEXTURE_MIN_FILTER,M(D.minFilter));f.generateMipmap(n)}else{f.texParameteri(n,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE);f.texParameteri(n,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE);f.texParameteri(n,f.TEXTURE_MAG_FILTER,R(D.magFilter));f.texParameteri(n,f.TEXTURE_MIN_FILTER,R(D.minFilter))}}function A(n){if(n&&!n.__webGLFramebuffer){n.__webGLFramebuffer=f.createFramebuffer();n.__webGLRenderbuffer=f.createRenderbuffer();
-n.__webGLTexture=f.createTexture();f.bindRenderbuffer(f.RENDERBUFFER,n.__webGLRenderbuffer);f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,n.width,n.height);f.bindTexture(f.TEXTURE_2D,n.__webGLTexture);f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,M(n.wrapS));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,M(n.wrapT));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,M(n.magFilter));f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,M(n.minFilter));f.texImage2D(f.TEXTURE_2D,0,M(n.format),n.width,
-n.height,0,M(n.format),M(n.type),null);f.bindFramebuffer(f.FRAMEBUFFER,n.__webGLFramebuffer);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,n.__webGLTexture,0);f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,n.__webGLRenderbuffer);f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}var D,p;if(n){D=n.__webGLFramebuffer;p=n.width;n=n.height}else{D=null;p=fa;n=Y}if(D!=W){f.bindFramebuffer(f.FRAMEBUFFER,
-D);f.viewport(ja,U,p,n);W=D}}function P(n,D){var p;if(n=="fragment")p=f.createShader(f.FRAGMENT_SHADER);else n=="vertex"&&(p=f.createShader(f.VERTEX_SHADER));f.shaderSource(p,D);f.compileShader(p);if(!f.getShaderParameter(p,f.COMPILE_STATUS)){console.error(f.getShaderInfoLog(p));console.error(D);return null}return p}function R(n){switch(n){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return f.LINEAR}}
-function M(n){switch(n){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}
-var ia=document.createElement("canvas"),f,ea=null,W=null,da=this,X=null,va=null,wa=null,Ca=null,ja=0,U=0,fa=0,Y=0,S=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],O=new THREE.Matrix4,ga=new Float32Array(16),sa=new Float32Array(16),ma=new THREE.Vector4,ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},za=!0,Ma=new THREE.Color(0),bb=0;if(a){if(a.antialias!==undefined)za=a.antialias;
-a.clearColor!==undefined&&Ma.setHex(a.clearColor);if(a.clearAlpha!==undefined)bb=a.clearAlpha}this.maxMorphTargets=8;this.domElement=ia;this.autoClear=!0;this.sortObjects=!0;(function(n,D,p){try{if(!(f=ia.getContext("experimental-webgl",{antialias:n})))throw"Error creating WebGL context.";}catch(o){console.error(o)}f.clearColor(0,0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendFunc(f.ONE,f.ONE_MINUS_SRC_ALPHA);
-f.clearColor(D.r,D.g,D.b,p);_cullEnabled=!0})(za,Ma,bb);this.context=f;this.setSize=function(n,D){ia.width=n;ia.height=D;this.setViewport(0,0,ia.width,ia.height)};this.setViewport=function(n,D,p,o){ja=n;U=D;fa=p;Y=o;f.viewport(ja,U,fa,Y)};this.setScissor=function(n,D,p,o){f.scissor(n,D,p,o)};this.enableScissorTest=function(n){n?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=function(n){f.depthMask(n)};this.setClearColorHex=function(n,D){var p=new THREE.Color(n);f.clearColor(p.r,
-p.g,p.b,D)};this.setClearColor=function(n,D){f.clearColor(n.r,n.g,n.b,D)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT)};this.initMaterial=function(n,D,p,o){var w,E,C;if(n instanceof THREE.MeshDepthMaterial)b(n,THREE.ShaderLib.depth);else if(n instanceof THREE.MeshNormalMaterial)b(n,THREE.ShaderLib.normal);else if(n instanceof THREE.MeshBasicMaterial)b(n,THREE.ShaderLib.basic);else if(n instanceof THREE.MeshLambertMaterial)b(n,THREE.ShaderLib.lambert);else if(n instanceof THREE.MeshPhongMaterial)b(n,
-THREE.ShaderLib.phong);else if(n instanceof THREE.LineBasicMaterial)b(n,THREE.ShaderLib.basic);else n instanceof THREE.ParticleBasicMaterial&&b(n,THREE.ShaderLib.particle_basic);var H,aa,Q,K;C=Q=K=0;for(H=D.length;C<H;C++){aa=D[C];aa instanceof THREE.DirectionalLight&&Q++;aa instanceof THREE.PointLight&&K++}if(K+Q<=4)D=Q;else{D=Math.ceil(4*Q/(K+Q));K=4-D}C={directional:D,point:K};H=50;if(o!==undefined&&o instanceof THREE.SkinnedMesh)H=o.bones.length;K=n.fragmentShader;D=n.vertexShader;H={fog:p,map:n.map,
-envMap:n.envMap,lightMap:n.lightMap,vertexColors:n.vertexColors,sizeAttenuation:n.sizeAttenuation,skinning:n.skinning,morphTargets:n.morphTargets,maxDirLights:C.directional,maxPointLights:C.point,maxBones:H};p=f.createProgram();C=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+H.maxPointLights,H.fog?"#define USE_FOG":"",H.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":
-"",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");H=[f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+H.maxDirLights,"#define MAX_POINT_LIGHTS "+H.maxPointLights,"#define MAX_BONES "+H.maxBones,H.map?"#define USE_MAP":"",H.envMap?"#define USE_ENVMAP":"",H.lightMap?"#define USE_LIGHTMAP":"",H.vertexColors?"#define USE_COLOR":"",H.skinning?"#define USE_SKINNING":
-"",H.morphTargets?"#define USE_MORPHTARGETS":"",H.sizeAttenuation?"#define USE_SIZEATTENUATION":"","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 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\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");
-f.attachShader(p,P("fragment",C+K));f.attachShader(p,P("vertex",H+D));f.linkProgram(p);f.getProgramParameter(p,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(p,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");p.uniforms={};p.attributes={};n.program=p;p=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in n.uniforms)p.push(w);
-w=n.program;K=0;for(D=p.length;K<D;K++){C=p[K];w.uniforms[C]=f.getUniformLocation(w,C)}p=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<this.maxMorphTargets;w++)p.push("morphTarget"+w);for(E in n.attributes)p.push(E);E=n.program;w=p;p=0;for(K=w.length;p<K;p++){D=w[p];E.attributes[D]=f.getAttribLocation(E,D)}E=n.program.attributes;f.enableVertexAttribArray(E.position);E.color>=0&&f.enableVertexAttribArray(E.color);E.normal>=0&&f.enableVertexAttribArray(E.normal);
-E.tangent>=0&&f.enableVertexAttribArray(E.tangent);if(n.skinning&&E.skinVertexA>=0&&E.skinVertexB>=0&&E.skinIndex>=0&&E.skinWeight>=0){f.enableVertexAttribArray(E.skinVertexA);f.enableVertexAttribArray(E.skinVertexB);f.enableVertexAttribArray(E.skinIndex);f.enableVertexAttribArray(E.skinWeight)}if(n.morphTargets){n.numSupportedMorphTargets=0;if(E.morphTarget0>=0){f.enableVertexAttribArray(E.morphTarget0);n.numSupportedMorphTargets++}if(E.morphTarget1>=0){f.enableVertexAttribArray(E.morphTarget1);
-n.numSupportedMorphTargets++}if(E.morphTarget2>=0){f.enableVertexAttribArray(E.morphTarget2);n.numSupportedMorphTargets++}if(E.morphTarget3>=0){f.enableVertexAttribArray(E.morphTarget3);n.numSupportedMorphTargets++}if(E.morphTarget4>=0){f.enableVertexAttribArray(E.morphTarget4);n.numSupportedMorphTargets++}if(E.morphTarget5>=0){f.enableVertexAttribArray(E.morphTarget5);n.numSupportedMorphTargets++}if(E.morphTarget6>=0){f.enableVertexAttribArray(E.morphTarget6);n.numSupportedMorphTargets++}if(E.morphTarget7>=
-0){f.enableVertexAttribArray(E.morphTarget7);n.numSupportedMorphTargets++}o.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(w=0;w<this.maxMorphTargets;w++)o.__webGLMorphTargetInfluences[w]=0}};this.render=function(n,D,p,o){var w,E,C,H,aa,Q,K,ra,Fa=n.lights,ca=n.fog;D.matrixAutoUpdate&&D.updateMatrix();n.update(undefined,!1,D);D.matrixWorldInverse.flattenToArray(sa);D.projectionMatrix.flattenToArray(ga);O.multiply(D.projectionMatrix,D.matrixWorldInverse);k(O);this.initWebGLObjects(n);
-A(p);(this.autoClear||o)&&this.clear();aa=n.__webglObjects.length;for(o=0;o<aa;o++){w=n.__webglObjects[o];K=w.object;if(K.visible)if(!(K instanceof THREE.Mesh)||m(K)){K.matrixWorld.flattenToArray(K._objectMatrixArray);B(K,D);z(w);w.render=!0;if(this.sortObjects){ma.copy(K.position);O.multiplyVector3(ma);w.z=ma.z}}else w.render=!1;else w.render=!1}this.sortObjects&&n.__webglObjects.sort(y);Q=n.__webglObjectsImmediate.length;for(o=0;o<Q;o++){w=n.__webglObjectsImmediate[o];K=w.object;if(K.visible){K.matrixAutoUpdate&&
-K.matrixWorld.flattenToArray(K._objectMatrixArray);B(K,D);x(w)}}G(THREE.NormalBlending);for(o=0;o<aa;o++){w=n.__webglObjects[o];if(w.render){K=w.object;ra=w.buffer;C=w.opaque;h(K);for(w=0;w<C.count;w++){H=C.list[w];j(H.depthTest);e(D,Fa,ca,H,ra,K)}}}for(o=0;o<Q;o++){w=n.__webglObjectsImmediate[o];K=w.object;if(K.visible){C=w.opaque;h(K);for(w=0;w<C.count;w++){H=C.list[w];j(H.depthTest);E=d(D,Fa,ca,H,K);K.render(function(Ba){g(Ba,E)})}}}for(o=0;o<aa;o++){w=n.__webglObjects[o];if(w.render){K=w.object;
-ra=w.buffer;C=w.transparent;h(K);for(w=0;w<C.count;w++){H=C.list[w];G(H.blending);j(H.depthTest);e(D,Fa,ca,H,ra,K)}}}for(o=0;o<Q;o++){w=n.__webglObjectsImmediate[o];K=w.object;if(K.visible){C=w.transparent;h(K);for(w=0;w<C.count;w++){H=C.list[w];G(H.blending);j(H.depthTest);E=d(D,Fa,ca,H,K);K.render(function(Ba){g(Ba,E)})}}}if(p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter){f.bindTexture(f.TEXTURE_2D,p.__webGLTexture);f.generateMipmap(f.TEXTURE_2D);f.bindTexture(f.TEXTURE_2D,
-null)}};this.initWebGLObjects=function(n){if(!n.__webglObjects){n.__webglObjects=[];n.__webglObjectsImmediate=[]}for(;n.__objectsAdded.length;){var D=n.__objectsAdded[0],p=n,o=void 0,w=void 0,E=void 0;if(D._modelViewMatrix==undefined){D._modelViewMatrix=new THREE.Matrix4;D._normalMatrixArray=new Float32Array(9);D._modelViewMatrixArray=new Float32Array(16);D._objectMatrixArray=new Float32Array(16);D.matrixWorld.flattenToArray(D._objectMatrixArray)}if(D instanceof THREE.Mesh){w=D.geometry;w.geometryGroups==
-undefined&&I(w);for(o in w.geometryGroups){E=w.geometryGroups[o];if(!E.__webGLVertexBuffer){var C=E;C.__webGLVertexBuffer=f.createBuffer();C.__webGLNormalBuffer=f.createBuffer();C.__webGLTangentBuffer=f.createBuffer();C.__webGLColorBuffer=f.createBuffer();C.__webGLUVBuffer=f.createBuffer();C.__webGLUV2Buffer=f.createBuffer();C.__webGLSkinVertexABuffer=f.createBuffer();C.__webGLSkinVertexBBuffer=f.createBuffer();C.__webGLSkinIndicesBuffer=f.createBuffer();C.__webGLSkinWeightsBuffer=f.createBuffer();
-C.__webGLFaceBuffer=f.createBuffer();C.__webGLLineBuffer=f.createBuffer();if(C.numMorphTargets){var H=void 0,aa=void 0;C.__webGLMorphTargetsBuffers=[];H=0;for(aa=C.numMorphTargets;H<aa;H++)C.__webGLMorphTargetsBuffers.push(f.createBuffer())}C=E;var Q=D,K=void 0,ra=void 0,Fa=aa=H=0;K=void 0;ra=void 0;var ca=void 0;ra=void 0;var Ba=Q.geometry;ca=Ba.faces;var na=C.faces;K=0;for(ra=na.length;K<ra;K++){fi=na[K];face=ca[fi];if(face instanceof THREE.Face3){H+=3;aa+=1;Fa+=3}else if(face instanceof THREE.Face4){H+=
-4;aa+=2;Fa+=4}}K=C;ra=Q;ca=void 0;na=void 0;var Ha=void 0,Na=void 0;Ha=void 0;var ya=[];ca=0;for(na=ra.materials.length;ca<na;ca++){Ha=ra.materials[ca];if(Ha instanceof THREE.MeshFaceMaterial){Ha=0;for(l=K.materials.length;Ha<l;Ha++)(Na=K.materials[Ha])&&ya.push(Na)}else(Na=Ha)&&ya.push(Na)}ra=ya;a:{K=void 0;ca=void 0;na=ra.length;for(K=0;K<na;K++){ca=ra[K];if(ca.map||ca.lightMap||ca instanceof THREE.MeshShaderMaterial){K=!0;break a}}K=!1}a:{ca=ra;na=void 0;ya=void 0;Ha=ca.length;for(na=0;na<Ha;na++){ya=
-ca[na];if(!(ya instanceof THREE.MeshBasicMaterial&&!ya.envMap||ya instanceof THREE.MeshDepthMaterial)){ca=ya&&ya.shading!=undefined&&ya.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}ca=!1}a:{na=void 0;ya=void 0;Ha=ra.length;for(na=0;na<Ha;na++){ya=ra[na];if(ya.vertexColors){ra=ya.vertexColors;break a}}ra=!1}C.__vertexArray=new Float32Array(H*3);if(ca)C.__normalArray=new Float32Array(H*3);if(Ba.hasTangents)C.__tangentArray=new Float32Array(H*4);if(ra)C.__colorArray=new Float32Array(H*
-3);if(K){if(Ba.faceUvs.length>0||Ba.faceVertexUvs.length>0)C.__uvArray=new Float32Array(H*2);if(Ba.faceUvs.length>1||Ba.faceVertexUvs.length>1)C.__uv2Array=new Float32Array(H*2)}if(Q.geometry.skinWeights.length&&Q.geometry.skinIndices.length){C.__skinVertexAArray=new Float32Array(H*4);C.__skinVertexBArray=new Float32Array(H*4);C.__skinIndexArray=new Float32Array(H*4);C.__skinWeightArray=new Float32Array(H*4)}C.__faceArray=new Uint16Array(aa*3);C.__lineArray=new Uint16Array(Fa*2);if(C.numMorphTargets){Q=
-void 0;Ba=void 0;C.__morphTargetsArrays=[];Q=0;for(Ba=C.numMorphTargets;Q<Ba;Q++)C.__morphTargetsArrays.push(new Float32Array(H*3))}C.__needsSmoothNormals=ca==THREE.SmoothShading;C.__uvType=K;C.__vertexColorType=ra;C.__normalType=ca;C.__webGLFaceCount=aa*3;C.__webGLLineCount=Fa*2;w.__dirtyVertices=!0;w.__dirtyMorphTargets=!0;w.__dirtyElements=!0;w.__dirtyUvs=!0;w.__dirtyNormals=!0;w.__dirtyTangents=!0;w.__dirtyColors=!0}F(p.__webglObjects,E,D)}}else if(D instanceof THREE.Ribbon){w=D.geometry;if(!w.__webGLVertexBuffer){o=
-w;o.__webGLVertexBuffer=f.createBuffer();o.__webGLColorBuffer=f.createBuffer();o=w;E=o.vertices.length;o.__vertexArray=new Float32Array(E*3);o.__colorArray=new Float32Array(E*3);o.__webGLVertexCount=E;w.__dirtyVertices=!0;w.__dirtyColors=!0}F(p.__webglObjects,w,D)}else if(D instanceof THREE.Line){w=D.geometry;if(!w.__webGLVertexBuffer){o=w;o.__webGLVertexBuffer=f.createBuffer();o.__webGLColorBuffer=f.createBuffer();o=w;E=o.vertices.length;o.__vertexArray=new Float32Array(E*3);o.__colorArray=new Float32Array(E*
-3);o.__webGLLineCount=E;w.__dirtyVertices=!0;w.__dirtyColors=!0}F(p.__webglObjects,w,D)}else if(D instanceof THREE.ParticleSystem){w=D.geometry;if(!w.__webGLVertexBuffer){o=w;o.__webGLVertexBuffer=f.createBuffer();o.__webGLColorBuffer=f.createBuffer();o=w;E=o.vertices.length;o.__vertexArray=new Float32Array(E*3);o.__colorArray=new Float32Array(E*3);o.__sortArray=[];o.__webGLParticleCount=E;w.__dirtyVertices=!0;w.__dirtyColors=!0}F(p.__webglObjects,w,D)}else THREE.MarchingCubes!==undefined&&D instanceof
-THREE.MarchingCubes&&p.__webglObjectsImmediate.push({object:D,opaque:{list:[],count:0},transparent:{list:[],count:0}});n.__objectsAdded.splice(0,1)}for(;n.__objectsRemoved.length;){D=n.__objectsRemoved[0];p=n;w=void 0;o=void 0;for(w=p.__webglObjects.length-1;w>=0;w--){o=p.__webglObjects[w].object;D==o&&p.__webglObjects.splice(w,1)}n.__objectsRemoved.splice(0,1)}D=0;for(p=n.__webglObjects.length;D<p;D++){o=n.__webglObjects[D].object;E=void 0;w=void 0;C=void 0;if(o instanceof THREE.Mesh){w=o.geometry;
-for(E in w.geometryGroups){C=w.geometryGroups[E];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||w.__dirtyColors||w.__dirtyTangents){H=f.DYNAMIC_DRAW;aa=void 0;Fa=void 0;var Ja=void 0,Z=void 0;Ja=void 0;var Ea=void 0,Da=void 0,Za=void 0,ua=void 0;Q=void 0;Ba=void 0;K=void 0;ra=void 0;ca=void 0;var ka=void 0,la=void 0,oa=void 0,Qa=void 0;Da=void 0;Za=void 0;Z=void 0;ua=void 0;Z=void 0;ka=void 0;la=void 0;Da=void 0;ka=void 0;la=void 0;oa=void 0;Qa=void 0;
-ka=void 0;la=void 0;oa=void 0;Qa=void 0;ka=void 0;la=void 0;oa=void 0;Qa=void 0;ka=void 0;la=void 0;oa=void 0;Z=void 0;ua=void 0;Ea=void 0;Ja=void 0;Ja=void 0;var Ta=void 0,gb=void 0,Oa=void 0,Ya=Na=Ha=ya=na=0,Ua=0,Ka=0,Wa=0,Pa=0,N=0,Ra=0,Va=C.__vertexArray,Ga=C.__uvArray,ab=C.__uv2Array,Xa=C.__normalArray,Ia=C.__tangentArray,Sa=C.__colorArray,xa=C.__skinVertexAArray,J=C.__skinVertexBArray,$=C.__skinIndexArray,V=C.__skinWeightArray,ha=C.__morphTargetsArrays,Aa=C.__faceArray,qa=C.__lineArray,pa=C.__needsSmoothNormals;
-Ba=C.__vertexColorType;Q=C.__uvType;K=C.__normalType;var T=o.geometry,La=T.__dirtyVertices,db=T.__dirtyElements,$a=T.__dirtyUvs,eb=T.__dirtyNormals,ib=T.__dirtyTangents,cb=T.__dirtyColors,fb=T.__dirtyMorphTargets,kb=T.vertices,ob=C.faces,rb=T.faces,pb=T.faceVertexUvs[0],qb=T.faceVertexUvs[1],lb=T.skinVerticesA,mb=T.skinVerticesB,nb=T.skinIndices,jb=T.skinWeights,hb=T.morphTargets;aa=0;for(Fa=ob.length;aa<Fa;aa++){Ja=ob[aa];Z=rb[Ja];pb&&(ra=pb[Ja]);qb&&(ca=qb[Ja]);Ja=Z.vertexNormals;Ea=Z.normal;Da=
-Z.vertexColors;Za=Z.color;ua=Z.vertexTangents;if(Z instanceof THREE.Face3){if(La){ka=kb[Z.a].position;la=kb[Z.b].position;oa=kb[Z.c].position;Va[ya]=ka.x;Va[ya+1]=ka.y;Va[ya+2]=ka.z;Va[ya+3]=la.x;Va[ya+4]=la.y;Va[ya+5]=la.z;Va[ya+6]=oa.x;Va[ya+7]=oa.y;Va[ya+8]=oa.z;ya+=9}if(fb){Ta=0;for(gb=hb.length;Ta<gb;Ta++){ka=hb[Ta].vertices[Z.a].position;la=hb[Ta].vertices[Z.b].position;oa=hb[Ta].vertices[Z.c].position;Oa=ha[Ta];Oa[Ra+0]=ka.x;Oa[Ra+1]=ka.y;Oa[Ra+2]=ka.z;Oa[Ra+3]=la.x;Oa[Ra+4]=la.y;Oa[Ra+5]=
-la.z;Oa[Ra+6]=oa.x;Oa[Ra+7]=oa.y;Oa[Ra+8]=oa.z}Ra+=9}if(jb.length){ka=jb[Z.a];la=jb[Z.b];oa=jb[Z.c];V[N]=ka.x;V[N+1]=ka.y;V[N+2]=ka.z;V[N+3]=ka.w;V[N+4]=la.x;V[N+5]=la.y;V[N+6]=la.z;V[N+7]=la.w;V[N+8]=oa.x;V[N+9]=oa.y;V[N+10]=oa.z;V[N+11]=oa.w;ka=nb[Z.a];la=nb[Z.b];oa=nb[Z.c];$[N]=ka.x;$[N+1]=ka.y;$[N+2]=ka.z;$[N+3]=ka.w;$[N+4]=la.x;$[N+5]=la.y;$[N+6]=la.z;$[N+7]=la.w;$[N+8]=oa.x;$[N+9]=oa.y;$[N+10]=oa.z;$[N+11]=oa.w;ka=lb[Z.a];la=lb[Z.b];oa=lb[Z.c];xa[N]=ka.x;xa[N+1]=ka.y;xa[N+2]=ka.z;xa[N+3]=1;
-xa[N+4]=la.x;xa[N+5]=la.y;xa[N+6]=la.z;xa[N+7]=1;xa[N+8]=oa.x;xa[N+9]=oa.y;xa[N+10]=oa.z;xa[N+11]=1;ka=mb[Z.a];la=mb[Z.b];oa=mb[Z.c];J[N]=ka.x;J[N+1]=ka.y;J[N+2]=ka.z;J[N+3]=1;J[N+4]=la.x;J[N+5]=la.y;J[N+6]=la.z;J[N+7]=1;J[N+8]=oa.x;J[N+9]=oa.y;J[N+10]=oa.z;J[N+11]=1;N+=12}if(cb&&Ba){if(Da.length==3&&Ba==THREE.VertexColors){Z=Da[0];ka=Da[1];la=Da[2]}else la=ka=Z=Za;Sa[Pa]=Z.r;Sa[Pa+1]=Z.g;Sa[Pa+2]=Z.b;Sa[Pa+3]=ka.r;Sa[Pa+4]=ka.g;Sa[Pa+5]=ka.b;Sa[Pa+6]=la.r;Sa[Pa+7]=la.g;Sa[Pa+8]=la.b;Pa+=9}if(ib&&
-T.hasTangents){Da=ua[0];Za=ua[1];Z=ua[2];Ia[Ka]=Da.x;Ia[Ka+1]=Da.y;Ia[Ka+2]=Da.z;Ia[Ka+3]=Da.w;Ia[Ka+4]=Za.x;Ia[Ka+5]=Za.y;Ia[Ka+6]=Za.z;Ia[Ka+7]=Za.w;Ia[Ka+8]=Z.x;Ia[Ka+9]=Z.y;Ia[Ka+10]=Z.z;Ia[Ka+11]=Z.w;Ka+=12}if(eb&&K)if(Ja.length==3&&pa)for(ua=0;ua<3;ua++){Ea=Ja[ua];Xa[Ua]=Ea.x;Xa[Ua+1]=Ea.y;Xa[Ua+2]=Ea.z;Ua+=3}else for(ua=0;ua<3;ua++){Xa[Ua]=Ea.x;Xa[Ua+1]=Ea.y;Xa[Ua+2]=Ea.z;Ua+=3}if($a&&ra!==undefined&&Q)for(ua=0;ua<3;ua++){Ja=ra[ua];Ga[Ha]=Ja.u;Ga[Ha+1]=Ja.v;Ha+=2}if($a&&ca!==undefined&&Q)for(ua=
-0;ua<3;ua++){Ja=ca[ua];ab[Na]=Ja.u;ab[Na+1]=Ja.v;Na+=2}if(db){Aa[Ya]=na;Aa[Ya+1]=na+1;Aa[Ya+2]=na+2;Ya+=3;qa[Wa]=na;qa[Wa+1]=na+1;qa[Wa+2]=na;qa[Wa+3]=na+2;qa[Wa+4]=na+1;qa[Wa+5]=na+2;Wa+=6;na+=3}}else if(Z instanceof THREE.Face4){if(La){ka=kb[Z.a].position;la=kb[Z.b].position;oa=kb[Z.c].position;Qa=kb[Z.d].position;Va[ya]=ka.x;Va[ya+1]=ka.y;Va[ya+2]=ka.z;Va[ya+3]=la.x;Va[ya+4]=la.y;Va[ya+5]=la.z;Va[ya+6]=oa.x;Va[ya+7]=oa.y;Va[ya+8]=oa.z;Va[ya+9]=Qa.x;Va[ya+10]=Qa.y;Va[ya+11]=Qa.z;ya+=12}if(fb){Ta=
-0;for(gb=hb.length;Ta<gb;Ta++){ka=hb[Ta].vertices[Z.a].position;la=hb[Ta].vertices[Z.b].position;oa=hb[Ta].vertices[Z.c].position;Qa=hb[Ta].vertices[Z.d].position;Oa=ha[Ta];Oa[Ra+0]=ka.x;Oa[Ra+1]=ka.y;Oa[Ra+2]=ka.z;Oa[Ra+3]=la.x;Oa[Ra+4]=la.y;Oa[Ra+5]=la.z;Oa[Ra+6]=oa.x;Oa[Ra+7]=oa.y;Oa[Ra+8]=oa.z;Oa[Ra+9]=Qa.x;Oa[Ra+10]=Qa.y;Oa[Ra+11]=Qa.z}Ra+=12}if(jb.length){ka=jb[Z.a];la=jb[Z.b];oa=jb[Z.c];Qa=jb[Z.d];V[N]=ka.x;V[N+1]=ka.y;V[N+2]=ka.z;V[N+3]=ka.w;V[N+4]=la.x;V[N+5]=la.y;V[N+6]=la.z;V[N+7]=la.w;
-V[N+8]=oa.x;V[N+9]=oa.y;V[N+10]=oa.z;V[N+11]=oa.w;V[N+12]=Qa.x;V[N+13]=Qa.y;V[N+14]=Qa.z;V[N+15]=Qa.w;ka=nb[Z.a];la=nb[Z.b];oa=nb[Z.c];Qa=nb[Z.d];$[N]=ka.x;$[N+1]=ka.y;$[N+2]=ka.z;$[N+3]=ka.w;$[N+4]=la.x;$[N+5]=la.y;$[N+6]=la.z;$[N+7]=la.w;$[N+8]=oa.x;$[N+9]=oa.y;$[N+10]=oa.z;$[N+11]=oa.w;$[N+12]=Qa.x;$[N+13]=Qa.y;$[N+14]=Qa.z;$[N+15]=Qa.w;ka=lb[Z.a];la=lb[Z.b];oa=lb[Z.c];Qa=lb[Z.d];xa[N]=ka.x;xa[N+1]=ka.y;xa[N+2]=ka.z;xa[N+3]=1;xa[N+4]=la.x;xa[N+5]=la.y;xa[N+6]=la.z;xa[N+7]=1;xa[N+8]=oa.x;xa[N+9]=
-oa.y;xa[N+10]=oa.z;xa[N+11]=1;xa[N+12]=Qa.x;xa[N+13]=Qa.y;xa[N+14]=Qa.z;xa[N+15]=1;ka=mb[Z.a];la=mb[Z.b];oa=mb[Z.c];Z=mb[Z.d];J[N]=ka.x;J[N+1]=ka.y;J[N+2]=ka.z;J[N+3]=1;J[N+4]=la.x;J[N+5]=la.y;J[N+6]=la.z;J[N+7]=1;J[N+8]=oa.x;J[N+9]=oa.y;J[N+10]=oa.z;J[N+11]=1;J[N+12]=Z.x;J[N+13]=Z.y;J[N+14]=Z.z;J[N+15]=1;N+=16}if(cb&&Ba){if(Da.length==4&&Ba==THREE.VertexColors){Z=Da[0];ka=Da[1];la=Da[2];Da=Da[3]}else Da=la=ka=Z=Za;Sa[Pa]=Z.r;Sa[Pa+1]=Z.g;Sa[Pa+2]=Z.b;Sa[Pa+3]=ka.r;Sa[Pa+4]=ka.g;Sa[Pa+5]=ka.b;Sa[Pa+
-6]=la.r;Sa[Pa+7]=la.g;Sa[Pa+8]=la.b;Sa[Pa+9]=Da.r;Sa[Pa+10]=Da.g;Sa[Pa+11]=Da.b;Pa+=12}if(ib&&T.hasTangents){Da=ua[0];Za=ua[1];Z=ua[2];ua=ua[3];Ia[Ka]=Da.x;Ia[Ka+1]=Da.y;Ia[Ka+2]=Da.z;Ia[Ka+3]=Da.w;Ia[Ka+4]=Za.x;Ia[Ka+5]=Za.y;Ia[Ka+6]=Za.z;Ia[Ka+7]=Za.w;Ia[Ka+8]=Z.x;Ia[Ka+9]=Z.y;Ia[Ka+10]=Z.z;Ia[Ka+11]=Z.w;Ia[Ka+12]=ua.x;Ia[Ka+13]=ua.y;Ia[Ka+14]=ua.z;Ia[Ka+15]=ua.w;Ka+=16}if(eb&&K)if(Ja.length==4&&pa)for(ua=0;ua<4;ua++){Ea=Ja[ua];Xa[Ua]=Ea.x;Xa[Ua+1]=Ea.y;Xa[Ua+2]=Ea.z;Ua+=3}else for(ua=0;ua<4;ua++){Xa[Ua]=
-Ea.x;Xa[Ua+1]=Ea.y;Xa[Ua+2]=Ea.z;Ua+=3}if($a&&ra!==undefined&&Q)for(ua=0;ua<4;ua++){Ja=ra[ua];Ga[Ha]=Ja.u;Ga[Ha+1]=Ja.v;Ha+=2}if($a&&ca!==undefined&&Q)for(ua=0;ua<4;ua++){Ja=ca[ua];ab[Na]=Ja.u;ab[Na+1]=Ja.v;Na+=2}if(db){Aa[Ya]=na;Aa[Ya+1]=na+1;Aa[Ya+2]=na+3;Aa[Ya+3]=na+1;Aa[Ya+4]=na+2;Aa[Ya+5]=na+3;Ya+=6;qa[Wa]=na;qa[Wa+1]=na+1;qa[Wa+2]=na;qa[Wa+3]=na+3;qa[Wa+4]=na+1;qa[Wa+5]=na+2;qa[Wa+6]=na+2;qa[Wa+7]=na+3;Wa+=8;na+=4}}}if(La){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,
-Va,H)}if(fb){Ta=0;for(gb=hb.length;Ta<gb;Ta++){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[Ta]);f.bufferData(f.ARRAY_BUFFER,ha[Ta],H)}}if(cb&&Pa>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Sa,H)}if(eb){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLNormalBuffer);f.bufferData(f.ARRAY_BUFFER,Xa,H)}if(ib&&T.hasTangents){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLTangentBuffer);f.bufferData(f.ARRAY_BUFFER,Ia,H)}if($a&&Ha>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUVBuffer);
-f.bufferData(f.ARRAY_BUFFER,Ga,H)}if($a&&Na>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLUV2Buffer);f.bufferData(f.ARRAY_BUFFER,ab,H)}if(db){f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,Aa,H);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,qa,H)}if(N>0){f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);f.bufferData(f.ARRAY_BUFFER,xa,H);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);f.bufferData(f.ARRAY_BUFFER,
-J,H);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);f.bufferData(f.ARRAY_BUFFER,$,H);f.bindBuffer(f.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);f.bufferData(f.ARRAY_BUFFER,V,H)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Ribbon){w=o.geometry;if(w.__dirtyVertices||w.__dirtyColors){o=w;E=f.DYNAMIC_DRAW;Q=void 0;Q=void 0;Ba=void 0;C=void 0;K=o.vertices;H=o.colors;ra=K.length;
-aa=H.length;ca=o.__vertexArray;Fa=o.__colorArray;na=o.__dirtyColors;if(o.__dirtyVertices){for(Q=0;Q<ra;Q++){Ba=K[Q].position;C=Q*3;ca[C]=Ba.x;ca[C+1]=Ba.y;ca[C+2]=Ba.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,ca,E)}if(na){for(Q=0;Q<aa;Q++){color=H[Q];C=Q*3;Fa[C]=color.r;Fa[C+1]=color.g;Fa[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Fa,E)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(o instanceof THREE.Line){w=
-o.geometry;if(w.__dirtyVertices||w.__dirtyColors){o=w;E=f.DYNAMIC_DRAW;Q=void 0;Q=void 0;Ba=void 0;C=void 0;K=o.vertices;H=o.colors;ra=K.length;aa=H.length;ca=o.__vertexArray;Fa=o.__colorArray;na=o.__dirtyColors;if(o.__dirtyVertices){for(Q=0;Q<ra;Q++){Ba=K[Q].position;C=Q*3;ca[C]=Ba.x;ca[C+1]=Ba.y;ca[C+2]=Ba.z}f.bindBuffer(f.ARRAY_BUFFER,o.__webGLVertexBuffer);f.bufferData(f.ARRAY_BUFFER,ca,E)}if(na){for(Q=0;Q<aa;Q++){color=H[Q];C=Q*3;Fa[C]=color.r;Fa[C+1]=color.g;Fa[C+2]=color.b}f.bindBuffer(f.ARRAY_BUFFER,
-o.__webGLColorBuffer);f.bufferData(f.ARRAY_BUFFER,Fa,E)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(o instanceof THREE.ParticleSystem){w=o.geometry;(w.__dirtyVertices||w.__dirtyColors||o.sortParticles)&&c(w,f.DYNAMIC_DRAW,o);w.__dirtyVertices=!1;w.__dirtyColors=!1}}};this.setFaceCulling=function(n,D){if(n){!D||D=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW);if(n=="back")f.cullFace(f.BACK);else n=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK);f.enable(f.CULL_FACE)}else f.disable(f.CULL_FACE)};
-this.supportsVertexTextures=function(){return f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
-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,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var d,e=b.length;for(d=0;d<e;d++){a=b[d];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
+THREE.WebGLRenderer=function(a){function c(j,t,w){var o,C,G,J=j.vertices,E=J.length,A=j.colors,V=A.length,K=j.__vertexArray,T=j.__colorArray,ja=j.__sortArray,pa=j.__dirtyVertices,sa=j.__dirtyColors;if(w.sortParticles){ha.multiplySelf(w.matrixWorld);for(o=0;o<E;o++){C=J[o].position;qa.copy(C);ha.multiplyVector3(qa);ja[o]=[qa.z,o]}ja.sort(function(Ba,ya){return ya[0]-Ba[0]});for(o=0;o<E;o++){C=J[ja[o][1]].position;G=o*3;K[G]=C.x;K[G+1]=C.y;K[G+2]=C.z}for(o=0;o<V;o++){G=o*3;color=A[ja[o][1]];T[G]=color.r;
+T[G+1]=color.g;T[G+2]=color.b}}else{if(pa)for(o=0;o<E;o++){C=J[o].position;G=o*3;K[G]=C.x;K[G+1]=C.y;K[G+2]=C.z}if(sa)for(o=0;o<V;o++){color=A[o];G=o*3;T[G]=color.r;T[G+1]=color.g;T[G+2]=color.b}}if(pa||w.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,K,t)}if(sa||w.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,T,t)}}function b(j,t){j.uniforms=Uniforms.clone(t.uniforms);j.vertexShader=t.vertexShader;j.fragmentShader=
+t.fragmentShader}function e(j,t,w,o,C){o.__webglProgram||Y.initMaterial(o,t,w,C);var G=o.program,J=G.uniforms,E=o.uniforms;if(G!=X){d.useProgram(G);X=G}d.uniformMatrix4fv(J.projectionMatrix,!1,ra);if(w&&(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial||o instanceof THREE.LineBasicMaterial||o instanceof THREE.ParticleBasicMaterial)){E.fogColor.value.setHex(w.color.hex);if(w instanceof THREE.Fog){E.fogNear.value=w.near;E.fogFar.value=
+w.far}else if(w instanceof THREE.FogExp2)E.fogDensity.value=w.density}if(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o.lights){var A,V,K=0,T=0,ja=0,pa,sa,Ba,ya=xa,Fa=ya.directional.colors,fa=ya.directional.positions,U=ya.point.colors,la=ya.point.positions,Ma=0,Ha=0;w=V=V=0;for(A=t.length;w<A;w++){V=t[w];pa=V.color;sa=V.position;Ba=V.intensity;if(V instanceof THREE.AmbientLight){K+=pa.r;T+=pa.g;ja+=pa.b}else if(V instanceof THREE.DirectionalLight){V=Ma*3;Fa[V]=pa.r*
+Ba;Fa[V+1]=pa.g*Ba;Fa[V+2]=pa.b*Ba;fa[V]=sa.x;fa[V+1]=sa.y;fa[V+2]=sa.z;Ma+=1}else if(V instanceof THREE.PointLight){V=Ha*3;U[V]=pa.r*Ba;U[V+1]=pa.g*Ba;U[V+2]=pa.b*Ba;la[V]=sa.x;la[V+1]=sa.y;la[V+2]=sa.z;Ha+=1}}for(w=Ma*3;w<Fa.length;w++)Fa[w]=0;for(w=Ha*3;w<U.length;w++)U[w]=0;ya.point.length=Ha;ya.directional.length=Ma;ya.ambient[0]=K;ya.ambient[1]=T;ya.ambient[2]=ja;w=xa;E.enableLighting.value=w.directional.length+w.point.length;E.ambientLightColor.value=w.ambient;E.directionalLightColor.value=
+w.directional.colors;E.directionalLightDirection.value=w.directional.positions;E.pointLightColor.value=w.point.colors;E.pointLightPosition.value=w.point.positions}if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial){E.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);E.opacity.value=o.opacity;E.map.texture=o.map;E.lightMap.texture=o.lightMap;E.envMap.texture=o.envMap;E.reflectivity.value=o.reflectivity;
+E.refractionRatio.value=o.refractionRatio;E.combine.value=o.combine;E.useRefract.value=o.envMap&&o.envMap.mapping instanceof THREE.CubeRefractionMapping}if(o instanceof THREE.LineBasicMaterial){E.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);E.opacity.value=o.opacity}else if(o instanceof THREE.ParticleBasicMaterial){E.psColor.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);E.opacity.value=o.opacity;E.size.value=o.size;E.scale.value=$.height/
+2;E.map.texture=o.map}else if(o instanceof THREE.MeshPhongMaterial){E.ambient.value.setRGB(o.ambient.r,o.ambient.g,o.ambient.b);E.specular.value.setRGB(o.specular.r,o.specular.g,o.specular.b);E.shininess.value=o.shininess}else if(o instanceof THREE.MeshDepthMaterial){E.mNear.value=j.near;E.mFar.value=j.far;E.opacity.value=o.opacity}else if(o instanceof THREE.MeshNormalMaterial)E.opacity.value=o.opacity;for(var fb in E)if(T=G.uniforms[fb]){A=E[fb];K=A.type;w=A.value;if(K=="i")d.uniform1i(T,w);else if(K==
+"f")d.uniform1f(T,w);else if(K=="fv1")d.uniform1fv(T,w);else if(K=="fv")d.uniform3fv(T,w);else if(K=="v2")d.uniform2f(T,w.x,w.y);else if(K=="v3")d.uniform3f(T,w.x,w.y,w.z);else if(K=="c")d.uniform3f(T,w.r,w.g,w.b);else if(K=="t"){d.uniform1i(T,w);if(A=A.texture)if(A.image instanceof Array&&A.image.length==6){if(A.image.length==6){if(A.needsUpdate){if(A.__wasSetOnce){d.bindTexture(d.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube);for(K=0;K<6;++K)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,0,0,d.RGBA,
+d.UNSIGNED_BYTE,A.image[K])}else{A.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube);for(K=0;K<6;++K)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+K,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,A.image[K]);A.__wasSetOnce=!0}D(d.TEXTURE_CUBE_MAP,A,A.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);A.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_CUBE_MAP,A.image.__webGLTextureCube)}}else{if(A.needsUpdate){if(A.__wasSetOnce){d.bindTexture(d.TEXTURE_2D,
+A.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,A.image)}else{A.__webGLTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,A.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,A.image);A.__wasSetOnce=!0}D(d.TEXTURE_2D,A,A.image);d.bindTexture(d.TEXTURE_2D,null);A.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_2D,A.__webGLTexture)}}}d.uniformMatrix4fv(J.modelViewMatrix,!1,C._modelViewMatrixArray);d.uniformMatrix3fv(J.normalMatrix,
+!1,C._normalMatrixArray);(o instanceof THREE.MeshShaderMaterial||o instanceof THREE.MeshPhongMaterial||o.envMap)&&d.uniform3f(J.cameraPosition,j.position.x,j.position.y,j.position.z);(o instanceof THREE.MeshShaderMaterial||o.envMap||o.skinning)&&d.uniformMatrix4fv(J.objectMatrix,!1,C._objectMatrixArray);(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshShaderMaterial||o.skinning)&&d.uniformMatrix4fv(J.viewMatrix,!1,na);if(o instanceof THREE.ShadowVolumeDynamicMaterial){j=
+E.directionalLightDirection.value;j[0]=-t.position.x;j[1]=-t.position.y;j[2]=-t.position.z;d.uniform3fv(J.directionalLightDirection,j);d.uniformMatrix4fv(J.objectMatrix,!1,C._objectMatrixArray);d.uniformMatrix4fv(J.viewMatrix,!1,na)}if(o.skinning){d.uniformMatrix4fv(J.cameraInverseMatrix,!1,na);d.uniformMatrix4fv(J.boneGlobalMatrices,!1,C.boneMatrices)}return G}function f(j,t,w,o,C,G){if(o.opacity!=0){j=e(j,t,w,o,G).attributes;if(o.morphTargets){t=o.program.attributes;G.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,
+C.__webGLMorphTargetsBuffers[G.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,C.__webGLVertexBuffer);d.vertexAttribPointer(t.position,3,d.FLOAT,!1,0,0);if(G.morphTargetForcedOrder.length){w=0;for(var J=G.morphTargetForcedOrder,E=G.morphTargetInfluences;w<o.numSupportedMorphTargets&&w<J.length;){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[J[w]]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);G.__webGLMorphTargetInfluences[w]=E[J[w]];w++}}else{J=[];var A=-1,V=0;E=G.morphTargetInfluences;
+var K,T=E.length;w=0;for(G.morphTargetBase!==-1&&(J[G.morphTargetBase]=!0);w<o.numSupportedMorphTargets;){for(K=0;K<T;K++)if(!J[K]&&E[K]>A){V=K;A=E[V]}d.bindBuffer(d.ARRAY_BUFFER,C.__webGLMorphTargetsBuffers[V]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);G.__webGLMorphTargetInfluences[w]=A;J[V]=1;A=-1;w++}}d.uniform1fv(o.program.uniforms.morphTargetInfluences,G.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,C.__webGLVertexBuffer);d.vertexAttribPointer(j.position,3,
+d.FLOAT,!1,0,0)}if(j.color>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLColorBuffer);d.vertexAttribPointer(j.color,3,d.FLOAT,!1,0,0)}if(j.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLNormalBuffer);d.vertexAttribPointer(j.normal,3,d.FLOAT,!1,0,0)}if(j.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLTangentBuffer);d.vertexAttribPointer(j.tangent,4,d.FLOAT,!1,0,0)}if(j.uv>=0)if(C.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLUVBuffer);d.vertexAttribPointer(j.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(j.uv)}else d.disableVertexAttribArray(j.uv);
+if(j.uv2>=0)if(C.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLUV2Buffer);d.vertexAttribPointer(j.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(j.uv2)}else d.disableVertexAttribArray(j.uv2);if(o.skinning&&j.skinVertexA>=0&&j.skinVertexB>=0&&j.skinIndex>=0&&j.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinVertexABuffer);d.vertexAttribPointer(j.skinVertexA,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinVertexBBuffer);d.vertexAttribPointer(j.skinVertexB,4,d.FLOAT,!1,0,
+0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinIndicesBuffer);d.vertexAttribPointer(j.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLSkinWeightsBuffer);d.vertexAttribPointer(j.skinWeight,4,d.FLOAT,!1,0,0)}if(G instanceof THREE.Mesh)if(o.wireframe){d.lineWidth(o.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);d.drawElements(d.LINES,C.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,
+C.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(G instanceof THREE.Line){G=G.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(o.linewidth);d.drawArrays(G,0,C.__webGLLineCount)}else if(G instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,C.__webGLParticleCount);else G instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,C.__webGLVertexCount)}}function g(j,t){if(!j.__webGLVertexBuffer)j.__webGLVertexBuffer=d.createBuffer();if(!j.__webGLNormalBuffer)j.__webGLNormalBuffer=d.createBuffer();
+if(j.hasPos){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,j.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.position);d.vertexAttribPointer(t.attributes.position,3,d.FLOAT,!1,0,0)}if(j.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,j.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.normal);d.vertexAttribPointer(t.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,j.count);
+j.count=0}function h(j){if(ua!=j.doubleSided){j.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);ua=j.doubleSided}if(va!=j.flipSided){j.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);va=j.flipSided}}function k(j){if(ma!=j){j?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);ma=j}}function m(j){N[0].set(j.n41-j.n11,j.n42-j.n12,j.n43-j.n13,j.n44-j.n14);N[1].set(j.n41+j.n11,j.n42+j.n12,j.n43+j.n13,j.n44+j.n14);N[2].set(j.n41+j.n21,j.n42+j.n22,j.n43+j.n23,j.n44+j.n24);N[3].set(j.n41-j.n21,j.n42-
+j.n22,j.n43-j.n23,j.n44-j.n24);N[4].set(j.n41-j.n31,j.n42-j.n32,j.n43-j.n33,j.n44-j.n34);N[5].set(j.n41+j.n31,j.n42+j.n32,j.n43+j.n33,j.n44+j.n34);var t;for(j=0;j<6;j++){t=N[j];t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))}}function n(j){for(var t=j.matrixWorld,w=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),o=0;o<6;o++){j=N[o].x*t.n14+N[o].y*t.n24+N[o].z*t.n34+N[o].w;if(j<=w)return!1}return!0}function p(j,t){j.list[j.count]=t;j.count+=1}function x(j){var t,
+w,o=j.object,C=j.opaque,G=j.transparent;G.count=0;j=C.count=0;for(t=o.materials.length;j<t;j++){w=o.materials[j];w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?p(G,w):p(C,w)}}function z(j){var t,w,o,C,G=j.object,J=j.buffer,E=j.opaque,A=j.transparent;A.count=0;j=E.count=0;for(o=G.materials.length;j<o;j++){t=G.materials[j];if(t instanceof THREE.MeshFaceMaterial){t=0;for(w=J.materials.length;t<w;t++)(C=J.materials[t])&&(C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?p(A,C):p(E,C))}else{C=
+t;C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?p(A,C):p(E,C)}}}function y(j,t){return t.z-j.z}function B(j,t){j._modelViewMatrix.multiplyToArray(t.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(j._modelViewMatrix).transposeIntoArray(j._normalMatrixArray)}function H(j){var t,w,o;if(j instanceof THREE.Mesh){w=j.geometry;for(t in w.geometryGroups){o=w.geometryGroups[t];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||
+w.__dirtyColors||w.__dirtyTangents){var C=d.DYNAMIC_DRAW,G=void 0,J=void 0,E=void 0,A=void 0;E=void 0;var V=void 0,K=void 0,T=void 0,ja=void 0,pa=void 0,sa=void 0,Ba=void 0,ya=void 0,Fa=void 0,fa=void 0,U=void 0,la=void 0,Ma=void 0;K=void 0;T=void 0;A=void 0;ja=void 0;A=void 0;fa=void 0;U=void 0;K=void 0;fa=void 0;U=void 0;la=void 0;Ma=void 0;fa=void 0;U=void 0;la=void 0;Ma=void 0;fa=void 0;U=void 0;la=void 0;Ma=void 0;fa=void 0;U=void 0;la=void 0;A=void 0;ja=void 0;V=void 0;E=void 0;E=void 0;var Ha=
+void 0,fb=void 0,Ua=void 0,Ja=0,Sa=0,cb=0,eb=0,Qa=0,Va=0,Ea=0,Wa=0,Na=0,O=0,Oa=0,Ra=o.__vertexArray,jb=o.__uvArray,Ca=o.__uv2Array,Ta=o.__normalArray,Ga=o.__tangentArray,Pa=o.__colorArray,Ka=o.__skinVertexAArray,wa=o.__skinVertexBArray,L=o.__skinIndexArray,aa=o.__skinWeightArray,oa=o.__morphTargetsArrays,ea=o.__faceArray,ta=o.__lineArray,Aa=o.__needsSmoothNormals;sa=o.__vertexColorType;pa=o.__uvType;Ba=o.__normalType;var ga=j.geometry,ca=ga.__dirtyVertices,La=ga.__dirtyElements,Ya=ga.__dirtyUvs,Za=
+ga.__dirtyNormals,db=ga.__dirtyTangents,hb=ga.__dirtyColors,bb=ga.__dirtyMorphTargets,Xa=ga.vertices,ob=o.faces,rb=ga.faces,pb=ga.faceVertexUvs[0],qb=ga.faceVertexUvs[1],lb=ga.skinVerticesA,mb=ga.skinVerticesB,nb=ga.skinIndices,ib=ga.skinWeights,kb=ga.edgeFaces,gb=ga.morphTargets;G=0;for(J=ob.length;G<J;G++){E=ob[G];A=rb[E];pb&&(ya=pb[E]);qb&&(Fa=qb[E]);E=A.vertexNormals;V=A.normal;K=A.vertexColors;T=A.color;ja=A.vertexTangents;if(A instanceof THREE.Face3){if(ca){fa=Xa[A.a].position;U=Xa[A.b].position;
+la=Xa[A.c].position;Ra[Sa]=fa.x;Ra[Sa+1]=fa.y;Ra[Sa+2]=fa.z;Ra[Sa+3]=U.x;Ra[Sa+4]=U.y;Ra[Sa+5]=U.z;Ra[Sa+6]=la.x;Ra[Sa+7]=la.y;Ra[Sa+8]=la.z;Sa+=9}if(bb){Ha=0;for(fb=gb.length;Ha<fb;Ha++){fa=gb[Ha].vertices[A.a].position;U=gb[Ha].vertices[A.b].position;la=gb[Ha].vertices[A.c].position;Ua=oa[Ha];Ua[Oa+0]=fa.x;Ua[Oa+1]=fa.y;Ua[Oa+2]=fa.z;Ua[Oa+3]=U.x;Ua[Oa+4]=U.y;Ua[Oa+5]=U.z;Ua[Oa+6]=la.x;Ua[Oa+7]=la.y;Ua[Oa+8]=la.z}Oa+=9}if(ib.length){fa=ib[A.a];U=ib[A.b];la=ib[A.c];aa[O]=fa.x;aa[O+1]=fa.y;aa[O+2]=
+fa.z;aa[O+3]=fa.w;aa[O+4]=U.x;aa[O+5]=U.y;aa[O+6]=U.z;aa[O+7]=U.w;aa[O+8]=la.x;aa[O+9]=la.y;aa[O+10]=la.z;aa[O+11]=la.w;fa=nb[A.a];U=nb[A.b];la=nb[A.c];L[O]=fa.x;L[O+1]=fa.y;L[O+2]=fa.z;L[O+3]=fa.w;L[O+4]=U.x;L[O+5]=U.y;L[O+6]=U.z;L[O+7]=U.w;L[O+8]=la.x;L[O+9]=la.y;L[O+10]=la.z;L[O+11]=la.w;fa=lb[A.a];U=lb[A.b];la=lb[A.c];Ka[O]=fa.x;Ka[O+1]=fa.y;Ka[O+2]=fa.z;Ka[O+3]=1;Ka[O+4]=U.x;Ka[O+5]=U.y;Ka[O+6]=U.z;Ka[O+7]=1;Ka[O+8]=la.x;Ka[O+9]=la.y;Ka[O+10]=la.z;Ka[O+11]=1;fa=mb[A.a];U=mb[A.b];la=mb[A.c];wa[O]=
+fa.x;wa[O+1]=fa.y;wa[O+2]=fa.z;wa[O+3]=1;wa[O+4]=U.x;wa[O+5]=U.y;wa[O+6]=U.z;wa[O+7]=1;wa[O+8]=la.x;wa[O+9]=la.y;wa[O+10]=la.z;wa[O+11]=1;O+=12}if(hb&&sa){if(K.length==3&&sa==THREE.VertexColors){A=K[0];fa=K[1];U=K[2]}else U=fa=A=T;Pa[Na]=A.r;Pa[Na+1]=A.g;Pa[Na+2]=A.b;Pa[Na+3]=fa.r;Pa[Na+4]=fa.g;Pa[Na+5]=fa.b;Pa[Na+6]=U.r;Pa[Na+7]=U.g;Pa[Na+8]=U.b;Na+=9}if(db&&ga.hasTangents){K=ja[0];T=ja[1];A=ja[2];Ga[Ea]=K.x;Ga[Ea+1]=K.y;Ga[Ea+2]=K.z;Ga[Ea+3]=K.w;Ga[Ea+4]=T.x;Ga[Ea+5]=T.y;Ga[Ea+6]=T.z;Ga[Ea+7]=T.w;
+Ga[Ea+8]=A.x;Ga[Ea+9]=A.y;Ga[Ea+10]=A.z;Ga[Ea+11]=A.w;Ea+=12}if(Za&&Ba)if(E.length==3&&Aa)for(ja=0;ja<3;ja++){V=E[ja];Ta[Va]=V.x;Ta[Va+1]=V.y;Ta[Va+2]=V.z;Va+=3}else for(ja=0;ja<3;ja++){Ta[Va]=V.x;Ta[Va+1]=V.y;Ta[Va+2]=V.z;Va+=3}if(Ya&&ya!==undefined&&pa)for(ja=0;ja<3;ja++){E=ya[ja];jb[cb]=E.u;jb[cb+1]=E.v;cb+=2}if(Ya&&Fa!==undefined&&pa)for(ja=0;ja<3;ja++){E=Fa[ja];Ca[eb]=E.u;Ca[eb+1]=E.v;eb+=2}if(La){ea[Qa]=Ja;ea[Qa+1]=Ja+1;ea[Qa+2]=Ja+2;Qa+=3;ta[Wa]=Ja;ta[Wa+1]=Ja+1;ta[Wa+2]=Ja;ta[Wa+3]=Ja+2;ta[Wa+
+4]=Ja+1;ta[Wa+5]=Ja+2;Wa+=6;Ja+=3}}else if(A instanceof THREE.Face4){if(ca){fa=Xa[A.a].position;U=Xa[A.b].position;la=Xa[A.c].position;Ma=Xa[A.d].position;Ra[Sa]=fa.x;Ra[Sa+1]=fa.y;Ra[Sa+2]=fa.z;Ra[Sa+3]=U.x;Ra[Sa+4]=U.y;Ra[Sa+5]=U.z;Ra[Sa+6]=la.x;Ra[Sa+7]=la.y;Ra[Sa+8]=la.z;Ra[Sa+9]=Ma.x;Ra[Sa+10]=Ma.y;Ra[Sa+11]=Ma.z;Sa+=12}if(bb){Ha=0;for(fb=gb.length;Ha<fb;Ha++){fa=gb[Ha].vertices[A.a].position;U=gb[Ha].vertices[A.b].position;la=gb[Ha].vertices[A.c].position;Ma=gb[Ha].vertices[A.d].position;Ua=
+oa[Ha];Ua[Oa+0]=fa.x;Ua[Oa+1]=fa.y;Ua[Oa+2]=fa.z;Ua[Oa+3]=U.x;Ua[Oa+4]=U.y;Ua[Oa+5]=U.z;Ua[Oa+6]=la.x;Ua[Oa+7]=la.y;Ua[Oa+8]=la.z;Ua[Oa+9]=Ma.x;Ua[Oa+10]=Ma.y;Ua[Oa+11]=Ma.z}Oa+=12}if(ib.length){fa=ib[A.a];U=ib[A.b];la=ib[A.c];Ma=ib[A.d];aa[O]=fa.x;aa[O+1]=fa.y;aa[O+2]=fa.z;aa[O+3]=fa.w;aa[O+4]=U.x;aa[O+5]=U.y;aa[O+6]=U.z;aa[O+7]=U.w;aa[O+8]=la.x;aa[O+9]=la.y;aa[O+10]=la.z;aa[O+11]=la.w;aa[O+12]=Ma.x;aa[O+13]=Ma.y;aa[O+14]=Ma.z;aa[O+15]=Ma.w;fa=nb[A.a];U=nb[A.b];la=nb[A.c];Ma=nb[A.d];L[O]=fa.x;L[O+
+1]=fa.y;L[O+2]=fa.z;L[O+3]=fa.w;L[O+4]=U.x;L[O+5]=U.y;L[O+6]=U.z;L[O+7]=U.w;L[O+8]=la.x;L[O+9]=la.y;L[O+10]=la.z;L[O+11]=la.w;L[O+12]=Ma.x;L[O+13]=Ma.y;L[O+14]=Ma.z;L[O+15]=Ma.w;fa=lb[A.a];U=lb[A.b];la=lb[A.c];Ma=lb[A.d];Ka[O]=fa.x;Ka[O+1]=fa.y;Ka[O+2]=fa.z;Ka[O+3]=1;Ka[O+4]=U.x;Ka[O+5]=U.y;Ka[O+6]=U.z;Ka[O+7]=1;Ka[O+8]=la.x;Ka[O+9]=la.y;Ka[O+10]=la.z;Ka[O+11]=1;Ka[O+12]=Ma.x;Ka[O+13]=Ma.y;Ka[O+14]=Ma.z;Ka[O+15]=1;fa=mb[A.a];U=mb[A.b];la=mb[A.c];A=mb[A.d];wa[O]=fa.x;wa[O+1]=fa.y;wa[O+2]=fa.z;wa[O+
+3]=1;wa[O+4]=U.x;wa[O+5]=U.y;wa[O+6]=U.z;wa[O+7]=1;wa[O+8]=la.x;wa[O+9]=la.y;wa[O+10]=la.z;wa[O+11]=1;wa[O+12]=A.x;wa[O+13]=A.y;wa[O+14]=A.z;wa[O+15]=1;O+=16}if(hb&&sa){if(K.length==4&&sa==THREE.VertexColors){A=K[0];fa=K[1];U=K[2];K=K[3]}else K=U=fa=A=T;Pa[Na]=A.r;Pa[Na+1]=A.g;Pa[Na+2]=A.b;Pa[Na+3]=fa.r;Pa[Na+4]=fa.g;Pa[Na+5]=fa.b;Pa[Na+6]=U.r;Pa[Na+7]=U.g;Pa[Na+8]=U.b;Pa[Na+9]=K.r;Pa[Na+10]=K.g;Pa[Na+11]=K.b;Na+=12}if(db&&ga.hasTangents){K=ja[0];T=ja[1];A=ja[2];ja=ja[3];Ga[Ea]=K.x;Ga[Ea+1]=K.y;Ga[Ea+
+2]=K.z;Ga[Ea+3]=K.w;Ga[Ea+4]=T.x;Ga[Ea+5]=T.y;Ga[Ea+6]=T.z;Ga[Ea+7]=T.w;Ga[Ea+8]=A.x;Ga[Ea+9]=A.y;Ga[Ea+10]=A.z;Ga[Ea+11]=A.w;Ga[Ea+12]=ja.x;Ga[Ea+13]=ja.y;Ga[Ea+14]=ja.z;Ga[Ea+15]=ja.w;Ea+=16}if(Za&&Ba)if(E.length==4&&Aa)for(ja=0;ja<4;ja++){V=E[ja];Ta[Va]=V.x;Ta[Va+1]=V.y;Ta[Va+2]=V.z;Va+=3}else for(ja=0;ja<4;ja++){Ta[Va]=V.x;Ta[Va+1]=V.y;Ta[Va+2]=V.z;Va+=3}if(Ya&&ya!==undefined&&pa)for(ja=0;ja<4;ja++){E=ya[ja];jb[cb]=E.u;jb[cb+1]=E.v;cb+=2}if(Ya&&Fa!==undefined&&pa)for(ja=0;ja<4;ja++){E=Fa[ja];
+Ca[eb]=E.u;Ca[eb+1]=E.v;eb+=2}if(La){ea[Qa]=Ja;ea[Qa+1]=Ja+1;ea[Qa+2]=Ja+3;ea[Qa+3]=Ja+1;ea[Qa+4]=Ja+2;ea[Qa+5]=Ja+3;Qa+=6;ta[Wa]=Ja;ta[Wa+1]=Ja+1;ta[Wa+2]=Ja;ta[Wa+3]=Ja+3;ta[Wa+4]=Ja+1;ta[Wa+5]=Ja+2;ta[Wa+6]=Ja+2;ta[Wa+7]=Ja+3;Wa+=8;Ja+=4}}}if(kb){G=0;for(J=kb.length;G<J;G++){ea[Qa]=kb[G].a;ea[Qa+1]=kb[G].b;ea[Qa+2]=kb[G].c;ea[Qa+3]=kb[G].a;ea[Qa+4]=kb[G].c;ea[Qa+5]=kb[G].d;Qa+=6}}if(ca){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ra,C)}if(bb){Ha=0;for(fb=gb.length;Ha<
+fb;Ha++){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLMorphTargetsBuffers[Ha]);d.bufferData(d.ARRAY_BUFFER,oa[Ha],C)}}if(hb&&Na>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,Pa,C)}if(Za){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ta,C)}if(db&&ga.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,Ga,C)}if(Ya&&cb>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,jb,C)}if(Ya&&
+eb>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ca,C)}if(La){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ea,C);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ta,C)}if(O>0){d.bindBuffer(d.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,Ka,C);d.bindBuffer(d.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,wa,C);d.bindBuffer(d.ARRAY_BUFFER,
+o.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,L,C);d.bindBuffer(d.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,aa,C)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){w=j.geometry;if(w.__dirtyVertices||w.__dirtyColors){j=w;t=d.DYNAMIC_DRAW;Ba=j.vertices;C=j.colors;ya=Ba.length;G=C.length;Fa=j.__vertexArray;J=j.__colorArray;Ja=j.__dirtyColors;
+if(j.__dirtyVertices){for(pa=0;pa<ya;pa++){sa=Ba[pa].position;o=pa*3;Fa[o]=sa.x;Fa[o+1]=sa.y;Fa[o+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Fa,t)}if(Ja){for(pa=0;pa<G;pa++){color=C[pa];o=pa*3;J[o]=color.r;J[o+1]=color.g;J[o+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,J,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(j instanceof THREE.Line){w=j.geometry;if(w.__dirtyVertices||w.__dirtyColors){j=w;t=d.DYNAMIC_DRAW;
+Ba=j.vertices;C=j.colors;ya=Ba.length;G=C.length;Fa=j.__vertexArray;J=j.__colorArray;Ja=j.__dirtyColors;if(j.__dirtyVertices){for(pa=0;pa<ya;pa++){sa=Ba[pa].position;o=pa*3;Fa[o]=sa.x;Fa[o+1]=sa.y;Fa[o+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Fa,t)}if(Ja){for(pa=0;pa<G;pa++){color=C[pa];o=pa*3;J[o]=color.r;J[o+1]=color.g;J[o+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,J,t)}}w.__dirtyVertices=!1;w.__dirtyColors=
+!1}else if(j instanceof THREE.ParticleSystem){w=j.geometry;(w.__dirtyVertices||w.__dirtyColors||j.sortParticles)&&c(w,d.DYNAMIC_DRAW,j);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function I(j){function t(ja){var pa=[];w=0;for(o=ja.length;w<o;w++)ja[w]==undefined?pa.push("undefined"):pa.push(ja[w].id);return pa.join("_")}var w,o,C,G,J,E,A,V,K={},T=j.morphTargets!==undefined?j.morphTargets.length:0;j.geometryGroups={};C=0;for(G=j.faces.length;C<G;C++){J=j.faces[C];E=J.materials;A=t(E);K[A]==undefined&&
+(K[A]={hash:A,counter:0});V=K[A].hash+"_"+K[A].counter;j.geometryGroups[V]==undefined&&(j.geometryGroups[V]={faces:[],materials:E,vertices:0,numMorphTargets:T});J=J instanceof THREE.Face3?3:4;if(j.geometryGroups[V].vertices+J>65535){K[A].counter+=1;V=K[A].hash+"_"+K[A].counter;j.geometryGroups[V]==undefined&&(j.geometryGroups[V]={faces:[],materials:E,vertices:0,numMorphTargets:T})}j.geometryGroups[V].faces.push(C);j.geometryGroups[V].vertices+=J}}function F(j,t,w){j.push({buffer:t,object:w,opaque:{list:[],
+count:0},transparent:{list:[],count:0}})}function M(j){if(j!=za){switch(j){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:d.blendEquation(d.FUNC_REVERSE_SUBTRACT);d.blendFunc(d.ONE,d.ONE);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,
+d.ONE_MINUS_SRC_ALPHA)}za=j}}function D(j,t,w){if((w.width&w.width-1)==0&&(w.height&w.height-1)==0){d.texParameteri(j,d.TEXTURE_WRAP_S,ka(t.wrapS));d.texParameteri(j,d.TEXTURE_WRAP_T,ka(t.wrapT));d.texParameteri(j,d.TEXTURE_MAG_FILTER,ka(t.magFilter));d.texParameteri(j,d.TEXTURE_MIN_FILTER,ka(t.minFilter));d.generateMipmap(j)}else{d.texParameteri(j,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(j,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(j,d.TEXTURE_MAG_FILTER,P(t.magFilter));d.texParameteri(j,
+d.TEXTURE_MIN_FILTER,P(t.minFilter))}}function Q(j){if(j&&!j.__webGLFramebuffer){j.__webGLFramebuffer=d.createFramebuffer();j.__webGLRenderbuffer=d.createRenderbuffer();j.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,j.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,j.width,j.height);d.bindTexture(d.TEXTURE_2D,j.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,ka(j.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,ka(j.wrapT));d.texParameteri(d.TEXTURE_2D,
+d.TEXTURE_MAG_FILTER,ka(j.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,ka(j.minFilter));d.texImage2D(d.TEXTURE_2D,0,ka(j.format),j.width,j.height,0,ka(j.format),ka(j.type),null);d.bindFramebuffer(d.FRAMEBUFFER,j.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,j.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,j.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,
+null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var t,w;if(j){t=j.__webGLFramebuffer;w=j.width;j=j.height}else{t=null;w=Z;j=S}if(t!=da){d.bindFramebuffer(d.FRAMEBUFFER,t);d.viewport(W,ia,w,j);da=t}}function R(j,t){var w;if(j=="fragment")w=d.createShader(d.FRAGMENT_SHADER);else j=="vertex"&&(w=d.createShader(d.VERTEX_SHADER));d.shaderSource(w,t);d.compileShader(w);if(!d.getShaderParameter(w,d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(w));console.error(t);return null}return w}function P(j){switch(j){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;
+default:return d.LINEAR}}function ka(j){switch(j){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;
+case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}
+var $=document.createElement("canvas"),d,X=null,da=null,Y=this,ua=null,va=null,za=null,ma=null,W=0,ia=0,Z=0,S=0,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ha=new THREE.Matrix4,ra=new Float32Array(16),na=new Float32Array(16),qa=new THREE.Vector4,xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Da=!0,$a=new THREE.Color(0),ab=0;if(a){if(a.antialias!==undefined)Da=a.antialias;
+a.clearColor!==undefined&&$a.setHex(a.clearColor);if(a.clearAlpha!==undefined)ab=a.clearAlpha}this.maxMorphTargets=8;this.domElement=$;this.autoClear=!0;this.sortObjects=!0;(function(j,t,w){try{if(!(d=$.getContext("experimental-webgl",{antialias:j,stencil:!0})))throw"Error creating WebGL context.";}catch(o){console.error(o)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,
+d.ONE_MINUS_SRC_ALPHA);d.clearColor(t.r,t.g,t.b,w)})(Da,$a,ab);this.context=d;var Ia={};a=[];Da=[];a[0]=-2;a[1]=-1;a[2]=-1;a[3]=2;a[4]=-1;a[5]=-1;a[6]=2;a[7]=1;a[8]=-1;a[9]=-2;a[10]=1;a[11]=-1;Da[0]=0;Da[1]=1;Da[2]=2;Da[3]=0;Da[4]=2;Da[5]=3;Ia.vertexBuffer=d.createBuffer();Ia.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,Ia.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,new Float32Array(a),d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,Ia.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,
+new Uint16Array(Da),d.STATIC_DRAW);Ia.program=d.createProgram();d.attachShader(Ia.program,R("fragment",THREE.ShaderLib.shadowPost.fragmentShader));d.attachShader(Ia.program,R("vertex",THREE.ShaderLib.shadowPost.vertexShader));d.linkProgram(Ia.program);Ia.vertexLocation=d.getAttribLocation(Ia.program,"position");Ia.projectionLocation=d.getUniformLocation(Ia.program,"projectionMatrix");this.setSize=function(j,t){$.width=j;$.height=t;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(j,
+t,w,o){W=j;ia=t;Z=w;S=o;d.viewport(W,ia,Z,S)};this.setScissor=function(j,t,w,o){d.scissor(j,t,w,o)};this.enableScissorTest=function(j){j?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(j){d.depthMask(j)};this.setClearColorHex=function(j,t){var w=new THREE.Color(j);d.clearColor(w.r,w.g,w.b,t)};this.setClearColor=function(j,t){d.clearColor(j.r,j.g,j.b,t)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT|d.STENCIL_BUFFER_BIT)};this.initMaterial=
+function(j,t,w,o){var C,G,J,E;if(j instanceof THREE.MeshDepthMaterial)b(j,THREE.ShaderLib.depth);else if(j instanceof THREE.ShadowVolumeDynamicMaterial)b(j,THREE.ShaderLib.shadowVolumeDynamic);else if(j instanceof THREE.MeshNormalMaterial)b(j,THREE.ShaderLib.normal);else if(j instanceof THREE.MeshBasicMaterial)b(j,THREE.ShaderLib.basic);else if(j instanceof THREE.MeshLambertMaterial)b(j,THREE.ShaderLib.lambert);else if(j instanceof THREE.MeshPhongMaterial)b(j,THREE.ShaderLib.phong);else if(j instanceof
+THREE.LineBasicMaterial)b(j,THREE.ShaderLib.basic);else j instanceof THREE.ParticleBasicMaterial&&b(j,THREE.ShaderLib.particle_basic);if(!j.program){var A,V,K;A=K=E=0;for(J=t.length;A<J;A++){V=t[A];V instanceof THREE.DirectionalLight&&K++;V instanceof THREE.PointLight&&E++}if(E+K<=4)t=K;else{t=Math.ceil(4*K/(E+K));E=4-t}E={directional:t,point:E};t=50;if(o!==undefined&&o instanceof THREE.SkinnedMesh)t=o.bones.length;J={fog:w,map:j.map,envMap:j.envMap,lightMap:j.lightMap,vertexColors:j.vertexColors,
+sizeAttenuation:j.sizeAttenuation,skinning:j.skinning,morphTargets:j.morphTargets,maxDirLights:E.directional,maxPointLights:E.point,maxBones:t};w=j.fragmentShader;E=j.vertexShader;t=d.createProgram();A=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+J.maxDirLights,"#define MAX_POINT_LIGHTS "+J.maxPointLights,J.fog?"#define USE_FOG":"",J.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",J.map?"#define USE_MAP":"",J.envMap?"#define USE_ENVMAP":"",J.lightMap?"#define USE_LIGHTMAP":
+"",J.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");J=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+J.maxDirLights,"#define MAX_POINT_LIGHTS "+J.maxPointLights,"#define MAX_BONES "+J.maxBones,J.map?"#define USE_MAP":"",J.envMap?"#define USE_ENVMAP":"",J.lightMap?"#define USE_LIGHTMAP":"",J.vertexColors?"#define USE_COLOR":"",J.skinning?"#define USE_SKINNING":"",J.morphTargets?"#define USE_MORPHTARGETS":
+"",J.sizeAttenuation?"#define USE_SIZEATTENUATION":"","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 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\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");
+d.attachShader(t,R("fragment",A+w));d.attachShader(t,R("vertex",J+E));d.linkProgram(t);d.getProgramParameter(t,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(t,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");t.uniforms={};t.attributes={};j.program=t;w=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(C in j.uniforms)w.push(C);
+C=j.program;E=0;for(t=w.length;E<t;E++){A=w[E];C.uniforms[A]=d.getUniformLocation(C,A)}w=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(C=0;C<this.maxMorphTargets;C++)w.push("morphTarget"+C);for(G in j.attributes)w.push(G);G=j.program;C=w;w=0;for(E=C.length;w<E;w++){t=C[w];G.attributes[t]=d.getAttribLocation(G,t)}G=j.program.attributes;d.enableVertexAttribArray(G.position);G.color>=0&&d.enableVertexAttribArray(G.color);G.normal>=0&&d.enableVertexAttribArray(G.normal);
+G.tangent>=0&&d.enableVertexAttribArray(G.tangent);if(j.skinning&&G.skinVertexA>=0&&G.skinVertexB>=0&&G.skinIndex>=0&&G.skinWeight>=0){d.enableVertexAttribArray(G.skinVertexA);d.enableVertexAttribArray(G.skinVertexB);d.enableVertexAttribArray(G.skinIndex);d.enableVertexAttribArray(G.skinWeight)}if(j.morphTargets){j.numSupportedMorphTargets=0;if(G.morphTarget0>=0){d.enableVertexAttribArray(G.morphTarget0);j.numSupportedMorphTargets++}if(G.morphTarget1>=0){d.enableVertexAttribArray(G.morphTarget1);
+j.numSupportedMorphTargets++}if(G.morphTarget2>=0){d.enableVertexAttribArray(G.morphTarget2);j.numSupportedMorphTargets++}if(G.morphTarget3>=0){d.enableVertexAttribArray(G.morphTarget3);j.numSupportedMorphTargets++}if(G.morphTarget4>=0){d.enableVertexAttribArray(G.morphTarget4);j.numSupportedMorphTargets++}if(G.morphTarget5>=0){d.enableVertexAttribArray(G.morphTarget5);j.numSupportedMorphTargets++}if(G.morphTarget6>=0){d.enableVertexAttribArray(G.morphTarget6);j.numSupportedMorphTargets++}if(G.morphTarget7>=
+0){d.enableVertexAttribArray(G.morphTarget7);j.numSupportedMorphTargets++}o.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(C=0;C<this.maxMorphTargets;C++)o.__webGLMorphTargetInfluences[C]=0}}j.__webglProgram=!0};this.render=function(j,t,w,o){var C,G,J,E,A,V,K,T,ja=j.lights,pa=j.fog;t.matrixAutoUpdate&&t.updateMatrix();j.update(undefined,!1,t);t.matrixWorldInverse.flattenToArray(na);t.projectionMatrix.flattenToArray(ra);ha.multiply(t.projectionMatrix,t.matrixWorldInverse);
+m(ha);this.initWebGLObjects(j);Q(w);(this.autoClear||o)&&this.clear();o=j.__webglObjects.length;for(A=0;A<o;A++){E=j.__webglObjects[A];K=E.object;if(K.visible)if(!(K instanceof THREE.Mesh)||n(K)){K.matrixWorld.flattenToArray(K._objectMatrixArray);B(K,t);z(E);E.render=!0;if(this.sortObjects){qa.copy(K.position);ha.multiplyVector3(qa);E.z=qa.z}}else E.render=!1;else E.render=!1}this.sortObjects&&j.__webglObjects.sort(y);V=j.__webglObjectsImmediate.length;for(A=0;A<V;A++){E=j.__webglObjectsImmediate[A];
+K=E.object;if(K.visible){K.matrixAutoUpdate&&K.matrixWorld.flattenToArray(K._objectMatrixArray);B(K,t);x(E)}}M(THREE.NormalBlending);for(A=0;A<o;A++){E=j.__webglObjects[A];if(E.render){K=E.object;T=E.buffer;J=E.opaque;h(K);for(C=0;C<J.count;C++){E=J.list[C];k(E.depthTest);f(t,ja,pa,E,T,K)}}}for(A=0;A<V;A++){E=j.__webglObjectsImmediate[A];K=E.object;if(K.visible){J=E.opaque;h(K);for(C=0;C<J.count;C++){E=J.list[C];k(E.depthTest);G=e(t,ja,pa,E,K);K.render(function(sa){g(sa,G)})}}}for(A=0;A<o;A++){E=
+j.__webglObjects[A];if(E.render){K=E.object;T=E.buffer;J=E.transparent;h(K);for(C=0;C<J.count;C++){E=J.list[C];M(E.blending);k(E.depthTest);f(t,ja,pa,E,T,K)}}}for(A=0;A<V;A++){E=j.__webglObjectsImmediate[A];K=E.object;if(K.visible){J=E.transparent;h(K);for(C=0;C<J.count;C++){E=J.list[C];M(E.blending);k(E.depthTest);G=e(t,ja,pa,E,K);K.render(function(sa){g(sa,G)})}}}if(j.__webglShadowVolumes.length&&j.lights.length){d.enable(d.POLYGON_OFFSET_FILL);d.polygonOffset(0.1,1);d.enable(d.STENCIL_TEST);d.depthMask(!1);
+d.colorMask(!1,!1,!1,!1);d.stencilFunc(d.ALWAYS,1,255);d.stencilOpSeparate(d.BACK,d.KEEP,d.INCR,d.KEEP);d.stencilOpSeparate(d.FRONT,d.KEEP,d.DECR,d.KEEP);V=j.lights.length;T=[];o=j.__webglShadowVolumes.length;for(t=0;t<V;t++){A=j.lights[t];if(A instanceof THREE.DirectionalLight){T[0]=-A.position.x;T[1]=-A.position.y;T[2]=-A.position.z;for(A=0;A<o;A++){K=j.__webglShadowVolumes[A].object;C=j.__webglShadowVolumes[A].buffer;E=K.materials[0];E.program||Y.initMaterial(E,ja,pa,K);G=E.program;E=G.uniforms;
+J=G.attributes;if(X!==G){d.useProgram(G);X=G;d.uniformMatrix4fv(E.projectionMatrix,!1,ra);d.uniformMatrix4fv(E.viewMatrix,!1,na);d.uniform3fv(E.directionalLightDirection,T)}K.matrixWorld.flattenToArray(K._objectMatrixArray);d.uniformMatrix4fv(E.objectMatrix,!1,K._objectMatrixArray);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLVertexBuffer);d.vertexAttribPointer(J.position,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,C.__webGLNormalBuffer);d.vertexAttribPointer(J.normal,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
+C.__webGLFaceBuffer);d.cullFace(d.FRONT);d.drawElements(d.TRIANGLES,C.__webGLFaceCount,d.UNSIGNED_SHORT,0);d.cullFace(d.BACK);d.drawElements(d.TRIANGLES,C.__webGLFaceCount,d.UNSIGNED_SHORT,0)}}}d.disable(d.POLYGON_OFFSET_FILL);d.colorMask(!0,!0,!0,!0);d.stencilFunc(d.NOTEQUAL,0,255);d.stencilOp(d.KEEP,d.KEEP,d.KEEP);d.disable(d.DEPTH_TEST);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.blendEquation(d.FUNC_ADD);za="";X=Ia.program;d.useProgram(Ia.program);d.uniformMatrix4fv(Ia.projectionLocation,
+!1,ra);d.bindBuffer(d.ARRAY_BUFFER,Ia.vertexBuffer);d.vertexAttribPointer(Ia.vertexLocation,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(Ia.vertexLocation);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,Ia.elementBuffer);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0);d.disable(d.STENCIL_TEST);d.enable(d.DEPTH_TEST);d.disable(d.BLEND);d.depthMask(!0)}if(w&&w.minFilter!==THREE.NearestFilter&&w.minFilter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,w.__webGLTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,
+null)}};this.initWebGLObjects=function(j){if(!j.__webglObjects){j.__webglObjects=[];j.__webglObjectsImmediate=[];j.__webglShadowVolumes=[]}for(;j.__objectsAdded.length;){var t=j.__objectsAdded[0],w=j,o=void 0,C=void 0,G=void 0;if(t._modelViewMatrix==undefined){t._modelViewMatrix=new THREE.Matrix4;t._normalMatrixArray=new Float32Array(9);t._modelViewMatrixArray=new Float32Array(16);t._objectMatrixArray=new Float32Array(16);t.matrixWorld.flattenToArray(t._objectMatrixArray)}if(t instanceof THREE.Mesh){C=
+t.geometry;C.geometryGroups==undefined&&I(C);for(o in C.geometryGroups){G=C.geometryGroups[o];if(!G.__webGLVertexBuffer){var J=G;J.__webGLVertexBuffer=d.createBuffer();J.__webGLNormalBuffer=d.createBuffer();J.__webGLTangentBuffer=d.createBuffer();J.__webGLColorBuffer=d.createBuffer();J.__webGLUVBuffer=d.createBuffer();J.__webGLUV2Buffer=d.createBuffer();J.__webGLSkinVertexABuffer=d.createBuffer();J.__webGLSkinVertexBBuffer=d.createBuffer();J.__webGLSkinIndicesBuffer=d.createBuffer();J.__webGLSkinWeightsBuffer=
+d.createBuffer();J.__webGLFaceBuffer=d.createBuffer();J.__webGLLineBuffer=d.createBuffer();if(J.numMorphTargets){var E=void 0,A=void 0;J.__webGLMorphTargetsBuffers=[];E=0;for(A=J.numMorphTargets;E<A;E++)J.__webGLMorphTargetsBuffers.push(d.createBuffer())}J=G;E=t;var V=void 0,K=void 0,T=void 0;T=void 0;var ja=A=0,pa=0;V=void 0;K=void 0;var sa=void 0;K=void 0;var Ba=E.geometry;sa=Ba.faces;var ya=J.faces;V=0;for(K=ya.length;V<K;V++){T=ya[V];T=sa[T];if(T instanceof THREE.Face3){A+=3;ja+=1;pa+=3}else if(T instanceof
+THREE.Face4){A+=4;ja+=2;pa+=4}}V=J;K=E;sa=void 0;ya=void 0;var Fa=void 0,fa=void 0;Fa=void 0;T=[];sa=0;for(ya=K.materials.length;sa<ya;sa++){Fa=K.materials[sa];if(Fa instanceof THREE.MeshFaceMaterial){Fa=0;for(l=V.materials.length;Fa<l;Fa++)(fa=V.materials[Fa])&&T.push(fa)}else(fa=Fa)&&T.push(fa)}K=T;a:{V=void 0;sa=void 0;ya=K.length;for(V=0;V<ya;V++){sa=K[V];if(sa.map||sa.lightMap||sa instanceof THREE.MeshShaderMaterial){V=!0;break a}}V=!1}a:{sa=K;ya=void 0;T=void 0;Fa=sa.length;for(ya=0;ya<Fa;ya++){T=
+sa[ya];if(!(T instanceof THREE.MeshBasicMaterial&&!T.envMap||T instanceof THREE.MeshDepthMaterial)){sa=T&&T.shading!=undefined&&T.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}sa=!1}a:{ya=void 0;T=void 0;Fa=K.length;for(ya=0;ya<Fa;ya++){T=K[ya];if(T.vertexColors){K=T.vertexColors;break a}}K=!1}J.__vertexArray=new Float32Array(A*3);if(sa)J.__normalArray=new Float32Array(A*3);if(Ba.hasTangents)J.__tangentArray=new Float32Array(A*4);if(K)J.__colorArray=new Float32Array(A*
+3);if(V){if(Ba.faceUvs.length>0||Ba.faceVertexUvs.length>0)J.__uvArray=new Float32Array(A*2);if(Ba.faceUvs.length>1||Ba.faceVertexUvs.length>1)J.__uv2Array=new Float32Array(A*2)}if(E.geometry.skinWeights.length&&E.geometry.skinIndices.length){J.__skinVertexAArray=new Float32Array(A*4);J.__skinVertexBArray=new Float32Array(A*4);J.__skinIndexArray=new Float32Array(A*4);J.__skinWeightArray=new Float32Array(A*4)}J.__faceArray=new Uint16Array(ja*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0));
+J.__lineArray=new Uint16Array(pa*2);if(J.numMorphTargets){Ba=void 0;ya=void 0;J.__morphTargetsArrays=[];Ba=0;for(ya=J.numMorphTargets;Ba<ya;Ba++)J.__morphTargetsArrays.push(new Float32Array(A*3))}J.__needsSmoothNormals=sa==THREE.SmoothShading;J.__uvType=V;J.__vertexColorType=K;J.__normalType=sa;J.__webGLFaceCount=ja*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0);J.__webGLLineCount=pa*2;C.__dirtyVertices=!0;C.__dirtyMorphTargets=!0;C.__dirtyElements=!0;C.__dirtyUvs=!0;C.__dirtyNormals=!0;
+C.__dirtyTangents=!0;C.__dirtyColors=!0}t instanceof THREE.ShadowVolume?F(w.__webglShadowVolumes,G,t):F(w.__webglObjects,G,t)}}else if(t instanceof THREE.Ribbon){C=t.geometry;if(!C.__webGLVertexBuffer){o=C;o.__webGLVertexBuffer=d.createBuffer();o.__webGLColorBuffer=d.createBuffer();o=C;G=o.vertices.length;o.__vertexArray=new Float32Array(G*3);o.__colorArray=new Float32Array(G*3);o.__webGLVertexCount=G;C.__dirtyVertices=!0;C.__dirtyColors=!0}F(w.__webglObjects,C,t)}else if(t instanceof THREE.Line){C=
+t.geometry;if(!C.__webGLVertexBuffer){o=C;o.__webGLVertexBuffer=d.createBuffer();o.__webGLColorBuffer=d.createBuffer();o=C;G=o.vertices.length;o.__vertexArray=new Float32Array(G*3);o.__colorArray=new Float32Array(G*3);o.__webGLLineCount=G;C.__dirtyVertices=!0;C.__dirtyColors=!0}F(w.__webglObjects,C,t)}else if(t instanceof THREE.ParticleSystem){C=t.geometry;if(!C.__webGLVertexBuffer){o=C;o.__webGLVertexBuffer=d.createBuffer();o.__webGLColorBuffer=d.createBuffer();o=C;G=o.vertices.length;o.__vertexArray=
+new Float32Array(G*3);o.__colorArray=new Float32Array(G*3);o.__sortArray=[];o.__webGLParticleCount=G;C.__dirtyVertices=!0;C.__dirtyColors=!0}F(w.__webglObjects,C,t)}else THREE.MarchingCubes!==undefined&&t instanceof THREE.MarchingCubes&&w.__webglObjectsImmediate.push({object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}});j.__objectsAdded.splice(0,1)}for(;j.__objectsRemoved.length;){t=j.__objectsRemoved[0];w=j;C=void 0;o=void 0;for(C=w.__webglObjects.length-1;C>=0;C--){o=w.__webglObjects[C].object;
+t==o&&w.__webglObjects.splice(C,1)}j.__objectsRemoved.splice(0,1)}t=0;for(w=j.__webglObjects.length;t<w;t++)H(j.__webglObjects[t].object,j);t=0;for(w=j.__webglShadowVolumes.length;t<w;t++)H(j.__webglShadowVolumes[t].object,j)};this.setFaceCulling=function(j,t){if(j){!t||t=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(j=="back")d.cullFace(d.BACK);else j=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
+0}};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,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var e,f=b.length;for(e=0;e<f;e++){a=b[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
 THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
 THREE.RenderableObject=function(){this.z=this.object=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.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
-var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,e=b?c.geometry:c,g=a.vertices,h=e.vertices,j=a.faces,k=e.faces,m=a.faceVertexUvs[0];e=e.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var t=0,x=h.length;t<x;t++){var z=new THREE.Vertex(h[t].position.clone());b&&c.matrix.multiplyVector3(z.position);g.push(z)}t=0;for(x=k.length;t<x;t++){h=k[t];var y,B,I=h.vertexNormals;z=h.vertexColors;if(h instanceof THREE.Face3)y=new THREE.Face3(h.a+d,h.b+d,h.c+
-d);else h instanceof THREE.Face4&&(y=new THREE.Face4(h.a+d,h.b+d,h.c+d,h.d+d));y.normal.copy(h.normal);b=0;for(g=I.length;b<g;b++){B=I[b];y.vertexNormals.push(B.clone())}y.color.copy(h.color);b=0;for(g=z.length;b<g;b++){B=z[b];y.vertexColors.push(B.clone())}y.materials=h.materials.slice();y.centroid.copy(h.centroid);j.push(y)}t=0;for(x=e.length;t<x;t++){d=e[t];j=[];b=0;for(g=d.length;b<g;b++)j.push(new THREE.UV(d[b].u,d[b].v));m.push(j)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,e=
-new THREE.Texture(d,c);d.onload=function(){e.needsUpdate=!0;b&&b(this)};d.src=a;return e},loadTextureCube:function(a,c,b){var d,e=[],g=new THREE.Texture(e,c);c=e.loadCount=0;for(d=a.length;c<d;++c){e[c]=new Image;e[c].onload=function(){e.loadCount+=1;if(e.loadCount==6)g.needsUpdate=!0;b&&b(this)};e[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,d){var e=new Worker(a);e.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);e.onmessage=function(h){function j(Y,S){return S=="relativeToHTML"?
-Y:g+"/"+Y}function k(){for(y in W.objects)if(!U.objects[y]){L=W.objects[y];if(M=U.geometries[L.geometry]){ea=[];for(fa=0;fa<L.materials.length;fa++)ea[fa]=U.materials[L.materials[fa]];A=L.position;r=L.rotation;q=L.quaternion;s=L.scale;q=0;ea.length==0&&(ea[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(M,ea);object.position.set(A[0],A[1],A[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=
-L.visible;U.scene.addObject(object);U.objects[y]=object}}}function m(Y){return function(S){U.geometries[Y]=S;k();va-=1;t()}}function t(){d({total_models:Ca,total_textures:ja,loaded_models:Ca-va,loaded_textures:ja-wa},U);va==0&&wa==0&&b(U)}var x,z,y,B,I,F,G,L,A,P,R,M,ia,f,ea,W,da,X,va,wa,Ca,ja,U;W=h.data;da=new THREE.BinaryLoader;X=new THREE.JSONLoader;wa=va=0;U={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};h=function(){wa-=1;t()};for(I in W.cameras){P=
-W.cameras[I];if(P.type=="perspective")ia=new THREE.Camera(P.fov,P.aspect,P.near,P.far);else if(P.type=="ortho"){ia=new THREE.Camera;ia.projectionMatrix=THREE.Matrix4.makeOrtho(P.left,P.right,P.top,P.bottom,P.near,P.far)}A=P.position;P=P.target;ia.position.set(A[0],A[1],A[2]);ia.target.position.set(P[0],P[1],P[2]);U.cameras[I]=ia}for(B in W.lights){I=W.lights[B];ia=I.color!==undefined?I.color:16777215;P=I.intensity!==undefined?I.intensity:1;if(I.type=="directional"){A=I.direction;light=new THREE.DirectionalLight(ia,
-P);light.position.set(A[0],A[1],A[2]);light.position.normalize()}else if(I.type=="point"){A=I.position;light=new THREE.PointLight(ia,P);light.position.set(A[0],A[1],A[2])}U.scene.addLight(light);U.lights[B]=light}for(F in W.fogs){B=W.fogs[F];if(B.type=="linear")f=new THREE.Fog(0,B.near,B.far);else B.type=="exp2"&&(f=new THREE.FogExp2(0,B.density));P=B.color;f.color.setRGB(P[0],P[1],P[2]);U.fogs[F]=f}if(U.cameras&&W.defaults.camera)U.currentCamera=U.cameras[W.defaults.camera];if(U.fogs&&W.defaults.fog)U.scene.fog=
-U.fogs[W.defaults.fog];P=W.defaults.bgcolor;U.bgColor=new THREE.Color;U.bgColor.setRGB(P[0],P[1],P[2]);U.bgColorAlpha=W.defaults.bgalpha;for(x in W.geometries){F=W.geometries[x];if(F.type=="bin_mesh"||F.type=="ascii_mesh")va+=1}Ca=va;for(x in W.geometries){F=W.geometries[x];if(F.type=="cube"){M=new Cube(F.width,F.height,F.depth,F.segmentsWidth,F.segmentsHeight,F.segmentsDepth,null,F.flipped,F.sides);U.geometries[x]=M}else if(F.type=="plane"){M=new Plane(F.width,F.height,F.segmentsWidth,F.segmentsHeight);
-U.geometries[x]=M}else if(F.type=="sphere"){M=new Sphere(F.radius,F.segmentsWidth,F.segmentsHeight);U.geometries[x]=M}else if(F.type=="cylinder"){M=new Cylinder(F.numSegs,F.topRad,F.botRad,F.height,F.topOffset,F.botOffset);U.geometries[x]=M}else if(F.type=="torus"){M=new Torus(F.radius,F.tube,F.segmentsR,F.segmentsT);U.geometries[x]=M}else if(F.type=="icosahedron"){M=new Icosahedron(F.subdivisions);U.geometries[x]=M}else if(F.type=="bin_mesh")da.load({model:j(F.url,W.urlBaseType),callback:m(x)});
-else F.type=="ascii_mesh"&&X.load({model:j(F.url,W.urlBaseType),callback:m(x)})}for(G in W.textures){x=W.textures[G];wa+=x.url instanceof Array?x.url.length:1}ja=wa;for(G in W.textures){x=W.textures[G];if(x.mapping!=undefined&&THREE[x.mapping]!=undefined)x.mapping=new THREE[x.mapping];if(x.url instanceof Array){F=[];for(var fa=0;fa<x.url.length;fa++)F[fa]=j(x.url[fa],W.urlBaseType);F=ImageUtils.loadTextureCube(F,x.mapping,h)}else{F=ImageUtils.loadTexture(j(x.url,W.urlBaseType),x.mapping,h);if(THREE[x.minFilter]!=
-undefined)F.minFilter=THREE[x.minFilter];if(THREE[x.magFilter]!=undefined)F.magFilter=THREE[x.magFilter]}U.textures[G]=F}for(z in W.materials){G=W.materials[z];for(R in G.parameters)if(R=="envMap"||R=="map"||R=="lightMap")G.parameters[R]=U.textures[G.parameters[R]];else if(R=="shading")G.parameters[R]=G.parameters[R]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(R=="blending")G.parameters[R]=THREE[G.parameters[R]]?THREE[G.parameters[R]]:THREE.NormalBlending;else R=="combine"&&(G.parameters[R]=
-G.parameters[R]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);G=new THREE[G.type](G.parameters);U.materials[z]=G}k();c(U)}},addMesh:function(a,c,b,d,e,g,h,j,k,m){c=new THREE.Mesh(c,m);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=e;c.position.z=g;c.rotation.x=h;c.rotation.y=j;c.rotation.z=k;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:d.fragmentShader,vertexShader:d.vertexShader,
-uniforms:d.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);return c},addPanoramaCube:function(a,c,b){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));
-c=new THREE.Mesh(new Cube(c,c,c,1,1,d,!0),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var d=c/2;c=new Plane(c,c);var e=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-d,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,d,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,
-c,1,0,d,0,g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,c,1,0,-d,0,-g,0,e,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,d,e=a.children.length;for(d=0;d<e;d++){b=a.children[d];c(b);SceneUtils.traverseHierarchy(b,c)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},
+var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,e=a.vertices.length,f=b?c.geometry:c,g=a.vertices,h=f.vertices,k=a.faces,m=f.faces,n=a.faceVertexUvs[0];f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,x=h.length;p<x;p++){var z=new THREE.Vertex(h[p].position.clone());b&&c.matrix.multiplyVector3(z.position);g.push(z)}p=0;for(x=m.length;p<x;p++){h=m[p];var y,B,H=h.vertexNormals;z=h.vertexColors;if(h instanceof THREE.Face3)y=new THREE.Face3(h.a+e,h.b+e,h.c+
+e);else h instanceof THREE.Face4&&(y=new THREE.Face4(h.a+e,h.b+e,h.c+e,h.d+e));y.normal.copy(h.normal);b=0;for(g=H.length;b<g;b++){B=H[b];y.vertexNormals.push(B.clone())}y.color.copy(h.color);b=0;for(g=z.length;b<g;b++){B=z[b];y.vertexColors.push(B.clone())}y.materials=h.materials.slice();y.centroid.copy(h.centroid);k.push(y)}p=0;for(x=f.length;p<x;p++){e=f[p];k=[];b=0;for(g=e.length;b<g;b++)k.push(new THREE.UV(e[b].u,e[b].v));n.push(k)}}},ImageUtils={loadTexture:function(a,c,b){var e=new Image,f=
+new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;b&&b(this)};e.src=a;return f},loadTextureCube:function(a,c,b){var e,f=[],g=new THREE.Texture(f,c);c=f.loadCount=0;for(e=a.length;c<e;++c){f[c]=new Image;f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;b&&b(this)};f[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,e){var f=new Worker(a);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);f.onmessage=function(h){function k(Z,S){return S=="relativeToHTML"?
+Z:g+"/"+Z}function m(){for(y in X.objects)if(!W.objects[y]){M=X.objects[y];if(P=W.geometries[M.geometry]){d=[];for(ia=0;ia<M.materials.length;ia++)d[ia]=W.materials[M.materials[ia]];D=M.position;r=M.rotation;q=M.quaternion;s=M.scale;q=0;d.length==0&&(d[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(P,d);object.position.set(D[0],D[1],D[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=
+M.visible;W.scene.addObject(object);W.objects[y]=object}}}function n(Z){return function(S){W.geometries[Z]=S;m();ua-=1;p()}}function p(){e({total_models:za,total_textures:ma,loaded_models:za-ua,loaded_textures:ma-va},W);ua==0&&va==0&&b(W)}var x,z,y,B,H,I,F,M,D,Q,R,P,ka,$,d,X,da,Y,ua,va,za,ma,W;X=h.data;da=new THREE.BinaryLoader;Y=new THREE.JSONLoader;va=ua=0;W={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};h=function(){va-=1;p()};for(H in X.cameras){Q=
+X.cameras[H];if(Q.type=="perspective")ka=new THREE.Camera(Q.fov,Q.aspect,Q.near,Q.far);else if(Q.type=="ortho"){ka=new THREE.Camera;ka.projectionMatrix=THREE.Matrix4.makeOrtho(Q.left,Q.right,Q.top,Q.bottom,Q.near,Q.far)}D=Q.position;Q=Q.target;ka.position.set(D[0],D[1],D[2]);ka.target.position.set(Q[0],Q[1],Q[2]);W.cameras[H]=ka}for(B in X.lights){H=X.lights[B];ka=H.color!==undefined?H.color:16777215;Q=H.intensity!==undefined?H.intensity:1;if(H.type=="directional"){D=H.direction;light=new THREE.DirectionalLight(ka,
+Q);light.position.set(D[0],D[1],D[2]);light.position.normalize()}else if(H.type=="point"){D=H.position;light=new THREE.PointLight(ka,Q);light.position.set(D[0],D[1],D[2])}W.scene.addLight(light);W.lights[B]=light}for(I in X.fogs){B=X.fogs[I];if(B.type=="linear")$=new THREE.Fog(0,B.near,B.far);else B.type=="exp2"&&($=new THREE.FogExp2(0,B.density));Q=B.color;$.color.setRGB(Q[0],Q[1],Q[2]);W.fogs[I]=$}if(W.cameras&&X.defaults.camera)W.currentCamera=W.cameras[X.defaults.camera];if(W.fogs&&X.defaults.fog)W.scene.fog=
+W.fogs[X.defaults.fog];Q=X.defaults.bgcolor;W.bgColor=new THREE.Color;W.bgColor.setRGB(Q[0],Q[1],Q[2]);W.bgColorAlpha=X.defaults.bgalpha;for(x in X.geometries){I=X.geometries[x];if(I.type=="bin_mesh"||I.type=="ascii_mesh")ua+=1}za=ua;for(x in X.geometries){I=X.geometries[x];if(I.type=="cube"){P=new Cube(I.width,I.height,I.depth,I.segmentsWidth,I.segmentsHeight,I.segmentsDepth,null,I.flipped,I.sides);W.geometries[x]=P}else if(I.type=="plane"){P=new Plane(I.width,I.height,I.segmentsWidth,I.segmentsHeight);
+W.geometries[x]=P}else if(I.type=="sphere"){P=new Sphere(I.radius,I.segmentsWidth,I.segmentsHeight);W.geometries[x]=P}else if(I.type=="cylinder"){P=new Cylinder(I.numSegs,I.topRad,I.botRad,I.height,I.topOffset,I.botOffset);W.geometries[x]=P}else if(I.type=="torus"){P=new Torus(I.radius,I.tube,I.segmentsR,I.segmentsT);W.geometries[x]=P}else if(I.type=="icosahedron"){P=new Icosahedron(I.subdivisions);W.geometries[x]=P}else if(I.type=="bin_mesh")da.load({model:k(I.url,X.urlBaseType),callback:n(x)});
+else I.type=="ascii_mesh"&&Y.load({model:k(I.url,X.urlBaseType),callback:n(x)})}for(F in X.textures){x=X.textures[F];va+=x.url instanceof Array?x.url.length:1}ma=va;for(F in X.textures){x=X.textures[F];if(x.mapping!=undefined&&THREE[x.mapping]!=undefined)x.mapping=new THREE[x.mapping];if(x.url instanceof Array){I=[];for(var ia=0;ia<x.url.length;ia++)I[ia]=k(x.url[ia],X.urlBaseType);I=ImageUtils.loadTextureCube(I,x.mapping,h)}else{I=ImageUtils.loadTexture(k(x.url,X.urlBaseType),x.mapping,h);if(THREE[x.minFilter]!=
+undefined)I.minFilter=THREE[x.minFilter];if(THREE[x.magFilter]!=undefined)I.magFilter=THREE[x.magFilter]}W.textures[F]=I}for(z in X.materials){F=X.materials[z];for(R in F.parameters)if(R=="envMap"||R=="map"||R=="lightMap")F.parameters[R]=W.textures[F.parameters[R]];else if(R=="shading")F.parameters[R]=F.parameters[R]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(R=="blending")F.parameters[R]=THREE[F.parameters[R]]?THREE[F.parameters[R]]:THREE.NormalBlending;else R=="combine"&&(F.parameters[R]=
+F.parameters[R]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);F=new THREE[F.type](F.parameters);W.materials[z]=F}m();c(W)}},addMesh:function(a,c,b,e,f,g,h,k,m,n){c=new THREE.Mesh(c,n);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=e;c.position.y=f;c.position.z=g;c.rotation.x=h;c.rotation.y=k;c.rotation.z=m;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,b){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,
+uniforms:e.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);return c},addPanoramaCube:function(a,c,b){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));
+c=new THREE.Mesh(new Cube(c,c,c,1,1,e,!0),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var e=c/2;c=new Plane(c,c);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,c,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,
+c,1,0,e,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,c,1,0,-e,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,e,f=a.children.length;for(e=0;e<f;e++){b=a.children[e];c(b);SceneUtils.traverseHierarchy(b,c)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},
 mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
@@ -324,86 +338,85 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,d,e,g=2*Math.ceil(a*3)+1;g>25&&(g=25);e=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-e)*(c-e))/(2*a*a));d+=b[c]}for(c=0;c<g;++c)b[c]/=d;return b}};
-THREE.QuakeCamera=function(a){function c(b,d){return function(){d.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,e,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;b=Array(g);for(c=e=0;c<g;++c){b[c]=Math.exp(-((c-f)*(c-f))/(2*a*a));e+=b[c]}for(c=0;c<g;++c)b[c]/=e;return b}};
+THREE.QuakeCamera=function(a){function c(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
 !1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);
-var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);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;b=this.target.position;var d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
+var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);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;b=this.target.position;var e=this.position;b.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=e.y+100*Math.cos(this.phi);b.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
 !1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
 THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
-THREE.PathCamera=function(a){function c(m,t,x,z){var y={name:x,fps:0.6,length:z,hierarchy:[]},B,I=t.getControlPointsArray(),F=t.getLength(),G=I.length,L=0;B=G-1;t={parent:-1,keys:[]};t.keys[0]={time:0,pos:I[0],rot:[0,0,0,1],scl:[1,1,1]};t.keys[B]={time:z,pos:I[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<G-1;B++){L=z*F.chunks[B]/F.total;t.keys[B]={time:L,pos:I[B]}}y.hierarchy[0]=t;THREE.AnimationHandler.add(y);return new THREE.Animation(m,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(m,t){var x,
-z,y=new THREE.Geometry;for(x=0;x<m.points.length*t;x++){z=x/(m.points.length*t);z=m.getPoint(z);y.vertices[x]=new THREE.Vertex(new THREE.Vector3(z.x,z.y,z.z))}return y}function d(m,t){var x=b(t,10),z=b(t,10),y=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,y);particleObj=new THREE.ParticleSystem(z,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);m.addChild(lineObj);particleObj.scale.set(1,1,1);m.addChild(particleObj);z=new Sphere(1,
-16,8);y=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<t.points.length;i++){x=new THREE.Mesh(z,y);x.position.copy(t.points[i]);x.updateMatrix();m.addChild(x)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
+THREE.PathCamera=function(a){function c(n,p,x,z){var y={name:x,fps:0.6,length:z,hierarchy:[]},B,H=p.getControlPointsArray(),I=p.getLength(),F=H.length,M=0;B=F-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:H[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[B]={time:z,pos:H[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<F-1;B++){M=z*I.chunks[B]/I.total;p.keys[B]={time:M,pos:H[B]}}y.hierarchy[0]=p;THREE.AnimationHandler.add(y);return new THREE.Animation(n,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(n,p){var x,
+z,y=new THREE.Geometry;for(x=0;x<n.points.length*p;x++){z=x/(n.points.length*p);z=n.getPoint(z);y.vertices[x]=new THREE.Vertex(new THREE.Vector3(z.x,z.y,z.z))}return y}function e(n,p){var x=b(p,10),z=b(p,10),y=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,y);particleObj=new THREE.ParticleSystem(z,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);n.addChild(lineObj);particleObj.scale.set(1,1,1);n.addChild(particleObj);z=new Sphere(1,
+16,8);y=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){x=new THREE.Mesh(z,y);x.position.copy(p.points[i]);x.updateMatrix();n.addChild(x)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
-this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var e=Math.PI*2,g=Math.PI/180;this.update=function(m,t,x){var z,y;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;z=this.phi%e;this.phi=z>=0?z:z+e;z=this.verticalAngleMap.srcRange;y=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-z[0])*(y[1]-y[0])/(z[1]-z[0])+y[0];z=this.horizontalAngleMap.srcRange;y=this.horizontalAngleMap.dstRange;this.theta=(this.theta-z[0])*(y[1]-y[0])/(z[1]-z[0])+y[0];z=this.target.position;z.x=100*Math.sin(this.phi)*Math.cos(this.theta);z.y=100*Math.cos(this.phi);z.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,m,t,x)};this.onMouseMove=function(m){this.mouseX=m.clientX-this.windowHalfX;this.mouseY=m.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
-this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),j=new Cube(10,10,20),k=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,a);a=new THREE.Mesh(k,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
-c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(m,t){return function(){t.apply(m,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-var Cube=function(a,c,b,d,e,g,h,j,k){function m(F,G,L,A,P,R,M,ia){var f,ea,W=d||1,da=e||1,X=P/2,va=R/2,wa=t.vertices.length;if(F=="x"&&G=="y"||F=="y"&&G=="x")f="z";else if(F=="x"&&G=="z"||F=="z"&&G=="x"){f="y";da=g||1}else if(F=="z"&&G=="y"||F=="y"&&G=="z"){f="x";W=g||1}var Ca=W+1,ja=da+1;P/=W;var U=R/da;for(ea=0;ea<ja;ea++)for(R=0;R<Ca;R++){var fa=new THREE.Vector3;fa[F]=(R*P-X)*L;fa[G]=(ea*U-va)*A;fa[f]=M;t.vertices.push(new THREE.Vertex(fa))}for(ea=0;ea<da;ea++)for(R=0;R<W;R++){t.faces.push(new THREE.Face4(R+
-Ca*ea+wa,R+Ca*(ea+1)+wa,R+1+Ca*(ea+1)+wa,R+1+Ca*ea+wa,null,null,ia));t.faceVertexUvs[0].push([new THREE.UV(R/W,ea/da),new THREE.UV(R/W,(ea+1)/da),new THREE.UV((R+1)/W,(ea+1)/da),new THREE.UV((R+1)/W,ea/da)])}}THREE.Geometry.call(this);var t=this,x=a/2,z=c/2,y=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(k!=undefined)for(var I in k)this.sides[I]!=
-undefined&&(this.sides[I]=k[I]);this.sides.px&&m("z","y",1*j,-1,b,c,-x,this.materials[0]);this.sides.nx&&m("z","y",-1*j,-1,b,c,x,this.materials[1]);this.sides.py&&m("x","z",1*j,1,a,b,z,this.materials[2]);this.sides.ny&&m("x","z",1*j,-1,a,b,-z,this.materials[3]);this.sides.pz&&m("x","y",1*j,-1,a,c,y,this.materials[4]);this.sides.nz&&m("x","y",-1*j,-1,a,c,-y,this.materials[5]);(function(){for(var F=[],G=[],L=0,A=t.vertices.length;L<A;L++){for(var P=t.vertices[L],R=!1,M=0,ia=F.length;M<ia;M++){var f=
-F[M];if(P.position.x==f.position.x&&P.position.y==f.position.y&&P.position.z==f.position.z){G[L]=M;R=!0;break}}if(!R){G[L]=F.length;F.push(new THREE.Vertex(P.position.clone()))}}L=0;for(A=t.faces.length;L<A;L++){P=t.faces[L];P.a=G[P.a];P.b=G[P.b];P.c=G[P.c];P.d=G[P.d]}t.vertices=F})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,c,b,d,e,g){function h(t,x,z){j.vertices.push(new THREE.Vertex(new THREE.Vector3(t,x,z)))}THREE.Geometry.call(this);var j=this,k=Math.PI,m=d/2;for(d=0;d<a;d++)h(Math.sin(2*k*d/a)*c,Math.cos(2*k*d/a)*c,-m);for(d=0;d<a;d++)h(Math.sin(2*k*d/a)*b,Math.cos(2*k*d/a)*b,m);for(d=0;d<a;d++)j.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));if(b>0){h(0,0,-m-(g||0));for(d=a;d<a+a/2;d++)j.faces.push(new THREE.Face4(2*a,(2*d-2*a)%a,(2*d-2*a+1)%a,(2*d-2*a+2)%a))}if(c>0){h(0,0,m+(e||0));
-for(d=a+a/2;d<2*a;d++)j.faces.push(new THREE.Face4(2*a+1,(2*d-2*a+2)%a+a,(2*d-2*a+1)%a+a,(2*d-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
-var Icosahedron=function(a){function c(x,z,y){var B=Math.sqrt(x*x+z*z+y*y);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(x/B,z/B,y/B)))-1}function b(x,z,y,B){B.faces.push(new THREE.Face3(x,z,y))}function d(x,z){var y=e.vertices[x].position,B=e.vertices[z].position;return c((y.x+B.x)/2,(y.y+B.y)/2,(y.z+B.z)/2)}var e=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
-1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var j in g.faces){var k=d(g.faces[j].a,g.faces[j].b),m=d(g.faces[j].b,g.faces[j].c),t=d(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,k,t,h);b(g.faces[j].b,m,k,h);b(g.faces[j].c,
-t,m,h);b(k,m,t,h)}g.faces=h.faces}e.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var d=[],e=[],g=[],h=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));d[j]=a[j].clone();e[j]=this.vertices.length-1}for(var k=(new THREE.Matrix4).setRotationZ(c),m=0;m<=this.angle+0.0010;m+=c){for(j=0;j<d.length;j++)if(m<this.angle){d[j]=k.multiplyVector3(d[j].clone());this.vertices.push(new THREE.Vertex(d[j]));g[j]=this.vertices.length-1}else g=h;m==0&&(h=e);for(j=
-0;j<e.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],e[j+1],e[j]));this.faceVertexUvs[0].push([new THREE.UV(m/b,j/a.length),new THREE.UV(m/b,(j+1)/a.length),new THREE.UV((m-c)/b,(j+1)/a.length),new THREE.UV((m-c)/b,j/a.length)])}e=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
-var Plane=function(a,c,b,d){THREE.Geometry.call(this);var e,g=a/2,h=c/2;b=b||1;d=d||1;var j=b+1,k=d+1;a/=b;var m=c/d;for(e=0;e<k;e++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(e*m-h),0)));for(e=0;e<d;e++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*e,c+j*(e+1),c+1+j*(e+1),c+1+j*e));this.faceVertexUvs[0].push([new THREE.UV(c/b,e/d),new THREE.UV(c/b,(e+1)/d),new THREE.UV((c+1)/b,(e+1)/d),new THREE.UV((c+1)/b,e/d)])}this.computeCentroids();this.computeFaceNormals()};
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,g=Math.PI/180;this.update=function(n,p,x){var z,y;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*g;this.theta=this.lon*g;z=this.phi%f;this.phi=z>=0?z:z+f;z=this.verticalAngleMap.srcRange;y=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-z[0])*(y[1]-y[0])/(z[1]-z[0])+y[0];z=this.horizontalAngleMap.srcRange;y=this.horizontalAngleMap.dstRange;this.theta=(this.theta-z[0])*(y[1]-y[0])/(z[1]-z[0])+y[0];z=this.target.position;z.x=100*Math.sin(this.phi)*Math.cos(this.theta);z.y=100*Math.cos(this.phi);z.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,n,p,x)};this.onMouseMove=function(n){this.mouseX=n.clientX-this.windowHalfX;this.mouseY=n.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
+this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(m,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
+c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(n,p){return function(){p.apply(n,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
+var Cube=function(a,c,b,e,f,g,h,k,m){function n(I,F,M,D,Q,R,P,ka){var $,d,X=e||1,da=f||1,Y=Q/2,ua=R/2,va=p.vertices.length;if(I=="x"&&F=="y"||I=="y"&&F=="x")$="z";else if(I=="x"&&F=="z"||I=="z"&&F=="x"){$="y";da=g||1}else if(I=="z"&&F=="y"||I=="y"&&F=="z"){$="x";X=g||1}var za=X+1,ma=da+1;Q/=X;var W=R/da;for(d=0;d<ma;d++)for(R=0;R<za;R++){var ia=new THREE.Vector3;ia[I]=(R*Q-Y)*M;ia[F]=(d*W-ua)*D;ia[$]=P;p.vertices.push(new THREE.Vertex(ia))}for(d=0;d<da;d++)for(R=0;R<X;R++){p.faces.push(new THREE.Face4(R+
+za*d+va,R+za*(d+1)+va,R+1+za*(d+1)+va,R+1+za*d+va,null,null,ka));p.faceVertexUvs[0].push([new THREE.UV(R/X,d/da),new THREE.UV(R/X,(d+1)/da),new THREE.UV((R+1)/X,(d+1)/da),new THREE.UV((R+1)/X,d/da)])}}THREE.Geometry.call(this);var p=this,x=a/2,z=c/2,y=b/2;k=k?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var H in m)this.sides[H]!=
+undefined&&(this.sides[H]=m[H]);this.sides.px&&n("z","y",1*k,-1,b,c,-x,this.materials[0]);this.sides.nx&&n("z","y",-1*k,-1,b,c,x,this.materials[1]);this.sides.py&&n("x","z",1*k,1,a,b,z,this.materials[2]);this.sides.ny&&n("x","z",1*k,-1,a,b,-z,this.materials[3]);this.sides.pz&&n("x","y",1*k,-1,a,c,y,this.materials[4]);this.sides.nz&&n("x","y",-1*k,-1,a,c,-y,this.materials[5]);(function(){for(var I=[],F=[],M=0,D=p.vertices.length;M<D;M++){for(var Q=p.vertices[M],R=!1,P=0,ka=I.length;P<ka;P++){var $=
+I[P];if(Q.position.x==$.position.x&&Q.position.y==$.position.y&&Q.position.z==$.position.z){F[M]=P;R=!0;break}}if(!R){F[M]=I.length;I.push(new THREE.Vertex(Q.position.clone()))}}M=0;for(D=p.faces.length;M<D;M++){Q=p.faces[M];Q.a=F[Q.a];Q.b=F[Q.b];Q.c=F[Q.c];Q.d=F[Q.d]}p.vertices=I})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(a,c,b,e,f,g){function h(p,x,z){k.vertices.push(new THREE.Vertex(new THREE.Vector3(p,x,z)))}THREE.Geometry.call(this);var k=this,m=Math.PI,n=e/2;for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*c,Math.cos(2*m*e/a)*c,-n);for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*b,Math.cos(2*m*e/a)*b,n);for(e=0;e<a;e++)k.faces.push(new THREE.Face4(e,e+a,a+(e+1)%a,(e+1)%a));if(b>0){h(0,0,-n-(g||0));for(e=a;e<a+a/2;e++)k.faces.push(new THREE.Face4(2*a,(2*e-2*a)%a,(2*e-2*a+1)%a,(2*e-2*a+2)%a))}if(c>0){h(0,0,n+(f||0));
+for(e=a+a/2;e<2*a;e++)k.faces.push(new THREE.Face4(2*a+1,(2*e-2*a+2)%a+a,(2*e-2*a+1)%a+a,(2*e-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
+var Icosahedron=function(a){function c(x,z,y){var B=Math.sqrt(x*x+z*z+y*y);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(x/B,z/B,y/B)))-1}function b(x,z,y,B){B.faces.push(new THREE.Face3(x,z,y))}function e(x,z){var y=f.vertices[x].position,B=f.vertices[z].position;return c((y.x+B.x)/2,(y.y+B.y)/2,(y.z+B.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
+1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var m=e(g.faces[k].a,g.faces[k].b),n=e(g.faces[k].b,g.faces[k].c),p=e(g.faces[k].c,g.faces[k].a);b(g.faces[k].a,m,p,h);b(g.faces[k].b,n,m,h);b(g.faces[k].c,
+p,n,h);b(m,n,p,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
+function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var e=[],f=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));e[k]=a[k].clone();f[k]=this.vertices.length-1}for(var m=(new THREE.Matrix4).setRotationZ(c),n=0;n<=this.angle+0.0010;n+=c){for(k=0;k<e.length;k++)if(n<this.angle){e[k]=m.multiplyVector3(e[k].clone());this.vertices.push(new THREE.Vertex(e[k]));g[k]=this.vertices.length-1}else g=h;n==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.faceVertexUvs[0].push([new THREE.UV(n/b,k/a.length),new THREE.UV(n/b,(k+1)/a.length),new THREE.UV((n-c)/b,(k+1)/a.length),new THREE.UV((n-c)/b,k/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
+var Plane=function(a,c,b,e){THREE.Geometry.call(this);var f,g=a/2,h=c/2;b=b||1;e=e||1;var k=b+1,m=e+1;a/=b;var n=c/e;for(f=0;f<m;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*n-h),0)));for(f=0;f<e;f++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+k*f,c+k*(f+1),c+1+k*(f+1),c+1+k*f));this.faceVertexUvs[0].push([new THREE.UV(c/b,f/e),new THREE.UV(c/b,(f+1)/e),new THREE.UV((c+1)/b,(f+1)/e),new THREE.UV((c+1)/b,f/e)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,e=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var j=a*Math.cos(d*e),k=a*Math.sin(d*e),m=[],t=0;for(d=0;d<g;d++){var x=2*d/g,z=k*Math.sin(x*e);x=k*Math.cos(x*e);(b==0||b==h)&&d>0||(t=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,j,z)))-1);m.push(t)}c.push(m)}var y,B,I;e=c.length;for(b=0;b<e;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){m=d==g-1;h=c[b][m?0:d+1];j=c[b][m?g-1:d];k=c[b-1][m?g-1:d];m=c[b-1][m?
-0:d+1];z=b/(e-1);y=(b-1)/(e-1);B=(d+1)/g;x=d/g;t=new THREE.UV(1-B,z);z=new THREE.UV(1-x,z);x=new THREE.UV(1-x,y);var F=new THREE.UV(1-B,y);if(b<c.length-1){y=this.vertices[h].position.clone();B=this.vertices[j].position.clone();I=this.vertices[k].position.clone();y.normalize();B.normalize();I.normalize();this.faces.push(new THREE.Face3(h,j,k,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(I.x,I.y,I.z)]));this.faceVertexUvs[0].push([t,z,x])}if(b>1){y=this.vertices[h].position.clone();
-B=this.vertices[k].position.clone();I=this.vertices[m].position.clone();y.normalize();B.normalize();I.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(I.x,I.y,I.z)]));this.faceVertexUvs[0].push([t,x,F])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
-var Torus=function(a,c,b,d){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){d=b/this.segmentsT*2*Math.PI;var e=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(e))*Math.cos(d),(this.radius+this.tube*Math.cos(e))*Math.sin(d),this.tube*Math.sin(e))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
-1;b<=this.segmentsT;++b){d=(this.segmentsT+1)*c+b;e=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,e,g,h));this.faceVertexUvs[0].push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var TorusKnot=function(a,c,b,d,e,g,h){function j(x,z,y,B,I,F){z=y/B*x;y=Math.cos(z);return new THREE.Vector3(I*(2+y)*0.5*Math.cos(x),I*(2+y)*Math.sin(x)*0.5,F*I*Math.sin(z)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=e||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var k=
-a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;e=j(k,h,this.q,this.p,this.radius,this.heightScale);k=j(k+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=k.x-e.x;b.y=k.y-e.y;b.z=k.z-e.z;d.x=k.x+e.x;d.y=k.y+e.y;d.z=k.z+e.z;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();k=this.tube*Math.cos(h);h=this.tube*Math.sin(h);e.x+=k*d.x+h*g.x;e.y+=k*d.y+h*g.y;e.z+=k*d.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(e.x,e.y,e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
-0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;e=this.grid[a][c];b=this.grid[g][c];d=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);k=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var m=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),t=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(e,b,d));this.faceVertexUvs[0].push([h,k,m]);this.faces.push(new THREE.Face3(g,d,b));this.faceVertexUvs[0].push([t,
-m,k])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null};
-THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
-c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function d(j,k){var m=new Image;m.onload=function(){if(!b(this.width)||!b(this.height)){var t=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
-j.image.width=t;j.image.height=x;j.image.getContext("2d").drawImage(this,0,0,t,x)}else j.image=this;j.needsUpdate=!0};m.src=k}var e,g,h;e="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")e="MeshPhongMaterial";else a.shading=="Basic"&&(e="MeshBasicMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;
-d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[e](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
-THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
-THREE.JSONLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(e){THREE.JSONLoader.prototype.createModel(e.data,b,d)};c.postMessage(a)},createModel:function(a,c,b){var d=function(e){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,e);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
-else{var h,j,k,m,t,x,z,y,B,I,F=a.faces;y=a.vertices;var G=a.normals,L=a.colors,A=0;for(h=0;h<a.uvs.length;h++)a.uvs[h].length&&A++;for(h=0;h<A;h++){g.faceUvs[h]=[];g.faceVertexUvs[h]=[]}k=0;for(m=y.length;k<m;){B=new THREE.Vertex;B.position.x=y[k++];B.position.y=y[k++];B.position.z=y[k++];g.vertices.push(B)}k=0;for(m=F.length;k<m;){t=F[k++];x=t&1;h=t&2;z=t&4;j=t&8;y=t&16;B=t&32;I=t&64;t&=128;if(x){x=new THREE.Face4;x.a=F[k++];x.b=F[k++];x.c=F[k++];x.d=F[k++];nVertices=4}else{x=new THREE.Face3;x.a=
-F[k++];x.b=F[k++];x.c=F[k++];nVertices=3}if(h){materialIndex=F[k++];x.materials=g.materials[materialIndex]}if(z)for(h=0;h<A;h++){uvLayer=a.uvs[h];uvIndex=F[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];g.faceUvs[h].push(new THREE.UV(u,v))}if(j)for(h=0;h<A;h++){uvLayer=a.uvs[h];uvs=[];for(j=0;j<nVertices;j++){uvIndex=F[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[j]=new THREE.UV(u,v)}j=g.faces.length;g.faceVertexUvs[h][j]=uvs}if(y){normalIndex=F[k++]*3;normal=new THREE.Vector3;normal.x=
-G[normalIndex++];normal.y=G[normalIndex++];normal.z=G[normalIndex];x.normal=normal}if(B)for(h=0;h<nVertices;h++){normalIndex=F[k++]*3;normal=new THREE.Vector3;normal.x=G[normalIndex++];normal.y=G[normalIndex++];normal.z=G[normalIndex];x.vertexNormals.push(normal)}if(I){color=new THREE.Color(F[k++]);x.color=color}if(t)for(h=0;h<nVertices;h++){colorIndex=F[k++];color=new THREE.Color(L[colorIndex]);x.vertexColors.push(color)}g.faces.push(x)}}})();(function(){var h,j,k,m;if(a.skinWeights){h=0;for(j=a.skinWeights.length;h<
-j;h+=2){k=a.skinWeights[h];m=a.skinWeights[h+1];g.skinWeights.push(new THREE.Vector4(k,m,0,0))}}if(a.skinIndices){h=0;for(j=a.skinIndices.length;h<j;h+=2){k=a.skinIndices[h];m=a.skinIndices[h+1];g.skinIndices.push(new THREE.Vector4(k,m,0,0))}}g.bones=a.bones;g.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var h,j,k,m;h=0;for(j=a.morphTargets.length;h<j;h++){g.morphTargets[h]={};g.morphTargets[h].name=a.morphTargets[h].name;g.morphTargets[h].vertices=[];dstVertices=g.morphTargets[h].vertices;
-srcVertices=a.morphTargets[h].vertices;k=0;for(m=srcVertices.length;k<m;k+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[k],srcVertices[k+1],srcVertices[k+2])))}}})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
-THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),e=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.BinaryLoader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,e,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};
-c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,e,g){var h=new XMLHttpRequest,j=d+"/"+a,k=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,e,c):alert("Couldn't load ["+j+"] ["+h.status+"]");else if(h.readyState==3){if(g){k==0&&(k=h.getResponseHeader("Content-Length"));g({total:k,loaded:h.responseText.length})}}else h.readyState==2&&(k=h.getResponseHeader("Content-Length"))};h.open("GET",j,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
-h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,d){var e=function(g){function h(p,o){var w=t(p,o),E=t(p,o+1),C=t(p,o+2),H=t(p,o+3),aa=(H<<1&255|C>>7)-127;w|=(C&127)<<16|E<<8;if(w==0&&aa==-127)return 0;return(1-2*(H>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,aa)}function j(p,o){var w=t(p,o),E=t(p,o+1),C=t(p,o+2);return(t(p,o+3)<<24)+(C<<16)+(E<<8)+w}function k(p,o){var w=t(p,o);return(t(p,o+1)<<8)+w}function m(p,o){var w=t(p,o);return w>127?w-256:w}function t(p,
-o){return p.charCodeAt(o)&255}function x(p){var o,w,E;o=j(a,p);w=j(a,p+M);E=j(a,p+ia);p=k(a,p+f);THREE.BinaryLoader.prototype.f3(G,o,w,E,p)}function z(p){var o,w,E,C,H,aa;o=j(a,p);w=j(a,p+M);E=j(a,p+ia);C=k(a,p+f);H=j(a,p+ea);aa=j(a,p+W);p=j(a,p+da);THREE.BinaryLoader.prototype.f3n(G,P,o,w,E,C,H,aa,p)}function y(p){var o,w,E,C;o=j(a,p);w=j(a,p+X);E=j(a,p+va);C=j(a,p+wa);p=k(a,p+Ca);THREE.BinaryLoader.prototype.f4(G,o,w,E,C,p)}function B(p){var o,w,E,C,H,aa,Q,K;o=j(a,p);w=j(a,p+X);E=j(a,p+va);C=j(a,
-p+wa);H=k(a,p+Ca);aa=j(a,p+ja);Q=j(a,p+U);K=j(a,p+fa);p=j(a,p+Y);THREE.BinaryLoader.prototype.f4n(G,P,o,w,E,C,H,aa,Q,K,p)}function I(p){var o,w;o=j(a,p);w=j(a,p+S);p=j(a,p+O);THREE.BinaryLoader.prototype.uv3(G.faceVertexUvs[0],R[o*2],R[o*2+1],R[w*2],R[w*2+1],R[p*2],R[p*2+1])}function F(p){var o,w,E;o=j(a,p);w=j(a,p+ga);E=j(a,p+sa);p=j(a,p+ma);THREE.BinaryLoader.prototype.uv4(G.faceVertexUvs[0],R[o*2],R[o*2+1],R[w*2],R[w*2+1],R[E*2],R[E*2+1],R[p*2],R[p*2+1])}var G=this,L=0,A,P=[],R=[],M,ia,f,ea,W,
-da,X,va,wa,Ca,ja,U,fa,Y,S,O,ga,sa,ma,ta,za,Ma,bb,n,D;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(G,d,g);A={signature:a.substr(L,8),header_bytes:t(a,L+8),vertex_coordinate_bytes:t(a,L+9),normal_coordinate_bytes:t(a,L+10),uv_coordinate_bytes:t(a,L+11),vertex_index_bytes:t(a,L+12),normal_index_bytes:t(a,L+13),uv_index_bytes:t(a,L+14),material_index_bytes:t(a,L+15),nvertices:j(a,L+16),nnormals:j(a,L+16+4),nuvs:j(a,L+16+8),ntri_flat:j(a,L+16+12),ntri_smooth:j(a,L+16+16),ntri_flat_uv:j(a,
-L+16+20),ntri_smooth_uv:j(a,L+16+24),nquad_flat:j(a,L+16+28),nquad_smooth:j(a,L+16+32),nquad_flat_uv:j(a,L+16+36),nquad_smooth_uv:j(a,L+16+40)};L+=A.header_bytes;M=A.vertex_index_bytes;ia=A.vertex_index_bytes*2;f=A.vertex_index_bytes*3;ea=A.vertex_index_bytes*3+A.material_index_bytes;W=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes;da=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*2;X=A.vertex_index_bytes;va=A.vertex_index_bytes*2;wa=A.vertex_index_bytes*3;
-Ca=A.vertex_index_bytes*4;ja=A.vertex_index_bytes*4+A.material_index_bytes;U=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes;fa=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*2;Y=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*3;S=A.uv_index_bytes;O=A.uv_index_bytes*2;ga=A.uv_index_bytes;sa=A.uv_index_bytes*2;ma=A.uv_index_bytes*3;g=A.vertex_index_bytes*3+A.material_index_bytes;D=A.vertex_index_bytes*4+A.material_index_bytes;ta=A.ntri_flat*
-g;za=A.ntri_smooth*(g+A.normal_index_bytes*3);Ma=A.ntri_flat_uv*(g+A.uv_index_bytes*3);bb=A.ntri_smooth_uv*(g+A.normal_index_bytes*3+A.uv_index_bytes*3);n=A.nquad_flat*D;g=A.nquad_smooth*(D+A.normal_index_bytes*4);D=A.nquad_flat_uv*(D+A.uv_index_bytes*4);L+=function(p){for(var o,w,E,C=A.vertex_coordinate_bytes*3,H=p+A.nvertices*C;p<H;p+=C){o=h(a,p);w=h(a,p+A.vertex_coordinate_bytes);E=h(a,p+A.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(G,o,w,E)}return A.nvertices*C}(L);L+=function(p){for(var o,
-w,E,C=A.normal_coordinate_bytes*3,H=p+A.nnormals*C;p<H;p+=C){o=m(a,p);w=m(a,p+A.normal_coordinate_bytes);E=m(a,p+A.normal_coordinate_bytes*2);P.push(o/127,w/127,E/127)}return A.nnormals*C}(L);L+=function(p){for(var o,w,E=A.uv_coordinate_bytes*2,C=p+A.nuvs*E;p<C;p+=E){o=h(a,p);w=h(a,p+A.uv_coordinate_bytes);R.push(o,w)}return A.nuvs*E}(L);ta=L+ta;za=ta+za;Ma=za+Ma;bb=Ma+bb;n=bb+n;g=n+g;D=g+D;(function(p){var o,w=A.vertex_index_bytes*3+A.material_index_bytes,E=w+A.uv_index_bytes*3,C=p+A.ntri_flat_uv*
-E;for(o=p;o<C;o+=E){x(o);I(o+w)}return C-p})(za);(function(p){var o,w=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,E=w+A.uv_index_bytes*3,C=p+A.ntri_smooth_uv*E;for(o=p;o<C;o+=E){z(o);I(o+w)}return C-p})(Ma);(function(p){var o,w=A.vertex_index_bytes*4+A.material_index_bytes,E=w+A.uv_index_bytes*4,C=p+A.nquad_flat_uv*E;for(o=p;o<C;o+=E){y(o);F(o+w)}return C-p})(g);(function(p){var o,w=A.vertex_index_bytes*4+A.material_index_bytes+A.normal_index_bytes*4,E=w+A.uv_index_bytes*
-4,C=p+A.nquad_smooth_uv*E;for(o=p;o<C;o+=E){B(o);F(o+w)}return C-p})(D);(function(p){var o,w=A.vertex_index_bytes*3+A.material_index_bytes,E=p+A.ntri_flat*w;for(o=p;o<E;o+=w)x(o);return E-p})(L);(function(p){var o,w=A.vertex_index_bytes*3+A.material_index_bytes+A.normal_index_bytes*3,E=p+A.ntri_smooth*w;for(o=p;o<E;o+=w)z(o);return E-p})(ta);(function(p){var o,w=A.vertex_index_bytes*4+A.material_index_bytes,E=p+A.nquad_flat*w;for(o=p;o<E;o+=w)y(o);return E-p})(bb);(function(p){var o,w=A.vertex_index_bytes*
-4+A.material_index_bytes+A.normal_index_bytes*4,E=p+A.nquad_smooth*w;for(o=p;o<E;o+=w)B(o);return E-p})(n);this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))},v:function(a,c,b,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,d)))},f3:function(a,c,b,d,e){a.faces.push(new THREE.Face3(c,b,d,null,null,a.materials[e]))},f4:function(a,c,b,d,e,g){a.faces.push(new THREE.Face4(c,b,d,e,null,null,a.materials[g]))},f3n:function(a,c,
-b,d,e,g,h,j,k){g=a.materials[g];var m=c[j*3],t=c[j*3+1];j=c[j*3+2];var x=c[k*3],z=c[k*3+1];k=c[k*3+2];a.faces.push(new THREE.Face3(b,d,e,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,t,j),new THREE.Vector3(x,z,k)],null,g))},f4n:function(a,c,b,d,e,g,h,j,k,m,t){h=a.materials[h];var x=c[k*3],z=c[k*3+1];k=c[k*3+2];var y=c[m*3],B=c[m*3+1];m=c[m*3+2];var I=c[t*3],F=c[t*3+1];t=c[t*3+2];a.faces.push(new THREE.Face4(b,d,e,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(x,
-z,k),new THREE.Vector3(y,B,m),new THREE.Vector3(I,F,t)],null,h))},uv3:function(a,c,b,d,e,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(d,e));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,d,e,g,h,j,k){var m=[];m.push(new THREE.UV(c,b));m.push(new THREE.UV(d,e));m.push(new THREE.UV(g,h));m.push(new THREE.UV(j,k));a.push(m)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
+var Sphere=function(a,c,b){THREE.Geometry.call(this);var e,f=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){e=b/h;var k=a*Math.cos(e*f),m=a*Math.sin(e*f),n=[],p=0;for(e=0;e<g;e++){var x=2*e/g,z=m*Math.sin(x*f);x=m*Math.cos(x*f);(b==0||b==h)&&e>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,z)))-1);n.push(p)}c.push(n)}var y,B,H;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(e=0;e<g;e++){n=e==g-1;h=c[b][n?0:e+1];k=c[b][n?g-1:e];m=c[b-1][n?g-1:e];n=c[b-1][n?
+0:e+1];z=b/(f-1);y=(b-1)/(f-1);B=(e+1)/g;x=e/g;p=new THREE.UV(1-B,z);z=new THREE.UV(1-x,z);x=new THREE.UV(1-x,y);var I=new THREE.UV(1-B,y);if(b<c.length-1){y=this.vertices[h].position.clone();B=this.vertices[k].position.clone();H=this.vertices[m].position.clone();y.normalize();B.normalize();H.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(H.x,H.y,H.z)]));this.faceVertexUvs[0].push([p,z,x])}if(b>1){y=this.vertices[h].position.clone();
+B=this.vertices[m].position.clone();H=this.vertices[n].position.clone();y.normalize();B.normalize();H.normalize();this.faces.push(new THREE.Face3(h,m,n,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(H.x,H.y,H.z)]));this.faceVertexUvs[0].push([p,x,I])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Torus=function(a,c,b,e){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){e=b/this.segmentsT*2*Math.PI;var f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
+1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*c+b;f=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(e,f,g,h));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
+var TorusKnot=function(a,c,b,e,f,g,h){function k(x,z,y,B,H,I){z=y/B*x;y=Math.cos(z);return new THREE.Vector3(H*(2+y)*0.5*Math.cos(x),H*(2+y)*Math.sin(x)*0.5,I*H*Math.sin(z)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=e||8;this.p=f||2;this.q=g||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;e=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var m=
+a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;f=k(m,h,this.q,this.p,this.radius,this.heightScale);m=k(m+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=m.x-f.x;b.y=m.y-f.y;b.z=m.z-f.z;e.x=m.x+f.x;e.y=m.y+f.y;e.z=m.z+f.z;g.cross(b,e);e.cross(g,b);g.normalize();e.normalize();m=this.tube*Math.cos(h);h=this.tube*Math.sin(h);f.x+=m*e.x+h*g.x;f.y+=m*e.y+h*g.y;f.z+=m*e.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
+0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;f=this.grid[a][c];b=this.grid[g][c];e=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);m=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(f,b,e));this.faceVertexUvs[0].push([h,m,n]);this.faces.push(new THREE.Face3(g,e,b));this.faceVertexUvs[0].push([p,
+n,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
+this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],b)]},createMaterial:function(a,c){function b(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function e(k,m){var n=new Image;n.onload=function(){if(!b(this.width)||!b(this.height)){var p=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));k.image.width=p;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,p,x)}else k.image=this;k.needsUpdate=!0};n.src=m}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")f="MeshPhongMaterial";else a.shading=="Basic"&&(f="MeshBasicMaterial");if(a.mapDiffuse&&c){h=document.createElement("canvas");g.map=new THREE.Texture(h);g.map.sourceFile=a.mapDiffuse;
+e(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;e(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[f](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
+THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var c=this,b=a.model,e=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(g){c.createModel(g.data,e,f);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var e=new THREE.Geometry;this.init_materials(e,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var f,g,h,k,m,n,p,x,z,y,B=a.faces;x=a.vertices;var H=a.normals,I=a.colors,F=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&F++;for(f=0;f<F;f++){e.faceUvs[f]=[];e.faceVertexUvs[f]=[]}h=0;for(k=x.length;h<k;){z=new THREE.Vertex;z.position.x=x[h++];z.position.y=x[h++];z.position.z=x[h++];e.vertices.push(z)}h=
+0;for(k=B.length;h<k;){m=B[h++];n=m&1;f=m&2;p=m&4;g=m&8;x=m&16;z=m&32;y=m&64;m&=128;if(n){n=new THREE.Face4;n.a=B[h++];n.b=B[h++];n.c=B[h++];n.d=B[h++];nVertices=4}else{n=new THREE.Face3;n.a=B[h++];n.b=B[h++];n.c=B[h++];nVertices=3}if(f){materialIndex=B[h++];n.materials=e.materials[materialIndex]}if(p)for(f=0;f<F;f++){uvLayer=a.uvs[f];uvIndex=B[h++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];e.faceUvs[f].push(new THREE.UV(u,v))}if(g)for(f=0;f<F;f++){uvLayer=a.uvs[f];uvs=[];for(g=0;g<nVertices;g++){uvIndex=
+B[h++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[g]=new THREE.UV(u,v)}g=e.faces.length;e.faceVertexUvs[f][g]=uvs}if(x){normalIndex=B[h++]*3;normal=new THREE.Vector3;normal.x=H[normalIndex++];normal.y=H[normalIndex++];normal.z=H[normalIndex];n.normal=normal}if(z)for(f=0;f<nVertices;f++){normalIndex=B[h++]*3;normal=new THREE.Vector3;normal.x=H[normalIndex++];normal.y=H[normalIndex++];normal.z=H[normalIndex];n.vertexNormals.push(normal)}if(y){color=new THREE.Color(B[h++]);n.color=color}if(m)for(f=
+0;f<nVertices;f++){colorIndex=B[h++];color=new THREE.Color(I[colorIndex]);n.vertexColors.push(color)}e.faces.push(n)}}})();(function(){var f,g,h,k;if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f+=2){h=a.skinWeights[f];k=a.skinWeights[f+1];e.skinWeights.push(new THREE.Vector4(h,k,0,0))}}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f+=2){h=a.skinIndices[f];k=a.skinIndices[f+1];e.skinIndices.push(new THREE.Vector4(h,k,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(){if(a.morphTargets!==
+undefined){var f,g,h,k;f=0;for(g=a.morphTargets.length;f<g;f++){e.morphTargets[f]={};e.morphTargets[f].name=a.morphTargets[f].name;e.morphTargets[f].vertices=[];dstVertices=e.morphTargets[f].vertices;srcVertices=a.morphTargets[f].vertices;h=0;for(k=srcVertices.length;h<k;h+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[h],srcVertices[h+1],srcVertices[h+2])))}}})();e.computeCentroids();e.computeFaceNormals();c(e)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
+THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
+THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.BinaryLoader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,f,e,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};
+c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,f,g){var h=new XMLHttpRequest,k=e+"/"+a,m=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,f,c):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){m==0&&(m=h.getResponseHeader("Content-Length"));g({total:m,loaded:h.responseText.length})}}else h.readyState==2&&(m=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,c,b,e){var f=function(g){function h(j,t){var w=p(j,t),o=p(j,t+1),C=p(j,t+2),G=p(j,t+3),J=(G<<1&255|C>>7)-127;w|=(C&127)<<16|o<<8;if(w==0&&J==-127)return 0;return(1-2*(G>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,J)}function k(j,t){var w=p(j,t),o=p(j,t+1),C=p(j,t+2);return(p(j,t+3)<<24)+(C<<16)+(o<<8)+w}function m(j,t){var w=p(j,t);return(p(j,t+1)<<8)+w}function n(j,t){var w=p(j,t);return w>127?w-256:w}function p(j,
+t){return j.charCodeAt(t)&255}function x(j){var t,w,o;t=k(a,j);w=k(a,j+P);o=k(a,j+ka);j=m(a,j+$);THREE.BinaryLoader.prototype.f3(F,t,w,o,j)}function z(j){var t,w,o,C,G,J;t=k(a,j);w=k(a,j+P);o=k(a,j+ka);C=m(a,j+$);G=k(a,j+d);J=k(a,j+X);j=k(a,j+da);THREE.BinaryLoader.prototype.f3n(F,Q,t,w,o,C,G,J,j)}function y(j){var t,w,o,C;t=k(a,j);w=k(a,j+Y);o=k(a,j+ua);C=k(a,j+va);j=m(a,j+za);THREE.BinaryLoader.prototype.f4(F,t,w,o,C,j)}function B(j){var t,w,o,C,G,J,E,A;t=k(a,j);w=k(a,j+Y);o=k(a,j+ua);C=k(a,j+va);
+G=m(a,j+za);J=k(a,j+ma);E=k(a,j+W);A=k(a,j+ia);j=k(a,j+Z);THREE.BinaryLoader.prototype.f4n(F,Q,t,w,o,C,G,J,E,A,j)}function H(j){var t,w;t=k(a,j);w=k(a,j+S);j=k(a,j+N);THREE.BinaryLoader.prototype.uv3(F.faceVertexUvs[0],R[t*2],R[t*2+1],R[w*2],R[w*2+1],R[j*2],R[j*2+1])}function I(j){var t,w,o;t=k(a,j);w=k(a,j+ha);o=k(a,j+ra);j=k(a,j+na);THREE.BinaryLoader.prototype.uv4(F.faceVertexUvs[0],R[t*2],R[t*2+1],R[w*2],R[w*2+1],R[o*2],R[o*2+1],R[j*2],R[j*2+1])}var F=this,M=0,D,Q=[],R=[],P,ka,$,d,X,da,Y,ua,va,
+za,ma,W,ia,Z,S,N,ha,ra,na,qa,xa,Da,$a,ab,Ia;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(F,e,g);D={signature:a.substr(M,8),header_bytes:p(a,M+8),vertex_coordinate_bytes:p(a,M+9),normal_coordinate_bytes:p(a,M+10),uv_coordinate_bytes:p(a,M+11),vertex_index_bytes:p(a,M+12),normal_index_bytes:p(a,M+13),uv_index_bytes:p(a,M+14),material_index_bytes:p(a,M+15),nvertices:k(a,M+16),nnormals:k(a,M+16+4),nuvs:k(a,M+16+8),ntri_flat:k(a,M+16+12),ntri_smooth:k(a,M+16+16),ntri_flat_uv:k(a,M+16+
+20),ntri_smooth_uv:k(a,M+16+24),nquad_flat:k(a,M+16+28),nquad_smooth:k(a,M+16+32),nquad_flat_uv:k(a,M+16+36),nquad_smooth_uv:k(a,M+16+40)};M+=D.header_bytes;P=D.vertex_index_bytes;ka=D.vertex_index_bytes*2;$=D.vertex_index_bytes*3;d=D.vertex_index_bytes*3+D.material_index_bytes;X=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;da=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;Y=D.vertex_index_bytes;ua=D.vertex_index_bytes*2;va=D.vertex_index_bytes*3;za=D.vertex_index_bytes*
+4;ma=D.vertex_index_bytes*4+D.material_index_bytes;W=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;ia=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;Z=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;S=D.uv_index_bytes;N=D.uv_index_bytes*2;ha=D.uv_index_bytes;ra=D.uv_index_bytes*2;na=D.uv_index_bytes*3;g=D.vertex_index_bytes*3+D.material_index_bytes;Ia=D.vertex_index_bytes*4+D.material_index_bytes;qa=D.ntri_flat*g;xa=D.ntri_smooth*(g+
+D.normal_index_bytes*3);Da=D.ntri_flat_uv*(g+D.uv_index_bytes*3);$a=D.ntri_smooth_uv*(g+D.normal_index_bytes*3+D.uv_index_bytes*3);ab=D.nquad_flat*Ia;g=D.nquad_smooth*(Ia+D.normal_index_bytes*4);Ia=D.nquad_flat_uv*(Ia+D.uv_index_bytes*4);M+=function(j){for(var t,w,o,C=D.vertex_coordinate_bytes*3,G=j+D.nvertices*C;j<G;j+=C){t=h(a,j);w=h(a,j+D.vertex_coordinate_bytes);o=h(a,j+D.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(F,t,w,o)}return D.nvertices*C}(M);M+=function(j){for(var t,w,o,C=
+D.normal_coordinate_bytes*3,G=j+D.nnormals*C;j<G;j+=C){t=n(a,j);w=n(a,j+D.normal_coordinate_bytes);o=n(a,j+D.normal_coordinate_bytes*2);Q.push(t/127,w/127,o/127)}return D.nnormals*C}(M);M+=function(j){for(var t,w,o=D.uv_coordinate_bytes*2,C=j+D.nuvs*o;j<C;j+=o){t=h(a,j);w=h(a,j+D.uv_coordinate_bytes);R.push(t,w)}return D.nuvs*o}(M);qa=M+qa;xa=qa+xa;Da=xa+Da;$a=Da+$a;ab=$a+ab;g=ab+g;Ia=g+Ia;(function(j){var t,w=D.vertex_index_bytes*3+D.material_index_bytes,o=w+D.uv_index_bytes*3,C=j+D.ntri_flat_uv*
+o;for(t=j;t<C;t+=o){x(t);H(t+w)}return C-j})(xa);(function(j){var t,w=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,o=w+D.uv_index_bytes*3,C=j+D.ntri_smooth_uv*o;for(t=j;t<C;t+=o){z(t);H(t+w)}return C-j})(Da);(function(j){var t,w=D.vertex_index_bytes*4+D.material_index_bytes,o=w+D.uv_index_bytes*4,C=j+D.nquad_flat_uv*o;for(t=j;t<C;t+=o){y(t);I(t+w)}return C-j})(g);(function(j){var t,w=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,o=w+D.uv_index_bytes*
+4,C=j+D.nquad_smooth_uv*o;for(t=j;t<C;t+=o){B(t);I(t+w)}return C-j})(Ia);(function(j){var t,w=D.vertex_index_bytes*3+D.material_index_bytes,o=j+D.ntri_flat*w;for(t=j;t<o;t+=w)x(t);return o-j})(M);(function(j){var t,w=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,o=j+D.ntri_smooth*w;for(t=j;t<o;t+=w)z(t);return o-j})(qa);(function(j){var t,w=D.vertex_index_bytes*4+D.material_index_bytes,o=j+D.nquad_flat*w;for(t=j;t<o;t+=w)y(t);return o-j})($a);(function(j){var t,w=D.vertex_index_bytes*
+4+D.material_index_bytes+D.normal_index_bytes*4,o=j+D.nquad_smooth*w;for(t=j;t<o;t+=w)B(t);return o-j})(ab);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))},v:function(a,c,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,e)))},f3:function(a,c,b,e,f){a.faces.push(new THREE.Face3(c,b,e,null,null,a.materials[f]))},f4:function(a,c,b,e,f,g){a.faces.push(new THREE.Face4(c,b,e,f,null,null,a.materials[g]))},f3n:function(a,
+c,b,e,f,g,h,k,m){g=a.materials[g];var n=c[k*3],p=c[k*3+1];k=c[k*3+2];var x=c[m*3],z=c[m*3+1];m=c[m*3+2];a.faces.push(new THREE.Face3(b,e,f,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(n,p,k),new THREE.Vector3(x,z,m)],null,g))},f4n:function(a,c,b,e,f,g,h,k,m,n,p){h=a.materials[h];var x=c[m*3],z=c[m*3+1];m=c[m*3+2];var y=c[n*3],B=c[n*3+1];n=c[n*3+2];var H=c[p*3],I=c[p*3+1];p=c[p*3+2];a.faces.push(new THREE.Face4(b,e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(x,
+z,m),new THREE.Vector3(y,B,n),new THREE.Vector3(H,I,p)],null,h))},uv3:function(a,c,b,e,f,g,h){var k=[];k.push(new THREE.UV(c,b));k.push(new THREE.UV(e,f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,c,b,e,f,g,h,k,m){var n=[];n.push(new THREE.UV(c,b));n.push(new THREE.UV(e,f));n.push(new THREE.UV(g,h));n.push(new THREE.UV(k,m));a.push(n)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
 THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,e){return b+(d-b)*e};this.VIntX=function(b,d,e,g,h,j,k,m,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=j+h*this.delta;d[g+1]=k;d[g+2]=m;e[g]=this.lerp(t[b],t[b+3],h);e[g+1]=this.lerp(t[b+1],t[b+4],h);e[g+2]=this.lerp(t[b+2],t[b+5],h)};this.VIntY=function(b,d,e,g,h,j,k,m,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=j;d[g+1]=k+h*this.delta;d[g+
-2]=m;d=b+this.yd*3;e[g]=this.lerp(t[b],t[d],h);e[g+1]=this.lerp(t[b+1],t[d+1],h);e[g+2]=this.lerp(t[b+2],t[d+2],h)};this.VIntZ=function(b,d,e,g,h,j,k,m,t,x){h=(h-t)/(x-t);t=this.normal_cache;d[g]=j;d[g+1]=k;d[g+2]=m+h*this.delta;d=b+this.zd*3;e[g]=this.lerp(t[b],t[d],h);e[g+1]=this.lerp(t[b+1],t[d+1],h);e[g+2]=this.lerp(t[b+2],t[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,e,g,h,j){var k=g+1,m=g+this.yd,t=g+this.zd,x=k+this.yd,z=k+this.zd,y=g+this.yd+this.zd,B=k+this.yd+this.zd,I=0,F=this.field[g],G=this.field[k],L=this.field[m],A=this.field[x],P=this.field[t],R=this.field[z],M=this.field[y],ia=this.field[B];F<h&&(I|=1);G<h&&(I|=2);L<h&&(I|=8);A<h&&(I|=4);P<h&&(I|=16);R<h&&(I|=32);M<h&&(I|=128);ia<h&&(I|=64);var f=THREE.edgeTable[I];if(f==0)return 0;
-var ea=this.delta,W=b+ea,da=d+ea;ea=e+ea;if(f&1){this.compNorm(g);this.compNorm(k);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,e,F,G)}if(f&2){this.compNorm(k);this.compNorm(x);this.VIntY(k*3,this.vlist,this.nlist,3,h,W,d,e,G,A)}if(f&4){this.compNorm(m);this.compNorm(x);this.VIntX(m*3,this.vlist,this.nlist,6,h,b,da,e,L,A)}if(f&8){this.compNorm(g);this.compNorm(m);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,e,F,L)}if(f&16){this.compNorm(t);this.compNorm(z);this.VIntX(t*3,this.vlist,this.nlist,12,
-h,b,d,ea,P,R)}if(f&32){this.compNorm(z);this.compNorm(B);this.VIntY(z*3,this.vlist,this.nlist,15,h,W,d,ea,R,ia)}if(f&64){this.compNorm(y);this.compNorm(B);this.VIntX(y*3,this.vlist,this.nlist,18,h,b,da,ea,M,ia)}if(f&128){this.compNorm(t);this.compNorm(y);this.VIntY(t*3,this.vlist,this.nlist,21,h,b,d,ea,P,M)}if(f&256){this.compNorm(g);this.compNorm(t);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,e,F,P)}if(f&512){this.compNorm(k);this.compNorm(z);this.VIntZ(k*3,this.vlist,this.nlist,27,h,W,d,e,G,R)}if(f&
-1024){this.compNorm(x);this.compNorm(B);this.VIntZ(x*3,this.vlist,this.nlist,30,h,W,da,e,A,ia)}if(f&2048){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,33,h,b,da,e,L,M)}I<<=4;for(h=g=0;THREE.triTable[I+h]!=-1;){b=I+h;d=b+1;e=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[e],j);h+=3;g++}return g};this.posnormtriv=function(b,d,e,g,h,j){var k=this.count*3;this.positionArray[k]=b[e];this.positionArray[k+1]=b[e+1];this.positionArray[k+
-2]=b[e+2];this.positionArray[k+3]=b[g];this.positionArray[k+4]=b[g+1];this.positionArray[k+5]=b[g+2];this.positionArray[k+6]=b[h];this.positionArray[k+7]=b[h+1];this.positionArray[k+8]=b[h+2];this.normalArray[k]=d[e];this.normalArray[k+1]=d[e+1];this.normalArray[k+2]=d[e+2];this.normalArray[k+3]=d[g];this.normalArray[k+4]=d[g+1];this.normalArray[k+5]=d[g+2];this.normalArray[k+6]=d[h];this.normalArray[k+7]=d[h+1];this.normalArray[k+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=
-this.maxCount-3&&j(this)};this.begin=function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,e,g,h){var j=this.size*Math.sqrt(g/h),k=e*this.size,m=d*this.size,t=b*this.size,x=Math.floor(k-j);x<1&&(x=1);k=Math.floor(k+j);k>this.size-1&&(k=this.size-1);var z=Math.floor(m-j);z<1&&(z=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var y=Math.floor(t-
-j);y<1&&(y=1);j=Math.floor(t+j);j>this.size-1&&(j=this.size-1);for(var B,I,F,G,L,A;x<k;x++){t=this.size2*x;I=x/this.size-e;L=I*I;for(I=z;I<m;I++){F=t+this.size*I;B=I/this.size-d;A=B*B;for(B=y;B<j;B++){G=B/this.size-b;G=g/(1.0E-6+G*G+A+L)-h;G>0&&(this.field[F+B]+=G)}}}};this.addPlaneX=function(b,d){var e,g,h,j,k,m=this.size,t=this.yd,x=this.zd,z=this.field,y=m*Math.sqrt(b/d);y>m&&(y=m);for(e=0;e<y;e++){g=e/m;g*=g;j=b/(1.0E-4+g)-d;if(j>0)for(g=0;g<m;g++){k=e+g*t;for(h=0;h<m;h++)z[x*h+k]+=j}}};this.addPlaneY=
-function(b,d){var e,g,h,j,k,m,t=this.size,x=this.yd,z=this.zd,y=this.field,B=t*Math.sqrt(b/d);B>t&&(B=t);for(g=0;g<B;g++){e=g/t;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=g*x;for(e=0;e<t;e++){m=k+e;for(h=0;h<t;h++)y[z*h+m]+=j}}}};this.addPlaneZ=function(b,d){var e,g,h,j,k,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){e=h/size;e*=e;j=b/(1.0E-4+e)-d;if(j>0){k=zd*h;for(g=0;g<size;g++){m=k+g*yd;for(e=0;e<size;e++)field[m+e]+=j}}}};this.reset=
-function(){var b;for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var d,e,g,h,j,k,m,t,x,z=this.size-2;for(h=1;h<z;h++){x=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(g=1;g<z;g++){t=x+this.size*g;k=(g-this.halfsize)/this.halfsize;for(e=1;e<z;e++){j=(e-this.halfsize)/this.halfsize;d=t+e;this.polygonize(j,k,m,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(e){var g,h,j,
-k,m,t,x,z;for(g=0;g<e.count;g++){m=g*3;x=m+1;z=m+2;h=e.positionArray[m];j=e.positionArray[x];k=e.positionArray[z];t=new THREE.Vector3(h,j,k);h=e.normalArray[m];j=e.normalArray[x];k=e.normalArray[z];m=new THREE.Vector3(h,j,k);m.normalize();m=new THREE.Vertex(t,m);d.vertices.push(m)}nfaces=e.count/3;for(g=0;g<nfaces;g++){m=(b+g)*3;x=m+1;z=m+2;t=d.vertices[m].normal;h=d.vertices[x].normal;j=d.vertices[z].normal;m=new THREE.Face3(m,x,z,[t,h,j]);d.faces.push(m)}b+=nfaces;e.count=0});return d};this.init(a)};
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,f){return b+(e-b)*f};this.VIntX=function(b,e,f,g,h,k,m,n,p,x){h=(h-p)/(x-p);p=this.normal_cache;e[g]=k+h*this.delta;e[g+1]=m;e[g+2]=n;f[g]=this.lerp(p[b],p[b+3],h);f[g+1]=this.lerp(p[b+1],p[b+4],h);f[g+2]=this.lerp(p[b+2],p[b+5],h)};this.VIntY=function(b,e,f,g,h,k,m,n,p,x){h=(h-p)/(x-p);p=this.normal_cache;e[g]=k;e[g+1]=m+h*this.delta;e[g+
+2]=n;e=b+this.yd*3;f[g]=this.lerp(p[b],p[e],h);f[g+1]=this.lerp(p[b+1],p[e+1],h);f[g+2]=this.lerp(p[b+2],p[e+2],h)};this.VIntZ=function(b,e,f,g,h,k,m,n,p,x){h=(h-p)/(x-p);p=this.normal_cache;e[g]=k;e[g+1]=m;e[g+2]=n+h*this.delta;e=b+this.zd*3;f[g]=this.lerp(p[b],p[e],h);f[g+1]=this.lerp(p[b+1],p[e+1],h);f[g+2]=this.lerp(p[b+2],p[e+2],h)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
+this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,f,g,h,k){var m=g+1,n=g+this.yd,p=g+this.zd,x=m+this.yd,z=m+this.zd,y=g+this.yd+this.zd,B=m+this.yd+this.zd,H=0,I=this.field[g],F=this.field[m],M=this.field[n],D=this.field[x],Q=this.field[p],R=this.field[z],P=this.field[y],ka=this.field[B];I<h&&(H|=1);F<h&&(H|=2);M<h&&(H|=8);D<h&&(H|=4);Q<h&&(H|=16);R<h&&(H|=32);P<h&&(H|=128);ka<h&&(H|=64);var $=THREE.edgeTable[H];if($==0)return 0;
+var d=this.delta,X=b+d,da=e+d;d=f+d;if($&1){this.compNorm(g);this.compNorm(m);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,e,f,I,F)}if($&2){this.compNorm(m);this.compNorm(x);this.VIntY(m*3,this.vlist,this.nlist,3,h,X,e,f,F,D)}if($&4){this.compNorm(n);this.compNorm(x);this.VIntX(n*3,this.vlist,this.nlist,6,h,b,da,f,M,D)}if($&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,e,f,I,M)}if($&16){this.compNorm(p);this.compNorm(z);this.VIntX(p*3,this.vlist,this.nlist,12,h,b,e,
+d,Q,R)}if($&32){this.compNorm(z);this.compNorm(B);this.VIntY(z*3,this.vlist,this.nlist,15,h,X,e,d,R,ka)}if($&64){this.compNorm(y);this.compNorm(B);this.VIntX(y*3,this.vlist,this.nlist,18,h,b,da,d,P,ka)}if($&128){this.compNorm(p);this.compNorm(y);this.VIntY(p*3,this.vlist,this.nlist,21,h,b,e,d,Q,P)}if($&256){this.compNorm(g);this.compNorm(p);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,e,f,I,Q)}if($&512){this.compNorm(m);this.compNorm(z);this.VIntZ(m*3,this.vlist,this.nlist,27,h,X,e,f,F,R)}if($&1024){this.compNorm(x);
+this.compNorm(B);this.VIntZ(x*3,this.vlist,this.nlist,30,h,X,da,f,D,ka)}if($&2048){this.compNorm(n);this.compNorm(y);this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,da,f,M,P)}H<<=4;for(h=g=0;THREE.triTable[H+h]!=-1;){b=H+h;e=b+1;f=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(b,e,f,g,h,k){var m=this.count*3;this.positionArray[m]=b[f];this.positionArray[m+1]=b[f+1];this.positionArray[m+2]=b[f+2];this.positionArray[m+
+3]=b[g];this.positionArray[m+4]=b[g+1];this.positionArray[m+5]=b[g+2];this.positionArray[m+6]=b[h];this.positionArray[m+7]=b[h+1];this.positionArray[m+8]=b[h+2];this.normalArray[m]=e[f];this.normalArray[m+1]=e[f+1];this.normalArray[m+2]=e[f+2];this.normalArray[m+3]=e[g];this.normalArray[m+4]=e[g+1];this.normalArray[m+5]=e[g+2];this.normalArray[m+6]=e[h];this.normalArray[m+7]=e[h+1];this.normalArray[m+8]=e[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(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,f,g,h){var k=this.size*Math.sqrt(g/h),m=f*this.size,n=e*this.size,p=b*this.size,x=Math.floor(m-k);x<1&&(x=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var z=Math.floor(n-k);z<1&&(z=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var y=Math.floor(p-k);y<1&&(y=1);k=Math.floor(p+k);
+k>this.size-1&&(k=this.size-1);for(var B,H,I,F,M,D;x<m;x++){p=this.size2*x;H=x/this.size-f;M=H*H;for(H=z;H<n;H++){I=p+this.size*H;B=H/this.size-e;D=B*B;for(B=y;B<k;B++){F=B/this.size-b;F=g/(1.0E-6+F*F+D+M)-h;F>0&&(this.field[I+B]+=F)}}}};this.addPlaneX=function(b,e){var f,g,h,k,m,n=this.size,p=this.yd,x=this.zd,z=this.field,y=n*Math.sqrt(b/e);y>n&&(y=n);for(f=0;f<y;f++){g=f/n;g*=g;k=b/(1.0E-4+g)-e;if(k>0)for(g=0;g<n;g++){m=f+g*p;for(h=0;h<n;h++)z[x*h+m]+=k}}};this.addPlaneY=function(b,e){var f,g,
+h,k,m,n,p=this.size,x=this.yd,z=this.zd,y=this.field,B=p*Math.sqrt(b/e);B>p&&(B=p);for(g=0;g<B;g++){f=g/p;f*=f;k=b/(1.0E-4+f)-e;if(k>0){m=g*x;for(f=0;f<p;f++){n=m+f;for(h=0;h<p;h++)y[z*h+n]+=k}}}};this.addPlaneZ=function(b,e){var f,g,h,k,m,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=b/(1.0E-4+f)-e;if(k>0){m=zd*h;for(g=0;g<size;g++){n=m+g*yd;for(f=0;f<size;f++)field[n+f]+=k}}}};this.reset=function(){var b;
+for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var e,f,g,h,k,m,n,p,x,z=this.size-2;for(h=1;h<z;h++){x=this.size2*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<z;g++){p=x+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<z;f++){k=(f-this.halfsize)/this.halfsize;e=p+f;this.polygonize(k,m,n,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry;this.render(function(f){var g,h,k,m,n,p,x,z;for(g=
+0;g<f.count;g++){n=g*3;x=n+1;z=n+2;h=f.positionArray[n];k=f.positionArray[x];m=f.positionArray[z];p=new THREE.Vector3(h,k,m);h=f.normalArray[n];k=f.normalArray[x];m=f.normalArray[z];n=new THREE.Vector3(h,k,m);n.normalize();n=new THREE.Vertex(p,n);e.vertices.push(n)}nfaces=f.count/3;for(g=0;g<nfaces;g++){n=(b+g)*3;x=n+1;z=n+2;p=e.vertices[n].normal;h=e.vertices[x].normal;k=e.vertices[z].normal;n=new THREE.Face3(n,x,z,[p,h,k]);e.faces.push(n)}b+=nfaces;f.count=0});return e};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,
 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,

+ 85 - 86
build/custom/ThreeExtras.js

@@ -1,19 +1,19 @@
 // ThreeExtras.js r37 - http://github.com/mrdoob/three.js
-var GeometryUtils={merge:function(a,e){var b=e instanceof THREE.Mesh,c=a.vertices.length,h=b?e.geometry:e,f=a.vertices,d=h.vertices,g=a.faces,j=h.faces,l=a.faceVertexUvs[0];h=h.faceVertexUvs[0];b&&e.matrixAutoUpdate&&e.updateMatrix();for(var k=0,m=d.length;k<m;k++){var t=new THREE.Vertex(d[k].position.clone());b&&e.matrix.multiplyVector3(t.position);f.push(t)}k=0;for(m=j.length;k<m;k++){d=j[k];var w,y,z=d.vertexNormals;t=d.vertexColors;if(d instanceof THREE.Face3)w=new THREE.Face3(d.a+c,d.b+c,d.c+
-c);else d instanceof THREE.Face4&&(w=new THREE.Face4(d.a+c,d.b+c,d.c+c,d.d+c));w.normal.copy(d.normal);b=0;for(f=z.length;b<f;b++){y=z[b];w.vertexNormals.push(y.clone())}w.color.copy(d.color);b=0;for(f=t.length;b<f;b++){y=t[b];w.vertexColors.push(y.clone())}w.materials=d.materials.slice();w.centroid.copy(d.centroid);g.push(w)}k=0;for(m=h.length;k<m;k++){c=h[k];g=[];b=0;for(f=c.length;b<f;b++)g.push(new THREE.UV(c[b].u,c[b].v));l.push(g)}}},ImageUtils={loadTexture:function(a,e,b){var c=new Image,h=
-new THREE.Texture(c,e);c.onload=function(){h.needsUpdate=!0;b&&b(this)};c.src=a;return h},loadTextureCube:function(a,e,b){var c,h=[],f=new THREE.Texture(h,e);e=h.loadCount=0;for(c=a.length;e<c;++e){h[e]=new Image;h[e].onload=function(){h.loadCount+=1;if(h.loadCount==6)f.needsUpdate=!0;b&&b(this)};h[e].src=a[e]}return f}},SceneUtils={loadScene:function(a,e,b,c){var h=new Worker(a);h.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);h.onmessage=function(d){function g(X,Y){return Y=="relativeToHTML"?
-X:f+"/"+X}function j(){for(w in G.objects)if(!H.objects[w]){B=G.objects[w];if(L=H.geometries[B.geometry]){J=[];for(O=0;O<B.materials.length;O++)J[O]=H.materials[B.materials[O]];n=B.position;r=B.rotation;q=B.quaternion;s=B.scale;q=0;J.length==0&&(J[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(L,J);object.position.set(n[0],n[1],n[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=
-B.visible;H.scene.addObject(object);H.objects[w]=object}}}function l(X){return function(Y){H.geometries[X]=Y;j();R-=1;k()}}function k(){c({total_models:Q,total_textures:T,loaded_models:Q-R,loaded_textures:T-P},H);R==0&&P==0&&b(H)}var m,t,w,y,z,p,A,B,n,E,D,L,M,K,J,G,N,U,R,P,Q,T,H;G=d.data;N=new THREE.BinaryLoader;U=new THREE.JSONLoader;P=R=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};d=function(){P-=1;k()};for(z in G.cameras){E=G.cameras[z];
-if(E.type=="perspective")M=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho"){M=new THREE.Camera;M.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far)}n=E.position;E=E.target;M.position.set(n[0],n[1],n[2]);M.target.position.set(E[0],E[1],E[2]);H.cameras[z]=M}for(y in G.lights){z=G.lights[y];M=z.color!==undefined?z.color:16777215;E=z.intensity!==undefined?z.intensity:1;if(z.type=="directional"){n=z.direction;light=new THREE.DirectionalLight(M,E);
-light.position.set(n[0],n[1],n[2]);light.position.normalize()}else if(z.type=="point"){n=z.position;light=new THREE.PointLight(M,E);light.position.set(n[0],n[1],n[2])}H.scene.addLight(light);H.lights[y]=light}for(p in G.fogs){y=G.fogs[p];if(y.type=="linear")K=new THREE.Fog(0,y.near,y.far);else y.type=="exp2"&&(K=new THREE.FogExp2(0,y.density));E=y.color;K.color.setRGB(E[0],E[1],E[2]);H.fogs[p]=K}if(H.cameras&&G.defaults.camera)H.currentCamera=H.cameras[G.defaults.camera];if(H.fogs&&G.defaults.fog)H.scene.fog=
-H.fogs[G.defaults.fog];E=G.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(E[0],E[1],E[2]);H.bgColorAlpha=G.defaults.bgalpha;for(m in G.geometries){p=G.geometries[m];if(p.type=="bin_mesh"||p.type=="ascii_mesh")R+=1}Q=R;for(m in G.geometries){p=G.geometries[m];if(p.type=="cube"){L=new Cube(p.width,p.height,p.depth,p.segmentsWidth,p.segmentsHeight,p.segmentsDepth,null,p.flipped,p.sides);H.geometries[m]=L}else if(p.type=="plane"){L=new Plane(p.width,p.height,p.segmentsWidth,p.segmentsHeight);
-H.geometries[m]=L}else if(p.type=="sphere"){L=new Sphere(p.radius,p.segmentsWidth,p.segmentsHeight);H.geometries[m]=L}else if(p.type=="cylinder"){L=new Cylinder(p.numSegs,p.topRad,p.botRad,p.height,p.topOffset,p.botOffset);H.geometries[m]=L}else if(p.type=="torus"){L=new Torus(p.radius,p.tube,p.segmentsR,p.segmentsT);H.geometries[m]=L}else if(p.type=="icosahedron"){L=new Icosahedron(p.subdivisions);H.geometries[m]=L}else if(p.type=="bin_mesh")N.load({model:g(p.url,G.urlBaseType),callback:l(m)});else p.type==
-"ascii_mesh"&&U.load({model:g(p.url,G.urlBaseType),callback:l(m)})}for(A in G.textures){m=G.textures[A];P+=m.url instanceof Array?m.url.length:1}T=P;for(A in G.textures){m=G.textures[A];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){p=[];for(var O=0;O<m.url.length;O++)p[O]=g(m.url[O],G.urlBaseType);p=ImageUtils.loadTextureCube(p,m.mapping,d)}else{p=ImageUtils.loadTexture(g(m.url,G.urlBaseType),m.mapping,d);if(THREE[m.minFilter]!=undefined)p.minFilter=
-THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)p.magFilter=THREE[m.magFilter]}H.textures[A]=p}for(t in G.materials){A=G.materials[t];for(D in A.parameters)if(D=="envMap"||D=="map"||D=="lightMap")A.parameters[D]=H.textures[A.parameters[D]];else if(D=="shading")A.parameters[D]=A.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")A.parameters[D]=THREE[A.parameters[D]]?THREE[A.parameters[D]]:THREE.NormalBlending;else D=="combine"&&(A.parameters[D]=A.parameters[D]==
-"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);H.materials[t]=A}j();e(H)}},addMesh:function(a,e,b,c,h,f,d,g,j,l){e=new THREE.Mesh(e,l);e.scale.x=e.scale.y=e.scale.z=b;e.position.x=c;e.position.y=h;e.position.z=f;e.rotation.x=d;e.rotation.y=g;e.rotation.z=j;a.addObject(e);return e},addPanoramaCubeWebGL:function(a,e,b){var c=ShaderUtils.lib.cube;c.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,
-uniforms:c.uniforms});e=new THREE.Mesh(new Cube(e,e,e,1,1,1,null,!0),b);a.addObject(e);return e},addPanoramaCube:function(a,e,b){var c=[];c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));
-e=new THREE.Mesh(new Cube(e,e,e,1,1,c,!0),new THREE.MeshFaceMaterial);a.addObject(e);return e},addPanoramaCubePlanes:function(a,e,b){var c=e/2;e=new Plane(e,e);var h=Math.PI,f=Math.PI/2;SceneUtils.addMesh(a,e,1,0,0,-c,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,e,1,-c,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,e,1,c,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,
-e,1,0,c,0,f,0,h,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,e,1,0,-c,0,-f,0,h,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,e){SceneUtils.traverseHierarchy(a,function(b){b.visible=e})},traverseHierarchy:function(a,e){var b,c,h=a.children.length;for(c=0;c<h;c++){b=a.children[c];e(b);SceneUtils.traverseHierarchy(b,e)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},
+var GeometryUtils={merge:function(a,g){var b=g instanceof THREE.Mesh,c=a.vertices.length,d=b?g.geometry:g,f=a.vertices,e=d.vertices,h=a.faces,l=d.faces,j=a.faceVertexUvs[0];d=d.faceVertexUvs[0];b&&g.matrixAutoUpdate&&g.updateMatrix();for(var k=0,m=e.length;k<m;k++){var p=new THREE.Vertex(e[k].position.clone());b&&g.matrix.multiplyVector3(p.position);f.push(p)}k=0;for(m=l.length;k<m;k++){e=l[k];var w,t,z=e.vertexNormals;p=e.vertexColors;if(e instanceof THREE.Face3)w=new THREE.Face3(e.a+c,e.b+c,e.c+
+c);else e instanceof THREE.Face4&&(w=new THREE.Face4(e.a+c,e.b+c,e.c+c,e.d+c));w.normal.copy(e.normal);b=0;for(f=z.length;b<f;b++){t=z[b];w.vertexNormals.push(t.clone())}w.color.copy(e.color);b=0;for(f=p.length;b<f;b++){t=p[b];w.vertexColors.push(t.clone())}w.materials=e.materials.slice();w.centroid.copy(e.centroid);h.push(w)}k=0;for(m=d.length;k<m;k++){c=d[k];h=[];b=0;for(f=c.length;b<f;b++)h.push(new THREE.UV(c[b].u,c[b].v));j.push(h)}}},ImageUtils={loadTexture:function(a,g,b){var c=new Image,d=
+new THREE.Texture(c,g);c.onload=function(){d.needsUpdate=!0;b&&b(this)};c.src=a;return d},loadTextureCube:function(a,g,b){var c,d=[],f=new THREE.Texture(d,g);g=d.loadCount=0;for(c=a.length;g<c;++g){d[g]=new Image;d[g].onload=function(){d.loadCount+=1;if(d.loadCount==6)f.needsUpdate=!0;b&&b(this)};d[g].src=a[g]}return f}},SceneUtils={loadScene:function(a,g,b,c){var d=new Worker(a);d.postMessage(0);var f=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(e){function h(X,Y){return Y=="relativeToHTML"?
+X:f+"/"+X}function l(){for(w in G.objects)if(!H.objects[w]){C=G.objects[w];if(L=H.geometries[C.geometry]){J=[];for(O=0;O<C.materials.length;O++)J[O]=H.materials[C.materials[O]];n=C.position;r=C.rotation;q=C.quaternion;s=C.scale;q=0;J.length==0&&(J[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(L,J);object.position.set(n[0],n[1],n[2]);if(q){object.quaternion.set(q[0],q[1],q[2],q[3]);object.useQuaternion=!0}else object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=
+C.visible;H.scene.addObject(object);H.objects[w]=object}}}function j(X){return function(Y){H.geometries[X]=Y;l();R-=1;k()}}function k(){c({total_models:Q,total_textures:T,loaded_models:Q-R,loaded_textures:T-P},H);R==0&&P==0&&b(H)}var m,p,w,t,z,y,A,C,n,E,D,L,M,K,J,G,N,U,R,P,Q,T,H;G=e.data;N=new THREE.BinaryLoader;U=new THREE.JSONLoader;P=R=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};e=function(){P-=1;k()};for(z in G.cameras){E=G.cameras[z];
+if(E.type=="perspective")M=new THREE.Camera(E.fov,E.aspect,E.near,E.far);else if(E.type=="ortho"){M=new THREE.Camera;M.projectionMatrix=THREE.Matrix4.makeOrtho(E.left,E.right,E.top,E.bottom,E.near,E.far)}n=E.position;E=E.target;M.position.set(n[0],n[1],n[2]);M.target.position.set(E[0],E[1],E[2]);H.cameras[z]=M}for(t in G.lights){z=G.lights[t];M=z.color!==undefined?z.color:16777215;E=z.intensity!==undefined?z.intensity:1;if(z.type=="directional"){n=z.direction;light=new THREE.DirectionalLight(M,E);
+light.position.set(n[0],n[1],n[2]);light.position.normalize()}else if(z.type=="point"){n=z.position;light=new THREE.PointLight(M,E);light.position.set(n[0],n[1],n[2])}H.scene.addLight(light);H.lights[t]=light}for(y in G.fogs){t=G.fogs[y];if(t.type=="linear")K=new THREE.Fog(0,t.near,t.far);else t.type=="exp2"&&(K=new THREE.FogExp2(0,t.density));E=t.color;K.color.setRGB(E[0],E[1],E[2]);H.fogs[y]=K}if(H.cameras&&G.defaults.camera)H.currentCamera=H.cameras[G.defaults.camera];if(H.fogs&&G.defaults.fog)H.scene.fog=
+H.fogs[G.defaults.fog];E=G.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(E[0],E[1],E[2]);H.bgColorAlpha=G.defaults.bgalpha;for(m in G.geometries){y=G.geometries[m];if(y.type=="bin_mesh"||y.type=="ascii_mesh")R+=1}Q=R;for(m in G.geometries){y=G.geometries[m];if(y.type=="cube"){L=new Cube(y.width,y.height,y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides);H.geometries[m]=L}else if(y.type=="plane"){L=new Plane(y.width,y.height,y.segmentsWidth,y.segmentsHeight);
+H.geometries[m]=L}else if(y.type=="sphere"){L=new Sphere(y.radius,y.segmentsWidth,y.segmentsHeight);H.geometries[m]=L}else if(y.type=="cylinder"){L=new Cylinder(y.numSegs,y.topRad,y.botRad,y.height,y.topOffset,y.botOffset);H.geometries[m]=L}else if(y.type=="torus"){L=new Torus(y.radius,y.tube,y.segmentsR,y.segmentsT);H.geometries[m]=L}else if(y.type=="icosahedron"){L=new Icosahedron(y.subdivisions);H.geometries[m]=L}else if(y.type=="bin_mesh")N.load({model:h(y.url,G.urlBaseType),callback:j(m)});else y.type==
+"ascii_mesh"&&U.load({model:h(y.url,G.urlBaseType),callback:j(m)})}for(A in G.textures){m=G.textures[A];P+=m.url instanceof Array?m.url.length:1}T=P;for(A in G.textures){m=G.textures[A];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){y=[];for(var O=0;O<m.url.length;O++)y[O]=h(m.url[O],G.urlBaseType);y=ImageUtils.loadTextureCube(y,m.mapping,e)}else{y=ImageUtils.loadTexture(h(m.url,G.urlBaseType),m.mapping,e);if(THREE[m.minFilter]!=undefined)y.minFilter=
+THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)y.magFilter=THREE[m.magFilter]}H.textures[A]=y}for(p in G.materials){A=G.materials[p];for(D in A.parameters)if(D=="envMap"||D=="map"||D=="lightMap")A.parameters[D]=H.textures[A.parameters[D]];else if(D=="shading")A.parameters[D]=A.parameters[D]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(D=="blending")A.parameters[D]=THREE[A.parameters[D]]?THREE[A.parameters[D]]:THREE.NormalBlending;else D=="combine"&&(A.parameters[D]=A.parameters[D]==
+"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);H.materials[p]=A}l();g(H)}},addMesh:function(a,g,b,c,d,f,e,h,l,j){g=new THREE.Mesh(g,j);g.scale.x=g.scale.y=g.scale.z=b;g.position.x=c;g.position.y=d;g.position.z=f;g.rotation.x=e;g.rotation.y=h;g.rotation.z=l;a.addObject(g);return g},addPanoramaCubeWebGL:function(a,g,b){var c=ShaderUtils.lib.cube;c.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,
+uniforms:c.uniforms});g=new THREE.Mesh(new Cube(g,g,g,1,1,1,null,!0),b);a.addObject(g);return g},addPanoramaCube:function(a,g,b){var c=[];c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));c.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));
+g=new THREE.Mesh(new Cube(g,g,g,1,1,c,!0),new THREE.MeshFaceMaterial);a.addObject(g);return g},addPanoramaCubePlanes:function(a,g,b){var c=g/2;g=new Plane(g,g);var d=Math.PI,f=Math.PI/2;SceneUtils.addMesh(a,g,1,0,0,-c,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,g,1,-c,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,g,1,c,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,
+g,1,0,c,0,f,0,d,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,g,1,0,-c,0,-f,0,d,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,g){SceneUtils.traverseHierarchy(a,function(b){b.visible=g})},traverseHierarchy:function(a,g){var b,c,d=a.children.length;for(c=0;c<d;c++){b=a.children[c];g(b);SceneUtils.traverseHierarchy(b,g)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},
 mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
 vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
 normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
@@ -23,86 +23,85 @@ cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec
 value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertexShader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
 film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},nIntensity:{type:"f",value:0.5},sIntensity:{type:"f",value:0.05},sCount:{type:"f",value:4096},grayscale:{type:"i",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nuniform float nIntensity;\nuniform float sIntensity;\nuniform float sCount;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time *  1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;\ncResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor =  vec4( cResult, cTextureScreen.a );\n}"},
 screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
-fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var e,b,c,h,f=2*Math.ceil(a*3)+1;f>25&&(f=25);h=(f-1)*0.5;b=Array(f);for(e=c=0;e<f;++e){b[e]=Math.exp(-((e-h)*(e-h))/(2*a*a));c+=b[e]}for(e=0;e<f;++e)b[e]/=c;return b}};
-THREE.QuakeCamera=function(a){function e(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
+fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var g,b,c,d,f=2*Math.ceil(a*3)+1;f>25&&(f=25);d=(f-1)*0.5;b=Array(f);for(g=c=0;g<f;++g){b[g]=Math.exp(-((g-d)*(g-d))/(2*a*a));c+=b[g]}for(g=0;g<f;++g)b[g]/=c;return b}};
+THREE.QuakeCamera=function(a){function g(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
 a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
 this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
 !1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
 !1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);
 var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);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;b=this.target.position;var c=this.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
-!1);this.domElement.addEventListener("mousemove",e(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",e(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
-THREE.QuakeCamera.prototype.translate=function(a,e){this.matrix.rotateAxis(e);if(this.noFly)e.y=0;this.position.addSelf(e.multiplyScalar(a));this.target.position.addSelf(e.multiplyScalar(a))};
-THREE.PathCamera=function(a){function e(l,k,m,t){var w={name:m,fps:0.6,length:t,hierarchy:[]},y,z=k.getControlPointsArray(),p=k.getLength(),A=z.length,B=0;y=A-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:z[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[y]={time:t,pos:z[y],rot:[0,0,0,1],scl:[1,1,1]};for(y=1;y<A-1;y++){B=t*p.chunks[y]/p.total;k.keys[y]={time:B,pos:z[y]}}w.hierarchy[0]=k;THREE.AnimationHandler.add(w);return new THREE.Animation(l,m,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(l,k){var m,
-t,w=new THREE.Geometry;for(m=0;m<l.points.length*k;m++){t=m/(l.points.length*k);t=l.getPoint(t);w.vertices[m]=new THREE.Vertex(new THREE.Vector3(t.x,t.y,t.z))}return w}function c(l,k){var m=b(k,10),t=b(k,10),w=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(m,w);particleObj=new THREE.ParticleSystem(t,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);l.addChild(lineObj);particleObj.scale.set(1,1,1);l.addChild(particleObj);t=new Sphere(1,
-16,8);w=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){m=new THREE.Mesh(t,w);m.position.copy(k.points[i]);m.updateMatrix();l.addChild(m)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
+!1);this.domElement.addEventListener("mousemove",g(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",g(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",g(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",g(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",g(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
+THREE.QuakeCamera.prototype.translate=function(a,g){this.matrix.rotateAxis(g);if(this.noFly)g.y=0;this.position.addSelf(g.multiplyScalar(a));this.target.position.addSelf(g.multiplyScalar(a))};
+THREE.PathCamera=function(a){function g(j,k,m,p){var w={name:m,fps:0.6,length:p,hierarchy:[]},t,z=k.getControlPointsArray(),y=k.getLength(),A=z.length,C=0;t=A-1;k={parent:-1,keys:[]};k.keys[0]={time:0,pos:z[0],rot:[0,0,0,1],scl:[1,1,1]};k.keys[t]={time:p,pos:z[t],rot:[0,0,0,1],scl:[1,1,1]};for(t=1;t<A-1;t++){C=p*y.chunks[t]/y.total;k.keys[t]={time:C,pos:z[t]}}w.hierarchy[0]=k;THREE.AnimationHandler.add(w);return new THREE.Animation(j,m,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(j,k){var m,
+p,w=new THREE.Geometry;for(m=0;m<j.points.length*k;m++){p=m/(j.points.length*k);p=j.getPoint(p);w.vertices[m]=new THREE.Vertex(new THREE.Vector3(p.x,p.y,p.z))}return w}function c(j,k){var m=b(k,10),p=b(k,10),w=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(m,w);particleObj=new THREE.ParticleSystem(p,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);j.addChild(lineObj);particleObj.scale.set(1,1,1);j.addChild(particleObj);p=new Sphere(1,
+16,8);w=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<k.points.length;i++){m=new THREE.Mesh(p,w);m.position.copy(k.points[i]);m.updateMatrix();j.addChild(m)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
 !0;this.lookHorizontal=!0;this.verticalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(a){if(a.duration!==undefined)this.duration=a.duration*1E3;if(a.waypoints!==undefined)this.waypoints=a.waypoints;if(a.useConstantSpeed!==undefined)this.useConstantSpeed=a.useConstantSpeed;if(a.resamplingCoef!==undefined)this.resamplingCoef=a.resamplingCoef;if(a.createDebugPath!==undefined)this.createDebugPath=a.createDebugPath;
 if(a.createDebugDummy!==undefined)this.createDebugDummy=a.createDebugDummy;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.lookHorizontal!==undefined)this.lookHorizontal=a.lookHorizontal;if(a.verticalAngleMap!==undefined)this.verticalAngleMap=a.verticalAngleMap;if(a.horizontalAngleMap!==undefined)this.horizontalAngleMap=a.horizontalAngleMap;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=
-this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var h=Math.PI*2,f=Math.PI/180;this.update=function(l,k,m){var t,w;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*f;this.theta=this.lon*f;t=this.phi%h;this.phi=t>=0?t:t+h;t=this.verticalAngleMap.srcRange;w=this.verticalAngleMap.dstRange;
-this.phi=(this.phi-t[0])*(w[1]-w[0])/(t[1]-t[0])+w[0];t=this.horizontalAngleMap.srcRange;w=this.horizontalAngleMap.dstRange;this.theta=(this.theta-t[0])*(w[1]-w[0])/(t[1]-t[0])+w[0];t=this.target.position;t.x=100*Math.sin(this.phi)*Math.cos(this.theta);t.y=100*Math.cos(this.phi);t.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,l,k,m)};this.onMouseMove=function(l){this.mouseX=l.clientX-this.windowHalfX;this.mouseY=l.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
-this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var d=new THREE.MeshLambertMaterial({color:65280}),g=new Cube(10,10,20),j=new Cube(2,2,10);this.animationParent=new THREE.Mesh(g,a);a=new THREE.Mesh(j,d);a.position.set(0,10,0);this.animation=e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
-e(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&c(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(l,k){return function(){k.apply(l,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
-var Cube=function(a,e,b,c,h,f,d,g,j){function l(p,A,B,n,E,D,L,M){var K,J,G=c||1,N=h||1,U=E/2,R=D/2,P=k.vertices.length;if(p=="x"&&A=="y"||p=="y"&&A=="x")K="z";else if(p=="x"&&A=="z"||p=="z"&&A=="x"){K="y";N=f||1}else if(p=="z"&&A=="y"||p=="y"&&A=="z"){K="x";G=f||1}var Q=G+1,T=N+1;E/=G;var H=D/N;for(J=0;J<T;J++)for(D=0;D<Q;D++){var O=new THREE.Vector3;O[p]=(D*E-U)*B;O[A]=(J*H-R)*n;O[K]=L;k.vertices.push(new THREE.Vertex(O))}for(J=0;J<N;J++)for(D=0;D<G;D++){k.faces.push(new THREE.Face4(D+Q*J+P,D+Q*
-(J+1)+P,D+1+Q*(J+1)+P,D+1+Q*J+P,null,null,M));k.faceVertexUvs[0].push([new THREE.UV(D/G,J/N),new THREE.UV(D/G,(J+1)/N),new THREE.UV((D+1)/G,(J+1)/N),new THREE.UV((D+1)/G,J/N)])}}THREE.Geometry.call(this);var k=this,m=a/2,t=e/2,w=b/2;g=g?-1:1;if(d!==undefined)if(d instanceof Array)this.materials=d;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([d])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(j!=undefined)for(var z in j)this.sides[z]!=undefined&&(this.sides[z]=
-j[z]);this.sides.px&&l("z","y",1*g,-1,b,e,-m,this.materials[0]);this.sides.nx&&l("z","y",-1*g,-1,b,e,m,this.materials[1]);this.sides.py&&l("x","z",1*g,1,a,b,t,this.materials[2]);this.sides.ny&&l("x","z",1*g,-1,a,b,-t,this.materials[3]);this.sides.pz&&l("x","y",1*g,-1,a,e,w,this.materials[4]);this.sides.nz&&l("x","y",-1*g,-1,a,e,-w,this.materials[5]);(function(){for(var p=[],A=[],B=0,n=k.vertices.length;B<n;B++){for(var E=k.vertices[B],D=!1,L=0,M=p.length;L<M;L++){var K=p[L];if(E.position.x==K.position.x&&
-E.position.y==K.position.y&&E.position.z==K.position.z){A[B]=L;D=!0;break}}if(!D){A[B]=p.length;p.push(new THREE.Vertex(E.position.clone()))}}B=0;for(n=k.faces.length;B<n;B++){E=k.faces[B];E.a=A[E.a];E.b=A[E.b];E.c=A[E.c];E.d=A[E.d]}k.vertices=p})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,e,b,c,h,f){function d(k,m,t){g.vertices.push(new THREE.Vertex(new THREE.Vector3(k,m,t)))}THREE.Geometry.call(this);var g=this,j=Math.PI,l=c/2;for(c=0;c<a;c++)d(Math.sin(2*j*c/a)*e,Math.cos(2*j*c/a)*e,-l);for(c=0;c<a;c++)d(Math.sin(2*j*c/a)*b,Math.cos(2*j*c/a)*b,l);for(c=0;c<a;c++)g.faces.push(new THREE.Face4(c,c+a,a+(c+1)%a,(c+1)%a));if(b>0){d(0,0,-l-(f||0));for(c=a;c<a+a/2;c++)g.faces.push(new THREE.Face4(2*a,(2*c-2*a)%a,(2*c-2*a+1)%a,(2*c-2*a+2)%a))}if(e>0){d(0,0,l+(h||0));
-for(c=a+a/2;c<2*a;c++)g.faces.push(new THREE.Face4(2*a+1,(2*c-2*a+2)%a+a,(2*c-2*a+1)%a+a,(2*c-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
-var Icosahedron=function(a){function e(m,t,w){var y=Math.sqrt(m*m+t*t+w*w);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(m/y,t/y,w/y)))-1}function b(m,t,w,y){y.faces.push(new THREE.Face3(m,t,w))}function c(m,t){var w=h.vertices[m].position,y=h.vertices[t].position;return e((w.x+y.x)/2,(w.y+y.y)/2,(w.z+y.z)/2)}var h=this,f=new THREE.Geometry,d;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;e(-1,a,0);e(1,a,0);e(-1,-a,0);e(1,-a,0);e(0,-1,a);e(0,1,a);e(0,-1,-a);e(0,
-1,-a);e(a,0,-1);e(a,0,1);e(-a,0,-1);e(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(a=0;a<this.subdivisions;a++){d=new THREE.Geometry;for(var g in f.faces){var j=c(f.faces[g].a,f.faces[g].b),l=c(f.faces[g].b,f.faces[g].c),k=c(f.faces[g].c,f.faces[g].a);b(f.faces[g].a,j,k,d);b(f.faces[g].b,l,j,d);b(f.faces[g].c,
-k,l,d);b(j,l,k,d)}f.faces=d.faces}h.faces=f.faces;delete f;delete d;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
-function Lathe(a,e,b){THREE.Geometry.call(this);this.steps=e||12;this.angle=b||2*Math.PI;e=this.angle/this.steps;for(var c=[],h=[],f=[],d=[],g=0;g<a.length;g++){this.vertices.push(new THREE.Vertex(a[g]));c[g]=a[g].clone();h[g]=this.vertices.length-1}for(var j=(new THREE.Matrix4).setRotationZ(e),l=0;l<=this.angle+0.0010;l+=e){for(g=0;g<c.length;g++)if(l<this.angle){c[g]=j.multiplyVector3(c[g].clone());this.vertices.push(new THREE.Vertex(c[g]));f[g]=this.vertices.length-1}else f=d;l==0&&(d=h);for(g=
-0;g<h.length-1;g++){this.faces.push(new THREE.Face4(f[g],f[g+1],h[g+1],h[g]));this.faceVertexUvs[0].push([new THREE.UV(l/b,g/a.length),new THREE.UV(l/b,(g+1)/a.length),new THREE.UV((l-e)/b,(g+1)/a.length),new THREE.UV((l-e)/b,g/a.length)])}h=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
-var Plane=function(a,e,b,c){THREE.Geometry.call(this);var h,f=a/2,d=e/2;b=b||1;c=c||1;var g=b+1,j=c+1;a/=b;var l=e/c;for(h=0;h<j;h++)for(e=0;e<g;e++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(e*a-f,-(h*l-d),0)));for(h=0;h<c;h++)for(e=0;e<b;e++){this.faces.push(new THREE.Face4(e+g*h,e+g*(h+1),e+1+g*(h+1),e+1+g*h));this.faceVertexUvs[0].push([new THREE.UV(e/b,h/c),new THREE.UV(e/b,(h+1)/c),new THREE.UV((e+1)/b,(h+1)/c),new THREE.UV((e+1)/b,h/c)])}this.computeCentroids();this.computeFaceNormals()};
+this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var d=Math.PI*2,f=Math.PI/180;this.update=function(j,k,m){var p,w;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*f;this.theta=this.lon*f;p=this.phi%d;this.phi=p>=0?p:p+d;p=this.verticalAngleMap.srcRange;w=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-p[0])*(w[1]-w[0])/(p[1]-p[0])+w[0];p=this.horizontalAngleMap.srcRange;w=this.horizontalAngleMap.dstRange;this.theta=(this.theta-p[0])*(w[1]-w[0])/(p[1]-p[0])+w[0];p=this.target.position;p.x=100*Math.sin(this.phi)*Math.cos(this.theta);p.y=100*Math.cos(this.phi);p.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,j,k,m)};this.onMouseMove=function(j){this.mouseX=j.clientX-this.windowHalfX;this.mouseY=j.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
+this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var e=new THREE.MeshLambertMaterial({color:65280}),h=new Cube(10,10,20),l=new Cube(2,2,10);this.animationParent=new THREE.Mesh(h,a);a=new THREE.Mesh(l,e);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
+g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&c(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(j,k){return function(){k.apply(j,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
+var Cube=function(a,g,b,c,d,f,e,h,l){function j(y,A,C,n,E,D,L,M){var K,J,G=c||1,N=d||1,U=E/2,R=D/2,P=k.vertices.length;if(y=="x"&&A=="y"||y=="y"&&A=="x")K="z";else if(y=="x"&&A=="z"||y=="z"&&A=="x"){K="y";N=f||1}else if(y=="z"&&A=="y"||y=="y"&&A=="z"){K="x";G=f||1}var Q=G+1,T=N+1;E/=G;var H=D/N;for(J=0;J<T;J++)for(D=0;D<Q;D++){var O=new THREE.Vector3;O[y]=(D*E-U)*C;O[A]=(J*H-R)*n;O[K]=L;k.vertices.push(new THREE.Vertex(O))}for(J=0;J<N;J++)for(D=0;D<G;D++){k.faces.push(new THREE.Face4(D+Q*J+P,D+Q*
+(J+1)+P,D+1+Q*(J+1)+P,D+1+Q*J+P,null,null,M));k.faceVertexUvs[0].push([new THREE.UV(D/G,J/N),new THREE.UV(D/G,(J+1)/N),new THREE.UV((D+1)/G,(J+1)/N),new THREE.UV((D+1)/G,J/N)])}}THREE.Geometry.call(this);var k=this,m=a/2,p=g/2,w=b/2;h=h?-1:1;if(e!==undefined)if(e instanceof Array)this.materials=e;else{this.materials=[];for(var t=0;t<6;t++)this.materials.push([e])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(l!=undefined)for(var z in l)this.sides[z]!=undefined&&(this.sides[z]=
+l[z]);this.sides.px&&j("z","y",1*h,-1,b,g,-m,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,b,g,m,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,b,p,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,b,-p,this.materials[3]);this.sides.pz&&j("x","y",1*h,-1,a,g,w,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,g,-w,this.materials[5]);(function(){for(var y=[],A=[],C=0,n=k.vertices.length;C<n;C++){for(var E=k.vertices[C],D=!1,L=0,M=y.length;L<M;L++){var K=y[L];if(E.position.x==K.position.x&&
+E.position.y==K.position.y&&E.position.z==K.position.z){A[C]=L;D=!0;break}}if(!D){A[C]=y.length;y.push(new THREE.Vertex(E.position.clone()))}}C=0;for(n=k.faces.length;C<n;C++){E=k.faces[C];E.a=A[E.a];E.b=A[E.b];E.c=A[E.c];E.d=A[E.d]}k.vertices=y})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(a,g,b,c,d,f){function e(k,m,p){h.vertices.push(new THREE.Vertex(new THREE.Vector3(k,m,p)))}THREE.Geometry.call(this);var h=this,l=Math.PI,j=c/2;for(c=0;c<a;c++)e(Math.sin(2*l*c/a)*g,Math.cos(2*l*c/a)*g,-j);for(c=0;c<a;c++)e(Math.sin(2*l*c/a)*b,Math.cos(2*l*c/a)*b,j);for(c=0;c<a;c++)h.faces.push(new THREE.Face4(c,c+a,a+(c+1)%a,(c+1)%a));if(b>0){e(0,0,-j-(f||0));for(c=a;c<a+a/2;c++)h.faces.push(new THREE.Face4(2*a,(2*c-2*a)%a,(2*c-2*a+1)%a,(2*c-2*a+2)%a))}if(g>0){e(0,0,j+(d||0));
+for(c=a+a/2;c<2*a;c++)h.faces.push(new THREE.Face4(2*a+1,(2*c-2*a+2)%a+a,(2*c-2*a+1)%a+a,(2*c-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
+var Icosahedron=function(a){function g(m,p,w){var t=Math.sqrt(m*m+p*p+w*w);return d.vertices.push(new THREE.Vertex(new THREE.Vector3(m/t,p/t,w/t)))-1}function b(m,p,w,t){t.faces.push(new THREE.Face3(m,p,w))}function c(m,p){var w=d.vertices[m].position,t=d.vertices[p].position;return g((w.x+t.x)/2,(w.y+t.y)/2,(w.z+t.z)/2)}var d=this,f=new THREE.Geometry,e;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;g(-1,a,0);g(1,a,0);g(-1,-a,0);g(1,-a,0);g(0,-1,a);g(0,1,a);g(0,-1,-a);g(0,
+1,-a);g(a,0,-1);g(a,0,1);g(-a,0,-1);g(-a,0,1);b(0,11,5,f);b(0,5,1,f);b(0,1,7,f);b(0,7,10,f);b(0,10,11,f);b(1,5,9,f);b(5,11,4,f);b(11,10,2,f);b(10,7,6,f);b(7,1,8,f);b(3,9,4,f);b(3,4,2,f);b(3,2,6,f);b(3,6,8,f);b(3,8,9,f);b(4,9,5,f);b(2,4,11,f);b(6,2,10,f);b(8,6,7,f);b(9,8,1,f);for(a=0;a<this.subdivisions;a++){e=new THREE.Geometry;for(var h in f.faces){var l=c(f.faces[h].a,f.faces[h].b),j=c(f.faces[h].b,f.faces[h].c),k=c(f.faces[h].c,f.faces[h].a);b(f.faces[h].a,l,k,e);b(f.faces[h].b,j,l,e);b(f.faces[h].c,
+k,j,e);b(l,j,k,e)}f.faces=e.faces}d.faces=f.faces;delete f;delete e;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
+function Lathe(a,g,b){THREE.Geometry.call(this);this.steps=g||12;this.angle=b||2*Math.PI;g=this.angle/this.steps;for(var c=[],d=[],f=[],e=[],h=0;h<a.length;h++){this.vertices.push(new THREE.Vertex(a[h]));c[h]=a[h].clone();d[h]=this.vertices.length-1}for(var l=(new THREE.Matrix4).setRotationZ(g),j=0;j<=this.angle+0.0010;j+=g){for(h=0;h<c.length;h++)if(j<this.angle){c[h]=l.multiplyVector3(c[h].clone());this.vertices.push(new THREE.Vertex(c[h]));f[h]=this.vertices.length-1}else f=e;j==0&&(e=d);for(h=
+0;h<d.length-1;h++){this.faces.push(new THREE.Face4(f[h],f[h+1],d[h+1],d[h]));this.faceVertexUvs[0].push([new THREE.UV(j/b,h/a.length),new THREE.UV(j/b,(h+1)/a.length),new THREE.UV((j-g)/b,(h+1)/a.length),new THREE.UV((j-g)/b,h/a.length)])}d=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
+var Plane=function(a,g,b,c){THREE.Geometry.call(this);var d,f=a/2,e=g/2;b=b||1;c=c||1;var h=b+1,l=c+1;a/=b;var j=g/c;for(d=0;d<l;d++)for(g=0;g<h;g++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(g*a-f,-(d*j-e),0)));for(d=0;d<c;d++)for(g=0;g<b;g++){this.faces.push(new THREE.Face4(g+h*d,g+h*(d+1),g+1+h*(d+1),g+1+h*d));this.faceVertexUvs[0].push([new THREE.UV(g/b,d/c),new THREE.UV(g/b,(d+1)/c),new THREE.UV((g+1)/b,(d+1)/c),new THREE.UV((g+1)/b,d/c)])}this.computeCentroids();this.computeFaceNormals()};
 Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
-var Sphere=function(a,e,b){THREE.Geometry.call(this);var c,h=Math.PI,f=Math.max(3,e||8),d=Math.max(2,b||6);e=[];for(b=0;b<d+1;b++){c=b/d;var g=a*Math.cos(c*h),j=a*Math.sin(c*h),l=[],k=0;for(c=0;c<f;c++){var m=2*c/f,t=j*Math.sin(m*h);m=j*Math.cos(m*h);(b==0||b==d)&&c>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,g,t)))-1);l.push(k)}e.push(l)}var w,y,z;h=e.length;for(b=0;b<h;b++){f=e[b].length;if(b>0)for(c=0;c<f;c++){l=c==f-1;d=e[b][l?0:c+1];g=e[b][l?f-1:c];j=e[b-1][l?f-1:c];l=e[b-1][l?
-0:c+1];t=b/(h-1);w=(b-1)/(h-1);y=(c+1)/f;m=c/f;k=new THREE.UV(1-y,t);t=new THREE.UV(1-m,t);m=new THREE.UV(1-m,w);var p=new THREE.UV(1-y,w);if(b<e.length-1){w=this.vertices[d].position.clone();y=this.vertices[g].position.clone();z=this.vertices[j].position.clone();w.normalize();y.normalize();z.normalize();this.faces.push(new THREE.Face3(d,g,j,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)]));this.faceVertexUvs[0].push([k,t,m])}if(b>1){w=this.vertices[d].position.clone();
-y=this.vertices[j].position.clone();z=this.vertices[l].position.clone();w.normalize();y.normalize();z.normalize();this.faces.push(new THREE.Face3(d,j,l,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)]));this.faceVertexUvs[0].push([k,m,p])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
-var Torus=function(a,e,b,c){this.radius=a||100;this.tube=e||40;this.segmentsR=b||8;this.segmentsT=c||6;a=[];THREE.Geometry.call(this);for(e=0;e<=this.segmentsR;++e)for(b=0;b<=this.segmentsT;++b){c=b/this.segmentsT*2*Math.PI;var h=e/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(h))*Math.cos(c),(this.radius+this.tube*Math.cos(h))*Math.sin(c),this.tube*Math.sin(h))));a.push([b/this.segmentsT,1-e/this.segmentsR])}for(e=1;e<=this.segmentsR;++e)for(b=
-1;b<=this.segmentsT;++b){c=(this.segmentsT+1)*e+b;h=(this.segmentsT+1)*e+b-1;var f=(this.segmentsT+1)*(e-1)+b-1,d=(this.segmentsT+1)*(e-1)+b;this.faces.push(new THREE.Face4(c,h,f,d));this.faceVertexUvs[0].push([new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[h][0],a[h][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[d][0],a[d][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
-var TorusKnot=function(a,e,b,c,h,f,d){function g(m,t,w,y,z,p){t=w/y*m;w=Math.cos(t);return new THREE.Vector3(z*(2+w)*0.5*Math.cos(m),z*(2+w)*Math.sin(m)*0.5,p*z*Math.sin(t)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=e||40;this.segmentsR=b||64;this.segmentsT=c||8;this.p=h||2;this.q=f||3;this.heightScale=d||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;c=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(e=0;e<this.segmentsT;++e){var j=
-a/this.segmentsR*2*this.p*Math.PI;d=e/this.segmentsT*2*Math.PI;h=g(j,d,this.q,this.p,this.radius,this.heightScale);j=g(j+0.01,d,this.q,this.p,this.radius,this.heightScale);b.x=j.x-h.x;b.y=j.y-h.y;b.z=j.z-h.z;c.x=j.x+h.x;c.y=j.y+h.y;c.z=j.z+h.z;f.cross(b,c);c.cross(f,b);f.normalize();c.normalize();j=this.tube*Math.cos(d);d=this.tube*Math.sin(d);h.x+=j*c.x+d*f.x;h.y+=j*c.y+d*f.y;h.z+=j*c.z+d*f.z;this.grid[a][e]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(h.x,h.y,h.z)))-1}}for(a=0;a<this.segmentsR;++a)for(e=
-0;e<this.segmentsT;++e){f=(a+1)%this.segmentsR;d=(e+1)%this.segmentsT;h=this.grid[a][e];b=this.grid[f][e];c=this.grid[a][d];f=this.grid[f][d];d=new THREE.UV(a/this.segmentsR,e/this.segmentsT);j=new THREE.UV((a+1)/this.segmentsR,e/this.segmentsT);var l=new THREE.UV(a/this.segmentsR,(e+1)/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(e+1)/this.segmentsT);this.faces.push(new THREE.Face3(h,b,c));this.faceVertexUvs[0].push([d,j,l]);this.faces.push(new THREE.Face3(f,c,b));this.faceVertexUvs[0].push([k,
-l,j])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null};
-THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var e="Loaded ";e+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
-e},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,e,b){a.materials=[];for(var c=0;c<e.length;++c)a.materials[c]=[THREE.Loader.prototype.createMaterial(e[c],b)]},createMaterial:function(a,e){function b(g){g=Math.log(g)/Math.LN2;return Math.floor(g)==g}function c(g,j){var l=new Image;l.onload=function(){if(!b(this.width)||!b(this.height)){var k=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),m=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
-g.image.width=k;g.image.height=m;g.image.getContext("2d").drawImage(this,0,0,k,m)}else g.image=this;g.needsUpdate=!0};l.src=j}var h,f,d;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")h="MeshPhongMaterial";else a.shading=="Basic"&&(h="MeshBasicMaterial");if(a.mapDiffuse&&e){d=document.createElement("canvas");f.map=new THREE.Texture(d);f.map.sourceFile=a.mapDiffuse;
-c(f.map,e+"/"+a.mapDiffuse)}else if(a.colorDiffuse){d=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;f.color=d;f.opacity=a.transparency}else if(a.DbgColor)f.color=a.DbgColor;if(a.mapLightmap&&e){d=document.createElement("canvas");f.lightMap=new THREE.Texture(d);f.lightMap.sourceFile=a.mapLightmap;c(f.lightMap,e+"/"+a.mapLightmap)}return new THREE[h](f)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
-THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
-THREE.JSONLoader.prototype={load:function(a){var e=a.model,b=a.callback,c=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(e);a=(new Date).getTime();e=new Worker(e);e.onmessage=function(h){THREE.JSONLoader.prototype.createModel(h.data,b,c)};e.postMessage(a)},createModel:function(a,e,b){var c=function(h){var f=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(f,a.materials,h);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
-else{var d,g,j,l,k,m,t,w,y,z,p=a.faces;w=a.vertices;var A=a.normals,B=a.colors,n=0;for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&n++;for(d=0;d<n;d++){f.faceUvs[d]=[];f.faceVertexUvs[d]=[]}j=0;for(l=w.length;j<l;){y=new THREE.Vertex;y.position.x=w[j++];y.position.y=w[j++];y.position.z=w[j++];f.vertices.push(y)}j=0;for(l=p.length;j<l;){k=p[j++];m=k&1;d=k&2;t=k&4;g=k&8;w=k&16;y=k&32;z=k&64;k&=128;if(m){m=new THREE.Face4;m.a=p[j++];m.b=p[j++];m.c=p[j++];m.d=p[j++];nVertices=4}else{m=new THREE.Face3;m.a=
-p[j++];m.b=p[j++];m.c=p[j++];nVertices=3}if(d){materialIndex=p[j++];m.materials=f.materials[materialIndex]}if(t)for(d=0;d<n;d++){uvLayer=a.uvs[d];uvIndex=p[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];f.faceUvs[d].push(new THREE.UV(u,v))}if(g)for(d=0;d<n;d++){uvLayer=a.uvs[d];uvs=[];for(g=0;g<nVertices;g++){uvIndex=p[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[g]=new THREE.UV(u,v)}g=f.faces.length;f.faceVertexUvs[d][g]=uvs}if(w){normalIndex=p[j++]*3;normal=new THREE.Vector3;normal.x=
-A[normalIndex++];normal.y=A[normalIndex++];normal.z=A[normalIndex];m.normal=normal}if(y)for(d=0;d<nVertices;d++){normalIndex=p[j++]*3;normal=new THREE.Vector3;normal.x=A[normalIndex++];normal.y=A[normalIndex++];normal.z=A[normalIndex];m.vertexNormals.push(normal)}if(z){color=new THREE.Color(p[j++]);m.color=color}if(k)for(d=0;d<nVertices;d++){colorIndex=p[j++];color=new THREE.Color(B[colorIndex]);m.vertexColors.push(color)}f.faces.push(m)}}})();(function(){var d,g,j,l;if(a.skinWeights){d=0;for(g=a.skinWeights.length;d<
-g;d+=2){j=a.skinWeights[d];l=a.skinWeights[d+1];f.skinWeights.push(new THREE.Vector4(j,l,0,0))}}if(a.skinIndices){d=0;for(g=a.skinIndices.length;d<g;d+=2){j=a.skinIndices[d];l=a.skinIndices[d+1];f.skinIndices.push(new THREE.Vector4(j,l,0,0))}}f.bones=a.bones;f.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var d,g,j,l;d=0;for(g=a.morphTargets.length;d<g;d++){f.morphTargets[d]={};f.morphTargets[d].name=a.morphTargets[d].name;f.morphTargets[d].vertices=[];dstVertices=f.morphTargets[d].vertices;
-srcVertices=a.morphTargets[d].vertices;j=0;for(l=srcVertices.length;j<l;j+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[j],srcVertices[j+1],srcVertices[j+2])))}}})();this.computeCentroids();this.computeFaceNormals()};c.prototype=new THREE.Geometry;c.prototype.constructor=c;e(new c(b))}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
-THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
-THREE.BinaryLoader.prototype={load:function(a){var e=a.model,b=a.callback,c=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(e),h=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(e);a=(new Date).getTime();e=new Worker(e);var f=this.showProgress?THREE.Loader.prototype.updateProgress:null;e.onmessage=function(d){THREE.BinaryLoader.prototype.loadAjaxBuffers(d.data.buffers,d.data.materials,b,h,c,f)};e.onerror=function(d){alert("worker.onerror: "+d.message+"\n"+d.data);d.preventDefault()};
-e.postMessage(a)},loadAjaxBuffers:function(a,e,b,c,h,f){var d=new XMLHttpRequest,g=c+"/"+a,j=0;d.onreadystatechange=function(){if(d.readyState==4)d.status==200||d.status==0?THREE.BinaryLoader.prototype.createBinModel(d.responseText,b,h,e):alert("Couldn't load ["+g+"] ["+d.status+"]");else if(d.readyState==3){if(f){j==0&&(j=d.getResponseHeader("Content-Length"));f({total:j,loaded:d.responseText.length})}}else d.readyState==2&&(j=d.getResponseHeader("Content-Length"))};d.open("GET",g,!0);d.overrideMimeType("text/plain; charset=x-user-defined");
-d.setRequestHeader("Content-Type","text/plain");d.send(null)},createBinModel:function(a,e,b,c){var h=function(f){function d(o,x){var C=k(o,x),F=k(o,x+1),I=k(o,x+2),S=k(o,x+3),V=(S<<1&255|I>>7)-127;C|=(I&127)<<16|F<<8;if(C==0&&V==-127)return 0;return(1-2*(S>>7))*(1+C*Math.pow(2,-23))*Math.pow(2,V)}function g(o,x){var C=k(o,x),F=k(o,x+1),I=k(o,x+2);return(k(o,x+3)<<24)+(I<<16)+(F<<8)+C}function j(o,x){var C=k(o,x);return(k(o,x+1)<<8)+C}function l(o,x){var C=k(o,x);return C>127?C-256:C}function k(o,
-x){return o.charCodeAt(x)&255}function m(o){var x,C,F;x=g(a,o);C=g(a,o+L);F=g(a,o+M);o=j(a,o+K);THREE.BinaryLoader.prototype.f3(A,x,C,F,o)}function t(o){var x,C,F,I,S,V;x=g(a,o);C=g(a,o+L);F=g(a,o+M);I=j(a,o+K);S=g(a,o+J);V=g(a,o+G);o=g(a,o+N);THREE.BinaryLoader.prototype.f3n(A,E,x,C,F,I,S,V,o)}function w(o){var x,C,F,I;x=g(a,o);C=g(a,o+U);F=g(a,o+R);I=g(a,o+P);o=j(a,o+Q);THREE.BinaryLoader.prototype.f4(A,x,C,F,I,o)}function y(o){var x,C,F,I,S,V,da,ea;x=g(a,o);C=g(a,o+U);F=g(a,o+R);I=g(a,o+P);S=j(a,
-o+Q);V=g(a,o+T);da=g(a,o+H);ea=g(a,o+O);o=g(a,o+X);THREE.BinaryLoader.prototype.f4n(A,E,x,C,F,I,S,V,da,ea,o)}function z(o){var x,C;x=g(a,o);C=g(a,o+Y);o=g(a,o+fa);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],D[x*2],D[x*2+1],D[C*2],D[C*2+1],D[o*2],D[o*2+1])}function p(o){var x,C,F;x=g(a,o);C=g(a,o+ga);F=g(a,o+ha);o=g(a,o+ia);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],D[x*2],D[x*2+1],D[C*2],D[C*2+1],D[F*2],D[F*2+1],D[o*2],D[o*2+1])}var A=this,B=0,n,E=[],D=[],L,M,K,J,G,N,U,R,P,Q,T,H,
-O,X,Y,fa,ga,ha,ia,Z,$,aa,ba,ca,W;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,c,f);n={signature:a.substr(B,8),header_bytes:k(a,B+8),vertex_coordinate_bytes:k(a,B+9),normal_coordinate_bytes:k(a,B+10),uv_coordinate_bytes:k(a,B+11),vertex_index_bytes:k(a,B+12),normal_index_bytes:k(a,B+13),uv_index_bytes:k(a,B+14),material_index_bytes:k(a,B+15),nvertices:g(a,B+16),nnormals:g(a,B+16+4),nuvs:g(a,B+16+8),ntri_flat:g(a,B+16+12),ntri_smooth:g(a,B+16+16),ntri_flat_uv:g(a,B+16+20),ntri_smooth_uv:g(a,
-B+16+24),nquad_flat:g(a,B+16+28),nquad_smooth:g(a,B+16+32),nquad_flat_uv:g(a,B+16+36),nquad_smooth_uv:g(a,B+16+40)};B+=n.header_bytes;L=n.vertex_index_bytes;M=n.vertex_index_bytes*2;K=n.vertex_index_bytes*3;J=n.vertex_index_bytes*3+n.material_index_bytes;G=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;N=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;U=n.vertex_index_bytes;R=n.vertex_index_bytes*2;P=n.vertex_index_bytes*3;Q=n.vertex_index_bytes*4;T=n.vertex_index_bytes*
+var Sphere=function(a,g,b){THREE.Geometry.call(this);var c,d=Math.PI,f=Math.max(3,g||8),e=Math.max(2,b||6);g=[];for(b=0;b<e+1;b++){c=b/e;var h=a*Math.cos(c*d),l=a*Math.sin(c*d),j=[],k=0;for(c=0;c<f;c++){var m=2*c/f,p=l*Math.sin(m*d);m=l*Math.cos(m*d);(b==0||b==e)&&c>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,p)))-1);j.push(k)}g.push(j)}var w,t,z;d=g.length;for(b=0;b<d;b++){f=g[b].length;if(b>0)for(c=0;c<f;c++){j=c==f-1;e=g[b][j?0:c+1];h=g[b][j?f-1:c];l=g[b-1][j?f-1:c];j=g[b-1][j?
+0:c+1];p=b/(d-1);w=(b-1)/(d-1);t=(c+1)/f;m=c/f;k=new THREE.UV(1-t,p);p=new THREE.UV(1-m,p);m=new THREE.UV(1-m,w);var y=new THREE.UV(1-t,w);if(b<g.length-1){w=this.vertices[e].position.clone();t=this.vertices[h].position.clone();z=this.vertices[l].position.clone();w.normalize();t.normalize();z.normalize();this.faces.push(new THREE.Face3(e,h,l,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z)]));this.faceVertexUvs[0].push([k,p,m])}if(b>1){w=this.vertices[e].position.clone();
+t=this.vertices[l].position.clone();z=this.vertices[j].position.clone();w.normalize();t.normalize();z.normalize();this.faces.push(new THREE.Face3(e,l,j,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(z.x,z.y,z.z)]));this.faceVertexUvs[0].push([k,m,y])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
+var Torus=function(a,g,b,c){this.radius=a||100;this.tube=g||40;this.segmentsR=b||8;this.segmentsT=c||6;a=[];THREE.Geometry.call(this);for(g=0;g<=this.segmentsR;++g)for(b=0;b<=this.segmentsT;++b){c=b/this.segmentsT*2*Math.PI;var d=g/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(d))*Math.cos(c),(this.radius+this.tube*Math.cos(d))*Math.sin(c),this.tube*Math.sin(d))));a.push([b/this.segmentsT,1-g/this.segmentsR])}for(g=1;g<=this.segmentsR;++g)for(b=
+1;b<=this.segmentsT;++b){c=(this.segmentsT+1)*g+b;d=(this.segmentsT+1)*g+b-1;var f=(this.segmentsT+1)*(g-1)+b-1,e=(this.segmentsT+1)*(g-1)+b;this.faces.push(new THREE.Face4(c,d,f,e));this.faceVertexUvs[0].push([new THREE.UV(a[c][0],a[c][1]),new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[e][0],a[e][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
+var TorusKnot=function(a,g,b,c,d,f,e){function h(m,p,w,t,z,y){p=w/t*m;w=Math.cos(p);return new THREE.Vector3(z*(2+w)*0.5*Math.cos(m),z*(2+w)*Math.sin(m)*0.5,y*z*Math.sin(p)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=g||40;this.segmentsR=b||64;this.segmentsT=c||8;this.p=d||2;this.q=f||3;this.heightScale=e||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;c=new THREE.Vector3;f=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(g=0;g<this.segmentsT;++g){var l=
+a/this.segmentsR*2*this.p*Math.PI;e=g/this.segmentsT*2*Math.PI;d=h(l,e,this.q,this.p,this.radius,this.heightScale);l=h(l+0.01,e,this.q,this.p,this.radius,this.heightScale);b.x=l.x-d.x;b.y=l.y-d.y;b.z=l.z-d.z;c.x=l.x+d.x;c.y=l.y+d.y;c.z=l.z+d.z;f.cross(b,c);c.cross(f,b);f.normalize();c.normalize();l=this.tube*Math.cos(e);e=this.tube*Math.sin(e);d.x+=l*c.x+e*f.x;d.y+=l*c.y+e*f.y;d.z+=l*c.z+e*f.z;this.grid[a][g]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z)))-1}}for(a=0;a<this.segmentsR;++a)for(g=
+0;g<this.segmentsT;++g){f=(a+1)%this.segmentsR;e=(g+1)%this.segmentsT;d=this.grid[a][g];b=this.grid[f][g];c=this.grid[a][e];f=this.grid[f][e];e=new THREE.UV(a/this.segmentsR,g/this.segmentsT);l=new THREE.UV((a+1)/this.segmentsR,g/this.segmentsT);var j=new THREE.UV(a/this.segmentsR,(g+1)/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(g+1)/this.segmentsT);this.faces.push(new THREE.Face3(d,b,c));this.faceVertexUvs[0].push([e,l,j]);this.faces.push(new THREE.Face3(f,c,b));this.faceVertexUvs[0].push([k,
+j,l])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
+THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var g="Loaded ";g+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";
+this.statusDomElement.innerHTML=g},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,g,b){a.materials=[];for(var c=0;c<g.length;++c)a.materials[c]=[THREE.Loader.prototype.createMaterial(g[c],b)]},createMaterial:function(a,g){function b(h){h=Math.log(h)/Math.LN2;return Math.floor(h)==h}function c(h,l){var j=new Image;j.onload=function(){if(!b(this.width)||!b(this.height)){var k=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),m=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));h.image.width=k;h.image.height=m;h.image.getContext("2d").drawImage(this,0,0,k,m)}else h.image=this;h.needsUpdate=!0};j.src=l}var d,f,e;d="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1,wireframe:a.wireframe};if(a.shading)if(a.shading=="Phong")d="MeshPhongMaterial";else a.shading=="Basic"&&(d="MeshBasicMaterial");if(a.mapDiffuse&&g){e=document.createElement("canvas");f.map=new THREE.Texture(e);f.map.sourceFile=a.mapDiffuse;
+c(f.map,g+"/"+a.mapDiffuse)}else if(a.colorDiffuse){e=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;f.color=e;f.opacity=a.transparency}else if(a.DbgColor)f.color=a.DbgColor;if(a.mapLightmap&&g){e=document.createElement("canvas");f.lightMap=new THREE.Texture(e);f.lightMap.sourceFile=a.mapLightmap;c(f.lightMap,g+"/"+a.mapLightmap)}return new THREE[d](f)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;
+THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a){var g=this,b=a.model,c=a.callback,d=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(f){g.createModel(f.data,c,d);g.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
+THREE.JSONLoader.prototype.createModel=function(a,g,b){var c=new THREE.Geometry;this.init_materials(c,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var d,f,e,h,l,j,k,m,p,w,t=a.faces;m=a.vertices;var z=a.normals,y=a.colors,A=0;for(d=0;d<a.uvs.length;d++)a.uvs[d].length&&A++;for(d=0;d<A;d++){c.faceUvs[d]=[];c.faceVertexUvs[d]=[]}e=0;for(h=m.length;e<h;){p=new THREE.Vertex;p.position.x=m[e++];p.position.y=m[e++];p.position.z=m[e++];c.vertices.push(p)}e=
+0;for(h=t.length;e<h;){l=t[e++];j=l&1;d=l&2;k=l&4;f=l&8;m=l&16;p=l&32;w=l&64;l&=128;if(j){j=new THREE.Face4;j.a=t[e++];j.b=t[e++];j.c=t[e++];j.d=t[e++];nVertices=4}else{j=new THREE.Face3;j.a=t[e++];j.b=t[e++];j.c=t[e++];nVertices=3}if(d){materialIndex=t[e++];j.materials=c.materials[materialIndex]}if(k)for(d=0;d<A;d++){uvLayer=a.uvs[d];uvIndex=t[e++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];c.faceUvs[d].push(new THREE.UV(u,v))}if(f)for(d=0;d<A;d++){uvLayer=a.uvs[d];uvs=[];for(f=0;f<nVertices;f++){uvIndex=
+t[e++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[f]=new THREE.UV(u,v)}f=c.faces.length;c.faceVertexUvs[d][f]=uvs}if(m){normalIndex=t[e++]*3;normal=new THREE.Vector3;normal.x=z[normalIndex++];normal.y=z[normalIndex++];normal.z=z[normalIndex];j.normal=normal}if(p)for(d=0;d<nVertices;d++){normalIndex=t[e++]*3;normal=new THREE.Vector3;normal.x=z[normalIndex++];normal.y=z[normalIndex++];normal.z=z[normalIndex];j.vertexNormals.push(normal)}if(w){color=new THREE.Color(t[e++]);j.color=color}if(l)for(d=
+0;d<nVertices;d++){colorIndex=t[e++];color=new THREE.Color(y[colorIndex]);j.vertexColors.push(color)}c.faces.push(j)}}})();(function(){var d,f,e,h;if(a.skinWeights){d=0;for(f=a.skinWeights.length;d<f;d+=2){e=a.skinWeights[d];h=a.skinWeights[d+1];c.skinWeights.push(new THREE.Vector4(e,h,0,0))}}if(a.skinIndices){d=0;for(f=a.skinIndices.length;d<f;d+=2){e=a.skinIndices[d];h=a.skinIndices[d+1];c.skinIndices.push(new THREE.Vector4(e,h,0,0))}}c.bones=a.bones;c.animation=a.animation})();(function(){if(a.morphTargets!==
+undefined){var d,f,e,h;d=0;for(f=a.morphTargets.length;d<f;d++){c.morphTargets[d]={};c.morphTargets[d].name=a.morphTargets[d].name;c.morphTargets[d].vertices=[];dstVertices=c.morphTargets[d].vertices;srcVertices=a.morphTargets[d].vertices;e=0;for(h=srcVertices.length;e<h;e+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[e],srcVertices[e+1],srcVertices[e+2])))}}})();c.computeCentroids();c.computeFaceNormals();g(c)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
+THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
+THREE.BinaryLoader.prototype={load:function(a){var g=a.model,b=a.callback,c=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(g),d=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(g);a=(new Date).getTime();g=new Worker(g);var f=this.showProgress?THREE.Loader.prototype.updateProgress:null;g.onmessage=function(e){THREE.BinaryLoader.prototype.loadAjaxBuffers(e.data.buffers,e.data.materials,b,d,c,f)};g.onerror=function(e){alert("worker.onerror: "+e.message+"\n"+e.data);e.preventDefault()};
+g.postMessage(a)},loadAjaxBuffers:function(a,g,b,c,d,f){var e=new XMLHttpRequest,h=c+"/"+a,l=0;e.onreadystatechange=function(){if(e.readyState==4)e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.responseText,b,d,g):alert("Couldn't load ["+h+"] ["+e.status+"]");else if(e.readyState==3){if(f){l==0&&(l=e.getResponseHeader("Content-Length"));f({total:l,loaded:e.responseText.length})}}else e.readyState==2&&(l=e.getResponseHeader("Content-Length"))};e.open("GET",h,!0);e.overrideMimeType("text/plain; charset=x-user-defined");
+e.setRequestHeader("Content-Type","text/plain");e.send(null)},createBinModel:function(a,g,b,c){var d=function(f){function e(o,x){var B=k(o,x),F=k(o,x+1),I=k(o,x+2),S=k(o,x+3),V=(S<<1&255|I>>7)-127;B|=(I&127)<<16|F<<8;if(B==0&&V==-127)return 0;return(1-2*(S>>7))*(1+B*Math.pow(2,-23))*Math.pow(2,V)}function h(o,x){var B=k(o,x),F=k(o,x+1),I=k(o,x+2);return(k(o,x+3)<<24)+(I<<16)+(F<<8)+B}function l(o,x){var B=k(o,x);return(k(o,x+1)<<8)+B}function j(o,x){var B=k(o,x);return B>127?B-256:B}function k(o,
+x){return o.charCodeAt(x)&255}function m(o){var x,B,F;x=h(a,o);B=h(a,o+L);F=h(a,o+M);o=l(a,o+K);THREE.BinaryLoader.prototype.f3(A,x,B,F,o)}function p(o){var x,B,F,I,S,V;x=h(a,o);B=h(a,o+L);F=h(a,o+M);I=l(a,o+K);S=h(a,o+J);V=h(a,o+G);o=h(a,o+N);THREE.BinaryLoader.prototype.f3n(A,E,x,B,F,I,S,V,o)}function w(o){var x,B,F,I;x=h(a,o);B=h(a,o+U);F=h(a,o+R);I=h(a,o+P);o=l(a,o+Q);THREE.BinaryLoader.prototype.f4(A,x,B,F,I,o)}function t(o){var x,B,F,I,S,V,da,ea;x=h(a,o);B=h(a,o+U);F=h(a,o+R);I=h(a,o+P);S=l(a,
+o+Q);V=h(a,o+T);da=h(a,o+H);ea=h(a,o+O);o=h(a,o+X);THREE.BinaryLoader.prototype.f4n(A,E,x,B,F,I,S,V,da,ea,o)}function z(o){var x,B;x=h(a,o);B=h(a,o+Y);o=h(a,o+fa);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],D[x*2],D[x*2+1],D[B*2],D[B*2+1],D[o*2],D[o*2+1])}function y(o){var x,B,F;x=h(a,o);B=h(a,o+ga);F=h(a,o+ha);o=h(a,o+ia);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],D[x*2],D[x*2+1],D[B*2],D[B*2+1],D[F*2],D[F*2+1],D[o*2],D[o*2+1])}var A=this,C=0,n,E=[],D=[],L,M,K,J,G,N,U,R,P,Q,T,H,
+O,X,Y,fa,ga,ha,ia,Z,$,aa,ba,ca,W;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,c,f);n={signature:a.substr(C,8),header_bytes:k(a,C+8),vertex_coordinate_bytes:k(a,C+9),normal_coordinate_bytes:k(a,C+10),uv_coordinate_bytes:k(a,C+11),vertex_index_bytes:k(a,C+12),normal_index_bytes:k(a,C+13),uv_index_bytes:k(a,C+14),material_index_bytes:k(a,C+15),nvertices:h(a,C+16),nnormals:h(a,C+16+4),nuvs:h(a,C+16+8),ntri_flat:h(a,C+16+12),ntri_smooth:h(a,C+16+16),ntri_flat_uv:h(a,C+16+20),ntri_smooth_uv:h(a,
+C+16+24),nquad_flat:h(a,C+16+28),nquad_smooth:h(a,C+16+32),nquad_flat_uv:h(a,C+16+36),nquad_smooth_uv:h(a,C+16+40)};C+=n.header_bytes;L=n.vertex_index_bytes;M=n.vertex_index_bytes*2;K=n.vertex_index_bytes*3;J=n.vertex_index_bytes*3+n.material_index_bytes;G=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;N=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;U=n.vertex_index_bytes;R=n.vertex_index_bytes*2;P=n.vertex_index_bytes*3;Q=n.vertex_index_bytes*4;T=n.vertex_index_bytes*
 4+n.material_index_bytes;H=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes;O=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;X=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;Y=n.uv_index_bytes;fa=n.uv_index_bytes*2;ga=n.uv_index_bytes;ha=n.uv_index_bytes*2;ia=n.uv_index_bytes*3;f=n.vertex_index_bytes*3+n.material_index_bytes;W=n.vertex_index_bytes*4+n.material_index_bytes;Z=n.ntri_flat*f;$=n.ntri_smooth*(f+n.normal_index_bytes*3);aa=n.ntri_flat_uv*
-(f+n.uv_index_bytes*3);ba=n.ntri_smooth_uv*(f+n.normal_index_bytes*3+n.uv_index_bytes*3);ca=n.nquad_flat*W;f=n.nquad_smooth*(W+n.normal_index_bytes*4);W=n.nquad_flat_uv*(W+n.uv_index_bytes*4);B+=function(o){for(var x,C,F,I=n.vertex_coordinate_bytes*3,S=o+n.nvertices*I;o<S;o+=I){x=d(a,o);C=d(a,o+n.vertex_coordinate_bytes);F=d(a,o+n.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(A,x,C,F)}return n.nvertices*I}(B);B+=function(o){for(var x,C,F,I=n.normal_coordinate_bytes*3,S=o+n.nnormals*I;o<
-S;o+=I){x=l(a,o);C=l(a,o+n.normal_coordinate_bytes);F=l(a,o+n.normal_coordinate_bytes*2);E.push(x/127,C/127,F/127)}return n.nnormals*I}(B);B+=function(o){for(var x,C,F=n.uv_coordinate_bytes*2,I=o+n.nuvs*F;o<I;o+=F){x=d(a,o);C=d(a,o+n.uv_coordinate_bytes);D.push(x,C)}return n.nuvs*F}(B);Z=B+Z;$=Z+$;aa=$+aa;ba=aa+ba;ca=ba+ca;f=ca+f;W=f+W;(function(o){var x,C=n.vertex_index_bytes*3+n.material_index_bytes,F=C+n.uv_index_bytes*3,I=o+n.ntri_flat_uv*F;for(x=o;x<I;x+=F){m(x);z(x+C)}return I-o})($);(function(o){var x,
-C=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,F=C+n.uv_index_bytes*3,I=o+n.ntri_smooth_uv*F;for(x=o;x<I;x+=F){t(x);z(x+C)}return I-o})(aa);(function(o){var x,C=n.vertex_index_bytes*4+n.material_index_bytes,F=C+n.uv_index_bytes*4,I=o+n.nquad_flat_uv*F;for(x=o;x<I;x+=F){w(x);p(x+C)}return I-o})(f);(function(o){var x,C=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,F=C+n.uv_index_bytes*4,I=o+n.nquad_smooth_uv*F;for(x=o;x<I;x+=F){y(x);p(x+C)}return I-o})(W);
-(function(o){var x,C=n.vertex_index_bytes*3+n.material_index_bytes,F=o+n.ntri_flat*C;for(x=o;x<F;x+=C)m(x);return F-o})(B);(function(o){var x,C=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,F=o+n.ntri_smooth*C;for(x=o;x<F;x+=C)t(x);return F-o})(Z);(function(o){var x,C=n.vertex_index_bytes*4+n.material_index_bytes,F=o+n.nquad_flat*C;for(x=o;x<F;x+=C)w(x);return F-o})(ba);(function(o){var x,C=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,F=o+n.nquad_smooth*
-C;for(x=o;x<F;x+=C)y(x);return F-o})(ca);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;e(new h(b))},v:function(a,e,b,c){a.vertices.push(new THREE.Vertex(new THREE.Vector3(e,b,c)))},f3:function(a,e,b,c,h){a.faces.push(new THREE.Face3(e,b,c,null,null,a.materials[h]))},f4:function(a,e,b,c,h,f){a.faces.push(new THREE.Face4(e,b,c,h,null,null,a.materials[f]))},f3n:function(a,e,b,c,h,f,d,g,j){f=a.materials[f];var l=e[g*3],k=e[g*3+1];g=e[g*3+2];
-var m=e[j*3],t=e[j*3+1];j=e[j*3+2];a.faces.push(new THREE.Face3(b,c,h,[new THREE.Vector3(e[d*3],e[d*3+1],e[d*3+2]),new THREE.Vector3(l,k,g),new THREE.Vector3(m,t,j)],null,f))},f4n:function(a,e,b,c,h,f,d,g,j,l,k){d=a.materials[d];var m=e[j*3],t=e[j*3+1];j=e[j*3+2];var w=e[l*3],y=e[l*3+1];l=e[l*3+2];var z=e[k*3],p=e[k*3+1];k=e[k*3+2];a.faces.push(new THREE.Face4(b,c,h,f,[new THREE.Vector3(e[g*3],e[g*3+1],e[g*3+2]),new THREE.Vector3(m,t,j),new THREE.Vector3(w,y,l),new THREE.Vector3(z,p,k)],null,d))},
-uv3:function(a,e,b,c,h,f,d){var g=[];g.push(new THREE.UV(e,b));g.push(new THREE.UV(c,h));g.push(new THREE.UV(f,d));a.push(g)},uv4:function(a,e,b,c,h,f,d,g,j){var l=[];l.push(new THREE.UV(e,b));l.push(new THREE.UV(c,h));l.push(new THREE.UV(f,d));l.push(new THREE.UV(g,j));a.push(l)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
-THREE.MarchingCubes=function(a,e){THREE.Object3D.call(this);this.materials=e instanceof Array?e:[e];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
-0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,f,d,g,j,l,k,m){d=(d-k)/(m-k);k=this.normal_cache;c[f]=g+d*this.delta;c[f+1]=j;c[f+2]=l;h[f]=this.lerp(k[b],k[b+3],d);h[f+1]=this.lerp(k[b+1],k[b+4],d);h[f+2]=this.lerp(k[b+2],k[b+5],d)};this.VIntY=function(b,c,h,f,d,g,j,l,k,m){d=(d-k)/(m-k);k=this.normal_cache;c[f]=g;c[f+1]=j+d*this.delta;c[f+
-2]=l;c=b+this.yd*3;h[f]=this.lerp(k[b],k[c],d);h[f+1]=this.lerp(k[b+1],k[c+1],d);h[f+2]=this.lerp(k[b+2],k[c+2],d)};this.VIntZ=function(b,c,h,f,d,g,j,l,k,m){d=(d-k)/(m-k);k=this.normal_cache;c[f]=g;c[f+1]=j;c[f+2]=l+d*this.delta;c=b+this.zd*3;h[f]=this.lerp(k[b],k[c],d);h[f+1]=this.lerp(k[b+1],k[c+1],d);h[f+2]=this.lerp(k[b+2],k[c+2],d)};this.compNorm=function(b){var c=b*3;if(this.normal_cache[c]==0){this.normal_cache[c]=this.field[b-1]-this.field[b+1];this.normal_cache[c+1]=this.field[b-this.yd]-
-this.field[b+this.yd];this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,c,h,f,d,g){var j=f+1,l=f+this.yd,k=f+this.zd,m=j+this.yd,t=j+this.zd,w=f+this.yd+this.zd,y=j+this.yd+this.zd,z=0,p=this.field[f],A=this.field[j],B=this.field[l],n=this.field[m],E=this.field[k],D=this.field[t],L=this.field[w],M=this.field[y];p<d&&(z|=1);A<d&&(z|=2);B<d&&(z|=8);n<d&&(z|=4);E<d&&(z|=16);D<d&&(z|=32);L<d&&(z|=128);M<d&&(z|=64);var K=THREE.edgeTable[z];if(K==0)return 0;
-var J=this.delta,G=b+J,N=c+J;J=h+J;if(K&1){this.compNorm(f);this.compNorm(j);this.VIntX(f*3,this.vlist,this.nlist,0,d,b,c,h,p,A)}if(K&2){this.compNorm(j);this.compNorm(m);this.VIntY(j*3,this.vlist,this.nlist,3,d,G,c,h,A,n)}if(K&4){this.compNorm(l);this.compNorm(m);this.VIntX(l*3,this.vlist,this.nlist,6,d,b,N,h,B,n)}if(K&8){this.compNorm(f);this.compNorm(l);this.VIntY(f*3,this.vlist,this.nlist,9,d,b,c,h,p,B)}if(K&16){this.compNorm(k);this.compNorm(t);this.VIntX(k*3,this.vlist,this.nlist,12,d,b,c,J,
-E,D)}if(K&32){this.compNorm(t);this.compNorm(y);this.VIntY(t*3,this.vlist,this.nlist,15,d,G,c,J,D,M)}if(K&64){this.compNorm(w);this.compNorm(y);this.VIntX(w*3,this.vlist,this.nlist,18,d,b,N,J,L,M)}if(K&128){this.compNorm(k);this.compNorm(w);this.VIntY(k*3,this.vlist,this.nlist,21,d,b,c,J,E,L)}if(K&256){this.compNorm(f);this.compNorm(k);this.VIntZ(f*3,this.vlist,this.nlist,24,d,b,c,h,p,E)}if(K&512){this.compNorm(j);this.compNorm(t);this.VIntZ(j*3,this.vlist,this.nlist,27,d,G,c,h,A,D)}if(K&1024){this.compNorm(m);
-this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,30,d,G,N,h,n,M)}if(K&2048){this.compNorm(l);this.compNorm(w);this.VIntZ(l*3,this.vlist,this.nlist,33,d,b,N,h,B,L)}z<<=4;for(d=f=0;THREE.triTable[z+d]!=-1;){b=z+d;c=b+1;h=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],g);d+=3;f++}return f};this.posnormtriv=function(b,c,h,f,d,g){var j=this.count*3;this.positionArray[j]=b[h];this.positionArray[j+1]=b[h+1];this.positionArray[j+2]=b[h+2];this.positionArray[j+
-3]=b[f];this.positionArray[j+4]=b[f+1];this.positionArray[j+5]=b[f+2];this.positionArray[j+6]=b[d];this.positionArray[j+7]=b[d+1];this.positionArray[j+8]=b[d+2];this.normalArray[j]=c[h];this.normalArray[j+1]=c[h+1];this.normalArray[j+2]=c[h+2];this.normalArray[j+3]=c[f];this.normalArray[j+4]=c[f+1];this.normalArray[j+5]=c[f+2];this.normalArray[j+6]=c[d];this.normalArray[j+7]=c[d+1];this.normalArray[j+8]=c[d+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&g(this)};this.begin=
-function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,h,f,d){var g=this.size*Math.sqrt(f/d),j=h*this.size,l=c*this.size,k=b*this.size,m=Math.floor(j-g);m<1&&(m=1);j=Math.floor(j+g);j>this.size-1&&(j=this.size-1);var t=Math.floor(l-g);t<1&&(t=1);l=Math.floor(l+g);l>this.size-1&&(l=this.size-1);var w=Math.floor(k-g);w<1&&(w=1);g=Math.floor(k+g);
-g>this.size-1&&(g=this.size-1);for(var y,z,p,A,B,n;m<j;m++){k=this.size2*m;z=m/this.size-h;B=z*z;for(z=t;z<l;z++){p=k+this.size*z;y=z/this.size-c;n=y*y;for(y=w;y<g;y++){A=y/this.size-b;A=f/(1.0E-6+A*A+n+B)-d;A>0&&(this.field[p+y]+=A)}}}};this.addPlaneX=function(b,c){var h,f,d,g,j,l=this.size,k=this.yd,m=this.zd,t=this.field,w=l*Math.sqrt(b/c);w>l&&(w=l);for(h=0;h<w;h++){f=h/l;f*=f;g=b/(1.0E-4+f)-c;if(g>0)for(f=0;f<l;f++){j=h+f*k;for(d=0;d<l;d++)t[m*d+j]+=g}}};this.addPlaneY=function(b,c){var h,f,
-d,g,j,l,k=this.size,m=this.yd,t=this.zd,w=this.field,y=k*Math.sqrt(b/c);y>k&&(y=k);for(f=0;f<y;f++){h=f/k;h*=h;g=b/(1.0E-4+h)-c;if(g>0){j=f*m;for(h=0;h<k;h++){l=j+h;for(d=0;d<k;d++)w[t*d+l]+=g}}}};this.addPlaneZ=function(b,c){var h,f,d,g,j,l;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(d=0;d<dist;d++){h=d/size;h*=h;g=b/(1.0E-4+h)-c;if(g>0){j=zd*d;for(f=0;f<size;f++){l=j+f*yd;for(h=0;h<size;h++)field[l+h]+=g}}}};this.reset=function(){var b;
-for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var c,h,f,d,g,j,l,k,m,t=this.size-2;for(d=1;d<t;d++){m=this.size2*d;l=(d-this.halfsize)/this.halfsize;for(f=1;f<t;f++){k=m+this.size*f;j=(f-this.halfsize)/this.halfsize;for(h=1;h<t;h++){g=(h-this.halfsize)/this.halfsize;c=k+h;this.polygonize(g,j,l,c,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry;this.render(function(h){var f,d,g,j,l,k,m,t;for(f=
-0;f<h.count;f++){l=f*3;m=l+1;t=l+2;d=h.positionArray[l];g=h.positionArray[m];j=h.positionArray[t];k=new THREE.Vector3(d,g,j);d=h.normalArray[l];g=h.normalArray[m];j=h.normalArray[t];l=new THREE.Vector3(d,g,j);l.normalize();l=new THREE.Vertex(k,l);c.vertices.push(l)}nfaces=h.count/3;for(f=0;f<nfaces;f++){l=(b+f)*3;m=l+1;t=l+2;k=c.vertices[l].normal;d=c.vertices[m].normal;g=c.vertices[t].normal;l=new THREE.Face3(l,m,t,[k,d,g]);c.faces.push(l)}b+=nfaces;h.count=0});return c};this.init(a)};
+(f+n.uv_index_bytes*3);ba=n.ntri_smooth_uv*(f+n.normal_index_bytes*3+n.uv_index_bytes*3);ca=n.nquad_flat*W;f=n.nquad_smooth*(W+n.normal_index_bytes*4);W=n.nquad_flat_uv*(W+n.uv_index_bytes*4);C+=function(o){for(var x,B,F,I=n.vertex_coordinate_bytes*3,S=o+n.nvertices*I;o<S;o+=I){x=e(a,o);B=e(a,o+n.vertex_coordinate_bytes);F=e(a,o+n.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(A,x,B,F)}return n.nvertices*I}(C);C+=function(o){for(var x,B,F,I=n.normal_coordinate_bytes*3,S=o+n.nnormals*I;o<
+S;o+=I){x=j(a,o);B=j(a,o+n.normal_coordinate_bytes);F=j(a,o+n.normal_coordinate_bytes*2);E.push(x/127,B/127,F/127)}return n.nnormals*I}(C);C+=function(o){for(var x,B,F=n.uv_coordinate_bytes*2,I=o+n.nuvs*F;o<I;o+=F){x=e(a,o);B=e(a,o+n.uv_coordinate_bytes);D.push(x,B)}return n.nuvs*F}(C);Z=C+Z;$=Z+$;aa=$+aa;ba=aa+ba;ca=ba+ca;f=ca+f;W=f+W;(function(o){var x,B=n.vertex_index_bytes*3+n.material_index_bytes,F=B+n.uv_index_bytes*3,I=o+n.ntri_flat_uv*F;for(x=o;x<I;x+=F){m(x);z(x+B)}return I-o})($);(function(o){var x,
+B=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,F=B+n.uv_index_bytes*3,I=o+n.ntri_smooth_uv*F;for(x=o;x<I;x+=F){p(x);z(x+B)}return I-o})(aa);(function(o){var x,B=n.vertex_index_bytes*4+n.material_index_bytes,F=B+n.uv_index_bytes*4,I=o+n.nquad_flat_uv*F;for(x=o;x<I;x+=F){w(x);y(x+B)}return I-o})(f);(function(o){var x,B=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,F=B+n.uv_index_bytes*4,I=o+n.nquad_smooth_uv*F;for(x=o;x<I;x+=F){t(x);y(x+B)}return I-o})(W);
+(function(o){var x,B=n.vertex_index_bytes*3+n.material_index_bytes,F=o+n.ntri_flat*B;for(x=o;x<F;x+=B)m(x);return F-o})(C);(function(o){var x,B=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,F=o+n.ntri_smooth*B;for(x=o;x<F;x+=B)p(x);return F-o})(Z);(function(o){var x,B=n.vertex_index_bytes*4+n.material_index_bytes,F=o+n.nquad_flat*B;for(x=o;x<F;x+=B)w(x);return F-o})(ba);(function(o){var x,B=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,F=o+n.nquad_smooth*
+B;for(x=o;x<F;x+=B)t(x);return F-o})(ca);this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;g(new d(b))},v:function(a,g,b,c){a.vertices.push(new THREE.Vertex(new THREE.Vector3(g,b,c)))},f3:function(a,g,b,c,d){a.faces.push(new THREE.Face3(g,b,c,null,null,a.materials[d]))},f4:function(a,g,b,c,d,f){a.faces.push(new THREE.Face4(g,b,c,d,null,null,a.materials[f]))},f3n:function(a,g,b,c,d,f,e,h,l){f=a.materials[f];var j=g[h*3],k=g[h*3+1];h=g[h*3+2];
+var m=g[l*3],p=g[l*3+1];l=g[l*3+2];a.faces.push(new THREE.Face3(b,c,d,[new THREE.Vector3(g[e*3],g[e*3+1],g[e*3+2]),new THREE.Vector3(j,k,h),new THREE.Vector3(m,p,l)],null,f))},f4n:function(a,g,b,c,d,f,e,h,l,j,k){e=a.materials[e];var m=g[l*3],p=g[l*3+1];l=g[l*3+2];var w=g[j*3],t=g[j*3+1];j=g[j*3+2];var z=g[k*3],y=g[k*3+1];k=g[k*3+2];a.faces.push(new THREE.Face4(b,c,d,f,[new THREE.Vector3(g[h*3],g[h*3+1],g[h*3+2]),new THREE.Vector3(m,p,l),new THREE.Vector3(w,t,j),new THREE.Vector3(z,y,k)],null,e))},
+uv3:function(a,g,b,c,d,f,e){var h=[];h.push(new THREE.UV(g,b));h.push(new THREE.UV(c,d));h.push(new THREE.UV(f,e));a.push(h)},uv4:function(a,g,b,c,d,f,e,h,l){var j=[];j.push(new THREE.UV(g,b));j.push(new THREE.UV(c,d));j.push(new THREE.UV(f,e));j.push(new THREE.UV(h,l));a.push(j)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
+THREE.MarchingCubes=function(a,g){THREE.Object3D.call(this);this.materials=g instanceof Array?g:[g];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
+0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,d){return b+(c-b)*d};this.VIntX=function(b,c,d,f,e,h,l,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[f]=h+e*this.delta;c[f+1]=l;c[f+2]=j;d[f]=this.lerp(k[b],k[b+3],e);d[f+1]=this.lerp(k[b+1],k[b+4],e);d[f+2]=this.lerp(k[b+2],k[b+5],e)};this.VIntY=function(b,c,d,f,e,h,l,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[f]=h;c[f+1]=l+e*this.delta;c[f+
+2]=j;c=b+this.yd*3;d[f]=this.lerp(k[b],k[c],e);d[f+1]=this.lerp(k[b+1],k[c+1],e);d[f+2]=this.lerp(k[b+2],k[c+2],e)};this.VIntZ=function(b,c,d,f,e,h,l,j,k,m){e=(e-k)/(m-k);k=this.normal_cache;c[f]=h;c[f+1]=l;c[f+2]=j+e*this.delta;c=b+this.zd*3;d[f]=this.lerp(k[b],k[c],e);d[f+1]=this.lerp(k[b+1],k[c+1],e);d[f+2]=this.lerp(k[b+2],k[c+2],e)};this.compNorm=function(b){var c=b*3;if(this.normal_cache[c]==0){this.normal_cache[c]=this.field[b-1]-this.field[b+1];this.normal_cache[c+1]=this.field[b-this.yd]-
+this.field[b+this.yd];this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,c,d,f,e,h){var l=f+1,j=f+this.yd,k=f+this.zd,m=l+this.yd,p=l+this.zd,w=f+this.yd+this.zd,t=l+this.yd+this.zd,z=0,y=this.field[f],A=this.field[l],C=this.field[j],n=this.field[m],E=this.field[k],D=this.field[p],L=this.field[w],M=this.field[t];y<e&&(z|=1);A<e&&(z|=2);C<e&&(z|=8);n<e&&(z|=4);E<e&&(z|=16);D<e&&(z|=32);L<e&&(z|=128);M<e&&(z|=64);var K=THREE.edgeTable[z];if(K==0)return 0;
+var J=this.delta,G=b+J,N=c+J;J=d+J;if(K&1){this.compNorm(f);this.compNorm(l);this.VIntX(f*3,this.vlist,this.nlist,0,e,b,c,d,y,A)}if(K&2){this.compNorm(l);this.compNorm(m);this.VIntY(l*3,this.vlist,this.nlist,3,e,G,c,d,A,n)}if(K&4){this.compNorm(j);this.compNorm(m);this.VIntX(j*3,this.vlist,this.nlist,6,e,b,N,d,C,n)}if(K&8){this.compNorm(f);this.compNorm(j);this.VIntY(f*3,this.vlist,this.nlist,9,e,b,c,d,y,C)}if(K&16){this.compNorm(k);this.compNorm(p);this.VIntX(k*3,this.vlist,this.nlist,12,e,b,c,J,
+E,D)}if(K&32){this.compNorm(p);this.compNorm(t);this.VIntY(p*3,this.vlist,this.nlist,15,e,G,c,J,D,M)}if(K&64){this.compNorm(w);this.compNorm(t);this.VIntX(w*3,this.vlist,this.nlist,18,e,b,N,J,L,M)}if(K&128){this.compNorm(k);this.compNorm(w);this.VIntY(k*3,this.vlist,this.nlist,21,e,b,c,J,E,L)}if(K&256){this.compNorm(f);this.compNorm(k);this.VIntZ(f*3,this.vlist,this.nlist,24,e,b,c,d,y,E)}if(K&512){this.compNorm(l);this.compNorm(p);this.VIntZ(l*3,this.vlist,this.nlist,27,e,G,c,d,A,D)}if(K&1024){this.compNorm(m);
+this.compNorm(t);this.VIntZ(m*3,this.vlist,this.nlist,30,e,G,N,d,n,M)}if(K&2048){this.compNorm(j);this.compNorm(w);this.VIntZ(j*3,this.vlist,this.nlist,33,e,b,N,d,C,L)}z<<=4;for(e=f=0;THREE.triTable[z+e]!=-1;){b=z+e;c=b+1;d=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[d],h);e+=3;f++}return f};this.posnormtriv=function(b,c,d,f,e,h){var l=this.count*3;this.positionArray[l]=b[d];this.positionArray[l+1]=b[d+1];this.positionArray[l+2]=b[d+2];this.positionArray[l+
+3]=b[f];this.positionArray[l+4]=b[f+1];this.positionArray[l+5]=b[f+2];this.positionArray[l+6]=b[e];this.positionArray[l+7]=b[e+1];this.positionArray[l+8]=b[e+2];this.normalArray[l]=c[d];this.normalArray[l+1]=c[d+1];this.normalArray[l+2]=c[d+2];this.normalArray[l+3]=c[f];this.normalArray[l+4]=c[f+1];this.normalArray[l+5]=c[f+2];this.normalArray[l+6]=c[e];this.normalArray[l+7]=c[e+1];this.normalArray[l+8]=c[e+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
+function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,d,f,e){var h=this.size*Math.sqrt(f/e),l=d*this.size,j=c*this.size,k=b*this.size,m=Math.floor(l-h);m<1&&(m=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var p=Math.floor(j-h);p<1&&(p=1);j=Math.floor(j+h);j>this.size-1&&(j=this.size-1);var w=Math.floor(k-h);w<1&&(w=1);h=Math.floor(k+h);
+h>this.size-1&&(h=this.size-1);for(var t,z,y,A,C,n;m<l;m++){k=this.size2*m;z=m/this.size-d;C=z*z;for(z=p;z<j;z++){y=k+this.size*z;t=z/this.size-c;n=t*t;for(t=w;t<h;t++){A=t/this.size-b;A=f/(1.0E-6+A*A+n+C)-e;A>0&&(this.field[y+t]+=A)}}}};this.addPlaneX=function(b,c){var d,f,e,h,l,j=this.size,k=this.yd,m=this.zd,p=this.field,w=j*Math.sqrt(b/c);w>j&&(w=j);for(d=0;d<w;d++){f=d/j;f*=f;h=b/(1.0E-4+f)-c;if(h>0)for(f=0;f<j;f++){l=d+f*k;for(e=0;e<j;e++)p[m*e+l]+=h}}};this.addPlaneY=function(b,c){var d,f,
+e,h,l,j,k=this.size,m=this.yd,p=this.zd,w=this.field,t=k*Math.sqrt(b/c);t>k&&(t=k);for(f=0;f<t;f++){d=f/k;d*=d;h=b/(1.0E-4+d)-c;if(h>0){l=f*m;for(d=0;d<k;d++){j=l+d;for(e=0;e<k;e++)w[p*e+j]+=h}}}};this.addPlaneZ=function(b,c){var d,f,e,h,l,j;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(e=0;e<dist;e++){d=e/size;d*=d;h=b/(1.0E-4+d)-c;if(h>0){l=zd*e;for(f=0;f<size;f++){j=l+f*yd;for(d=0;d<size;d++)field[j+d]+=h}}}};this.reset=function(){var b;
+for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var c,d,f,e,h,l,j,k,m,p=this.size-2;for(e=1;e<p;e++){m=this.size2*e;j=(e-this.halfsize)/this.halfsize;for(f=1;f<p;f++){k=m+this.size*f;l=(f-this.halfsize)/this.halfsize;for(d=1;d<p;d++){h=(d-this.halfsize)/this.halfsize;c=k+d;this.polygonize(h,l,j,c,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry;this.render(function(d){var f,e,h,l,j,k,m,p;for(f=
+0;f<d.count;f++){j=f*3;m=j+1;p=j+2;e=d.positionArray[j];h=d.positionArray[m];l=d.positionArray[p];k=new THREE.Vector3(e,h,l);e=d.normalArray[j];h=d.normalArray[m];l=d.normalArray[p];j=new THREE.Vector3(e,h,l);j.normalize();j=new THREE.Vertex(k,j);c.vertices.push(j)}nfaces=d.count/3;for(f=0;f<nfaces;f++){j=(b+f)*3;m=j+1;p=j+2;k=c.vertices[j].normal;e=c.vertices[m].normal;h=c.vertices[p].normal;j=new THREE.Face3(j,m,p,[k,e,h]);c.faces.push(j)}b+=nfaces;d.count=0});return c};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,
 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,

+ 210 - 196
build/custom/ThreeWebGL.js

@@ -1,89 +1,89 @@
 // ThreeWebGL.js r37 - http://github.com/mrdoob/three.js
 var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
-THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var f,e,h,j,p,n;if(c==0)f=e=h=0;else{j=Math.floor(a*6);p=a*6-j;a=c*(1-b);n=c*(1-b*p);b=c*(1-b*(1-p));switch(j){case 1:f=n;e=c;h=a;break;case 2:f=a;e=c;h=b;break;case 3:f=a;e=n;h=c;break;case 4:f=b;e=a;h=c;break;case 5:f=c;e=a;
-h=n;break;case 6:case 0:f=c;e=b;h=a}}this.r=f;this.g=e;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
-255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
-THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
-this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
-THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
-b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,f=this.z;this.set(c*a.z-f*a.y,f*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
-a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
-this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
-1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,f){this.set(a||0,b||0,c||0,f||1)};
-THREE.Vector4.prototype={set:function(a,b,c,f){this.x=a;this.y=b;this.z=c;this.w=f;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
-a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
-THREE.Ray.prototype={intersectScene:function(a){var b,c,f=a.objects,e=[];a=0;for(b=f.length;a<b;a++){c=f[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(h,j){return h.distance-j.distance});return e},intersectObject:function(a){function b(P,L,ja,ma){ma=ma.clone().subSelf(L);ja=ja.clone().subSelf(L);var sa=P.clone().subSelf(L);P=ma.dot(ma);L=ma.dot(ja);ma=ma.dot(sa);var U=ja.dot(ja);ja=ja.dot(sa);sa=1/(P*U-L*L);U=(U*ma-L*ja)*sa;P=(P*ja-L*ma)*sa;return U>0&&P>0&&U+P<
-1}var c,f,e,h,j,p,n,s,x,z,C,y=a.geometry,J=y.vertices,K=[];c=0;for(f=y.faces.length;c<f;c++){e=y.faces[c];z=this.origin.clone();C=this.direction.clone();n=a.matrixWorld;h=n.multiplyVector3(J[e.a].position.clone());j=n.multiplyVector3(J[e.b].position.clone());p=n.multiplyVector3(J[e.c].position.clone());n=e instanceof THREE.Face4?n.multiplyVector3(J[e.d].position.clone()):null;s=a.matrixRotationWorld.multiplyVector3(e.normal.clone());x=C.dot(s);if(x<0){s=s.dot((new THREE.Vector3).sub(h,z))/x;z=z.addSelf(C.multiplyScalar(s));
-if(e instanceof THREE.Face3){if(b(z,h,j,p)){e={distance:this.origin.distanceTo(z),point:z,face:e,object:a};K.push(e)}}else if(e instanceof THREE.Face4&&(b(z,h,j,n)||b(z,j,p,n))){e={distance:this.origin.distanceTo(z),point:z,face:e,object:a};K.push(e)}}}return K}};
-THREE.Rectangle=function(){function a(){h=f-b;j=e-c}var b,c,f,e,h,j,p=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return e};this.set=function(n,s,x,z){p=!1;b=n;c=s;f=x;e=z;a()};this.addPoint=function(n,s){if(p){p=!1;b=n;c=s;f=n;e=s}else{b=b<n?b:n;c=c<s?c:s;f=f>n?f:n;e=e>s?e:s}a()};
-this.add3Points=function(n,s,x,z,C,y){if(p){p=!1;b=n<x?n<C?n:C:x<C?x:C;c=s<z?s<y?s:y:z<y?z:y;f=n>x?n>C?n:C:x>C?x:C;e=s>z?s>y?s:y:z>y?z:y}else{b=n<x?n<C?n<b?n:b:C<b?C:b:x<C?x<b?x:b:C<b?C:b;c=s<z?s<y?s<c?s:c:y<c?y:c:z<y?z<c?z:c:y<c?y:c;f=n>x?n>C?n>f?n:f:C>f?C:f:x>C?x>f?x:f:C>f?C:f;e=s>z?s>y?s>e?s:e:y>e?y:e:z>y?z>e?z:e:y>e?y:e}a()};this.addRectangle=function(n){if(p){p=!1;b=n.getLeft();c=n.getTop();f=n.getRight();e=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();c=c<n.getTop()?c:n.getTop();f=f>n.getRight()?
-f:n.getRight();e=e>n.getBottom()?e:n.getBottom()}a()};this.inflate=function(n){b-=n;c-=n;f+=n;e+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();c=c>n.getTop()?c:n.getTop();f=f<n.getRight()?f:n.getRight();e=e<n.getBottom()?e:n.getBottom();a()};this.instersects=function(n){return Math.min(f,n.getRight())-Math.max(b,n.getLeft())>=0&&Math.min(e,n.getBottom())-Math.max(c,n.getTop())>=0};this.empty=function(){p=!0;e=f=c=b=0;a()};this.isEmpty=function(){return p}};
-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,f,e,h,j,p,n,s,x,z,C,y,J,K){this.set(a||1,b||0,c||0,f||0,e||0,h||1,j||0,p||0,n||0,s||0,x||1,z||0,C||0,y||0,J||0,K||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,b,c,f,e,h,j,p,n,s,x,z,C,y,J,K){this.n11=a;this.n12=b;this.n13=c;this.n14=f;this.n21=e;this.n22=h;this.n23=j;this.n24=p;this.n31=n;this.n32=s;this.n33=x;this.n34=z;this.n41=C;this.n42=y;this.n43=J;this.n44=K;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var f=THREE.Matrix4.__v1,
-e=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}e.cross(h,f).normalize();this.n11=f.x;this.n12=e.x;this.n13=h.x;this.n21=f.y;this.n22=e.y;this.n23=h.y;this.n31=f.z;this.n32=e.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,f=a.z,e=1/(this.n41*b+this.n42*c+this.n43*f+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*f+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
-f+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*f+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,f=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*f+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*f+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*f+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*f+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,f=a.z;a.x=b*this.n11+c*this.n12+f*this.n13;a.y=b*this.n21+c*this.n22+f*this.n23;a.z=b*this.n31+c*this.n32+f*this.n33;a.normalize();
-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,f=a.n12,e=a.n13,h=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,x=a.n31,z=a.n32,C=a.n33,y=a.n34,J=a.n41,K=a.n42,P=a.n43,L=a.n44,ja=b.n11,ma=b.n12,sa=b.n13,U=b.n14,A=b.n21,oa=b.n22,
-d=b.n23,Ba=b.n24,Ca=b.n31,Q=b.n32,N=b.n33,pa=b.n34;this.n11=c*ja+f*A+e*Ca;this.n12=c*ma+f*oa+e*Q;this.n13=c*sa+f*d+e*N;this.n14=c*U+f*Ba+e*pa+h;this.n21=j*ja+p*A+n*Ca;this.n22=j*ma+p*oa+n*Q;this.n23=j*sa+p*d+n*N;this.n24=j*U+p*Ba+n*pa+s;this.n31=x*ja+z*A+C*Ca;this.n32=x*ma+z*oa+C*Q;this.n33=x*sa+z*d+C*N;this.n34=x*U+z*Ba+C*pa+y;this.n41=J*ja+K*A+P*Ca;this.n42=J*ma+K*oa+P*Q;this.n43=J*sa+K*d+P*N;this.n44=J*U+K*Ba+P*pa+L;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;
-c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
-a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,f=this.n14,e=this.n21,h=this.n22,j=this.n23,p=this.n24,n=this.n31,s=this.n32,x=this.n33,z=this.n34,C=this.n41,y=this.n42,J=this.n43,K=this.n44;return f*j*s*C-c*p*s*C-f*h*x*C+b*p*x*C+c*h*z*C-b*j*z*C-f*j*n*y+c*p*n*y+f*e*x*y-a*p*x*y-c*e*z*y+a*j*z*y+f*h*n*J-b*p*n*J-f*e*s*J+a*p*s*J+b*e*z*J-a*h*z*J-c*h*n*K+b*j*n*K+c*e*s*K-a*j*s*K-b*e*x*K+a*h*x*K},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
+THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var g,f,h,i,m,o;if(d==0)g=f=h=0;else{i=Math.floor(a*6);m=a*6-i;a=d*(1-c);o=d*(1-c*m);c=d*(1-c*(1-m));switch(i){case 1:g=o;f=d;h=a;break;case 2:g=a;f=d;h=c;break;case 3:g=a;f=o;h=d;break;case 4:g=c;f=a;h=d;break;case 5:g=d;f=a;
+h=o;break;case 6:case 0:g=d;f=c;h=a}}this.r=g;this.g=f;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
+255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,c){this.set(a||0,c||0)};
+THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
+this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,c,d){this.set(a||0,c||0,d||0)};
+THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
+c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,d=this.y,g=this.z;this.set(d*a.z-g*a.y,g*a.x-c*a.z,c*a.y-d*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
+a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
+this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-a.n23/c,a.n33/c);this.z=Math.atan2(-a.n13/c,a.n11/c)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
+1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,d,g){this.set(a||0,c||0,d||0,g||1)};
+THREE.Vector4.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
+a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
+THREE.Ray.prototype={intersectScene:function(a){var c,d,g=a.objects,f=[];a=0;for(c=g.length;a<c;a++){d=g[a];d instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(d)))}f.sort(function(h,i){return h.distance-i.distance});return f},intersectObject:function(a){function c(Q,K,ia,la){la=la.clone().subSelf(K);ia=ia.clone().subSelf(K);var wa=Q.clone().subSelf(K);Q=la.dot(la);K=la.dot(ia);la=la.dot(wa);var S=ia.dot(ia);ia=ia.dot(wa);wa=1/(Q*S-K*K);S=(S*la-K*ia)*wa;Q=(Q*ia-K*la)*wa;return S>0&&Q>0&&S+Q<
+1}var d,g,f,h,i,m,o,t,x,y,B,z=a.geometry,H=z.vertices,J=[];d=0;for(g=z.faces.length;d<g;d++){f=z.faces[d];y=this.origin.clone();B=this.direction.clone();o=a.matrixWorld;h=o.multiplyVector3(H[f.a].position.clone());i=o.multiplyVector3(H[f.b].position.clone());m=o.multiplyVector3(H[f.c].position.clone());o=f instanceof THREE.Face4?o.multiplyVector3(H[f.d].position.clone()):null;t=a.matrixRotationWorld.multiplyVector3(f.normal.clone());x=B.dot(t);if(x<0){t=t.dot((new THREE.Vector3).sub(h,y))/x;y=y.addSelf(B.multiplyScalar(t));
+if(f instanceof THREE.Face3){if(c(y,h,i,m)){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};J.push(f)}}else if(f instanceof THREE.Face4&&(c(y,h,i,o)||c(y,i,m,o))){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};J.push(f)}}}return J}};
+THREE.Rectangle=function(){function a(){h=g-c;i=f-d}var c,d,g,f,h,i,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return g};this.getBottom=function(){return f};this.set=function(o,t,x,y){m=!1;c=o;d=t;g=x;f=y;a()};this.addPoint=function(o,t){if(m){m=!1;c=o;d=t;g=o;f=t}else{c=c<o?c:o;d=d<t?d:t;g=g>o?g:o;f=f>t?f:t}a()};
+this.add3Points=function(o,t,x,y,B,z){if(m){m=!1;c=o<x?o<B?o:B:x<B?x:B;d=t<y?t<z?t:z:y<z?y:z;g=o>x?o>B?o:B:x>B?x:B;f=t>y?t>z?t:z:y>z?y:z}else{c=o<x?o<B?o<c?o:c:B<c?B:c:x<B?x<c?x:c:B<c?B:c;d=t<y?t<z?t<d?t:d:z<d?z:d:y<z?y<d?y:d:z<d?z:d;g=o>x?o>B?o>g?o:g:B>g?B:g:x>B?x>g?x:g:B>g?B:g;f=t>y?t>z?t>f?t:f:z>f?z:f:y>z?y>f?y:f:z>f?z:f}a()};this.addRectangle=function(o){if(m){m=!1;c=o.getLeft();d=o.getTop();g=o.getRight();f=o.getBottom()}else{c=c<o.getLeft()?c:o.getLeft();d=d<o.getTop()?d:o.getTop();g=g>o.getRight()?
+g:o.getRight();f=f>o.getBottom()?f:o.getBottom()}a()};this.inflate=function(o){c-=o;d-=o;g+=o;f+=o;a()};this.minSelf=function(o){c=c>o.getLeft()?c:o.getLeft();d=d>o.getTop()?d:o.getTop();g=g<o.getRight()?g:o.getRight();f=f<o.getBottom()?f:o.getBottom();a()};this.instersects=function(o){return Math.min(g,o.getRight())-Math.max(c,o.getLeft())>=0&&Math.min(f,o.getBottom())-Math.max(d,o.getTop())>=0};this.empty=function(){m=!0;f=g=d=c=0;a()};this.isEmpty=function(){return m}};
+THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
+THREE.Matrix4=function(a,c,d,g,f,h,i,m,o,t,x,y,B,z,H,J){this.set(a||1,c||0,d||0,g||0,f||0,h||1,i||0,m||0,o||0,t||0,x||1,y||0,B||0,z||0,H||0,J||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,c,d,g,f,h,i,m,o,t,x,y,B,z,H,J){this.n11=a;this.n12=c;this.n13=d;this.n14=g;this.n21=f;this.n22=h;this.n23=i;this.n24=m;this.n31=o;this.n32=t;this.n33=x;this.n34=y;this.n41=B;this.n42=z;this.n43=H;this.n44=J;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,d){var g=THREE.Matrix4.__v1,
+f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,c).normalize();if(h.length()===0)h.z=1;g.cross(d,h).normalize();if(g.length()===0){h.x+=1.0E-4;g.cross(d,h).normalize()}f.cross(h,g).normalize();this.n11=g.x;this.n12=f.x;this.n13=h.x;this.n21=g.y;this.n22=f.y;this.n23=h.y;this.n31=g.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var c=a.x,d=a.y,g=a.z,f=1/(this.n41*c+this.n42*d+this.n43*g+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*g+this.n14)*f;a.y=(this.n21*c+this.n22*d+this.n23*
+g+this.n24)*f;a.z=(this.n31*c+this.n32*d+this.n33*g+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,d=a.y,g=a.z,f=a.w;a.x=this.n11*c+this.n12*d+this.n13*g+this.n14*f;a.y=this.n21*c+this.n22*d+this.n23*g+this.n24*f;a.z=this.n31*c+this.n32*d+this.n33*g+this.n34*f;a.w=this.n41*c+this.n42*d+this.n43*g+this.n44*f;return a},rotateAxis:function(a){var c=a.x,d=a.y,g=a.z;a.x=c*this.n11+d*this.n12+g*this.n13;a.y=c*this.n21+d*this.n22+g*this.n23;a.z=c*this.n31+d*this.n32+g*this.n33;a.normalize();
+return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,g=a.n12,f=a.n13,h=a.n14,i=a.n21,m=a.n22,o=a.n23,t=a.n24,x=a.n31,y=a.n32,B=a.n33,z=a.n34,H=a.n41,J=a.n42,Q=a.n43,K=a.n44,ia=c.n11,la=c.n12,wa=c.n13,S=c.n14,E=c.n21,fa=c.n22,
+Y=c.n23,b=c.n24,ra=c.n31,R=c.n32,N=c.n33,pa=c.n34;this.n11=d*ia+g*E+f*ra;this.n12=d*la+g*fa+f*R;this.n13=d*wa+g*Y+f*N;this.n14=d*S+g*b+f*pa+h;this.n21=i*ia+m*E+o*ra;this.n22=i*la+m*fa+o*R;this.n23=i*wa+m*Y+o*N;this.n24=i*S+m*b+o*pa+t;this.n31=x*ia+y*E+B*ra;this.n32=x*la+y*fa+B*R;this.n33=x*wa+y*Y+B*N;this.n34=x*S+y*b+B*pa+z;this.n41=H*ia+J*E+Q*ra;this.n42=H*la+J*fa+Q*R;this.n43=H*wa+J*Y+Q*N;this.n44=H*S+J*b+Q*pa+K;return this},multiplyToArray:function(a,c,d){this.multiply(a,c);d[0]=this.n11;d[1]=
+this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
+a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,g=this.n14,f=this.n21,h=this.n22,i=this.n23,m=this.n24,o=this.n31,t=this.n32,x=this.n33,y=this.n34,B=this.n41,z=this.n42,H=this.n43,J=this.n44;return g*i*t*B-d*m*t*B-g*h*x*B+c*m*x*B+d*h*y*B-c*i*y*B-g*i*o*z+d*m*o*z+g*f*x*z-a*m*x*z-d*f*y*z+a*i*y*z+g*h*o*H-c*m*o*H-g*f*t*H+a*m*t*H+c*f*y*H-a*h*y*H-d*h*o*J+c*i*o*J+d*f*t*J-a*i*t*J-c*f*x*J+a*h*x*J},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
 this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
-a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,
-0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),f=Math.sin(b),e=
-1-c,h=a.x,j=a.y,p=a.z,n=e*h,s=e*j;this.set(n*h+c,n*j-f*p,n*p+f*j,0,n*j+f*p,s*j+c,s*p-f*h,0,n*p-f*j,s*p+f*h,e*p*p+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,f=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=a*c,p=b*c;this.n11=e*h;this.n12=-e*f;this.n13=c;this.n21=p*h+a*f;this.n22=-p*f+a*h;this.n23=-b*e;this.n31=-j*h+b*f;this.n32=j*f+b*h;this.n33=
-a*e;return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,f=a.z,e=a.w,h=b+b,j=c+c,p=f+f;a=b*h;var n=b*j;b*=p;var s=c*j;c*=p;f*=p;h*=e;j*=e;e*=p;this.n11=1-(s+f);this.n12=n-e;this.n13=b+j;this.n21=n+e;this.n22=1-(a+f);this.n23=c-h;this.n31=b-j;this.n32=c+h;this.n33=1-(a+s);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
-a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,f=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*f;this.n22=a.n22*f;this.n32=a.n32*f;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
-THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,f=a.n12,e=a.n13,h=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,x=a.n31,z=a.n32,C=a.n33,y=a.n34,J=a.n41,K=a.n42,P=a.n43,L=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*y*K-s*C*K+s*z*P-p*y*P-n*z*L+p*C*L;b.n12=h*C*K-e*y*K-h*z*P+f*y*P+e*z*L-f*C*L;b.n13=e*s*K-h*n*K+h*p*P-f*s*P-e*p*L+f*n*L;b.n14=h*n*z-e*s*z-h*p*C+f*s*C+e*p*y-f*n*y;b.n21=s*C*J-n*y*J-s*x*P+j*y*P+n*x*L-j*C*L;b.n22=e*y*J-h*C*J+h*x*P-c*y*P-e*x*L+c*C*L;b.n23=h*n*J-e*s*J-h*j*P+c*s*P+e*j*L-c*n*L;
-b.n24=e*s*x-h*n*x+h*j*C-c*s*C-e*j*y+c*n*y;b.n31=p*y*J-s*z*J+s*x*K-j*y*K-p*x*L+j*z*L;b.n32=h*z*J-f*y*J-h*x*K+c*y*K+f*x*L-c*z*L;b.n33=e*s*J-h*p*J+h*j*K-c*s*K-f*j*L+c*p*L;b.n34=h*p*x-f*s*x-h*j*z+c*s*z+f*j*y-c*p*y;b.n41=n*z*J-p*C*J-n*x*K+j*C*K+p*x*P-j*z*P;b.n42=f*C*J-e*z*J+e*x*K-c*C*K-f*x*P+c*z*P;b.n43=e*p*J-f*n*J-e*j*K+c*n*K+f*j*P-c*p*P;b.n44=f*n*x-e*p*x+e*j*z-c*n*z-f*j*C+c*p*C;b.multiplyScalar(1/a.determinant());return b};
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,f=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,s=a.n23*a.n12-a.n22*a.n13,x=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*j+a.n31*s;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*f;c[1]=a*e;c[2]=a*h;c[3]=a*j;c[4]=a*p;c[5]=a*n;c[6]=a*s;c[7]=a*x;c[8]=a*z;return b};
-THREE.Matrix4.makeFrustum=function(a,b,c,f,e,h){var j;j=new THREE.Matrix4;j.n11=2*e/(b-a);j.n12=0;j.n13=(b+a)/(b-a);j.n14=0;j.n21=0;j.n22=2*e/(f-c);j.n23=(f+c)/(f-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+e)/(h-e);j.n34=-2*h*e/(h-e);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,c,f){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,f)};
-THREE.Matrix4.makeOrtho=function(a,b,c,f,e,h){var j,p,n,s;j=new THREE.Matrix4;p=b-a;n=c-f;s=h-e;j.n11=2/p;j.n12=0;j.n13=0;j.n14=-((b+a)/p);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((c+f)/n);j.n31=0;j.n32=0;j.n33=-2/s;j.n34=-((h+e)/s);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
+a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,
+0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var d=Math.cos(c),g=Math.sin(c),f=
+1-d,h=a.x,i=a.y,m=a.z,o=f*h,t=f*i;this.set(o*h+d,o*i-g*m,o*m+g*i,0,o*i+g*m,t*i+d,t*m-g*h,0,o*m-g*i,t*m+g*h,f*m*m+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,d=a.y,g=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var h=Math.cos(g);g=Math.sin(g);var i=a*d,m=c*d;this.n11=f*h;this.n12=-f*g;this.n13=d;this.n21=m*h+a*g;this.n22=-m*g+a*h;this.n23=-c*f;this.n31=-i*h+c*g;this.n32=i*g+c*h;this.n33=
+a*f;return this},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,g=a.z,f=a.w,h=c+c,i=d+d,m=g+g;a=c*h;var o=c*i;c*=m;var t=d*i;d*=m;g*=m;h*=f;i*=f;f*=m;this.n11=1-(t+g);this.n12=o-f;this.n13=c+i;this.n21=o+f;this.n22=1-(a+g);this.n23=d-h;this.n31=c-i;this.n32=d+h;this.n33=1-(a+t);return this},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=d;this.n13*=a;this.n21*=c;this.n22*=d;this.n23*=a;this.n31*=c;this.n32*=d;this.n33*=a;this.n41*=c;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=
+a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var d=1/c.x,g=1/c.y,f=1/c.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*g;this.n22=a.n22*g;this.n32=a.n32*g;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
+THREE.Matrix4.makeInvert=function(a,c){var d=a.n11,g=a.n12,f=a.n13,h=a.n14,i=a.n21,m=a.n22,o=a.n23,t=a.n24,x=a.n31,y=a.n32,B=a.n33,z=a.n34,H=a.n41,J=a.n42,Q=a.n43,K=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=o*z*J-t*B*J+t*y*Q-m*z*Q-o*y*K+m*B*K;c.n12=h*B*J-f*z*J-h*y*Q+g*z*Q+f*y*K-g*B*K;c.n13=f*t*J-h*o*J+h*m*Q-g*t*Q-f*m*K+g*o*K;c.n14=h*o*y-f*t*y-h*m*B+g*t*B+f*m*z-g*o*z;c.n21=t*B*H-o*z*H-t*x*Q+i*z*Q+o*x*K-i*B*K;c.n22=f*z*H-h*B*H+h*x*Q-d*z*Q-f*x*K+d*B*K;c.n23=h*o*H-f*t*H-h*i*Q+d*t*Q+f*i*K-d*o*K;
+c.n24=f*t*x-h*o*x+h*i*B-d*t*B-f*i*z+d*o*z;c.n31=m*z*H-t*y*H+t*x*J-i*z*J-m*x*K+i*y*K;c.n32=h*y*H-g*z*H-h*x*J+d*z*J+g*x*K-d*y*K;c.n33=f*t*H-h*m*H+h*i*J-d*t*J-g*i*K+d*m*K;c.n34=h*m*x-g*t*x-h*i*y+d*t*y+g*i*z-d*m*z;c.n41=o*y*H-m*B*H-o*x*J+i*B*J+m*x*Q-i*y*Q;c.n42=g*B*H-f*y*H+f*x*J-d*B*J-g*x*Q+d*y*Q;c.n43=f*m*H-g*o*H-f*i*J+d*o*J+g*i*Q-d*m*Q;c.n44=g*o*x-f*m*x+f*i*y-d*o*y-g*i*B+d*m*B;c.multiplyScalar(1/a.determinant());return c};
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,g=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,m=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,x=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*g+a.n21*i+a.n31*t;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*g;d[1]=a*f;d[2]=a*h;d[3]=a*i;d[4]=a*m;d[5]=a*o;d[6]=a*t;d[7]=a*x;d[8]=a*y;return c};
+THREE.Matrix4.makeFrustum=function(a,c,d,g,f,h){var i;i=new THREE.Matrix4;i.n11=2*f/(c-a);i.n12=0;i.n13=(c+a)/(c-a);i.n14=0;i.n21=0;i.n22=2*f/(g-d);i.n23=(g+d)/(g-d);i.n24=0;i.n31=0;i.n32=0;i.n33=-(h+f)/(h-f);i.n34=-2*h*f/(h-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,c,d,g){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,d,g)};
+THREE.Matrix4.makeOrtho=function(a,c,d,g,f,h){var i,m,o,t;i=new THREE.Matrix4;m=c-a;o=d-g;t=h-f;i.n11=2/m;i.n12=0;i.n13=0;i.n14=-((c+a)/m);i.n21=0;i.n22=2/o;i.n23=0;i.n24=-((d+g)/o);i.n31=0;i.n32=0;i.n33=-2/t;i.n34=-((h+f)/t);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
 THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
 !0;this._vector=new THREE.Vector3};
-THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
-undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
-1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var f=this.children.length;a<f;a++)this.children[a].update(this.matrixWorld,
-b,c)}};THREE.Quaternion=function(a,b,c,f){this.set(a||0,b||0,c||0,f!==undefined?f:1)};
-THREE.Quaternion.prototype={set:function(a,b,c,f){this.x=a;this.y=b;this.z=c;this.w=f;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,f=a.y*b,e=a.z*b;a=Math.cos(f);f=Math.sin(f);b=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(c);c=Math.sin(c);var j=a*b,p=f*e;this.w=j*h-p*c;this.x=j*c+p*h;this.y=f*b*h+a*e*c;this.z=a*e*h-f*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
--1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,f=this.z,e=this.w,h=a.x,j=a.y,p=a.z;a=a.w;this.x=b*a+e*h+c*p-f*j;this.y=c*a+e*j+f*h-b*p;this.z=f*a+e*p+b*j-c*h;this.w=e*a-b*h-c*j-f*p;return this},
-multiplyVector3:function(a,b){b||(b=a);var c=a.x,f=a.y,e=a.z,h=this.x,j=this.y,p=this.z,n=this.w,s=n*c+j*e-p*f,x=n*f+p*c-h*e,z=n*e+h*f-j*c;c=-h*c-j*f-p*e;b.x=s*n+c*-h+x*-p-z*-j;b.y=x*n+c*-j+z*-h-s*-p;b.z=z*n+c*-p+s*-j-x*-h;return b}};
-THREE.Quaternion.slerp=function(a,b,c,f){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),j=Math.sqrt(1-e*e);if(Math.abs(j)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=a.w*e+b.w*f;c.x=a.x*e+b.x*f;c.y=a.y*e+b.y*f;c.z=a.z*e+b.z*f;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Face3=function(a,b,c,f,e,h){this.a=a;this.b=b;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
-THREE.Face4=function(a,b,c,f,e,h,j){this.a=a;this.b=b;this.c=c;this.d=f;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
-THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
-THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
-c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,f,e,h,j,p=new THREE.Vector3,n=new THREE.Vector3;f=0;for(e=this.faces.length;f<e;f++){h=this.faces[f];if(a&&h.vertexNormals.length){p.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)p.addSelf(h.vertexNormals[b]);p.divideScalar(3)}else{b=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];p.sub(j.position,c.position);n.sub(b.position,c.position);p.crossSelf(n)}p.isZero()||
-p.normalize();h.normal.copy(p)}},computeVertexNormals:function(){var a,b,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)f[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{f=
-this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)f[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)f[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(f[c.a]);
-c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function a(V,ha,ia,W,S,ta,ka){p=V.vertices[ha].position;n=V.vertices[ia].position;s=V.vertices[W].position;x=j[S];z=j[ta];C=j[ka];y=n.x-p.x;J=s.x-p.x;K=n.y-p.y;P=s.y-p.y;L=n.z-p.z;ja=s.z-p.z;ma=z.u-x.u;sa=C.u-x.u;U=z.v-x.v;A=C.v-x.v;oa=1/(ma*A-sa*
-U);Q.set((A*y-U*J)*oa,(A*K-U*P)*oa,(A*L-U*ja)*oa);N.set((ma*J-sa*y)*oa,(ma*P-sa*K)*oa,(ma*ja-sa*L)*oa);Ba[ha].addSelf(Q);Ba[ia].addSelf(Q);Ba[W].addSelf(Q);Ca[ha].addSelf(N);Ca[ia].addSelf(N);Ca[W].addSelf(N)}var b,c,f,e,h,j,p,n,s,x,z,C,y,J,K,P,L,ja,ma,sa,U,A,oa,d,Ba=[],Ca=[],Q=new THREE.Vector3,N=new THREE.Vector3,pa=new THREE.Vector3,ya=new THREE.Vector3,Da=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){Ba[b]=new THREE.Vector3;Ca[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){h=
-this.faces[b];j=this.faceVertexUvs[0][b];if(h instanceof THREE.Face3)a(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){a(this,h.a,h.b,h.c,0,1,2);a(this,h.a,h.b,h.d,0,1,3)}}var qa=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(f=0;f<h.vertexNormals.length;f++){Da.copy(h.vertexNormals[f]);e=h[qa[f]];d=Ba[e];pa.copy(d);pa.subSelf(Da.multiplyScalar(Da.dot(d))).normalize();ya.cross(h.vertexNormals[f],d);e=ya.dot(Ca[e]);e=e<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(pa.x,
-pa.y,pa.z,e)}}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,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=
+THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
+undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
+1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var g=this.children.length;a<g;a++)this.children[a].update(this.matrixWorld,
+c,d)}};THREE.Quaternion=function(a,c,d,g){this.set(a||0,c||0,d||0,g!==undefined?g:1)};
+THREE.Quaternion.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,d=a.x*c,g=a.y*c,f=a.z*c;a=Math.cos(g);g=Math.sin(g);c=Math.cos(-f);f=Math.sin(-f);var h=Math.cos(d);d=Math.sin(d);var i=a*c,m=g*f;this.w=i*h-m*d;this.x=i*d+m*h;this.y=g*c*h+a*f*d;this.z=a*f*h-g*c*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
+-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,d=this.y,g=this.z,f=this.w,h=a.x,i=a.y,m=a.z;a=a.w;this.x=c*a+f*h+d*m-g*i;this.y=d*a+f*i+g*h-c*m;this.z=g*a+f*m+c*i-d*h;this.w=f*a-c*h-d*i-g*m;return this},
+multiplyVector3:function(a,c){c||(c=a);var d=a.x,g=a.y,f=a.z,h=this.x,i=this.y,m=this.z,o=this.w,t=o*d+i*f-m*g,x=o*g+m*d-h*f,y=o*f+h*g-i*d;d=-h*d-i*g-m*f;c.x=t*o+d*-h+x*-m-y*-i;c.y=x*o+d*-i+y*-h-t*-m;c.z=y*o+d*-m+t*-i-x*-h;return c}};
+THREE.Quaternion.slerp=function(a,c,d,g){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.0010){d.w=0.5*(a.w+c.w);d.x=0.5*(a.x+c.x);d.y=0.5*(a.y+c.y);d.z=0.5*(a.z+c.z);return d}f=Math.sin((1-g)*h)/i;g=Math.sin(g*h)/i;d.w=a.w*f+c.w*g;d.x=a.x*f+c.x*g;d.y=a.y*f+c.y*g;d.z=a.z*f+c.z*g;return d};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
+THREE.Face3=function(a,c,d,g,f,h){this.a=a;this.b=c;this.c=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,c,d,g,f,h,i){this.a=a;this.b=c;this.c=d;this.d=g;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
+THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
+THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,g,f,h,i,m=new THREE.Vector3,o=new THREE.Vector3;g=0;for(f=this.faces.length;g<f;g++){h=this.faces[g];if(a&&h.vertexNormals.length){m.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else{c=this.vertices[h.a];d=this.vertices[h.b];i=this.vertices[h.c];m.sub(i.position,d.position);o.sub(c.position,d.position);m.crossSelf(o)}m.isZero()||
+m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var a,c,d,g;if(this.__tmpVertices==undefined){g=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)g[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{g=
+this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)g[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){g[d.a].addSelf(d.normal);g[d.b].addSelf(d.normal);g[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){g[d.a].addSelf(d.normal);g[d.b].addSelf(d.normal);g[d.c].addSelf(d.normal);g[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)g[a].normalize();a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(g[d.a]);
+d.vertexNormals[1].copy(g[d.b]);d.vertexNormals[2].copy(g[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(g[d.a]);d.vertexNormals[1].copy(g[d.b]);d.vertexNormals[2].copy(g[d.c]);d.vertexNormals[3].copy(g[d.d])}}},computeTangents:function(){function a(T,ga,ha,ja,O,ma,ka){m=T.vertices[ga].position;o=T.vertices[ha].position;t=T.vertices[ja].position;x=i[O];y=i[ma];B=i[ka];z=o.x-m.x;H=t.x-m.x;J=o.y-m.y;Q=t.y-m.y;K=o.z-m.z;ia=t.z-m.z;la=y.u-x.u;wa=B.u-x.u;S=y.v-x.v;E=B.v-x.v;fa=1/(la*E-
+wa*S);R.set((E*z-S*H)*fa,(E*J-S*Q)*fa,(E*K-S*ia)*fa);N.set((la*H-wa*z)*fa,(la*Q-wa*J)*fa,(la*ia-wa*K)*fa);b[ga].addSelf(R);b[ha].addSelf(R);b[ja].addSelf(R);ra[ga].addSelf(N);ra[ha].addSelf(N);ra[ja].addSelf(N)}var c,d,g,f,h,i,m,o,t,x,y,B,z,H,J,Q,K,ia,la,wa,S,E,fa,Y,b=[],ra=[],R=new THREE.Vector3,N=new THREE.Vector3,pa=new THREE.Vector3,Aa=new THREE.Vector3,Ba=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){b[c]=new THREE.Vector3;ra[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){h=
+this.faces[c];i=this.faceVertexUvs[0][c];if(h instanceof THREE.Face3)a(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){a(this,h.a,h.b,h.c,0,1,2);a(this,h.a,h.b,h.d,0,1,3)}}var sa=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(g=0;g<h.vertexNormals.length;g++){Ba.copy(h.vertexNormals[g]);f=h[sa[g]];Y=b[f];pa.copy(Y);pa.subSelf(Ba.multiplyScalar(Ba.dot(Y))).normalize();Aa.cross(h.vertexNormals[g],Y);f=Aa.dot(ra[f]);f=f<0?-1:1;h.vertexTangents[g]=new THREE.Vector4(pa.x,
+pa.y,pa.z,f)}}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;
+if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere=
 {radius:a}}};THREE.GeometryIdCounter=0;
-THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(e){for(var h=0;h<a.length;h++)a[h].update(e)};c.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};c.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};c.add=function(e){b[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");b[e.name]=e;if(e.initialized!==!0){for(var h=0;h<e.hierarchy.length;h++){for(var j=0;j<e.hierarchy[h].keys.length;j++){if(e.hierarchy[h].keys[j].time<
-0)e.hierarchy[h].keys[j].time=0;if(e.hierarchy[h].keys[j].rot!==undefined&&!(e.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var p=e.hierarchy[h].keys[j].rot;e.hierarchy[h].keys[j].rot=new THREE.Quaternion(p[0],p[1],p[2],p[3])}}if(e.hierarchy[h].keys[0].morphTargets!==undefined){p={};for(j=0;j<e.hierarchy[h].keys.length;j++)for(var n=0;n<e.hierarchy[h].keys[j].morphTargets.length;n++){var s=e.hierarchy[h].keys[j].morphTargets[n];p[s]=-1}e.hierarchy[h].usedMorphTargets=p;for(j=0;j<e.hierarchy[h].keys.length;j++){var x=
-{};for(s in p){for(n=0;n<e.hierarchy[h].keys[j].morphTargets.length;n++)if(e.hierarchy[h].keys[j].morphTargets[n]===s){x[s]=e.hierarchy[h].keys[j].morphTargetsInfluences[n];break}n===e.hierarchy[h].keys[j].morphTargets.length&&(x[s]=0)}e.hierarchy[h].keys[j].morphTargetsInfluences=x}}for(j=1;j<e.hierarchy[h].keys.length;j++)if(e.hierarchy[h].keys[j].time===e.hierarchy[h].keys[j-1].time){e.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<e.hierarchy[h].keys.length;j++)e.hierarchy[h].keys[j].index=j}j=parseInt(e.length*
-e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(h=0;h<e.hierarchy.length;h++)e.JIT.hierarchy.push(Array(j));e.initialized=!0}};c.get=function(e){if(typeof e==="string")if(b[e])return b[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};c.parse=function(e){var h=[];if(e instanceof THREE.SkinnedMesh)for(var j=0;j<e.bones.length;j++)h.push(e.bones[j]);else f(e,h);return h};var f=function(e,h){h.push(e);for(var j=0;j<e.children.length;j++)f(e.children[j],h)};c.LINEAR=
-0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,f){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==undefined?f:!0;this.points=[];this.target=new THREE.Vector3};
-THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,f=this.hierarchy.length,e;for(c=0;c<f;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
-e instanceof THREE.Bone?e.skinMatrix:e.matrix}var h=e.animationCache.prevKey;e=e.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
+THREE.AnimationHandler=function(){var a=[],c={},d={};d.update=function(f){for(var h=0;h<a.length;h++)a[h].update(f)};d.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};d.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};d.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var h=0;h<f.hierarchy.length;h++){for(var i=0;i<f.hierarchy[h].keys.length;i++){if(f.hierarchy[h].keys[i].time<
+0)f.hierarchy[h].keys[i].time=0;if(f.hierarchy[h].keys[i].rot!==undefined&&!(f.hierarchy[h].keys[i].rot instanceof THREE.Quaternion)){var m=f.hierarchy[h].keys[i].rot;f.hierarchy[h].keys[i].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(f.hierarchy[h].keys[0].morphTargets!==undefined){m={};for(i=0;i<f.hierarchy[h].keys.length;i++)for(var o=0;o<f.hierarchy[h].keys[i].morphTargets.length;o++){var t=f.hierarchy[h].keys[i].morphTargets[o];m[t]=-1}f.hierarchy[h].usedMorphTargets=m;for(i=0;i<f.hierarchy[h].keys.length;i++){var x=
+{};for(t in m){for(o=0;o<f.hierarchy[h].keys[i].morphTargets.length;o++)if(f.hierarchy[h].keys[i].morphTargets[o]===t){x[t]=f.hierarchy[h].keys[i].morphTargetsInfluences[o];break}o===f.hierarchy[h].keys[i].morphTargets.length&&(x[t]=0)}f.hierarchy[h].keys[i].morphTargetsInfluences=x}}for(i=1;i<f.hierarchy[h].keys.length;i++)if(f.hierarchy[h].keys[i].time===f.hierarchy[h].keys[i-1].time){f.hierarchy[h].keys.splice(i,1);i--}for(i=1;i<f.hierarchy[h].keys.length;i++)f.hierarchy[h].keys[i].index=i}i=parseInt(f.length*
+f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(h=0;h<f.hierarchy.length;h++)f.JIT.hierarchy.push(Array(i));f.initialized=!0}};d.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};d.parse=function(f){var h=[];if(f instanceof THREE.SkinnedMesh)for(var i=0;i<f.bones.length;i++)h.push(f.bones[i]);else g(f,h);return h};var g=function(f,h){h.push(f);for(var i=0;i<f.children.length;i++)g(f.children[i],h)};d.LINEAR=
+0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(a,c,d,g){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=d!==undefined?d:THREE.AnimationHandler.LINEAR;this.JITCompile=g!==undefined?g:!0;this.points=[];this.target=new THREE.Vector3};
+THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var d,g=this.hierarchy.length,f;for(d=0;d<g;d++){f=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
+f instanceof THREE.Bone?f.skinMatrix:f.matrix}var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[d].keys[0];h.rot=this.data.hierarchy[d].keys[0];h.scl=this.data.hierarchy[d].keys[0];f.pos=this.getNextKeyWith("pos",d,1);f.rot=this.getNextKeyWith("rot",d,1);f.scl=this.getNextKeyWith("scl",d,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
 THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
 THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,f,e,h,j,p,n,s,x=this.data.JIT.hierarchy,z,C;this.currentTime+=a*this.timeScale;C=this.currentTime;z=this.currentTime%=this.data.length;s=parseInt(Math.min(z*this.data.fps,this.data.length*this.data.fps),10);for(var y=0,J=this.hierarchy.length;y<J;y++){a=this.hierarchy[y];n=a.animationCache;if(this.JITCompile&&x[y][s]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=x[y][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=x[y][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var K=0;K<3;K++){c=b[K];j=n.prevKey[c];p=n.nextKey[c];if(p.time<=C){if(z<C)if(this.loop){j=this.data.hierarchy[y].keys[0];for(p=this.getNextKeyWith(c,y,1);p.time<z;){j=p;p=this.getNextKeyWith(c,y,p.index+1)}}else{this.stop();return}else{do{j=p;p=this.getNextKeyWith(c,y,p.index+1)}while(p.time<
-z)}n.prevKey[c]=j;n.nextKey[c]=p}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;f=(z-j.time)/(p.time-j.time);e=j[c];h=p[c];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+y);f=f<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(h[0]-e[0])*f;c.y=e[1]+(h[1]-e[1])*f;c.z=e[2]+(h[2]-e[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
-this.getPrevKeyWith("pos",y,j.index-1).pos;this.points[1]=e;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",y,p.index+1).pos;f=f*0.33+0.33;e=this.interpolateCatmullRom(this.points,f);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,f,0)}}}else if(c===
-"rot")THREE.Quaternion.slerp(e,h,a.quaternion,f);else if(c==="scl"){c=a.scale;c.x=e[0]+(h[0]-e[0])*f;c.y=e[1]+(h[1]-e[1])*f;c.z=e[2]+(h[2]-e[2])*f}}}}if(this.JITCompile&&x[0][s]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y<this.hierarchy.length;y++)x[y][s]=this.hierarchy[y]instanceof THREE.Bone?this.hierarchy[y].skinMatrix.clone():this.hierarchy[y].matrix.clone()}}};
-THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],f=[],e,h,j,p,n,s;e=(a.length-1)*b;h=Math.floor(e);e-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];p=a[c[1]];n=a[c[2]];s=a[c[3]];c=e*e;j=e*c;f[0]=this.interpolate(h[0],p[0],n[0],s[0],e,c,j);f[1]=this.interpolate(h[1],p[1],n[1],s[1],e,c,j);f[2]=this.interpolate(h[2],p[2],n[2],s[2],e,c,j);return f};
-THREE.Animation.prototype.interpolate=function(a,b,c,f,e,h,j){a=(c-a)*0.5;f=(f-b)*0.5;return(2*(b-c)+a+f)*j+(-3*(b-c)-2*a-f)*h+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var f=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<f.length-1?c:f.length-1;else c%=f.length;for(;c<f.length;c++)if(f[c][a]!==undefined)return f[c];return this.data.hierarchy[b].keys[0]};
-THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var f=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][a]!==undefined)return f[c];return this.data.hierarchy[b].keys[f.length-1]};
-THREE.Camera=function(a,b,c,f,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=f||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
-THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
-THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
-!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
-THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],d,g,f,h,i,m,o,t,x=this.data.JIT.hierarchy,y,B;this.currentTime+=a*this.timeScale;B=this.currentTime;y=this.currentTime%=this.data.length;t=parseInt(Math.min(y*this.data.fps,this.data.length*this.data.fps),10);for(var z=0,H=this.hierarchy.length;z<H;z++){a=this.hierarchy[z];o=a.animationCache;if(this.JITCompile&&x[z][t]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=x[z][t];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=x[z][t];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var J=0;J<3;J++){d=c[J];i=o.prevKey[d];m=o.nextKey[d];if(m.time<=B){if(y<B)if(this.loop){i=this.data.hierarchy[z].keys[0];for(m=this.getNextKeyWith(d,z,1);m.time<y;){i=m;m=this.getNextKeyWith(d,z,m.index+1)}}else{this.stop();return}else{do{i=m;m=this.getNextKeyWith(d,z,m.index+1)}while(m.time<
+y)}o.prevKey[d]=i;o.nextKey[d]=m}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;g=(y-i.time)/(m.time-i.time);f=i[d];h=m[d];if(g<0||g>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+g+" on bone "+z);g=g<0?0:1}if(d==="pos"){d=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=f[0]+(h[0]-f[0])*g;d.y=f[1]+(h[1]-f[1])*g;d.z=f[2]+(h[2]-f[2])*g}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",z,i.index-1).pos;this.points[1]=f;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",z,m.index+1).pos;g=g*0.33+0.33;f=this.interpolateCatmullRom(this.points,g);d.x=f[0];d.y=f[1];d.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){g=this.interpolateCatmullRom(this.points,g*1.01);this.target.set(g[0],g[1],g[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();g=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,g,0)}}}else if(d===
+"rot")THREE.Quaternion.slerp(f,h,a.quaternion,g);else if(d==="scl"){d=a.scale;d.x=f[0]+(h[0]-f[0])*g;d.y=f[1]+(h[1]-f[1])*g;d.z=f[2]+(h[2]-f[2])*g}}}}if(this.JITCompile&&x[0][t]===undefined){this.hierarchy[0].update(undefined,!0);for(z=0;z<this.hierarchy.length;z++)x[z][t]=this.hierarchy[z]instanceof THREE.Bone?this.hierarchy[z].skinMatrix.clone():this.hierarchy[z].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var d=[],g=[],f,h,i,m,o,t;f=(a.length-1)*c;h=Math.floor(f);f-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>a.length-2?h:h+1;d[3]=h>a.length-3?h:h+2;h=a[d[0]];m=a[d[1]];o=a[d[2]];t=a[d[3]];d=f*f;i=f*d;g[0]=this.interpolate(h[0],m[0],o[0],t[0],f,d,i);g[1]=this.interpolate(h[1],m[1],o[1],t[1],f,d,i);g[2]=this.interpolate(h[2],m[2],o[2],t[2],f,d,i);return g};
+THREE.Animation.prototype.interpolate=function(a,c,d,g,f,h,i){a=(d-a)*0.5;g=(g-c)*0.5;return(2*(c-d)+a+g)*i+(-3*(c-d)-2*a-g)*h+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,d){var g=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d<g.length-1?d:g.length-1;else d%=g.length;for(;d<g.length;d++)if(g[d][a]!==undefined)return g[d];return this.data.hierarchy[c].keys[0]};
+THREE.Animation.prototype.getPrevKeyWith=function(a,c,d){var g=this.data.hierarchy[c].keys;for(d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+g.length;d>=0;d--)if(g[d][a]!==undefined)return g[d];return this.data.hierarchy[c].keys[g.length-1]};
+THREE.Camera=function(a,c,d,g,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=d||0.1;this.far=g||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
+THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
+THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
+!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
+THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
 THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
 THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
@@ -109,48 +109,54 @@ undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.unifor
 if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
 THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
 a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
-THREE.Texture=function(a,b,c,f,e,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=f!==undefined?f:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
+THREE.ShadowVolumeDynamicMaterial=function(){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=
+!1};THREE.Texture=function(a,c,d,g,f,h){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=g!==undefined?g:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
 THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
 THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
-THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
-var Uniforms={clone:function(a){var b,c,f,e={};for(b in a){e[b]={};for(c in a[b]){f=a[b][c];e[b][c]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return e},merge:function(a){var b,c,f,e={};for(b=0;b<a.length;b++){f=this.clone(a[b]);for(c in f)e[c]=f[c]}return e}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
-THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
+THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
+var Uniforms={clone:function(a){var c,d,g,f={};for(c in a){f[c]={};for(d in a[c]){g=a[c][d];f[c][d]=g instanceof THREE.Color||g instanceof THREE.Vector3||g instanceof THREE.Texture?g.clone():g}}return f},merge:function(a){var c,d,g,f={};for(c=0;c<a.length;c++){g=this.clone(a[c]);for(d in g)f[d]=g[d]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
+THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
 THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
-THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
-this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
+THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++){this.morphTargetInfluences.push(0);
+this.morphTargetDictionary[this.geometry.morphTargets[d].name]=d}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
-THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<e;f++){a=this.children[f];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(f=0;f<e;f++)this.children[f].update(this.skinMatrix,
-b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
-THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,f,e,h,j,p;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){e=this.geometry.bones[c];h=e.pos;j=e.rotq;p=e.scl;f=this.addBone();f.name=e.name;f.position.set(h[0],h[1],h[2]);f.quaternion.set(j[0],j[1],j[2],j[3]);f.useQuaternion=!0;p!==undefined?f.scale.set(p[0],p[1],p[2]):f.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){e=this.geometry.bones[c];
-f=this.bones[c];e.parent===-1?this.addChild(f):this.bones[e.parent].addChild(f)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
-THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f,e=this.children.length;for(f=0;f<e;f++){a=this.children[f];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.matrixWorld,b,c)}c=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<c;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
-b*16)}};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 f;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var e=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;
-f=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[e].multiplyVector3(f));f=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[h].multiplyVector3(f));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.Sound=function(a,b,c,f){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=f!==undefined?f:!0;this.sources=a instanceof Array?a:[a];var e;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)e=
-"audio/mpeg";else if(b.indexOf(".ogg")!==-1)e="audio/ogg";else b.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
+THREE.Bone.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(g=0;g<f;g++){a=this.children[g];a instanceof THREE.Bone?a.update(this.skinMatrix,c,d):a.update(this.matrixWorld,!0,d)}}else for(g=0;g<f;g++)this.children[g].update(this.skinMatrix,
+c,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
+THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,g,f,h,i,m;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){f=this.geometry.bones[d];h=f.pos;i=f.rotq;m=f.scl;g=this.addBone();g.name=f.name;g.position.set(h[0],h[1],h[2]);g.quaternion.set(i[0],i[1],i[2],i[3]);g.useQuaternion=!0;m!==undefined?g.scale.set(m[0],m[1],m[2]):g.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){f=this.geometry.bones[d];
+g=this.bones[d];f.parent===-1?this.addChild(g):this.bones[f.parent].addChild(g)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
+THREE.SkinnedMesh.prototype.update=function(a,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g,f=this.children.length;for(g=0;g<f;g++){a=this.children[g];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.matrixWorld,c,d)}d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
+c*16)}};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,c=[],d=0;d<this.bones.length;d++){a=this.bones[d];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var g;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;
+g=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(c[f].multiplyVector3(g));g=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(g));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){d=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=d;this.geometry.skinWeights[a].y+=d}}}};
+THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
+THREE.Sound=function(a,c,d,g){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=g!==undefined?g:!0;this.sources=a instanceof Array?a:[a];var f;d=this.sources.length;for(a=0;a<d;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)f=
+"audio/mpeg";else if(c.indexOf(".ogg")!==-1)f="audio/ogg";else c.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
 THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
 THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
-THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f=this.children.length;for(a=0;a<f;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
-THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,b){b===undefined&&(b=0);b=Math.abs(b);for(var c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.addChild(a)};
-THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}if(this.LODs.length>1){a=c.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(a>=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible=
-!1;this.LODs[f].object3D.visible=!0}else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
-THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
-THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
-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!==undefined?b:2.5E-4};
-THREE.Projector=function(){function a(){var Q=n[p]=n[p]||new THREE.RenderableVertex;p++;return Q}function b(Q,N){return N.z-Q.z}function c(Q,N){var pa=0,ya=1,Da=Q.z+Q.w,qa=N.z+N.w,V=-Q.z+Q.w,ha=-N.z+N.w;if(Da>=0&&qa>=0&&V>=0&&ha>=0)return!0;else if(Da<0&&qa<0||V<0&&ha<0)return!1;else{if(Da<0)pa=Math.max(pa,Da/(Da-qa));else qa<0&&(ya=Math.min(ya,Da/(Da-qa)));if(V<0)pa=Math.max(pa,V/(V-ha));else ha<0&&(ya=Math.min(ya,V/(V-ha)));if(ya<pa)return!1;else{Q.lerpSelf(N,pa);N.lerpSelf(Q,1-ya);return!0}}}var f,
-e,h=[],j,p,n=[],s,x,z=[],C,y=[],J,K,P=[],L,ja,ma=[],sa=new THREE.Vector4,U=new THREE.Vector4,A=new THREE.Matrix4,oa=new THREE.Matrix4,d=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ba=new THREE.Vector4,Ca=new THREE.Vector4;this.projectVector=function(Q,N){A.multiply(N.projectionMatrix,N.matrixWorldInverse);A.multiplyVector3(Q);return Q};this.unprojectVector=function(Q,N){A.multiply(N.matrixWorld,THREE.Matrix4.makeInvert(N.projectionMatrix));
-A.multiplyVector3(Q);return Q};this.projectObjects=function(Q,N,pa){N=[];var ya,Da,qa;e=0;Da=Q.objects;Q=0;for(ya=Da.length;Q<ya;Q++){qa=Da[Q];var V;if(!(V=!qa.visible))if(V=qa instanceof THREE.Mesh){a:{V=void 0;for(var ha=qa.matrixWorld,ia=-qa.geometry.boundingSphere.radius*Math.max(qa.scale.x,Math.max(qa.scale.y,qa.scale.z)),W=0;W<6;W++){V=d[W].x*ha.n14+d[W].y*ha.n24+d[W].z*ha.n34+d[W].w;if(V<=ia){V=!1;break a}}V=!0}V=!V}if(!V){V=h[e]=h[e]||new THREE.RenderableObject;e++;f=V;sa.copy(qa.position);
-A.multiplyVector3(sa);f.object=qa;f.z=sa.z;N.push(f)}}pa&&N.sort(b);return N};this.projectScene=function(Q,N,pa){var ya=[],Da=N.near,qa=N.far,V,ha,ia,W,S,ta,ka,za,La,la,Na,Wa,g,m,o,i,k;ja=K=C=x=0;N.matrixAutoUpdate&&N.updateMatrix();Q.update(undefined,!1,N);A.multiply(N.projectionMatrix,N.matrixWorldInverse);d[0].set(A.n41-A.n11,A.n42-A.n12,A.n43-A.n13,A.n44-A.n14);d[1].set(A.n41+A.n11,A.n42+A.n12,A.n43+A.n13,A.n44+A.n14);d[2].set(A.n41+A.n21,A.n42+A.n22,A.n43+A.n23,A.n44+A.n24);d[3].set(A.n41-A.n21,
-A.n42-A.n22,A.n43-A.n23,A.n44-A.n24);d[4].set(A.n41-A.n31,A.n42-A.n32,A.n43-A.n33,A.n44-A.n34);d[5].set(A.n41+A.n31,A.n42+A.n32,A.n43+A.n33,A.n44+A.n34);for(V=0;V<6;V++){La=d[V];La.divideScalar(Math.sqrt(La.x*La.x+La.y*La.y+La.z*La.z))}La=this.projectObjects(Q,N,!0);Q=0;for(V=La.length;Q<V;Q++){la=La[Q].object;if(la.visible){Na=la.matrixWorld;Wa=la.matrixRotationWorld;g=la.materials;m=la.overdraw;p=0;if(la instanceof THREE.Mesh){o=la.geometry;W=o.vertices;i=o.faces;o=o.faceVertexUvs;ha=0;for(ia=W.length;ha<
-ia;ha++){j=a();j.positionWorld.copy(W[ha].position);Na.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);A.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Da&&j.positionScreen.z<qa}W=0;for(ha=i.length;W<ha;W++){ia=i[W];if(ia instanceof THREE.Face3){S=n[ia.a];ta=n[ia.b];ka=n[ia.c];if(S.visible&&ta.visible&&ka.visible&&(la.doubleSided||la.flipSided!=(ka.positionScreen.x-S.positionScreen.x)*
-(ta.positionScreen.y-S.positionScreen.y)-(ka.positionScreen.y-S.positionScreen.y)*(ta.positionScreen.x-S.positionScreen.x)<0)){za=z[x]=z[x]||new THREE.RenderableFace3;x++;s=za;s.v1.copy(S);s.v2.copy(ta);s.v3.copy(ka)}else continue}else if(ia instanceof THREE.Face4){S=n[ia.a];ta=n[ia.b];ka=n[ia.c];za=n[ia.d];if(S.visible&&ta.visible&&ka.visible&&za.visible&&(la.doubleSided||la.flipSided!=((za.positionScreen.x-S.positionScreen.x)*(ta.positionScreen.y-S.positionScreen.y)-(za.positionScreen.y-S.positionScreen.y)*
-(ta.positionScreen.x-S.positionScreen.x)<0||(ta.positionScreen.x-ka.positionScreen.x)*(za.positionScreen.y-ka.positionScreen.y)-(ta.positionScreen.y-ka.positionScreen.y)*(za.positionScreen.x-ka.positionScreen.x)<0))){k=y[C]=y[C]||new THREE.RenderableFace4;C++;s=k;s.v1.copy(S);s.v2.copy(ta);s.v3.copy(ka);s.v4.copy(za)}else continue}s.normalWorld.copy(ia.normal);Wa.multiplyVector3(s.normalWorld);s.centroidWorld.copy(ia.centroid);Na.multiplyVector3(s.centroidWorld);s.centroidScreen.copy(s.centroidWorld);
-A.multiplyVector3(s.centroidScreen);ka=ia.vertexNormals;S=0;for(ta=ka.length;S<ta;S++){za=s.vertexNormalsWorld[S];za.copy(ka[S]);Wa.multiplyVector3(za)}S=0;for(ta=o.length;S<ta;S++)if(k=o[S][W]){ka=0;for(za=k.length;ka<za;ka++)s.uvs[S][ka]=k[ka]}s.meshMaterials=g;s.faceMaterials=ia.materials;s.overdraw=m;s.z=s.centroidScreen.z;ya.push(s)}}else if(la instanceof THREE.Line){oa.multiply(A,Na);W=la.geometry.vertices;S=a();S.positionScreen.copy(W[0].position);oa.multiplyVector4(S.positionScreen);ha=1;
-for(ia=W.length;ha<ia;ha++){S=a();S.positionScreen.copy(W[ha].position);oa.multiplyVector4(S.positionScreen);ta=n[p-2];Ba.copy(S.positionScreen);Ca.copy(ta.positionScreen);if(c(Ba,Ca)){Ba.multiplyScalar(1/Ba.w);Ca.multiplyScalar(1/Ca.w);Na=P[K]=P[K]||new THREE.RenderableLine;K++;J=Na;J.v1.positionScreen.copy(Ba);J.v2.positionScreen.copy(Ca);J.z=Math.max(Ba.z,Ca.z);J.materials=la.materials;ya.push(J)}}}else if(la instanceof THREE.Particle){U.set(la.position.x,la.position.y,la.position.z,1);A.multiplyVector4(U);
-U.z/=U.w;if(U.z>0&&U.z<1){Na=ma[ja]=ma[ja]||new THREE.RenderableParticle;ja++;L=Na;L.x=U.x/U.w;L.y=U.y/U.w;L.z=U.z;L.rotation=la.rotation.z;L.scale.x=la.scale.x*Math.abs(L.x-(U.x+N.projectionMatrix.n11)/(U.w+N.projectionMatrix.n14));L.scale.y=la.scale.y*Math.abs(L.y-(U.y+N.projectionMatrix.n22)/(U.w+N.projectionMatrix.n24));L.materials=la.materials;ya.push(L)}}}}pa&&ya.sort(b);return ya}};
-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 f,e=c.length;for(f=0;f<e;f++){a=c[f];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
+THREE.Sound.prototype.update=function(a,c,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g=this.children.length;for(a=0;a<g;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
+THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,c){c===undefined&&(c=0);c=Math.abs(c);for(var d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:a});this.addChild(a)};
+THREE.LOD.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){a=d.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var g=1;g<this.LODs.length;g++)if(a>=this.LODs[g].visibleAtDistance){this.LODs[g-1].object3D.visible=
+!1;this.LODs[g].object3D.visible=!0}else break;for(;g<this.LODs.length;g++)this.LODs[g].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.ShadowVolume=function(a,c){THREE.Mesh.call(this,a.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);a.addChild(this);this.calculateShadowVolumeGeometry(a.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
+THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(a){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=a.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,g=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var h=f.length,i,m,o,t,x,y=["a","b","c","d"];for(o=0;o<h;o++){m=c.length;i=f[o];if(i instanceof THREE.Face4){t=4;m=new THREE.Face4(m,m+1,m+2,m+3)}else{t=3;m=new THREE.Face3(m,m+1,m+2)}m.normal.copy(i.normal);d.push(m);for(m=
+0;m<t;m++){x=a[i[y[m]]];c.push(new THREE.Vertex(x.position.clone()))}}for(h=0;h<f.length-1;h++){a=d[h];for(i=h+1;i<f.length;i++){m=d[i];m=this.facesShareEdge(c,a,m);if(m!==undefined){m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]);m.normal.set(1,0,0);g.push(m)}}}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,d){var g,f,h,i,m,o,t,x,y,B,z,H,J,Q=0,K=["a","b","c","d"];g=c instanceof THREE.Face4?4:3;f=d instanceof THREE.Face4?4:3;for(H=0;H<g;H++){h=c[K[H]];m=a[h];for(J=0;J<f;J++){i=d[K[J]];o=a[i];if(Math.abs(m.position.x-o.position.x)<1.0E-4&&Math.abs(m.position.y-o.position.y)<1.0E-4&&Math.abs(m.position.z-o.position.z)<1.0E-4){Q++;if(Q===1){t=m;x=o;y=h;B=i;z=K[H]}if(Q===2){z+=K[H];return z==="ad"||z==="ac"?{faces:[c,d],vertices:[t,x,o,m],indices:[y,
+B,i,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[t,m,o,x],indices:[y,h,i,B],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
+THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
+THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
+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,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
+THREE.Projector=function(){function a(){var R=o[m]=o[m]||new THREE.RenderableVertex;m++;return R}function c(R,N){return N.z-R.z}function d(R,N){var pa=0,Aa=1,Ba=R.z+R.w,sa=N.z+N.w,T=-R.z+R.w,ga=-N.z+N.w;if(Ba>=0&&sa>=0&&T>=0&&ga>=0)return!0;else if(Ba<0&&sa<0||T<0&&ga<0)return!1;else{if(Ba<0)pa=Math.max(pa,Ba/(Ba-sa));else sa<0&&(Aa=Math.min(Aa,Ba/(Ba-sa)));if(T<0)pa=Math.max(pa,T/(T-ga));else ga<0&&(Aa=Math.min(Aa,T/(T-ga)));if(Aa<pa)return!1;else{R.lerpSelf(N,pa);N.lerpSelf(R,1-Aa);return!0}}}var g,
+f,h=[],i,m,o=[],t,x,y=[],B,z=[],H,J,Q=[],K,ia,la=[],wa=new THREE.Vector4,S=new THREE.Vector4,E=new THREE.Matrix4,fa=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],b=new THREE.Vector4,ra=new THREE.Vector4;this.projectVector=function(R,N){E.multiply(N.projectionMatrix,N.matrixWorldInverse);E.multiplyVector3(R);return R};this.unprojectVector=function(R,N){E.multiply(N.matrixWorld,THREE.Matrix4.makeInvert(N.projectionMatrix));
+E.multiplyVector3(R);return R};this.projectObjects=function(R,N,pa){N=[];var Aa,Ba,sa;f=0;Ba=R.objects;R=0;for(Aa=Ba.length;R<Aa;R++){sa=Ba[R];var T;if(!(T=!sa.visible))if(T=sa instanceof THREE.Mesh){a:{T=void 0;for(var ga=sa.matrixWorld,ha=-sa.geometry.boundingSphere.radius*Math.max(sa.scale.x,Math.max(sa.scale.y,sa.scale.z)),ja=0;ja<6;ja++){T=Y[ja].x*ga.n14+Y[ja].y*ga.n24+Y[ja].z*ga.n34+Y[ja].w;if(T<=ha){T=!1;break a}}T=!0}T=!T}if(!T){T=h[f]=h[f]||new THREE.RenderableObject;f++;g=T;wa.copy(sa.position);
+E.multiplyVector3(wa);g.object=sa;g.z=wa.z;N.push(g)}}pa&&N.sort(c);return N};this.projectScene=function(R,N,pa){var Aa=[],Ba=N.near,sa=N.far,T,ga,ha,ja,O,ma,ka,Ca,Fa,na,Ea,Wa,Ya,xa,e,p,n;ia=J=B=x=0;N.matrixAutoUpdate&&N.updateMatrix();R.update(undefined,!1,N);E.multiply(N.projectionMatrix,N.matrixWorldInverse);Y[0].set(E.n41-E.n11,E.n42-E.n12,E.n43-E.n13,E.n44-E.n14);Y[1].set(E.n41+E.n11,E.n42+E.n12,E.n43+E.n13,E.n44+E.n14);Y[2].set(E.n41+E.n21,E.n42+E.n22,E.n43+E.n23,E.n44+E.n24);Y[3].set(E.n41-
+E.n21,E.n42-E.n22,E.n43-E.n23,E.n44-E.n24);Y[4].set(E.n41-E.n31,E.n42-E.n32,E.n43-E.n33,E.n44-E.n34);Y[5].set(E.n41+E.n31,E.n42+E.n32,E.n43+E.n33,E.n44+E.n34);for(T=0;T<6;T++){Fa=Y[T];Fa.divideScalar(Math.sqrt(Fa.x*Fa.x+Fa.y*Fa.y+Fa.z*Fa.z))}Fa=this.projectObjects(R,N,!0);R=0;for(T=Fa.length;R<T;R++){na=Fa[R].object;if(na.visible){Ea=na.matrixWorld;Wa=na.matrixRotationWorld;Ya=na.materials;xa=na.overdraw;m=0;if(na instanceof THREE.Mesh){e=na.geometry;ja=e.vertices;p=e.faces;e=e.faceVertexUvs;ga=0;
+for(ha=ja.length;ga<ha;ga++){i=a();i.positionWorld.copy(ja[ga].position);Ea.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);E.multiplyVector4(i.positionScreen);i.positionScreen.x/=i.positionScreen.w;i.positionScreen.y/=i.positionScreen.w;i.visible=i.positionScreen.z>Ba&&i.positionScreen.z<sa}ja=0;for(ga=p.length;ja<ga;ja++){ha=p[ja];if(ha instanceof THREE.Face3){O=o[ha.a];ma=o[ha.b];ka=o[ha.c];if(O.visible&&ma.visible&&ka.visible&&(na.doubleSided||na.flipSided!=(ka.positionScreen.x-
+O.positionScreen.x)*(ma.positionScreen.y-O.positionScreen.y)-(ka.positionScreen.y-O.positionScreen.y)*(ma.positionScreen.x-O.positionScreen.x)<0)){Ca=y[x]=y[x]||new THREE.RenderableFace3;x++;t=Ca;t.v1.copy(O);t.v2.copy(ma);t.v3.copy(ka)}else continue}else if(ha instanceof THREE.Face4){O=o[ha.a];ma=o[ha.b];ka=o[ha.c];Ca=o[ha.d];if(O.visible&&ma.visible&&ka.visible&&Ca.visible&&(na.doubleSided||na.flipSided!=((Ca.positionScreen.x-O.positionScreen.x)*(ma.positionScreen.y-O.positionScreen.y)-(Ca.positionScreen.y-
+O.positionScreen.y)*(ma.positionScreen.x-O.positionScreen.x)<0||(ma.positionScreen.x-ka.positionScreen.x)*(Ca.positionScreen.y-ka.positionScreen.y)-(ma.positionScreen.y-ka.positionScreen.y)*(Ca.positionScreen.x-ka.positionScreen.x)<0))){n=z[B]=z[B]||new THREE.RenderableFace4;B++;t=n;t.v1.copy(O);t.v2.copy(ma);t.v3.copy(ka);t.v4.copy(Ca)}else continue}t.normalWorld.copy(ha.normal);Wa.multiplyVector3(t.normalWorld);t.centroidWorld.copy(ha.centroid);Ea.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);
+E.multiplyVector3(t.centroidScreen);ka=ha.vertexNormals;O=0;for(ma=ka.length;O<ma;O++){Ca=t.vertexNormalsWorld[O];Ca.copy(ka[O]);Wa.multiplyVector3(Ca)}O=0;for(ma=e.length;O<ma;O++)if(n=e[O][ja]){ka=0;for(Ca=n.length;ka<Ca;ka++)t.uvs[O][ka]=n[ka]}t.meshMaterials=Ya;t.faceMaterials=ha.materials;t.overdraw=xa;t.z=t.centroidScreen.z;Aa.push(t)}}else if(na instanceof THREE.Line){fa.multiply(E,Ea);ja=na.geometry.vertices;O=a();O.positionScreen.copy(ja[0].position);fa.multiplyVector4(O.positionScreen);
+ga=1;for(ha=ja.length;ga<ha;ga++){O=a();O.positionScreen.copy(ja[ga].position);fa.multiplyVector4(O.positionScreen);ma=o[m-2];b.copy(O.positionScreen);ra.copy(ma.positionScreen);if(d(b,ra)){b.multiplyScalar(1/b.w);ra.multiplyScalar(1/ra.w);Ea=Q[J]=Q[J]||new THREE.RenderableLine;J++;H=Ea;H.v1.positionScreen.copy(b);H.v2.positionScreen.copy(ra);H.z=Math.max(b.z,ra.z);H.materials=na.materials;Aa.push(H)}}}else if(na instanceof THREE.Particle){S.set(na.position.x,na.position.y,na.position.z,1);E.multiplyVector4(S);
+S.z/=S.w;if(S.z>0&&S.z<1){Ea=la[ia]=la[ia]||new THREE.RenderableParticle;ia++;K=Ea;K.x=S.x/S.w;K.y=S.y/S.w;K.z=S.z;K.rotation=na.rotation.z;K.scale.x=na.scale.x*Math.abs(K.x-(S.x+N.projectionMatrix.n11)/(S.w+N.projectionMatrix.n14));K.scale.y=na.scale.y*Math.abs(K.y-(S.y+N.projectionMatrix.n22)/(S.w+N.projectionMatrix.n24));K.materials=na.materials;Aa.push(K)}}}}pa&&Aa.sort(c);return Aa}};
+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,c,d){d&&a.update(undefined,!1,c);d=a.sounds;var g,f=d.length;for(g=0;g<f;g++){a=d[g];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
 THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
 envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
 envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -164,90 +170,98 @@ default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = pr
 THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f",
 value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",
 value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
-THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
-value:1}},fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,
-THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,
-THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),
-fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,
-THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
-THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",
+THREE.ShaderLib={shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, 0.5 );\n}"},shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos      = objectMatrix * vec4( position, 1.0 );\nvec3 norm     = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position   = projectionMatrix * viewMatrix * ( pos + extruded );\n}",fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},
+depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},
+fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,
+THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,
+THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
+THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",
+THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",
+THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.lights_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),
 vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
 THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.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.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
 THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
-THREE.WebGLRenderer=function(a){function b(g,m,o){var i,k,t,q=g.vertices,r=q.length,D=g.colors,w=D.length,v=g.__vertexArray,M=g.__colorArray,X=g.__sortArray,G=g.__dirtyVertices,R=g.__dirtyColors;if(o.sortParticles){S.multiplySelf(o.matrixWorld);for(i=0;i<r;i++){k=q[i].position;za.copy(k);S.multiplyVector3(za);X[i]=[za.z,i]}X.sort(function(H,Z){return Z[0]-H[0]});for(i=0;i<r;i++){k=q[X[i][1]].position;t=i*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}for(i=0;i<w;i++){t=i*3;color=D[X[i][1]];M[t]=color.r;M[t+1]=
-color.g;M[t+2]=color.b}}else{if(G)for(i=0;i<r;i++){k=q[i].position;t=i*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}if(R)for(i=0;i<w;i++){color=D[i];t=i*3;M[t]=color.r;M[t+1]=color.g;M[t+2]=color.b}}if(G||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,v,m)}if(R||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,M,m)}}function c(g,m){g.fragmentShader=m.fragmentShader;g.vertexShader=m.vertexShader;g.uniforms=Uniforms.clone(m.uniforms)}
-function f(g,m,o,i,k){i.program||Q.initMaterial(i,m,o,k);var t=i.program,q=t.uniforms,r=i.uniforms;if(t!=Ba){d.useProgram(t);Ba=t}d.uniformMatrix4fv(q.projectionMatrix,!1,ta);if(o&&(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial||i instanceof THREE.LineBasicMaterial||i instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){r.fogNear.value=o.near;r.fogFar.value=o.far}else if(o instanceof
-THREE.FogExp2)r.fogDensity.value=o.density}if(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i.lights){var D,w,v=0,M=0,X=0,G,R,H,Z=La,Ga=Z.directional.colors,T=Z.directional.positions,$=Z.point.colors,B=Z.point.positions,Aa=0,Y=0;o=w=w=0;for(D=m.length;o<D;o++){w=m[o];G=w.color;R=w.position;H=w.intensity;if(w instanceof THREE.AmbientLight){v+=G.r;M+=G.g;X+=G.b}else if(w instanceof THREE.DirectionalLight){w=Aa*3;Ga[w]=G.r*H;Ga[w+1]=G.g*H;Ga[w+2]=G.b*H;T[w]=R.x;T[w+1]=
-R.y;T[w+2]=R.z;Aa+=1}else if(w instanceof THREE.PointLight){w=Y*3;$[w]=G.r*H;$[w+1]=G.g*H;$[w+2]=G.b*H;B[w]=R.x;B[w+1]=R.y;B[w+2]=R.z;Y+=1}}for(o=Aa*3;o<Ga.length;o++)Ga[o]=0;for(o=Y*3;o<$.length;o++)$[o]=0;Z.point.length=Y;Z.directional.length=Aa;Z.ambient[0]=v;Z.ambient[1]=M;Z.ambient[2]=X;m=La;r.enableLighting.value=m.directional.length+m.point.length;r.ambientLightColor.value=m.ambient;r.directionalLightColor.value=m.directional.colors;r.directionalLightDirection.value=m.directional.positions;
-r.pointLightColor.value=m.point.colors;r.pointLightPosition.value=m.point.positions}if(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity;r.map.texture=i.map;r.lightMap.texture=i.lightMap;r.envMap.texture=i.envMap;r.reflectivity.value=i.reflectivity;r.refractionRatio.value=i.refractionRatio;r.combine.value=i.combine;r.useRefract.value=
-i.envMap&&i.envMap.mapping instanceof THREE.CubeRefractionMapping}if(i instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity}else if(i instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity;r.size.value=i.size;r.scale.value=oa.height/2;r.map.texture=i.map}else if(i instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(i.ambient.r,
-i.ambient.g,i.ambient.b);r.specular.value.setRGB(i.specular.r,i.specular.g,i.specular.b);r.shininess.value=i.shininess}else if(i instanceof THREE.MeshDepthMaterial){r.mNear.value=g.near;r.mFar.value=g.far;r.opacity.value=i.opacity}else if(i instanceof THREE.MeshNormalMaterial)r.opacity.value=i.opacity;for(var Ha in r)if(v=t.uniforms[Ha]){o=r[Ha];D=o.type;m=o.value;if(D=="i")d.uniform1i(v,m);else if(D=="f")d.uniform1f(v,m);else if(D=="fv1")d.uniform1fv(v,m);else if(D=="fv")d.uniform3fv(v,m);else if(D==
-"v2")d.uniform2f(v,m.x,m.y);else if(D=="v3")d.uniform3f(v,m.x,m.y,m.z);else if(D=="c")d.uniform3f(v,m.r,m.g,m.b);else if(D=="t"){d.uniform1i(v,m);if(o=o.texture)if(o.image instanceof Array&&o.image.length==6){if(o.image.length==6){if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube);for(D=0;D<6;++D)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image[D])}else{o.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,
-o.image.__webGLTextureCube);for(D=0;D<6;++D)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image[D]);o.__wasSetOnce=!0}ja(d.TEXTURE_CUBE_MAP,o,o.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube)}}else{if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image)}else{o.__webGLTexture=
-d.createTexture();d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image);o.__wasSetOnce=!0}ja(d.TEXTURE_2D,o,o.image);d.bindTexture(d.TEXTURE_2D,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_2D,o.__webGLTexture)}}}d.uniformMatrix4fv(q.modelViewMatrix,!1,k._modelViewMatrixArray);d.uniformMatrix3fv(q.normalMatrix,!1,k._normalMatrixArray);(i instanceof THREE.MeshShaderMaterial||i instanceof THREE.MeshPhongMaterial||
-i.envMap)&&d.uniform3f(q.cameraPosition,g.position.x,g.position.y,g.position.z);(i instanceof THREE.MeshShaderMaterial||i.envMap||i.skinning)&&d.uniformMatrix4fv(q.objectMatrix,!1,k._objectMatrixArray);(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshShaderMaterial||i.skinning)&&d.uniformMatrix4fv(q.viewMatrix,!1,ka);if(i.skinning){d.uniformMatrix4fv(q.cameraInverseMatrix,!1,ka);d.uniformMatrix4fv(q.boneGlobalMatrices,!1,k.boneMatrices)}return t}
-function e(g,m,o,i,k,t){if(i.opacity!=0){g=f(g,m,o,i,t).attributes;if(i.morphTargets){m=i.program.attributes;t.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[t.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.vertexAttribPointer(m.position,3,d.FLOAT,!1,0,0);if(t.morphTargetForcedOrder.length){o=0;for(var q=t.morphTargetForcedOrder,r=t.morphTargetInfluences;o<i.numSupportedMorphTargets&&o<q.length;){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[q[o]]);
-d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=r[q[o]];o++}}else{q=[];var D=-1,w=0;r=t.morphTargetInfluences;var v,M=r.length;o=0;for(t.morphTargetBase!==-1&&(q[t.morphTargetBase]=!0);o<i.numSupportedMorphTargets;){for(v=0;v<M;v++)if(!q[v]&&r[v]>D){w=v;D=r[w]}d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[w]);d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=D;q[w]=1;D=-1;o++}}d.uniform1fv(i.program.uniforms.morphTargetInfluences,
-t.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.vertexAttribPointer(g.position,3,d.FLOAT,!1,0,0)}if(g.color>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLColorBuffer);d.vertexAttribPointer(g.color,3,d.FLOAT,!1,0,0)}if(g.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLNormalBuffer);d.vertexAttribPointer(g.normal,3,d.FLOAT,!1,0,0)}if(g.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLTangentBuffer);d.vertexAttribPointer(g.tangent,4,d.FLOAT,!1,0,0)}if(g.uv>=0)if(k.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,
-k.__webGLUVBuffer);d.vertexAttribPointer(g.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv)}else d.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(k.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLUV2Buffer);d.vertexAttribPointer(g.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv2)}else d.disableVertexAttribArray(g.uv2);if(i.skinning&&g.skinVertexA>=0&&g.skinVertexB>=0&&g.skinIndex>=0&&g.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexABuffer);d.vertexAttribPointer(g.skinVertexA,
-4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexBBuffer);d.vertexAttribPointer(g.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinIndicesBuffer);d.vertexAttribPointer(g.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinWeightsBuffer);d.vertexAttribPointer(g.skinWeight,4,d.FLOAT,!1,0,0)}if(t instanceof THREE.Mesh)if(i.wireframe){d.lineWidth(i.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);d.drawElements(d.LINES,
-k.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,k.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(t instanceof THREE.Line){t=t.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(i.linewidth);d.drawArrays(t,0,k.__webGLLineCount)}else if(t instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,k.__webGLParticleCount);else t instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,k.__webGLVertexCount)}}function h(g,m){if(!g.__webGLVertexBuffer)g.__webGLVertexBuffer=
-d.createBuffer();if(!g.__webGLNormalBuffer)g.__webGLNormalBuffer=d.createBuffer();if(g.hasPos){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,g.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.position);d.vertexAttribPointer(m.attributes.position,3,d.FLOAT,!1,0,0)}if(g.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,g.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.normal);d.vertexAttribPointer(m.attributes.normal,
-3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,g.count);g.count=0}function j(g){if(N!=g.doubleSided){g.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);N=g.doubleSided}if(pa!=g.flipSided){g.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);pa=g.flipSided}}function p(g){if(Da!=g){g?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);Da=g}}function n(g){W[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);W[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);W[2].set(g.n41+g.n21,g.n42+g.n22,
-g.n43+g.n23,g.n44+g.n24);W[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);W[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);W[5].set(g.n41+g.n31,g.n42+g.n32,g.n43+g.n33,g.n44+g.n34);var m;for(g=0;g<6;g++){m=W[g];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function s(g){for(var m=g.matrixWorld,o=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),i=0;i<6;i++){g=W[i].x*m.n14+W[i].y*m.n24+W[i].z*m.n34+W[i].w;if(g<=o)return!1}return!0}function x(g,
-m){g.list[g.count]=m;g.count+=1}function z(g){var m,o,i=g.object,k=g.opaque,t=g.transparent;t.count=0;g=k.count=0;for(m=i.materials.length;g<m;g++){o=i.materials[g];o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?x(t,o):x(k,o)}}function C(g){var m,o,i,k,t=g.object,q=g.buffer,r=g.opaque,D=g.transparent;D.count=0;g=r.count=0;for(i=t.materials.length;g<i;g++){m=t.materials[g];if(m instanceof THREE.MeshFaceMaterial){m=0;for(o=q.materials.length;m<o;m++)(k=q.materials[m])&&(k.opacity&&k.opacity<
-1||k.blending!=THREE.NormalBlending?x(D,k):x(r,k))}else{k=m;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?x(D,k):x(r,k)}}}function y(g,m){return m.z-g.z}function J(g,m){g._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function K(g){function m(X){var G=[];o=0;for(i=X.length;o<i;o++)X[o]==undefined?G.push("undefined"):G.push(X[o].id);return G.join("_")}var o,
-i,k,t,q,r,D,w,v={},M=g.morphTargets!==undefined?g.morphTargets.length:0;g.geometryGroups={};k=0;for(t=g.faces.length;k<t;k++){q=g.faces[k];r=q.materials;D=m(r);v[D]==undefined&&(v[D]={hash:D,counter:0});w=v[D].hash+"_"+v[D].counter;g.geometryGroups[w]==undefined&&(g.geometryGroups[w]={faces:[],materials:r,vertices:0,numMorphTargets:M});q=q instanceof THREE.Face3?3:4;if(g.geometryGroups[w].vertices+q>65535){v[D].counter+=1;w=v[D].hash+"_"+v[D].counter;g.geometryGroups[w]==undefined&&(g.geometryGroups[w]=
-{faces:[],materials:r,vertices:0,numMorphTargets:M})}g.geometryGroups[w].faces.push(k);g.geometryGroups[w].vertices+=q}}function P(g,m,o){g.push({buffer:m,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(g){if(g!=ya){switch(g){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);
-break;case THREE.ReverseSubtractiveBlending:d.blendEquation(d.FUNC_REVERSE_SUBTRACT);d.blendFunc(d.ONE,d.ONE);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}ya=g}}function ja(g,m,o){if((o.width&o.width-1)==0&&(o.height&o.height-1)==0){d.texParameteri(g,d.TEXTURE_WRAP_S,A(m.wrapS));d.texParameteri(g,d.TEXTURE_WRAP_T,A(m.wrapT));d.texParameteri(g,d.TEXTURE_MAG_FILTER,A(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,A(m.minFilter));d.generateMipmap(g)}else{d.texParameteri(g,
-d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_MAG_FILTER,U(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,U(m.minFilter))}}function ma(g){if(g&&!g.__webGLFramebuffer){g.__webGLFramebuffer=d.createFramebuffer();g.__webGLRenderbuffer=d.createRenderbuffer();g.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,g.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,g.width,g.height);d.bindTexture(d.TEXTURE_2D,
-g.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,A(g.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,A(g.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,A(g.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,A(g.minFilter));d.texImage2D(d.TEXTURE_2D,0,A(g.format),g.width,g.height,0,A(g.format),A(g.type),null);d.bindFramebuffer(d.FRAMEBUFFER,g.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,g.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,
-d.DEPTH_ATTACHMENT,d.RENDERBUFFER,g.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var m,o;if(g){m=g.__webGLFramebuffer;o=g.width;g=g.height}else{m=null;o=ha;g=ia}if(m!=Ca){d.bindFramebuffer(d.FRAMEBUFFER,m);d.viewport(qa,V,o,g);Ca=m}}function sa(g,m){var o;if(g=="fragment")o=d.createShader(d.FRAGMENT_SHADER);else g=="vertex"&&(o=d.createShader(d.VERTEX_SHADER));d.shaderSource(o,m);d.compileShader(o);if(!d.getShaderParameter(o,
-d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(o));console.error(m);return null}return o}function U(g){switch(g){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return d.LINEAR}}function A(g){switch(g){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;
-case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;
-case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var oa=document.createElement("canvas"),d,Ba=null,Ca=null,Q=this,N=null,pa=null,ya=null,Da=null,qa=0,V=0,ha=0,ia=0,W=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Matrix4,ta=new Float32Array(16),ka=new Float32Array(16),za=new THREE.Vector4,La={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},la=!0,Na=new THREE.Color(0),Wa=0;if(a){if(a.antialias!==undefined)la=a.antialias;a.clearColor!==undefined&&Na.setHex(a.clearColor);if(a.clearAlpha!==undefined)Wa=a.clearAlpha}this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=
-!0;(function(g,m,o){try{if(!(d=oa.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(i){console.error(i)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.clearColor(m.r,m.g,m.b,o);_cullEnabled=!0})(la,Na,Wa);this.context=d;this.setSize=function(g,m){oa.width=g;oa.height=m;this.setViewport(0,0,oa.width,oa.height)};
-this.setViewport=function(g,m,o,i){qa=g;V=m;ha=o;ia=i;d.viewport(qa,V,ha,ia)};this.setScissor=function(g,m,o,i){d.scissor(g,m,o,i)};this.enableScissorTest=function(g){g?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(g){d.depthMask(g)};this.setClearColorHex=function(g,m){var o=new THREE.Color(g);d.clearColor(o.r,o.g,o.b,m)};this.setClearColor=function(g,m){d.clearColor(g.r,g.g,g.b,m)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};this.initMaterial=
-function(g,m,o,i){var k,t,q;if(g instanceof THREE.MeshDepthMaterial)c(g,THREE.ShaderLib.depth);else if(g instanceof THREE.MeshNormalMaterial)c(g,THREE.ShaderLib.normal);else if(g instanceof THREE.MeshBasicMaterial)c(g,THREE.ShaderLib.basic);else if(g instanceof THREE.MeshLambertMaterial)c(g,THREE.ShaderLib.lambert);else if(g instanceof THREE.MeshPhongMaterial)c(g,THREE.ShaderLib.phong);else if(g instanceof THREE.LineBasicMaterial)c(g,THREE.ShaderLib.basic);else g instanceof THREE.ParticleBasicMaterial&&
-c(g,THREE.ShaderLib.particle_basic);var r,D,w,v;q=w=v=0;for(r=m.length;q<r;q++){D=m[q];D instanceof THREE.DirectionalLight&&w++;D instanceof THREE.PointLight&&v++}if(v+w<=4)m=w;else{m=Math.ceil(4*w/(v+w));v=4-m}q={directional:m,point:v};r=50;if(i!==undefined&&i instanceof THREE.SkinnedMesh)r=i.bones.length;v=g.fragmentShader;m=g.vertexShader;r={fog:o,map:g.map,envMap:g.envMap,lightMap:g.lightMap,vertexColors:g.vertexColors,sizeAttenuation:g.sizeAttenuation,skinning:g.skinning,morphTargets:g.morphTargets,
-maxDirLights:q.directional,maxPointLights:q.point,maxBones:r};o=d.createProgram();q=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,r.fog?"#define USE_FOG":"",r.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
-r=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"","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 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\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");
-d.attachShader(o,sa("fragment",q+v));d.attachShader(o,sa("vertex",r+m));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};g.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(k in g.uniforms)o.push(k);
-k=g.program;v=0;for(m=o.length;v<m;v++){q=o[v];k.uniforms[q]=d.getUniformLocation(k,q)}o=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(k=0;k<this.maxMorphTargets;k++)o.push("morphTarget"+k);for(t in g.attributes)o.push(t);t=g.program;k=o;o=0;for(v=k.length;o<v;o++){m=k[o];t.attributes[m]=d.getAttribLocation(t,m)}t=g.program.attributes;d.enableVertexAttribArray(t.position);t.color>=0&&d.enableVertexAttribArray(t.color);t.normal>=0&&d.enableVertexAttribArray(t.normal);
-t.tangent>=0&&d.enableVertexAttribArray(t.tangent);if(g.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0){d.enableVertexAttribArray(t.skinVertexA);d.enableVertexAttribArray(t.skinVertexB);d.enableVertexAttribArray(t.skinIndex);d.enableVertexAttribArray(t.skinWeight)}if(g.morphTargets){g.numSupportedMorphTargets=0;if(t.morphTarget0>=0){d.enableVertexAttribArray(t.morphTarget0);g.numSupportedMorphTargets++}if(t.morphTarget1>=0){d.enableVertexAttribArray(t.morphTarget1);
-g.numSupportedMorphTargets++}if(t.morphTarget2>=0){d.enableVertexAttribArray(t.morphTarget2);g.numSupportedMorphTargets++}if(t.morphTarget3>=0){d.enableVertexAttribArray(t.morphTarget3);g.numSupportedMorphTargets++}if(t.morphTarget4>=0){d.enableVertexAttribArray(t.morphTarget4);g.numSupportedMorphTargets++}if(t.morphTarget5>=0){d.enableVertexAttribArray(t.morphTarget5);g.numSupportedMorphTargets++}if(t.morphTarget6>=0){d.enableVertexAttribArray(t.morphTarget6);g.numSupportedMorphTargets++}if(t.morphTarget7>=
-0){d.enableVertexAttribArray(t.morphTarget7);g.numSupportedMorphTargets++}i.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k<this.maxMorphTargets;k++)i.__webGLMorphTargetInfluences[k]=0}};this.render=function(g,m,o,i){var k,t,q,r,D,w,v,M,X=g.lights,G=g.fog;m.matrixAutoUpdate&&m.updateMatrix();g.update(undefined,!1,m);m.matrixWorldInverse.flattenToArray(ka);m.projectionMatrix.flattenToArray(ta);S.multiply(m.projectionMatrix,m.matrixWorldInverse);n(S);this.initWebGLObjects(g);
-ma(o);(this.autoClear||i)&&this.clear();D=g.__webglObjects.length;for(i=0;i<D;i++){k=g.__webglObjects[i];v=k.object;if(v.visible)if(!(v instanceof THREE.Mesh)||s(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);J(v,m);C(k);k.render=!0;if(this.sortObjects){za.copy(v.position);S.multiplyVector3(za);k.z=za.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(y);w=g.__webglObjectsImmediate.length;for(i=0;i<w;i++){k=g.__webglObjectsImmediate[i];v=k.object;if(v.visible){v.matrixAutoUpdate&&
-v.matrixWorld.flattenToArray(v._objectMatrixArray);J(v,m);z(k)}}L(THREE.NormalBlending);for(i=0;i<D;i++){k=g.__webglObjects[i];if(k.render){v=k.object;M=k.buffer;q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);e(m,X,G,r,M,v)}}}for(i=0;i<w;i++){k=g.__webglObjectsImmediate[i];v=k.object;if(v.visible){q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);t=f(m,X,G,r,v);v.render(function(R){h(R,t)})}}}for(i=0;i<D;i++){k=g.__webglObjects[i];if(k.render){v=k.object;M=k.buffer;
-q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];L(r.blending);p(r.depthTest);e(m,X,G,r,M,v)}}}for(i=0;i<w;i++){k=g.__webglObjectsImmediate[i];v=k.object;if(v.visible){q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];L(r.blending);p(r.depthTest);t=f(m,X,G,r,v);v.render(function(R){h(R,t)})}}}if(o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=
-function(g){if(!g.__webglObjects){g.__webglObjects=[];g.__webglObjectsImmediate=[]}for(;g.__objectsAdded.length;){var m=g.__objectsAdded[0],o=g,i=void 0,k=void 0,t=void 0;if(m._modelViewMatrix==undefined){m._modelViewMatrix=new THREE.Matrix4;m._normalMatrixArray=new Float32Array(9);m._modelViewMatrixArray=new Float32Array(16);m._objectMatrixArray=new Float32Array(16);m.matrixWorld.flattenToArray(m._objectMatrixArray)}if(m instanceof THREE.Mesh){k=m.geometry;k.geometryGroups==undefined&&K(k);for(i in k.geometryGroups){t=
-k.geometryGroups[i];if(!t.__webGLVertexBuffer){var q=t;q.__webGLVertexBuffer=d.createBuffer();q.__webGLNormalBuffer=d.createBuffer();q.__webGLTangentBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q.__webGLUVBuffer=d.createBuffer();q.__webGLUV2Buffer=d.createBuffer();q.__webGLSkinVertexABuffer=d.createBuffer();q.__webGLSkinVertexBBuffer=d.createBuffer();q.__webGLSkinIndicesBuffer=d.createBuffer();q.__webGLSkinWeightsBuffer=d.createBuffer();q.__webGLFaceBuffer=d.createBuffer();q.__webGLLineBuffer=
-d.createBuffer();if(q.numMorphTargets){var r=void 0,D=void 0;q.__webGLMorphTargetsBuffers=[];r=0;for(D=q.numMorphTargets;r<D;r++)q.__webGLMorphTargetsBuffers.push(d.createBuffer())}q=t;var w=m,v=void 0,M=void 0,X=D=r=0;v=void 0;M=void 0;var G=void 0;M=void 0;var R=w.geometry;G=R.faces;var H=q.faces;v=0;for(M=H.length;v<M;v++){fi=H[v];face=G[fi];if(face instanceof THREE.Face3){r+=3;D+=1;X+=3}else if(face instanceof THREE.Face4){r+=4;D+=2;X+=4}}v=q;M=w;G=void 0;H=void 0;var Z=void 0,Ga=void 0;Z=void 0;
-var T=[];G=0;for(H=M.materials.length;G<H;G++){Z=M.materials[G];if(Z instanceof THREE.MeshFaceMaterial){Z=0;for(l=v.materials.length;Z<l;Z++)(Ga=v.materials[Z])&&T.push(Ga)}else(Ga=Z)&&T.push(Ga)}M=T;a:{v=void 0;G=void 0;H=M.length;for(v=0;v<H;v++){G=M[v];if(G.map||G.lightMap||G instanceof THREE.MeshShaderMaterial){v=!0;break a}}v=!1}a:{G=void 0;H=void 0;T=M.length;for(G=0;G<T;G++){H=M[G];if(!(H instanceof THREE.MeshBasicMaterial&&!H.envMap||H instanceof THREE.MeshDepthMaterial)){G=H&&H.shading!=
-undefined&&H.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}G=!1}a:{H=void 0;T=void 0;Z=M.length;for(H=0;H<Z;H++){T=M[H];if(T.vertexColors){M=T.vertexColors;break a}}M=!1}q.__vertexArray=new Float32Array(r*3);if(G)q.__normalArray=new Float32Array(r*3);if(R.hasTangents)q.__tangentArray=new Float32Array(r*4);if(M)q.__colorArray=new Float32Array(r*3);if(v){if(R.faceUvs.length>0||R.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(R.faceUvs.length>1||R.faceVertexUvs.length>
-1)q.__uv2Array=new Float32Array(r*2)}if(w.geometry.skinWeights.length&&w.geometry.skinIndices.length){q.__skinVertexAArray=new Float32Array(r*4);q.__skinVertexBArray=new Float32Array(r*4);q.__skinIndexArray=new Float32Array(r*4);q.__skinWeightArray=new Float32Array(r*4)}q.__faceArray=new Uint16Array(D*3);q.__lineArray=new Uint16Array(X*2);if(q.numMorphTargets){w=void 0;R=void 0;q.__morphTargetsArrays=[];w=0;for(R=q.numMorphTargets;w<R;w++)q.__morphTargetsArrays.push(new Float32Array(r*3))}q.__needsSmoothNormals=
-G==THREE.SmoothShading;q.__uvType=v;q.__vertexColorType=M;q.__normalType=G;q.__webGLFaceCount=D*3;q.__webGLLineCount=X*2;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}P(o.__webglObjects,t,m)}}else if(m instanceof THREE.Ribbon){k=m.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=d.createBuffer();i.__webGLColorBuffer=d.createBuffer();i=k;t=i.vertices.length;i.__vertexArray=new Float32Array(t*
-3);i.__colorArray=new Float32Array(t*3);i.__webGLVertexCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}P(o.__webglObjects,k,m)}else if(m instanceof THREE.Line){k=m.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=d.createBuffer();i.__webGLColorBuffer=d.createBuffer();i=k;t=i.vertices.length;i.__vertexArray=new Float32Array(t*3);i.__colorArray=new Float32Array(t*3);i.__webGLLineCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}P(o.__webglObjects,k,m)}else if(m instanceof THREE.ParticleSystem){k=
-m.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=d.createBuffer();i.__webGLColorBuffer=d.createBuffer();i=k;t=i.vertices.length;i.__vertexArray=new Float32Array(t*3);i.__colorArray=new Float32Array(t*3);i.__sortArray=[];i.__webGLParticleCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}P(o.__webglObjects,k,m)}else THREE.MarchingCubes!==undefined&&m instanceof THREE.MarchingCubes&&o.__webglObjectsImmediate.push({object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}});g.__objectsAdded.splice(0,
-1)}for(;g.__objectsRemoved.length;){m=g.__objectsRemoved[0];o=g;k=void 0;i=void 0;for(k=o.__webglObjects.length-1;k>=0;k--){i=o.__webglObjects[k].object;m==i&&o.__webglObjects.splice(k,1)}g.__objectsRemoved.splice(0,1)}m=0;for(o=g.__webglObjects.length;m<o;m++){i=g.__webglObjects[m].object;t=void 0;k=void 0;q=void 0;if(i instanceof THREE.Mesh){k=i.geometry;for(t in k.geometryGroups){q=k.geometryGroups[t];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||
-k.__dirtyColors||k.__dirtyTangents){r=d.DYNAMIC_DRAW;D=void 0;X=void 0;var $=void 0,B=void 0;$=void 0;var Aa=void 0,Y=void 0,Ha=void 0,O=void 0;w=void 0;R=void 0;v=void 0;M=void 0;G=void 0;var E=void 0,F=void 0,I=void 0,na=void 0;Y=void 0;Ha=void 0;B=void 0;O=void 0;B=void 0;E=void 0;F=void 0;Y=void 0;E=void 0;F=void 0;I=void 0;na=void 0;E=void 0;F=void 0;I=void 0;na=void 0;E=void 0;F=void 0;I=void 0;na=void 0;E=void 0;F=void 0;I=void 0;B=void 0;O=void 0;Aa=void 0;$=void 0;$=void 0;var Ea=void 0,
-Xa=void 0,ua=void 0,Oa=Ga=Z=T=H=0,Ia=0,aa=0,Ja=0,ra=0,u=0,va=0,wa=q.__vertexArray,Za=q.__uvArray,$a=q.__uv2Array,Ma=q.__normalArray,ca=q.__tangentArray,xa=q.__colorArray,da=q.__skinVertexAArray,ea=q.__skinVertexBArray,fa=q.__skinIndexArray,ga=q.__skinWeightArray,ab=q.__morphTargetsArrays,Pa=q.__faceArray,Ka=q.__lineArray,hb=q.__needsSmoothNormals;R=q.__vertexColorType;w=q.__uvType;v=q.__normalType;var Fa=i.geometry,bb=Fa.__dirtyVertices,cb=Fa.__dirtyElements,Ya=Fa.__dirtyUvs,db=Fa.__dirtyNormals,
-eb=Fa.__dirtyTangents,fb=Fa.__dirtyColors,gb=Fa.__dirtyMorphTargets,Sa=Fa.vertices,ib=q.faces,lb=Fa.faces,jb=Fa.faceVertexUvs[0],kb=Fa.faceVertexUvs[1],Ta=Fa.skinVerticesA,Ua=Fa.skinVerticesB,Va=Fa.skinIndices,Ra=Fa.skinWeights,Qa=Fa.morphTargets;D=0;for(X=ib.length;D<X;D++){$=ib[D];B=lb[$];jb&&(M=jb[$]);kb&&(G=kb[$]);$=B.vertexNormals;Aa=B.normal;Y=B.vertexColors;Ha=B.color;O=B.vertexTangents;if(B instanceof THREE.Face3){if(bb){E=Sa[B.a].position;F=Sa[B.b].position;I=Sa[B.c].position;wa[T]=E.x;wa[T+
-1]=E.y;wa[T+2]=E.z;wa[T+3]=F.x;wa[T+4]=F.y;wa[T+5]=F.z;wa[T+6]=I.x;wa[T+7]=I.y;wa[T+8]=I.z;T+=9}if(gb){Ea=0;for(Xa=Qa.length;Ea<Xa;Ea++){E=Qa[Ea].vertices[B.a].position;F=Qa[Ea].vertices[B.b].position;I=Qa[Ea].vertices[B.c].position;ua=ab[Ea];ua[va+0]=E.x;ua[va+1]=E.y;ua[va+2]=E.z;ua[va+3]=F.x;ua[va+4]=F.y;ua[va+5]=F.z;ua[va+6]=I.x;ua[va+7]=I.y;ua[va+8]=I.z}va+=9}if(Ra.length){E=Ra[B.a];F=Ra[B.b];I=Ra[B.c];ga[u]=E.x;ga[u+1]=E.y;ga[u+2]=E.z;ga[u+3]=E.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;
-ga[u+8]=I.x;ga[u+9]=I.y;ga[u+10]=I.z;ga[u+11]=I.w;E=Va[B.a];F=Va[B.b];I=Va[B.c];fa[u]=E.x;fa[u+1]=E.y;fa[u+2]=E.z;fa[u+3]=E.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=I.x;fa[u+9]=I.y;fa[u+10]=I.z;fa[u+11]=I.w;E=Ta[B.a];F=Ta[B.b];I=Ta[B.c];da[u]=E.x;da[u+1]=E.y;da[u+2]=E.z;da[u+3]=1;da[u+4]=F.x;da[u+5]=F.y;da[u+6]=F.z;da[u+7]=1;da[u+8]=I.x;da[u+9]=I.y;da[u+10]=I.z;da[u+11]=1;E=Ua[B.a];F=Ua[B.b];I=Ua[B.c];ea[u]=E.x;ea[u+1]=E.y;ea[u+2]=E.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;
-ea[u+7]=1;ea[u+8]=I.x;ea[u+9]=I.y;ea[u+10]=I.z;ea[u+11]=1;u+=12}if(fb&&R){if(Y.length==3&&R==THREE.VertexColors){B=Y[0];E=Y[1];F=Y[2]}else F=E=B=Ha;xa[ra]=B.r;xa[ra+1]=B.g;xa[ra+2]=B.b;xa[ra+3]=E.r;xa[ra+4]=E.g;xa[ra+5]=E.b;xa[ra+6]=F.r;xa[ra+7]=F.g;xa[ra+8]=F.b;ra+=9}if(eb&&Fa.hasTangents){Y=O[0];Ha=O[1];B=O[2];ca[aa]=Y.x;ca[aa+1]=Y.y;ca[aa+2]=Y.z;ca[aa+3]=Y.w;ca[aa+4]=Ha.x;ca[aa+5]=Ha.y;ca[aa+6]=Ha.z;ca[aa+7]=Ha.w;ca[aa+8]=B.x;ca[aa+9]=B.y;ca[aa+10]=B.z;ca[aa+11]=B.w;aa+=12}if(db&&v)if($.length==
-3&&hb)for(O=0;O<3;O++){Aa=$[O];Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}else for(O=0;O<3;O++){Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}if(Ya&&M!==undefined&&w)for(O=0;O<3;O++){$=M[O];Za[Z]=$.u;Za[Z+1]=$.v;Z+=2}if(Ya&&G!==undefined&&w)for(O=0;O<3;O++){$=G[O];$a[Ga]=$.u;$a[Ga+1]=$.v;Ga+=2}if(cb){Pa[Oa]=H;Pa[Oa+1]=H+1;Pa[Oa+2]=H+2;Oa+=3;Ka[Ja]=H;Ka[Ja+1]=H+1;Ka[Ja+2]=H;Ka[Ja+3]=H+2;Ka[Ja+4]=H+1;Ka[Ja+5]=H+2;Ja+=6;H+=3}}else if(B instanceof THREE.Face4){if(bb){E=Sa[B.a].position;F=Sa[B.b].position;
-I=Sa[B.c].position;na=Sa[B.d].position;wa[T]=E.x;wa[T+1]=E.y;wa[T+2]=E.z;wa[T+3]=F.x;wa[T+4]=F.y;wa[T+5]=F.z;wa[T+6]=I.x;wa[T+7]=I.y;wa[T+8]=I.z;wa[T+9]=na.x;wa[T+10]=na.y;wa[T+11]=na.z;T+=12}if(gb){Ea=0;for(Xa=Qa.length;Ea<Xa;Ea++){E=Qa[Ea].vertices[B.a].position;F=Qa[Ea].vertices[B.b].position;I=Qa[Ea].vertices[B.c].position;na=Qa[Ea].vertices[B.d].position;ua=ab[Ea];ua[va+0]=E.x;ua[va+1]=E.y;ua[va+2]=E.z;ua[va+3]=F.x;ua[va+4]=F.y;ua[va+5]=F.z;ua[va+6]=I.x;ua[va+7]=I.y;ua[va+8]=I.z;ua[va+9]=na.x;
-ua[va+10]=na.y;ua[va+11]=na.z}va+=12}if(Ra.length){E=Ra[B.a];F=Ra[B.b];I=Ra[B.c];na=Ra[B.d];ga[u]=E.x;ga[u+1]=E.y;ga[u+2]=E.z;ga[u+3]=E.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=I.x;ga[u+9]=I.y;ga[u+10]=I.z;ga[u+11]=I.w;ga[u+12]=na.x;ga[u+13]=na.y;ga[u+14]=na.z;ga[u+15]=na.w;E=Va[B.a];F=Va[B.b];I=Va[B.c];na=Va[B.d];fa[u]=E.x;fa[u+1]=E.y;fa[u+2]=E.z;fa[u+3]=E.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=I.x;fa[u+9]=I.y;fa[u+10]=I.z;fa[u+11]=I.w;fa[u+12]=na.x;fa[u+13]=na.y;
-fa[u+14]=na.z;fa[u+15]=na.w;E=Ta[B.a];F=Ta[B.b];I=Ta[B.c];na=Ta[B.d];da[u]=E.x;da[u+1]=E.y;da[u+2]=E.z;da[u+3]=1;da[u+4]=F.x;da[u+5]=F.y;da[u+6]=F.z;da[u+7]=1;da[u+8]=I.x;da[u+9]=I.y;da[u+10]=I.z;da[u+11]=1;da[u+12]=na.x;da[u+13]=na.y;da[u+14]=na.z;da[u+15]=1;E=Ua[B.a];F=Ua[B.b];I=Ua[B.c];B=Ua[B.d];ea[u]=E.x;ea[u+1]=E.y;ea[u+2]=E.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=I.x;ea[u+9]=I.y;ea[u+10]=I.z;ea[u+11]=1;ea[u+12]=B.x;ea[u+13]=B.y;ea[u+14]=B.z;ea[u+15]=1;u+=16}if(fb&&
-R){if(Y.length==4&&R==THREE.VertexColors){B=Y[0];E=Y[1];F=Y[2];Y=Y[3]}else Y=F=E=B=Ha;xa[ra]=B.r;xa[ra+1]=B.g;xa[ra+2]=B.b;xa[ra+3]=E.r;xa[ra+4]=E.g;xa[ra+5]=E.b;xa[ra+6]=F.r;xa[ra+7]=F.g;xa[ra+8]=F.b;xa[ra+9]=Y.r;xa[ra+10]=Y.g;xa[ra+11]=Y.b;ra+=12}if(eb&&Fa.hasTangents){Y=O[0];Ha=O[1];B=O[2];O=O[3];ca[aa]=Y.x;ca[aa+1]=Y.y;ca[aa+2]=Y.z;ca[aa+3]=Y.w;ca[aa+4]=Ha.x;ca[aa+5]=Ha.y;ca[aa+6]=Ha.z;ca[aa+7]=Ha.w;ca[aa+8]=B.x;ca[aa+9]=B.y;ca[aa+10]=B.z;ca[aa+11]=B.w;ca[aa+12]=O.x;ca[aa+13]=O.y;ca[aa+14]=O.z;
-ca[aa+15]=O.w;aa+=16}if(db&&v)if($.length==4&&hb)for(O=0;O<4;O++){Aa=$[O];Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}else for(O=0;O<4;O++){Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}if(Ya&&M!==undefined&&w)for(O=0;O<4;O++){$=M[O];Za[Z]=$.u;Za[Z+1]=$.v;Z+=2}if(Ya&&G!==undefined&&w)for(O=0;O<4;O++){$=G[O];$a[Ga]=$.u;$a[Ga+1]=$.v;Ga+=2}if(cb){Pa[Oa]=H;Pa[Oa+1]=H+1;Pa[Oa+2]=H+3;Pa[Oa+3]=H+1;Pa[Oa+4]=H+2;Pa[Oa+5]=H+3;Oa+=6;Ka[Ja]=H;Ka[Ja+1]=H+1;Ka[Ja+2]=H;Ka[Ja+3]=H+3;Ka[Ja+4]=H+1;Ka[Ja+5]=H+2;Ka[Ja+
-6]=H+2;Ka[Ja+7]=H+3;Ja+=8;H+=4}}}if(bb){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,wa,r)}if(gb){Ea=0;for(Xa=Qa.length;Ea<Xa;Ea++){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[Ea]);d.bufferData(d.ARRAY_BUFFER,ab[Ea],r)}}if(fb&&ra>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,xa,r)}if(db){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ma,r)}if(eb&&Fa.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,
-q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,ca,r)}if(Ya&&Z>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Za,r)}if(Ya&&Ga>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,$a,r)}if(cb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Pa,r);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Ka,r)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);
-d.bufferData(d.ARRAY_BUFFER,da,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ea,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,fa,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,ga,r)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(i instanceof THREE.Ribbon){k=i.geometry;if(k.__dirtyVertices||
-k.__dirtyColors){i=k;t=d.DYNAMIC_DRAW;w=void 0;w=void 0;R=void 0;q=void 0;v=i.vertices;r=i.colors;M=v.length;D=r.length;G=i.__vertexArray;X=i.__colorArray;H=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<M;w++){R=v[w].position;q=w*3;G[q]=R.x;G[q+1]=R.y;G[q+2]=R.z}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,G,t)}if(H){for(w=0;w<D;w++){color=r[w];q=w*3;X[q]=color.r;X[q+1]=color.g;X[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,
-X,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(i instanceof THREE.Line){k=i.geometry;if(k.__dirtyVertices||k.__dirtyColors){i=k;t=d.DYNAMIC_DRAW;w=void 0;w=void 0;R=void 0;q=void 0;v=i.vertices;r=i.colors;M=v.length;D=r.length;G=i.__vertexArray;X=i.__colorArray;H=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<M;w++){R=v[w].position;q=w*3;G[q]=R.x;G[q+1]=R.y;G[q+2]=R.z}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,G,t)}if(H){for(w=0;w<D;w++){color=r[w];q=w*
-3;X[q]=color.r;X[q+1]=color.g;X[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,X,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem){k=i.geometry;(k.__dirtyVertices||k.__dirtyColors||i.sortParticles)&&b(k,d.DYNAMIC_DRAW,i);k.__dirtyVertices=!1;k.__dirtyColors=!1}}};this.setFaceCulling=function(g,m){if(g){!m||m=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(g=="back")d.cullFace(d.BACK);else g=="front"?d.cullFace(d.FRONT):
-d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+THREE.WebGLRenderer=function(a){function c(e,p,n){var j,q,s,v=e.vertices,r=v.length,k=e.colors,A=k.length,u=e.__vertexArray,G=e.__colorArray,F=e.__sortArray,L=e.__dirtyVertices,M=e.__dirtyColors;if(n.sortParticles){ma.multiplySelf(n.matrixWorld);for(j=0;j<r;j++){q=v[j].position;Fa.copy(q);ma.multiplyVector3(Fa);F[j]=[Fa.z,j]}F.sort(function(V,P){return P[0]-V[0]});for(j=0;j<r;j++){q=v[F[j][1]].position;s=j*3;u[s]=q.x;u[s+1]=q.y;u[s+2]=q.z}for(j=0;j<A;j++){s=j*3;color=k[F[j][1]];G[s]=color.r;G[s+1]=
+color.g;G[s+2]=color.b}}else{if(L)for(j=0;j<r;j++){q=v[j].position;s=j*3;u[s]=q.x;u[s+1]=q.y;u[s+2]=q.z}if(M)for(j=0;j<A;j++){color=k[j];s=j*3;G[s]=color.r;G[s+1]=color.g;G[s+2]=color.b}}if(L||n.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,u,p)}if(M||n.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,G,p)}}function d(e,p){e.uniforms=Uniforms.clone(p.uniforms);e.vertexShader=p.vertexShader;e.fragmentShader=
+p.fragmentShader}function g(e,p,n,j,q){j.__webglProgram||N.initMaterial(j,p,n,q);var s=j.program,v=s.uniforms,r=j.uniforms;if(s!=ra){b.useProgram(s);ra=s}b.uniformMatrix4fv(v.projectionMatrix,!1,ka);if(n&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){r.fogNear.value=n.near;r.fogFar.value=
+n.far}else if(n instanceof THREE.FogExp2)r.fogDensity.value=n.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j.lights){var k,A,u=0,G=0,F=0,L,M,V,P=na,U=P.directional.colors,C=P.directional.positions,D=P.point.colors,I=P.point.positions,W=0,oa=0;n=A=A=0;for(k=p.length;n<k;n++){A=p[n];L=A.color;M=A.position;V=A.intensity;if(A instanceof THREE.AmbientLight){u+=L.r;G+=L.g;F+=L.b}else if(A instanceof THREE.DirectionalLight){A=W*3;U[A]=L.r*V;U[A+1]=L.g*V;U[A+2]=
+L.b*V;C[A]=M.x;C[A+1]=M.y;C[A+2]=M.z;W+=1}else if(A instanceof THREE.PointLight){A=oa*3;D[A]=L.r*V;D[A+1]=L.g*V;D[A+2]=L.b*V;I[A]=M.x;I[A+1]=M.y;I[A+2]=M.z;oa+=1}}for(n=W*3;n<U.length;n++)U[n]=0;for(n=oa*3;n<D.length;n++)D[n]=0;P.point.length=oa;P.directional.length=W;P.ambient[0]=u;P.ambient[1]=G;P.ambient[2]=F;n=na;r.enableLighting.value=n.directional.length+n.point.length;r.ambientLightColor.value=n.ambient;r.directionalLightColor.value=n.directional.colors;r.directionalLightDirection.value=n.directional.positions;
+r.pointLightColor.value=n.point.colors;r.pointLightPosition.value=n.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.map.texture=j.map;r.lightMap.texture=j.lightMap;r.envMap.texture=j.envMap;r.reflectivity.value=j.reflectivity;r.refractionRatio.value=j.refractionRatio;r.combine.value=j.combine;r.useRefract.value=
+j.envMap&&j.envMap.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.size.value=j.size;r.scale.value=Y.height/2;r.map.texture=j.map}else if(j instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(j.ambient.r,
+j.ambient.g,j.ambient.b);r.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);r.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){r.mNear.value=e.near;r.mFar.value=e.far;r.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)r.opacity.value=j.opacity;for(var Na in r)if(G=s.uniforms[Na]){k=r[Na];u=k.type;n=k.value;if(u=="i")b.uniform1i(G,n);else if(u=="f")b.uniform1f(G,n);else if(u=="fv1")b.uniform1fv(G,n);else if(u=="fv")b.uniform3fv(G,n);else if(u==
+"v2")b.uniform2f(G,n.x,n.y);else if(u=="v3")b.uniform3f(G,n.x,n.y,n.z);else if(u=="c")b.uniform3f(G,n.r,n.g,n.b);else if(u=="t"){b.uniform1i(G,n);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);for(u=0;u<6;++u)b.texSubImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image[u])}else{k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,
+k.image.__webGLTextureCube);for(u=0;u<6;++u)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[u]);k.__wasSetOnce=!0}la(b.TEXTURE_CUBE_MAP,k,k.image[0]);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image)}else{k.__webGLTexture=
+b.createTexture();b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);k.__wasSetOnce=!0}la(b.TEXTURE_2D,k,k.image);b.bindTexture(b.TEXTURE_2D,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}b.uniformMatrix4fv(v.modelViewMatrix,!1,q._modelViewMatrixArray);b.uniformMatrix3fv(v.normalMatrix,!1,q._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||
+j.envMap)&&b.uniform3f(v.cameraPosition,e.position.x,e.position.y,e.position.z);(j instanceof THREE.MeshShaderMaterial||j.envMap||j.skinning)&&b.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&b.uniformMatrix4fv(v.viewMatrix,!1,Ca);if(j instanceof THREE.ShadowVolumeDynamicMaterial){e=r.directionalLightDirection.value;e[0]=-p.position.x;e[1]=-p.position.y;e[2]=
+-p.position.z;b.uniform3fv(v.directionalLightDirection,e);b.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);b.uniformMatrix4fv(v.viewMatrix,!1,Ca)}if(j.skinning){b.uniformMatrix4fv(v.cameraInverseMatrix,!1,Ca);b.uniformMatrix4fv(v.boneGlobalMatrices,!1,q.boneMatrices)}return s}function f(e,p,n,j,q,s){if(j.opacity!=0){e=g(e,p,n,j,s).attributes;if(j.morphTargets){p=j.program.attributes;s.morphTargetBase!==-1?b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[s.morphTargetBase]):b.bindBuffer(b.ARRAY_BUFFER,
+q.__webGLVertexBuffer);b.vertexAttribPointer(p.position,3,b.FLOAT,!1,0,0);if(s.morphTargetForcedOrder.length){n=0;for(var v=s.morphTargetForcedOrder,r=s.morphTargetInfluences;n<j.numSupportedMorphTargets&&n<v.length;){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[v[n]]);b.vertexAttribPointer(p["morphTarget"+n],3,b.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=r[v[n]];n++}}else{v=[];var k=-1,A=0;r=s.morphTargetInfluences;var u,G=r.length;n=0;for(s.morphTargetBase!==-1&&(v[s.morphTargetBase]=
+!0);n<j.numSupportedMorphTargets;){for(u=0;u<G;u++)if(!v[u]&&r[u]>k){A=u;k=r[A]}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[A]);b.vertexAttribPointer(p["morphTarget"+n],3,b.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=k;v[A]=1;k=-1;n++}}b.uniform1fv(j.program.uniforms.morphTargetInfluences,s.__webGLMorphTargetInfluences)}else{b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,!1,0,0)}if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLColorBuffer);
+b.vertexAttribPointer(e.color,3,b.FLOAT,!1,0,0)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,!1,0,0)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,!1,0,0)}if(e.uv>=0)if(q.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(q.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,
+q.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(j.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);b.vertexAttribPointer(e.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);b.vertexAttribPointer(e.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);b.vertexAttribPointer(e.skinIndex,
+4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);b.vertexAttribPointer(e.skinWeight,4,b.FLOAT,!1,0,0)}if(s instanceof THREE.Mesh)if(j.wireframe){b.lineWidth(j.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);b.drawElements(b.LINES,q.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(s instanceof THREE.Line){s=s.type==THREE.LineStrip?
+b.LINE_STRIP:b.LINES;b.lineWidth(j.linewidth);b.drawArrays(s,0,q.__webGLLineCount)}else if(s instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,q.__webGLParticleCount);else s instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,q.__webGLVertexCount)}}function h(e,p){if(!e.__webGLVertexBuffer)e.__webGLVertexBuffer=b.createBuffer();if(!e.__webGLNormalBuffer)e.__webGLNormalBuffer=b.createBuffer();if(e.hasPos){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,e.positionArray,
+b.DYNAMIC_DRAW);b.enableVertexAttribArray(p.attributes.position);b.vertexAttribPointer(p.attributes.position,3,b.FLOAT,!1,0,0)}if(e.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,e.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(p.attributes.normal);b.vertexAttribPointer(p.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,e.count);e.count=0}function i(e){if(pa!=e.doubleSided){e.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);pa=
+e.doubleSided}if(Aa!=e.flipSided){e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);Aa=e.flipSided}}function m(e){if(sa!=e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);sa=e}}function o(e){O[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);O[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);O[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);O[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);O[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34);O[5].set(e.n41+e.n31,
+e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var p;for(e=0;e<6;e++){p=O[e];p.divideScalar(Math.sqrt(p.x*p.x+p.y*p.y+p.z*p.z))}}function t(e){for(var p=e.matrixWorld,n=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),j=0;j<6;j++){e=O[j].x*p.n14+O[j].y*p.n24+O[j].z*p.n34+O[j].w;if(e<=n)return!1}return!0}function x(e,p){e.list[e.count]=p;e.count+=1}function y(e){var p,n,j=e.object,q=e.opaque,s=e.transparent;s.count=0;e=q.count=0;for(p=j.materials.length;e<p;e++){n=j.materials[e];
+n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?x(s,n):x(q,n)}}function B(e){var p,n,j,q,s=e.object,v=e.buffer,r=e.opaque,k=e.transparent;k.count=0;e=r.count=0;for(j=s.materials.length;e<j;e++){p=s.materials[e];if(p instanceof THREE.MeshFaceMaterial){p=0;for(n=v.materials.length;p<n;p++)(q=v.materials[p])&&(q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?x(k,q):x(r,q))}else{q=p;q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?x(k,q):x(r,q)}}}function z(e,p){return p.z-e.z}
+function H(e,p){e._modelViewMatrix.multiplyToArray(p.matrixWorldInverse,e.matrixWorld,e._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)}function J(e){var p,n,j;if(e instanceof THREE.Mesh){n=e.geometry;for(p in n.geometryGroups){j=n.geometryGroups[p];if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents){var q=b.DYNAMIC_DRAW,s=void 0,v=void 0,r=void 0,k=void 0;
+r=void 0;var A=void 0,u=void 0,G=void 0,F=void 0,L=void 0,M=void 0,V=void 0,P=void 0,U=void 0,C=void 0,D=void 0,I=void 0,W=void 0;u=void 0;G=void 0;k=void 0;F=void 0;k=void 0;C=void 0;D=void 0;u=void 0;C=void 0;D=void 0;I=void 0;W=void 0;C=void 0;D=void 0;I=void 0;W=void 0;C=void 0;D=void 0;I=void 0;W=void 0;C=void 0;D=void 0;I=void 0;k=void 0;F=void 0;A=void 0;r=void 0;r=void 0;var oa=void 0,Na=void 0,ta=void 0,Z=0,ua=0,Qa=0,Ra=0,Ga=0,Ha=0,X=0,Ia=0,qa=0,w=0,va=0,ya=j.__vertexArray,Za=j.__uvArray,
+$a=j.__uv2Array,La=j.__normalArray,$=j.__tangentArray,za=j.__colorArray,aa=j.__skinVertexAArray,ca=j.__skinVertexBArray,da=j.__skinIndexArray,ea=j.__skinWeightArray,ab=j.__morphTargetsArrays,Ja=j.__faceArray,Ka=j.__lineArray,hb=j.__needsSmoothNormals;M=j.__vertexColorType;L=j.__uvType;V=j.__normalType;var Da=e.geometry,bb=Da.__dirtyVertices,cb=Da.__dirtyElements,Xa=Da.__dirtyUvs,db=Da.__dirtyNormals,eb=Da.__dirtyTangents,fb=Da.__dirtyColors,gb=Da.__dirtyMorphTargets,Sa=Da.vertices,ib=j.faces,lb=Da.faces,
+jb=Da.faceVertexUvs[0],kb=Da.faceVertexUvs[1],Ta=Da.skinVerticesA,Ua=Da.skinVerticesB,Va=Da.skinIndices,Oa=Da.skinWeights,Pa=Da.edgeFaces,Ma=Da.morphTargets;s=0;for(v=ib.length;s<v;s++){r=ib[s];k=lb[r];jb&&(P=jb[r]);kb&&(U=kb[r]);r=k.vertexNormals;A=k.normal;u=k.vertexColors;G=k.color;F=k.vertexTangents;if(k instanceof THREE.Face3){if(bb){C=Sa[k.a].position;D=Sa[k.b].position;I=Sa[k.c].position;ya[ua]=C.x;ya[ua+1]=C.y;ya[ua+2]=C.z;ya[ua+3]=D.x;ya[ua+4]=D.y;ya[ua+5]=D.z;ya[ua+6]=I.x;ya[ua+7]=I.y;ya[ua+
+8]=I.z;ua+=9}if(gb){oa=0;for(Na=Ma.length;oa<Na;oa++){C=Ma[oa].vertices[k.a].position;D=Ma[oa].vertices[k.b].position;I=Ma[oa].vertices[k.c].position;ta=ab[oa];ta[va+0]=C.x;ta[va+1]=C.y;ta[va+2]=C.z;ta[va+3]=D.x;ta[va+4]=D.y;ta[va+5]=D.z;ta[va+6]=I.x;ta[va+7]=I.y;ta[va+8]=I.z}va+=9}if(Oa.length){C=Oa[k.a];D=Oa[k.b];I=Oa[k.c];ea[w]=C.x;ea[w+1]=C.y;ea[w+2]=C.z;ea[w+3]=C.w;ea[w+4]=D.x;ea[w+5]=D.y;ea[w+6]=D.z;ea[w+7]=D.w;ea[w+8]=I.x;ea[w+9]=I.y;ea[w+10]=I.z;ea[w+11]=I.w;C=Va[k.a];D=Va[k.b];I=Va[k.c];
+da[w]=C.x;da[w+1]=C.y;da[w+2]=C.z;da[w+3]=C.w;da[w+4]=D.x;da[w+5]=D.y;da[w+6]=D.z;da[w+7]=D.w;da[w+8]=I.x;da[w+9]=I.y;da[w+10]=I.z;da[w+11]=I.w;C=Ta[k.a];D=Ta[k.b];I=Ta[k.c];aa[w]=C.x;aa[w+1]=C.y;aa[w+2]=C.z;aa[w+3]=1;aa[w+4]=D.x;aa[w+5]=D.y;aa[w+6]=D.z;aa[w+7]=1;aa[w+8]=I.x;aa[w+9]=I.y;aa[w+10]=I.z;aa[w+11]=1;C=Ua[k.a];D=Ua[k.b];I=Ua[k.c];ca[w]=C.x;ca[w+1]=C.y;ca[w+2]=C.z;ca[w+3]=1;ca[w+4]=D.x;ca[w+5]=D.y;ca[w+6]=D.z;ca[w+7]=1;ca[w+8]=I.x;ca[w+9]=I.y;ca[w+10]=I.z;ca[w+11]=1;w+=12}if(fb&&M){if(u.length==
+3&&M==THREE.VertexColors){k=u[0];C=u[1];D=u[2]}else D=C=k=G;za[qa]=k.r;za[qa+1]=k.g;za[qa+2]=k.b;za[qa+3]=C.r;za[qa+4]=C.g;za[qa+5]=C.b;za[qa+6]=D.r;za[qa+7]=D.g;za[qa+8]=D.b;qa+=9}if(eb&&Da.hasTangents){u=F[0];G=F[1];k=F[2];$[X]=u.x;$[X+1]=u.y;$[X+2]=u.z;$[X+3]=u.w;$[X+4]=G.x;$[X+5]=G.y;$[X+6]=G.z;$[X+7]=G.w;$[X+8]=k.x;$[X+9]=k.y;$[X+10]=k.z;$[X+11]=k.w;X+=12}if(db&&V)if(r.length==3&&hb)for(F=0;F<3;F++){A=r[F];La[Ha]=A.x;La[Ha+1]=A.y;La[Ha+2]=A.z;Ha+=3}else for(F=0;F<3;F++){La[Ha]=A.x;La[Ha+1]=A.y;
+La[Ha+2]=A.z;Ha+=3}if(Xa&&P!==undefined&&L)for(F=0;F<3;F++){r=P[F];Za[Qa]=r.u;Za[Qa+1]=r.v;Qa+=2}if(Xa&&U!==undefined&&L)for(F=0;F<3;F++){r=U[F];$a[Ra]=r.u;$a[Ra+1]=r.v;Ra+=2}if(cb){Ja[Ga]=Z;Ja[Ga+1]=Z+1;Ja[Ga+2]=Z+2;Ga+=3;Ka[Ia]=Z;Ka[Ia+1]=Z+1;Ka[Ia+2]=Z;Ka[Ia+3]=Z+2;Ka[Ia+4]=Z+1;Ka[Ia+5]=Z+2;Ia+=6;Z+=3}}else if(k instanceof THREE.Face4){if(bb){C=Sa[k.a].position;D=Sa[k.b].position;I=Sa[k.c].position;W=Sa[k.d].position;ya[ua]=C.x;ya[ua+1]=C.y;ya[ua+2]=C.z;ya[ua+3]=D.x;ya[ua+4]=D.y;ya[ua+5]=D.z;ya[ua+
+6]=I.x;ya[ua+7]=I.y;ya[ua+8]=I.z;ya[ua+9]=W.x;ya[ua+10]=W.y;ya[ua+11]=W.z;ua+=12}if(gb){oa=0;for(Na=Ma.length;oa<Na;oa++){C=Ma[oa].vertices[k.a].position;D=Ma[oa].vertices[k.b].position;I=Ma[oa].vertices[k.c].position;W=Ma[oa].vertices[k.d].position;ta=ab[oa];ta[va+0]=C.x;ta[va+1]=C.y;ta[va+2]=C.z;ta[va+3]=D.x;ta[va+4]=D.y;ta[va+5]=D.z;ta[va+6]=I.x;ta[va+7]=I.y;ta[va+8]=I.z;ta[va+9]=W.x;ta[va+10]=W.y;ta[va+11]=W.z}va+=12}if(Oa.length){C=Oa[k.a];D=Oa[k.b];I=Oa[k.c];W=Oa[k.d];ea[w]=C.x;ea[w+1]=C.y;
+ea[w+2]=C.z;ea[w+3]=C.w;ea[w+4]=D.x;ea[w+5]=D.y;ea[w+6]=D.z;ea[w+7]=D.w;ea[w+8]=I.x;ea[w+9]=I.y;ea[w+10]=I.z;ea[w+11]=I.w;ea[w+12]=W.x;ea[w+13]=W.y;ea[w+14]=W.z;ea[w+15]=W.w;C=Va[k.a];D=Va[k.b];I=Va[k.c];W=Va[k.d];da[w]=C.x;da[w+1]=C.y;da[w+2]=C.z;da[w+3]=C.w;da[w+4]=D.x;da[w+5]=D.y;da[w+6]=D.z;da[w+7]=D.w;da[w+8]=I.x;da[w+9]=I.y;da[w+10]=I.z;da[w+11]=I.w;da[w+12]=W.x;da[w+13]=W.y;da[w+14]=W.z;da[w+15]=W.w;C=Ta[k.a];D=Ta[k.b];I=Ta[k.c];W=Ta[k.d];aa[w]=C.x;aa[w+1]=C.y;aa[w+2]=C.z;aa[w+3]=1;aa[w+4]=
+D.x;aa[w+5]=D.y;aa[w+6]=D.z;aa[w+7]=1;aa[w+8]=I.x;aa[w+9]=I.y;aa[w+10]=I.z;aa[w+11]=1;aa[w+12]=W.x;aa[w+13]=W.y;aa[w+14]=W.z;aa[w+15]=1;C=Ua[k.a];D=Ua[k.b];I=Ua[k.c];k=Ua[k.d];ca[w]=C.x;ca[w+1]=C.y;ca[w+2]=C.z;ca[w+3]=1;ca[w+4]=D.x;ca[w+5]=D.y;ca[w+6]=D.z;ca[w+7]=1;ca[w+8]=I.x;ca[w+9]=I.y;ca[w+10]=I.z;ca[w+11]=1;ca[w+12]=k.x;ca[w+13]=k.y;ca[w+14]=k.z;ca[w+15]=1;w+=16}if(fb&&M){if(u.length==4&&M==THREE.VertexColors){k=u[0];C=u[1];D=u[2];u=u[3]}else u=D=C=k=G;za[qa]=k.r;za[qa+1]=k.g;za[qa+2]=k.b;za[qa+
+3]=C.r;za[qa+4]=C.g;za[qa+5]=C.b;za[qa+6]=D.r;za[qa+7]=D.g;za[qa+8]=D.b;za[qa+9]=u.r;za[qa+10]=u.g;za[qa+11]=u.b;qa+=12}if(eb&&Da.hasTangents){u=F[0];G=F[1];k=F[2];F=F[3];$[X]=u.x;$[X+1]=u.y;$[X+2]=u.z;$[X+3]=u.w;$[X+4]=G.x;$[X+5]=G.y;$[X+6]=G.z;$[X+7]=G.w;$[X+8]=k.x;$[X+9]=k.y;$[X+10]=k.z;$[X+11]=k.w;$[X+12]=F.x;$[X+13]=F.y;$[X+14]=F.z;$[X+15]=F.w;X+=16}if(db&&V)if(r.length==4&&hb)for(F=0;F<4;F++){A=r[F];La[Ha]=A.x;La[Ha+1]=A.y;La[Ha+2]=A.z;Ha+=3}else for(F=0;F<4;F++){La[Ha]=A.x;La[Ha+1]=A.y;La[Ha+
+2]=A.z;Ha+=3}if(Xa&&P!==undefined&&L)for(F=0;F<4;F++){r=P[F];Za[Qa]=r.u;Za[Qa+1]=r.v;Qa+=2}if(Xa&&U!==undefined&&L)for(F=0;F<4;F++){r=U[F];$a[Ra]=r.u;$a[Ra+1]=r.v;Ra+=2}if(cb){Ja[Ga]=Z;Ja[Ga+1]=Z+1;Ja[Ga+2]=Z+3;Ja[Ga+3]=Z+1;Ja[Ga+4]=Z+2;Ja[Ga+5]=Z+3;Ga+=6;Ka[Ia]=Z;Ka[Ia+1]=Z+1;Ka[Ia+2]=Z;Ka[Ia+3]=Z+3;Ka[Ia+4]=Z+1;Ka[Ia+5]=Z+2;Ka[Ia+6]=Z+2;Ka[Ia+7]=Z+3;Ia+=8;Z+=4}}}if(Pa){s=0;for(v=Pa.length;s<v;s++){Ja[Ga]=Pa[s].a;Ja[Ga+1]=Pa[s].b;Ja[Ga+2]=Pa[s].c;Ja[Ga+3]=Pa[s].a;Ja[Ga+4]=Pa[s].c;Ja[Ga+5]=Pa[s].d;
+Ga+=6}}if(bb){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,ya,q)}if(gb){oa=0;for(Na=Ma.length;oa<Na;oa++){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLMorphTargetsBuffers[oa]);b.bufferData(b.ARRAY_BUFFER,ab[oa],q)}}if(fb&&qa>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,za,q)}if(db){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,La,q)}if(eb&&Da.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLTangentBuffer);
+b.bufferData(b.ARRAY_BUFFER,$,q)}if(Xa&&Qa>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Za,q)}if(Xa&&Ra>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,$a,q)}if(cb){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ja,q);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ka,q)}if(w>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinVertexABuffer);b.bufferData(b.ARRAY_BUFFER,
+aa,q);b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinVertexBBuffer);b.bufferData(b.ARRAY_BUFFER,ca,q);b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinIndicesBuffer);b.bufferData(b.ARRAY_BUFFER,da,q);b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinWeightsBuffer);b.bufferData(b.ARRAY_BUFFER,ea,q)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(e instanceof THREE.Ribbon){n=e.geometry;if(n.__dirtyVertices||n.__dirtyColors){e=
+n;p=b.DYNAMIC_DRAW;V=e.vertices;q=e.colors;P=V.length;s=q.length;U=e.__vertexArray;v=e.__colorArray;Z=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<P;L++){M=V[L].position;j=L*3;U[j]=M.x;U[j+1]=M.y;U[j+2]=M.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,U,p)}if(Z){for(L=0;L<s;L++){color=q[L];j=L*3;v[j]=color.r;v[j+1]=color.g;v[j+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,v,p)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(e instanceof
+THREE.Line){n=e.geometry;if(n.__dirtyVertices||n.__dirtyColors){e=n;p=b.DYNAMIC_DRAW;V=e.vertices;q=e.colors;P=V.length;s=q.length;U=e.__vertexArray;v=e.__colorArray;Z=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<P;L++){M=V[L].position;j=L*3;U[j]=M.x;U[j+1]=M.y;U[j+2]=M.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,U,p)}if(Z){for(L=0;L<s;L++){color=q[L];j=L*3;v[j]=color.r;v[j+1]=color.g;v[j+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,
+v,p)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(e instanceof THREE.ParticleSystem){n=e.geometry;(n.__dirtyVertices||n.__dirtyColors||e.sortParticles)&&c(n,b.DYNAMIC_DRAW,e);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function Q(e){function p(F){var L=[];n=0;for(j=F.length;n<j;n++)F[n]==undefined?L.push("undefined"):L.push(F[n].id);return L.join("_")}var n,j,q,s,v,r,k,A,u={},G=e.morphTargets!==undefined?e.morphTargets.length:0;e.geometryGroups={};q=0;for(s=e.faces.length;q<s;q++){v=e.faces[q];r=
+v.materials;k=p(r);u[k]==undefined&&(u[k]={hash:k,counter:0});A=u[k].hash+"_"+u[k].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:r,vertices:0,numMorphTargets:G});v=v instanceof THREE.Face3?3:4;if(e.geometryGroups[A].vertices+v>65535){u[k].counter+=1;A=u[k].hash+"_"+u[k].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:r,vertices:0,numMorphTargets:G})}e.geometryGroups[A].faces.push(q);e.geometryGroups[A].vertices+=v}}function K(e,p,
+n){e.push({buffer:p,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function ia(e){if(e!=Ba){switch(e){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:b.blendEquation(b.FUNC_REVERSE_SUBTRACT);b.blendFunc(b.ONE,b.ONE);break;default:b.blendEquation(b.FUNC_ADD);
+b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}Ba=e}}function la(e,p,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){b.texParameteri(e,b.TEXTURE_WRAP_S,fa(p.wrapS));b.texParameteri(e,b.TEXTURE_WRAP_T,fa(p.wrapT));b.texParameteri(e,b.TEXTURE_MAG_FILTER,fa(p.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,fa(p.minFilter));b.generateMipmap(e)}else{b.texParameteri(e,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_MAG_FILTER,E(p.magFilter));
+b.texParameteri(e,b.TEXTURE_MIN_FILTER,E(p.minFilter))}}function wa(e){if(e&&!e.__webGLFramebuffer){e.__webGLFramebuffer=b.createFramebuffer();e.__webGLRenderbuffer=b.createRenderbuffer();e.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,e.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,e.width,e.height);b.bindTexture(b.TEXTURE_2D,e.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,fa(e.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,
+fa(e.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,fa(e.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,fa(e.minFilter));b.texImage2D(b.TEXTURE_2D,0,fa(e.format),e.width,e.height,0,fa(e.format),fa(e.type),null);b.bindFramebuffer(b.FRAMEBUFFER,e.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,e.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,
+null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var p,n;if(e){p=e.__webGLFramebuffer;n=e.width;e=e.height}else{p=null;n=ha;e=ja}if(p!=R){b.bindFramebuffer(b.FRAMEBUFFER,p);b.viewport(T,ga,n,e);R=p}}function S(e,p){var n;if(e=="fragment")n=b.createShader(b.FRAGMENT_SHADER);else e=="vertex"&&(n=b.createShader(b.VERTEX_SHADER));b.shaderSource(n,p);b.compileShader(n);if(!b.getShaderParameter(n,b.COMPILE_STATUS)){console.error(b.getShaderInfoLog(n));console.error(p);
+return null}return n}function E(e){switch(e){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return b.NEAREST;default:return b.LINEAR}}function fa(e){switch(e){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;
+case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;
+case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var Y=document.createElement("canvas"),b,ra=null,R=null,N=this,pa=null,Aa=null,Ba=null,sa=null,T=0,ga=0,ha=0,ja=0,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ma=new THREE.Matrix4,ka=new Float32Array(16),Ca=new Float32Array(16),Fa=new THREE.Vector4,na=
+{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Ea=!0,Wa=new THREE.Color(0),Ya=0;if(a){if(a.antialias!==undefined)Ea=a.antialias;a.clearColor!==undefined&&Wa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ya=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Y;this.autoClear=!0;this.sortObjects=!0;(function(e,p,n){try{if(!(b=Y.getContext("experimental-webgl",{antialias:e,stencil:!0})))throw"Error creating WebGL context.";}catch(j){console.error(j)}b.clearColor(0,
+0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(p.r,p.g,p.b,n)})(Ea,Wa,Ya);this.context=b;var xa={};a=[];Ea=[];a[0]=-2;a[1]=-1;a[2]=-1;a[3]=2;a[4]=-1;a[5]=-1;a[6]=2;a[7]=1;a[8]=-1;a[9]=-2;a[10]=1;a[11]=-1;Ea[0]=0;Ea[1]=1;Ea[2]=2;Ea[3]=0;Ea[4]=2;Ea[5]=3;xa.vertexBuffer=b.createBuffer();xa.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,xa.vertexBuffer);
+b.bufferData(b.ARRAY_BUFFER,new Float32Array(a),b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,xa.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(Ea),b.STATIC_DRAW);xa.program=b.createProgram();b.attachShader(xa.program,S("fragment",THREE.ShaderLib.shadowPost.fragmentShader));b.attachShader(xa.program,S("vertex",THREE.ShaderLib.shadowPost.vertexShader));b.linkProgram(xa.program);xa.vertexLocation=b.getAttribLocation(xa.program,"position");xa.projectionLocation=b.getUniformLocation(xa.program,
+"projectionMatrix");this.setSize=function(e,p){Y.width=e;Y.height=p;this.setViewport(0,0,Y.width,Y.height)};this.setViewport=function(e,p,n,j){T=e;ga=p;ha=n;ja=j;b.viewport(T,ga,ha,ja)};this.setScissor=function(e,p,n,j){b.scissor(e,p,n,j)};this.enableScissorTest=function(e){e?b.enable(b.SCISSOR_TEST):b.disable(b.SCISSOR_TEST)};this.enableDepthBufferWrite=function(e){b.depthMask(e)};this.setClearColorHex=function(e,p){var n=new THREE.Color(e);b.clearColor(n.r,n.g,n.b,p)};this.setClearColor=function(e,
+p){b.clearColor(e.r,e.g,e.b,p)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT|b.STENCIL_BUFFER_BIT)};this.initMaterial=function(e,p,n,j){var q,s,v,r;if(e instanceof THREE.MeshDepthMaterial)d(e,THREE.ShaderLib.depth);else if(e instanceof THREE.ShadowVolumeDynamicMaterial)d(e,THREE.ShaderLib.shadowVolumeDynamic);else if(e instanceof THREE.MeshNormalMaterial)d(e,THREE.ShaderLib.normal);else if(e instanceof THREE.MeshBasicMaterial)d(e,THREE.ShaderLib.basic);else if(e instanceof THREE.MeshLambertMaterial)d(e,
+THREE.ShaderLib.lambert);else if(e instanceof THREE.MeshPhongMaterial)d(e,THREE.ShaderLib.phong);else if(e instanceof THREE.LineBasicMaterial)d(e,THREE.ShaderLib.basic);else e instanceof THREE.ParticleBasicMaterial&&d(e,THREE.ShaderLib.particle_basic);if(!e.program){var k,A,u;k=u=r=0;for(v=p.length;k<v;k++){A=p[k];A instanceof THREE.DirectionalLight&&u++;A instanceof THREE.PointLight&&r++}if(r+u<=4)p=u;else{p=Math.ceil(4*u/(r+u));r=4-p}r={directional:p,point:r};p=50;if(j!==undefined&&j instanceof
+THREE.SkinnedMesh)p=j.bones.length;v={fog:n,map:e.map,envMap:e.envMap,lightMap:e.lightMap,vertexColors:e.vertexColors,sizeAttenuation:e.sizeAttenuation,skinning:e.skinning,morphTargets:e.morphTargets,maxDirLights:r.directional,maxPointLights:r.point,maxBones:p};n=e.fragmentShader;r=e.vertexShader;p=b.createProgram();k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.fog?"#define USE_FOG":"",v.fog instanceof THREE.FogExp2?
+"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.lightMap?"#define USE_LIGHTMAP":"",v.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,"#define MAX_BONES "+v.maxBones,v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.lightMap?"#define USE_LIGHTMAP":
+"",v.vertexColors?"#define USE_COLOR":"",v.skinning?"#define USE_SKINNING":"",v.morphTargets?"#define USE_MORPHTARGETS":"",v.sizeAttenuation?"#define USE_SIZEATTENUATION":"","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 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
+b.attachShader(p,S("fragment",k+n));b.attachShader(p,S("vertex",v+r));b.linkProgram(p);b.getProgramParameter(p,b.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+b.getProgramParameter(p,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");p.uniforms={};p.attributes={};e.program=p;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in e.uniforms)n.push(q);
+q=e.program;r=0;for(p=n.length;r<p;r++){k=n[r];q.uniforms[k]=b.getUniformLocation(q,k)}n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<this.maxMorphTargets;q++)n.push("morphTarget"+q);for(s in e.attributes)n.push(s);s=e.program;q=n;n=0;for(r=q.length;n<r;n++){p=q[n];s.attributes[p]=b.getAttribLocation(s,p)}s=e.program.attributes;b.enableVertexAttribArray(s.position);s.color>=0&&b.enableVertexAttribArray(s.color);s.normal>=0&&b.enableVertexAttribArray(s.normal);
+s.tangent>=0&&b.enableVertexAttribArray(s.tangent);if(e.skinning&&s.skinVertexA>=0&&s.skinVertexB>=0&&s.skinIndex>=0&&s.skinWeight>=0){b.enableVertexAttribArray(s.skinVertexA);b.enableVertexAttribArray(s.skinVertexB);b.enableVertexAttribArray(s.skinIndex);b.enableVertexAttribArray(s.skinWeight)}if(e.morphTargets){e.numSupportedMorphTargets=0;if(s.morphTarget0>=0){b.enableVertexAttribArray(s.morphTarget0);e.numSupportedMorphTargets++}if(s.morphTarget1>=0){b.enableVertexAttribArray(s.morphTarget1);
+e.numSupportedMorphTargets++}if(s.morphTarget2>=0){b.enableVertexAttribArray(s.morphTarget2);e.numSupportedMorphTargets++}if(s.morphTarget3>=0){b.enableVertexAttribArray(s.morphTarget3);e.numSupportedMorphTargets++}if(s.morphTarget4>=0){b.enableVertexAttribArray(s.morphTarget4);e.numSupportedMorphTargets++}if(s.morphTarget5>=0){b.enableVertexAttribArray(s.morphTarget5);e.numSupportedMorphTargets++}if(s.morphTarget6>=0){b.enableVertexAttribArray(s.morphTarget6);e.numSupportedMorphTargets++}if(s.morphTarget7>=
+0){b.enableVertexAttribArray(s.morphTarget7);e.numSupportedMorphTargets++}j.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(q=0;q<this.maxMorphTargets;q++)j.__webGLMorphTargetInfluences[q]=0}}e.__webglProgram=!0};this.render=function(e,p,n,j){var q,s,v,r,k,A,u,G,F=e.lights,L=e.fog;p.matrixAutoUpdate&&p.updateMatrix();e.update(undefined,!1,p);p.matrixWorldInverse.flattenToArray(Ca);p.projectionMatrix.flattenToArray(ka);ma.multiply(p.projectionMatrix,p.matrixWorldInverse);o(ma);
+this.initWebGLObjects(e);wa(n);(this.autoClear||j)&&this.clear();j=e.__webglObjects.length;for(k=0;k<j;k++){r=e.__webglObjects[k];u=r.object;if(u.visible)if(!(u instanceof THREE.Mesh)||t(u)){u.matrixWorld.flattenToArray(u._objectMatrixArray);H(u,p);B(r);r.render=!0;if(this.sortObjects){Fa.copy(u.position);ma.multiplyVector3(Fa);r.z=Fa.z}}else r.render=!1;else r.render=!1}this.sortObjects&&e.__webglObjects.sort(z);A=e.__webglObjectsImmediate.length;for(k=0;k<A;k++){r=e.__webglObjectsImmediate[k];u=
+r.object;if(u.visible){u.matrixAutoUpdate&&u.matrixWorld.flattenToArray(u._objectMatrixArray);H(u,p);y(r)}}ia(THREE.NormalBlending);for(k=0;k<j;k++){r=e.__webglObjects[k];if(r.render){u=r.object;G=r.buffer;v=r.opaque;i(u);for(q=0;q<v.count;q++){r=v.list[q];m(r.depthTest);f(p,F,L,r,G,u)}}}for(k=0;k<A;k++){r=e.__webglObjectsImmediate[k];u=r.object;if(u.visible){v=r.opaque;i(u);for(q=0;q<v.count;q++){r=v.list[q];m(r.depthTest);s=g(p,F,L,r,u);u.render(function(M){h(M,s)})}}}for(k=0;k<j;k++){r=e.__webglObjects[k];
+if(r.render){u=r.object;G=r.buffer;v=r.transparent;i(u);for(q=0;q<v.count;q++){r=v.list[q];ia(r.blending);m(r.depthTest);f(p,F,L,r,G,u)}}}for(k=0;k<A;k++){r=e.__webglObjectsImmediate[k];u=r.object;if(u.visible){v=r.transparent;i(u);for(q=0;q<v.count;q++){r=v.list[q];ia(r.blending);m(r.depthTest);s=g(p,F,L,r,u);u.render(function(M){h(M,s)})}}}if(e.__webglShadowVolumes.length&&e.lights.length){b.enable(b.POLYGON_OFFSET_FILL);b.polygonOffset(0.1,1);b.enable(b.STENCIL_TEST);b.depthMask(!1);b.colorMask(!1,
+!1,!1,!1);b.stencilFunc(b.ALWAYS,1,255);b.stencilOpSeparate(b.BACK,b.KEEP,b.INCR,b.KEEP);b.stencilOpSeparate(b.FRONT,b.KEEP,b.DECR,b.KEEP);A=e.lights.length;G=[];j=e.__webglShadowVolumes.length;for(p=0;p<A;p++){k=e.lights[p];if(k instanceof THREE.DirectionalLight){G[0]=-k.position.x;G[1]=-k.position.y;G[2]=-k.position.z;for(k=0;k<j;k++){u=e.__webglShadowVolumes[k].object;q=e.__webglShadowVolumes[k].buffer;r=u.materials[0];r.program||N.initMaterial(r,F,L,u);s=r.program;r=s.uniforms;v=s.attributes;
+if(ra!==s){b.useProgram(s);ra=s;b.uniformMatrix4fv(r.projectionMatrix,!1,ka);b.uniformMatrix4fv(r.viewMatrix,!1,Ca);b.uniform3fv(r.directionalLightDirection,G)}u.matrixWorld.flattenToArray(u._objectMatrixArray);b.uniformMatrix4fv(r.objectMatrix,!1,u._objectMatrixArray);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.vertexAttribPointer(v.position,3,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLNormalBuffer);b.vertexAttribPointer(v.normal,3,b.FLOAT,!1,0,0);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
+q.__webGLFaceBuffer);b.cullFace(b.FRONT);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0);b.cullFace(b.BACK);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0)}}}b.disable(b.POLYGON_OFFSET_FILL);b.colorMask(!0,!0,!0,!0);b.stencilFunc(b.NOTEQUAL,0,255);b.stencilOp(b.KEEP,b.KEEP,b.KEEP);b.disable(b.DEPTH_TEST);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.blendEquation(b.FUNC_ADD);Ba="";ra=xa.program;b.useProgram(xa.program);b.uniformMatrix4fv(xa.projectionLocation,
+!1,ka);b.bindBuffer(b.ARRAY_BUFFER,xa.vertexBuffer);b.vertexAttribPointer(xa.vertexLocation,3,b.FLOAT,!1,0,0);b.enableVertexAttribArray(xa.vertexLocation);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,xa.elementBuffer);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.disable(b.STENCIL_TEST);b.enable(b.DEPTH_TEST);b.disable(b.BLEND);b.depthMask(!0)}if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,n.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,
+null)}};this.initWebGLObjects=function(e){if(!e.__webglObjects){e.__webglObjects=[];e.__webglObjectsImmediate=[];e.__webglShadowVolumes=[]}for(;e.__objectsAdded.length;){var p=e.__objectsAdded[0],n=e,j=void 0,q=void 0,s=void 0;if(p._modelViewMatrix==undefined){p._modelViewMatrix=new THREE.Matrix4;p._normalMatrixArray=new Float32Array(9);p._modelViewMatrixArray=new Float32Array(16);p._objectMatrixArray=new Float32Array(16);p.matrixWorld.flattenToArray(p._objectMatrixArray)}if(p instanceof THREE.Mesh){q=
+p.geometry;q.geometryGroups==undefined&&Q(q);for(j in q.geometryGroups){s=q.geometryGroups[j];if(!s.__webGLVertexBuffer){var v=s;v.__webGLVertexBuffer=b.createBuffer();v.__webGLNormalBuffer=b.createBuffer();v.__webGLTangentBuffer=b.createBuffer();v.__webGLColorBuffer=b.createBuffer();v.__webGLUVBuffer=b.createBuffer();v.__webGLUV2Buffer=b.createBuffer();v.__webGLSkinVertexABuffer=b.createBuffer();v.__webGLSkinVertexBBuffer=b.createBuffer();v.__webGLSkinIndicesBuffer=b.createBuffer();v.__webGLSkinWeightsBuffer=
+b.createBuffer();v.__webGLFaceBuffer=b.createBuffer();v.__webGLLineBuffer=b.createBuffer();if(v.numMorphTargets){var r=void 0,k=void 0;v.__webGLMorphTargetsBuffers=[];r=0;for(k=v.numMorphTargets;r<k;r++)v.__webGLMorphTargetsBuffers.push(b.createBuffer())}v=s;r=p;var A=void 0,u=void 0,G=void 0;G=void 0;var F=k=0,L=0;A=void 0;u=void 0;var M=void 0;u=void 0;var V=r.geometry;M=V.faces;var P=v.faces;A=0;for(u=P.length;A<u;A++){G=P[A];G=M[G];if(G instanceof THREE.Face3){k+=3;F+=1;L+=3}else if(G instanceof
+THREE.Face4){k+=4;F+=2;L+=4}}A=v;u=r;M=void 0;P=void 0;var U=void 0,C=void 0;U=void 0;G=[];M=0;for(P=u.materials.length;M<P;M++){U=u.materials[M];if(U instanceof THREE.MeshFaceMaterial){U=0;for(l=A.materials.length;U<l;U++)(C=A.materials[U])&&G.push(C)}else(C=U)&&G.push(C)}u=G;a:{A=void 0;M=void 0;P=u.length;for(A=0;A<P;A++){M=u[A];if(M.map||M.lightMap||M instanceof THREE.MeshShaderMaterial){A=!0;break a}}A=!1}a:{M=void 0;P=void 0;G=u.length;for(M=0;M<G;M++){P=u[M];if(!(P instanceof THREE.MeshBasicMaterial&&
+!P.envMap||P instanceof THREE.MeshDepthMaterial)){M=P&&P.shading!=undefined&&P.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}M=!1}a:{P=void 0;G=void 0;U=u.length;for(P=0;P<U;P++){G=u[P];if(G.vertexColors){u=G.vertexColors;break a}}u=!1}v.__vertexArray=new Float32Array(k*3);if(M)v.__normalArray=new Float32Array(k*3);if(V.hasTangents)v.__tangentArray=new Float32Array(k*4);if(u)v.__colorArray=new Float32Array(k*3);if(A){if(V.faceUvs.length>0||V.faceVertexUvs.length>0)v.__uvArray=
+new Float32Array(k*2);if(V.faceUvs.length>1||V.faceVertexUvs.length>1)v.__uv2Array=new Float32Array(k*2)}if(r.geometry.skinWeights.length&&r.geometry.skinIndices.length){v.__skinVertexAArray=new Float32Array(k*4);v.__skinVertexBArray=new Float32Array(k*4);v.__skinIndexArray=new Float32Array(k*4);v.__skinWeightArray=new Float32Array(k*4)}v.__faceArray=new Uint16Array(F*3+(r.geometry.edgeFaces?r.geometry.edgeFaces.length*6:0));v.__lineArray=new Uint16Array(L*2);if(v.numMorphTargets){V=void 0;P=void 0;
+v.__morphTargetsArrays=[];V=0;for(P=v.numMorphTargets;V<P;V++)v.__morphTargetsArrays.push(new Float32Array(k*3))}v.__needsSmoothNormals=M==THREE.SmoothShading;v.__uvType=A;v.__vertexColorType=u;v.__normalType=M;v.__webGLFaceCount=F*3+(r.geometry.edgeFaces?r.geometry.edgeFaces.length*6:0);v.__webGLLineCount=L*2;q.__dirtyVertices=!0;q.__dirtyMorphTargets=!0;q.__dirtyElements=!0;q.__dirtyUvs=!0;q.__dirtyNormals=!0;q.__dirtyTangents=!0;q.__dirtyColors=!0}p instanceof THREE.ShadowVolume?K(n.__webglShadowVolumes,
+s,p):K(n.__webglObjects,s,p)}}else if(p instanceof THREE.Ribbon){q=p.geometry;if(!q.__webGLVertexBuffer){j=q;j.__webGLVertexBuffer=b.createBuffer();j.__webGLColorBuffer=b.createBuffer();j=q;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__webGLVertexCount=s;q.__dirtyVertices=!0;q.__dirtyColors=!0}K(n.__webglObjects,q,p)}else if(p instanceof THREE.Line){q=p.geometry;if(!q.__webGLVertexBuffer){j=q;j.__webGLVertexBuffer=b.createBuffer();j.__webGLColorBuffer=
+b.createBuffer();j=q;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__webGLLineCount=s;q.__dirtyVertices=!0;q.__dirtyColors=!0}K(n.__webglObjects,q,p)}else if(p instanceof THREE.ParticleSystem){q=p.geometry;if(!q.__webGLVertexBuffer){j=q;j.__webGLVertexBuffer=b.createBuffer();j.__webGLColorBuffer=b.createBuffer();j=q;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__sortArray=[];j.__webGLParticleCount=
+s;q.__dirtyVertices=!0;q.__dirtyColors=!0}K(n.__webglObjects,q,p)}else THREE.MarchingCubes!==undefined&&p instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}});e.__objectsAdded.splice(0,1)}for(;e.__objectsRemoved.length;){p=e.__objectsRemoved[0];n=e;q=void 0;j=void 0;for(q=n.__webglObjects.length-1;q>=0;q--){j=n.__webglObjects[q].object;p==j&&n.__webglObjects.splice(q,1)}e.__objectsRemoved.splice(0,1)}p=0;for(n=e.__webglObjects.length;p<
+n;p++)J(e.__webglObjects[p].object,e);p=0;for(n=e.__webglShadowVolumes.length;p<n;p++)J(e.__webglShadowVolumes[p].object,e)};this.setFaceCulling=function(e,p){if(e){!p||p=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};

+ 4 - 0
examples/misc_ubiquity_test.html

@@ -51,6 +51,7 @@
 		<script type="text/javascript" src="../src/materials/MeshNormalMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/MeshFaceMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/MeshShaderMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/ShadowVolumeDynamicMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/ParticleBasicMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
@@ -66,6 +67,7 @@
 		<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
 		<script type="text/javascript" src="../src/objects/Sound.js"></script>
 		<script type="text/javascript" src="../src/objects/LOD.js"></script>
+		<script type="text/javascript" src="../src/objects/ShadowVolume.js"></script>
 		<script type="text/javascript" src="../src/scenes/Scene.js"></script>
 		<script type="text/javascript" src="../src/scenes/Fog.js"></script>
 		<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
@@ -97,6 +99,8 @@
 		<script type="text/javascript" src="../src/extras/geometries/Torus.js"></script>
 		<script type="text/javascript" src="../src/extras/geometries/TorusKnot.js"></script>
 		<script type="text/javascript" src="../src/extras/io/Loader.js"></script>
+		<script type="text/javascript" src="../src/extras/io/JSONLoader.js"></script>
+		<script type="text/javascript" src="../src/extras/io/BinaryLoader.js"></script>
 		<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
 
 		<script type="text/javascript" src="obj/Qrcode.js"></script>

+ 2 - 85
examples/webgl_geometry_minecraft.html

@@ -39,92 +39,9 @@
 
 		<div id="container"><br /><br /><br /><br /><br />Generating world...</div>
 		<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - <a href="http://www.minecraft.net/" target="_blank">minecraft</a> demo. featuring <a href="http://painterlypack.net/" target="_blank">painterly pack</a><br />(left click: forward, right click: backward)</div>
-<!--
+
 		<script type="text/javascript" src="../build/Three.js"></script>
--->
-		<script type="text/javascript" src="../src/Three.js"></script>
-		<script type="text/javascript" src="../src/core/Color.js"></script>
-		<script type="text/javascript" src="../src/core/Vector2.js"></script>
-		<script type="text/javascript" src="../src/core/Vector3.js"></script>
-		<script type="text/javascript" src="../src/core/Vector4.js"></script>
-		<script type="text/javascript" src="../src/core/Ray.js"></script>
-		<script type="text/javascript" src="../src/core/Rectangle.js"></script>
-		<script type="text/javascript" src="../src/core/Matrix3.js"></script>
-		<script type="text/javascript" src="../src/core/Matrix4.js"></script>
-		<script type="text/javascript" src="../src/core/Object3D.js"></script>
-		<script type="text/javascript" src="../src/core/Quaternion.js"></script>
-		<script type="text/javascript" src="../src/core/Vertex.js"></script>
-		<script type="text/javascript" src="../src/core/Face3.js"></script>
-		<script type="text/javascript" src="../src/core/Face4.js"></script>
-		<script type="text/javascript" src="../src/core/UV.js"></script>
-		<script type="text/javascript" src="../src/core/Geometry.js"></script>
-		<script type="text/javascript" src="../src/core/Spline.js"></script>
-		<script type="text/javascript" src="../src/animation/AnimationHandler.js"></script>
-		<script type="text/javascript" src="../src/animation/Animation.js"></script>
-		<script type="text/javascript" src="../src/cameras/Camera.js"></script>
-		<script type="text/javascript" src="../src/lights/Light.js"></script>
-		<script type="text/javascript" src="../src/lights/AmbientLight.js"></script>
-		<script type="text/javascript" src="../src/lights/DirectionalLight.js"></script>
-		<script type="text/javascript" src="../src/lights/PointLight.js"></script>
-		<script type="text/javascript" src="../src/materials/Material.js"></script>
-		<script type="text/javascript" src="../src/materials/Mappings.js"></script>
-		<script type="text/javascript" src="../src/materials/LineBasicMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshBasicMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshLambertMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshPhongMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshDepthMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshNormalMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshFaceMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/MeshShaderMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ParticleBasicMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/Texture.js"></script>
-		<script type="text/javascript" src="../src/materials/RenderTarget.js"></script>
-		<script type="text/javascript" src="../src/materials/Uniforms.js"></script>
-		<script type="text/javascript" src="../src/objects/Particle.js"></script>
-		<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
-		<script type="text/javascript" src="../src/objects/Line.js"></script>
-		<script type="text/javascript" src="../src/objects/Mesh.js"></script>
-		<script type="text/javascript" src="../src/objects/Bone.js"></script>
-		<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
-		<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
-		<script type="text/javascript" src="../src/objects/Sound.js"></script>
-		<script type="text/javascript" src="../src/objects/LOD.js"></script>
-		<script type="text/javascript" src="../src/scenes/Scene.js"></script>
-		<script type="text/javascript" src="../src/scenes/Fog.js"></script>
-		<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
-		<script type="text/javascript" src="../src/renderers/Projector.js"></script>
-		<script type="text/javascript" src="../src/renderers/DOMRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/CanvasRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/WebGLShaders.js"></script>
-		<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/SoundRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableVertex.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
-		<script type="text/javascript" src="../src/extras/GeometryUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/ImageUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/SceneUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/ShaderUtils.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/QuakeCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/cameras/PathCamera.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/Cube.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/Cylinder.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/Icosahedron.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/Lathe.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/Plane.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/Sphere.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/Torus.js"></script>
-		<script type="text/javascript" src="../src/extras/geometries/TorusKnot.js"></script>
-		<script type="text/javascript" src="../src/extras/io/Loader.js"></script>
-		<script type="text/javascript" src="../src/extras/io/JSONLoader.js"></script>
-		<script type="text/javascript" src="../src/extras/io/BinaryLoader.js"></script>
-		<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
-		
+
 		<script type="text/javascript" src="js/ImprovedNoise.js"></script>
 
 		<script type="text/javascript" src="js/Detector.js"></script>

+ 0 - 1
examples/webgl_materials_video.html

@@ -138,7 +138,6 @@
 					material = materials[ cube_count ];
 
 					material.program = material_base.program;
-					material.uniforms = Uniforms.clone( THREE.ShaderLib[ 'lambert' ].uniforms );
 
 					material.hue = i/xgrid;
 					material.saturation = j/ygrid;

+ 1 - 2
examples/webgl_performance.html

@@ -16,8 +16,7 @@
 	<body>
 
 		<script type="text/javascript" src="../build/Three.js"></script>
-		
-		
+
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
 

+ 0 - 1
examples/webgl_postprocessing_dof.html

@@ -135,7 +135,6 @@
 
 					materials[c] = new THREE.MeshBasicMaterial( parameters );
 					materials[c].program = material_base.program;
-					materials[c].uniforms = Uniforms.clone( THREE.ShaderLib[ 'basic' ].uniforms );
 
 					if ( singleMaterial )
 						mesh = new THREE.Mesh( geo, zmaterial );

+ 1 - 2
examples/webgl_ribbons.html

@@ -130,12 +130,11 @@
 
 					materials[c] = new THREE.MeshBasicMaterial( { color:0xffffff, vertexColors:true } );
 					materials[c].program = material_base.program;
-					materials[c].uniforms = Uniforms.clone( THREE.ShaderLib[ 'basic' ].uniforms );
 
 					ribbon = new THREE.Ribbon( i % 2 ? geometry : geometry2, materials[c] );
 					ribbon.rotation.x = 0;
 					ribbon.rotation.y = 1.57;
-					ribbon.rotation.z = 3.14;	
+					ribbon.rotation.z = 3.14;
 
 					x = 40 * ( i - xgrid/2 );
 					y = 40 * ( j - ygrid/2 );

+ 9 - 3
examples/webgl_sandbox.html

@@ -69,8 +69,9 @@
 		<script type="text/javascript" src="../src/materials/MeshNormalMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/MeshFaceMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/MeshShaderMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/ShadowVolumeDynamicMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/ParticleBasicMaterial.js"></script>
-		<script type="text/javascript" src="../src/materials/ParticleCircleMaterial.js"></script>
+		<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
 		<script type="text/javascript" src="../src/materials/Texture.js"></script>
 		<script type="text/javascript" src="../src/materials/RenderTarget.js"></script>
@@ -84,6 +85,7 @@
 		<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
 		<script type="text/javascript" src="../src/objects/Sound.js"></script>
 		<script type="text/javascript" src="../src/objects/LOD.js"></script>
+		<script type="text/javascript" src="../src/objects/ShadowVolume.js"></script>
 		<script type="text/javascript" src="../src/scenes/Scene.js"></script>
 		<script type="text/javascript" src="../src/scenes/Fog.js"></script>
 		<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
@@ -94,8 +96,10 @@
 		<script type="text/javascript" src="../src/renderers/WebGLShaders.js"></script>
 		<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
 		<script type="text/javascript" src="../src/renderers/SoundRenderer.js"></script>
-		<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableVertex.js"></script>
 		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableFace4.js"></script>
+		<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
 		<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
 		<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
 		<script type="text/javascript" src="../src/extras/GeometryUtils.js"></script>
@@ -113,8 +117,10 @@
 		<script type="text/javascript" src="../src/extras/geometries/Torus.js"></script>
 		<script type="text/javascript" src="../src/extras/geometries/TorusKnot.js"></script>
 		<script type="text/javascript" src="../src/extras/io/Loader.js"></script>
+		<script type="text/javascript" src="../src/extras/io/JSONLoader.js"></script>
+		<script type="text/javascript" src="../src/extras/io/BinaryLoader.js"></script>
 		<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
-		
+
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
 		<script type="text/javascript" src="js/Stats.js"></script>
 

+ 174 - 0
examples/webgl_stencil.html

@@ -0,0 +1,174 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js webgl - stencil shadow</title>
+		<meta charset="utf-8">
+		<style type="text/css">
+			body {
+				background:#fff;
+				padding:0;
+				margin:0;
+				font-weight: bold;
+				overflow:hidden;
+			}
+		</style>
+	</head>
+
+	<body>
+		<script type="text/javascript" src="../build/Three.js"></script>
+		<script type="text/javascript" src="js/Stats.js"></script>
+
+
+		<script type="text/javascript">
+			var statsEnabled = true;
+
+			var container, stats;
+
+			var camera, scene, renderer;
+
+			var mesh, boxMesh, light, lightCube, light2, lightCube2, zmesh, lightMesh, geometry;
+
+			var mouseX = 0, mouseY = 0;
+
+			var windowHalfX = window.innerWidth / 2;
+			var windowHalfY = window.innerHeight / 2;
+
+			document.addEventListener( 'mousemove', onDocumentMouseMove, false );
+
+			init();
+
+			function init() {
+
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
+
+				camera = new THREE.Camera( 60, window.innerWidth / window.innerHeight, 1, 10000 );
+				camera.position.z = 250;
+
+				scene = new THREE.Scene();
+	
+
+				// world
+
+				var cube = new Cube( 300, 300, 10 );
+				var material0 = new THREE.MeshPhongMaterial( { color:0xff00ff } );
+				var material1 = new THREE.MeshLambertMaterial( { color:0x00ff00 } );
+				var material2 = new THREE.MeshLambertMaterial( { color:0x0000ff } );
+
+				var mesh1 = new THREE.Mesh( cube, material0 );
+				mesh1.position.z = -150;
+				scene.addChild( mesh1 );
+
+				var mesh2 = new THREE.Mesh( cube, material1 );
+				mesh2.position.x = -150;
+				mesh2.rotation.y = 90 * Math.PI / 180;
+				scene.addChild( mesh2 );
+
+				var mesh3 = new THREE.Mesh( cube, material2 );
+				mesh3.position.y = -150;
+				mesh3.rotation.x = 90 * Math.PI / 180;
+				scene.addChild( mesh3 );
+
+				new THREE.ShadowVolume( mesh1 )
+				new THREE.ShadowVolume( mesh2 )
+				new THREE.ShadowVolume( mesh3 )
+	
+	
+				// moving objects
+
+				var cube = new Cube( 40, 40, 40 );
+				var torus = new Torus( 40, 10 );
+				var sphere = new Sphere( 40 );
+				var cylinder = new Cylinder( 10, 10, 20, 40, 0, 0 );
+				mesh = new THREE.Mesh( torus, material1 );
+				scene.addChild( mesh );
+
+				boxMesh = new THREE.Mesh( cube, material2 );
+				scene.addChild( boxMesh );
+				
+				new THREE.ShadowVolume( mesh );
+				new THREE.ShadowVolume( boxMesh );
+
+
+				// lights
+
+				light = new THREE.DirectionalLight( 0xffffff );
+				light.position.set( 0, 1, 0 );
+				scene.addChild( light );
+
+				var cube = new Sphere( 5 );
+				lightCube = new THREE.Mesh( cube, material2 );
+				scene.addChild( lightCube );
+
+
+				// renderer
+
+				renderer = new THREE.WebGLRenderer();
+				renderer.setClearColorHex( 0xaaaaaa, 1 );
+				renderer.setSize( window.innerWidth, window.innerHeight );
+				container.appendChild( renderer.domElement );
+
+				if ( statsEnabled ) {
+
+					stats = new Stats();
+					stats.domElement.style.position = 'absolute';
+					stats.domElement.style.top = '0px';
+					stats.domElement.style.zIndex = 100;
+					container.appendChild( stats.domElement );
+
+				}
+
+				setInterval( loop, 1000 / 60 );
+			}
+
+
+			function onDocumentMouseMove(event) {
+
+				mouseX = ( event.clientX - windowHalfX );
+				mouseY = ( event.clientY - windowHalfY );
+
+			}
+
+			var t = 0;
+
+			function loop() {
+
+				mesh.position.x = Math.sin( t ) * 100;
+				mesh.position.y = Math.cos( t ) * 100;
+
+				mesh.rotation.x += 0.5 * Math.PI / 180;
+				mesh.rotation.y += 1.0 * Math.PI / 180;
+				mesh.rotation.z += 1.5 * Math.PI / 180;
+
+				boxMesh.position.z = Math.sin( t ) * 100;
+				boxMesh.rotation.x = Math.sin( t ) * 180 * Math.PI / 180;
+
+				light.position.x = Math.sin( t );
+				light.position.y = 1.5;
+				light.position.z = Math.cos( t );
+
+				lightCube.position.copy( light.position );
+				lightCube.position.multiplyScalar( 200 );
+
+
+				t += 0.02;
+
+				camera.position.x += ( mouseX - camera.position.x ) * .05;
+				camera.position.y += ( - mouseY - camera.position.y ) * .05;
+
+				renderer.render( scene, camera );
+
+				if ( statsEnabled ) stats.update();
+
+			}
+
+			function log( text ) {
+
+				var e = document.getElementById("log");
+				e.innerHTML = text + "<br/>" + e.innerHTML;
+
+			}
+		</script>
+
+	</body>
+</html>

+ 242 - 250
src/extras/io/JSONLoader.js

@@ -6,7 +6,7 @@
 THREE.JSONLoader = function ( showStatus ) {
 
 	THREE.Loader.call( this, showStatus );
-	
+
 };
 
 THREE.JSONLoader.prototype = new THREE.Loader();
@@ -14,342 +14,334 @@ THREE.JSONLoader.prototype.constructor = THREE.JSONLoader;
 THREE.JSONLoader.prototype.supr = THREE.Loader.prototype;
 
 
-THREE.JSONLoader.prototype = {
+/**
+ * Load models generated by slim OBJ converter with ASCII option (converter_obj_three_slim.py -t ascii)
+ *  - parameters
+ *  - model (required)
+ *  - callback (required)
+ *  - texture_path (optional: if not specified, textures will be assumed to be in the same folder as JS model file)
+ */
 
-	// Load models generated by slim OBJ converter with ASCII option (converter_obj_three_slim.py -t ascii)
-	//  - parameters
-	//		- model (required)
-	//		- callback (required)
-	//		- texture_path (optional: if not specified, textures will be assumed to be in the same folder as JS model file)
+THREE.JSONLoader.prototype.load = function ( parameters ) {
 
-	load: function ( parameters ) {
-		
-		var url = parameters.model,
-			callback = parameters.callback, 
-		    texture_path = parameters.texture_path ? parameters.texture_path : THREE.Loader.prototype.extractUrlbase( url ),
-		
-			s = (new Date).getTime(),
-			worker = new Worker( url );
-		
-		worker.onmessage = function( event ) {
-			
-			THREE.JSONLoader.prototype.createModel( event.data, callback, texture_path );
+	var scope = this,
+		url = parameters.model,
+		callback = parameters.callback, 
+		texture_path = parameters.texture_path ? parameters.texture_path : this.extractUrlbase( url ),
+		worker = new Worker( url );
 
-		};
+	worker.onmessage = function ( event ) {
 
-		worker.postMessage( s );
+		scope.createModel( event.data, callback, texture_path );
+		scope.onLoadComplete();
 
-	},
-	
-	createModel: function ( json, callback, texture_path ) {
+	};
 
-		var Model = function ( texture_path ) {
+	this.onLoadStart();
+	worker.postMessage( new Date().getTime() );
 
-			var scope = this;
+};
 
-			THREE.Geometry.call( this );
+THREE.JSONLoader.prototype.createModel = function ( json, callback, texture_path ) {
 
-			THREE.Loader.prototype.init_materials( scope, json.materials, texture_path );
-			
-			parse();
-			init_skin();
-			init_morphing();
+	var scope = this,
+	geometry = new THREE.Geometry();
 
-			this.computeCentroids();
-			this.computeFaceNormals();
-			
-			function parse() {
+	this.init_materials( geometry, json.materials, texture_path );
 
-				if ( json.version === undefined || json.version != 2 ) {
+	parse();
 
-					console.error( 'Deprecated file format.' );
-					return;
+	init_skin();
+	init_morphing();
 
-				}
-	
-				function isBitSet( value, position ) {
-					
-					return value & ( 1 << position );
-
-				};
-				
-				var i, j, fi,
-				
-				offset, zLength,
-
-				type,
-				isQuad, 
-				hasMaterial, 
-				hasFaceUv, hasFaceVertexUv,
-				hasFaceNormal, hasFaceVertexNormal,
-				hasFaceColor, hasFaceVertexColor,
-
-				vertex, face,
-				
-				faces = json.faces,
-				vertices = json.vertices,
-				normals = json.normals,
-				colors = json.colors,
-
-				nUvLayers = 0;
-				
-				// disregard empty arrays
-				
-				for ( i = 0; i < json.uvs.length; i++ ) {
-					
-					if ( json.uvs[ i ].length ) nUvLayers ++;
+	geometry.computeCentroids();
+	geometry.computeFaceNormals();
 
-				}
-				
-				for ( i = 0; i < nUvLayers; i++ ) {
+	function parse() {
 
-					scope.faceUvs[ i ] = [];
-					scope.faceVertexUvs[ i ] = [];
+		if ( json.version === undefined || json.version != 2 ) {
 
-				}
+			console.error( 'Deprecated file format.' );
+			return;
 
-				offset = 0;
-				zLength = vertices.length;
-				
-				while ( offset < zLength ) {
+		}
 
-					vertex = new THREE.Vertex();
-					
-					vertex.position.x = vertices[ offset ++ ];
-					vertex.position.y = vertices[ offset ++ ];
-					vertex.position.z = vertices[ offset ++ ];
+		function isBitSet( value, position ) {
 
-					scope.vertices.push( vertex );
+			return value & ( 1 << position );
 
-				}
-				
-				offset = 0;
-				zLength = faces.length;
+		};
 
-				while ( offset < zLength ) {
+		var i, j, fi,
 
-					type = faces[ offset ++ ];
+		offset, zLength,
 
-					
-					isQuad          	= isBitSet( type, 0 );
-					hasMaterial         = isBitSet( type, 1 );
-					hasFaceUv           = isBitSet( type, 2 );
-					hasFaceVertexUv     = isBitSet( type, 3 );
-					hasFaceNormal       = isBitSet( type, 4 );
-					hasFaceVertexNormal = isBitSet( type, 5 );
-					hasFaceColor	    = isBitSet( type, 6 );
-					hasFaceVertexColor  = isBitSet( type, 7 );
+		type,
+		isQuad, 
+		hasMaterial, 
+		hasFaceUv, hasFaceVertexUv,
+		hasFaceNormal, hasFaceVertexNormal,
+		hasFaceColor, hasFaceVertexColor,
 
-					//console.log("type", type, "bits", isQuad, hasMaterial, hasFaceUv, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor);
+		vertex, face,
 
-					if ( isQuad ) {
+		faces = json.faces,
+		vertices = json.vertices,
+		normals = json.normals,
+		colors = json.colors,
 
-						face = new THREE.Face4();
-						
-						face.a = faces[ offset ++ ];
-						face.b = faces[ offset ++ ];
-						face.c = faces[ offset ++ ];
-						face.d = faces[ offset ++ ];
+		nUvLayers = 0;
 
-						nVertices = 4;
+		// disregard empty arrays
 
-					} else {
+		for ( i = 0; i < json.uvs.length; i++ ) {
 
-						face = new THREE.Face3();
-					
-						face.a = faces[ offset ++ ];
-						face.b = faces[ offset ++ ];
-						face.c = faces[ offset ++ ];
+			if ( json.uvs[ i ].length ) nUvLayers ++;
 
-						nVertices = 3;
+		}
 
-					}
-					
-					if ( hasMaterial ) {
+		for ( i = 0; i < nUvLayers; i++ ) {
 
-						materialIndex = faces[ offset ++ ];
-						face.materials = scope.materials[ materialIndex ];
+			geometry.faceUvs[ i ] = [];
+			geometry.faceVertexUvs[ i ] = [];
 
-					}
+		}
 
-					if ( hasFaceUv ) {
+		offset = 0;
+		zLength = vertices.length;
 
-						for ( i = 0; i < nUvLayers; i++ ) {
+		while ( offset < zLength ) {
 
-							uvLayer = json.uvs[ i ];
+			vertex = new THREE.Vertex();
 
-							uvIndex = faces[ offset ++ ];
+			vertex.position.x = vertices[ offset ++ ];
+			vertex.position.y = vertices[ offset ++ ];
+			vertex.position.z = vertices[ offset ++ ];
 
-							u = uvLayer[ uvIndex * 2 ];
-							v = uvLayer[ uvIndex * 2 + 1 ];
+			geometry.vertices.push( vertex );
 
-							scope.faceUvs[ i ].push( new THREE.UV( u, v ) );
+		}
 
-						}
+		offset = 0;
+		zLength = faces.length;
 
-					}
+		while ( offset < zLength ) {
 
-					if ( hasFaceVertexUv ) {
+			type = faces[ offset ++ ];
 
-						for ( i = 0; i < nUvLayers; i++ ) {
-							
-							uvLayer = json.uvs[ i ];
 
-							uvs = [];
+			isQuad          	= isBitSet( type, 0 );
+			hasMaterial         = isBitSet( type, 1 );
+			hasFaceUv           = isBitSet( type, 2 );
+			hasFaceVertexUv     = isBitSet( type, 3 );
+			hasFaceNormal       = isBitSet( type, 4 );
+			hasFaceVertexNormal = isBitSet( type, 5 );
+			hasFaceColor	    = isBitSet( type, 6 );
+			hasFaceVertexColor  = isBitSet( type, 7 );
 
-							for ( j = 0; j < nVertices; j ++ ) {
+			//console.log("type", type, "bits", isQuad, hasMaterial, hasFaceUv, hasFaceVertexUv, hasFaceNormal, hasFaceVertexNormal, hasFaceColor, hasFaceVertexColor);
 
-								uvIndex = faces[ offset ++ ];
+			if ( isQuad ) {
 
-								u = uvLayer[ uvIndex * 2 ];
-								v = uvLayer[ uvIndex * 2 + 1 ];
+				face = new THREE.Face4();
 
-								uvs[ j ] = new THREE.UV( u, v );
+				face.a = faces[ offset ++ ];
+				face.b = faces[ offset ++ ];
+				face.c = faces[ offset ++ ];
+				face.d = faces[ offset ++ ];
 
-							}
+				nVertices = 4;
 
-							// to get face <=> uv index correspondence
-							
-							fi = scope.faces.length;
-							scope.faceVertexUvs[ i ][ fi ] = uvs;
+			} else {
 
-						}
+				face = new THREE.Face3();
 
-					}
+				face.a = faces[ offset ++ ];
+				face.b = faces[ offset ++ ];
+				face.c = faces[ offset ++ ];
 
-					if ( hasFaceNormal ) {
+				nVertices = 3;
 
-						normalIndex = faces[ offset ++ ] * 3;
+			}
 
-						normal = new THREE.Vector3();
-						
-						normal.x = normals[ normalIndex ++ ];
-						normal.y = normals[ normalIndex ++ ];
-						normal.z = normals[ normalIndex ];
+			if ( hasMaterial ) {
 
-						face.normal = normal;
+				materialIndex = faces[ offset ++ ];
+				face.materials = geometry.materials[ materialIndex ];
 
-					}
+			}
 
-					if ( hasFaceVertexNormal ) {
+			if ( hasFaceUv ) {
 
-						for ( i = 0; i < nVertices; i++ ) {
+				for ( i = 0; i < nUvLayers; i++ ) {
 
-							normalIndex = faces[ offset ++ ] * 3;
+					uvLayer = json.uvs[ i ];
 
-							normal = new THREE.Vector3();
-							
-							normal.x = normals[ normalIndex ++ ];
-							normal.y = normals[ normalIndex ++ ];
-							normal.z = normals[ normalIndex ];
+					uvIndex = faces[ offset ++ ];
 
-							face.vertexNormals.push( normal );
+					u = uvLayer[ uvIndex * 2 ];
+					v = uvLayer[ uvIndex * 2 + 1 ];
 
-						}
+					geometry.faceUvs[ i ].push( new THREE.UV( u, v ) );
 
-					}
+				}
 
-				
-					if ( hasFaceColor ) {
+			}
 
-						color = new THREE.Color( faces[ offset ++ ] );
-						face.color = color;
+			if ( hasFaceVertexUv ) {
 
-					}
+				for ( i = 0; i < nUvLayers; i++ ) {
+
+					uvLayer = json.uvs[ i ];
+
+					uvs = [];
+
+					for ( j = 0; j < nVertices; j ++ ) {
 
-					
-					if ( hasFaceVertexColor ) {
+						uvIndex = faces[ offset ++ ];
 
-						for ( i = 0; i < nVertices; i++ ) {
+						u = uvLayer[ uvIndex * 2 ];
+						v = uvLayer[ uvIndex * 2 + 1 ];
 
-							colorIndex = faces[ offset ++ ];
-							
-							color = new THREE.Color( colors[ colorIndex ] );
-							face.vertexColors.push( color );
-							
-						}
+						uvs[ j ] = new THREE.UV( u, v );
 
 					}
 
-					scope.faces.push( face );
+					// to get face <=> uv index correspondence
+
+					fi = geometry.faces.length;
+					geometry.faceVertexUvs[ i ][ fi ] = uvs;
 
 				}
 
-			};
-			
-			function init_skin() {
-				
-				var i, l, x, y, z, w, a, b, c, d;
+			}
 
-				if ( json.skinWeights ) {
-					
-					for( i = 0, l = json.skinWeights.length; i < l; i += 2 ) {
+			if ( hasFaceNormal ) {
 
-						x = json.skinWeights[ i     ];
-						y = json.skinWeights[ i + 1 ];
-						z = 0;
-						w = 0;
-						
-						scope.skinWeights.push( new THREE.Vector4( x, y, z, w ) );
+				normalIndex = faces[ offset ++ ] * 3;
+
+				normal = new THREE.Vector3();
+
+				normal.x = normals[ normalIndex ++ ];
+				normal.y = normals[ normalIndex ++ ];
+				normal.z = normals[ normalIndex ];
+
+				face.normal = normal;
+
+			}
+
+			if ( hasFaceVertexNormal ) {
+
+				for ( i = 0; i < nVertices; i++ ) {
+
+					normalIndex = faces[ offset ++ ] * 3;
+
+					normal = new THREE.Vector3();
+
+					normal.x = normals[ normalIndex ++ ];
+					normal.y = normals[ normalIndex ++ ];
+					normal.z = normals[ normalIndex ];
+
+					face.vertexNormals.push( normal );
 
-					}
-					
 				}
-				
-				if ( json.skinIndices ) {
-					
-					for( i = 0, l = json.skinIndices.length; i < l; i += 2 ) {
 
-						a = json.skinIndices[ i     ];
-						b = json.skinIndices[ i + 1 ];
-						c = 0;
-						d = 0;
+			}
 
-						scope.skinIndices.push( new THREE.Vector4( a, b, c, d ) );
 
-					}
-				
+			if ( hasFaceColor ) {
+
+				color = new THREE.Color( faces[ offset ++ ] );
+				face.color = color;
+
+			}
+
+
+			if ( hasFaceVertexColor ) {
+
+				for ( i = 0; i < nVertices; i++ ) {
+
+					colorIndex = faces[ offset ++ ];
+
+					color = new THREE.Color( colors[ colorIndex ] );
+					face.vertexColors.push( color );
+
 				}
-				
-				scope.bones = json.bones;
-				scope.animation = json.animation;
-				
-			};
-			
-			function init_morphing() {
-
-				if( json.morphTargets !== undefined ) {
-					
-					var i, l, v, vl;
-					
-					for( i = 0, l = json.morphTargets.length; i < l; i++ ) {
-						
-						scope.morphTargets[ i ] = {};
-						scope.morphTargets[ i ].name = json.morphTargets[ i ].name;
-						scope.morphTargets[ i ].vertices = [];
-						
-						dstVertices = scope.morphTargets[ i ].vertices;
-						srcVertices = json.morphTargets [ i ].vertices;
-
-						for( v = 0, vl = srcVertices.length; v < vl; v += 3 ) {
-
-							dstVertices.push( new THREE.Vertex( new THREE.Vector3( srcVertices[ v ], srcVertices[ v + 1 ], srcVertices[ v + 2 ] ) ) );
-
-						}
-						
-					} 
-					
+
+			}
+
+			geometry.faces.push( face );
+
+		}
+
+	};
+
+	function init_skin() {
+
+		var i, l, x, y, z, w, a, b, c, d;
+
+		if ( json.skinWeights ) {
+
+			for( i = 0, l = json.skinWeights.length; i < l; i += 2 ) {
+
+				x = json.skinWeights[ i     ];
+				y = json.skinWeights[ i + 1 ];
+				z = 0;
+				w = 0;
+
+				geometry.skinWeights.push( new THREE.Vector4( x, y, z, w ) );
+
+			}
+
+		}
+
+		if ( json.skinIndices ) {
+
+			for( i = 0, l = json.skinIndices.length; i < l; i += 2 ) {
+
+				a = json.skinIndices[ i     ];
+				b = json.skinIndices[ i + 1 ];
+				c = 0;
+				d = 0;
+
+				geometry.skinIndices.push( new THREE.Vector4( a, b, c, d ) );
+
+			}
+
+		}
+
+		geometry.bones = json.bones;
+		geometry.animation = json.animation;
+
+	};
+
+	function init_morphing() {
+
+		if( json.morphTargets !== undefined ) {
+
+			var i, l, v, vl;
+
+			for( i = 0, l = json.morphTargets.length; i < l; i++ ) {
+
+				geometry.morphTargets[ i ] = {};
+				geometry.morphTargets[ i ].name = json.morphTargets[ i ].name;
+				geometry.morphTargets[ i ].vertices = [];
+
+				dstVertices = geometry.morphTargets[ i ].vertices;
+				srcVertices = json.morphTargets [ i ].vertices;
+
+				for( v = 0, vl = srcVertices.length; v < vl; v += 3 ) {
+
+					dstVertices.push( new THREE.Vertex( new THREE.Vector3( srcVertices[ v ], srcVertices[ v + 1 ], srcVertices[ v + 2 ] ) ) );
+
 				}
 
-			};
-			
-		};
+			} 
 
-		Model.prototype = new THREE.Geometry();
-		Model.prototype.constructor = Model;
+		}
 
-		callback( new Model( texture_path ) );
+	};
 
-	}
+	callback( geometry );
 
-};
+}

+ 36 - 33
src/extras/io/Loader.js

@@ -4,34 +4,38 @@
 
 THREE.Loader = function ( showStatus ) {
 
-	this.showStatus = showStatus;	
+	this.showStatus = showStatus;
 	this.statusDomElement = showStatus ? THREE.Loader.prototype.addStatusElement() : null;
 
+	this.onLoadStart = function () {};
+	this.onLoadProgress = function() {};
+	this.onLoadComplete = function () {};
+
 };
 
 THREE.Loader.prototype = {
 
-	addStatusElement: function ( ) {
-		
+	addStatusElement: function () {
+
 		var e = document.createElement( "div" );
-		
-		e.style.fontSize = "0.8em"; 
-		e.style.textAlign = "left";
-		e.style.background = "#b00"; 
-		e.style.color = "#fff"; 
-		e.style.width = "140px"; 
-		e.style.padding = "0.25em 0.25em 0.25em 0.5em"; 
+
 		e.style.position = "absolute"; 
 		e.style.right = "0px"; 
 		e.style.top = "0px"; 
+		e.style.fontSize = "0.8em"; 
+		e.style.textAlign = "left";
+		e.style.background = "rgba(0,0,0,0.25)"; 
+		e.style.color = "#fff"; 
+		e.style.width = "120px"; 
+		e.style.padding = "0.5em 0.5em 0.5em 0.5em"; 
 		e.style.zIndex = 1000;
-		
+
 		e.innerHTML = "Loading ...";
-		
+
 		return e;
-		
+
 	},
-	
+
 	updateProgress: function ( progress ) {
 
 		var message = "Loaded ";
@@ -50,13 +54,13 @@ THREE.Loader.prototype = {
 		this.statusDomElement.innerHTML = message;
 
 	},
-	
+
 	extractUrlbase: function( url ) {
-		
+
 		var chunks = url.split( "/" );
 		chunks.pop();
 		return chunks.join( "/" );
-		
+
 	},
 
 	init_materials: function( scope, materials, texture_path ) {
@@ -88,9 +92,9 @@ THREE.Loader.prototype = {
 		}
 
 		function load_image( where, url ) {
-			
+
 			var image = new Image();
-			
+
 			image.onload = function () {
 
 				if ( !is_pow2( this.width ) || !is_pow2( this.height ) ) {
@@ -113,20 +117,21 @@ THREE.Loader.prototype = {
 			};
 
 			image.src = url;
-			
+
 		}
-		
+
 		var material, mtype, mpars, texture, color;
 
 		// defaults
-		
+
 		mtype = "MeshLambertMaterial";
+
 		mpars = { color: 0xeeeeee, opacity: 1.0, map: null, lightMap: null, vertexColors: m.vertexColors ? THREE.VertexColors : false, wireframe: m.wireframe };
 		
 		// parameters from model file
-		
+
 		if ( m.shading ) {
-			
+
 			if ( m.shading == "Phong" ) mtype = "MeshPhongMaterial";
 			else if ( m.shading == "Basic" ) mtype = "MeshBasicMaterial";
 
@@ -135,10 +140,10 @@ THREE.Loader.prototype = {
 		if ( m.mapDiffuse && texture_path ) {
 
 			texture = document.createElement( 'canvas' );
-			
+
 			mpars.map = new THREE.Texture( texture );
 			mpars.map.sourceFile = m.mapDiffuse;
-			
+
 			load_image( mpars.map, texture_path + "/" + m.mapDiffuse );
 
 		} else if ( m.colorDiffuse ) {
@@ -156,20 +161,18 @@ THREE.Loader.prototype = {
 		if ( m.mapLightmap && texture_path ) {
 
 			texture = document.createElement( 'canvas' );
-			
+
 			mpars.lightMap = new THREE.Texture( texture );
 			mpars.lightMap.sourceFile = m.mapLightmap;
-			
+
 			load_image( mpars.lightMap, texture_path + "/" + m.mapLightmap );
 
 		}
-		
+
 		material = new THREE[ mtype ]( mpars );
 
 		return material;
 
-	}	
-	
-};
-	
+	}
 
+};

+ 59 - 0
src/materials/ShadowVolumeDynamicMaterial.js

@@ -0,0 +1,59 @@
+/**
+ * @author mr.doob / http://mrdoob.com/
+ * @author alteredq / http://alteredqualia.com/
+ *
+ * parameters = {
+ *  color: <hex>,
+ *  opacity: <float>,
+ *  map: new THREE.Texture( <Image> ),
+ 
+ *  lightMap: new THREE.Texture( <Image> ),
+ 
+ *  envMap: new THREE.TextureCube( [posx, negx, posy, negy, posz, negz] ),
+ *  combine: THREE.Multiply,
+ *  reflectivity: <float>,
+ *  refractionRatio: <float>,
+ 
+ *  shading: THREE.SmoothShading,
+ *  blending: THREE.NormalBlending,
+ *  depthTest: <bool>,
+ 
+ *  wireframe: <boolean>,
+ *  wireframeLinewidth: <float>,
+ 
+ *  vertexColors: <bool>,
+ *  skinning: <bool>
+ * }
+ */
+
+THREE.ShadowVolumeDynamicMaterial = function ( parameters ) {
+
+	this.id = THREE.MaterialCounter.value ++;
+
+	this.color = new THREE.Color( 0xffffff );
+	this.opacity = 1.0;
+	this.map = null;
+
+	this.lightMap = null;
+
+	this.envMap = null;
+	this.combine = THREE.MultiplyOperation;
+	this.reflectivity = 1.0;
+	this.refractionRatio = 0.98;
+
+	this.fog = true; // implemented just in WebGLRenderer2
+
+	this.shading = THREE.FlatShading;
+	this.blending = THREE.NormalBlending;
+	this.depthTest = true;
+
+	this.wireframe = false;
+	this.wireframeLinewidth = 1.0;
+	this.wireframeLinecap = 'round'; // implemented just in CanvasRenderer
+	this.wireframeLinejoin = 'round'; // implemented just in CanvasRenderer
+
+	this.vertexColors = false;
+	this.skinning = false;
+	this.morphTargets = false;
+
+};

+ 200 - 0
src/objects/ShadowVolume.js

@@ -0,0 +1,200 @@
+/*
+ * Shadow Volume
+ */
+
+THREE.ShadowVolume = function( mesh, isStatic ) {
+	
+	THREE.Mesh.call( this, mesh.geometry, isStatic ? [ new THREE.ShadowVolumeDynamicMaterial() ] : [ new THREE.ShadowVolumeDynamicMaterial() ] );
+	mesh.addChild( this );
+
+	this.calculateShadowVolumeGeometry( mesh.geometry );
+}
+
+THREE.ShadowVolume.prototype             = new THREE.Mesh();
+THREE.ShadowVolume.prototype.constructor = THREE.ShadowVolume;
+THREE.ShadowVolume.prototype.supr        = THREE.Mesh.prototype;
+
+
+/*
+ * Calculate Geometry
+ */
+
+THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry = function( originalGeometry ) {
+	
+	// create geometry
+	
+	this.geometry = new THREE.Geometry();
+	this.geometry.boundingSphere = originalGeometry.boundingSphere;
+	this.geometry.edgeFaces = [];
+		
+	// copy vertices / faces from original mesh
+	
+	var vertexTypes = this.geometry.vertexTypes;
+	var vertices    = this.geometry.vertices;
+	var	faces       = this.geometry.faces;
+	var edgeFaces   = this.geometry.edgeFaces;
+
+	var originalFaces    = originalGeometry.faces;	
+	var originalVertices = originalGeometry.vertices;
+	var	fl               = originalFaces.length;
+	
+	var	originalFace, face, i, f, n, vertex, numVertices;
+	var indices = [ "a", "b", "c", "d" ];
+
+
+	for( f = 0; f < fl; f++ ) {
+		
+		numVertices = vertices.length;
+		originalFace = originalFaces[ f ];
+
+		if ( originalFace instanceof THREE.Face4 ) {
+			
+			n = 4;
+			face = new THREE.Face4( numVertices, numVertices + 1, numVertices + 2, numVertices + 3 );
+		
+		} else {
+			
+          	n = 3;
+			face = new THREE.Face3( numVertices, numVertices + 1, numVertices + 2 );
+		}
+
+		face.normal.copy( originalFace.normal );
+		faces.push( face );
+
+
+		for( i = 0; i < n; i++ ) {
+			
+			vertex = originalVertices[ originalFace[ indices[ i ]]];
+			vertices.push( new THREE.Vertex( vertex.position.clone()));
+		
+		}
+
+	}
+	
+
+	// calculate edge faces
+
+	var result, faceA, faceB, v, vl;
+	
+	for( var fa = 0; fa < originalFaces.length - 1; fa++ ) {
+		
+		faceA = faces[ fa ];
+		
+		for( var fb = fa + 1; fb < originalFaces.length; fb++ ) {
+			
+			faceB = faces[ fb ];
+			result = this.facesShareEdge( vertices, faceA, faceB );
+			
+			if( result !== undefined ) {
+
+				numVertices = vertices.length;
+				face = new THREE.Face4( result.indices[ 0 ], result.indices[ 3 ], result.indices[ 2 ], result.indices[ 1 ] );
+				face.normal.set( 1, 0, 0 );
+				edgeFaces.push( face );
+
+			}
+
+		}
+
+	}
+
+}
+
+
+
+/*
+ * Faces share edge?
+ */
+
+THREE.ShadowVolume.prototype.facesShareEdge = function( vertices, faceA, faceB ) {
+
+	var indicesA,
+		indicesB,
+		indexA,
+		indexB,
+		vertexA,
+		vertexB,
+		savedVertexA,
+		savedVertexB,
+		savedIndexA,
+		savedIndexB,
+		indexLetters,
+		a, b,
+		numMatches = 0,
+		indices = [ "a", "b", "c", "d" ];
+	
+	if( faceA instanceof THREE.Face4 ) indicesA = 4;
+	else                               indicesA = 3;
+	
+	if( faceB instanceof THREE.Face4 ) indicesB = 4;
+	else                               indicesB = 3;
+	
+	
+	for( a = 0; a < indicesA; a++ ) {
+		
+		indexA  = faceA[ indices[ a ] ];
+		vertexA = vertices[ indexA ];
+	
+		for( b = 0; b < indicesB; b++ ) {
+
+			indexB  = faceB[ indices[ b ] ];
+			vertexB = vertices[ indexB ];
+			
+			if( Math.abs( vertexA.position.x - vertexB.position.x ) < 0.0001 &&
+				Math.abs( vertexA.position.y - vertexB.position.y ) < 0.0001 &&
+				Math.abs( vertexA.position.z - vertexB.position.z ) < 0.0001 ) {
+			
+				numMatches++;
+				
+				if( numMatches === 1 ) {
+					
+ 					savedVertexA = vertexA;
+ 					savedVertexB = vertexB;
+					savedIndexA  = indexA;
+					savedIndexB  = indexB;
+					indexLetters = indices[ a ];
+
+				}
+				
+				if( numMatches === 2 ) {
+
+					indexLetters += indices[ a ];
+					
+					if( indexLetters === "ad" || indexLetters === "ac" ) {
+						
+						return {
+							
+							faces   	: [ faceA, faceB ],
+							vertices	: [ savedVertexA, savedVertexB, vertexB, vertexA  ],
+							indices		: [ savedIndexA,  savedIndexB,  indexB,  indexA   ],
+							vertexTypes	: [ 1, 2, 2, 1 ],
+							extrudable	: true
+
+						};
+
+					} else {
+						
+						return {
+							
+							faces   	: [ faceA, faceB ],
+							vertices	: [ savedVertexA, vertexA, vertexB, savedVertexB ],
+							indices		: [ savedIndexA,  indexA,  indexB,  savedIndexB  ],
+							vertexTypes	: [ 1, 1, 2, 2 ],
+							extrudable	: true
+
+						};
+
+					}
+					
+				}
+				
+			}
+			
+		}
+		
+	}
+
+	return undefined;
+
+}
+

+ 330 - 86
src/renderers/WebGLRenderer.js

@@ -32,6 +32,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_oldFlipSided = null,
 	_oldBlending = null,
 	_oldDepth = null,
+	_cullEnabled = true,
 
 	_viewportX = 0,
 	_viewportY = 0,
@@ -88,7 +89,42 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	this.context = _gl;
 
-	// alert( dumpObject( getGLParams() ) );
+
+	// create shadow polygons
+
+	var _shadow   = {};
+	var vertices = [];
+	var faces    = [];
+	
+	vertices[ 0 * 3 + 0 ] = -2; vertices[ 0 * 3 + 1 ] = -1; vertices[ 0 * 3 + 2 ] = -1;
+	vertices[ 1 * 3 + 0 ] =  2; vertices[ 1 * 3 + 1 ] = -1; vertices[ 1 * 3 + 2 ] = -1;
+	vertices[ 2 * 3 + 0 ] =  2; vertices[ 2 * 3 + 1 ] =  1; vertices[ 2 * 3 + 2 ] = -1;
+	vertices[ 3 * 3 + 0 ] = -2; vertices[ 3 * 3 + 1 ] =  1; vertices[ 3 * 3 + 2 ] = -1;
+	
+	faces[ 0 ] = 0; faces[ 1 ] = 1; faces[ 2 ] = 2;
+	faces[ 3 ] = 0; faces[ 4 ] = 2; faces[ 5 ] = 3;
+
+
+	_shadow.vertexBuffer  = _gl.createBuffer();
+	_shadow.elementBuffer = _gl.createBuffer();
+	
+	_gl.bindBuffer( _gl.ARRAY_BUFFER, _shadow.vertexBuffer );
+	_gl.bufferData( _gl.ARRAY_BUFFER, new Float32Array( vertices ), _gl.STATIC_DRAW );
+
+	_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _shadow.elementBuffer );
+	_gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, new Uint16Array( faces ), _gl.STATIC_DRAW );
+	
+
+	_shadow.program = _gl.createProgram();
+
+	_gl.attachShader( _shadow.program, getShader( "fragment", THREE.ShaderLib.shadowPost.fragmentShader ));
+	_gl.attachShader( _shadow.program, getShader( "vertex",   THREE.ShaderLib.shadowPost.vertexShader   ));
+
+	_gl.linkProgram( _shadow.program );
+
+	_shadow.vertexLocation     = _gl.getAttribLocation ( _shadow.program, "position"         );
+	_shadow.projectionLocation = _gl.getUniformLocation( _shadow.program, "projectionMatrix" );
+
 
 	this.setSize = function ( width, height ) {
 
@@ -147,7 +183,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	this.clear = function () {
 
-		_gl.clear( _gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT );
+		_gl.clear( _gl.COLOR_BUFFER_BIT | _gl.DEPTH_BUFFER_BIT | _gl.STENCIL_BUFFER_BIT );
 
 	};
 
@@ -321,7 +357,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	function initMeshBuffers ( geometryGroup, object ) {
 
-		var f, fl, 
+		var f, fl, fi, face,
 		
 			nvertices = 0, ntris = 0, nlines = 0,
 			
@@ -408,7 +444,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		geometryGroup.__faceArray = new Uint16Array( ntris * 3 );
+		geometryGroup.__faceArray = new Uint16Array( ntris * 3 + ( object.geometry.edgeFaces ? object.geometry.edgeFaces.length * 2 * 3 : 0 ));
 		geometryGroup.__lineArray = new Uint16Array( nlines * 2 );
 
 		if( geometryGroup.numMorphTargets ) {
@@ -429,7 +465,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		geometryGroup.__vertexColorType = vertexColorType;
 		geometryGroup.__normalType = normalType;
 
-		geometryGroup.__webGLFaceCount = ntris * 3;
+		geometryGroup.__webGLFaceCount = ntris * 3 + ( object.geometry.edgeFaces ? object.geometry.edgeFaces.length * 2 * 3 : 0 );
 		geometryGroup.__webGLLineCount = nlines * 2;		
 
 	};
@@ -510,6 +546,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 		obj_skinVerticesB = geometry.skinVerticesB,
 		obj_skinIndices = geometry.skinIndices,
 		obj_skinWeights = geometry.skinWeights,
+		obj_edgeFaces = geometry.edgeFaces,
 
 		morphTargets = geometry.morphTargets;
 		
@@ -1163,6 +1200,24 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+		if( obj_edgeFaces ) {
+			
+			for( f = 0, fl = obj_edgeFaces.length; f < fl; f++ ) {
+				
+				faceArray[ offset_face ]     = obj_edgeFaces[ f ].a;
+				faceArray[ offset_face + 1 ] = obj_edgeFaces[ f ].b;
+				faceArray[ offset_face + 2 ] = obj_edgeFaces[ f ].c;
+
+				faceArray[ offset_face + 3 ] = obj_edgeFaces[ f ].a;
+				faceArray[ offset_face + 4 ] = obj_edgeFaces[ f ].c;
+				faceArray[ offset_face + 5 ] = obj_edgeFaces[ f ].d;
+
+				offset_face += 6;
+			}
+			
+		}
+
+
 		if ( dirtyVertices ) {
 
 			_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webGLVertexBuffer );
@@ -1463,15 +1518,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
-	function setMaterialShaders ( material, shaders ) {
+	function setMaterialShaders( material, shaders ) {
 
-		material.fragmentShader = shaders.fragmentShader;
-		material.vertexShader = shaders.vertexShader;
 		material.uniforms = Uniforms.clone( shaders.uniforms );
+		material.vertexShader = shaders.vertexShader;
+		material.fragmentShader = shaders.fragmentShader;
 
 	};
 
-	function refreshUniformsCommon ( uniforms, material ) {
+	function refreshUniformsCommon( uniforms, material ) {
 
 		// premultiply alpha
 		uniforms.diffuse.value.setRGB( material.color.r * material.opacity, material.color.g * material.opacity, material.color.b * material.opacity );
@@ -1556,6 +1611,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			setMaterialShaders( material, THREE.ShaderLib[ 'depth' ] );
 
+		} else if ( material instanceof THREE.ShadowVolumeDynamicMaterial ) {
+
+			setMaterialShaders( material, THREE.ShaderLib[ 'shadowVolumeDynamic' ] );
+
 		} else if ( material instanceof THREE.MeshNormalMaterial ) {
 
 			setMaterialShaders( material, THREE.ShaderLib[ 'normal' ] );
@@ -1582,103 +1641,112 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
-		// heuristics to create shader parameters according to lights in the scene
-		// (not to blow over maxLights budget)
+		if ( ! material.program ) {
 
-		maxLightCount = allocateLights( lights, 4 );
+			// heuristics to create shader parameters according to lights in the scene
+			// (not to blow over maxLights budget)
 
-		maxBones = allocateBones( object );
-		
-		parameters = { fog: fog, map: material.map, envMap: material.envMap, lightMap: material.lightMap, vertexColors: material.vertexColors,
-					   sizeAttenuation: material.sizeAttenuation,
-					   skinning: material.skinning,
-					   morphTargets: material.morphTargets,
-					   maxDirLights: maxLightCount.directional, maxPointLights: maxLightCount.point,
-					   maxBones: maxBones };
+			maxLightCount = allocateLights( lights, 4 );
 
-		material.program = buildProgram( material.fragmentShader, material.vertexShader, parameters );
+			maxBones = allocateBones( object );
 
+			parameters = { fog: fog, map: material.map, envMap: material.envMap, lightMap: material.lightMap, vertexColors: material.vertexColors,
+						   sizeAttenuation: material.sizeAttenuation,
+						   skinning: material.skinning,
+						   morphTargets: material.morphTargets,
+						   maxDirLights: maxLightCount.directional, maxPointLights: maxLightCount.point,
+						   maxBones: maxBones };
 
-		// load uniforms
+			material.program = buildProgram( material.fragmentShader, material.vertexShader, parameters );
 
-		identifiers = [ 'viewMatrix', 'modelViewMatrix', 'projectionMatrix', 'normalMatrix', 'objectMatrix', 'cameraPosition',
-						'cameraInverseMatrix', 'boneGlobalMatrices', 'morphTargetInfluences'
-						];
+			// load uniforms
 
+			identifiers = [ 'viewMatrix', 'modelViewMatrix', 'projectionMatrix', 'normalMatrix', 'objectMatrix', 'cameraPosition',
+							'cameraInverseMatrix', 'boneGlobalMatrices', 'morphTargetInfluences'
+							];
 
-		for( u in material.uniforms ) {
 
-			identifiers.push(u);
-		}
+			for( u in material.uniforms ) {
 
-		cacheUniformLocations( material.program, identifiers );
-		
+				identifiers.push(u);
+			}
 
-		// load attributes
-		
-		identifiers = [ "position", "normal", "uv", "uv2", "tangent", "color",
-					    "skinVertexA", "skinVertexB", "skinIndex", "skinWeight" ];
-		
-		for( i = 0; i < this.maxMorphTargets; i++ ) {
-			
-			identifiers.push( "morphTarget" + i );
-		}
-		
-		for( a in material.attributes ) {
-			
-			identifiers.push( a );
-		}
-		
-		cacheAttributeLocations( material.program, identifiers );
+			cacheUniformLocations( material.program, identifiers );
 
 
-		var attributes = material.program.attributes;
+			// load attributes
 
-		_gl.enableVertexAttribArray( attributes.position );
+			identifiers = [ "position", "normal", "uv", "uv2", "tangent", "color",
+						    "skinVertexA", "skinVertexB", "skinIndex", "skinWeight" ];
 
-		if ( attributes.color >= 0 ) 	_gl.enableVertexAttribArray( attributes.color );
-		if ( attributes.normal >= 0 ) 	_gl.enableVertexAttribArray( attributes.normal );
-		if ( attributes.tangent >= 0 ) 	_gl.enableVertexAttribArray( attributes.tangent );
+			for ( i = 0; i < this.maxMorphTargets; i++ ) {
 
-		if ( material.skinning &&
-			 attributes.skinVertexA >=0 && attributes.skinVertexB >= 0 &&
-			 attributes.skinIndex >= 0 && attributes.skinWeight >= 0 ) {
+				identifiers.push( "morphTarget" + i );
+			}
 
-			_gl.enableVertexAttribArray( attributes.skinVertexA );
-			_gl.enableVertexAttribArray( attributes.skinVertexB );
-			_gl.enableVertexAttribArray( attributes.skinIndex );
-			_gl.enableVertexAttribArray( attributes.skinWeight );
+			for ( a in material.attributes ) {
 
-		}
-		
-		if ( material.morphTargets ) {
-			
-			material.numSupportedMorphTargets = 0;
-			
-			if( attributes.morphTarget0 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget0 ); material.numSupportedMorphTargets++ }
-			if( attributes.morphTarget1 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget1 ); material.numSupportedMorphTargets++ }
-			if( attributes.morphTarget2 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget2 ); material.numSupportedMorphTargets++ }
-			if( attributes.morphTarget3 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget3 ); material.numSupportedMorphTargets++ }
-			if( attributes.morphTarget4 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget4 ); material.numSupportedMorphTargets++ }
-			if( attributes.morphTarget5 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget5 ); material.numSupportedMorphTargets++ }
-			if( attributes.morphTarget6 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget6 ); material.numSupportedMorphTargets++ }
-			if( attributes.morphTarget7 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget7 ); material.numSupportedMorphTargets++ }
-			 	
-			object.__webGLMorphTargetInfluences = new Float32Array( this.maxMorphTargets );
-			
-			for( var i = 0; i < this.maxMorphTargets; i++ ) {
-				
-				object.__webGLMorphTargetInfluences[ i ] = 0;
-				
+				identifiers.push( a );
 			}
-			
+
+			cacheAttributeLocations( material.program, identifiers );
+
+
+			var attributes = material.program.attributes;
+
+			_gl.enableVertexAttribArray( attributes.position );
+
+			if ( attributes.color >= 0 ) 	_gl.enableVertexAttribArray( attributes.color );
+			if ( attributes.normal >= 0 ) 	_gl.enableVertexAttribArray( attributes.normal );
+			if ( attributes.tangent >= 0 ) 	_gl.enableVertexAttribArray( attributes.tangent );
+
+			if ( material.skinning &&
+				 attributes.skinVertexA >=0 && attributes.skinVertexB >= 0 &&
+				 attributes.skinIndex >= 0 && attributes.skinWeight >= 0 ) {
+
+				_gl.enableVertexAttribArray( attributes.skinVertexA );
+				_gl.enableVertexAttribArray( attributes.skinVertexB );
+				_gl.enableVertexAttribArray( attributes.skinIndex );
+				_gl.enableVertexAttribArray( attributes.skinWeight );
+
+			}
+
+			if ( material.morphTargets ) {
+
+				material.numSupportedMorphTargets = 0;
+
+				if( attributes.morphTarget0 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget0 ); material.numSupportedMorphTargets++ }
+				if( attributes.morphTarget1 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget1 ); material.numSupportedMorphTargets++ }
+				if( attributes.morphTarget2 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget2 ); material.numSupportedMorphTargets++ }
+				if( attributes.morphTarget3 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget3 ); material.numSupportedMorphTargets++ }
+				if( attributes.morphTarget4 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget4 ); material.numSupportedMorphTargets++ }
+				if( attributes.morphTarget5 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget5 ); material.numSupportedMorphTargets++ }
+				if( attributes.morphTarget6 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget6 ); material.numSupportedMorphTargets++ }
+				if( attributes.morphTarget7 >= 0 ) { _gl.enableVertexAttribArray( attributes.morphTarget7 ); material.numSupportedMorphTargets++ }
+
+				object.__webGLMorphTargetInfluences = new Float32Array( this.maxMorphTargets );
+
+				for( var i = 0; i < this.maxMorphTargets; i++ ) {
+
+					object.__webGLMorphTargetInfluences[ i ] = 0;
+
+				}
+
+			}
+
 		}
 
+		material.__webglProgram = true;
+
 	};
 
 	function setProgram( camera, lights, fog, material, object ) {
 
-		if ( !material.program ) _this.initMaterial( material, lights, fog, object );
+		if ( ! material.__webglProgram ) {
+
+			_this.initMaterial( material, lights, fog, object );
+
+		}
 
 		var program = material.program,
 			p_uniforms = program.uniforms,
@@ -1782,6 +1850,20 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+		if( material instanceof THREE.ShadowVolumeDynamicMaterial ) {
+			
+			var dirLight = m_uniforms.directionalLightDirection.value;
+			
+			dirLight[ 0 ] = -lights.position.x;
+			dirLight[ 1 ] = -lights.position.y;
+			dirLight[ 2 ] = -lights.position.z;
+			
+			_gl.uniform3fv( p_uniforms.directionalLightDirection, dirLight );
+			_gl.uniformMatrix4fv( p_uniforms.objectMatrix, false, object._objectMatrixArray );
+			_gl.uniformMatrix4fv( p_uniforms.viewMatrix, false, _viewMatrixArray );
+		}
+
+
 		if ( material.skinning ) {
 
 			loadUniformsSkinning( p_uniforms, object );
@@ -2261,6 +2343,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			this.clear();
 
 		}
+		
 
 		// set matrices
 
@@ -2450,6 +2533,150 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+
+
+		//////////////////////// stencil shadows begin //////////////////////
+		// method: we're rendering the world in light, then the shadow
+		//         volumes into the stencil and last a big darkening 
+		//         quad over the whole thing. This is NOT how you're
+		//         supposed to do stencil shadows but is much faster
+		//
+
+		if( scene.__webglShadowVolumes.length && scene.lights.length ) {
+			
+			// setup stencil
+	
+			_gl.enable( _gl.POLYGON_OFFSET_FILL );
+			_gl.polygonOffset( 0.1, 1.0 );
+			_gl.enable( _gl.STENCIL_TEST );
+			_gl.depthMask( false );
+			_gl.colorMask( false, false, false, false );
+		
+			_gl.stencilFunc( _gl.ALWAYS, 1, 0xFF );
+			_gl.stencilOpSeparate( _gl.BACK,  _gl.KEEP, _gl.INCR, _gl.KEEP );
+			_gl.stencilOpSeparate( _gl.FRONT, _gl.KEEP, _gl.DECR, _gl.KEEP );
+	
+	
+			
+			// loop through all directional lights
+			
+			var l, ll = scene.lights.length;
+			var p;
+			var light, geometryGroup;
+			var dirLight = [];			
+			var	program;
+			var p_uniforms;
+		    var m_uniforms;
+		    var attributes;
+	
+			ol = scene.__webglShadowVolumes.length;
+			
+			for( l = 0; l < ll; l++ ) {
+				
+				light = scene.lights[ l ];
+				
+				if( light instanceof THREE.DirectionalLight ) {
+
+					dirLight[ 0 ] = -light.position.x;
+					dirLight[ 1 ] = -light.position.y;
+					dirLight[ 2 ] = -light.position.z;
+
+					
+					// render all volumes
+					
+					for ( o = 0; o < ol; o++ ) {
+			
+						object        = scene.__webglShadowVolumes[ o ].object;
+						geometryGroup = scene.__webglShadowVolumes[ o ].buffer;
+						material      = object.materials[ 0 ];
+
+
+						if ( !material.program ) _this.initMaterial( material, lights, fog, object );
+	
+						program = material.program,
+			  			p_uniforms = program.uniforms,
+		                m_uniforms = material.uniforms,
+		                attributes = program.attributes;
+
+
+						if( _oldProgram !== program ) {
+							
+							_gl.useProgram( program );
+							_oldProgram = program;
+
+							_gl.uniformMatrix4fv( p_uniforms.projectionMatrix, false, _projectionMatrixArray );
+							_gl.uniformMatrix4fv( p_uniforms.viewMatrix, false, _viewMatrixArray );
+							_gl.uniform3fv( p_uniforms.directionalLightDirection, dirLight );
+						}
+
+
+						object.matrixWorld.flattenToArray( object._objectMatrixArray );
+						//object._modelViewMatrix.multiplyToArray( camera.matrixWorldInverse, object.matrixWorld, object._modelViewMatrixArray );
+
+						_gl.uniformMatrix4fv( p_uniforms.objectMatrix, false, object._objectMatrixArray );
+						//_gl.uniformMatrix4fv( p_uniforms.modelViewMatrix, false, object._modelViewMatrixArray );
+
+	
+						_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webGLVertexBuffer );
+						_gl.vertexAttribPointer( attributes.position, 3, _gl.FLOAT, false, 0, 0 );
+
+						_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webGLNormalBuffer );
+						_gl.vertexAttribPointer( attributes.normal, 3, _gl.FLOAT, false, 0, 0 );
+
+						_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webGLFaceBuffer );
+
+						_gl.cullFace( _gl.FRONT );
+						_gl.drawElements( _gl.TRIANGLES, geometryGroup.__webGLFaceCount, _gl.UNSIGNED_SHORT, 0 );
+
+						_gl.cullFace( _gl.BACK );
+						_gl.drawElements( _gl.TRIANGLES, geometryGroup.__webGLFaceCount, _gl.UNSIGNED_SHORT, 0 );
+				
+					}
+	
+				}
+	
+			}
+	
+	
+			// draw darkening polygon	
+	
+			_gl.disable( _gl.POLYGON_OFFSET_FILL );
+			_gl.colorMask( true, true, true, true );
+			_gl.stencilFunc( _gl.NOTEQUAL, 0, 0xFF );
+			_gl.stencilOp( _gl.KEEP, _gl.KEEP, _gl.KEEP );
+		    _gl.disable( _gl.DEPTH_TEST );
+			
+			_gl.enable( _gl.BLEND );
+			_gl.blendFunc( _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA );
+			_gl.blendEquation( _gl.FUNC_ADD );
+	
+	
+			_oldBlending = "";
+			_oldProgram = _shadow.program;
+	
+			_gl.useProgram( _shadow.program );
+			_gl.uniformMatrix4fv( _shadow.projectionLocation, false, _projectionMatrixArray );
+			
+			_gl.bindBuffer( _gl.ARRAY_BUFFER, _shadow.vertexBuffer );
+			_gl.vertexAttribPointer( _shadow.vertexLocation, 3, _gl.FLOAT, false, 0, 0 );
+			_gl.enableVertexAttribArray( _shadow.vertexLocation );
+				
+			_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _shadow.elementBuffer );
+			_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );
+	
+	
+			// disable stencil
+	
+		    _gl.disable	 ( _gl.STENCIL_TEST );
+		    _gl.enable	 ( _gl.DEPTH_TEST );
+			_gl.disable  ( _gl.BLEND );
+		    _gl.depthMask( true );
+		}
+
+
+		//////////////////////// stencil shadows end //////////////////////
+
+
 		// Generate mipmap if we're using any kind of mipmap filtering
 
 		if ( renderTarget && renderTarget.minFilter !== THREE.NearestFilter && renderTarget.minFilter !== THREE.LinearFilter ) {
@@ -2473,7 +2700,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			scene.__webglObjects = [];
 			scene.__webglObjectsImmediate = [];
-
+			scene.__webglShadowVolumes = [];
 		}
 
 		while ( scene.__objectsAdded.length ) {
@@ -2497,6 +2724,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 			updateObject( scene.__webglObjects[ o ].object, scene );
 
 		}
+		
+		for ( var o = 0, ol = scene.__webglShadowVolumes.length; o < ol; o ++ ) {
+
+			updateObject( scene.__webglShadowVolumes[ o ].object, scene );
+
+		}
+		
 
 	};
 
@@ -2551,8 +2785,15 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 				// create separate wrapper per each use of VBO
 
-				addBuffer( scene.__webglObjects, geometryGroup, object );
-
+				if( object instanceof THREE.ShadowVolume ) {
+					
+					addBuffer( scene.__webglShadowVolumes, geometryGroup, object );
+					
+				} else {
+					
+					addBuffer( scene.__webglObjects, geometryGroup, object );
+					
+				}
 			}
 
 		} else if ( object instanceof THREE.Ribbon ) {
@@ -2861,7 +3102,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		try {
 
-			if ( ! ( _gl = _canvas.getContext( 'experimental-webgl', { antialias: antialias } ) ) ) {
+			if ( ! ( _gl = _canvas.getContext( 'experimental-webgl', { antialias: antialias, stencil:true } ) ) ) {
 
 				throw 'Error creating WebGL context.';
 
@@ -3354,7 +3595,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			case THREE.LinearFilter:
 			case THREE.LinearMipMapNearestFilter:
-			case THREE.LinearMipMapLinearFilter: return _gl.LINEAR; break;
+			case THREE.LinearMipMapLinearFilter: 
+			default:
+				
+				return _gl.LINEAR; break;
 
 		}
 		

+ 61 - 0
src/renderers/WebGLShaders.js

@@ -6,6 +6,7 @@
 
 THREE.ShaderChunk = {
 
+
 	// FOG
 
 	fog_pars_fragment: [
@@ -555,6 +556,66 @@ THREE.UniformsLib = {
 
 THREE.ShaderLib = {
 
+	'shadowPost': {
+		
+		vertexShader: [
+		
+			"uniform 	mat4 	projectionMatrix;",
+			"attribute 	vec3 	position;",
+	
+			"void main(void)",
+			"{",
+				"gl_Position = projectionMatrix * vec4( position, 1.0 );",
+			"}"
+
+		].join( "\n" ),
+		
+		fragmentShader: [
+		
+			"#ifdef GL_ES",
+				"precision highp float;",
+			"#endif",		
+	
+			"void main( void )",
+			"{",
+				"gl_FragColor = vec4( 0, 0, 0, 0.5 );",
+			"}"
+
+		].join( "\n" )
+		
+	},
+
+
+	'shadowVolumeDynamic': {
+		
+		uniforms: { "directionalLightDirection": { type: "fv", value: [] }},
+
+		vertexShader: [
+
+			"uniform 	vec3 	directionalLightDirection;",
+	
+			"void main() {",
+
+				"vec4 pos      = objectMatrix * vec4( position, 1.0 );",
+				"vec3 norm     = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;",
+				"vec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );",
+				"gl_Position   = projectionMatrix * viewMatrix * ( pos + extruded );",
+			"}"
+
+		].join( "\n" ),
+
+		fragmentShader: [
+
+			"void main() {",
+
+				"gl_FragColor = vec4( 1, 1, 1, 1 );",
+
+			"}"
+
+		].join( "\n" )
+	},		
+
+
 	'depth': {
 
 		uniforms: { "mNear": { type: "f", value: 1.0 },

+ 4 - 0
utils/build.py

@@ -46,6 +46,7 @@ COMMON_FILES = [
 'materials/MeshNormalMaterial.js',
 'materials/MeshFaceMaterial.js',
 'materials/MeshShaderMaterial.js',
+'materials/ShadowVolumeDynamicMaterial.js',
 'materials/ParticleBasicMaterial.js',
 'materials/ParticleCanvasMaterial.js',
 'materials/ParticleDOMMaterial.js',
@@ -61,6 +62,7 @@ COMMON_FILES = [
 'objects/Ribbon.js',
 'objects/Sound.js',
 'objects/LOD.js',
+'objects/ShadowVolume.js',
 'scenes/Scene.js',
 'scenes/Fog.js',
 'scenes/FogExp2.js',
@@ -268,6 +270,7 @@ WEBGL_FILES = [
 'materials/MeshFaceMaterial.js',
 'materials/MeshShaderMaterial.js',
 'materials/ParticleBasicMaterial.js',
+'materials/ShadowVolumeDynamicMaterial.js',
 'materials/Texture.js',
 'materials/RenderTarget.js',
 'materials/Uniforms.js',
@@ -280,6 +283,7 @@ WEBGL_FILES = [
 'objects/Ribbon.js',
 'objects/Sound.js',
 'objects/LOD.js',
+'objects/ShadowVolume.js',
 'scenes/Scene.js',
 'scenes/Fog.js',
 'scenes/FogExp2.js',

+ 4 - 2
utils/exporters/convert_obj_three.py

@@ -846,7 +846,9 @@ def convert_ascii(infile, morphfiles, outfile):
     
     morphData = []
     for mfilepattern in morphfiles.split():
-        for path in glob.glob(mfilepattern):
+        matches = glob.glob(mfilepattern)
+        matches.sort()
+        for path in matches:
             normpath = os.path.normpath(path)
             if normpath != norminfile or not skipOriginalMorph:
                 name = os.path.basename(normpath)
@@ -1276,4 +1278,4 @@ if __name__ == "__main__":
         convert_ascii(infile, morphfiles, outfile)
     elif TYPE == "binary":
         convert_binary(infile, outfile)
-    
+