123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- // ThreeDebug.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 f,i,j,u,b,o;if(d==0)f=i=j=0;else{u=Math.floor(a*6);b=a*6-u;a=d*(1-c);o=d*(1-c*b);c=d*(1-c*(1-b));switch(u){case 1:f=o;i=d;j=a;break;case 2:f=a;i=d;j=c;break;case 3:f=a;i=o;j=d;break;case 4:f=c;i=a;j=d;break;case 5:f=d;i=a;j=o;break;case 6:case 0:f=d;i=c;j=a}}this.r=f;this.g=i;this.b=j;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,f=this.z;this.x=d*a.z-f*a.y;this.y=f*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,f){this.x=a||0;this.y=c||0;this.z=d||0;this.w=f||1};
- THREE.Vector4.prototype={set:function(a,c,d,f){this.x=a;this.y=c;this.z=d;this.w=f;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,f=a.objects,i=[];a=0;for(c=f.length;a<c;a++){d=f[a];if(d instanceof THREE.Mesh)i=i.concat(this.intersectObject(d))}i.sort(function(j,u){return j.distance-u.distance});return i},intersectObject:function(a){function c(I,w,R,F){F=F.clone().subSelf(w);R=R.clone().subSelf(w);var e=I.clone().subSelf(w);I=F.dot(F);w=F.dot(R);F=F.dot(e);var p=R.dot(R);R=R.dot(e);e=1/(I*p-w*w);p=(p*F-w*R)*e;I=(I*R-w*F)*e;return p>0&&I>0&&p+I<1}var d,f,i,j,u,b,o,q,y,z,
- x,s=a.geometry,G=s.vertices,J=[];d=0;for(f=s.faces.length;d<f;d++){i=s.faces[d];z=this.origin.clone();x=this.direction.clone();j=a.matrix.multiplyVector3(G[i.a].position.clone());u=a.matrix.multiplyVector3(G[i.b].position.clone());b=a.matrix.multiplyVector3(G[i.c].position.clone());o=i instanceof THREE.Face4?a.matrix.multiplyVector3(G[i.d].position.clone()):null;q=a.rotationMatrix.multiplyVector3(i.normal.clone());y=x.dot(q);if(y<0){q=q.dot((new THREE.Vector3).sub(j,z))/y;z=z.addSelf(x.multiplyScalar(q));
- if(i instanceof THREE.Face3){if(c(z,j,u,b)){i={distance:this.origin.distanceTo(z),point:z,face:i,object:a};J.push(i)}}else if(i instanceof THREE.Face4)if(c(z,j,u,o)||c(z,u,b,o)){i={distance:this.origin.distanceTo(z),point:z,face:i,object:a};J.push(i)}}}return J}};
- THREE.Rectangle=function(){function a(){j=f-c;u=i-d}var c,d,f,i,j,u,b=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return j};this.getHeight=function(){return u};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return f};this.getBottom=function(){return i};this.set=function(o,q,y,z){b=false;c=o;d=q;f=y;i=z;a()};this.addPoint=function(o,q){if(b){b=false;c=o;d=q;f=o;i=q}else{c=c<o?c:o;d=d<q?d:q;f=f>o?f:o;i=i>q?
- i:q}a()};this.add3Points=function(o,q,y,z,x,s){if(b){b=false;c=o<y?o<x?o:x:y<x?y:x;d=q<z?q<s?q:s:z<s?z:s;f=o>y?o>x?o:x:y>x?y:x;i=q>z?q>s?q:s:z>s?z:s}else{c=o<y?o<x?o<c?o:c:x<c?x:c:y<x?y<c?y:c:x<c?x:c;d=q<z?q<s?q<d?q:d:s<d?s:d:z<s?z<d?z:d:s<d?s:d;f=o>y?o>x?o>f?o:f:x>f?x:f:y>x?y>f?y:f:x>f?x:f;i=q>z?q>s?q>i?q:i:s>i?s:i:z>s?z>i?z:i:s>i?s:i}a()};this.addRectangle=function(o){if(b){b=false;c=o.getLeft();d=o.getTop();f=o.getRight();i=o.getBottom()}else{c=c<o.getLeft()?c:o.getLeft();d=d<o.getTop()?d:o.getTop();
- f=f>o.getRight()?f:o.getRight();i=i>o.getBottom()?i:o.getBottom()}a()};this.inflate=function(o){c-=o;d-=o;f+=o;i+=o;a()};this.minSelf=function(o){c=c>o.getLeft()?c:o.getLeft();d=d>o.getTop()?d:o.getTop();f=f<o.getRight()?f:o.getRight();i=i<o.getBottom()?i:o.getBottom();a()};this.instersects=function(o){return Math.min(f,o.getRight())-Math.max(c,o.getLeft())>=0&&Math.min(i,o.getBottom())-Math.max(d,o.getTop())>=0};this.empty=function(){b=true;i=f=d=c=0;a()};this.isEmpty=function(){return b};this.toString=
- function(){return"THREE.Rectangle ( left: "+c+", right: "+f+", top: "+d+", bottom: "+i+", width: "+j+", height: "+u+" )"}};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},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
- THREE.Matrix4=function(a,c,d,f,i,j,u,b,o,q,y,z,x,s,G,J){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=f||0;this.n21=i||0;this.n22=j||1;this.n23=u||0;this.n24=b||0;this.n31=o||0;this.n32=q||0;this.n33=y||1;this.n34=z||0;this.n41=x||0;this.n42=s||0;this.n43=G||0;this.n44=J||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,f,i,j,u,b,o,q,y,z,x,s,G,J){this.n11=a;this.n12=c;this.n13=d;this.n14=f;this.n21=i;this.n22=j;this.n23=u;this.n24=b;this.n31=o;this.n32=q;this.n33=y;this.n34=z;this.n41=x;this.n42=s;this.n43=G;this.n44=J;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 f=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,j=THREE.Matrix4.__tmpVec3;j.sub(a,c).normalize();f.cross(d,j).normalize();i.cross(j,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a);
- this.n31=j.x;this.n32=j.y;this.n33=j.z;this.n34=-j.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,f=a.z,i=1/(this.n41*c+this.n42*d+this.n43*f+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*f+this.n14)*i;a.y=(this.n21*c+this.n22*d+this.n23*f+this.n24)*i;a.z=(this.n31*c+this.n32*d+this.n33*f+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,d=a.y,f=a.z,i=a.w;a.x=this.n11*c+this.n12*d+this.n13*f+this.n14*i;a.y=this.n21*c+this.n22*d+this.n23*
- f+this.n24*i;a.z=this.n31*c+this.n32*d+this.n33*f+this.n34*i;a.w=this.n41*c+this.n42*d+this.n43*f+this.n44*i;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,f=a.n12,i=a.n13,j=a.n14,u=a.n21,b=a.n22,o=a.n23,q=a.n24,y=a.n31,
- z=a.n32,x=a.n33,s=a.n34,G=a.n41,J=a.n42,I=a.n43,w=a.n44,R=c.n11,F=c.n12,e=c.n13,p=c.n14,h=c.n21,g=c.n22,k=c.n23,m=c.n24,t=c.n31,l=c.n32,n=c.n33,r=c.n34,v=c.n41,A=c.n42,D=c.n43,K=c.n44;this.n11=d*R+f*h+i*t+j*v;this.n12=d*F+f*g+i*l+j*A;this.n13=d*e+f*k+i*n+j*D;this.n14=d*p+f*m+i*r+j*K;this.n21=u*R+b*h+o*t+q*v;this.n22=u*F+b*g+o*l+q*A;this.n23=u*e+b*k+o*n+q*D;this.n24=u*p+b*m+o*r+q*K;this.n31=y*R+z*h+x*t+s*v;this.n32=y*F+z*g+x*l+s*A;this.n33=y*e+z*k+x*n+s*D;this.n34=y*p+z*m+x*r+s*K;this.n41=G*R+J*h+
- I*t+w*v;this.n42=G*F+J*g+I*l+w*A;this.n43=G*e+J*k+I*n+w*D;this.n44=G*p+J*m+I*r+w*K;return this},multiplyToArray:function(a,c,d){var f=a.n11,i=a.n12,j=a.n13,u=a.n14,b=a.n21,o=a.n22,q=a.n23,y=a.n24,z=a.n31,x=a.n32,s=a.n33,G=a.n34,J=a.n41,I=a.n42,w=a.n43;a=a.n44;var R=c.n11,F=c.n12,e=c.n13,p=c.n14,h=c.n21,g=c.n22,k=c.n23,m=c.n24,t=c.n31,l=c.n32,n=c.n33,r=c.n34,v=c.n41,A=c.n42,D=c.n43;c=c.n44;this.n11=f*R+i*h+j*t+u*v;this.n12=f*F+i*g+j*l+u*A;this.n13=f*e+i*k+j*n+u*D;this.n14=f*p+i*m+j*r+u*c;this.n21=
- b*R+o*h+q*t+y*v;this.n22=b*F+o*g+q*l+y*A;this.n23=b*e+o*k+q*n+y*D;this.n24=b*p+o*m+q*r+y*c;this.n31=z*R+x*h+s*t+G*v;this.n32=z*F+x*g+s*l+G*A;this.n33=z*e+x*k+s*n+G*D;this.n34=z*p+x*m+s*r+G*c;this.n41=J*R+I*h+w*t+a*v;this.n42=J*F+I*g+w*l+a*A;this.n43=J*e+I*k+w*n+a*D;this.n44=J*p+I*m+w*r+a*c;d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;
- d[15]=this.n44;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,f=this.n13,i=this.n14,j=this.n21,u=this.n22,b=this.n23,o=this.n24,q=this.n31,y=this.n32,z=this.n33,x=this.n34,s=this.n41,G=this.n42,J=this.n43,I=this.n44,w=a.n11,R=a.n21,F=a.n31,e=a.n41,p=a.n12,h=a.n22,g=a.n32,k=a.n42,m=a.n13,t=a.n23,l=a.n33,n=a.n43,r=a.n14,v=a.n24,A=a.n34;a=a.n44;this.n11=c*w+d*R+f*F+i*e;this.n12=c*p+d*h+f*g+i*k;this.n13=c*m+d*t+f*l+i*n;this.n14=c*r+d*v+f*A+i*a;this.n21=j*w+u*R+b*F+o*e;this.n22=j*p+u*
- h+b*g+o*k;this.n23=j*m+u*t+b*l+o*n;this.n24=j*r+u*v+b*A+o*a;this.n31=q*w+y*R+z*F+x*e;this.n32=q*p+y*h+z*g+x*k;this.n33=q*m+y*t+z*l+x*n;this.n34=q*r+y*v+z*A+x*a;this.n41=s*w+G*R+J*F+I*e;this.n42=s*p+G*h+J*g+I*k;this.n43=s*m+G*t+J*l+I*n;this.n44=s*r+G*v+J*A+I*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,f=this.n14,i=this.n21,j=this.n22,u=this.n23,b=this.n24,o=this.n31,q=this.n32,y=this.n33,z=this.n34,x=this.n41,s=this.n42,G=this.n43,J=this.n44;return f*u*q*x-d*b*q*x-f*j*y*x+c*b*y*x+d*j*z*x-c*u*z*x-f*u*o*s+d*b*o*s+f*i*y*s-a*b*y*s-d*i*z*s+a*u*z*s+f*j*o*G-c*b*o*G-f*i*q*G+a*b*q*G+c*i*z*G-a*j*z*G-d*j*o*J+c*u*o*J+d*i*q*J-a*u*q*J-c*i*y*J+a*j*y*J},transpose:function(){function a(c,d,f){var i=c[d];c[d]=c[f];c[f]=i}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},flattenToArray:function(a){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),f=Math.sin(c),i=1-d,j=a.x,u=a.y,b=a.z,
- o=i*j,q=i*u;this.set(o*j+d,o*u-f*b,o*b+f*u,0,o*u+f*b,q*u+d,q*b-f*j,0,o*b-f*u,q*b+f*j,i*b*b+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 f=new THREE.Matrix4;f.setTranslation(a,c,d);return f};
- THREE.Matrix4.scaleMatrix=function(a,c,d){var f=new THREE.Matrix4;f.setScale(a,c,d);return f};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,f=a.n13,i=a.n14,j=a.n21,u=a.n22,b=a.n23,o=a.n24,q=a.n31,y=a.n32,z=a.n33,x=a.n34,s=a.n41,G=a.n42,J=a.n43,I=a.n44,w=new THREE.Matrix4;w.n11=b*x*G-o*z*G+o*y*J-u*x*J-b*y*I+u*z*I;w.n12=i*z*G-f*x*G-i*y*J+d*x*J+f*y*I-d*z*I;w.n13=f*o*G-i*b*G+i*u*J-d*o*J-f*u*I+d*b*I;w.n14=i*b*y-f*o*y-i*u*z+d*o*z+f*u*x-d*b*x;w.n21=o*z*s-b*x*s-o*q*J+j*x*J+b*q*I-j*z*I;w.n22=f*x*s-i*z*s+i*q*J-c*x*J-f*q*I+c*z*I;w.n23=i*b*s-f*o*s-i*j*J+c*o*J+f*j*I-c*b*I;w.n24=f*o*q-i*b*q+
- i*j*z-c*o*z-f*j*x+c*b*x;w.n31=u*x*s-o*y*s+o*q*G-j*x*G-u*q*I+j*y*I;w.n32=i*y*s-d*x*s-i*q*G+c*x*G+d*q*I-c*y*I;w.n33=f*o*s-i*u*s+i*j*G-c*o*G-d*j*I+c*u*I;w.n34=i*u*q-d*o*q-i*j*y+c*o*y+d*j*x-c*u*x;w.n41=b*y*s-u*z*s-b*q*G+j*z*G+u*q*J-j*y*J;w.n42=d*z*s-f*y*s+f*q*G-c*z*G-d*q*J+c*y*J;w.n43=f*u*s-d*b*s-f*j*G+c*b*G+d*j*J-c*u*J;w.n44=d*b*q-f*u*q+f*j*y-c*b*y-d*j*z+c*u*z;w.multiplyScalar(1/a.determinant());return w};
- THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,f=a.n33*a.n22-a.n32*a.n23,i=-a.n33*a.n21+a.n31*a.n23,j=a.n32*a.n21-a.n31*a.n22,u=-a.n33*a.n12+a.n32*a.n13,b=a.n33*a.n11-a.n31*a.n13,o=-a.n32*a.n11+a.n31*a.n12,q=a.n23*a.n12-a.n22*a.n13,y=-a.n23*a.n11+a.n21*a.n13,z=a.n22*a.n11-a.n21*a.n12;a=a.n11*f+a.n21*u+a.n31*q;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*f;d[1]=a*i;d[2]=a*j;d[3]=a*u;d[4]=a*b;d[5]=a*o;d[6]=a*q;d[7]=a*y;d[8]=a*z;return c};
- THREE.Matrix4.makeFrustum=function(a,c,d,f,i,j){var u,b,o;u=new THREE.Matrix4;b=2*i/(c-a);o=2*i/(f-d);a=(c+a)/(c-a);d=(f+d)/(f-d);f=-(j+i)/(j-i);i=-2*j*i/(j-i);u.n11=b;u.n12=0;u.n13=a;u.n14=0;u.n21=0;u.n22=o;u.n23=d;u.n24=0;u.n31=0;u.n32=0;u.n33=f;u.n34=i;u.n41=0;u.n42=0;u.n43=-1;u.n44=0;return u};THREE.Matrix4.makePerspective=function(a,c,d,f){var i;a=d*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,d,f)};
- THREE.Matrix4.makeOrtho=function(a,c,d,f,i,j){var u,b,o,q;u=new THREE.Matrix4;b=c-a;o=d-f;q=j-i;a=(c+a)/b;d=(d+f)/o;i=(j+i)/q;u.n11=2/b;u.n12=0;u.n13=0;u.n14=-a;u.n21=0;u.n22=2/o;u.n23=0;u.n24=-d;u.n31=0;u.n32=0;u.n33=-2/q;u.n34=-i;u.n41=0;u.n42=0;u.n43=0;u.n44=1;return u};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,f,i){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=i instanceof Array?i:[i]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
- THREE.Face4=function(a,c,d,f,i,j){this.a=a;this.b=c;this.c=d;this.d=f;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=j instanceof Array?j:[j]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,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.colors=[];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,f,i,j,u,b=new THREE.Vector3,o=new THREE.Vector3;f=0;for(i=this.vertices.length;f<i;f++){j=this.vertices[f];j.normal.set(0,0,0)}f=0;for(i=this.faces.length;f<i;f++){j=this.faces[f];if(a&&j.vertexNormals.length){b.set(0,0,0);c=0;for(d=j.normal.length;c<d;c++)b.addSelf(j.vertexNormals[c]);b.divideScalar(3)}else{c=this.vertices[j.a];d=this.vertices[j.b];u=this.vertices[j.c];b.sub(u.position,
- d.position);o.sub(c.position,d.position);b.crossSelf(o)}b.isZero()||b.normalize();j.normal.copy(b)}},computeVertexNormals:function(){var a,c,d,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)f[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{f=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)f[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){f[d.a].addSelf(d.normal);f[d.b].addSelf(d.normal);f[d.c].addSelf(d.normal);f[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)f[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(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(f[d.a]);d.vertexNormals[1].copy(f[d.b]);d.vertexNormals[2].copy(f[d.c]);d.vertexNormals[3].copy(f[d.d])}}},computeTangents:function(){function a(r,v,A,D,K,L,N){j=r.vertices[v].position;u=r.vertices[A].position;b=r.vertices[D].position;o=i[K];q=i[L];y=i[N];z=u.x-j.x;x=b.x-j.x;s=u.y-j.y;G=b.y-j.y;
- J=u.z-j.z;I=b.z-j.z;w=q.u-o.u;R=y.u-o.u;F=q.v-o.v;e=y.v-o.v;p=1/(w*e-R*F);k.set((e*z-F*x)*p,(e*s-F*G)*p,(e*J-F*I)*p);m.set((w*x-R*z)*p,(w*G-R*s)*p,(w*I-R*J)*p);h[v].addSelf(k);h[A].addSelf(k);h[D].addSelf(k);g[v].addSelf(m);g[A].addSelf(m);g[D].addSelf(m)}var c,d,f,i,j,u,b,o,q,y,z,x,s,G,J,I,w,R,F,e,p,h=[],g=[],k=new THREE.Vector3,m=new THREE.Vector3,t=new THREE.Vector3,l=new THREE.Vector3,n=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){h[c]=new THREE.Vector3;g[c]=new THREE.Vector3}c=0;
- for(d=this.faces.length;c<d;c++){f=this.faces[c];i=this.uvs[c];if(f instanceof THREE.Face3){a(this,f.a,f.b,f.c,0,1,2);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2])}else if(f instanceof THREE.Face4){a(this,f.a,f.b,f.c,0,1,2);a(this,f.a,f.b,f.d,0,1,3);this.vertices[f.a].normal.copy(f.vertexNormals[0]);this.vertices[f.b].normal.copy(f.vertexNormals[1]);this.vertices[f.c].normal.copy(f.vertexNormals[2]);
- this.vertices[f.d].normal.copy(f.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){n.copy(this.vertices[c].normal);f=h[c];t.copy(f);t.subSelf(n.multiplyScalar(n.dot(f))).normalize();l.cross(this.vertices[c].normal,f);f=l.dot(g[c]);f=f<0?-1:1;this.vertices[c].tangent.set(t.x,t.y,t.z,f)}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(y){var z=[];c=0;for(d=y.length;c<d;c++)y[c]==undefined?z.push("undefined"):z.push(y[c].toString());return z.join("_")}var c,d,f,i,j,u,b,o,q={};f=0;for(i=this.faces.length;f<i;f++){j=this.faces[f];
- u=j.materials;b=a(u);if(q[b]==undefined)q[b]={hash:b,counter:0};o=q[b].hash+"_"+q[b].counter;if(this.geometryChunks[o]==undefined)this.geometryChunks[o]={faces:[],materials:u,vertices:0};j=j instanceof THREE.Face3?3:4;if(this.geometryChunks[o].vertices+j>65535){q[b].counter+=1;o=q[b].hash+"_"+q[b].counter;if(this.geometryChunks[o]==undefined)this.geometryChunks[o]={faces:[],materials:u,vertices:0}}this.geometryChunks[o].faces.push(f);this.geometryChunks[o].vertices+=j}},toString:function(){return"THREE.Geometry ( vertices: "+
- this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
- THREE.Camera=function(a,c,d,f){this.fov=a;this.aspect=c;this.near=d;this.far=f;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(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
- this.translateZ=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);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,f=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.setRotX(c.x);if(c.y!=0){f.setRotY(c.y);this.rotationMatrix.multiplySelf(f)}if(c.z!=0){f.setRotZ(c.z);this.rotationMatrix.multiplySelf(f)}this.matrix.multiplySelf(this.rotationMatrix);if(d.x!=0||d.y!=0||d.z!=0){f.setScale(d.x,d.y,d.z);this.matrix.multiplySelf(f)}}};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];this.sortParticles=false};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.BillboardBlending=3;
- THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=false;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.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
- a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.LineBasicMaterialCounter={value:0};
- THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;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.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){a.color!==
- undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;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.shading!==undefined)this.shading=a.shading;if(a.blending!==
- undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;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;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<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/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+
- "<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
- THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;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.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){a.color!==
- undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;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.shading!==undefined)this.shading=a.shading;if(a.blending!==
- undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;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;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<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/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+
- "<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<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.opacity=1;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.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=
- 1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;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.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=
- a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;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;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- 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/>opacity: "+this.opacity+"<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/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+
- this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.MeshPhongMaterialCounter={value:0};
- THREE.MeshDepthMaterial=function(a){this.id=THREE.MeshDepthMaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;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;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
- undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshDepthMaterialCounter={value:0};
- THREE.MeshNormalMaterial=function(a){this.id=THREE.MeshNormalMaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;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;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
- undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshNormalMaterialCounter={value:0};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.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;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.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;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;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
- THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
- THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.offset=new THREE.Vector2;this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;
- if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.ParticleBasicMaterialCounter={value:0};
- 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,f,i,j){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=j!==undefined?j: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,f,i={};for(c in a){i[c]={};for(d in a[c]){f=a[c][d];i[c][d]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return i},merge:function(a){var c,d,f,i={};for(c=0;c<a.length;c++){f=this.clone(a[c]);for(d in f)i[d]=f[d]}return i}};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(g,k){return k.z-g.z}function c(g,k){var m=0,t=1,l=g.z+g.w,n=k.z+k.w,r=-g.z+g.w,v=-k.z+k.w;if(l>=0&&n>=0&&r>=0&&v>=0)return true;else if(l<0&&n<0||r<0&&v<0)return false;else{if(l<0)m=Math.max(m,l/(l-n));else if(n<0)t=Math.min(t,l/(l-n));if(r<0)m=Math.max(m,r/(r-v));else if(v<0)t=Math.min(t,r/(r-v));if(t<m)return false;else{g.lerpSelf(k,m);k.lerpSelf(g,1-t);return true}}}var d,f,i=[],j,u,b,o=[],q,y,z=[],x,s,G=[],J=new THREE.Vector4,I=new THREE.Vector4,w=new THREE.Matrix4,
- R=new THREE.Matrix4,F=[],e=new THREE.Vector4,p=new THREE.Vector4,h;this.projectObjects=function(g,k,m){var t=[],l,n;f=0;w.multiply(k.projectionMatrix,k.matrix);F[0]=new THREE.Vector4(w.n41-w.n11,w.n42-w.n12,w.n43-w.n13,w.n44-w.n14);F[1]=new THREE.Vector4(w.n41+w.n11,w.n42+w.n12,w.n43+w.n13,w.n44+w.n14);F[2]=new THREE.Vector4(w.n41+w.n21,w.n42+w.n22,w.n43+w.n23,w.n44+w.n24);F[3]=new THREE.Vector4(w.n41-w.n21,w.n42-w.n22,w.n43-w.n23,w.n44-w.n24);F[4]=new THREE.Vector4(w.n41-w.n31,w.n42-w.n32,w.n43-
- w.n33,w.n44-w.n34);F[5]=new THREE.Vector4(w.n41+w.n31,w.n42+w.n32,w.n43+w.n33,w.n44+w.n34);k=0;for(l=F.length;k<l;k++){n=F[k];n.divideScalar(Math.sqrt(n.x*n.x+n.y*n.y+n.z*n.z))}l=g.objects;g=0;for(k=l.length;g<k;g++){n=l[g];var r;if(!(r=!n.visible)){if(r=n instanceof THREE.Mesh){a:{r=void 0;for(var v=n.position,A=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),D=0;D<6;D++){r=F[D].x*v.x+F[D].y*v.y+F[D].z*v.z+F[D].w;if(r<=A){r=false;break a}}r=true}r=!r}r=r}if(!r){d=
- i[f]=i[f]||new THREE.RenderableObject;J.copy(n.position);w.multiplyVector3(J);d.object=n;d.z=J.z;t.push(d);f++}}m&&t.sort(a);return t};this.projectScene=function(g,k,m){var t=[],l=k.near,n=k.far,r,v,A,D,K,L,N,U,W,M,E,P,O,B,S,X;b=y=s=0;k.autoUpdateMatrix&&k.updateMatrix();w.multiply(k.projectionMatrix,k.matrix);L=this.projectObjects(g,k,true);g=0;for(r=L.length;g<r;g++){N=L[g].object;if(N.visible){N.autoUpdateMatrix&&N.updateMatrix();U=N.matrix;W=N.rotationMatrix;M=N.materials;E=N.overdraw;if(N instanceof
- THREE.Mesh){P=N.geometry;O=P.vertices;v=0;for(A=O.length;v<A;v++){B=O[v];B.positionWorld.copy(B.position);U.multiplyVector3(B.positionWorld);D=B.positionScreen;D.copy(B.positionWorld);w.multiplyVector4(D);D.x/=D.w;D.y/=D.w;B.__visible=D.z>l&&D.z<n}P=P.faces;v=0;for(A=P.length;v<A;v++){B=P[v];if(B instanceof THREE.Face3){D=O[B.a];K=O[B.b];S=O[B.c];if(D.__visible&&K.__visible&&S.__visible)if(N.doubleSided||N.flipSided!=(S.positionScreen.x-D.positionScreen.x)*(K.positionScreen.y-D.positionScreen.y)-
- (S.positionScreen.y-D.positionScreen.y)*(K.positionScreen.x-D.positionScreen.x)<0){j=o[b]=o[b]||new THREE.RenderableFace3;j.v1.positionWorld.copy(D.positionWorld);j.v2.positionWorld.copy(K.positionWorld);j.v3.positionWorld.copy(S.positionWorld);j.v1.positionScreen.copy(D.positionScreen);j.v2.positionScreen.copy(K.positionScreen);j.v3.positionScreen.copy(S.positionScreen);j.normalWorld.copy(B.normal);W.multiplyVector3(j.normalWorld);j.centroidWorld.copy(B.centroid);U.multiplyVector3(j.centroidWorld);
- j.centroidScreen.copy(j.centroidWorld);w.multiplyVector3(j.centroidScreen);S=B.vertexNormals;h=j.vertexNormalsWorld;D=0;for(K=S.length;D<K;D++){X=h[D]=h[D]||new THREE.Vector3;X.copy(S[D]);W.multiplyVector3(X)}j.z=j.centroidScreen.z;j.meshMaterials=M;j.faceMaterials=B.materials;j.overdraw=E;if(N.geometry.uvs[v]){j.uvs[0]=N.geometry.uvs[v][0];j.uvs[1]=N.geometry.uvs[v][1];j.uvs[2]=N.geometry.uvs[v][2]}t.push(j);b++}}else if(B instanceof THREE.Face4){D=O[B.a];K=O[B.b];S=O[B.c];X=O[B.d];if(D.__visible&&
- K.__visible&&S.__visible&&X.__visible)if(N.doubleSided||N.flipSided!=((X.positionScreen.x-D.positionScreen.x)*(K.positionScreen.y-D.positionScreen.y)-(X.positionScreen.y-D.positionScreen.y)*(K.positionScreen.x-D.positionScreen.x)<0||(K.positionScreen.x-S.positionScreen.x)*(X.positionScreen.y-S.positionScreen.y)-(K.positionScreen.y-S.positionScreen.y)*(X.positionScreen.x-S.positionScreen.x)<0)){j=o[b]=o[b]||new THREE.RenderableFace3;j.v1.positionWorld.copy(D.positionWorld);j.v2.positionWorld.copy(K.positionWorld);
- j.v3.positionWorld.copy(X.positionWorld);j.v1.positionScreen.copy(D.positionScreen);j.v2.positionScreen.copy(K.positionScreen);j.v3.positionScreen.copy(X.positionScreen);j.normalWorld.copy(B.normal);W.multiplyVector3(j.normalWorld);j.centroidWorld.copy(B.centroid);U.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);w.multiplyVector3(j.centroidScreen);j.z=j.centroidScreen.z;j.meshMaterials=M;j.faceMaterials=B.materials;j.overdraw=E;if(N.geometry.uvs[v]){j.uvs[0]=N.geometry.uvs[v][0];
- j.uvs[1]=N.geometry.uvs[v][1];j.uvs[2]=N.geometry.uvs[v][3]}t.push(j);b++;u=o[b]=o[b]||new THREE.RenderableFace3;u.v1.positionWorld.copy(K.positionWorld);u.v2.positionWorld.copy(S.positionWorld);u.v3.positionWorld.copy(X.positionWorld);u.v1.positionScreen.copy(K.positionScreen);u.v2.positionScreen.copy(S.positionScreen);u.v3.positionScreen.copy(X.positionScreen);u.normalWorld.copy(j.normalWorld);u.centroidWorld.copy(j.centroidWorld);u.centroidScreen.copy(j.centroidScreen);u.z=u.centroidScreen.z;u.meshMaterials=
- M;u.faceMaterials=B.materials;u.overdraw=E;if(N.geometry.uvs[v]){u.uvs[0]=N.geometry.uvs[v][1];u.uvs[1]=N.geometry.uvs[v][2];u.uvs[2]=N.geometry.uvs[v][3]}t.push(u);b++}}}}else if(N instanceof THREE.Line){R.multiply(w,U);O=N.geometry.vertices;B=O[0];B.positionScreen.copy(B.position);R.multiplyVector4(B.positionScreen);v=1;for(A=O.length;v<A;v++){D=O[v];D.positionScreen.copy(D.position);R.multiplyVector4(D.positionScreen);K=O[v-1];e.copy(D.positionScreen);p.copy(K.positionScreen);if(c(e,p)){e.multiplyScalar(1/
- e.w);p.multiplyScalar(1/p.w);q=z[y]=z[y]||new THREE.RenderableLine;q.v1.positionScreen.copy(e);q.v2.positionScreen.copy(p);q.z=Math.max(e.z,p.z);q.materials=N.materials;t.push(q);y++}}}else if(N instanceof THREE.Particle){I.set(N.position.x,N.position.y,N.position.z,1);w.multiplyVector4(I);I.z/=I.w;if(I.z>0&&I.z<1){x=G[s]=G[s]||new THREE.RenderableParticle;x.x=I.x/I.w;x.y=I.y/I.w;x.z=I.z;x.rotation=N.rotation.z;x.scale.x=N.scale.x*Math.abs(x.x-(I.x+k.projectionMatrix.n11)/(I.w+k.projectionMatrix.n14));
- x.scale.y=N.scale.y*Math.abs(x.y-(I.y+k.projectionMatrix.n22)/(I.w+k.projectionMatrix.n24));x.materials=N.materials;t.push(x);s++}}}}m&&t.sort(a);return t};this.unprojectVector=function(g,k){var m=THREE.Matrix4.makeInvert(k.matrix);m.multiplySelf(THREE.Matrix4.makeInvert(k.projectionMatrix));m.multiplyVector3(g);return g}};
- THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,f,i,j;this.domElement=document.createElement("div");this.setSize=function(u,b){d=u;f=b;i=d/2;j=f/2};this.render=function(u,b){var o,q,y,z,x,s,G,J;a=c.projectScene(u,b);o=0;for(q=a.length;o<q;o++){x=a[o];if(x instanceof THREE.RenderableParticle){G=x.x*i+i;J=x.y*j+j;y=0;for(z=x.material.length;y<z;y++){s=x.material[y];if(s instanceof THREE.ParticleDOMMaterial){s=s.domElement;s.style.left=G+"px";s.style.top=J+"px"}}}}}};
- THREE.CanvasRenderer=function(){function a(da){if(x!=da)q.globalAlpha=x=da}function c(da){if(s!=da){switch(da){case THREE.NormalBlending:q.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:q.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:q.globalCompositeOperation="darker"}s=da}}var d=null,f=new THREE.Projector,i=document.createElement("canvas"),j,u,b,o,q=i.getContext("2d"),y=new THREE.Color(0),z=0,x=1,s=0,G=null,J=null,I=1,w,R,F,e,p,h,g,k,m,t=new THREE.Color,
- l=new THREE.Color,n=new THREE.Color,r=new THREE.Color,v=new THREE.Color,A,D,K,L,N,U,W,M,E,P=new THREE.Rectangle,O=new THREE.Rectangle,B=new THREE.Rectangle,S=false,X=new THREE.Color,ba=new THREE.Color,Z=new THREE.Color,aa=new THREE.Color,ka=Math.PI*2,Y=new THREE.Vector3,ua,fa,wa,ha,la,va,oa=16;ua=document.createElement("canvas");ua.width=ua.height=2;fa=ua.getContext("2d");fa.fillStyle="rgba(0,0,0,1)";fa.fillRect(0,0,2,2);wa=fa.getImageData(0,0,2,2);ha=wa.data;la=document.createElement("canvas");la.width=
- la.height=oa;va=la.getContext("2d");va.translate(-oa/2,-oa/2);va.scale(oa,oa);oa--;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(da,ca){j=da;u=ca;b=j/2;o=u/2;i.width=j;i.height=u;P.set(-b,-o,b,o);x=1;s=0;J=G=null;I=1};this.setClearColor=function(da,ca){y=da;z=ca;O.set(-b,-o,b,o);q.setTransform(1,0,0,-1,b,o);this.clear()};this.setClearColorHex=function(da,ca){y.setHex(da);z=ca;O.set(-b,-o,b,o);q.setTransform(1,0,0,-1,b,o);this.clear()};this.clear=function(){q.setTransform(1,
- 0,0,-1,b,o);if(!O.isEmpty()){O.inflate(1);O.minSelf(P);if(y.hex==0&&z==0)q.clearRect(O.getX(),O.getY(),O.getWidth(),O.getHeight());else{c(THREE.NormalBlending);a(1);q.fillStyle="rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*255)+","+z+")";q.fillRect(O.getX(),O.getY(),O.getWidth(),O.getHeight())}O.empty()}};this.render=function(da,ca){function Ca(C){var V,T,H,Q=C.lights;ba.setRGB(0,0,0);Z.setRGB(0,0,0);aa.setRGB(0,0,0);C=0;for(V=Q.length;C<V;C++){T=Q[C];H=T.color;if(T instanceof
- THREE.AmbientLight){ba.r+=H.r;ba.g+=H.g;ba.b+=H.b}else if(T instanceof THREE.DirectionalLight){Z.r+=H.r;Z.g+=H.g;Z.b+=H.b}else if(T instanceof THREE.PointLight){aa.r+=H.r;aa.g+=H.g;aa.b+=H.b}}}function xa(C,V,T,H){var Q,$,ga,ia,ja=C.lights;C=0;for(Q=ja.length;C<Q;C++){$=ja[C];ga=$.color;ia=$.intensity;if($ instanceof THREE.DirectionalLight){$=T.dot($.position)*ia;if($>0){H.r+=ga.r*$;H.g+=ga.g*$;H.b+=ga.b*$}}else if($ instanceof THREE.PointLight){Y.sub($.position,V);Y.normalize();$=T.dot(Y)*ia;if($>
- 0){H.r+=ga.r*$;H.g+=ga.g*$;H.b+=ga.b*$}}}}function Ga(C,V,T){if(T.opacity!=0){a(T.opacity);c(T.blending);var H,Q,$,ga,ia,ja;if(T instanceof THREE.ParticleBasicMaterial){if(T.map&&T.map.image.loaded){ga=T.map.image;ia=ga.width>>1;ja=ga.height>>1;Q=V.scale.x*b;$=V.scale.y*o;T=Q*ia;H=$*ja;B.set(C.x-T,C.y-H,C.x+T,C.y+H);if(!P.instersects(B))return;q.save();q.translate(C.x,C.y);q.rotate(-V.rotation);q.scale(Q,-$);q.translate(-ia,-ja);q.drawImage(ga,0,0);q.restore()}q.beginPath();q.moveTo(C.x-10,C.y);q.lineTo(C.x+
- 10,C.y);q.moveTo(C.x,C.y-10);q.lineTo(C.x,C.y+10);q.closePath();q.strokeStyle="rgb(255,255,0)";q.stroke()}else if(T instanceof THREE.ParticleCircleMaterial){if(S){X.r=ba.r+Z.r+aa.r;X.g=ba.g+Z.g+aa.g;X.b=ba.b+Z.b+aa.b;t.r=T.color.r*X.r;t.g=T.color.g*X.g;t.b=T.color.b*X.b;t.updateStyleString()}else t.__styleString=T.color.__styleString;T=V.scale.x*b;H=V.scale.y*o;B.set(C.x-T,C.y-H,C.x+T,C.y+H);if(P.instersects(B)){Q=t.__styleString;if(J!=Q)q.fillStyle=J=Q;q.save();q.translate(C.x,C.y);q.rotate(-V.rotation);
- q.scale(T,H);q.beginPath();q.arc(0,0,1,0,ka,true);q.closePath();q.fill();q.restore()}}}}function Ha(C,V,T,H){if(H.opacity!=0){a(H.opacity);c(H.blending);q.beginPath();q.moveTo(C.positionScreen.x,C.positionScreen.y);q.lineTo(V.positionScreen.x,V.positionScreen.y);q.closePath();if(H instanceof THREE.LineBasicMaterial){t.__styleString=H.color.__styleString;C=H.linewidth;if(I!=C)q.lineWidth=I=C;C=t.__styleString;if(G!=C)q.strokeStyle=G=C;q.stroke();B.inflate(H.linewidth*2)}}}function ma(C,V,T,H,Q,$){if(Q.opacity!=
- 0){a(Q.opacity);c(Q.blending);e=C.positionScreen.x;p=C.positionScreen.y;h=V.positionScreen.x;g=V.positionScreen.y;k=T.positionScreen.x;m=T.positionScreen.y;q.beginPath();q.moveTo(e,p);q.lineTo(h,g);q.lineTo(k,m);q.lineTo(e,p);q.closePath();if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.image.loaded&&Q.map.mapping instanceof THREE.UVMapping&&za(e,p,h,g,k,m,Q.map.image,H.uvs[0].u,H.uvs[0].v,H.uvs[1].u,H.uvs[1].v,H.uvs[2].u,H.uvs[2].v);else if(Q.env_map){if(Q.env_map.image.loaded)if(Q.env_map.mapping instanceof
- THREE.SphericalReflectionMapping){C=ca.matrix;Y.copy(H.vertexNormalsWorld[0]);L=(Y.x*C.n11+Y.y*C.n12+Y.z*C.n13)*0.5+0.5;N=-(Y.x*C.n21+Y.y*C.n22+Y.z*C.n23)*0.5+0.5;Y.copy(H.vertexNormalsWorld[1]);U=(Y.x*C.n11+Y.y*C.n12+Y.z*C.n13)*0.5+0.5;W=-(Y.x*C.n21+Y.y*C.n22+Y.z*C.n23)*0.5+0.5;Y.copy(H.vertexNormalsWorld[2]);M=(Y.x*C.n11+Y.y*C.n12+Y.z*C.n13)*0.5+0.5;E=-(Y.x*C.n21+Y.y*C.n22+Y.z*C.n23)*0.5+0.5;za(e,p,h,g,k,m,Q.env_map.image,L,N,U,W,M,E)}}else Q.wireframe?Da(Q.color.__styleString,Q.wireframe_linewidth):
- Ea(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){Q.map.mapping instanceof THREE.UVMapping&&za(e,p,h,g,k,m,Q.map.image,H.uvs[0].u,H.uvs[0].v,H.uvs[1].u,H.uvs[1].v,H.uvs[2].u,H.uvs[2].v);c(THREE.SubtractiveBlending)}if(S)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&H.vertexNormalsWorld.length==3){l.r=n.r=r.r=ba.r;l.g=n.g=r.g=ba.g;l.b=n.b=r.b=ba.b;xa($,H.v1.positionWorld,H.vertexNormalsWorld[0],l);xa($,H.v2.positionWorld,H.vertexNormalsWorld[1],n);
- xa($,H.v3.positionWorld,H.vertexNormalsWorld[2],r);v.r=(n.r+r.r)*0.5;v.g=(n.g+r.g)*0.5;v.b=(n.b+r.b)*0.5;K=Ma(l,n,r,v);za(e,p,h,g,k,m,K,0,0,1,0,0,1)}else{X.r=ba.r;X.g=ba.g;X.b=ba.b;xa($,H.centroidWorld,H.normalWorld,X);t.r=Q.color.r*X.r;t.g=Q.color.g*X.g;t.b=Q.color.b*X.b;t.updateStyleString();Q.wireframe?Da(t.__styleString,Q.wireframe_linewidth):Ea(t.__styleString)}else Q.wireframe?Da(Q.color.__styleString,Q.wireframe_linewidth):Ea(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){A=
- ca.near;D=ca.far;l.r=l.g=l.b=1-Ia(C.positionScreen.z,A,D);n.r=n.g=n.b=1-Ia(V.positionScreen.z,A,D);r.r=r.g=r.b=1-Ia(T.positionScreen.z,A,D);v.r=(n.r+r.r)*0.5;v.g=(n.g+r.g)*0.5;v.b=(n.b+r.b)*0.5;K=Ma(l,n,r,v);za(e,p,h,g,k,m,K,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){t.r=Ja(H.normalWorld.x);t.g=Ja(H.normalWorld.y);t.b=Ja(H.normalWorld.z);t.updateStyleString();Q.wireframe?Da(t.__styleString,Q.wireframe_linewidth):Ea(t.__styleString)}}}function Da(C,V){if(G!=C)q.strokeStyle=G=C;if(I!=
- V)q.lineWidth=I=V;q.stroke();B.inflate(V*2)}function Ea(C){if(J!=C)q.fillStyle=J=C;q.fill()}function za(C,V,T,H,Q,$,ga,ia,ja,ra,na,sa,Aa){var pa,ta;pa=ga.width-1;ta=ga.height-1;ia*=pa;ja*=ta;ra*=pa;na*=ta;sa*=pa;Aa*=ta;T-=C;H-=V;Q-=C;$-=V;ra-=ia;na-=ja;sa-=ia;Aa-=ja;pa=ra*Aa-sa*na;if(pa!=0){ta=1/pa;pa=(Aa*T-na*Q)*ta;na=(Aa*H-na*$)*ta;T=(ra*Q-sa*T)*ta;H=(ra*$-sa*H)*ta;C=C-pa*ia-T*ja;V=V-na*ia-H*ja;q.save();q.transform(pa,na,T,H,C,V);q.clip();q.drawImage(ga,0,0);q.restore()}}function Ma(C,V,T,H){var Q=
- ~~(C.r*255),$=~~(C.g*255);C=~~(C.b*255);var ga=~~(V.r*255),ia=~~(V.g*255);V=~~(V.b*255);var ja=~~(T.r*255),ra=~~(T.g*255);T=~~(T.b*255);var na=~~(H.r*255),sa=~~(H.g*255);H=~~(H.b*255);ha[0]=Q<0?0:Q>255?255:Q;ha[1]=$<0?0:$>255?255:$;ha[2]=C<0?0:C>255?255:C;ha[4]=ga<0?0:ga>255?255:ga;ha[5]=ia<0?0:ia>255?255:ia;ha[6]=V<0?0:V>255?255:V;ha[8]=ja<0?0:ja>255?255:ja;ha[9]=ra<0?0:ra>255?255:ra;ha[10]=T<0?0:T>255?255:T;ha[12]=na<0?0:na>255?255:na;ha[13]=sa<0?0:sa>255?255:sa;ha[14]=H<0?0:H>255?255:H;fa.putImageData(wa,
- 0,0);va.drawImage(ua,0,0);return la}function Ia(C,V,T){C=(C-V)/(T-V);return C*C*(3-2*C)}function Ja(C){C=(C+1)*0.5;return C<0?0:C>1?1:C}function Ka(C,V){var T=V.x-C.x,H=V.y-C.y,Q=1/Math.sqrt(T*T+H*H);T*=Q;H*=Q;V.x+=T;V.y+=H;C.x-=T;C.y-=H}var Fa,Na,ea,qa,ya,La,Oa,Ba;this.autoClear?this.clear():q.setTransform(1,0,0,-1,b,o);d=f.projectScene(da,ca,this.sortElements);q.fillStyle="rgba( 0, 255, 255, 0.5 )";q.fillRect(P.getX(),P.getY(),P.getWidth(),P.getHeight());(S=da.lights.length>0)&&Ca(da);Fa=0;for(Na=
- d.length;Fa<Na;Fa++){ea=d[Fa];B.empty();if(ea instanceof THREE.RenderableParticle){w=ea;w.x*=b;w.y*=o;qa=0;for(ya=ea.materials.length;qa<ya;qa++)Ga(w,ea,ea.materials[qa],da)}else if(ea instanceof THREE.RenderableLine){w=ea.v1;R=ea.v2;w.positionScreen.x*=b;w.positionScreen.y*=o;R.positionScreen.x*=b;R.positionScreen.y*=o;B.addPoint(w.positionScreen.x,w.positionScreen.y);B.addPoint(R.positionScreen.x,R.positionScreen.y);if(P.instersects(B)){qa=0;for(ya=ea.materials.length;qa<ya;)Ha(w,R,ea,ea.materials[qa++],
- da)}}else if(ea instanceof THREE.RenderableFace3){w=ea.v1;R=ea.v2;F=ea.v3;w.positionScreen.x*=b;w.positionScreen.y*=o;R.positionScreen.x*=b;R.positionScreen.y*=o;F.positionScreen.x*=b;F.positionScreen.y*=o;if(ea.overdraw){Ka(w.positionScreen,R.positionScreen);Ka(R.positionScreen,F.positionScreen);Ka(F.positionScreen,w.positionScreen)}B.add3Points(w.positionScreen.x,w.positionScreen.y,R.positionScreen.x,R.positionScreen.y,F.positionScreen.x,F.positionScreen.y);if(P.instersects(B)){qa=0;for(ya=ea.meshMaterials.length;qa<
- ya;){Ba=ea.meshMaterials[qa++];if(Ba instanceof THREE.MeshFaceMaterial){La=0;for(Oa=ea.faceMaterials.length;La<Oa;)(Ba=ea.faceMaterials[La++])&&ma(w,R,F,ea,Ba,da)}else ma(w,R,F,ea,Ba,da)}}}O.addRectangle(B)}q.lineWidth=1;q.strokeStyle="rgba( 255, 0, 0, 0.5 )";q.strokeRect(O.getX(),O.getY(),O.getWidth(),O.getHeight());q.setTransform(1,0,0,1,0,0)}};
- THREE.SVGRenderer=function(){function a(L,N,U){var W,M,E,P;W=0;for(M=L.lights.length;W<M;W++){E=L.lights[W];if(E instanceof THREE.DirectionalLight){P=N.normalWorld.dot(E.position)*E.intensity;if(P>0){U.r+=E.color.r*P;U.g+=E.color.g*P;U.b+=E.color.b*P}}else if(E instanceof THREE.PointLight){m.sub(E.position,N.centroidWorld);m.normalize();P=N.normalWorld.dot(m)*E.intensity;if(P>0){U.r+=E.color.r*P;U.g+=E.color.g*P;U.b+=E.color.b*P}}}}function c(L,N,U,W,M,E){r=f(v++);r.setAttribute("d","M "+L.positionScreen.x+
- " "+L.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+U.positionScreen.x+","+U.positionScreen.y+"z");if(M instanceof THREE.MeshBasicMaterial)F.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshLambertMaterial)if(R){e.r=p.r;e.g=p.g;e.b=p.b;a(E,W,e);F.r=M.color.r*e.r;F.g=M.color.g*e.g;F.b=M.color.b*e.b;F.updateStyleString()}else F.__styleString=M.color.__styleString;else if(M instanceof THREE.MeshDepthMaterial){k=1-M.__2near/(M.__farPlusNear-W.z*M.__farMinusNear);
- F.setRGB(k,k,k)}else M instanceof THREE.MeshNormalMaterial&&F.setRGB(i(W.normalWorld.x),i(W.normalWorld.y),i(W.normalWorld.z));M.wireframe?r.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+M.wireframe_linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.wireframe_linecap+"; stroke-linejoin: "+M.wireframe_linejoin):r.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+M.opacity);b.appendChild(r)}function d(L,N,U,W,M,E,P){r=f(v++);r.setAttribute("d",
- "M "+L.positionScreen.x+" "+L.positionScreen.y+" L "+N.positionScreen.x+" "+N.positionScreen.y+" L "+U.positionScreen.x+","+U.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(E instanceof THREE.MeshBasicMaterial)F.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshLambertMaterial)if(R){e.r=p.r;e.g=p.g;e.b=p.b;a(P,M,e);F.r=E.color.r*e.r;F.g=E.color.g*e.g;F.b=E.color.b*e.b;F.updateStyleString()}else F.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshDepthMaterial){k=
- 1-E.__2near/(E.__farPlusNear-M.z*E.__farMinusNear);F.setRGB(k,k,k)}else E instanceof THREE.MeshNormalMaterial&&F.setRGB(i(M.normalWorld.x),i(M.normalWorld.y),i(M.normalWorld.z));E.wireframe?r.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+E.wireframe_linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframe_linecap+"; stroke-linejoin: "+E.wireframe_linejoin):r.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+E.opacity);b.appendChild(r)}
- function f(L){if(t[L]==null){t[L]=document.createElementNS("http://www.w3.org/2000/svg","path");K==0&&t[L].setAttribute("shape-rendering","crispEdges");return t[L]}return t[L]}function i(L){return L<0?Math.min((1+L)*0.5,0.5):0.5+Math.min(L*0.5,0.5)}var j=null,u=new THREE.Projector,b=document.createElementNS("http://www.w3.org/2000/svg","svg"),o,q,y,z,x,s,G,J,I=new THREE.Rectangle,w=new THREE.Rectangle,R=false,F=new THREE.Color(16777215),e=new THREE.Color(16777215),p=new THREE.Color(0),h=new THREE.Color(0),
- g=new THREE.Color(0),k,m=new THREE.Vector3,t=[],l=[],n=[],r,v,A,D,K=1;this.domElement=b;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(L){switch(L){case "high":K=1;break;case "low":K=0}};this.setSize=function(L,N){o=L;q=N;y=o/2;z=q/2;b.setAttribute("viewBox",-y+" "+-z+" "+o+" "+q);b.setAttribute("width",o);b.setAttribute("height",q);I.set(-y,-z,y,z)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};this.render=function(L,N){var U,W,
- M,E,P,O,B,S;this.autoClear&&this.clear();j=u.projectScene(L,N,this.sortElements);D=A=v=0;if(R=L.lights.length>0){B=L.lights;p.setRGB(0,0,0);h.setRGB(0,0,0);g.setRGB(0,0,0);U=0;for(W=B.length;U<W;U++){M=B[U];E=M.color;if(M instanceof THREE.AmbientLight){p.r+=E.r;p.g+=E.g;p.b+=E.b}else if(M instanceof THREE.DirectionalLight){h.r+=E.r;h.g+=E.g;h.b+=E.b}else if(M instanceof THREE.PointLight){g.r+=E.r;g.g+=E.g;g.b+=E.b}}}U=0;for(W=j.length;U<W;U++){B=j[U];w.empty();if(B instanceof THREE.RenderableParticle){x=
- B;x.x*=y;x.y*=-z;M=0;for(E=B.materials.length;M<E;M++)if(S=B.materials[M]){P=x;O=B;S=S;var X=A++;if(l[X]==null){l[X]=document.createElementNS("http://www.w3.org/2000/svg","circle");K==0&&l[X].setAttribute("shape-rendering","crispEdges")}r=l[X];r.setAttribute("cx",P.x);r.setAttribute("cy",P.y);r.setAttribute("r",O.scale.x*y);if(S instanceof THREE.ParticleCircleMaterial){if(R){e.r=p.r+h.r+g.r;e.g=p.g+h.g+g.g;e.b=p.b+h.b+g.b;F.r=S.color.r*e.r;F.g=S.color.g*e.g;F.b=S.color.b*e.b;F.updateStyleString()}else F=
- S.color;r.setAttribute("style","fill: "+F.__styleString)}b.appendChild(r)}}else if(B instanceof THREE.RenderableLine){x=B.v1;s=B.v2;x.positionScreen.x*=y;x.positionScreen.y*=-z;s.positionScreen.x*=y;s.positionScreen.y*=-z;w.addPoint(x.positionScreen.x,x.positionScreen.y);w.addPoint(s.positionScreen.x,s.positionScreen.y);if(I.instersects(w)){M=0;for(E=B.materials.length;M<E;)if(S=B.materials[M++]){P=x;O=s;S=S;X=D++;if(n[X]==null){n[X]=document.createElementNS("http://www.w3.org/2000/svg","line");K==
- 0&&n[X].setAttribute("shape-rendering","crispEdges")}r=n[X];r.setAttribute("x1",P.positionScreen.x);r.setAttribute("y1",P.positionScreen.y);r.setAttribute("x2",O.positionScreen.x);r.setAttribute("y2",O.positionScreen.y);if(S instanceof THREE.LineBasicMaterial){F.__styleString=S.color.__styleString;r.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+S.linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.linecap+"; stroke-linejoin: "+S.linejoin);b.appendChild(r)}}}}else if(B instanceof
- THREE.RenderableFace3){x=B.v1;s=B.v2;G=B.v3;x.positionScreen.x*=y;x.positionScreen.y*=-z;s.positionScreen.x*=y;s.positionScreen.y*=-z;G.positionScreen.x*=y;G.positionScreen.y*=-z;w.addPoint(x.positionScreen.x,x.positionScreen.y);w.addPoint(s.positionScreen.x,s.positionScreen.y);w.addPoint(G.positionScreen.x,G.positionScreen.y);if(I.instersects(w)){M=0;for(E=B.meshMaterials.length;M<E;){S=B.meshMaterials[M++];if(S instanceof THREE.MeshFaceMaterial){P=0;for(O=B.faceMaterials.length;P<O;)(S=B.faceMaterials[P++])&&
- c(x,s,G,B,S,L)}else S&&c(x,s,G,B,S,L)}}}else if(B instanceof THREE.RenderableFace4){x=B.v1;s=B.v2;G=B.v3;J=B.v4;x.positionScreen.x*=y;x.positionScreen.y*=-z;s.positionScreen.x*=y;s.positionScreen.y*=-z;G.positionScreen.x*=y;G.positionScreen.y*=-z;J.positionScreen.x*=y;J.positionScreen.y*=-z;w.addPoint(x.positionScreen.x,x.positionScreen.y);w.addPoint(s.positionScreen.x,s.positionScreen.y);w.addPoint(G.positionScreen.x,G.positionScreen.y);w.addPoint(J.positionScreen.x,J.positionScreen.y);if(I.instersects(w)){M=
- 0;for(E=B.meshMaterials.length;M<E;){S=B.meshMaterials[M++];if(S instanceof THREE.MeshFaceMaterial){P=0;for(O=B.faceMaterials.length;P<O;)(S=B.faceMaterials[P++])&&d(x,s,G,J,B,S,L)}else S&&d(x,s,G,J,B,S,L)}}}}}};
- THREE.WebGLRenderer=function(a){function c(e,p){e.fragment_shader=p.fragment_shader;e.vertex_shader=p.vertex_shader;e.uniforms=Uniforms.clone(p.uniforms)}function d(e){if(e.doubleSided){if(y){b.disable(b.CULL_FACE);y=false}}else{if(!y){b.enable(b.CULL_FACE);y=true}e.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW)}}function f(e){if(e!=z){switch(e){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;
- case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}z=e}}function i(e,p){var h;if(e=="fragment")h=b.createShader(b.FRAGMENT_SHADER);else if(e=="vertex")h=b.createShader(b.VERTEX_SHADER);b.shaderSource(h,p);b.compileShader(h);if(!b.getShaderParameter(h,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(h));return null}return h}function j(e){switch(e){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 u=document.createElement("canvas"),
- b,o=null,q=null,y,z=null,x=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],s=new THREE.Matrix4,G=new Float32Array(16),J=new Float32Array(16),I=new THREE.Vector4,w=true,R=new THREE.Color(0),F=0;if(a){if(a.antialias!==undefined)w=a.antialias;a.clearColor!==undefined&&R.setHex(a.clearColor);if(a.clearAlpha!==undefined)F=a.clearAlpha}this.domElement=u;this.autoClear=true;(function(e,p,h){try{b=u.getContext("experimental-webgl",{antialias:e})}catch(g){console.log(g)}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(p.r,p.g,p.b,h);y=true})(w,R,F);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(e,p){u.width=e;u.height=p;b.viewport(0,0,u.width,u.height)};this.setClearColorHex=
- function(e,p){var h=new THREE.Color(e);b.clearColor(h.r,h.g,h.b,p)};this.setClearColor=function(e,p){b.clearColor(e.r,e.g,e.b,p)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=function(e,p){var h,g,k,m=0,t=0,l=0,n,r,v,A=this.lights,D=A.directional.colors,K=A.directional.positions,L=A.point.colors,N=A.point.positions,U=0,W=0;h=k=k=0;for(g=p.length;h<g;h++){k=p[h];n=k.color;r=k.position;v=k.intensity;if(k instanceof THREE.AmbientLight){m+=n.r;t+=n.g;l+=n.b}else if(k instanceof
- THREE.DirectionalLight){k=U*3;D[k]=n.r*v;D[k+1]=n.g*v;D[k+2]=n.b*v;K[k]=r.x;K[k+1]=r.y;K[k+2]=r.z;U+=1}else if(k instanceof THREE.PointLight){k=W*3;L[k]=n.r*v;L[k+1]=n.g*v;L[k+2]=n.b*v;N[k]=r.x;N[k+1]=r.y;N[k+2]=r.z;W+=1}}for(h=U*3;h<D.length;h++)D[h]=0;for(h=W*3;h<L.length;h++)L[h]=0;A.point.length=W;A.directional.length=U;A.ambient[0]=m;A.ambient[1]=t;A.ambient[2]=l};this.createParticleBuffers=function(e){e.__webGLVertexBuffer=b.createBuffer();e.__webGLColorBuffer=b.createBuffer()};this.createLineBuffers=
- function(e){e.__webGLVertexBuffer=b.createBuffer();e.__webGLColorBuffer=b.createBuffer()};this.createMeshBuffers=function(e){e.__webGLVertexBuffer=b.createBuffer();e.__webGLNormalBuffer=b.createBuffer();e.__webGLTangentBuffer=b.createBuffer();e.__webGLColorBuffer=b.createBuffer();e.__webGLUVBuffer=b.createBuffer();e.__webGLUV2Buffer=b.createBuffer();e.__webGLFaceBuffer=b.createBuffer();e.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(e){var p=e.vertices.length;e.__vertexArray=new Float32Array(p*
- 3);e.__colorArray=new Float32Array(p*3);e.__webGLLineCount=p};this.initParticleBuffers=function(e){var p=e.vertices.length;e.__vertexArray=new Float32Array(p*3);e.__colorArray=new Float32Array(p*3);e.__sortArray=[];e.__webGLParticleCount=p};this.initMeshBuffers=function(e,p){var h,g,k=0,m=0,t=0,l=p.geometry.faces,n=e.faces;h=0;for(g=n.length;h<g;h++){fi=n[h];face=l[fi];if(face instanceof THREE.Face3){k+=3;m+=1;t+=3}else if(face instanceof THREE.Face4){k+=4;m+=2;t+=4}}e.__vertexArray=new Float32Array(k*
- 3);e.__normalArray=new Float32Array(k*3);e.__tangentArray=new Float32Array(k*4);e.__colorArray=new Float32Array(k*3);e.__uvArray=new Float32Array(k*2);e.__uv2Array=new Float32Array(k*2);e.__faceArray=new Uint16Array(m*3);e.__lineArray=new Uint16Array(t*2);k=false;h=0;for(g=p.materials.length;h<g;h++){l=p.materials[h];if(l instanceof THREE.MeshFaceMaterial){l=0;for(n=e.materials.length;l<n;l++)if(e.materials[l]&&e.materials[l].shading!=undefined&&e.materials[l].shading==THREE.SmoothShading){k=true;
- break}}else if(l&&l.shading!=undefined&&l.shading==THREE.SmoothShading){k=true;break}if(k)break}e.__needsSmoothNormals=k;e.__webGLFaceCount=m*3;e.__webGLLineCount=t*2};this.setMeshBuffers=function(e,p,h){var g,k,m,t,l,n,r,v,A,D,K=0,L=0,N=0,U=0,W=0,M=0,E=0,P=0,O=0,B=e.__vertexArray,S=e.__uvArray,X=e.__uv2Array,ba=e.__normalArray,Z=e.__tangentArray,aa=e.__colorArray,ka=e.__faceArray,Y=e.__lineArray,ua=e.__needsSmoothNormals,fa=p.geometry,wa=fa.__dirtyVertices,ha=fa.__dirtyElements,la=fa.__dirtyUvs,
- va=fa.__dirtyNormals,oa=fa.__dirtyTangents,da=fa.__dirtyColors,ca=fa.vertices,Ca=e.faces,xa=fa.faces,Ga=fa.uvs,Ha=fa.uvs2,ma=fa.colors;p=0;for(g=Ca.length;p<g;p++){k=Ca[p];m=xa[k];n=Ga[k];k=Ha[k];t=m.vertexNormals;l=m.normal;if(m instanceof THREE.Face3){if(wa){r=ca[m.a].position;v=ca[m.b].position;A=ca[m.c].position;B[L]=r.x;B[L+1]=r.y;B[L+2]=r.z;B[L+3]=v.x;B[L+4]=v.y;B[L+5]=v.z;B[L+6]=A.x;B[L+7]=A.y;B[L+8]=A.z;L+=9}if(da&&ma.length){r=ma[m.a];v=ma[m.b];A=ma[m.c];aa[O]=r.r;aa[O+1]=r.g;aa[O+2]=r.b;
- aa[O+3]=v.r;aa[O+4]=v.g;aa[O+5]=v.b;aa[O+6]=A.r;aa[O+7]=A.g;aa[O+8]=A.b;O+=9}if(oa&&fa.hasTangents){r=ca[m.a].tangent;v=ca[m.b].tangent;A=ca[m.c].tangent;Z[E]=r.x;Z[E+1]=r.y;Z[E+2]=r.z;Z[E+3]=r.w;Z[E+4]=v.x;Z[E+5]=v.y;Z[E+6]=v.z;Z[E+7]=v.w;Z[E+8]=A.x;Z[E+9]=A.y;Z[E+10]=A.z;Z[E+11]=A.w;E+=12}if(va)if(t.length==3&&ua)for(m=0;m<3;m++){l=t[m];ba[M]=l.x;ba[M+1]=l.y;ba[M+2]=l.z;M+=3}else for(m=0;m<3;m++){ba[M]=l.x;ba[M+1]=l.y;ba[M+2]=l.z;M+=3}if(la&&n)for(m=0;m<3;m++){t=n[m];S[N]=t.u;S[N+1]=t.v;N+=2}if(la&&
- k)for(m=0;m<3;m++){n=k[m];X[U]=n.u;X[U+1]=n.v;U+=2}if(ha){ka[W]=K;ka[W+1]=K+1;ka[W+2]=K+2;W+=3;Y[P]=K;Y[P+1]=K+1;Y[P+2]=K;Y[P+3]=K+2;Y[P+4]=K+1;Y[P+5]=K+2;P+=6;K+=3}}else if(m instanceof THREE.Face4){if(wa){r=ca[m.a].position;v=ca[m.b].position;A=ca[m.c].position;D=ca[m.d].position;B[L]=r.x;B[L+1]=r.y;B[L+2]=r.z;B[L+3]=v.x;B[L+4]=v.y;B[L+5]=v.z;B[L+6]=A.x;B[L+7]=A.y;B[L+8]=A.z;B[L+9]=D.x;B[L+10]=D.y;B[L+11]=D.z;L+=12}if(da&&ma.length){r=ma[m.a];v=ma[m.b];A=ma[m.d];aa[O]=r.r;aa[O+1]=r.g;aa[O+2]=r.b;
- aa[O+3]=v.r;aa[O+4]=v.g;aa[O+5]=v.b;aa[O+6]=A.r;aa[O+7]=A.g;aa[O+8]=A.b;aa[O+9]=(void 0).r;aa[O+10]=(void 0).g;aa[O+11]=(void 0).b;O+=12}if(oa&&fa.hasTangents){r=ca[m.a].tangent;v=ca[m.b].tangent;A=ca[m.c].tangent;m=ca[m.d].tangent;Z[E]=r.x;Z[E+1]=r.y;Z[E+2]=r.z;Z[E+3]=r.w;Z[E+4]=v.x;Z[E+5]=v.y;Z[E+6]=v.z;Z[E+7]=v.w;Z[E+8]=A.x;Z[E+9]=A.y;Z[E+10]=A.z;Z[E+11]=A.w;Z[E+12]=m.x;Z[E+13]=m.y;Z[E+14]=m.z;Z[E+15]=m.w;E+=16}if(va)if(t.length==4&&ua)for(m=0;m<4;m++){l=t[m];ba[M]=l.x;ba[M+1]=l.y;ba[M+2]=l.z;
- M+=3}else for(m=0;m<4;m++){ba[M]=l.x;ba[M+1]=l.y;ba[M+2]=l.z;M+=3}if(la&&n)for(m=0;m<4;m++){t=n[m];S[N]=t.u;S[N+1]=t.v;N+=2}if(la&&k)for(m=0;m<4;m++){n=k[m];X[U]=n.u;X[U+1]=n.v;U+=2}if(ha){ka[W]=K;ka[W+1]=K+1;ka[W+2]=K+2;ka[W+3]=K;ka[W+4]=K+2;ka[W+5]=K+3;W+=6;Y[P]=K;Y[P+1]=K+1;Y[P+2]=K;Y[P+3]=K+3;Y[P+4]=K+1;Y[P+5]=K+2;Y[P+6]=K+2;Y[P+7]=K+3;P+=8;K+=4}}}if(wa){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,B,h)}if(da&&ma.length){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);
- b.bufferData(b.ARRAY_BUFFER,aa,h)}if(va){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,ba,h)}if(oa&&fa.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,Z,h)}if(la&&N>0){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,S,h)}if(la&&U>0){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,X,h)}if(ha){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,
- ka,h);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,e.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Y,h)}};this.setLineBuffers=function(e,p){var h,g,k,m=e.vertices,t=e.colors,l=m.length,n=t.length,r=e.__vertexArray,v=e.__colorArray,A=e.__dirtyColors;if(e.__dirtyVertices){for(h=0;h<l;h++){g=m[h].position;k=h*3;r[k]=g.x;r[k+1]=g.y;r[k+2]=g.z}b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,r,p)}if(A){for(h=0;h<n;h++){color=t[h];k=h*3;v[k]=color.r;v[k+1]=color.g;v[k+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,
- e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,v,p)}};this.setParticleBuffers=function(e,p,h){var g,k,m,t=e.vertices,l=t.length,n=e.colors,r=n.length,v=e.__vertexArray,A=e.__colorArray,D=e.__sortArray,K=e.__dirtyVertices,L=e.__dirtyColors;if(h.sortParticles){s.multiplySelf(h.matrix);for(g=0;g<l;g++){k=t[g].position;I.copy(k);s.multiplyVector3(I);D[g]=[I.z,g]}D.sort(function(N,U){return U[0]-N[0]});for(g=0;g<l;g++){k=t[D[g][1]].position;m=g*3;v[m]=k.x;v[m+1]=k.y;v[m+2]=k.z}for(g=0;g<r;g++){m=g*
- 3;color=n[D[g][1]];A[m]=color.r;A[m+1]=color.g;A[m+2]=color.b}}else{if(K)for(g=0;g<l;g++){k=t[g].position;m=g*3;v[m]=k.x;v[m+1]=k.y;v[m+2]=k.z}if(L)for(g=0;g<r;g++){color=n[g];m=g*3;A[m]=color.r;A[m+1]=color.g;A[m+2]=color.b}}if(K||h.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,v,p)}if(L||h.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,e.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,A,p)}};this.initMaterial=function(e,p,h){var g,k;if(e instanceof THREE.MeshDepthMaterial)c(e,
- THREE.ShaderLib.depth);else if(e instanceof THREE.MeshNormalMaterial)c(e,THREE.ShaderLib.normal);else if(e instanceof THREE.MeshBasicMaterial)c(e,THREE.ShaderLib.basic);else if(e instanceof THREE.MeshLambertMaterial)c(e,THREE.ShaderLib.lambert);else if(e instanceof THREE.MeshPhongMaterial)c(e,THREE.ShaderLib.phong);else if(e instanceof THREE.LineBasicMaterial)c(e,THREE.ShaderLib.basic);else e instanceof THREE.ParticleBasicMaterial&&c(e,THREE.ShaderLib.particle_basic);var m,t,l,n;k=l=n=0;for(m=p.length;k<
- m;k++){t=p[k];t instanceof THREE.DirectionalLight&&l++;t instanceof THREE.PointLight&&n++}if(n+l<=4){p=l;n=n}else{p=Math.ceil(4*l/(n+l));n=4-p}k={directional:p,point:n};n=e.fragment_shader;p=e.vertex_shader;m={fog:h,map:e.map,env_map:e.env_map,light_map:e.light_map,vertex_colors:e.vertex_colors,maxDirLights:k.directional,maxPointLights:k.point};h=b.createProgram();k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+m.maxDirLights,"#define MAX_POINT_LIGHTS "+m.maxPointLights,
- m.fog?"#define USE_FOG":"",m.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",m.map?"#define USE_MAP":"",m.env_map?"#define USE_ENVMAP":"",m.light_map?"#define USE_LIGHTMAP":"",m.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");m=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+m.maxDirLights,"#define MAX_POINT_LIGHTS "+m.maxPointLights,m.map?"#define USE_MAP":"",m.env_map?"#define USE_ENVMAP":
- "",m.light_map?"#define USE_LIGHTMAP":"",m.vertex_colors?"#define USE_COLOR":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");b.attachShader(h,i("fragment",k+n));b.attachShader(h,i("vertex",m+p));b.linkProgram(h);b.getProgramParameter(h,b.LINK_STATUS)||
- alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(h,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");h.uniforms={};h.attributes={};e.program=h;h=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(g in e.uniforms)h.push(g);g=e.program;n=0;for(p=h.length;n<p;n++){k=h[n];g.uniforms[k]=b.getUniformLocation(g,k)}e=e.program;g=["position","normal","uv","uv2","tangent","color"];h=0;for(n=g.length;h<n;h++){p=g[h];e.attributes[p]=
- b.getAttribLocation(e,p)}};this.setProgram=function(e,p,h,g,k){g.program||this.initMaterial(g,p,h);var m=g.program,t=m.uniforms,l=g.uniforms;if(m!=o){b.useProgram(m);o=m;b.uniformMatrix4fv(t.projectionMatrix,false,G)}if(h&&(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial||g instanceof THREE.LineBasicMaterial||g instanceof THREE.ParticleBasicMaterial)){l.fogColor.value.setHex(h.color.hex);if(h instanceof THREE.Fog){l.fogNear.value=
- h.near;l.fogFar.value=h.far}else if(h instanceof THREE.FogExp2)l.fogDensity.value=h.density}if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial){this.setupLights(m,p);p=this.lights;l.enableLighting.value=p.directional.length+p.point.length;l.ambientLightColor.value=p.ambient;l.directionalLightColor.value=p.directional.colors;l.directionalLightDirection.value=p.directional.positions;l.pointLightColor.value=p.point.colors;l.pointLightPosition.value=p.point.positions}if(g instanceof
- THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial){l.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);l.opacity.value=g.opacity;l.map.texture=g.map;l.light_map.texture=g.light_map;l.env_map.texture=g.env_map;l.reflectivity.value=g.reflectivity;l.refraction_ratio.value=g.refraction_ratio;l.combine.value=g.combine;l.useRefract.value=g.env_map&&g.env_map.mapping instanceof THREE.CubeRefractionMapping}if(g instanceof
- THREE.LineBasicMaterial){l.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);l.opacity.value=g.opacity}else if(g instanceof THREE.ParticleBasicMaterial){l.psColor.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);l.opacity.value=g.opacity;l.size.value=g.size;l.map.texture=g.map}else if(g instanceof THREE.MeshPhongMaterial){l.ambient.value.setRGB(g.ambient.r,g.ambient.g,g.ambient.b);l.specular.value.setRGB(g.specular.r,g.specular.g,g.specular.b);
- l.shininess.value=g.shininess}else if(g instanceof THREE.MeshDepthMaterial){l.mNear.value=e.near;l.mFar.value=e.far;l.opacity.value=g.opacity}else if(g instanceof THREE.MeshNormalMaterial)l.opacity.value=g.opacity;var n,r,v;for(n in l)if(v=m.uniforms[n]){h=l[n];r=h.type;p=h.value;if(r=="i")b.uniform1i(v,p);else if(r=="f")b.uniform1f(v,p);else if(r=="fv1")b.uniform1fv(v,p);else if(r=="fv")b.uniform3fv(v,p);else if(r=="v2")b.uniform2f(v,p.x,p.y);else if(r=="v3")b.uniform3f(v,p.x,p.y,p.z);else if(r==
- "c")b.uniform3f(v,p.r,p.g,p.b);else if(r=="t"){b.uniform1i(v,p);if(h=h.texture)if(h.image instanceof Array&&h.image.length==6){h=h;p=p;if(h.image.length==6){if(!h.image.__webGLTextureCube&&!h.image.__cubeMapInitialized&&h.image.loadCount==6){h.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,h.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(r=0;r<6;++r)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,h.image[r]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);h.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+p);b.bindTexture(b.TEXTURE_CUBE_MAP,h.image.__webGLTextureCube)}}else{h=h;p=p;if(!h.__webGLTexture&&h.image.loaded){h.__webGLTexture=b.createTexture();
- b.bindTexture(b.TEXTURE_2D,h.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,h.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,j(h.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,j(h.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,j(h.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,j(h.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+p);b.bindTexture(b.TEXTURE_2D,h.__webGLTexture)}}}b.uniformMatrix4fv(t.modelViewMatrix,
- false,k._modelViewMatrixArray);b.uniformMatrix3fv(t.normalMatrix,false,k._normalMatrixArray);if(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.env_map)b.uniform3f(t.cameraPosition,e.position.x,e.position.y,e.position.z);if(g instanceof THREE.MeshShaderMaterial||g.env_map)b.uniformMatrix4fv(t.objectMatrix,false,k._objectMatrixArray);if(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial)b.uniformMatrix4fv(t.viewMatrix,
- false,J);return m};this.renderBuffer=function(e,p,h,g,k,m){e=this.setProgram(e,p,h,g,m).attributes;b.bindBuffer(b.ARRAY_BUFFER,k.__webGLVertexBuffer);b.vertexAttribPointer(e.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.position);if(e.color>=0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLColorBuffer);b.vertexAttribPointer(e.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.color)}if(e.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLNormalBuffer);b.vertexAttribPointer(e.normal,3,b.FLOAT,
- false,0,0);b.enableVertexAttribArray(e.normal)}if(e.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLTangentBuffer);b.vertexAttribPointer(e.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.tangent)}if(e.uv>=0)if(k.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUVBuffer);b.vertexAttribPointer(e.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.uv)}else b.disableVertexAttribArray(e.uv);if(e.uv2>=0)if(k.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,k.__webGLUV2Buffer);b.vertexAttribPointer(e.uv2,
- 2,b.FLOAT,false,0,0);b.enableVertexAttribArray(e.uv2)}else b.disableVertexAttribArray(e.uv2);if(m instanceof THREE.Mesh)if(g.wireframe){b.lineWidth(g.wireframe_linewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLLineBuffer);b.drawElements(b.LINES,k.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,k.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,k.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(m instanceof THREE.Line){m=m.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(g.linewidth);
- b.drawArrays(m,0,k.__webGLLineCount)}else m instanceof THREE.ParticleSystem&&b.drawArrays(b.POINTS,0,k.__webGLParticleCount)};this.renderPass=function(e,p,h,g,k,m,t){var l,n,r,v,A;r=0;for(v=g.materials.length;r<v;r++){l=g.materials[r];if(l instanceof THREE.MeshFaceMaterial){l=0;for(n=k.materials.length;l<n;l++)if((A=k.materials[l])&&A.blending==m&&A.opacity<1==t){f(A.blending);this.setDepthTest(A.depth_test);this.renderBuffer(e,p,h,A,k,g)}}else if((A=l)&&A.blending==m&&A.opacity<1==t){f(A.blending);
- this.setDepthTest(A.depth_test);this.renderBuffer(e,p,h,A,k,g)}}};this.renderPassImmediate=function(e,p,h,g,k,m){var t,l,n,r;t=0;for(l=g.materials.length;t<l;t++)if((n=g.materials[t])&&n.blending==k&&n.opacity<1==m){f(n.blending);this.setDepthTest(n.depth_test);r=this.setProgram(e,p,h,n,g);g.render(function(v){var A=r;if(!v.__webGLVertexBuffer)v.__webGLVertexBuffer=b.createBuffer();if(!v.__webGLNormalBuffer)v.__webGLNormalBuffer=b.createBuffer();if(v.hasPos){b.bindBuffer(b.ARRAY_BUFFER,v.__webGLVertexBuffer);
- b.bufferData(b.ARRAY_BUFFER,v.positionArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(A.attributes.position);b.vertexAttribPointer(A.attributes.position,3,b.FLOAT,false,0,0)}if(v.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,v.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,v.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(A.attributes.normal);b.vertexAttribPointer(A.attributes.normal,3,b.FLOAT,false,0,0)}b.drawArrays(b.TRIANGLES,0,v.count);v.count=0})}};this.render=function(e,p,h,g){var k,m,t,l,
- n=e.lights,r=e.fog;p.autoUpdateMatrix&&p.updateMatrix();p.matrix.flattenToArray(J);p.projectionMatrix.flattenToArray(G);s.multiply(p.projectionMatrix,p.matrix);x[0].set(s.n41-s.n11,s.n42-s.n12,s.n43-s.n13,s.n44-s.n14);x[1].set(s.n41+s.n11,s.n42+s.n12,s.n43+s.n13,s.n44+s.n14);x[2].set(s.n41+s.n21,s.n42+s.n22,s.n43+s.n23,s.n44+s.n24);x[3].set(s.n41-s.n21,s.n42-s.n22,s.n43-s.n23,s.n44-s.n24);x[4].set(s.n41-s.n31,s.n42-s.n32,s.n43-s.n33,s.n44-s.n34);x[5].set(s.n41+s.n31,s.n42+s.n32,s.n43+s.n33,s.n44+
- s.n34);for(k=0;k<5;k++){l=x[k];l.divideScalar(Math.sqrt(l.x*l.x+l.y*l.y+l.z*l.z))}this.initWebGLObjects(e,p);g=g!==undefined?g:true;if(h&&!h.__webGLFramebuffer){h.__webGLFramebuffer=b.createFramebuffer();h.__webGLRenderbuffer=b.createRenderbuffer();h.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,h.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,h.width,h.height);b.bindTexture(b.TEXTURE_2D,h.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,
- j(h.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,j(h.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,j(h.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,j(h.min_filter));b.texImage2D(b.TEXTURE_2D,0,j(h.format),h.width,h.height,0,j(h.format),j(h.type),null);b.bindFramebuffer(b.FRAMEBUFFER,h.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,h.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,
- h.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(h){k=h.__webGLFramebuffer;l=h.width;t=h.height}else{k=null;l=u.width;t=u.height}if(k!=q){b.bindFramebuffer(b.FRAMEBUFFER,k);b.viewport(0,0,l,t);g&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);q=k}this.autoClear&&this.clear();k=e.__webGLObjects.length;for(g=0;g<k;g++){t=e.__webGLObjects[g];l=t.object;if(m=l.visible){if(!(m=!(l instanceof THREE.Mesh)))a:{m=void 0;
- for(var v=l.matrix,A=-l.geometry.boundingSphere.radius*Math.max(l.scale.x,Math.max(l.scale.y,l.scale.z)),D=0;D<6;D++){m=x[D].x*v.n14+x[D].y*v.n24+x[D].z*v.n34+x[D].w;if(m<=A){m=false;break a}}m=true}m=m}if(m){if(l.autoUpdateMatrix){l.updateMatrix();l.matrix.flattenToArray(l._objectMatrixArray)}this.setupMatrices(l,p);t.render=true}else t.render=false}m=e.__webGLObjectsImmediate.length;for(g=0;g<m;g++){l=e.__webGLObjectsImmediate[g].object;if(l.visible){if(l.autoUpdateMatrix){l.updateMatrix();l.matrix.flattenToArray(l._objectMatrixArray)}this.setupMatrices(l,
- p)}}for(g=0;g<k;g++){t=e.__webGLObjects[g];if(t.render){l=t.object;t=t.buffer;d(l);this.renderPass(p,n,r,l,t,THREE.NormalBlending,false)}}for(g=0;g<m;g++){l=e.__webGLObjectsImmediate[g].object;if(l.visible){d(l);this.renderPassImmediate(p,n,r,l,THREE.NormalBlending,false)}}for(g=0;g<k;g++){t=e.__webGLObjects[g];if(t.render){l=t.object;t=t.buffer;d(l);this.renderPass(p,n,r,l,t,THREE.AdditiveBlending,false);this.renderPass(p,n,r,l,t,THREE.SubtractiveBlending,false);this.renderPass(p,n,r,l,t,THREE.AdditiveBlending,
- true);this.renderPass(p,n,r,l,t,THREE.SubtractiveBlending,true);this.renderPass(p,n,r,l,t,THREE.NormalBlending,true);this.renderPass(p,n,r,l,t,THREE.BillboardBlending,false)}}for(g=0;g<m;g++){l=e.__webGLObjectsImmediate[g].object;if(l.visible){d(l);this.renderPassImmediate(p,n,r,l,THREE.NormalBlending,true)}}if(h&&h.min_filter!==THREE.NearestFilter&&h.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,h.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=
- function(e,p){function h(A,D,K,L){if(A[D]==undefined){e.__webGLObjects.push({buffer:K,object:L});A[D]=1}}function g(A,D,K){if(A[D]==undefined){e.__webGLObjectsImmediate.push({object:K});A[D]=1}}var k,m,t,l,n,r,v;if(!e.__webGLObjects){e.__webGLObjects=[];e.__webGLObjectsMap={};e.__webGLObjectsImmediate=[]}k=0;for(m=e.objects.length;k<m;k++){t=e.objects[k];n=t.geometry;if(e.__webGLObjectsMap[t.id]==undefined){e.__webGLObjectsMap[t.id]={};t._modelViewMatrix=new THREE.Matrix4;t._normalMatrixArray=new Float32Array(9);
- t._modelViewMatrixArray=new Float32Array(16);t._objectMatrixArray=new Float32Array(16);t.matrix.flattenToArray(t._objectMatrixArray)}v=e.__webGLObjectsMap[t.id];if(t instanceof THREE.Mesh){for(l in n.geometryChunks){r=n.geometryChunks[l];if(!r.__webGLVertexBuffer){this.createMeshBuffers(r);this.initMeshBuffers(r,t);n.__dirtyVertices=true;n.__dirtyElements=true;n.__dirtyUvs=true;n.__dirtyNormals=true;n.__dirtyTangents=true;n.__dirtyColors=true}if(n.__dirtyVertices||n.__dirtyElements||n.__dirtyUvs||
- n.__dirtyNormals||n.__dirtyColors||n.__dirtyTangents)this.setMeshBuffers(r,t,b.DYNAMIC_DRAW);h(v,l,r,t)}n.__dirtyVertices=false;n.__dirtyElements=false;n.__dirtyUvs=false;n.__dirtyNormals=false;n.__dirtyTangents=false;n.__dirtyColors=false}else if(t instanceof THREE.Line){if(!n.__webGLVertexBuffer){this.createLineBuffers(n);this.initLineBuffers(n);n.__dirtyVertices=true;n.__dirtyColors=true}if(n.__dirtyVertices||n.__dirtyColors)this.setLineBuffers(n,b.DYNAMIC_DRAW);h(v,0,n,t);n.__dirtyVertices=false;
- n.__dirtyColors=false}else if(t instanceof THREE.ParticleSystem){if(!n.__webGLVertexBuffer){this.createParticleBuffers(n);this.initParticleBuffers(n);n.__dirtyVertices=true;n.__dirtyColors=true}if(n.__dirtyVertices||n.__dirtyColors||t.sortParticles)this.setParticleBuffers(n,b.DYNAMIC_DRAW,t,p);h(v,0,n,t);n.__dirtyVertices=false;n.__dirtyColors=false}else t instanceof THREE.MarchingCubes&&g(v,0,t)}};this.removeObject=function(e,p){var h,g;for(h=e.__webGLObjects.length-1;h>=0;h--){g=e.__webGLObjects[h].object;
- p==g&&e.__webGLObjects.splice(h,1)}};this.setupMatrices=function(e,p){e._modelViewMatrix.multiplyToArray(p.matrix,e.matrix,e._modelViewMatrixArray);e._normalMatrix=THREE.Matrix4.makeInvert3x3(e._modelViewMatrix).transposeIntoArray(e._normalMatrixArray)};this.setDepthTest=function(e){e?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)};this.setFaceCulling=function(e,p){if(e){!p||p=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(e=="back")b.cullFace(b.BACK);else e=="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, gl_FragColor.w ), 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\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\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\ngl_FragColor = gl_FragColor * 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\ngl_FragColor = gl_FragColor * 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\ngl_FragColor = gl_FragColor * 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 mColor = vec4( diffuse, opacity );\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\ngl_FragColor = gl_FragColor * totalLight;",
- color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif"};
- THREE.UniformsLib={common:{diffuse:{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:{psColor:{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},opacity:{type:"f",value:1}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
- value:1}},fragment_shader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\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 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,
- THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,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,THREE.Snippets.color_pars_vertex,
- "void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,
- THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,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,THREE.Snippets.color_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_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 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,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() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,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,THREE.Snippets.color_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_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 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",THREE.Snippets.color_pars_vertex,
- "void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};THREE.RenderableObject=function(){this.z=this.object=null};
- THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,null]};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};
- THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|