Browse Source

Merged with empaempa's branch.

Hopefully now it's proper. All examples are working.
alteredq 14 years ago
parent
commit
cc453b6bda

+ 315 - 299
build/Three.js

@@ -1,95 +1,98 @@
 // 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,f,g,j,k,m;if(b==0)d=f=g=0;else{j=Math.floor(a*6);k=a*6-j;a=b*(1-c);m=b*(1-c*k);c=b*(1-c*(1-k));switch(j){case 1:d=m;f=b;g=a;break;case 2:d=a;f=b;g=c;break;case 3:d=a;f=m;g=b;break;case 4:d=c;f=a;g=b;break;case 5:d=b;f=a;
-g=m;break;case 6:case 0:d=b;f=c;g=a}}this.r=d;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*
+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,j,m;if(b==0)e=f=g=0;else{h=Math.floor(a*6);j=a*6-h;a=b*(1-c);m=b*(1-c*j);c=b*(1-c*(1-j));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,f=[];a=0;for(c=d.length;a<c;a++){b=d[a];b instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(b)))}f.sort(function(g,j){return g.distance-j.distance});return f},intersectObject:function(a){function c(G,I,R,D){D=D.clone().subSelf(I);R=R.clone().subSelf(I);var M=G.clone().subSelf(I);G=D.dot(D);I=D.dot(R);D=D.dot(M);var L=R.dot(R);R=R.dot(M);M=1/(G*L-I*I);L=(L*D-I*R)*M;G=(G*R-I*D)*M;return L>0&&G>0&&L+G<1}var b,d,f,g,j,k,m,o,n,x,
-z,y=a.geometry,B=y.vertices,F=[];b=0;for(d=y.faces.length;b<d;b++){f=y.faces[b];x=this.origin.clone();z=this.direction.clone();m=a.matrixWorld;g=m.multiplyVector3(B[f.a].position.clone());j=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;o=a.matrixRotationWorld.multiplyVector3(f.normal.clone());n=z.dot(o);if(n<0){o=o.dot((new THREE.Vector3).sub(g,x))/n;x=x.addSelf(z.multiplyScalar(o));
-if(f instanceof THREE.Face3){if(c(x,g,j,k)){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};F.push(f)}}else if(f instanceof THREE.Face4&&(c(x,g,j,m)||c(x,j,k,m))){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};F.push(f)}}}return F}};
-THREE.Rectangle=function(){function a(){g=d-c;j=f-b}var c,b,d,f,g,j,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(m,o,n,x){k=!1;c=m;b=o;d=n;f=x;a()};this.addPoint=function(m,o){if(k){k=!1;c=m;b=o;d=m;f=o}else{c=c<m?c:m;b=b<o?b:o;d=d>m?d:m;f=f>o?f:o}a()};
-this.add3Points=function(m,o,n,x,z,y){if(k){k=!1;c=m<n?m<z?m:z:n<z?n:z;b=o<x?o<y?o:y:x<y?x:y;d=m>n?m>z?m:z:n>z?n:z;f=o>x?o>y?o:y:x>y?x:y}else{c=m<n?m<z?m<c?m:c:z<c?z:c:n<z?n<c?n:c:z<c?z:c;b=o<x?o<y?o<b?o:b:y<b?y:b:x<y?x<b?x:b:y<b?y:b;d=m>n?m>z?m>d?m:d:z>d?z:d:n>z?n>d?n:d:z>d?z:d;f=o>x?o>y?o>f?o: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();d=m.getRight();f=m.getBottom()}else{c=c<m.getLeft()?c:m.getLeft();b=b<m.getTop()?b:m.getTop();d=d>m.getRight()?
-d:m.getRight();f=f>m.getBottom()?f:m.getBottom()}a()};this.inflate=function(m){c-=m;b-=m;d+=m;f+=m;a()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();b=b>m.getTop()?b:m.getTop();d=d<m.getRight()?d:m.getRight();f=f<m.getBottom()?f:m.getBottom();a()};this.instersects=function(m){return Math.min(d,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=d=b=c=0;a()};this.isEmpty=function(){return k}};
+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(G,J,S,D){D=D.clone().subSelf(J);S=S.clone().subSelf(J);var L=G.clone().subSelf(J);G=D.dot(D);J=D.dot(S);D=D.dot(L);var N=S.dot(S);S=S.dot(L);L=1/(G*N-J*J);N=(N*D-J*S)*L;G=(G*S-J*D)*L;return N>0&&G>0&&N+G<1}var b,e,f,g,h,j,m,o,n,t,
+y,w=a.geometry,z=w.vertices,E=[];b=0;for(e=w.faces.length;b<e;b++){f=w.faces[b];t=this.origin.clone();y=this.direction.clone();m=a.matrixWorld;g=m.multiplyVector3(z[f.a].position.clone());h=m.multiplyVector3(z[f.b].position.clone());j=m.multiplyVector3(z[f.c].position.clone());m=f instanceof THREE.Face4?m.multiplyVector3(z[f.d].position.clone()):null;o=a.matrixRotationWorld.multiplyVector3(f.normal.clone());n=y.dot(o);if(n<0){o=o.dot((new THREE.Vector3).sub(g,t))/n;t=t.addSelf(y.multiplyScalar(o));
+if(f instanceof THREE.Face3){if(c(t,g,h,j)){f={distance:this.origin.distanceTo(t),point:t,face:f,object:a};E.push(f)}}else if(f instanceof THREE.Face4&&(c(t,g,h,m)||c(t,h,j,m))){f={distance:this.origin.distanceTo(t),point:t,face:f,object:a};E.push(f)}}}return E}};
+THREE.Rectangle=function(){function a(){g=e-c;h=f-b}var c,b,e,f,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 e};this.getBottom=function(){return f};this.set=function(m,o,n,t){j=!1;c=m;b=o;e=n;f=t;a()};this.addPoint=function(m,o){if(j){j=!1;c=m;b=o;e=m;f=o}else{c=c<m?c:m;b=b<o?b:o;e=e>m?e:m;f=f>o?f:o}a()};
+this.add3Points=function(m,o,n,t,y,w){if(j){j=!1;c=m<n?m<y?m:y:n<y?n:y;b=o<t?o<w?o:w:t<w?t:w;e=m>n?m>y?m:y:n>y?n:y;f=o>t?o>w?o:w:t>w?t:w}else{c=m<n?m<y?m<c?m:c:y<c?y:c:n<y?n<c?n:c:y<c?y:c;b=o<t?o<w?o<b?o:b:w<b?w:b:t<w?t<b?t:b:w<b?w:b;e=m>n?m>y?m>e?m:e:y>e?y:e:n>y?n>e?n:e:y>e?y:e;f=o>t?o>w?o>f?o:f:w>f?w:f:t>w?t>f?t:f:w>f?w:f}a()};this.addRectangle=function(m){if(j){j=!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(){j=!0;f=e=b=c=0;a()};this.isEmpty=function(){return j}};
 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,f,g,j,k,m,o,n,x,z,y,B,F){this.set(a||1,c||0,b||0,d||0,f||0,g||1,j||0,k||0,m||0,o||0,n||1,x||0,z||0,y||0,B||0,F||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
-THREE.Matrix4.prototype={set:function(a,c,b,d,f,g,j,k,m,o,n,x,z,y,B,F){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=f;this.n22=g;this.n23=j;this.n24=k;this.n31=m;this.n32=o;this.n33=n;this.n34=x;this.n41=z;this.n42=y;this.n43=B;this.n44=F;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,
-f=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()}f.cross(g,d).normalize();this.n11=d.x;this.n12=f.x;this.n13=g.x;this.n21=d.y;this.n22=f.y;this.n23=g.y;this.n31=d.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,f=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)*f;a.y=(this.n21*c+this.n22*b+this.n23*
-d+this.n24)*f;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,f=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*f;a.y=this.n21*c+this.n22*b+this.n23*d+this.n24*f;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*f;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*f;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,f=a.n13,g=a.n14,j=a.n21,k=a.n22,m=a.n23,o=a.n24,n=a.n31,x=a.n32,z=a.n33,y=a.n34,B=a.n41,F=a.n42,G=a.n43,I=a.n44,R=c.n11,D=c.n12,M=c.n13,L=c.n14,N=c.n21,ma=c.n22,
-e=c.n23,la=c.n24,V=c.n31,$=c.n32,X=c.n33,sa=c.n34;this.n11=b*R+d*N+f*V;this.n12=b*D+d*ma+f*$;this.n13=b*M+d*e+f*X;this.n14=b*L+d*la+f*sa+g;this.n21=j*R+k*N+m*V;this.n22=j*D+k*ma+m*$;this.n23=j*M+k*e+m*X;this.n24=j*L+k*la+m*sa+o;this.n31=n*R+x*N+z*V;this.n32=n*D+x*ma+z*$;this.n33=n*M+x*e+z*X;this.n34=n*L+x*la+z*sa+y;this.n41=B*R+F*N+G*V;this.n42=B*D+F*ma+G*$;this.n43=B*M+F*e+G*X;this.n44=B*L+F*la+G*sa+I;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,f=this.n21,g=this.n22,j=this.n23,k=this.n24,m=this.n31,o=this.n32,n=this.n33,x=this.n34,z=this.n41,y=this.n42,B=this.n43,F=this.n44;return d*j*o*z-b*k*o*z-d*g*n*z+c*k*n*z+b*g*x*z-c*j*x*z-d*j*m*y+b*k*m*y+d*f*n*y-a*k*n*y-b*f*x*y+a*j*x*y+d*g*m*B-c*k*m*B-d*f*o*B+a*k*o*B+c*f*x*B-a*g*x*B-b*g*m*F+c*j*m*F+b*f*o*F-a*j*o*F-c*f*n*F+a*g*n*F},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,j,m,o,n,t,y,w,z,E){this.set(a||1,c||0,b||0,e||0,f||0,g||1,h||0,j||0,m||0,o||0,n||1,t||0,y||0,w||0,z||0,E||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,c,b,e,f,g,h,j,m,o,n,t,y,w,z,E){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=f;this.n22=g;this.n23=h;this.n24=j;this.n31=m;this.n32=o;this.n33=n;this.n34=t;this.n41=y;this.n42=w;this.n43=z;this.n44=E;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,j=a.n22,m=a.n23,o=a.n24,n=a.n31,t=a.n32,y=a.n33,w=a.n34,z=a.n41,E=a.n42,G=a.n43,J=a.n44,S=c.n11,D=c.n12,L=c.n13,N=c.n14,O=c.n21,Fa=c.n22,
+oa=c.n23,xa=c.n24,W=c.n31,d=c.n32,Z=c.n33,ya=c.n34;this.n11=b*S+e*O+f*W;this.n12=b*D+e*Fa+f*d;this.n13=b*L+e*oa+f*Z;this.n14=b*N+e*xa+f*ya+g;this.n21=h*S+j*O+m*W;this.n22=h*D+j*Fa+m*d;this.n23=h*L+j*oa+m*Z;this.n24=h*N+j*xa+m*ya+o;this.n31=n*S+t*O+y*W;this.n32=n*D+t*Fa+y*d;this.n33=n*L+t*oa+y*Z;this.n34=n*N+t*xa+y*ya+w;this.n41=z*S+E*O+G*W;this.n42=z*D+E*Fa+G*d;this.n43=z*L+E*oa+G*Z;this.n44=z*N+E*xa+G*ya+J;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,j=this.n24,m=this.n31,o=this.n32,n=this.n33,t=this.n34,y=this.n41,w=this.n42,z=this.n43,E=this.n44;return e*h*o*y-b*j*o*y-e*g*n*y+c*j*n*y+b*g*t*y-c*h*t*y-e*h*m*w+b*j*m*w+e*f*n*w-a*j*n*w-b*f*t*w+a*h*t*w+e*g*m*z-c*j*m*z-e*f*o*z+a*j*o*z+c*f*t*z-a*g*t*z-b*g*m*E+c*h*m*E+b*f*o*E-a*h*o*E-c*f*n*E+a*g*n*E},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),f=1-b,g=a.x,j=a.y,k=
-a.z,m=f*g,o=f*j;this.set(m*g+b,m*j-d*k,m*k+d*j,0,m*j+d*k,o*j+b,o*k-d*g,0,m*k-d*j,o*k+d*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,d=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(b);b=Math.sin(b);var g=Math.cos(d);d=Math.sin(d);var j=a*b,k=c*b;this.n11=f*g;this.n12=-f*d;this.n13=b;this.n21=k*g+a*d;this.n22=-k*d+a*g;this.n23=-c*f;this.n31=-j*g+c*d;this.n32=j*d+c*g;this.n33=a*f;return this},
-setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,f=a.w,g=c+c,j=b+b,k=d+d;a=c*g;var m=c*j;c*=k;var o=b*j;b*=k;d*=k;g*=f;j*=f;f*=k;this.n11=1-(o+d);this.n12=m-f;this.n13=c+j;this.n21=m+f;this.n22=1-(a+d);this.n23=b-g;this.n31=c-j;this.n32=b+g;this.n33=1-(a+o);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,f=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*f;this.n23=a.n23*f;this.n33=a.n33*f}};
-THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,d=a.n12,f=a.n13,g=a.n14,j=a.n21,k=a.n22,m=a.n23,o=a.n24,n=a.n31,x=a.n32,z=a.n33,y=a.n34,B=a.n41,F=a.n42,G=a.n43,I=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*y*F-o*z*F+o*x*G-k*y*G-m*x*I+k*z*I;c.n12=g*z*F-f*y*F-g*x*G+d*y*G+f*x*I-d*z*I;c.n13=f*o*F-g*m*F+g*k*G-d*o*G-f*k*I+d*m*I;c.n14=g*m*x-f*o*x-g*k*z+d*o*z+f*k*y-d*m*y;c.n21=o*z*B-m*y*B-o*n*G+j*y*G+m*n*I-j*z*I;c.n22=f*y*B-g*z*B+g*n*G-b*y*G-f*n*I+b*z*I;c.n23=g*m*B-f*o*B-g*j*G+b*o*G+f*j*I-b*m*I;
-c.n24=f*o*n-g*m*n+g*j*z-b*o*z-f*j*y+b*m*y;c.n31=k*y*B-o*x*B+o*n*F-j*y*F-k*n*I+j*x*I;c.n32=g*x*B-d*y*B-g*n*F+b*y*F+d*n*I-b*x*I;c.n33=f*o*B-g*k*B+g*j*F-b*o*F-d*j*I+b*k*I;c.n34=g*k*n-d*o*n-g*j*x+b*o*x+d*j*y-b*k*y;c.n41=m*x*B-k*z*B-m*n*F+j*z*F+k*n*G-j*x*G;c.n42=d*z*B-f*x*B+f*n*F-b*z*F-d*n*G+b*x*G;c.n43=f*k*B-d*m*B-f*j*F+b*m*F+d*j*G-b*k*G;c.n44=d*m*n-f*k*n+f*j*x-b*m*x-d*j*z+b*k*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,f=-a.n33*a.n21+a.n31*a.n23,g=a.n32*a.n21-a.n31*a.n22,j=-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,o=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*j+a.n31*o;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*d;b[1]=a*f;b[2]=a*g;b[3]=a*j;b[4]=a*k;b[5]=a*m;b[6]=a*o;b[7]=a*n;b[8]=a*x;return c};
-THREE.Matrix4.makeFrustum=function(a,c,b,d,f,g){var j;j=new THREE.Matrix4;j.n11=2*f/(c-a);j.n12=0;j.n13=(c+a)/(c-a);j.n14=0;j.n21=0;j.n22=2*f/(d-b);j.n23=(d+b)/(d-b);j.n24=0;j.n31=0;j.n32=0;j.n33=-(g+f)/(g-f);j.n34=-2*g*f/(g-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,c,b,d){var f;a=b*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,b,d)};
-THREE.Matrix4.makeOrtho=function(a,c,b,d,f,g){var j,k,m,o;j=new THREE.Matrix4;k=c-a;m=b-d;o=g-f;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+a)/k);j.n21=0;j.n22=2/m;j.n23=0;j.n24=-((b+d)/m);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((g+f)/o);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;
+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,j=
+a.z,m=f*g,o=f*h;this.set(m*g+b,m*h-e*j,m*j+e*h,0,m*h+e*j,o*h+b,o*j-e*g,0,m*j-e*h,o*j+e*g,f*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,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,j=c*b;this.n11=f*g;this.n12=-f*e;this.n13=b;this.n21=j*g+a*e;this.n22=-j*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,j=e+e;a=c*g;var m=c*h;c*=j;var o=b*h;b*=j;e*=j;g*=f;h*=f;f*=j;this.n11=1-(o+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+o);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,j=a.n22,m=a.n23,o=a.n24,n=a.n31,t=a.n32,y=a.n33,w=a.n34,z=a.n41,E=a.n42,G=a.n43,J=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*w*E-o*y*E+o*t*G-j*w*G-m*t*J+j*y*J;c.n12=g*y*E-f*w*E-g*t*G+e*w*G+f*t*J-e*y*J;c.n13=f*o*E-g*m*E+g*j*G-e*o*G-f*j*J+e*m*J;c.n14=g*m*t-f*o*t-g*j*y+e*o*y+f*j*w-e*m*w;c.n21=o*y*z-m*w*z-o*n*G+h*w*G+m*n*J-h*y*J;c.n22=f*w*z-g*y*z+g*n*G-b*w*G-f*n*J+b*y*J;c.n23=g*m*z-f*o*z-g*h*G+b*o*G+f*h*J-b*m*J;
+c.n24=f*o*n-g*m*n+g*h*y-b*o*y-f*h*w+b*m*w;c.n31=j*w*z-o*t*z+o*n*E-h*w*E-j*n*J+h*t*J;c.n32=g*t*z-e*w*z-g*n*E+b*w*E+e*n*J-b*t*J;c.n33=f*o*z-g*j*z+g*h*E-b*o*E-e*h*J+b*j*J;c.n34=g*j*n-e*o*n-g*h*t+b*o*t+e*h*w-b*j*w;c.n41=m*t*z-j*y*z-m*n*E+h*y*E+j*n*G-h*t*G;c.n42=e*y*z-f*t*z+f*n*E-b*y*E-e*n*G+b*t*G;c.n43=f*j*z-e*m*z-f*h*E+b*m*E+e*h*G-b*j*G;c.n44=e*m*n-f*j*n+f*h*t-b*m*t-e*h*y+b*j*y;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,j=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,o=a.n23*a.n12-a.n22*a.n13,n=-a.n23*a.n11+a.n21*a.n13,t=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*h+a.n31*o;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*j;b[5]=a*m;b[6]=a*o;b[7]=a*n;b[8]=a*t;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,j,m,o;h=new THREE.Matrix4;j=c-a;m=b-e;o=g-f;h.n11=2/j;h.n12=0;h.n13=0;h.n14=-((c+a)/j);h.n21=0;h.n22=2/m;h.n23=0;h.n24=-((b+e)/m);h.n31=0;h.n32=0;h.n33=-2/o;h.n34=-((g+f)/o);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,f=a.z*c;a=Math.cos(d);d=Math.sin(d);c=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(b);b=Math.sin(b);var j=a*c,k=d*f;this.w=j*g-k*b;this.x=j*b+k*g;this.y=d*c*g+a*f*b;this.z=a*f*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,f=this.w,g=a.x,j=a.y,k=a.z;a=a.w;this.x=c*a+f*g+b*k-d*j;this.y=b*a+f*j+d*g-c*k;this.z=d*a+f*k+c*j-b*g;this.w=f*a-c*g-b*j-d*k;return this},
-multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,f=a.z,g=this.x,j=this.y,k=this.z,m=this.w,o=m*b+j*f-k*d,n=m*d+k*b-g*f,x=m*f+g*d-j*b;b=-g*b-j*d-k*f;c.x=o*m+b*-g+n*-k-x*-j;c.y=n*m+b*-j+x*-g-o*-k;c.z=x*m+b*-k+o*-j-n*-g;return c}};
-THREE.Quaternion.slerp=function(a,c,b,d){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),j=Math.sqrt(1-f*f);if(Math.abs(j)<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-d)*g)/j;d=Math.sin(d*g)/j;b.w=a.w*f+c.w*d;b.x=a.x*f+c.x*d;b.y=a.y*f+c.y*d;b.z=a.z*f+c.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
-THREE.Face3=function(a,c,b,d,f,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=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,d,f,g,j){this.a=a;this.b=c;this.c=b;this.d=d;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=j instanceof Array?j:[j];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,j=e*f;this.w=h*g-j*b;this.x=h*b+j*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,j=a.z;a=a.w;this.x=c*a+f*g+b*j-e*h;this.y=b*a+f*h+e*g-c*j;this.z=e*a+f*j+c*h-b*g;this.w=f*a-c*g-b*h-e*j;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,j=this.z,m=this.w,o=m*b+h*f-j*e,n=m*e+j*b-g*f,t=m*f+g*e-h*b;b=-g*b-h*e-j*f;c.x=o*m+b*-g+n*-j-t*-h;c.y=n*m+b*-h+t*-g-o*-j;c.z=t*m+b*-j+o*-h-n*-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,f,g,j,k=new THREE.Vector3,m=new THREE.Vector3;d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];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];j=this.vertices[g.c];k.sub(j.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,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(T,fa,qa,Z,S,da,ua){k=T.vertices[fa].position;m=T.vertices[qa].position;o=T.vertices[Z].position;n=j[S];x=j[da];z=j[ua];y=m.x-k.x;B=o.x-k.x;F=m.y-k.y;G=o.y-k.y;I=m.z-k.z;R=o.z-k.z;D=x.u-n.u;M=z.u-n.u;L=x.v-n.v;N=z.v-n.v;ma=1/(D*N-M*L);
-$.set((N*y-L*B)*ma,(N*F-L*G)*ma,(N*I-L*R)*ma);X.set((D*B-M*y)*ma,(D*G-M*F)*ma,(D*R-M*I)*ma);la[fa].addSelf($);la[qa].addSelf($);la[Z].addSelf($);V[fa].addSelf(X);V[qa].addSelf(X);V[Z].addSelf(X)}var c,b,d,f,g,j,k,m,o,n,x,z,y,B,F,G,I,R,D,M,L,N,ma,e,la=[],V=[],$=new THREE.Vector3,X=new THREE.Vector3,sa=new THREE.Vector3,va=new THREE.Vector3,wa=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){la[c]=new THREE.Vector3;V[c]=new THREE.Vector3}c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];
-j=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 ia=["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++){wa.copy(g.vertexNormals[d]);f=g[ia[d]];e=la[f];sa.copy(e);sa.subSelf(wa.multiplyScalar(wa.dot(e))).normalize();va.cross(g.vertexNormals[d],e);f=va.dot(V[f]);f=f<0?-1:1;g.vertexTangents[d]=new THREE.Vector4(sa.x,sa.y,sa.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;
+b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,e,f,g,h,j=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){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);m.sub(c.position,b.position);j.crossSelf(m)}j.isZero()||
+j.normalize();g.normal.copy(j)}},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(X,qa,za,ea,U,ma,Ca){j=X.vertices[qa].position;m=X.vertices[za].position;o=X.vertices[ea].position;n=h[U];t=h[ma];y=h[Ca];w=m.x-j.x;z=o.x-j.x;E=m.y-j.y;G=o.y-j.y;J=m.z-j.z;S=o.z-j.z;D=t.u-n.u;L=y.u-n.u;N=t.v-n.v;O=y.v-n.v;Fa=1/(D*O-L*N);
+d.set((O*w-N*z)*Fa,(O*E-N*G)*Fa,(O*J-N*S)*Fa);Z.set((D*z-L*w)*Fa,(D*G-L*E)*Fa,(D*S-L*J)*Fa);xa[qa].addSelf(d);xa[za].addSelf(d);xa[ea].addSelf(d);W[qa].addSelf(Z);W[za].addSelf(Z);W[ea].addSelf(Z)}var c,b,e,f,g,h,j,m,o,n,t,y,w,z,E,G,J,S,D,L,N,O,Fa,oa,xa=[],W=[],d=new THREE.Vector3,Z=new THREE.Vector3,ya=new THREE.Vector3,Ga=new THREE.Vector3,Ha=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){xa[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 ra=["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++){Ha.copy(g.vertexNormals[e]);f=g[ra[e]];oa=xa[f];ya.copy(oa);ya.subSelf(Ha.multiplyScalar(Ha.dot(oa))).normalize();Ga.cross(g.vertexNormals[e],oa);f=Ga.dot(W[f]);f=f<0?-1:1;g.vertexTangents[e]=new THREE.Vector4(ya.x,ya.y,
+ya.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,F,G,I,R,D){y=(F-y)*0.5;G=(G-B)*0.5;return(2*(B-F)+y+G)*D+(-3*(B-F)-2*y-G)*R+y*I+B}this.points=a;var b=[],d={x:0,y:0,z:0},f,g,j,k,m,o,n,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);j=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;o=this.points[b[0]];n=this.points[b[1]];
-x=this.points[b[2]];z=this.points[b[3]];k=j*j;m=j*k;d.x=c(o.x,n.x,x.x,z.x,j,k,m);d.y=c(o.y,n.y,x.y,z.y,j,k,m);d.z=c(o.z,n.z,x.z,z.z,j,k,m);return d};this.getControlPointsArray=function(){var y,B,F=this.points.length,G=[];for(y=0;y<F;y++){B=this.points[y];G[y]=[B.x,B.y,B.z]}return G};this.getLength=function(y){var B,F,G=B=B=0,I=new THREE.Vector3,R=new THREE.Vector3,D=[],M=0;D[0]=0;y||(y=100);F=this.points.length*y;I.copy(this.points[0]);for(y=1;y<F;y++){B=y/F;position=this.getPoint(B);R.copy(position);
-M+=R.distanceTo(I);I.copy(position);B*=this.points.length-1;B=Math.floor(B);if(B!=G){D[B]=M;G=B}}D[D.length]=M;return{chunks:D,total:M}};this.reparametrizeByArcLength=function(y){var B,F,G,I,R,D,M=[],L=new THREE.Vector3,N=this.getLength();M.push(L.copy(this.points[0]).clone());for(B=1;B<this.points.length;B++){F=N.chunks[B]-N.chunks[B-1];D=Math.ceil(y*F/N.total);I=(B-1)/(this.points.length-1);R=B/(this.points.length-1);for(F=1;F<D-1;F++){G=I+F*(1/D)*(R-I);position=this.getPoint(G);M.push(L.copy(position).clone())}M.push(L.copy(this.points[B]).clone())}this.points=
-M}};
-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 j=0;j<f.hierarchy[g].keys.length;j++){if(f.hierarchy[g].keys[j].time<0)f.hierarchy[g].keys[j].time=
-0;if(f.hierarchy[g].keys[j].rot!==undefined&&!(f.hierarchy[g].keys[j].rot instanceof THREE.Quaternion)){var k=f.hierarchy[g].keys[j].rot;f.hierarchy[g].keys[j].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){k={};for(j=0;j<f.hierarchy[g].keys.length;j++)for(var m=0;m<f.hierarchy[g].keys[j].morphTargets.length;m++){var o=f.hierarchy[g].keys[j].morphTargets[m];k[o]=-1}f.hierarchy[g].usedMorphTargets=k;for(j=0;j<f.hierarchy[g].keys.length;j++){var n=
-{};for(o in k){for(m=0;m<f.hierarchy[g].keys[j].morphTargets.length;m++)if(f.hierarchy[g].keys[j].morphTargets[m]===o){n[o]=f.hierarchy[g].keys[j].morphTargetsInfluences[m];break}m===f.hierarchy[g].keys[j].morphTargets.length&&(n[o]=0)}f.hierarchy[g].keys[j].morphTargetsInfluences=n}}for(j=1;j<f.hierarchy[g].keys.length;j++)if(f.hierarchy[g].keys[j].time===f.hierarchy[g].keys[j-1].time){f.hierarchy[g].keys.splice(j,1);j--}for(j=1;j<f.hierarchy[g].keys.length;j++)f.hierarchy[g].keys[j].index=j}j=parseInt(f.length*
-f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(g=0;g<f.hierarchy.length;g++)f.JIT.hierarchy.push(Array(j));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 j=0;j<f.bones.length;j++)g.push(f.bones[j]);else d(f,g);return g};var d=function(f,g){g.push(f);for(var j=0;j<f.children.length;j++)d(f.children[j],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,f;for(b=0;b<d;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=
+THREE.Spline=function(a){function c(w,z,E,G,J,S,D){w=(E-w)*0.5;G=(G-z)*0.5;return(2*(z-E)+w+G)*D+(-3*(z-E)-2*w-G)*S+w*J+z}this.points=a;var b=[],e={x:0,y:0,z:0},f,g,h,j,m,o,n,t,y;this.initFromArray=function(w){this.points=[];for(var z=0;z<w.length;z++)this.points[z]={x:w[z][0],y:w[z][1],z:w[z][2]}};this.getPoint=function(w){f=(this.points.length-1)*w;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;o=this.points[b[0]];n=this.points[b[1]];
+t=this.points[b[2]];y=this.points[b[3]];j=h*h;m=h*j;e.x=c(o.x,n.x,t.x,y.x,h,j,m);e.y=c(o.y,n.y,t.y,y.y,h,j,m);e.z=c(o.z,n.z,t.z,y.z,h,j,m);return e};this.getControlPointsArray=function(){var w,z,E=this.points.length,G=[];for(w=0;w<E;w++){z=this.points[w];G[w]=[z.x,z.y,z.z]}return G};this.getLength=function(w){var z,E,G=z=z=0,J=new THREE.Vector3,S=new THREE.Vector3,D=[],L=0;D[0]=0;w||(w=100);E=this.points.length*w;J.copy(this.points[0]);for(w=1;w<E;w++){z=w/E;position=this.getPoint(z);S.copy(position);
+L+=S.distanceTo(J);J.copy(position);z*=this.points.length-1;z=Math.floor(z);if(z!=G){D[z]=L;G=z}}D[D.length]=L;return{chunks:D,total:L}};this.reparametrizeByArcLength=function(w){var z,E,G,J,S,D,L=[],N=new THREE.Vector3,O=this.getLength();L.push(N.copy(this.points[0]).clone());for(z=1;z<this.points.length;z++){E=O.chunks[z]-O.chunks[z-1];D=Math.ceil(w*E/O.total);J=(z-1)/(this.points.length-1);S=z/(this.points.length-1);for(E=1;E<D-1;E++){G=J+E*(1/D)*(S-J);position=this.getPoint(G);L.push(N.copy(position).clone())}L.push(N.copy(this.points[z]).clone())}this.points=
+L}};
+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 j=f.hierarchy[g].keys[h].rot;f.hierarchy[g].keys[h].rot=new THREE.Quaternion(j[0],j[1],j[2],j[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){j={};for(h=0;h<f.hierarchy[g].keys.length;h++)for(var m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++){var o=f.hierarchy[g].keys[h].morphTargets[m];j[o]=-1}f.hierarchy[g].usedMorphTargets=j;for(h=0;h<f.hierarchy[g].keys.length;h++){var n=
+{};for(o in j){for(m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++)if(f.hierarchy[g].keys[h].morphTargets[m]===o){n[o]=f.hierarchy[g].keys[h].morphTargetsInfluences[m];break}m===f.hierarchy[g].keys[h].morphTargets.length&&(n[o]=0)}f.hierarchy[g].keys[h].morphTargetsInfluences=n}}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,f,g,j,k,m,o,n=this.data.JIT.hierarchy,x,z;this.currentTime+=a*this.timeScale;z=this.currentTime;x=this.currentTime%=this.data.length;o=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&&n[y][o]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=n[y][o];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
-!1}else{a.matrix=n[y][o];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 F=0;F<3;F++){b=c[F];j=m.prevKey[b];k=m.nextKey[b];if(k.time<=z){if(x<z)if(this.loop){j=this.data.hierarchy[y].keys[0];for(k=this.getNextKeyWith(b,y,1);k.time<x;){j=k;k=this.getNextKeyWith(b,y,k.index+1)}}else{this.stop();return}else{do{j=k;k=this.getNextKeyWith(b,y,k.index+1)}while(k.time<
-x)}m.prevKey[b]=j;m.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(x-j.time)/(k.time-j.time);f=j[b];g=k[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=f[0]+(g[0]-f[0])*d;b.y=f[1]+(g[1]-f[1])*d;b.z=f[2]+(g[2]-f[2])*d}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]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",y,k.index+1).pos;d=d*0.33+0.33;f=this.interpolateCatmullRom(this.points,d);b.x=f[0];b.y=f[1];b.z=f[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(f,g,a.quaternion,d);else if(b==="scl"){b=a.scale;b.x=f[0]+(g[0]-f[0])*d;b.y=f[1]+(g[1]-f[1])*d;b.z=f[2]+(g[2]-f[2])*d}}}}if(this.JITCompile&&n[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y<this.hierarchy.length;y++)n[y][o]=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=[],f,g,j,k,m,o;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]];o=a[b[3]];b=f*f;j=f*b;d[0]=this.interpolate(g[0],k[0],m[0],o[0],f,b,j);d[1]=this.interpolate(g[1],k[1],m[1],o[1],f,b,j);d[2]=this.interpolate(g[2],k[2],m[2],o[2],f,b,j);return d};
-THREE.Animation.prototype.interpolate=function(a,c,b,d,f,g,j){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*j+(-3*(c-b)-2*a-d)*g+a*f+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,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=d||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.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,e,f,g,h,j,m,o,n=this.data.JIT.hierarchy,t,y;this.currentTime+=a*this.timeScale;y=this.currentTime;t=this.currentTime%=this.data.length;o=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,z=this.hierarchy.length;w<z;w++){a=this.hierarchy[w];m=a.animationCache;if(this.JITCompile&&n[w][o]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=n[w][o];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=n[w][o];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 E=0;E<3;E++){b=c[E];h=m.prevKey[b];j=m.nextKey[b];if(j.time<=y){if(t<y)if(this.loop){h=this.data.hierarchy[w].keys[0];for(j=this.getNextKeyWith(b,w,1);j.time<t;){h=j;j=this.getNextKeyWith(b,w,j.index+1)}}else{this.stop();return}else{do{h=j;j=this.getNextKeyWith(b,w,j.index+1)}while(j.time<
+t)}m.prevKey[b]=h;m.nextKey[b]=j}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(t-h.time)/(j.time-h.time);f=h[b];g=j[b];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+w);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",w,h.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",w,j.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&&n[0][o]===undefined){this.hierarchy[0].update(undefined,!0);for(w=0;w<this.hierarchy.length;w++)n[w][o]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],f,g,h,j,m,o;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]];j=a[b[1]];m=a[b[2]];o=a[b[3]];b=f*f;h=f*b;e[0]=this.interpolate(g[0],j[0],m[0],o[0],f,b,h);e[1]=this.interpolate(g[1],j[1],m[1],o[1],f,b,h);e[2]=this.interpolate(g[2],j[2],m[2],o[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;
 THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=b||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=b||0};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.MultiplyBlending=3;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.PointLight.prototype.constructor=THREE.PointLight;THREE.LensFlare=function(a,c,b,e){THREE.Object3D.call(this);this.positionScreen=new THREE.Vector3;this.lensFlares=[];this.customUpdateCallback=undefined;a!==undefined&&this.add(a,c,b,e)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
+THREE.LensFlare.prototype.add=function(a,c,b,e){c===undefined&&(c=-1);b===undefined&&(b=0);if(e===undefined)e=THREE.BillboardBlending;b=Math.min(b,Math.max(0,b));this.lensFlares.push({texture:a,size:c,distance:b,x:0,y:0,z:0,scale:1,rotation:1,opacity:1,blending:e})};
+THREE.LensFlare.prototype.updateLensFlares=function(a){var c,b=this.lensFlares.length,e,f=-this.positionScreen.x*2,g=-this.positionScreen.y*2;for(c=0;c<b;c++){e=this.lensFlares[c];e.x=this.positionScreen.x+f*e.distance;e.y=this.positionScreen.y+g*e.distance;e.wantedScale=a*0.2+0.8;e.wantedRotation=e.x*Math.PI*0.25;e.wantedOpacity=a;e.scale+=(e.wantedScale-e.scale)*0.25;e.rotation+=(e.wantedRotation-e.rotation)*0.25;e.opacity+=(e.wantedOpacity-e.opacity)*0.5}};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.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};
+THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;
@@ -116,92 +119,92 @@ THREE.ShadowVolumeDynamicMaterial=function(){this.id=THREE.MaterialCounter.value
 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,f,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=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.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,f={};for(c in a){f[c]={};for(b in a[c]){d=a[c][b];f[c][b]=d instanceof THREE.Color||d instanceof THREE.Vector3||d instanceof THREE.Texture?d.clone():d}}return f},merge:function(a){var c,b,d,f={};for(c=0;c<a.length;c++){d=this.clone(a[c]);for(b in d)f[b]=d[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;
+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,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(d=0;d<f;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<f;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,f,g,j,k;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){f=this.geometry.bones[b];g=f.pos;j=f.rotq;k=f.scl;d=this.addBone();d.name=f.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(j[0],j[1],j[2],j[3]);d.useQuaternion=!0;k!==undefined?d.scale.set(k[0],k[1],k[2]):d.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){f=this.geometry.bones[b];
-d=this.bones[b];f.parent===-1?this.addChild(d):this.bones[f.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,f=this.children.length;for(d=0;d<f;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,j;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;j=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;j!==undefined?e.scale.set(j[0],j[1],j[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 f=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[f].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 f;b=this.sources.length;for(a=0;a<b;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)f=
+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.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.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,d=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var g=f.length,j,k,m,o,n,x=["a","b","c","d"];for(m=0;m<g;m++){k=c.length;j=f[m];if(j instanceof THREE.Face4){o=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{o=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(j.normal);b.push(k);for(k=
-0;k<o;k++){n=a[j[x[k]]];c.push(new THREE.Vertex(n.position.clone()))}}for(g=0;g<f.length-1;g++){a=b[g];for(j=g+1;j<f.length;j++){k=b[j];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);d.push(k)}}}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,b){var d,f,g,j,k,m,o,n,x,z,y,B,F,G=0,I=["a","b","c","d"];d=c instanceof THREE.Face4?4:3;f=b instanceof THREE.Face4?4:3;for(B=0;B<d;B++){g=c[I[B]];k=a[g];for(F=0;F<f;F++){j=b[I[F]];m=a[j];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){G++;if(G===1){o=k;n=m;x=g;z=j;y=I[B]}if(G===2){y+=I[B];return y==="ad"||y==="ac"?{faces:[c,b],vertices:[o,n,m,k],indices:[x,
-z,j,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,b],vertices:[o,k,m,n],indices:[x,g,j,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.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,j,m,o,n,t=["a","b","c","d"];for(m=0;m<g;m++){j=c.length;h=f[m];if(h instanceof THREE.Face4){o=4;j=new THREE.Face4(j,j+1,j+2,j+3)}else{o=3;j=new THREE.Face3(j,j+1,j+2)}j.normal.copy(h.normal);b.push(j);for(j=
+0;j<o;j++){n=a[h[t[j]]];c.push(new THREE.Vertex(n.position.clone()))}}for(g=0;g<f.length-1;g++){a=b[g];for(h=g+1;h<f.length;h++){j=b[h];j=this.facesShareEdge(c,a,j);if(j!==undefined){j=new THREE.Face4(j.indices[0],j.indices[3],j.indices[2],j.indices[1]);j.normal.set(1,0,0);e.push(j)}}}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,b){var e,f,g,h,j,m,o,n,t,y,w,z,E,G=0,J=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=b instanceof THREE.Face4?4:3;for(z=0;z<e;z++){g=c[J[z]];j=a[g];for(E=0;E<f;E++){h=b[J[E]];m=a[h];if(Math.abs(j.position.x-m.position.x)<1.0E-4&&Math.abs(j.position.y-m.position.y)<1.0E-4&&Math.abs(j.position.z-m.position.z)<1.0E-4){G++;if(G===1){o=j;n=m;t=g;y=h;w=J[z]}if(G===2){w+=J[z];return w==="ad"||w==="ac"?{faces:[c,b],vertices:[o,n,m,j],indices:[t,
+y,h,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,b],vertices:[o,j,m,n],indices:[t,g,h,y],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 $=m[k]=m[k]||new THREE.RenderableVertex;k++;return $}function c($,X){return X.z-$.z}function b($,X){var sa=0,va=1,wa=$.z+$.w,ia=X.z+X.w,T=-$.z+$.w,fa=-X.z+X.w;if(wa>=0&&ia>=0&&T>=0&&fa>=0)return!0;else if(wa<0&&ia<0||T<0&&fa<0)return!1;else{if(wa<0)sa=Math.max(sa,wa/(wa-ia));else ia<0&&(va=Math.min(va,wa/(wa-ia)));if(T<0)sa=Math.max(sa,T/(T-fa));else fa<0&&(va=Math.min(va,T/(T-fa)));if(va<sa)return!1;else{$.lerpSelf(X,sa);X.lerpSelf($,1-va);return!0}}}var d,
-f,g=[],j,k,m=[],o,n,x=[],z,y=[],B,F,G=[],I,R,D=[],M=new THREE.Vector4,L=new THREE.Vector4,N=new THREE.Matrix4,ma=new THREE.Matrix4,e=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],la=new THREE.Vector4,V=new THREE.Vector4;this.projectVector=function($,X){N.multiply(X.projectionMatrix,X.matrixWorldInverse);N.multiplyVector3($);return $};this.unprojectVector=function($,X){N.multiply(X.matrixWorld,THREE.Matrix4.makeInvert(X.projectionMatrix));
-N.multiplyVector3($);return $};this.projectObjects=function($,X,sa){X=[];var va,wa,ia;f=0;wa=$.objects;$=0;for(va=wa.length;$<va;$++){ia=wa[$];var T;if(!(T=!ia.visible))if(T=ia instanceof THREE.Mesh){a:{T=void 0;for(var fa=ia.matrixWorld,qa=-ia.geometry.boundingSphere.radius*Math.max(ia.scale.x,Math.max(ia.scale.y,ia.scale.z)),Z=0;Z<6;Z++){T=e[Z].x*fa.n14+e[Z].y*fa.n24+e[Z].z*fa.n34+e[Z].w;if(T<=qa){T=!1;break a}}T=!0}T=!T}if(!T){T=g[f]=g[f]||new THREE.RenderableObject;f++;d=T;M.copy(ia.position);
-N.multiplyVector3(M);d.object=ia;d.z=M.z;X.push(d)}}sa&&X.sort(c);return X};this.projectScene=function($,X,sa){var va=[],wa=X.near,ia=X.far,T,fa,qa,Z,S,da,ua,ca,ga,xa,Ka,Xa,Ya,Aa,h,t,w;R=F=z=n=0;X.matrixAutoUpdate&&X.updateMatrix();$.update(undefined,!1,X);N.multiply(X.projectionMatrix,X.matrixWorldInverse);e[0].set(N.n41-N.n11,N.n42-N.n12,N.n43-N.n13,N.n44-N.n14);e[1].set(N.n41+N.n11,N.n42+N.n12,N.n43+N.n13,N.n44+N.n14);e[2].set(N.n41+N.n21,N.n42+N.n22,N.n43+N.n23,N.n44+N.n24);e[3].set(N.n41-N.n21,
-N.n42-N.n22,N.n43-N.n23,N.n44-N.n24);e[4].set(N.n41-N.n31,N.n42-N.n32,N.n43-N.n33,N.n44-N.n34);e[5].set(N.n41+N.n31,N.n42+N.n32,N.n43+N.n33,N.n44+N.n34);for(T=0;T<6;T++){ga=e[T];ga.divideScalar(Math.sqrt(ga.x*ga.x+ga.y*ga.y+ga.z*ga.z))}ga=this.projectObjects($,X,!0);$=0;for(T=ga.length;$<T;$++){xa=ga[$].object;if(xa.visible){Ka=xa.matrixWorld;Xa=xa.matrixRotationWorld;Ya=xa.materials;Aa=xa.overdraw;k=0;if(xa instanceof THREE.Mesh){h=xa.geometry;Z=h.vertices;t=h.faces;h=h.faceVertexUvs;fa=0;for(qa=
-Z.length;fa<qa;fa++){j=a();j.positionWorld.copy(Z[fa].position);Ka.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);N.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>wa&&j.positionScreen.z<ia}Z=0;for(fa=t.length;Z<fa;Z++){qa=t[Z];if(qa instanceof THREE.Face3){S=m[qa.a];da=m[qa.b];ua=m[qa.c];if(S.visible&&da.visible&&ua.visible&&(xa.doubleSided||xa.flipSided!=(ua.positionScreen.x-S.positionScreen.x)*
-(da.positionScreen.y-S.positionScreen.y)-(ua.positionScreen.y-S.positionScreen.y)*(da.positionScreen.x-S.positionScreen.x)<0)){ca=x[n]=x[n]||new THREE.RenderableFace3;n++;o=ca;o.v1.copy(S);o.v2.copy(da);o.v3.copy(ua)}else continue}else if(qa instanceof THREE.Face4){S=m[qa.a];da=m[qa.b];ua=m[qa.c];ca=m[qa.d];if(S.visible&&da.visible&&ua.visible&&ca.visible&&(xa.doubleSided||xa.flipSided!=((ca.positionScreen.x-S.positionScreen.x)*(da.positionScreen.y-S.positionScreen.y)-(ca.positionScreen.y-S.positionScreen.y)*
-(da.positionScreen.x-S.positionScreen.x)<0||(da.positionScreen.x-ua.positionScreen.x)*(ca.positionScreen.y-ua.positionScreen.y)-(da.positionScreen.y-ua.positionScreen.y)*(ca.positionScreen.x-ua.positionScreen.x)<0))){w=y[z]=y[z]||new THREE.RenderableFace4;z++;o=w;o.v1.copy(S);o.v2.copy(da);o.v3.copy(ua);o.v4.copy(ca)}else continue}o.normalWorld.copy(qa.normal);Xa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(qa.centroid);Ka.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);
-N.multiplyVector3(o.centroidScreen);ua=qa.vertexNormals;S=0;for(da=ua.length;S<da;S++){ca=o.vertexNormalsWorld[S];ca.copy(ua[S]);Xa.multiplyVector3(ca)}S=0;for(da=h.length;S<da;S++)if(w=h[S][Z]){ua=0;for(ca=w.length;ua<ca;ua++)o.uvs[S][ua]=w[ua]}o.meshMaterials=Ya;o.faceMaterials=qa.materials;o.overdraw=Aa;o.z=o.centroidScreen.z;va.push(o)}}else if(xa instanceof THREE.Line){ma.multiply(N,Ka);Z=xa.geometry.vertices;S=a();S.positionScreen.copy(Z[0].position);ma.multiplyVector4(S.positionScreen);fa=
-1;for(qa=Z.length;fa<qa;fa++){S=a();S.positionScreen.copy(Z[fa].position);ma.multiplyVector4(S.positionScreen);da=m[k-2];la.copy(S.positionScreen);V.copy(da.positionScreen);if(b(la,V)){la.multiplyScalar(1/la.w);V.multiplyScalar(1/V.w);Ka=G[F]=G[F]||new THREE.RenderableLine;F++;B=Ka;B.v1.positionScreen.copy(la);B.v2.positionScreen.copy(V);B.z=Math.max(la.z,V.z);B.materials=xa.materials;va.push(B)}}}else if(xa instanceof THREE.Particle){L.set(xa.position.x,xa.position.y,xa.position.z,1);N.multiplyVector4(L);
-L.z/=L.w;if(L.z>0&&L.z<1){Ka=D[R]=D[R]||new THREE.RenderableParticle;R++;I=Ka;I.x=L.x/L.w;I.y=L.y/L.w;I.z=L.z;I.rotation=xa.rotation.z;I.scale.x=xa.scale.x*Math.abs(I.x-(L.x+X.projectionMatrix.n11)/(L.w+X.projectionMatrix.n14));I.scale.y=xa.scale.y*Math.abs(I.y-(L.y+X.projectionMatrix.n22)/(L.w+X.projectionMatrix.n24));I.materials=xa.materials;va.push(I)}}}}sa&&va.sort(c);return va}};
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,f,g;this.domElement=document.createElement("div");this.setSize=function(j,k){b=j;d=k;f=b/2;g=d/2};this.render=function(j,k){var m,o,n,x,z,y,B,F;a=c.projectScene(j,k);m=0;for(o=a.length;m<o;m++){z=a[m];if(z instanceof THREE.RenderableParticle){B=z.x*f+f;F=z.y*g+g;n=0;for(x=z.material.length;n<x;n++){y=z.material[n];if(y instanceof THREE.ParticleDOMMaterial){y=y.domElement;y.style.left=B+"px";y.style.top=F+"px"}}}}}};
-THREE.CanvasRenderer=function(){function a(za){if(y!=za)n.globalAlpha=y=za}function c(za){if(B!=za){switch(za){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}B=za}}function b(za){if(F!=za)n.strokeStyle=F=za}var d=null,f=new THREE.Projector,g=document.createElement("canvas"),j,k,m,o,n=g.getContext("2d"),x=new THREE.Color(0),z=0,y=1,B=0,
-F=null,G=null,I=null,R=null,D=null,M,L,N,ma,e=new THREE.RenderableVertex,la=new THREE.RenderableVertex,V,$,X,sa,va,wa,ia,T,fa,qa,Z,S,da=new THREE.Color,ua=new THREE.Color,ca=new THREE.Color,ga=new THREE.Color,xa=new THREE.Color,Ka,Xa,Ya,Aa,h,t,w,p,C,H,K=new THREE.Rectangle,E=new THREE.Rectangle,A=new THREE.Rectangle,aa=!1,J=new THREE.Color,Y=new THREE.Color,ha=new THREE.Color,ra=new THREE.Color,ja=new THREE.Vector3,Ha,ya,Ba,W,ea,na,Ia=16;Ha=document.createElement("canvas");Ha.width=Ha.height=2;ya=
-Ha.getContext("2d");ya.fillStyle="rgba(0,0,0,1)";ya.fillRect(0,0,2,2);Ba=ya.getImageData(0,0,2,2);W=Ba.data;ea=document.createElement("canvas");ea.width=ea.height=Ia;na=ea.getContext("2d");na.translate(-Ia/2,-Ia/2);na.scale(Ia,Ia);Ia--;this.domElement=g;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(za,Va){j=za;k=Va;m=j/2;o=k/2;g.width=j;g.height=k;K.set(-m,-o,m,o);y=1;B=0;D=R=I=G=F=null};this.setClearColor=function(za,Va){x=za;z=Va};this.setClearColorHex=function(za,
-Va){x.setHex(za);z=Va};this.clear=function(){n.setTransform(1,0,0,-1,m,o);if(!E.isEmpty()){E.inflate(1);E.minSelf(K);if(x.hex==0&&z==0)n.clearRect(E.getX(),E.getY(),E.getWidth(),E.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(x.r*255)+","+Math.floor(x.g*255)+","+Math.floor(x.b*255)+","+z+")";n.fillRect(E.getX(),E.getY(),E.getWidth(),E.getHeight())}E.empty()}};this.render=function(za,Va){function Qa(P){var ka,oa,U,Fa=P.lights;Y.setRGB(0,0,0);ha.setRGB(0,0,0);ra.setRGB(0,
-0,0);P=0;for(ka=Fa.length;P<ka;P++){oa=Fa[P];U=oa.color;if(oa instanceof THREE.AmbientLight){Y.r+=U.r;Y.g+=U.g;Y.b+=U.b}else if(oa instanceof THREE.DirectionalLight){ha.r+=U.r;ha.g+=U.g;ha.b+=U.b}else if(oa instanceof THREE.PointLight){ra.r+=U.r;ra.g+=U.g;ra.b+=U.b}}}function Da(P,ka,oa,U){var Fa,Ca,pa,Q,Na=P.lights;P=0;for(Fa=Na.length;P<Fa;P++){Ca=Na[P];pa=Ca.color;if(Ca instanceof THREE.DirectionalLight){Q=oa.dot(Ca.position);if(!(Q<=0)){Q*=Ca.intensity;U.r+=pa.r*Q;U.g+=pa.g*Q;U.b+=pa.b*Q}}else if(Ca instanceof
-THREE.PointLight){Q=oa.dot(ja.sub(Ca.position,ka).normalize());if(!(Q<=0)){Q*=Ca.distance==0?1:1-Math.min(ka.distanceTo(Ca.position)/Ca.distance,1);if(Q!=0){Q*=Ca.intensity;U.r+=pa.r*Q;U.g+=pa.g*Q;U.b+=pa.b*Q}}}}}function Ta(P,ka,oa){a(oa.opacity);c(oa.blending);var U,Fa,Ca,pa,Q,Na;if(oa instanceof THREE.ParticleBasicMaterial){if(oa.map){pa=oa.map.image;Q=pa.width>>1;Na=pa.height>>1;oa=ka.scale.x*m;Ca=ka.scale.y*o;U=oa*Q;Fa=Ca*Na;A.set(P.x-U,P.y-Fa,P.x+U,P.y+Fa);if(K.instersects(A)){n.save();n.translate(P.x,
-P.y);n.rotate(-ka.rotation);n.scale(oa,-Ca);n.translate(-Q,-Na);n.drawImage(pa,0,0);n.restore()}}}else if(oa instanceof THREE.ParticleCanvasMaterial){U=ka.scale.x*m;Fa=ka.scale.y*o;A.set(P.x-U,P.y-Fa,P.x+U,P.y+Fa);if(K.instersects(A)){b(oa.color.__styleString);Ca=oa.color.__styleString;if(G!=Ca)n.fillStyle=G=Ca;n.save();n.translate(P.x,P.y);n.rotate(-ka.rotation);n.scale(U,Fa);oa.program(n);n.restore()}}}function kb(P,ka,oa,U){a(U.opacity);c(U.blending);n.beginPath();n.moveTo(P.positionScreen.x,P.positionScreen.y);
-n.lineTo(ka.positionScreen.x,ka.positionScreen.y);n.closePath();if(U instanceof THREE.LineBasicMaterial){da.__styleString=U.color.__styleString;P=U.linewidth;if(I!=P)n.lineWidth=I=P;P=U.linecap;if(R!=P)n.lineCap=R=P;P=U.linejoin;if(D!=P)n.lineJoin=D=P;b(da.__styleString);n.stroke();A.inflate(U.linewidth*2)}}function fb(P,ka,oa,U,Fa,Ca,pa,Q,Na){a(Q.opacity);c(Q.blending);V=P.positionScreen.x;$=P.positionScreen.y;X=ka.positionScreen.x;sa=ka.positionScreen.y;va=oa.positionScreen.x;wa=oa.positionScreen.y;
-Za(V,$,X,sa,va,wa);if(Q instanceof THREE.MeshBasicMaterial)if(Q.map){if(Q.map.mapping instanceof THREE.UVMapping){Aa=pa.uvs[0];O(V,$,X,sa,va,wa,Q.map.image,Aa[U].u,Aa[U].v,Aa[Fa].u,Aa[Fa].v,Aa[Ca].u,Aa[Ca].v)}}else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping){P=Va.matrixWorldInverse;ja.copy(pa.vertexNormalsWorld[0]);h=(ja.x*P.n11+ja.y*P.n12+ja.z*P.n13)*0.5+0.5;t=-(ja.x*P.n21+ja.y*P.n22+ja.z*P.n23)*0.5+0.5;ja.copy(pa.vertexNormalsWorld[1]);w=(ja.x*P.n11+ja.y*P.n12+
-ja.z*P.n13)*0.5+0.5;p=-(ja.x*P.n21+ja.y*P.n22+ja.z*P.n23)*0.5+0.5;ja.copy(pa.vertexNormalsWorld[2]);C=(ja.x*P.n11+ja.y*P.n12+ja.z*P.n13)*0.5+0.5;H=-(ja.x*P.n21+ja.y*P.n22+ja.z*P.n23)*0.5+0.5;O(V,$,X,sa,va,wa,Q.envMap.image,h,t,w,p,C,H)}}else Q.wireframe?Ua(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Oa(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){if(Q.map.mapping instanceof THREE.UVMapping){Aa=pa.uvs[0];O(V,$,
-X,sa,va,wa,Q.map.image,Aa[U].u,Aa[U].v,Aa[Fa].u,Aa[Fa].v,Aa[Ca].u,Aa[Ca].v)}c(THREE.SubtractiveBlending)}if(aa)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&pa.vertexNormalsWorld.length==3){ua.r=ca.r=ga.r=Y.r;ua.g=ca.g=ga.g=Y.g;ua.b=ca.b=ga.b=Y.b;Da(Na,pa.v1.positionWorld,pa.vertexNormalsWorld[0],ua);Da(Na,pa.v2.positionWorld,pa.vertexNormalsWorld[1],ca);Da(Na,pa.v3.positionWorld,pa.vertexNormalsWorld[2],ga);xa.r=(ca.r+ga.r)*0.5;xa.g=(ca.g+ga.g)*0.5;xa.b=(ca.b+ga.b)*0.5;Ya=Sa(ua,ca,ga,xa);O(V,
-$,X,sa,va,wa,Ya,0,0,1,0,0,1)}else{J.r=Y.r;J.g=Y.g;J.b=Y.b;Da(Na,pa.centroidWorld,pa.normalWorld,J);da.r=Q.color.r*J.r;da.g=Q.color.g*J.g;da.b=Q.color.b*J.b;da.updateStyleString();Q.wireframe?Ua(da.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Oa(da.__styleString)}else Q.wireframe?Ua(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Oa(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Ka=Va.near;Xa=Va.far;ua.r=ua.g=ua.b=
-1-Ra(P.positionScreen.z,Ka,Xa);ca.r=ca.g=ca.b=1-Ra(ka.positionScreen.z,Ka,Xa);ga.r=ga.g=ga.b=1-Ra(oa.positionScreen.z,Ka,Xa);xa.r=(ca.r+ga.r)*0.5;xa.g=(ca.g+ga.g)*0.5;xa.b=(ca.b+ga.b)*0.5;Ya=Sa(ua,ca,ga,xa);O(V,$,X,sa,va,wa,Ya,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){da.r=gb(pa.normalWorld.x);da.g=gb(pa.normalWorld.y);da.b=gb(pa.normalWorld.z);da.updateStyleString();Q.wireframe?Ua(da.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Oa(da.__styleString)}}
-function $a(P,ka,oa,U,Fa,Ca,pa,Q,Na){a(Q.opacity);c(Q.blending);if(Q.map||Q.envMap){fb(P,ka,U,0,1,3,pa,Q,Na);fb(Fa,oa,Ca,1,2,3,pa,Q,Na)}else{V=P.positionScreen.x;$=P.positionScreen.y;X=ka.positionScreen.x;sa=ka.positionScreen.y;va=oa.positionScreen.x;wa=oa.positionScreen.y;ia=U.positionScreen.x;T=U.positionScreen.y;fa=Fa.positionScreen.x;qa=Fa.positionScreen.y;Z=Ca.positionScreen.x;S=Ca.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){La(V,$,X,sa,va,wa,ia,T);Q.wireframe?Ua(Q.color.__styleString,
-Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Oa(Q.color.__styleString)}else if(Q instanceof THREE.MeshLambertMaterial)if(aa)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&pa.vertexNormalsWorld.length==4){ua.r=ca.r=ga.r=xa.r=Y.r;ua.g=ca.g=ga.g=xa.g=Y.g;ua.b=ca.b=ga.b=xa.b=Y.b;Da(Na,pa.v1.positionWorld,pa.vertexNormalsWorld[0],ua);Da(Na,pa.v2.positionWorld,pa.vertexNormalsWorld[1],ca);Da(Na,pa.v4.positionWorld,pa.vertexNormalsWorld[3],ga);Da(Na,pa.v3.positionWorld,pa.vertexNormalsWorld[2],
-xa);Ya=Sa(ua,ca,ga,xa);Za(V,$,X,sa,ia,T);O(V,$,X,sa,ia,T,Ya,0,0,1,0,0,1);Za(fa,qa,va,wa,Z,S);O(fa,qa,va,wa,Z,S,Ya,1,0,1,1,0,1)}else{J.r=Y.r;J.g=Y.g;J.b=Y.b;Da(Na,pa.centroidWorld,pa.normalWorld,J);da.r=Q.color.r*J.r;da.g=Q.color.g*J.g;da.b=Q.color.b*J.b;da.updateStyleString();La(V,$,X,sa,va,wa,ia,T);Q.wireframe?Ua(da.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Oa(da.__styleString)}else{La(V,$,X,sa,va,wa,ia,T);Q.wireframe?Ua(Q.color.__styleString,Q.wireframeLinewidth,
-Q.wireframeLinecap,Q.wireframeLinejoin):Oa(Q.color.__styleString)}else if(Q instanceof THREE.MeshNormalMaterial){da.r=gb(pa.normalWorld.x);da.g=gb(pa.normalWorld.y);da.b=gb(pa.normalWorld.z);da.updateStyleString();La(V,$,X,sa,va,wa,ia,T);Q.wireframe?Ua(da.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):Oa(da.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Ka=Va.near;Xa=Va.far;ua.r=ua.g=ua.b=1-Ra(P.positionScreen.z,Ka,Xa);ca.r=ca.g=ca.b=1-Ra(ka.positionScreen.z,
-Ka,Xa);ga.r=ga.g=ga.b=1-Ra(U.positionScreen.z,Ka,Xa);xa.r=xa.g=xa.b=1-Ra(oa.positionScreen.z,Ka,Xa);Ya=Sa(ua,ca,ga,xa);Za(V,$,X,sa,ia,T);O(V,$,X,sa,ia,T,Ya,0,0,1,0,0,1);Za(fa,qa,va,wa,Z,S);O(fa,qa,va,wa,Z,S,Ya,1,0,1,1,0,1)}}}function Za(P,ka,oa,U,Fa,Ca){n.beginPath();n.moveTo(P,ka);n.lineTo(oa,U);n.lineTo(Fa,Ca);n.lineTo(P,ka);n.closePath()}function La(P,ka,oa,U,Fa,Ca,pa,Q){n.beginPath();n.moveTo(P,ka);n.lineTo(oa,U);n.lineTo(Fa,Ca);n.lineTo(pa,Q);n.lineTo(P,ka);n.closePath()}function Ua(P,ka,oa,
-U){if(I!=ka)n.lineWidth=I=ka;if(R!=oa)n.lineCap=R=oa;if(D!=U)n.lineJoin=D=U;b(P);n.stroke();A.inflate(ka*2)}function Oa(P){if(G!=P)n.fillStyle=G=P;n.fill()}function O(P,ka,oa,U,Fa,Ca,pa,Q,Na,eb,cb,bb,mb){var hb,ib;hb=pa.width-1;ib=pa.height-1;Q*=hb;Na*=ib;eb*=hb;cb*=ib;bb*=hb;mb*=ib;oa-=P;U-=ka;Fa-=P;Ca-=ka;eb-=Q;cb-=Na;bb-=Q;mb-=Na;hb=eb*mb-bb*cb;if(hb!=0){ib=1/hb;hb=(mb*oa-cb*Fa)*ib;cb=(mb*U-cb*Ca)*ib;oa=(eb*Fa-bb*oa)*ib;U=(eb*Ca-bb*U)*ib;P=P-hb*Q-oa*Na;ka=ka-cb*Q-U*Na;n.save();n.transform(hb,cb,
-oa,U,P,ka);n.clip();n.drawImage(pa,0,0);n.restore()}}function Sa(P,ka,oa,U){var Fa=~~(P.r*255),Ca=~~(P.g*255);P=~~(P.b*255);var pa=~~(ka.r*255),Q=~~(ka.g*255);ka=~~(ka.b*255);var Na=~~(oa.r*255),eb=~~(oa.g*255);oa=~~(oa.b*255);var cb=~~(U.r*255),bb=~~(U.g*255);U=~~(U.b*255);W[0]=Fa<0?0:Fa>255?255:Fa;W[1]=Ca<0?0:Ca>255?255:Ca;W[2]=P<0?0:P>255?255:P;W[4]=pa<0?0:pa>255?255:pa;W[5]=Q<0?0:Q>255?255:Q;W[6]=ka<0?0:ka>255?255:ka;W[8]=Na<0?0:Na>255?255:Na;W[9]=eb<0?0:eb>255?255:eb;W[10]=oa<0?0:oa>255?255:
-oa;W[12]=cb<0?0:cb>255?255:cb;W[13]=bb<0?0:bb>255?255:bb;W[14]=U<0?0:U>255?255:U;ya.putImageData(Ba,0,0);na.drawImage(Ha,0,0);return ea}function Ra(P,ka,oa){P=(P-ka)/(oa-ka);return P*P*(3-2*P)}function gb(P){P=(P+1)*0.5;return P<0?0:P>1?1:P}function db(P,ka){var oa=ka.x-P.x,U=ka.y-P.y,Fa=1/Math.sqrt(oa*oa+U*U);oa*=Fa;U*=Fa;ka.x+=oa;ka.y+=U;P.x-=oa;P.y-=U}var ab,Pa,ta,Ea,Ga,Ja,Ma,Wa;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,o);d=f.projectScene(za,Va,this.sortElements);(aa=za.lights.length>
-0)&&Qa(za);ab=0;for(Pa=d.length;ab<Pa;ab++){ta=d[ab];A.empty();if(ta instanceof THREE.RenderableParticle){M=ta;M.x*=m;M.y*=o;Ea=0;for(Ga=ta.materials.length;Ea<Ga;){Wa=ta.materials[Ea++];Wa.opacity!=0&&Ta(M,ta,Wa,za)}}else if(ta instanceof THREE.RenderableLine){M=ta.v1;L=ta.v2;M.positionScreen.x*=m;M.positionScreen.y*=o;L.positionScreen.x*=m;L.positionScreen.y*=o;A.addPoint(M.positionScreen.x,M.positionScreen.y);A.addPoint(L.positionScreen.x,L.positionScreen.y);if(K.instersects(A)){Ea=0;for(Ga=ta.materials.length;Ea<
-Ga;){Wa=ta.materials[Ea++];Wa.opacity!=0&&kb(M,L,ta,Wa,za)}}}else if(ta instanceof THREE.RenderableFace3){M=ta.v1;L=ta.v2;N=ta.v3;M.positionScreen.x*=m;M.positionScreen.y*=o;L.positionScreen.x*=m;L.positionScreen.y*=o;N.positionScreen.x*=m;N.positionScreen.y*=o;if(ta.overdraw){db(M.positionScreen,L.positionScreen);db(L.positionScreen,N.positionScreen);db(N.positionScreen,M.positionScreen)}A.add3Points(M.positionScreen.x,M.positionScreen.y,L.positionScreen.x,L.positionScreen.y,N.positionScreen.x,N.positionScreen.y);
-if(K.instersects(A)){Ea=0;for(Ga=ta.meshMaterials.length;Ea<Ga;){Wa=ta.meshMaterials[Ea++];if(Wa instanceof THREE.MeshFaceMaterial){Ja=0;for(Ma=ta.faceMaterials.length;Ja<Ma;)(Wa=ta.faceMaterials[Ja++])&&Wa.opacity!=0&&fb(M,L,N,0,1,2,ta,Wa,za)}else Wa.opacity!=0&&fb(M,L,N,0,1,2,ta,Wa,za)}}}else if(ta instanceof THREE.RenderableFace4){M=ta.v1;L=ta.v2;N=ta.v3;ma=ta.v4;M.positionScreen.x*=m;M.positionScreen.y*=o;L.positionScreen.x*=m;L.positionScreen.y*=o;N.positionScreen.x*=m;N.positionScreen.y*=o;
-ma.positionScreen.x*=m;ma.positionScreen.y*=o;e.positionScreen.copy(L.positionScreen);la.positionScreen.copy(ma.positionScreen);if(ta.overdraw){db(M.positionScreen,L.positionScreen);db(L.positionScreen,ma.positionScreen);db(ma.positionScreen,M.positionScreen);db(N.positionScreen,e.positionScreen);db(N.positionScreen,la.positionScreen)}A.addPoint(M.positionScreen.x,M.positionScreen.y);A.addPoint(L.positionScreen.x,L.positionScreen.y);A.addPoint(N.positionScreen.x,N.positionScreen.y);A.addPoint(ma.positionScreen.x,
-ma.positionScreen.y);if(K.instersects(A)){Ea=0;for(Ga=ta.meshMaterials.length;Ea<Ga;){Wa=ta.meshMaterials[Ea++];if(Wa instanceof THREE.MeshFaceMaterial){Ja=0;for(Ma=ta.faceMaterials.length;Ja<Ma;)(Wa=ta.faceMaterials[Ja++])&&Wa.opacity!=0&&$a(M,L,N,ma,e,la,ta,Wa,za)}else Wa.opacity!=0&&$a(M,L,N,ma,e,la,ta,Wa,za)}}}E.addRectangle(A)}n.setTransform(1,0,0,1,0,0)}};
-THREE.SVGRenderer=function(){function a(ia,T,fa){var qa,Z,S,da;qa=0;for(Z=ia.lights.length;qa<Z;qa++){S=ia.lights[qa];if(S instanceof THREE.DirectionalLight){da=T.normalWorld.dot(S.position)*S.intensity;if(da>0){fa.r+=S.color.r*da;fa.g+=S.color.g*da;fa.b+=S.color.b*da}}else if(S instanceof THREE.PointLight){la.sub(S.position,T.centroidWorld);la.normalize();da=T.normalWorld.dot(la)*S.intensity;if(da>0){fa.r+=S.color.r*da;fa.g+=S.color.g*da;fa.b+=S.color.b*da}}}}function c(ia,T,fa,qa,Z,S){X=d(sa++);
-X.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+"z");if(Z instanceof THREE.MeshBasicMaterial)D.__styleString=Z.color.__styleString;else if(Z instanceof THREE.MeshLambertMaterial)if(R){M.r=L.r;M.g=L.g;M.b=L.b;a(S,qa,M);D.r=Z.color.r*M.r;D.g=Z.color.g*M.g;D.b=Z.color.b*M.b;D.updateStyleString()}else D.__styleString=Z.color.__styleString;else if(Z instanceof THREE.MeshDepthMaterial){e=
-1-Z.__2near/(Z.__farPlusNear-qa.z*Z.__farMinusNear);D.setRGB(e,e,e)}else Z instanceof THREE.MeshNormalMaterial&&D.setRGB(f(qa.normalWorld.x),f(qa.normalWorld.y),f(qa.normalWorld.z));Z.wireframe?X.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+Z.wireframeLinewidth+"; stroke-opacity: "+Z.opacity+"; stroke-linecap: "+Z.wireframeLinecap+"; stroke-linejoin: "+Z.wireframeLinejoin):X.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+Z.opacity);k.appendChild(X)}
-function b(ia,T,fa,qa,Z,S,da){X=d(sa++);X.setAttribute("d","M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+T.positionScreen.x+" "+T.positionScreen.y+" L "+fa.positionScreen.x+","+fa.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)D.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(R){M.r=L.r;M.g=L.g;M.b=L.b;a(da,Z,M);D.r=S.color.r*M.r;D.g=S.color.g*M.g;D.b=S.color.b*M.b;D.updateStyleString()}else D.__styleString=
-S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){e=1-S.__2near/(S.__farPlusNear-Z.z*S.__farMinusNear);D.setRGB(e,e,e)}else S instanceof THREE.MeshNormalMaterial&&D.setRGB(f(Z.normalWorld.x),f(Z.normalWorld.y),f(Z.normalWorld.z));S.wireframe?X.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+S.wireframeLinewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframeLinecap+"; stroke-linejoin: "+S.wireframeLinejoin):X.setAttribute("style","fill: "+
-D.__styleString+"; fill-opacity: "+S.opacity);k.appendChild(X)}function d(ia){if(V[ia]==null){V[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");wa==0&&V[ia].setAttribute("shape-rendering","crispEdges")}return V[ia]}function f(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var g=null,j=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,o,n,x,z,y,B,F,G=new THREE.Rectangle,I=new THREE.Rectangle,R=!1,D=new THREE.Color(16777215),M=
-new THREE.Color(16777215),L=new THREE.Color(0),N=new THREE.Color(0),ma=new THREE.Color(0),e,la=new THREE.Vector3,V=[],$=[],X,sa,va,wa=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ia){switch(ia){case "high":wa=1;break;case "low":wa=0}};this.setSize=function(ia,T){m=ia;o=T;n=m/2;x=o/2;k.setAttribute("viewBox",-n+" "+-x+" "+m+" "+o);k.setAttribute("width",m);k.setAttribute("height",o);G.set(-n,-x,n,x)};this.clear=function(){for(;k.childNodes.length>
-0;)k.removeChild(k.childNodes[0])};this.render=function(ia,T){var fa,qa,Z,S,da,ua,ca,ga;this.autoClear&&this.clear();g=j.projectScene(ia,T,this.sortElements);va=sa=0;if(R=ia.lights.length>0){ca=ia.lights;L.setRGB(0,0,0);N.setRGB(0,0,0);ma.setRGB(0,0,0);fa=0;for(qa=ca.length;fa<qa;fa++){Z=ca[fa];S=Z.color;if(Z instanceof THREE.AmbientLight){L.r+=S.r;L.g+=S.g;L.b+=S.b}else if(Z instanceof THREE.DirectionalLight){N.r+=S.r;N.g+=S.g;N.b+=S.b}else if(Z instanceof THREE.PointLight){ma.r+=S.r;ma.g+=S.g;ma.b+=
-S.b}}}fa=0;for(qa=g.length;fa<qa;fa++){ca=g[fa];I.empty();if(ca instanceof THREE.RenderableParticle){z=ca;z.x*=n;z.y*=-x;Z=0;for(S=ca.materials.length;Z<S;)Z++}else if(ca instanceof THREE.RenderableLine){z=ca.v1;y=ca.v2;z.positionScreen.x*=n;z.positionScreen.y*=-x;y.positionScreen.x*=n;y.positionScreen.y*=-x;I.addPoint(z.positionScreen.x,z.positionScreen.y);I.addPoint(y.positionScreen.x,y.positionScreen.y);if(G.instersects(I)){Z=0;for(S=ca.materials.length;Z<S;)if((ga=ca.materials[Z++])&&ga.opacity!=
-0){da=z;ua=y;var xa=va++;if($[xa]==null){$[xa]=document.createElementNS("http://www.w3.org/2000/svg","line");wa==0&&$[xa].setAttribute("shape-rendering","crispEdges")}X=$[xa];X.setAttribute("x1",da.positionScreen.x);X.setAttribute("y1",da.positionScreen.y);X.setAttribute("x2",ua.positionScreen.x);X.setAttribute("y2",ua.positionScreen.y);if(ga instanceof THREE.LineBasicMaterial){D.__styleString=ga.color.__styleString;X.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+
-ga.linewidth+"; stroke-opacity: "+ga.opacity+"; stroke-linecap: "+ga.linecap+"; stroke-linejoin: "+ga.linejoin);k.appendChild(X)}}}}else if(ca instanceof THREE.RenderableFace3){z=ca.v1;y=ca.v2;B=ca.v3;z.positionScreen.x*=n;z.positionScreen.y*=-x;y.positionScreen.x*=n;y.positionScreen.y*=-x;B.positionScreen.x*=n;B.positionScreen.y*=-x;I.addPoint(z.positionScreen.x,z.positionScreen.y);I.addPoint(y.positionScreen.x,y.positionScreen.y);I.addPoint(B.positionScreen.x,B.positionScreen.y);if(G.instersects(I)){Z=
-0;for(S=ca.meshMaterials.length;Z<S;){ga=ca.meshMaterials[Z++];if(ga instanceof THREE.MeshFaceMaterial){da=0;for(ua=ca.faceMaterials.length;da<ua;)(ga=ca.faceMaterials[da++])&&ga.opacity!=0&&c(z,y,B,ca,ga,ia)}else ga&&ga.opacity!=0&&c(z,y,B,ca,ga,ia)}}}else if(ca instanceof THREE.RenderableFace4){z=ca.v1;y=ca.v2;B=ca.v3;F=ca.v4;z.positionScreen.x*=n;z.positionScreen.y*=-x;y.positionScreen.x*=n;y.positionScreen.y*=-x;B.positionScreen.x*=n;B.positionScreen.y*=-x;F.positionScreen.x*=n;F.positionScreen.y*=
--x;I.addPoint(z.positionScreen.x,z.positionScreen.y);I.addPoint(y.positionScreen.x,y.positionScreen.y);I.addPoint(B.positionScreen.x,B.positionScreen.y);I.addPoint(F.positionScreen.x,F.positionScreen.y);if(G.instersects(I)){Z=0;for(S=ca.meshMaterials.length;Z<S;){ga=ca.meshMaterials[Z++];if(ga instanceof THREE.MeshFaceMaterial){da=0;for(ua=ca.faceMaterials.length;da<ua;)(ga=ca.faceMaterials[da++])&&ga.opacity!=0&&b(z,y,B,F,ca,ga,ia)}else ga&&ga.opacity!=0&&b(z,y,B,F,ca,ga,ia)}}}}}};
+THREE.Projector=function(){function a(){var d=m[j]=m[j]||new THREE.RenderableVertex;j++;return d}function c(d,Z){return Z.z-d.z}function b(d,Z){var ya=0,Ga=1,Ha=d.z+d.w,ra=Z.z+Z.w,X=-d.z+d.w,qa=-Z.z+Z.w;if(Ha>=0&&ra>=0&&X>=0&&qa>=0)return!0;else if(Ha<0&&ra<0||X<0&&qa<0)return!1;else{if(Ha<0)ya=Math.max(ya,Ha/(Ha-ra));else ra<0&&(Ga=Math.min(Ga,Ha/(Ha-ra)));if(X<0)ya=Math.max(ya,X/(X-qa));else qa<0&&(Ga=Math.min(Ga,X/(X-qa)));if(Ga<ya)return!1;else{d.lerpSelf(Z,ya);Z.lerpSelf(d,1-Ga);return!0}}}var e,
+f,g=[],h,j,m=[],o,n,t=[],y,w=[],z,E,G=[],J,S,D=[],L=new THREE.Vector4,N=new THREE.Vector4,O=new THREE.Matrix4,Fa=new THREE.Matrix4,oa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],xa=new THREE.Vector4,W=new THREE.Vector4;this.projectVector=function(d,Z){O.multiply(Z.projectionMatrix,Z.matrixWorldInverse);O.multiplyVector3(d);return d};this.unprojectVector=function(d,Z){O.multiply(Z.matrixWorld,THREE.Matrix4.makeInvert(Z.projectionMatrix));
+O.multiplyVector3(d);return d};this.projectObjects=function(d,Z,ya){Z=[];var Ga,Ha,ra;f=0;Ha=d.objects;d=0;for(Ga=Ha.length;d<Ga;d++){ra=Ha[d];var X;if(!(X=!ra.visible))if(X=ra instanceof THREE.Mesh){a:{X=void 0;for(var qa=ra.matrixWorld,za=-ra.geometry.boundingSphere.radius*Math.max(ra.scale.x,Math.max(ra.scale.y,ra.scale.z)),ea=0;ea<6;ea++){X=oa[ea].x*qa.n14+oa[ea].y*qa.n24+oa[ea].z*qa.n34+oa[ea].w;if(X<=za){X=!1;break a}}X=!0}X=!X}if(!X){X=g[f]=g[f]||new THREE.RenderableObject;f++;e=X;L.copy(ra.position);
+O.multiplyVector3(L);e.object=ra;e.z=L.z;Z.push(e)}}ya&&Z.sort(c);return Z};this.projectScene=function(d,Z,ya){var Ga=[],Ha=Z.near,ra=Z.far,X,qa,za,ea,U,ma,Ca,fa,ja,Da,Sa,Xa,Wa,Ta,M,V,na;S=E=y=n=0;Z.matrixAutoUpdate&&Z.updateMatrix();d.update(undefined,!1,Z);O.multiply(Z.projectionMatrix,Z.matrixWorldInverse);oa[0].set(O.n41-O.n11,O.n42-O.n12,O.n43-O.n13,O.n44-O.n14);oa[1].set(O.n41+O.n11,O.n42+O.n12,O.n43+O.n13,O.n44+O.n14);oa[2].set(O.n41+O.n21,O.n42+O.n22,O.n43+O.n23,O.n44+O.n24);oa[3].set(O.n41-
+O.n21,O.n42-O.n22,O.n43-O.n23,O.n44-O.n24);oa[4].set(O.n41-O.n31,O.n42-O.n32,O.n43-O.n33,O.n44-O.n34);oa[5].set(O.n41+O.n31,O.n42+O.n32,O.n43+O.n33,O.n44+O.n34);for(X=0;X<6;X++){ja=oa[X];ja.divideScalar(Math.sqrt(ja.x*ja.x+ja.y*ja.y+ja.z*ja.z))}ja=this.projectObjects(d,Z,!0);d=0;for(X=ja.length;d<X;d++){Da=ja[d].object;if(Da.visible){Sa=Da.matrixWorld;Xa=Da.matrixRotationWorld;Wa=Da.materials;Ta=Da.overdraw;j=0;if(Da instanceof THREE.Mesh){M=Da.geometry;ea=M.vertices;V=M.faces;M=M.faceVertexUvs;qa=
+0;for(za=ea.length;qa<za;qa++){h=a();h.positionWorld.copy(ea[qa].position);Sa.multiplyVector3(h.positionWorld);h.positionScreen.copy(h.positionWorld);O.multiplyVector4(h.positionScreen);h.positionScreen.x/=h.positionScreen.w;h.positionScreen.y/=h.positionScreen.w;h.visible=h.positionScreen.z>Ha&&h.positionScreen.z<ra}ea=0;for(qa=V.length;ea<qa;ea++){za=V[ea];if(za instanceof THREE.Face3){U=m[za.a];ma=m[za.b];Ca=m[za.c];if(U.visible&&ma.visible&&Ca.visible&&(Da.doubleSided||Da.flipSided!=(Ca.positionScreen.x-
+U.positionScreen.x)*(ma.positionScreen.y-U.positionScreen.y)-(Ca.positionScreen.y-U.positionScreen.y)*(ma.positionScreen.x-U.positionScreen.x)<0)){fa=t[n]=t[n]||new THREE.RenderableFace3;n++;o=fa;o.v1.copy(U);o.v2.copy(ma);o.v3.copy(Ca)}else continue}else if(za instanceof THREE.Face4){U=m[za.a];ma=m[za.b];Ca=m[za.c];fa=m[za.d];if(U.visible&&ma.visible&&Ca.visible&&fa.visible&&(Da.doubleSided||Da.flipSided!=((fa.positionScreen.x-U.positionScreen.x)*(ma.positionScreen.y-U.positionScreen.y)-(fa.positionScreen.y-
+U.positionScreen.y)*(ma.positionScreen.x-U.positionScreen.x)<0||(ma.positionScreen.x-Ca.positionScreen.x)*(fa.positionScreen.y-Ca.positionScreen.y)-(ma.positionScreen.y-Ca.positionScreen.y)*(fa.positionScreen.x-Ca.positionScreen.x)<0))){na=w[y]=w[y]||new THREE.RenderableFace4;y++;o=na;o.v1.copy(U);o.v2.copy(ma);o.v3.copy(Ca);o.v4.copy(fa)}else continue}o.normalWorld.copy(za.normal);Xa.multiplyVector3(o.normalWorld);o.centroidWorld.copy(za.centroid);Sa.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);
+O.multiplyVector3(o.centroidScreen);Ca=za.vertexNormals;U=0;for(ma=Ca.length;U<ma;U++){fa=o.vertexNormalsWorld[U];fa.copy(Ca[U]);Xa.multiplyVector3(fa)}U=0;for(ma=M.length;U<ma;U++)if(na=M[U][ea]){Ca=0;for(fa=na.length;Ca<fa;Ca++)o.uvs[U][Ca]=na[Ca]}o.meshMaterials=Wa;o.faceMaterials=za.materials;o.overdraw=Ta;o.z=o.centroidScreen.z;Ga.push(o)}}else if(Da instanceof THREE.Line){Fa.multiply(O,Sa);ea=Da.geometry.vertices;U=a();U.positionScreen.copy(ea[0].position);Fa.multiplyVector4(U.positionScreen);
+qa=1;for(za=ea.length;qa<za;qa++){U=a();U.positionScreen.copy(ea[qa].position);Fa.multiplyVector4(U.positionScreen);ma=m[j-2];xa.copy(U.positionScreen);W.copy(ma.positionScreen);if(b(xa,W)){xa.multiplyScalar(1/xa.w);W.multiplyScalar(1/W.w);Sa=G[E]=G[E]||new THREE.RenderableLine;E++;z=Sa;z.v1.positionScreen.copy(xa);z.v2.positionScreen.copy(W);z.z=Math.max(xa.z,W.z);z.materials=Da.materials;Ga.push(z)}}}else if(Da instanceof THREE.Particle){N.set(Da.position.x,Da.position.y,Da.position.z,1);O.multiplyVector4(N);
+N.z/=N.w;if(N.z>0&&N.z<1){Sa=D[S]=D[S]||new THREE.RenderableParticle;S++;J=Sa;J.x=N.x/N.w;J.y=N.y/N.w;J.z=N.z;J.rotation=Da.rotation.z;J.scale.x=Da.scale.x*Math.abs(J.x-(N.x+Z.projectionMatrix.n11)/(N.w+Z.projectionMatrix.n14));J.scale.y=Da.scale.y*Math.abs(J.y-(N.y+Z.projectionMatrix.n22)/(N.w+Z.projectionMatrix.n24));J.materials=Da.materials;Ga.push(J)}}}}ya&&Ga.sort(c);return Ga}};
+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,j){b=h;e=j;f=b/2;g=e/2};this.render=function(h,j){var m,o,n,t,y,w,z,E;a=c.projectScene(h,j);m=0;for(o=a.length;m<o;m++){y=a[m];if(y instanceof THREE.RenderableParticle){z=y.x*f+f;E=y.y*g+g;n=0;for(t=y.material.length;n<t;n++){w=y.material[n];if(w instanceof THREE.ParticleDOMMaterial){w=w.domElement;w.style.left=z+"px";w.style.top=E+"px"}}}}}};
+THREE.CanvasRenderer=function(){function a(ka){if(w!=ka)n.globalAlpha=w=ka}function c(ka){if(z!=ka){switch(ka){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}z=ka}}function b(ka){if(E!=ka)n.strokeStyle=E=ka}var e=null,f=new THREE.Projector,g=document.createElement("canvas"),h,j,m,o,n=g.getContext("2d"),t=new THREE.Color(0),y=0,w=1,z=0,
+E=null,G=null,J=null,S=null,D=null,L,N,O,Fa,oa=new THREE.RenderableVertex,xa=new THREE.RenderableVertex,W,d,Z,ya,Ga,Ha,ra,X,qa,za,ea,U,ma=new THREE.Color,Ca=new THREE.Color,fa=new THREE.Color,ja=new THREE.Color,Da=new THREE.Color,Sa,Xa,Wa,Ta,M,V,na,Aa,ca,ga,k=new THREE.Rectangle,B=new THREE.Rectangle,x=new THREE.Rectangle,p=!1,A=new THREE.Color,F=new THREE.Color,H=new THREE.Color,K=new THREE.Color,C=new THREE.Vector3,$,I,la,Y,ua,sa,Ea=16;$=document.createElement("canvas");$.width=$.height=2;I=$.getContext("2d");
+I.fillStyle="rgba(0,0,0,1)";I.fillRect(0,0,2,2);la=I.getImageData(0,0,2,2);Y=la.data;ua=document.createElement("canvas");ua.width=ua.height=Ea;sa=ua.getContext("2d");sa.translate(-Ea/2,-Ea/2);sa.scale(Ea,Ea);Ea--;this.domElement=g;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(ka,va){h=ka;j=va;m=h/2;o=j/2;g.width=h;g.height=j;k.set(-m,-o,m,o);w=1;z=0;D=S=J=G=E=null};this.setClearColor=function(ka,va){t=ka;y=va};this.setClearColorHex=function(ka,va){t.setHex(ka);y=
+va};this.clear=function(){n.setTransform(1,0,0,-1,m,o);if(!B.isEmpty()){B.inflate(1);B.minSelf(k);if(t.hex==0&&y==0)n.clearRect(B.getX(),B.getY(),B.getWidth(),B.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+y+")";n.fillRect(B.getX(),B.getY(),B.getWidth(),B.getHeight())}B.empty()}};this.render=function(ka,va){function ha(P){var da,aa,T,ta=P.lights;F.setRGB(0,0,0);H.setRGB(0,0,0);K.setRGB(0,0,0);P=0;for(da=
+ta.length;P<da;P++){aa=ta[P];T=aa.color;if(aa instanceof THREE.AmbientLight){F.r+=T.r;F.g+=T.g;F.b+=T.b}else if(aa instanceof THREE.DirectionalLight){H.r+=T.r;H.g+=T.g;H.b+=T.b}else if(aa instanceof THREE.PointLight){K.r+=T.r;K.g+=T.g;K.b+=T.b}}}function ia(P,da,aa,T){var ta,Ja,pa,Q,Oa=P.lights;P=0;for(ta=Oa.length;P<ta;P++){Ja=Oa[P];pa=Ja.color;if(Ja instanceof THREE.DirectionalLight){Q=aa.dot(Ja.position);if(!(Q<=0)){Q*=Ja.intensity;T.r+=pa.r*Q;T.g+=pa.g*Q;T.b+=pa.b*Q}}else if(Ja instanceof THREE.PointLight){Q=
+aa.dot(C.sub(Ja.position,da).normalize());if(!(Q<=0)){Q*=Ja.distance==0?1:1-Math.min(da.distanceTo(Ja.position)/Ja.distance,1);if(Q!=0){Q*=Ja.intensity;T.r+=pa.r*Q;T.g+=pa.g*Q;T.b+=pa.b*Q}}}}}function wa(P,da,aa){a(aa.opacity);c(aa.blending);var T,ta,Ja,pa,Q,Oa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map){pa=aa.map.image;Q=pa.width>>1;Oa=pa.height>>1;aa=da.scale.x*m;Ja=da.scale.y*o;T=aa*Q;ta=Ja*Oa;x.set(P.x-T,P.y-ta,P.x+T,P.y+ta);if(k.instersects(x)){n.save();n.translate(P.x,P.y);n.rotate(-da.rotation);
+n.scale(aa,-Ja);n.translate(-Q,-Oa);n.drawImage(pa,0,0);n.restore()}}}else if(aa instanceof THREE.ParticleCanvasMaterial){T=da.scale.x*m;ta=da.scale.y*o;x.set(P.x-T,P.y-ta,P.x+T,P.y+ta);if(k.instersects(x)){b(aa.color.__styleString);Ja=aa.color.__styleString;if(G!=Ja)n.fillStyle=G=Ja;n.save();n.translate(P.x,P.y);n.rotate(-da.rotation);n.scale(T,ta);aa.program(n);n.restore()}}}function Qa(P,da,aa,T){a(T.opacity);c(T.blending);n.beginPath();n.moveTo(P.positionScreen.x,P.positionScreen.y);n.lineTo(da.positionScreen.x,
+da.positionScreen.y);n.closePath();if(T instanceof THREE.LineBasicMaterial){ma.__styleString=T.color.__styleString;P=T.linewidth;if(J!=P)n.lineWidth=J=P;P=T.linecap;if(S!=P)n.lineCap=S=P;P=T.linejoin;if(D!=P)n.lineJoin=D=P;b(ma.__styleString);n.stroke();x.inflate(T.linewidth*2)}}function Va(P,da,aa,T,ta,Ja,pa,Q,Oa){a(Q.opacity);c(Q.blending);W=P.positionScreen.x;d=P.positionScreen.y;Z=da.positionScreen.x;ya=da.positionScreen.y;Ga=aa.positionScreen.x;Ha=aa.positionScreen.y;Ma(W,d,Z,ya,Ga,Ha);if(Q instanceof
+THREE.MeshBasicMaterial)if(Q.map){if(Q.map.mapping instanceof THREE.UVMapping){Ta=pa.uvs[0];bb(W,d,Z,ya,Ga,Ha,Q.map.image,Ta[T].u,Ta[T].v,Ta[ta].u,Ta[ta].v,Ta[Ja].u,Ta[Ja].v)}}else if(Q.envMap){if(Q.envMap.mapping instanceof THREE.SphericalReflectionMapping){P=va.matrixWorldInverse;C.copy(pa.vertexNormalsWorld[0]);M=(C.x*P.n11+C.y*P.n12+C.z*P.n13)*0.5+0.5;V=-(C.x*P.n21+C.y*P.n22+C.z*P.n23)*0.5+0.5;C.copy(pa.vertexNormalsWorld[1]);na=(C.x*P.n11+C.y*P.n12+C.z*P.n13)*0.5+0.5;Aa=-(C.x*P.n21+C.y*P.n22+
+C.z*P.n23)*0.5+0.5;C.copy(pa.vertexNormalsWorld[2]);ca=(C.x*P.n11+C.y*P.n12+C.z*P.n13)*0.5+0.5;ga=-(C.x*P.n21+C.y*P.n22+C.z*P.n23)*0.5+0.5;bb(W,d,Z,ya,Ga,Ha,Q.envMap.image,M,V,na,Aa,ca,ga)}}else Q.wireframe?Pa(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){if(Q.map.mapping instanceof THREE.UVMapping){Ta=pa.uvs[0];bb(W,d,Z,ya,Ga,Ha,Q.map.image,Ta[T].u,Ta[T].v,Ta[ta].u,
+Ta[ta].v,Ta[Ja].u,Ta[Ja].v)}c(THREE.SubtractiveBlending)}if(p)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&pa.vertexNormalsWorld.length==3){Ca.r=fa.r=ja.r=F.r;Ca.g=fa.g=ja.g=F.g;Ca.b=fa.b=ja.b=F.b;ia(Oa,pa.v1.positionWorld,pa.vertexNormalsWorld[0],Ca);ia(Oa,pa.v2.positionWorld,pa.vertexNormalsWorld[1],fa);ia(Oa,pa.v3.positionWorld,pa.vertexNormalsWorld[2],ja);Da.r=(fa.r+ja.r)*0.5;Da.g=(fa.g+ja.g)*0.5;Da.b=(fa.b+ja.b)*0.5;Wa=$a(Ca,fa,ja,Da);bb(W,d,Z,ya,Ga,Ha,Wa,0,0,1,0,0,1)}else{A.r=F.r;A.g=F.g;
+A.b=F.b;ia(Oa,pa.centroidWorld,pa.normalWorld,A);ma.r=Q.color.r*A.r;ma.g=Q.color.g*A.g;ma.b=Q.color.b*A.b;ma.updateStyleString();Q.wireframe?Pa(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(ma.__styleString)}else Q.wireframe?Pa(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=va.near;Xa=va.far;Ca.r=Ca.g=Ca.b=1-Za(P.positionScreen.z,Sa,Xa);fa.r=fa.g=fa.b=1-
+Za(da.positionScreen.z,Sa,Xa);ja.r=ja.g=ja.b=1-Za(aa.positionScreen.z,Sa,Xa);Da.r=(fa.r+ja.r)*0.5;Da.g=(fa.g+ja.g)*0.5;Da.b=(fa.b+ja.b)*0.5;Wa=$a(Ca,fa,ja,Da);bb(W,d,Z,ya,Ga,Ha,Wa,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){ma.r=Ka(pa.normalWorld.x);ma.g=Ka(pa.normalWorld.y);ma.b=Ka(pa.normalWorld.z);ma.updateStyleString();Q.wireframe?Pa(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(ma.__styleString)}}function eb(P,da,aa,T,ta,Ja,pa,Q,Oa){a(Q.opacity);
+c(Q.blending);if(Q.map||Q.envMap){Va(P,da,T,0,1,3,pa,Q,Oa);Va(ta,aa,Ja,1,2,3,pa,Q,Oa)}else{W=P.positionScreen.x;d=P.positionScreen.y;Z=da.positionScreen.x;ya=da.positionScreen.y;Ga=aa.positionScreen.x;Ha=aa.positionScreen.y;ra=T.positionScreen.x;X=T.positionScreen.y;qa=ta.positionScreen.x;za=ta.positionScreen.y;ea=Ja.positionScreen.x;U=Ja.positionScreen.y;if(Q instanceof THREE.MeshBasicMaterial){La(W,d,Z,ya,Ga,Ha,ra,X);Q.wireframe?Pa(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):
+cb(Q.color.__styleString)}else if(Q instanceof THREE.MeshLambertMaterial)if(p)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&pa.vertexNormalsWorld.length==4){Ca.r=fa.r=ja.r=Da.r=F.r;Ca.g=fa.g=ja.g=Da.g=F.g;Ca.b=fa.b=ja.b=Da.b=F.b;ia(Oa,pa.v1.positionWorld,pa.vertexNormalsWorld[0],Ca);ia(Oa,pa.v2.positionWorld,pa.vertexNormalsWorld[1],fa);ia(Oa,pa.v4.positionWorld,pa.vertexNormalsWorld[3],ja);ia(Oa,pa.v3.positionWorld,pa.vertexNormalsWorld[2],Da);Wa=$a(Ca,fa,ja,Da);Ma(W,d,Z,ya,ra,X);bb(W,d,Z,ya,
+ra,X,Wa,0,0,1,0,0,1);Ma(qa,za,Ga,Ha,ea,U);bb(qa,za,Ga,Ha,ea,U,Wa,1,0,1,1,0,1)}else{A.r=F.r;A.g=F.g;A.b=F.b;ia(Oa,pa.centroidWorld,pa.normalWorld,A);ma.r=Q.color.r*A.r;ma.g=Q.color.g*A.g;ma.b=Q.color.b*A.b;ma.updateStyleString();La(W,d,Z,ya,Ga,Ha,ra,X);Q.wireframe?Pa(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(ma.__styleString)}else{La(W,d,Z,ya,Ga,Ha,ra,X);Q.wireframe?Pa(Q.color.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(Q.color.__styleString)}else if(Q instanceof
+THREE.MeshNormalMaterial){ma.r=Ka(pa.normalWorld.x);ma.g=Ka(pa.normalWorld.y);ma.b=Ka(pa.normalWorld.z);ma.updateStyleString();La(W,d,Z,ya,Ga,Ha,ra,X);Q.wireframe?Pa(ma.__styleString,Q.wireframeLinewidth,Q.wireframeLinecap,Q.wireframeLinejoin):cb(ma.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){Sa=va.near;Xa=va.far;Ca.r=Ca.g=Ca.b=1-Za(P.positionScreen.z,Sa,Xa);fa.r=fa.g=fa.b=1-Za(da.positionScreen.z,Sa,Xa);ja.r=ja.g=ja.b=1-Za(T.positionScreen.z,Sa,Xa);Da.r=Da.g=Da.b=1-Za(aa.positionScreen.z,
+Sa,Xa);Wa=$a(Ca,fa,ja,Da);Ma(W,d,Z,ya,ra,X);bb(W,d,Z,ya,ra,X,Wa,0,0,1,0,0,1);Ma(qa,za,Ga,Ha,ea,U);bb(qa,za,Ga,Ha,ea,U,Wa,1,0,1,1,0,1)}}}function Ma(P,da,aa,T,ta,Ja){n.beginPath();n.moveTo(P,da);n.lineTo(aa,T);n.lineTo(ta,Ja);n.lineTo(P,da);n.closePath()}function La(P,da,aa,T,ta,Ja,pa,Q){n.beginPath();n.moveTo(P,da);n.lineTo(aa,T);n.lineTo(ta,Ja);n.lineTo(pa,Q);n.lineTo(P,da);n.closePath()}function Pa(P,da,aa,T){if(J!=da)n.lineWidth=J=da;if(S!=aa)n.lineCap=S=aa;if(D!=T)n.lineJoin=D=T;b(P);n.stroke();
+x.inflate(da*2)}function cb(P){if(G!=P)n.fillStyle=G=P;n.fill()}function bb(P,da,aa,T,ta,Ja,pa,Q,Oa,Ra,db,hb,jb){var fb,ib;fb=pa.width-1;ib=pa.height-1;Q*=fb;Oa*=ib;Ra*=fb;db*=ib;hb*=fb;jb*=ib;aa-=P;T-=da;ta-=P;Ja-=da;Ra-=Q;db-=Oa;hb-=Q;jb-=Oa;fb=Ra*jb-hb*db;if(fb!=0){ib=1/fb;fb=(jb*aa-db*ta)*ib;db=(jb*T-db*Ja)*ib;aa=(Ra*ta-hb*aa)*ib;T=(Ra*Ja-hb*T)*ib;P=P-fb*Q-aa*Oa;da=da-db*Q-T*Oa;n.save();n.transform(fb,db,aa,T,P,da);n.clip();n.drawImage(pa,0,0);n.restore()}}function $a(P,da,aa,T){var ta=~~(P.r*
+255),Ja=~~(P.g*255);P=~~(P.b*255);var pa=~~(da.r*255),Q=~~(da.g*255);da=~~(da.b*255);var Oa=~~(aa.r*255),Ra=~~(aa.g*255);aa=~~(aa.b*255);var db=~~(T.r*255),hb=~~(T.g*255);T=~~(T.b*255);Y[0]=ta<0?0:ta>255?255:ta;Y[1]=Ja<0?0:Ja>255?255:Ja;Y[2]=P<0?0:P>255?255:P;Y[4]=pa<0?0:pa>255?255:pa;Y[5]=Q<0?0:Q>255?255:Q;Y[6]=da<0?0:da>255?255:da;Y[8]=Oa<0?0:Oa>255?255:Oa;Y[9]=Ra<0?0:Ra>255?255:Ra;Y[10]=aa<0?0:aa>255?255:aa;Y[12]=db<0?0:db>255?255:db;Y[13]=hb<0?0:hb>255?255:hb;Y[14]=T<0?0:T>255?255:T;I.putImageData(la,
+0,0);sa.drawImage($,0,0);return ua}function Za(P,da,aa){P=(P-da)/(aa-da);return P*P*(3-2*P)}function Ka(P){P=(P+1)*0.5;return P<0?0:P>1?1:P}function Ya(P,da){var aa=da.x-P.x,T=da.y-P.y,ta=1/Math.sqrt(aa*aa+T*T);aa*=ta;T*=ta;da.x+=aa;da.y+=T;P.x-=aa;P.y-=T}var Ua,R,Ba,Na,gb,kb,ab,Ia;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,o);e=f.projectScene(ka,va,this.sortElements);(p=ka.lights.length>0)&&ha(ka);Ua=0;for(R=e.length;Ua<R;Ua++){Ba=e[Ua];x.empty();if(Ba instanceof THREE.RenderableParticle){L=
+Ba;L.x*=m;L.y*=o;Na=0;for(gb=Ba.materials.length;Na<gb;){Ia=Ba.materials[Na++];Ia.opacity!=0&&wa(L,Ba,Ia,ka)}}else if(Ba instanceof THREE.RenderableLine){L=Ba.v1;N=Ba.v2;L.positionScreen.x*=m;L.positionScreen.y*=o;N.positionScreen.x*=m;N.positionScreen.y*=o;x.addPoint(L.positionScreen.x,L.positionScreen.y);x.addPoint(N.positionScreen.x,N.positionScreen.y);if(k.instersects(x)){Na=0;for(gb=Ba.materials.length;Na<gb;){Ia=Ba.materials[Na++];Ia.opacity!=0&&Qa(L,N,Ba,Ia,ka)}}}else if(Ba instanceof THREE.RenderableFace3){L=
+Ba.v1;N=Ba.v2;O=Ba.v3;L.positionScreen.x*=m;L.positionScreen.y*=o;N.positionScreen.x*=m;N.positionScreen.y*=o;O.positionScreen.x*=m;O.positionScreen.y*=o;if(Ba.overdraw){Ya(L.positionScreen,N.positionScreen);Ya(N.positionScreen,O.positionScreen);Ya(O.positionScreen,L.positionScreen)}x.add3Points(L.positionScreen.x,L.positionScreen.y,N.positionScreen.x,N.positionScreen.y,O.positionScreen.x,O.positionScreen.y);if(k.instersects(x)){Na=0;for(gb=Ba.meshMaterials.length;Na<gb;){Ia=Ba.meshMaterials[Na++];
+if(Ia instanceof THREE.MeshFaceMaterial){kb=0;for(ab=Ba.faceMaterials.length;kb<ab;)(Ia=Ba.faceMaterials[kb++])&&Ia.opacity!=0&&Va(L,N,O,0,1,2,Ba,Ia,ka)}else Ia.opacity!=0&&Va(L,N,O,0,1,2,Ba,Ia,ka)}}}else if(Ba instanceof THREE.RenderableFace4){L=Ba.v1;N=Ba.v2;O=Ba.v3;Fa=Ba.v4;L.positionScreen.x*=m;L.positionScreen.y*=o;N.positionScreen.x*=m;N.positionScreen.y*=o;O.positionScreen.x*=m;O.positionScreen.y*=o;Fa.positionScreen.x*=m;Fa.positionScreen.y*=o;oa.positionScreen.copy(N.positionScreen);xa.positionScreen.copy(Fa.positionScreen);
+if(Ba.overdraw){Ya(L.positionScreen,N.positionScreen);Ya(N.positionScreen,Fa.positionScreen);Ya(Fa.positionScreen,L.positionScreen);Ya(O.positionScreen,oa.positionScreen);Ya(O.positionScreen,xa.positionScreen)}x.addPoint(L.positionScreen.x,L.positionScreen.y);x.addPoint(N.positionScreen.x,N.positionScreen.y);x.addPoint(O.positionScreen.x,O.positionScreen.y);x.addPoint(Fa.positionScreen.x,Fa.positionScreen.y);if(k.instersects(x)){Na=0;for(gb=Ba.meshMaterials.length;Na<gb;){Ia=Ba.meshMaterials[Na++];
+if(Ia instanceof THREE.MeshFaceMaterial){kb=0;for(ab=Ba.faceMaterials.length;kb<ab;)(Ia=Ba.faceMaterials[kb++])&&Ia.opacity!=0&&eb(L,N,O,Fa,oa,xa,Ba,Ia,ka)}else Ia.opacity!=0&&eb(L,N,O,Fa,oa,xa,Ba,Ia,ka)}}}B.addRectangle(x)}n.setTransform(1,0,0,1,0,0)}};
+THREE.SVGRenderer=function(){function a(ra,X,qa){var za,ea,U,ma;za=0;for(ea=ra.lights.length;za<ea;za++){U=ra.lights[za];if(U instanceof THREE.DirectionalLight){ma=X.normalWorld.dot(U.position)*U.intensity;if(ma>0){qa.r+=U.color.r*ma;qa.g+=U.color.g*ma;qa.b+=U.color.b*ma}}else if(U instanceof THREE.PointLight){xa.sub(U.position,X.centroidWorld);xa.normalize();ma=X.normalWorld.dot(xa)*U.intensity;if(ma>0){qa.r+=U.color.r*ma;qa.g+=U.color.g*ma;qa.b+=U.color.b*ma}}}}function c(ra,X,qa,za,ea,U){Z=e(ya++);
+Z.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+X.positionScreen.x+" "+X.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+"z");if(ea instanceof THREE.MeshBasicMaterial)D.__styleString=ea.color.__styleString;else if(ea instanceof THREE.MeshLambertMaterial)if(S){L.r=N.r;L.g=N.g;L.b=N.b;a(U,za,L);D.r=ea.color.r*L.r;D.g=ea.color.g*L.g;D.b=ea.color.b*L.b;D.updateStyleString()}else D.__styleString=ea.color.__styleString;else if(ea instanceof THREE.MeshDepthMaterial){oa=
+1-ea.__2near/(ea.__farPlusNear-za.z*ea.__farMinusNear);D.setRGB(oa,oa,oa)}else ea instanceof THREE.MeshNormalMaterial&&D.setRGB(f(za.normalWorld.x),f(za.normalWorld.y),f(za.normalWorld.z));ea.wireframe?Z.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+ea.wireframeLinewidth+"; stroke-opacity: "+ea.opacity+"; stroke-linecap: "+ea.wireframeLinecap+"; stroke-linejoin: "+ea.wireframeLinejoin):Z.setAttribute("style","fill: "+D.__styleString+"; fill-opacity: "+ea.opacity);
+j.appendChild(Z)}function b(ra,X,qa,za,ea,U,ma){Z=e(ya++);Z.setAttribute("d","M "+ra.positionScreen.x+" "+ra.positionScreen.y+" L "+X.positionScreen.x+" "+X.positionScreen.y+" L "+qa.positionScreen.x+","+qa.positionScreen.y+" L "+za.positionScreen.x+","+za.positionScreen.y+"z");if(U instanceof THREE.MeshBasicMaterial)D.__styleString=U.color.__styleString;else if(U instanceof THREE.MeshLambertMaterial)if(S){L.r=N.r;L.g=N.g;L.b=N.b;a(ma,ea,L);D.r=U.color.r*L.r;D.g=U.color.g*L.g;D.b=U.color.b*L.b;D.updateStyleString()}else D.__styleString=
+U.color.__styleString;else if(U instanceof THREE.MeshDepthMaterial){oa=1-U.__2near/(U.__farPlusNear-ea.z*U.__farMinusNear);D.setRGB(oa,oa,oa)}else U instanceof THREE.MeshNormalMaterial&&D.setRGB(f(ea.normalWorld.x),f(ea.normalWorld.y),f(ea.normalWorld.z));U.wireframe?Z.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+U.wireframeLinewidth+"; stroke-opacity: "+U.opacity+"; stroke-linecap: "+U.wireframeLinecap+"; stroke-linejoin: "+U.wireframeLinejoin):Z.setAttribute("style",
+"fill: "+D.__styleString+"; fill-opacity: "+U.opacity);j.appendChild(Z)}function e(ra){if(W[ra]==null){W[ra]=document.createElementNS("http://www.w3.org/2000/svg","path");Ha==0&&W[ra].setAttribute("shape-rendering","crispEdges")}return W[ra]}function f(ra){return ra<0?Math.min((1+ra)*0.5,0.5):0.5+Math.min(ra*0.5,0.5)}var g=null,h=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,o,n,t,y,w,z,E,G=new THREE.Rectangle,J=new THREE.Rectangle,S=!1,D=new THREE.Color(16777215),
+L=new THREE.Color(16777215),N=new THREE.Color(0),O=new THREE.Color(0),Fa=new THREE.Color(0),oa,xa=new THREE.Vector3,W=[],d=[],Z,ya,Ga,Ha=1;this.domElement=j;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ra){switch(ra){case "high":Ha=1;break;case "low":Ha=0}};this.setSize=function(ra,X){m=ra;o=X;n=m/2;t=o/2;j.setAttribute("viewBox",-n+" "+-t+" "+m+" "+o);j.setAttribute("width",m);j.setAttribute("height",o);G.set(-n,-t,n,t)};this.clear=function(){for(;j.childNodes.length>
+0;)j.removeChild(j.childNodes[0])};this.render=function(ra,X){var qa,za,ea,U,ma,Ca,fa,ja;this.autoClear&&this.clear();g=h.projectScene(ra,X,this.sortElements);Ga=ya=0;if(S=ra.lights.length>0){fa=ra.lights;N.setRGB(0,0,0);O.setRGB(0,0,0);Fa.setRGB(0,0,0);qa=0;for(za=fa.length;qa<za;qa++){ea=fa[qa];U=ea.color;if(ea instanceof THREE.AmbientLight){N.r+=U.r;N.g+=U.g;N.b+=U.b}else if(ea instanceof THREE.DirectionalLight){O.r+=U.r;O.g+=U.g;O.b+=U.b}else if(ea instanceof THREE.PointLight){Fa.r+=U.r;Fa.g+=
+U.g;Fa.b+=U.b}}}qa=0;for(za=g.length;qa<za;qa++){fa=g[qa];J.empty();if(fa instanceof THREE.RenderableParticle){y=fa;y.x*=n;y.y*=-t;ea=0;for(U=fa.materials.length;ea<U;)ea++}else if(fa instanceof THREE.RenderableLine){y=fa.v1;w=fa.v2;y.positionScreen.x*=n;y.positionScreen.y*=-t;w.positionScreen.x*=n;w.positionScreen.y*=-t;J.addPoint(y.positionScreen.x,y.positionScreen.y);J.addPoint(w.positionScreen.x,w.positionScreen.y);if(G.instersects(J)){ea=0;for(U=fa.materials.length;ea<U;)if((ja=fa.materials[ea++])&&
+ja.opacity!=0){ma=y;Ca=w;var Da=Ga++;if(d[Da]==null){d[Da]=document.createElementNS("http://www.w3.org/2000/svg","line");Ha==0&&d[Da].setAttribute("shape-rendering","crispEdges")}Z=d[Da];Z.setAttribute("x1",ma.positionScreen.x);Z.setAttribute("y1",ma.positionScreen.y);Z.setAttribute("x2",Ca.positionScreen.x);Z.setAttribute("y2",Ca.positionScreen.y);if(ja instanceof THREE.LineBasicMaterial){D.__styleString=ja.color.__styleString;Z.setAttribute("style","fill: none; stroke: "+D.__styleString+"; stroke-width: "+
+ja.linewidth+"; stroke-opacity: "+ja.opacity+"; stroke-linecap: "+ja.linecap+"; stroke-linejoin: "+ja.linejoin);j.appendChild(Z)}}}}else if(fa instanceof THREE.RenderableFace3){y=fa.v1;w=fa.v2;z=fa.v3;y.positionScreen.x*=n;y.positionScreen.y*=-t;w.positionScreen.x*=n;w.positionScreen.y*=-t;z.positionScreen.x*=n;z.positionScreen.y*=-t;J.addPoint(y.positionScreen.x,y.positionScreen.y);J.addPoint(w.positionScreen.x,w.positionScreen.y);J.addPoint(z.positionScreen.x,z.positionScreen.y);if(G.instersects(J)){ea=
+0;for(U=fa.meshMaterials.length;ea<U;){ja=fa.meshMaterials[ea++];if(ja instanceof THREE.MeshFaceMaterial){ma=0;for(Ca=fa.faceMaterials.length;ma<Ca;)(ja=fa.faceMaterials[ma++])&&ja.opacity!=0&&c(y,w,z,fa,ja,ra)}else ja&&ja.opacity!=0&&c(y,w,z,fa,ja,ra)}}}else if(fa instanceof THREE.RenderableFace4){y=fa.v1;w=fa.v2;z=fa.v3;E=fa.v4;y.positionScreen.x*=n;y.positionScreen.y*=-t;w.positionScreen.x*=n;w.positionScreen.y*=-t;z.positionScreen.x*=n;z.positionScreen.y*=-t;E.positionScreen.x*=n;E.positionScreen.y*=
+-t;J.addPoint(y.positionScreen.x,y.positionScreen.y);J.addPoint(w.positionScreen.x,w.positionScreen.y);J.addPoint(z.positionScreen.x,z.positionScreen.y);J.addPoint(E.positionScreen.x,E.positionScreen.y);if(G.instersects(J)){ea=0;for(U=fa.meshMaterials.length;ea<U;){ja=fa.meshMaterials[ea++];if(ja instanceof THREE.MeshFaceMaterial){ma=0;for(Ca=fa.faceMaterials.length;ma<Ca;)(ja=fa.faceMaterials[ma++])&&ja.opacity!=0&&b(y,w,z,E,fa,ja,ra)}else ja&&ja.opacity!=0&&b(y,w,z,E,fa,ja,ra)}}}}}};
 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",
@@ -215,7 +218,8 @@ 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:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",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={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}",
+THREE.ShaderLib={lensFlare:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nattribute \tvec2 \tposition;\nattribute  vec2\tUV;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nuniform    int         renderPink;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nif( renderPink == 1 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );\n} else {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity;\ngl_FragColor = color;\n}\n}"},
+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\nuniform \tfloat \tdarkness;\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, darkness );\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,
@@ -227,110 +231,121 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 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(h,t,w){var p,C,H,K=h.vertices,E=K.length,A=h.colors,aa=A.length,J=h.__vertexArray,Y=h.__colorArray,ha=h.__sortArray,ra=h.__dirtyVertices,ja=h.__dirtyColors;if(w.sortParticles){da.multiplySelf(w.matrixWorld);for(p=0;p<E;p++){C=K[p].position;ga.copy(C);da.multiplyVector3(ga);ha[p]=[ga.z,p]}ha.sort(function(Ha,ya){return ya[0]-Ha[0]});for(p=0;p<E;p++){C=K[ha[p][1]].position;H=p*3;J[H]=C.x;J[H+1]=C.y;J[H+2]=C.z}for(p=0;p<aa;p++){H=p*3;color=A[ha[p][1]];Y[H]=
-color.r;Y[H+1]=color.g;Y[H+2]=color.b}}else{if(ra)for(p=0;p<E;p++){C=K[p].position;H=p*3;J[H]=C.x;J[H+1]=C.y;J[H+2]=C.z}if(ja)for(p=0;p<aa;p++){color=A[p];H=p*3;Y[H]=color.r;Y[H+1]=color.g;Y[H+2]=color.b}}if(ra||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,J,t)}if(ja||w.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,Y,t)}}function b(h,t){h.uniforms=Uniforms.clone(t.uniforms);h.vertexShader=t.vertexShader;
-h.fragmentShader=t.fragmentShader}function d(h,t,w,p,C){p.__webglProgram||X.initMaterial(p,t,w,C);var H=p.program,K=H.uniforms,E=p.uniforms;if(H!=V){e.useProgram(H);V=H}e.uniformMatrix4fv(K.projectionMatrix,!1,ua);if(w&&(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial||p instanceof THREE.LineBasicMaterial||p 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(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p.lights){var A,aa,J=0,Y=0,ha=0,ra,ja,Ha,ya,Ba=xa,W=Ba.directional.colors,ea=Ba.directional.positions,na=Ba.point.colors,Ia=Ba.point.positions,za=Ba.point.distances,Va=0,Qa=0;w=aa=ya=0;for(A=t.length;w<A;w++){aa=t[w];ra=aa.color;ja=aa.position;Ha=aa.intensity;ya=aa.distance;if(aa instanceof THREE.AmbientLight){J+=ra.r;Y+=ra.g;ha+=ra.b}else if(aa instanceof
-THREE.DirectionalLight){ya=Va*3;W[ya]=ra.r*Ha;W[ya+1]=ra.g*Ha;W[ya+2]=ra.b*Ha;ea[ya]=ja.x;ea[ya+1]=ja.y;ea[ya+2]=ja.z;Va+=1}else if(aa instanceof THREE.PointLight){aa=Qa*3;na[aa]=ra.r*Ha;na[aa+1]=ra.g*Ha;na[aa+2]=ra.b*Ha;Ia[aa]=ja.x;Ia[aa+1]=ja.y;Ia[aa+2]=ja.z;za[Qa]=ya;Qa+=1}}for(w=Va*3;w<W.length;w++)W[w]=0;for(w=Qa*3;w<na.length;w++)na[w]=0;Ba.point.length=Qa;Ba.directional.length=Va;Ba.ambient[0]=J;Ba.ambient[1]=Y;Ba.ambient[2]=ha;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;E.pointLightDistance.value=w.point.distances}if(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial){E.diffuse.value.setRGB(p.color.r,p.color.g,p.color.b);E.opacity.value=p.opacity;E.map.texture=p.map;E.lightMap.texture=
-p.lightMap;E.envMap.texture=p.envMap;E.reflectivity.value=p.reflectivity;E.refractionRatio.value=p.refractionRatio;E.combine.value=p.combine;E.useRefract.value=p.envMap&&p.envMap.mapping instanceof THREE.CubeRefractionMapping}if(p instanceof THREE.LineBasicMaterial){E.diffuse.value.setRGB(p.color.r,p.color.g,p.color.b);E.opacity.value=p.opacity}else if(p instanceof THREE.ParticleBasicMaterial){E.psColor.value.setRGB(p.color.r,p.color.g,p.color.b);E.opacity.value=p.opacity;E.size.value=p.size;E.scale.value=
-la.height/2;E.map.texture=p.map}else if(p instanceof THREE.MeshPhongMaterial){E.ambient.value.setRGB(p.ambient.r,p.ambient.g,p.ambient.b);E.specular.value.setRGB(p.specular.r,p.specular.g,p.specular.b);E.shininess.value=p.shininess}else if(p instanceof THREE.MeshDepthMaterial){E.mNear.value=h.near;E.mFar.value=h.far;E.opacity.value=p.opacity}else if(p instanceof THREE.MeshNormalMaterial)E.opacity.value=p.opacity;for(var Da in E)if(Y=H.uniforms[Da]){A=E[Da];J=A.type;w=A.value;if(J=="i")e.uniform1i(Y,
-w);else if(J=="f")e.uniform1f(Y,w);else if(J=="fv1")e.uniform1fv(Y,w);else if(J=="fv")e.uniform3fv(Y,w);else if(J=="v2")e.uniform2f(Y,w.x,w.y);else if(J=="v3")e.uniform3f(Y,w.x,w.y,w.z);else if(J=="c")e.uniform3f(Y,w.r,w.g,w.b);else if(J=="t"){e.uniform1i(Y,w);if(A=A.texture)if(A.image instanceof Array&&A.image.length==6){if(A.image.length==6){if(A.needsUpdate){if(A.__webglInit){e.bindTexture(e.TEXTURE_CUBE_MAP,A.image.__webglTextureCube);for(J=0;J<6;++J)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+
-J,0,0,0,e.RGBA,e.UNSIGNED_BYTE,A.image[J])}else{A.image.__webglTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,A.image.__webglTextureCube);for(J=0;J<6;++J)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+J,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,A.image[J]);A.__webglInit=!0}D(e.TEXTURE_CUBE_MAP,A,A.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);A.needsUpdate=!1}e.activeTexture(e.TEXTURE0+w);e.bindTexture(e.TEXTURE_CUBE_MAP,A.image.__webglTextureCube)}}else{if(A.needsUpdate){if(A.__webglInit){e.bindTexture(e.TEXTURE_2D,
-A.__webglTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,A.image)}else{A.__webglTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,A.__webglTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,A.image);A.__webglInit=!0}D(e.TEXTURE_2D,A,A.image);e.bindTexture(e.TEXTURE_2D,null);A.needsUpdate=!1}e.activeTexture(e.TEXTURE0+w);e.bindTexture(e.TEXTURE_2D,A.__webglTexture)}}}e.uniformMatrix4fv(K.modelViewMatrix,!1,C._modelViewMatrixArray);e.uniformMatrix3fv(K.normalMatrix,
-!1,C._normalMatrixArray);(p instanceof THREE.MeshShaderMaterial||p instanceof THREE.MeshPhongMaterial||p.envMap)&&e.uniform3f(K.cameraPosition,h.position.x,h.position.y,h.position.z);(p instanceof THREE.MeshShaderMaterial||p.envMap||p.skinning)&&e.uniformMatrix4fv(K.objectMatrix,!1,C._objectMatrixArray);(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshShaderMaterial||p.skinning)&&e.uniformMatrix4fv(K.viewMatrix,!1,ca);if(p instanceof THREE.ShadowVolumeDynamicMaterial){h=
-E.directionalLightDirection.value;h[0]=-t.position.x;h[1]=-t.position.y;h[2]=-t.position.z;e.uniform3fv(K.directionalLightDirection,h);e.uniformMatrix4fv(K.objectMatrix,!1,C._objectMatrixArray);e.uniformMatrix4fv(K.viewMatrix,!1,ca)}if(p.skinning){e.uniformMatrix4fv(K.cameraInverseMatrix,!1,ca);e.uniformMatrix4fv(K.boneGlobalMatrices,!1,C.boneMatrices)}return H}function f(h,t,w,p,C,H){if(p.opacity!=0){h=d(h,t,w,p,H).attributes;if(p.morphTargets){t=p.program.attributes;H.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,
-C.__webglMorphTargetsBuffers[H.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,C.__webglVertexBuffer);e.vertexAttribPointer(t.position,3,e.FLOAT,!1,0,0);if(H.morphTargetForcedOrder.length){w=0;for(var K=H.morphTargetForcedOrder,E=H.morphTargetInfluences;w<p.numSupportedMorphTargets&&w<K.length;){e.bindBuffer(e.ARRAY_BUFFER,C.__webglMorphTargetsBuffers[K[w]]);e.vertexAttribPointer(t["morphTarget"+w],3,e.FLOAT,!1,0,0);H.__webglMorphTargetInfluences[w]=E[K[w]];w++}}else{K=[];var A=-1,aa=0;E=H.morphTargetInfluences;
-var J,Y=E.length;w=0;for(H.morphTargetBase!==-1&&(K[H.morphTargetBase]=!0);w<p.numSupportedMorphTargets;){for(J=0;J<Y;J++)if(!K[J]&&E[J]>A){aa=J;A=E[aa]}e.bindBuffer(e.ARRAY_BUFFER,C.__webglMorphTargetsBuffers[aa]);e.vertexAttribPointer(t["morphTarget"+w],3,e.FLOAT,!1,0,0);H.__webglMorphTargetInfluences[w]=A;K[aa]=1;A=-1;w++}}e.uniform1fv(p.program.uniforms.morphTargetInfluences,H.__webglMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,C.__webglVertexBuffer);e.vertexAttribPointer(h.position,
-3,e.FLOAT,!1,0,0)}if(h.color>=0){e.bindBuffer(e.ARRAY_BUFFER,C.__webglColorBuffer);e.vertexAttribPointer(h.color,3,e.FLOAT,!1,0,0)}if(h.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,C.__webglNormalBuffer);e.vertexAttribPointer(h.normal,3,e.FLOAT,!1,0,0)}if(h.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,C.__webglTangentBuffer);e.vertexAttribPointer(h.tangent,4,e.FLOAT,!1,0,0)}if(h.uv>=0)if(C.__webglUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,C.__webglUVBuffer);e.vertexAttribPointer(h.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(h.uv)}else e.disableVertexAttribArray(h.uv);
-if(h.uv2>=0)if(C.__webglUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,C.__webglUV2Buffer);e.vertexAttribPointer(h.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(h.uv2)}else e.disableVertexAttribArray(h.uv2);if(p.skinning&&h.skinVertexA>=0&&h.skinVertexB>=0&&h.skinIndex>=0&&h.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,C.__webglSkinVertexABuffer);e.vertexAttribPointer(h.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,C.__webglSkinVertexBBuffer);e.vertexAttribPointer(h.skinVertexB,4,e.FLOAT,!1,0,
-0);e.bindBuffer(e.ARRAY_BUFFER,C.__webglSkinIndicesBuffer);e.vertexAttribPointer(h.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,C.__webglSkinWeightsBuffer);e.vertexAttribPointer(h.skinWeight,4,e.FLOAT,!1,0,0)}if(H instanceof THREE.Mesh)if(p.wireframe){e.lineWidth(p.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,C.__webglLineBuffer);e.drawElements(e.LINES,C.__webglLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,C.__webglFaceBuffer);e.drawElements(e.TRIANGLES,
-C.__webglFaceCount,e.UNSIGNED_SHORT,0)}else if(H instanceof THREE.Line){H=H.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(p.linewidth);e.drawArrays(H,0,C.__webglLineCount)}else if(H instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,C.__webglParticleCount);else H instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,C.__webglVertexCount)}}function g(h,t){if(!h.__webglVertexBuffer)h.__webglVertexBuffer=e.createBuffer();if(!h.__webglNormalBuffer)h.__webglNormalBuffer=e.createBuffer();
-if(h.hasPos){e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,h.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(t.attributes.position);e.vertexAttribPointer(t.attributes.position,3,e.FLOAT,!1,0,0)}if(h.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,h.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,h.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(t.attributes.normal);e.vertexAttribPointer(t.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,h.count);
-h.count=0}function j(h){if(sa!=h.doubleSided){h.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);sa=h.doubleSided}if(va!=h.flipSided){h.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);va=h.flipSided}}function k(h){if(ia!=h){h?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ia=h}}function m(h){S[0].set(h.n41-h.n11,h.n42-h.n12,h.n43-h.n13,h.n44-h.n14);S[1].set(h.n41+h.n11,h.n42+h.n12,h.n43+h.n13,h.n44+h.n14);S[2].set(h.n41+h.n21,h.n42+h.n22,h.n43+h.n23,h.n44+h.n24);S[3].set(h.n41-h.n21,h.n42-
-h.n22,h.n43-h.n23,h.n44-h.n24);S[4].set(h.n41-h.n31,h.n42-h.n32,h.n43-h.n33,h.n44-h.n34);S[5].set(h.n41+h.n31,h.n42+h.n32,h.n43+h.n33,h.n44+h.n34);var t;for(h=0;h<6;h++){t=S[h];t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))}}function o(h){for(var t=h.matrixWorld,w=-h.geometry.boundingSphere.radius*Math.max(h.scale.x,Math.max(h.scale.y,h.scale.z)),p=0;p<6;p++){h=S[p].x*t.n14+S[p].y*t.n24+S[p].z*t.n34+S[p].w;if(h<=w)return!1}return!0}function n(h,t){h.list[h.count]=t;h.count+=1}function x(h){var t,
-w,p=h.object,C=h.opaque,H=h.transparent;H.count=0;h=C.count=0;for(t=p.materials.length;h<t;h++){w=p.materials[h];w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?n(H,w):n(C,w)}}function z(h){var t,w,p,C,H=h.object,K=h.buffer,E=h.opaque,A=h.transparent;A.count=0;h=E.count=0;for(p=H.materials.length;h<p;h++){t=H.materials[h];if(t instanceof THREE.MeshFaceMaterial){t=0;for(w=K.materials.length;t<w;t++)(C=K.materials[t])&&(C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?n(A,C):n(E,C))}else{C=
-t;C.opacity&&C.opacity<1||C.blending!=THREE.NormalBlending?n(A,C):n(E,C)}}}function y(h,t){return t.z-h.z}function B(h,t){h._modelViewMatrix.multiplyToArray(t.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(h._modelViewMatrix).transposeIntoArray(h._normalMatrixArray)}function F(h){var t,w,p;if(h instanceof THREE.Mesh){w=h.geometry;for(t in w.geometryGroups){p=w.geometryGroups[t];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||
-w.__dirtyColors||w.__dirtyTangents){var C=e.DYNAMIC_DRAW,H=void 0,K=void 0,E=void 0,A=void 0;E=void 0;var aa=void 0,J=void 0,Y=void 0,ha=void 0,ra=void 0,ja=void 0,Ha=void 0,ya=void 0,Ba=void 0,W=void 0,ea=void 0,na=void 0,Ia=void 0;J=void 0;Y=void 0;A=void 0;ha=void 0;A=void 0;W=void 0;ea=void 0;J=void 0;W=void 0;ea=void 0;na=void 0;Ia=void 0;W=void 0;ea=void 0;na=void 0;Ia=void 0;W=void 0;ea=void 0;na=void 0;Ia=void 0;W=void 0;ea=void 0;na=void 0;A=void 0;ha=void 0;aa=void 0;E=void 0;E=void 0;var za=
-void 0,Va=void 0,Qa=void 0,Da=0,Ta=0,kb=0,fb=0,$a=0,Za=0,La=0,Ua=0,Oa=0,O=0,Sa=0,Ra=p.__vertexArray,gb=p.__uvArray,db=p.__uv2Array,ab=p.__normalArray,Pa=p.__tangentArray,ta=p.__colorArray,Ea=p.__skinVertexAArray,Ga=p.__skinVertexBArray,Ja=p.__skinIndexArray,Ma=p.__skinWeightArray,Wa=p.__morphTargetsArrays,P=p.__faceArray,ka=p.__lineArray,oa=p.__needsSmoothNormals;ja=p.__vertexColorType;ra=p.__uvType;Ha=p.__normalType;var U=h.geometry,Fa=U.__dirtyVertices,Ca=U.__dirtyElements,pa=U.__dirtyUvs,Q=U.__dirtyNormals,
-Na=U.__dirtyTangents,eb=U.__dirtyColors,cb=U.__dirtyMorphTargets,bb=U.vertices,mb=p.faces,hb=U.faces,ib=U.faceVertexUvs[0],rb=U.faceVertexUvs[1],ob=U.skinVerticesA,pb=U.skinVerticesB,qb=U.skinIndices,lb=U.skinWeights,nb=U.edgeFaces,jb=U.morphTargets;H=0;for(K=mb.length;H<K;H++){E=mb[H];A=hb[E];ib&&(ya=ib[E]);rb&&(Ba=rb[E]);E=A.vertexNormals;aa=A.normal;J=A.vertexColors;Y=A.color;ha=A.vertexTangents;if(A instanceof THREE.Face3){if(Fa){W=bb[A.a].position;ea=bb[A.b].position;na=bb[A.c].position;Ra[Ta]=
-W.x;Ra[Ta+1]=W.y;Ra[Ta+2]=W.z;Ra[Ta+3]=ea.x;Ra[Ta+4]=ea.y;Ra[Ta+5]=ea.z;Ra[Ta+6]=na.x;Ra[Ta+7]=na.y;Ra[Ta+8]=na.z;Ta+=9}if(cb){za=0;for(Va=jb.length;za<Va;za++){W=jb[za].vertices[A.a].position;ea=jb[za].vertices[A.b].position;na=jb[za].vertices[A.c].position;Qa=Wa[za];Qa[Sa+0]=W.x;Qa[Sa+1]=W.y;Qa[Sa+2]=W.z;Qa[Sa+3]=ea.x;Qa[Sa+4]=ea.y;Qa[Sa+5]=ea.z;Qa[Sa+6]=na.x;Qa[Sa+7]=na.y;Qa[Sa+8]=na.z}Sa+=9}if(lb.length){W=lb[A.a];ea=lb[A.b];na=lb[A.c];Ma[O]=W.x;Ma[O+1]=W.y;Ma[O+2]=W.z;Ma[O+3]=W.w;Ma[O+4]=ea.x;
-Ma[O+5]=ea.y;Ma[O+6]=ea.z;Ma[O+7]=ea.w;Ma[O+8]=na.x;Ma[O+9]=na.y;Ma[O+10]=na.z;Ma[O+11]=na.w;W=qb[A.a];ea=qb[A.b];na=qb[A.c];Ja[O]=W.x;Ja[O+1]=W.y;Ja[O+2]=W.z;Ja[O+3]=W.w;Ja[O+4]=ea.x;Ja[O+5]=ea.y;Ja[O+6]=ea.z;Ja[O+7]=ea.w;Ja[O+8]=na.x;Ja[O+9]=na.y;Ja[O+10]=na.z;Ja[O+11]=na.w;W=ob[A.a];ea=ob[A.b];na=ob[A.c];Ea[O]=W.x;Ea[O+1]=W.y;Ea[O+2]=W.z;Ea[O+3]=1;Ea[O+4]=ea.x;Ea[O+5]=ea.y;Ea[O+6]=ea.z;Ea[O+7]=1;Ea[O+8]=na.x;Ea[O+9]=na.y;Ea[O+10]=na.z;Ea[O+11]=1;W=pb[A.a];ea=pb[A.b];na=pb[A.c];Ga[O]=W.x;Ga[O+1]=
-W.y;Ga[O+2]=W.z;Ga[O+3]=1;Ga[O+4]=ea.x;Ga[O+5]=ea.y;Ga[O+6]=ea.z;Ga[O+7]=1;Ga[O+8]=na.x;Ga[O+9]=na.y;Ga[O+10]=na.z;Ga[O+11]=1;O+=12}if(eb&&ja){if(J.length==3&&ja==THREE.VertexColors){A=J[0];W=J[1];ea=J[2]}else ea=W=A=Y;ta[Oa]=A.r;ta[Oa+1]=A.g;ta[Oa+2]=A.b;ta[Oa+3]=W.r;ta[Oa+4]=W.g;ta[Oa+5]=W.b;ta[Oa+6]=ea.r;ta[Oa+7]=ea.g;ta[Oa+8]=ea.b;Oa+=9}if(Na&&U.hasTangents){J=ha[0];Y=ha[1];A=ha[2];Pa[La]=J.x;Pa[La+1]=J.y;Pa[La+2]=J.z;Pa[La+3]=J.w;Pa[La+4]=Y.x;Pa[La+5]=Y.y;Pa[La+6]=Y.z;Pa[La+7]=Y.w;Pa[La+8]=A.x;
-Pa[La+9]=A.y;Pa[La+10]=A.z;Pa[La+11]=A.w;La+=12}if(Q&&Ha)if(E.length==3&&oa)for(ha=0;ha<3;ha++){aa=E[ha];ab[Za]=aa.x;ab[Za+1]=aa.y;ab[Za+2]=aa.z;Za+=3}else for(ha=0;ha<3;ha++){ab[Za]=aa.x;ab[Za+1]=aa.y;ab[Za+2]=aa.z;Za+=3}if(pa&&ya!==undefined&&ra)for(ha=0;ha<3;ha++){E=ya[ha];gb[kb]=E.u;gb[kb+1]=E.v;kb+=2}if(pa&&Ba!==undefined&&ra)for(ha=0;ha<3;ha++){E=Ba[ha];db[fb]=E.u;db[fb+1]=E.v;fb+=2}if(Ca){P[$a]=Da;P[$a+1]=Da+1;P[$a+2]=Da+2;$a+=3;ka[Ua]=Da;ka[Ua+1]=Da+1;ka[Ua+2]=Da;ka[Ua+3]=Da+2;ka[Ua+4]=Da+
-1;ka[Ua+5]=Da+2;Ua+=6;Da+=3}}else if(A instanceof THREE.Face4){if(Fa){W=bb[A.a].position;ea=bb[A.b].position;na=bb[A.c].position;Ia=bb[A.d].position;Ra[Ta]=W.x;Ra[Ta+1]=W.y;Ra[Ta+2]=W.z;Ra[Ta+3]=ea.x;Ra[Ta+4]=ea.y;Ra[Ta+5]=ea.z;Ra[Ta+6]=na.x;Ra[Ta+7]=na.y;Ra[Ta+8]=na.z;Ra[Ta+9]=Ia.x;Ra[Ta+10]=Ia.y;Ra[Ta+11]=Ia.z;Ta+=12}if(cb){za=0;for(Va=jb.length;za<Va;za++){W=jb[za].vertices[A.a].position;ea=jb[za].vertices[A.b].position;na=jb[za].vertices[A.c].position;Ia=jb[za].vertices[A.d].position;Qa=Wa[za];
-Qa[Sa+0]=W.x;Qa[Sa+1]=W.y;Qa[Sa+2]=W.z;Qa[Sa+3]=ea.x;Qa[Sa+4]=ea.y;Qa[Sa+5]=ea.z;Qa[Sa+6]=na.x;Qa[Sa+7]=na.y;Qa[Sa+8]=na.z;Qa[Sa+9]=Ia.x;Qa[Sa+10]=Ia.y;Qa[Sa+11]=Ia.z}Sa+=12}if(lb.length){W=lb[A.a];ea=lb[A.b];na=lb[A.c];Ia=lb[A.d];Ma[O]=W.x;Ma[O+1]=W.y;Ma[O+2]=W.z;Ma[O+3]=W.w;Ma[O+4]=ea.x;Ma[O+5]=ea.y;Ma[O+6]=ea.z;Ma[O+7]=ea.w;Ma[O+8]=na.x;Ma[O+9]=na.y;Ma[O+10]=na.z;Ma[O+11]=na.w;Ma[O+12]=Ia.x;Ma[O+13]=Ia.y;Ma[O+14]=Ia.z;Ma[O+15]=Ia.w;W=qb[A.a];ea=qb[A.b];na=qb[A.c];Ia=qb[A.d];Ja[O]=W.x;Ja[O+1]=W.y;
-Ja[O+2]=W.z;Ja[O+3]=W.w;Ja[O+4]=ea.x;Ja[O+5]=ea.y;Ja[O+6]=ea.z;Ja[O+7]=ea.w;Ja[O+8]=na.x;Ja[O+9]=na.y;Ja[O+10]=na.z;Ja[O+11]=na.w;Ja[O+12]=Ia.x;Ja[O+13]=Ia.y;Ja[O+14]=Ia.z;Ja[O+15]=Ia.w;W=ob[A.a];ea=ob[A.b];na=ob[A.c];Ia=ob[A.d];Ea[O]=W.x;Ea[O+1]=W.y;Ea[O+2]=W.z;Ea[O+3]=1;Ea[O+4]=ea.x;Ea[O+5]=ea.y;Ea[O+6]=ea.z;Ea[O+7]=1;Ea[O+8]=na.x;Ea[O+9]=na.y;Ea[O+10]=na.z;Ea[O+11]=1;Ea[O+12]=Ia.x;Ea[O+13]=Ia.y;Ea[O+14]=Ia.z;Ea[O+15]=1;W=pb[A.a];ea=pb[A.b];na=pb[A.c];A=pb[A.d];Ga[O]=W.x;Ga[O+1]=W.y;Ga[O+2]=W.z;
-Ga[O+3]=1;Ga[O+4]=ea.x;Ga[O+5]=ea.y;Ga[O+6]=ea.z;Ga[O+7]=1;Ga[O+8]=na.x;Ga[O+9]=na.y;Ga[O+10]=na.z;Ga[O+11]=1;Ga[O+12]=A.x;Ga[O+13]=A.y;Ga[O+14]=A.z;Ga[O+15]=1;O+=16}if(eb&&ja){if(J.length==4&&ja==THREE.VertexColors){A=J[0];W=J[1];ea=J[2];J=J[3]}else J=ea=W=A=Y;ta[Oa]=A.r;ta[Oa+1]=A.g;ta[Oa+2]=A.b;ta[Oa+3]=W.r;ta[Oa+4]=W.g;ta[Oa+5]=W.b;ta[Oa+6]=ea.r;ta[Oa+7]=ea.g;ta[Oa+8]=ea.b;ta[Oa+9]=J.r;ta[Oa+10]=J.g;ta[Oa+11]=J.b;Oa+=12}if(Na&&U.hasTangents){J=ha[0];Y=ha[1];A=ha[2];ha=ha[3];Pa[La]=J.x;Pa[La+1]=
-J.y;Pa[La+2]=J.z;Pa[La+3]=J.w;Pa[La+4]=Y.x;Pa[La+5]=Y.y;Pa[La+6]=Y.z;Pa[La+7]=Y.w;Pa[La+8]=A.x;Pa[La+9]=A.y;Pa[La+10]=A.z;Pa[La+11]=A.w;Pa[La+12]=ha.x;Pa[La+13]=ha.y;Pa[La+14]=ha.z;Pa[La+15]=ha.w;La+=16}if(Q&&Ha)if(E.length==4&&oa)for(ha=0;ha<4;ha++){aa=E[ha];ab[Za]=aa.x;ab[Za+1]=aa.y;ab[Za+2]=aa.z;Za+=3}else for(ha=0;ha<4;ha++){ab[Za]=aa.x;ab[Za+1]=aa.y;ab[Za+2]=aa.z;Za+=3}if(pa&&ya!==undefined&&ra)for(ha=0;ha<4;ha++){E=ya[ha];gb[kb]=E.u;gb[kb+1]=E.v;kb+=2}if(pa&&Ba!==undefined&&ra)for(ha=0;ha<4;ha++){E=
-Ba[ha];db[fb]=E.u;db[fb+1]=E.v;fb+=2}if(Ca){P[$a]=Da;P[$a+1]=Da+1;P[$a+2]=Da+3;P[$a+3]=Da+1;P[$a+4]=Da+2;P[$a+5]=Da+3;$a+=6;ka[Ua]=Da;ka[Ua+1]=Da+1;ka[Ua+2]=Da;ka[Ua+3]=Da+3;ka[Ua+4]=Da+1;ka[Ua+5]=Da+2;ka[Ua+6]=Da+2;ka[Ua+7]=Da+3;Ua+=8;Da+=4}}}if(nb){H=0;for(K=nb.length;H<K;H++){P[$a]=nb[H].a;P[$a+1]=nb[H].b;P[$a+2]=nb[H].c;P[$a+3]=nb[H].a;P[$a+4]=nb[H].c;P[$a+5]=nb[H].d;$a+=6}}if(Fa){e.bindBuffer(e.ARRAY_BUFFER,p.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ra,C)}if(cb){za=0;for(Va=jb.length;za<
-Va;za++){e.bindBuffer(e.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[za]);e.bufferData(e.ARRAY_BUFFER,Wa[za],C)}}if(eb&&Oa>0){e.bindBuffer(e.ARRAY_BUFFER,p.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,ta,C)}if(Q){e.bindBuffer(e.ARRAY_BUFFER,p.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,ab,C)}if(Na&&U.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,p.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,Pa,C)}if(pa&&kb>0){e.bindBuffer(e.ARRAY_BUFFER,p.__webglUVBuffer);e.bufferData(e.ARRAY_BUFFER,gb,C)}if(pa&&
-fb>0){e.bindBuffer(e.ARRAY_BUFFER,p.__webglUV2Buffer);e.bufferData(e.ARRAY_BUFFER,db,C)}if(Ca){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,P,C);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ka,C)}if(O>0){e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,Ea,C);e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,Ga,C);e.bindBuffer(e.ARRAY_BUFFER,
-p.__webglSkinIndicesBuffer);e.bufferData(e.ARRAY_BUFFER,Ja,C);e.bindBuffer(e.ARRAY_BUFFER,p.__webglSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,Ma,C)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(h instanceof THREE.Ribbon){w=h.geometry;if(w.__dirtyVertices||w.__dirtyColors){h=w;t=e.DYNAMIC_DRAW;Ha=h.vertices;C=h.colors;ya=Ha.length;H=C.length;Ba=h.__vertexArray;K=h.__colorArray;Da=h.__dirtyColors;
-if(h.__dirtyVertices){for(ra=0;ra<ya;ra++){ja=Ha[ra].position;p=ra*3;Ba[p]=ja.x;Ba[p+1]=ja.y;Ba[p+2]=ja.z}e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,t)}if(Da){for(ra=0;ra<H;ra++){color=C[ra];p=ra*3;K[p]=color.r;K[p+1]=color.g;K[p+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(h instanceof THREE.Line){w=h.geometry;if(w.__dirtyVertices||w.__dirtyColors){h=w;t=e.DYNAMIC_DRAW;
-Ha=h.vertices;C=h.colors;ya=Ha.length;H=C.length;Ba=h.__vertexArray;K=h.__colorArray;Da=h.__dirtyColors;if(h.__dirtyVertices){for(ra=0;ra<ya;ra++){ja=Ha[ra].position;p=ra*3;Ba[p]=ja.x;Ba[p+1]=ja.y;Ba[p+2]=ja.z}e.bindBuffer(e.ARRAY_BUFFER,h.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,t)}if(Da){for(ra=0;ra<H;ra++){color=C[ra];p=ra*3;K[p]=color.r;K[p+1]=color.g;K[p+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,h.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,t)}}w.__dirtyVertices=!1;w.__dirtyColors=
-!1}else if(h instanceof THREE.ParticleSystem){w=h.geometry;(w.__dirtyVertices||w.__dirtyColors||h.sortParticles)&&c(w,e.DYNAMIC_DRAW,h);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function G(h){function t(ha){var ra=[];w=0;for(p=ha.length;w<p;w++)ha[w]==undefined?ra.push("undefined"):ra.push(ha[w].id);return ra.join("_")}var w,p,C,H,K,E,A,aa,J={},Y=h.morphTargets!==undefined?h.morphTargets.length:0;h.geometryGroups={};C=0;for(H=h.faces.length;C<H;C++){K=h.faces[C];E=K.materials;A=t(E);J[A]==undefined&&
-(J[A]={hash:A,counter:0});aa=J[A].hash+"_"+J[A].counter;h.geometryGroups[aa]==undefined&&(h.geometryGroups[aa]={faces:[],materials:E,vertices:0,numMorphTargets:Y});K=K instanceof THREE.Face3?3:4;if(h.geometryGroups[aa].vertices+K>65535){J[A].counter+=1;aa=J[A].hash+"_"+J[A].counter;h.geometryGroups[aa]==undefined&&(h.geometryGroups[aa]={faces:[],materials:E,vertices:0,numMorphTargets:Y})}h.geometryGroups[aa].faces.push(C);h.geometryGroups[aa].vertices+=K}}function I(h,t,w){h.push({buffer:t,object:w,
-opaque:{list:[],count:0},transparent:{list:[],count:0}})}function R(h){if(h!=wa){switch(h){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD);e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}wa=
-h}}function D(h,t,w){if((w.width&w.width-1)==0&&(w.height&w.height-1)==0){e.texParameteri(h,e.TEXTURE_WRAP_S,ma(t.wrapS));e.texParameteri(h,e.TEXTURE_WRAP_T,ma(t.wrapT));e.texParameteri(h,e.TEXTURE_MAG_FILTER,ma(t.magFilter));e.texParameteri(h,e.TEXTURE_MIN_FILTER,ma(t.minFilter));e.generateMipmap(h)}else{e.texParameteri(h,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(h,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(h,e.TEXTURE_MAG_FILTER,N(t.magFilter));e.texParameteri(h,e.TEXTURE_MIN_FILTER,
-N(t.minFilter))}}function M(h){if(h&&!h.__webglFramebuffer){h.__webglFramebuffer=e.createFramebuffer();h.__webglRenderbuffer=e.createRenderbuffer();h.__webglTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,h.__webglRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,h.width,h.height);e.bindTexture(e.TEXTURE_2D,h.__webglTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,ma(h.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,ma(h.wrapT));e.texParameteri(e.TEXTURE_2D,
-e.TEXTURE_MAG_FILTER,ma(h.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,ma(h.minFilter));e.texImage2D(e.TEXTURE_2D,0,ma(h.format),h.width,h.height,0,ma(h.format),ma(h.type),null);e.bindFramebuffer(e.FRAMEBUFFER,h.__webglFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,h.__webglTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,h.__webglRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,
-null);e.bindFramebuffer(e.FRAMEBUFFER,null)}var t,w;if(h){t=h.__webglFramebuffer;w=h.width;h=h.height}else{t=null;w=qa;h=Z}if(t!=$){e.bindFramebuffer(e.FRAMEBUFFER,t);e.viewport(T,fa,w,h);$=t}}function L(h,t){var w;if(h=="fragment")w=e.createShader(e.FRAGMENT_SHADER);else h=="vertex"&&(w=e.createShader(e.VERTEX_SHADER));e.shaderSource(w,t);e.compileShader(w);if(!e.getShaderParameter(w,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(w));console.error(t);return null}return w}function N(h){switch(h){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
-default:return e.LINEAR}}function ma(h){switch(h){case THREE.RepeatWrapping:return e.REPEAT;case THREE.ClampToEdgeWrapping:return e.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return e.MIRRORED_REPEAT;case THREE.NearestFilter:return e.NEAREST;case THREE.NearestMipMapNearestFilter:return e.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return e.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return e.LINEAR;case THREE.LinearMipMapNearestFilter:return e.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return e.LINEAR_MIPMAP_LINEAR;
-case THREE.ByteType:return e.BYTE;case THREE.UnsignedByteType:return e.UNSIGNED_BYTE;case THREE.ShortType:return e.SHORT;case THREE.UnsignedShortType:return e.UNSIGNED_SHORT;case THREE.IntType:return e.INT;case THREE.UnsignedShortType:return e.UNSIGNED_INT;case THREE.FloatType:return e.FLOAT;case THREE.AlphaFormat:return e.ALPHA;case THREE.RGBFormat:return e.RGB;case THREE.RGBAFormat:return e.RGBA;case THREE.LuminanceFormat:return e.LUMINANCE;case THREE.LuminanceAlphaFormat:return e.LUMINANCE_ALPHA}return 0}
-var e,la=document.createElement("canvas"),V=null,$=null,X=this,sa=null,va=null,wa=null,ia=null,T=0,fa=0,qa=0,Z=0,S=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],da=new THREE.Matrix4,ua=new Float32Array(16),ca=new Float32Array(16),ga=new THREE.Vector4,xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Ka=!0,Xa=new THREE.Color(0),Ya=0;if(a){if(a.antialias!==undefined)Ka=
-a.antialias;a.clearColor!==undefined&&Xa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ya=a.clearAlpha}this.maxMorphTargets=8;this.domElement=la;this.autoClear=!0;this.sortObjects=!0;(function(h,t,w){try{if(!(e=la.getContext("experimental-webgl",{antialias:h,stencil:!0})))throw"Error creating WebGL context.";}catch(p){console.error(p)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);
-e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(t.r,t.g,t.b,w)})(Ka,Xa,Ya);this.context=e;var Aa={};a=[];Ka=[];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;Ka[0]=0;Ka[1]=1;Ka[2]=2;Ka[3]=0;Ka[4]=2;Ka[5]=3;Aa.vertexBuffer=e.createBuffer();Aa.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,Aa.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,new Float32Array(a),e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
-Aa.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array(Ka),e.STATIC_DRAW);Aa.program=e.createProgram();e.attachShader(Aa.program,L("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(Aa.program,L("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(Aa.program);Aa.vertexLocation=e.getAttribLocation(Aa.program,"position");Aa.projectionLocation=e.getUniformLocation(Aa.program,"projectionMatrix");this.setSize=function(h,t){la.width=h;la.height=t;this.setViewport(0,
-0,la.width,la.height)};this.setViewport=function(h,t,w,p){T=h;fa=t;qa=w;Z=p;e.viewport(T,fa,qa,Z)};this.setScissor=function(h,t,w,p){e.scissor(h,t,w,p)};this.enableScissorTest=function(h){h?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(h){e.depthMask(h)};this.setClearColorHex=function(h,t){var w=new THREE.Color(h);e.clearColor(w.r,w.g,w.b,t)};this.setClearColor=function(h,t){e.clearColor(h.r,h.g,h.b,t)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|
-e.STENCIL_BUFFER_BIT)};this.initMaterial=function(h,t,w,p){var C,H,K,E;if(h instanceof THREE.MeshDepthMaterial)b(h,THREE.ShaderLib.depth);else if(h instanceof THREE.ShadowVolumeDynamicMaterial)b(h,THREE.ShaderLib.shadowVolumeDynamic);else if(h instanceof THREE.MeshNormalMaterial)b(h,THREE.ShaderLib.normal);else if(h instanceof THREE.MeshBasicMaterial)b(h,THREE.ShaderLib.basic);else if(h instanceof THREE.MeshLambertMaterial)b(h,THREE.ShaderLib.lambert);else if(h instanceof THREE.MeshPhongMaterial)b(h,
-THREE.ShaderLib.phong);else if(h instanceof THREE.LineBasicMaterial)b(h,THREE.ShaderLib.basic);else h instanceof THREE.ParticleBasicMaterial&&b(h,THREE.ShaderLib.particle_basic);if(!h.program){var A,aa,J;A=J=E=0;for(K=t.length;A<K;A++){aa=t[A];aa instanceof THREE.DirectionalLight&&J++;aa instanceof THREE.PointLight&&E++}if(E+J<=4)t=J;else{t=Math.ceil(4*J/(E+J));E=4-t}E={directional:t,point:E};t=50;if(p!==undefined&&p instanceof THREE.SkinnedMesh)t=p.bones.length;K={map:h.map,envMap:h.envMap,lightMap:h.lightMap,
-vertexColors:h.vertexColors,fog:w,sizeAttenuation:h.sizeAttenuation,skinning:h.skinning,morphTargets:h.morphTargets,maxDirLights:E.directional,maxPointLights:E.point,maxBones:t};w=h.fragmentShader;E=h.vertexShader;t=e.createProgram();A=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+K.maxDirLights,"#define MAX_POINT_LIGHTS "+K.maxPointLights,K.fog?"#define USE_FOG":"",K.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",K.map?"#define USE_MAP":"",K.envMap?"#define USE_ENVMAP":
-"",K.lightMap?"#define USE_LIGHTMAP":"",K.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");K=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+K.maxDirLights,"#define MAX_POINT_LIGHTS "+K.maxPointLights,"#define MAX_BONES "+K.maxBones,K.map?"#define USE_MAP":"",K.envMap?"#define USE_ENVMAP":"",K.lightMap?"#define USE_LIGHTMAP":"",K.vertexColors?"#define USE_COLOR":"",K.skinning?"#define USE_SKINNING":
-"",K.morphTargets?"#define USE_MORPHTARGETS":"",K.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 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-e.attachShader(t,L("fragment",A+w));e.attachShader(t,L("vertex",K+E));e.linkProgram(t);e.getProgramParameter(t,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(t,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");t.uniforms={};t.attributes={};h.program=t;w=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(C in h.uniforms)w.push(C);
-C=h.program;E=0;for(t=w.length;E<t;E++){A=w[E];C.uniforms[A]=e.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(H in h.attributes)w.push(H);H=h.program;C=w;w=0;for(E=C.length;w<E;w++){t=C[w];H.attributes[t]=e.getAttribLocation(H,t)}H=h.program.attributes;e.enableVertexAttribArray(H.position);H.color>=0&&e.enableVertexAttribArray(H.color);H.normal>=0&&e.enableVertexAttribArray(H.normal);
-H.tangent>=0&&e.enableVertexAttribArray(H.tangent);if(h.skinning&&H.skinVertexA>=0&&H.skinVertexB>=0&&H.skinIndex>=0&&H.skinWeight>=0){e.enableVertexAttribArray(H.skinVertexA);e.enableVertexAttribArray(H.skinVertexB);e.enableVertexAttribArray(H.skinIndex);e.enableVertexAttribArray(H.skinWeight)}if(h.morphTargets){h.numSupportedMorphTargets=0;if(H.morphTarget0>=0){e.enableVertexAttribArray(H.morphTarget0);h.numSupportedMorphTargets++}if(H.morphTarget1>=0){e.enableVertexAttribArray(H.morphTarget1);
-h.numSupportedMorphTargets++}if(H.morphTarget2>=0){e.enableVertexAttribArray(H.morphTarget2);h.numSupportedMorphTargets++}if(H.morphTarget3>=0){e.enableVertexAttribArray(H.morphTarget3);h.numSupportedMorphTargets++}if(H.morphTarget4>=0){e.enableVertexAttribArray(H.morphTarget4);h.numSupportedMorphTargets++}if(H.morphTarget5>=0){e.enableVertexAttribArray(H.morphTarget5);h.numSupportedMorphTargets++}if(H.morphTarget6>=0){e.enableVertexAttribArray(H.morphTarget6);h.numSupportedMorphTargets++}if(H.morphTarget7>=
-0){e.enableVertexAttribArray(H.morphTarget7);h.numSupportedMorphTargets++}p.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);C=0;for(H=this.maxMorphTargets;C<H;C++)p.__webglMorphTargetInfluences[C]=0}}h.__webglProgram=!0};this.render=function(h,t,w,p){var C,H,K,E,A,aa,J,Y,ha=h.lights,ra=h.fog;t.matrixAutoUpdate&&t.updateMatrix();h.update(undefined,!1,t);t.matrixWorldInverse.flattenToArray(ca);t.projectionMatrix.flattenToArray(ua);da.multiply(t.projectionMatrix,t.matrixWorldInverse);
-m(da);this.initWebGLObjects(h);M(w);(this.autoClear||p)&&this.clear();p=h.__webglObjects.length;for(A=0;A<p;A++){E=h.__webglObjects[A];J=E.object;if(J.visible)if(!(J instanceof THREE.Mesh)||o(J)){J.matrixWorld.flattenToArray(J._objectMatrixArray);B(J,t);z(E);E.render=!0;if(this.sortObjects){ga.copy(J.position);da.multiplyVector3(ga);E.z=ga.z}}else E.render=!1;else E.render=!1}this.sortObjects&&h.__webglObjects.sort(y);aa=h.__webglObjectsImmediate.length;for(A=0;A<aa;A++){E=h.__webglObjectsImmediate[A];
-J=E.object;if(J.visible){J.matrixAutoUpdate&&J.matrixWorld.flattenToArray(J._objectMatrixArray);B(J,t);x(E)}}R(THREE.NormalBlending);for(A=0;A<p;A++){E=h.__webglObjects[A];if(E.render){J=E.object;Y=E.buffer;K=E.opaque;j(J);for(C=0;C<K.count;C++){E=K.list[C];k(E.depthTest);f(t,ha,ra,E,Y,J)}}}for(A=0;A<aa;A++){E=h.__webglObjectsImmediate[A];J=E.object;if(J.visible){K=E.opaque;j(J);for(C=0;C<K.count;C++){E=K.list[C];k(E.depthTest);H=d(t,ha,ra,E,J);J.render(function(ja){g(ja,H)})}}}for(A=0;A<p;A++){E=
-h.__webglObjects[A];if(E.render){J=E.object;Y=E.buffer;K=E.transparent;j(J);for(C=0;C<K.count;C++){E=K.list[C];R(E.blending);k(E.depthTest);f(t,ha,ra,E,Y,J)}}}for(A=0;A<aa;A++){E=h.__webglObjectsImmediate[A];J=E.object;if(J.visible){K=E.transparent;j(J);for(C=0;C<K.count;C++){E=K.list[C];R(E.blending);k(E.depthTest);H=d(t,ha,ra,E,J);J.render(function(ja){g(ja,H)})}}}if(h.__webglShadowVolumes.length&&h.lights.length){e.enable(e.POLYGON_OFFSET_FILL);e.polygonOffset(0.1,1);e.enable(e.STENCIL_TEST);e.depthMask(!1);
-e.colorMask(!1,!1,!1,!1);e.stencilFunc(e.ALWAYS,1,255);e.stencilOpSeparate(e.BACK,e.KEEP,e.INCR,e.KEEP);e.stencilOpSeparate(e.FRONT,e.KEEP,e.DECR,e.KEEP);aa=h.lights.length;Y=[];p=h.__webglShadowVolumes.length;for(t=0;t<aa;t++){A=h.lights[t];if(A instanceof THREE.DirectionalLight){Y[0]=-A.position.x;Y[1]=-A.position.y;Y[2]=-A.position.z;for(A=0;A<p;A++){J=h.__webglShadowVolumes[A].object;C=h.__webglShadowVolumes[A].buffer;E=J.materials[0];E.program||X.initMaterial(E,ha,ra,J);H=E.program;E=H.uniforms;
-K=H.attributes;if(V!==H){e.useProgram(H);V=H;e.uniformMatrix4fv(E.projectionMatrix,!1,ua);e.uniformMatrix4fv(E.viewMatrix,!1,ca);e.uniform3fv(E.directionalLightDirection,Y)}J.matrixWorld.flattenToArray(J._objectMatrixArray);e.uniformMatrix4fv(E.objectMatrix,!1,J._objectMatrixArray);e.bindBuffer(e.ARRAY_BUFFER,C.__webglVertexBuffer);e.vertexAttribPointer(K.position,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,C.__webglNormalBuffer);e.vertexAttribPointer(K.normal,3,e.FLOAT,!1,0,0);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,
-C.__webglFaceBuffer);e.cullFace(e.FRONT);e.drawElements(e.TRIANGLES,C.__webglFaceCount,e.UNSIGNED_SHORT,0);e.cullFace(e.BACK);e.drawElements(e.TRIANGLES,C.__webglFaceCount,e.UNSIGNED_SHORT,0)}}}e.disable(e.POLYGON_OFFSET_FILL);e.colorMask(!0,!0,!0,!0);e.stencilFunc(e.NOTEQUAL,0,255);e.stencilOp(e.KEEP,e.KEEP,e.KEEP);e.disable(e.DEPTH_TEST);e.enable(e.BLEND);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA);e.blendEquation(e.FUNC_ADD);wa="";V=Aa.program;e.useProgram(Aa.program);e.uniformMatrix4fv(Aa.projectionLocation,
-!1,ua);e.bindBuffer(e.ARRAY_BUFFER,Aa.vertexBuffer);e.vertexAttribPointer(Aa.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(Aa.vertexLocation);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,Aa.elementBuffer);e.drawElements(e.TRIANGLES,6,e.UNSIGNED_SHORT,0);e.disable(e.STENCIL_TEST);e.enable(e.DEPTH_TEST);e.disable(e.BLEND);e.depthMask(!0)}if(w&&w.minFilter!==THREE.NearestFilter&&w.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,w.__webglTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,
-null)}};this.initWebGLObjects=function(h){if(!h.__webglObjects){h.__webglObjects=[];h.__webglObjectsImmediate=[];h.__webglShadowVolumes=[]}for(;h.__objectsAdded.length;){var t=h.__objectsAdded[0],w=h,p=void 0,C=void 0,H=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&&G(C);for(p in C.geometryGroups){H=C.geometryGroups[p];if(!H.__webglVertexBuffer){var K=H;K.__webglVertexBuffer=e.createBuffer();K.__webglNormalBuffer=e.createBuffer();K.__webglTangentBuffer=e.createBuffer();K.__webglColorBuffer=e.createBuffer();K.__webglUVBuffer=e.createBuffer();K.__webglUV2Buffer=e.createBuffer();K.__webglSkinVertexABuffer=e.createBuffer();K.__webglSkinVertexBBuffer=e.createBuffer();K.__webglSkinIndicesBuffer=e.createBuffer();K.__webglSkinWeightsBuffer=
-e.createBuffer();K.__webglFaceBuffer=e.createBuffer();K.__webglLineBuffer=e.createBuffer();if(K.numMorphTargets){var E=void 0,A=void 0;K.__webglMorphTargetsBuffers=[];E=0;for(A=K.numMorphTargets;E<A;E++)K.__webglMorphTargetsBuffers.push(e.createBuffer())}K=H;E=t;var aa=void 0,J=void 0,Y=void 0;Y=void 0;var ha=A=0,ra=0;aa=void 0;J=void 0;var ja=void 0;J=void 0;var Ha=E.geometry;ja=Ha.faces;var ya=K.faces;aa=0;for(J=ya.length;aa<J;aa++){Y=ya[aa];Y=ja[Y];if(Y instanceof THREE.Face3){A+=3;ha+=1;ra+=3}else if(Y instanceof
-THREE.Face4){A+=4;ha+=2;ra+=4}}aa=K;J=E;ja=void 0;ya=void 0;var Ba=void 0,W=void 0;Ba=void 0;Y=[];ja=0;for(ya=J.materials.length;ja<ya;ja++){Ba=J.materials[ja];if(Ba instanceof THREE.MeshFaceMaterial){Ba=0;for(l=aa.materials.length;Ba<l;Ba++)(W=aa.materials[Ba])&&Y.push(W)}else(W=Ba)&&Y.push(W)}J=Y;a:{aa=void 0;ja=void 0;ya=J.length;for(aa=0;aa<ya;aa++){ja=J[aa];if(ja.map||ja.lightMap||ja instanceof THREE.MeshShaderMaterial){aa=!0;break a}}aa=!1}a:{ja=J;ya=void 0;Y=void 0;Ba=ja.length;for(ya=0;ya<
-Ba;ya++){Y=ja[ya];if(!(Y instanceof THREE.MeshBasicMaterial&&!Y.envMap||Y instanceof THREE.MeshDepthMaterial)){ja=Y&&Y.shading!=undefined&&Y.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}ja=!1}a:{ya=void 0;Y=void 0;Ba=J.length;for(ya=0;ya<Ba;ya++){Y=J[ya];if(Y.vertexColors){J=Y.vertexColors;break a}}J=!1}K.__vertexArray=new Float32Array(A*3);if(ja)K.__normalArray=new Float32Array(A*3);if(Ha.hasTangents)K.__tangentArray=new Float32Array(A*4);if(J)K.__colorArray=new Float32Array(A*
-3);if(aa){if(Ha.faceUvs.length>0||Ha.faceVertexUvs.length>0)K.__uvArray=new Float32Array(A*2);if(Ha.faceUvs.length>1||Ha.faceVertexUvs.length>1)K.__uv2Array=new Float32Array(A*2)}if(E.geometry.skinWeights.length&&E.geometry.skinIndices.length){K.__skinVertexAArray=new Float32Array(A*4);K.__skinVertexBArray=new Float32Array(A*4);K.__skinIndexArray=new Float32Array(A*4);K.__skinWeightArray=new Float32Array(A*4)}K.__faceArray=new Uint16Array(ha*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0));
-K.__lineArray=new Uint16Array(ra*2);if(K.numMorphTargets){Ha=void 0;ya=void 0;K.__morphTargetsArrays=[];Ha=0;for(ya=K.numMorphTargets;Ha<ya;Ha++)K.__morphTargetsArrays.push(new Float32Array(A*3))}K.__needsSmoothNormals=ja==THREE.SmoothShading;K.__uvType=aa;K.__vertexColorType=J;K.__normalType=ja;K.__webglFaceCount=ha*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0);K.__webglLineCount=ra*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?I(w.__webglShadowVolumes,H,t):I(w.__webglObjects,H,t)}}else if(t instanceof THREE.Ribbon){C=t.geometry;if(!C.__webglVertexBuffer){p=C;p.__webglVertexBuffer=e.createBuffer();p.__webglColorBuffer=e.createBuffer();p=C;H=p.vertices.length;p.__vertexArray=new Float32Array(H*3);p.__colorArray=new Float32Array(H*3);p.__webglVertexCount=H;C.__dirtyVertices=!0;C.__dirtyColors=!0}I(w.__webglObjects,C,t)}else if(t instanceof THREE.Line){C=
-t.geometry;if(!C.__webglVertexBuffer){p=C;p.__webglVertexBuffer=e.createBuffer();p.__webglColorBuffer=e.createBuffer();p=C;H=p.vertices.length;p.__vertexArray=new Float32Array(H*3);p.__colorArray=new Float32Array(H*3);p.__webglLineCount=H;C.__dirtyVertices=!0;C.__dirtyColors=!0}I(w.__webglObjects,C,t)}else if(t instanceof THREE.ParticleSystem){C=t.geometry;if(!C.__webglVertexBuffer){p=C;p.__webglVertexBuffer=e.createBuffer();p.__webglColorBuffer=e.createBuffer();p=C;H=p.vertices.length;p.__vertexArray=
-new Float32Array(H*3);p.__colorArray=new Float32Array(H*3);p.__sortArray=[];p.__webglParticleCount=H;C.__dirtyVertices=!0;C.__dirtyColors=!0}I(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}});h.__objectsAdded.splice(0,1)}for(;h.__objectsRemoved.length;){t=h.__objectsRemoved[0];w=h;C=void 0;p=void 0;for(C=w.__webglObjects.length-1;C>=0;C--){p=w.__webglObjects[C].object;
-t==p&&w.__webglObjects.splice(C,1)}h.__objectsRemoved.splice(0,1)}t=0;for(w=h.__webglObjects.length;t<w;t++)F(h.__webglObjects[t].object,h);t=0;for(w=h.__webglShadowVolumes.length;t<w;t++)F(h.__webglShadowVolumes[t].object,h)};this.setFaceCulling=function(h,t){if(h){!t||t=="ccw"?e.frontFace(e.CCW):e.frontFace(e.CW);if(h=="back")e.cullFace(e.BACK);else h=="front"?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK);e.enable(e.CULL_FACE)}else e.disable(e.CULL_FACE)};this.supportsVertexTextures=function(){return e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
-0}};THREE.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,f=b.length;for(d=0;d<f;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(k,B,x){var p,A,F,H=k.vertices,K=H.length,C=k.colors,$=C.length,I=k.__vertexArray,la=k.__colorArray,Y=k.__sortArray,ua=k.__dirtyVertices,sa=k.__dirtyColors;if(x.sortParticles){Da.multiplySelf(x.matrixWorld);for(p=0;p<K;p++){A=H[p].position;Wa.copy(A);Da.multiplyVector3(Wa);Y[p]=[Wa.z,p]}Y.sort(function(Ea,ka){return ka[0]-Ea[0]});for(p=0;p<K;p++){A=H[Y[p][1]].position;F=p*3;I[F]=A.x;I[F+1]=A.y;I[F+2]=A.z}for(p=0;p<$;p++){F=p*3;color=C[Y[p][1]];la[F]=color.r;
+la[F+1]=color.g;la[F+2]=color.b}}else{if(ua)for(p=0;p<K;p++){A=H[p].position;F=p*3;I[F]=A.x;I[F+1]=A.y;I[F+2]=A.z}if(sa)for(p=0;p<$;p++){color=C[p];F=p*3;la[F]=color.r;la[F+1]=color.g;la[F+2]=color.b}}if(ua||x.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,I,B)}if(sa||x.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,k.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,la,B)}}function b(k,B){k.uniforms=Uniforms.clone(B.uniforms);k.vertexShader=B.vertexShader;
+k.fragmentShader=B.fragmentShader}function e(k,B,x,p,A){p.__webglProgram||ra.initMaterial(p,B,x,A);var F=p.program,H=F.uniforms,K=p.uniforms;if(F!=ya){d.useProgram(F);ya=F}d.uniformMatrix4fv(H.projectionMatrix,!1,Sa);if(x&&(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial||p instanceof THREE.LineBasicMaterial||p instanceof THREE.ParticleBasicMaterial)){K.fogColor.value.setHex(x.color.hex);if(x instanceof THREE.Fog){K.fogNear.value=
+x.near;K.fogFar.value=x.far}else if(x instanceof THREE.FogExp2)K.fogDensity.value=x.density}if(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p.lights){var C,$,I=0,la=0,Y=0,ua,sa,Ea,ka,va=Ta,ha=va.directional.colors,ia=va.directional.positions,wa=va.point.colors,Qa=va.point.positions,Va=va.point.distances,eb=0,Ma=0;x=$=ka=0;for(C=B.length;x<C;x++){$=B[x];ua=$.color;sa=$.position;Ea=$.intensity;ka=$.distance;if($ instanceof THREE.AmbientLight){I+=ua.r;la+=ua.g;Y+=ua.b}else if($ instanceof
+THREE.DirectionalLight){ka=eb*3;ha[ka]=ua.r*Ea;ha[ka+1]=ua.g*Ea;ha[ka+2]=ua.b*Ea;ia[ka]=sa.x;ia[ka+1]=sa.y;ia[ka+2]=sa.z;eb+=1}else if($ instanceof THREE.PointLight){$=Ma*3;wa[$]=ua.r*Ea;wa[$+1]=ua.g*Ea;wa[$+2]=ua.b*Ea;Qa[$]=sa.x;Qa[$+1]=sa.y;Qa[$+2]=sa.z;Va[Ma]=ka;Ma+=1}}for(x=eb*3;x<ha.length;x++)ha[x]=0;for(x=Ma*3;x<wa.length;x++)wa[x]=0;va.point.length=Ma;va.directional.length=eb;va.ambient[0]=I;va.ambient[1]=la;va.ambient[2]=Y;x=Ta;K.enableLighting.value=x.directional.length+x.point.length;K.ambientLightColor.value=
+x.ambient;K.directionalLightColor.value=x.directional.colors;K.directionalLightDirection.value=x.directional.positions;K.pointLightColor.value=x.point.colors;K.pointLightPosition.value=x.point.positions;K.pointLightDistance.value=x.point.distances}if(p instanceof THREE.MeshBasicMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshPhongMaterial){K.diffuse.value.setRGB(p.color.r,p.color.g,p.color.b);K.opacity.value=p.opacity;K.map.texture=p.map;K.lightMap.texture=p.lightMap;K.envMap.texture=
+p.envMap;K.reflectivity.value=p.reflectivity;K.refractionRatio.value=p.refractionRatio;K.combine.value=p.combine;K.useRefract.value=p.envMap&&p.envMap.mapping instanceof THREE.CubeRefractionMapping}if(p instanceof THREE.LineBasicMaterial){K.diffuse.value.setRGB(p.color.r,p.color.g,p.color.b);K.opacity.value=p.opacity}else if(p instanceof THREE.ParticleBasicMaterial){K.psColor.value.setRGB(p.color.r,p.color.g,p.color.b);K.opacity.value=p.opacity;K.size.value=p.size;K.scale.value=Z.height/2;K.map.texture=
+p.map}else if(p instanceof THREE.MeshPhongMaterial){K.ambient.value.setRGB(p.ambient.r,p.ambient.g,p.ambient.b);K.specular.value.setRGB(p.specular.r,p.specular.g,p.specular.b);K.shininess.value=p.shininess}else if(p instanceof THREE.MeshDepthMaterial){K.mNear.value=k.near;K.mFar.value=k.far;K.opacity.value=p.opacity}else if(p instanceof THREE.MeshNormalMaterial)K.opacity.value=p.opacity;for(var La in K)if(la=F.uniforms[La]){C=K[La];I=C.type;x=C.value;if(I=="i")d.uniform1i(la,x);else if(I=="f")d.uniform1f(la,
+x);else if(I=="fv1")d.uniform1fv(la,x);else if(I=="fv")d.uniform3fv(la,x);else if(I=="v2")d.uniform2f(la,x.x,x.y);else if(I=="v3")d.uniform3f(la,x.x,x.y,x.z);else if(I=="c")d.uniform3f(la,x.r,x.g,x.b);else if(I=="t"){d.uniform1i(la,x);if(C=C.texture)if(C.image instanceof Array&&C.image.length==6){if(C.image.length==6){if(C.needsUpdate){if(C.__webglInit){d.bindTexture(d.TEXTURE_CUBE_MAP,C.image.__webglTextureCube);for(I=0;I<6;++I)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,0,0,d.RGBA,d.UNSIGNED_BYTE,
+C.image[I])}else{C.image.__webglTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,C.image.__webglTextureCube);for(I=0;I<6;++I)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+I,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,C.image[I]);C.__webglInit=!0}N(d.TEXTURE_CUBE_MAP,C,C.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);C.needsUpdate=!1}d.activeTexture(d.TEXTURE0+x);d.bindTexture(d.TEXTURE_CUBE_MAP,C.image.__webglTextureCube)}}else O(C,x)}}d.uniformMatrix4fv(H.modelViewMatrix,!1,A._modelViewMatrixArray);
+d.uniformMatrix3fv(H.normalMatrix,!1,A._normalMatrixArray);(p instanceof THREE.MeshShaderMaterial||p instanceof THREE.MeshPhongMaterial||p.envMap)&&d.uniform3f(H.cameraPosition,k.position.x,k.position.y,k.position.z);(p instanceof THREE.MeshShaderMaterial||p.envMap||p.skinning)&&d.uniformMatrix4fv(H.objectMatrix,!1,A._objectMatrixArray);(p instanceof THREE.MeshPhongMaterial||p instanceof THREE.MeshLambertMaterial||p instanceof THREE.MeshShaderMaterial||p.skinning)&&d.uniformMatrix4fv(H.viewMatrix,
+!1,Xa);if(p instanceof THREE.ShadowVolumeDynamicMaterial){k=K.directionalLightDirection.value;k[0]=-B.position.x;k[1]=-B.position.y;k[2]=-B.position.z;d.uniform3fv(H.directionalLightDirection,k);d.uniformMatrix4fv(H.objectMatrix,!1,A._objectMatrixArray);d.uniformMatrix4fv(H.viewMatrix,!1,Xa)}if(p.skinning){d.uniformMatrix4fv(H.cameraInverseMatrix,!1,Xa);d.uniformMatrix4fv(H.boneGlobalMatrices,!1,A.boneMatrices)}return F}function f(k,B,x,p,A,F){if(p.opacity!=0){k=e(k,B,x,p,F).attributes;if(p.morphTargets){B=
+p.program.attributes;F.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[F.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,A.__webglVertexBuffer);d.vertexAttribPointer(B.position,3,d.FLOAT,!1,0,0);if(F.morphTargetForcedOrder.length){x=0;for(var H=F.morphTargetForcedOrder,K=F.morphTargetInfluences;x<p.numSupportedMorphTargets&&x<H.length;){d.bindBuffer(d.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[H[x]]);d.vertexAttribPointer(B["morphTarget"+x],3,d.FLOAT,!1,0,0);F.__webglMorphTargetInfluences[x]=
+K[H[x]];x++}}else{H=[];var C=-1,$=0;K=F.morphTargetInfluences;var I,la=K.length;x=0;for(F.morphTargetBase!==-1&&(H[F.morphTargetBase]=!0);x<p.numSupportedMorphTargets;){for(I=0;I<la;I++)if(!H[I]&&K[I]>C){$=I;C=K[$]}d.bindBuffer(d.ARRAY_BUFFER,A.__webglMorphTargetsBuffers[$]);d.vertexAttribPointer(B["morphTarget"+x],3,d.FLOAT,!1,0,0);F.__webglMorphTargetInfluences[x]=C;H[$]=1;C=-1;x++}}d.uniform1fv(p.program.uniforms.morphTargetInfluences,F.__webglMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,
+A.__webglVertexBuffer);d.vertexAttribPointer(k.position,3,d.FLOAT,!1,0,0)}if(k.color>=0){d.bindBuffer(d.ARRAY_BUFFER,A.__webglColorBuffer);d.vertexAttribPointer(k.color,3,d.FLOAT,!1,0,0)}if(k.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,A.__webglNormalBuffer);d.vertexAttribPointer(k.normal,3,d.FLOAT,!1,0,0)}if(k.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,A.__webglTangentBuffer);d.vertexAttribPointer(k.tangent,4,d.FLOAT,!1,0,0)}if(k.uv>=0)if(A.__webglUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,A.__webglUVBuffer);
+d.vertexAttribPointer(k.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(k.uv)}else d.disableVertexAttribArray(k.uv);if(k.uv2>=0)if(A.__webglUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,A.__webglUV2Buffer);d.vertexAttribPointer(k.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(k.uv2)}else d.disableVertexAttribArray(k.uv2);if(p.skinning&&k.skinVertexA>=0&&k.skinVertexB>=0&&k.skinIndex>=0&&k.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,A.__webglSkinVertexABuffer);d.vertexAttribPointer(k.skinVertexA,4,d.FLOAT,
+!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,A.__webglSkinVertexBBuffer);d.vertexAttribPointer(k.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,A.__webglSkinIndicesBuffer);d.vertexAttribPointer(k.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,A.__webglSkinWeightsBuffer);d.vertexAttribPointer(k.skinWeight,4,d.FLOAT,!1,0,0)}if(F instanceof THREE.Mesh)if(p.wireframe){d.lineWidth(p.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,A.__webglLineBuffer);d.drawElements(d.LINES,A.__webglLineCount,
+d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,A.__webglFaceBuffer);d.drawElements(d.TRIANGLES,A.__webglFaceCount,d.UNSIGNED_SHORT,0)}else if(F instanceof THREE.Line){F=F.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(p.linewidth);d.drawArrays(F,0,A.__webglLineCount)}else if(F instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,A.__webglParticleCount);else F instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,A.__webglVertexCount)}}function g(k,B){if(!k.__webglVertexBuffer)k.__webglVertexBuffer=
+d.createBuffer();if(!k.__webglNormalBuffer)k.__webglNormalBuffer=d.createBuffer();if(k.hasPos){d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,k.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(B.attributes.position);d.vertexAttribPointer(B.attributes.position,3,d.FLOAT,!1,0,0)}if(k.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,k.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,k.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(B.attributes.normal);d.vertexAttribPointer(B.attributes.normal,
+3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,k.count);k.count=0}function h(k){if(X!=k.doubleSided){k.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);X=k.doubleSided}if(qa!=k.flipSided){k.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);qa=k.flipSided}}function j(k){if(ea!=k){k?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);ea=k}}function m(k){ja[0].set(k.n41-k.n11,k.n42-k.n12,k.n43-k.n13,k.n44-k.n14);ja[1].set(k.n41+k.n11,k.n42+k.n12,k.n43+k.n13,k.n44+k.n14);ja[2].set(k.n41+k.n21,k.n42+k.n22,
+k.n43+k.n23,k.n44+k.n24);ja[3].set(k.n41-k.n21,k.n42-k.n22,k.n43-k.n23,k.n44-k.n24);ja[4].set(k.n41-k.n31,k.n42-k.n32,k.n43-k.n33,k.n44-k.n34);ja[5].set(k.n41+k.n31,k.n42+k.n32,k.n43+k.n33,k.n44+k.n34);var B;for(k=0;k<6;k++){B=ja[k];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z*B.z))}}function o(k){for(var B=k.matrixWorld,x=-k.geometry.boundingSphere.radius*Math.max(k.scale.x,Math.max(k.scale.y,k.scale.z)),p=0;p<6;p++){k=ja[p].x*B.n14+ja[p].y*B.n24+ja[p].z*B.n34+ja[p].w;if(k<=x)return!1}return!0}function n(k,
+B){k.list[k.count]=B;k.count+=1}function t(k){var B,x,p=k.object,A=k.opaque,F=k.transparent;F.count=0;k=A.count=0;for(B=p.materials.length;k<B;k++){x=p.materials[k];x.opacity&&x.opacity<1||x.blending!=THREE.NormalBlending?n(F,x):n(A,x)}}function y(k){var B,x,p,A,F=k.object,H=k.buffer,K=k.opaque,C=k.transparent;C.count=0;k=K.count=0;for(p=F.materials.length;k<p;k++){B=F.materials[k];if(B instanceof THREE.MeshFaceMaterial){B=0;for(x=H.materials.length;B<x;B++)(A=H.materials[B])&&(A.opacity&&A.opacity<
+1||A.blending!=THREE.NormalBlending?n(C,A):n(K,A))}else{A=B;A.opacity&&A.opacity<1||A.blending!=THREE.NormalBlending?n(C,A):n(K,A)}}}function w(k,B){return B.z-k.z}function z(k){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);var B,x=k.lights.length,p,A=k.lights,F=[],H,K,C,$,I,la=k.__webglShadowVolumes.length;
+for(B=0;B<x;B++){p=k.lights[B];if(p instanceof THREE.DirectionalLight){F[0]=-p.position.x;F[1]=-p.position.y;F[2]=-p.position.z;for(I=0;I<la;I++){p=k.__webglShadowVolumes[I].object;H=k.__webglShadowVolumes[I].buffer;K=p.materials[0];K.program||ra.initMaterial(K,A,undefined,p);K=K.program;C=K.uniforms;$=K.attributes;if(ya!==K){d.useProgram(K);ya=K;d.uniformMatrix4fv(C.projectionMatrix,!1,Sa);d.uniformMatrix4fv(C.viewMatrix,!1,Xa);d.uniform3fv(C.directionalLightDirection,F)}p.matrixWorld.flattenToArray(p._objectMatrixArray);
+d.uniformMatrix4fv(C.objectMatrix,!1,p._objectMatrixArray);d.bindBuffer(d.ARRAY_BUFFER,H.__webglVertexBuffer);d.vertexAttribPointer($.position,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,H.__webglNormalBuffer);d.vertexAttribPointer($.normal,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,H.__webglFaceBuffer);d.cullFace(d.FRONT);d.drawElements(d.TRIANGLES,H.__webglFaceCount,d.UNSIGNED_SHORT,0);d.cullFace(d.BACK);d.drawElements(d.TRIANGLES,H.__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);za="";ya=ca.program;d.useProgram(ca.program);d.uniformMatrix4fv(ca.projectionLocation,!1,Sa);d.uniform1f(ca.darknessLocation,ca.darkness);d.bindBuffer(d.ARRAY_BUFFER,ca.vertexBuffer);d.vertexAttribPointer(ca.vertexLocation,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(ca.vertexLocation);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.blendEquation(d.FUNC_ADD);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
+ca.elementBuffer);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0);d.disable(d.STENCIL_TEST);d.enable(d.DEPTH_TEST);d.depthMask(Ha)}function E(k,B){var x,p,A,F=k.__webglLensFlares.length,H,K,C;H=new THREE.Vector3;var $=fa/Ca;K=Ca*0.5;C=fa*0.5;var I=16/fa,la=[I*$,I],Y=[1,1,0];I=[1,1];var ua,sa=ga.readBackPixels,Ea,ka,va=ga.uniforms;x=ga.attributes;d.useProgram(ga.program);ya=ga.program;za="";d.uniform1i(va.map,0);d.activeTexture(d.TEXTURE0);d.uniform1f(va.opacity,1);d.uniform1f(va.rotation,0);d.uniform2fv(va.scale,
+la);d.bindBuffer(d.ARRAY_BUFFER,ga.vertexBuffer);d.vertexAttribPointer(x.vertex,2,d.FLOAT,!1,16,0);d.vertexAttribPointer(x.uv,2,d.FLOAT,!1,16,8);d.bindTexture(d.TEXTURE_2D,ga.tempTexture);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,ga.elementBuffer);d.disable(d.CULL_FACE);d.depthMask(!1);for(A=0;A<F;A++){x=k.__webglLensFlares[A].object;H.set(x.matrixWorld.n14,x.matrixWorld.n24,x.matrixWorld.n34);B.matrixWorldInverse.multiplyVector3(H);p=H.z;B.projectionMatrix.multiplyVector3(H);Y[0]=H.x;Y[1]=H.y;Y[2]=H.z;
+I[0]=Y[0]*K+K;I[1]=Y[1]*C+C;d.copyTexSubImage2D(d.TEXTURE_2D,0,0,0,I[0]-8,I[1]-8,16,16);d.uniform3fv(va.screenPosition,Y);d.uniform1i(va.renderPink,1);d.enable(d.DEPTH_TEST);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0);try{d.readPixels(I[0]-8,I[1]-8,16,16,d.RGBA,d.UNSIGNED_BYTE,ga.readBackPixels)}catch(ha){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}d.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(5*(1-Math.max(0,Math.min(-p,
+B.far))/B.far),10)+2;p=sampleDistance*4;ua=sampleDistance*64;ka=0;Ea=28-p+(448-ua);ga.readBackPixels[Ea+0]===255&&ga.readBackPixels[Ea+1]===0&&ga.readBackPixels[Ea+2]===255&&(ka+=0.2);Ea=28+p+(448-ua);sa[Ea+0]===255&&sa[Ea+1]===0&&sa[Ea+2]===255&&(ka+=0.2);Ea=28+p+(448+ua);sa[Ea+0]===255&&sa[Ea+1]===0&&sa[Ea+2]===255&&(ka+=0.2);Ea=28-p+(448+ua);sa[Ea+0]===255&&sa[Ea+1]===0&&sa[Ea+2]===255&&(ka+=0.2);Ea=476;sa[Ea+0]===255&&sa[Ea+1]===0&&sa[Ea+2]===255&&(ka+=0.2);x.positionScreen.x=Y[0];x.positionScreen.y=
+Y[1];x.positionScreen.z=Y[2];x.customUpdateCallback?x.customUpdateCallback(ka,x):x.updateLensFlares(ka);d.uniform1i(va.renderPink,0);d.disable(d.DEPTH_TEST);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)}for(A=0;A<F;A++){x=k.__webglLensFlares[A].object;H=0;for(K=x.lensFlares.length;H<K;H++){C=x.lensFlares[H];if(C.opacity>0.0010&&C.scale>0.0010){Y[0]=C.x;Y[1]=C.y;Y[2]=C.z;I=C.size*C.scale/fa;la[0]=I*$;la[1]=I;d.uniform3fv(va.screenPosition,Y);d.uniform1f(va.rotation,C.rotation);d.uniform2fv(va.scale,
+la);d.uniform1f(va.opacity,C.opacity);L(C.blending);O(C.texture,0);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0)}}}d.enable(d.CULL_FACE);d.enable(d.DEPTH_TEST);d.depthMask(Ha)}function G(k,B){k._modelViewMatrix.multiplyToArray(B.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(k._modelViewMatrix).transposeIntoArray(k._normalMatrixArray)}function J(k){var B,x,p;if(k instanceof THREE.Mesh){x=k.geometry;for(B in x.geometryGroups){p=x.geometryGroups[B];if(x.__dirtyVertices||
+x.__dirtyMorphTargets||x.__dirtyElements||x.__dirtyUvs||x.__dirtyNormals||x.__dirtyColors||x.__dirtyTangents){var A=d.DYNAMIC_DRAW,F=void 0,H=void 0,K=void 0,C=void 0;K=void 0;var $=void 0,I=void 0,la=void 0,Y=void 0,ua=void 0,sa=void 0,Ea=void 0,ka=void 0,va=void 0,ha=void 0,ia=void 0,wa=void 0,Qa=void 0;I=void 0;la=void 0;C=void 0;Y=void 0;C=void 0;ha=void 0;ia=void 0;I=void 0;ha=void 0;ia=void 0;wa=void 0;Qa=void 0;ha=void 0;ia=void 0;wa=void 0;Qa=void 0;ha=void 0;ia=void 0;wa=void 0;Qa=void 0;
+ha=void 0;ia=void 0;wa=void 0;C=void 0;Y=void 0;$=void 0;K=void 0;K=void 0;var Va=void 0,eb=void 0,Ma=void 0,La=0,Pa=0,cb=0,bb=0,$a=0,Za=0,Ka=0,Ya=0,Ua=0,R=0,Ba=0,Na=p.__vertexArray,gb=p.__uvArray,kb=p.__uv2Array,ab=p.__normalArray,Ia=p.__tangentArray,P=p.__colorArray,da=p.__skinVertexAArray,aa=p.__skinVertexBArray,T=p.__skinIndexArray,ta=p.__skinWeightArray,Ja=p.__morphTargetsArrays,pa=p.__faceArray,Q=p.__lineArray,Oa=p.__needsSmoothNormals;sa=p.__vertexColorType;ua=p.__uvType;Ea=p.__normalType;
+var Ra=k.geometry,db=Ra.__dirtyVertices,hb=Ra.__dirtyElements,jb=Ra.__dirtyUvs,fb=Ra.__dirtyNormals,ib=Ra.__dirtyTangents,sb=Ra.__dirtyColors,tb=Ra.__dirtyMorphTargets,ob=Ra.vertices,ub=p.faces,xb=Ra.faces,vb=Ra.faceVertexUvs[0],wb=Ra.faceVertexUvs[1],pb=Ra.skinVerticesA,qb=Ra.skinVerticesB,rb=Ra.skinIndices,mb=Ra.skinWeights,nb=Ra.edgeFaces,lb=Ra.morphTargets;F=0;for(H=ub.length;F<H;F++){K=ub[F];C=xb[K];vb&&(ka=vb[K]);wb&&(va=wb[K]);K=C.vertexNormals;$=C.normal;I=C.vertexColors;la=C.color;Y=C.vertexTangents;
+if(C instanceof THREE.Face3){if(db){ha=ob[C.a].position;ia=ob[C.b].position;wa=ob[C.c].position;Na[Pa]=ha.x;Na[Pa+1]=ha.y;Na[Pa+2]=ha.z;Na[Pa+3]=ia.x;Na[Pa+4]=ia.y;Na[Pa+5]=ia.z;Na[Pa+6]=wa.x;Na[Pa+7]=wa.y;Na[Pa+8]=wa.z;Pa+=9}if(tb){Va=0;for(eb=lb.length;Va<eb;Va++){ha=lb[Va].vertices[C.a].position;ia=lb[Va].vertices[C.b].position;wa=lb[Va].vertices[C.c].position;Ma=Ja[Va];Ma[Ba+0]=ha.x;Ma[Ba+1]=ha.y;Ma[Ba+2]=ha.z;Ma[Ba+3]=ia.x;Ma[Ba+4]=ia.y;Ma[Ba+5]=ia.z;Ma[Ba+6]=wa.x;Ma[Ba+7]=wa.y;Ma[Ba+8]=wa.z}Ba+=
+9}if(mb.length){ha=mb[C.a];ia=mb[C.b];wa=mb[C.c];ta[R]=ha.x;ta[R+1]=ha.y;ta[R+2]=ha.z;ta[R+3]=ha.w;ta[R+4]=ia.x;ta[R+5]=ia.y;ta[R+6]=ia.z;ta[R+7]=ia.w;ta[R+8]=wa.x;ta[R+9]=wa.y;ta[R+10]=wa.z;ta[R+11]=wa.w;ha=rb[C.a];ia=rb[C.b];wa=rb[C.c];T[R]=ha.x;T[R+1]=ha.y;T[R+2]=ha.z;T[R+3]=ha.w;T[R+4]=ia.x;T[R+5]=ia.y;T[R+6]=ia.z;T[R+7]=ia.w;T[R+8]=wa.x;T[R+9]=wa.y;T[R+10]=wa.z;T[R+11]=wa.w;ha=pb[C.a];ia=pb[C.b];wa=pb[C.c];da[R]=ha.x;da[R+1]=ha.y;da[R+2]=ha.z;da[R+3]=1;da[R+4]=ia.x;da[R+5]=ia.y;da[R+6]=ia.z;
+da[R+7]=1;da[R+8]=wa.x;da[R+9]=wa.y;da[R+10]=wa.z;da[R+11]=1;ha=qb[C.a];ia=qb[C.b];wa=qb[C.c];aa[R]=ha.x;aa[R+1]=ha.y;aa[R+2]=ha.z;aa[R+3]=1;aa[R+4]=ia.x;aa[R+5]=ia.y;aa[R+6]=ia.z;aa[R+7]=1;aa[R+8]=wa.x;aa[R+9]=wa.y;aa[R+10]=wa.z;aa[R+11]=1;R+=12}if(sb&&sa){if(I.length==3&&sa==THREE.VertexColors){C=I[0];ha=I[1];ia=I[2]}else ia=ha=C=la;P[Ua]=C.r;P[Ua+1]=C.g;P[Ua+2]=C.b;P[Ua+3]=ha.r;P[Ua+4]=ha.g;P[Ua+5]=ha.b;P[Ua+6]=ia.r;P[Ua+7]=ia.g;P[Ua+8]=ia.b;Ua+=9}if(ib&&Ra.hasTangents){I=Y[0];la=Y[1];C=Y[2];Ia[Ka]=
+I.x;Ia[Ka+1]=I.y;Ia[Ka+2]=I.z;Ia[Ka+3]=I.w;Ia[Ka+4]=la.x;Ia[Ka+5]=la.y;Ia[Ka+6]=la.z;Ia[Ka+7]=la.w;Ia[Ka+8]=C.x;Ia[Ka+9]=C.y;Ia[Ka+10]=C.z;Ia[Ka+11]=C.w;Ka+=12}if(fb&&Ea)if(K.length==3&&Oa)for(Y=0;Y<3;Y++){$=K[Y];ab[Za]=$.x;ab[Za+1]=$.y;ab[Za+2]=$.z;Za+=3}else for(Y=0;Y<3;Y++){ab[Za]=$.x;ab[Za+1]=$.y;ab[Za+2]=$.z;Za+=3}if(jb&&ka!==undefined&&ua)for(Y=0;Y<3;Y++){K=ka[Y];gb[cb]=K.u;gb[cb+1]=K.v;cb+=2}if(jb&&va!==undefined&&ua)for(Y=0;Y<3;Y++){K=va[Y];kb[bb]=K.u;kb[bb+1]=K.v;bb+=2}if(hb){pa[$a]=La;pa[$a+
+1]=La+1;pa[$a+2]=La+2;$a+=3;Q[Ya]=La;Q[Ya+1]=La+1;Q[Ya+2]=La;Q[Ya+3]=La+2;Q[Ya+4]=La+1;Q[Ya+5]=La+2;Ya+=6;La+=3}}else if(C instanceof THREE.Face4){if(db){ha=ob[C.a].position;ia=ob[C.b].position;wa=ob[C.c].position;Qa=ob[C.d].position;Na[Pa]=ha.x;Na[Pa+1]=ha.y;Na[Pa+2]=ha.z;Na[Pa+3]=ia.x;Na[Pa+4]=ia.y;Na[Pa+5]=ia.z;Na[Pa+6]=wa.x;Na[Pa+7]=wa.y;Na[Pa+8]=wa.z;Na[Pa+9]=Qa.x;Na[Pa+10]=Qa.y;Na[Pa+11]=Qa.z;Pa+=12}if(tb){Va=0;for(eb=lb.length;Va<eb;Va++){ha=lb[Va].vertices[C.a].position;ia=lb[Va].vertices[C.b].position;
+wa=lb[Va].vertices[C.c].position;Qa=lb[Va].vertices[C.d].position;Ma=Ja[Va];Ma[Ba+0]=ha.x;Ma[Ba+1]=ha.y;Ma[Ba+2]=ha.z;Ma[Ba+3]=ia.x;Ma[Ba+4]=ia.y;Ma[Ba+5]=ia.z;Ma[Ba+6]=wa.x;Ma[Ba+7]=wa.y;Ma[Ba+8]=wa.z;Ma[Ba+9]=Qa.x;Ma[Ba+10]=Qa.y;Ma[Ba+11]=Qa.z}Ba+=12}if(mb.length){ha=mb[C.a];ia=mb[C.b];wa=mb[C.c];Qa=mb[C.d];ta[R]=ha.x;ta[R+1]=ha.y;ta[R+2]=ha.z;ta[R+3]=ha.w;ta[R+4]=ia.x;ta[R+5]=ia.y;ta[R+6]=ia.z;ta[R+7]=ia.w;ta[R+8]=wa.x;ta[R+9]=wa.y;ta[R+10]=wa.z;ta[R+11]=wa.w;ta[R+12]=Qa.x;ta[R+13]=Qa.y;ta[R+14]=
+Qa.z;ta[R+15]=Qa.w;ha=rb[C.a];ia=rb[C.b];wa=rb[C.c];Qa=rb[C.d];T[R]=ha.x;T[R+1]=ha.y;T[R+2]=ha.z;T[R+3]=ha.w;T[R+4]=ia.x;T[R+5]=ia.y;T[R+6]=ia.z;T[R+7]=ia.w;T[R+8]=wa.x;T[R+9]=wa.y;T[R+10]=wa.z;T[R+11]=wa.w;T[R+12]=Qa.x;T[R+13]=Qa.y;T[R+14]=Qa.z;T[R+15]=Qa.w;ha=pb[C.a];ia=pb[C.b];wa=pb[C.c];Qa=pb[C.d];da[R]=ha.x;da[R+1]=ha.y;da[R+2]=ha.z;da[R+3]=1;da[R+4]=ia.x;da[R+5]=ia.y;da[R+6]=ia.z;da[R+7]=1;da[R+8]=wa.x;da[R+9]=wa.y;da[R+10]=wa.z;da[R+11]=1;da[R+12]=Qa.x;da[R+13]=Qa.y;da[R+14]=Qa.z;da[R+15]=
+1;ha=qb[C.a];ia=qb[C.b];wa=qb[C.c];C=qb[C.d];aa[R]=ha.x;aa[R+1]=ha.y;aa[R+2]=ha.z;aa[R+3]=1;aa[R+4]=ia.x;aa[R+5]=ia.y;aa[R+6]=ia.z;aa[R+7]=1;aa[R+8]=wa.x;aa[R+9]=wa.y;aa[R+10]=wa.z;aa[R+11]=1;aa[R+12]=C.x;aa[R+13]=C.y;aa[R+14]=C.z;aa[R+15]=1;R+=16}if(sb&&sa){if(I.length==4&&sa==THREE.VertexColors){C=I[0];ha=I[1];ia=I[2];I=I[3]}else I=ia=ha=C=la;P[Ua]=C.r;P[Ua+1]=C.g;P[Ua+2]=C.b;P[Ua+3]=ha.r;P[Ua+4]=ha.g;P[Ua+5]=ha.b;P[Ua+6]=ia.r;P[Ua+7]=ia.g;P[Ua+8]=ia.b;P[Ua+9]=I.r;P[Ua+10]=I.g;P[Ua+11]=I.b;Ua+=
+12}if(ib&&Ra.hasTangents){I=Y[0];la=Y[1];C=Y[2];Y=Y[3];Ia[Ka]=I.x;Ia[Ka+1]=I.y;Ia[Ka+2]=I.z;Ia[Ka+3]=I.w;Ia[Ka+4]=la.x;Ia[Ka+5]=la.y;Ia[Ka+6]=la.z;Ia[Ka+7]=la.w;Ia[Ka+8]=C.x;Ia[Ka+9]=C.y;Ia[Ka+10]=C.z;Ia[Ka+11]=C.w;Ia[Ka+12]=Y.x;Ia[Ka+13]=Y.y;Ia[Ka+14]=Y.z;Ia[Ka+15]=Y.w;Ka+=16}if(fb&&Ea)if(K.length==4&&Oa)for(Y=0;Y<4;Y++){$=K[Y];ab[Za]=$.x;ab[Za+1]=$.y;ab[Za+2]=$.z;Za+=3}else for(Y=0;Y<4;Y++){ab[Za]=$.x;ab[Za+1]=$.y;ab[Za+2]=$.z;Za+=3}if(jb&&ka!==undefined&&ua)for(Y=0;Y<4;Y++){K=ka[Y];gb[cb]=K.u;
+gb[cb+1]=K.v;cb+=2}if(jb&&va!==undefined&&ua)for(Y=0;Y<4;Y++){K=va[Y];kb[bb]=K.u;kb[bb+1]=K.v;bb+=2}if(hb){pa[$a]=La;pa[$a+1]=La+1;pa[$a+2]=La+3;pa[$a+3]=La+1;pa[$a+4]=La+2;pa[$a+5]=La+3;$a+=6;Q[Ya]=La;Q[Ya+1]=La+1;Q[Ya+2]=La;Q[Ya+3]=La+3;Q[Ya+4]=La+1;Q[Ya+5]=La+2;Q[Ya+6]=La+2;Q[Ya+7]=La+3;Ya+=8;La+=4}}}if(nb){F=0;for(H=nb.length;F<H;F++){pa[$a]=nb[F].a;pa[$a+1]=nb[F].b;pa[$a+2]=nb[F].c;pa[$a+3]=nb[F].a;pa[$a+4]=nb[F].c;pa[$a+5]=nb[F].d;$a+=6}}if(db){d.bindBuffer(d.ARRAY_BUFFER,p.__webglVertexBuffer);
+d.bufferData(d.ARRAY_BUFFER,Na,A)}if(tb){Va=0;for(eb=lb.length;Va<eb;Va++){d.bindBuffer(d.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[Va]);d.bufferData(d.ARRAY_BUFFER,Ja[Va],A)}}if(sb&&Ua>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,P,A)}if(fb){d.bindBuffer(d.ARRAY_BUFFER,p.__webglNormalBuffer);d.bufferData(d.ARRAY_BUFFER,ab,A)}if(ib&&Ra.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,p.__webglTangentBuffer);d.bufferData(d.ARRAY_BUFFER,Ia,A)}if(jb&&cb>0){d.bindBuffer(d.ARRAY_BUFFER,
+p.__webglUVBuffer);d.bufferData(d.ARRAY_BUFFER,gb,A)}if(jb&&bb>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglUV2Buffer);d.bufferData(d.ARRAY_BUFFER,kb,A)}if(hb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,pa,A);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Q,A)}if(R>0){d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,da,A);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinVertexBBuffer);
+d.bufferData(d.ARRAY_BUFFER,aa,A);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,T,A);d.bindBuffer(d.ARRAY_BUFFER,p.__webglSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,ta,A)}}}x.__dirtyVertices=!1;x.__dirtyMorphTargets=!1;x.__dirtyElements=!1;x.__dirtyUvs=!1;x.__dirtyNormals=!1;x.__dirtyTangents=!1;x.__dirtyColors=!1}else if(k instanceof THREE.Ribbon){x=k.geometry;if(x.__dirtyVertices||x.__dirtyColors){k=x;B=d.DYNAMIC_DRAW;Ea=k.vertices;A=k.colors;ka=Ea.length;
+F=A.length;va=k.__vertexArray;H=k.__colorArray;La=k.__dirtyColors;if(k.__dirtyVertices){for(ua=0;ua<ka;ua++){sa=Ea[ua].position;p=ua*3;va[p]=sa.x;va[p+1]=sa.y;va[p+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,va,B)}if(La){for(ua=0;ua<F;ua++){color=A[ua];p=ua*3;H[p]=color.r;H[p+1]=color.g;H[p+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,k.__webglColorBuffer);d.bufferData(d.ARRAY_BUFFER,H,B)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(k instanceof THREE.Line){x=
+k.geometry;if(x.__dirtyVertices||x.__dirtyColors){k=x;B=d.DYNAMIC_DRAW;Ea=k.vertices;A=k.colors;ka=Ea.length;F=A.length;va=k.__vertexArray;H=k.__colorArray;La=k.__dirtyColors;if(k.__dirtyVertices){for(ua=0;ua<ka;ua++){sa=Ea[ua].position;p=ua*3;va[p]=sa.x;va[p+1]=sa.y;va[p+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,k.__webglVertexBuffer);d.bufferData(d.ARRAY_BUFFER,va,B)}if(La){for(ua=0;ua<F;ua++){color=A[ua];p=ua*3;H[p]=color.r;H[p+1]=color.g;H[p+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,k.__webglColorBuffer);
+d.bufferData(d.ARRAY_BUFFER,H,B)}}x.__dirtyVertices=!1;x.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem){x=k.geometry;(x.__dirtyVertices||x.__dirtyColors||k.sortParticles)&&c(x,d.DYNAMIC_DRAW,k);x.__dirtyVertices=!1;x.__dirtyColors=!1}}function S(k){function B(Y){var ua=[];x=0;for(p=Y.length;x<p;x++)Y[x]==undefined?ua.push("undefined"):ua.push(Y[x].id);return ua.join("_")}var x,p,A,F,H,K,C,$,I={},la=k.morphTargets!==undefined?k.morphTargets.length:0;k.geometryGroups={};A=0;for(F=k.faces.length;A<
+F;A++){H=k.faces[A];K=H.materials;C=B(K);I[C]==undefined&&(I[C]={hash:C,counter:0});$=I[C].hash+"_"+I[C].counter;k.geometryGroups[$]==undefined&&(k.geometryGroups[$]={faces:[],materials:K,vertices:0,numMorphTargets:la});H=H instanceof THREE.Face3?3:4;if(k.geometryGroups[$].vertices+H>65535){I[C].counter+=1;$=I[C].hash+"_"+I[C].counter;k.geometryGroups[$]==undefined&&(k.geometryGroups[$]={faces:[],materials:K,vertices:0,numMorphTargets:la})}k.geometryGroups[$].faces.push(A);k.geometryGroups[$].vertices+=
+H}}function D(k,B,x){k.push({buffer:B,object:x,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(k){if(k!=za){switch(k){case THREE.AdditiveAlphaBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE);break;case THREE.SubtractiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,d.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ZERO,
+d.SRC_COLOR);break;default:d.blendEquationSeparate(d.FUNC_ADD,d.FUNC_ADD);d.blendFuncSeparate(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA,d.ONE,d.ONE_MINUS_SRC_ALPHA)}za=k}}function N(k,B,x){if((x.width&x.width-1)==0&&(x.height&x.height-1)==0){d.texParameteri(k,d.TEXTURE_WRAP_S,W(B.wrapS));d.texParameteri(k,d.TEXTURE_WRAP_T,W(B.wrapT));d.texParameteri(k,d.TEXTURE_MAG_FILTER,W(B.magFilter));d.texParameteri(k,d.TEXTURE_MIN_FILTER,W(B.minFilter));d.generateMipmap(k)}else{d.texParameteri(k,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);
+d.texParameteri(k,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(k,d.TEXTURE_MAG_FILTER,xa(B.magFilter));d.texParameteri(k,d.TEXTURE_MIN_FILTER,xa(B.minFilter))}}function O(k,B){if(k.needsUpdate){if(k.__webglInit){d.bindTexture(d.TEXTURE_2D,k.__webglTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,k.image)}else{k.__webglTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,k.__webglTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,k.image);k.__webglInit=!0}N(d.TEXTURE_2D,
+k,k.image);d.bindTexture(d.TEXTURE_2D,null);k.needsUpdate=!1}d.activeTexture(d.TEXTURE0+B);d.bindTexture(d.TEXTURE_2D,k.__webglTexture)}function Fa(k){if(k&&!k.__webglFramebuffer){k.__webglFramebuffer=d.createFramebuffer();k.__webglRenderbuffer=d.createRenderbuffer();k.__webglTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,k.__webglRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,k.width,k.height);d.bindTexture(d.TEXTURE_2D,k.__webglTexture);d.texParameteri(d.TEXTURE_2D,
+d.TEXTURE_WRAP_S,W(k.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,W(k.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,W(k.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,W(k.minFilter));d.texImage2D(d.TEXTURE_2D,0,W(k.format),k.width,k.height,0,W(k.format),W(k.type),null);d.bindFramebuffer(d.FRAMEBUFFER,k.__webglFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,k.__webglTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,
+d.RENDERBUFFER,k.__webglRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var B,x;if(k){B=k.__webglFramebuffer;x=k.width;k=k.height}else{B=null;x=Ca;k=fa}if(B!=Ga){d.bindFramebuffer(d.FRAMEBUFFER,B);d.viewport(U,ma,x,k);Ga=B}}function oa(k,B){var x;if(k=="fragment")x=d.createShader(d.FRAGMENT_SHADER);else k=="vertex"&&(x=d.createShader(d.VERTEX_SHADER));d.shaderSource(x,B);d.compileShader(x);if(!d.getShaderParameter(x,d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(x));
+console.error(B);return null}return x}function xa(k){switch(k){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;default:return d.LINEAR}}function W(k){switch(k){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 d,Z=document.createElement("canvas"),ya=null,Ga=null,Ha=!0,ra=this,X=null,qa=null,za=null,ea=null,U=0,ma=0,Ca=0,fa=0,ja=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Matrix4,Sa=new Float32Array(16),Xa=new Float32Array(16),Wa=new THREE.Vector4,
+Ta={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},M=!0,V=!0,na=new THREE.Color(0),Aa=0;if(a){if(a.stencil!=undefined)M=a.stencil;if(a.antialias!==undefined)V=a.antialias;a.clearColor!==undefined&&na.setHex(a.clearColor);if(a.clearAlpha!==undefined)Aa=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Z;this.autoClear=!0;this.sortObjects=!0;(function(k,B,x,p){try{if(!(d=Z.getContext("experimental-webgl",{antialias:k,stencil:p})))throw"Error creating WebGL context.";
+}catch(A){console.error(A)}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.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);d.clearColor(B.r,B.g,B.b,x)})(V,na,Aa,M);this.context=d;if(M){var ca={};ca.vertices=new Float32Array(12);ca.faces=new Uint16Array(6);ca.darkness=0.5;ca.vertices[0]=-2;ca.vertices[1]=-1;ca.vertices[2]=-1;ca.vertices[3]=2;ca.vertices[4]=-1;
+ca.vertices[5]=-1;ca.vertices[6]=2;ca.vertices[7]=1;ca.vertices[8]=-1;ca.vertices[9]=-2;ca.vertices[10]=1;ca.vertices[11]=-1;ca.faces[0]=0;ca.faces[1]=1;ca.faces[2]=2;ca.faces[3]=0;ca.faces[4]=2;ca.faces[5]=3;ca.vertexBuffer=d.createBuffer();ca.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,ca.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,ca.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,ca.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ca.faces,d.STATIC_DRAW);ca.program=
+d.createProgram();d.attachShader(ca.program,oa("fragment",THREE.ShaderLib.shadowPost.fragmentShader));d.attachShader(ca.program,oa("vertex",THREE.ShaderLib.shadowPost.vertexShader));d.linkProgram(ca.program);ca.vertexLocation=d.getAttribLocation(ca.program,"position");ca.projectionLocation=d.getUniformLocation(ca.program,"projectionMatrix");ca.darknessLocation=d.getUniformLocation(ca.program,"darkness")}var ga={};ga.vertices=new Float32Array(16);ga.faces=new Uint16Array(6);ga.transparency=0.5;a=0;
+ga.vertices[a++]=-1;ga.vertices[a++]=-1;ga.vertices[a++]=0;ga.vertices[a++]=0;ga.vertices[a++]=1;ga.vertices[a++]=-1;ga.vertices[a++]=1;ga.vertices[a++]=0;ga.vertices[a++]=1;ga.vertices[a++]=1;ga.vertices[a++]=1;ga.vertices[a++]=1;ga.vertices[a++]=-1;ga.vertices[a++]=1;ga.vertices[a++]=0;ga.vertices[a++]=1;a=0;ga.faces[a++]=0;ga.faces[a++]=1;ga.faces[a++]=2;ga.faces[a++]=0;ga.faces[a++]=2;ga.faces[a++]=3;ga.vertexBuffer=d.createBuffer();ga.elementBuffer=d.createBuffer();ga.tempTexture=d.createTexture();
+ga.readBackPixels=new Uint8Array(1024);d.bindBuffer(d.ARRAY_BUFFER,ga.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,ga.vertices,d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,ga.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ga.faces,d.STATIC_DRAW);d.bindTexture(d.TEXTURE_2D,ga.tempTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGB,16,16,0,d.RGB,d.UNSIGNED_BYTE,null);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_2D,
+d.TEXTURE_MAG_FILTER,d.NEAREST);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.NEAREST);ga.program=d.createProgram();d.attachShader(ga.program,oa("fragment",THREE.ShaderLib.lensFlare.fragmentShader));d.attachShader(ga.program,oa("vertex",THREE.ShaderLib.lensFlare.vertexShader));d.linkProgram(ga.program);ga.attributes={};ga.uniforms={};ga.attributes.vertex=d.getAttribLocation(ga.program,"position");ga.attributes.uv=d.getAttribLocation(ga.program,"UV");ga.uniforms.map=d.getUniformLocation(ga.program,
+"map");ga.uniforms.opacity=d.getUniformLocation(ga.program,"opacity");ga.uniforms.scale=d.getUniformLocation(ga.program,"scale");ga.uniforms.rotation=d.getUniformLocation(ga.program,"rotation");ga.uniforms.screenPosition=d.getUniformLocation(ga.program,"screenPosition");ga.uniforms.renderPink=d.getUniformLocation(ga.program,"renderPink");this.setSize=function(k,B){Z.width=k;Z.height=B;this.setViewport(0,0,Z.width,Z.height)};this.setViewport=function(k,B,x,p){U=k;ma=B;Ca=x;fa=p;d.viewport(U,ma,Ca,
+fa)};this.setScissor=function(k,B,x,p){d.scissor(k,B,x,p)};this.enableScissorTest=function(k){k?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(k){Ha=k;d.depthMask(k)};this.setClearColorHex=function(k,B){var x=new THREE.Color(k);d.clearColor(x.r,x.g,x.b,B)};this.setClearColor=function(k,B){d.clearColor(k.r,k.g,k.b,B)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT|d.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(k){ca.darkness=
+k};this.initMaterial=function(k,B,x,p){var A,F,H,K;if(k instanceof THREE.MeshDepthMaterial)b(k,THREE.ShaderLib.depth);else if(k instanceof THREE.ShadowVolumeDynamicMaterial)b(k,THREE.ShaderLib.shadowVolumeDynamic);else if(k instanceof THREE.MeshNormalMaterial)b(k,THREE.ShaderLib.normal);else if(k instanceof THREE.MeshBasicMaterial)b(k,THREE.ShaderLib.basic);else if(k instanceof THREE.MeshLambertMaterial)b(k,THREE.ShaderLib.lambert);else if(k instanceof THREE.MeshPhongMaterial)b(k,THREE.ShaderLib.phong);
+else if(k instanceof THREE.LineBasicMaterial)b(k,THREE.ShaderLib.basic);else k instanceof THREE.ParticleBasicMaterial&&b(k,THREE.ShaderLib.particle_basic);if(!k.program){var C,$,I;C=I=K=0;for(H=B.length;C<H;C++){$=B[C];$ instanceof THREE.DirectionalLight&&I++;$ instanceof THREE.PointLight&&K++}if(K+I<=4)B=I;else{B=Math.ceil(4*I/(K+I));K=4-B}K={directional:B,point:K};B=50;if(p!==undefined&&p instanceof THREE.SkinnedMesh)B=p.bones.length;H={map:k.map,envMap:k.envMap,lightMap:k.lightMap,vertexColors:k.vertexColors,
+fog:x,sizeAttenuation:k.sizeAttenuation,skinning:k.skinning,morphTargets:k.morphTargets,maxDirLights:K.directional,maxPointLights:K.point,maxBones:B};x=k.fragmentShader;K=k.vertexShader;B=d.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=[d.getParameter(d.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 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+d.attachShader(B,oa("fragment",C+x));d.attachShader(B,oa("vertex",H+K));d.linkProgram(B);d.getProgramParameter(B,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(B,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");B.uniforms={};B.attributes={};k.program=B;x=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(A in k.uniforms)x.push(A);
+A=k.program;K=0;for(B=x.length;K<B;K++){C=x[K];A.uniforms[C]=d.getUniformLocation(A,C)}x=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(A=0;A<this.maxMorphTargets;A++)x.push("morphTarget"+A);for(F in k.attributes)x.push(F);F=k.program;A=x;x=0;for(K=A.length;x<K;x++){B=A[x];F.attributes[B]=d.getAttribLocation(F,B)}F=k.program.attributes;d.enableVertexAttribArray(F.position);F.color>=0&&d.enableVertexAttribArray(F.color);F.normal>=0&&d.enableVertexAttribArray(F.normal);
+F.tangent>=0&&d.enableVertexAttribArray(F.tangent);if(k.skinning&&F.skinVertexA>=0&&F.skinVertexB>=0&&F.skinIndex>=0&&F.skinWeight>=0){d.enableVertexAttribArray(F.skinVertexA);d.enableVertexAttribArray(F.skinVertexB);d.enableVertexAttribArray(F.skinIndex);d.enableVertexAttribArray(F.skinWeight)}if(k.morphTargets){k.numSupportedMorphTargets=0;if(F.morphTarget0>=0){d.enableVertexAttribArray(F.morphTarget0);k.numSupportedMorphTargets++}if(F.morphTarget1>=0){d.enableVertexAttribArray(F.morphTarget1);
+k.numSupportedMorphTargets++}if(F.morphTarget2>=0){d.enableVertexAttribArray(F.morphTarget2);k.numSupportedMorphTargets++}if(F.morphTarget3>=0){d.enableVertexAttribArray(F.morphTarget3);k.numSupportedMorphTargets++}if(F.morphTarget4>=0){d.enableVertexAttribArray(F.morphTarget4);k.numSupportedMorphTargets++}if(F.morphTarget5>=0){d.enableVertexAttribArray(F.morphTarget5);k.numSupportedMorphTargets++}if(F.morphTarget6>=0){d.enableVertexAttribArray(F.morphTarget6);k.numSupportedMorphTargets++}if(F.morphTarget7>=
+0){d.enableVertexAttribArray(F.morphTarget7);k.numSupportedMorphTargets++}p.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);A=0;for(F=this.maxMorphTargets;A<F;A++)p.__webglMorphTargetInfluences[A]=0}}k.__webglProgram=!0};this.render=function(k,B,x,p){var A,F,H,K,C,$,I,la,Y=k.lights,ua=k.fog;B.matrixAutoUpdate&&B.updateMatrix();k.update(undefined,!1,B);B.matrixWorldInverse.flattenToArray(Xa);B.projectionMatrix.flattenToArray(Sa);Da.multiply(B.projectionMatrix,B.matrixWorldInverse);
+m(Da);this.initWebGLObjects(k);Fa(x);(this.autoClear||p)&&this.clear();C=k.__webglObjects.length;for(p=0;p<C;p++){A=k.__webglObjects[p];I=A.object;if(I.visible)if(!(I instanceof THREE.Mesh)||o(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);G(I,B);y(A);A.render=!0;if(this.sortObjects){Wa.copy(I.position);Da.multiplyVector3(Wa);A.z=Wa.z}}else A.render=!1;else A.render=!1}this.sortObjects&&k.__webglObjects.sort(w);$=k.__webglObjectsImmediate.length;for(p=0;p<$;p++){A=k.__webglObjectsImmediate[p];
+I=A.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);G(I,B);t(A)}}L(THREE.NormalBlending);for(p=0;p<C;p++){A=k.__webglObjects[p];if(A.render){I=A.object;la=A.buffer;H=A.opaque;h(I);for(A=0;A<H.count;A++){K=H.list[A];j(K.depthTest);f(B,Y,ua,K,la,I)}}}for(p=0;p<$;p++){A=k.__webglObjectsImmediate[p];I=A.object;if(I.visible){H=A.opaque;h(I);for(A=0;A<H.count;A++){K=H.list[A];j(K.depthTest);F=e(B,Y,ua,K,I);I.render(function(sa){g(sa,F)})}}}for(p=0;p<C;p++){A=
+k.__webglObjects[p];if(A.render){I=A.object;la=A.buffer;H=A.transparent;h(I);for(A=0;A<H.count;A++){K=H.list[A];L(K.blending);j(K.depthTest);f(B,Y,ua,K,la,I)}}}for(p=0;p<$;p++){A=k.__webglObjectsImmediate[p];I=A.object;if(I.visible){H=A.transparent;h(I);for(A=0;A<H.count;A++){K=H.list[A];L(K.blending);j(K.depthTest);F=e(B,Y,ua,K,I);I.render(function(sa){g(sa,F)})}}}M&&k.__webglShadowVolumes.length&&k.lights.length&&z(k);k.__webglLensFlares.length&&E(k,B);if(x&&x.minFilter!==THREE.NearestFilter&&x.minFilter!==
+THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,x.__webglTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=function(k){if(!k.__webglObjects){k.__webglObjects=[];k.__webglObjectsImmediate=[];k.__webglShadowVolumes=[];k.__webglLensFlares=[]}for(;k.__objectsAdded.length;){var B=k.__objectsAdded[0],x=k,p=void 0,A=void 0,F=void 0;if(B._modelViewMatrix==undefined){B._modelViewMatrix=new THREE.Matrix4;B._normalMatrixArray=new Float32Array(9);B._modelViewMatrixArray=
+new Float32Array(16);B._objectMatrixArray=new Float32Array(16);B.matrixWorld.flattenToArray(B._objectMatrixArray)}if(B instanceof THREE.Mesh){A=B.geometry;A.geometryGroups==undefined&&S(A);for(p in A.geometryGroups){F=A.geometryGroups[p];if(!F.__webglVertexBuffer){var H=F;H.__webglVertexBuffer=d.createBuffer();H.__webglNormalBuffer=d.createBuffer();H.__webglTangentBuffer=d.createBuffer();H.__webglColorBuffer=d.createBuffer();H.__webglUVBuffer=d.createBuffer();H.__webglUV2Buffer=d.createBuffer();H.__webglSkinVertexABuffer=
+d.createBuffer();H.__webglSkinVertexBBuffer=d.createBuffer();H.__webglSkinIndicesBuffer=d.createBuffer();H.__webglSkinWeightsBuffer=d.createBuffer();H.__webglFaceBuffer=d.createBuffer();H.__webglLineBuffer=d.createBuffer();if(H.numMorphTargets){var K=void 0,C=void 0;H.__webglMorphTargetsBuffers=[];K=0;for(C=H.numMorphTargets;K<C;K++)H.__webglMorphTargetsBuffers.push(d.createBuffer())}H=F;K=B;var $=void 0,I=void 0,la=void 0;la=void 0;var Y=C=0,ua=0;$=void 0;I=void 0;var sa=void 0;I=void 0;var Ea=K.geometry;
+sa=Ea.faces;var ka=H.faces;$=0;for(I=ka.length;$<I;$++){la=ka[$];la=sa[la];if(la instanceof THREE.Face3){C+=3;Y+=1;ua+=3}else if(la instanceof THREE.Face4){C+=4;Y+=2;ua+=4}}$=H;I=K;sa=void 0;ka=void 0;var va=void 0,ha=void 0;va=void 0;la=[];sa=0;for(ka=I.materials.length;sa<ka;sa++){va=I.materials[sa];if(va instanceof THREE.MeshFaceMaterial){va=0;for(l=$.materials.length;va<l;va++)(ha=$.materials[va])&&la.push(ha)}else(ha=va)&&la.push(ha)}I=la;a:{$=void 0;sa=void 0;ka=I.length;for($=0;$<ka;$++){sa=
+I[$];if(sa.map||sa.lightMap||sa instanceof THREE.MeshShaderMaterial){$=!0;break a}}$=!1}a:{sa=I;ka=void 0;la=void 0;va=sa.length;for(ka=0;ka<va;ka++){la=sa[ka];if(!(la instanceof THREE.MeshBasicMaterial&&!la.envMap||la instanceof THREE.MeshDepthMaterial)){sa=la&&la.shading!=undefined&&la.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}sa=!1}a:{ka=void 0;la=void 0;va=I.length;for(ka=0;ka<va;ka++){la=I[ka];if(la.vertexColors){I=la.vertexColors;break a}}I=!1}H.__vertexArray=
+new Float32Array(C*3);if(sa)H.__normalArray=new Float32Array(C*3);if(Ea.hasTangents)H.__tangentArray=new Float32Array(C*4);if(I)H.__colorArray=new Float32Array(C*3);if($){if(Ea.faceUvs.length>0||Ea.faceVertexUvs.length>0)H.__uvArray=new Float32Array(C*2);if(Ea.faceUvs.length>1||Ea.faceVertexUvs.length>1)H.__uv2Array=new Float32Array(C*2)}if(K.geometry.skinWeights.length&&K.geometry.skinIndices.length){H.__skinVertexAArray=new Float32Array(C*4);H.__skinVertexBArray=new Float32Array(C*4);H.__skinIndexArray=
+new Float32Array(C*4);H.__skinWeightArray=new Float32Array(C*4)}H.__faceArray=new Uint16Array(Y*3+(K.geometry.edgeFaces?K.geometry.edgeFaces.length*6:0));H.__lineArray=new Uint16Array(ua*2);if(H.numMorphTargets){Ea=void 0;ka=void 0;H.__morphTargetsArrays=[];Ea=0;for(ka=H.numMorphTargets;Ea<ka;Ea++)H.__morphTargetsArrays.push(new Float32Array(C*3))}H.__needsSmoothNormals=sa==THREE.SmoothShading;H.__uvType=$;H.__vertexColorType=I;H.__normalType=sa;H.__webglFaceCount=Y*3+(K.geometry.edgeFaces?K.geometry.edgeFaces.length*
+6:0);H.__webglLineCount=ua*2;A.__dirtyVertices=!0;A.__dirtyMorphTargets=!0;A.__dirtyElements=!0;A.__dirtyUvs=!0;A.__dirtyNormals=!0;A.__dirtyTangents=!0;A.__dirtyColors=!0}B instanceof THREE.ShadowVolume?D(x.__webglShadowVolumes,F,B):D(x.__webglObjects,F,B)}}else if(B instanceof THREE.LensFlare)D(x.__webglLensFlares,undefined,B);else if(B instanceof THREE.Ribbon){A=B.geometry;if(!A.__webglVertexBuffer){p=A;p.__webglVertexBuffer=d.createBuffer();p.__webglColorBuffer=d.createBuffer();p=A;F=p.vertices.length;
+p.__vertexArray=new Float32Array(F*3);p.__colorArray=new Float32Array(F*3);p.__webglVertexCount=F;A.__dirtyVertices=!0;A.__dirtyColors=!0}D(x.__webglObjects,A,B)}else if(B instanceof THREE.Line){A=B.geometry;if(!A.__webglVertexBuffer){p=A;p.__webglVertexBuffer=d.createBuffer();p.__webglColorBuffer=d.createBuffer();p=A;F=p.vertices.length;p.__vertexArray=new Float32Array(F*3);p.__colorArray=new Float32Array(F*3);p.__webglLineCount=F;A.__dirtyVertices=!0;A.__dirtyColors=!0}D(x.__webglObjects,A,B)}else if(B instanceof
+THREE.ParticleSystem){A=B.geometry;if(!A.__webglVertexBuffer){p=A;p.__webglVertexBuffer=d.createBuffer();p.__webglColorBuffer=d.createBuffer();p=A;F=p.vertices.length;p.__vertexArray=new Float32Array(F*3);p.__colorArray=new Float32Array(F*3);p.__sortArray=[];p.__webglParticleCount=F;A.__dirtyVertices=!0;A.__dirtyColors=!0}D(x.__webglObjects,A,B)}else THREE.MarchingCubes!==undefined&&B instanceof THREE.MarchingCubes&&x.__webglObjectsImmediate.push({object:B,opaque:{list:[],count:0},transparent:{list:[],
+count:0}});k.__objectsAdded.splice(0,1)}for(;k.__objectsRemoved.length;){B=k.__objectsRemoved[0];x=k;A=void 0;p=void 0;for(A=x.__webglObjects.length-1;A>=0;A--){p=x.__webglObjects[A].object;B==p&&x.__webglObjects.splice(A,1)}k.__objectsRemoved.splice(0,1)}B=0;for(x=k.__webglObjects.length;B<x;B++)J(k.__webglObjects[B].object,k);B=0;for(x=k.__webglShadowVolumes.length;B<x;B++)J(k.__webglShadowVolumes[B].object,k);B=0;for(x=k.__webglLensFlares.length;B<x;B++)J(k.__webglLensFlares[B].object,k)};this.setFaceCulling=
+function(k,B){if(k){!B||B=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(k=="back")d.cullFace(d.BACK);else k=="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,f=b?c.geometry:c,g=a.vertices,j=f.vertices,k=a.faces,m=f.faces,o=a.faceVertexUvs[0];f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,x=j.length;n<x;n++){var z=new THREE.Vertex(j[n].position.clone());b&&c.matrix.multiplyVector3(z.position);g.push(z)}n=0;for(x=m.length;n<x;n++){j=m[n];var y,B,F=j.vertexNormals;z=j.vertexColors;if(j instanceof THREE.Face3)y=new THREE.Face3(j.a+d,j.b+d,j.c+
-d);else j instanceof THREE.Face4&&(y=new THREE.Face4(j.a+d,j.b+d,j.c+d,j.d+d));y.normal.copy(j.normal);b=0;for(g=F.length;b<g;b++){B=F[b];y.vertexNormals.push(B.clone())}y.color.copy(j.color);b=0;for(g=z.length;b<g;b++){B=z[b];y.vertexColors.push(B.clone())}y.materials=j.materials.slice();y.centroid.copy(j.centroid);k.push(y)}n=0;for(x=f.length;n<x;n++){d=f[n];k=[];b=0;for(g=d.length;b<g;b++)k.push(new THREE.UV(d[b].u,d[b].v));o.push(k)}}},ImageUtils={loadTexture:function(a,c,b){var d=new Image,f=
-new THREE.Texture(d,c);d.onload=function(){f.needsUpdate=!0;b&&b(this)};d.src=a;return f},loadTextureCube:function(a,c,b){var d,f=[],g=new THREE.Texture(f,c);c=f.loadCount=0;for(d=a.length;c<d;++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,d){var f=new Worker(a);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);f.onmessage=function(j){function k(qa,Z){return Z=="relativeToHTML"?
-qa:g+"/"+qa}function m(){for(y in V.objects)if(!T.objects[y]){R=V.objects[y];if(N=T.geometries[R.geometry]){la=[];for(fa=0;fa<R.materials.length;fa++)la[fa]=T.materials[R.materials[fa]];D=R.position;r=R.rotation;q=R.quaternion;s=R.scale;q=0;la.length==0&&(la[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(N,la);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=R.visible;T.scene.addObject(object);T.objects[y]=object}}}function o(qa){return function(Z){T.geometries[qa]=Z;m();sa-=1;n()}}function n(){d({total_models:wa,total_textures:ia,loaded_models:wa-sa,loaded_textures:ia-va},T);sa==0&&va==0&&b(T)}var x,z,y,B,F,G,I,R,D,M,L,N,ma,e,la,V,$,X,sa,va,wa,ia,T;V=j.data;$=new THREE.BinaryLoader;X=new THREE.JSONLoader;va=sa=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};j=function(){va-=1;
-n()};for(F in V.cameras){M=V.cameras[F];if(M.type=="perspective")ma=new THREE.Camera(M.fov,M.aspect,M.near,M.far);else if(M.type=="ortho"){ma=new THREE.Camera;ma.projectionMatrix=THREE.Matrix4.makeOrtho(M.left,M.right,M.top,M.bottom,M.near,M.far)}D=M.position;M=M.target;ma.position.set(D[0],D[1],D[2]);ma.target.position.set(M[0],M[1],M[2]);T.cameras[F]=ma}for(B in V.lights){F=V.lights[B];ma=F.color!==undefined?F.color:16777215;M=F.intensity!==undefined?F.intensity:1;if(F.type=="directional"){D=F.direction;
-light=new THREE.DirectionalLight(ma,M);light.position.set(D[0],D[1],D[2]);light.position.normalize()}else if(F.type=="point"){D=F.position;light=new THREE.PointLight(ma,M);light.position.set(D[0],D[1],D[2])}T.scene.addLight(light);T.lights[B]=light}for(G in V.fogs){B=V.fogs[G];if(B.type=="linear")e=new THREE.Fog(0,B.near,B.far);else B.type=="exp2"&&(e=new THREE.FogExp2(0,B.density));M=B.color;e.color.setRGB(M[0],M[1],M[2]);T.fogs[G]=e}if(T.cameras&&V.defaults.camera)T.currentCamera=T.cameras[V.defaults.camera];
-if(T.fogs&&V.defaults.fog)T.scene.fog=T.fogs[V.defaults.fog];M=V.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(M[0],M[1],M[2]);T.bgColorAlpha=V.defaults.bgalpha;for(x in V.geometries){G=V.geometries[x];if(G.type=="bin_mesh"||G.type=="ascii_mesh")sa+=1}wa=sa;for(x in V.geometries){G=V.geometries[x];if(G.type=="cube"){N=new Cube(G.width,G.height,G.depth,G.segmentsWidth,G.segmentsHeight,G.segmentsDepth,null,G.flipped,G.sides);T.geometries[x]=N}else if(G.type=="plane"){N=new Plane(G.width,
-G.height,G.segmentsWidth,G.segmentsHeight);T.geometries[x]=N}else if(G.type=="sphere"){N=new Sphere(G.radius,G.segmentsWidth,G.segmentsHeight);T.geometries[x]=N}else if(G.type=="cylinder"){N=new Cylinder(G.numSegs,G.topRad,G.botRad,G.height,G.topOffset,G.botOffset);T.geometries[x]=N}else if(G.type=="torus"){N=new Torus(G.radius,G.tube,G.segmentsR,G.segmentsT);T.geometries[x]=N}else if(G.type=="icosahedron"){N=new Icosahedron(G.subdivisions);T.geometries[x]=N}else if(G.type=="bin_mesh")$.load({model:k(G.url,
-V.urlBaseType),callback:o(x)});else G.type=="ascii_mesh"&&X.load({model:k(G.url,V.urlBaseType),callback:o(x)})}for(I in V.textures){x=V.textures[I];va+=x.url instanceof Array?x.url.length:1}ia=va;for(I in V.textures){x=V.textures[I];if(x.mapping!=undefined&&THREE[x.mapping]!=undefined)x.mapping=new THREE[x.mapping];if(x.url instanceof Array){G=[];for(var fa=0;fa<x.url.length;fa++)G[fa]=k(x.url[fa],V.urlBaseType);G=ImageUtils.loadTextureCube(G,x.mapping,j)}else{G=ImageUtils.loadTexture(k(x.url,V.urlBaseType),
-x.mapping,j);if(THREE[x.minFilter]!=undefined)G.minFilter=THREE[x.minFilter];if(THREE[x.magFilter]!=undefined)G.magFilter=THREE[x.magFilter]}T.textures[I]=G}for(z in V.materials){I=V.materials[z];for(L in I.parameters)if(L=="envMap"||L=="map"||L=="lightMap")I.parameters[L]=T.textures[I.parameters[L]];else if(L=="shading")I.parameters[L]=I.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")I.parameters[L]=THREE[I.parameters[L]]?THREE[I.parameters[L]]:THREE.NormalBlending;
-else L=="combine"&&(I.parameters[L]=I.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);I=new THREE[I.type](I.parameters);T.materials[z]=I}m();c(T)}},addMesh:function(a,c,b,d,f,g,j,k,m,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=f;c.position.z=g;c.rotation.x=j;c.rotation.y=k;c.rotation.z=m;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 f=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,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,c,1,0,-d,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,d,f=a.children.length;for(d=0;d<f;d++){b=a.children[d];c(b);SceneUtils.traverseHierarchy(b,c)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",
+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,j=a.faces,m=f.faces,o=a.faceVertexUvs[0];f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var n=0,t=h.length;n<t;n++){var y=new THREE.Vertex(h[n].position.clone());b&&c.matrix.multiplyVector3(y.position);g.push(y)}n=0;for(t=m.length;n<t;n++){h=m[n];var w,z,E=h.vertexNormals;y=h.vertexColors;if(h instanceof THREE.Face3)w=new THREE.Face3(h.a+e,h.b+e,h.c+
+e);else h instanceof THREE.Face4&&(w=new THREE.Face4(h.a+e,h.b+e,h.c+e,h.d+e));w.normal.copy(h.normal);b=0;for(g=E.length;b<g;b++){z=E[b];w.vertexNormals.push(z.clone())}w.color.copy(h.color);b=0;for(g=y.length;b<g;b++){z=y[b];w.vertexColors.push(z.clone())}w.materials=h.materials.slice();w.centroid.copy(h.centroid);j.push(w)}n=0;for(t=f.length;n<t;n++){e=f[n];j=[];b=0;for(g=e.length;b<g;b++)j.push(new THREE.UV(e[b].u,e[b].v));o.push(j)}}},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 j(za,ea){return ea=="relativeToHTML"?
+za:g+"/"+za}function m(){for(w in W.objects)if(!X.objects[w]){S=W.objects[w];if(O=X.geometries[S.geometry]){xa=[];for(qa=0;qa<S.materials.length;qa++)xa[qa]=X.materials[S.materials[qa]];D=S.position;r=S.rotation;q=S.quaternion;s=S.scale;q=0;xa.length==0&&(xa[0]=new THREE.MeshFaceMaterial);object=new THREE.Mesh(O,xa);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=S.visible;X.scene.addObject(object);X.objects[w]=object}}}function o(za){return function(ea){X.geometries[za]=ea;m();ya-=1;n()}}function n(){e({total_models:Ha,total_textures:ra,loaded_models:Ha-ya,loaded_textures:ra-Ga},X);ya==0&&Ga==0&&b(X)}var t,y,w,z,E,G,J,S,D,L,N,O,Fa,oa,xa,W,d,Z,ya,Ga,Ha,ra,X;W=h.data;d=new THREE.BinaryLoader;Z=new THREE.JSONLoader;Ga=ya=0;X={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};h=function(){Ga-=
+1;n()};for(E in W.cameras){L=W.cameras[E];if(L.type=="perspective")Fa=new THREE.Camera(L.fov,L.aspect,L.near,L.far);else if(L.type=="ortho"){Fa=new THREE.Camera;Fa.projectionMatrix=THREE.Matrix4.makeOrtho(L.left,L.right,L.top,L.bottom,L.near,L.far)}D=L.position;L=L.target;Fa.position.set(D[0],D[1],D[2]);Fa.target.position.set(L[0],L[1],L[2]);X.cameras[E]=Fa}for(z in W.lights){E=W.lights[z];Fa=E.color!==undefined?E.color:16777215;L=E.intensity!==undefined?E.intensity:1;if(E.type=="directional"){D=
+E.direction;light=new THREE.DirectionalLight(Fa,L);light.position.set(D[0],D[1],D[2]);light.position.normalize()}else if(E.type=="point"){D=E.position;light=new THREE.PointLight(Fa,L);light.position.set(D[0],D[1],D[2])}X.scene.addLight(light);X.lights[z]=light}for(G in W.fogs){z=W.fogs[G];if(z.type=="linear")oa=new THREE.Fog(0,z.near,z.far);else z.type=="exp2"&&(oa=new THREE.FogExp2(0,z.density));L=z.color;oa.color.setRGB(L[0],L[1],L[2]);X.fogs[G]=oa}if(X.cameras&&W.defaults.camera)X.currentCamera=
+X.cameras[W.defaults.camera];if(X.fogs&&W.defaults.fog)X.scene.fog=X.fogs[W.defaults.fog];L=W.defaults.bgcolor;X.bgColor=new THREE.Color;X.bgColor.setRGB(L[0],L[1],L[2]);X.bgColorAlpha=W.defaults.bgalpha;for(t in W.geometries){G=W.geometries[t];if(G.type=="bin_mesh"||G.type=="ascii_mesh")ya+=1}Ha=ya;for(t in W.geometries){G=W.geometries[t];if(G.type=="cube"){O=new Cube(G.width,G.height,G.depth,G.segmentsWidth,G.segmentsHeight,G.segmentsDepth,null,G.flipped,G.sides);X.geometries[t]=O}else if(G.type==
+"plane"){O=new Plane(G.width,G.height,G.segmentsWidth,G.segmentsHeight);X.geometries[t]=O}else if(G.type=="sphere"){O=new Sphere(G.radius,G.segmentsWidth,G.segmentsHeight);X.geometries[t]=O}else if(G.type=="cylinder"){O=new Cylinder(G.numSegs,G.topRad,G.botRad,G.height,G.topOffset,G.botOffset);X.geometries[t]=O}else if(G.type=="torus"){O=new Torus(G.radius,G.tube,G.segmentsR,G.segmentsT);X.geometries[t]=O}else if(G.type=="icosahedron"){O=new Icosahedron(G.subdivisions);X.geometries[t]=O}else if(G.type==
+"bin_mesh")d.load({model:j(G.url,W.urlBaseType),callback:o(t)});else G.type=="ascii_mesh"&&Z.load({model:j(G.url,W.urlBaseType),callback:o(t)})}for(J in W.textures){t=W.textures[J];Ga+=t.url instanceof Array?t.url.length:1}ra=Ga;for(J in W.textures){t=W.textures[J];if(t.mapping!=undefined&&THREE[t.mapping]!=undefined)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){G=[];for(var qa=0;qa<t.url.length;qa++)G[qa]=j(t.url[qa],W.urlBaseType);G=ImageUtils.loadTextureCube(G,t.mapping,h)}else{G=ImageUtils.loadTexture(j(t.url,
+W.urlBaseType),t.mapping,h);if(THREE[t.minFilter]!=undefined)G.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=undefined)G.magFilter=THREE[t.magFilter]}X.textures[J]=G}for(y in W.materials){J=W.materials[y];for(N in J.parameters)if(N=="envMap"||N=="map"||N=="lightMap")J.parameters[N]=X.textures[J.parameters[N]];else if(N=="shading")J.parameters[N]=J.parameters[N]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(N=="blending")J.parameters[N]=THREE[J.parameters[N]]?THREE[J.parameters[N]]:THREE.NormalBlending;
+else N=="combine"&&(J.parameters[N]=J.parameters[N]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);J=new THREE[J.type](J.parameters);X.materials[y]=J}m();c(X)}},addMesh:function(a,c,b,e,f,g,h,j,m,o){c=new THREE.Mesh(c,o);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=j;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},
@@ -340,86 +355,87 @@ 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,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;b=Array(g);for(c=d=0;c<g;++c){b[c]=Math.exp(-((c-f)*(c-f))/(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.activeLook=!0;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.activeLook=!0;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.activeLook!==undefined)this.activeLook=a.activeLook;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.activeLook)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.activeLook)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.activeLook||(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.activeLook||(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(o,n,x,z){var y={name:x,fps:0.6,length:z,hierarchy:[]},B,F=n.getControlPointsArray(),G=n.getLength(),I=F.length,R=0;B=I-1;n={parent:-1,keys:[]};n.keys[0]={time:0,pos:F[0],rot:[0,0,0,1],scl:[1,1,1]};n.keys[B]={time:z,pos:F[B],rot:[0,0,0,1],scl:[1,1,1]};for(B=1;B<I-1;B++){R=z*G.chunks[B]/G.total;n.keys[B]={time:R,pos:F[B]}}y.hierarchy[0]=n;THREE.AnimationHandler.add(y);return new THREE.Animation(o,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(o,n){var x,
-z,y=new THREE.Geometry;for(x=0;x<o.points.length*n;x++){z=x/(o.points.length*n);z=o.getPoint(z);y.vertices[x]=new THREE.Vertex(new THREE.Vector3(z.x,z.y,z.z))}return y}function d(o,n){var x=b(n,10),z=b(n,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);o.addChild(lineObj);particleObj.scale.set(1,1,1);o.addChild(particleObj);z=new Sphere(1,
-16,8);y=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<n.points.length;i++){x=new THREE.Mesh(z,y);x.position.copy(n.points[i]);x.updateMatrix();o.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(o,n,t,y){var w={name:t,fps:0.6,length:y,hierarchy:[]},z,E=n.getControlPointsArray(),G=n.getLength(),J=E.length,S=0;z=J-1;n={parent:-1,keys:[]};n.keys[0]={time:0,pos:E[0],rot:[0,0,0,1],scl:[1,1,1]};n.keys[z]={time:y,pos:E[z],rot:[0,0,0,1],scl:[1,1,1]};for(z=1;z<J-1;z++){S=y*G.chunks[z]/G.total;n.keys[z]={time:S,pos:E[z]}}w.hierarchy[0]=n;THREE.AnimationHandler.add(w);return new THREE.Animation(o,t,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(o,n){var t,
+y,w=new THREE.Geometry;for(t=0;t<o.points.length*n;t++){y=t/(o.points.length*n);y=o.getPoint(y);w.vertices[t]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return w}function e(o,n){var t=b(n,10),y=b(n,10),w=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(t,w);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);o.addChild(lineObj);particleObj.scale.set(1,1,1);o.addChild(particleObj);y=new Sphere(1,
+16,8);w=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<n.points.length;i++){t=new THREE.Mesh(y,w);t.position.copy(n.points[i]);t.updateMatrix();o.addChild(t)}}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 f=Math.PI*2,g=Math.PI/180;this.update=function(o,n,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,o,n,x)};this.onMouseMove=function(o){this.mouseX=o.clientX-this.windowHalfX;this.mouseY=o.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 j=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,j);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(o,n){return function(){n.apply(o,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,f,g,j,k,m){function o(G,I,R,D,M,L,N,ma){var e,la,V=d||1,$=f||1,X=M/2,sa=L/2,va=n.vertices.length;if(G=="x"&&I=="y"||G=="y"&&I=="x")e="z";else if(G=="x"&&I=="z"||G=="z"&&I=="x"){e="y";$=g||1}else if(G=="z"&&I=="y"||G=="y"&&I=="z"){e="x";V=g||1}var wa=V+1,ia=$+1;M/=V;var T=L/$;for(la=0;la<ia;la++)for(L=0;L<wa;L++){var fa=new THREE.Vector3;fa[G]=(L*M-X)*R;fa[I]=(la*T-sa)*D;fa[e]=N;n.vertices.push(new THREE.Vertex(fa))}for(la=0;la<$;la++)for(L=0;L<V;L++){n.faces.push(new THREE.Face4(L+
-wa*la+va,L+wa*(la+1)+va,L+1+wa*(la+1)+va,L+1+wa*la+va,null,null,ma));n.faceVertexUvs[0].push([new THREE.UV(L/V,la/$),new THREE.UV(L/V,(la+1)/$),new THREE.UV((L+1)/V,(la+1)/$),new THREE.UV((L+1)/V,la/$)])}}THREE.Geometry.call(this);var n=this,x=a/2,z=c/2,y=b/2;k=k?-1:1;if(j!==undefined)if(j instanceof Array)this.materials=j;else{this.materials=[];for(var B=0;B<6;B++)this.materials.push([j])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(m!=undefined)for(var F in m)this.sides[F]!=
-undefined&&(this.sides[F]=m[F]);this.sides.px&&o("z","y",1*k,-1,b,c,-x,this.materials[0]);this.sides.nx&&o("z","y",-1*k,-1,b,c,x,this.materials[1]);this.sides.py&&o("x","z",1*k,1,a,b,z,this.materials[2]);this.sides.ny&&o("x","z",1*k,-1,a,b,-z,this.materials[3]);this.sides.pz&&o("x","y",1*k,-1,a,c,y,this.materials[4]);this.sides.nz&&o("x","y",-1*k,-1,a,c,-y,this.materials[5]);(function(){for(var G=[],I=[],R=0,D=n.vertices.length;R<D;R++){for(var M=n.vertices[R],L=!1,N=0,ma=G.length;N<ma;N++){var e=
-G[N];if(M.position.x==e.position.x&&M.position.y==e.position.y&&M.position.z==e.position.z){I[R]=N;L=!0;break}}if(!L){I[R]=G.length;G.push(new THREE.Vertex(M.position.clone()))}}R=0;for(D=n.faces.length;R<D;R++){M=n.faces[R];M.a=I[M.a];M.b=I[M.b];M.c=I[M.c];M.d=I[M.d]}n.vertices=G})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
-var Cylinder=function(a,c,b,d,f,g){function j(n,x,z){k.vertices.push(new THREE.Vertex(new THREE.Vector3(n,x,z)))}THREE.Geometry.call(this);var k=this,m=Math.PI,o=d/2;for(d=0;d<a;d++)j(Math.sin(2*m*d/a)*c,Math.cos(2*m*d/a)*c,-o);for(d=0;d<a;d++)j(Math.sin(2*m*d/a)*b,Math.cos(2*m*d/a)*b,o);for(d=0;d<a;d++)k.faces.push(new THREE.Face4(d,d+a,a+(d+1)%a,(d+1)%a));if(b>0){j(0,0,-o-(g||0));for(d=a;d<a+a/2;d++)k.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){j(0,0,o+(f||0));
-for(d=a+a/2;d<2*a;d++)k.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 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 d(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,j;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++){j=new THREE.Geometry;for(var k in g.faces){var m=d(g.faces[k].a,g.faces[k].b),o=d(g.faces[k].b,g.faces[k].c),n=d(g.faces[k].c,g.faces[k].a);b(g.faces[k].a,m,n,j);b(g.faces[k].b,o,m,j);b(g.faces[k].c,
-n,o,j);b(m,o,n,j)}g.faces=j.faces}f.faces=g.faces;delete g;delete j;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=[],f=[],g=[],j=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));d[k]=a[k].clone();f[k]=this.vertices.length-1}for(var m=(new THREE.Matrix4).setRotationZ(c),o=0;o<=this.angle+0.0010;o+=c){for(k=0;k<d.length;k++)if(o<this.angle){d[k]=m.multiplyVector3(d[k].clone());this.vertices.push(new THREE.Vertex(d[k]));g[k]=this.vertices.length-1}else g=j;o==0&&(j=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(o/b,k/a.length),new THREE.UV(o/b,(k+1)/a.length),new THREE.UV((o-c)/b,(k+1)/a.length),new THREE.UV((o-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,d){THREE.Geometry.call(this);var f,g=a/2,j=c/2;b=b||1;d=d||1;var k=b+1,m=d+1;a/=b;var o=c/d;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*o-j),0)));for(f=0;f<d;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/d),new THREE.UV(c/b,(f+1)/d),new THREE.UV((c+1)/b,(f+1)/d),new THREE.UV((c+1)/b,f/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(o,n,t){var y,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)*g;this.theta=this.lon*g;y=this.phi%f;this.phi=y>=0?y:y+f;y=this.verticalAngleMap.srcRange;w=this.verticalAngleMap.dstRange;
+this.phi=(this.phi-y[0])*(w[1]-w[0])/(y[1]-y[0])+w[0];y=this.horizontalAngleMap.srcRange;w=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(w[1]-w[0])/(y[1]-y[0])+w[0];y=this.target.position;y.x=100*Math.sin(this.phi)*Math.cos(this.theta);y.y=100*Math.cos(this.phi);y.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,o,n,t)};this.onMouseMove=function(o){this.mouseX=o.clientX-this.windowHalfX;this.mouseY=o.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),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(j,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(o,n){return function(){n.apply(o,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,j,m){function o(G,J,S,D,L,N,O,Fa){var oa,xa,W=e||1,d=f||1,Z=L/2,ya=N/2,Ga=n.vertices.length;if(G=="x"&&J=="y"||G=="y"&&J=="x")oa="z";else if(G=="x"&&J=="z"||G=="z"&&J=="x"){oa="y";d=g||1}else if(G=="z"&&J=="y"||G=="y"&&J=="z"){oa="x";W=g||1}var Ha=W+1,ra=d+1;L/=W;var X=N/d;for(xa=0;xa<ra;xa++)for(N=0;N<Ha;N++){var qa=new THREE.Vector3;qa[G]=(N*L-Z)*S;qa[J]=(xa*X-ya)*D;qa[oa]=O;n.vertices.push(new THREE.Vertex(qa))}for(xa=0;xa<d;xa++)for(N=0;N<W;N++){n.faces.push(new THREE.Face4(N+
+Ha*xa+Ga,N+Ha*(xa+1)+Ga,N+1+Ha*(xa+1)+Ga,N+1+Ha*xa+Ga,null,null,Fa));n.faceVertexUvs[0].push([new THREE.UV(N/W,xa/d),new THREE.UV(N/W,(xa+1)/d),new THREE.UV((N+1)/W,(xa+1)/d),new THREE.UV((N+1)/W,xa/d)])}}THREE.Geometry.call(this);var n=this,t=a/2,y=c/2,w=b/2;j=j?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var z=0;z<6;z++)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 E in m)this.sides[E]!=
+undefined&&(this.sides[E]=m[E]);this.sides.px&&o("z","y",1*j,-1,b,c,-t,this.materials[0]);this.sides.nx&&o("z","y",-1*j,-1,b,c,t,this.materials[1]);this.sides.py&&o("x","z",1*j,1,a,b,y,this.materials[2]);this.sides.ny&&o("x","z",1*j,-1,a,b,-y,this.materials[3]);this.sides.pz&&o("x","y",1*j,-1,a,c,w,this.materials[4]);this.sides.nz&&o("x","y",-1*j,-1,a,c,-w,this.materials[5]);(function(){for(var G=[],J=[],S=0,D=n.vertices.length;S<D;S++){for(var L=n.vertices[S],N=!1,O=0,Fa=G.length;O<Fa;O++){var oa=
+G[O];if(L.position.x==oa.position.x&&L.position.y==oa.position.y&&L.position.z==oa.position.z){J[S]=O;N=!0;break}}if(!N){J[S]=G.length;G.push(new THREE.Vertex(L.position.clone()))}}S=0;for(D=n.faces.length;S<D;S++){L=n.faces[S];L.a=J[L.a];L.b=J[L.b];L.c=J[L.c];L.d=J[L.d]}n.vertices=G})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
+var Cylinder=function(a,c,b,e,f,g){function h(n,t,y){j.vertices.push(new THREE.Vertex(new THREE.Vector3(n,t,y)))}THREE.Geometry.call(this);var j=this,m=Math.PI,o=e/2;for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*c,Math.cos(2*m*e/a)*c,-o);for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*b,Math.cos(2*m*e/a)*b,o);for(e=0;e<a;e++)j.faces.push(new THREE.Face4(e,e+a,a+(e+1)%a,(e+1)%a));if(b>0){h(0,0,-o-(g||0));for(e=a;e<a+a/2;e++)j.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,o+(f||0));
+for(e=a+a/2;e<2*a;e++)j.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(t,y,w){var z=Math.sqrt(t*t+y*y+w*w);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(t/z,y/z,w/z)))-1}function b(t,y,w,z){z.faces.push(new THREE.Face3(t,y,w))}function e(t,y){var w=f.vertices[t].position,z=f.vertices[y].position;return c((w.x+z.x)/2,(w.y+z.y)/2,(w.z+z.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 j in g.faces){var m=e(g.faces[j].a,g.faces[j].b),o=e(g.faces[j].b,g.faces[j].c),n=e(g.faces[j].c,g.faces[j].a);b(g.faces[j].a,m,n,h);b(g.faces[j].b,o,m,h);b(g.faces[j].c,
+n,o,h);b(m,o,n,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=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));e[j]=a[j].clone();f[j]=this.vertices.length-1}for(var m=(new THREE.Matrix4).setRotationZ(c),o=0;o<=this.angle+0.0010;o+=c){for(j=0;j<e.length;j++)if(o<this.angle){e[j]=m.multiplyVector3(e[j].clone());this.vertices.push(new THREE.Vertex(e[j]));g[j]=this.vertices.length-1}else g=h;o==0&&(h=f);for(j=
+0;j<f.length-1;j++){this.faces.push(new THREE.Face4(g[j],g[j+1],f[j+1],f[j]));this.faceVertexUvs[0].push([new THREE.UV(o/b,j/a.length),new THREE.UV(o/b,(j+1)/a.length),new THREE.UV((o-c)/b,(j+1)/a.length),new THREE.UV((o-c)/b,j/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 j=b+1,m=e+1;a/=b;var o=c/e;for(f=0;f<m;f++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*o-h),0)));for(f=0;f<e;f++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+j*f,c+j*(f+1),c+1+j*(f+1),c+1+j*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,f=Math.PI,g=Math.max(3,c||8),j=Math.max(2,b||6);c=[];for(b=0;b<j+1;b++){d=b/j;var k=a*Math.cos(d*f),m=a*Math.sin(d*f),o=[],n=0;for(d=0;d<g;d++){var x=2*d/g,z=m*Math.sin(x*f);x=m*Math.cos(x*f);(b==0||b==j)&&d>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,z)))-1);o.push(n)}c.push(o)}var y,B,F;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){o=d==g-1;j=c[b][o?0:d+1];k=c[b][o?g-1:d];m=c[b-1][o?g-1:d];o=c[b-1][o?
-0:d+1];z=b/(f-1);y=(b-1)/(f-1);B=(d+1)/g;x=d/g;n=new THREE.UV(1-B,z);z=new THREE.UV(1-x,z);x=new THREE.UV(1-x,y);var G=new THREE.UV(1-B,y);if(b<c.length-1){y=this.vertices[j].position.clone();B=this.vertices[k].position.clone();F=this.vertices[m].position.clone();y.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,k,m,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([n,z,x])}if(b>1){y=this.vertices[j].position.clone();
-B=this.vertices[m].position.clone();F=this.vertices[o].position.clone();y.normalize();B.normalize();F.normalize();this.faces.push(new THREE.Face3(j,m,o,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(B.x,B.y,B.z),new THREE.Vector3(F.x,F.y,F.z)]));this.faceVertexUvs[0].push([n,x,G])}}}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 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(d),(this.radius+this.tube*Math.cos(f))*Math.sin(d),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){d=(this.segmentsT+1)*c+b;f=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,j=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,f,g,j));this.faceVertexUvs[0].push([new THREE.UV(a[d][0],a[d][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[j][0],a[j][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,f,g,j){function k(x,z,y,B,F,G){z=y/B*x;y=Math.cos(z);return new THREE.Vector3(F*(2+y)*0.5*Math.cos(x),F*(2+y)*Math.sin(x)*0.5,G*F*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=f||2;this.q=g||3;this.heightScale=j||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 m=
-a/this.segmentsR*2*this.p*Math.PI;j=c/this.segmentsT*2*Math.PI;f=k(m,j,this.q,this.p,this.radius,this.heightScale);m=k(m+0.01,j,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;d.x=m.x+f.x;d.y=m.y+f.y;d.z=m.z+f.z;g.cross(b,d);d.cross(g,b);g.normalize();d.normalize();m=this.tube*Math.cos(j);j=this.tube*Math.sin(j);f.x+=m*d.x+j*g.x;f.y+=m*d.y+j*g.y;f.z+=m*d.z+j*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;j=(c+1)%this.segmentsT;f=this.grid[a][c];b=this.grid[g][c];d=this.grid[a][j];g=this.grid[g][j];j=new THREE.UV(a/this.segmentsR,c/this.segmentsT);m=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var o=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),n=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(f,b,d));this.faceVertexUvs[0].push([j,m,o]);this.faces.push(new THREE.Face3(g,d,b));this.faceVertexUvs[0].push([n,
+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 j=a*Math.cos(e*f),m=a*Math.sin(e*f),o=[],n=0;for(e=0;e<g;e++){var t=2*e/g,y=m*Math.sin(t*f);t=m*Math.cos(t*f);(b==0||b==h)&&e>0||(n=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,j,y)))-1);o.push(n)}c.push(o)}var w,z,E;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(e=0;e<g;e++){o=e==g-1;h=c[b][o?0:e+1];j=c[b][o?g-1:e];m=c[b-1][o?g-1:e];o=c[b-1][o?
+0:e+1];y=b/(f-1);w=(b-1)/(f-1);z=(e+1)/g;t=e/g;n=new THREE.UV(1-z,y);y=new THREE.UV(1-t,y);t=new THREE.UV(1-t,w);var G=new THREE.UV(1-z,w);if(b<c.length-1){w=this.vertices[h].position.clone();z=this.vertices[j].position.clone();E=this.vertices[m].position.clone();w.normalize();z.normalize();E.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(E.x,E.y,E.z)]));this.faceVertexUvs[0].push([n,y,t])}if(b>1){w=this.vertices[h].position.clone();
+z=this.vertices[m].position.clone();E=this.vertices[o].position.clone();w.normalize();z.normalize();E.normalize();this.faces.push(new THREE.Face3(h,m,o,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(E.x,E.y,E.z)]));this.faceVertexUvs[0].push([n,t,G])}}}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 j(t,y,w,z,E,G){y=w/z*t;w=Math.cos(y);return new THREE.Vector3(E*(2+w)*0.5*Math.cos(t),E*(2+w)*Math.sin(t)*0.5,G*E*Math.sin(y)*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=j(m,h,this.q,this.p,this.radius,this.heightScale);m=j(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 o=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),n=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,o]);this.faces.push(new THREE.Face3(g,e,b));this.faceVertexUvs[0].push([n,
 o,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 d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,m){var o=new Image;o.onload=function(){if(!b(this.width)||!b(this.height)){var n=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=n;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,n,x)}else k.image=this;k.needsUpdate=!0};o.src=m}var f,g,j;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){j=document.createElement("canvas");g.map=new THREE.Texture(j);g.map.sourceFile=a.mapDiffuse;
-d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){j=(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=j;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){j=document.createElement("canvas");g.lightMap=new THREE.Texture(j);g.lightMap.sourceFile=a.mapLightmap;d(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,d=a.callback,f=a.texture_path?a.texture_path:this.extractUrlbase(b);a=new Worker(b);a.onmessage=function(g){c.createModel(g.data,d,f);c.onLoadComplete()};this.onLoadStart();a.postMessage((new Date).getTime())};
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry;this.init_materials(d,a.materials,b);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");else{var f,g,j,k,m,o,n,x,z,y,B=a.faces;x=a.vertices;var F=a.normals,G=a.colors,I=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&I++;for(f=0;f<I;f++){d.faceUvs[f]=[];d.faceVertexUvs[f]=[]}k=0;for(m=x.length;k<m;){z=new THREE.Vertex;z.position.x=x[k++];z.position.y=x[k++];z.position.z=x[k++];d.vertices.push(z)}k=
-0;for(m=B.length;k<m;){o=B[k++];n=o&1;j=o&2;f=o&4;g=o&8;x=o&16;z=o&32;y=o&64;o&=128;if(n){n=new THREE.Face4;n.a=B[k++];n.b=B[k++];n.c=B[k++];n.d=B[k++];nVertices=4}else{n=new THREE.Face3;n.a=B[k++];n.b=B[k++];n.c=B[k++];nVertices=3}if(j){materialIndex=B[k++];n.materials=d.materials[materialIndex]}j=d.faces.length;if(f)for(f=0;f<I;f++){uvLayer=a.uvs[f];uvIndex=B[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];d.faceUvs[f][j]=new THREE.UV(u,v)}if(g)for(f=0;f<I;f++){uvLayer=a.uvs[f];uvs=[];for(g=0;g<
-nVertices;g++){uvIndex=B[k++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[g]=new THREE.UV(u,v)}d.faceVertexUvs[f][j]=uvs}if(x){normalIndex=B[k++]*3;normal=new THREE.Vector3;normal.x=F[normalIndex++];normal.y=F[normalIndex++];normal.z=F[normalIndex];n.normal=normal}if(z)for(f=0;f<nVertices;f++){normalIndex=B[k++]*3;normal=new THREE.Vector3;normal.x=F[normalIndex++];normal.y=F[normalIndex++];normal.z=F[normalIndex];n.vertexNormals.push(normal)}if(y){color=new THREE.Color(B[k++]);n.color=color}if(o)for(f=
-0;f<nVertices;f++){colorIndex=B[k++];color=new THREE.Color(G[colorIndex]);n.vertexColors.push(color)}d.faces.push(n)}}})();(function(){var f,g,j,k;if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f+=2){j=a.skinWeights[f];k=a.skinWeights[f+1];d.skinWeights.push(new THREE.Vector4(j,k,0,0))}}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f+=2){j=a.skinIndices[f];k=a.skinIndices[f+1];d.skinIndices.push(new THREE.Vector4(j,k,0,0))}}d.bones=a.bones;d.animation=a.animation})();(function(){if(a.morphTargets!==
-undefined){var f,g,j,k;f=0;for(g=a.morphTargets.length;f<g;f++){d.morphTargets[f]={};d.morphTargets[f].name=a.morphTargets[f].name;d.morphTargets[f].vertices=[];dstVertices=d.morphTargets[f].vertices;srcVertices=a.morphTargets[f].vertices;j=0;for(k=srcVertices.length;j<k;j+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[j],srcVertices[j+1],srcVertices[j+2])))}}})();d.computeCentroids();d.computeFaceNormals();c(d)};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};
+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(j){j=Math.log(j)/Math.LN2;return Math.floor(j)==j}function e(j,m){var o=new Image;o.onload=function(){if(!b(this.width)||!b(this.height)){var n=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),t=Math.pow(2,Math.round(Math.log(this.height)/
+Math.LN2));j.image.width=n;j.image.height=t;j.image.getContext("2d").drawImage(this,0,0,n,t)}else j.image=this;j.needsUpdate=!0};o.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,j,m,o,n,t,y,w,z=a.faces;t=a.vertices;var E=a.normals,G=a.colors,J=0;for(f=0;f<a.uvs.length;f++)a.uvs[f].length&&J++;for(f=0;f<J;f++){e.faceUvs[f]=[];e.faceVertexUvs[f]=[]}j=0;for(m=t.length;j<m;){y=new THREE.Vertex;y.position.x=t[j++];y.position.y=t[j++];y.position.z=t[j++];e.vertices.push(y)}j=
+0;for(m=z.length;j<m;){o=z[j++];n=o&1;h=o&2;f=o&4;g=o&8;t=o&16;y=o&32;w=o&64;o&=128;if(n){n=new THREE.Face4;n.a=z[j++];n.b=z[j++];n.c=z[j++];n.d=z[j++];nVertices=4}else{n=new THREE.Face3;n.a=z[j++];n.b=z[j++];n.c=z[j++];nVertices=3}if(h){materialIndex=z[j++];n.materials=e.materials[materialIndex]}h=e.faces.length;if(f)for(f=0;f<J;f++){uvLayer=a.uvs[f];uvIndex=z[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];e.faceUvs[f][h]=new THREE.UV(u,v)}if(g)for(f=0;f<J;f++){uvLayer=a.uvs[f];uvs=[];for(g=0;g<
+nVertices;g++){uvIndex=z[j++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[g]=new THREE.UV(u,v)}e.faceVertexUvs[f][h]=uvs}if(t){normalIndex=z[j++]*3;normal=new THREE.Vector3;normal.x=E[normalIndex++];normal.y=E[normalIndex++];normal.z=E[normalIndex];n.normal=normal}if(y)for(f=0;f<nVertices;f++){normalIndex=z[j++]*3;normal=new THREE.Vector3;normal.x=E[normalIndex++];normal.y=E[normalIndex++];normal.z=E[normalIndex];n.vertexNormals.push(normal)}if(w){color=new THREE.Color(z[j++]);n.color=color}if(o)for(f=
+0;f<nVertices;f++){colorIndex=z[j++];color=new THREE.Color(G[colorIndex]);n.vertexColors.push(color)}e.faces.push(n)}}})();(function(){var f,g,h,j;if(a.skinWeights){f=0;for(g=a.skinWeights.length;f<g;f+=2){h=a.skinWeights[f];j=a.skinWeights[f+1];e.skinWeights.push(new THREE.Vector4(h,j,0,0))}}if(a.skinIndices){f=0;for(g=a.skinIndices.length;f<g;f+=2){h=a.skinIndices[f];j=a.skinIndices[f+1];e.skinIndices.push(new THREE.Vector4(h,j,0,0))}}e.bones=a.bones;e.animation=a.animation})();(function(){if(a.morphTargets!==
+undefined){var f,g,h,j;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(j=srcVertices.length;h<j;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,d=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(j){THREE.BinaryLoader.prototype.loadAjaxBuffers(j.data.buffers,j.data.materials,b,f,d,g)};c.onerror=function(j){alert("worker.onerror: "+j.message+"\n"+j.data);j.preventDefault()};
-c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,f,g){var j=new XMLHttpRequest,k=d+"/"+a,m=0;j.onreadystatechange=function(){if(j.readyState==4)j.status==200||j.status==0?THREE.BinaryLoader.prototype.createBinModel(j.responseText,b,f,c):alert("Couldn't load ["+k+"] ["+j.status+"]");else if(j.readyState==3){if(g){m==0&&(m=j.getResponseHeader("Content-Length"));g({total:m,loaded:j.responseText.length})}}else j.readyState==2&&(m=j.getResponseHeader("Content-Length"))};j.open("GET",k,!0);j.overrideMimeType("text/plain; charset=x-user-defined");
-j.setRequestHeader("Content-Type","text/plain");j.send(null)},createBinModel:function(a,c,b,d){var f=function(g){function j(h,t){var w=n(h,t),p=n(h,t+1),C=n(h,t+2),H=n(h,t+3),K=(H<<1&255|C>>7)-127;w|=(C&127)<<16|p<<8;if(w==0&&K==-127)return 0;return(1-2*(H>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,K)}function k(h,t){var w=n(h,t),p=n(h,t+1),C=n(h,t+2);return(n(h,t+3)<<24)+(C<<16)+(p<<8)+w}function m(h,t){var w=n(h,t);return(n(h,t+1)<<8)+w}function o(h,t){var w=n(h,t);return w>127?w-256:w}function n(h,
-t){return h.charCodeAt(t)&255}function x(h){var t,w,p;t=k(a,h);w=k(a,h+N);p=k(a,h+ma);h=m(a,h+e);THREE.BinaryLoader.prototype.f3(I,t,w,p,h)}function z(h){var t,w,p,C,H,K;t=k(a,h);w=k(a,h+N);p=k(a,h+ma);C=m(a,h+e);H=k(a,h+la);K=k(a,h+V);h=k(a,h+$);THREE.BinaryLoader.prototype.f3n(I,M,t,w,p,C,H,K,h)}function y(h){var t,w,p,C;t=k(a,h);w=k(a,h+X);p=k(a,h+sa);C=k(a,h+va);h=m(a,h+wa);THREE.BinaryLoader.prototype.f4(I,t,w,p,C,h)}function B(h){var t,w,p,C,H,K,E,A;t=k(a,h);w=k(a,h+X);p=k(a,h+sa);C=k(a,h+va);
-H=m(a,h+wa);K=k(a,h+ia);E=k(a,h+T);A=k(a,h+fa);h=k(a,h+qa);THREE.BinaryLoader.prototype.f4n(I,M,t,w,p,C,H,K,E,A,h)}function F(h){var t,w;t=k(a,h);w=k(a,h+Z);h=k(a,h+S);THREE.BinaryLoader.prototype.uv3(I.faceVertexUvs[0],L[t*2],L[t*2+1],L[w*2],L[w*2+1],L[h*2],L[h*2+1])}function G(h){var t,w,p;t=k(a,h);w=k(a,h+da);p=k(a,h+ua);h=k(a,h+ca);THREE.BinaryLoader.prototype.uv4(I.faceVertexUvs[0],L[t*2],L[t*2+1],L[w*2],L[w*2+1],L[p*2],L[p*2+1],L[h*2],L[h*2+1])}var I=this,R=0,D,M=[],L=[],N,ma,e,la,V,$,X,sa,
-va,wa,ia,T,fa,qa,Z,S,da,ua,ca,ga,xa,Ka,Xa,Ya,Aa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(I,d,g);D={signature:a.substr(R,8),header_bytes:n(a,R+8),vertex_coordinate_bytes:n(a,R+9),normal_coordinate_bytes:n(a,R+10),uv_coordinate_bytes:n(a,R+11),vertex_index_bytes:n(a,R+12),normal_index_bytes:n(a,R+13),uv_index_bytes:n(a,R+14),material_index_bytes:n(a,R+15),nvertices:k(a,R+16),nnormals:k(a,R+16+4),nuvs:k(a,R+16+8),ntri_flat:k(a,R+16+12),ntri_smooth:k(a,R+16+16),ntri_flat_uv:k(a,
-R+16+20),ntri_smooth_uv:k(a,R+16+24),nquad_flat:k(a,R+16+28),nquad_smooth:k(a,R+16+32),nquad_flat_uv:k(a,R+16+36),nquad_smooth_uv:k(a,R+16+40)};R+=D.header_bytes;N=D.vertex_index_bytes;ma=D.vertex_index_bytes*2;e=D.vertex_index_bytes*3;la=D.vertex_index_bytes*3+D.material_index_bytes;V=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;$=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;X=D.vertex_index_bytes;sa=D.vertex_index_bytes*2;va=D.vertex_index_bytes*3;wa=
-D.vertex_index_bytes*4;ia=D.vertex_index_bytes*4+D.material_index_bytes;T=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;fa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;qa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;Z=D.uv_index_bytes;S=D.uv_index_bytes*2;da=D.uv_index_bytes;ua=D.uv_index_bytes*2;ca=D.uv_index_bytes*3;g=D.vertex_index_bytes*3+D.material_index_bytes;Aa=D.vertex_index_bytes*4+D.material_index_bytes;ga=D.ntri_flat*
-g;xa=D.ntri_smooth*(g+D.normal_index_bytes*3);Ka=D.ntri_flat_uv*(g+D.uv_index_bytes*3);Xa=D.ntri_smooth_uv*(g+D.normal_index_bytes*3+D.uv_index_bytes*3);Ya=D.nquad_flat*Aa;g=D.nquad_smooth*(Aa+D.normal_index_bytes*4);Aa=D.nquad_flat_uv*(Aa+D.uv_index_bytes*4);R+=function(h){for(var t,w,p,C=D.vertex_coordinate_bytes*3,H=h+D.nvertices*C;h<H;h+=C){t=j(a,h);w=j(a,h+D.vertex_coordinate_bytes);p=j(a,h+D.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(I,t,w,p)}return D.nvertices*C}(R);R+=function(h){for(var t,
-w,p,C=D.normal_coordinate_bytes*3,H=h+D.nnormals*C;h<H;h+=C){t=o(a,h);w=o(a,h+D.normal_coordinate_bytes);p=o(a,h+D.normal_coordinate_bytes*2);M.push(t/127,w/127,p/127)}return D.nnormals*C}(R);R+=function(h){for(var t,w,p=D.uv_coordinate_bytes*2,C=h+D.nuvs*p;h<C;h+=p){t=j(a,h);w=j(a,h+D.uv_coordinate_bytes);L.push(t,w)}return D.nuvs*p}(R);ga=R+ga;xa=ga+xa;Ka=xa+Ka;Xa=Ka+Xa;Ya=Xa+Ya;g=Ya+g;Aa=g+Aa;(function(h){var t,w=D.vertex_index_bytes*3+D.material_index_bytes,p=w+D.uv_index_bytes*3,C=h+D.ntri_flat_uv*
-p;for(t=h;t<C;t+=p){x(t);F(t+w)}return C-h})(xa);(function(h){var t,w=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,p=w+D.uv_index_bytes*3,C=h+D.ntri_smooth_uv*p;for(t=h;t<C;t+=p){z(t);F(t+w)}return C-h})(Ka);(function(h){var t,w=D.vertex_index_bytes*4+D.material_index_bytes,p=w+D.uv_index_bytes*4,C=h+D.nquad_flat_uv*p;for(t=h;t<C;t+=p){y(t);G(t+w)}return C-h})(g);(function(h){var t,w=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,p=w+D.uv_index_bytes*
-4,C=h+D.nquad_smooth_uv*p;for(t=h;t<C;t+=p){B(t);G(t+w)}return C-h})(Aa);(function(h){var t,w=D.vertex_index_bytes*3+D.material_index_bytes,p=h+D.ntri_flat*w;for(t=h;t<p;t+=w)x(t);return p-h})(R);(function(h){var t,w=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,p=h+D.ntri_smooth*w;for(t=h;t<p;t+=w)z(t);return p-h})(ga);(function(h){var t,w=D.vertex_index_bytes*4+D.material_index_bytes,p=h+D.nquad_flat*w;for(t=h;t<p;t+=w)y(t);return p-h})(Xa);(function(h){var t,w=D.vertex_index_bytes*
-4+D.material_index_bytes+D.normal_index_bytes*4,p=h+D.nquad_smooth*w;for(t=h;t<p;t+=w)B(t);return p-h})(Ya);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(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,f){a.faces.push(new THREE.Face3(c,b,d,null,null,a.materials[f]))},f4:function(a,c,b,d,f,g){a.faces.push(new THREE.Face4(c,b,d,f,null,null,a.materials[g]))},f3n:function(a,
-c,b,d,f,g,j,k,m){g=a.materials[g];var o=c[k*3],n=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,d,f,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(o,n,k),new THREE.Vector3(x,z,m)],null,g))},f4n:function(a,c,b,d,f,g,j,k,m,o,n){j=a.materials[j];var x=c[m*3],z=c[m*3+1];m=c[m*3+2];var y=c[o*3],B=c[o*3+1];o=c[o*3+2];var F=c[n*3],G=c[n*3+1];n=c[n*3+2];a.faces.push(new THREE.Face4(b,d,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,o),new THREE.Vector3(F,G,n)],null,j))},uv3:function(a,c,b,d,f,g,j){var k=[];k.push(new THREE.UV(c,b));k.push(new THREE.UV(d,f));k.push(new THREE.UV(g,j));a.push(k)},uv4:function(a,c,b,d,f,g,j,k,m){var o=[];o.push(new THREE.UV(c,b));o.push(new THREE.UV(d,f));o.push(new THREE.UV(g,j));o.push(new THREE.UV(k,m));a.push(o)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
+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,j=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 ["+j+"] ["+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",j,!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(M,V){var na=n(M,V),Aa=n(M,V+1),ca=n(M,V+2),ga=n(M,V+3),k=(ga<<1&255|ca>>7)-127;na|=(ca&127)<<16|Aa<<8;if(na==0&&k==-127)return 0;return(1-2*(ga>>7))*(1+na*Math.pow(2,-23))*Math.pow(2,k)}function j(M,V){var na=n(M,V),Aa=n(M,V+1),ca=n(M,V+2);return(n(M,V+3)<<24)+(ca<<16)+(Aa<<8)+na}function m(M,V){var na=n(M,V);return(n(M,V+1)<<8)+na}function o(M,V){var na=n(M,V);return na>127?
+na-256:na}function n(M,V){return M.charCodeAt(V)&255}function t(M){var V,na,Aa;V=j(a,M);na=j(a,M+O);Aa=j(a,M+Fa);M=m(a,M+oa);THREE.BinaryLoader.prototype.f3(J,V,na,Aa,M)}function y(M){var V,na,Aa,ca,ga,k;V=j(a,M);na=j(a,M+O);Aa=j(a,M+Fa);ca=m(a,M+oa);ga=j(a,M+xa);k=j(a,M+W);M=j(a,M+d);THREE.BinaryLoader.prototype.f3n(J,L,V,na,Aa,ca,ga,k,M)}function w(M){var V,na,Aa,ca;V=j(a,M);na=j(a,M+Z);Aa=j(a,M+ya);ca=j(a,M+Ga);M=m(a,M+Ha);THREE.BinaryLoader.prototype.f4(J,V,na,Aa,ca,M)}function z(M){var V,na,
+Aa,ca,ga,k,B,x;V=j(a,M);na=j(a,M+Z);Aa=j(a,M+ya);ca=j(a,M+Ga);ga=m(a,M+Ha);k=j(a,M+ra);B=j(a,M+X);x=j(a,M+qa);M=j(a,M+za);THREE.BinaryLoader.prototype.f4n(J,L,V,na,Aa,ca,ga,k,B,x,M)}function E(M){var V,na;V=j(a,M);na=j(a,M+ea);M=j(a,M+U);THREE.BinaryLoader.prototype.uv3(J.faceVertexUvs[0],N[V*2],N[V*2+1],N[na*2],N[na*2+1],N[M*2],N[M*2+1])}function G(M){var V,na,Aa;V=j(a,M);na=j(a,M+ma);Aa=j(a,M+Ca);M=j(a,M+fa);THREE.BinaryLoader.prototype.uv4(J.faceVertexUvs[0],N[V*2],N[V*2+1],N[na*2],N[na*2+1],N[Aa*
+2],N[Aa*2+1],N[M*2],N[M*2+1])}var J=this,S=0,D,L=[],N=[],O,Fa,oa,xa,W,d,Z,ya,Ga,Ha,ra,X,qa,za,ea,U,ma,Ca,fa,ja,Da,Sa,Xa,Wa,Ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(J,e,g);D={signature:a.substr(S,8),header_bytes:n(a,S+8),vertex_coordinate_bytes:n(a,S+9),normal_coordinate_bytes:n(a,S+10),uv_coordinate_bytes:n(a,S+11),vertex_index_bytes:n(a,S+12),normal_index_bytes:n(a,S+13),uv_index_bytes:n(a,S+14),material_index_bytes:n(a,S+15),nvertices:j(a,S+16),nnormals:j(a,S+16+4),nuvs:j(a,
+S+16+8),ntri_flat:j(a,S+16+12),ntri_smooth:j(a,S+16+16),ntri_flat_uv:j(a,S+16+20),ntri_smooth_uv:j(a,S+16+24),nquad_flat:j(a,S+16+28),nquad_smooth:j(a,S+16+32),nquad_flat_uv:j(a,S+16+36),nquad_smooth_uv:j(a,S+16+40)};S+=D.header_bytes;O=D.vertex_index_bytes;Fa=D.vertex_index_bytes*2;oa=D.vertex_index_bytes*3;xa=D.vertex_index_bytes*3+D.material_index_bytes;W=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;d=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;Z=
+D.vertex_index_bytes;ya=D.vertex_index_bytes*2;Ga=D.vertex_index_bytes*3;Ha=D.vertex_index_bytes*4;ra=D.vertex_index_bytes*4+D.material_index_bytes;X=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;qa=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;za=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;ea=D.uv_index_bytes;U=D.uv_index_bytes*2;ma=D.uv_index_bytes;Ca=D.uv_index_bytes*2;fa=D.uv_index_bytes*3;g=D.vertex_index_bytes*3+D.material_index_bytes;
+Ta=D.vertex_index_bytes*4+D.material_index_bytes;ja=D.ntri_flat*g;Da=D.ntri_smooth*(g+D.normal_index_bytes*3);Sa=D.ntri_flat_uv*(g+D.uv_index_bytes*3);Xa=D.ntri_smooth_uv*(g+D.normal_index_bytes*3+D.uv_index_bytes*3);Wa=D.nquad_flat*Ta;g=D.nquad_smooth*(Ta+D.normal_index_bytes*4);Ta=D.nquad_flat_uv*(Ta+D.uv_index_bytes*4);S+=function(M){for(var V,na,Aa,ca=D.vertex_coordinate_bytes*3,ga=M+D.nvertices*ca;M<ga;M+=ca){V=h(a,M);na=h(a,M+D.vertex_coordinate_bytes);Aa=h(a,M+D.vertex_coordinate_bytes*2);
+THREE.BinaryLoader.prototype.v(J,V,na,Aa)}return D.nvertices*ca}(S);S+=function(M){for(var V,na,Aa,ca=D.normal_coordinate_bytes*3,ga=M+D.nnormals*ca;M<ga;M+=ca){V=o(a,M);na=o(a,M+D.normal_coordinate_bytes);Aa=o(a,M+D.normal_coordinate_bytes*2);L.push(V/127,na/127,Aa/127)}return D.nnormals*ca}(S);S+=function(M){for(var V,na,Aa=D.uv_coordinate_bytes*2,ca=M+D.nuvs*Aa;M<ca;M+=Aa){V=h(a,M);na=h(a,M+D.uv_coordinate_bytes);N.push(V,na)}return D.nuvs*Aa}(S);ja=S+ja;Da=ja+Da;Sa=Da+Sa;Xa=Sa+Xa;Wa=Xa+Wa;g=Wa+
+g;Ta=g+Ta;(function(M){var V,na=D.vertex_index_bytes*3+D.material_index_bytes,Aa=na+D.uv_index_bytes*3,ca=M+D.ntri_flat_uv*Aa;for(V=M;V<ca;V+=Aa){t(V);E(V+na)}return ca-M})(Da);(function(M){var V,na=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,Aa=na+D.uv_index_bytes*3,ca=M+D.ntri_smooth_uv*Aa;for(V=M;V<ca;V+=Aa){y(V);E(V+na)}return ca-M})(Sa);(function(M){var V,na=D.vertex_index_bytes*4+D.material_index_bytes,Aa=na+D.uv_index_bytes*4,ca=M+D.nquad_flat_uv*Aa;for(V=M;V<ca;V+=
+Aa){w(V);G(V+na)}return ca-M})(g);(function(M){var V,na=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,Aa=na+D.uv_index_bytes*4,ca=M+D.nquad_smooth_uv*Aa;for(V=M;V<ca;V+=Aa){z(V);G(V+na)}return ca-M})(Ta);(function(M){var V,na=D.vertex_index_bytes*3+D.material_index_bytes,Aa=M+D.ntri_flat*na;for(V=M;V<Aa;V+=na)t(V);return Aa-M})(S);(function(M){var V,na=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,Aa=M+D.ntri_smooth*na;for(V=M;V<Aa;V+=na)y(V);return Aa-
+M})(ja);(function(M){var V,na=D.vertex_index_bytes*4+D.material_index_bytes,Aa=M+D.nquad_flat*na;for(V=M;V<Aa;V+=na)w(V);return Aa-M})(Xa);(function(M){var V,na=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,Aa=M+D.nquad_smooth*na;for(V=M;V<Aa;V+=na)z(V);return Aa-M})(Wa);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,j,m){g=a.materials[g];var o=c[j*3],n=c[j*3+1];j=c[j*3+2];var t=c[m*3],y=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(o,n,j),new THREE.Vector3(t,y,m)],null,g))},f4n:function(a,c,b,e,f,g,h,j,m,o,n){h=a.materials[h];var t=c[m*3],y=c[m*3+1];m=
+c[m*3+2];var w=c[o*3],z=c[o*3+1];o=c[o*3+2];var E=c[n*3],G=c[n*3+1];n=c[n*3+2];a.faces.push(new THREE.Face4(b,e,f,g,[new THREE.Vector3(c[j*3],c[j*3+1],c[j*3+2]),new THREE.Vector3(t,y,m),new THREE.Vector3(w,z,o),new THREE.Vector3(E,G,n)],null,h))},uv3:function(a,c,b,e,f,g,h){var j=[];j.push(new THREE.UV(c,b));j.push(new THREE.UV(e,f));j.push(new THREE.UV(g,h));a.push(j)},uv4:function(a,c,b,e,f,g,h,j,m){var o=[];o.push(new THREE.UV(c,b));o.push(new THREE.UV(e,f));o.push(new THREE.UV(g,h));o.push(new THREE.UV(j,
+m));a.push(o)}};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,f){return b+(d-b)*f};this.VIntX=function(b,d,f,g,j,k,m,o,n,x){j=(j-n)/(x-n);n=this.normal_cache;d[g]=k+j*this.delta;d[g+1]=m;d[g+2]=o;f[g]=this.lerp(n[b],n[b+3],j);f[g+1]=this.lerp(n[b+1],n[b+4],j);f[g+2]=this.lerp(n[b+2],n[b+5],j)};this.VIntY=function(b,d,f,g,j,k,m,o,n,x){j=(j-n)/(x-n);n=this.normal_cache;d[g]=k;d[g+1]=m+j*this.delta;d[g+
-2]=o;d=b+this.yd*3;f[g]=this.lerp(n[b],n[d],j);f[g+1]=this.lerp(n[b+1],n[d+1],j);f[g+2]=this.lerp(n[b+2],n[d+2],j)};this.VIntZ=function(b,d,f,g,j,k,m,o,n,x){j=(j-n)/(x-n);n=this.normal_cache;d[g]=k;d[g+1]=m;d[g+2]=o+j*this.delta;d=b+this.zd*3;f[g]=this.lerp(n[b],n[d],j);f[g+1]=this.lerp(n[b+1],n[d+1],j);f[g+2]=this.lerp(n[b+2],n[d+2],j)};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,f,g,j,k){var m=g+1,o=g+this.yd,n=g+this.zd,x=m+this.yd,z=m+this.zd,y=g+this.yd+this.zd,B=m+this.yd+this.zd,F=0,G=this.field[g],I=this.field[m],R=this.field[o],D=this.field[x],M=this.field[n],L=this.field[z],N=this.field[y],ma=this.field[B];G<j&&(F|=1);I<j&&(F|=2);R<j&&(F|=8);D<j&&(F|=4);M<j&&(F|=16);L<j&&(F|=32);N<j&&(F|=128);ma<j&&(F|=64);var e=THREE.edgeTable[F];if(e==0)return 0;
-var la=this.delta,V=b+la,$=d+la;la=f+la;if(e&1){this.compNorm(g);this.compNorm(m);this.VIntX(g*3,this.vlist,this.nlist,0,j,b,d,f,G,I)}if(e&2){this.compNorm(m);this.compNorm(x);this.VIntY(m*3,this.vlist,this.nlist,3,j,V,d,f,I,D)}if(e&4){this.compNorm(o);this.compNorm(x);this.VIntX(o*3,this.vlist,this.nlist,6,j,b,$,f,R,D)}if(e&8){this.compNorm(g);this.compNorm(o);this.VIntY(g*3,this.vlist,this.nlist,9,j,b,d,f,G,R)}if(e&16){this.compNorm(n);this.compNorm(z);this.VIntX(n*3,this.vlist,this.nlist,12,j,
-b,d,la,M,L)}if(e&32){this.compNorm(z);this.compNorm(B);this.VIntY(z*3,this.vlist,this.nlist,15,j,V,d,la,L,ma)}if(e&64){this.compNorm(y);this.compNorm(B);this.VIntX(y*3,this.vlist,this.nlist,18,j,b,$,la,N,ma)}if(e&128){this.compNorm(n);this.compNorm(y);this.VIntY(n*3,this.vlist,this.nlist,21,j,b,d,la,M,N)}if(e&256){this.compNorm(g);this.compNorm(n);this.VIntZ(g*3,this.vlist,this.nlist,24,j,b,d,f,G,M)}if(e&512){this.compNorm(m);this.compNorm(z);this.VIntZ(m*3,this.vlist,this.nlist,27,j,V,d,f,I,L)}if(e&
-1024){this.compNorm(x);this.compNorm(B);this.VIntZ(x*3,this.vlist,this.nlist,30,j,V,$,f,D,ma)}if(e&2048){this.compNorm(o);this.compNorm(y);this.VIntZ(o*3,this.vlist,this.nlist,33,j,b,$,f,R,N)}F<<=4;for(j=g=0;THREE.triTable[F+j]!=-1;){b=F+j;d=b+1;f=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[d],3*THREE.triTable[f],k);j+=3;g++}return g};this.posnormtriv=function(b,d,f,g,j,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[j];this.positionArray[m+7]=b[j+1];this.positionArray[m+8]=b[j+2];this.normalArray[m]=d[f];this.normalArray[m+1]=d[f+1];this.normalArray[m+2]=d[f+2];this.normalArray[m+3]=d[g];this.normalArray[m+4]=d[g+1];this.normalArray[m+5]=d[g+2];this.normalArray[m+6]=d[j];this.normalArray[m+7]=d[j+1];this.normalArray[m+8]=d[j+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 d=this.count*3;d<this.positionArray.length;d++)this.positionArray[d]=0;b(this)}};this.addBall=function(b,d,f,g,j){var k=this.size*Math.sqrt(g/j),m=f*this.size,o=d*this.size,n=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(o-k);z<1&&(z=1);o=Math.floor(o+k);o>this.size-1&&(o=this.size-1);var y=Math.floor(n-
-k);y<1&&(y=1);k=Math.floor(n+k);k>this.size-1&&(k=this.size-1);for(var B,F,G,I,R,D;x<m;x++){n=this.size2*x;F=x/this.size-f;R=F*F;for(F=z;F<o;F++){G=n+this.size*F;B=F/this.size-d;D=B*B;for(B=y;B<k;B++){I=B/this.size-b;I=g/(1.0E-6+I*I+D+R)-j;I>0&&(this.field[G+B]+=I)}}}};this.addPlaneX=function(b,d){var f,g,j,k,m,o=this.size,n=this.yd,x=this.zd,z=this.field,y=o*Math.sqrt(b/d);y>o&&(y=o);for(f=0;f<y;f++){g=f/o;g*=g;k=b/(1.0E-4+g)-d;if(k>0)for(g=0;g<o;g++){m=f+g*n;for(j=0;j<o;j++)z[x*j+m]+=k}}};this.addPlaneY=
-function(b,d){var f,g,j,k,m,o,n=this.size,x=this.yd,z=this.zd,y=this.field,B=n*Math.sqrt(b/d);B>n&&(B=n);for(g=0;g<B;g++){f=g/n;f*=f;k=b/(1.0E-4+f)-d;if(k>0){m=g*x;for(f=0;f<n;f++){o=m+f;for(j=0;j<n;j++)y[z*j+o]+=k}}}};this.addPlaneZ=function(b,d){var f,g,j,k,m,o;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(j=0;j<dist;j++){f=j/size;f*=f;k=b/(1.0E-4+f)-d;if(k>0){m=zd*j;for(g=0;g<size;g++){o=m+g*yd;for(f=0;f<size;f++)field[o+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 d,f,g,j,k,m,o,n,x,z=this.size-2;for(j=1;j<z;j++){x=this.size2*j;o=(j-this.halfsize)/this.halfsize;for(g=1;g<z;g++){n=x+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<z;f++){k=(f-this.halfsize)/this.halfsize;d=n+f;this.polygonize(k,m,o,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(f){var g,j,k,
-m,o,n,x,z;for(g=0;g<f.count;g++){o=g*3;x=o+1;z=o+2;j=f.positionArray[o];k=f.positionArray[x];m=f.positionArray[z];n=new THREE.Vector3(j,k,m);j=f.normalArray[o];k=f.normalArray[x];m=f.normalArray[z];o=new THREE.Vector3(j,k,m);o.normalize();o=new THREE.Vertex(n,o);d.vertices.push(o)}nfaces=f.count/3;for(g=0;g<nfaces;g++){o=(b+g)*3;x=o+1;z=o+2;n=d.vertices[o].normal;j=d.vertices[x].normal;k=d.vertices[z].normal;o=new THREE.Face3(o,x,z,[n,j,k]);d.faces.push(o)}b+=nfaces;f.count=0});return d};this.init(a)};
-THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
+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,j,m,o,n,t){h=(h-n)/(t-n);n=this.normal_cache;e[g]=j+h*this.delta;e[g+1]=m;e[g+2]=o;f[g]=this.lerp(n[b],n[b+3],h);f[g+1]=this.lerp(n[b+1],n[b+4],h);f[g+2]=this.lerp(n[b+2],n[b+5],h)};this.VIntY=function(b,e,f,g,h,j,m,o,n,t){h=(h-n)/(t-n);n=this.normal_cache;e[g]=j;e[g+1]=m+h*this.delta;e[g+
+2]=o;e=b+this.yd*3;f[g]=this.lerp(n[b],n[e],h);f[g+1]=this.lerp(n[b+1],n[e+1],h);f[g+2]=this.lerp(n[b+2],n[e+2],h)};this.VIntZ=function(b,e,f,g,h,j,m,o,n,t){h=(h-n)/(t-n);n=this.normal_cache;e[g]=j;e[g+1]=m;e[g+2]=o+h*this.delta;e=b+this.zd*3;f[g]=this.lerp(n[b],n[e],h);f[g+1]=this.lerp(n[b+1],n[e+1],h);f[g+2]=this.lerp(n[b+2],n[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,j){var m=g+1,o=g+this.yd,n=g+this.zd,t=m+this.yd,y=m+this.zd,w=g+this.yd+this.zd,z=m+this.yd+this.zd,E=0,G=this.field[g],J=this.field[m],S=this.field[o],D=this.field[t],L=this.field[n],N=this.field[y],O=this.field[w],Fa=this.field[z];G<h&&(E|=1);J<h&&(E|=2);S<h&&(E|=8);D<h&&(E|=4);L<h&&(E|=16);N<h&&(E|=32);O<h&&(E|=128);Fa<h&&(E|=64);var oa=THREE.edgeTable[E];if(oa==0)return 0;
+var xa=this.delta,W=b+xa,d=e+xa;xa=f+xa;if(oa&1){this.compNorm(g);this.compNorm(m);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,e,f,G,J)}if(oa&2){this.compNorm(m);this.compNorm(t);this.VIntY(m*3,this.vlist,this.nlist,3,h,W,e,f,J,D)}if(oa&4){this.compNorm(o);this.compNorm(t);this.VIntX(o*3,this.vlist,this.nlist,6,h,b,d,f,S,D)}if(oa&8){this.compNorm(g);this.compNorm(o);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,e,f,G,S)}if(oa&16){this.compNorm(n);this.compNorm(y);this.VIntX(n*3,this.vlist,this.nlist,
+12,h,b,e,xa,L,N)}if(oa&32){this.compNorm(y);this.compNorm(z);this.VIntY(y*3,this.vlist,this.nlist,15,h,W,e,xa,N,Fa)}if(oa&64){this.compNorm(w);this.compNorm(z);this.VIntX(w*3,this.vlist,this.nlist,18,h,b,d,xa,O,Fa)}if(oa&128){this.compNorm(n);this.compNorm(w);this.VIntY(n*3,this.vlist,this.nlist,21,h,b,e,xa,L,O)}if(oa&256){this.compNorm(g);this.compNorm(n);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,e,f,G,L)}if(oa&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,h,W,
+e,f,J,N)}if(oa&1024){this.compNorm(t);this.compNorm(z);this.VIntZ(t*3,this.vlist,this.nlist,30,h,W,d,f,D,Fa)}if(oa&2048){this.compNorm(o);this.compNorm(w);this.VIntZ(o*3,this.vlist,this.nlist,33,h,b,d,f,S,O)}E<<=4;for(h=g=0;THREE.triTable[E+h]!=-1;){b=E+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],j);h+=3;g++}return g};this.posnormtriv=function(b,e,f,g,h,j){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&&j(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 j=this.size*Math.sqrt(g/h),m=f*this.size,o=e*this.size,n=b*this.size,t=Math.floor(m-j);t<1&&(t=1);m=Math.floor(m+j);m>this.size-1&&(m=this.size-1);var y=Math.floor(o-j);y<1&&(y=1);o=Math.floor(o+j);o>this.size-1&&(o=
+this.size-1);var w=Math.floor(n-j);w<1&&(w=1);j=Math.floor(n+j);j>this.size-1&&(j=this.size-1);for(var z,E,G,J,S,D;t<m;t++){n=this.size2*t;E=t/this.size-f;S=E*E;for(E=y;E<o;E++){G=n+this.size*E;z=E/this.size-e;D=z*z;for(z=w;z<j;z++){J=z/this.size-b;J=g/(1.0E-6+J*J+D+S)-h;J>0&&(this.field[G+z]+=J)}}}};this.addPlaneX=function(b,e){var f,g,h,j,m,o=this.size,n=this.yd,t=this.zd,y=this.field,w=o*Math.sqrt(b/e);w>o&&(w=o);for(f=0;f<w;f++){g=f/o;g*=g;j=b/(1.0E-4+g)-e;if(j>0)for(g=0;g<o;g++){m=f+g*n;for(h=
+0;h<o;h++)y[t*h+m]+=j}}};this.addPlaneY=function(b,e){var f,g,h,j,m,o,n=this.size,t=this.yd,y=this.zd,w=this.field,z=n*Math.sqrt(b/e);z>n&&(z=n);for(g=0;g<z;g++){f=g/n;f*=f;j=b/(1.0E-4+f)-e;if(j>0){m=g*t;for(f=0;f<n;f++){o=m+f;for(h=0;h<n;h++)w[y*h+o]+=j}}}};this.addPlaneZ=function(b,e){var f,g,h,j,m,o;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;j=b/(1.0E-4+f)-e;if(j>0){m=zd*h;for(g=0;g<size;g++){o=m+g*yd;
+for(f=0;f<size;f++)field[o+f]+=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 e,f,g,h,j,m,o,n,t,y=this.size-2;for(h=1;h<y;h++){t=this.size2*h;o=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){n=t+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<y;f++){j=(f-this.halfsize)/this.halfsize;e=n+f;this.polygonize(j,m,o,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry;
+this.render(function(f){var g,h,j,m,o,n,t,y;for(g=0;g<f.count;g++){o=g*3;t=o+1;y=o+2;h=f.positionArray[o];j=f.positionArray[t];m=f.positionArray[y];n=new THREE.Vector3(h,j,m);h=f.normalArray[o];j=f.normalArray[t];m=f.normalArray[y];o=new THREE.Vector3(h,j,m);o.normalize();o=new THREE.Vertex(n,o);e.vertices.push(o)}nfaces=f.count/3;for(g=0;g<nfaces;g++){o=(b+g)*3;t=o+1;y=o+2;n=e.vertices[o].normal;h=e.vertices[t].normal;j=e.vertices[y].normal;o=new THREE.Face3(o,t,y,[n,h,j]);e.faces.push(o)}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,
 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);

+ 1 - 1
build/custom/ThreeCanvas.js

@@ -83,7 +83,7 @@ THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.po
 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,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};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.MultiplyBlending=3;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
+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.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};

+ 1 - 1
build/custom/ThreeSVG.js

@@ -83,7 +83,7 @@ THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.po
 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,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1;this.distance=c||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1;this.distance=c||0};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.MultiplyBlending=3;THREE.MaterialCounter={value:0};
+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.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
 THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=!1;

+ 160 - 149
build/custom/ThreeWebGL.js

@@ -1,7 +1,7 @@
 // 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,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,n,o;if(d==0)g=f=h=0;else{i=Math.floor(a*6);n=a*6-i;a=d*(1-c);o=d*(1-c*n);c=d*(1-c*(1-n));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*
+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,i,j,o,p;if(d==0)g=f=i=0;else{j=Math.floor(a*6);o=a*6-j;a=d*(1-c);p=d*(1-c*o);c=d*(1-c*(1-o));switch(j){case 1:g=p;f=d;i=a;break;case 2:g=a;f=d;i=c;break;case 3:g=a;f=p;i=d;break;case 4:g=c;f=a;i=d;break;case 5:g=d;f=a;
+i=p;break;case 6:case 0:g=d;f=c;i=a}}this.r=g;this.g=f;this.b=i;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)};
@@ -12,79 +12,79 @@ this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPosit
 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 va=Q.clone().subSelf(K);Q=la.dot(la);K=la.dot(ia);la=la.dot(va);var S=ia.dot(ia);ia=ia.dot(va);va=1/(Q*S-K*K);S=(S*la-K*ia)*va;Q=(Q*ia-K*la)*va;return S>0&&Q>0&&S+Q<
-1}var d,g,f,h,i,n,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());n=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,n)){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,n,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,n=!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){n=!1;c=o;d=t;g=x;f=y;a()};this.addPoint=function(o,t){if(n){n=!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(n){n=!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(n){n=!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(){n=!0;f=g=d=c=0;a()};this.isEmpty=function(){return n}};
+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(i,j){return i.distance-j.distance});return f},intersectObject:function(a){function c(T,O,pa,Y){Y=Y.clone().subSelf(O);pa=pa.clone().subSelf(O);var qa=T.clone().subSelf(O);T=Y.dot(Y);O=Y.dot(pa);Y=Y.dot(qa);var V=pa.dot(pa);pa=pa.dot(qa);qa=1/(T*V-O*O);V=(V*Y-O*pa)*qa;T=(T*pa-O*Y)*qa;return V>0&&T>0&&V+T<1}var d,g,
+f,i,j,o,p,v,x,y,D,z=a.geometry,K=z.vertices,M=[];d=0;for(g=z.faces.length;d<g;d++){f=z.faces[d];y=this.origin.clone();D=this.direction.clone();p=a.matrixWorld;i=p.multiplyVector3(K[f.a].position.clone());j=p.multiplyVector3(K[f.b].position.clone());o=p.multiplyVector3(K[f.c].position.clone());p=f instanceof THREE.Face4?p.multiplyVector3(K[f.d].position.clone()):null;v=a.matrixRotationWorld.multiplyVector3(f.normal.clone());x=D.dot(v);if(x<0){v=v.dot((new THREE.Vector3).sub(i,y))/x;y=y.addSelf(D.multiplyScalar(v));
+if(f instanceof THREE.Face3){if(c(y,i,j,o)){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};M.push(f)}}else if(f instanceof THREE.Face4&&(c(y,i,j,p)||c(y,j,o,p))){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};M.push(f)}}}return M}};
+THREE.Rectangle=function(){function a(){i=g-c;j=f-d}var c,d,g,f,i,j,o=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return g};this.getBottom=function(){return f};this.set=function(p,v,x,y){o=!1;c=p;d=v;g=x;f=y;a()};this.addPoint=function(p,v){if(o){o=!1;c=p;d=v;g=p;f=v}else{c=c<p?c:p;d=d<v?d:v;g=g>p?g:p;f=f>v?f:v}a()};
+this.add3Points=function(p,v,x,y,D,z){if(o){o=!1;c=p<x?p<D?p:D:x<D?x:D;d=v<y?v<z?v:z:y<z?y:z;g=p>x?p>D?p:D:x>D?x:D;f=v>y?v>z?v:z:y>z?y:z}else{c=p<x?p<D?p<c?p:c:D<c?D:c:x<D?x<c?x:c:D<c?D:c;d=v<y?v<z?v<d?v:d:z<d?z:d:y<z?y<d?y:d:z<d?z:d;g=p>x?p>D?p>g?p:g:D>g?D:g:x>D?x>g?x:g:D>g?D:g;f=v>y?v>z?v>f?v:f:z>f?z:f:y>z?y>f?y:f:z>f?z:f}a()};this.addRectangle=function(p){if(o){o=!1;c=p.getLeft();d=p.getTop();g=p.getRight();f=p.getBottom()}else{c=c<p.getLeft()?c:p.getLeft();d=d<p.getTop()?d:p.getTop();g=g>p.getRight()?
+g:p.getRight();f=f>p.getBottom()?f:p.getBottom()}a()};this.inflate=function(p){c-=p;d-=p;g+=p;f+=p;a()};this.minSelf=function(p){c=c>p.getLeft()?c:p.getLeft();d=d>p.getTop()?d:p.getTop();g=g<p.getRight()?g:p.getRight();f=f<p.getBottom()?f:p.getBottom();a()};this.instersects=function(p){return Math.min(g,p.getRight())-Math.max(c,p.getLeft())>=0&&Math.min(f,p.getBottom())-Math.max(d,p.getTop())>=0};this.empty=function(){o=!0;f=g=d=c=0;a()};this.isEmpty=function(){return o}};
 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,n,o,t,x,y,B,z,H,J){this.set(a||1,c||0,d||0,g||0,f||0,h||1,i||0,n||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,n,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=n;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*
+THREE.Matrix4=function(a,c,d,g,f,i,j,o,p,v,x,y,D,z,K,M){this.set(a||1,c||0,d||0,g||0,f||0,i||1,j||0,o||0,p||0,v||0,x||1,y||0,D||0,z||0,K||0,M||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
+THREE.Matrix4.prototype={set:function(a,c,d,g,f,i,j,o,p,v,x,y,D,z,K,M){this.n11=a;this.n12=c;this.n13=d;this.n14=g;this.n21=f;this.n22=i;this.n23=j;this.n24=o;this.n31=p;this.n32=v;this.n33=x;this.n34=y;this.n41=D;this.n42=z;this.n43=K;this.n44=M;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,i=THREE.Matrix4.__v3;i.sub(a,c).normalize();if(i.length()===0)i.z=1;g.cross(d,i).normalize();if(g.length()===0){i.x+=1.0E-4;g.cross(d,i).normalize()}f.cross(i,g).normalize();this.n11=g.x;this.n12=f.x;this.n13=i.x;this.n21=g.y;this.n22=f.y;this.n23=i.y;this.n31=g.z;this.n32=f.z;this.n33=i.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,n=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,va=c.n13,S=c.n14,D=c.n21,fa=c.n22,
-b=c.n23,oa=c.n24,ra=c.n31,R=c.n32,O=c.n33,pa=c.n34;this.n11=d*ia+g*D+f*ra;this.n12=d*la+g*fa+f*R;this.n13=d*va+g*b+f*O;this.n14=d*S+g*oa+f*pa+h;this.n21=i*ia+n*D+o*ra;this.n22=i*la+n*fa+o*R;this.n23=i*va+n*b+o*O;this.n24=i*S+n*oa+o*pa+t;this.n31=x*ia+y*D+B*ra;this.n32=x*la+y*fa+B*R;this.n33=x*va+y*b+B*O;this.n34=x*S+y*oa+B*pa+z;this.n41=H*ia+J*D+Q*ra;this.n42=H*la+J*fa+Q*R;this.n43=H*va+J*b+Q*O;this.n44=H*S+J*oa+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,n=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*n*t*B-g*h*x*B+c*n*x*B+d*h*y*B-c*i*y*B-g*i*o*z+d*n*o*z+g*f*x*z-a*n*x*z-d*f*y*z+a*i*y*z+g*h*o*H-c*n*o*H-g*f*t*H+a*n*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=
+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,i=a.n14,j=a.n21,o=a.n22,p=a.n23,v=a.n24,x=a.n31,y=a.n32,D=a.n33,z=a.n34,K=a.n41,M=a.n42,T=a.n43,O=a.n44,pa=c.n11,Y=c.n12,qa=c.n13,V=c.n14,E=c.n21,Fa=c.n22,
+ka=c.n23,Da=c.n24,$=c.n31,b=c.n32,Q=c.n33,la=c.n34;this.n11=d*pa+g*E+f*$;this.n12=d*Y+g*Fa+f*b;this.n13=d*qa+g*ka+f*Q;this.n14=d*V+g*Da+f*la+i;this.n21=j*pa+o*E+p*$;this.n22=j*Y+o*Fa+p*b;this.n23=j*qa+o*ka+p*Q;this.n24=j*V+o*Da+p*la+v;this.n31=x*pa+y*E+D*$;this.n32=x*Y+y*Fa+D*b;this.n33=x*qa+y*ka+D*Q;this.n34=x*V+y*Da+D*la+z;this.n41=K*pa+M*E+T*$;this.n42=K*Y+M*Fa+T*b;this.n43=K*qa+M*ka+T*Q;this.n44=K*V+M*Da+T*la+O;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,i=this.n22,j=this.n23,o=this.n24,p=this.n31,v=this.n32,x=this.n33,y=this.n34,D=this.n41,z=this.n42,K=this.n43,M=this.n44;return g*j*v*D-d*o*v*D-g*i*x*D+c*o*x*D+d*i*y*D-c*j*y*D-g*j*p*z+d*o*p*z+g*f*x*z-a*o*x*z-d*f*y*z+a*j*y*z+g*i*p*K-c*o*p*K-g*f*v*K+a*o*v*K+c*f*y*K-a*i*y*K-d*i*p*M+c*j*p*M+d*f*v*M-a*j*v*M-c*f*x*M+a*i*x*M},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
 this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
 this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
 a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,
 0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var d=Math.cos(c),g=Math.sin(c),f=
-1-d,h=a.x,i=a.y,n=a.z,o=f*h,t=f*i;this.set(o*h+d,o*i-g*n,o*n+g*i,0,o*i+g*n,t*i+d,t*n-g*h,0,o*n-g*i,t*n+g*h,f*n*n+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,n=c*d;this.n11=f*h;this.n12=-f*g;this.n13=d;this.n21=n*h+a*g;this.n22=-n*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,n=g+g;a=c*h;var o=c*i;c*=n;var t=d*i;d*=n;g*=n;h*=f;i*=f;f*=n;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=
+1-d,i=a.x,j=a.y,o=a.z,p=f*i,v=f*j;this.set(p*i+d,p*j-g*o,p*o+g*j,0,p*j+g*o,v*j+d,v*o-g*i,0,p*o-g*j,v*o+g*i,f*o*o+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var 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 i=Math.cos(g);g=Math.sin(g);var j=a*d,o=c*d;this.n11=f*i;this.n12=-f*g;this.n13=d;this.n21=o*i+a*g;this.n22=-o*g+a*i;this.n23=-c*f;this.n31=-j*i+c*g;this.n32=j*g+c*i;this.n33=
+a*f;return this},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,g=a.z,f=a.w,i=c+c,j=d+d,o=g+g;a=c*i;var p=c*j;c*=o;var v=d*j;d*=o;g*=o;i*=f;j*=f;f*=o;this.n11=1-(v+g);this.n12=p-f;this.n13=c+j;this.n21=p+f;this.n22=1-(a+g);this.n23=d-i;this.n31=c-j;this.n32=d+i;this.n33=1-(a+v);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,n=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-n*z*Q-o*y*K+n*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*n*Q-g*t*Q-f*n*K+g*o*K;c.n14=h*o*y-f*t*y-h*n*B+g*t*B+f*n*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=n*z*H-t*y*H+t*x*J-i*z*J-n*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*n*H+h*i*J-d*t*J-g*i*K+d*n*K;c.n34=h*n*x-g*t*x-h*i*y+d*t*y+g*i*z-d*n*z;c.n41=o*y*H-n*B*H-o*x*J+i*B*J+n*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*n*H-g*o*H-f*i*J+d*o*J+g*i*Q-d*n*Q;c.n44=g*o*x-f*n*x+f*i*y-d*o*y-g*i*B+d*n*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,n=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*n;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,n,o,t;i=new THREE.Matrix4;n=c-a;o=d-g;t=h-f;i.n11=2/n;i.n12=0;i.n13=0;i.n14=-((c+a)/n);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.Matrix4.makeInvert=function(a,c){var d=a.n11,g=a.n12,f=a.n13,i=a.n14,j=a.n21,o=a.n22,p=a.n23,v=a.n24,x=a.n31,y=a.n32,D=a.n33,z=a.n34,K=a.n41,M=a.n42,T=a.n43,O=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=p*z*M-v*D*M+v*y*T-o*z*T-p*y*O+o*D*O;c.n12=i*D*M-f*z*M-i*y*T+g*z*T+f*y*O-g*D*O;c.n13=f*v*M-i*p*M+i*o*T-g*v*T-f*o*O+g*p*O;c.n14=i*p*y-f*v*y-i*o*D+g*v*D+f*o*z-g*p*z;c.n21=v*D*K-p*z*K-v*x*T+j*z*T+p*x*O-j*D*O;c.n22=f*z*K-i*D*K+i*x*T-d*z*T-f*x*O+d*D*O;c.n23=i*p*K-f*v*K-i*j*T+d*v*T+f*j*O-d*p*O;
+c.n24=f*v*x-i*p*x+i*j*D-d*v*D-f*j*z+d*p*z;c.n31=o*z*K-v*y*K+v*x*M-j*z*M-o*x*O+j*y*O;c.n32=i*y*K-g*z*K-i*x*M+d*z*M+g*x*O-d*y*O;c.n33=f*v*K-i*o*K+i*j*M-d*v*M-g*j*O+d*o*O;c.n34=i*o*x-g*v*x-i*j*y+d*v*y+g*j*z-d*o*z;c.n41=p*y*K-o*D*K-p*x*M+j*D*M+o*x*T-j*y*T;c.n42=g*D*K-f*y*K+f*x*M-d*D*M-g*x*T+d*y*T;c.n43=f*o*K-g*p*K-f*j*M+d*p*M+g*j*T-d*o*T;c.n44=g*p*x-f*o*x+f*j*y-d*p*y-g*j*D+d*o*D;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,i=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,o=a.n33*a.n11-a.n31*a.n13,p=-a.n32*a.n11+a.n31*a.n12,v=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*j+a.n31*v;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*g;d[1]=a*f;d[2]=a*i;d[3]=a*j;d[4]=a*o;d[5]=a*p;d[6]=a*v;d[7]=a*x;d[8]=a*y;return c};
+THREE.Matrix4.makeFrustum=function(a,c,d,g,f,i){var j;j=new THREE.Matrix4;j.n11=2*f/(c-a);j.n12=0;j.n13=(c+a)/(c-a);j.n14=0;j.n21=0;j.n22=2*f/(g-d);j.n23=(g+d)/(g-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(i+f)/(i-f);j.n34=-2*i*f/(i-f);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};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,i){var j,o,p,v;j=new THREE.Matrix4;o=c-a;p=d-g;v=i-f;j.n11=2/o;j.n12=0;j.n13=0;j.n14=-((c+a)/o);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((d+g)/p);j.n31=0;j.n32=0;j.n33=-2/v;j.n34=-((i+f)/v);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;
 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,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,n=g*f;this.w=i*h-n*d;this.x=i*d+n*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,n=a.z;a=a.w;this.x=c*a+f*h+d*n-g*i;this.y=d*a+f*i+g*h-c*n;this.z=g*a+f*n+c*i-d*h;this.w=f*a-c*h-d*i-g*n;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,n=this.z,o=this.w,t=o*d+i*f-n*g,x=o*g+n*d-h*f,y=o*f+h*g-i*d;d=-h*d-i*g-n*f;c.x=t*o+d*-h+x*-n-y*-i;c.y=x*o+d*-i+y*-h-t*-n;c.z=y*o+d*-n+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.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 i=Math.cos(d);d=Math.sin(d);var j=a*c,o=g*f;this.w=j*i-o*d;this.x=j*d+o*i;this.y=g*c*i+a*f*d;this.z=a*f*i-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,i=a.x,j=a.y,o=a.z;a=a.w;this.x=c*a+f*i+d*o-g*j;this.y=d*a+f*j+g*i-c*o;this.z=g*a+f*o+c*j-d*i;this.w=f*a-c*i-d*j-g*o;return this},
+multiplyVector3:function(a,c){c||(c=a);var d=a.x,g=a.y,f=a.z,i=this.x,j=this.y,o=this.z,p=this.w,v=p*d+j*f-o*g,x=p*g+o*d-i*f,y=p*f+i*g-j*d;d=-i*d-j*g-o*f;c.x=v*p+d*-i+x*-o-y*-j;c.y=x*p+d*-j+y*-i-v*-o;c.z=y*p+d*-o+v*-j-x*-i;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 i=Math.acos(f),j=Math.sqrt(1-f*f);if(Math.abs(j)<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)*i)/j;g=Math.sin(g*i)/j;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,i){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=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
+THREE.Face4=function(a,c,d,g,f,i,j){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=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];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,n=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){n.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)n.addSelf(h.vertexNormals[c]);n.divideScalar(3)}else{c=this.vertices[h.a];d=this.vertices[h.b];i=this.vertices[h.c];n.sub(i.position,d.position);o.sub(c.position,d.position);n.crossSelf(o)}n.isZero()||
-n.normalize();h.normal.copy(n)}},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=
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,g,f,i,j,o=new THREE.Vector3,p=new THREE.Vector3;g=0;for(f=this.faces.length;g<f;g++){i=this.faces[g];if(a&&i.vertexNormals.length){o.set(0,0,0);c=0;for(d=i.vertexNormals.length;c<d;c++)o.addSelf(i.vertexNormals[c]);o.divideScalar(3)}else{c=this.vertices[i.a];d=this.vertices[i.b];j=this.vertices[i.c];o.sub(j.position,d.position);p.sub(c.position,d.position);o.crossSelf(p)}o.isZero()||
+o.normalize();i.normal.copy(o)}},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(U,ga,ha,ja,P,ma,ka){n=U.vertices[ga].position;o=U.vertices[ha].position;t=U.vertices[ja].position;x=i[P];y=i[ma];B=i[ka];z=o.x-n.x;H=t.x-n.x;J=o.y-n.y;Q=t.y-n.y;K=o.z-n.z;ia=t.z-n.z;la=y.u-x.u;va=B.u-x.u;S=y.v-x.v;D=B.v-x.v;fa=1/(la*D-
-va*S);R.set((D*z-S*H)*fa,(D*J-S*Q)*fa,(D*K-S*ia)*fa);O.set((la*H-va*z)*fa,(la*Q-va*J)*fa,(la*ia-va*K)*fa);oa[ga].addSelf(R);oa[ha].addSelf(R);oa[ja].addSelf(R);ra[ga].addSelf(O);ra[ha].addSelf(O);ra[ja].addSelf(O)}var c,d,g,f,h,i,n,o,t,x,y,B,z,H,J,Q,K,ia,la,va,S,D,fa,b,oa=[],ra=[],R=new THREE.Vector3,O=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++){oa[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]];b=oa[f];pa.copy(b);pa.subSelf(Ba.multiplyScalar(Ba.dot(b))).normalize();Aa.cross(h.vertexNormals[g],b);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;
+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(W,na,aa,oa,U,ra,ma){o=W.vertices[na].position;p=W.vertices[aa].position;v=W.vertices[oa].position;x=j[U];y=j[ra];D=j[ma];z=p.x-o.x;K=v.x-o.x;M=p.y-o.y;T=v.y-o.y;O=p.z-o.z;pa=v.z-o.z;Y=y.u-x.u;qa=D.u-x.u;V=y.v-x.v;E=D.v-x.v;Fa=1/(Y*E-qa*
+V);b.set((E*z-V*K)*Fa,(E*M-V*T)*Fa,(E*O-V*pa)*Fa);Q.set((Y*K-qa*z)*Fa,(Y*T-qa*M)*Fa,(Y*pa-qa*O)*Fa);Da[na].addSelf(b);Da[aa].addSelf(b);Da[oa].addSelf(b);$[na].addSelf(Q);$[aa].addSelf(Q);$[oa].addSelf(Q)}var c,d,g,f,i,j,o,p,v,x,y,D,z,K,M,T,O,pa,Y,qa,V,E,Fa,ka,Da=[],$=[],b=new THREE.Vector3,Q=new THREE.Vector3,la=new THREE.Vector3,Ba=new THREE.Vector3,Ca=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){Da[c]=new THREE.Vector3;$[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){i=
+this.faces[c];j=this.faceVertexUvs[0][c];if(i instanceof THREE.Face3)a(this,i.a,i.b,i.c,0,1,2);else if(i instanceof THREE.Face4){a(this,i.a,i.b,i.c,0,1,2);a(this,i.a,i.b,i.d,0,1,3)}}var ta=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){i=this.faces[c];for(g=0;g<i.vertexNormals.length;g++){Ca.copy(i.vertexNormals[g]);f=i[ta[g]];ka=Da[f];la.copy(ka);la.subSelf(Ca.multiplyScalar(Ca.dot(ka))).normalize();Ba.cross(i.vertexNormals[g],ka);f=Ba.dot($[f]);f=f<0?-1:1;i.vertexTangents[g]=new THREE.Vector4(la.x,
+la.y,la.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=[],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 n=f.hierarchy[h].keys[i].rot;f.hierarchy[h].keys[i].rot=new THREE.Quaternion(n[0],n[1],n[2],n[3])}}if(f.hierarchy[h].keys[0].morphTargets!==undefined){n={};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];n[t]=-1}f.hierarchy[h].usedMorphTargets=n;for(i=0;i<f.hierarchy[h].keys.length;i++){var x=
-{};for(t in n){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=
+THREE.AnimationHandler=function(){var a=[],c={},d={};d.update=function(f){for(var i=0;i<a.length;i++)a[i].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 i=0;i<f.hierarchy.length;i++){for(var j=0;j<f.hierarchy[i].keys.length;j++){if(f.hierarchy[i].keys[j].time<
+0)f.hierarchy[i].keys[j].time=0;if(f.hierarchy[i].keys[j].rot!==undefined&&!(f.hierarchy[i].keys[j].rot instanceof THREE.Quaternion)){var o=f.hierarchy[i].keys[j].rot;f.hierarchy[i].keys[j].rot=new THREE.Quaternion(o[0],o[1],o[2],o[3])}}if(f.hierarchy[i].keys[0].morphTargets!==undefined){o={};for(j=0;j<f.hierarchy[i].keys.length;j++)for(var p=0;p<f.hierarchy[i].keys[j].morphTargets.length;p++){var v=f.hierarchy[i].keys[j].morphTargets[p];o[v]=-1}f.hierarchy[i].usedMorphTargets=o;for(j=0;j<f.hierarchy[i].keys.length;j++){var x=
+{};for(v in o){for(p=0;p<f.hierarchy[i].keys[j].morphTargets.length;p++)if(f.hierarchy[i].keys[j].morphTargets[p]===v){x[v]=f.hierarchy[i].keys[j].morphTargetsInfluences[p];break}p===f.hierarchy[i].keys[j].morphTargets.length&&(x[v]=0)}f.hierarchy[i].keys[j].morphTargetsInfluences=x}}for(j=1;j<f.hierarchy[i].keys.length;j++)if(f.hierarchy[i].keys[j].time===f.hierarchy[i].keys[j-1].time){f.hierarchy[i].keys.splice(j,1);j--}for(j=1;j<f.hierarchy[i].keys.length;j++)f.hierarchy[i].keys[j].index=j}j=parseInt(f.length*
+f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(i=0;i<f.hierarchy.length;i++)f.JIT.hierarchy.push(Array(j));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 i=[];if(f instanceof THREE.SkinnedMesh)for(var j=0;j<f.bones.length;j++)i.push(f.bones[j]);else g(f,i);return i};var g=function(f,i){i.push(f);for(var j=0;j<f.children.length;j++)g(f.children[j],i)};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)};
+f instanceof THREE.Bone?f.skinMatrix:f.matrix}var i=f.animationCache.prevKey;f=f.animationCache.nextKey;i.pos=this.data.hierarchy[d].keys[0];i.rot=this.data.hierarchy[d].keys[0];i.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 c=["pos","rot","scl"],d,g,f,h,i,n,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];n=o.nextKey[d];if(n.time<=B){if(y<B)if(this.loop){i=this.data.hierarchy[z].keys[0];for(n=this.getNextKeyWith(d,z,1);n.time<y;){i=n;n=this.getNextKeyWith(d,z,n.index+1)}}else{this.stop();return}else{do{i=n;n=this.getNextKeyWith(d,z,n.index+1)}while(n.time<
-y)}o.prevKey[d]=i;o.nextKey[d]=n}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;g=(y-i.time)/(n.time-i.time);f=i[d];h=n[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,n.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,n,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]];n=a[d[1]];o=a[d[2]];t=a[d[3]];d=f*f;i=f*d;g[0]=this.interpolate(h[0],n[0],o[0],t[0],f,d,i);g[1]=this.interpolate(h[1],n[1],o[1],t[1],f,d,i);g[2]=this.interpolate(h[2],n[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.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],d,g,f,i,j,o,p,v,x=this.data.JIT.hierarchy,y,D;this.currentTime+=a*this.timeScale;D=this.currentTime;y=this.currentTime%=this.data.length;v=parseInt(Math.min(y*this.data.fps,this.data.length*this.data.fps),10);for(var z=0,K=this.hierarchy.length;z<K;z++){a=this.hierarchy[z];p=a.animationCache;if(this.JITCompile&&x[z][v]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=x[z][v];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
+!1}else{a.matrix=x[z][v];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 M=0;M<3;M++){d=c[M];j=p.prevKey[d];o=p.nextKey[d];if(o.time<=D){if(y<D)if(this.loop){j=this.data.hierarchy[z].keys[0];for(o=this.getNextKeyWith(d,z,1);o.time<y;){j=o;o=this.getNextKeyWith(d,z,o.index+1)}}else{this.stop();return}else{do{j=o;o=this.getNextKeyWith(d,z,o.index+1)}while(o.time<
+y)}p.prevKey[d]=j;p.nextKey[d]=o}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;g=(y-j.time)/(o.time-j.time);f=j[d];i=o[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]+(i[0]-f[0])*g;d.y=f[1]+(i[1]-f[1])*g;d.z=f[2]+(i[2]-f[2])*g}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
+this.getPrevKeyWith("pos",z,j.index-1).pos;this.points[1]=f;this.points[2]=i;this.points[3]=this.getNextKeyWith("pos",z,o.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,i,a.quaternion,g);else if(d==="scl"){d=a.scale;d.x=f[0]+(i[0]-f[0])*g;d.y=f[1]+(i[1]-f[1])*g;d.z=f[2]+(i[2]-f[2])*g}}}}if(this.JITCompile&&x[0][v]===undefined){this.hierarchy[0].update(undefined,!0);for(z=0;z<this.hierarchy.length;z++)x[z][v]=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,i,j,o,p,v;f=(a.length-1)*c;i=Math.floor(f);f-=i;d[0]=i==0?i:i-1;d[1]=i;d[2]=i>a.length-2?i:i+1;d[3]=i>a.length-3?i:i+2;i=a[d[0]];o=a[d[1]];p=a[d[2]];v=a[d[3]];d=f*f;j=f*d;g[0]=this.interpolate(i[0],o[0],p[0],v[0],f,d,j);g[1]=this.interpolate(i[1],o[1],p[1],v[1],f,d,j);g[2]=this.interpolate(i[2],o[2],p[2],v[2],f,d,j);return g};
+THREE.Animation.prototype.interpolate=function(a,c,d,g,f,i,j){a=(d-a)*0.5;g=(g-c)*0.5;return(2*(c-d)+a+g)*j+(-3*(c-d)-2*a-g)*i+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,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=d||0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=d||0};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.MultiplyBlending=3;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
+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.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
 THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
 THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
 a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
@@ -110,7 +110,7 @@ if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if
 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.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)}};
+!1};THREE.Texture=function(a,c,d,g,f,i){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=i!==undefined?i: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,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};
@@ -122,12 +122,12 @@ this.morphTargetDictionary[this.geometry.morphTargets[d].name]=d}}}};THREE.Mesh.
 THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
 THREE.Bone.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.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,n;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;n=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;n!==undefined?g.scale.set(n[0],n[1],n[2]):g.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){f=this.geometry.bones[d];
+THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,g,f,i,j,o;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){f=this.geometry.bones[d];i=f.pos;j=f.rotq;o=f.scl;g=this.addBone();g.name=f.name;g.position.set(i[0],i[1],i[2]);g.quaternion.set(j[0],j[1],j[2],j[3]);g.useQuaternion=!0;o!==undefined?g.scale.set(o[0],o[1],o[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.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,i=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[i].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;
@@ -138,24 +138,24 @@ THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=functi
 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,n,o,t,x,y=["a","b","c","d"];for(o=0;o<h;o++){n=c.length;i=f[o];if(i instanceof THREE.Face4){t=4;n=new THREE.Face4(n,n+1,n+2,n+3)}else{t=3;n=new THREE.Face3(n,n+1,n+2)}n.normal.copy(i.normal);d.push(n);for(n=
-0;n<t;n++){x=a[i[y[n]]];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++){n=d[i];n=this.facesShareEdge(c,a,n);if(n!==undefined){n=new THREE.Face4(n.indices[0],n.indices[3],n.indices[2],n.indices[1]);n.normal.set(1,0,0);g.push(n)}}}};
-THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,d){var g,f,h,i,n,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]];n=a[h];for(J=0;J<f;J++){i=d[K[J]];o=a[i];if(Math.abs(n.position.x-o.position.x)<1.0E-4&&Math.abs(n.position.y-o.position.y)<1.0E-4&&Math.abs(n.position.z-o.position.z)<1.0E-4){Q++;if(Q===1){t=n;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,n],indices:[y,
-B,i,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[t,n,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.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 i=f.length,j,o,p,v,x,y=["a","b","c","d"];for(p=0;p<i;p++){o=c.length;j=f[p];if(j instanceof THREE.Face4){v=4;o=new THREE.Face4(o,o+1,o+2,o+3)}else{v=3;o=new THREE.Face3(o,o+1,o+2)}o.normal.copy(j.normal);d.push(o);for(o=
+0;o<v;o++){x=a[j[y[o]]];c.push(new THREE.Vertex(x.position.clone()))}}for(i=0;i<f.length-1;i++){a=d[i];for(j=i+1;j<f.length;j++){o=d[j];o=this.facesShareEdge(c,a,o);if(o!==undefined){o=new THREE.Face4(o.indices[0],o.indices[3],o.indices[2],o.indices[1]);o.normal.set(1,0,0);g.push(o)}}}};
+THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,d){var g,f,i,j,o,p,v,x,y,D,z,K,M,T=0,O=["a","b","c","d"];g=c instanceof THREE.Face4?4:3;f=d instanceof THREE.Face4?4:3;for(K=0;K<g;K++){i=c[O[K]];o=a[i];for(M=0;M<f;M++){j=d[O[M]];p=a[j];if(Math.abs(o.position.x-p.position.x)<1.0E-4&&Math.abs(o.position.y-p.position.y)<1.0E-4&&Math.abs(o.position.z-p.position.z)<1.0E-4){T++;if(T===1){v=o;x=p;y=i;D=j;z=O[K]}if(T===2){z+=O[K];return z==="ad"||z==="ac"?{faces:[c,d],vertices:[v,x,p,o],indices:[y,
+D,j,i],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[v,o,p,x],indices:[y,i,j,D],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[n]=o[n]||new THREE.RenderableVertex;n++;return R}function c(R,O){return O.z-R.z}function d(R,O){var pa=0,Aa=1,Ba=R.z+R.w,sa=O.z+O.w,U=-R.z+R.w,ga=-O.z+O.w;if(Ba>=0&&sa>=0&&U>=0&&ga>=0)return!0;else if(Ba<0&&sa<0||U<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(U<0)pa=Math.max(pa,U/(U-ga));else ga<0&&(Aa=Math.min(Aa,U/(U-ga)));if(Aa<pa)return!1;else{R.lerpSelf(O,pa);O.lerpSelf(R,1-Aa);return!0}}}var g,
-f,h=[],i,n,o=[],t,x,y=[],B,z=[],H,J,Q=[],K,ia,la=[],va=new THREE.Vector4,S=new THREE.Vector4,D=new THREE.Matrix4,fa=new THREE.Matrix4,b=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],oa=new THREE.Vector4,ra=new THREE.Vector4;this.projectVector=function(R,O){D.multiply(O.projectionMatrix,O.matrixWorldInverse);D.multiplyVector3(R);return R};this.unprojectVector=function(R,O){D.multiply(O.matrixWorld,THREE.Matrix4.makeInvert(O.projectionMatrix));
-D.multiplyVector3(R);return R};this.projectObjects=function(R,O,pa){O=[];var Aa,Ba,sa;f=0;Ba=R.objects;R=0;for(Aa=Ba.length;R<Aa;R++){sa=Ba[R];var U;if(!(U=!sa.visible))if(U=sa instanceof THREE.Mesh){a:{U=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++){U=b[ja].x*ga.n14+b[ja].y*ga.n24+b[ja].z*ga.n34+b[ja].w;if(U<=ha){U=!1;break a}}U=!0}U=!U}if(!U){U=h[f]=h[f]||new THREE.RenderableObject;f++;g=U;va.copy(sa.position);
-D.multiplyVector3(va);g.object=sa;g.z=va.z;O.push(g)}}pa&&O.sort(c);return O};this.projectScene=function(R,O,pa){var Aa=[],Ba=O.near,sa=O.far,U,ga,ha,ja,P,ma,ka,Ca,Fa,na,Ea,Wa,Ya,wa,e,p,m;ia=J=B=x=0;O.matrixAutoUpdate&&O.updateMatrix();R.update(undefined,!1,O);D.multiply(O.projectionMatrix,O.matrixWorldInverse);b[0].set(D.n41-D.n11,D.n42-D.n12,D.n43-D.n13,D.n44-D.n14);b[1].set(D.n41+D.n11,D.n42+D.n12,D.n43+D.n13,D.n44+D.n14);b[2].set(D.n41+D.n21,D.n42+D.n22,D.n43+D.n23,D.n44+D.n24);b[3].set(D.n41-
-D.n21,D.n42-D.n22,D.n43-D.n23,D.n44-D.n24);b[4].set(D.n41-D.n31,D.n42-D.n32,D.n43-D.n33,D.n44-D.n34);b[5].set(D.n41+D.n31,D.n42+D.n32,D.n43+D.n33,D.n44+D.n34);for(U=0;U<6;U++){Fa=b[U];Fa.divideScalar(Math.sqrt(Fa.x*Fa.x+Fa.y*Fa.y+Fa.z*Fa.z))}Fa=this.projectObjects(R,O,!0);R=0;for(U=Fa.length;R<U;R++){na=Fa[R].object;if(na.visible){Ea=na.matrixWorld;Wa=na.matrixRotationWorld;Ya=na.materials;wa=na.overdraw;n=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);D.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){P=o[ha.a];ma=o[ha.b];ka=o[ha.c];if(P.visible&&ma.visible&&ka.visible&&(na.doubleSided||na.flipSided!=(ka.positionScreen.x-
-P.positionScreen.x)*(ma.positionScreen.y-P.positionScreen.y)-(ka.positionScreen.y-P.positionScreen.y)*(ma.positionScreen.x-P.positionScreen.x)<0)){Ca=y[x]=y[x]||new THREE.RenderableFace3;x++;t=Ca;t.v1.copy(P);t.v2.copy(ma);t.v3.copy(ka)}else continue}else if(ha instanceof THREE.Face4){P=o[ha.a];ma=o[ha.b];ka=o[ha.c];Ca=o[ha.d];if(P.visible&&ma.visible&&ka.visible&&Ca.visible&&(na.doubleSided||na.flipSided!=((Ca.positionScreen.x-P.positionScreen.x)*(ma.positionScreen.y-P.positionScreen.y)-(Ca.positionScreen.y-
-P.positionScreen.y)*(ma.positionScreen.x-P.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))){m=z[B]=z[B]||new THREE.RenderableFace4;B++;t=m;t.v1.copy(P);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);
-D.multiplyVector3(t.centroidScreen);ka=ha.vertexNormals;P=0;for(ma=ka.length;P<ma;P++){Ca=t.vertexNormalsWorld[P];Ca.copy(ka[P]);Wa.multiplyVector3(Ca)}P=0;for(ma=e.length;P<ma;P++)if(m=e[P][ja]){ka=0;for(Ca=m.length;ka<Ca;ka++)t.uvs[P][ka]=m[ka]}t.meshMaterials=Ya;t.faceMaterials=ha.materials;t.overdraw=wa;t.z=t.centroidScreen.z;Aa.push(t)}}else if(na instanceof THREE.Line){fa.multiply(D,Ea);ja=na.geometry.vertices;P=a();P.positionScreen.copy(ja[0].position);fa.multiplyVector4(P.positionScreen);
-ga=1;for(ha=ja.length;ga<ha;ga++){P=a();P.positionScreen.copy(ja[ga].position);fa.multiplyVector4(P.positionScreen);ma=o[n-2];oa.copy(P.positionScreen);ra.copy(ma.positionScreen);if(d(oa,ra)){oa.multiplyScalar(1/oa.w);ra.multiplyScalar(1/ra.w);Ea=Q[J]=Q[J]||new THREE.RenderableLine;J++;H=Ea;H.v1.positionScreen.copy(oa);H.v2.positionScreen.copy(ra);H.z=Math.max(oa.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);
-D.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+O.projectionMatrix.n11)/(S.w+O.projectionMatrix.n14));K.scale.y=na.scale.y*Math.abs(K.y-(S.y+O.projectionMatrix.n22)/(S.w+O.projectionMatrix.n24));K.materials=na.materials;Aa.push(K)}}}}pa&&Aa.sort(c);return Aa}};
+THREE.Projector=function(){function a(){var b=p[o]=p[o]||new THREE.RenderableVertex;o++;return b}function c(b,Q){return Q.z-b.z}function d(b,Q){var la=0,Ba=1,Ca=b.z+b.w,ta=Q.z+Q.w,W=-b.z+b.w,na=-Q.z+Q.w;if(Ca>=0&&ta>=0&&W>=0&&na>=0)return!0;else if(Ca<0&&ta<0||W<0&&na<0)return!1;else{if(Ca<0)la=Math.max(la,Ca/(Ca-ta));else ta<0&&(Ba=Math.min(Ba,Ca/(Ca-ta)));if(W<0)la=Math.max(la,W/(W-na));else na<0&&(Ba=Math.min(Ba,W/(W-na)));if(Ba<la)return!1;else{b.lerpSelf(Q,la);Q.lerpSelf(b,1-Ba);return!0}}}var g,
+f,i=[],j,o,p=[],v,x,y=[],D,z=[],K,M,T=[],O,pa,Y=[],qa=new THREE.Vector4,V=new THREE.Vector4,E=new THREE.Matrix4,Fa=new THREE.Matrix4,ka=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Da=new THREE.Vector4,$=new THREE.Vector4;this.projectVector=function(b,Q){E.multiply(Q.projectionMatrix,Q.matrixWorldInverse);E.multiplyVector3(b);return b};this.unprojectVector=function(b,Q){E.multiply(Q.matrixWorld,THREE.Matrix4.makeInvert(Q.projectionMatrix));
+E.multiplyVector3(b);return b};this.projectObjects=function(b,Q,la){Q=[];var Ba,Ca,ta;f=0;Ca=b.objects;b=0;for(Ba=Ca.length;b<Ba;b++){ta=Ca[b];var W;if(!(W=!ta.visible))if(W=ta instanceof THREE.Mesh){a:{W=void 0;for(var na=ta.matrixWorld,aa=-ta.geometry.boundingSphere.radius*Math.max(ta.scale.x,Math.max(ta.scale.y,ta.scale.z)),oa=0;oa<6;oa++){W=ka[oa].x*na.n14+ka[oa].y*na.n24+ka[oa].z*na.n34+ka[oa].w;if(W<=aa){W=!1;break a}}W=!0}W=!W}if(!W){W=i[f]=i[f]||new THREE.RenderableObject;f++;g=W;qa.copy(ta.position);
+E.multiplyVector3(qa);g.object=ta;g.z=qa.z;Q.push(g)}}la&&Q.sort(c);return Q};this.projectScene=function(b,Q,la){var Ba=[],Ca=Q.near,ta=Q.far,W,na,aa,oa,U,ra,ma,xa,ua,ca,La,Qa,Ra,cb,Na,ab,Ta;pa=M=D=x=0;Q.matrixAutoUpdate&&Q.updateMatrix();b.update(undefined,!1,Q);E.multiply(Q.projectionMatrix,Q.matrixWorldInverse);ka[0].set(E.n41-E.n11,E.n42-E.n12,E.n43-E.n13,E.n44-E.n14);ka[1].set(E.n41+E.n11,E.n42+E.n12,E.n43+E.n13,E.n44+E.n14);ka[2].set(E.n41+E.n21,E.n42+E.n22,E.n43+E.n23,E.n44+E.n24);ka[3].set(E.n41-
+E.n21,E.n42-E.n22,E.n43-E.n23,E.n44-E.n24);ka[4].set(E.n41-E.n31,E.n42-E.n32,E.n43-E.n33,E.n44-E.n34);ka[5].set(E.n41+E.n31,E.n42+E.n32,E.n43+E.n33,E.n44+E.n34);for(W=0;W<6;W++){ua=ka[W];ua.divideScalar(Math.sqrt(ua.x*ua.x+ua.y*ua.y+ua.z*ua.z))}ua=this.projectObjects(b,Q,!0);b=0;for(W=ua.length;b<W;b++){ca=ua[b].object;if(ca.visible){La=ca.matrixWorld;Qa=ca.matrixRotationWorld;Ra=ca.materials;cb=ca.overdraw;o=0;if(ca instanceof THREE.Mesh){Na=ca.geometry;oa=Na.vertices;ab=Na.faces;Na=Na.faceVertexUvs;
+na=0;for(aa=oa.length;na<aa;na++){j=a();j.positionWorld.copy(oa[na].position);La.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);E.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Ca&&j.positionScreen.z<ta}oa=0;for(na=ab.length;oa<na;oa++){aa=ab[oa];if(aa instanceof THREE.Face3){U=p[aa.a];ra=p[aa.b];ma=p[aa.c];if(U.visible&&ra.visible&&ma.visible&&(ca.doubleSided||ca.flipSided!=(ma.positionScreen.x-
+U.positionScreen.x)*(ra.positionScreen.y-U.positionScreen.y)-(ma.positionScreen.y-U.positionScreen.y)*(ra.positionScreen.x-U.positionScreen.x)<0)){xa=y[x]=y[x]||new THREE.RenderableFace3;x++;v=xa;v.v1.copy(U);v.v2.copy(ra);v.v3.copy(ma)}else continue}else if(aa instanceof THREE.Face4){U=p[aa.a];ra=p[aa.b];ma=p[aa.c];xa=p[aa.d];if(U.visible&&ra.visible&&ma.visible&&xa.visible&&(ca.doubleSided||ca.flipSided!=((xa.positionScreen.x-U.positionScreen.x)*(ra.positionScreen.y-U.positionScreen.y)-(xa.positionScreen.y-
+U.positionScreen.y)*(ra.positionScreen.x-U.positionScreen.x)<0||(ra.positionScreen.x-ma.positionScreen.x)*(xa.positionScreen.y-ma.positionScreen.y)-(ra.positionScreen.y-ma.positionScreen.y)*(xa.positionScreen.x-ma.positionScreen.x)<0))){Ta=z[D]=z[D]||new THREE.RenderableFace4;D++;v=Ta;v.v1.copy(U);v.v2.copy(ra);v.v3.copy(ma);v.v4.copy(xa)}else continue}v.normalWorld.copy(aa.normal);Qa.multiplyVector3(v.normalWorld);v.centroidWorld.copy(aa.centroid);La.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);
+E.multiplyVector3(v.centroidScreen);ma=aa.vertexNormals;U=0;for(ra=ma.length;U<ra;U++){xa=v.vertexNormalsWorld[U];xa.copy(ma[U]);Qa.multiplyVector3(xa)}U=0;for(ra=Na.length;U<ra;U++)if(Ta=Na[U][oa]){ma=0;for(xa=Ta.length;ma<xa;ma++)v.uvs[U][ma]=Ta[ma]}v.meshMaterials=Ra;v.faceMaterials=aa.materials;v.overdraw=cb;v.z=v.centroidScreen.z;Ba.push(v)}}else if(ca instanceof THREE.Line){Fa.multiply(E,La);oa=ca.geometry.vertices;U=a();U.positionScreen.copy(oa[0].position);Fa.multiplyVector4(U.positionScreen);
+na=1;for(aa=oa.length;na<aa;na++){U=a();U.positionScreen.copy(oa[na].position);Fa.multiplyVector4(U.positionScreen);ra=p[o-2];Da.copy(U.positionScreen);$.copy(ra.positionScreen);if(d(Da,$)){Da.multiplyScalar(1/Da.w);$.multiplyScalar(1/$.w);La=T[M]=T[M]||new THREE.RenderableLine;M++;K=La;K.v1.positionScreen.copy(Da);K.v2.positionScreen.copy($);K.z=Math.max(Da.z,$.z);K.materials=ca.materials;Ba.push(K)}}}else if(ca instanceof THREE.Particle){V.set(ca.position.x,ca.position.y,ca.position.z,1);E.multiplyVector4(V);
+V.z/=V.w;if(V.z>0&&V.z<1){La=Y[pa]=Y[pa]||new THREE.RenderableParticle;pa++;O=La;O.x=V.x/V.w;O.y=V.y/V.w;O.z=V.z;O.rotation=ca.rotation.z;O.scale.x=ca.scale.x*Math.abs(O.x-(V.x+Q.projectionMatrix.n11)/(V.w+Q.projectionMatrix.n14));O.scale.y=ca.scale.y*Math.abs(O.y-(V.y+Q.projectionMatrix.n22)/(V.w+Q.projectionMatrix.n24));O.materials=ca.materials;Ba.push(O)}}}}la&&Ba.sort(c);return Ba}};
 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",
@@ -170,7 +170,8 @@ 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:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",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={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}",
+THREE.ShaderLib={lensFlare:{vertexShader:"uniform \tvec3 \tscreenPosition;\nuniform\tvec2\tscale;\nuniform\tfloat\trotation;\nattribute \tvec2 \tposition;\nattribute  vec2\tUV;\nvarying\tvec2\tvUV;\nvoid main(void)\n{\nvUV = UV;\nvec2 pos;\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\ngl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform\tsampler2D\tmap;\nuniform\tfloat\t\topacity;\nuniform    int         renderPink;\nvarying\tvec2\t\tvUV;\nvoid main( void )\n{\nif( renderPink == 1 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );\n} else {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity;\ngl_FragColor = color;\n}\n}"},
+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\nuniform \tfloat \tdarkness;\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, darkness );\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,
@@ -182,86 +183,96 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
 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(e,p,m){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(m.sortParticles){ma.multiplySelf(m.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(W,N){return N[0]-W[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||m.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webglVertexBuffer);b.bufferData(b.ARRAY_BUFFER,u,p)}if(M||m.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,m,j,q){j.__webglProgram||O.initMaterial(j,p,m,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(m&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(m.color.hex);if(m instanceof THREE.Fog){r.fogNear.value=m.near;r.fogFar.value=
-m.far}else if(m instanceof THREE.FogExp2)r.fogDensity.value=m.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j.lights){var k,A,u=0,G=0,F=0,L,M,W,N,T=na,C=T.directional.colors,E=T.directional.positions,I=T.point.colors,Y=T.point.positions,xa=T.point.distances,Ma=0,Z=0;m=A=N=0;for(k=p.length;m<k;m++){A=p[m];L=A.color;M=A.position;W=A.intensity;N=A.distance;if(A instanceof THREE.AmbientLight){u+=L.r;G+=L.g;F+=L.b}else if(A instanceof THREE.DirectionalLight){N=
-Ma*3;C[N]=L.r*W;C[N+1]=L.g*W;C[N+2]=L.b*W;E[N]=M.x;E[N+1]=M.y;E[N+2]=M.z;Ma+=1}else if(A instanceof THREE.PointLight){A=Z*3;I[A]=L.r*W;I[A+1]=L.g*W;I[A+2]=L.b*W;Y[A]=M.x;Y[A+1]=M.y;Y[A+2]=M.z;xa[Z]=N;Z+=1}}for(m=Ma*3;m<C.length;m++)C[m]=0;for(m=Z*3;m<I.length;m++)I[m]=0;T.point.length=Z;T.directional.length=Ma;T.ambient[0]=u;T.ambient[1]=G;T.ambient[2]=F;m=na;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;r.pointLightDistance.value=m.point.distances}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(j.color.r,j.color.g,j.color.b);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.color.g,j.color.b);r.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(j.color.r,j.color.g,j.color.b);r.opacity.value=j.opacity;r.size.value=j.size;r.scale.value=oa.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 V in r)if(G=s.uniforms[V]){k=r[V];u=k.type;m=k.value;if(u=="i")b.uniform1i(G,m);else if(u=="f")b.uniform1f(G,m);else if(u=="fv1")b.uniform1fv(G,m);else if(u=="fv")b.uniform3fv(G,m);else if(u==
-"v2")b.uniform2f(G,m.x,m.y);else if(u=="v3")b.uniform3f(G,m.x,m.y,m.z);else if(u=="c")b.uniform3f(G,m.r,m.g,m.b);else if(u=="t"){b.uniform1i(G,m);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__webglInit){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.__webglInit=!0}la(b.TEXTURE_CUBE_MAP,k,k.image[0]);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+m);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}}else{if(k.needsUpdate){if(k.__webglInit){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.__webglInit=!0}la(b.TEXTURE_2D,k,k.image);b.bindTexture(b.TEXTURE_2D,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+m);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,m,j,q,s){if(j.opacity!=0){e=g(e,p,m,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){m=0;for(var v=s.morphTargetForcedOrder,r=s.morphTargetInfluences;m<j.numSupportedMorphTargets&&m<v.length;){b.bindBuffer(b.ARRAY_BUFFER,q.__webglMorphTargetsBuffers[v[m]]);b.vertexAttribPointer(p["morphTarget"+m],3,b.FLOAT,!1,0,0);s.__webglMorphTargetInfluences[m]=r[v[m]];m++}}else{v=[];var k=-1,A=0;r=s.morphTargetInfluences;var u,G=r.length;m=0;for(s.morphTargetBase!==-1&&(v[s.morphTargetBase]=
-!0);m<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"+m],3,b.FLOAT,!1,0,0);s.__webglMorphTargetInfluences[m]=k;v[A]=1;k=-1;m++}}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 n(e){if(sa!=e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);sa=e}}function o(e){P[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);P[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);P[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);P[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);P[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34);P[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=P[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,m=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),j=0;j<6;j++){e=P[j].x*p.n14+P[j].y*p.n24+P[j].z*p.n34+P[j].w;if(e<=m)return!1}return!0}function x(e,p){e.list[e.count]=p;e.count+=1}function y(e){var p,m,j=e.object,q=e.opaque,s=e.transparent;s.count=0;e=q.count=0;for(p=j.materials.length;e<p;e++){m=j.materials[e];
-m.opacity&&m.opacity<1||m.blending!=THREE.NormalBlending?x(s,m):x(q,m)}}function B(e){var p,m,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(m=v.materials.length;p<m;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,m,j;if(e instanceof THREE.Mesh){m=e.geometry;for(p in m.geometryGroups){j=m.geometryGroups[p];if(m.__dirtyVertices||m.__dirtyMorphTargets||m.__dirtyElements||m.__dirtyUvs||m.__dirtyNormals||m.__dirtyColors||m.__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,W=void 0,N=void 0,T=void 0,C=void 0,E=void 0,I=void 0,Y=void 0;u=void 0;G=void 0;k=void 0;F=void 0;k=void 0;C=void 0;E=void 0;u=void 0;C=void 0;E=void 0;I=void 0;Y=void 0;C=void 0;E=void 0;I=void 0;Y=void 0;C=void 0;E=void 0;I=void 0;Y=void 0;C=void 0;E=void 0;I=void 0;k=void 0;F=void 0;A=void 0;r=void 0;r=void 0;var xa=void 0,Ma=void 0,Z=void 0,V=0,ta=0,Qa=0,Ra=0,Ga=0,Ha=0,X=0,Ia=0,qa=0,w=0,ua=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;W=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,Na=Da.morphTargets;s=0;for(v=ib.length;s<v;s++){r=ib[s];k=lb[r];jb&&(N=jb[r]);kb&&(T=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;E=Sa[k.b].position;I=Sa[k.c].position;ya[ta]=C.x;ya[ta+1]=C.y;ya[ta+2]=C.z;ya[ta+3]=E.x;ya[ta+4]=E.y;ya[ta+5]=E.z;ya[ta+6]=I.x;ya[ta+7]=I.y;ya[ta+
-8]=I.z;ta+=9}if(gb){xa=0;for(Ma=Na.length;xa<Ma;xa++){C=Na[xa].vertices[k.a].position;E=Na[xa].vertices[k.b].position;I=Na[xa].vertices[k.c].position;Z=ab[xa];Z[ua+0]=C.x;Z[ua+1]=C.y;Z[ua+2]=C.z;Z[ua+3]=E.x;Z[ua+4]=E.y;Z[ua+5]=E.z;Z[ua+6]=I.x;Z[ua+7]=I.y;Z[ua+8]=I.z}ua+=9}if(Oa.length){C=Oa[k.a];E=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]=E.x;ea[w+5]=E.y;ea[w+6]=E.z;ea[w+7]=E.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];E=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]=E.x;da[w+5]=E.y;da[w+6]=E.z;da[w+7]=E.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];E=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]=E.x;aa[w+5]=E.y;aa[w+6]=E.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];E=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]=E.x;ca[w+5]=E.y;ca[w+6]=E.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];E=u[2]}else E=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]=E.r;za[qa+7]=E.g;za[qa+8]=E.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&&W)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&&N!==undefined&&L)for(F=0;F<3;F++){r=N[F];Za[Qa]=r.u;Za[Qa+1]=r.v;Qa+=2}if(Xa&&T!==undefined&&L)for(F=0;F<3;F++){r=T[F];$a[Ra]=r.u;$a[Ra+1]=r.v;Ra+=2}if(cb){Ja[Ga]=V;Ja[Ga+1]=V+1;Ja[Ga+2]=V+2;Ga+=3;Ka[Ia]=V;Ka[Ia+1]=V+1;Ka[Ia+2]=V;Ka[Ia+3]=V+2;Ka[Ia+4]=V+1;Ka[Ia+5]=V+2;Ia+=6;V+=3}}else if(k instanceof THREE.Face4){if(bb){C=Sa[k.a].position;E=Sa[k.b].position;I=Sa[k.c].position;Y=Sa[k.d].position;ya[ta]=C.x;ya[ta+1]=C.y;ya[ta+2]=C.z;ya[ta+3]=E.x;ya[ta+4]=E.y;ya[ta+5]=E.z;ya[ta+
-6]=I.x;ya[ta+7]=I.y;ya[ta+8]=I.z;ya[ta+9]=Y.x;ya[ta+10]=Y.y;ya[ta+11]=Y.z;ta+=12}if(gb){xa=0;for(Ma=Na.length;xa<Ma;xa++){C=Na[xa].vertices[k.a].position;E=Na[xa].vertices[k.b].position;I=Na[xa].vertices[k.c].position;Y=Na[xa].vertices[k.d].position;Z=ab[xa];Z[ua+0]=C.x;Z[ua+1]=C.y;Z[ua+2]=C.z;Z[ua+3]=E.x;Z[ua+4]=E.y;Z[ua+5]=E.z;Z[ua+6]=I.x;Z[ua+7]=I.y;Z[ua+8]=I.z;Z[ua+9]=Y.x;Z[ua+10]=Y.y;Z[ua+11]=Y.z}ua+=12}if(Oa.length){C=Oa[k.a];E=Oa[k.b];I=Oa[k.c];Y=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]=E.x;ea[w+5]=E.y;ea[w+6]=E.z;ea[w+7]=E.w;ea[w+8]=I.x;ea[w+9]=I.y;ea[w+10]=I.z;ea[w+11]=I.w;ea[w+12]=Y.x;ea[w+13]=Y.y;ea[w+14]=Y.z;ea[w+15]=Y.w;C=Va[k.a];E=Va[k.b];I=Va[k.c];Y=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]=E.x;da[w+5]=E.y;da[w+6]=E.z;da[w+7]=E.w;da[w+8]=I.x;da[w+9]=I.y;da[w+10]=I.z;da[w+11]=I.w;da[w+12]=Y.x;da[w+13]=Y.y;da[w+14]=Y.z;da[w+15]=Y.w;C=Ta[k.a];E=Ta[k.b];I=Ta[k.c];Y=Ta[k.d];aa[w]=C.x;aa[w+1]=C.y;aa[w+2]=C.z;aa[w+3]=1;aa[w+4]=E.x;aa[w+5]=E.y;
-aa[w+6]=E.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]=Y.x;aa[w+13]=Y.y;aa[w+14]=Y.z;aa[w+15]=1;C=Ua[k.a];E=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]=E.x;ca[w+5]=E.y;ca[w+6]=E.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];E=u[2];u=u[3]}else u=E=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]=E.r;za[qa+7]=E.g;za[qa+8]=E.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&&W)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&&N!==undefined&&L)for(F=0;F<4;F++){r=N[F];Za[Qa]=r.u;Za[Qa+1]=r.v;Qa+=2}if(Xa&&T!==undefined&&L)for(F=0;F<4;F++){r=T[F];$a[Ra]=r.u;$a[Ra+1]=r.v;Ra+=2}if(cb){Ja[Ga]=V;Ja[Ga+1]=V+1;Ja[Ga+2]=V+3;Ja[Ga+3]=V+1;Ja[Ga+4]=V+2;Ja[Ga+5]=V+3;Ga+=6;Ka[Ia]=V;Ka[Ia+1]=V+1;Ka[Ia+2]=V;Ka[Ia+3]=V+3;Ka[Ia+4]=V+1;Ka[Ia+5]=V+2;Ka[Ia+6]=V+2;Ka[Ia+7]=V+3;Ia+=8;V+=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){xa=0;for(Ma=Na.length;xa<Ma;xa++){b.bindBuffer(b.ARRAY_BUFFER,j.__webglMorphTargetsBuffers[xa]);b.bufferData(b.ARRAY_BUFFER,ab[xa],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)}}}m.__dirtyVertices=!1;m.__dirtyMorphTargets=!1;m.__dirtyElements=!1;m.__dirtyUvs=!1;m.__dirtyNormals=!1;m.__dirtyTangents=!1;m.__dirtyColors=!1}else if(e instanceof THREE.Ribbon){m=e.geometry;if(m.__dirtyVertices||m.__dirtyColors){e=m;p=b.DYNAMIC_DRAW;W=e.vertices;
-q=e.colors;N=W.length;s=q.length;T=e.__vertexArray;v=e.__colorArray;V=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<N;L++){M=W[L].position;j=L*3;T[j]=M.x;T[j+1]=M.y;T[j+2]=M.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webglVertexBuffer);b.bufferData(b.ARRAY_BUFFER,T,p)}if(V){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)}}m.__dirtyVertices=!1;m.__dirtyColors=!1}else if(e instanceof THREE.Line){m=
-e.geometry;if(m.__dirtyVertices||m.__dirtyColors){e=m;p=b.DYNAMIC_DRAW;W=e.vertices;q=e.colors;N=W.length;s=q.length;T=e.__vertexArray;v=e.__colorArray;V=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<N;L++){M=W[L].position;j=L*3;T[j]=M.x;T[j+1]=M.y;T[j+2]=M.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webglVertexBuffer);b.bufferData(b.ARRAY_BUFFER,T,p)}if(V){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)}}m.__dirtyVertices=!1;m.__dirtyColors=!1}else if(e instanceof THREE.ParticleSystem){m=e.geometry;(m.__dirtyVertices||m.__dirtyColors||e.sortParticles)&&c(m,b.DYNAMIC_DRAW,e);m.__dirtyVertices=!1;m.__dirtyColors=!1}}function Q(e){function p(F){var L=[];m=0;for(j=F.length;m<j;m++)F[m]==undefined?L.push("undefined"):L.push(F[m].id);return L.join("_")}var m,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,
-m){e.push({buffer:p,object:m,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.SRC_ALPHA,b.ONE);break;case THREE.SubtractiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ZERO,b.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ZERO,b.SRC_COLOR);break;default:b.blendEquationSeparate(b.FUNC_ADD,b.FUNC_ADD);b.blendFuncSeparate(b.SRC_ALPHA,
-b.ONE_MINUS_SRC_ALPHA,b.ONE,b.ONE_MINUS_SRC_ALPHA)}Ba=e}}function la(e,p,m){if((m.width&m.width-1)==0&&(m.height&m.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,
-D(p.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,D(p.minFilter))}}function va(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,m;if(e){p=e.__webglFramebuffer;m=e.width;e=e.height}else{p=null;m=ha;e=ja}if(p!=R){b.bindFramebuffer(b.FRAMEBUFFER,p);b.viewport(U,ga,m,e);R=p}}function S(e,p){var m;if(e=="fragment")m=b.createShader(b.FRAGMENT_SHADER);else e=="vertex"&&(m=b.createShader(b.VERTEX_SHADER));b.shaderSource(m,p);b.compileShader(m);if(!b.getShaderParameter(m,b.COMPILE_STATUS)){console.error(b.getShaderInfoLog(m));console.error(p);
-return null}return m}function D(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;
+THREE.WebGLRenderer=function(a){function c(e,n,k){var h,m,u,r=e.vertices,t=r.length,q=e.colors,A=q.length,s=e.__vertexArray,G=e.__colorArray,B=e.__sortArray,L=e.__dirtyVertices,I=e.__dirtyColors;if(k.sortParticles){ca.multiplySelf(k.matrixWorld);for(h=0;h<t;h++){m=r[h].position;Ra.copy(m);ca.multiplyVector3(Ra);B[h]=[Ra.z,h]}B.sort(function(P,N){return N[0]-P[0]});for(h=0;h<t;h++){m=r[B[h][1]].position;u=h*3;s[u]=m.x;s[u+1]=m.y;s[u+2]=m.z}for(h=0;h<A;h++){u=h*3;color=q[B[h][1]];G[u]=color.r;G[u+1]=
+color.g;G[u+2]=color.b}}else{if(L)for(h=0;h<t;h++){m=r[h].position;u=h*3;s[u]=m.x;s[u+1]=m.y;s[u+2]=m.z}if(I)for(h=0;h<A;h++){color=q[h];u=h*3;G[u]=color.r;G[u+1]=color.g;G[u+2]=color.b}}if(L||k.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webglVertexBuffer);b.bufferData(b.ARRAY_BUFFER,s,n)}if(I||k.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webglColorBuffer);b.bufferData(b.ARRAY_BUFFER,G,n)}}function d(e,n){e.uniforms=Uniforms.clone(n.uniforms);e.vertexShader=n.vertexShader;e.fragmentShader=
+n.fragmentShader}function g(e,n,k,h,m){h.__webglProgram||ta.initMaterial(h,n,k,m);var u=h.program,r=u.uniforms,t=h.uniforms;if(u!=la){b.useProgram(u);la=u}b.uniformMatrix4fv(r.projectionMatrix,!1,La);if(k&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof THREE.ParticleBasicMaterial)){t.fogColor.value.setHex(k.color.hex);if(k instanceof THREE.Fog){t.fogNear.value=k.near;t.fogFar.value=
+k.far}else if(k instanceof THREE.FogExp2)t.fogDensity.value=k.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h.lights){var q,A,s=0,G=0,B=0,L,I,P,N,R=cb,C=R.directional.colors,F=R.directional.positions,J=R.point.colors,da=R.point.positions,ya=R.point.distances,Oa=0,ea=0;k=A=N=0;for(q=n.length;k<q;k++){A=n[k];L=A.color;I=A.position;P=A.intensity;N=A.distance;if(A instanceof THREE.AmbientLight){s+=L.r;G+=L.g;B+=L.b}else if(A instanceof THREE.DirectionalLight){N=
+Oa*3;C[N]=L.r*P;C[N+1]=L.g*P;C[N+2]=L.b*P;F[N]=I.x;F[N+1]=I.y;F[N+2]=I.z;Oa+=1}else if(A instanceof THREE.PointLight){A=ea*3;J[A]=L.r*P;J[A+1]=L.g*P;J[A+2]=L.b*P;da[A]=I.x;da[A+1]=I.y;da[A+2]=I.z;ya[ea]=N;ea+=1}}for(k=Oa*3;k<C.length;k++)C[k]=0;for(k=ea*3;k<J.length;k++)J[k]=0;R.point.length=ea;R.directional.length=Oa;R.ambient[0]=s;R.ambient[1]=G;R.ambient[2]=B;k=cb;t.enableLighting.value=k.directional.length+k.point.length;t.ambientLightColor.value=k.ambient;t.directionalLightColor.value=k.directional.colors;
+t.directionalLightDirection.value=k.directional.positions;t.pointLightColor.value=k.point.colors;t.pointLightPosition.value=k.point.positions;t.pointLightDistance.value=k.point.distances}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){t.diffuse.value.setRGB(h.color.r,h.color.g,h.color.b);t.opacity.value=h.opacity;t.map.texture=h.map;t.lightMap.texture=h.lightMap;t.envMap.texture=h.envMap;t.reflectivity.value=h.reflectivity;t.refractionRatio.value=
+h.refractionRatio;t.combine.value=h.combine;t.useRefract.value=h.envMap&&h.envMap.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){t.diffuse.value.setRGB(h.color.r,h.color.g,h.color.b);t.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){t.psColor.value.setRGB(h.color.r,h.color.g,h.color.b);t.opacity.value=h.opacity;t.size.value=h.size;t.scale.value=Q.height/2;t.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){t.ambient.value.setRGB(h.ambient.r,
+h.ambient.g,h.ambient.b);t.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);t.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){t.mNear.value=e.near;t.mFar.value=e.far;t.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)t.opacity.value=h.opacity;for(var X in t)if(G=u.uniforms[X]){q=t[X];s=q.type;k=q.value;if(s=="i")b.uniform1i(G,k);else if(s=="f")b.uniform1f(G,k);else if(s=="fv1")b.uniform1fv(G,k);else if(s=="fv")b.uniform3fv(G,k);else if(s==
+"v2")b.uniform2f(G,k.x,k.y);else if(s=="v3")b.uniform3f(G,k.x,k.y,k.z);else if(s=="c")b.uniform3f(G,k.r,k.g,k.b);else if(s=="t"){b.uniform1i(G,k);if(q=q.texture)if(q.image instanceof Array&&q.image.length==6){if(q.image.length==6){if(q.needsUpdate){if(q.__webglInit){b.bindTexture(b.TEXTURE_CUBE_MAP,q.image.__webglTextureCube);for(s=0;s<6;++s)b.texSubImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,0,0,b.RGBA,b.UNSIGNED_BYTE,q.image[s])}else{q.image.__webglTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,
+q.image.__webglTextureCube);for(s=0;s<6;++s)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,q.image[s]);q.__webglInit=!0}V(b.TEXTURE_CUBE_MAP,q,q.image[0]);b.bindTexture(b.TEXTURE_CUBE_MAP,null);q.needsUpdate=!1}b.activeTexture(b.TEXTURE0+k);b.bindTexture(b.TEXTURE_CUBE_MAP,q.image.__webglTextureCube)}}else E(q,k)}}b.uniformMatrix4fv(r.modelViewMatrix,!1,m._modelViewMatrixArray);b.uniformMatrix3fv(r.normalMatrix,!1,m._normalMatrixArray);(h instanceof THREE.MeshShaderMaterial||
+h instanceof THREE.MeshPhongMaterial||h.envMap)&&b.uniform3f(r.cameraPosition,e.position.x,e.position.y,e.position.z);(h instanceof THREE.MeshShaderMaterial||h.envMap||h.skinning)&&b.uniformMatrix4fv(r.objectMatrix,!1,m._objectMatrixArray);(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial||h.skinning)&&b.uniformMatrix4fv(r.viewMatrix,!1,Qa);if(h instanceof THREE.ShadowVolumeDynamicMaterial){e=t.directionalLightDirection.value;e[0]=
+-n.position.x;e[1]=-n.position.y;e[2]=-n.position.z;b.uniform3fv(r.directionalLightDirection,e);b.uniformMatrix4fv(r.objectMatrix,!1,m._objectMatrixArray);b.uniformMatrix4fv(r.viewMatrix,!1,Qa)}if(h.skinning){b.uniformMatrix4fv(r.cameraInverseMatrix,!1,Qa);b.uniformMatrix4fv(r.boneGlobalMatrices,!1,m.boneMatrices)}return u}function f(e,n,k,h,m,u){if(h.opacity!=0){e=g(e,n,k,h,u).attributes;if(h.morphTargets){n=h.program.attributes;u.morphTargetBase!==-1?b.bindBuffer(b.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[u.morphTargetBase]):
+b.bindBuffer(b.ARRAY_BUFFER,m.__webglVertexBuffer);b.vertexAttribPointer(n.position,3,b.FLOAT,!1,0,0);if(u.morphTargetForcedOrder.length){k=0;for(var r=u.morphTargetForcedOrder,t=u.morphTargetInfluences;k<h.numSupportedMorphTargets&&k<r.length;){b.bindBuffer(b.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[r[k]]);b.vertexAttribPointer(n["morphTarget"+k],3,b.FLOAT,!1,0,0);u.__webglMorphTargetInfluences[k]=t[r[k]];k++}}else{r=[];var q=-1,A=0;t=u.morphTargetInfluences;var s,G=t.length;k=0;for(u.morphTargetBase!==
+-1&&(r[u.morphTargetBase]=!0);k<h.numSupportedMorphTargets;){for(s=0;s<G;s++)if(!r[s]&&t[s]>q){A=s;q=t[A]}b.bindBuffer(b.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[A]);b.vertexAttribPointer(n["morphTarget"+k],3,b.FLOAT,!1,0,0);u.__webglMorphTargetInfluences[k]=q;r[A]=1;q=-1;k++}}b.uniform1fv(h.program.uniforms.morphTargetInfluences,u.__webglMorphTargetInfluences)}else{b.bindBuffer(b.ARRAY_BUFFER,m.__webglVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,!1,0,0)}if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER,
+m.__webglColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,!1,0,0)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,m.__webglNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,!1,0,0)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,m.__webglTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,!1,0,0)}if(e.uv>=0)if(m.__webglUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,m.__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(m.__webglUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,m.__webglUV2Buffer);b.vertexAttribPointer(e.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(h.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,m.__webglSkinVertexABuffer);b.vertexAttribPointer(e.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,m.__webglSkinVertexBBuffer);b.vertexAttribPointer(e.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,
+m.__webglSkinIndicesBuffer);b.vertexAttribPointer(e.skinIndex,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,m.__webglSkinWeightsBuffer);b.vertexAttribPointer(e.skinWeight,4,b.FLOAT,!1,0,0)}if(u instanceof THREE.Mesh)if(h.wireframe){b.lineWidth(h.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer);b.drawElements(b.LINES,m.__webglLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer);b.drawElements(b.TRIANGLES,m.__webglFaceCount,b.UNSIGNED_SHORT,
+0)}else if(u instanceof THREE.Line){u=u.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(h.linewidth);b.drawArrays(u,0,m.__webglLineCount)}else if(u instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,m.__webglParticleCount);else u instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,m.__webglVertexCount)}}function i(e,n){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(n.attributes.position);b.vertexAttribPointer(n.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(n.attributes.normal);b.vertexAttribPointer(n.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,e.count);e.count=0}function j(e){if(W!=e.doubleSided){e.doubleSided?
+b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);W=e.doubleSided}if(na!=e.flipSided){e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);na=e.flipSided}}function o(e){if(oa!=e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);oa=e}}function p(e){ua[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);ua[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);ua[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);ua[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);ua[4].set(e.n41-e.n31,e.n42-
+e.n32,e.n43-e.n33,e.n44-e.n34);ua[5].set(e.n41+e.n31,e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var n;for(e=0;e<6;e++){n=ua[e];n.divideScalar(Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z))}}function v(e){for(var n=e.matrixWorld,k=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),h=0;h<6;h++){e=ua[h].x*n.n14+ua[h].y*n.n24+ua[h].z*n.n34+ua[h].w;if(e<=k)return!1}return!0}function x(e,n){e.list[e.count]=n;e.count+=1}function y(e){var n,k,h=e.object,m=e.opaque,u=e.transparent;u.count=
+0;e=m.count=0;for(n=h.materials.length;e<n;e++){k=h.materials[e];k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?x(u,k):x(m,k)}}function D(e){var n,k,h,m,u=e.object,r=e.buffer,t=e.opaque,q=e.transparent;q.count=0;e=t.count=0;for(h=u.materials.length;e<h;e++){n=u.materials[e];if(n instanceof THREE.MeshFaceMaterial){n=0;for(k=r.materials.length;n<k;n++)(m=r.materials[n])&&(m.opacity&&m.opacity<1||m.blending!=THREE.NormalBlending?x(q,m):x(t,m))}else{m=n;m.opacity&&m.opacity<1||m.blending!=THREE.NormalBlending?
+x(q,m):x(t,m)}}}function z(e,n){return n.z-e.z}function K(e){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);var n,k=e.lights.length,h,m=e.lights,u=[],r,t,q,A,s,G=e.__webglShadowVolumes.length;for(n=0;n<k;n++){h=e.lights[n];if(h instanceof THREE.DirectionalLight){u[0]=-h.position.x;u[1]=-h.position.y;
+u[2]=-h.position.z;for(s=0;s<G;s++){h=e.__webglShadowVolumes[s].object;r=e.__webglShadowVolumes[s].buffer;t=h.materials[0];t.program||ta.initMaterial(t,m,undefined,h);t=t.program;q=t.uniforms;A=t.attributes;if(la!==t){b.useProgram(t);la=t;b.uniformMatrix4fv(q.projectionMatrix,!1,La);b.uniformMatrix4fv(q.viewMatrix,!1,Qa);b.uniform3fv(q.directionalLightDirection,u)}h.matrixWorld.flattenToArray(h._objectMatrixArray);b.uniformMatrix4fv(q.objectMatrix,!1,h._objectMatrixArray);b.bindBuffer(b.ARRAY_BUFFER,
+r.__webglVertexBuffer);b.vertexAttribPointer(A.position,3,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,r.__webglNormalBuffer);b.vertexAttribPointer(A.normal,3,b.FLOAT,!1,0,0);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,r.__webglFaceBuffer);b.cullFace(b.FRONT);b.drawElements(b.TRIANGLES,r.__webglFaceCount,b.UNSIGNED_SHORT,0);b.cullFace(b.BACK);b.drawElements(b.TRIANGLES,r.__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);aa="";la=S.program;b.useProgram(S.program);b.uniformMatrix4fv(S.projectionLocation,!1,La);b.uniform1f(S.darknessLocation,S.darkness);b.bindBuffer(b.ARRAY_BUFFER,S.vertexBuffer);b.vertexAttribPointer(S.vertexLocation,3,b.FLOAT,!1,0,0);b.enableVertexAttribArray(S.vertexLocation);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.blendEquation(b.FUNC_ADD);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,S.elementBuffer);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.disable(b.STENCIL_TEST);
+b.enable(b.DEPTH_TEST);b.depthMask(Ca)}function M(e,n){var k,h,m,u=e.__webglLensFlares.length,r,t,q;r=new THREE.Vector3;var A=xa/ma;t=ma*0.5;q=xa*0.5;var s=16/xa,G=[s*A,s],B=[1,1,0];s=[1,1];var L,I=H.readBackPixels,P,N,R=H.uniforms;k=H.attributes;b.useProgram(H.program);la=H.program;aa="";b.uniform1i(R.map,0);b.activeTexture(b.TEXTURE0);b.uniform1f(R.opacity,1);b.uniform1f(R.rotation,0);b.uniform2fv(R.scale,G);b.bindBuffer(b.ARRAY_BUFFER,H.vertexBuffer);b.vertexAttribPointer(k.vertex,2,b.FLOAT,!1,
+16,0);b.vertexAttribPointer(k.uv,2,b.FLOAT,!1,16,8);b.bindTexture(b.TEXTURE_2D,H.tempTexture);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,H.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);for(m=0;m<u;m++){k=e.__webglLensFlares[m].object;r.set(k.matrixWorld.n14,k.matrixWorld.n24,k.matrixWorld.n34);n.matrixWorldInverse.multiplyVector3(r);h=r.z;n.projectionMatrix.multiplyVector3(r);B[0]=r.x;B[1]=r.y;B[2]=r.z;s[0]=B[0]*t+t;s[1]=B[1]*q+q;b.copyTexSubImage2D(b.TEXTURE_2D,0,0,0,s[0]-8,s[1]-8,16,16);b.uniform3fv(R.screenPosition,
+B);b.uniform1i(R.renderPink,1);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);try{b.readPixels(s[0]-8,s[1]-8,16,16,b.RGBA,b.UNSIGNED_BYTE,H.readBackPixels)}catch(C){console.log("WebGLRenderer.renderLensFlare: readPixels failed!")}b.getError()&&console.log("WebGLRenderer.renderLensFlare: readPixels failed!");sampleDistance=parseInt(5*(1-Math.max(0,Math.min(-h,n.far))/n.far),10)+2;h=sampleDistance*4;L=sampleDistance*64;N=0;P=28-h+(448-L);H.readBackPixels[P+0]===255&&H.readBackPixels[P+
+1]===0&&H.readBackPixels[P+2]===255&&(N+=0.2);P=28+h+(448-L);I[P+0]===255&&I[P+1]===0&&I[P+2]===255&&(N+=0.2);P=28+h+(448+L);I[P+0]===255&&I[P+1]===0&&I[P+2]===255&&(N+=0.2);P=28-h+(448+L);I[P+0]===255&&I[P+1]===0&&I[P+2]===255&&(N+=0.2);P=476;I[P+0]===255&&I[P+1]===0&&I[P+2]===255&&(N+=0.2);k.positionScreen.x=B[0];k.positionScreen.y=B[1];k.positionScreen.z=B[2];k.customUpdateCallback?k.customUpdateCallback(N,k):k.updateLensFlares(N);b.uniform1i(R.renderPink,0);b.disable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,
+6,b.UNSIGNED_SHORT,0)}for(m=0;m<u;m++){k=e.__webglLensFlares[m].object;r=0;for(t=k.lensFlares.length;r<t;r++){q=k.lensFlares[r];if(q.opacity>0.0010&&q.scale>0.0010){B[0]=q.x;B[1]=q.y;B[2]=q.z;s=q.size*q.scale/xa;G[0]=s*A;G[1]=s;b.uniform3fv(R.screenPosition,B);b.uniform1f(R.rotation,q.rotation);b.uniform2fv(R.scale,G);b.uniform1f(R.opacity,q.opacity);qa(q.blending);E(q.texture,0);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}}}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(Ca)}function T(e,
+n){e._modelViewMatrix.multiplyToArray(n.matrixWorldInverse,e.matrixWorld,e._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)}function O(e){var n,k,h;if(e instanceof THREE.Mesh){k=e.geometry;for(n in k.geometryGroups){h=k.geometryGroups[n];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents){var m=b.DYNAMIC_DRAW,u=void 0,r=void 0,t=void 0,q=void 0;t=void 0;var A=
+void 0,s=void 0,G=void 0,B=void 0,L=void 0,I=void 0,P=void 0,N=void 0,R=void 0,C=void 0,F=void 0,J=void 0,da=void 0;s=void 0;G=void 0;q=void 0;B=void 0;q=void 0;C=void 0;F=void 0;s=void 0;C=void 0;F=void 0;J=void 0;da=void 0;C=void 0;F=void 0;J=void 0;da=void 0;C=void 0;F=void 0;J=void 0;da=void 0;C=void 0;F=void 0;J=void 0;q=void 0;B=void 0;A=void 0;t=void 0;t=void 0;var ya=void 0,Oa=void 0,ea=void 0,X=0,va=0,Va=0,Wa=0,Ga=0,Ha=0,Z=0,Ia=0,sa=0,w=0,wa=0,za=h.__vertexArray,db=h.__uvArray,eb=h.__uv2Array,
+Ma=h.__normalArray,fa=h.__tangentArray,Aa=h.__colorArray,ga=h.__skinVertexAArray,ha=h.__skinVertexBArray,ia=h.__skinIndexArray,ja=h.__skinWeightArray,fb=h.__morphTargetsArrays,Ja=h.__faceArray,Ka=h.__lineArray,mb=h.__needsSmoothNormals;I=h.__vertexColorType;L=h.__uvType;P=h.__normalType;var Ea=e.geometry,gb=Ea.__dirtyVertices,hb=Ea.__dirtyElements,bb=Ea.__dirtyUvs,ib=Ea.__dirtyNormals,jb=Ea.__dirtyTangents,kb=Ea.__dirtyColors,lb=Ea.__dirtyMorphTargets,Xa=Ea.vertices,nb=h.faces,rb=Ea.faces,ob=Ea.faceVertexUvs[0],
+pb=Ea.faceVertexUvs[1],Ya=Ea.skinVerticesA,Za=Ea.skinVerticesB,$a=Ea.skinIndices,Sa=Ea.skinWeights,Ua=Ea.edgeFaces,Pa=Ea.morphTargets;u=0;for(r=nb.length;u<r;u++){t=nb[u];q=rb[t];ob&&(N=ob[t]);pb&&(R=pb[t]);t=q.vertexNormals;A=q.normal;s=q.vertexColors;G=q.color;B=q.vertexTangents;if(q instanceof THREE.Face3){if(gb){C=Xa[q.a].position;F=Xa[q.b].position;J=Xa[q.c].position;za[va]=C.x;za[va+1]=C.y;za[va+2]=C.z;za[va+3]=F.x;za[va+4]=F.y;za[va+5]=F.z;za[va+6]=J.x;za[va+7]=J.y;za[va+8]=J.z;va+=9}if(lb){ya=
+0;for(Oa=Pa.length;ya<Oa;ya++){C=Pa[ya].vertices[q.a].position;F=Pa[ya].vertices[q.b].position;J=Pa[ya].vertices[q.c].position;ea=fb[ya];ea[wa+0]=C.x;ea[wa+1]=C.y;ea[wa+2]=C.z;ea[wa+3]=F.x;ea[wa+4]=F.y;ea[wa+5]=F.z;ea[wa+6]=J.x;ea[wa+7]=J.y;ea[wa+8]=J.z}wa+=9}if(Sa.length){C=Sa[q.a];F=Sa[q.b];J=Sa[q.c];ja[w]=C.x;ja[w+1]=C.y;ja[w+2]=C.z;ja[w+3]=C.w;ja[w+4]=F.x;ja[w+5]=F.y;ja[w+6]=F.z;ja[w+7]=F.w;ja[w+8]=J.x;ja[w+9]=J.y;ja[w+10]=J.z;ja[w+11]=J.w;C=$a[q.a];F=$a[q.b];J=$a[q.c];ia[w]=C.x;ia[w+1]=C.y;ia[w+
+2]=C.z;ia[w+3]=C.w;ia[w+4]=F.x;ia[w+5]=F.y;ia[w+6]=F.z;ia[w+7]=F.w;ia[w+8]=J.x;ia[w+9]=J.y;ia[w+10]=J.z;ia[w+11]=J.w;C=Ya[q.a];F=Ya[q.b];J=Ya[q.c];ga[w]=C.x;ga[w+1]=C.y;ga[w+2]=C.z;ga[w+3]=1;ga[w+4]=F.x;ga[w+5]=F.y;ga[w+6]=F.z;ga[w+7]=1;ga[w+8]=J.x;ga[w+9]=J.y;ga[w+10]=J.z;ga[w+11]=1;C=Za[q.a];F=Za[q.b];J=Za[q.c];ha[w]=C.x;ha[w+1]=C.y;ha[w+2]=C.z;ha[w+3]=1;ha[w+4]=F.x;ha[w+5]=F.y;ha[w+6]=F.z;ha[w+7]=1;ha[w+8]=J.x;ha[w+9]=J.y;ha[w+10]=J.z;ha[w+11]=1;w+=12}if(kb&&I){if(s.length==3&&I==THREE.VertexColors){q=
+s[0];C=s[1];F=s[2]}else F=C=q=G;Aa[sa]=q.r;Aa[sa+1]=q.g;Aa[sa+2]=q.b;Aa[sa+3]=C.r;Aa[sa+4]=C.g;Aa[sa+5]=C.b;Aa[sa+6]=F.r;Aa[sa+7]=F.g;Aa[sa+8]=F.b;sa+=9}if(jb&&Ea.hasTangents){s=B[0];G=B[1];q=B[2];fa[Z]=s.x;fa[Z+1]=s.y;fa[Z+2]=s.z;fa[Z+3]=s.w;fa[Z+4]=G.x;fa[Z+5]=G.y;fa[Z+6]=G.z;fa[Z+7]=G.w;fa[Z+8]=q.x;fa[Z+9]=q.y;fa[Z+10]=q.z;fa[Z+11]=q.w;Z+=12}if(ib&&P)if(t.length==3&&mb)for(B=0;B<3;B++){A=t[B];Ma[Ha]=A.x;Ma[Ha+1]=A.y;Ma[Ha+2]=A.z;Ha+=3}else for(B=0;B<3;B++){Ma[Ha]=A.x;Ma[Ha+1]=A.y;Ma[Ha+2]=A.z;
+Ha+=3}if(bb&&N!==undefined&&L)for(B=0;B<3;B++){t=N[B];db[Va]=t.u;db[Va+1]=t.v;Va+=2}if(bb&&R!==undefined&&L)for(B=0;B<3;B++){t=R[B];eb[Wa]=t.u;eb[Wa+1]=t.v;Wa+=2}if(hb){Ja[Ga]=X;Ja[Ga+1]=X+1;Ja[Ga+2]=X+2;Ga+=3;Ka[Ia]=X;Ka[Ia+1]=X+1;Ka[Ia+2]=X;Ka[Ia+3]=X+2;Ka[Ia+4]=X+1;Ka[Ia+5]=X+2;Ia+=6;X+=3}}else if(q instanceof THREE.Face4){if(gb){C=Xa[q.a].position;F=Xa[q.b].position;J=Xa[q.c].position;da=Xa[q.d].position;za[va]=C.x;za[va+1]=C.y;za[va+2]=C.z;za[va+3]=F.x;za[va+4]=F.y;za[va+5]=F.z;za[va+6]=J.x;
+za[va+7]=J.y;za[va+8]=J.z;za[va+9]=da.x;za[va+10]=da.y;za[va+11]=da.z;va+=12}if(lb){ya=0;for(Oa=Pa.length;ya<Oa;ya++){C=Pa[ya].vertices[q.a].position;F=Pa[ya].vertices[q.b].position;J=Pa[ya].vertices[q.c].position;da=Pa[ya].vertices[q.d].position;ea=fb[ya];ea[wa+0]=C.x;ea[wa+1]=C.y;ea[wa+2]=C.z;ea[wa+3]=F.x;ea[wa+4]=F.y;ea[wa+5]=F.z;ea[wa+6]=J.x;ea[wa+7]=J.y;ea[wa+8]=J.z;ea[wa+9]=da.x;ea[wa+10]=da.y;ea[wa+11]=da.z}wa+=12}if(Sa.length){C=Sa[q.a];F=Sa[q.b];J=Sa[q.c];da=Sa[q.d];ja[w]=C.x;ja[w+1]=C.y;
+ja[w+2]=C.z;ja[w+3]=C.w;ja[w+4]=F.x;ja[w+5]=F.y;ja[w+6]=F.z;ja[w+7]=F.w;ja[w+8]=J.x;ja[w+9]=J.y;ja[w+10]=J.z;ja[w+11]=J.w;ja[w+12]=da.x;ja[w+13]=da.y;ja[w+14]=da.z;ja[w+15]=da.w;C=$a[q.a];F=$a[q.b];J=$a[q.c];da=$a[q.d];ia[w]=C.x;ia[w+1]=C.y;ia[w+2]=C.z;ia[w+3]=C.w;ia[w+4]=F.x;ia[w+5]=F.y;ia[w+6]=F.z;ia[w+7]=F.w;ia[w+8]=J.x;ia[w+9]=J.y;ia[w+10]=J.z;ia[w+11]=J.w;ia[w+12]=da.x;ia[w+13]=da.y;ia[w+14]=da.z;ia[w+15]=da.w;C=Ya[q.a];F=Ya[q.b];J=Ya[q.c];da=Ya[q.d];ga[w]=C.x;ga[w+1]=C.y;ga[w+2]=C.z;ga[w+3]=
+1;ga[w+4]=F.x;ga[w+5]=F.y;ga[w+6]=F.z;ga[w+7]=1;ga[w+8]=J.x;ga[w+9]=J.y;ga[w+10]=J.z;ga[w+11]=1;ga[w+12]=da.x;ga[w+13]=da.y;ga[w+14]=da.z;ga[w+15]=1;C=Za[q.a];F=Za[q.b];J=Za[q.c];q=Za[q.d];ha[w]=C.x;ha[w+1]=C.y;ha[w+2]=C.z;ha[w+3]=1;ha[w+4]=F.x;ha[w+5]=F.y;ha[w+6]=F.z;ha[w+7]=1;ha[w+8]=J.x;ha[w+9]=J.y;ha[w+10]=J.z;ha[w+11]=1;ha[w+12]=q.x;ha[w+13]=q.y;ha[w+14]=q.z;ha[w+15]=1;w+=16}if(kb&&I){if(s.length==4&&I==THREE.VertexColors){q=s[0];C=s[1];F=s[2];s=s[3]}else s=F=C=q=G;Aa[sa]=q.r;Aa[sa+1]=q.g;Aa[sa+
+2]=q.b;Aa[sa+3]=C.r;Aa[sa+4]=C.g;Aa[sa+5]=C.b;Aa[sa+6]=F.r;Aa[sa+7]=F.g;Aa[sa+8]=F.b;Aa[sa+9]=s.r;Aa[sa+10]=s.g;Aa[sa+11]=s.b;sa+=12}if(jb&&Ea.hasTangents){s=B[0];G=B[1];q=B[2];B=B[3];fa[Z]=s.x;fa[Z+1]=s.y;fa[Z+2]=s.z;fa[Z+3]=s.w;fa[Z+4]=G.x;fa[Z+5]=G.y;fa[Z+6]=G.z;fa[Z+7]=G.w;fa[Z+8]=q.x;fa[Z+9]=q.y;fa[Z+10]=q.z;fa[Z+11]=q.w;fa[Z+12]=B.x;fa[Z+13]=B.y;fa[Z+14]=B.z;fa[Z+15]=B.w;Z+=16}if(ib&&P)if(t.length==4&&mb)for(B=0;B<4;B++){A=t[B];Ma[Ha]=A.x;Ma[Ha+1]=A.y;Ma[Ha+2]=A.z;Ha+=3}else for(B=0;B<4;B++){Ma[Ha]=
+A.x;Ma[Ha+1]=A.y;Ma[Ha+2]=A.z;Ha+=3}if(bb&&N!==undefined&&L)for(B=0;B<4;B++){t=N[B];db[Va]=t.u;db[Va+1]=t.v;Va+=2}if(bb&&R!==undefined&&L)for(B=0;B<4;B++){t=R[B];eb[Wa]=t.u;eb[Wa+1]=t.v;Wa+=2}if(hb){Ja[Ga]=X;Ja[Ga+1]=X+1;Ja[Ga+2]=X+3;Ja[Ga+3]=X+1;Ja[Ga+4]=X+2;Ja[Ga+5]=X+3;Ga+=6;Ka[Ia]=X;Ka[Ia+1]=X+1;Ka[Ia+2]=X;Ka[Ia+3]=X+3;Ka[Ia+4]=X+1;Ka[Ia+5]=X+2;Ka[Ia+6]=X+2;Ka[Ia+7]=X+3;Ia+=8;X+=4}}}if(Ua){u=0;for(r=Ua.length;u<r;u++){Ja[Ga]=Ua[u].a;Ja[Ga+1]=Ua[u].b;Ja[Ga+2]=Ua[u].c;Ja[Ga+3]=Ua[u].a;Ja[Ga+4]=
+Ua[u].c;Ja[Ga+5]=Ua[u].d;Ga+=6}}if(gb){b.bindBuffer(b.ARRAY_BUFFER,h.__webglVertexBuffer);b.bufferData(b.ARRAY_BUFFER,za,m)}if(lb){ya=0;for(Oa=Pa.length;ya<Oa;ya++){b.bindBuffer(b.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[ya]);b.bufferData(b.ARRAY_BUFFER,fb[ya],m)}}if(kb&&sa>0){b.bindBuffer(b.ARRAY_BUFFER,h.__webglColorBuffer);b.bufferData(b.ARRAY_BUFFER,Aa,m)}if(ib){b.bindBuffer(b.ARRAY_BUFFER,h.__webglNormalBuffer);b.bufferData(b.ARRAY_BUFFER,Ma,m)}if(jb&&Ea.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,
+h.__webglTangentBuffer);b.bufferData(b.ARRAY_BUFFER,fa,m)}if(bb&&Va>0){b.bindBuffer(b.ARRAY_BUFFER,h.__webglUVBuffer);b.bufferData(b.ARRAY_BUFFER,db,m)}if(bb&&Wa>0){b.bindBuffer(b.ARRAY_BUFFER,h.__webglUV2Buffer);b.bufferData(b.ARRAY_BUFFER,eb,m)}if(hb){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ja,m);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ka,m)}if(w>0){b.bindBuffer(b.ARRAY_BUFFER,h.__webglSkinVertexABuffer);
+b.bufferData(b.ARRAY_BUFFER,ga,m);b.bindBuffer(b.ARRAY_BUFFER,h.__webglSkinVertexBBuffer);b.bufferData(b.ARRAY_BUFFER,ha,m);b.bindBuffer(b.ARRAY_BUFFER,h.__webglSkinIndicesBuffer);b.bufferData(b.ARRAY_BUFFER,ia,m);b.bindBuffer(b.ARRAY_BUFFER,h.__webglSkinWeightsBuffer);b.bufferData(b.ARRAY_BUFFER,ja,m)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(e instanceof THREE.Ribbon){k=e.geometry;if(k.__dirtyVertices||
+k.__dirtyColors){e=k;n=b.DYNAMIC_DRAW;P=e.vertices;m=e.colors;N=P.length;u=m.length;R=e.__vertexArray;r=e.__colorArray;X=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<N;L++){I=P[L].position;h=L*3;R[h]=I.x;R[h+1]=I.y;R[h+2]=I.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webglVertexBuffer);b.bufferData(b.ARRAY_BUFFER,R,n)}if(X){for(L=0;L<u;L++){color=m[L];h=L*3;r[h]=color.r;r[h+1]=color.g;r[h+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,e.__webglColorBuffer);b.bufferData(b.ARRAY_BUFFER,r,n)}}k.__dirtyVertices=!1;
+k.__dirtyColors=!1}else if(e instanceof THREE.Line){k=e.geometry;if(k.__dirtyVertices||k.__dirtyColors){e=k;n=b.DYNAMIC_DRAW;P=e.vertices;m=e.colors;N=P.length;u=m.length;R=e.__vertexArray;r=e.__colorArray;X=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<N;L++){I=P[L].position;h=L*3;R[h]=I.x;R[h+1]=I.y;R[h+2]=I.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webglVertexBuffer);b.bufferData(b.ARRAY_BUFFER,R,n)}if(X){for(L=0;L<u;L++){color=m[L];h=L*3;r[h]=color.r;r[h+1]=color.g;r[h+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,
+e.__webglColorBuffer);b.bufferData(b.ARRAY_BUFFER,r,n)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(e instanceof THREE.ParticleSystem){k=e.geometry;(k.__dirtyVertices||k.__dirtyColors||e.sortParticles)&&c(k,b.DYNAMIC_DRAW,e);k.__dirtyVertices=!1;k.__dirtyColors=!1}}function pa(e){function n(B){var L=[];k=0;for(h=B.length;k<h;k++)B[k]==undefined?L.push("undefined"):L.push(B[k].id);return L.join("_")}var k,h,m,u,r,t,q,A,s={},G=e.morphTargets!==undefined?e.morphTargets.length:0;e.geometryGroups=
+{};m=0;for(u=e.faces.length;m<u;m++){r=e.faces[m];t=r.materials;q=n(t);s[q]==undefined&&(s[q]={hash:q,counter:0});A=s[q].hash+"_"+s[q].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:t,vertices:0,numMorphTargets:G});r=r instanceof THREE.Face3?3:4;if(e.geometryGroups[A].vertices+r>65535){s[q].counter+=1;A=s[q].hash+"_"+s[q].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:t,vertices:0,numMorphTargets:G})}e.geometryGroups[A].faces.push(m);
+e.geometryGroups[A].vertices+=r}}function Y(e,n,k){e.push({buffer:n,object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function qa(e){if(e!=aa){switch(e){case THREE.AdditiveAlphaBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE);break;case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE);break;case THREE.SubtractiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ZERO,b.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:b.blendEquation(b.FUNC_ADD);
+b.blendFunc(b.ZERO,b.SRC_COLOR);break;default:b.blendEquationSeparate(b.FUNC_ADD,b.FUNC_ADD);b.blendFuncSeparate(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA,b.ONE,b.ONE_MINUS_SRC_ALPHA)}aa=e}}function V(e,n,k){if((k.width&k.width-1)==0&&(k.height&k.height-1)==0){b.texParameteri(e,b.TEXTURE_WRAP_S,$(n.wrapS));b.texParameteri(e,b.TEXTURE_WRAP_T,$(n.wrapT));b.texParameteri(e,b.TEXTURE_MAG_FILTER,$(n.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,$(n.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,Da(n.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,Da(n.minFilter))}}function E(e,n){if(e.needsUpdate){if(e.__webglInit){b.bindTexture(b.TEXTURE_2D,e.__webglTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,e.image)}else{e.__webglTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,e.__webglTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,e.image);e.__webglInit=
+!0}V(b.TEXTURE_2D,e,e.image);b.bindTexture(b.TEXTURE_2D,null);e.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_2D,e.__webglTexture)}function Fa(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,$(e.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,$(e.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,$(e.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,$(e.minFilter));b.texImage2D(b.TEXTURE_2D,0,$(e.format),e.width,e.height,0,$(e.format),$(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 n,k;if(e){n=e.__webglFramebuffer;k=e.width;e=e.height}else{n=null;k=ma;e=xa}if(n!=Ba){b.bindFramebuffer(b.FRAMEBUFFER,n);b.viewport(U,ra,k,e);Ba=n}}function ka(e,n){var k;if(e=="fragment")k=b.createShader(b.FRAGMENT_SHADER);else e=="vertex"&&(k=b.createShader(b.VERTEX_SHADER));b.shaderSource(k,n);b.compileShader(k);if(!b.getShaderParameter(k,b.COMPILE_STATUS)){console.error(b.getShaderInfoLog(k));
+console.error(n);return null}return k}function Da(e){switch(e){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return b.NEAREST;default:return b.LINEAR}}function $(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 b,oa=document.createElement("canvas"),ra=null,R=null,O=this,pa=null,Aa=null,Ba=null,sa=null,U=0,ga=0,ha=0,ja=0,P=[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:[],distances:[]}},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=oa;this.autoClear=!0;this.sortObjects=!0;(function(e,p,m){try{if(!(b=oa.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.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.clearColor(p.r,p.g,p.b,m)})(Ea,Wa,Ya);this.context=b;var wa={};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;wa.vertexBuffer=b.createBuffer();wa.elementBuffer=b.createBuffer();
-b.bindBuffer(b.ARRAY_BUFFER,wa.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,new Float32Array(a),b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,wa.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(Ea),b.STATIC_DRAW);wa.program=b.createProgram();b.attachShader(wa.program,S("fragment",THREE.ShaderLib.shadowPost.fragmentShader));b.attachShader(wa.program,S("vertex",THREE.ShaderLib.shadowPost.vertexShader));b.linkProgram(wa.program);wa.vertexLocation=b.getAttribLocation(wa.program,"position");
-wa.projectionLocation=b.getUniformLocation(wa.program,"projectionMatrix");this.setSize=function(e,p){oa.width=e;oa.height=p;this.setViewport(0,0,oa.width,oa.height)};this.setViewport=function(e,p,m,j){U=e;ga=p;ha=m;ja=j;b.viewport(U,ga,ha,ja)};this.setScissor=function(e,p,m,j){b.scissor(e,p,m,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 m=new THREE.Color(e);
-b.clearColor(m.r,m.g,m.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,m,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={map:e.map,envMap:e.envMap,lightMap:e.lightMap,vertexColors:e.vertexColors,fog:m,sizeAttenuation:e.sizeAttenuation,skinning:e.skinning,morphTargets:e.morphTargets,maxDirLights:r.directional,maxPointLights:r.point,maxBones:p};m=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 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
-b.attachShader(p,S("fragment",k+m));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;m=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in e.uniforms)m.push(q);
-q=e.program;r=0;for(p=m.length;r<p;r++){k=m[r];q.uniforms[k]=b.getUniformLocation(q,k)}m=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<this.maxMorphTargets;q++)m.push("morphTarget"+q);for(s in e.attributes)m.push(s);s=e.program;q=m;m=0;for(r=q.length;m<r;m++){p=q[m];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);q=0;for(s=this.maxMorphTargets;q<s;q++)j.__webglMorphTargetInfluences[q]=0}}e.__webglProgram=!0};this.render=function(e,p,m,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);va(m);(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];n(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];n(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);n(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);n(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||O.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=wa.program;b.useProgram(wa.program);b.uniformMatrix4fv(wa.projectionLocation,
-!1,ka);b.bindBuffer(b.ARRAY_BUFFER,wa.vertexBuffer);b.vertexAttribPointer(wa.vertexLocation,3,b.FLOAT,!1,0,0);b.enableVertexAttribArray(wa.vertexLocation);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,wa.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(m&&m.minFilter!==THREE.NearestFilter&&m.minFilter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,m.__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],m=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 W=r.geometry;M=W.faces;var N=v.faces;A=0;for(u=N.length;A<u;A++){G=N[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;N=void 0;var T=void 0,C=void 0;T=void 0;G=[];M=0;for(N=u.materials.length;M<N;M++){T=u.materials[M];if(T instanceof THREE.MeshFaceMaterial){T=0;for(l=A.materials.length;T<l;T++)(C=A.materials[T])&&G.push(C)}else(C=T)&&G.push(C)}u=G;a:{A=void 0;M=void 0;N=u.length;for(A=0;A<N;A++){M=u[A];if(M.map||M.lightMap||M instanceof THREE.MeshShaderMaterial){A=!0;break a}}A=!1}a:{M=void 0;N=void 0;G=u.length;for(M=0;M<G;M++){N=u[M];if(!(N instanceof THREE.MeshBasicMaterial&&
-!N.envMap||N instanceof THREE.MeshDepthMaterial)){M=N&&N.shading!=undefined&&N.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}M=!1}a:{N=void 0;G=void 0;T=u.length;for(N=0;N<T;N++){G=u[N];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(W.hasTangents)v.__tangentArray=new Float32Array(k*4);if(u)v.__colorArray=new Float32Array(k*3);if(A){if(W.faceUvs.length>0||W.faceVertexUvs.length>0)v.__uvArray=
-new Float32Array(k*2);if(W.faceUvs.length>1||W.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){W=void 0;N=void 0;
-v.__morphTargetsArrays=[];W=0;for(N=v.numMorphTargets;W<N;W++)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(m.__webglShadowVolumes,
-s,p):K(m.__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(m.__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(m.__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(m.__webglObjects,q,p)}else THREE.MarchingCubes!==undefined&&p instanceof THREE.MarchingCubes&&m.__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];m=e;q=void 0;j=void 0;for(q=m.__webglObjects.length-1;q>=0;q--){j=m.__webglObjects[q].object;p==j&&m.__webglObjects.splice(q,1)}e.__objectsRemoved.splice(0,1)}p=0;for(m=e.__webglObjects.length;p<
-m;p++)J(e.__webglObjects[p].object,e);p=0;for(m=e.__webglShadowVolumes.length;p<m;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}};
+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 b,Q=document.createElement("canvas"),la=null,Ba=null,Ca=!0,ta=this,W=null,na=null,aa=null,oa=null,U=0,ra=0,ma=0,xa=0,ua=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ca=new THREE.Matrix4,La=new Float32Array(16),Qa=new Float32Array(16),Ra=new THREE.Vector4,
+cb={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Na=!0,ab=!0,Ta=new THREE.Color(0),qb=0;if(a){if(a.stencil!=undefined)Na=a.stencil;if(a.antialias!==undefined)ab=a.antialias;a.clearColor!==undefined&&Ta.setHex(a.clearColor);if(a.clearAlpha!==undefined)qb=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Q;this.autoClear=!0;this.sortObjects=!0;(function(e,n,k,h){try{if(!(b=Q.getContext("experimental-webgl",{antialias:e,stencil:h})))throw"Error creating WebGL context.";
+}catch(m){console.error(m)}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.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);b.clearColor(n.r,n.g,n.b,k)})(ab,Ta,qb,Na);this.context=b;if(Na){var S={};S.vertices=new Float32Array(12);S.faces=new Uint16Array(6);S.darkness=0.5;S.vertices[0]=-2;S.vertices[1]=-1;S.vertices[2]=-1;S.vertices[3]=2;S.vertices[4]=-1;S.vertices[5]=
+-1;S.vertices[6]=2;S.vertices[7]=1;S.vertices[8]=-1;S.vertices[9]=-2;S.vertices[10]=1;S.vertices[11]=-1;S.faces[0]=0;S.faces[1]=1;S.faces[2]=2;S.faces[3]=0;S.faces[4]=2;S.faces[5]=3;S.vertexBuffer=b.createBuffer();S.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,S.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,S.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,S.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,S.faces,b.STATIC_DRAW);S.program=b.createProgram();b.attachShader(S.program,
+ka("fragment",THREE.ShaderLib.shadowPost.fragmentShader));b.attachShader(S.program,ka("vertex",THREE.ShaderLib.shadowPost.vertexShader));b.linkProgram(S.program);S.vertexLocation=b.getAttribLocation(S.program,"position");S.projectionLocation=b.getUniformLocation(S.program,"projectionMatrix");S.darknessLocation=b.getUniformLocation(S.program,"darkness")}var H={};H.vertices=new Float32Array(16);H.faces=new Uint16Array(6);H.transparency=0.5;a=0;H.vertices[a++]=-1;H.vertices[a++]=-1;H.vertices[a++]=0;
+H.vertices[a++]=0;H.vertices[a++]=1;H.vertices[a++]=-1;H.vertices[a++]=1;H.vertices[a++]=0;H.vertices[a++]=1;H.vertices[a++]=1;H.vertices[a++]=1;H.vertices[a++]=1;H.vertices[a++]=-1;H.vertices[a++]=1;H.vertices[a++]=0;H.vertices[a++]=1;a=0;H.faces[a++]=0;H.faces[a++]=1;H.faces[a++]=2;H.faces[a++]=0;H.faces[a++]=2;H.faces[a++]=3;H.vertexBuffer=b.createBuffer();H.elementBuffer=b.createBuffer();H.tempTexture=b.createTexture();H.readBackPixels=new Uint8Array(1024);b.bindBuffer(b.ARRAY_BUFFER,H.vertexBuffer);
+b.bufferData(b.ARRAY_BUFFER,H.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,H.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,H.faces,b.STATIC_DRAW);b.bindTexture(b.TEXTURE_2D,H.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,
+b.NEAREST);H.program=b.createProgram();b.attachShader(H.program,ka("fragment",THREE.ShaderLib.lensFlare.fragmentShader));b.attachShader(H.program,ka("vertex",THREE.ShaderLib.lensFlare.vertexShader));b.linkProgram(H.program);H.attributes={};H.uniforms={};H.attributes.vertex=b.getAttribLocation(H.program,"position");H.attributes.uv=b.getAttribLocation(H.program,"UV");H.uniforms.map=b.getUniformLocation(H.program,"map");H.uniforms.opacity=b.getUniformLocation(H.program,"opacity");H.uniforms.scale=b.getUniformLocation(H.program,
+"scale");H.uniforms.rotation=b.getUniformLocation(H.program,"rotation");H.uniforms.screenPosition=b.getUniformLocation(H.program,"screenPosition");H.uniforms.renderPink=b.getUniformLocation(H.program,"renderPink");this.setSize=function(e,n){Q.width=e;Q.height=n;this.setViewport(0,0,Q.width,Q.height)};this.setViewport=function(e,n,k,h){U=e;ra=n;ma=k;xa=h;b.viewport(U,ra,ma,xa)};this.setScissor=function(e,n,k,h){b.scissor(e,n,k,h)};this.enableScissorTest=function(e){e?b.enable(b.SCISSOR_TEST):b.disable(b.SCISSOR_TEST)};
+this.enableDepthBufferWrite=function(e){Ca=e;b.depthMask(e)};this.setClearColorHex=function(e,n){var k=new THREE.Color(e);b.clearColor(k.r,k.g,k.b,n)};this.setClearColor=function(e,n){b.clearColor(e.r,e.g,e.b,n)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT|b.STENCIL_BUFFER_BIT)};this.setStencilShadowDarkness=function(e){S.darkness=e};this.initMaterial=function(e,n,k,h){var m,u,r,t;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 q,
+A,s;q=s=t=0;for(r=n.length;q<r;q++){A=n[q];A instanceof THREE.DirectionalLight&&s++;A instanceof THREE.PointLight&&t++}if(t+s<=4)n=s;else{n=Math.ceil(4*s/(t+s));t=4-n}t={directional:n,point:t};n=50;if(h!==undefined&&h instanceof THREE.SkinnedMesh)n=h.bones.length;r={map:e.map,envMap:e.envMap,lightMap:e.lightMap,vertexColors:e.vertexColors,fog:k,sizeAttenuation:e.sizeAttenuation,skinning:e.skinning,morphTargets:e.morphTargets,maxDirLights:t.directional,maxPointLights:t.point,maxBones:n};k=e.fragmentShader;
+t=e.vertexShader;n=b.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=[b.getParameter(b.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 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
+b.attachShader(n,ka("fragment",q+k));b.attachShader(n,ka("vertex",r+t));b.linkProgram(n);b.getProgramParameter(n,b.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+b.getProgramParameter(n,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");n.uniforms={};n.attributes={};e.program=n;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(m in e.uniforms)k.push(m);
+m=e.program;t=0;for(n=k.length;t<n;t++){q=k[t];m.uniforms[q]=b.getUniformLocation(m,q)}k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(m=0;m<this.maxMorphTargets;m++)k.push("morphTarget"+m);for(u in e.attributes)k.push(u);u=e.program;m=k;k=0;for(t=m.length;k<t;k++){n=m[k];u.attributes[n]=b.getAttribLocation(u,n)}u=e.program.attributes;b.enableVertexAttribArray(u.position);u.color>=0&&b.enableVertexAttribArray(u.color);u.normal>=0&&b.enableVertexAttribArray(u.normal);
+u.tangent>=0&&b.enableVertexAttribArray(u.tangent);if(e.skinning&&u.skinVertexA>=0&&u.skinVertexB>=0&&u.skinIndex>=0&&u.skinWeight>=0){b.enableVertexAttribArray(u.skinVertexA);b.enableVertexAttribArray(u.skinVertexB);b.enableVertexAttribArray(u.skinIndex);b.enableVertexAttribArray(u.skinWeight)}if(e.morphTargets){e.numSupportedMorphTargets=0;if(u.morphTarget0>=0){b.enableVertexAttribArray(u.morphTarget0);e.numSupportedMorphTargets++}if(u.morphTarget1>=0){b.enableVertexAttribArray(u.morphTarget1);
+e.numSupportedMorphTargets++}if(u.morphTarget2>=0){b.enableVertexAttribArray(u.morphTarget2);e.numSupportedMorphTargets++}if(u.morphTarget3>=0){b.enableVertexAttribArray(u.morphTarget3);e.numSupportedMorphTargets++}if(u.morphTarget4>=0){b.enableVertexAttribArray(u.morphTarget4);e.numSupportedMorphTargets++}if(u.morphTarget5>=0){b.enableVertexAttribArray(u.morphTarget5);e.numSupportedMorphTargets++}if(u.morphTarget6>=0){b.enableVertexAttribArray(u.morphTarget6);e.numSupportedMorphTargets++}if(u.morphTarget7>=
+0){b.enableVertexAttribArray(u.morphTarget7);e.numSupportedMorphTargets++}h.__webglMorphTargetInfluences=new Float32Array(this.maxMorphTargets);m=0;for(u=this.maxMorphTargets;m<u;m++)h.__webglMorphTargetInfluences[m]=0}}e.__webglProgram=!0};this.render=function(e,n,k,h){var m,u,r,t,q,A,s,G,B=e.lights,L=e.fog;n.matrixAutoUpdate&&n.updateMatrix();e.update(undefined,!1,n);n.matrixWorldInverse.flattenToArray(Qa);n.projectionMatrix.flattenToArray(La);ca.multiply(n.projectionMatrix,n.matrixWorldInverse);
+p(ca);this.initWebGLObjects(e);Fa(k);(this.autoClear||h)&&this.clear();q=e.__webglObjects.length;for(h=0;h<q;h++){m=e.__webglObjects[h];s=m.object;if(s.visible)if(!(s instanceof THREE.Mesh)||v(s)){s.matrixWorld.flattenToArray(s._objectMatrixArray);T(s,n);D(m);m.render=!0;if(this.sortObjects){Ra.copy(s.position);ca.multiplyVector3(Ra);m.z=Ra.z}}else m.render=!1;else m.render=!1}this.sortObjects&&e.__webglObjects.sort(z);A=e.__webglObjectsImmediate.length;for(h=0;h<A;h++){m=e.__webglObjectsImmediate[h];
+s=m.object;if(s.visible){s.matrixAutoUpdate&&s.matrixWorld.flattenToArray(s._objectMatrixArray);T(s,n);y(m)}}qa(THREE.NormalBlending);for(h=0;h<q;h++){m=e.__webglObjects[h];if(m.render){s=m.object;G=m.buffer;r=m.opaque;j(s);for(m=0;m<r.count;m++){t=r.list[m];o(t.depthTest);f(n,B,L,t,G,s)}}}for(h=0;h<A;h++){m=e.__webglObjectsImmediate[h];s=m.object;if(s.visible){r=m.opaque;j(s);for(m=0;m<r.count;m++){t=r.list[m];o(t.depthTest);u=g(n,B,L,t,s);s.render(function(I){i(I,u)})}}}for(h=0;h<q;h++){m=e.__webglObjects[h];
+if(m.render){s=m.object;G=m.buffer;r=m.transparent;j(s);for(m=0;m<r.count;m++){t=r.list[m];qa(t.blending);o(t.depthTest);f(n,B,L,t,G,s)}}}for(h=0;h<A;h++){m=e.__webglObjectsImmediate[h];s=m.object;if(s.visible){r=m.transparent;j(s);for(m=0;m<r.count;m++){t=r.list[m];qa(t.blending);o(t.depthTest);u=g(n,B,L,t,s);s.render(function(I){i(I,u)})}}}Na&&e.__webglShadowVolumes.length&&e.lights.length&&K(e);e.__webglLensFlares.length&&M(e,n);if(k&&k.minFilter!==THREE.NearestFilter&&k.minFilter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,
+k.__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=[];e.__webglLensFlares=[]}for(;e.__objectsAdded.length;){var n=e.__objectsAdded[0],k=e,h=void 0,m=void 0,u=void 0;if(n._modelViewMatrix==undefined){n._modelViewMatrix=new THREE.Matrix4;n._normalMatrixArray=new Float32Array(9);n._modelViewMatrixArray=new Float32Array(16);n._objectMatrixArray=
+new Float32Array(16);n.matrixWorld.flattenToArray(n._objectMatrixArray)}if(n instanceof THREE.Mesh){m=n.geometry;m.geometryGroups==undefined&&pa(m);for(h in m.geometryGroups){u=m.geometryGroups[h];if(!u.__webglVertexBuffer){var r=u;r.__webglVertexBuffer=b.createBuffer();r.__webglNormalBuffer=b.createBuffer();r.__webglTangentBuffer=b.createBuffer();r.__webglColorBuffer=b.createBuffer();r.__webglUVBuffer=b.createBuffer();r.__webglUV2Buffer=b.createBuffer();r.__webglSkinVertexABuffer=b.createBuffer();
+r.__webglSkinVertexBBuffer=b.createBuffer();r.__webglSkinIndicesBuffer=b.createBuffer();r.__webglSkinWeightsBuffer=b.createBuffer();r.__webglFaceBuffer=b.createBuffer();r.__webglLineBuffer=b.createBuffer();if(r.numMorphTargets){var t=void 0,q=void 0;r.__webglMorphTargetsBuffers=[];t=0;for(q=r.numMorphTargets;t<q;t++)r.__webglMorphTargetsBuffers.push(b.createBuffer())}r=u;t=n;var A=void 0,s=void 0,G=void 0;G=void 0;var B=q=0,L=0;A=void 0;s=void 0;var I=void 0;s=void 0;var P=t.geometry;I=P.faces;var N=
+r.faces;A=0;for(s=N.length;A<s;A++){G=N[A];G=I[G];if(G instanceof THREE.Face3){q+=3;B+=1;L+=3}else if(G instanceof THREE.Face4){q+=4;B+=2;L+=4}}A=r;s=t;I=void 0;N=void 0;var R=void 0,C=void 0;R=void 0;G=[];I=0;for(N=s.materials.length;I<N;I++){R=s.materials[I];if(R instanceof THREE.MeshFaceMaterial){R=0;for(l=A.materials.length;R<l;R++)(C=A.materials[R])&&G.push(C)}else(C=R)&&G.push(C)}s=G;a:{A=void 0;I=void 0;N=s.length;for(A=0;A<N;A++){I=s[A];if(I.map||I.lightMap||I instanceof THREE.MeshShaderMaterial){A=
+!0;break a}}A=!1}a:{I=void 0;N=void 0;G=s.length;for(I=0;I<G;I++){N=s[I];if(!(N instanceof THREE.MeshBasicMaterial&&!N.envMap||N instanceof THREE.MeshDepthMaterial)){I=N&&N.shading!=undefined&&N.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}I=!1}a:{N=void 0;G=void 0;R=s.length;for(N=0;N<R;N++){G=s[N];if(G.vertexColors){s=G.vertexColors;break a}}s=!1}r.__vertexArray=new Float32Array(q*3);if(I)r.__normalArray=new Float32Array(q*3);if(P.hasTangents)r.__tangentArray=new Float32Array(q*
+4);if(s)r.__colorArray=new Float32Array(q*3);if(A){if(P.faceUvs.length>0||P.faceVertexUvs.length>0)r.__uvArray=new Float32Array(q*2);if(P.faceUvs.length>1||P.faceVertexUvs.length>1)r.__uv2Array=new Float32Array(q*2)}if(t.geometry.skinWeights.length&&t.geometry.skinIndices.length){r.__skinVertexAArray=new Float32Array(q*4);r.__skinVertexBArray=new Float32Array(q*4);r.__skinIndexArray=new Float32Array(q*4);r.__skinWeightArray=new Float32Array(q*4)}r.__faceArray=new Uint16Array(B*3+(t.geometry.edgeFaces?
+t.geometry.edgeFaces.length*6:0));r.__lineArray=new Uint16Array(L*2);if(r.numMorphTargets){P=void 0;N=void 0;r.__morphTargetsArrays=[];P=0;for(N=r.numMorphTargets;P<N;P++)r.__morphTargetsArrays.push(new Float32Array(q*3))}r.__needsSmoothNormals=I==THREE.SmoothShading;r.__uvType=A;r.__vertexColorType=s;r.__normalType=I;r.__webglFaceCount=B*3+(t.geometry.edgeFaces?t.geometry.edgeFaces.length*6:0);r.__webglLineCount=L*2;m.__dirtyVertices=!0;m.__dirtyMorphTargets=!0;m.__dirtyElements=!0;m.__dirtyUvs=
+!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}n instanceof THREE.ShadowVolume?Y(k.__webglShadowVolumes,u,n):Y(k.__webglObjects,u,n)}}else if(n instanceof THREE.LensFlare)Y(k.__webglLensFlares,undefined,n);else if(n instanceof THREE.Ribbon){m=n.geometry;if(!m.__webglVertexBuffer){h=m;h.__webglVertexBuffer=b.createBuffer();h.__webglColorBuffer=b.createBuffer();h=m;u=h.vertices.length;h.__vertexArray=new Float32Array(u*3);h.__colorArray=new Float32Array(u*3);h.__webglVertexCount=u;m.__dirtyVertices=
+!0;m.__dirtyColors=!0}Y(k.__webglObjects,m,n)}else if(n instanceof THREE.Line){m=n.geometry;if(!m.__webglVertexBuffer){h=m;h.__webglVertexBuffer=b.createBuffer();h.__webglColorBuffer=b.createBuffer();h=m;u=h.vertices.length;h.__vertexArray=new Float32Array(u*3);h.__colorArray=new Float32Array(u*3);h.__webglLineCount=u;m.__dirtyVertices=!0;m.__dirtyColors=!0}Y(k.__webglObjects,m,n)}else if(n instanceof THREE.ParticleSystem){m=n.geometry;if(!m.__webglVertexBuffer){h=m;h.__webglVertexBuffer=b.createBuffer();
+h.__webglColorBuffer=b.createBuffer();h=m;u=h.vertices.length;h.__vertexArray=new Float32Array(u*3);h.__colorArray=new Float32Array(u*3);h.__sortArray=[];h.__webglParticleCount=u;m.__dirtyVertices=!0;m.__dirtyColors=!0}Y(k.__webglObjects,m,n)}else THREE.MarchingCubes!==undefined&&n instanceof THREE.MarchingCubes&&k.__webglObjectsImmediate.push({object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}});e.__objectsAdded.splice(0,1)}for(;e.__objectsRemoved.length;){n=e.__objectsRemoved[0];k=
+e;m=void 0;h=void 0;for(m=k.__webglObjects.length-1;m>=0;m--){h=k.__webglObjects[m].object;n==h&&k.__webglObjects.splice(m,1)}e.__objectsRemoved.splice(0,1)}n=0;for(k=e.__webglObjects.length;n<k;n++)O(e.__webglObjects[n].object,e);n=0;for(k=e.__webglShadowVolumes.length;n<k;n++)O(e.__webglShadowVolumes[n].object,e);n=0;for(k=e.__webglLensFlares.length;n<k;n++)O(e.__webglLensFlares[n].object,e)};this.setFaceCulling=function(e,n){if(e){!n||n=="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}};

+ 2 - 1
examples/misc_ubiquity_test.html

@@ -41,6 +41,7 @@
 		<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/lights/LensFlare.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>
@@ -102,7 +103,7 @@
 		<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>
 
 		<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>

BIN
examples/textures/lensflare0.png


BIN
examples/textures/lensflare1.png


+ 186 - 0
examples/webgl_stencilLensFlare.html

@@ -0,0 +1,186 @@
+<!DOCTYPE HTML>
+<html lang="en">
+	<head>
+		<title>three.js - webgl</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, 1000 );
+				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.PointLight( 0xffffff );
+				scene.addChild( light );
+
+
+				light = new THREE.DirectionalLight( 0xffffff );
+				light.position.set( 0, 1, 0 );
+				scene.addChild( light );
+
+
+				var cube = new Sphere( 2 );
+				lightCube = new THREE.Mesh( cube, material2 );
+				lightCube.visible = false;
+				scene.addChild( lightCube );
+
+				var lensFlare = new THREE.LensFlare( ImageUtils.loadTexture( "textures/lensflare0.png" ), 128, 0.0, THREE.AdditiveAlphaBlending );
+				lensFlare.add( ImageUtils.loadTexture( "textures/lensflare1.png" ), 256, 0.33, THREE.AdditiveAlphaBlending );
+				lensFlare.add( lensFlare.lensFlares[ 1 ].texture, 300, 0.66, THREE.AdditiveAlphaBlending );
+				lensFlare.add( lensFlare.lensFlares[ 1 ].texture, 400, 1.0, THREE.AdditiveAlphaBlending );
+				
+				lightCube.addChild( lensFlare );
+
+
+				// renderer
+
+				renderer = new THREE.WebGLRenderer( { antialias: false } );
+				renderer.setClearColorHex( 0x222222, 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 = 0.5;
+				light.position.normalize();
+
+				lightCube.position.copy( light.position );
+				lightCube.position.multiplyScalar( 200 );
+
+
+				t += 0.015;
+
+				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>

+ 91 - 0
src/lights/LensFlare.js

@@ -0,0 +1,91 @@
+/**
+ * @author Mikael Emtinger
+ */
+ 
+THREE.LensFlare = function ( texture, size, distance, blending ) {
+
+	THREE.Object3D.call( this );
+
+	this.positionScreen = new THREE.Vector3();
+	this.lensFlares = [];
+	this.customUpdateCallback = undefined;
+
+	if( texture !== undefined ) {
+		
+		this.add( texture, size, distance, blending );
+		
+	}
+};
+
+THREE.LensFlare.prototype = new THREE.Object3D();
+THREE.LensFlare.prototype.constructor = THREE.LensFlare;
+THREE.LensFlare.prototype.supr = THREE.Object3D.prototype;
+
+
+/*
+ * Add: adds another flare 
+ */
+
+THREE.LensFlare.prototype.add = function( texture, size, distance, blending ) {
+	
+	if( size === undefined ) size = -1;
+	if( distance === undefined ) distance = 0;
+	if( blending === undefined ) blending = THREE.BillboardBlending;
+	
+	distance = Math.min( distance, Math.max( 0, distance ));
+
+	this.lensFlares.push( { texture: texture, 			// THREE.Texture
+		                    size: size, 				// size in pixels (-1 = use texture.width)
+		                    distance: distance, 		// distance (0-1) from light source (0=at light source)
+		                    x: 0, y: 0, z: 0,			// screen position (-1 => 1) z = 0 is ontop z = 1 is back 
+		                    scale: 1, 					// scale
+		                    rotation: 1, 				// rotation
+		                    opacity: 1,					// opacity
+		                    blending: blending } );		// blending
+
+}
+
+
+/*
+ * Update lens flares update positions on all flares based on the screen position
+ * Set myLensFlare.customUpdateCallback to alter the flares in your project specific way.
+ */
+
+THREE.LensFlare.prototype.updateLensFlares = function( visibility ) {
+	
+	var f, fl = this.lensFlares.length;
+	var flare;
+	var vecX = -this.positionScreen.x * 2;
+	var vecY = -this.positionScreen.y * 2; 
+	
+	
+	for( f = 0; f < fl; f++ ) {
+		
+		flare = this.lensFlares[ f ];
+		
+		flare.x = this.positionScreen.x + vecX * flare.distance;
+		flare.y = this.positionScreen.y + vecY * flare.distance;
+
+		flare.wantedScale = ( visibility * 0.2 + 0.8 );
+		flare.wantedRotation = flare.x * Math.PI * 0.25;
+		flare.wantedOpacity = visibility;
+		
+		flare.scale += ( flare.wantedScale - flare.scale ) * 0.25;
+		flare.rotation += ( flare.wantedRotation - flare.rotation ) * 0.25;
+		flare.opacity += ( flare.wantedOpacity - flare.opacity ) * 0.5;
+
+	}
+
+}
+
+
+
+
+
+
+
+
+
+
+
+

+ 2 - 0
src/materials/Material.js

@@ -14,5 +14,7 @@ THREE.NormalBlending = 0;
 THREE.AdditiveBlending = 1;
 THREE.SubtractiveBlending = 2;
 THREE.MultiplyBlending = 3;
+THREE.AdditiveAlphaBlending = 4;
+
 
 THREE.MaterialCounter = { value: 0 };

+ 454 - 116
src/renderers/WebGLRenderer.js

@@ -24,6 +24,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 	_canvas = document.createElement( 'canvas' ),
 	_currentProgram = null,
 	_currentFramebuffer = null,
+	_currentDepthMask = true,
 
 	_this = this,
 
@@ -69,12 +70,14 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	// parameters defaults
 
+	stencil = true,
 	antialias = true,
 	clearColor = new THREE.Color( 0x000000 ),
 	clearAlpha = 0;
 
 	if ( parameters ) {
 
+		if ( parameters.stencil != undefined ) stencil = parameters.stencil;
 		if ( parameters.antialias !== undefined ) antialias = parameters.antialias;
 		if ( parameters.clearColor !== undefined ) clearColor.setHex( parameters.clearColor );
 		if ( parameters.clearAlpha !== undefined ) clearAlpha = parameters.clearAlpha;
@@ -86,45 +89,114 @@ THREE.WebGLRenderer = function ( parameters ) {
 	this.autoClear = true;
 	this.sortObjects = true;
 
-	initGL( antialias, clearColor, clearAlpha );
+	initGL( antialias, clearColor, clearAlpha, stencil );
 
 	this.context = _gl;
 
 
-	// create shadow polygons
+	// prepare stencil shadow polygon
 
-	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;
+	if( stencil ) {
+		
+		var _stencilShadow      = {};
+		
+		_stencilShadow.vertices = new Float32Array( 12 );
+		_stencilShadow.faces    = new Uint16Array( 6 );
+		_stencilShadow.darkness = 0.5;
+		
+		_stencilShadow.vertices[ 0 * 3 + 0 ] = -2; _stencilShadow.vertices[ 0 * 3 + 1 ] = -1; _stencilShadow.vertices[ 0 * 3 + 2 ] = -1;
+		_stencilShadow.vertices[ 1 * 3 + 0 ] =  2; _stencilShadow.vertices[ 1 * 3 + 1 ] = -1; _stencilShadow.vertices[ 1 * 3 + 2 ] = -1;
+		_stencilShadow.vertices[ 2 * 3 + 0 ] =  2; _stencilShadow.vertices[ 2 * 3 + 1 ] =  1; _stencilShadow.vertices[ 2 * 3 + 2 ] = -1;
+		_stencilShadow.vertices[ 3 * 3 + 0 ] = -2; _stencilShadow.vertices[ 3 * 3 + 1 ] =  1; _stencilShadow.vertices[ 3 * 3 + 2 ] = -1;
+		
+		_stencilShadow.faces[ 0 ] = 0; _stencilShadow.faces[ 1 ] = 1; _stencilShadow.faces[ 2 ] = 2;
+		_stencilShadow.faces[ 3 ] = 0; _stencilShadow.faces[ 4 ] = 2; _stencilShadow.faces[ 5 ] = 3;
+	
+	
+		_stencilShadow.vertexBuffer  = _gl.createBuffer();
+		_stencilShadow.elementBuffer = _gl.createBuffer();
+		
+		_gl.bindBuffer( _gl.ARRAY_BUFFER, _stencilShadow.vertexBuffer );
+		_gl.bufferData( _gl.ARRAY_BUFFER,  _stencilShadow.vertices, _gl.STATIC_DRAW );
+	
+		_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _stencilShadow.elementBuffer );
+		_gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, _stencilShadow.faces, _gl.STATIC_DRAW );
+		
+	
+		_stencilShadow.program = _gl.createProgram();
+	
+		_gl.attachShader( _stencilShadow.program, getShader( "fragment", THREE.ShaderLib.shadowPost.fragmentShader ));
+		_gl.attachShader( _stencilShadow.program, getShader( "vertex",   THREE.ShaderLib.shadowPost.vertexShader   ));
+	
+		_gl.linkProgram( _stencilShadow.program );
+	
+		_stencilShadow.vertexLocation     = _gl.getAttribLocation ( _stencilShadow.program, "position"         );
+		_stencilShadow.projectionLocation = _gl.getUniformLocation( _stencilShadow.program, "projectionMatrix" );
+		_stencilShadow.darknessLocation   = _gl.getUniformLocation( _stencilShadow.program, "darkness"         );
+	}
+	
+	
+	// prepare lens flare
+	
+	var _lensFlare = {};
+	var i;
+	
+	_lensFlare.vertices     = new Float32Array( 8 + 8 );
+	_lensFlare.faces        = new Uint16Array( 6 );
+	_lensFlare.transparency = 0.5;
+	
+	i = 0;
+	_lensFlare.vertices[ i++ ] = -1; _lensFlare.vertices[ i++ ] = -1;	// vertex
+	_lensFlare.vertices[ i++ ] = 0;  _lensFlare.vertices[ i++ ] = 0;	// uv... etc.
+	_lensFlare.vertices[ i++ ] = 1;  _lensFlare.vertices[ i++ ] = -1;
+	_lensFlare.vertices[ i++ ] = 1;  _lensFlare.vertices[ i++ ] = 0;
+	_lensFlare.vertices[ i++ ] = 1;  _lensFlare.vertices[ i++ ] = 1;
+	_lensFlare.vertices[ i++ ] = 1;  _lensFlare.vertices[ i++ ] = 1;
+	_lensFlare.vertices[ i++ ] = -1; _lensFlare.vertices[ i++ ] = 1;
+	_lensFlare.vertices[ i++ ] = 0;  _lensFlare.vertices[ i++ ] = 1;
+
+	i = 0;
+	_lensFlare.faces[ i++ ] = 0; _lensFlare.faces[ i++ ] = 1; _lensFlare.faces[ i++ ] = 2;
+	_lensFlare.faces[ i++ ] = 0; _lensFlare.faces[ i++ ] = 2; _lensFlare.faces[ i++ ] = 3;
+
+	_lensFlare.vertexBuffer  = _gl.createBuffer();
+	_lensFlare.elementBuffer = _gl.createBuffer();
+	_lensFlare.tempTexture   = _gl.createTexture();
+	_lensFlare.readBackPixels = new Uint8Array( 16*16*4 );
+	
+	_gl.bindBuffer( _gl.ARRAY_BUFFER, _lensFlare.vertexBuffer );
+	_gl.bufferData( _gl.ARRAY_BUFFER,  _lensFlare.vertices, _gl.STATIC_DRAW );
 
+	_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _lensFlare.elementBuffer );
+	_gl.bufferData( _gl.ELEMENT_ARRAY_BUFFER, _lensFlare.faces, _gl.STATIC_DRAW );
 
-	_shadow.vertexBuffer  = _gl.createBuffer();
-	_shadow.elementBuffer = _gl.createBuffer();
+	_gl.bindTexture( _gl.TEXTURE_2D, _lensFlare.tempTexture );
+	_gl.texImage2D( _gl.TEXTURE_2D, 0, _gl.RGB, 16, 16, 0, _gl.RGB, _gl.UNSIGNED_BYTE, null );
+	_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );
+	_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
+	_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MAG_FILTER, _gl.NEAREST );
+	_gl.texParameteri( _gl.TEXTURE_2D, _gl.TEXTURE_MIN_FILTER, _gl.NEAREST );
 
-	_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 );
+	_lensFlare.program = _gl.createProgram();
 
+	_gl.attachShader( _lensFlare.program, getShader( "fragment", THREE.ShaderLib.lensFlare.fragmentShader ));
+	_gl.attachShader( _lensFlare.program, getShader( "vertex",   THREE.ShaderLib.lensFlare.vertexShader   ));
 
-	_shadow.program = _gl.createProgram();
+	_gl.linkProgram( _lensFlare.program );
 
-	_gl.attachShader( _shadow.program, getShader( "fragment", THREE.ShaderLib.shadowPost.fragmentShader ));
-	_gl.attachShader( _shadow.program, getShader( "vertex",   THREE.ShaderLib.shadowPost.vertexShader   ));
+	_lensFlare.attributes = {};
+	_lensFlare.uniforms = {};
+	_lensFlare.attributes.vertex       = _gl.getAttribLocation ( _lensFlare.program, "position" );
+	_lensFlare.attributes.uv           = _gl.getAttribLocation ( _lensFlare.program, "UV" );
+	_lensFlare.uniforms.map            = _gl.getUniformLocation( _lensFlare.program, "map" );
+	_lensFlare.uniforms.opacity        = _gl.getUniformLocation( _lensFlare.program, "opacity" );
+	_lensFlare.uniforms.scale          = _gl.getUniformLocation( _lensFlare.program, "scale" );
+	_lensFlare.uniforms.rotation       = _gl.getUniformLocation( _lensFlare.program, "rotation" );
+	_lensFlare.uniforms.screenPosition = _gl.getUniformLocation( _lensFlare.program, "screenPosition" );
+	_lensFlare.uniforms.renderPink     = _gl.getUniformLocation( _lensFlare.program, "renderPink" );
 
-	_gl.linkProgram( _shadow.program );
 
-	_shadow.vertexLocation     = _gl.getAttribLocation ( _shadow.program, "position"         );
-	_shadow.projectionLocation = _gl.getUniformLocation( _shadow.program, "projectionMatrix" );
 
 
 	this.setSize = function ( width, height ) {
@@ -165,6 +237,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	this.enableDepthBufferWrite = function ( enable ) {
 
+		_currentDepthMask = enable;
 		_gl.depthMask( enable );
 
 	};
@@ -188,6 +261,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
+	this.setStencilShadowDarkness = function( value ) {
+		
+		_stencilShadow.darkness = value;
+	};
+
 
 	function setupLights ( program, lights ) {
 
@@ -2582,150 +2660,393 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 		}
 
+		// render stencil shadows
 
+		if( stencil && scene.__webglShadowVolumes.length && scene.lights.length ) {
 
-		//////////////////////// 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
-		//
+			renderStencilShadows( scene );
+		
+		}
+
+		// render lens flares
+		
+		if( scene.__webglLensFlares.length ) {
+			
+			renderLensFlares( scene, camera );
+		
+		}
+
+
+		// Generate mipmap if we're using any kind of mipmap filtering
+
+		if ( renderTarget && renderTarget.minFilter !== THREE.NearestFilter && renderTarget.minFilter !== THREE.LinearFilter ) {
+
+			updateRenderTargetMipmap( renderTarget );
 
-		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 );
+	/*
+	 * Stencil Shadows
+	 * 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
+	 * 
+	 */
 
+	function renderStencilShadows( scene ) {
+			
+		// setup stencil
 
-			// loop through all directional lights
+		_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 );
 
-			var l, ll = scene.lights.length,
-			p, light, geometryGroup, dirLight = [],
-			program, p_uniforms, m_uniforms,
-			attributes;
+		
+		// loop through all directional lights
+		
+		var l, ll = scene.lights.length;
+		var p;
+		var light, lights = scene.lights;
+		var dirLight = [];			
+		var object, geometryGroup, material;
+		var	program;
+		var p_uniforms;
+	    var m_uniforms;
+	    var attributes;
+		var o, ol = scene.__webglShadowVolumes.length;
+		
+		for( l = 0; l < ll; l++ ) {
+			
+			light = scene.lights[ l ];
+			
+			if( light instanceof THREE.DirectionalLight ) {
 
-			ol = scene.__webglShadowVolumes.length;
+				dirLight[ 0 ] = -light.position.x;
+				dirLight[ 1 ] = -light.position.y;
+				dirLight[ 2 ] = -light.position.z;
 
-			for ( l = 0; l < ll; l++ ) {
+				
+				// render all volumes
+				
+				for( o = 0; o < ol; o++ ) {
+		
+					object        = scene.__webglShadowVolumes[ o ].object;
+					geometryGroup = scene.__webglShadowVolumes[ o ].buffer;
+					material      = object.materials[ 0 ];
 
-				light = scene.lights[ l ];
+					if ( !material.program ) _this.initMaterial( material, lights, undefined, object );
 
-				if ( light instanceof THREE.DirectionalLight ) {
+					program = material.program,
+		  			p_uniforms = program.uniforms,
+	                m_uniforms = material.uniforms,
+	                attributes = program.attributes;
 
-					dirLight[ 0 ] = -light.position.x;
-					dirLight[ 1 ] = -light.position.y;
-					dirLight[ 2 ] = -light.position.z;
 
-					// render all volumes
+					if( _currentProgram !== program ) {
+						
+						_gl.useProgram( program );
+						_currentProgram = program;
 
-					for ( o = 0; o < ol; o++ ) {
+						_gl.uniformMatrix4fv( p_uniforms.projectionMatrix, false, _projectionMatrixArray );
+						_gl.uniformMatrix4fv( p_uniforms.viewMatrix, false, _viewMatrixArray );
+						_gl.uniform3fv( p_uniforms.directionalLightDirection, dirLight );
+					}
 
-						object        = scene.__webglShadowVolumes[ o ].object;
-						geometryGroup = scene.__webglShadowVolumes[ o ].buffer;
-						material      = object.materials[ 0 ];
 
+					object.matrixWorld.flattenToArray( object._objectMatrixArray );
+					_gl.uniformMatrix4fv( p_uniforms.objectMatrix, false, object._objectMatrixArray );
 
-						if ( !material.program ) _this.initMaterial( material, lights, fog, object );
 
-						program = material.program,
-			  			p_uniforms = program.uniforms,
-						m_uniforms = material.uniforms,
-						attributes = program.attributes;
+					_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 );
 
-						if ( _currentProgram !== program ) {
+					_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglFaceBuffer );
 
-							_gl.useProgram( program );
-							_currentProgram = program;
+					_gl.cullFace( _gl.FRONT );
+					_gl.drawElements( _gl.TRIANGLES, geometryGroup.__webglFaceCount, _gl.UNSIGNED_SHORT, 0 );
 
-							_gl.uniformMatrix4fv( p_uniforms.projectionMatrix, false, _projectionMatrixArray );
-							_gl.uniformMatrix4fv( p_uniforms.viewMatrix, false, _viewMatrixArray );
-							_gl.uniform3fv( p_uniforms.directionalLightDirection, dirLight );
-						}
+					_gl.cullFace( _gl.BACK );
+					_gl.drawElements( _gl.TRIANGLES, geometryGroup.__webglFaceCount, _gl.UNSIGNED_SHORT, 0 );
+			
+				}
 
+			}
 
-						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 );
+		// setup color+stencil
 
-						_gl.bindBuffer( _gl.ARRAY_BUFFER, geometryGroup.__webglNormalBuffer );
-						_gl.vertexAttribPointer( attributes.normal, 3, _gl.FLOAT, false, 0, 0 );
+		_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.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, geometryGroup.__webglFaceBuffer );
 
-						_gl.cullFace( _gl.FRONT );
-						_gl.drawElements( _gl.TRIANGLES, geometryGroup.__webglFaceCount, _gl.UNSIGNED_SHORT, 0 );
+		// draw darkening polygon	
 
-						_gl.cullFace( _gl.BACK );
-						_gl.drawElements( _gl.TRIANGLES, geometryGroup.__webglFaceCount, _gl.UNSIGNED_SHORT, 0 );
+		_oldBlending = "";
+		_currentProgram = _stencilShadow.program;
 
-					}
+		_gl.useProgram( _stencilShadow.program );
+		_gl.uniformMatrix4fv( _stencilShadow.projectionLocation, false, _projectionMatrixArray );
+		_gl.uniform1f( _stencilShadow.darknessLocation, _stencilShadow.darkness );
+		
+		_gl.bindBuffer( _gl.ARRAY_BUFFER, _stencilShadow.vertexBuffer );
+		_gl.vertexAttribPointer( _stencilShadow.vertexLocation, 3, _gl.FLOAT, false, 0, 0 );
+		_gl.enableVertexAttribArray( _stencilShadow.vertexLocation );
 
-				}
+		_gl.blendFunc( _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA );
+		_gl.blendEquation( _gl.FUNC_ADD );
+			
+		_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _stencilShadow.elementBuffer );
+		_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );
 
-			}
 
-			// draw darkening polygon
+		// disable stencil
 
-			_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.disable	 ( _gl.STENCIL_TEST );
+	    _gl.enable	 ( _gl.DEPTH_TEST );
+	    _gl.depthMask( _currentDepthMask );
+	}
 
-			_gl.enable( _gl.BLEND );
-			_gl.blendFunc( _gl.ONE, _gl.ONE_MINUS_SRC_ALPHA );
-			_gl.blendEquation( _gl.FUNC_ADD );
+	/*
+	 * Render lens flares
+	 * Method: renders 16x16 0xff00ff-colored points scattered over the light source area, 
+	 *         reads these back and calculates occlusion.  
+	 *         Then LensFlare.updateLensFlares() is called to re-position and 
+	 *         update transparency of flares. Then they are rendered.
+	 * 
+	 */
 
-			_oldBlending = "";
-			_currentProgram = _shadow.program;
+	function renderLensFlares( scene, camera ) {
+		
+		var object, objectZ, geometryGroup, material;
+		var o, ol = scene.__webglLensFlares.length;
+		var f, fl, flare;
+		var tempPosition = new THREE.Vector3();
+		var invAspect = _viewportHeight / _viewportWidth;
+		var halfViewportWidth = _viewportWidth * 0.5;
+		var halfViewportHeight = _viewportHeight * 0.5;
+		var size = 16 / _viewportHeight;
+		var scale = [ size * invAspect, size ];
+		var screenPosition = [ 1, 1, 0 ];
+		var screenPositionPixels = [ 1, 1 ];
+		var sampleX, sampleY, readBackPixels = _lensFlare.readBackPixels;
+		var sampleMidX = 7 * 4;
+		var sampleMidY = 7 * 16 * 4;
+		var sampleIndex, visibility;
+		var uniforms = _lensFlare.uniforms;
+		var attributes = _lensFlare.attributes;
+
+
+		// set lensflare program and reset blending
+
+		_gl.useProgram( _lensFlare.program );
+		_currentProgram = _lensFlare.program;
+		_oldBlending = "";
+
+
+		// loop through all lens flares to update their occlusion and positions
+		// setup gl and common used attribs/unforms
+
+		_gl.uniform1i( uniforms.map, 0 );
+		_gl.activeTexture( _gl.TEXTURE0 );
+		
+		_gl.uniform1f( uniforms.opacity, 1 );
+		_gl.uniform1f( uniforms.rotation, 0 );
+		_gl.uniform2fv( uniforms.scale, scale );
 
-			_gl.useProgram( _shadow.program );
-			_gl.uniformMatrix4fv( _shadow.projectionLocation, false, _projectionMatrixArray );
+		_gl.bindBuffer( _gl.ARRAY_BUFFER, _lensFlare.vertexBuffer );
+		_gl.vertexAttribPointer( attributes.vertex, 2, _gl.FLOAT, false, 2 * 8, 0 );
+		_gl.vertexAttribPointer( attributes.uv, 2, _gl.FLOAT, false, 2 * 8, 8 );
 
-			_gl.bindBuffer( _gl.ARRAY_BUFFER, _shadow.vertexBuffer );
-			_gl.vertexAttribPointer( _shadow.vertexLocation, 3, _gl.FLOAT, false, 0, 0 );
-			_gl.enableVertexAttribArray( _shadow.vertexLocation );
+		_gl.bindTexture( _gl.TEXTURE_2D, _lensFlare.tempTexture );
 
-			_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _shadow.elementBuffer );
-			_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );
+		_gl.bindBuffer( _gl.ELEMENT_ARRAY_BUFFER, _lensFlare.elementBuffer );
+
+		_gl.disable( _gl.CULL_FACE );
+		_gl.depthMask( false );
+
+
+		for( o = 0; o < ol; o++ ) {
+			
+			// calc object screen position
+			
+			object = scene.__webglLensFlares[ o ].object;
+			
+			tempPosition.set( object.matrixWorld.n14, object.matrixWorld.n24, object.matrixWorld.n34 );
+			
+			camera.matrixWorldInverse.multiplyVector3( tempPosition );
+			objectZ = tempPosition.z;
+			camera.projectionMatrix.multiplyVector3( tempPosition );
+			
+			
+			// setup arrays for gl programs
+			
+			screenPosition[ 0 ] = tempPosition.x;
+			screenPosition[ 1 ] = tempPosition.y;
+			screenPosition[ 2 ] = tempPosition.z;
+			
+			screenPositionPixels[ 0 ] = screenPosition[ 0 ] * halfViewportWidth + halfViewportWidth;
+			screenPositionPixels[ 1 ] = screenPosition[ 1 ] * halfViewportHeight + halfViewportHeight;
+	
+
+			// save current RGB to temp texture
+			
+			_gl.copyTexSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, screenPositionPixels[ 0 ] - 8, screenPositionPixels[ 1 ] - 8, 16, 16 );
+
+	
+			// render pink quad
 
-			// disable stencil
+			_gl.uniform3fv( uniforms.screenPosition, screenPosition );
+			_gl.uniform1i( uniforms.renderPink, 1 );
 
-			_gl.disable( _gl.STENCIL_TEST );
 			_gl.enable( _gl.DEPTH_TEST );
-			_gl.disable( _gl.BLEND );
-			_gl.depthMask( true );
 
-		}
+			_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );
 
 
-		//////////////////////// stencil shadows end //////////////////////
+			// read back
 
+			try {
+				
+				_gl.readPixels( screenPositionPixels[ 0 ] - 8, screenPositionPixels[ 1 ] - 8, 16, 16, _gl.RGBA, _gl.UNSIGNED_BYTE, _lensFlare.readBackPixels );
+				
+			}
+			catch( error ) {
+				
+				console.log( "WebGLRenderer.renderLensFlare: readPixels failed!" );
+			}
 
-		// Generate mipmap if we're using any kind of mipmap filtering
+			if( _gl.getError()) {
+				
+				console.log( "WebGLRenderer.renderLensFlare: readPixels failed!" );
+			}
 
-		if ( renderTarget && renderTarget.minFilter !== THREE.NearestFilter && renderTarget.minFilter !== THREE.LinearFilter ) {
 
-			updateRenderTargetMipmap( renderTarget );
+			// sample read back pixels
+
+			sampleDistance = parseInt( 5 * ( 1 - Math.max( 0, Math.min( -objectZ, camera.far )) / camera.far ), 10 ) + 2;
+			sampleX = sampleDistance * 4;
+			sampleY = sampleDistance * 4 * 16;
+
+			visibility = 0;
+
+			sampleIndex = ( sampleMidX - sampleX ) + ( sampleMidY - sampleY );	// upper left
+			if( _lensFlare.readBackPixels[ sampleIndex + 0 ] === 255 && 
+				_lensFlare.readBackPixels[ sampleIndex + 1 ] === 0 &&
+				_lensFlare.readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;			
+
+			sampleIndex = ( sampleMidX + sampleX ) + ( sampleMidY - sampleY );	// upper right
+			if( readBackPixels[ sampleIndex + 0 ] === 255 && 
+				readBackPixels[ sampleIndex + 1 ] === 0 &&
+				readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;			
+
+			sampleIndex = ( sampleMidX + sampleX ) + ( sampleMidY + sampleY );	// lower right
+			if( readBackPixels[ sampleIndex + 0 ] === 255 && 
+				readBackPixels[ sampleIndex + 1 ] === 0 &&
+				readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;			
+
+			sampleIndex = ( sampleMidX - sampleX ) + ( sampleMidY + sampleY );	// lower left
+			if( readBackPixels[ sampleIndex + 0 ] === 255 && 
+				readBackPixels[ sampleIndex + 1 ] === 0 &&
+				readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;			
+
+			sampleIndex = sampleMidX + sampleMidY;								// center
+			if( readBackPixels[ sampleIndex + 0 ] === 255 && 
+				readBackPixels[ sampleIndex + 1 ] === 0 &&
+				readBackPixels[ sampleIndex + 2 ] === 255 ) visibility += 0.2;			
+
+
+			object.positionScreen.x = screenPosition[ 0 ];
+			object.positionScreen.y = screenPosition[ 1 ];
+			object.positionScreen.z = screenPosition[ 2 ];
+
+			if( object.customUpdateCallback ) {
+				
+				object.customUpdateCallback( visibility, object );
+				
+			} else {
+				
+				object.updateLensFlares( visibility );
+				
+			}
+
+
+			// restore graphics
+		
+			_gl.uniform1i( uniforms.renderPink, 0 );
+			_gl.disable( _gl.DEPTH_TEST );
+			_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );
+		}
+		
+		
+		// loop through all lens flares and draw their flares
+		// setup gl
+		
+		for( o = 0; o < ol; o++ ) {
+		
+			object = scene.__webglLensFlares[ o ].object;
+
+			for( f = 0, fl = object.lensFlares.length; f < fl; f++ ) {
+				
+				flare = object.lensFlares[ f ];
+				
+				if( flare.opacity > 0.001 && flare.scale > 0.001 ) {
+
+					screenPosition[ 0 ] = flare.x;
+					screenPosition[ 1 ] = flare.y;
+					screenPosition[ 2 ] = flare.z;
+	
+					size = flare.size * flare.scale / _viewportHeight;
+					scale[ 0 ] = size * invAspect;
+					scale[ 1 ] = size;
+						
+	
+					_gl.uniform3fv( uniforms.screenPosition, screenPosition );
+					_gl.uniform1f( uniforms.rotation, flare.rotation );
+					_gl.uniform2fv( uniforms.scale, scale );
+					_gl.uniform1f( uniforms.opacity, flare.opacity );
+	
+					setBlending( flare.blending );
+					setTexture( flare.texture, 0 );
+	
+					// todo: only draw if loaded
+			
+					_gl.drawElements( _gl.TRIANGLES, 6, _gl.UNSIGNED_SHORT, 0 );
+				}
+				
+			}
 
 		}
 
-	};
+
+		// restore gl
+	
+		_gl.enable( _gl.CULL_FACE );
+		_gl.enable( _gl.DEPTH_TEST );
+		_gl.depthMask( _currentDepthMask );
+	}
+
+
 
 	function setupMatrices ( object, camera ) {
 
@@ -2741,6 +3062,7 @@ THREE.WebGLRenderer = function ( parameters ) {
 			scene.__webglObjects = [];
 			scene.__webglObjectsImmediate = [];
 			scene.__webglShadowVolumes = [];
+			scene.__webglLensFlares = [];
 		}
 
 		while ( scene.__objectsAdded.length ) {
@@ -2770,7 +3092,12 @@ THREE.WebGLRenderer = function ( parameters ) {
 			updateObject( scene.__webglShadowVolumes[ o ].object, scene );
 
 		}
+		
+		for ( var o = 0, ol = scene.__webglLensFlares.length; o < ol; o ++ ) {
 
+			updateObject( scene.__webglLensFlares[ o ].object, scene );
+
+		}
 
 	};
 
@@ -2837,6 +3164,10 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			}
 
+		} else if ( object instanceof THREE.LensFlare ) {
+			
+			addBuffer( scene.__webglLensFlares, undefined, object );
+			
 		} else if ( object instanceof THREE.Ribbon ) {
 
 			geometry = object.geometry;
@@ -3139,11 +3470,11 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 	};
 
-	function initGL ( antialias, clearColor, clearAlpha ) {
+	function initGL ( antialias, clearColor, clearAlpha, stencil ) {
 
 		try {
 
-			if ( ! ( _gl = _canvas.getContext( 'experimental-webgl', { antialias: antialias, stencil:true } ) ) ) {
+			if ( ! ( _gl = _canvas.getContext( 'experimental-webgl', { antialias: antialias, stencil: stencil } ) ) ) {
 
 				throw 'Error creating WebGL context.';
 
@@ -3373,6 +3704,13 @@ THREE.WebGLRenderer = function ( parameters ) {
 
 			switch ( blending ) {
 
+				case THREE.AdditiveAlphaBlending:
+				
+					_gl.blendEquation( _gl.FUNC_ADD );
+					_gl.blendFunc( _gl.SRC_ALPHA, _gl.ONE );
+				
+					break;
+
 				case THREE.AdditiveBlending:
 
 					_gl.blendEquation( _gl.FUNC_ADD );

+ 53 - 1
src/renderers/WebGLShaders.js

@@ -569,6 +569,56 @@ THREE.UniformsLib = {
 
 THREE.ShaderLib = {
 
+	'lensFlare': {
+		
+		vertexShader: [
+
+			"uniform 	vec3 	screenPosition;",
+			"uniform	vec2	scale;",
+			"uniform	float	rotation;",
+			"attribute 	vec2 	position;",
+			"attribute  vec2	UV;",
+			"varying	vec2	vUV;",
+	
+			"void main(void)",
+			"{",
+				"vUV = UV;",
+
+				"vec2 pos;",
+				"pos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;",
+				"pos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;",
+				"gl_Position = vec4(( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );",
+			"}"
+
+		].join( "\n" ),
+		
+		fragmentShader: [
+		
+			"#ifdef GL_ES",
+				"precision highp float;",
+			"#endif",		
+
+			"uniform	sampler2D	map;",
+			"uniform	float		opacity;",
+			
+			"uniform    int         renderPink;",
+			"varying	vec2		vUV;",
+	
+			"void main( void )",
+			"{",
+				"if( renderPink == 1 ) {",
+					"gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );",
+				"} else {",
+					"vec4 color = texture2D( map, vUV );",
+					"color.a *= opacity;",
+					"gl_FragColor = color;",
+				"}",
+			"}"
+		].join( "\n" )
+
+	},
+
+
 	'shadowPost': {
 
 		vertexShader: [
@@ -589,9 +639,11 @@ THREE.ShaderLib = {
 				"precision highp float;",
 			"#endif",		
 
+			"uniform 	float 	darkness;",
+
 			"void main( void )",
 			"{",
-				"gl_FragColor = vec4( 0, 0, 0, 0.5 );",
+				"gl_FragColor = vec4( 0, 0, 0, darkness );",
 			"}"
 
 		].join( "\n" )

+ 1 - 0
utils/build.py

@@ -36,6 +36,7 @@ COMMON_FILES = [
 'lights/AmbientLight.js',
 'lights/DirectionalLight.js',
 'lights/PointLight.js',
+'lights/LensFlare.js',
 'materials/Material.js',
 'materials/Mappings.js',
 'materials/LineBasicMaterial.js',