| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- // ThreeExtras.js r31 - 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,e){this.r=a;this.g=b;this.b=e;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)+")"},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,e){this.x=a||0;this.y=b||0;this.z=e||0};
- THREE.Vector3.prototype={set:function(a,b,e){this.x=a;this.y=b;this.z=e;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,e=this.y,d=this.z;this.x=e*a.z-d*a.y;this.y=d*a.x-b*a.z;this.z=b*a.y-e*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},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,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+e*e+a*a)},distanceToSquared:function(a){var b=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return b*b+e*e+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,e,d){this.x=a||0;this.y=b||0;this.z=e||0;this.w=d||1};
- THREE.Vector4.prototype={set:function(a,b,e,d){this.x=a;this.y=b;this.z=e;this.w=d;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,e,d=a.objects,f=[];a=0;for(b=d.length;a<b;a++){e=d[a];if(e instanceof THREE.Mesh)f=f.concat(this.intersectObject(e))}f.sort(function(g,k){return g.distance-k.distance});return f},intersectObject:function(a){function b(J,v,E,n){n=n.clone().subSelf(v);E=E.clone().subSelf(v);var i=J.clone().subSelf(v);J=n.dot(n);v=n.dot(E);n=n.dot(i);var p=E.dot(E);E=E.dot(i);i=1/(J*p-v*v);p=(p*n-v*E)*i;J=(J*E-v*n)*i;return p>0&&J>0&&p+J<1}var e,d,f,g,k,h,j,c,u,y,
- r,t=a.geometry,x=t.vertices,C=[];e=0;for(d=t.faces.length;e<d;e++){f=t.faces[e];y=this.origin.clone();r=this.direction.clone();g=a.matrix.multiplyVector3(x[f.a].position.clone());k=a.matrix.multiplyVector3(x[f.b].position.clone());h=a.matrix.multiplyVector3(x[f.c].position.clone());j=f instanceof THREE.Face4?a.matrix.multiplyVector3(x[f.d].position.clone()):null;c=a.rotationMatrix.multiplyVector3(f.normal.clone());u=r.dot(c);if(u<0){c=c.dot((new THREE.Vector3).sub(g,y))/u;y=y.addSelf(r.multiplyScalar(c));
- if(f instanceof THREE.Face3){if(b(y,g,k,h)){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};C.push(f)}}else if(f instanceof THREE.Face4)if(b(y,g,k,j)||b(y,k,h,j)){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};C.push(f)}}}return C}};
- THREE.Rectangle=function(){function a(){g=d-b;k=f-e}var b,e,d,f,g,k,h=true;this.getX=function(){return b};this.getY=function(){return e};this.getWidth=function(){return g};this.getHeight=function(){return k};this.getLeft=function(){return b};this.getTop=function(){return e};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(j,c,u,y){h=false;b=j;e=c;d=u;f=y;a()};this.addPoint=function(j,c){if(h){h=false;b=j;e=c;d=j;f=c}else{b=b<j?b:j;e=e<c?e:c;d=d>j?d:j;f=f>c?
- f:c}a()};this.add3Points=function(j,c,u,y,r,t){if(h){h=false;b=j<u?j<r?j:r:u<r?u:r;e=c<y?c<t?c:t:y<t?y:t;d=j>u?j>r?j:r:u>r?u:r;f=c>y?c>t?c:t:y>t?y:t}else{b=j<u?j<r?j<b?j:b:r<b?r:b:u<r?u<b?u:b:r<b?r:b;e=c<y?c<t?c<e?c:e:t<e?t:e:y<t?y<e?y:e:t<e?t:e;d=j>u?j>r?j>d?j:d:r>d?r:d:u>r?u>d?u:d:r>d?r:d;f=c>y?c>t?c>f?c:f:t>f?t:f:y>t?y>f?y:f:t>f?t:f}a()};this.addRectangle=function(j){if(h){h=false;b=j.getLeft();e=j.getTop();d=j.getRight();f=j.getBottom()}else{b=b<j.getLeft()?b:j.getLeft();e=e<j.getTop()?e:j.getTop();
- d=d>j.getRight()?d:j.getRight();f=f>j.getBottom()?f:j.getBottom()}a()};this.inflate=function(j){b-=j;e-=j;d+=j;f+=j;a()};this.minSelf=function(j){b=b>j.getLeft()?b:j.getLeft();e=e>j.getTop()?e:j.getTop();d=d<j.getRight()?d:j.getRight();f=f<j.getBottom()?f:j.getBottom();a()};this.instersects=function(j){return Math.min(d,j.getRight())-Math.max(b,j.getLeft())>=0&&Math.min(f,j.getBottom())-Math.max(e,j.getTop())>=0};this.empty=function(){h=true;f=d=e=b=0;a()};this.isEmpty=function(){return h};this.toString=
- function(){return"THREE.Rectangle ( left: "+b+", right: "+d+", top: "+e+", bottom: "+f+", width: "+g+", height: "+k+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
- THREE.Matrix4=function(a,b,e,d,f,g,k,h,j,c,u,y,r,t,x,C){this.n11=a||1;this.n12=b||0;this.n13=e||0;this.n14=d||0;this.n21=f||0;this.n22=g||1;this.n23=k||0;this.n24=h||0;this.n31=j||0;this.n32=c||0;this.n33=u||1;this.n34=y||0;this.n41=r||0;this.n42=t||0;this.n43=x||0;this.n44=C||1};
- 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,e,d,f,g,k,h,j,c,u,y,r,t,x,C){this.n11=a;this.n12=b;this.n13=e;this.n14=d;this.n21=f;this.n22=g;this.n23=k;this.n24=h;this.n31=j;this.n32=c;this.n33=u;this.n34=y;this.n41=r;this.n42=t;this.n43=x;this.n44=C;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,e){var d=new THREE.Vector3,f=new THREE.Vector3,g=new THREE.Vector3;g.sub(a,b).normalize();d.cross(e,g).normalize();f.cross(g,d).normalize();this.n11=d.x;this.n12=d.y;this.n13=d.z;this.n14=-d.dot(a);this.n21=f.x;this.n22=f.y;this.n23=f.z;this.n24=-f.dot(a);this.n31=g.x;
- this.n32=g.y;this.n33=g.z;this.n34=-g.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,e=a.y,d=a.z,f=1/(this.n41*b+this.n42*e+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*e+this.n13*d+this.n14)*f;a.y=(this.n21*b+this.n22*e+this.n23*d+this.n24)*f;a.z=(this.n31*b+this.n32*e+this.n33*d+this.n34)*f;return a},multiplyVector4:function(a){var b=a.x,e=a.y,d=a.z,f=a.w;a.x=this.n11*b+this.n12*e+this.n13*d+this.n14*f;a.y=this.n21*b+this.n22*e+this.n23*d+this.n24*
- f;a.z=this.n31*b+this.n32*e+this.n33*d+this.n34*f;a.w=this.n41*b+this.n42*e+this.n43*d+this.n44*f;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 e=a.n11,d=a.n12,f=a.n13,g=a.n14,k=a.n21,h=a.n22,j=a.n23,c=a.n24,u=a.n31,y=a.n32,
- r=a.n33,t=a.n34,x=a.n41,C=a.n42,J=a.n43,v=a.n44,E=b.n11,n=b.n12,i=b.n13,p=b.n14,l=b.n21,w=b.n22,o=b.n23,m=b.n24,z=b.n31,L=b.n32,A=b.n33,D=b.n34,B=b.n41,N=b.n42,M=b.n43,O=b.n44;this.n11=e*E+d*l+f*z+g*B;this.n12=e*n+d*w+f*L+g*N;this.n13=e*i+d*o+f*A+g*M;this.n14=e*p+d*m+f*D+g*O;this.n21=k*E+h*l+j*z+c*B;this.n22=k*n+h*w+j*L+c*N;this.n23=k*i+h*o+j*A+c*M;this.n24=k*p+h*m+j*D+c*O;this.n31=u*E+y*l+r*z+t*B;this.n32=u*n+y*w+r*L+t*N;this.n33=u*i+y*o+r*A+t*M;this.n34=u*p+y*m+r*D+t*O;this.n41=x*E+C*l+J*z+v*B;
- this.n42=x*n+C*w+J*L+v*N;this.n43=x*i+C*o+J*A+v*M;this.n44=x*p+C*m+J*D+v*O;return this},multiplySelf:function(a){var b=this.n11,e=this.n12,d=this.n13,f=this.n14,g=this.n21,k=this.n22,h=this.n23,j=this.n24,c=this.n31,u=this.n32,y=this.n33,r=this.n34,t=this.n41,x=this.n42,C=this.n43,J=this.n44,v=a.n11,E=a.n21,n=a.n31,i=a.n41,p=a.n12,l=a.n22,w=a.n32,o=a.n42,m=a.n13,z=a.n23,L=a.n33,A=a.n43,D=a.n14,B=a.n24,N=a.n34;a=a.n44;this.n11=b*v+e*E+d*n+f*i;this.n12=b*p+e*l+d*w+f*o;this.n13=b*m+e*z+d*L+f*A;this.n14=
- b*D+e*B+d*N+f*a;this.n21=g*v+k*E+h*n+j*i;this.n22=g*p+k*l+h*w+j*o;this.n23=g*m+k*z+h*L+j*A;this.n24=g*D+k*B+h*N+j*a;this.n31=c*v+u*E+y*n+r*i;this.n32=c*p+u*l+y*w+r*o;this.n33=c*m+u*z+y*L+r*A;this.n34=c*D+u*B+y*N+r*a;this.n41=t*v+x*E+C*n+J*i;this.n42=t*p+x*l+C*w+J*o;this.n43=t*m+x*z+C*L+J*A;this.n44=t*D+x*B+C*N+J*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(){return this.n14*this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*
- this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14*this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(b,e,d){var f=b[e];b[e]=b[d];
- b[d]=f}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(){return[this.n11,this.n21,this.n31,this.n41,this.n12,
- this.n22,this.n32,this.n42,this.n13,this.n23,this.n33,this.n43,this.n14,this.n24,this.n34,this.n44]},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,e){var d=new THREE.Matrix4;d.n14=a;d.n24=b;d.n34=e;return d};
- THREE.Matrix4.scaleMatrix=function(a,b,e){var d=new THREE.Matrix4;d.n11=a;d.n22=b;d.n33=e;return d};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.n22=b.n33=Math.cos(a);b.n32=Math.sin(a);b.n23=-b.n32;return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n33=Math.cos(a);b.n13=Math.sin(a);b.n31=-b.n13;return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n22=Math.cos(a);b.n21=Math.sin(a);b.n12=-b.n21;return b};
- THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var e=new THREE.Matrix4,d=Math.cos(b),f=Math.sin(b),g=1-d,k=a.x,h=a.y,j=a.z;e.n11=g*k*k+d;e.n12=g*k*h-f*j;e.n13=g*k*j+f*h;e.n21=g*k*h+f*j;e.n22=g*h*h+d;e.n23=g*h*j-f*k;e.n31=g*k*j-f*h;e.n32=g*h*j+f*k;e.n33=g*j*j+d;return e};
- THREE.Matrix4.makeInvert=function(a){var b=new THREE.Matrix4;b.n11=a.n23*a.n34*a.n42-a.n24*a.n33*a.n42+a.n24*a.n32*a.n43-a.n22*a.n34*a.n43-a.n23*a.n32*a.n44+a.n22*a.n33*a.n44;b.n12=a.n14*a.n33*a.n42-a.n13*a.n34*a.n42-a.n14*a.n32*a.n43+a.n12*a.n34*a.n43+a.n13*a.n32*a.n44-a.n12*a.n33*a.n44;b.n13=a.n13*a.n24*a.n42-a.n14*a.n23*a.n42+a.n14*a.n22*a.n43-a.n12*a.n24*a.n43-a.n13*a.n22*a.n44+a.n12*a.n23*a.n44;b.n14=a.n14*a.n23*a.n32-a.n13*a.n24*a.n32-a.n14*a.n22*a.n33+a.n12*a.n24*a.n33+a.n13*a.n22*a.n34-a.n12*
- a.n23*a.n34;b.n21=a.n24*a.n33*a.n41-a.n23*a.n34*a.n41-a.n24*a.n31*a.n43+a.n21*a.n34*a.n43+a.n23*a.n31*a.n44-a.n21*a.n33*a.n44;b.n22=a.n13*a.n34*a.n41-a.n14*a.n33*a.n41+a.n14*a.n31*a.n43-a.n11*a.n34*a.n43-a.n13*a.n31*a.n44+a.n11*a.n33*a.n44;b.n23=a.n14*a.n23*a.n41-a.n13*a.n24*a.n41-a.n14*a.n21*a.n43+a.n11*a.n24*a.n43+a.n13*a.n21*a.n44-a.n11*a.n23*a.n44;b.n24=a.n13*a.n24*a.n31-a.n14*a.n23*a.n31+a.n14*a.n21*a.n33-a.n11*a.n24*a.n33-a.n13*a.n21*a.n34+a.n11*a.n23*a.n34;b.n31=a.n22*a.n34*a.n41-a.n24*a.n32*
- a.n41+a.n24*a.n31*a.n42-a.n21*a.n34*a.n42-a.n22*a.n31*a.n44+a.n21*a.n32*a.n44;b.n32=a.n14*a.n32*a.n41-a.n12*a.n34*a.n41-a.n14*a.n31*a.n42+a.n11*a.n34*a.n42+a.n12*a.n31*a.n44-a.n11*a.n32*a.n44;b.n33=a.n13*a.n24*a.n41-a.n14*a.n22*a.n41+a.n14*a.n21*a.n42-a.n11*a.n24*a.n42-a.n12*a.n21*a.n44+a.n11*a.n22*a.n44;b.n34=a.n14*a.n22*a.n31-a.n12*a.n24*a.n31-a.n14*a.n21*a.n32+a.n11*a.n24*a.n32+a.n12*a.n21*a.n34-a.n11*a.n22*a.n34;b.n41=a.n23*a.n32*a.n41-a.n22*a.n33*a.n41-a.n23*a.n31*a.n42+a.n21*a.n33*a.n42+a.n22*
- a.n31*a.n43-a.n21*a.n32*a.n43;b.n42=a.n12*a.n33*a.n41-a.n13*a.n32*a.n41+a.n13*a.n31*a.n42-a.n11*a.n33*a.n42-a.n12*a.n31*a.n43+a.n11*a.n32*a.n43;b.n43=a.n13*a.n22*a.n41-a.n12*a.n23*a.n41-a.n13*a.n21*a.n42+a.n11*a.n23*a.n42+a.n12*a.n21*a.n43-a.n11*a.n22*a.n43;b.n44=a.n12*a.n23*a.n31-a.n13*a.n22*a.n31+a.n13*a.n21*a.n32-a.n11*a.n23*a.n32-a.n12*a.n21*a.n33+a.n11*a.n22*a.n33;b.multiplyScalar(1/a.determinant());return b};
- THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var e=b[10]*b[5]-b[6]*b[9],d=-b[10]*b[1]+b[2]*b[9],f=b[6]*b[1]-b[2]*b[5],g=-b[10]*b[4]+b[6]*b[8],k=b[10]*b[0]-b[2]*b[8],h=-b[6]*b[0]+b[2]*b[4],j=b[9]*b[4]-b[5]*b[8],c=-b[9]*b[0]+b[1]*b[8],u=b[5]*b[0]-b[1]*b[4];b=b[0]*e+b[1]*g+b[2]*j;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*e;a.m[1]=b*d;a.m[2]=b*f;a.m[3]=b*g;a.m[4]=b*k;a.m[5]=b*h;a.m[6]=b*j;a.m[7]=b*c;a.m[8]=b*u;return a};
- THREE.Matrix4.makeFrustum=function(a,b,e,d,f,g){var k,h,j;k=new THREE.Matrix4;h=2*f/(b-a);j=2*f/(d-e);a=(b+a)/(b-a);e=(d+e)/(d-e);d=-(g+f)/(g-f);f=-2*g*f/(g-f);k.n11=h;k.n12=0;k.n13=a;k.n14=0;k.n21=0;k.n22=j;k.n23=e;k.n24=0;k.n31=0;k.n32=0;k.n33=d;k.n34=f;k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(a,b,e,d){var f;a=e*Math.tan(a*Math.PI/360);f=-a;return THREE.Matrix4.makeFrustum(f*b,a*b,f,a,e,d)};
- THREE.Matrix4.makeOrtho=function(a,b,e,d,f,g){var k,h,j,c;k=new THREE.Matrix4;h=b-a;j=e-d;c=g-f;a=(b+a)/h;e=(e+d)/j;f=(g+f)/c;k.n11=2/h;k.n12=0;k.n13=0;k.n14=-a;k.n21=0;k.n22=2/j;k.n23=0;k.n24=-e;k.n31=0;k.n32=0;k.n33=-2/c;k.n34=-f;k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};
- 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,e,d,f){this.a=a;this.b=b;this.c=e;this.centroid=new THREE.Vector3;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.material=f instanceof Array?f:[f]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
- THREE.Face4=function(a,b,e,d,f,g){this.a=a;this.b=b;this.c=e;this.d=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.material=g instanceof Array?g:[g]};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,e;a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];e.centroid.set(0,0,0);if(e instanceof THREE.Face3){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);e.centroid.divideScalar(3)}else if(e instanceof THREE.Face4){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);
- e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,e,d,f,g,k,h=new THREE.Vector3,j=new THREE.Vector3;d=0;for(f=this.vertices.length;d<f;d++){g=this.vertices[d];g.normal.set(0,0,0)}d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];if(a&&g.vertexNormals.length){h.set(0,0,0);b=0;for(e=g.normal.length;b<e;b++)h.addSelf(g.vertexNormals[b]);h.divideScalar(3)}else{b=this.vertices[g.a];e=this.vertices[g.b];k=this.vertices[g.c];h.sub(k.position,
- e.position);j.sub(b.position,e.position);h.crossSelf(j)}h.isZero()||h.normalize();g.normal.copy(h)}},computeVertexNormals:function(){var a,b=[],e,d;a=0;for(vl=this.vertices.length;a<vl;a++)b[a]=new THREE.Vector3;a=0;for(e=this.faces.length;a<e;a++){d=this.faces[a];if(d instanceof THREE.Face3){b[d.a].addSelf(d.normal);b[d.b].addSelf(d.normal);b[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){b[d.a].addSelf(d.normal);b[d.b].addSelf(d.normal);b[d.c].addSelf(d.normal);b[d.d].addSelf(d.normal)}}a=
- 0;for(vl=this.vertices.length;a<vl;a++)b[a].normalize();a=0;for(e=this.faces.length;a<e;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0]=b[d.a].clone();d.vertexNormals[1]=b[d.b].clone();d.vertexNormals[2]=b[d.c].clone()}else if(d instanceof THREE.Face4){d.vertexNormals[0]=b[d.a].clone();d.vertexNormals[1]=b[d.b].clone();d.vertexNormals[2]=b[d.c].clone();d.vertexNormals[3]=b[d.d].clone()}}},computeTangents:function(){function a(D,B,N,M){g=D.vertices[B].position;k=D.vertices[N].position;
- h=D.vertices[M].position;j=f[0];c=f[1];u=f[2];y=k.x-g.x;r=h.x-g.x;t=k.y-g.y;x=h.y-g.y;C=k.z-g.z;J=h.z-g.z;v=c.u-j.u;E=u.u-j.u;n=c.v-j.v;i=u.v-j.v;p=1/(v*i-E*n);m.set((i*y-n*r)*p,(i*t-n*x)*p,(i*C-n*J)*p);z.set((v*r-E*y)*p,(v*x-E*t)*p,(v*J-E*C)*p);w[B].addSelf(m);w[N].addSelf(m);w[M].addSelf(m);o[B].addSelf(z);o[N].addSelf(z);o[M].addSelf(z)}var b,e,d,f,g,k,h,j,c,u,y,r,t,x,C,J,v,E,n,i,p,l,w=[],o=[],m=new THREE.Vector3,z=new THREE.Vector3,L=new THREE.Vector3,A=new THREE.Vector3;l=new THREE.Vector3;b=
- 0;for(e=this.vertices.length;b<e;b++){w[b]=new THREE.Vector3;o[b]=new THREE.Vector3}b=0;for(e=this.faces.length;b<e;b++){d=this.faces[b];f=this.uvs[b];if(d instanceof THREE.Face3){a(this,d.a,d.b,d.c);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);this.vertices[d.c].normal.copy(d.vertexNormals[2])}else if(d instanceof THREE.Face4){a(this,d.a,d.b,d.c);this.vertices[d.a].normal.copy(d.vertexNormals[0]);this.vertices[d.b].normal.copy(d.vertexNormals[1]);
- this.vertices[d.c].normal.copy(d.vertexNormals[2]);this.vertices[d.d].normal.copy(d.vertexNormals[3])}}b=0;for(e=this.vertices.length;b<e;b++){l.copy(this.vertices[b].normal);d=w[b];L.copy(d);L.subSelf(l.multiplyScalar(l.dot(d))).normalize();A.cross(this.vertices[b].normal,d);test=A.dot(o[b]);d=test<0?-1:1;this.vertices[b].tangent.set(L.x,L.y,L.z,d)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.bbox={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,e=this.vertices.length;b<e;b++){a=this.vertices[b];if(a.position.x<this.bbox.x[0])this.bbox.x[0]=a.position.x;else if(a.position.x>this.bbox.x[1])this.bbox.x[1]=a.position.x;if(a.position.y<this.bbox.y[0])this.bbox.y[0]=a.position.y;else if(a.position.y>this.bbox.y[1])this.bbox.y[1]=a.position.y;if(a.position.z<this.bbox.z[0])this.bbox.z[0]=a.position.z;else if(a.position.z>
- this.bbox.z[1])this.bbox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,b=0,e=this.vertices.length;b<e;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(u){var y=[];b=0;for(e=u.length;b<e;b++)u[b]==undefined?y.push("undefined"):y.push(u[b].toString());return y.join("_")}var b,e,d,f,g,k,h,j,c={};d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];k=
- g.material;h=a(k);if(c[h]==undefined)c[h]={hash:h,counter:0};j=c[h].hash+"_"+c[h].counter;if(this.geometryChunks[j]==undefined)this.geometryChunks[j]={faces:[],material:k,vertices:0};g=g instanceof THREE.Face3?3:4;if(this.geometryChunks[j].vertices+g>65535){c[h].counter+=1;j=c[h].hash+"_"+c[h].counter;if(this.geometryChunks[j]==undefined)this.geometryChunks[j]={faces:[],material:k,vertices:0}}this.geometryChunks[j].faces.push(d);this.geometryChunks[j].vertices+=g}},toString:function(){return"THREE.Geometry ( vertices: "+
- this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
- THREE.Camera=function(a,b,e,d){this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.up=new THREE.Vector3(0,1,0);this.matrix=new THREE.Matrix4;this.projectionMatrix=THREE.Matrix4.makePerspective(a,b,e,d);this.autoUpdateMatrix=true;this.translateX=function(f){f=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(f);f.cross(f.clone(),this.up);this.position.addSelf(f);this.target.position.addSelf(f)};this.translateZ=function(f){f=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(f);
- this.position.subSelf(f);this.target.position.subSelf(f)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.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.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.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.translationMatrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.scaleMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.autoUpdateMatrix=this.visible=true;this.updateMatrix=function(){this.matrixPosition=THREE.Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z);
- this.rotationMatrix=THREE.Matrix4.rotationXMatrix(this.rotation.x);this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.scaleMatrix=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);this.matrix.multiplySelf(this.rotationMatrix);this.matrix.multiplySelf(this.scaleMatrix)}};THREE.Object3DCounter={value:0};
- THREE.Particle=function(a){THREE.Object3D.call(this);this.material=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.Line=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.material=b instanceof Array?b:[b]};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.material=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}this.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.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.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}this.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.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.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}this.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.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.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}this.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.near=1;this.far=1E3;this.opacity=1;this.blending=THREE.NormalBlending;if(a){if(a.near!==undefined)this.near=a.near;if(a.far!==undefined)this.far=a.far;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}this.__2near=2*this.near;this.__farPlusNear=this.far+this.near;this.__farMinusNear=this.far-this.near;this.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}this.toString=function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){this.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}this.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}this.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}this.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;this.toString=function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
- THREE.Texture=function(a,b,e,d,f,g){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrap_t=d!==undefined?d:THREE.ClampToEdgeWrapping;this.mag_filter=f!==undefined?f:THREE.LinearFilter;this.min_filter=g!==undefined?g:THREE.LinearMipMapLinearFilter;this.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.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.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.Projector=function(){function a(w,o){return o.z-w.z}function b(w,o){var m=0,z=1,L=w.z+w.w,A=o.z+o.w,D=-w.z+w.w,B=-o.z+o.w;if(L>=0&&A>=0&&D>=0&&B>=0)return true;else if(L<0&&A<0||D<0&&B<0)return false;else{if(L<0)m=Math.max(m,L/(L-A));else if(A<0)z=Math.min(z,L/(L-A));if(D<0)m=Math.max(m,D/(D-B));else if(B<0)z=Math.min(z,D/(D-B));if(z<m)return false;else{w.lerpSelf(o,m);o.lerpSelf(w,1-z);return true}}}var e,d,f=[],g,k,h,j=[],c,u,y=[],r,t,x=[],C=new THREE.Vector4,J=new THREE.Vector4,v=new THREE.Matrix4,
- E=new THREE.Matrix4,n=[],i=new THREE.Vector4,p=new THREE.Vector4,l;this.projectObjects=function(w,o,m){var z=[],L,A;d=0;v.multiply(o.projectionMatrix,o.matrix);n[0]=new THREE.Vector4(v.n41-v.n11,v.n42-v.n12,v.n43-v.n13,v.n44-v.n14);n[1]=new THREE.Vector4(v.n41+v.n11,v.n42+v.n12,v.n43+v.n13,v.n44+v.n14);n[2]=new THREE.Vector4(v.n41+v.n21,v.n42+v.n22,v.n43+v.n23,v.n44+v.n24);n[3]=new THREE.Vector4(v.n41-v.n21,v.n42-v.n22,v.n43-v.n23,v.n44-v.n24);n[4]=new THREE.Vector4(v.n41-v.n31,v.n42-v.n32,v.n43-
- v.n33,v.n44-v.n34);n[5]=new THREE.Vector4(v.n41+v.n31,v.n42+v.n32,v.n43+v.n33,v.n44+v.n34);o=0;for(L=n.length;o<L;o++){A=n[o];A.divideScalar(Math.sqrt(A.x*A.x+A.y*A.y+A.z*A.z))}L=w.objects;w=0;for(o=L.length;w<o;w++){A=L[w];var D;if(!(D=A.visible===false)){a:{D=void 0;for(var B=A.position,N=-A.geometry.boundingSphere.radius*Math.max(A.scale.x,Math.max(A.scale.y,A.scale.z)),M=0;M<6;M++){D=n[M].x*B.x+n[M].y*B.y+n[M].z*B.z+n[M].w;if(D<=N){D=false;break a}}D=true}D=D===false}if(!D){e=f[d]=f[d]||new THREE.RenderableObject;
- C.copy(A.position);v.multiplyVector3(C);e.object=A;e.z=C.z;z.push(e);d++}}m&&z.sort(a);return z};this.projectScene=function(w,o,m){var z=[],L,A,D,B,N,M,O,U,$,W,S,I,H,R,q,s;h=u=t=0;o.autoUpdateMatrix&&o.updateMatrix();v.multiply(o.projectionMatrix,o.matrix);M=w.objects;w=0;for(L=M.length;w<L;w++){O=M[w];if(O.visible!==false){O.autoUpdateMatrix&&O.updateMatrix();U=O.matrix;$=O.rotationMatrix;W=O.material;S=O.overdraw;if(O instanceof THREE.Mesh){I=O.geometry;H=I.vertices;A=0;for(D=H.length;A<D;A++){R=
- H[A];R.positionWorld.copy(R.position);U.multiplyVector3(R.positionWorld);B=R.positionScreen;B.copy(R.positionWorld);v.multiplyVector4(B);B.multiplyScalar(1/B.w);R.__visible=B.z>0&&B.z<1}I=I.faces;A=0;for(D=I.length;A<D;A++){R=I[A];if(R instanceof THREE.Face3){B=H[R.a];N=H[R.b];q=H[R.c];if(B.__visible&&N.__visible&&q.__visible)if(O.doubleSided||O.flipSided!=(q.positionScreen.x-B.positionScreen.x)*(N.positionScreen.y-B.positionScreen.y)-(q.positionScreen.y-B.positionScreen.y)*(N.positionScreen.x-B.positionScreen.x)<
- 0){g=j[h]=j[h]||new THREE.RenderableFace3;g.v1.positionWorld.copy(B.positionWorld);g.v2.positionWorld.copy(N.positionWorld);g.v3.positionWorld.copy(q.positionWorld);g.v1.positionScreen.copy(B.positionScreen);g.v2.positionScreen.copy(N.positionScreen);g.v3.positionScreen.copy(q.positionScreen);g.normalWorld.copy(R.normal);$.multiplyVector3(g.normalWorld);g.centroidWorld.copy(R.centroid);U.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);q=
- R.vertexNormals;l=g.vertexNormalsWorld;B=0;for(N=q.length;B<N;B++){s=l[B]=l[B]||new THREE.Vector3;s.copy(q[B]);$.multiplyVector3(s)}g.z=g.centroidScreen.z;g.meshMaterial=W;g.faceMaterial=R.material;g.overdraw=S;if(O.geometry.uvs[A]){g.uvs[0]=O.geometry.uvs[A][0];g.uvs[1]=O.geometry.uvs[A][1];g.uvs[2]=O.geometry.uvs[A][2]}z.push(g);h++}}else if(R instanceof THREE.Face4){B=H[R.a];N=H[R.b];q=H[R.c];s=H[R.d];if(B.__visible&&N.__visible&&q.__visible&&s.__visible)if(O.doubleSided||O.flipSided!=((s.positionScreen.x-
- B.positionScreen.x)*(N.positionScreen.y-B.positionScreen.y)-(s.positionScreen.y-B.positionScreen.y)*(N.positionScreen.x-B.positionScreen.x)<0||(N.positionScreen.x-q.positionScreen.x)*(s.positionScreen.y-q.positionScreen.y)-(N.positionScreen.y-q.positionScreen.y)*(s.positionScreen.x-q.positionScreen.x)<0)){g=j[h]=j[h]||new THREE.RenderableFace3;g.v1.positionWorld.copy(B.positionWorld);g.v2.positionWorld.copy(N.positionWorld);g.v3.positionWorld.copy(s.positionWorld);g.v1.positionScreen.copy(B.positionScreen);
- g.v2.positionScreen.copy(N.positionScreen);g.v3.positionScreen.copy(s.positionScreen);g.normalWorld.copy(R.normal);$.multiplyVector3(g.normalWorld);g.centroidWorld.copy(R.centroid);U.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);v.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterial=W;g.faceMaterial=R.material;g.overdraw=S;if(O.geometry.uvs[A]){g.uvs[0]=O.geometry.uvs[A][0];g.uvs[1]=O.geometry.uvs[A][1];g.uvs[2]=O.geometry.uvs[A][3]}z.push(g);h++;k=j[h]=
- j[h]||new THREE.RenderableFace3;k.v1.positionWorld.copy(N.positionWorld);k.v2.positionWorld.copy(q.positionWorld);k.v3.positionWorld.copy(s.positionWorld);k.v1.positionScreen.copy(N.positionScreen);k.v2.positionScreen.copy(q.positionScreen);k.v3.positionScreen.copy(s.positionScreen);k.normalWorld.copy(g.normalWorld);k.centroidWorld.copy(g.centroidWorld);k.centroidScreen.copy(g.centroidScreen);k.z=k.centroidScreen.z;k.meshMaterial=W;k.faceMaterial=R.material;k.overdraw=S;if(O.geometry.uvs[A]){k.uvs[0]=
- O.geometry.uvs[A][1];k.uvs[1]=O.geometry.uvs[A][2];k.uvs[2]=O.geometry.uvs[A][3]}z.push(k);h++}}}}else if(O instanceof THREE.Line){E.multiply(v,U);H=O.geometry.vertices;R=H[0];R.positionScreen.copy(R.position);E.multiplyVector4(R.positionScreen);A=1;for(D=H.length;A<D;A++){B=H[A];B.positionScreen.copy(B.position);E.multiplyVector4(B.positionScreen);N=H[A-1];i.copy(B.positionScreen);p.copy(N.positionScreen);if(b(i,p)){i.multiplyScalar(1/i.w);p.multiplyScalar(1/p.w);c=y[u]=y[u]||new THREE.RenderableLine;
- c.v1.positionScreen.copy(i);c.v2.positionScreen.copy(p);c.z=Math.max(i.z,p.z);c.material=O.material;z.push(c);u++}}}else if(O instanceof THREE.Particle){J.set(O.position.x,O.position.y,O.position.z,1);v.multiplyVector4(J);J.z/=J.w;if(J.z>0&&J.z<1){r=x[t]=x[t]||new THREE.RenderableParticle;r.x=J.x/J.w;r.y=J.y/J.w;r.z=J.z;r.rotation=O.rotation.z;r.scale.x=O.scale.x*Math.abs(r.x-(J.x+o.projectionMatrix.n11)/(J.w+o.projectionMatrix.n14));r.scale.y=O.scale.y*Math.abs(r.y-(J.y+o.projectionMatrix.n22)/(J.w+
- o.projectionMatrix.n24));r.material=O.material;z.push(r);t++}}}}m&&z.sort(a);return z};this.unprojectVector=function(w,o){var m=new THREE.Matrix4;m.multiply(THREE.Matrix4.makeInvert(o.matrix),THREE.Matrix4.makeInvert(o.projectionMatrix));m.multiplyVector3(w);return w}};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,e,d,f,g;this.domElement=document.createElement("div");this.setSize=function(k,h){e=k;d=h;f=e/2;g=d/2};this.render=function(k,h){var j,c,u,y,r,t,x,C;a=b.projectScene(k,h);j=0;for(c=a.length;j<c;j++){r=a[j];if(r instanceof THREE.RenderableParticle){x=r.x*f+f;C=r.y*g+g;u=0;for(y=r.material.length;u<y;u++){t=r.material[u];if(t instanceof THREE.ParticleDOMMaterial){t=t.domElement;t.style.left=x+"px";t.style.top=C+"px"}}}}}};
- THREE.CanvasRenderer=function(){var a=null,b=new THREE.Projector,e=document.createElement("canvas"),d,f,g,k,h=e.getContext("2d"),j=1,c=0,u=null,y=null,r=1,t,x,C,J,v,E,n,i,p,l=new THREE.Color,w=new THREE.Color,o=new THREE.Color,m=new THREE.Color,z=new THREE.Color,L,A,D,B,N,M,O,U,$,W,S=new THREE.Rectangle,I=new THREE.Rectangle,H=new THREE.Rectangle,R=false,q=new THREE.Color,s=new THREE.Color,F=new THREE.Color,P=new THREE.Color,X=Math.PI*2,Y=new THREE.Vector3,ea,ma,oa,fa,ra,va,pa=16;ea=document.createElement("canvas");
- ea.width=ea.height=2;ma=ea.getContext("2d");ma.fillStyle="rgba(0,0,0,1)";ma.fillRect(0,0,2,2);oa=ma.getImageData(0,0,2,2);fa=oa.data;ra=document.createElement("canvas");ra.width=ra.height=pa;va=ra.getContext("2d");va.translate(-pa/2,-pa/2);va.scale(pa,pa);pa--;this.domElement=e;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ia,wa){d=ia;f=wa;g=d/2;k=f/2;e.width=d;e.height=f;S.set(-g,-k,g,k)};this.clear=function(){if(!I.isEmpty()){I.inflate(1);I.minSelf(S);h.clearRect(I.getX(),
- I.getY(),I.getWidth(),I.getHeight());I.empty()}};this.render=function(ia,wa){function Ka(G){var V,T,K,Q=G.lights;s.setRGB(0,0,0);F.setRGB(0,0,0);P.setRGB(0,0,0);G=0;for(V=Q.length;G<V;G++){T=Q[G];K=T.color;if(T instanceof THREE.AmbientLight){s.r+=K.r;s.g+=K.g;s.b+=K.b}else if(T instanceof THREE.DirectionalLight){F.r+=K.r;F.g+=K.g;F.b+=K.b}else if(T instanceof THREE.PointLight){P.r+=K.r;P.g+=K.g;P.b+=K.b}}}function xa(G,V,T,K){var Q,Z,ba,ca,da=G.lights;G=0;for(Q=da.length;G<Q;G++){Z=da[G];ba=Z.color;
- ca=Z.intensity;if(Z instanceof THREE.DirectionalLight){Z=T.dot(Z.position)*ca;if(Z>0){K.r+=ba.r*Z;K.g+=ba.g*Z;K.b+=ba.b*Z}}else if(Z instanceof THREE.PointLight){Y.sub(Z.position,V);Y.normalize();Z=T.dot(Y)*ca;if(Z>0){K.r+=ba.r*Z;K.g+=ba.g*Z;K.b+=ba.b*Z}}}}function La(G,V,T){if(T.opacity!=0){Ca(T.opacity);ya(T.blending);var K,Q,Z,ba,ca,da;if(T instanceof THREE.ParticleBasicMaterial){if(T.map){ba=T.map;ca=ba.width>>1;da=ba.height>>1;Q=V.scale.x*g;Z=V.scale.y*k;T=Q*ca;K=Z*da;H.set(G.x-T,G.y-K,G.x+T,
- G.y+K);if(S.instersects(H)){h.save();h.translate(G.x,G.y);h.rotate(-V.rotation);h.scale(Q,-Z);h.translate(-ca,-da);h.drawImage(ba,0,0);h.restore()}}}else if(T instanceof THREE.ParticleCircleMaterial){if(R){q.r=s.r+F.r+P.r;q.g=s.g+F.g+P.g;q.b=s.b+F.b+P.b;l.r=T.color.r*q.r;l.g=T.color.g*q.g;l.b=T.color.b*q.b;l.updateStyleString()}else l.__styleString=T.color.__styleString;T=V.scale.x*g;K=V.scale.y*k;H.set(G.x-T,G.y-K,G.x+T,G.y+K);if(S.instersects(H)){Q=l.__styleString;if(y!=Q)h.fillStyle=y=Q;h.save();
- h.translate(G.x,G.y);h.rotate(-V.rotation);h.scale(T,K);h.beginPath();h.arc(0,0,1,0,X,true);h.closePath();h.fill();h.restore()}}}}function Ma(G,V,T,K){if(K.opacity!=0){Ca(K.opacity);ya(K.blending);h.beginPath();h.moveTo(G.positionScreen.x,G.positionScreen.y);h.lineTo(V.positionScreen.x,V.positionScreen.y);h.closePath();if(K instanceof THREE.LineBasicMaterial){l.__styleString=K.color.__styleString;G=K.linewidth;if(r!=G)h.lineWidth=r=G;G=l.__styleString;if(u!=G)h.strokeStyle=u=G;h.stroke();H.inflate(K.linewidth*
- 2)}}}function Ga(G,V,T,K,Q,Z){if(Q.opacity!=0){Ca(Q.opacity);ya(Q.blending);J=G.positionScreen.x;v=G.positionScreen.y;E=V.positionScreen.x;n=V.positionScreen.y;i=T.positionScreen.x;p=T.positionScreen.y;h.beginPath();h.moveTo(J,v);h.lineTo(E,n);h.lineTo(i,p);h.lineTo(J,v);h.closePath();if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.image.loaded&&Q.map.mapping instanceof THREE.UVMapping&&sa(J,v,E,n,i,p,Q.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);else if(Q.env_map){if(Q.env_map.image.loaded)if(Q.env_map.mapping instanceof
- THREE.SphericalReflectionMapping){G=wa.matrix;Y.copy(K.vertexNormalsWorld[0]);N=(Y.x*G.n11+Y.y*G.n12+Y.z*G.n13)*0.5+0.5;M=-(Y.x*G.n21+Y.y*G.n22+Y.z*G.n23)*0.5+0.5;Y.copy(K.vertexNormalsWorld[1]);O=(Y.x*G.n11+Y.y*G.n12+Y.z*G.n13)*0.5+0.5;U=-(Y.x*G.n21+Y.y*G.n22+Y.z*G.n23)*0.5+0.5;Y.copy(K.vertexNormalsWorld[2]);$=(Y.x*G.n11+Y.y*G.n12+Y.z*G.n13)*0.5+0.5;W=-(Y.x*G.n21+Y.y*G.n22+Y.z*G.n23)*0.5+0.5;sa(J,v,E,n,i,p,Q.env_map.image,N,M,O,U,$,W)}}else Q.wireframe?za(Q.color.__styleString,Q.wireframe_linewidth):
- Aa(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){Q.map.mapping instanceof THREE.UVMapping&&sa(J,v,E,n,i,p,Q.map.image,K.uvs[0].u,K.uvs[0].v,K.uvs[1].u,K.uvs[1].v,K.uvs[2].u,K.uvs[2].v);ya(THREE.SubtractiveBlending)}if(R)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&K.vertexNormalsWorld.length==3){w.r=o.r=m.r=s.r;w.g=o.g=m.g=s.g;w.b=o.b=m.b=s.b;xa(Z,K.v1.positionWorld,K.vertexNormalsWorld[0],w);xa(Z,K.v2.positionWorld,K.vertexNormalsWorld[1],o);xa(Z,
- K.v3.positionWorld,K.vertexNormalsWorld[2],m);z.r=(o.r+m.r)*0.5;z.g=(o.g+m.g)*0.5;z.b=(o.b+m.b)*0.5;B=Ha(w,o,m,z);sa(J,v,E,n,i,p,B,0,0,1,0,0,1)}else{q.r=s.r;q.g=s.g;q.b=s.b;xa(Z,K.centroidWorld,K.normalWorld,q);l.r=Q.color.r*q.r;l.g=Q.color.g*q.g;l.b=Q.color.b*q.b;l.updateStyleString();Q.wireframe?za(l.__styleString,Q.wireframe_linewidth):Aa(l.__styleString)}else Q.wireframe?za(Q.color.__styleString,Q.wireframe_linewidth):Aa(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){L=Q.__2near;
- A=Q.__farPlusNear;D=Q.__farMinusNear;w.r=w.g=w.b=1-L/(A-G.positionScreen.z*D);o.r=o.g=o.b=1-L/(A-V.positionScreen.z*D);m.r=m.g=m.b=1-L/(A-T.positionScreen.z*D);z.r=(o.r+m.r)*0.5;z.g=(o.g+m.g)*0.5;z.b=(o.b+m.b)*0.5;B=Ha(w,o,m,z);sa(J,v,E,n,i,p,B,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){l.r=Da(K.normalWorld.x);l.g=Da(K.normalWorld.y);l.b=Da(K.normalWorld.z);l.updateStyleString();Q.wireframe?za(l.__styleString,Q.wireframe_linewidth):Aa(l.__styleString)}}}function za(G,V){if(u!=G)h.strokeStyle=
- u=G;if(r!=V)h.lineWidth=r=V;h.stroke();H.inflate(V*2)}function Aa(G){if(y!=G)h.fillStyle=y=G;h.fill()}function sa(G,V,T,K,Q,Z,ba,ca,da,ja,ga,ka,ta){var na,la;na=ba.width-1;la=ba.height-1;ca*=na;da*=la;ja*=na;ga*=la;ka*=na;ta*=la;T-=G;K-=V;Q-=G;Z-=V;ja-=ca;ga-=da;ka-=ca;ta-=da;la=1/(ja*ta-ka*ga);na=(ta*T-ga*Q)*la;ga=(ta*K-ga*Z)*la;T=(ja*Q-ka*T)*la;K=(ja*Z-ka*K)*la;G=G-na*ca-T*da;V=V-ga*ca-K*da;h.save();h.transform(na,ga,T,K,G,V);h.clip();h.drawImage(ba,0,0);h.restore()}function Ca(G){if(j!=G)h.globalAlpha=
- j=G}function ya(G){if(c!=G){switch(G){case THREE.NormalBlending:h.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:h.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:h.globalCompositeOperation="darker"}c=G}}function Ha(G,V,T,K){var Q=~~(G.r*255),Z=~~(G.g*255);G=~~(G.b*255);var ba=~~(V.r*255),ca=~~(V.g*255);V=~~(V.b*255);var da=~~(T.r*255),ja=~~(T.g*255);T=~~(T.b*255);var ga=~~(K.r*255),ka=~~(K.g*255);K=~~(K.b*255);fa[0]=Q<0?0:Q>255?255:Q;fa[1]=Z<0?0:
- Z>255?255:Z;fa[2]=G<0?0:G>255?255:G;fa[4]=ba<0?0:ba>255?255:ba;fa[5]=ca<0?0:ca>255?255:ca;fa[6]=V<0?0:V>255?255:V;fa[8]=da<0?0:da>255?255:da;fa[9]=ja<0?0:ja>255?255:ja;fa[10]=T<0?0:T>255?255:T;fa[12]=ga<0?0:ga>255?255:ga;fa[13]=ka<0?0:ka>255?255:ka;fa[14]=K<0?0:K>255?255:K;ma.putImageData(oa,0,0);va.drawImage(ea,0,0);return ra}function Da(G){G=(G+1)*0.5;return G<0?0:G>1?1:G}function Ea(G,V){var T=V.x-G.x,K=V.y-G.y,Q=1/Math.sqrt(T*T+K*K);T*=Q;K*=Q;V.x+=T;V.y+=K;G.x-=T;G.y-=K}var Ba,Ia,aa,ha,qa,Fa,
- Ja,ua;h.setTransform(1,0,0,-1,g,k);this.autoClear&&this.clear();a=b.projectScene(ia,wa,this.sortElements);(R=ia.lights.length>0)&&Ka(ia);Ba=0;for(Ia=a.length;Ba<Ia;Ba++){aa=a[Ba];H.empty();if(aa instanceof THREE.RenderableParticle){t=aa;t.x*=g;t.y*=k;ha=0;for(qa=aa.material.length;ha<qa;ha++)La(t,aa,aa.material[ha],ia)}else if(aa instanceof THREE.RenderableLine){t=aa.v1;x=aa.v2;t.positionScreen.x*=g;t.positionScreen.y*=k;x.positionScreen.x*=g;x.positionScreen.y*=k;H.addPoint(t.positionScreen.x,t.positionScreen.y);
- H.addPoint(x.positionScreen.x,x.positionScreen.y);if(S.instersects(H)){ha=0;for(qa=aa.material.length;ha<qa;)Ma(t,x,aa,aa.material[ha++],ia)}}else if(aa instanceof THREE.RenderableFace3){t=aa.v1;x=aa.v2;C=aa.v3;t.positionScreen.x*=g;t.positionScreen.y*=k;x.positionScreen.x*=g;x.positionScreen.y*=k;C.positionScreen.x*=g;C.positionScreen.y*=k;if(aa.overdraw){Ea(t.positionScreen,x.positionScreen);Ea(x.positionScreen,C.positionScreen);Ea(C.positionScreen,t.positionScreen)}H.add3Points(t.positionScreen.x,
- t.positionScreen.y,x.positionScreen.x,x.positionScreen.y,C.positionScreen.x,C.positionScreen.y);if(S.instersects(H)){ha=0;for(qa=aa.meshMaterial.length;ha<qa;){ua=aa.meshMaterial[ha++];if(ua instanceof THREE.MeshFaceMaterial){Fa=0;for(Ja=aa.faceMaterial.length;Fa<Ja;)(ua=aa.faceMaterial[Fa++])&&Ga(t,x,C,aa,ua,ia)}else Ga(t,x,C,aa,ua,ia)}}}I.addRectangle(H)}h.setTransform(1,0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(U,$,W){var S,I,H,R;S=0;for(I=U.lights.length;S<I;S++){H=U.lights[S];if(H instanceof THREE.DirectionalLight){R=$.normalWorld.dot(H.position)*H.intensity;if(R>0){W.r+=H.color.r*R;W.g+=H.color.g*R;W.b+=H.color.b*R}}else if(H instanceof THREE.PointLight){m.sub(H.position,$.centroidWorld);m.normalize();R=$.normalWorld.dot(m)*H.intensity;if(R>0){W.r+=H.color.r*R;W.g+=H.color.g*R;W.b+=H.color.b*R}}}}function b(U,$,W,S,I,H){D=d(B++);D.setAttribute("d","M "+U.positionScreen.x+
- " "+U.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)n.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(E){i.r=p.r;i.g=p.g;i.b=p.b;a(H,S,i);n.r=I.color.r*i.r;n.g=I.color.g*i.g;n.b=I.color.b*i.b;n.updateStyleString()}else n.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){o=1-I.__2near/(I.__farPlusNear-S.z*I.__farMinusNear);
- n.setRGB(o,o,o)}else I instanceof THREE.MeshNormalMaterial&&n.setRGB(f(S.normalWorld.x),f(S.normalWorld.y),f(S.normalWorld.z));I.wireframe?D.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):D.setAttribute("style","fill: "+n.__styleString+"; fill-opacity: "+I.opacity);h.appendChild(D)}function e(U,$,W,S,I,H,R){D=d(B++);D.setAttribute("d",
- "M "+U.positionScreen.x+" "+U.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");if(H instanceof THREE.MeshBasicMaterial)n.__styleString=H.color.__styleString;else if(H instanceof THREE.MeshLambertMaterial)if(E){i.r=p.r;i.g=p.g;i.b=p.b;a(R,I,i);n.r=H.color.r*i.r;n.g=H.color.g*i.g;n.b=H.color.b*i.b;n.updateStyleString()}else n.__styleString=H.color.__styleString;else if(H instanceof THREE.MeshDepthMaterial){o=
- 1-H.__2near/(H.__farPlusNear-I.z*H.__farMinusNear);n.setRGB(o,o,o)}else H instanceof THREE.MeshNormalMaterial&&n.setRGB(f(I.normalWorld.x),f(I.normalWorld.y),f(I.normalWorld.z));H.wireframe?D.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+H.wireframe_linewidth+"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.wireframe_linecap+"; stroke-linejoin: "+H.wireframe_linejoin):D.setAttribute("style","fill: "+n.__styleString+"; fill-opacity: "+H.opacity);h.appendChild(D)}
- function d(U){if(z[U]==null){z[U]=document.createElementNS("http://www.w3.org/2000/svg","path");O==0&&z[U].setAttribute("shape-rendering","crispEdges");return z[U]}return z[U]}function f(U){return U<0?Math.min((1+U)*0.5,0.5):0.5+Math.min(U*0.5,0.5)}var g=null,k=new THREE.Projector,h=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,c,u,y,r,t,x,C,J=new THREE.Rectangle,v=new THREE.Rectangle,E=false,n=new THREE.Color(16777215),i=new THREE.Color(16777215),p=new THREE.Color(0),l=new THREE.Color(0),
- w=new THREE.Color(0),o,m=new THREE.Vector3,z=[],L=[],A=[],D,B,N,M,O=1;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(U){switch(U){case "high":O=1;break;case "low":O=0}};this.setSize=function(U,$){j=U;c=$;u=j/2;y=c/2;h.setAttribute("viewBox",-u+" "+-y+" "+j+" "+c);h.setAttribute("width",j);h.setAttribute("height",c);J.set(-u,-y,u,y)};this.clear=function(){for(;h.childNodes.length>0;)h.removeChild(h.childNodes[0])};this.render=function(U,$){var W,S,
- I,H,R,q,s,F;this.autoClear&&this.clear();g=k.projectScene(U,$,this.sortElements);M=N=B=0;if(E=U.lights.length>0){s=U.lights;p.setRGB(0,0,0);l.setRGB(0,0,0);w.setRGB(0,0,0);W=0;for(S=s.length;W<S;W++){I=s[W];H=I.color;if(I instanceof THREE.AmbientLight){p.r+=H.r;p.g+=H.g;p.b+=H.b}else if(I instanceof THREE.DirectionalLight){l.r+=H.r;l.g+=H.g;l.b+=H.b}else if(I instanceof THREE.PointLight){w.r+=H.r;w.g+=H.g;w.b+=H.b}}}W=0;for(S=g.length;W<S;W++){s=g[W];v.empty();if(s instanceof THREE.RenderableParticle){r=
- s;r.x*=u;r.y*=-y;I=0;for(H=s.material.length;I<H;I++)if(F=s.material[I]){R=r;q=s;F=F;var P=N++;if(L[P]==null){L[P]=document.createElementNS("http://www.w3.org/2000/svg","circle");O==0&&L[P].setAttribute("shape-rendering","crispEdges")}D=L[P];D.setAttribute("cx",R.x);D.setAttribute("cy",R.y);D.setAttribute("r",q.scale.x*u);if(F instanceof THREE.ParticleCircleMaterial){if(E){i.r=p.r+l.r+w.r;i.g=p.g+l.g+w.g;i.b=p.b+l.b+w.b;n.r=F.color.r*i.r;n.g=F.color.g*i.g;n.b=F.color.b*i.b;n.updateStyleString()}else n=
- F.color;D.setAttribute("style","fill: "+n.__styleString)}h.appendChild(D)}}else if(s instanceof THREE.RenderableLine){r=s.v1;t=s.v2;r.positionScreen.x*=u;r.positionScreen.y*=-y;t.positionScreen.x*=u;t.positionScreen.y*=-y;v.addPoint(r.positionScreen.x,r.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);if(J.instersects(v)){I=0;for(H=s.material.length;I<H;)if(F=s.material[I++]){R=r;q=t;F=F;P=M++;if(A[P]==null){A[P]=document.createElementNS("http://www.w3.org/2000/svg","line");O==
- 0&&A[P].setAttribute("shape-rendering","crispEdges")}D=A[P];D.setAttribute("x1",R.positionScreen.x);D.setAttribute("y1",R.positionScreen.y);D.setAttribute("x2",q.positionScreen.x);D.setAttribute("y2",q.positionScreen.y);if(F instanceof THREE.LineBasicMaterial){n.__styleString=F.color.__styleString;D.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+F.linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.linecap+"; stroke-linejoin: "+F.linejoin);h.appendChild(D)}}}}else if(s instanceof
- THREE.RenderableFace3){r=s.v1;t=s.v2;x=s.v3;r.positionScreen.x*=u;r.positionScreen.y*=-y;t.positionScreen.x*=u;t.positionScreen.y*=-y;x.positionScreen.x*=u;x.positionScreen.y*=-y;v.addPoint(r.positionScreen.x,r.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(x.positionScreen.x,x.positionScreen.y);if(J.instersects(v)){I=0;for(H=s.meshMaterial.length;I<H;){F=s.meshMaterial[I++];if(F instanceof THREE.MeshFaceMaterial){R=0;for(q=s.faceMaterial.length;R<q;)(F=s.faceMaterial[R++])&&
- b(r,t,x,s,F,U)}else F&&b(r,t,x,s,F,U)}}}else if(s instanceof THREE.RenderableFace4){r=s.v1;t=s.v2;x=s.v3;C=s.v4;r.positionScreen.x*=u;r.positionScreen.y*=-y;t.positionScreen.x*=u;t.positionScreen.y*=-y;x.positionScreen.x*=u;x.positionScreen.y*=-y;C.positionScreen.x*=u;C.positionScreen.y*=-y;v.addPoint(r.positionScreen.x,r.positionScreen.y);v.addPoint(t.positionScreen.x,t.positionScreen.y);v.addPoint(x.positionScreen.x,x.positionScreen.y);v.addPoint(C.positionScreen.x,C.positionScreen.y);if(J.instersects(v)){I=
- 0;for(H=s.meshMaterial.length;I<H;){F=s.meshMaterial[I++];if(F instanceof THREE.MeshFaceMaterial){R=0;for(q=s.faceMaterial.length;R<q;)(F=s.faceMaterial[R++])&&e(r,t,x,C,s,F,U)}else F&&e(r,t,x,C,s,F,U)}}}}}};
- THREE.WebGLRenderer=function(a){function b(i,p){var l=c.createProgram(),w=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","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(l,k("fragment","#ifdef GL_ES\nprecision highp float;\n#endif\nuniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"+
- i));c.attachShader(l,k("vertex",w+p));c.linkProgram(l);c.getProgramParameter(l,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(l,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");l.uniforms={};l.attributes={};return l}function e(i,p){if(i.image.length==6){if(!i.image.__webGLTextureCube&&!i.image.__cubeMapInitialized&&i.image.loadCount==6){i.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,i.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(var l=0;l<6;++l)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+l,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,i.image[l]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);i.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+p);c.bindTexture(c.TEXTURE_CUBE_MAP,
- i.image.__webGLTextureCube)}}function d(i,p){if(!i.__webGLTexture&&i.image.loaded){i.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,i.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,i.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,h(i.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,h(i.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,h(i.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,h(i.min_filter));c.generateMipmap(c.TEXTURE_2D);
- c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+p);c.bindTexture(c.TEXTURE_2D,i.__webGLTexture)}function f(i,p){var l,w,o;l=0;for(w=p.length;l<w;l++){o=p[l];i.uniforms[o]=c.getUniformLocation(i,o)}}function g(i,p){var l,w,o;l=0;for(w=p.length;l<w;l++){o=p[l];i.attributes[o]=c.getAttribLocation(i,o)}}function k(i,p){var l;if(i=="fragment")l=c.createShader(c.FRAGMENT_SHADER);else if(i=="vertex")l=c.createShader(c.VERTEX_SHADER);c.shaderSource(l,p);c.compileShader(l);if(!c.getShaderParameter(l,
- c.COMPILE_STATUS)){alert(c.getShaderInfoLog(l));return null}return l}function h(i){switch(i){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}return 0}var j=document.createElement("canvas"),c,u,y,r=new THREE.Matrix4,t,x=new Float32Array(16),C=new Float32Array(16),J=new Float32Array(16),v=new Float32Array(9),E=new Float32Array(16);a=function(i,p){if(i){var l,w,o,m=pointLights=maxDirLights=maxPointLights=0;l=0;for(w=i.lights.length;l<w;l++){o=i.lights[l];o instanceof THREE.DirectionalLight&&m++;o instanceof THREE.PointLight&&pointLights++}if(pointLights+m<=p){maxDirLights=
- m;maxPointLights=pointLights}else{maxDirLights=Math.ceil(p*m/(pointLights+m));maxPointLights=p-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:p-1}}(a,4);this.domElement=j;this.autoClear=true;try{c=j.getContext("experimental-webgl",{antialias:true})}catch(n){}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(0,0,0,0);u=y=function(i,p){var l=[i?"#define MAX_DIR_LIGHTS "+i:"",p?"#define MAX_POINT_LIGHTS "+p:"","uniform bool enableLighting;\nuniform bool useRefract;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;\nuniform vec3 ambientLightColor;",i?"uniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];":"",i?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"",p?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":
- "",p?"uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",p?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nuniform float mRefractionRatio;\nvoid main(void) {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec3 transformedNormal = normalize( normalMatrix * normal );\nif ( !enableLighting ) {\nvLightWeighting = vec3( 1.0, 1.0, 1.0 );\n} else {\nvLightWeighting = ambientLightColor;",
- i?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",i?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",i?"float directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );":"",i?"vLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;":"",i?"}":"",p?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",p?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",p?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );":
- "",p?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",p?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",p?"}":"","}\nvNormal = transformedNormal;\nvUv = uv;\nif ( useRefract ) {\nvReflect = refract( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz), mRefractionRatio );\n} else {\nvReflect = reflect( normalize(mPosition.xyz - cameraPosition), normalize(nWorld.xyz) );\n}\ngl_Position = projectionMatrix * mvPosition;\n}"].join("\n"),
- w=[i?"#define MAX_DIR_LIGHTS "+i:"",p?"#define MAX_POINT_LIGHTS "+p:"","uniform int material;\nuniform bool enableMap;\nuniform bool enableCubeMap;\nuniform bool mixEnvMap;\nuniform samplerCube tCube;\nuniform float mReflectivity;\nuniform sampler2D tMap;\nuniform vec4 mColor;\nuniform float mOpacity;\nuniform vec4 mAmbient;\nuniform vec4 mSpecular;\nuniform float mShininess;\nuniform float m2Near;\nuniform float mFarPlusNear;\nuniform float mFarMinusNear;\nuniform int pointLightNumber;\nuniform int directionalLightNumber;",
- i?"uniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",p?"varying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];":"","varying vec3 vViewPosition;\nvarying vec3 vReflect;\nvoid main() {\nvec4 mapColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nvec4 cubeColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nif ( enableMap ) {\nmapColor = texture2D( tMap, vUv );\n}\nif ( enableCubeMap ) {\ncubeColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\n}\nif ( material == 4 ) { \ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, mOpacity );\n} else if ( material == 3 ) { \nfloat w = 0.5;\ngl_FragColor = vec4( w, w, w, mOpacity );\n} else if ( material == 2 ) { \nvec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );",
- p?"vec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );":"",p?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",p?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",p?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",p?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",p?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",p?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",p?"float pointSpecularWeight = 0.0;":"",p?"if ( pointDotNormalHalf >= 0.0 )":
- "",p?"pointSpecularWeight = pow( pointDotNormalHalf, mShininess );":"",p?"pointDiffuse += mColor * pointDiffuseWeight;":"",p?"pointSpecular += mSpecular * pointSpecularWeight;":"",p?"}":"",i?"vec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );":"",i?"vec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",i?"for( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {":"",i?"vec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );":"",i?"vec3 dirVector = normalize( lDirection.xyz );":"",i?"vec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );":
- "",i?"float dirDotNormalHalf = dot( normal, dirHalfVector );":"",i?"float dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );":"",i?"float dirSpecularWeight = 0.0;":"",i?"if ( dirDotNormalHalf >= 0.0 )":"",i?"dirSpecularWeight = pow( dirDotNormalHalf, mShininess );":"",i?"dirDiffuse += mColor * dirDiffuseWeight;":"",i?"dirSpecular += mSpecular * dirSpecularWeight;":"",i?"}":"","vec4 totalLight = mAmbient;",i?"totalLight += dirDiffuse + dirSpecular;":"",p?"totalLight += pointDiffuse + pointSpecular;":
- "","if ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mapColor.rgb * totalLight.xyz * vLightWeighting, cubeColor.rgb, mReflectivity ), mapColor.a );\n} else {\ngl_FragColor = vec4( mapColor.rgb * cubeColor.rgb * totalLight.xyz * vLightWeighting, mapColor.a );\n}\n} else if ( material == 1 ) {\nif ( mixEnvMap ) {\ngl_FragColor = vec4( mix( mColor.rgb * mapColor.rgb * vLightWeighting, cubeColor.rgb, mReflectivity ), mColor.a * mapColor.a );\n} else {\ngl_FragColor = vec4( mColor.rgb * mapColor.rgb * cubeColor.rgb * vLightWeighting, mColor.a * mapColor.a );\n}\n} else {\nif ( mixEnvMap ) {\ngl_FragColor = mix( mColor * mapColor, cubeColor, mReflectivity );\n} else {\ngl_FragColor = mColor * mapColor * cubeColor;\n}\n}\n}"].join("\n");
- l=b(w,l);c.useProgram(l);f(l,["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","enableLighting","ambientLightColor","material","mColor","mAmbient","mSpecular","mShininess","mOpacity","enableMap","tMap","enableCubeMap","tCube","mixEnvMap","mReflectivity","mRefractionRatio","useRefract","m2Near","mFarPlusNear","mFarMinusNear"]);i&&f(l,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);p&&f(l,["pointLightNumber","pointLightColor",
- "pointLightPosition"]);c.uniform1i(l.uniforms.enableMap,0);c.uniform1i(l.uniforms.tMap,0);c.uniform1i(l.uniforms.enableCubeMap,0);c.uniform1i(l.uniforms.tCube,1);c.uniform1i(l.uniforms.mixEnvMap,0);c.uniform1i(l.uniforms.useRefract,0);g(l,["position","normal","uv"]);return l}(a.directional,a.point);this.setSize=function(i,p){j.width=i;j.height=p;c.viewport(0,0,j.width,j.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(i,p){var l,w,o,m,z,L=[],
- A=[],D=[];m=[];z=[];c.uniform1i(i.uniforms.enableLighting,p.length);l=0;for(w=p.length;l<w;l++){o=p[l];if(o instanceof THREE.AmbientLight)L.push(o);else if(o instanceof THREE.DirectionalLight)D.push(o);else o instanceof THREE.PointLight&&A.push(o)}l=o=m=z=0;for(w=L.length;l<w;l++){o+=L[l].color.r;m+=L[l].color.g;z+=L[l].color.b}c.uniform3f(i.uniforms.ambientLightColor,o,m,z);m=[];z=[];l=0;for(w=D.length;l<w;l++){o=D[l];m.push(o.color.r*o.intensity);m.push(o.color.g*o.intensity);m.push(o.color.b*o.intensity);
- z.push(o.position.x);z.push(o.position.y);z.push(o.position.z)}if(D.length){c.uniform1i(i.uniforms.directionalLightNumber,D.length);c.uniform3fv(i.uniforms.directionalLightDirection,z);c.uniform3fv(i.uniforms.directionalLightColor,m)}m=[];z=[];l=0;for(w=A.length;l<w;l++){o=A[l];m.push(o.color.r*o.intensity);m.push(o.color.g*o.intensity);m.push(o.color.b*o.intensity);z.push(o.position.x);z.push(o.position.y);z.push(o.position.z)}if(A.length){c.uniform1i(i.uniforms.pointLightNumber,A.length);c.uniform3fv(i.uniforms.pointLightPosition,
- z);c.uniform3fv(i.uniforms.pointLightColor,m)}};this.createBuffers=function(i,p){var l,w,o,m,z,L,A,D,B,N=[],M=[],O=[],U=[],$=[],W=[],S=0,I=i.geometry.geometryChunks[p],H;o=false;l=0;for(w=i.material.length;l<w;l++){meshMaterial=i.material[l];if(meshMaterial instanceof THREE.MeshFaceMaterial){z=0;for(H=I.material.length;z<H;z++)if(I.material[z]&&I.material[z].shading!=undefined&&I.material[z].shading==THREE.SmoothShading){o=true;break}}else if(meshMaterial&&meshMaterial.shading!=undefined&&meshMaterial.shading==
- THREE.SmoothShading){o=true;break}if(o)break}H=o;l=0;for(w=I.faces.length;l<w;l++){o=I.faces[l];m=i.geometry.faces[o];z=m.vertexNormals;faceNormal=m.normal;o=i.geometry.uvs[o];if(m instanceof THREE.Face3){L=i.geometry.vertices[m.a].position;A=i.geometry.vertices[m.b].position;D=i.geometry.vertices[m.c].position;O.push(L.x,L.y,L.z);O.push(A.x,A.y,A.z);O.push(D.x,D.y,D.z);if(i.geometry.hasTangents){L=i.geometry.vertices[m.a].tangent;A=i.geometry.vertices[m.b].tangent;D=i.geometry.vertices[m.c].tangent;
- $.push(L.x,L.y,L.z,L.w);$.push(A.x,A.y,A.z,A.w);$.push(D.x,D.y,D.z,D.w)}if(z.length==3&&H)for(m=0;m<3;m++)U.push(z[m].x,z[m].y,z[m].z);else for(m=0;m<3;m++)U.push(faceNormal.x,faceNormal.y,faceNormal.z);if(o)for(m=0;m<3;m++)W.push(o[m].u,o[m].v);N.push(S,S+1,S+2);M.push(S,S+1);M.push(S,S+2);M.push(S+1,S+2);S+=3}else if(m instanceof THREE.Face4){L=i.geometry.vertices[m.a].position;A=i.geometry.vertices[m.b].position;D=i.geometry.vertices[m.c].position;B=i.geometry.vertices[m.d].position;O.push(L.x,
- L.y,L.z);O.push(A.x,A.y,A.z);O.push(D.x,D.y,D.z);O.push(B.x,B.y,B.z);if(i.geometry.hasTangents){L=i.geometry.vertices[m.a].tangent;A=i.geometry.vertices[m.b].tangent;D=i.geometry.vertices[m.c].tangent;m=i.geometry.vertices[m.d].tangent;$.push(L.x,L.y,L.z,L.w);$.push(A.x,A.y,A.z,A.w);$.push(D.x,D.y,D.z,D.w);$.push(m.x,m.y,m.z,m.w)}if(z.length==4&&H)for(m=0;m<4;m++)U.push(z[m].x,z[m].y,z[m].z);else for(m=0;m<4;m++)U.push(faceNormal.x,faceNormal.y,faceNormal.z);if(o)for(m=0;m<4;m++)W.push(o[m].u,o[m].v);
- N.push(S,S+1,S+2);N.push(S,S+2,S+3);M.push(S,S+1);M.push(S,S+2);M.push(S,S+3);M.push(S+1,S+2);M.push(S+2,S+3);S+=4}}if(O.length){I.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,I.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(O),c.STATIC_DRAW);I.__webGLNormalBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,I.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(U),c.STATIC_DRAW);if(i.geometry.hasTangents){I.__webGLTangentBuffer=c.createBuffer();
- c.bindBuffer(c.ARRAY_BUFFER,I.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array($),c.STATIC_DRAW)}if(W.length>0){I.__webGLUVBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,I.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(W),c.STATIC_DRAW)}I.__webGLFaceBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,I.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(N),c.STATIC_DRAW);I.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
- I.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(M),c.STATIC_DRAW);I.__webGLFaceCount=N.length;I.__webGLLineCount=M.length}};this.renderBuffer=function(i,p,l,w){var o,m,z,L,A,D,B,N,M;if(l instanceof THREE.MeshShaderMaterial){if(!l.program){l.program=b(l.fragment_shader,l.vertex_shader);B=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(M in l.uniforms)B.push(M);f(l.program,B);g(l.program,["position","normal","uv","tangent"])}M=
- l.program}else M=y;if(M!=u){c.useProgram(M);u=M}M==y&&this.setupLights(M,p);this.loadCamera(M,i);this.loadMatrices(M);if(l instanceof THREE.MeshShaderMaterial){z=l.wireframe;L=l.wireframe_linewidth;i=M;p=l.uniforms;var O;for(o in p){N=p[o].type;B=p[o].value;O=i.uniforms[o];if(N=="i")c.uniform1i(O,B);else if(N=="f")c.uniform1f(O,B);else if(N=="v3")c.uniform3f(O,B.x,B.y,B.z);else if(N=="c")c.uniform3f(O,B.r,B.g,B.b);else if(N=="t"){c.uniform1i(O,B);if(N=p[o].texture)N.image instanceof Array&&N.image.length==
- 6?e(N,B):d(N,B)}}}if(l instanceof THREE.MeshPhongMaterial||l instanceof THREE.MeshLambertMaterial||l instanceof THREE.MeshBasicMaterial){o=l.color;m=l.opacity;z=l.wireframe;L=l.wireframe_linewidth;A=l.map;D=l.env_map;p=l.combine==THREE.MixOperation;i=l.reflectivity;N=l.env_map&&l.env_map.mapping instanceof THREE.CubeRefractionMapping;B=l.refraction_ratio;c.uniform4f(M.uniforms.mColor,o.r*m,o.g*m,o.b*m,m);c.uniform1i(M.uniforms.mixEnvMap,p);c.uniform1f(M.uniforms.mReflectivity,i);c.uniform1i(M.uniforms.useRefract,
- N);c.uniform1f(M.uniforms.mRefractionRatio,B)}if(l instanceof THREE.MeshNormalMaterial){m=l.opacity;c.uniform1f(M.uniforms.mOpacity,m);c.uniform1i(M.uniforms.material,4)}else if(l instanceof THREE.MeshDepthMaterial){m=l.opacity;z=l.wireframe;L=l.wireframe_linewidth;c.uniform1f(M.uniforms.mOpacity,m);c.uniform1f(M.uniforms.m2Near,l.__2near);c.uniform1f(M.uniforms.mFarPlusNear,l.__farPlusNear);c.uniform1f(M.uniforms.mFarMinusNear,l.__farMinusNear);c.uniform1i(M.uniforms.material,3)}else if(l instanceof
- THREE.MeshPhongMaterial){o=l.ambient;i=l.specular;l=l.shininess;c.uniform4f(M.uniforms.mAmbient,o.r,o.g,o.b,m);c.uniform4f(M.uniforms.mSpecular,i.r,i.g,i.b,m);c.uniform1f(M.uniforms.mShininess,l);c.uniform1i(M.uniforms.material,2)}else if(l instanceof THREE.MeshLambertMaterial)c.uniform1i(M.uniforms.material,1);else l instanceof THREE.MeshBasicMaterial&&c.uniform1i(M.uniforms.material,0);if(A){d(A,0);c.uniform1i(M.uniforms.tMap,0);c.uniform1i(M.uniforms.enableMap,1)}else c.uniform1i(M.uniforms.enableMap,
- 0);if(D){e(D,1);c.uniform1i(M.uniforms.tCube,1);c.uniform1i(M.uniforms.enableCubeMap,1)}else c.uniform1i(M.uniforms.enableCubeMap,0);m=M.attributes;c.bindBuffer(c.ARRAY_BUFFER,w.__webGLVertexBuffer);c.vertexAttribPointer(m.position,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(m.position);if(m.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,w.__webGLNormalBuffer);c.vertexAttribPointer(m.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(m.normal)}if(m.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,w.__webGLTangentBuffer);
- c.vertexAttribPointer(m.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(m.tangent)}if(m.uv>=0)if(w.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,w.__webGLUVBuffer);c.vertexAttribPointer(m.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(m.uv)}else c.disableVertexAttribArray(m.uv);if(z){c.lineWidth(L);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,w.__webGLLineBuffer);c.drawElements(c.LINES,w.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,w.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,
- w.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(i,p,l,w,o,m){var z,L,A,D,B;A=0;for(D=l.material.length;A<D;A++){z=l.material[A];if(z instanceof THREE.MeshFaceMaterial){z=0;for(L=w.material.length;z<L;z++)if((B=w.material[z])&&B.blending==o&&B.opacity<1==m){this.setBlending(B.blending);this.renderBuffer(i,p,B,w)}}else if((B=z)&&B.blending==o&&B.opacity<1==m){this.setBlending(B.blending);this.renderBuffer(i,p,B,w)}}};this.render=function(i,p){var l,w,o,m,z=i.lights;this.initWebGLObjects(i);
- this.autoClear&&this.clear();p.autoUpdateMatrix&&p.updateMatrix();x.set(p.matrix.flatten());J.set(p.projectionMatrix.flatten());l=0;for(w=i.__webGLObjects.length;l<w;l++){o=i.__webGLObjects[l];m=o.object;o=o.buffer;if(m.visible){this.setupMatrices(m,p);this.renderPass(p,z,m,o,THREE.NormalBlending,false)}}l=0;for(w=i.__webGLObjects.length;l<w;l++){o=i.__webGLObjects[l];m=o.object;o=o.buffer;if(m.visible){this.setupMatrices(m,p);this.renderPass(p,z,m,o,THREE.AdditiveBlending,false);this.renderPass(p,
- z,m,o,THREE.SubtractiveBlending,false);this.renderPass(p,z,m,o,THREE.AdditiveBlending,true);this.renderPass(p,z,m,o,THREE.SubtractiveBlending,true);this.renderPass(p,z,m,o,THREE.NormalBlending,true)}}};this.initWebGLObjects=function(i){var p,l,w,o,m,z;if(!i.__webGLObjects){i.__webGLObjects=[];i.__webGLObjectsMap={}}p=0;for(l=i.objects.length;p<l;p++){w=i.objects[p];if(i.__webGLObjectsMap[w.id]==undefined)i.__webGLObjectsMap[w.id]={};z=i.__webGLObjectsMap[w.id];if(w instanceof THREE.Mesh)for(m in w.geometry.geometryChunks){o=
- w.geometry.geometryChunks[m];o.__webGLVertexBuffer||this.createBuffers(w,m);if(z[m]==undefined){o={buffer:o,object:w};i.__webGLObjects.push(o);z[m]=1}}}};this.removeObject=function(i,p){var l,w;for(l=i.__webGLObjects.length-1;l>=0;l--){w=i.__webGLObjects[l].object;p==w&&i.__webGLObjects.splice(l,1)}};this.setupMatrices=function(i,p){i.autoUpdateMatrix&&i.updateMatrix();r.multiply(p.matrix,i.matrix);C.set(r.flatten());t=THREE.Matrix4.makeInvert3x3(r).transpose();v.set(t.m);E.set(i.matrix.flatten())};
- this.loadMatrices=function(i){c.uniformMatrix4fv(i.uniforms.viewMatrix,false,x);c.uniformMatrix4fv(i.uniforms.modelViewMatrix,false,C);c.uniformMatrix4fv(i.uniforms.projectionMatrix,false,J);c.uniformMatrix3fv(i.uniforms.normalMatrix,false,v);c.uniformMatrix4fv(i.uniforms.objectMatrix,false,E)};this.loadCamera=function(i,p){c.uniform3f(i.uniforms.cameraPosition,p.position.x,p.position.y,p.position.z)};this.setBlending=function(i){switch(i){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(i,p){if(i){!p||p=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(i=="back")c.cullFace(c.BACK);else i=="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.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.faceMaterial=this.meshMaterial=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.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.material=null};
- var GeometryUtils={merge:function(a,b){var e=b instanceof THREE.Mesh,d=a.vertices.length,f=e?b.geometry:b,g=a.vertices,k=f.vertices,h=a.faces,j=f.faces,c=a.uvs;f=f.uvs;e&&b.updateMatrix();for(var u=0,y=k.length;u<y;u++){var r=new THREE.Vertex(k[u].position.clone());e&&b.matrix.multiplyVector3(r.position);g.push(r)}u=0;for(y=j.length;u<y;u++){k=j[u];var t,x=k.vertexNormals;if(k instanceof THREE.Face3)t=new THREE.Face3(k.a+d,k.b+d,k.c+d);else if(k instanceof THREE.Face4)t=new THREE.Face4(k.a+d,k.b+
- d,k.c+d,k.d+d);t.centroid.copy(k.centroid);t.normal.copy(k.normal);e=0;for(g=x.length;e<g;e++){r=x[e];t.vertexNormals.push(r.clone())}t.material=k.material.slice();h.push(t)}u=0;for(y=f.length;u<y;u++){d=f[u];h=[];e=0;for(g=d.length;e<g;e++)h.push(new THREE.UV(d[e].u,d[e].v));c.push(h)}}},ImageUtils={loadTexture:function(a,b){var e=new Image;e.onload=function(){this.loaded=true};e.src=a;return new THREE.Texture(e,b)},loadArray:function(a){var b,e,d=[];b=d.loadCount=0;for(e=a.length;b<e;++b){d[b]=
- new Image;d[b].loaded=0;d[b].onload=function(){d.loadCount+=1;this.loaded=true};d[b].src=a[b]}return d}},SceneUtils={addMesh:function(a,b,e,d,f,g,k,h,j,c){b=new THREE.Mesh(b,c);b.scale.x=b.scale.y=b.scale.z=e;b.position.x=d;b.position.y=f;b.position.z=g;b.rotation.x=k;b.rotation.y=h;b.rotation.z=j;a.addObject(b);return b},addPanoramaCubeWebGL:function(a,b,e){var d=ShaderUtils.lib.cube;d.uniforms.tCube.texture=e;e=new THREE.MeshShaderMaterial({fragment_shader:d.fragment_shader,vertex_shader:d.vertex_shader,
- uniforms:d.uniforms});b=new THREE.Mesh(new Cube(b,b,b,1,1,null,true),e);a.addObject(b);return b},addPanoramaCube:function(a,b,e){var d=[];d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[3])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[4])}));d.push(new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));
- mesh=new THREE.Mesh(new Cube(b,b,b,1,1,d,true),new THREE.MeshFaceMaterial);a.addObject(mesh);return mesh},addPanoramaCubePlanes:function(a,b,e){var d=b/2;b=new Plane(b,b);var f=Math.PI/2,g=Math.PI;SceneUtils.addMesh(a,b,1,0,0,-d,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[5])}));SceneUtils.addMesh(a,b,1,-d,0,0,0,f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[0])}));SceneUtils.addMesh(a,b,1,d,0,0,0,-f,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[1])}));SceneUtils.addMesh(a,
- b,1,0,d,0,f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[2])}));SceneUtils.addMesh(a,b,1,0,-d,0,-f,0,g,new THREE.MeshBasicMaterial({map:new THREE.Texture(e[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:{tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},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 uDirLightColor;\nuniform vec3 uPointLightPos;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform sampler2D tNormal;\nuniform sampler2D tAO;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 normalTex = normalize( texture2D( tNormal, vUv ).xyz * 2.0 - 1.0 );\nvec3 aoTex = 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( uAmbientColor, 1.0 );\ntotalLight += dirDiffuse + dirSpecular;\ntotalLight += pointDiffuse + pointSpecular;\ngl_FragColor = vec4( totalLight.xyz * vLightWeighting * aoTex, 1.0 );\n}",
- vertex_shader:"attribute vec4 tangent;\nuniform vec3 uDirLightPos;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightPos;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientLightColor;\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 vLightWeighting;\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;\nvLightWeighting = uAmbientLightColor;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( vNormal, vPointLightVector ), 0.0 );\nvLightWeighting += uPointLightColor * pointLightWeighting;\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nfloat directionalLightWeighting = max( dot( vNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += uDirLightColor * directionalLightWeighting;\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}"},
- 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:{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}"}}},Cube=function(a,b,e,d,f,g,k,h){function j(C,J,v,E,n,i,p,l){var w,o=d||1,m=f||1,z=o+1,L=m+1,A=n/2,D=i/2;n=n/o;i=i/m;var B=c.vertices.length;if(C=="x"&&J=="y"||C=="y"&&J=="x")w="z";else if(C=="x"&&J=="z"||C=="z"&&J=="x")w="y";else if(C=="z"&&J=="y"||C=="y"&&J=="z")w="x";for(iy=0;iy<L;iy++)for(ix=0;ix<
- z;ix++){var N=new THREE.Vector3;N[C]=(ix*n-A)*v;N[J]=(iy*i-D)*E;N[w]=p;c.vertices.push(new THREE.Vertex(N))}for(iy=0;iy<m;iy++)for(ix=0;ix<o;ix++){c.faces.push(new THREE.Face4(ix+z*iy+B,ix+z*(iy+1)+B,ix+1+z*(iy+1)+B,ix+1+z*iy+B,null,l));c.uvs.push([new THREE.UV(ix/o,iy/m),new THREE.UV(ix/o,(iy+1)/m),new THREE.UV((ix+1)/o,(iy+1)/m),new THREE.UV((ix+1)/o,iy/m)])}}THREE.Geometry.call(this);var c=this,u=a/2,y=b/2,r=e/2;k=k?-1:1;if(g!==undefined)if(g instanceof Array)this.materials=g;else{this.materials=
- [];for(var t=0;t<6;t++)this.materials.push([g])}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(h!=undefined)for(var x in h)if(this.sides[x]!=undefined)this.sides[x]=h[x];this.sides.px&&j("z","y",1*k,-1,e,b,-u,this.materials[0]);this.sides.nx&&j("z","y",-1*k,-1,e,b,u,this.materials[1]);this.sides.py&&j("x","z",1*k,1,a,e,y,this.materials[2]);this.sides.ny&&j("x","z",1*k,-1,a,e,-y,this.materials[3]);this.sides.pz&&j("x","y",1*k,-1,a,b,r,this.materials[4]);this.sides.nz&&
- j("x","y",-1*k,-1,a,b,-r,this.materials[5]);(function(){for(var C=[],J=[],v=0,E=c.vertices.length;v<E;v++){for(var n=c.vertices[v],i=false,p=0,l=C.length;p<l;p++){var w=C[p];if(n.position.x==w.position.x&&n.position.y==w.position.y&&n.position.z==w.position.z){J[v]=p;i=true;break}}if(!i){J[v]=C.length;C.push(new THREE.Vertex(n.position.clone()))}}v=0;for(E=c.faces.length;v<E;v++){n=c.faces[v];n.a=J[n.a];n.b=J[n.b];n.c=J[n.c];n.d=J[n.d]}c.vertices=C})();this.computeCentroids();this.computeFaceNormals();
- this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
- var Cylinder=function(a,b,e,d,f){function g(c,u,y){k.vertices.push(new THREE.Vertex(new THREE.Vector3(c,u,y)))}THREE.Geometry.call(this);var k=this,h=Math.PI,j;for(j=0;j<a;j++)g(Math.sin(2*h*j/a)*b,Math.cos(2*h*j/a)*b,0);for(j=0;j<a;j++)g(Math.sin(2*h*j/a)*e,Math.cos(2*h*j/a)*e,d);for(j=0;j<a;j++)k.faces.push(new THREE.Face4(j,j+a,a+(j+1)%a,(j+1)%a));if(e!=0){g(0,0,-f);for(j=a;j<a+a/2;j++)k.faces.push(new THREE.Face4(2*a,(2*j-2*a)%a,(2*j-2*a+1)%a,(2*j-2*a+2)%a))}if(b!=0){g(0,0,d+f);for(j=a+a/2;j<
- 2*a;j++)k.faces.push(new THREE.Face4((2*j-2*a+2)%a+a,(2*j-2*a+1)%a+a,(2*j-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
- var Plane=function(a,b,e,d){THREE.Geometry.call(this);var f,g=a/2,k=b/2;e=e||1;d=d||1;var h=e+1,j=d+1;a=a/e;var c=b/d;for(f=0;f<j;f++)for(b=0;b<h;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*c-k),0)));for(f=0;f<d;f++)for(b=0;b<e;b++){this.faces.push(new THREE.Face4(b+h*f,b+h*(f+1),b+1+h*(f+1),b+1+h*f));this.uvs.push([new THREE.UV(b/e,f/d),new THREE.UV(b/e,(f+1)/d),new THREE.UV((b+1)/e,(f+1)/d),new THREE.UV((b+1)/e,f/d)])}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
- Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
- var Sphere=function(a,b,e){THREE.Geometry.call(this);var d,f=Math.PI,g=Math.max(3,b||8),k=Math.max(2,e||6);b=[];for(e=0;e<k+1;e++){d=e/k;var h=a*Math.cos(d*f),j=a*Math.sin(d*f),c=[],u=0;for(d=0;d<g;d++){var y=2*d/g,r=j*Math.sin(y*f);y=j*Math.cos(y*f);(e==0||e==k)&&d>0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(y,h,r)))-1);c.push(u)}b.push(c)}var t,x;a=b.length;for(e=0;e<a;e++){f=b[e].length;if(e>0)for(d=0;d<f;d++){j=d==f-1;g=b[e][j?0:d+1];k=b[e][j?f-1:d];h=b[e-1][j?f-1:d];j=b[e-1][j?
- 0:d+1];u=e/(a-1);y=(e-1)/(a-1);t=(d+1)/f;r=d/f;c=new THREE.UV(1-t,u);u=new THREE.UV(1-r,u);r=new THREE.UV(1-r,y);var C=new THREE.UV(1-t,y);if(e<b.length-1){y=this.vertices[g].position.clone();t=this.vertices[k].position.clone();x=this.vertices[h].position.clone();y.normalize();t.normalize();x.normalize();this.faces.push(new THREE.Face3(g,k,h,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(x.x,x.y,x.z)]));this.uvs.push([c,u,r])}if(e>1){y=this.vertices[g].position.clone();
- t=this.vertices[h].position.clone();x=this.vertices[j].position.clone();y.normalize();t.normalize();x.normalize();this.faces.push(new THREE.Face3(g,h,j,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(x.x,x.y,x.z)]));this.uvs.push([c,r,C])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
- 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 e=document.createElement("script");e.type="text/javascript";e.onload=b;e.src=a;document.getElementsByTagName("head")[0].appendChild(e)},loadAscii:function(a,b,e){var d=(new Date).getTime();a=new Worker(a);a.onmessage=function(f){THREE.Loader.prototype.createModel(f.data,b,e)};a.postMessage(d)},loadBinary:function(a,b,e){var d=(new Date).getTime();a=new Worker(a);var f=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(g){THREE.Loader.prototype.loadAjaxBuffers(g.data.buffers,
- g.data.materials,b,e,f)};a.onerror=function(g){alert("worker.onerror: "+g.message+"\n"+g.data);g.preventDefault()};a.postMessage(d)},loadAjaxBuffers:function(a,b,e,d,f){var g=new XMLHttpRequest,k=d+"/"+a,h=0;g.onreadystatechange=function(){if(g.readyState==4)g.status==200||g.status==0?THREE.Loader.prototype.createBinModel(g.responseText,e,d,b):alert("Couldn't load ["+k+"] ["+g.status+"]");else if(g.readyState==3){if(f){if(h==0)h=g.getResponseHeader("Content-Length");f({total:h,loaded:g.responseText.length})}}else if(g.readyState==
- 2)h=g.getResponseHeader("Content-Length")};g.open("GET",k,true);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)},createBinModel:function(a,b,e,d){var f=function(g){function k(q,s){var F=u(q,s),P=u(q,s+1),X=u(q,s+2),Y=u(q,s+3),ea=(Y<<1&255|X>>7)-127;F=(X&127)<<16|P<<8|F;if(F==0&&ea==-127)return 0;return(1-2*(Y>>7))*(1+F*Math.pow(2,-23))*Math.pow(2,ea)}function h(q,s){var F=u(q,s),P=u(q,s+1),X=u(q,s+2);return(u(q,s+3)<<24)+(X<<16)+
- (P<<8)+F}function j(q,s){var F=u(q,s);return(u(q,s+1)<<8)+F}function c(q,s){var F=u(q,s);return F>127?F-256:F}function u(q,s){return q.charCodeAt(s)&255}function y(q){var s,F,P;s=h(a,q);F=h(a,q+l);P=h(a,q+w);q=j(a,q+o);THREE.Loader.prototype.f3(v,s,F,P,q)}function r(q){var s,F,P,X,Y,ea;s=h(a,q);F=h(a,q+l);P=h(a,q+w);X=j(a,q+o);Y=h(a,q+m);ea=h(a,q+z);q=h(a,q+L);THREE.Loader.prototype.f3n(v,i,s,F,P,X,Y,ea,q)}function t(q){var s,F,P,X;s=h(a,q);F=h(a,q+A);P=h(a,q+D);X=h(a,q+B);q=j(a,q+N);THREE.Loader.prototype.f4(v,
- s,F,P,X,q)}function x(q){var s,F,P,X,Y,ea,ma,oa;s=h(a,q);F=h(a,q+A);P=h(a,q+D);X=h(a,q+B);Y=j(a,q+N);ea=h(a,q+M);ma=h(a,q+O);oa=h(a,q+U);q=h(a,q+$);THREE.Loader.prototype.f4n(v,i,s,F,P,X,Y,ea,ma,oa,q)}function C(q){var s,F;s=h(a,q);F=h(a,q+W);q=h(a,q+S);THREE.Loader.prototype.uv3(v,p[s*2],p[s*2+1],p[F*2],p[F*2+1],p[q*2],p[q*2+1])}function J(q){var s,F,P;s=h(a,q);F=h(a,q+I);P=h(a,q+H);q=h(a,q+R);THREE.Loader.prototype.uv4(v,p[s*2],p[s*2+1],p[F*2],p[F*2+1],p[P*2],p[P*2+1],p[q*2],p[q*2+1])}var v=this,
- E=0,n,i=[],p=[],l,w,o,m,z,L,A,D,B,N,M,O,U,$,W,S,I,H,R;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(v,d,g);n={signature:a.substr(E,8),header_bytes:u(a,E+8),vertex_coordinate_bytes:u(a,E+9),normal_coordinate_bytes:u(a,E+10),uv_coordinate_bytes:u(a,E+11),vertex_index_bytes:u(a,E+12),normal_index_bytes:u(a,E+13),uv_index_bytes:u(a,E+14),material_index_bytes:u(a,E+15),nvertices:h(a,E+16),nnormals:h(a,E+16+4),nuvs:h(a,E+16+8),ntri_flat:h(a,E+16+12),ntri_smooth:h(a,E+16+16),ntri_flat_uv:h(a,
- E+16+20),ntri_smooth_uv:h(a,E+16+24),nquad_flat:h(a,E+16+28),nquad_smooth:h(a,E+16+32),nquad_flat_uv:h(a,E+16+36),nquad_smooth_uv:h(a,E+16+40)};E+=n.header_bytes;l=n.vertex_index_bytes;w=n.vertex_index_bytes*2;o=n.vertex_index_bytes*3;m=n.vertex_index_bytes*3+n.material_index_bytes;z=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;L=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;A=n.vertex_index_bytes;D=n.vertex_index_bytes*2;B=n.vertex_index_bytes*3;N=n.vertex_index_bytes*
- 4;M=n.vertex_index_bytes*4+n.material_index_bytes;O=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes;U=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*2;$=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*3;W=n.uv_index_bytes;S=n.uv_index_bytes*2;I=n.uv_index_bytes;H=n.uv_index_bytes*2;R=n.uv_index_bytes*3;E+=function(q){var s,F,P,X=n.vertex_coordinate_bytes*3,Y=q+n.nvertices*X;for(q=q;q<Y;q+=X){s=k(a,q);F=k(a,q+n.vertex_coordinate_bytes);P=k(a,
- q+n.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(v,s,F,P)}return n.nvertices*X}(E);E+=function(q){var s,F,P,X=n.normal_coordinate_bytes*3,Y=q+n.nnormals*X;for(q=q;q<Y;q+=X){s=c(a,q);F=c(a,q+n.normal_coordinate_bytes);P=c(a,q+n.normal_coordinate_bytes*2);i.push(s/127,F/127,P/127)}return n.nnormals*X}(E);E+=function(q){var s,F,P=n.uv_coordinate_bytes*2,X=q+n.nuvs*P;for(q=q;q<X;q+=P){s=k(a,q);F=k(a,q+n.uv_coordinate_bytes);p.push(s,F)}return n.nuvs*P}(E);E+=function(q){var s,F=n.vertex_index_bytes*
- 3+n.material_index_bytes,P=q+n.ntri_flat*F;for(s=q;s<P;s+=F)y(s);return P-q}(E);E+=function(q){var s,F=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,P=q+n.ntri_smooth*F;for(s=q;s<P;s+=F)r(s);return P-q}(E);E+=function(q){var s,F=n.vertex_index_bytes*3+n.material_index_bytes,P=F+n.uv_index_bytes*3,X=q+n.ntri_flat_uv*P;for(s=q;s<X;s+=P){y(s);C(s+F)}return X-q}(E);E+=function(q){var s,F=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,P=F+n.uv_index_bytes*3,
- X=q+n.ntri_smooth_uv*P;for(s=q;s<X;s+=P){r(s);C(s+F)}return X-q}(E);E+=function(q){var s,F=n.vertex_index_bytes*4+n.material_index_bytes,P=q+n.nquad_flat*F;for(s=q;s<P;s+=F)t(s);return P-q}(E);E+=function(q){var s,F=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,P=q+n.nquad_smooth*F;for(s=q;s<P;s+=F)x(s);return P-q}(E);E+=function(q){var s,F=n.vertex_index_bytes*4+n.material_index_bytes,P=F+n.uv_index_bytes*4,X=q+n.nquad_flat_uv*P;for(s=q;s<X;s+=P){t(s);J(s+F)}return X-q}(E);
- E+=function(q){var s,F=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,P=F+n.uv_index_bytes*4,X=q+n.nquad_smooth_uv*P;for(s=q;s<X;s+=P){x(s);J(s+F)}return X-q}(E);this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f(e))},createModel:function(a,b,e){var d=function(f){var g=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(g,a.materials,f);(function(){var k,h,j,c,u;k=0;for(h=
- a.vertices.length;k<h;k+=3){j=a.vertices[k];c=a.vertices[k+1];u=a.vertices[k+2];THREE.Loader.prototype.v(g,j,c,u)}})();(function(){function k(x,C){THREE.Loader.prototype.f3(g,x[C],x[C+1],x[C+2],x[C+3])}function h(x,C){THREE.Loader.prototype.f3n(g,a.normals,x[C],x[C+1],x[C+2],x[C+3],x[C+4],x[C+5],x[C+6])}function j(x,C){THREE.Loader.prototype.f4(g,x[C],x[C+1],x[C+2],x[C+3],x[C+4])}function c(x,C){THREE.Loader.prototype.f4n(g,a.normals,x[C],x[C+1],x[C+2],x[C+3],x[C+4],x[C+5],x[C+6],x[C+7],x[C+8])}function u(x,
- C){var J,v,E;J=x[C];v=x[C+1];E=x[C+2];THREE.Loader.prototype.uv3(g,a.uvs[J*2],a.uvs[J*2+1],a.uvs[v*2],a.uvs[v*2+1],a.uvs[E*2],a.uvs[E*2+1])}function y(x,C){var J,v,E,n;J=x[C];v=x[C+1];E=x[C+2];n=x[C+3];THREE.Loader.prototype.uv4(g,a.uvs[J*2],a.uvs[J*2+1],a.uvs[v*2],a.uvs[v*2+1],a.uvs[E*2],a.uvs[E*2+1],a.uvs[n*2],a.uvs[n*2+1])}var r,t;r=0;for(t=a.triangles.length;r<t;r+=4)k(a.triangles,r);r=0;for(t=a.triangles_uv.length;r<t;r+=7){k(a.triangles_uv,r);u(a.triangles_uv,r+4)}r=0;for(t=a.triangles_n.length;r<
- t;r+=7)h(a.triangles_n,r);r=0;for(t=a.triangles_n_uv.length;r<t;r+=10){h(a.triangles_n_uv,r);u(a.triangles_n_uv,r+7)}r=0;for(t=a.quads.length;r<t;r+=5)j(a.quads,r);r=0;for(t=a.quads_uv.length;r<t;r+=9){j(a.quads_uv,r);y(a.quads_uv,r+5)}r=0;for(t=a.quads_n.length;r<t;r+=9)c(a.quads_n,r);r=0;for(t=a.quads_n_uv.length;r<t;r+=13){c(a.quads_n_uv,r);y(a.quads_n_uv,r+9)}})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};d.prototype=new THREE.Geometry;d.prototype.constructor=
- d;b(new d(e))},v:function(a,b,e,d){a.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,d)))},f3:function(a,b,e,d,f){a.faces.push(new THREE.Face3(b,e,d,null,a.materials[f]))},f4:function(a,b,e,d,f,g){a.faces.push(new THREE.Face4(b,e,d,f,null,a.materials[g]))},f3n:function(a,b,e,d,f,g,k,h,j){g=a.materials[g];var c=b[h*3],u=b[h*3+1];h=b[h*3+2];var y=b[j*3],r=b[j*3+1];j=b[j*3+2];a.faces.push(new THREE.Face3(e,d,f,[new THREE.Vector3(b[k*3],b[k*3+1],b[k*3+2]),new THREE.Vector3(c,u,h),new THREE.Vector3(y,
- r,j)],g))},f4n:function(a,b,e,d,f,g,k,h,j,c,u){k=a.materials[k];var y=b[j*3],r=b[j*3+1];j=b[j*3+2];var t=b[c*3],x=b[c*3+1];c=b[c*3+2];var C=b[u*3],J=b[u*3+1];u=b[u*3+2];a.faces.push(new THREE.Face4(e,d,f,g,[new THREE.Vector3(b[h*3],b[h*3+1],b[h*3+2]),new THREE.Vector3(y,r,j),new THREE.Vector3(t,x,c),new THREE.Vector3(C,J,u)],k))},uv3:function(a,b,e,d,f,g,k){var h=[];h.push(new THREE.UV(b,e));h.push(new THREE.UV(d,f));h.push(new THREE.UV(g,k));a.uvs.push(h)},uv4:function(a,b,e,d,f,g,k,h,j){var c=[];
- c.push(new THREE.UV(b,e));c.push(new THREE.UV(d,f));c.push(new THREE.UV(g,k));c.push(new THREE.UV(h,j));a.uvs.push(c)},init_materials:function(a,b,e){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=[THREE.Loader.prototype.createMaterial(b[d],e)]},createMaterial:function(a,b){function e(g){g=Math.log(g)/Math.LN2;return Math.floor(g)==g}var d,f;if(a.map_diffuse&&b){f=document.createElement("canvas");d=new THREE.MeshLambertMaterial({map:new THREE.Texture(f)});f=new Image;f.onload=function(){if(!e(this.width)||
- !e(this.height)){var g=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),k=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));d.map.image.width=g;d.map.image.height=k;d.map.image.getContext("2d").drawImage(this,0,0,g,k)}else d.map.image=this;d.map.image.loaded=1};f.src=b+"/"+a.map_diffuse}else if(a.col_diffuse){f=(a.col_diffuse[0]*255<<16)+(a.col_diffuse[1]*255<<8)+a.col_diffuse[2]*255;d=new THREE.MeshLambertMaterial({color:f,opacity:a.transparency})}else d=a.a_dbg_color?new THREE.MeshLambertMaterial({color:a.a_dbg_color}):
- new THREE.MeshLambertMaterial({color:15658734});return d}};
|