123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- // ThreeExtras.js r32 - http://github.com/mrdoob/three.js
- var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)};
- THREE.Color.prototype={setRGB:function(a,c,d){this.r=a;this.g=c;this.b=d;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,d){var e,g,b,l,j,h;if(d==0)e=g=b=0;else{l=Math.floor(a*6);j=a*6-l;a=d*(1-c);h=d*(1-c*j);c=d*(1-c*(1-j));switch(l){case 1:e=h;g=d;b=a;break;case 2:e=a;g=d;b=c;break;case 3:e=a;g=h;b=d;break;case 4:e=c;g=a;b=d;break;case 5:e=d;g=a;b=h;break;case 6:case 0:e=d;g=c;b=a}}this.r=e;this.g=g;this.b=b;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},
- setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+
- this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
- THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;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,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.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,c,d){this.x=a||0;this.y=c||0;this.z=d||0};
- THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;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,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
- cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
- a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+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,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1};
- THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;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,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.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,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.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,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},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,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
- THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,g=[];a=0;for(c=e.length;a<c;a++){d=e[a];if(d instanceof THREE.Mesh)g=g.concat(this.intersectObject(d))}g.sort(function(b,l){return b.distance-l.distance});return g},intersectObject:function(a){function c(G,t,k,f){f=f.clone().subSelf(t);k=k.clone().subSelf(t);var m=G.clone().subSelf(t);G=f.dot(f);t=f.dot(k);f=f.dot(m);var n=k.dot(k);k=k.dot(m);m=1/(G*n-t*t);n=(n*f-t*k)*m;G=(G*k-t*f)*m;return n>0&&G>0&&n+G<1}var d,e,g,b,l,j,h,o,v,z,
- u,q=a.geometry,x=q.vertices,B=[];d=0;for(e=q.faces.length;d<e;d++){g=q.faces[d];z=this.origin.clone();u=this.direction.clone();b=a.matrix.multiplyVector3(x[g.a].position.clone());l=a.matrix.multiplyVector3(x[g.b].position.clone());j=a.matrix.multiplyVector3(x[g.c].position.clone());h=g instanceof THREE.Face4?a.matrix.multiplyVector3(x[g.d].position.clone()):null;o=a.rotationMatrix.multiplyVector3(g.normal.clone());v=u.dot(o);if(v<0){o=o.dot((new THREE.Vector3).sub(b,z))/v;z=z.addSelf(u.multiplyScalar(o));
- if(g instanceof THREE.Face3){if(c(z,b,l,j)){g={distance:this.origin.distanceTo(z),point:z,face:g,object:a};B.push(g)}}else if(g instanceof THREE.Face4)if(c(z,b,l,h)||c(z,l,j,h)){g={distance:this.origin.distanceTo(z),point:z,face:g,object:a};B.push(g)}}}return B}};
- THREE.Rectangle=function(){function a(){b=e-c;l=g-d}var c,d,e,g,b,l,j=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return b};this.getHeight=function(){return l};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(h,o,v,z){j=false;c=h;d=o;e=v;g=z;a()};this.addPoint=function(h,o){if(j){j=false;c=h;d=o;e=h;g=o}else{c=c<h?c:h;d=d<o?d:o;e=e>h?e:h;g=g>o?
- g:o}a()};this.add3Points=function(h,o,v,z,u,q){if(j){j=false;c=h<v?h<u?h:u:v<u?v:u;d=o<z?o<q?o:q:z<q?z:q;e=h>v?h>u?h:u:v>u?v:u;g=o>z?o>q?o:q:z>q?z:q}else{c=h<v?h<u?h<c?h:c:u<c?u:c:v<u?v<c?v:c:u<c?u:c;d=o<z?o<q?o<d?o:d:q<d?q:d:z<q?z<d?z:d:q<d?q:d;e=h>v?h>u?h>e?h:e:u>e?u:e:v>u?v>e?v:e:u>e?u:e;g=o>z?o>q?o>g?o:g:q>g?q:g:z>q?z>g?z:g:q>g?q:g}a()};this.addRectangle=function(h){if(j){j=false;c=h.getLeft();d=h.getTop();e=h.getRight();g=h.getBottom()}else{c=c<h.getLeft()?c:h.getLeft();d=d<h.getTop()?d:h.getTop();
- e=e>h.getRight()?e:h.getRight();g=g>h.getBottom()?g:h.getBottom()}a()};this.inflate=function(h){c-=h;d-=h;e+=h;g+=h;a()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();d=d>h.getTop()?d:h.getTop();e=e<h.getRight()?e:h.getRight();g=g<h.getBottom()?g:h.getBottom();a()};this.instersects=function(h){return Math.min(e,h.getRight())-Math.max(c,h.getLeft())>=0&&Math.min(g,h.getBottom())-Math.max(d,h.getTop())>=0};this.empty=function(){j=true;g=e=d=c=0;a()};this.isEmpty=function(){return j};this.toString=
- function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+g+", width: "+b+", height: "+l+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this}};
- THREE.Matrix4=function(a,c,d,e,g,b,l,j,h,o,v,z,u,q,x,B){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=b||1;this.n23=l||0;this.n24=j||0;this.n31=h||0;this.n32=o||0;this.n33=v||1;this.n34=z||0;this.n41=u||0;this.n42=q||0;this.n43=x||0;this.n44=B||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
- THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,d,e,g,b,l,j,h,o,v,z,u,q,x,B){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=g;this.n22=b;this.n23=l;this.n24=j;this.n31=h;this.n32=o;this.n33=v;this.n34=z;this.n41=u;this.n42=q;this.n43=x;this.n44=B;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
- a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,b=THREE.Matrix4.__tmpVec3;b.sub(a,c).normalize();e.cross(d,b).normalize();g.cross(b,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=b.x;this.n32=b.y;this.n33=b.z;this.n34=-b.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,g=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*c+this.n22*d+this.n23*
- e+this.n24*g;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*g;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,g=a.n13,b=a.n14,l=a.n21,j=a.n22,h=a.n23,o=a.n24,v=a.n31,
- z=a.n32,u=a.n33,q=a.n34,x=a.n41,B=a.n42,G=a.n43,t=a.n44,k=c.n11,f=c.n12,m=c.n13,n=c.n14,C=c.n21,w=c.n22,p=c.n23,F=c.n24,y=c.n31,J=c.n32,E=c.n33,A=c.n34,M=c.n41,aa=c.n42,N=c.n43,U=c.n44;this.n11=d*k+e*C+g*y+b*M;this.n12=d*f+e*w+g*J+b*aa;this.n13=d*m+e*p+g*E+b*N;this.n14=d*n+e*F+g*A+b*U;this.n21=l*k+j*C+h*y+o*M;this.n22=l*f+j*w+h*J+o*aa;this.n23=l*m+j*p+h*E+o*N;this.n24=l*n+j*F+h*A+o*U;this.n31=v*k+z*C+u*y+q*M;this.n32=v*f+z*w+u*J+q*aa;this.n33=v*m+z*p+u*E+q*N;this.n34=v*n+z*F+u*A+q*U;this.n41=x*k+
- B*C+G*y+t*M;this.n42=x*f+B*w+G*J+t*aa;this.n43=x*m+B*p+G*E+t*N;this.n44=x*n+B*F+G*A+t*U;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,g=this.n14,b=this.n21,l=this.n22,j=this.n23,h=this.n24,o=this.n31,v=this.n32,z=this.n33,u=this.n34,q=this.n41,x=this.n42,B=this.n43,G=this.n44,t=a.n11,k=a.n21,f=a.n31,m=a.n41,n=a.n12,C=a.n22,w=a.n32,p=a.n42,F=a.n13,y=a.n23,J=a.n33,E=a.n43,A=a.n14,M=a.n24,aa=a.n34;a=a.n44;this.n11=c*t+d*k+e*f+g*m;this.n12=c*n+d*C+e*w+g*p;this.n13=c*F+d*y+
- e*J+g*E;this.n14=c*A+d*M+e*aa+g*a;this.n21=b*t+l*k+j*f+h*m;this.n22=b*n+l*C+j*w+h*p;this.n23=b*F+l*y+j*J+h*E;this.n24=b*A+l*M+j*aa+h*a;this.n31=o*t+v*k+z*f+u*m;this.n32=o*n+v*C+z*w+u*p;this.n33=o*F+v*y+z*J+u*E;this.n34=o*A+v*M+z*aa+u*a;this.n41=q*t+x*k+B*f+G*m;this.n42=q*n+x*C+B*w+G*p;this.n43=q*F+x*y+B*J+G*E;this.n44=q*A+x*M+B*aa+G*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=
- a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,e=this.n14,g=this.n21,b=this.n22,l=this.n23,j=this.n24,h=this.n31,o=this.n32,v=this.n33,z=this.n34,u=this.n41,q=this.n42,x=this.n43,B=this.n44;return e*l*o*u-d*j*o*u-e*b*v*u+c*j*v*u+d*b*z*u-c*l*z*u-e*l*h*q+d*j*h*q+e*g*v*q-a*j*v*q-d*g*z*q+a*l*z*q+e*b*h*x-c*j*h*x-e*g*o*x+a*j*o*x+c*g*z*x-a*b*z*x-d*b*h*B+c*l*h*B+d*g*o*B-a*l*o*B-c*g*v*B+a*b*v*B},transpose:function(){function a(c,
- d,e){var g=c[d];c[d]=c[e];c[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;
- a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=
- Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),g=1-d,b=a.x,l=a.y,j=a.z,h=g*b,o=g*l;this.set(h*b+d,h*l-e*j,h*j+e*l,0,h*l+e*j,o*l+d,o*j-e*b,0,h*j-e*l,o*j+e*b,g*j*j+d,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+
- this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setTranslation(a,c,d);return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.setScale(a,c,d);return e};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};
- THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4;d.setRotAxis(a,c);return d};
- THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,b=a.n21,l=a.n22,j=a.n23,h=a.n24,o=a.n31,v=a.n32,z=a.n33,u=a.n34,q=a.n41,x=a.n42,B=a.n43,G=a.n44,t=new THREE.Matrix4;t.n11=j*u*x-h*z*x+h*v*B-l*u*B-j*v*G+l*z*G;t.n12=g*z*x-e*u*x-g*v*B+d*u*B+e*v*G-d*z*G;t.n13=e*h*x-g*j*x+g*l*B-d*h*B-e*l*G+d*j*G;t.n14=g*j*v-e*h*v-g*l*z+d*h*z+e*l*u-d*j*u;t.n21=h*z*q-j*u*q-h*o*B+b*u*B+j*o*G-b*z*G;t.n22=e*u*q-g*z*q+g*o*B-c*u*B-e*o*G+c*z*G;t.n23=g*j*q-e*h*q-g*b*B+c*h*B+e*b*G-c*j*G;t.n24=e*h*o-g*j*o+
- g*b*z-c*h*z-e*b*u+c*j*u;t.n31=l*u*q-h*v*q+h*o*x-b*u*x-l*o*G+b*v*G;t.n32=g*v*q-d*u*q-g*o*x+c*u*x+d*o*G-c*v*G;t.n33=e*h*q-g*l*q+g*b*x-c*h*x-d*b*G+c*l*G;t.n34=g*l*o-d*h*o-g*b*v+c*h*v+d*b*u-c*l*u;t.n41=j*v*q-l*z*q-j*o*x+b*z*x+l*o*B-b*v*B;t.n42=d*z*q-e*v*q+e*o*x-c*z*x-d*o*B+c*v*B;t.n43=e*l*q-d*j*q-e*b*x+c*j*x+d*b*B-c*l*B;t.n44=d*j*o-e*l*o+e*b*v-c*j*v-d*b*z+c*l*z;t.multiplyScalar(1/a.determinant());return t};
- THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=a.m,e=c[10]*c[5]-c[6]*c[9],g=-c[10]*c[1]+c[2]*c[9],b=c[6]*c[1]-c[2]*c[5],l=-c[10]*c[4]+c[6]*c[8],j=c[10]*c[0]-c[2]*c[8],h=-c[6]*c[0]+c[2]*c[4],o=c[9]*c[4]-c[5]*c[8],v=-c[9]*c[0]+c[1]*c[8],z=c[5]*c[0]-c[1]*c[4];c=c[0]*e+c[1]*l+c[2]*o;if(c==0)throw"matrix not invertible";c=1/c;d[0]=c*e;d[1]=c*g;d[2]=c*b;d[3]=c*l;d[4]=c*j;d[5]=c*h;d[6]=c*o;d[7]=c*v;d[8]=c*z;return a};
- THREE.Matrix4.makeFrustum=function(a,c,d,e,g,b){var l,j,h;l=new THREE.Matrix4;j=2*g/(c-a);h=2*g/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(b+g)/(b-g);g=-2*b*g/(b-g);l.n11=j;l.n12=0;l.n13=a;l.n14=0;l.n21=0;l.n22=h;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,c,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,d,e)};
- THREE.Matrix4.makeOrtho=function(a,c,d,e,g,b){var l,j,h,o;l=new THREE.Matrix4;j=c-a;h=d-e;o=b-g;a=(c+a)/j;d=(d+e)/h;g=(b+g)/o;l.n11=2/j;l.n12=0;l.n13=0;l.n14=-a;l.n21=0;l.n22=2/h;l.n23=0;l.n24=-d;l.n31=0;l.n32=0;l.n33=-2/o;l.n34=-g;l.n41=0;l.n42=0;l.n43=0;l.n44=1;return l};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
- THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||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,c,d,e,g){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
- THREE.Face4=function(a,c,d,e,g,b){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=b instanceof Array?b:[b]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||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.uvs2=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
- THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
- d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,e,g,b,l,j=new THREE.Vector3,h=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){b=this.vertices[e];b.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){b=this.faces[e];if(a&&b.vertexNormals.length){j.set(0,0,0);c=0;for(d=b.normal.length;c<d;c++)j.addSelf(b.vertexNormals[c]);j.divideScalar(3)}else{c=this.vertices[b.a];d=this.vertices[b.b];l=this.vertices[b.c];j.sub(l.position,
- d.position);h.sub(c.position,d.position);j.crossSelf(h)}j.isZero()||j.normalize();b.normal.copy(j)}},computeVertexNormals:function(){var a,c,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
- new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<
- c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(A,M,aa,N,U,T,R){b=A.vertices[M].position;l=A.vertices[aa].position;j=A.vertices[N].position;h=g[U];o=g[T];v=g[R];z=l.x-b.x;u=j.x-b.x;q=l.y-b.y;x=j.y-b.y;
- B=l.z-b.z;G=j.z-b.z;t=o.u-h.u;k=v.u-h.u;f=o.v-h.v;m=v.v-h.v;n=1/(t*m-k*f);p.set((m*z-f*u)*n,(m*q-f*x)*n,(m*B-f*G)*n);F.set((t*u-k*z)*n,(t*x-k*q)*n,(t*G-k*B)*n);C[M].addSelf(p);C[aa].addSelf(p);C[N].addSelf(p);w[M].addSelf(F);w[aa].addSelf(F);w[N].addSelf(F)}var c,d,e,g,b,l,j,h,o,v,z,u,q,x,B,G,t,k,f,m,n,C=[],w=[],p=new THREE.Vector3,F=new THREE.Vector3,y=new THREE.Vector3,J=new THREE.Vector3,E=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){C[c]=new THREE.Vector3;w[c]=new THREE.Vector3}c=
- 0;for(d=this.faces.length;c<d;c++){e=this.faces[c];g=this.uvs[c];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
- this.vertices[e.d].normal.copy(e.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){E.copy(this.vertices[c].normal);e=C[c];y.copy(e);y.subSelf(E.multiplyScalar(E.dot(e))).normalize();J.cross(this.vertices[c].normal,e);e=J.dot(w[c]);e=e<0?-1:1;this.vertices[c].tangent.set(y.x,y.y,y.z,e)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
- z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
- this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(v){var z=[];c=0;for(d=v.length;c<d;c++)v[c]==undefined?z.push("undefined"):z.push(v[c].toString());return z.join("_")}var c,d,e,g,b,l,j,h,o={};e=0;for(g=this.faces.length;e<g;e++){b=this.faces[e];
- l=b.materials;j=a(l);if(o[j]==undefined)o[j]={hash:j,counter:0};h=o[j].hash+"_"+o[j].counter;if(this.geometryChunks[h]==undefined)this.geometryChunks[h]={faces:[],materials:l,vertices:0};b=b instanceof THREE.Face3?3:4;if(this.geometryChunks[h].vertices+b>65535){o[j].counter+=1;h=o[j].hash+"_"+o[j].counter;if(this.geometryChunks[h]==undefined)this.geometryChunks[h]={faces:[],materials:l,vertices:0}}this.geometryChunks[h].faces.push(e);this.geometryChunks[h].vertices+=b}},toString:function(){return"THREE.Geometry ( vertices: "+
- this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
- THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
- this.translateZ=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()};
- THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;
- THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
- THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true};
- THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){e.setRotY(c.y);this.rotationMatrix.multiplySelf(e)}if(c.z!=0){e.setRotZ(c.z);this.rotationMatrix.multiplySelf(e)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(e)}}};THREE.Object3DCounter={value:0};
- THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c]};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
- THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()};
- THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
- THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}};
- THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
- THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==
- undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==
- undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
- THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+
- this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
- THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);
- if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;
- if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
- THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+
- this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
- THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.light_map=this.specular_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=
- 1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;
- if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;
- if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
- THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
- this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshPhongMaterialCounter={value:0};
- THREE.MeshDepthMaterial=function(a){this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial"}};
- THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
- THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!==
- undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
- THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
- THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.size=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.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending}};
- THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>)"}};
- THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
- THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,d,e,g,b){this.image=a;this.mapping=c!==undefined?c: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=b!==undefined?b:THREE.LinearMipMapLinearFilter};
- THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;
- THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
- THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
- var Uniforms={clone:function(a){var c,d,e,g={};for(c in a){g[c]={};for(d in a[c]){e=a[c][d];g[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var c,d,e,g={};for(c=0;c<a.length;c++){e=this.clone(a[c]);for(d in e)g[d]=e[d]}return g}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
- THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
- THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
- THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4};
- THREE.Projector=function(){function a(w,p){return p.z-w.z}function c(w,p){var F=0,y=1,J=w.z+w.w,E=p.z+p.w,A=-w.z+w.w,M=-p.z+p.w;if(J>=0&&E>=0&&A>=0&&M>=0)return true;else if(J<0&&E<0||A<0&&M<0)return false;else{if(J<0)F=Math.max(F,J/(J-E));else if(E<0)y=Math.min(y,J/(J-E));if(A<0)F=Math.max(F,A/(A-M));else if(M<0)y=Math.min(y,A/(A-M));if(y<F)return false;else{w.lerpSelf(p,F);p.lerpSelf(w,1-y);return true}}}var d,e,g=[],b,l,j,h=[],o,v,z=[],u,q,x=[],B=new THREE.Vector4,G=new THREE.Vector4,t=new THREE.Matrix4,
- k=new THREE.Matrix4,f=[],m=new THREE.Vector4,n=new THREE.Vector4,C;this.projectObjects=function(w,p,F){var y=[],J,E;e=0;t.multiply(p.projectionMatrix,p.matrix);f[0]=new THREE.Vector4(t.n41-t.n11,t.n42-t.n12,t.n43-t.n13,t.n44-t.n14);f[1]=new THREE.Vector4(t.n41+t.n11,t.n42+t.n12,t.n43+t.n13,t.n44+t.n14);f[2]=new THREE.Vector4(t.n41+t.n21,t.n42+t.n22,t.n43+t.n23,t.n44+t.n24);f[3]=new THREE.Vector4(t.n41-t.n21,t.n42-t.n22,t.n43-t.n23,t.n44-t.n24);f[4]=new THREE.Vector4(t.n41-t.n31,t.n42-t.n32,t.n43-
- t.n33,t.n44-t.n34);f[5]=new THREE.Vector4(t.n41+t.n31,t.n42+t.n32,t.n43+t.n33,t.n44+t.n34);p=0;for(J=f.length;p<J;p++){E=f[p];E.divideScalar(Math.sqrt(E.x*E.x+E.y*E.y+E.z*E.z))}J=w.objects;w=0;for(p=J.length;w<p;w++){E=J[w];var A;if(!(A=!E.visible)){if(A=E instanceof THREE.Mesh){a:{A=void 0;for(var M=E.position,aa=-E.geometry.boundingSphere.radius*Math.max(E.scale.x,Math.max(E.scale.y,E.scale.z)),N=0;N<6;N++){A=f[N].x*M.x+f[N].y*M.y+f[N].z*M.z+f[N].w;if(A<=aa){A=false;break a}}A=true}A=!A}A=A}if(!A){d=
- g[e]=g[e]||new THREE.RenderableObject;B.copy(E.position);t.multiplyVector3(B);d.object=E;d.z=B.z;y.push(d);e++}}F&&y.sort(a);return y};this.projectScene=function(w,p,F){var y=[],J=p.near,E=p.far,A,M,aa,N,U,T,R,Z,ca,W,S,ba,X,I,Q,V;j=v=q=0;p.autoUpdateMatrix&&p.updateMatrix();t.multiply(p.projectionMatrix,p.matrix);T=this.projectObjects(w,p,true);w=0;for(A=T.length;w<A;w++){R=T[w].object;if(R.visible){R.autoUpdateMatrix&&R.updateMatrix();Z=R.matrix;ca=R.rotationMatrix;W=R.materials;S=R.overdraw;if(R instanceof
- THREE.Mesh){ba=R.geometry;X=ba.vertices;M=0;for(aa=X.length;M<aa;M++){I=X[M];I.positionWorld.copy(I.position);Z.multiplyVector3(I.positionWorld);N=I.positionScreen;N.copy(I.positionWorld);t.multiplyVector4(N);N.x/=N.w;N.y/=N.w;I.__visible=N.z>J&&N.z<E}ba=ba.faces;M=0;for(aa=ba.length;M<aa;M++){I=ba[M];if(I instanceof THREE.Face3){N=X[I.a];U=X[I.b];Q=X[I.c];if(N.__visible&&U.__visible&&Q.__visible)if(R.doubleSided||R.flipSided!=(Q.positionScreen.x-N.positionScreen.x)*(U.positionScreen.y-N.positionScreen.y)-
- (Q.positionScreen.y-N.positionScreen.y)*(U.positionScreen.x-N.positionScreen.x)<0){b=h[j]=h[j]||new THREE.RenderableFace3;b.v1.positionWorld.copy(N.positionWorld);b.v2.positionWorld.copy(U.positionWorld);b.v3.positionWorld.copy(Q.positionWorld);b.v1.positionScreen.copy(N.positionScreen);b.v2.positionScreen.copy(U.positionScreen);b.v3.positionScreen.copy(Q.positionScreen);b.normalWorld.copy(I.normal);ca.multiplyVector3(b.normalWorld);b.centroidWorld.copy(I.centroid);Z.multiplyVector3(b.centroidWorld);
- b.centroidScreen.copy(b.centroidWorld);t.multiplyVector3(b.centroidScreen);Q=I.vertexNormals;C=b.vertexNormalsWorld;N=0;for(U=Q.length;N<U;N++){V=C[N]=C[N]||new THREE.Vector3;V.copy(Q[N]);ca.multiplyVector3(V)}b.z=b.centroidScreen.z;b.meshMaterials=W;b.faceMaterials=I.materials;b.overdraw=S;if(R.geometry.uvs[M]){b.uvs[0]=R.geometry.uvs[M][0];b.uvs[1]=R.geometry.uvs[M][1];b.uvs[2]=R.geometry.uvs[M][2]}y.push(b);j++}}else if(I instanceof THREE.Face4){N=X[I.a];U=X[I.b];Q=X[I.c];V=X[I.d];if(N.__visible&&
- U.__visible&&Q.__visible&&V.__visible)if(R.doubleSided||R.flipSided!=((V.positionScreen.x-N.positionScreen.x)*(U.positionScreen.y-N.positionScreen.y)-(V.positionScreen.y-N.positionScreen.y)*(U.positionScreen.x-N.positionScreen.x)<0||(U.positionScreen.x-Q.positionScreen.x)*(V.positionScreen.y-Q.positionScreen.y)-(U.positionScreen.y-Q.positionScreen.y)*(V.positionScreen.x-Q.positionScreen.x)<0)){b=h[j]=h[j]||new THREE.RenderableFace3;b.v1.positionWorld.copy(N.positionWorld);b.v2.positionWorld.copy(U.positionWorld);
- b.v3.positionWorld.copy(V.positionWorld);b.v1.positionScreen.copy(N.positionScreen);b.v2.positionScreen.copy(U.positionScreen);b.v3.positionScreen.copy(V.positionScreen);b.normalWorld.copy(I.normal);ca.multiplyVector3(b.normalWorld);b.centroidWorld.copy(I.centroid);Z.multiplyVector3(b.centroidWorld);b.centroidScreen.copy(b.centroidWorld);t.multiplyVector3(b.centroidScreen);b.z=b.centroidScreen.z;b.meshMaterials=W;b.faceMaterials=I.materials;b.overdraw=S;if(R.geometry.uvs[M]){b.uvs[0]=R.geometry.uvs[M][0];
- b.uvs[1]=R.geometry.uvs[M][1];b.uvs[2]=R.geometry.uvs[M][3]}y.push(b);j++;l=h[j]=h[j]||new THREE.RenderableFace3;l.v1.positionWorld.copy(U.positionWorld);l.v2.positionWorld.copy(Q.positionWorld);l.v3.positionWorld.copy(V.positionWorld);l.v1.positionScreen.copy(U.positionScreen);l.v2.positionScreen.copy(Q.positionScreen);l.v3.positionScreen.copy(V.positionScreen);l.normalWorld.copy(b.normalWorld);l.centroidWorld.copy(b.centroidWorld);l.centroidScreen.copy(b.centroidScreen);l.z=l.centroidScreen.z;l.meshMaterials=
- W;l.faceMaterials=I.materials;l.overdraw=S;if(R.geometry.uvs[M]){l.uvs[0]=R.geometry.uvs[M][1];l.uvs[1]=R.geometry.uvs[M][2];l.uvs[2]=R.geometry.uvs[M][3]}y.push(l);j++}}}}else if(R instanceof THREE.Line){k.multiply(t,Z);X=R.geometry.vertices;I=X[0];I.positionScreen.copy(I.position);k.multiplyVector4(I.positionScreen);M=1;for(aa=X.length;M<aa;M++){N=X[M];N.positionScreen.copy(N.position);k.multiplyVector4(N.positionScreen);U=X[M-1];m.copy(N.positionScreen);n.copy(U.positionScreen);if(c(m,n)){m.multiplyScalar(1/
- m.w);n.multiplyScalar(1/n.w);o=z[v]=z[v]||new THREE.RenderableLine;o.v1.positionScreen.copy(m);o.v2.positionScreen.copy(n);o.z=Math.max(m.z,n.z);o.materials=R.materials;y.push(o);v++}}}else if(R instanceof THREE.Particle){G.set(R.position.x,R.position.y,R.position.z,1);t.multiplyVector4(G);G.z/=G.w;if(G.z>0&&G.z<1){u=x[q]=x[q]||new THREE.RenderableParticle;u.x=G.x/G.w;u.y=G.y/G.w;u.z=G.z;u.rotation=R.rotation.z;u.scale.x=R.scale.x*Math.abs(u.x-(G.x+p.projectionMatrix.n11)/(G.w+p.projectionMatrix.n14));
- u.scale.y=R.scale.y*Math.abs(u.y-(G.y+p.projectionMatrix.n22)/(G.w+p.projectionMatrix.n24));u.materials=R.materials;y.push(u);q++}}}}F&&y.sort(a);return y};this.unprojectVector=function(w,p){var F=THREE.Matrix4.makeInvert(p.matrix);F.multiplySelf(THREE.Matrix4.makeInvert(p.projectionMatrix));F.multiplyVector3(w);return w}};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,g,b;this.domElement=document.createElement("div");this.setSize=function(l,j){d=l;e=j;g=d/2;b=e/2};this.render=function(l,j){var h,o,v,z,u,q,x,B;a=c.projectScene(l,j);h=0;for(o=a.length;h<o;h++){u=a[h];if(u instanceof THREE.RenderableParticle){x=u.x*g+g;B=u.y*b+b;v=0;for(z=u.material.length;v<z;v++){q=u.material[v];if(q instanceof THREE.ParticleDOMMaterial){q=q.domElement;q.style.left=x+"px";q.style.top=B+"px"}}}}}};
- THREE.CanvasRenderer=function(){function a(la){if(u!=la)o.globalAlpha=u=la}function c(la){if(q!=la){switch(la){case THREE.NormalBlending:o.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:o.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:o.globalCompositeOperation="darker"}q=la}}var d=null,e=new THREE.Projector,g=document.createElement("canvas"),b,l,j,h,o=g.getContext("2d"),v=new THREE.Color(0),z=0,u=1,q=0,x=null,B=null,G=1,t,k,f,m,n,C,w,p,F,y=new THREE.Color,
- J=new THREE.Color,E=new THREE.Color,A=new THREE.Color,M=new THREE.Color,aa,N,U,T,R,Z,ca,W,S,ba=new THREE.Rectangle,X=new THREE.Rectangle,I=new THREE.Rectangle,Q=false,V=new THREE.Color,ha=new THREE.Color,ka=new THREE.Color,D=new THREE.Color,H=Math.PI*2,K=new THREE.Vector3,P,da,ia,fa,qa,sa,wa=16;P=document.createElement("canvas");P.width=P.height=2;da=P.getContext("2d");da.fillStyle="rgba(0,0,0,1)";da.fillRect(0,0,2,2);ia=da.getImageData(0,0,2,2);fa=ia.data;qa=document.createElement("canvas");qa.width=
- qa.height=wa;sa=qa.getContext("2d");sa.translate(-wa/2,-wa/2);sa.scale(wa,wa);wa--;this.domElement=g;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(la,xa){b=la;l=xa;j=b/2;h=l/2;g.width=b;g.height=l;ba.set(-j,-h,j,h);u=1;q=0;B=x=null;G=1};this.setClearColor=function(la,xa){v.setHex(la);z=xa;X.set(-j,-h,j,h);o.setTransform(1,0,0,-1,j,h);this.clear()};this.clear=function(){o.setTransform(1,0,0,-1,j,h);if(!X.isEmpty()){X.inflate(1);X.minSelf(ba);if(v.hex==0&&z==0)o.clearRect(X.getX(),
- X.getY(),X.getWidth(),X.getHeight());else{c(THREE.NormalBlending);a(1);o.fillStyle="rgba("+Math.floor(v.r*255)+","+Math.floor(v.g*255)+","+Math.floor(v.b*255)+","+z+")";o.fillRect(X.getX(),X.getY(),X.getWidth(),X.getHeight())}X.empty()}};this.render=function(la,xa){function Pa(L){var ea,$,O,Y=L.lights;ha.setRGB(0,0,0);ka.setRGB(0,0,0);D.setRGB(0,0,0);L=0;for(ea=Y.length;L<ea;L++){$=Y[L];O=$.color;if($ instanceof THREE.AmbientLight){ha.r+=O.r;ha.g+=O.g;ha.b+=O.b}else if($ instanceof THREE.DirectionalLight){ka.r+=
- O.r;ka.g+=O.g;ka.b+=O.b}else if($ instanceof THREE.PointLight){D.r+=O.r;D.g+=O.g;D.b+=O.b}}}function Da(L,ea,$,O){var Y,ga,ma,na,oa=L.lights;L=0;for(Y=oa.length;L<Y;L++){ga=oa[L];ma=ga.color;na=ga.intensity;if(ga instanceof THREE.DirectionalLight){ga=$.dot(ga.position)*na;if(ga>0){O.r+=ma.r*ga;O.g+=ma.g*ga;O.b+=ma.b*ga}}else if(ga instanceof THREE.PointLight){K.sub(ga.position,ea);K.normalize();ga=$.dot(K)*na;if(ga>0){O.r+=ma.r*ga;O.g+=ma.g*ga;O.b+=ma.b*ga}}}}function Qa(L,ea,$){if($.opacity!=0){a($.opacity);
- c($.blending);var O,Y,ga,ma,na,oa;if($ instanceof THREE.ParticleBasicMaterial){if($.map&&$.map.image.loaded){ma=$.map.image;na=ma.width>>1;oa=ma.height>>1;Y=ea.scale.x*j;ga=ea.scale.y*h;$=Y*na;O=ga*oa;I.set(L.x-$,L.y-O,L.x+$,L.y+O);if(ba.instersects(I)){o.save();o.translate(L.x,L.y);o.rotate(-ea.rotation);o.scale(Y,-ga);o.translate(-na,-oa);o.drawImage(ma,0,0);o.restore()}}}else if($ instanceof THREE.ParticleCircleMaterial){if(Q){V.r=ha.r+ka.r+D.r;V.g=ha.g+ka.g+D.g;V.b=ha.b+ka.b+D.b;y.r=$.color.r*
- V.r;y.g=$.color.g*V.g;y.b=$.color.b*V.b;y.updateStyleString()}else y.__styleString=$.color.__styleString;$=ea.scale.x*j;O=ea.scale.y*h;I.set(L.x-$,L.y-O,L.x+$,L.y+O);if(ba.instersects(I)){Y=y.__styleString;if(B!=Y)o.fillStyle=B=Y;o.save();o.translate(L.x,L.y);o.rotate(-ea.rotation);o.scale($,O);o.beginPath();o.arc(0,0,1,0,H,true);o.closePath();o.fill();o.restore()}}}}function Ra(L,ea,$,O){if(O.opacity!=0){a(O.opacity);c(O.blending);o.beginPath();o.moveTo(L.positionScreen.x,L.positionScreen.y);o.lineTo(ea.positionScreen.x,
- ea.positionScreen.y);o.closePath();if(O instanceof THREE.LineBasicMaterial){y.__styleString=O.color.__styleString;L=O.linewidth;if(G!=L)o.lineWidth=G=L;L=y.__styleString;if(x!=L)o.strokeStyle=x=L;o.stroke();I.inflate(O.linewidth*2)}}}function La(L,ea,$,O,Y,ga){if(Y.opacity!=0){a(Y.opacity);c(Y.blending);m=L.positionScreen.x;n=L.positionScreen.y;C=ea.positionScreen.x;w=ea.positionScreen.y;p=$.positionScreen.x;F=$.positionScreen.y;o.beginPath();o.moveTo(m,n);o.lineTo(C,w);o.lineTo(p,F);o.lineTo(m,n);
- o.closePath();if(Y instanceof THREE.MeshBasicMaterial)if(Y.map)Y.map.image.loaded&&Y.map.mapping instanceof THREE.UVMapping&&Aa(m,n,C,w,p,F,Y.map.image,O.uvs[0].u,O.uvs[0].v,O.uvs[1].u,O.uvs[1].v,O.uvs[2].u,O.uvs[2].v);else if(Y.env_map){if(Y.env_map.image.loaded)if(Y.env_map.mapping instanceof THREE.SphericalReflectionMapping){L=xa.matrix;K.copy(O.vertexNormalsWorld[0]);T=(K.x*L.n11+K.y*L.n12+K.z*L.n13)*0.5+0.5;R=-(K.x*L.n21+K.y*L.n22+K.z*L.n23)*0.5+0.5;K.copy(O.vertexNormalsWorld[1]);Z=(K.x*L.n11+
- K.y*L.n12+K.z*L.n13)*0.5+0.5;ca=-(K.x*L.n21+K.y*L.n22+K.z*L.n23)*0.5+0.5;K.copy(O.vertexNormalsWorld[2]);W=(K.x*L.n11+K.y*L.n12+K.z*L.n13)*0.5+0.5;S=-(K.x*L.n21+K.y*L.n22+K.z*L.n23)*0.5+0.5;Aa(m,n,C,w,p,F,Y.env_map.image,T,R,Z,ca,W,S)}}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString);else if(Y instanceof THREE.MeshLambertMaterial){if(Y.map&&!Y.wireframe){Y.map.mapping instanceof THREE.UVMapping&&Aa(m,n,C,w,p,F,Y.map.image,O.uvs[0].u,O.uvs[0].v,O.uvs[1].u,
- O.uvs[1].v,O.uvs[2].u,O.uvs[2].v);c(THREE.SubtractiveBlending)}if(Q)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&O.vertexNormalsWorld.length==3){J.r=E.r=A.r=ha.r;J.g=E.g=A.g=ha.g;J.b=E.b=A.b=ha.b;Da(ga,O.v1.positionWorld,O.vertexNormalsWorld[0],J);Da(ga,O.v2.positionWorld,O.vertexNormalsWorld[1],E);Da(ga,O.v3.positionWorld,O.vertexNormalsWorld[2],A);M.r=(E.r+A.r)*0.5;M.g=(E.g+A.g)*0.5;M.b=(E.b+A.b)*0.5;U=Ma(J,E,A,M);Aa(m,n,C,w,p,F,U,0,0,1,0,0,1)}else{V.r=ha.r;V.g=ha.g;V.b=ha.b;Da(ga,O.centroidWorld,
- O.normalWorld,V);y.r=Y.color.r*V.r;y.g=Y.color.g*V.g;y.b=Y.color.b*V.b;y.updateStyleString();Y.wireframe?Ea(y.__styleString,Y.wireframe_linewidth):Fa(y.__styleString)}else Y.wireframe?Ea(Y.color.__styleString,Y.wireframe_linewidth):Fa(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){aa=xa.near;N=xa.far;J.r=J.g=J.b=1-Ha(L.positionScreen.z,aa,N);E.r=E.g=E.b=1-Ha(ea.positionScreen.z,aa,N);A.r=A.g=A.b=1-Ha($.positionScreen.z,aa,N);M.r=(E.r+A.r)*0.5;M.g=(E.g+A.g)*0.5;M.b=(E.b+A.b)*
- 0.5;U=Ma(J,E,A,M);Aa(m,n,C,w,p,F,U,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){y.r=Ia(O.normalWorld.x);y.g=Ia(O.normalWorld.y);y.b=Ia(O.normalWorld.z);y.updateStyleString();Y.wireframe?Ea(y.__styleString,Y.wireframe_linewidth):Fa(y.__styleString)}}}function Ea(L,ea){if(x!=L)o.strokeStyle=x=L;if(G!=ea)o.lineWidth=G=ea;o.stroke();I.inflate(ea*2)}function Fa(L){if(B!=L)o.fillStyle=B=L;o.fill()}function Aa(L,ea,$,O,Y,ga,ma,na,oa,ta,pa,ua,Ba){var ya,va;ya=ma.width-1;va=ma.height-1;na*=
- ya;oa*=va;ta*=ya;pa*=va;ua*=ya;Ba*=va;$-=L;O-=ea;Y-=L;ga-=ea;ta-=na;pa-=oa;ua-=na;Ba-=oa;va=1/(ta*Ba-ua*pa);ya=(Ba*$-pa*Y)*va;pa=(Ba*O-pa*ga)*va;$=(ta*Y-ua*$)*va;O=(ta*ga-ua*O)*va;L=L-ya*na-$*oa;ea=ea-pa*na-O*oa;o.save();o.transform(ya,pa,$,O,L,ea);o.clip();o.drawImage(ma,0,0);o.restore()}function Ma(L,ea,$,O){var Y=~~(L.r*255),ga=~~(L.g*255);L=~~(L.b*255);var ma=~~(ea.r*255),na=~~(ea.g*255);ea=~~(ea.b*255);var oa=~~($.r*255),ta=~~($.g*255);$=~~($.b*255);var pa=~~(O.r*255),ua=~~(O.g*255);O=~~(O.b*
- 255);fa[0]=Y<0?0:Y>255?255:Y;fa[1]=ga<0?0:ga>255?255:ga;fa[2]=L<0?0:L>255?255:L;fa[4]=ma<0?0:ma>255?255:ma;fa[5]=na<0?0:na>255?255:na;fa[6]=ea<0?0:ea>255?255:ea;fa[8]=oa<0?0:oa>255?255:oa;fa[9]=ta<0?0:ta>255?255:ta;fa[10]=$<0?0:$>255?255:$;fa[12]=pa<0?0:pa>255?255:pa;fa[13]=ua<0?0:ua>255?255:ua;fa[14]=O<0?0:O>255?255:O;da.putImageData(ia,0,0);sa.drawImage(P,0,0);return qa}function Ha(L,ea,$){L=(L-ea)/($-ea);return L*L*(3-2*L)}function Ia(L){L=(L+1)*0.5;return L<0?0:L>1?1:L}function Ja(L,ea){var $=
- ea.x-L.x,O=ea.y-L.y,Y=1/Math.sqrt($*$+O*O);$*=Y;O*=Y;ea.x+=$;ea.y+=O;L.x-=$;L.y-=O}var Ga,Na,ja,ra,za,Ka,Oa,Ca;this.autoClear?this.clear():o.setTransform(1,0,0,-1,j,h);d=e.projectScene(la,xa,this.sortElements);(Q=la.lights.length>0)&&Pa(la);Ga=0;for(Na=d.length;Ga<Na;Ga++){ja=d[Ga];I.empty();if(ja instanceof THREE.RenderableParticle){t=ja;t.x*=j;t.y*=h;ra=0;for(za=ja.materials.length;ra<za;ra++)Qa(t,ja,ja.materials[ra],la)}else if(ja instanceof THREE.RenderableLine){t=ja.v1;k=ja.v2;t.positionScreen.x*=
- j;t.positionScreen.y*=h;k.positionScreen.x*=j;k.positionScreen.y*=h;I.addPoint(t.positionScreen.x,t.positionScreen.y);I.addPoint(k.positionScreen.x,k.positionScreen.y);if(ba.instersects(I)){ra=0;for(za=ja.materials.length;ra<za;)Ra(t,k,ja,ja.materials[ra++],la)}}else if(ja instanceof THREE.RenderableFace3){t=ja.v1;k=ja.v2;f=ja.v3;t.positionScreen.x*=j;t.positionScreen.y*=h;k.positionScreen.x*=j;k.positionScreen.y*=h;f.positionScreen.x*=j;f.positionScreen.y*=h;if(ja.overdraw){Ja(t.positionScreen,k.positionScreen);
- Ja(k.positionScreen,f.positionScreen);Ja(f.positionScreen,t.positionScreen)}I.add3Points(t.positionScreen.x,t.positionScreen.y,k.positionScreen.x,k.positionScreen.y,f.positionScreen.x,f.positionScreen.y);if(ba.instersects(I)){ra=0;for(za=ja.meshMaterials.length;ra<za;){Ca=ja.meshMaterials[ra++];if(Ca instanceof THREE.MeshFaceMaterial){Ka=0;for(Oa=ja.faceMaterials.length;Ka<Oa;)(Ca=ja.faceMaterials[Ka++])&&La(t,k,f,ja,Ca,la)}else La(t,k,f,ja,Ca,la)}}}X.addRectangle(I)}o.setTransform(1,0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(T,R,Z){var ca,W,S,ba;ca=0;for(W=T.lights.length;ca<W;ca++){S=T.lights[ca];if(S instanceof THREE.DirectionalLight){ba=R.normalWorld.dot(S.position)*S.intensity;if(ba>0){Z.r+=S.color.r*ba;Z.g+=S.color.g*ba;Z.b+=S.color.b*ba}}else if(S instanceof THREE.PointLight){F.sub(S.position,R.centroidWorld);F.normalize();ba=R.normalWorld.dot(F)*S.intensity;if(ba>0){Z.r+=S.color.r*ba;Z.g+=S.color.g*ba;Z.b+=S.color.b*ba}}}}function c(T,R,Z,ca,W,S){A=e(M++);A.setAttribute("d",
- "M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");if(W instanceof THREE.MeshBasicMaterial)f.__styleString=W.color.__styleString;else if(W instanceof THREE.MeshLambertMaterial)if(k){m.r=n.r;m.g=n.g;m.b=n.b;a(S,ca,m);f.r=W.color.r*m.r;f.g=W.color.g*m.g;f.b=W.color.b*m.b;f.updateStyleString()}else f.__styleString=W.color.__styleString;else if(W instanceof THREE.MeshDepthMaterial){p=1-W.__2near/(W.__farPlusNear-
- ca.z*W.__farMinusNear);f.setRGB(p,p,p)}else W instanceof THREE.MeshNormalMaterial&&f.setRGB(g(ca.normalWorld.x),g(ca.normalWorld.y),g(ca.normalWorld.z));W.wireframe?A.setAttribute("style","fill: none; stroke: "+f.__styleString+"; stroke-width: "+W.wireframe_linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.wireframe_linecap+"; stroke-linejoin: "+W.wireframe_linejoin):A.setAttribute("style","fill: "+f.__styleString+"; fill-opacity: "+W.opacity);j.appendChild(A)}function d(T,R,Z,ca,W,
- S,ba){A=e(M++);A.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+R.positionScreen.x+" "+R.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+" L "+ca.positionScreen.x+","+ca.positionScreen.y+"z");if(S instanceof THREE.MeshBasicMaterial)f.__styleString=S.color.__styleString;else if(S instanceof THREE.MeshLambertMaterial)if(k){m.r=n.r;m.g=n.g;m.b=n.b;a(ba,W,m);f.r=S.color.r*m.r;f.g=S.color.g*m.g;f.b=S.color.b*m.b;f.updateStyleString()}else f.__styleString=S.color.__styleString;
- else if(S instanceof THREE.MeshDepthMaterial){p=1-S.__2near/(S.__farPlusNear-W.z*S.__farMinusNear);f.setRGB(p,p,p)}else S instanceof THREE.MeshNormalMaterial&&f.setRGB(g(W.normalWorld.x),g(W.normalWorld.y),g(W.normalWorld.z));S.wireframe?A.setAttribute("style","fill: none; stroke: "+f.__styleString+"; stroke-width: "+S.wireframe_linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.wireframe_linecap+"; stroke-linejoin: "+S.wireframe_linejoin):A.setAttribute("style","fill: "+f.__styleString+
- "; fill-opacity: "+S.opacity);j.appendChild(A)}function e(T){if(y[T]==null){y[T]=document.createElementNS("http://www.w3.org/2000/svg","path");U==0&&y[T].setAttribute("shape-rendering","crispEdges");return y[T]}return y[T]}function g(T){return T<0?Math.min((1+T)*0.5,0.5):0.5+Math.min(T*0.5,0.5)}var b=null,l=new THREE.Projector,j=document.createElementNS("http://www.w3.org/2000/svg","svg"),h,o,v,z,u,q,x,B,G=new THREE.Rectangle,t=new THREE.Rectangle,k=false,f=new THREE.Color(16777215),m=new THREE.Color(16777215),
- n=new THREE.Color(0),C=new THREE.Color(0),w=new THREE.Color(0),p,F=new THREE.Vector3,y=[],J=[],E=[],A,M,aa,N,U=1;this.domElement=j;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(T){switch(T){case "high":U=1;break;case "low":U=0}};this.setSize=function(T,R){h=T;o=R;v=h/2;z=o/2;j.setAttribute("viewBox",-v+" "+-z+" "+h+" "+o);j.setAttribute("width",h);j.setAttribute("height",o);G.set(-v,-z,v,z)};this.clear=function(){for(;j.childNodes.length>0;)j.removeChild(j.childNodes[0])};
- this.render=function(T,R){var Z,ca,W,S,ba,X,I,Q;this.autoClear&&this.clear();b=l.projectScene(T,R,this.sortElements);N=aa=M=0;if(k=T.lights.length>0){I=T.lights;n.setRGB(0,0,0);C.setRGB(0,0,0);w.setRGB(0,0,0);Z=0;for(ca=I.length;Z<ca;Z++){W=I[Z];S=W.color;if(W instanceof THREE.AmbientLight){n.r+=S.r;n.g+=S.g;n.b+=S.b}else if(W instanceof THREE.DirectionalLight){C.r+=S.r;C.g+=S.g;C.b+=S.b}else if(W instanceof THREE.PointLight){w.r+=S.r;w.g+=S.g;w.b+=S.b}}}Z=0;for(ca=b.length;Z<ca;Z++){I=b[Z];t.empty();
- if(I instanceof THREE.RenderableParticle){u=I;u.x*=v;u.y*=-z;W=0;for(S=I.materials.length;W<S;W++)if(Q=I.materials[W]){ba=u;X=I;Q=Q;var V=aa++;if(J[V]==null){J[V]=document.createElementNS("http://www.w3.org/2000/svg","circle");U==0&&J[V].setAttribute("shape-rendering","crispEdges")}A=J[V];A.setAttribute("cx",ba.x);A.setAttribute("cy",ba.y);A.setAttribute("r",X.scale.x*v);if(Q instanceof THREE.ParticleCircleMaterial){if(k){m.r=n.r+C.r+w.r;m.g=n.g+C.g+w.g;m.b=n.b+C.b+w.b;f.r=Q.color.r*m.r;f.g=Q.color.g*
- m.g;f.b=Q.color.b*m.b;f.updateStyleString()}else f=Q.color;A.setAttribute("style","fill: "+f.__styleString)}j.appendChild(A)}}else if(I instanceof THREE.RenderableLine){u=I.v1;q=I.v2;u.positionScreen.x*=v;u.positionScreen.y*=-z;q.positionScreen.x*=v;q.positionScreen.y*=-z;t.addPoint(u.positionScreen.x,u.positionScreen.y);t.addPoint(q.positionScreen.x,q.positionScreen.y);if(G.instersects(t)){W=0;for(S=I.materials.length;W<S;)if(Q=I.materials[W++]){ba=u;X=q;Q=Q;V=N++;if(E[V]==null){E[V]=document.createElementNS("http://www.w3.org/2000/svg",
- "line");U==0&&E[V].setAttribute("shape-rendering","crispEdges")}A=E[V];A.setAttribute("x1",ba.positionScreen.x);A.setAttribute("y1",ba.positionScreen.y);A.setAttribute("x2",X.positionScreen.x);A.setAttribute("y2",X.positionScreen.y);if(Q instanceof THREE.LineBasicMaterial){f.__styleString=Q.color.__styleString;A.setAttribute("style","fill: none; stroke: "+f.__styleString+"; stroke-width: "+Q.linewidth+"; stroke-opacity: "+Q.opacity+"; stroke-linecap: "+Q.linecap+"; stroke-linejoin: "+Q.linejoin);
- j.appendChild(A)}}}}else if(I instanceof THREE.RenderableFace3){u=I.v1;q=I.v2;x=I.v3;u.positionScreen.x*=v;u.positionScreen.y*=-z;q.positionScreen.x*=v;q.positionScreen.y*=-z;x.positionScreen.x*=v;x.positionScreen.y*=-z;t.addPoint(u.positionScreen.x,u.positionScreen.y);t.addPoint(q.positionScreen.x,q.positionScreen.y);t.addPoint(x.positionScreen.x,x.positionScreen.y);if(G.instersects(t)){W=0;for(S=I.meshMaterials.length;W<S;){Q=I.meshMaterials[W++];if(Q instanceof THREE.MeshFaceMaterial){ba=0;for(X=
- I.faceMaterials.length;ba<X;)(Q=I.faceMaterials[ba++])&&c(u,q,x,I,Q,T)}else Q&&c(u,q,x,I,Q,T)}}}else if(I instanceof THREE.RenderableFace4){u=I.v1;q=I.v2;x=I.v3;B=I.v4;u.positionScreen.x*=v;u.positionScreen.y*=-z;q.positionScreen.x*=v;q.positionScreen.y*=-z;x.positionScreen.x*=v;x.positionScreen.y*=-z;B.positionScreen.x*=v;B.positionScreen.y*=-z;t.addPoint(u.positionScreen.x,u.positionScreen.y);t.addPoint(q.positionScreen.x,q.positionScreen.y);t.addPoint(x.positionScreen.x,x.positionScreen.y);t.addPoint(B.positionScreen.x,
- B.positionScreen.y);if(G.instersects(t)){W=0;for(S=I.meshMaterials.length;W<S;){Q=I.meshMaterials[W++];if(Q instanceof THREE.MeshFaceMaterial){ba=0;for(X=I.faceMaterials.length;ba<X;)(Q=I.faceMaterials[ba++])&&d(u,q,x,B,I,Q,T)}else Q&&d(u,q,x,B,I,Q,T)}}}}}};
- THREE.WebGLRenderer=function(a){function c(k,f){k.fragment_shader=f.fragment_shader;k.vertex_shader=f.vertex_shader;k.uniforms=Uniforms.clone(f.uniforms)}function d(k,f){var m;if(k=="fragment")m=b.createShader(b.FRAGMENT_SHADER);else if(k=="vertex")m=b.createShader(b.VERTEX_SHADER);b.shaderSource(m,f);b.compileShader(m);if(!b.getShaderParameter(m,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(m));return null}return m}function e(k){switch(k){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;
- case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;
- case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var g=document.createElement("canvas"),b,l=null,j=null,h=new THREE.Matrix4,o,v=new Float32Array(16),z=new Float32Array(16),
- u=new Float32Array(16),q=new Float32Array(9),x=new Float32Array(16),B=true,G=new THREE.Color(0),t=0;if(a){if(a.antialias!==undefined)B=a.antialias;a.clearColor!==undefined&&G.setHex(a.clearColor);if(a.clearAlpha!==undefined)t=a.clearAlpha}this.domElement=g;this.autoClear=true;(function(k,f,m){try{b=g.getContext("experimental-webgl",{antialias:k})}catch(n){}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);
- b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(f.r,f.g,f.b,m)})(B,G,t);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(k,f){g.width=k;g.height=f;b.viewport(0,0,g.width,g.height)};this.setClearColor=function(k,f){var m=new THREE.Color(k);b.clearColor(m.r,m.g,m.b,f)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|
- b.DEPTH_BUFFER_BIT)};this.setupLights=function(k,f){var m,n,C,w=0,p=0,F=0,y,J,E,A=this.lights,M=A.directional.colors,aa=A.directional.positions,N=A.point.colors,U=A.point.positions,T=0,R=0;m=0;for(n=f.length;m<n;m++){C=f[m];y=C.color;J=C.position;E=C.intensity;if(C instanceof THREE.AmbientLight){w+=y.r;p+=y.g;F+=y.b}else if(C instanceof THREE.DirectionalLight){M[T*3]=y.r*E;M[T*3+1]=y.g*E;M[T*3+2]=y.b*E;aa[T*3]=J.x;aa[T*3+1]=J.y;aa[T*3+2]=J.z;T+=1}else if(C instanceof THREE.PointLight){N[R*3]=y.r*
- E;N[R*3+1]=y.g*E;N[R*3+2]=y.b*E;U[R*3]=J.x;U[R*3+1]=J.y;U[R*3+2]=J.z;R+=1}}A.point.length=R;A.directional.length=T;A.ambient[0]=w;A.ambient[1]=p;A.ambient[2]=F};this.createParticleBuffers=function(k){k.__webGLVertexBuffer=b.createBuffer();k.__webGLParticleBuffer=b.createBuffer()};this.createLineBuffers=function(k){k.__webGLVertexBuffer=b.createBuffer();k.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(k){k.__webGLVertexBuffer=b.createBuffer();k.__webGLNormalBuffer=b.createBuffer();
- k.__webGLTangentBuffer=b.createBuffer();k.__webGLUVBuffer=b.createBuffer();k.__webGLUV2Buffer=b.createBuffer();k.__webGLFaceBuffer=b.createBuffer();k.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(k){var f=k.vertices.length;k.__vertexArray=new Float32Array(f*3);k.__lineArray=new Uint16Array(f);k.__webGLLineCount=f};this.initParticleBuffers=function(k){var f=k.vertices.length;k.__vertexArray=new Float32Array(f*3);k.__particleArray=new Uint16Array(f);k.__webGLParticleCount=f};this.initMeshBuffers=
- function(k,f){var m,n,C=0,w=0,p=0,F=f.geometry.faces,y=k.faces;m=0;for(n=y.length;m<n;m++){fi=y[m];face=F[fi];if(face instanceof THREE.Face3){C+=3;w+=1;p+=3}else if(face instanceof THREE.Face4){C+=4;w+=2;p+=4}}k.__vertexArray=new Float32Array(C*3);k.__normalArray=new Float32Array(C*3);k.__tangentArray=new Float32Array(C*4);k.__uvArray=new Float32Array(C*2);k.__uv2Array=new Float32Array(C*2);k.__faceArray=new Uint16Array(w*3);k.__lineArray=new Uint16Array(p*2);C=false;m=0;for(n=f.materials.length;m<
- n;m++){F=f.materials[m];if(F instanceof THREE.MeshFaceMaterial){F=0;for(y=k.materials.length;F<y;F++)if(k.materials[F]&&k.materials[F].shading!=undefined&&k.materials[F].shading==THREE.SmoothShading){C=true;break}}else if(F&&F.shading!=undefined&&F.shading==THREE.SmoothShading){C=true;break}if(C)break}k.__needsSmoothNormals=C;k.__webGLFaceCount=w*3;k.__webGLLineCount=p*2};this.setMeshBuffers=function(k,f,m,n,C,w,p,F){var y,J,E,A,M,aa,N,U,T,R,Z=0,ca=0,W=0,S=0,ba=0,X=0,I=0,Q=0,V=k.__vertexArray,ha=
- k.__uvArray,ka=k.__uv2Array,D=k.__normalArray,H=k.__tangentArray,K=k.__faceArray,P=k.__lineArray,da=k.__needsSmoothNormals,ia=f.geometry,fa=ia.vertices,qa=k.faces,sa=ia.faces,wa=ia.uvs,la=ia.uvs2;f=0;for(y=qa.length;f<y;f++){J=qa[f];E=sa[J];aa=wa[J];J=la[J];A=E.vertexNormals;M=E.normal;if(E instanceof THREE.Face3){if(n){N=fa[E.a].position;U=fa[E.b].position;T=fa[E.c].position;V[ca]=N.x;V[ca+1]=N.y;V[ca+2]=N.z;V[ca+3]=U.x;V[ca+4]=U.y;V[ca+5]=U.z;V[ca+6]=T.x;V[ca+7]=T.y;V[ca+8]=T.z;ca+=9}if(F&&ia.hasTangents){N=
- fa[E.a].tangent;U=fa[E.b].tangent;T=fa[E.c].tangent;H[I]=N.x;H[I+1]=N.y;H[I+2]=N.z;H[I+3]=N.w;H[I+4]=U.x;H[I+5]=U.y;H[I+6]=U.z;H[I+7]=U.w;H[I+8]=T.x;H[I+9]=T.y;H[I+10]=T.z;H[I+11]=T.w;I+=12}if(p)if(A.length==3&&da)for(E=0;E<3;E++){M=A[E];D[X]=M.x;D[X+1]=M.y;D[X+2]=M.z;X+=3}else for(E=0;E<3;E++){D[X]=M.x;D[X+1]=M.y;D[X+2]=M.z;X+=3}if(w&&aa)for(E=0;E<3;E++){A=aa[E];ha[W]=A.u;ha[W+1]=A.v;W+=2}if(w&&J)for(E=0;E<3;E++){aa=J[E];ka[S]=aa.u;ka[S+1]=aa.v;S+=2}if(C){K[ba]=Z;K[ba+1]=Z+1;K[ba+2]=Z+2;ba+=3;P[Q]=
- Z;P[Q+1]=Z+1;P[Q+2]=Z;P[Q+3]=Z+2;P[Q+4]=Z+1;P[Q+5]=Z+2;Q+=6;Z+=3}}else if(E instanceof THREE.Face4){if(n){N=fa[E.a].position;U=fa[E.b].position;T=fa[E.c].position;R=fa[E.d].position;V[ca]=N.x;V[ca+1]=N.y;V[ca+2]=N.z;V[ca+3]=U.x;V[ca+4]=U.y;V[ca+5]=U.z;V[ca+6]=T.x;V[ca+7]=T.y;V[ca+8]=T.z;V[ca+9]=R.x;V[ca+10]=R.y;V[ca+11]=R.z;ca+=12}if(F&&ia.hasTangents){N=fa[E.a].tangent;U=fa[E.b].tangent;T=fa[E.c].tangent;E=fa[E.d].tangent;H[I]=N.x;H[I+1]=N.y;H[I+2]=N.z;H[I+3]=N.w;H[I+4]=U.x;H[I+5]=U.y;H[I+6]=U.z;
- H[I+7]=U.w;H[I+8]=T.x;H[I+9]=T.y;H[I+10]=T.z;H[I+11]=T.w;H[I+12]=E.x;H[I+13]=E.y;H[I+14]=E.z;H[I+15]=E.w;I+=16}if(p)if(A.length==4&&da)for(E=0;E<4;E++){M=A[E];D[X]=M.x;D[X+1]=M.y;D[X+2]=M.z;X+=3}else for(E=0;E<4;E++){D[X]=M.x;D[X+1]=M.y;D[X+2]=M.z;X+=3}if(w&&aa)for(E=0;E<4;E++){A=aa[E];ha[W]=A.u;ha[W+1]=A.v;W+=2}if(w&&J)for(E=0;E<4;E++){aa=J[E];ka[S]=aa.u;ka[S+1]=aa.v;S+=2}if(C){K[ba]=Z;K[ba+1]=Z+1;K[ba+2]=Z+2;K[ba+3]=Z;K[ba+4]=Z+2;K[ba+5]=Z+3;ba+=6;P[Q]=Z;P[Q+1]=Z+1;P[Q+2]=Z;P[Q+3]=Z+3;P[Q+4]=Z+
- 1;P[Q+5]=Z+2;P[Q+6]=Z+2;P[Q+7]=Z+3;Q+=8;Z+=4}}}if(n){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,V,m)}if(p){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,D,m)}if(F&&ia.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,H,m)}if(w&&W>0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,ha,m)}if(w&&S>0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,
- ka,m)}if(C){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,K,m);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,P,m)}};this.setLineBuffers=function(k,f,m,n){var C,w,p=k.vertices,F=p.length,y=k.__vertexArray,J=k.__lineArray;if(m)for(m=0;m<F;m++){C=p[m].position;w=m*3;y[w]=C.x;y[w+1]=C.y;y[w+2]=C.z}if(n)for(m=0;m<F;m++)J[m]=m;b.bindBuffer(b.ARRAY_BUFFER,k.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,y,f);
- b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,J,f)};this.setParticleBuffers=function(k,f,m,n){var C,w,p=k.vertices,F=p.length,y=k.__vertexArray,J=k.__particleArray;if(m)for(m=0;m<F;m++){C=p[m].position;w=m*3;y[w]=C.x;y[w+1]=C.y;y[w+2]=C.z}if(n)for(m=0;m<F;m++)J[m]=m;b.bindBuffer(b.ARRAY_BUFFER,k.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,y,f);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLParticleBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,J,f)};
- this.initMaterial=function(k,f,m){if(!k.program){var n,C;if(k instanceof THREE.MeshDepthMaterial)c(k,THREE.ShaderLib.depth);else if(k instanceof THREE.MeshNormalMaterial)c(k,THREE.ShaderLib.normal);else if(k instanceof THREE.MeshBasicMaterial)c(k,THREE.ShaderLib.basic);else if(k instanceof THREE.MeshLambertMaterial)c(k,THREE.ShaderLib.lambert);else if(k instanceof THREE.MeshPhongMaterial)c(k,THREE.ShaderLib.phong);else if(k instanceof THREE.LineBasicMaterial)c(k,THREE.ShaderLib.basic);else k instanceof
- THREE.ParticleBasicMaterial&&c(k,THREE.ShaderLib.particle_basic);var w,p,F,y;C=F=y=0;for(w=f.length;C<w;C++){p=f[C];p instanceof THREE.DirectionalLight&&F++;p instanceof THREE.PointLight&&y++}if(y+F<=4){f=F;y=y}else{f=Math.ceil(4*F/(y+F));y=4-f}C={directional:f,point:y};y=k.fragment_shader;f=k.vertex_shader;w={fog:m,map:k.map,env_map:k.env_map,light_map:k.light_map,maxDirLights:C.directional,maxPointLights:C.point};m=b.createProgram();C=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+
- w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,w.fog?"#define USE_FOG":"",w.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",w.map?"#define USE_MAP":"",w.env_map?"#define USE_ENVMAP":"",w.light_map?"#define USE_LIGHTMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");w=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+w.maxDirLights,"#define MAX_POINT_LIGHTS "+w.maxPointLights,w.map?"#define USE_MAP":
- "",w.env_map?"#define USE_ENVMAP":"",w.light_map?"#define USE_LIGHTMAP":"","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;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(m,d("fragment",C+y));b.attachShader(m,d("vertex",w+f));b.linkProgram(m);b.getProgramParameter(m,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+
- b.getProgramParameter(m,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");m.uniforms={};m.attributes={};k.program=m;m=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(n in k.uniforms)m.push(n);n=k.program;y=0;for(f=m.length;y<f;y++){C=m[y];n.uniforms[C]=b.getUniformLocation(n,C)}k=k.program;n=["position","normal","uv","uv2","tangent"];m=0;for(y=n.length;m<y;m++){f=n[m];k.attributes[f]=b.getAttribLocation(k,f)}}};this.renderBuffer=function(k,
- f,m,n,C,w){var p;this.initMaterial(n,f,m);p=n.program;if(p!=l){b.useProgram(p);l=p}this.loadCamera(p,k);this.loadMatrices(p);if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial){this.setupLights(p,f);f=this.lights;n.uniforms.enableLighting.value=f.directional.length+f.point.length;n.uniforms.ambientLightColor.value=f.ambient;n.uniforms.directionalLightColor.value=f.directional.colors;n.uniforms.directionalLightDirection.value=f.directional.positions;n.uniforms.pointLightColor.value=
- f.point.colors;n.uniforms.pointLightPosition.value=f.point.positions}if(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial){n.uniforms.color.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);n.uniforms.opacity.value=n.opacity;n.uniforms.map.texture=n.map;n.uniforms.light_map.texture=n.light_map;n.uniforms.env_map.texture=n.env_map;n.uniforms.reflectivity.value=n.reflectivity;n.uniforms.refraction_ratio.value=n.refraction_ratio;
- n.uniforms.combine.value=n.combine;n.uniforms.useRefract.value=n.env_map&&n.env_map.mapping instanceof THREE.CubeRefractionMapping;if(m){n.uniforms.fogColor.value.setHex(m.color.hex);if(m instanceof THREE.Fog){n.uniforms.fogNear.value=m.near;n.uniforms.fogFar.value=m.far}else if(m instanceof THREE.FogExp2)n.uniforms.fogDensity.value=m.density}}if(n instanceof THREE.LineBasicMaterial){n.uniforms.color.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);n.uniforms.opacity.value=
- n.opacity;if(m){n.uniforms.fogColor.value.setHex(m.color.hex);if(m instanceof THREE.Fog){n.uniforms.fogNear.value=m.near;n.uniforms.fogFar.value=m.far}else if(m instanceof THREE.FogExp2)n.uniforms.fogDensity.value=m.density}}if(n instanceof THREE.ParticleBasicMaterial){n.uniforms.color.value.setRGB(n.color.r*n.opacity,n.color.g*n.opacity,n.color.b*n.opacity);n.uniforms.opacity.value=n.opacity;n.uniforms.size.value=n.size;n.uniforms.map.texture=n.map;if(m){n.uniforms.fogColor.value.setHex(m.color.hex);
- if(m instanceof THREE.Fog){n.uniforms.fogNear.value=m.near;n.uniforms.fogFar.value=m.far}else if(m instanceof THREE.FogExp2)n.uniforms.fogDensity.value=m.density}}if(n instanceof THREE.MeshPhongMaterial){n.uniforms.ambient.value.setRGB(n.ambient.r,n.ambient.g,n.ambient.b);n.uniforms.specular.value.setRGB(n.specular.r,n.specular.g,n.specular.b);n.uniforms.shininess.value=n.shininess}if(n instanceof THREE.MeshDepthMaterial){n.uniforms.mNear.value=k.near;n.uniforms.mFar.value=k.far}k=n.uniforms;var F,
- y,J;for(F in k)if(J=p.uniforms[F]){f=k[F];y=f.type;m=f.value;if(y=="i")b.uniform1i(J,m);else if(y=="f")b.uniform1f(J,m);else if(y=="fv1")b.uniform1fv(J,m);else if(y=="fv")b.uniform3fv(J,m);else if(y=="v2")b.uniform2f(J,m.x,m.y);else if(y=="v3")b.uniform3f(J,m.x,m.y,m.z);else if(y=="c")b.uniform3f(J,m.r,m.g,m.b);else if(y=="t"){b.uniform1i(J,m);if(f=f.texture)if(f.image instanceof Array&&f.image.length==6){f=f;m=m;if(f.image.length==6){if(!f.image.__webGLTextureCube&&!f.image.__cubeMapInitialized&&
- f.image.loadCount==6){f.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,f.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(y=0;y<6;++y)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+y,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,
- f.image[y]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);f.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+m);b.bindTexture(b.TEXTURE_CUBE_MAP,f.image.__webGLTextureCube)}}else{f=f;m=m;if(!f.__webGLTexture&&f.image.loaded){f.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,f.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,e(f.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,
- e(f.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,e(f.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(f.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+m);b.bindTexture(b.TEXTURE_2D,f.__webGLTexture)}}}p=p.attributes;b.bindBuffer(b.ARRAY_BUFFER,C.__webGLVertexBuffer);b.vertexAttribPointer(p.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.position);if(p.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,C.__webGLNormalBuffer);
- b.vertexAttribPointer(p.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.normal)}if(p.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,C.__webGLTangentBuffer);b.vertexAttribPointer(p.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.tangent)}if(p.uv>=0)if(C.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,C.__webGLUVBuffer);b.vertexAttribPointer(p.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.uv)}else b.disableVertexAttribArray(p.uv);if(p.uv2>=0)if(C.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,
- C.__webGLUV2Buffer);b.vertexAttribPointer(p.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(p.uv2)}else b.disableVertexAttribArray(p.uv2);if(n.wireframe||n instanceof THREE.LineBasicMaterial){p=n.wireframe_linewidth!==undefined?n.wireframe_linewidth:n.linewidth!==undefined?n.linewidth:1;n=n instanceof THREE.LineBasicMaterial&&w.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(p);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,C.__webGLLineBuffer);b.drawElements(n,C.__webGLLineCount,b.UNSIGNED_SHORT,
- 0)}else if(n instanceof THREE.ParticleBasicMaterial){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,C.__webGLParticleBuffer);b.drawElements(b.POINTS,C.__webGLParticleCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,C.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,C.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(k,f,m,n,C,w,p){var F,y,J,E,A;J=0;for(E=n.materials.length;J<E;J++){F=n.materials[J];if(F instanceof THREE.MeshFaceMaterial){F=0;for(y=C.materials.length;F<y;F++)if((A=
- C.materials[F])&&A.blending==w&&A.opacity<1==p){this.setBlending(A.blending);this.renderBuffer(k,f,m,A,C,n)}}else if((A=F)&&A.blending==w&&A.opacity<1==p){this.setBlending(A.blending);this.renderBuffer(k,f,m,A,C,n)}}};this.render=function(k,f,m,n){var C,w,p,F=k.lights,y=k.fog;this.initWebGLObjects(k);n=n!==undefined?n:true;if(m&&!m.__webGLFramebuffer){m.__webGLFramebuffer=b.createFramebuffer();m.__webGLRenderbuffer=b.createRenderbuffer();m.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,
- m.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,m.width,m.height);b.bindTexture(b.TEXTURE_2D,m.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,e(m.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,e(m.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,e(m.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,e(m.min_filter));b.texImage2D(b.TEXTURE_2D,0,e(m.format),m.width,m.height,0,e(m.format),e(m.type),null);b.bindFramebuffer(b.FRAMEBUFFER,
- m.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,m.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,m.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(m){C=m.__webGLFramebuffer;p=m.width;w=m.height}else{C=null;p=g.width;w=g.height}if(C!=j){b.bindFramebuffer(b.FRAMEBUFFER,C);b.viewport(0,0,p,w);n&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);
- j=C}this.autoClear&&this.clear();f.autoUpdateMatrix&&f.updateMatrix();v.set(f.matrix.flatten());u.set(f.projectionMatrix.flatten());n=0;for(C=k.__webGLObjects.length;n<C;n++){w=k.__webGLObjects[n];p=w.object;w=w.buffer;if(p.visible){if(p.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);p.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW)}this.setupMatrices(p,f);this.renderPass(f,F,y,p,w,THREE.NormalBlending,false)}}n=0;for(C=k.__webGLObjects.length;n<C;n++){w=k.__webGLObjects[n];p=w.object;
- w=w.buffer;if(p.visible){this.setupMatrices(p,f);this.renderPass(f,F,y,p,w,THREE.AdditiveBlending,false);this.renderPass(f,F,y,p,w,THREE.SubtractiveBlending,false);this.renderPass(f,F,y,p,w,THREE.AdditiveBlending,true);this.renderPass(f,F,y,p,w,THREE.SubtractiveBlending,true);this.renderPass(f,F,y,p,w,THREE.NormalBlending,true)}}if(m&&m.min_filter!==THREE.NearestFilter&&m.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,m.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,
- null)}};this.initWebGLObjects=function(k){function f(J,E,A,M){if(J[E]==undefined){k.__webGLObjects.push({buffer:A,object:M});J[E]=1}}var m,n,C,w,p,F,y;if(!k.__webGLObjects){k.__webGLObjects=[];k.__webGLObjectsMap={}}m=0;for(n=k.objects.length;m<n;m++){C=k.objects[m];p=C.geometry;if(k.__webGLObjectsMap[C.id]==undefined)k.__webGLObjectsMap[C.id]={};y=k.__webGLObjectsMap[C.id];if(C instanceof THREE.Mesh){for(w in p.geometryChunks){F=p.geometryChunks[w];if(!F.__webGLVertexBuffer){this.createMeshBuffers(F);
- this.initMeshBuffers(F,C);p.__dirtyVertices=true;p.__dirtyElements=true;p.__dirtyUvs=true;p.__dirtyNormals=true;p.__dirtyTangents=true}if(p.__dirtyVertices||p.__dirtyElements||p.__dirtyUvs)this.setMeshBuffers(F,C,b.DYNAMIC_DRAW,p.__dirtyVertices,p.__dirtyElements,p.__dirtyUvs,p.__dirtyNormals,p.__dirtyTangents);f(y,w,F,C)}p.__dirtyVertices=false;p.__dirtyElements=false;p.__dirtyUvs=false;p.__dirtyNormals=false;p.__dirtyTangents=false}else if(C instanceof THREE.Line){if(!p.__webGLVertexBuffer){this.createLineBuffers(p);
- this.initLineBuffers(p);p.__dirtyVertices=true;p.__dirtyElements=true}p.__dirtyVertices&&this.setLineBuffers(p,b.DYNAMIC_DRAW,p.__dirtyVertices,p.__dirtyElements);f(y,0,p,C);p.__dirtyVertices=false;p.__dirtyElements=false}else if(C instanceof THREE.ParticleSystem){if(!p.__webGLVertexBuffer){this.createParticleBuffers(p);this.initParticleBuffers(p);p.__dirtyVertices=true;p.__dirtyElements=true}p.__dirtyVertices&&this.setParticleBuffers(p,b.DYNAMIC_DRAW,p.__dirtyVertices,p.__dirtyElements);f(y,0,p,
- C);p.__dirtyVertices=false;p.__dirtyElements=false}}};this.removeObject=function(k,f){var m,n;for(m=k.__webGLObjects.length-1;m>=0;m--){n=k.__webGLObjects[m].object;f==n&&k.__webGLObjects.splice(m,1)}};this.setupMatrices=function(k,f){k.autoUpdateMatrix&&k.updateMatrix();h.multiply(f.matrix,k.matrix);z.set(h.flatten());o=THREE.Matrix4.makeInvert3x3(h).transpose();q.set(o.m);x.set(k.matrix.flatten())};this.loadMatrices=function(k){b.uniformMatrix4fv(k.uniforms.viewMatrix,false,v);b.uniformMatrix4fv(k.uniforms.modelViewMatrix,
- false,z);b.uniformMatrix4fv(k.uniforms.projectionMatrix,false,u);b.uniformMatrix3fv(k.uniforms.normalMatrix,false,q);b.uniformMatrix4fv(k.uniforms.objectMatrix,false,x)};this.loadCamera=function(k,f){b.uniform3f(k.uniforms.cameraPosition,f.position.x,f.position.y,f.position.z)};this.setBlending=function(k){switch(k){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);
- b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(k,f){if(k){!f||f=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(k=="back")b.cullFace(b.BACK);else k=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
- THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, 1.0 ), fogFactor );\n#endif",
- envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",
- envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",
- map_particle_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",
- lightmap_fragment:"#ifdef USE_LIGHTMAP\nlightmapColor = texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
- lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
- lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"};
- THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
- value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
- THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}",
- vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",
- THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mColor * mapColor * lightmapColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},
- lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,
- "gl_FragColor = mColor * mapColor * lightmapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,
- "vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",
- THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 lightmapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,THREE.Snippets.lightmap_fragment,"gl_FragColor = mapColor * lightmapColor * totalLight * vec4( vLightWeighting, 1.0 );",
- THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
- THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );",THREE.Snippets.map_particle_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:"uniform float size;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"}};
- THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,null]};
- THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
- var GeometryUtils={merge:function(a,c){var d=c instanceof THREE.Mesh,e=a.vertices.length,g=d?c.geometry:c,b=a.vertices,l=g.vertices,j=a.faces,h=g.faces,o=a.uvs;g=g.uvs;d&&c.autoUpdateMatrix&&c.updateMatrix();for(var v=0,z=l.length;v<z;v++){var u=new THREE.Vertex(l[v].position.clone());d&&c.matrix.multiplyVector3(u.position);b.push(u)}v=0;for(z=h.length;v<z;v++){l=h[v];var q,x=l.vertexNormals;if(l instanceof THREE.Face3)q=new THREE.Face3(l.a+e,l.b+e,l.c+e);else if(l instanceof THREE.Face4)q=new THREE.Face4(l.a+
- e,l.b+e,l.c+e,l.d+e);q.centroid.copy(l.centroid);q.normal.copy(l.normal);d=0;for(b=x.length;d<b;d++){u=x[d];q.vertexNormals.push(u.clone())}q.materials=l.materials.slice();j.push(q)}v=0;for(z=g.length;v<z;v++){e=g[v];j=[];d=0;for(b=e.length;d<b;d++)j.push(new THREE.UV(e[d].u,e[d].v));o.push(j)}}},ImageUtils={loadTexture:function(a,c,d){var e=new Image;e.onload=function(){this.loaded=true;d&&d(this)};e.src=a;return new THREE.Texture(e,c)},loadArray:function(a,c){var d,e,g=[];d=g.loadCount=0;for(e=
- a.length;d<e;++d){g[d]=new Image;g[d].loaded=0;g[d].onload=function(){g.loadCount+=1;this.loaded=true;c&&c(this)};g[d].src=a[d]}return g}},SceneUtils={loadScene:function(a,c,d,e){a=new Worker(a);a.postMessage(0);a.onmessage=function(g){function b(){for(v in w.objects)if(!A.objects[v]){B=w.objects[v];if(f=A.geometries[B.geometry]){C=[];for(i=0;i<B.materials.length;i++)C[i]=A.materials[B.materials[i]];G=B.position;r=B.rotation;s=B.scale;object=new THREE.Mesh(f,C);object.position.set(G[0],G[1],G[2]);
- object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=B.visible;A.scene.addObject(object);A.objects[v]=object}}}function l(M){return function(aa){A.geometries[M]=aa;b();F-=1;j()}}function j(){e({total_models:J,total_textures:E,loaded_models:J-F,loaded_textures:E-y},A);F==0&&y==0&&d(A)}var h,o,v,z,u,q,x,B,G,t,k,f,m,n,C,w,p,F,y,J,E,A;w=g.data;p=new THREE.Loader;y=F=0;A={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{}};
- g=function(){y-=1;j()};for(u in w.cameras){t=w.cameras[u];if(t.type=="perspective")m=new THREE.Camera(t.fov,t.aspect,t.near,t.far);else if(t.type=="ortho"){m=new THREE.Camera;m.projectionMatrix=THREE.Matrix4.makeOrtho(t.left,t.right,t.top,t.bottom,t.near,t.far)}G=t.position;t=t.target;m.position.set(G[0],G[1],G[2]);m.target.position.set(t[0],t[1],t[2]);A.cameras[u]=m}for(z in w.lights){u=w.lights[z];if(u.type=="directional"){G=u.direction;light=new THREE.DirectionalLight;light.position.set(G[0],G[1],
- G[2]);light.position.normalize()}else if(u.type=="point"){G=u.position;light=new THREE.PointLight;light.position.set(G[0],G[1],G[2])}t=u.color;i=u.intensity||1;light.color.setRGB(t[0]*i,t[1]*i,t[2]*i);A.scene.addLight(light);A.lights[z]=light}for(q in w.fogs){z=w.fogs[q];if(z.type=="linear")n=new THREE.Fog(0,z.near,z.far);else if(z.type=="exp2")n=new THREE.FogExp2(0,z.density);t=z.color;n.color.setRGB(t[0],t[1],t[2]);A.fogs[q]=n}if(A.cameras&&w.defaults.camera)A.currentCamera=A.cameras[w.defaults.camera];
- if(A.fogs&&w.defaults.fog)A.scene.fog=A.fogs[w.defaults.fog];t=w.defaults.bgcolor;A.bgColor=new THREE.Color;A.bgColor.setRGB(t[0],t[1],t[2]);A.bgColorAlpha=w.defaults.bgalpha;for(h in w.geometries){q=w.geometries[h];if(q.type=="bin_mesh"||q.type=="ascii_mesh")F+=1}J=F;for(h in w.geometries){q=w.geometries[h];if(q.type=="cube"){f=new Cube(q.width,q.height,q.depth,q.segments_width,q.segments_height,null,q.flipped,q.sides);A.geometries[h]=f}else if(q.type=="plane"){f=new Plane(q.width,q.height,q.segments_width,
- q.segments_height);A.geometries[h]=f}else if(q.type=="sphere"){f=new Sphere(q.radius,q.segments_width,q.segments_height);A.geometries[h]=f}else if(q.type=="cylinder"){f=new Cylinder(q.numSegs,q.topRad,q.botRad,q.height,q.topOffset,q.botOffset);A.geometries[h]=f}else if(q.type=="torus"){f=new Torus(q.radius,q.tube,q.segmentsR,q.segmentsT);A.geometries[h]=f}else if(q.type=="icosahedron"){f=new Icosahedron(q.subdivisions);A.geometries[h]=f}else if(q.type=="bin_mesh")p.loadBinary({model:q.url,callback:l(h)});
- else q.type=="ascii_mesh"&&p.loadAscii({model:q.url,callback:l(h)})}for(x in w.textures){h=w.textures[x];y+=h.url instanceof Array?h.url.length:1}E=y;for(x in w.textures){h=w.textures[x];if(h.mapping!=undefined&&THREE[h.mapping]!=undefined)h.mapping=new THREE[h.mapping];if(h.url instanceof Array){q=ImageUtils.loadArray(h.url,g);q=new THREE.Texture(q,h.mapping)}else{q=ImageUtils.loadTexture(h.url,h.mapping,g);if(THREE[h.min_filter]!=undefined)q.min_filter=THREE[h.min_filter];if(THREE[h.mag_filter]!=
- undefined)q.mag_filter=THREE[h.mag_filter]}A.textures[x]=q}for(o in w.materials){x=w.materials[o];for(k in x.parameters)if(k=="env_map"||k=="map"||k=="light_map")x.parameters[k]=A.textures[x.parameters[k]];else if(k=="shading")x.parameters[k]=x.parameters[k]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(k=="combine")x.parameters[k]=x.parameters[k]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;x=new THREE[x.type](x.parameters);A.materials[o]=x}b();c(A)}},addMesh:function(a,c,d,
- e,g,b,l,j,h,o){c=new THREE.Mesh(c,o);c.scale.x=c.scale.y=c.scale.z=d;c.position.x=e;c.position.y=g;c.position.z=b;c.rotation.x=l;c.rotation.y=j;c.rotation.z=h;a.addObject(c);return c},addPanoramaCubeWebGL:function(a,c,d){var e=ShaderUtils.lib.cube;e.uniforms.tCube.texture=d;d=new THREE.MeshShaderMaterial({fragment_shader:e.fragment_shader,vertex_shader:e.vertex_shader,uniforms:e.uniforms});c=new THREE.Mesh(new Cube(c,c,c,1,1,null,true),d);a.addObject(c);return c},addPanoramaCube:function(a,c,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])}));c=new THREE.Mesh(new Cube(c,c,c,1,1,e,true),new THREE.MeshFaceMaterial);a.addObject(c);return c},
- addPanoramaCubePlanes:function(a,c,d){var e=c/2;c=new Plane(c,c);var g=Math.PI/2,b=Math.PI;SceneUtils.addMesh(a,c,1,0,0,-e,0,0,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[5])}));SceneUtils.addMesh(a,c,1,-e,0,0,0,g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[0])}));SceneUtils.addMesh(a,c,1,e,0,0,0,-g,0,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[1])}));SceneUtils.addMesh(a,c,1,0,e,0,g,0,b,new THREE.MeshBasicMaterial({map:new THREE.Texture(d[2])}));SceneUtils.addMesh(a,
- c,1,0,-e,0,-g,0,b,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() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
- normal:{uniforms:{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tAO:{type:"t",value:3,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:4,texture:null},uDisplacementBias:{type:"f",value:-0.5},uDisplacementScale:{type:"f",value:2.5},uPointLightPos:{type:"v3",value:new THREE.Vector3},uPointLightColor:{type:"c",value:new THREE.Color(15658734)},uDirLightPos:{type:"v3",value:new THREE.Vector3},
- uDirLightColor:{type:"c",value:new THREE.Color(15658734)},uAmbientLightColor:{type:"c",value:new THREE.Color(328965)},uDiffuseColor:{type:"c",value:new THREE.Color(15658734)},uSpecularColor:{type:"c",value:new THREE.Color(1118481)},uAmbientColor:{type:"c",value:new THREE.Color(328965)},uShininess:{type:"f",value:30}},fragment_shader:"uniform vec3 uDirLightPos;\nuniform vec3 uAmbientLightColor;\nuniform vec3 uDirLightColor;\nuniform vec3 uPointLightColor;\nuniform vec3 uAmbientColor;\nuniform vec3 uDiffuseColor;\nuniform vec3 uSpecularColor;\nuniform float uShininess;\nuniform bool enableDiffuse;\nuniform bool enableAO;\nuniform sampler2D tDiffuse;\nuniform sampler2D tNormal;\nuniform sampler2D tAO;\nuniform float uNormalScale;\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 diffuseTex = vec3( 1.0, 1.0, 1.0 );\nvec3 aoTex = vec3( 1.0, 1.0, 1.0 );\nvec3 normalTex = texture2D( tNormal, vUv ).xyz * 2.0 - 1.0;\nnormalTex.xy *= uNormalScale;\nnormalTex = normalize( normalTex );\nif( enableDiffuse )\ndiffuseTex = texture2D( tDiffuse, vUv ).xyz;\nif( enableAO )\naoTex = texture2D( tAO, vUv ).xyz;\nmat3 tsb = mat3( vTangent, vBinormal, vNormal );\nvec3 finalNormal = tsb * normalTex;\nvec3 normal = normalize( finalNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 pointDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 pointSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec3 pointVector = normalize( vPointLightVector );\nvec3 pointHalfVector = normalize( vPointLightVector + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, uShininess );\npointDiffuse += vec4( uDiffuseColor, 1.0 ) * pointDiffuseWeight;\npointSpecular += vec4( uSpecularColor, 1.0 ) * pointSpecularWeight;\nvec4 dirDiffuse = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 dirSpecular = vec4( 0.0, 0.0, 0.0, 0.0 );\nvec4 lDirection = viewMatrix * vec4( uDirLightPos, 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, uShininess );\ndirDiffuse += vec4( uDiffuseColor, 1.0 ) * dirDiffuseWeight;\ndirSpecular += vec4( uSpecularColor, 1.0 ) * dirSpecularWeight;\nvec4 totalLight = vec4( uAmbientLightColor * uAmbientColor, 1.0 );\ntotalLight += vec4( uDirLightColor, 1.0 ) * ( dirDiffuse + dirSpecular );\ntotalLight += vec4( uPointLightColor, 1.0 ) * ( pointDiffuse + pointSpecular );\ngl_FragColor = vec4( totalLight.xyz * aoTex * diffuseTex, 1.0 );\n}",
- vertex_shader:"attribute vec4 tangent;\nuniform vec3 uPointLightPos;\n#ifdef VERTEX_TEXTURES\nuniform sampler2D tDisplacement;\nuniform float uDisplacementScale;\nuniform float uDisplacementBias;\n#endif\nvarying vec3 vTangent;\nvarying vec3 vBinormal;\nvarying vec3 vNormal;\nvarying vec2 vUv;\nvarying vec3 vPointLightVector;\nvarying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\nvTangent = normalize( normalMatrix * tangent.xyz );\nvBinormal = cross( vNormal, vTangent ) * tangent.w;\nvBinormal = normalize( vBinormal );\nvUv = uv;\nvec4 lPosition = viewMatrix * vec4( uPointLightPos, 1.0 );\nvPointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\n#ifdef VERTEX_TEXTURES\nvec3 dv = texture2D( tDisplacement, uv ).xyz;\nfloat df = uDisplacementScale * dv.x + uDisplacementBias;\nvec4 displacedPosition = vec4( vNormal.xyz * df, 0.0 ) + mvPosition;\ngl_Position = projectionMatrix * displacedPosition;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif\n}"},
- cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertex_shader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"},convolution:{uniforms:{tDiffuse:{type:"t",
- value:0,texture:null},uImageIncrement:{type:"v2",value:new THREE.Vector2(0.001953125,0)},cKernel:{type:"fv1",value:[]}},vertex_shader:"varying vec2 vUv;\nuniform vec2 uImageIncrement;\n#define KERNEL_SIZE 25.0\nvoid main(void) {\nvUv = uv - ((KERNEL_SIZE - 1.0) / 2.0) * uImageIncrement;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform vec2 uImageIncrement;\n#define KERNEL_SIZE 25\nuniform float cKernel[KERNEL_SIZE];\nvoid main(void) {\nvec2 imageCoord = vUv;\nvec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );\nfor( int i=0; i<KERNEL_SIZE; ++i ) {\nsum += texture2D( tDiffuse, imageCoord ) * cKernel[i];\nimageCoord += uImageIncrement;\n}\ngl_FragColor = sum;\n}"},
- film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float time;\nconst float fNintensity = 0.35;\nconst float fSintensity = 0.35;\nconst float fScount = 4096.0;\nvoid main() {\nvec4 cTextureScreen = texture2D( tDiffuse, vUv );\nfloat x = vUv.x * vUv.y * time * 1000.0;\nx = mod( x, 13.0 ) * mod( x, 123.0 );\nfloat dx = mod( x, 0.01 );\nvec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx * 100.0, 0.0, 1.0 );\nvec2 sc = vec2( sin(vUv.y * fScount), cos(vUv.y * fScount) );\ncResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * fSintensity;\ncResult = cTextureScreen.rgb + clamp( fNintensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );\ncResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );\ngl_FragColor = vec4( cResult, cTextureScreen.a );\n}"},
- screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertex_shader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragment_shader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
- fragment_shader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(a){var c,d,e,g,b=2*Math.ceil(a*3)+1;if(b>25)b=25;g=(b-1)*0.5;d=Array(b);for(c=e=0;c<b;++c){d[c]=Math.exp(-((c-g)*(c-g))/(2*a*a));e+=d[c]}for(c=0;c<b;++c)d[c]/=e;return d}},Cube=function(a,c,d,e,g,b,l,j){function h(B,G,t,k,f,m,n,C){var w,p,F=e||1,y=g||1,J=F+1,E=y+1,A=f/2,M=m/2;f=f/F;var aa=m/y,N=o.vertices.length;if(B=="x"&&G=="y"||B=="y"&&G=="x")w="z";else if(B=="x"&&G=="z"||B=="z"&&G=="x")w="y";
- else if(B=="z"&&G=="y"||B=="y"&&G=="z")w="x";for(p=0;p<E;p++)for(m=0;m<J;m++){var U=new THREE.Vector3;U[B]=(m*f-A)*t;U[G]=(p*aa-M)*k;U[w]=n;o.vertices.push(new THREE.Vertex(U))}for(p=0;p<y;p++)for(m=0;m<F;m++){o.faces.push(new THREE.Face4(m+J*p+N,m+J*(p+1)+N,m+1+J*(p+1)+N,m+1+J*p+N,null,C));o.uvs.push([new THREE.UV(m/F,p/y),new THREE.UV(m/F,(p+1)/y),new THREE.UV((m+1)/F,(p+1)/y),new THREE.UV((m+1)/F,p/y)])}}THREE.Geometry.call(this);var o=this,v=a/2,z=c/2,u=d/2;l=l?-1:1;if(b!==undefined)if(b instanceof
- Array)this.materials=b;else{this.materials=[];for(var q=0;q<6;q++)this.materials.push([b])}else this.materials=[];this.sides={px:true,nx:true,py:true,ny:true,pz:true,nz:true};if(j!=undefined)for(var x in j)if(this.sides[x]!=undefined)this.sides[x]=j[x];this.sides.px&&h("z","y",1*l,-1,d,c,-v,this.materials[0]);this.sides.nx&&h("z","y",-1*l,-1,d,c,v,this.materials[1]);this.sides.py&&h("x","z",1*l,1,a,d,z,this.materials[2]);this.sides.ny&&h("x","z",1*l,-1,a,d,-z,this.materials[3]);this.sides.pz&&h("x",
- "y",1*l,-1,a,c,u,this.materials[4]);this.sides.nz&&h("x","y",-1*l,-1,a,c,-u,this.materials[5]);(function(){for(var B=[],G=[],t=0,k=o.vertices.length;t<k;t++){for(var f=o.vertices[t],m=false,n=0,C=B.length;n<C;n++){var w=B[n];if(f.position.x==w.position.x&&f.position.y==w.position.y&&f.position.z==w.position.z){G[t]=n;m=true;break}}if(!m){G[t]=B.length;B.push(new THREE.Vertex(f.position.clone()))}}t=0;for(k=o.faces.length;t<k;t++){f=o.faces[t];f.a=G[f.a];f.b=G[f.b];f.c=G[f.c];f.d=G[f.d]}o.vertices=
- B})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cube.prototype=new THREE.Geometry;Cube.prototype.constructor=Cube;
- var Cylinder=function(a,c,d,e,g){function b(o,v,z){l.vertices.push(new THREE.Vertex(new THREE.Vector3(o,v,z)))}THREE.Geometry.call(this);var l=this,j=Math.PI,h;for(h=0;h<a;h++)b(Math.sin(2*j*h/a)*c,Math.cos(2*j*h/a)*c,0);for(h=0;h<a;h++)b(Math.sin(2*j*h/a)*d,Math.cos(2*j*h/a)*d,e);for(h=0;h<a;h++)l.faces.push(new THREE.Face4(h,h+a,a+(h+1)%a,(h+1)%a));if(d!=0){b(0,0,-g);for(h=a;h<a+a/2;h++)l.faces.push(new THREE.Face4(2*a,(2*h-2*a)%a,(2*h-2*a+1)%a,(2*h-2*a+2)%a))}if(c!=0){b(0,0,e+g);for(h=a+a/2;h<
- 2*a;h++)l.faces.push(new THREE.Face4((2*h-2*a+2)%a+a,(2*h-2*a+1)%a+a,(2*h-2*a)%a+a,2*a+1))}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};Cylinder.prototype=new THREE.Geometry;Cylinder.prototype.constructor=Cylinder;
- var Plane=function(a,c,d,e){THREE.Geometry.call(this);var g,b=a/2,l=c/2;d=d||1;e=e||1;var j=d+1,h=e+1;a=a/d;var o=c/e;for(g=0;g<h;g++)for(c=0;c<j;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-b,-(g*o-l),0)));for(g=0;g<e;g++)for(c=0;c<d;c++){this.faces.push(new THREE.Face4(c+j*g,c+j*(g+1),c+1+j*(g+1),c+1+j*g));this.uvs.push([new THREE.UV(c/d,g/e),new THREE.UV(c/d,(g+1)/e),new THREE.UV((c+1)/d,(g+1)/e),new THREE.UV((c+1)/d,g/e)])}this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};
- Plane.prototype=new THREE.Geometry;Plane.prototype.constructor=Plane;
- var Sphere=function(a,c,d){THREE.Geometry.call(this);var e,g=Math.PI,b=Math.max(3,c||8),l=Math.max(2,d||6);c=[];for(d=0;d<l+1;d++){e=d/l;var j=a*Math.cos(e*g),h=a*Math.sin(e*g),o=[],v=0;for(e=0;e<b;e++){var z=2*e/b,u=h*Math.sin(z*g);z=h*Math.cos(z*g);(d==0||d==l)&&e>0||(v=this.vertices.push(new THREE.Vertex(new THREE.Vector3(z,j,u)))-1);o.push(v)}c.push(o)}var q,x,B;g=c.length;for(d=0;d<g;d++){b=c[d].length;if(d>0)for(e=0;e<b;e++){o=e==b-1;l=c[d][o?0:e+1];j=c[d][o?b-1:e];h=c[d-1][o?b-1:e];o=c[d-1][o?
- 0:e+1];u=d/(g-1);q=(d-1)/(g-1);x=(e+1)/b;z=e/b;v=new THREE.UV(1-x,u);u=new THREE.UV(1-z,u);z=new THREE.UV(1-z,q);var G=new THREE.UV(1-x,q);if(d<c.length-1){q=this.vertices[l].position.clone();x=this.vertices[j].position.clone();B=this.vertices[h].position.clone();q.normalize();x.normalize();B.normalize();this.faces.push(new THREE.Face3(l,j,h,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([v,u,z])}if(d>1){q=this.vertices[l].position.clone();
- x=this.vertices[h].position.clone();B=this.vertices[o].position.clone();q.normalize();x.normalize();B.normalize();this.faces.push(new THREE.Face3(l,h,o,[new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(x.x,x.y,x.z),new THREE.Vector3(B.x,B.y,B.z)]));this.uvs.push([v,z,G])}}}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial();this.boundingSphere={radius:a}};Sphere.prototype=new THREE.Geometry;Sphere.prototype.constructor=Sphere;
- var Torus=function(a,c,d,e){this.radius=a||100;this.tube=c||40;this.segmentsR=d||8;this.segmentsT=e||6;a=[];THREE.Geometry.call(this);for(c=0;c<=this.segmentsR;++c)for(d=0;d<=this.segmentsT;++d){e=d/this.segmentsT*2*Math.PI;var g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(e),(this.radius+this.tube*Math.cos(g))*Math.sin(e),this.tube*Math.sin(g))));a.push([d/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(d=
- 1;d<=this.segmentsT;++d){e=(this.segmentsT+1)*c+d;g=(this.segmentsT+1)*c+d-1;var b=(this.segmentsT+1)*(c-1)+d-1,l=(this.segmentsT+1)*(c-1)+d;this.faces.push(new THREE.Face4(e,g,b,l));this.uvs.push([new THREE.UV(a[e][0],a[e][1]),new THREE.UV(a[g][0],a[g][1]),new THREE.UV(a[b][0],a[b][1]),new THREE.UV(a[l][0],a[l][1])])}delete a;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Torus.prototype=new THREE.Geometry;Torus.prototype.constructor=Torus;
- var Icosahedron=function(a){function c(z,u,q){var x=Math.sqrt(z*z+u*u+q*q);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(z/x,u/x,q/x)))-1}function d(z,u,q,x){x.faces.push(new THREE.Face3(z,u,q))}function e(z,u){var q=g.vertices[z].position,x=g.vertices[u].position;return c((q.x+x.x)/2,(q.y+x.y)/2,(q.z+x.z)/2)}var g=this,b=new THREE.Geometry,l;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,-a);c(0,
- 1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);d(0,11,5,b);d(0,5,1,b);d(0,1,7,b);d(0,7,10,b);d(0,10,11,b);d(1,5,9,b);d(5,11,4,b);d(11,10,2,b);d(10,7,6,b);d(7,1,8,b);d(3,9,4,b);d(3,4,2,b);d(3,2,6,b);d(3,6,8,b);d(3,8,9,b);d(4,9,5,b);d(2,4,11,b);d(6,2,10,b);d(8,6,7,b);d(9,8,1,b);for(a=0;a<this.subdivisions;a++){l=new THREE.Geometry;for(var j in b.faces){var h=e(b.faces[j].a,b.faces[j].b),o=e(b.faces[j].b,b.faces[j].c),v=e(b.faces[j].c,b.faces[j].a);d(b.faces[j].a,h,v,l);d(b.faces[j].b,o,h,l);d(b.faces[j].c,
- v,o,l);d(h,o,v,l)}b.faces=l.faces}g.faces=b.faces;delete b;delete l;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()};Icosahedron.prototype=new THREE.Geometry;Icosahedron.prototype.constructor=Icosahedron;
- function LathedObject(a,c,d){THREE.Geometry.call(this);c=c||12;d=d||2*Math.PI;c=d/c;for(var e=[],g=[],b=[],l=[],j=0;j<a.length;j++){this.vertices.push(new THREE.Vertex(a[j]));g[j]=this.vertices.length-1;e[j]=new THREE.Vector3(a[j].x,a[j].y,a[j].z)}for(var h=THREE.Matrix4.rotationZMatrix(c),o=0;o<=d+0.0010;o+=c){for(j=0;j<e.length;j++)if(o<d){e[j]=h.multiplyVector3(e[j].clone());this.vertices.push(new THREE.Vertex(e[j]));b[j]=this.vertices.length-1}else b=l;if(o==0)l=g;for(j=0;j<g.length-1;j++){this.faces.push(new THREE.Face4(b[j],
- b[j+1],g[j+1],g[j]));this.uvs.push([new THREE.UV(o/d,j/a.length),new THREE.UV(o/d,(j+1)/a.length),new THREE.UV((o-c)/d,(j+1)/a.length),new THREE.UV((o-c)/d,j/a.length)])}g=b;b=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.sortFacesByMaterial()}LathedObject.prototype=new THREE.Geometry;LathedObject.prototype.constructor=LathedObject;THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?this.addStatusElement():null};
- THREE.Loader.prototype={addStatusElement:function(){var a=document.createElement("div");a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="#b00";a.style.color="#fff";a.style.width="140px";a.style.padding="0.25em 0.25em 0.25em 0.5em";a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=
- c},loadAsciiOld:function(a,c){var d=document.createElement("script");d.type="text/javascript";d.onload=c;d.src=a;document.getElementsByTagName("head")[0].appendChild(d)},loadAscii:function(a){var c=a.model,d=a.callback,e=a.texture_path?a.texture_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);c.onmessage=function(g){THREE.Loader.prototype.createModel(g.data,d,e)};c.postMessage(a)},loadBinary:function(a){var c=a.model,d=a.callback,e=a.texture_path?a.texture_path:
- THREE.Loader.prototype.extractUrlbase(c),g=a.bin_path?a.bin_path:THREE.Loader.prototype.extractUrlbase(c);a=(new Date).getTime();c=new Worker(c);var b=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(l){THREE.Loader.prototype.loadAjaxBuffers(l.data.buffers,l.data.materials,d,g,e,b)};c.onerror=function(l){alert("worker.onerror: "+l.message+"\n"+l.data);l.preventDefault()};c.postMessage(a)},loadAjaxBuffers:function(a,c,d,e,g,b){var l=new XMLHttpRequest,j=e+"/"+a,h=0;
- l.onreadystatechange=function(){if(l.readyState==4)l.status==200||l.status==0?THREE.Loader.prototype.createBinModel(l.responseText,d,g,c):alert("Couldn't load ["+j+"] ["+l.status+"]");else if(l.readyState==3){if(b){if(h==0)h=l.getResponseHeader("Content-Length");b({total:h,loaded:l.responseText.length})}}else if(l.readyState==2)h=l.getResponseHeader("Content-Length")};l.open("GET",j,true);l.overrideMimeType("text/plain; charset=x-user-defined");l.setRequestHeader("Content-Type","text/plain");l.send(null)},
- createBinModel:function(a,c,d,e){var g=function(b){function l(D,H){var K=v(D,H),P=v(D,H+1),da=v(D,H+2),ia=v(D,H+3),fa=(ia<<1&255|da>>7)-127;K=(da&127)<<16|P<<8|K;if(K==0&&fa==-127)return 0;return(1-2*(ia>>7))*(1+K*Math.pow(2,-23))*Math.pow(2,fa)}function j(D,H){var K=v(D,H),P=v(D,H+1),da=v(D,H+2);return(v(D,H+3)<<24)+(da<<16)+(P<<8)+K}function h(D,H){var K=v(D,H);return(v(D,H+1)<<8)+K}function o(D,H){var K=v(D,H);return K>127?K-256:K}function v(D,H){return D.charCodeAt(H)&255}function z(D){var H,
- K,P;H=j(a,D);K=j(a,D+C);P=j(a,D+w);D=h(a,D+p);THREE.Loader.prototype.f3(t,H,K,P,D)}function u(D){var H,K,P,da,ia,fa;H=j(a,D);K=j(a,D+C);P=j(a,D+w);da=h(a,D+p);ia=j(a,D+F);fa=j(a,D+y);D=j(a,D+J);THREE.Loader.prototype.f3n(t,m,H,K,P,da,ia,fa,D)}function q(D){var H,K,P,da;H=j(a,D);K=j(a,D+E);P=j(a,D+A);da=j(a,D+M);D=h(a,D+aa);THREE.Loader.prototype.f4(t,H,K,P,da,D)}function x(D){var H,K,P,da,ia,fa,qa,sa;H=j(a,D);K=j(a,D+E);P=j(a,D+A);da=j(a,D+M);ia=h(a,D+aa);fa=j(a,D+N);qa=j(a,D+U);sa=j(a,D+T);D=j(a,
- D+R);THREE.Loader.prototype.f4n(t,m,H,K,P,da,ia,fa,qa,sa,D)}function B(D){var H,K;H=j(a,D);K=j(a,D+Z);D=j(a,D+ca);THREE.Loader.prototype.uv3(t.uvs,n[H*2],n[H*2+1],n[K*2],n[K*2+1],n[D*2],n[D*2+1])}function G(D){var H,K,P;H=j(a,D);K=j(a,D+W);P=j(a,D+S);D=j(a,D+ba);THREE.Loader.prototype.uv4(t.uvs,n[H*2],n[H*2+1],n[K*2],n[K*2+1],n[P*2],n[P*2+1],n[D*2],n[D*2+1])}var t=this,k=0,f,m=[],n=[],C,w,p,F,y,J,E,A,M,aa,N,U,T,R,Z,ca,W,S,ba,X,I,Q,V,ha,ka;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(t,
- e,b);f={signature:a.substr(k,8),header_bytes:v(a,k+8),vertex_coordinate_bytes:v(a,k+9),normal_coordinate_bytes:v(a,k+10),uv_coordinate_bytes:v(a,k+11),vertex_index_bytes:v(a,k+12),normal_index_bytes:v(a,k+13),uv_index_bytes:v(a,k+14),material_index_bytes:v(a,k+15),nvertices:j(a,k+16),nnormals:j(a,k+16+4),nuvs:j(a,k+16+8),ntri_flat:j(a,k+16+12),ntri_smooth:j(a,k+16+16),ntri_flat_uv:j(a,k+16+20),ntri_smooth_uv:j(a,k+16+24),nquad_flat:j(a,k+16+28),nquad_smooth:j(a,k+16+32),nquad_flat_uv:j(a,k+16+36),
- nquad_smooth_uv:j(a,k+16+40)};k+=f.header_bytes;C=f.vertex_index_bytes;w=f.vertex_index_bytes*2;p=f.vertex_index_bytes*3;F=f.vertex_index_bytes*3+f.material_index_bytes;y=f.vertex_index_bytes*3+f.material_index_bytes+f.normal_index_bytes;J=f.vertex_index_bytes*3+f.material_index_bytes+f.normal_index_bytes*2;E=f.vertex_index_bytes;A=f.vertex_index_bytes*2;M=f.vertex_index_bytes*3;aa=f.vertex_index_bytes*4;N=f.vertex_index_bytes*4+f.material_index_bytes;U=f.vertex_index_bytes*4+f.material_index_bytes+
- f.normal_index_bytes;T=f.vertex_index_bytes*4+f.material_index_bytes+f.normal_index_bytes*2;R=f.vertex_index_bytes*4+f.material_index_bytes+f.normal_index_bytes*3;Z=f.uv_index_bytes;ca=f.uv_index_bytes*2;W=f.uv_index_bytes;S=f.uv_index_bytes*2;ba=f.uv_index_bytes*3;b=f.vertex_index_bytes*3+f.material_index_bytes;ka=f.vertex_index_bytes*4+f.material_index_bytes;X=f.ntri_flat*b;I=f.ntri_smooth*(b+f.normal_index_bytes*3);Q=f.ntri_flat_uv*(b+f.uv_index_bytes*3);V=f.ntri_smooth_uv*(b+f.normal_index_bytes*
- 3+f.uv_index_bytes*3);ha=f.nquad_flat*ka;b=f.nquad_smooth*(ka+f.normal_index_bytes*4);ka=f.nquad_flat_uv*(ka+f.uv_index_bytes*4);k+=function(D){var H,K,P,da=f.vertex_coordinate_bytes*3,ia=D+f.nvertices*da;for(D=D;D<ia;D+=da){H=l(a,D);K=l(a,D+f.vertex_coordinate_bytes);P=l(a,D+f.vertex_coordinate_bytes*2);THREE.Loader.prototype.v(t,H,K,P)}return f.nvertices*da}(k);k+=function(D){var H,K,P,da=f.normal_coordinate_bytes*3,ia=D+f.nnormals*da;for(D=D;D<ia;D+=da){H=o(a,D);K=o(a,D+f.normal_coordinate_bytes);
- P=o(a,D+f.normal_coordinate_bytes*2);m.push(H/127,K/127,P/127)}return f.nnormals*da}(k);k+=function(D){var H,K,P=f.uv_coordinate_bytes*2,da=D+f.nuvs*P;for(D=D;D<da;D+=P){H=l(a,D);K=l(a,D+f.uv_coordinate_bytes);n.push(H,K)}return f.nuvs*P}(k);k=k;X=k+X;I=X+I;Q=I+Q;V=Q+V;ha=V+ha;b=ha+b;ka=b+ka;(function(D){var H,K=f.vertex_index_bytes*3+f.material_index_bytes,P=K+f.uv_index_bytes*3,da=D+f.ntri_flat_uv*P;for(H=D;H<da;H+=P){z(H);B(H+K)}return da-D})(I);(function(D){var H,K=f.vertex_index_bytes*3+f.material_index_bytes+
- f.normal_index_bytes*3,P=K+f.uv_index_bytes*3,da=D+f.ntri_smooth_uv*P;for(H=D;H<da;H+=P){u(H);B(H+K)}return da-D})(Q);(function(D){var H,K=f.vertex_index_bytes*4+f.material_index_bytes,P=K+f.uv_index_bytes*4,da=D+f.nquad_flat_uv*P;for(H=D;H<da;H+=P){q(H);G(H+K)}return da-D})(b);(function(D){var H,K=f.vertex_index_bytes*4+f.material_index_bytes+f.normal_index_bytes*4,P=K+f.uv_index_bytes*4,da=D+f.nquad_smooth_uv*P;for(H=D;H<da;H+=P){x(H);G(H+K)}return da-D})(ka);(function(D){var H,K=f.vertex_index_bytes*
- 3+f.material_index_bytes,P=D+f.ntri_flat*K;for(H=D;H<P;H+=K)z(H);return P-D})(k);(function(D){var H,K=f.vertex_index_bytes*3+f.material_index_bytes+f.normal_index_bytes*3,P=D+f.ntri_smooth*K;for(H=D;H<P;H+=K)u(H);return P-D})(X);(function(D){var H,K=f.vertex_index_bytes*4+f.material_index_bytes,P=D+f.nquad_flat*K;for(H=D;H<P;H+=K)q(H);return P-D})(V);(function(D){var H,K=f.vertex_index_bytes*4+f.material_index_bytes+f.normal_index_bytes*4,P=D+f.nquad_smooth*K;for(H=D;H<P;H+=K)x(H);return P-D})(ha);
- this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(d))},createModel:function(a,c,d){var e=function(g){var b=this;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(b,a.materials,g);(function(){var l,j,h,o,v;l=0;for(j=a.vertices.length;l<j;l+=3){h=a.vertices[l];o=a.vertices[l+1];v=a.vertices[l+2];THREE.Loader.prototype.v(b,h,o,v)}})();(function(){function l(x,B){THREE.Loader.prototype.f3(b,x[B],
- x[B+1],x[B+2],x[B+3])}function j(x,B){THREE.Loader.prototype.f3n(b,a.normals,x[B],x[B+1],x[B+2],x[B+3],x[B+4],x[B+5],x[B+6])}function h(x,B){THREE.Loader.prototype.f4(b,x[B],x[B+1],x[B+2],x[B+3],x[B+4])}function o(x,B){THREE.Loader.prototype.f4n(b,a.normals,x[B],x[B+1],x[B+2],x[B+3],x[B+4],x[B+5],x[B+6],x[B+7],x[B+8])}function v(x,B){var G,t,k,f,m,n,C,w,p;G=x[B];t=x[B+1];k=x[B+2];f=a.uvs[G*2];C=a.uvs[G*2+1];m=a.uvs[t*2];w=a.uvs[t*2+1];n=a.uvs[k*2];p=a.uvs[k*2+1];THREE.Loader.prototype.uv3(b.uvs,f,
- C,m,w,n,p);if(a.uvs2){f=a.uvs2[G*2];C=a.uvs2[G*2+1];m=a.uvs2[t*2];w=a.uvs2[t*2+1];n=a.uvs2[k*2];p=a.uvs2[k*2+1];THREE.Loader.prototype.uv3(b.uvs2,f,1-C,m,1-w,n,1-p)}}function z(x,B){var G,t,k,f,m,n,C,w,p,F,y,J;G=x[B];t=x[B+1];k=x[B+2];f=x[B+3];m=a.uvs[G*2];p=a.uvs[G*2+1];n=a.uvs[t*2];F=a.uvs[t*2+1];C=a.uvs[k*2];y=a.uvs[k*2+1];w=a.uvs[f*2];J=a.uvs[f*2+1];THREE.Loader.prototype.uv4(b.uvs,m,p,n,F,C,y,w,J);if(a.uvs2){m=a.uvs2[G*2];p=a.uvs2[G*2+1];n=a.uvs2[t*2];F=a.uvs2[t*2+1];C=a.uvs2[k*2];y=a.uvs2[k*
- 2+1];w=a.uvs2[f*2];J=a.uvs2[f*2+1];THREE.Loader.prototype.uv4(b.uvs2,m,1-p,n,1-F,C,1-y,w,1-J)}}var u,q;u=0;for(q=a.triangles_uv.length;u<q;u+=7){l(a.triangles_uv,u);v(a.triangles_uv,u+4)}u=0;for(q=a.triangles_n_uv.length;u<q;u+=10){j(a.triangles_n_uv,u);v(a.triangles_n_uv,u+7)}u=0;for(q=a.quads_uv.length;u<q;u+=9){h(a.quads_uv,u);z(a.quads_uv,u+5)}u=0;for(q=a.quads_n_uv.length;u<q;u+=13){o(a.quads_n_uv,u);z(a.quads_n_uv,u+9)}u=0;for(q=a.triangles.length;u<q;u+=4)l(a.triangles,u);u=0;for(q=a.triangles_n.length;u<
- q;u+=7)j(a.triangles_n,u);u=0;for(q=a.quads.length;u<q;u+=5)h(a.quads,u);u=0;for(q=a.quads_n.length;u<q;u+=9)o(a.quads_n,u)})();this.computeCentroids();this.computeFaceNormals();this.sortFacesByMaterial()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;c(new e(d))},v:function(a,c,d,e){a.vertices.push(new THREE.Vertex(new THREE.Vector3(c,d,e)))},f3:function(a,c,d,e,g){a.faces.push(new THREE.Face3(c,d,e,null,a.materials[g]))},f4:function(a,c,d,e,g,b){a.faces.push(new THREE.Face4(c,d,e,g,null,
- a.materials[b]))},f3n:function(a,c,d,e,g,b,l,j,h){b=a.materials[b];var o=c[j*3],v=c[j*3+1];j=c[j*3+2];var z=c[h*3],u=c[h*3+1];h=c[h*3+2];a.faces.push(new THREE.Face3(d,e,g,[new THREE.Vector3(c[l*3],c[l*3+1],c[l*3+2]),new THREE.Vector3(o,v,j),new THREE.Vector3(z,u,h)],b))},f4n:function(a,c,d,e,g,b,l,j,h,o,v){l=a.materials[l];var z=c[h*3],u=c[h*3+1];h=c[h*3+2];var q=c[o*3],x=c[o*3+1];o=c[o*3+2];var B=c[v*3],G=c[v*3+1];v=c[v*3+2];a.faces.push(new THREE.Face4(d,e,g,b,[new THREE.Vector3(c[j*3],c[j*3+1],
- c[j*3+2]),new THREE.Vector3(z,u,h),new THREE.Vector3(q,x,o),new THREE.Vector3(B,G,v)],l))},uv3:function(a,c,d,e,g,b,l){var j=[];j.push(new THREE.UV(c,d));j.push(new THREE.UV(e,g));j.push(new THREE.UV(b,l));a.push(j)},uv4:function(a,c,d,e,g,b,l,j,h){var o=[];o.push(new THREE.UV(c,d));o.push(new THREE.UV(e,g));o.push(new THREE.UV(b,l));o.push(new THREE.UV(j,h));a.push(o)},init_materials:function(a,c,d){a.materials=[];for(var e=0;e<c.length;++e)a.materials[e]=[THREE.Loader.prototype.createMaterial(c[e],
- d)]},createMaterial:function(a,c){function d(l){l=Math.log(l)/Math.LN2;return Math.floor(l)==l}function e(l,j){var h=new Image;h.onload=function(){if(!d(this.width)||!d(this.height)){var o=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),v=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));l.image.width=o;l.image.height=v;l.image.getContext("2d").drawImage(this,0,0,o,v)}else l.image=this;l.image.loaded=1};h.src=j}var g,b;if(a.map_diffuse&&c){b=document.createElement("canvas");g=new THREE.MeshLambertMaterial({map:new THREE.Texture(b)});
- e(g.map,c+"/"+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;g=new THREE.MeshLambertMaterial({color:g,opacity:a.transparency})}else g=a.a_dbg_color?new THREE.MeshLambertMaterial({color:a.a_dbg_color}):new THREE.MeshLambertMaterial({color:15658734});if(a.map_lightmap&&c){b=document.createElement("canvas");g.light_map=new THREE.Texture(b);e(g.light_map,c+"/"+a.map_lightmap)}return g},extractUrlbase:function(a){a=a.split("/");a.pop();
- return a.join("/")}};
|