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