| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- // 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,d){this.r=a;this.g=b;this.b=d;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,d){this.x=a||0;this.y=b||0;this.z=d||0};
- THREE.Vector3.prototype={set:function(a,b,d){this.x=a;this.y=b;this.z=d;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,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-d*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,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+d*d+a*a)},distanceToSquared:function(a){var b=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return b*b+d*d+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,d,e){this.x=a||0;this.y=b||0;this.z=d||0;this.w=e||1};
- THREE.Vector4.prototype={set:function(a,b,d,e){this.x=a;this.y=b;this.z=d;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,d,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){d=e[a];if(d instanceof THREE.Mesh)g=g.concat(this.intersectObject(d))}g.sort(function(f,h){return f.distance-h.distance});return g},intersectObject:function(a){function b(H,w,J,n){n=n.clone().subSelf(w);J=J.clone().subSelf(w);var j=H.clone().subSelf(w);H=n.dot(n);w=n.dot(J);n=n.dot(j);var m=J.dot(J);J=J.dot(j);j=1/(H*m-w*w);m=(m*n-w*J)*j;H=(H*J-w*n)*j;return m>0&&H>0&&m+H<1}var d,e,g,f,h,c,k,l,q,C,
- o,v=a.geometry,x=v.vertices,t=[];d=0;for(e=v.faces.length;d<e;d++){g=v.faces[d];C=this.origin.clone();o=this.direction.clone();f=a.matrix.multiplyVector3(x[g.a].position.clone());h=a.matrix.multiplyVector3(x[g.b].position.clone());c=a.matrix.multiplyVector3(x[g.c].position.clone());k=g instanceof THREE.Face4?a.matrix.multiplyVector3(x[g.d].position.clone()):null;l=a.rotationMatrix.multiplyVector3(g.normal.clone());q=o.dot(l);if(q<0){l=l.dot((new THREE.Vector3).sub(f,C))/q;C=C.addSelf(o.multiplyScalar(l));
- if(g instanceof THREE.Face3){if(b(C,f,h,c)){g={distance:this.origin.distanceTo(C),point:C,face:g,object:a};t.push(g)}}else if(g instanceof THREE.Face4)if(b(C,f,h,k)||b(C,h,c,k)){g={distance:this.origin.distanceTo(C),point:C,face:g,object:a};t.push(g)}}}return t}};
- THREE.Rectangle=function(){function a(){f=e-b;h=g-d}var b,d,e,g,f,h,c=true;this.getX=function(){return b};this.getY=function(){return d};this.getWidth=function(){return f};this.getHeight=function(){return h};this.getLeft=function(){return b};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(k,l,q,C){c=false;b=k;d=l;e=q;g=C;a()};this.addPoint=function(k,l){if(c){c=false;b=k;d=l;e=k;g=l}else{b=b<k?b:k;d=d<l?d:l;e=e>k?e:k;g=g>l?
- g:l}a()};this.add3Points=function(k,l,q,C,o,v){if(c){c=false;b=k<q?k<o?k:o:q<o?q:o;d=l<C?l<v?l:v:C<v?C:v;e=k>q?k>o?k:o:q>o?q:o;g=l>C?l>v?l:v:C>v?C:v}else{b=k<q?k<o?k<b?k:b:o<b?o:b:q<o?q<b?q:b:o<b?o:b;d=l<C?l<v?l<d?l:d:v<d?v:d:C<v?C<d?C:d:v<d?v:d;e=k>q?k>o?k>e?k:e:o>e?o:e:q>o?q>e?q:e:o>e?o:e;g=l>C?l>v?l>g?l:g:v>g?v:g:C>v?C>g?C:g:v>g?v:g}a()};this.addRectangle=function(k){if(c){c=false;b=k.getLeft();d=k.getTop();e=k.getRight();g=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();d=d<k.getTop()?d:k.getTop();
- e=e>k.getRight()?e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;d-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();d=d>k.getTop()?d:k.getTop();e=e<k.getRight()?e:k.getRight();g=g<k.getBottom()?g:k.getBottom();a()};this.instersects=function(k){return Math.min(e,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(g,k.getBottom())-Math.max(d,k.getTop())>=0};this.empty=function(){c=true;g=e=d=b=0;a()};this.isEmpty=function(){return c};this.toString=
- function(){return"THREE.Rectangle ( left: "+b+", right: "+e+", top: "+d+", 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}};
- THREE.Matrix4=function(a,b,d,e,g,f,h,c,k,l,q,C,o,v,x,t){this.n11=a||1;this.n12=b||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=f||1;this.n23=h||0;this.n24=c||0;this.n31=k||0;this.n32=l||0;this.n33=q||1;this.n34=C||0;this.n41=o||0;this.n42=v||0;this.n43=x||0;this.n44=t||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,d,e,g,f,h,c,k,l,q,C,o,v,x,t){this.n11=a;this.n12=b;this.n13=d;this.n14=e;this.n21=g;this.n22=f;this.n23=h;this.n24=c;this.n31=k;this.n32=l;this.n33=q;this.n34=C;this.n41=o;this.n42=v;this.n43=x;this.n44=t;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,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,f=THREE.Matrix4.__tmpVec3;f.sub(a,b).normalize();e.cross(d,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,d=a.y,e=a.z,g=1/(this.n41*b+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*d+this.n23*
- e+this.n24*g;a.z=this.n31*b+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*d+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 d=a.n11,e=a.n12,g=a.n13,f=a.n14,h=a.n21,c=a.n22,k=a.n23,l=a.n24,q=a.n31,
- C=a.n32,o=a.n33,v=a.n34,x=a.n41,t=a.n42,H=a.n43,w=a.n44,J=b.n11,n=b.n12,j=b.n13,m=b.n14,B=b.n21,u=b.n22,p=b.n23,M=b.n24,y=b.n31,D=b.n32,F=b.n33,E=b.n34,A=b.n41,O=b.n42,K=b.n43,U=b.n44;this.n11=d*J+e*B+g*y+f*A;this.n12=d*n+e*u+g*D+f*O;this.n13=d*j+e*p+g*F+f*K;this.n14=d*m+e*M+g*E+f*U;this.n21=h*J+c*B+k*y+l*A;this.n22=h*n+c*u+k*D+l*O;this.n23=h*j+c*p+k*F+l*K;this.n24=h*m+c*M+k*E+l*U;this.n31=q*J+C*B+o*y+v*A;this.n32=q*n+C*u+o*D+v*O;this.n33=q*j+C*p+o*F+v*K;this.n34=q*m+C*M+o*E+v*U;this.n41=x*J+t*B+
- H*y+w*A;this.n42=x*n+t*u+H*D+w*O;this.n43=x*j+t*p+H*F+w*K;this.n44=x*m+t*M+H*E+w*U;return this},multiplySelf:function(a){var b=this.n11,d=this.n12,e=this.n13,g=this.n14,f=this.n21,h=this.n22,c=this.n23,k=this.n24,l=this.n31,q=this.n32,C=this.n33,o=this.n34,v=this.n41,x=this.n42,t=this.n43,H=this.n44,w=a.n11,J=a.n21,n=a.n31,j=a.n41,m=a.n12,B=a.n22,u=a.n32,p=a.n42,M=a.n13,y=a.n23,D=a.n33,F=a.n43,E=a.n14,A=a.n24,O=a.n34;a=a.n44;this.n11=b*w+d*J+e*n+g*j;this.n12=b*m+d*B+e*u+g*p;this.n13=b*M+d*y+e*D+g*
- F;this.n14=b*E+d*A+e*O+g*a;this.n21=f*w+h*J+c*n+k*j;this.n22=f*m+h*B+c*u+k*p;this.n23=f*M+h*y+c*D+k*F;this.n24=f*E+h*A+c*O+k*a;this.n31=l*w+q*J+C*n+o*j;this.n32=l*m+q*B+C*u+o*p;this.n33=l*M+q*y+C*D+o*F;this.n34=l*E+q*A+C*O+o*a;this.n41=v*w+x*J+t*n+H*j;this.n42=v*m+x*B+t*u+H*p;this.n43=v*M+x*y+t*D+H*F;this.n44=v*E+x*A+t*O+H*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,d=this.n13,e=this.n14,g=this.n21,f=this.n22,h=this.n23,c=this.n24,k=this.n31,l=this.n32,q=this.n33,C=this.n34,o=this.n41,v=this.n42,x=this.n43,t=this.n44;return e*h*l*o-d*c*l*o-e*f*q*o+b*c*q*o+d*f*C*o-b*h*C*o-e*h*k*v+d*c*k*v+e*g*q*v-a*c*q*v-d*g*C*v+a*h*C*v+e*f*k*x-b*c*k*x-e*g*l*x+a*c*l*x+b*g*C*x-a*f*C*x-d*f*k*t+b*h*k*t+d*g*l*t-a*h*l*t-b*g*q*t+a*f*q*t},transpose:function(){function a(b,d,
- e){var g=b[d];b[d]=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},setTranslation:function(a,b,d){this.set(1,0,0,a,0,1,0,b,0,0,1,d,0,0,0,1);return this},setScale:function(a,b,d){this.set(a,0,0,0,0,b,0,0,0,0,d,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 d=Math.cos(b),e=Math.sin(b),g=1-d,f=a.x,h=a.y,c=a.z,k=g*f,l=g*h;this.set(k*f+d,k*h-e*c,k*c+e*h,0,k*h+e*c,l*h+d,l*c-e*f,0,k*c-e*h,l*c+e*f,g*c*c+d,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,d){var e=new THREE.Matrix4;e.setTranslation(a,b,d);return e};THREE.Matrix4.scaleMatrix=function(a,b,d){var e=new THREE.Matrix4;e.setScale(a,b,d);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 d=new THREE.Matrix4;d.setRotAxis(a,b);return d};
- THREE.Matrix4.makeInvert=function(a){var b=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,c=a.n23,k=a.n24,l=a.n31,q=a.n32,C=a.n33,o=a.n34,v=a.n41,x=a.n42,t=a.n43,H=a.n44,w=new THREE.Matrix4;w.n11=c*o*x-k*C*x+k*q*t-h*o*t-c*q*H+h*C*H;w.n12=g*C*x-e*o*x-g*q*t+d*o*t+e*q*H-d*C*H;w.n13=e*k*x-g*c*x+g*h*t-d*k*t-e*h*H+d*c*H;w.n14=g*c*q-e*k*q-g*h*C+d*k*C+e*h*o-d*c*o;w.n21=k*C*v-c*o*v-k*l*t+f*o*t+c*l*H-f*C*H;w.n22=e*o*v-g*C*v+g*l*t-b*o*t-e*l*H+b*C*H;w.n23=g*c*v-e*k*v-g*f*t+b*k*t+e*f*H-b*c*H;w.n24=e*k*l-g*c*l+
- g*f*C-b*k*C-e*f*o+b*c*o;w.n31=h*o*v-k*q*v+k*l*x-f*o*x-h*l*H+f*q*H;w.n32=g*q*v-d*o*v-g*l*x+b*o*x+d*l*H-b*q*H;w.n33=e*k*v-g*h*v+g*f*x-b*k*x-d*f*H+b*h*H;w.n34=g*h*l-d*k*l-g*f*q+b*k*q+d*f*o-b*h*o;w.n41=c*q*v-h*C*v-c*l*x+f*C*x+h*l*t-f*q*t;w.n42=d*C*v-e*q*v+e*l*x-b*C*x-d*l*t+b*q*t;w.n43=e*h*v-d*c*v-e*f*x+b*c*x+d*f*t-b*h*t;w.n44=d*c*l-e*h*l+e*f*q-b*c*q-d*f*C+b*h*C;w.multiplyScalar(1/a.determinant());return w};
- THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=a.m33;var d=a.m,e=b[10]*b[5]-b[6]*b[9],g=-b[10]*b[1]+b[2]*b[9],f=b[6]*b[1]-b[2]*b[5],h=-b[10]*b[4]+b[6]*b[8],c=b[10]*b[0]-b[2]*b[8],k=-b[6]*b[0]+b[2]*b[4],l=b[9]*b[4]-b[5]*b[8],q=-b[9]*b[0]+b[1]*b[8],C=b[5]*b[0]-b[1]*b[4];b=b[0]*e+b[1]*h+b[2]*l;if(b==0)throw"matrix not invertible";b=1/b;d[0]=b*e;d[1]=b*g;d[2]=b*f;d[3]=b*h;d[4]=b*c;d[5]=b*k;d[6]=b*l;d[7]=b*q;d[8]=b*C;return a};
- THREE.Matrix4.makeFrustum=function(a,b,d,e,g,f){var h,c,k;h=new THREE.Matrix4;c=2*g/(b-a);k=2*g/(e-d);a=(b+a)/(b-a);d=(e+d)/(e-d);e=-(f+g)/(f-g);g=-2*f*g/(f-g);h.n11=c;h.n12=0;h.n13=a;h.n14=0;h.n21=0;h.n22=k;h.n23=d;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,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,d,e)};
- THREE.Matrix4.makeOrtho=function(a,b,d,e,g,f){var h,c,k,l;h=new THREE.Matrix4;c=b-a;k=d-e;l=f-g;a=(b+a)/c;d=(d+e)/k;g=(f+g)/l;h.n11=2/c;h.n12=0;h.n13=0;h.n14=-a;h.n21=0;h.n22=2/k;h.n23=0;h.n24=-d;h.n31=0;h.n32=0;h.n33=-2/l;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,d,e,g){this.a=a;this.b=b;this.c=d;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,d,e,g,f){this.a=a;this.b=b;this.c=d;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.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
- THREE.Geometry.prototype={computeCentroids:function(){var a,b,d;a=0;for(b=this.faces.length;a<b;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
- d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,d,e,g,f,h,c=new THREE.Vector3,k=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){c.set(0,0,0);b=0;for(d=f.normal.length;b<d;b++)c.addSelf(f.vertexNormals[b]);c.divideScalar(3)}else{b=this.vertices[f.a];d=this.vertices[f.b];h=this.vertices[f.c];c.sub(h.position,
- d.position);k.sub(b.position,d.position);c.crossSelf(k)}c.isZero()||c.normalize();f.normal.copy(c)}},computeVertexNormals:function(){var a,b,d,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++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
- new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{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++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
- b;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(E,A,O,K,U,W,P){f=E.vertices[A].position;h=E.vertices[O].position;c=E.vertices[K].position;k=g[U];l=g[W];q=g[P];C=h.x-f.x;o=c.x-f.x;v=h.y-f.y;x=c.y-f.y;
- t=h.z-f.z;H=c.z-f.z;w=l.u-k.u;J=q.u-k.u;n=l.v-k.v;j=q.v-k.v;m=1/(w*j-J*n);p.set((j*C-n*o)*m,(j*v-n*x)*m,(j*t-n*H)*m);M.set((w*o-J*C)*m,(w*x-J*v)*m,(w*H-J*t)*m);B[A].addSelf(p);B[O].addSelf(p);B[K].addSelf(p);u[A].addSelf(M);u[O].addSelf(M);u[K].addSelf(M)}var b,d,e,g,f,h,c,k,l,q,C,o,v,x,t,H,w,J,n,j,m,B=[],u=[],p=new THREE.Vector3,M=new THREE.Vector3,y=new THREE.Vector3,D=new THREE.Vector3,F=new THREE.Vector3;b=0;for(d=this.vertices.length;b<d;b++){B[b]=new THREE.Vector3;u[b]=new THREE.Vector3}b=0;
- for(d=this.faces.length;b<d;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(d=this.vertices.length;b<d;b++){F.copy(this.vertices[b].normal);e=B[b];y.copy(e);y.subSelf(F.multiplyScalar(F.dot(e))).normalize();D.cross(this.vertices[b].normal,e);e=D.dot(u[b]);e=e<0?-1:1;this.vertices[b].tangent.set(y.x,y.y,y.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,d=this.vertices.length;b<d;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,d=this.vertices.length;b<d;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(q){var C=[];b=0;for(d=q.length;b<d;b++)q[b]==undefined?C.push("undefined"):C.push(q[b].toString());return C.join("_")}var b,d,e,g,f,h,c,k,l={};e=0;for(g=this.faces.length;e<g;e++){f=this.faces[e];
- h=f.materials;c=a(h);if(l[c]==undefined)l[c]={hash:c,counter:0};k=l[c].hash+"_"+l[c].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:h,vertices:0};f=f instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+f>65535){l[c].counter+=1;k=l[c].hash+"_"+l[c].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:h,vertices:0}}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=f}},toString:function(){return"THREE.Geometry ( vertices: "+
- this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
- THREE.Camera=function(a,b,d,e){this.fov=a;this.aspect=b;this.near=d;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.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true};
- THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,b=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(b.x);if(b.y!=0){e.setRotY(b.y);this.rotationMatrix.multiplySelf(e)}if(b.z!=0){e.setRotZ(b.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};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.autoUpdateMatrix=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
- THREE.Line=function(a,b,d){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b 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.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";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.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}};
- THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
- THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);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.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;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}};
- THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<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/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+
- "<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
- THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);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.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;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}};
- THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<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/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+
- this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<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.env_map=this.specular_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=
- this.wireframe_linecap="round";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.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_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.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;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}};
- 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/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
- this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshPhongMaterialCounter={value:0};
- THREE.MeshDepthMaterial=function(a){this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial"}};
- THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;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}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial"}};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.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";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.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;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}};
- THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
- THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
- THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};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,d,e,g,f){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=d!==undefined?d: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,d){this.width=a;this.height=b;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
- var Uniforms={clone:function(a){var b,d,e,g={};for(b in a){g[b]={};for(d in a[b]){e=a[b][d];g[b][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,d,e,g={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(d in e)g[d]=e[d]}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,d){this.color=new THREE.Color(a);this.near=b||1;this.far=d||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
- THREE.Projector=function(){function a(u,p){return p.z-u.z}function b(u,p){var M=0,y=1,D=u.z+u.w,F=p.z+p.w,E=-u.z+u.w,A=-p.z+p.w;if(D>=0&&F>=0&&E>=0&&A>=0)return true;else if(D<0&&F<0||E<0&&A<0)return false;else{if(D<0)M=Math.max(M,D/(D-F));else if(F<0)y=Math.min(y,D/(D-F));if(E<0)M=Math.max(M,E/(E-A));else if(A<0)y=Math.min(y,E/(E-A));if(y<M)return false;else{u.lerpSelf(p,M);p.lerpSelf(u,1-y);return true}}}var d,e,g=[],f,h,c,k=[],l,q,C=[],o,v,x=[],t=new THREE.Vector4,H=new THREE.Vector4,w=new THREE.Matrix4,
- J=new THREE.Matrix4,n=[],j=new THREE.Vector4,m=new THREE.Vector4,B;this.projectObjects=function(u,p,M){var y=[],D,F;e=0;w.multiply(p.projectionMatrix,p.matrix);n[0]=new THREE.Vector4(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);n[1]=new THREE.Vector4(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);n[2]=new THREE.Vector4(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);n[3]=new THREE.Vector4(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);n[4]=new THREE.Vector4(w.n41-w.n31,w.n42-w.n32,w.n43-
- w.n33,w.n44-w.n34);n[5]=new THREE.Vector4(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);p=0;for(D=n.length;p<D;p++){F=n[p];F.divideScalar(Math.sqrt(F.x*F.x+F.y*F.y+F.z*F.z))}D=u.objects;u=0;for(p=D.length;u<p;u++){F=D[u];var E;if(!(E=!F.visible)){if(E=F instanceof THREE.Mesh){a:{E=void 0;for(var A=F.position,O=-F.geometry.boundingSphere.radius*Math.max(F.scale.x,Math.max(F.scale.y,F.scale.z)),K=0;K<6;K++){E=n[K].x*A.x+n[K].y*A.y+n[K].z*A.z+n[K].w;if(E<=O){E=false;break a}}E=true}E=!E}E=E}if(!E){d=
- g[e]=g[e]||new THREE.RenderableObject;t.copy(F.position);w.multiplyVector3(t);d.object=F;d.z=t.z;y.push(d);e++}}M&&y.sort(a);return y};this.projectScene=function(u,p,M){var y=[],D=p.near,F=p.far,E,A,O,K,U,W,P,da,X,R,T,ba,Y,G,S,V;c=q=v=0;p.autoUpdateMatrix&&p.updateMatrix();w.multiply(p.projectionMatrix,p.matrix);W=this.projectObjects(u,p,true);u=0;for(E=W.length;u<E;u++){P=W[u].object;if(P.visible){P.autoUpdateMatrix&&P.updateMatrix();da=P.matrix;X=P.rotationMatrix;R=P.materials;T=P.overdraw;if(P instanceof
- THREE.Mesh){ba=P.geometry;Y=ba.vertices;A=0;for(O=Y.length;A<O;A++){G=Y[A];G.positionWorld.copy(G.position);da.multiplyVector3(G.positionWorld);K=G.positionScreen;K.copy(G.positionWorld);w.multiplyVector4(K);K.x/=K.w;K.y/=K.w;G.__visible=K.z>D&&K.z<F}ba=ba.faces;A=0;for(O=ba.length;A<O;A++){G=ba[A];if(G instanceof THREE.Face3){K=Y[G.a];U=Y[G.b];S=Y[G.c];if(K.__visible&&U.__visible&&S.__visible)if(P.doubleSided||P.flipSided!=(S.positionScreen.x-K.positionScreen.x)*(U.positionScreen.y-K.positionScreen.y)-
- (S.positionScreen.y-K.positionScreen.y)*(U.positionScreen.x-K.positionScreen.x)<0){f=k[c]=k[c]||new THREE.RenderableFace3;f.v1.positionWorld.copy(K.positionWorld);f.v2.positionWorld.copy(U.positionWorld);f.v3.positionWorld.copy(S.positionWorld);f.v1.positionScreen.copy(K.positionScreen);f.v2.positionScreen.copy(U.positionScreen);f.v3.positionScreen.copy(S.positionScreen);f.normalWorld.copy(G.normal);X.multiplyVector3(f.normalWorld);f.centroidWorld.copy(G.centroid);da.multiplyVector3(f.centroidWorld);
- f.centroidScreen.copy(f.centroidWorld);w.multiplyVector3(f.centroidScreen);S=G.vertexNormals;B=f.vertexNormalsWorld;K=0;for(U=S.length;K<U;K++){V=B[K]=B[K]||new THREE.Vector3;V.copy(S[K]);X.multiplyVector3(V)}f.z=f.centroidScreen.z;f.meshMaterials=R;f.faceMaterials=G.materials;f.overdraw=T;if(P.geometry.uvs[A]){f.uvs[0]=P.geometry.uvs[A][0];f.uvs[1]=P.geometry.uvs[A][1];f.uvs[2]=P.geometry.uvs[A][2]}y.push(f);c++}}else if(G instanceof THREE.Face4){K=Y[G.a];U=Y[G.b];S=Y[G.c];V=Y[G.d];if(K.__visible&&
- U.__visible&&S.__visible&&V.__visible)if(P.doubleSided||P.flipSided!=((V.positionScreen.x-K.positionScreen.x)*(U.positionScreen.y-K.positionScreen.y)-(V.positionScreen.y-K.positionScreen.y)*(U.positionScreen.x-K.positionScreen.x)<0||(U.positionScreen.x-S.positionScreen.x)*(V.positionScreen.y-S.positionScreen.y)-(U.positionScreen.y-S.positionScreen.y)*(V.positionScreen.x-S.positionScreen.x)<0)){f=k[c]=k[c]||new THREE.RenderableFace3;f.v1.positionWorld.copy(K.positionWorld);f.v2.positionWorld.copy(U.positionWorld);
- f.v3.positionWorld.copy(V.positionWorld);f.v1.positionScreen.copy(K.positionScreen);f.v2.positionScreen.copy(U.positionScreen);f.v3.positionScreen.copy(V.positionScreen);f.normalWorld.copy(G.normal);X.multiplyVector3(f.normalWorld);f.centroidWorld.copy(G.centroid);da.multiplyVector3(f.centroidWorld);f.centroidScreen.copy(f.centroidWorld);w.multiplyVector3(f.centroidScreen);f.z=f.centroidScreen.z;f.meshMaterials=R;f.faceMaterials=G.materials;f.overdraw=T;if(P.geometry.uvs[A]){f.uvs[0]=P.geometry.uvs[A][0];
- f.uvs[1]=P.geometry.uvs[A][1];f.uvs[2]=P.geometry.uvs[A][3]}y.push(f);c++;h=k[c]=k[c]||new THREE.RenderableFace3;h.v1.positionWorld.copy(U.positionWorld);h.v2.positionWorld.copy(S.positionWorld);h.v3.positionWorld.copy(V.positionWorld);h.v1.positionScreen.copy(U.positionScreen);h.v2.positionScreen.copy(S.positionScreen);h.v3.positionScreen.copy(V.positionScreen);h.normalWorld.copy(f.normalWorld);h.centroidWorld.copy(f.centroidWorld);h.centroidScreen.copy(f.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=
- R;h.faceMaterials=G.materials;h.overdraw=T;if(P.geometry.uvs[A]){h.uvs[0]=P.geometry.uvs[A][1];h.uvs[1]=P.geometry.uvs[A][2];h.uvs[2]=P.geometry.uvs[A][3]}y.push(h);c++}}}}else if(P instanceof THREE.Line){J.multiply(w,da);Y=P.geometry.vertices;G=Y[0];G.positionScreen.copy(G.position);J.multiplyVector4(G.positionScreen);A=1;for(O=Y.length;A<O;A++){K=Y[A];K.positionScreen.copy(K.position);J.multiplyVector4(K.positionScreen);U=Y[A-1];j.copy(K.positionScreen);m.copy(U.positionScreen);if(b(j,m)){j.multiplyScalar(1/
- j.w);m.multiplyScalar(1/m.w);l=C[q]=C[q]||new THREE.RenderableLine;l.v1.positionScreen.copy(j);l.v2.positionScreen.copy(m);l.z=Math.max(j.z,m.z);l.materials=P.materials;y.push(l);q++}}}else if(P instanceof THREE.Particle){H.set(P.position.x,P.position.y,P.position.z,1);w.multiplyVector4(H);H.z/=H.w;if(H.z>0&&H.z<1){o=x[v]=x[v]||new THREE.RenderableParticle;o.x=H.x/H.w;o.y=H.y/H.w;o.z=H.z;o.rotation=P.rotation.z;o.scale.x=P.scale.x*Math.abs(o.x-(H.x+p.projectionMatrix.n11)/(H.w+p.projectionMatrix.n14));
- o.scale.y=P.scale.y*Math.abs(o.y-(H.y+p.projectionMatrix.n22)/(H.w+p.projectionMatrix.n24));o.materials=P.materials;y.push(o);v++}}}}M&&y.sort(a);return y};this.unprojectVector=function(u,p){var M=THREE.Matrix4.makeInvert(p.matrix);M.multiplySelf(THREE.Matrix4.makeInvert(p.projectionMatrix));M.multiplyVector3(u);return u}};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,d,e,g,f;this.domElement=document.createElement("div");this.setSize=function(h,c){d=h;e=c;g=d/2;f=e/2};this.render=function(h,c){var k,l,q,C,o,v,x,t;a=b.projectScene(h,c);k=0;for(l=a.length;k<l;k++){o=a[k];if(o instanceof THREE.RenderableParticle){x=o.x*g+g;t=o.y*f+f;q=0;for(C=o.material.length;q<C;q++){v=o.material[q];if(v instanceof THREE.ParticleDOMMaterial){v=v.domElement;v.style.left=x+"px";v.style.top=t+"px"}}}}}};
- THREE.CanvasRenderer=function(){function a(ma){if(o!=ma)l.globalAlpha=o=ma}function b(ma){if(v!=ma){switch(ma){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}v=ma}}var d=null,e=new THREE.Projector,g=document.createElement("canvas"),f,h,c,k,l=g.getContext("2d"),q=null,C=null,o=1,v=0,x=null,t=null,H=1,w,J,n,j,m,B,u,p,M,y=new THREE.Color,
- D=new THREE.Color,F=new THREE.Color,E=new THREE.Color,A=new THREE.Color,O,K,U,W,P,da,X,R,T,ba=new THREE.Rectangle,Y=new THREE.Rectangle,G=new THREE.Rectangle,S=false,V=new THREE.Color,ia=new THREE.Color,ha=new THREE.Color,z=new THREE.Color,L=Math.PI*2,I=new THREE.Vector3,Z,ca,ga,ja,qa,sa,ya=16;Z=document.createElement("canvas");Z.width=Z.height=2;ca=Z.getContext("2d");ca.fillStyle="rgba(0,0,0,1)";ca.fillRect(0,0,2,2);ga=ca.getImageData(0,0,2,2);ja=ga.data;qa=document.createElement("canvas");qa.width=
- qa.height=ya;sa=qa.getContext("2d");sa.translate(-ya/2,-ya/2);sa.scale(ya,ya);ya--;this.domElement=g;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ma,wa){f=ma;h=wa;c=f/2;k=h/2;g.width=f;g.height=h;ba.set(-c,-k,c,k);o=1;v=0;t=x=null;H=1};this.setClearColor=function(ma,wa){q=ma!==null?new THREE.Color(ma):null;C=wa;Y.set(-c,-k,c,k);l.setTransform(1,0,0,-1,c,k);this.clear()};this.clear=function(){if(!Y.isEmpty()){Y.inflate(1);Y.minSelf(ba);if(q!==null){b(THREE.NormalBlending);
- a(1);l.fillStyle="rgba("+Math.floor(q.r*255)+","+Math.floor(q.g*255)+","+Math.floor(q.b*255)+","+C+")";l.fillRect(Y.getX(),Y.getY(),Y.getWidth(),Y.getHeight())}else l.clearRect(Y.getX(),Y.getY(),Y.getWidth(),Y.getHeight());Y.empty()}};this.render=function(ma,wa){function Pa(N){var ea,aa,Q,$=N.lights;ia.setRGB(0,0,0);ha.setRGB(0,0,0);z.setRGB(0,0,0);N=0;for(ea=$.length;N<ea;N++){aa=$[N];Q=aa.color;if(aa instanceof THREE.AmbientLight){ia.r+=Q.r;ia.g+=Q.g;ia.b+=Q.b}else if(aa instanceof THREE.DirectionalLight){ha.r+=
- Q.r;ha.g+=Q.g;ha.b+=Q.b}else if(aa instanceof THREE.PointLight){z.r+=Q.r;z.g+=Q.g;z.b+=Q.b}}}function Da(N,ea,aa,Q){var $,fa,la,na,oa=N.lights;N=0;for($=oa.length;N<$;N++){fa=oa[N];la=fa.color;na=fa.intensity;if(fa instanceof THREE.DirectionalLight){fa=aa.dot(fa.position)*na;if(fa>0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}else if(fa instanceof THREE.PointLight){I.sub(fa.position,ea);I.normalize();fa=aa.dot(I)*na;if(fa>0){Q.r+=la.r*fa;Q.g+=la.g*fa;Q.b+=la.b*fa}}}}function Qa(N,ea,aa){if(aa.opacity!=
- 0){a(aa.opacity);b(aa.blending);var Q,$,fa,la,na,oa;if(aa instanceof THREE.ParticleBasicMaterial){if(aa.map){la=aa.map;na=la.width>>1;oa=la.height>>1;$=ea.scale.x*c;fa=ea.scale.y*k;aa=$*na;Q=fa*oa;G.set(N.x-aa,N.y-Q,N.x+aa,N.y+Q);if(ba.instersects(G)){l.save();l.translate(N.x,N.y);l.rotate(-ea.rotation);l.scale($,-fa);l.translate(-na,-oa);l.drawImage(la,0,0);l.restore()}}}else if(aa instanceof THREE.ParticleCircleMaterial){if(S){V.r=ia.r+ha.r+z.r;V.g=ia.g+ha.g+z.g;V.b=ia.b+ha.b+z.b;y.r=aa.color.r*
- V.r;y.g=aa.color.g*V.g;y.b=aa.color.b*V.b;y.updateStyleString()}else y.__styleString=aa.color.__styleString;aa=ea.scale.x*c;Q=ea.scale.y*k;G.set(N.x-aa,N.y-Q,N.x+aa,N.y+Q);if(ba.instersects(G)){$=y.__styleString;if(t!=$)l.fillStyle=t=$;l.save();l.translate(N.x,N.y);l.rotate(-ea.rotation);l.scale(aa,Q);l.beginPath();l.arc(0,0,1,0,L,true);l.closePath();l.fill();l.restore()}}}}function Ra(N,ea,aa,Q){if(Q.opacity!=0){a(Q.opacity);b(Q.blending);l.beginPath();l.moveTo(N.positionScreen.x,N.positionScreen.y);
- l.lineTo(ea.positionScreen.x,ea.positionScreen.y);l.closePath();if(Q instanceof THREE.LineBasicMaterial){y.__styleString=Q.color.__styleString;N=Q.linewidth;if(H!=N)l.lineWidth=H=N;N=y.__styleString;if(x!=N)l.strokeStyle=x=N;l.stroke();G.inflate(Q.linewidth*2)}}}function La(N,ea,aa,Q,$,fa){if($.opacity!=0){a($.opacity);b($.blending);j=N.positionScreen.x;m=N.positionScreen.y;B=ea.positionScreen.x;u=ea.positionScreen.y;p=aa.positionScreen.x;M=aa.positionScreen.y;l.beginPath();l.moveTo(j,m);l.lineTo(B,
- u);l.lineTo(p,M);l.lineTo(j,m);l.closePath();if($ instanceof THREE.MeshBasicMaterial)if($.map)$.map.image.loaded&&$.map.mapping instanceof THREE.UVMapping&&Aa(j,m,B,u,p,M,$.map.image,Q.uvs[0].u,Q.uvs[0].v,Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);else if($.env_map){if($.env_map.image.loaded)if($.env_map.mapping instanceof THREE.SphericalReflectionMapping){N=wa.matrix;I.copy(Q.vertexNormalsWorld[0]);W=(I.x*N.n11+I.y*N.n12+I.z*N.n13)*0.5+0.5;P=-(I.x*N.n21+I.y*N.n22+I.z*N.n23)*0.5+0.5;I.copy(Q.vertexNormalsWorld[1]);
- da=(I.x*N.n11+I.y*N.n12+I.z*N.n13)*0.5+0.5;X=-(I.x*N.n21+I.y*N.n22+I.z*N.n23)*0.5+0.5;I.copy(Q.vertexNormalsWorld[2]);R=(I.x*N.n11+I.y*N.n12+I.z*N.n13)*0.5+0.5;T=-(I.x*N.n21+I.y*N.n22+I.z*N.n23)*0.5+0.5;Aa(j,m,B,u,p,M,$.env_map.image,W,P,da,X,R,T)}}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString);else if($ instanceof THREE.MeshLambertMaterial){if($.map&&!$.wireframe){$.map.mapping instanceof THREE.UVMapping&&Aa(j,m,B,u,p,M,$.map.image,Q.uvs[0].u,Q.uvs[0].v,
- Q.uvs[1].u,Q.uvs[1].v,Q.uvs[2].u,Q.uvs[2].v);b(THREE.SubtractiveBlending)}if(S)if(!$.wireframe&&$.shading==THREE.SmoothShading&&Q.vertexNormalsWorld.length==3){D.r=F.r=E.r=ia.r;D.g=F.g=E.g=ia.g;D.b=F.b=E.b=ia.b;Da(fa,Q.v1.positionWorld,Q.vertexNormalsWorld[0],D);Da(fa,Q.v2.positionWorld,Q.vertexNormalsWorld[1],F);Da(fa,Q.v3.positionWorld,Q.vertexNormalsWorld[2],E);A.r=(F.r+E.r)*0.5;A.g=(F.g+E.g)*0.5;A.b=(F.b+E.b)*0.5;U=Ma(D,F,E,A);Aa(j,m,B,u,p,M,U,0,0,1,0,0,1)}else{V.r=ia.r;V.g=ia.g;V.b=ia.b;Da(fa,
- Q.centroidWorld,Q.normalWorld,V);y.r=$.color.r*V.r;y.g=$.color.g*V.g;y.b=$.color.b*V.b;y.updateStyleString();$.wireframe?Ea(y.__styleString,$.wireframe_linewidth):Fa(y.__styleString)}else $.wireframe?Ea($.color.__styleString,$.wireframe_linewidth):Fa($.color.__styleString)}else if($ instanceof THREE.MeshDepthMaterial){O=wa.near;K=wa.far;D.r=D.g=D.b=1-Ha(N.positionScreen.z,O,K);F.r=F.g=F.b=1-Ha(ea.positionScreen.z,O,K);E.r=E.g=E.b=1-Ha(aa.positionScreen.z,O,K);A.r=(F.r+E.r)*0.5;A.g=(F.g+E.g)*0.5;A.b=
- (F.b+E.b)*0.5;U=Ma(D,F,E,A);Aa(j,m,B,u,p,M,U,0,0,1,0,0,1)}else if($ instanceof THREE.MeshNormalMaterial){y.r=Ia(Q.normalWorld.x);y.g=Ia(Q.normalWorld.y);y.b=Ia(Q.normalWorld.z);y.updateStyleString();$.wireframe?Ea(y.__styleString,$.wireframe_linewidth):Fa(y.__styleString)}}}function Ea(N,ea){if(x!=N)l.strokeStyle=x=N;if(H!=ea)l.lineWidth=H=ea;l.stroke();G.inflate(ea*2)}function Fa(N){if(t!=N)l.fillStyle=t=N;l.fill()}function Aa(N,ea,aa,Q,$,fa,la,na,oa,ta,pa,ua,Ba){var xa,va;xa=la.width-1;va=la.height-
- 1;na*=xa;oa*=va;ta*=xa;pa*=va;ua*=xa;Ba*=va;aa-=N;Q-=ea;$-=N;fa-=ea;ta-=na;pa-=oa;ua-=na;Ba-=oa;va=1/(ta*Ba-ua*pa);xa=(Ba*aa-pa*$)*va;pa=(Ba*Q-pa*fa)*va;aa=(ta*$-ua*aa)*va;Q=(ta*fa-ua*Q)*va;N=N-xa*na-aa*oa;ea=ea-pa*na-Q*oa;l.save();l.transform(xa,pa,aa,Q,N,ea);l.clip();l.drawImage(la,0,0);l.restore()}function Ma(N,ea,aa,Q){var $=~~(N.r*255),fa=~~(N.g*255);N=~~(N.b*255);var la=~~(ea.r*255),na=~~(ea.g*255);ea=~~(ea.b*255);var oa=~~(aa.r*255),ta=~~(aa.g*255);aa=~~(aa.b*255);var pa=~~(Q.r*255),ua=~~(Q.g*
- 255);Q=~~(Q.b*255);ja[0]=$<0?0:$>255?255:$;ja[1]=fa<0?0:fa>255?255:fa;ja[2]=N<0?0:N>255?255:N;ja[4]=la<0?0:la>255?255:la;ja[5]=na<0?0:na>255?255:na;ja[6]=ea<0?0:ea>255?255:ea;ja[8]=oa<0?0:oa>255?255:oa;ja[9]=ta<0?0:ta>255?255:ta;ja[10]=aa<0?0:aa>255?255:aa;ja[12]=pa<0?0:pa>255?255:pa;ja[13]=ua<0?0:ua>255?255:ua;ja[14]=Q<0?0:Q>255?255:Q;ca.putImageData(ga,0,0);sa.drawImage(Z,0,0);return qa}function Ha(N,ea,aa){N=(N-ea)/(aa-ea);return N*N*(3-2*N)}function Ia(N){N=(N+1)*0.5;return N<0?0:N>1?1:N}function Ja(N,
- ea){var aa=ea.x-N.x,Q=ea.y-N.y,$=1/Math.sqrt(aa*aa+Q*Q);aa*=$;Q*=$;ea.x+=aa;ea.y+=Q;N.x-=aa;N.y-=Q}var Ga,Na,ka,ra,za,Ka,Oa,Ca;l.setTransform(1,0,0,-1,c,k);this.autoClear&&this.clear();d=e.projectScene(ma,wa,this.sortElements);(S=ma.lights.length>0)&&Pa(ma);Ga=0;for(Na=d.length;Ga<Na;Ga++){ka=d[Ga];G.empty();if(ka instanceof THREE.RenderableParticle){w=ka;w.x*=c;w.y*=k;ra=0;for(za=ka.materials.length;ra<za;ra++)Qa(w,ka,ka.materials[ra],ma)}else if(ka instanceof THREE.RenderableLine){w=ka.v1;J=ka.v2;
- w.positionScreen.x*=c;w.positionScreen.y*=k;J.positionScreen.x*=c;J.positionScreen.y*=k;G.addPoint(w.positionScreen.x,w.positionScreen.y);G.addPoint(J.positionScreen.x,J.positionScreen.y);if(ba.instersects(G)){ra=0;for(za=ka.materials.length;ra<za;)Ra(w,J,ka,ka.materials[ra++],ma)}}else if(ka instanceof THREE.RenderableFace3){w=ka.v1;J=ka.v2;n=ka.v3;w.positionScreen.x*=c;w.positionScreen.y*=k;J.positionScreen.x*=c;J.positionScreen.y*=k;n.positionScreen.x*=c;n.positionScreen.y*=k;if(ka.overdraw){Ja(w.positionScreen,
- J.positionScreen);Ja(J.positionScreen,n.positionScreen);Ja(n.positionScreen,w.positionScreen)}G.add3Points(w.positionScreen.x,w.positionScreen.y,J.positionScreen.x,J.positionScreen.y,n.positionScreen.x,n.positionScreen.y);if(ba.instersects(G)){ra=0;for(za=ka.meshMaterials.length;ra<za;){Ca=ka.meshMaterials[ra++];if(Ca instanceof THREE.MeshFaceMaterial){Ka=0;for(Oa=ka.faceMaterials.length;Ka<Oa;)(Ca=ka.faceMaterials[Ka++])&&La(w,J,n,ka,Ca,ma)}else La(w,J,n,ka,Ca,ma)}}}Y.addRectangle(G)}l.setTransform(1,
- 0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(W,P,da){var X,R,T,ba;X=0;for(R=W.lights.length;X<R;X++){T=W.lights[X];if(T instanceof THREE.DirectionalLight){ba=P.normalWorld.dot(T.position)*T.intensity;if(ba>0){da.r+=T.color.r*ba;da.g+=T.color.g*ba;da.b+=T.color.b*ba}}else if(T instanceof THREE.PointLight){M.sub(T.position,P.centroidWorld);M.normalize();ba=P.normalWorld.dot(M)*T.intensity;if(ba>0){da.r+=T.color.r*ba;da.g+=T.color.g*ba;da.b+=T.color.b*ba}}}}function b(W,P,da,X,R,T){E=e(A++);E.setAttribute("d",
- "M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+"z");if(R instanceof THREE.MeshBasicMaterial)n.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshLambertMaterial)if(J){j.r=m.r;j.g=m.g;j.b=m.b;a(T,X,j);n.r=R.color.r*j.r;n.g=R.color.g*j.g;n.b=R.color.b*j.b;n.updateStyleString()}else n.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshDepthMaterial){p=1-R.__2near/(R.__farPlusNear-
- X.z*R.__farMinusNear);n.setRGB(p,p,p)}else R instanceof THREE.MeshNormalMaterial&&n.setRGB(g(X.normalWorld.x),g(X.normalWorld.y),g(X.normalWorld.z));R.wireframe?E.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+R.wireframe_linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframe_linecap+"; stroke-linejoin: "+R.wireframe_linejoin):E.setAttribute("style","fill: "+n.__styleString+"; fill-opacity: "+R.opacity);c.appendChild(E)}function d(W,P,da,X,R,T,ba){E=
- e(A++);E.setAttribute("d","M "+W.positionScreen.x+" "+W.positionScreen.y+" L "+P.positionScreen.x+" "+P.positionScreen.y+" L "+da.positionScreen.x+","+da.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");if(T instanceof THREE.MeshBasicMaterial)n.__styleString=T.color.__styleString;else if(T instanceof THREE.MeshLambertMaterial)if(J){j.r=m.r;j.g=m.g;j.b=m.b;a(ba,R,j);n.r=T.color.r*j.r;n.g=T.color.g*j.g;n.b=T.color.b*j.b;n.updateStyleString()}else n.__styleString=T.color.__styleString;
- else if(T instanceof THREE.MeshDepthMaterial){p=1-T.__2near/(T.__farPlusNear-R.z*T.__farMinusNear);n.setRGB(p,p,p)}else T instanceof THREE.MeshNormalMaterial&&n.setRGB(g(R.normalWorld.x),g(R.normalWorld.y),g(R.normalWorld.z));T.wireframe?E.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+T.wireframe_linewidth+"; stroke-opacity: "+T.opacity+"; stroke-linecap: "+T.wireframe_linecap+"; stroke-linejoin: "+T.wireframe_linejoin):E.setAttribute("style","fill: "+n.__styleString+
- "; fill-opacity: "+T.opacity);c.appendChild(E)}function e(W){if(y[W]==null){y[W]=document.createElementNS("http://www.w3.org/2000/svg","path");U==0&&y[W].setAttribute("shape-rendering","crispEdges");return y[W]}return y[W]}function g(W){return W<0?Math.min((1+W)*0.5,0.5):0.5+Math.min(W*0.5,0.5)}var f=null,h=new THREE.Projector,c=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,q,C,o,v,x,t,H=new THREE.Rectangle,w=new THREE.Rectangle,J=false,n=new THREE.Color(16777215),j=new THREE.Color(16777215),
- m=new THREE.Color(0),B=new THREE.Color(0),u=new THREE.Color(0),p,M=new THREE.Vector3,y=[],D=[],F=[],E,A,O,K,U=1;this.domElement=c;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(W){switch(W){case "high":U=1;break;case "low":U=0}};this.setSize=function(W,P){k=W;l=P;q=k/2;C=l/2;c.setAttribute("viewBox",-q+" "+-C+" "+k+" "+l);c.setAttribute("width",k);c.setAttribute("height",l);H.set(-q,-C,q,C)};this.clear=function(){for(;c.childNodes.length>0;)c.removeChild(c.childNodes[0])};
- this.render=function(W,P){var da,X,R,T,ba,Y,G,S;this.autoClear&&this.clear();f=h.projectScene(W,P,this.sortElements);K=O=A=0;if(J=W.lights.length>0){G=W.lights;m.setRGB(0,0,0);B.setRGB(0,0,0);u.setRGB(0,0,0);da=0;for(X=G.length;da<X;da++){R=G[da];T=R.color;if(R instanceof THREE.AmbientLight){m.r+=T.r;m.g+=T.g;m.b+=T.b}else if(R instanceof THREE.DirectionalLight){B.r+=T.r;B.g+=T.g;B.b+=T.b}else if(R instanceof THREE.PointLight){u.r+=T.r;u.g+=T.g;u.b+=T.b}}}da=0;for(X=f.length;da<X;da++){G=f[da];w.empty();
- if(G instanceof THREE.RenderableParticle){o=G;o.x*=q;o.y*=-C;R=0;for(T=G.materials.length;R<T;R++)if(S=G.materials[R]){ba=o;Y=G;S=S;var V=O++;if(D[V]==null){D[V]=document.createElementNS("http://www.w3.org/2000/svg","circle");U==0&&D[V].setAttribute("shape-rendering","crispEdges")}E=D[V];E.setAttribute("cx",ba.x);E.setAttribute("cy",ba.y);E.setAttribute("r",Y.scale.x*q);if(S instanceof THREE.ParticleCircleMaterial){if(J){j.r=m.r+B.r+u.r;j.g=m.g+B.g+u.g;j.b=m.b+B.b+u.b;n.r=S.color.r*j.r;n.g=S.color.g*
- j.g;n.b=S.color.b*j.b;n.updateStyleString()}else n=S.color;E.setAttribute("style","fill: "+n.__styleString)}c.appendChild(E)}}else if(G instanceof THREE.RenderableLine){o=G.v1;v=G.v2;o.positionScreen.x*=q;o.positionScreen.y*=-C;v.positionScreen.x*=q;v.positionScreen.y*=-C;w.addPoint(o.positionScreen.x,o.positionScreen.y);w.addPoint(v.positionScreen.x,v.positionScreen.y);if(H.instersects(w)){R=0;for(T=G.materials.length;R<T;)if(S=G.materials[R++]){ba=o;Y=v;S=S;V=K++;if(F[V]==null){F[V]=document.createElementNS("http://www.w3.org/2000/svg",
- "line");U==0&&F[V].setAttribute("shape-rendering","crispEdges")}E=F[V];E.setAttribute("x1",ba.positionScreen.x);E.setAttribute("y1",ba.positionScreen.y);E.setAttribute("x2",Y.positionScreen.x);E.setAttribute("y2",Y.positionScreen.y);if(S instanceof THREE.LineBasicMaterial){n.__styleString=S.color.__styleString;E.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+S.linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.linecap+"; stroke-linejoin: "+S.linejoin);
- c.appendChild(E)}}}}else if(G instanceof THREE.RenderableFace3){o=G.v1;v=G.v2;x=G.v3;o.positionScreen.x*=q;o.positionScreen.y*=-C;v.positionScreen.x*=q;v.positionScreen.y*=-C;x.positionScreen.x*=q;x.positionScreen.y*=-C;w.addPoint(o.positionScreen.x,o.positionScreen.y);w.addPoint(v.positionScreen.x,v.positionScreen.y);w.addPoint(x.positionScreen.x,x.positionScreen.y);if(H.instersects(w)){R=0;for(T=G.meshMaterials.length;R<T;){S=G.meshMaterials[R++];if(S instanceof THREE.MeshFaceMaterial){ba=0;for(Y=
- G.faceMaterials.length;ba<Y;)(S=G.faceMaterials[ba++])&&b(o,v,x,G,S,W)}else S&&b(o,v,x,G,S,W)}}}else if(G instanceof THREE.RenderableFace4){o=G.v1;v=G.v2;x=G.v3;t=G.v4;o.positionScreen.x*=q;o.positionScreen.y*=-C;v.positionScreen.x*=q;v.positionScreen.y*=-C;x.positionScreen.x*=q;x.positionScreen.y*=-C;t.positionScreen.x*=q;t.positionScreen.y*=-C;w.addPoint(o.positionScreen.x,o.positionScreen.y);w.addPoint(v.positionScreen.x,v.positionScreen.y);w.addPoint(x.positionScreen.x,x.positionScreen.y);w.addPoint(t.positionScreen.x,
- t.positionScreen.y);if(H.instersects(w)){R=0;for(T=G.meshMaterials.length;R<T;){S=G.meshMaterials[R++];if(S instanceof THREE.MeshFaceMaterial){ba=0;for(Y=G.faceMaterials.length;ba<Y;)(S=G.faceMaterials[ba++])&&d(o,v,x,t,G,S,W)}else S&&d(o,v,x,t,G,S,W)}}}}}};
- THREE.WebGLRenderer=function(a){function b(j,m){j.fragment_shader=m.fragment_shader;j.vertex_shader=m.vertex_shader;j.uniforms=Uniforms.clone(m.uniforms)}function d(j,m){j.uniforms.color.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);j.uniforms.opacity.value=j.opacity;j.uniforms.map.texture=j.map;j.uniforms.env_map.texture=j.env_map;j.uniforms.reflectivity.value=j.reflectivity;j.uniforms.refraction_ratio.value=j.refraction_ratio;j.uniforms.combine.value=j.combine;j.uniforms.useRefract.value=
- j.env_map&&j.env_map.mapping instanceof THREE.CubeRefractionMapping;if(m){j.uniforms.fogColor.value.setHex(m.color.hex);if(m instanceof THREE.Fog){j.uniforms.fogNear.value=m.near;j.uniforms.fogFar.value=m.far}else if(m instanceof THREE.FogExp2)j.uniforms.fogDensity.value=m.density}}function e(j,m){j.uniforms.color.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);j.uniforms.opacity.value=j.opacity;if(m){j.uniforms.fogColor.value.setHex(m.color.hex);if(m instanceof THREE.Fog){j.uniforms.fogNear.value=
- m.near;j.uniforms.fogFar.value=m.far}else if(m instanceof THREE.FogExp2)j.uniforms.fogDensity.value=m.density}}function g(j,m){var B;if(j=="fragment")B=c.createShader(c.FRAGMENT_SHADER);else if(j=="vertex")B=c.createShader(c.VERTEX_SHADER);c.shaderSource(B,m);c.compileShader(B);if(!c.getShaderParameter(B,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(B));return null}return B}function f(j){switch(j){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;
- case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return c.BYTE;case THREE.UnsignedByteType:return c.UNSIGNED_BYTE;case THREE.ShortType:return c.SHORT;case THREE.UnsignedShortType:return c.UNSIGNED_SHORT;
- case THREE.IntType:return c.INT;case THREE.UnsignedShortType:return c.UNSIGNED_INT;case THREE.FloatType:return c.FLOAT;case THREE.AlphaFormat:return c.ALPHA;case THREE.RGBFormat:return c.RGB;case THREE.RGBAFormat:return c.RGBA;case THREE.LuminanceFormat:return c.LUMINANCE;case THREE.LuminanceAlphaFormat:return c.LUMINANCE_ALPHA}return 0}var h=document.createElement("canvas"),c,k=null,l=null,q=new THREE.Matrix4,C,o=new Float32Array(16),v=new Float32Array(16),x=new Float32Array(16),t=new Float32Array(9),
- H=new Float32Array(16),w=true,J=new THREE.Color(0),n=0;if(a){if(a.antialias!==undefined)w=a.antialias;a.clearColor!==undefined&&J.setHex(a.clearColor);if(a.clearAlpha!==undefined)n=a.clearAlpha}this.domElement=h;this.autoClear=true;(function(j,m,B){try{c=h.getContext("experimental-webgl",{antialias:j})}catch(u){}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);c.cullFace(c.BACK);
- c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(m.r,m.g,m.b,B)})(w,J,n);this.context=c;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(j,m){h.width=j;h.height=m;c.viewport(0,0,h.width,h.height)};this.setClearColor=function(j,m){var B=new THREE.Color(j);c.clearColor(B.r,B.g,B.b,m)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=
- function(j,m){var B,u,p,M=0,y=0,D=0,F,E,A,O=this.lights,K=O.directional.colors,U=O.directional.positions,W=O.point.colors,P=O.point.positions,da=0,X=0;B=0;for(u=m.length;B<u;B++){p=m[B];F=p.color;E=p.position;A=p.intensity;if(p instanceof THREE.AmbientLight){M+=F.r;y+=F.g;D+=F.b}else if(p instanceof THREE.DirectionalLight){K[da*3]=F.r*A;K[da*3+1]=F.g*A;K[da*3+2]=F.b*A;U[da*3]=E.x;U[da*3+1]=E.y;U[da*3+2]=E.z;da+=1}else if(p instanceof THREE.PointLight){W[X*3]=F.r*A;W[X*3+1]=F.g*A;W[X*3+2]=F.b*A;P[X*
- 3]=E.x;P[X*3+1]=E.y;P[X*3+2]=E.z;X+=1}}O.point.length=X;O.directional.length=da;O.ambient[0]=M;O.ambient[1]=y;O.ambient[2]=D};this.createParticleBuffers=function(j){j.__webGLVertexBuffer=c.createBuffer();j.__webGLFaceBuffer=c.createBuffer()};this.createLineBuffers=function(j){j.__webGLVertexBuffer=c.createBuffer();j.__webGLLineBuffer=c.createBuffer()};this.createMeshBuffers=function(j){j.__webGLVertexBuffer=c.createBuffer();j.__webGLNormalBuffer=c.createBuffer();j.__webGLTangentBuffer=c.createBuffer();
- j.__webGLUVBuffer=c.createBuffer();j.__webGLFaceBuffer=c.createBuffer();j.__webGLLineBuffer=c.createBuffer()};this.initLineBuffers=function(j){var m=j.vertices.length;j.__vertexArray=new Float32Array(m*3);j.__lineArray=new Uint16Array(m);j.__webGLLineCount=m};this.initMeshBuffers=function(j,m){var B,u,p=0,M=0,y=0,D=m.geometry.faces,F=j.faces;B=0;for(u=F.length;B<u;B++){fi=F[B];face=D[fi];if(face instanceof THREE.Face3){p+=3;M+=1;y+=3}else if(face instanceof THREE.Face4){p+=4;M+=2;y+=4}}j.__vertexArray=
- new Float32Array(p*3);j.__normalArray=new Float32Array(p*3);j.__tangentArray=new Float32Array(p*4);j.__uvArray=new Float32Array(p*2);j.__faceArray=new Uint16Array(M*3);j.__lineArray=new Uint16Array(y*2);p=false;B=0;for(u=m.materials.length;B<u;B++){D=m.materials[B];if(D instanceof THREE.MeshFaceMaterial){D=0;for(F=j.materials.length;D<F;D++)if(j.materials[D]&&j.materials[D].shading!=undefined&&j.materials[D].shading==THREE.SmoothShading){p=true;break}}else if(D&&D.shading!=undefined&&D.shading==THREE.SmoothShading){p=
- true;break}if(p)break}j.__needsSmoothNormals=p;j.__webGLFaceCount=M*3;j.__webGLLineCount=y*2};this.setMeshBuffers=function(j,m,B,u,p,M,y,D){var F,E,A,O,K,U,W,P,da,X=0,R=0,T=0,ba=0,Y=0,G=0,S=0,V=j.__vertexArray,ia=j.__uvArray,ha=j.__normalArray,z=j.__tangentArray,L=j.__faceArray,I=j.__lineArray,Z=j.__needsSmoothNormals,ca=m.geometry,ga=ca.vertices,ja=j.faces,qa=ca.faces,sa=ca.uvs;m=0;for(F=ja.length;m<F;m++){E=ja[m];A=qa[E];E=sa[E];O=A.vertexNormals;K=A.normal;if(A instanceof THREE.Face3){if(u){U=
- ga[A.a].position;W=ga[A.b].position;P=ga[A.c].position;V[R]=U.x;V[R+1]=U.y;V[R+2]=U.z;V[R+3]=W.x;V[R+4]=W.y;V[R+5]=W.z;V[R+6]=P.x;V[R+7]=P.y;V[R+8]=P.z;R+=9}if(D&&ca.hasTangents){U=ga[A.a].tangent;W=ga[A.b].tangent;P=ga[A.c].tangent;z[G]=U.x;z[G+1]=U.y;z[G+2]=U.z;z[G+3]=U.w;z[G+4]=W.x;z[G+5]=W.y;z[G+6]=W.z;z[G+7]=W.w;z[G+8]=P.x;z[G+9]=P.y;z[G+10]=P.z;z[G+11]=P.w;G+=12}if(y)if(O.length==3&&Z)for(A=0;A<3;A++){K=O[A];ha[Y]=K.x;ha[Y+1]=K.y;ha[Y+2]=K.z;Y+=3}else for(A=0;A<3;A++){ha[Y]=K.x;ha[Y+1]=K.y;
- ha[Y+2]=K.z;Y+=3}if(M&&E)for(A=0;A<3;A++){O=E[A];ia[T]=O.u;ia[T+1]=O.v;T+=2}if(p){L[ba]=X;L[ba+1]=X+1;L[ba+2]=X+2;ba+=3;I[S]=X;I[S+1]=X+1;I[S+2]=X;I[S+3]=X+2;I[S+4]=X+1;I[S+5]=X+2;S+=6;X+=3}}else if(A instanceof THREE.Face4){if(u){U=ga[A.a].position;W=ga[A.b].position;P=ga[A.c].position;da=ga[A.d].position;V[R]=U.x;V[R+1]=U.y;V[R+2]=U.z;V[R+3]=W.x;V[R+4]=W.y;V[R+5]=W.z;V[R+6]=P.x;V[R+7]=P.y;V[R+8]=P.z;V[R+9]=da.x;V[R+10]=da.y;V[R+11]=da.z;R+=12}if(D&&ca.hasTangents){U=ga[A.a].tangent;W=ga[A.b].tangent;
- P=ga[A.c].tangent;A=ga[A.d].tangent;z[G]=U.x;z[G+1]=U.y;z[G+2]=U.z;z[G+3]=U.w;z[G+4]=W.x;z[G+5]=W.y;z[G+6]=W.z;z[G+7]=W.w;z[G+8]=P.x;z[G+9]=P.y;z[G+10]=P.z;z[G+11]=P.w;z[G+12]=A.x;z[G+13]=A.y;z[G+14]=A.z;z[G+15]=A.w;G+=16}if(y)if(O.length==4&&Z)for(A=0;A<4;A++){K=O[A];ha[Y]=K.x;ha[Y+1]=K.y;ha[Y+2]=K.z;Y+=3}else for(A=0;A<4;A++){ha[Y]=K.x;ha[Y+1]=K.y;ha[Y+2]=K.z;Y+=3}if(M&&E)for(A=0;A<4;A++){O=E[A];ia[T]=O.u;ia[T+1]=O.v;T+=2}if(p){L[ba]=X;L[ba+1]=X+1;L[ba+2]=X+2;L[ba+3]=X;L[ba+4]=X+2;L[ba+5]=X+3;ba+=
- 6;I[S]=X;I[S+1]=X+1;I[S+2]=X;I[S+3]=X+3;I[S+4]=X+1;I[S+5]=X+2;I[S+6]=X+2;I[S+7]=X+3;S+=8;X+=4}}}if(u){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,V,B)}if(y){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,ha,B)}if(D&&ca.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,z,B)}if(M&&T>0){c.bindBuffer(c.ARRAY_BUFFER,j.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,ia,B)}if(p){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
- j.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,L,B);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,I,B)}};this.setLineBuffers=function(j,m,B,u){var p,M,y=j.vertices,D=y.length,F=j.__vertexArray,E=j.__lineArray;if(B)for(B=0;B<D;B++){p=y[B].position;M=B*3;F[M]=p.x;F[M+1]=p.y;F[M+2]=p.z}if(u)for(B=0;B<D;B++)E[B]=B;c.bindBuffer(c.ARRAY_BUFFER,j.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,F,m);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,j.__webGLLineBuffer);
- c.bufferData(c.ELEMENT_ARRAY_BUFFER,E,m)};this.setParticleBuffers=function(){};this.renderBuffer=function(j,m,B,u,p,M){var y,D,F,E;if(!u.program){if(u instanceof THREE.MeshDepthMaterial){b(u,THREE.ShaderLib.depth);u.uniforms.mNear.value=j.near;u.uniforms.mFar.value=j.far}else if(u instanceof THREE.MeshNormalMaterial)b(u,THREE.ShaderLib.normal);else if(u instanceof THREE.MeshBasicMaterial){b(u,THREE.ShaderLib.basic);d(u,B)}else if(u instanceof THREE.MeshLambertMaterial){b(u,THREE.ShaderLib.lambert);
- d(u,B)}else if(u instanceof THREE.MeshPhongMaterial){b(u,THREE.ShaderLib.phong);d(u,B)}else if(u instanceof THREE.LineBasicMaterial){b(u,THREE.ShaderLib.basic);e(u,B)}var A,O,K;A=E=D=0;for(O=m.length;A<O;A++){K=m[A];K instanceof THREE.DirectionalLight&&E++;K instanceof THREE.PointLight&&D++}if(D+E<=4){A=E;D=D}else{A=Math.ceil(4*E/(D+E));D=4-A}D={directional:A,point:D};E={fog:B,map:u.map,env_map:u.env_map,maxDirLights:D.directional,maxPointLights:D.point};D=u.fragment_shader;A=u.vertex_shader;O=c.createProgram();
- K=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,E.fog?"#define USE_FOG":"",E.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");E=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+E.maxDirLights,"#define MAX_POINT_LIGHTS "+E.maxPointLights,
- E.map?"#define USE_MAP":"",E.env_map?"#define USE_ENVMAP":"","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 vec2 uv;\n"].join("\n");c.attachShader(O,g("fragment",K+D));c.attachShader(O,g("vertex",E+A));c.linkProgram(O);c.getProgramParameter(O,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+
- c.getProgramParameter(O,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");O.uniforms={};O.attributes={};u.program=O;D=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(y in u.uniforms)D.push(y);y=u.program;A=0;for(O=D.length;A<O;A++){K=D[A];y.uniforms[K]=c.getUniformLocation(y,K)}y=u.program;D=["position","normal","uv","tangent"];A=0;for(O=D.length;A<O;A++){K=D[A];y.attributes[K]=c.getAttribLocation(y,K)}}y=u.program;if(y!=k){c.useProgram(y);
- k=y}this.loadCamera(y,j);this.loadMatrices(y);if(u instanceof THREE.MeshPhongMaterial||u instanceof THREE.MeshLambertMaterial){this.setupLights(y,m);j=this.lights;u.uniforms.enableLighting.value=j.directional.length+j.point.length;u.uniforms.ambientLightColor.value=j.ambient;u.uniforms.directionalLightColor.value=j.directional.colors;u.uniforms.directionalLightDirection.value=j.directional.positions;u.uniforms.pointLightColor.value=j.point.colors;u.uniforms.pointLightPosition.value=j.point.positions}if(u instanceof
- THREE.MeshBasicMaterial||u instanceof THREE.MeshLambertMaterial||u instanceof THREE.MeshPhongMaterial)d(u,B);u instanceof THREE.LineBasicMaterial&&e(u,B);if(u instanceof THREE.MeshPhongMaterial){u.uniforms.ambient.value.setRGB(u.ambient.r,u.ambient.g,u.ambient.b);u.uniforms.specular.value.setRGB(u.specular.r,u.specular.g,u.specular.b);u.uniforms.shininess.value=u.shininess}B=u.uniforms;for(F in B)if(A=y.uniforms[F]){m=B[F];D=m.type;j=m.value;if(D=="i")c.uniform1i(A,j);else if(D=="f")c.uniform1f(A,
- j);else if(D=="fv1")c.uniform1fv(A,j);else if(D=="fv")c.uniform3fv(A,j);else if(D=="v2")c.uniform2f(A,j.x,j.y);else if(D=="v3")c.uniform3f(A,j.x,j.y,j.z);else if(D=="c")c.uniform3f(A,j.r,j.g,j.b);else if(D=="t"){c.uniform1i(A,j);if(m=m.texture)if(m.image instanceof Array&&m.image.length==6){m=m;j=j;if(m.image.length==6){if(!m.image.__webGLTextureCube&&!m.image.__cubeMapInitialized&&m.image.loadCount==6){m.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,m.image.__webGLTextureCube);
- c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(D=0;D<6;++D)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,m.image[D]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);m.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+
- j);c.bindTexture(c.TEXTURE_CUBE_MAP,m.image.__webGLTextureCube)}}else{m=m;j=j;if(!m.__webGLTexture&&m.image.loaded){m.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,m.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,m.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,f(m.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,f(m.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,f(m.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,f(m.min_filter));
- c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+j);c.bindTexture(c.TEXTURE_2D,m.__webGLTexture)}}}F=y.attributes;c.bindBuffer(c.ARRAY_BUFFER,p.__webGLVertexBuffer);c.vertexAttribPointer(F.position,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.position);if(F.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLNormalBuffer);c.vertexAttribPointer(F.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.normal)}if(F.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLTangentBuffer);
- c.vertexAttribPointer(F.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.tangent)}if(F.uv>=0)if(p.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,p.__webGLUVBuffer);c.vertexAttribPointer(F.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(F.uv)}else c.disableVertexAttribArray(F.uv);if(u.wireframe||u instanceof THREE.LineBasicMaterial){F=u.wireframe_linewidth!==undefined?u.wireframe_linewidth:u.linewidth!==undefined?u.linewidth:1;u=u instanceof THREE.LineBasicMaterial&&M.type==THREE.LineStrip?
- c.LINE_STRIP:c.LINES;c.lineWidth(F);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,p.__webGLLineBuffer);c.drawElements(u,p.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,p.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,p.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(j,m,B,u,p,M,y){var D,F,E,A,O;E=0;for(A=u.materials.length;E<A;E++){D=u.materials[E];if(D instanceof THREE.MeshFaceMaterial){D=0;for(F=p.materials.length;D<F;D++)if((O=p.materials[D])&&O.blending==M&&
- O.opacity<1==y){this.setBlending(O.blending);this.renderBuffer(j,m,B,O,p,u)}}else if((O=D)&&O.blending==M&&O.opacity<1==y){this.setBlending(O.blending);this.renderBuffer(j,m,B,O,p,u)}}};this.render=function(j,m,B,u){var p,M,y,D=j.lights,F=j.fog;this.initWebGLObjects(j);u=u!==undefined?u:true;if(B&&!B.__webGLFramebuffer){B.__webGLFramebuffer=c.createFramebuffer();B.__webGLRenderbuffer=c.createRenderbuffer();B.__webGLTexture=c.createTexture();c.bindRenderbuffer(c.RENDERBUFFER,B.__webGLRenderbuffer);
- c.renderbufferStorage(c.RENDERBUFFER,c.DEPTH_COMPONENT16,B.width,B.height);c.bindTexture(c.TEXTURE_2D,B.__webGLTexture);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,f(B.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,f(B.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,f(B.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,f(B.min_filter));c.texImage2D(c.TEXTURE_2D,0,f(B.format),B.width,B.height,0,f(B.format),f(B.type),null);c.bindFramebuffer(c.FRAMEBUFFER,B.__webGLFramebuffer);
- c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,B.__webGLTexture,0);c.framebufferRenderbuffer(c.FRAMEBUFFER,c.DEPTH_ATTACHMENT,c.RENDERBUFFER,B.__webGLRenderbuffer);c.bindTexture(c.TEXTURE_2D,null);c.bindRenderbuffer(c.RENDERBUFFER,null);c.bindFramebuffer(c.FRAMEBUFFER,null)}if(B){p=B.__webGLFramebuffer;y=B.width;M=B.height}else{p=null;y=h.width;M=h.height}if(p!=l){c.bindFramebuffer(c.FRAMEBUFFER,p);c.viewport(0,0,y,M);u&&c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT);l=p}this.autoClear&&
- this.clear();m.autoUpdateMatrix&&m.updateMatrix();o.set(m.matrix.flatten());x.set(m.projectionMatrix.flatten());u=0;for(p=j.__webGLObjects.length;u<p;u++){M=j.__webGLObjects[u];y=M.object;M=M.buffer;if(y.visible){this.setupMatrices(y,m);this.renderPass(m,D,F,y,M,THREE.NormalBlending,false)}}u=0;for(p=j.__webGLObjects.length;u<p;u++){M=j.__webGLObjects[u];y=M.object;M=M.buffer;if(y.visible){this.setupMatrices(y,m);if(y.doubleSided)c.disable(c.CULL_FACE);else{c.enable(c.CULL_FACE);y.flipSided?c.frontFace(c.CW):
- c.frontFace(c.CCW)}this.renderPass(m,D,F,y,M,THREE.AdditiveBlending,false);this.renderPass(m,D,F,y,M,THREE.SubtractiveBlending,false);this.renderPass(m,D,F,y,M,THREE.AdditiveBlending,true);this.renderPass(m,D,F,y,M,THREE.SubtractiveBlending,true);this.renderPass(m,D,F,y,M,THREE.NormalBlending,true)}}if(B&&B.min_filter!==THREE.NearestFilter&&B.min_filter!==THREE.LinearFilter){c.bindTexture(c.TEXTURE_2D,B.__webGLTexture);c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}};this.initWebGLObjects=
- function(j){function m(E,A,O,K){if(E[A]==undefined){j.__webGLObjects.push({buffer:O,object:K});E[A]=1}}var B,u,p,M,y,D,F;if(!j.__webGLObjects){j.__webGLObjects=[];j.__webGLObjectsMap={}}B=0;for(u=j.objects.length;B<u;B++){p=j.objects[B];y=p.geometry;if(j.__webGLObjectsMap[p.id]==undefined)j.__webGLObjectsMap[p.id]={};F=j.__webGLObjectsMap[p.id];if(p instanceof THREE.Mesh){for(M in y.geometryChunks){D=y.geometryChunks[M];if(!D.__webGLVertexBuffer){this.createMeshBuffers(D);this.initMeshBuffers(D,p);
- y.__dirtyVertices=true;y.__dirtyElements=true;y.__dirtyUvs=true;y.__dirtyNormals=true;y.__dirtyTangents=true}if(y.__dirtyVertices||y.__dirtyElements||y.__dirtyUvs)this.setMeshBuffers(D,p,c.DYNAMIC_DRAW,y.__dirtyVertices,y.__dirtyElements,y.__dirtyUvs,y.__dirtyNormals,y.__dirtyTangents);m(F,M,D,p)}y.__dirtyVertices=false;y.__dirtyElements=false;y.__dirtyUvs=false;y.__dirtyNormals=false;y.__dirtyTangents=false}else if(p instanceof THREE.Line){if(!y.__webGLVertexBuffer){this.createLineBuffers(y);this.initLineBuffers(y);
- y.__dirtyVertices=true;y.__dirtyElements=true}y.__dirtyVertices&&this.setLineBuffers(y,c.DYNAMIC_DRAW,y.__dirtyVertices,y.__dirtyElements);m(F,0,y,p);y.__dirtyVertices=false;y.__dirtyElements=false}else if(p instanceof THREE.ParticleSystem){y.__webGLVertexBuffer||this.createParticleBuffers(y);m(F,0,y,p)}}};this.removeObject=function(j,m){var B,u;for(B=j.__webGLObjects.length-1;B>=0;B--){u=j.__webGLObjects[B].object;m==u&&j.__webGLObjects.splice(B,1)}};this.setupMatrices=function(j,m){j.autoUpdateMatrix&&
- j.updateMatrix();q.multiply(m.matrix,j.matrix);v.set(q.flatten());C=THREE.Matrix4.makeInvert3x3(q).transpose();t.set(C.m);H.set(j.matrix.flatten())};this.loadMatrices=function(j){c.uniformMatrix4fv(j.uniforms.viewMatrix,false,o);c.uniformMatrix4fv(j.uniforms.modelViewMatrix,false,v);c.uniformMatrix4fv(j.uniforms.projectionMatrix,false,x);c.uniformMatrix3fv(j.uniforms.normalMatrix,false,t);c.uniformMatrix4fv(j.uniforms.objectMatrix,false,H)};this.loadCamera=function(j,m){c.uniform3f(j.uniforms.cameraPosition,
- m.position.x,m.position.y,m.position.z)};this.setBlending=function(j){switch(j){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(j,m){if(j){!m||m=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(j=="back")c.cullFace(c.BACK);else j=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);
- c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.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, 1.0 ), 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\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\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_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\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\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 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"};
- THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,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:[]}}};
- THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\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 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",
- THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
- THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,
- THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_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 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,
- "gl_FragColor = mapColor * totalLight * vec4( vLightWeighting, 1.0 );",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.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_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")}};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};
- var GeometryUtils={merge:function(a,b){var d=b instanceof THREE.Mesh,e=a.vertices.length,g=d?b.geometry:b,f=a.vertices,h=g.vertices,c=a.faces,k=g.faces,l=a.uvs;g=g.uvs;d&&b.autoUpdateMatrix&&b.updateMatrix();for(var q=0,C=h.length;q<C;q++){var o=new THREE.Vertex(h[q].position.clone());d&&b.matrix.multiplyVector3(o.position);f.push(o)}q=0;for(C=k.length;q<C;q++){h=k[q];var v,x=h.vertexNormals;if(h instanceof THREE.Face3)v=new THREE.Face3(h.a+e,h.b+e,h.c+e);else if(h instanceof THREE.Face4)v=new THREE.Face4(h.a+
- e,h.b+e,h.c+e,h.d+e);v.centroid.copy(h.centroid);v.normal.copy(h.normal);d=0;for(f=x.length;d<f;d++){o=x[d];v.vertexNormals.push(o.clone())}v.materials=h.materials.slice();c.push(v)}q=0;for(C=g.length;q<C;q++){e=g[q];c=[];d=0;for(f=e.length;d<f;d++)c.push(new THREE.UV(e[d].u,e[d].v));l.push(c)}}},ImageUtils={loadTexture:function(a,b,d){var e=new Image;e.onload=function(){this.loaded=true;d&&d(this)};e.src=a;return new THREE.Texture(e,b)},loadArray:function(a,b){var d,e,g=[];d=g.loadCount=0;for(e=
- a.length;d<e;++d){g[d]=new Image;g[d].loaded=0;g[d].onload=function(){g.loadCount+=1;this.loaded=true;b&&b(this)};g[d].src=a[d]}return g}},SceneUtils={loadScene:function(a,b,d){a=new Worker(a);a.postMessage(0);a.onmessage=function(e){function g(){for(k in m.objects)if(!p.objects[k]){v=m.objects[k];if(H=p.geometries[v.geometry]){j=[];for(i=0;i<v.materials.length;i++)j[i]=p.materials[v.materials[i]];x=v.position;r=v.rotation;s=v.scale;object=new THREE.Mesh(H,j);object.position.set(x[0],x[1],x[2]);object.rotation.set(r[0],
- r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=v.visible;p.scene.addObject(object);p.objects[k]=object}}}function f(M){return function(y){p.geometries[M]=y;g();B-=1;B==0&&u==0&&d(p)}}var h,c,k,l,q,C,o,v,x,t,H,w,J,n,j,m,B,u,p;m=e.data;n=new THREE.Loader;u=B=0;p={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};for(h in m.geometries){e=m.geometries[h];if(e.type=="bin_mesh"||e.type=="ascii_mesh")B+=1}for(h in m.geometries){e=m.geometries[h];
- if(e.type=="cube"){H=new Cube(e.width,e.height,e.depth,e.segments_width,e.segments_height,null,e.flipped,e.sides);p.geometries[h]=H}else if(e.type=="plane"){H=new Plane(e.width,e.height,e.segments_width,e.segments_height);p.geometries[h]=H}else if(e.type=="sphere"){H=new Sphere(e.radius,e.segments_width,e.segments_height);p.geometries[h]=H}else if(e.type=="cylinder"){H=new Cylinder(e.numSegs,e.topRad,e.botRad,e.height,e.topOffset,e.botOffset);p.geometries[h]=H}else if(e.type=="torus"){H=new Torus(e.radius,
- e.tube,e.segmentsR,e.segmentsT);p.geometries[h]=H}else if(e.type=="icosahedron"){H=new Icosahedron(e.subdivisions);p.geometries[h]=H}else if(e.type=="bin_mesh")n.loadBinary({model:e.url,callback:f(h)});else e.type=="ascii_mesh"&&n.loadAscii({model:e.url,callback:f(h)})}for(o in m.textures){h=m.textures[o];u+=h.url instanceof Array?h.url.length:1}e=function(){u-=1;B==0&&u==0&&d(p)};for(o in m.textures){h=m.textures[o];if(h.mapping!=undefined&&THREE[h.mapping]!=undefined)h.mapping=new THREE[h.mapping];
- if(h.url instanceof Array){n=ImageUtils.loadArray(h.url,e);n=new THREE.Texture(n,h.mapping)}else{n=ImageUtils.loadTexture(h.url,h.mapping,e);if(THREE[h.min_filter]!=undefined)n.min_filter=THREE[h.min_filter];if(THREE[h.mag_filter]!=undefined)n.mag_filter=THREE[h.mag_filter]}p.textures[o]=n}for(c in m.materials){o=m.materials[c];for(t in o.parameters)if(t=="env_map"||t=="map")o.parameters[t]=p.textures[o.parameters[t]];else if(t=="shading")o.parameters[t]=o.parameters[t]=="flat"?THREE.FlatShading:
- THREE.SmoothShading;else if(t=="combine")o.parameters[t]=o.parameters[t]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;o=new THREE[o.type](o.parameters);p.materials[c]=o}g();for(l in m.lights){c=m.lights[l];if(c.type=="directional"){x=c.direction;light=new THREE.DirectionalLight;light.position.set(x[0],x[1],x[2]);light.position.normalize()}else if(c.type=="point"){x=c.position;light=new THREE.PointLight;light.position.set(x[0],x[1],x[2])}t=c.color;i=c.intensity||1;light.color.setRGB(t[0]*
- i,t[1]*i,t[2]*i);p.scene.addLight(light);p.lights[l]=light}for(q in m.cameras){t=m.cameras[q];if(t.type=="perspective")w=new THREE.Camera(t.fov,t.aspect,t.near,t.far);else if(t.type=="ortho"){w=new THREE.Camera;w.projectionMatrix=THREE.Matrix4.makeOrtho(t.left,t.right,t.top,t.bottom,t.near,t.far)}x=t.position;l=t.target;w.position.set(x[0],x[1],x[2]);w.target.position.set(l[0],l[1],l[2]);p.cameras[q]=w}for(C in m.fogs){q=m.fogs[C];if(q.type=="linear")J=new THREE.Fog(0,q.near,q.far);else if(q.type==
- "exp2")J=new THREE.FogExp2(0,q.density);t=q.color;J.color.setRGB(t[0],t[1],t[2]);p.fogs[C]=J}if(p.cameras&&m.defaults.camera)p.currentCamera=p.cameras[m.defaults.camera];if(p.fogs&&m.defaults.fog)p.scene.fog=p.fogs[m.defaults.fog];t=m.defaults.bgcolor;p.bgColor=new THREE.Color;p.bgColor.setRGB(t[0],t[1],t[2]);p.bgColorAlpha=m.defaults.bgalpha;b(p)}},addMesh:function(a,b,d,e,g,f,h,c,k,l){b=new THREE.Mesh(b,l);b.scale.x=b.scale.y=b.scale.z=d;b.position.x=e;b.position.y=g;b.position.z=f;b.rotation.x=
- h;b.rotation.y=c;b.rotation.z=k;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,d){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=d;d=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),d);a.addObject(b);return b},addPanoramaCube:function(a,b,d){var e=[];e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));
- e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[3])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[4])}));e.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(d[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,d){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(d[5])}));
- SceneUtils.addMesh(a,b,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));SceneUtils.addMesh(a,b,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));SceneUtils.addMesh(a,b,1,0,e,0,g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));SceneUtils.addMesh(a,b,1,0,-e,0,-g,0,f,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[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(void) {\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}"},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}"}}},Cube=function(a,b,d,e,g,f,h,c){function k(t,H,w,J,n,j,m,B){var u,p,M=e||1,y=g||1,D=M+1,F=y+1,E=n/2,A=j/2;n=n/M;var O=j/y,K=l.vertices.length;if(t=="x"&&H=="y"||t=="y"&&H=="x")u="z";else if(t=="x"&&H=="z"||t=="z"&&H=="x")u="y";else if(t=="z"&&H=="y"||t=="y"&&H=="z")u="x";for(p=0;p<F;p++)for(j=0;j<D;j++){var U=new THREE.Vector3;
- U[t]=(j*n-E)*w;U[H]=(p*O-A)*J;U[u]=m;l.vertices.push(new THREE.Vertex(U))}for(p=0;p<y;p++)for(j=0;j<M;j++){l.faces.push(new THREE.Face4(j+D*p+K,j+D*(p+1)+K,j+1+D*(p+1)+K,j+1+D*p+K,null,B));l.uvs.push([new THREE.UV(j/M,p/y),new THREE.UV(j/M,(p+1)/y),new THREE.UV((j+1)/M,(p+1)/y),new THREE.UV((j+1)/M,p/y)])}}THREE.Geometry.call(this);var l=this,q=a/2,C=b/2,o=d/2;h=h?-1:1;if(f!==undefined)if(f instanceof Array)this.materials=f;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([f])}else this.materials=
- [];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(c!=undefined)for(var x in c)if(this.sides[x]!=undefined)this.sides[x]=c[x];this.sides.px&&k("z","y",1*h,-1,d,b,-q,this.materials[0]);this.sides.nx&&k("z","y",-1*h,-1,d,b,q,this.materials[1]);this.sides.py&&k("x","z",1*h,1,a,d,C,this.materials[2]);this.sides.ny&&k("x","z",1*h,-1,a,d,-C,this.materials[3]);this.sides.pz&&k("x","y",1*h,-1,a,b,o,this.materials[4]);this.sides.nz&&k("x","y",-1*h,-1,a,b,-o,this.materials[5]);(function(){for(var t=
- [],H=[],w=0,J=l.vertices.length;w<J;w++){for(var n=l.vertices[w],j=false,m=0,B=t.length;m<B;m++){var u=t[m];if(n.position.x==u.position.x&&n.position.y==u.position.y&&n.position.z==u.position.z){H[w]=m;j=true;break}}if(!j){H[w]=t.length;t.push(new THREE.Vertex(n.position.clone()))}}w=0;for(J=l.faces.length;w<J;w++){n=l.faces[w];n.a=H[n.a];n.b=H[n.b];n.c=H[n.c];n.d=H[n.d]}l.vertices=t})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;
- Cube.prototype.constructor=Cube;
- var Cylinder=function(a,b,d,e,g){function f(l,q,C){h.vertices.push(new THREE.Vertex(new THREE.Vector3(l,q,C)))}THREE.Geometry.call(this);var h=this,c=Math.PI,k;for(k=0;k<a;k++)f(Math.sin(2*c*k/a)*b,Math.cos(2*c*k/a)*b,0);for(k=0;k<a;k++)f(Math.sin(2*c*k/a)*d,Math.cos(2*c*k/a)*d,e);for(k=0;k<a;k++)h.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(d!=0){f(0,0,-g);for(k=a;k<a+a/2;k++)h.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(b!=0){f(0,0,e+g);for(k=a+a/2;k<
- 2*a;k++)h.faces.push(new THREE.Face4((2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-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,d,e){THREE.Geometry.call(this);var g,f=a/2,h=b/2;d=d||1;e=e||1;var c=d+1,k=e+1;a=a/d;var l=b/e;for(g=0;g<k;g++)for(b=0;b<c;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-f,-(g*l-h),0)));for(g=0;g<e;g++)for(b=0;b<d;b++){this.faces.push(new THREE.Face4(b+c*g,b+c*(g+1),b+1+c*(g+1),b+1+c*g));this.uvs.push([new THREE.UV(b/d,g/e),new THREE.UV(b/d,(g+1)/e),new THREE.UV((b+1)/d,(g+1)/e),new THREE.UV((b+1)/d,g/e)])}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
- Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
- var Sphere=function(a,b,d){THREE.Geometry.call(this);var e,g=Math.PI,f=Math.max(3,b||8),h=Math.max(2,d||6);b=[];for(d=0;d<h+1;d++){e=d/h;var c=a*Math.cos(e*g),k=a*Math.sin(e*g),l=[],q=0;for(e=0;e<f;e++){var C=2*e/f,o=k*Math.sin(C*g);C=k*Math.cos(C*g);(d==0||d==h)&&e>0||(q=this.vertices.push(new THREE.Vertex(new THREE.Vector3(C,c,o)))-1);l.push(q)}b.push(l)}var v,x,t;g=b.length;for(d=0;d<g;d++){f=b[d].length;if(d>0)for(e=0;e<f;e++){l=e==f-1;h=b[d][l?0:e+1];c=b[d][l?f-1:e];k=b[d-1][l?f-1:e];l=b[d-1][l?
- 0:e+1];o=d/(g-1);v=(d-1)/(g-1);x=(e+1)/f;C=e/f;q=new THREE.UV(1-x,o);o=new THREE.UV(1-C,o);C=new THREE.UV(1-C,v);var H=new THREE.UV(1-x,v);if(d<b.length-1){v=this.vertices[h].position.clone();x=this.vertices[c].position.clone();t=this.vertices[k].position.clone();v.normalize();x.normalize();t.normalize();this.faces.push(new THREE.Face3(h,c,k,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(t.x,t.y,t.z)]));this.uvs.push([q,o,C])}if(d>1){v=this.vertices[h].position.clone();
- x=this.vertices[k].position.clone();t=this.vertices[l].position.clone();v.normalize();x.normalize();t.normalize();this.faces.push(new THREE.Face3(h,k,l,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(t.x,t.y,t.z)]));this.uvs.push([q,C,H])}}}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,d,e){this.radius=a||100;this.tube=b||40;this.segmentsR=d||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(b=0;b<=this.segmentsR;++b)for(d=0;d<=this.segmentsT;++d){e=d/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([d/this.segmentsT,1-b/this.segmentsR])}for(b=1;b<=this.segmentsR;++b)for(d=
- 1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*b+d;g=(this.segmentsT+1)*b+d-1;var f=(this.segmentsT+1)*(b-1)+d-1,h=(this.segmentsT+1)*(b-1)+d;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(C,o,v){var x=Math.sqrt(C*C+o*o+v*v);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(C/x,o/x,v/x)))-1}function d(C,o,v,x){x.faces.push(new THREE.Face3(C,o,v))}function e(C,o){var v=g.vertices[C].position,x=g.vertices[o].position;return b((v.x+x.x)/2,(v.y+x.y)/2,(v.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);d(0,11,5,f);d(0,5,1,f);d(0,1,7,f);d(0,7,10,f);d(0,10,11,f);d(1,5,9,f);d(5,11,4,f);d(11,10,2,f);d(10,7,6,f);d(7,1,8,f);d(3,9,4,f);d(3,4,2,f);d(3,2,6,f);d(3,6,8,f);d(3,8,9,f);d(4,9,5,f);d(2,4,11,f);d(6,2,10,f);d(8,6,7,f);d(9,8,1,f);for(a=0;a<this.subdivisions;a++){h=new THREE.Geometry;for(var c in f.faces){var k=e(f.faces[c].a,f.faces[c].b),l=e(f.faces[c].b,f.faces[c].c),q=e(f.faces[c].c,f.faces[c].a);d(f.faces[c].a,k,q,h);d(f.faces[c].b,l,k,h);d(f.faces[c].c,
- q,l,h);d(k,l,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,d){THREE.Geometry.call(this);b=b||12;d=d||2*Math.PI;b=d/b;for(var e=[],g=[],f=[],h=[],c=0;c<a.length;c++){this.vertices.push(new THREE.Vertex(a[c]));g[c]=this.vertices.length-1;e[c]=new THREE.Vector3(a[c].x,a[c].y,a[c].z)}for(var k=THREE.Matrix4.rotationZMatrix(b),l=0;l<=d+0.0010;l+=b){for(c=0;c<e.length;c++)if(l<d){e[c]=k.multiplyVector3(e[c].clone());this.vertices.push(new THREE.Vertex(e[c]));f[c]=this.vertices.length-1}else f=h;if(l==0)h=g;for(c=0;c<g.length-1;c++){this.faces.push(new THREE.Face4(f[c],
- f[c+1],g[c+1],g[c]));this.uvs.push([new THREE.UV(l/d,c/a.length),new THREE.UV(l/d,(c+1)/a.length),new THREE.UV((l-b)/d,(c+1)/a.length),new THREE.UV((l-b)/d,c/a.length)])}g=f;f=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;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 d=document.createElement("script");d.type="text/javascript";d.onload=b;d.src=a;document.getElementsByTagName("head")[0].appendChild(d)},loadAscii:function(a){var b=a.model,d=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,d,e)};b.postMessage(a)},loadBinary:function(a){var b=a.model,d=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,d,g,e,f)};b.onerror=function(h){alert("worker.onerror: "+h.message+"\n"+h.data);h.preventDefault()};b.postMessage(a)},loadAjaxBuffers:function(a,b,d,e,g,f){var h=new XMLHttpRequest,c=e+"/"+a,k=0;
- h.onreadystatechange=function(){if(h.readyState==4)h.status==200||h.status==0?THREE.Loader.prototype.createBinModel(h.responseText,d,g,b):alert("Couldn't load ["+c+"] ["+h.status+"]");else if(h.readyState==3){if(f){if(k==0)k=h.getResponseHeader("Content-Length");f({total:k,loaded:h.responseText.length})}}else if(h.readyState==2)k=h.getResponseHeader("Content-Length")};h.open("GET",c,true);h.overrideMimeType("text/plain; charset=x-user-defined");h.setRequestHeader("Content-Type","text/plain");h.send(null)},
- createBinModel:function(a,b,d,e){var g=function(f){function h(z,L){var I=q(z,L),Z=q(z,L+1),ca=q(z,L+2),ga=q(z,L+3),ja=(ga<<1&255|ca>>7)-127;I=(ca&127)<<16|Z<<8|I;if(I==0&&ja==-127)return 0;return(1-2*(ga>>7))*(1+I*Math.pow(2,-23))*Math.pow(2,ja)}function c(z,L){var I=q(z,L),Z=q(z,L+1),ca=q(z,L+2);return(q(z,L+3)<<24)+(ca<<16)+(Z<<8)+I}function k(z,L){var I=q(z,L);return(q(z,L+1)<<8)+I}function l(z,L){var I=q(z,L);return I>127?I-256:I}function q(z,L){return z.charCodeAt(L)&255}function C(z){var L,
- I,Z;L=c(a,z);I=c(a,z+B);Z=c(a,z+u);z=k(a,z+p);THREE.Loader.prototype.f3(w,L,I,Z,z)}function o(z){var L,I,Z,ca,ga,ja;L=c(a,z);I=c(a,z+B);Z=c(a,z+u);ca=k(a,z+p);ga=c(a,z+M);ja=c(a,z+y);z=c(a,z+D);THREE.Loader.prototype.f3n(w,j,L,I,Z,ca,ga,ja,z)}function v(z){var L,I,Z,ca;L=c(a,z);I=c(a,z+F);Z=c(a,z+E);ca=c(a,z+A);z=k(a,z+O);THREE.Loader.prototype.f4(w,L,I,Z,ca,z)}function x(z){var L,I,Z,ca,ga,ja,qa,sa;L=c(a,z);I=c(a,z+F);Z=c(a,z+E);ca=c(a,z+A);ga=k(a,z+O);ja=c(a,z+K);qa=c(a,z+U);sa=c(a,z+W);z=c(a,z+
- P);THREE.Loader.prototype.f4n(w,j,L,I,Z,ca,ga,ja,qa,sa,z)}function t(z){var L,I;L=c(a,z);I=c(a,z+da);z=c(a,z+X);THREE.Loader.prototype.uv3(w,m[L*2],m[L*2+1],m[I*2],m[I*2+1],m[z*2],m[z*2+1])}function H(z){var L,I,Z;L=c(a,z);I=c(a,z+R);Z=c(a,z+T);z=c(a,z+ba);THREE.Loader.prototype.uv4(w,m[L*2],m[L*2+1],m[I*2],m[I*2+1],m[Z*2],m[Z*2+1],m[z*2],m[z*2+1])}var w=this,J=0,n,j=[],m=[],B,u,p,M,y,D,F,E,A,O,K,U,W,P,da,X,R,T,ba,Y,G,S,V,ia,ha;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(w,e,f);
- n={signature:a.substr(J,8),header_bytes:q(a,J+8),vertex_coordinate_bytes:q(a,J+9),normal_coordinate_bytes:q(a,J+10),uv_coordinate_bytes:q(a,J+11),vertex_index_bytes:q(a,J+12),normal_index_bytes:q(a,J+13),uv_index_bytes:q(a,J+14),material_index_bytes:q(a,J+15),nvertices:c(a,J+16),nnormals:c(a,J+16+4),nuvs:c(a,J+16+8),ntri_flat:c(a,J+16+12),ntri_smooth:c(a,J+16+16),ntri_flat_uv:c(a,J+16+20),ntri_smooth_uv:c(a,J+16+24),nquad_flat:c(a,J+16+28),nquad_smooth:c(a,J+16+32),nquad_flat_uv:c(a,J+16+36),nquad_smooth_uv:c(a,
- J+16+40)};J+=n.header_bytes;B=n.vertex_index_bytes;u=n.vertex_index_bytes*2;p=n.vertex_index_bytes*3;M=n.vertex_index_bytes*3+n.material_index_bytes;y=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;D=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;F=n.vertex_index_bytes;E=n.vertex_index_bytes*2;A=n.vertex_index_bytes*3;O=n.vertex_index_bytes*4;K=n.vertex_index_bytes*4+n.material_index_bytes;U=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes;
- W=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;P=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;da=n.uv_index_bytes;X=n.uv_index_bytes*2;R=n.uv_index_bytes;T=n.uv_index_bytes*2;ba=n.uv_index_bytes*3;f=n.vertex_index_bytes*3+n.material_index_bytes;ha=n.vertex_index_bytes*4+n.material_index_bytes;Y=n.ntri_flat*f;G=n.ntri_smooth*(f+n.normal_index_bytes*3);S=n.ntri_flat_uv*(f+n.uv_index_bytes*3);V=n.ntri_smooth_uv*(f+n.normal_index_bytes*3+n.uv_index_bytes*
- 3);ia=n.nquad_flat*ha;f=n.nquad_smooth*(ha+n.normal_index_bytes*4);ha=n.nquad_flat_uv*(ha+n.uv_index_bytes*4);J+=function(z){var L,I,Z,ca=n.vertex_coordinate_bytes*3,ga=z+n.nvertices*ca;for(z=z;z<ga;z+=ca){L=h(a,z);I=h(a,z+n.vertex_coordinate_bytes);Z=h(a,z+n.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(w,L,I,Z)}return n.nvertices*ca}(J);J+=function(z){var L,I,Z,ca=n.normal_coordinate_bytes*3,ga=z+n.nnormals*ca;for(z=z;z<ga;z+=ca){L=l(a,z);I=l(a,z+n.normal_coordinate_bytes);Z=l(a,z+n.normal_coordinate_bytes*
- 2);j.push(L/127,I/127,Z/127)}return n.nnormals*ca}(J);J+=function(z){var L,I,Z=n.uv_coordinate_bytes*2,ca=z+n.nuvs*Z;for(z=z;z<ca;z+=Z){L=h(a,z);I=h(a,z+n.uv_coordinate_bytes);m.push(L,I)}return n.nuvs*Z}(J);J=J;Y=J+Y;G=Y+G;S=G+S;V=S+V;ia=V+ia;f=ia+f;ha=f+ha;(function(z){var L,I=n.vertex_index_bytes*3+n.material_index_bytes,Z=I+n.uv_index_bytes*3,ca=z+n.ntri_flat_uv*Z;for(L=z;L<ca;L+=Z){C(L);t(L+I)}return ca-z})(G);(function(z){var L,I=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*
- 3,Z=I+n.uv_index_bytes*3,ca=z+n.ntri_smooth_uv*Z;for(L=z;L<ca;L+=Z){o(L);t(L+I)}return ca-z})(S);(function(z){var L,I=n.vertex_index_bytes*4+n.material_index_bytes,Z=I+n.uv_index_bytes*4,ca=z+n.nquad_flat_uv*Z;for(L=z;L<ca;L+=Z){v(L);H(L+I)}return ca-z})(f);(function(z){var L,I=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,Z=I+n.uv_index_bytes*4,ca=z+n.nquad_smooth_uv*Z;for(L=z;L<ca;L+=Z){x(L);H(L+I)}return ca-z})(ha);(function(z){var L,I=n.vertex_index_bytes*3+n.material_index_bytes,
- Z=z+n.ntri_flat*I;for(L=z;L<Z;L+=I)C(L);return Z-z})(J);(function(z){var L,I=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,Z=z+n.ntri_smooth*I;for(L=z;L<Z;L+=I)o(L);return Z-z})(Y);(function(z){var L,I=n.vertex_index_bytes*4+n.material_index_bytes,Z=z+n.nquad_flat*I;for(L=z;L<Z;L+=I)v(L);return Z-z})(V);(function(z){var L,I=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,Z=z+n.nquad_smooth*I;for(L=z;L<Z;L+=I)x(L);return Z-z})(ia);this.computeCentroids();
- this.computeFaceNormals();this.sortFacesByMaterial()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;b(new g(d))},createModel:function(a,b,d){var e=function(g){var f=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(f,a.materials,g);(function(){var h,c,k,l,q;h=0;for(c=a.vertices.length;h<c;h+=3){k=a.vertices[h];l=a.vertices[h+1];q=a.vertices[h+2];THREE.Loader.prototype.v(f,k,l,q)}})();(function(){function h(x,t){THREE.Loader.prototype.f3(f,x[t],x[t+1],x[t+2],x[t+3])}function c(x,
- t){THREE.Loader.prototype.f3n(f,a.normals,x[t],x[t+1],x[t+2],x[t+3],x[t+4],x[t+5],x[t+6])}function k(x,t){THREE.Loader.prototype.f4(f,x[t],x[t+1],x[t+2],x[t+3],x[t+4])}function l(x,t){THREE.Loader.prototype.f4n(f,a.normals,x[t],x[t+1],x[t+2],x[t+3],x[t+4],x[t+5],x[t+6],x[t+7],x[t+8])}function q(x,t){var H,w,J;H=x[t];w=x[t+1];J=x[t+2];THREE.Loader.prototype.uv3(f,a.uvs[H*2],a.uvs[H*2+1],a.uvs[w*2],a.uvs[w*2+1],a.uvs[J*2],a.uvs[J*2+1])}function C(x,t){var H,w,J,n;H=x[t];w=x[t+1];J=x[t+2];n=x[t+3];THREE.Loader.prototype.uv4(f,
- a.uvs[H*2],a.uvs[H*2+1],a.uvs[w*2],a.uvs[w*2+1],a.uvs[J*2],a.uvs[J*2+1],a.uvs[n*2],a.uvs[n*2+1])}var o,v;o=0;for(v=a.triangles_uv.length;o<v;o+=7){h(a.triangles_uv,o);q(a.triangles_uv,o+4)}o=0;for(v=a.triangles_n_uv.length;o<v;o+=10){c(a.triangles_n_uv,o);q(a.triangles_n_uv,o+7)}o=0;for(v=a.quads_uv.length;o<v;o+=9){k(a.quads_uv,o);C(a.quads_uv,o+5)}o=0;for(v=a.quads_n_uv.length;o<v;o+=13){l(a.quads_n_uv,o);C(a.quads_n_uv,o+9)}o=0;for(v=a.triangles.length;o<v;o+=4)h(a.triangles,o);o=0;for(v=a.triangles_n.length;o<
- v;o+=7)c(a.triangles_n,o);o=0;for(v=a.quads.length;o<v;o+=5)k(a.quads,o);o=0;for(v=a.quads_n.length;o<v;o+=9)l(a.quads_n,o)})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(d))},v:function(a,b,d,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,d,e)))},f3:function(a,b,d,e,g){a.faces.push(new THREE.Face3(b,d,e,null,a.materials[g]))},f4:function(a,b,d,e,g,f){a.faces.push(new THREE.Face4(b,d,e,g,null,
- a.materials[f]))},f3n:function(a,b,d,e,g,f,h,c,k){f=a.materials[f];var l=b[c*3],q=b[c*3+1];c=b[c*3+2];var C=b[k*3],o=b[k*3+1];k=b[k*3+2];a.faces.push(new THREE.Face3(d,e,g,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(l,q,c),new THREE.Vector3(C,o,k)],f))},f4n:function(a,b,d,e,g,f,h,c,k,l,q){h=a.materials[h];var C=b[k*3],o=b[k*3+1];k=b[k*3+2];var v=b[l*3],x=b[l*3+1];l=b[l*3+2];var t=b[q*3],H=b[q*3+1];q=b[q*3+2];a.faces.push(new THREE.Face4(d,e,g,f,[new THREE.Vector3(b[c*3],b[c*3+1],
- b[c*3+2]),new THREE.Vector3(C,o,k),new THREE.Vector3(v,x,l),new THREE.Vector3(t,H,q)],h))},uv3:function(a,b,d,e,g,f,h){var c=[];c.push(new THREE.UV(b,d));c.push(new THREE.UV(e,g));c.push(new THREE.UV(f,h));a.uvs.push(c)},uv4:function(a,b,d,e,g,f,h,c,k){var l=[];l.push(new THREE.UV(b,d));l.push(new THREE.UV(e,g));l.push(new THREE.UV(f,h));l.push(new THREE.UV(c,k));a.uvs.push(l)},init_materials:function(a,b,d){a.materials=[];for(var e=0;e<b.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(b[e],
- d)]},createMaterial:function(a,b){function d(f){f=Math.log(f)/Math.LN2;return Math.floor(f)==f}var e,g;if(a.map_diffuse&&b){g=document.createElement("canvas");e=new THREE.MeshLambertMaterial({map:new THREE.Texture(g)});g=new Image;g.onload=function(){if(!d(this.width)||!d(this.height)){var f=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),h=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));e.map.image.width=f;e.map.image.height=h;e.map.image.getContext("2d").drawImage(this,0,0,f,h)}else e.map.image=
- this;e.map.image.loaded=1};g.src=b+"/"+a.map_diffuse}else if(a.col_diffuse){g=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*255;e=new THREE.MeshLambertMaterial({color:g,opacity:a.transparency})}else e=a.a_dbg_color?new THREE.MeshLambertMaterial({color:a.a_dbg_color}):new THREE.MeshLambertMaterial({color:15658734});return e},extractUrlbase:function(a){a=a.split("/");a.pop();return a.join("/")}};
|