|
@@ -1,204 +1,204 @@
|
|
|
-// 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,d,e){this.r=a;this.g=d;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+
|
|
|
-","+~~(this.g*255)+","+~~(this.b*255)+")"},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,d){this.x=a||0;this.y=d||0};
|
|
|
-THREE.Vector2.prototype={set:function(a,d){this.x=a;this.y=d;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,d){this.x=a.x+d.x;this.y=a.y+d.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,d){this.x=a.x-d.x;this.y=a.y-d.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,d,e){this.x=a||0;this.y=d||0;this.z=e||0};
|
|
|
-THREE.Vector3.prototype={set:function(a,d,e){this.x=a;this.y=d;this.z=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,d){this.x=a.x+d.x;this.y=a.y+d.y;this.z=a.z+d.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,d){this.x=a.x-d.x;this.y=a.y-d.y;this.z=a.z-d.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
|
|
|
-cross:function(a,d){this.x=a.y*d.z-a.z*d.y;this.y=a.z*d.x-a.x*d.z;this.z=a.x*d.y-a.y*d.x;return this},crossSelf:function(a){var d=this.x,e=this.y,f=this.z;this.x=e*a.z-f*a.y;this.y=f*a.x-d*a.z;this.z=d*a.y-e*a.x;return this},multiply:function(a,d){this.x=a.x*d.x;this.y=a.y*d.y;this.z=a.z*d.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 d=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(d*d+e*e+a*a)},distanceToSquared:function(a){var d=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return d*d+e*e+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=
|
|
|
--this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
|
|
|
-THREE.Vector4=function(a,d,e,f){this.x=a||0;this.y=d||0;this.z=e||0;this.w=f||1};
|
|
|
-THREE.Vector4.prototype={set:function(a,d,e,f){this.x=a;this.y=d;this.z=e;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,d){this.x=a.x+d.x;this.y=a.y+d.y;this.z=a.z+d.z;this.w=a.w+d.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,d){this.x=a.x-d.x;this.y=a.y-d.y;this.z=a.z-d.z;this.w=a.w-d.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,d){this.x+=(a.x-this.x)*d;this.y+=(a.y-this.y)*d;this.z+=(a.z-this.z)*d;this.w+=(a.w-this.w)*d},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,d){this.origin=a||new THREE.Vector3;this.direction=d||new THREE.Vector3};
|
|
|
-THREE.Ray.prototype={intersectScene:function(a){var d,e,f=a.objects,h=[];a=0;for(d=f.length;a<d;a++){e=f[a];if(e instanceof THREE.Mesh)h=h.concat(this.intersectObject(e))}h.sort(function(i,p){return i.distance-p.distance});return h},intersectObject:function(a){function d(Q,q,aa,L){L=L.clone().subSelf(q);aa=aa.clone().subSelf(q);var g=Q.clone().subSelf(q);Q=L.dot(L);q=L.dot(aa);L=L.dot(g);var l=aa.dot(aa);aa=aa.dot(g);g=1/(Q*l-q*q);l=(l*L-q*aa)*g;Q=(Q*aa-q*L)*g;return l>0&&Q>0&&l+Q<1}var e,f,h,i,p,
|
|
|
-b,k,j,C,F,A,E=a.geometry,N=E.vertices,P=[];e=0;for(f=E.faces.length;e<f;e++){h=E.faces[e];F=this.origin.clone();A=this.direction.clone();i=a.matrix.multiplyVector3(N[h.a].position.clone());p=a.matrix.multiplyVector3(N[h.b].position.clone());b=a.matrix.multiplyVector3(N[h.c].position.clone());k=h instanceof THREE.Face4?a.matrix.multiplyVector3(N[h.d].position.clone()):null;j=a.rotationMatrix.multiplyVector3(h.normal.clone());C=A.dot(j);if(C<0){j=j.dot((new THREE.Vector3).sub(i,F))/C;F=F.addSelf(A.multiplyScalar(j));
|
|
|
-if(h instanceof THREE.Face3){if(d(F,i,p,b)){h={distance:this.origin.distanceTo(F),point:F,face:h,object:a};P.push(h)}}else if(h instanceof THREE.Face4)if(d(F,i,p,k)||d(F,p,b,k)){h={distance:this.origin.distanceTo(F),point:F,face:h,object:a};P.push(h)}}}return P}};
|
|
|
-THREE.Rectangle=function(){function a(){i=f-d;p=h-e}var d,e,f,h,i,p,b=true;this.getX=function(){return d};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return p};this.getLeft=function(){return d};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,j,C,F){b=false;d=k;e=j;f=C;h=F;a()};this.addPoint=function(k,j){if(b){b=false;d=k;e=j;f=k;h=j}else{d=d<k?d:k;e=e<j?e:j;f=f>k?f:k;h=h>j?
|
|
|
-h:j}a()};this.add3Points=function(k,j,C,F,A,E){if(b){b=false;d=k<C?k<A?k:A:C<A?C:A;e=j<F?j<E?j:E:F<E?F:E;f=k>C?k>A?k:A:C>A?C:A;h=j>F?j>E?j:E:F>E?F:E}else{d=k<C?k<A?k<d?k:d:A<d?A:d:C<A?C<d?C:d:A<d?A:d;e=j<F?j<E?j<e?j:e:E<e?E:e:F<E?F<e?F:e:E<e?E:e;f=k>C?k>A?k>f?k:f:A>f?A:f:C>A?C>f?C:f:A>f?A:f;h=j>F?j>E?j>h?j:h:E>h?E:h:F>E?F>h?F:h:E>h?E:h}a()};this.addRectangle=function(k){if(b){b=false;d=k.getLeft();e=k.getTop();f=k.getRight();h=k.getBottom()}else{d=d<k.getLeft()?d:k.getLeft();e=e<k.getTop()?e:k.getTop();
|
|
|
-f=f>k.getRight()?f:k.getRight();h=h>k.getBottom()?h:k.getBottom()}a()};this.inflate=function(k){d-=k;e-=k;f+=k;h+=k;a()};this.minSelf=function(k){d=d>k.getLeft()?d:k.getLeft();e=e>k.getTop()?e:k.getTop();f=f<k.getRight()?f:k.getRight();h=h<k.getBottom()?h:k.getBottom();a()};this.instersects=function(k){return Math.min(f,k.getRight())-Math.max(d,k.getLeft())>=0&&Math.min(h,k.getBottom())-Math.max(e,k.getTop())>=0};this.empty=function(){b=true;h=f=e=d=0;a()};this.isEmpty=function(){return b};this.toString=
|
|
|
-function(){return"THREE.Rectangle ( left: "+d+", right: "+f+", top: "+e+", bottom: "+h+", width: "+i+", height: "+p+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
|
|
|
-THREE.Matrix4=function(a,d,e,f,h,i,p,b,k,j,C,F,A,E,N,P){this.n11=a||1;this.n12=d||0;this.n13=e||0;this.n14=f||0;this.n21=h||0;this.n22=i||1;this.n23=p||0;this.n24=b||0;this.n31=k||0;this.n32=j||0;this.n33=C||1;this.n34=F||0;this.n41=A||0;this.n42=E||0;this.n43=N||0;this.n44=P||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,d,e,f,h,i,p,b,k,j,C,F,A,E,N,P){this.n11=a;this.n12=d;this.n13=e;this.n14=f;this.n21=h;this.n22=i;this.n23=p;this.n24=b;this.n31=k;this.n32=j;this.n33=C;this.n34=F;this.n41=A;this.n42=E;this.n43=N;this.n44=P;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,d,e){var f=THREE.Matrix4.__tmpVec1,h=THREE.Matrix4.__tmpVec2,i=THREE.Matrix4.__tmpVec3;i.sub(a,d).normalize();f.cross(e,i).normalize();h.cross(i,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=h.x;this.n22=h.y;this.n23=h.z;this.n24=-h.dot(a);
|
|
|
-this.n31=i.x;this.n32=i.y;this.n33=i.z;this.n34=-i.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var d=a.x,e=a.y,f=a.z,h=1/(this.n41*d+this.n42*e+this.n43*f+this.n44);a.x=(this.n11*d+this.n12*e+this.n13*f+this.n14)*h;a.y=(this.n21*d+this.n22*e+this.n23*f+this.n24)*h;a.z=(this.n31*d+this.n32*e+this.n33*f+this.n34)*h;return a},multiplyVector4:function(a){var d=a.x,e=a.y,f=a.z,h=a.w;a.x=this.n11*d+this.n12*e+this.n13*f+this.n14*h;a.y=this.n21*d+this.n22*e+this.n23*
|
|
|
-f+this.n24*h;a.z=this.n31*d+this.n32*e+this.n33*f+this.n34*h;a.w=this.n41*d+this.n42*e+this.n43*f+this.n44*h;return a},crossVector:function(a){var d=new THREE.Vector4;d.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;d.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;d.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;d.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return d},multiply:function(a,d){var e=a.n11,f=a.n12,h=a.n13,i=a.n14,p=a.n21,b=a.n22,k=a.n23,j=a.n24,C=a.n31,
|
|
|
-F=a.n32,A=a.n33,E=a.n34,N=a.n41,P=a.n42,Q=a.n43,q=a.n44,aa=d.n11,L=d.n12,g=d.n13,l=d.n14,r=d.n21,m=d.n22,u=d.n23,I=d.n24,n=d.n31,w=d.n32,B=d.n33,v=d.n34,o=d.n41,K=d.n42,H=d.n43,U=d.n44;this.n11=e*aa+f*r+h*n+i*o;this.n12=e*L+f*m+h*w+i*K;this.n13=e*g+f*u+h*B+i*H;this.n14=e*l+f*I+h*v+i*U;this.n21=p*aa+b*r+k*n+j*o;this.n22=p*L+b*m+k*w+j*K;this.n23=p*g+b*u+k*B+j*H;this.n24=p*l+b*I+k*v+j*U;this.n31=C*aa+F*r+A*n+E*o;this.n32=C*L+F*m+A*w+E*K;this.n33=C*g+F*u+A*B+E*H;this.n34=C*l+F*I+A*v+E*U;this.n41=N*aa+
|
|
|
-P*r+Q*n+q*o;this.n42=N*L+P*m+Q*w+q*K;this.n43=N*g+P*u+Q*B+q*H;this.n44=N*l+P*I+Q*v+q*U;return this},multiplySelf:function(a){var d=this.n11,e=this.n12,f=this.n13,h=this.n14,i=this.n21,p=this.n22,b=this.n23,k=this.n24,j=this.n31,C=this.n32,F=this.n33,A=this.n34,E=this.n41,N=this.n42,P=this.n43,Q=this.n44,q=a.n11,aa=a.n21,L=a.n31,g=a.n41,l=a.n12,r=a.n22,m=a.n32,u=a.n42,I=a.n13,n=a.n23,w=a.n33,B=a.n43,v=a.n14,o=a.n24,K=a.n34;a=a.n44;this.n11=d*q+e*aa+f*L+h*g;this.n12=d*l+e*r+f*m+h*u;this.n13=d*I+e*n+
|
|
|
-f*w+h*B;this.n14=d*v+e*o+f*K+h*a;this.n21=i*q+p*aa+b*L+k*g;this.n22=i*l+p*r+b*m+k*u;this.n23=i*I+p*n+b*w+k*B;this.n24=i*v+p*o+b*K+k*a;this.n31=j*q+C*aa+F*L+A*g;this.n32=j*l+C*r+F*m+A*u;this.n33=j*I+C*n+F*w+A*B;this.n34=j*v+C*o+F*K+A*a;this.n41=E*q+N*aa+P*L+Q*g;this.n42=E*l+N*r+P*m+Q*u;this.n43=E*I+N*n+P*w+Q*B;this.n44=E*v+N*o+P*K+Q*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,d=this.n12,e=this.n13,f=this.n14,h=this.n21,i=this.n22,p=this.n23,b=this.n24,k=this.n31,j=this.n32,C=this.n33,F=this.n34,A=this.n41,E=this.n42,N=this.n43,P=this.n44;return f*p*j*A-e*b*j*A-f*i*C*A+d*b*C*A+e*i*F*A-d*p*F*A-f*p*k*E+e*b*k*E+f*h*C*E-a*b*C*E-e*h*F*E+a*p*F*E+f*i*k*N-d*b*k*N-f*h*j*N+a*b*j*N+d*h*F*N-a*i*F*N-e*i*k*P+d*p*k*P+e*h*j*P-a*p*j*P-d*h*C*P+a*i*C*P},transpose:function(){function a(d,
|
|
|
-e,f){var h=d[e];d[e]=d[f];d[f]=h}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(){this.flat[0]=this.n11;this.flat[1]=
|
|
|
-this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},setTranslation:function(a,d,e){this.set(1,0,0,a,0,1,0,d,0,0,1,e,0,0,0,1);return this},setScale:function(a,d,e){this.set(a,0,0,0,0,d,0,0,0,0,e,0,0,0,0,1);return this},
|
|
|
-setRotX:function(a){var d=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,d,-a,0,0,a,d,0,0,0,0,1);return this},setRotY:function(a){var d=Math.cos(a);a=Math.sin(a);this.set(d,0,a,0,0,1,0,0,-a,0,d,0,0,0,0,1);return this},setRotZ:function(a){var d=Math.cos(a);a=Math.sin(a);this.set(d,-a,0,0,a,d,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,d){c=Math.cos(d);s=Math.sin(d);t=1-c;x=a.x;y=a.y;z=a.z;tx=t*x;ty=t*y;this.set(tx*x+c,tx*y-s*z,tx*z+s*y,0,tx*y+s*z,ty*y+c,ty*z-s*x,0,tx*z-s*y,ty*z+s*x,t*z*z+
|
|
|
-c,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,d,e){var f=new THREE.Matrix4;f.n14=a;f.n24=d;f.n34=e;return f};THREE.Matrix4.scaleMatrix=function(a,d,e){var f=new THREE.Matrix4;f.n11=a;f.n22=d;f.n33=e;return f};
|
|
|
-THREE.Matrix4.rotationXMatrix=function(a){var d=new THREE.Matrix4;d.n22=d.n33=Math.cos(a);d.n32=Math.sin(a);d.n23=-d.n32;return d};THREE.Matrix4.rotationYMatrix=function(a){var d=new THREE.Matrix4;d.n11=d.n33=Math.cos(a);d.n13=Math.sin(a);d.n31=-d.n13;return d};THREE.Matrix4.rotationZMatrix=function(a){var d=new THREE.Matrix4;d.n11=d.n22=Math.cos(a);d.n21=Math.sin(a);d.n12=-d.n21;return d};
|
|
|
-THREE.Matrix4.rotationAxisAngleMatrix=function(a,d){var e=new THREE.Matrix4,f=Math.cos(d),h=Math.sin(d),i=1-f,p=a.x,b=a.y,k=a.z,j=i*p,C=i*b;e.n11=j*p+f;e.n12=j*b-h*k;e.n13=j*k+h*b;e.n21=j*b+h*k;e.n22=C*b+f;e.n23=C*k-h*p;e.n31=j*k-h*b;e.n32=C*k+h*p;e.n33=i*k*k+f;return e};
|
|
|
-THREE.Matrix4.makeInvert=function(a){var d=a.n11,e=a.n12,f=a.n13,h=a.n14,i=a.n21,p=a.n22,b=a.n23,k=a.n24,j=a.n31,C=a.n32,F=a.n33,A=a.n34,E=a.n41,N=a.n42,P=a.n43,Q=a.n44,q=new THREE.Matrix4;q.n11=b*A*N-k*F*N+k*C*P-p*A*P-b*C*Q+p*F*Q;q.n12=h*F*N-f*A*N-h*C*P+e*A*P+f*C*Q-e*F*Q;q.n13=f*k*N-h*b*N+h*p*P-e*k*P-f*p*Q+e*b*Q;q.n14=h*b*C-f*k*C-h*p*F+e*k*F+f*p*A-e*b*A;q.n21=k*F*E-b*A*E-k*j*P+i*A*P+b*j*Q-i*F*Q;q.n22=f*A*E-h*F*E+h*j*P-d*A*P-f*j*Q+d*F*Q;q.n23=h*b*E-f*k*E-h*i*P+d*k*P+f*i*Q-d*b*Q;q.n24=f*k*j-h*b*j+
|
|
|
-h*i*F-d*k*F-f*i*A+d*b*A;q.n31=p*A*E-k*C*E+k*j*N-i*A*N-p*j*Q+i*C*Q;q.n32=h*C*E-e*A*E-h*j*N+d*A*N+e*j*Q-d*C*Q;q.n33=f*k*E-h*p*E+h*i*N-d*k*N-e*i*Q+d*p*Q;q.n34=h*p*j-e*k*j-h*i*C+d*k*C+e*i*A-d*p*A;q.n41=b*C*E-p*F*E-b*j*N+i*F*N+p*j*P-i*C*P;q.n42=e*F*E-f*C*E+f*j*N-d*F*N-e*j*P+d*C*P;q.n43=f*p*E-e*b*E-f*i*N+d*b*N+e*i*P-d*p*P;q.n44=e*b*j-f*p*j+f*i*C-d*b*C-e*i*F+d*p*F;q.multiplyScalar(1/a.determinant());return q};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var d=a.flatten();a=a.m33;var e=d[10]*d[5]-d[6]*d[9],f=-d[10]*d[1]+d[2]*d[9],h=d[6]*d[1]-d[2]*d[5],i=-d[10]*d[4]+d[6]*d[8],p=d[10]*d[0]-d[2]*d[8],b=-d[6]*d[0]+d[2]*d[4],k=d[9]*d[4]-d[5]*d[8],j=-d[9]*d[0]+d[1]*d[8],C=d[5]*d[0]-d[1]*d[4];d=d[0]*e+d[1]*i+d[2]*k;if(d==0)throw"matrix not invertible";d=1/d;a.m[0]=d*e;a.m[1]=d*f;a.m[2]=d*h;a.m[3]=d*i;a.m[4]=d*p;a.m[5]=d*b;a.m[6]=d*k;a.m[7]=d*j;a.m[8]=d*C;return a};
|
|
|
-THREE.Matrix4.makeFrustum=function(a,d,e,f,h,i){var p,b,k;p=new THREE.Matrix4;b=2*h/(d-a);k=2*h/(f-e);a=(d+a)/(d-a);e=(f+e)/(f-e);f=-(i+h)/(i-h);h=-2*i*h/(i-h);p.n11=b;p.n12=0;p.n13=a;p.n14=0;p.n21=0;p.n22=k;p.n23=e;p.n24=0;p.n31=0;p.n32=0;p.n33=f;p.n34=h;p.n41=0;p.n42=0;p.n43=-1;p.n44=0;return p};THREE.Matrix4.makePerspective=function(a,d,e,f){var h;a=e*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*d,a*d,h,a,e,f)};
|
|
|
-THREE.Matrix4.makeOrtho=function(a,d,e,f,h,i){var p,b,k,j;p=new THREE.Matrix4;b=d-a;k=e-f;j=i-h;a=(d+a)/b;e=(e+f)/k;h=(i+h)/j;p.n11=2/b;p.n12=0;p.n13=0;p.n14=-a;p.n21=0;p.n22=2/k;p.n23=0;p.n24=-e;p.n31=0;p.n32=0;p.n33=-2/j;p.n34=-h;p.n41=0;p.n42=0;p.n43=0;p.n44=1;return p};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
|
-THREE.Vertex=function(a,d){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=d||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,d,e,f,h){this.a=a;this.b=d;this.c=e;this.centroid=new THREE.Vector3;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.materials=h instanceof Array?h:[h]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
|
|
|
-THREE.Face4=function(a,d,e,f,h,i){this.a=a;this.b=d;this.c=e;this.d=f;this.centroid=new THREE.Vector3;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.materials=i instanceof Array?i:[i]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,d){this.u=a||0;this.v=d||0};
|
|
|
-THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
|
|
|
-THREE.Geometry.prototype={computeCentroids:function(){var a,d,e;a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];e.centroid.set(0,0,0);if(e instanceof THREE.Face3){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);e.centroid.divideScalar(3)}else if(e instanceof THREE.Face4){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);
|
|
|
-e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var d,e,f,h,i,p,b=new THREE.Vector3,k=new THREE.Vector3;f=0;for(h=this.vertices.length;f<h;f++){i=this.vertices[f];i.normal.set(0,0,0)}f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];if(a&&i.vertexNormals.length){b.set(0,0,0);d=0;for(e=i.normal.length;d<e;d++)b.addSelf(i.vertexNormals[d]);b.divideScalar(3)}else{d=this.vertices[i.a];e=this.vertices[i.b];p=this.vertices[i.c];b.sub(p.position,
|
|
|
-e.position);k.sub(d.position,e.position);b.crossSelf(k)}b.isZero()||b.normalize();i.normal.copy(b)}},computeVertexNormals:function(){var a,d,e,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(d=this.vertices.length;a<d;a++)f[a]=new THREE.Vector3;a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];if(e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,
|
|
|
-new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{f=this.__tmpVertices;a=0;for(d=this.vertices.length;a<d;a++)f[a].set(0,0,0)}a=0;for(d=this.faces.length;a<d;a++){e=this.faces[a];if(e instanceof THREE.Face3){f[e.a].addSelf(e.normal);f[e.b].addSelf(e.normal);f[e.c].addSelf(e.normal)}else if(e instanceof THREE.Face4){f[e.a].addSelf(e.normal);f[e.b].addSelf(e.normal);f[e.c].addSelf(e.normal);f[e.d].addSelf(e.normal)}}a=0;for(d=this.vertices.length;a<d;a++)f[a].normalize();a=0;for(d=this.faces.length;a<
|
|
|
-d;a++){e=this.faces[a];if(e instanceof THREE.Face3){e.vertexNormals[0].copy(f[e.a]);e.vertexNormals[1].copy(f[e.b]);e.vertexNormals[2].copy(f[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(f[e.a]);e.vertexNormals[1].copy(f[e.b]);e.vertexNormals[2].copy(f[e.c]);e.vertexNormals[3].copy(f[e.d])}}},computeTangents:function(){function a(v,o,K,H,U,T,M){i=v.vertices[o].position;p=v.vertices[K].position;b=v.vertices[H].position;k=h[U];j=h[T];C=h[M];F=p.x-i.x;A=b.x-i.x;E=p.y-i.y;N=b.y-i.y;
|
|
|
-P=p.z-i.z;Q=b.z-i.z;q=j.u-k.u;aa=C.u-k.u;L=j.v-k.v;g=C.v-k.v;l=1/(q*g-aa*L);u.set((g*F-L*A)*l,(g*E-L*N)*l,(g*P-L*Q)*l);I.set((q*A-aa*F)*l,(q*N-aa*E)*l,(q*Q-aa*P)*l);r[o].addSelf(u);r[K].addSelf(u);r[H].addSelf(u);m[o].addSelf(I);m[K].addSelf(I);m[H].addSelf(I)}var d,e,f,h,i,p,b,k,j,C,F,A,E,N,P,Q,q,aa,L,g,l,r=[],m=[],u=new THREE.Vector3,I=new THREE.Vector3,n=new THREE.Vector3,w=new THREE.Vector3,B=new THREE.Vector3;d=0;for(e=this.vertices.length;d<e;d++){r[d]=new THREE.Vector3;m[d]=new THREE.Vector3}d=
|
|
|
-0;for(e=this.faces.length;d<e;d++){f=this.faces[d];h=this.uvs[d];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])}}d=0;for(e=this.vertices.length;d<e;d++){B.copy(this.vertices[d].normal);f=r[d];n.copy(f);n.subSelf(B.multiplyScalar(B.dot(f))).normalize();w.cross(this.vertices[d].normal,f);f=w.dot(m[d]);f=f<0?-1:1;this.vertices[d].tangent.set(n.x,n.y,n.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 d=1,e=this.vertices.length;d<e;d++){a=this.vertices[d];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,d=0,e=this.vertices.length;d<e;d++)a=Math.max(a,this.vertices[d].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(C){var F=[];d=0;for(e=C.length;d<e;d++)C[d]==undefined?F.push("undefined"):F.push(C[d].toString());return F.join("_")}var d,e,f,h,i,p,b,k,j={};f=0;for(h=this.faces.length;f<h;f++){i=this.faces[f];
|
|
|
-p=i.materials;b=a(p);if(j[b]==undefined)j[b]={hash:b,counter:0};k=j[b].hash+"_"+j[b].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:p,vertices:0};i=i instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+i>65535){j[b].counter+=1;k=j[b].hash+"_"+j[b].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:p,vertices:0}}this.geometryChunks[k].faces.push(f);this.geometryChunks[k].vertices+=i}},toString:function(){return"THREE.Geometry ( vertices: "+
|
|
|
-this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
|
|
|
-THREE.Camera=function(a,d,e,f){this.fov=a;this.aspect=d;this.near=e;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(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
|
|
|
-this.translateZ=function(h){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(h);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,d){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=d||1};THREE.DirectionalLight.prototype=new THREE.Light;
|
|
|
-THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,d){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=d||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.PointLight;
|
|
|
-THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.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,d=this.rotation,e=this.scale,f=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.identity();if(d.x!=0){f.setRotX(d.x);this.matrix.multiplySelf(f);this.rotationMatrix.multiplySelf(f)}if(d.y!=0){f.setRotY(d.y);this.matrix.multiplySelf(f);this.rotationMatrix.multiplySelf(f)}if(d.z!=0){f.setRotZ(d.z);this.matrix.multiplySelf(f);this.rotationMatrix.multiplySelf(f)}if(e.x!=0||e.y!=0||e.z!=0){f.setScale(e.x,e.y,
|
|
|
-e.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,d){THREE.Object3D.call(this);this.geometry=a;this.materials=d instanceof Array?d:[d];this.autoUpdateMatrix=false};THREE.ParticleSystem.prototype=new THREE.Object3D;
|
|
|
-THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,d,e){THREE.Object3D.call(this);this.geometry=a;this.materials=d instanceof Array?d:[d];this.type=e!=undefined?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
|
-THREE.Mesh=function(a,d){THREE.Object3D.call(this);this.geometry=a;this.materials=d instanceof Array?d:[d];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;
|
|
|
-THREE.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}};
|
|
|
-THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
|
|
|
-THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
|
|
|
-a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
-undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
|
-THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+
|
|
|
-"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
|
|
|
-THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
|
|
|
-a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
-undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
|
-THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+
|
|
|
-this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
|
|
|
-THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=
|
|
|
-this.wireframe_linecap="round";if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
|
|
|
-a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==
|
|
|
-undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
|
-THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
|
|
|
-this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshPhongMaterialCounter={value:0};
|
|
|
-THREE.MeshDepthMaterial=function(a){this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial"}};
|
|
|
-THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
|
|
|
-THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!==
|
|
|
-undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
|
-THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
|
|
|
-THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
|
|
-THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
|
|
-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,d,e,f,h,i){this.image=a;this.mapping=d!==undefined?d:new THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=h!==undefined?h:THREE.LinearFilter;this.min_filter=i!==undefined?i: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,d,e){this.width=a;this.height=d;e=e||{};this.wrap_s=e.wrap_s!==undefined?e.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=e.wrap_t!==undefined?e.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=e.mag_filter!==undefined?e.mag_filter:THREE.LinearFilter;this.min_filter=e.min_filter!==undefined?e.min_filter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType};
|
|
|
-var Uniforms={clone:function(a){var d,e,f,h={};for(d in a){h[d]={};for(e in a[d]){f=a[d][e];h[d][e]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return h},merge:function(a){var d,e,f,h={};for(d=0;d<a.length;d++){f=this.clone(a[d]);for(e in f)h[e]=f[e]}return h}};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,d,e){this.color=new THREE.Color(a);this.near=d||1;this.far=e||1E3};THREE.FogExp2=function(a,d){this.color=new THREE.Color(a);this.density=d||2.5E-4};
|
|
|
-THREE.Projector=function(){function a(m,u){return u.z-m.z}function d(m,u){var I=0,n=1,w=m.z+m.w,B=u.z+u.w,v=-m.z+m.w,o=-u.z+u.w;if(w>=0&&B>=0&&v>=0&&o>=0)return true;else if(w<0&&B<0||v<0&&o<0)return false;else{if(w<0)I=Math.max(I,w/(w-B));else if(B<0)n=Math.min(n,w/(w-B));if(v<0)I=Math.max(I,v/(v-o));else if(o<0)n=Math.min(n,v/(v-o));if(n<I)return false;else{m.lerpSelf(u,I);u.lerpSelf(m,1-n);return true}}}var e,f,h=[],i,p,b,k=[],j,C,F=[],A,E,N=[],P=new THREE.Vector4,Q=new THREE.Vector4,q=new THREE.Matrix4,
|
|
|
-aa=new THREE.Matrix4,L=[],g=new THREE.Vector4,l=new THREE.Vector4,r;this.projectObjects=function(m,u,I){var n=[],w,B;f=0;q.multiply(u.projectionMatrix,u.matrix);L[0]=new THREE.Vector4(q.n41-q.n11,q.n42-q.n12,q.n43-q.n13,q.n44-q.n14);L[1]=new THREE.Vector4(q.n41+q.n11,q.n42+q.n12,q.n43+q.n13,q.n44+q.n14);L[2]=new THREE.Vector4(q.n41+q.n21,q.n42+q.n22,q.n43+q.n23,q.n44+q.n24);L[3]=new THREE.Vector4(q.n41-q.n21,q.n42-q.n22,q.n43-q.n23,q.n44-q.n24);L[4]=new THREE.Vector4(q.n41-q.n31,q.n42-q.n32,q.n43-
|
|
|
-q.n33,q.n44-q.n34);L[5]=new THREE.Vector4(q.n41+q.n31,q.n42+q.n32,q.n43+q.n33,q.n44+q.n34);u=0;for(w=L.length;u<w;u++){B=L[u];B.divideScalar(Math.sqrt(B.x*B.x+B.y*B.y+B.z*B.z))}w=m.objects;m=0;for(u=w.length;m<u;m++){B=w[m];var v;if(!(v=!B.visible)){if(v=B instanceof THREE.Mesh){a:{v=void 0;for(var o=B.position,K=-B.geometry.boundingSphere.radius*Math.max(B.scale.x,Math.max(B.scale.y,B.scale.z)),H=0;H<6;H++){v=L[H].x*o.x+L[H].y*o.y+L[H].z*o.z+L[H].w;if(v<=K){v=false;break a}}v=true}v=!v}v=v}if(!v){e=
|
|
|
-h[f]=h[f]||new THREE.RenderableObject;P.copy(B.position);q.multiplyVector3(P);e.object=B;e.z=P.z;n.push(e);f++}}I&&n.sort(a);return n};this.projectScene=function(m,u,I){var n=[],w=u.near,B=u.far,v,o,K,H,U,T,M,ba,V,O,R,Z,W,D,S,X;b=C=E=0;u.autoUpdateMatrix&&u.updateMatrix();q.multiply(u.projectionMatrix,u.matrix);T=this.projectObjects(m,u,true);m=0;for(v=T.length;m<v;m++){M=T[m].object;if(M.visible){M.autoUpdateMatrix&&M.updateMatrix();ba=M.matrix;V=M.rotationMatrix;O=M.materials;R=M.overdraw;if(M instanceof
|
|
|
-THREE.Mesh){Z=M.geometry;W=Z.vertices;o=0;for(K=W.length;o<K;o++){D=W[o];D.positionWorld.copy(D.position);ba.multiplyVector3(D.positionWorld);H=D.positionScreen;H.copy(D.positionWorld);q.multiplyVector4(H);H.x/=H.w;H.y/=H.w;D.__visible=H.z>w&&H.z<B}Z=Z.faces;o=0;for(K=Z.length;o<K;o++){D=Z[o];if(D instanceof THREE.Face3){H=W[D.a];U=W[D.b];S=W[D.c];if(H.__visible&&U.__visible&&S.__visible)if(M.doubleSided||M.flipSided!=(S.positionScreen.x-H.positionScreen.x)*(U.positionScreen.y-H.positionScreen.y)-
|
|
|
-(S.positionScreen.y-H.positionScreen.y)*(U.positionScreen.x-H.positionScreen.x)<0){i=k[b]=k[b]||new THREE.RenderableFace3;i.v1.positionWorld.copy(H.positionWorld);i.v2.positionWorld.copy(U.positionWorld);i.v3.positionWorld.copy(S.positionWorld);i.v1.positionScreen.copy(H.positionScreen);i.v2.positionScreen.copy(U.positionScreen);i.v3.positionScreen.copy(S.positionScreen);i.normalWorld.copy(D.normal);V.multiplyVector3(i.normalWorld);i.centroidWorld.copy(D.centroid);ba.multiplyVector3(i.centroidWorld);
|
|
|
-i.centroidScreen.copy(i.centroidWorld);q.multiplyVector3(i.centroidScreen);S=D.vertexNormals;r=i.vertexNormalsWorld;H=0;for(U=S.length;H<U;H++){X=r[H]=r[H]||new THREE.Vector3;X.copy(S[H]);V.multiplyVector3(X)}i.z=i.centroidScreen.z;i.meshMaterials=O;i.faceMaterials=D.materials;i.overdraw=R;if(M.geometry.uvs[o]){i.uvs[0]=M.geometry.uvs[o][0];i.uvs[1]=M.geometry.uvs[o][1];i.uvs[2]=M.geometry.uvs[o][2]}n.push(i);b++}}else if(D instanceof THREE.Face4){H=W[D.a];U=W[D.b];S=W[D.c];X=W[D.d];if(H.__visible&&
|
|
|
-U.__visible&&S.__visible&&X.__visible)if(M.doubleSided||M.flipSided!=((X.positionScreen.x-H.positionScreen.x)*(U.positionScreen.y-H.positionScreen.y)-(X.positionScreen.y-H.positionScreen.y)*(U.positionScreen.x-H.positionScreen.x)<0||(U.positionScreen.x-S.positionScreen.x)*(X.positionScreen.y-S.positionScreen.y)-(U.positionScreen.y-S.positionScreen.y)*(X.positionScreen.x-S.positionScreen.x)<0)){i=k[b]=k[b]||new THREE.RenderableFace3;i.v1.positionWorld.copy(H.positionWorld);i.v2.positionWorld.copy(U.positionWorld);
|
|
|
-i.v3.positionWorld.copy(X.positionWorld);i.v1.positionScreen.copy(H.positionScreen);i.v2.positionScreen.copy(U.positionScreen);i.v3.positionScreen.copy(X.positionScreen);i.normalWorld.copy(D.normal);V.multiplyVector3(i.normalWorld);i.centroidWorld.copy(D.centroid);ba.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);q.multiplyVector3(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=O;i.faceMaterials=D.materials;i.overdraw=R;if(M.geometry.uvs[o]){i.uvs[0]=M.geometry.uvs[o][0];
|
|
|
-i.uvs[1]=M.geometry.uvs[o][1];i.uvs[2]=M.geometry.uvs[o][3]}n.push(i);b++;p=k[b]=k[b]||new THREE.RenderableFace3;p.v1.positionWorld.copy(U.positionWorld);p.v2.positionWorld.copy(S.positionWorld);p.v3.positionWorld.copy(X.positionWorld);p.v1.positionScreen.copy(U.positionScreen);p.v2.positionScreen.copy(S.positionScreen);p.v3.positionScreen.copy(X.positionScreen);p.normalWorld.copy(i.normalWorld);p.centroidWorld.copy(i.centroidWorld);p.centroidScreen.copy(i.centroidScreen);p.z=p.centroidScreen.z;p.meshMaterials=
|
|
|
-O;p.faceMaterials=D.materials;p.overdraw=R;if(M.geometry.uvs[o]){p.uvs[0]=M.geometry.uvs[o][1];p.uvs[1]=M.geometry.uvs[o][2];p.uvs[2]=M.geometry.uvs[o][3]}n.push(p);b++}}}}else if(M instanceof THREE.Line){aa.multiply(q,ba);W=M.geometry.vertices;D=W[0];D.positionScreen.copy(D.position);aa.multiplyVector4(D.positionScreen);o=1;for(K=W.length;o<K;o++){H=W[o];H.positionScreen.copy(H.position);aa.multiplyVector4(H.positionScreen);U=W[o-1];g.copy(H.positionScreen);l.copy(U.positionScreen);if(d(g,l)){g.multiplyScalar(1/
|
|
|
-g.w);l.multiplyScalar(1/l.w);j=F[C]=F[C]||new THREE.RenderableLine;j.v1.positionScreen.copy(g);j.v2.positionScreen.copy(l);j.z=Math.max(g.z,l.z);j.materials=M.materials;n.push(j);C++}}}else if(M instanceof THREE.Particle){Q.set(M.position.x,M.position.y,M.position.z,1);q.multiplyVector4(Q);Q.z/=Q.w;if(Q.z>0&&Q.z<1){A=N[E]=N[E]||new THREE.RenderableParticle;A.x=Q.x/Q.w;A.y=Q.y/Q.w;A.z=Q.z;A.rotation=M.rotation.z;A.scale.x=M.scale.x*Math.abs(A.x-(Q.x+u.projectionMatrix.n11)/(Q.w+u.projectionMatrix.n14));
|
|
|
-A.scale.y=M.scale.y*Math.abs(A.y-(Q.y+u.projectionMatrix.n22)/(Q.w+u.projectionMatrix.n24));A.materials=M.materials;n.push(A);E++}}}}I&&n.sort(a);return n};this.unprojectVector=function(m,u){var I=new THREE.Matrix4;I.multiply(THREE.Matrix4.makeInvert(u.matrix),THREE.Matrix4.makeInvert(u.projectionMatrix));I.multiplyVector3(m);return m}};
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,d=new THREE.Projector,e,f,h,i;this.domElement=document.createElement("div");this.setSize=function(p,b){e=p;f=b;h=e/2;i=f/2};this.render=function(p,b){var k,j,C,F,A,E,N,P;a=d.projectScene(p,b);k=0;for(j=a.length;k<j;k++){A=a[k];if(A instanceof THREE.RenderableParticle){N=A.x*h+h;P=A.y*i+i;C=0;for(F=A.material.length;C<F;C++){E=A.material[C];if(E instanceof THREE.ParticleDOMMaterial){E=E.domElement;E.style.left=N+"px";E.style.top=P+"px"}}}}}};
|
|
|
-THREE.CanvasRenderer=function(){function a(ja){if(A!=ja)j.globalAlpha=A=ja}function d(ja){if(E!=ja){switch(ja){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation="darker"}E=ja}}var e=null,f=new THREE.Projector,h=document.createElement("canvas"),i,p,b,k,j=h.getContext("2d"),C=null,F=null,A=1,E=0,N=null,P=null,Q=1,q,aa,L,g,l,r,m,u,I,n=new THREE.Color,
|
|
|
-w=new THREE.Color,B=new THREE.Color,v=new THREE.Color,o=new THREE.Color,K,H,U,T,M,ba,V,O,R,Z=new THREE.Rectangle,W=new THREE.Rectangle,D=new THREE.Rectangle,S=false,X=new THREE.Color,ka=new THREE.Color,ha=new THREE.Color,ea=new THREE.Color,pa=Math.PI*2,da=new THREE.Vector3,wa,qa,la,na,ya,Aa,Ba=16;wa=document.createElement("canvas");wa.width=wa.height=2;qa=wa.getContext("2d");qa.fillStyle="rgba(0,0,0,1)";qa.fillRect(0,0,2,2);la=qa.getImageData(0,0,2,2);na=la.data;ya=document.createElement("canvas");
|
|
|
-ya.width=ya.height=Ba;Aa=ya.getContext("2d");Aa.translate(-Ba/2,-Ba/2);Aa.scale(Ba,Ba);Ba--;this.domElement=h;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ja,xa){i=ja;p=xa;b=i/2;k=p/2;h.width=i;h.height=p;Z.set(-b,-k,b,k);A=1;E=0;P=N=null;Q=1};this.setClearColor=function(ja,xa){C=ja!==null?new THREE.Color(ja):null;F=xa;W.set(-b,-k,b,k);j.setTransform(1,0,0,-1,b,k);this.clear()};this.clear=function(){if(!W.isEmpty()){W.inflate(1);W.minSelf(Z);if(C!==null){d(THREE.NormalBlending);
|
|
|
-a(1);j.fillStyle="rgba("+Math.floor(C.r*255)+","+Math.floor(C.g*255)+","+Math.floor(C.b*255)+","+F+")";j.fillRect(W.getX(),W.getY(),W.getWidth(),W.getHeight())}else j.clearRect(W.getX(),W.getY(),W.getWidth(),W.getHeight());W.empty()}};this.render=function(ja,xa){function Sa(G){var ca,$,J,Y=G.lights;ka.setRGB(0,0,0);ha.setRGB(0,0,0);ea.setRGB(0,0,0);G=0;for(ca=Y.length;G<ca;G++){$=Y[G];J=$.color;if($ instanceof THREE.AmbientLight){ka.r+=J.r;ka.g+=J.g;ka.b+=J.b}else if($ instanceof THREE.DirectionalLight){ha.r+=
|
|
|
-J.r;ha.g+=J.g;ha.b+=J.b}else if($ instanceof THREE.PointLight){ea.r+=J.r;ea.g+=J.g;ea.b+=J.b}}}function Ga(G,ca,$,J){var Y,fa,ia,ma,oa=G.lights;G=0;for(Y=oa.length;G<Y;G++){fa=oa[G];ia=fa.color;ma=fa.intensity;if(fa instanceof THREE.DirectionalLight){fa=$.dot(fa.position)*ma;if(fa>0){J.r+=ia.r*fa;J.g+=ia.g*fa;J.b+=ia.b*fa}}else if(fa instanceof THREE.PointLight){da.sub(fa.position,ca);da.normalize();fa=$.dot(da)*ma;if(fa>0){J.r+=ia.r*fa;J.g+=ia.g*fa;J.b+=ia.b*fa}}}}function Ta(G,ca,$){if($.opacity!=
|
|
|
-0){a($.opacity);d($.blending);var J,Y,fa,ia,ma,oa;if($ instanceof THREE.ParticleBasicMaterial){if($.map){ia=$.map;ma=ia.width>>1;oa=ia.height>>1;Y=ca.scale.x*b;fa=ca.scale.y*k;$=Y*ma;J=fa*oa;D.set(G.x-$,G.y-J,G.x+$,G.y+J);if(!Z.instersects(D))return;j.save();j.translate(G.x,G.y);j.rotate(-ca.rotation);j.scale(Y,-fa);j.translate(-ma,-oa);j.drawImage(ia,0,0);j.restore()}j.beginPath();j.moveTo(G.x-10,G.y);j.lineTo(G.x+10,G.y);j.moveTo(G.x,G.y-10);j.lineTo(G.x,G.y+10);j.closePath();j.strokeStyle="rgb(255,255,0)";
|
|
|
-j.stroke()}else if($ instanceof THREE.ParticleCircleMaterial){if(S){X.r=ka.r+ha.r+ea.r;X.g=ka.g+ha.g+ea.g;X.b=ka.b+ha.b+ea.b;n.r=$.color.r*X.r;n.g=$.color.g*X.g;n.b=$.color.b*X.b;n.updateStyleString()}else n.__styleString=$.color.__styleString;$=ca.scale.x*b;J=ca.scale.y*k;D.set(G.x-$,G.y-J,G.x+$,G.y+J);if(Z.instersects(D)){Y=n.__styleString;if(P!=Y)j.fillStyle=P=Y;j.save();j.translate(G.x,G.y);j.rotate(-ca.rotation);j.scale($,J);j.beginPath();j.arc(0,0,1,0,pa,true);j.closePath();j.fill();j.restore()}}}}
|
|
|
-function Ua(G,ca,$,J){if(J.opacity!=0){a(J.opacity);d(J.blending);j.beginPath();j.moveTo(G.positionScreen.x,G.positionScreen.y);j.lineTo(ca.positionScreen.x,ca.positionScreen.y);j.closePath();if(J instanceof THREE.LineBasicMaterial){n.__styleString=J.color.__styleString;G=J.linewidth;if(Q!=G)j.lineWidth=Q=G;G=n.__styleString;if(N!=G)j.strokeStyle=N=G;j.stroke();D.inflate(J.linewidth*2)}}}function Oa(G,ca,$,J,Y,fa){if(Y.opacity!=0){a(Y.opacity);d(Y.blending);g=G.positionScreen.x;l=G.positionScreen.y;
|
|
|
-r=ca.positionScreen.x;m=ca.positionScreen.y;u=$.positionScreen.x;I=$.positionScreen.y;j.beginPath();j.moveTo(g,l);j.lineTo(r,m);j.lineTo(u,I);j.lineTo(g,l);j.closePath();if(Y instanceof THREE.MeshBasicMaterial)if(Y.map)Y.map.image.loaded&&Y.map.mapping instanceof THREE.UVMapping&&Da(g,l,r,m,u,I,Y.map.image,J.uvs[0].u,J.uvs[0].v,J.uvs[1].u,J.uvs[1].v,J.uvs[2].u,J.uvs[2].v);else if(Y.env_map){if(Y.env_map.image.loaded)if(Y.env_map.mapping instanceof THREE.SphericalReflectionMapping){G=xa.matrix;da.copy(J.vertexNormalsWorld[0]);
|
|
|
-T=(da.x*G.n11+da.y*G.n12+da.z*G.n13)*0.5+0.5;M=-(da.x*G.n21+da.y*G.n22+da.z*G.n23)*0.5+0.5;da.copy(J.vertexNormalsWorld[1]);ba=(da.x*G.n11+da.y*G.n12+da.z*G.n13)*0.5+0.5;V=-(da.x*G.n21+da.y*G.n22+da.z*G.n23)*0.5+0.5;da.copy(J.vertexNormalsWorld[2]);O=(da.x*G.n11+da.y*G.n12+da.z*G.n13)*0.5+0.5;R=-(da.x*G.n21+da.y*G.n22+da.z*G.n23)*0.5+0.5;Da(g,l,r,m,u,I,Y.env_map.image,T,M,ba,V,O,R)}}else Y.wireframe?Ha(Y.color.__styleString,Y.wireframe_linewidth):Ia(Y.color.__styleString);else if(Y instanceof THREE.MeshLambertMaterial){if(Y.map&&
|
|
|
-!Y.wireframe){Y.map.mapping instanceof THREE.UVMapping&&Da(g,l,r,m,u,I,Y.map.image,J.uvs[0].u,J.uvs[0].v,J.uvs[1].u,J.uvs[1].v,J.uvs[2].u,J.uvs[2].v);d(THREE.SubtractiveBlending)}if(S)if(!Y.wireframe&&Y.shading==THREE.SmoothShading&&J.vertexNormalsWorld.length==3){w.r=B.r=v.r=ka.r;w.g=B.g=v.g=ka.g;w.b=B.b=v.b=ka.b;Ga(fa,J.v1.positionWorld,J.vertexNormalsWorld[0],w);Ga(fa,J.v2.positionWorld,J.vertexNormalsWorld[1],B);Ga(fa,J.v3.positionWorld,J.vertexNormalsWorld[2],v);o.r=(B.r+v.r)*0.5;o.g=(B.g+v.g)*
|
|
|
-0.5;o.b=(B.b+v.b)*0.5;U=Pa(w,B,v,o);Da(g,l,r,m,u,I,U,0,0,1,0,0,1)}else{X.r=ka.r;X.g=ka.g;X.b=ka.b;Ga(fa,J.centroidWorld,J.normalWorld,X);n.r=Y.color.r*X.r;n.g=Y.color.g*X.g;n.b=Y.color.b*X.b;n.updateStyleString();Y.wireframe?Ha(n.__styleString,Y.wireframe_linewidth):Ia(n.__styleString)}else Y.wireframe?Ha(Y.color.__styleString,Y.wireframe_linewidth):Ia(Y.color.__styleString)}else if(Y instanceof THREE.MeshDepthMaterial){K=xa.near;H=xa.far;w.r=w.g=w.b=1-Ka(G.positionScreen.z,K,H);B.r=B.g=B.b=1-Ka(ca.positionScreen.z,
|
|
|
-K,H);v.r=v.g=v.b=1-Ka($.positionScreen.z,K,H);o.r=(B.r+v.r)*0.5;o.g=(B.g+v.g)*0.5;o.b=(B.b+v.b)*0.5;U=Pa(w,B,v,o);Da(g,l,r,m,u,I,U,0,0,1,0,0,1)}else if(Y instanceof THREE.MeshNormalMaterial){n.r=La(J.normalWorld.x);n.g=La(J.normalWorld.y);n.b=La(J.normalWorld.z);n.updateStyleString();Y.wireframe?Ha(n.__styleString,Y.wireframe_linewidth):Ia(n.__styleString)}}}function Ha(G,ca){if(N!=G)j.strokeStyle=N=G;if(Q!=ca)j.lineWidth=Q=ca;j.stroke();D.inflate(ca*2)}function Ia(G){if(P!=G)j.fillStyle=P=G;j.fill()}
|
|
|
-function Da(G,ca,$,J,Y,fa,ia,ma,oa,ta,ra,ua,Ea){var za,va;za=ia.width-1;va=ia.height-1;ma*=za;oa*=va;ta*=za;ra*=va;ua*=za;Ea*=va;$-=G;J-=ca;Y-=G;fa-=ca;ta-=ma;ra-=oa;ua-=ma;Ea-=oa;va=1/(ta*Ea-ua*ra);za=(Ea*$-ra*Y)*va;ra=(Ea*J-ra*fa)*va;$=(ta*Y-ua*$)*va;J=(ta*fa-ua*J)*va;G=G-za*ma-$*oa;ca=ca-ra*ma-J*oa;j.save();j.transform(za,ra,$,J,G,ca);j.clip();j.drawImage(ia,0,0);j.restore()}function Pa(G,ca,$,J){var Y=~~(G.r*255),fa=~~(G.g*255);G=~~(G.b*255);var ia=~~(ca.r*255),ma=~~(ca.g*255);ca=~~(ca.b*255);
|
|
|
-var oa=~~($.r*255),ta=~~($.g*255);$=~~($.b*255);var ra=~~(J.r*255),ua=~~(J.g*255);J=~~(J.b*255);na[0]=Y<0?0:Y>255?255:Y;na[1]=fa<0?0:fa>255?255:fa;na[2]=G<0?0:G>255?255:G;na[4]=ia<0?0:ia>255?255:ia;na[5]=ma<0?0:ma>255?255:ma;na[6]=ca<0?0:ca>255?255:ca;na[8]=oa<0?0:oa>255?255:oa;na[9]=ta<0?0:ta>255?255:ta;na[10]=$<0?0:$>255?255:$;na[12]=ra<0?0:ra>255?255:ra;na[13]=ua<0?0:ua>255?255:ua;na[14]=J<0?0:J>255?255:J;qa.putImageData(la,0,0);Aa.drawImage(wa,0,0);return ya}function Ka(G,ca,$){G=(G-ca)/($-ca);
|
|
|
-return G*G*(3-2*G)}function La(G){G=(G+1)*0.5;return G<0?0:G>1?1:G}function Ma(G,ca){var $=ca.x-G.x,J=ca.y-G.y,Y=1/Math.sqrt($*$+J*J);$*=Y;J*=Y;ca.x+=$;ca.y+=J;G.x-=$;G.y-=J}var Ja,Qa,ga,sa,Ca,Na,Ra,Fa;j.setTransform(1,0,0,-1,b,k);this.autoClear&&this.clear();e=f.projectScene(ja,xa,this.sortElements);j.fillStyle="rgba( 0, 255, 255, 0.5 )";j.fillRect(Z.getX(),Z.getY(),Z.getWidth(),Z.getHeight());(S=ja.lights.length>0)&&Sa(ja);Ja=0;for(Qa=e.length;Ja<Qa;Ja++){ga=e[Ja];D.empty();if(ga instanceof THREE.RenderableParticle){q=
|
|
|
-ga;q.x*=b;q.y*=k;sa=0;for(Ca=ga.materials.length;sa<Ca;sa++)Ta(q,ga,ga.materials[sa],ja)}else if(ga instanceof THREE.RenderableLine){q=ga.v1;aa=ga.v2;q.positionScreen.x*=b;q.positionScreen.y*=k;aa.positionScreen.x*=b;aa.positionScreen.y*=k;D.addPoint(q.positionScreen.x,q.positionScreen.y);D.addPoint(aa.positionScreen.x,aa.positionScreen.y);if(Z.instersects(D)){sa=0;for(Ca=ga.materials.length;sa<Ca;)Ua(q,aa,ga,ga.materials[sa++],ja)}}else if(ga instanceof THREE.RenderableFace3){q=ga.v1;aa=ga.v2;L=
|
|
|
-ga.v3;q.positionScreen.x*=b;q.positionScreen.y*=k;aa.positionScreen.x*=b;aa.positionScreen.y*=k;L.positionScreen.x*=b;L.positionScreen.y*=k;if(ga.overdraw){Ma(q.positionScreen,aa.positionScreen);Ma(aa.positionScreen,L.positionScreen);Ma(L.positionScreen,q.positionScreen)}D.add3Points(q.positionScreen.x,q.positionScreen.y,aa.positionScreen.x,aa.positionScreen.y,L.positionScreen.x,L.positionScreen.y);if(Z.instersects(D)){sa=0;for(Ca=ga.meshMaterials.length;sa<Ca;){Fa=ga.meshMaterials[sa++];if(Fa instanceof
|
|
|
-THREE.MeshFaceMaterial){Na=0;for(Ra=ga.faceMaterials.length;Na<Ra;)(Fa=ga.faceMaterials[Na++])&&Oa(q,aa,L,ga,Fa,ja)}else Oa(q,aa,L,ga,Fa,ja)}}}W.addRectangle(D)}j.lineWidth=1;j.strokeStyle="rgba( 255, 0, 0, 0.5 )";j.strokeRect(W.getX(),W.getY(),W.getWidth(),W.getHeight());j.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(T,M,ba){var V,O,R,Z;V=0;for(O=T.lights.length;V<O;V++){R=T.lights[V];if(R instanceof THREE.DirectionalLight){Z=M.normalWorld.dot(R.position)*R.intensity;if(Z>0){ba.r+=R.color.r*Z;ba.g+=R.color.g*Z;ba.b+=R.color.b*Z}}else if(R instanceof THREE.PointLight){I.sub(R.position,M.centroidWorld);I.normalize();Z=M.normalWorld.dot(I)*R.intensity;if(Z>0){ba.r+=R.color.r*Z;ba.g+=R.color.g*Z;ba.b+=R.color.b*Z}}}}function d(T,M,ba,V,O,R){v=f(o++);v.setAttribute("d","M "+
|
|
|
-T.positionScreen.x+" "+T.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+"z");if(O instanceof THREE.MeshBasicMaterial)L.__styleString=O.color.__styleString;else if(O instanceof THREE.MeshLambertMaterial)if(aa){g.r=l.r;g.g=l.g;g.b=l.b;a(R,V,g);L.r=O.color.r*g.r;L.g=O.color.g*g.g;L.b=O.color.b*g.b;L.updateStyleString()}else L.__styleString=O.color.__styleString;else if(O instanceof THREE.MeshDepthMaterial){u=1-O.__2near/(O.__farPlusNear-
|
|
|
-V.z*O.__farMinusNear);L.setRGB(u,u,u)}else O instanceof THREE.MeshNormalMaterial&&L.setRGB(h(V.normalWorld.x),h(V.normalWorld.y),h(V.normalWorld.z));O.wireframe?v.setAttribute("style","fill: none; stroke: "+L.__styleString+"; stroke-width: "+O.wireframe_linewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.wireframe_linecap+"; stroke-linejoin: "+O.wireframe_linejoin):v.setAttribute("style","fill: "+L.__styleString+"; fill-opacity: "+O.opacity);b.appendChild(v)}function e(T,M,ba,V,O,R,Z){v=
|
|
|
-f(o++);v.setAttribute("d","M "+T.positionScreen.x+" "+T.positionScreen.y+" L "+M.positionScreen.x+" "+M.positionScreen.y+" L "+ba.positionScreen.x+","+ba.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(R instanceof THREE.MeshBasicMaterial)L.__styleString=R.color.__styleString;else if(R instanceof THREE.MeshLambertMaterial)if(aa){g.r=l.r;g.g=l.g;g.b=l.b;a(Z,O,g);L.r=R.color.r*g.r;L.g=R.color.g*g.g;L.b=R.color.b*g.b;L.updateStyleString()}else L.__styleString=R.color.__styleString;
|
|
|
-else if(R instanceof THREE.MeshDepthMaterial){u=1-R.__2near/(R.__farPlusNear-O.z*R.__farMinusNear);L.setRGB(u,u,u)}else R instanceof THREE.MeshNormalMaterial&&L.setRGB(h(O.normalWorld.x),h(O.normalWorld.y),h(O.normalWorld.z));R.wireframe?v.setAttribute("style","fill: none; stroke: "+L.__styleString+"; stroke-width: "+R.wireframe_linewidth+"; stroke-opacity: "+R.opacity+"; stroke-linecap: "+R.wireframe_linecap+"; stroke-linejoin: "+R.wireframe_linejoin):v.setAttribute("style","fill: "+L.__styleString+
|
|
|
-"; fill-opacity: "+R.opacity);b.appendChild(v)}function f(T){if(n[T]==null){n[T]=document.createElementNS("http://www.w3.org/2000/svg","path");U==0&&n[T].setAttribute("shape-rendering","crispEdges");return n[T]}return n[T]}function h(T){return T<0?Math.min((1+T)*0.5,0.5):0.5+Math.min(T*0.5,0.5)}var i=null,p=new THREE.Projector,b=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,j,C,F,A,E,N,P,Q=new THREE.Rectangle,q=new THREE.Rectangle,aa=false,L=new THREE.Color(16777215),g=new THREE.Color(16777215),
|
|
|
-l=new THREE.Color(0),r=new THREE.Color(0),m=new THREE.Color(0),u,I=new THREE.Vector3,n=[],w=[],B=[],v,o,K,H,U=1;this.domElement=b;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(T){switch(T){case "high":U=1;break;case "low":U=0}};this.setSize=function(T,M){k=T;j=M;C=k/2;F=j/2;b.setAttribute("viewBox",-C+" "+-F+" "+k+" "+j);b.setAttribute("width",k);b.setAttribute("height",j);Q.set(-C,-F,C,F)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};
|
|
|
-this.render=function(T,M){var ba,V,O,R,Z,W,D,S;this.autoClear&&this.clear();i=p.projectScene(T,M,this.sortElements);H=K=o=0;if(aa=T.lights.length>0){D=T.lights;l.setRGB(0,0,0);r.setRGB(0,0,0);m.setRGB(0,0,0);ba=0;for(V=D.length;ba<V;ba++){O=D[ba];R=O.color;if(O instanceof THREE.AmbientLight){l.r+=R.r;l.g+=R.g;l.b+=R.b}else if(O instanceof THREE.DirectionalLight){r.r+=R.r;r.g+=R.g;r.b+=R.b}else if(O instanceof THREE.PointLight){m.r+=R.r;m.g+=R.g;m.b+=R.b}}}ba=0;for(V=i.length;ba<V;ba++){D=i[ba];q.empty();
|
|
|
-if(D instanceof THREE.RenderableParticle){A=D;A.x*=C;A.y*=-F;O=0;for(R=D.materials.length;O<R;O++)if(S=D.materials[O]){Z=A;W=D;S=S;var X=K++;if(w[X]==null){w[X]=document.createElementNS("http://www.w3.org/2000/svg","circle");U==0&&w[X].setAttribute("shape-rendering","crispEdges")}v=w[X];v.setAttribute("cx",Z.x);v.setAttribute("cy",Z.y);v.setAttribute("r",W.scale.x*C);if(S instanceof THREE.ParticleCircleMaterial){if(aa){g.r=l.r+r.r+m.r;g.g=l.g+r.g+m.g;g.b=l.b+r.b+m.b;L.r=S.color.r*g.r;L.g=S.color.g*
|
|
|
-g.g;L.b=S.color.b*g.b;L.updateStyleString()}else L=S.color;v.setAttribute("style","fill: "+L.__styleString)}b.appendChild(v)}}else if(D instanceof THREE.RenderableLine){A=D.v1;E=D.v2;A.positionScreen.x*=C;A.positionScreen.y*=-F;E.positionScreen.x*=C;E.positionScreen.y*=-F;q.addPoint(A.positionScreen.x,A.positionScreen.y);q.addPoint(E.positionScreen.x,E.positionScreen.y);if(Q.instersects(q)){O=0;for(R=D.materials.length;O<R;)if(S=D.materials[O++]){Z=A;W=E;S=S;X=H++;if(B[X]==null){B[X]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"line");U==0&&B[X].setAttribute("shape-rendering","crispEdges")}v=B[X];v.setAttribute("x1",Z.positionScreen.x);v.setAttribute("y1",Z.positionScreen.y);v.setAttribute("x2",W.positionScreen.x);v.setAttribute("y2",W.positionScreen.y);if(S instanceof THREE.LineBasicMaterial){L.__styleString=S.color.__styleString;v.setAttribute("style","fill: none; stroke: "+L.__styleString+"; stroke-width: "+S.linewidth+"; stroke-opacity: "+S.opacity+"; stroke-linecap: "+S.linecap+"; stroke-linejoin: "+S.linejoin);b.appendChild(v)}}}}else if(D instanceof
|
|
|
-THREE.RenderableFace3){A=D.v1;E=D.v2;N=D.v3;A.positionScreen.x*=C;A.positionScreen.y*=-F;E.positionScreen.x*=C;E.positionScreen.y*=-F;N.positionScreen.x*=C;N.positionScreen.y*=-F;q.addPoint(A.positionScreen.x,A.positionScreen.y);q.addPoint(E.positionScreen.x,E.positionScreen.y);q.addPoint(N.positionScreen.x,N.positionScreen.y);if(Q.instersects(q)){O=0;for(R=D.meshMaterials.length;O<R;){S=D.meshMaterials[O++];if(S instanceof THREE.MeshFaceMaterial){Z=0;for(W=D.faceMaterials.length;Z<W;)(S=D.faceMaterials[Z++])&&
|
|
|
-d(A,E,N,D,S,T)}else S&&d(A,E,N,D,S,T)}}}else if(D instanceof THREE.RenderableFace4){A=D.v1;E=D.v2;N=D.v3;P=D.v4;A.positionScreen.x*=C;A.positionScreen.y*=-F;E.positionScreen.x*=C;E.positionScreen.y*=-F;N.positionScreen.x*=C;N.positionScreen.y*=-F;P.positionScreen.x*=C;P.positionScreen.y*=-F;q.addPoint(A.positionScreen.x,A.positionScreen.y);q.addPoint(E.positionScreen.x,E.positionScreen.y);q.addPoint(N.positionScreen.x,N.positionScreen.y);q.addPoint(P.positionScreen.x,P.positionScreen.y);if(Q.instersects(q)){O=
|
|
|
-0;for(R=D.meshMaterials.length;O<R;){S=D.meshMaterials[O++];if(S instanceof THREE.MeshFaceMaterial){Z=0;for(W=D.faceMaterials.length;Z<W;)(S=D.faceMaterials[Z++])&&e(A,E,N,P,D,S,T)}else S&&e(A,E,N,P,D,S,T)}}}}}};
|
|
|
-THREE.WebGLRenderer=function(a){function d(g,l){g.fragment_shader=l.fragment_shader;g.vertex_shader=l.vertex_shader;g.uniforms=Uniforms.clone(l.uniforms)}function e(g,l){g.uniforms.color.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);g.uniforms.opacity.value=g.opacity;g.uniforms.map.texture=g.map;g.uniforms.env_map.texture=g.env_map;g.uniforms.reflectivity.value=g.reflectivity;g.uniforms.refraction_ratio.value=g.refraction_ratio;g.uniforms.combine.value=g.combine;g.uniforms.useRefract.value=
|
|
|
-g.env_map&&g.env_map.mapping instanceof THREE.CubeRefractionMapping;if(l){g.uniforms.fogColor.value.setHex(l.color.hex);if(l instanceof THREE.Fog){g.uniforms.fogNear.value=l.near;g.uniforms.fogFar.value=l.far}else if(l instanceof THREE.FogExp2)g.uniforms.fogDensity.value=l.density}}function f(g,l){g.uniforms.color.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);g.uniforms.opacity.value=g.opacity;if(l){g.uniforms.fogColor.value.setHex(l.color.hex);if(l instanceof THREE.Fog){g.uniforms.fogNear.value=
|
|
|
-l.near;g.uniforms.fogFar.value=l.far}else if(l instanceof THREE.FogExp2)g.uniforms.fogDensity.value=l.density}}function h(g,l){var r;if(g=="fragment")r=b.createShader(b.FRAGMENT_SHADER);else if(g=="vertex")r=b.createShader(b.VERTEX_SHADER);b.shaderSource(r,l);b.compileShader(r);if(!b.getShaderParameter(r,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(r));return null}return r}function i(g){switch(g){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 p=document.createElement("canvas"),b,k=null,j=null,C=new THREE.Matrix4,F,A=new Float32Array(16),E=new Float32Array(16),N=new Float32Array(16),P=new Float32Array(9),
|
|
|
-Q=new Float32Array(16),q=true,aa=new THREE.Color(0),L=0;if(a){if(a.antialias!==undefined)q=a.antialias;a.clearColor!==undefined&&aa.setHex(a.clearColor);if(a.clearAlpha!==undefined)L=a.clearAlpha}this.domElement=p;this.autoClear=true;(function(g,l,r){try{b=p.getContext("experimental-webgl",{antialias:g})}catch(m){}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(l.r,l.g,l.b,r)})(q,aa,L);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(g,l){p.width=g;p.height=l;b.viewport(0,0,p.width,p.height)};this.setClearColor=function(g,l){var r=new THREE.Color(g);b.clearColor(r.r,r.g,r.b,l)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=
|
|
|
-function(g,l){var r,m,u,I=0,n=0,w=0,B,v,o,K=this.lights,H=K.directional.colors,U=K.directional.positions,T=K.point.colors,M=K.point.positions,ba=0,V=0;r=0;for(m=l.length;r<m;r++){u=l[r];B=u.color;v=u.position;o=u.intensity;if(u instanceof THREE.AmbientLight){I+=B.r;n+=B.g;w+=B.b}else if(u instanceof THREE.DirectionalLight){H[ba*3]=B.r*o;H[ba*3+1]=B.g*o;H[ba*3+2]=B.b*o;U[ba*3]=v.x;U[ba*3+1]=v.y;U[ba*3+2]=v.z;ba+=1}else if(u instanceof THREE.PointLight){T[V*3]=B.r*o;T[V*3+1]=B.g*o;T[V*3+2]=B.b*o;M[V*
|
|
|
-3]=v.x;M[V*3+1]=v.y;M[V*3+2]=v.z;V+=1}}K.point.length=V;K.directional.length=ba;K.ambient[0]=I;K.ambient[1]=n;K.ambient[2]=w};this.createParticleBuffers=function(g){g.__webGLVertexBuffer=b.createBuffer();g.__webGLFaceBuffer=b.createBuffer()};this.createLineBuffers=function(g){g.__webGLVertexBuffer=b.createBuffer();g.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(g){g.__webGLVertexBuffer=b.createBuffer();g.__webGLNormalBuffer=b.createBuffer();g.__webGLTangentBuffer=b.createBuffer();
|
|
|
-g.__webGLUVBuffer=b.createBuffer();g.__webGLFaceBuffer=b.createBuffer();g.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(g){var l=g.vertices.length;g.__vertexArray=new Float32Array(l*3);g.__lineArray=new Uint16Array(l);g.__webGLLineCount=l};this.initMeshBuffers=function(g,l){var r,m,u=0,I=0,n=0,w=l.geometry.faces,B=g.faces;r=0;for(m=B.length;r<m;r++){fi=B[r];face=w[fi];if(face instanceof THREE.Face3){u+=3;I+=1;n+=3}else if(face instanceof THREE.Face4){u+=4;I+=2;n+=4}}g.__vertexArray=
|
|
|
-new Float32Array(u*3);g.__normalArray=new Float32Array(u*3);g.__tangentArray=new Float32Array(u*4);g.__uvArray=new Float32Array(u*2);g.__faceArray=new Uint16Array(I*3);g.__lineArray=new Uint16Array(n*2);u=false;r=0;for(m=l.materials.length;r<m;r++){w=l.materials[r];if(w instanceof THREE.MeshFaceMaterial){w=0;for(B=g.materials.length;w<B;w++)if(g.materials[w]&&g.materials[w].shading!=undefined&&g.materials[w].shading==THREE.SmoothShading){u=true;break}}else if(w&&w.shading!=undefined&&w.shading==THREE.SmoothShading){u=
|
|
|
-true;break}if(u)break}g.__needsSmoothNormals=u;g.__webGLFaceCount=I*3;g.__webGLLineCount=n*2};this.setMeshBuffers=function(g,l,r,m,u,I,n,w){var B,v,o,K,H,U,T,M,ba,V=0,O=0,R=0,Z=0,W=0,D=0,S=0,X=g.__vertexArray,ka=g.__uvArray,ha=g.__normalArray,ea=g.__tangentArray,pa=g.__faceArray,da=g.__lineArray,wa=g.__needsSmoothNormals,qa=l.geometry,la=qa.vertices,na=g.faces,ya=qa.faces,Aa=qa.uvs;l=0;for(B=na.length;l<B;l++){v=na[l];o=ya[v];v=Aa[v];K=o.vertexNormals;H=o.normal;if(o instanceof THREE.Face3){if(m){U=
|
|
|
-la[o.a].position;T=la[o.b].position;M=la[o.c].position;X[O]=U.x;X[O+1]=U.y;X[O+2]=U.z;X[O+3]=T.x;X[O+4]=T.y;X[O+5]=T.z;X[O+6]=M.x;X[O+7]=M.y;X[O+8]=M.z;O+=9}if(w&&qa.hasTangents){U=la[o.a].tangent;T=la[o.b].tangent;M=la[o.c].tangent;ea[D]=U.x;ea[D+1]=U.y;ea[D+2]=U.z;ea[D+3]=U.w;ea[D+4]=T.x;ea[D+5]=T.y;ea[D+6]=T.z;ea[D+7]=T.w;ea[D+8]=M.x;ea[D+9]=M.y;ea[D+10]=M.z;ea[D+11]=M.w;D+=12}if(n)if(K.length==3&&wa)for(o=0;o<3;o++){H=K[o];ha[W]=H.x;ha[W+1]=H.y;ha[W+2]=H.z;W+=3}else for(o=0;o<3;o++){ha[W]=H.x;
|
|
|
-ha[W+1]=H.y;ha[W+2]=H.z;W+=3}if(I&&v)for(o=0;o<3;o++){K=v[o];ka[R]=K.u;ka[R+1]=K.v;R+=2}if(u){pa[Z]=V;pa[Z+1]=V+1;pa[Z+2]=V+2;Z+=3;da[S]=V;da[S+1]=V+1;da[S+2]=V;da[S+3]=V+2;da[S+4]=V+1;da[S+5]=V+2;S+=6;V+=3}}else if(o instanceof THREE.Face4){if(m){U=la[o.a].position;T=la[o.b].position;M=la[o.c].position;ba=la[o.d].position;X[O]=U.x;X[O+1]=U.y;X[O+2]=U.z;X[O+3]=T.x;X[O+4]=T.y;X[O+5]=T.z;X[O+6]=M.x;X[O+7]=M.y;X[O+8]=M.z;X[O+9]=ba.x;X[O+10]=ba.y;X[O+11]=ba.z;O+=12}if(w&&qa.hasTangents){U=la[o.a].tangent;
|
|
|
-T=la[o.b].tangent;M=la[o.c].tangent;o=la[o.d].tangent;ea[D]=U.x;ea[D+1]=U.y;ea[D+2]=U.z;ea[D+3]=U.w;ea[D+4]=T.x;ea[D+5]=T.y;ea[D+6]=T.z;ea[D+7]=T.w;ea[D+8]=M.x;ea[D+9]=M.y;ea[D+10]=M.z;ea[D+11]=M.w;ea[D+12]=o.x;ea[D+13]=o.y;ea[D+14]=o.z;ea[D+15]=o.w;D+=16}if(n)if(K.length==4&&wa)for(o=0;o<4;o++){H=K[o];ha[W]=H.x;ha[W+1]=H.y;ha[W+2]=H.z;W+=3}else for(o=0;o<4;o++){ha[W]=H.x;ha[W+1]=H.y;ha[W+2]=H.z;W+=3}if(I&&v)for(o=0;o<4;o++){K=v[o];ka[R]=K.u;ka[R+1]=K.v;R+=2}if(u){pa[Z]=V;pa[Z+1]=V+1;pa[Z+2]=V+2;
|
|
|
-pa[Z+3]=V;pa[Z+4]=V+2;pa[Z+5]=V+3;Z+=6;da[S]=V;da[S+1]=V+1;da[S+2]=V;da[S+3]=V+3;da[S+4]=V+1;da[S+5]=V+2;da[S+6]=V+2;da[S+7]=V+3;S+=8;V+=4}}}if(m){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,X,r)}if(n){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,ha,r)}if(w&&qa.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,ea,r)}if(I&&R>0){b.bindBuffer(b.ARRAY_BUFFER,g.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,
|
|
|
-ka,r)}if(u){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,pa,r);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,da,r)}};this.setLineBuffers=function(g,l,r,m){var u,I,n=g.vertices,w=n.length,B=g.__vertexArray,v=g.__lineArray;if(r)for(r=0;r<w;r++){u=n[r].position;I=r*3;B[I]=u.x;B[I+1]=u.y;B[I+2]=u.z}if(m)for(r=0;r<w;r++)v[r]=r;b.bindBuffer(b.ARRAY_BUFFER,g.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,B,l);
|
|
|
-b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,g.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,v,l)};this.setParticleBuffers=function(){};this.renderBuffer=function(g,l,r,m,u,I){var n,w,B,v;if(!m.program){if(m instanceof THREE.MeshDepthMaterial){d(m,THREE.ShaderLib.depth);m.uniforms.mNear.value=g.near;m.uniforms.mFar.value=g.far}else if(m instanceof THREE.MeshNormalMaterial)d(m,THREE.ShaderLib.normal);else if(m instanceof THREE.MeshBasicMaterial){d(m,THREE.ShaderLib.basic);e(m,r)}else if(m instanceof
|
|
|
-THREE.MeshLambertMaterial){d(m,THREE.ShaderLib.lambert);e(m,r)}else if(m instanceof THREE.MeshPhongMaterial){d(m,THREE.ShaderLib.phong);e(m,r)}else if(m instanceof THREE.LineBasicMaterial){d(m,THREE.ShaderLib.basic);f(m,r)}var o,K,H;o=v=w=0;for(K=l.length;o<K;o++){H=l[o];H instanceof THREE.DirectionalLight&&v++;H instanceof THREE.PointLight&&w++}if(w+v<=4){o=v;w=w}else{o=Math.ceil(4*v/(w+v));w=4-o}w={directional:o,point:w};v={fog:r,map:m.map,env_map:m.env_map,maxDirLights:w.directional,maxPointLights:w.point};
|
|
|
-w=m.fragment_shader;o=m.vertex_shader;K=b.createProgram();H=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.fog?"#define USE_FOG":"",v.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+
|
|
|
-v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.map?"#define USE_MAP":"",v.env_map?"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");b.attachShader(K,h("fragment",H+w));b.attachShader(K,h("vertex",v+o));b.linkProgram(K);b.getProgramParameter(K,b.LINK_STATUS)||
|
|
|
-alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(K,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");K.uniforms={};K.attributes={};m.program=K;w=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(n in m.uniforms)w.push(n);n=m.program;o=0;for(K=w.length;o<K;o++){H=w[o];n.uniforms[H]=b.getUniformLocation(n,H)}n=m.program;w=["position","normal","uv","tangent"];o=0;for(K=w.length;o<K;o++){H=w[o];n.attributes[H]=b.getAttribLocation(n,
|
|
|
-H)}}n=m.program;if(n!=k){b.useProgram(n);k=n}this.loadCamera(n,g);this.loadMatrices(n);if(m instanceof THREE.MeshPhongMaterial||m instanceof THREE.MeshLambertMaterial){this.setupLights(n,l);g=this.lights;m.uniforms.enableLighting.value=g.directional.length+g.point.length;m.uniforms.ambientLightColor.value=g.ambient;m.uniforms.directionalLightColor.value=g.directional.colors;m.uniforms.directionalLightDirection.value=g.directional.positions;m.uniforms.pointLightColor.value=g.point.colors;m.uniforms.pointLightPosition.value=
|
|
|
-g.point.positions}if(m instanceof THREE.MeshBasicMaterial||m instanceof THREE.MeshLambertMaterial||m instanceof THREE.MeshPhongMaterial)e(m,r);m instanceof THREE.LineBasicMaterial&&f(m,r);if(m instanceof THREE.MeshPhongMaterial){m.uniforms.ambient.value.setRGB(m.ambient.r,m.ambient.g,m.ambient.b);m.uniforms.specular.value.setRGB(m.specular.r,m.specular.g,m.specular.b);m.uniforms.shininess.value=m.shininess}r=m.uniforms;for(B in r)if(o=n.uniforms[B]){l=r[B];w=l.type;g=l.value;if(w=="i")b.uniform1i(o,
|
|
|
-g);else if(w=="f")b.uniform1f(o,g);else if(w=="fv1")b.uniform1fv(o,g);else if(w=="fv")b.uniform3fv(o,g);else if(w=="v2")b.uniform2f(o,g.x,g.y);else if(w=="v3")b.uniform3f(o,g.x,g.y,g.z);else if(w=="c")b.uniform3f(o,g.r,g.g,g.b);else if(w=="t"){b.uniform1i(o,g);if(l=l.texture)if(l.image instanceof Array&&l.image.length==6){l=l;g=g;if(l.image.length==6){if(!l.image.__webGLTextureCube&&!l.image.__cubeMapInitialized&&l.image.loadCount==6){l.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,
|
|
|
-l.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(w=0;w<6;++w)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+w,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,l.image[w]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);l.image.__cubeMapInitialized=
|
|
|
-true}b.activeTexture(b.TEXTURE0+g);b.bindTexture(b.TEXTURE_CUBE_MAP,l.image.__webGLTextureCube)}}else{l=l;g=g;if(!l.__webGLTexture&&l.image.loaded){l.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,l.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,l.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,i(l.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,i(l.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,i(l.mag_filter));b.texParameteri(b.TEXTURE_2D,
|
|
|
-b.TEXTURE_MIN_FILTER,i(l.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+g);b.bindTexture(b.TEXTURE_2D,l.__webGLTexture)}}}B=n.attributes;b.bindBuffer(b.ARRAY_BUFFER,u.__webGLVertexBuffer);b.vertexAttribPointer(B.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(B.position);if(B.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLNormalBuffer);b.vertexAttribPointer(B.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(B.normal)}if(B.tangent>=
|
|
|
-0){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLTangentBuffer);b.vertexAttribPointer(B.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(B.tangent)}if(B.uv>=0)if(u.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLUVBuffer);b.vertexAttribPointer(B.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(B.uv)}else b.disableVertexAttribArray(B.uv);if(m.wireframe||m instanceof THREE.LineBasicMaterial){B=m.wireframe_linewidth!==undefined?m.wireframe_linewidth:m.linewidth!==undefined?m.linewidth:1;m=m instanceof
|
|
|
-THREE.LineBasicMaterial&&I.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(B);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,u.__webGLLineBuffer);b.drawElements(m,u.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,u.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,u.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(g,l,r,m,u,I,n){var w,B,v,o,K;v=0;for(o=m.materials.length;v<o;v++){w=m.materials[v];if(w instanceof THREE.MeshFaceMaterial){w=0;for(B=u.materials.length;w<
|
|
|
-B;w++)if((K=u.materials[w])&&K.blending==I&&K.opacity<1==n){this.setBlending(K.blending);this.renderBuffer(g,l,r,K,u,m)}}else if((K=w)&&K.blending==I&&K.opacity<1==n){this.setBlending(K.blending);this.renderBuffer(g,l,r,K,u,m)}}};this.render=function(g,l,r,m){var u,I,n,w=g.lights,B=g.fog;this.initWebGLObjects(g);m=m!==undefined?m:true;if(r&&!r.__webGLFramebuffer){r.__webGLFramebuffer=b.createFramebuffer();r.__webGLRenderbuffer=b.createRenderbuffer();r.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,
|
|
|
-r.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,r.width,r.height);b.bindTexture(b.TEXTURE_2D,r.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,i(r.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,i(r.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,i(r.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,i(r.min_filter));b.texImage2D(b.TEXTURE_2D,0,i(r.format),r.width,r.height,0,i(r.format),i(r.type),null);b.bindFramebuffer(b.FRAMEBUFFER,
|
|
|
-r.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,r.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,r.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(r){u=r.__webGLFramebuffer;n=r.width;I=r.height}else{u=null;n=p.width;I=p.height}if(u!=j){b.bindFramebuffer(b.FRAMEBUFFER,u);b.viewport(0,0,n,I);m&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);
|
|
|
-j=u}this.autoClear&&this.clear();l.autoUpdateMatrix&&l.updateMatrix();A.set(l.matrix.flatten());N.set(l.projectionMatrix.flatten());m=0;for(u=g.__webGLObjects.length;m<u;m++){I=g.__webGLObjects[m];n=I.object;I=I.buffer;if(n.visible){this.setupMatrices(n,l);this.renderPass(l,w,B,n,I,THREE.NormalBlending,false)}}m=0;for(u=g.__webGLObjects.length;m<u;m++){I=g.__webGLObjects[m];n=I.object;I=I.buffer;if(n.visible){this.setupMatrices(n,l);if(n.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);
|
|
|
-n.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW)}this.renderPass(l,w,B,n,I,THREE.AdditiveBlending,false);this.renderPass(l,w,B,n,I,THREE.SubtractiveBlending,false);this.renderPass(l,w,B,n,I,THREE.AdditiveBlending,true);this.renderPass(l,w,B,n,I,THREE.SubtractiveBlending,true);this.renderPass(l,w,B,n,I,THREE.NormalBlending,true)}}if(r&&r.min_filter!==THREE.NearestFilter&&r.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,r.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,
|
|
|
-null)}};this.initWebGLObjects=function(g){function l(v,o,K,H){if(v[o]==undefined){g.__webGLObjects.push({buffer:K,object:H});v[o]=1}}var r,m,u,I,n,w,B;if(!g.__webGLObjects){g.__webGLObjects=[];g.__webGLObjectsMap={}}r=0;for(m=g.objects.length;r<m;r++){u=g.objects[r];n=u.geometry;if(g.__webGLObjectsMap[u.id]==undefined)g.__webGLObjectsMap[u.id]={};B=g.__webGLObjectsMap[u.id];if(u instanceof THREE.Mesh){for(I in n.geometryChunks){w=n.geometryChunks[I];if(!w.__webGLVertexBuffer){this.createMeshBuffers(w);
|
|
|
-this.initMeshBuffers(w,u);n.__dirtyVertices=true;n.__dirtyElements=true;n.__dirtyUvs=true;n.__dirtyNormals=true;n.__dirtyTangents=true}if(n.__dirtyVertices||n.__dirtyElements||n.__dirtyUvs)this.setMeshBuffers(w,u,b.DYNAMIC_DRAW,n.__dirtyVertices,n.__dirtyElements,n.__dirtyUvs,n.__dirtyNormals,n.__dirtyTangents);l(B,I,w,u)}n.__dirtyVertices=false;n.__dirtyElements=false;n.__dirtyUvs=false;n.__dirtyNormals=false;n.__dirtyTangents=false}else if(u instanceof THREE.Line){if(!n.__webGLVertexBuffer){this.createLineBuffers(n);
|
|
|
-this.initLineBuffers(n);n.__dirtyVertices=true;n.__dirtyElements=true}n.__dirtyVertices&&this.setLineBuffers(n,b.DYNAMIC_DRAW,n.__dirtyVertices,n.__dirtyElements);l(B,0,n,u);n.__dirtyVertices=false;n.__dirtyElements=false}else if(u instanceof THREE.ParticleSystem){n.__webGLVertexBuffer||this.createParticleBuffers(n);l(B,0,n,u)}}};this.removeObject=function(g,l){var r,m;for(r=g.__webGLObjects.length-1;r>=0;r--){m=g.__webGLObjects[r].object;l==m&&g.__webGLObjects.splice(r,1)}};this.setupMatrices=function(g,
|
|
|
-l){g.autoUpdateMatrix&&g.updateMatrix();C.multiply(l.matrix,g.matrix);E.set(C.flatten());F=THREE.Matrix4.makeInvert3x3(C).transpose();P.set(F.m);Q.set(g.matrix.flatten())};this.loadMatrices=function(g){b.uniformMatrix4fv(g.uniforms.viewMatrix,false,A);b.uniformMatrix4fv(g.uniforms.modelViewMatrix,false,E);b.uniformMatrix4fv(g.uniforms.projectionMatrix,false,N);b.uniformMatrix3fv(g.uniforms.normalMatrix,false,P);b.uniformMatrix4fv(g.uniforms.objectMatrix,false,Q)};this.loadCamera=function(g,l){b.uniform3f(g.uniforms.cameraPosition,
|
|
|
-l.position.x,l.position.y,l.position.z)};this.setBlending=function(g){switch(g){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(g,l){if(g){!l||l=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(g=="back")b.cullFace(b.BACK);else g=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);
|
|
|
-b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
-THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, 1.0 ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
|
|
|
-envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
|
-map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
|
-lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
|
|
-lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"};
|
|
|
-THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},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:[]}}};
|
|
|
-THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}",
|
|
|
-vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",
|
|
|
-THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
|
|
|
-THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,
|
|
|
-THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},
|
|
|
-shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,
|
|
|
-"gl_FragColor = mapColor * totalLight * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
|
|
|
-THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};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};
|
|
|
+// 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()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+
|
|
|
+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
|
|
|
+THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
|
|
|
+this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,d){this.x=a||0;this.y=c||0;this.z=d||0};
|
|
|
+THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
|
|
|
+cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,d=this.y,e=this.z;this.x=d*a.z-e*a.y;this.y=e*a.x-c*a.z;this.z=c*a.y-d*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
|
|
|
+a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+d*d+a*a)},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=
|
|
|
+-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
|
|
|
+THREE.Vector4=function(a,c,d,e){this.x=a||0;this.y=c||0;this.z=d||0;this.w=e||1};
|
|
|
+THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
|
|
|
+return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
|
|
|
+THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,g=[];a=0;for(c=e.length;a<c;a++){d=e[a];if(d instanceof THREE.Mesh)g=g.concat(this.intersectObject(d))}g.sort(function(h,m){return h.distance-m.distance});return g},intersectObject:function(a){function c(K,p,V,F){F=F.clone().subSelf(p);V=V.clone().subSelf(p);var f=K.clone().subSelf(p);K=F.dot(F);p=F.dot(V);F=F.dot(f);var k=V.dot(V);V=V.dot(f);f=1/(K*k-p*p);k=(k*F-p*V)*f;K=(K*V-p*F)*f;return k>0&&K>0&&k+K<1}var d,e,g,h,m,b,i,j,w,z,
|
|
|
+u,y=a.geometry,H=y.vertices,J=[];d=0;for(e=y.faces.length;d<e;d++){g=y.faces[d];z=this.origin.clone();u=this.direction.clone();h=a.matrix.multiplyVector3(H[g.a].position.clone());m=a.matrix.multiplyVector3(H[g.b].position.clone());b=a.matrix.multiplyVector3(H[g.c].position.clone());i=g instanceof THREE.Face4?a.matrix.multiplyVector3(H[g.d].position.clone()):null;j=a.rotationMatrix.multiplyVector3(g.normal.clone());w=u.dot(j);if(w<0){j=j.dot((new THREE.Vector3).sub(h,z))/w;z=z.addSelf(u.multiplyScalar(j));
|
|
|
+if(g instanceof THREE.Face3){if(c(z,h,m,b)){g={distance:this.origin.distanceTo(z),point:z,face:g,object:a};J.push(g)}}else if(g instanceof THREE.Face4)if(c(z,h,m,i)||c(z,m,b,i)){g={distance:this.origin.distanceTo(z),point:z,face:g,object:a};J.push(g)}}}return J}};
|
|
|
+THREE.Rectangle=function(){function a(){h=e-c;m=g-d}var c,d,e,g,h,m,b=true;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return h};this.getHeight=function(){return m};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(i,j,w,z){b=false;c=i;d=j;e=w;g=z;a()};this.addPoint=function(i,j){if(b){b=false;c=i;d=j;e=i;g=j}else{c=c<i?c:i;d=d<j?d:j;e=e>i?e:i;g=g>j?
|
|
|
+g:j}a()};this.add3Points=function(i,j,w,z,u,y){if(b){b=false;c=i<w?i<u?i:u:w<u?w:u;d=j<z?j<y?j:y:z<y?z:y;e=i>w?i>u?i:u:w>u?w:u;g=j>z?j>y?j:y:z>y?z:y}else{c=i<w?i<u?i<c?i:c:u<c?u:c:w<u?w<c?w:c:u<c?u:c;d=j<z?j<y?j<d?j:d:y<d?y:d:z<y?z<d?z:d:y<d?y:d;e=i>w?i>u?i>e?i:e:u>e?u:e:w>u?w>e?w:e:u>e?u:e;g=j>z?j>y?j>g?j:g:y>g?y:g:z>y?z>g?z:g:y>g?y:g}a()};this.addRectangle=function(i){if(b){b=false;c=i.getLeft();d=i.getTop();e=i.getRight();g=i.getBottom()}else{c=c<i.getLeft()?c:i.getLeft();d=d<i.getTop()?d:i.getTop();
|
|
|
+e=e>i.getRight()?e:i.getRight();g=g>i.getBottom()?g:i.getBottom()}a()};this.inflate=function(i){c-=i;d-=i;e+=i;g+=i;a()};this.minSelf=function(i){c=c>i.getLeft()?c:i.getLeft();d=d>i.getTop()?d:i.getTop();e=e<i.getRight()?e:i.getRight();g=g<i.getBottom()?g:i.getBottom();a()};this.instersects=function(i){return Math.min(e,i.getRight())-Math.max(c,i.getLeft())>=0&&Math.min(g,i.getBottom())-Math.max(d,i.getTop())>=0};this.empty=function(){b=true;g=e=d=c=0;a()};this.isEmpty=function(){return b};this.toString=
|
|
|
+function(){return"THREE.Rectangle ( left: "+c+", right: "+e+", top: "+d+", bottom: "+g+", width: "+h+", height: "+m+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a;a=this.m[1];this.m[1]=this.m[3];this.m[3]=a;a=this.m[2];this.m[2]=this.m[6];this.m[6]=a;a=this.m[5];this.m[5]=this.m[7];this.m[7]=a;return this}};
|
|
|
+THREE.Matrix4=function(a,c,d,e,g,h,m,b,i,j,w,z,u,y,H,J){this.n11=a||1;this.n12=c||0;this.n13=d||0;this.n14=e||0;this.n21=g||0;this.n22=h||1;this.n23=m||0;this.n24=b||0;this.n31=i||0;this.n32=j||0;this.n33=w||1;this.n34=z||0;this.n41=u||0;this.n42=y||0;this.n43=H||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,e,g,h,m,b,i,j,w,z,u,y,H,J){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=g;this.n22=h;this.n23=m;this.n24=b;this.n31=i;this.n32=j;this.n33=w;this.n34=z;this.n41=u;this.n42=y;this.n43=H;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 e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,h=THREE.Matrix4.__tmpVec3;h.sub(a,c).normalize();e.cross(d,h).normalize();g.cross(h,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);
|
|
|
+this.n31=h.x;this.n32=h.y;this.n33=h.z;this.n34=-h.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,g=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*g;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*g;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,g=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*g;a.y=this.n21*c+this.n22*d+this.n23*
|
|
|
+e+this.n24*g;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*g;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*g;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,g=a.n13,h=a.n14,m=a.n21,b=a.n22,i=a.n23,j=a.n24,w=a.n31,
|
|
|
+z=a.n32,u=a.n33,y=a.n34,H=a.n41,J=a.n42,K=a.n43,p=a.n44,V=c.n11,F=c.n12,f=c.n13,k=c.n14,q=c.n21,l=c.n22,r=c.n23,C=c.n24,n=c.n31,t=c.n32,v=c.n33,s=c.n34,o=c.n41,E=c.n42,B=c.n43,O=c.n44;this.n11=d*V+e*q+g*n+h*o;this.n12=d*F+e*l+g*t+h*E;this.n13=d*f+e*r+g*v+h*B;this.n14=d*k+e*C+g*s+h*O;this.n21=m*V+b*q+i*n+j*o;this.n22=m*F+b*l+i*t+j*E;this.n23=m*f+b*r+i*v+j*B;this.n24=m*k+b*C+i*s+j*O;this.n31=w*V+z*q+u*n+y*o;this.n32=w*F+z*l+u*t+y*E;this.n33=w*f+z*r+u*v+y*B;this.n34=w*k+z*C+u*s+y*O;this.n41=H*V+J*q+
|
|
|
+K*n+p*o;this.n42=H*F+J*l+K*t+p*E;this.n43=H*f+J*r+K*v+p*B;this.n44=H*k+J*C+K*s+p*O;return this},multiplySelf:function(a){var c=this.n11,d=this.n12,e=this.n13,g=this.n14,h=this.n21,m=this.n22,b=this.n23,i=this.n24,j=this.n31,w=this.n32,z=this.n33,u=this.n34,y=this.n41,H=this.n42,J=this.n43,K=this.n44,p=a.n11,V=a.n21,F=a.n31,f=a.n41,k=a.n12,q=a.n22,l=a.n32,r=a.n42,C=a.n13,n=a.n23,t=a.n33,v=a.n43,s=a.n14,o=a.n24,E=a.n34;a=a.n44;this.n11=c*p+d*V+e*F+g*f;this.n12=c*k+d*q+e*l+g*r;this.n13=c*C+d*n+e*t+g*
|
|
|
+v;this.n14=c*s+d*o+e*E+g*a;this.n21=h*p+m*V+b*F+i*f;this.n22=h*k+m*q+b*l+i*r;this.n23=h*C+m*n+b*t+i*v;this.n24=h*s+m*o+b*E+i*a;this.n31=j*p+w*V+z*F+u*f;this.n32=j*k+w*q+z*l+u*r;this.n33=j*C+w*n+z*t+u*v;this.n34=j*s+w*o+z*E+u*a;this.n41=y*p+H*V+J*F+K*f;this.n42=y*k+H*q+J*l+K*r;this.n43=y*C+H*n+J*t+K*v;this.n44=y*s+H*o+J*E+K*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=
|
|
|
+a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,e=this.n14,g=this.n21,h=this.n22,m=this.n23,b=this.n24,i=this.n31,j=this.n32,w=this.n33,z=this.n34,u=this.n41,y=this.n42,H=this.n43,J=this.n44;return e*m*j*u-d*b*j*u-e*h*w*u+c*b*w*u+d*h*z*u-c*m*z*u-e*m*i*y+d*b*i*y+e*g*w*y-a*b*w*y-d*g*z*y+a*m*z*y+e*h*i*H-c*b*i*H-e*g*j*H+a*b*j*H+c*g*z*H-a*h*z*H-d*h*i*J+c*m*i*J+d*g*j*J-a*m*j*J-c*g*w*J+a*h*w*J},transpose:function(){function a(c,d,
|
|
|
+e){var g=c[d];c[d]=c[e];c[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=
|
|
|
+this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},
|
|
|
+setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),g=1-d,h=a.x,m=a.y,b=a.z,i=g*h,j=g*m;this.set(i*h+d,i*m-e*b,i*b+e*m,0,i*m+e*b,j*m+d,j*b-e*h,0,i*b-e*m,j*b+e*h,g*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 e=new THREE.Matrix4;e.n14=a;e.n24=c;e.n34=d;return e};THREE.Matrix4.scaleMatrix=function(a,c,d){var e=new THREE.Matrix4;e.n11=a;e.n22=c;e.n33=d;return e};
|
|
|
+THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.n22=c.n33=Math.cos(a);c.n32=Math.sin(a);c.n23=-c.n32;return c};THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.n11=c.n33=Math.cos(a);c.n13=Math.sin(a);c.n31=-c.n13;return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.n11=c.n22=Math.cos(a);c.n21=Math.sin(a);c.n12=-c.n21;return c};
|
|
|
+THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var d=new THREE.Matrix4,e=Math.cos(c),g=Math.sin(c),h=1-e,m=a.x,b=a.y,i=a.z,j=h*m,w=h*b;d.n11=j*m+e;d.n12=j*b-g*i;d.n13=j*i+g*b;d.n21=j*b+g*i;d.n22=w*b+e;d.n23=w*i-g*m;d.n31=j*i-g*b;d.n32=w*i+g*m;d.n33=h*i*i+e;return d};
|
|
|
+THREE.Matrix4.makeInvert=function(a){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,h=a.n21,m=a.n22,b=a.n23,i=a.n24,j=a.n31,w=a.n32,z=a.n33,u=a.n34,y=a.n41,H=a.n42,J=a.n43,K=a.n44,p=new THREE.Matrix4;p.n11=b*u*H-i*z*H+i*w*J-m*u*J-b*w*K+m*z*K;p.n12=g*z*H-e*u*H-g*w*J+d*u*J+e*w*K-d*z*K;p.n13=e*i*H-g*b*H+g*m*J-d*i*J-e*m*K+d*b*K;p.n14=g*b*w-e*i*w-g*m*z+d*i*z+e*m*u-d*b*u;p.n21=i*z*y-b*u*y-i*j*J+h*u*J+b*j*K-h*z*K;p.n22=e*u*y-g*z*y+g*j*J-c*u*J-e*j*K+c*z*K;p.n23=g*b*y-e*i*y-g*h*J+c*i*J+e*h*K-c*b*K;p.n24=e*i*j-g*b*j+
|
|
|
+g*h*z-c*i*z-e*h*u+c*b*u;p.n31=m*u*y-i*w*y+i*j*H-h*u*H-m*j*K+h*w*K;p.n32=g*w*y-d*u*y-g*j*H+c*u*H+d*j*K-c*w*K;p.n33=e*i*y-g*m*y+g*h*H-c*i*H-d*h*K+c*m*K;p.n34=g*m*j-d*i*j-g*h*w+c*i*w+d*h*u-c*m*u;p.n41=b*w*y-m*z*y-b*j*H+h*z*H+m*j*J-h*w*J;p.n42=d*z*y-e*w*y+e*j*H-c*z*H-d*j*J+c*w*J;p.n43=e*m*y-d*b*y-e*h*H+c*b*H+d*h*J-c*m*J;p.n44=d*b*j-e*m*j+e*h*w-c*b*w-d*h*z+c*m*z;p.multiplyScalar(1/a.determinant());return p};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.flatten();a=a.m33;var d=c[10]*c[5]-c[6]*c[9],e=-c[10]*c[1]+c[2]*c[9],g=c[6]*c[1]-c[2]*c[5],h=-c[10]*c[4]+c[6]*c[8],m=c[10]*c[0]-c[2]*c[8],b=-c[6]*c[0]+c[2]*c[4],i=c[9]*c[4]-c[5]*c[8],j=-c[9]*c[0]+c[1]*c[8],w=c[5]*c[0]-c[1]*c[4];c=c[0]*d+c[1]*h+c[2]*i;if(c==0)throw"matrix not invertible";c=1/c;a.m[0]=c*d;a.m[1]=c*e;a.m[2]=c*g;a.m[3]=c*h;a.m[4]=c*m;a.m[5]=c*b;a.m[6]=c*i;a.m[7]=c*j;a.m[8]=c*w;return a};
|
|
|
+THREE.Matrix4.makeFrustum=function(a,c,d,e,g,h){var m,b,i;m=new THREE.Matrix4;b=2*g/(c-a);i=2*g/(e-d);a=(c+a)/(c-a);d=(e+d)/(e-d);e=-(h+g)/(h-g);g=-2*h*g/(h-g);m.n11=b;m.n12=0;m.n13=a;m.n14=0;m.n21=0;m.n22=i;m.n23=d;m.n24=0;m.n31=0;m.n32=0;m.n33=e;m.n34=g;m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(a,c,d,e){var g;a=d*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,d,e)};
|
|
|
+THREE.Matrix4.makeOrtho=function(a,c,d,e,g,h){var m,b,i,j;m=new THREE.Matrix4;b=c-a;i=d-e;j=h-g;a=(c+a)/b;d=(d+e)/i;g=(h+g)/j;m.n11=2/b;m.n12=0;m.n13=0;m.n14=-a;m.n21=0;m.n22=2/i;m.n23=0;m.n24=-d;m.n31=0;m.n32=0;m.n33=-2/j;m.n34=-g;m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
|
+THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
|
|
|
+THREE.Face3=function(a,c,d,e,g){this.a=a;this.b=c;this.c=d;this.centroid=new THREE.Vector3;this.normal=e instanceof THREE.Vector3?e:new THREE.Vector3;this.vertexNormals=e instanceof Array?e:[];this.materials=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
|
|
|
+THREE.Face4=function(a,c,d,e,g,h){this.a=a;this.b=c;this.c=d;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=h instanceof Array?h:[h]};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.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
|
|
|
+THREE.Geometry.prototype={computeCentroids:function(){var a,c,d;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];d.centroid.set(0,0,0);if(d instanceof THREE.Face3){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);d.centroid.divideScalar(3)}else if(d instanceof THREE.Face4){d.centroid.addSelf(this.vertices[d.a].position);d.centroid.addSelf(this.vertices[d.b].position);d.centroid.addSelf(this.vertices[d.c].position);
|
|
|
+d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var c,d,e,g,h,m,b=new THREE.Vector3,i=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){h=this.vertices[e];h.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){h=this.faces[e];if(a&&h.vertexNormals.length){b.set(0,0,0);c=0;for(d=h.normal.length;c<d;c++)b.addSelf(h.vertexNormals[c]);b.divideScalar(3)}else{c=this.vertices[h.a];d=this.vertices[h.b];m=this.vertices[h.c];b.sub(m.position,
|
|
|
+d.position);i.sub(c.position,d.position);b.crossSelf(i)}b.isZero()||b.normalize();h.normal.copy(b)}},computeVertexNormals:function(){var a,c,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
|
|
|
+new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<
|
|
|
+c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(s,o,E,B,O,N,G){h=s.vertices[o].position;m=s.vertices[E].position;b=s.vertices[B].position;i=g[O];j=g[N];w=g[G];z=m.x-h.x;u=b.x-h.x;y=m.y-h.y;H=b.y-h.y;
|
|
|
+J=m.z-h.z;K=b.z-h.z;p=j.u-i.u;V=w.u-i.u;F=j.v-i.v;f=w.v-i.v;k=1/(p*f-V*F);r.set((f*z-F*u)*k,(f*y-F*H)*k,(f*J-F*K)*k);C.set((p*u-V*z)*k,(p*H-V*y)*k,(p*K-V*J)*k);q[o].addSelf(r);q[E].addSelf(r);q[B].addSelf(r);l[o].addSelf(C);l[E].addSelf(C);l[B].addSelf(C)}var c,d,e,g,h,m,b,i,j,w,z,u,y,H,J,K,p,V,F,f,k,q=[],l=[],r=new THREE.Vector3,C=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector3,v=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){q[c]=new THREE.Vector3;l[c]=new THREE.Vector3}c=0;
|
|
|
+for(d=this.faces.length;c<d;c++){e=this.faces[c];g=this.uvs[c];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
|
|
|
+this.vertices[e.d].normal.copy(e.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){v.copy(this.vertices[c].normal);e=q[c];n.copy(e);n.subSelf(v.multiplyScalar(v.dot(e))).normalize();t.cross(this.vertices[c].normal,e);e=t.dot(l[c]);e=e<0?-1:1;this.vertices[c].tangent.set(n.x,n.y,n.z,e)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
|
+z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
|
|
|
+this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(w){var z=[];c=0;for(d=w.length;c<d;c++)w[c]==undefined?z.push("undefined"):z.push(w[c].toString());return z.join("_")}var c,d,e,g,h,m,b,i,j={};e=0;for(g=this.faces.length;e<g;e++){h=this.faces[e];
|
|
|
+m=h.materials;b=a(m);if(j[b]==undefined)j[b]={hash:b,counter:0};i=j[b].hash+"_"+j[b].counter;if(this.geometryChunks[i]==undefined)this.geometryChunks[i]={faces:[],materials:m,vertices:0};h=h instanceof THREE.Face3?3:4;if(this.geometryChunks[i].vertices+h>65535){j[b].counter+=1;i=j[b].hash+"_"+j[b].counter;if(this.geometryChunks[i]==undefined)this.geometryChunks[i]={faces:[],materials:m,vertices:0}}this.geometryChunks[i].faces.push(e);this.geometryChunks[i].vertices+=h}},toString:function(){return"THREE.Geometry ( vertices: "+
|
|
|
+this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
|
|
|
+THREE.Camera=function(a,c,d,e){this.fov=a;this.aspect=c;this.near=d;this.far=e;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
|
|
|
+this.translateZ=function(g){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(g);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()};
|
|
|
+THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;
|
|
|
+THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.PointLight;
|
|
|
+THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true};
|
|
|
+THREE.Object3D.prototype={updateMatrix:function(){var a=this.position,c=this.rotation,d=this.scale,e=this.tmpMatrix;this.matrix.setTranslation(a.x,a.y,a.z);this.rotationMatrix.identity();if(c.x!=0){e.setRotX(c.x);this.matrix.multiplySelf(e);this.rotationMatrix.multiplySelf(e)}if(c.y!=0){e.setRotY(c.y);this.matrix.multiplySelf(e);this.rotationMatrix.multiplySelf(e)}if(c.z!=0){e.setRotZ(c.z);this.matrix.multiplySelf(e);this.rotationMatrix.multiplySelf(e)}if(d.x!=0||d.y!=0||d.z!=0){e.setScale(d.x,d.y,
|
|
|
+d.z);this.matrix.multiplySelf(e)}}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.autoUpdateMatrix=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.LineBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.linewidth=1;this.linejoin=this.linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.linewidth!==undefined)this.linewidth=a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin}};
|
|
|
+THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>)"}};
|
|
|
+THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
|
|
|
+a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
+undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
|
+THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+
|
|
|
+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
|
|
|
+THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.env_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=
|
|
|
+a.map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
+undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
|
+THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+
|
|
|
+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
|
|
|
+THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.env_map=this.specular_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=
|
|
|
+this.wireframe_linecap="round";if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.map!==undefined)this.map=a.map;if(a.specular_map!==undefined)this.specular_map=a.specular_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=
|
|
|
+a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==
|
|
|
+undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
|
+THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>map: "+this.map+"<br/>specular_map: "+this.specular_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>opacity: "+this.opacity+"<br/>shading: "+this.shading+"<br/>wireframe: "+
|
|
|
+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshPhongMaterialCounter={value:0};
|
|
|
+THREE.MeshDepthMaterial=function(a){this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial"}};
|
|
|
+THREE.MeshNormalMaterial=function(a){this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial"}};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
|
|
|
+THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=a.vertex_shader;if(a.uniforms!==
|
|
|
+undefined)this.uniforms=a.uniforms;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin}};
|
|
|
+THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
|
|
|
+THREE.ParticleBasicMaterial=function(a){this.color=new THREE.Color(16777215);this.map=null;this.opacity=1;this.blending=THREE.NormalBlending;this.offset=new THREE.Vector2;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.map!==undefined)this.map=a.map;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
|
|
+THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>color: "+this.color+"<br/>map: "+this.map+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};
|
|
|
+THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};
|
|
|
+THREE.Texture=function(a,c,d,e,g,h){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=d!==undefined?d:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=h!==undefined?h:THREE.LinearMipMapLinearFilter};
|
|
|
+THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;
|
|
|
+THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
|
|
|
+THREE.RenderTarget=function(a,c,d){this.width=a;this.height=c;d=d||{};this.wrap_s=d.wrap_s!==undefined?d.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=d.wrap_t!==undefined?d.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=d.mag_filter!==undefined?d.mag_filter:THREE.LinearFilter;this.min_filter=d.min_filter!==undefined?d.min_filter:THREE.LinearMipMapLinearFilter;this.format=d.format!==undefined?d.format:THREE.RGBFormat;this.type=d.type!==undefined?d.type:THREE.UnsignedByteType};
|
|
|
+var Uniforms={clone:function(a){var c,d,e,g={};for(c in a){g[c]={};for(d in a[c]){e=a[c][d];g[c][d]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var c,d,e,g={};for(c=0;c<a.length;c++){e=this.clone(a[c]);for(d in e)g[d]=e[d]}return g}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
|
+THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
|
|
|
+THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
|
|
|
+THREE.Fog=function(a,c,d){this.color=new THREE.Color(a);this.near=c||1;this.far=d||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4};
|
|
|
+THREE.Projector=function(){function a(l,r){return r.z-l.z}function c(l,r){var C=0,n=1,t=l.z+l.w,v=r.z+r.w,s=-l.z+l.w,o=-r.z+r.w;if(t>=0&&v>=0&&s>=0&&o>=0)return true;else if(t<0&&v<0||s<0&&o<0)return false;else{if(t<0)C=Math.max(C,t/(t-v));else if(v<0)n=Math.min(n,t/(t-v));if(s<0)C=Math.max(C,s/(s-o));else if(o<0)n=Math.min(n,s/(s-o));if(n<C)return false;else{l.lerpSelf(r,C);r.lerpSelf(l,1-n);return true}}}var d,e,g=[],h,m,b,i=[],j,w,z=[],u,y,H=[],J=new THREE.Vector4,K=new THREE.Vector4,p=new THREE.Matrix4,
|
|
|
+V=new THREE.Matrix4,F=[],f=new THREE.Vector4,k=new THREE.Vector4,q;this.projectObjects=function(l,r,C){var n=[],t,v;e=0;p.multiply(r.projectionMatrix,r.matrix);F[0]=new THREE.Vector4(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);F[1]=new THREE.Vector4(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);F[2]=new THREE.Vector4(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);F[3]=new THREE.Vector4(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);F[4]=new THREE.Vector4(p.n41-p.n31,p.n42-p.n32,p.n43-
|
|
|
+p.n33,p.n44-p.n34);F[5]=new THREE.Vector4(p.n41+p.n31,p.n42+p.n32,p.n43+p.n33,p.n44+p.n34);r=0;for(t=F.length;r<t;r++){v=F[r];v.divideScalar(Math.sqrt(v.x*v.x+v.y*v.y+v.z*v.z))}t=l.objects;l=0;for(r=t.length;l<r;l++){v=t[l];var s;if(!(s=!v.visible)){if(s=v instanceof THREE.Mesh){a:{s=void 0;for(var o=v.position,E=-v.geometry.boundingSphere.radius*Math.max(v.scale.x,Math.max(v.scale.y,v.scale.z)),B=0;B<6;B++){s=F[B].x*o.x+F[B].y*o.y+F[B].z*o.z+F[B].w;if(s<=E){s=false;break a}}s=true}s=!s}s=s}if(!s){d=
|
|
|
+g[e]=g[e]||new THREE.RenderableObject;J.copy(v.position);p.multiplyVector3(J);d.object=v;d.z=J.z;n.push(d);e++}}C&&n.sort(a);return n};this.projectScene=function(l,r,C){var n=[],t=r.near,v=r.far,s,o,E,B,O,N,G,W,P,I,L,T,Q,x,M,R;b=w=y=0;r.autoUpdateMatrix&&r.updateMatrix();p.multiply(r.projectionMatrix,r.matrix);N=this.projectObjects(l,r,true);l=0;for(s=N.length;l<s;l++){G=N[l].object;if(G.visible){G.autoUpdateMatrix&&G.updateMatrix();W=G.matrix;P=G.rotationMatrix;I=G.materials;L=G.overdraw;if(G instanceof
|
|
|
+THREE.Mesh){T=G.geometry;Q=T.vertices;o=0;for(E=Q.length;o<E;o++){x=Q[o];x.positionWorld.copy(x.position);W.multiplyVector3(x.positionWorld);B=x.positionScreen;B.copy(x.positionWorld);p.multiplyVector4(B);B.x/=B.w;B.y/=B.w;x.__visible=B.z>t&&B.z<v}T=T.faces;o=0;for(E=T.length;o<E;o++){x=T[o];if(x instanceof THREE.Face3){B=Q[x.a];O=Q[x.b];M=Q[x.c];if(B.__visible&&O.__visible&&M.__visible)if(G.doubleSided||G.flipSided!=(M.positionScreen.x-B.positionScreen.x)*(O.positionScreen.y-B.positionScreen.y)-
|
|
|
+(M.positionScreen.y-B.positionScreen.y)*(O.positionScreen.x-B.positionScreen.x)<0){h=i[b]=i[b]||new THREE.RenderableFace3;h.v1.positionWorld.copy(B.positionWorld);h.v2.positionWorld.copy(O.positionWorld);h.v3.positionWorld.copy(M.positionWorld);h.v1.positionScreen.copy(B.positionScreen);h.v2.positionScreen.copy(O.positionScreen);h.v3.positionScreen.copy(M.positionScreen);h.normalWorld.copy(x.normal);P.multiplyVector3(h.normalWorld);h.centroidWorld.copy(x.centroid);W.multiplyVector3(h.centroidWorld);
|
|
|
+h.centroidScreen.copy(h.centroidWorld);p.multiplyVector3(h.centroidScreen);M=x.vertexNormals;q=h.vertexNormalsWorld;B=0;for(O=M.length;B<O;B++){R=q[B]=q[B]||new THREE.Vector3;R.copy(M[B]);P.multiplyVector3(R)}h.z=h.centroidScreen.z;h.meshMaterials=I;h.faceMaterials=x.materials;h.overdraw=L;if(G.geometry.uvs[o]){h.uvs[0]=G.geometry.uvs[o][0];h.uvs[1]=G.geometry.uvs[o][1];h.uvs[2]=G.geometry.uvs[o][2]}n.push(h);b++}}else if(x instanceof THREE.Face4){B=Q[x.a];O=Q[x.b];M=Q[x.c];R=Q[x.d];if(B.__visible&&
|
|
|
+O.__visible&&M.__visible&&R.__visible)if(G.doubleSided||G.flipSided!=((R.positionScreen.x-B.positionScreen.x)*(O.positionScreen.y-B.positionScreen.y)-(R.positionScreen.y-B.positionScreen.y)*(O.positionScreen.x-B.positionScreen.x)<0||(O.positionScreen.x-M.positionScreen.x)*(R.positionScreen.y-M.positionScreen.y)-(O.positionScreen.y-M.positionScreen.y)*(R.positionScreen.x-M.positionScreen.x)<0)){h=i[b]=i[b]||new THREE.RenderableFace3;h.v1.positionWorld.copy(B.positionWorld);h.v2.positionWorld.copy(O.positionWorld);
|
|
|
+h.v3.positionWorld.copy(R.positionWorld);h.v1.positionScreen.copy(B.positionScreen);h.v2.positionScreen.copy(O.positionScreen);h.v3.positionScreen.copy(R.positionScreen);h.normalWorld.copy(x.normal);P.multiplyVector3(h.normalWorld);h.centroidWorld.copy(x.centroid);W.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);p.multiplyVector3(h.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=I;h.faceMaterials=x.materials;h.overdraw=L;if(G.geometry.uvs[o]){h.uvs[0]=G.geometry.uvs[o][0];
|
|
|
+h.uvs[1]=G.geometry.uvs[o][1];h.uvs[2]=G.geometry.uvs[o][3]}n.push(h);b++;m=i[b]=i[b]||new THREE.RenderableFace3;m.v1.positionWorld.copy(O.positionWorld);m.v2.positionWorld.copy(M.positionWorld);m.v3.positionWorld.copy(R.positionWorld);m.v1.positionScreen.copy(O.positionScreen);m.v2.positionScreen.copy(M.positionScreen);m.v3.positionScreen.copy(R.positionScreen);m.normalWorld.copy(h.normalWorld);m.centroidWorld.copy(h.centroidWorld);m.centroidScreen.copy(h.centroidScreen);m.z=m.centroidScreen.z;m.meshMaterials=
|
|
|
+I;m.faceMaterials=x.materials;m.overdraw=L;if(G.geometry.uvs[o]){m.uvs[0]=G.geometry.uvs[o][1];m.uvs[1]=G.geometry.uvs[o][2];m.uvs[2]=G.geometry.uvs[o][3]}n.push(m);b++}}}}else if(G instanceof THREE.Line){V.multiply(p,W);Q=G.geometry.vertices;x=Q[0];x.positionScreen.copy(x.position);V.multiplyVector4(x.positionScreen);o=1;for(E=Q.length;o<E;o++){B=Q[o];B.positionScreen.copy(B.position);V.multiplyVector4(B.positionScreen);O=Q[o-1];f.copy(B.positionScreen);k.copy(O.positionScreen);if(c(f,k)){f.multiplyScalar(1/
|
|
|
+f.w);k.multiplyScalar(1/k.w);j=z[w]=z[w]||new THREE.RenderableLine;j.v1.positionScreen.copy(f);j.v2.positionScreen.copy(k);j.z=Math.max(f.z,k.z);j.materials=G.materials;n.push(j);w++}}}else if(G instanceof THREE.Particle){K.set(G.position.x,G.position.y,G.position.z,1);p.multiplyVector4(K);K.z/=K.w;if(K.z>0&&K.z<1){u=H[y]=H[y]||new THREE.RenderableParticle;u.x=K.x/K.w;u.y=K.y/K.w;u.z=K.z;u.rotation=G.rotation.z;u.scale.x=G.scale.x*Math.abs(u.x-(K.x+r.projectionMatrix.n11)/(K.w+r.projectionMatrix.n14));
|
|
|
+u.scale.y=G.scale.y*Math.abs(u.y-(K.y+r.projectionMatrix.n22)/(K.w+r.projectionMatrix.n24));u.materials=G.materials;n.push(u);y++}}}}C&&n.sort(a);return n};this.unprojectVector=function(l,r){var C=new THREE.Matrix4;C.multiply(THREE.Matrix4.makeInvert(r.matrix),THREE.Matrix4.makeInvert(r.projectionMatrix));C.multiplyVector3(l);return l}};
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,d,e,g,h;this.domElement=document.createElement("div");this.setSize=function(m,b){d=m;e=b;g=d/2;h=e/2};this.render=function(m,b){var i,j,w,z,u,y,H,J;a=c.projectScene(m,b);i=0;for(j=a.length;i<j;i++){u=a[i];if(u instanceof THREE.RenderableParticle){H=u.x*g+g;J=u.y*h+h;w=0;for(z=u.material.length;w<z;w++){y=u.material[w];if(y instanceof THREE.ParticleDOMMaterial){y=y.domElement;y.style.left=H+"px";y.style.top=J+"px"}}}}}};
|
|
|
+THREE.CanvasRenderer=function(){function a(da){if(u!=da)j.globalAlpha=u=da}function c(da){if(y!=da){switch(da){case THREE.NormalBlending:j.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:j.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:j.globalCompositeOperation="darker"}y=da}}var d=null,e=new THREE.Projector,g=document.createElement("canvas"),h,m,b,i,j=g.getContext("2d"),w=null,z=null,u=1,y=0,H=null,J=null,K=1,p,V,F,f,k,q,l,r,C,n=new THREE.Color,
|
|
|
+t=new THREE.Color,v=new THREE.Color,s=new THREE.Color,o=new THREE.Color,E,B,O,N,G,W,P,I,L,T=new THREE.Rectangle,Q=new THREE.Rectangle,x=new THREE.Rectangle,M=false,R=new THREE.Color,ea=new THREE.Color,ba=new THREE.Color,Z=new THREE.Color,ja=Math.PI*2,Y=new THREE.Vector3,qa,ka,fa,ha,sa,ua,va=16;qa=document.createElement("canvas");qa.width=qa.height=2;ka=qa.getContext("2d");ka.fillStyle="rgba(0,0,0,1)";ka.fillRect(0,0,2,2);fa=ka.getImageData(0,0,2,2);ha=fa.data;sa=document.createElement("canvas");sa.width=
|
|
|
+sa.height=va;ua=sa.getContext("2d");ua.translate(-va/2,-va/2);ua.scale(va,va);va--;this.domElement=g;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(da,ra){h=da;m=ra;b=h/2;i=m/2;g.width=h;g.height=m;T.set(-b,-i,b,i);u=1;y=0;J=H=null;K=1};this.setClearColor=function(da,ra){w=da!==null?new THREE.Color(da):null;z=ra;Q.set(-b,-i,b,i);j.setTransform(1,0,0,-1,b,i);this.clear()};this.clear=function(){if(!Q.isEmpty()){Q.inflate(1);Q.minSelf(T);if(w!==null){c(THREE.NormalBlending);
|
|
|
+a(1);j.fillStyle="rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*255)+","+Math.floor(w.b*255)+","+z+")";j.fillRect(Q.getX(),Q.getY(),Q.getWidth(),Q.getHeight())}else j.clearRect(Q.getX(),Q.getY(),Q.getWidth(),Q.getHeight());Q.empty()}};this.render=function(da,ra){function Ma(A){var X,U,D,S=A.lights;ea.setRGB(0,0,0);ba.setRGB(0,0,0);Z.setRGB(0,0,0);A=0;for(X=S.length;A<X;A++){U=S[A];D=U.color;if(U instanceof THREE.AmbientLight){ea.r+=D.r;ea.g+=D.g;ea.b+=D.b}else if(U instanceof THREE.DirectionalLight){ba.r+=
|
|
|
+D.r;ba.g+=D.g;ba.b+=D.b}else if(U instanceof THREE.PointLight){Z.r+=D.r;Z.g+=D.g;Z.b+=D.b}}}function Aa(A,X,U,D){var S,$,ca,ga,ia=A.lights;A=0;for(S=ia.length;A<S;A++){$=ia[A];ca=$.color;ga=$.intensity;if($ instanceof THREE.DirectionalLight){$=U.dot($.position)*ga;if($>0){D.r+=ca.r*$;D.g+=ca.g*$;D.b+=ca.b*$}}else if($ instanceof THREE.PointLight){Y.sub($.position,X);Y.normalize();$=U.dot(Y)*ga;if($>0){D.r+=ca.r*$;D.g+=ca.g*$;D.b+=ca.b*$}}}}function Na(A,X,U){if(U.opacity!=0){a(U.opacity);c(U.blending);
|
|
|
+var D,S,$,ca,ga,ia;if(U instanceof THREE.ParticleBasicMaterial){if(U.map){ca=U.map;ga=ca.width>>1;ia=ca.height>>1;S=X.scale.x*b;$=X.scale.y*i;U=S*ga;D=$*ia;x.set(A.x-U,A.y-D,A.x+U,A.y+D);if(!T.instersects(x))return;j.save();j.translate(A.x,A.y);j.rotate(-X.rotation);j.scale(S,-$);j.translate(-ga,-ia);j.drawImage(ca,0,0);j.restore()}j.beginPath();j.moveTo(A.x-10,A.y);j.lineTo(A.x+10,A.y);j.moveTo(A.x,A.y-10);j.lineTo(A.x,A.y+10);j.closePath();j.strokeStyle="rgb(255,255,0)";j.stroke()}else if(U instanceof
|
|
|
+THREE.ParticleCircleMaterial){if(M){R.r=ea.r+ba.r+Z.r;R.g=ea.g+ba.g+Z.g;R.b=ea.b+ba.b+Z.b;n.r=U.color.r*R.r;n.g=U.color.g*R.g;n.b=U.color.b*R.b;n.updateStyleString()}else n.__styleString=U.color.__styleString;U=X.scale.x*b;D=X.scale.y*i;x.set(A.x-U,A.y-D,A.x+U,A.y+D);if(T.instersects(x)){S=n.__styleString;if(J!=S)j.fillStyle=J=S;j.save();j.translate(A.x,A.y);j.rotate(-X.rotation);j.scale(U,D);j.beginPath();j.arc(0,0,1,0,ja,true);j.closePath();j.fill();j.restore()}}}}function Oa(A,X,U,D){if(D.opacity!=
|
|
|
+0){a(D.opacity);c(D.blending);j.beginPath();j.moveTo(A.positionScreen.x,A.positionScreen.y);j.lineTo(X.positionScreen.x,X.positionScreen.y);j.closePath();if(D instanceof THREE.LineBasicMaterial){n.__styleString=D.color.__styleString;A=D.linewidth;if(K!=A)j.lineWidth=K=A;A=n.__styleString;if(H!=A)j.strokeStyle=H=A;j.stroke();x.inflate(D.linewidth*2)}}}function Ia(A,X,U,D,S,$){if(S.opacity!=0){a(S.opacity);c(S.blending);f=A.positionScreen.x;k=A.positionScreen.y;q=X.positionScreen.x;l=X.positionScreen.y;
|
|
|
+r=U.positionScreen.x;C=U.positionScreen.y;j.beginPath();j.moveTo(f,k);j.lineTo(q,l);j.lineTo(r,C);j.lineTo(f,k);j.closePath();if(S instanceof THREE.MeshBasicMaterial)if(S.map)S.map.image.loaded&&S.map.mapping instanceof THREE.UVMapping&&xa(f,k,q,l,r,C,S.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);else if(S.env_map){if(S.env_map.image.loaded)if(S.env_map.mapping instanceof THREE.SphericalReflectionMapping){A=ra.matrix;Y.copy(D.vertexNormalsWorld[0]);N=(Y.x*A.n11+Y.y*
|
|
|
+A.n12+Y.z*A.n13)*0.5+0.5;G=-(Y.x*A.n21+Y.y*A.n22+Y.z*A.n23)*0.5+0.5;Y.copy(D.vertexNormalsWorld[1]);W=(Y.x*A.n11+Y.y*A.n12+Y.z*A.n13)*0.5+0.5;P=-(Y.x*A.n21+Y.y*A.n22+Y.z*A.n23)*0.5+0.5;Y.copy(D.vertexNormalsWorld[2]);I=(Y.x*A.n11+Y.y*A.n12+Y.z*A.n13)*0.5+0.5;L=-(Y.x*A.n21+Y.y*A.n22+Y.z*A.n23)*0.5+0.5;xa(f,k,q,l,r,C,S.env_map.image,N,G,W,P,I,L)}}else S.wireframe?Ba(S.color.__styleString,S.wireframe_linewidth):Ca(S.color.__styleString);else if(S instanceof THREE.MeshLambertMaterial){if(S.map&&!S.wireframe){S.map.mapping instanceof
|
|
|
+THREE.UVMapping&&xa(f,k,q,l,r,C,S.map.image,D.uvs[0].u,D.uvs[0].v,D.uvs[1].u,D.uvs[1].v,D.uvs[2].u,D.uvs[2].v);c(THREE.SubtractiveBlending)}if(M)if(!S.wireframe&&S.shading==THREE.SmoothShading&&D.vertexNormalsWorld.length==3){t.r=v.r=s.r=ea.r;t.g=v.g=s.g=ea.g;t.b=v.b=s.b=ea.b;Aa($,D.v1.positionWorld,D.vertexNormalsWorld[0],t);Aa($,D.v2.positionWorld,D.vertexNormalsWorld[1],v);Aa($,D.v3.positionWorld,D.vertexNormalsWorld[2],s);o.r=(v.r+s.r)*0.5;o.g=(v.g+s.g)*0.5;o.b=(v.b+s.b)*0.5;O=Ja(t,v,s,o);xa(f,
|
|
|
+k,q,l,r,C,O,0,0,1,0,0,1)}else{R.r=ea.r;R.g=ea.g;R.b=ea.b;Aa($,D.centroidWorld,D.normalWorld,R);n.r=S.color.r*R.r;n.g=S.color.g*R.g;n.b=S.color.b*R.b;n.updateStyleString();S.wireframe?Ba(n.__styleString,S.wireframe_linewidth):Ca(n.__styleString)}else S.wireframe?Ba(S.color.__styleString,S.wireframe_linewidth):Ca(S.color.__styleString)}else if(S instanceof THREE.MeshDepthMaterial){E=ra.near;B=ra.far;t.r=t.g=t.b=1-Ea(A.positionScreen.z,E,B);v.r=v.g=v.b=1-Ea(X.positionScreen.z,E,B);s.r=s.g=s.b=1-Ea(U.positionScreen.z,
|
|
|
+E,B);o.r=(v.r+s.r)*0.5;o.g=(v.g+s.g)*0.5;o.b=(v.b+s.b)*0.5;O=Ja(t,v,s,o);xa(f,k,q,l,r,C,O,0,0,1,0,0,1)}else if(S instanceof THREE.MeshNormalMaterial){n.r=Fa(D.normalWorld.x);n.g=Fa(D.normalWorld.y);n.b=Fa(D.normalWorld.z);n.updateStyleString();S.wireframe?Ba(n.__styleString,S.wireframe_linewidth):Ca(n.__styleString)}}}function Ba(A,X){if(H!=A)j.strokeStyle=H=A;if(K!=X)j.lineWidth=K=X;j.stroke();x.inflate(X*2)}function Ca(A){if(J!=A)j.fillStyle=J=A;j.fill()}function xa(A,X,U,D,S,$,ca,ga,ia,na,la,oa,
|
|
|
+ya){var ta,pa;ta=ca.width-1;pa=ca.height-1;ga*=ta;ia*=pa;na*=ta;la*=pa;oa*=ta;ya*=pa;U-=A;D-=X;S-=A;$-=X;na-=ga;la-=ia;oa-=ga;ya-=ia;pa=1/(na*ya-oa*la);ta=(ya*U-la*S)*pa;la=(ya*D-la*$)*pa;U=(na*S-oa*U)*pa;D=(na*$-oa*D)*pa;A=A-ta*ga-U*ia;X=X-la*ga-D*ia;j.save();j.transform(ta,la,U,D,A,X);j.clip();j.drawImage(ca,0,0);j.restore()}function Ja(A,X,U,D){var S=~~(A.r*255),$=~~(A.g*255);A=~~(A.b*255);var ca=~~(X.r*255),ga=~~(X.g*255);X=~~(X.b*255);var ia=~~(U.r*255),na=~~(U.g*255);U=~~(U.b*255);var la=~~(D.r*
|
|
|
+255),oa=~~(D.g*255);D=~~(D.b*255);ha[0]=S<0?0:S>255?255:S;ha[1]=$<0?0:$>255?255:$;ha[2]=A<0?0:A>255?255:A;ha[4]=ca<0?0:ca>255?255:ca;ha[5]=ga<0?0:ga>255?255:ga;ha[6]=X<0?0:X>255?255:X;ha[8]=ia<0?0:ia>255?255:ia;ha[9]=na<0?0:na>255?255:na;ha[10]=U<0?0:U>255?255:U;ha[12]=la<0?0:la>255?255:la;ha[13]=oa<0?0:oa>255?255:oa;ha[14]=D<0?0:D>255?255:D;ka.putImageData(fa,0,0);ua.drawImage(qa,0,0);return sa}function Ea(A,X,U){A=(A-X)/(U-X);return A*A*(3-2*A)}function Fa(A){A=(A+1)*0.5;return A<0?0:A>1?1:A}function Ga(A,
|
|
|
+X){var U=X.x-A.x,D=X.y-A.y,S=1/Math.sqrt(U*U+D*D);U*=S;D*=S;X.x+=U;X.y+=D;A.x-=U;A.y-=D}var Da,Ka,aa,ma,wa,Ha,La,za;j.setTransform(1,0,0,-1,b,i);this.autoClear&&this.clear();d=e.projectScene(da,ra,this.sortElements);j.fillStyle="rgba( 0, 255, 255, 0.5 )";j.fillRect(T.getX(),T.getY(),T.getWidth(),T.getHeight());(M=da.lights.length>0)&&Ma(da);Da=0;for(Ka=d.length;Da<Ka;Da++){aa=d[Da];x.empty();if(aa instanceof THREE.RenderableParticle){p=aa;p.x*=b;p.y*=i;ma=0;for(wa=aa.materials.length;ma<wa;ma++)Na(p,
|
|
|
+aa,aa.materials[ma],da)}else if(aa instanceof THREE.RenderableLine){p=aa.v1;V=aa.v2;p.positionScreen.x*=b;p.positionScreen.y*=i;V.positionScreen.x*=b;V.positionScreen.y*=i;x.addPoint(p.positionScreen.x,p.positionScreen.y);x.addPoint(V.positionScreen.x,V.positionScreen.y);if(T.instersects(x)){ma=0;for(wa=aa.materials.length;ma<wa;)Oa(p,V,aa,aa.materials[ma++],da)}}else if(aa instanceof THREE.RenderableFace3){p=aa.v1;V=aa.v2;F=aa.v3;p.positionScreen.x*=b;p.positionScreen.y*=i;V.positionScreen.x*=b;
|
|
|
+V.positionScreen.y*=i;F.positionScreen.x*=b;F.positionScreen.y*=i;if(aa.overdraw){Ga(p.positionScreen,V.positionScreen);Ga(V.positionScreen,F.positionScreen);Ga(F.positionScreen,p.positionScreen)}x.add3Points(p.positionScreen.x,p.positionScreen.y,V.positionScreen.x,V.positionScreen.y,F.positionScreen.x,F.positionScreen.y);if(T.instersects(x)){ma=0;for(wa=aa.meshMaterials.length;ma<wa;){za=aa.meshMaterials[ma++];if(za instanceof THREE.MeshFaceMaterial){Ha=0;for(La=aa.faceMaterials.length;Ha<La;)(za=
|
|
|
+aa.faceMaterials[Ha++])&&Ia(p,V,F,aa,za,da)}else Ia(p,V,F,aa,za,da)}}}Q.addRectangle(x)}j.lineWidth=1;j.strokeStyle="rgba( 255, 0, 0, 0.5 )";j.strokeRect(Q.getX(),Q.getY(),Q.getWidth(),Q.getHeight());j.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function a(N,G,W){var P,I,L,T;P=0;for(I=N.lights.length;P<I;P++){L=N.lights[P];if(L instanceof THREE.DirectionalLight){T=G.normalWorld.dot(L.position)*L.intensity;if(T>0){W.r+=L.color.r*T;W.g+=L.color.g*T;W.b+=L.color.b*T}}else if(L instanceof THREE.PointLight){C.sub(L.position,G.centroidWorld);C.normalize();T=G.normalWorld.dot(C)*L.intensity;if(T>0){W.r+=L.color.r*T;W.g+=L.color.g*T;W.b+=L.color.b*T}}}}function c(N,G,W,P,I,L){s=e(o++);s.setAttribute("d","M "+N.positionScreen.x+
|
|
|
+" "+N.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+"z");if(I instanceof THREE.MeshBasicMaterial)F.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshLambertMaterial)if(V){f.r=k.r;f.g=k.g;f.b=k.b;a(L,P,f);F.r=I.color.r*f.r;F.g=I.color.g*f.g;F.b=I.color.b*f.b;F.updateStyleString()}else F.__styleString=I.color.__styleString;else if(I instanceof THREE.MeshDepthMaterial){r=1-I.__2near/(I.__farPlusNear-P.z*I.__farMinusNear);
|
|
|
+F.setRGB(r,r,r)}else I instanceof THREE.MeshNormalMaterial&&F.setRGB(g(P.normalWorld.x),g(P.normalWorld.y),g(P.normalWorld.z));I.wireframe?s.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+I.wireframe_linewidth+"; stroke-opacity: "+I.opacity+"; stroke-linecap: "+I.wireframe_linecap+"; stroke-linejoin: "+I.wireframe_linejoin):s.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+I.opacity);b.appendChild(s)}function d(N,G,W,P,I,L,T){s=e(o++);s.setAttribute("d",
|
|
|
+"M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+G.positionScreen.x+" "+G.positionScreen.y+" L "+W.positionScreen.x+","+W.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");if(L instanceof THREE.MeshBasicMaterial)F.__styleString=L.color.__styleString;else if(L instanceof THREE.MeshLambertMaterial)if(V){f.r=k.r;f.g=k.g;f.b=k.b;a(T,I,f);F.r=L.color.r*f.r;F.g=L.color.g*f.g;F.b=L.color.b*f.b;F.updateStyleString()}else F.__styleString=L.color.__styleString;else if(L instanceof THREE.MeshDepthMaterial){r=
|
|
|
+1-L.__2near/(L.__farPlusNear-I.z*L.__farMinusNear);F.setRGB(r,r,r)}else L instanceof THREE.MeshNormalMaterial&&F.setRGB(g(I.normalWorld.x),g(I.normalWorld.y),g(I.normalWorld.z));L.wireframe?s.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+L.wireframe_linewidth+"; stroke-opacity: "+L.opacity+"; stroke-linecap: "+L.wireframe_linecap+"; stroke-linejoin: "+L.wireframe_linejoin):s.setAttribute("style","fill: "+F.__styleString+"; fill-opacity: "+L.opacity);b.appendChild(s)}
|
|
|
+function e(N){if(n[N]==null){n[N]=document.createElementNS("http://www.w3.org/2000/svg","path");O==0&&n[N].setAttribute("shape-rendering","crispEdges");return n[N]}return n[N]}function g(N){return N<0?Math.min((1+N)*0.5,0.5):0.5+Math.min(N*0.5,0.5)}var h=null,m=new THREE.Projector,b=document.createElementNS("http://www.w3.org/2000/svg","svg"),i,j,w,z,u,y,H,J,K=new THREE.Rectangle,p=new THREE.Rectangle,V=false,F=new THREE.Color(16777215),f=new THREE.Color(16777215),k=new THREE.Color(0),q=new THREE.Color(0),
|
|
|
+l=new THREE.Color(0),r,C=new THREE.Vector3,n=[],t=[],v=[],s,o,E,B,O=1;this.domElement=b;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(N){switch(N){case "high":O=1;break;case "low":O=0}};this.setSize=function(N,G){i=N;j=G;w=i/2;z=j/2;b.setAttribute("viewBox",-w+" "+-z+" "+i+" "+j);b.setAttribute("width",i);b.setAttribute("height",j);K.set(-w,-z,w,z)};this.clear=function(){for(;b.childNodes.length>0;)b.removeChild(b.childNodes[0])};this.render=function(N,G){var W,P,
|
|
|
+I,L,T,Q,x,M;this.autoClear&&this.clear();h=m.projectScene(N,G,this.sortElements);B=E=o=0;if(V=N.lights.length>0){x=N.lights;k.setRGB(0,0,0);q.setRGB(0,0,0);l.setRGB(0,0,0);W=0;for(P=x.length;W<P;W++){I=x[W];L=I.color;if(I instanceof THREE.AmbientLight){k.r+=L.r;k.g+=L.g;k.b+=L.b}else if(I instanceof THREE.DirectionalLight){q.r+=L.r;q.g+=L.g;q.b+=L.b}else if(I instanceof THREE.PointLight){l.r+=L.r;l.g+=L.g;l.b+=L.b}}}W=0;for(P=h.length;W<P;W++){x=h[W];p.empty();if(x instanceof THREE.RenderableParticle){u=
|
|
|
+x;u.x*=w;u.y*=-z;I=0;for(L=x.materials.length;I<L;I++)if(M=x.materials[I]){T=u;Q=x;M=M;var R=E++;if(t[R]==null){t[R]=document.createElementNS("http://www.w3.org/2000/svg","circle");O==0&&t[R].setAttribute("shape-rendering","crispEdges")}s=t[R];s.setAttribute("cx",T.x);s.setAttribute("cy",T.y);s.setAttribute("r",Q.scale.x*w);if(M instanceof THREE.ParticleCircleMaterial){if(V){f.r=k.r+q.r+l.r;f.g=k.g+q.g+l.g;f.b=k.b+q.b+l.b;F.r=M.color.r*f.r;F.g=M.color.g*f.g;F.b=M.color.b*f.b;F.updateStyleString()}else F=
|
|
|
+M.color;s.setAttribute("style","fill: "+F.__styleString)}b.appendChild(s)}}else if(x instanceof THREE.RenderableLine){u=x.v1;y=x.v2;u.positionScreen.x*=w;u.positionScreen.y*=-z;y.positionScreen.x*=w;y.positionScreen.y*=-z;p.addPoint(u.positionScreen.x,u.positionScreen.y);p.addPoint(y.positionScreen.x,y.positionScreen.y);if(K.instersects(p)){I=0;for(L=x.materials.length;I<L;)if(M=x.materials[I++]){T=u;Q=y;M=M;R=B++;if(v[R]==null){v[R]=document.createElementNS("http://www.w3.org/2000/svg","line");O==
|
|
|
+0&&v[R].setAttribute("shape-rendering","crispEdges")}s=v[R];s.setAttribute("x1",T.positionScreen.x);s.setAttribute("y1",T.positionScreen.y);s.setAttribute("x2",Q.positionScreen.x);s.setAttribute("y2",Q.positionScreen.y);if(M instanceof THREE.LineBasicMaterial){F.__styleString=M.color.__styleString;s.setAttribute("style","fill: none; stroke: "+F.__styleString+"; stroke-width: "+M.linewidth+"; stroke-opacity: "+M.opacity+"; stroke-linecap: "+M.linecap+"; stroke-linejoin: "+M.linejoin);b.appendChild(s)}}}}else if(x instanceof
|
|
|
+THREE.RenderableFace3){u=x.v1;y=x.v2;H=x.v3;u.positionScreen.x*=w;u.positionScreen.y*=-z;y.positionScreen.x*=w;y.positionScreen.y*=-z;H.positionScreen.x*=w;H.positionScreen.y*=-z;p.addPoint(u.positionScreen.x,u.positionScreen.y);p.addPoint(y.positionScreen.x,y.positionScreen.y);p.addPoint(H.positionScreen.x,H.positionScreen.y);if(K.instersects(p)){I=0;for(L=x.meshMaterials.length;I<L;){M=x.meshMaterials[I++];if(M instanceof THREE.MeshFaceMaterial){T=0;for(Q=x.faceMaterials.length;T<Q;)(M=x.faceMaterials[T++])&&
|
|
|
+c(u,y,H,x,M,N)}else M&&c(u,y,H,x,M,N)}}}else if(x instanceof THREE.RenderableFace4){u=x.v1;y=x.v2;H=x.v3;J=x.v4;u.positionScreen.x*=w;u.positionScreen.y*=-z;y.positionScreen.x*=w;y.positionScreen.y*=-z;H.positionScreen.x*=w;H.positionScreen.y*=-z;J.positionScreen.x*=w;J.positionScreen.y*=-z;p.addPoint(u.positionScreen.x,u.positionScreen.y);p.addPoint(y.positionScreen.x,y.positionScreen.y);p.addPoint(H.positionScreen.x,H.positionScreen.y);p.addPoint(J.positionScreen.x,J.positionScreen.y);if(K.instersects(p)){I=
|
|
|
+0;for(L=x.meshMaterials.length;I<L;){M=x.meshMaterials[I++];if(M instanceof THREE.MeshFaceMaterial){T=0;for(Q=x.faceMaterials.length;T<Q;)(M=x.faceMaterials[T++])&&d(u,y,H,J,x,M,N)}else M&&d(u,y,H,J,x,M,N)}}}}}};
|
|
|
+THREE.WebGLRenderer=function(a){function c(f,k){f.fragment_shader=k.fragment_shader;f.vertex_shader=k.vertex_shader;f.uniforms=Uniforms.clone(k.uniforms)}function d(f,k){f.uniforms.color.value.setRGB(f.color.r*f.opacity,f.color.g*f.opacity,f.color.b*f.opacity);f.uniforms.opacity.value=f.opacity;f.uniforms.map.texture=f.map;f.uniforms.env_map.texture=f.env_map;f.uniforms.reflectivity.value=f.reflectivity;f.uniforms.refraction_ratio.value=f.refraction_ratio;f.uniforms.combine.value=f.combine;f.uniforms.useRefract.value=
|
|
|
+f.env_map&&f.env_map.mapping instanceof THREE.CubeRefractionMapping;if(k){f.uniforms.fogColor.value.setHex(k.color.hex);if(k instanceof THREE.Fog){f.uniforms.fogNear.value=k.near;f.uniforms.fogFar.value=k.far}else if(k instanceof THREE.FogExp2)f.uniforms.fogDensity.value=k.density}}function e(f,k){f.uniforms.color.value.setRGB(f.color.r*f.opacity,f.color.g*f.opacity,f.color.b*f.opacity);f.uniforms.opacity.value=f.opacity;if(k){f.uniforms.fogColor.value.setHex(k.color.hex);if(k instanceof THREE.Fog){f.uniforms.fogNear.value=
|
|
|
+k.near;f.uniforms.fogFar.value=k.far}else if(k instanceof THREE.FogExp2)f.uniforms.fogDensity.value=k.density}}function g(f,k){var q;if(f=="fragment")q=b.createShader(b.FRAGMENT_SHADER);else if(f=="vertex")q=b.createShader(b.VERTEX_SHADER);b.shaderSource(q,k);b.compileShader(q);if(!b.getShaderParameter(q,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(q));return null}return q}function h(f){switch(f){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 m=document.createElement("canvas"),b,i=null,j=null,w=new THREE.Matrix4,z,u=new Float32Array(16),y=new Float32Array(16),H=new Float32Array(16),J=new Float32Array(9),
|
|
|
+K=new Float32Array(16),p=true,V=new THREE.Color(0),F=0;if(a){if(a.antialias!==undefined)p=a.antialias;a.clearColor!==undefined&&V.setHex(a.clearColor);if(a.clearAlpha!==undefined)F=a.clearAlpha}this.domElement=m;this.autoClear=true;(function(f,k,q){try{b=m.getContext("experimental-webgl",{antialias:f})}catch(l){}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(k.r,k.g,k.b,q)})(p,V,F);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,k){m.width=f;m.height=k;b.viewport(0,0,m.width,m.height)};this.setClearColor=function(f,k){var q=new THREE.Color(f);b.clearColor(q.r,q.g,q.b,k)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.setupLights=
|
|
|
+function(f,k){var q,l,r,C=0,n=0,t=0,v,s,o,E=this.lights,B=E.directional.colors,O=E.directional.positions,N=E.point.colors,G=E.point.positions,W=0,P=0;q=0;for(l=k.length;q<l;q++){r=k[q];v=r.color;s=r.position;o=r.intensity;if(r instanceof THREE.AmbientLight){C+=v.r;n+=v.g;t+=v.b}else if(r instanceof THREE.DirectionalLight){B[W*3]=v.r*o;B[W*3+1]=v.g*o;B[W*3+2]=v.b*o;O[W*3]=s.x;O[W*3+1]=s.y;O[W*3+2]=s.z;W+=1}else if(r instanceof THREE.PointLight){N[P*3]=v.r*o;N[P*3+1]=v.g*o;N[P*3+2]=v.b*o;G[P*3]=s.x;
|
|
|
+G[P*3+1]=s.y;G[P*3+2]=s.z;P+=1}}E.point.length=P;E.directional.length=W;E.ambient[0]=C;E.ambient[1]=n;E.ambient[2]=t};this.createParticleBuffers=function(f){f.__webGLVertexBuffer=b.createBuffer();f.__webGLFaceBuffer=b.createBuffer()};this.createLineBuffers=function(f){f.__webGLVertexBuffer=b.createBuffer();f.__webGLLineBuffer=b.createBuffer()};this.createMeshBuffers=function(f){f.__webGLVertexBuffer=b.createBuffer();f.__webGLNormalBuffer=b.createBuffer();f.__webGLTangentBuffer=b.createBuffer();f.__webGLUVBuffer=
|
|
|
+b.createBuffer();f.__webGLFaceBuffer=b.createBuffer();f.__webGLLineBuffer=b.createBuffer()};this.initLineBuffers=function(f){var k=f.vertices.length;f.__vertexArray=new Float32Array(k*3);f.__lineArray=new Uint16Array(k);f.__webGLLineCount=k};this.initMeshBuffers=function(f,k){var q,l,r=0,C=0,n=0,t=k.geometry.faces,v=f.faces;q=0;for(l=v.length;q<l;q++){fi=v[q];face=t[fi];if(face instanceof THREE.Face3){r+=3;C+=1;n+=3}else if(face instanceof THREE.Face4){r+=4;C+=2;n+=4}}f.__vertexArray=new Float32Array(r*
|
|
|
+3);f.__normalArray=new Float32Array(r*3);f.__tangentArray=new Float32Array(r*4);f.__uvArray=new Float32Array(r*2);f.__faceArray=new Uint16Array(C*3);f.__lineArray=new Uint16Array(n*2);r=false;q=0;for(l=k.materials.length;q<l;q++){t=k.materials[q];if(t instanceof THREE.MeshFaceMaterial){t=0;for(v=f.materials.length;t<v;t++)if(f.materials[t]&&f.materials[t].shading!=undefined&&f.materials[t].shading==THREE.SmoothShading){r=true;break}}else if(t&&t.shading!=undefined&&t.shading==THREE.SmoothShading){r=
|
|
|
+true;break}if(r)break}f.__needsSmoothNormals=r;f.__webGLFaceCount=C*3;f.__webGLLineCount=n*2};this.setMeshBuffers=function(f,k,q,l,r,C,n,t){var v,s,o,E,B,O,N,G,W,P=0,I=0,L=0,T=0,Q=0,x=0,M=0,R=f.__vertexArray,ea=f.__uvArray,ba=f.__normalArray,Z=f.__tangentArray,ja=f.__faceArray,Y=f.__lineArray,qa=f.__needsSmoothNormals,ka=k.geometry,fa=ka.vertices,ha=f.faces,sa=ka.faces,ua=ka.uvs;k=0;for(v=ha.length;k<v;k++){s=ha[k];o=sa[s];s=ua[s];E=o.vertexNormals;B=o.normal;if(o instanceof THREE.Face3){if(l){O=
|
|
|
+fa[o.a].position;N=fa[o.b].position;G=fa[o.c].position;R[I]=O.x;R[I+1]=O.y;R[I+2]=O.z;R[I+3]=N.x;R[I+4]=N.y;R[I+5]=N.z;R[I+6]=G.x;R[I+7]=G.y;R[I+8]=G.z;I+=9}if(t&&ka.hasTangents){O=fa[o.a].tangent;N=fa[o.b].tangent;G=fa[o.c].tangent;Z[x]=O.x;Z[x+1]=O.y;Z[x+2]=O.z;Z[x+3]=O.w;Z[x+4]=N.x;Z[x+5]=N.y;Z[x+6]=N.z;Z[x+7]=N.w;Z[x+8]=G.x;Z[x+9]=G.y;Z[x+10]=G.z;Z[x+11]=G.w;x+=12}if(n)if(E.length==3&&qa)for(o=0;o<3;o++){B=E[o];ba[Q]=B.x;ba[Q+1]=B.y;ba[Q+2]=B.z;Q+=3}else for(o=0;o<3;o++){ba[Q]=B.x;ba[Q+1]=B.y;
|
|
|
+ba[Q+2]=B.z;Q+=3}if(C&&s)for(o=0;o<3;o++){E=s[o];ea[L]=E.u;ea[L+1]=E.v;L+=2}if(r){ja[T]=P;ja[T+1]=P+1;ja[T+2]=P+2;T+=3;Y[M]=P;Y[M+1]=P+1;Y[M+2]=P;Y[M+3]=P+2;Y[M+4]=P+1;Y[M+5]=P+2;M+=6;P+=3}}else if(o instanceof THREE.Face4){if(l){O=fa[o.a].position;N=fa[o.b].position;G=fa[o.c].position;W=fa[o.d].position;R[I]=O.x;R[I+1]=O.y;R[I+2]=O.z;R[I+3]=N.x;R[I+4]=N.y;R[I+5]=N.z;R[I+6]=G.x;R[I+7]=G.y;R[I+8]=G.z;R[I+9]=W.x;R[I+10]=W.y;R[I+11]=W.z;I+=12}if(t&&ka.hasTangents){O=fa[o.a].tangent;N=fa[o.b].tangent;
|
|
|
+G=fa[o.c].tangent;o=fa[o.d].tangent;Z[x]=O.x;Z[x+1]=O.y;Z[x+2]=O.z;Z[x+3]=O.w;Z[x+4]=N.x;Z[x+5]=N.y;Z[x+6]=N.z;Z[x+7]=N.w;Z[x+8]=G.x;Z[x+9]=G.y;Z[x+10]=G.z;Z[x+11]=G.w;Z[x+12]=o.x;Z[x+13]=o.y;Z[x+14]=o.z;Z[x+15]=o.w;x+=16}if(n)if(E.length==4&&qa)for(o=0;o<4;o++){B=E[o];ba[Q]=B.x;ba[Q+1]=B.y;ba[Q+2]=B.z;Q+=3}else for(o=0;o<4;o++){ba[Q]=B.x;ba[Q+1]=B.y;ba[Q+2]=B.z;Q+=3}if(C&&s)for(o=0;o<4;o++){E=s[o];ea[L]=E.u;ea[L+1]=E.v;L+=2}if(r){ja[T]=P;ja[T+1]=P+1;ja[T+2]=P+2;ja[T+3]=P;ja[T+4]=P+2;ja[T+5]=P+3;
|
|
|
+T+=6;Y[M]=P;Y[M+1]=P+1;Y[M+2]=P;Y[M+3]=P+3;Y[M+4]=P+1;Y[M+5]=P+2;Y[M+6]=P+2;Y[M+7]=P+3;M+=8;P+=4}}}if(l){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,R,q)}if(n){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,ba,q)}if(t&&ka.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,Z,q)}if(C&&L>0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,ea,q)}if(r){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,
|
|
|
+f.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ja,q);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Y,q)}};this.setLineBuffers=function(f,k,q,l){var r,C,n=f.vertices,t=n.length,v=f.__vertexArray,s=f.__lineArray;if(q)for(q=0;q<t;q++){r=n[q].position;C=q*3;v[C]=r.x;v[C+1]=r.y;v[C+2]=r.z}if(l)for(q=0;q<t;q++)s[q]=q;b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,v,k);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);
|
|
|
+b.bufferData(b.ELEMENT_ARRAY_BUFFER,s,k)};this.setParticleBuffers=function(){};this.renderBuffer=function(f,k,q,l,r,C){var n,t,v,s;if(!l.program){if(l instanceof THREE.MeshDepthMaterial){c(l,THREE.ShaderLib.depth);l.uniforms.mNear.value=f.near;l.uniforms.mFar.value=f.far}else if(l instanceof THREE.MeshNormalMaterial)c(l,THREE.ShaderLib.normal);else if(l instanceof THREE.MeshBasicMaterial){c(l,THREE.ShaderLib.basic);d(l,q)}else if(l instanceof THREE.MeshLambertMaterial){c(l,THREE.ShaderLib.lambert);
|
|
|
+d(l,q)}else if(l instanceof THREE.MeshPhongMaterial){c(l,THREE.ShaderLib.phong);d(l,q)}else if(l instanceof THREE.LineBasicMaterial){c(l,THREE.ShaderLib.basic);e(l,q)}var o,E,B;o=s=t=0;for(E=k.length;o<E;o++){B=k[o];B instanceof THREE.DirectionalLight&&s++;B instanceof THREE.PointLight&&t++}if(t+s<=4){o=s;t=t}else{o=Math.ceil(4*s/(t+s));t=4-o}t={directional:o,point:t};s={fog:q,map:l.map,env_map:l.env_map,maxDirLights:t.directional,maxPointLights:t.point};t=l.fragment_shader;o=l.vertex_shader;E=b.createProgram();
|
|
|
+B=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights,s.fog?"#define USE_FOG":"",s.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",s.map?"#define USE_MAP":"",s.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");s=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights,
|
|
|
+s.map?"#define USE_MAP":"",s.env_map?"#define USE_ENVMAP":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"].join("\n");b.attachShader(E,g("fragment",B+t));b.attachShader(E,g("vertex",s+o));b.linkProgram(E);b.getProgramParameter(E,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+
|
|
|
+b.getProgramParameter(E,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");E.uniforms={};E.attributes={};l.program=E;t=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(n in l.uniforms)t.push(n);n=l.program;o=0;for(E=t.length;o<E;o++){B=t[o];n.uniforms[B]=b.getUniformLocation(n,B)}n=l.program;t=["position","normal","uv","tangent"];o=0;for(E=t.length;o<E;o++){B=t[o];n.attributes[B]=b.getAttribLocation(n,B)}}n=l.program;if(n!=i){b.useProgram(n);
|
|
|
+i=n}this.loadCamera(n,f);this.loadMatrices(n);if(l instanceof THREE.MeshPhongMaterial||l instanceof THREE.MeshLambertMaterial){this.setupLights(n,k);f=this.lights;l.uniforms.enableLighting.value=f.directional.length+f.point.length;l.uniforms.ambientLightColor.value=f.ambient;l.uniforms.directionalLightColor.value=f.directional.colors;l.uniforms.directionalLightDirection.value=f.directional.positions;l.uniforms.pointLightColor.value=f.point.colors;l.uniforms.pointLightPosition.value=f.point.positions}if(l instanceof
|
|
|
+THREE.MeshBasicMaterial||l instanceof THREE.MeshLambertMaterial||l instanceof THREE.MeshPhongMaterial)d(l,q);l instanceof THREE.LineBasicMaterial&&e(l,q);if(l instanceof THREE.MeshPhongMaterial){l.uniforms.ambient.value.setRGB(l.ambient.r,l.ambient.g,l.ambient.b);l.uniforms.specular.value.setRGB(l.specular.r,l.specular.g,l.specular.b);l.uniforms.shininess.value=l.shininess}q=l.uniforms;for(v in q)if(o=n.uniforms[v]){k=q[v];t=k.type;f=k.value;if(t=="i")b.uniform1i(o,f);else if(t=="f")b.uniform1f(o,
|
|
|
+f);else if(t=="fv1")b.uniform1fv(o,f);else if(t=="fv")b.uniform3fv(o,f);else if(t=="v2")b.uniform2f(o,f.x,f.y);else if(t=="v3")b.uniform3f(o,f.x,f.y,f.z);else if(t=="c")b.uniform3f(o,f.r,f.g,f.b);else if(t=="t"){b.uniform1i(o,f);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){k=k;f=f;if(k.image.length==6){if(!k.image.__webGLTextureCube&&!k.image.__cubeMapInitialized&&k.image.loadCount==6){k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,k.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(t=0;t<6;++t)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[t]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+
|
|
|
+f);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{k=k;f=f;if(!k.__webGLTexture&&k.image.loaded){k.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,h(k.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,h(k.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,h(k.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,h(k.min_filter));
|
|
|
+b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+f);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}v=n.attributes;b.bindBuffer(b.ARRAY_BUFFER,r.__webGLVertexBuffer);b.vertexAttribPointer(v.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.position);if(v.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLNormalBuffer);b.vertexAttribPointer(v.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.normal)}if(v.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLTangentBuffer);
|
|
|
+b.vertexAttribPointer(v.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.tangent)}if(v.uv>=0)if(r.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,r.__webGLUVBuffer);b.vertexAttribPointer(v.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(v.uv)}else b.disableVertexAttribArray(v.uv);if(l.wireframe||l instanceof THREE.LineBasicMaterial){v=l.wireframe_linewidth!==undefined?l.wireframe_linewidth:l.linewidth!==undefined?l.linewidth:1;l=l instanceof THREE.LineBasicMaterial&&C.type==THREE.LineStrip?
|
|
|
+b.LINE_STRIP:b.LINES;b.lineWidth(v);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,r.__webGLLineBuffer);b.drawElements(l,r.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,r.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,r.__webGLFaceCount,b.UNSIGNED_SHORT,0)}};this.renderPass=function(f,k,q,l,r,C,n){var t,v,s,o,E;s=0;for(o=l.materials.length;s<o;s++){t=l.materials[s];if(t instanceof THREE.MeshFaceMaterial){t=0;for(v=r.materials.length;t<v;t++)if((E=r.materials[t])&&E.blending==C&&
|
|
|
+E.opacity<1==n){this.setBlending(E.blending);this.renderBuffer(f,k,q,E,r,l)}}else if((E=t)&&E.blending==C&&E.opacity<1==n){this.setBlending(E.blending);this.renderBuffer(f,k,q,E,r,l)}}};this.render=function(f,k,q,l){var r,C,n,t=f.lights,v=f.fog;this.initWebGLObjects(f);l=l!==undefined?l:true;if(q&&!q.__webGLFramebuffer){q.__webGLFramebuffer=b.createFramebuffer();q.__webGLRenderbuffer=b.createRenderbuffer();q.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,q.__webGLRenderbuffer);
|
|
|
+b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,q.width,q.height);b.bindTexture(b.TEXTURE_2D,q.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,h(q.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,h(q.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,h(q.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,h(q.min_filter));b.texImage2D(b.TEXTURE_2D,0,h(q.format),q.width,q.height,0,h(q.format),h(q.type),null);b.bindFramebuffer(b.FRAMEBUFFER,q.__webGLFramebuffer);
|
|
|
+b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,q.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,q.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}if(q){r=q.__webGLFramebuffer;n=q.width;C=q.height}else{r=null;n=m.width;C=m.height}if(r!=j){b.bindFramebuffer(b.FRAMEBUFFER,r);b.viewport(0,0,n,C);l&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);j=r}this.autoClear&&
|
|
|
+this.clear();k.autoUpdateMatrix&&k.updateMatrix();u.set(k.matrix.flatten());H.set(k.projectionMatrix.flatten());l=0;for(r=f.__webGLObjects.length;l<r;l++){C=f.__webGLObjects[l];n=C.object;C=C.buffer;if(n.visible){this.setupMatrices(n,k);this.renderPass(k,t,v,n,C,THREE.NormalBlending,false)}}l=0;for(r=f.__webGLObjects.length;l<r;l++){C=f.__webGLObjects[l];n=C.object;C=C.buffer;if(n.visible){this.setupMatrices(n,k);if(n.doubleSided)b.disable(b.CULL_FACE);else{b.enable(b.CULL_FACE);n.flipSided?b.frontFace(b.CW):
|
|
|
+b.frontFace(b.CCW)}this.renderPass(k,t,v,n,C,THREE.AdditiveBlending,false);this.renderPass(k,t,v,n,C,THREE.SubtractiveBlending,false);this.renderPass(k,t,v,n,C,THREE.AdditiveBlending,true);this.renderPass(k,t,v,n,C,THREE.SubtractiveBlending,true);this.renderPass(k,t,v,n,C,THREE.NormalBlending,true)}}if(q&&q.min_filter!==THREE.NearestFilter&&q.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,q.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=
|
|
|
+function(f){function k(s,o,E,B){if(s[o]==undefined){f.__webGLObjects.push({buffer:E,object:B});s[o]=1}}var q,l,r,C,n,t,v;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={}}q=0;for(l=f.objects.length;q<l;q++){r=f.objects[q];n=r.geometry;if(f.__webGLObjectsMap[r.id]==undefined)f.__webGLObjectsMap[r.id]={};v=f.__webGLObjectsMap[r.id];if(r instanceof THREE.Mesh){for(C in n.geometryChunks){t=n.geometryChunks[C];if(!t.__webGLVertexBuffer){this.createMeshBuffers(t);this.initMeshBuffers(t,r);
|
|
|
+n.__dirtyVertices=true;n.__dirtyElements=true;n.__dirtyUvs=true;n.__dirtyNormals=true;n.__dirtyTangents=true}if(n.__dirtyVertices||n.__dirtyElements||n.__dirtyUvs)this.setMeshBuffers(t,r,b.DYNAMIC_DRAW,n.__dirtyVertices,n.__dirtyElements,n.__dirtyUvs,n.__dirtyNormals,n.__dirtyTangents);k(v,C,t,r)}n.__dirtyVertices=false;n.__dirtyElements=false;n.__dirtyUvs=false;n.__dirtyNormals=false;n.__dirtyTangents=false}else if(r instanceof THREE.Line){if(!n.__webGLVertexBuffer){this.createLineBuffers(n);this.initLineBuffers(n);
|
|
|
+n.__dirtyVertices=true;n.__dirtyElements=true}n.__dirtyVertices&&this.setLineBuffers(n,b.DYNAMIC_DRAW,n.__dirtyVertices,n.__dirtyElements);k(v,0,n,r);n.__dirtyVertices=false;n.__dirtyElements=false}else if(r instanceof THREE.ParticleSystem){n.__webGLVertexBuffer||this.createParticleBuffers(n);k(v,0,n,r)}}};this.removeObject=function(f,k){var q,l;for(q=f.__webGLObjects.length-1;q>=0;q--){l=f.__webGLObjects[q].object;k==l&&f.__webGLObjects.splice(q,1)}};this.setupMatrices=function(f,k){f.autoUpdateMatrix&&
|
|
|
+f.updateMatrix();w.multiply(k.matrix,f.matrix);y.set(w.flatten());z=THREE.Matrix4.makeInvert3x3(w).transpose();J.set(z.m);K.set(f.matrix.flatten())};this.loadMatrices=function(f){b.uniformMatrix4fv(f.uniforms.viewMatrix,false,u);b.uniformMatrix4fv(f.uniforms.modelViewMatrix,false,y);b.uniformMatrix4fv(f.uniforms.projectionMatrix,false,H);b.uniformMatrix3fv(f.uniforms.normalMatrix,false,J);b.uniformMatrix4fv(f.uniforms.objectMatrix,false,K)};this.loadCamera=function(f,k){b.uniform3f(f.uniforms.cameraPosition,
|
|
|
+k.position.x,k.position.y,k.position.z)};this.setBlending=function(f){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(f,k){if(f){!k||k=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(f=="back")b.cullFace(b.BACK);else f=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);
|
|
|
+b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
+THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, 1.0 ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
|
|
|
+envmap_fragment:"#ifdef USE_ENVMAP\ncubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = mix( gl_FragColor, cubeColor, reflectivity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
|
+map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\nmapColor = texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
|
+lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
|
|
+lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif"};
|
|
|
+THREE.UniformsLib={common:{color:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},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:[]}}};
|
|
|
+THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), 1.0 );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{},fragment_shader:"varying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, 1.0 );\n}",
|
|
|
+vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 color;\nuniform float opacity;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",
|
|
|
+THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor;",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nvarying vec3 vLightWeighting;",
|
|
|
+THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,"gl_FragColor = mColor * mapColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,
|
|
|
+THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},
|
|
|
+shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 color;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.map_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,THREE.Snippets.lights_pars_fragment,"void main() {\nvec4 mColor = vec4( color, opacity );\nvec4 mapColor = vec4( 1.0 );\nvec4 cubeColor = vec4( 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lights_fragment,
|
|
|
+"gl_FragColor = mapColor * totalLight * vec4( vLightWeighting, 1.0 );",THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.envmap_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
|
|
|
+THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")}};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};
|