123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- // ThreeWebGL.js r44dev - http://github.com/mrdoob/three.js
- var THREE=THREE||{};if(!window.Int32Array)window.Int32Array=Array,window.Float32Array=Array;THREE.Color=function(b){b!==void 0&&this.setHex(b);return this};
- THREE.Color.prototype={constructor:THREE.Color,r:1,g:1,b:1,copy:function(b){this.r=b.r;this.g=b.g;this.b=b.b;return this},setRGB:function(b,c,d){this.r=b;this.g=c;this.b=d;return this},setHSV:function(b,c,d){var e,h,g;if(d==0)this.r=this.g=this.b=0;else switch(e=Math.floor(b*6),h=b*6-e,b=d*(1-c),g=d*(1-c*h),c=d*(1-c*(1-h)),e){case 1:this.r=g;this.g=d;this.b=b;break;case 2:this.r=b;this.g=d;this.b=c;break;case 3:this.r=b;this.g=g;this.b=d;break;case 4:this.r=c;this.g=b;this.b=d;break;case 5:this.r=
- d;this.g=b;this.b=g;break;case 6:case 0:this.r=d,this.g=c,this.b=b}return this},setHex:function(b){b=Math.floor(b);this.r=(b>>16&255)/255;this.g=(b>>8&255)/255;this.b=(b&255)/255;return this},getHex:function(){return~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},getContextStyle:function(){return"rgb("+Math.floor(this.r*255)+","+Math.floor(this.g*255)+","+Math.floor(this.b*255)+")"},clone:function(){return(new THREE.Color).setRGB(this.r,this.g,this.b)}};
- THREE.Vector2=function(b,c){this.x=b||0;this.y=c||0};
- THREE.Vector2.prototype={constructor:THREE.Vector2,set:function(b,c){this.x=b;this.y=c;return this},copy:function(b){this.x=b.x;this.y=b.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;return this},
- divideScalar:function(b){b?(this.x/=b,this.y/=b):this.set(0,0);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.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(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){var c=this.x-b.x,b=this.y-b.y;return c*c+b*b},setLength:function(b){return this.normalize().multiplyScalar(b)},
- equals:function(b){return b.x==this.x&&b.y==this.y}};THREE.Vector3=function(b,c,d){this.x=b||0;this.y=c||0;this.z=d||0};
- THREE.Vector3.prototype={constructor:THREE.Vector3,set:function(b,c,d){this.x=b;this.y=c;this.z=d;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;return this},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;return this},addScalar:function(b){this.x+=b;this.y+=b;this.z+=b;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=
- b.z-c.z;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;return this},multiply:function(b,c){this.x=b.x*c.x;this.y=b.y*c.y;this.z=b.z*c.z;return this},multiplySelf:function(b){this.x*=b.x;this.y*=b.y;this.z*=b.z;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;return this},divideSelf:function(b){this.x/=b.x;this.y/=b.y;this.z/=b.z;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b):this.set(0,0,0);return this},negate:function(){return this.multiplyScalar(-1)},
- dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.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(b){return this.normalize().multiplyScalar(b)},cross:function(b,c){this.x=b.y*c.z-b.z*c.y;this.y=b.z*c.x-b.x*c.z;this.z=b.x*c.y-b.y*c.x;return this},crossSelf:function(b){return this.set(this.y*
- b.z-this.z*b.y,this.z*b.x-this.x*b.z,this.x*b.y-this.y*b.x)},distanceTo:function(b){return Math.sqrt(this.distanceToSquared(b))},distanceToSquared:function(b){return(new THREE.Vector3).sub(this,b).lengthSq()},setPositionFromMatrix:function(b){this.x=b.n14;this.y=b.n24;this.z=b.n34},setRotationFromMatrix:function(b){var c=Math.cos(this.y);this.y=Math.asin(b.n13);Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12/c,b.n11/c)):(this.x=0,this.z=Math.atan2(b.n21,b.n22))},isZero:function(){return this.lengthSq()<
- 1.0E-4}};THREE.Vector4=function(b,c,d,e){this.x=b||0;this.y=c||0;this.z=d||0;this.w=e||1};
- THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w||1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-c.z;this.w=
- b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
- normalize:function(){return this.divideScalar(this.length())},setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
- THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c<d;c++)e=e.concat(this.intersectObject(b[c]));e.sort(function(b,c){return b.distance-c.distance});return e},intersectObject:function(b){function c(b,c,d){var e;e=d.clone().subSelf(b).dot(c);if(e<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(e));return d.distanceTo(b)}function d(b,c,d,e){var e=e.clone().subSelf(c),
- d=d.clone().subSelf(c),h=b.clone().subSelf(c),b=e.dot(e),c=e.dot(d),e=e.dot(h),g=d.dot(d),d=d.dot(h),h=1/(b*g-c*c),g=(g*e-c*d)*h,b=(b*d-c*e)*h;return g>0&&b>0&&g+b<1}if(b instanceof THREE.Particle){var e=c(this.origin,this.direction,b.matrixWorld.getPosition());if(e==null||e>b.scale.x)return[];return[{distance:e,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){e=c(this.origin,this.direction,b.matrixWorld.getPosition());if(e==null||e>b.geometry.boundingSphere.radius*Math.max(b.scale.x,
- Math.max(b.scale.y,b.scale.z)))return[];var h,g,j,k,p,o,m,r,q,v,C=b.geometry,x=C.vertices,E=[],e=0;for(h=C.faces.length;e<h;e++)if(g=C.faces[e],q=this.origin.clone(),v=this.direction.clone(),o=b.matrixWorld,j=o.multiplyVector3(g.centroid.clone()).subSelf(q),r=j.dot(v),!(r<=0)&&(j=o.multiplyVector3(x[g.a].position.clone()),k=o.multiplyVector3(x[g.b].position.clone()),p=o.multiplyVector3(x[g.c].position.clone()),o=g instanceof THREE.Face4?o.multiplyVector3(x[g.d].position.clone()):null,m=b.matrixRotationWorld.multiplyVector3(g.normal.clone()),
- r=v.dot(m),b.doubleSided||(b.flipSided?r>0:r<0)))if(r=m.dot((new THREE.Vector3).sub(j,q))/r,q=q.addSelf(v.multiplyScalar(r)),g instanceof THREE.Face3)d(q,j,k,p)&&(g={distance:this.origin.distanceTo(q),point:q,face:g,object:b},E.push(g));else if(g instanceof THREE.Face4&&(d(q,j,k,o)||d(q,k,p,o)))g={distance:this.origin.distanceTo(q),point:q,face:g,object:b},E.push(g);E.sort(function(b,c){return b.distance-c.distance});return E}else return[]}};
- THREE.Rectangle=function(){function b(){g=e-c;j=h-d}var c,d,e,h,g,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return g};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(g,j,m,r){k=!1;c=g;d=j;e=m;h=r;b()};this.addPoint=function(g,j){k?(k=!1,c=g,d=j,e=g,h=j):(c=c<g?c:g,d=d<j?d:j,e=e>g?e:g,h=h>j?h:j);b()};this.add3Points=
- function(g,j,m,r,q,v){k?(k=!1,c=g<m?g<q?g:q:m<q?m:q,d=j<r?j<v?j:v:r<v?r:v,e=g>m?g>q?g:q:m>q?m:q,h=j>r?j>v?j:v:r>v?r:v):(c=g<m?g<q?g<c?g:c:q<c?q:c:m<q?m<c?m:c:q<c?q:c,d=j<r?j<v?j<d?j:d:v<d?v:d:r<v?r<d?r:d:v<d?v:d,e=g>m?g>q?g>e?g:e:q>e?q:e:m>q?m>e?m:e:q>e?q:e,h=j>r?j>v?j>h?j:h:v>h?v:h:r>v?r>h?r:h:v>h?v:h);b()};this.addRectangle=function(g){k?(k=!1,c=g.getLeft(),d=g.getTop(),e=g.getRight(),h=g.getBottom()):(c=c<g.getLeft()?c:g.getLeft(),d=d<g.getTop()?d:g.getTop(),e=e>g.getRight()?e:g.getRight(),h=h>
- g.getBottom()?h:g.getBottom());b()};this.inflate=function(g){c-=g;d-=g;e+=g;h+=g;b()};this.minSelf=function(g){c=c>g.getLeft()?c:g.getLeft();d=d>g.getTop()?d:g.getTop();e=e<g.getRight()?e:g.getRight();h=h<g.getBottom()?h:g.getBottom();b()};this.instersects=function(b){return Math.min(e,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(d,b.getTop())>=0};this.empty=function(){k=!0;h=e=d=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]};
- THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,d,e,h,g,j,k,p,o,m,r,q,v,C,x){this.set(b||1,c||0,d||0,e||0,h||0,g||1,j||0,k||0,p||0,o||0,m||1,r||0,q||0,v||0,C||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,e,h,g,j,k,p,o,m,r,q,v,C,x){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=g;this.n23=j;this.n24=k;this.n31=p;this.n32=o;this.n33=m;this.n34=r;this.n41=q;this.n42=v;this.n43=C;this.n44=x;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
- c,d){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(b,c).normalize();if(g.length()===0)g.z=1;e.cross(d,g).normalize();e.length()===0&&(g.x+=1.0E-4,e.cross(d,g).normalize());h.cross(g,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=g.x;this.n21=e.y;this.n22=h.y;this.n23=g.y;this.n31=e.z;this.n32=h.z;this.n33=g.z;return this},multiplyVector3:function(b){var c=b.x,d=b.y,e=b.z,h=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);b.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*h;
- b.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*h;b.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,d=b.y,e=b.z,h=b.w;b.x=this.n11*c+this.n12*d+this.n13*e+this.n14*h;b.y=this.n21*c+this.n22*d+this.n23*e+this.n24*h;b.z=this.n31*c+this.n32*d+this.n33*e+this.n34*h;b.w=this.n41*c+this.n42*d+this.n43*e+this.n44*h;return b},rotateAxis:function(b){var c=b.x,d=b.y,e=b.z;b.x=c*this.n11+d*this.n12+e*this.n13;b.y=c*this.n21+d*this.n22+e*this.n23;b.z=c*this.n31+
- d*this.n32+e*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var d=b.n11,e=b.n12,h=b.n13,g=b.n14,j=b.n21,k=b.n22,p=b.n23,o=b.n24,m=b.n31,r=b.n32,q=b.n33,v=b.n34,C=b.n41,x=b.n42,E=b.n43,K=b.n44,ya=c.n11,za=
- c.n12,ta=c.n13,U=c.n14,t=c.n21,Y=c.n22,L=c.n23,P=c.n24,Q=c.n31,ha=c.n32,qa=c.n33,S=c.n34,J=c.n41,f=c.n42,Ba=c.n43,ra=c.n44;this.n11=d*ya+e*t+h*Q+g*J;this.n12=d*za+e*Y+h*ha+g*f;this.n13=d*ta+e*L+h*qa+g*Ba;this.n14=d*U+e*P+h*S+g*ra;this.n21=j*ya+k*t+p*Q+o*J;this.n22=j*za+k*Y+p*ha+o*f;this.n23=j*ta+k*L+p*qa+o*Ba;this.n24=j*U+k*P+p*S+o*ra;this.n31=m*ya+r*t+q*Q+v*J;this.n32=m*za+r*Y+q*ha+v*f;this.n33=m*ta+r*L+q*qa+v*Ba;this.n34=m*U+r*P+q*S+v*ra;this.n41=C*ya+x*t+E*Q+K*J;this.n42=C*za+x*Y+E*ha+K*f;this.n43=
- C*ta+x*L+E*qa+K*Ba;this.n44=C*U+x*P+E*S+K*ra;return this},multiplyToArray:function(b,c,d){this.multiply(b,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=
- b;this.n23*=b;this.n24*=b;this.n31*=b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,h=this.n21,g=this.n22,j=this.n23,k=this.n24,p=this.n31,o=this.n32,m=this.n33,r=this.n34,q=this.n41,v=this.n42,C=this.n43,x=this.n44;return e*j*o*q-d*k*o*q-e*g*m*q+c*k*m*q+d*g*r*q-c*j*r*q-e*j*p*v+d*k*p*v+e*h*m*v-b*k*m*v-d*h*r*v+b*j*r*v+e*g*p*C-c*k*p*C-e*h*o*C+b*k*o*C+c*h*r*C-b*g*r*C-d*g*p*x+c*j*
- p*x+d*h*o*x-b*j*o*x-c*h*m*x+b*g*m*x},transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;
- b.n33=this.n33;b.n34=this.n34;b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},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(b){b[0]=
- this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;return b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=
- this.n34;b[c+15]=this.n44;return b},setTranslation:function(b,c,d){this.set(1,0,0,b,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(b,c,d){this.set(b,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,
- 0,b,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var d=Math.cos(c),e=Math.sin(c),h=1-d,g=b.x,j=b.y,k=b.z,p=h*g,o=h*j;this.set(p*g+d,p*j-e*k,p*k+e*j,0,p*j+e*k,o*j+d,o*k-e*g,0,p*k-e*j,o*k+e*g,h*k*k+d,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
- new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var d=b.x,e=b.y,h=b.z,g=Math.cos(d),d=Math.sin(d),j=Math.cos(e),e=Math.sin(e),k=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var p=
- j*k,o=j*h,m=e*k,r=e*h;this.n11=p+r*d;this.n12=m*d-o;this.n13=g*e;this.n21=g*h;this.n22=g*k;this.n23=-d;this.n31=o*d-m;this.n32=r+p*d;this.n33=g*j;break;case "ZXY":p=j*k;o=j*h;m=e*k;r=e*h;this.n11=p-r*d;this.n12=-g*h;this.n13=m+o*d;this.n21=o+m*d;this.n22=g*k;this.n23=r-p*d;this.n31=-g*e;this.n32=d;this.n33=g*j;break;case "ZYX":p=g*k;o=g*h;m=d*k;r=d*h;this.n11=j*k;this.n12=m*e-o;this.n13=p*e+r;this.n21=j*h;this.n22=r*e+p;this.n23=o*e-m;this.n31=-e;this.n32=d*j;this.n33=g*j;break;case "YZX":p=g*j;o=
- g*e;m=d*j;r=d*e;this.n11=j*k;this.n12=r-p*h;this.n13=m*h+o;this.n21=h;this.n22=g*k;this.n23=-d*k;this.n31=-e*k;this.n32=o*h+m;this.n33=p-r*h;break;case "XZY":p=g*j;o=g*e;m=d*j;r=d*e;this.n11=j*k;this.n12=-h;this.n13=e*k;this.n21=p*h+r;this.n22=g*k;this.n23=o*h-m;this.n31=m*h-o;this.n32=d*k;this.n33=r*h+p;break;default:p=g*k,o=g*h,m=d*k,r=d*h,this.n11=j*k,this.n12=-j*h,this.n13=e,this.n21=o+m*e,this.n22=p-r*e,this.n23=-d*j,this.n31=r-p*e,this.n32=m+o*e,this.n33=g*j}return this},setRotationFromQuaternion:function(b){var c=
- b.x,d=b.y,e=b.z,h=b.w,g=c+c,j=d+d,k=e+e,b=c*g,p=c*j;c*=k;var o=d*j;d*=k;e*=k;g*=h;j*=h;h*=k;this.n11=1-(o+e);this.n12=p-h;this.n13=c+j;this.n21=p+h;this.n22=1-(b+e);this.n23=d-g;this.n31=c-j;this.n32=d+g;this.n33=1-(b+o);return this},scale:function(b){var c=b.x,d=b.y,b=b.z;this.n11*=c;this.n12*=d;this.n13*=b;this.n21*=c;this.n22*=d;this.n23*=b;this.n31*=c;this.n32*=d;this.n33*=b;this.n41*=c;this.n42*=d;this.n43*=b;return this},compose:function(b,c,d){var e=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2;
- e.identity();e.setRotationFromQuaternion(c);h.setScale(d.x,d.y,d.z);this.multiply(e,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,d){var e=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);g.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;d=d instanceof THREE.Vector3?d:new THREE.Vector3;d.x=e.length();
- d.y=h.length();d.z=g.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;e=THREE.Matrix4.__m1;e.copy(this);e.n11/=d.x;e.n21/=d.x;e.n31/=d.x;e.n12/=d.y;e.n22/=d.y;e.n32/=d.y;e.n13/=d.z;e.n23/=d.z;e.n33/=d.z;c.setFromRotationMatrix(e);return[b,c,d]},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},extractRotation:function(b,c){var d=1/c.x,e=1/c.y,h=1/c.z;this.n11=b.n11*d;this.n21=b.n21*d;this.n31=b.n31*d;this.n12=b.n12*e;this.n22=b.n22*e;this.n32=b.n32*e;this.n13=b.n13*h;this.n23=
- b.n23*h;this.n33=b.n33*h}};
- THREE.Matrix4.makeInvert=function(b,c){var d=b.n11,e=b.n12,h=b.n13,g=b.n14,j=b.n21,k=b.n22,p=b.n23,o=b.n24,m=b.n31,r=b.n32,q=b.n33,v=b.n34,C=b.n41,x=b.n42,E=b.n43,K=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*x-o*q*x+o*r*E-k*v*E-p*r*K+k*q*K;c.n12=g*q*x-h*v*x-g*r*E+e*v*E+h*r*K-e*q*K;c.n13=h*o*x-g*p*x+g*k*E-e*o*E-h*k*K+e*p*K;c.n14=g*p*r-h*o*r-g*k*q+e*o*q+h*k*v-e*p*v;c.n21=o*q*C-p*v*C-o*m*E+j*v*E+p*m*K-j*q*K;c.n22=h*v*C-g*q*C+g*m*E-d*v*E-h*m*K+d*q*K;c.n23=g*p*C-h*o*C-g*j*E+d*o*E+h*j*K-d*p*K;c.n24=
- h*o*m-g*p*m+g*j*q-d*o*q-h*j*v+d*p*v;c.n31=k*v*C-o*r*C+o*m*x-j*v*x-k*m*K+j*r*K;c.n32=g*r*C-e*v*C-g*m*x+d*v*x+e*m*K-d*r*K;c.n33=h*o*C-g*k*C+g*j*x-d*o*x-e*j*K+d*k*K;c.n34=g*k*m-e*o*m-g*j*r+d*o*r+e*j*v-d*k*v;c.n41=p*r*C-k*q*C-p*m*x+j*q*x+k*m*E-j*r*E;c.n42=e*q*C-h*r*C+h*m*x-d*q*x-e*m*E+d*r*E;c.n43=h*k*C-e*p*C-h*j*x+d*p*x+e*j*E-d*k*E;c.n44=e*p*m-h*k*m+h*j*r-d*p*r-e*j*q+d*k*q;c.multiplyScalar(1/b.determinant());return c};
- THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,d=c.m,e=b.n33*b.n22-b.n32*b.n23,h=-b.n33*b.n21+b.n31*b.n23,g=b.n32*b.n21-b.n31*b.n22,j=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,o=b.n23*b.n12-b.n22*b.n13,m=-b.n23*b.n11+b.n21*b.n13,r=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*o;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*h;d[2]=b*g;d[3]=b*j;d[4]=b*k;d[5]=b*p;d[6]=b*o;d[7]=b*m;d[8]=b*r;return c};
- THREE.Matrix4.makeFrustum=function(b,c,d,e,h,g){var j;j=new THREE.Matrix4;j.n11=2*h/(c-b);j.n12=0;j.n13=(c+b)/(c-b);j.n14=0;j.n21=0;j.n22=2*h/(e-d);j.n23=(e+d)/(e-d);j.n24=0;j.n31=0;j.n32=0;j.n33=-(g+h)/(g-h);j.n34=-2*g*h/(g-h);j.n41=0;j.n42=0;j.n43=-1;j.n44=0;return j};THREE.Matrix4.makePerspective=function(b,c,d,e){var h,b=d*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,d,e)};
- THREE.Matrix4.makeOrtho=function(b,c,d,e,h,g){var j,k,p,o;j=new THREE.Matrix4;k=c-b;p=d-e;o=g-h;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/p;j.n23=0;j.n24=-((d+e)/p);j.n31=0;j.n32=0;j.n33=-2/o;j.n34=-((g+h)/o);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
- THREE.Object3D=function(){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=!0;this.quaternion=new THREE.Quaternion;
- this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""};
- THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
- -1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},removeChild:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var d,e,h;d=0;for(e=this.children.length;d<e;d++){h=this.children[d];if(h.name===b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);
- this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,d){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
- this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,e=this.children.length;b<e;b++)this.children[b].update(this.matrixWorld,c,d)}};THREE.Quaternion=function(b,c,d,e){this.set(b||0,c||0,d||0,e!==void 0?e:1)};
- THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,d,e){this.x=b;this.y=c;this.z=d;this.w=e;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,d=b.x*c,e=b.y*c,h=b.z*c,b=Math.cos(e),e=Math.sin(e),c=Math.cos(-h),h=Math.sin(-h),g=Math.cos(d),d=Math.sin(d),j=b*c,k=e*h;this.w=j*g-k*d;this.x=j*d+k*g;this.y=e*c*g+b*h*d;this.z=b*h*g-e*c*d;return this},setFromAxisAngle:function(b,c){var d=c/2,e=Math.sin(d);
- this.x=b.x*e;this.y=b.y*e;this.z=b.z*e;this.w=Math.cos(d);return this},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
- 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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=b,this.w*=b);return this},multiplySelf:function(b){var c=
- this.x,d=this.y,e=this.z,h=this.w,g=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+h*g+d*k-e*j;this.y=d*b+h*j+e*g-c*k;this.z=e*b+h*k+c*j-d*g;this.w=h*b-c*g-d*j-e*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var d=b.x,e=b.y,h=b.z,g=this.x,j=this.y,k=this.z,p=this.w,o=p*d+j*h-k*e,m=p*e+k*d-g*h,r=p*h+g*e-j*d,d=-g*
- d-j*e-k*h;c.x=o*p+d*-g+m*-k-r*-j;c.y=m*p+d*-j+r*-g-o*-k;c.z=r*p+d*-k+o*-j-m*-g;return c}};THREE.Quaternion.slerp=function(b,c,d,e){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var g=Math.acos(h),j=Math.sqrt(1-h*h);if(Math.abs(j)<0.0010)return d.w=0.5*(b.w+c.w),d.x=0.5*(b.x+c.x),d.y=0.5*(b.y+c.y),d.z=0.5*(b.z+c.z),d;h=Math.sin((1-e)*g)/j;e=Math.sin(e*g)/j;d.w=b.w*h+c.w*e;d.x=b.x*h+c.x*e;d.y=b.y*h+c.y*e;d.z=b.z*h+c.z*e;return d};
- THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,d,e,h,g){this.a=b;this.b=c;this.c=d;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.color=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=g instanceof Array?g:[g];this.centroid=new THREE.Vector3};
- THREE.Face4=function(b,c,d,e,h,g,j){this.a=b;this.b=c;this.c=d;this.d=e;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
- THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
- THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
- THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,c,d;b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d.centroid.set(0,0,0),d instanceof THREE.Face3?(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),d.centroid.divideScalar(3)):d instanceof THREE.Face4&&(d.centroid.addSelf(this.vertices[d.a].position),d.centroid.addSelf(this.vertices[d.b].position),d.centroid.addSelf(this.vertices[d.c].position),
- d.centroid.addSelf(this.vertices[d.d].position),d.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,d,e,h,g,j,k=new THREE.Vector3,p=new THREE.Vector3;e=0;for(h=this.faces.length;e<h;e++){g=this.faces[e];if(b&&g.vertexNormals.length){k.set(0,0,0);c=0;for(d=g.vertexNormals.length;c<d;c++)k.addSelf(g.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[g.a],d=this.vertices[g.b],j=this.vertices[g.c],k.sub(j.position,d.position),p.sub(c.position,d.position),k.crossSelf(p);k.isZero()||
- k.normalize();g.normal.copy(k)}},computeVertexNormals:function(){var b,c,d,e;if(this.__tmpVertices==void 0){e=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)e[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(d=this.faces[b],d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{e=
- this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)e[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal)):d instanceof THREE.Face4&&(e[d.a].addSelf(d.normal),e[d.b].addSelf(d.normal),e[d.c].addSelf(d.normal),e[d.d].addSelf(d.normal));b=0;for(c=this.vertices.length;b<c;b++)e[b].normalize();b=0;for(c=this.faces.length;b<c;b++)d=this.faces[b],d instanceof THREE.Face3?(d.vertexNormals[0].copy(e[d.a]),
- d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c])):d instanceof THREE.Face4&&(d.vertexNormals[0].copy(e[d.a]),d.vertexNormals[1].copy(e[d.b]),d.vertexNormals[2].copy(e[d.c]),d.vertexNormals[3].copy(e[d.d]))},computeTangents:function(){function b(b,f,c,d,e,h,g){k=b.vertices[f].position;p=b.vertices[c].position;o=b.vertices[d].position;m=j[e];r=j[h];q=j[g];v=p.x-k.x;C=o.x-k.x;x=p.y-k.y;E=o.y-k.y;K=p.z-k.z;ya=o.z-k.z;za=r.u-m.u;ta=q.u-m.u;U=r.v-m.v;t=q.v-m.v;Y=1/(za*t-ta*U);ha.set((t*v-
- U*C)*Y,(t*x-U*E)*Y,(t*K-U*ya)*Y);qa.set((za*C-ta*v)*Y,(za*E-ta*x)*Y,(za*ya-ta*K)*Y);P[f].addSelf(ha);P[c].addSelf(ha);P[d].addSelf(ha);Q[f].addSelf(qa);Q[c].addSelf(qa);Q[d].addSelf(qa)}var c,d,e,h,g,j,k,p,o,m,r,q,v,C,x,E,K,ya,za,ta,U,t,Y,L,P=[],Q=[],ha=new THREE.Vector3,qa=new THREE.Vector3,S=new THREE.Vector3,J=new THREE.Vector3,f=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)P[c]=new THREE.Vector3,Q[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)g=this.faces[c],j=this.faceVertexUvs[0][c],
- g instanceof THREE.Face3?b(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(b(this,g.a,g.b,g.c,0,1,2),b(this,g.a,g.b,g.d,0,1,3));var Ba=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){g=this.faces[c];for(e=0;e<g.vertexNormals.length;e++)f.copy(g.vertexNormals[e]),h=g[Ba[e]],L=P[h],S.copy(L),S.subSelf(f.multiplyScalar(f.dot(L))).normalize(),J.cross(g.vertexNormals[e],L),h=J.dot(Q[h]),h=h<0?-1:1,g.vertexTangents[e]=new THREE.Vector4(S.x,S.y,S.z,h)}this.hasTangents=!0},computeBoundingBox:function(){var b;
- if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
- else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,d=this.vertices.length;c<d;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}function c(b,c,d){b[c]===
- void 0?(b[c]={set:{},array:[]},b[c].set[d]=1,b[c].array.push(d)):b[c].set[d]===void 0&&(b[c].set[d]=1,b[c].array.push(d))}var d,e,h,g,j,k={};d=0;for(e=this.faces.length;d<e;d++)j=this.faces[d],j instanceof THREE.Face3?(h=b(j.a,j.b),c(k,h,d),h=b(j.b,j.c),c(k,h,d),h=b(j.a,j.c),c(k,h,d)):j instanceof THREE.Face4&&(h=b(j.b,j.d),c(k,h,d),h=b(j.a,j.b),c(k,h,d),h=b(j.a,j.d),c(k,h,d),h=b(j.b,j.c),c(k,h,d),h=b(j.c,j.d),c(k,h,d));d=0;for(e=this.edges.length;d<e;d++){j=this.edges[d];h=j.vertexIndices[0];g=j.vertexIndices[1];
- j.faceIndices=k[b(h,g)].array;for(h=0;h<j.faceIndices.length;h++)g=j.faceIndices[h],j.faces.push(this.faces[g])}}};THREE.GeometryIdCounter=0;
- THREE.Spline=function(b){function c(b,c,d,e,h,g,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*g+b*h+c}this.points=b;var d=[],e={x:0,y:0,z:0},h,g,j,k,p,o,m,r,q;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;g=Math.floor(h);j=h-g;d[0]=g==0?g:g-1;d[1]=g;d[2]=g>this.points.length-2?g:g+1;d[3]=g>this.points.length-3?g:g+2;o=this.points[d[0]];m=this.points[d[1]];
- r=this.points[d[2]];q=this.points[d[3]];k=j*j;p=j*k;e.x=c(o.x,m.x,r.x,q.x,j,k,p);e.y=c(o.y,m.y,r.y,q.y,j,k,p);e.z=c(o.z,m.z,r.z,q.z,j,k,p);return e};this.getControlPointsArray=function(){var b,c,d=this.points.length,e=[];for(b=0;b<d;b++)c=this.points[b],e[b]=[c.x,c.y,c.z];return e};this.getLength=function(b){var c,d,e=c=c=0,h=new THREE.Vector3,g=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);d=this.points.length*b;h.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),g.copy(position),
- k+=g.distanceTo(h),h.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=e&&(j[c]=k,e=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,d,e,h,g,j,k=[],o=new THREE.Vector3,p=this.getLength();k.push(o.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=p.chunks[c]-p.chunks[c-1];j=Math.ceil(b*d/p.total);h=(c-1)/(this.points.length-1);g=c/(this.points.length-1);for(d=1;d<j-1;d++)e=h+d*(1/j)*(g-h),position=this.getPoint(e),k.push(o.copy(position).clone());
- k.push(o.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,d,e){this.vertices=[b,c];this.vertexIndices=[d,e];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,d,e,h){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=d||0.1;this.far=e||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
- THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
- THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,d=-c,e=b*d,b=Math.abs(b*c-e),d=Math.abs(c-d);this.projectionMatrix=THREE.Matrix4.makeFrustum(e+this.x*b/this.fullWidth,e+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*d/this.fullHeight,c-this.y*d/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
- THREE.Camera.prototype.setViewOffset=function(b,c,d,e,h,g){this.fullWidth=b;this.fullHeight=c;this.x=d;this.y=e;this.width=h;this.height=g;this.updateProjectionMatrix()};
- THREE.Camera.prototype.update=function(b,c,d){if(this.useTarget)this.matrix.lookAt(this.position,this.target.position,this.up),this.matrix.setPosition(this.position),b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse),c=!0;else if(this.matrixAutoUpdate&&this.updateMatrix(),c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=
- !1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};THREE.OrthoCamera=function(b,c,d,e,h,g,j){THREE.Camera.call(this,45,1,h,g,j);this.left=b;this.right=c;this.top=d;this.bottom=e;this.updateProjectionMatrix()};THREE.OrthoCamera.prototype=new THREE.Camera;THREE.OrthoCamera.prototype.constructor=THREE.OrthoCamera;
- THREE.OrthoCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.Light=function(b){THREE.Object3D.call(this);this.color=new THREE.Color(b)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(b){THREE.Light.call(this,b)};THREE.AmbientLight.prototype=new THREE.Light;
- THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(b,c,d,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1;this.distance=d||0;this.castShadow=e!==void 0?e:!1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(b,c,d){THREE.Light.call(this,b);this.position=new THREE.Vector3;this.intensity=c||1;this.distance=d||0};
- THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.SpotLight=function(b,c,d,e){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.target=new THREE.Object3D;this.intensity=c||1;this.distance=d||0;this.castShadow=e!==void 0?e:!1};THREE.SpotLight.prototype=new THREE.Light;THREE.SpotLight.prototype.constructor=THREE.SpotLight;
- THREE.Material=function(b){this.id=THREE.MaterialCount++;b=b||{};this.opacity=b.opacity!==void 0?b.opacity:1;this.transparent=b.transparent!==void 0?b.transparent:!1;this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.depthTest=b.depthTest!==void 0?b.depthTest:!0;this.polygonOffset=b.polygonOffset!==void 0?b.polygonOffset:!1;this.polygonOffsetFactor=b.polygonOffsetFactor!==void 0?b.polygonOffsetFactor:0;this.polygonOffsetUnits=b.polygonOffsetUnits!==void 0?b.polygonOffsetUnits:
- 0;this.alphaTest=b.alphaTest!==void 0?b.alphaTest:0};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;
- THREE.LineBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.linewidth=b.linewidth!==void 0?b.linewidth:1;this.linecap=b.linecap!==void 0?b.linecap:"round";this.linejoin=b.linejoin!==void 0?b.linejoin:"round";this.vertexColors=b.vertexColors?b.vertexColors:!1};THREE.LineBasicMaterial.prototype=new THREE.Material;THREE.LineBasicMaterial.prototype.constructor=THREE.LineBasicMaterial;
- THREE.MeshBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.shading=b.shading!==
- void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};
- THREE.MeshBasicMaterial.prototype=new THREE.Material;THREE.MeshBasicMaterial.prototype.constructor=THREE.MeshBasicMaterial;
- THREE.MeshLambertMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.shading=b.shading!==
- void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};
- THREE.MeshLambertMaterial.prototype=new THREE.Material;THREE.MeshLambertMaterial.prototype.constructor=THREE.MeshLambertMaterial;
- THREE.MeshPhongMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.ambient=b.ambient!==void 0?new THREE.Color(b.ambient):new THREE.Color(328965);this.specular=b.specular!==void 0?new THREE.Color(b.specular):new THREE.Color(1118481);this.shininess=b.shininess!==void 0?b.shininess:30;this.map=b.map!==void 0?b.map:null;this.lightMap=b.lightMap!==void 0?b.lightMap:null;this.envMap=b.envMap!==void 0?b.envMap:null;
- this.combine=b.combine!==void 0?b.combine:THREE.MultiplyOperation;this.reflectivity=b.reflectivity!==void 0?b.reflectivity:1;this.refractionRatio=b.refractionRatio!==void 0?b.refractionRatio:0.98;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.wireframeLinecap=b.wireframeLinecap!==void 0?b.wireframeLinecap:"round";this.wireframeLinejoin=b.wireframeLinejoin!==
- void 0?b.wireframeLinejoin:"round";this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshPhongMaterial.prototype=new THREE.Material;THREE.MeshPhongMaterial.prototype.constructor=THREE.MeshPhongMaterial;
- THREE.MeshDepthMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1};THREE.MeshDepthMaterial.prototype=new THREE.Material;THREE.MeshDepthMaterial.prototype.constructor=THREE.MeshDepthMaterial;
- THREE.MeshNormalMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.shading=b.shading?b.shading:THREE.FlatShading;this.wireframe=b.wireframe?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth?b.wireframeLinewidth:1};THREE.MeshNormalMaterial.prototype=new THREE.Material;THREE.MeshNormalMaterial.prototype.constructor=THREE.MeshNormalMaterial;THREE.MeshFaceMaterial=function(){};
- THREE.MeshShaderMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.fragmentShader=b.fragmentShader!==void 0?b.fragmentShader:"void main() {}";this.vertexShader=b.vertexShader!==void 0?b.vertexShader:"void main() {}";this.uniforms=b.uniforms!==void 0?b.uniforms:{};this.attributes=b.attributes;this.shading=b.shading!==void 0?b.shading:THREE.SmoothShading;this.wireframe=b.wireframe!==void 0?b.wireframe:!1;this.wireframeLinewidth=b.wireframeLinewidth!==void 0?b.wireframeLinewidth:1;this.fog=
- b.fog!==void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1;this.skinning=b.skinning!==void 0?b.skinning:!1;this.morphTargets=b.morphTargets!==void 0?b.morphTargets:!1};THREE.MeshShaderMaterial.prototype=new THREE.Material;THREE.MeshShaderMaterial.prototype.constructor=THREE.MeshShaderMaterial;
- THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map!==void 0?b.map:null;this.size=b.size!==void 0?b.size:1;this.sizeAttenuation=b.sizeAttenuation!==void 0?b.sizeAttenuation:!0;this.vertexColors=b.vertexColors!==void 0?b.vertexColors:!1};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
- THREE.Texture=function(b,c,d,e,h,g){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=d!==void 0?d:THREE.ClampToEdgeWrapping;this.wrapT=e!==void 0?e:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=g!==void 0?g:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
- THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};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;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.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};
- THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,d){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=d!=void 0?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
- THREE.Mesh=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c&&c.length?c:[c];this.overdraw=!1;if(this.geometry&&(this.geometry.boundingSphere||this.geometry.computeBoundingSphere(),this.boundRadius=b.boundingSphere.radius,this.geometry.morphTargets.length)){this.morphTargetBase=-1;this.morphTargetForcedOrder=[];this.morphTargetInfluences=[];this.morphTargetDictionary={};for(var d=0;d<this.geometry.morphTargets.length;d++)this.morphTargetInfluences.push(0),this.morphTargetDictionary[this.geometry.morphTargets[d].name]=
- d}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;THREE.Mesh.prototype.getMorphTargetIndexByName=function(b){if(this.morphTargetDictionary[b]!==void 0)return this.morphTargetDictionary[b];console.log("THREE.Mesh.getMorphTargetIndexByName: morph target "+b+" does not exist. Returning 0.");return 0};
- THREE.Bone=function(b){THREE.Object3D.call(this);this.skin=b;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
- THREE.Bone.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.skinMatrix.multiply(b,this.matrix):this.skinMatrix.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var e,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<h;e++)b=this.children[e],b instanceof THREE.Bone?b.update(this.skinMatrix,c,d):b.update(this.matrixWorld,!0,d)}else for(e=0;e<h;e++)this.children[e].update(this.skinMatrix,
- c,d)};THREE.Bone.prototype.addChild=function(b){if(this.children.indexOf(b)===-1&&(b.parent!==void 0&&b.parent.removeChild(b),b.parent=this,this.children.push(b),!(b instanceof THREE.Bone)))this.hasNoneBoneChildren=!0};
- THREE.SkinnedMesh=function(b,c){THREE.Mesh.call(this,b,c);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];var d,e,h,g,j,k;if(this.geometry.bones!==void 0){for(d=0;d<this.geometry.bones.length;d++)h=this.geometry.bones[d],g=h.pos,j=h.rotq,k=h.scl,e=this.addBone(),e.name=h.name,e.position.set(g[0],g[1],g[2]),e.quaternion.set(j[0],j[1],j[2],j[3]),e.useQuaternion=!0,k!==void 0?e.scale.set(k[0],k[1],k[2]):e.scale.set(1,1,1);for(d=0;d<this.bones.length;d++)h=this.geometry.bones[d],
- e=this.bones[d],h.parent===-1?this.addChild(e):this.bones[h.parent].addChild(e);this.boneMatrices=new Float32Array(16*this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
- THREE.SkinnedMesh.prototype.update=function(b,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;var e,h=this.children.length;for(e=0;e<h;e++)b=this.children[e],b instanceof THREE.Bone?b.update(this.identityMatrix,!1,d):b.update(this.matrixWorld,c,d);d=this.bones.length;ba=this.bones;bm=this.boneMatrices;for(c=0;c<d;c++)ba[c].skinMatrix.flattenToArrayOffset(bm,
- c*16)}};THREE.SkinnedMesh.prototype.addBone=function(b){b===void 0&&(b=new THREE.Bone(this));this.bones.push(b);return b};
- THREE.SkinnedMesh.prototype.pose=function(){this.update(void 0,!0);for(var b,c=[],d=0;d<this.bones.length;d++)b=this.bones[d],c.push(THREE.Matrix4.makeInvert(b.skinMatrix)),b.skinMatrix.flattenToArrayOffset(this.boneMatrices,d*16);if(this.geometry.skinVerticesA===void 0){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(b=0;b<this.geometry.skinIndices.length;b++){var d=this.geometry.vertices[b].position,h=this.geometry.skinIndices[b].x,g=this.geometry.skinIndices[b].y;e=new THREE.Vector3(d.x,
- d.y,d.z);this.geometry.skinVerticesA.push(c[h].multiplyVector3(e));e=new THREE.Vector3(d.x,d.y,d.z);this.geometry.skinVerticesB.push(c[g].multiplyVector3(e));this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y!==1&&(d=(1-(this.geometry.skinWeights[b].x+this.geometry.skinWeights[b].y))*0.5,this.geometry.skinWeights[b].x+=d,this.geometry.skinWeights[b].y+=d)}}};THREE.Ribbon=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c]};
- 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.add=function(b,c){c===void 0&&(c=0);for(var c=Math.abs(c),d=0;d<this.LODs.length;d++)if(c<this.LODs[d].visibleAtDistance)break;this.LODs.splice(d,0,{visibleAtDistance:c,object3D:b});this.addChild(b)};
- THREE.LOD.prototype.update=function(b,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0;if(this.LODs.length>1){b=d.matrixWorldInverse;b=-(b.n31*this.position.x+b.n32*this.position.y+b.n33*this.position.z+b.n34);this.LODs[0].object3D.visible=!0;for(var e=1;e<this.LODs.length;e++)if(b>=this.LODs[e].visibleAtDistance)this.LODs[e-1].object3D.visible=!1,
- this.LODs[e].object3D.visible=!0;else break;for(;e<this.LODs.length;e++)this.LODs[e].object3D.visible=!1}for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,d)};
- THREE.Sprite=function(b){THREE.Object3D.call(this);if(b.material!==void 0)this.material=b.material,this.map=void 0,this.blending=material.blending;else if(b.map!==void 0)this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map),this.material=void 0,this.blending=b.blending!==void 0?b.blending:THREE.NormalBlending;this.useScreenCoordinates=b.useScreenCoordinates!==void 0?b.useScreenCoordinates:!0;this.mergeWith3D=b.mergeWith3D!==void 0?b.mergeWith3D:!this.useScreenCoordinates;
- this.affectedByDistance=b.affectedByDistance!==void 0?b.affectedByDistance:!this.useScreenCoordinates;this.scaleByViewport=b.scaleByViewport!==void 0?b.scaleByViewport:!this.affectedByDistance;this.alignment=b.alignment instanceof THREE.Vector2?b.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;
- THREE.Sprite.prototype.supr=THREE.Object3D.prototype;THREE.Sprite.prototype.updateMatrix=function(){this.matrix.setPosition(this.position);this.rotation3d.set(0,0,this.rotation);this.matrix.setRotationFromEuler(this.rotation3d);if(this.scale.x!==1||this.scale.y!==1)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);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);
- THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.collisions=this.overrideMaterial=this.fog=null;this.objects=[];this.lights=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(b){this.supr.addChild.call(this,b);this.addChildRecurse(b)};
- THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
- THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
- THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
- THREE.Projector=function(){function b(){var b=p[k]=p[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,f=b.z+b.w,h=c.z+c.w,g=-b.z+b.w,j=-c.z+c.w;return f>=0&&h>=0&&g>=0&&j>=0?!0:f<0&&h<0||g<0&&j<0?!1:(f<0?d=Math.max(d,f/(f-h)):h<0&&(e=Math.min(e,f/(f-h))),g<0?d=Math.max(d,g/(g-j)):j<0&&(e=Math.min(e,g/(g-j))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var e,h,g=[],j,k,p=[],o,m,r=[],q,v=[],C,x,E=[],K,ya,za=[],ta=new THREE.Vector4,U=new THREE.Vector4,
- t=new THREE.Matrix4,Y=new THREE.Matrix4,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],P=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(b,c){t.multiply(c.projectionMatrix,c.matrixWorldInverse);t.multiplyVector3(b);return b};this.unprojectVector=function(b,c){t.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));t.multiplyVector3(b);return b};this.projectObjects=function(b,d,j){var d=[],k,f,o;h=0;f=
- b.objects;b=0;for(k=f.length;b<k;b++){o=f[b];var p;if(!(p=!o.visible))if(p=o instanceof THREE.Mesh){a:{p=void 0;for(var m=o.matrixWorld,r=-o.geometry.boundingSphere.radius*Math.max(o.scale.x,Math.max(o.scale.y,o.scale.z)),q=0;q<6;q++)if(p=L[q].x*m.n14+L[q].y*m.n24+L[q].z*m.n34+L[q].w,p<=r){p=!1;break a}p=!0}p=!p}if(!p)p=g[h]=g[h]||new THREE.RenderableObject,h++,e=p,ta.copy(o.position),t.multiplyVector3(ta),e.object=o,e.z=ta.z,d.push(e)}j&&d.sort(c);return d};this.projectScene=function(e,h,g){var J=
- [],f=h.near,ta=h.far,ra,va,T,Z,F,V,N,la,wa,O,Aa,Ia,Fa,xa,ia,Ca,Ea;ya=x=q=m=0;h.matrixAutoUpdate&&h.update(void 0,!0);e.update(void 0,!1,h);t.multiply(h.projectionMatrix,h.matrixWorldInverse);L[0].set(t.n41-t.n11,t.n42-t.n12,t.n43-t.n13,t.n44-t.n14);L[1].set(t.n41+t.n11,t.n42+t.n12,t.n43+t.n13,t.n44+t.n14);L[2].set(t.n41+t.n21,t.n42+t.n22,t.n43+t.n23,t.n44+t.n24);L[3].set(t.n41-t.n21,t.n42-t.n22,t.n43-t.n23,t.n44-t.n24);L[4].set(t.n41-t.n31,t.n42-t.n32,t.n43-t.n33,t.n44-t.n34);L[5].set(t.n41+t.n31,
- t.n42+t.n32,t.n43+t.n33,t.n44+t.n34);for(ra=0;ra<6;ra++)wa=L[ra],wa.divideScalar(Math.sqrt(wa.x*wa.x+wa.y*wa.y+wa.z*wa.z));wa=this.projectObjects(e,h,!0);e=0;for(ra=wa.length;e<ra;e++)if(O=wa[e].object,O.visible)if(Aa=O.matrixWorld,Ia=O.matrixRotationWorld,Fa=O.materials,xa=O.overdraw,k=0,O instanceof THREE.Mesh){ia=O.geometry;Z=ia.vertices;Ca=ia.faces;ia=ia.faceVertexUvs;va=0;for(T=Z.length;va<T;va++)j=b(),j.positionWorld.copy(Z[va].position),Aa.multiplyVector3(j.positionWorld),j.positionScreen.copy(j.positionWorld),
- t.multiplyVector4(j.positionScreen),j.positionScreen.x/=j.positionScreen.w,j.positionScreen.y/=j.positionScreen.w,j.visible=j.positionScreen.z>f&&j.positionScreen.z<ta;Z=0;for(va=Ca.length;Z<va;Z++){T=Ca[Z];if(T instanceof THREE.Face3)if(F=p[T.a],V=p[T.b],N=p[T.c],F.visible&&V.visible&&N.visible&&(O.doubleSided||O.flipSided!=(N.positionScreen.x-F.positionScreen.x)*(V.positionScreen.y-F.positionScreen.y)-(N.positionScreen.y-F.positionScreen.y)*(V.positionScreen.x-F.positionScreen.x)<0))la=r[m]=r[m]||
- new THREE.RenderableFace3,m++,o=la,o.v1.copy(F),o.v2.copy(V),o.v3.copy(N);else continue;else if(T instanceof THREE.Face4)if(F=p[T.a],V=p[T.b],N=p[T.c],la=p[T.d],F.visible&&V.visible&&N.visible&&la.visible&&(O.doubleSided||O.flipSided!=((la.positionScreen.x-F.positionScreen.x)*(V.positionScreen.y-F.positionScreen.y)-(la.positionScreen.y-F.positionScreen.y)*(V.positionScreen.x-F.positionScreen.x)<0||(V.positionScreen.x-N.positionScreen.x)*(la.positionScreen.y-N.positionScreen.y)-(V.positionScreen.y-
- N.positionScreen.y)*(la.positionScreen.x-N.positionScreen.x)<0)))Ea=v[q]=v[q]||new THREE.RenderableFace4,q++,o=Ea,o.v1.copy(F),o.v2.copy(V),o.v3.copy(N),o.v4.copy(la);else continue;o.normalWorld.copy(T.normal);Ia.multiplyVector3(o.normalWorld);o.centroidWorld.copy(T.centroid);Aa.multiplyVector3(o.centroidWorld);o.centroidScreen.copy(o.centroidWorld);t.multiplyVector3(o.centroidScreen);N=T.vertexNormals;F=0;for(V=N.length;F<V;F++)la=o.vertexNormalsWorld[F],la.copy(N[F]),Ia.multiplyVector3(la);F=0;
- for(V=ia.length;F<V;F++)if(Ea=ia[F][Z]){N=0;for(la=Ea.length;N<la;N++)o.uvs[F][N]=Ea[N]}o.meshMaterials=Fa;o.faceMaterials=T.materials;o.overdraw=xa;o.z=o.centroidScreen.z;J.push(o)}}else if(O instanceof THREE.Line){Y.multiply(t,Aa);Z=O.geometry.vertices;F=b();F.positionScreen.copy(Z[0].position);Y.multiplyVector4(F.positionScreen);va=1;for(T=Z.length;va<T;va++)if(F=b(),F.positionScreen.copy(Z[va].position),Y.multiplyVector4(F.positionScreen),V=p[k-2],P.copy(F.positionScreen),Q.copy(V.positionScreen),
- d(P,Q))P.multiplyScalar(1/P.w),Q.multiplyScalar(1/Q.w),Aa=E[x]=E[x]||new THREE.RenderableLine,x++,C=Aa,C.v1.positionScreen.copy(P),C.v2.positionScreen.copy(Q),C.z=Math.max(P.z,Q.z),C.materials=O.materials,J.push(C)}else if(O instanceof THREE.Particle&&(U.set(O.matrixWorld.n14,O.matrixWorld.n24,O.matrixWorld.n34,1),t.multiplyVector4(U),U.z/=U.w,U.z>0&&U.z<1))Aa=za[ya]=za[ya]||new THREE.RenderableParticle,ya++,K=Aa,K.x=U.x/U.w,K.y=U.y/U.w,K.z=U.z,K.rotation=O.rotation.z,K.scale.x=O.scale.x*Math.abs(K.x-
- (U.x+h.projectionMatrix.n11)/(U.w+h.projectionMatrix.n14)),K.scale.y=O.scale.y*Math.abs(K.y-(U.y+h.projectionMatrix.n22)/(U.w+h.projectionMatrix.n24)),K.materials=O.materials,J.push(K);g&&J.sort(c);return J}};
- THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform int combine;\n#endif",
- envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
- map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",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\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
- 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_pars_vertex:"uniform bool enableLighting;\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#ifdef PHONG\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
- lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\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 );\nfloat pointLightWeighting = max( dot( transformedNormal, lVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting * lDistance;\n#ifdef PHONG\nvPointLight[ i ] = vec4( lVector, lDistance );\n#endif\n}\n#endif\n}",
- lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( vec3( 0.0 ), 1.0 );\nvec4 pointSpecular = vec4( vec3( 0.0 ), 1.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight * pointDistance;\npointSpecular += mSpecular * pointSpecularWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( vec3( 0.0 ), 1.0 );\nvec4 dirSpecular = vec4( vec3( 0.0 ), 1.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
- 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\nvColor = color;\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",
- 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",
- 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",
- 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\nvec4 shadowColor = vec4( 1.0 );\nfor( int i = 0; i < MAX_SHADOWS; i ++ ) {\nvec3 shadowCoord = vShadowCoord[ i ].xyz / vShadowCoord[ i ].w;\nif ( shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0 ) {\n#ifdef SHADOWMAP_SOFT\nfloat shadow = 0.0;\nfor ( float y = -1.25; y <= 1.25; y += 1.25 )\nfor ( float x = -1.25; x <= 1.25; x += 1.25 ) {\nvec4 rgbaDepth = texture2D( shadowMap[ i ], vec2( x * xPixelOffset, y * yPixelOffset ) + shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) )\nshadow += 1.0;\n}\nshadow /= 9.0;\nshadowColor = shadowColor * vec4( vec3( ( 1.0 - shadowDarkness * shadow ) ), 1.0 );\n#else\nvec4 rgbaDepth = texture2D( shadowMap[ i ], shadowCoord.xy );\nfloat fDepth = unpackDepth( rgbaDepth );\nif ( fDepth < ( shadowCoord.z + shadowBias ) )\nshadowColor = shadowColor * vec4( vec3( shadowDarkness ), 1.0 );\n#endif\n}\n}\ngl_FragColor = gl_FragColor * shadowColor;\n#endif",
- 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 ++ ) {\nvShadowCoord[ i ] = shadowMatrix[ i ] * objectMatrix * vec4( position, 1.0 );\n}\n#endif",alphatest_fragment:"#ifdef ALPHATEST\nif ( gl_FragColor.a < ALPHATEST ) discard;\n#endif"};
- THREE.UniformsUtils={merge:function(b){var c,d,e,h={};for(c=0;c<b.length;c++)for(d in e=this.clone(b[c]),e)h[d]=e[d];return h},clone:function(b){var c,d,e,h={};for(c in b)for(d in h[c]={},b[c])e=b[c][d],h[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector2||e instanceof THREE.Vector3||e instanceof THREE.Vector4||e instanceof THREE.Matrix4||e instanceof THREE.Texture?e.clone():e instanceof Array?e.slice():e;return h}};
- 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},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",value:2.5E-4},fogNear:{type:"f",
- value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightDistance:{type:"fv1",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},scale:{type:"f",
- value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},shadowmap:{shadowMap:{type:"tv",value:3,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
- THREE.ShaderLib={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:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\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 color = texture2D( map, vUV );\ncolor.a *= opacity * vVisibility;\ngl_FragColor = color;\n}\n}"},
- 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:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform sampler2D occlusionMap;\nuniform float opacity;\nuniform int renderType;\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 color = texture2D( map, vUV );\ncolor.a *= opacity * visibility;\ngl_FragColor = color;\n}\n}"},
- 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}",
- fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUV;\nvoid main() {\nvec4 color = texture2D( map, vUV );\ncolor.a *= opacity;\ngl_FragColor = color;\n}"},shadowPost:{vertexShader:"uniform \tmat4 \tprojectionMatrix;\nattribute \tvec3 \tposition;\nvoid main() {\ngl_Position = projectionMatrix * vec4( position, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform \tfloat \tdarkness;\nvoid main() {\ngl_FragColor = vec4( 0, 0, 0, darkness );\n}"},
- shadowVolumeDynamic:{uniforms:{directionalLightDirection:{type:"fv",value:[]}},vertexShader:"uniform \tvec3 \tdirectionalLightDirection;\nvoid main() {\nvec4 pos = objectMatrix * vec4( position, 1.0 );\nvec3 norm = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nvec4 extruded = vec4( directionalLightDirection * 5000.0 * step( 0.0, dot( directionalLightDirection, norm ) ), 0.0 );\ngl_Position = projectionMatrix * viewMatrix * ( pos + extruded );\n}",
- fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0 );\n}"},depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},
- normal:{uniforms:{opacity:{type:"f",value:1}},fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),
- 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,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,
- THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:[THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,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,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,
- THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,"gl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
- "}"].join("\n"),vertexShader:["varying vec3 vLightWeighting;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,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,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},phong:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,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}}]),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,
- "void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,
- THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,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 = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
- THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",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"),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")},depthRGBA:{uniforms:{},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}",vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,
- "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n")}};
- THREE.WebGLRenderer=function(b){function c(b,c,d){var e,h,g,j=b.vertices,A=j.length,k=b.colors,R=k.length,B=b.__vertexArray,D=b.__colorArray,o=b.__sortArray,p=b.__dirtyVertices,m=b.__dirtyColors,r=b.__webglCustomAttributes,q,t;if(r)for(q in r)r[q].offset=0;if(d.sortParticles){Ca.multiplySelf(d.matrixWorld);for(e=0;e<A;e++)h=j[e].position,Ja.copy(h),Ca.multiplyVector3(Ja),o[e]=[Ja.z,e];o.sort(function(b,c){return c[0]-b[0]});for(e=0;e<A;e++)h=j[o[e][1]].position,g=e*3,B[g]=h.x,B[g+1]=h.y,B[g+2]=h.z;
- for(e=0;e<R;e++)g=e*3,color=k[o[e][1]],D[g]=color.r,D[g+1]=color.g,D[g+2]=color.b;if(r)for(q in r){e=r[q];k=e.value.length;for(g=0;g<k;g++){index=o[g][1];R=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[R]=e.value[index]}else{if(e.boundTo===void 0||e.boundTo==="vertices")t=e.value[index];e.size===2?(e.array[R]=t.x,e.array[R+1]=t.y):e.size===3?e.type==="c"?(e.array[R]=t.r,e.array[R+1]=t.g,e.array[R+2]=t.b):(e.array[R]=t.x,e.array[R+1]=t.y,e.array[R+2]=t.z):(e.array[R]=
- t.x,e.array[R+1]=t.y,e.array[R+2]=t.z,e.array[R+3]=t.w)}e.offset+=e.size}}}else{if(p)for(e=0;e<A;e++)h=j[e].position,g=e*3,B[g]=h.x,B[g+1]=h.y,B[g+2]=h.z;if(m)for(e=0;e<R;e++)color=k[e],g=e*3,D[g]=color.r,D[g+1]=color.g,D[g+2]=color.b;if(r)for(q in r)if(e=r[q],e.__original.needsUpdate){k=e.value.length;for(g=0;g<k;g++){R=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[R]=e.value[g]}else{if(e.boundTo===void 0||e.boundTo==="vertices")t=e.value[g];e.size===2?(e.array[R]=
- t.x,e.array[R+1]=t.y):e.size===3?e.type==="c"?(e.array[R]=t.r,e.array[R+1]=t.g,e.array[R+2]=t.b):(e.array[R]=t.x,e.array[R+1]=t.y,e.array[R+2]=t.z):(e.array[R]=t.x,e.array[R+1]=t.y,e.array[R+2]=t.z,e.array[R+3]=t.w)}e.offset+=e.size}}}if(p||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,B,c);if(m||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,D,c);if(r)for(q in r)if(e=r[q],e.__original.needsUpdate||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,
- e.buffer),f.bufferData(f.ARRAY_BUFFER,e.array,c)}function d(b,c,d,e,h){e.program||J.initMaterial(e,c,d,h);if(e.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(J.maxMorphTargets);for(var g=0,j=J.maxMorphTargets;g<j;g++)h.__webglMorphTargetInfluences[g]=0}var g=e.program,j=g.uniforms,A=e.uniforms;g!=ra&&(f.useProgram(g),ra=g);f.uniformMatrix4fv(j.projectionMatrix,!1,Ea);if(d&&(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||
- e instanceof THREE.MeshPhongMaterial||e instanceof THREE.LineBasicMaterial||e instanceof THREE.ParticleBasicMaterial||e.fog))if(A.fogColor.value=d.color,d instanceof THREE.Fog)A.fogNear.value=d.near,A.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)A.fogDensity.value=d.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){var k,o,B,D=0,p=0,r=0,m,t,q,u=Ua,v=u.directional.colors,H=u.directional.positions,C=u.point.colors,z=u.point.positions,x=u.point.distances,
- K=0,E=0,d=o=q=0;for(k=c.length;d<k;d++)if(o=c[d],B=o.color,m=o.position,t=o.intensity,q=o.distance,o instanceof THREE.AmbientLight)D+=B.r,p+=B.g,r+=B.b;else if(o instanceof THREE.DirectionalLight)q=K*3,v[q]=B.r*t,v[q+1]=B.g*t,v[q+2]=B.b*t,H[q]=m.x,H[q+1]=m.y,H[q+2]=m.z,K+=1;else if(o instanceof THREE.SpotLight)q=K*3,v[q]=B.r*t,v[q+1]=B.g*t,v[q+2]=B.b*t,B=1/m.length(),H[q]=m.x*B,H[q+1]=m.y*B,H[q+2]=m.z*B,K+=1;else if(o instanceof THREE.PointLight)o=E*3,C[o]=B.r*t,C[o+1]=B.g*t,C[o+2]=B.b*t,z[o]=m.x,
- z[o+1]=m.y,z[o+2]=m.z,x[E]=q,E+=1;for(d=K*3;d<v.length;d++)v[d]=0;for(d=E*3;d<C.length;d++)C[d]=0;u.point.length=E;u.directional.length=K;u.ambient[0]=D;u.ambient[1]=p;u.ambient[2]=r;c=Ua;A.enableLighting.value=c.directional.length+c.point.length;A.ambientLightColor.value=c.ambient;A.directionalLightColor.value=c.directional.colors;A.directionalLightDirection.value=c.directional.positions;A.pointLightColor.value=c.point.colors;A.pointLightPosition.value=c.point.positions;A.pointLightDistance.value=
- c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)A.diffuse.value=e.color,A.opacity.value=e.opacity,(A.map.texture=e.map)&&A.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),A.lightMap.texture=e.lightMap,A.envMap.texture=e.envMap,A.reflectivity.value=e.reflectivity,A.refractionRatio.value=e.refractionRatio,A.combine.value=e.combine,A.useRefract.value=e.envMap&&e.envMap.mapping instanceof
- THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)A.diffuse.value=e.color,A.opacity.value=e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)A.psColor.value=e.color,A.opacity.value=e.opacity,A.size.value=e.size,A.scale.value=Ga.height/2,A.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)A.ambient.value=e.ambient,A.specular.value=e.specular,A.shininess.value=e.shininess;else if(e instanceof THREE.MeshDepthMaterial)A.mNear.value=b.near,A.mFar.value=b.far,A.opacity.value=
- e.opacity;else if(e instanceof THREE.MeshNormalMaterial)A.opacity.value=e.opacity;if(h.receiveShadow&&!e._shadowPass&&A.shadowMatrix){for(c=0;c<Qa.length;c++)A.shadowMatrix.value[c]=Qa[c],A.shadowMap.texture[c]=J.shadowMap[c];A.shadowDarkness.value=J.shadowMapDarkness;A.shadowBias.value=J.shadowMapBias}for(var M in A)if(k=g.uniforms[M])if(d=A[M],D=d.type,c=d.value,D=="i")f.uniform1i(k,c);else if(D=="f")f.uniform1f(k,c);else if(D=="v2")f.uniform2f(k,c.x,c.y);else if(D=="v3")f.uniform3f(k,c.x,c.y,c.z);
- else if(D=="v4")f.uniform4f(k,c.x,c.y,c.z,c.w);else if(D=="c")f.uniform3f(k,c.r,c.g,c.b);else if(D=="fv1")f.uniform1fv(k,c);else if(D=="fv")f.uniform3fv(k,c);else if(D=="v3v"){if(!d._array)d._array=new Float32Array(3*c.length);D=0;for(p=c.length;D<p;D++)r=D*3,d._array[r]=c[D].x,d._array[r+1]=c[D].y,d._array[r+2]=c[D].z;f.uniform3fv(k,d._array)}else if(D=="m4"){if(!d._array)d._array=new Float32Array(16);c.flattenToArray(d._array);f.uniformMatrix4fv(k,!1,d._array)}else if(D=="m4v"){if(!d._array)d._array=
- new Float32Array(16*c.length);D=0;for(p=c.length;D<p;D++)c[D].flattenToArrayOffset(d._array,D*16);f.uniformMatrix4fv(k,!1,d._array)}else if(D=="t"){if(f.uniform1i(k,c),k=d.texture)if(k.image instanceof Array&&k.image.length==6){if(d=k,d.image.length==6)if(d.needsUpdate){if(!d.image.__webglTextureCube)d.image.__webglTextureCube=f.createTexture();f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_CUBE_MAP,d.image.__webglTextureCube);for(c=0;c<6;c++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,
- f.RGBA,f.RGBA,f.UNSIGNED_BYTE,d.image[c]);Y(f.TEXTURE_CUBE_MAP,d,d.image[0]);d.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_CUBE_MAP,d.image.__webglTextureCube)}else k instanceof THREE.WebGLRenderTargetCube?(d=k,f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_CUBE_MAP,d.__webglTexture)):L(k,c)}else if(D=="tv"){if(!d._array){d._array=[];D=0;for(p=d.texture.length;D<p;D++)d._array[D]=c+D}f.uniform1iv(k,d._array);D=0;for(p=d.texture.length;D<p;D++)(k=d.texture[D])&&
- L(k,d._array[D])}f.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);f.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(e instanceof THREE.MeshShaderMaterial||e instanceof THREE.MeshPhongMaterial||e.envMap)&&j.cameraPosition!==null&&f.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(e instanceof THREE.MeshShaderMaterial||e.envMap||e.skinning||h.receiveShadow)&&j.objectMatrix!==null&&f.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);(e instanceof THREE.MeshPhongMaterial||
- e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshShaderMaterial||e.skinning)&&j.viewMatrix!==null&&f.uniformMatrix4fv(j.viewMatrix,!1,Ra);e.skinning&&(f.uniformMatrix4fv(j.cameraInverseMatrix,!1,Ra),f.uniformMatrix4fv(j.boneGlobalMatrices,!1,h.boneMatrices));return g}function e(b,c,e,h,g,j){if(h.opacity!=0){var k,b=d(b,c,e,h,j).attributes;if(!h.morphTargets&&b.position>=0)f.bindBuffer(f.ARRAY_BUFFER,g.__webglVertexBuffer),f.vertexAttribPointer(b.position,3,f.FLOAT,!1,0,0);else if(j.morphTargetBase){c=
- h.program.attributes;j.morphTargetBase!==-1?(f.bindBuffer(f.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0)):c.position>=0&&(f.bindBuffer(f.ARRAY_BUFFER,g.__webglVertexBuffer),f.vertexAttribPointer(c.position,3,f.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var e=0,A=j.morphTargetForcedOrder,o=j.morphTargetInfluences;e<h.numSupportedMorphTargets&&e<A.length;)f.bindBuffer(f.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[A[e]]),f.vertexAttribPointer(c["morphTarget"+
- e],3,f.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[e]=o[A[e]],e++;else{var A=[],p=-1,B=0,o=j.morphTargetInfluences,D,m=o.length,e=0;for(j.morphTargetBase!==-1&&(A[j.morphTargetBase]=!0);e<h.numSupportedMorphTargets;){for(D=0;D<m;D++)!A[D]&&o[D]>p&&(B=D,p=o[B]);f.bindBuffer(f.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[B]);f.vertexAttribPointer(c["morphTarget"+e],3,f.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[e]=p;A[B]=1;p=-1;e++}}h.program.uniforms.morphTargetInfluences!==null&&f.uniform1fv(h.program.uniforms.morphTargetInfluences,
- j.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(k in g.__webglCustomAttributes)b[k]>=0&&(c=g.__webglCustomAttributes[k],f.bindBuffer(f.ARRAY_BUFFER,c.buffer),f.vertexAttribPointer(b[k],c.size,f.FLOAT,!1,0,0));b.color>=0&&(f.bindBuffer(f.ARRAY_BUFFER,g.__webglColorBuffer),f.vertexAttribPointer(b.color,3,f.FLOAT,!1,0,0));b.normal>=0&&(f.bindBuffer(f.ARRAY_BUFFER,g.__webglNormalBuffer),f.vertexAttribPointer(b.normal,3,f.FLOAT,!1,0,0));b.tangent>=0&&(f.bindBuffer(f.ARRAY_BUFFER,g.__webglTangentBuffer),
- f.vertexAttribPointer(b.tangent,4,f.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(f.bindBuffer(f.ARRAY_BUFFER,g.__webglUVBuffer),f.vertexAttribPointer(b.uv,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv)):f.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(f.bindBuffer(f.ARRAY_BUFFER,g.__webglUV2Buffer),f.vertexAttribPointer(b.uv2,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv2)):f.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=
- 0&&(f.bindBuffer(f.ARRAY_BUFFER,g.__webglSkinVertexABuffer),f.vertexAttribPointer(b.skinVertexA,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),f.vertexAttribPointer(b.skinVertexB,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),f.vertexAttribPointer(b.skinIndex,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),f.vertexAttribPointer(b.skinWeight,4,f.FLOAT,!1,0,0));j instanceof THREE.Mesh?(h.wireframe?(f.lineWidth(h.wireframeLinewidth),
- f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),f.drawElements(f.LINES,g.__webglLineCount,f.UNSIGNED_SHORT,0)):(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),f.drawElements(f.TRIANGLES,g.__webglFaceCount,f.UNSIGNED_SHORT,0)),J.data.vertices+=g.__webglFaceCount,J.data.faces+=g.__webglFaceCount/3,J.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?f.LINE_STRIP:f.LINES,f.lineWidth(h.linewidth),f.drawArrays(j,0,g.__webglLineCount),J.data.drawCalls++):j instanceof
- THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,g.__webglParticleCount),J.data.drawCalls++):j instanceof THREE.Ribbon&&(f.drawArrays(f.TRIANGLE_STRIP,0,g.__webglVertexCount),J.data.drawCalls++)}}function h(b,c,d){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=f.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=f.createBuffer();b.hasPos&&(f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,b.positionArray,f.DYNAMIC_DRAW),f.enableVertexAttribArray(c.attributes.position),
- f.vertexAttribPointer(c.attributes.position,3,f.FLOAT,!1,0,0));if(b.hasNormal){f.bindBuffer(f.ARRAY_BUFFER,b.__webglNormalBuffer);if(d==THREE.FlatShading){var e,g,h,j,k,o,p,B,D,m,r=b.count*3;for(m=0;m<r;m+=9)d=b.normalArray,e=d[m],g=d[m+1],h=d[m+2],j=d[m+3],o=d[m+4],B=d[m+5],k=d[m+6],p=d[m+7],D=d[m+8],e=(e+j+k)/3,g=(g+o+p)/3,h=(h+B+D)/3,d[m]=e,d[m+1]=g,d[m+2]=h,d[m+3]=e,d[m+4]=g,d[m+5]=h,d[m+6]=e,d[m+7]=g,d[m+8]=h}f.bufferData(f.ARRAY_BUFFER,b.normalArray,f.DYNAMIC_DRAW);f.enableVertexAttribArray(c.attributes.normal);
- f.vertexAttribPointer(c.attributes.normal,3,f.FLOAT,!1,0,0)}f.drawArrays(f.TRIANGLES,0,b.count);b.count=0}function g(b){if(Z!=b.doubleSided)b.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE),Z=b.doubleSided;if(F!=b.flipSided)b.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW),F=b.flipSided}function j(b){N!=b&&(b?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),N=b)}function k(b,c,d){la!=b&&(b?f.enable(f.POLYGON_OFFSET_FILL):f.disable(f.POLYGON_OFFSET_FILL),la=b);if(b&&(wa!=c||O!=d))f.polygonOffset(c,
- d),wa=c,O=d}function p(b){ia[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ia[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ia[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ia[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ia[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ia[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=ia[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function o(b){for(var c=b.matrixWorld,d=
- -b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ia[f].x*c.n14+ia[f].y*c.n24+ia[f].z*c.n34+ia[f].w,b<=d)return!1;return!0}function m(b,c){b.list[b.count]=c;b.count+=1}function r(b){var c,d,f=b.object,e=b.opaque,g=b.transparent;g.count=0;b=e.count=0;for(c=f.materials.length;b<c;b++)d=f.materials[b],d.transparent?m(g,d):m(e,d)}function q(b){var c,d,f,e,g=b.object,h=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(f=g.materials.length;b<
- f;b++)if(c=g.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(d=h.materials.length;c<d;c++)(e=h.materials[c])&&(e.transparent?m(k,e):m(j,e))}else(e=c)&&(e.transparent?m(k,e):m(j,e))}function v(b,c){return c.z-b.z}function C(b,c){var k,Ta,G,m=0,fa,A,r,q,B=b.lights;W||(W=new THREE.Camera(J.shadowCameraFov,c.aspect,J.shadowCameraNear,J.shadowCameraFar));k=0;for(Ta=B.length;k<Ta;k++)if(G=B[k],G instanceof THREE.SpotLight&&G.castShadow){J.shadowMap[m]||(J.shadowMap[m]=new THREE.WebGLRenderTarget(J.shadowMapWidth,
- J.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Qa[m]||(Qa[m]=new THREE.Matrix4);fa=J.shadowMap[m];A=Qa[m];W.position.copy(G.position);W.target.position.copy(G.target.position);W.update(void 0,!0);b.update(void 0,!1,W);A.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);A.multiplySelf(W.projectionMatrix);A.multiplySelf(W.matrixWorldInverse);W.matrixWorldInverse.flattenToArray(Ra);W.projectionMatrix.flattenToArray(Ea);Ca.multiply(W.projectionMatrix,
- W.matrixWorldInverse);p(Ca);J.initWebGLObjects(b);P(fa);f.clearColor(1,1,1,1);J.clear();f.clearColor(ua.r,ua.g,ua.b,Pa);A=b.__webglObjects.length;G=b.__webglObjectsImmediate.length;for(fa=0;fa<A;fa++)r=b.__webglObjects[fa],q=r.object,q.visible&&q.castShadow?!(q instanceof THREE.Mesh)||o(q)?(q.matrixWorld.flattenToArray(q._objectMatrixArray),E(q,W,!1),r.render=!0):r.render=!1:r.render=!1;j(!0);t(THREE.NormalBlending);for(fa=0;fa<A;fa++)if(r=b.__webglObjects[fa],r.render)q=r.object,buffer=r.buffer,
- g(q),r=q.customDepthMaterial?q.customDepthMaterial:q.geometry.morphTargets.length?Va:Sa,e(W,B,null,r,buffer,q);for(fa=0;fa<G;fa++)r=b.__webglObjectsImmediate[fa],q=r.object,q.visible&&q.castShadow&&(q.matrixAutoUpdate&&q.matrixWorld.flattenToArray(q._objectMatrixArray),E(q,W,!1),g(q),program=d(W,B,null,Sa,q),q.render(function(b){h(b,program,Sa.shading)}));m++}}function x(b,c){var d,e,g;d=u.attributes;var h=u.uniforms,j=xa/Fa,k,o=[],m=Fa*0.5,p=xa*0.5,D=!0;f.useProgram(u.program);ra=u.program;N=V=-1;
- Wa||(f.enableVertexAttribArray(u.attributes.position),f.enableVertexAttribArray(u.attributes.uv),Wa=!0);f.disable(f.CULL_FACE);f.enable(f.BLEND);f.depthMask(!0);f.bindBuffer(f.ARRAY_BUFFER,u.vertexBuffer);f.vertexAttribPointer(d.position,2,f.FLOAT,!1,16,0);f.vertexAttribPointer(d.uv,2,f.FLOAT,!1,16,8);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.uniformMatrix4fv(h.projectionMatrix,!1,Ea);f.activeTexture(f.TEXTURE0);f.uniform1i(h.map,0);d=0;for(e=b.__webglSprites.length;d<e;d++)g=b.__webglSprites[d],
- g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(v);d=0;for(e=b.__webglSprites.length;d<e;d++)g=b.__webglSprites[d],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(f.uniform1i(h.useScreenCoordinates,1),f.uniform3f(h.screenPosition,(g.position.x-m)/m,(p-g.position.y)/p,Math.max(0,Math.min(1,g.position.z)))):(f.uniform1i(h.useScreenCoordinates,
- 0),f.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),f.uniformMatrix4fv(h.modelViewMatrix,!1,g._modelViewMatrixArray)),k=g.map.image.width/(g.scaleByViewport?xa:1),o[0]=k*j*g.scale.x,o[1]=k*g.scale.y,f.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),f.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),f.uniform2f(h.alignment,g.alignment.x,g.alignment.y),f.uniform1f(h.opacity,g.opacity),f.uniform1f(h.rotation,g.rotation),f.uniform2fv(h.scale,o),g.mergeWith3D&&!D?(f.enable(f.DEPTH_TEST),D=!0):!g.mergeWith3D&&
- D&&(f.disable(f.DEPTH_TEST),D=!1),t(g.blending),L(g.map,0),f.drawElements(f.TRIANGLES,6,f.UNSIGNED_SHORT,0));f.enable(f.CULL_FACE);f.enable(f.DEPTH_TEST);f.depthMask(T)}function E(b,c,d){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);d&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function K(b){var c,d,f,e;e=b.__materials;b=0;for(d=e.length;b<d;b++)if(f=e[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;
- return!1}function ya(b){var c,d,f,e;e=b.__materials;b=0;for(d=e.length;b<d;b++)if(f=e[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function za(b,c){var d;for(d=b.length-1;d>=0;d--)b[d].object==c&&b.splice(d,1)}function ta(b){function c(b){var e=[];d=0;for(f=b.length;d<f;d++)b[d]==void 0?e.push("undefined"):e.push(b[d].id);return e.join("_")}var d,f,e,g,h,j,k,o,m={},D=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};e=0;for(g=b.faces.length;e<g;e++)h=b.faces[e],
- j=h.materials,k=c(j),m[k]==void 0&&(m[k]={hash:k,counter:0}),o=m[k].hash+"_"+m[k].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:j,vertices:0,numMorphTargets:D}),h=h instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+h>65535&&(m[k].counter+=1,o=m[k].hash+"_"+m[k].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:j,vertices:0,numMorphTargets:D})),b.geometryGroups[o].faces.push(e),b.geometryGroups[o].vertices+=h}function U(b,c,d){b.push({buffer:c,
- object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function t(b){if(b!=V){switch(b){case THREE.AdditiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE);break;case THREE.SubtractiveBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:f.blendEquation(f.FUNC_ADD);f.blendFunc(f.ZERO,f.SRC_COLOR);break;default:f.blendEquationSeparate(f.FUNC_ADD,f.FUNC_ADD),f.blendFuncSeparate(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA,
- f.ONE,f.ONE_MINUS_SRC_ALPHA)}V=b}}function Y(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(f.texParameteri(b,f.TEXTURE_WRAP_S,S(c.wrapS)),f.texParameteri(b,f.TEXTURE_WRAP_T,S(c.wrapT)),f.texParameteri(b,f.TEXTURE_MAG_FILTER,S(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,S(c.minFilter)),f.generateMipmap(b)):(f.texParameteri(b,f.TEXTURE_WRAP_S,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_WRAP_T,f.CLAMP_TO_EDGE),f.texParameteri(b,f.TEXTURE_MAG_FILTER,qa(c.magFilter)),f.texParameteri(b,
- f.TEXTURE_MIN_FILTER,qa(c.minFilter)))}function L(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=f.createTexture(),b.__webglInit=!0;f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?f.texImage2D(f.TEXTURE_2D,0,S(b.format),b.image.width,b.image.height,0,S(b.format),f.UNSIGNED_BYTE,b.image.data):f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b.image);Y(f.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+
- c),f.bindTexture(f.TEXTURE_2D,b.__webglTexture)}function P(b){var c=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=f.createRenderbuffer();b.__webglTexture=f.createTexture();if(c){f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture);Y(f.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var d=0;d<6;d++)b.__webglFramebuffer[d]=f.createFramebuffer(),f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+
- d,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null)}else b.__webglFramebuffer=f.createFramebuffer(),f.bindTexture(f.TEXTURE_2D,b.__webglTexture),Y(f.TEXTURE_2D,b,b),f.texImage2D(f.TEXTURE_2D,0,S(b.format),b.width,b.height,0,S(b.format),S(b.type),null);f.bindRenderbuffer(f.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(d=0;d<6;++d)f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer[d]),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_CUBE_MAP_POSITIVE_X+d,b.__webglTexture,
- 0);else f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,f.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,b.width,b.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,
- f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,b.__webglRenderbuffer)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,b.width,b.height);c?f.bindTexture(f.TEXTURE_CUBE_MAP,null):f.bindTexture(f.TEXTURE_2D,null);f.bindRenderbuffer(f.RENDERBUFFER,null);f.bindFramebuffer(f.FRAMEBUFFER,null)}b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,d=b.width,b=b.height):(c=null,d=Fa,b=xa);c!=va&&(f.bindFramebuffer(f.FRAMEBUFFER,c),f.viewport(Aa,Ia,d,b),va=c)}function Q(b){b instanceof THREE.WebGLRenderTargetCube?
- (f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture),f.generateMipmap(f.TEXTURE_CUBE_MAP),f.bindTexture(f.TEXTURE_CUBE_MAP,null)):(f.bindTexture(f.TEXTURE_2D,b.__webglTexture),f.generateMipmap(f.TEXTURE_2D),f.bindTexture(f.TEXTURE_2D,null))}function ha(b,c){var d;b=="fragment"?d=f.createShader(f.FRAGMENT_SHADER):b=="vertex"&&(d=f.createShader(f.VERTEX_SHADER));f.shaderSource(d,c);f.compileShader(d);if(!f.getShaderParameter(d,f.COMPILE_STATUS))return console.error(f.getShaderInfoLog(d)),console.error(c),
- null;return d}function qa(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;default:return f.LINEAR}}function S(b){switch(b){case THREE.RepeatWrapping:return f.REPEAT;case THREE.ClampToEdgeWrapping:return f.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return f.MIRRORED_REPEAT;case THREE.NearestFilter:return f.NEAREST;case THREE.NearestMipMapNearestFilter:return f.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return f.NEAREST_MIPMAP_LINEAR;
- case THREE.LinearFilter:return f.LINEAR;case THREE.LinearMipMapNearestFilter:return f.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return f.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return f.BYTE;case THREE.UnsignedByteType:return f.UNSIGNED_BYTE;case THREE.ShortType:return f.SHORT;case THREE.UnsignedShortType:return f.UNSIGNED_SHORT;case THREE.IntType:return f.INT;case THREE.UnsignedShortType:return f.UNSIGNED_INT;case THREE.FloatType:return f.FLOAT;case THREE.AlphaFormat:return f.ALPHA;
- case THREE.RGBFormat:return f.RGB;case THREE.RGBAFormat:return f.RGBA;case THREE.LuminanceFormat:return f.LUMINANCE;case THREE.LuminanceAlphaFormat:return f.LUMINANCE_ALPHA}return 0}var J=this,f,Ba=[],ra=null,va=null,T=!0,Z=null,F=null,V=null,N=null,la=null,wa=null,O=null,Aa=0,Ia=0,Fa=0,xa=0,ia=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Ea=new Float32Array(16),Ra=new Float32Array(16),Ja=new THREE.Vector4,Ua={ambient:[0,
- 0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ga=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Za=b.stencil!==void 0?b.stencil:!0,$a=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ab=b.antialias!==void 0?b.antialias:!1,ua=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),Pa=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,
- drawCalls:0};this.maxMorphTargets=8;this.domElement=Ga;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=!0;var W,Qa=[],b=THREE.ShaderLib.depthRGBA,Xa=THREE.UniformsUtils.clone(b.uniforms),Sa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Xa}),
- Va=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Xa,morphTargets:!0});Sa._shadowPass=!0;Va._shadowPass=!0;try{if(!(f=Ga.getContext("experimental-webgl",{antialias:ab,stencil:Za,preserveDrawingBuffer:$a})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+f.getParameter(f.VERSION)+" | "+f.getParameter(f.VENDOR)+" | "+f.getParameter(f.RENDERER)+" | "+f.getParameter(f.SHADING_LANGUAGE_VERSION))}catch(bb){console.error(bb)}f.clearColor(0,
- 0,0,1);f.clearDepth(1);f.enable(f.DEPTH_TEST);f.depthFunc(f.LEQUAL);f.frontFace(f.CCW);f.cullFace(f.BACK);f.enable(f.CULL_FACE);f.enable(f.BLEND);f.blendEquation(f.FUNC_ADD);f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA);f.clearColor(ua.r,ua.g,ua.b,Pa);this.context=f;var Ya=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,u={};u.vertices=new Float32Array(16);u.faces=new Uint16Array(6);i=0;u.vertices[i++]=-1;u.vertices[i++]=-1;u.vertices[i++]=0;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=
- -1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=1;u.vertices[i++]=0;u.vertices[i++]=-1;u.vertices[i++]=1;u.vertices[i++]=0;i=u.vertices[i++]=0;u.faces[i++]=0;u.faces[i++]=1;u.faces[i++]=2;u.faces[i++]=0;u.faces[i++]=2;u.faces[i++]=3;u.vertexBuffer=f.createBuffer();u.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,u.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,u.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,u.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,
- u.faces,f.STATIC_DRAW);u.program=f.createProgram();f.attachShader(u.program,ha("fragment",THREE.ShaderLib.sprite.fragmentShader));f.attachShader(u.program,ha("vertex",THREE.ShaderLib.sprite.vertexShader));f.linkProgram(u.program);u.attributes={};u.uniforms={};u.attributes.position=f.getAttribLocation(u.program,"position");u.attributes.uv=f.getAttribLocation(u.program,"uv");u.uniforms.uvOffset=f.getUniformLocation(u.program,"uvOffset");u.uniforms.uvScale=f.getUniformLocation(u.program,"uvScale");u.uniforms.rotation=
- f.getUniformLocation(u.program,"rotation");u.uniforms.scale=f.getUniformLocation(u.program,"scale");u.uniforms.alignment=f.getUniformLocation(u.program,"alignment");u.uniforms.map=f.getUniformLocation(u.program,"map");u.uniforms.opacity=f.getUniformLocation(u.program,"opacity");u.uniforms.useScreenCoordinates=f.getUniformLocation(u.program,"useScreenCoordinates");u.uniforms.affectedByDistance=f.getUniformLocation(u.program,"affectedByDistance");u.uniforms.screenPosition=f.getUniformLocation(u.program,
- "screenPosition");u.uniforms.modelViewMatrix=f.getUniformLocation(u.program,"modelViewMatrix");u.uniforms.projectionMatrix=f.getUniformLocation(u.program,"projectionMatrix");var Wa=!1;this.setSize=function(b,c){Ga.width=b;Ga.height=c;this.setViewport(0,0,Ga.width,Ga.height)};this.setViewport=function(b,c,d,e){Aa=b;Ia=c;Fa=d;xa=e;f.viewport(Aa,Ia,Fa,xa)};this.setScissor=function(b,c,d,e){f.scissor(b,c,d,e)};this.enableScissorTest=function(b){b?f.enable(f.SCISSOR_TEST):f.disable(f.SCISSOR_TEST)};this.enableDepthBufferWrite=
- function(b){T=b;f.depthMask(b)};this.setClearColorHex=function(b,c){ua.setHex(b);Pa=c;f.clearColor(ua.r,ua.g,ua.b,Pa)};this.setClearColor=function(b,c){ua.copy(b);Pa=c;f.clearColor(ua.r,ua.g,ua.b,Pa)};this.clear=function(){f.clear(f.COLOR_BUFFER_BIT|f.DEPTH_BUFFER_BIT|f.STENCIL_BUFFER_BIT)};this.getContext=function(){return f};this.initMaterial=function(b,c,d,e){var g,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?
- j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var o,m,p;o=p=k=0;for(m=c.length;o<m;o++)h=c[o],h instanceof THREE.SpotLight&&p++,h instanceof THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&
- k++;k+p<=_maxLights?o=p:(o=Math.ceil(_maxLights*p/(k+p)),k=_maxLights-o);h={directional:o,point:k};k=p=0;for(o=c.length;k<o;k++)m=c[k],m instanceof THREE.SpotLight&&m.castShadow&&p++;var D=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)D=e.bones.length;var q;a:{o=b.fragmentShader;m=b.vertexShader;var k=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,
- maxMorphTargets:this.maxMorphTargets,maxDirLights:h.directional,maxPointLights:h.point,maxBones:D,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:b.alphaTest},r,e=[];j?e.push(j):(e.push(o),e.push(m));for(r in d)e.push(r),e.push(d[r]);j=e.join();r=0;for(e=Ba.length;r<e;r++)if(Ba[r].code==j){q=Ba[r].program;break a}r=f.createProgram();e=[Ya?"#define VERTEX_TEXTURES":
- "","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,"#define MAX_BONES "+d.maxBones,d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.skinning?"#define USE_SKINNING":"",d.morphTargets?"#define USE_MORPHTARGETS":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":"",d.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");
- h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+d.maxDirLights,"#define MAX_POINT_LIGHTS "+d.maxPointLights,"#define MAX_SHADOWS "+d.maxShadows,d.alphaTest?"#define ALPHATEST "+d.alphaTest:"",d.fog?"#define USE_FOG":"",d.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",d.map?"#define USE_MAP":"",d.envMap?"#define USE_ENVMAP":"",d.lightMap?"#define USE_LIGHTMAP":"",d.vertexColors?"#define USE_COLOR":"",d.shadowMapEnabled?"#define USE_SHADOWMAP":"",d.shadowMapSoft?"#define SHADOWMAP_SOFT":
- "",d.shadowMapSoft?"#define SHADOWMAP_WIDTH "+d.shadowMapWidth.toFixed(1):"",d.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+d.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");f.attachShader(r,ha("fragment",h+o));f.attachShader(r,ha("vertex",e+m));f.linkProgram(r);f.getProgramParameter(r,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(r,f.VALIDATE_STATUS)+", gl error ["+f.getError()+"]");r.uniforms=
- {};r.attributes={};var t,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(t in k)e.push(t);t=e;e=0;for(k=t.length;e<k;e++)o=t[e],r.uniforms[o]=f.getUniformLocation(r,o);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(t=0;t<d.maxMorphTargets;t++)e.push("morphTarget"+t);for(q in c)e.push(q);q=e;t=0;for(c=q.length;t<c;t++)d=
- q[t],r.attributes[d]=f.getAttribLocation(r,d);Ba.push({program:r,code:j});q=r}b.program=q;q=b.program.attributes;q.position>=0&&f.enableVertexAttribArray(q.position);q.color>=0&&f.enableVertexAttribArray(q.color);q.normal>=0&&f.enableVertexAttribArray(q.normal);q.tangent>=0&&f.enableVertexAttribArray(q.tangent);b.skinning&&q.skinVertexA>=0&&q.skinVertexB>=0&&q.skinIndex>=0&&q.skinWeight>=0&&(f.enableVertexAttribArray(q.skinVertexA),f.enableVertexAttribArray(q.skinVertexB),f.enableVertexAttribArray(q.skinIndex),
- f.enableVertexAttribArray(q.skinWeight));if(b.attributes)for(g in b.attributes)q[g]!==void 0&&q[g]>=0&&f.enableVertexAttribArray(q[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)t="morphTarget"+g,q[t]>=0&&(f.enableVertexAttribArray(q[t]),b.numSupportedMorphTargets++)};this.render=function(b,c,f,m){var G,u,fa,A,K,R,B,D,F=b.lights,Oa=b.fog;this.shadowMapEnabled&&C(b,c);J.data.vertices=0;J.data.faces=0;J.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
- !1,c);c.matrixWorldInverse.flattenToArray(Ra);c.projectionMatrix.flattenToArray(Ea);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);p(Ca);this.initWebGLObjects(b);P(f);(this.autoClear||m)&&this.clear();K=b.__webglObjects.length;for(m=0;m<K;m++)if(G=b.__webglObjects[m],B=G.object,B.visible)if(!(B instanceof THREE.Mesh)||o(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),q(G),G.render=!0,this.sortObjects)G.object.renderDepth?G.z=G.object.renderDepth:(Ja.copy(B.position),Ca.multiplyVector3(Ja),
- G.z=Ja.z)}else G.render=!1;else G.render=!1;this.sortObjects&&b.__webglObjects.sort(v);R=b.__webglObjectsImmediate.length;for(m=0;m<R;m++)G=b.__webglObjectsImmediate[m],B=G.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),r(G));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);t(b.overrideMaterial.blending);for(m=0;m<K;m++)if(G=b.__webglObjects[m],G.render)B=G.object,D=G.buffer,g(B),e(c,F,Oa,b.overrideMaterial,D,B);for(m=0;m<R;m++)G=b.__webglObjectsImmediate[m],
- B=G.object,B.visible&&(g(B),u=d(c,F,Oa,b.overrideMaterial,B),B.render(function(c){h(c,u,b.overrideMaterial.shading)}))}else{t(THREE.NormalBlending);for(m=K-1;m>=0;m--)if(G=b.__webglObjects[m],G.render){B=G.object;D=G.buffer;fa=G.opaque;g(B);for(G=0;G<fa.count;G++)A=fa.list[G],j(A.depthTest),k(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),e(c,F,Oa,A,D,B)}for(m=0;m<R;m++)if(G=b.__webglObjectsImmediate[m],B=G.object,B.visible){fa=G.opaque;g(B);for(G=0;G<fa.count;G++)A=fa.list[G],j(A.depthTest),
- k(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),u=d(c,F,Oa,A,B),B.render(function(b){h(b,u,A.shading)})}for(m=0;m<K;m++)if(G=b.__webglObjects[m],G.render){B=G.object;D=G.buffer;fa=G.transparent;g(B);for(G=0;G<fa.count;G++)A=fa.list[G],t(A.blending),j(A.depthTest),k(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),e(c,F,Oa,A,D,B)}for(m=0;m<R;m++)if(G=b.__webglObjectsImmediate[m],B=G.object,B.visible){fa=G.transparent;g(B);for(G=0;G<fa.count;G++)A=fa.list[G],t(A.blending),j(A.depthTest),
- k(A.polygonOffset,A.polygonOffsetFactor,A.polygonOffsetUnits),u=d(c,F,Oa,A,B),B.render(function(b){h(b,u,A.shading)})}}b.__webglSprites.length&&x(b,c);f&&f.minFilter!==THREE.NearestFilter&&f.minFilter!==THREE.LinearFilter&&Q(f)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var d=b.__objectsAdded[0],e=b,g=void 0,h=void 0,j=void 0;if(d._modelViewMatrix==void 0)d._modelViewMatrix=new THREE.Matrix4,
- d._normalMatrixArray=new Float32Array(9),d._modelViewMatrixArray=new Float32Array(16),d._objectMatrixArray=new Float32Array(16),d.matrixWorld.flattenToArray(d._objectMatrixArray);if(d instanceof THREE.Mesh)for(g in h=d.geometry,h.geometryGroups==void 0&&ta(h),h.geometryGroups){j=h.geometryGroups[g];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=f.createBuffer();k.__webglNormalBuffer=f.createBuffer();k.__webglTangentBuffer=f.createBuffer();k.__webglColorBuffer=f.createBuffer();k.__webglUVBuffer=
- f.createBuffer();k.__webglUV2Buffer=f.createBuffer();k.__webglSkinVertexABuffer=f.createBuffer();k.__webglSkinVertexBBuffer=f.createBuffer();k.__webglSkinIndicesBuffer=f.createBuffer();k.__webglSkinWeightsBuffer=f.createBuffer();k.__webglFaceBuffer=f.createBuffer();k.__webglLineBuffer=f.createBuffer();if(k.numMorphTargets){var m=void 0,o=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(o=k.numMorphTargets;m<o;m++)k.__webglMorphTargetsBuffers.push(f.createBuffer())}for(var k=j,m=d,q=void 0,r=void 0,
- p=void 0,t=p=void 0,u=void 0,v=void 0,C=v=o=0,x=p=r=void 0,E=x=r=q=void 0,p=void 0,t=m.geometry,u=t.faces,x=k.faces,q=0,r=x.length;q<r;q++)p=x[q],p=u[p],p instanceof THREE.Face3?(o+=3,v+=1,C+=3):p instanceof THREE.Face4&&(o+=4,v+=2,C+=4);for(var q=k,r=m,I=x=u=void 0,H=void 0,I=void 0,p=[],u=0,x=r.materials.length;u<x;u++)if(I=r.materials[u],I instanceof THREE.MeshFaceMaterial){I=0;for(l=q.materials.length;I<l;I++)(H=q.materials[I])&&p.push(H)}else(H=I)&&p.push(H);q=p;k.__materials=q;a:{u=r=void 0;
- x=q.length;for(r=0;r<x;r++)if(u=q[r],u.map||u.lightMap||u instanceof THREE.MeshShaderMaterial){r=!0;break a}r=!1}a:{x=u=void 0;p=q.length;for(u=0;u<p;u++)if(x=q[u],!(x instanceof THREE.MeshBasicMaterial&&!x.envMap||x instanceof THREE.MeshDepthMaterial)){x=x&&x.shading!=void 0&&x.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}x=!1}a:{p=u=void 0;I=q.length;for(u=0;u<I;u++)if(p=q[u],p.vertexColors){p=p.vertexColors;break a}p=!1}k.__vertexArray=new Float32Array(o*3);if(x)k.__normalArray=
- new Float32Array(o*3);if(t.hasTangents)k.__tangentArray=new Float32Array(o*4);if(p)k.__colorArray=new Float32Array(o*3);if(r){if(t.faceUvs.length>0||t.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(t.faceUvs.length>1||t.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4),k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=
- new Float32Array(o*4);k.__faceArray=new Uint16Array(v*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(C*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];t=0;for(u=k.numMorphTargets;t<u;t++)k.__morphTargetsArrays.push(new Float32Array(o*3))}k.__needsSmoothNormals=x==THREE.SmoothShading;k.__uvType=r;k.__vertexColorType=p;k.__normalType=x;k.__webglFaceCount=v*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=C*2;t=0;for(u=q.length;t<
- u;t++)if(r=q[t],r.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in r.attributes){p=r.attributes[a];x={};for(E in p)x[E]=p[E];if(!x.__webglInitialized||x.createUniqueBuffers)x.__webglInitialized=!0,v=1,x.type==="v2"?v=2:x.type==="v3"?v=3:x.type==="v4"?v=4:x.type==="c"&&(v=3),x.size=v,x.array=new Float32Array(o*v),x.buffer=f.createBuffer(),x.buffer.belongsToAttribute=a,p.needsUpdate=!0,x.__original=p;k.__webglCustomAttributes[a]=x}}k.__inittedArrays=!0;h.__dirtyVertices=
- !0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}U(e.__webglObjects,j,d)}else if(d instanceof THREE.Ribbon){h=d.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=f.createBuffer(),g.__webglColorBuffer=f.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*3),g.__webglVertexCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;U(e.__webglObjects,h,d)}else if(d instanceof
- THREE.Line){h=d.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=f.createBuffer(),g.__webglColorBuffer=f.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*3),g.__webglLineCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;U(e.__webglObjects,h,d)}else if(d instanceof THREE.ParticleSystem){h=d.geometry;if(!h.__webglVertexBuffer){g=h;g.__webglVertexBuffer=f.createBuffer();g.__webglColorBuffer=f.createBuffer();g=h;j=d;k=g.vertices.length;
- g.__vertexArray=new Float32Array(k*3);g.__colorArray=new Float32Array(k*3);g.__sortArray=[];g.__webglParticleCount=k;g.__materials=j.materials;E=o=m=void 0;m=0;for(o=j.materials.length;m<o;m++)if(E=j.materials[m],E.attributes){if(g.__webglCustomAttributes===void 0)g.__webglCustomAttributes={};for(a in E.attributes){originalAttribute=E.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=
- !0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=f.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;g.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=!0;h.__dirtyColors=!0}U(e.__webglObjects,h,d)}else THREE.MarchingCubes!==void 0&&d instanceof THREE.MarchingCubes?
- e.__webglObjectsImmediate.push({object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}}):d instanceof THREE.Sprite&&e.__webglSprites.push(d);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];d=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)za(d.__webglObjects,e);else if(e instanceof THREE.Sprite){d=d.__webglSprites;h=void 0;for(h=d.length-1;h>=0;h--)d[h]==e&&d.splice(h,1)}else e instanceof
- THREE.MarchingCubes&&za(d.__webglObjectsImmediate,e);b.__objectsRemoved.splice(0,1)}d=0;for(e=b.__webglObjects.length;d<e;d++)if(g=b.__webglObjects[d].object,m=k=h=j=void 0,g instanceof THREE.Mesh){h=g.geometry;for(j in h.geometryGroups)if(k=h.geometryGroups[j],m=K(k),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||m)if(m=k,o=f.DYNAMIC_DRAW,E=!h.dynamic,m.__inittedArrays){var F=C=v=void 0,z=void 0,J=F=void 0,ga=void 0,
- O=void 0,M=void 0,L=H=I=p=x=u=r=q=t=void 0,s=z=M=z=O=ga=void 0,n=void 0,y=n=s=ga=void 0,N=void 0,S=y=n=s=F=F=J=M=z=y=n=s=N=y=n=s=N=y=n=s=void 0,ja=0,ma=0,V=0,Y=0,T=0,P=0,X=0,Q=0,ka=0,w=0,na=0,y=s=0,y=void 0,oa=m.__vertexArray,ia=m.__uvArray,la=m.__uv2Array,W=m.__normalArray,$=m.__tangentArray,pa=m.__colorArray,aa=m.__skinVertexAArray,ca=m.__skinVertexBArray,da=m.__skinIndexArray,ea=m.__skinWeightArray,ra=m.__morphTargetsArrays,Z=m.__webglCustomAttributes,n=void 0,ha=m.__faceArray,Da=m.__lineArray,
- wa=m.__needsSmoothNormals,q=m.__vertexColorType,t=m.__uvType,r=m.__normalType,sa=g.geometry,ua=sa.__dirtyVertices,va=sa.__dirtyElements,qa=sa.__dirtyUvs,Aa=sa.__dirtyNormals,Ba=sa.__dirtyTangents,Ca=sa.__dirtyColors,Ea=sa.__dirtyMorphTargets,xa=sa.vertices,Fa=m.faces,Ia=sa.faces,Ga=sa.faceVertexUvs[0],Ja=sa.faceVertexUvs[1],La=sa.skinVerticesA,Ma=sa.skinVerticesB,Na=sa.skinIndices,Ka=sa.skinWeights,Ha=sa.morphTargets;if(Z)for(S in Z)Z[S].offset=0,Z[S].offsetSrc=0;v=0;for(C=Fa.length;v<C;v++)if(F=
- Fa[v],z=Ia[F],Ga&&(u=Ga[F]),Ja&&(x=Ja[F]),F=z.vertexNormals,J=z.normal,ga=z.vertexColors,O=z.color,M=z.vertexTangents,z instanceof THREE.Face3){if(ua)p=xa[z.a].position,I=xa[z.b].position,H=xa[z.c].position,oa[ma]=p.x,oa[ma+1]=p.y,oa[ma+2]=p.z,oa[ma+3]=I.x,oa[ma+4]=I.y,oa[ma+5]=I.z,oa[ma+6]=H.x,oa[ma+7]=H.y,oa[ma+8]=H.z,ma+=9;if(Z)for(S in Z)if(n=Z[S],n.__original.needsUpdate)s=n.offset,y=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[z.a],n.array[s+1]=n.value[z.b],
- n.array[s+2]=n.value[z.c]):n.boundTo==="faces"?(y=n.value[y],n.array[s]=y,n.array[s+1]=y,n.array[s+2]=y,n.offsetSrc++):n.boundTo==="faceVertices"&&(n.array[s]=n.value[y],n.array[s+1]=n.value[y+1],n.array[s+2]=n.value[y+2],n.offsetSrc+=3),n.offset+=3):(n.boundTo===void 0||n.boundTo==="vertices"?(p=n.value[z.a],I=n.value[z.b],H=n.value[z.c]):n.boundTo==="faces"?(H=I=p=y=n.value[y],n.offsetSrc++):n.boundTo==="faceVertices"&&(p=n.value[y],I=n.value[y+1],H=n.value[y+2],n.offsetSrc+=3),n.size===2?(n.array[s]=
- p.x,n.array[s+1]=p.y,n.array[s+2]=I.x,n.array[s+3]=I.y,n.array[s+4]=H.x,n.array[s+5]=H.y,n.offset+=6):n.size===3?(n.type==="c"?(n.array[s]=p.r,n.array[s+1]=p.g,n.array[s+2]=p.b,n.array[s+3]=I.r,n.array[s+4]=I.g,n.array[s+5]=I.b,n.array[s+6]=H.r,n.array[s+7]=H.g,n.array[s+8]=H.b):(n.array[s]=p.x,n.array[s+1]=p.y,n.array[s+2]=p.z,n.array[s+3]=I.x,n.array[s+4]=I.y,n.array[s+5]=I.z,n.array[s+6]=H.x,n.array[s+7]=H.y,n.array[s+8]=H.z),n.offset+=9):(n.array[s]=p.x,n.array[s+1]=p.y,n.array[s+2]=p.z,n.array[s+
- 3]=p.w,n.array[s+4]=I.x,n.array[s+5]=I.y,n.array[s+6]=I.z,n.array[s+7]=I.w,n.array[s+8]=H.x,n.array[s+9]=H.y,n.array[s+10]=H.z,n.array[s+11]=H.w,n.offset+=12));if(Ea){s=0;for(n=Ha.length;s<n;s++)p=Ha[s].vertices[z.a].position,I=Ha[s].vertices[z.b].position,H=Ha[s].vertices[z.c].position,y=ra[s],y[na]=p.x,y[na+1]=p.y,y[na+2]=p.z,y[na+3]=I.x,y[na+4]=I.y,y[na+5]=I.z,y[na+6]=H.x,y[na+7]=H.y,y[na+8]=H.z;na+=9}if(Ka.length)s=Ka[z.a],n=Ka[z.b],y=Ka[z.c],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=s.w,ea[w+
- 4]=n.x,ea[w+5]=n.y,ea[w+6]=n.z,ea[w+7]=n.w,ea[w+8]=y.x,ea[w+9]=y.y,ea[w+10]=y.z,ea[w+11]=y.w,s=Na[z.a],n=Na[z.b],y=Na[z.c],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=s.w,da[w+4]=n.x,da[w+5]=n.y,da[w+6]=n.z,da[w+7]=n.w,da[w+8]=y.x,da[w+9]=y.y,da[w+10]=y.z,da[w+11]=y.w,s=La[z.a],n=La[z.b],y=La[z.c],aa[w]=s.x,aa[w+1]=s.y,aa[w+2]=s.z,aa[w+3]=1,aa[w+4]=n.x,aa[w+5]=n.y,aa[w+6]=n.z,aa[w+7]=1,aa[w+8]=y.x,aa[w+9]=y.y,aa[w+10]=y.z,aa[w+11]=1,s=Ma[z.a],n=Ma[z.b],y=Ma[z.c],ca[w]=s.x,ca[w+1]=s.y,ca[w+2]=s.z,ca[w+
- 3]=1,ca[w+4]=n.x,ca[w+5]=n.y,ca[w+6]=n.z,ca[w+7]=1,ca[w+8]=y.x,ca[w+9]=y.y,ca[w+10]=y.z,ca[w+11]=1,w+=12;if(Ca&&q)ga.length==3&&q==THREE.VertexColors?(z=ga[0],s=ga[1],n=ga[2]):n=s=z=O,pa[ka]=z.r,pa[ka+1]=z.g,pa[ka+2]=z.b,pa[ka+3]=s.r,pa[ka+4]=s.g,pa[ka+5]=s.b,pa[ka+6]=n.r,pa[ka+7]=n.g,pa[ka+8]=n.b,ka+=9;if(Ba&&sa.hasTangents)ga=M[0],O=M[1],z=M[2],$[X]=ga.x,$[X+1]=ga.y,$[X+2]=ga.z,$[X+3]=ga.w,$[X+4]=O.x,$[X+5]=O.y,$[X+6]=O.z,$[X+7]=O.w,$[X+8]=z.x,$[X+9]=z.y,$[X+10]=z.z,$[X+11]=z.w,X+=12;if(Aa&&r)if(F.length==
- 3&&wa)for(M=0;M<3;M++)J=F[M],W[P]=J.x,W[P+1]=J.y,W[P+2]=J.z,P+=3;else for(M=0;M<3;M++)W[P]=J.x,W[P+1]=J.y,W[P+2]=J.z,P+=3;if(qa&&u!==void 0&&t)for(M=0;M<3;M++)F=u[M],ia[V]=F.u,ia[V+1]=F.v,V+=2;if(qa&&x!==void 0&&t)for(M=0;M<3;M++)F=x[M],la[Y]=F.u,la[Y+1]=F.v,Y+=2;va&&(ha[T]=ja,ha[T+1]=ja+1,ha[T+2]=ja+2,T+=3,Da[Q]=ja,Da[Q+1]=ja+1,Da[Q+2]=ja,Da[Q+3]=ja+2,Da[Q+4]=ja+1,Da[Q+5]=ja+2,Q+=6,ja+=3)}else if(z instanceof THREE.Face4){if(ua)p=xa[z.a].position,I=xa[z.b].position,H=xa[z.c].position,L=xa[z.d].position,
- oa[ma]=p.x,oa[ma+1]=p.y,oa[ma+2]=p.z,oa[ma+3]=I.x,oa[ma+4]=I.y,oa[ma+5]=I.z,oa[ma+6]=H.x,oa[ma+7]=H.y,oa[ma+8]=H.z,oa[ma+9]=L.x,oa[ma+10]=L.y,oa[ma+11]=L.z,ma+=12;if(Z)for(S in Z)if(n=Z[S],n.__original.needsUpdate)s=n.offset,y=n.offsetSrc,n.size===1?(n.boundTo===void 0||n.boundTo==="vertices"?(n.array[s]=n.value[z.a],n.array[s+1]=n.value[z.b],n.array[s+2]=n.value[z.c],n.array[s+3]=n.value[z.d]):n.boundTo==="faces"?(y=n.value[y],n.array[s]=y,n.array[s+1]=y,n.array[s+2]=y,n.array[s+3]=y,n.offsetSrc++):
- n.boundTo==="faceVertices"&&(n.array[s]=n.value[y],n.array[s+1]=n.value[y+1],n.array[s+2]=n.value[y+2],n.array[s+3]=n.value[y+3],n.offsetSrc+=4),n.offset+=4):(n.boundTo===void 0||n.boundTo==="vertices"?(p=n.value[z.a],I=n.value[z.b],H=n.value[z.c],L=n.value[z.d]):n.boundTo==="faces"?(L=H=I=p=y=n.value[y],n.offsetSrc++):n.boundTo==="faceVertices"&&(p=n.value[y],I=n.value[y+1],H=n.value[y+2],L=n.value[y+3],n.offsetSrc+=4),n.size===2?(n.array[s]=p.x,n.array[s+1]=p.y,n.array[s+2]=I.x,n.array[s+3]=I.y,
- n.array[s+4]=H.x,n.array[s+5]=H.y,n.array[s+6]=L.x,n.array[s+7]=L.y,n.offset+=8):n.size===3?(n.type==="c"?(n.array[s]=p.r,n.array[s+1]=p.g,n.array[s+2]=p.b,n.array[s+3]=I.r,n.array[s+4]=I.g,n.array[s+5]=I.b,n.array[s+6]=H.r,n.array[s+7]=H.g,n.array[s+8]=H.b,n.array[s+9]=L.r,n.array[s+10]=L.g,n.array[s+11]=L.b):(n.array[s]=p.x,n.array[s+1]=p.y,n.array[s+2]=p.z,n.array[s+3]=I.x,n.array[s+4]=I.y,n.array[s+5]=I.z,n.array[s+6]=H.x,n.array[s+7]=H.y,n.array[s+8]=H.z,n.array[s+9]=L.x,n.array[s+10]=L.y,n.array[s+
- 11]=L.z),n.offset+=12):(n.array[s]=p.x,n.array[s+1]=p.y,n.array[s+2]=p.z,n.array[s+3]=p.w,n.array[s+4]=I.x,n.array[s+5]=I.y,n.array[s+6]=I.z,n.array[s+7]=I.w,n.array[s+8]=H.x,n.array[s+9]=H.y,n.array[s+10]=H.z,n.array[s+11]=H.w,n.array[s+12]=L.x,n.array[s+13]=L.y,n.array[s+14]=L.z,n.array[s+15]=L.w,n.offset+=16));if(Ea){s=0;for(n=Ha.length;s<n;s++)p=Ha[s].vertices[z.a].position,I=Ha[s].vertices[z.b].position,H=Ha[s].vertices[z.c].position,L=Ha[s].vertices[z.d].position,y=ra[s],y[na]=p.x,y[na+1]=p.y,
- y[na+2]=p.z,y[na+3]=I.x,y[na+4]=I.y,y[na+5]=I.z,y[na+6]=H.x,y[na+7]=H.y,y[na+8]=H.z,y[na+9]=L.x,y[na+10]=L.y,y[na+11]=L.z;na+=12}if(Ka.length)s=Ka[z.a],n=Ka[z.b],y=Ka[z.c],N=Ka[z.d],ea[w]=s.x,ea[w+1]=s.y,ea[w+2]=s.z,ea[w+3]=s.w,ea[w+4]=n.x,ea[w+5]=n.y,ea[w+6]=n.z,ea[w+7]=n.w,ea[w+8]=y.x,ea[w+9]=y.y,ea[w+10]=y.z,ea[w+11]=y.w,ea[w+12]=N.x,ea[w+13]=N.y,ea[w+14]=N.z,ea[w+15]=N.w,s=Na[z.a],n=Na[z.b],y=Na[z.c],N=Na[z.d],da[w]=s.x,da[w+1]=s.y,da[w+2]=s.z,da[w+3]=s.w,da[w+4]=n.x,da[w+5]=n.y,da[w+6]=n.z,da[w+
- 7]=n.w,da[w+8]=y.x,da[w+9]=y.y,da[w+10]=y.z,da[w+11]=y.w,da[w+12]=N.x,da[w+13]=N.y,da[w+14]=N.z,da[w+15]=N.w,s=La[z.a],n=La[z.b],y=La[z.c],N=La[z.d],aa[w]=s.x,aa[w+1]=s.y,aa[w+2]=s.z,aa[w+3]=1,aa[w+4]=n.x,aa[w+5]=n.y,aa[w+6]=n.z,aa[w+7]=1,aa[w+8]=y.x,aa[w+9]=y.y,aa[w+10]=y.z,aa[w+11]=1,aa[w+12]=N.x,aa[w+13]=N.y,aa[w+14]=N.z,aa[w+15]=1,s=Ma[z.a],n=Ma[z.b],y=Ma[z.c],z=Ma[z.d],ca[w]=s.x,ca[w+1]=s.y,ca[w+2]=s.z,ca[w+3]=1,ca[w+4]=n.x,ca[w+5]=n.y,ca[w+6]=n.z,ca[w+7]=1,ca[w+8]=y.x,ca[w+9]=y.y,ca[w+10]=y.z,
- ca[w+11]=1,ca[w+12]=z.x,ca[w+13]=z.y,ca[w+14]=z.z,ca[w+15]=1,w+=16;if(Ca&&q)ga.length==4&&q==THREE.VertexColors?(z=ga[0],s=ga[1],n=ga[2],ga=ga[3]):ga=n=s=z=O,pa[ka]=z.r,pa[ka+1]=z.g,pa[ka+2]=z.b,pa[ka+3]=s.r,pa[ka+4]=s.g,pa[ka+5]=s.b,pa[ka+6]=n.r,pa[ka+7]=n.g,pa[ka+8]=n.b,pa[ka+9]=ga.r,pa[ka+10]=ga.g,pa[ka+11]=ga.b,ka+=12;if(Ba&&sa.hasTangents)ga=M[0],O=M[1],z=M[2],M=M[3],$[X]=ga.x,$[X+1]=ga.y,$[X+2]=ga.z,$[X+3]=ga.w,$[X+4]=O.x,$[X+5]=O.y,$[X+6]=O.z,$[X+7]=O.w,$[X+8]=z.x,$[X+9]=z.y,$[X+10]=z.z,$[X+
- 11]=z.w,$[X+12]=M.x,$[X+13]=M.y,$[X+14]=M.z,$[X+15]=M.w,X+=16;if(Aa&&r)if(F.length==4&&wa)for(M=0;M<4;M++)J=F[M],W[P]=J.x,W[P+1]=J.y,W[P+2]=J.z,P+=3;else for(M=0;M<4;M++)W[P]=J.x,W[P+1]=J.y,W[P+2]=J.z,P+=3;if(qa&&u!==void 0&&t)for(M=0;M<4;M++)F=u[M],ia[V]=F.u,ia[V+1]=F.v,V+=2;if(qa&&x!==void 0&&t)for(M=0;M<4;M++)F=x[M],la[Y]=F.u,la[Y+1]=F.v,Y+=2;va&&(ha[T]=ja,ha[T+1]=ja+1,ha[T+2]=ja+3,ha[T+3]=ja+1,ha[T+4]=ja+2,ha[T+5]=ja+3,T+=6,Da[Q]=ja,Da[Q+1]=ja+1,Da[Q+2]=ja,Da[Q+3]=ja+3,Da[Q+4]=ja+1,Da[Q+5]=ja+
- 2,Da[Q+6]=ja+2,Da[Q+7]=ja+3,Q+=8,ja+=4)}ua&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,oa,o));if(Z)for(S in Z)n=Z[S],n.__original.needsUpdate&&(f.bindBuffer(f.ARRAY_BUFFER,n.buffer),f.bufferData(f.ARRAY_BUFFER,n.array,o));if(Ea){s=0;for(n=Ha.length;s<n;s++)f.bindBuffer(f.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[s]),f.bufferData(f.ARRAY_BUFFER,ra[s],o)}Ca&&ka>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,pa,o));Aa&&(f.bindBuffer(f.ARRAY_BUFFER,
- m.__webglNormalBuffer),f.bufferData(f.ARRAY_BUFFER,W,o));Ba&&sa.hasTangents&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglTangentBuffer),f.bufferData(f.ARRAY_BUFFER,$,o));qa&&V>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,ia,o));qa&&Y>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglUV2Buffer),f.bufferData(f.ARRAY_BUFFER,la,o));va&&(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,ha,o),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,m.__webglLineBuffer),
- f.bufferData(f.ELEMENT_ARRAY_BUFFER,Da,o));w>0&&(f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,aa,o),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,ca,o),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,da,o),f.bindBuffer(f.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER,ea,o));E&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,delete m.__tangentArray,
- delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;ya(k)}else if(g instanceof THREE.Ribbon){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=f.DYNAMIC_DRAW;k=C=v=v=void 0;t=g.vertices;m=
- g.colors;q=t.length;o=m.length;r=g.__vertexArray;E=g.__colorArray;u=g.__dirtyColors;if(g.__dirtyVertices){for(v=0;v<q;v++)C=t[v].position,k=v*3,r[k]=C.x,r[k+1]=C.y,r[k+2]=C.z;f.bindBuffer(f.ARRAY_BUFFER,g.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,r,j)}if(u){for(v=0;v<o;v++)color=m[v],k=v*3,E[k]=color.r,E[k+1]=color.g,E[k+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,g.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,E,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof THREE.Line){h=g.geometry;
- if(h.__dirtyVertices||h.__dirtyColors){g=h;j=f.DYNAMIC_DRAW;k=C=v=v=void 0;t=g.vertices;m=g.colors;q=t.length;o=m.length;r=g.__vertexArray;E=g.__colorArray;u=g.__dirtyColors;if(g.__dirtyVertices){for(v=0;v<q;v++)C=t[v].position,k=v*3,r[k]=C.x,r[k+1]=C.y,r[k+2]=C.z;f.bindBuffer(f.ARRAY_BUFFER,g.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,r,j)}if(u){for(v=0;v<o;v++)color=m[v],k=v*3,E[k]=color.r,E[k+1]=color.g,E[k+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,g.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,
- E,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem)h=g.geometry,m=K(h),(h.__dirtyVertices||h.__dirtyColors||g.sortParticles||m)&&c(h,f.DYNAMIC_DRAW,g),h.__dirtyVertices=!1,h.__dirtyColors=!1,ya(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?f.frontFace(f.CCW):f.frontFace(f.CW),b=="back"?f.cullFace(f.BACK):b=="front"?f.cullFace(f.FRONT):f.cullFace(f.FRONT_AND_BACK),f.enable(f.CULL_FACE)):f.disable(f.CULL_FACE)};this.supportsVertexTextures=function(){return Ya}};
- THREE.WebGLRenderTarget=function(b,c,d){this.width=b;this.height=c;d=d||{};this.wrapS=d.wrapS!==void 0?d.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=d.wrapT!==void 0?d.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=d.magFilter!==void 0?d.magFilter:THREE.LinearFilter;this.minFilter=d.minFilter!==void 0?d.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=d.format!==void 0?d.format:THREE.RGBAFormat;this.type=d.type!==void 0?d.type:
- THREE.UnsignedByteType;this.depthBuffer=d.depthBuffer!==void 0?d.depthBuffer:!0;this.stencilBuffer=d.stencilBuffer!==void 0?d.stencilBuffer:!0};THREE.WebGLRenderTargetCube=function(b,c,d){THREE.WebGLRenderTarget.call(this,b,c,d);this.activeCubeFace=0};THREE.WebGLRenderTargetCube.prototype=new THREE.WebGLRenderTarget;THREE.WebGLRenderTargetCube.prototype.constructor=THREE.WebGLRenderTargetCube;
|