123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- // 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,l){return g.distance-l.distance});return f},intersectObject:function(a){function b(K,I,D,n){n=n.clone().subSelf(I);D=D.clone().subSelf(I);var i=K.clone().subSelf(I);K=n.dot(n);I=n.dot(D);n=n.dot(i);var o=D.dot(D);D=D.dot(i);i=1/(K*o-I*I);o=(o*n-I*D)*i;K=(K*D-I*n)*i;return o>0&&K>0&&o+K<1}var e,d,f,g,l,h,k,c,u,y,
- r,s=a.geometry,w=s.vertices,z=[];e=0;for(d=s.faces.length;e<d;e++){f=s.faces[e];y=this.origin.clone();r=this.direction.clone();g=a.matrix.multiplyVector3(w[f.a].position.clone());l=a.matrix.multiplyVector3(w[f.b].position.clone());h=a.matrix.multiplyVector3(w[f.c].position.clone());k=f instanceof THREE.Face4?a.matrix.multiplyVector3(w[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,l,h)){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};z.push(f)}}else if(f instanceof THREE.Face4)if(b(y,g,l,k)||b(y,l,h,k)){f={distance:this.origin.distanceTo(y),point:y,face:f,object:a};z.push(f)}}}return z}};
- THREE.Rectangle=function(){function a(){g=d-b;l=f-e}var b,e,d,f,g,l,h=true;this.getX=function(){return b};this.getY=function(){return e};this.getWidth=function(){return g};this.getHeight=function(){return l};this.getLeft=function(){return b};this.getTop=function(){return e};this.getRight=function(){return d};this.getBottom=function(){return f};this.set=function(k,c,u,y){h=false;b=k;e=c;d=u;f=y;a()};this.addPoint=function(k,c){if(h){h=false;b=k;e=c;d=k;f=c}else{b=b<k?b:k;e=e<c?e:c;d=d>k?d:k;f=f>c?
- f:c}a()};this.add3Points=function(k,c,u,y,r,s){if(h){h=false;b=k<u?k<r?k:r:u<r?u:r;e=c<y?c<s?c:s:y<s?y:s;d=k>u?k>r?k:r:u>r?u:r;f=c>y?c>s?c:s:y>s?y:s}else{b=k<u?k<r?k<b?k:b:r<b?r:b:u<r?u<b?u:b:r<b?r:b;e=c<y?c<s?c<e?c:e:s<e?s:e:y<s?y<e?y:e:s<e?s:e;d=k>u?k>r?k>d?k:d:r>d?r:d:u>r?u>d?u:d:r>d?r:d;f=c>y?c>s?c>f?c:f:s>f?s:f:y>s?y>f?y:f:s>f?s:f}a()};this.addRectangle=function(k){if(h){h=false;b=k.getLeft();e=k.getTop();d=k.getRight();f=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();e=e<k.getTop()?e:k.getTop();
- d=d>k.getRight()?d:k.getRight();f=f>k.getBottom()?f:k.getBottom()}a()};this.inflate=function(k){b-=k;e-=k;d+=k;f+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();e=e>k.getTop()?e:k.getTop();d=d<k.getRight()?d:k.getRight();f=f<k.getBottom()?f:k.getBottom();a()};this.instersects=function(k){return Math.min(d,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(f,k.getBottom())-Math.max(e,k.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: "+l+" )"}};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,l,h,k,c,u,y,r,s,w,z){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=l||0;this.n24=h||0;this.n31=k||0;this.n32=c||0;this.n33=u||1;this.n34=y||0;this.n41=r||0;this.n42=s||0;this.n43=w||0;this.n44=z||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,l,h,k,c,u,y,r,s,w,z){this.n11=a;this.n12=b;this.n13=e;this.n14=d;this.n21=f;this.n22=g;this.n23=l;this.n24=h;this.n31=k;this.n32=c;this.n33=u;this.n34=y;this.n41=r;this.n42=s;this.n43=w;this.n44=z;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,l=a.n21,h=a.n22,k=a.n23,c=a.n24,u=a.n31,y=a.n32,
- r=a.n33,s=a.n34,w=a.n41,z=a.n42,K=a.n43,I=a.n44,D=b.n11,n=b.n12,i=b.n13,o=b.n14,j=b.n21,v=b.n22,q=b.n23,m=b.n24,A=b.n31,F=b.n32,M=b.n33,x=b.n34,J=b.n41,R=b.n42,C=b.n43,V=b.n44;this.n11=e*D+d*j+f*A+g*J;this.n12=e*n+d*v+f*F+g*R;this.n13=e*i+d*q+f*M+g*C;this.n14=e*o+d*m+f*x+g*V;this.n21=l*D+h*j+k*A+c*J;this.n22=l*n+h*v+k*F+c*R;this.n23=l*i+h*q+k*M+c*C;this.n24=l*o+h*m+k*x+c*V;this.n31=u*D+y*j+r*A+s*J;this.n32=u*n+y*v+r*F+s*R;this.n33=u*i+y*q+r*M+s*C;this.n34=u*o+y*m+r*x+s*V;this.n41=w*D+z*j+K*A+I*J;
- this.n42=w*n+z*v+K*F+I*R;this.n43=w*i+z*q+K*M+I*C;this.n44=w*o+z*m+K*x+I*V;return this},multiplySelf:function(a){var b=this.n11,e=this.n12,d=this.n13,f=this.n14,g=this.n21,l=this.n22,h=this.n23,k=this.n24,c=this.n31,u=this.n32,y=this.n33,r=this.n34,s=this.n41,w=this.n42,z=this.n43,K=this.n44,I=a.n11,D=a.n21,n=a.n31,i=a.n41,o=a.n12,j=a.n22,v=a.n32,q=a.n42,m=a.n13,A=a.n23,F=a.n33,M=a.n43,x=a.n14,J=a.n24,R=a.n34;a=a.n44;this.n11=b*I+e*D+d*n+f*i;this.n12=b*o+e*j+d*v+f*q;this.n13=b*m+e*A+d*F+f*M;this.n14=
- b*x+e*J+d*R+f*a;this.n21=g*I+l*D+h*n+k*i;this.n22=g*o+l*j+h*v+k*q;this.n23=g*m+l*A+h*F+k*M;this.n24=g*x+l*J+h*R+k*a;this.n31=c*I+u*D+y*n+r*i;this.n32=c*o+u*j+y*v+r*q;this.n33=c*m+u*A+y*F+r*M;this.n34=c*x+u*J+y*R+r*a;this.n41=s*I+w*D+z*n+K*i;this.n42=s*o+w*j+z*v+K*q;this.n43=s*m+w*A+z*F+K*M;this.n44=s*x+w*J+z*R+K*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,l=a.x,h=a.y,k=a.z;e.n11=g*l*l+d;e.n12=g*l*h-f*k;e.n13=g*l*k+f*h;e.n21=g*l*h+f*k;e.n22=g*h*h+d;e.n23=g*h*k-f*l;e.n31=g*l*k-f*h;e.n32=g*h*k+f*l;e.n33=g*k*k+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],l=b[10]*b[0]-b[2]*b[8],h=-b[6]*b[0]+b[2]*b[4],k=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]*k;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*l;a.m[5]=b*h;a.m[6]=b*k;a.m[7]=b*c;a.m[8]=b*u;return a};
- THREE.Matrix4.makeFrustum=function(a,b,e,d,f,g){var l,h,k;l=new THREE.Matrix4;h=2*f/(b-a);k=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);l.n11=h;l.n12=0;l.n13=a;l.n14=0;l.n21=0;l.n22=k;l.n23=e;l.n24=0;l.n31=0;l.n32=0;l.n33=d;l.n34=f;l.n41=0;l.n42=0;l.n43=-1;l.n44=0;return l};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 l,h,k,c;l=new THREE.Matrix4;h=b-a;k=e-d;c=g-f;a=(b+a)/h;e=(e+d)/k;f=(g+f)/c;l.n11=2/h;l.n12=0;l.n13=0;l.n14=-a;l.n21=0;l.n22=2/k;l.n23=0;l.n24=-e;l.n31=0;l.n32=0;l.n33=-2/c;l.n34=-f;l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};
- 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.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,l,h=new THREE.Vector3,k=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];l=this.vertices[g.c];h.sub(l.position,
- e.position);k.sub(b.position,e.position);h.crossSelf(k)}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(x,J,R,C){g=x.vertices[J].position;l=x.vertices[R].position;
- h=x.vertices[C].position;k=f[0];c=f[1];u=f[2];y=l.x-g.x;r=h.x-g.x;s=l.y-g.y;w=h.y-g.y;z=l.z-g.z;K=h.z-g.z;I=c.u-k.u;D=u.u-k.u;n=c.v-k.v;i=u.v-k.v;o=1/(I*i-D*n);m.set((i*y-n*r)*o,(i*s-n*w)*o,(i*z-n*K)*o);A.set((I*r-D*y)*o,(I*w-D*s)*o,(I*K-D*z)*o);v[J].addSelf(m);v[R].addSelf(m);v[C].addSelf(m);q[J].addSelf(A);q[R].addSelf(A);q[C].addSelf(A)}var b,e,d,f,g,l,h,k,c,u,y,r,s,w,z,K,I,D,n,i,o,j,v=[],q=[],m=new THREE.Vector3,A=new THREE.Vector3,F=new THREE.Vector3,M=new THREE.Vector3;j=new THREE.Vector3;b=
- 0;for(e=this.vertices.length;b<e;b++){v[b]=new THREE.Vector3;q[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++){j.copy(this.vertices[b].normal);d=v[b];F.copy(d);F.subSelf(j.multiplyScalar(j.dot(d))).normalize();M.cross(this.vertices[b].normal,d);test=M.dot(q[b]);d=test<0?-1:1;this.vertices[b].tangent.set(F.x,F.y,F.z,d)}this.hasTangents=true},computeBoundingBox:function(){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 a=1,b=this.vertices.length;a<b;a++){vertex=this.vertices[a];if(vertex.position.x<this.bbox.x[0])this.bbox.x[0]=vertex.position.x;else if(vertex.position.x>this.bbox.x[1])this.bbox.x[1]=vertex.position.x;if(vertex.position.y<this.bbox.y[0])this.bbox.y[0]=vertex.position.y;else if(vertex.position.y>this.bbox.y[1])this.bbox.y[1]=vertex.position.y;if(vertex.position.z<this.bbox.z[0])this.bbox.z[0]=
- vertex.position.z;else if(vertex.position.z>this.bbox.z[1])this.bbox.z[1]=vertex.position.z}}},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,l,h,k,c={};d=0;for(f=this.faces.length;d<f;d++){g=this.faces[d];l=g.material;h=a(l);if(c[h]==undefined)c[h]={hash:h,counter:0};k=c[h].hash+"_"+c[h].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],material:l,
- vertices:0};g=g instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+g>65535){c[h].counter+=1;k=c[h].hash+"_"+c[h].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],material:l,vertices:0}}this.geometryChunks[k].faces.push(d);this.geometryChunks[k].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.computeBoundingBox()};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(j,v){var q=0,m=1,A=j.z+j.w,F=v.z+v.w,M=-j.z+j.w,x=-v.z+v.w;if(A>=0&&F>=0&&M>=0&&x>=0)return true;else if(A<0&&F<0||M<0&&x<0)return false;else{if(A<0)q=Math.max(q,A/(A-F));else if(F<0)m=Math.min(m,A/(A-F));if(M<0)q=Math.max(q,M/(M-x));else if(x<0)m=Math.min(m,M/(M-x));if(m<q)return false;else{j.lerpSelf(v,q);v.lerpSelf(j,1-m);return true}}}function b(j,v){return v.z-j.z}var e,d,f=[],g,l,h,k=[],c,u,y=[],r,s,w=[],z=new THREE.Vector4,K=new THREE.Vector4,I=new THREE.Matrix4,
- D=new THREE.Matrix4,n=new THREE.Vector4,i=new THREE.Vector4,o;this.projectObjects=function(j,v,q){var m=[],A,F;d=0;I.multiply(v.projectionMatrix,v.matrix);A=j.objects;j=0;for(v=A.length;j<v;j++){F=A[j];if(F.visible!==false){e=f[d]=f[d]||new THREE.RenderableObject;z.copy(F.position);I.multiplyVector3(z);e.object=F;e.z=z.z;m.push(e);d++}}q&&m.sort(b);return m};this.projectScene=function(j,v,q){var m=[],A,F,M,x,J,R,C,V,T,$,W,O,G,B,S,p;h=u=s=0;v.autoUpdateMatrix&&v.updateMatrix();I.multiply(v.projectionMatrix,
- v.matrix);R=j.objects;j=0;for(A=R.length;j<A;j++){C=R[j];if(C.visible!==false){C.autoUpdateMatrix&&C.updateMatrix();V=C.matrix;T=C.rotationMatrix;$=C.material;W=C.overdraw;if(C instanceof THREE.Mesh){O=C.geometry;G=O.vertices;F=0;for(M=G.length;F<M;F++){B=G[F];B.positionWorld.copy(B.position);V.multiplyVector3(B.positionWorld);x=B.positionScreen;x.copy(B.positionWorld);I.multiplyVector4(x);x.multiplyScalar(1/x.w);B.__visible=x.z>0&&x.z<1}O=O.faces;F=0;for(M=O.length;F<M;F++){B=O[F];if(B instanceof
- THREE.Face3){x=G[B.a];J=G[B.b];S=G[B.c];if(x.__visible&&J.__visible&&S.__visible)if(C.doubleSided||C.flipSided!=(S.positionScreen.x-x.positionScreen.x)*(J.positionScreen.y-x.positionScreen.y)-(S.positionScreen.y-x.positionScreen.y)*(J.positionScreen.x-x.positionScreen.x)<0){g=k[h]=k[h]||new THREE.RenderableFace3;g.v1.positionWorld.copy(x.positionWorld);g.v2.positionWorld.copy(J.positionWorld);g.v3.positionWorld.copy(S.positionWorld);g.v1.positionScreen.copy(x.positionScreen);g.v2.positionScreen.copy(J.positionScreen);
- g.v3.positionScreen.copy(S.positionScreen);g.normalWorld.copy(B.normal);T.multiplyVector3(g.normalWorld);g.centroidWorld.copy(B.centroid);V.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);I.multiplyVector3(g.centroidScreen);S=B.vertexNormals;o=g.vertexNormalsWorld;x=0;for(J=S.length;x<J;x++){p=o[x]=o[x]||new THREE.Vector3;p.copy(S[x]);T.multiplyVector3(p)}g.z=g.centroidScreen.z;g.meshMaterial=$;g.faceMaterial=B.material;g.overdraw=W;if(C.geometry.uvs[F]){g.uvs[0]=C.geometry.uvs[F][0];
- g.uvs[1]=C.geometry.uvs[F][1];g.uvs[2]=C.geometry.uvs[F][2]}m.push(g);h++}}else if(B instanceof THREE.Face4){x=G[B.a];J=G[B.b];S=G[B.c];p=G[B.d];if(x.__visible&&J.__visible&&S.__visible&&p.__visible)if(C.doubleSided||C.flipSided!=((p.positionScreen.x-x.positionScreen.x)*(J.positionScreen.y-x.positionScreen.y)-(p.positionScreen.y-x.positionScreen.y)*(J.positionScreen.x-x.positionScreen.x)<0||(J.positionScreen.x-S.positionScreen.x)*(p.positionScreen.y-S.positionScreen.y)-(J.positionScreen.y-S.positionScreen.y)*
- (p.positionScreen.x-S.positionScreen.x)<0)){g=k[h]=k[h]||new THREE.RenderableFace3;g.v1.positionWorld.copy(x.positionWorld);g.v2.positionWorld.copy(J.positionWorld);g.v3.positionWorld.copy(p.positionWorld);g.v1.positionScreen.copy(x.positionScreen);g.v2.positionScreen.copy(J.positionScreen);g.v3.positionScreen.copy(p.positionScreen);g.normalWorld.copy(B.normal);T.multiplyVector3(g.normalWorld);g.centroidWorld.copy(B.centroid);V.multiplyVector3(g.centroidWorld);g.centroidScreen.copy(g.centroidWorld);
- I.multiplyVector3(g.centroidScreen);g.z=g.centroidScreen.z;g.meshMaterial=$;g.faceMaterial=B.material;g.overdraw=W;if(C.geometry.uvs[F]){g.uvs[0]=C.geometry.uvs[F][0];g.uvs[1]=C.geometry.uvs[F][1];g.uvs[2]=C.geometry.uvs[F][3]}m.push(g);h++;l=k[h]=k[h]||new THREE.RenderableFace3;l.v1.positionWorld.copy(J.positionWorld);l.v2.positionWorld.copy(S.positionWorld);l.v3.positionWorld.copy(p.positionWorld);l.v1.positionScreen.copy(J.positionScreen);l.v2.positionScreen.copy(S.positionScreen);l.v3.positionScreen.copy(p.positionScreen);
- l.normalWorld.copy(g.normalWorld);l.centroidWorld.copy(g.centroidWorld);l.centroidScreen.copy(g.centroidScreen);l.z=l.centroidScreen.z;l.meshMaterial=$;l.faceMaterial=B.material;l.overdraw=W;if(C.geometry.uvs[F]){l.uvs[0]=C.geometry.uvs[F][1];l.uvs[1]=C.geometry.uvs[F][2];l.uvs[2]=C.geometry.uvs[F][3]}m.push(l);h++}}}}else if(C instanceof THREE.Line){D.multiply(I,V);G=C.geometry.vertices;B=G[0];B.positionScreen.copy(B.position);D.multiplyVector4(B.positionScreen);F=1;for(M=G.length;F<M;F++){x=G[F];
- x.positionScreen.copy(x.position);D.multiplyVector4(x.positionScreen);J=G[F-1];n.copy(x.positionScreen);i.copy(J.positionScreen);if(a(n,i)){n.multiplyScalar(1/n.w);i.multiplyScalar(1/i.w);c=y[u]=y[u]||new THREE.RenderableLine;c.v1.positionScreen.copy(n);c.v2.positionScreen.copy(i);c.z=Math.max(n.z,i.z);c.material=C.material;m.push(c);u++}}}else if(C instanceof THREE.Particle){K.set(C.position.x,C.position.y,C.position.z,1);I.multiplyVector4(K);K.z/=K.w;if(K.z>0&&K.z<1){r=w[s]=w[s]||new THREE.RenderableParticle;
- r.x=K.x/K.w;r.y=K.y/K.w;r.z=K.z;r.rotation=C.rotation.z;r.scale.x=C.scale.x*Math.abs(r.x-(K.x+v.projectionMatrix.n11)/(K.w+v.projectionMatrix.n14));r.scale.y=C.scale.y*Math.abs(r.y-(K.y+v.projectionMatrix.n22)/(K.w+v.projectionMatrix.n24));r.material=C.material;m.push(r);s++}}}}q&&m.sort(b);return m};this.unprojectVector=function(j,v){var q=new THREE.Matrix4;q.multiply(THREE.Matrix4.makeInvert(v.matrix),THREE.Matrix4.makeInvert(v.projectionMatrix));q.multiplyVector3(j);return j}};
- 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(l,h){e=l;d=h;f=e/2;g=d/2};this.render=function(l,h){var k,c,u,y,r,s,w,z;a=b.projectScene(l,h);k=0;for(c=a.length;k<c;k++){r=a[k];if(r instanceof THREE.RenderableParticle){w=r.x*f+f;z=r.y*g+g;u=0;for(y=r.material.length;u<y;u++){s=r.material[u];if(s instanceof THREE.ParticleDOMMaterial){s=s.domElement;s.style.left=w+"px";s.style.top=z+"px"}}}}}};
- THREE.CanvasRenderer=function(){var a=null,b=new THREE.Projector,e=document.createElement("canvas"),d,f,g,l,h=e.getContext("2d"),k=1,c=0,u=null,y=null,r=1,s,w,z,K,I,D,n,i,o,j=new THREE.Color,v=new THREE.Color,q=new THREE.Color,m=new THREE.Color,A=new THREE.Color,F,M,x,J,R,C,V,T,$,W,O=new THREE.Rectangle,G=new THREE.Rectangle,B=new THREE.Rectangle,S=false,p=new THREE.Color,t=new THREE.Color,E=new THREE.Color,N=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;l=f/2;e.width=d;e.height=f;O.set(-g,-l,g,l)};this.clear=function(){if(!G.isEmpty()){G.inflate(1);G.minSelf(O);h.clearRect(G.getX(),
- G.getY(),G.getWidth(),G.getHeight());G.empty()}};this.render=function(ia,wa){function Ka(H){var U,Q,L,P=H.lights;t.setRGB(0,0,0);E.setRGB(0,0,0);N.setRGB(0,0,0);H=0;for(U=P.length;H<U;H++){Q=P[H];L=Q.color;if(Q instanceof THREE.AmbientLight){t.r+=L.r;t.g+=L.g;t.b+=L.b}else if(Q instanceof THREE.DirectionalLight){E.r+=L.r;E.g+=L.g;E.b+=L.b}else if(Q instanceof THREE.PointLight){N.r+=L.r;N.g+=L.g;N.b+=L.b}}}function xa(H,U,Q,L){var P,Z,ba,ca,da=H.lights;H=0;for(P=da.length;H<P;H++){Z=da[H];ba=Z.color;
- ca=Z.intensity;if(Z instanceof THREE.DirectionalLight){Z=Q.dot(Z.position)*ca;if(Z>0){L.r+=ba.r*Z;L.g+=ba.g*Z;L.b+=ba.b*Z}}else if(Z instanceof THREE.PointLight){Y.sub(Z.position,U);Y.normalize();Z=Q.dot(Y)*ca;if(Z>0){L.r+=ba.r*Z;L.g+=ba.g*Z;L.b+=ba.b*Z}}}}function La(H,U,Q){if(Q.opacity!=0){Ca(Q.opacity);ya(Q.blending);var L,P,Z,ba,ca,da;if(Q instanceof THREE.ParticleBasicMaterial){if(Q.map){ba=Q.map;ca=ba.width>>1;da=ba.height>>1;P=U.scale.x*g;Z=U.scale.y*l;Q=P*ca;L=Z*da;B.set(H.x-Q,H.y-L,H.x+Q,
- H.y+L);if(O.instersects(B)){h.save();h.translate(H.x,H.y);h.rotate(-U.rotation);h.scale(P,-Z);h.translate(-ca,-da);h.drawImage(ba,0,0);h.restore()}}}else if(Q instanceof THREE.ParticleCircleMaterial){if(S){p.r=t.r+E.r+N.r;p.g=t.g+E.g+N.g;p.b=t.b+E.b+N.b;j.r=Q.color.r*p.r;j.g=Q.color.g*p.g;j.b=Q.color.b*p.b;j.updateStyleString()}else j.__styleString=Q.color.__styleString;Q=U.scale.x*g;L=U.scale.y*l;B.set(H.x-Q,H.y-L,H.x+Q,H.y+L);if(O.instersects(B)){P=j.__styleString;if(y!=P)h.fillStyle=y=P;h.save();
- h.translate(H.x,H.y);h.rotate(-U.rotation);h.scale(Q,L);h.beginPath();h.arc(0,0,1,0,X,true);h.closePath();h.fill();h.restore()}}}}function Ma(H,U,Q,L){if(L.opacity!=0){Ca(L.opacity);ya(L.blending);h.beginPath();h.moveTo(H.positionScreen.x,H.positionScreen.y);h.lineTo(U.positionScreen.x,U.positionScreen.y);h.closePath();if(L instanceof THREE.LineBasicMaterial){j.__styleString=L.color.__styleString;H=L.linewidth;if(r!=H)h.lineWidth=r=H;H=j.__styleString;if(u!=H)h.strokeStyle=u=H;h.stroke();B.inflate(L.linewidth*
- 2)}}}function Ga(H,U,Q,L,P,Z){if(P.opacity!=0){Ca(P.opacity);ya(P.blending);K=H.positionScreen.x;I=H.positionScreen.y;D=U.positionScreen.x;n=U.positionScreen.y;i=Q.positionScreen.x;o=Q.positionScreen.y;h.beginPath();h.moveTo(K,I);h.lineTo(D,n);h.lineTo(i,o);h.lineTo(K,I);h.closePath();if(P instanceof THREE.MeshBasicMaterial)if(P.map)P.map.image.loaded&&P.map.mapping instanceof THREE.UVMapping&&sa(K,I,D,n,i,o,P.map.image,L.uvs[0].u,L.uvs[0].v,L.uvs[1].u,L.uvs[1].v,L.uvs[2].u,L.uvs[2].v);else if(P.env_map){if(P.env_map.image.loaded)if(P.env_map.mapping instanceof
- THREE.SphericalReflectionMapping){H=wa.matrix;Y.copy(L.vertexNormalsWorld[0]);R=(Y.x*H.n11+Y.y*H.n12+Y.z*H.n13)*0.5+0.5;C=-(Y.x*H.n21+Y.y*H.n22+Y.z*H.n23)*0.5+0.5;Y.copy(L.vertexNormalsWorld[1]);V=(Y.x*H.n11+Y.y*H.n12+Y.z*H.n13)*0.5+0.5;T=-(Y.x*H.n21+Y.y*H.n22+Y.z*H.n23)*0.5+0.5;Y.copy(L.vertexNormalsWorld[2]);$=(Y.x*H.n11+Y.y*H.n12+Y.z*H.n13)*0.5+0.5;W=-(Y.x*H.n21+Y.y*H.n22+Y.z*H.n23)*0.5+0.5;sa(K,I,D,n,i,o,P.env_map.image,R,C,V,T,$,W)}}else P.wireframe?za(P.color.__styleString,P.wireframe_linewidth):
- Aa(P.color.__styleString);else if(P instanceof THREE.MeshLambertMaterial){if(P.map&&!P.wireframe){P.map.mapping instanceof THREE.UVMapping&&sa(K,I,D,n,i,o,P.map.image,L.uvs[0].u,L.uvs[0].v,L.uvs[1].u,L.uvs[1].v,L.uvs[2].u,L.uvs[2].v);ya(THREE.SubtractiveBlending)}if(S)if(!P.wireframe&&P.shading==THREE.SmoothShading&&L.vertexNormalsWorld.length==3){v.r=q.r=m.r=t.r;v.g=q.g=m.g=t.g;v.b=q.b=m.b=t.b;xa(Z,L.v1.positionWorld,L.vertexNormalsWorld[0],v);xa(Z,L.v2.positionWorld,L.vertexNormalsWorld[1],q);xa(Z,
- L.v3.positionWorld,L.vertexNormalsWorld[2],m);A.r=(q.r+m.r)*0.5;A.g=(q.g+m.g)*0.5;A.b=(q.b+m.b)*0.5;J=Ha(v,q,m,A);sa(K,I,D,n,i,o,J,0,0,1,0,0,1)}else{p.r=t.r;p.g=t.g;p.b=t.b;xa(Z,L.centroidWorld,L.normalWorld,p);j.r=P.color.r*p.r;j.g=P.color.g*p.g;j.b=P.color.b*p.b;j.updateStyleString();P.wireframe?za(j.__styleString,P.wireframe_linewidth):Aa(j.__styleString)}else P.wireframe?za(P.color.__styleString,P.wireframe_linewidth):Aa(P.color.__styleString)}else if(P instanceof THREE.MeshDepthMaterial){F=P.__2near;
- M=P.__farPlusNear;x=P.__farMinusNear;v.r=v.g=v.b=1-F/(M-H.positionScreen.z*x);q.r=q.g=q.b=1-F/(M-U.positionScreen.z*x);m.r=m.g=m.b=1-F/(M-Q.positionScreen.z*x);A.r=(q.r+m.r)*0.5;A.g=(q.g+m.g)*0.5;A.b=(q.b+m.b)*0.5;J=Ha(v,q,m,A);sa(K,I,D,n,i,o,J,0,0,1,0,0,1)}else if(P instanceof THREE.MeshNormalMaterial){j.r=Da(L.normalWorld.x);j.g=Da(L.normalWorld.y);j.b=Da(L.normalWorld.z);j.updateStyleString();P.wireframe?za(j.__styleString,P.wireframe_linewidth):Aa(j.__styleString)}}}function za(H,U){if(u!=H)h.strokeStyle=
- u=H;if(r!=U)h.lineWidth=r=U;h.stroke();B.inflate(U*2)}function Aa(H){if(y!=H)h.fillStyle=y=H;h.fill()}function sa(H,U,Q,L,P,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;Q-=H;L-=U;P-=H;Z-=U;ja-=ca;ga-=da;ka-=ca;ta-=da;la=1/(ja*ta-ka*ga);na=(ta*Q-ga*P)*la;ga=(ta*L-ga*Z)*la;Q=(ja*P-ka*Q)*la;L=(ja*Z-ka*L)*la;H=H-na*ca-Q*da;U=U-ga*ca-L*da;h.save();h.transform(na,ga,Q,L,H,U);h.clip();h.drawImage(ba,0,0);h.restore()}function Ca(H){if(k!=H)h.globalAlpha=
- k=H}function ya(H){if(c!=H){switch(H){case THREE.NormalBlending:h.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:h.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:h.globalCompositeOperation="darker"}c=H}}function Ha(H,U,Q,L){var P=~~(H.r*255),Z=~~(H.g*255);H=~~(H.b*255);var ba=~~(U.r*255),ca=~~(U.g*255);U=~~(U.b*255);var da=~~(Q.r*255),ja=~~(Q.g*255);Q=~~(Q.b*255);var ga=~~(L.r*255),ka=~~(L.g*255);L=~~(L.b*255);fa[0]=P<0?0:P>255?255:P;fa[1]=Z<0?0:
- Z>255?255:Z;fa[2]=H<0?0:H>255?255:H;fa[4]=ba<0?0:ba>255?255:ba;fa[5]=ca<0?0:ca>255?255:ca;fa[6]=U<0?0:U>255?255:U;fa[8]=da<0?0:da>255?255:da;fa[9]=ja<0?0:ja>255?255:ja;fa[10]=Q<0?0:Q>255?255:Q;fa[12]=ga<0?0:ga>255?255:ga;fa[13]=ka<0?0:ka>255?255:ka;fa[14]=L<0?0:L>255?255:L;ma.putImageData(oa,0,0);va.drawImage(ea,0,0);return ra}function Da(H){H=(H+1)*0.5;return H<0?0:H>1?1:H}function Ea(H,U){var Q=U.x-H.x,L=U.y-H.y,P=1/Math.sqrt(Q*Q+L*L);Q*=P;L*=P;U.x+=Q;U.y+=L;H.x-=Q;H.y-=L}var Ba,Ia,aa,ha,qa,Fa,
- Ja,ua;h.setTransform(1,0,0,-1,g,l);this.autoClear&&this.clear();a=b.projectScene(ia,wa,this.sortElements);(S=ia.lights.length>0)&&Ka(ia);Ba=0;for(Ia=a.length;Ba<Ia;Ba++){aa=a[Ba];B.empty();if(aa instanceof THREE.RenderableParticle){s=aa;s.x*=g;s.y*=l;ha=0;for(qa=aa.material.length;ha<qa;ha++)La(s,aa,aa.material[ha],ia)}else if(aa instanceof THREE.RenderableLine){s=aa.v1;w=aa.v2;s.positionScreen.x*=g;s.positionScreen.y*=l;w.positionScreen.x*=g;w.positionScreen.y*=l;B.addPoint(s.positionScreen.x,s.positionScreen.y);
- B.addPoint(w.positionScreen.x,w.positionScreen.y);if(O.instersects(B)){ha=0;for(qa=aa.material.length;ha<qa;)Ma(s,w,aa,aa.material[ha++],ia)}}else if(aa instanceof THREE.RenderableFace3){s=aa.v1;w=aa.v2;z=aa.v3;s.positionScreen.x*=g;s.positionScreen.y*=l;w.positionScreen.x*=g;w.positionScreen.y*=l;z.positionScreen.x*=g;z.positionScreen.y*=l;if(aa.overdraw){Ea(s.positionScreen,w.positionScreen);Ea(w.positionScreen,z.positionScreen);Ea(z.positionScreen,s.positionScreen)}B.add3Points(s.positionScreen.x,
- s.positionScreen.y,w.positionScreen.x,w.positionScreen.y,z.positionScreen.x,z.positionScreen.y);if(O.instersects(B)){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(s,w,z,aa,ua,ia)}else Ga(s,w,z,aa,ua,ia)}}}G.addRectangle(B)}h.setTransform(1,0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(T,$,W){var O,G,B,S;O=0;for(G=T.lights.length;O<G;O++){B=T.lights[O];if(B instanceof THREE.DirectionalLight){S=$.normalWorld.dot(B.position)*B.intensity;if(S>0){W.r+=B.color.r*S;W.g+=B.color.g*S;W.b+=B.color.b*S}}else if(B instanceof THREE.PointLight){m.sub(B.position,$.centroidWorld);m.normalize();S=$.normalWorld.dot(m)*B.intensity;if(S>0){W.r+=B.color.r*S;W.g+=B.color.g*S;W.b+=B.color.b*S}}}}function b(T,$,W,O,G,B){x=d(J++);x.setAttribute("d","M "+T.positionScreen.x+
- " "+T.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(G instanceof THREE.MeshBasicMaterial)n.__styleString=G.color.__styleString;else if(G instanceof THREE.MeshLambertMaterial)if(D){i.r=o.r;i.g=o.g;i.b=o.b;a(B,O,i);n.r=G.color.r*i.r;n.g=G.color.g*i.g;n.b=G.color.b*i.b;n.updateStyleString()}else n.__styleString=G.color.__styleString;else if(G instanceof THREE.MeshDepthMaterial){q=1-G.__2near/(G.__farPlusNear-O.z*G.__farMinusNear);
- n.setRGB(q,q,q)}else G instanceof THREE.MeshNormalMaterial&&n.setRGB(f(O.normalWorld.x),f(O.normalWorld.y),f(O.normalWorld.z));G.wireframe?x.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+G.wireframe_linewidth+"; stroke-opacity: "+G.opacity+"; stroke-linecap: "+G.wireframe_linecap+"; stroke-linejoin: "+G.wireframe_linejoin):x.setAttribute("style","fill: "+n.__styleString+"; fill-opacity: "+G.opacity);h.appendChild(x)}function e(T,$,W,O,G,B,S){x=d(J++);x.setAttribute("d",
- "M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+$.positionScreen.x+" "+$.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+"z");if(B instanceof THREE.MeshBasicMaterial)n.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshLambertMaterial)if(D){i.r=o.r;i.g=o.g;i.b=o.b;a(S,G,i);n.r=B.color.r*i.r;n.g=B.color.g*i.g;n.b=B.color.b*i.b;n.updateStyleString()}else n.__styleString=B.color.__styleString;else if(B instanceof THREE.MeshDepthMaterial){q=
- 1-B.__2near/(B.__farPlusNear-G.z*B.__farMinusNear);n.setRGB(q,q,q)}else B instanceof THREE.MeshNormalMaterial&&n.setRGB(f(G.normalWorld.x),f(G.normalWorld.y),f(G.normalWorld.z));B.wireframe?x.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+B.wireframe_linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframe_linecap+"; stroke-linejoin: "+B.wireframe_linejoin):x.setAttribute("style","fill: "+n.__styleString+"; fill-opacity: "+B.opacity);h.appendChild(x)}
- function d(T){if(A[T]==null){A[T]=document.createElementNS("http://www.w3.org/2000/svg","path");V==0&&A[T].setAttribute("shape-rendering","crispEdges");return A[T]}return A[T]}function f(T){return T<0?Math.min((1+T)*0.5,0.5):0.5+Math.min(T*0.5,0.5)}var g=null,l=new THREE.Projector,h=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,c,u,y,r,s,w,z,K=new THREE.Rectangle,I=new THREE.Rectangle,D=false,n=new THREE.Color(16777215),i=new THREE.Color(16777215),o=new THREE.Color(0),j=new THREE.Color(0),
- v=new THREE.Color(0),q,m=new THREE.Vector3,A=[],F=[],M=[],x,J,R,C,V=1;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(T){switch(T){case "high":V=1;break;case "low":V=0}};this.setSize=function(T,$){k=T;c=$;u=k/2;y=c/2;h.setAttribute("viewBox",-u+" "+-y+" "+k+" "+c);h.setAttribute("width",k);h.setAttribute("height",c);K.set(-u,-y,u,y)};this.clear=function(){for(;h.childNodes.length>0;)h.removeChild(h.childNodes[0])};this.render=function(T,$){var W,O,
- G,B,S,p,t,E;this.autoClear&&this.clear();g=l.projectScene(T,$,this.sortElements);C=R=J=0;if(D=T.lights.length>0){t=T.lights;o.setRGB(0,0,0);j.setRGB(0,0,0);v.setRGB(0,0,0);W=0;for(O=t.length;W<O;W++){G=t[W];B=G.color;if(G instanceof THREE.AmbientLight){o.r+=B.r;o.g+=B.g;o.b+=B.b}else if(G instanceof THREE.DirectionalLight){j.r+=B.r;j.g+=B.g;j.b+=B.b}else if(G instanceof THREE.PointLight){v.r+=B.r;v.g+=B.g;v.b+=B.b}}}W=0;for(O=g.length;W<O;W++){t=g[W];I.empty();if(t instanceof THREE.RenderableParticle){r=
- t;r.x*=u;r.y*=-y;G=0;for(B=t.material.length;G<B;G++)if(E=t.material[G]){S=r;p=t;E=E;var N=R++;if(F[N]==null){F[N]=document.createElementNS("http://www.w3.org/2000/svg","circle");V==0&&F[N].setAttribute("shape-rendering","crispEdges")}x=F[N];x.setAttribute("cx",S.x);x.setAttribute("cy",S.y);x.setAttribute("r",p.scale.x*u);if(E instanceof THREE.ParticleCircleMaterial){if(D){i.r=o.r+j.r+v.r;i.g=o.g+j.g+v.g;i.b=o.b+j.b+v.b;n.r=E.color.r*i.r;n.g=E.color.g*i.g;n.b=E.color.b*i.b;n.updateStyleString()}else n=
- E.color;x.setAttribute("style","fill: "+n.__styleString)}h.appendChild(x)}}else if(t instanceof THREE.RenderableLine){r=t.v1;s=t.v2;r.positionScreen.x*=u;r.positionScreen.y*=-y;s.positionScreen.x*=u;s.positionScreen.y*=-y;I.addPoint(r.positionScreen.x,r.positionScreen.y);I.addPoint(s.positionScreen.x,s.positionScreen.y);if(K.instersects(I)){G=0;for(B=t.material.length;G<B;)if(E=t.material[G++]){S=r;p=s;E=E;N=C++;if(M[N]==null){M[N]=document.createElementNS("http://www.w3.org/2000/svg","line");V==
- 0&&M[N].setAttribute("shape-rendering","crispEdges")}x=M[N];x.setAttribute("x1",S.positionScreen.x);x.setAttribute("y1",S.positionScreen.y);x.setAttribute("x2",p.positionScreen.x);x.setAttribute("y2",p.positionScreen.y);if(E instanceof THREE.LineBasicMaterial){n.__styleString=E.color.__styleString;x.setAttribute("style","fill: none; stroke: "+n.__styleString+"; stroke-width: "+E.linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.linecap+"; stroke-linejoin: "+E.linejoin);h.appendChild(x)}}}}else if(t instanceof
- THREE.RenderableFace3){r=t.v1;s=t.v2;w=t.v3;r.positionScreen.x*=u;r.positionScreen.y*=-y;s.positionScreen.x*=u;s.positionScreen.y*=-y;w.positionScreen.x*=u;w.positionScreen.y*=-y;I.addPoint(r.positionScreen.x,r.positionScreen.y);I.addPoint(s.positionScreen.x,s.positionScreen.y);I.addPoint(w.positionScreen.x,w.positionScreen.y);if(K.instersects(I)){G=0;for(B=t.meshMaterial.length;G<B;){E=t.meshMaterial[G++];if(E instanceof THREE.MeshFaceMaterial){S=0;for(p=t.faceMaterial.length;S<p;)(E=t.faceMaterial[S++])&&
- b(r,s,w,t,E,T)}else E&&b(r,s,w,t,E,T)}}}else if(t instanceof THREE.RenderableFace4){r=t.v1;s=t.v2;w=t.v3;z=t.v4;r.positionScreen.x*=u;r.positionScreen.y*=-y;s.positionScreen.x*=u;s.positionScreen.y*=-y;w.positionScreen.x*=u;w.positionScreen.y*=-y;z.positionScreen.x*=u;z.positionScreen.y*=-y;I.addPoint(r.positionScreen.x,r.positionScreen.y);I.addPoint(s.positionScreen.x,s.positionScreen.y);I.addPoint(w.positionScreen.x,w.positionScreen.y);I.addPoint(z.positionScreen.x,z.positionScreen.y);if(K.instersects(I)){G=
- 0;for(B=t.meshMaterial.length;G<B;){E=t.meshMaterial[G++];if(E instanceof THREE.MeshFaceMaterial){S=0;for(p=t.faceMaterial.length;S<p;)(E=t.faceMaterial[S++])&&e(r,s,w,z,t,E,T)}else E&&e(r,s,w,z,t,E,T)}}}}}};
- THREE.WebGLRenderer=function(a){function b(i,o){var j=c.createProgram(),v=[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(j,l("fragment","#ifdef GL_ES\nprecision highp float;\n#endif\nuniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"+
- i));c.attachShader(j,l("vertex",v+o));c.linkProgram(j);c.getProgramParameter(j,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(j,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");j.uniforms={};j.attributes={};return j}function e(i,o){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 j=0;j<6;++j)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,i.image[j]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);i.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+o);c.bindTexture(c.TEXTURE_CUBE_MAP,
- i.image.__webGLTextureCube)}}function d(i,o){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+o);c.bindTexture(c.TEXTURE_2D,i.__webGLTexture)}function f(i,o){var j,v,q;j=0;for(v=o.length;j<v;j++){q=o[j];i.uniforms[q]=c.getUniformLocation(i,q)}}function g(i,o){var j,v,q;j=0;for(v=o.length;j<v;j++){q=o[j];i.attributes[q]=c.getAttribLocation(i,q)}}function l(i,o){var j;if(i=="fragment")j=c.createShader(c.FRAGMENT_SHADER);else if(i=="vertex")j=c.createShader(c.VERTEX_SHADER);c.shaderSource(j,o);c.compileShader(j);if(!c.getShaderParameter(j,
- c.COMPILE_STATUS)){alert(c.getShaderInfoLog(j));return null}return j}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 k=document.createElement("canvas"),c,u,y,r=new THREE.Matrix4,s,w=new Float32Array(16),z=new Float32Array(16),K=new Float32Array(16),I=new Float32Array(9),D=new Float32Array(16);a=function(i,o){if(i){var j,v,q,m=pointLights=maxDirLights=maxPointLights=0;j=0;for(v=i.lights.length;j<v;j++){q=i.lights[j];q instanceof THREE.DirectionalLight&&m++;q instanceof THREE.PointLight&&pointLights++}if(pointLights+m<=o){maxDirLights=
- m;maxPointLights=pointLights}else{maxDirLights=Math.ceil(o*m/(pointLights+m));maxPointLights=o-maxDirLights}return{directional:maxDirLights,point:maxPointLights}}return{directional:1,point:o-1}}(a,4);this.domElement=k;this.autoClear=true;try{c=k.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,o){var j=[i?"#define MAX_DIR_LIGHTS "+i:"",o?"#define MAX_POINT_LIGHTS "+o:"","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 ];":"",o?"uniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];":
- "",o?"uniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];":"","varying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vLightWeighting;",o?"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?"}":"",o?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",o?"vec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );":"",o?"vPointLightVector[ i ] = normalize( lPosition.xyz - mvPosition.xyz );":
- "",o?"float pointLightWeighting = max( dot( transformedNormal, vPointLightVector[ i ] ), 0.0 );":"",o?"vLightWeighting += pointLightColor[ i ] * pointLightWeighting;":"",o?"}":"","}\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"),
- v=[i?"#define MAX_DIR_LIGHTS "+i:"",o?"#define MAX_POINT_LIGHTS "+o:"","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;",o?"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 );",
- o?"vec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );":"",o?"vec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );":"",o?"for( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {":"",o?"vec3 pointVector = normalize( vPointLightVector[ i ] );":"",o?"vec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );":"",o?"float pointDotNormalHalf = dot( normal, pointHalfVector );":"",o?"float pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );":"",o?"float pointSpecularWeight = 0.0;":"",o?"if ( pointDotNormalHalf >= 0.0 )":
- "",o?"pointSpecularWeight = pow( pointDotNormalHalf, mShininess );":"",o?"pointDiffuse += mColor * pointDiffuseWeight;":"",o?"pointSpecular += mSpecular * pointSpecularWeight;":"",o?"}":"",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;":"",o?"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");
- j=b(v,j);c.useProgram(j);f(j,["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(j,["directionalLightNumber","directionalLightColor","directionalLightDirection"]);o&&f(j,["pointLightNumber","pointLightColor",
- "pointLightPosition"]);c.uniform1i(j.uniforms.enableMap,0);c.uniform1i(j.uniforms.tMap,0);c.uniform1i(j.uniforms.enableCubeMap,0);c.uniform1i(j.uniforms.tCube,1);c.uniform1i(j.uniforms.mixEnvMap,0);c.uniform1i(j.uniforms.useRefract,0);g(j,["position","normal","uv"]);return j}(a.directional,a.point);this.setSize=function(i,o){k.width=i;k.height=o;c.viewport(0,0,k.width,k.height)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(i,o){var j,v,q,m,A,F=[],
- M=[],x=[];m=[];A=[];c.uniform1i(i.uniforms.enableLighting,o.length);j=0;for(v=o.length;j<v;j++){q=o[j];if(q instanceof THREE.AmbientLight)F.push(q);else if(q instanceof THREE.DirectionalLight)x.push(q);else q instanceof THREE.PointLight&&M.push(q)}j=q=m=A=0;for(v=F.length;j<v;j++){q+=F[j].color.r;m+=F[j].color.g;A+=F[j].color.b}c.uniform3f(i.uniforms.ambientLightColor,q,m,A);m=[];A=[];j=0;for(v=x.length;j<v;j++){q=x[j];m.push(q.color.r*q.intensity);m.push(q.color.g*q.intensity);m.push(q.color.b*q.intensity);
- A.push(q.position.x);A.push(q.position.y);A.push(q.position.z)}if(x.length){c.uniform1i(i.uniforms.directionalLightNumber,x.length);c.uniform3fv(i.uniforms.directionalLightDirection,A);c.uniform3fv(i.uniforms.directionalLightColor,m)}m=[];A=[];j=0;for(v=M.length;j<v;j++){q=M[j];m.push(q.color.r*q.intensity);m.push(q.color.g*q.intensity);m.push(q.color.b*q.intensity);A.push(q.position.x);A.push(q.position.y);A.push(q.position.z)}if(M.length){c.uniform1i(i.uniforms.pointLightNumber,M.length);c.uniform3fv(i.uniforms.pointLightPosition,
- A);c.uniform3fv(i.uniforms.pointLightColor,m)}};this.createBuffers=function(i,o){var j,v,q,m,A,F,M,x,J,R=[],C=[],V=[],T=[],$=[],W=[],O=0,G=i.geometry.geometryChunks[o],B;q=false;j=0;for(v=i.material.length;j<v;j++){meshMaterial=i.material[j];if(meshMaterial instanceof THREE.MeshFaceMaterial){A=0;for(B=G.material.length;A<B;A++)if(G.material[A]&&G.material[A].shading!=undefined&&G.material[A].shading==THREE.SmoothShading){q=true;break}}else if(meshMaterial&&meshMaterial.shading!=undefined&&meshMaterial.shading==
- THREE.SmoothShading){q=true;break}if(q)break}B=q;j=0;for(v=G.faces.length;j<v;j++){q=G.faces[j];m=i.geometry.faces[q];A=m.vertexNormals;faceNormal=m.normal;q=i.geometry.uvs[q];if(m instanceof THREE.Face3){F=i.geometry.vertices[m.a].position;M=i.geometry.vertices[m.b].position;x=i.geometry.vertices[m.c].position;V.push(F.x,F.y,F.z);V.push(M.x,M.y,M.z);V.push(x.x,x.y,x.z);if(i.geometry.hasTangents){F=i.geometry.vertices[m.a].tangent;M=i.geometry.vertices[m.b].tangent;x=i.geometry.vertices[m.c].tangent;
- $.push(F.x,F.y,F.z,F.w);$.push(M.x,M.y,M.z,M.w);$.push(x.x,x.y,x.z,x.w)}if(A.length==3&&B)for(m=0;m<3;m++)T.push(A[m].x,A[m].y,A[m].z);else for(m=0;m<3;m++)T.push(faceNormal.x,faceNormal.y,faceNormal.z);if(q)for(m=0;m<3;m++)W.push(q[m].u,q[m].v);R.push(O,O+1,O+2);C.push(O,O+1);C.push(O,O+2);C.push(O+1,O+2);O+=3}else if(m instanceof THREE.Face4){F=i.geometry.vertices[m.a].position;M=i.geometry.vertices[m.b].position;x=i.geometry.vertices[m.c].position;J=i.geometry.vertices[m.d].position;V.push(F.x,
- F.y,F.z);V.push(M.x,M.y,M.z);V.push(x.x,x.y,x.z);V.push(J.x,J.y,J.z);if(i.geometry.hasTangents){F=i.geometry.vertices[m.a].tangent;M=i.geometry.vertices[m.b].tangent;x=i.geometry.vertices[m.c].tangent;m=i.geometry.vertices[m.d].tangent;$.push(F.x,F.y,F.z,F.w);$.push(M.x,M.y,M.z,M.w);$.push(x.x,x.y,x.z,x.w);$.push(m.x,m.y,m.z,m.w)}if(A.length==4&&B)for(m=0;m<4;m++)T.push(A[m].x,A[m].y,A[m].z);else for(m=0;m<4;m++)T.push(faceNormal.x,faceNormal.y,faceNormal.z);if(q)for(m=0;m<4;m++)W.push(q[m].u,q[m].v);
- R.push(O,O+1,O+2);R.push(O,O+2,O+3);C.push(O,O+1);C.push(O,O+2);C.push(O,O+3);C.push(O+1,O+2);C.push(O+2,O+3);O+=4}}if(V.length){G.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,G.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(V),c.STATIC_DRAW);G.__webGLNormalBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,G.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(T),c.STATIC_DRAW);if(i.geometry.hasTangents){G.__webGLTangentBuffer=c.createBuffer();
- c.bindBuffer(c.ARRAY_BUFFER,G.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array($),c.STATIC_DRAW)}if(W.length>0){G.__webGLUVBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,G.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(W),c.STATIC_DRAW)}G.__webGLFaceBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,G.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(R),c.STATIC_DRAW);G.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
- G.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(C),c.STATIC_DRAW);G.__webGLFaceCount=R.length;G.__webGLLineCount=C.length}};this.renderBuffer=function(i,o,j,v){var q,m,A,F,M,x,J,R,C;if(j instanceof THREE.MeshShaderMaterial){if(!j.program){j.program=b(j.fragment_shader,j.vertex_shader);J=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(C in j.uniforms)J.push(C);f(j.program,J);g(j.program,["position","normal","uv","tangent"])}C=
- j.program}else C=y;if(C!=u){c.useProgram(C);u=C}C==y&&this.setupLights(C,o);this.loadCamera(C,i);this.loadMatrices(C);if(j instanceof THREE.MeshShaderMaterial){A=j.wireframe;F=j.wireframe_linewidth;i=C;o=j.uniforms;var V;for(q in o){R=o[q].type;J=o[q].value;V=i.uniforms[q];if(R=="i")c.uniform1i(V,J);else if(R=="f")c.uniform1f(V,J);else if(R=="v3")c.uniform3f(V,J.x,J.y,J.z);else if(R=="c")c.uniform3f(V,J.r,J.g,J.b);else if(R=="t"){c.uniform1i(V,J);if(R=o[q].texture)R.image instanceof Array&&R.image.length==
- 6?e(R,J):d(R,J)}}}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshBasicMaterial){q=j.color;m=j.opacity;A=j.wireframe;F=j.wireframe_linewidth;M=j.map;x=j.env_map;o=j.combine==THREE.MixOperation;i=j.reflectivity;R=j.env_map&&j.env_map.mapping instanceof THREE.CubeRefractionMapping;J=j.refraction_ratio;c.uniform4f(C.uniforms.mColor,q.r*m,q.g*m,q.b*m,m);c.uniform1i(C.uniforms.mixEnvMap,o);c.uniform1f(C.uniforms.mReflectivity,i);c.uniform1i(C.uniforms.useRefract,
- R);c.uniform1f(C.uniforms.mRefractionRatio,J)}if(j instanceof THREE.MeshNormalMaterial){m=j.opacity;c.uniform1f(C.uniforms.mOpacity,m);c.uniform1i(C.uniforms.material,4)}else if(j instanceof THREE.MeshDepthMaterial){m=j.opacity;A=j.wireframe;F=j.wireframe_linewidth;c.uniform1f(C.uniforms.mOpacity,m);c.uniform1f(C.uniforms.m2Near,j.__2near);c.uniform1f(C.uniforms.mFarPlusNear,j.__farPlusNear);c.uniform1f(C.uniforms.mFarMinusNear,j.__farMinusNear);c.uniform1i(C.uniforms.material,3)}else if(j instanceof
- THREE.MeshPhongMaterial){q=j.ambient;i=j.specular;j=j.shininess;c.uniform4f(C.uniforms.mAmbient,q.r,q.g,q.b,m);c.uniform4f(C.uniforms.mSpecular,i.r,i.g,i.b,m);c.uniform1f(C.uniforms.mShininess,j);c.uniform1i(C.uniforms.material,2)}else if(j instanceof THREE.MeshLambertMaterial)c.uniform1i(C.uniforms.material,1);else j instanceof THREE.MeshBasicMaterial&&c.uniform1i(C.uniforms.material,0);if(M){d(M,0);c.uniform1i(C.uniforms.tMap,0);c.uniform1i(C.uniforms.enableMap,1)}else c.uniform1i(C.uniforms.enableMap,
- 0);if(x){e(x,1);c.uniform1i(C.uniforms.tCube,1);c.uniform1i(C.uniforms.enableCubeMap,1)}else c.uniform1i(C.uniforms.enableCubeMap,0);m=C.attributes;c.bindBuffer(c.ARRAY_BUFFER,v.__webGLVertexBuffer);c.vertexAttribPointer(m.position,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(m.position);if(m.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,v.__webGLNormalBuffer);c.vertexAttribPointer(m.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(m.normal)}if(m.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,v.__webGLTangentBuffer);
- c.vertexAttribPointer(m.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(m.tangent)}if(m.uv>=0)if(v.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,v.__webGLUVBuffer);c.vertexAttribPointer(m.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(m.uv)}else c.disableVertexAttribArray(m.uv);if(A){c.lineWidth(F);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.__webGLLineBuffer);c.drawElements(c.LINES,v.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,v.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,
- v.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(i,o,j,v,q,m){var A,F,M,x,J;M=0;for(x=j.material.length;M<x;M++){A=j.material[M];if(A instanceof THREE.MeshFaceMaterial){A=0;for(F=v.material.length;A<F;A++)if((J=v.material[A])&&J.blending==q&&J.opacity<1==m){this.setBlending(J.blending);this.renderBuffer(i,o,J,v)}}else if((J=A)&&J.blending==q&&J.opacity<1==m){this.setBlending(J.blending);this.renderBuffer(i,o,J,v)}}};this.render=function(i,o){var j,v,q,m,A=i.lights;this.initWebGLObjects(i);
- this.autoClear&&this.clear();o.autoUpdateMatrix&&o.updateMatrix();w.set(o.matrix.flatten());K.set(o.projectionMatrix.flatten());j=0;for(v=i.__webGLObjects.length;j<v;j++){q=i.__webGLObjects[j];m=q.object;q=q.buffer;if(m.visible){this.setupMatrices(m,o);this.renderPass(o,A,m,q,THREE.NormalBlending,false)}}j=0;for(v=i.__webGLObjects.length;j<v;j++){q=i.__webGLObjects[j];m=q.object;q=q.buffer;if(m.visible){this.setupMatrices(m,o);this.renderPass(o,A,m,q,THREE.AdditiveBlending,false);this.renderPass(o,
- A,m,q,THREE.SubtractiveBlending,false);this.renderPass(o,A,m,q,THREE.AdditiveBlending,true);this.renderPass(o,A,m,q,THREE.SubtractiveBlending,true);this.renderPass(o,A,m,q,THREE.NormalBlending,true)}}};this.initWebGLObjects=function(i){var o,j,v,q,m,A;if(!i.__webGLObjects){i.__webGLObjects=[];i.__webGLObjectsMap={}}o=0;for(j=i.objects.length;o<j;o++){v=i.objects[o];if(i.__webGLObjectsMap[v.id]==undefined)i.__webGLObjectsMap[v.id]={};A=i.__webGLObjectsMap[v.id];if(v instanceof THREE.Mesh)for(m in v.geometry.geometryChunks){q=
- v.geometry.geometryChunks[m];q.__webGLVertexBuffer||this.createBuffers(v,m);if(A[m]==undefined){q={buffer:q,object:v};i.__webGLObjects.push(q);A[m]=1}}}};this.removeObject=function(i,o){var j,v;for(j=i.__webGLObjects.length-1;j>=0;j--){v=i.__webGLObjects[j].object;o==v&&i.__webGLObjects.splice(j,1)}};this.setupMatrices=function(i,o){i.autoUpdateMatrix&&i.updateMatrix();r.multiply(o.matrix,i.matrix);z.set(r.flatten());s=THREE.Matrix4.makeInvert3x3(r).transpose();I.set(s.m);D.set(i.matrix.flatten())};
- this.loadMatrices=function(i){c.uniformMatrix4fv(i.uniforms.viewMatrix,false,w);c.uniformMatrix4fv(i.uniforms.modelViewMatrix,false,z);c.uniformMatrix4fv(i.uniforms.projectionMatrix,false,K);c.uniformMatrix3fv(i.uniforms.normalMatrix,false,I);c.uniformMatrix4fv(i.uniforms.objectMatrix,false,D)};this.loadCamera=function(i,o){c.uniform3f(i.uniforms.cameraPosition,o.position.x,o.position.y,o.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,o){if(i){!o||o=="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,l=f.vertices,h=a.faces,k=f.faces,c=a.uvs;f=f.uvs;e&&b.updateMatrix();for(var u=0,y=l.length;u<y;u++){var r=new THREE.Vertex(l[u].position.clone());e&&b.matrix.multiplyVector3(r.position);g.push(r)}u=0;for(y=k.length;u<y;u++){l=k[u];var s,w=l.vertexNormals;if(l instanceof THREE.Face3)s=new THREE.Face3(l.a+d,l.b+d,l.c+d);else if(l instanceof THREE.Face4)s=new THREE.Face4(l.a+d,l.b+
- d,l.c+d,l.d+d);s.centroid.copy(l.centroid);s.normal.copy(l.normal);e=0;for(g=w.length;e<g;e++){r=w[e];s.vertexNormals.push(r.clone())}s.material=l.material.slice();h.push(s)}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,l,h,k,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=l;b.rotation.y=h;b.rotation.z=k;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,l,h){function k(z,K,I,D,n,i,o,j){var v,q=d||1,m=f||1,A=q+1,F=m+1,M=n/2,x=i/2;n=n/q;i=i/m;var J=c.vertices.length;if(z=="x"&&K=="y"||z=="y"&&K=="x")v="z";else if(z=="x"&&K=="z"||z=="z"&&K=="x")v="y";else if(z=="z"&&K=="y"||z=="y"&&K=="z")v="x";for(iy=0;iy<F;iy++)for(ix=0;ix<
- A;ix++){var R=new THREE.Vector3;R[z]=(ix*n-M)*I;R[K]=(iy*i-x)*D;R[v]=o;c.vertices.push(new THREE.Vertex(R))}for(iy=0;iy<m;iy++)for(ix=0;ix<q;ix++){c.faces.push(new THREE.Face4(ix+A*iy+J,ix+A*(iy+1)+J,ix+1+A*(iy+1)+J,ix+1+A*iy+J,null,j));c.uvs.push([new THREE.UV(ix/q,iy/m),new THREE.UV(ix/q,(iy+1)/m),new THREE.UV((ix+1)/q,(iy+1)/m),new THREE.UV((ix+1)/q,iy/m)])}}THREE.Geometry.call(this);var c=this,u=a/2,y=b/2,r=e/2;l=l?-1:1;if(g!==undefined)if(g instanceof Array)this.materials=g;else{this.materials=
- [];for(var s=0;s<6;s++)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 w in h)if(this.sides[w]!=undefined)this.sides[w]=h[w];this.sides.px&&k("z","y",1*l,-1,e,b,-u,this.materials[0]);this.sides.nx&&k("z","y",-1*l,-1,e,b,u,this.materials[1]);this.sides.py&&k("x","z",1*l,1,a,e,y,this.materials[2]);this.sides.ny&&k("x","z",1*l,-1,a,e,-y,this.materials[3]);this.sides.pz&&k("x","y",1*l,-1,a,b,r,this.materials[4]);this.sides.nz&&
- k("x","y",-1*l,-1,a,b,-r,this.materials[5]);(function(){for(var z=[],K=[],I=0,D=c.vertices.length;I<D;I++){for(var n=c.vertices[I],i=false,o=0,j=z.length;o<j;o++){var v=z[o];if(n.position.x==v.position.x&&n.position.y==v.position.y&&n.position.z==v.position.z){K[I]=o;i=true;break}}if(!i){K[I]=z.length;z.push(new THREE.Vertex(n.position.clone()))}}I=0;for(D=c.faces.length;I<D;I++){n=c.faces[I];n.a=K[n.a];n.b=K[n.b];n.c=K[n.c];n.d=K[n.d]}c.vertices=z})();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){l.vertices.push(new THREE.Vertex(new THREE.Vector3(c,u,y)))}THREE.Geometry.call(this);var l=this,h=Math.PI,k;for(k=0;k<a;k++)g(Math.sin(2*h*k/a)*b,Math.cos(2*h*k/a)*b,0);for(k=0;k<a;k++)g(Math.sin(2*h*k/a)*e,Math.cos(2*h*k/a)*e,d);for(k=0;k<a;k++)l.faces.push(new THREE.Face4(k,k+a,a+(k+1)%a,(k+1)%a));if(e!=0){g(0,0,-f);for(k=a;k<a+a/2;k++)l.faces.push(new THREE.Face4(2*a,(2*k-2*a)%a,(2*k-2*a+1)%a,(2*k-2*a+2)%a))}if(b!=0){g(0,0,d+f);for(k=a+a/2;k<
- 2*a;k++)l.faces.push(new THREE.Face4((2*k-2*a+2)%a+a,(2*k-2*a+1)%a+a,(2*k-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
- var Plane=function(a,b,e,d){THREE.Geometry.call(this);var f,g=a/2,l=b/2;e=e||1;d=d||1;var h=e+1,k=d+1;a=a/e;var c=b/d;for(f=0;f<k;f++)for(b=0;b<h;b++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(b*a-g,-(f*c-l),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),l=Math.max(2,e||6);b=[];for(e=0;e<l+1;e++){d=e/l;var h=a*Math.cos(d*f),k=a*Math.sin(d*f),c=[],u=0;for(d=0;d<g;d++){var y=2*d/g,r=k*Math.sin(y*f);y=k*Math.cos(y*f);(e==0||e==l)&&d>0||(u=this.vertices.push(new THREE.Vertex(new THREE.Vector3(y,h,r)))-1);c.push(u)}b.push(c)}var s,w;a=b.length;for(e=0;e<a;e++){f=b[e].length;if(e>0)for(d=0;d<f;d++){k=d==f-1;g=b[e][k?0:d+1];l=b[e][k?f-1:d];h=b[e-1][k?f-1:d];k=b[e-1][k?
- 0:d+1];u=e/(a-1);y=(e-1)/(a-1);s=(d+1)/f;r=d/f;c=new THREE.UV(1-s,u);u=new THREE.UV(1-r,u);r=new THREE.UV(1-r,y);var z=new THREE.UV(1-s,y);if(e<b.length-1){y=this.vertices[g].position.clone();s=this.vertices[l].position.clone();w=this.vertices[h].position.clone();y.normalize();s.normalize();w.normalize();this.faces.push(new THREE.Face3(g,l,h,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(w.x,w.y,w.z)]));this.uvs.push([c,u,r])}if(e>1){y=this.vertices[g].position.clone();
- s=this.vertices[h].position.clone();w=this.vertices[k].position.clone();y.normalize();s.normalize();w.normalize();this.faces.push(new THREE.Face3(g,h,k,[new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(w.x,w.y,w.z)]));this.uvs.push([c,r,z])}}}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,l=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 ["+l+"] ["+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",l,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 l(p,t){var E=u(p,t),N=u(p,t+1),X=u(p,t+2),Y=u(p,t+3),ea=(Y<<1&255|X>>7)-127;E=(X&127)<<16|N<<8|E;if(E==0&&ea==-127)return 0;return(1-2*(Y>>7))*(1+E*Math.pow(2,-23))*Math.pow(2,ea)}function h(p,t){var E=u(p,t),N=u(p,t+1),X=u(p,t+2);return(u(p,t+3)<<24)+(X<<16)+
- (N<<8)+E}function k(p,t){var E=u(p,t);return(u(p,t+1)<<8)+E}function c(p,t){var E=u(p,t);return E>127?E-256:E}function u(p,t){return p.charCodeAt(t)&255}function y(p){var t,E,N;t=h(a,p);E=h(a,p+j);N=h(a,p+v);p=k(a,p+q);THREE.Loader.prototype.f3(I,t,E,N,p)}function r(p){var t,E,N,X,Y,ea;t=h(a,p);E=h(a,p+j);N=h(a,p+v);X=k(a,p+q);Y=h(a,p+m);ea=h(a,p+A);p=h(a,p+F);THREE.Loader.prototype.f3n(I,i,t,E,N,X,Y,ea,p)}function s(p){var t,E,N,X;t=h(a,p);E=h(a,p+M);N=h(a,p+x);X=h(a,p+J);p=k(a,p+R);THREE.Loader.prototype.f4(I,
- t,E,N,X,p)}function w(p){var t,E,N,X,Y,ea,ma,oa;t=h(a,p);E=h(a,p+M);N=h(a,p+x);X=h(a,p+J);Y=k(a,p+R);ea=h(a,p+C);ma=h(a,p+V);oa=h(a,p+T);p=h(a,p+$);THREE.Loader.prototype.f4n(I,i,t,E,N,X,Y,ea,ma,oa,p)}function z(p){var t,E;t=h(a,p);E=h(a,p+W);p=h(a,p+O);THREE.Loader.prototype.uv3(I,o[t*2],o[t*2+1],o[E*2],o[E*2+1],o[p*2],o[p*2+1])}function K(p){var t,E,N;t=h(a,p);E=h(a,p+G);N=h(a,p+B);p=h(a,p+S);THREE.Loader.prototype.uv4(I,o[t*2],o[t*2+1],o[E*2],o[E*2+1],o[N*2],o[N*2+1],o[p*2],o[p*2+1])}var I=this,
- D=0,n,i=[],o=[],j,v,q,m,A,F,M,x,J,R,C,V,T,$,W,O,G,B,S;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(I,d,g);n={signature:a.substr(D,8),header_bytes:u(a,D+8),vertex_coordinate_bytes:u(a,D+9),normal_coordinate_bytes:u(a,D+10),uv_coordinate_bytes:u(a,D+11),vertex_index_bytes:u(a,D+12),normal_index_bytes:u(a,D+13),uv_index_bytes:u(a,D+14),material_index_bytes:u(a,D+15),nvertices:h(a,D+16),nnormals:h(a,D+16+4),nuvs:h(a,D+16+8),ntri_flat:h(a,D+16+12),ntri_smooth:h(a,D+16+16),ntri_flat_uv:h(a,
- D+16+20),ntri_smooth_uv:h(a,D+16+24),nquad_flat:h(a,D+16+28),nquad_smooth:h(a,D+16+32),nquad_flat_uv:h(a,D+16+36),nquad_smooth_uv:h(a,D+16+40)};D+=n.header_bytes;j=n.vertex_index_bytes;v=n.vertex_index_bytes*2;q=n.vertex_index_bytes*3;m=n.vertex_index_bytes*3+n.material_index_bytes;A=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes;F=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*2;M=n.vertex_index_bytes;x=n.vertex_index_bytes*2;J=n.vertex_index_bytes*3;R=n.vertex_index_bytes*
- 4;C=n.vertex_index_bytes*4+n.material_index_bytes;V=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes;T=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;O=n.uv_index_bytes*2;G=n.uv_index_bytes;B=n.uv_index_bytes*2;S=n.uv_index_bytes*3;D+=function(p){var t,E,N,X=n.vertex_coordinate_bytes*3,Y=p+n.nvertices*X;for(p=p;p<Y;p+=X){t=l(a,p);E=l(a,p+n.vertex_coordinate_bytes);N=l(a,
- p+n.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(I,t,E,N)}return n.nvertices*X}(D);D+=function(p){var t,E,N,X=n.normal_coordinate_bytes*3,Y=p+n.nnormals*X;for(p=p;p<Y;p+=X){t=c(a,p);E=c(a,p+n.normal_coordinate_bytes);N=c(a,p+n.normal_coordinate_bytes*2);i.push(t/127,E/127,N/127)}return n.nnormals*X}(D);D+=function(p){var t,E,N=n.uv_coordinate_bytes*2,X=p+n.nuvs*N;for(p=p;p<X;p+=N){t=l(a,p);E=l(a,p+n.uv_coordinate_bytes);o.push(t,E)}return n.nuvs*N}(D);D+=function(p){var t,E=n.vertex_index_bytes*
- 3+n.material_index_bytes,N=p+n.ntri_flat*E;for(t=p;t<N;t+=E)y(t);return N-p}(D);D+=function(p){var t,E=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,N=p+n.ntri_smooth*E;for(t=p;t<N;t+=E)r(t);return N-p}(D);D+=function(p){var t,E=n.vertex_index_bytes*3+n.material_index_bytes,N=E+n.uv_index_bytes*3,X=p+n.ntri_flat_uv*N;for(t=p;t<X;t+=N){y(t);z(t+E)}return X-p}(D);D+=function(p){var t,E=n.vertex_index_bytes*3+n.material_index_bytes+n.normal_index_bytes*3,N=E+n.uv_index_bytes*3,
- X=p+n.ntri_smooth_uv*N;for(t=p;t<X;t+=N){r(t);z(t+E)}return X-p}(D);D+=function(p){var t,E=n.vertex_index_bytes*4+n.material_index_bytes,N=p+n.nquad_flat*E;for(t=p;t<N;t+=E)s(t);return N-p}(D);D+=function(p){var t,E=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,N=p+n.nquad_smooth*E;for(t=p;t<N;t+=E)w(t);return N-p}(D);D+=function(p){var t,E=n.vertex_index_bytes*4+n.material_index_bytes,N=E+n.uv_index_bytes*4,X=p+n.nquad_flat_uv*N;for(t=p;t<X;t+=N){s(t);K(t+E)}return X-p}(D);
- D+=function(p){var t,E=n.vertex_index_bytes*4+n.material_index_bytes+n.normal_index_bytes*4,N=E+n.uv_index_bytes*4,X=p+n.nquad_smooth_uv*N;for(t=p;t<X;t+=N){w(t);K(t+E)}return X-p}(D);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 l,h,k,c,u;l=0;for(h=
- a.vertices.length;l<h;l+=3){k=a.vertices[l];c=a.vertices[l+1];u=a.vertices[l+2];THREE.Loader.prototype.v(g,k,c,u)}})();(function(){function l(w,z){THREE.Loader.prototype.f3(g,w[z],w[z+1],w[z+2],w[z+3])}function h(w,z){THREE.Loader.prototype.f3n(g,a.normals,w[z],w[z+1],w[z+2],w[z+3],w[z+4],w[z+5],w[z+6])}function k(w,z){THREE.Loader.prototype.f4(g,w[z],w[z+1],w[z+2],w[z+3],w[z+4])}function c(w,z){THREE.Loader.prototype.f4n(g,a.normals,w[z],w[z+1],w[z+2],w[z+3],w[z+4],w[z+5],w[z+6],w[z+7],w[z+8])}function u(w,
- z){var K,I,D;K=w[z];I=w[z+1];D=w[z+2];THREE.Loader.prototype.uv3(g,a.uvs[K*2],a.uvs[K*2+1],a.uvs[I*2],a.uvs[I*2+1],a.uvs[D*2],a.uvs[D*2+1])}function y(w,z){var K,I,D,n;K=w[z];I=w[z+1];D=w[z+2];n=w[z+3];THREE.Loader.prototype.uv4(g,a.uvs[K*2],a.uvs[K*2+1],a.uvs[I*2],a.uvs[I*2+1],a.uvs[D*2],a.uvs[D*2+1],a.uvs[n*2],a.uvs[n*2+1])}var r,s;r=0;for(s=a.triangles.length;r<s;r+=4)l(a.triangles,r);r=0;for(s=a.triangles_uv.length;r<s;r+=7){l(a.triangles_uv,r);u(a.triangles_uv,r+4)}r=0;for(s=a.triangles_n.length;r<
- s;r+=7)h(a.triangles_n,r);r=0;for(s=a.triangles_n_uv.length;r<s;r+=10){h(a.triangles_n_uv,r);u(a.triangles_n_uv,r+7)}r=0;for(s=a.quads.length;r<s;r+=5)k(a.quads,r);r=0;for(s=a.quads_uv.length;r<s;r+=9){k(a.quads_uv,r);y(a.quads_uv,r+5)}r=0;for(s=a.quads_n.length;r<s;r+=9)c(a.quads_n,r);r=0;for(s=a.quads_n_uv.length;r<s;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,l,h,k){g=a.materials[g];var c=b[h*3],u=b[h*3+1];h=b[h*3+2];var y=b[k*3],r=b[k*3+1];k=b[k*3+2];a.faces.push(new THREE.Face3(e,d,f,[new THREE.Vector3(b[l*3],b[l*3+1],b[l*3+2]),new THREE.Vector3(c,u,h),new THREE.Vector3(y,
- r,k)],g))},f4n:function(a,b,e,d,f,g,l,h,k,c,u){l=a.materials[l];var y=b[k*3],r=b[k*3+1];k=b[k*3+2];var s=b[c*3],w=b[c*3+1];c=b[c*3+2];var z=b[u*3],K=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,k),new THREE.Vector3(s,w,c),new THREE.Vector3(z,K,u)],l))},uv3:function(a,b,e,d,f,g,l){var h=[];h.push(new THREE.UV(b,e));h.push(new THREE.UV(d,f));h.push(new THREE.UV(g,l));a.uvs.push(h)},uv4:function(a,b,e,d,f,g,l,h,k){var c=[];
- c.push(new THREE.UV(b,e));c.push(new THREE.UV(d,f));c.push(new THREE.UV(g,l));c.push(new THREE.UV(h,k));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)),l=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));d.map.image.width=g;d.map.image.height=l;d.map.image.getContext("2d").drawImage(this,0,0,g,l)}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}};
|