123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- // ThreeExtras.js r32 - http://github.com/mrdoob/three.js
- var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)};
- THREE.Color.prototype={setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,g,f,h,k,j;if(c==0)e=g=f=0;else{h=Math.floor(a*6);k=a*6-h;a=c*(1-b);j=c*(1-b*k);b=c*(1-b*(1-k));switch(h){case 1:e=j;g=c;f=a;break;case 2:e=a;g=c;f=b;break;case 3:e=a;g=j;f=c;break;case 4:e=b;g=a;f=c;break;case 5:e=c;g=a;f=j;break;case 6:case 0:e=c;g=b;f=a}}this.r=e;this.g=g;this.b=f;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},
- setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+
- this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,b){this.x=a||0;this.y=b||0};
- THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
- this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,c){this.x=a||0;this.y=b||0;this.z=c||0};
- THREE.Vector3.prototype={set:function(a,b,c){this.x=a;this.y=b;this.z=c;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
- cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,c=this.y,e=this.z;this.x=c*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-c*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
- a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+c*c+a*a)},distanceToSquared:function(a){var b=this.x-a.x,c=this.y-a.y;a=this.z-a.z;return b*b+c*c+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=
- -this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
- THREE.Vector4=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e||1};
- THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
- return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
- THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
- THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){c=e[a];if(c instanceof THREE.Mesh)g=g.concat(this.intersectObject(c))}g.sort(function(f,h){return f.distance-h.distance});return g},intersectObject:function(a){function b(E,v,F,p){p=p.clone().subSelf(v);F=F.clone().subSelf(v);var M=E.clone().subSelf(v);E=p.dot(p);v=p.dot(F);p=p.dot(M);var d=F.dot(F);F=F.dot(M);M=1/(E*d-v*v);d=(d*p-v*F)*M;E=(E*F-v*p)*M;return d>0&&E>0&&d+E<1}var c,e,g,f,h,k,j,m,q,w,
- u,t=a.geometry,x=t.vertices,A=[];c=0;for(e=t.faces.length;c<e;c++){g=t.faces[c];w=this.origin.clone();u=this.direction.clone();f=a.matrix.multiplyVector3(x[g.a].position.clone());h=a.matrix.multiplyVector3(x[g.b].position.clone());k=a.matrix.multiplyVector3(x[g.c].position.clone());j=g instanceof THREE.Face4?a.matrix.multiplyVector3(x[g.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(g.normal.clone());q=u.dot(m);if(q<0){m=m.dot((new THREE.Vector3).sub(f,w))/q;w=w.addSelf(u.multiplyScalar(m));
- if(g instanceof THREE.Face3){if(b(w,f,h,k)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};A.push(g)}}else if(g instanceof THREE.Face4)if(b(w,f,h,j)||b(w,h,k,j)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};A.push(g)}}}return A}};
- THREE.Rectangle=function(){function a(){f=e-b;h=g-c}var b,c,e,g,f,h,k=true;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(j,m,q,w){k=false;b=j;c=m;e=q;g=w;a()};this.addPoint=function(j,m){if(k){k=false;b=j;c=m;e=j;g=m}else{b=b<j?b:j;c=c<m?c:m;e=e>j?e:j;g=g>m?
- g:m}a()};this.add3Points=function(j,m,q,w,u,t){if(k){k=false;b=j<q?j<u?j:u:q<u?q:u;c=m<w?m<t?m:t:w<t?w:t;e=j>q?j>u?j:u:q>u?q:u;g=m>w?m>t?m:t:w>t?w:t}else{b=j<q?j<u?j<b?j:b:u<b?u:b:q<u?q<b?q:b:u<b?u:b;c=m<w?m<t?m<c?m:c:t<c?t:c:w<t?w<c?w:c:t<c?t:c;e=j>q?j>u?j>e?j:e:u>e?u:e:q>u?q>e?q:e:u>e?u:e;g=m>w?m>t?m>g?m:g:t>g?t:g:w>t?w>g?w:g:t>g?t:g}a()};this.addRectangle=function(j){if(k){k=false;b=j.getLeft();c=j.getTop();e=j.getRight();g=j.getBottom()}else{b=b<j.getLeft()?b:j.getLeft();c=c<j.getTop()?c:j.getTop();
- e=e>j.getRight()?e:j.getRight();g=g>j.getBottom()?g:j.getBottom()}a()};this.inflate=function(j){b-=j;c-=j;e+=j;g+=j;a()};this.minSelf=function(j){b=b>j.getLeft()?b:j.getLeft();c=c>j.getTop()?c:j.getTop();e=e<j.getRight()?e:j.getRight();g=g<j.getBottom()?g:j.getBottom();a()};this.instersects=function(j){return Math.min(e,j.getRight())-Math.max(b,j.getLeft())>=0&&Math.min(g,j.getBottom())-Math.max(c,j.getTop())>=0};this.empty=function(){k=true;g=e=c=b=0;a()};this.isEmpty=function(){return k};this.toString=
- function(){return"THREE.Rectangle ( left: "+b+", right: "+e+", top: "+c+", bottom: "+g+", width: "+f+", height: "+h+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
- THREE.Matrix4=function(a,b,c,e,g,f,h,k,j,m,q,w,u,t,x,A){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=e||0;this.n21=g||0;this.n22=f||1;this.n23=h||0;this.n24=k||0;this.n31=j||0;this.n32=m||0;this.n33=q||1;this.n34=w||0;this.n41=u||0;this.n42=t||0;this.n43=x||0;this.n44=A||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,c,e,g,f,h,k,j,m,q,w,u,t,x,A){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=g;this.n22=f;this.n23=h;this.n24=k;this.n31=j;this.n32=m;this.n33=q;this.n34=w;this.n41=u;this.n42=t;this.n43=x;this.n44=A;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
- a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,c){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();e.cross(c,f).normalize();g.cross(f,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);
- this.n31=f.x;this.n32=f.y;this.n33=f.z;this.n34=-f.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,g=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*c+this.n23*
- e+this.n24*g;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*c+this.n43*e+this.n44*g;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var c=a.n11,e=a.n12,g=a.n13,f=a.n14,h=a.n21,k=a.n22,j=a.n23,m=a.n24,q=a.n31,
- w=a.n32,u=a.n33,t=a.n34,x=a.n41,A=a.n42,E=a.n43,v=a.n44,F=b.n11,p=b.n12,M=b.n13,d=b.n14,aa=b.n21,O=b.n22,K=b.n23,X=b.n24,Q=b.n31,U=b.n32,V=b.n33,H=b.n34,Y=b.n41,ea=b.n42,Z=b.n43,fa=b.n44;this.n11=c*F+e*aa+g*Q+f*Y;this.n12=c*p+e*O+g*U+f*ea;this.n13=c*M+e*K+g*V+f*Z;this.n14=c*d+e*X+g*H+f*fa;this.n21=h*F+k*aa+j*Q+m*Y;this.n22=h*p+k*O+j*U+m*ea;this.n23=h*M+k*K+j*V+m*Z;this.n24=h*d+k*X+j*H+m*fa;this.n31=q*F+w*aa+u*Q+t*Y;this.n32=q*p+w*O+u*U+t*ea;this.n33=q*M+w*K+u*V+t*Z;this.n34=q*d+w*X+u*H+t*fa;this.n41=
- x*F+A*aa+E*Q+v*Y;this.n42=x*p+A*O+E*U+v*ea;this.n43=x*M+A*K+E*V+v*Z;this.n44=x*d+A*X+E*H+v*fa;return this},multiplyToArray:function(a,b,c){var e=a.n11,g=a.n12,f=a.n13,h=a.n14,k=a.n21,j=a.n22,m=a.n23,q=a.n24,w=a.n31,u=a.n32,t=a.n33,x=a.n34,A=a.n41,E=a.n42,v=a.n43;a=a.n44;var F=b.n11,p=b.n12,M=b.n13,d=b.n14,aa=b.n21,O=b.n22,K=b.n23,X=b.n24,Q=b.n31,U=b.n32,V=b.n33,H=b.n34,Y=b.n41,ea=b.n42,Z=b.n43;b=b.n44;this.n11=e*F+g*aa+f*Q+h*Y;this.n12=e*p+g*O+f*U+h*ea;this.n13=e*M+g*K+f*V+h*Z;this.n14=e*d+g*X+f*
- H+h*b;this.n21=k*F+j*aa+m*Q+q*Y;this.n22=k*p+j*O+m*U+q*ea;this.n23=k*M+j*K+m*V+q*Z;this.n24=k*d+j*X+m*H+q*b;this.n31=w*F+u*aa+t*Q+x*Y;this.n32=w*p+u*O+t*U+x*ea;this.n33=w*M+u*K+t*V+x*Z;this.n34=w*d+u*X+t*H+x*b;this.n41=A*F+E*aa+v*Q+a*Y;this.n42=A*p+E*O+v*U+a*ea;this.n43=A*M+E*K+v*V+a*Z;this.n44=A*d+E*X+v*H+a*b;c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=
- this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,e=this.n13,g=this.n14,f=this.n21,h=this.n22,k=this.n23,j=this.n24,m=this.n31,q=this.n32,w=this.n33,u=this.n34,t=this.n41,x=this.n42,A=this.n43,E=this.n44,v=a.n11,F=a.n21,p=a.n31,M=a.n41,d=a.n12,aa=a.n22,O=a.n32,K=a.n42,X=a.n13,Q=a.n23,U=a.n33,V=a.n43,H=a.n14,Y=a.n24,ea=a.n34;a=a.n44;this.n11=b*v+c*F+e*p+g*M;this.n12=b*d+c*aa+e*O+g*K;this.n13=b*X+c*Q+e*U+g*V;this.n14=b*H+c*Y+e*ea+g*a;this.n21=f*v+
- h*F+k*p+j*M;this.n22=f*d+h*aa+k*O+j*K;this.n23=f*X+h*Q+k*U+j*V;this.n24=f*H+h*Y+k*ea+j*a;this.n31=m*v+q*F+w*p+u*M;this.n32=m*d+q*aa+w*O+u*K;this.n33=m*X+q*Q+w*U+u*V;this.n34=m*H+q*Y+w*ea+u*a;this.n41=t*v+x*F+A*p+E*M;this.n42=t*d+x*aa+A*O+E*K;this.n43=t*X+x*Q+A*U+E*V;this.n44=t*H+x*Y+A*ea+E*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;
- this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,g=this.n21,f=this.n22,h=this.n23,k=this.n24,j=this.n31,m=this.n32,q=this.n33,w=this.n34,u=this.n41,t=this.n42,x=this.n43,A=this.n44;return e*h*m*u-c*k*m*u-e*f*q*u+b*k*q*u+c*f*w*u-b*h*w*u-e*h*j*t+c*k*j*t+e*g*q*t-a*k*q*t-c*g*w*t+a*h*w*t+e*f*j*x-b*k*j*x-e*g*m*x+a*k*m*x+b*g*w*x-a*f*w*x-c*f*j*A+b*h*j*A+c*g*m*A-a*h*m*A-b*g*q*A+a*f*q*A},transpose:function(){function a(b,c,e){var g=b[c];b[c]=b[e];b[e]=
- g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;
- a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,
- 0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),
- g=1-c,f=a.x,h=a.y,k=a.z,j=g*f,m=g*h;this.set(j*f+c,j*h-e*k,j*k+e*h,0,j*h+e*k,m*h+c,m*k-e*f,0,j*k-e*h,m*k+e*f,g*k*k+c,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setTranslation(a,b,c);return e};
- THREE.Matrix4.scaleMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setScale(a,b,c);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
- THREE.Matrix4.makeInvert=function(a){var b=a.n11,c=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,k=a.n23,j=a.n24,m=a.n31,q=a.n32,w=a.n33,u=a.n34,t=a.n41,x=a.n42,A=a.n43,E=a.n44,v=new THREE.Matrix4;v.n11=k*u*x-j*w*x+j*q*A-h*u*A-k*q*E+h*w*E;v.n12=g*w*x-e*u*x-g*q*A+c*u*A+e*q*E-c*w*E;v.n13=e*j*x-g*k*x+g*h*A-c*j*A-e*h*E+c*k*E;v.n14=g*k*q-e*j*q-g*h*w+c*j*w+e*h*u-c*k*u;v.n21=j*w*t-k*u*t-j*m*A+f*u*A+k*m*E-f*w*E;v.n22=e*u*t-g*w*t+g*m*A-b*u*A-e*m*E+b*w*E;v.n23=g*k*t-e*j*t-g*f*A+b*j*A+e*f*E-b*k*E;v.n24=e*j*m-g*k*m+
- g*f*w-b*j*w-e*f*u+b*k*u;v.n31=h*u*t-j*q*t+j*m*x-f*u*x-h*m*E+f*q*E;v.n32=g*q*t-c*u*t-g*m*x+b*u*x+c*m*E-b*q*E;v.n33=e*j*t-g*h*t+g*f*x-b*j*x-c*f*E+b*h*E;v.n34=g*h*m-c*j*m-g*f*q+b*j*q+c*f*u-b*h*u;v.n41=k*q*t-h*w*t-k*m*x+f*w*x+h*m*A-f*q*A;v.n42=c*w*t-e*q*t+e*m*x-b*w*x-c*m*A+b*q*A;v.n43=e*h*t-c*k*t-e*f*x+b*k*x+c*f*A-b*h*A;v.n44=c*k*m-e*h*m+e*f*q-b*k*q-c*f*w+b*h*w;v.multiplyScalar(1/a.determinant());return v};
- THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,f=a.n32*a.n21-a.n31*a.n22,h=-a.n33*a.n12+a.n32*a.n13,k=a.n33*a.n11-a.n31*a.n13,j=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,q=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*h+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*g;c[2]=a*f;c[3]=a*h;c[4]=a*k;c[5]=a*j;c[6]=a*m;c[7]=a*q;c[8]=a*w;return b};
- THREE.Matrix4.makeFrustum=function(a,b,c,e,g,f){var h,k,j;h=new THREE.Matrix4;k=2*g/(b-a);j=2*g/(e-c);a=(b+a)/(b-a);c=(e+c)/(e-c);e=-(f+g)/(f-g);g=-2*f*g/(f-g);h.n11=k;h.n12=0;h.n13=a;h.n14=0;h.n21=0;h.n22=j;h.n23=c;h.n24=0;h.n31=0;h.n32=0;h.n33=e;h.n34=g;h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(a,b,c,e){var g;a=c*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,c,e)};
- THREE.Matrix4.makeOrtho=function(a,b,c,e,g,f){var h,k,j,m;h=new THREE.Matrix4;k=b-a;j=c-e;m=f-g;a=(b+a)/k;c=(c+e)/j;g=(f+g)/m;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-a;h.n21=0;h.n22=2/j;h.n23=0;h.n24=-c;h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-g;h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
- THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
- THREE.Face3=function(a,b,c,e,g){this.a=a;this.b=b;this.c=c;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
- THREE.Face4=function(a,b,c,e,g,f){this.a=a;this.b=b;this.c=c;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=f instanceof Array?f:[f]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
- THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
- THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
- c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,e,g,f,h,k=new THREE.Vector3,j=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){f=this.vertices[e];f.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){f=this.faces[e];if(a&&f.vertexNormals.length){k.set(0,0,0);b=0;for(c=f.normal.length;b<c;b++)k.addSelf(f.vertexNormals[b]);k.divideScalar(3)}else{b=this.vertices[f.a];c=this.vertices[f.b];h=this.vertices[f.c];k.sub(h.position,
- c.position);j.sub(b.position,c.position);k.crossSelf(j)}k.isZero()||k.normalize();f.normal.copy(k)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
- new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal);e[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
- b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(H,Y,ea,Z,fa,ia,l){f=H.vertices[Y].position;h=H.vertices[ea].position;k=H.vertices[Z].position;j=g[fa];m=g[ia];q=g[l];w=h.x-f.x;u=k.x-f.x;t=h.y-f.y;x=k.y-
- f.y;A=h.z-f.z;E=k.z-f.z;v=m.u-j.u;F=q.u-j.u;p=m.v-j.v;M=q.v-j.v;d=1/(v*M-F*p);K.set((M*w-p*u)*d,(M*t-p*x)*d,(M*A-p*E)*d);X.set((v*u-F*w)*d,(v*x-F*t)*d,(v*E-F*A)*d);aa[Y].addSelf(K);aa[ea].addSelf(K);aa[Z].addSelf(K);O[Y].addSelf(X);O[ea].addSelf(X);O[Z].addSelf(X)}var b,c,e,g,f,h,k,j,m,q,w,u,t,x,A,E,v,F,p,M,d,aa=[],O=[],K=new THREE.Vector3,X=new THREE.Vector3,Q=new THREE.Vector3,U=new THREE.Vector3,V=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){aa[b]=new THREE.Vector3;O[b]=new THREE.Vector3}b=
- 0;for(c=this.faces.length;b<c;b++){e=this.faces[b];g=this.uvs[b];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
- this.vertices[e.d].normal.copy(e.vertexNormals[3])}}b=0;for(c=this.vertices.length;b<c;b++){V.copy(this.vertices[b].normal);e=aa[b];Q.copy(e);Q.subSelf(V.multiplyScalar(V.dot(e))).normalize();U.cross(this.vertices[b].normal,e);e=U.dot(O[b]);e=e<0?-1:1;this.vertices[b].tangent.set(Q.x,Q.y,Q.z,e)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
- z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=this.vertices[b];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
- this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(q){var w=[];b=0;for(c=q.length;b<c;b++)q[b]==undefined?w.push("undefined"):w.push(q[b].toString());return w.join("_")}var b,c,e,g,f,h,k,j,m={};e=0;for(g=this.faces.length;e<g;e++){f=this.faces[e];
- h=f.materials;k=a(h);if(m[k]==undefined)m[k]={hash:k,counter:0};j=m[k].hash+"_"+m[k].counter;if(this.geometryChunks[j]==undefined)this.geometryChunks[j]={faces:[],materials:h,vertices:0};f=f instanceof THREE.Face3?3:4;if(this.geometryChunks[j].vertices+f>65535){m[k].counter+=1;j=m[k].hash+"_"+m[k].counter;if(this.geometryChunks[j]==undefined)this.geometryChunks[j]={faces:[],materials:h,vertices:0}}this.geometryChunks[j].faces.push(e);this.geometryChunks[j].vertices+=f}},toString:function(){return"THREE.Geometry ( vertices: "+
- this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
- THREE.Camera=function(a,b,c,e){this.fov=a;this.aspect=b;this.near=c;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
- this.translateZ=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()};
- THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;
- THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
- THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true;this.children=[]};
- THREE.Object3D.prototype={addChild:function(a){this.children.indexOf(a)===-1&&this.children.push(a)},removeChild:function(a){a=this.children.indexOf(a);a!==-1&&this.children.splice(a,1)},updateMatrix:function(){var a=this.position,b=this.rotation,c=this.scale,e=this.matrix,g=this.rotationMatrix,f=this.tmpMatrix;e.setTranslation(a.x,a.y,a.z);g.setRotX(b.x);b.y!=0&&g.multiplySelf(f.setRotY(b.y));b.z!=0&&g.multiplySelf(f.setRotZ(b.z));e.multiplySelf(g);if(c.x!=0||c.y!=0||c.z!=0)e.multiplySelf(f.setScale(c.x,
- c.y,c.z))}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
- THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()};
- THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;
- THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
- a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.LineBasicMaterialCounter={value:0};
- THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){a.color!==
- undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
- undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+
- "<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
- THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){a.color!==
- undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
- undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+
- "<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
- THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=
- 1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=
- a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=
- a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+
- this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.MeshPhongMaterialCounter={value:0};
- THREE.MeshDepthMaterial=function(a){this.id=THREE.MeshDepthMaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
- undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshDepthMaterialCounter={value:0};
- THREE.MeshNormalMaterial=function(a){this.id=THREE.MeshNormalMaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
- undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshNormalMaterialCounter={value:0};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
- THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=
- a.vertex_shader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==
- undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
- THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.offset=new THREE.Vector2;this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;
- if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.ParticleBasicMaterialCounter={value:0};
- THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
- THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,b,c,e,g,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=f!==undefined?f:THREE.LinearMipMapLinearFilter};
- THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;
- THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
- THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrap_s=c.wrap_s!==undefined?c.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=c.wrap_t!==undefined?c.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=c.mag_filter!==undefined?c.mag_filter:THREE.LinearFilter;this.min_filter=c.min_filter!==undefined?c.min_filter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
- var Uniforms={clone:function(a){var b,c,e,g={};for(b in a){g[b]={};for(c in a[b]){e=a[b][c];g[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,c,e,g={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(c in e)g[c]=e[c]}return g}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
- THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
- THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
- THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
- THREE.Projector=function(){function a(O,K){return K.z-O.z}function b(O,K){var X=0,Q=1,U=O.z+O.w,V=K.z+K.w,H=-O.z+O.w,Y=-K.z+K.w;if(U>=0&&V>=0&&H>=0&&Y>=0)return true;else if(U<0&&V<0||H<0&&Y<0)return false;else{if(U<0)X=Math.max(X,U/(U-V));else if(V<0)Q=Math.min(Q,U/(U-V));if(H<0)X=Math.max(X,H/(H-Y));else if(Y<0)Q=Math.min(Q,H/(H-Y));if(Q<X)return false;else{O.lerpSelf(K,X);K.lerpSelf(O,1-Q);return true}}}var c,e,g=[],f,h,k,j=[],m,q,w=[],u,t,x=[],A=new THREE.Vector4,E=new THREE.Vector4,v=new THREE.Matrix4,
- F=new THREE.Matrix4,p=[],M=new THREE.Vector4,d=new THREE.Vector4,aa;this.projectObjects=function(O,K,X){var Q=[],U,V;e=0;v.multiply(K.projectionMatrix,K.matrix);p[0]=new THREE.Vector4(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);p[1]=new THREE.Vector4(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);p[2]=new THREE.Vector4(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);p[3]=new THREE.Vector4(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);p[4]=new THREE.Vector4(v.n41-v.n31,v.n42-v.n32,v.n43-
- v.n33,v.n44-v.n34);p[5]=new THREE.Vector4(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);K=0;for(U=p.length;K<U;K++){V=p[K];V.divideScalar(Math.sqrt(V.x*V.x+V.y*V.y+V.z*V.z))}U=O.objects;O=0;for(K=U.length;O<K;O++){V=U[O];var H;if(!(H=!V.visible)){if(H=V instanceof THREE.Mesh){a:{H=void 0;for(var Y=V.position,ea=-V.geometry.boundingSphere.radius*Math.max(V.scale.x,Math.max(V.scale.y,V.scale.z)),Z=0;Z<6;Z++){H=p[Z].x*Y.x+p[Z].y*Y.y+p[Z].z*Y.z+p[Z].w;if(H<=ea){H=false;break a}}H=true}H=!H}H=H}if(!H){c=
- g[e]=g[e]||new THREE.RenderableObject;A.copy(V.position);v.multiplyVector3(A);c.object=V;c.z=A.z;Q.push(c);e++}}X&&Q.sort(a);return Q};this.projectScene=function(O,K,X){var Q=[],U=K.near,V=K.far,H,Y,ea,Z,fa,ia,l,y,B,o,n,N,G,z,I,D;k=q=t=0;K.autoUpdateMatrix&&K.updateMatrix();v.multiply(K.projectionMatrix,K.matrix);ia=this.projectObjects(O,K,true);O=0;for(H=ia.length;O<H;O++){l=ia[O].object;if(l.visible){l.autoUpdateMatrix&&l.updateMatrix();y=l.matrix;B=l.rotationMatrix;o=l.materials;n=l.overdraw;if(l instanceof
- THREE.Mesh){N=l.geometry;G=N.vertices;Y=0;for(ea=G.length;Y<ea;Y++){z=G[Y];z.positionWorld.copy(z.position);y.multiplyVector3(z.positionWorld);Z=z.positionScreen;Z.copy(z.positionWorld);v.multiplyVector4(Z);Z.x/=Z.w;Z.y/=Z.w;z.__visible=Z.z>U&&Z.z<V}N=N.faces;Y=0;for(ea=N.length;Y<ea;Y++){z=N[Y];if(z instanceof THREE.Face3){Z=G[z.a];fa=G[z.b];I=G[z.c];if(Z.__visible&&fa.__visible&&I.__visible)if(l.doubleSided||l.flipSided!=(I.positionScreen.x-Z.positionScreen.x)*(fa.positionScreen.y-Z.positionScreen.y)-
- (I.positionScreen.y-Z.positionScreen.y)*(fa.positionScreen.x-Z.positionScreen.x)<0){f=j[k]=j[k]||new THREE.RenderableFace3;f.v1.positionWorld.copy(Z.positionWorld);f.v2.positionWorld.copy(fa.positionWorld);f.v3.positionWorld.copy(I.positionWorld);f.v1.positionScreen.copy(Z.positionScreen);f.v2.positionScreen.copy(fa.positionScreen);f.v3.positionScreen.copy(I.positionScreen);f.normalWorld.copy(z.normal);B.multiplyVector3(f.normalWorld);f.centroidWorld.copy(z.centroid);y.multiplyVector3(f.centroidWorld);
- f.centroidScreen.copy(f.centroidWorld);v.multiplyVector3(f.centroidScreen);I=z.vertexNormals;aa=f.vertexNormalsWorld;Z=0;for(fa=I.length;Z<fa;Z++){D=aa[Z]=aa[Z]||new THREE.Vector3;D.copy(I[Z]);B.multiplyVector3(D)}f.z=f.centroidScreen.z;f.meshMaterials=o;f.faceMaterials=z.materials;f.overdraw=n;if(l.geometry.uvs[Y]){f.uvs[0]=l.geometry.uvs[Y][0];f.uvs[1]=l.geometry.uvs[Y][1];f.uvs[2]=l.geometry.uvs[Y][2]}Q.push(f);k++}}else if(z instanceof THREE.Face4){Z=G[z.a];fa=G[z.b];I=G[z.c];D=G[z.d];if(Z.__visible&&
- fa.__visible&&I.__visible&&D.__visible)if(l.doubleSided||l.flipSided!=((D.positionScreen.x-Z.positionScreen.x)*(fa.positionScreen.y-Z.positionScreen.y)-(D.positionScreen.y-Z.positionScreen.y)*(fa.positionScreen.x-Z.positionScreen.x)<0||(fa.positionScreen.x-I.positionScreen.x)*(D.positionScreen.y-I.positionScreen.y)-(fa.positionScreen.y-I.positionScreen.y)*(D.positionScreen.x-I.positionScreen.x)<0)){f=j[k]=j[k]||new THREE.RenderableFace3;f.v1.positionWorld.copy(Z.positionWorld);f.v2.positionWorld.copy(fa.positionWorld);
- f.v3.positionWorld.copy(D.positionWorld);f.v1.positionScreen.copy(Z.positionScreen);f.v2.positionScreen.copy(fa.positionScreen);f.v3.positionScreen.copy(D.positionScreen);f.normalWorld.copy(z.normal);B.multiplyVector3(f.normalWorld);f.centroidWorld.copy(z.centroid);y.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);v.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=o;f.faceMaterials=z.materials;f.overdraw=n;if(l.geometry.uvs[Y]){f.uvs[0]=l.geometry.uvs[Y][0];
- f.uvs[1]=l.geometry.uvs[Y][1];f.uvs[2]=l.geometry.uvs[Y][3]}Q.push(f);k++;h=j[k]=j[k]||new THREE.RenderableFace3;h.v1.positionWorld.copy(fa.positionWorld);h.v2.positionWorld.copy(I.positionWorld);h.v3.positionWorld.copy(D.positionWorld);h.v1.positionScreen.copy(fa.positionScreen);h.v2.positionScreen.copy(I.positionScreen);h.v3.positionScreen.copy(D.positionScreen);h.normalWorld.copy(f.normalWorld);h.centroidWorld.copy(f.centroidWorld);h.centroidScreen.copy(f.centroidScreen);h.z=h.centroidScreen.z;
- h.meshMaterials=o;h.faceMaterials=z.materials;h.overdraw=n;if(l.geometry.uvs[Y]){h.uvs[0]=l.geometry.uvs[Y][1];h.uvs[1]=l.geometry.uvs[Y][2];h.uvs[2]=l.geometry.uvs[Y][3]}Q.push(h);k++}}}}else if(l instanceof THREE.Line){F.multiply(v,y);G=l.geometry.vertices;z=G[0];z.positionScreen.copy(z.position);F.multiplyVector4(z.positionScreen);Y=1;for(ea=G.length;Y<ea;Y++){Z=G[Y];Z.positionScreen.copy(Z.position);F.multiplyVector4(Z.positionScreen);fa=G[Y-1];M.copy(Z.positionScreen);d.copy(fa.positionScreen);
- if(b(M,d)){M.multiplyScalar(1/M.w);d.multiplyScalar(1/d.w);m=w[q]=w[q]||new THREE.RenderableLine;m.v1.positionScreen.copy(M);m.v2.positionScreen.copy(d);m.z=Math.max(M.z,d.z);m.materials=l.materials;Q.push(m);q++}}}else if(l instanceof THREE.Particle){E.set(l.position.x,l.position.y,l.position.z,1);v.multiplyVector4(E);E.z/=E.w;if(E.z>0&&E.z<1){u=x[t]=x[t]||new THREE.RenderableParticle;u.x=E.x/E.w;u.y=E.y/E.w;u.z=E.z;u.rotation=l.rotation.z;u.scale.x=l.scale.x*Math.abs(u.x-(E.x+K.projectionMatrix.n11)/
- (E.w+K.projectionMatrix.n14));u.scale.y=l.scale.y*Math.abs(u.y-(E.y+K.projectionMatrix.n22)/(E.w+K.projectionMatrix.n24));u.materials=l.materials;Q.push(u);t++}}}}X&&Q.sort(a);return Q};this.unprojectVector=function(O,K){var X=THREE.Matrix4.makeInvert(K.matrix);X.multiplySelf(THREE.Matrix4.makeInvert(K.projectionMatrix));X.multiplyVector3(O);return O}};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,g,f;this.domElement=document.createElement("div");this.setSize=function(h,k){c=h;e=k;g=c/2;f=e/2};this.render=function(h,k){var j,m,q,w,u,t,x,A;a=b.projectScene(h,k);j=0;for(m=a.length;j<m;j++){u=a[j];if(u instanceof THREE.RenderableParticle){x=u.x*g+g;A=u.y*f+f;q=0;for(w=u.material.length;q<w;q++){t=u.material[q];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=x+"px";t.style.top=A+"px"}}}}}};
- THREE.CanvasRenderer=function(){function a(ga){if(u!=ga)m.globalAlpha=u=ga}function b(ga){if(t!=ga){switch(ga){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}t=ga}}var c=null,e=new THREE.Projector,g=document.createElement("canvas"),f,h,k,j,m=g.getContext("2d"),q=new THREE.Color(0),w=0,u=1,t=0,x=null,A=null,E=1,v,F,p,M,d,aa,O,K,X,Q=new THREE.Color,
- U=new THREE.Color,V=new THREE.Color,H=new THREE.Color,Y=new THREE.Color,ea,Z,fa,ia,l,y,B,o,n,N=new THREE.Rectangle,G=new THREE.Rectangle,z=new THREE.Rectangle,I=false,D=new THREE.Color,$=new THREE.Color,da=new THREE.Color,C=new THREE.Color,L=Math.PI*2,J=new THREE.Vector3,R,W,la,S,ta,sa,va=16;R=document.createElement("canvas");R.width=R.height=2;W=R.getContext("2d");W.fillStyle="rgba(0,0,0,1)";W.fillRect(0,0,2,2);la=W.getImageData(0,0,2,2);S=la.data;ta=document.createElement("canvas");ta.width=ta.height=
- va;sa=ta.getContext("2d");sa.translate(-va/2,-va/2);sa.scale(va,va);va--;this.domElement=g;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ga,ka){f=ga;h=ka;k=f/2;j=h/2;g.width=f;g.height=h;N.set(-k,-j,k,j);u=1;t=0;A=x=null;E=1};this.setClearColor=function(ga,ka){q=ga;w=ka;G.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.setClearColorHex=function(ga,ka){q.setHex(ga);w=ka;G.set(-k,-j,k,j);m.setTransform(1,0,0,-1,k,j);this.clear()};this.clear=function(){m.setTransform(1,
- 0,0,-1,k,j);if(!G.isEmpty()){G.inflate(1);G.minSelf(N);if(q.hex==0&&w==0)m.clearRect(G.getX(),G.getY(),G.getWidth(),G.getHeight());else{b(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+w+")";m.fillRect(G.getX(),G.getY(),G.getWidth(),G.getHeight())}G.empty()}};this.render=function(ga,ka){function na(P){var ha,ca,T,ba=P.lights;$.setRGB(0,0,0);da.setRGB(0,0,0);C.setRGB(0,0,0);P=0;for(ha=ba.length;P<ha;P++){ca=ba[P];T=ca.color;if(ca instanceof
- THREE.AmbientLight){$.r+=T.r;$.g+=T.g;$.b+=T.b}else if(ca instanceof THREE.DirectionalLight){da.r+=T.r;da.g+=T.g;da.b+=T.b}else if(ca instanceof THREE.PointLight){C.r+=T.r;C.g+=T.g;C.b+=T.b}}}function Ca(P,ha,ca,T){var ba,ja,ua,za,Ba=P.lights;P=0;for(ba=Ba.length;P<ba;P++){ja=Ba[P];ua=ja.color;za=ja.intensity;if(ja instanceof THREE.DirectionalLight){ja=ca.dot(ja.position)*za;if(ja>0){T.r+=ua.r*ja;T.g+=ua.g*ja;T.b+=ua.b*ja}}else if(ja instanceof THREE.PointLight){J.sub(ja.position,ha);J.normalize();
- ja=ca.dot(J)*za;if(ja>0){T.r+=ua.r*ja;T.g+=ua.g*ja;T.b+=ua.b*ja}}}}function ya(P,ha,ca){if(ca.opacity!=0){a(ca.opacity);b(ca.blending);var T,ba,ja,ua,za,Ba;if(ca instanceof THREE.ParticleBasicMaterial){if(ca.map&&ca.map.image.loaded){ua=ca.map.image;za=ua.width>>1;Ba=ua.height>>1;ba=ha.scale.x*k;ja=ha.scale.y*j;ca=ba*za;T=ja*Ba;z.set(P.x-ca,P.y-T,P.x+ca,P.y+T);if(N.instersects(z)){m.save();m.translate(P.x,P.y);m.rotate(-ha.rotation);m.scale(ba,-ja);m.translate(-za,-Ba);m.drawImage(ua,0,0);m.restore()}}}else if(ca instanceof
- THREE.ParticleCircleMaterial){if(I){D.r=$.r+da.r+C.r;D.g=$.g+da.g+C.g;D.b=$.b+da.b+C.b;Q.r=ca.color.r*D.r;Q.g=ca.color.g*D.g;Q.b=ca.color.b*D.b;Q.updateStyleString()}else Q.__styleString=ca.color.__styleString;ca=ha.scale.x*k;T=ha.scale.y*j;z.set(P.x-ca,P.y-T,P.x+ca,P.y+T);if(N.instersects(z)){ba=Q.__styleString;if(A!=ba)m.fillStyle=A=ba;m.save();m.translate(P.x,P.y);m.rotate(-ha.rotation);m.scale(ca,T);m.beginPath();m.arc(0,0,1,0,L,true);m.closePath();m.fill();m.restore()}}}}function qa(P,ha,ca,
- T){if(T.opacity!=0){a(T.opacity);b(T.blending);m.beginPath();m.moveTo(P.positionScreen.x,P.positionScreen.y);m.lineTo(ha.positionScreen.x,ha.positionScreen.y);m.closePath();if(T instanceof THREE.LineBasicMaterial){Q.__styleString=T.color.__styleString;P=T.linewidth;if(E!=P)m.lineWidth=E=P;P=Q.__styleString;if(x!=P)m.strokeStyle=x=P;m.stroke();z.inflate(T.linewidth*2)}}}function ra(P,ha,ca,T,ba,ja){if(ba.opacity!=0){a(ba.opacity);b(ba.blending);M=P.positionScreen.x;d=P.positionScreen.y;aa=ha.positionScreen.x;
- O=ha.positionScreen.y;K=ca.positionScreen.x;X=ca.positionScreen.y;m.beginPath();m.moveTo(M,d);m.lineTo(aa,O);m.lineTo(K,X);m.lineTo(M,d);m.closePath();if(ba instanceof THREE.MeshBasicMaterial)if(ba.map)ba.map.image.loaded&&ba.map.mapping instanceof THREE.UVMapping&&wa(M,d,aa,O,K,X,ba.map.image,T.uvs[0].u,T.uvs[0].v,T.uvs[1].u,T.uvs[1].v,T.uvs[2].u,T.uvs[2].v);else if(ba.env_map){if(ba.env_map.image.loaded)if(ba.env_map.mapping instanceof THREE.SphericalReflectionMapping){P=ka.matrix;J.copy(T.vertexNormalsWorld[0]);
- ia=(J.x*P.n11+J.y*P.n12+J.z*P.n13)*0.5+0.5;l=-(J.x*P.n21+J.y*P.n22+J.z*P.n23)*0.5+0.5;J.copy(T.vertexNormalsWorld[1]);y=(J.x*P.n11+J.y*P.n12+J.z*P.n13)*0.5+0.5;B=-(J.x*P.n21+J.y*P.n22+J.z*P.n23)*0.5+0.5;J.copy(T.vertexNormalsWorld[2]);o=(J.x*P.n11+J.y*P.n12+J.z*P.n13)*0.5+0.5;n=-(J.x*P.n21+J.y*P.n22+J.z*P.n23)*0.5+0.5;wa(M,d,aa,O,K,X,ba.env_map.image,ia,l,y,B,o,n)}}else ba.wireframe?Ha(ba.color.__styleString,ba.wireframe_linewidth):Ia(ba.color.__styleString);else if(ba instanceof THREE.MeshLambertMaterial){if(ba.map&&
- !ba.wireframe){ba.map.mapping instanceof THREE.UVMapping&&wa(M,d,aa,O,K,X,ba.map.image,T.uvs[0].u,T.uvs[0].v,T.uvs[1].u,T.uvs[1].v,T.uvs[2].u,T.uvs[2].v);b(THREE.SubtractiveBlending)}if(I)if(!ba.wireframe&&ba.shading==THREE.SmoothShading&&T.vertexNormalsWorld.length==3){U.r=V.r=H.r=$.r;U.g=V.g=H.g=$.g;U.b=V.b=H.b=$.b;Ca(ja,T.v1.positionWorld,T.vertexNormalsWorld[0],U);Ca(ja,T.v2.positionWorld,T.vertexNormalsWorld[1],V);Ca(ja,T.v3.positionWorld,T.vertexNormalsWorld[2],H);Y.r=(V.r+H.r)*0.5;Y.g=(V.g+
- H.g)*0.5;Y.b=(V.b+H.b)*0.5;fa=ma(U,V,H,Y);wa(M,d,aa,O,K,X,fa,0,0,1,0,0,1)}else{D.r=$.r;D.g=$.g;D.b=$.b;Ca(ja,T.centroidWorld,T.normalWorld,D);Q.r=ba.color.r*D.r;Q.g=ba.color.g*D.g;Q.b=ba.color.b*D.b;Q.updateStyleString();ba.wireframe?Ha(Q.__styleString,ba.wireframe_linewidth):Ia(Q.__styleString)}else ba.wireframe?Ha(ba.color.__styleString,ba.wireframe_linewidth):Ia(ba.color.__styleString)}else if(ba instanceof THREE.MeshDepthMaterial){ea=ka.near;Z=ka.far;U.r=U.g=U.b=1-pa(P.positionScreen.z,ea,Z);
- V.r=V.g=V.b=1-pa(ha.positionScreen.z,ea,Z);H.r=H.g=H.b=1-pa(ca.positionScreen.z,ea,Z);Y.r=(V.r+H.r)*0.5;Y.g=(V.g+H.g)*0.5;Y.b=(V.b+H.b)*0.5;fa=ma(U,V,H,Y);wa(M,d,aa,O,K,X,fa,0,0,1,0,0,1)}else if(ba instanceof THREE.MeshNormalMaterial){Q.r=Da(T.normalWorld.x);Q.g=Da(T.normalWorld.y);Q.b=Da(T.normalWorld.z);Q.updateStyleString();ba.wireframe?Ha(Q.__styleString,ba.wireframe_linewidth):Ia(Q.__styleString)}}}function Ha(P,ha){if(x!=P)m.strokeStyle=x=P;if(E!=ha)m.lineWidth=E=ha;m.stroke();z.inflate(ha*
- 2)}function Ia(P){if(A!=P)m.fillStyle=A=P;m.fill()}function wa(P,ha,ca,T,ba,ja,ua,za,Ba,Ka,Ga,La,Ra){var Ja,Ma;Ja=ua.width-1;Ma=ua.height-1;za*=Ja;Ba*=Ma;Ka*=Ja;Ga*=Ma;La*=Ja;Ra*=Ma;ca-=P;T-=ha;ba-=P;ja-=ha;Ka-=za;Ga-=Ba;La-=za;Ra-=Ba;Ja=Ka*Ra-La*Ga;if(Ja!=0){Ma=1/Ja;Ja=(Ra*ca-Ga*ba)*Ma;Ga=(Ra*T-Ga*ja)*Ma;ca=(Ka*ba-La*ca)*Ma;T=(Ka*ja-La*T)*Ma;P=P-Ja*za-ca*Ba;ha=ha-Ga*za-T*Ba;m.save();m.transform(Ja,Ga,ca,T,P,ha);m.clip();m.drawImage(ua,0,0);m.restore()}}function ma(P,ha,ca,T){var ba=~~(P.r*255),ja=
- ~~(P.g*255);P=~~(P.b*255);var ua=~~(ha.r*255),za=~~(ha.g*255);ha=~~(ha.b*255);var Ba=~~(ca.r*255),Ka=~~(ca.g*255);ca=~~(ca.b*255);var Ga=~~(T.r*255),La=~~(T.g*255);T=~~(T.b*255);S[0]=ba<0?0:ba>255?255:ba;S[1]=ja<0?0:ja>255?255:ja;S[2]=P<0?0:P>255?255:P;S[4]=ua<0?0:ua>255?255:ua;S[5]=za<0?0:za>255?255:za;S[6]=ha<0?0:ha>255?255:ha;S[8]=Ba<0?0:Ba>255?255:Ba;S[9]=Ka<0?0:Ka>255?255:Ka;S[10]=ca<0?0:ca>255?255:ca;S[12]=Ga<0?0:Ga>255?255:Ga;S[13]=La<0?0:La>255?255:La;S[14]=T<0?0:T>255?255:T;W.putImageData(la,
- 0,0);sa.drawImage(R,0,0);return ta}function pa(P,ha,ca){P=(P-ha)/(ca-ha);return P*P*(3-2*P)}function Da(P){P=(P+1)*0.5;return P<0?0:P>1?1:P}function xa(P,ha){var ca=ha.x-P.x,T=ha.y-P.y,ba=1/Math.sqrt(ca*ca+T*T);ca*=ba;T*=ba;ha.x+=ca;ha.y+=T;P.x-=ca;P.y-=T}var Oa,Aa,oa,Ea,Fa,Pa,Qa,Na;this.autoClear?this.clear():m.setTransform(1,0,0,-1,k,j);c=e.projectScene(ga,ka,this.sortElements);(I=ga.lights.length>0)&&na(ga);Oa=0;for(Aa=c.length;Oa<Aa;Oa++){oa=c[Oa];z.empty();if(oa instanceof THREE.RenderableParticle){v=
- oa;v.x*=k;v.y*=j;Ea=0;for(Fa=oa.materials.length;Ea<Fa;Ea++)ya(v,oa,oa.materials[Ea],ga)}else if(oa instanceof THREE.RenderableLine){v=oa.v1;F=oa.v2;v.positionScreen.x*=k;v.positionScreen.y*=j;F.positionScreen.x*=k;F.positionScreen.y*=j;z.addPoint(v.positionScreen.x,v.positionScreen.y);z.addPoint(F.positionScreen.x,F.positionScreen.y);if(N.instersects(z)){Ea=0;for(Fa=oa.materials.length;Ea<Fa;)qa(v,F,oa,oa.materials[Ea++],ga)}}else if(oa instanceof THREE.RenderableFace3){v=oa.v1;F=oa.v2;p=oa.v3;v.positionScreen.x*=
- k;v.positionScreen.y*=j;F.positionScreen.x*=k;F.positionScreen.y*=j;p.positionScreen.x*=k;p.positionScreen.y*=j;if(oa.overdraw){xa(v.positionScreen,F.positionScreen);xa(F.positionScreen,p.positionScreen);xa(p.positionScreen,v.positionScreen)}z.add3Points(v.positionScreen.x,v.positionScreen.y,F.positionScreen.x,F.positionScreen.y,p.positionScreen.x,p.positionScreen.y);if(N.instersects(z)){Ea=0;for(Fa=oa.meshMaterials.length;Ea<Fa;){Na=oa.meshMaterials[Ea++];if(Na instanceof THREE.MeshFaceMaterial){Pa=
- 0;for(Qa=oa.faceMaterials.length;Pa<Qa;)(Na=oa.faceMaterials[Pa++])&&ra(v,F,p,oa,Na,ga)}else ra(v,F,p,oa,Na,ga)}}}G.addRectangle(z)}m.setTransform(1,0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(ia,l,y){var B,o,n,N;B=0;for(o=ia.lights.length;B<o;B++){n=ia.lights[B];if(n instanceof THREE.DirectionalLight){N=l.normalWorld.dot(n.position)*n.intensity;if(N>0){y.r+=n.color.r*N;y.g+=n.color.g*N;y.b+=n.color.b*N}}else if(n instanceof THREE.PointLight){X.sub(n.position,l.centroidWorld);X.normalize();N=l.normalWorld.dot(X)*n.intensity;if(N>0){y.r+=n.color.r*N;y.g+=n.color.g*N;y.b+=n.color.b*N}}}}function b(ia,l,y,B,o,n){H=e(Y++);H.setAttribute("d","M "+ia.positionScreen.x+
- " "+ia.positionScreen.y+" L "+l.positionScreen.x+" "+l.positionScreen.y+" L "+y.positionScreen.x+","+y.positionScreen.y+"z");if(o instanceof THREE.MeshBasicMaterial)p.__styleString=o.color.__styleString;else if(o instanceof THREE.MeshLambertMaterial)if(F){M.r=d.r;M.g=d.g;M.b=d.b;a(n,B,M);p.r=o.color.r*M.r;p.g=o.color.g*M.g;p.b=o.color.b*M.b;p.updateStyleString()}else p.__styleString=o.color.__styleString;else if(o instanceof THREE.MeshDepthMaterial){K=1-o.__2near/(o.__farPlusNear-B.z*o.__farMinusNear);
- p.setRGB(K,K,K)}else o instanceof THREE.MeshNormalMaterial&&p.setRGB(g(B.normalWorld.x),g(B.normalWorld.y),g(B.normalWorld.z));o.wireframe?H.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+o.wireframe_linewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframe_linecap+"; stroke-linejoin: "+o.wireframe_linejoin):H.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+o.opacity);k.appendChild(H)}function c(ia,l,y,B,o,n,N){H=e(Y++);H.setAttribute("d",
- "M "+ia.positionScreen.x+" "+ia.positionScreen.y+" L "+l.positionScreen.x+" "+l.positionScreen.y+" L "+y.positionScreen.x+","+y.positionScreen.y+" L "+B.positionScreen.x+","+B.positionScreen.y+"z");if(n instanceof THREE.MeshBasicMaterial)p.__styleString=n.color.__styleString;else if(n instanceof THREE.MeshLambertMaterial)if(F){M.r=d.r;M.g=d.g;M.b=d.b;a(N,o,M);p.r=n.color.r*M.r;p.g=n.color.g*M.g;p.b=n.color.b*M.b;p.updateStyleString()}else p.__styleString=n.color.__styleString;else if(n instanceof
- THREE.MeshDepthMaterial){K=1-n.__2near/(n.__farPlusNear-o.z*n.__farMinusNear);p.setRGB(K,K,K)}else n instanceof THREE.MeshNormalMaterial&&p.setRGB(g(o.normalWorld.x),g(o.normalWorld.y),g(o.normalWorld.z));n.wireframe?H.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+n.wireframe_linewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframe_linecap+"; stroke-linejoin: "+n.wireframe_linejoin):H.setAttribute("style","fill: "+p.__styleString+"; fill-opacity: "+
- n.opacity);k.appendChild(H)}function e(ia){if(Q[ia]==null){Q[ia]=document.createElementNS("http://www.w3.org/2000/svg","path");fa==0&&Q[ia].setAttribute("shape-rendering","crispEdges");return Q[ia]}return Q[ia]}function g(ia){return ia<0?Math.min((1+ia)*0.5,0.5):0.5+Math.min(ia*0.5,0.5)}var f=null,h=new THREE.Projector,k=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,m,q,w,u,t,x,A,E=new THREE.Rectangle,v=new THREE.Rectangle,F=false,p=new THREE.Color(16777215),M=new THREE.Color(16777215),
- d=new THREE.Color(0),aa=new THREE.Color(0),O=new THREE.Color(0),K,X=new THREE.Vector3,Q=[],U=[],V=[],H,Y,ea,Z,fa=1;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(ia){switch(ia){case "high":fa=1;break;case "low":fa=0}};this.setSize=function(ia,l){j=ia;m=l;q=j/2;w=m/2;k.setAttribute("viewBox",-q+" "+-w+" "+j+" "+m);k.setAttribute("width",j);k.setAttribute("height",m);E.set(-q,-w,q,w)};this.clear=function(){for(;k.childNodes.length>0;)k.removeChild(k.childNodes[0])};
- this.render=function(ia,l){var y,B,o,n,N,G,z,I;this.autoClear&&this.clear();f=h.projectScene(ia,l,this.sortElements);Z=ea=Y=0;if(F=ia.lights.length>0){z=ia.lights;d.setRGB(0,0,0);aa.setRGB(0,0,0);O.setRGB(0,0,0);y=0;for(B=z.length;y<B;y++){o=z[y];n=o.color;if(o instanceof THREE.AmbientLight){d.r+=n.r;d.g+=n.g;d.b+=n.b}else if(o instanceof THREE.DirectionalLight){aa.r+=n.r;aa.g+=n.g;aa.b+=n.b}else if(o instanceof THREE.PointLight){O.r+=n.r;O.g+=n.g;O.b+=n.b}}}y=0;for(B=f.length;y<B;y++){z=f[y];v.empty();
- if(z instanceof THREE.RenderableParticle){u=z;u.x*=q;u.y*=-w;o=0;for(n=z.materials.length;o<n;o++)if(I=z.materials[o]){N=u;G=z;I=I;var D=ea++;if(U[D]==null){U[D]=document.createElementNS("http://www.w3.org/2000/svg","circle");fa==0&&U[D].setAttribute("shape-rendering","crispEdges")}H=U[D];H.setAttribute("cx",N.x);H.setAttribute("cy",N.y);H.setAttribute("r",G.scale.x*q);if(I instanceof THREE.ParticleCircleMaterial){if(F){M.r=d.r+aa.r+O.r;M.g=d.g+aa.g+O.g;M.b=d.b+aa.b+O.b;p.r=I.color.r*M.r;p.g=I.color.g*
- M.g;p.b=I.color.b*M.b;p.updateStyleString()}else p=I.color;H.setAttribute("style","fill: "+p.__styleString)}k.appendChild(H)}}else if(z instanceof THREE.RenderableLine){u=z.v1;t=z.v2;u.positionScreen.x*=q;u.positionScreen.y*=-w;t.positionScreen.x*=q;t.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);if(E.instersects(v)){o=0;for(n=z.materials.length;o<n;)if(I=z.materials[o++]){N=u;G=t;I=I;D=Z++;if(V[D]==null){V[D]=document.createElementNS("http://www.w3.org/2000/svg",
- "line");fa==0&&V[D].setAttribute("shape-rendering","crispEdges")}H=V[D];H.setAttribute("x1",N.positionScreen.x);H.setAttribute("y1",N.positionScreen.y);H.setAttribute("x2",G.positionScreen.x);H.setAttribute("y2",G.positionScreen.y);if(I instanceof THREE.LineBasicMaterial){p.__styleString=I.color.__styleString;H.setAttribute("style","fill: none; stroke: "+p.__styleString+"; stroke-width: "+I.linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.linecap+"; stroke-linejoin: "+I.linejoin);k.appendChild(H)}}}}else if(z instanceof
- THREE.RenderableFace3){u=z.v1;t=z.v2;x=z.v3;u.positionScreen.x*=q;u.positionScreen.y*=-w;t.positionScreen.x*=q;t.positionScreen.y*=-w;x.positionScreen.x*=q;x.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(x.positionScreen.x,x.positionScreen.y);if(E.instersects(v)){o=0;for(n=z.meshMaterials.length;o<n;){I=z.meshMaterials[o++];if(I instanceof THREE.MeshFaceMaterial){N=0;for(G=z.faceMaterials.length;N<G;)(I=z.faceMaterials[N++])&&
- b(u,t,x,z,I,ia)}else I&&b(u,t,x,z,I,ia)}}}else if(z instanceof THREE.RenderableFace4){u=z.v1;t=z.v2;x=z.v3;A=z.v4;u.positionScreen.x*=q;u.positionScreen.y*=-w;t.positionScreen.x*=q;t.positionScreen.y*=-w;x.positionScreen.x*=q;x.positionScreen.y*=-w;A.positionScreen.x*=q;A.positionScreen.y*=-w;v.addPoint(u.positionScreen.x,u.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(x.positionScreen.x,x.positionScreen.y);v.addPoint(A.positionScreen.x,A.positionScreen.y);if(E.instersects(v)){o=
- 0;for(n=z.meshMaterials.length;o<n;){I=z.meshMaterials[o++];if(I instanceof THREE.MeshFaceMaterial){N=0;for(G=z.faceMaterials.length;N<G;)(I=z.faceMaterials[N++])&&c(u,t,x,A,z,I,ia)}else I&&c(u,t,x,A,z,I,ia)}}}}}};
- THREE.WebGLRenderer=function(a){function b(l,y,B){var o,n,N,G=l.vertices,z=G.length,I=l.colors,D=I.length,$=l.__vertexArray,da=l.__colorArray,C=l.__sortArray,L=l.__dirtyVertices,J=l.__dirtyColors;if(B.sortParticles){V.multiplySelf(B.matrixWorld);for(o=0;o<z;o++){n=G[o].position;ea.copy(n);V.multiplyVector3(ea);C[o]=[ea.z,o]}C.sort(function(R,W){return W[0]-R[0]});for(o=0;o<z;o++){n=G[C[o][1]].position;N=o*3;$[N]=n.x;$[N+1]=n.y;$[N+2]=n.z}for(o=0;o<D;o++){N=o*3;color=I[C[o][1]];da[N]=color.r;da[N+
- 1]=color.g;da[N+2]=color.b}}else{if(L)for(o=0;o<z;o++){n=G[o].position;N=o*3;$[N]=n.x;$[N+1]=n.y;$[N+2]=n.z}if(J)for(o=0;o<D;o++){color=I[o];N=o*3;da[N]=color.r;da[N+1]=color.g;da[N+2]=color.b}}if(L||B.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,l.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,$,y)}if(J||B.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,l.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,da,y)}}function c(l,y){l.fragment_shader=y.fragment_shader;l.vertex_shader=y.vertex_shader;l.uniforms=
- Uniforms.clone(y.uniforms)}function e(l,y){if(!l.__webGLVertexBuffer)l.__webGLVertexBuffer=d.createBuffer();if(!l.__webGLNormalBuffer)l.__webGLNormalBuffer=d.createBuffer();if(l.hasPos){d.bindBuffer(d.ARRAY_BUFFER,l.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,l.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(y.attributes.position);d.vertexAttribPointer(y.attributes.position,3,d.FLOAT,false,0,0)}if(l.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,l.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,
- l.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(y.attributes.normal);d.vertexAttribPointer(y.attributes.normal,3,d.FLOAT,false,0,0)}d.drawArrays(d.TRIANGLES,0,l.count);l.count=0}function g(l){if(K!=l.doubleSided){l.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);K=l.doubleSided}if(X!=l.flipSided){l.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);X=l.flipSided}}function f(l){U[0].set(l.n41-l.n11,l.n42-l.n12,l.n43-l.n13,l.n44-l.n14);U[1].set(l.n41+l.n11,l.n42+l.n12,l.n43+l.n13,l.n44+
- l.n14);U[2].set(l.n41+l.n21,l.n42+l.n22,l.n43+l.n23,l.n44+l.n24);U[3].set(l.n41-l.n21,l.n42-l.n22,l.n43-l.n23,l.n44-l.n24);U[4].set(l.n41-l.n31,l.n42-l.n32,l.n43-l.n33,l.n44-l.n34);U[5].set(l.n41+l.n31,l.n42+l.n32,l.n43+l.n33,l.n44+l.n34);var y;for(l=0;l<5;l++){y=U[l];y.divideScalar(Math.sqrt(y.x*y.x+y.y*y.y+y.z*y.z))}}function h(l){for(var y=l.matrix,B=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),o=0;o<6;o++){l=U[o].x*y.n14+U[o].y*y.n24+U[o].z*y.n34+U[o].w;
- if(l<=B)return false}return true}function k(l,y){l.list[l.count]=y;l.count+=1}function j(l){var y,B,o=l.object,n=l.opaque,N=l.transparent;N.count=0;l=n.count=0;for(y=o.materials.length;l<y;l++){B=o.materials[l];B.opacity&&B.opacity<1||B.blending!=THREE.NormalBlending?k(N,B):k(n,B)}}function m(l){var y,B,o,n,N=l.object,G=l.buffer,z=l.opaque,I=l.transparent;I.count=0;l=z.count=0;for(o=N.materials.length;l<o;l++){y=N.materials[l];if(y instanceof THREE.MeshFaceMaterial){y=0;for(B=G.materials.length;y<
- B;y++)if(n=G.materials[y])n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?k(I,n):k(z,n)}else{n=y;n.opacity&&n.opacity<1||n.blending!=THREE.NormalBlending?k(I,n):k(z,n)}}}function q(l){var y,B,o,n=l.children;y=0;for(B=n.length;y<B;y++){o=n[y];o.autoUpdateMatrix&&o.updateMatrix();o.matrixWorld.multiply(l.matrixWorld,o.matrix);q(o)}}function w(l,y){return y.z-l.z}function u(l,y){var B,o,n=y.children;B=0;for(o=n.length;B<o;B++){child=n[B];t(l,child,false);u(l,child)}}function t(l,y,B){var o,
- n,N;n=y.geometry;if(l.__webGLObjectsMap[y.id]==undefined){l.__webGLObjectsMap[y.id]={};y._modelViewMatrix=new THREE.Matrix4;y._normalMatrixArray=new Float32Array(9);y._modelViewMatrixArray=new Float32Array(16);y._objectMatrixArray=new Float32Array(16);y.matrix.flattenToArray(y._objectMatrixArray)}N=l.__webGLObjectsMap[y.id];objlist=l.__webGLObjects;if(y instanceof THREE.Mesh){for(o in n.geometryChunks){l=n.geometryChunks[o];if(!l.__webGLVertexBuffer){var G=l;G.__webGLVertexBuffer=d.createBuffer();
- G.__webGLNormalBuffer=d.createBuffer();G.__webGLTangentBuffer=d.createBuffer();G.__webGLColorBuffer=d.createBuffer();G.__webGLUVBuffer=d.createBuffer();G.__webGLUV2Buffer=d.createBuffer();G.__webGLFaceBuffer=d.createBuffer();G.__webGLLineBuffer=d.createBuffer();G=l;var z=y,I=void 0,D=void 0,$=0,da=0,C=0,L=z.geometry.faces,J=G.faces;I=0;for(D=J.length;I<D;I++){fi=J[I];face=L[fi];if(face instanceof THREE.Face3){$+=3;da+=1;C+=3}else if(face instanceof THREE.Face4){$+=4;da+=2;C+=4}}G.__vertexArray=new Float32Array($*
- 3);G.__normalArray=new Float32Array($*3);G.__tangentArray=new Float32Array($*4);G.__colorArray=new Float32Array($*3);G.__uvArray=new Float32Array($*2);G.__uv2Array=new Float32Array($*2);G.__faceArray=new Uint16Array(da*3);G.__lineArray=new Uint16Array(C*2);D=I=G;z=z;$=void 0;L=void 0;var R=void 0,W=void 0;R=void 0;J=false;$=0;for(L=z.materials.length;$<L;$++){R=z.materials[$];if(R instanceof THREE.MeshFaceMaterial){R=0;for(W=D.materials.length;R<W;R++)if(D.materials[R]&&D.materials[R].shading!=undefined&&
- D.materials[R].shading==THREE.SmoothShading){J=true;break}}else if(R&&R.shading!=undefined&&R.shading==THREE.SmoothShading){J=true;break}if(J)break}I.__needsSmoothNormals=J;G.__webGLFaceCount=da*3;G.__webGLLineCount=C*2;n.__dirtyVertices=true;n.__dirtyElements=true;n.__dirtyUvs=true;n.__dirtyNormals=true;n.__dirtyTangents=true;n.__dirtyColors=true}if(n.__dirtyVertices||n.__dirtyElements||n.__dirtyUvs||n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents){G=l;da=d.DYNAMIC_DRAW;C=void 0;I=void 0;var la=
- void 0,S=void 0,ta=void 0,sa=void 0,va=void 0;la=void 0;var ga=void 0,ka=void 0,na=void 0,Ca=void 0;ga=void 0;ka=void 0;na=void 0;S=void 0;ga=void 0;ka=void 0;na=void 0;Ca=void 0;S=void 0;sa=void 0;ta=void 0;va=void 0;var ya=W=R=J=L=$=z=D=0,qa=0,ra=G.__vertexArray,Ha=G.__uvArray,Ia=G.__uv2Array,wa=G.__normalArray,ma=G.__tangentArray,pa=G.__colorArray,Da=G.__faceArray,xa=G.__lineArray,Oa=G.__needsSmoothNormals,Aa=y.geometry,oa=Aa.__dirtyVertices,Ea=Aa.__dirtyElements,Fa=Aa.__dirtyUvs,Pa=Aa.__dirtyNormals,
- Qa=Aa.__dirtyTangents,Na=Aa.__dirtyColors,P=Aa.vertices,ha=G.faces,ca=Aa.faces,T=Aa.uvs,ba=Aa.uvs2,ja=Aa.colors;C=0;for(I=ha.length;C<I;C++){la=ha[C];S=ca[la];va=T[la];la=ba[la];ta=S.vertexNormals;sa=S.normal;if(S instanceof THREE.Face3){if(oa){ga=P[S.a].position;ka=P[S.b].position;na=P[S.c].position;ra[z]=ga.x;ra[z+1]=ga.y;ra[z+2]=ga.z;ra[z+3]=ka.x;ra[z+4]=ka.y;ra[z+5]=ka.z;ra[z+6]=na.x;ra[z+7]=na.y;ra[z+8]=na.z;z+=9}if(Na&&ja.length){ga=ja[S.a];ka=ja[S.b];na=ja[S.c];pa[qa]=ga.r;pa[qa+1]=ga.g;pa[qa+
- 2]=ga.b;pa[qa+3]=ka.r;pa[qa+4]=ka.g;pa[qa+5]=ka.b;pa[qa+6]=na.r;pa[qa+7]=na.g;pa[qa+8]=na.b;qa+=9}if(Qa&&Aa.hasTangents){ga=P[S.a].tangent;ka=P[S.b].tangent;na=P[S.c].tangent;ma[W]=ga.x;ma[W+1]=ga.y;ma[W+2]=ga.z;ma[W+3]=ga.w;ma[W+4]=ka.x;ma[W+5]=ka.y;ma[W+6]=ka.z;ma[W+7]=ka.w;ma[W+8]=na.x;ma[W+9]=na.y;ma[W+10]=na.z;ma[W+11]=na.w;W+=12}if(Pa)if(ta.length==3&&Oa)for(S=0;S<3;S++){sa=ta[S];wa[R]=sa.x;wa[R+1]=sa.y;wa[R+2]=sa.z;R+=3}else for(S=0;S<3;S++){wa[R]=sa.x;wa[R+1]=sa.y;wa[R+2]=sa.z;R+=3}if(Fa&&
- va)for(S=0;S<3;S++){ta=va[S];Ha[$]=ta.u;Ha[$+1]=ta.v;$+=2}if(Fa&&la)for(S=0;S<3;S++){va=la[S];Ia[L]=va.u;Ia[L+1]=va.v;L+=2}if(Ea){Da[J]=D;Da[J+1]=D+1;Da[J+2]=D+2;J+=3;xa[ya]=D;xa[ya+1]=D+1;xa[ya+2]=D;xa[ya+3]=D+2;xa[ya+4]=D+1;xa[ya+5]=D+2;ya+=6;D+=3}}else if(S instanceof THREE.Face4){if(oa){ga=P[S.a].position;ka=P[S.b].position;na=P[S.c].position;Ca=P[S.d].position;ra[z]=ga.x;ra[z+1]=ga.y;ra[z+2]=ga.z;ra[z+3]=ka.x;ra[z+4]=ka.y;ra[z+5]=ka.z;ra[z+6]=na.x;ra[z+7]=na.y;ra[z+8]=na.z;ra[z+9]=Ca.x;ra[z+
- 10]=Ca.y;ra[z+11]=Ca.z;z+=12}if(Na&&ja.length){ga=ja[S.a];ka=ja[S.b];na=ja[S.c];Ca=ja[S.d];pa[qa]=ga.r;pa[qa+1]=ga.g;pa[qa+2]=ga.b;pa[qa+3]=ka.r;pa[qa+4]=ka.g;pa[qa+5]=ka.b;pa[qa+6]=na.r;pa[qa+7]=na.g;pa[qa+8]=na.b;pa[qa+9]=Ca.r;pa[qa+10]=Ca.g;pa[qa+11]=Ca.b;qa+=12}if(Qa&&Aa.hasTangents){ga=P[S.a].tangent;ka=P[S.b].tangent;na=P[S.c].tangent;S=P[S.d].tangent;ma[W]=ga.x;ma[W+1]=ga.y;ma[W+2]=ga.z;ma[W+3]=ga.w;ma[W+4]=ka.x;ma[W+5]=ka.y;ma[W+6]=ka.z;ma[W+7]=ka.w;ma[W+8]=na.x;ma[W+9]=na.y;ma[W+10]=na.z;
- ma[W+11]=na.w;ma[W+12]=S.x;ma[W+13]=S.y;ma[W+14]=S.z;ma[W+15]=S.w;W+=16}if(Pa)if(ta.length==4&&Oa)for(S=0;S<4;S++){sa=ta[S];wa[R]=sa.x;wa[R+1]=sa.y;wa[R+2]=sa.z;R+=3}else for(S=0;S<4;S++){wa[R]=sa.x;wa[R+1]=sa.y;wa[R+2]=sa.z;R+=3}if(Fa&&va)for(S=0;S<4;S++){ta=va[S];Ha[$]=ta.u;Ha[$+1]=ta.v;$+=2}if(Fa&&la)for(S=0;S<4;S++){va=la[S];Ia[L]=va.u;Ia[L+1]=va.v;L+=2}if(Ea){Da[J]=D;Da[J+1]=D+1;Da[J+2]=D+2;Da[J+3]=D;Da[J+4]=D+2;Da[J+5]=D+3;J+=6;xa[ya]=D;xa[ya+1]=D+1;xa[ya+2]=D;xa[ya+3]=D+3;xa[ya+4]=D+1;xa[ya+
- 5]=D+2;xa[ya+6]=D+2;xa[ya+7]=D+3;ya+=8;D+=4}}}if(oa){d.bindBuffer(d.ARRAY_BUFFER,G.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,ra,da)}if(Na&&ja.length){d.bindBuffer(d.ARRAY_BUFFER,G.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,pa,da)}if(Pa){d.bindBuffer(d.ARRAY_BUFFER,G.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,wa,da)}if(Qa&&Aa.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,G.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,ma,da)}if(Fa&&$>0){d.bindBuffer(d.ARRAY_BUFFER,G.__webGLUVBuffer);
- d.bufferData(d.ARRAY_BUFFER,Ha,da)}if(Fa&&L>0){d.bindBuffer(d.ARRAY_BUFFER,G.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ia,da)}if(Ea){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,G.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,Da,da);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,G.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,xa,da)}}x(objlist,N,o,l,y,B)}n.__dirtyVertices=false;n.__dirtyElements=false;n.__dirtyUvs=false;n.__dirtyNormals=false;n.__dirtyTangents=false;n.__dirtyColors=false}else if(y instanceof
- THREE.Line){if(!n.__webGLVertexBuffer){n.__webGLVertexBuffer=d.createBuffer();n.__webGLColorBuffer=d.createBuffer();o=n.vertices.length;n.__vertexArray=new Float32Array(o*3);n.__colorArray=new Float32Array(o*3);n.__webGLLineCount=o;n.__dirtyVertices=true;n.__dirtyColors=true}if(n.__dirtyVertices||n.__dirtyColors){o=d.DYNAMIC_DRAW;z=n.vertices;G=n.colors;$=z.length;da=G.length;L=n.__vertexArray;C=n.__colorArray;J=n.__dirtyColors;if(n.__dirtyVertices){for(I=0;I<$;I++){D=z[I].position;l=I*3;L[l]=D.x;
- L[l+1]=D.y;L[l+2]=D.z}d.bindBuffer(d.ARRAY_BUFFER,n.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,L,o)}if(J){for(I=0;I<da;I++){color=G[I];l=I*3;C[l]=color.r;C[l+1]=color.g;C[l+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,n.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,C,o)}}x(objlist,N,0,n,y,B);n.__dirtyVertices=false;n.__dirtyColors=false}else if(y instanceof THREE.ParticleSystem){if(!n.__webGLVertexBuffer){n.__webGLVertexBuffer=d.createBuffer();n.__webGLColorBuffer=d.createBuffer();o=n.vertices.length;
- n.__vertexArray=new Float32Array(o*3);n.__colorArray=new Float32Array(o*3);n.__sortArray=[];n.__webGLParticleCount=o;n.__dirtyVertices=true;n.__dirtyColors=true}if(n.__dirtyVertices||n.__dirtyColors||y.sortParticles)b(n,d.DYNAMIC_DRAW,y,camera);x(objlist,N,0,n,y,B);n.__dirtyVertices=false;n.__dirtyColors=false}else if(y instanceof THREE.MarchingCubes)if(N[0]==undefined){l.__webGLObjectsImmediate.push({object:y,opaque:{list:[],count:0},transparent:{list:[],count:0},root:B});N[0]=1}}function x(l,y,
- B,o,n,N){if(y[B]==undefined){l.push({buffer:o,object:n,opaque:{list:[],count:0},transparent:{list:[],count:0},root:N});y[B]=1}}function A(l,y){l._modelViewMatrix.multiplyToArray(y.matrix,l.matrixWorld,l._modelViewMatrixArray);l._normalMatrix=THREE.Matrix4.makeInvert3x3(l._modelViewMatrix).transposeIntoArray(l._normalMatrixArray)}function E(l){if(l!=Q){switch(l){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,
- d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}Q=l}}function v(l,y){if(l&&!l.__webGLFramebuffer){l.__webGLFramebuffer=d.createFramebuffer();l.__webGLRenderbuffer=d.createRenderbuffer();l.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,l.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,l.width,l.height);
- d.bindTexture(d.TEXTURE_2D,l.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,p(l.wrap_s));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,p(l.wrap_t));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,p(l.mag_filter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,p(l.min_filter));d.texImage2D(d.TEXTURE_2D,0,p(l.format),l.width,l.height,0,p(l.format),p(l.type),null);d.bindFramebuffer(d.FRAMEBUFFER,l.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,
- l.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,l.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var B,o,n;if(l){B=l.__webGLFramebuffer;o=l.width;n=l.height}else{B=null;o=M.width;n=M.height}if(B!=O){d.bindFramebuffer(d.FRAMEBUFFER,B);d.viewport(0,0,o,n);y&&d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT);O=B}}function F(l,y){var B;if(l=="fragment")B=d.createShader(d.FRAGMENT_SHADER);
- else if(l=="vertex")B=d.createShader(d.VERTEX_SHADER);d.shaderSource(B,y);d.compileShader(B);if(!d.getShaderParameter(B,d.COMPILE_STATUS)){alert(d.getShaderInfoLog(B));return null}return B}function p(l){switch(l){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;
- case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;
- case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var M=document.createElement("canvas"),d,aa=null,O=null,K=null,X=null,Q=null,U=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],V=new THREE.Matrix4,H=new Float32Array(16),Y=new Float32Array(16),ea=new THREE.Vector4,Z=true,fa=new THREE.Color(0),ia=0;if(a){if(a.antialias!==
- undefined)Z=a.antialias;a.clearColor!==undefined&&fa.setHex(a.clearColor);if(a.clearAlpha!==undefined)ia=a.clearAlpha}this.domElement=M;this.autoClear=true;(function(l,y,B){try{d=M.getContext("experimental-webgl",{antialias:l})}catch(o){console.log(o)}if(!d){alert("WebGL not supported");throw"cannot create webgl context";}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,
- d.ONE_MINUS_SRC_ALPHA);d.clearColor(y.r,y.g,y.b,B);_cullEnabled=true})(Z,fa,ia);this.context=d;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(l,y){M.width=l;M.height=y;d.viewport(0,0,M.width,M.height)};this.setClearColorHex=function(l,y){var B=new THREE.Color(l);d.clearColor(B.r,B.g,B.b,y)};this.setClearColor=function(l,y){d.clearColor(l.r,l.g,l.b,y)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};
- this.setupLights=function(l,y){var B,o,n,N=0,G=0,z=0,I,D,$,da=this.lights,C=da.directional.colors,L=da.directional.positions,J=da.point.colors,R=da.point.positions,W=0,la=0;B=n=n=0;for(o=y.length;B<o;B++){n=y[B];I=n.color;D=n.position;$=n.intensity;if(n instanceof THREE.AmbientLight){N+=I.r;G+=I.g;z+=I.b}else if(n instanceof THREE.DirectionalLight){n=W*3;C[n]=I.r*$;C[n+1]=I.g*$;C[n+2]=I.b*$;L[n]=D.x;L[n+1]=D.y;L[n+2]=D.z;W+=1}else if(n instanceof THREE.PointLight){n=la*3;J[n]=I.r*$;J[n+1]=I.g*$;J[n+
- 2]=I.b*$;R[n]=D.x;R[n+1]=D.y;R[n+2]=D.z;la+=1}}for(B=W*3;B<C.length;B++)C[B]=0;for(B=la*3;B<J.length;B++)J[B]=0;da.point.length=la;da.directional.length=W;da.ambient[0]=N;da.ambient[1]=G;da.ambient[2]=z};this.initMaterial=function(l,y,B){var o,n;if(l instanceof THREE.MeshDepthMaterial)c(l,THREE.ShaderLib.depth);else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial)c(l,THREE.ShaderLib.basic);else if(l instanceof THREE.MeshLambertMaterial)c(l,
- THREE.ShaderLib.lambert);else if(l instanceof THREE.MeshPhongMaterial)c(l,THREE.ShaderLib.phong);else if(l instanceof THREE.LineBasicMaterial)c(l,THREE.ShaderLib.basic);else l instanceof THREE.ParticleBasicMaterial&&c(l,THREE.ShaderLib.particle_basic);var N,G,z,I;n=z=I=0;for(N=y.length;n<N;n++){G=y[n];G instanceof THREE.DirectionalLight&&z++;G instanceof THREE.PointLight&&I++}if(I+z<=4){y=z;I=I}else{y=Math.ceil(4*z/(I+z));I=4-y}n={directional:y,point:I};I=l.fragment_shader;y=l.vertex_shader;N={fog:B,
- map:l.map,env_map:l.env_map,light_map:l.light_map,vertex_colors:l.vertex_colors,maxDirLights:n.directional,maxPointLights:n.point};B=d.createProgram();n=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+N.maxDirLights,"#define MAX_POINT_LIGHTS "+N.maxPointLights,N.fog?"#define USE_FOG":"",N.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",N.map?"#define USE_MAP":"",N.env_map?"#define USE_ENVMAP":"",N.light_map?"#define USE_LIGHTMAP":"",N.vertex_colors?"#define USE_COLOR":
- "","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");N=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+N.maxDirLights,"#define MAX_POINT_LIGHTS "+N.maxPointLights,N.map?"#define USE_MAP":"",N.env_map?"#define USE_ENVMAP":"",N.light_map?"#define USE_LIGHTMAP":"",N.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");
- d.attachShader(B,F("fragment",n+I));d.attachShader(B,F("vertex",N+y));d.linkProgram(B);d.getProgramParameter(B,d.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+d.getProgramParameter(B,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");B.uniforms={};B.attributes={};l.program=B;B=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(o in l.uniforms)B.push(o);o=l.program;I=0;for(y=B.length;I<y;I++){n=B[I];o.uniforms[n]=d.getUniformLocation(o,
- n)}l=l.program;o=["position","normal","uv","uv2","tangent","color"];B=0;for(I=o.length;B<I;B++){y=o[B];l.attributes[y]=d.getAttribLocation(l,y)}};this.setProgram=function(l,y,B,o,n){o.program||this.initMaterial(o,y,B);var N=o.program,G=N.uniforms,z=o.uniforms;if(N!=aa){d.useProgram(N);aa=N;d.uniformMatrix4fv(G.projectionMatrix,false,H)}if(B&&(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial||o instanceof THREE.LineBasicMaterial||o instanceof
- THREE.ParticleBasicMaterial)){z.fogColor.value.setHex(B.color.hex);if(B instanceof THREE.Fog){z.fogNear.value=B.near;z.fogFar.value=B.far}else if(B instanceof THREE.FogExp2)z.fogDensity.value=B.density}if(o instanceof THREE.MeshPhongMaterial||o instanceof THREE.MeshLambertMaterial){this.setupLights(N,y);y=this.lights;z.enableLighting.value=y.directional.length+y.point.length;z.ambientLightColor.value=y.ambient;z.directionalLightColor.value=y.directional.colors;z.directionalLightDirection.value=y.directional.positions;
- z.pointLightColor.value=y.point.colors;z.pointLightPosition.value=y.point.positions}if(o instanceof THREE.MeshBasicMaterial||o instanceof THREE.MeshLambertMaterial||o instanceof THREE.MeshPhongMaterial){z.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);z.opacity.value=o.opacity;z.map.texture=o.map;z.light_map.texture=o.light_map;z.env_map.texture=o.env_map;z.reflectivity.value=o.reflectivity;z.refraction_ratio.value=o.refraction_ratio;z.combine.value=o.combine;z.useRefract.value=
- o.env_map&&o.env_map.mapping instanceof THREE.CubeRefractionMapping}if(o instanceof THREE.LineBasicMaterial){z.diffuse.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);z.opacity.value=o.opacity}else if(o instanceof THREE.ParticleBasicMaterial){z.psColor.value.setRGB(o.color.r*o.opacity,o.color.g*o.opacity,o.color.b*o.opacity);z.opacity.value=o.opacity;z.size.value=o.size;z.map.texture=o.map}else if(o instanceof THREE.MeshPhongMaterial){z.ambient.value.setRGB(o.ambient.r,o.ambient.g,
- o.ambient.b);z.specular.value.setRGB(o.specular.r,o.specular.g,o.specular.b);z.shininess.value=o.shininess}else if(o instanceof THREE.MeshDepthMaterial){z.mNear.value=l.near;z.mFar.value=l.far;z.opacity.value=o.opacity}else if(o instanceof THREE.MeshNormalMaterial)z.opacity.value=o.opacity;var I,D,$;for(I in z)if($=N.uniforms[I]){B=z[I];D=B.type;y=B.value;if(D=="i")d.uniform1i($,y);else if(D=="f")d.uniform1f($,y);else if(D=="fv1")d.uniform1fv($,y);else if(D=="fv")d.uniform3fv($,y);else if(D=="v2")d.uniform2f($,
- y.x,y.y);else if(D=="v3")d.uniform3f($,y.x,y.y,y.z);else if(D=="c")d.uniform3f($,y.r,y.g,y.b);else if(D=="t"){d.uniform1i($,y);if(B=B.texture)if(B.image instanceof Array&&B.image.length==6){B=B;y=y;if(B.image.length==6){if(!B.image.__webGLTextureCube&&!B.image.__cubeMapInitialized&&B.image.loadCount==6){B.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,B.image.__webGLTextureCube);d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_CUBE_MAP,
- d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_MAG_FILTER,d.LINEAR);d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_MIN_FILTER,d.LINEAR_MIPMAP_LINEAR);for(D=0;D<6;++D)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,B.image[D]);d.generateMipmap(d.TEXTURE_CUBE_MAP);d.bindTexture(d.TEXTURE_CUBE_MAP,null);B.image.__cubeMapInitialized=true}d.activeTexture(d.TEXTURE0+y);d.bindTexture(d.TEXTURE_CUBE_MAP,B.image.__webGLTextureCube)}}else{B=B;y=y;if(!B.__webGLTexture&&
- B.image.loaded){B.__webGLTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,B.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,B.image);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,p(B.wrap_s));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,p(B.wrap_t));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,p(B.mag_filter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,p(B.min_filter));d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}d.activeTexture(d.TEXTURE0+
- y);d.bindTexture(d.TEXTURE_2D,B.__webGLTexture)}}}d.uniformMatrix4fv(G.modelViewMatrix,false,n._modelViewMatrixArray);d.uniformMatrix3fv(G.normalMatrix,false,n._normalMatrixArray);if(o instanceof THREE.MeshShaderMaterial||o instanceof THREE.MeshPhongMaterial||o.env_map)d.uniform3f(G.cameraPosition,l.position.x,l.position.y,l.position.z);if(o instanceof THREE.MeshShaderMaterial||o.env_map)d.uniformMatrix4fv(G.objectMatrix,false,n._objectMatrixArray);if(o instanceof THREE.MeshPhongMaterial||o instanceof
- THREE.MeshLambertMaterial||o instanceof THREE.MeshShaderMaterial)d.uniformMatrix4fv(G.viewMatrix,false,Y);return N};this.renderBuffer=function(l,y,B,o,n,N){l=this.setProgram(l,y,B,o,N).attributes;d.bindBuffer(d.ARRAY_BUFFER,n.__webGLVertexBuffer);d.vertexAttribPointer(l.position,3,d.FLOAT,false,0,0);d.enableVertexAttribArray(l.position);if(l.color>=0){d.bindBuffer(d.ARRAY_BUFFER,n.__webGLColorBuffer);d.vertexAttribPointer(l.color,3,d.FLOAT,false,0,0);d.enableVertexAttribArray(l.color)}if(l.normal>=
- 0){d.bindBuffer(d.ARRAY_BUFFER,n.__webGLNormalBuffer);d.vertexAttribPointer(l.normal,3,d.FLOAT,false,0,0);d.enableVertexAttribArray(l.normal)}if(l.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,n.__webGLTangentBuffer);d.vertexAttribPointer(l.tangent,4,d.FLOAT,false,0,0);d.enableVertexAttribArray(l.tangent)}if(l.uv>=0)if(n.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,n.__webGLUVBuffer);d.vertexAttribPointer(l.uv,2,d.FLOAT,false,0,0);d.enableVertexAttribArray(l.uv)}else d.disableVertexAttribArray(l.uv);if(l.uv2>=
- 0)if(n.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,n.__webGLUV2Buffer);d.vertexAttribPointer(l.uv2,2,d.FLOAT,false,0,0);d.enableVertexAttribArray(l.uv2)}else d.disableVertexAttribArray(l.uv2);if(N instanceof THREE.Mesh)if(o.wireframe){d.lineWidth(o.wireframe_linewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,n.__webGLLineBuffer);d.drawElements(d.LINES,n.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,n.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,n.__webGLFaceCount,d.UNSIGNED_SHORT,
- 0)}else if(N instanceof THREE.Line){N=N.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(o.linewidth);d.drawArrays(N,0,n.__webGLLineCount)}else N instanceof THREE.ParticleSystem&&d.drawArrays(d.POINTS,0,n.__webGLParticleCount)};this.render=function(l,y,B,o){var n,N,G,z,I,D,$,da=l.lights,C=l.fog;y.autoUpdateMatrix&&y.updateMatrix();y.matrix.flattenToArray(Y);y.projectionMatrix.flattenToArray(H);V.multiply(y.projectionMatrix,y.matrix);f(V);this.initWebGLObjects(l,y);v(B,o!==undefined?o:true);
- this.autoClear&&this.clear();z=l.__webGLObjects.length;for(o=0;o<z;o++){n=l.__webGLObjects[o];D=n.object;if(D.visible){if(n.root){D.autoUpdateMatrix&&D.updateMatrix();D.matrixWorld.copy(D.matrix);q(D)}if(!(D instanceof THREE.Mesh)||h(D)){D.matrixWorld.flattenToArray(D._objectMatrixArray);A(D,y);m(n);n.render=true;ea.copy(D.position);V.multiplyVector3(ea);n.z=ea.z}else n.render=false}else n.render=false}l.__webGLObjects.sort(w);I=l.__webGLObjectsImmediate.length;for(o=0;o<I;o++){n=l.__webGLObjectsImmediate[o];
- D=n.object;if(D.visible){if(D.autoUpdateMatrix){D.updateMatrix();D.matrixWorld.copy(D.matrix);D.matrixWorld.flattenToArray(D._objectMatrixArray)}A(D,y);j(n)}}E(THREE.NormalBlending);for(o=0;o<z;o++){n=l.__webGLObjects[o];if(n.render){D=n.object;$=n.buffer;G=n.opaque;g(D);for(n=0;n<G.count;n++){material=G.list[n];this.setDepthTest(material.depth_test);this.renderBuffer(y,da,C,material,$,D)}}}for(o=0;o<I;o++){n=l.__webGLObjectsImmediate[o];D=n.object;if(D.visible){G=n.opaque;g(D);for(n=0;n<G.count;n++){material=
- G.list[n];this.setDepthTest(material.depth_test);N=this.setProgram(y,da,C,material,D);D.render(function(L){e(L,N)})}}}for(o=0;o<z;o++){n=l.__webGLObjects[o];if(n.render){D=n.object;$=n.buffer;G=n.transparent;g(D);for(n=0;n<G.count;n++){material=G.list[n];E(material.blending);this.setDepthTest(material.depth_test);this.renderBuffer(y,da,C,material,$,D)}}}for(o=0;o<I;o++){n=l.__webGLObjectsImmediate[o];D=n.object;if(D.visible){G=n.transparent;g(D);for(n=0;n<G.count;n++){material=G.list[n];E(material.blending);
- this.setDepthTest(material.depth_test);N=this.setProgram(y,da,C,material,D);D.render(function(L){e(L,N)})}}}if(B&&B.min_filter!==THREE.NearestFilter&&B.min_filter!==THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,B.__webGLTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=function(l){var y,B,o;if(!l.__webGLObjects){l.__webGLObjects=[];l.__webGLObjectsMap={};l.__webGLObjectsImmediate=[]}y=0;for(B=l.objects.length;y<B;y++){o=l.objects[y];t(l,o,true);u(l,
- o)}};this.removeObject=function(l,y){var B,o;for(B=l.__webGLObjects.length-1;B>=0;B--){o=l.__webGLObjects[B].object;y==o&&l.__webGLObjects.splice(B,1)}};this.setDepthTest=function(l){l?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST)};this.setFaceCulling=function(l,y){if(l){!y||y=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(l=="back")d.cullFace(d.BACK);else l=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
- 0}};
- THREE.Snippets={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 env_map;\nuniform int combine;\n#endif",
- envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\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 ), refraction_ratio );\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_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",
- lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, 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 ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
- lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
- lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 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 + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
- color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif"};
- THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
- value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
- THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragment_shader:"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}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
- value:1}},fragment_shader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,
- THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,
- "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,
- THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,
- THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,
- THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,
- THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
- THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.Snippets.lights_vertex,
- "gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",THREE.Snippets.color_pars_vertex,
- "void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};THREE.RenderableObject=function(){this.z=this.object=null};
- THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,null]};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};
- THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
- THREE.Detector={canvas:!!document.createElement("canvas").getContext,webgl:window.Uint8Array!=undefined,workers:!!window.Worker,addGetWebGLMessage:function(a){var b=document.body,c="oldie";if(a){if(a.parent!==undefined)b=a.parent;if(a.id!==undefined)c=a.id}a=document.createElement("center");var e=document.createElement("div");e.innerHTML='Sorry, your browser doesn\'t support <a href="http://khronos.org/webgl/wiki/Getting_a_WebGL_Implementation">WebGL</a><br/>\n<br/>\nPlease try in\n<a href="http://www.google.com/chrome">Chrome 9+</a> /\n<a href="http://www.mozilla.com/en-US/firefox/all-beta.html">Firefox 4+</a> /\n<a href="http://nightly.webkit.org/">Safari OSX 10.6+</a>';e.id=
- c;c=e.style;c.fontFamily="monospace";c.fontSize="13px";c.textAlign="center";c.background="#eee";c.color="#000";c.padding="1em";c.width="475px";c.margin="5em auto 0";a.appendChild(e);b.appendChild(a);return e}};
- var GeometryUtils={merge:function(a,b){var c=b instanceof THREE.Mesh,e=a.vertices.length,g=c?b.geometry:b,f=a.vertices,h=g.vertices,k=a.faces,j=g.faces,m=a.uvs;g=g.uvs;c&&b.autoUpdateMatrix&&b.updateMatrix();for(var q=0,w=h.length;q<w;q++){var u=new THREE.Vertex(h[q].position.clone());c&&b.matrix.multiplyVector3(u.position);f.push(u)}q=0;for(w=j.length;q<w;q++){h=j[q];var t,x=h.vertexNormals;if(h instanceof THREE.Face3)t=new THREE.Face3(h.a+e,h.b+e,h.c+e);else if(h instanceof THREE.Face4)t=new THREE.Face4(h.a+
- e,h.b+e,h.c+e,h.d+e);t.centroid.copy(h.centroid);t.normal.copy(h.normal);c=0;for(f=x.length;c<f;c++){u=x[c];t.vertexNormals.push(u.clone())}t.materials=h.materials.slice();k.push(t)}q=0;for(w=g.length;q<w;q++){e=g[q];k=[];c=0;for(f=e.length;c<f;c++)k.push(new THREE.UV(e[c].u,e[c].v));m.push(k)}}},ImageUtils={loadTexture:function(a,b,c){var e=new Image;e.onload=function(){this.loaded=true;c&&c(this)};e.src=a;return new THREE.Texture(e,b)},loadArray:function(a,b){var c,e,g=[];c=g.loadCount=0;for(e=
- a.length;c<e;++c){g[c]=new Image;g[c].loaded=0;g[c].onload=function(){g.loadCount+=1;this.loaded=true;b&&b(this)};g[c].src=a[c]}return g}},SceneUtils={loadScene:function(a,b,c,e){a=new Worker(a);a.postMessage(0);a.onmessage=function(g){function f(){for(q in O.objects)if(!H.objects[q]){A=O.objects[q];if(p=H.geometries[A.geometry]){aa=[];for(i=0;i<A.materials.length;i++)aa[i]=H.materials[A.materials[i]];E=A.position;r=A.rotation;s=A.scale;object=new THREE.Mesh(p,aa);object.position.set(E[0],E[1],E[2]);
- object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=A.visible;H.scene.addObject(object);H.objects[q]=object}}}function h(Y){return function(ea){H.geometries[Y]=ea;f();X-=1;k()}}function k(){e({total_models:U,total_textures:V,loaded_models:U-X,loaded_textures:V-Q},H);X==0&&Q==0&&c(H)}var j,m,q,w,u,t,x,A,E,v,F,p,M,d,aa,O,K,X,Q,U,V,H;O=g.data;K=new THREE.Loader;Q=X=0;H={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};
- g=function(){Q-=1;k()};for(u in O.cameras){v=O.cameras[u];if(v.type=="perspective")M=new THREE.Camera(v.fov,v.aspect,v.near,v.far);else if(v.type=="ortho"){M=new THREE.Camera;M.projectionMatrix=THREE.Matrix4.makeOrtho(v.left,v.right,v.top,v.bottom,v.near,v.far)}E=v.position;v=v.target;M.position.set(E[0],E[1],E[2]);M.target.position.set(v[0],v[1],v[2]);H.cameras[u]=M}for(w in O.lights){u=O.lights[w];if(u.type=="directional"){E=u.direction;light=new THREE.DirectionalLight;light.position.set(E[0],E[1],
- E[2]);light.position.normalize()}else if(u.type=="point"){E=u.position;light=new THREE.PointLight;light.position.set(E[0],E[1],E[2])}v=u.color;i=u.intensity||1;light.color.setRGB(v[0]*i,v[1]*i,v[2]*i);H.scene.addLight(light);H.lights[w]=light}for(t in O.fogs){w=O.fogs[t];if(w.type=="linear")d=new THREE.Fog(0,w.near,w.far);else if(w.type=="exp2")d=new THREE.FogExp2(0,w.density);v=w.color;d.color.setRGB(v[0],v[1],v[2]);H.fogs[t]=d}if(H.cameras&&O.defaults.camera)H.currentCamera=H.cameras[O.defaults.camera];
- if(H.fogs&&O.defaults.fog)H.scene.fog=H.fogs[O.defaults.fog];v=O.defaults.bgcolor;H.bgColor=new THREE.Color;H.bgColor.setRGB(v[0],v[1],v[2]);H.bgColorAlpha=O.defaults.bgalpha;for(j in O.geometries){t=O.geometries[j];if(t.type=="bin_mesh"||t.type=="ascii_mesh")X+=1}U=X;for(j in O.geometries){t=O.geometries[j];if(t.type=="cube"){p=new Cube(t.width,t.height,t.depth,t.segments_width,t.segments_height,null,t.flipped,t.sides);H.geometries[j]=p}else if(t.type=="plane"){p=new Plane(t.width,t.height,t.segments_width,
- t.segments_height);H.geometries[j]=p}else if(t.type=="sphere"){p=new Sphere(t.radius,t.segments_width,t.segments_height);H.geometries[j]=p}else if(t.type=="cylinder"){p=new Cylinder(t.numSegs,t.topRad,t.botRad,t.height,t.topOffset,t.botOffset);H.geometries[j]=p}else if(t.type=="torus"){p=new Torus(t.radius,t.tube,t.segmentsR,t.segmentsT);H.geometries[j]=p}else if(t.type=="icosahedron"){p=new Icosahedron(t.subdivisions);H.geometries[j]=p}else if(t.type=="bin_mesh")K.loadBinary({model:t.url,callback:h(j)});
- else t.type=="ascii_mesh"&&K.loadAscii({model:t.url,callback:h(j)})}for(x in O.textures){j=O.textures[x];Q+=j.url instanceof Array?j.url.length:1}V=Q;for(x in O.textures){j=O.textures[x];if(j.mapping!=undefined&&THREE[j.mapping]!=undefined)j.mapping=new THREE[j.mapping];if(j.url instanceof Array){t=ImageUtils.loadArray(j.url,g);t=new THREE.Texture(t,j.mapping)}else{t=ImageUtils.loadTexture(j.url,j.mapping,g);if(THREE[j.min_filter]!=undefined)t.min_filter=THREE[j.min_filter];if(THREE[j.mag_filter]!=
- undefined)t.mag_filter=THREE[j.mag_filter]}H.textures[x]=t}for(m in O.materials){x=O.materials[m];for(F in x.parameters)if(F=="env_map"||F=="map"||F=="light_map")x.parameters[F]=H.textures[x.parameters[F]];else if(F=="shading")x.parameters[F]=x.parameters[F]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(F=="blending")x.parameters[F]=THREE[x.parameters[F]]?THREE[x.parameters[F]]:THREE.NormalBlending;else if(F=="combine")x.parameters[F]=x.parameters[F]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;
- x=new THREE[x.type](x.parameters);H.materials[m]=x}f();b(H)}},addMesh:function(a,b,c,e,g,f,h,k,j,m){b=new THREE.Mesh(b,m);b.scale.x=b.scale.y=b.scale.z=c;b.position.x=e;b.position.y=g;b.position.z=f;b.rotation.x=h;b.rotation.y=k;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,c){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=c;c=new THREE.MeshShaderMaterial({fragment_shader:e.fragment_shader,vertex_shader:e.vertex_shader,uniforms:e.uniforms});b=new THREE.Mesh(new Cube(b,
- b,b,1,1,null,true),c);a.addObject(b);return b},addPanoramaCube:function(a,b,c){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));b=new THREE.Mesh(new Cube(b,
- b,b,1,1,e,true),new THREE.MeshFaceMaterial);a.addObject(b);return b},addPanoramaCubePlanes:function(a,b,c){var e=b/2;b=new Plane(b,b);var g=Math.PI/2,f=Math.PI;SceneUtils.addMesh(a,b,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[5])}));SceneUtils.addMesh(a,b,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[0])}));SceneUtils.addMesh(a,b,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[1])}));SceneUtils.addMesh(a,b,1,0,e,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[2])}));
- SceneUtils.addMesh(a,b,1,0,-e,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(c[3])}))}},ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
- vertex_shader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
- normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
- uDirLightColor:{type:"c",value:new THREE.Color(15658734)},uAmbientLightColor:{type:"c",value:new THREE.Color(328965)},uDiffuseColor:{type:"c",value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30}},fragment_shader:"uniform vec3 uDirLightPos;\nuniform vec3 uAmbientLightColor;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform bool enableDiffuse;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );\nvec3 aoTex = vec3( 1.0, 1.0, 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ndiffuseTex = texture2D( tDiffuse, vUv ).xyz;\nif( enableAO )\naoTex = texture2D( tAO, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec3 pointVector = normalize( vPointLightVector );\nvec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}",
- vertex_shader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"},
- cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},convolution:{uniforms:{tDiffuse:{type:"t",
- value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
- film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0},grayscale:{type:"i",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nuniform bool grayscale;\nconst float fNintensity = 0.35;\nconst float fSintensity = 0.35;\nconst float fScount = 4096.0;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin(vUv.y * fScount), cos(vUv.y * fScount) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * fSintensity;\ncResult = cTextureScreen.rgb + clamp( fNintensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\nif( grayscale ) {\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\n}\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
- screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
- fragment_shader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var b,c,e,g,f=2*Math.ceil(a*3)+1;if(f>25)f=25;g=(f-1)*0.5;c=Array(f);for(b=e=0;b<f;++b){c[b]=Math.exp(-((b-g)*(b-g))/(2*a*a));e+=c[b]}for(b=0;b<f;++b)c[b]/=e;return c}},Cube=function(a,b,c,e,g,f,h,k){function j(A,E,v,F,p,M,d,aa){var O,K,X=e||1,Q=g||1,U=X+1,V=Q+1,H=p/2,Y=M/2;p=p/X;var ea=M/Q,Z=m.vertices.length;if(A=="x"&&E=="y"||A=="y"&&E=="x")O="z";else if(A=="x"&&E=="z"||A=="z"&&E=="x")O="y";
- else if(A=="z"&&E=="y"||A=="y"&&E=="z")O="x";for(K=0;K<V;K++)for(M=0;M<U;M++){var fa=new THREE.Vector3;fa[A]=(M*p-H)*v;fa[E]=(K*ea-Y)*F;fa[O]=d;m.vertices.push(new THREE.Vertex(fa))}for(K=0;K<Q;K++)for(M=0;M<X;M++){m.faces.push(new THREE.Face4(M+U*K+Z,M+U*(K+1)+Z,M+1+U*(K+1)+Z,M+1+U*K+Z,null,aa));m.uvs.push([new THREE.UV(M/X,K/Q),new THREE.UV(M/X,(K+1)/Q),new THREE.UV((M+1)/X,(K+1)/Q),new THREE.UV((M+1)/X,K/Q)])}}THREE.Geometry.call(this);var m=this,q=a/2,w=b/2,u=c/2;h=h?-1:1;if(f!==undefined)if(f instanceof
- Array)this.materials=f;else{this.materials=[];for(var t=0;t<6;t++)this.materials.push([f])}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(k!=undefined)for(var x in k)if(this.sides[x]!=undefined)this.sides[x]=k[x];this.sides.px&&j("z","y",1*h,-1,c,b,-q,this.materials[0]);this.sides.nx&&j("z","y",-1*h,-1,c,b,q,this.materials[1]);this.sides.py&&j("x","z",1*h,1,a,c,w,this.materials[2]);this.sides.ny&&j("x","z",1*h,-1,a,c,-w,this.materials[3]);this.sides.pz&&j("x",
- "y",1*h,-1,a,b,u,this.materials[4]);this.sides.nz&&j("x","y",-1*h,-1,a,b,-u,this.materials[5]);(function(){for(var A=[],E=[],v=0,F=m.vertices.length;v<F;v++){for(var p=m.vertices[v],M=false,d=0,aa=A.length;d<aa;d++){var O=A[d];if(p.position.x==O.position.x&&p.position.y==O.position.y&&p.position.z==O.position.z){E[v]=d;M=true;break}}if(!M){E[v]=A.length;A.push(new THREE.Vertex(p.position.clone()))}}v=0;for(F=m.faces.length;v<F;v++){p=m.faces[v];p.a=E[p.a];p.b=E[p.b];p.c=E[p.c];p.d=E[p.d]}m.vertices=
- A})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
- var Cylinder=function(a,b,c,e,g){function f(m,q,w){h.vertices.push(new THREE.Vertex(new THREE.Vector3(m,q,w)))}THREE.Geometry.call(this);var h=this,k=Math.PI,j;for(j=0;j<a;j++)f(Math.sin(2*k*j/a)*b,Math.cos(2*k*j/a)*b,0);for(j=0;j<a;j++)f(Math.sin(2*k*j/a)*c,Math.cos(2*k*j/a)*c,e);for(j=0;j<a;j++)h.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(c!=0){f(0,0,-g);for(j=a;j<a+a/2;j++)h.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b!=0){f(0,0,e+g);for(j=a+a/2;j<
- 2*a;j++)h.faces.push(new THREE.Face4((2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
- var Plane=function(a,b,c,e){THREE.Geometry.call(this);var g,f=a/2,h=b/2;c=c||1;e=e||1;var k=c+1,j=e+1;a=a/c;var m=b/e;for(g=0;g<j;g++)for(b=0;b<k;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-f,-(g*m-h),0)));for(g=0;g<e;g++)for(b=0;b<c;b++){this.faces.push(new THREE.Face4(b+k*g,b+k*(g+1),b+1+k*(g+1),b+1+k*g));this.uvs.push([new THREE.UV(b/c,g/e),new THREE.UV(b/c,(g+1)/e),new THREE.UV((b+1)/c,(g+1)/e),new THREE.UV((b+1)/c,g/e)])}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
- Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
- var Sphere=function(a,b,c){THREE.Geometry.call(this);var e,g=Math.PI,f=Math.max(3,b||8),h=Math.max(2,c||6);b=[];for(c=0;c<h+1;c++){e=c/h;var k=a*Math.cos(e*g),j=a*Math.sin(e*g),m=[],q=0;for(e=0;e<f;e++){var w=2*e/f,u=j*Math.sin(w*g);w=j*Math.cos(w*g);(c==0||c==h)&&e>0||(q=this.vertices.push(new THREE.Vertex(new THREE.Vector3(w,k,u)))-1);m.push(q)}b.push(m)}var t,x,A;g=b.length;for(c=0;c<g;c++){f=b[c].length;if(c>0)for(e=0;e<f;e++){m=e==f-1;h=b[c][m?0:e+1];k=b[c][m?f-1:e];j=b[c-1][m?f-1:e];m=b[c-1][m?
- 0:e+1];u=c/(g-1);t=(c-1)/(g-1);x=(e+1)/f;w=e/f;q=new THREE.UV(1-x,u);u=new THREE.UV(1-w,u);w=new THREE.UV(1-w,t);var E=new THREE.UV(1-x,t);if(c<b.length-1){t=this.vertices[h].position.clone();x=this.vertices[k].position.clone();A=this.vertices[j].position.clone();t.normalize();x.normalize();A.normalize();this.faces.push(new THREE.Face3(h,k,j,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([q,u,w])}if(c>1){t=this.vertices[h].position.clone();
- x=this.vertices[j].position.clone();A=this.vertices[m].position.clone();t.normalize();x.normalize();A.normalize();this.faces.push(new THREE.Face3(h,j,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(A.x,A.y,A.z)]));this.uvs.push([q,w,E])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
- var Torus=function(a,b,c,e){this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(c=0;c<=this.segmentsT;++c){e=c/this.segmentsT*2*Math.PI;var g=b/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(e),(this.radius+this.tube*Math.cos(g))*Math.sin(e),this.tube*Math.sin(g))));a.push([c/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(c=
- 1;c<=this.segmentsT;++c){e=(this.segmentsT+1)*b+c;g=(this.segmentsT+1)*b+c-1;var f=(this.segmentsT+1)*(b-1)+c-1,h=(this.segmentsT+1)*(b-1)+c;this.faces.push(new THREE.Face4(e,g,f,h));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[f][0],a[f][1]),new THREE.UV(a[h][0],a[h][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
- var Icosahedron=function(a){function b(w,u,t){var x=Math.sqrt(w*w+u*u+t*t);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(w/x,u/x,t/x)))-1}function c(w,u,t,x){x.faces.push(new THREE.Face3(w,u,t))}function e(w,u){var t=g.vertices[w].position,x=g.vertices[u].position;return b((t.x+x.x)/2,(t.y+x.y)/2,(t.z+x.z)/2)}var g=this,f=new THREE.Geometry,h;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,
- 1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,f);c(0,5,1,f);c(0,1,7,f);c(0,7,10,f);c(0,10,11,f);c(1,5,9,f);c(5,11,4,f);c(11,10,2,f);c(10,7,6,f);c(7,1,8,f);c(3,9,4,f);c(3,4,2,f);c(3,2,6,f);c(3,6,8,f);c(3,8,9,f);c(4,9,5,f);c(2,4,11,f);c(6,2,10,f);c(8,6,7,f);c(9,8,1,f);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var k in f.faces){var j=e(f.faces[k].a,f.faces[k].b),m=e(f.faces[k].b,f.faces[k].c),q=e(f.faces[k].c,f.faces[k].a);c(f.faces[k].a,j,q,h);c(f.faces[k].b,m,j,h);c(f.faces[k].c,
- q,m,h);c(j,m,q,h)}f.faces=h.faces}g.faces=f.faces;delete f;delete h;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
- function LathedObject(a,b,c){THREE.Geometry.call(this);b=b||12;c=c||2*Math.PI;b=c/b;for(var e=[],g=[],f=[],h=[],k=0;k<a.length;k++){this.vertices.push(new THREE.Vertex(a[k]));g[k]=this.vertices.length-1;e[k]=new THREE.Vector3(a[k].x,a[k].y,a[k].z)}for(var j=THREE.Matrix4.rotationZMatrix(b),m=0;m<=c+0.0010;m+=b){for(k=0;k<e.length;k++)if(m<c){e[k]=j.multiplyVector3(e[k].clone());this.vertices.push(new THREE.Vertex(e[k]));f[k]=this.vertices.length-1}else f=h;if(m==0)h=g;for(k=0;k<g.length-1;k++){this.faces.push(new THREE.Face4(f[k],
- f[k+1],g[k+1],g[k]));this.uvs.push([new THREE.UV(m/c,k/a.length),new THREE.UV(m/c,(k+1)/a.length),new THREE.UV((m-b)/c,(k+1)/a.length),new THREE.UV((m-b)/c,k/a.length)])}g=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;if(!window.Int32Array){window.Int32Array=Array;window.Float32Array=Array}
- THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b];this.init=function(c){this.isolation=80;this.size=c;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=true;this.maxCount=4096;this.count=
- 0;this.hasNormal=this.hasPos=false;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(c,e,g){return c+(e-c)*g};this.VIntX=function(c,e,g,f,h,k,j,m,q,w){h=(h-q)/(w-q);q=this.normal_cache;e[f]=k+h*this.delta;e[f+1]=j;e[f+2]=m;g[f]=this.lerp(q[c],q[c+3],h);g[f+1]=this.lerp(q[c+1],q[c+4],h);g[f+2]=this.lerp(q[c+2],q[c+5],h)};this.VIntY=function(c,e,g,f,h,k,j,m,q,w){h=(h-q)/(w-q);q=this.normal_cache;e[f]=k;e[f+1]=j+h*this.delta;e[f+
- 2]=m;e=c+this.yd*3;g[f]=this.lerp(q[c],q[e],h);g[f+1]=this.lerp(q[c+1],q[e+1],h);g[f+2]=this.lerp(q[c+2],q[e+2],h)};this.VIntZ=function(c,e,g,f,h,k,j,m,q,w){h=(h-q)/(w-q);q=this.normal_cache;e[f]=k;e[f+1]=j;e[f+2]=m+h*this.delta;e=c+this.zd*3;g[f]=this.lerp(q[c],q[e],h);g[f+1]=this.lerp(q[c+1],q[e+1],h);g[f+2]=this.lerp(q[c+2],q[e+2],h)};this.compNorm=function(c){var e=c*3;if(this.normal_cache[e]==0){this.normal_cache[e]=this.field[c-1]-this.field[c+1];this.normal_cache[e+1]=this.field[c-this.yd]-
- this.field[c+this.yd];this.normal_cache[e+2]=this.field[c-this.zd]-this.field[c+this.zd]}};this.polygonize=function(c,e,g,f,h,k){var j=f+1,m=f+this.yd,q=f+this.zd,w=j+this.yd,u=j+this.zd,t=f+this.yd+this.zd,x=j+this.yd+this.zd,A=0,E=this.field[f],v=this.field[j],F=this.field[m],p=this.field[w],M=this.field[q],d=this.field[u],aa=this.field[t],O=this.field[x];if(E<h)A|=1;if(v<h)A|=2;if(F<h)A|=8;if(p<h)A|=4;if(M<h)A|=16;if(d<h)A|=32;if(aa<h)A|=128;if(O<h)A|=64;var K=THREE.edgeTable[A];if(K==0)return 0;
- var X=this.delta,Q=c+X,U=e+X;X=g+X;if(K&1){this.compNorm(f);this.compNorm(j);this.VIntX(f*3,this.vlist,this.nlist,0,h,c,e,g,E,v)}if(K&2){this.compNorm(j);this.compNorm(w);this.VIntY(j*3,this.vlist,this.nlist,3,h,Q,e,g,v,p)}if(K&4){this.compNorm(m);this.compNorm(w);this.VIntX(m*3,this.vlist,this.nlist,6,h,c,U,g,F,p)}if(K&8){this.compNorm(f);this.compNorm(m);this.VIntY(f*3,this.vlist,this.nlist,9,h,c,e,g,E,F)}if(K&16){this.compNorm(q);this.compNorm(u);this.VIntX(q*3,this.vlist,this.nlist,12,h,c,e,X,
- M,d)}if(K&32){this.compNorm(u);this.compNorm(x);this.VIntY(u*3,this.vlist,this.nlist,15,h,Q,e,X,d,O)}if(K&64){this.compNorm(t);this.compNorm(x);this.VIntX(t*3,this.vlist,this.nlist,18,h,c,U,X,aa,O)}if(K&128){this.compNorm(q);this.compNorm(t);this.VIntY(q*3,this.vlist,this.nlist,21,h,c,e,X,M,aa)}if(K&256){this.compNorm(f);this.compNorm(q);this.VIntZ(f*3,this.vlist,this.nlist,24,h,c,e,g,E,M)}if(K&512){this.compNorm(j);this.compNorm(u);this.VIntZ(j*3,this.vlist,this.nlist,27,h,Q,e,g,v,d)}if(K&1024){this.compNorm(w);
- this.compNorm(x);this.VIntZ(w*3,this.vlist,this.nlist,30,h,Q,U,g,p,O)}if(K&2048){this.compNorm(m);this.compNorm(t);this.VIntZ(m*3,this.vlist,this.nlist,33,h,c,U,g,F,aa)}A<<=4;for(h=f=0;THREE.triTable[A+h]!=-1;){c=A+h;e=c+1;g=c+2;this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[c],3*THREE.triTable[e],3*THREE.triTable[g],k);h+=3;f++}return f};this.posnormtriv=function(c,e,g,f,h,k){var j=this.count*3;this.positionArray[j]=c[g];this.positionArray[j+1]=c[g+1];this.positionArray[j+2]=c[g+2];this.positionArray[j+
- 3]=c[f];this.positionArray[j+4]=c[f+1];this.positionArray[j+5]=c[f+2];this.positionArray[j+6]=c[h];this.positionArray[j+7]=c[h+1];this.positionArray[j+8]=c[h+2];this.normalArray[j]=e[g];this.normalArray[j+1]=e[g+1];this.normalArray[j+2]=e[g+2];this.normalArray[j+3]=e[f];this.normalArray[j+4]=e[f+1];this.normalArray[j+5]=e[f+2];this.normalArray[j+6]=e[h];this.normalArray[j+7]=e[h+1];this.normalArray[j+8]=e[h+2];this.hasNormal=this.hasPos=true;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=
- function(){this.count=0;this.hasNormal=this.hasPos=false};this.end=function(c){if(this.count!=0){for(var e=this.count*3;e<this.positionArray.length;e++)this.positionArray[e]=0;c(this)}};this.addBall=function(c,e,g,f,h){var k=this.size*Math.sqrt(f/h),j=g*this.size,m=e*this.size,q=c*this.size,w=Math.floor(j-k);if(w<1)w=1;j=Math.floor(j+k);if(j>this.size-1)j=this.size-1;var u=Math.floor(m-k);if(u<1)u=1;m=Math.floor(m+k);if(m>this.size-1)m=this.size-1;var t=Math.floor(q-k);if(t<1)t=1;k=Math.floor(q+k);
- if(k>this.size-1)k=this.size-1;var x,A,E,v,F,p;for(w=w;w<j;w++){q=this.size2*w;A=w/this.size-g;F=A*A;for(A=u;A<m;A++){E=q+this.size*A;x=A/this.size-e;p=x*x;for(x=t;x<k;x++){v=x/this.size-c;v=f/(1.0E-6+v*v+p+F)-h;if(v>0)this.field[E+x]+=v}}}};this.addPlaneX=function(c,e){var g,f,h,k,j,m=this.size,q=this.yd,w=this.zd,u=this.field,t=m*Math.sqrt(c/e);if(t>m)t=m;for(g=0;g<t;g++){f=g/m;f=f*f;k=c/(1.0E-4+f)-e;if(k>0)for(f=0;f<m;f++){j=g+f*q;for(h=0;h<m;h++)u[w*h+j]+=k}}};this.addPlaneY=function(c,e){var g,
- f,h,k,j,m,q=this.size,w=this.yd,u=this.zd,t=this.field,x=q*Math.sqrt(c/e);if(x>q)x=q;for(f=0;f<x;f++){g=f/q;g=g*g;k=c/(1.0E-4+g)-e;if(k>0){j=f*w;for(g=0;g<q;g++){m=j+g;for(h=0;h<q;h++)t[u*h+m]+=k}}}};this.addPlaneZ=function(c,e){var g,f,h,k,j,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(c/e);if(dist>size)dist=size;for(h=0;h<dist;h++){g=h/size;g=g*g;k=c/(1.0E-4+g)-e;if(k>0){j=zd*h;for(f=0;f<size;f++){m=j+f*yd;for(g=0;g<size;g++)field[m+g]+=k}}}};this.reset=function(){var c;
- for(c=0;c<this.size3;c++){this.normal_cache[c*3]=0;this.field[c]=0}};this.render=function(c){this.begin();var e,g,f,h,k,j,m,q,w,u=this.size-2;for(h=1;h<u;h++){w=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(f=1;f<u;f++){q=w+this.size*f;j=(f-this.halfsize)/this.halfsize;for(g=1;g<u;g++){k=(g-this.halfsize)/this.halfsize;e=q+g;this.polygonize(k,j,m,e,this.isolation,c)}}}this.end(c)};this.generateGeometry=function(){var c=0,e=new THREE.Geometry;this.render(function(g){var f,h,k,j,m,q,w,u;for(f=
- 0;f<g.count;f++){m=f*3;w=m+1;u=m+2;h=g.positionArray[m];k=g.positionArray[w];j=g.positionArray[u];q=new THREE.Vector3(h,k,j);h=g.normalArray[m];k=g.normalArray[w];j=g.normalArray[u];m=new THREE.Vector3(h,k,j);m.normalize();m=new THREE.Vertex(q,m);e.vertices.push(m)}nfaces=g.count/3;for(f=0;f<nfaces;f++){m=(c+f)*3;w=m+1;u=m+2;q=e.vertices[m].normal;h=e.vertices[w].normal;k=e.vertices[u].normal;m=new THREE.Face3(m,w,u,[q,h,k]);e.faces.push(m)}c+=nfaces;g.count=0});e.sortFacesByMaterial();return e};
- this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
- THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
- 1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
- 419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
- THREE.triTable=new Int32Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,9,8,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,2,10,0,2,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,8,3,2,10,8,10,9,8,-1,-1,-1,-1,-1,-1,-1,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,8,11,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,11,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,1,11,2,1,9,11,9,8,11,-1,-1,-1,-1,-1,-1,-1,3,10,1,11,10,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,10,1,0,8,10,8,11,10,-1,-1,-1,-1,-1,-1,-1,3,9,0,3,11,9,11,10,9,-1,-1,-1,-1,-1,-1,-1,9,8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,7,3,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,1,9,4,7,1,7,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,8,4,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,4,7,3,0,4,1,2,10,-1,-1,-1,-1,-1,-1,-1,9,2,10,9,0,2,8,4,7,
- -1,-1,-1,-1,-1,-1,-1,2,10,9,2,9,7,2,7,3,7,9,4,-1,-1,-1,-1,8,4,7,3,11,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,4,7,11,2,4,2,0,4,-1,-1,-1,-1,-1,-1,-1,9,0,1,8,4,7,2,3,11,-1,-1,-1,-1,-1,-1,-1,4,7,11,9,4,11,9,11,2,9,2,1,-1,-1,-1,-1,3,10,1,3,11,10,7,8,4,-1,-1,-1,-1,-1,-1,-1,1,11,10,1,4,11,1,0,4,7,11,4,-1,-1,-1,-1,4,7,8,9,0,11,9,11,10,11,0,3,-1,-1,-1,-1,4,7,11,4,11,9,9,11,10,-1,-1,-1,-1,-1,-1,-1,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,5,4,1,5,0,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,8,5,4,8,3,5,3,1,5,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,10,4,9,5,-1,-1,-1,-1,-1,-1,-1,5,2,10,5,4,2,4,0,2,-1,-1,-1,-1,-1,-1,-1,2,10,5,3,2,5,3,5,4,3,4,8,-1,-1,-1,-1,9,5,4,2,3,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,11,2,0,8,11,4,9,5,-1,-1,-1,-1,-1,-1,-1,0,5,4,0,1,5,2,3,11,-1,-1,-1,-1,-1,-1,-1,2,1,5,2,5,8,2,8,11,4,8,5,-1,-1,-1,-1,10,3,11,10,1,3,9,5,4,-1,-1,-1,-1,-1,-1,-1,4,9,5,0,8,1,8,10,1,8,11,10,-1,-1,-1,-1,5,4,0,5,0,11,5,11,10,11,0,3,-1,-1,-1,-1,5,4,8,5,
- 8,10,10,8,11,-1,-1,-1,-1,-1,-1,-1,9,7,8,5,7,9,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,3,0,9,5,3,5,7,3,-1,-1,-1,-1,-1,-1,-1,0,7,8,0,1,7,1,5,7,-1,-1,-1,-1,-1,-1,-1,1,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,7,8,9,5,7,10,1,2,-1,-1,-1,-1,-1,-1,-1,10,1,2,9,5,0,5,3,0,5,7,3,-1,-1,-1,-1,8,0,2,8,2,5,8,5,7,10,5,2,-1,-1,-1,-1,2,10,5,2,5,3,3,5,7,-1,-1,-1,-1,-1,-1,-1,7,9,5,7,8,9,3,11,2,-1,-1,-1,-1,-1,-1,-1,9,5,7,9,7,2,9,2,0,2,7,11,-1,-1,-1,-1,2,3,11,0,1,8,1,7,8,1,5,7,-1,-1,-1,-1,11,2,1,11,1,7,7,1,5,-1,-1,-1,-1,-1,-1,
- -1,9,5,8,8,5,7,10,1,3,10,3,11,-1,-1,-1,-1,5,7,0,5,0,9,7,11,0,1,0,10,11,10,0,-1,11,10,0,11,0,3,10,5,0,8,0,7,5,7,0,-1,11,10,5,7,11,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,6,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,0,1,5,10,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,8,3,1,9,8,5,10,6,-1,-1,-1,-1,-1,-1,-1,1,6,5,2,6,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,6,5,1,2,6,3,0,8,-1,-1,-1,-1,-1,-1,-1,9,6,5,9,0,6,0,2,6,-1,-1,-1,-1,-1,-1,-1,5,9,8,5,8,2,5,2,6,3,2,8,-1,-1,-1,-1,2,3,11,10,6,
- 5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,0,8,11,2,0,10,6,5,-1,-1,-1,-1,-1,-1,-1,0,1,9,2,3,11,5,10,6,-1,-1,-1,-1,-1,-1,-1,5,10,6,1,9,2,9,11,2,9,8,11,-1,-1,-1,-1,6,3,11,6,5,3,5,1,3,-1,-1,-1,-1,-1,-1,-1,0,8,11,0,11,5,0,5,1,5,11,6,-1,-1,-1,-1,3,11,6,0,3,6,0,6,5,0,5,9,-1,-1,-1,-1,6,5,9,6,9,11,11,9,8,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,3,0,4,7,3,6,5,10,-1,-1,-1,-1,-1,-1,-1,1,9,0,5,10,6,8,4,7,-1,-1,-1,-1,-1,-1,-1,10,6,5,1,9,7,1,7,3,7,9,4,-1,-1,-1,-1,6,1,2,6,5,1,4,7,8,-1,-1,-1,-1,
- -1,-1,-1,1,2,5,5,2,6,3,0,4,3,4,7,-1,-1,-1,-1,8,4,7,9,0,5,0,6,5,0,2,6,-1,-1,-1,-1,7,3,9,7,9,4,3,2,9,5,9,6,2,6,9,-1,3,11,2,7,8,4,10,6,5,-1,-1,-1,-1,-1,-1,-1,5,10,6,4,7,2,4,2,0,2,7,11,-1,-1,-1,-1,0,1,9,4,7,8,2,3,11,5,10,6,-1,-1,-1,-1,9,2,1,9,11,2,9,4,11,7,11,4,5,10,6,-1,8,4,7,3,11,5,3,5,1,5,11,6,-1,-1,-1,-1,5,1,11,5,11,6,1,0,11,7,11,4,0,4,11,-1,0,5,9,0,6,5,0,3,6,11,6,3,8,4,7,-1,6,5,9,6,9,11,4,7,9,7,11,9,-1,-1,-1,-1,10,4,9,6,4,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,10,6,4,9,10,0,8,3,-1,-1,-1,-1,-1,-1,-1,
- 10,0,1,10,6,0,6,4,0,-1,-1,-1,-1,-1,-1,-1,8,3,1,8,1,6,8,6,4,6,1,10,-1,-1,-1,-1,1,4,9,1,2,4,2,6,4,-1,-1,-1,-1,-1,-1,-1,3,0,8,1,2,9,2,4,9,2,6,4,-1,-1,-1,-1,0,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,3,2,8,2,4,4,2,6,-1,-1,-1,-1,-1,-1,-1,10,4,9,10,6,4,11,2,3,-1,-1,-1,-1,-1,-1,-1,0,8,2,2,8,11,4,9,10,4,10,6,-1,-1,-1,-1,3,11,2,0,1,6,0,6,4,6,1,10,-1,-1,-1,-1,6,4,1,6,1,10,4,8,1,2,1,11,8,11,1,-1,9,6,4,9,3,6,9,1,3,11,6,3,-1,-1,-1,-1,8,11,1,8,1,0,11,6,1,9,1,4,6,4,1,-1,3,11,6,3,6,0,0,6,4,-1,-1,-1,-1,-1,-1,-1,
- 6,4,8,11,6,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,10,6,7,8,10,8,9,10,-1,-1,-1,-1,-1,-1,-1,0,7,3,0,10,7,0,9,10,6,7,10,-1,-1,-1,-1,10,6,7,1,10,7,1,7,8,1,8,0,-1,-1,-1,-1,10,6,7,10,7,1,1,7,3,-1,-1,-1,-1,-1,-1,-1,1,2,6,1,6,8,1,8,9,8,6,7,-1,-1,-1,-1,2,6,9,2,9,1,6,7,9,0,9,3,7,3,9,-1,7,8,0,7,0,6,6,0,2,-1,-1,-1,-1,-1,-1,-1,7,3,2,6,7,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,11,10,6,8,10,8,9,8,6,7,-1,-1,-1,-1,2,0,7,2,7,11,0,9,7,6,7,10,9,10,7,-1,1,8,0,1,7,8,1,10,7,6,7,10,2,3,11,-1,11,2,1,11,1,7,10,6,1,6,7,1,-1,-1,-1,-1,
- 8,9,6,8,6,7,9,1,6,11,6,3,1,3,6,-1,0,9,1,11,6,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,8,0,7,0,6,3,11,0,11,6,0,-1,-1,-1,-1,7,11,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,8,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,9,11,7,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,1,9,8,3,1,11,7,6,-1,-1,-1,-1,-1,-1,-1,10,1,2,6,11,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,10,3,0,8,6,11,7,-1,-1,-1,-1,-1,-1,-1,2,9,0,2,10,9,6,11,7,-1,-1,-1,-1,-1,-1,-1,6,11,7,2,10,3,10,8,3,10,9,8,-1,-1,-1,-1,7,
- 2,3,6,2,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7,0,8,7,6,0,6,2,0,-1,-1,-1,-1,-1,-1,-1,2,7,6,2,3,7,0,1,9,-1,-1,-1,-1,-1,-1,-1,1,6,2,1,8,6,1,9,8,8,7,6,-1,-1,-1,-1,10,7,6,10,1,7,1,3,7,-1,-1,-1,-1,-1,-1,-1,10,7,6,1,7,10,1,8,7,1,0,8,-1,-1,-1,-1,0,3,7,0,7,10,0,10,9,6,10,7,-1,-1,-1,-1,7,6,10,7,10,8,8,10,9,-1,-1,-1,-1,-1,-1,-1,6,8,4,11,8,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,6,11,3,0,6,0,4,6,-1,-1,-1,-1,-1,-1,-1,8,6,11,8,4,6,9,0,1,-1,-1,-1,-1,-1,-1,-1,9,4,6,9,6,3,9,3,1,11,3,6,-1,-1,-1,-1,6,8,4,6,11,8,2,10,1,-1,-1,-1,
- -1,-1,-1,-1,1,2,10,3,0,11,0,6,11,0,4,6,-1,-1,-1,-1,4,11,8,4,6,11,0,2,9,2,10,9,-1,-1,-1,-1,10,9,3,10,3,2,9,4,3,11,3,6,4,6,3,-1,8,2,3,8,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,0,4,2,4,6,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,9,0,2,3,4,2,4,6,4,3,8,-1,-1,-1,-1,1,9,4,1,4,2,2,4,6,-1,-1,-1,-1,-1,-1,-1,8,1,3,8,6,1,8,4,6,6,10,1,-1,-1,-1,-1,10,1,0,10,0,6,6,0,4,-1,-1,-1,-1,-1,-1,-1,4,6,3,4,3,8,6,10,3,0,3,9,10,9,3,-1,10,9,4,6,10,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,5,7,6,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,5,11,7,6,
- -1,-1,-1,-1,-1,-1,-1,5,0,1,5,4,0,7,6,11,-1,-1,-1,-1,-1,-1,-1,11,7,6,8,3,4,3,5,4,3,1,5,-1,-1,-1,-1,9,5,4,10,1,2,7,6,11,-1,-1,-1,-1,-1,-1,-1,6,11,7,1,2,10,0,8,3,4,9,5,-1,-1,-1,-1,7,6,11,5,4,10,4,2,10,4,0,2,-1,-1,-1,-1,3,4,8,3,5,4,3,2,5,10,5,2,11,7,6,-1,7,2,3,7,6,2,5,4,9,-1,-1,-1,-1,-1,-1,-1,9,5,4,0,8,6,0,6,2,6,8,7,-1,-1,-1,-1,3,6,2,3,7,6,1,5,0,5,4,0,-1,-1,-1,-1,6,2,8,6,8,7,2,1,8,4,8,5,1,5,8,-1,9,5,4,10,1,6,1,7,6,1,3,7,-1,-1,-1,-1,1,6,10,1,7,6,1,0,7,8,7,0,9,5,4,-1,4,0,10,4,10,5,0,3,10,6,10,7,3,7,10,
- -1,7,6,10,7,10,8,5,4,10,4,8,10,-1,-1,-1,-1,6,9,5,6,11,9,11,8,9,-1,-1,-1,-1,-1,-1,-1,3,6,11,0,6,3,0,5,6,0,9,5,-1,-1,-1,-1,0,11,8,0,5,11,0,1,5,5,6,11,-1,-1,-1,-1,6,11,3,6,3,5,5,3,1,-1,-1,-1,-1,-1,-1,-1,1,2,10,9,5,11,9,11,8,11,5,6,-1,-1,-1,-1,0,11,3,0,6,11,0,9,6,5,6,9,1,2,10,-1,11,8,5,11,5,6,8,0,5,10,5,2,0,2,5,-1,6,11,3,6,3,5,2,10,3,10,5,3,-1,-1,-1,-1,5,8,9,5,2,8,5,6,2,3,8,2,-1,-1,-1,-1,9,5,6,9,6,0,0,6,2,-1,-1,-1,-1,-1,-1,-1,1,5,8,1,8,0,5,6,8,3,8,2,6,2,8,-1,1,5,6,2,1,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- 1,3,6,1,6,10,3,8,6,5,6,9,8,9,6,-1,10,1,0,10,0,6,9,5,0,5,6,0,-1,-1,-1,-1,0,3,8,5,6,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,5,6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,7,5,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,11,5,10,11,7,5,8,3,0,-1,-1,-1,-1,-1,-1,-1,5,11,7,5,10,11,1,9,0,-1,-1,-1,-1,-1,-1,-1,10,7,5,10,11,7,9,8,1,8,3,1,-1,-1,-1,-1,11,1,2,11,7,1,7,5,1,-1,-1,-1,-1,-1,-1,-1,0,8,3,1,2,7,1,7,5,7,2,11,-1,-1,-1,-1,9,7,5,9,2,7,9,0,2,2,11,7,-1,-1,-1,-1,7,5,2,7,2,11,5,9,2,3,2,8,9,8,2,-1,2,5,10,2,3,5,3,7,5,-1,-1,
- -1,-1,-1,-1,-1,8,2,0,8,5,2,8,7,5,10,2,5,-1,-1,-1,-1,9,0,1,5,10,3,5,3,7,3,10,2,-1,-1,-1,-1,9,8,2,9,2,1,8,7,2,10,2,5,7,5,2,-1,1,3,5,3,7,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,8,7,0,7,1,1,7,5,-1,-1,-1,-1,-1,-1,-1,9,0,3,9,3,5,5,3,7,-1,-1,-1,-1,-1,-1,-1,9,8,7,5,9,7,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5,8,4,5,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,5,0,4,5,11,0,5,10,11,11,3,0,-1,-1,-1,-1,0,1,9,8,4,10,8,10,11,10,4,5,-1,-1,-1,-1,10,11,4,10,4,5,11,3,4,9,4,1,3,1,4,-1,2,5,1,2,8,5,2,11,8,4,5,8,-1,-1,-1,-1,0,4,11,0,11,3,4,5,11,
- 2,11,1,5,1,11,-1,0,2,5,0,5,9,2,11,5,4,5,8,11,8,5,-1,9,4,5,2,11,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,5,10,3,5,2,3,4,5,3,8,4,-1,-1,-1,-1,5,10,2,5,2,4,4,2,0,-1,-1,-1,-1,-1,-1,-1,3,10,2,3,5,10,3,8,5,4,5,8,0,1,9,-1,5,10,2,5,2,4,1,9,2,9,4,2,-1,-1,-1,-1,8,4,5,8,5,3,3,5,1,-1,-1,-1,-1,-1,-1,-1,0,4,5,1,0,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8,4,5,8,5,3,9,0,5,0,3,5,-1,-1,-1,-1,9,4,5,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,11,7,4,9,11,9,10,11,-1,-1,-1,-1,-1,-1,-1,0,8,3,4,9,7,9,11,7,9,10,11,-1,-1,-1,-1,1,10,11,1,11,
- 4,1,4,0,7,4,11,-1,-1,-1,-1,3,1,4,3,4,8,1,10,4,7,4,11,10,11,4,-1,4,11,7,9,11,4,9,2,11,9,1,2,-1,-1,-1,-1,9,7,4,9,11,7,9,1,11,2,11,1,0,8,3,-1,11,7,4,11,4,2,2,4,0,-1,-1,-1,-1,-1,-1,-1,11,7,4,11,4,2,8,3,4,3,2,4,-1,-1,-1,-1,2,9,10,2,7,9,2,3,7,7,4,9,-1,-1,-1,-1,9,10,7,9,7,4,10,2,7,8,7,0,2,0,7,-1,3,7,10,3,10,2,7,4,10,1,10,0,4,0,10,-1,1,10,2,8,7,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,7,1,3,-1,-1,-1,-1,-1,-1,-1,4,9,1,4,1,7,0,8,1,8,7,1,-1,-1,-1,-1,4,0,3,7,4,3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4,8,7,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,9,10,8,10,11,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,11,9,10,-1,-1,-1,-1,-1,-1,-1,0,1,10,0,10,8,8,10,11,-1,-1,-1,-1,-1,-1,-1,3,1,10,11,3,10,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,2,11,1,11,9,9,11,8,-1,-1,-1,-1,-1,-1,-1,3,0,9,3,9,11,1,2,9,2,11,9,-1,-1,-1,-1,0,2,11,8,0,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3,2,11,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,10,8,9,-1,-1,-1,-1,-1,-1,-1,9,10,2,0,9,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,3,8,2,8,10,0,1,8,1,10,8,-1,-1,-1,-1,1,10,
- 2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1,3,8,9,1,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,9,1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,3,8,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?this.addStatusElement():null};
- THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
- b},loadAsciiOld:function(a,b){var c=document.createElement("script");c.type="text/javascript";c.onload=b;c.src=a;document.getElementsByTagName("head")[0].appendChild(c)},loadAscii:function(a){var b=a.model,c=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);b.onmessage=function(g){THREE.Loader.prototype.createModel(g.data,c,e)};b.postMessage(a)},loadBinary:function(a){var b=a.model,c=a.callback,e=a.texture_path?a.texture_path:
- THREE.Loader.prototype.extractUrlbase(b),g=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(b);a=(new Date).getTime();b=new Worker(b);var f=this.showProgress?THREE.Loader.prototype.updateProgress:null;b.onmessage=function(h){THREE.Loader.prototype.loadAjaxBuffers(h.data.buffers,h.data.materials,c,g,e,f)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,c,e,g,f){var h=new XMLHttpRequest,k=e+"/"+a,j=0;
- h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,c,g,b):alert("Couldn't load ["+k+"] ["+h.status+"]");else if(h.readyState==3){if(f){if(j==0)j=h.getResponseHeader("Content-Length");f({total:j,loaded:h.responseText.length})}}else if(h.readyState==2)j=h.getResponseHeader("Content-Length")};h.open("GET",k,true);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
- createBinModel:function(a,b,c,e){var g=function(f){function h(C,L){var J=q(C,L),R=q(C,L+1),W=q(C,L+2),la=q(C,L+3),S=(la<<1&255|W>>7)-127;J=(W&127)<<16|R<<8|J;if(J==0&&S==-127)return 0;return(1-2*(la>>7))*(1+J*Math.pow(2,-23))*Math.pow(2,S)}function k(C,L){var J=q(C,L),R=q(C,L+1),W=q(C,L+2);return(q(C,L+3)<<24)+(W<<16)+(R<<8)+J}function j(C,L){var J=q(C,L);return(q(C,L+1)<<8)+J}function m(C,L){var J=q(C,L);return J>127?J-256:J}function q(C,L){return C.charCodeAt(L)&255}function w(C){var L,J,R;L=k(a,
- C);J=k(a,C+aa);R=k(a,C+O);C=j(a,C+K);THREE.Loader.prototype.f3(v,L,J,R,C)}function u(C){var L,J,R,W,la,S;L=k(a,C);J=k(a,C+aa);R=k(a,C+O);W=j(a,C+K);la=k(a,C+X);S=k(a,C+Q);C=k(a,C+U);THREE.Loader.prototype.f3n(v,M,L,J,R,W,la,S,C)}function t(C){var L,J,R,W;L=k(a,C);J=k(a,C+V);R=k(a,C+H);W=k(a,C+Y);C=j(a,C+ea);THREE.Loader.prototype.f4(v,L,J,R,W,C)}function x(C){var L,J,R,W,la,S,ta,sa;L=k(a,C);J=k(a,C+V);R=k(a,C+H);W=k(a,C+Y);la=j(a,C+ea);S=k(a,C+Z);ta=k(a,C+fa);sa=k(a,C+ia);C=k(a,C+l);THREE.Loader.prototype.f4n(v,
- M,L,J,R,W,la,S,ta,sa,C)}function A(C){var L,J;L=k(a,C);J=k(a,C+y);C=k(a,C+B);THREE.Loader.prototype.uv3(v.uvs,d[L*2],d[L*2+1],d[J*2],d[J*2+1],d[C*2],d[C*2+1])}function E(C){var L,J,R;L=k(a,C);J=k(a,C+o);R=k(a,C+n);C=k(a,C+N);THREE.Loader.prototype.uv4(v.uvs,d[L*2],d[L*2+1],d[J*2],d[J*2+1],d[R*2],d[R*2+1],d[C*2],d[C*2+1])}var v=this,F=0,p,M=[],d=[],aa,O,K,X,Q,U,V,H,Y,ea,Z,fa,ia,l,y,B,o,n,N,G,z,I,D,$,da;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,e,f);p={signature:a.substr(F,8),
- header_bytes:q(a,F+8),vertex_coordinate_bytes:q(a,F+9),normal_coordinate_bytes:q(a,F+10),uv_coordinate_bytes:q(a,F+11),vertex_index_bytes:q(a,F+12),normal_index_bytes:q(a,F+13),uv_index_bytes:q(a,F+14),material_index_bytes:q(a,F+15),nvertices:k(a,F+16),nnormals:k(a,F+16+4),nuvs:k(a,F+16+8),ntri_flat:k(a,F+16+12),ntri_smooth:k(a,F+16+16),ntri_flat_uv:k(a,F+16+20),ntri_smooth_uv:k(a,F+16+24),nquad_flat:k(a,F+16+28),nquad_smooth:k(a,F+16+32),nquad_flat_uv:k(a,F+16+36),nquad_smooth_uv:k(a,F+16+40)};F+=
- p.header_bytes;aa=p.vertex_index_bytes;O=p.vertex_index_bytes*2;K=p.vertex_index_bytes*3;X=p.vertex_index_bytes*3+p.material_index_bytes;Q=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes;U=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*2;V=p.vertex_index_bytes;H=p.vertex_index_bytes*2;Y=p.vertex_index_bytes*3;ea=p.vertex_index_bytes*4;Z=p.vertex_index_bytes*4+p.material_index_bytes;fa=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes;ia=p.vertex_index_bytes*
- 4+p.material_index_bytes+p.normal_index_bytes*2;l=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*3;y=p.uv_index_bytes;B=p.uv_index_bytes*2;o=p.uv_index_bytes;n=p.uv_index_bytes*2;N=p.uv_index_bytes*3;f=p.vertex_index_bytes*3+p.material_index_bytes;da=p.vertex_index_bytes*4+p.material_index_bytes;G=p.ntri_flat*f;z=p.ntri_smooth*(f+p.normal_index_bytes*3);I=p.ntri_flat_uv*(f+p.uv_index_bytes*3);D=p.ntri_smooth_uv*(f+p.normal_index_bytes*3+p.uv_index_bytes*3);$=p.nquad_flat*da;f=
- p.nquad_smooth*(da+p.normal_index_bytes*4);da=p.nquad_flat_uv*(da+p.uv_index_bytes*4);F+=function(C){var L,J,R,W=p.vertex_coordinate_bytes*3,la=C+p.nvertices*W;for(C=C;C<la;C+=W){L=h(a,C);J=h(a,C+p.vertex_coordinate_bytes);R=h(a,C+p.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,L,J,R)}return p.nvertices*W}(F);F+=function(C){var L,J,R,W=p.normal_coordinate_bytes*3,la=C+p.nnormals*W;for(C=C;C<la;C+=W){L=m(a,C);J=m(a,C+p.normal_coordinate_bytes);R=m(a,C+p.normal_coordinate_bytes*2);M.push(L/
- 127,J/127,R/127)}return p.nnormals*W}(F);F+=function(C){var L,J,R=p.uv_coordinate_bytes*2,W=C+p.nuvs*R;for(C=C;C<W;C+=R){L=h(a,C);J=h(a,C+p.uv_coordinate_bytes);d.push(L,J)}return p.nuvs*R}(F);F=F;G=F+G;z=G+z;I=z+I;D=I+D;$=D+$;f=$+f;da=f+da;(function(C){var L,J=p.vertex_index_bytes*3+p.material_index_bytes,R=J+p.uv_index_bytes*3,W=C+p.ntri_flat_uv*R;for(L=C;L<W;L+=R){w(L);A(L+J)}return W-C})(z);(function(C){var L,J=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*3,R=J+p.uv_index_bytes*
- 3,W=C+p.ntri_smooth_uv*R;for(L=C;L<W;L+=R){u(L);A(L+J)}return W-C})(I);(function(C){var L,J=p.vertex_index_bytes*4+p.material_index_bytes,R=J+p.uv_index_bytes*4,W=C+p.nquad_flat_uv*R;for(L=C;L<W;L+=R){t(L);E(L+J)}return W-C})(f);(function(C){var L,J=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,R=J+p.uv_index_bytes*4,W=C+p.nquad_smooth_uv*R;for(L=C;L<W;L+=R){x(L);E(L+J)}return W-C})(da);(function(C){var L,J=p.vertex_index_bytes*3+p.material_index_bytes,R=C+p.ntri_flat*J;for(L=
- C;L<R;L+=J)w(L);return R-C})(F);(function(C){var L,J=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*3,R=C+p.ntri_smooth*J;for(L=C;L<R;L+=J)u(L);return R-C})(G);(function(C){var L,J=p.vertex_index_bytes*4+p.material_index_bytes,R=C+p.nquad_flat*J;for(L=C;L<R;L+=J)t(L);return R-C})(D);(function(C){var L,J=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,R=C+p.nquad_smooth*J;for(L=C;L<R;L+=J)x(L);return R-C})($);this.computeCentroids();this.computeFaceNormals();
- this.sortFacesByMaterial()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g(c))},createModel:function(a,b,c){var e=function(g){var f=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(f,a.materials,g);(function(){var h,k,j,m,q;h=0;for(k=a.vertices.length;h<k;h+=3){j=a.vertices[h];m=a.vertices[h+1];q=a.vertices[h+2];THREE.Loader.prototype.v(f,j,m,q)}if(a.colors){h=0;for(k=a.colors.length;h<k;h+=3){j=a.colors[h];m=a.colors[h+1];q=a.colors[h+2];THREE.Loader.prototype.vc(f,
- j,m,q)}}})();(function(){function h(x,A){THREE.Loader.prototype.f3(f,x[A],x[A+1],x[A+2],x[A+3])}function k(x,A){THREE.Loader.prototype.f3n(f,a.normals,x[A],x[A+1],x[A+2],x[A+3],x[A+4],x[A+5],x[A+6])}function j(x,A){THREE.Loader.prototype.f4(f,x[A],x[A+1],x[A+2],x[A+3],x[A+4])}function m(x,A){THREE.Loader.prototype.f4n(f,a.normals,x[A],x[A+1],x[A+2],x[A+3],x[A+4],x[A+5],x[A+6],x[A+7],x[A+8])}function q(x,A){var E,v,F,p,M,d,aa,O,K;E=x[A];v=x[A+1];F=x[A+2];p=a.uvs[E*2];aa=a.uvs[E*2+1];M=a.uvs[v*2];O=
- a.uvs[v*2+1];d=a.uvs[F*2];K=a.uvs[F*2+1];THREE.Loader.prototype.uv3(f.uvs,p,aa,M,O,d,K);if(a.uvs2){p=a.uvs2[E*2];aa=a.uvs2[E*2+1];M=a.uvs2[v*2];O=a.uvs2[v*2+1];d=a.uvs2[F*2];K=a.uvs2[F*2+1];THREE.Loader.prototype.uv3(f.uvs2,p,1-aa,M,1-O,d,1-K)}}function w(x,A){var E,v,F,p,M,d,aa,O,K,X,Q,U;E=x[A];v=x[A+1];F=x[A+2];p=x[A+3];M=a.uvs[E*2];K=a.uvs[E*2+1];d=a.uvs[v*2];X=a.uvs[v*2+1];aa=a.uvs[F*2];Q=a.uvs[F*2+1];O=a.uvs[p*2];U=a.uvs[p*2+1];THREE.Loader.prototype.uv4(f.uvs,M,K,d,X,aa,Q,O,U);if(a.uvs2){M=
- a.uvs2[E*2];K=a.uvs2[E*2+1];d=a.uvs2[v*2];X=a.uvs2[v*2+1];aa=a.uvs2[F*2];Q=a.uvs2[F*2+1];O=a.uvs2[p*2];U=a.uvs2[p*2+1];THREE.Loader.prototype.uv4(f.uvs2,M,1-K,d,1-X,aa,1-Q,O,1-U)}}var u,t;u=0;for(t=a.triangles_uv.length;u<t;u+=7){h(a.triangles_uv,u);q(a.triangles_uv,u+4)}u=0;for(t=a.triangles_n_uv.length;u<t;u+=10){k(a.triangles_n_uv,u);q(a.triangles_n_uv,u+7)}u=0;for(t=a.quads_uv.length;u<t;u+=9){j(a.quads_uv,u);w(a.quads_uv,u+5)}u=0;for(t=a.quads_n_uv.length;u<t;u+=13){m(a.quads_n_uv,u);w(a.quads_n_uv,
- u+9)}u=0;for(t=a.triangles.length;u<t;u+=4)h(a.triangles,u);u=0;for(t=a.triangles_n.length;u<t;u+=7)k(a.triangles_n,u);u=0;for(t=a.quads.length;u<t;u+=5)j(a.quads,u);u=0;for(t=a.quads_n.length;u<t;u+=9)m(a.quads_n,u)})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))},v:function(a,b,c,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))},vc:function(a,b,c,e){var g=new THREE.Color(16777215);
- g.setRGB(b,c,e);a.colors.push(g)},f3:function(a,b,c,e,g){a.faces.push(new THREE.Face3(b,c,e,null,a.materials[g]))},f4:function(a,b,c,e,g,f){a.faces.push(new THREE.Face4(b,c,e,g,null,a.materials[f]))},f3n:function(a,b,c,e,g,f,h,k,j){f=a.materials[f];var m=b[k*3],q=b[k*3+1];k=b[k*3+2];var w=b[j*3],u=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(c,e,g,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(m,q,k),new THREE.Vector3(w,u,j)],f))},f4n:function(a,b,c,e,g,f,h,k,j,m,q){h=a.materials[h];
- var w=b[j*3],u=b[j*3+1];j=b[j*3+2];var t=b[m*3],x=b[m*3+1];m=b[m*3+2];var A=b[q*3],E=b[q*3+1];q=b[q*3+2];a.faces.push(new THREE.Face4(c,e,g,f,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(w,u,j),new THREE.Vector3(t,x,m),new THREE.Vector3(A,E,q)],h))},uv3:function(a,b,c,e,g,f,h){var k=[];k.push(new THREE.UV(b,c));k.push(new THREE.UV(e,g));k.push(new THREE.UV(f,h));a.push(k)},uv4:function(a,b,c,e,g,f,h,k,j){var m=[];m.push(new THREE.UV(b,c));m.push(new THREE.UV(e,g));m.push(new THREE.UV(f,
- h));m.push(new THREE.UV(k,j));a.push(m)},init_materials:function(a,b,c){a.materials=[];for(var e=0;e<b.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(b[e],c)]},createMaterial:function(a,b){function c(k){k=Math.log(k)/Math.LN2;return Math.floor(k)==k}function e(k,j){var m=new Image;m.onload=function(){if(!c(this.width)||!c(this.height)){var q=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),w=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));k.image.width=q;k.image.height=
- w;k.image.getContext("2d").drawImage(this,0,0,q,w)}else k.image=this;k.image.loaded=1};m.src=j}var g,f,h;g="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,light_map:null,vertex_colors:a.vertex_colors};if(a.shading)if(a.shading=="Phong")g="MeshPhongMaterial";if(a.map_diffuse&&b){h=document.createElement("canvas");f.map=new THREE.Texture(h);e(f.map,b+"/"+a.map_diffuse)}else if(a.col_diffuse){h=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*255;f.color=h;f.opacity=a.transparency}else if(a.a_dbg_color)f.color=
- a.a_dbg_color;if(a.map_lightmap&&b){h=document.createElement("canvas");f.light_map=new THREE.Texture(h);e(f.light_map,b+"/"+a.map_lightmap)}return new THREE[g](f)},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|