| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- // ThreeWebGL.js r46dev - http://github.com/mrdoob/three.js
- var THREE=THREE||{};if(!self.Int32Array)self.Int32Array=Array,self.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,i;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),i=d*(1-c*h),c=d*(1-c*(1-h)),e){case 1:this.r=i;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=i;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=i;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},setX:function(b){this.x=b;return this},setY:function(b){this.y=b;return this},setZ:function(b){this.z=b;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!==void 0?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!==void 0?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.children)},intersectObjects:function(b){var c,d,e=[];c=0;for(d=b.length;c<d;c++)Array.prototype.push.apply(e,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),i=d.dot(d),d=d.dot(h),h=1/(b*i-c*c),i=(i*e-c*d)*h,b=(b*d-c*e)*h;return i>0&&b>0&&i+b<1}for(var e,h=[],i=0,j=b.children.length;i<j;i++)Array.prototype.push.apply(h,this.intersectObject(b.children[i]));if(b instanceof THREE.Particle){i=c(this.origin,this.direction,b.matrixWorld.getPosition());if(i==null||i>b.scale.x)return[];e={distance:i,point:b.position,face:null,object:b};h.push(e)}else if(b instanceof THREE.Mesh){i=c(this.origin,
- this.direction,b.matrixWorld.getPosition());if(i==null||i>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return h;var k,o,s,p,n,v,w,D,F=b.geometry,J=F.vertices;b.matrixRotationWorld.extractRotation(b.matrixWorld);i=0;for(j=F.faces.length;i<j;i++)if(e=F.faces[i],w=this.origin.clone(),D=this.direction.clone(),p=b.matrixWorld,k=p.multiplyVector3(e.centroid.clone()).subSelf(w),v=k.dot(D),!(v<=0)&&(k=p.multiplyVector3(J[e.a].position.clone()),o=p.multiplyVector3(J[e.b].position.clone()),
- s=p.multiplyVector3(J[e.c].position.clone()),p=e instanceof THREE.Face4?p.multiplyVector3(J[e.d].position.clone()):null,n=b.matrixRotationWorld.multiplyVector3(e.normal.clone()),v=D.dot(n),b.doubleSided||(b.flipSided?v>0:v<0)))if(v=n.dot((new THREE.Vector3).sub(k,w))/v,w=w.addSelf(D.multiplyScalar(v)),e instanceof THREE.Face3)d(w,k,o,s)&&(e={distance:this.origin.distanceTo(w),point:w,face:e,object:b},h.push(e));else if(e instanceof THREE.Face4&&(d(w,k,o,p)||d(w,o,s,p)))e={distance:this.origin.distanceTo(w),
- point:w,face:e,object:b},h.push(e)}return h}};
- THREE.Rectangle=function(){function b(){i=e-c;j=h-d}var c,d,e,h,i,j,k=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return i};this.getHeight=function(){return j};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(i,j,p,n){k=!1;c=i;d=j;e=p;h=n;b()};this.addPoint=function(i,j){k?(k=!1,c=i,d=j,e=i,h=j):(c=c<i?c:i,d=d<j?d:j,e=e>i?e:i,h=h>j?h:j);b()};this.add3Points=
- function(i,j,p,n,v,w){k?(k=!1,c=i<p?i<v?i:v:p<v?p:v,d=j<n?j<w?j:w:n<w?n:w,e=i>p?i>v?i:v:p>v?p:v,h=j>n?j>w?j:w:n>w?n:w):(c=i<p?i<v?i<c?i:c:v<c?v:c:p<v?p<c?p:c:v<c?v:c,d=j<n?j<w?j<d?j:d:w<d?w:d:n<w?n<d?n:d:w<d?w:d,e=i>p?i>v?i>e?i:e:v>e?v:e:p>v?p>e?p:e:v>e?v:e,h=j>n?j>w?j>h?j:h:w>h?w:h:n>w?n>h?n:h:w>h?w:h);b()};this.addRectangle=function(i){k?(k=!1,c=i.getLeft(),d=i.getTop(),e=i.getRight(),h=i.getBottom()):(c=c<i.getLeft()?c:i.getLeft(),d=d<i.getTop()?d:i.getTop(),e=e>i.getRight()?e:i.getRight(),h=h>
- i.getBottom()?h:i.getBottom());b()};this.inflate=function(i){c-=i;d-=i;e+=i;h+=i;b()};this.minSelf=function(i){c=c>i.getLeft()?c:i.getLeft();d=d>i.getTop()?d:i.getTop();e=e<i.getRight()?e:i.getRight();h=h<i.getBottom()?h:i.getBottom();b()};this.intersects=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,i,j,k,o,s,p,n,v,w,D,F){this.set(b!==void 0?b:1,c||0,d||0,e||0,h||0,i!==void 0?i:1,j||0,k||0,o||0,s||0,p!==void 0?p:1,n||0,v||0,w||0,D||0,F!==void 0?F:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,d,e,h,i,j,k,o,s,p,n,v,w,D,F){this.n11=b;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=i;this.n23=j;this.n24=k;this.n31=o;this.n32=s;this.n33=p;this.n34=n;this.n41=v;this.n42=w;this.n43=D;this.n44=F;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(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,i=THREE.Matrix4.__v3;i.sub(b,c).normalize();if(i.length()===0)i.z=1;e.cross(d,i).normalize();e.length()===0&&(i.x+=1.0E-4,e.cross(d,i).normalize());h.cross(i,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=i.x;this.n21=e.y;this.n22=h.y;this.n23=i.y;this.n31=e.z;this.n32=h.z;this.n33=i.z;return this},multiply:function(b,c){var d=b.n11,e=b.n12,h=b.n13,i=b.n14,j=b.n21,k=b.n22,o=b.n23,s=b.n24,p=b.n31,n=b.n32,v=b.n33,w=b.n34,D=b.n41,F=b.n42,J=b.n43,
- I=b.n44,ga=c.n11,u=c.n12,ha=c.n13,P=c.n14,U=c.n21,V=c.n22,O=c.n23,G=c.n24,ra=c.n31,oa=c.n32,sa=c.n33,fa=c.n34,ia=c.n41,A=c.n42,E=c.n43,f=c.n44;this.n11=d*ga+e*U+h*ra+i*ia;this.n12=d*u+e*V+h*oa+i*A;this.n13=d*ha+e*O+h*sa+i*E;this.n14=d*P+e*G+h*fa+i*f;this.n21=j*ga+k*U+o*ra+s*ia;this.n22=j*u+k*V+o*oa+s*A;this.n23=j*ha+k*O+o*sa+s*E;this.n24=j*P+k*G+o*fa+s*f;this.n31=p*ga+n*U+v*ra+w*ia;this.n32=p*u+n*V+v*oa+w*A;this.n33=p*ha+n*O+v*sa+w*E;this.n34=p*P+n*G+v*fa+w*f;this.n41=D*ga+F*U+J*ra+I*ia;this.n42=
- D*u+F*V+J*oa+I*A;this.n43=D*ha+F*O+J*sa+I*E;this.n44=D*P+F*G+J*fa+I*f;return this},multiplySelf:function(b){return this.multiply(this,b)},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},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},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},determinant:function(){var b=this.n11,c=this.n12,d=this.n13,e=this.n14,h=this.n21,i=this.n22,j=this.n23,k=this.n24,o=this.n31,s=this.n32,p=this.n33,n=this.n34,v=this.n41,w=this.n42,D=this.n43,F=this.n44;return e*j*s*v-d*k*s*v-e*i*p*v+c*k*p*v+d*i*n*v-c*j*n*v-e*j*o*w+d*k*o*w+e*h*p*w-b*k*p*w-d*h*n*w+b*j*n*w+e*i*o*D-c*k*o*D-e*h*s*D+b*k*s*D+c*h*n*D-b*i*n*D-d*i*o*F+c*j*o*F+
- d*h*s*F-b*j*s*F-c*h*p*F+b*i*p*F},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,i=b.x,j=b.y,k=b.z,o=h*i,s=h*j;this.set(o*i+d,o*j-e*k,o*k+e*j,0,o*j+e*k,s*j+d,s*k-e*i,0,o*k-e*j,s*k+e*i,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(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
- this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(b){var c=b.n11,d=b.n12,e=b.n13,h=b.n14,i=b.n21,j=b.n22,k=b.n23,o=b.n24,s=b.n31,p=b.n32,n=b.n33,v=b.n34,w=b.n41,D=b.n42,F=b.n43,J=b.n44;this.n11=k*v*D-o*n*D+o*p*F-j*v*F-k*p*J+j*n*J;this.n12=h*n*D-e*v*D-h*p*F+d*v*F+e*p*J-d*n*J;this.n13=e*o*D-h*k*D+h*j*F-d*o*F-e*j*J+d*k*J;this.n14=h*k*p-e*o*p-h*j*n+d*o*n+e*j*v-d*k*v;this.n21=o*n*w-k*v*w-o*s*F+i*v*F+k*s*J-i*n*J;this.n22=e*v*w-h*n*w+
- h*s*F-c*v*F-e*s*J+c*n*J;this.n23=h*k*w-e*o*w-h*i*F+c*o*F+e*i*J-c*k*J;this.n24=e*o*s-h*k*s+h*i*n-c*o*n-e*i*v+c*k*v;this.n31=j*v*w-o*p*w+o*s*D-i*v*D-j*s*J+i*p*J;this.n32=h*p*w-d*v*w-h*s*D+c*v*D+d*s*J-c*p*J;this.n33=e*o*w-h*j*w+h*i*D-c*o*D-d*i*J+c*j*J;this.n34=h*j*s-d*o*s-h*i*p+c*o*p+d*i*v-c*j*v;this.n41=k*p*w-j*n*w-k*s*D+i*n*D+j*s*F-i*p*F;this.n42=d*n*w-e*p*w+e*s*D-c*n*D-d*s*F+c*p*F;this.n43=e*j*w-d*k*w-e*i*D+c*k*D+d*i*F-c*j*F;this.n44=d*k*s-e*j*s+e*i*p-c*k*p-d*i*n+c*j*n;this.multiplyScalar(1/b.determinant());
- return this},setRotationFromEuler:function(b,c){var d=b.x,e=b.y,h=b.z,i=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 o=j*k,s=j*h,p=e*k,n=e*h;this.n11=o+n*d;this.n12=p*d-s;this.n13=i*e;this.n21=i*h;this.n22=i*k;this.n23=-d;this.n31=s*d-p;this.n32=n+o*d;this.n33=i*j;break;case "ZXY":o=j*k;s=j*h;p=e*k;n=e*h;this.n11=o-n*d;this.n12=-i*h;this.n13=p+s*d;this.n21=s+p*d;this.n22=i*k;this.n23=n-o*d;this.n31=-i*e;this.n32=d;this.n33=i*j;break;case "ZYX":o=
- i*k;s=i*h;p=d*k;n=d*h;this.n11=j*k;this.n12=p*e-s;this.n13=o*e+n;this.n21=j*h;this.n22=n*e+o;this.n23=s*e-p;this.n31=-e;this.n32=d*j;this.n33=i*j;break;case "YZX":o=i*j;s=i*e;p=d*j;n=d*e;this.n11=j*k;this.n12=n-o*h;this.n13=p*h+s;this.n21=h;this.n22=i*k;this.n23=-d*k;this.n31=-e*k;this.n32=s*h+p;this.n33=o-n*h;break;case "XZY":o=i*j;s=i*e;p=d*j;n=d*e;this.n11=j*k;this.n12=-h;this.n13=e*k;this.n21=o*h+n;this.n22=i*k;this.n23=s*h-p;this.n31=p*h-s;this.n32=d*k;this.n33=n*h+o;break;default:o=i*k,s=i*
- h,p=d*k,n=d*h,this.n11=j*k,this.n12=-j*h,this.n13=e,this.n21=s+p*e,this.n22=o-n*e,this.n23=-d*j,this.n31=n-o*e,this.n32=p+s*e,this.n33=i*j}return this},setRotationFromQuaternion:function(b){var c=b.x,d=b.y,e=b.z,h=b.w,i=c+c,j=d+d,k=e+e,b=c*i,o=c*j;c*=k;var s=d*j;d*=k;e*=k;i*=h;j*=h;h*=k;this.n11=1-(s+e);this.n12=o-h;this.n13=c+j;this.n21=o+h;this.n22=1-(b+e);this.n23=d-i;this.n31=c-j;this.n32=d+i;this.n33=1-(b+s);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,i=THREE.Matrix4.__v3;e.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);i.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=i.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;
- return this},extractRotation:function(b){var c=THREE.Matrix4.__v1,d=1/c.set(b.n11,b.n21,b.n31).length(),e=1/c.set(b.n12,b.n22,b.n32).length(),c=1/c.set(b.n13,b.n23,b.n33).length();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*c;this.n23=b.n23*c;this.n33=b.n33*c;return this}};
- 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,i=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,o=-b.n32*b.n11+b.n31*b.n12,s=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,n=b.n22*b.n11-b.n21*b.n12,b=b.n11*e+b.n21*j+b.n31*s;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;d[0]=b*e;d[1]=b*h;d[2]=b*i;d[3]=b*j;d[4]=b*k;d[5]=b*o;d[6]=b*s;d[7]=b*p;d[8]=b*n;return c};
- THREE.Matrix4.makeFrustum=function(b,c,d,e,h,i){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=-(i+h)/(i-h);j.n34=-2*i*h/(i-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,i){var j,k,o,s;j=new THREE.Matrix4;k=c-b;o=d-e;s=i-h;j.n11=2/k;j.n12=0;j.n13=0;j.n14=-((c+b)/k);j.n21=0;j.n22=2/o;j.n23=0;j.n24=-((d+e)/o);j.n31=0;j.n32=0;j.n33=-2/s;j.n34=-((i+h)/s);j.n41=0;j.n42=0;j.n43=0;j.n44=1;return j};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
- THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
- !0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
- 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)},add:function(b){if(this.children.indexOf(b)===
- -1)b.parent!==void 0&&b.parent.remove(b),b.parent=this,this.children.push(b)},remove: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},updateMatrixWorld:function(b){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||b)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,b=!0;for(var c=0,d=this.children.length;c<
- d;c++)this.children[c].updateMatrixWorld(b)}};THREE.Object3DCount=0;
- THREE.Projector=function(){function b(){var b=i[h]=i[h]||new THREE.RenderableVertex;h++;return b}function c(b,c){return c.z-b.z}function d(b,c){var d=0,e=1,i=b.z+b.w,h=c.z+c.w,j=-b.z+b.w,k=-c.z+c.w;return i>=0&&h>=0&&j>=0&&k>=0?!0:i<0&&h<0||j<0&&k<0?!1:(i<0?d=Math.max(d,i/(i-h)):h<0&&(e=Math.min(e,i/(i-h))),j<0?d=Math.max(d,j/(j-k)):k<0&&(e=Math.min(e,j/(j-k))),e<d?!1:(b.lerpSelf(c,d),c.lerpSelf(b,1-e),!0))}var e,h,i=[],j,k,o=[],s,p=[],n,v,w=[],D,F,J=[],I={objects:[],lights:[],elements:[]};new THREE.Vector3;
- var ga=new THREE.Vector4,u=new THREE.Matrix4,ha=new THREE.Matrix4,P=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],U=new THREE.Vector4,V=new THREE.Vector4;this.projectVector=function(b,c){c.matrixWorldInverse.getInverse(c.matrixWorld);u.multiply(c.projectionMatrix,c.matrixWorldInverse);u.multiplyVector3(b);return b};this.unprojectVector=function(b,c){c.projectionMatrixInverse.getInverse(c.projectionMatrix);u.multiply(c.matrixWorld,c.projectionMatrixInverse);
- u.multiplyVector3(b);return b};this.pickingRay=function(b,c){var d;b.z=-1;d=new THREE.Vector3(b.x,b.y,1);this.unprojectVector(b,c);this.unprojectVector(d,c);d.subSelf(b).normalize();return new THREE.Ray(b,d)};this.projectGraph=function(b){I.objects.length=0;I.lights.length=0;var c=function(b){if(b.visible!=!1){var d;if(!(d=b instanceof THREE.Particle))if(!(d=b instanceof THREE.Line))if(d=b instanceof THREE.Mesh)if(!(d=!b.frustumCulled))a:{for(var e=b.matrixWorld,i=-b.geometry.boundingSphere.radius*
- Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(d=P[h].x*e.n14+P[h].y*e.n24+P[h].z*e.n34+P[h].w,d<=i){d=!1;break a}d=!0}d?I.objects.push(b):b instanceof THREE.Light&&I.lights.push(b);d=0;for(e=b.children.length;d<e;d++)c(b.children[d])}};c(b);return I};this.projectScene=function(O,G,ra){var oa=G.near,sa=G.far,fa,ia,A,E,f,W,Q,Y,L,X,ua,Ka,La,xa,ta,va;F=v=s=k=0;I.elements.length=0;G.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),O.add(G));O.updateMatrixWorld();
- G.matrixWorldInverse.getInverse(G.matrixWorld);u.multiply(G.projectionMatrix,G.matrixWorldInverse);P[0].set(u.n41-u.n11,u.n42-u.n12,u.n43-u.n13,u.n44-u.n14);P[1].set(u.n41+u.n11,u.n42+u.n12,u.n43+u.n13,u.n44+u.n14);P[2].set(u.n41+u.n21,u.n42+u.n22,u.n43+u.n23,u.n44+u.n24);P[3].set(u.n41-u.n21,u.n42-u.n22,u.n43-u.n23,u.n44-u.n24);P[4].set(u.n41-u.n31,u.n42-u.n32,u.n43-u.n33,u.n44-u.n34);P[5].set(u.n41+u.n31,u.n42+u.n32,u.n43+u.n33,u.n44+u.n34);for(fa=0;fa<6;fa++)L=P[fa],L.divideScalar(Math.sqrt(L.x*
- L.x+L.y*L.y+L.z*L.z));I=this.projectGraph(O);O=0;for(fa=I.objects.length;O<fa;O++)if(L=I.objects[O],X=L.matrixWorld,Ka=L.materials,La=L.overdraw,h=0,L instanceof THREE.Mesh){ua=L.geometry;E=ua.vertices;xa=ua.faces;ta=ua.faceVertexUvs;ua=L.matrixRotationWorld.extractRotation(L.matrixWorld);ia=0;for(A=E.length;ia<A;ia++)e=b(),e.positionWorld.copy(E[ia].position),X.multiplyVector3(e.positionWorld),e.positionScreen.copy(e.positionWorld),u.multiplyVector4(e.positionScreen),e.positionScreen.x/=e.positionScreen.w,
- e.positionScreen.y/=e.positionScreen.w,e.visible=e.positionScreen.z>oa&&e.positionScreen.z<sa;E=0;for(ia=xa.length;E<ia;E++){A=xa[E];if(A instanceof THREE.Face3)if(f=i[A.a],W=i[A.b],Q=i[A.c],f.visible&&W.visible&&Q.visible&&(L.doubleSided||L.flipSided!=(Q.positionScreen.x-f.positionScreen.x)*(W.positionScreen.y-f.positionScreen.y)-(Q.positionScreen.y-f.positionScreen.y)*(W.positionScreen.x-f.positionScreen.x)<0))Y=o[k]=o[k]||new THREE.RenderableFace3,k++,j=Y,j.v1.copy(f),j.v2.copy(W),j.v3.copy(Q);
- else continue;else if(A instanceof THREE.Face4)if(f=i[A.a],W=i[A.b],Q=i[A.c],Y=i[A.d],f.visible&&W.visible&&Q.visible&&Y.visible&&(L.doubleSided||L.flipSided!=((Y.positionScreen.x-f.positionScreen.x)*(W.positionScreen.y-f.positionScreen.y)-(Y.positionScreen.y-f.positionScreen.y)*(W.positionScreen.x-f.positionScreen.x)<0||(W.positionScreen.x-Q.positionScreen.x)*(Y.positionScreen.y-Q.positionScreen.y)-(W.positionScreen.y-Q.positionScreen.y)*(Y.positionScreen.x-Q.positionScreen.x)<0)))va=p[s]=p[s]||
- new THREE.RenderableFace4,s++,j=va,j.v1.copy(f),j.v2.copy(W),j.v3.copy(Q),j.v4.copy(Y);else continue;j.normalWorld.copy(A.normal);ua.multiplyVector3(j.normalWorld);j.centroidWorld.copy(A.centroid);X.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);u.multiplyVector3(j.centroidScreen);Q=A.vertexNormals;f=0;for(W=Q.length;f<W;f++)Y=j.vertexNormalsWorld[f],Y.copy(Q[f]),ua.multiplyVector3(Y);f=0;for(W=ta.length;f<W;f++)if(va=ta[f][E]){Q=0;for(Y=va.length;Q<Y;Q++)j.uvs[f][Q]=va[Q]}j.meshMaterials=
- Ka;j.faceMaterials=A.materials;j.overdraw=La;j.z=j.centroidScreen.z;I.elements.push(j)}}else if(L instanceof THREE.Line){ha.multiply(u,X);E=L.geometry.vertices;f=b();f.positionScreen.copy(E[0].position);ha.multiplyVector4(f.positionScreen);ia=1;for(A=E.length;ia<A;ia++)if(f=b(),f.positionScreen.copy(E[ia].position),ha.multiplyVector4(f.positionScreen),W=i[h-2],U.copy(f.positionScreen),V.copy(W.positionScreen),d(U,V))U.multiplyScalar(1/U.w),V.multiplyScalar(1/V.w),X=w[v]=w[v]||new THREE.RenderableLine,
- v++,n=X,n.v1.positionScreen.copy(U),n.v2.positionScreen.copy(V),n.z=Math.max(U.z,V.z),n.materials=L.materials,I.elements.push(n)}else if(L instanceof THREE.Particle&&(ga.set(L.matrixWorld.n14,L.matrixWorld.n24,L.matrixWorld.n34,1),u.multiplyVector4(ga),ga.z/=ga.w,ga.z>0&&ga.z<1))X=J[F]=J[F]||new THREE.RenderableParticle,F++,D=X,D.x=ga.x/ga.w,D.y=ga.y/ga.w,D.z=ga.z,D.rotation=L.rotation.z,D.scale.x=L.scale.x*Math.abs(D.x-(ga.x+G.projectionMatrix.n11)/(ga.w+G.projectionMatrix.n14)),D.scale.y=L.scale.y*
- Math.abs(D.y-(ga.y+G.projectionMatrix.n22)/(ga.w+G.projectionMatrix.n24)),D.materials=L.materials,I.elements.push(D);ra&&I.elements.sort(c);return I}};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=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),i=Math.cos(d),d=Math.sin(d),j=b*c,k=e*h;this.w=j*i-k*d;this.x=j*d+k*i;this.y=e*c*i+b*h*d;this.z=b*h*i-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,i=b.x,j=b.y,k=b.z,b=b.w;this.x=c*b+h*i+d*k-e*j;this.y=d*b+h*j+e*i-c*k;this.z=e*b+h*k+c*j-d*i;this.w=h*b-c*i-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,i=this.x,j=this.y,k=this.z,o=this.w,s=o*d+j*h-k*e,p=o*e+k*d-i*h,n=o*h+i*e-j*d,d=-i*
- d-j*e-k*h;c.x=s*o+d*-i+p*-k-n*-j;c.y=p*o+d*-j+n*-i-s*-k;c.z=n*o+d*-k+s*-j-p*-i;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;h<0?(d.w=-c.w,d.x=-c.x,d.y=-c.y,d.z=-c.z,h=-h):d.copy(c);if(Math.abs(h)>=1)return d.w=b.w,d.x=b.x,d.y=b.y,d.z=b.z,d;var i=Math.acos(h),h=Math.sqrt(1-h*h);if(Math.abs(h)<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;c=Math.sin((1-e)*i)/h;e=Math.sin(e*i)/h;d.w=b.w*c+d.w*e;d.x=b.x*c+d.x*e;d.y=b.y*c+d.y*e;d.z=b.z*c+d.z*e;return d};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
- THREE.Face3=function(b,c,d,e,h,i){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=i instanceof Array?i:[i];this.centroid=new THREE.Vector3};
- THREE.Face4=function(b,c,d,e,h,i,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=i instanceof THREE.Color?i:new THREE.Color;this.vertexColors=i instanceof Array?i:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};THREE.UV=function(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=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];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,applyMatrix:function(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var d=0,e=this.vertices.length;d<e;d++)b.multiplyVector3(this.vertices[d].position);d=0;for(e=this.faces.length;d<e;d++){var h=this.faces[d];c.multiplyVector3(h.normal);for(var i=0,j=h.vertexNormals.length;i<j;i++)c.multiplyVector3(h.vertexNormals[i]);b.multiplyVector3(h.centroid)}},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,i,j,k=new THREE.Vector3,o=new THREE.Vector3;e=0;for(h=this.faces.length;e<h;e++){i=this.faces[e];if(b&&i.vertexNormals.length){k.set(0,0,0);c=0;for(d=i.vertexNormals.length;c<d;c++)k.addSelf(i.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[i.a],d=this.vertices[i.b],j=this.vertices[i.c],k.sub(j.position,d.position),o.sub(c.position,d.position),k.crossSelf(o);k.isZero()||k.normalize();i.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,c,d,e,i,h,E){k=b.vertices[c].position;o=b.vertices[d].position;s=b.vertices[e].position;p=j[i];n=j[h];v=j[E];w=o.x-k.x;D=s.x-k.x;F=o.y-k.y;J=s.y-k.y;I=o.z-k.z;ga=s.z-k.z;u=n.u-p.u;ha=v.u-p.u;P=n.v-p.v;U=v.v-p.v;V=1/(u*U-ha*P);oa.set((U*w-P*D)*V,(U*F-P*J)*V,(U*I-P*ga)*V);sa.set((u*D-ha*w)*V,(u*J-ha*F)*V,(u*ga-ha*I)*V);G[c].addSelf(oa);G[d].addSelf(oa);G[e].addSelf(oa);
- ra[c].addSelf(sa);ra[d].addSelf(sa);ra[e].addSelf(sa)}var c,d,e,h,i,j,k,o,s,p,n,v,w,D,F,J,I,ga,u,ha,P,U,V,O,G=[],ra=[],oa=new THREE.Vector3,sa=new THREE.Vector3,fa=new THREE.Vector3,ia=new THREE.Vector3,A=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++)G[c]=new THREE.Vector3,ra[c]=new THREE.Vector3;c=0;for(d=this.faces.length;c<d;c++)i=this.faces[c],j=this.faceVertexUvs[0][c],i instanceof THREE.Face3?b(this,i.a,i.b,i.c,0,1,2):i instanceof THREE.Face4&&(b(this,i.a,i.b,i.c,0,1,2),b(this,i.a,
- i.b,i.d,0,1,3));var E=["a","b","c","d"];c=0;for(d=this.faces.length;c<d;c++){i=this.faces[c];for(e=0;e<i.vertexNormals.length;e++)A.copy(i.vertexNormals[e]),h=i[E[e]],O=G[h],fa.copy(O),fa.subSelf(A.multiplyScalar(A.dot(O))).normalize(),ia.cross(i.vertexNormals[e],O),h=ia.dot(ra[h]),h=h<0?-1:1,i.vertexTangents[e]=new THREE.Vector4(fa.x,fa.y,fa.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}},mergeVertices:function(){var b={},c=[],d=[],e,h=Math.pow(10,4),i,j;i=0;for(j=this.vertices.length;i<j;i++)e=this.vertices[i].position,e=[Math.round(e.x*h),Math.round(e.y*h),Math.round(e.z*h)].join("_"),
- b[e]===void 0?(b[e]=i,c.push(this.vertices[i]),d[i]=c.length-1):d[i]=d[b[e]];i=0;for(j=this.faces.length;i<j;i++){b=this.faces[i];if(b instanceof THREE.Face3)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c];if(b instanceof THREE.Face4)b.a=d[b.a],b.b=d[b.b],b.c=d[b.c],b.d=d[b.d]}this.vertices=c}};THREE.GeometryCount=0;
- THREE.Spline=function(b){function c(b,c,d,e,i,h,j){b=(d-b)*0.5;e=(e-c)*0.5;return(2*(c-d)+b+e)*j+(-3*(c-d)-2*b-e)*h+b*i+c}this.points=b;var d=[],e={x:0,y:0,z:0},h,i,j,k,o,s,p,n,v;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;i=Math.floor(h);j=h-i;d[0]=i==0?i:i-1;d[1]=i;d[2]=i>this.points.length-2?i:i+1;d[3]=i>this.points.length-3?i:i+2;s=this.points[d[0]];p=this.points[d[1]];
- n=this.points[d[2]];v=this.points[d[3]];k=j*j;o=j*k;e.x=c(s.x,p.x,n.x,v.x,j,k,o);e.y=c(s.y,p.y,n.y,v.y,j,k,o);e.z=c(s.z,p.z,n.z,v.z,j,k,o);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,i=new THREE.Vector3,h=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);d=this.points.length*b;i.copy(this.points[0]);for(b=1;b<d;b++)c=b/d,position=this.getPoint(c),h.copy(position),
- k+=h.distanceTo(i),i.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,i,h,j,k=[],p=new THREE.Vector3,o=this.getLength();k.push(p.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){d=o.chunks[c]-o.chunks[c-1];j=Math.ceil(b*d/o.total);i=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(d=1;d<j-1;d++)e=i+d*(1/j)*(h-i),position=this.getPoint(e),k.push(p.copy(position).clone());
- k.push(p.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(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
- THREE.Camera.prototype.lookAt=function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(b,c,d,e,h,i){THREE.Camera.call(this);this.left=b;this.right=c;this.top=d;this.bottom=e;this.near=h!==void 0?h:0.1;this.far=i!==void 0?i:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;
- THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(b,c,d,e){THREE.Camera.call(this);this.fov=b!==void 0?b:50;this.aspect=c!==void 0?c:1;this.near=d!==void 0?d:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;THREE.PerspectiveCamera.prototype.constructor=THREE.PerspectiveCamera;
- THREE.PerspectiveCamera.prototype.setLens=function(b,c){this.fov=2*Math.atan((c!==void 0?c:43.25)/(b*2));this.fov*=180/Math.PI;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype.setViewOffset=function(b,c,d,e,h,i){this.fullWidth=b;this.fullHeight=c;this.x=d;this.y=e;this.width=h;this.height=i;this.updateProjectionMatrix()};
- THREE.PerspectiveCamera.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.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){THREE.Light.call(this,b);this.position=new THREE.Vector3(0,1,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?d:0};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(0,0,0);this.intensity=c!==void 0?c:1;this.distance=d!==void 0?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!==void 0?c:1;this.distance=d!==void 0?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.name="";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.depthWrite=b.depthWrite!==void 0?b.depthWrite:!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;this.fog=b.fog!==void 0?b.fog:!0};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.fog=b.fog!==void 0?b.fog:
- !0;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.fog=b.fog!==void 0?
- b.fog:!0;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.fog=b.fog!==void 0?b.fog:!0;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){console.warn("DEPRECATED: MeshShaderMaterial() is now ShaderMaterial().");return new THREE.ShaderMaterial(b)};
- 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;this.fog=b.fog!==void 0?b.fog:!0};THREE.ParticleBasicMaterial.prototype=new THREE.Material;THREE.ParticleBasicMaterial.prototype.constructor=THREE.ParticleBasicMaterial;
- THREE.ShaderMaterial=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.ShaderMaterial.prototype=new THREE.Material;THREE.ShaderMaterial.prototype.constructor=THREE.ShaderMaterial;
- THREE.Texture=function(b,c,d,e,h,i){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=i!==void 0?i: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.DataTexture=function(b,c,d,e,h,i,j,k,o){THREE.Texture.call(this,null,h,i,j,k,o);this.image={data:b,width:c,height:d};this.format=e!==void 0?e:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
- THREE.DataTexture.prototype.clone=function(){var b=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b};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,i,j,k;if(this.geometry.bones!==void 0){for(d=0;d<this.geometry.bones.length;d++)h=this.geometry.bones[d],i=h.pos,j=h.rotq,k=h.scl,e=this.addBone(),e.name=h.name,e.position.set(i[0],i[1],i[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,i=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[i].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.addLevel=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.add(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);this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.map=b.map instanceof THREE.Texture?b.map:THREE.ImageUtils.loadTexture(b.map);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.overrideMaterial=this.fog=null;this.matrixAutoUpdate=!1};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Fog=function(b,c,d){this.color=new THREE.Color(b);this.near=c!==void 0?c:1;this.far=d!==void 0?d:1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
- THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",
- envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",
- envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",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#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}\n#endif\n}",
- lights_phong_pars_vertex:"#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\nuniform float pointLightDistance[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif",lights_phong_vertex:"#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 );\nvPointLight[ i ] = vec4( lVector, lDistance );\n}\n#endif",
- lights_pars_fragment:"uniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nvarying vec4 vPointLight[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\n#if MAX_POINT_LIGHTS > 0\nvec3 pointDiffuse = vec3( 0.0 );\nvec3 pointSpecular = vec3( 0.0 );\nfor ( int i = 0; i < MAX_POINT_LIGHTS; i ++ ) {\nvec3 pointVector = normalize( vPointLight[ i ].xyz );\nvec3 pointHalfVector = normalize( vPointLight[ i ].xyz + viewPosition );\nfloat pointDistance = vPointLight[ i ].w;\nfloat pointDotNormalHalf = max( dot( normal, pointHalfVector ), 0.0 );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += diffuse * pointLightColor[ i ] * pointDiffuseWeight * pointDistance;\npointSpecular += specular * pointLightColor[ i ] * pointSpecularWeight * pointDiffuseWeight * pointDistance;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec3 dirDiffuse = vec3( 0.0 );\nvec3 dirSpecular = vec3( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i ++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + viewPosition );\nfloat dirDotNormalHalf = max( dot( normal, dirHalfVector ), 0.0 );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += diffuse * directionalLightColor[ i ] * dirDiffuseWeight;\ndirSpecular += specular * directionalLightColor[ i ] * dirSpecularWeight * dirDiffuseWeight;\n}\n#endif\nvec3 totalDiffuse = vec3( 0.0 );\nvec3 totalSpecular = vec3( 0.0 );\n#if MAX_DIR_LIGHTS > 0\ntotalDiffuse += dirDiffuse;\ntotalSpecular += dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalDiffuse += pointDiffuse;\ntotalSpecular += pointSpecular;\n#endif\ngl_FragColor.xyz = gl_FragColor.xyz * ( totalDiffuse + ambientLightColor * ambient ) + totalSpecular;",
- 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;\nshadowCoord.z += shadowBias;\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 )\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 )\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},flipEnvMap:{type:"f",value:-1},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refractionRatio:{type:"f",value:0.98},combine:{type:"i",value:0},morphTargetInfluences:{type:"f",value:0}},fog:{fogDensity:{type:"f",
- 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:6,texture:[]},shadowMatrix:{type:"m4v",value:[]},shadowBias:{type:"f",value:0.0039},shadowDarkness:{type:"f",value:0.2}}};
- THREE.ShaderLib={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 vec3 color;\nuniform sampler2D map;\nuniform float opacity;\nvarying vec2 vUV;\nvoid main() {\nvec4 texture = texture2D( map, vUV );\ngl_FragColor = vec4( color * texture.xyz, texture.a * opacity );\n}"},
- depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}"},normal:{uniforms:{opacity:{type:"f",value:1}},
- vertexShader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}",fragmentShader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}"},basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.shadowmap]),vertexShader:[THREE.ShaderChunk.map_pars_vertex,
- 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"),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")},lambert:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.common,THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap]),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"),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")},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}}]),vertexShader:["varying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.ShaderChunk.map_pars_vertex,THREE.ShaderChunk.lightmap_pars_vertex,THREE.ShaderChunk.envmap_pars_vertex,THREE.ShaderChunk.lights_phong_pars_vertex,THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.skinning_pars_vertex,THREE.ShaderChunk.morphtarget_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.map_vertex,THREE.ShaderChunk.lightmap_vertex,
- THREE.ShaderChunk.envmap_vertex,THREE.ShaderChunk.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = -mvPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.ShaderChunk.lights_phong_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;",
- THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.ShaderChunk.lightmap_pars_fragment,THREE.ShaderChunk.envmap_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.lights_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( vec3 ( 1.0 ), opacity );",THREE.ShaderChunk.map_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_fragment,THREE.ShaderChunk.lightmap_fragment,THREE.ShaderChunk.color_fragment,
- THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
- THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
- "}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
- THREE.WebGLRenderer=function(b){function c(b,c,d){var e,i,h,j=b.vertices,x=j.length,R=b.colors,k=R.length,C=b.__vertexArray,r=b.__colorArray,S=b.__sortArray,B=b.__dirtyVertices,p=b.__dirtyColors,o=b.__webglCustomAttributes,n,H;if(o)for(n in o)o[n].offset=0;if(d.sortParticles){ya.multiplySelf(d.matrixWorld);for(e=0;e<x;e++)i=j[e].position,Ba.copy(i),ya.multiplyVector3(Ba),S[e]=[Ba.z,e];S.sort(function(b,f){return f[0]-b[0]});for(e=0;e<x;e++)i=j[S[e][1]].position,h=e*3,C[h]=i.x,C[h+1]=i.y,C[h+2]=i.z;
- for(e=0;e<k;e++)h=e*3,color=R[S[e][1]],r[h]=color.r,r[h+1]=color.g,r[h+2]=color.b;if(o)for(n in o){e=o[n];R=e.value.length;for(h=0;h<R;h++){index=S[h][1];k=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[k]=e.value[index]}else{if(e.boundTo===void 0||e.boundTo==="vertices")H=e.value[index];e.size===2?(e.array[k]=H.x,e.array[k+1]=H.y):e.size===3?e.type==="c"?(e.array[k]=H.r,e.array[k+1]=H.g,e.array[k+2]=H.b):(e.array[k]=H.x,e.array[k+1]=H.y,e.array[k+2]=H.z):(e.array[k]=
- H.x,e.array[k+1]=H.y,e.array[k+2]=H.z,e.array[k+3]=H.w)}e.offset+=e.size}}}else{if(B)for(e=0;e<x;e++)i=j[e].position,h=e*3,C[h]=i.x,C[h+1]=i.y,C[h+2]=i.z;if(p)for(e=0;e<k;e++)color=R[e],h=e*3,r[h]=color.r,r[h+1]=color.g,r[h+2]=color.b;if(o)for(n in o)if(e=o[n],e.__original.needsUpdate){R=e.value.length;for(h=0;h<R;h++){k=e.offset;if(e.size===1){if(e.boundTo===void 0||e.boundTo==="vertices")e.array[k]=e.value[h]}else{if(e.boundTo===void 0||e.boundTo==="vertices")H=e.value[h];e.size===2?(e.array[k]=
- H.x,e.array[k+1]=H.y):e.size===3?e.type==="c"?(e.array[k]=H.r,e.array[k+1]=H.g,e.array[k+2]=H.b):(e.array[k]=H.x,e.array[k+1]=H.y,e.array[k+2]=H.z):(e.array[k]=H.x,e.array[k+1]=H.y,e.array[k+2]=H.z,e.array[k+3]=H.w)}e.offset+=e.size}}}if(B||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,C,c);if(p||d.sortParticles)f.bindBuffer(f.ARRAY_BUFFER,b.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,r,c);if(o)for(n in o)if(e=o[n],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,i){e.program||E.initMaterial(e,c,d,i);if(e.morphTargets&&!i.__webglMorphTargetInfluences){i.__webglMorphTargetInfluences=new Float32Array(E.maxMorphTargets);for(var h=0,j=E.maxMorphTargets;h<j;h++)i.__webglMorphTargetInfluences[h]=0}var x=!1,h=e.program,j=h.uniforms,k=e.uniforms;h!=Q&&(f.useProgram(h),Q=h,x=!0);if(e.id!=L)L=e.id,x=!0;if(x){f.uniformMatrix4fv(j.projectionMatrix,!1,Oa);if(d&&e.fog)if(k.fogColor.value=d.color,d instanceof
- THREE.Fog)k.fogNear.value=d.near,k.fogFar.value=d.far;else if(d instanceof THREE.FogExp2)k.fogDensity.value=d.density;if(e instanceof THREE.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e.lights){for(var o,C,r=0,S=0,B=0,n,p,s,H=Ua,v=H.directional.colors,w=H.directional.positions,t=H.point.colors,u=H.point.positions,D=H.point.distances,K=0,F=0,d=o=s=0,x=c.length;d<x;d++)if(o=c[d],C=o.color,n=o.position,p=o.intensity,s=o.distance,o instanceof THREE.AmbientLight)r+=C.r,S+=C.g,B+=C.b;else if(o instanceof
- THREE.DirectionalLight)s=K*3,v[s]=C.r*p,v[s+1]=C.g*p,v[s+2]=C.b*p,w[s]=n.x,w[s+1]=n.y,w[s+2]=n.z,K+=1;else if(o instanceof THREE.SpotLight)s=K*3,v[s]=C.r*p,v[s+1]=C.g*p,v[s+2]=C.b*p,C=1/n.length(),w[s]=n.x*C,w[s+1]=n.y*C,w[s+2]=n.z*C,K+=1;else if(o instanceof THREE.PointLight)o=F*3,t[o]=C.r*p,t[o+1]=C.g*p,t[o+2]=C.b*p,u[o]=n.x,u[o+1]=n.y,u[o+2]=n.z,D[F]=s,F+=1;d=K*3;for(x=v.length;d<x;d++)v[d]=0;d=F*3;for(x=t.length;d<x;d++)t[d]=0;H.point.length=F;H.directional.length=K;H.ambient[0]=r;H.ambient[1]=
- S;H.ambient[2]=B;c=Ua;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=c.point.distances}if(e instanceof THREE.MeshBasicMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.MeshPhongMaterial)k.diffuse.value=e.color,k.opacity.value=
- e.opacity,(k.map.texture=e.map)&&k.offsetRepeat.value.set(e.map.offset.x,e.map.offset.y,e.map.repeat.x,e.map.repeat.y),k.lightMap.texture=e.lightMap,k.envMap.texture=e.envMap,k.flipEnvMap.value=e.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,k.reflectivity.value=e.reflectivity,k.refractionRatio.value=e.refractionRatio,k.combine.value=e.combine,k.useRefract.value=e.envMap&&e.envMap.mapping instanceof THREE.CubeRefractionMapping;if(e instanceof THREE.LineBasicMaterial)k.diffuse.value=e.color,k.opacity.value=
- e.opacity;else if(e instanceof THREE.ParticleBasicMaterial)k.psColor.value=e.color,k.opacity.value=e.opacity,k.size.value=e.size,k.scale.value=Ca.height/2,k.map.texture=e.map;else if(e instanceof THREE.MeshPhongMaterial)k.ambient.value=e.ambient,k.specular.value=e.specular,k.shininess.value=e.shininess;else if(e instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=e.opacity;else if(e instanceof THREE.MeshNormalMaterial)k.opacity.value=e.opacity;if(i.receiveShadow&&
- !e._shadowPass&&k.shadowMatrix){for(c=0;c<Ma.length;c++)k.shadowMatrix.value[c]=Ma[c],k.shadowMap.texture[c]=E.shadowMap[c];k.shadowDarkness.value=E.shadowMapDarkness;k.shadowBias.value=E.shadowMapBias}c=e.uniformsList;k=0;for(d=c.length;k<d;k++)if(S=h.uniforms[c[k][1]])if(r=c[k][0],B=r.type,x=r.value,B=="i")f.uniform1i(S,x);else if(B=="f")f.uniform1f(S,x);else if(B=="v2")f.uniform2f(S,x.x,x.y);else if(B=="v3")f.uniform3f(S,x.x,x.y,x.z);else if(B=="v4")f.uniform4f(S,x.x,x.y,x.z,x.w);else if(B=="c")f.uniform3f(S,
- x.r,x.g,x.b);else if(B=="fv1")f.uniform1fv(S,x);else if(B=="fv")f.uniform3fv(S,x);else if(B=="v3v"){if(!r._array)r._array=new Float32Array(3*x.length);B=0;for(n=x.length;B<n;B++)H=B*3,r._array[H]=x[B].x,r._array[H+1]=x[B].y,r._array[H+2]=x[B].z;f.uniform3fv(S,r._array)}else if(B=="m4"){if(!r._array)r._array=new Float32Array(16);x.flattenToArray(r._array);f.uniformMatrix4fv(S,!1,r._array)}else if(B=="m4v"){if(!r._array)r._array=new Float32Array(16*x.length);B=0;for(n=x.length;B<n;B++)x[B].flattenToArrayOffset(r._array,
- B*16);f.uniformMatrix4fv(S,!1,r._array)}else if(B=="t"){if(f.uniform1i(S,x),S=r.texture)if(S.image instanceof Array&&S.image.length==6){if(r=S,r.image.length==6)if(r.needsUpdate){if(!r.image.__webglTextureCube)r.image.__webglTextureCube=f.createTexture();f.activeTexture(f.TEXTURE0+x);f.bindTexture(f.TEXTURE_CUBE_MAP,r.image.__webglTextureCube);for(x=0;x<6;x++)f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,r.image[x]);O(f.TEXTURE_CUBE_MAP,r,r.image[0]);r.needsUpdate=!1}else f.activeTexture(f.TEXTURE0+
- x),f.bindTexture(f.TEXTURE_CUBE_MAP,r.image.__webglTextureCube)}else S instanceof THREE.WebGLRenderTargetCube?(r=S,f.activeTexture(f.TEXTURE0+x),f.bindTexture(f.TEXTURE_CUBE_MAP,r.__webglTexture)):G(S,x)}else if(B=="tv"){if(!r._array){r._array=[];B=0;for(n=r.texture.length;B<n;B++)r._array[B]=x+B}f.uniform1iv(S,r._array);B=0;for(n=r.texture.length;B<n;B++)(S=r.texture[B])&&G(S,r._array[B])}(e instanceof THREE.ShaderMaterial||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.MeshPhongMaterial||e instanceof THREE.MeshLambertMaterial||e instanceof THREE.ShaderMaterial||e.skinning)&&j.viewMatrix!==null&&f.uniformMatrix4fv(j.viewMatrix,!1,Pa);e.skinning&&(f.uniformMatrix4fv(j.cameraInverseMatrix,!1,Pa),f.uniformMatrix4fv(j.boneGlobalMatrices,!1,i.boneMatrices))}f.uniformMatrix4fv(j.modelViewMatrix,!1,i._modelViewMatrixArray);j.normalMatrix&&f.uniformMatrix3fv(j.normalMatrix,!1,i._normalMatrixArray);
- (e instanceof THREE.ShaderMaterial||e.envMap||e.skinning||i.receiveShadow)&&j.objectMatrix!==null&&f.uniformMatrix4fv(j.objectMatrix,!1,i._objectMatrixArray);return h}function e(b,c,e,i,h,j){if(i.opacity!=0){var k,e=d(b,c,e,i,j),b=e.attributes,c=!1,e=h.id*16777215+e.id*2+(i.wireframe?1:0);e!=X&&(X=e,c=!0);if(!i.morphTargets&&b.position>=0)c&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(b.position,3,f.FLOAT,!1,0,0));else if(j.morphTargetBase){e=i.program.attributes;j.morphTargetBase!==
- -1?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[j.morphTargetBase]),f.vertexAttribPointer(e.position,3,f.FLOAT,!1,0,0)):e.position>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.vertexAttribPointer(e.position,3,f.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var x=0,o=j.morphTargetForcedOrder,n=j.morphTargetInfluences;x<i.numSupportedMorphTargets&&x<o.length;)f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[o[x]]),f.vertexAttribPointer(e["morphTarget"+x],3,
- f.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[x]=n[o[x]],x++;else{var o=[],C=-1,r=0,n=j.morphTargetInfluences,p,B=n.length,x=0;for(j.morphTargetBase!==-1&&(o[j.morphTargetBase]=!0);x<i.numSupportedMorphTargets;){for(p=0;p<B;p++)!o[p]&&n[p]>C&&(r=p,C=n[r]);f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[r]);f.vertexAttribPointer(e["morphTarget"+x],3,f.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[x]=C;o[r]=1;C=-1;x++}}i.program.uniforms.morphTargetInfluences!==null&&f.uniform1fv(i.program.uniforms.morphTargetInfluences,
- j.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(k in h.__webglCustomAttributes)b[k]>=0&&(e=h.__webglCustomAttributes[k],f.bindBuffer(f.ARRAY_BUFFER,e.buffer),f.vertexAttribPointer(b[k],e.size,f.FLOAT,!1,0,0));b.color>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglColorBuffer),f.vertexAttribPointer(b.color,3,f.FLOAT,!1,0,0));b.normal>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglNormalBuffer),f.vertexAttribPointer(b.normal,3,f.FLOAT,!1,0,0));b.tangent>=0&&(f.bindBuffer(f.ARRAY_BUFFER,
- h.__webglTangentBuffer),f.vertexAttribPointer(b.tangent,4,f.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUVBuffer),f.vertexAttribPointer(b.uv,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv)):f.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUV2Buffer),f.vertexAttribPointer(b.uv2,2,f.FLOAT,!1,0,0),f.enableVertexAttribArray(b.uv2)):f.disableVertexAttribArray(b.uv2));i.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
- 0&&b.skinIndex>=0&&b.skinWeight>=0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexABuffer),f.vertexAttribPointer(b.skinVertexA,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),f.vertexAttribPointer(b.skinVertexB,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),f.vertexAttribPointer(b.skinIndex,4,f.FLOAT,!1,0,0),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),f.vertexAttribPointer(b.skinWeight,4,f.FLOAT,!1,0,0))}j instanceof THREE.Mesh?(i.wireframe?
- (f.lineWidth(i.wireframeLinewidth),c&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),f.drawElements(f.LINES,h.__webglLineCount,f.UNSIGNED_SHORT,0)):(c&&f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),f.drawElements(f.TRIANGLES,h.__webglFaceCount,f.UNSIGNED_SHORT,0)),E.info.render.calls++,E.info.render.vertices+=h.__webglFaceCount,E.info.render.faces+=h.__webglFaceCount/3):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?f.LINE_STRIP:f.LINES,f.lineWidth(i.linewidth),f.drawArrays(j,
- 0,h.__webglLineCount),E.info.render.calls++):j instanceof THREE.ParticleSystem?(f.drawArrays(f.POINTS,0,h.__webglParticleCount),E.info.render.calls++):j instanceof THREE.Ribbon&&(f.drawArrays(f.TRIANGLE_STRIP,0,h.__webglVertexCount),E.info.render.calls++)}}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,h,i,j,k,o,n,C,r,p,B=b.count*3;for(p=0;p<B;p+=9)d=b.normalArray,e=d[p],h=d[p+1],i=d[p+2],j=d[p+3],o=d[p+4],C=d[p+5],k=d[p+6],n=d[p+7],r=d[p+8],e=(e+j+k)/3,h=(h+o+n)/3,i=(i+C+r)/3,d[p]=e,d[p+1]=h,d[p+2]=i,d[p+3]=e,d[p+4]=h,d[p+5]=i,d[p+6]=e,d[p+7]=h,d[p+8]=i}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 i(b){if(Ka!=b.doubleSided)b.doubleSided?f.disable(f.CULL_FACE):f.enable(f.CULL_FACE),Ka=b.doubleSided;if(La!=b.flipSided)b.flipSided?f.frontFace(f.CW):f.frontFace(f.CCW),La=b.flipSided}function j(b){ta!=b&&(b?f.enable(f.DEPTH_TEST):f.disable(f.DEPTH_TEST),ta=b)}function k(b){va!=b&&(f.depthMask(b),va=b)}function o(b,
- c,d){Va!=b&&(b?f.enable(f.POLYGON_OFFSET_FILL):f.disable(f.POLYGON_OFFSET_FILL),Va=b);if(b&&(Wa!=c||Xa!=d))f.polygonOffset(c,d),Wa=c,Xa=d}function s(b){pa[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);pa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);pa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);pa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);pa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);pa[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=pa[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function p(b){for(var c=b.matrixWorld,f=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),d=0;d<6;d++)if(b=pa[d].x*c.n14+pa[d].y*c.n24+pa[d].z*c.n34+pa[d].w,b<=f)return!1;return!0}function n(b,c){b.list[b.count]=c;b.count+=1}function v(b){var c,f,d=b.object,e=b.opaque,h=b.transparent;h.count=0;b=e.count=0;for(c=d.materials.length;b<c;b++)f=d.materials[b],f.transparent?n(h,f):n(e,f)}function w(b){var c,
- f,d,e,h=b.object,i=b.buffer,j=b.opaque,k=b.transparent;k.count=0;b=j.count=0;for(d=h.materials.length;b<d;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(f=i.materials.length;c<f;c++)(e=i.materials[c])&&(e.transparent?n(k,e):n(j,e))}else(e=c)&&(e.transparent?n(k,e):n(j,e))}function D(b,c){return c.z-b.z}function F(b){var c,k,Ea,Fa=0,o,n,x,R,v;E.initWebGLObjects(b);v=b.__webglLights;la||(la=new THREE.PerspectiveCamera(E.shadowCameraFov,E.shadowMapWidth/E.shadowMapHeight,E.shadowCameraNear,
- E.shadowCameraFar));c=0;for(k=v.length;c<k;c++)if(Ea=v[c],Ea instanceof THREE.SpotLight&&Ea.castShadow){L=-1;E.shadowMap[Fa]||(E.shadowMap[Fa]=new THREE.WebGLRenderTarget(E.shadowMapWidth,E.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ma[Fa]||(Ma[Fa]=new THREE.Matrix4);o=E.shadowMap[Fa];n=Ma[Fa];la.position.copy(Ea.position);la.lookAt(Ea.target.position);la.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),b.add(la));b.updateMatrixWorld();
- la.matrixWorldInverse.getInverse(la.matrixWorld);n.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);n.multiplySelf(la.projectionMatrix);n.multiplySelf(la.matrixWorldInverse);la.matrixWorldInverse.flattenToArray(Pa);la.projectionMatrix.flattenToArray(Oa);ya.multiply(la.projectionMatrix,la.matrixWorldInverse);s(ya);oa(o);f.clearColor(1,1,1,1);E.clear();f.clearColor(ma.r,ma.g,ma.b,za);n=b.__webglObjects.length;Ea=b.__webglObjectsImmediate.length;for(o=0;o<n;o++)x=b.__webglObjects[o],R=x.object,R.visible&&
- R.castShadow?!(R instanceof THREE.Mesh)||!R.frustumCulled||p(R)?(R.matrixWorld.flattenToArray(R._objectMatrixArray),I(R,la,!1),x.render=!0):x.render=!1:x.render=!1;j(!0);V(THREE.NormalBlending);for(o=0;o<n;o++)if(x=b.__webglObjects[o],x.render)R=x.object,buffer=x.buffer,i(R),x=R.customDepthMaterial?R.customDepthMaterial:R.geometry.morphTargets.length?Ya:Qa,e(la,v,null,x,buffer,R);for(o=0;o<Ea;o++)x=b.__webglObjectsImmediate[o],R=x.object,R.visible&&R.castShadow&&(R.matrixAutoUpdate&&R.matrixWorld.flattenToArray(R._objectMatrixArray),
- X=-1,I(R,la,!1),i(R),program=d(la,v,null,Qa,R),R.immediateRenderCallback?R.immediateRenderCallback(program,f,pa):R.render(function(b){h(b,program,Qa.shading)}));Fa++}}function J(b,c){var d,e,h;d=t.attributes;var i=t.uniforms,j=Ja/Na,k,o=[],p=Na*0.5,n=Ja*0.5,r=!0;f.useProgram(t.program);Q=t.program;X=ta=xa=-1;Za||(f.enableVertexAttribArray(t.attributes.position),f.enableVertexAttribArray(t.attributes.uv),Za=!0);f.disable(f.CULL_FACE);f.enable(f.BLEND);f.depthMask(!0);f.bindBuffer(f.ARRAY_BUFFER,t.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,t.elementBuffer);f.uniformMatrix4fv(i.projectionMatrix,!1,Oa);f.activeTexture(f.TEXTURE0);f.uniform1i(i.map,0);d=0;for(e=b.__webglSprites.length;d<e;d++)if(h=b.__webglSprites[d],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);
- b.__webglSprites.sort(D);d=0;for(e=b.__webglSprites.length;d<e;d++)h=b.__webglSprites[d],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(f.uniform1i(i.useScreenCoordinates,1),f.uniform3f(i.screenPosition,(h.position.x-p)/p,(n-h.position.y)/n,Math.max(0,Math.min(1,h.position.z)))):(f.uniform1i(i.useScreenCoordinates,0),f.uniform1i(i.affectedByDistance,h.affectedByDistance?1:0),f.uniformMatrix4fv(i.modelViewMatrix,!1,h._modelViewMatrixArray)),k=h.map.image.width/
- (h.scaleByViewport?Ja:1),o[0]=k*j*h.scale.x,o[1]=k*h.scale.y,f.uniform2f(i.uvScale,h.uvScale.x,h.uvScale.y),f.uniform2f(i.uvOffset,h.uvOffset.x,h.uvOffset.y),f.uniform2f(i.alignment,h.alignment.x,h.alignment.y),f.uniform1f(i.opacity,h.opacity),f.uniform3f(i.color,h.color.r,h.color.g,h.color.b),f.uniform1f(i.rotation,h.rotation),f.uniform2fv(i.scale,o),h.mergeWith3D&&!r?(f.enable(f.DEPTH_TEST),r=!0):!h.mergeWith3D&&r&&(f.disable(f.DEPTH_TEST),r=!1),V(h.blending),G(h.map,0),f.drawElements(f.TRIANGLES,
- 6,f.UNSIGNED_SHORT,0));f.enable(f.CULL_FACE);f.enable(f.DEPTH_TEST);f.depthMask(va)}function I(b,c,f){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);f&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function ga(b){var c,f,d,e;e=b.__materials;b=0;for(f=e.length;b<f;b++)if(d=e[b],d.attributes)for(c in d.attributes)if(d.attributes[c].needsUpdate)return!0;return!1}function u(b){var c,f,d,e;e=b.__materials;b=0;for(f=
- e.length;b<f;b++)if(d=e[b],d.attributes)for(c in d.attributes)d.attributes[c].needsUpdate=!1}function ha(b){var d,e,h;if(b instanceof THREE.Mesh){d=b.geometry;for(var i=0,j=d.geometryGroupsList.length;i<j;i++)if(e=d.geometryGroupsList[i],h=ga(e),d.__dirtyVertices||d.__dirtyMorphTargets||d.__dirtyElements||d.__dirtyUvs||d.__dirtyNormals||d.__dirtyColors||d.__dirtyTangents||h){h=e;var k=f.DYNAMIC_DRAW,x=!d.dynamic;if(h.__inittedArrays){var o=void 0,p=void 0,n=void 0,r=void 0,s=n=void 0,B=void 0,v=void 0,
- w=void 0,t=void 0,H=void 0,D=void 0,E=void 0,F=void 0,M=void 0,N=void 0,K=void 0,A=void 0,q=r=w=r=v=B=void 0,m=void 0,z=m=q=B=void 0,J=void 0,L=z=m=q=n=n=s=w=r=z=m=q=J=z=m=q=J=z=m=q=void 0,I=0,G=0,V=0,W=0,T=0,P=0,Z=0,Q=0,ja=0,y=0,ka=0,z=q=0,z=void 0,O=h.__vertexArray,fa=h.__uvArray,ia=h.__uv2Array,U=h.__normalArray,$=h.__tangentArray,na=h.__colorArray,aa=h.__skinVertexAArray,ca=h.__skinVertexBArray,da=h.__skinIndexArray,ea=h.__skinWeightArray,la=h.__morphTargetsArrays,Y=h.__webglCustomAttributes,
- m=void 0,ha=h.__faceArray,X=h.__lineArray,ra=h.__needsSmoothNormals,H=h.__vertexColorType,t=h.__uvType,D=h.__normalType,qa=b.geometry,oa=qa.__dirtyVertices,pa=qa.__dirtyElements,ma=qa.__dirtyUvs,sa=qa.__dirtyNormals,ua=qa.__dirtyTangents,va=qa.__dirtyColors,xa=qa.__dirtyMorphTargets,ta=qa.vertices,ya=h.faces,Ca=qa.faces,za=qa.faceVertexUvs[0],Ba=qa.faceVertexUvs[1],Ga=qa.skinVerticesA,Ha=qa.skinVerticesB,Ia=qa.skinIndices,Da=qa.skinWeights,Aa=qa.morphTargets;if(Y)for(L in Y)Y[L].offset=0,Y[L].offsetSrc=
- 0;o=0;for(p=ya.length;o<p;o++)if(n=ya[o],r=Ca[n],za&&(E=za[n]),Ba&&(F=Ba[n]),n=r.vertexNormals,s=r.normal,B=r.vertexColors,v=r.color,w=r.vertexTangents,r instanceof THREE.Face3){if(oa)M=ta[r.a].position,N=ta[r.b].position,K=ta[r.c].position,O[G]=M.x,O[G+1]=M.y,O[G+2]=M.z,O[G+3]=N.x,O[G+4]=N.y,O[G+5]=N.z,O[G+6]=K.x,O[G+7]=K.y,O[G+8]=K.z,G+=9;if(Y)for(L in Y)if(m=Y[L],m.__original.needsUpdate)q=m.offset,z=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[q]=m.value[r.a],m.array[q+
- 1]=m.value[r.b],m.array[q+2]=m.value[r.c]):m.boundTo==="faces"?(z=m.value[z],m.array[q]=z,m.array[q+1]=z,m.array[q+2]=z,m.offsetSrc++):m.boundTo==="faceVertices"&&(m.array[q]=m.value[z],m.array[q+1]=m.value[z+1],m.array[q+2]=m.value[z+2],m.offsetSrc+=3),m.offset+=3):(m.boundTo===void 0||m.boundTo==="vertices"?(M=m.value[r.a],N=m.value[r.b],K=m.value[r.c]):m.boundTo==="faces"?(K=N=M=z=m.value[z],m.offsetSrc++):m.boundTo==="faceVertices"&&(M=m.value[z],N=m.value[z+1],K=m.value[z+2],m.offsetSrc+=3),
- m.size===2?(m.array[q]=M.x,m.array[q+1]=M.y,m.array[q+2]=N.x,m.array[q+3]=N.y,m.array[q+4]=K.x,m.array[q+5]=K.y,m.offset+=6):m.size===3?(m.type==="c"?(m.array[q]=M.r,m.array[q+1]=M.g,m.array[q+2]=M.b,m.array[q+3]=N.r,m.array[q+4]=N.g,m.array[q+5]=N.b,m.array[q+6]=K.r,m.array[q+7]=K.g,m.array[q+8]=K.b):(m.array[q]=M.x,m.array[q+1]=M.y,m.array[q+2]=M.z,m.array[q+3]=N.x,m.array[q+4]=N.y,m.array[q+5]=N.z,m.array[q+6]=K.x,m.array[q+7]=K.y,m.array[q+8]=K.z),m.offset+=9):(m.array[q]=M.x,m.array[q+1]=M.y,
- m.array[q+2]=M.z,m.array[q+3]=M.w,m.array[q+4]=N.x,m.array[q+5]=N.y,m.array[q+6]=N.z,m.array[q+7]=N.w,m.array[q+8]=K.x,m.array[q+9]=K.y,m.array[q+10]=K.z,m.array[q+11]=K.w,m.offset+=12));if(xa){q=0;for(m=Aa.length;q<m;q++)M=Aa[q].vertices[r.a].position,N=Aa[q].vertices[r.b].position,K=Aa[q].vertices[r.c].position,z=la[q],z[ka]=M.x,z[ka+1]=M.y,z[ka+2]=M.z,z[ka+3]=N.x,z[ka+4]=N.y,z[ka+5]=N.z,z[ka+6]=K.x,z[ka+7]=K.y,z[ka+8]=K.z;ka+=9}if(Da.length)q=Da[r.a],m=Da[r.b],z=Da[r.c],ea[y]=q.x,ea[y+1]=q.y,ea[y+
- 2]=q.z,ea[y+3]=q.w,ea[y+4]=m.x,ea[y+5]=m.y,ea[y+6]=m.z,ea[y+7]=m.w,ea[y+8]=z.x,ea[y+9]=z.y,ea[y+10]=z.z,ea[y+11]=z.w,q=Ia[r.a],m=Ia[r.b],z=Ia[r.c],da[y]=q.x,da[y+1]=q.y,da[y+2]=q.z,da[y+3]=q.w,da[y+4]=m.x,da[y+5]=m.y,da[y+6]=m.z,da[y+7]=m.w,da[y+8]=z.x,da[y+9]=z.y,da[y+10]=z.z,da[y+11]=z.w,q=Ga[r.a],m=Ga[r.b],z=Ga[r.c],aa[y]=q.x,aa[y+1]=q.y,aa[y+2]=q.z,aa[y+3]=1,aa[y+4]=m.x,aa[y+5]=m.y,aa[y+6]=m.z,aa[y+7]=1,aa[y+8]=z.x,aa[y+9]=z.y,aa[y+10]=z.z,aa[y+11]=1,q=Ha[r.a],m=Ha[r.b],z=Ha[r.c],ca[y]=q.x,ca[y+
- 1]=q.y,ca[y+2]=q.z,ca[y+3]=1,ca[y+4]=m.x,ca[y+5]=m.y,ca[y+6]=m.z,ca[y+7]=1,ca[y+8]=z.x,ca[y+9]=z.y,ca[y+10]=z.z,ca[y+11]=1,y+=12;if(va&&H)B.length==3&&H==THREE.VertexColors?(r=B[0],q=B[1],m=B[2]):m=q=r=v,na[ja]=r.r,na[ja+1]=r.g,na[ja+2]=r.b,na[ja+3]=q.r,na[ja+4]=q.g,na[ja+5]=q.b,na[ja+6]=m.r,na[ja+7]=m.g,na[ja+8]=m.b,ja+=9;if(ua&&qa.hasTangents)B=w[0],v=w[1],r=w[2],$[Z]=B.x,$[Z+1]=B.y,$[Z+2]=B.z,$[Z+3]=B.w,$[Z+4]=v.x,$[Z+5]=v.y,$[Z+6]=v.z,$[Z+7]=v.w,$[Z+8]=r.x,$[Z+9]=r.y,$[Z+10]=r.z,$[Z+11]=r.w,Z+=
- 12;if(sa&&D)if(n.length==3&&ra)for(w=0;w<3;w++)s=n[w],U[P]=s.x,U[P+1]=s.y,U[P+2]=s.z,P+=3;else for(w=0;w<3;w++)U[P]=s.x,U[P+1]=s.y,U[P+2]=s.z,P+=3;if(ma&&E!==void 0&&t)for(w=0;w<3;w++)n=E[w],fa[V]=n.u,fa[V+1]=n.v,V+=2;if(ma&&F!==void 0&&t)for(w=0;w<3;w++)n=F[w],ia[W]=n.u,ia[W+1]=n.v,W+=2;pa&&(ha[T]=I,ha[T+1]=I+1,ha[T+2]=I+2,T+=3,X[Q]=I,X[Q+1]=I+1,X[Q+2]=I,X[Q+3]=I+2,X[Q+4]=I+1,X[Q+5]=I+2,Q+=6,I+=3)}else if(r instanceof THREE.Face4){if(oa)M=ta[r.a].position,N=ta[r.b].position,K=ta[r.c].position,A=
- ta[r.d].position,O[G]=M.x,O[G+1]=M.y,O[G+2]=M.z,O[G+3]=N.x,O[G+4]=N.y,O[G+5]=N.z,O[G+6]=K.x,O[G+7]=K.y,O[G+8]=K.z,O[G+9]=A.x,O[G+10]=A.y,O[G+11]=A.z,G+=12;if(Y)for(L in Y)if(m=Y[L],m.__original.needsUpdate)q=m.offset,z=m.offsetSrc,m.size===1?(m.boundTo===void 0||m.boundTo==="vertices"?(m.array[q]=m.value[r.a],m.array[q+1]=m.value[r.b],m.array[q+2]=m.value[r.c],m.array[q+3]=m.value[r.d]):m.boundTo==="faces"?(z=m.value[z],m.array[q]=z,m.array[q+1]=z,m.array[q+2]=z,m.array[q+3]=z,m.offsetSrc++):m.boundTo===
- "faceVertices"&&(m.array[q]=m.value[z],m.array[q+1]=m.value[z+1],m.array[q+2]=m.value[z+2],m.array[q+3]=m.value[z+3],m.offsetSrc+=4),m.offset+=4):(m.boundTo===void 0||m.boundTo==="vertices"?(M=m.value[r.a],N=m.value[r.b],K=m.value[r.c],A=m.value[r.d]):m.boundTo==="faces"?(A=K=N=M=z=m.value[z],m.offsetSrc++):m.boundTo==="faceVertices"&&(M=m.value[z],N=m.value[z+1],K=m.value[z+2],A=m.value[z+3],m.offsetSrc+=4),m.size===2?(m.array[q]=M.x,m.array[q+1]=M.y,m.array[q+2]=N.x,m.array[q+3]=N.y,m.array[q+4]=
- K.x,m.array[q+5]=K.y,m.array[q+6]=A.x,m.array[q+7]=A.y,m.offset+=8):m.size===3?(m.type==="c"?(m.array[q]=M.r,m.array[q+1]=M.g,m.array[q+2]=M.b,m.array[q+3]=N.r,m.array[q+4]=N.g,m.array[q+5]=N.b,m.array[q+6]=K.r,m.array[q+7]=K.g,m.array[q+8]=K.b,m.array[q+9]=A.r,m.array[q+10]=A.g,m.array[q+11]=A.b):(m.array[q]=M.x,m.array[q+1]=M.y,m.array[q+2]=M.z,m.array[q+3]=N.x,m.array[q+4]=N.y,m.array[q+5]=N.z,m.array[q+6]=K.x,m.array[q+7]=K.y,m.array[q+8]=K.z,m.array[q+9]=A.x,m.array[q+10]=A.y,m.array[q+11]=A.z),
- m.offset+=12):(m.array[q]=M.x,m.array[q+1]=M.y,m.array[q+2]=M.z,m.array[q+3]=M.w,m.array[q+4]=N.x,m.array[q+5]=N.y,m.array[q+6]=N.z,m.array[q+7]=N.w,m.array[q+8]=K.x,m.array[q+9]=K.y,m.array[q+10]=K.z,m.array[q+11]=K.w,m.array[q+12]=A.x,m.array[q+13]=A.y,m.array[q+14]=A.z,m.array[q+15]=A.w,m.offset+=16));if(xa){q=0;for(m=Aa.length;q<m;q++)M=Aa[q].vertices[r.a].position,N=Aa[q].vertices[r.b].position,K=Aa[q].vertices[r.c].position,A=Aa[q].vertices[r.d].position,z=la[q],z[ka]=M.x,z[ka+1]=M.y,z[ka+2]=
- M.z,z[ka+3]=N.x,z[ka+4]=N.y,z[ka+5]=N.z,z[ka+6]=K.x,z[ka+7]=K.y,z[ka+8]=K.z,z[ka+9]=A.x,z[ka+10]=A.y,z[ka+11]=A.z;ka+=12}if(Da.length)q=Da[r.a],m=Da[r.b],z=Da[r.c],J=Da[r.d],ea[y]=q.x,ea[y+1]=q.y,ea[y+2]=q.z,ea[y+3]=q.w,ea[y+4]=m.x,ea[y+5]=m.y,ea[y+6]=m.z,ea[y+7]=m.w,ea[y+8]=z.x,ea[y+9]=z.y,ea[y+10]=z.z,ea[y+11]=z.w,ea[y+12]=J.x,ea[y+13]=J.y,ea[y+14]=J.z,ea[y+15]=J.w,q=Ia[r.a],m=Ia[r.b],z=Ia[r.c],J=Ia[r.d],da[y]=q.x,da[y+1]=q.y,da[y+2]=q.z,da[y+3]=q.w,da[y+4]=m.x,da[y+5]=m.y,da[y+6]=m.z,da[y+7]=m.w,
- da[y+8]=z.x,da[y+9]=z.y,da[y+10]=z.z,da[y+11]=z.w,da[y+12]=J.x,da[y+13]=J.y,da[y+14]=J.z,da[y+15]=J.w,q=Ga[r.a],m=Ga[r.b],z=Ga[r.c],J=Ga[r.d],aa[y]=q.x,aa[y+1]=q.y,aa[y+2]=q.z,aa[y+3]=1,aa[y+4]=m.x,aa[y+5]=m.y,aa[y+6]=m.z,aa[y+7]=1,aa[y+8]=z.x,aa[y+9]=z.y,aa[y+10]=z.z,aa[y+11]=1,aa[y+12]=J.x,aa[y+13]=J.y,aa[y+14]=J.z,aa[y+15]=1,q=Ha[r.a],m=Ha[r.b],z=Ha[r.c],r=Ha[r.d],ca[y]=q.x,ca[y+1]=q.y,ca[y+2]=q.z,ca[y+3]=1,ca[y+4]=m.x,ca[y+5]=m.y,ca[y+6]=m.z,ca[y+7]=1,ca[y+8]=z.x,ca[y+9]=z.y,ca[y+10]=z.z,ca[y+
- 11]=1,ca[y+12]=r.x,ca[y+13]=r.y,ca[y+14]=r.z,ca[y+15]=1,y+=16;if(va&&H)B.length==4&&H==THREE.VertexColors?(r=B[0],q=B[1],m=B[2],B=B[3]):B=m=q=r=v,na[ja]=r.r,na[ja+1]=r.g,na[ja+2]=r.b,na[ja+3]=q.r,na[ja+4]=q.g,na[ja+5]=q.b,na[ja+6]=m.r,na[ja+7]=m.g,na[ja+8]=m.b,na[ja+9]=B.r,na[ja+10]=B.g,na[ja+11]=B.b,ja+=12;if(ua&&qa.hasTangents)B=w[0],v=w[1],r=w[2],w=w[3],$[Z]=B.x,$[Z+1]=B.y,$[Z+2]=B.z,$[Z+3]=B.w,$[Z+4]=v.x,$[Z+5]=v.y,$[Z+6]=v.z,$[Z+7]=v.w,$[Z+8]=r.x,$[Z+9]=r.y,$[Z+10]=r.z,$[Z+11]=r.w,$[Z+12]=w.x,
- $[Z+13]=w.y,$[Z+14]=w.z,$[Z+15]=w.w,Z+=16;if(sa&&D)if(n.length==4&&ra)for(w=0;w<4;w++)s=n[w],U[P]=s.x,U[P+1]=s.y,U[P+2]=s.z,P+=3;else for(w=0;w<4;w++)U[P]=s.x,U[P+1]=s.y,U[P+2]=s.z,P+=3;if(ma&&E!==void 0&&t)for(w=0;w<4;w++)n=E[w],fa[V]=n.u,fa[V+1]=n.v,V+=2;if(ma&&F!==void 0&&t)for(w=0;w<4;w++)n=F[w],ia[W]=n.u,ia[W+1]=n.v,W+=2;pa&&(ha[T]=I,ha[T+1]=I+1,ha[T+2]=I+3,ha[T+3]=I+1,ha[T+4]=I+2,ha[T+5]=I+3,T+=6,X[Q]=I,X[Q+1]=I+1,X[Q+2]=I,X[Q+3]=I+3,X[Q+4]=I+1,X[Q+5]=I+2,X[Q+6]=I+2,X[Q+7]=I+3,Q+=8,I+=4)}oa&&
- (f.bindBuffer(f.ARRAY_BUFFER,h.__webglVertexBuffer),f.bufferData(f.ARRAY_BUFFER,O,k));if(Y)for(L in Y)m=Y[L],m.__original.needsUpdate&&(f.bindBuffer(f.ARRAY_BUFFER,m.buffer),f.bufferData(f.ARRAY_BUFFER,m.array,k));if(xa){q=0;for(m=Aa.length;q<m;q++)f.bindBuffer(f.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[q]),f.bufferData(f.ARRAY_BUFFER,la[q],k)}va&&ja>0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglColorBuffer),f.bufferData(f.ARRAY_BUFFER,na,k));sa&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglNormalBuffer),f.bufferData(f.ARRAY_BUFFER,
- U,k));ua&&qa.hasTangents&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglTangentBuffer),f.bufferData(f.ARRAY_BUFFER,$,k));ma&&V>0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUVBuffer),f.bufferData(f.ARRAY_BUFFER,fa,k));ma&&W>0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglUV2Buffer),f.bufferData(f.ARRAY_BUFFER,ia,k));pa&&(f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,ha,k),f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,X,k));
- y>0&&(f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexABuffer),f.bufferData(f.ARRAY_BUFFER,aa,k),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),f.bufferData(f.ARRAY_BUFFER,ca,k),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),f.bufferData(f.ARRAY_BUFFER,da,k),f.bindBuffer(f.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),f.bufferData(f.ARRAY_BUFFER,ea,k));x&&(delete h.__inittedArrays,delete h.__colorArray,delete h.__normalArray,delete h.__tangentArray,delete h.__uvArray,delete h.__uv2Array,
- delete h.__faceArray,delete h.__vertexArray,delete h.__lineArray,delete h.__skinVertexAArray,delete h.__skinVertexBArray,delete h.__skinIndexArray,delete h.__skinWeightArray)}}d.__dirtyVertices=!1;d.__dirtyMorphTargets=!1;d.__dirtyElements=!1;d.__dirtyUvs=!1;d.__dirtyNormals=!1;d.__dirtyTangents=!1;d.__dirtyColors=!1;u(e)}else if(b instanceof THREE.Ribbon){d=b.geometry;if(d.__dirtyVertices||d.__dirtyColors){b=d;e=f.DYNAMIC_DRAW;p=b.vertices;j=b.colors;t=p.length;h=j.length;H=b.__vertexArray;k=b.__colorArray;
- D=b.__dirtyColors;if(b.__dirtyVertices){for(x=0;x<t;x++)o=p[x].position,i=x*3,H[i]=o.x,H[i+1]=o.y,H[i+2]=o.z;f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,H,e)}if(D){for(x=0;x<h;x++)color=j[x],i=x*3,k[i]=color.r,k[i+1]=color.g,k[i+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,b.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,k,e)}}d.__dirtyVertices=!1;d.__dirtyColors=!1}else if(b instanceof THREE.Line){d=b.geometry;if(d.__dirtyVertices||d.__dirtyColors){b=d;e=f.DYNAMIC_DRAW;
- p=b.vertices;j=b.colors;t=p.length;h=j.length;H=b.__vertexArray;k=b.__colorArray;D=b.__dirtyColors;if(b.__dirtyVertices){for(x=0;x<t;x++)o=p[x].position,i=x*3,H[i]=o.x,H[i+1]=o.y,H[i+2]=o.z;f.bindBuffer(f.ARRAY_BUFFER,b.__webglVertexBuffer);f.bufferData(f.ARRAY_BUFFER,H,e)}if(D){for(x=0;x<h;x++)color=j[x],i=x*3,k[i]=color.r,k[i+1]=color.g,k[i+2]=color.b;f.bindBuffer(f.ARRAY_BUFFER,b.__webglColorBuffer);f.bufferData(f.ARRAY_BUFFER,k,e)}}d.__dirtyVertices=!1;d.__dirtyColors=!1}else if(b instanceof THREE.ParticleSystem)d=
- b.geometry,h=ga(d),(d.__dirtyVertices||d.__dirtyColors||b.sortParticles||h)&&c(d,f.DYNAMIC_DRAW,b),d.__dirtyVertices=!1,d.__dirtyColors=!1,u(d)}function P(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,h,i,j,k,o,n={},r=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};e=0;for(h=b.faces.length;e<h;e++)i=b.faces[e],j=i.materials,k=c(j),n[k]==void 0&&(n[k]={hash:k,counter:0}),o=n[k].hash+"_"+n[k].counter,
- b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:j,vertices:0,numMorphTargets:r}),i=i instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+i>65535&&(n[k].counter+=1,o=n[k].hash+"_"+n[k].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:j,vertices:0,numMorphTargets:r})),b.geometryGroups[o].faces.push(e),b.geometryGroups[o].vertices+=i;b.geometryGroupsList=[];for(var p in b.geometryGroups)b.geometryGroups[p].id=ua++,b.geometryGroupsList.push(b.geometryGroups[p])}
- function U(b,c,d){b.push({buffer:c,object:d,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function V(b){if(b!=xa){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)}xa=b}}function O(b,c,d){(d.width&d.width-1)==0&&(d.height&d.height-1)==0?(f.texParameteri(b,f.TEXTURE_WRAP_S,A(c.wrapS)),f.texParameteri(b,f.TEXTURE_WRAP_T,A(c.wrapT)),f.texParameteri(b,f.TEXTURE_MAG_FILTER,A(c.magFilter)),f.texParameteri(b,f.TEXTURE_MIN_FILTER,A(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,ia(c.magFilter)),
- f.texParameteri(b,f.TEXTURE_MIN_FILTER,ia(c.minFilter)))}function G(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=f.createTexture(),E.info.memory.textures++;f.activeTexture(f.TEXTURE0+c);f.bindTexture(f.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?f.texImage2D(f.TEXTURE_2D,0,A(b.format),b.image.width,b.image.height,0,A(b.format),f.UNSIGNED_BYTE,b.image.data):f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,b.image);O(f.TEXTURE_2D,b,b.image);b.needsUpdate=
- !1}else f.activeTexture(f.TEXTURE0+c),f.bindTexture(f.TEXTURE_2D,b.__webglTexture)}function ra(b,c){f.bindRenderbuffer(f.RENDERBUFFER,b);c.depthBuffer&&!c.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_COMPONENT16,c.width,c.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_ATTACHMENT,f.RENDERBUFFER,b)):c.depthBuffer&&c.stencilBuffer?(f.renderbufferStorage(f.RENDERBUFFER,f.DEPTH_STENCIL,c.width,c.height),f.framebufferRenderbuffer(f.FRAMEBUFFER,f.DEPTH_STENCIL_ATTACHMENT,f.RENDERBUFFER,
- b)):f.renderbufferStorage(f.RENDERBUFFER,f.RGBA4,c.width,c.height)}function oa(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.__webglTexture=f.createTexture();if(c){b.__webglFramebuffer=[];b.__webglRenderbuffer=[];f.bindTexture(f.TEXTURE_CUBE_MAP,b.__webglTexture);O(f.TEXTURE_CUBE_MAP,b,b);for(var d=0;d<6;d++){b.__webglFramebuffer[d]=f.createFramebuffer();b.__webglRenderbuffer[d]=
- f.createRenderbuffer();f.texImage2D(f.TEXTURE_CUBE_MAP_POSITIVE_X+d,0,A(b.format),b.width,b.height,0,A(b.format),A(b.type),null);var e=b,h=f.TEXTURE_CUBE_MAP_POSITIVE_X+d;f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer[d]);f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,h,e.__webglTexture,0);ra(b.__webglRenderbuffer[d],b)}}else b.__webglFramebuffer=f.createFramebuffer(),b.__webglRenderbuffer=f.createRenderbuffer(),f.bindTexture(f.TEXTURE_2D,b.__webglTexture),O(f.TEXTURE_2D,b,b),f.texImage2D(f.TEXTURE_2D,
- 0,A(b.format),b.width,b.height,0,A(b.format),A(b.type),null),d=f.TEXTURE_2D,f.bindFramebuffer(f.FRAMEBUFFER,b.__webglFramebuffer),f.framebufferTexture2D(f.FRAMEBUFFER,f.COLOR_ATTACHMENT0,d,b.__webglTexture,0),f.bindRenderbuffer(f.RENDERBUFFER,b.__webglRenderbuffer),ra(b.__webglRenderbuffer,b);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,h=e=0):(c=null,d=Na,b=Ja,e=Ra,h=Sa);c!=Y&&(f.bindFramebuffer(f.FRAMEBUFFER,c),f.viewport(e,h,d,b),Y=c)}function sa(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 fa(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 ia(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return f.NEAREST;default:return f.LINEAR}}function A(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 E=this,f,W=[],Q=null,Y=null,L=-1,X=null,ua=0,Ka=null,La=null,xa=null,ta=null,va=null,Va=null,Wa=null,Xa=null,Ra=0,Sa=0,Na=0,Ja=0,pa=[new THREE.Vector4,new THREE.Vector4,
- new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ya=new THREE.Matrix4,Oa=new Float32Array(16),Pa=new Float32Array(16),Ba=new THREE.Vector4,Ua={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},Ca=b.canvas!==void 0?b.canvas:document.createElement("canvas"),T=b.stencil!==void 0?b.stencil:!0,bb=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,cb=b.antialias!==void 0?b.antialias:!1,ma=b.clearColor!==
- void 0?new THREE.Color(b.clearColor):new THREE.Color(0),za=b.clearAlpha!==void 0?b.clearAlpha:0,Ta=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=Ca;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=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 la,Ma=[],b=THREE.ShaderLib.depthRGBA,$a=THREE.UniformsUtils.clone(b.uniforms),Qa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:$a}),Ya=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:$a,morphTargets:!0});Qa._shadowPass=!0;Ya._shadowPass=!0;try{if(!(f=Ca.getContext("experimental-webgl",{antialias:cb,stencil:T,
- preserveDrawingBuffer:bb})))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(db){console.error(db)}f.clearColor(0,0,0,1);f.clearDepth(1);f.clearStencil(0);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(ma.r,ma.g,ma.b,za);this.context=f;var ab=f.getParameter(f.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,t={};t.vertices=new Float32Array(16);t.faces=new Uint16Array(6);T=0;t.vertices[T++]=-1;t.vertices[T++]=-1;t.vertices[T++]=0;t.vertices[T++]=1;t.vertices[T++]=1;t.vertices[T++]=-1;t.vertices[T++]=1;t.vertices[T++]=1;t.vertices[T++]=1;t.vertices[T++]=1;t.vertices[T++]=1;t.vertices[T++]=0;t.vertices[T++]=-1;t.vertices[T++]=1;t.vertices[T++]=0;T=t.vertices[T++]=0;t.faces[T++]=
- 0;t.faces[T++]=1;t.faces[T++]=2;t.faces[T++]=0;t.faces[T++]=2;t.faces[T++]=3;t.vertexBuffer=f.createBuffer();t.elementBuffer=f.createBuffer();f.bindBuffer(f.ARRAY_BUFFER,t.vertexBuffer);f.bufferData(f.ARRAY_BUFFER,t.vertices,f.STATIC_DRAW);f.bindBuffer(f.ELEMENT_ARRAY_BUFFER,t.elementBuffer);f.bufferData(f.ELEMENT_ARRAY_BUFFER,t.faces,f.STATIC_DRAW);t.program=f.createProgram();f.attachShader(t.program,fa("fragment",THREE.ShaderLib.sprite.fragmentShader));f.attachShader(t.program,fa("vertex",THREE.ShaderLib.sprite.vertexShader));
- f.linkProgram(t.program);t.attributes={};t.uniforms={};t.attributes.position=f.getAttribLocation(t.program,"position");t.attributes.uv=f.getAttribLocation(t.program,"uv");t.uniforms.uvOffset=f.getUniformLocation(t.program,"uvOffset");t.uniforms.uvScale=f.getUniformLocation(t.program,"uvScale");t.uniforms.rotation=f.getUniformLocation(t.program,"rotation");t.uniforms.scale=f.getUniformLocation(t.program,"scale");t.uniforms.alignment=f.getUniformLocation(t.program,"alignment");t.uniforms.color=f.getUniformLocation(t.program,
- "color");t.uniforms.map=f.getUniformLocation(t.program,"map");t.uniforms.opacity=f.getUniformLocation(t.program,"opacity");t.uniforms.useScreenCoordinates=f.getUniformLocation(t.program,"useScreenCoordinates");t.uniforms.affectedByDistance=f.getUniformLocation(t.program,"affectedByDistance");t.uniforms.screenPosition=f.getUniformLocation(t.program,"screenPosition");t.uniforms.modelViewMatrix=f.getUniformLocation(t.program,"modelViewMatrix");t.uniforms.projectionMatrix=f.getUniformLocation(t.program,
- "projectionMatrix");var Za=!1;this.setSize=function(b,c){Ca.width=b;Ca.height=c;this.setViewport(0,0,Ca.width,Ca.height)};this.setViewport=function(b,c,d,e){Ra=b;Sa=c;Na=d;Ja=e;f.viewport(Ra,Sa,Na,Ja)};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.setClearColorHex=function(b,c){ma.setHex(b);za=c;f.clearColor(ma.r,ma.g,ma.b,za)};this.setClearColor=function(b,c){ma.copy(b);za=c;f.clearColor(ma.r,ma.g,
- ma.b,za)};this.getClearColor=function(){return ma};this.getClearAlpha=function(){return za};this.clear=function(b,c,d){var e=0;if(b==void 0||b)e|=f.COLOR_BUFFER_BIT;if(c==void 0||c)e|=f.DEPTH_BUFFER_BIT;if(d==void 0||d)e|=f.STENCIL_BUFFER_BIT;f.clear(e)};this.getContext=function(){return f};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var c=
- b.geometry.geometryGroups[g];f.deleteBuffer(c.__webglVertexBuffer);f.deleteBuffer(c.__webglNormalBuffer);f.deleteBuffer(c.__webglTangentBuffer);f.deleteBuffer(c.__webglColorBuffer);f.deleteBuffer(c.__webglUVBuffer);f.deleteBuffer(c.__webglUV2Buffer);f.deleteBuffer(c.__webglSkinVertexABuffer);f.deleteBuffer(c.__webglSkinVertexBBuffer);f.deleteBuffer(c.__webglSkinIndicesBuffer);f.deleteBuffer(c.__webglSkinWeightsBuffer);f.deleteBuffer(c.__webglFaceBuffer);f.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=
- 0,e=c.numMorphTargets;d<e;d++)f.deleteBuffer(c.__webglMorphTargetsBuffers[d]);E.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),E.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),E.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,f.deleteBuffer(b.__webglVertexBuffer),f.deleteBuffer(b.__webglColorBuffer),
- E.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,f.deleteTexture(b.__webglTexture),E.info.memory.textures--};this.initMaterial=function(b,c,d,e){var h,i,j,k;b instanceof THREE.MeshDepthMaterial?k="depth":b instanceof THREE.MeshNormalMaterial?k="normal":b instanceof THREE.MeshBasicMaterial?k="basic":b instanceof THREE.MeshLambertMaterial?k="lambert":b instanceof THREE.MeshPhongMaterial?k="phong":b instanceof THREE.LineBasicMaterial?k="basic":b instanceof
- THREE.ParticleBasicMaterial&&(k="particle_basic");if(k){var o=THREE.ShaderLib[k];b.uniforms=THREE.UniformsUtils.clone(o.uniforms);b.vertexShader=o.vertexShader;b.fragmentShader=o.fragmentShader}var n,p,r;n=r=o=0;for(p=c.length;n<p;n++)j=c[n],j instanceof THREE.SpotLight&&r++,j instanceof THREE.DirectionalLight&&r++,j instanceof THREE.PointLight&&o++;o+r<=Ta?n=r:(n=Math.ceil(Ta*r/(o+r)),o=Ta-n);j={directional:n,point:o};o=r=0;for(n=c.length;o<n;o++)p=c[o],p instanceof THREE.SpotLight&&p.castShadow&&
- r++;var w=50;if(e!==void 0&&e instanceof THREE.SkinnedMesh)w=e.bones.length;var s;a:{n=b.fragmentShader;p=b.vertexShader;var o=b.uniforms,c=b.attributes,d={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:d,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:j.directional,maxPointLights:j.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&e.receiveShadow,shadowMapSoft:this.shadowMapSoft,
- shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:r,alphaTest:b.alphaTest},v,e=[];k?e.push(k):(e.push(n),e.push(p));for(v in d)e.push(v),e.push(d[v]);k=e.join();v=0;for(e=W.length;v<e;v++)if(W[v].code==k){s=W[v].program;break a}v=f.createProgram();e=[ab?"#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");
- j=["#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.useFog&&d.fog?"#define USE_FOG":"",d.useFog&&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(v,fa("fragment",j+n));f.attachShader(v,fa("vertex",e+p));f.linkProgram(v);f.getProgramParameter(v,f.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+f.getProgramParameter(v,f.VALIDATE_STATUS)+", gl error ["+
- f.getError()+"]");v.uniforms={};v.attributes={};var t,e=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(t in o)e.push(t);t=e;e=0;for(o=t.length;e<o;e++)n=t[e],v.uniforms[n]=f.getUniformLocation(v,n);e=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(t=0;t<d.maxMorphTargets;t++)e.push("morphTarget"+t);for(s in c)e.push(s);
- s=e;t=0;for(c=s.length;t<c;t++)d=s[t],v.attributes[d]=f.getAttribLocation(v,d);v.id=W.length;W.push({program:v,code:k});E.info.memory.programs=W.length;s=v}b.program=s;s=b.program.attributes;s.position>=0&&f.enableVertexAttribArray(s.position);s.color>=0&&f.enableVertexAttribArray(s.color);s.normal>=0&&f.enableVertexAttribArray(s.normal);s.tangent>=0&&f.enableVertexAttribArray(s.tangent);b.skinning&&s.skinVertexA>=0&&s.skinVertexB>=0&&s.skinIndex>=0&&s.skinWeight>=0&&(f.enableVertexAttribArray(s.skinVertexA),
- f.enableVertexAttribArray(s.skinVertexB),f.enableVertexAttribArray(s.skinIndex),f.enableVertexAttribArray(s.skinWeight));if(b.attributes)for(i in b.attributes)s[i]!==void 0&&s[i]>=0&&f.enableVertexAttribArray(s[i]);if(b.morphTargets)for(i=b.numSupportedMorphTargets=0;i<this.maxMorphTargets;i++)t="morphTarget"+i,s[t]>=0&&(f.enableVertexAttribArray(s[t]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,d,c,e){oa(b);
- this.clear(d,c,e)};this.render=function(b,c,n,t){var u,A,wa,x,R,G,C,r,S,B=b.fog;L=-1;this.shadowMapEnabled&&F(b,c);E.info.render.calls=0;E.info.render.vertices=0;E.info.render.faces=0;c.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),b.add(c));b.updateMatrixWorld();c.matrixWorldInverse.getInverse(c.matrixWorld);c.matrixWorldInverse.flattenToArray(Pa);c.projectionMatrix.flattenToArray(Oa);ya.multiply(c.projectionMatrix,c.matrixWorldInverse);s(ya);this.initWebGLObjects(b);S=
- b.__webglLights;oa(n);(this.autoClear||t)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);R=b.__webglObjects.length;for(t=0;t<R;t++)if(u=b.__webglObjects[t],C=u.object,C.visible)if(!(C instanceof THREE.Mesh)||!C.frustumCulled||p(C)){if(C.matrixWorld.flattenToArray(C._objectMatrixArray),I(C,c,!0),w(u),u.render=!0,this.sortObjects)u.object.renderDepth?u.z=u.object.renderDepth:(Ba.copy(C.position),ya.multiplyVector3(Ba),u.z=Ba.z)}else u.render=!1;else u.render=!1;this.sortObjects&&
- b.__webglObjects.sort(D);G=b.__webglObjectsImmediate.length;for(t=0;t<G;t++)u=b.__webglObjectsImmediate[t],C=u.object,C.visible&&(C.matrixAutoUpdate&&C.matrixWorld.flattenToArray(C._objectMatrixArray),I(C,c,!0),v(u));if(b.overrideMaterial){j(b.overrideMaterial.depthTest);V(b.overrideMaterial.blending);for(t=0;t<R;t++)if(u=b.__webglObjects[t],u.render)C=u.object,r=u.buffer,i(C),e(c,S,B,b.overrideMaterial,r,C);for(t=0;t<G;t++)u=b.__webglObjectsImmediate[t],C=u.object,C.visible&&(X=-1,i(C),A=d(c,S,B,
- b.overrideMaterial,C),C.immediateRenderCallback?C.immediateRenderCallback(A,f,pa):C.render(function(c){h(c,A,b.overrideMaterial.shading)}))}else{V(THREE.NormalBlending);for(t=R-1;t>=0;t--)if(u=b.__webglObjects[t],u.render){C=u.object;r=u.buffer;wa=u.opaque;i(C);for(u=0;u<wa.count;u++)x=wa.list[u],j(x.depthTest),k(x.depthWrite),o(x.polygonOffset,x.polygonOffsetFactor,x.polygonOffsetUnits),e(c,S,B,x,r,C)}for(t=0;t<G;t++)if(u=b.__webglObjectsImmediate[t],C=u.object,C.visible){X=-1;wa=u.opaque;i(C);for(u=
- 0;u<wa.count;u++)x=wa.list[u],j(x.depthTest),k(x.depthWrite),o(x.polygonOffset,x.polygonOffsetFactor,x.polygonOffsetUnits),A=d(c,S,B,x,C),C.immediateRenderCallback?C.immediateRenderCallback(A,f,pa):C.render(function(b){h(b,A,x.shading)})}for(t=0;t<R;t++)if(u=b.__webglObjects[t],u.render){C=u.object;r=u.buffer;wa=u.transparent;i(C);for(u=0;u<wa.count;u++)x=wa.list[u],V(x.blending),j(x.depthTest),k(x.depthWrite),o(x.polygonOffset,x.polygonOffsetFactor,x.polygonOffsetUnits),e(c,S,B,x,r,C)}for(t=0;t<
- G;t++)if(u=b.__webglObjectsImmediate[t],C=u.object,C.visible){X=-1;wa=u.transparent;i(C);for(u=0;u<wa.count;u++)x=wa.list[u],V(x.blending),j(x.depthTest),k(x.depthWrite),o(x.polygonOffset,x.polygonOffsetFactor,x.polygonOffsetUnits),A=d(c,S,B,x,C),C.immediateRenderCallback?C.immediateRenderCallback(A,f,pa):C.render(function(b){h(b,A,x.shading)})}}b.__webglSprites.length&&J(b,c);n&&n.minFilter!==THREE.NearestFilter&&n.minFilter!==THREE.LinearFilter&&sa(n)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=
- [],b.__webglObjectsImmediate=[],b.__webglSprites=[],b.__webglLights=[];THREE.SceneUtils.traverseHierarchy(b,function(c){var d,e,h;if(!c.__webglInit)if(c.__webglInit=!0,c._modelViewMatrix=new THREE.Matrix4,c._normalMatrixArray=new Float32Array(9),c._modelViewMatrixArray=new Float32Array(16),c._objectMatrixArray=new Float32Array(16),c.matrixWorld.flattenToArray(c._objectMatrixArray),c instanceof THREE.Mesh)for(d in e=c.geometry,e.geometryGroups==void 0&&P(e),e.geometryGroups){if(h=e.geometryGroups[d],
- !h.__webglVertexBuffer){var i=h;i.__webglVertexBuffer=f.createBuffer();i.__webglNormalBuffer=f.createBuffer();i.__webglTangentBuffer=f.createBuffer();i.__webglColorBuffer=f.createBuffer();i.__webglUVBuffer=f.createBuffer();i.__webglUV2Buffer=f.createBuffer();i.__webglSkinVertexABuffer=f.createBuffer();i.__webglSkinVertexBBuffer=f.createBuffer();i.__webglSkinIndicesBuffer=f.createBuffer();i.__webglSkinWeightsBuffer=f.createBuffer();i.__webglFaceBuffer=f.createBuffer();i.__webglLineBuffer=f.createBuffer();
- if(i.numMorphTargets){var j=void 0,k=void 0;i.__webglMorphTargetsBuffers=[];j=0;for(k=i.numMorphTargets;j<k;j++)i.__webglMorphTargetsBuffers.push(f.createBuffer())}E.info.memory.geometries++;for(var i=c,o=void 0,n=void 0,p=void 0,s=p=void 0,t=void 0,v=void 0,w=v=j=0,u=p=n=void 0,p=k=u=n=o=void 0,s=i.geometry,t=s.faces,u=h.faces,o=0,n=u.length;o<n;o++)p=u[o],p=t[p],p instanceof THREE.Face3?(j+=3,v+=1,w+=3):p instanceof THREE.Face4&&(j+=4,v+=2,w+=4);for(var o=h,n=i,A=u=t=void 0,D=void 0,A=void 0,p=
- [],t=0,u=n.materials.length;t<u;t++)if(A=n.materials[t],A instanceof THREE.MeshFaceMaterial){A=0;for(l=o.materials.length;A<l;A++)(D=o.materials[A])&&p.push(D)}else(D=A)&&p.push(D);o=p;h.__materials=o;a:{t=n=void 0;u=o.length;for(n=0;n<u;n++)if(t=o[n],t.map||t.lightMap||t instanceof THREE.ShaderMaterial){n=!0;break a}n=!1}a:{u=t=void 0;p=o.length;for(t=0;t<p;t++)if(u=o[t],!(u instanceof THREE.MeshBasicMaterial&&!u.envMap||u instanceof THREE.MeshDepthMaterial)){u=u&&u.shading!=void 0&&u.shading==THREE.SmoothShading?
- THREE.SmoothShading:THREE.FlatShading;break a}u=!1}a:{p=t=void 0;A=o.length;for(t=0;t<A;t++)if(p=o[t],p.vertexColors){p=p.vertexColors;break a}p=!1}h.__vertexArray=new Float32Array(j*3);if(u)h.__normalArray=new Float32Array(j*3);if(s.hasTangents)h.__tangentArray=new Float32Array(j*4);if(p)h.__colorArray=new Float32Array(j*3);if(n){if(s.faceUvs.length>0||s.faceVertexUvs.length>0)h.__uvArray=new Float32Array(j*2);if(s.faceUvs.length>1||s.faceVertexUvs.length>1)h.__uv2Array=new Float32Array(j*2)}if(i.geometry.skinWeights.length&&
- i.geometry.skinIndices.length)h.__skinVertexAArray=new Float32Array(j*4),h.__skinVertexBArray=new Float32Array(j*4),h.__skinIndexArray=new Float32Array(j*4),h.__skinWeightArray=new Float32Array(j*4);h.__faceArray=new Uint16Array(v*3+(i.geometry.edgeFaces?i.geometry.edgeFaces.length*6:0));h.__lineArray=new Uint16Array(w*2);if(h.numMorphTargets){h.__morphTargetsArrays=[];s=0;for(t=h.numMorphTargets;s<t;s++)h.__morphTargetsArrays.push(new Float32Array(j*3))}h.__needsSmoothNormals=u==THREE.SmoothShading;
- h.__uvType=n;h.__vertexColorType=p;h.__normalType=u;h.__webglFaceCount=v*3+(i.geometry.edgeFaces?i.geometry.edgeFaces.length*6:0);h.__webglLineCount=w*2;s=0;for(t=o.length;s<t;s++)if(n=o[s],n.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in n.attributes){p=n.attributes[a];u={};for(k in p)u[k]=p[k];if(!u.__webglInitialized||u.createUniqueBuffers)u.__webglInitialized=!0,v=1,u.type==="v2"?v=2:u.type==="v3"?v=3:u.type==="v4"?v=4:u.type==="c"&&(v=3),u.size=v,u.array=
- new Float32Array(j*v),u.buffer=f.createBuffer(),u.buffer.belongsToAttribute=a,p.needsUpdate=!0,u.__original=p;h.__webglCustomAttributes[a]=u}}h.__inittedArrays=!0;e.__dirtyVertices=!0;e.__dirtyMorphTargets=!0;e.__dirtyElements=!0;e.__dirtyUvs=!0;e.__dirtyNormals=!0;e.__dirtyTangents=!0;e.__dirtyColors=!0}}else if(c instanceof THREE.Ribbon){if(e=c.geometry,!e.__webglVertexBuffer)h=e,h.__webglVertexBuffer=f.createBuffer(),h.__webglColorBuffer=f.createBuffer(),E.info.memory.geometries++,h=e,i=h.vertices.length,
- h.__vertexArray=new Float32Array(i*3),h.__colorArray=new Float32Array(i*3),h.__webglVertexCount=i,e.__dirtyVertices=!0,e.__dirtyColors=!0}else if(c instanceof THREE.Line){if(e=c.geometry,!e.__webglVertexBuffer)h=e,h.__webglVertexBuffer=f.createBuffer(),h.__webglColorBuffer=f.createBuffer(),E.info.memory.geometries++,h=e,i=h.vertices.length,h.__vertexArray=new Float32Array(i*3),h.__colorArray=new Float32Array(i*3),h.__webglLineCount=i,e.__dirtyVertices=!0,e.__dirtyColors=!0}else if(c instanceof THREE.ParticleSystem&&
- (e=c.geometry,!e.__webglVertexBuffer)){h=e;h.__webglVertexBuffer=f.createBuffer();h.__webglColorBuffer=f.createBuffer();E.info.geometries++;h=e;i=h.vertices.length;h.__vertexArray=new Float32Array(i*3);h.__colorArray=new Float32Array(i*3);h.__sortArray=[];h.__webglParticleCount=i;h.__materials=c.materials;j=0;for(k=c.materials.length;j<k;j++)if(v=c.materials[j],v.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in v.attributes){originalAttribute=v.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(i*size),attribute.buffer=f.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=
- originalAttribute;h.__webglCustomAttributes[a]=attribute}}e.__dirtyVertices=!0;e.__dirtyColors=!0}if(!c.__webglActive){if(c instanceof THREE.Mesh)for(d in e=c.geometry,e.geometryGroups)h=e.geometryGroups[d],U(b.__webglObjects,h,c);else c instanceof THREE.Ribbon||c instanceof THREE.Line||c instanceof THREE.ParticleSystem?(e=c.geometry,U(b.__webglObjects,e,c)):THREE.MarchingCubes!==void 0&&c instanceof THREE.MarchingCubes||c.immediateRenderCallback?b.__webglObjectsImmediate.push({object:c,opaque:{list:[],
- count:0},transparent:{list:[],count:0}}):c instanceof THREE.Sprite?b.__webglSprites.push(c):c instanceof THREE.Light&&b.__webglLights.push(c);c.__webglActive=!0}});for(var c=0,d=b.__webglObjects.length;c<d;c++)ha(b.__webglObjects[c].object,b)};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 ab}};
- 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.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};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;
|