ThreeWebGL.js 179 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. // ThreeWebGL.js r47dev - http://github.com/mrdoob/three.js
  2. 'use strict';var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.Float32Array=Array;if(!self.requestAnimationFrame)self.requestAnimationFrame=function(){return self.webkitRequestAnimationFrame||self.mozRequestAnimationFrame||self.oRequestAnimationFrame||self.msRequestAnimationFrame||function(a){self.setTimeout(a,1E3/60)}}();THREE.Color=function(a){void 0!==a&&this.setHex(a);return this};
  3. THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(a){this.r=a.r;this.g=a.g;this.b=a.b;return this},copyGammaToLinear:function(a){this.r=a.r*a.r;this.g=a.g*a.g;this.b=a.b*a.b;return this},copyLinearToGamma:function(a){this.r=Math.sqrt(a.r);this.g=Math.sqrt(a.g);this.b=Math.sqrt(a.b);return this},convertGammaToLinear:function(){var a=this.r,b=this.g,c=this.b;this.r=a*a;this.g=b*b;this.b=c*c;return this},convertLinearToGamma:function(){this.r=Math.sqrt(this.r);this.g=Math.sqrt(this.g);
  4. this.b=Math.sqrt(this.b);return this},setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;return this},setHSV:function(a,b,c){var d,g,f;if(0===c)this.r=this.g=this.b=0;else switch(d=Math.floor(6*a),g=6*a-d,a=c*(1-b),f=c*(1-b*g),b=c*(1-b*(1-g)),d){case 1:this.r=f;this.g=c;this.b=a;break;case 2:this.r=a;this.g=c;this.b=b;break;case 3:this.r=a;this.g=f;this.b=c;break;case 4:this.r=b;this.g=a;this.b=c;break;case 5:this.r=c;this.g=a;this.b=f;break;case 6:case 0:this.r=c,this.g=b,this.b=a}return this},setHex:function(a){a=
  5. Math.floor(a);this.r=(a>>16&255)/255;this.g=(a>>8&255)/255;this.b=(a&255)/255;return this},getHex:function(){return Math.floor(255*this.r)<<16^Math.floor(255*this.g)<<8^Math.floor(255*this.b)},getContextStyle:function(){return"rgb("+Math.floor(255*this.r)+","+Math.floor(255*this.g)+","+Math.floor(255*this.b)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
  6. THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},
  7. divideScalar:function(a){a?(this.x/=a,this.y/=a):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.lengthSq())},normalize:function(){return this.divideScalar(this.length())},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var b=this.x-a.x,a=this.y-a.y;return b*b+a*a},setLength:function(a){return this.normalize().multiplyScalar(a)},
  8. equals:function(a){return a.x===this.x&&a.y===this.y}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
  9. THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},setX:function(a){this.x=a;return this},setY:function(a){this.y=a;return this},setZ:function(a){this.z=a;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},
  10. addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=a.z;return this},
  11. divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a):this.z=this.y=this.x=0;return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.lengthSq())},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},
  12. cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,d=this.z;this.x=c*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){return(new THREE.Vector3).sub(this,a).lengthSq()},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){var b=Math.cos(this.y);
  13. this.y=Math.asin(a.n13);1.0E-5<Math.abs(b)?(this.x=Math.atan2(-a.n23/b,a.n33/b),this.z=Math.atan2(-a.n12/b,a.n11/b)):(this.x=0,this.z=Math.atan2(a.n21,a.n22))},isZero:function(){return 1.0E-4>this.lengthSq()}};THREE.Vector4=function(a,b,c,d){this.x=a||0;this.y=b||0;this.z=c||0;this.w=void 0!==d?d:1};
  14. THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=void 0!==a.w?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
  15. b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
  16. normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};THREE.Frustum=function(){this.planes=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4]};
  17. THREE.Frustum.prototype.setFromMatrix=function(a){var b,c=this.planes;c[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);c[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);c[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);c[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);c[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);c[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;6>a;a++)b=c[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))};
  18. THREE.Frustum.prototype.contains=function(a){for(var b=this.planes,c=a.matrixWorld,d=THREE.Frustum.__v1.set(c.getColumnX().length(),c.getColumnY().length(),c.getColumnZ().length()),d=-a.geometry.boundingSphere.radius*Math.max(d.x,Math.max(d.y,d.z)),g=0;6>g;g++)if(a=b[g].x*c.n14+b[g].y*c.n24+b[g].z*c.n34+b[g].w,a<=d)return!1;return!0};THREE.Frustum.__v1=new THREE.Vector3;
  19. THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);t=o.dot(b);y=p.add(a,r.copy(b).multiplyScalar(t));return F=c.distanceTo(y)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);r.sub(a,b);I=o.dot(o);A=o.dot(p);v=o.dot(r);J=p.dot(p);K=p.dot(r);G=1/(I*J-A*A);M=(J*v-A*K)*G;H=(I*K-A*v)*G;return 0<=M&&0<=H&&1>M+H}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,c,d=[];for(b=0,
  20. c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector3,l=new THREE.Vector3,j=new THREE.Vector3,n=new THREE.Vector3,m=new THREE.Vector3;this.intersectObject=function(a){for(var b,p=[],o=0,r=a.children.length;o<r;o++)Array.prototype.push.apply(p,this.intersectObject(a.children[o]));if(a instanceof THREE.Particle){o=
  21. c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.scale.x)return[];b={distance:o,point:a.position,face:null,object:a};p.push(b)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return p;var e,t,y=a.geometry,v=y.vertices,I;a.matrixRotationWorld.extractRotation(a.matrixWorld);for(o=0,r=y.faces.length;o<r;o++)if(b=y.faces[o],k.copy(this.origin),l.copy(this.direction),
  22. I=a.matrixWorld,j=I.multiplyVector3(j.copy(b.centroid)).subSelf(k),n=a.matrixRotationWorld.multiplyVector3(n.copy(b.normal)),e=l.dot(n),!(1.0E-4>Math.abs(e))&&(t=n.dot(j)/e,!(0>t)&&(a.doubleSided||(a.flipSided?0<e:0>e))))if(m.add(k,l.multiplyScalar(t)),b instanceof THREE.Face3)g=I.multiplyVector3(g.copy(v[b.a].position)),f=I.multiplyVector3(f.copy(v[b.b].position)),h=I.multiplyVector3(h.copy(v[b.c].position)),d(m,g,f,h)&&(b={distance:k.distanceTo(m),point:m.clone(),face:b,object:a},p.push(b));else if(b instanceof
  23. THREE.Face4&&(g=I.multiplyVector3(g.copy(v[b.a].position)),f=I.multiplyVector3(f.copy(v[b.b].position)),h=I.multiplyVector3(h.copy(v[b.c].position)),i=I.multiplyVector3(i.copy(v[b.d].position)),d(m,g,f,i)||d(m,f,h,i)))b={distance:k.distanceTo(m),point:m.clone(),face:b,object:a},p.push(b)}return p};var o=new THREE.Vector3,p=new THREE.Vector3,r=new THREE.Vector3,t,y,F,I,A,v,J,K,G,M,H};
  24. THREE.Rectangle=function(){function a(){f=d-b;h=g-c}var b,c,d,g,f,h,i=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(f,h,j,n){i=!1;b=f;c=h;d=j;g=n;a()};this.addPoint=function(f,h){i?(i=!1,b=f,c=h,d=f,g=h):(b=b<f?b:f,c=c<h?c:h,d=d>f?d:f,g=g>h?g:h);a()};this.add3Points=
  25. function(f,h,j,n,m,o){i?(i=!1,b=f<j?f<m?f:m:j<m?j:m,c=h<n?h<o?h:o:n<o?n:o,d=f>j?f>m?f:m:j>m?j:m,g=h>n?h>o?h:o:n>o?n:o):(b=f<j?f<m?f<b?f:b:m<b?m:b:j<m?j<b?j:b:m<b?m:b,c=h<n?h<o?h<c?h:c:o<c?o:c:n<o?n<c?n:c:o<c?o:c,d=f>j?f>m?f>d?f:d:m>d?m:d:j>m?j>d?j:d:m>d?m:d,g=h>n?h>o?h>g?h:g:o>g?o:g:n>o?n>g?n:g:o>g?o:g);a()};this.addRectangle=function(f){i?(i=!1,b=f.getLeft(),c=f.getTop(),d=f.getRight(),g=f.getBottom()):(b=b<f.getLeft()?b:f.getLeft(),c=c<f.getTop()?c:f.getTop(),d=d>f.getRight()?d:f.getRight(),g=g>
  26. f.getBottom()?g:f.getBottom());a()};this.inflate=function(f){b-=f;c-=f;d+=f;g+=f;a()};this.minSelf=function(f){b=b>f.getLeft()?b:f.getLeft();c=c>f.getTop()?c:f.getTop();d=d<f.getRight()?d:f.getRight();g=g<f.getBottom()?g:f.getBottom();a()};this.intersects=function(a){return d<a.getLeft()||b>a.getRight()||g<a.getTop()||c>a.getBottom()?!1:!0};this.empty=function(){i=!0;g=d=c=b=0;a()};this.isEmpty=function(){return i}};
  27. THREE.Math={clamp:function(a,b,c){return a<b?b:a>c?c:a},clampBottom:function(a,b){return a<b?b:a},mapLinear:function(a,b,c,d,g){return d+(a-b)*(g-d)/(c-b)},random16:function(){return(65280*Math.random()+255*Math.random())/65535},randInt:function(a,b){return a+Math.floor(Math.random()*(b-a+1))},randFloat:function(a,b){return a+Math.random()*(b-a)},randFloatSpread:function(a){return a*(0.5-Math.random())}};THREE.Matrix3=function(){this.m=[]};
  28. THREE.Matrix3.prototype={constructor:THREE.Matrix3,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}};
  29. THREE.Matrix4=function(a,b,c,d,g,f,h,i,k,l,j,n,m,o,p,r){this.set(void 0!==a?a:1,b||0,c||0,d||0,g||0,void 0!==f?f:1,h||0,i||0,k||0,l||0,void 0!==j?j:1,n||0,m||0,o||0,p||0,void 0!==r?r:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
  30. THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,g,f,h,i,k,l,j,n,m,o,p,r){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=g;this.n22=f;this.n23=h;this.n24=i;this.n31=k;this.n32=l;this.n33=j;this.n34=n;this.n41=m;this.n42=o;this.n43=p;this.n44=r;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
  31. b,c){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;f.sub(a,b).normalize();if(0===f.length())f.z=1;d.cross(c,f).normalize();0===d.length()&&(f.x+=1.0E-4,d.cross(c,f).normalize());g.cross(f,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=f.x;this.n21=d.y;this.n22=g.y;this.n23=f.y;this.n31=d.z;this.n32=g.z;this.n33=f.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,g=a.n13,f=a.n14,h=a.n21,i=a.n22,k=a.n23,l=a.n24,j=a.n31,n=a.n32,m=a.n33,o=a.n34,p=a.n41,r=a.n42,t=a.n43,
  32. y=a.n44,F=b.n11,I=b.n12,A=b.n13,v=b.n14,J=b.n21,K=b.n22,G=b.n23,M=b.n24,H=b.n31,L=b.n32,V=b.n33,ga=b.n34,oa=b.n41,z=b.n42,e=b.n43,qa=b.n44;this.n11=c*F+d*J+g*H+f*oa;this.n12=c*I+d*K+g*L+f*z;this.n13=c*A+d*G+g*V+f*e;this.n14=c*v+d*M+g*ga+f*qa;this.n21=h*F+i*J+k*H+l*oa;this.n22=h*I+i*K+k*L+l*z;this.n23=h*A+i*G+k*V+l*e;this.n24=h*v+i*M+k*ga+l*qa;this.n31=j*F+n*J+m*H+o*oa;this.n32=j*I+n*K+m*L+o*z;this.n33=j*A+n*G+m*V+o*e;this.n34=j*v+n*M+m*ga+o*qa;this.n41=p*F+r*J+t*H+y*oa;this.n42=p*I+r*K+t*L+y*z;this.n43=
  33. p*A+r*G+t*V+y*e;this.n44=p*v+r*M+t*ga+y*qa;return this},multiplySelf:function(a){return this.multiply(this,a)},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},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=
  34. 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},multiplyVector3:function(a){var b=a.x,c=a.y,d=a.z,g=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*g;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*g;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,g=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*g;a.y=
  35. this.n21*b+this.n22*c+this.n23*d+this.n24*g;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*g;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*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*
  36. 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},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,g=this.n21,f=this.n22,h=this.n23,i=this.n24,k=this.n31,l=this.n32,j=this.n33,n=this.n34,m=this.n41,o=this.n42,p=this.n43,r=this.n44;return d*h*l*m-c*i*l*m-d*f*j*m+b*i*j*m+c*f*n*m-b*h*n*m-d*h*k*o+c*i*k*o+d*g*j*o-a*i*j*o-c*g*n*o+a*h*n*o+d*f*k*p-b*i*k*p-d*g*l*p+a*i*l*p+b*g*n*p-a*f*n*p-c*f*k*r+b*h*k*r+c*g*l*r-a*h*l*r-
  37. b*g*j*r+a*f*j*r},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n34=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;
  38. 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]=
  39. 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]=
  40. 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,
  41. 0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),g=1-c,f=a.x,h=a.y,i=a.z,k=g*f,l=g*h;this.set(k*f+c,k*h-d*i,k*i+d*h,0,k*h+d*i,l*h+c,l*i-d*f,0,k*i-d*h,l*i+d*f,g*i*i+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
  42. this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var b=a.n11,c=a.n12,d=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,k=a.n24,l=a.n31,j=a.n32,n=a.n33,m=a.n34,o=a.n41,p=a.n42,r=a.n43,t=a.n44;this.n11=i*m*p-k*n*p+k*j*r-h*m*r-i*j*t+h*n*t;this.n12=g*n*p-d*m*p-g*j*r+c*m*r+d*j*t-c*n*t;this.n13=d*k*p-g*i*p+g*h*r-c*k*r-d*h*t+c*i*t;this.n14=g*i*j-d*k*j-g*h*n+c*k*n+d*h*m-c*i*m;this.n21=k*n*o-i*m*o-k*l*r+f*m*r+i*l*t-f*n*t;this.n22=d*m*o-g*n*o+
  43. g*l*r-b*m*r-d*l*t+b*n*t;this.n23=g*i*o-d*k*o-g*f*r+b*k*r+d*f*t-b*i*t;this.n24=d*k*l-g*i*l+g*f*n-b*k*n-d*f*m+b*i*m;this.n31=h*m*o-k*j*o+k*l*p-f*m*p-h*l*t+f*j*t;this.n32=g*j*o-c*m*o-g*l*p+b*m*p+c*l*t-b*j*t;this.n33=c*k*o-g*h*o+g*f*p-b*k*p-c*f*t+b*h*t;this.n34=g*h*l-c*k*l-g*f*j+b*k*j+c*f*m-b*h*m;this.n41=i*j*o-h*n*o-i*l*p+f*n*p+h*l*r-f*j*r;this.n42=c*n*o-d*j*o+d*l*p-b*n*p-c*l*r+b*j*r;this.n43=d*h*o-c*i*o-d*f*p+b*i*p+c*f*r-b*h*r;this.n44=c*i*l-d*h*l+d*f*j-b*i*j-c*f*n+b*h*n;this.multiplyScalar(1/a.determinant());
  44. return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,g=a.z,f=Math.cos(c),c=Math.sin(c),h=Math.cos(d),d=Math.sin(d),i=Math.cos(g),g=Math.sin(g);switch(b){case "YXZ":var k=h*i,l=h*g,j=d*i,n=d*g;this.n11=k+n*c;this.n12=j*c-l;this.n13=f*d;this.n21=f*g;this.n22=f*i;this.n23=-c;this.n31=l*c-j;this.n32=n+k*c;this.n33=f*h;break;case "ZXY":k=h*i;l=h*g;j=d*i;n=d*g;this.n11=k-n*c;this.n12=-f*g;this.n13=j+l*c;this.n21=l+j*c;this.n22=f*i;this.n23=n-k*c;this.n31=-f*d;this.n32=c;this.n33=f*h;break;case "ZYX":k=
  45. f*i;l=f*g;j=c*i;n=c*g;this.n11=h*i;this.n12=j*d-l;this.n13=k*d+n;this.n21=h*g;this.n22=n*d+k;this.n23=l*d-j;this.n31=-d;this.n32=c*h;this.n33=f*h;break;case "YZX":k=f*h;l=f*d;j=c*h;n=c*d;this.n11=h*i;this.n12=n-k*g;this.n13=j*g+l;this.n21=g;this.n22=f*i;this.n23=-c*i;this.n31=-d*i;this.n32=l*g+j;this.n33=k-n*g;break;case "XZY":k=f*h;l=f*d;j=c*h;n=c*d;this.n11=h*i;this.n12=-g;this.n13=d*i;this.n21=k*g+n;this.n22=f*i;this.n23=l*g-j;this.n31=j*g-l;this.n32=c*i;this.n33=n*g+k;break;default:k=f*i,l=f*
  46. g,j=c*i,n=c*g,this.n11=h*i,this.n12=-h*g,this.n13=d,this.n21=l+j*d,this.n22=k-n*d,this.n23=-c*h,this.n31=n-k*d,this.n32=j+l*d,this.n33=f*h}return this},setRotationFromQuaternion:function(a){var b=a.x,c=a.y,d=a.z,g=a.w,f=b+b,h=c+c,i=d+d,a=b*f,k=b*h,b=b*i,l=c*h,c=c*i,d=d*i,f=g*f,h=g*h,g=g*i;this.n11=1-(l+d);this.n12=k-g;this.n13=b+h;this.n21=k+g;this.n22=1-(a+d);this.n23=c-f;this.n31=b-h;this.n32=c+f;this.n33=1-(a+l);return this},scale:function(a){var b=a.x,c=a.y,a=a.z;this.n11*=b;this.n12*=c;this.n13*=
  47. 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},compose:function(a,b,c){var d=THREE.Matrix4.__m1,g=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(b);g.setScale(c.x,c.y,c.z);this.multiply(d,g);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,b,c){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,f=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);g.set(this.n12,this.n22,this.n32);f.set(this.n13,
  48. this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;b=b instanceof THREE.Quaternion?b:new THREE.Quaternion;c=c instanceof THREE.Vector3?c:new THREE.Vector3;c.x=d.length();c.y=g.length();c.z=f.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=c.x;d.n21/=c.x;d.n31/=c.x;d.n12/=c.y;d.n22/=c.y;d.n32/=c.y;d.n13/=c.z;d.n23/=c.z;d.n33/=c.z;b.setFromRotationMatrix(d);return[a,b,c]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
  49. return this},extractRotation:function(a){var b=THREE.Matrix4.__v1,c=1/b.set(a.n11,a.n21,a.n31).length(),d=1/b.set(a.n12,a.n22,a.n32).length(),b=1/b.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*c;this.n21=a.n21*c;this.n31=a.n31*c;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*b;this.n23=a.n23*b;this.n33=a.n33*b;return this},rotateByAxis:function(a,b){if(1===a.x&&0===a.y&&0===a.z)return this.rotateX(b);if(0===a.x&&1===a.y&&0===a.z)return this.rotateY(b);if(0===a.x&&0===a.y&&1===
  50. a.z)return this.rotateZ(b);var c=a.x,d=a.y,g=a.z,f=Math.sqrt(c*c+d*d+g*g),c=c/f,d=d/f,g=g/f,f=c*c,h=d*d,i=g*g,k=Math.cos(b),l=Math.sin(b),j=1-k,n=c*d*j,m=c*g*j,j=d*g*j,c=c*l,o=d*l,l=g*l,g=f+(1-f)*k,f=n+l,d=m-o,n=n-l,h=h+(1-h)*k,l=j+c,m=m+o,j=j-c,i=i+(1-i)*k,k=this.n11,c=this.n21,o=this.n31,p=this.n41,r=this.n12,t=this.n22,y=this.n32,F=this.n42,I=this.n13,A=this.n23,v=this.n33,J=this.n43;this.n11=g*k+f*r+d*I;this.n21=g*c+f*t+d*A;this.n31=g*o+f*y+d*v;this.n41=g*p+f*F+d*J;this.n12=n*k+h*r+l*I;this.n22=
  51. n*c+h*t+l*A;this.n32=n*o+h*y+l*v;this.n42=n*p+h*F+l*J;this.n13=m*k+j*r+i*I;this.n23=m*c+j*t+i*A;this.n33=m*o+j*y+i*v;this.n43=m*p+j*F+i*J;return this},rotateX:function(a){var b=this.n12,c=this.n22,d=this.n32,g=this.n42,f=this.n13,h=this.n23,i=this.n33,k=this.n43,l=Math.cos(a),a=Math.sin(a);this.n12=l*b+a*f;this.n22=l*c+a*h;this.n32=l*d+a*i;this.n42=l*g+a*k;this.n13=l*f-a*b;this.n23=l*h-a*c;this.n33=l*i-a*d;this.n43=l*k-a*g;return this},rotateY:function(a){var b=this.n11,c=this.n21,d=this.n31,g=this.n41,
  52. f=this.n13,h=this.n23,i=this.n33,k=this.n43,l=Math.cos(a),a=Math.sin(a);this.n11=l*b-a*f;this.n21=l*c-a*h;this.n31=l*d-a*i;this.n41=l*g-a*k;this.n13=l*f+a*b;this.n23=l*h+a*c;this.n33=l*i+a*d;this.n43=l*k+a*g;return this},rotateZ:function(a){var b=this.n11,c=this.n21,d=this.n31,g=this.n41,f=this.n12,h=this.n22,i=this.n32,k=this.n42,l=Math.cos(a),a=Math.sin(a);this.n11=l*b+a*f;this.n21=l*c+a*h;this.n31=l*d+a*i;this.n41=l*g+a*k;this.n12=l*f-a*b;this.n22=l*h-a*c;this.n32=l*i-a*d;this.n42=l*k-a*g;return this},
  53. translate:function(a){var b=a.x,c=a.y,a=a.z;this.n14=this.n11*b+this.n12*c+this.n13*a+this.n14;this.n24=this.n21*b+this.n22*c+this.n23*a+this.n24;this.n34=this.n31*b+this.n32*c+this.n33*a+this.n34;this.n44=this.n41*b+this.n42*c+this.n43*a+this.n44;return this}};
  54. THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,d=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,i=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,j=-a.n23*a.n11+a.n21*a.n13,n=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*h+a.n31*l;if(0===a)return null;a=1/a;c[0]=a*d;c[1]=a*g;c[2]=a*f;c[3]=a*h;c[4]=a*i;c[5]=a*k;c[6]=a*l;c[7]=a*j;c[8]=a*n;return b};
  55. THREE.Matrix4.makeFrustum=function(a,b,c,d,g,f){var h;h=new THREE.Matrix4;h.n11=2*g/(b-a);h.n12=0;h.n13=(b+a)/(b-a);h.n14=0;h.n21=0;h.n22=2*g/(d-c);h.n23=(d+c)/(d-c);h.n24=0;h.n31=0;h.n32=0;h.n33=-(f+g)/(f-g);h.n34=-2*f*g/(f-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,d){var g,a=c*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,c,d)};
  56. THREE.Matrix4.makeOrtho=function(a,b,c,d,g,f){var h,i,k,l;h=new THREE.Matrix4;i=b-a;k=c-d;l=f-g;h.n11=2/i;h.n12=0;h.n13=0;h.n14=-((b+a)/i);h.n21=0;h.n22=2/k;h.n23=0;h.n24=-((c+d)/k);h.n31=0;h.n32=0;h.n33=-2/l;h.n34=-((f+g)/l);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.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
  57. THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
  58. !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
  59. THREE.Object3D.prototype={constructor:THREE.Object3D,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(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(-1===
  60. this.children.indexOf(a)){void 0!==a.parent&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.addObject(a)}},remove:function(a){var b=this.children.indexOf(a);if(-1!==b){a.parent=void 0;this.children.splice(b,1);for(b=this;void 0!==b.parent;)b=b.parent;void 0!==b&&b instanceof THREE.Scene&&b.removeObject(a)}},getChildByName:function(a,b){var c,d,g;for(c=0,d=this.children.length;c<d;c++){g=this.children[c];if(g.name===
  61. a||b&&(g=g.getChildByName(a,b),void 0!==g))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(1!==this.scale.x||1!==this.scale.y||1!==this.scale.z)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
  62. this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,void 0!==d?d:1)};
  63. THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var b=Math.PI/360,c=a.x*b,d=a.y*b,g=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-g),g=Math.sin(-g),f=Math.cos(c),c=Math.sin(c),h=a*b,i=d*g;this.w=h*f-i*c;this.x=h*c+i*f;this.y=d*b*f+a*g*c;this.z=a*g*f-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
  64. this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-a.n11-a.n22+a.n33))/2;this.x=0>a.n32-a.n23?-Math.abs(this.x):Math.abs(this.x);this.y=0>a.n13-a.n31?-Math.abs(this.y):Math.abs(this.y);this.z=0>a.n21-a.n12?-Math.abs(this.z):Math.abs(this.z);
  65. this.normalize();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);0===a?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var b=
  66. this.x,c=this.y,d=this.z,g=this.w,f=a.x,h=a.y,i=a.z,a=a.w;this.x=b*a+g*f+c*i-d*h;this.y=c*a+g*h+d*f-b*i;this.z=d*a+g*i+b*h-c*f;this.w=g*a-b*f-c*h-d*i;return this},multiply:function(a,b){this.x=a.x*b.w+a.y*b.z-a.z*b.y+a.w*b.x;this.y=-a.x*b.z+a.y*b.w+a.z*b.x+a.w*b.y;this.z=a.x*b.y-a.y*b.x+a.z*b.w+a.w*b.z;this.w=-a.x*b.x-a.y*b.y-a.z*b.z+a.w*b.w;return this},multiplyVector3:function(a,b){b||(b=a);var c=a.x,d=a.y,g=a.z,f=this.x,h=this.y,i=this.z,k=this.w,l=k*c+h*g-i*d,j=k*d+i*c-f*g,n=k*g+f*d-h*c,c=-f*
  67. c-h*d-i*g;b.x=l*k+c*-f+j*-i-n*-h;b.y=j*k+c*-h+n*-f-l*-i;b.z=n*k+c*-i+l*-h-j*-f;return b}};
  68. THREE.Quaternion.slerp=function(a,b,c,d){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;0>g?(c.w=-b.w,c.x=-b.x,c.y=-b.y,c.z=-b.z,g=-g):c.copy(b);if(1<=Math.abs(g))return c.w=a.w,c.x=a.x,c.y=a.y,c.z=a.z,c;var f=Math.acos(g),g=Math.sqrt(1-g*g);if(0.001>Math.abs(g))return 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),c;b=Math.sin((1-d)*f)/g;d=Math.sin(d*f)/g;c.w=a.w*b+c.w*d;c.x=a.x*b+c.x*d;c.y=a.y*b+c.y*d;c.z=a.z*b+c.z*d;return c};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
  69. THREE.Face3=function(a,b,c,d,g,f){this.a=a;this.b=b;this.c=c;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};
  70. THREE.Face4=function(a,b,c,d,g,f,h){this.a=a;this.b=b;this.c=c;this.d=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.materialIndex=h;this.centroid=new THREE.Vector3};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
  71. THREE.UV.prototype={constructor:THREE.UV,set:function(a,b){this.u=a;this.v=b;return this},copy:function(a){this.u=a.u;this.v=a.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
  72. THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.materials=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
  73. THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(a){var b=new THREE.Matrix4;b.extractRotation(a,new THREE.Vector3(1,1,1));for(var c=0,d=this.vertices.length;c<d;c++)a.multiplyVector3(this.vertices[c].position);c=0;for(d=this.faces.length;c<d;c++){var g=this.faces[c];b.multiplyVector3(g.normal);for(var f=0,h=g.vertexNormals.length;f<h;f++)b.multiplyVector3(g.vertexNormals[f]);a.multiplyVector3(g.centroid)}},computeCentroids:function(){var a,b,c;for(a=0,b=this.faces.length;a<
  74. b;a++)c=this.faces[a],c.centroid.set(0,0,0),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)):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(){var a,
  75. b,c,d,g,f,h=new THREE.Vector3,i=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],g=this.vertices[c.b],f=this.vertices[c.c],h.sub(f.position,g.position),i.sub(d.position,g.position),h.crossSelf(i),h.isZero()||h.normalize(),c.normal.copy(h)},computeVertexNormals:function(){var a,b,c,d;if(void 0===this.__tmpVertices){d=this.__tmpVertices=Array(this.vertices.length);for(a=0,b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;for(a=0,b=this.faces.length;a<b;a++)if(c=
  76. this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;for(a=0,b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
  77. d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));for(a=0,b=this.vertices.length;a<b;a++)d[a].normalize();for(a=0,b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
  78. b,c,e,d,g,f){i=a.vertices[b].position;k=a.vertices[c].position;l=a.vertices[e].position;j=h[d];n=h[g];m=h[f];o=k.x-i.x;p=l.x-i.x;r=k.y-i.y;t=l.y-i.y;y=k.z-i.z;F=l.z-i.z;I=n.u-j.u;A=m.u-j.u;v=n.v-j.v;J=m.v-j.v;K=1/(I*J-A*v);L.set((J*o-v*p)*K,(J*r-v*t)*K,(J*y-v*F)*K);V.set((I*p-A*o)*K,(I*t-A*r)*K,(I*F-A*y)*K);M[b].addSelf(L);M[c].addSelf(L);M[e].addSelf(L);H[b].addSelf(V);H[c].addSelf(V);H[e].addSelf(V)}var b,c,d,g,f,h,i,k,l,j,n,m,o,p,r,t,y,F,I,A,v,J,K,G,M=[],H=[],L=new THREE.Vector3,V=new THREE.Vector3,
  79. ga=new THREE.Vector3,oa=new THREE.Vector3,z=new THREE.Vector3;for(b=0,c=this.vertices.length;b<c;b++)M[b]=new THREE.Vector3,H[b]=new THREE.Vector3;for(b=0,c=this.faces.length;b<c;b++)f=this.faces[b],h=this.faceVertexUvs[0][b],f instanceof THREE.Face3?a(this,f.a,f.b,f.c,0,1,2):f instanceof THREE.Face4&&(a(this,f.a,f.b,f.c,0,1,2),a(this,f.a,f.b,f.d,0,1,3));var e=["a","b","c","d"];for(b=0,c=this.faces.length;b<c;b++){f=this.faces[b];for(d=0;d<f.vertexNormals.length;d++)z.copy(f.vertexNormals[d]),g=f[e[d]],
  80. G=M[g],ga.copy(G),ga.subSelf(z.multiplyScalar(z.dot(G))).normalize(),oa.cross(f.vertexNormals[d],G),g=oa.dot(H[g]),g=0>g?-1:1,f.vertexTangents[d]=new THREE.Vector4(ga.x,ga.y,ga.z,g)}this.hasTangents=!0},computeBoundingBox:function(){if(0<this.vertices.length){var a;a=this.vertices[0].position;this.boundingBox?(this.boundingBox.min.copy(a),this.boundingBox.max.copy(a)):this.boundingBox={min:a.clone(),max:a.clone()};for(var b=this.boundingBox.min,c=this.boundingBox.max,d=1,g=this.vertices.length;d<
  81. g;d++){a=this.vertices[d].position;if(a.x<b.x)b.x=a.x;else if(a.x>c.x)c.x=a.x;if(a.y<b.y)b.y=a.y;else if(a.y>c.y)c.y=a.y;if(a.z<b.z)b.z=a.z;else if(a.z>c.z)c.z=a.z}}},computeBoundingSphere:function(){for(var a,b=0,c=0,d=this.vertices.length;c<d;c++)a=this.vertices[c].position.length(),a>b&&(b=a);this.boundingSphere={radius:b}},mergeVertices:function(){var a={},b=[],c=[],d,g=Math.pow(10,4),f,h;for(f=0,h=this.vertices.length;f<h;f++)d=this.vertices[f].position,d=[Math.round(d.x*g),Math.round(d.y*g),
  82. Math.round(d.z*g)].join("_"),void 0===a[d]?(a[d]=f,b.push(this.vertices[f]),c[f]=b.length-1):c[f]=c[a[d]];for(f=0,h=this.faces.length;f<h;f++)if(a=this.faces[f],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
  83. THREE.Spline=function(a){function b(a,b,c,d,g,f,h){a=0.5*(c-a);d=0.5*(d-b);return(2*(b-c)+a+d)*h+(-3*(b-c)-2*a-d)*f+a*g+b}this.points=a;var c=[],d={x:0,y:0,z:0},g,f,h,i,k,l,j,n,m;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){g=(this.points.length-1)*a;f=Math.floor(g);h=g-f;c[0]=0===f?f:f-1;c[1]=f;c[2]=f>this.points.length-2?f:f+1;c[3]=f>this.points.length-3?f:f+2;l=this.points[c[0]];j=this.points[c[1]];
  84. n=this.points[c[2]];m=this.points[c[3]];i=h*h;k=h*i;d.x=b(l.x,j.x,n.x,m.x,h,i,k);d.y=b(l.y,j.y,n.y,m.y,h,i,k);d.z=b(l.z,j.z,n.z,m.z,h,i,k);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,g=b=b=0,f=new THREE.Vector3,h=new THREE.Vector3,i=[],j=0;i[0]=0;a||(a=100);c=this.points.length*a;f.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),h.copy(d),j+=h.distanceTo(f),
  85. f.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=g&&(i[b]=j,g=b);i[i.length]=j;return{chunks:i,total:j}};this.reparametrizeByArcLength=function(a){var b,c,d,g,f,h,i=[],j=new THREE.Vector3,n=this.getLength();i.push(j.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=n.chunks[b]-n.chunks[b-1];h=Math.ceil(a*c/n.total);g=(b-1)/(this.points.length-1);f=b/(this.points.length-1);for(c=1;c<h-1;c++)d=g+c*(1/h)*(f-g),d=this.getPoint(d),i.push(j.copy(d).clone());i.push(j.copy(this.points[b]).clone())}this.points=
  86. i}};THREE.Edge=function(a,b,c,d){this.vertices=[a,b];this.vertexIndices=[c,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
  87. THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,b,c,d,g,f){THREE.Camera.call(this);this.left=a;this.right=b;this.top=c;this.bottom=d;this.near=void 0!==g?g:0.1;this.far=void 0!==f?f:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
  88. THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,b,c,d){THREE.Camera.call(this);this.fov=void 0!==a?a:50;this.aspect=void 0!==b?b:1;this.near=void 0!==c?c:0.1;this.far=void 0!==d?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
  89. THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;THREE.PerspectiveCamera.prototype.setLens=function(a,b){this.fov=2*Math.atan((void 0!==b?b:43.25)/(2*a));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(a,b,c,d,g,f){this.fullWidth=a;this.fullHeight=b;this.x=c;this.y=d;this.width=g;this.height=f;this.updateProjectionMatrix()};
  90. THREE.PerspectiveCamera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var a=this.fullWidth/this.fullHeight,b=Math.tan(this.fov*Math.PI/360)*this.near,c=-b,d=a*c,a=Math.abs(a*b-d),c=Math.abs(b-c);this.projectionMatrix=THREE.Matrix4.makeFrustum(d+this.x*a/this.fullWidth,d+(this.x+this.width)*a/this.fullWidth,b-(this.y+this.height)*c/this.fullHeight,b-this.y*c/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,
  91. this.far)};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;
  92. THREE.DirectionalLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,0,0);this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0};THREE.PointLight.prototype=new THREE.Light;
  93. THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(a,b,c,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=void 0!==b?b:1;this.distance=void 0!==c?c:0;this.castShadow=void 0!==d?d:!1;this.onlyShadow=!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
  94. THREE.Material=function(a){a=a||{};this.name="";this.id=THREE.MaterialCount++;this.opacity=void 0!==a.opacity?a.opacity:1;this.transparent=void 0!==a.transparent?a.transparent:!1;this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.depthTest=void 0!==a.depthTest?a.depthTest:!0;this.depthWrite=void 0!==a.depthWrite?a.depthWrite:!0;this.polygonOffset=void 0!==a.polygonOffset?a.polygonOffset:!1;this.polygonOffsetFactor=void 0!==a.polygonOffsetFactor?a.polygonOffsetFactor:0;this.polygonOffsetUnits=
  95. void 0!==a.polygonOffsetUnits?a.polygonOffsetUnits:0;this.alphaTest=void 0!==a.alphaTest?a.alphaTest:0;this.overdraw=void 0!==a.overdraw?a.overdraw:!1};THREE.MaterialCount=0;THREE.NoShading=0;THREE.FlatShading=1;THREE.SmoothShading=2;THREE.NoColors=0;THREE.FaceColors=1;THREE.VertexColors=2;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.MultiplyBlending=3;THREE.AdditiveAlphaBlending=4;
  96. THREE.LineBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.linewidth=void 0!==a.linewidth?a.linewidth:1;this.linecap=void 0!==a.linecap?a.linecap:"round";this.linejoin=void 0!==a.linejoin?a.linejoin:"round";this.vertexColors=a.vertexColors?a.vertexColors:!1;this.fog=void 0!==a.fog?a.fog:!0};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
  97. THREE.MeshBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:null;this.lightMap=void 0!==a.lightMap?a.lightMap:null;this.envMap=void 0!==a.envMap?a.envMap:null;this.combine=void 0!==a.combine?a.combine:THREE.MultiplyOperation;this.reflectivity=void 0!==a.reflectivity?a.reflectivity:1;this.refractionRatio=void 0!==a.refractionRatio?a.refractionRatio:0.98;this.fog=void 0!==a.fog?a.fog:
  98. !0;this.shading=void 0!==a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wireframe:!1;this.wireframeLinewidth=void 0!==a.wireframeLinewidth?a.wireframeLinewidth:1;this.wireframeLinecap=void 0!==a.wireframeLinecap?a.wireframeLinecap:"round";this.wireframeLinejoin=void 0!==a.wireframeLinejoin?a.wireframeLinejoin:"round";this.vertexColors=void 0!==a.vertexColors?a.vertexColors:!1;this.skinning=void 0!==a.skinning?a.skinning:!1;this.morphTargets=void 0!==a.morphTargets?a.morphTargets:
  99. !1};THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
  100. THREE.MeshLambertMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=void 0!==a.ambient?new THREE.Color(a.ambient):new THREE.Color(328965);this.wrapAround=void 0!==a.wrapAround?a.wrapAround:!1;this.wrapRGB=new THREE.Vector3(1,1,1);this.map=void 0!==a.map?a.map:null;this.lightMap=void 0!==a.lightMap?a.lightMap:null;this.envMap=void 0!==a.envMap?a.envMap:null;this.combine=void 0!==a.combine?a.combine:THREE.MultiplyOperation;
  101. this.reflectivity=void 0!==a.reflectivity?a.reflectivity:1;this.refractionRatio=void 0!==a.refractionRatio?a.refractionRatio:0.98;this.fog=void 0!==a.fog?a.fog:!0;this.shading=void 0!==a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wireframe:!1;this.wireframeLinewidth=void 0!==a.wireframeLinewidth?a.wireframeLinewidth:1;this.wireframeLinecap=void 0!==a.wireframeLinecap?a.wireframeLinecap:"round";this.wireframeLinejoin=void 0!==a.wireframeLinejoin?a.wireframeLinejoin:
  102. "round";this.vertexColors=void 0!==a.vertexColors?a.vertexColors:!1;this.skinning=void 0!==a.skinning?a.skinning:!1;this.morphTargets=void 0!==a.morphTargets?a.morphTargets:!1};THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
  103. THREE.MeshPhongMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.ambient=void 0!==a.ambient?new THREE.Color(a.ambient):new THREE.Color(328965);this.specular=void 0!==a.specular?new THREE.Color(a.specular):new THREE.Color(1118481);this.shininess=void 0!==a.shininess?a.shininess:30;this.metal=void 0!==a.metal?a.metal:!1;this.perPixel=void 0!==a.perPixel?a.perPixel:!1;this.wrapAround=void 0!==a.wrapAround?a.wrapAround:
  104. !1;this.wrapRGB=new THREE.Vector3(1,1,1);this.map=void 0!==a.map?a.map:null;this.lightMap=void 0!==a.lightMap?a.lightMap:null;this.envMap=void 0!==a.envMap?a.envMap:null;this.combine=void 0!==a.combine?a.combine:THREE.MultiplyOperation;this.reflectivity=void 0!==a.reflectivity?a.reflectivity:1;this.refractionRatio=void 0!==a.refractionRatio?a.refractionRatio:0.98;this.fog=void 0!==a.fog?a.fog:!0;this.shading=void 0!==a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wireframe:
  105. !1;this.wireframeLinewidth=void 0!==a.wireframeLinewidth?a.wireframeLinewidth:1;this.wireframeLinecap=void 0!==a.wireframeLinecap?a.wireframeLinecap:"round";this.wireframeLinejoin=void 0!==a.wireframeLinejoin?a.wireframeLinejoin:"round";this.vertexColors=void 0!==a.vertexColors?a.vertexColors:!1;this.skinning=void 0!==a.skinning?a.skinning:!1;this.morphTargets=void 0!==a.morphTargets?a.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;
  106. THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;THREE.MeshDepthMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=void 0!==a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wireframe:!1;this.wireframeLinewidth=void 0!==a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
  107. THREE.MeshNormalMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.shading=a.shading?a.shading:THREE.FlatShading;this.wireframe=a.wireframe?a.wireframe:!1;this.wireframeLinewidth=a.wireframeLinewidth?a.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
  108. THREE.MeshShaderMaterial=function(a){console.warn("DEPRECATED: MeshShaderMaterial() is now ShaderMaterial().");return new THREE.ShaderMaterial(a)};
  109. THREE.ParticleBasicMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=void 0!==a.map?a.map:null;this.size=void 0!==a.size?a.size:1;this.sizeAttenuation=void 0!==a.sizeAttenuation?a.sizeAttenuation:!0;this.vertexColors=void 0!==a.vertexColors?a.vertexColors:!1;this.fog=void 0!==a.fog?a.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
  110. THREE.ShaderMaterial=function(a){THREE.Material.call(this,a);a=a||{};this.fragmentShader=void 0!==a.fragmentShader?a.fragmentShader:"void main() {}";this.vertexShader=void 0!==a.vertexShader?a.vertexShader:"void main() {}";this.uniforms=void 0!==a.uniforms?a.uniforms:{};this.attributes=a.attributes;this.shading=void 0!==a.shading?a.shading:THREE.SmoothShading;this.wireframe=void 0!==a.wireframe?a.wireframe:!1;this.wireframeLinewidth=void 0!==a.wireframeLinewidth?a.wireframeLinewidth:1;this.fog=void 0!==
  111. a.fog?a.fog:!1;this.lights=void 0!==a.lights?a.lights:!1;this.vertexColors=void 0!==a.vertexColors?a.vertexColors:!1;this.skinning=void 0!==a.skinning?a.skinning:!1;this.morphTargets=void 0!==a.morphTargets?a.morphTargets:!1};THREE.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
  112. THREE.Texture=function(a,b,c,d,g,f,h,i){this.id=THREE.TextureCount++;this.image=a;this.mapping=void 0!==b?b:new THREE.UVMapping;this.wrapS=void 0!==c?c:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==d?d:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==g?g:THREE.LinearFilter;this.minFilter=void 0!==f?f:THREE.LinearMipMapLinearFilter;this.format=void 0!==h?h:THREE.RGBAFormat;this.type=void 0!==i?i:THREE.UnsignedByteType;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.generateMipmaps=
  113. !0;this.needsUpdate=!1;this.onUpdate=null};THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var a=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter,this.format,this.type);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};
  114. THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};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;
  115. 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.DataTexture=function(a,b,c,d,g,f,h,i,k,l){THREE.Texture.call(this,null,f,h,i,k,l,d,g);this.image={data:a,width:b,height:c}};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
  116. THREE.DataTexture.prototype.clone=function(){var a=new THREE.DataTexture(this.image.data,this.image.width,this.image.height,this.format,this.type,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);a.offset.copy(this.offset);a.repeat.copy(this.repeat);return a};THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
  117. THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.sortParticles=!1;if(this.geometry)this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius;this.frustumCulled=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
  118. THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.material=b;this.type=void 0!==c?c:THREE.LineStrip;this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere())};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
  119. THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b;if(b instanceof Array)console.warn("DEPRECATED: Mesh material can no longer be an Array. Using material at index 0..."),this.material=b[0];if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=a.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};
  120. 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;
  121. THREE.Mesh.prototype.getMorphTargetIndexByName=function(a){if(void 0!==this.morphTargetDictionary[a])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};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
  122. THREE.Bone.prototype.update=function(a,b){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 c,d=this.children.length;for(c=0;c<d;c++)this.children[c].update(this.skinMatrix,b)};
  123. THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var c,d,g,f,h,i;if(void 0!==this.geometry.bones){for(c=0;c<this.geometry.bones.length;c++)g=this.geometry.bones[c],f=g.pos,h=g.rotq,i=g.scl,d=this.addBone(),d.name=g.name,d.position.set(f[0],f[1],f[2]),d.quaternion.set(h[0],h[1],h[2],h[3]),d.useQuaternion=!0,void 0!==i?d.scale.set(i[0],i[1],i[2]):d.scale.set(1,1,1);for(c=0;c<this.bones.length;c++)g=this.geometry.bones[c],
  124. d=this.bones[c],-1===g.parent?this.add(d):this.bones[g.parent].add(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.addBone=function(a){void 0===a&&(a=new THREE.Bone(this));this.bones.push(a);return a};
  125. THREE.SkinnedMesh.prototype.updateMatrixWorld=function(a){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1;for(var a=0,b=this.children.length;a<b;a++){var c=this.children[a];c instanceof THREE.Bone?c.update(this.identityMatrix,!1):c.updateMatrixWorld(!0)}for(var b=this.bones.length,c=this.bones,d=this.boneMatrices,a=0;a<b;a++)c[a].skinMatrix.flattenToArrayOffset(d,
  126. 16*a)};
  127. THREE.SkinnedMesh.prototype.pose=function(){this.updateMatrixWorld(!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];var d=new THREE.Matrix4;d.getInverse(a.skinMatrix);b.push(d);a.skinMatrix.flattenToArrayOffset(this.boneMatrices,16*c)}if(void 0===this.geometry.skinVerticesA){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];for(a=0;a<this.geometry.skinIndices.length;a++){var c=this.geometry.vertices[a].position,g=this.geometry.skinIndices[a].x,f=this.geometry.skinIndices[a].y,d=
  128. new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[g].multiplyVector3(d));d=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[f].multiplyVector3(d));1!==this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y&&(c=0.5*(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y)),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.material=b};
  129. THREE.Ribbon.prototype=new THREE.Object3D;THREE.Ribbon.prototype.constructor=THREE.Ribbon;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.addLevel=function(a,b){void 0===b&&(b=0);for(var b=Math.abs(b),c=0;c<this.LODs.length&&!(b<this.LODs[c].visibleAtDistance);c++);this.LODs.splice(c,0,{visibleAtDistance:b,object3D:a});this.add(a)};
  130. THREE.LOD.prototype.update=function(a){if(1<this.LODs.length){a.matrixWorldInverse.getInverse(a.matrixWorld);a=a.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 b=1;b<this.LODs.length;b++)if(a>=this.LODs[b].visibleAtDistance)this.LODs[b-1].object3D.visible=!1,this.LODs[b].object3D.visible=!0;else break;for(;b<this.LODs.length;b++)this.LODs[b].object3D.visible=!1}};
  131. THREE.Sprite=function(a){THREE.Object3D.call(this);this.color=void 0!==a.color?new THREE.Color(a.color):new THREE.Color(16777215);this.map=a.map instanceof THREE.Texture?a.map:THREE.ImageUtils.loadTexture(a.map);this.blending=void 0!==a.blending?a.blending:THREE.NormalBlending;this.useScreenCoordinates=void 0!==a.useScreenCoordinates?a.useScreenCoordinates:!0;this.mergeWith3D=void 0!==a.mergeWith3D?a.mergeWith3D:!this.useScreenCoordinates;this.affectedByDistance=void 0!==a.affectedByDistance?a.affectedByDistance:
  132. !this.useScreenCoordinates;this.scaleByViewport=void 0!==a.scaleByViewport?a.scaleByViewport:!this.affectedByDistance;this.alignment=a.alignment instanceof THREE.Vector2?a.alignment:THREE.SpriteAlignment.center;this.rotation3d=this.rotation;this.rotation=0;this.opacity=1;this.uvOffset=new THREE.Vector2(0,0);this.uvScale=new THREE.Vector2(1,1)};THREE.Sprite.prototype=new THREE.Object3D;THREE.Sprite.prototype.constructor=THREE.Sprite;
  133. THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(1!==this.scale.x||1!==this.scale.y)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,this.scale.y);this.matrixWorldNeedsUpdate=!0};THREE.SpriteAlignment={};THREE.SpriteAlignment.topLeft=new THREE.Vector2(1,-1);THREE.SpriteAlignment.topCenter=new THREE.Vector2(0,-1);
  134. THREE.SpriteAlignment.topRight=new THREE.Vector2(-1,-1);THREE.SpriteAlignment.centerLeft=new THREE.Vector2(1,0);THREE.SpriteAlignment.center=new THREE.Vector2(0,0);THREE.SpriteAlignment.centerRight=new THREE.Vector2(-1,0);THREE.SpriteAlignment.bottomLeft=new THREE.Vector2(1,1);THREE.SpriteAlignment.bottomCenter=new THREE.Vector2(0,1);THREE.SpriteAlignment.bottomRight=new THREE.Vector2(-1,1);
  135. THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;
  136. THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)-1===this.lights.indexOf(a)&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&-1===this.objects.indexOf(a)){this.objects.push(a);this.__objectsAdded.push(a);var b=this.__objectsRemoved.indexOf(a);-1!==b&&this.__objectsRemoved.splice(b,1)}for(b=0;b<a.children.length;b++)this.addObject(a.children[b])};
  137. THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var b=this.lights.indexOf(a);-1!==b&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),-1!==b&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),-1!==b&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
  138. THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=void 0!==b?b:1;this.far=void 0!==c?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=void 0!==b?b:2.5E-4};
  139. 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 float flipEnvMap;\nuniform int combine;\n#endif",
  140. envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\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",
  141. map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
  142. lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D lightMap;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( lightMap, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_lambert_pars_vertex:"uniform vec3 ambient;\nuniform vec3 diffuse;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif",
  143. lights_lambert_vertex:"vLightWeighting = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\n#ifdef WRAP_AROUND\nfloat directionalLightWeightingFull = max( dot( transformedNormal, dirVector ), 0.0 );\nfloat directionalLightWeightingHalf = max( 0.5 * dot( transformedNormal, dirVector ) + 0.5, 0.0 );\nvec3 directionalLightWeighting = mix( vec3( directionalLightWeightingFull ), vec3( directionalLightWeightingHalf ), wrapRGB );\n#else\nfloat directionalLightWeighting = max( dot( transformedNormal, dirVector ), 0.0 );\n#endif\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#ifdef WRAP_AROUND\nfloat pointLightWeightingFull = max( dot( transformedNormal, lVector ), 0.0 );\nfloat pointLightWeightingHalf = max( 0.5 * dot( transformedNormal, lVector ) + 0.5, 0.0 );\nvec3 pointLightWeighting = mix( vec3 ( pointLightWeightingFull ), vec3( pointLightWeightingHalf ), wrapRGB );\n#else\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\n#endif\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n}\n#endif\nvLightWeighting = vLightWeighting * diffuse + ambient * ambientLightColor;",
  144. lights_phong_pars_vertex:"#if MAX_POINT_LIGHTS > 0\n#ifndef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif",lights_phong_vertex:"#if MAX_POINT_LIGHTS > 0\n#ifndef PHONG_PER_PIXEL\nfor( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz - mvPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif\n#endif",
  145. lights_phong_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\n#ifdef PHONG_PER_PIXEL\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\n#else\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif\n#ifdef WRAP_AROUND\nuniform vec3 wrapRGB;\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",
  146. lights_phong_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\n#ifdef PHONG_PER_PIXEL\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 lVector = lPosition.xyz + vViewPosition.xyz;\nfloat lDistance = 1.0;\nif ( pointLightDistance[ i ] > 0.0 )\nlDistance = 1.0 - min( ( length( lVector ) / pointLightDistance[ i ] ), 1.0 );\nlVector = normalize( lVector );\n#else\nvec3 lVector = normalize( vPointLight[ i ].xyz );\nfloat lDistance = vPointLight[ i ].w;\n#endif\n#ifdef WRAP_AROUND\nfloat pointDiffuseWeightFull = max( dot( normal, lVector ), 0.0 );\nfloat pointDiffuseWeightHalf = max( 0.5 * dot( normal, lVector ) + 0.5, 0.0 );\nvec3 pointDiffuseWeight = mix( vec3 ( pointDiffuseWeightFull ), vec3( pointDiffuseWeightHalf ), wrapRGB );\n#else\nfloat pointDiffuseWeight = max( dot( normal, lVector ), 0.0 );\n#endif\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * lDistance;\nvec3 pointHalfVector = normalize( lVector + viewPosition );\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointSpecularWeight = max( pow( pointDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( lVector, pointHalfVector ), 5.0 );\npointSpecular += schlick * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;\n#else\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * lDistance;\n#endif\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\n#ifdef WRAP_AROUND\nfloat dirDiffuseWeightFull = max( dot( normal, dirVector ), 0.0 );\nfloat dirDiffuseWeightHalf = max( 0.5 * dot( normal, dirVector ) + 0.5, 0.0 );\nvec3 dirDiffuseWeight = mix( vec3( dirDiffuseWeightFull ), vec3( dirDiffuseWeightHalf ), wrapRGB );\n#else\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\n#endif\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\nvec3 dirHalfVector = normalize( dirVector + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirSpecularWeight = max( pow( dirDotNormalHalf, shininess ), 0.0 );\n#ifdef PHYSICALLY_BASED_SHADING\nvec3 schlick = specular + vec3( 1.0 - specular ) * pow( dot( dirVector, dirHalfVector ), 5.0 );\ndirSpecular += schlick * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#else\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n#endif\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\n#ifdef METAL\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient + totalSpecular );\n#else\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;\n#endif",
  147. color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n#ifdef GAMMA_INPUT\nvColor = color * color;\n#else\nvColor = color;\n#endif\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 boneGlobalMatrices[ MAX_BONES ];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( boneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( boneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#endif",
  148. morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\nuniform float morphTargetInfluences[ 8 ];\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\nvec3 morphed = vec3( 0.0, 0.0, 0.0 );\nmorphed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\nmorphed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\nmorphed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\nmorphed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\nmorphed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\nmorphed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\nmorphed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\nmorphed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\nmorphed += position;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( morphed, 1.0 );\n#endif",
  149. default_vertex:"#ifndef USE_MORPHTARGETS\n#ifndef USE_SKINNING\ngl_Position = projectionMatrix * mvPosition;\n#endif\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\nuniform sampler2D shadowMap[ MAX_SHADOWS ];\nuniform float shadowDarkness;\nuniform float shadowBias;\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 256.0 * 256.0 * 256.0 ), 1.0 / ( 256.0 * 256.0 ), 1.0 / 256.0, 1.0 );\nfloat depth = dot( rgba_depth, bit_shift );\nreturn depth;\n}\n#endif",
  150. shadowmap_fragment:"#ifdef USE_SHADOWMAP\n#ifdef SHADOWMAP_SOFT\nconst float xPixelOffset = 1.0 / SHADOWMAP_WIDTH;\nconst float yPixelOffset = 1.0 / SHADOWMAP_HEIGHT;\n#endif\nvec3 shadowColor = vec3( 1.0 );\nfloat fDepth;\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nshadowCoord.z += shadowBias;\nbvec4 shadowTest = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\nif ( all( shadowTest ) ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nconst float shadowDelta = 1.0 / 9.0;\nconst float dx0 = -1.25 * xPixelOffset;\nconst float dy0 = -1.25 * yPixelOffset;\nconst float dx1 = 1.25 * xPixelOffset;\nconst float dy1 = 1.25 * yPixelOffset;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, 0.0 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( 0.0, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nfDepth = unpackDepth( texture2D( shadowMap[ i ], shadowCoord.xy + vec2( dx1, dy1 ) ) );\nif ( fDepth < shadowCoord.z ) shadow += shadowDelta;\nshadowColor = shadowColor * vec3( ( 1.0 - shadowDarkness * shadow ) );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < shadowCoord.z )\nshadowColor = shadowColor * vec3( 1.0 - shadowDarkness );\n#endif\n}\n}\n#ifdef GAMMA_OUTPUT\nshadowColor *= shadowColor;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * shadowColor;\n#endif",
  151. shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\nvarying vec4 vShadowCoord[ MAX_SHADOWS ];\nuniform mat4 shadowMatrix[ MAX_SHADOWS ];\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\n#ifdef USE_MORPHTARGETS\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( morphed, 1.0 );\n#else\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n#endif\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif",
  152. linear_to_gamma_fragment:"#ifdef GAMMA_OUTPUT\ngl_FragColor.xyz = sqrt( gl_FragColor.xyz );\n#endif"};
  153. THREE.UniformsUtils={merge:function(a){var b,c,d,g={};for(b=0;b<a.length;b++)for(c in d=this.clone(a[b]),d)g[c]=d[c];return g},clone:function(a){var b,c,d,g={};for(b in a)for(c in g[b]={},a[b])d=a[b][c],g[b][c]=d instanceof THREE.Color||d instanceof THREE.Vector2||d instanceof THREE.Vector3||d instanceof THREE.Vector4||d instanceof THREE.Matrix4||d instanceof THREE.Texture?d.clone():d instanceof Array?d.slice():d;return g}};
  154. THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},offsetRepeat:{type:"v4",value:new THREE.Vector4(0,0,1,1)},lightMap:{type:"t",value:2,texture:null},envMap:{type:"t",value:1,texture:null},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",
  155. value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
  156. 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)}},shadowmap:{shadowMap:{type:"tv",value:6,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
  157. THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",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}"},normal:{uniforms:{opacity:{type:"f",
  158. value:1}},vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}",fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,
  159. 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,THREE.ShaderChunk.shadowmap_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,
  160. THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),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,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,
  161. THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(328965)},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["varying vec3 vLightWeighting;",
  162. THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_lambert_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_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,
  163. "vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.lights_lambert_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform 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,
  164. THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,"gl_FragColor.xyz = gl_FragColor.xyz * vLightWeighting;",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,
  165. THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30},wrapRGB:{type:"v3",value:new THREE.Vector3(1,1,1)}}]),vertexShader:["varying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,
  166. THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_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 = -mvPosition.xyz;\nvec3 transformedNormal = normalMatrix * normal;\nvNormal = transformedNormal;",
  167. THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;",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,
  168. THREE.ShaderChunk.lights_phong_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.linear_to_gamma_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,
  169. THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_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;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",
  170. THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
  171. THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
  172. THREE.WebGLRenderer=function(a){function b(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(void 0===a.__webglCustomAttributesList)a.__webglCustomAttributesList=[];for(var g in d.attributes){var f=d.attributes[g];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var h=1;"v2"===f.type?h=2:"v3"===f.type?h=3:"v4"===f.type?h=4:"c"===f.type&&(h=3);f.size=h;f.array=new Float32Array(c*h);f.buffer=e.createBuffer();f.buffer.belongsToAttribute=g;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
  173. function c(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;if(0<=b.materialIndex)return a.geometry.materials[b.materialIndex]}function d(a){return a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial?!1:a&&void 0!==a.shading&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function g(a){return a.map||a.lightMap||a instanceof THREE.ShaderMaterial?!0:!1}function f(a,b,c){var d,g,f,h,i=a.vertices;h=i.length;
  174. var j=a.colors,n=j.length,l=a.__vertexArray,k=a.__colorArray,m=a.__sortArray,p=a.__dirtyVertices,o=a.__dirtyColors,r=a.__webglCustomAttributesList;if(c.sortParticles){nb.multiplySelf(c.matrixWorld);for(d=0;d<h;d++)g=i[d].position,Va.copy(g),nb.multiplyVector3(Va),m[d]=[Va.z,d];m.sort(function(a,b){return b[0]-a[0]});for(d=0;d<h;d++)g=i[m[d][1]].position,f=3*d,l[f]=g.x,l[f+1]=g.y,l[f+2]=g.z;for(d=0;d<n;d++)f=3*d,g=j[m[d][1]],k[f]=g.r,k[f+1]=g.g,k[f+2]=g.b;if(r)for(j=0,n=r.length;j<n;j++)if(i=r[j],
  175. void 0===i.boundTo||"vertices"===i.boundTo)if(f=0,g=i.value.length,1===i.size)for(d=0;d<g;d++)h=m[d][1],i.array[d]=i.value[h];else if(2===i.size)for(d=0;d<g;d++)h=m[d][1],h=i.value[h],i.array[f]=h.x,i.array[f+1]=h.y,f+=2;else if(3===i.size)if("c"===i.type)for(d=0;d<g;d++)h=m[d][1],h=i.value[h],i.array[f]=h.r,i.array[f+1]=h.g,i.array[f+2]=h.b,f+=3;else for(d=0;d<g;d++)h=m[d][1],h=i.value[h],i.array[f]=h.x,i.array[f+1]=h.y,i.array[f+2]=h.z,f+=3;else if(4===i.size)for(d=0;d<g;d++)h=m[d][1],h=i.value[h],
  176. i.array[f]=h.x,i.array[f+1]=h.y,i.array[f+2]=h.z,i.array[f+3]=h.w,f+=4}else{if(p)for(d=0;d<h;d++)g=i[d].position,f=3*d,l[f]=g.x,l[f+1]=g.y,l[f+2]=g.z;if(o)for(d=0;d<n;d++)g=j[d],f=3*d,k[f]=g.r,k[f+1]=g.g,k[f+2]=g.b;if(r)for(j=0,n=r.length;j<n;j++)if(i=r[j],i.needsUpdate&&(void 0===i.boundTo||"vertices"===i.boundTo))if(g=i.value.length,f=0,1===i.size)for(d=0;d<g;d++)i.array[d]=i.value[d];else if(2===i.size)for(d=0;d<g;d++)h=i.value[d],i.array[f]=h.x,i.array[f+1]=h.y,f+=2;else if(3===i.size)if("c"===
  177. i.type)for(d=0;d<g;d++)h=i.value[d],i.array[f]=h.r,i.array[f+1]=h.g,i.array[f+2]=h.b,f+=3;else for(d=0;d<g;d++)h=i.value[d],i.array[f]=h.x,i.array[f+1]=h.y,i.array[f+2]=h.z,f+=3;else if(4===i.size)for(d=0;d<g;d++)h=i.value[d],i.array[f]=h.x,i.array[f+1]=h.y,i.array[f+2]=h.z,i.array[f+3]=h.w,f+=4}if(p||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,l,b);if(o||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,a.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,
  178. k,b);if(r)for(j=0,n=r.length;j<n;j++)if(i=r[j],i.needsUpdate||c.sortParticles)e.bindBuffer(e.ARRAY_BUFFER,i.buffer),e.bufferData(e.ARRAY_BUFFER,i.array,b)}function h(a,b){return b.z-a.z}function i(a,b,c){if(a.length)for(var d=0,e=a.length;d<e;d++)$a=null,Ha=Ca=ob=pb=ab=-1,a[d].render(b,c,ac,bc),$a=null,Ha=Ca=ob=pb=ab=-1}function k(a,b,c,d,e,f,g,h){var i,j,n,l;b?(j=a.length-1,l=b=-1):(j=0,b=a.length,l=1);for(var k=j;k!==b;k+=l)if(i=a[k],i.render){j=i.object;n=i.buffer;if(h)i=h;else{i=i[c];if(!i)continue;
  179. g&&z.setBlending(i.blending);z.setDepthTest(i.depthTest);z.setDepthWrite(i.depthWrite);y(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}z.setObjectFaces(j);n instanceof THREE.BufferGeometry?z.renderBufferDirect(d,e,f,i,n,j):z.renderBuffer(d,e,f,i,n,j)}}function l(a,b,c,d,e,f,g){for(var h,i,j=0,n=a.length;j<n;j++)if(h=a[j],i=h.object,i.visible){if(g)h=g;else{h=h[b];if(!h)continue;f&&z.setBlending(h.blending);z.setDepthTest(h.depthTest);z.setDepthWrite(h.depthWrite);y(h.polygonOffset,h.polygonOffsetFactor,
  180. h.polygonOffsetUnits)}z.renderImmediateObject(c,d,e,h,i)}}function j(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function m(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function o(a,b){for(var c=a.length-1;0<=c;c--)a[c].object===b&&a.splice(c,1)}function p(a,b){for(var c=a.length-1;0<=c;c--)a[c]===b&&a.splice(c,1)}function r(a,b,c,d,f){d.program||z.initMaterial(d,b,c,f);if(d.morphTargets&&
  181. !f.__webglMorphTargetInfluences){f.__webglMorphTargetInfluences=new Float32Array(z.maxMorphTargets);for(var g=0,h=z.maxMorphTargets;g<h;g++)f.__webglMorphTargetInfluences[g]=0}var i=!1,g=d.program,h=g.uniforms,j=d.uniforms;g!==$a&&(e.useProgram(g),$a=g,i=!0);if(d.id!==Ha)Ha=d.id,i=!0;if(i){e.uniformMatrix4fv(h.projectionMatrix,!1,a._projectionMatrixArray);if(c&&d.fog)if(j.fogColor.value=c.color,c instanceof THREE.Fog)j.fogNear.value=c.near,j.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)j.fogDensity.value=
  182. c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){var n,l,k=0,m=0,p=0,o,r,t=cc,v=t.directional.colors,y=t.directional.positions,A=t.point.colors,F=t.point.positions,M=t.point.distances,G=0,H=0,L=r=0;for(c=0,i=b.length;c<i;c++)if(n=b[c],l=n.color,o=n.intensity,r=n.distance,n instanceof THREE.AmbientLight)z.gammaInput?(k+=l.r*l.r,m+=l.g*l.g,p+=l.b*l.b):(k+=l.r,m+=l.g,p+=l.b);else if(n instanceof THREE.DirectionalLight)r=3*G,z.gammaInput?(v[r]=l.r*l.r*
  183. o*o,v[r+1]=l.g*l.g*o*o,v[r+2]=l.b*l.b*o*o):(v[r]=l.r*o,v[r+1]=l.g*o,v[r+2]=l.b*o),n=n.matrixWorld.getPosition(),l=1/n.length(),y[r]=n.x*l,y[r+1]=n.y*l,y[r+2]=n.z*l,G+=1;else if(n instanceof THREE.SpotLight&&!n.onlyShadow)r=3*G,z.gammaInput?(v[r]=l.r*l.r*o*o,v[r+1]=l.g*l.g*o*o,v[r+2]=l.b*l.b*o*o):(v[r]=l.r*o,v[r+1]=l.g*o,v[r+2]=l.b*o),n=n.matrixWorld.getPosition(),l=1/n.length(),y[r]=n.x*l,y[r+1]=n.y*l,y[r+2]=n.z*l,G+=1;else if(n instanceof THREE.PointLight)L=3*H,z.gammaInput?(A[L]=l.r*l.r*o*o,A[L+
  184. 1]=l.g*l.g*o*o,A[L+2]=l.b*l.b*o*o):(A[L]=l.r*o,A[L+1]=l.g*o,A[L+2]=l.b*o),n=n.matrixWorld.getPosition(),F[L]=n.x,F[L+1]=n.y,F[L+2]=n.z,M[H]=r,H+=1;for(c=3*G,i=v.length;c<i;c++)v[c]=0;for(c=3*H,i=A.length;c<i;c++)A[c]=0;t.point.length=H;t.directional.length=G;t.ambient[0]=k;t.ambient[1]=m;t.ambient[2]=p;b=cc;j.ambientLightColor.value=b.ambient;j.directionalLightColor.value=b.directional.colors;j.directionalLightDirection.value=b.directional.positions;j.pointLightColor.value=b.point.colors;j.pointLightPosition.value=
  185. b.point.positions;j.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)j.opacity.value=d.opacity,z.gammaInput?j.diffuse.value.copyGammaToLinear(d.color):j.diffuse.value=d.color,(j.map.texture=d.map)&&j.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),j.lightMap.texture=d.lightMap,j.envMap.texture=d.envMap,j.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?
  186. 1:-1,j.reflectivity.value=d.reflectivity,j.refractionRatio.value=d.refractionRatio,j.combine.value=d.combine,j.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)j.diffuse.value=d.color,j.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)j.psColor.value=d.color,j.opacity.value=d.opacity,j.size.value=d.size,j.scale.value=K.height/2,j.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)j.shininess.value=
  187. d.shininess,z.gammaInput?(j.ambient.value.copyGammaToLinear(d.ambient),j.specular.value.copyGammaToLinear(d.specular)):(j.ambient.value=d.ambient,j.specular.value=d.specular),d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshLambertMaterial)z.gammaInput?j.ambient.value.copyGammaToLinear(d.ambient):j.ambient.value=d.ambient,d.wrapAround&&j.wrapRGB.value.copy(d.wrapRGB);else if(d instanceof THREE.MeshDepthMaterial)j.mNear.value=a.near,j.mFar.value=a.far,j.opacity.value=d.opacity;
  188. else if(d instanceof THREE.MeshNormalMaterial)j.opacity.value=d.opacity;if(f.receiveShadow&&!d._shadowPass&&j.shadowMatrix){for(b=0;b<z.shadowMapPlugin.shadowMatrix.length;b++)j.shadowMatrix.value[b]=z.shadowMapPlugin.shadowMatrix[b],j.shadowMap.texture[b]=z.shadowMapPlugin.shadowMap[b];j.shadowDarkness.value=z.shadowMapDarkness;j.shadowBias.value=z.shadowMapBias}b=d.uniformsList;for(j=0,c=b.length;j<c;j++)if(m=g.uniforms[b[j][1]])if(i=b[j][0],p=i.type,k=i.value,"i"===p)e.uniform1i(m,k);else if("f"===
  189. p)e.uniform1f(m,k);else if("v2"===p)e.uniform2f(m,k.x,k.y);else if("v3"===p)e.uniform3f(m,k.x,k.y,k.z);else if("v4"===p)e.uniform4f(m,k.x,k.y,k.z,k.w);else if("c"===p)e.uniform3f(m,k.r,k.g,k.b);else if("fv1"===p)e.uniform1fv(m,k);else if("fv"===p)e.uniform3fv(m,k);else if("v3v"===p){if(!i._array)i._array=new Float32Array(3*k.length);for(p=0,t=k.length;p<t;p++)v=3*p,i._array[v]=k[p].x,i._array[v+1]=k[p].y,i._array[v+2]=k[p].z;e.uniform3fv(m,i._array)}else if("m4"===p){if(!i._array)i._array=new Float32Array(16);
  190. k.flattenToArray(i._array);e.uniformMatrix4fv(m,!1,i._array)}else if("m4v"===p){if(!i._array)i._array=new Float32Array(16*k.length);for(p=0,t=k.length;p<t;p++)k[p].flattenToArrayOffset(i._array,16*p);e.uniformMatrix4fv(m,!1,i._array)}else if("t"===p){if(e.uniform1i(m,k),m=i.texture)if(m.image instanceof Array&&6===m.image.length){if(i=m,6===i.image.length)if(i.needsUpdate){if(!i.image.__webglTextureCube)i.image.__webglTextureCube=e.createTexture();e.activeTexture(e.TEXTURE0+k);e.bindTexture(e.TEXTURE_CUBE_MAP,
  191. i.image.__webglTextureCube);k=[];for(m=0;6>m;m++){p=k;t=m;if(z.autoScaleCubemaps){if(v=i.image[m],A=vc,!(v.width<=A&&v.height<=A))F=Math.max(v.width,v.height),y=Math.floor(v.width*A/F),A=Math.floor(v.height*A/F),F=document.createElement("canvas"),F.width=y,F.height=A,F.getContext("2d").drawImage(v,0,0,v.width,v.height,0,0,y,A),v=F}else v=i.image[m];p[t]=v}m=k[0];p=0===(m.width&m.width-1)&&0===(m.height&m.height-1);t=J(i.format);v=J(i.type);I(e.TEXTURE_CUBE_MAP,i,p);for(m=0;6>m;m++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+
  192. m,0,t,t,v,k[m]);i.generateMipmaps&&p&&e.generateMipmap(e.TEXTURE_CUBE_MAP);i.needsUpdate=!1;if(i.onUpdated)i.onUpdated()}else e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,i.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(i=m,e.activeTexture(e.TEXTURE0+k),e.bindTexture(e.TEXTURE_CUBE_MAP,i.__webglTexture)):z.setTexture(m,k)}else if("tv"===p){if(!i._array){i._array=[];for(p=0,t=i.texture.length;p<t;p++)i._array[p]=k+p}e.uniform1iv(m,i._array);for(p=0,t=i.texture.length;p<
  193. t;p++)(m=i.texture[p])&&z.setTexture(m,i._array[p])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&null!==h.cameraPosition&&e.uniform3f(h.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&null!==h.viewMatrix&&e.uniformMatrix4fv(h.viewMatrix,!1,a._viewMatrixArray);d.skinning&&(e.uniformMatrix4fv(h.cameraInverseMatrix,!1,a._viewMatrixArray),
  194. e.uniformMatrix4fv(h.boneGlobalMatrices,!1,f.boneMatrices))}e.uniformMatrix4fv(h.modelViewMatrix,!1,f._modelViewMatrixArray);h.normalMatrix&&e.uniformMatrix3fv(h.normalMatrix,!1,f._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||f.receiveShadow)&&null!==h.objectMatrix&&e.uniformMatrix4fv(h.objectMatrix,!1,f._objectMatrixArray);return g}function t(a,b){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);var c=THREE.Matrix4.makeInvert3x3(a._modelViewMatrix);
  195. c&&c.transposeIntoArray(a._normalMatrixArray)}function y(a,b,c){dc!==a&&(a?e.enable(e.POLYGON_OFFSET_FILL):e.disable(e.POLYGON_OFFSET_FILL),dc=a);if(a&&(ec!==b||Lb!==c))e.polygonOffset(b,c),ec=b,Lb=c}function F(a,b){var c;"fragment"===a?c=e.createShader(e.FRAGMENT_SHADER):"vertex"===a&&(c=e.createShader(e.VERTEX_SHADER));e.shaderSource(c,b);e.compileShader(c);return!e.getShaderParameter(c,e.COMPILE_STATUS)?(console.error(e.getShaderInfoLog(c)),console.error(b),null):c}function I(a,b,c){c?(e.texParameteri(a,
  196. e.TEXTURE_WRAP_S,J(b.wrapS)),e.texParameteri(a,e.TEXTURE_WRAP_T,J(b.wrapT)),e.texParameteri(a,e.TEXTURE_MAG_FILTER,J(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,J(b.minFilter))):(e.texParameteri(a,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(a,e.TEXTURE_MAG_FILTER,v(b.magFilter)),e.texParameteri(a,e.TEXTURE_MIN_FILTER,v(b.minFilter)))}function A(a,b){e.bindRenderbuffer(e.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,
  197. e.DEPTH_COMPONENT16,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,b.width,b.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,a)):e.renderbufferStorage(e.RENDERBUFFER,e.RGBA4,b.width,b.height)}function v(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return e.NEAREST;
  198. default:return e.LINEAR}}function J(a){switch(a){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;
  199. 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}
  200. var a=a||{},K=void 0!==a.canvas?a.canvas:document.createElement("canvas"),G=void 0!==a.precision?a.precision:"mediump",M=void 0!==a.antialias?a.antialias:!1,H=void 0!==a.stencil?a.stencil:!0,L=void 0!==a.preserveDrawingBuffer?a.preserveDrawingBuffer:!1,V=void 0!==a.clearColor?new THREE.Color(a.clearColor):new THREE.Color(0),ga=void 0!==a.clearAlpha?a.clearAlpha:0,oa=void 0!==a.maxLights?a.maxLights:4;this.domElement=K;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=
  201. this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMapEnabled=!1;this.shadowMapCullFrontFaces=this.shadowMapSoft=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.autoScaleCubemaps=!0;this.renderPluginsPre=[];this.renderPluginsPost=
  202. [];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0,points:0}};var z=this,e,qa=[],$a=null,$b=null,Ha=-1,Ca=null,Qc=0,Kb=null,Mb=null,ab=null,pb=null,ob=null,dc=null,ec=null,Lb=null,yb=null,qb=0,rb=0,zb=0,sb=0,ac=0,bc=0,Ab=new THREE.Frustum,nb=new THREE.Matrix4,Va=new THREE.Vector4,cc={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}};e=function(){var a;try{if(!(a=K.getContext("experimental-webgl",
  203. {antialias:M,stencil:H,preserveDrawingBuffer:L})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();e.clearColor(0,0,0,1);e.clearDepth(1);e.clearStencil(0);e.enable(e.DEPTH_TEST);e.depthFunc(e.LEQUAL);e.frontFace(e.CCW);e.cullFace(e.BACK);e.enable(e.CULL_FACE);e.enable(e.BLEND);e.blendEquation(e.FUNC_ADD);
  204. e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);e.clearColor(V.r,V.g,V.b,ga);this.context=e;var Nb=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);e.getParameter(e.TEXTURE_SIZE);var vc=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE);this.getContext=function(){return e};this.supportsVertexTextures=function(){return 0<Nb};this.setSize=function(a,b){K.width=a;K.height=b;this.setViewport(0,0,K.width,K.height)};this.setViewport=function(a,b,c,d){qb=a;rb=b;zb=c;sb=d;e.viewport(qb,rb,zb,sb)};this.setScissor=
  205. function(a,b,c,d){e.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST)};this.setClearColorHex=function(a,b){V.setHex(a);ga=b;e.clearColor(V.r,V.g,V.b,ga)};this.setClearColor=function(a,b){V.copy(a);ga=b;e.clearColor(V.r,V.g,V.b,ga)};this.getClearColor=function(){return V};this.getClearAlpha=function(){return ga};this.clear=function(a,b,c){var d=0;if(void 0===a||a)d|=e.COLOR_BUFFER_BIT;if(void 0===b||b)d|=e.DEPTH_BUFFER_BIT;if(void 0===c||c)d|=
  206. e.STENCIL_BUFFER_BIT;e.clear(d)};this.clearTarget=function(a,b,c,d){this.setRenderTarget(a);this.clear(b,c,d)};this.addPostPlugin=function(a){a.init(this);this.renderPluginsPost.push(a)};this.addPrePlugin=function(a){a.init(this);this.renderPluginsPre.push(a)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=
  207. a.geometry.geometryGroups[b];e.deleteBuffer(c.__webglVertexBuffer);e.deleteBuffer(c.__webglNormalBuffer);e.deleteBuffer(c.__webglTangentBuffer);e.deleteBuffer(c.__webglColorBuffer);e.deleteBuffer(c.__webglUVBuffer);e.deleteBuffer(c.__webglUV2Buffer);e.deleteBuffer(c.__webglSkinVertexABuffer);e.deleteBuffer(c.__webglSkinVertexBBuffer);e.deleteBuffer(c.__webglSkinIndicesBuffer);e.deleteBuffer(c.__webglSkinWeightsBuffer);e.deleteBuffer(c.__webglFaceBuffer);e.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=
  208. 0,f=c.numMorphTargets;d<f;d++)e.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)e.deleteBuffer(c.__webglCustomAttributesList[d].buffer);z.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),z.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),
  209. z.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,e.deleteBuffer(a.__webglVertexBuffer),e.deleteBuffer(a.__webglColorBuffer),z.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,e.deleteTexture(a.__webglTexture),z.info.memory.textures--};this.updateShadowMap=function(a,b){$a=null;Ha=Ca=ob=pb=ab=-1;this.shadowMapPlugin.update(a,b)};this.renderBufferImmediate=function(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=e.createBuffer();
  210. if(!a.__webglNormalBuffer)a.__webglNormalBuffer=e.createBuffer();a.hasPos&&(e.bindBuffer(e.ARRAY_BUFFER,a.__webglVertexBuffer),e.bufferData(e.ARRAY_BUFFER,a.positionArray,e.DYNAMIC_DRAW),e.enableVertexAttribArray(b.attributes.position),e.vertexAttribPointer(b.attributes.position,3,e.FLOAT,!1,0,0));if(a.hasNormal){e.bindBuffer(e.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,f,g,h,i,j,l,k,n,m,p=3*a.count;for(m=0;m<p;m+=9)c=a.normalArray,d=c[m],f=c[m+1],g=c[m+2],h=c[m+3],j=c[m+
  211. 4],k=c[m+5],i=c[m+6],l=c[m+7],n=c[m+8],d=(d+h+i)/3,f=(f+j+l)/3,g=(g+k+n)/3,c[m]=d,c[m+1]=f,c[m+2]=g,c[m+3]=d,c[m+4]=f,c[m+5]=g,c[m+6]=d,c[m+7]=f,c[m+8]=g}e.bufferData(e.ARRAY_BUFFER,a.normalArray,e.DYNAMIC_DRAW);e.enableVertexAttribArray(b.attributes.normal);e.vertexAttribPointer(b.attributes.normal,3,e.FLOAT,!1,0,0)}e.drawArrays(e.TRIANGLES,0,a.count);a.count=0};this.renderBufferDirect=function(a,b,c,d,f,g){if(0!==d.opacity&&(c=r(a,b,c,d,g),a=c.attributes,b=!1,d=16777215*f.id+2*c.id+(d.wireframe?
  212. 1:0),d!==Ca&&(Ca=d,b=!0),g instanceof THREE.Mesh)){g=f.offsets;d=0;for(c=g.length;d<c;++d)b&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexPositionBuffer),e.vertexAttribPointer(a.position,f.vertexPositionBuffer.itemSize,e.FLOAT,!1,0,12*g[d].index),0<=a.normal&&f.vertexNormalBuffer&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexNormalBuffer),e.vertexAttribPointer(a.normal,f.vertexNormalBuffer.itemSize,e.FLOAT,!1,0,12*g[d].index)),0<=a.uv&&f.vertexUvBuffer&&(f.vertexUvBuffer?(e.bindBuffer(e.ARRAY_BUFFER,f.vertexUvBuffer),
  213. e.vertexAttribPointer(a.uv,f.vertexUvBuffer.itemSize,e.FLOAT,!1,0,8*g[d].index),e.enableVertexAttribArray(a.uv)):e.disableVertexAttribArray(a.uv)),0<=a.color&&f.vertexColorBuffer&&(e.bindBuffer(e.ARRAY_BUFFER,f.vertexColorBuffer),e.vertexAttribPointer(a.color,f.vertexColorBuffer.itemSize,e.FLOAT,!1,0,16*g[d].index)),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.vertexIndexBuffer)),e.drawElements(e.TRIANGLES,g[d].count,e.UNSIGNED_SHORT,2*g[d].start),z.info.render.calls++,z.info.render.vertices+=g[d].count,
  214. z.info.render.faces+=g[d].count/3}};this.renderBuffer=function(a,b,c,d,f,g){if(0!==d.opacity){var h,i,c=r(a,b,c,d,g),b=c.attributes,a=!1,c=16777215*f.id+2*c.id+(d.wireframe?1:0);c!==Ca&&(Ca=c,a=!0);if(!d.morphTargets&&0<=b.position)a&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(b.position,3,e.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;-1!==g.morphTargetBase?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[g.morphTargetBase]),e.vertexAttribPointer(c.position,
  215. 3,e.FLOAT,!1,0,0)):0<=c.position&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglVertexBuffer),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){h=0;var j=g.morphTargetForcedOrder;for(i=g.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<j.length;)e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[j[h]]),e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[h]=i[j[h]],h++}else{var j=[],l=-1,k=0;i=g.morphTargetInfluences;var n,
  216. m=i.length;h=0;for(-1!==g.morphTargetBase&&(j[g.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(n=0;n<m;n++)!j[n]&&i[n]>l&&(k=n,l=i[k]);e.bindBuffer(e.ARRAY_BUFFER,f.__webglMorphTargetsBuffers[k]);e.vertexAttribPointer(c["morphTarget"+h],3,e.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[h]=l;j[k]=1;l=-1;h++}}null!==d.program.uniforms.morphTargetInfluences&&e.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(f.__webglCustomAttributesList)for(h=0,i=
  217. f.__webglCustomAttributesList.length;h<i;h++)c=f.__webglCustomAttributesList[h],0<=b[c.buffer.belongsToAttribute]&&(e.bindBuffer(e.ARRAY_BUFFER,c.buffer),e.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,e.FLOAT,!1,0,0));0<=b.color&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglColorBuffer),e.vertexAttribPointer(b.color,3,e.FLOAT,!1,0,0));0<=b.normal&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglNormalBuffer),e.vertexAttribPointer(b.normal,3,e.FLOAT,!1,0,0));0<=b.tangent&&(e.bindBuffer(e.ARRAY_BUFFER,
  218. f.__webglTangentBuffer),e.vertexAttribPointer(b.tangent,4,e.FLOAT,!1,0,0));0<=b.uv&&(f.__webglUVBuffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUVBuffer),e.vertexAttribPointer(b.uv,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv)):e.disableVertexAttribArray(b.uv));0<=b.uv2&&(f.__webglUV2Buffer?(e.bindBuffer(e.ARRAY_BUFFER,f.__webglUV2Buffer),e.vertexAttribPointer(b.uv2,2,e.FLOAT,!1,0,0),e.enableVertexAttribArray(b.uv2)):e.disableVertexAttribArray(b.uv2));d.skinning&&0<=b.skinVertexA&&0<=b.skinVertexB&&
  219. 0<=b.skinIndex&&0<=b.skinWeight&&(e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexABuffer),e.vertexAttribPointer(b.skinVertexA,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinVertexBBuffer),e.vertexAttribPointer(b.skinVertexB,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinIndicesBuffer),e.vertexAttribPointer(b.skinIndex,4,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,f.__webglSkinWeightsBuffer),e.vertexAttribPointer(b.skinWeight,4,e.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?
  220. (d=d.wireframeLinewidth,d!==yb&&(e.lineWidth(d),yb=d),a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglLineBuffer),e.drawElements(e.LINES,f.__webglLineCount,e.UNSIGNED_SHORT,0)):(a&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,f.__webglFaceBuffer),e.drawElements(e.TRIANGLES,f.__webglFaceCount,e.UNSIGNED_SHORT,0)),z.info.render.calls++,z.info.render.vertices+=f.__webglFaceCount,z.info.render.faces+=f.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?e.LINE_STRIP:e.LINES,d=d.linewidth,d!==
  221. yb&&(e.lineWidth(d),yb=d),e.drawArrays(g,0,f.__webglLineCount),z.info.render.calls++):g instanceof THREE.ParticleSystem?(e.drawArrays(e.POINTS,0,f.__webglParticleCount),z.info.render.calls++,z.info.render.points+=f.__webglParticleCount):g instanceof THREE.Ribbon&&(e.drawArrays(e.TRIANGLE_STRIP,0,f.__webglVertexCount),z.info.render.calls++)}};this.render=function(a,b,c,d){var f,g,j,n,m=a.lights,p=a.fog;Ha=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);void 0===b.parent&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
  222. a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();i(this.renderPluginsPre,a,b);z.info.render.calls=0;z.info.render.vertices=0;z.info.render.faces=0;z.info.render.points=0;b.matrixWorldInverse.getInverse(b.matrixWorld);if(!b._viewMatrixArray)b._viewMatrixArray=new Float32Array(16);b.matrixWorldInverse.flattenToArray(b._viewMatrixArray);if(!b._projectionMatrixArray)b._projectionMatrixArray=new Float32Array(16);b.projectionMatrix.flattenToArray(b._projectionMatrixArray);nb.multiply(b.projectionMatrix,
  223. b.matrixWorldInverse);Ab.setFromMatrix(nb);this.setRenderTarget(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;for(d=0,f=n.length;d<f;d++)if(g=n[d],j=g.object,g.render=!1,j.visible&&(!(j instanceof THREE.Mesh||j instanceof THREE.ParticleSystem)||!j.frustumCulled||Ab.contains(j))){j.matrixWorld.flattenToArray(j._objectMatrixArray);t(j,b);var o=g,r=o.object,v=o.buffer,A=void 0,A=A=void 0,A=r.material;if(A instanceof THREE.MeshFaceMaterial){if(A=
  224. v.materialIndex,0<=A)A=r.geometry.materials[A],A.transparent?(o.transparent=A,o.opaque=null):(o.opaque=A,o.transparent=null)}else if(A)A.transparent?(o.transparent=A,o.opaque=null):(o.opaque=A,o.transparent=null);g.render=!0;if(this.sortObjects)j.renderDepth?g.z=j.renderDepth:(Va.copy(j.position),nb.multiplyVector3(Va),g.z=Va.z)}this.sortObjects&&n.sort(h);n=a.__webglObjectsImmediate;for(d=0,f=n.length;d<f;d++)if(g=n[d],j=g.object,j.visible)j.matrixAutoUpdate&&j.matrixWorld.flattenToArray(j._objectMatrixArray),
  225. t(j,b),j=g.object.material,j.transparent?(g.transparent=j,g.opaque=null):(g.opaque=j,g.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),this.setDepthTest(a.overrideMaterial.depthTest),this.setDepthWrite(a.overrideMaterial.depthWrite),y(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,m,p,!0,a.overrideMaterial),l(a.__webglObjectsImmediate,"",b,m,p,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),
  226. k(a.__webglObjects,!0,"opaque",b,m,p,!1),l(a.__webglObjectsImmediate,"opaque",b,m,p,!1),k(a.__webglObjects,!1,"transparent",b,m,p,!0),l(a.__webglObjectsImmediate,"transparent",b,m,p,!0));i(this.renderPluginsPost,a,b);c&&c.generateMipmaps&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(e.bindTexture(e.TEXTURE_CUBE_MAP,c.__webglTexture),e.generateMipmap(e.TEXTURE_CUBE_MAP),e.bindTexture(e.TEXTURE_CUBE_MAP,null)):(e.bindTexture(e.TEXTURE_2D,
  227. c.__webglTexture),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)));this.setDepthTest(!0);this.setDepthWrite(!0)};this.renderImmediateObject=function(a,b,c,d,f){var g=r(a,b,c,d,f);Ca=-1;z.setObjectFaces(f);f.immediateRenderCallback?f.immediateRenderCallback(g,e,Ab):f.render(function(a){z.renderBufferImmediate(a,g,d.shading)})};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=
  228. a.__objectsAdded[0],i=a,l=void 0,k=void 0,r=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){if(k=h.geometry,k instanceof THREE.Geometry){if(void 0===k.geometryGroups){var t=k,v=void 0,y=void 0,A=void 0,I=void 0,F=void 0,G=void 0,J=void 0,K={},M=t.morphTargets.length;
  229. t.geometryGroups={};for(v=0,y=t.faces.length;v<y;v++)A=t.faces[v],I=A.materialIndex,G=void 0!==I?I:-1,void 0===K[G]&&(K[G]={hash:G,counter:0}),J=K[G].hash+"_"+K[G].counter,void 0===t.geometryGroups[J]&&(t.geometryGroups[J]={faces3:[],faces4:[],materialIndex:I,vertices:0,numMorphTargets:M}),F=A instanceof THREE.Face3?3:4,65535<t.geometryGroups[J].vertices+F&&(K[G].counter+=1,J=K[G].hash+"_"+K[G].counter,void 0===t.geometryGroups[J]&&(t.geometryGroups[J]={faces3:[],faces4:[],materialIndex:I,vertices:0,
  230. numMorphTargets:M})),A instanceof THREE.Face3?t.geometryGroups[J].faces3.push(v):t.geometryGroups[J].faces4.push(v),t.geometryGroups[J].vertices+=F;t.geometryGroupsList=[];var L=void 0;for(L in t.geometryGroups)t.geometryGroups[L].id=Qc++,t.geometryGroupsList.push(t.geometryGroups[L])}for(l in k.geometryGroups)if(r=k.geometryGroups[l],!r.__webglVertexBuffer){var H=r;H.__webglVertexBuffer=e.createBuffer();H.__webglNormalBuffer=e.createBuffer();H.__webglTangentBuffer=e.createBuffer();H.__webglColorBuffer=
  231. e.createBuffer();H.__webglUVBuffer=e.createBuffer();H.__webglUV2Buffer=e.createBuffer();H.__webglSkinVertexABuffer=e.createBuffer();H.__webglSkinVertexBBuffer=e.createBuffer();H.__webglSkinIndicesBuffer=e.createBuffer();H.__webglSkinWeightsBuffer=e.createBuffer();H.__webglFaceBuffer=e.createBuffer();H.__webglLineBuffer=e.createBuffer();if(H.numMorphTargets){var V=void 0,ga=void 0;H.__webglMorphTargetsBuffers=[];for(V=0,ga=H.numMorphTargets;V<ga;V++)H.__webglMorphTargetsBuffers.push(e.createBuffer())}z.info.memory.geometries++;
  232. var ha=r,oa=h,qa=oa.geometry,Ca=ha.faces3,Ha=ha.faces4,Da=3*Ca.length+4*Ha.length,Va=1*Ca.length+2*Ha.length,$a=3*Ca.length+4*Ha.length,tb=c(oa,ha),nb=g(tb),ob=d(tb),pb=tb.vertexColors?tb.vertexColors:!1;ha.__vertexArray=new Float32Array(3*Da);if(ob)ha.__normalArray=new Float32Array(3*Da);if(qa.hasTangents)ha.__tangentArray=new Float32Array(4*Da);if(pb)ha.__colorArray=new Float32Array(3*Da);if(nb){if(0<qa.faceUvs.length||0<qa.faceVertexUvs.length)ha.__uvArray=new Float32Array(2*Da);if(1<qa.faceUvs.length||
  233. 1<qa.faceVertexUvs.length)ha.__uv2Array=new Float32Array(2*Da)}if(oa.geometry.skinWeights.length&&oa.geometry.skinIndices.length)ha.__skinVertexAArray=new Float32Array(4*Da),ha.__skinVertexBArray=new Float32Array(4*Da),ha.__skinIndexArray=new Float32Array(4*Da),ha.__skinWeightArray=new Float32Array(4*Da);ha.__faceArray=new Uint16Array(3*Va);ha.__lineArray=new Uint16Array(2*$a);if(ha.numMorphTargets){ha.__morphTargetsArrays=[];for(var ab=0,yb=ha.numMorphTargets;ab<yb;ab++)ha.__morphTargetsArrays.push(new Float32Array(3*
  234. Da))}ha.__webglFaceCount=3*Va;ha.__webglLineCount=2*$a;if(tb.attributes){if(void 0===ha.__webglCustomAttributesList)ha.__webglCustomAttributesList=[];var qb=void 0;for(qb in tb.attributes){var fc=tb.attributes[qb],wa={},rb;for(rb in fc)wa[rb]=fc[rb];if(!wa.__webglInitialized||wa.createUniqueBuffers){wa.__webglInitialized=!0;var Bb=1;"v2"===wa.type?Bb=2:"v3"===wa.type?Bb=3:"v4"===wa.type?Bb=4:"c"===wa.type&&(Bb=3);wa.size=Bb;wa.array=new Float32Array(Da*Bb);wa.buffer=e.createBuffer();wa.buffer.belongsToAttribute=
  235. qb;fc.needsUpdate=!0;wa.__original=fc}ha.__webglCustomAttributesList.push(wa)}}ha.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}}else if(h instanceof THREE.Ribbon){if(k=h.geometry,!k.__webglVertexBuffer){var zb=k;zb.__webglVertexBuffer=e.createBuffer();zb.__webglColorBuffer=e.createBuffer();z.info.memory.geometries++;var gc=k,sb=gc.vertices.length;gc.__vertexArray=new Float32Array(3*
  236. sb);gc.__colorArray=new Float32Array(3*sb);gc.__webglVertexCount=sb;k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof THREE.Line){if(k=h.geometry,!k.__webglVertexBuffer){var Ab=k;Ab.__webglVertexBuffer=e.createBuffer();Ab.__webglColorBuffer=e.createBuffer();z.info.memory.geometries++;var Ob=k,$b=h,wc=Ob.vertices.length;Ob.__vertexArray=new Float32Array(3*wc);Ob.__colorArray=new Float32Array(3*wc);Ob.__webglLineCount=wc;b(Ob,$b);k.__dirtyVertices=!0;k.__dirtyColors=!0}}else if(h instanceof
  237. THREE.ParticleSystem&&(k=h.geometry,!k.__webglVertexBuffer)){var Kb=k;Kb.__webglVertexBuffer=e.createBuffer();Kb.__webglColorBuffer=e.createBuffer();z.info.geometries++;var Cb=k,ac=h,xc=Cb.vertices.length;Cb.__vertexArray=new Float32Array(3*xc);Cb.__colorArray=new Float32Array(3*xc);Cb.__sortArray=[];Cb.__webglParticleCount=xc;b(Cb,ac);k.__dirtyVertices=!0;k.__dirtyColors=!0}if(!h.__webglActive){if(h instanceof THREE.Mesh)if(k=h.geometry,k instanceof THREE.BufferGeometry)j(i.__webglObjects,k,h);else for(l in k.geometryGroups)r=
  238. k.geometryGroups[l],j(i.__webglObjects,r,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(k=h.geometry,j(i.__webglObjects,k,h)):void 0!==THREE.MarchingCubes&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){var za=
  239. a.__objectsRemoved[0],hc=a;za instanceof THREE.Mesh||za instanceof THREE.ParticleSystem||za instanceof THREE.Ribbon||za instanceof THREE.Line?o(hc.__webglObjects,za):za instanceof THREE.Sprite?p(hc.__webglSprites,za):za instanceof THREE.LensFlare?p(hc.__webglFlares,za):(za instanceof THREE.MarchingCubes||za.immediateRenderCallback)&&o(hc.__webglObjectsImmediate,za);za.__webglActive=!1;a.__objectsRemoved.splice(0,1)}for(var yc=0,bc=a.__webglObjects.length;yc<bc;yc++){var Fa=a.__webglObjects[yc].object,
  240. P=Fa.geometry,Pb=void 0,Db=void 0,sa=void 0;if(Fa instanceof THREE.Mesh)if(P instanceof THREE.BufferGeometry)P.__dirtyVertices=!1,P.__dirtyElements=!1,P.__dirtyUvs=!1,P.__dirtyNormals=!1,P.__dirtyColors=!1;else{for(var zc=0,cc=P.geometryGroupsList.length;zc<cc;zc++)if(Pb=P.geometryGroupsList[zc],sa=c(Fa,Pb),Db=sa.attributes&&n(sa),P.__dirtyVertices||P.__dirtyMorphTargets||P.__dirtyElements||P.__dirtyUvs||P.__dirtyNormals||P.__dirtyColors||P.__dirtyTangents||Db){var N=Pb,dc=Fa,xa=e.DYNAMIC_DRAW,ec=
  241. !P.dynamic,ic=sa;if(N.__inittedArrays){var Lb=d(ic),Ac=ic.vertexColors?ic.vertexColors:!1,Mb=g(ic),Nb=Lb===THREE.SmoothShading,u=void 0,B=void 0,Ea=void 0,x=void 0,Eb=void 0,bb=void 0,Ga=void 0,jc=void 0,Wa=void 0,Fb=void 0,Gb=void 0,C=void 0,D=void 0,E=void 0,T=void 0,Ia=void 0,Ja=void 0,Ka=void 0,Qb=void 0,La=void 0,Ma=void 0,Na=void 0,Rb=void 0,Oa=void 0,Pa=void 0,Qa=void 0,Sb=void 0,Ra=void 0,Sa=void 0,Ta=void 0,Tb=void 0,cb=void 0,db=void 0,eb=void 0,kc=void 0,fb=void 0,gb=void 0,hb=void 0,lc=
  242. void 0,Q=void 0,Hc=void 0,ib=void 0,Hb=void 0,Ib=void 0,ya=void 0,Ic=void 0,ja=void 0,ca=0,ia=0,Xa=0,Ya=0,Aa=0,na=0,U=0,pa=0,da=0,w=0,ea=0,s=0,ua=void 0,ka=N.__vertexArray,Ub=N.__uvArray,Vb=N.__uv2Array,Ba=N.__normalArray,X=N.__tangentArray,la=N.__colorArray,Y=N.__skinVertexAArray,Z=N.__skinVertexBArray,$=N.__skinIndexArray,aa=N.__skinWeightArray,Bc=N.__morphTargetsArrays,Cc=N.__webglCustomAttributesList,q=void 0,Ua=N.__faceArray,va=N.__lineArray,ra=dc.geometry,vc=ra.__dirtyElements,Jc=ra.__dirtyUvs,
  243. Rc=ra.__dirtyNormals,Sc=ra.__dirtyTangents,Tc=ra.__dirtyColors,Uc=ra.__dirtyMorphTargets,ub=ra.vertices,R=N.faces3,S=N.faces4,fa=ra.faces,Dc=ra.faceVertexUvs[0],Ec=ra.faceVertexUvs[1],vb=ra.skinVerticesA,wb=ra.skinVerticesB,xb=ra.skinIndices,jb=ra.skinWeights,kb=ra.morphTargets;if(ra.__dirtyVertices){for(u=0,B=R.length;u<B;u++)x=fa[R[u]],C=ub[x.a].position,D=ub[x.b].position,E=ub[x.c].position,ka[ia]=C.x,ka[ia+1]=C.y,ka[ia+2]=C.z,ka[ia+3]=D.x,ka[ia+4]=D.y,ka[ia+5]=D.z,ka[ia+6]=E.x,ka[ia+7]=E.y,ka[ia+
  244. 8]=E.z,ia+=9;for(u=0,B=S.length;u<B;u++)x=fa[S[u]],C=ub[x.a].position,D=ub[x.b].position,E=ub[x.c].position,T=ub[x.d].position,ka[ia]=C.x,ka[ia+1]=C.y,ka[ia+2]=C.z,ka[ia+3]=D.x,ka[ia+4]=D.y,ka[ia+5]=D.z,ka[ia+6]=E.x,ka[ia+7]=E.y,ka[ia+8]=E.z,ka[ia+9]=T.x,ka[ia+10]=T.y,ka[ia+11]=T.z,ia+=12;e.bindBuffer(e.ARRAY_BUFFER,N.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,ka,xa)}if(Uc)for(ya=0,Ic=kb.length;ya<Ic;ya++){ea=0;for(u=0,B=R.length;u<B;u++)x=fa[R[u]],C=kb[ya].vertices[x.a].position,D=kb[ya].vertices[x.b].position,
  245. E=kb[ya].vertices[x.c].position,ja=Bc[ya],ja[ea]=C.x,ja[ea+1]=C.y,ja[ea+2]=C.z,ja[ea+3]=D.x,ja[ea+4]=D.y,ja[ea+5]=D.z,ja[ea+6]=E.x,ja[ea+7]=E.y,ja[ea+8]=E.z,ea+=9;for(u=0,B=S.length;u<B;u++)x=fa[S[u]],C=kb[ya].vertices[x.a].position,D=kb[ya].vertices[x.b].position,E=kb[ya].vertices[x.c].position,T=kb[ya].vertices[x.d].position,ja=Bc[ya],ja[ea]=C.x,ja[ea+1]=C.y,ja[ea+2]=C.z,ja[ea+3]=D.x,ja[ea+4]=D.y,ja[ea+5]=D.z,ja[ea+6]=E.x,ja[ea+7]=E.y,ja[ea+8]=E.z,ja[ea+9]=T.x,ja[ea+10]=T.y,ja[ea+11]=T.z,ea+=12;
  246. e.bindBuffer(e.ARRAY_BUFFER,N.__webglMorphTargetsBuffers[ya]);e.bufferData(e.ARRAY_BUFFER,Bc[ya],xa)}if(jb.length){for(u=0,B=R.length;u<B;u++)x=fa[R[u]],Oa=jb[x.a],Pa=jb[x.b],Qa=jb[x.c],aa[w]=Oa.x,aa[w+1]=Oa.y,aa[w+2]=Oa.z,aa[w+3]=Oa.w,aa[w+4]=Pa.x,aa[w+5]=Pa.y,aa[w+6]=Pa.z,aa[w+7]=Pa.w,aa[w+8]=Qa.x,aa[w+9]=Qa.y,aa[w+10]=Qa.z,aa[w+11]=Qa.w,Ra=xb[x.a],Sa=xb[x.b],Ta=xb[x.c],$[w]=Ra.x,$[w+1]=Ra.y,$[w+2]=Ra.z,$[w+3]=Ra.w,$[w+4]=Sa.x,$[w+5]=Sa.y,$[w+6]=Sa.z,$[w+7]=Sa.w,$[w+8]=Ta.x,$[w+9]=Ta.y,$[w+10]=
  247. Ta.z,$[w+11]=Ta.w,cb=vb[x.a],db=vb[x.b],eb=vb[x.c],Y[w]=cb.x,Y[w+1]=cb.y,Y[w+2]=cb.z,Y[w+3]=1,Y[w+4]=db.x,Y[w+5]=db.y,Y[w+6]=db.z,Y[w+7]=1,Y[w+8]=eb.x,Y[w+9]=eb.y,Y[w+10]=eb.z,Y[w+11]=1,fb=wb[x.a],gb=wb[x.b],hb=wb[x.c],Z[w]=fb.x,Z[w+1]=fb.y,Z[w+2]=fb.z,Z[w+3]=1,Z[w+4]=gb.x,Z[w+5]=gb.y,Z[w+6]=gb.z,Z[w+7]=1,Z[w+8]=hb.x,Z[w+9]=hb.y,Z[w+10]=hb.z,Z[w+11]=1,w+=12;for(u=0,B=S.length;u<B;u++)x=fa[S[u]],Oa=jb[x.a],Pa=jb[x.b],Qa=jb[x.c],Sb=jb[x.d],aa[w]=Oa.x,aa[w+1]=Oa.y,aa[w+2]=Oa.z,aa[w+3]=Oa.w,aa[w+4]=Pa.x,
  248. aa[w+5]=Pa.y,aa[w+6]=Pa.z,aa[w+7]=Pa.w,aa[w+8]=Qa.x,aa[w+9]=Qa.y,aa[w+10]=Qa.z,aa[w+11]=Qa.w,aa[w+12]=Sb.x,aa[w+13]=Sb.y,aa[w+14]=Sb.z,aa[w+15]=Sb.w,Ra=xb[x.a],Sa=xb[x.b],Ta=xb[x.c],Tb=xb[x.d],$[w]=Ra.x,$[w+1]=Ra.y,$[w+2]=Ra.z,$[w+3]=Ra.w,$[w+4]=Sa.x,$[w+5]=Sa.y,$[w+6]=Sa.z,$[w+7]=Sa.w,$[w+8]=Ta.x,$[w+9]=Ta.y,$[w+10]=Ta.z,$[w+11]=Ta.w,$[w+12]=Tb.x,$[w+13]=Tb.y,$[w+14]=Tb.z,$[w+15]=Tb.w,cb=vb[x.a],db=vb[x.b],eb=vb[x.c],kc=vb[x.d],Y[w]=cb.x,Y[w+1]=cb.y,Y[w+2]=cb.z,Y[w+3]=1,Y[w+4]=db.x,Y[w+5]=db.y,Y[w+
  249. 6]=db.z,Y[w+7]=1,Y[w+8]=eb.x,Y[w+9]=eb.y,Y[w+10]=eb.z,Y[w+11]=1,Y[w+12]=kc.x,Y[w+13]=kc.y,Y[w+14]=kc.z,Y[w+15]=1,fb=wb[x.a],gb=wb[x.b],hb=wb[x.c],lc=wb[x.d],Z[w]=fb.x,Z[w+1]=fb.y,Z[w+2]=fb.z,Z[w+3]=1,Z[w+4]=gb.x,Z[w+5]=gb.y,Z[w+6]=gb.z,Z[w+7]=1,Z[w+8]=hb.x,Z[w+9]=hb.y,Z[w+10]=hb.z,Z[w+11]=1,Z[w+12]=lc.x,Z[w+13]=lc.y,Z[w+14]=lc.z,Z[w+15]=1,w+=16;0<w&&(e.bindBuffer(e.ARRAY_BUFFER,N.__webglSkinVertexABuffer),e.bufferData(e.ARRAY_BUFFER,Y,xa),e.bindBuffer(e.ARRAY_BUFFER,N.__webglSkinVertexBBuffer),e.bufferData(e.ARRAY_BUFFER,
  250. Z,xa),e.bindBuffer(e.ARRAY_BUFFER,N.__webglSkinIndicesBuffer),e.bufferData(e.ARRAY_BUFFER,$,xa),e.bindBuffer(e.ARRAY_BUFFER,N.__webglSkinWeightsBuffer),e.bufferData(e.ARRAY_BUFFER,aa,xa))}if(Tc&&Ac){for(u=0,B=R.length;u<B;u++)x=fa[R[u]],Ga=x.vertexColors,jc=x.color,3===Ga.length&&Ac===THREE.VertexColors?(La=Ga[0],Ma=Ga[1],Na=Ga[2]):Na=Ma=La=jc,la[da]=La.r,la[da+1]=La.g,la[da+2]=La.b,la[da+3]=Ma.r,la[da+4]=Ma.g,la[da+5]=Ma.b,la[da+6]=Na.r,la[da+7]=Na.g,la[da+8]=Na.b,da+=9;for(u=0,B=S.length;u<B;u++)x=
  251. fa[S[u]],Ga=x.vertexColors,jc=x.color,4===Ga.length&&Ac===THREE.VertexColors?(La=Ga[0],Ma=Ga[1],Na=Ga[2],Rb=Ga[3]):Rb=Na=Ma=La=jc,la[da]=La.r,la[da+1]=La.g,la[da+2]=La.b,la[da+3]=Ma.r,la[da+4]=Ma.g,la[da+5]=Ma.b,la[da+6]=Na.r,la[da+7]=Na.g,la[da+8]=Na.b,la[da+9]=Rb.r,la[da+10]=Rb.g,la[da+11]=Rb.b,da+=12;0<da&&(e.bindBuffer(e.ARRAY_BUFFER,N.__webglColorBuffer),e.bufferData(e.ARRAY_BUFFER,la,xa))}if(Sc&&ra.hasTangents){for(u=0,B=R.length;u<B;u++)x=fa[R[u]],Wa=x.vertexTangents,Ia=Wa[0],Ja=Wa[1],Ka=Wa[2],
  252. X[U]=Ia.x,X[U+1]=Ia.y,X[U+2]=Ia.z,X[U+3]=Ia.w,X[U+4]=Ja.x,X[U+5]=Ja.y,X[U+6]=Ja.z,X[U+7]=Ja.w,X[U+8]=Ka.x,X[U+9]=Ka.y,X[U+10]=Ka.z,X[U+11]=Ka.w,U+=12;for(u=0,B=S.length;u<B;u++)x=fa[S[u]],Wa=x.vertexTangents,Ia=Wa[0],Ja=Wa[1],Ka=Wa[2],Qb=Wa[3],X[U]=Ia.x,X[U+1]=Ia.y,X[U+2]=Ia.z,X[U+3]=Ia.w,X[U+4]=Ja.x,X[U+5]=Ja.y,X[U+6]=Ja.z,X[U+7]=Ja.w,X[U+8]=Ka.x,X[U+9]=Ka.y,X[U+10]=Ka.z,X[U+11]=Ka.w,X[U+12]=Qb.x,X[U+13]=Qb.y,X[U+14]=Qb.z,X[U+15]=Qb.w,U+=16;e.bindBuffer(e.ARRAY_BUFFER,N.__webglTangentBuffer);e.bufferData(e.ARRAY_BUFFER,
  253. X,xa)}if(Rc&&Lb){for(u=0,B=R.length;u<B;u++)if(x=fa[R[u]],Eb=x.vertexNormals,bb=x.normal,3===Eb.length&&Nb)for(Q=0;3>Q;Q++)ib=Eb[Q],Ba[na]=ib.x,Ba[na+1]=ib.y,Ba[na+2]=ib.z,na+=3;else for(Q=0;3>Q;Q++)Ba[na]=bb.x,Ba[na+1]=bb.y,Ba[na+2]=bb.z,na+=3;for(u=0,B=S.length;u<B;u++)if(x=fa[S[u]],Eb=x.vertexNormals,bb=x.normal,4===Eb.length&&Nb)for(Q=0;4>Q;Q++)ib=Eb[Q],Ba[na]=ib.x,Ba[na+1]=ib.y,Ba[na+2]=ib.z,na+=3;else for(Q=0;4>Q;Q++)Ba[na]=bb.x,Ba[na+1]=bb.y,Ba[na+2]=bb.z,na+=3;e.bindBuffer(e.ARRAY_BUFFER,
  254. N.__webglNormalBuffer);e.bufferData(e.ARRAY_BUFFER,Ba,xa)}if(Jc&&Dc&&Mb){for(u=0,B=R.length;u<B;u++)if(Ea=R[u],x=fa[Ea],Fb=Dc[Ea],void 0!==Fb)for(Q=0;3>Q;Q++)Hb=Fb[Q],Ub[Xa]=Hb.u,Ub[Xa+1]=Hb.v,Xa+=2;for(u=0,B=S.length;u<B;u++)if(Ea=S[u],x=fa[Ea],Fb=Dc[Ea],void 0!==Fb)for(Q=0;4>Q;Q++)Hb=Fb[Q],Ub[Xa]=Hb.u,Ub[Xa+1]=Hb.v,Xa+=2;0<Xa&&(e.bindBuffer(e.ARRAY_BUFFER,N.__webglUVBuffer),e.bufferData(e.ARRAY_BUFFER,Ub,xa))}if(Jc&&Ec&&Mb){for(u=0,B=R.length;u<B;u++)if(Ea=R[u],x=fa[Ea],Gb=Ec[Ea],void 0!==Gb)for(Q=
  255. 0;3>Q;Q++)Ib=Gb[Q],Vb[Ya]=Ib.u,Vb[Ya+1]=Ib.v,Ya+=2;for(u=0,B=S.length;u<B;u++)if(Ea=S[u],x=fa[Ea],Gb=Ec[Ea],void 0!==Gb)for(Q=0;4>Q;Q++)Ib=Gb[Q],Vb[Ya]=Ib.u,Vb[Ya+1]=Ib.v,Ya+=2;0<Ya&&(e.bindBuffer(e.ARRAY_BUFFER,N.__webglUV2Buffer),e.bufferData(e.ARRAY_BUFFER,Vb,xa))}if(vc){for(u=0,B=R.length;u<B;u++)x=fa[R[u]],Ua[Aa]=ca,Ua[Aa+1]=ca+1,Ua[Aa+2]=ca+2,Aa+=3,va[pa]=ca,va[pa+1]=ca+1,va[pa+2]=ca,va[pa+3]=ca+2,va[pa+4]=ca+1,va[pa+5]=ca+2,pa+=6,ca+=3;for(u=0,B=S.length;u<B;u++)x=fa[S[u]],Ua[Aa]=ca,Ua[Aa+
  256. 1]=ca+1,Ua[Aa+2]=ca+3,Ua[Aa+3]=ca+1,Ua[Aa+4]=ca+2,Ua[Aa+5]=ca+3,Aa+=6,va[pa]=ca,va[pa+1]=ca+1,va[pa+2]=ca,va[pa+3]=ca+3,va[pa+4]=ca+1,va[pa+5]=ca+2,va[pa+6]=ca+2,va[pa+7]=ca+3,pa+=8,ca+=4;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,N.__webglFaceBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,Ua,xa);e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,N.__webglLineBuffer);e.bufferData(e.ELEMENT_ARRAY_BUFFER,va,xa)}if(Cc)for(Q=0,Hc=Cc.length;Q<Hc;Q++)if(q=Cc[Q],q.__original.needsUpdate){s=0;if(1===q.size)if(void 0===q.boundTo||
  257. "vertices"===q.boundTo){for(u=0,B=R.length;u<B;u++)x=fa[R[u]],q.array[s]=q.value[x.a],q.array[s+1]=q.value[x.b],q.array[s+2]=q.value[x.c],s+=3;for(u=0,B=S.length;u<B;u++)x=fa[S[u]],q.array[s]=q.value[x.a],q.array[s+1]=q.value[x.b],q.array[s+2]=q.value[x.c],q.array[s+3]=q.value[x.d],s+=4}else{if("faces"===q.boundTo){for(u=0,B=R.length;u<B;u++)ua=q.value[R[u]],q.array[s]=ua,q.array[s+1]=ua,q.array[s+2]=ua,s+=3;for(u=0,B=S.length;u<B;u++)ua=q.value[S[u]],q.array[s]=ua,q.array[s+1]=ua,q.array[s+2]=ua,
  258. q.array[s+3]=ua,s+=4}}else if(2===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(u=0,B=R.length;u<B;u++)x=fa[R[u]],C=q.value[x.a],D=q.value[x.b],E=q.value[x.c],q.array[s]=C.x,q.array[s+1]=C.y,q.array[s+2]=D.x,q.array[s+3]=D.y,q.array[s+4]=E.x,q.array[s+5]=E.y,s+=6;for(u=0,B=S.length;u<B;u++)x=fa[S[u]],C=q.value[x.a],D=q.value[x.b],E=q.value[x.c],T=q.value[x.d],q.array[s]=C.x,q.array[s+1]=C.y,q.array[s+2]=D.x,q.array[s+3]=D.y,q.array[s+4]=E.x,q.array[s+5]=E.y,q.array[s+6]=T.x,q.array[s+
  259. 7]=T.y,s+=8}else{if("faces"===q.boundTo){for(u=0,B=R.length;u<B;u++)E=D=C=ua=q.value[R[u]],q.array[s]=C.x,q.array[s+1]=C.y,q.array[s+2]=D.x,q.array[s+3]=D.y,q.array[s+4]=E.x,q.array[s+5]=E.y,s+=6;for(u=0,B=S.length;u<B;u++)T=E=D=C=ua=q.value[S[u]],q.array[s]=C.x,q.array[s+1]=C.y,q.array[s+2]=D.x,q.array[s+3]=D.y,q.array[s+4]=E.x,q.array[s+5]=E.y,q.array[s+6]=T.x,q.array[s+7]=T.y,s+=8}}else if(3===q.size){var O;O="c"===q.type?["r","g","b"]:["x","y","z"];if(void 0===q.boundTo||"vertices"===q.boundTo){for(u=
  260. 0,B=R.length;u<B;u++)x=fa[R[u]],C=q.value[x.a],D=q.value[x.b],E=q.value[x.c],q.array[s]=C[O[0]],q.array[s+1]=C[O[1]],q.array[s+2]=C[O[2]],q.array[s+3]=D[O[0]],q.array[s+4]=D[O[1]],q.array[s+5]=D[O[2]],q.array[s+6]=E[O[0]],q.array[s+7]=E[O[1]],q.array[s+8]=E[O[2]],s+=9;for(u=0,B=S.length;u<B;u++)x=fa[S[u]],C=q.value[x.a],D=q.value[x.b],E=q.value[x.c],T=q.value[x.d],q.array[s]=C[O[0]],q.array[s+1]=C[O[1]],q.array[s+2]=C[O[2]],q.array[s+3]=D[O[0]],q.array[s+4]=D[O[1]],q.array[s+5]=D[O[2]],q.array[s+
  261. 6]=E[O[0]],q.array[s+7]=E[O[1]],q.array[s+8]=E[O[2]],q.array[s+9]=T[O[0]],q.array[s+10]=T[O[1]],q.array[s+11]=T[O[2]],s+=12}else if("faces"===q.boundTo){for(u=0,B=R.length;u<B;u++)E=D=C=ua=q.value[R[u]],q.array[s]=C[O[0]],q.array[s+1]=C[O[1]],q.array[s+2]=C[O[2]],q.array[s+3]=D[O[0]],q.array[s+4]=D[O[1]],q.array[s+5]=D[O[2]],q.array[s+6]=E[O[0]],q.array[s+7]=E[O[1]],q.array[s+8]=E[O[2]],s+=9;for(u=0,B=S.length;u<B;u++)T=E=D=C=ua=q.value[S[u]],q.array[s]=C[O[0]],q.array[s+1]=C[O[1]],q.array[s+2]=C[O[2]],
  262. q.array[s+3]=D[O[0]],q.array[s+4]=D[O[1]],q.array[s+5]=D[O[2]],q.array[s+6]=E[O[0]],q.array[s+7]=E[O[1]],q.array[s+8]=E[O[2]],q.array[s+9]=T[O[0]],q.array[s+10]=T[O[1]],q.array[s+11]=T[O[2]],s+=12}}else if(4===q.size)if(void 0===q.boundTo||"vertices"===q.boundTo){for(u=0,B=R.length;u<B;u++)x=fa[R[u]],C=q.value[x.a],D=q.value[x.b],E=q.value[x.c],q.array[s]=C.x,q.array[s+1]=C.y,q.array[s+2]=C.z,q.array[s+3]=C.w,q.array[s+4]=D.x,q.array[s+5]=D.y,q.array[s+6]=D.z,q.array[s+7]=D.w,q.array[s+8]=E.x,q.array[s+
  263. 9]=E.y,q.array[s+10]=E.z,q.array[s+11]=E.w,s+=12;for(u=0,B=S.length;u<B;u++)x=fa[S[u]],C=q.value[x.a],D=q.value[x.b],E=q.value[x.c],T=q.value[x.d],q.array[s]=C.x,q.array[s+1]=C.y,q.array[s+2]=C.z,q.array[s+3]=C.w,q.array[s+4]=D.x,q.array[s+5]=D.y,q.array[s+6]=D.z,q.array[s+7]=D.w,q.array[s+8]=E.x,q.array[s+9]=E.y,q.array[s+10]=E.z,q.array[s+11]=E.w,q.array[s+12]=T.x,q.array[s+13]=T.y,q.array[s+14]=T.z,q.array[s+15]=T.w,s+=16}else if("faces"===q.boundTo){for(u=0,B=R.length;u<B;u++)E=D=C=ua=q.value[R[u]],
  264. q.array[s]=C.x,q.array[s+1]=C.y,q.array[s+2]=C.z,q.array[s+3]=C.w,q.array[s+4]=D.x,q.array[s+5]=D.y,q.array[s+6]=D.z,q.array[s+7]=D.w,q.array[s+8]=E.x,q.array[s+9]=E.y,q.array[s+10]=E.z,q.array[s+11]=E.w,s+=12;for(u=0,B=S.length;u<B;u++)T=E=D=C=ua=q.value[S[u]],q.array[s]=C.x,q.array[s+1]=C.y,q.array[s+2]=C.z,q.array[s+3]=C.w,q.array[s+4]=D.x,q.array[s+5]=D.y,q.array[s+6]=D.z,q.array[s+7]=D.w,q.array[s+8]=E.x,q.array[s+9]=E.y,q.array[s+10]=E.z,q.array[s+11]=E.w,q.array[s+12]=T.x,q.array[s+13]=T.y,
  265. q.array[s+14]=T.z,q.array[s+15]=T.w,s+=16}e.bindBuffer(e.ARRAY_BUFFER,q.buffer);e.bufferData(e.ARRAY_BUFFER,q.array,xa)}ec&&(delete N.__inittedArrays,delete N.__colorArray,delete N.__normalArray,delete N.__tangentArray,delete N.__uvArray,delete N.__uv2Array,delete N.__faceArray,delete N.__vertexArray,delete N.__lineArray,delete N.__skinVertexAArray,delete N.__skinVertexBArray,delete N.__skinIndexArray,delete N.__skinWeightArray)}}P.__dirtyVertices=!1;P.__dirtyMorphTargets=!1;P.__dirtyElements=!1;
  266. P.__dirtyUvs=!1;P.__dirtyNormals=!1;P.__dirtyColors=!1;P.__dirtyTangents=!1;sa.attributes&&m(sa)}else if(Fa instanceof THREE.Ribbon){if(P.__dirtyVertices||P.__dirtyColors){var lb=P,Kc=e.DYNAMIC_DRAW,Wb=void 0,Xb=void 0,mc=void 0,mb=void 0,nc=void 0,Lc=lb.vertices,Mc=lb.colors,Vc=Lc.length,Wc=Mc.length,oc=lb.__vertexArray,pc=lb.__colorArray,Xc=lb.__dirtyColors;if(lb.__dirtyVertices){for(Wb=0;Wb<Vc;Wb++)mc=Lc[Wb].position,mb=3*Wb,oc[mb]=mc.x,oc[mb+1]=mc.y,oc[mb+2]=mc.z;e.bindBuffer(e.ARRAY_BUFFER,lb.__webglVertexBuffer);
  267. e.bufferData(e.ARRAY_BUFFER,oc,Kc)}if(Xc){for(Xb=0;Xb<Wc;Xb++)nc=Mc[Xb],mb=3*Xb,pc[mb]=nc.r,pc[mb+1]=nc.g,pc[mb+2]=nc.b;e.bindBuffer(e.ARRAY_BUFFER,lb.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,pc,Kc)}}P.__dirtyVertices=!1;P.__dirtyColors=!1}else if(Fa instanceof THREE.Line){sa=c(Fa,Pb);Db=sa.attributes&&n(sa);if(P.__dirtyVertices||P.__dirtyColors||Db){var Za=P,Fc=e.DYNAMIC_DRAW,Yb=void 0,Zb=void 0,qc=void 0,ba=void 0,rc=void 0,Nc=Za.vertices,Oc=Za.colors,Yc=Nc.length,Zc=Oc.length,sc=Za.__vertexArray,
  268. tc=Za.__colorArray,$c=Za.__dirtyColors,Gc=Za.__webglCustomAttributesList,uc=void 0,Pc=void 0,ma=void 0,Jb=void 0,ta=void 0,W=void 0;if(Za.__dirtyVertices){for(Yb=0;Yb<Yc;Yb++)qc=Nc[Yb].position,ba=3*Yb,sc[ba]=qc.x,sc[ba+1]=qc.y,sc[ba+2]=qc.z;e.bindBuffer(e.ARRAY_BUFFER,Za.__webglVertexBuffer);e.bufferData(e.ARRAY_BUFFER,sc,Fc)}if($c){for(Zb=0;Zb<Zc;Zb++)rc=Oc[Zb],ba=3*Zb,tc[ba]=rc.r,tc[ba+1]=rc.g,tc[ba+2]=rc.b;e.bindBuffer(e.ARRAY_BUFFER,Za.__webglColorBuffer);e.bufferData(e.ARRAY_BUFFER,tc,Fc)}if(Gc)for(uc=
  269. 0,Pc=Gc.length;uc<Pc;uc++)if(W=Gc[uc],W.needsUpdate&&(void 0===W.boundTo||"vertices"===W.boundTo)){ba=0;Jb=W.value.length;if(1===W.size)for(ma=0;ma<Jb;ma++)W.array[ma]=W.value[ma];else if(2===W.size)for(ma=0;ma<Jb;ma++)ta=W.value[ma],W.array[ba]=ta.x,W.array[ba+1]=ta.y,ba+=2;else if(3===W.size)if("c"===W.type)for(ma=0;ma<Jb;ma++)ta=W.value[ma],W.array[ba]=ta.r,W.array[ba+1]=ta.g,W.array[ba+2]=ta.b,ba+=3;else for(ma=0;ma<Jb;ma++)ta=W.value[ma],W.array[ba]=ta.x,W.array[ba+1]=ta.y,W.array[ba+2]=ta.z,
  270. ba+=3;else if(4===W.size)for(ma=0;ma<Jb;ma++)ta=W.value[ma],W.array[ba]=ta.x,W.array[ba+1]=ta.y,W.array[ba+2]=ta.z,W.array[ba+3]=ta.w,ba+=4;e.bindBuffer(e.ARRAY_BUFFER,W.buffer);e.bufferData(e.ARRAY_BUFFER,W.array,Fc)}}P.__dirtyVertices=!1;P.__dirtyColors=!1;sa.attributes&&m(sa)}else if(Fa instanceof THREE.ParticleSystem)sa=c(Fa,Pb),Db=sa.attributes&&n(sa),(P.__dirtyVertices||P.__dirtyColors||Fa.sortParticles||Db)&&f(P,e.DYNAMIC_DRAW,Fa),P.__dirtyVertices=!1,P.__dirtyColors=!1,sa.attributes&&m(sa)}};
  271. this.initMaterial=function(a,b,c,d){var f,g,h,i,j;a instanceof THREE.MeshDepthMaterial?j="depth":a instanceof THREE.MeshNormalMaterial?j="normal":a instanceof THREE.MeshBasicMaterial?j="basic":a instanceof THREE.MeshLambertMaterial?j="lambert":a instanceof THREE.MeshPhongMaterial?j="phong":a instanceof THREE.LineBasicMaterial?j="basic":a instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];a.uniforms=THREE.UniformsUtils.clone(k.uniforms);a.vertexShader=k.vertexShader;
  272. a.fragmentShader=k.fragmentShader}var l,n;g=k=0;for(l=0,n=b.length;l<n;l++)f=b[l],f instanceof THREE.SpotLight&&!f.onlyShadow&&g++,f instanceof THREE.DirectionalLight&&g++,f instanceof THREE.PointLight&&k++;k+g<=oa?l=g:(l=Math.ceil(oa*g/(k+g)),k=oa-l);f=l;g=k;var m=0;for(k=0,l=b.length;k<l;k++)n=b[k],n instanceof THREE.SpotLight&&n.castShadow&&m++;var p=50;if(void 0!==d&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var o;a:{l=a.fragmentShader;n=a.vertexShader;var k=a.uniforms,b=a.attributes,c=
  273. {map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f,maxPointLights:g,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel,wrapAround:a.wrapAround},
  274. r,d=[];j?d.push(j):(d.push(l),d.push(n));for(r in c)d.push(r),d.push(c[r]);j=d.join();for(r=0,d=qa.length;r<d;r++)if(qa[r].code===j){o=qa[r].program;break a}r=e.createProgram();d=[0<Nb?"#define VERTEX_TEXTURES":"",z.gammaInput?"#define GAMMA_INPUT":"",z.gammaOutput?"#define GAMMA_OUTPUT":"",z.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,
  275. c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
  276. f=["precision "+G+" float;","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",z.gammaInput?"#define GAMMA_INPUT":"",z.gammaOutput?"#define GAMMA_OUTPUT":"",z.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?
  277. "#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.wrapAround?"#define WRAP_AROUND":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");e.attachShader(r,F("fragment",
  278. f+l));e.attachShader(r,F("vertex",d+n));e.linkProgram(r);e.getProgramParameter(r,e.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+e.getProgramParameter(r,e.VALIDATE_STATUS)+", gl error ["+e.getError()+"]");r.uniforms={};r.attributes={};var t,d="viewMatrix,modelViewMatrix,projectionMatrix,normalMatrix,objectMatrix,cameraPosition,cameraInverseMatrix,boneGlobalMatrices,morphTargetInfluences".split(",");for(t in k)d.push(t);t=d;for(d=0,k=t.length;d<k;d++)l=t[d],r.uniforms[l]=
  279. e.getUniformLocation(r,l);d="position,normal,uv,uv2,tangent,color,skinVertexA,skinVertexB,skinIndex,skinWeight".split(",");for(t=0;t<c.maxMorphTargets;t++)d.push("morphTarget"+t);for(o in b)d.push(o);o=d;for(t=0,b=o.length;t<b;t++)c=o[t],r.attributes[c]=e.getAttribLocation(r,c);r.id=qa.length;qa.push({program:r,code:j});z.info.memory.programs=qa.length;o=r}a.program=o;o=a.program.attributes;0<=o.position&&e.enableVertexAttribArray(o.position);0<=o.color&&e.enableVertexAttribArray(o.color);0<=o.normal&&
  280. e.enableVertexAttribArray(o.normal);0<=o.tangent&&e.enableVertexAttribArray(o.tangent);a.skinning&&0<=o.skinVertexA&&0<=o.skinVertexB&&0<=o.skinIndex&&0<=o.skinWeight&&(e.enableVertexAttribArray(o.skinVertexA),e.enableVertexAttribArray(o.skinVertexB),e.enableVertexAttribArray(o.skinIndex),e.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(i in a.attributes)void 0!==o[i]&&0<=o[i]&&e.enableVertexAttribArray(o[i]);if(a.morphTargets)for(i=a.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)t=
  281. "morphTarget"+i,0<=o[t]&&(e.enableVertexAttribArray(o[t]),a.numSupportedMorphTargets++);a.uniformsList=[];for(h in a.uniforms)a.uniformsList.push([a.uniforms[h],h])};this.setFaceCulling=function(a,b){a?(!b||"ccw"===b?e.frontFace(e.CCW):e.frontFace(e.CW),"back"===a?e.cullFace(e.BACK):"front"===a?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK),e.enable(e.CULL_FACE)):e.disable(e.CULL_FACE)};this.setObjectFaces=function(a){if(Kb!==a.doubleSided)a.doubleSided?e.disable(e.CULL_FACE):e.enable(e.CULL_FACE),
  282. Kb=a.doubleSided;if(Mb!==a.flipSided)a.flipSided?e.frontFace(e.CW):e.frontFace(e.CCW),Mb=a.flipSided};this.setDepthTest=function(a){pb!==a&&(a?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),pb=a)};this.setDepthWrite=function(a){ob!==a&&(e.depthMask(a),ob=a)};this.setBlending=function(a){if(a!==ab){switch(a){case THREE.AdditiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.SRC_ALPHA,e.ONE);break;case THREE.SubtractiveBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.ONE_MINUS_SRC_COLOR);
  283. break;case THREE.MultiplyBlending:e.blendEquation(e.FUNC_ADD);e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA)}ab=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=e.createTexture(),z.info.memory.textures++;e.activeTexture(e.TEXTURE0+b);e.bindTexture(e.TEXTURE_2D,a.__webglTexture);var c=a.image,d=0===(c.width&c.width-1)&&
  284. 0===(c.height&c.height-1),f=J(a.format),g=J(a.type);I(e.TEXTURE_2D,a,d);a instanceof THREE.DataTexture?e.texImage2D(e.TEXTURE_2D,0,f,c.width,c.height,0,f,g,c.data):e.texImage2D(e.TEXTURE_2D,0,f,f,g,a.image);a.generateMipmaps&&d&&e.generateMipmap(e.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else e.activeTexture(e.TEXTURE0+b),e.bindTexture(e.TEXTURE_2D,a.__webglTexture)};this.setRenderTarget=function(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(void 0===
  285. a.depthBuffer)a.depthBuffer=!0;if(void 0===a.stencilBuffer)a.stencilBuffer=!0;a.__webglTexture=e.createTexture();var c=0===(a.width&a.width-1)&&0===(a.height&a.height-1),d=J(a.format),f=J(a.type);if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];e.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture);I(e.TEXTURE_CUBE_MAP,a,c);for(c=0;6>c;c++){a.__webglFramebuffer[c]=e.createFramebuffer();a.__webglRenderbuffer[c]=e.createRenderbuffer();e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,d,a.width,a.height,
  286. 0,d,f,null);var g=a,h=e.TEXTURE_CUBE_MAP_POSITIVE_X+c;e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[c]);e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,h,g.__webglTexture,0);A(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=e.createFramebuffer(),a.__webglRenderbuffer=e.createRenderbuffer(),e.bindTexture(e.TEXTURE_2D,a.__webglTexture),I(e.TEXTURE_2D,a,c),e.texImage2D(e.TEXTURE_2D,0,d,a.width,a.height,0,d,f,null),d=e.TEXTURE_2D,e.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),
  287. e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,d,a.__webglTexture,0),A(a.__webglRenderbuffer,a);b?e.bindTexture(e.TEXTURE_CUBE_MAP,null):e.bindTexture(e.TEXTURE_2D,null);e.bindRenderbuffer(e.RENDERBUFFER,null);e.bindFramebuffer(e.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,d=a.width,a=a.height,c=f=0):(b=null,d=zb,a=sb,f=qb,c=rb);b!==$b&&(e.bindFramebuffer(e.FRAMEBUFFER,b),e.viewport(f,c,d,a),$b=b);ac=d;bc=a};this.shadowMapPlugin=new THREE.ShadowMapPlugin;
  288. this.addPrePlugin(this.shadowMapPlugin);this.addPostPlugin(new THREE.SpritePlugin);this.addPostPlugin(new THREE.LensFlarePlugin)};
  289. THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=void 0!==c.wrapS?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=void 0!==c.wrapT?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=void 0!==c.magFilter?c.magFilter:THREE.LinearFilter;this.minFilter=void 0!==c.minFilter?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=void 0!==c.format?c.format:THREE.RGBAFormat;this.type=void 0!==c.type?c.type:
  290. THREE.UnsignedByteType;this.depthBuffer=void 0!==c.depthBuffer?c.depthBuffer:!0;this.stencilBuffer=void 0!==c.stencilBuffer?c.stencilBuffer:!0;this.generateMipmaps=!0};
  291. THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
  292. THREE.WebGLRenderTargetCube.prototype=new THREE.WebGLRenderTarget;THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;
  293. THREE.BufferGeometry=function(){this.id=THREE.GeometryCount++;this.vertexColorArray=this.vertexUvArray=this.vertexNormalArray=this.vertexPositionArray=this.vertexIndexArray=this.vertexColorBuffer=this.vertexUvBuffer=this.vertexNormalBuffer=this.vertexPositionBuffer=this.vertexIndexBuffer=null;this.dynamic=!1;this.boundingSphere=this.boundingBox=null;this.morphTargets=[]};THREE.BufferGeometry.prototype={constructor:THREE.BufferGeometry,computeBoundingBox:function(){},computeBoundingSphere:function(){}};
  294. THREE.LensFlare=function(a,b,c,d,g){THREE.Object3D.call(this);this.lensFlares=[];this.positionScreen=new THREE.Vector3;this.customUpdateCallback=void 0;void 0!==a&&this.add(a,b,c,d,g)};THREE.LensFlare.prototype=new THREE.Object3D;THREE.LensFlare.prototype.constructor=THREE.LensFlare;THREE.LensFlare.prototype.supr=THREE.Object3D.prototype;
  295. THREE.LensFlare.prototype.add=function(a,b,c,d,g,f){void 0===b&&(b=-1);void 0===c&&(c=0);void 0===f&&(f=1);void 0===g&&(g=new THREE.Color(16777215));if(void 0===d)d=THREE.NormalBlending;c=Math.min(c,Math.max(0,c));this.lensFlares.push({texture:a,size:b,distance:c,x:0,y:0,z:0,scale:1,rotation:1,opacity:f,color:g,blending:d})};
  296. THREE.LensFlare.prototype.updateLensFlares=function(){var a,b=this.lensFlares.length,c,d=2*-this.positionScreen.x,g=2*-this.positionScreen.y;for(a=0;a<b;a++)c=this.lensFlares[a],c.x=this.positionScreen.x+d*c.distance,c.y=this.positionScreen.y+g*c.distance,c.wantedRotation=0.25*c.x*Math.PI,c.rotation+=0.25*(c.wantedRotation-c.rotation)};
  297. THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=a;this.isolation=80;this.size=a;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(3*this.size3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=0;this.hasNormal=
  298. this.hasPos=!1;this.positionArray=new Float32Array(3*this.maxCount);this.normalArray=new Float32Array(3*this.maxCount)};this.lerp=function(a,b,g){return a+(b-a)*g};this.VIntX=function(a,b,g,f,h,i,k,l,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[f]=i+h*this.delta;b[f+1]=k;b[f+2]=l;g[f]=this.lerp(j[a],j[a+3],h);g[f+1]=this.lerp(j[a+1],j[a+4],h);g[f+2]=this.lerp(j[a+2],j[a+5],h)};this.VIntY=function(a,b,g,f,h,i,k,l,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[f]=i;b[f+1]=k+h*this.delta;b[f+2]=l;b=a+3*this.yd;
  299. g[f]=this.lerp(j[a],j[b],h);g[f+1]=this.lerp(j[a+1],j[b+1],h);g[f+2]=this.lerp(j[a+2],j[b+2],h)};this.VIntZ=function(a,b,g,f,h,i,k,l,j,n){h=(h-j)/(n-j);j=this.normal_cache;b[f]=i;b[f+1]=k;b[f+2]=l+h*this.delta;b=a+3*this.zd;g[f]=this.lerp(j[a],j[b],h);g[f+1]=this.lerp(j[a+1],j[b+1],h);g[f+2]=this.lerp(j[a+2],j[b+2],h)};this.compNorm=function(a){var b=3*a;0===this.normal_cache[b]&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
  300. this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,g,f,h,i){var k=f+1,l=f+this.yd,j=f+this.zd,n=k+this.yd,m=k+this.zd,o=f+this.yd+this.zd,p=k+this.yd+this.zd,r=0,t=this.field[f],y=this.field[k],F=this.field[l],I=this.field[n],A=this.field[j],v=this.field[m],J=this.field[o],K=this.field[p];t<h&&(r|=1);y<h&&(r|=2);F<h&&(r|=8);I<h&&(r|=4);A<h&&(r|=16);v<h&&(r|=32);J<h&&(r|=128);K<h&&(r|=64);var G=THREE.edgeTable[r];if(0===G)return 0;var M=this.delta,H=a+
  301. M,L=b+M,M=g+M;G&1&&(this.compNorm(f),this.compNorm(k),this.VIntX(3*f,this.vlist,this.nlist,0,h,a,b,g,t,y));G&2&&(this.compNorm(k),this.compNorm(n),this.VIntY(3*k,this.vlist,this.nlist,3,h,H,b,g,y,I));G&4&&(this.compNorm(l),this.compNorm(n),this.VIntX(3*l,this.vlist,this.nlist,6,h,a,L,g,F,I));G&8&&(this.compNorm(f),this.compNorm(l),this.VIntY(3*f,this.vlist,this.nlist,9,h,a,b,g,t,F));G&16&&(this.compNorm(j),this.compNorm(m),this.VIntX(3*j,this.vlist,this.nlist,12,h,a,b,M,A,v));G&32&&(this.compNorm(m),
  302. this.compNorm(p),this.VIntY(3*m,this.vlist,this.nlist,15,h,H,b,M,v,K));G&64&&(this.compNorm(o),this.compNorm(p),this.VIntX(3*o,this.vlist,this.nlist,18,h,a,L,M,J,K));G&128&&(this.compNorm(j),this.compNorm(o),this.VIntY(3*j,this.vlist,this.nlist,21,h,a,b,M,A,J));G&256&&(this.compNorm(f),this.compNorm(j),this.VIntZ(3*f,this.vlist,this.nlist,24,h,a,b,g,t,A));G&512&&(this.compNorm(k),this.compNorm(m),this.VIntZ(3*k,this.vlist,this.nlist,27,h,H,b,g,y,v));G&1024&&(this.compNorm(n),this.compNorm(p),this.VIntZ(3*
  303. n,this.vlist,this.nlist,30,h,H,L,g,I,K));G&2048&&(this.compNorm(l),this.compNorm(o),this.VIntZ(3*l,this.vlist,this.nlist,33,h,a,L,g,F,J));r<<=4;for(h=f=0;-1!=THREE.triTable[r+h];)a=r+h,b=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[g],i),h+=3,f++;return f};this.posnormtriv=function(a,b,g,f,h,i){var k=3*this.count;this.positionArray[k]=a[g];this.positionArray[k+1]=a[g+1];this.positionArray[k+2]=a[g+2];this.positionArray[k+3]=a[f];this.positionArray[k+
  304. 4]=a[f+1];this.positionArray[k+5]=a[f+2];this.positionArray[k+6]=a[h];this.positionArray[k+7]=a[h+1];this.positionArray[k+8]=a[h+2];this.normalArray[k]=b[g];this.normalArray[k+1]=b[g+1];this.normalArray[k+2]=b[g+2];this.normalArray[k+3]=b[f];this.normalArray[k+4]=b[f+1];this.normalArray[k+5]=b[f+2];this.normalArray[k+6]=b[h];this.normalArray[k+7]=b[h+1];this.normalArray[k+8]=b[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&i(this)};this.begin=function(){this.count=0;
  305. this.hasNormal=this.hasPos=!1};this.end=function(a){if(0!==this.count){for(var b=3*this.count;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,g,f,h){var i=this.size*Math.sqrt(f/h),k=g*this.size,l=b*this.size,j=a*this.size,n=Math.floor(k-i);1>n&&(n=1);k=Math.floor(k+i);k>this.size-1&&(k=this.size-1);var m=Math.floor(l-i);1>m&&(m=1);l=Math.floor(l+i);l>this.size-1&&(l=this.size-1);var o=Math.floor(j-i);1>o&&(o=1);i=Math.floor(j+i);i>this.size-1&&(i=this.size-
  306. 1);for(var p,r,t,y,F,I,A,j=n;j<k;j++){t=this.size2*j;F=j/this.size-g;I=F*F;for(n=m;n<l;n++){r=t+this.size*n;p=n/this.size-b;A=p*p;for(p=o;p<i;p++)y=p/this.size-a,y=f/(1.0E-6+y*y+A+I)-h,0<y&&(this.field[r+p]+=y)}}};this.addPlaneX=function(a,b){var g,f,h,i,k,l=this.size,j=this.yd,n=this.zd,m=this.field,o=l*Math.sqrt(a/b);o>l&&(o=l);for(g=0;g<o;g++)if(f=g/l,f*=f,i=a/(1.0E-4+f)-b,0<i)for(f=0;f<l;f++){k=g+f*j;for(h=0;h<l;h++)m[n*h+k]+=i}};this.addPlaneY=function(a,b){var g,f,h,i,k,l,j=this.size,n=this.yd,
  307. m=this.zd,o=this.field,p=j*Math.sqrt(a/b);p>j&&(p=j);for(f=0;f<p;f++)if(g=f/j,g*=g,i=a/(1.0E-4+g)-b,0<i){k=f*n;for(g=0;g<j;g++){l=k+g;for(h=0;h<j;h++)o[m*h+l]+=i}}};this.addPlaneZ=function(a,b){var g,f,h,i,k,l,j=this.size,n=this.yd,m=this.zd,o=this.field,p=j*Math.sqrt(a/b);p>j&&(p=j);for(h=0;h<p;h++)if(g=h/j,g*=g,i=a/(1.0E-4+g)-b,0<i){k=m*h;for(f=0;f<j;f++){l=k+f*n;for(g=0;g<j;g++)o[l+g]+=i}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[3*a]=0,this.field[a]=0};this.render=
  308. function(a){this.begin();var b,g,f,h,i,k,l,j,n,m=this.size-2;for(h=1;h<m;h++){n=this.size2*h;l=(h-this.halfsize)/this.halfsize;for(f=1;f<m;f++){j=n+this.size*f;k=(f-this.halfsize)/this.halfsize;for(g=1;g<m;g++)i=(g-this.halfsize)/this.halfsize,b=j+g,this.polygonize(i,k,l,b,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,b=new THREE.Geometry,g=[];this.render(function(f){var h,i,k,l,j,n,m,o;for(h=0;h<f.count;h++)m=3*h,j=m+1,o=m+2,i=f.positionArray[m],k=f.positionArray[j],l=
  309. f.positionArray[o],n=new THREE.Vector3(i,k,l),i=f.normalArray[m],k=f.normalArray[j],l=f.normalArray[o],m=new THREE.Vector3(i,k,l),m.normalize(),j=new THREE.Vertex(n),b.vertices.push(j),g.push(m);n=f.count/3;for(h=0;h<n;h++)m=3*(a+h),j=m+1,o=m+2,i=g[m],k=g[j],l=g[o],m=new THREE.Face3(m,j,o,[i,k,l]),b.faces.push(m);a+=n;f.count=0});return b};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
  310. 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,
  311. 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,
  312. 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
  313. THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,
  314. -1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,
  315. -1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,
  316. -1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,
  317. 8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,
  318. -1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,
  319. 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,
  320. -1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,
  321. 10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,
  322. 6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,
  323. 8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,
  324. 2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,
  325. -1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,
  326. -1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,
  327. -1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
  328. 1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,
  329. -1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,
  330. 2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,
  331. 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
  332. -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
  333. 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);
  334. THREE.LensFlarePlugin=function(){function a(a){var c=b.createProgram(),d=b.createShader(b.FRAGMENT_SHADER),f=b.createShader(b.VERTEX_SHADER);b.shaderSource(d,a.fragmentShader);b.shaderSource(f,a.vertexShader);b.compileShader(d);b.compileShader(f);b.attachShader(c,d);b.attachShader(c,f);b.linkProgram(c);return c}var b,c,d,g,f,h,i,k,l,j,n,m,o;this.init=function(p){b=p.context;c=p;d=new Float32Array(16);g=new Uint16Array(6);p=0;d[p++]=-1;d[p++]=-1;d[p++]=0;d[p++]=0;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=
  335. 0;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=1;d[p++]=-1;d[p++]=1;d[p++]=0;d[p++]=1;p=0;g[p++]=0;g[p++]=1;g[p++]=2;g[p++]=0;g[p++]=2;g[p++]=3;f=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,g,b.STATIC_DRAW);i=b.createTexture();k=b.createTexture();b.bindTexture(b.TEXTURE_2D,i);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,
  336. b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.bindTexture(b.TEXTURE_2D,k);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);
  337. b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);0>=b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)?(l=!1,j=a(THREE.ShaderFlares.lensFlare)):(l=!0,j=a(THREE.ShaderFlares.lensFlareVertexTexture));n={};m={};n.vertex=b.getAttribLocation(j,"position");n.uv=b.getAttribLocation(j,"uv");m.renderType=b.getUniformLocation(j,"renderType");m.map=b.getUniformLocation(j,"map");m.occlusionMap=b.getUniformLocation(j,"occlusionMap");m.opacity=b.getUniformLocation(j,"opacity");m.color=b.getUniformLocation(j,
  338. "color");m.scale=b.getUniformLocation(j,"scale");m.rotation=b.getUniformLocation(j,"rotation");m.screenPosition=b.getUniformLocation(j,"screenPosition");o=!1};this.render=function(a,d,g,y){var a=a.__webglFlares,F=a.length;if(F){var I=new THREE.Vector3,A=y/g,v=0.5*g,J=0.5*y,K=16/y,G=new THREE.Vector2(K*A,K),M=new THREE.Vector3(1,1,0),H=new THREE.Vector2(1,1),L=m,K=n;b.useProgram(j);o||(b.enableVertexAttribArray(n.vertex),b.enableVertexAttribArray(n.uv),o=!0);b.uniform1i(L.occlusionMap,0);b.uniform1i(L.map,
  339. 1);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(K.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(K.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.disable(b.CULL_FACE);b.depthMask(!1);var V,ga,oa,z,e;for(V=0;V<F;V++)if(K=16/y,G.set(K*A,K),z=a[V],I.set(z.matrixWorld.n14,z.matrixWorld.n24,z.matrixWorld.n34),d.matrixWorldInverse.multiplyVector3(I),d.projectionMatrix.multiplyVector3(I),M.copy(I),H.x=M.x*v+v,H.y=M.y*J+J,l||0<H.x&&H.x<g&&0<H.y&&H.y<y){b.activeTexture(b.TEXTURE1);
  340. b.bindTexture(b.TEXTURE_2D,i);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,H.x-8,H.y-8,16,16,0);b.uniform1i(L.renderType,0);b.uniform2f(L.scale,G.x,G.y);b.uniform3f(L.screenPosition,M.x,M.y,M.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,k);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,H.x-8,H.y-8,16,16,0);b.uniform1i(L.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,
  341. i);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(M);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(L.renderType,2);b.enable(b.BLEND);for(ga=0,oa=z.lensFlares.length;ga<oa;ga++)if(e=z.lensFlares[ga],0.001<e.opacity&&0.001<e.scale)M.x=e.x,M.y=e.y,M.z=e.z,K=e.size*e.scale/y,G.x=K*A,G.y=K,b.uniform3f(L.screenPosition,M.x,M.y,M.z),b.uniform2f(L.scale,G.x,G.y),b.uniform1f(L.rotation,e.rotation),b.uniform1f(L.opacity,e.opacity),b.uniform3f(L.color,
  342. e.color.r,e.color.g,e.color.b),c.setBlending(e.blending),c.setTexture(e.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
  343. THREE.ShadowMapPlugin=function(){var a,b,c,d,g,f=new THREE.Frustum,h=new THREE.Matrix4;this.shadowMatrix=[];this.shadowMap=[];this.init=function(c){a=c.context;b=c;var c=THREE.ShaderLib.depthRGBA,f=THREE.UniformsUtils.clone(c.uniforms);d=new THREE.ShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,uniforms:f});g=new THREE.ShaderMaterial({fragmentShader:c.fragmentShader,vertexShader:c.vertexShader,uniforms:f,morphTargets:!0});d._shadowPass=!0;g._shadowPass=!0};this.render=
  344. function(a,c){b.shadowMapEnabled&&b.shadowMapAutoUpdate&&this.update(a,c)};this.update=function(i){var k,l,j,n,m,o,p,r,t=0,y=i.lights;c||(c=new THREE.PerspectiveCamera(b.shadowCameraFov,b.shadowMapWidth/b.shadowMapHeight,b.shadowCameraNear,b.shadowCameraFar));a.clearColor(1,1,1,1);a.disable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.FRONT);b.setDepthTest(!0);for(k=0,l=y.length;k<l;k++)if(p=y[k],p.castShadow&&p instanceof THREE.SpotLight){this.shadowMap[t]||(this.shadowMap[t]=new THREE.WebGLRenderTarget(b.shadowMapWidth,
  345. b.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),this.shadowMatrix[t]=new THREE.Matrix4);j=this.shadowMap[t];n=this.shadowMatrix[t];c.position.copy(p.position);c.lookAt(p.target.position);null==c.parent&&(i.add(c),b.autoUpdateScene&&i.updateMatrixWorld());c.matrixWorldInverse.getInverse(c.matrixWorld);n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(c.projectionMatrix);n.multiplySelf(c.matrixWorldInverse);if(!c._viewMatrixArray)c._viewMatrixArray=
  346. new Float32Array(16);c.matrixWorldInverse.flattenToArray(c._viewMatrixArray);if(!c._projectionMatrixArray)c._projectionMatrixArray=new Float32Array(16);c.projectionMatrix.flattenToArray(c._projectionMatrixArray);h.multiply(c.projectionMatrix,c.matrixWorldInverse);f.setFromMatrix(h);b.setRenderTarget(j);b.clear();r=i.__webglObjects;for(j=0,n=r.length;j<n;j++)if(m=r[j],p=m.object,m.render=!1,p.visible&&p.castShadow&&(!(p instanceof THREE.Mesh)||!p.frustumCulled||f.contains(p)))p.matrixWorld.flattenToArray(p._objectMatrixArray),
  347. p._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),m.render=!0;for(j=0,n=r.length;j<n;j++)if(m=r[j],m.render)p=m.object,m=m.buffer,b.setObjectFaces(p),o=p.customDepthMaterial?p.customDepthMaterial:p.geometry.morphTargets.length?g:d,m instanceof THREE.BufferGeometry?b.renderBufferDirect(c,y,null,o,m,p):b.renderBuffer(c,y,null,o,m,p);r=i.__webglObjectsImmediate;for(j=0,n=r.length;j<n;j++)m=r[j],p=m.object,p.visible&&p.castShadow&&(p.matrixAutoUpdate&&p.matrixWorld.flattenToArray(p._objectMatrixArray),
  348. p._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,p.matrixWorld,p._modelViewMatrixArray),b.renderImmediateObject(c,y,null,d,p));t++}i=b.getClearColor();k=b.getClearAlpha();a.clearColor(i.r,i.g,i.b,k);a.enable(a.BLEND);b.shadowMapCullFrontFaces&&a.cullFace(a.BACK)}};
  349. THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d,g,f,h,i,k,l,j;this.init=function(a){b=a.context;c=a;d=new Float32Array(16);g=new Uint16Array(6);a=0;d[a++]=-1;d[a++]=-1;d[a++]=0;d[a++]=1;d[a++]=1;d[a++]=-1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=1;d[a++]=0;d[a++]=-1;d[a++]=1;d[a++]=0;a=d[a++]=0;g[a++]=0;g[a++]=1;g[a++]=2;g[a++]=0;g[a++]=2;g[a++]=3;f=b.createBuffer();h=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,f);b.bufferData(b.ARRAY_BUFFER,d,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
  350. h);b.bufferData(b.ELEMENT_ARRAY_BUFFER,g,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,m=b.createProgram(),o=b.createShader(b.FRAGMENT_SHADER),p=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,a.fragmentShader);b.shaderSource(p,a.vertexShader);b.compileShader(o);b.compileShader(p);b.attachShader(m,o);b.attachShader(m,p);b.linkProgram(m);i=m;k={};l={};k.position=b.getAttribLocation(i,"position");k.uv=b.getAttribLocation(i,"uv");l.uvOffset=b.getUniformLocation(i,"uvOffset");l.uvScale=b.getUniformLocation(i,
  351. "uvScale");l.rotation=b.getUniformLocation(i,"rotation");l.scale=b.getUniformLocation(i,"scale");l.alignment=b.getUniformLocation(i,"alignment");l.color=b.getUniformLocation(i,"color");l.map=b.getUniformLocation(i,"map");l.opacity=b.getUniformLocation(i,"opacity");l.useScreenCoordinates=b.getUniformLocation(i,"useScreenCoordinates");l.affectedByDistance=b.getUniformLocation(i,"affectedByDistance");l.screenPosition=b.getUniformLocation(i,"screenPosition");l.modelViewMatrix=b.getUniformLocation(i,"modelViewMatrix");
  352. l.projectionMatrix=b.getUniformLocation(i,"projectionMatrix");j=!1};this.render=function(d,g,o,p){var d=d.__webglSprites,r=d.length;if(r){var t=k,y=l,F=p/o,o=0.5*o,I=0.5*p,A=!0;b.useProgram(i);j||(b.enableVertexAttribArray(t.position),b.enableVertexAttribArray(t.uv),j=!0);b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,f);b.vertexAttribPointer(t.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(t.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,h);b.uniformMatrix4fv(y.projectionMatrix,
  353. !1,g._projectionMatrixArray);b.activeTexture(b.TEXTURE0);b.uniform1i(y.map,0);for(var v,J=[],t=0;t<r;t++)if(v=d[t],v.visible&&0!==v.opacity)v.useScreenCoordinates?v.z=-v.position.z:(v._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,v.matrixWorld,v._modelViewMatrixArray),v.z=-v._modelViewMatrix.n34);d.sort(a);for(t=0;t<r;t++)v=d[t],v.visible&&0!==v.opacity&&v.map&&v.map.image&&v.map.image.width&&(v.useScreenCoordinates?(b.uniform1i(y.useScreenCoordinates,1),b.uniform3f(y.screenPosition,(v.position.x-
  354. o)/o,(I-v.position.y)/I,Math.max(0,Math.min(1,v.position.z)))):(b.uniform1i(y.useScreenCoordinates,0),b.uniform1i(y.affectedByDistance,v.affectedByDistance?1:0),b.uniformMatrix4fv(y.modelViewMatrix,!1,v._modelViewMatrixArray)),g=v.map.image.width/(v.scaleByViewport?p:1),J[0]=g*F*v.scale.x,J[1]=g*v.scale.y,b.uniform2f(y.uvScale,v.uvScale.x,v.uvScale.y),b.uniform2f(y.uvOffset,v.uvOffset.x,v.uvOffset.y),b.uniform2f(y.alignment,v.alignment.x,v.alignment.y),b.uniform1f(y.opacity,v.opacity),b.uniform3f(y.color,
  355. v.color.r,v.color.g,v.color.b),b.uniform1f(y.rotation,v.rotation),b.uniform2fv(y.scale,J),v.mergeWith3D&&!A?(b.enable(b.DEPTH_TEST),A=!0):!v.mergeWith3D&&A&&(b.disable(b.DEPTH_TEST),A=!1),c.setBlending(v.blending),c.setTexture(v.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
  356. THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
  357. lensFlare:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"precision mediump float;\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( texture2D( map, vUV ).rgb, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nfloat visibility = texture2D( occlusionMap, vec2( 0.5, 0.1 ) ).a +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ).a +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ).a +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ).a;\nvisibility = ( 1.0 - visibility / 4.0 );\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * visibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"}};
  358. THREE.ShaderSprite={sprite:{vertexShader:"uniform int useScreenCoordinates;\nuniform int affectedByDistance;\nuniform vec3 screenPosition;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform float rotation;\nuniform vec2 scale;\nuniform vec2 alignment;\nuniform vec2 uvOffset;\nuniform vec2 uvScale;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvoid main() {\nvUV = uvOffset + uv * uvScale;\nvec2 alignedPosition = position + alignment;\nvec2 rotatedPosition;\nrotatedPosition.x = ( cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y ) * scale.x;\nrotatedPosition.y = ( sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y ) * scale.y;\nvec4 finalPosition;\nif( useScreenCoordinates != 0 ) {\nfinalPosition = vec4( screenPosition.xy + rotatedPosition, screenPosition.z, 1.0 );\n} else {\nfinalPosition = projectionMatrix * modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\nfinalPosition.xy += rotatedPosition * ( affectedByDistance == 1 ? 1.0 : finalPosition.z );\n}\ngl_Position = finalPosition;\n}",
  359. fragmentShader:"precision mediump float;\nuniform vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\n}"}};
  360. THREE.ImageUtils={crossOrigin:"",loadTexture:function(a,b,c){var d=new Image,g=new THREE.Texture(d,b);d.onload=function(){g.needsUpdate=!0;c&&c(this)};d.crossOrigin=this.crossOrigin;d.src=a;return g},loadTextureCube:function(a,b,c){var d,g=[],f=new THREE.Texture(g,b);g.loadCount=0;for(b=0,d=a.length;b<d;++b)g[b]=new Image,g[b].onload=function(){g.loadCount+=1;if(6===g.loadCount)f.needsUpdate=!0;c&&c(this)},g[b].crossOrigin="",g[b].src=a[b];return f},getNormalMap:function(a,b){var c=function(a){var b=
  361. Math.sqrt(a[0]*a[0]+a[1]*a[1]+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]},b=b|1,d=a.width,g=a.height,f=document.createElement("canvas");f.width=d;f.height=g;var h=f.getContext("2d");h.drawImage(a,0,0);for(var i=h.getImageData(0,0,d,g).data,k=h.createImageData(d,g),l=k.data,j=0;j<d;j++)for(var n=1;n<g;n++){var m=0>n-1?g-1:n-1,o=(n+1)%g,p=0>j-1?d-1:j-1,r=(j+1)%d,t=[],y=[0,0,i[4*(n*d+j)]/255*b];t.push([-1,0,i[4*(n*d+p)]/255*b]);t.push([-1,-1,i[4*(m*d+p)]/255*b]);t.push([0,-1,i[4*(m*d+j)]/255*b]);t.push([1,
  362. -1,i[4*(m*d+r)]/255*b]);t.push([1,0,i[4*(n*d+r)]/255*b]);t.push([1,1,i[4*(o*d+r)]/255*b]);t.push([0,1,i[4*(o*d+j)]/255*b]);t.push([-1,1,i[4*(o*d+p)]/255*b]);m=[];p=t.length;for(o=0;o<p;o++){var r=t[o],F=t[(o+1)%p],r=[r[0]-y[0],r[1]-y[1],r[2]-y[2]],F=[F[0]-y[0],F[1]-y[1],F[2]-y[2]];m.push(c([r[1]*F[2]-r[2]*F[1],r[2]*F[0]-r[0]*F[2],r[0]*F[1]-r[1]*F[0]]))}t=[0,0,0];for(o=0;o<m.length;o++)t[0]+=m[o][0],t[1]+=m[o][1],t[2]+=m[o][2];t[0]/=m.length;t[1]/=m.length;t[2]/=m.length;y=4*(n*d+j);l[y]=255*((t[0]+
  363. 1)/2)|0;l[y+1]=255*(t[1]+0.5)|0;l[y+2]=255*t[2]|0;l[y+3]=255}h.putImageData(k,0,0);return f}};