Fixed broken examples.

Updated build script.
This commit is contained in:
Mr.doob
2011-03-24 21:04:34 +00:00
parent 0ccf06f593
commit bd2d39ac6b
7 changed files with 515 additions and 572 deletions
+287 -286
View File
@@ -1,88 +1,88 @@
// Three.js r37 - http://github.com/mrdoob/three.js
var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,c,b){this.r=a;this.g=c;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,b){var d,f,g,h,k,m;if(b==0)d=f=g=0;else{h=Math.floor(a*6);k=a*6-h;a=b*(1-c);m=b*(1-c*k);c=b*(1-c*(1-k));switch(h){case 1: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,k,m;if(b==0)e=f=g=0;else{h=Math.floor(a*6);k=a*6-h;a=b*(1-c);m=b*(1-c*k);c=b*(1-c*(1-k));switch(h){case 1:e=m;f=b;g=a;break;case 2:e=a;f=b;g=c;break;case 3:e=a;f=m;g=b;break;case 4:e=c;f=a;g=b;break;case 5:e=b;f=a;
g=m;break;case 6:case 0:e=b;f=c;g=a}}this.r=e;this.g=f;this.b=g;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,c){this.set(a||0,c||0)};
THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,c,b){this.set(a||0,c||0,b||0)};
THREE.Vector3.prototype={set:function(a,c,b){this.x=a;this.y=c;this.z=b;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,b=this.y,d=this.z;this.set(b*a.z-d*a.y,d*a.x-c*a.z,c*a.y-b*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,b=this.y,e=this.z;this.set(b*a.z-e*a.y,e*a.x-c*a.z,c*a.y-b*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,b=this.y-a.y;a=this.z-a.z;return c*c+b*b+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-a.n23/c,a.n33/c);this.z=Math.atan2(-a.n13/c,a.n11/c)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,d){this.set(a||0,c||0,b||0,d||1)};
THREE.Vector4.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,b,e){this.set(a||0,c||0,b||0,e||1)};
THREE.Vector4.prototype={set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
THREE.Ray.prototype={intersectScene:function(a){var c,b,d=a.objects,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,h){return g.distance-h.distance});return f},intersectObject:function(a){function c(I,C,J,B){B=B.clone().subSelf(C);J=J.clone().subSelf(C);var U=I.clone().subSelf(C);I=B.dot(B);C=B.dot(J);B=B.dot(U);var P=J.dot(J);J=J.dot(U);U=1/(I*P-C*C);P=(P*B-C*J)*U;I=(I*J-C*B)*U;return P>0&&I>0&&P+I<1}var b,d,f,g,h,k,m,n,q,x,
z,p=a.geometry,A=p.vertices,G=[];b=0;for(d=p.faces.length;b<d;b++){f=p.faces[b];x=this.origin.clone();z=this.direction.clone();m=a.matrixWorld;g=m.multiplyVector3(A[f.a].position.clone());h=m.multiplyVector3(A[f.b].position.clone());k=m.multiplyVector3(A[f.c].position.clone());m=f instanceof THREE.Face4?m.multiplyVector3(A[f.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(f.normal.clone());q=z.dot(n);if(q<0){n=n.dot((new THREE.Vector3).sub(g,x))/q;x=x.addSelf(z.multiplyScalar(n));
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(J,D,K,C){C=C.clone().subSelf(D);K=K.clone().subSelf(D);var U=J.clone().subSelf(D);J=C.dot(C);D=C.dot(K);C=C.dot(U);var P=K.dot(K);K=K.dot(U);U=1/(J*P-D*D);P=(P*C-D*K)*U;J=(J*K-D*C)*U;return P>0&&J>0&&P+J<1}var b,e,f,g,h,k,m,n,p,x,
y,o=a.geometry,A=o.vertices,G=[];b=0;for(e=o.faces.length;b<e;b++){f=o.faces[b];x=this.origin.clone();y=this.direction.clone();m=a.matrixWorld;g=m.multiplyVector3(A[f.a].position.clone());h=m.multiplyVector3(A[f.b].position.clone());k=m.multiplyVector3(A[f.c].position.clone());m=f instanceof THREE.Face4?m.multiplyVector3(A[f.d].position.clone()):null;n=a.matrixRotationWorld.multiplyVector3(f.normal.clone());p=y.dot(n);if(p<0){n=n.dot((new THREE.Vector3).sub(g,x))/p;x=x.addSelf(y.multiplyScalar(n));
if(f instanceof THREE.Face3){if(c(x,g,h,k)){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};G.push(f)}}else if(f instanceof THREE.Face4&&(c(x,g,h,m)||c(x,h,k,m))){f={distance:this.origin.distanceTo(x),point:x,face:f,object:a};G.push(f)}}}return G}};
THREE.Rectangle=function(){function a(){g=d-c;h=f-b}var c,b,d,f,g,h,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(m,n,q,x){k=!1;c=m;b=n;d=q;f=x;a()};this.addPoint=function(m,n){if(k){k=!1;c=m;b=n;d=m;f=n}else{c=c<m?c:m;b=b<n?b:n;d=d>m?d:m;f=f>n?f:n}a()};
this.add3Points=function(m,n,q,x,z,p){if(k){k=!1;c=m<q?m<z?m:z:q<z?q:z;b=n<x?n<p?n:p:x<p?x:p;d=m>q?m>z?m:z:q>z?q:z;f=n>x?n>p?n:p:x>p?x:p}else{c=m<q?m<z?m<c?m:c:z<c?z:c:q<z?q<c?q:c:z<c?z:c;b=n<x?n<p?n<b?n:b:p<b?p:b:x<p?x<b?x:b:p<b?p:b;d=m>q?m>z?m>d?m:d:z>d?z:d:q>z?q>d?q:d:z>d?z:d;f=n>x?n>p?n>f?n:f:p>f?p:f:x>p?x>f?x:f:p>f?p: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.Rectangle=function(){function a(){g=e-c;h=f-b}var c,b,e,f,g,h,k=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return g};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return e};this.getBottom=function(){return f};this.set=function(m,n,p,x){k=!1;c=m;b=n;e=p;f=x;a()};this.addPoint=function(m,n){if(k){k=!1;c=m;b=n;e=m;f=n}else{c=c<m?c:m;b=b<n?b:n;e=e>m?e:m;f=f>n?f:n}a()};
this.add3Points=function(m,n,p,x,y,o){if(k){k=!1;c=m<p?m<y?m:y:p<y?p:y;b=n<x?n<o?n:o:x<o?x:o;e=m>p?m>y?m:y:p>y?p:y;f=n>x?n>o?n:o:x>o?x:o}else{c=m<p?m<y?m<c?m:c:y<c?y:c:p<y?p<c?p:c:y<c?y:c;b=n<x?n<o?n<b?n:b:o<b?o:b:x<o?x<b?x:b:o<b?o:b;e=m>p?m>y?m>e?m:e:y>e?y:e:p>y?p>e?p:e:y>e?y:e;f=n>x?n>o?n>f?n:f:o>f?o:f:x>o?x>f?x:f:o>f?o:f}a()};this.addRectangle=function(m){if(k){k=!1;c=m.getLeft();b=m.getTop();e=m.getRight();f=m.getBottom()}else{c=c<m.getLeft()?c:m.getLeft();b=b<m.getTop()?b:m.getTop();e=e>m.getRight()?
e:m.getRight();f=f>m.getBottom()?f:m.getBottom()}a()};this.inflate=function(m){c-=m;b-=m;e+=m;f+=m;a()};this.minSelf=function(m){c=c>m.getLeft()?c:m.getLeft();b=b>m.getTop()?b:m.getTop();e=e<m.getRight()?e:m.getRight();f=f<m.getBottom()?f:m.getBottom();a()};this.instersects=function(m){return Math.min(e,m.getRight())-Math.max(c,m.getLeft())>=0&&Math.min(f,m.getBottom())-Math.max(b,m.getTop())>=0};this.empty=function(){k=!0;f=e=b=c=0;a()};this.isEmpty=function(){return k}};
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
THREE.Matrix4=function(a,c,b,d,f,g,h,k,m,n,q,x,z,p,A,G){this.set(a||1,c||0,b||0,d||0,f||0,g||1,h||0,k||0,m||0,n||0,q||1,x||0,z||0,p||0,A||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
THREE.Matrix4.prototype={set:function(a,c,b,d,f,g,h,k,m,n,q,x,z,p,A,G){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=m;this.n32=n;this.n33=q;this.n34=x;this.n41=z;this.n42=p;this.n43=A;this.n44=G;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,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,h=a.n21,k=a.n22,m=a.n23,n=a.n24,q=a.n31,x=a.n32,z=a.n33,p=a.n34,A=a.n41,G=a.n42,I=a.n43,C=a.n44,J=c.n11,B=c.n12,U=c.n13,P=c.n14,O=c.n21,V=c.n22,
Y=c.n23,e=c.n24,ja=c.n31,X=c.n32,W=c.n33,wa=c.n34;this.n11=b*J+d*O+f*ja;this.n12=b*B+d*V+f*X;this.n13=b*U+d*Y+f*W;this.n14=b*P+d*e+f*wa+g;this.n21=h*J+k*O+m*ja;this.n22=h*B+k*V+m*X;this.n23=h*U+k*Y+m*W;this.n24=h*P+k*e+m*wa+n;this.n31=q*J+x*O+z*ja;this.n32=q*B+x*V+z*X;this.n33=q*U+x*Y+z*W;this.n34=q*P+x*e+z*wa+p;this.n41=A*J+G*O+I*ja;this.n42=A*B+G*V+I*X;this.n43=A*U+G*Y+I*W;this.n44=A*P+G*e+I*wa+C;return this},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;
THREE.Matrix4=function(a,c,b,e,f,g,h,k,m,n,p,x,y,o,A,G){this.set(a||1,c||0,b||0,e||0,f||0,g||1,h||0,k||0,m||0,n||0,p||1,x||0,y||0,o||0,A||0,G||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
THREE.Matrix4.prototype={set:function(a,c,b,e,f,g,h,k,m,n,p,x,y,o,A,G){this.n11=a;this.n12=c;this.n13=b;this.n14=e;this.n21=f;this.n22=g;this.n23=h;this.n24=k;this.n31=m;this.n32=n;this.n33=p;this.n34=x;this.n41=y;this.n42=o;this.n43=A;this.n44=G;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,b){var e=THREE.Matrix4.__v1,
f=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,c).normalize();if(g.length()===0)g.z=1;e.cross(b,g).normalize();if(e.length()===0){g.x+=1.0E-4;e.cross(b,g).normalize()}f.cross(g,e).normalize();this.n11=e.x;this.n12=f.x;this.n13=g.x;this.n21=e.y;this.n22=f.y;this.n23=g.y;this.n31=e.z;this.n32=f.z;this.n33=g.z;return this},multiplyVector3:function(a){var c=a.x,b=a.y,e=a.z,f=1/(this.n41*c+this.n42*b+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*e+this.n14)*f;a.y=(this.n21*c+this.n22*b+this.n23*
e+this.n24)*f;a.z=(this.n31*c+this.n32*b+this.n33*e+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,b=a.y,e=a.z,f=a.w;a.x=this.n11*c+this.n12*b+this.n13*e+this.n14*f;a.y=this.n21*c+this.n22*b+this.n23*e+this.n24*f;a.z=this.n31*c+this.n32*b+this.n33*e+this.n34*f;a.w=this.n41*c+this.n42*b+this.n43*e+this.n44*f;return a},rotateAxis:function(a){var c=a.x,b=a.y,e=a.z;a.x=c*this.n11+b*this.n12+e*this.n13;a.y=c*this.n21+b*this.n22+e*this.n23;a.z=c*this.n31+b*this.n32+e*this.n33;a.normalize();
return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,m=a.n23,n=a.n24,p=a.n31,x=a.n32,y=a.n33,o=a.n34,A=a.n41,G=a.n42,J=a.n43,D=a.n44,K=c.n11,C=c.n12,U=c.n13,P=c.n14,O=c.n21,W=c.n22,
Y=c.n23,d=c.n24,ja=c.n31,X=c.n32,V=c.n33,va=c.n34;this.n11=b*K+e*O+f*ja;this.n12=b*C+e*W+f*X;this.n13=b*U+e*Y+f*V;this.n14=b*P+e*d+f*va+g;this.n21=h*K+k*O+m*ja;this.n22=h*C+k*W+m*X;this.n23=h*U+k*Y+m*V;this.n24=h*P+k*d+m*va+n;this.n31=p*K+x*O+y*ja;this.n32=p*C+x*W+y*X;this.n33=p*U+x*Y+y*V;this.n34=p*P+x*d+y*va+o;this.n41=A*K+G*O+J*ja;this.n42=A*C+G*W+J*X;this.n43=A*U+G*Y+J*V;this.n44=A*P+G*d+J*va+D;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,h=this.n23,k=this.n24,m=this.n31,n=this.n32,q=this.n33,x=this.n34,z=this.n41,p=this.n42,A=this.n43,G=this.n44;return d*h*n*z-b*k*n*z-d*g*q*z+c*k*q*z+b*g*x*z-c*h*x*z-d*h*m*p+b*k*m*p+d*f*q*p-a*k*q*p-b*f*x*p+a*h*x*p+d*g*m*A-c*k*m*A-d*f*n*A+a*k*n*A+c*f*x*A-a*g*x*A-b*g*m*G+c*h*m*G+b*f*n*G-a*h*n*G-c*f*q*G+a*g*q*G},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
this.n11,c=this.n12,b=this.n13,e=this.n14,f=this.n21,g=this.n22,h=this.n23,k=this.n24,m=this.n31,n=this.n32,p=this.n33,x=this.n34,y=this.n41,o=this.n42,A=this.n43,G=this.n44;return e*h*n*y-b*k*n*y-e*g*p*y+c*k*p*y+b*g*x*y-c*h*x*y-e*h*m*o+b*k*m*o+e*f*p*o-a*k*p*o-b*f*x*o+a*h*x*o+e*g*m*A-c*k*m*A-e*f*n*A+a*k*n*A+c*f*x*A-a*g*x*A-b*g*m*G+c*h*m*G+b*f*n*G-a*h*n*G-c*f*p*G+a*g*p*G},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=
this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.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,h=a.y,k=a.z,m=f*g,n=f*h;this.set(m*
g+b,m*h-d*k,m*k+d*h,0,m*h+d*k,n*h+b,n*k-d*g,0,m*k-d*h,n*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 h=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=-h*g+c*d;this.n32=h*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,h=b+b,k=d+d;a=c*g;var m=c*h;c*=k;var n=b*h;b*=k;d*=k;g*=f;h*=f;f*=k;this.n11=1-(n+d);this.n12=m-f;this.n13=c+h;this.n21=m+f;this.n22=1-(a+d);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+n);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
a.n34},extractRotation:function(a,c){var b=1/c.x,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,h=a.n21,k=a.n22,m=a.n23,n=a.n24,q=a.n31,x=a.n32,z=a.n33,p=a.n34,A=a.n41,G=a.n42,I=a.n43,C=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*p*G-n*z*G+n*x*I-k*p*I-m*x*C+k*z*C;c.n12=g*z*G-f*p*G-g*x*I+d*p*I+f*x*C-d*z*C;c.n13=f*n*G-g*m*G+g*k*I-d*n*I-f*k*C+d*m*C;c.n14=g*m*x-f*n*x-g*k*z+d*n*z+f*k*p-d*m*p;c.n21=n*z*A-m*p*A-n*q*I+h*p*I+m*q*C-h*z*C;c.n22=f*p*A-g*z*A+g*q*I-b*p*I-f*q*C+b*z*C;c.n23=g*m*A-f*n*A-g*h*I+b*n*I+f*h*C-b*m*C;
c.n24=f*n*q-g*m*q+g*h*z-b*n*z-f*h*p+b*m*p;c.n31=k*p*A-n*x*A+n*q*G-h*p*G-k*q*C+h*x*C;c.n32=g*x*A-d*p*A-g*q*G+b*p*G+d*q*C-b*x*C;c.n33=f*n*A-g*k*A+g*h*G-b*n*G-d*h*C+b*k*C;c.n34=g*k*q-d*n*q-g*h*x+b*n*x+d*h*p-b*k*p;c.n41=m*x*A-k*z*A-m*q*G+h*z*G+k*q*I-h*x*I;c.n42=d*z*A-f*x*A+f*q*G-b*z*G-d*q*I+b*x*I;c.n43=f*k*A-d*m*A-f*h*G+b*m*G+d*h*I-b*k*I;c.n44=d*m*q-f*k*q+f*h*x-b*m*x-d*h*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,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,q=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*d+a.n21*h+a.n31*n;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*h;b[4]=a*k;b[5]=a*m;b[6]=a*n;b[7]=a*q;b[8]=a*x;return c};
THREE.Matrix4.makeFrustum=function(a,c,b,d,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/(d-b);h.n23=(d+b)/(d-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,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 h,k,m,n;h=new THREE.Matrix4;k=c-a;m=b-d;n=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((c+a)/k);h.n21=0;h.n22=2/m;h.n23=0;h.n24=-((b+d)/m);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((g+f)/n);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var b=Math.cos(c),e=Math.sin(c),f=1-b,g=a.x,h=a.y,k=a.z,m=f*g,n=f*h;this.set(m*
g+b,m*h-e*k,m*k+e*h,0,m*h+e*k,n*h+b,n*k-e*g,0,m*k-e*h,n*k+e*g,f*k*k+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,b=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(b);b=Math.sin(b);var g=Math.cos(e);e=Math.sin(e);var h=a*b,k=c*b;this.n11=f*g;this.n12=-f*e;this.n13=b;this.n21=k*g+a*e;this.n22=-k*e+a*g;this.n23=-c*f;this.n31=-h*g+c*e;this.n32=h*e+c*g;this.n33=a*f;return this},setRotationFromQuaternion:function(a){var c=
a.x,b=a.y,e=a.z,f=a.w,g=c+c,h=b+b,k=e+e;a=c*g;var m=c*h;c*=k;var n=b*h;b*=k;e*=k;g*=f;h*=f;f*=k;this.n11=1-(n+e);this.n12=m-f;this.n13=c+h;this.n21=m+f;this.n22=1-(a+e);this.n23=b-g;this.n31=c-h;this.n32=b+g;this.n33=1-(a+n);return this},scale:function(a){var c=a.x,b=a.y;a=a.z;this.n11*=c;this.n12*=b;this.n13*=a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=
a.n34},extractRotation:function(a,c){var b=1/c.x,e=1/c.y,f=1/c.z;this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
THREE.Matrix4.makeInvert=function(a,c){var b=a.n11,e=a.n12,f=a.n13,g=a.n14,h=a.n21,k=a.n22,m=a.n23,n=a.n24,p=a.n31,x=a.n32,y=a.n33,o=a.n34,A=a.n41,G=a.n42,J=a.n43,D=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=m*o*G-n*y*G+n*x*J-k*o*J-m*x*D+k*y*D;c.n12=g*y*G-f*o*G-g*x*J+e*o*J+f*x*D-e*y*D;c.n13=f*n*G-g*m*G+g*k*J-e*n*J-f*k*D+e*m*D;c.n14=g*m*x-f*n*x-g*k*y+e*n*y+f*k*o-e*m*o;c.n21=n*y*A-m*o*A-n*p*J+h*o*J+m*p*D-h*y*D;c.n22=f*o*A-g*y*A+g*p*J-b*o*J-f*p*D+b*y*D;c.n23=g*m*A-f*n*A-g*h*J+b*n*J+f*h*D-b*m*D;
c.n24=f*n*p-g*m*p+g*h*y-b*n*y-f*h*o+b*m*o;c.n31=k*o*A-n*x*A+n*p*G-h*o*G-k*p*D+h*x*D;c.n32=g*x*A-e*o*A-g*p*G+b*o*G+e*p*D-b*x*D;c.n33=f*n*A-g*k*A+g*h*G-b*n*G-e*h*D+b*k*D;c.n34=g*k*p-e*n*p-g*h*x+b*n*x+e*h*o-b*k*o;c.n41=m*x*A-k*y*A-m*p*G+h*y*G+k*p*J-h*x*J;c.n42=e*y*A-f*x*A+f*p*G-b*y*G-e*p*J+b*x*J;c.n43=f*k*A-e*m*A-f*h*G+b*m*G+e*h*J-b*k*J;c.n44=e*m*p-f*k*p+f*h*x-b*m*x-e*h*y+b*k*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,k=a.n33*a.n11-a.n31*a.n13,m=-a.n32*a.n11+a.n31*a.n12,n=a.n23*a.n12-a.n22*a.n13,p=-a.n23*a.n11+a.n21*a.n13,x=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*h+a.n31*n;if(a==0)throw"matrix not invertible";a=1/a;b[0]=a*e;b[1]=a*f;b[2]=a*g;b[3]=a*h;b[4]=a*k;b[5]=a*m;b[6]=a*n;b[7]=a*p;b[8]=a*x;return c};
THREE.Matrix4.makeFrustum=function(a,c,b,e,f,g){var h;h=new THREE.Matrix4;h.n11=2*f/(c-a);h.n12=0;h.n13=(c+a)/(c-a);h.n14=0;h.n21=0;h.n22=2*f/(e-b);h.n23=(e+b)/(e-b);h.n24=0;h.n31=0;h.n32=0;h.n33=-(g+f)/(g-f);h.n34=-2*g*f/(g-f);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,c,b,e){var f;a=b*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,b,e)};
THREE.Matrix4.makeOrtho=function(a,c,b,e,f,g){var h,k,m,n;h=new THREE.Matrix4;k=c-a;m=b-e;n=g-f;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((c+a)/k);h.n21=0;h.n22=2/m;h.n23=0;h.n24=-((b+e)/m);h.n31=0;h.n32=0;h.n33=-2/n;h.n34=-((g+f)/n);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
!0;this._vector=new THREE.Vector3};
THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var d=this.children.length;a<d;a++)this.children[a].update(this.matrixWorld,
c,b)}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==undefined?d:1)};
THREE.Quaternion.prototype={set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,d=a.y*c,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 h=a*c,k=d*f;this.w=h*g-k*b;this.x=h*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,h=a.y,k=a.z;a=a.w;this.x=c*a+f*g+b*k-d*h;this.y=b*a+f*h+d*g-c*k;this.z=d*a+f*k+c*h-b*g;this.w=f*a-c*g-b*h-d*k;return this},
multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,f=a.z,g=this.x,h=this.y,k=this.z,m=this.w,n=m*b+h*f-k*d,q=m*d+k*b-g*f,x=m*f+g*d-h*b;b=-g*b-h*d-k*f;c.x=n*m+b*-g+q*-k-x*-h;c.y=q*m+b*-h+x*-g-n*-k;c.z=x*m+b*-k+n*-h-q*-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),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-d)*g)/h;d=Math.sin(d*g)/h;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,h){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=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,
c,b)}};THREE.Quaternion=function(a,c,b,e){this.set(a||0,c||0,b||0,e!==undefined?e:1)};
THREE.Quaternion.prototype={set:function(a,c,b,e){this.x=a;this.y=c;this.z=b;this.w=e;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,b=a.x*c,e=a.y*c,f=a.z*c;a=Math.cos(e);e=Math.sin(e);c=Math.cos(-f);f=Math.sin(-f);var g=Math.cos(b);b=Math.sin(b);var h=a*c,k=e*f;this.w=h*g-k*b;this.x=h*b+k*g;this.y=e*c*g+a*f*b;this.z=a*f*g-e*c*b;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,b=this.y,e=this.z,f=this.w,g=a.x,h=a.y,k=a.z;a=a.w;this.x=c*a+f*g+b*k-e*h;this.y=b*a+f*h+e*g-c*k;this.z=e*a+f*k+c*h-b*g;this.w=f*a-c*g-b*h-e*k;return this},
multiplyVector3:function(a,c){c||(c=a);var b=a.x,e=a.y,f=a.z,g=this.x,h=this.y,k=this.z,m=this.w,n=m*b+h*f-k*e,p=m*e+k*b-g*f,x=m*f+g*e-h*b;b=-g*b-h*e-k*f;c.x=n*m+b*-g+p*-k-x*-h;c.y=p*m+b*-h+x*-g-n*-k;c.z=x*m+b*-k+n*-h-p*-g;return c}};
THREE.Quaternion.slerp=function(a,c,b,e){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){b.w=a.w;b.x=a.x;b.y=a.y;b.z=a.z;return b}var g=Math.acos(f),h=Math.sqrt(1-f*f);if(Math.abs(h)<0.001){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,h,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];h=this.vertices[g.c];k.sub(h.position,b.position);m.sub(c.position,b.position);k.crossSelf(m)}k.isZero()||
k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,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(oa,ma,ca,S,M,fa,ra){k=oa.vertices[ma].position;m=oa.vertices[ca].position;n=oa.vertices[S].position;q=h[M];x=h[fa];z=h[ra];p=m.x-k.x;A=n.x-k.x;G=m.y-k.y;I=n.y-k.y;C=m.z-k.z;J=n.z-k.z;B=x.u-q.u;U=z.u-q.u;P=x.v-q.v;O=z.v-q.v;V=1/(B*O-U*
P);X.set((O*p-P*A)*V,(O*G-P*I)*V,(O*C-P*J)*V);W.set((B*A-U*p)*V,(B*I-U*G)*V,(B*J-U*C)*V);e[ma].addSelf(X);e[ca].addSelf(X);e[S].addSelf(X);ja[ma].addSelf(W);ja[ca].addSelf(W);ja[S].addSelf(W)}var c,b,d,f,g,h,k,m,n,q,x,z,p,A,G,I,C,J,B,U,P,O,V,Y,e=[],ja=[],X=new THREE.Vector3,W=new THREE.Vector3,wa=new THREE.Vector3,ha=new THREE.Vector3,Aa=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){e[c]=new THREE.Vector3;ja[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 ka=["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++){Aa.copy(g.vertexNormals[d]);f=g[ka[d]];Y=e[f];wa.copy(Y);wa.subSelf(Aa.multiplyScalar(Aa.dot(Y))).normalize();ha.cross(g.vertexNormals[d],Y);f=ha.dot(ja[f]);f=f<0?-1:1;g.vertexTangents[d]=new THREE.Vector4(wa.x,wa.y,wa.z,f)}}this.hasTangents=!0},
b.centroid.addSelf(this.vertices[b.d].position);b.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,b,e,f,g,h,k=new THREE.Vector3,m=new THREE.Vector3;e=0;for(f=this.faces.length;e<f;e++){g=this.faces[e];if(a&&g.vertexNormals.length){k.set(0,0,0);c=0;for(b=g.vertexNormals.length;c<b;c++)k.addSelf(g.vertexNormals[c]);k.divideScalar(3)}else{c=this.vertices[g.a];b=this.vertices[g.b];h=this.vertices[g.c];k.sub(h.position,b.position);m.sub(c.position,b.position);k.crossSelf(m)}k.isZero()||
k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var a,c,b,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=
this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){e[b.a].addSelf(b.normal);e[b.b].addSelf(b.normal);e[b.c].addSelf(b.normal)}else if(b instanceof THREE.Face4){e[b.a].addSelf(b.normal);e[b.b].addSelf(b.normal);e[b.c].addSelf(b.normal);e[b.d].addSelf(b.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<c;a++){b=this.faces[a];if(b instanceof THREE.Face3){b.vertexNormals[0].copy(e[b.a]);
b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c])}else if(b instanceof THREE.Face4){b.vertexNormals[0].copy(e[b.a]);b.vertexNormals[1].copy(e[b.b]);b.vertexNormals[2].copy(e[b.c]);b.vertexNormals[3].copy(e[b.d])}}},computeTangents:function(){function a(oa,ma,ca,S,M,fa,ra){k=oa.vertices[ma].position;m=oa.vertices[ca].position;n=oa.vertices[S].position;p=h[M];x=h[fa];y=h[ra];o=m.x-k.x;A=n.x-k.x;G=m.y-k.y;J=n.y-k.y;D=m.z-k.z;K=n.z-k.z;C=x.u-p.u;U=y.u-p.u;P=x.v-p.v;O=y.v-p.v;W=1/(C*O-U*
P);X.set((O*o-P*A)*W,(O*G-P*J)*W,(O*D-P*K)*W);V.set((C*A-U*o)*W,(C*J-U*G)*W,(C*K-U*D)*W);d[ma].addSelf(X);d[ca].addSelf(X);d[S].addSelf(X);ja[ma].addSelf(V);ja[ca].addSelf(V);ja[S].addSelf(V)}var c,b,e,f,g,h,k,m,n,p,x,y,o,A,G,J,D,K,C,U,P,O,W,Y,d=[],ja=[],X=new THREE.Vector3,V=new THREE.Vector3,va=new THREE.Vector3,ga=new THREE.Vector3,za=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++){d[c]=new THREE.Vector3;ja[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 la=["a","b","c","d"];c=0;for(b=this.faces.length;c<b;c++){g=this.faces[c];for(e=0;e<g.vertexNormals.length;e++){za.copy(g.vertexNormals[e]);f=g[la[e]];Y=d[f];va.copy(Y);va.subSelf(za.multiplyScalar(za.dot(Y))).normalize();ga.cross(g.vertexNormals[e],Y);f=ga.dot(ja[f]);f=f<0?-1:1;g.vertexTangents[e]=new THREE.Vector4(va.x,va.y,va.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(p,A,G,I,C,J,B){p=(G-p)*0.5;I=(I-A)*0.5;return(2*(A-G)+p+I)*B+(-3*(A-G)-2*p-I)*J+p*C+A}this.points=a;var b=[],d={x:0,y:0,z:0},f,g,h,k,m,n,q,x,z;this.initFromArray=function(p){this.points=[];for(var A=0;A<p.length;A++)this.points[A]={x:p[A][0],y:p[A][1],z:p[A][2]}};this.getPoint=function(p){f=(this.points.length-1)*p;g=Math.floor(f);h=f-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;n=this.points[b[0]];q=this.points[b[1]];
x=this.points[b[2]];z=this.points[b[3]];k=h*h;m=h*k;d.x=c(n.x,q.x,x.x,z.x,h,k,m);d.y=c(n.y,q.y,x.y,z.y,h,k,m);d.z=c(n.z,q.z,x.z,z.z,h,k,m);return d};this.getControlPointsArray=function(){var p,A,G=this.points.length,I=[];for(p=0;p<G;p++){A=this.points[p];I[p]=[A.x,A.y,A.z]}return I};this.getLength=function(p){var A,G,I=A=A=0,C=new THREE.Vector3,J=new THREE.Vector3,B=[],U=0;B[0]=0;p||(p=100);G=this.points.length*p;C.copy(this.points[0]);for(p=1;p<G;p++){A=p/G;position=this.getPoint(A);J.copy(position);
U+=J.distanceTo(C);C.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=I){B[A]=U;I=A}}B[B.length]=U;return{chunks:B,total:U}};this.reparametrizeByArcLength=function(p){var A,G,I,C,J,B,U=[],P=new THREE.Vector3,O=this.getLength();U.push(P.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){G=O.chunks[A]-O.chunks[A-1];B=Math.ceil(p*G/O.total);C=(A-1)/(this.points.length-1);J=A/(this.points.length-1);for(G=1;G<B-1;G++){I=C+G*(1/B)*(J-C);position=this.getPoint(I);U.push(P.copy(position).clone())}U.push(P.copy(this.points[A]).clone())}this.points=
THREE.Spline=function(a){function c(o,A,G,J,D,K,C){o=(G-o)*0.5;J=(J-A)*0.5;return(2*(A-G)+o+J)*C+(-3*(A-G)-2*o-J)*K+o*D+A}this.points=a;var b=[],e={x:0,y:0,z:0},f,g,h,k,m,n,p,x,y;this.initFromArray=function(o){this.points=[];for(var A=0;A<o.length;A++)this.points[A]={x:o[A][0],y:o[A][1],z:o[A][2]}};this.getPoint=function(o){f=(this.points.length-1)*o;g=Math.floor(f);h=f-g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>this.points.length-2?g:g+1;b[3]=g>this.points.length-3?g:g+2;n=this.points[b[0]];p=this.points[b[1]];
x=this.points[b[2]];y=this.points[b[3]];k=h*h;m=h*k;e.x=c(n.x,p.x,x.x,y.x,h,k,m);e.y=c(n.y,p.y,x.y,y.y,h,k,m);e.z=c(n.z,p.z,x.z,y.z,h,k,m);return e};this.getControlPointsArray=function(){var o,A,G=this.points.length,J=[];for(o=0;o<G;o++){A=this.points[o];J[o]=[A.x,A.y,A.z]}return J};this.getLength=function(o){var A,G,J=A=A=0,D=new THREE.Vector3,K=new THREE.Vector3,C=[],U=0;C[0]=0;o||(o=100);G=this.points.length*o;D.copy(this.points[0]);for(o=1;o<G;o++){A=o/G;position=this.getPoint(A);K.copy(position);
U+=K.distanceTo(D);D.copy(position);A*=this.points.length-1;A=Math.floor(A);if(A!=J){C[A]=U;J=A}}C[C.length]=U;return{chunks:C,total:U}};this.reparametrizeByArcLength=function(o){var A,G,J,D,K,C,U=[],P=new THREE.Vector3,O=this.getLength();U.push(P.copy(this.points[0]).clone());for(A=1;A<this.points.length;A++){G=O.chunks[A]-O.chunks[A-1];C=Math.ceil(o*G/O.total);D=(A-1)/(this.points.length-1);K=A/(this.points.length-1);for(G=1;G<C-1;G++){J=D+G*(1/C)*(K-D);position=this.getPoint(J);U.push(P.copy(position).clone())}U.push(P.copy(this.points[A]).clone())}this.points=
U}};
THREE.AnimationHandler=function(){var a=[],c={},b={};b.update=function(f){for(var g=0;g<a.length;g++)a[g].update(f)};b.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};b.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};b.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var g=0;g<f.hierarchy.length;g++){for(var h=0;h<f.hierarchy[g].keys.length;h++){if(f.hierarchy[g].keys[h].time<0)f.hierarchy[g].keys[h].time=
0;if(f.hierarchy[g].keys[h].rot!==undefined&&!(f.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var k=f.hierarchy[g].keys[h].rot;f.hierarchy[g].keys[h].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){k={};for(h=0;h<f.hierarchy[g].keys.length;h++)for(var m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++){var n=f.hierarchy[g].keys[h].morphTargets[m];k[n]=-1}f.hierarchy[g].usedMorphTargets=k;for(h=0;h<f.hierarchy[g].keys.length;h++){var q=
{};for(n in k){for(m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++)if(f.hierarchy[g].keys[h].morphTargets[m]===n){q[n]=f.hierarchy[g].keys[h].morphTargetsInfluences[m];break}m===f.hierarchy[g].keys[h].morphTargets.length&&(q[n]=0)}f.hierarchy[g].keys[h].morphTargetsInfluences=q}}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 d(f,g);return g};var d=function(f,g){g.push(f);for(var h=0;h<f.children.length;h++)d(f.children[h],g)};b.LINEAR=
0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==undefined?d:!0;this.points=[];this.target=new THREE.Vector3};
THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,d=this.hierarchy.length,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=
0;if(f.hierarchy[g].keys[h].rot!==undefined&&!(f.hierarchy[g].keys[h].rot instanceof THREE.Quaternion)){var k=f.hierarchy[g].keys[h].rot;f.hierarchy[g].keys[h].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(f.hierarchy[g].keys[0].morphTargets!==undefined){k={};for(h=0;h<f.hierarchy[g].keys.length;h++)for(var m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++){var n=f.hierarchy[g].keys[h].morphTargets[m];k[n]=-1}f.hierarchy[g].usedMorphTargets=k;for(h=0;h<f.hierarchy[g].keys.length;h++){var p=
{};for(n in k){for(m=0;m<f.hierarchy[g].keys[h].morphTargets.length;m++)if(f.hierarchy[g].keys[h].morphTargets[m]===n){p[n]=f.hierarchy[g].keys[h].morphTargetsInfluences[m];break}m===f.hierarchy[g].keys[h].morphTargets.length&&(p[n]=0)}f.hierarchy[g].keys[h].morphTargetsInfluences=p}}for(h=1;h<f.hierarchy[g].keys.length;h++)if(f.hierarchy[g].keys[h].time===f.hierarchy[g].keys[h-1].time){f.hierarchy[g].keys.splice(h,1);h--}for(h=1;h<f.hierarchy[g].keys.length;h++)f.hierarchy[g].keys[h].index=h}h=parseInt(f.length*
f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(g=0;g<f.hierarchy.length;g++)f.JIT.hierarchy.push(Array(h));f.initialized=!0}};b.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};b.parse=function(f){var g=[];if(f instanceof THREE.SkinnedMesh)for(var h=0;h<f.bones.length;h++)g.push(f.bones[h]);else e(f,g);return g};var e=function(f,g){g.push(f);for(var h=0;h<f.children.length;h++)e(f.children[h],g)};b.LINEAR=
0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=2;return b}();THREE.Animation=function(a,c,b,e){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=b!==undefined?b:THREE.AnimationHandler.LINEAR;this.JITCompile=e!==undefined?e:!0;this.points=[];this.target=new THREE.Vector3};
THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var b,e=this.hierarchy.length,f;for(b=0;b<e;b++){f=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
f instanceof THREE.Bone?f.skinMatrix:f.matrix}var g=f.animationCache.prevKey;f=f.animationCache.nextKey;g.pos=this.data.hierarchy[b].keys[0];g.rot=this.data.hierarchy[b].keys[0];g.scl=this.data.hierarchy[b].keys[0];f.pos=this.getNextKeyWith("pos",b,1);f.rot=this.getNextKeyWith("rot",b,1);f.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,f,g,h,k,m,n,q=this.data.JIT.hierarchy,x,z;this.currentTime+=a*this.timeScale;z=this.currentTime;x=this.currentTime%=this.data.length;n=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,A=this.hierarchy.length;p<A;p++){a=this.hierarchy[p];m=a.animationCache;if(this.JITCompile&&q[p][n]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=q[p][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
!1}else{a.matrix=q[p][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var G=0;G<3;G++){b=c[G];h=m.prevKey[b];k=m.nextKey[b];if(k.time<=z){if(x<z)if(this.loop){h=this.data.hierarchy[p].keys[0];for(k=this.getNextKeyWith(b,p,1);k.time<x;){h=k;k=this.getNextKeyWith(b,p,k.index+1)}}else{this.stop();return}else{do{h=k;k=this.getNextKeyWith(b,p,k.index+1)}while(k.time<
x)}m.prevKey[b]=h;m.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(x-h.time)/(k.time-h.time);f=h[b];g=k[b];if(d<0||d>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p);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",p,h.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",p,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&&q[0][n]===undefined){this.hierarchy[0].update(undefined,!0);for(p=0;p<this.hierarchy.length;p++)q[p][n]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],f,g,h,k,m,n;f=(a.length-1)*c;g=Math.floor(f);f-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];k=a[b[1]];m=a[b[2]];n=a[b[3]];b=f*f;h=f*b;d[0]=this.interpolate(g[0],k[0],m[0],n[0],f,b,h);d[1]=this.interpolate(g[1],k[1],m[1],n[1],f,b,h);d[2]=this.interpolate(g[2],k[2],m[2],n[2],f,b,h);return d};
THREE.Animation.prototype.interpolate=function(a,c,b,d,f,g,h){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*h+(-3*(c-b)-2*a-d)*g+a*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,k,m,n,p=this.data.JIT.hierarchy,x,y;this.currentTime+=a*this.timeScale;y=this.currentTime;x=this.currentTime%=this.data.length;n=parseInt(Math.min(x*this.data.fps,this.data.length*this.data.fps),10);for(var o=0,A=this.hierarchy.length;o<A;o++){a=this.hierarchy[o];m=a.animationCache;if(this.JITCompile&&p[o][n]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=p[o][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
!1}else{a.matrix=p[o][n];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var G=0;G<3;G++){b=c[G];h=m.prevKey[b];k=m.nextKey[b];if(k.time<=y){if(x<y)if(this.loop){h=this.data.hierarchy[o].keys[0];for(k=this.getNextKeyWith(b,o,1);k.time<x;){h=k;k=this.getNextKeyWith(b,o,k.index+1)}}else{this.stop();return}else{do{h=k;k=this.getNextKeyWith(b,o,k.index+1)}while(k.time<
x)}m.prevKey[b]=h;m.nextKey[b]=k}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;e=(x-h.time)/(k.time-h.time);f=h[b];g=k[b];if(e<0||e>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+e+" on bone "+o);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",o,h.index-1).pos;this.points[1]=f;this.points[2]=g;this.points[3]=this.getNextKeyWith("pos",o,k.index+1).pos;e=e*0.33+0.33;f=this.interpolateCatmullRom(this.points,e);b.x=f[0];b.y=f[1];b.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){e=this.interpolateCatmullRom(this.points,e*1.01);this.target.set(e[0],e[1],e[2]);this.target.subSelf(b);this.target.y=0;this.target.normalize();e=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,e,0)}}}else if(b===
"rot")THREE.Quaternion.slerp(f,g,a.quaternion,e);else if(b==="scl"){b=a.scale;b.x=f[0]+(g[0]-f[0])*e;b.y=f[1]+(g[1]-f[1])*e;b.z=f[2]+(g[2]-f[2])*e}}}}if(this.JITCompile&&p[0][n]===undefined){this.hierarchy[0].update(undefined,!0);for(o=0;o<this.hierarchy.length;o++)p[o][n]=this.hierarchy[o]instanceof THREE.Bone?this.hierarchy[o].skinMatrix.clone():this.hierarchy[o].matrix.clone()}}};
THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],e=[],f,g,h,k,m,n;f=(a.length-1)*c;g=Math.floor(f);f-=g;b[0]=g==0?g:g-1;b[1]=g;b[2]=g>a.length-2?g:g+1;b[3]=g>a.length-3?g:g+2;g=a[b[0]];k=a[b[1]];m=a[b[2]];n=a[b[3]];b=f*f;h=f*b;e[0]=this.interpolate(g[0],k[0],m[0],n[0],f,b,h);e[1]=this.interpolate(g[1],k[1],m[1],n[1],f,b,h);e[2]=this.interpolate(g[2],k[2],m[2],n[2],f,b,h);return e};
THREE.Animation.prototype.interpolate=function(a,c,b,e,f,g,h){a=(b-a)*0.5;e=(e-c)*0.5;return(2*(c-b)+a+e)*h+(-3*(c-b)-2*a-e)*g+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)b=b<e.length-1?b:e.length-1;else b%=e.length;for(;b<e.length;b++)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[0]};
THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){var e=this.data.hierarchy[c].keys;for(b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+e.length;b>=0;b--)if(e[b][a]!==undefined)return e[b];return this.data.hierarchy[c].keys[e.length-1]};
THREE.Camera=function(a,c,b,e,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=b||0.1;this.far=e||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
THREE.Camera.prototype.update=function(a,c,b){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,b)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
@@ -115,91 +115,91 @@ 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,h,k;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){f=this.geometry.bones[b];g=f.pos;h=f.rotq;k=f.scl;d=this.addBone();d.name=f.name;d.position.set(g[0],g[1],g[2]);d.quaternion.set(h[0],h[1],h[2],h[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,k;if(this.geometry.bones!==undefined){for(b=0;b<this.geometry.bones.length;b++){f=this.geometry.bones[b];g=f.pos;h=f.rotq;k=f.scl;e=this.addBone();e.name=f.name;e.position.set(g[0],g[1],g[2]);e.quaternion.set(h[0],h[1],h[2],h[3]);e.useQuaternion=!0;k!==undefined?e.scale.set(k[0],k[1],k[2]):e.scale.set(1,1,1)}for(b=0;b<this.bones.length;b++){f=this.geometry.bones[b];
e=this.bones[b];f.parent===-1?this.addChild(e):this.bones[f.parent].addChild(e)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
THREE.SkinnedMesh.prototype.update=function(a,c,b){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e,f=this.children.length;for(e=0;e<f;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,b):a.update(this.matrixWorld,c,b)}b=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<b;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
c*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],b=0;b<this.bones.length;b++){a=this.bones[b];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,b*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var d;for(a=0;a<this.geometry.skinIndices.length;a++){b=this.geometry.vertices[a].position;var 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,h,k,m,n,q,x=["a","b","c","d"];for(m=0;m<g;m++){k=c.length;h=f[m];if(h instanceof THREE.Face4){n=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{n=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(h.normal);b.push(k);for(k=
0;k<n;k++){q=a[h[x[k]]];c.push(new THREE.Vertex(q.position.clone()))}}for(g=0;g<f.length-1;g++){a=b[g];for(h=g+1;h<f.length;h++){k=b[h];k=this.facesShareEdge(c,a,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);d.push(k)}}}};
THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,b){var d,f,g,h,k,m,n,q,x,z,p,A,G,I=0,C=["a","b","c","d"];d=c instanceof THREE.Face4?4:3;f=b instanceof THREE.Face4?4:3;for(A=0;A<d;A++){g=c[C[A]];k=a[g];for(G=0;G<f;G++){h=b[C[G]];m=a[h];if(Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4){I++;if(I===1){n=k;q=m;x=g;z=h;p=C[A]}if(I===2){p+=C[A];return p==="ad"||p==="ac"?{faces:[c,b],vertices:[n,q,m,k],indices:[x,
z,h,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,b],vertices:[n,k,m,q],indices:[x,g,h,z],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(a){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=a.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,b=this.geometry.faces,e=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var g=f.length,h,k,m,n,p,x=["a","b","c","d"];for(m=0;m<g;m++){k=c.length;h=f[m];if(h instanceof THREE.Face4){n=4;k=new THREE.Face4(k,k+1,k+2,k+3)}else{n=3;k=new THREE.Face3(k,k+1,k+2)}k.normal.copy(h.normal);b.push(k);for(k=
0;k<n;k++){p=a[h[x[k]]];c.push(new THREE.Vertex(p.position.clone()))}}for(g=0;g<f.length-1;g++){a=b[g];for(h=g+1;h<f.length;h++){k=b[h];k=this.facesShareEdge(c,a,k);if(k!==undefined){k=new THREE.Face4(k.indices[0],k.indices[3],k.indices[2],k.indices[1]);k.normal.set(1,0,0);e.push(k)}}}};
THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,b){var e,f,g,h,k,m,n,p,x,y,o,A,G,J=0,D=["a","b","c","d"];e=c instanceof THREE.Face4?4:3;f=b instanceof THREE.Face4?4:3;for(A=0;A<e;A++){g=c[D[A]];k=a[g];for(G=0;G<f;G++){h=b[D[G]];m=a[h];if(Math.abs(k.position.x-m.position.x)<1.0E-4&&Math.abs(k.position.y-m.position.y)<1.0E-4&&Math.abs(k.position.z-m.position.z)<1.0E-4){J++;if(J===1){n=k;p=m;x=g;y=h;o=D[A]}if(J===2){o+=D[A];return o==="ad"||o==="ac"?{faces:[c,b],vertices:[n,p,m,k],indices:[x,
y,h,g],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,b],vertices:[n,k,m,p],indices:[x,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 X=m[k]=m[k]||new THREE.RenderableVertex;k++;return X}function c(X,W){return W.z-X.z}function b(X,W){var wa=0,ha=1,Aa=X.z+X.w,ka=W.z+W.w,oa=-X.z+X.w,ma=-W.z+W.w;if(Aa>=0&&ka>=0&&oa>=0&&ma>=0)return!0;else if(Aa<0&&ka<0||oa<0&&ma<0)return!1;else{if(Aa<0)wa=Math.max(wa,Aa/(Aa-ka));else ka<0&&(ha=Math.min(ha,Aa/(Aa-ka)));if(oa<0)wa=Math.max(wa,oa/(oa-ma));else ma<0&&(ha=Math.min(ha,oa/(oa-ma)));if(ha<wa)return!1;else{X.lerpSelf(W,wa);W.lerpSelf(X,1-ha);return!0}}}
var d,f,g=[],h,k,m=[],n,q,x=[],z,p=[],A,G,I=[],C,J,B=[],U=new THREE.Vector4,P=new THREE.Vector4,O=new THREE.Matrix4,V=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],e=new THREE.Vector4,ja=new THREE.Vector4;this.projectVector=function(X,W){O.multiply(W.projectionMatrix,W.matrixWorldInverse);O.multiplyVector3(X);return X};this.unprojectVector=function(X,W){O.multiply(W.matrixWorld,THREE.Matrix4.makeInvert(W.projectionMatrix));
O.multiplyVector3(X);return X};this.projectObjects=function(X,W,wa){W=[];var ha,Aa,ka;f=0;Aa=X.objects;X=0;for(ha=Aa.length;X<ha;X++){ka=Aa[X];var oa;if(!(oa=!ka.visible))if(oa=ka instanceof THREE.Mesh){a:{oa=void 0;for(var ma=ka.matrixWorld,ca=-ka.geometry.boundingSphere.radius*Math.max(ka.scale.x,Math.max(ka.scale.y,ka.scale.z)),S=0;S<6;S++){oa=Y[S].x*ma.n14+Y[S].y*ma.n24+Y[S].z*ma.n34+Y[S].w;if(oa<=ca){oa=!1;break a}}oa=!0}oa=!oa}if(!oa){oa=g[f]=g[f]||new THREE.RenderableObject;f++;d=oa;U.copy(ka.position);
O.multiplyVector3(U);d.object=ka;d.z=U.z;W.push(d)}}wa&&W.sort(c);return W};this.projectScene=function(X,W,wa){var ha=[],Aa=W.near,ka=W.far,oa,ma,ca,S,M,fa,ra,la,qa,xa,Ca,Za,$a,Ha,j,w,t;J=G=z=q=0;W.matrixAutoUpdate&&W.updateMatrix();X.update(undefined,!1,W);O.multiply(W.projectionMatrix,W.matrixWorldInverse);Y[0].set(O.n41-O.n11,O.n42-O.n12,O.n43-O.n13,O.n44-O.n14);Y[1].set(O.n41+O.n11,O.n42+O.n12,O.n43+O.n13,O.n44+O.n14);Y[2].set(O.n41+O.n21,O.n42+O.n22,O.n43+O.n23,O.n44+O.n24);Y[3].set(O.n41-O.n21,
O.n42-O.n22,O.n43-O.n23,O.n44-O.n24);Y[4].set(O.n41-O.n31,O.n42-O.n32,O.n43-O.n33,O.n44-O.n34);Y[5].set(O.n41+O.n31,O.n42+O.n32,O.n43+O.n33,O.n44+O.n34);for(oa=0;oa<6;oa++){qa=Y[oa];qa.divideScalar(Math.sqrt(qa.x*qa.x+qa.y*qa.y+qa.z*qa.z))}qa=this.projectObjects(X,W,!0);X=0;for(oa=qa.length;X<oa;X++){xa=qa[X].object;if(xa.visible){Ca=xa.matrixWorld;Za=xa.matrixRotationWorld;$a=xa.materials;Ha=xa.overdraw;k=0;if(xa instanceof THREE.Mesh){j=xa.geometry;S=j.vertices;w=j.faces;j=j.faceVertexUvs;ma=0;
for(ca=S.length;ma<ca;ma++){h=a();h.positionWorld.copy(S[ma].position);Ca.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>Aa&&h.positionScreen.z<ka}S=0;for(ma=w.length;S<ma;S++){ca=w[S];if(ca instanceof THREE.Face3){M=m[ca.a];fa=m[ca.b];ra=m[ca.c];if(M.visible&&fa.visible&&ra.visible&&(xa.doubleSided||xa.flipSided!=(ra.positionScreen.x-
M.positionScreen.x)*(fa.positionScreen.y-M.positionScreen.y)-(ra.positionScreen.y-M.positionScreen.y)*(fa.positionScreen.x-M.positionScreen.x)<0)){la=x[q]=x[q]||new THREE.RenderableFace3;q++;n=la;n.v1.copy(M);n.v2.copy(fa);n.v3.copy(ra)}else continue}else if(ca instanceof THREE.Face4){M=m[ca.a];fa=m[ca.b];ra=m[ca.c];la=m[ca.d];if(M.visible&&fa.visible&&ra.visible&&la.visible&&(xa.doubleSided||xa.flipSided!=((la.positionScreen.x-M.positionScreen.x)*(fa.positionScreen.y-M.positionScreen.y)-(la.positionScreen.y-
M.positionScreen.y)*(fa.positionScreen.x-M.positionScreen.x)<0||(fa.positionScreen.x-ra.positionScreen.x)*(la.positionScreen.y-ra.positionScreen.y)-(fa.positionScreen.y-ra.positionScreen.y)*(la.positionScreen.x-ra.positionScreen.x)<0))){t=p[z]=p[z]||new THREE.RenderableFace4;z++;n=t;n.v1.copy(M);n.v2.copy(fa);n.v3.copy(ra);n.v4.copy(la)}else continue}n.normalWorld.copy(ca.normal);Za.multiplyVector3(n.normalWorld);n.centroidWorld.copy(ca.centroid);Ca.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);
O.multiplyVector3(n.centroidScreen);ra=ca.vertexNormals;M=0;for(fa=ra.length;M<fa;M++){la=n.vertexNormalsWorld[M];la.copy(ra[M]);Za.multiplyVector3(la)}M=0;for(fa=j.length;M<fa;M++)if(t=j[M][S]){ra=0;for(la=t.length;ra<la;ra++)n.uvs[M][ra]=t[ra]}n.meshMaterials=$a;n.faceMaterials=ca.materials;n.overdraw=Ha;n.z=n.centroidScreen.z;ha.push(n)}}else if(xa instanceof THREE.Line){V.multiply(O,Ca);S=xa.geometry.vertices;M=a();M.positionScreen.copy(S[0].position);V.multiplyVector4(M.positionScreen);ma=1;
for(ca=S.length;ma<ca;ma++){M=a();M.positionScreen.copy(S[ma].position);V.multiplyVector4(M.positionScreen);fa=m[k-2];e.copy(M.positionScreen);ja.copy(fa.positionScreen);if(b(e,ja)){e.multiplyScalar(1/e.w);ja.multiplyScalar(1/ja.w);Ca=I[G]=I[G]||new THREE.RenderableLine;G++;A=Ca;A.v1.positionScreen.copy(e);A.v2.positionScreen.copy(ja);A.z=Math.max(e.z,ja.z);A.materials=xa.materials;ha.push(A)}}}else if(xa instanceof THREE.Particle){P.set(xa.position.x,xa.position.y,xa.position.z,1);O.multiplyVector4(P);
P.z/=P.w;if(P.z>0&&P.z<1){Ca=B[J]=B[J]||new THREE.RenderableParticle;J++;C=Ca;C.x=P.x/P.w;C.y=P.y/P.w;C.z=P.z;C.rotation=xa.rotation.z;C.scale.x=xa.scale.x*Math.abs(C.x-(P.x+W.projectionMatrix.n11)/(P.w+W.projectionMatrix.n14));C.scale.y=xa.scale.y*Math.abs(C.y-(P.y+W.projectionMatrix.n22)/(P.w+W.projectionMatrix.n24));C.materials=xa.materials;ha.push(C)}}}}wa&&ha.sort(c);return ha}};
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(h,k){b=h;d=k;f=b/2;g=d/2};this.render=function(h,k){var m,n,q,x,z,p,A,G;a=c.projectScene(h,k);m=0;for(n=a.length;m<n;m++){z=a[m];if(z instanceof THREE.RenderableParticle){A=z.x*f+f;G=z.y*g+g;q=0;for(x=z.material.length;q<x;q++){p=z.material[q];if(p instanceof THREE.ParticleDOMMaterial){p=p.domElement;p.style.left=A+"px";p.style.top=G+"px"}}}}}};
THREE.CanvasRenderer=function(){function a(R){if(z!=R)n.globalAlpha=z=R}function c(R){if(p!=R){switch(R){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}p=R}}var b=null,d=new THREE.Projector,f=document.createElement("canvas"),g,h,k,m,n=f.getContext("2d"),q=new THREE.Color(0),x=0,z=1,p=0,A=null,G=null,I=1,C,J,B,U,P=new THREE.RenderableVertex,
O=new THREE.RenderableVertex,V,Y,e,ja,X,W,wa,ha,Aa,ka,oa,ma,ca=new THREE.Color,S=new THREE.Color,M=new THREE.Color,fa=new THREE.Color,ra=new THREE.Color,la,qa,xa,Ca,Za,$a,Ha,j,w,t,o=new THREE.Rectangle,y=new THREE.Rectangle,E=new THREE.Rectangle,K=!1,F=new THREE.Color,D=new THREE.Color,Q=new THREE.Color,H=new THREE.Color,T=new THREE.Vector3,ga,pa,sa,ya,ua,Ea,da=16;ga=document.createElement("canvas");ga.width=ga.height=2;pa=ga.getContext("2d");pa.fillStyle="rgba(0,0,0,1)";pa.fillRect(0,0,2,2);sa=pa.getImageData(0,
0,2,2);ya=sa.data;ua=document.createElement("canvas");ua.width=ua.height=da;Ea=ua.getContext("2d");Ea.translate(-da/2,-da/2);Ea.scale(da,da);da--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(R,ia){g=R;h=ia;k=g/2;m=h/2;f.width=g;f.height=h;o.set(-k,-m,k,m);z=1;p=0;G=A=null;I=1};this.setClearColor=function(R,ia){q=R;x=ia};this.setClearColorHex=function(R,ia){q.setHex(R);x=ia};this.clear=function(){n.setTransform(1,0,0,-1,k,m);if(!y.isEmpty()){y.inflate(1);
y.minSelf(o);if(q.hex==0&&x==0)n.clearRect(y.getX(),y.getY(),y.getWidth(),y.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+x+")";n.fillRect(y.getX(),y.getY(),y.getWidth(),y.getHeight())}y.empty()}};this.render=function(R,ia){function La(L){var Z,na,aa,ta=L.lights;D.setRGB(0,0,0);Q.setRGB(0,0,0);H.setRGB(0,0,0);L=0;for(Z=ta.length;L<Z;L++){na=ta[L];aa=na.color;if(na instanceof THREE.AmbientLight){D.r+=aa.r;
D.g+=aa.g;D.b+=aa.b}else if(na instanceof THREE.DirectionalLight){Q.r+=aa.r;Q.g+=aa.g;Q.b+=aa.b}else if(na instanceof THREE.PointLight){H.r+=aa.r;H.g+=aa.g;H.b+=aa.b}}}function Ga(L,Z,na,aa){var ta,za,ea,$,Ka=L.lights;L=0;for(ta=Ka.length;L<ta;L++){za=Ka[L];ea=za.color;$=za.intensity;if(za instanceof THREE.DirectionalLight){za=na.dot(za.position)*$;if(za>0){aa.r+=ea.r*za;aa.g+=ea.g*za;aa.b+=ea.b*za}}else if(za instanceof THREE.PointLight){T.sub(za.position,Z);T.normalize();za=na.dot(T)*$;if(za>0){aa.r+=
ea.r*za;aa.g+=ea.g*za;aa.b+=ea.b*za}}}}function eb(L,Z,na){a(na.opacity);c(na.blending);var aa,ta,za,ea,$,Ka;if(na instanceof THREE.ParticleBasicMaterial){if(na.map){ea=na.map.image;$=ea.width>>1;Ka=ea.height>>1;na=Z.scale.x*k;za=Z.scale.y*m;aa=na*$;ta=za*Ka;E.set(L.x-aa,L.y-ta,L.x+aa,L.y+ta);if(o.instersects(E)){n.save();n.translate(L.x,L.y);n.rotate(-Z.rotation);n.scale(na,-za);n.translate(-$,-Ka);n.drawImage(ea,0,0);n.restore()}}}else if(na instanceof THREE.ParticleCanvasMaterial){if(K){F.r=D.r+
Q.r+H.r;F.g=D.g+Q.g+H.g;F.b=D.b+Q.b+H.b;ca.r=na.color.r*F.r;ca.g=na.color.g*F.g;ca.b=na.color.b*F.b;ca.updateStyleString()}else ca.__styleString=na.color.__styleString;aa=Z.scale.x*k;ta=Z.scale.y*m;E.set(L.x-aa,L.y-ta,L.x+aa,L.y+ta);if(o.instersects(E)){n.save();n.translate(L.x,L.y);n.rotate(-Z.rotation);n.scale(aa,ta);na.program(n,ca);n.restore()}}}function Ta(L,Z,na,aa){a(aa.opacity);c(aa.blending);n.beginPath();n.moveTo(L.positionScreen.x,L.positionScreen.y);n.lineTo(Z.positionScreen.x,Z.positionScreen.y);
n.closePath();if(aa instanceof THREE.LineBasicMaterial){ca.__styleString=aa.color.__styleString;L=aa.linewidth;if(I!=L)n.lineWidth=I=L;L=ca.__styleString;if(A!=L)n.strokeStyle=A=L;n.stroke();E.inflate(aa.linewidth*2)}}function Ia(L,Z,na,aa,ta,za,ea,$,Ka){a($.opacity);c($.blending);V=L.positionScreen.x;Y=L.positionScreen.y;e=Z.positionScreen.x;ja=Z.positionScreen.y;X=na.positionScreen.x;W=na.positionScreen.y;bb(V,Y,e,ja,X,W);if($ instanceof THREE.MeshBasicMaterial)if($.map){if($.map.mapping instanceof
THREE.UVMapping){Ca=ea.uvs[0];Da(V,Y,e,ja,X,W,$.map.image,Ca[aa].u,Ca[aa].v,Ca[ta].u,Ca[ta].v,Ca[za].u,Ca[za].v)}}else if($.envMap){if($.envMap.mapping instanceof THREE.SphericalReflectionMapping){L=ia.matrixWorldInverse;T.copy(ea.vertexNormalsWorld[0]);Za=(T.x*L.n11+T.y*L.n12+T.z*L.n13)*0.5+0.5;$a=-(T.x*L.n21+T.y*L.n22+T.z*L.n23)*0.5+0.5;T.copy(ea.vertexNormalsWorld[1]);Ha=(T.x*L.n11+T.y*L.n12+T.z*L.n13)*0.5+0.5;j=-(T.x*L.n21+T.y*L.n22+T.z*L.n23)*0.5+0.5;T.copy(ea.vertexNormalsWorld[2]);w=(T.x*L.n11+
T.y*L.n12+T.z*L.n13)*0.5+0.5;t=-(T.x*L.n21+T.y*L.n22+T.z*L.n23)*0.5+0.5;Da(V,Y,e,ja,X,W,$.envMap.image,Za,$a,Ha,j,w,t)}}else $.wireframe?Pa($.color.__styleString,$.wireframeLinewidth):Ua($.color.__styleString);else if($ instanceof THREE.MeshLambertMaterial){if($.map&&!$.wireframe){if($.map.mapping instanceof THREE.UVMapping){Ca=ea.uvs[0];Da(V,Y,e,ja,X,W,$.map.image,Ca[aa].u,Ca[aa].v,Ca[ta].u,Ca[ta].v,Ca[za].u,Ca[za].v)}c(THREE.SubtractiveBlending)}if(K)if(!$.wireframe&&$.shading==THREE.SmoothShading&&
ea.vertexNormalsWorld.length==3){S.r=M.r=fa.r=D.r;S.g=M.g=fa.g=D.g;S.b=M.b=fa.b=D.b;Ga(Ka,ea.v1.positionWorld,ea.vertexNormalsWorld[0],S);Ga(Ka,ea.v2.positionWorld,ea.vertexNormalsWorld[1],M);Ga(Ka,ea.v3.positionWorld,ea.vertexNormalsWorld[2],fa);ra.r=(M.r+fa.r)*0.5;ra.g=(M.g+fa.g)*0.5;ra.b=(M.b+fa.b)*0.5;xa=Va(S,M,fa,ra);Da(V,Y,e,ja,X,W,xa,0,0,1,0,0,1)}else{F.r=D.r;F.g=D.g;F.b=D.b;Ga(Ka,ea.centroidWorld,ea.normalWorld,F);ca.r=$.color.r*F.r;ca.g=$.color.g*F.g;ca.b=$.color.b*F.b;ca.updateStyleString();
$.wireframe?Pa(ca.__styleString,$.wireframeLinewidth):Ua(ca.__styleString)}else $.wireframe?Pa($.color.__styleString,$.wireframeLinewidth):Ua($.color.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){la=ia.near;qa=ia.far;S.r=S.g=S.b=1-Ma(L.positionScreen.z,la,qa);M.r=M.g=M.b=1-Ma(Z.positionScreen.z,la,qa);fa.r=fa.g=fa.b=1-Ma(na.positionScreen.z,la,qa);ra.r=(M.r+fa.r)*0.5;ra.g=(M.g+fa.g)*0.5;ra.b=(M.b+fa.b)*0.5;xa=Va(S,M,fa,ra);Da(V,Y,e,ja,X,W,xa,0,0,1,0,0,1)}else if($ instanceof THREE.MeshNormalMaterial){ca.r=
N(ea.normalWorld.x);ca.g=N(ea.normalWorld.y);ca.b=N(ea.normalWorld.z);ca.updateStyleString();$.wireframe?Pa(ca.__styleString,$.wireframeLinewidth):Ua(ca.__styleString)}}function Ra(L,Z,na,aa,ta,za,ea,$,Ka){a($.opacity);c($.blending);if($.map||$.envMap){Ia(L,Z,aa,0,1,3,ea,$,Ka);Ia(ta,na,za,1,2,3,ea,$,Ka)}else{V=L.positionScreen.x;Y=L.positionScreen.y;e=Z.positionScreen.x;ja=Z.positionScreen.y;X=na.positionScreen.x;W=na.positionScreen.y;wa=aa.positionScreen.x;ha=aa.positionScreen.y;Aa=ta.positionScreen.x;
ka=ta.positionScreen.y;oa=za.positionScreen.x;ma=za.positionScreen.y;if($ instanceof THREE.MeshBasicMaterial){db(V,Y,e,ja,X,W,wa,ha);$.wireframe?Pa($.color.__styleString,$.wireframeLinewidth):Ua($.color.__styleString)}else if($ instanceof THREE.MeshLambertMaterial)if(K)if(!$.wireframe&&$.shading==THREE.SmoothShading&&ea.vertexNormalsWorld.length==4){S.r=M.r=fa.r=ra.r=D.r;S.g=M.g=fa.g=ra.g=D.g;S.b=M.b=fa.b=ra.b=D.b;Ga(Ka,ea.v1.positionWorld,ea.vertexNormalsWorld[0],S);Ga(Ka,ea.v2.positionWorld,ea.vertexNormalsWorld[1],
M);Ga(Ka,ea.v4.positionWorld,ea.vertexNormalsWorld[3],fa);Ga(Ka,ea.v3.positionWorld,ea.vertexNormalsWorld[2],ra);xa=Va(S,M,fa,ra);bb(V,Y,e,ja,wa,ha);Da(V,Y,e,ja,wa,ha,xa,0,0,1,0,0,1);bb(Aa,ka,X,W,oa,ma);Da(Aa,ka,X,W,oa,ma,xa,1,0,1,1,0,1)}else{F.r=D.r;F.g=D.g;F.b=D.b;Ga(Ka,ea.centroidWorld,ea.normalWorld,F);ca.r=$.color.r*F.r;ca.g=$.color.g*F.g;ca.b=$.color.b*F.b;ca.updateStyleString();db(V,Y,e,ja,X,W,wa,ha);$.wireframe?Pa(ca.__styleString,$.wireframeLinewidth):Ua(ca.__styleString)}else{db(V,Y,e,ja,
X,W,wa,ha);$.wireframe?Pa($.color.__styleString,$.wireframeLinewidth):Ua($.color.__styleString)}else if($ instanceof THREE.MeshNormalMaterial){ca.r=N(ea.normalWorld.x);ca.g=N(ea.normalWorld.y);ca.b=N(ea.normalWorld.z);ca.updateStyleString();db(V,Y,e,ja,X,W,wa,ha);$.wireframe?Pa(ca.__styleString,$.wireframeLinewidth):Ua(ca.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){la=ia.near;qa=ia.far;S.r=S.g=S.b=1-Ma(L.positionScreen.z,la,qa);M.r=M.g=M.b=1-Ma(Z.positionScreen.z,la,qa);fa.r=fa.g=
fa.b=1-Ma(aa.positionScreen.z,la,qa);ra.r=ra.g=ra.b=1-Ma(na.positionScreen.z,la,qa);xa=Va(S,M,fa,ra);bb(V,Y,e,ja,wa,ha);Da(V,Y,e,ja,wa,ha,xa,0,0,1,0,0,1);bb(Aa,ka,X,W,oa,ma);Da(Aa,ka,X,W,oa,ma,xa,1,0,1,1,0,1)}}}function bb(L,Z,na,aa,ta,za){n.beginPath();n.moveTo(L,Z);n.lineTo(na,aa);n.lineTo(ta,za);n.lineTo(L,Z);n.closePath()}function db(L,Z,na,aa,ta,za,ea,$){n.beginPath();n.moveTo(L,Z);n.lineTo(na,aa);n.lineTo(ta,za);n.lineTo(ea,$);n.lineTo(L,Z);n.closePath()}function Pa(L,Z){if(A!=L)n.strokeStyle=
A=L;if(I!=Z)n.lineWidth=I=Z;n.stroke();E.inflate(Z*2)}function Ua(L){if(G!=L)n.fillStyle=G=L;n.fill()}function Da(L,Z,na,aa,ta,za,ea,$,Ka,Xa,Ya,cb,gb){var ab,Wa;ab=ea.width-1;Wa=ea.height-1;$*=ab;Ka*=Wa;Xa*=ab;Ya*=Wa;cb*=ab;gb*=Wa;na-=L;aa-=Z;ta-=L;za-=Z;Xa-=$;Ya-=Ka;cb-=$;gb-=Ka;ab=Xa*gb-cb*Ya;if(ab!=0){Wa=1/ab;ab=(gb*na-Ya*ta)*Wa;Ya=(gb*aa-Ya*za)*Wa;na=(Xa*ta-cb*na)*Wa;aa=(Xa*za-cb*aa)*Wa;L=L-ab*$-na*Ka;Z=Z-Ya*$-aa*Ka;n.save();n.transform(ab,Ya,na,aa,L,Z);n.clip();n.drawImage(ea,0,0);n.restore()}}
function Va(L,Z,na,aa){var ta=~~(L.r*255),za=~~(L.g*255);L=~~(L.b*255);var ea=~~(Z.r*255),$=~~(Z.g*255);Z=~~(Z.b*255);var Ka=~~(na.r*255),Xa=~~(na.g*255);na=~~(na.b*255);var Ya=~~(aa.r*255),cb=~~(aa.g*255);aa=~~(aa.b*255);ya[0]=ta<0?0:ta>255?255:ta;ya[1]=za<0?0:za>255?255:za;ya[2]=L<0?0:L>255?255:L;ya[4]=ea<0?0:ea>255?255:ea;ya[5]=$<0?0:$>255?255:$;ya[6]=Z<0?0:Z>255?255:Z;ya[8]=Ka<0?0:Ka>255?255:Ka;ya[9]=Xa<0?0:Xa>255?255:Xa;ya[10]=na<0?0:na>255?255:na;ya[12]=Ya<0?0:Ya>255?255:Ya;ya[13]=cb<0?0:cb>
255?255:cb;ya[14]=aa<0?0:aa>255?255:aa;pa.putImageData(sa,0,0);Ea.drawImage(ga,0,0);return ua}function Ma(L,Z,na){L=(L-Z)/(na-Z);return L*L*(3-2*L)}function N(L){L=(L+1)*0.5;return L<0?0:L>1?1:L}function Na(L,Z){var na=Z.x-L.x,aa=Z.y-L.y,ta=1/Math.sqrt(na*na+aa*aa);na*=ta;aa*=ta;Z.x+=na;Z.y+=aa;L.x-=na;L.y-=aa}var Qa,ib,Ba,Sa,Fa,Oa,Ja,va;this.autoClear?this.clear():n.setTransform(1,0,0,-1,k,m);b=d.projectScene(R,ia,this.sortElements);(K=R.lights.length>0)&&La(R);Qa=0;for(ib=b.length;Qa<ib;Qa++){Ba=
b[Qa];E.empty();if(Ba instanceof THREE.RenderableParticle){C=Ba;C.x*=k;C.y*=m;Sa=0;for(Fa=Ba.materials.length;Sa<Fa;){va=Ba.materials[Sa++];va.opacity!=0&&eb(C,Ba,va,R)}}else if(Ba instanceof THREE.RenderableLine){C=Ba.v1;J=Ba.v2;C.positionScreen.x*=k;C.positionScreen.y*=m;J.positionScreen.x*=k;J.positionScreen.y*=m;E.addPoint(C.positionScreen.x,C.positionScreen.y);E.addPoint(J.positionScreen.x,J.positionScreen.y);if(o.instersects(E)){Sa=0;for(Fa=Ba.materials.length;Sa<Fa;){va=Ba.materials[Sa++];
va.opacity!=0&&Ta(C,J,Ba,va,R)}}}else if(Ba instanceof THREE.RenderableFace3){C=Ba.v1;J=Ba.v2;B=Ba.v3;C.positionScreen.x*=k;C.positionScreen.y*=m;J.positionScreen.x*=k;J.positionScreen.y*=m;B.positionScreen.x*=k;B.positionScreen.y*=m;if(Ba.overdraw){Na(C.positionScreen,J.positionScreen);Na(J.positionScreen,B.positionScreen);Na(B.positionScreen,C.positionScreen)}E.add3Points(C.positionScreen.x,C.positionScreen.y,J.positionScreen.x,J.positionScreen.y,B.positionScreen.x,B.positionScreen.y);if(o.instersects(E)){Sa=
0;for(Fa=Ba.meshMaterials.length;Sa<Fa;){va=Ba.meshMaterials[Sa++];if(va instanceof THREE.MeshFaceMaterial){Oa=0;for(Ja=Ba.faceMaterials.length;Oa<Ja;)(va=Ba.faceMaterials[Oa++])&&va.opacity!=0&&Ia(C,J,B,0,1,2,Ba,va,R)}else va.opacity!=0&&Ia(C,J,B,0,1,2,Ba,va,R)}}}else if(Ba instanceof THREE.RenderableFace4){C=Ba.v1;J=Ba.v2;B=Ba.v3;U=Ba.v4;C.positionScreen.x*=k;C.positionScreen.y*=m;J.positionScreen.x*=k;J.positionScreen.y*=m;B.positionScreen.x*=k;B.positionScreen.y*=m;U.positionScreen.x*=k;U.positionScreen.y*=
m;P.positionScreen.copy(J.positionScreen);O.positionScreen.copy(U.positionScreen);if(Ba.overdraw){Na(C.positionScreen,J.positionScreen);Na(J.positionScreen,U.positionScreen);Na(U.positionScreen,C.positionScreen);Na(B.positionScreen,P.positionScreen);Na(B.positionScreen,O.positionScreen)}E.addPoint(C.positionScreen.x,C.positionScreen.y);E.addPoint(J.positionScreen.x,J.positionScreen.y);E.addPoint(B.positionScreen.x,B.positionScreen.y);E.addPoint(U.positionScreen.x,U.positionScreen.y);if(o.instersects(E)){Sa=
0;for(Fa=Ba.meshMaterials.length;Sa<Fa;){va=Ba.meshMaterials[Sa++];if(va instanceof THREE.MeshFaceMaterial){Oa=0;for(Ja=Ba.faceMaterials.length;Oa<Ja;)(va=Ba.faceMaterials[Oa++])&&va.opacity!=0&&Ra(C,J,B,U,P,O,Ba,va,R)}else va.opacity!=0&&Ra(C,J,B,U,P,O,Ba,va,R)}}}y.addRectangle(E)}n.setTransform(1,0,0,1,0,0)}};
THREE.SVGRenderer=function(){function a(ka,oa,ma){var ca,S,M,fa;ca=0;for(S=ka.lights.length;ca<S;ca++){M=ka.lights[ca];if(M instanceof THREE.DirectionalLight){fa=oa.normalWorld.dot(M.position)*M.intensity;if(fa>0){ma.r+=M.color.r*fa;ma.g+=M.color.g*fa;ma.b+=M.color.b*fa}}else if(M instanceof THREE.PointLight){e.sub(M.position,oa.centroidWorld);e.normalize();fa=oa.normalWorld.dot(e)*M.intensity;if(fa>0){ma.r+=M.color.r*fa;ma.g+=M.color.g*fa;ma.b+=M.color.b*fa}}}}function c(ka,oa,ma,ca,S,M){W=d(wa++);
W.setAttribute("d","M "+ka.positionScreen.x+" "+ka.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)B.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(J){U.r=P.r;U.g=P.g;U.b=P.b;a(M,ca,U);B.r=S.color.r*U.r;B.g=S.color.g*U.g;B.b=S.color.b*U.b;B.updateStyleString()}else B.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){Y=
1-S.__2near/(S.__farPlusNear-ca.z*S.__farMinusNear);B.setRGB(Y,Y,Y)}else S instanceof THREE.MeshNormalMaterial&&B.setRGB(f(ca.normalWorld.x),f(ca.normalWorld.y),f(ca.normalWorld.z));S.wireframe?W.setAttribute("style","fill: none; stroke: "+B.__styleString+"; stroke-width: "+S.wireframeLinewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframeLinecap+"; stroke-linejoin: "+S.wireframeLinejoin):W.setAttribute("style","fill: "+B.__styleString+"; fill-opacity: "+S.opacity);k.appendChild(W)}
function b(ka,oa,ma,ca,S,M,fa){W=d(wa++);W.setAttribute("d","M "+ka.positionScreen.x+" "+ka.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)B.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(J){U.r=P.r;U.g=P.g;U.b=P.b;a(fa,S,U);B.r=M.color.r*U.r;B.g=M.color.g*U.g;B.b=M.color.b*U.b;B.updateStyleString()}else B.__styleString=
M.color.__styleString;else if(M instanceof THREE.MeshDepthMaterial){Y=1-M.__2near/(M.__farPlusNear-S.z*M.__farMinusNear);B.setRGB(Y,Y,Y)}else M instanceof THREE.MeshNormalMaterial&&B.setRGB(f(S.normalWorld.x),f(S.normalWorld.y),f(S.normalWorld.z));M.wireframe?W.setAttribute("style","fill: none; stroke: "+B.__styleString+"; stroke-width: "+M.wireframeLinewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframeLinecap+"; stroke-linejoin: "+M.wireframeLinejoin):W.setAttribute("style","fill: "+
B.__styleString+"; fill-opacity: "+M.opacity);k.appendChild(W)}function d(ka){if(ja[ka]==null){ja[ka]=document.createElementNS("http://www.w3.org/2000/svg","path");Aa==0&&ja[ka].setAttribute("shape-rendering","crispEdges")}return ja[ka]}function f(ka){return ka<0?Math.min((1+ka)*0.5,0.5):0.5+Math.min(ka*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,n,q,x,z,p,A,G,I=new THREE.Rectangle,C=new THREE.Rectangle,J=!1,B=new THREE.Color(16777215),
U=new THREE.Color(16777215),P=new THREE.Color(0),O=new THREE.Color(0),V=new THREE.Color(0),Y,e=new THREE.Vector3,ja=[],X=[],W,wa,ha,Aa=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(ka){switch(ka){case "high":Aa=1;break;case "low":Aa=0}};this.setSize=function(ka,oa){m=ka;n=oa;q=m/2;x=n/2;k.setAttribute("viewBox",-q+" "+-x+" "+m+" "+n);k.setAttribute("width",m);k.setAttribute("height",n);I.set(-q,-x,q,x)};this.clear=function(){for(;k.childNodes.length>
0;)k.removeChild(k.childNodes[0])};this.render=function(ka,oa){var ma,ca,S,M,fa,ra,la,qa;this.autoClear&&this.clear();g=h.projectScene(ka,oa,this.sortElements);ha=wa=0;if(J=ka.lights.length>0){la=ka.lights;P.setRGB(0,0,0);O.setRGB(0,0,0);V.setRGB(0,0,0);ma=0;for(ca=la.length;ma<ca;ma++){S=la[ma];M=S.color;if(S instanceof THREE.AmbientLight){P.r+=M.r;P.g+=M.g;P.b+=M.b}else if(S instanceof THREE.DirectionalLight){O.r+=M.r;O.g+=M.g;O.b+=M.b}else if(S instanceof THREE.PointLight){V.r+=M.r;V.g+=M.g;V.b+=
M.b}}}ma=0;for(ca=g.length;ma<ca;ma++){la=g[ma];C.empty();if(la instanceof THREE.RenderableParticle){z=la;z.x*=q;z.y*=-x;S=0;for(M=la.materials.length;S<M;)S++}else if(la instanceof THREE.RenderableLine){z=la.v1;p=la.v2;z.positionScreen.x*=q;z.positionScreen.y*=-x;p.positionScreen.x*=q;p.positionScreen.y*=-x;C.addPoint(z.positionScreen.x,z.positionScreen.y);C.addPoint(p.positionScreen.x,p.positionScreen.y);if(I.instersects(C)){S=0;for(M=la.materials.length;S<M;)if((qa=la.materials[S++])&&qa.opacity!=
0){fa=z;ra=p;var xa=ha++;if(X[xa]==null){X[xa]=document.createElementNS("http://www.w3.org/2000/svg","line");Aa==0&&X[xa].setAttribute("shape-rendering","crispEdges")}W=X[xa];W.setAttribute("x1",fa.positionScreen.x);W.setAttribute("y1",fa.positionScreen.y);W.setAttribute("x2",ra.positionScreen.x);W.setAttribute("y2",ra.positionScreen.y);if(qa instanceof THREE.LineBasicMaterial){B.__styleString=qa.color.__styleString;W.setAttribute("style","fill: none; stroke: "+B.__styleString+"; stroke-width: "+
qa.linewidth+"; stroke-opacity: "+qa.opacity+"; stroke-linecap: "+qa.linecap+"; stroke-linejoin: "+qa.linejoin);k.appendChild(W)}}}}else if(la instanceof THREE.RenderableFace3){z=la.v1;p=la.v2;A=la.v3;z.positionScreen.x*=q;z.positionScreen.y*=-x;p.positionScreen.x*=q;p.positionScreen.y*=-x;A.positionScreen.x*=q;A.positionScreen.y*=-x;C.addPoint(z.positionScreen.x,z.positionScreen.y);C.addPoint(p.positionScreen.x,p.positionScreen.y);C.addPoint(A.positionScreen.x,A.positionScreen.y);if(I.instersects(C)){S=
0;for(M=la.meshMaterials.length;S<M;){qa=la.meshMaterials[S++];if(qa instanceof THREE.MeshFaceMaterial){fa=0;for(ra=la.faceMaterials.length;fa<ra;)(qa=la.faceMaterials[fa++])&&qa.opacity!=0&&c(z,p,A,la,qa,ka)}else qa&&qa.opacity!=0&&c(z,p,A,la,qa,ka)}}}else if(la instanceof THREE.RenderableFace4){z=la.v1;p=la.v2;A=la.v3;G=la.v4;z.positionScreen.x*=q;z.positionScreen.y*=-x;p.positionScreen.x*=q;p.positionScreen.y*=-x;A.positionScreen.x*=q;A.positionScreen.y*=-x;G.positionScreen.x*=q;G.positionScreen.y*=
-x;C.addPoint(z.positionScreen.x,z.positionScreen.y);C.addPoint(p.positionScreen.x,p.positionScreen.y);C.addPoint(A.positionScreen.x,A.positionScreen.y);C.addPoint(G.positionScreen.x,G.positionScreen.y);if(I.instersects(C)){S=0;for(M=la.meshMaterials.length;S<M;){qa=la.meshMaterials[S++];if(qa instanceof THREE.MeshFaceMaterial){fa=0;for(ra=la.faceMaterials.length;fa<ra;)(qa=la.faceMaterials[fa++])&&qa.opacity!=0&&b(z,p,A,G,la,qa,ka)}else qa&&qa.opacity!=0&&b(z,p,A,G,la,qa,ka)}}}}}};
THREE.Projector=function(){function a(){var X=m[k]=m[k]||new THREE.RenderableVertex;k++;return X}function c(X,V){return V.z-X.z}function b(X,V){var va=0,ga=1,za=X.z+X.w,la=V.z+V.w,oa=-X.z+X.w,ma=-V.z+V.w;if(za>=0&&la>=0&&oa>=0&&ma>=0)return!0;else if(za<0&&la<0||oa<0&&ma<0)return!1;else{if(za<0)va=Math.max(va,za/(za-la));else la<0&&(ga=Math.min(ga,za/(za-la)));if(oa<0)va=Math.max(va,oa/(oa-ma));else ma<0&&(ga=Math.min(ga,oa/(oa-ma)));if(ga<va)return!1;else{X.lerpSelf(V,va);V.lerpSelf(X,1-ga);return!0}}}
var e,f,g=[],h,k,m=[],n,p,x=[],y,o=[],A,G,J=[],D,K,C=[],U=new THREE.Vector4,P=new THREE.Vector4,O=new THREE.Matrix4,W=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],d=new THREE.Vector4,ja=new THREE.Vector4;this.projectVector=function(X,V){O.multiply(V.projectionMatrix,V.matrixWorldInverse);O.multiplyVector3(X);return X};this.unprojectVector=function(X,V){O.multiply(V.matrixWorld,THREE.Matrix4.makeInvert(V.projectionMatrix));
O.multiplyVector3(X);return X};this.projectObjects=function(X,V,va){V=[];var ga,za,la;f=0;za=X.objects;X=0;for(ga=za.length;X<ga;X++){la=za[X];var oa;if(!(oa=!la.visible))if(oa=la instanceof THREE.Mesh){a:{oa=void 0;for(var ma=la.matrixWorld,ca=-la.geometry.boundingSphere.radius*Math.max(la.scale.x,Math.max(la.scale.y,la.scale.z)),S=0;S<6;S++){oa=Y[S].x*ma.n14+Y[S].y*ma.n24+Y[S].z*ma.n34+Y[S].w;if(oa<=ca){oa=!1;break a}}oa=!0}oa=!oa}if(!oa){oa=g[f]=g[f]||new THREE.RenderableObject;f++;e=oa;U.copy(la.position);
O.multiplyVector3(U);e.object=la;e.z=U.z;V.push(e)}}va&&V.sort(c);return V};this.projectScene=function(X,V,va){var ga=[],za=V.near,la=V.far,oa,ma,ca,S,M,fa,ra,ka,qa,wa,Ca,Za,$a,Ha,j,t,w;K=G=y=p=0;V.matrixAutoUpdate&&V.updateMatrix();X.update(undefined,!1,V);O.multiply(V.projectionMatrix,V.matrixWorldInverse);Y[0].set(O.n41-O.n11,O.n42-O.n12,O.n43-O.n13,O.n44-O.n14);Y[1].set(O.n41+O.n11,O.n42+O.n12,O.n43+O.n13,O.n44+O.n14);Y[2].set(O.n41+O.n21,O.n42+O.n22,O.n43+O.n23,O.n44+O.n24);Y[3].set(O.n41-O.n21,
O.n42-O.n22,O.n43-O.n23,O.n44-O.n24);Y[4].set(O.n41-O.n31,O.n42-O.n32,O.n43-O.n33,O.n44-O.n34);Y[5].set(O.n41+O.n31,O.n42+O.n32,O.n43+O.n33,O.n44+O.n34);for(oa=0;oa<6;oa++){qa=Y[oa];qa.divideScalar(Math.sqrt(qa.x*qa.x+qa.y*qa.y+qa.z*qa.z))}qa=this.projectObjects(X,V,!0);X=0;for(oa=qa.length;X<oa;X++){wa=qa[X].object;if(wa.visible){Ca=wa.matrixWorld;Za=wa.matrixRotationWorld;$a=wa.materials;Ha=wa.overdraw;k=0;if(wa instanceof THREE.Mesh){j=wa.geometry;S=j.vertices;t=j.faces;j=j.faceVertexUvs;ma=0;
for(ca=S.length;ma<ca;ma++){h=a();h.positionWorld.copy(S[ma].position);Ca.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>za&&h.positionScreen.z<la}S=0;for(ma=t.length;S<ma;S++){ca=t[S];if(ca instanceof THREE.Face3){M=m[ca.a];fa=m[ca.b];ra=m[ca.c];if(M.visible&&fa.visible&&ra.visible&&(wa.doubleSided||wa.flipSided!=(ra.positionScreen.x-
M.positionScreen.x)*(fa.positionScreen.y-M.positionScreen.y)-(ra.positionScreen.y-M.positionScreen.y)*(fa.positionScreen.x-M.positionScreen.x)<0)){ka=x[p]=x[p]||new THREE.RenderableFace3;p++;n=ka;n.v1.copy(M);n.v2.copy(fa);n.v3.copy(ra)}else continue}else if(ca instanceof THREE.Face4){M=m[ca.a];fa=m[ca.b];ra=m[ca.c];ka=m[ca.d];if(M.visible&&fa.visible&&ra.visible&&ka.visible&&(wa.doubleSided||wa.flipSided!=((ka.positionScreen.x-M.positionScreen.x)*(fa.positionScreen.y-M.positionScreen.y)-(ka.positionScreen.y-
M.positionScreen.y)*(fa.positionScreen.x-M.positionScreen.x)<0||(fa.positionScreen.x-ra.positionScreen.x)*(ka.positionScreen.y-ra.positionScreen.y)-(fa.positionScreen.y-ra.positionScreen.y)*(ka.positionScreen.x-ra.positionScreen.x)<0))){w=o[y]=o[y]||new THREE.RenderableFace4;y++;n=w;n.v1.copy(M);n.v2.copy(fa);n.v3.copy(ra);n.v4.copy(ka)}else continue}n.normalWorld.copy(ca.normal);Za.multiplyVector3(n.normalWorld);n.centroidWorld.copy(ca.centroid);Ca.multiplyVector3(n.centroidWorld);n.centroidScreen.copy(n.centroidWorld);
O.multiplyVector3(n.centroidScreen);ra=ca.vertexNormals;M=0;for(fa=ra.length;M<fa;M++){ka=n.vertexNormalsWorld[M];ka.copy(ra[M]);Za.multiplyVector3(ka)}M=0;for(fa=j.length;M<fa;M++)if(w=j[M][S]){ra=0;for(ka=w.length;ra<ka;ra++)n.uvs[M][ra]=w[ra]}n.meshMaterials=$a;n.faceMaterials=ca.materials;n.overdraw=Ha;n.z=n.centroidScreen.z;ga.push(n)}}else if(wa instanceof THREE.Line){W.multiply(O,Ca);S=wa.geometry.vertices;M=a();M.positionScreen.copy(S[0].position);W.multiplyVector4(M.positionScreen);ma=1;
for(ca=S.length;ma<ca;ma++){M=a();M.positionScreen.copy(S[ma].position);W.multiplyVector4(M.positionScreen);fa=m[k-2];d.copy(M.positionScreen);ja.copy(fa.positionScreen);if(b(d,ja)){d.multiplyScalar(1/d.w);ja.multiplyScalar(1/ja.w);Ca=J[G]=J[G]||new THREE.RenderableLine;G++;A=Ca;A.v1.positionScreen.copy(d);A.v2.positionScreen.copy(ja);A.z=Math.max(d.z,ja.z);A.materials=wa.materials;ga.push(A)}}}else if(wa instanceof THREE.Particle){P.set(wa.position.x,wa.position.y,wa.position.z,1);O.multiplyVector4(P);
P.z/=P.w;if(P.z>0&&P.z<1){Ca=C[K]=C[K]||new THREE.RenderableParticle;K++;D=Ca;D.x=P.x/P.w;D.y=P.y/P.w;D.z=P.z;D.rotation=wa.rotation.z;D.scale.x=wa.scale.x*Math.abs(D.x-(P.x+V.projectionMatrix.n11)/(P.w+V.projectionMatrix.n14));D.scale.y=wa.scale.y*Math.abs(D.y-(P.y+V.projectionMatrix.n22)/(P.w+V.projectionMatrix.n24));D.materials=wa.materials;ga.push(D)}}}}va&&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,k){b=h;e=k;f=b/2;g=e/2};this.render=function(h,k){var m,n,p,x,y,o,A,G;a=c.projectScene(h,k);m=0;for(n=a.length;m<n;m++){y=a[m];if(y instanceof THREE.RenderableParticle){A=y.x*f+f;G=y.y*g+g;p=0;for(x=y.material.length;p<x;p++){o=y.material[p];if(o instanceof THREE.ParticleDOMMaterial){o=o.domElement;o.style.left=A+"px";o.style.top=G+"px"}}}}}};
THREE.CanvasRenderer=function(){function a(R){if(y!=R)n.globalAlpha=y=R}function c(R){if(o!=R){switch(R){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}o=R}}var b=null,e=new THREE.Projector,f=document.createElement("canvas"),g,h,k,m,n=f.getContext("2d"),p=new THREE.Color(0),x=0,y=1,o=0,A=null,G=null,J=1,D,K,C,U,P=new THREE.RenderableVertex,
O=new THREE.RenderableVertex,W,Y,d,ja,X,V,va,ga,za,la,oa,ma,ca=new THREE.Color,S=new THREE.Color,M=new THREE.Color,fa=new THREE.Color,ra=new THREE.Color,ka,qa,wa,Ca,Za,$a,Ha,j,t,w,q=new THREE.Rectangle,B=new THREE.Rectangle,F=new THREE.Rectangle,H=!1,E=new THREE.Color,z=new THREE.Color,T=new THREE.Color,I=new THREE.Color,Q=new THREE.Vector3,ha,pa,sa,Aa,xa,Ea,da=16;ha=document.createElement("canvas");ha.width=ha.height=2;pa=ha.getContext("2d");pa.fillStyle="rgba(0,0,0,1)";pa.fillRect(0,0,2,2);sa=pa.getImageData(0,
0,2,2);Aa=sa.data;xa=document.createElement("canvas");xa.width=xa.height=da;Ea=xa.getContext("2d");Ea.translate(-da/2,-da/2);Ea.scale(da,da);da--;this.domElement=f;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(R,ia){g=R;h=ia;k=g/2;m=h/2;f.width=g;f.height=h;q.set(-k,-m,k,m);y=1;o=0;G=A=null;J=1};this.setClearColor=function(R,ia){p=R;x=ia};this.setClearColorHex=function(R,ia){p.setHex(R);x=ia};this.clear=function(){n.setTransform(1,0,0,-1,k,m);if(!B.isEmpty()){B.inflate(1);
B.minSelf(q);if(p.hex==0&&x==0)n.clearRect(B.getX(),B.getY(),B.getWidth(),B.getHeight());else{c(THREE.NormalBlending);a(1);n.fillStyle="rgba("+Math.floor(p.r*255)+","+Math.floor(p.g*255)+","+Math.floor(p.b*255)+","+x+")";n.fillRect(B.getX(),B.getY(),B.getWidth(),B.getHeight())}B.empty()}};this.render=function(R,ia){function La(L){var Z,na,aa,ta=L.lights;z.setRGB(0,0,0);T.setRGB(0,0,0);I.setRGB(0,0,0);L=0;for(Z=ta.length;L<Z;L++){na=ta[L];aa=na.color;if(na instanceof THREE.AmbientLight){z.r+=aa.r;
z.g+=aa.g;z.b+=aa.b}else if(na instanceof THREE.DirectionalLight){T.r+=aa.r;T.g+=aa.g;T.b+=aa.b}else if(na instanceof THREE.PointLight){I.r+=aa.r;I.g+=aa.g;I.b+=aa.b}}}function Ga(L,Z,na,aa){var ta,ya,ea,$,Ka=L.lights;L=0;for(ta=Ka.length;L<ta;L++){ya=Ka[L];ea=ya.color;$=ya.intensity;if(ya instanceof THREE.DirectionalLight){ya=na.dot(ya.position)*$;if(ya>0){aa.r+=ea.r*ya;aa.g+=ea.g*ya;aa.b+=ea.b*ya}}else if(ya instanceof THREE.PointLight){Q.sub(ya.position,Z);Q.normalize();ya=na.dot(Q)*$;if(ya>0){aa.r+=
ea.r*ya;aa.g+=ea.g*ya;aa.b+=ea.b*ya}}}}function eb(L,Z,na){a(na.opacity);c(na.blending);var aa,ta,ya,ea,$,Ka;if(na instanceof THREE.ParticleBasicMaterial){if(na.map){ea=na.map.image;$=ea.width>>1;Ka=ea.height>>1;na=Z.scale.x*k;ya=Z.scale.y*m;aa=na*$;ta=ya*Ka;F.set(L.x-aa,L.y-ta,L.x+aa,L.y+ta);if(q.instersects(F)){n.save();n.translate(L.x,L.y);n.rotate(-Z.rotation);n.scale(na,-ya);n.translate(-$,-Ka);n.drawImage(ea,0,0);n.restore()}}}else if(na instanceof THREE.ParticleCanvasMaterial){if(H){E.r=z.r+
T.r+I.r;E.g=z.g+T.g+I.g;E.b=z.b+T.b+I.b;ca.r=na.color.r*E.r;ca.g=na.color.g*E.g;ca.b=na.color.b*E.b;ca.updateStyleString()}else ca.__styleString=na.color.__styleString;aa=Z.scale.x*k;ta=Z.scale.y*m;F.set(L.x-aa,L.y-ta,L.x+aa,L.y+ta);if(q.instersects(F)){n.save();n.translate(L.x,L.y);n.rotate(-Z.rotation);n.scale(aa,ta);na.program(n,ca);n.restore()}}}function Ta(L,Z,na,aa){a(aa.opacity);c(aa.blending);n.beginPath();n.moveTo(L.positionScreen.x,L.positionScreen.y);n.lineTo(Z.positionScreen.x,Z.positionScreen.y);
n.closePath();if(aa instanceof THREE.LineBasicMaterial){ca.__styleString=aa.color.__styleString;L=aa.linewidth;if(J!=L)n.lineWidth=J=L;L=ca.__styleString;if(A!=L)n.strokeStyle=A=L;n.stroke();F.inflate(aa.linewidth*2)}}function Ia(L,Z,na,aa,ta,ya,ea,$,Ka){a($.opacity);c($.blending);W=L.positionScreen.x;Y=L.positionScreen.y;d=Z.positionScreen.x;ja=Z.positionScreen.y;X=na.positionScreen.x;V=na.positionScreen.y;bb(W,Y,d,ja,X,V);if($ instanceof THREE.MeshBasicMaterial)if($.map){if($.map.mapping instanceof
THREE.UVMapping){Ca=ea.uvs[0];Da(W,Y,d,ja,X,V,$.map.image,Ca[aa].u,Ca[aa].v,Ca[ta].u,Ca[ta].v,Ca[ya].u,Ca[ya].v)}}else if($.envMap){if($.envMap.mapping instanceof THREE.SphericalReflectionMapping){L=ia.matrixWorldInverse;Q.copy(ea.vertexNormalsWorld[0]);Za=(Q.x*L.n11+Q.y*L.n12+Q.z*L.n13)*0.5+0.5;$a=-(Q.x*L.n21+Q.y*L.n22+Q.z*L.n23)*0.5+0.5;Q.copy(ea.vertexNormalsWorld[1]);Ha=(Q.x*L.n11+Q.y*L.n12+Q.z*L.n13)*0.5+0.5;j=-(Q.x*L.n21+Q.y*L.n22+Q.z*L.n23)*0.5+0.5;Q.copy(ea.vertexNormalsWorld[2]);t=(Q.x*L.n11+
Q.y*L.n12+Q.z*L.n13)*0.5+0.5;w=-(Q.x*L.n21+Q.y*L.n22+Q.z*L.n23)*0.5+0.5;Da(W,Y,d,ja,X,V,$.envMap.image,Za,$a,Ha,j,t,w)}}else $.wireframe?Pa($.color.__styleString,$.wireframeLinewidth):Ua($.color.__styleString);else if($ instanceof THREE.MeshLambertMaterial){if($.map&&!$.wireframe){if($.map.mapping instanceof THREE.UVMapping){Ca=ea.uvs[0];Da(W,Y,d,ja,X,V,$.map.image,Ca[aa].u,Ca[aa].v,Ca[ta].u,Ca[ta].v,Ca[ya].u,Ca[ya].v)}c(THREE.SubtractiveBlending)}if(H)if(!$.wireframe&&$.shading==THREE.SmoothShading&&
ea.vertexNormalsWorld.length==3){S.r=M.r=fa.r=z.r;S.g=M.g=fa.g=z.g;S.b=M.b=fa.b=z.b;Ga(Ka,ea.v1.positionWorld,ea.vertexNormalsWorld[0],S);Ga(Ka,ea.v2.positionWorld,ea.vertexNormalsWorld[1],M);Ga(Ka,ea.v3.positionWorld,ea.vertexNormalsWorld[2],fa);ra.r=(M.r+fa.r)*0.5;ra.g=(M.g+fa.g)*0.5;ra.b=(M.b+fa.b)*0.5;wa=Va(S,M,fa,ra);Da(W,Y,d,ja,X,V,wa,0,0,1,0,0,1)}else{E.r=z.r;E.g=z.g;E.b=z.b;Ga(Ka,ea.centroidWorld,ea.normalWorld,E);ca.r=$.color.r*E.r;ca.g=$.color.g*E.g;ca.b=$.color.b*E.b;ca.updateStyleString();
$.wireframe?Pa(ca.__styleString,$.wireframeLinewidth):Ua(ca.__styleString)}else $.wireframe?Pa($.color.__styleString,$.wireframeLinewidth):Ua($.color.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){ka=ia.near;qa=ia.far;S.r=S.g=S.b=1-Ma(L.positionScreen.z,ka,qa);M.r=M.g=M.b=1-Ma(Z.positionScreen.z,ka,qa);fa.r=fa.g=fa.b=1-Ma(na.positionScreen.z,ka,qa);ra.r=(M.r+fa.r)*0.5;ra.g=(M.g+fa.g)*0.5;ra.b=(M.b+fa.b)*0.5;wa=Va(S,M,fa,ra);Da(W,Y,d,ja,X,V,wa,0,0,1,0,0,1)}else if($ instanceof THREE.MeshNormalMaterial){ca.r=
N(ea.normalWorld.x);ca.g=N(ea.normalWorld.y);ca.b=N(ea.normalWorld.z);ca.updateStyleString();$.wireframe?Pa(ca.__styleString,$.wireframeLinewidth):Ua(ca.__styleString)}}function Ra(L,Z,na,aa,ta,ya,ea,$,Ka){a($.opacity);c($.blending);if($.map||$.envMap){Ia(L,Z,aa,0,1,3,ea,$,Ka);Ia(ta,na,ya,1,2,3,ea,$,Ka)}else{W=L.positionScreen.x;Y=L.positionScreen.y;d=Z.positionScreen.x;ja=Z.positionScreen.y;X=na.positionScreen.x;V=na.positionScreen.y;va=aa.positionScreen.x;ga=aa.positionScreen.y;za=ta.positionScreen.x;
la=ta.positionScreen.y;oa=ya.positionScreen.x;ma=ya.positionScreen.y;if($ instanceof THREE.MeshBasicMaterial){db(W,Y,d,ja,X,V,va,ga);$.wireframe?Pa($.color.__styleString,$.wireframeLinewidth):Ua($.color.__styleString)}else if($ instanceof THREE.MeshLambertMaterial)if(H)if(!$.wireframe&&$.shading==THREE.SmoothShading&&ea.vertexNormalsWorld.length==4){S.r=M.r=fa.r=ra.r=z.r;S.g=M.g=fa.g=ra.g=z.g;S.b=M.b=fa.b=ra.b=z.b;Ga(Ka,ea.v1.positionWorld,ea.vertexNormalsWorld[0],S);Ga(Ka,ea.v2.positionWorld,ea.vertexNormalsWorld[1],
M);Ga(Ka,ea.v4.positionWorld,ea.vertexNormalsWorld[3],fa);Ga(Ka,ea.v3.positionWorld,ea.vertexNormalsWorld[2],ra);wa=Va(S,M,fa,ra);bb(W,Y,d,ja,va,ga);Da(W,Y,d,ja,va,ga,wa,0,0,1,0,0,1);bb(za,la,X,V,oa,ma);Da(za,la,X,V,oa,ma,wa,1,0,1,1,0,1)}else{E.r=z.r;E.g=z.g;E.b=z.b;Ga(Ka,ea.centroidWorld,ea.normalWorld,E);ca.r=$.color.r*E.r;ca.g=$.color.g*E.g;ca.b=$.color.b*E.b;ca.updateStyleString();db(W,Y,d,ja,X,V,va,ga);$.wireframe?Pa(ca.__styleString,$.wireframeLinewidth):Ua(ca.__styleString)}else{db(W,Y,d,ja,
X,V,va,ga);$.wireframe?Pa($.color.__styleString,$.wireframeLinewidth):Ua($.color.__styleString)}else if($ instanceof THREE.MeshNormalMaterial){ca.r=N(ea.normalWorld.x);ca.g=N(ea.normalWorld.y);ca.b=N(ea.normalWorld.z);ca.updateStyleString();db(W,Y,d,ja,X,V,va,ga);$.wireframe?Pa(ca.__styleString,$.wireframeLinewidth):Ua(ca.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){ka=ia.near;qa=ia.far;S.r=S.g=S.b=1-Ma(L.positionScreen.z,ka,qa);M.r=M.g=M.b=1-Ma(Z.positionScreen.z,ka,qa);fa.r=fa.g=
fa.b=1-Ma(aa.positionScreen.z,ka,qa);ra.r=ra.g=ra.b=1-Ma(na.positionScreen.z,ka,qa);wa=Va(S,M,fa,ra);bb(W,Y,d,ja,va,ga);Da(W,Y,d,ja,va,ga,wa,0,0,1,0,0,1);bb(za,la,X,V,oa,ma);Da(za,la,X,V,oa,ma,wa,1,0,1,1,0,1)}}}function bb(L,Z,na,aa,ta,ya){n.beginPath();n.moveTo(L,Z);n.lineTo(na,aa);n.lineTo(ta,ya);n.lineTo(L,Z);n.closePath()}function db(L,Z,na,aa,ta,ya,ea,$){n.beginPath();n.moveTo(L,Z);n.lineTo(na,aa);n.lineTo(ta,ya);n.lineTo(ea,$);n.lineTo(L,Z);n.closePath()}function Pa(L,Z){if(A!=L)n.strokeStyle=
A=L;if(J!=Z)n.lineWidth=J=Z;n.stroke();F.inflate(Z*2)}function Ua(L){if(G!=L)n.fillStyle=G=L;n.fill()}function Da(L,Z,na,aa,ta,ya,ea,$,Ka,Xa,Ya,cb,gb){var ab,Wa;ab=ea.width-1;Wa=ea.height-1;$*=ab;Ka*=Wa;Xa*=ab;Ya*=Wa;cb*=ab;gb*=Wa;na-=L;aa-=Z;ta-=L;ya-=Z;Xa-=$;Ya-=Ka;cb-=$;gb-=Ka;ab=Xa*gb-cb*Ya;if(ab!=0){Wa=1/ab;ab=(gb*na-Ya*ta)*Wa;Ya=(gb*aa-Ya*ya)*Wa;na=(Xa*ta-cb*na)*Wa;aa=(Xa*ya-cb*aa)*Wa;L=L-ab*$-na*Ka;Z=Z-Ya*$-aa*Ka;n.save();n.transform(ab,Ya,na,aa,L,Z);n.clip();n.drawImage(ea,0,0);n.restore()}}
function Va(L,Z,na,aa){var ta=~~(L.r*255),ya=~~(L.g*255);L=~~(L.b*255);var ea=~~(Z.r*255),$=~~(Z.g*255);Z=~~(Z.b*255);var Ka=~~(na.r*255),Xa=~~(na.g*255);na=~~(na.b*255);var Ya=~~(aa.r*255),cb=~~(aa.g*255);aa=~~(aa.b*255);Aa[0]=ta<0?0:ta>255?255:ta;Aa[1]=ya<0?0:ya>255?255:ya;Aa[2]=L<0?0:L>255?255:L;Aa[4]=ea<0?0:ea>255?255:ea;Aa[5]=$<0?0:$>255?255:$;Aa[6]=Z<0?0:Z>255?255:Z;Aa[8]=Ka<0?0:Ka>255?255:Ka;Aa[9]=Xa<0?0:Xa>255?255:Xa;Aa[10]=na<0?0:na>255?255:na;Aa[12]=Ya<0?0:Ya>255?255:Ya;Aa[13]=cb<0?0:cb>
255?255:cb;Aa[14]=aa<0?0:aa>255?255:aa;pa.putImageData(sa,0,0);Ea.drawImage(ha,0,0);return xa}function Ma(L,Z,na){L=(L-Z)/(na-Z);return L*L*(3-2*L)}function N(L){L=(L+1)*0.5;return L<0?0:L>1?1:L}function Na(L,Z){var na=Z.x-L.x,aa=Z.y-L.y,ta=1/Math.sqrt(na*na+aa*aa);na*=ta;aa*=ta;Z.x+=na;Z.y+=aa;L.x-=na;L.y-=aa}var Qa,ib,Ba,Sa,Fa,Oa,Ja,ua;this.autoClear?this.clear():n.setTransform(1,0,0,-1,k,m);b=e.projectScene(R,ia,this.sortElements);(H=R.lights.length>0)&&La(R);Qa=0;for(ib=b.length;Qa<ib;Qa++){Ba=
b[Qa];F.empty();if(Ba instanceof THREE.RenderableParticle){D=Ba;D.x*=k;D.y*=m;Sa=0;for(Fa=Ba.materials.length;Sa<Fa;){ua=Ba.materials[Sa++];ua.opacity!=0&&eb(D,Ba,ua,R)}}else if(Ba instanceof THREE.RenderableLine){D=Ba.v1;K=Ba.v2;D.positionScreen.x*=k;D.positionScreen.y*=m;K.positionScreen.x*=k;K.positionScreen.y*=m;F.addPoint(D.positionScreen.x,D.positionScreen.y);F.addPoint(K.positionScreen.x,K.positionScreen.y);if(q.instersects(F)){Sa=0;for(Fa=Ba.materials.length;Sa<Fa;){ua=Ba.materials[Sa++];
ua.opacity!=0&&Ta(D,K,Ba,ua,R)}}}else if(Ba instanceof THREE.RenderableFace3){D=Ba.v1;K=Ba.v2;C=Ba.v3;D.positionScreen.x*=k;D.positionScreen.y*=m;K.positionScreen.x*=k;K.positionScreen.y*=m;C.positionScreen.x*=k;C.positionScreen.y*=m;if(Ba.overdraw){Na(D.positionScreen,K.positionScreen);Na(K.positionScreen,C.positionScreen);Na(C.positionScreen,D.positionScreen)}F.add3Points(D.positionScreen.x,D.positionScreen.y,K.positionScreen.x,K.positionScreen.y,C.positionScreen.x,C.positionScreen.y);if(q.instersects(F)){Sa=
0;for(Fa=Ba.meshMaterials.length;Sa<Fa;){ua=Ba.meshMaterials[Sa++];if(ua instanceof THREE.MeshFaceMaterial){Oa=0;for(Ja=Ba.faceMaterials.length;Oa<Ja;)(ua=Ba.faceMaterials[Oa++])&&ua.opacity!=0&&Ia(D,K,C,0,1,2,Ba,ua,R)}else ua.opacity!=0&&Ia(D,K,C,0,1,2,Ba,ua,R)}}}else if(Ba instanceof THREE.RenderableFace4){D=Ba.v1;K=Ba.v2;C=Ba.v3;U=Ba.v4;D.positionScreen.x*=k;D.positionScreen.y*=m;K.positionScreen.x*=k;K.positionScreen.y*=m;C.positionScreen.x*=k;C.positionScreen.y*=m;U.positionScreen.x*=k;U.positionScreen.y*=
m;P.positionScreen.copy(K.positionScreen);O.positionScreen.copy(U.positionScreen);if(Ba.overdraw){Na(D.positionScreen,K.positionScreen);Na(K.positionScreen,U.positionScreen);Na(U.positionScreen,D.positionScreen);Na(C.positionScreen,P.positionScreen);Na(C.positionScreen,O.positionScreen)}F.addPoint(D.positionScreen.x,D.positionScreen.y);F.addPoint(K.positionScreen.x,K.positionScreen.y);F.addPoint(C.positionScreen.x,C.positionScreen.y);F.addPoint(U.positionScreen.x,U.positionScreen.y);if(q.instersects(F)){Sa=
0;for(Fa=Ba.meshMaterials.length;Sa<Fa;){ua=Ba.meshMaterials[Sa++];if(ua instanceof THREE.MeshFaceMaterial){Oa=0;for(Ja=Ba.faceMaterials.length;Oa<Ja;)(ua=Ba.faceMaterials[Oa++])&&ua.opacity!=0&&Ra(D,K,C,U,P,O,Ba,ua,R)}else ua.opacity!=0&&Ra(D,K,C,U,P,O,Ba,ua,R)}}}B.addRectangle(F)}n.setTransform(1,0,0,1,0,0)}};
THREE.SVGRenderer=function(){function a(la,oa,ma){var ca,S,M,fa;ca=0;for(S=la.lights.length;ca<S;ca++){M=la.lights[ca];if(M instanceof THREE.DirectionalLight){fa=oa.normalWorld.dot(M.position)*M.intensity;if(fa>0){ma.r+=M.color.r*fa;ma.g+=M.color.g*fa;ma.b+=M.color.b*fa}}else if(M instanceof THREE.PointLight){d.sub(M.position,oa.centroidWorld);d.normalize();fa=oa.normalWorld.dot(d)*M.intensity;if(fa>0){ma.r+=M.color.r*fa;ma.g+=M.color.g*fa;ma.b+=M.color.b*fa}}}}function c(la,oa,ma,ca,S,M){V=e(va++);
V.setAttribute("d","M "+la.positionScreen.x+" "+la.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)C.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(K){U.r=P.r;U.g=P.g;U.b=P.b;a(M,ca,U);C.r=S.color.r*U.r;C.g=S.color.g*U.g;C.b=S.color.b*U.b;C.updateStyleString()}else C.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshDepthMaterial){Y=
1-S.__2near/(S.__farPlusNear-ca.z*S.__farMinusNear);C.setRGB(Y,Y,Y)}else S instanceof THREE.MeshNormalMaterial&&C.setRGB(f(ca.normalWorld.x),f(ca.normalWorld.y),f(ca.normalWorld.z));S.wireframe?V.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+S.wireframeLinewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframeLinecap+"; stroke-linejoin: "+S.wireframeLinejoin):V.setAttribute("style","fill: "+C.__styleString+"; fill-opacity: "+S.opacity);k.appendChild(V)}
function b(la,oa,ma,ca,S,M,fa){V=e(va++);V.setAttribute("d","M "+la.positionScreen.x+" "+la.positionScreen.y+" L "+oa.positionScreen.x+" "+oa.positionScreen.y+" L "+ma.positionScreen.x+","+ma.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)C.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(K){U.r=P.r;U.g=P.g;U.b=P.b;a(fa,S,U);C.r=M.color.r*U.r;C.g=M.color.g*U.g;C.b=M.color.b*U.b;C.updateStyleString()}else C.__styleString=
M.color.__styleString;else if(M instanceof THREE.MeshDepthMaterial){Y=1-M.__2near/(M.__farPlusNear-S.z*M.__farMinusNear);C.setRGB(Y,Y,Y)}else M instanceof THREE.MeshNormalMaterial&&C.setRGB(f(S.normalWorld.x),f(S.normalWorld.y),f(S.normalWorld.z));M.wireframe?V.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+M.wireframeLinewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframeLinecap+"; stroke-linejoin: "+M.wireframeLinejoin):V.setAttribute("style","fill: "+
C.__styleString+"; fill-opacity: "+M.opacity);k.appendChild(V)}function e(la){if(ja[la]==null){ja[la]=document.createElementNS("http://www.w3.org/2000/svg","path");za==0&&ja[la].setAttribute("shape-rendering","crispEdges")}return ja[la]}function f(la){return la<0?Math.min((1+la)*0.5,0.5):0.5+Math.min(la*0.5,0.5)}var g=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,n,p,x,y,o,A,G,J=new THREE.Rectangle,D=new THREE.Rectangle,K=!1,C=new THREE.Color(16777215),
U=new THREE.Color(16777215),P=new THREE.Color(0),O=new THREE.Color(0),W=new THREE.Color(0),Y,d=new THREE.Vector3,ja=[],X=[],V,va,ga,za=1;this.domElement=k;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(la){switch(la){case "high":za=1;break;case "low":za=0}};this.setSize=function(la,oa){m=la;n=oa;p=m/2;x=n/2;k.setAttribute("viewBox",-p+" "+-x+" "+m+" "+n);k.setAttribute("width",m);k.setAttribute("height",n);J.set(-p,-x,p,x)};this.clear=function(){for(;k.childNodes.length>
0;)k.removeChild(k.childNodes[0])};this.render=function(la,oa){var ma,ca,S,M,fa,ra,ka,qa;this.autoClear&&this.clear();g=h.projectScene(la,oa,this.sortElements);ga=va=0;if(K=la.lights.length>0){ka=la.lights;P.setRGB(0,0,0);O.setRGB(0,0,0);W.setRGB(0,0,0);ma=0;for(ca=ka.length;ma<ca;ma++){S=ka[ma];M=S.color;if(S instanceof THREE.AmbientLight){P.r+=M.r;P.g+=M.g;P.b+=M.b}else if(S instanceof THREE.DirectionalLight){O.r+=M.r;O.g+=M.g;O.b+=M.b}else if(S instanceof THREE.PointLight){W.r+=M.r;W.g+=M.g;W.b+=
M.b}}}ma=0;for(ca=g.length;ma<ca;ma++){ka=g[ma];D.empty();if(ka instanceof THREE.RenderableParticle){y=ka;y.x*=p;y.y*=-x;S=0;for(M=ka.materials.length;S<M;)S++}else if(ka instanceof THREE.RenderableLine){y=ka.v1;o=ka.v2;y.positionScreen.x*=p;y.positionScreen.y*=-x;o.positionScreen.x*=p;o.positionScreen.y*=-x;D.addPoint(y.positionScreen.x,y.positionScreen.y);D.addPoint(o.positionScreen.x,o.positionScreen.y);if(J.instersects(D)){S=0;for(M=ka.materials.length;S<M;)if((qa=ka.materials[S++])&&qa.opacity!=
0){fa=y;ra=o;var wa=ga++;if(X[wa]==null){X[wa]=document.createElementNS("http://www.w3.org/2000/svg","line");za==0&&X[wa].setAttribute("shape-rendering","crispEdges")}V=X[wa];V.setAttribute("x1",fa.positionScreen.x);V.setAttribute("y1",fa.positionScreen.y);V.setAttribute("x2",ra.positionScreen.x);V.setAttribute("y2",ra.positionScreen.y);if(qa instanceof THREE.LineBasicMaterial){C.__styleString=qa.color.__styleString;V.setAttribute("style","fill: none; stroke: "+C.__styleString+"; stroke-width: "+
qa.linewidth+"; stroke-opacity: "+qa.opacity+"; stroke-linecap: "+qa.linecap+"; stroke-linejoin: "+qa.linejoin);k.appendChild(V)}}}}else if(ka instanceof THREE.RenderableFace3){y=ka.v1;o=ka.v2;A=ka.v3;y.positionScreen.x*=p;y.positionScreen.y*=-x;o.positionScreen.x*=p;o.positionScreen.y*=-x;A.positionScreen.x*=p;A.positionScreen.y*=-x;D.addPoint(y.positionScreen.x,y.positionScreen.y);D.addPoint(o.positionScreen.x,o.positionScreen.y);D.addPoint(A.positionScreen.x,A.positionScreen.y);if(J.instersects(D)){S=
0;for(M=ka.meshMaterials.length;S<M;){qa=ka.meshMaterials[S++];if(qa instanceof THREE.MeshFaceMaterial){fa=0;for(ra=ka.faceMaterials.length;fa<ra;)(qa=ka.faceMaterials[fa++])&&qa.opacity!=0&&c(y,o,A,ka,qa,la)}else qa&&qa.opacity!=0&&c(y,o,A,ka,qa,la)}}}else if(ka instanceof THREE.RenderableFace4){y=ka.v1;o=ka.v2;A=ka.v3;G=ka.v4;y.positionScreen.x*=p;y.positionScreen.y*=-x;o.positionScreen.x*=p;o.positionScreen.y*=-x;A.positionScreen.x*=p;A.positionScreen.y*=-x;G.positionScreen.x*=p;G.positionScreen.y*=
-x;D.addPoint(y.positionScreen.x,y.positionScreen.y);D.addPoint(o.positionScreen.x,o.positionScreen.y);D.addPoint(A.positionScreen.x,A.positionScreen.y);D.addPoint(G.positionScreen.x,G.positionScreen.y);if(J.instersects(D)){S=0;for(M=ka.meshMaterials.length;S<M;){qa=ka.meshMaterials[S++];if(qa instanceof THREE.MeshFaceMaterial){fa=0;for(ra=ka.faceMaterials.length;fa<ra;)(qa=ka.faceMaterials[fa++])&&qa.opacity!=0&&b(y,o,A,G,ka,qa,la)}else qa&&qa.opacity!=0&&b(y,o,A,G,ka,qa,la)}}}}}};
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",
@@ -213,7 +213,7 @@ default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = pr
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f",
value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",
value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
THREE.ShaderLib={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() {\nvec3 pos = ( objectMatrix * vec4( position, 1.0 )).xyz;\nvec3 norm = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz) * normal;// normalMatrix * normal;\nvec4 final = vec4( pos + directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 1.0 );\ngl_Position = projectionMatrix * viewMatrix * final;\n}",fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},
THREE.ShaderLib={shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, 0.5 );\n}"},shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos = objectMatrix * vec4( position, 1.0 );\nvec3 norm = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position = projectionMatrix * viewMatrix * ( pos + extruded );\n}",fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},
depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},
fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,
THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,
@@ -225,109 +225,110 @@ 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(j,w,t){var o,y,E,K=j.vertices,F=K.length,D=j.colors,Q=D.length,H=j.__vertexArray,T=j.__colorArray,ga=j.__sortArray,pa=j.__dirtyVertices,sa=j.__dirtyColors;if(t.sortParticles){fa.multiplySelf(t.matrixWorld);for(o=0;o<F;o++){y=K[o].position;qa.copy(y);fa.multiplyVector3(qa);ga[o]=[qa.z,o]}ga.sort(function(ya,ua){return ua[0]-ya[0]});for(o=0;o<F;o++){y=K[ga[o][1]].position;E=o*3;H[E]=y.x;H[E+1]=y.y;H[E+2]=y.z}for(o=0;o<Q;o++){E=o*3;color=D[ga[o][1]];T[E]=color.r;
T[E+1]=color.g;T[E+2]=color.b}}else{if(pa)for(o=0;o<F;o++){y=K[o].position;E=o*3;H[E]=y.x;H[E+1]=y.y;H[E+2]=y.z}if(sa)for(o=0;o<Q;o++){color=D[o];E=o*3;T[E]=color.r;T[E+1]=color.g;T[E+2]=color.b}}if(pa||t.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,j.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,H,w)}if(sa||t.sortParticles){e.bindBuffer(e.ARRAY_BUFFER,j.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,T,w)}}function b(j,w){j.fragmentShader=w.fragmentShader;j.vertexShader=w.vertexShader;j.uniforms=
Uniforms.clone(w.uniforms)}function d(j,w,t,o,y){o.program||W.initMaterial(o,w,t,y);var E=o.program,K=E.uniforms,F=o.uniforms;if(E!=ja){e.useProgram(E);ja=E}e.uniformMatrix4fv(K.projectionMatrix,!1,ra);if(t&&(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial||o instanceof THREE.LineBasicMaterial||o instanceof THREE.ParticleBasicMaterial)){F.fogColor.value.setHex(t.color.hex);if(t instanceof THREE.Fog){F.fogNear.value=t.near;F.fogFar.value=
t.far}else if(t instanceof THREE.FogExp2)F.fogDensity.value=t.density}if(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o.lights){var D,Q,H=0,T=0,ga=0,pa,sa,ya,ua=xa,Ea=ua.directional.colors,da=ua.directional.positions,R=ua.point.colors,ia=ua.point.positions,La=0,Ga=0;t=Q=Q=0;for(D=w.length;t<D;t++){Q=w[t];pa=Q.color;sa=Q.position;ya=Q.intensity;if(Q instanceof THREE.AmbientLight){H+=pa.r;T+=pa.g;ga+=pa.b}else if(Q instanceof THREE.DirectionalLight){Q=La*3;Ea[Q]=pa.r*
ya;Ea[Q+1]=pa.g*ya;Ea[Q+2]=pa.b*ya;da[Q]=sa.x;da[Q+1]=sa.y;da[Q+2]=sa.z;La+=1}else if(Q instanceof THREE.PointLight){Q=Ga*3;R[Q]=pa.r*ya;R[Q+1]=pa.g*ya;R[Q+2]=pa.b*ya;ia[Q]=sa.x;ia[Q+1]=sa.y;ia[Q+2]=sa.z;Ga+=1}}for(t=La*3;t<Ea.length;t++)Ea[t]=0;for(t=Ga*3;t<R.length;t++)R[t]=0;ua.point.length=Ga;ua.directional.length=La;ua.ambient[0]=H;ua.ambient[1]=T;ua.ambient[2]=ga;t=xa;F.enableLighting.value=t.directional.length+t.point.length;F.ambientLightColor.value=t.ambient;F.directionalLightColor.value=
t.directional.colors;F.directionalLightDirection.value=t.directional.positions;F.pointLightColor.value=t.point.colors;F.pointLightPosition.value=t.point.positions}if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial){F.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity;F.map.texture=o.map;F.lightMap.texture=o.lightMap;F.envMap.texture=o.envMap;F.reflectivity.value=o.reflectivity;
F.refractionRatio.value=o.refractionRatio;F.combine.value=o.combine;F.useRefract.value=o.envMap&&o.envMap.mapping instanceof THREE.CubeRefractionMapping}if(o instanceof THREE.LineBasicMaterial){F.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity}else if(o instanceof THREE.ParticleBasicMaterial){F.psColor.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);F.opacity.value=o.opacity;F.size.value=o.size;F.scale.value=Y.height/
2;F.map.texture=o.map}else if(o instanceof THREE.MeshPhongMaterial){F.ambient.value.setRGB(o.ambient.r,o.ambient.g,o.ambient.b);F.specular.value.setRGB(o.specular.r,o.specular.g,o.specular.b);F.shininess.value=o.shininess}else if(o instanceof THREE.MeshDepthMaterial){F.mNear.value=j.near;F.mFar.value=j.far;F.opacity.value=o.opacity}else if(o instanceof THREE.MeshNormalMaterial)F.opacity.value=o.opacity;for(var eb in F)if(T=E.uniforms[eb]){D=F[eb];H=D.type;t=D.value;if(H=="i")e.uniform1i(T,t);else if(H==
"f")e.uniform1f(T,t);else if(H=="fv1")e.uniform1fv(T,t);else if(H=="fv")e.uniform3fv(T,t);else if(H=="v2")e.uniform2f(T,t.x,t.y);else if(H=="v3")e.uniform3f(T,t.x,t.y,t.z);else if(H=="c")e.uniform3f(T,t.r,t.g,t.b);else if(H=="t"){e.uniform1i(T,t);if(D=D.texture)if(D.image instanceof Array&&D.image.length==6){if(D.image.length==6){if(D.needsUpdate){if(D.__wasSetOnce){e.bindTexture(e.TEXTURE_CUBE_MAP,D.image.__webGLTextureCube);for(H=0;H<6;++H)e.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+H,0,0,0,e.RGBA,
e.UNSIGNED_BYTE,D.image[H])}else{D.image.__webGLTextureCube=e.createTexture();e.bindTexture(e.TEXTURE_CUBE_MAP,D.image.__webGLTextureCube);for(H=0;H<6;++H)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+H,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,D.image[H]);D.__wasSetOnce=!0}B(e.TEXTURE_CUBE_MAP,D,D.image[0]);e.bindTexture(e.TEXTURE_CUBE_MAP,null);D.needsUpdate=!1}e.activeTexture(e.TEXTURE0+t);e.bindTexture(e.TEXTURE_CUBE_MAP,D.image.__webGLTextureCube)}}else{if(D.needsUpdate){if(D.__wasSetOnce){e.bindTexture(e.TEXTURE_2D,
D.__webGLTexture);e.texSubImage2D(e.TEXTURE_2D,0,0,0,e.RGBA,e.UNSIGNED_BYTE,D.image)}else{D.__webGLTexture=e.createTexture();e.bindTexture(e.TEXTURE_2D,D.__webGLTexture);e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,D.image);D.__wasSetOnce=!0}B(e.TEXTURE_2D,D,D.image);e.bindTexture(e.TEXTURE_2D,null);D.needsUpdate=!1}e.activeTexture(e.TEXTURE0+t);e.bindTexture(e.TEXTURE_2D,D.__webGLTexture)}}}e.uniformMatrix4fv(K.modelViewMatrix,!1,y._modelViewMatrixArray);e.uniformMatrix3fv(K.normalMatrix,
!1,y._normalMatrixArray);(o instanceof THREE.MeshShaderMaterial||o instanceof THREE.MeshPhongMaterial||o.envMap)&&e.uniform3f(K.cameraPosition,j.position.x,j.position.y,j.position.z);(o instanceof THREE.MeshShaderMaterial||o.envMap||o.skinning)&&e.uniformMatrix4fv(K.objectMatrix,!1,y._objectMatrixArray);(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshShaderMaterial||o.skinning)&&e.uniformMatrix4fv(K.viewMatrix,!1,la);if(o instanceof THREE.ShadowVolumeDynamicMaterial){j=
F.directionalLightDirection.value;j[0]=-w.position.x;j[1]=-w.position.y;j[2]=-w.position.z;e.uniform3fv(K.directionalLightDirection,j);e.uniformMatrix4fv(K.objectMatrix,!1,y._objectMatrixArray);e.uniformMatrix4fv(K.viewMatrix,!1,la)}if(o.skinning){e.uniformMatrix4fv(K.cameraInverseMatrix,!1,la);e.uniformMatrix4fv(K.boneGlobalMatrices,!1,y.boneMatrices)}return E}function f(j,w,t,o,y,E){if(o.opacity!=0){j=d(j,w,t,o,E).attributes;if(o.morphTargets){w=o.program.attributes;E.morphTargetBase!==-1?e.bindBuffer(e.ARRAY_BUFFER,
y.__webGLMorphTargetsBuffers[E.morphTargetBase]):e.bindBuffer(e.ARRAY_BUFFER,y.__webGLVertexBuffer);e.vertexAttribPointer(w.position,3,e.FLOAT,!1,0,0);if(E.morphTargetForcedOrder.length){t=0;for(var K=E.morphTargetForcedOrder,F=E.morphTargetInfluences;t<o.numSupportedMorphTargets&&t<K.length;){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLMorphTargetsBuffers[K[t]]);e.vertexAttribPointer(w["morphTarget"+t],3,e.FLOAT,!1,0,0);E.__webGLMorphTargetInfluences[t]=F[K[t]];t++}}else{K=[];var D=-1,Q=0;F=E.morphTargetInfluences;
var H,T=F.length;t=0;for(E.morphTargetBase!==-1&&(K[E.morphTargetBase]=!0);t<o.numSupportedMorphTargets;){for(H=0;H<T;H++)if(!K[H]&&F[H]>D){Q=H;D=F[Q]}e.bindBuffer(e.ARRAY_BUFFER,y.__webGLMorphTargetsBuffers[Q]);e.vertexAttribPointer(w["morphTarget"+t],3,e.FLOAT,!1,0,0);E.__webGLMorphTargetInfluences[t]=D;K[Q]=1;D=-1;t++}}e.uniform1fv(o.program.uniforms.morphTargetInfluences,E.__webGLMorphTargetInfluences)}else{e.bindBuffer(e.ARRAY_BUFFER,y.__webGLVertexBuffer);e.vertexAttribPointer(j.position,3,
e.FLOAT,!1,0,0)}if(j.color>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLColorBuffer);e.vertexAttribPointer(j.color,3,e.FLOAT,!1,0,0)}if(j.normal>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLNormalBuffer);e.vertexAttribPointer(j.normal,3,e.FLOAT,!1,0,0)}if(j.tangent>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLTangentBuffer);e.vertexAttribPointer(j.tangent,4,e.FLOAT,!1,0,0)}if(j.uv>=0)if(y.__webGLUVBuffer){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLUVBuffer);e.vertexAttribPointer(j.uv,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(j.uv)}else e.disableVertexAttribArray(j.uv);
if(j.uv2>=0)if(y.__webGLUV2Buffer){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLUV2Buffer);e.vertexAttribPointer(j.uv2,2,e.FLOAT,!1,0,0);e.enableVertexAttribArray(j.uv2)}else e.disableVertexAttribArray(j.uv2);if(o.skinning&&j.skinVertexA>=0&&j.skinVertexB>=0&&j.skinIndex>=0&&j.skinWeight>=0){e.bindBuffer(e.ARRAY_BUFFER,y.__webGLSkinVertexABuffer);e.vertexAttribPointer(j.skinVertexA,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webGLSkinVertexBBuffer);e.vertexAttribPointer(j.skinVertexB,4,e.FLOAT,!1,0,
0);e.bindBuffer(e.ARRAY_BUFFER,y.__webGLSkinIndicesBuffer);e.vertexAttribPointer(j.skinIndex,4,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,y.__webGLSkinWeightsBuffer);e.vertexAttribPointer(j.skinWeight,4,e.FLOAT,!1,0,0)}if(E instanceof THREE.Mesh)if(o.wireframe){e.lineWidth(o.wireframeLinewidth);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webGLLineBuffer);e.drawElements(e.LINES,y.__webGLLineCount,e.UNSIGNED_SHORT,0)}else{e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,y.__webGLFaceBuffer);e.drawElements(e.TRIANGLES,
y.__webGLFaceCount,e.UNSIGNED_SHORT,0)}else if(E instanceof THREE.Line){E=E.type==THREE.LineStrip?e.LINE_STRIP:e.LINES;e.lineWidth(o.linewidth);e.drawArrays(E,0,y.__webGLLineCount)}else if(E instanceof THREE.ParticleSystem)e.drawArrays(e.POINTS,0,y.__webGLParticleCount);else E instanceof THREE.Ribbon&&e.drawArrays(e.TRIANGLE_STRIP,0,y.__webGLVertexCount)}}function g(j,w){if(!j.__webGLVertexBuffer)j.__webGLVertexBuffer=e.createBuffer();if(!j.__webGLNormalBuffer)j.__webGLNormalBuffer=e.createBuffer();
if(j.hasPos){e.bindBuffer(e.ARRAY_BUFFER,j.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,j.positionArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(w.attributes.position);e.vertexAttribPointer(w.attributes.position,3,e.FLOAT,!1,0,0)}if(j.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,j.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,j.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(w.attributes.normal);e.vertexAttribPointer(w.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,j.count);
j.count=0}function h(j){if(wa!=j.doubleSided){j.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE);wa=j.doubleSided}if(ha!=j.flipSided){j.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW);ha=j.flipSided}}function k(j){if(ka!=j){j?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST);ka=j}}function m(j){M[0].set(j.n41-j.n11,j.n42-j.n12,j.n43-j.n13,j.n44-j.n14);M[1].set(j.n41+j.n11,j.n42+j.n12,j.n43+j.n13,j.n44+j.n14);M[2].set(j.n41+j.n21,j.n42+j.n22,j.n43+j.n23,j.n44+j.n24);M[3].set(j.n41-j.n21,j.n42-
j.n22,j.n43-j.n23,j.n44-j.n24);M[4].set(j.n41-j.n31,j.n42-j.n32,j.n43-j.n33,j.n44-j.n34);M[5].set(j.n41+j.n31,j.n42+j.n32,j.n43+j.n33,j.n44+j.n34);var w;for(j=0;j<6;j++){w=M[j];w.divideScalar(Math.sqrt(w.x*w.x+w.y*w.y+w.z*w.z))}}function n(j){for(var w=j.matrixWorld,t=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),o=0;o<6;o++){j=M[o].x*w.n14+M[o].y*w.n24+M[o].z*w.n34+M[o].w;if(j<=t)return!1}return!0}function q(j,w){j.list[j.count]=w;j.count+=1}function x(j){var w,
t,o=j.object,y=j.opaque,E=j.transparent;E.count=0;j=y.count=0;for(w=o.materials.length;j<w;j++){t=o.materials[j];t.opacity&&t.opacity<1||t.blending!=THREE.NormalBlending?q(E,t):q(y,t)}}function z(j){var w,t,o,y,E=j.object,K=j.buffer,F=j.opaque,D=j.transparent;D.count=0;j=F.count=0;for(o=E.materials.length;j<o;j++){w=E.materials[j];if(w instanceof THREE.MeshFaceMaterial){w=0;for(t=K.materials.length;w<t;w++)(y=K.materials[w])&&(y.opacity&&y.opacity<1||y.blending!=THREE.NormalBlending?q(D,y):q(F,y))}else{y=
w;y.opacity&&y.opacity<1||y.blending!=THREE.NormalBlending?q(D,y):q(F,y)}}}function p(j,w){return w.z-j.z}function A(j,w){j._modelViewMatrix.multiplyToArray(w.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(j._modelViewMatrix).transposeIntoArray(j._normalMatrixArray)}function G(j){var w,t,o;if(j instanceof THREE.Mesh){t=j.geometry;for(w in t.geometryGroups){o=t.geometryGroups[w];if(t.__dirtyVertices||t.__dirtyMorphTargets||t.__dirtyElements||t.__dirtyUvs||t.__dirtyNormals||
t.__dirtyColors||t.__dirtyTangents){var y=e.DYNAMIC_DRAW,E=void 0,K=void 0,F=void 0,D=void 0;F=void 0;var Q=void 0,H=void 0,T=void 0,ga=void 0,pa=void 0,sa=void 0,ya=void 0,ua=void 0,Ea=void 0,da=void 0,R=void 0,ia=void 0,La=void 0;H=void 0;T=void 0;D=void 0;ga=void 0;D=void 0;da=void 0;R=void 0;H=void 0;da=void 0;R=void 0;ia=void 0;La=void 0;da=void 0;R=void 0;ia=void 0;La=void 0;da=void 0;R=void 0;ia=void 0;La=void 0;da=void 0;R=void 0;ia=void 0;D=void 0;ga=void 0;Q=void 0;F=void 0;F=void 0;var Ga=
void 0,eb=void 0,Ta=void 0,Ia=0,Ra=0,bb=0,db=0,Pa=0,Ua=0,Da=0,Va=0,Ma=0,N=0,Na=0,Qa=o.__vertexArray,ib=o.__uvArray,Ba=o.__uv2Array,Sa=o.__normalArray,Fa=o.__tangentArray,Oa=o.__colorArray,Ja=o.__skinVertexAArray,va=o.__skinVertexBArray,L=o.__skinIndexArray,Z=o.__skinWeightArray,na=o.__morphTargetsArrays,aa=o.__faceArray,ta=o.__lineArray,za=o.__needsSmoothNormals;sa=o.__vertexColorType;pa=o.__uvType;ya=o.__normalType;var ea=j.geometry,$=ea.__dirtyVertices,Ka=ea.__dirtyElements,Xa=ea.__dirtyUvs,Ya=
ea.__dirtyNormals,cb=ea.__dirtyTangents,gb=ea.__dirtyColors,ab=ea.__dirtyMorphTargets,Wa=ea.vertices,nb=o.faces,qb=ea.faces,ob=ea.faceVertexUvs[0],pb=ea.faceVertexUvs[1],kb=ea.skinVerticesA,lb=ea.skinVerticesB,mb=ea.skinIndices,hb=ea.skinWeights,jb=ea.edgeFaces,fb=ea.morphTargets;E=0;for(K=nb.length;E<K;E++){F=nb[E];D=qb[F];ob&&(ua=ob[F]);pb&&(Ea=pb[F]);F=D.vertexNormals;Q=D.normal;H=D.vertexColors;T=D.color;ga=D.vertexTangents;if(D instanceof THREE.Face3){if($){da=Wa[D.a].position;R=Wa[D.b].position;
ia=Wa[D.c].position;Qa[Ra]=da.x;Qa[Ra+1]=da.y;Qa[Ra+2]=da.z;Qa[Ra+3]=R.x;Qa[Ra+4]=R.y;Qa[Ra+5]=R.z;Qa[Ra+6]=ia.x;Qa[Ra+7]=ia.y;Qa[Ra+8]=ia.z;Ra+=9}if(ab){Ga=0;for(eb=fb.length;Ga<eb;Ga++){da=fb[Ga].vertices[D.a].position;R=fb[Ga].vertices[D.b].position;ia=fb[Ga].vertices[D.c].position;Ta=na[Ga];Ta[Na+0]=da.x;Ta[Na+1]=da.y;Ta[Na+2]=da.z;Ta[Na+3]=R.x;Ta[Na+4]=R.y;Ta[Na+5]=R.z;Ta[Na+6]=ia.x;Ta[Na+7]=ia.y;Ta[Na+8]=ia.z}Na+=9}if(hb.length){da=hb[D.a];R=hb[D.b];ia=hb[D.c];Z[N]=da.x;Z[N+1]=da.y;Z[N+2]=da.z;
Z[N+3]=da.w;Z[N+4]=R.x;Z[N+5]=R.y;Z[N+6]=R.z;Z[N+7]=R.w;Z[N+8]=ia.x;Z[N+9]=ia.y;Z[N+10]=ia.z;Z[N+11]=ia.w;da=mb[D.a];R=mb[D.b];ia=mb[D.c];L[N]=da.x;L[N+1]=da.y;L[N+2]=da.z;L[N+3]=da.w;L[N+4]=R.x;L[N+5]=R.y;L[N+6]=R.z;L[N+7]=R.w;L[N+8]=ia.x;L[N+9]=ia.y;L[N+10]=ia.z;L[N+11]=ia.w;da=kb[D.a];R=kb[D.b];ia=kb[D.c];Ja[N]=da.x;Ja[N+1]=da.y;Ja[N+2]=da.z;Ja[N+3]=1;Ja[N+4]=R.x;Ja[N+5]=R.y;Ja[N+6]=R.z;Ja[N+7]=1;Ja[N+8]=ia.x;Ja[N+9]=ia.y;Ja[N+10]=ia.z;Ja[N+11]=1;da=lb[D.a];R=lb[D.b];ia=lb[D.c];va[N]=da.x;va[N+
1]=da.y;va[N+2]=da.z;va[N+3]=1;va[N+4]=R.x;va[N+5]=R.y;va[N+6]=R.z;va[N+7]=1;va[N+8]=ia.x;va[N+9]=ia.y;va[N+10]=ia.z;va[N+11]=1;N+=12}if(gb&&sa){if(H.length==3&&sa==THREE.VertexColors){D=H[0];da=H[1];R=H[2]}else R=da=D=T;Oa[Ma]=D.r;Oa[Ma+1]=D.g;Oa[Ma+2]=D.b;Oa[Ma+3]=da.r;Oa[Ma+4]=da.g;Oa[Ma+5]=da.b;Oa[Ma+6]=R.r;Oa[Ma+7]=R.g;Oa[Ma+8]=R.b;Ma+=9}if(cb&&ea.hasTangents){H=ga[0];T=ga[1];D=ga[2];Fa[Da]=H.x;Fa[Da+1]=H.y;Fa[Da+2]=H.z;Fa[Da+3]=H.w;Fa[Da+4]=T.x;Fa[Da+5]=T.y;Fa[Da+6]=T.z;Fa[Da+7]=T.w;Fa[Da+8]=
D.x;Fa[Da+9]=D.y;Fa[Da+10]=D.z;Fa[Da+11]=D.w;Da+=12}if(Ya&&ya)if(F.length==3&&za)for(ga=0;ga<3;ga++){Q=F[ga];Sa[Ua]=Q.x;Sa[Ua+1]=Q.y;Sa[Ua+2]=Q.z;Ua+=3}else for(ga=0;ga<3;ga++){Sa[Ua]=Q.x;Sa[Ua+1]=Q.y;Sa[Ua+2]=Q.z;Ua+=3}if(Xa&&ua!==undefined&&pa)for(ga=0;ga<3;ga++){F=ua[ga];ib[bb]=F.u;ib[bb+1]=F.v;bb+=2}if(Xa&&Ea!==undefined&&pa)for(ga=0;ga<3;ga++){F=Ea[ga];Ba[db]=F.u;Ba[db+1]=F.v;db+=2}if(Ka){aa[Pa]=Ia;aa[Pa+1]=Ia+1;aa[Pa+2]=Ia+2;Pa+=3;ta[Va]=Ia;ta[Va+1]=Ia+1;ta[Va+2]=Ia;ta[Va+3]=Ia+2;ta[Va+4]=Ia+
1;ta[Va+5]=Ia+2;Va+=6;Ia+=3}}else if(D instanceof THREE.Face4){if($){da=Wa[D.a].position;R=Wa[D.b].position;ia=Wa[D.c].position;La=Wa[D.d].position;Qa[Ra]=da.x;Qa[Ra+1]=da.y;Qa[Ra+2]=da.z;Qa[Ra+3]=R.x;Qa[Ra+4]=R.y;Qa[Ra+5]=R.z;Qa[Ra+6]=ia.x;Qa[Ra+7]=ia.y;Qa[Ra+8]=ia.z;Qa[Ra+9]=La.x;Qa[Ra+10]=La.y;Qa[Ra+11]=La.z;Ra+=12}if(ab){Ga=0;for(eb=fb.length;Ga<eb;Ga++){da=fb[Ga].vertices[D.a].position;R=fb[Ga].vertices[D.b].position;ia=fb[Ga].vertices[D.c].position;La=fb[Ga].vertices[D.d].position;Ta=na[Ga];
Ta[Na+0]=da.x;Ta[Na+1]=da.y;Ta[Na+2]=da.z;Ta[Na+3]=R.x;Ta[Na+4]=R.y;Ta[Na+5]=R.z;Ta[Na+6]=ia.x;Ta[Na+7]=ia.y;Ta[Na+8]=ia.z;Ta[Na+9]=La.x;Ta[Na+10]=La.y;Ta[Na+11]=La.z}Na+=12}if(hb.length){da=hb[D.a];R=hb[D.b];ia=hb[D.c];La=hb[D.d];Z[N]=da.x;Z[N+1]=da.y;Z[N+2]=da.z;Z[N+3]=da.w;Z[N+4]=R.x;Z[N+5]=R.y;Z[N+6]=R.z;Z[N+7]=R.w;Z[N+8]=ia.x;Z[N+9]=ia.y;Z[N+10]=ia.z;Z[N+11]=ia.w;Z[N+12]=La.x;Z[N+13]=La.y;Z[N+14]=La.z;Z[N+15]=La.w;da=mb[D.a];R=mb[D.b];ia=mb[D.c];La=mb[D.d];L[N]=da.x;L[N+1]=da.y;L[N+2]=da.z;L[N+
3]=da.w;L[N+4]=R.x;L[N+5]=R.y;L[N+6]=R.z;L[N+7]=R.w;L[N+8]=ia.x;L[N+9]=ia.y;L[N+10]=ia.z;L[N+11]=ia.w;L[N+12]=La.x;L[N+13]=La.y;L[N+14]=La.z;L[N+15]=La.w;da=kb[D.a];R=kb[D.b];ia=kb[D.c];La=kb[D.d];Ja[N]=da.x;Ja[N+1]=da.y;Ja[N+2]=da.z;Ja[N+3]=1;Ja[N+4]=R.x;Ja[N+5]=R.y;Ja[N+6]=R.z;Ja[N+7]=1;Ja[N+8]=ia.x;Ja[N+9]=ia.y;Ja[N+10]=ia.z;Ja[N+11]=1;Ja[N+12]=La.x;Ja[N+13]=La.y;Ja[N+14]=La.z;Ja[N+15]=1;da=lb[D.a];R=lb[D.b];ia=lb[D.c];D=lb[D.d];va[N]=da.x;va[N+1]=da.y;va[N+2]=da.z;va[N+3]=1;va[N+4]=R.x;va[N+5]=
R.y;va[N+6]=R.z;va[N+7]=1;va[N+8]=ia.x;va[N+9]=ia.y;va[N+10]=ia.z;va[N+11]=1;va[N+12]=D.x;va[N+13]=D.y;va[N+14]=D.z;va[N+15]=1;N+=16}if(gb&&sa){if(H.length==4&&sa==THREE.VertexColors){D=H[0];da=H[1];R=H[2];H=H[3]}else H=R=da=D=T;Oa[Ma]=D.r;Oa[Ma+1]=D.g;Oa[Ma+2]=D.b;Oa[Ma+3]=da.r;Oa[Ma+4]=da.g;Oa[Ma+5]=da.b;Oa[Ma+6]=R.r;Oa[Ma+7]=R.g;Oa[Ma+8]=R.b;Oa[Ma+9]=H.r;Oa[Ma+10]=H.g;Oa[Ma+11]=H.b;Ma+=12}if(cb&&ea.hasTangents){H=ga[0];T=ga[1];D=ga[2];ga=ga[3];Fa[Da]=H.x;Fa[Da+1]=H.y;Fa[Da+2]=H.z;Fa[Da+3]=H.w;
Fa[Da+4]=T.x;Fa[Da+5]=T.y;Fa[Da+6]=T.z;Fa[Da+7]=T.w;Fa[Da+8]=D.x;Fa[Da+9]=D.y;Fa[Da+10]=D.z;Fa[Da+11]=D.w;Fa[Da+12]=ga.x;Fa[Da+13]=ga.y;Fa[Da+14]=ga.z;Fa[Da+15]=ga.w;Da+=16}if(Ya&&ya)if(F.length==4&&za)for(ga=0;ga<4;ga++){Q=F[ga];Sa[Ua]=Q.x;Sa[Ua+1]=Q.y;Sa[Ua+2]=Q.z;Ua+=3}else for(ga=0;ga<4;ga++){Sa[Ua]=Q.x;Sa[Ua+1]=Q.y;Sa[Ua+2]=Q.z;Ua+=3}if(Xa&&ua!==undefined&&pa)for(ga=0;ga<4;ga++){F=ua[ga];ib[bb]=F.u;ib[bb+1]=F.v;bb+=2}if(Xa&&Ea!==undefined&&pa)for(ga=0;ga<4;ga++){F=Ea[ga];Ba[db]=F.u;Ba[db+1]=
F.v;db+=2}if(Ka){aa[Pa]=Ia;aa[Pa+1]=Ia+1;aa[Pa+2]=Ia+3;aa[Pa+3]=Ia+1;aa[Pa+4]=Ia+2;aa[Pa+5]=Ia+3;Pa+=6;ta[Va]=Ia;ta[Va+1]=Ia+1;ta[Va+2]=Ia;ta[Va+3]=Ia+3;ta[Va+4]=Ia+1;ta[Va+5]=Ia+2;ta[Va+6]=Ia+2;ta[Va+7]=Ia+3;Va+=8;Ia+=4}}}if(jb){E=0;for(K=jb.length;E<K;E++){aa[Pa]=jb[E].a;aa[Pa+1]=jb[E].b;aa[Pa+2]=jb[E].c;aa[Pa+3]=jb[E].a;aa[Pa+4]=jb[E].c;aa[Pa+5]=jb[E].d;Pa+=6}}if($){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Qa,y)}if(ab){Ga=0;for(eb=fb.length;Ga<eb;Ga++){e.bindBuffer(e.ARRAY_BUFFER,
o.__webGLMorphTargetsBuffers[Ga]);e.bufferData(e.ARRAY_BUFFER,na[Ga],y)}}if(gb&&Ma>0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,Oa,y)}if(Ya){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Sa,y)}if(cb&&ea.hasTangents){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLTangentBuffer);e.bufferData(e.ARRAY_BUFFER,Fa,y)}if(Xa&&bb>0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLUVBuffer);e.bufferData(e.ARRAY_BUFFER,ib,y)}if(Xa&&db>0){e.bindBuffer(e.ARRAY_BUFFER,
o.__webGLUV2Buffer);e.bufferData(e.ARRAY_BUFFER,Ba,y)}if(Ka){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,aa,y);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,ta,y)}if(N>0){e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);e.bufferData(e.ARRAY_BUFFER,Ja,y);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);e.bufferData(e.ARRAY_BUFFER,va,y);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);
e.bufferData(e.ARRAY_BUFFER,L,y);e.bindBuffer(e.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);e.bufferData(e.ARRAY_BUFFER,Z,y)}}}t.__dirtyVertices=!1;t.__dirtyMorphTargets=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){t=j.geometry;if(t.__dirtyVertices||t.__dirtyColors){j=t;w=e.DYNAMIC_DRAW;ya=j.vertices;y=j.colors;ua=ya.length;E=y.length;Ea=j.__vertexArray;K=j.__colorArray;Ia=j.__dirtyColors;if(j.__dirtyVertices){for(pa=
0;pa<ua;pa++){sa=ya[pa].position;o=pa*3;Ea[o]=sa.x;Ea[o+1]=sa.y;Ea[o+2]=sa.z}e.bindBuffer(e.ARRAY_BUFFER,j.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ea,w)}if(Ia){for(pa=0;pa<E;pa++){color=y[pa];o=pa*3;K[o]=color.r;K[o+1]=color.g;K[o+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,j.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,w)}}t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Line){t=j.geometry;if(t.__dirtyVertices||t.__dirtyColors){j=t;w=e.DYNAMIC_DRAW;ya=j.vertices;y=j.colors;
ua=ya.length;E=y.length;Ea=j.__vertexArray;K=j.__colorArray;Ia=j.__dirtyColors;if(j.__dirtyVertices){for(pa=0;pa<ua;pa++){sa=ya[pa].position;o=pa*3;Ea[o]=sa.x;Ea[o+1]=sa.y;Ea[o+2]=sa.z}e.bindBuffer(e.ARRAY_BUFFER,j.__webGLVertexBuffer);e.bufferData(e.ARRAY_BUFFER,Ea,w)}if(Ia){for(pa=0;pa<E;pa++){color=y[pa];o=pa*3;K[o]=color.r;K[o+1]=color.g;K[o+2]=color.b}e.bindBuffer(e.ARRAY_BUFFER,j.__webGLColorBuffer);e.bufferData(e.ARRAY_BUFFER,K,w)}}t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof
THREE.ParticleSystem){t=j.geometry;(t.__dirtyVertices||t.__dirtyColors||j.sortParticles)&&c(t,e.DYNAMIC_DRAW,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}}function I(j){function w(ga){var pa=[];t=0;for(o=ga.length;t<o;t++)ga[t]==undefined?pa.push("undefined"):pa.push(ga[t].id);return pa.join("_")}var t,o,y,E,K,F,D,Q,H={},T=j.morphTargets!==undefined?j.morphTargets.length:0;j.geometryGroups={};y=0;for(E=j.faces.length;y<E;y++){K=j.faces[y];F=K.materials;D=w(F);H[D]==undefined&&(H[D]={hash:D,counter:0});
Q=H[D].hash+"_"+H[D].counter;j.geometryGroups[Q]==undefined&&(j.geometryGroups[Q]={faces:[],materials:F,vertices:0,numMorphTargets:T});K=K instanceof THREE.Face3?3:4;if(j.geometryGroups[Q].vertices+K>65535){H[D].counter+=1;Q=H[D].hash+"_"+H[D].counter;j.geometryGroups[Q]==undefined&&(j.geometryGroups[Q]={faces:[],materials:F,vertices:0,numMorphTargets:T})}j.geometryGroups[Q].faces.push(y);j.geometryGroups[Q].vertices+=K}}function C(j,w,t){j.push({buffer:w,object:t,opaque:{list:[],count:0},transparent:{list:[],
count:0}})}function J(j){if(j!=Aa){switch(j){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE);break;case THREE.SubtractiveBlending:e.blendFunc(e.DST_COLOR,e.ZERO);break;case THREE.BillboardBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:e.blendEquation(e.FUNC_REVERSE_SUBTRACT);e.blendFunc(e.ONE,e.ONE);break;default:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}Aa=
j}}function B(j,w,t){if((t.width&t.width-1)==0&&(t.height&t.height-1)==0){e.texParameteri(j,e.TEXTURE_WRAP_S,V(w.wrapS));e.texParameteri(j,e.TEXTURE_WRAP_T,V(w.wrapT));e.texParameteri(j,e.TEXTURE_MAG_FILTER,V(w.magFilter));e.texParameteri(j,e.TEXTURE_MIN_FILTER,V(w.minFilter));e.generateMipmap(j)}else{e.texParameteri(j,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE);e.texParameteri(j,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);e.texParameteri(j,e.TEXTURE_MAG_FILTER,O(w.magFilter));e.texParameteri(j,e.TEXTURE_MIN_FILTER,
O(w.minFilter))}}function U(j){if(j&&!j.__webGLFramebuffer){j.__webGLFramebuffer=e.createFramebuffer();j.__webGLRenderbuffer=e.createRenderbuffer();j.__webGLTexture=e.createTexture();e.bindRenderbuffer(e.RENDERBUFFER,j.__webGLRenderbuffer);e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_COMPONENT16,j.width,j.height);e.bindTexture(e.TEXTURE_2D,j.__webGLTexture);e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,V(j.wrapS));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,V(j.wrapT));e.texParameteri(e.TEXTURE_2D,
e.TEXTURE_MAG_FILTER,V(j.magFilter));e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,V(j.minFilter));e.texImage2D(e.TEXTURE_2D,0,V(j.format),j.width,j.height,0,V(j.format),V(j.type),null);e.bindFramebuffer(e.FRAMEBUFFER,j.__webGLFramebuffer);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,j.__webGLTexture,0);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,j.__webGLRenderbuffer);e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);
e.bindFramebuffer(e.FRAMEBUFFER,null)}var w,t;if(j){w=j.__webGLFramebuffer;t=j.width;j=j.height}else{w=null;t=ca;j=S}if(w!=X){e.bindFramebuffer(e.FRAMEBUFFER,w);e.viewport(oa,ma,t,j);X=w}}function P(j,w){var t;if(j=="fragment")t=e.createShader(e.FRAGMENT_SHADER);else j=="vertex"&&(t=e.createShader(e.VERTEX_SHADER));e.shaderSource(t,w);e.compileShader(t);if(!e.getShaderParameter(t,e.COMPILE_STATUS)){console.error(e.getShaderInfoLog(t));console.error(w);return null}return t}function O(j){switch(j){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
default:return e.LINEAR}}function V(j){switch(j){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 Y=document.createElement("canvas"),e,ja=null,X=null,W=this,wa=null,ha=null,Aa=null,ka=null,oa=0,ma=0,ca=0,S=0,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],fa=new THREE.Matrix4,ra=new Float32Array(16),la=new Float32Array(16),qa=new THREE.Vector4,xa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Ca=!0,Za=new THREE.Color(0),$a=0;if(a){if(a.antialias!==undefined)Ca=a.antialias;
a.clearColor!==undefined&&Za.setHex(a.clearColor);if(a.clearAlpha!==undefined)$a=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Y;this.autoClear=!0;this.sortObjects=!0;(function(j,w,t){try{if(!(e=Y.getContext("experimental-webgl",{antialias:j,stencil:!0})))throw"Error creating WebGL context.";}catch(o){console.error(o)}e.clearColor(0,0,0,1);e.clearDepth(1);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendFunc(e.ONE,
e.ONE_MINUS_SRC_ALPHA);e.clearColor(w.r,w.g,w.b,t)})(Ca,Za,$a);this.context=e;var Ha={};a=[];Ca=[];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;Ca[0]=0;Ca[1]=1;Ca[2]=2;Ca[3]=0;Ca[4]=2;Ca[5]=3;Ha.vertexBuffer=e.createBuffer();Ha.elementBuffer=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,Ha.vertexBuffer);e.bufferData(e.ARRAY_BUFFER,new Float32Array(a),e.STATIC_DRAW);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,Ha.elementBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,
new Uint16Array(Ca),e.STATIC_DRAW);Ha.program=e.createProgram();e.attachShader(Ha.program,P("fragment",THREE.ShaderLib.shadowPost.fragmentShader));e.attachShader(Ha.program,P("vertex",THREE.ShaderLib.shadowPost.vertexShader));e.linkProgram(Ha.program);Ha.vertexLocation=e.getAttribLocation(Ha.program,"position");Ha.projectionLocation=e.getUniformLocation(Ha.program,"projectionMatrix");this.setSize=function(j,w){Y.width=j;Y.height=w;this.setViewport(0,0,Y.width,Y.height)};this.setViewport=function(j,
w,t,o){oa=j;ma=w;ca=t;S=o;e.viewport(oa,ma,ca,S)};this.setScissor=function(j,w,t,o){e.scissor(j,w,t,o)};this.enableScissorTest=function(j){j?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.enableDepthBufferWrite=function(j){e.depthMask(j)};this.setClearColorHex=function(j,w){var t=new THREE.Color(j);e.clearColor(t.r,t.g,t.b,w)};this.setClearColor=function(j,w){e.clearColor(j.r,j.g,j.b,w)};this.clear=function(){e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT|e.STENCIL_BUFFER_BIT)};this.initMaterial=
function(j,w,t,o){var y,E,K;if(j instanceof THREE.MeshDepthMaterial)b(j,THREE.ShaderLib.depth);else if(j instanceof THREE.ShadowVolumeDynamicMaterial)b(j,THREE.ShaderLib.shadowVolumeDynamic);else if(j instanceof THREE.MeshNormalMaterial)b(j,THREE.ShaderLib.normal);else if(j instanceof THREE.MeshBasicMaterial)b(j,THREE.ShaderLib.basic);else if(j instanceof THREE.MeshLambertMaterial)b(j,THREE.ShaderLib.lambert);else if(j instanceof THREE.MeshPhongMaterial)b(j,THREE.ShaderLib.phong);else if(j instanceof
THREE.LineBasicMaterial)b(j,THREE.ShaderLib.basic);else j instanceof THREE.ParticleBasicMaterial&&b(j,THREE.ShaderLib.particle_basic);var F,D,Q,H;K=Q=H=0;for(F=w.length;K<F;K++){D=w[K];D instanceof THREE.DirectionalLight&&Q++;D instanceof THREE.PointLight&&H++}if(H+Q<=4)w=Q;else{w=Math.ceil(4*Q/(H+Q));H=4-w}K={directional:w,point:H};F=50;if(o!==undefined&&o instanceof THREE.SkinnedMesh)F=o.bones.length;H=j.fragmentShader;w=j.vertexShader;F={fog:t,map:j.map,envMap:j.envMap,lightMap:j.lightMap,vertexColors:j.vertexColors,
sizeAttenuation:j.sizeAttenuation,skinning:j.skinning,morphTargets:j.morphTargets,maxDirLights:K.directional,maxPointLights:K.point,maxBones:F};t=e.createProgram();K=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights,F.fog?"#define USE_FOG":"",F.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",F.map?"#define USE_MAP":"",F.envMap?"#define USE_ENVMAP":"",F.lightMap?"#define USE_LIGHTMAP":"",F.vertexColors?"#define USE_COLOR":
"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");F=[e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+F.maxDirLights,"#define MAX_POINT_LIGHTS "+F.maxPointLights,"#define MAX_BONES "+F.maxBones,F.map?"#define USE_MAP":"",F.envMap?"#define USE_ENVMAP":"",F.lightMap?"#define USE_LIGHTMAP":"",F.vertexColors?"#define USE_COLOR":"",F.skinning?"#define USE_SKINNING":"",F.morphTargets?"#define USE_MORPHTARGETS":"",F.sizeAttenuation?
"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
e.attachShader(t,P("fragment",K+H));e.attachShader(t,P("vertex",F+w));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={};j.program=t;t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in j.uniforms)t.push(y);
y=j.program;H=0;for(w=t.length;H<w;H++){K=t[H];y.uniforms[K]=e.getUniformLocation(y,K)}t=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<this.maxMorphTargets;y++)t.push("morphTarget"+y);for(E in j.attributes)t.push(E);E=j.program;y=t;t=0;for(H=y.length;t<H;t++){w=y[t];E.attributes[w]=e.getAttribLocation(E,w)}E=j.program.attributes;e.enableVertexAttribArray(E.position);E.color>=0&&e.enableVertexAttribArray(E.color);E.normal>=0&&e.enableVertexAttribArray(E.normal);
E.tangent>=0&&e.enableVertexAttribArray(E.tangent);if(j.skinning&&E.skinVertexA>=0&&E.skinVertexB>=0&&E.skinIndex>=0&&E.skinWeight>=0){e.enableVertexAttribArray(E.skinVertexA);e.enableVertexAttribArray(E.skinVertexB);e.enableVertexAttribArray(E.skinIndex);e.enableVertexAttribArray(E.skinWeight)}if(j.morphTargets){j.numSupportedMorphTargets=0;if(E.morphTarget0>=0){e.enableVertexAttribArray(E.morphTarget0);j.numSupportedMorphTargets++}if(E.morphTarget1>=0){e.enableVertexAttribArray(E.morphTarget1);
j.numSupportedMorphTargets++}if(E.morphTarget2>=0){e.enableVertexAttribArray(E.morphTarget2);j.numSupportedMorphTargets++}if(E.morphTarget3>=0){e.enableVertexAttribArray(E.morphTarget3);j.numSupportedMorphTargets++}if(E.morphTarget4>=0){e.enableVertexAttribArray(E.morphTarget4);j.numSupportedMorphTargets++}if(E.morphTarget5>=0){e.enableVertexAttribArray(E.morphTarget5);j.numSupportedMorphTargets++}if(E.morphTarget6>=0){e.enableVertexAttribArray(E.morphTarget6);j.numSupportedMorphTargets++}if(E.morphTarget7>=
0){e.enableVertexAttribArray(E.morphTarget7);j.numSupportedMorphTargets++}o.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(y=0;y<this.maxMorphTargets;y++)o.__webGLMorphTargetInfluences[y]=0}};this.render=function(j,w,t,o){var y,E,K,F,D,Q,H,T,ga=j.lights,pa=j.fog;w.matrixAutoUpdate&&w.updateMatrix();j.update(undefined,!1,w);w.matrixWorldInverse.flattenToArray(la);w.projectionMatrix.flattenToArray(ra);fa.multiply(w.projectionMatrix,w.matrixWorldInverse);m(fa);this.initWebGLObjects(j);
U(t);(this.autoClear||o)&&this.clear();D=j.__webglObjects.length;for(o=0;o<D;o++){y=j.__webglObjects[o];H=y.object;if(H.visible)if(!(H instanceof THREE.Mesh)||n(H)){H.matrixWorld.flattenToArray(H._objectMatrixArray);A(H,w);z(y);y.render=!0;if(this.sortObjects){qa.copy(H.position);fa.multiplyVector3(qa);y.z=qa.z}}else y.render=!1;else y.render=!1}this.sortObjects&&j.__webglObjects.sort(p);Q=j.__webglObjectsImmediate.length;for(o=0;o<Q;o++){y=j.__webglObjectsImmediate[o];H=y.object;if(H.visible){H.matrixAutoUpdate&&
H.matrixWorld.flattenToArray(H._objectMatrixArray);A(H,w);x(y)}}J(THREE.NormalBlending);for(o=0;o<D;o++){y=j.__webglObjects[o];if(y.render){H=y.object;T=y.buffer;K=y.opaque;h(H);for(y=0;y<K.count;y++){F=K.list[y];k(F.depthTest);f(w,ga,pa,F,T,H)}}}for(o=0;o<Q;o++){y=j.__webglObjectsImmediate[o];H=y.object;if(H.visible){K=y.opaque;h(H);for(y=0;y<K.count;y++){F=K.list[y];k(F.depthTest);E=d(w,ga,pa,F,H);H.render(function(ua){g(ua,E)})}}}for(o=0;o<D;o++){y=j.__webglObjects[o];if(y.render){H=y.object;T=
y.buffer;K=y.transparent;h(H);for(y=0;y<K.count;y++){F=K.list[y];J(F.blending);k(F.depthTest);f(w,ga,pa,F,T,H)}}}for(o=0;o<Q;o++){y=j.__webglObjectsImmediate[o];H=y.object;if(H.visible){K=y.transparent;h(H);for(y=0;y<K.count;y++){F=K.list[y];J(F.blending);k(F.depthTest);E=d(w,ga,pa,F,H);H.render(function(ua){g(ua,E)})}}}if(j.__webglShadowVolumes.length&&j.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);Q=j.lights.length;var sa,ya;D=j.__webglShadowVolumes.length;for(ga=0;ga<Q;ga++){ya=j.lights[ga];if(ya instanceof THREE.DirectionalLight)for(o=0;o<D;o++){y=j.__webglShadowVolumes[o];H=y.object;T=y.buffer;K=y.opaque;H.matrixWorld.flattenToArray(H._objectMatrixArray);A(H,w);z(y);e.cullFace(e.FRONT);for(sa=0;sa<2;sa++){for(y=0;y<K.count;y++){F=K.list[y];f(w,ya,pa,F,T,H)}e.cullFace(e.BACK)}}}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);Aa="";ja=Ha.program;e.useProgram(Ha.program);e.uniformMatrix4fv(Ha.projectionLocation,!1,ra);e.bindBuffer(e.ARRAY_BUFFER,Ha.vertexBuffer);e.vertexAttribPointer(Ha.vertexLocation,3,e.FLOAT,!1,0,0);e.enableVertexAttribArray(Ha.vertexLocation);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,Ha.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(t&&t.minFilter!==THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter){e.bindTexture(e.TEXTURE_2D,t.__webGLTexture);e.generateMipmap(e.TEXTURE_2D);e.bindTexture(e.TEXTURE_2D,null)}};this.initWebGLObjects=function(j){if(!j.__webglObjects){j.__webglObjects=[];j.__webglObjectsImmediate=[];j.__webglShadowVolumes=[]}for(;j.__objectsAdded.length;){var w=j.__objectsAdded[0],t=j,o=void 0,y=void 0,
E=void 0;if(w._modelViewMatrix==undefined){w._modelViewMatrix=new THREE.Matrix4;w._normalMatrixArray=new Float32Array(9);w._modelViewMatrixArray=new Float32Array(16);w._objectMatrixArray=new Float32Array(16);w.matrixWorld.flattenToArray(w._objectMatrixArray)}if(w instanceof THREE.Mesh){y=w.geometry;y.geometryGroups==undefined&&I(y);for(o in y.geometryGroups){E=y.geometryGroups[o];if(!E.__webGLVertexBuffer){var K=E;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 F=void 0,D=void 0;K.__webGLMorphTargetsBuffers=[];F=0;for(D=K.numMorphTargets;F<D;F++)K.__webGLMorphTargetsBuffers.push(e.createBuffer())}K=
E;F=w;var Q=void 0,H=void 0,T=void 0;T=void 0;var ga=D=0,pa=0;Q=void 0;H=void 0;var sa=void 0;H=void 0;var ya=F.geometry;sa=ya.faces;var ua=K.faces;Q=0;for(H=ua.length;Q<H;Q++){T=ua[Q];T=sa[T];if(T instanceof THREE.Face3){D+=3;ga+=1;pa+=3}else if(T instanceof THREE.Face4){D+=4;ga+=2;pa+=4}}Q=K;H=F;sa=void 0;ua=void 0;var Ea=void 0,da=void 0;Ea=void 0;T=[];sa=0;for(ua=H.materials.length;sa<ua;sa++){Ea=H.materials[sa];if(Ea instanceof THREE.MeshFaceMaterial){Ea=0;for(l=Q.materials.length;Ea<l;Ea++)(da=
Q.materials[Ea])&&T.push(da)}else(da=Ea)&&T.push(da)}H=T;a:{Q=void 0;sa=void 0;ua=H.length;for(Q=0;Q<ua;Q++){sa=H[Q];if(sa.map||sa.lightMap||sa instanceof THREE.MeshShaderMaterial){Q=!0;break a}}Q=!1}a:{sa=H;ua=void 0;T=void 0;Ea=sa.length;for(ua=0;ua<Ea;ua++){T=sa[ua];if(!(T instanceof THREE.MeshBasicMaterial&&!T.envMap||T instanceof THREE.MeshDepthMaterial)){sa=T&&T.shading!=undefined&&T.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}sa=!1}a:{ua=void 0;T=void 0;Ea=H.length;
for(ua=0;ua<Ea;ua++){T=H[ua];if(T.vertexColors){H=T.vertexColors;break a}}H=!1}K.__vertexArray=new Float32Array(D*3);if(sa)K.__normalArray=new Float32Array(D*3);if(ya.hasTangents)K.__tangentArray=new Float32Array(D*4);if(H)K.__colorArray=new Float32Array(D*3);if(Q){if(ya.faceUvs.length>0||ya.faceVertexUvs.length>0)K.__uvArray=new Float32Array(D*2);if(ya.faceUvs.length>1||ya.faceVertexUvs.length>1)K.__uv2Array=new Float32Array(D*2)}if(F.geometry.skinWeights.length&&F.geometry.skinIndices.length){K.__skinVertexAArray=
new Float32Array(D*4);K.__skinVertexBArray=new Float32Array(D*4);K.__skinIndexArray=new Float32Array(D*4);K.__skinWeightArray=new Float32Array(D*4)}K.__faceArray=new Uint16Array(ga*3+(F.geometry.edgeFaces?F.geometry.edgeFaces.length*6:0));K.__lineArray=new Uint16Array(pa*2);if(K.numMorphTargets){ya=void 0;ua=void 0;K.__morphTargetsArrays=[];ya=0;for(ua=K.numMorphTargets;ya<ua;ya++)K.__morphTargetsArrays.push(new Float32Array(D*3))}K.__needsSmoothNormals=sa==THREE.SmoothShading;K.__uvType=Q;K.__vertexColorType=
H;K.__normalType=sa;K.__webGLFaceCount=ga*3+(F.geometry.edgeFaces?F.geometry.edgeFaces.length*6:0);K.__webGLLineCount=pa*2;y.__dirtyVertices=!0;y.__dirtyMorphTargets=!0;y.__dirtyElements=!0;y.__dirtyUvs=!0;y.__dirtyNormals=!0;y.__dirtyTangents=!0;y.__dirtyColors=!0}w instanceof THREE.ShadowVolume?C(t.__webglShadowVolumes,E,w):C(t.__webglObjects,E,w)}}else if(w instanceof THREE.Ribbon){y=w.geometry;if(!y.__webGLVertexBuffer){o=y;o.__webGLVertexBuffer=e.createBuffer();o.__webGLColorBuffer=e.createBuffer();
o=y;E=o.vertices.length;o.__vertexArray=new Float32Array(E*3);o.__colorArray=new Float32Array(E*3);o.__webGLVertexCount=E;y.__dirtyVertices=!0;y.__dirtyColors=!0}C(t.__webglObjects,y,w)}else if(w instanceof THREE.Line){y=w.geometry;if(!y.__webGLVertexBuffer){o=y;o.__webGLVertexBuffer=e.createBuffer();o.__webGLColorBuffer=e.createBuffer();o=y;E=o.vertices.length;o.__vertexArray=new Float32Array(E*3);o.__colorArray=new Float32Array(E*3);o.__webGLLineCount=E;y.__dirtyVertices=!0;y.__dirtyColors=!0}C(t.__webglObjects,
y,w)}else if(w instanceof THREE.ParticleSystem){y=w.geometry;if(!y.__webGLVertexBuffer){o=y;o.__webGLVertexBuffer=e.createBuffer();o.__webGLColorBuffer=e.createBuffer();o=y;E=o.vertices.length;o.__vertexArray=new Float32Array(E*3);o.__colorArray=new Float32Array(E*3);o.__sortArray=[];o.__webGLParticleCount=E;y.__dirtyVertices=!0;y.__dirtyColors=!0}C(t.__webglObjects,y,w)}else THREE.MarchingCubes!==undefined&&w instanceof THREE.MarchingCubes&&t.__webglObjectsImmediate.push({object:w,opaque:{list:[],
count:0},transparent:{list:[],count:0}});j.__objectsAdded.splice(0,1)}for(;j.__objectsRemoved.length;){w=j.__objectsRemoved[0];t=j;y=void 0;o=void 0;for(y=t.__webglObjects.length-1;y>=0;y--){o=t.__webglObjects[y].object;w==o&&t.__webglObjects.splice(y,1)}j.__objectsRemoved.splice(0,1)}w=0;for(t=j.__webglObjects.length;w<t;w++)G(j.__webglObjects[w].object,j);w=0;for(t=j.__webglShadowVolumes.length;w<t;w++)G(j.__webglShadowVolumes[w].object,j)};this.setFaceCulling=function(j,w){if(j){!w||w=="ccw"?e.frontFace(e.CCW):
e.frontFace(e.CW);if(j=="back")e.cullFace(e.BACK);else j=="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(j,t,w){var q,B,F,H=j.vertices,E=H.length,z=j.colors,T=z.length,I=j.__vertexArray,Q=j.__colorArray,ha=j.__sortArray,pa=j.__dirtyVertices,sa=j.__dirtyColors;if(w.sortParticles){fa.multiplySelf(w.matrixWorld);for(q=0;q<E;q++){B=H[q].position;qa.copy(B);fa.multiplyVector3(qa);ha[q]=[qa.z,q]}ha.sort(function(Aa,xa){return xa[0]-Aa[0]});for(q=0;q<E;q++){B=H[ha[q][1]].position;F=q*3;I[F]=B.x;I[F+1]=B.y;I[F+2]=B.z}for(q=0;q<T;q++){F=q*3;color=z[ha[q][1]];Q[F]=color.r;
Q[F+1]=color.g;Q[F+2]=color.b}}else{if(pa)for(q=0;q<E;q++){B=H[q].position;F=q*3;I[F]=B.x;I[F+1]=B.y;I[F+2]=B.z}if(sa)for(q=0;q<T;q++){color=z[q];F=q*3;Q[F]=color.r;Q[F+1]=color.g;Q[F+2]=color.b}}if(pa||w.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,I,t)}if(sa||w.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,Q,t)}}function b(j,t){j.uniforms=Uniforms.clone(t.uniforms);j.vertexShader=t.vertexShader;j.fragmentShader=
t.fragmentShader}function e(j,t,w,q,B){q.__webglProgram||V.initMaterial(q,t,w,B);var F=q.program,H=F.uniforms,E=q.uniforms;if(F!=ja){d.useProgram(F);ja=F}d.uniformMatrix4fv(H.projectionMatrix,!1,ra);if(w&&(q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial||q instanceof THREE.LineBasicMaterial||q 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(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial||q.lights){var z,T,I=0,Q=0,ha=0,pa,sa,Aa,xa=wa,Ea=xa.directional.colors,da=xa.directional.positions,R=xa.point.colors,ia=xa.point.positions,La=0,Ga=0;w=T=T=0;for(z=t.length;w<z;w++){T=t[w];pa=T.color;sa=T.position;Aa=T.intensity;if(T instanceof THREE.AmbientLight){I+=pa.r;Q+=pa.g;ha+=pa.b}else if(T instanceof THREE.DirectionalLight){T=La*3;Ea[T]=pa.r*
Aa;Ea[T+1]=pa.g*Aa;Ea[T+2]=pa.b*Aa;da[T]=sa.x;da[T+1]=sa.y;da[T+2]=sa.z;La+=1}else if(T instanceof THREE.PointLight){T=Ga*3;R[T]=pa.r*Aa;R[T+1]=pa.g*Aa;R[T+2]=pa.b*Aa;ia[T]=sa.x;ia[T+1]=sa.y;ia[T+2]=sa.z;Ga+=1}}for(w=La*3;w<Ea.length;w++)Ea[w]=0;for(w=Ga*3;w<R.length;w++)R[w]=0;xa.point.length=Ga;xa.directional.length=La;xa.ambient[0]=I;xa.ambient[1]=Q;xa.ambient[2]=ha;w=wa;E.enableLighting.value=w.directional.length+w.point.length;E.ambientLightColor.value=w.ambient;E.directionalLightColor.value=
w.directional.colors;E.directionalLightDirection.value=w.directional.positions;E.pointLightColor.value=w.point.colors;E.pointLightPosition.value=w.point.positions}if(q instanceof THREE.MeshBasicMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshPhongMaterial){E.diffuse.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);E.opacity.value=q.opacity;E.map.texture=q.map;E.lightMap.texture=q.lightMap;E.envMap.texture=q.envMap;E.reflectivity.value=q.reflectivity;
E.refractionRatio.value=q.refractionRatio;E.combine.value=q.combine;E.useRefract.value=q.envMap&&q.envMap.mapping instanceof THREE.CubeRefractionMapping}if(q instanceof THREE.LineBasicMaterial){E.diffuse.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);E.opacity.value=q.opacity}else if(q instanceof THREE.ParticleBasicMaterial){E.psColor.value.setRGB(q.color.r*q.opacity,q.color.g*q.opacity,q.color.b*q.opacity);E.opacity.value=q.opacity;E.size.value=q.size;E.scale.value=Y.height/
2;E.map.texture=q.map}else if(q instanceof THREE.MeshPhongMaterial){E.ambient.value.setRGB(q.ambient.r,q.ambient.g,q.ambient.b);E.specular.value.setRGB(q.specular.r,q.specular.g,q.specular.b);E.shininess.value=q.shininess}else if(q instanceof THREE.MeshDepthMaterial){E.mNear.value=j.near;E.mFar.value=j.far;E.opacity.value=q.opacity}else if(q instanceof THREE.MeshNormalMaterial)E.opacity.value=q.opacity;for(var eb in E)if(Q=F.uniforms[eb]){z=E[eb];I=z.type;w=z.value;if(I=="i")d.uniform1i(Q,w);else if(I==
"f")d.uniform1f(Q,w);else if(I=="fv1")d.uniform1fv(Q,w);else if(I=="fv")d.uniform3fv(Q,w);else if(I=="v2")d.uniform2f(Q,w.x,w.y);else if(I=="v3")d.uniform3f(Q,w.x,w.y,w.z);else if(I=="c")d.uniform3f(Q,w.r,w.g,w.b);else if(I=="t"){d.uniform1i(Q,w);if(z=z.texture)if(z.image instanceof Array&&z.image.length==6){if(z.image.length==6){if(z.needsUpdate){if(z.__wasSetOnce){d.bindTexture(d.TEXTURE_CUBE_MAP,z.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,z.image[I])}else{z.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,z.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,z.image[I]);z.__wasSetOnce=!0}C(d.TEXTURE_CUBE_MAP,z,z.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);z.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_CUBE_MAP,z.image.__webGLTextureCube)}}else{if(z.needsUpdate){if(z.__wasSetOnce){d.bindTexture(d.TEXTURE_2D,
z.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,z.image)}else{z.__webGLTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,z.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,z.image);z.__wasSetOnce=!0}C(d.TEXTURE_2D,z,z.image);d.bindTexture(d.TEXTURE_2D,null);z.needsUpdate=!1}d.activeTexture(d.TEXTURE0+w);d.bindTexture(d.TEXTURE_2D,z.__webGLTexture)}}}d.uniformMatrix4fv(H.modelViewMatrix,!1,B._modelViewMatrixArray);d.uniformMatrix3fv(H.normalMatrix,
!1,B._normalMatrixArray);(q instanceof THREE.MeshShaderMaterial||q instanceof THREE.MeshPhongMaterial||q.envMap)&&d.uniform3f(H.cameraPosition,j.position.x,j.position.y,j.position.z);(q instanceof THREE.MeshShaderMaterial||q.envMap||q.skinning)&&d.uniformMatrix4fv(H.objectMatrix,!1,B._objectMatrixArray);(q instanceof THREE.MeshPhongMaterial||q instanceof THREE.MeshLambertMaterial||q instanceof THREE.MeshShaderMaterial||q.skinning)&&d.uniformMatrix4fv(H.viewMatrix,!1,ka);if(q instanceof THREE.ShadowVolumeDynamicMaterial){j=
E.directionalLightDirection.value;j[0]=-t.position.x;j[1]=-t.position.y;j[2]=-t.position.z;d.uniform3fv(H.directionalLightDirection,j);d.uniformMatrix4fv(H.objectMatrix,!1,B._objectMatrixArray);d.uniformMatrix4fv(H.viewMatrix,!1,ka)}if(q.skinning){d.uniformMatrix4fv(H.cameraInverseMatrix,!1,ka);d.uniformMatrix4fv(H.boneGlobalMatrices,!1,B.boneMatrices)}return F}function f(j,t,w,q,B,F){if(q.opacity!=0){j=e(j,t,w,q,F).attributes;if(q.morphTargets){t=q.program.attributes;F.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,
B.__webGLMorphTargetsBuffers[F.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,B.__webGLVertexBuffer);d.vertexAttribPointer(t.position,3,d.FLOAT,!1,0,0);if(F.morphTargetForcedOrder.length){w=0;for(var H=F.morphTargetForcedOrder,E=F.morphTargetInfluences;w<q.numSupportedMorphTargets&&w<H.length;){d.bindBuffer(d.ARRAY_BUFFER,B.__webGLMorphTargetsBuffers[H[w]]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);F.__webGLMorphTargetInfluences[w]=E[H[w]];w++}}else{H=[];var z=-1,T=0;E=F.morphTargetInfluences;
var I,Q=E.length;w=0;for(F.morphTargetBase!==-1&&(H[F.morphTargetBase]=!0);w<q.numSupportedMorphTargets;){for(I=0;I<Q;I++)if(!H[I]&&E[I]>z){T=I;z=E[T]}d.bindBuffer(d.ARRAY_BUFFER,B.__webGLMorphTargetsBuffers[T]);d.vertexAttribPointer(t["morphTarget"+w],3,d.FLOAT,!1,0,0);F.__webGLMorphTargetInfluences[w]=z;H[T]=1;z=-1;w++}}d.uniform1fv(q.program.uniforms.morphTargetInfluences,F.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,B.__webGLVertexBuffer);d.vertexAttribPointer(j.position,3,
d.FLOAT,!1,0,0)}if(j.color>=0){d.bindBuffer(d.ARRAY_BUFFER,B.__webGLColorBuffer);d.vertexAttribPointer(j.color,3,d.FLOAT,!1,0,0)}if(j.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,B.__webGLNormalBuffer);d.vertexAttribPointer(j.normal,3,d.FLOAT,!1,0,0)}if(j.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,B.__webGLTangentBuffer);d.vertexAttribPointer(j.tangent,4,d.FLOAT,!1,0,0)}if(j.uv>=0)if(B.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,B.__webGLUVBuffer);d.vertexAttribPointer(j.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(j.uv)}else d.disableVertexAttribArray(j.uv);
if(j.uv2>=0)if(B.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,B.__webGLUV2Buffer);d.vertexAttribPointer(j.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(j.uv2)}else d.disableVertexAttribArray(j.uv2);if(q.skinning&&j.skinVertexA>=0&&j.skinVertexB>=0&&j.skinIndex>=0&&j.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,B.__webGLSkinVertexABuffer);d.vertexAttribPointer(j.skinVertexA,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,B.__webGLSkinVertexBBuffer);d.vertexAttribPointer(j.skinVertexB,4,d.FLOAT,!1,0,
0);d.bindBuffer(d.ARRAY_BUFFER,B.__webGLSkinIndicesBuffer);d.vertexAttribPointer(j.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,B.__webGLSkinWeightsBuffer);d.vertexAttribPointer(j.skinWeight,4,d.FLOAT,!1,0,0)}if(F instanceof THREE.Mesh)if(q.wireframe){d.lineWidth(q.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,B.__webGLLineBuffer);d.drawElements(d.LINES,B.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,B.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,
B.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(F instanceof THREE.Line){F=F.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(q.linewidth);d.drawArrays(F,0,B.__webGLLineCount)}else if(F instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,B.__webGLParticleCount);else F instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,B.__webGLVertexCount)}}function g(j,t){if(!j.__webGLVertexBuffer)j.__webGLVertexBuffer=d.createBuffer();if(!j.__webGLNormalBuffer)j.__webGLNormalBuffer=d.createBuffer();
if(j.hasPos){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,j.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.position);d.vertexAttribPointer(t.attributes.position,3,d.FLOAT,!1,0,0)}if(j.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,j.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,j.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(t.attributes.normal);d.vertexAttribPointer(t.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,j.count);
j.count=0}function h(j){if(va!=j.doubleSided){j.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);va=j.doubleSided}if(ga!=j.flipSided){j.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);ga=j.flipSided}}function k(j){if(la!=j){j?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);la=j}}function m(j){M[0].set(j.n41-j.n11,j.n42-j.n12,j.n43-j.n13,j.n44-j.n14);M[1].set(j.n41+j.n11,j.n42+j.n12,j.n43+j.n13,j.n44+j.n14);M[2].set(j.n41+j.n21,j.n42+j.n22,j.n43+j.n23,j.n44+j.n24);M[3].set(j.n41-j.n21,j.n42-
j.n22,j.n43-j.n23,j.n44-j.n24);M[4].set(j.n41-j.n31,j.n42-j.n32,j.n43-j.n33,j.n44-j.n34);M[5].set(j.n41+j.n31,j.n42+j.n32,j.n43+j.n33,j.n44+j.n34);var t;for(j=0;j<6;j++){t=M[j];t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))}}function n(j){for(var t=j.matrixWorld,w=-j.geometry.boundingSphere.radius*Math.max(j.scale.x,Math.max(j.scale.y,j.scale.z)),q=0;q<6;q++){j=M[q].x*t.n14+M[q].y*t.n24+M[q].z*t.n34+M[q].w;if(j<=w)return!1}return!0}function p(j,t){j.list[j.count]=t;j.count+=1}function x(j){var t,
w,q=j.object,B=j.opaque,F=j.transparent;F.count=0;j=B.count=0;for(t=q.materials.length;j<t;j++){w=q.materials[j];w.opacity&&w.opacity<1||w.blending!=THREE.NormalBlending?p(F,w):p(B,w)}}function y(j){var t,w,q,B,F=j.object,H=j.buffer,E=j.opaque,z=j.transparent;z.count=0;j=E.count=0;for(q=F.materials.length;j<q;j++){t=F.materials[j];if(t instanceof THREE.MeshFaceMaterial){t=0;for(w=H.materials.length;t<w;t++)(B=H.materials[t])&&(B.opacity&&B.opacity<1||B.blending!=THREE.NormalBlending?p(z,B):p(E,B))}else{B=
t;B.opacity&&B.opacity<1||B.blending!=THREE.NormalBlending?p(z,B):p(E,B)}}}function o(j,t){return t.z-j.z}function A(j,t){j._modelViewMatrix.multiplyToArray(t.matrixWorldInverse,j.matrixWorld,j._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(j._modelViewMatrix).transposeIntoArray(j._normalMatrixArray)}function G(j){var t,w,q;if(j instanceof THREE.Mesh){w=j.geometry;for(t in w.geometryGroups){q=w.geometryGroups[t];if(w.__dirtyVertices||w.__dirtyMorphTargets||w.__dirtyElements||w.__dirtyUvs||w.__dirtyNormals||
w.__dirtyColors||w.__dirtyTangents){var B=d.DYNAMIC_DRAW,F=void 0,H=void 0,E=void 0,z=void 0;E=void 0;var T=void 0,I=void 0,Q=void 0,ha=void 0,pa=void 0,sa=void 0,Aa=void 0,xa=void 0,Ea=void 0,da=void 0,R=void 0,ia=void 0,La=void 0;I=void 0;Q=void 0;z=void 0;ha=void 0;z=void 0;da=void 0;R=void 0;I=void 0;da=void 0;R=void 0;ia=void 0;La=void 0;da=void 0;R=void 0;ia=void 0;La=void 0;da=void 0;R=void 0;ia=void 0;La=void 0;da=void 0;R=void 0;ia=void 0;z=void 0;ha=void 0;T=void 0;E=void 0;E=void 0;var Ga=
void 0,eb=void 0,Ta=void 0,Ia=0,Ra=0,bb=0,db=0,Pa=0,Ua=0,Da=0,Va=0,Ma=0,N=0,Na=0,Qa=q.__vertexArray,ib=q.__uvArray,Ba=q.__uv2Array,Sa=q.__normalArray,Fa=q.__tangentArray,Oa=q.__colorArray,Ja=q.__skinVertexAArray,ua=q.__skinVertexBArray,L=q.__skinIndexArray,Z=q.__skinWeightArray,na=q.__morphTargetsArrays,aa=q.__faceArray,ta=q.__lineArray,ya=q.__needsSmoothNormals;sa=q.__vertexColorType;pa=q.__uvType;Aa=q.__normalType;var ea=j.geometry,$=ea.__dirtyVertices,Ka=ea.__dirtyElements,Xa=ea.__dirtyUvs,Ya=
ea.__dirtyNormals,cb=ea.__dirtyTangents,gb=ea.__dirtyColors,ab=ea.__dirtyMorphTargets,Wa=ea.vertices,nb=q.faces,qb=ea.faces,ob=ea.faceVertexUvs[0],pb=ea.faceVertexUvs[1],kb=ea.skinVerticesA,lb=ea.skinVerticesB,mb=ea.skinIndices,hb=ea.skinWeights,jb=ea.edgeFaces,fb=ea.morphTargets;F=0;for(H=nb.length;F<H;F++){E=nb[F];z=qb[E];ob&&(xa=ob[E]);pb&&(Ea=pb[E]);E=z.vertexNormals;T=z.normal;I=z.vertexColors;Q=z.color;ha=z.vertexTangents;if(z instanceof THREE.Face3){if($){da=Wa[z.a].position;R=Wa[z.b].position;
ia=Wa[z.c].position;Qa[Ra]=da.x;Qa[Ra+1]=da.y;Qa[Ra+2]=da.z;Qa[Ra+3]=R.x;Qa[Ra+4]=R.y;Qa[Ra+5]=R.z;Qa[Ra+6]=ia.x;Qa[Ra+7]=ia.y;Qa[Ra+8]=ia.z;Ra+=9}if(ab){Ga=0;for(eb=fb.length;Ga<eb;Ga++){da=fb[Ga].vertices[z.a].position;R=fb[Ga].vertices[z.b].position;ia=fb[Ga].vertices[z.c].position;Ta=na[Ga];Ta[Na+0]=da.x;Ta[Na+1]=da.y;Ta[Na+2]=da.z;Ta[Na+3]=R.x;Ta[Na+4]=R.y;Ta[Na+5]=R.z;Ta[Na+6]=ia.x;Ta[Na+7]=ia.y;Ta[Na+8]=ia.z}Na+=9}if(hb.length){da=hb[z.a];R=hb[z.b];ia=hb[z.c];Z[N]=da.x;Z[N+1]=da.y;Z[N+2]=da.z;
Z[N+3]=da.w;Z[N+4]=R.x;Z[N+5]=R.y;Z[N+6]=R.z;Z[N+7]=R.w;Z[N+8]=ia.x;Z[N+9]=ia.y;Z[N+10]=ia.z;Z[N+11]=ia.w;da=mb[z.a];R=mb[z.b];ia=mb[z.c];L[N]=da.x;L[N+1]=da.y;L[N+2]=da.z;L[N+3]=da.w;L[N+4]=R.x;L[N+5]=R.y;L[N+6]=R.z;L[N+7]=R.w;L[N+8]=ia.x;L[N+9]=ia.y;L[N+10]=ia.z;L[N+11]=ia.w;da=kb[z.a];R=kb[z.b];ia=kb[z.c];Ja[N]=da.x;Ja[N+1]=da.y;Ja[N+2]=da.z;Ja[N+3]=1;Ja[N+4]=R.x;Ja[N+5]=R.y;Ja[N+6]=R.z;Ja[N+7]=1;Ja[N+8]=ia.x;Ja[N+9]=ia.y;Ja[N+10]=ia.z;Ja[N+11]=1;da=lb[z.a];R=lb[z.b];ia=lb[z.c];ua[N]=da.x;ua[N+
1]=da.y;ua[N+2]=da.z;ua[N+3]=1;ua[N+4]=R.x;ua[N+5]=R.y;ua[N+6]=R.z;ua[N+7]=1;ua[N+8]=ia.x;ua[N+9]=ia.y;ua[N+10]=ia.z;ua[N+11]=1;N+=12}if(gb&&sa){if(I.length==3&&sa==THREE.VertexColors){z=I[0];da=I[1];R=I[2]}else R=da=z=Q;Oa[Ma]=z.r;Oa[Ma+1]=z.g;Oa[Ma+2]=z.b;Oa[Ma+3]=da.r;Oa[Ma+4]=da.g;Oa[Ma+5]=da.b;Oa[Ma+6]=R.r;Oa[Ma+7]=R.g;Oa[Ma+8]=R.b;Ma+=9}if(cb&&ea.hasTangents){I=ha[0];Q=ha[1];z=ha[2];Fa[Da]=I.x;Fa[Da+1]=I.y;Fa[Da+2]=I.z;Fa[Da+3]=I.w;Fa[Da+4]=Q.x;Fa[Da+5]=Q.y;Fa[Da+6]=Q.z;Fa[Da+7]=Q.w;Fa[Da+8]=
z.x;Fa[Da+9]=z.y;Fa[Da+10]=z.z;Fa[Da+11]=z.w;Da+=12}if(Ya&&Aa)if(E.length==3&&ya)for(ha=0;ha<3;ha++){T=E[ha];Sa[Ua]=T.x;Sa[Ua+1]=T.y;Sa[Ua+2]=T.z;Ua+=3}else for(ha=0;ha<3;ha++){Sa[Ua]=T.x;Sa[Ua+1]=T.y;Sa[Ua+2]=T.z;Ua+=3}if(Xa&&xa!==undefined&&pa)for(ha=0;ha<3;ha++){E=xa[ha];ib[bb]=E.u;ib[bb+1]=E.v;bb+=2}if(Xa&&Ea!==undefined&&pa)for(ha=0;ha<3;ha++){E=Ea[ha];Ba[db]=E.u;Ba[db+1]=E.v;db+=2}if(Ka){aa[Pa]=Ia;aa[Pa+1]=Ia+1;aa[Pa+2]=Ia+2;Pa+=3;ta[Va]=Ia;ta[Va+1]=Ia+1;ta[Va+2]=Ia;ta[Va+3]=Ia+2;ta[Va+4]=Ia+
1;ta[Va+5]=Ia+2;Va+=6;Ia+=3}}else if(z instanceof THREE.Face4){if($){da=Wa[z.a].position;R=Wa[z.b].position;ia=Wa[z.c].position;La=Wa[z.d].position;Qa[Ra]=da.x;Qa[Ra+1]=da.y;Qa[Ra+2]=da.z;Qa[Ra+3]=R.x;Qa[Ra+4]=R.y;Qa[Ra+5]=R.z;Qa[Ra+6]=ia.x;Qa[Ra+7]=ia.y;Qa[Ra+8]=ia.z;Qa[Ra+9]=La.x;Qa[Ra+10]=La.y;Qa[Ra+11]=La.z;Ra+=12}if(ab){Ga=0;for(eb=fb.length;Ga<eb;Ga++){da=fb[Ga].vertices[z.a].position;R=fb[Ga].vertices[z.b].position;ia=fb[Ga].vertices[z.c].position;La=fb[Ga].vertices[z.d].position;Ta=na[Ga];
Ta[Na+0]=da.x;Ta[Na+1]=da.y;Ta[Na+2]=da.z;Ta[Na+3]=R.x;Ta[Na+4]=R.y;Ta[Na+5]=R.z;Ta[Na+6]=ia.x;Ta[Na+7]=ia.y;Ta[Na+8]=ia.z;Ta[Na+9]=La.x;Ta[Na+10]=La.y;Ta[Na+11]=La.z}Na+=12}if(hb.length){da=hb[z.a];R=hb[z.b];ia=hb[z.c];La=hb[z.d];Z[N]=da.x;Z[N+1]=da.y;Z[N+2]=da.z;Z[N+3]=da.w;Z[N+4]=R.x;Z[N+5]=R.y;Z[N+6]=R.z;Z[N+7]=R.w;Z[N+8]=ia.x;Z[N+9]=ia.y;Z[N+10]=ia.z;Z[N+11]=ia.w;Z[N+12]=La.x;Z[N+13]=La.y;Z[N+14]=La.z;Z[N+15]=La.w;da=mb[z.a];R=mb[z.b];ia=mb[z.c];La=mb[z.d];L[N]=da.x;L[N+1]=da.y;L[N+2]=da.z;L[N+
3]=da.w;L[N+4]=R.x;L[N+5]=R.y;L[N+6]=R.z;L[N+7]=R.w;L[N+8]=ia.x;L[N+9]=ia.y;L[N+10]=ia.z;L[N+11]=ia.w;L[N+12]=La.x;L[N+13]=La.y;L[N+14]=La.z;L[N+15]=La.w;da=kb[z.a];R=kb[z.b];ia=kb[z.c];La=kb[z.d];Ja[N]=da.x;Ja[N+1]=da.y;Ja[N+2]=da.z;Ja[N+3]=1;Ja[N+4]=R.x;Ja[N+5]=R.y;Ja[N+6]=R.z;Ja[N+7]=1;Ja[N+8]=ia.x;Ja[N+9]=ia.y;Ja[N+10]=ia.z;Ja[N+11]=1;Ja[N+12]=La.x;Ja[N+13]=La.y;Ja[N+14]=La.z;Ja[N+15]=1;da=lb[z.a];R=lb[z.b];ia=lb[z.c];z=lb[z.d];ua[N]=da.x;ua[N+1]=da.y;ua[N+2]=da.z;ua[N+3]=1;ua[N+4]=R.x;ua[N+5]=
R.y;ua[N+6]=R.z;ua[N+7]=1;ua[N+8]=ia.x;ua[N+9]=ia.y;ua[N+10]=ia.z;ua[N+11]=1;ua[N+12]=z.x;ua[N+13]=z.y;ua[N+14]=z.z;ua[N+15]=1;N+=16}if(gb&&sa){if(I.length==4&&sa==THREE.VertexColors){z=I[0];da=I[1];R=I[2];I=I[3]}else I=R=da=z=Q;Oa[Ma]=z.r;Oa[Ma+1]=z.g;Oa[Ma+2]=z.b;Oa[Ma+3]=da.r;Oa[Ma+4]=da.g;Oa[Ma+5]=da.b;Oa[Ma+6]=R.r;Oa[Ma+7]=R.g;Oa[Ma+8]=R.b;Oa[Ma+9]=I.r;Oa[Ma+10]=I.g;Oa[Ma+11]=I.b;Ma+=12}if(cb&&ea.hasTangents){I=ha[0];Q=ha[1];z=ha[2];ha=ha[3];Fa[Da]=I.x;Fa[Da+1]=I.y;Fa[Da+2]=I.z;Fa[Da+3]=I.w;
Fa[Da+4]=Q.x;Fa[Da+5]=Q.y;Fa[Da+6]=Q.z;Fa[Da+7]=Q.w;Fa[Da+8]=z.x;Fa[Da+9]=z.y;Fa[Da+10]=z.z;Fa[Da+11]=z.w;Fa[Da+12]=ha.x;Fa[Da+13]=ha.y;Fa[Da+14]=ha.z;Fa[Da+15]=ha.w;Da+=16}if(Ya&&Aa)if(E.length==4&&ya)for(ha=0;ha<4;ha++){T=E[ha];Sa[Ua]=T.x;Sa[Ua+1]=T.y;Sa[Ua+2]=T.z;Ua+=3}else for(ha=0;ha<4;ha++){Sa[Ua]=T.x;Sa[Ua+1]=T.y;Sa[Ua+2]=T.z;Ua+=3}if(Xa&&xa!==undefined&&pa)for(ha=0;ha<4;ha++){E=xa[ha];ib[bb]=E.u;ib[bb+1]=E.v;bb+=2}if(Xa&&Ea!==undefined&&pa)for(ha=0;ha<4;ha++){E=Ea[ha];Ba[db]=E.u;Ba[db+1]=
E.v;db+=2}if(Ka){aa[Pa]=Ia;aa[Pa+1]=Ia+1;aa[Pa+2]=Ia+3;aa[Pa+3]=Ia+1;aa[Pa+4]=Ia+2;aa[Pa+5]=Ia+3;Pa+=6;ta[Va]=Ia;ta[Va+1]=Ia+1;ta[Va+2]=Ia;ta[Va+3]=Ia+3;ta[Va+4]=Ia+1;ta[Va+5]=Ia+2;ta[Va+6]=Ia+2;ta[Va+7]=Ia+3;Va+=8;Ia+=4}}}if(jb){F=0;for(H=jb.length;F<H;F++){aa[Pa]=jb[F].a;aa[Pa+1]=jb[F].b;aa[Pa+2]=jb[F].c;aa[Pa+3]=jb[F].a;aa[Pa+4]=jb[F].c;aa[Pa+5]=jb[F].d;Pa+=6}}if($){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Qa,B)}if(ab){Ga=0;for(eb=fb.length;Ga<eb;Ga++){d.bindBuffer(d.ARRAY_BUFFER,
q.__webGLMorphTargetsBuffers[Ga]);d.bufferData(d.ARRAY_BUFFER,na[Ga],B)}}if(gb&&Ma>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,Oa,B)}if(Ya){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Sa,B)}if(cb&&ea.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,Fa,B)}if(Xa&&bb>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,ib,B)}if(Xa&&db>0){d.bindBuffer(d.ARRAY_BUFFER,
q.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ba,B)}if(Ka){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,aa,B);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,ta,B)}if(N>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);d.bufferData(d.ARRAY_BUFFER,Ja,B);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ua,B);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);
d.bufferData(d.ARRAY_BUFFER,L,B);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,Z,B)}}}w.__dirtyVertices=!1;w.__dirtyMorphTargets=!1;w.__dirtyElements=!1;w.__dirtyUvs=!1;w.__dirtyNormals=!1;w.__dirtyTangents=!1;w.__dirtyColors=!1}else if(j instanceof THREE.Ribbon){w=j.geometry;if(w.__dirtyVertices||w.__dirtyColors){j=w;t=d.DYNAMIC_DRAW;Aa=j.vertices;B=j.colors;xa=Aa.length;F=B.length;Ea=j.__vertexArray;H=j.__colorArray;Ia=j.__dirtyColors;if(j.__dirtyVertices){for(pa=
0;pa<xa;pa++){sa=Aa[pa].position;q=pa*3;Ea[q]=sa.x;Ea[q+1]=sa.y;Ea[q+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ea,t)}if(Ia){for(pa=0;pa<F;pa++){color=B[pa];q=pa*3;H[q]=color.r;H[q+1]=color.g;H[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,H,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(j instanceof THREE.Line){w=j.geometry;if(w.__dirtyVertices||w.__dirtyColors){j=w;t=d.DYNAMIC_DRAW;Aa=j.vertices;B=j.colors;
xa=Aa.length;F=B.length;Ea=j.__vertexArray;H=j.__colorArray;Ia=j.__dirtyColors;if(j.__dirtyVertices){for(pa=0;pa<xa;pa++){sa=Aa[pa].position;q=pa*3;Ea[q]=sa.x;Ea[q+1]=sa.y;Ea[q+2]=sa.z}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Ea,t)}if(Ia){for(pa=0;pa<F;pa++){color=B[pa];q=pa*3;H[q]=color.r;H[q+1]=color.g;H[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,j.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,H,t)}}w.__dirtyVertices=!1;w.__dirtyColors=!1}else if(j instanceof
THREE.ParticleSystem){w=j.geometry;(w.__dirtyVertices||w.__dirtyColors||j.sortParticles)&&c(w,d.DYNAMIC_DRAW,j);w.__dirtyVertices=!1;w.__dirtyColors=!1}}function J(j){function t(ha){var pa=[];w=0;for(q=ha.length;w<q;w++)ha[w]==undefined?pa.push("undefined"):pa.push(ha[w].id);return pa.join("_")}var w,q,B,F,H,E,z,T,I={},Q=j.morphTargets!==undefined?j.morphTargets.length:0;j.geometryGroups={};B=0;for(F=j.faces.length;B<F;B++){H=j.faces[B];E=H.materials;z=t(E);I[z]==undefined&&(I[z]={hash:z,counter:0});
T=I[z].hash+"_"+I[z].counter;j.geometryGroups[T]==undefined&&(j.geometryGroups[T]={faces:[],materials:E,vertices:0,numMorphTargets:Q});H=H instanceof THREE.Face3?3:4;if(j.geometryGroups[T].vertices+H>65535){I[z].counter+=1;T=I[z].hash+"_"+I[z].counter;j.geometryGroups[T]==undefined&&(j.geometryGroups[T]={faces:[],materials:E,vertices:0,numMorphTargets:Q})}j.geometryGroups[T].faces.push(B);j.geometryGroups[T].vertices+=H}}function D(j,t,w){j.push({buffer:t,object:w,opaque:{list:[],count:0},transparent:{list:[],
count:0}})}function K(j){if(j!=za){switch(j){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:d.blendEquation(d.FUNC_REVERSE_SUBTRACT);d.blendFunc(d.ONE,d.ONE);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}za=
j}}function C(j,t,w){if((w.width&w.width-1)==0&&(w.height&w.height-1)==0){d.texParameteri(j,d.TEXTURE_WRAP_S,W(t.wrapS));d.texParameteri(j,d.TEXTURE_WRAP_T,W(t.wrapT));d.texParameteri(j,d.TEXTURE_MAG_FILTER,W(t.magFilter));d.texParameteri(j,d.TEXTURE_MIN_FILTER,W(t.minFilter));d.generateMipmap(j)}else{d.texParameteri(j,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(j,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(j,d.TEXTURE_MAG_FILTER,O(t.magFilter));d.texParameteri(j,d.TEXTURE_MIN_FILTER,
O(t.minFilter))}}function U(j){if(j&&!j.__webGLFramebuffer){j.__webGLFramebuffer=d.createFramebuffer();j.__webGLRenderbuffer=d.createRenderbuffer();j.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,j.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,j.width,j.height);d.bindTexture(d.TEXTURE_2D,j.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,W(j.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,W(j.wrapT));d.texParameteri(d.TEXTURE_2D,
d.TEXTURE_MAG_FILTER,W(j.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,W(j.minFilter));d.texImage2D(d.TEXTURE_2D,0,W(j.format),j.width,j.height,0,W(j.format),W(j.type),null);d.bindFramebuffer(d.FRAMEBUFFER,j.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,j.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,j.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);
d.bindFramebuffer(d.FRAMEBUFFER,null)}var t,w;if(j){t=j.__webGLFramebuffer;w=j.width;j=j.height}else{t=null;w=ca;j=S}if(t!=X){d.bindFramebuffer(d.FRAMEBUFFER,t);d.viewport(oa,ma,w,j);X=t}}function P(j,t){var w;if(j=="fragment")w=d.createShader(d.FRAGMENT_SHADER);else j=="vertex"&&(w=d.createShader(d.VERTEX_SHADER));d.shaderSource(w,t);d.compileShader(w);if(!d.getShaderParameter(w,d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(w));console.error(t);return null}return w}function O(j){switch(j){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;
default:return d.LINEAR}}function W(j){switch(j){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;
case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}
var Y=document.createElement("canvas"),d,ja=null,X=null,V=this,va=null,ga=null,za=null,la=null,oa=0,ma=0,ca=0,S=0,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],fa=new THREE.Matrix4,ra=new Float32Array(16),ka=new Float32Array(16),qa=new THREE.Vector4,wa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Ca=!0,Za=new THREE.Color(0),$a=0;if(a){if(a.antialias!==undefined)Ca=a.antialias;
a.clearColor!==undefined&&Za.setHex(a.clearColor);if(a.clearAlpha!==undefined)$a=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Y;this.autoClear=!0;this.sortObjects=!0;(function(j,t,w){try{if(!(d=Y.getContext("experimental-webgl",{antialias:j,stencil:!0})))throw"Error creating WebGL context.";}catch(q){console.error(q)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,
d.ONE_MINUS_SRC_ALPHA);d.clearColor(t.r,t.g,t.b,w)})(Ca,Za,$a);this.context=d;var Ha={};a=[];Ca=[];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;Ca[0]=0;Ca[1]=1;Ca[2]=2;Ca[3]=0;Ca[4]=2;Ca[5]=3;Ha.vertexBuffer=d.createBuffer();Ha.elementBuffer=d.createBuffer();d.bindBuffer(d.ARRAY_BUFFER,Ha.vertexBuffer);d.bufferData(d.ARRAY_BUFFER,new Float32Array(a),d.STATIC_DRAW);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,Ha.elementBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,
new Uint16Array(Ca),d.STATIC_DRAW);Ha.program=d.createProgram();d.attachShader(Ha.program,P("fragment",THREE.ShaderLib.shadowPost.fragmentShader));d.attachShader(Ha.program,P("vertex",THREE.ShaderLib.shadowPost.vertexShader));d.linkProgram(Ha.program);Ha.vertexLocation=d.getAttribLocation(Ha.program,"position");Ha.projectionLocation=d.getUniformLocation(Ha.program,"projectionMatrix");this.setSize=function(j,t){Y.width=j;Y.height=t;this.setViewport(0,0,Y.width,Y.height)};this.setViewport=function(j,
t,w,q){oa=j;ma=t;ca=w;S=q;d.viewport(oa,ma,ca,S)};this.setScissor=function(j,t,w,q){d.scissor(j,t,w,q)};this.enableScissorTest=function(j){j?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(j){d.depthMask(j)};this.setClearColorHex=function(j,t){var w=new THREE.Color(j);d.clearColor(w.r,w.g,w.b,t)};this.setClearColor=function(j,t){d.clearColor(j.r,j.g,j.b,t)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT|d.STENCIL_BUFFER_BIT)};this.initMaterial=
function(j,t,w,q){var B,F,H,E;if(j instanceof THREE.MeshDepthMaterial)b(j,THREE.ShaderLib.depth);else if(j instanceof THREE.ShadowVolumeDynamicMaterial)b(j,THREE.ShaderLib.shadowVolumeDynamic);else if(j instanceof THREE.MeshNormalMaterial)b(j,THREE.ShaderLib.normal);else if(j instanceof THREE.MeshBasicMaterial)b(j,THREE.ShaderLib.basic);else if(j instanceof THREE.MeshLambertMaterial)b(j,THREE.ShaderLib.lambert);else if(j instanceof THREE.MeshPhongMaterial)b(j,THREE.ShaderLib.phong);else if(j instanceof
THREE.LineBasicMaterial)b(j,THREE.ShaderLib.basic);else j instanceof THREE.ParticleBasicMaterial&&b(j,THREE.ShaderLib.particle_basic);if(!j.program){var z,T,I;z=I=E=0;for(H=t.length;z<H;z++){T=t[z];T instanceof THREE.DirectionalLight&&I++;T instanceof THREE.PointLight&&E++}if(E+I<=4)t=I;else{t=Math.ceil(4*I/(E+I));E=4-t}E={directional:t,point:E};t=50;if(q!==undefined&&q instanceof THREE.SkinnedMesh)t=q.bones.length;H={fog:w,map:j.map,envMap:j.envMap,lightMap:j.lightMap,vertexColors:j.vertexColors,
sizeAttenuation:j.sizeAttenuation,skinning:j.skinning,morphTargets:j.morphTargets,maxDirLights:E.directional,maxPointLights:E.point,maxBones:t};w=j.fragmentShader;E=j.vertexShader;t=d.createProgram();z=["#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 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
d.attachShader(t,P("fragment",z+w));d.attachShader(t,P("vertex",H+E));d.linkProgram(t);d.getProgramParameter(t,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(t,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");t.uniforms={};t.attributes={};j.program=t;w=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(B in j.uniforms)w.push(B);
B=j.program;E=0;for(t=w.length;E<t;E++){z=w[E];B.uniforms[z]=d.getUniformLocation(B,z)}w=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(B=0;B<this.maxMorphTargets;B++)w.push("morphTarget"+B);for(F in j.attributes)w.push(F);F=j.program;B=w;w=0;for(E=B.length;w<E;w++){t=B[w];F.attributes[t]=d.getAttribLocation(F,t)}F=j.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(j.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(j.morphTargets){j.numSupportedMorphTargets=0;if(F.morphTarget0>=0){d.enableVertexAttribArray(F.morphTarget0);j.numSupportedMorphTargets++}if(F.morphTarget1>=0){d.enableVertexAttribArray(F.morphTarget1);
j.numSupportedMorphTargets++}if(F.morphTarget2>=0){d.enableVertexAttribArray(F.morphTarget2);j.numSupportedMorphTargets++}if(F.morphTarget3>=0){d.enableVertexAttribArray(F.morphTarget3);j.numSupportedMorphTargets++}if(F.morphTarget4>=0){d.enableVertexAttribArray(F.morphTarget4);j.numSupportedMorphTargets++}if(F.morphTarget5>=0){d.enableVertexAttribArray(F.morphTarget5);j.numSupportedMorphTargets++}if(F.morphTarget6>=0){d.enableVertexAttribArray(F.morphTarget6);j.numSupportedMorphTargets++}if(F.morphTarget7>=
0){d.enableVertexAttribArray(F.morphTarget7);j.numSupportedMorphTargets++}q.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(B=0;B<this.maxMorphTargets;B++)q.__webGLMorphTargetInfluences[B]=0}}j.__webglProgram=!0};this.render=function(j,t,w,q){var B,F,H,E,z,T,I,Q,ha=j.lights,pa=j.fog;t.matrixAutoUpdate&&t.updateMatrix();j.update(undefined,!1,t);t.matrixWorldInverse.flattenToArray(ka);t.projectionMatrix.flattenToArray(ra);fa.multiply(t.projectionMatrix,t.matrixWorldInverse);
m(fa);this.initWebGLObjects(j);U(w);(this.autoClear||q)&&this.clear();q=j.__webglObjects.length;for(z=0;z<q;z++){E=j.__webglObjects[z];I=E.object;if(I.visible)if(!(I instanceof THREE.Mesh)||n(I)){I.matrixWorld.flattenToArray(I._objectMatrixArray);A(I,t);y(E);E.render=!0;if(this.sortObjects){qa.copy(I.position);fa.multiplyVector3(qa);E.z=qa.z}}else E.render=!1;else E.render=!1}this.sortObjects&&j.__webglObjects.sort(o);T=j.__webglObjectsImmediate.length;for(z=0;z<T;z++){E=j.__webglObjectsImmediate[z];
I=E.object;if(I.visible){I.matrixAutoUpdate&&I.matrixWorld.flattenToArray(I._objectMatrixArray);A(I,t);x(E)}}K(THREE.NormalBlending);for(z=0;z<q;z++){E=j.__webglObjects[z];if(E.render){I=E.object;Q=E.buffer;H=E.opaque;h(I);for(B=0;B<H.count;B++){E=H.list[B];k(E.depthTest);f(t,ha,pa,E,Q,I)}}}for(z=0;z<T;z++){E=j.__webglObjectsImmediate[z];I=E.object;if(I.visible){H=E.opaque;h(I);for(B=0;B<H.count;B++){E=H.list[B];k(E.depthTest);F=e(t,ha,pa,E,I);I.render(function(sa){g(sa,F)})}}}for(z=0;z<q;z++){E=
j.__webglObjects[z];if(E.render){I=E.object;Q=E.buffer;H=E.transparent;h(I);for(B=0;B<H.count;B++){E=H.list[B];K(E.blending);k(E.depthTest);f(t,ha,pa,E,Q,I)}}}for(z=0;z<T;z++){E=j.__webglObjectsImmediate[z];I=E.object;if(I.visible){H=E.transparent;h(I);for(B=0;B<H.count;B++){E=H.list[B];K(E.blending);k(E.depthTest);F=e(t,ha,pa,E,I);I.render(function(sa){g(sa,F)})}}}if(j.__webglShadowVolumes.length&&j.lights.length){d.enable(d.POLYGON_OFFSET_FILL);d.polygonOffset(0.1,1);d.enable(d.STENCIL_TEST);d.depthMask(!1);
d.colorMask(!1,!1,!1,!1);d.stencilFunc(d.ALWAYS,1,255);d.stencilOpSeparate(d.BACK,d.KEEP,d.INCR,d.KEEP);d.stencilOpSeparate(d.FRONT,d.KEEP,d.DECR,d.KEEP);T=j.lights.length;Q=[];q=j.__webglShadowVolumes.length;for(t=0;t<T;t++){z=j.lights[t];if(z instanceof THREE.DirectionalLight){Q[0]=-z.position.x;Q[1]=-z.position.y;Q[2]=-z.position.z;for(z=0;z<q;z++){I=j.__webglShadowVolumes[z].object;B=j.__webglShadowVolumes[z].buffer;E=I.materials[0];E.program||V.initMaterial(E,ha,pa,I);F=E.program;E=F.uniforms;
H=F.attributes;if(ja!==F){d.useProgram(F);ja=F;d.uniformMatrix4fv(E.projectionMatrix,!1,ra);d.uniformMatrix4fv(E.viewMatrix,!1,ka);d.uniform3fv(E.directionalLightDirection,Q)}I.matrixWorld.flattenToArray(I._objectMatrixArray);d.uniformMatrix4fv(E.objectMatrix,!1,I._objectMatrixArray);d.bindBuffer(d.ARRAY_BUFFER,B.__webGLVertexBuffer);d.vertexAttribPointer(H.position,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,B.__webGLNormalBuffer);d.vertexAttribPointer(H.normal,3,d.FLOAT,!1,0,0);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,
B.__webGLFaceBuffer);d.cullFace(d.FRONT);d.drawElements(d.TRIANGLES,B.__webGLFaceCount,d.UNSIGNED_SHORT,0);d.cullFace(d.BACK);d.drawElements(d.TRIANGLES,B.__webGLFaceCount,d.UNSIGNED_SHORT,0)}}}d.disable(d.POLYGON_OFFSET_FILL);d.colorMask(!0,!0,!0,!0);d.stencilFunc(d.NOTEQUAL,0,255);d.stencilOp(d.KEEP,d.KEEP,d.KEEP);d.disable(d.DEPTH_TEST);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.blendEquation(d.FUNC_ADD);za="";ja=Ha.program;d.useProgram(Ha.program);d.uniformMatrix4fv(Ha.projectionLocation,
!1,ra);d.bindBuffer(d.ARRAY_BUFFER,Ha.vertexBuffer);d.vertexAttribPointer(Ha.vertexLocation,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(Ha.vertexLocation);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,Ha.elementBuffer);d.drawElements(d.TRIANGLES,6,d.UNSIGNED_SHORT,0);d.disable(d.STENCIL_TEST);d.enable(d.DEPTH_TEST);d.disable(d.BLEND);d.depthMask(!0)}if(w&&w.minFilter!==THREE.NearestFilter&&w.minFilter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,w.__webGLTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,
null)}};this.initWebGLObjects=function(j){if(!j.__webglObjects){j.__webglObjects=[];j.__webglObjectsImmediate=[];j.__webglShadowVolumes=[]}for(;j.__objectsAdded.length;){var t=j.__objectsAdded[0],w=j,q=void 0,B=void 0,F=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){B=
t.geometry;B.geometryGroups==undefined&&J(B);for(q in B.geometryGroups){F=B.geometryGroups[q];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 E=void 0,z=void 0;H.__webGLMorphTargetsBuffers=[];E=0;for(z=H.numMorphTargets;E<z;E++)H.__webGLMorphTargetsBuffers.push(d.createBuffer())}H=F;E=t;var T=void 0,I=void 0,Q=void 0;Q=void 0;var ha=z=0,pa=0;T=void 0;I=void 0;var sa=void 0;I=void 0;var Aa=E.geometry;sa=Aa.faces;var xa=H.faces;T=0;for(I=xa.length;T<I;T++){Q=xa[T];Q=sa[Q];if(Q instanceof THREE.Face3){z+=3;ha+=1;pa+=3}else if(Q instanceof
THREE.Face4){z+=4;ha+=2;pa+=4}}T=H;I=E;sa=void 0;xa=void 0;var Ea=void 0,da=void 0;Ea=void 0;Q=[];sa=0;for(xa=I.materials.length;sa<xa;sa++){Ea=I.materials[sa];if(Ea instanceof THREE.MeshFaceMaterial){Ea=0;for(l=T.materials.length;Ea<l;Ea++)(da=T.materials[Ea])&&Q.push(da)}else(da=Ea)&&Q.push(da)}I=Q;a:{T=void 0;sa=void 0;xa=I.length;for(T=0;T<xa;T++){sa=I[T];if(sa.map||sa.lightMap||sa instanceof THREE.MeshShaderMaterial){T=!0;break a}}T=!1}a:{sa=I;xa=void 0;Q=void 0;Ea=sa.length;for(xa=0;xa<Ea;xa++){Q=
sa[xa];if(!(Q instanceof THREE.MeshBasicMaterial&&!Q.envMap||Q instanceof THREE.MeshDepthMaterial)){sa=Q&&Q.shading!=undefined&&Q.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}sa=!1}a:{xa=void 0;Q=void 0;Ea=I.length;for(xa=0;xa<Ea;xa++){Q=I[xa];if(Q.vertexColors){I=Q.vertexColors;break a}}I=!1}H.__vertexArray=new Float32Array(z*3);if(sa)H.__normalArray=new Float32Array(z*3);if(Aa.hasTangents)H.__tangentArray=new Float32Array(z*4);if(I)H.__colorArray=new Float32Array(z*
3);if(T){if(Aa.faceUvs.length>0||Aa.faceVertexUvs.length>0)H.__uvArray=new Float32Array(z*2);if(Aa.faceUvs.length>1||Aa.faceVertexUvs.length>1)H.__uv2Array=new Float32Array(z*2)}if(E.geometry.skinWeights.length&&E.geometry.skinIndices.length){H.__skinVertexAArray=new Float32Array(z*4);H.__skinVertexBArray=new Float32Array(z*4);H.__skinIndexArray=new Float32Array(z*4);H.__skinWeightArray=new Float32Array(z*4)}H.__faceArray=new Uint16Array(ha*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0));
H.__lineArray=new Uint16Array(pa*2);if(H.numMorphTargets){Aa=void 0;xa=void 0;H.__morphTargetsArrays=[];Aa=0;for(xa=H.numMorphTargets;Aa<xa;Aa++)H.__morphTargetsArrays.push(new Float32Array(z*3))}H.__needsSmoothNormals=sa==THREE.SmoothShading;H.__uvType=T;H.__vertexColorType=I;H.__normalType=sa;H.__webGLFaceCount=ha*3+(E.geometry.edgeFaces?E.geometry.edgeFaces.length*6:0);H.__webGLLineCount=pa*2;B.__dirtyVertices=!0;B.__dirtyMorphTargets=!0;B.__dirtyElements=!0;B.__dirtyUvs=!0;B.__dirtyNormals=!0;
B.__dirtyTangents=!0;B.__dirtyColors=!0}t instanceof THREE.ShadowVolume?D(w.__webglShadowVolumes,F,t):D(w.__webglObjects,F,t)}}else if(t instanceof THREE.Ribbon){B=t.geometry;if(!B.__webGLVertexBuffer){q=B;q.__webGLVertexBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q=B;F=q.vertices.length;q.__vertexArray=new Float32Array(F*3);q.__colorArray=new Float32Array(F*3);q.__webGLVertexCount=F;B.__dirtyVertices=!0;B.__dirtyColors=!0}D(w.__webglObjects,B,t)}else if(t instanceof THREE.Line){B=
t.geometry;if(!B.__webGLVertexBuffer){q=B;q.__webGLVertexBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q=B;F=q.vertices.length;q.__vertexArray=new Float32Array(F*3);q.__colorArray=new Float32Array(F*3);q.__webGLLineCount=F;B.__dirtyVertices=!0;B.__dirtyColors=!0}D(w.__webglObjects,B,t)}else if(t instanceof THREE.ParticleSystem){B=t.geometry;if(!B.__webGLVertexBuffer){q=B;q.__webGLVertexBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q=B;F=q.vertices.length;q.__vertexArray=
new Float32Array(F*3);q.__colorArray=new Float32Array(F*3);q.__sortArray=[];q.__webGLParticleCount=F;B.__dirtyVertices=!0;B.__dirtyColors=!0}D(w.__webglObjects,B,t)}else THREE.MarchingCubes!==undefined&&t instanceof THREE.MarchingCubes&&w.__webglObjectsImmediate.push({object:t,opaque:{list:[],count:0},transparent:{list:[],count:0}});j.__objectsAdded.splice(0,1)}for(;j.__objectsRemoved.length;){t=j.__objectsRemoved[0];w=j;B=void 0;q=void 0;for(B=w.__webglObjects.length-1;B>=0;B--){q=w.__webglObjects[B].object;
t==q&&w.__webglObjects.splice(B,1)}j.__objectsRemoved.splice(0,1)}t=0;for(w=j.__webglObjects.length;t<w;t++)G(j.__webglObjects[t].object,j);t=0;for(w=j.__webglShadowVolumes.length;t<w;t++)G(j.__webglShadowVolumes[t].object,j)};this.setFaceCulling=function(j,t){if(j){!t||t=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(j=="back")d.cullFace(d.BACK);else j=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
0}};THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,b){b&&a.update(undefined,!1,c);b=a.sounds;var e,f=b.length;for(e=0;e<f;e++){a=b[e];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(a){this.positionWorld.copy(a.positionWorld);this.positionScreen.copy(a.positionScreen)};
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.v4=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,d=a.vertices.length,f=b?c.geometry:c,g=a.vertices,h=f.vertices,k=a.faces,m=f.faces,n=a.faceVertexUvs[0];f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var q=0,x=h.length;q<x;q++){var z=new THREE.Vertex(h[q].position.clone());b&&c.matrix.multiplyVector3(z.position);g.push(z)}q=0;for(x=m.length;q<x;q++){h=m[q];var p,A,G=h.vertexNormals;z=h.vertexColors;if(h instanceof THREE.Face3)p=new THREE.Face3(h.a+d,h.b+d,h.c+
d);else h instanceof THREE.Face4&&(p=new THREE.Face4(h.a+d,h.b+d,h.c+d,h.d+d));p.normal.copy(h.normal);b=0;for(g=G.length;b<g;b++){A=G[b];p.vertexNormals.push(A.clone())}p.color.copy(h.color);b=0;for(g=z.length;b<g;b++){A=z[b];p.vertexColors.push(A.clone())}p.materials=h.materials.slice();p.centroid.copy(h.centroid);k.push(p)}q=0;for(x=f.length;q<x;q++){d=f[q];k=[];b=0;for(g=d.length;b<g;b++)k.push(new THREE.UV(d[b].u,d[b].v));n.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){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(q in V.objects)if(!ha.objects[q]){G=V.objects[q];if(B=ha.geometries[G.geometry]){O=
[];for(i=0;i<G.materials.length;i++)O[i]=ha.materials[G.materials[i]];I=G.position;r=G.rotation;s=G.scale;object=new THREE.Mesh(B,O);object.position.set(I[0],I[1],I[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;ha.scene.addObject(object);ha.objects[q]=object}}}function h(Aa){return function(ka){ha.geometries[Aa]=ka;g();ja-=1;k()}}function k(){d({total_models:W,total_textures:wa,loaded_models:W-ja,loaded_textures:wa-X},ha);ja==0&&X==0&&b(ha)}var m,
n,q,x,z,p,A,G,I,C,J,B,U,P,O,V,Y,e,ja,X,W,wa,ha;V=f.data;Y=new THREE.BinaryLoader;e=new THREE.JSONLoader;X=ja=0;ha={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};f=function(){X-=1;k()};for(z in V.cameras){C=V.cameras[z];if(C.type=="perspective")U=new THREE.Camera(C.fov,C.aspect,C.near,C.far);else if(C.type=="ortho"){U=new THREE.Camera;U.projectionMatrix=THREE.Matrix4.makeOrtho(C.left,C.right,C.top,C.bottom,C.near,C.far)}I=C.position;C=C.target;
U.position.set(I[0],I[1],I[2]);U.target.position.set(C[0],C[1],C[2]);ha.cameras[z]=U}for(x in V.lights){z=V.lights[x];if(z.type=="directional"){I=z.direction;light=new THREE.DirectionalLight;light.position.set(I[0],I[1],I[2]);light.position.normalize()}else if(z.type=="point"){I=z.position;light=new THREE.PointLight;light.position.set(I[0],I[1],I[2])}C=z.color;i=z.intensity||1;light.color.setRGB(C[0]*i,C[1]*i,C[2]*i);ha.scene.addLight(light);ha.lights[x]=light}for(p in V.fogs){x=V.fogs[p];if(x.type==
"linear")P=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(P=new THREE.FogExp2(0,x.density));C=x.color;P.color.setRGB(C[0],C[1],C[2]);ha.fogs[p]=P}if(ha.cameras&&V.defaults.camera)ha.currentCamera=ha.cameras[V.defaults.camera];if(ha.fogs&&V.defaults.fog)ha.scene.fog=ha.fogs[V.defaults.fog];C=V.defaults.bgcolor;ha.bgColor=new THREE.Color;ha.bgColor.setRGB(C[0],C[1],C[2]);ha.bgColorAlpha=V.defaults.bgalpha;for(m in V.geometries){p=V.geometries[m];if(p.type=="bin_mesh"||p.type=="ascii_mesh")ja+=
1}W=ja;for(m in V.geometries){p=V.geometries[m];if(p.type=="cube"){B=new Cube(p.width,p.height,p.depth,p.segmentsWidth,p.segmentsHeight,p.segmentsDepth,null,p.flipped,p.sides);ha.geometries[m]=B}else if(p.type=="plane"){B=new Plane(p.width,p.height,p.segmentsWidth,p.segmentsHeight);ha.geometries[m]=B}else if(p.type=="sphere"){B=new Sphere(p.radius,p.segmentsWidth,p.segmentsHeight);ha.geometries[m]=B}else if(p.type=="cylinder"){B=new Cylinder(p.numSegs,p.topRad,p.botRad,p.height,p.topOffset,p.botOffset);
ha.geometries[m]=B}else if(p.type=="torus"){B=new Torus(p.radius,p.tube,p.segmentsR,p.segmentsT);ha.geometries[m]=B}else if(p.type=="icosahedron"){B=new Icosahedron(p.subdivisions);ha.geometries[m]=B}else if(p.type=="bin_mesh")Y.load({model:p.url,callback:h(m)});else p.type=="ascii_mesh"&&e.load({model:p.url,callback:h(m)})}for(A in V.textures){m=V.textures[A];X+=m.url instanceof Array?m.url.length:1}wa=X;for(A in V.textures){m=V.textures[A];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=
new THREE[m.mapping];if(m.url instanceof Array)p=ImageUtils.loadTextureCube(m.url,m.mapping,f);else{p=ImageUtils.loadTexture(m.url,m.mapping,f);if(THREE[m.minFilter]!=undefined)p.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)p.magFilter=THREE[m.magFilter]}ha.textures[A]=p}for(n in V.materials){A=V.materials[n];for(J in A.parameters)if(J=="envMap"||J=="map"||J=="lightMap")A.parameters[J]=ha.textures[A.parameters[J]];else if(J=="shading")A.parameters[J]=A.parameters[J]=="flat"?THREE.FlatShading:
THREE.SmoothShading;else if(J=="blending")A.parameters[J]=THREE[A.parameters[J]]?THREE[A.parameters[J]]:THREE.NormalBlending;else J=="combine"&&(A.parameters[J]=A.parameters[J]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);ha.materials[n]=A}g();c(ha)}},addMesh:function(a,c,b,d,f,g,h,k,m,n){c=new THREE.Mesh(c,n);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=d;c.position.y=f;c.position.z=g;c.rotation.x=h;c.rotation.y=k;c.rotation.z=m;a.addObject(c);return c},
addPanoramaCubeWebGL:function(a,c,b){var 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",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}",
var GeometryUtils={merge:function(a,c){var b=c instanceof THREE.Mesh,e=a.vertices.length,f=b?c.geometry:c,g=a.vertices,h=f.vertices,k=a.faces,m=f.faces,n=a.faceVertexUvs[0];f=f.faceVertexUvs[0];b&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,x=h.length;p<x;p++){var y=new THREE.Vertex(h[p].position.clone());b&&c.matrix.multiplyVector3(y.position);g.push(y)}p=0;for(x=m.length;p<x;p++){h=m[p];var o,A,G=h.vertexNormals;y=h.vertexColors;if(h instanceof THREE.Face3)o=new THREE.Face3(h.a+e,h.b+e,h.c+
e);else h instanceof THREE.Face4&&(o=new THREE.Face4(h.a+e,h.b+e,h.c+e,h.d+e));o.normal.copy(h.normal);b=0;for(g=G.length;b<g;b++){A=G[b];o.vertexNormals.push(A.clone())}o.color.copy(h.color);b=0;for(g=y.length;b<g;b++){A=y[b];o.vertexColors.push(A.clone())}o.materials=h.materials.slice();o.centroid.copy(h.centroid);k.push(o)}p=0;for(x=f.length;p<x;p++){e=f[p];k=[];b=0;for(g=e.length;b<g;b++)k.push(new THREE.UV(e[b].u,e[b].v));n.push(k)}}},ImageUtils={loadTexture:function(a,c,b){var e=new Image,f=
new THREE.Texture(e,c);e.onload=function(){f.needsUpdate=!0;b&&b(this)};e.src=a;return f},loadTextureCube:function(a,c,b){var e,f=[],g=new THREE.Texture(f,c);c=f.loadCount=0;for(e=a.length;c<e;++c){f[c]=new Image;f[c].onload=function(){f.loadCount+=1;if(f.loadCount==6)g.needsUpdate=!0;b&&b(this)};f[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,c,b,e){a=new Worker(a);a.postMessage(0);a.onmessage=function(f){function g(){for(p in W.objects)if(!ga.objects[p]){G=W.objects[p];if(C=ga.geometries[G.geometry]){O=
[];for(i=0;i<G.materials.length;i++)O[i]=ga.materials[G.materials[i]];J=G.position;r=G.rotation;s=G.scale;object=new THREE.Mesh(C,O);object.position.set(J[0],J[1],J[2]);object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=G.visible;ga.scene.addObject(object);ga.objects[p]=object}}}function h(za){return function(la){ga.geometries[za]=la;g();ja-=1;k()}}function k(){e({total_models:V,total_textures:va,loaded_models:V-ja,loaded_textures:va-X},ga);ja==0&&X==0&&b(ga)}var m,
n,p,x,y,o,A,G,J,D,K,C,U,P,O,W,Y,d,ja,X,V,va,ga;W=f.data;Y=new THREE.BinaryLoader;d=new THREE.JSONLoader;X=ja=0;ga={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};f=function(){X-=1;k()};for(y in W.cameras){D=W.cameras[y];if(D.type=="perspective")U=new THREE.Camera(D.fov,D.aspect,D.near,D.far);else if(D.type=="ortho"){U=new THREE.Camera;U.projectionMatrix=THREE.Matrix4.makeOrtho(D.left,D.right,D.top,D.bottom,D.near,D.far)}J=D.position;D=D.target;
U.position.set(J[0],J[1],J[2]);U.target.position.set(D[0],D[1],D[2]);ga.cameras[y]=U}for(x in W.lights){y=W.lights[x];if(y.type=="directional"){J=y.direction;light=new THREE.DirectionalLight;light.position.set(J[0],J[1],J[2]);light.position.normalize()}else if(y.type=="point"){J=y.position;light=new THREE.PointLight;light.position.set(J[0],J[1],J[2])}D=y.color;i=y.intensity||1;light.color.setRGB(D[0]*i,D[1]*i,D[2]*i);ga.scene.addLight(light);ga.lights[x]=light}for(o in W.fogs){x=W.fogs[o];if(x.type==
"linear")P=new THREE.Fog(0,x.near,x.far);else x.type=="exp2"&&(P=new THREE.FogExp2(0,x.density));D=x.color;P.color.setRGB(D[0],D[1],D[2]);ga.fogs[o]=P}if(ga.cameras&&W.defaults.camera)ga.currentCamera=ga.cameras[W.defaults.camera];if(ga.fogs&&W.defaults.fog)ga.scene.fog=ga.fogs[W.defaults.fog];D=W.defaults.bgcolor;ga.bgColor=new THREE.Color;ga.bgColor.setRGB(D[0],D[1],D[2]);ga.bgColorAlpha=W.defaults.bgalpha;for(m in W.geometries){o=W.geometries[m];if(o.type=="bin_mesh"||o.type=="ascii_mesh")ja+=
1}V=ja;for(m in W.geometries){o=W.geometries[m];if(o.type=="cube"){C=new Cube(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides);ga.geometries[m]=C}else if(o.type=="plane"){C=new Plane(o.width,o.height,o.segmentsWidth,o.segmentsHeight);ga.geometries[m]=C}else if(o.type=="sphere"){C=new Sphere(o.radius,o.segmentsWidth,o.segmentsHeight);ga.geometries[m]=C}else if(o.type=="cylinder"){C=new Cylinder(o.numSegs,o.topRad,o.botRad,o.height,o.topOffset,o.botOffset);
ga.geometries[m]=C}else if(o.type=="torus"){C=new Torus(o.radius,o.tube,o.segmentsR,o.segmentsT);ga.geometries[m]=C}else if(o.type=="icosahedron"){C=new Icosahedron(o.subdivisions);ga.geometries[m]=C}else if(o.type=="bin_mesh")Y.load({model:o.url,callback:h(m)});else o.type=="ascii_mesh"&&d.load({model:o.url,callback:h(m)})}for(A in W.textures){m=W.textures[A];X+=m.url instanceof Array?m.url.length:1}va=X;for(A in W.textures){m=W.textures[A];if(m.mapping!=undefined&&THREE[m.mapping]!=undefined)m.mapping=
new THREE[m.mapping];if(m.url instanceof Array)o=ImageUtils.loadTextureCube(m.url,m.mapping,f);else{o=ImageUtils.loadTexture(m.url,m.mapping,f);if(THREE[m.minFilter]!=undefined)o.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=undefined)o.magFilter=THREE[m.magFilter]}ga.textures[A]=o}for(n in W.materials){A=W.materials[n];for(K in A.parameters)if(K=="envMap"||K=="map"||K=="lightMap")A.parameters[K]=ga.textures[A.parameters[K]];else if(K=="shading")A.parameters[K]=A.parameters[K]=="flat"?THREE.FlatShading:
THREE.SmoothShading;else if(K=="blending")A.parameters[K]=THREE[A.parameters[K]]?THREE[A.parameters[K]]:THREE.NormalBlending;else K=="combine"&&(A.parameters[K]=A.parameters[K]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation);A=new THREE[A.type](A.parameters);ga.materials[n]=A}g();c(ga)}},addMesh:function(a,c,b,e,f,g,h,k,m,n){c=new THREE.Mesh(c,n);c.scale.x=c.scale.y=c.scale.z=b;c.position.x=e;c.position.y=f;c.position.z=g;c.rotation.x=h;c.rotation.y=k;c.rotation.z=m;a.addObject(c);return c},
addPanoramaCubeWebGL:function(a,c,b){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=b;b=new THREE.MeshShaderMaterial({fragmentShader:e.fragmentShader,vertexShader:e.vertexShader,uniforms:e.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,1,null,!0),b);a.addObject(c);return c},addPanoramaCube:function(a,c,b){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));
e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,e,!0),new THREE.MeshFaceMaterial);a.addObject(c);return c},addPanoramaCubePlanes:function(a,c,b){var e=c/2;c=new Plane(c,c);var f=Math.PI,g=Math.PI/2;SceneUtils.addMesh(a,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[5])}));SceneUtils.addMesh(a,
c,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[0])}));SceneUtils.addMesh(a,c,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[1])}));SceneUtils.addMesh(a,c,1,0,e,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[2])}));SceneUtils.addMesh(a,c,1,0,-e,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(b[3])}))},showHierarchy:function(a,c){SceneUtils.traverseHierarchy(a,function(b){b.visible=c})},traverseHierarchy:function(a,c){var b,e,f=a.children.length;
for(e=0;e<f;e++){b=a.children[e];c(b);SceneUtils.traverseHierarchy(b,c)}}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
uDirLightColor:{type:"c",value:new THREE.Color(15658734)},uAmbientLightColor:{type:"c",value:new THREE.Color(328965)},uDiffuseColor:{type:"c",value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30}},fragmentShader:"uniform vec3 uDirLightPos;\nuniform vec3 uAmbientLightColor;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform bool enableDiffuse;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );\nvec3 aoTex = vec3( 1.0, 1.0, 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ndiffuseTex = texture2D( tDiffuse, vUv ).xyz;\nif( enableAO )\naoTex = texture2D( tAO, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec3 pointVector = normalize( vPointLightVector );\nvec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}",
@@ -336,86 +337,86 @@ 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.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,b,e,f,g=2*Math.ceil(a*3)+1;g>25&&(g=25);f=(g-1)*0.5;b=Array(g);for(c=e=0;c<g;++c){b[c]=Math.exp(-((c-f)*(c-f))/(2*a*a));e+=b[c]}for(c=0;c<g;++c)b[c]/=e;return b}};
THREE.QuakeCamera=function(a){function c(b,e){return function(){e.apply(b,arguments)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.movementSpeed=1;this.lookSpeed=0.005;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.dragToLook=!1;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.domElement=document;if(a){if(a.movementSpeed!==undefined)this.movementSpeed=a.movementSpeed;if(a.lookSpeed!==undefined)this.lookSpeed=a.lookSpeed;if(a.noFly!==undefined)this.noFly=
a.noFly;if(a.lookVertical!==undefined)this.lookVertical=a.lookVertical;if(a.autoForward!==undefined)this.autoForward=a.autoForward;if(a.dragToLook!==undefined)this.dragToLook=a.dragToLook;if(a.heightSpeed!==undefined)this.heightSpeed=a.heightSpeed;if(a.heightCoef!==undefined)this.heightCoef=a.heightCoef;if(a.heightMin!==undefined)this.heightMin=a.heightMin;if(a.heightMax!==undefined)this.heightMax=a.heightMax;if(a.domElement!==undefined)this.domElement=a.domElement}this.theta=this.phi=this.lon=this.lat=
this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.moveForward=!1;this.moveBackward=!1;this.moveLeft=!1;this.moveRight=!1;this.mouseDragOn=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(!this.dragToLook)switch(b.button){case 0:this.moveForward=
!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
!1;break;case 39:case 68:this.moveRight=!1}};this.update=function(){this.autoSpeedFactor=this.heightSpeed?((this.position.y<this.heightMin?this.heightMin:this.position.y>this.heightMax?this.heightMax:this.position.y)-this.heightMin)*this.heightCoef:0;(this.moveForward||this.autoForward)&&this.translateZ(-(this.movementSpeed+this.autoSpeedFactor));this.moveBackward&&this.translateZ(this.movementSpeed);this.moveLeft&&this.translateX(-this.movementSpeed);this.moveRight&&this.translateX(this.movementSpeed);
var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var d=this.position;b.x=d.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=d.y+100*Math.cos(this.phi);b.z=d.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
var b=this.lookSpeed;this.dragToLook&&!this.mouseDragOn&&(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;b=this.target.position;var e=this.position;b.x=e.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=e.y+100*Math.cos(this.phi);b.z=e.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};THREE.QuakeCamera.prototype=new THREE.Camera;THREE.QuakeCamera.prototype.constructor=THREE.QuakeCamera;THREE.QuakeCamera.prototype.supr=THREE.Camera.prototype;
THREE.QuakeCamera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};
THREE.PathCamera=function(a){function c(n,q,x,z){var p={name:x,fps:0.6,length:z,hierarchy:[]},A,G=q.getControlPointsArray(),I=q.getLength(),C=G.length,J=0;A=C-1;q={parent:-1,keys:[]};q.keys[0]={time:0,pos:G[0],rot:[0,0,0,1],scl:[1,1,1]};q.keys[A]={time:z,pos:G[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<C-1;A++){J=z*I.chunks[A]/I.total;q.keys[A]={time:J,pos:G[A]}}p.hierarchy[0]=q;THREE.AnimationHandler.add(p);return new THREE.Animation(n,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(n,q){var x,
z,p=new THREE.Geometry;for(x=0;x<n.points.length*q;x++){z=x/(n.points.length*q);z=n.getPoint(z);p.vertices[x]=new THREE.Vertex(new THREE.Vector3(z.x,z.y,z.z))}return p}function d(n,q){var x=b(q,10),z=b(q,10),p=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,p);particleObj=new THREE.ParticleSystem(z,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);n.addChild(lineObj);particleObj.scale.set(1,1,1);n.addChild(particleObj);z=new Sphere(1,
16,8);p=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<q.points.length;i++){x=new THREE.Mesh(z,p);x.position.copy(q.points[i]);x.updateMatrix();n.addChild(x)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookVertical=
THREE.PathCamera=function(a){function c(n,p,x,y){var o={name:x,fps:0.6,length:y,hierarchy:[]},A,G=p.getControlPointsArray(),J=p.getLength(),D=G.length,K=0;A=D-1;p={parent:-1,keys:[]};p.keys[0]={time:0,pos:G[0],rot:[0,0,0,1],scl:[1,1,1]};p.keys[A]={time:y,pos:G[A],rot:[0,0,0,1],scl:[1,1,1]};for(A=1;A<D-1;A++){K=y*J.chunks[A]/J.total;p.keys[A]={time:K,pos:G[A]}}o.hierarchy[0]=p;THREE.AnimationHandler.add(o);return new THREE.Animation(n,x,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function b(n,p){var x,
y,o=new THREE.Geometry;for(x=0;x<n.points.length*p;x++){y=x/(n.points.length*p);y=n.getPoint(y);o.vertices[x]=new THREE.Vertex(new THREE.Vector3(y.x,y.y,y.z))}return o}function e(n,p){var x=b(p,10),y=b(p,10),o=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(x,o);particleObj=new THREE.ParticleSystem(y,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);n.addChild(lineObj);particleObj.scale.set(1,1,1);n.addChild(particleObj);y=new Sphere(1,
16,8);o=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<p.points.length;i++){x=new THREE.Mesh(y,o);x.position.copy(p.points[i]);x.updateMatrix();n.addChild(x)}}THREE.Camera.call(this,a.fov,a.aspect,a.near,a.far,a.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.005;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(n,q,x){var z,p;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;p=this.verticalAngleMap.dstRange;
this.phi=(this.phi-z[0])*(p[1]-p[0])/(z[1]-z[0])+p[0];z=this.horizontalAngleMap.srcRange;p=this.horizontalAngleMap.dstRange;this.theta=(this.theta-z[0])*(p[1]-p[0])/(z[1]-z[0])+p[0];z=this.target.position;z.x=100*Math.sin(this.phi)*Math.cos(this.theta);z.y=100*Math.cos(this.phi);z.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,n,q,x)};this.onMouseMove=function(n){this.mouseX=n.clientX-this.windowHalfX;this.mouseY=n.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var f=Math.PI*2,g=Math.PI/180;this.update=function(n,p,x){var y,o;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;o=this.verticalAngleMap.dstRange;
this.phi=(this.phi-y[0])*(o[1]-o[0])/(y[1]-y[0])+o[0];y=this.horizontalAngleMap.srcRange;o=this.horizontalAngleMap.dstRange;this.theta=(this.theta-y[0])*(o[1]-o[0])/(y[1]-y[0])+o[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,n,p,x)};this.onMouseMove=function(n){this.mouseX=n.clientX-this.windowHalfX;this.mouseY=n.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);
this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){a=new THREE.MeshLambertMaterial({color:30719});var h=new THREE.MeshLambertMaterial({color:65280}),k=new Cube(10,10,20),m=new Cube(2,2,10);this.animationParent=new THREE.Mesh(k,a);a=new THREE.Mesh(m,h);a.position.set(0,10,0);this.animation=c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(a)}else{this.animation=
c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&d(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(n,q){return function(){q.apply(n,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
var Cube=function(a,c,b,d,f,g,h,k,m){function n(I,C,J,B,U,P,O,V){var Y,e,ja=d||1,X=f||1,W=U/2,wa=P/2,ha=q.vertices.length;if(I=="x"&&C=="y"||I=="y"&&C=="x")Y="z";else if(I=="x"&&C=="z"||I=="z"&&C=="x"){Y="y";X=g||1}else if(I=="z"&&C=="y"||I=="y"&&C=="z"){Y="x";ja=g||1}var Aa=ja+1,ka=X+1;U/=ja;var oa=P/X;for(e=0;e<ka;e++)for(P=0;P<Aa;P++){var ma=new THREE.Vector3;ma[I]=(P*U-W)*J;ma[C]=(e*oa-wa)*B;ma[Y]=O;q.vertices.push(new THREE.Vertex(ma))}for(e=0;e<X;e++)for(P=0;P<ja;P++){q.faces.push(new THREE.Face4(P+
Aa*e+ha,P+Aa*(e+1)+ha,P+1+Aa*(e+1)+ha,P+1+Aa*e+ha,null,null,V));q.faceVertexUvs[0].push([new THREE.UV(P/ja,e/X),new THREE.UV(P/ja,(e+1)/X),new THREE.UV((P+1)/ja,(e+1)/X),new THREE.UV((P+1)/ja,e/X)])}}THREE.Geometry.call(this);var q=this,x=a/2,z=c/2,p=b/2;k=k?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var A=0;A<6;A++)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 G in m)this.sides[G]!=
undefined&&(this.sides[G]=m[G]);this.sides.px&&n("z","y",1*k,-1,b,c,-x,this.materials[0]);this.sides.nx&&n("z","y",-1*k,-1,b,c,x,this.materials[1]);this.sides.py&&n("x","z",1*k,1,a,b,z,this.materials[2]);this.sides.ny&&n("x","z",1*k,-1,a,b,-z,this.materials[3]);this.sides.pz&&n("x","y",1*k,-1,a,c,p,this.materials[4]);this.sides.nz&&n("x","y",-1*k,-1,a,c,-p,this.materials[5]);(function(){for(var I=[],C=[],J=0,B=q.vertices.length;J<B;J++){for(var U=q.vertices[J],P=!1,O=0,V=I.length;O<V;O++){var Y=I[O];
if(U.position.x==Y.position.x&&U.position.y==Y.position.y&&U.position.z==Y.position.z){C[J]=O;P=!0;break}}if(!P){C[J]=I.length;I.push(new THREE.Vertex(U.position.clone()))}}J=0;for(B=q.faces.length;J<B;J++){U=q.faces[J];U.a=C[U.a];U.b=C[U.b];U.c=C[U.c];U.d=C[U.d]}q.vertices=I})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
var Cylinder=function(a,c,b,d,f,g){function h(q,x,z){k.vertices.push(new THREE.Vertex(new THREE.Vector3(q,x,z)))}THREE.Geometry.call(this);var k=this,m=Math.PI,n=d/2;for(d=0;d<a;d++)h(Math.sin(2*m*d/a)*c,Math.cos(2*m*d/a)*c,-n);for(d=0;d<a;d++)h(Math.sin(2*m*d/a)*b,Math.cos(2*m*d/a)*b,n);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){h(0,0,-n-(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){h(0,0,n+(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,p){var A=Math.sqrt(x*x+z*z+p*p);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(x/A,z/A,p/A)))-1}function b(x,z,p,A){A.faces.push(new THREE.Face3(x,z,p))}function d(x,z){var p=f.vertices[x].position,A=f.vertices[z].position;return c((p.x+A.x)/2,(p.y+A.y)/2,(p.z+A.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var m=d(g.faces[k].a,g.faces[k].b),n=d(g.faces[k].b,g.faces[k].c),q=d(g.faces[k].c,g.faces[k].a);b(g.faces[k].a,m,q,h);b(g.faces[k].b,n,m,h);b(g.faces[k].c,
q,n,h);b(m,n,q,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 d=[],f=[],g=[],h=[],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),n=0;n<=this.angle+0.0010;n+=c){for(k=0;k<d.length;k++)if(n<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=h;n==0&&(h=f);for(k=
c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this.target);this.animationParent.addChild(this)}this.createDebugPath&&e(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(n,p){return function(){p.apply(n,arguments)}}(this,this.onMouseMove),!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
var Cube=function(a,c,b,e,f,g,h,k,m){function n(J,D,K,C,U,P,O,W){var Y,d,ja=e||1,X=f||1,V=U/2,va=P/2,ga=p.vertices.length;if(J=="x"&&D=="y"||J=="y"&&D=="x")Y="z";else if(J=="x"&&D=="z"||J=="z"&&D=="x"){Y="y";X=g||1}else if(J=="z"&&D=="y"||J=="y"&&D=="z"){Y="x";ja=g||1}var za=ja+1,la=X+1;U/=ja;var oa=P/X;for(d=0;d<la;d++)for(P=0;P<za;P++){var ma=new THREE.Vector3;ma[J]=(P*U-V)*K;ma[D]=(d*oa-va)*C;ma[Y]=O;p.vertices.push(new THREE.Vertex(ma))}for(d=0;d<X;d++)for(P=0;P<ja;P++){p.faces.push(new THREE.Face4(P+
za*d+ga,P+za*(d+1)+ga,P+1+za*(d+1)+ga,P+1+za*d+ga,null,null,W));p.faceVertexUvs[0].push([new THREE.UV(P/ja,d/X),new THREE.UV(P/ja,(d+1)/X),new THREE.UV((P+1)/ja,(d+1)/X),new THREE.UV((P+1)/ja,d/X)])}}THREE.Geometry.call(this);var p=this,x=a/2,y=c/2,o=b/2;k=k?-1:1;if(h!==undefined)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var A=0;A<6;A++)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 G in m)this.sides[G]!=
undefined&&(this.sides[G]=m[G]);this.sides.px&&n("z","y",1*k,-1,b,c,-x,this.materials[0]);this.sides.nx&&n("z","y",-1*k,-1,b,c,x,this.materials[1]);this.sides.py&&n("x","z",1*k,1,a,b,y,this.materials[2]);this.sides.ny&&n("x","z",1*k,-1,a,b,-y,this.materials[3]);this.sides.pz&&n("x","y",1*k,-1,a,c,o,this.materials[4]);this.sides.nz&&n("x","y",-1*k,-1,a,c,-o,this.materials[5]);(function(){for(var J=[],D=[],K=0,C=p.vertices.length;K<C;K++){for(var U=p.vertices[K],P=!1,O=0,W=J.length;O<W;O++){var Y=J[O];
if(U.position.x==Y.position.x&&U.position.y==Y.position.y&&U.position.z==Y.position.z){D[K]=O;P=!0;break}}if(!P){D[K]=J.length;J.push(new THREE.Vertex(U.position.clone()))}}K=0;for(C=p.faces.length;K<C;K++){U=p.faces[K];U.a=D[U.a];U.b=D[U.b];U.c=D[U.c];U.d=D[U.d]}p.vertices=J})();this.computeCentroids();this.computeFaceNormals()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
var Cylinder=function(a,c,b,e,f,g){function h(p,x,y){k.vertices.push(new THREE.Vertex(new THREE.Vector3(p,x,y)))}THREE.Geometry.call(this);var k=this,m=Math.PI,n=e/2;for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*c,Math.cos(2*m*e/a)*c,-n);for(e=0;e<a;e++)h(Math.sin(2*m*e/a)*b,Math.cos(2*m*e/a)*b,n);for(e=0;e<a;e++)k.faces.push(new THREE.Face4(e,e+a,a+(e+1)%a,(e+1)%a));if(b>0){h(0,0,-n-(g||0));for(e=a;e<a+a/2;e++)k.faces.push(new THREE.Face4(2*a,(2*e-2*a)%a,(2*e-2*a+1)%a,(2*e-2*a+2)%a))}if(c>0){h(0,0,n+(f||0));
for(e=a+a/2;e<2*a;e++)k.faces.push(new THREE.Face4(2*a+1,(2*e-2*a+2)%a+a,(2*e-2*a+1)%a+a,(2*e-2*a)%a+a))}this.computeCentroids();this.computeFaceNormals()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
var Icosahedron=function(a){function c(x,y,o){var A=Math.sqrt(x*x+y*y+o*o);return f.vertices.push(new THREE.Vertex(new THREE.Vector3(x/A,y/A,o/A)))-1}function b(x,y,o,A){A.faces.push(new THREE.Face3(x,y,o))}function e(x,y){var o=f.vertices[x].position,A=f.vertices[y].position;return c((o.x+A.x)/2,(o.y+A.y)/2,(o.z+A.z)/2)}var f=this,g=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,g);b(0,5,1,g);b(0,1,7,g);b(0,7,10,g);b(0,10,11,g);b(1,5,9,g);b(5,11,4,g);b(11,10,2,g);b(10,7,6,g);b(7,1,8,g);b(3,9,4,g);b(3,4,2,g);b(3,2,6,g);b(3,6,8,g);b(3,8,9,g);b(4,9,5,g);b(2,4,11,g);b(6,2,10,g);b(8,6,7,g);b(9,8,1,g);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in g.faces){var m=e(g.faces[k].a,g.faces[k].b),n=e(g.faces[k].b,g.faces[k].c),p=e(g.faces[k].c,g.faces[k].a);b(g.faces[k].a,m,p,h);b(g.faces[k].b,n,m,h);b(g.faces[k].c,
p,n,h);b(m,n,p,h)}g.faces=h.faces}f.faces=g.faces;delete g;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
function Lathe(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;c=this.angle/this.steps;for(var e=[],f=[],g=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));e[k]=a[k].clone();f[k]=this.vertices.length-1}for(var m=(new THREE.Matrix4).setRotationZ(c),n=0;n<=this.angle+0.001;n+=c){for(k=0;k<e.length;k++)if(n<this.angle){e[k]=m.multiplyVector3(e[k].clone());this.vertices.push(new THREE.Vertex(e[k]));g[k]=this.vertices.length-1}else g=h;n==0&&(h=f);for(k=
0;k<f.length-1;k++){this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k]));this.faceVertexUvs[0].push([new THREE.UV(n/b,k/a.length),new THREE.UV(n/b,(k+1)/a.length),new THREE.UV((n-c)/b,(k+1)/a.length),new THREE.UV((n-c)/b,k/a.length)])}f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}Lathe.prototype=new THREE.Geometry;Lathe.prototype.constructor=Lathe;
var Plane=function(a,c,b,d){THREE.Geometry.call(this);var f,g=a/2,h=c/2;b=b||1;d=d||1;var k=b+1,m=d+1;a/=b;var n=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*n-h),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()};
var Plane=function(a,c,b,e){THREE.Geometry.call(this);var f,g=a/2,h=c/2;b=b||1;e=e||1;var k=b+1,m=e+1;a/=b;var n=c/e;for(f=0;f<m;f++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-g,-(f*n-h),0)));for(f=0;f<e;f++)for(c=0;c<b;c++){this.faces.push(new THREE.Face4(c+k*f,c+k*(f+1),c+1+k*(f+1),c+1+k*f));this.faceVertexUvs[0].push([new THREE.UV(c/b,f/e),new THREE.UV(c/b,(f+1)/e),new THREE.UV((c+1)/b,(f+1)/e),new THREE.UV((c+1)/b,f/e)])}this.computeCentroids();this.computeFaceNormals()};
Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
var Sphere=function(a,c,b){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){d=b/h;var k=a*Math.cos(d*f),m=a*Math.sin(d*f),n=[],q=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==h)&&d>0||(q=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,z)))-1);n.push(q)}c.push(n)}var p,A,G;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(d=0;d<g;d++){n=d==g-1;h=c[b][n?0:d+1];k=c[b][n?g-1:d];m=c[b-1][n?g-1:d];n=c[b-1][n?
0:d+1];z=b/(f-1);p=(b-1)/(f-1);A=(d+1)/g;x=d/g;q=new THREE.UV(1-A,z);z=new THREE.UV(1-x,z);x=new THREE.UV(1-x,p);var I=new THREE.UV(1-A,p);if(b<c.length-1){p=this.vertices[h].position.clone();A=this.vertices[k].position.clone();G=this.vertices[m].position.clone();p.normalize();A.normalize();G.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([q,z,x])}if(b>1){p=this.vertices[h].position.clone();
A=this.vertices[m].position.clone();G=this.vertices[n].position.clone();p.normalize();A.normalize();G.normalize();this.faces.push(new THREE.Face3(h,m,n,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([q,x,I])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
var Torus=function(a,c,b,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,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(d,f,g,h));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[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
var TorusKnot=function(a,c,b,d,f,g,h){function k(x,z,p,A,G,I){z=p/A*x;p=Math.cos(z);return new THREE.Vector3(G*(2+p)*0.5*Math.cos(x),G*(2+p)*Math.sin(x)*0.5,I*G*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=h||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;g=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<this.segmentsT;++c){var m=
a/this.segmentsR*2*this.p*Math.PI;h=c/this.segmentsT*2*Math.PI;f=k(m,h,this.q,this.p,this.radius,this.heightScale);m=k(m+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=m.x-f.x;b.y=m.y-f.y;b.z=m.z-f.z;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(h);h=this.tube*Math.sin(h);f.x+=m*d.x+h*g.x;f.y+=m*d.y+h*g.y;f.z+=m*d.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];d=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);m=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),q=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(f,b,d));this.faceVertexUvs[0].push([h,m,n]);this.faces.push(new THREE.Face3(g,d,b));this.faceVertexUvs[0].push([q,
var Sphere=function(a,c,b){THREE.Geometry.call(this);var e,f=Math.PI,g=Math.max(3,c||8),h=Math.max(2,b||6);c=[];for(b=0;b<h+1;b++){e=b/h;var k=a*Math.cos(e*f),m=a*Math.sin(e*f),n=[],p=0;for(e=0;e<g;e++){var x=2*e/g,y=m*Math.sin(x*f);x=m*Math.cos(x*f);(b==0||b==h)&&e>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(x,k,y)))-1);n.push(p)}c.push(n)}var o,A,G;f=c.length;for(b=0;b<f;b++){g=c[b].length;if(b>0)for(e=0;e<g;e++){n=e==g-1;h=c[b][n?0:e+1];k=c[b][n?g-1:e];m=c[b-1][n?g-1:e];n=c[b-1][n?
0:e+1];y=b/(f-1);o=(b-1)/(f-1);A=(e+1)/g;x=e/g;p=new THREE.UV(1-A,y);y=new THREE.UV(1-x,y);x=new THREE.UV(1-x,o);var J=new THREE.UV(1-A,o);if(b<c.length-1){o=this.vertices[h].position.clone();A=this.vertices[k].position.clone();G=this.vertices[m].position.clone();o.normalize();A.normalize();G.normalize();this.faces.push(new THREE.Face3(h,k,m,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([p,y,x])}if(b>1){o=this.vertices[h].position.clone();
A=this.vertices[m].position.clone();G=this.vertices[n].position.clone();o.normalize();A.normalize();G.normalize();this.faces.push(new THREE.Face3(h,m,n,[new THREE.Vector3(o.x,o.y,o.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(G.x,G.y,G.z)]));this.faceVertexUvs[0].push([p,x,J])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
var Torus=function(a,c,b,e){this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(b=0;b<=this.segmentsT;++b){e=b/this.segmentsT*2*Math.PI;var f=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(f))*Math.cos(e),(this.radius+this.tube*Math.cos(f))*Math.sin(e),this.tube*Math.sin(f))));a.push([b/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(b=
1;b<=this.segmentsT;++b){e=(this.segmentsT+1)*c+b;f=(this.segmentsT+1)*c+b-1;var g=(this.segmentsT+1)*(c-1)+b-1,h=(this.segmentsT+1)*(c-1)+b;this.faces.push(new THREE.Face4(e,f,g,h));this.faceVertexUvs[0].push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
var TorusKnot=function(a,c,b,e,f,g,h){function k(x,y,o,A,G,J){y=o/A*x;o=Math.cos(y);return new THREE.Vector3(G*(2+o)*0.5*Math.cos(x),G*(2+o)*Math.sin(x)*0.5,J*G*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=k(m,h,this.q,this.p,this.radius,this.heightScale);m=k(m+0.01,h,this.q,this.p,this.radius,this.heightScale);b.x=m.x-f.x;b.y=m.y-f.y;b.z=m.z-f.z;e.x=m.x+f.x;e.y=m.y+f.y;e.z=m.z+f.z;g.cross(b,e);e.cross(g,b);g.normalize();e.normalize();m=this.tube*Math.cos(h);h=this.tube*Math.sin(h);f.x+=m*e.x+h*g.x;f.y+=m*e.y+h*g.y;f.z+=m*e.z+h*g.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=
0;c<this.segmentsT;++c){g=(a+1)%this.segmentsR;h=(c+1)%this.segmentsT;f=this.grid[a][c];b=this.grid[g][c];e=this.grid[a][h];g=this.grid[g][h];h=new THREE.UV(a/this.segmentsR,c/this.segmentsT);m=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT);var n=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face3(f,b,e));this.faceVertexUvs[0].push([h,m,n]);this.faces.push(new THREE.Face3(g,e,b));this.faceVertexUvs[0].push([p,
n,m])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};TorusKnot.prototype=new THREE.Geometry;TorusKnot.prototype.constructor=TorusKnot;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null};
THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(c[d],b)]},createMaterial:function(a,c){function b(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function d(k,m){var n=new Image;n.onload=function(){if(!b(this.width)||!b(this.height)){var q=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=q;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,q,x)}else k.image=this;k.needsUpdate=!0};n.src=m}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};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;d(g.map,c+"/"+a.mapDiffuse)}else if(a.colorDiffuse){h=
(a.colorDiffuse[0]*255<<16)+(a.colorDiffuse[1]*255<<8)+a.colorDiffuse[2]*255;g.color=h;g.opacity=a.transparency}else if(a.DbgColor)g.color=a.DbgColor;if(a.mapLightmap&&c){h=document.createElement("canvas");g.lightMap=new THREE.Texture(h);g.lightMap.sourceFile=a.mapLightmap;d(g.lightMap,c+"/"+a.mapLightmap)}return new THREE[f](g)}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")},init_materials:function(a,c,b){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],b)]},createMaterial:function(a,c){function b(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function e(k,m){var n=new Image;n.onload=function(){if(!b(this.width)||!b(this.height)){var p=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),x=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));
k.image.width=p;k.image.height=x;k.image.getContext("2d").drawImage(this,0,0,p,x)}else k.image=this;k.needsUpdate=!0};n.src=m}var f,g,h;f="MeshLambertMaterial";g={color:15658734,opacity:1,map:null,lightMap:null,vertexColors:a.vertexColors?THREE.VertexColors:!1};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=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(f){THREE.JSONLoader.prototype.createModel(f.data,b,d)};c.postMessage(a)},createModel:function(a,c,b){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
else{var h,k,m,n,q,x,z,p,A,G,I=a.faces;p=a.vertices;var C=a.normals,J=a.colors,B=0;for(h=0;h<a.uvs.length;h++)a.uvs[h].length&&B++;for(h=0;h<B;h++){g.faceUvs[h]=[];g.faceVertexUvs[h]=[]}m=0;for(n=p.length;m<n;){A=new THREE.Vertex;A.position.x=p[m++];A.position.y=p[m++];A.position.z=p[m++];g.vertices.push(A)}m=0;for(n=I.length;m<n;){q=I[m++];x=q&1;h=q&2;z=q&4;k=q&8;p=q&16;A=q&32;G=q&64;q&=128;if(x){x=new THREE.Face4;x.a=I[m++];x.b=I[m++];x.c=I[m++];x.d=I[m++];nVertices=4}else{x=new THREE.Face3;x.a=
I[m++];x.b=I[m++];x.c=I[m++];nVertices=3}if(h){materialIndex=I[m++];x.materials=g.materials[materialIndex]}if(z)for(h=0;h<B;h++){uvLayer=a.uvs[h];uvIndex=I[m++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];g.faceUvs[h].push(new THREE.UV(u,v))}if(k)for(h=0;h<B;h++){uvLayer=a.uvs[h];uvs=[];for(k=0;k<nVertices;k++){uvIndex=I[m++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[k]=new THREE.UV(u,v)}k=g.faces.length;g.faceVertexUvs[h][k]=uvs}if(p){normalIndex=I[m++]*3;normal=new THREE.Vector3;normal.x=
C[normalIndex++];normal.y=C[normalIndex++];normal.z=C[normalIndex];x.normal=normal}if(A)for(h=0;h<nVertices;h++){normalIndex=I[m++]*3;normal=new THREE.Vector3;normal.x=C[normalIndex++];normal.y=C[normalIndex++];normal.z=C[normalIndex];x.vertexNormals.push(normal)}if(G){color=new THREE.Color(I[m++]);x.color=color}if(q)for(h=0;h<nVertices;h++){colorIndex=I[m++];color=new THREE.Color(J[colorIndex]);x.vertexColors.push(color)}g.faces.push(x)}}})();(function(){var h,k,m,n;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<
THREE.JSONLoader.prototype={load:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(f){THREE.JSONLoader.prototype.createModel(f.data,b,e)};c.postMessage(a)},createModel:function(a,c,b){var e=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){if(a.version===undefined||a.version!=2)console.error("Deprecated file format.");
else{var h,k,m,n,p,x,y,o,A,G,J=a.faces;o=a.vertices;var D=a.normals,K=a.colors,C=0;for(h=0;h<a.uvs.length;h++)a.uvs[h].length&&C++;for(h=0;h<C;h++){g.faceUvs[h]=[];g.faceVertexUvs[h]=[]}m=0;for(n=o.length;m<n;){A=new THREE.Vertex;A.position.x=o[m++];A.position.y=o[m++];A.position.z=o[m++];g.vertices.push(A)}m=0;for(n=J.length;m<n;){p=J[m++];x=p&1;h=p&2;y=p&4;k=p&8;o=p&16;A=p&32;G=p&64;p&=128;if(x){x=new THREE.Face4;x.a=J[m++];x.b=J[m++];x.c=J[m++];x.d=J[m++];nVertices=4}else{x=new THREE.Face3;x.a=
J[m++];x.b=J[m++];x.c=J[m++];nVertices=3}if(h){materialIndex=J[m++];x.materials=g.materials[materialIndex]}if(y)for(h=0;h<C;h++){uvLayer=a.uvs[h];uvIndex=J[m++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];g.faceUvs[h].push(new THREE.UV(u,v))}if(k)for(h=0;h<C;h++){uvLayer=a.uvs[h];uvs=[];for(k=0;k<nVertices;k++){uvIndex=J[m++];u=uvLayer[uvIndex*2];v=uvLayer[uvIndex*2+1];uvs[k]=new THREE.UV(u,v)}k=g.faces.length;g.faceVertexUvs[h][k]=uvs}if(o){normalIndex=J[m++]*3;normal=new THREE.Vector3;normal.x=
D[normalIndex++];normal.y=D[normalIndex++];normal.z=D[normalIndex];x.normal=normal}if(A)for(h=0;h<nVertices;h++){normalIndex=J[m++]*3;normal=new THREE.Vector3;normal.x=D[normalIndex++];normal.y=D[normalIndex++];normal.z=D[normalIndex];x.vertexNormals.push(normal)}if(G){color=new THREE.Color(J[m++]);x.color=color}if(p)for(h=0;h<nVertices;h++){colorIndex=J[m++];color=new THREE.Color(K[colorIndex]);x.vertexColors.push(color)}g.faces.push(x)}}})();(function(){var h,k,m,n;if(a.skinWeights){h=0;for(k=a.skinWeights.length;h<
k;h+=2){m=a.skinWeights[h];n=a.skinWeights[h+1];g.skinWeights.push(new THREE.Vector4(m,n,0,0))}}if(a.skinIndices){h=0;for(k=a.skinIndices.length;h<k;h+=2){m=a.skinIndices[h];n=a.skinIndices[h+1];g.skinIndices.push(new THREE.Vector4(m,n,0,0))}}g.bones=a.bones;g.animation=a.animation})();(function(){if(a.morphTargets!==undefined){var h,k,m,n;h=0;for(k=a.morphTargets.length;h<k;h++){g.morphTargets[h]={};g.morphTargets[h].name=a.morphTargets[h].name;g.morphTargets[h].vertices=[];dstVertices=g.morphTargets[h].vertices;
srcVertices=a.morphTargets[h].vertices;m=0;for(n=srcVertices.length;m<n;m+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[m],srcVertices[m+1],srcVertices[m+2])))}}})();this.computeCentroids();this.computeFaceNormals()};d.prototype=new THREE.Geometry;d.prototype.constructor=d;c(new d(b))}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
srcVertices=a.morphTargets[h].vertices;m=0;for(n=srcVertices.length;m<n;m+=3)dstVertices.push(new THREE.Vertex(new THREE.Vector3(srcVertices[m],srcVertices[m+1],srcVertices[m+2])))}}})();this.computeCentroids();this.computeFaceNormals()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(b))}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,d=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),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,d,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};
c.postMessage(a)},loadAjaxBuffers:function(a,c,b,d,f,g){var h=new XMLHttpRequest,k=d+"/"+a,m=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,f,c):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){m==0&&(m=h.getResponseHeader("Content-Length"));g({total:m,loaded:h.responseText.length})}}else h.readyState==2&&(m=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,d){var f=function(g){function h(j,w){var t=q(j,w),o=q(j,w+1),y=q(j,w+2),E=q(j,w+3),K=(E<<1&255|y>>7)-127;t|=(y&127)<<16|o<<8;if(t==0&&K==-127)return 0;return(1-2*(E>>7))*(1+t*Math.pow(2,-23))*Math.pow(2,K)}function k(j,w){var t=q(j,w),o=q(j,w+1),y=q(j,w+2);return(q(j,w+3)<<24)+(y<<16)+(o<<8)+t}function m(j,w){var t=q(j,w);return(q(j,w+1)<<8)+t}function n(j,w){var t=q(j,w);return t>127?t-256:t}function q(j,
w){return j.charCodeAt(w)&255}function x(j){var w,t,o;w=k(a,j);t=k(a,j+O);o=k(a,j+V);j=m(a,j+Y);THREE.BinaryLoader.prototype.f3(C,w,t,o,j)}function z(j){var w,t,o,y,E,K;w=k(a,j);t=k(a,j+O);o=k(a,j+V);y=m(a,j+Y);E=k(a,j+e);K=k(a,j+ja);j=k(a,j+X);THREE.BinaryLoader.prototype.f3n(C,U,w,t,o,y,E,K,j)}function p(j){var w,t,o,y;w=k(a,j);t=k(a,j+W);o=k(a,j+wa);y=k(a,j+ha);j=m(a,j+Aa);THREE.BinaryLoader.prototype.f4(C,w,t,o,y,j)}function A(j){var w,t,o,y,E,K,F,D;w=k(a,j);t=k(a,j+W);o=k(a,j+wa);y=k(a,j+ha);
E=m(a,j+Aa);K=k(a,j+ka);F=k(a,j+oa);D=k(a,j+ma);j=k(a,j+ca);THREE.BinaryLoader.prototype.f4n(C,U,w,t,o,y,E,K,F,D,j)}function G(j){var w,t;w=k(a,j);t=k(a,j+S);j=k(a,j+M);THREE.BinaryLoader.prototype.uv3(C.faceVertexUvs[0],P[w*2],P[w*2+1],P[t*2],P[t*2+1],P[j*2],P[j*2+1])}function I(j){var w,t,o;w=k(a,j);t=k(a,j+fa);o=k(a,j+ra);j=k(a,j+la);THREE.BinaryLoader.prototype.uv4(C.faceVertexUvs[0],P[w*2],P[w*2+1],P[t*2],P[t*2+1],P[o*2],P[o*2+1],P[j*2],P[j*2+1])}var C=this,J=0,B,U=[],P=[],O,V,Y,e,ja,X,W,wa,
ha,Aa,ka,oa,ma,ca,S,M,fa,ra,la,qa,xa,Ca,Za,$a,Ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,d,g);B={signature:a.substr(J,8),header_bytes:q(a,J+8),vertex_coordinate_bytes:q(a,J+9),normal_coordinate_bytes:q(a,J+10),uv_coordinate_bytes:q(a,J+11),vertex_index_bytes:q(a,J+12),normal_index_bytes:q(a,J+13),uv_index_bytes:q(a,J+14),material_index_bytes:q(a,J+15),nvertices:k(a,J+16),nnormals:k(a,J+16+4),nuvs:k(a,J+16+8),ntri_flat:k(a,J+16+12),ntri_smooth:k(a,J+16+16),ntri_flat_uv:k(a,
J+16+20),ntri_smooth_uv:k(a,J+16+24),nquad_flat:k(a,J+16+28),nquad_smooth:k(a,J+16+32),nquad_flat_uv:k(a,J+16+36),nquad_smooth_uv:k(a,J+16+40)};J+=B.header_bytes;O=B.vertex_index_bytes;V=B.vertex_index_bytes*2;Y=B.vertex_index_bytes*3;e=B.vertex_index_bytes*3+B.material_index_bytes;ja=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes;X=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*2;W=B.vertex_index_bytes;wa=B.vertex_index_bytes*2;ha=B.vertex_index_bytes*3;Aa=
B.vertex_index_bytes*4;ka=B.vertex_index_bytes*4+B.material_index_bytes;oa=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes;ma=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*2;ca=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*3;S=B.uv_index_bytes;M=B.uv_index_bytes*2;fa=B.uv_index_bytes;ra=B.uv_index_bytes*2;la=B.uv_index_bytes*3;g=B.vertex_index_bytes*3+B.material_index_bytes;Ha=B.vertex_index_bytes*4+B.material_index_bytes;qa=B.ntri_flat*
g;xa=B.ntri_smooth*(g+B.normal_index_bytes*3);Ca=B.ntri_flat_uv*(g+B.uv_index_bytes*3);Za=B.ntri_smooth_uv*(g+B.normal_index_bytes*3+B.uv_index_bytes*3);$a=B.nquad_flat*Ha;g=B.nquad_smooth*(Ha+B.normal_index_bytes*4);Ha=B.nquad_flat_uv*(Ha+B.uv_index_bytes*4);J+=function(j){for(var w,t,o,y=B.vertex_coordinate_bytes*3,E=j+B.nvertices*y;j<E;j+=y){w=h(a,j);t=h(a,j+B.vertex_coordinate_bytes);o=h(a,j+B.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(C,w,t,o)}return B.nvertices*y}(J);J+=function(j){for(var w,
t,o,y=B.normal_coordinate_bytes*3,E=j+B.nnormals*y;j<E;j+=y){w=n(a,j);t=n(a,j+B.normal_coordinate_bytes);o=n(a,j+B.normal_coordinate_bytes*2);U.push(w/127,t/127,o/127)}return B.nnormals*y}(J);J+=function(j){for(var w,t,o=B.uv_coordinate_bytes*2,y=j+B.nuvs*o;j<y;j+=o){w=h(a,j);t=h(a,j+B.uv_coordinate_bytes);P.push(w,t)}return B.nuvs*o}(J);qa=J+qa;xa=qa+xa;Ca=xa+Ca;Za=Ca+Za;$a=Za+$a;g=$a+g;Ha=g+Ha;(function(j){var w,t=B.vertex_index_bytes*3+B.material_index_bytes,o=t+B.uv_index_bytes*3,y=j+B.ntri_flat_uv*
o;for(w=j;w<y;w+=o){x(w);G(w+t)}return y-j})(xa);(function(j){var w,t=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,o=t+B.uv_index_bytes*3,y=j+B.ntri_smooth_uv*o;for(w=j;w<y;w+=o){z(w);G(w+t)}return y-j})(Ca);(function(j){var w,t=B.vertex_index_bytes*4+B.material_index_bytes,o=t+B.uv_index_bytes*4,y=j+B.nquad_flat_uv*o;for(w=j;w<y;w+=o){p(w);I(w+t)}return y-j})(g);(function(j){var w,t=B.vertex_index_bytes*4+B.material_index_bytes+B.normal_index_bytes*4,o=t+B.uv_index_bytes*
4,y=j+B.nquad_smooth_uv*o;for(w=j;w<y;w+=o){A(w);I(w+t)}return y-j})(Ha);(function(j){var w,t=B.vertex_index_bytes*3+B.material_index_bytes,o=j+B.ntri_flat*t;for(w=j;w<o;w+=t)x(w);return o-j})(J);(function(j){var w,t=B.vertex_index_bytes*3+B.material_index_bytes+B.normal_index_bytes*3,o=j+B.ntri_smooth*t;for(w=j;w<o;w+=t)z(w);return o-j})(qa);(function(j){var w,t=B.vertex_index_bytes*4+B.material_index_bytes,o=j+B.nquad_flat*t;for(w=j;w<o;w+=t)p(w);return o-j})(Za);(function(j){var w,t=B.vertex_index_bytes*
4+B.material_index_bytes+B.normal_index_bytes*4,o=j+B.nquad_smooth*t;for(w=j;w<o;w+=t)A(w);return o-j})($a);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,h,k,m){g=a.materials[g];var n=c[k*3],q=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[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(n,q,k),new THREE.Vector3(x,z,m)],null,g))},f4n:function(a,c,b,d,f,g,h,k,m,n,q){h=a.materials[h];var x=c[m*3],z=c[m*3+1];m=c[m*3+2];var p=c[n*3],A=c[n*3+1];n=c[n*3+2];var G=c[q*3],I=c[q*3+1];q=c[q*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(p,A,n),new THREE.Vector3(G,I,q)],null,h))},uv3:function(a,c,b,d,f,g,h){var k=[];k.push(new THREE.UV(c,b));k.push(new THREE.UV(d,f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,c,b,d,f,g,h,k,m){var n=[];n.push(new THREE.UV(c,b));n.push(new THREE.UV(d,f));n.push(new THREE.UV(g,h));n.push(new THREE.UV(k,m));a.push(n)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
THREE.BinaryLoader.prototype={load:function(a){var c=a.model,b=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c),f=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var g=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(h){THREE.BinaryLoader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,b,f,e,g)};c.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};
c.postMessage(a)},loadAjaxBuffers:function(a,c,b,e,f,g){var h=new XMLHttpRequest,k=e+"/"+a,m=0;h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,b,f,c):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(g){m==0&&(m=h.getResponseHeader("Content-Length"));g({total:m,loaded:h.responseText.length})}}else h.readyState==2&&(m=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(a,c,b,e){var f=function(g){function h(j,t){var w=p(j,t),q=p(j,t+1),B=p(j,t+2),F=p(j,t+3),H=(F<<1&255|B>>7)-127;w|=(B&127)<<16|q<<8;if(w==0&&H==-127)return 0;return(1-2*(F>>7))*(1+w*Math.pow(2,-23))*Math.pow(2,H)}function k(j,t){var w=p(j,t),q=p(j,t+1),B=p(j,t+2);return(p(j,t+3)<<24)+(B<<16)+(q<<8)+w}function m(j,t){var w=p(j,t);return(p(j,t+1)<<8)+w}function n(j,t){var w=p(j,t);return w>127?w-256:w}function p(j,
t){return j.charCodeAt(t)&255}function x(j){var t,w,q;t=k(a,j);w=k(a,j+O);q=k(a,j+W);j=m(a,j+Y);THREE.BinaryLoader.prototype.f3(D,t,w,q,j)}function y(j){var t,w,q,B,F,H;t=k(a,j);w=k(a,j+O);q=k(a,j+W);B=m(a,j+Y);F=k(a,j+d);H=k(a,j+ja);j=k(a,j+X);THREE.BinaryLoader.prototype.f3n(D,U,t,w,q,B,F,H,j)}function o(j){var t,w,q,B;t=k(a,j);w=k(a,j+V);q=k(a,j+va);B=k(a,j+ga);j=m(a,j+za);THREE.BinaryLoader.prototype.f4(D,t,w,q,B,j)}function A(j){var t,w,q,B,F,H,E,z;t=k(a,j);w=k(a,j+V);q=k(a,j+va);B=k(a,j+ga);
F=m(a,j+za);H=k(a,j+la);E=k(a,j+oa);z=k(a,j+ma);j=k(a,j+ca);THREE.BinaryLoader.prototype.f4n(D,U,t,w,q,B,F,H,E,z,j)}function G(j){var t,w;t=k(a,j);w=k(a,j+S);j=k(a,j+M);THREE.BinaryLoader.prototype.uv3(D.faceVertexUvs[0],P[t*2],P[t*2+1],P[w*2],P[w*2+1],P[j*2],P[j*2+1])}function J(j){var t,w,q;t=k(a,j);w=k(a,j+fa);q=k(a,j+ra);j=k(a,j+ka);THREE.BinaryLoader.prototype.uv4(D.faceVertexUvs[0],P[t*2],P[t*2+1],P[w*2],P[w*2+1],P[q*2],P[q*2+1],P[j*2],P[j*2+1])}var D=this,K=0,C,U=[],P=[],O,W,Y,d,ja,X,V,va,
ga,za,la,oa,ma,ca,S,M,fa,ra,ka,qa,wa,Ca,Za,$a,Ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(D,e,g);C={signature:a.substr(K,8),header_bytes:p(a,K+8),vertex_coordinate_bytes:p(a,K+9),normal_coordinate_bytes:p(a,K+10),uv_coordinate_bytes:p(a,K+11),vertex_index_bytes:p(a,K+12),normal_index_bytes:p(a,K+13),uv_index_bytes:p(a,K+14),material_index_bytes:p(a,K+15),nvertices:k(a,K+16),nnormals:k(a,K+16+4),nuvs:k(a,K+16+8),ntri_flat:k(a,K+16+12),ntri_smooth:k(a,K+16+16),ntri_flat_uv:k(a,
K+16+20),ntri_smooth_uv:k(a,K+16+24),nquad_flat:k(a,K+16+28),nquad_smooth:k(a,K+16+32),nquad_flat_uv:k(a,K+16+36),nquad_smooth_uv:k(a,K+16+40)};K+=C.header_bytes;O=C.vertex_index_bytes;W=C.vertex_index_bytes*2;Y=C.vertex_index_bytes*3;d=C.vertex_index_bytes*3+C.material_index_bytes;ja=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;X=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;V=C.vertex_index_bytes;va=C.vertex_index_bytes*2;ga=C.vertex_index_bytes*3;za=
C.vertex_index_bytes*4;la=C.vertex_index_bytes*4+C.material_index_bytes;oa=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;ma=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ca=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;S=C.uv_index_bytes;M=C.uv_index_bytes*2;fa=C.uv_index_bytes;ra=C.uv_index_bytes*2;ka=C.uv_index_bytes*3;g=C.vertex_index_bytes*3+C.material_index_bytes;Ha=C.vertex_index_bytes*4+C.material_index_bytes;qa=C.ntri_flat*
g;wa=C.ntri_smooth*(g+C.normal_index_bytes*3);Ca=C.ntri_flat_uv*(g+C.uv_index_bytes*3);Za=C.ntri_smooth_uv*(g+C.normal_index_bytes*3+C.uv_index_bytes*3);$a=C.nquad_flat*Ha;g=C.nquad_smooth*(Ha+C.normal_index_bytes*4);Ha=C.nquad_flat_uv*(Ha+C.uv_index_bytes*4);K+=function(j){for(var t,w,q,B=C.vertex_coordinate_bytes*3,F=j+C.nvertices*B;j<F;j+=B){t=h(a,j);w=h(a,j+C.vertex_coordinate_bytes);q=h(a,j+C.vertex_coordinate_bytes*2);THREE.BinaryLoader.prototype.v(D,t,w,q)}return C.nvertices*B}(K);K+=function(j){for(var t,
w,q,B=C.normal_coordinate_bytes*3,F=j+C.nnormals*B;j<F;j+=B){t=n(a,j);w=n(a,j+C.normal_coordinate_bytes);q=n(a,j+C.normal_coordinate_bytes*2);U.push(t/127,w/127,q/127)}return C.nnormals*B}(K);K+=function(j){for(var t,w,q=C.uv_coordinate_bytes*2,B=j+C.nuvs*q;j<B;j+=q){t=h(a,j);w=h(a,j+C.uv_coordinate_bytes);P.push(t,w)}return C.nuvs*q}(K);qa=K+qa;wa=qa+wa;Ca=wa+Ca;Za=Ca+Za;$a=Za+$a;g=$a+g;Ha=g+Ha;(function(j){var t,w=C.vertex_index_bytes*3+C.material_index_bytes,q=w+C.uv_index_bytes*3,B=j+C.ntri_flat_uv*
q;for(t=j;t<B;t+=q){x(t);G(t+w)}return B-j})(wa);(function(j){var t,w=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,q=w+C.uv_index_bytes*3,B=j+C.ntri_smooth_uv*q;for(t=j;t<B;t+=q){y(t);G(t+w)}return B-j})(Ca);(function(j){var t,w=C.vertex_index_bytes*4+C.material_index_bytes,q=w+C.uv_index_bytes*4,B=j+C.nquad_flat_uv*q;for(t=j;t<B;t+=q){o(t);J(t+w)}return B-j})(g);(function(j){var t,w=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,q=w+C.uv_index_bytes*
4,B=j+C.nquad_smooth_uv*q;for(t=j;t<B;t+=q){A(t);J(t+w)}return B-j})(Ha);(function(j){var t,w=C.vertex_index_bytes*3+C.material_index_bytes,q=j+C.ntri_flat*w;for(t=j;t<q;t+=w)x(t);return q-j})(K);(function(j){var t,w=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,q=j+C.ntri_smooth*w;for(t=j;t<q;t+=w)y(t);return q-j})(qa);(function(j){var t,w=C.vertex_index_bytes*4+C.material_index_bytes,q=j+C.nquad_flat*w;for(t=j;t<q;t+=w)o(t);return q-j})(Za);(function(j){var t,w=C.vertex_index_bytes*
4+C.material_index_bytes+C.normal_index_bytes*4,q=j+C.nquad_smooth*w;for(t=j;t<q;t+=w)A(t);return q-j})($a);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f(b))},v:function(a,c,b,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,b,e)))},f3:function(a,c,b,e,f){a.faces.push(new THREE.Face3(c,b,e,null,null,a.materials[f]))},f4:function(a,c,b,e,f,g){a.faces.push(new THREE.Face4(c,b,e,f,null,null,a.materials[g]))},f3n:function(a,
c,b,e,f,g,h,k,m){g=a.materials[g];var n=c[k*3],p=c[k*3+1];k=c[k*3+2];var x=c[m*3],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(n,p,k),new THREE.Vector3(x,y,m)],null,g))},f4n:function(a,c,b,e,f,g,h,k,m,n,p){h=a.materials[h];var x=c[m*3],y=c[m*3+1];m=c[m*3+2];var o=c[n*3],A=c[n*3+1];n=c[n*3+2];var G=c[p*3],J=c[p*3+1];p=c[p*3+2];a.faces.push(new THREE.Face4(b,e,f,g,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(x,
y,m),new THREE.Vector3(o,A,n),new THREE.Vector3(G,J,p)],null,h))},uv3:function(a,c,b,e,f,g,h){var k=[];k.push(new THREE.UV(c,b));k.push(new THREE.UV(e,f));k.push(new THREE.UV(g,h));a.push(k)},uv4:function(a,c,b,e,f,g,h,k,m){var n=[];n.push(new THREE.UV(c,b));n.push(new THREE.UV(e,f));n.push(new THREE.UV(g,h));n.push(new THREE.UV(k,m));a.push(n)}};if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,d,f){return b+(d-b)*f};this.VIntX=function(b,d,f,g,h,k,m,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=k+h*this.delta;d[g+1]=m;d[g+2]=n;f[g]=this.lerp(q[b],q[b+3],h);f[g+1]=this.lerp(q[b+1],q[b+4],h);f[g+2]=this.lerp(q[b+2],q[b+5],h)};this.VIntY=function(b,d,f,g,h,k,m,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=k;d[g+1]=m+h*this.delta;d[g+
2]=n;d=b+this.yd*3;f[g]=this.lerp(q[b],q[d],h);f[g+1]=this.lerp(q[b+1],q[d+1],h);f[g+2]=this.lerp(q[b+2],q[d+2],h)};this.VIntZ=function(b,d,f,g,h,k,m,n,q,x){h=(h-q)/(x-q);q=this.normal_cache;d[g]=k;d[g+1]=m;d[g+2]=n+h*this.delta;d=b+this.zd*3;f[g]=this.lerp(q[b],q[d],h);f[g+1]=this.lerp(q[b+1],q[d+1],h);f[g+2]=this.lerp(q[b+2],q[d+2],h)};this.compNorm=function(b){var d=b*3;if(this.normal_cache[d]==0){this.normal_cache[d]=this.field[b-1]-this.field[b+1];this.normal_cache[d+1]=this.field[b-this.yd]-
this.field[b+this.yd];this.normal_cache[d+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,d,f,g,h,k){var m=g+1,n=g+this.yd,q=g+this.zd,x=m+this.yd,z=m+this.zd,p=g+this.yd+this.zd,A=m+this.yd+this.zd,G=0,I=this.field[g],C=this.field[m],J=this.field[n],B=this.field[x],U=this.field[q],P=this.field[z],O=this.field[p],V=this.field[A];I<h&&(G|=1);C<h&&(G|=2);J<h&&(G|=8);B<h&&(G|=4);U<h&&(G|=16);P<h&&(G|=32);O<h&&(G|=128);V<h&&(G|=64);var Y=THREE.edgeTable[G];if(Y==0)return 0;
var e=this.delta,ja=b+e,X=d+e;e=f+e;if(Y&1){this.compNorm(g);this.compNorm(m);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,d,f,I,C)}if(Y&2){this.compNorm(m);this.compNorm(x);this.VIntY(m*3,this.vlist,this.nlist,3,h,ja,d,f,C,B)}if(Y&4){this.compNorm(n);this.compNorm(x);this.VIntX(n*3,this.vlist,this.nlist,6,h,b,X,f,J,B)}if(Y&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,d,f,I,J)}if(Y&16){this.compNorm(q);this.compNorm(z);this.VIntX(q*3,this.vlist,this.nlist,12,h,b,d,
e,U,P)}if(Y&32){this.compNorm(z);this.compNorm(A);this.VIntY(z*3,this.vlist,this.nlist,15,h,ja,d,e,P,V)}if(Y&64){this.compNorm(p);this.compNorm(A);this.VIntX(p*3,this.vlist,this.nlist,18,h,b,X,e,O,V)}if(Y&128){this.compNorm(q);this.compNorm(p);this.VIntY(q*3,this.vlist,this.nlist,21,h,b,d,e,U,O)}if(Y&256){this.compNorm(g);this.compNorm(q);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,d,f,I,U)}if(Y&512){this.compNorm(m);this.compNorm(z);this.VIntZ(m*3,this.vlist,this.nlist,27,h,ja,d,f,C,P)}if(Y&1024){this.compNorm(x);
this.compNorm(A);this.VIntZ(x*3,this.vlist,this.nlist,30,h,ja,X,f,B,V)}if(Y&2048){this.compNorm(n);this.compNorm(p);this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,X,f,J,O)}G<<=4;for(h=g=0;THREE.triTable[G+h]!=-1;){b=G+h;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);h+=3;g++}return g};this.posnormtriv=function(b,d,f,g,h,k){var m=this.count*3;this.positionArray[m]=b[f];this.positionArray[m+1]=b[f+1];this.positionArray[m+2]=b[f+2];this.positionArray[m+
3]=b[g];this.positionArray[m+4]=b[g+1];this.positionArray[m+5]=b[g+2];this.positionArray[m+6]=b[h];this.positionArray[m+7]=b[h+1];this.positionArray[m+8]=b[h+2];this.normalArray[m]=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[h];this.normalArray[m+7]=d[h+1];this.normalArray[m+8]=d[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(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,h){var k=this.size*Math.sqrt(g/h),m=f*this.size,n=d*this.size,q=b*this.size,x=Math.floor(m-k);x<1&&(x=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var z=Math.floor(n-k);z<1&&(z=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var p=Math.floor(q-k);p<1&&(p=1);k=Math.floor(q+k);
k>this.size-1&&(k=this.size-1);for(var A,G,I,C,J,B;x<m;x++){q=this.size2*x;G=x/this.size-f;J=G*G;for(G=z;G<n;G++){I=q+this.size*G;A=G/this.size-d;B=A*A;for(A=p;A<k;A++){C=A/this.size-b;C=g/(1.0E-6+C*C+B+J)-h;C>0&&(this.field[I+A]+=C)}}}};this.addPlaneX=function(b,d){var f,g,h,k,m,n=this.size,q=this.yd,x=this.zd,z=this.field,p=n*Math.sqrt(b/d);p>n&&(p=n);for(f=0;f<p;f++){g=f/n;g*=g;k=b/(1.0E-4+g)-d;if(k>0)for(g=0;g<n;g++){m=f+g*q;for(h=0;h<n;h++)z[x*h+m]+=k}}};this.addPlaneY=function(b,d){var f,g,
h,k,m,n,q=this.size,x=this.yd,z=this.zd,p=this.field,A=q*Math.sqrt(b/d);A>q&&(A=q);for(g=0;g<A;g++){f=g/q;f*=f;k=b/(1.0E-4+f)-d;if(k>0){m=g*x;for(f=0;f<q;f++){n=m+f;for(h=0;h<q;h++)p[z*h+n]+=k}}}};this.addPlaneZ=function(b,d){var f,g,h,k,m,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/d);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=b/(1.0E-4+f)-d;if(k>0){m=zd*h;for(g=0;g<size;g++){n=m+g*yd;for(f=0;f<size;f++)field[n+f]+=k}}}};this.reset=function(){var b;
for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var d,f,g,h,k,m,n,q,x,z=this.size-2;for(h=1;h<z;h++){x=this.size2*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<z;g++){q=x+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<z;f++){k=(f-this.halfsize)/this.halfsize;d=q+f;this.polygonize(k,m,n,d,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,d=new THREE.Geometry;this.render(function(f){var g,h,k,m,n,q,x,z;for(g=
0;g<f.count;g++){n=g*3;x=n+1;z=n+2;h=f.positionArray[n];k=f.positionArray[x];m=f.positionArray[z];q=new THREE.Vector3(h,k,m);h=f.normalArray[n];k=f.normalArray[x];m=f.normalArray[z];n=new THREE.Vector3(h,k,m);n.normalize();n=new THREE.Vertex(q,n);d.vertices.push(n)}nfaces=f.count/3;for(g=0;g<nfaces;g++){n=(b+g)*3;x=n+1;z=n+2;q=d.vertices[n].normal;h=d.vertices[x].normal;k=d.vertices[z].normal;n=new THREE.Face3(n,x,z,[q,h,k]);d.faces.push(n)}b+=nfaces;f.count=0});return d};this.init(a)};
0;this.hasPos=!1;this.hasNormal=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,e,f){return b+(e-b)*f};this.VIntX=function(b,e,f,g,h,k,m,n,p,x){h=(h-p)/(x-p);p=this.normal_cache;e[g]=k+h*this.delta;e[g+1]=m;e[g+2]=n;f[g]=this.lerp(p[b],p[b+3],h);f[g+1]=this.lerp(p[b+1],p[b+4],h);f[g+2]=this.lerp(p[b+2],p[b+5],h)};this.VIntY=function(b,e,f,g,h,k,m,n,p,x){h=(h-p)/(x-p);p=this.normal_cache;e[g]=k;e[g+1]=m+h*this.delta;e[g+
2]=n;e=b+this.yd*3;f[g]=this.lerp(p[b],p[e],h);f[g+1]=this.lerp(p[b+1],p[e+1],h);f[g+2]=this.lerp(p[b+2],p[e+2],h)};this.VIntZ=function(b,e,f,g,h,k,m,n,p,x){h=(h-p)/(x-p);p=this.normal_cache;e[g]=k;e[g+1]=m;e[g+2]=n+h*this.delta;e=b+this.zd*3;f[g]=this.lerp(p[b],p[e],h);f[g+1]=this.lerp(p[b+1],p[e+1],h);f[g+2]=this.lerp(p[b+2],p[e+2],h)};this.compNorm=function(b){var e=b*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[b-1]-this.field[b+1];this.normal_cache[e+1]=this.field[b-this.yd]-
this.field[b+this.yd];this.normal_cache[e+2]=this.field[b-this.zd]-this.field[b+this.zd]}};this.polygonize=function(b,e,f,g,h,k){var m=g+1,n=g+this.yd,p=g+this.zd,x=m+this.yd,y=m+this.zd,o=g+this.yd+this.zd,A=m+this.yd+this.zd,G=0,J=this.field[g],D=this.field[m],K=this.field[n],C=this.field[x],U=this.field[p],P=this.field[y],O=this.field[o],W=this.field[A];J<h&&(G|=1);D<h&&(G|=2);K<h&&(G|=8);C<h&&(G|=4);U<h&&(G|=16);P<h&&(G|=32);O<h&&(G|=128);W<h&&(G|=64);var Y=THREE.edgeTable[G];if(Y==0)return 0;
var d=this.delta,ja=b+d,X=e+d;d=f+d;if(Y&1){this.compNorm(g);this.compNorm(m);this.VIntX(g*3,this.vlist,this.nlist,0,h,b,e,f,J,D)}if(Y&2){this.compNorm(m);this.compNorm(x);this.VIntY(m*3,this.vlist,this.nlist,3,h,ja,e,f,D,C)}if(Y&4){this.compNorm(n);this.compNorm(x);this.VIntX(n*3,this.vlist,this.nlist,6,h,b,X,f,K,C)}if(Y&8){this.compNorm(g);this.compNorm(n);this.VIntY(g*3,this.vlist,this.nlist,9,h,b,e,f,J,K)}if(Y&16){this.compNorm(p);this.compNorm(y);this.VIntX(p*3,this.vlist,this.nlist,12,h,b,e,
d,U,P)}if(Y&32){this.compNorm(y);this.compNorm(A);this.VIntY(y*3,this.vlist,this.nlist,15,h,ja,e,d,P,W)}if(Y&64){this.compNorm(o);this.compNorm(A);this.VIntX(o*3,this.vlist,this.nlist,18,h,b,X,d,O,W)}if(Y&128){this.compNorm(p);this.compNorm(o);this.VIntY(p*3,this.vlist,this.nlist,21,h,b,e,d,U,O)}if(Y&256){this.compNorm(g);this.compNorm(p);this.VIntZ(g*3,this.vlist,this.nlist,24,h,b,e,f,J,U)}if(Y&512){this.compNorm(m);this.compNorm(y);this.VIntZ(m*3,this.vlist,this.nlist,27,h,ja,e,f,D,P)}if(Y&1024){this.compNorm(x);
this.compNorm(A);this.VIntZ(x*3,this.vlist,this.nlist,30,h,ja,X,f,C,W)}if(Y&2048){this.compNorm(n);this.compNorm(o);this.VIntZ(n*3,this.vlist,this.nlist,33,h,b,X,f,K,O)}G<<=4;for(h=g=0;THREE.triTable[G+h]!=-1;){b=G+h;e=b+1;f=b+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[e],3*THREE.triTable[f],k);h+=3;g++}return g};this.posnormtriv=function(b,e,f,g,h,k){var m=this.count*3;this.positionArray[m]=b[f];this.positionArray[m+1]=b[f+1];this.positionArray[m+2]=b[f+2];this.positionArray[m+
3]=b[g];this.positionArray[m+4]=b[g+1];this.positionArray[m+5]=b[g+2];this.positionArray[m+6]=b[h];this.positionArray[m+7]=b[h+1];this.positionArray[m+8]=b[h+2];this.normalArray[m]=e[f];this.normalArray[m+1]=e[f+1];this.normalArray[m+2]=e[f+2];this.normalArray[m+3]=e[g];this.normalArray[m+4]=e[g+1];this.normalArray[m+5]=e[g+2];this.normalArray[m+6]=e[h];this.normalArray[m+7]=e[h+1];this.normalArray[m+8]=e[h+2];this.hasPos=!0;this.hasNormal=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
function(){this.count=0;this.hasPos=!1;this.hasNormal=!1};this.end=function(b){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;b(this)}};this.addBall=function(b,e,f,g,h){var k=this.size*Math.sqrt(g/h),m=f*this.size,n=e*this.size,p=b*this.size,x=Math.floor(m-k);x<1&&(x=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var y=Math.floor(n-k);y<1&&(y=1);n=Math.floor(n+k);n>this.size-1&&(n=this.size-1);var o=Math.floor(p-k);o<1&&(o=1);k=Math.floor(p+k);
k>this.size-1&&(k=this.size-1);for(var A,G,J,D,K,C;x<m;x++){p=this.size2*x;G=x/this.size-f;K=G*G;for(G=y;G<n;G++){J=p+this.size*G;A=G/this.size-e;C=A*A;for(A=o;A<k;A++){D=A/this.size-b;D=g/(1.0E-6+D*D+C+K)-h;D>0&&(this.field[J+A]+=D)}}}};this.addPlaneX=function(b,e){var f,g,h,k,m,n=this.size,p=this.yd,x=this.zd,y=this.field,o=n*Math.sqrt(b/e);o>n&&(o=n);for(f=0;f<o;f++){g=f/n;g*=g;k=b/(1.0E-4+g)-e;if(k>0)for(g=0;g<n;g++){m=f+g*p;for(h=0;h<n;h++)y[x*h+m]+=k}}};this.addPlaneY=function(b,e){var f,g,
h,k,m,n,p=this.size,x=this.yd,y=this.zd,o=this.field,A=p*Math.sqrt(b/e);A>p&&(A=p);for(g=0;g<A;g++){f=g/p;f*=f;k=b/(1.0E-4+f)-e;if(k>0){m=g*x;for(f=0;f<p;f++){n=m+f;for(h=0;h<p;h++)o[y*h+n]+=k}}}};this.addPlaneZ=function(b,e){var f,g,h,k,m,n;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/e);dist>size&&(dist=size);for(h=0;h<dist;h++){f=h/size;f*=f;k=b/(1.0E-4+f)-e;if(k>0){m=zd*h;for(g=0;g<size;g++){n=m+g*yd;for(f=0;f<size;f++)field[n+f]+=k}}}};this.reset=function(){var b;
for(b=0;b<this.size3;b++){this.normal_cache[b*3]=0;this.field[b]=0}};this.render=function(b){this.begin();var e,f,g,h,k,m,n,p,x,y=this.size-2;for(h=1;h<y;h++){x=this.size2*h;n=(h-this.halfsize)/this.halfsize;for(g=1;g<y;g++){p=x+this.size*g;m=(g-this.halfsize)/this.halfsize;for(f=1;f<y;f++){k=(f-this.halfsize)/this.halfsize;e=p+f;this.polygonize(k,m,n,e,this.isolation,b)}}}this.end(b)};this.generateGeometry=function(){var b=0,e=new THREE.Geometry;this.render(function(f){var g,h,k,m,n,p,x,y;for(g=
0;g<f.count;g++){n=g*3;x=n+1;y=n+2;h=f.positionArray[n];k=f.positionArray[x];m=f.positionArray[y];p=new THREE.Vector3(h,k,m);h=f.normalArray[n];k=f.normalArray[x];m=f.normalArray[y];n=new THREE.Vector3(h,k,m);n.normalize();n=new THREE.Vertex(p,n);e.vertices.push(n)}nfaces=f.count/3;for(g=0;g<nfaces;g++){n=(b+g)*3;x=n+1;y=n+2;p=e.vertices[n].normal;h=e.vertices[x].normal;k=e.vertices[y].normal;n=new THREE.Face3(n,x,y,[p,h,k]);e.faces.push(n)}b+=nfaces;f.count=0});return e};this.init(a)};
THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
+210 -196
View File
@@ -1,89 +1,89 @@
// ThreeWebGL.js r37 - http://github.com/mrdoob/three.js
var THREE=THREE||{};THREE.Color=function(a){this.setHex(a)};
THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var f,e,h,j,p,n;if(c==0)f=e=h=0;else{j=Math.floor(a*6);p=a*6-j;a=c*(1-b);n=c*(1-b*p);b=c*(1-b*(1-p));switch(j){case 1:f=n;e=c;h=a;break;case 2:f=a;e=c;h=b;break;case 3:f=a;e=n;h=c;break;case 4:f=b;e=a;h=c;break;case 5:f=c;e=a;
h=n;break;case 6:case 0:f=c;e=b;h=a}}this.r=f;this.g=e;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,b){this.set(a||0,b||0)};
THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,b,c){this.set(a||0,b||0,c||0)};
THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
b){this.set(a.y*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x);return this},crossSelf:function(a){var b=this.x,c=this.y,f=this.z;this.set(c*a.z-f*a.y,f*a.x-b*a.z,b*a.y-c*a.x);return this},multiply:function(a,b){this.set(a.x*b.x,a.y*b.y,a.z*b.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var b=Math.cos(this.y);if(Math.abs(b)>1.0E-5){this.x=Math.atan2(-a.n23/b,a.n33/b);this.z=Math.atan2(-a.n13/b,a.n11/b)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,b,c,f){this.set(a||0,b||0,c||0,f||1)};
THREE.Vector4.prototype={set:function(a,b,c,f){this.x=a;this.y=b;this.z=c;this.w=f;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,b){this.set(a.x+b.x,a.y+b.y,a.z+b.z,a.w+b.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,b){this.set(a.x-b.x,a.y-b.y,a.z-b.z,a.w-b.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,b){this.set(this.x+(a.x-this.x)*b,this.y+(a.y-this.y)*b,this.z+(a.z-this.z)*b,this.w+(a.w-this.w)*b)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
THREE.Ray.prototype={intersectScene:function(a){var b,c,f=a.objects,e=[];a=0;for(b=f.length;a<b;a++){c=f[a];c instanceof THREE.Mesh&&(e=e.concat(this.intersectObject(c)))}e.sort(function(h,j){return h.distance-j.distance});return e},intersectObject:function(a){function b(P,L,ja,ma){ma=ma.clone().subSelf(L);ja=ja.clone().subSelf(L);var sa=P.clone().subSelf(L);P=ma.dot(ma);L=ma.dot(ja);ma=ma.dot(sa);var U=ja.dot(ja);ja=ja.dot(sa);sa=1/(P*U-L*L);U=(U*ma-L*ja)*sa;P=(P*ja-L*ma)*sa;return U>0&&P>0&&U+P<
1}var c,f,e,h,j,p,n,s,x,z,C,y=a.geometry,J=y.vertices,K=[];c=0;for(f=y.faces.length;c<f;c++){e=y.faces[c];z=this.origin.clone();C=this.direction.clone();n=a.matrixWorld;h=n.multiplyVector3(J[e.a].position.clone());j=n.multiplyVector3(J[e.b].position.clone());p=n.multiplyVector3(J[e.c].position.clone());n=e instanceof THREE.Face4?n.multiplyVector3(J[e.d].position.clone()):null;s=a.matrixRotationWorld.multiplyVector3(e.normal.clone());x=C.dot(s);if(x<0){s=s.dot((new THREE.Vector3).sub(h,z))/x;z=z.addSelf(C.multiplyScalar(s));
if(e instanceof THREE.Face3){if(b(z,h,j,p)){e={distance:this.origin.distanceTo(z),point:z,face:e,object:a};K.push(e)}}else if(e instanceof THREE.Face4&&(b(z,h,j,n)||b(z,j,p,n))){e={distance:this.origin.distanceTo(z),point:z,face:e,object:a};K.push(e)}}}return K}};
THREE.Rectangle=function(){function a(){h=f-b;j=e-c}var b,c,f,e,h,j,p=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return j};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return f};this.getBottom=function(){return e};this.set=function(n,s,x,z){p=!1;b=n;c=s;f=x;e=z;a()};this.addPoint=function(n,s){if(p){p=!1;b=n;c=s;f=n;e=s}else{b=b<n?b:n;c=c<s?c:s;f=f>n?f:n;e=e>s?e:s}a()};
this.add3Points=function(n,s,x,z,C,y){if(p){p=!1;b=n<x?n<C?n:C:x<C?x:C;c=s<z?s<y?s:y:z<y?z:y;f=n>x?n>C?n:C:x>C?x:C;e=s>z?s>y?s:y:z>y?z:y}else{b=n<x?n<C?n<b?n:b:C<b?C:b:x<C?x<b?x:b:C<b?C:b;c=s<z?s<y?s<c?s:c:y<c?y:c:z<y?z<c?z:c:y<c?y:c;f=n>x?n>C?n>f?n:f:C>f?C:f:x>C?x>f?x:f:C>f?C:f;e=s>z?s>y?s>e?s:e:y>e?y:e:z>y?z>e?z:e:y>e?y:e}a()};this.addRectangle=function(n){if(p){p=!1;b=n.getLeft();c=n.getTop();f=n.getRight();e=n.getBottom()}else{b=b<n.getLeft()?b:n.getLeft();c=c<n.getTop()?c:n.getTop();f=f>n.getRight()?
f:n.getRight();e=e>n.getBottom()?e:n.getBottom()}a()};this.inflate=function(n){b-=n;c-=n;f+=n;e+=n;a()};this.minSelf=function(n){b=b>n.getLeft()?b:n.getLeft();c=c>n.getTop()?c:n.getTop();f=f<n.getRight()?f:n.getRight();e=e<n.getBottom()?e:n.getBottom();a()};this.instersects=function(n){return Math.min(f,n.getRight())-Math.max(b,n.getLeft())>=0&&Math.min(e,n.getBottom())-Math.max(c,n.getTop())>=0};this.empty=function(){p=!0;e=f=c=b=0;a()};this.isEmpty=function(){return p}};
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
THREE.Matrix4=function(a,b,c,f,e,h,j,p,n,s,x,z,C,y,J,K){this.set(a||1,b||0,c||0,f||0,e||0,h||1,j||0,p||0,n||0,s||0,x||1,z||0,C||0,y||0,J||0,K||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
THREE.Matrix4.prototype={set:function(a,b,c,f,e,h,j,p,n,s,x,z,C,y,J,K){this.n11=a;this.n12=b;this.n13=c;this.n14=f;this.n21=e;this.n22=h;this.n23=j;this.n24=p;this.n31=n;this.n32=s;this.n33=x;this.n34=z;this.n41=C;this.n42=y;this.n43=J;this.n44=K;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,b,c){var f=THREE.Matrix4.__v1,
e=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,b).normalize();if(h.length()===0)h.z=1;f.cross(c,h).normalize();if(f.length()===0){h.x+=1.0E-4;f.cross(c,h).normalize()}e.cross(h,f).normalize();this.n11=f.x;this.n12=e.x;this.n13=h.x;this.n21=f.y;this.n22=e.y;this.n23=h.y;this.n31=f.z;this.n32=e.z;this.n33=h.z;return this},multiplyVector3:function(a){var b=a.x,c=a.y,f=a.z,e=1/(this.n41*b+this.n42*c+this.n43*f+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*f+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*
f+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*f+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,f=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*f+this.n14*e;a.y=this.n21*b+this.n22*c+this.n23*f+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*f+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*f+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,f=a.z;a.x=b*this.n11+c*this.n12+f*this.n13;a.y=b*this.n21+c*this.n22+f*this.n23;a.z=b*this.n31+c*this.n32+f*this.n33;a.normalize();
return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,f=a.n12,e=a.n13,h=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,x=a.n31,z=a.n32,C=a.n33,y=a.n34,J=a.n41,K=a.n42,P=a.n43,L=a.n44,ja=b.n11,ma=b.n12,sa=b.n13,U=b.n14,A=b.n21,oa=b.n22,
d=b.n23,Ba=b.n24,Ca=b.n31,Q=b.n32,N=b.n33,pa=b.n34;this.n11=c*ja+f*A+e*Ca;this.n12=c*ma+f*oa+e*Q;this.n13=c*sa+f*d+e*N;this.n14=c*U+f*Ba+e*pa+h;this.n21=j*ja+p*A+n*Ca;this.n22=j*ma+p*oa+n*Q;this.n23=j*sa+p*d+n*N;this.n24=j*U+p*Ba+n*pa+s;this.n31=x*ja+z*A+C*Ca;this.n32=x*ma+z*oa+C*Q;this.n33=x*sa+z*d+C*N;this.n34=x*U+z*Ba+C*pa+y;this.n41=J*ja+K*A+P*Ca;this.n42=J*ma+K*oa+P*Q;this.n43=J*sa+K*d+P*N;this.n44=J*U+K*Ba+P*pa+L;return this},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;
c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,f=this.n14,e=this.n21,h=this.n22,j=this.n23,p=this.n24,n=this.n31,s=this.n32,x=this.n33,z=this.n34,C=this.n41,y=this.n42,J=this.n43,K=this.n44;return f*j*s*C-c*p*s*C-f*h*x*C+b*p*x*C+c*h*z*C-b*j*z*C-f*j*n*y+c*p*n*y+f*e*x*y-a*p*x*y-c*e*z*y+a*j*z*y+f*h*n*J-b*p*n*J-f*e*s*J+a*p*s*J+b*e*z*J-a*h*z*J-c*h*n*K+b*j*n*K+c*e*s*K-a*j*s*K-b*e*x*K+a*h*x*K},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
THREE.Color.prototype={autoUpdate:!0,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;this.hex=a.hex;this.__styleString=a.__styleString},setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var g,f,h,i,m,o;if(d==0)g=f=h=0;else{i=Math.floor(a*6);m=a*6-i;a=d*(1-c);o=d*(1-c*m);c=d*(1-c*(1-m));switch(i){case 1:g=o;f=d;h=a;break;case 2:g=a;f=d;h=c;break;case 3:g=a;f=o;h=d;break;case 4:g=c;f=a;h=d;break;case 5:g=d;f=a;
h=o;break;case 6:case 0:g=d;f=c;h=a}}this.r=g;this.g=f;this.b=h;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGB();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGB:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*
255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)}};THREE.Vector2=function(a,c){this.set(a||0,c||0)};
THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.set(a.x,a.y);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a);return this},negate:function(){this.set(-this.x,-this.y);return this},unit:function(){this.multiplyScalar(1/
this.length());return this},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y},clone:function(){return new THREE.Vector2(this.x,this.y)}};THREE.Vector3=function(a,c,d){this.set(a||0,c||0,d||0)};
THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,d=this.y,g=this.z;this.set(d*a.z-g*a.y,g*a.x-c*a.z,c*a.y-d*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-a.n23/c,a.n33/c);this.z=Math.atan2(-a.n13/c,a.n11/c)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,d,g){this.set(a||0,c||0,d||0,g||1)};
THREE.Vector4.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
THREE.Ray.prototype={intersectScene:function(a){var c,d,g=a.objects,f=[];a=0;for(c=g.length;a<c;a++){d=g[a];d instanceof THREE.Mesh&&(f=f.concat(this.intersectObject(d)))}f.sort(function(h,i){return h.distance-i.distance});return f},intersectObject:function(a){function c(Q,K,ia,la){la=la.clone().subSelf(K);ia=ia.clone().subSelf(K);var wa=Q.clone().subSelf(K);Q=la.dot(la);K=la.dot(ia);la=la.dot(wa);var S=ia.dot(ia);ia=ia.dot(wa);wa=1/(Q*S-K*K);S=(S*la-K*ia)*wa;Q=(Q*ia-K*la)*wa;return S>0&&Q>0&&S+Q<
1}var d,g,f,h,i,m,o,t,x,y,B,z=a.geometry,H=z.vertices,J=[];d=0;for(g=z.faces.length;d<g;d++){f=z.faces[d];y=this.origin.clone();B=this.direction.clone();o=a.matrixWorld;h=o.multiplyVector3(H[f.a].position.clone());i=o.multiplyVector3(H[f.b].position.clone());m=o.multiplyVector3(H[f.c].position.clone());o=f instanceof THREE.Face4?o.multiplyVector3(H[f.d].position.clone()):null;t=a.matrixRotationWorld.multiplyVector3(f.normal.clone());x=B.dot(t);if(x<0){t=t.dot((new THREE.Vector3).sub(h,y))/x;y=y.addSelf(B.multiplyScalar(t));
if(f instanceof THREE.Face3){if(c(y,h,i,m)){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};J.push(f)}}else if(f instanceof THREE.Face4&&(c(y,h,i,o)||c(y,i,m,o))){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};J.push(f)}}}return J}};
THREE.Rectangle=function(){function a(){h=g-c;i=f-d}var c,d,g,f,h,i,m=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return i};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return g};this.getBottom=function(){return f};this.set=function(o,t,x,y){m=!1;c=o;d=t;g=x;f=y;a()};this.addPoint=function(o,t){if(m){m=!1;c=o;d=t;g=o;f=t}else{c=c<o?c:o;d=d<t?d:t;g=g>o?g:o;f=f>t?f:t}a()};
this.add3Points=function(o,t,x,y,B,z){if(m){m=!1;c=o<x?o<B?o:B:x<B?x:B;d=t<y?t<z?t:z:y<z?y:z;g=o>x?o>B?o:B:x>B?x:B;f=t>y?t>z?t:z:y>z?y:z}else{c=o<x?o<B?o<c?o:c:B<c?B:c:x<B?x<c?x:c:B<c?B:c;d=t<y?t<z?t<d?t:d:z<d?z:d:y<z?y<d?y:d:z<d?z:d;g=o>x?o>B?o>g?o:g:B>g?B:g:x>B?x>g?x:g:B>g?B:g;f=t>y?t>z?t>f?t:f:z>f?z:f:y>z?y>f?y:f:z>f?z:f}a()};this.addRectangle=function(o){if(m){m=!1;c=o.getLeft();d=o.getTop();g=o.getRight();f=o.getBottom()}else{c=c<o.getLeft()?c:o.getLeft();d=d<o.getTop()?d:o.getTop();g=g>o.getRight()?
g:o.getRight();f=f>o.getBottom()?f:o.getBottom()}a()};this.inflate=function(o){c-=o;d-=o;g+=o;f+=o;a()};this.minSelf=function(o){c=c>o.getLeft()?c:o.getLeft();d=d>o.getTop()?d:o.getTop();g=g<o.getRight()?g:o.getRight();f=f<o.getBottom()?f:o.getBottom();a()};this.instersects=function(o){return Math.min(g,o.getRight())-Math.max(c,o.getLeft())>=0&&Math.min(f,o.getBottom())-Math.max(d,o.getTop())>=0};this.empty=function(){m=!0;f=g=d=c=0;a()};this.isEmpty=function(){return m}};
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
THREE.Matrix4=function(a,c,d,g,f,h,i,m,o,t,x,y,B,z,H,J){this.set(a||1,c||0,d||0,g||0,f||0,h||1,i||0,m||0,o||0,t||0,x||1,y||0,B||0,z||0,H||0,J||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
THREE.Matrix4.prototype={set:function(a,c,d,g,f,h,i,m,o,t,x,y,B,z,H,J){this.n11=a;this.n12=c;this.n13=d;this.n14=g;this.n21=f;this.n22=h;this.n23=i;this.n24=m;this.n31=o;this.n32=t;this.n33=x;this.n34=y;this.n41=B;this.n42=z;this.n43=H;this.n44=J;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,d){var g=THREE.Matrix4.__v1,
f=THREE.Matrix4.__v2,h=THREE.Matrix4.__v3;h.sub(a,c).normalize();if(h.length()===0)h.z=1;g.cross(d,h).normalize();if(g.length()===0){h.x+=1.0E-4;g.cross(d,h).normalize()}f.cross(h,g).normalize();this.n11=g.x;this.n12=f.x;this.n13=h.x;this.n21=g.y;this.n22=f.y;this.n23=h.y;this.n31=g.z;this.n32=f.z;this.n33=h.z;return this},multiplyVector3:function(a){var c=a.x,d=a.y,g=a.z,f=1/(this.n41*c+this.n42*d+this.n43*g+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*g+this.n14)*f;a.y=(this.n21*c+this.n22*d+this.n23*
g+this.n24)*f;a.z=(this.n31*c+this.n32*d+this.n33*g+this.n34)*f;return a},multiplyVector4:function(a){var c=a.x,d=a.y,g=a.z,f=a.w;a.x=this.n11*c+this.n12*d+this.n13*g+this.n14*f;a.y=this.n21*c+this.n22*d+this.n23*g+this.n24*f;a.z=this.n31*c+this.n32*d+this.n33*g+this.n34*f;a.w=this.n41*c+this.n42*d+this.n43*g+this.n44*f;return a},rotateAxis:function(a){var c=a.x,d=a.y,g=a.z;a.x=c*this.n11+d*this.n12+g*this.n13;a.y=c*this.n21+d*this.n22+g*this.n23;a.z=c*this.n31+d*this.n32+g*this.n33;a.normalize();
return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,g=a.n12,f=a.n13,h=a.n14,i=a.n21,m=a.n22,o=a.n23,t=a.n24,x=a.n31,y=a.n32,B=a.n33,z=a.n34,H=a.n41,J=a.n42,Q=a.n43,K=a.n44,ia=c.n11,la=c.n12,wa=c.n13,S=c.n14,E=c.n21,fa=c.n22,
Y=c.n23,b=c.n24,ra=c.n31,R=c.n32,N=c.n33,pa=c.n34;this.n11=d*ia+g*E+f*ra;this.n12=d*la+g*fa+f*R;this.n13=d*wa+g*Y+f*N;this.n14=d*S+g*b+f*pa+h;this.n21=i*ia+m*E+o*ra;this.n22=i*la+m*fa+o*R;this.n23=i*wa+m*Y+o*N;this.n24=i*S+m*b+o*pa+t;this.n31=x*ia+y*E+B*ra;this.n32=x*la+y*fa+B*R;this.n33=x*wa+y*Y+B*N;this.n34=x*S+y*b+B*pa+z;this.n41=H*ia+J*E+Q*ra;this.n42=H*la+J*fa+Q*R;this.n43=H*wa+J*Y+Q*N;this.n44=H*S+J*b+Q*pa+K;return this},multiplyToArray:function(a,c,d){this.multiply(a,c);d[0]=this.n11;d[1]=
this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=
a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,g=this.n14,f=this.n21,h=this.n22,i=this.n23,m=this.n24,o=this.n31,t=this.n32,x=this.n33,y=this.n34,B=this.n41,z=this.n42,H=this.n43,J=this.n44;return g*i*t*B-d*m*t*B-g*h*x*B+c*m*x*B+d*h*y*B-c*i*y*B-g*i*o*z+d*m*o*z+g*f*x*z-a*m*x*z-d*f*y*z+a*i*y*z+g*h*o*H-c*m*o*H-g*f*t*H+a*m*t*H+c*f*y*H-a*h*y*H-d*h*o*J+c*i*o*J+d*f*t*J-a*i*t*J-c*f*x*J+a*h*x*J},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=
this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=
this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;
a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,
0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),f=Math.sin(b),e=
1-c,h=a.x,j=a.y,p=a.z,n=e*h,s=e*j;this.set(n*h+c,n*j-f*p,n*p+f*j,0,n*j+f*p,s*j+c,s*p-f*h,0,n*p-f*j,s*p+f*h,e*p*p+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,f=a.z;a=Math.cos(b);b=Math.sin(b);var e=Math.cos(c);c=Math.sin(c);var h=Math.cos(f);f=Math.sin(f);var j=a*c,p=b*c;this.n11=e*h;this.n12=-e*f;this.n13=c;this.n21=p*h+a*f;this.n22=-p*f+a*h;this.n23=-b*e;this.n31=-j*h+b*f;this.n32=j*f+b*h;this.n33=
a*e;return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,f=a.z,e=a.w,h=b+b,j=c+c,p=f+f;a=b*h;var n=b*j;b*=p;var s=c*j;c*=p;f*=p;h*=e;j*=e;e*=p;this.n11=1-(s+f);this.n12=n-e;this.n13=b+j;this.n21=n+e;this.n22=1-(a+f);this.n23=c-h;this.n31=b-j;this.n32=c+h;this.n33=1-(a+s);return this},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=c;this.n13*=a;this.n21*=b;this.n22*=c;this.n23*=a;this.n31*=b;this.n32*=c;this.n33*=a;this.n41*=b;this.n42*=c;this.n43*=a;return this},extractPosition:function(a){this.n14=
a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,b){var c=1/b.x,f=1/b.y,e=1/b.z;this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*f;this.n22=a.n22*f;this.n32=a.n32*f;this.n13=a.n13*e;this.n23=a.n23*e;this.n33=a.n33*e}};
THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,f=a.n12,e=a.n13,h=a.n14,j=a.n21,p=a.n22,n=a.n23,s=a.n24,x=a.n31,z=a.n32,C=a.n33,y=a.n34,J=a.n41,K=a.n42,P=a.n43,L=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=n*y*K-s*C*K+s*z*P-p*y*P-n*z*L+p*C*L;b.n12=h*C*K-e*y*K-h*z*P+f*y*P+e*z*L-f*C*L;b.n13=e*s*K-h*n*K+h*p*P-f*s*P-e*p*L+f*n*L;b.n14=h*n*z-e*s*z-h*p*C+f*s*C+e*p*y-f*n*y;b.n21=s*C*J-n*y*J-s*x*P+j*y*P+n*x*L-j*C*L;b.n22=e*y*J-h*C*J+h*x*P-c*y*P-e*x*L+c*C*L;b.n23=h*n*J-e*s*J-h*j*P+c*s*P+e*j*L-c*n*L;
b.n24=e*s*x-h*n*x+h*j*C-c*s*C-e*j*y+c*n*y;b.n31=p*y*J-s*z*J+s*x*K-j*y*K-p*x*L+j*z*L;b.n32=h*z*J-f*y*J-h*x*K+c*y*K+f*x*L-c*z*L;b.n33=e*s*J-h*p*J+h*j*K-c*s*K-f*j*L+c*p*L;b.n34=h*p*x-f*s*x-h*j*z+c*s*z+f*j*y-c*p*y;b.n41=n*z*J-p*C*J-n*x*K+j*C*K+p*x*P-j*z*P;b.n42=f*C*J-e*z*J+e*x*K-c*C*K-f*x*P+c*z*P;b.n43=e*p*J-f*n*J-e*j*K+c*n*K+f*j*P-c*p*P;b.n44=f*n*x-e*p*x+e*j*z-c*n*z-f*j*C+c*p*C;b.multiplyScalar(1/a.determinant());return b};
THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,f=a.n33*a.n22-a.n32*a.n23,e=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,j=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,s=a.n23*a.n12-a.n22*a.n13,x=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*j+a.n31*s;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*f;c[1]=a*e;c[2]=a*h;c[3]=a*j;c[4]=a*p;c[5]=a*n;c[6]=a*s;c[7]=a*x;c[8]=a*z;return b};
THREE.Matrix4.makeFrustum=function(a,b,c,f,e,h){var j;j=new THREE.Matrix4;j.n11=2*e/(b-a);j.n12=0;j.n13=(b+a)/(b-a);j.n14=0;j.n21=0;j.n22=2*e/(f-c);j.n23=(f+c)/(f-c);j.n24=0;j.n31=0;j.n32=0;j.n33=-(h+e)/(h-e);j.n34=-2*h*e/(h-e);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(a,b,c,f){var e;a=c*Math.tan(a*Math.PI/360);e=-a;return THREE.Matrix4.makeFrustum(e*b,a*b,e,a,c,f)};
THREE.Matrix4.makeOrtho=function(a,b,c,f,e,h){var j,p,n,s;j=new THREE.Matrix4;p=b-a;n=c-f;s=h-e;j.n11=2/p;j.n12=0;j.n13=0;j.n14=-((b+a)/p);j.n21=0;j.n22=2/n;j.n23=0;j.n24=-((c+f)/n);j.n31=0;j.n32=0;j.n33=-2/s;j.n34=-((h+e)/s);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,
0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var d=Math.cos(c),g=Math.sin(c),f=
1-d,h=a.x,i=a.y,m=a.z,o=f*h,t=f*i;this.set(o*h+d,o*i-g*m,o*m+g*i,0,o*i+g*m,t*i+d,t*m-g*h,0,o*m-g*i,t*m+g*h,f*m*m+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,d=a.y,g=a.z;a=Math.cos(c);c=Math.sin(c);var f=Math.cos(d);d=Math.sin(d);var h=Math.cos(g);g=Math.sin(g);var i=a*d,m=c*d;this.n11=f*h;this.n12=-f*g;this.n13=d;this.n21=m*h+a*g;this.n22=-m*g+a*h;this.n23=-c*f;this.n31=-i*h+c*g;this.n32=i*g+c*h;this.n33=
a*f;return this},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,g=a.z,f=a.w,h=c+c,i=d+d,m=g+g;a=c*h;var o=c*i;c*=m;var t=d*i;d*=m;g*=m;h*=f;i*=f;f*=m;this.n11=1-(t+g);this.n12=o-f;this.n13=c+i;this.n21=o+f;this.n22=1-(a+g);this.n23=d-h;this.n31=c-i;this.n32=d+h;this.n33=1-(a+t);return this},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=d;this.n13*=a;this.n21*=c;this.n22*=d;this.n23*=a;this.n31*=c;this.n32*=d;this.n33*=a;this.n41*=c;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=
a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var d=1/c.x,g=1/c.y,f=1/c.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*g;this.n22=a.n22*g;this.n32=a.n32*g;this.n13=a.n13*f;this.n23=a.n23*f;this.n33=a.n33*f}};
THREE.Matrix4.makeInvert=function(a,c){var d=a.n11,g=a.n12,f=a.n13,h=a.n14,i=a.n21,m=a.n22,o=a.n23,t=a.n24,x=a.n31,y=a.n32,B=a.n33,z=a.n34,H=a.n41,J=a.n42,Q=a.n43,K=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=o*z*J-t*B*J+t*y*Q-m*z*Q-o*y*K+m*B*K;c.n12=h*B*J-f*z*J-h*y*Q+g*z*Q+f*y*K-g*B*K;c.n13=f*t*J-h*o*J+h*m*Q-g*t*Q-f*m*K+g*o*K;c.n14=h*o*y-f*t*y-h*m*B+g*t*B+f*m*z-g*o*z;c.n21=t*B*H-o*z*H-t*x*Q+i*z*Q+o*x*K-i*B*K;c.n22=f*z*H-h*B*H+h*x*Q-d*z*Q-f*x*K+d*B*K;c.n23=h*o*H-f*t*H-h*i*Q+d*t*Q+f*i*K-d*o*K;
c.n24=f*t*x-h*o*x+h*i*B-d*t*B-f*i*z+d*o*z;c.n31=m*z*H-t*y*H+t*x*J-i*z*J-m*x*K+i*y*K;c.n32=h*y*H-g*z*H-h*x*J+d*z*J+g*x*K-d*y*K;c.n33=f*t*H-h*m*H+h*i*J-d*t*J-g*i*K+d*m*K;c.n34=h*m*x-g*t*x-h*i*y+d*t*y+g*i*z-d*m*z;c.n41=o*y*H-m*B*H-o*x*J+i*B*J+m*x*Q-i*y*Q;c.n42=g*B*H-f*y*H+f*x*J-d*B*J-g*x*Q+d*y*Q;c.n43=f*m*H-g*o*H-f*i*J+d*o*J+g*i*Q-d*m*Q;c.n44=g*o*x-f*m*x+f*i*y-d*o*y-g*i*B+d*m*B;c.multiplyScalar(1/a.determinant());return c};
THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,g=a.n33*a.n22-a.n32*a.n23,f=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,i=-a.n33*a.n12+a.n32*a.n13,m=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,t=a.n23*a.n12-a.n22*a.n13,x=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*g+a.n21*i+a.n31*t;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*g;d[1]=a*f;d[2]=a*h;d[3]=a*i;d[4]=a*m;d[5]=a*o;d[6]=a*t;d[7]=a*x;d[8]=a*y;return c};
THREE.Matrix4.makeFrustum=function(a,c,d,g,f,h){var i;i=new THREE.Matrix4;i.n11=2*f/(c-a);i.n12=0;i.n13=(c+a)/(c-a);i.n14=0;i.n21=0;i.n22=2*f/(g-d);i.n23=(g+d)/(g-d);i.n24=0;i.n31=0;i.n32=0;i.n33=-(h+f)/(h-f);i.n34=-2*h*f/(h-f);i.n41=0;i.n42=0;i.n43=-1;i.n44=0;return i};THREE.Matrix4.makePerspective=function(a,c,d,g){var f;a=d*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*c,a*c,f,a,d,g)};
THREE.Matrix4.makeOrtho=function(a,c,d,g,f,h){var i,m,o,t;i=new THREE.Matrix4;m=c-a;o=d-g;t=h-f;i.n11=2/m;i.n12=0;i.n13=0;i.n14=-((c+a)/m);i.n21=0;i.n22=2/o;i.n23=0;i.n24=-((d+g)/o);i.n31=0;i.n32=0;i.n33=-2/t;i.n34=-((h+f)/t);i.n41=0;i.n42=0;i.n43=0;i.n44=1;return i};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
THREE.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
!0;this._vector=new THREE.Vector3};
THREE.Object3D.prototype={translate:function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var b=this;b instanceof THREE.Scene===!1&&b!==undefined;)b=b.parent;b!==undefined&&b.addChildRecurse(a)}},removeChild:function(a){var b=this.children.indexOf(a);if(b!==-1){a.parent=undefined;this.children.splice(b,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,b,c){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;b=!0}a=0;for(var f=this.children.length;a<f;a++)this.children[a].update(this.matrixWorld,
b,c)}};THREE.Quaternion=function(a,b,c,f){this.set(a||0,b||0,c||0,f!==undefined?f:1)};
THREE.Quaternion.prototype={set:function(a,b,c,f){this.x=a;this.y=b;this.z=c;this.w=f;return this},setFromEuler:function(a){var b=0.5*Math.PI/360,c=a.x*b,f=a.y*b,e=a.z*b;a=Math.cos(f);f=Math.sin(f);b=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(c);c=Math.sin(c);var j=a*b,p=f*e;this.w=j*h-p*c;this.x=j*c+p*h;this.y=f*b*h+a*e*c;this.z=a*e*h-f*b*c;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var b=this.x,c=this.y,f=this.z,e=this.w,h=a.x,j=a.y,p=a.z;a=a.w;this.x=b*a+e*h+c*p-f*j;this.y=c*a+e*j+f*h-b*p;this.z=f*a+e*p+b*j-c*h;this.w=e*a-b*h-c*j-f*p;return this},
multiplyVector3:function(a,b){b||(b=a);var c=a.x,f=a.y,e=a.z,h=this.x,j=this.y,p=this.z,n=this.w,s=n*c+j*e-p*f,x=n*f+p*c-h*e,z=n*e+h*f-j*c;c=-h*c-j*f-p*e;b.x=s*n+c*-h+x*-p-z*-j;b.y=x*n+c*-j+z*-h-s*-p;b.z=z*n+c*-p+s*-j-x*-h;return b}};
THREE.Quaternion.slerp=function(a,b,c,f){var e=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(e)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(e),j=Math.sqrt(1-e*e);if(Math.abs(j)<0.001){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}e=Math.sin((1-f)*h)/j;f=Math.sin(f*h)/j;c.w=a.w*e+b.w*f;c.x=a.x*e+b.x*f;c.y=a.y*e+b.y*f;c.z=a.z*e+b.z*f;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Face3=function(a,b,c,f,e,h){this.a=a;this.b=b;this.c=c;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
THREE.Face4=function(a,b,c,f,e,h,j){this.a=a;this.b=b;this.c=c;this.d=f;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.set(a||0,b||0)};
THREE.UV.prototype={set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,f,e,h,j,p=new THREE.Vector3,n=new THREE.Vector3;f=0;for(e=this.faces.length;f<e;f++){h=this.faces[f];if(a&&h.vertexNormals.length){p.set(0,0,0);b=0;for(c=h.vertexNormals.length;b<c;b++)p.addSelf(h.vertexNormals[b]);p.divideScalar(3)}else{b=this.vertices[h.a];c=this.vertices[h.b];j=this.vertices[h.c];p.sub(j.position,c.position);n.sub(b.position,c.position);p.crossSelf(n)}p.isZero()||
p.normalize();h.normal.copy(p)}},computeVertexNormals:function(){var a,b,c,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)f[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=
this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)f[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){f[c.a].addSelf(c.normal);f[c.b].addSelf(c.normal);f[c.c].addSelf(c.normal);f[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)f[a].normalize();a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(f[c.a]);
c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(f[c.a]);c.vertexNormals[1].copy(f[c.b]);c.vertexNormals[2].copy(f[c.c]);c.vertexNormals[3].copy(f[c.d])}}},computeTangents:function(){function a(V,ha,ia,W,S,ta,ka){p=V.vertices[ha].position;n=V.vertices[ia].position;s=V.vertices[W].position;x=j[S];z=j[ta];C=j[ka];y=n.x-p.x;J=s.x-p.x;K=n.y-p.y;P=s.y-p.y;L=n.z-p.z;ja=s.z-p.z;ma=z.u-x.u;sa=C.u-x.u;U=z.v-x.v;A=C.v-x.v;oa=1/(ma*A-sa*
U);Q.set((A*y-U*J)*oa,(A*K-U*P)*oa,(A*L-U*ja)*oa);N.set((ma*J-sa*y)*oa,(ma*P-sa*K)*oa,(ma*ja-sa*L)*oa);Ba[ha].addSelf(Q);Ba[ia].addSelf(Q);Ba[W].addSelf(Q);Ca[ha].addSelf(N);Ca[ia].addSelf(N);Ca[W].addSelf(N)}var b,c,f,e,h,j,p,n,s,x,z,C,y,J,K,P,L,ja,ma,sa,U,A,oa,d,Ba=[],Ca=[],Q=new THREE.Vector3,N=new THREE.Vector3,pa=new THREE.Vector3,ya=new THREE.Vector3,Da=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){Ba[b]=new THREE.Vector3;Ca[b]=new THREE.Vector3}b=0;for(c=this.faces.length;b<c;b++){h=
this.faces[b];j=this.faceVertexUvs[0][b];if(h instanceof THREE.Face3)a(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){a(this,h.a,h.b,h.c,0,1,2);a(this,h.a,h.b,h.d,0,1,3)}}var qa=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){h=this.faces[b];for(f=0;f<h.vertexNormals.length;f++){Da.copy(h.vertexNormals[f]);e=h[qa[f]];d=Ba[e];pa.copy(d);pa.subSelf(Da.multiplyScalar(Da.dot(d))).normalize();ya.cross(h.vertexNormals[f],d);e=ya.dot(Ca[e]);e=e<0?-1:1;h.vertexTangents[f]=new THREE.Vector4(pa.x,
pa.y,pa.z,e)}}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;
if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere=
THREE.Object3D.prototype={translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==
undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);if(this.scale.x!==1||this.scale.y!==
1||this.scale.z!==1){this.matrix.scale(this.scale);this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}this.matrixWorldNeedsUpdate=!0},update:function(a,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var g=this.children.length;a<g;a++)this.children[a].update(this.matrixWorld,
c,d)}};THREE.Quaternion=function(a,c,d,g){this.set(a||0,c||0,d||0,g!==undefined?g:1)};
THREE.Quaternion.prototype={set:function(a,c,d,g){this.x=a;this.y=c;this.z=d;this.w=g;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,d=a.x*c,g=a.y*c,f=a.z*c;a=Math.cos(g);g=Math.sin(g);c=Math.cos(-f);f=Math.sin(-f);var h=Math.cos(d);d=Math.sin(d);var i=a*c,m=g*f;this.w=i*h-m*d;this.x=i*d+m*h;this.y=g*c*h+a*f*d;this.z=a*f*h-g*c*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,d=this.y,g=this.z,f=this.w,h=a.x,i=a.y,m=a.z;a=a.w;this.x=c*a+f*h+d*m-g*i;this.y=d*a+f*i+g*h-c*m;this.z=g*a+f*m+c*i-d*h;this.w=f*a-c*h-d*i-g*m;return this},
multiplyVector3:function(a,c){c||(c=a);var d=a.x,g=a.y,f=a.z,h=this.x,i=this.y,m=this.z,o=this.w,t=o*d+i*f-m*g,x=o*g+m*d-h*f,y=o*f+h*g-i*d;d=-h*d-i*g-m*f;c.x=t*o+d*-h+x*-m-y*-i;c.y=x*o+d*-i+y*-h-t*-m;c.z=y*o+d*-m+t*-i-x*-h;return c}};
THREE.Quaternion.slerp=function(a,c,d,g){var f=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;if(Math.abs(f)>=1){d.w=a.w;d.x=a.x;d.y=a.y;d.z=a.z;return d}var h=Math.acos(f),i=Math.sqrt(1-f*f);if(Math.abs(i)<0.001){d.w=0.5*(a.w+c.w);d.x=0.5*(a.x+c.x);d.y=0.5*(a.y+c.y);d.z=0.5*(a.z+c.z);return d}f=Math.sin((1-g)*h)/i;g=Math.sin(g*h)/i;d.w=a.w*f+c.w*g;d.x=a.x*f+c.x*g;d.y=a.y*f+c.y*g;d.z=a.z*f+c.z*g;return d};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
THREE.Face3=function(a,c,d,g,f,h){this.a=a;this.b=c;this.c=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=f instanceof THREE.Color?f:new THREE.Color;this.vertexColors=f instanceof Array?f:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};
THREE.Face4=function(a,c,d,g,f,h,i){this.a=a;this.b=c;this.c=d;this.d=g;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.set(a||0,c||0)};
THREE.UV.prototype={set:function(a,c){this.u=a;this.v=c;return this},copy:function(a){this.set(a.u,a.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.hasTangents=!1};
THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,g,f,h,i,m=new THREE.Vector3,o=new THREE.Vector3;g=0;for(f=this.faces.length;g<f;g++){h=this.faces[g];if(a&&h.vertexNormals.length){m.set(0,0,0);c=0;for(d=h.vertexNormals.length;c<d;c++)m.addSelf(h.vertexNormals[c]);m.divideScalar(3)}else{c=this.vertices[h.a];d=this.vertices[h.b];i=this.vertices[h.c];m.sub(i.position,d.position);o.sub(c.position,d.position);m.crossSelf(o)}m.isZero()||
m.normalize();h.normal.copy(m)}},computeVertexNormals:function(){var a,c,d,g;if(this.__tmpVertices==undefined){g=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)g[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{g=
this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)g[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){g[d.a].addSelf(d.normal);g[d.b].addSelf(d.normal);g[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){g[d.a].addSelf(d.normal);g[d.b].addSelf(d.normal);g[d.c].addSelf(d.normal);g[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)g[a].normalize();a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(g[d.a]);
d.vertexNormals[1].copy(g[d.b]);d.vertexNormals[2].copy(g[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(g[d.a]);d.vertexNormals[1].copy(g[d.b]);d.vertexNormals[2].copy(g[d.c]);d.vertexNormals[3].copy(g[d.d])}}},computeTangents:function(){function a(T,ga,ha,ja,O,ma,ka){m=T.vertices[ga].position;o=T.vertices[ha].position;t=T.vertices[ja].position;x=i[O];y=i[ma];B=i[ka];z=o.x-m.x;H=t.x-m.x;J=o.y-m.y;Q=t.y-m.y;K=o.z-m.z;ia=t.z-m.z;la=y.u-x.u;wa=B.u-x.u;S=y.v-x.v;E=B.v-x.v;fa=1/(la*E-
wa*S);R.set((E*z-S*H)*fa,(E*J-S*Q)*fa,(E*K-S*ia)*fa);N.set((la*H-wa*z)*fa,(la*Q-wa*J)*fa,(la*ia-wa*K)*fa);b[ga].addSelf(R);b[ha].addSelf(R);b[ja].addSelf(R);ra[ga].addSelf(N);ra[ha].addSelf(N);ra[ja].addSelf(N)}var c,d,g,f,h,i,m,o,t,x,y,B,z,H,J,Q,K,ia,la,wa,S,E,fa,Y,b=[],ra=[],R=new THREE.Vector3,N=new THREE.Vector3,pa=new THREE.Vector3,Aa=new THREE.Vector3,Ba=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){b[c]=new THREE.Vector3;ra[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){h=
this.faces[c];i=this.faceVertexUvs[0][c];if(h instanceof THREE.Face3)a(this,h.a,h.b,h.c,0,1,2);else if(h instanceof THREE.Face4){a(this,h.a,h.b,h.c,0,1,2);a(this,h.a,h.b,h.d,0,1,3)}}var sa=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){h=this.faces[c];for(g=0;g<h.vertexNormals.length;g++){Ba.copy(h.vertexNormals[g]);f=h[sa[g]];Y=b[f];pa.copy(Y);pa.subSelf(Ba.multiplyScalar(Ba.dot(Y))).normalize();Aa.cross(h.vertexNormals[g],Y);f=Aa.dot(ra[f]);f=f<0?-1:1;h.vertexTangents[g]=new THREE.Vector4(pa.x,
pa.y,pa.z,f)}}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;
if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere=
{radius:a}}};THREE.GeometryIdCounter=0;
THREE.AnimationHandler=function(){var a=[],b={},c={};c.update=function(e){for(var h=0;h<a.length;h++)a[h].update(e)};c.addToUpdate=function(e){a.indexOf(e)===-1&&a.push(e)};c.removeFromUpdate=function(e){e=a.indexOf(e);e!==-1&&a.splice(e,1)};c.add=function(e){b[e.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+e.name+" already exists in library. Overwriting.");b[e.name]=e;if(e.initialized!==!0){for(var h=0;h<e.hierarchy.length;h++){for(var j=0;j<e.hierarchy[h].keys.length;j++){if(e.hierarchy[h].keys[j].time<
0)e.hierarchy[h].keys[j].time=0;if(e.hierarchy[h].keys[j].rot!==undefined&&!(e.hierarchy[h].keys[j].rot instanceof THREE.Quaternion)){var p=e.hierarchy[h].keys[j].rot;e.hierarchy[h].keys[j].rot=new THREE.Quaternion(p[0],p[1],p[2],p[3])}}if(e.hierarchy[h].keys[0].morphTargets!==undefined){p={};for(j=0;j<e.hierarchy[h].keys.length;j++)for(var n=0;n<e.hierarchy[h].keys[j].morphTargets.length;n++){var s=e.hierarchy[h].keys[j].morphTargets[n];p[s]=-1}e.hierarchy[h].usedMorphTargets=p;for(j=0;j<e.hierarchy[h].keys.length;j++){var x=
{};for(s in p){for(n=0;n<e.hierarchy[h].keys[j].morphTargets.length;n++)if(e.hierarchy[h].keys[j].morphTargets[n]===s){x[s]=e.hierarchy[h].keys[j].morphTargetsInfluences[n];break}n===e.hierarchy[h].keys[j].morphTargets.length&&(x[s]=0)}e.hierarchy[h].keys[j].morphTargetsInfluences=x}}for(j=1;j<e.hierarchy[h].keys.length;j++)if(e.hierarchy[h].keys[j].time===e.hierarchy[h].keys[j-1].time){e.hierarchy[h].keys.splice(j,1);j--}for(j=1;j<e.hierarchy[h].keys.length;j++)e.hierarchy[h].keys[j].index=j}j=parseInt(e.length*
e.fps,10);e.JIT={};e.JIT.hierarchy=[];for(h=0;h<e.hierarchy.length;h++)e.JIT.hierarchy.push(Array(j));e.initialized=!0}};c.get=function(e){if(typeof e==="string")if(b[e])return b[e];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+e);return null}};c.parse=function(e){var h=[];if(e instanceof THREE.SkinnedMesh)for(var j=0;j<e.bones.length;j++)h.push(e.bones[j]);else f(e,h);return h};var f=function(e,h){h.push(e);for(var j=0;j<e.children.length;j++)f(e.children[j],h)};c.LINEAR=
0;c.CATMULLROM=1;c.CATMULLROM_FORWARD=2;return c}();THREE.Animation=function(a,b,c,f){this.root=a;this.data=THREE.AnimationHandler.get(b);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=c!==undefined?c:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==undefined?f:!0;this.points=[];this.target=new THREE.Vector3};
THREE.Animation.prototype.play=function(a,b){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=b!==undefined?b:0;var c,f=this.hierarchy.length,e;for(c=0;c<f;c++){e=this.hierarchy[c];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)e.useQuaternion=!0;e.matrixAutoUpdate=!0;if(e.animationCache===undefined){e.animationCache={};e.animationCache.prevKey={pos:0,rot:0,scl:0};e.animationCache.nextKey={pos:0,rot:0,scl:0};e.animationCache.originalMatrix=
e instanceof THREE.Bone?e.skinMatrix:e.matrix}var h=e.animationCache.prevKey;e=e.animationCache.nextKey;h.pos=this.data.hierarchy[c].keys[0];h.rot=this.data.hierarchy[c].keys[0];h.scl=this.data.hierarchy[c].keys[0];e.pos=this.getNextKeyWith("pos",c,1);e.rot=this.getNextKeyWith("rot",c,1);e.scl=this.getNextKeyWith("scl",c,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
THREE.AnimationHandler=function(){var a=[],c={},d={};d.update=function(f){for(var h=0;h<a.length;h++)a[h].update(f)};d.addToUpdate=function(f){a.indexOf(f)===-1&&a.push(f)};d.removeFromUpdate=function(f){f=a.indexOf(f);f!==-1&&a.splice(f,1)};d.add=function(f){c[f.name]!==undefined&&console.log("THREE.AnimationHandler.add: Warning! "+f.name+" already exists in library. Overwriting.");c[f.name]=f;if(f.initialized!==!0){for(var h=0;h<f.hierarchy.length;h++){for(var i=0;i<f.hierarchy[h].keys.length;i++){if(f.hierarchy[h].keys[i].time<
0)f.hierarchy[h].keys[i].time=0;if(f.hierarchy[h].keys[i].rot!==undefined&&!(f.hierarchy[h].keys[i].rot instanceof THREE.Quaternion)){var m=f.hierarchy[h].keys[i].rot;f.hierarchy[h].keys[i].rot=new THREE.Quaternion(m[0],m[1],m[2],m[3])}}if(f.hierarchy[h].keys[0].morphTargets!==undefined){m={};for(i=0;i<f.hierarchy[h].keys.length;i++)for(var o=0;o<f.hierarchy[h].keys[i].morphTargets.length;o++){var t=f.hierarchy[h].keys[i].morphTargets[o];m[t]=-1}f.hierarchy[h].usedMorphTargets=m;for(i=0;i<f.hierarchy[h].keys.length;i++){var x=
{};for(t in m){for(o=0;o<f.hierarchy[h].keys[i].morphTargets.length;o++)if(f.hierarchy[h].keys[i].morphTargets[o]===t){x[t]=f.hierarchy[h].keys[i].morphTargetsInfluences[o];break}o===f.hierarchy[h].keys[i].morphTargets.length&&(x[t]=0)}f.hierarchy[h].keys[i].morphTargetsInfluences=x}}for(i=1;i<f.hierarchy[h].keys.length;i++)if(f.hierarchy[h].keys[i].time===f.hierarchy[h].keys[i-1].time){f.hierarchy[h].keys.splice(i,1);i--}for(i=1;i<f.hierarchy[h].keys.length;i++)f.hierarchy[h].keys[i].index=i}i=parseInt(f.length*
f.fps,10);f.JIT={};f.JIT.hierarchy=[];for(h=0;h<f.hierarchy.length;h++)f.JIT.hierarchy.push(Array(i));f.initialized=!0}};d.get=function(f){if(typeof f==="string")if(c[f])return c[f];else{console.log("THREE.AnimationHandler.get: Couldn't find animation "+f);return null}};d.parse=function(f){var h=[];if(f instanceof THREE.SkinnedMesh)for(var i=0;i<f.bones.length;i++)h.push(f.bones[i]);else g(f,h);return h};var g=function(f,h){h.push(f);for(var i=0;i<f.children.length;i++)g(f.children[i],h)};d.LINEAR=
0;d.CATMULLROM=1;d.CATMULLROM_FORWARD=2;return d}();THREE.Animation=function(a,c,d,g){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.isPaused=!0;this.loop=!0;this.interpolationType=d!==undefined?d:THREE.AnimationHandler.LINEAR;this.JITCompile=g!==undefined?g:!0;this.points=[];this.target=new THREE.Vector3};
THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==undefined?a:!0;this.currentTime=c!==undefined?c:0;var d,g=this.hierarchy.length,f;for(d=0;d<g;d++){f=this.hierarchy[d];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)f.useQuaternion=!0;f.matrixAutoUpdate=!0;if(f.animationCache===undefined){f.animationCache={};f.animationCache.prevKey={pos:0,rot:0,scl:0};f.animationCache.nextKey={pos:0,rot:0,scl:0};f.animationCache.originalMatrix=
f instanceof THREE.Bone?f.skinMatrix:f.matrix}var h=f.animationCache.prevKey;f=f.animationCache.nextKey;h.pos=this.data.hierarchy[d].keys[0];h.rot=this.data.hierarchy[d].keys[0];h.scl=this.data.hierarchy[d].keys[0];f.pos=this.getNextKeyWith("pos",d,1);f.rot=this.getNextKeyWith("rot",d,1);f.scl=this.getNextKeyWith("scl",d,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
THREE.Animation.prototype.stop=function(){this.isPlaying=!1;this.isPaused=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==undefined){if(this.hierarchy[a]instanceof THREE.Bone)this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix;else this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix;delete this.hierarchy[a].animationCache}};
THREE.Animation.prototype.update=function(a){if(this.isPlaying){var b=["pos","rot","scl"],c,f,e,h,j,p,n,s,x=this.data.JIT.hierarchy,z,C;this.currentTime+=a*this.timeScale;C=this.currentTime;z=this.currentTime%=this.data.length;s=parseInt(Math.min(z*this.data.fps,this.data.length*this.data.fps),10);for(var y=0,J=this.hierarchy.length;y<J;y++){a=this.hierarchy[y];n=a.animationCache;if(this.JITCompile&&x[y][s]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=x[y][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
!1}else{a.matrix=x[y][s];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var K=0;K<3;K++){c=b[K];j=n.prevKey[c];p=n.nextKey[c];if(p.time<=C){if(z<C)if(this.loop){j=this.data.hierarchy[y].keys[0];for(p=this.getNextKeyWith(c,y,1);p.time<z;){j=p;p=this.getNextKeyWith(c,y,p.index+1)}}else{this.stop();return}else{do{j=p;p=this.getNextKeyWith(c,y,p.index+1)}while(p.time<
z)}n.prevKey[c]=j;n.nextKey[c]=p}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;f=(z-j.time)/(p.time-j.time);e=j[c];h=p[c];if(f<0||f>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+y);f=f<0?0:1}if(c==="pos"){c=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){c.x=e[0]+(h[0]-e[0])*f;c.y=e[1]+(h[1]-e[1])*f;c.z=e[2]+(h[2]-e[2])*f}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
this.getPrevKeyWith("pos",y,j.index-1).pos;this.points[1]=e;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",y,p.index+1).pos;f=f*0.33+0.33;e=this.interpolateCatmullRom(this.points,f);c.x=e[0];c.y=e[1];c.z=e[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){f=this.interpolateCatmullRom(this.points,f*1.01);this.target.set(f[0],f[1],f[2]);this.target.subSelf(c);this.target.y=0;this.target.normalize();f=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,f,0)}}}else if(c===
"rot")THREE.Quaternion.slerp(e,h,a.quaternion,f);else if(c==="scl"){c=a.scale;c.x=e[0]+(h[0]-e[0])*f;c.y=e[1]+(h[1]-e[1])*f;c.z=e[2]+(h[2]-e[2])*f}}}}if(this.JITCompile&&x[0][s]===undefined){this.hierarchy[0].update(undefined,!0);for(y=0;y<this.hierarchy.length;y++)x[y][s]=this.hierarchy[y]instanceof THREE.Bone?this.hierarchy[y].skinMatrix.clone():this.hierarchy[y].matrix.clone()}}};
THREE.Animation.prototype.interpolateCatmullRom=function(a,b){var c=[],f=[],e,h,j,p,n,s;e=(a.length-1)*b;h=Math.floor(e);e-=h;c[0]=h==0?h:h-1;c[1]=h;c[2]=h>a.length-2?h:h+1;c[3]=h>a.length-3?h:h+2;h=a[c[0]];p=a[c[1]];n=a[c[2]];s=a[c[3]];c=e*e;j=e*c;f[0]=this.interpolate(h[0],p[0],n[0],s[0],e,c,j);f[1]=this.interpolate(h[1],p[1],n[1],s[1],e,c,j);f[2]=this.interpolate(h[2],p[2],n[2],s[2],e,c,j);return f};
THREE.Animation.prototype.interpolate=function(a,b,c,f,e,h,j){a=(c-a)*0.5;f=(f-b)*0.5;return(2*(b-c)+a+f)*j+(-3*(b-c)-2*a-f)*h+a*e+b};THREE.Animation.prototype.getNextKeyWith=function(a,b,c){var f=this.data.hierarchy[b].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)c=c<f.length-1?c:f.length-1;else c%=f.length;for(;c<f.length;c++)if(f[c][a]!==undefined)return f[c];return this.data.hierarchy[b].keys[0]};
THREE.Animation.prototype.getPrevKeyWith=function(a,b,c){var f=this.data.hierarchy[b].keys;for(c=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?c>0?c:0:c>=0?c:c+f.length;c>=0;c--)if(f[c][a]!==undefined)return f[c];return this.data.hierarchy[b].keys[f.length-1]};
THREE.Camera=function(a,b,c,f,e){THREE.Object3D.call(this);this.fov=a||50;this.aspect=b||1;this.near=c||0.1;this.far=f||2E3;this.target=e||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
THREE.Camera.prototype.translate=function(a,b){this.matrix.rotateAxis(b);this.position.addSelf(b.multiplyScalar(a));this.target.position.addSelf(b.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
THREE.Camera.prototype.update=function(a,b,c){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);b=!0}else{this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
!1;b=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],d,g,f,h,i,m,o,t,x=this.data.JIT.hierarchy,y,B;this.currentTime+=a*this.timeScale;B=this.currentTime;y=this.currentTime%=this.data.length;t=parseInt(Math.min(y*this.data.fps,this.data.length*this.data.fps),10);for(var z=0,H=this.hierarchy.length;z<H;z++){a=this.hierarchy[z];o=a.animationCache;if(this.JITCompile&&x[z][t]!==undefined)if(a instanceof THREE.Bone){a.skinMatrix=x[z][t];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=
!1}else{a.matrix=x[z][t];a.matrixAutoUpdate=!1;a.matrixWorldNeedsUpdate=!0}else{if(this.JITCompile)if(a instanceof THREE.Bone)a.skinMatrix=a.animationCache.originalMatrix;else a.matrix=a.animationCache.originalMatrix;for(var J=0;J<3;J++){d=c[J];i=o.prevKey[d];m=o.nextKey[d];if(m.time<=B){if(y<B)if(this.loop){i=this.data.hierarchy[z].keys[0];for(m=this.getNextKeyWith(d,z,1);m.time<y;){i=m;m=this.getNextKeyWith(d,z,m.index+1)}}else{this.stop();return}else{do{i=m;m=this.getNextKeyWith(d,z,m.index+1)}while(m.time<
y)}o.prevKey[d]=i;o.nextKey[d]=m}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;g=(y-i.time)/(m.time-i.time);f=i[d];h=m[d];if(g<0||g>1){console.log("THREE.Animation.update: Warning! Scale out of bounds:"+g+" on bone "+z);g=g<0?0:1}if(d==="pos"){d=a.position;if(this.interpolationType===THREE.AnimationHandler.LINEAR){d.x=f[0]+(h[0]-f[0])*g;d.y=f[1]+(h[1]-f[1])*g;d.z=f[2]+(h[2]-f[2])*g}else if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){this.points[0]=
this.getPrevKeyWith("pos",z,i.index-1).pos;this.points[1]=f;this.points[2]=h;this.points[3]=this.getNextKeyWith("pos",z,m.index+1).pos;g=g*0.33+0.33;f=this.interpolateCatmullRom(this.points,g);d.x=f[0];d.y=f[1];d.z=f[2];if(this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD){g=this.interpolateCatmullRom(this.points,g*1.01);this.target.set(g[0],g[1],g[2]);this.target.subSelf(d);this.target.y=0;this.target.normalize();g=Math.atan2(this.target.x,this.target.z);a.rotation.set(0,g,0)}}}else if(d===
"rot")THREE.Quaternion.slerp(f,h,a.quaternion,g);else if(d==="scl"){d=a.scale;d.x=f[0]+(h[0]-f[0])*g;d.y=f[1]+(h[1]-f[1])*g;d.z=f[2]+(h[2]-f[2])*g}}}}if(this.JITCompile&&x[0][t]===undefined){this.hierarchy[0].update(undefined,!0);for(z=0;z<this.hierarchy.length;z++)x[z][t]=this.hierarchy[z]instanceof THREE.Bone?this.hierarchy[z].skinMatrix.clone():this.hierarchy[z].matrix.clone()}}};
THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var d=[],g=[],f,h,i,m,o,t;f=(a.length-1)*c;h=Math.floor(f);f-=h;d[0]=h==0?h:h-1;d[1]=h;d[2]=h>a.length-2?h:h+1;d[3]=h>a.length-3?h:h+2;h=a[d[0]];m=a[d[1]];o=a[d[2]];t=a[d[3]];d=f*f;i=f*d;g[0]=this.interpolate(h[0],m[0],o[0],t[0],f,d,i);g[1]=this.interpolate(h[1],m[1],o[1],t[1],f,d,i);g[2]=this.interpolate(h[2],m[2],o[2],t[2],f,d,i);return g};
THREE.Animation.prototype.interpolate=function(a,c,d,g,f,h,i){a=(d-a)*0.5;g=(g-c)*0.5;return(2*(c-d)+a+g)*i+(-3*(c-d)-2*a-g)*h+a*f+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,d){var g=this.data.hierarchy[c].keys;if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=d<g.length-1?d:g.length-1;else d%=g.length;for(;d<g.length;d++)if(g[d][a]!==undefined)return g[d];return this.data.hierarchy[c].keys[0]};
THREE.Animation.prototype.getPrevKeyWith=function(a,c,d){var g=this.data.hierarchy[c].keys;for(d=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?d>0?d:0:d>=0?d:d+g.length;d>=0;d--)if(g[d][a]!==undefined)return g[d];return this.data.hierarchy[c].keys[g.length-1]};
THREE.Camera=function(a,c,d,g,f){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=d||0.1;this.far=g||2E3;this.target=f||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
THREE.Camera.prototype.translate=function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a));this.target.position.addSelf(c.multiplyScalar(a))};THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};THREE.Camera.prototype.updateMatrix=function(){this.update(undefined,!0)};
THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};
THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
@@ -109,48 +109,54 @@ undefined)this.vertexShader=a.vertexShader;if(a.uniforms!==undefined)this.unifor
if(a.wireframeLinejoin!==undefined)this.wireframeLinejoin=a.wireframeLinejoin;if(a.lights!==undefined)this.lights=a.lights;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors;if(a.skinning!==undefined)this.skinning=a.skinning;if(a.morphTargets!==undefined)this.morphTargets=a.morphTargets}};
THREE.ParticleBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.sizeAttenuation=!0;this.blending=THREE.NormalBlending;this.depthTest=!0;this.offset=new THREE.Vector2;this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.sizeAttenuation!==undefined)this.sizeAttenuation=
a.sizeAttenuation;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
THREE.Texture=function(a,b,c,f,e,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrapS=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrapT=f!==undefined?f:THREE.ClampToEdgeWrapping;this.magFilter=e!==undefined?e:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
THREE.ShadowVolumeDynamicMaterial=function(){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;this.morphTargets=
!1};THREE.Texture=function(a,c,d,g,f,h){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrapS=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrapT=g!==undefined?g:THREE.ClampToEdgeWrapping;this.magFilter=f!==undefined?f:THREE.LinearFilter;this.minFilter=h!==undefined?h:THREE.LinearMipMapLinearFilter;this.needsUpdate=!1};THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter)}};
THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;
THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==undefined?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==undefined?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==undefined?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==undefined?c.minFilter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
var Uniforms={clone:function(a){var b,c,f,e={};for(b in a){e[b]={};for(c in a[b]){f=a[b][c];e[b][c]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return e},merge:function(a){var b,c,f,e={};for(b=0;b<a.length;b++){f=this.clone(a[b]);for(c in f)e[c]=f[c]}return e}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrapS=d.wrapS!==undefined?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==undefined?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==undefined?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==undefined?d.minFilter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
var Uniforms={clone:function(a){var c,d,g,f={};for(c in a){f[c]={};for(d in a[c]){g=a[c][d];f[c][d]=g instanceof THREE.Color||g instanceof THREE.Vector3||g instanceof THREE.Texture?g.clone():g}}return f},merge:function(a){var c,d,g,f={};for(c=0;c<a.length;c++){g=this.clone(a[c]);for(d in g)f[d]=g[d]}return f}};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.matrixAutoUpdate=!1};THREE.Particle.prototype=new THREE.Object3D;
THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b&&b.length?b:[b];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var c=0;c<this.geometry.morphTargets.length;c++){this.morphTargetInfluences.push(0);
this.morphTargetDictionary[this.geometry.morphTargets[c].name]=c}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius;if(this.geometry.morphTargets.length){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++){this.morphTargetInfluences.push(0);
this.morphTargetDictionary[this.geometry.morphTargets[d].name]=d}}}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(this.morphTargetDictionary[a]!==undefined)return this.morphTargetDictionary[a];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+a+" does not exist. Returning 0.");return 0};
THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
THREE.Bone.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f,e=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(f=0;f<e;f++){a=this.children[f];a instanceof THREE.Bone?a.update(this.skinMatrix,b,c):a.update(this.matrixWorld,!0,c)}}else for(f=0;f<e;f++)this.children[f].update(this.skinMatrix,
b,c)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,f,e,h,j,p;if(this.geometry.bones!==undefined){for(c=0;c<this.geometry.bones.length;c++){e=this.geometry.bones[c];h=e.pos;j=e.rotq;p=e.scl;f=this.addBone();f.name=e.name;f.position.set(h[0],h[1],h[2]);f.quaternion.set(j[0],j[1],j[2],j[3]);f.useQuaternion=!0;p!==undefined?f.scale.set(p[0],p[1],p[2]):f.scale.set(1,1,1)}for(c=0;c<this.bones.length;c++){e=this.geometry.bones[c];
f=this.bones[c];e.parent===-1?this.addChild(f):this.bones[e.parent].addChild(f)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
THREE.SkinnedMesh.prototype.update=function(a,b,c){if(this.visible){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f,e=this.children.length;for(f=0;f<e;f++){a=this.children[f];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,c):a.update(this.matrixWorld,b,c)}c=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(b=0;b<c;b++)ba[b].skinMatrix.flattenToArrayOffset(bm,
b*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var f;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var e=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;
f=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[e].multiplyVector3(f));f=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[h].multiplyVector3(f));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
THREE.Ribbon=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
THREE.Sound=function(a,b,c,f){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=b!==undefined?Math.abs(b):100;this.volume=Math.min(1,Math.max(0,c!==undefined?c:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=f!==undefined?f:!0;this.sources=a instanceof Array?a:[a];var e;c=this.sources.length;for(a=0;a<c;a++){b=this.sources[a];b.toLowerCase();if(b.indexOf(".mp3")!==-1)e=
"audio/mpeg";else if(b.indexOf(".ogg")!==-1)e="audio/ogg";else b.indexOf(".wav")!==-1&&(e="audio/wav");if(this.domElement.canPlayType(e)){e=document.createElement("source");e.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(e);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
THREE.Bone.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g,f=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(g=0;g<f;g++){a=this.children[g];a instanceof THREE.Bone?a.update(this.skinMatrix,c,d):a.update(this.matrixWorld,!0,d)}}else for(g=0;g<f;g++)this.children[g].update(this.skinMatrix,
c,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
THREE.SkinnedMesh=function(a,c){THREE.Mesh.call(this,a,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,g,f,h,i,m;if(this.geometry.bones!==undefined){for(d=0;d<this.geometry.bones.length;d++){f=this.geometry.bones[d];h=f.pos;i=f.rotq;m=f.scl;g=this.addBone();g.name=f.name;g.position.set(h[0],h[1],h[2]);g.quaternion.set(i[0],i[1],i[2],i[3]);g.useQuaternion=!0;m!==undefined?g.scale.set(m[0],m[1],m[2]):g.scale.set(1,1,1)}for(d=0;d<this.bones.length;d++){f=this.geometry.bones[d];
g=this.bones[d];f.parent===-1?this.addChild(g):this.bones[f.parent].addChild(g)}this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
THREE.SkinnedMesh.prototype.update=function(a,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g,f=this.children.length;for(g=0;g<f;g++){a=this.children[g];a instanceof THREE.Bone?a.update(this.identityMatrix,!1,d):a.update(this.matrixWorld,c,d)}d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
c*16)}};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,c=[],d=0;d<this.bones.length;d++){a=this.bones[d];c.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var g;for(a=0;a<this.geometry.skinIndices.length;a++){d=this.geometry.vertices[a].position;var f=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;
g=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesA.push(c[f].multiplyVector3(g));g=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[h].multiplyVector3(g));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){d=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=d;this.geometry.skinWeights[a].y+=d}}}};
THREE.Ribbon=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.flipSided=!1;this.doubleSided=!1};THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;
THREE.Sound=function(a,c,d,g){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=g!==undefined?g:!0;this.sources=a instanceof Array?a:[a];var f;d=this.sources.length;for(a=0;a<d;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)f=
"audio/mpeg";else if(c.indexOf(".ogg")!==-1)f="audio/ogg";else c.indexOf(".wav")!==-1&&(f="audio/wav");if(this.domElement.canPlayType(f)){f=document.createElement("source");f.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(f);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
THREE.Sound.prototype.update=function(a,b,c){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);b=!0}if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}var f=this.children.length;for(a=0;a<f;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,b){b===undefined&&(b=0);b=Math.abs(b);for(var c=0;c<this.LODs.length;c++)if(b<this.LODs[c].visibleAtDistance)break;this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.addChild(a)};
THREE.LOD.prototype.update=function(a,b,c){this.matrixAutoUpdate&&(b|=this.updateMatrix());if(b||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;b=!0}if(this.LODs.length>1){a=c.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var f=1;f<this.LODs.length;f++)if(a>=this.LODs[f].visibleAtDistance){this.LODs[f-1].object3D.visible=
!1;this.LODs[f].object3D.visible=!0}else break;for(;f<this.LODs.length;f++)this.LODs[f].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,b,c)};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};
THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else if(a instanceof THREE.Sound){b=this.sounds.indexOf(a);b!==-1&&this.sounds.splice(b,1)}else if(!(a instanceof THREE.Camera)){b=this.objects.indexOf(a);if(b!==-1){this.objects.splice(b,1);this.__objectsRemoved.push(a)}}for(b=0;b<a.children.length;b++)this.removeChildRecurse(a.children[b])};
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==undefined?b:2.5E-4};
THREE.Projector=function(){function a(){var Q=n[p]=n[p]||new THREE.RenderableVertex;p++;return Q}function b(Q,N){return N.z-Q.z}function c(Q,N){var pa=0,ya=1,Da=Q.z+Q.w,qa=N.z+N.w,V=-Q.z+Q.w,ha=-N.z+N.w;if(Da>=0&&qa>=0&&V>=0&&ha>=0)return!0;else if(Da<0&&qa<0||V<0&&ha<0)return!1;else{if(Da<0)pa=Math.max(pa,Da/(Da-qa));else qa<0&&(ya=Math.min(ya,Da/(Da-qa)));if(V<0)pa=Math.max(pa,V/(V-ha));else ha<0&&(ya=Math.min(ya,V/(V-ha)));if(ya<pa)return!1;else{Q.lerpSelf(N,pa);N.lerpSelf(Q,1-ya);return!0}}}var f,
e,h=[],j,p,n=[],s,x,z=[],C,y=[],J,K,P=[],L,ja,ma=[],sa=new THREE.Vector4,U=new THREE.Vector4,A=new THREE.Matrix4,oa=new THREE.Matrix4,d=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ba=new THREE.Vector4,Ca=new THREE.Vector4;this.projectVector=function(Q,N){A.multiply(N.projectionMatrix,N.matrixWorldInverse);A.multiplyVector3(Q);return Q};this.unprojectVector=function(Q,N){A.multiply(N.matrixWorld,THREE.Matrix4.makeInvert(N.projectionMatrix));
A.multiplyVector3(Q);return Q};this.projectObjects=function(Q,N,pa){N=[];var ya,Da,qa;e=0;Da=Q.objects;Q=0;for(ya=Da.length;Q<ya;Q++){qa=Da[Q];var V;if(!(V=!qa.visible))if(V=qa instanceof THREE.Mesh){a:{V=void 0;for(var ha=qa.matrixWorld,ia=-qa.geometry.boundingSphere.radius*Math.max(qa.scale.x,Math.max(qa.scale.y,qa.scale.z)),W=0;W<6;W++){V=d[W].x*ha.n14+d[W].y*ha.n24+d[W].z*ha.n34+d[W].w;if(V<=ia){V=!1;break a}}V=!0}V=!V}if(!V){V=h[e]=h[e]||new THREE.RenderableObject;e++;f=V;sa.copy(qa.position);
A.multiplyVector3(sa);f.object=qa;f.z=sa.z;N.push(f)}}pa&&N.sort(b);return N};this.projectScene=function(Q,N,pa){var ya=[],Da=N.near,qa=N.far,V,ha,ia,W,S,ta,ka,za,La,la,Na,Wa,g,m,o,i,k;ja=K=C=x=0;N.matrixAutoUpdate&&N.updateMatrix();Q.update(undefined,!1,N);A.multiply(N.projectionMatrix,N.matrixWorldInverse);d[0].set(A.n41-A.n11,A.n42-A.n12,A.n43-A.n13,A.n44-A.n14);d[1].set(A.n41+A.n11,A.n42+A.n12,A.n43+A.n13,A.n44+A.n14);d[2].set(A.n41+A.n21,A.n42+A.n22,A.n43+A.n23,A.n44+A.n24);d[3].set(A.n41-A.n21,
A.n42-A.n22,A.n43-A.n23,A.n44-A.n24);d[4].set(A.n41-A.n31,A.n42-A.n32,A.n43-A.n33,A.n44-A.n34);d[5].set(A.n41+A.n31,A.n42+A.n32,A.n43+A.n33,A.n44+A.n34);for(V=0;V<6;V++){La=d[V];La.divideScalar(Math.sqrt(La.x*La.x+La.y*La.y+La.z*La.z))}La=this.projectObjects(Q,N,!0);Q=0;for(V=La.length;Q<V;Q++){la=La[Q].object;if(la.visible){Na=la.matrixWorld;Wa=la.matrixRotationWorld;g=la.materials;m=la.overdraw;p=0;if(la instanceof THREE.Mesh){o=la.geometry;W=o.vertices;i=o.faces;o=o.faceVertexUvs;ha=0;for(ia=W.length;ha<
ia;ha++){j=a();j.positionWorld.copy(W[ha].position);Na.multiplyVector3(j.positionWorld);j.positionScreen.copy(j.positionWorld);A.multiplyVector4(j.positionScreen);j.positionScreen.x/=j.positionScreen.w;j.positionScreen.y/=j.positionScreen.w;j.visible=j.positionScreen.z>Da&&j.positionScreen.z<qa}W=0;for(ha=i.length;W<ha;W++){ia=i[W];if(ia instanceof THREE.Face3){S=n[ia.a];ta=n[ia.b];ka=n[ia.c];if(S.visible&&ta.visible&&ka.visible&&(la.doubleSided||la.flipSided!=(ka.positionScreen.x-S.positionScreen.x)*
(ta.positionScreen.y-S.positionScreen.y)-(ka.positionScreen.y-S.positionScreen.y)*(ta.positionScreen.x-S.positionScreen.x)<0)){za=z[x]=z[x]||new THREE.RenderableFace3;x++;s=za;s.v1.copy(S);s.v2.copy(ta);s.v3.copy(ka)}else continue}else if(ia instanceof THREE.Face4){S=n[ia.a];ta=n[ia.b];ka=n[ia.c];za=n[ia.d];if(S.visible&&ta.visible&&ka.visible&&za.visible&&(la.doubleSided||la.flipSided!=((za.positionScreen.x-S.positionScreen.x)*(ta.positionScreen.y-S.positionScreen.y)-(za.positionScreen.y-S.positionScreen.y)*
(ta.positionScreen.x-S.positionScreen.x)<0||(ta.positionScreen.x-ka.positionScreen.x)*(za.positionScreen.y-ka.positionScreen.y)-(ta.positionScreen.y-ka.positionScreen.y)*(za.positionScreen.x-ka.positionScreen.x)<0))){k=y[C]=y[C]||new THREE.RenderableFace4;C++;s=k;s.v1.copy(S);s.v2.copy(ta);s.v3.copy(ka);s.v4.copy(za)}else continue}s.normalWorld.copy(ia.normal);Wa.multiplyVector3(s.normalWorld);s.centroidWorld.copy(ia.centroid);Na.multiplyVector3(s.centroidWorld);s.centroidScreen.copy(s.centroidWorld);
A.multiplyVector3(s.centroidScreen);ka=ia.vertexNormals;S=0;for(ta=ka.length;S<ta;S++){za=s.vertexNormalsWorld[S];za.copy(ka[S]);Wa.multiplyVector3(za)}S=0;for(ta=o.length;S<ta;S++)if(k=o[S][W]){ka=0;for(za=k.length;ka<za;ka++)s.uvs[S][ka]=k[ka]}s.meshMaterials=g;s.faceMaterials=ia.materials;s.overdraw=m;s.z=s.centroidScreen.z;ya.push(s)}}else if(la instanceof THREE.Line){oa.multiply(A,Na);W=la.geometry.vertices;S=a();S.positionScreen.copy(W[0].position);oa.multiplyVector4(S.positionScreen);ha=1;
for(ia=W.length;ha<ia;ha++){S=a();S.positionScreen.copy(W[ha].position);oa.multiplyVector4(S.positionScreen);ta=n[p-2];Ba.copy(S.positionScreen);Ca.copy(ta.positionScreen);if(c(Ba,Ca)){Ba.multiplyScalar(1/Ba.w);Ca.multiplyScalar(1/Ca.w);Na=P[K]=P[K]||new THREE.RenderableLine;K++;J=Na;J.v1.positionScreen.copy(Ba);J.v2.positionScreen.copy(Ca);J.z=Math.max(Ba.z,Ca.z);J.materials=la.materials;ya.push(J)}}}else if(la instanceof THREE.Particle){U.set(la.position.x,la.position.y,la.position.z,1);A.multiplyVector4(U);
U.z/=U.w;if(U.z>0&&U.z<1){Na=ma[ja]=ma[ja]||new THREE.RenderableParticle;ja++;L=Na;L.x=U.x/U.w;L.y=U.y/U.w;L.z=U.z;L.rotation=la.rotation.z;L.scale.x=la.scale.x*Math.abs(L.x-(U.x+N.projectionMatrix.n11)/(U.w+N.projectionMatrix.n14));L.scale.y=la.scale.y*Math.abs(L.y-(U.y+N.projectionMatrix.n22)/(U.w+N.projectionMatrix.n24));L.materials=la.materials;ya.push(L)}}}}pa&&ya.sort(b);return ya}};
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,b,c){c&&a.update(undefined,!1,b);c=a.sounds;var f,e=c.length;for(f=0;f<e;f++){a=c[f];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(b.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
THREE.Sound.prototype.update=function(a,c,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var g=this.children.length;for(a=0;a<g;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.LOD=function(){THREE.Object3D.call(this);this.LODs=[]};THREE.LOD.prototype=new THREE.Object3D;THREE.LOD.prototype.constructor=THREE.LOD;
THREE.LOD.prototype.supr=THREE.Object3D.prototype;THREE.LOD.prototype.add=function(a,c){c===undefined&&(c=0);c=Math.abs(c);for(var d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:a});this.addChild(a)};
THREE.LOD.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}if(this.LODs.length>1){a=d.matrixWorldInverse;a=-(a.n31*this.position.x+a.n32*this.position.y+a.n33*this.position.z+a.n34);this.LODs[0].object3D.visible=!0;for(var g=1;g<this.LODs.length;g++)if(a>=this.LODs[g].visibleAtDistance){this.LODs[g-1].object3D.visible=
!1;this.LODs[g].object3D.visible=!0}else break;for(;g<this.LODs.length;g++)this.LODs[g].object3D.visible=!1}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.ShadowVolume=function(a,c){THREE.Mesh.call(this,a.geometry,c?[new THREE.ShadowVolumeDynamicMaterial]:[new THREE.ShadowVolumeDynamicMaterial]);a.addChild(this);this.calculateShadowVolumeGeometry(a.geometry)};THREE.ShadowVolume.prototype=new THREE.Mesh;THREE.ShadowVolume.prototype.constructor=THREE.ShadowVolume;
THREE.ShadowVolume.prototype.supr=THREE.Mesh.prototype;
THREE.ShadowVolume.prototype.calculateShadowVolumeGeometry=function(a){this.geometry=new THREE.Geometry;this.geometry.boundingSphere=a.boundingSphere;this.geometry.edgeFaces=[];var c=this.geometry.vertices,d=this.geometry.faces,g=this.geometry.edgeFaces,f=a.faces;a=a.vertices;var h=f.length,i,m,o,t,x,y=["a","b","c","d"];for(o=0;o<h;o++){m=c.length;i=f[o];if(i instanceof THREE.Face4){t=4;m=new THREE.Face4(m,m+1,m+2,m+3)}else{t=3;m=new THREE.Face3(m,m+1,m+2)}m.normal.copy(i.normal);d.push(m);for(m=
0;m<t;m++){x=a[i[y[m]]];c.push(new THREE.Vertex(x.position.clone()))}}for(h=0;h<f.length-1;h++){a=d[h];for(i=h+1;i<f.length;i++){m=d[i];m=this.facesShareEdge(c,a,m);if(m!==undefined){m=new THREE.Face4(m.indices[0],m.indices[3],m.indices[2],m.indices[1]);m.normal.set(1,0,0);g.push(m)}}}};
THREE.ShadowVolume.prototype.facesShareEdge=function(a,c,d){var g,f,h,i,m,o,t,x,y,B,z,H,J,Q=0,K=["a","b","c","d"];g=c instanceof THREE.Face4?4:3;f=d instanceof THREE.Face4?4:3;for(H=0;H<g;H++){h=c[K[H]];m=a[h];for(J=0;J<f;J++){i=d[K[J]];o=a[i];if(Math.abs(m.position.x-o.position.x)<1.0E-4&&Math.abs(m.position.y-o.position.y)<1.0E-4&&Math.abs(m.position.z-o.position.z)<1.0E-4){Q++;if(Q===1){t=m;x=o;y=h;B=i;z=K[H]}if(Q===2){z+=K[H];return z==="ad"||z==="ac"?{faces:[c,d],vertices:[t,x,o,m],indices:[y,
B,i,h],vertexTypes:[1,2,2,1],extrudable:!0}:{faces:[c,d],vertices:[t,m,o,x],indices:[y,h,i,B],vertexTypes:[1,1,2,2],extrudable:!0}}}}}};THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;
THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==undefined?c:2.5E-4};
THREE.Projector=function(){function a(){var R=o[m]=o[m]||new THREE.RenderableVertex;m++;return R}function c(R,N){return N.z-R.z}function d(R,N){var pa=0,Aa=1,Ba=R.z+R.w,sa=N.z+N.w,T=-R.z+R.w,ga=-N.z+N.w;if(Ba>=0&&sa>=0&&T>=0&&ga>=0)return!0;else if(Ba<0&&sa<0||T<0&&ga<0)return!1;else{if(Ba<0)pa=Math.max(pa,Ba/(Ba-sa));else sa<0&&(Aa=Math.min(Aa,Ba/(Ba-sa)));if(T<0)pa=Math.max(pa,T/(T-ga));else ga<0&&(Aa=Math.min(Aa,T/(T-ga)));if(Aa<pa)return!1;else{R.lerpSelf(N,pa);N.lerpSelf(R,1-Aa);return!0}}}var g,
f,h=[],i,m,o=[],t,x,y=[],B,z=[],H,J,Q=[],K,ia,la=[],wa=new THREE.Vector4,S=new THREE.Vector4,E=new THREE.Matrix4,fa=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],b=new THREE.Vector4,ra=new THREE.Vector4;this.projectVector=function(R,N){E.multiply(N.projectionMatrix,N.matrixWorldInverse);E.multiplyVector3(R);return R};this.unprojectVector=function(R,N){E.multiply(N.matrixWorld,THREE.Matrix4.makeInvert(N.projectionMatrix));
E.multiplyVector3(R);return R};this.projectObjects=function(R,N,pa){N=[];var Aa,Ba,sa;f=0;Ba=R.objects;R=0;for(Aa=Ba.length;R<Aa;R++){sa=Ba[R];var T;if(!(T=!sa.visible))if(T=sa instanceof THREE.Mesh){a:{T=void 0;for(var ga=sa.matrixWorld,ha=-sa.geometry.boundingSphere.radius*Math.max(sa.scale.x,Math.max(sa.scale.y,sa.scale.z)),ja=0;ja<6;ja++){T=Y[ja].x*ga.n14+Y[ja].y*ga.n24+Y[ja].z*ga.n34+Y[ja].w;if(T<=ha){T=!1;break a}}T=!0}T=!T}if(!T){T=h[f]=h[f]||new THREE.RenderableObject;f++;g=T;wa.copy(sa.position);
E.multiplyVector3(wa);g.object=sa;g.z=wa.z;N.push(g)}}pa&&N.sort(c);return N};this.projectScene=function(R,N,pa){var Aa=[],Ba=N.near,sa=N.far,T,ga,ha,ja,O,ma,ka,Ca,Fa,na,Ea,Wa,Ya,xa,e,p,n;ia=J=B=x=0;N.matrixAutoUpdate&&N.updateMatrix();R.update(undefined,!1,N);E.multiply(N.projectionMatrix,N.matrixWorldInverse);Y[0].set(E.n41-E.n11,E.n42-E.n12,E.n43-E.n13,E.n44-E.n14);Y[1].set(E.n41+E.n11,E.n42+E.n12,E.n43+E.n13,E.n44+E.n14);Y[2].set(E.n41+E.n21,E.n42+E.n22,E.n43+E.n23,E.n44+E.n24);Y[3].set(E.n41-
E.n21,E.n42-E.n22,E.n43-E.n23,E.n44-E.n24);Y[4].set(E.n41-E.n31,E.n42-E.n32,E.n43-E.n33,E.n44-E.n34);Y[5].set(E.n41+E.n31,E.n42+E.n32,E.n43+E.n33,E.n44+E.n34);for(T=0;T<6;T++){Fa=Y[T];Fa.divideScalar(Math.sqrt(Fa.x*Fa.x+Fa.y*Fa.y+Fa.z*Fa.z))}Fa=this.projectObjects(R,N,!0);R=0;for(T=Fa.length;R<T;R++){na=Fa[R].object;if(na.visible){Ea=na.matrixWorld;Wa=na.matrixRotationWorld;Ya=na.materials;xa=na.overdraw;m=0;if(na instanceof THREE.Mesh){e=na.geometry;ja=e.vertices;p=e.faces;e=e.faceVertexUvs;ga=0;
for(ha=ja.length;ga<ha;ga++){i=a();i.positionWorld.copy(ja[ga].position);Ea.multiplyVector3(i.positionWorld);i.positionScreen.copy(i.positionWorld);E.multiplyVector4(i.positionScreen);i.positionScreen.x/=i.positionScreen.w;i.positionScreen.y/=i.positionScreen.w;i.visible=i.positionScreen.z>Ba&&i.positionScreen.z<sa}ja=0;for(ga=p.length;ja<ga;ja++){ha=p[ja];if(ha instanceof THREE.Face3){O=o[ha.a];ma=o[ha.b];ka=o[ha.c];if(O.visible&&ma.visible&&ka.visible&&(na.doubleSided||na.flipSided!=(ka.positionScreen.x-
O.positionScreen.x)*(ma.positionScreen.y-O.positionScreen.y)-(ka.positionScreen.y-O.positionScreen.y)*(ma.positionScreen.x-O.positionScreen.x)<0)){Ca=y[x]=y[x]||new THREE.RenderableFace3;x++;t=Ca;t.v1.copy(O);t.v2.copy(ma);t.v3.copy(ka)}else continue}else if(ha instanceof THREE.Face4){O=o[ha.a];ma=o[ha.b];ka=o[ha.c];Ca=o[ha.d];if(O.visible&&ma.visible&&ka.visible&&Ca.visible&&(na.doubleSided||na.flipSided!=((Ca.positionScreen.x-O.positionScreen.x)*(ma.positionScreen.y-O.positionScreen.y)-(Ca.positionScreen.y-
O.positionScreen.y)*(ma.positionScreen.x-O.positionScreen.x)<0||(ma.positionScreen.x-ka.positionScreen.x)*(Ca.positionScreen.y-ka.positionScreen.y)-(ma.positionScreen.y-ka.positionScreen.y)*(Ca.positionScreen.x-ka.positionScreen.x)<0))){n=z[B]=z[B]||new THREE.RenderableFace4;B++;t=n;t.v1.copy(O);t.v2.copy(ma);t.v3.copy(ka);t.v4.copy(Ca)}else continue}t.normalWorld.copy(ha.normal);Wa.multiplyVector3(t.normalWorld);t.centroidWorld.copy(ha.centroid);Ea.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);
E.multiplyVector3(t.centroidScreen);ka=ha.vertexNormals;O=0;for(ma=ka.length;O<ma;O++){Ca=t.vertexNormalsWorld[O];Ca.copy(ka[O]);Wa.multiplyVector3(Ca)}O=0;for(ma=e.length;O<ma;O++)if(n=e[O][ja]){ka=0;for(Ca=n.length;ka<Ca;ka++)t.uvs[O][ka]=n[ka]}t.meshMaterials=Ya;t.faceMaterials=ha.materials;t.overdraw=xa;t.z=t.centroidScreen.z;Aa.push(t)}}else if(na instanceof THREE.Line){fa.multiply(E,Ea);ja=na.geometry.vertices;O=a();O.positionScreen.copy(ja[0].position);fa.multiplyVector4(O.positionScreen);
ga=1;for(ha=ja.length;ga<ha;ga++){O=a();O.positionScreen.copy(ja[ga].position);fa.multiplyVector4(O.positionScreen);ma=o[m-2];b.copy(O.positionScreen);ra.copy(ma.positionScreen);if(d(b,ra)){b.multiplyScalar(1/b.w);ra.multiplyScalar(1/ra.w);Ea=Q[J]=Q[J]||new THREE.RenderableLine;J++;H=Ea;H.v1.positionScreen.copy(b);H.v2.positionScreen.copy(ra);H.z=Math.max(b.z,ra.z);H.materials=na.materials;Aa.push(H)}}}else if(na instanceof THREE.Particle){S.set(na.position.x,na.position.y,na.position.z,1);E.multiplyVector4(S);
S.z/=S.w;if(S.z>0&&S.z<1){Ea=la[ia]=la[ia]||new THREE.RenderableParticle;ia++;K=Ea;K.x=S.x/S.w;K.y=S.y/S.w;K.z=S.z;K.rotation=na.rotation.z;K.scale.x=na.scale.x*Math.abs(K.x-(S.x+N.projectionMatrix.n11)/(S.w+N.projectionMatrix.n14));K.scale.y=na.scale.y*Math.abs(K.y-(S.y+N.projectionMatrix.n22)/(S.w+N.projectionMatrix.n24));K.materials=na.materials;Aa.push(K)}}}}pa&&Aa.sort(c);return Aa}};
THREE.SoundRenderer=function(){this.volume=1;this.domElement=document.createElement("div");this.domElement.id="THREESound";this.cameraPosition=new THREE.Vector3;this.soundPosition=new THREE.Vector3;this.render=function(a,c,d){d&&a.update(undefined,!1,c);d=a.sounds;var g,f=d.length;for(g=0;g<f;g++){a=d[g];this.soundPosition.set(a.matrixWorld.n14,a.matrixWorld.n24,a.matrixWorld.n34);this.soundPosition.subSelf(c.position);if(a.isPlaying&&a.isLoaded){a.isAddedToDOM||a.addToDOM(this.domElement);a.calculateVolumeAndPan(this.soundPosition)}}}};
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
@@ -164,90 +170,98 @@ default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = pr
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)},morphTargetInfluences:{type:"f",
value:0}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",
value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
value:1}},fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,
THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,
THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),
fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,
THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",
THREE.ShaderLib={shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main(void)\n{\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nvoid main( void )\n{\ngl_FragColor = vec4( 0, 0, 0, 0.5 );\n}"},shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos = objectMatrix * vec4( position, 1.0 );\nvec3 norm = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm )), 0.0 );\ngl_Position = projectionMatrix * viewMatrix * ( pos + extruded );\n}",fragmentShader:"void main() {\ngl_FragColor = vec4( 1, 1, 1, 1 );\n}"},
depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},
fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,
THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,
THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",
THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",
THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",
THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.lights_fragment,THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),
vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};
THREE.WebGLRenderer=function(a){function b(g,m,o){var i,k,t,q=g.vertices,r=q.length,D=g.colors,w=D.length,v=g.__vertexArray,M=g.__colorArray,X=g.__sortArray,G=g.__dirtyVertices,R=g.__dirtyColors;if(o.sortParticles){S.multiplySelf(o.matrixWorld);for(i=0;i<r;i++){k=q[i].position;za.copy(k);S.multiplyVector3(za);X[i]=[za.z,i]}X.sort(function(H,Z){return Z[0]-H[0]});for(i=0;i<r;i++){k=q[X[i][1]].position;t=i*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}for(i=0;i<w;i++){t=i*3;color=D[X[i][1]];M[t]=color.r;M[t+1]=
color.g;M[t+2]=color.b}}else{if(G)for(i=0;i<r;i++){k=q[i].position;t=i*3;v[t]=k.x;v[t+1]=k.y;v[t+2]=k.z}if(R)for(i=0;i<w;i++){color=D[i];t=i*3;M[t]=color.r;M[t+1]=color.g;M[t+2]=color.b}}if(G||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,v,m)}if(R||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,M,m)}}function c(g,m){g.fragmentShader=m.fragmentShader;g.vertexShader=m.vertexShader;g.uniforms=Uniforms.clone(m.uniforms)}
function f(g,m,o,i,k){i.program||Q.initMaterial(i,m,o,k);var t=i.program,q=t.uniforms,r=i.uniforms;if(t!=Ba){d.useProgram(t);Ba=t}d.uniformMatrix4fv(q.projectionMatrix,!1,ta);if(o&&(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial||i instanceof THREE.LineBasicMaterial||i instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){r.fogNear.value=o.near;r.fogFar.value=o.far}else if(o instanceof
THREE.FogExp2)r.fogDensity.value=o.density}if(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i.lights){var D,w,v=0,M=0,X=0,G,R,H,Z=La,Ga=Z.directional.colors,T=Z.directional.positions,$=Z.point.colors,B=Z.point.positions,Aa=0,Y=0;o=w=w=0;for(D=m.length;o<D;o++){w=m[o];G=w.color;R=w.position;H=w.intensity;if(w instanceof THREE.AmbientLight){v+=G.r;M+=G.g;X+=G.b}else if(w instanceof THREE.DirectionalLight){w=Aa*3;Ga[w]=G.r*H;Ga[w+1]=G.g*H;Ga[w+2]=G.b*H;T[w]=R.x;T[w+1]=
R.y;T[w+2]=R.z;Aa+=1}else if(w instanceof THREE.PointLight){w=Y*3;$[w]=G.r*H;$[w+1]=G.g*H;$[w+2]=G.b*H;B[w]=R.x;B[w+1]=R.y;B[w+2]=R.z;Y+=1}}for(o=Aa*3;o<Ga.length;o++)Ga[o]=0;for(o=Y*3;o<$.length;o++)$[o]=0;Z.point.length=Y;Z.directional.length=Aa;Z.ambient[0]=v;Z.ambient[1]=M;Z.ambient[2]=X;m=La;r.enableLighting.value=m.directional.length+m.point.length;r.ambientLightColor.value=m.ambient;r.directionalLightColor.value=m.directional.colors;r.directionalLightDirection.value=m.directional.positions;
r.pointLightColor.value=m.point.colors;r.pointLightPosition.value=m.point.positions}if(i instanceof THREE.MeshBasicMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity;r.map.texture=i.map;r.lightMap.texture=i.lightMap;r.envMap.texture=i.envMap;r.reflectivity.value=i.reflectivity;r.refractionRatio.value=i.refractionRatio;r.combine.value=i.combine;r.useRefract.value=
i.envMap&&i.envMap.mapping instanceof THREE.CubeRefractionMapping}if(i instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity}else if(i instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(i.color.r*i.opacity,i.color.g*i.opacity,i.color.b*i.opacity);r.opacity.value=i.opacity;r.size.value=i.size;r.scale.value=oa.height/2;r.map.texture=i.map}else if(i instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(i.ambient.r,
i.ambient.g,i.ambient.b);r.specular.value.setRGB(i.specular.r,i.specular.g,i.specular.b);r.shininess.value=i.shininess}else if(i instanceof THREE.MeshDepthMaterial){r.mNear.value=g.near;r.mFar.value=g.far;r.opacity.value=i.opacity}else if(i instanceof THREE.MeshNormalMaterial)r.opacity.value=i.opacity;for(var Ha in r)if(v=t.uniforms[Ha]){o=r[Ha];D=o.type;m=o.value;if(D=="i")d.uniform1i(v,m);else if(D=="f")d.uniform1f(v,m);else if(D=="fv1")d.uniform1fv(v,m);else if(D=="fv")d.uniform3fv(v,m);else if(D==
"v2")d.uniform2f(v,m.x,m.y);else if(D=="v3")d.uniform3f(v,m.x,m.y,m.z);else if(D=="c")d.uniform3f(v,m.r,m.g,m.b);else if(D=="t"){d.uniform1i(v,m);if(o=o.texture)if(o.image instanceof Array&&o.image.length==6){if(o.image.length==6){if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube);for(D=0;D<6;++D)d.texSubImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image[D])}else{o.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,
o.image.__webGLTextureCube);for(D=0;D<6;++D)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image[D]);o.__wasSetOnce=!0}ja(d.TEXTURE_CUBE_MAP,o,o.image[0]);d.bindTexture(d.TEXTURE_CUBE_MAP,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube)}}else{if(o.needsUpdate){if(o.__wasSetOnce){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,o.image)}else{o.__webGLTexture=
d.createTexture();d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image);o.__wasSetOnce=!0}ja(d.TEXTURE_2D,o,o.image);d.bindTexture(d.TEXTURE_2D,null);o.needsUpdate=!1}d.activeTexture(d.TEXTURE0+m);d.bindTexture(d.TEXTURE_2D,o.__webGLTexture)}}}d.uniformMatrix4fv(q.modelViewMatrix,!1,k._modelViewMatrixArray);d.uniformMatrix3fv(q.normalMatrix,!1,k._normalMatrixArray);(i instanceof THREE.MeshShaderMaterial||i instanceof THREE.MeshPhongMaterial||
i.envMap)&&d.uniform3f(q.cameraPosition,g.position.x,g.position.y,g.position.z);(i instanceof THREE.MeshShaderMaterial||i.envMap||i.skinning)&&d.uniformMatrix4fv(q.objectMatrix,!1,k._objectMatrixArray);(i instanceof THREE.MeshPhongMaterial||i instanceof THREE.MeshLambertMaterial||i instanceof THREE.MeshShaderMaterial||i.skinning)&&d.uniformMatrix4fv(q.viewMatrix,!1,ka);if(i.skinning){d.uniformMatrix4fv(q.cameraInverseMatrix,!1,ka);d.uniformMatrix4fv(q.boneGlobalMatrices,!1,k.boneMatrices)}return t}
function e(g,m,o,i,k,t){if(i.opacity!=0){g=f(g,m,o,i,t).attributes;if(i.morphTargets){m=i.program.attributes;t.morphTargetBase!==-1?d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[t.morphTargetBase]):d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.vertexAttribPointer(m.position,3,d.FLOAT,!1,0,0);if(t.morphTargetForcedOrder.length){o=0;for(var q=t.morphTargetForcedOrder,r=t.morphTargetInfluences;o<i.numSupportedMorphTargets&&o<q.length;){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[q[o]]);
d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=r[q[o]];o++}}else{q=[];var D=-1,w=0;r=t.morphTargetInfluences;var v,M=r.length;o=0;for(t.morphTargetBase!==-1&&(q[t.morphTargetBase]=!0);o<i.numSupportedMorphTargets;){for(v=0;v<M;v++)if(!q[v]&&r[v]>D){w=v;D=r[w]}d.bindBuffer(d.ARRAY_BUFFER,k.__webGLMorphTargetsBuffers[w]);d.vertexAttribPointer(m["morphTarget"+o],3,d.FLOAT,!1,0,0);t.__webGLMorphTargetInfluences[o]=D;q[w]=1;D=-1;o++}}d.uniform1fv(i.program.uniforms.morphTargetInfluences,
t.__webGLMorphTargetInfluences)}else{d.bindBuffer(d.ARRAY_BUFFER,k.__webGLVertexBuffer);d.vertexAttribPointer(g.position,3,d.FLOAT,!1,0,0)}if(g.color>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLColorBuffer);d.vertexAttribPointer(g.color,3,d.FLOAT,!1,0,0)}if(g.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLNormalBuffer);d.vertexAttribPointer(g.normal,3,d.FLOAT,!1,0,0)}if(g.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLTangentBuffer);d.vertexAttribPointer(g.tangent,4,d.FLOAT,!1,0,0)}if(g.uv>=0)if(k.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,
k.__webGLUVBuffer);d.vertexAttribPointer(g.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv)}else d.disableVertexAttribArray(g.uv);if(g.uv2>=0)if(k.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLUV2Buffer);d.vertexAttribPointer(g.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(g.uv2)}else d.disableVertexAttribArray(g.uv2);if(i.skinning&&g.skinVertexA>=0&&g.skinVertexB>=0&&g.skinIndex>=0&&g.skinWeight>=0){d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexABuffer);d.vertexAttribPointer(g.skinVertexA,
4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinVertexBBuffer);d.vertexAttribPointer(g.skinVertexB,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinIndicesBuffer);d.vertexAttribPointer(g.skinIndex,4,d.FLOAT,!1,0,0);d.bindBuffer(d.ARRAY_BUFFER,k.__webGLSkinWeightsBuffer);d.vertexAttribPointer(g.skinWeight,4,d.FLOAT,!1,0,0)}if(t instanceof THREE.Mesh)if(i.wireframe){d.lineWidth(i.wireframeLinewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);d.drawElements(d.LINES,
k.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,k.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(t instanceof THREE.Line){t=t.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(i.linewidth);d.drawArrays(t,0,k.__webGLLineCount)}else if(t instanceof THREE.ParticleSystem)d.drawArrays(d.POINTS,0,k.__webGLParticleCount);else t instanceof THREE.Ribbon&&d.drawArrays(d.TRIANGLE_STRIP,0,k.__webGLVertexCount)}}function h(g,m){if(!g.__webGLVertexBuffer)g.__webGLVertexBuffer=
d.createBuffer();if(!g.__webGLNormalBuffer)g.__webGLNormalBuffer=d.createBuffer();if(g.hasPos){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,g.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.position);d.vertexAttribPointer(m.attributes.position,3,d.FLOAT,!1,0,0)}if(g.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,g.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,g.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(m.attributes.normal);d.vertexAttribPointer(m.attributes.normal,
3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,g.count);g.count=0}function j(g){if(N!=g.doubleSided){g.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);N=g.doubleSided}if(pa!=g.flipSided){g.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);pa=g.flipSided}}function p(g){if(Da!=g){g?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST);Da=g}}function n(g){W[0].set(g.n41-g.n11,g.n42-g.n12,g.n43-g.n13,g.n44-g.n14);W[1].set(g.n41+g.n11,g.n42+g.n12,g.n43+g.n13,g.n44+g.n14);W[2].set(g.n41+g.n21,g.n42+g.n22,
g.n43+g.n23,g.n44+g.n24);W[3].set(g.n41-g.n21,g.n42-g.n22,g.n43-g.n23,g.n44-g.n24);W[4].set(g.n41-g.n31,g.n42-g.n32,g.n43-g.n33,g.n44-g.n34);W[5].set(g.n41+g.n31,g.n42+g.n32,g.n43+g.n33,g.n44+g.n34);var m;for(g=0;g<6;g++){m=W[g];m.divideScalar(Math.sqrt(m.x*m.x+m.y*m.y+m.z*m.z))}}function s(g){for(var m=g.matrixWorld,o=-g.geometry.boundingSphere.radius*Math.max(g.scale.x,Math.max(g.scale.y,g.scale.z)),i=0;i<6;i++){g=W[i].x*m.n14+W[i].y*m.n24+W[i].z*m.n34+W[i].w;if(g<=o)return!1}return!0}function x(g,
m){g.list[g.count]=m;g.count+=1}function z(g){var m,o,i=g.object,k=g.opaque,t=g.transparent;t.count=0;g=k.count=0;for(m=i.materials.length;g<m;g++){o=i.materials[g];o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?x(t,o):x(k,o)}}function C(g){var m,o,i,k,t=g.object,q=g.buffer,r=g.opaque,D=g.transparent;D.count=0;g=r.count=0;for(i=t.materials.length;g<i;g++){m=t.materials[g];if(m instanceof THREE.MeshFaceMaterial){m=0;for(o=q.materials.length;m<o;m++)(k=q.materials[m])&&(k.opacity&&k.opacity<
1||k.blending!=THREE.NormalBlending?x(D,k):x(r,k))}else{k=m;k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?x(D,k):x(r,k)}}}function y(g,m){return m.z-g.z}function J(g,m){g._modelViewMatrix.multiplyToArray(m.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(g._modelViewMatrix).transposeIntoArray(g._normalMatrixArray)}function K(g){function m(X){var G=[];o=0;for(i=X.length;o<i;o++)X[o]==undefined?G.push("undefined"):G.push(X[o].id);return G.join("_")}var o,
i,k,t,q,r,D,w,v={},M=g.morphTargets!==undefined?g.morphTargets.length:0;g.geometryGroups={};k=0;for(t=g.faces.length;k<t;k++){q=g.faces[k];r=q.materials;D=m(r);v[D]==undefined&&(v[D]={hash:D,counter:0});w=v[D].hash+"_"+v[D].counter;g.geometryGroups[w]==undefined&&(g.geometryGroups[w]={faces:[],materials:r,vertices:0,numMorphTargets:M});q=q instanceof THREE.Face3?3:4;if(g.geometryGroups[w].vertices+q>65535){v[D].counter+=1;w=v[D].hash+"_"+v[D].counter;g.geometryGroups[w]==undefined&&(g.geometryGroups[w]=
{faces:[],materials:r,vertices:0,numMorphTargets:M})}g.geometryGroups[w].faces.push(k);g.geometryGroups[w].vertices+=q}}function P(g,m,o){g.push({buffer:m,object:o,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(g){if(g!=ya){switch(g){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);
break;case THREE.ReverseSubtractiveBlending:d.blendEquation(d.FUNC_REVERSE_SUBTRACT);d.blendFunc(d.ONE,d.ONE);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}ya=g}}function ja(g,m,o){if((o.width&o.width-1)==0&&(o.height&o.height-1)==0){d.texParameteri(g,d.TEXTURE_WRAP_S,A(m.wrapS));d.texParameteri(g,d.TEXTURE_WRAP_T,A(m.wrapT));d.texParameteri(g,d.TEXTURE_MAG_FILTER,A(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,A(m.minFilter));d.generateMipmap(g)}else{d.texParameteri(g,
d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(g,d.TEXTURE_MAG_FILTER,U(m.magFilter));d.texParameteri(g,d.TEXTURE_MIN_FILTER,U(m.minFilter))}}function ma(g){if(g&&!g.__webGLFramebuffer){g.__webGLFramebuffer=d.createFramebuffer();g.__webGLRenderbuffer=d.createRenderbuffer();g.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,g.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,g.width,g.height);d.bindTexture(d.TEXTURE_2D,
g.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,A(g.wrapS));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,A(g.wrapT));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,A(g.magFilter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,A(g.minFilter));d.texImage2D(d.TEXTURE_2D,0,A(g.format),g.width,g.height,0,A(g.format),A(g.type),null);d.bindFramebuffer(d.FRAMEBUFFER,g.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,g.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,
d.DEPTH_ATTACHMENT,d.RENDERBUFFER,g.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var m,o;if(g){m=g.__webGLFramebuffer;o=g.width;g=g.height}else{m=null;o=ha;g=ia}if(m!=Ca){d.bindFramebuffer(d.FRAMEBUFFER,m);d.viewport(qa,V,o,g);Ca=m}}function sa(g,m){var o;if(g=="fragment")o=d.createShader(d.FRAGMENT_SHADER);else g=="vertex"&&(o=d.createShader(d.VERTEX_SHADER));d.shaderSource(o,m);d.compileShader(o);if(!d.getShaderParameter(o,
d.COMPILE_STATUS)){console.error(d.getShaderInfoLog(o));console.error(m);return null}return o}function U(g){switch(g){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return d.NEAREST;case THREE.LinearFilter:case THREE.LinearMipMapNearestFilter:case THREE.LinearMipMapLinearFilter:return d.LINEAR}}function A(g){switch(g){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;
case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;
case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var oa=document.createElement("canvas"),d,Ba=null,Ca=null,Q=this,N=null,pa=null,ya=null,Da=null,qa=0,V=0,ha=0,ia=0,W=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],S=new THREE.Matrix4,ta=new Float32Array(16),ka=new Float32Array(16),za=new THREE.Vector4,La={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},la=!0,Na=new THREE.Color(0),Wa=0;if(a){if(a.antialias!==undefined)la=a.antialias;a.clearColor!==undefined&&Na.setHex(a.clearColor);if(a.clearAlpha!==undefined)Wa=a.clearAlpha}this.maxMorphTargets=8;this.domElement=oa;this.autoClear=!0;this.sortObjects=
!0;(function(g,m,o){try{if(!(d=oa.getContext("experimental-webgl",{antialias:g})))throw"Error creating WebGL context.";}catch(i){console.error(i)}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.clearColor(m.r,m.g,m.b,o);_cullEnabled=!0})(la,Na,Wa);this.context=d;this.setSize=function(g,m){oa.width=g;oa.height=m;this.setViewport(0,0,oa.width,oa.height)};
this.setViewport=function(g,m,o,i){qa=g;V=m;ha=o;ia=i;d.viewport(qa,V,ha,ia)};this.setScissor=function(g,m,o,i){d.scissor(g,m,o,i)};this.enableScissorTest=function(g){g?d.enable(d.SCISSOR_TEST):d.disable(d.SCISSOR_TEST)};this.enableDepthBufferWrite=function(g){d.depthMask(g)};this.setClearColorHex=function(g,m){var o=new THREE.Color(g);d.clearColor(o.r,o.g,o.b,m)};this.setClearColor=function(g,m){d.clearColor(g.r,g.g,g.b,m)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};this.initMaterial=
function(g,m,o,i){var k,t,q;if(g instanceof THREE.MeshDepthMaterial)c(g,THREE.ShaderLib.depth);else if(g instanceof THREE.MeshNormalMaterial)c(g,THREE.ShaderLib.normal);else if(g instanceof THREE.MeshBasicMaterial)c(g,THREE.ShaderLib.basic);else if(g instanceof THREE.MeshLambertMaterial)c(g,THREE.ShaderLib.lambert);else if(g instanceof THREE.MeshPhongMaterial)c(g,THREE.ShaderLib.phong);else if(g instanceof THREE.LineBasicMaterial)c(g,THREE.ShaderLib.basic);else g instanceof THREE.ParticleBasicMaterial&&
c(g,THREE.ShaderLib.particle_basic);var r,D,w,v;q=w=v=0;for(r=m.length;q<r;q++){D=m[q];D instanceof THREE.DirectionalLight&&w++;D instanceof THREE.PointLight&&v++}if(v+w<=4)m=w;else{m=Math.ceil(4*w/(v+w));v=4-m}q={directional:m,point:v};r=50;if(i!==undefined&&i instanceof THREE.SkinnedMesh)r=i.bones.length;v=g.fragmentShader;m=g.vertexShader;r={fog:o,map:g.map,envMap:g.envMap,lightMap:g.lightMap,vertexColors:g.vertexColors,sizeAttenuation:g.sizeAttenuation,skinning:g.skinning,morphTargets:g.morphTargets,
maxDirLights:q.directional,maxPointLights:q.point,maxBones:r};o=d.createProgram();q=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,r.fog?"#define USE_FOG":"",r.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
r=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+r.maxDirLights,"#define MAX_POINT_LIGHTS "+r.maxPointLights,"#define MAX_BONES "+r.maxBones,r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.lightMap?"#define USE_LIGHTMAP":"",r.vertexColors?"#define USE_COLOR":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
d.attachShader(o,sa("fragment",q+v));d.attachShader(o,sa("vertex",r+m));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};g.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(k in g.uniforms)o.push(k);
k=g.program;v=0;for(m=o.length;v<m;v++){q=o[v];k.uniforms[q]=d.getUniformLocation(k,q)}o=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(k=0;k<this.maxMorphTargets;k++)o.push("morphTarget"+k);for(t in g.attributes)o.push(t);t=g.program;k=o;o=0;for(v=k.length;o<v;o++){m=k[o];t.attributes[m]=d.getAttribLocation(t,m)}t=g.program.attributes;d.enableVertexAttribArray(t.position);t.color>=0&&d.enableVertexAttribArray(t.color);t.normal>=0&&d.enableVertexAttribArray(t.normal);
t.tangent>=0&&d.enableVertexAttribArray(t.tangent);if(g.skinning&&t.skinVertexA>=0&&t.skinVertexB>=0&&t.skinIndex>=0&&t.skinWeight>=0){d.enableVertexAttribArray(t.skinVertexA);d.enableVertexAttribArray(t.skinVertexB);d.enableVertexAttribArray(t.skinIndex);d.enableVertexAttribArray(t.skinWeight)}if(g.morphTargets){g.numSupportedMorphTargets=0;if(t.morphTarget0>=0){d.enableVertexAttribArray(t.morphTarget0);g.numSupportedMorphTargets++}if(t.morphTarget1>=0){d.enableVertexAttribArray(t.morphTarget1);
g.numSupportedMorphTargets++}if(t.morphTarget2>=0){d.enableVertexAttribArray(t.morphTarget2);g.numSupportedMorphTargets++}if(t.morphTarget3>=0){d.enableVertexAttribArray(t.morphTarget3);g.numSupportedMorphTargets++}if(t.morphTarget4>=0){d.enableVertexAttribArray(t.morphTarget4);g.numSupportedMorphTargets++}if(t.morphTarget5>=0){d.enableVertexAttribArray(t.morphTarget5);g.numSupportedMorphTargets++}if(t.morphTarget6>=0){d.enableVertexAttribArray(t.morphTarget6);g.numSupportedMorphTargets++}if(t.morphTarget7>=
0){d.enableVertexAttribArray(t.morphTarget7);g.numSupportedMorphTargets++}i.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(k=0;k<this.maxMorphTargets;k++)i.__webGLMorphTargetInfluences[k]=0}};this.render=function(g,m,o,i){var k,t,q,r,D,w,v,M,X=g.lights,G=g.fog;m.matrixAutoUpdate&&m.updateMatrix();g.update(undefined,!1,m);m.matrixWorldInverse.flattenToArray(ka);m.projectionMatrix.flattenToArray(ta);S.multiply(m.projectionMatrix,m.matrixWorldInverse);n(S);this.initWebGLObjects(g);
ma(o);(this.autoClear||i)&&this.clear();D=g.__webglObjects.length;for(i=0;i<D;i++){k=g.__webglObjects[i];v=k.object;if(v.visible)if(!(v instanceof THREE.Mesh)||s(v)){v.matrixWorld.flattenToArray(v._objectMatrixArray);J(v,m);C(k);k.render=!0;if(this.sortObjects){za.copy(v.position);S.multiplyVector3(za);k.z=za.z}}else k.render=!1;else k.render=!1}this.sortObjects&&g.__webglObjects.sort(y);w=g.__webglObjectsImmediate.length;for(i=0;i<w;i++){k=g.__webglObjectsImmediate[i];v=k.object;if(v.visible){v.matrixAutoUpdate&&
v.matrixWorld.flattenToArray(v._objectMatrixArray);J(v,m);z(k)}}L(THREE.NormalBlending);for(i=0;i<D;i++){k=g.__webglObjects[i];if(k.render){v=k.object;M=k.buffer;q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);e(m,X,G,r,M,v)}}}for(i=0;i<w;i++){k=g.__webglObjectsImmediate[i];v=k.object;if(v.visible){q=k.opaque;j(v);for(k=0;k<q.count;k++){r=q.list[k];p(r.depthTest);t=f(m,X,G,r,v);v.render(function(R){h(R,t)})}}}for(i=0;i<D;i++){k=g.__webglObjects[i];if(k.render){v=k.object;M=k.buffer;
q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];L(r.blending);p(r.depthTest);e(m,X,G,r,M,v)}}}for(i=0;i<w;i++){k=g.__webglObjectsImmediate[i];v=k.object;if(v.visible){q=k.transparent;j(v);for(k=0;k<q.count;k++){r=q.list[k];L(r.blending);p(r.depthTest);t=f(m,X,G,r,v);v.render(function(R){h(R,t)})}}}if(o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=
function(g){if(!g.__webglObjects){g.__webglObjects=[];g.__webglObjectsImmediate=[]}for(;g.__objectsAdded.length;){var m=g.__objectsAdded[0],o=g,i=void 0,k=void 0,t=void 0;if(m._modelViewMatrix==undefined){m._modelViewMatrix=new THREE.Matrix4;m._normalMatrixArray=new Float32Array(9);m._modelViewMatrixArray=new Float32Array(16);m._objectMatrixArray=new Float32Array(16);m.matrixWorld.flattenToArray(m._objectMatrixArray)}if(m instanceof THREE.Mesh){k=m.geometry;k.geometryGroups==undefined&&K(k);for(i in k.geometryGroups){t=
k.geometryGroups[i];if(!t.__webGLVertexBuffer){var q=t;q.__webGLVertexBuffer=d.createBuffer();q.__webGLNormalBuffer=d.createBuffer();q.__webGLTangentBuffer=d.createBuffer();q.__webGLColorBuffer=d.createBuffer();q.__webGLUVBuffer=d.createBuffer();q.__webGLUV2Buffer=d.createBuffer();q.__webGLSkinVertexABuffer=d.createBuffer();q.__webGLSkinVertexBBuffer=d.createBuffer();q.__webGLSkinIndicesBuffer=d.createBuffer();q.__webGLSkinWeightsBuffer=d.createBuffer();q.__webGLFaceBuffer=d.createBuffer();q.__webGLLineBuffer=
d.createBuffer();if(q.numMorphTargets){var r=void 0,D=void 0;q.__webGLMorphTargetsBuffers=[];r=0;for(D=q.numMorphTargets;r<D;r++)q.__webGLMorphTargetsBuffers.push(d.createBuffer())}q=t;var w=m,v=void 0,M=void 0,X=D=r=0;v=void 0;M=void 0;var G=void 0;M=void 0;var R=w.geometry;G=R.faces;var H=q.faces;v=0;for(M=H.length;v<M;v++){fi=H[v];face=G[fi];if(face instanceof THREE.Face3){r+=3;D+=1;X+=3}else if(face instanceof THREE.Face4){r+=4;D+=2;X+=4}}v=q;M=w;G=void 0;H=void 0;var Z=void 0,Ga=void 0;Z=void 0;
var T=[];G=0;for(H=M.materials.length;G<H;G++){Z=M.materials[G];if(Z instanceof THREE.MeshFaceMaterial){Z=0;for(l=v.materials.length;Z<l;Z++)(Ga=v.materials[Z])&&T.push(Ga)}else(Ga=Z)&&T.push(Ga)}M=T;a:{v=void 0;G=void 0;H=M.length;for(v=0;v<H;v++){G=M[v];if(G.map||G.lightMap||G instanceof THREE.MeshShaderMaterial){v=!0;break a}}v=!1}a:{G=void 0;H=void 0;T=M.length;for(G=0;G<T;G++){H=M[G];if(!(H instanceof THREE.MeshBasicMaterial&&!H.envMap||H instanceof THREE.MeshDepthMaterial)){G=H&&H.shading!=
undefined&&H.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}G=!1}a:{H=void 0;T=void 0;Z=M.length;for(H=0;H<Z;H++){T=M[H];if(T.vertexColors){M=T.vertexColors;break a}}M=!1}q.__vertexArray=new Float32Array(r*3);if(G)q.__normalArray=new Float32Array(r*3);if(R.hasTangents)q.__tangentArray=new Float32Array(r*4);if(M)q.__colorArray=new Float32Array(r*3);if(v){if(R.faceUvs.length>0||R.faceVertexUvs.length>0)q.__uvArray=new Float32Array(r*2);if(R.faceUvs.length>1||R.faceVertexUvs.length>
1)q.__uv2Array=new Float32Array(r*2)}if(w.geometry.skinWeights.length&&w.geometry.skinIndices.length){q.__skinVertexAArray=new Float32Array(r*4);q.__skinVertexBArray=new Float32Array(r*4);q.__skinIndexArray=new Float32Array(r*4);q.__skinWeightArray=new Float32Array(r*4)}q.__faceArray=new Uint16Array(D*3);q.__lineArray=new Uint16Array(X*2);if(q.numMorphTargets){w=void 0;R=void 0;q.__morphTargetsArrays=[];w=0;for(R=q.numMorphTargets;w<R;w++)q.__morphTargetsArrays.push(new Float32Array(r*3))}q.__needsSmoothNormals=
G==THREE.SmoothShading;q.__uvType=v;q.__vertexColorType=M;q.__normalType=G;q.__webGLFaceCount=D*3;q.__webGLLineCount=X*2;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}P(o.__webglObjects,t,m)}}else if(m instanceof THREE.Ribbon){k=m.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=d.createBuffer();i.__webGLColorBuffer=d.createBuffer();i=k;t=i.vertices.length;i.__vertexArray=new Float32Array(t*
3);i.__colorArray=new Float32Array(t*3);i.__webGLVertexCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}P(o.__webglObjects,k,m)}else if(m instanceof THREE.Line){k=m.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=d.createBuffer();i.__webGLColorBuffer=d.createBuffer();i=k;t=i.vertices.length;i.__vertexArray=new Float32Array(t*3);i.__colorArray=new Float32Array(t*3);i.__webGLLineCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}P(o.__webglObjects,k,m)}else if(m instanceof THREE.ParticleSystem){k=
m.geometry;if(!k.__webGLVertexBuffer){i=k;i.__webGLVertexBuffer=d.createBuffer();i.__webGLColorBuffer=d.createBuffer();i=k;t=i.vertices.length;i.__vertexArray=new Float32Array(t*3);i.__colorArray=new Float32Array(t*3);i.__sortArray=[];i.__webGLParticleCount=t;k.__dirtyVertices=!0;k.__dirtyColors=!0}P(o.__webglObjects,k,m)}else THREE.MarchingCubes!==undefined&&m instanceof THREE.MarchingCubes&&o.__webglObjectsImmediate.push({object:m,opaque:{list:[],count:0},transparent:{list:[],count:0}});g.__objectsAdded.splice(0,
1)}for(;g.__objectsRemoved.length;){m=g.__objectsRemoved[0];o=g;k=void 0;i=void 0;for(k=o.__webglObjects.length-1;k>=0;k--){i=o.__webglObjects[k].object;m==i&&o.__webglObjects.splice(k,1)}g.__objectsRemoved.splice(0,1)}m=0;for(o=g.__webglObjects.length;m<o;m++){i=g.__webglObjects[m].object;t=void 0;k=void 0;q=void 0;if(i instanceof THREE.Mesh){k=i.geometry;for(t in k.geometryGroups){q=k.geometryGroups[t];if(k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||
k.__dirtyColors||k.__dirtyTangents){r=d.DYNAMIC_DRAW;D=void 0;X=void 0;var $=void 0,B=void 0;$=void 0;var Aa=void 0,Y=void 0,Ha=void 0,O=void 0;w=void 0;R=void 0;v=void 0;M=void 0;G=void 0;var E=void 0,F=void 0,I=void 0,na=void 0;Y=void 0;Ha=void 0;B=void 0;O=void 0;B=void 0;E=void 0;F=void 0;Y=void 0;E=void 0;F=void 0;I=void 0;na=void 0;E=void 0;F=void 0;I=void 0;na=void 0;E=void 0;F=void 0;I=void 0;na=void 0;E=void 0;F=void 0;I=void 0;B=void 0;O=void 0;Aa=void 0;$=void 0;$=void 0;var Ea=void 0,
Xa=void 0,ua=void 0,Oa=Ga=Z=T=H=0,Ia=0,aa=0,Ja=0,ra=0,u=0,va=0,wa=q.__vertexArray,Za=q.__uvArray,$a=q.__uv2Array,Ma=q.__normalArray,ca=q.__tangentArray,xa=q.__colorArray,da=q.__skinVertexAArray,ea=q.__skinVertexBArray,fa=q.__skinIndexArray,ga=q.__skinWeightArray,ab=q.__morphTargetsArrays,Pa=q.__faceArray,Ka=q.__lineArray,hb=q.__needsSmoothNormals;R=q.__vertexColorType;w=q.__uvType;v=q.__normalType;var Fa=i.geometry,bb=Fa.__dirtyVertices,cb=Fa.__dirtyElements,Ya=Fa.__dirtyUvs,db=Fa.__dirtyNormals,
eb=Fa.__dirtyTangents,fb=Fa.__dirtyColors,gb=Fa.__dirtyMorphTargets,Sa=Fa.vertices,ib=q.faces,lb=Fa.faces,jb=Fa.faceVertexUvs[0],kb=Fa.faceVertexUvs[1],Ta=Fa.skinVerticesA,Ua=Fa.skinVerticesB,Va=Fa.skinIndices,Ra=Fa.skinWeights,Qa=Fa.morphTargets;D=0;for(X=ib.length;D<X;D++){$=ib[D];B=lb[$];jb&&(M=jb[$]);kb&&(G=kb[$]);$=B.vertexNormals;Aa=B.normal;Y=B.vertexColors;Ha=B.color;O=B.vertexTangents;if(B instanceof THREE.Face3){if(bb){E=Sa[B.a].position;F=Sa[B.b].position;I=Sa[B.c].position;wa[T]=E.x;wa[T+
1]=E.y;wa[T+2]=E.z;wa[T+3]=F.x;wa[T+4]=F.y;wa[T+5]=F.z;wa[T+6]=I.x;wa[T+7]=I.y;wa[T+8]=I.z;T+=9}if(gb){Ea=0;for(Xa=Qa.length;Ea<Xa;Ea++){E=Qa[Ea].vertices[B.a].position;F=Qa[Ea].vertices[B.b].position;I=Qa[Ea].vertices[B.c].position;ua=ab[Ea];ua[va+0]=E.x;ua[va+1]=E.y;ua[va+2]=E.z;ua[va+3]=F.x;ua[va+4]=F.y;ua[va+5]=F.z;ua[va+6]=I.x;ua[va+7]=I.y;ua[va+8]=I.z}va+=9}if(Ra.length){E=Ra[B.a];F=Ra[B.b];I=Ra[B.c];ga[u]=E.x;ga[u+1]=E.y;ga[u+2]=E.z;ga[u+3]=E.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;
ga[u+8]=I.x;ga[u+9]=I.y;ga[u+10]=I.z;ga[u+11]=I.w;E=Va[B.a];F=Va[B.b];I=Va[B.c];fa[u]=E.x;fa[u+1]=E.y;fa[u+2]=E.z;fa[u+3]=E.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=I.x;fa[u+9]=I.y;fa[u+10]=I.z;fa[u+11]=I.w;E=Ta[B.a];F=Ta[B.b];I=Ta[B.c];da[u]=E.x;da[u+1]=E.y;da[u+2]=E.z;da[u+3]=1;da[u+4]=F.x;da[u+5]=F.y;da[u+6]=F.z;da[u+7]=1;da[u+8]=I.x;da[u+9]=I.y;da[u+10]=I.z;da[u+11]=1;E=Ua[B.a];F=Ua[B.b];I=Ua[B.c];ea[u]=E.x;ea[u+1]=E.y;ea[u+2]=E.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;
ea[u+7]=1;ea[u+8]=I.x;ea[u+9]=I.y;ea[u+10]=I.z;ea[u+11]=1;u+=12}if(fb&&R){if(Y.length==3&&R==THREE.VertexColors){B=Y[0];E=Y[1];F=Y[2]}else F=E=B=Ha;xa[ra]=B.r;xa[ra+1]=B.g;xa[ra+2]=B.b;xa[ra+3]=E.r;xa[ra+4]=E.g;xa[ra+5]=E.b;xa[ra+6]=F.r;xa[ra+7]=F.g;xa[ra+8]=F.b;ra+=9}if(eb&&Fa.hasTangents){Y=O[0];Ha=O[1];B=O[2];ca[aa]=Y.x;ca[aa+1]=Y.y;ca[aa+2]=Y.z;ca[aa+3]=Y.w;ca[aa+4]=Ha.x;ca[aa+5]=Ha.y;ca[aa+6]=Ha.z;ca[aa+7]=Ha.w;ca[aa+8]=B.x;ca[aa+9]=B.y;ca[aa+10]=B.z;ca[aa+11]=B.w;aa+=12}if(db&&v)if($.length==
3&&hb)for(O=0;O<3;O++){Aa=$[O];Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}else for(O=0;O<3;O++){Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}if(Ya&&M!==undefined&&w)for(O=0;O<3;O++){$=M[O];Za[Z]=$.u;Za[Z+1]=$.v;Z+=2}if(Ya&&G!==undefined&&w)for(O=0;O<3;O++){$=G[O];$a[Ga]=$.u;$a[Ga+1]=$.v;Ga+=2}if(cb){Pa[Oa]=H;Pa[Oa+1]=H+1;Pa[Oa+2]=H+2;Oa+=3;Ka[Ja]=H;Ka[Ja+1]=H+1;Ka[Ja+2]=H;Ka[Ja+3]=H+2;Ka[Ja+4]=H+1;Ka[Ja+5]=H+2;Ja+=6;H+=3}}else if(B instanceof THREE.Face4){if(bb){E=Sa[B.a].position;F=Sa[B.b].position;
I=Sa[B.c].position;na=Sa[B.d].position;wa[T]=E.x;wa[T+1]=E.y;wa[T+2]=E.z;wa[T+3]=F.x;wa[T+4]=F.y;wa[T+5]=F.z;wa[T+6]=I.x;wa[T+7]=I.y;wa[T+8]=I.z;wa[T+9]=na.x;wa[T+10]=na.y;wa[T+11]=na.z;T+=12}if(gb){Ea=0;for(Xa=Qa.length;Ea<Xa;Ea++){E=Qa[Ea].vertices[B.a].position;F=Qa[Ea].vertices[B.b].position;I=Qa[Ea].vertices[B.c].position;na=Qa[Ea].vertices[B.d].position;ua=ab[Ea];ua[va+0]=E.x;ua[va+1]=E.y;ua[va+2]=E.z;ua[va+3]=F.x;ua[va+4]=F.y;ua[va+5]=F.z;ua[va+6]=I.x;ua[va+7]=I.y;ua[va+8]=I.z;ua[va+9]=na.x;
ua[va+10]=na.y;ua[va+11]=na.z}va+=12}if(Ra.length){E=Ra[B.a];F=Ra[B.b];I=Ra[B.c];na=Ra[B.d];ga[u]=E.x;ga[u+1]=E.y;ga[u+2]=E.z;ga[u+3]=E.w;ga[u+4]=F.x;ga[u+5]=F.y;ga[u+6]=F.z;ga[u+7]=F.w;ga[u+8]=I.x;ga[u+9]=I.y;ga[u+10]=I.z;ga[u+11]=I.w;ga[u+12]=na.x;ga[u+13]=na.y;ga[u+14]=na.z;ga[u+15]=na.w;E=Va[B.a];F=Va[B.b];I=Va[B.c];na=Va[B.d];fa[u]=E.x;fa[u+1]=E.y;fa[u+2]=E.z;fa[u+3]=E.w;fa[u+4]=F.x;fa[u+5]=F.y;fa[u+6]=F.z;fa[u+7]=F.w;fa[u+8]=I.x;fa[u+9]=I.y;fa[u+10]=I.z;fa[u+11]=I.w;fa[u+12]=na.x;fa[u+13]=na.y;
fa[u+14]=na.z;fa[u+15]=na.w;E=Ta[B.a];F=Ta[B.b];I=Ta[B.c];na=Ta[B.d];da[u]=E.x;da[u+1]=E.y;da[u+2]=E.z;da[u+3]=1;da[u+4]=F.x;da[u+5]=F.y;da[u+6]=F.z;da[u+7]=1;da[u+8]=I.x;da[u+9]=I.y;da[u+10]=I.z;da[u+11]=1;da[u+12]=na.x;da[u+13]=na.y;da[u+14]=na.z;da[u+15]=1;E=Ua[B.a];F=Ua[B.b];I=Ua[B.c];B=Ua[B.d];ea[u]=E.x;ea[u+1]=E.y;ea[u+2]=E.z;ea[u+3]=1;ea[u+4]=F.x;ea[u+5]=F.y;ea[u+6]=F.z;ea[u+7]=1;ea[u+8]=I.x;ea[u+9]=I.y;ea[u+10]=I.z;ea[u+11]=1;ea[u+12]=B.x;ea[u+13]=B.y;ea[u+14]=B.z;ea[u+15]=1;u+=16}if(fb&&
R){if(Y.length==4&&R==THREE.VertexColors){B=Y[0];E=Y[1];F=Y[2];Y=Y[3]}else Y=F=E=B=Ha;xa[ra]=B.r;xa[ra+1]=B.g;xa[ra+2]=B.b;xa[ra+3]=E.r;xa[ra+4]=E.g;xa[ra+5]=E.b;xa[ra+6]=F.r;xa[ra+7]=F.g;xa[ra+8]=F.b;xa[ra+9]=Y.r;xa[ra+10]=Y.g;xa[ra+11]=Y.b;ra+=12}if(eb&&Fa.hasTangents){Y=O[0];Ha=O[1];B=O[2];O=O[3];ca[aa]=Y.x;ca[aa+1]=Y.y;ca[aa+2]=Y.z;ca[aa+3]=Y.w;ca[aa+4]=Ha.x;ca[aa+5]=Ha.y;ca[aa+6]=Ha.z;ca[aa+7]=Ha.w;ca[aa+8]=B.x;ca[aa+9]=B.y;ca[aa+10]=B.z;ca[aa+11]=B.w;ca[aa+12]=O.x;ca[aa+13]=O.y;ca[aa+14]=O.z;
ca[aa+15]=O.w;aa+=16}if(db&&v)if($.length==4&&hb)for(O=0;O<4;O++){Aa=$[O];Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}else for(O=0;O<4;O++){Ma[Ia]=Aa.x;Ma[Ia+1]=Aa.y;Ma[Ia+2]=Aa.z;Ia+=3}if(Ya&&M!==undefined&&w)for(O=0;O<4;O++){$=M[O];Za[Z]=$.u;Za[Z+1]=$.v;Z+=2}if(Ya&&G!==undefined&&w)for(O=0;O<4;O++){$=G[O];$a[Ga]=$.u;$a[Ga+1]=$.v;Ga+=2}if(cb){Pa[Oa]=H;Pa[Oa+1]=H+1;Pa[Oa+2]=H+3;Pa[Oa+3]=H+1;Pa[Oa+4]=H+2;Pa[Oa+5]=H+3;Oa+=6;Ka[Ja]=H;Ka[Ja+1]=H+1;Ka[Ja+2]=H;Ka[Ja+3]=H+3;Ka[Ja+4]=H+1;Ka[Ja+5]=H+2;Ka[Ja+
6]=H+2;Ka[Ja+7]=H+3;Ja+=8;H+=4}}}if(bb){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,wa,r)}if(gb){Ea=0;for(Xa=Qa.length;Ea<Xa;Ea++){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[Ea]);d.bufferData(d.ARRAY_BUFFER,ab[Ea],r)}}if(fb&&ra>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,xa,r)}if(db){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ma,r)}if(eb&&Fa.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,
q.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,ca,r)}if(Ya&&Z>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Za,r)}if(Ya&&Ga>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,$a,r)}if(cb){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Pa,r);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Ka,r)}if(u>0){d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);
d.bufferData(d.ARRAY_BUFFER,da,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ea,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,fa,r);d.bindBuffer(d.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,ga,r)}}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1}else if(i instanceof THREE.Ribbon){k=i.geometry;if(k.__dirtyVertices||
k.__dirtyColors){i=k;t=d.DYNAMIC_DRAW;w=void 0;w=void 0;R=void 0;q=void 0;v=i.vertices;r=i.colors;M=v.length;D=r.length;G=i.__vertexArray;X=i.__colorArray;H=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<M;w++){R=v[w].position;q=w*3;G[q]=R.x;G[q+1]=R.y;G[q+2]=R.z}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,G,t)}if(H){for(w=0;w<D;w++){color=r[w];q=w*3;X[q]=color.r;X[q+1]=color.g;X[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,
X,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(i instanceof THREE.Line){k=i.geometry;if(k.__dirtyVertices||k.__dirtyColors){i=k;t=d.DYNAMIC_DRAW;w=void 0;w=void 0;R=void 0;q=void 0;v=i.vertices;r=i.colors;M=v.length;D=r.length;G=i.__vertexArray;X=i.__colorArray;H=i.__dirtyColors;if(i.__dirtyVertices){for(w=0;w<M;w++){R=v[w].position;q=w*3;G[q]=R.x;G[q+1]=R.y;G[q+2]=R.z}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,G,t)}if(H){for(w=0;w<D;w++){color=r[w];q=w*
3;X[q]=color.r;X[q+1]=color.g;X[q+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,i.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,X,t)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(i instanceof THREE.ParticleSystem){k=i.geometry;(k.__dirtyVertices||k.__dirtyColors||i.sortParticles)&&b(k,d.DYNAMIC_DRAW,i);k.__dirtyVertices=!1;k.__dirtyColors=!1}}};this.setFaceCulling=function(g,m){if(g){!m||m=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(g=="back")d.cullFace(d.BACK);else g=="front"?d.cullFace(d.FRONT):
d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
THREE.WebGLRenderer=function(a){function c(e,p,n){var j,q,s,v=e.vertices,r=v.length,k=e.colors,A=k.length,u=e.__vertexArray,G=e.__colorArray,F=e.__sortArray,L=e.__dirtyVertices,M=e.__dirtyColors;if(n.sortParticles){ma.multiplySelf(n.matrixWorld);for(j=0;j<r;j++){q=v[j].position;Fa.copy(q);ma.multiplyVector3(Fa);F[j]=[Fa.z,j]}F.sort(function(V,P){return P[0]-V[0]});for(j=0;j<r;j++){q=v[F[j][1]].position;s=j*3;u[s]=q.x;u[s+1]=q.y;u[s+2]=q.z}for(j=0;j<A;j++){s=j*3;color=k[F[j][1]];G[s]=color.r;G[s+1]=
color.g;G[s+2]=color.b}}else{if(L)for(j=0;j<r;j++){q=v[j].position;s=j*3;u[s]=q.x;u[s+1]=q.y;u[s+2]=q.z}if(M)for(j=0;j<A;j++){color=k[j];s=j*3;G[s]=color.r;G[s+1]=color.g;G[s+2]=color.b}}if(L||n.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,u,p)}if(M||n.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,G,p)}}function d(e,p){e.uniforms=Uniforms.clone(p.uniforms);e.vertexShader=p.vertexShader;e.fragmentShader=
p.fragmentShader}function g(e,p,n,j,q){j.__webglProgram||N.initMaterial(j,p,n,q);var s=j.program,v=s.uniforms,r=j.uniforms;if(s!=ra){b.useProgram(s);ra=s}b.uniformMatrix4fv(v.projectionMatrix,!1,ka);if(n&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){r.fogColor.value.setHex(n.color.hex);if(n instanceof THREE.Fog){r.fogNear.value=n.near;r.fogFar.value=
n.far}else if(n instanceof THREE.FogExp2)r.fogDensity.value=n.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j.lights){var k,A,u=0,G=0,F=0,L,M,V,P=na,U=P.directional.colors,C=P.directional.positions,D=P.point.colors,I=P.point.positions,W=0,oa=0;n=A=A=0;for(k=p.length;n<k;n++){A=p[n];L=A.color;M=A.position;V=A.intensity;if(A instanceof THREE.AmbientLight){u+=L.r;G+=L.g;F+=L.b}else if(A instanceof THREE.DirectionalLight){A=W*3;U[A]=L.r*V;U[A+1]=L.g*V;U[A+2]=
L.b*V;C[A]=M.x;C[A+1]=M.y;C[A+2]=M.z;W+=1}else if(A instanceof THREE.PointLight){A=oa*3;D[A]=L.r*V;D[A+1]=L.g*V;D[A+2]=L.b*V;I[A]=M.x;I[A+1]=M.y;I[A+2]=M.z;oa+=1}}for(n=W*3;n<U.length;n++)U[n]=0;for(n=oa*3;n<D.length;n++)D[n]=0;P.point.length=oa;P.directional.length=W;P.ambient[0]=u;P.ambient[1]=G;P.ambient[2]=F;n=na;r.enableLighting.value=n.directional.length+n.point.length;r.ambientLightColor.value=n.ambient;r.directionalLightColor.value=n.directional.colors;r.directionalLightDirection.value=n.directional.positions;
r.pointLightColor.value=n.point.colors;r.pointLightPosition.value=n.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.map.texture=j.map;r.lightMap.texture=j.lightMap;r.envMap.texture=j.envMap;r.reflectivity.value=j.reflectivity;r.refractionRatio.value=j.refractionRatio;r.combine.value=j.combine;r.useRefract.value=
j.envMap&&j.envMap.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);r.opacity.value=j.opacity;r.size.value=j.size;r.scale.value=Y.height/2;r.map.texture=j.map}else if(j instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(j.ambient.r,
j.ambient.g,j.ambient.b);r.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);r.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){r.mNear.value=e.near;r.mFar.value=e.far;r.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)r.opacity.value=j.opacity;for(var Na in r)if(G=s.uniforms[Na]){k=r[Na];u=k.type;n=k.value;if(u=="i")b.uniform1i(G,n);else if(u=="f")b.uniform1f(G,n);else if(u=="fv1")b.uniform1fv(G,n);else if(u=="fv")b.uniform3fv(G,n);else if(u==
"v2")b.uniform2f(G,n.x,n.y);else if(u=="v3")b.uniform3f(G,n.x,n.y,n.z);else if(u=="c")b.uniform3f(G,n.r,n.g,n.b);else if(u=="t"){b.uniform1i(G,n);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);for(u=0;u<6;++u)b.texSubImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image[u])}else{k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,
k.image.__webGLTextureCube);for(u=0;u<6;++u)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[u]);k.__wasSetOnce=!0}la(b.TEXTURE_CUBE_MAP,k,k.image[0]);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image)}else{k.__webGLTexture=
b.createTexture();b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);k.__wasSetOnce=!0}la(b.TEXTURE_2D,k,k.image);b.bindTexture(b.TEXTURE_2D,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+n);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}b.uniformMatrix4fv(v.modelViewMatrix,!1,q._modelViewMatrixArray);b.uniformMatrix3fv(v.normalMatrix,!1,q._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||
j.envMap)&&b.uniform3f(v.cameraPosition,e.position.x,e.position.y,e.position.z);(j instanceof THREE.MeshShaderMaterial||j.envMap||j.skinning)&&b.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&b.uniformMatrix4fv(v.viewMatrix,!1,Ca);if(j instanceof THREE.ShadowVolumeDynamicMaterial){e=r.directionalLightDirection.value;e[0]=-p.position.x;e[1]=-p.position.y;e[2]=
-p.position.z;b.uniform3fv(v.directionalLightDirection,e);b.uniformMatrix4fv(v.objectMatrix,!1,q._objectMatrixArray);b.uniformMatrix4fv(v.viewMatrix,!1,Ca)}if(j.skinning){b.uniformMatrix4fv(v.cameraInverseMatrix,!1,Ca);b.uniformMatrix4fv(v.boneGlobalMatrices,!1,q.boneMatrices)}return s}function f(e,p,n,j,q,s){if(j.opacity!=0){e=g(e,p,n,j,s).attributes;if(j.morphTargets){p=j.program.attributes;s.morphTargetBase!==-1?b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[s.morphTargetBase]):b.bindBuffer(b.ARRAY_BUFFER,
q.__webGLVertexBuffer);b.vertexAttribPointer(p.position,3,b.FLOAT,!1,0,0);if(s.morphTargetForcedOrder.length){n=0;for(var v=s.morphTargetForcedOrder,r=s.morphTargetInfluences;n<j.numSupportedMorphTargets&&n<v.length;){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[v[n]]);b.vertexAttribPointer(p["morphTarget"+n],3,b.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=r[v[n]];n++}}else{v=[];var k=-1,A=0;r=s.morphTargetInfluences;var u,G=r.length;n=0;for(s.morphTargetBase!==-1&&(v[s.morphTargetBase]=
!0);n<j.numSupportedMorphTargets;){for(u=0;u<G;u++)if(!v[u]&&r[u]>k){A=u;k=r[A]}b.bindBuffer(b.ARRAY_BUFFER,q.__webGLMorphTargetsBuffers[A]);b.vertexAttribPointer(p["morphTarget"+n],3,b.FLOAT,!1,0,0);s.__webGLMorphTargetInfluences[n]=k;v[A]=1;k=-1;n++}}b.uniform1fv(j.program.uniforms.morphTargetInfluences,s.__webGLMorphTargetInfluences)}else{b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,!1,0,0)}if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLColorBuffer);
b.vertexAttribPointer(e.color,3,b.FLOAT,!1,0,0)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,!1,0,0)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,!1,0,0)}if(e.uv>=0)if(q.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(q.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,
q.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(j.skinning&&e.skinVertexA>=0&&e.skinVertexB>=0&&e.skinIndex>=0&&e.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinVertexABuffer);b.vertexAttribPointer(e.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinVertexBBuffer);b.vertexAttribPointer(e.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinIndicesBuffer);b.vertexAttribPointer(e.skinIndex,
4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLSkinWeightsBuffer);b.vertexAttribPointer(e.skinWeight,4,b.FLOAT,!1,0,0)}if(s instanceof THREE.Mesh)if(j.wireframe){b.lineWidth(j.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLLineBuffer);b.drawElements(b.LINES,q.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,q.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(s instanceof THREE.Line){s=s.type==THREE.LineStrip?
b.LINE_STRIP:b.LINES;b.lineWidth(j.linewidth);b.drawArrays(s,0,q.__webGLLineCount)}else if(s instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,q.__webGLParticleCount);else s instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,q.__webGLVertexCount)}}function h(e,p){if(!e.__webGLVertexBuffer)e.__webGLVertexBuffer=b.createBuffer();if(!e.__webGLNormalBuffer)e.__webGLNormalBuffer=b.createBuffer();if(e.hasPos){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,e.positionArray,
b.DYNAMIC_DRAW);b.enableVertexAttribArray(p.attributes.position);b.vertexAttribPointer(p.attributes.position,3,b.FLOAT,!1,0,0)}if(e.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,e.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(p.attributes.normal);b.vertexAttribPointer(p.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,e.count);e.count=0}function i(e){if(pa!=e.doubleSided){e.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);pa=
e.doubleSided}if(Aa!=e.flipSided){e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);Aa=e.flipSided}}function m(e){if(sa!=e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);sa=e}}function o(e){O[0].set(e.n41-e.n11,e.n42-e.n12,e.n43-e.n13,e.n44-e.n14);O[1].set(e.n41+e.n11,e.n42+e.n12,e.n43+e.n13,e.n44+e.n14);O[2].set(e.n41+e.n21,e.n42+e.n22,e.n43+e.n23,e.n44+e.n24);O[3].set(e.n41-e.n21,e.n42-e.n22,e.n43-e.n23,e.n44-e.n24);O[4].set(e.n41-e.n31,e.n42-e.n32,e.n43-e.n33,e.n44-e.n34);O[5].set(e.n41+e.n31,
e.n42+e.n32,e.n43+e.n33,e.n44+e.n34);var p;for(e=0;e<6;e++){p=O[e];p.divideScalar(Math.sqrt(p.x*p.x+p.y*p.y+p.z*p.z))}}function t(e){for(var p=e.matrixWorld,n=-e.geometry.boundingSphere.radius*Math.max(e.scale.x,Math.max(e.scale.y,e.scale.z)),j=0;j<6;j++){e=O[j].x*p.n14+O[j].y*p.n24+O[j].z*p.n34+O[j].w;if(e<=n)return!1}return!0}function x(e,p){e.list[e.count]=p;e.count+=1}function y(e){var p,n,j=e.object,q=e.opaque,s=e.transparent;s.count=0;e=q.count=0;for(p=j.materials.length;e<p;e++){n=j.materials[e];
n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?x(s,n):x(q,n)}}function B(e){var p,n,j,q,s=e.object,v=e.buffer,r=e.opaque,k=e.transparent;k.count=0;e=r.count=0;for(j=s.materials.length;e<j;e++){p=s.materials[e];if(p instanceof THREE.MeshFaceMaterial){p=0;for(n=v.materials.length;p<n;p++)(q=v.materials[p])&&(q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?x(k,q):x(r,q))}else{q=p;q.opacity&&q.opacity<1||q.blending!=THREE.NormalBlending?x(k,q):x(r,q)}}}function z(e,p){return p.z-e.z}
function H(e,p){e._modelViewMatrix.multiplyToArray(p.matrixWorldInverse,e.matrixWorld,e._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)}function J(e){var p,n,j;if(e instanceof THREE.Mesh){n=e.geometry;for(p in n.geometryGroups){j=n.geometryGroups[p];if(n.__dirtyVertices||n.__dirtyMorphTargets||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents){var q=b.DYNAMIC_DRAW,s=void 0,v=void 0,r=void 0,k=void 0;
r=void 0;var A=void 0,u=void 0,G=void 0,F=void 0,L=void 0,M=void 0,V=void 0,P=void 0,U=void 0,C=void 0,D=void 0,I=void 0,W=void 0;u=void 0;G=void 0;k=void 0;F=void 0;k=void 0;C=void 0;D=void 0;u=void 0;C=void 0;D=void 0;I=void 0;W=void 0;C=void 0;D=void 0;I=void 0;W=void 0;C=void 0;D=void 0;I=void 0;W=void 0;C=void 0;D=void 0;I=void 0;k=void 0;F=void 0;A=void 0;r=void 0;r=void 0;var oa=void 0,Na=void 0,ta=void 0,Z=0,ua=0,Qa=0,Ra=0,Ga=0,Ha=0,X=0,Ia=0,qa=0,w=0,va=0,ya=j.__vertexArray,Za=j.__uvArray,
$a=j.__uv2Array,La=j.__normalArray,$=j.__tangentArray,za=j.__colorArray,aa=j.__skinVertexAArray,ca=j.__skinVertexBArray,da=j.__skinIndexArray,ea=j.__skinWeightArray,ab=j.__morphTargetsArrays,Ja=j.__faceArray,Ka=j.__lineArray,hb=j.__needsSmoothNormals;M=j.__vertexColorType;L=j.__uvType;V=j.__normalType;var Da=e.geometry,bb=Da.__dirtyVertices,cb=Da.__dirtyElements,Xa=Da.__dirtyUvs,db=Da.__dirtyNormals,eb=Da.__dirtyTangents,fb=Da.__dirtyColors,gb=Da.__dirtyMorphTargets,Sa=Da.vertices,ib=j.faces,lb=Da.faces,
jb=Da.faceVertexUvs[0],kb=Da.faceVertexUvs[1],Ta=Da.skinVerticesA,Ua=Da.skinVerticesB,Va=Da.skinIndices,Oa=Da.skinWeights,Pa=Da.edgeFaces,Ma=Da.morphTargets;s=0;for(v=ib.length;s<v;s++){r=ib[s];k=lb[r];jb&&(P=jb[r]);kb&&(U=kb[r]);r=k.vertexNormals;A=k.normal;u=k.vertexColors;G=k.color;F=k.vertexTangents;if(k instanceof THREE.Face3){if(bb){C=Sa[k.a].position;D=Sa[k.b].position;I=Sa[k.c].position;ya[ua]=C.x;ya[ua+1]=C.y;ya[ua+2]=C.z;ya[ua+3]=D.x;ya[ua+4]=D.y;ya[ua+5]=D.z;ya[ua+6]=I.x;ya[ua+7]=I.y;ya[ua+
8]=I.z;ua+=9}if(gb){oa=0;for(Na=Ma.length;oa<Na;oa++){C=Ma[oa].vertices[k.a].position;D=Ma[oa].vertices[k.b].position;I=Ma[oa].vertices[k.c].position;ta=ab[oa];ta[va+0]=C.x;ta[va+1]=C.y;ta[va+2]=C.z;ta[va+3]=D.x;ta[va+4]=D.y;ta[va+5]=D.z;ta[va+6]=I.x;ta[va+7]=I.y;ta[va+8]=I.z}va+=9}if(Oa.length){C=Oa[k.a];D=Oa[k.b];I=Oa[k.c];ea[w]=C.x;ea[w+1]=C.y;ea[w+2]=C.z;ea[w+3]=C.w;ea[w+4]=D.x;ea[w+5]=D.y;ea[w+6]=D.z;ea[w+7]=D.w;ea[w+8]=I.x;ea[w+9]=I.y;ea[w+10]=I.z;ea[w+11]=I.w;C=Va[k.a];D=Va[k.b];I=Va[k.c];
da[w]=C.x;da[w+1]=C.y;da[w+2]=C.z;da[w+3]=C.w;da[w+4]=D.x;da[w+5]=D.y;da[w+6]=D.z;da[w+7]=D.w;da[w+8]=I.x;da[w+9]=I.y;da[w+10]=I.z;da[w+11]=I.w;C=Ta[k.a];D=Ta[k.b];I=Ta[k.c];aa[w]=C.x;aa[w+1]=C.y;aa[w+2]=C.z;aa[w+3]=1;aa[w+4]=D.x;aa[w+5]=D.y;aa[w+6]=D.z;aa[w+7]=1;aa[w+8]=I.x;aa[w+9]=I.y;aa[w+10]=I.z;aa[w+11]=1;C=Ua[k.a];D=Ua[k.b];I=Ua[k.c];ca[w]=C.x;ca[w+1]=C.y;ca[w+2]=C.z;ca[w+3]=1;ca[w+4]=D.x;ca[w+5]=D.y;ca[w+6]=D.z;ca[w+7]=1;ca[w+8]=I.x;ca[w+9]=I.y;ca[w+10]=I.z;ca[w+11]=1;w+=12}if(fb&&M){if(u.length==
3&&M==THREE.VertexColors){k=u[0];C=u[1];D=u[2]}else D=C=k=G;za[qa]=k.r;za[qa+1]=k.g;za[qa+2]=k.b;za[qa+3]=C.r;za[qa+4]=C.g;za[qa+5]=C.b;za[qa+6]=D.r;za[qa+7]=D.g;za[qa+8]=D.b;qa+=9}if(eb&&Da.hasTangents){u=F[0];G=F[1];k=F[2];$[X]=u.x;$[X+1]=u.y;$[X+2]=u.z;$[X+3]=u.w;$[X+4]=G.x;$[X+5]=G.y;$[X+6]=G.z;$[X+7]=G.w;$[X+8]=k.x;$[X+9]=k.y;$[X+10]=k.z;$[X+11]=k.w;X+=12}if(db&&V)if(r.length==3&&hb)for(F=0;F<3;F++){A=r[F];La[Ha]=A.x;La[Ha+1]=A.y;La[Ha+2]=A.z;Ha+=3}else for(F=0;F<3;F++){La[Ha]=A.x;La[Ha+1]=A.y;
La[Ha+2]=A.z;Ha+=3}if(Xa&&P!==undefined&&L)for(F=0;F<3;F++){r=P[F];Za[Qa]=r.u;Za[Qa+1]=r.v;Qa+=2}if(Xa&&U!==undefined&&L)for(F=0;F<3;F++){r=U[F];$a[Ra]=r.u;$a[Ra+1]=r.v;Ra+=2}if(cb){Ja[Ga]=Z;Ja[Ga+1]=Z+1;Ja[Ga+2]=Z+2;Ga+=3;Ka[Ia]=Z;Ka[Ia+1]=Z+1;Ka[Ia+2]=Z;Ka[Ia+3]=Z+2;Ka[Ia+4]=Z+1;Ka[Ia+5]=Z+2;Ia+=6;Z+=3}}else if(k instanceof THREE.Face4){if(bb){C=Sa[k.a].position;D=Sa[k.b].position;I=Sa[k.c].position;W=Sa[k.d].position;ya[ua]=C.x;ya[ua+1]=C.y;ya[ua+2]=C.z;ya[ua+3]=D.x;ya[ua+4]=D.y;ya[ua+5]=D.z;ya[ua+
6]=I.x;ya[ua+7]=I.y;ya[ua+8]=I.z;ya[ua+9]=W.x;ya[ua+10]=W.y;ya[ua+11]=W.z;ua+=12}if(gb){oa=0;for(Na=Ma.length;oa<Na;oa++){C=Ma[oa].vertices[k.a].position;D=Ma[oa].vertices[k.b].position;I=Ma[oa].vertices[k.c].position;W=Ma[oa].vertices[k.d].position;ta=ab[oa];ta[va+0]=C.x;ta[va+1]=C.y;ta[va+2]=C.z;ta[va+3]=D.x;ta[va+4]=D.y;ta[va+5]=D.z;ta[va+6]=I.x;ta[va+7]=I.y;ta[va+8]=I.z;ta[va+9]=W.x;ta[va+10]=W.y;ta[va+11]=W.z}va+=12}if(Oa.length){C=Oa[k.a];D=Oa[k.b];I=Oa[k.c];W=Oa[k.d];ea[w]=C.x;ea[w+1]=C.y;
ea[w+2]=C.z;ea[w+3]=C.w;ea[w+4]=D.x;ea[w+5]=D.y;ea[w+6]=D.z;ea[w+7]=D.w;ea[w+8]=I.x;ea[w+9]=I.y;ea[w+10]=I.z;ea[w+11]=I.w;ea[w+12]=W.x;ea[w+13]=W.y;ea[w+14]=W.z;ea[w+15]=W.w;C=Va[k.a];D=Va[k.b];I=Va[k.c];W=Va[k.d];da[w]=C.x;da[w+1]=C.y;da[w+2]=C.z;da[w+3]=C.w;da[w+4]=D.x;da[w+5]=D.y;da[w+6]=D.z;da[w+7]=D.w;da[w+8]=I.x;da[w+9]=I.y;da[w+10]=I.z;da[w+11]=I.w;da[w+12]=W.x;da[w+13]=W.y;da[w+14]=W.z;da[w+15]=W.w;C=Ta[k.a];D=Ta[k.b];I=Ta[k.c];W=Ta[k.d];aa[w]=C.x;aa[w+1]=C.y;aa[w+2]=C.z;aa[w+3]=1;aa[w+4]=
D.x;aa[w+5]=D.y;aa[w+6]=D.z;aa[w+7]=1;aa[w+8]=I.x;aa[w+9]=I.y;aa[w+10]=I.z;aa[w+11]=1;aa[w+12]=W.x;aa[w+13]=W.y;aa[w+14]=W.z;aa[w+15]=1;C=Ua[k.a];D=Ua[k.b];I=Ua[k.c];k=Ua[k.d];ca[w]=C.x;ca[w+1]=C.y;ca[w+2]=C.z;ca[w+3]=1;ca[w+4]=D.x;ca[w+5]=D.y;ca[w+6]=D.z;ca[w+7]=1;ca[w+8]=I.x;ca[w+9]=I.y;ca[w+10]=I.z;ca[w+11]=1;ca[w+12]=k.x;ca[w+13]=k.y;ca[w+14]=k.z;ca[w+15]=1;w+=16}if(fb&&M){if(u.length==4&&M==THREE.VertexColors){k=u[0];C=u[1];D=u[2];u=u[3]}else u=D=C=k=G;za[qa]=k.r;za[qa+1]=k.g;za[qa+2]=k.b;za[qa+
3]=C.r;za[qa+4]=C.g;za[qa+5]=C.b;za[qa+6]=D.r;za[qa+7]=D.g;za[qa+8]=D.b;za[qa+9]=u.r;za[qa+10]=u.g;za[qa+11]=u.b;qa+=12}if(eb&&Da.hasTangents){u=F[0];G=F[1];k=F[2];F=F[3];$[X]=u.x;$[X+1]=u.y;$[X+2]=u.z;$[X+3]=u.w;$[X+4]=G.x;$[X+5]=G.y;$[X+6]=G.z;$[X+7]=G.w;$[X+8]=k.x;$[X+9]=k.y;$[X+10]=k.z;$[X+11]=k.w;$[X+12]=F.x;$[X+13]=F.y;$[X+14]=F.z;$[X+15]=F.w;X+=16}if(db&&V)if(r.length==4&&hb)for(F=0;F<4;F++){A=r[F];La[Ha]=A.x;La[Ha+1]=A.y;La[Ha+2]=A.z;Ha+=3}else for(F=0;F<4;F++){La[Ha]=A.x;La[Ha+1]=A.y;La[Ha+
2]=A.z;Ha+=3}if(Xa&&P!==undefined&&L)for(F=0;F<4;F++){r=P[F];Za[Qa]=r.u;Za[Qa+1]=r.v;Qa+=2}if(Xa&&U!==undefined&&L)for(F=0;F<4;F++){r=U[F];$a[Ra]=r.u;$a[Ra+1]=r.v;Ra+=2}if(cb){Ja[Ga]=Z;Ja[Ga+1]=Z+1;Ja[Ga+2]=Z+3;Ja[Ga+3]=Z+1;Ja[Ga+4]=Z+2;Ja[Ga+5]=Z+3;Ga+=6;Ka[Ia]=Z;Ka[Ia+1]=Z+1;Ka[Ia+2]=Z;Ka[Ia+3]=Z+3;Ka[Ia+4]=Z+1;Ka[Ia+5]=Z+2;Ka[Ia+6]=Z+2;Ka[Ia+7]=Z+3;Ia+=8;Z+=4}}}if(Pa){s=0;for(v=Pa.length;s<v;s++){Ja[Ga]=Pa[s].a;Ja[Ga+1]=Pa[s].b;Ja[Ga+2]=Pa[s].c;Ja[Ga+3]=Pa[s].a;Ja[Ga+4]=Pa[s].c;Ja[Ga+5]=Pa[s].d;
Ga+=6}}if(bb){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,ya,q)}if(gb){oa=0;for(Na=Ma.length;oa<Na;oa++){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLMorphTargetsBuffers[oa]);b.bufferData(b.ARRAY_BUFFER,ab[oa],q)}}if(fb&&qa>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,za,q)}if(db){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,La,q)}if(eb&&Da.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLTangentBuffer);
b.bufferData(b.ARRAY_BUFFER,$,q)}if(Xa&&Qa>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Za,q)}if(Xa&&Ra>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,$a,q)}if(cb){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ja,q);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Ka,q)}if(w>0){b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinVertexABuffer);b.bufferData(b.ARRAY_BUFFER,
aa,q);b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinVertexBBuffer);b.bufferData(b.ARRAY_BUFFER,ca,q);b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinIndicesBuffer);b.bufferData(b.ARRAY_BUFFER,da,q);b.bindBuffer(b.ARRAY_BUFFER,j.__webGLSkinWeightsBuffer);b.bufferData(b.ARRAY_BUFFER,ea,q)}}}n.__dirtyVertices=!1;n.__dirtyMorphTargets=!1;n.__dirtyElements=!1;n.__dirtyUvs=!1;n.__dirtyNormals=!1;n.__dirtyTangents=!1;n.__dirtyColors=!1}else if(e instanceof THREE.Ribbon){n=e.geometry;if(n.__dirtyVertices||n.__dirtyColors){e=
n;p=b.DYNAMIC_DRAW;V=e.vertices;q=e.colors;P=V.length;s=q.length;U=e.__vertexArray;v=e.__colorArray;Z=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<P;L++){M=V[L].position;j=L*3;U[j]=M.x;U[j+1]=M.y;U[j+2]=M.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,U,p)}if(Z){for(L=0;L<s;L++){color=q[L];j=L*3;v[j]=color.r;v[j+1]=color.g;v[j+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,v,p)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(e instanceof
THREE.Line){n=e.geometry;if(n.__dirtyVertices||n.__dirtyColors){e=n;p=b.DYNAMIC_DRAW;V=e.vertices;q=e.colors;P=V.length;s=q.length;U=e.__vertexArray;v=e.__colorArray;Z=e.__dirtyColors;if(e.__dirtyVertices){for(L=0;L<P;L++){M=V[L].position;j=L*3;U[j]=M.x;U[j+1]=M.y;U[j+2]=M.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,U,p)}if(Z){for(L=0;L<s;L++){color=q[L];j=L*3;v[j]=color.r;v[j+1]=color.g;v[j+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,
v,p)}}n.__dirtyVertices=!1;n.__dirtyColors=!1}else if(e instanceof THREE.ParticleSystem){n=e.geometry;(n.__dirtyVertices||n.__dirtyColors||e.sortParticles)&&c(n,b.DYNAMIC_DRAW,e);n.__dirtyVertices=!1;n.__dirtyColors=!1}}function Q(e){function p(F){var L=[];n=0;for(j=F.length;n<j;n++)F[n]==undefined?L.push("undefined"):L.push(F[n].id);return L.join("_")}var n,j,q,s,v,r,k,A,u={},G=e.morphTargets!==undefined?e.morphTargets.length:0;e.geometryGroups={};q=0;for(s=e.faces.length;q<s;q++){v=e.faces[q];r=
v.materials;k=p(r);u[k]==undefined&&(u[k]={hash:k,counter:0});A=u[k].hash+"_"+u[k].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:r,vertices:0,numMorphTargets:G});v=v instanceof THREE.Face3?3:4;if(e.geometryGroups[A].vertices+v>65535){u[k].counter+=1;A=u[k].hash+"_"+u[k].counter;e.geometryGroups[A]==undefined&&(e.geometryGroups[A]={faces:[],materials:r,vertices:0,numMorphTargets:G})}e.geometryGroups[A].faces.push(q);e.geometryGroups[A].vertices+=v}}function K(e,p,
n){e.push({buffer:p,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function ia(e){if(e!=Ba){switch(e){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:b.blendEquation(b.FUNC_REVERSE_SUBTRACT);b.blendFunc(b.ONE,b.ONE);break;default:b.blendEquation(b.FUNC_ADD);
b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}Ba=e}}function la(e,p,n){if((n.width&n.width-1)==0&&(n.height&n.height-1)==0){b.texParameteri(e,b.TEXTURE_WRAP_S,fa(p.wrapS));b.texParameteri(e,b.TEXTURE_WRAP_T,fa(p.wrapT));b.texParameteri(e,b.TEXTURE_MAG_FILTER,fa(p.magFilter));b.texParameteri(e,b.TEXTURE_MIN_FILTER,fa(p.minFilter));b.generateMipmap(e)}else{b.texParameteri(e,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(e,b.TEXTURE_MAG_FILTER,E(p.magFilter));
b.texParameteri(e,b.TEXTURE_MIN_FILTER,E(p.minFilter))}}function wa(e){if(e&&!e.__webGLFramebuffer){e.__webGLFramebuffer=b.createFramebuffer();e.__webGLRenderbuffer=b.createRenderbuffer();e.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,e.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,e.width,e.height);b.bindTexture(b.TEXTURE_2D,e.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,fa(e.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,
fa(e.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,fa(e.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,fa(e.minFilter));b.texImage2D(b.TEXTURE_2D,0,fa(e.format),e.width,e.height,0,fa(e.format),fa(e.type),null);b.bindFramebuffer(b.FRAMEBUFFER,e.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,e.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,e.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,
null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var p,n;if(e){p=e.__webGLFramebuffer;n=e.width;e=e.height}else{p=null;n=ha;e=ja}if(p!=R){b.bindFramebuffer(b.FRAMEBUFFER,p);b.viewport(T,ga,n,e);R=p}}function S(e,p){var n;if(e=="fragment")n=b.createShader(b.FRAGMENT_SHADER);else e=="vertex"&&(n=b.createShader(b.VERTEX_SHADER));b.shaderSource(n,p);b.compileShader(n);if(!b.getShaderParameter(n,b.COMPILE_STATUS)){console.error(b.getShaderInfoLog(n));console.error(p);
return null}return n}function E(e){switch(e){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return b.NEAREST;default:return b.LINEAR}}function fa(e){switch(e){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;
case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;
case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var Y=document.createElement("canvas"),b,ra=null,R=null,N=this,pa=null,Aa=null,Ba=null,sa=null,T=0,ga=0,ha=0,ja=0,O=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ma=new THREE.Matrix4,ka=new Float32Array(16),Ca=new Float32Array(16),Fa=new THREE.Vector4,na=
{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}},Ea=!0,Wa=new THREE.Color(0),Ya=0;if(a){if(a.antialias!==undefined)Ea=a.antialias;a.clearColor!==undefined&&Wa.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ya=a.clearAlpha}this.maxMorphTargets=8;this.domElement=Y;this.autoClear=!0;this.sortObjects=!0;(function(e,p,n){try{if(!(b=Y.getContext("experimental-webgl",{antialias:e,stencil:!0})))throw"Error creating WebGL context.";}catch(j){console.error(j)}b.clearColor(0,
0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(p.r,p.g,p.b,n)})(Ea,Wa,Ya);this.context=b;var xa={};a=[];Ea=[];a[0]=-2;a[1]=-1;a[2]=-1;a[3]=2;a[4]=-1;a[5]=-1;a[6]=2;a[7]=1;a[8]=-1;a[9]=-2;a[10]=1;a[11]=-1;Ea[0]=0;Ea[1]=1;Ea[2]=2;Ea[3]=0;Ea[4]=2;Ea[5]=3;xa.vertexBuffer=b.createBuffer();xa.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,xa.vertexBuffer);
b.bufferData(b.ARRAY_BUFFER,new Float32Array(a),b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,xa.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,new Uint16Array(Ea),b.STATIC_DRAW);xa.program=b.createProgram();b.attachShader(xa.program,S("fragment",THREE.ShaderLib.shadowPost.fragmentShader));b.attachShader(xa.program,S("vertex",THREE.ShaderLib.shadowPost.vertexShader));b.linkProgram(xa.program);xa.vertexLocation=b.getAttribLocation(xa.program,"position");xa.projectionLocation=b.getUniformLocation(xa.program,
"projectionMatrix");this.setSize=function(e,p){Y.width=e;Y.height=p;this.setViewport(0,0,Y.width,Y.height)};this.setViewport=function(e,p,n,j){T=e;ga=p;ha=n;ja=j;b.viewport(T,ga,ha,ja)};this.setScissor=function(e,p,n,j){b.scissor(e,p,n,j)};this.enableScissorTest=function(e){e?b.enable(b.SCISSOR_TEST):b.disable(b.SCISSOR_TEST)};this.enableDepthBufferWrite=function(e){b.depthMask(e)};this.setClearColorHex=function(e,p){var n=new THREE.Color(e);b.clearColor(n.r,n.g,n.b,p)};this.setClearColor=function(e,
p){b.clearColor(e.r,e.g,e.b,p)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT|b.STENCIL_BUFFER_BIT)};this.initMaterial=function(e,p,n,j){var q,s,v,r;if(e instanceof THREE.MeshDepthMaterial)d(e,THREE.ShaderLib.depth);else if(e instanceof THREE.ShadowVolumeDynamicMaterial)d(e,THREE.ShaderLib.shadowVolumeDynamic);else if(e instanceof THREE.MeshNormalMaterial)d(e,THREE.ShaderLib.normal);else if(e instanceof THREE.MeshBasicMaterial)d(e,THREE.ShaderLib.basic);else if(e instanceof THREE.MeshLambertMaterial)d(e,
THREE.ShaderLib.lambert);else if(e instanceof THREE.MeshPhongMaterial)d(e,THREE.ShaderLib.phong);else if(e instanceof THREE.LineBasicMaterial)d(e,THREE.ShaderLib.basic);else e instanceof THREE.ParticleBasicMaterial&&d(e,THREE.ShaderLib.particle_basic);if(!e.program){var k,A,u;k=u=r=0;for(v=p.length;k<v;k++){A=p[k];A instanceof THREE.DirectionalLight&&u++;A instanceof THREE.PointLight&&r++}if(r+u<=4)p=u;else{p=Math.ceil(4*u/(r+u));r=4-p}r={directional:p,point:r};p=50;if(j!==undefined&&j instanceof
THREE.SkinnedMesh)p=j.bones.length;v={fog:n,map:e.map,envMap:e.envMap,lightMap:e.lightMap,vertexColors:e.vertexColors,sizeAttenuation:e.sizeAttenuation,skinning:e.skinning,morphTargets:e.morphTargets,maxDirLights:r.directional,maxPointLights:r.point,maxBones:p};n=e.fragmentShader;r=e.vertexShader;p=b.createProgram();k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.fog?"#define USE_FOG":"",v.fog instanceof THREE.FogExp2?
"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.lightMap?"#define USE_LIGHTMAP":"",v.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,"#define MAX_BONES "+v.maxBones,v.map?"#define USE_MAP":"",v.envMap?"#define USE_ENVMAP":"",v.lightMap?"#define USE_LIGHTMAP":
"",v.vertexColors?"#define USE_COLOR":"",v.skinning?"#define USE_SKINNING":"",v.morphTargets?"#define USE_MORPHTARGETS":"",v.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
b.attachShader(p,S("fragment",k+n));b.attachShader(p,S("vertex",v+r));b.linkProgram(p);b.getProgramParameter(p,b.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+b.getProgramParameter(p,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");p.uniforms={};p.attributes={};e.program=p;n=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in e.uniforms)n.push(q);
q=e.program;r=0;for(p=n.length;r<p;r++){k=n[r];q.uniforms[k]=b.getUniformLocation(q,k)}n=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<this.maxMorphTargets;q++)n.push("morphTarget"+q);for(s in e.attributes)n.push(s);s=e.program;q=n;n=0;for(r=q.length;n<r;n++){p=q[n];s.attributes[p]=b.getAttribLocation(s,p)}s=e.program.attributes;b.enableVertexAttribArray(s.position);s.color>=0&&b.enableVertexAttribArray(s.color);s.normal>=0&&b.enableVertexAttribArray(s.normal);
s.tangent>=0&&b.enableVertexAttribArray(s.tangent);if(e.skinning&&s.skinVertexA>=0&&s.skinVertexB>=0&&s.skinIndex>=0&&s.skinWeight>=0){b.enableVertexAttribArray(s.skinVertexA);b.enableVertexAttribArray(s.skinVertexB);b.enableVertexAttribArray(s.skinIndex);b.enableVertexAttribArray(s.skinWeight)}if(e.morphTargets){e.numSupportedMorphTargets=0;if(s.morphTarget0>=0){b.enableVertexAttribArray(s.morphTarget0);e.numSupportedMorphTargets++}if(s.morphTarget1>=0){b.enableVertexAttribArray(s.morphTarget1);
e.numSupportedMorphTargets++}if(s.morphTarget2>=0){b.enableVertexAttribArray(s.morphTarget2);e.numSupportedMorphTargets++}if(s.morphTarget3>=0){b.enableVertexAttribArray(s.morphTarget3);e.numSupportedMorphTargets++}if(s.morphTarget4>=0){b.enableVertexAttribArray(s.morphTarget4);e.numSupportedMorphTargets++}if(s.morphTarget5>=0){b.enableVertexAttribArray(s.morphTarget5);e.numSupportedMorphTargets++}if(s.morphTarget6>=0){b.enableVertexAttribArray(s.morphTarget6);e.numSupportedMorphTargets++}if(s.morphTarget7>=
0){b.enableVertexAttribArray(s.morphTarget7);e.numSupportedMorphTargets++}j.__webGLMorphTargetInfluences=new Float32Array(this.maxMorphTargets);for(q=0;q<this.maxMorphTargets;q++)j.__webGLMorphTargetInfluences[q]=0}}e.__webglProgram=!0};this.render=function(e,p,n,j){var q,s,v,r,k,A,u,G,F=e.lights,L=e.fog;p.matrixAutoUpdate&&p.updateMatrix();e.update(undefined,!1,p);p.matrixWorldInverse.flattenToArray(Ca);p.projectionMatrix.flattenToArray(ka);ma.multiply(p.projectionMatrix,p.matrixWorldInverse);o(ma);
this.initWebGLObjects(e);wa(n);(this.autoClear||j)&&this.clear();j=e.__webglObjects.length;for(k=0;k<j;k++){r=e.__webglObjects[k];u=r.object;if(u.visible)if(!(u instanceof THREE.Mesh)||t(u)){u.matrixWorld.flattenToArray(u._objectMatrixArray);H(u,p);B(r);r.render=!0;if(this.sortObjects){Fa.copy(u.position);ma.multiplyVector3(Fa);r.z=Fa.z}}else r.render=!1;else r.render=!1}this.sortObjects&&e.__webglObjects.sort(z);A=e.__webglObjectsImmediate.length;for(k=0;k<A;k++){r=e.__webglObjectsImmediate[k];u=
r.object;if(u.visible){u.matrixAutoUpdate&&u.matrixWorld.flattenToArray(u._objectMatrixArray);H(u,p);y(r)}}ia(THREE.NormalBlending);for(k=0;k<j;k++){r=e.__webglObjects[k];if(r.render){u=r.object;G=r.buffer;v=r.opaque;i(u);for(q=0;q<v.count;q++){r=v.list[q];m(r.depthTest);f(p,F,L,r,G,u)}}}for(k=0;k<A;k++){r=e.__webglObjectsImmediate[k];u=r.object;if(u.visible){v=r.opaque;i(u);for(q=0;q<v.count;q++){r=v.list[q];m(r.depthTest);s=g(p,F,L,r,u);u.render(function(M){h(M,s)})}}}for(k=0;k<j;k++){r=e.__webglObjects[k];
if(r.render){u=r.object;G=r.buffer;v=r.transparent;i(u);for(q=0;q<v.count;q++){r=v.list[q];ia(r.blending);m(r.depthTest);f(p,F,L,r,G,u)}}}for(k=0;k<A;k++){r=e.__webglObjectsImmediate[k];u=r.object;if(u.visible){v=r.transparent;i(u);for(q=0;q<v.count;q++){r=v.list[q];ia(r.blending);m(r.depthTest);s=g(p,F,L,r,u);u.render(function(M){h(M,s)})}}}if(e.__webglShadowVolumes.length&&e.lights.length){b.enable(b.POLYGON_OFFSET_FILL);b.polygonOffset(0.1,1);b.enable(b.STENCIL_TEST);b.depthMask(!1);b.colorMask(!1,
!1,!1,!1);b.stencilFunc(b.ALWAYS,1,255);b.stencilOpSeparate(b.BACK,b.KEEP,b.INCR,b.KEEP);b.stencilOpSeparate(b.FRONT,b.KEEP,b.DECR,b.KEEP);A=e.lights.length;G=[];j=e.__webglShadowVolumes.length;for(p=0;p<A;p++){k=e.lights[p];if(k instanceof THREE.DirectionalLight){G[0]=-k.position.x;G[1]=-k.position.y;G[2]=-k.position.z;for(k=0;k<j;k++){u=e.__webglShadowVolumes[k].object;q=e.__webglShadowVolumes[k].buffer;r=u.materials[0];r.program||N.initMaterial(r,F,L,u);s=r.program;r=s.uniforms;v=s.attributes;
if(ra!==s){b.useProgram(s);ra=s;b.uniformMatrix4fv(r.projectionMatrix,!1,ka);b.uniformMatrix4fv(r.viewMatrix,!1,Ca);b.uniform3fv(r.directionalLightDirection,G)}u.matrixWorld.flattenToArray(u._objectMatrixArray);b.uniformMatrix4fv(r.objectMatrix,!1,u._objectMatrixArray);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLVertexBuffer);b.vertexAttribPointer(v.position,3,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,q.__webGLNormalBuffer);b.vertexAttribPointer(v.normal,3,b.FLOAT,!1,0,0);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
q.__webGLFaceBuffer);b.cullFace(b.FRONT);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0);b.cullFace(b.BACK);b.drawElements(b.TRIANGLES,q.__webGLFaceCount,b.UNSIGNED_SHORT,0)}}}b.disable(b.POLYGON_OFFSET_FILL);b.colorMask(!0,!0,!0,!0);b.stencilFunc(b.NOTEQUAL,0,255);b.stencilOp(b.KEEP,b.KEEP,b.KEEP);b.disable(b.DEPTH_TEST);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.blendEquation(b.FUNC_ADD);Ba="";ra=xa.program;b.useProgram(xa.program);b.uniformMatrix4fv(xa.projectionLocation,
!1,ka);b.bindBuffer(b.ARRAY_BUFFER,xa.vertexBuffer);b.vertexAttribPointer(xa.vertexLocation,3,b.FLOAT,!1,0,0);b.enableVertexAttribArray(xa.vertexLocation);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,xa.elementBuffer);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.disable(b.STENCIL_TEST);b.enable(b.DEPTH_TEST);b.disable(b.BLEND);b.depthMask(!0)}if(n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,n.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,
null)}};this.initWebGLObjects=function(e){if(!e.__webglObjects){e.__webglObjects=[];e.__webglObjectsImmediate=[];e.__webglShadowVolumes=[]}for(;e.__objectsAdded.length;){var p=e.__objectsAdded[0],n=e,j=void 0,q=void 0,s=void 0;if(p._modelViewMatrix==undefined){p._modelViewMatrix=new THREE.Matrix4;p._normalMatrixArray=new Float32Array(9);p._modelViewMatrixArray=new Float32Array(16);p._objectMatrixArray=new Float32Array(16);p.matrixWorld.flattenToArray(p._objectMatrixArray)}if(p instanceof THREE.Mesh){q=
p.geometry;q.geometryGroups==undefined&&Q(q);for(j in q.geometryGroups){s=q.geometryGroups[j];if(!s.__webGLVertexBuffer){var v=s;v.__webGLVertexBuffer=b.createBuffer();v.__webGLNormalBuffer=b.createBuffer();v.__webGLTangentBuffer=b.createBuffer();v.__webGLColorBuffer=b.createBuffer();v.__webGLUVBuffer=b.createBuffer();v.__webGLUV2Buffer=b.createBuffer();v.__webGLSkinVertexABuffer=b.createBuffer();v.__webGLSkinVertexBBuffer=b.createBuffer();v.__webGLSkinIndicesBuffer=b.createBuffer();v.__webGLSkinWeightsBuffer=
b.createBuffer();v.__webGLFaceBuffer=b.createBuffer();v.__webGLLineBuffer=b.createBuffer();if(v.numMorphTargets){var r=void 0,k=void 0;v.__webGLMorphTargetsBuffers=[];r=0;for(k=v.numMorphTargets;r<k;r++)v.__webGLMorphTargetsBuffers.push(b.createBuffer())}v=s;r=p;var A=void 0,u=void 0,G=void 0;G=void 0;var F=k=0,L=0;A=void 0;u=void 0;var M=void 0;u=void 0;var V=r.geometry;M=V.faces;var P=v.faces;A=0;for(u=P.length;A<u;A++){G=P[A];G=M[G];if(G instanceof THREE.Face3){k+=3;F+=1;L+=3}else if(G instanceof
THREE.Face4){k+=4;F+=2;L+=4}}A=v;u=r;M=void 0;P=void 0;var U=void 0,C=void 0;U=void 0;G=[];M=0;for(P=u.materials.length;M<P;M++){U=u.materials[M];if(U instanceof THREE.MeshFaceMaterial){U=0;for(l=A.materials.length;U<l;U++)(C=A.materials[U])&&G.push(C)}else(C=U)&&G.push(C)}u=G;a:{A=void 0;M=void 0;P=u.length;for(A=0;A<P;A++){M=u[A];if(M.map||M.lightMap||M instanceof THREE.MeshShaderMaterial){A=!0;break a}}A=!1}a:{M=void 0;P=void 0;G=u.length;for(M=0;M<G;M++){P=u[M];if(!(P instanceof THREE.MeshBasicMaterial&&
!P.envMap||P instanceof THREE.MeshDepthMaterial)){M=P&&P.shading!=undefined&&P.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}}M=!1}a:{P=void 0;G=void 0;U=u.length;for(P=0;P<U;P++){G=u[P];if(G.vertexColors){u=G.vertexColors;break a}}u=!1}v.__vertexArray=new Float32Array(k*3);if(M)v.__normalArray=new Float32Array(k*3);if(V.hasTangents)v.__tangentArray=new Float32Array(k*4);if(u)v.__colorArray=new Float32Array(k*3);if(A){if(V.faceUvs.length>0||V.faceVertexUvs.length>0)v.__uvArray=
new Float32Array(k*2);if(V.faceUvs.length>1||V.faceVertexUvs.length>1)v.__uv2Array=new Float32Array(k*2)}if(r.geometry.skinWeights.length&&r.geometry.skinIndices.length){v.__skinVertexAArray=new Float32Array(k*4);v.__skinVertexBArray=new Float32Array(k*4);v.__skinIndexArray=new Float32Array(k*4);v.__skinWeightArray=new Float32Array(k*4)}v.__faceArray=new Uint16Array(F*3+(r.geometry.edgeFaces?r.geometry.edgeFaces.length*6:0));v.__lineArray=new Uint16Array(L*2);if(v.numMorphTargets){V=void 0;P=void 0;
v.__morphTargetsArrays=[];V=0;for(P=v.numMorphTargets;V<P;V++)v.__morphTargetsArrays.push(new Float32Array(k*3))}v.__needsSmoothNormals=M==THREE.SmoothShading;v.__uvType=A;v.__vertexColorType=u;v.__normalType=M;v.__webGLFaceCount=F*3+(r.geometry.edgeFaces?r.geometry.edgeFaces.length*6:0);v.__webGLLineCount=L*2;q.__dirtyVertices=!0;q.__dirtyMorphTargets=!0;q.__dirtyElements=!0;q.__dirtyUvs=!0;q.__dirtyNormals=!0;q.__dirtyTangents=!0;q.__dirtyColors=!0}p instanceof THREE.ShadowVolume?K(n.__webglShadowVolumes,
s,p):K(n.__webglObjects,s,p)}}else if(p instanceof THREE.Ribbon){q=p.geometry;if(!q.__webGLVertexBuffer){j=q;j.__webGLVertexBuffer=b.createBuffer();j.__webGLColorBuffer=b.createBuffer();j=q;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__webGLVertexCount=s;q.__dirtyVertices=!0;q.__dirtyColors=!0}K(n.__webglObjects,q,p)}else if(p instanceof THREE.Line){q=p.geometry;if(!q.__webGLVertexBuffer){j=q;j.__webGLVertexBuffer=b.createBuffer();j.__webGLColorBuffer=
b.createBuffer();j=q;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__webGLLineCount=s;q.__dirtyVertices=!0;q.__dirtyColors=!0}K(n.__webglObjects,q,p)}else if(p instanceof THREE.ParticleSystem){q=p.geometry;if(!q.__webGLVertexBuffer){j=q;j.__webGLVertexBuffer=b.createBuffer();j.__webGLColorBuffer=b.createBuffer();j=q;s=j.vertices.length;j.__vertexArray=new Float32Array(s*3);j.__colorArray=new Float32Array(s*3);j.__sortArray=[];j.__webGLParticleCount=
s;q.__dirtyVertices=!0;q.__dirtyColors=!0}K(n.__webglObjects,q,p)}else THREE.MarchingCubes!==undefined&&p instanceof THREE.MarchingCubes&&n.__webglObjectsImmediate.push({object:p,opaque:{list:[],count:0},transparent:{list:[],count:0}});e.__objectsAdded.splice(0,1)}for(;e.__objectsRemoved.length;){p=e.__objectsRemoved[0];n=e;q=void 0;j=void 0;for(q=n.__webglObjects.length-1;q>=0;q--){j=n.__webglObjects[q].object;p==j&&n.__webglObjects.splice(q,1)}e.__objectsRemoved.splice(0,1)}p=0;for(n=e.__webglObjects.length;p<
n;p++)J(e.__webglObjects[p].object,e);p=0;for(n=e.__webglShadowVolumes.length;p<n;p++)J(e.__webglShadowVolumes[p].object,e)};this.setFaceCulling=function(e,p){if(e){!p||p=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
+4
View File
@@ -51,6 +51,7 @@
<script type="text/javascript" src="../src/materials/MeshNormalMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshFaceMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshShaderMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ShadowVolumeDynamicMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleBasicMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
@@ -66,6 +67,7 @@
<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
<script type="text/javascript" src="../src/objects/Sound.js"></script>
<script type="text/javascript" src="../src/objects/LOD.js"></script>
<script type="text/javascript" src="../src/objects/ShadowVolume.js"></script>
<script type="text/javascript" src="../src/scenes/Scene.js"></script>
<script type="text/javascript" src="../src/scenes/Fog.js"></script>
<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
@@ -97,6 +99,8 @@
<script type="text/javascript" src="../src/extras/geometries/Torus.js"></script>
<script type="text/javascript" src="../src/extras/geometries/TorusKnot.js"></script>
<script type="text/javascript" src="../src/extras/io/Loader.js"></script>
<script type="text/javascript" src="../src/extras/io/JSONLoader.js"></script>
<script type="text/javascript" src="../src/extras/io/BinaryLoader.js"></script>
<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
<script type="text/javascript" src="obj/Qrcode.js"></script>
+2 -85
View File
@@ -39,92 +39,9 @@
<div id="container"><br /><br /><br /><br /><br />Generating world...</div>
<div id="info"><a href="http://github.com/mrdoob/three.js" target="_blank">three.js</a> - <a href="http://www.minecraft.net/" target="_blank">minecraft</a> demo. featuring <a href="http://painterlypack.net/" target="_blank">painterly pack</a><br />(left click: forward, right click: backward)</div>
<!--
<script type="text/javascript" src="../build/Three.js"></script>
-->
<script type="text/javascript" src="../src/Three.js"></script>
<script type="text/javascript" src="../src/core/Color.js"></script>
<script type="text/javascript" src="../src/core/Vector2.js"></script>
<script type="text/javascript" src="../src/core/Vector3.js"></script>
<script type="text/javascript" src="../src/core/Vector4.js"></script>
<script type="text/javascript" src="../src/core/Ray.js"></script>
<script type="text/javascript" src="../src/core/Rectangle.js"></script>
<script type="text/javascript" src="../src/core/Matrix3.js"></script>
<script type="text/javascript" src="../src/core/Matrix4.js"></script>
<script type="text/javascript" src="../src/core/Object3D.js"></script>
<script type="text/javascript" src="../src/core/Quaternion.js"></script>
<script type="text/javascript" src="../src/core/Vertex.js"></script>
<script type="text/javascript" src="../src/core/Face3.js"></script>
<script type="text/javascript" src="../src/core/Face4.js"></script>
<script type="text/javascript" src="../src/core/UV.js"></script>
<script type="text/javascript" src="../src/core/Geometry.js"></script>
<script type="text/javascript" src="../src/core/Spline.js"></script>
<script type="text/javascript" src="../src/animation/AnimationHandler.js"></script>
<script type="text/javascript" src="../src/animation/Animation.js"></script>
<script type="text/javascript" src="../src/cameras/Camera.js"></script>
<script type="text/javascript" src="../src/lights/Light.js"></script>
<script type="text/javascript" src="../src/lights/AmbientLight.js"></script>
<script type="text/javascript" src="../src/lights/DirectionalLight.js"></script>
<script type="text/javascript" src="../src/lights/PointLight.js"></script>
<script type="text/javascript" src="../src/materials/Material.js"></script>
<script type="text/javascript" src="../src/materials/Mappings.js"></script>
<script type="text/javascript" src="../src/materials/LineBasicMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshBasicMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshLambertMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshPhongMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshDepthMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshNormalMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshFaceMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshShaderMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleBasicMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
<script type="text/javascript" src="../src/materials/Texture.js"></script>
<script type="text/javascript" src="../src/materials/RenderTarget.js"></script>
<script type="text/javascript" src="../src/materials/Uniforms.js"></script>
<script type="text/javascript" src="../src/objects/Particle.js"></script>
<script type="text/javascript" src="../src/objects/ParticleSystem.js"></script>
<script type="text/javascript" src="../src/objects/Line.js"></script>
<script type="text/javascript" src="../src/objects/Mesh.js"></script>
<script type="text/javascript" src="../src/objects/Bone.js"></script>
<script type="text/javascript" src="../src/objects/SkinnedMesh.js"></script>
<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
<script type="text/javascript" src="../src/objects/Sound.js"></script>
<script type="text/javascript" src="../src/objects/LOD.js"></script>
<script type="text/javascript" src="../src/scenes/Scene.js"></script>
<script type="text/javascript" src="../src/scenes/Fog.js"></script>
<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
<script type="text/javascript" src="../src/renderers/Projector.js"></script>
<script type="text/javascript" src="../src/renderers/DOMRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/CanvasRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/SVGRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/WebGLShaders.js"></script>
<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/SoundRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableVertex.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
<script type="text/javascript" src="../src/extras/GeometryUtils.js"></script>
<script type="text/javascript" src="../src/extras/ImageUtils.js"></script>
<script type="text/javascript" src="../src/extras/SceneUtils.js"></script>
<script type="text/javascript" src="../src/extras/ShaderUtils.js"></script>
<script type="text/javascript" src="../src/extras/cameras/QuakeCamera.js"></script>
<script type="text/javascript" src="../src/extras/cameras/PathCamera.js"></script>
<script type="text/javascript" src="../src/extras/geometries/Cube.js"></script>
<script type="text/javascript" src="../src/extras/geometries/Cylinder.js"></script>
<script type="text/javascript" src="../src/extras/geometries/Icosahedron.js"></script>
<script type="text/javascript" src="../src/extras/geometries/Lathe.js"></script>
<script type="text/javascript" src="../src/extras/geometries/Plane.js"></script>
<script type="text/javascript" src="../src/extras/geometries/Sphere.js"></script>
<script type="text/javascript" src="../src/extras/geometries/Torus.js"></script>
<script type="text/javascript" src="../src/extras/geometries/TorusKnot.js"></script>
<script type="text/javascript" src="../src/extras/io/Loader.js"></script>
<script type="text/javascript" src="../src/extras/io/JSONLoader.js"></script>
<script type="text/javascript" src="../src/extras/io/BinaryLoader.js"></script>
<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
<script type="text/javascript" src="js/ImprovedNoise.js"></script>
<script type="text/javascript" src="js/Detector.js"></script>
+1 -2
View File
@@ -16,8 +16,7 @@
<body>
<script type="text/javascript" src="../build/Three.js"></script>
<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
<script type="text/javascript" src="js/Stats.js"></script>
+9 -3
View File
@@ -69,8 +69,9 @@
<script type="text/javascript" src="../src/materials/MeshNormalMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshFaceMaterial.js"></script>
<script type="text/javascript" src="../src/materials/MeshShaderMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ShadowVolumeDynamicMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleBasicMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleCircleMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleCanvasMaterial.js"></script>
<script type="text/javascript" src="../src/materials/ParticleDOMMaterial.js"></script>
<script type="text/javascript" src="../src/materials/Texture.js"></script>
<script type="text/javascript" src="../src/materials/RenderTarget.js"></script>
@@ -84,6 +85,7 @@
<script type="text/javascript" src="../src/objects/Ribbon.js"></script>
<script type="text/javascript" src="../src/objects/Sound.js"></script>
<script type="text/javascript" src="../src/objects/LOD.js"></script>
<script type="text/javascript" src="../src/objects/ShadowVolume.js"></script>
<script type="text/javascript" src="../src/scenes/Scene.js"></script>
<script type="text/javascript" src="../src/scenes/Fog.js"></script>
<script type="text/javascript" src="../src/scenes/FogExp2.js"></script>
@@ -94,8 +96,10 @@
<script type="text/javascript" src="../src/renderers/WebGLShaders.js"></script>
<script type="text/javascript" src="../src/renderers/WebGLRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/SoundRenderer.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableVertex.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableFace3.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableFace4.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableObject.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableParticle.js"></script>
<script type="text/javascript" src="../src/renderers/renderables/RenderableLine.js"></script>
<script type="text/javascript" src="../src/extras/GeometryUtils.js"></script>
@@ -113,8 +117,10 @@
<script type="text/javascript" src="../src/extras/geometries/Torus.js"></script>
<script type="text/javascript" src="../src/extras/geometries/TorusKnot.js"></script>
<script type="text/javascript" src="../src/extras/io/Loader.js"></script>
<script type="text/javascript" src="../src/extras/io/JSONLoader.js"></script>
<script type="text/javascript" src="../src/extras/io/BinaryLoader.js"></script>
<script type="text/javascript" src="../src/extras/objects/MarchingCubes.js"></script>
<script type="text/javascript" src="js/RequestAnimationFrame.js"></script>
<script type="text/javascript" src="js/Stats.js"></script>
+2
View File
@@ -270,6 +270,7 @@ WEBGL_FILES = [
'materials/MeshFaceMaterial.js',
'materials/MeshShaderMaterial.js',
'materials/ParticleBasicMaterial.js',
'materials/ShadowVolumeDynamicMaterial.js',
'materials/Texture.js',
'materials/RenderTarget.js',
'materials/Uniforms.js',
@@ -282,6 +283,7 @@ WEBGL_FILES = [
'objects/Ribbon.js',
'objects/Sound.js',
'objects/LOD.js',
'objects/ShadowVolume.js',
'scenes/Scene.js',
'scenes/Fog.js',
'scenes/FogExp2.js',