|
@@ -1,68 +1,69 @@
|
|
|
// 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,b,f){this.r=a;this.g=b;this.b=f;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)+
|
|
|
+THREE.Color.prototype={setRGB:function(a,b,e){this.r=a;this.g=b;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+
|
|
|
","+~~(this.g*255)+","+~~(this.b*255)+")"},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,b){this.x=a||0;this.y=b||0};
|
|
|
THREE.Vector2.prototype={set:function(a,b){this.x=a;this.y=b;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
|
|
|
-this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,f){this.x=a||0;this.y=b||0;this.z=f||0};
|
|
|
-THREE.Vector3.prototype={set:function(a,b,f){this.x=a;this.y=b;this.z=f;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
|
|
|
-cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,f=this.y,e=this.z;this.x=f*a.z-e*a.y;this.y=e*a.x-b*a.z;this.z=b*a.y-f*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},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 b=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+f*f+a*a)},distanceToSquared:function(a){var b=this.x-a.x,f=this.y-a.y;a=this.z-a.z;return b*b+f*f+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)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,b,e){this.x=a||0;this.y=b||0;this.z=e||0};
|
|
|
+THREE.Vector3.prototype={set:function(a,b,e){this.x=a;this.y=b;this.z=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
|
|
|
+cross:function(a,b){this.x=a.y*b.z-a.z*b.y;this.y=a.z*b.x-a.x*b.z;this.z=a.x*b.y-a.y*b.x;return this},crossSelf:function(a){var b=this.x,e=this.y,f=this.z;this.x=e*a.z-f*a.y;this.y=f*a.x-b*a.z;this.z=b*a.y-e*a.x;return this},multiply:function(a,b){this.x=a.x*b.x;this.y=a.y*b.y;this.z=a.z*b.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},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 b=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(b*b+e*e+a*a)},distanceToSquared:function(a){var b=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return b*b+e*e+a*a},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},negate:function(){this.x=
|
|
|
-this.x;this.y=-this.y;this.z=-this.z;return this},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
|
|
|
-THREE.Vector4=function(a,b,f,e){this.x=a||0;this.y=b||0;this.z=f||0;this.w=e||1};
|
|
|
-THREE.Vector4.prototype={set:function(a,b,f,e){this.x=a;this.y=b;this.z=f;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
|
|
|
+THREE.Vector4=function(a,b,e,f){this.x=a||0;this.y=b||0;this.z=e||0;this.w=f||1};
|
|
|
+THREE.Vector4.prototype={set:function(a,b,e,f){this.x=a;this.y=b;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,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
|
|
|
return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
|
|
|
THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
|
-THREE.Ray.prototype={intersectScene:function(a){var b,f,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){f=e[a];if(f instanceof THREE.Mesh)g=g.concat(this.intersectObject(f))}g.sort(function(j,p){return j.distance-p.distance});return g},intersectObject:function(a){function b(O,s,L,d){d=d.clone().subSelf(s);L=L.clone().subSelf(s);var h=O.clone().subSelf(s);O=d.dot(d);s=d.dot(L);d=d.dot(h);var q=L.dot(L);L=L.dot(h);h=1/(O*q-s*s);q=(q*d-s*L)*h;O=(O*L-s*d)*h;return q>0&&O>0&&q+O<1}var f,e,g,j,p,c,k,m,B,D,
|
|
|
-x,A=a.geometry,M=A.vertices,Q=[];f=0;for(e=A.faces.length;f<e;f++){g=A.faces[f];D=this.origin.clone();x=this.direction.clone();j=a.matrix.multiplyVector3(M[g.a].position.clone());p=a.matrix.multiplyVector3(M[g.b].position.clone());c=a.matrix.multiplyVector3(M[g.c].position.clone());k=g instanceof THREE.Face4?a.matrix.multiplyVector3(M[g.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(g.normal.clone());B=x.dot(m);if(B<0){m=m.dot((new THREE.Vector3).sub(j,D))/B;D=D.addSelf(x.multiplyScalar(m));
|
|
|
-if(g instanceof THREE.Face3){if(b(D,j,p,c)){g={distance:this.origin.distanceTo(D),point:D,face:g,object:a};Q.push(g)}}else if(g instanceof THREE.Face4)if(b(D,j,p,k)||b(D,p,c,k)){g={distance:this.origin.distanceTo(D),point:D,face:g,object:a};Q.push(g)}}}return Q}};
|
|
|
-THREE.Rectangle=function(){function a(){j=e-b;p=g-f}var b,f,e,g,j,p,c=true;this.getX=function(){return b};this.getY=function(){return f};this.getWidth=function(){return j};this.getHeight=function(){return p};this.getLeft=function(){return b};this.getTop=function(){return f};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(k,m,B,D){c=false;b=k;f=m;e=B;g=D;a()};this.addPoint=function(k,m){if(c){c=false;b=k;f=m;e=k;g=m}else{b=b<k?b:k;f=f<m?f:m;e=e>k?e:k;g=g>m?
|
|
|
-g:m}a()};this.add3Points=function(k,m,B,D,x,A){if(c){c=false;b=k<B?k<x?k:x:B<x?B:x;f=m<D?m<A?m:A:D<A?D:A;e=k>B?k>x?k:x:B>x?B:x;g=m>D?m>A?m:A:D>A?D:A}else{b=k<B?k<x?k<b?k:b:x<b?x:b:B<x?B<b?B:b:x<b?x:b;f=m<D?m<A?m<f?m:f:A<f?A:f:D<A?D<f?D:f:A<f?A:f;e=k>B?k>x?k>e?k:e:x>e?x:e:B>x?B>e?B:e:x>e?x:e;g=m>D?m>A?m>g?m:g:A>g?A:g:D>A?D>g?D:g:A>g?A:g}a()};this.addRectangle=function(k){if(c){c=false;b=k.getLeft();f=k.getTop();e=k.getRight();g=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();f=f<k.getTop()?f:k.getTop();
|
|
|
-e=e>k.getRight()?e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;f-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();f=f>k.getTop()?f:k.getTop();e=e<k.getRight()?e:k.getRight();g=g<k.getBottom()?g:k.getBottom();a()};this.instersects=function(k){return Math.min(e,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(g,k.getBottom())-Math.max(f,k.getTop())>=0};this.empty=function(){c=true;g=e=f=b=0;a()};this.isEmpty=function(){return c};this.toString=
|
|
|
-function(){return"THREE.Rectangle ( left: "+b+", right: "+e+", top: "+f+", bottom: "+g+", width: "+j+", 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,b,f,e,g,j,p,c,k,m,B,D,x,A,M,Q){this.n11=a||1;this.n12=b||0;this.n13=f||0;this.n14=e||0;this.n21=g||0;this.n22=j||1;this.n23=p||0;this.n24=c||0;this.n31=k||0;this.n32=m||0;this.n33=B||1;this.n34=D||0;this.n41=x||0;this.n42=A||0;this.n43=M||0;this.n44=Q||1};
|
|
|
-THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,f,e,g,j,p,c,k,m,B,D,x,A,M,Q){this.n11=a;this.n12=b;this.n13=f;this.n14=e;this.n21=g;this.n22=j;this.n23=p;this.n24=c;this.n31=k;this.n32=m;this.n33=B;this.n34=D;this.n41=x;this.n42=A;this.n43=M;this.n44=Q;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
|
|
|
-a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,f){var e=new THREE.Vector3,g=new THREE.Vector3,j=new THREE.Vector3;j.sub(a,b).normalize();e.cross(f,j).normalize();g.cross(j,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);this.n31=j.x;
|
|
|
-this.n32=j.y;this.n33=j.z;this.n34=-j.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,f=a.y,e=a.z,g=1/(this.n41*b+this.n42*f+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*f+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*f+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*f+this.n33*e+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,f=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*f+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*f+this.n23*e+this.n24*
|
|
|
-g;a.z=this.n31*b+this.n32*f+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*f+this.n43*e+this.n44*g;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var f=a.n11,e=a.n12,g=a.n13,j=a.n14,p=a.n21,c=a.n22,k=a.n23,m=a.n24,B=a.n31,D=a.n32,
|
|
|
-x=a.n33,A=a.n34,M=a.n41,Q=a.n42,O=a.n43,s=a.n44,L=b.n11,d=b.n12,h=b.n13,q=b.n14,n=b.n21,l=b.n22,i=b.n23,u=b.n24,o=b.n31,y=b.n32,t=b.n33,r=b.n34,w=b.n41,W=b.n42,G=b.n43,T=b.n44;this.n11=f*L+e*n+g*o+j*w;this.n12=f*d+e*l+g*y+j*W;this.n13=f*h+e*i+g*t+j*G;this.n14=f*q+e*u+g*r+j*T;this.n21=p*L+c*n+k*o+m*w;this.n22=p*d+c*l+k*y+m*W;this.n23=p*h+c*i+k*t+m*G;this.n24=p*q+c*u+k*r+m*T;this.n31=B*L+D*n+x*o+A*w;this.n32=B*d+D*l+x*y+A*W;this.n33=B*h+D*i+x*t+A*G;this.n34=B*q+D*u+x*r+A*T;this.n41=M*L+Q*n+O*o+s*w;
|
|
|
-this.n42=M*d+Q*l+O*y+s*W;this.n43=M*h+Q*i+O*t+s*G;this.n44=M*q+Q*u+O*r+s*T;return this},multiplySelf:function(a){var b=this.n11,f=this.n12,e=this.n13,g=this.n14,j=this.n21,p=this.n22,c=this.n23,k=this.n24,m=this.n31,B=this.n32,D=this.n33,x=this.n34,A=this.n41,M=this.n42,Q=this.n43,O=this.n44,s=a.n11,L=a.n21,d=a.n31,h=a.n41,q=a.n12,n=a.n22,l=a.n32,i=a.n42,u=a.n13,o=a.n23,y=a.n33,t=a.n43,r=a.n14,w=a.n24,W=a.n34;a=a.n44;this.n11=b*s+f*L+e*d+g*h;this.n12=b*q+f*n+e*l+g*i;this.n13=b*u+f*o+e*y+g*t;this.n14=
|
|
|
-b*r+f*w+e*W+g*a;this.n21=j*s+p*L+c*d+k*h;this.n22=j*q+p*n+c*l+k*i;this.n23=j*u+p*o+c*y+k*t;this.n24=j*r+p*w+c*W+k*a;this.n31=m*s+B*L+D*d+x*h;this.n32=m*q+B*n+D*l+x*i;this.n33=m*u+B*o+D*y+x*t;this.n34=m*r+B*w+D*W+x*a;this.n41=A*s+M*L+Q*d+O*h;this.n42=A*q+M*n+Q*l+O*i;this.n43=A*u+M*o+Q*y+O*t;this.n44=A*r+M*w+Q*W+O*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*=
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var b,e,f=a.objects,g=[];a=0;for(b=f.length;a<b;a++){e=f[a];if(e instanceof THREE.Mesh)g=g.concat(this.intersectObject(e))}g.sort(function(i,p){return i.distance-p.distance});return g},intersectObject:function(a){function b(U,s,R,d){d=d.clone().subSelf(s);R=R.clone().subSelf(s);var h=U.clone().subSelf(s);U=d.dot(d);s=d.dot(R);d=d.dot(h);var o=R.dot(R);R=R.dot(h);h=1/(U*o-s*s);o=(o*d-s*R)*h;U=(U*R-s*d)*h;return o>0&&U>0&&o+U<1}var e,f,g,i,p,c,k,l,D,F,
|
|
|
+y,C=a.geometry,S=C.vertices,W=[];e=0;for(f=C.faces.length;e<f;e++){g=C.faces[e];F=this.origin.clone();y=this.direction.clone();i=a.matrix.multiplyVector3(S[g.a].position.clone());p=a.matrix.multiplyVector3(S[g.b].position.clone());c=a.matrix.multiplyVector3(S[g.c].position.clone());k=g instanceof THREE.Face4?a.matrix.multiplyVector3(S[g.d].position.clone()):null;l=a.rotationMatrix.multiplyVector3(g.normal.clone());D=y.dot(l);if(D<0){l=l.dot((new THREE.Vector3).sub(i,F))/D;F=F.addSelf(y.multiplyScalar(l));
|
|
|
+if(g instanceof THREE.Face3){if(b(F,i,p,c)){g={distance:this.origin.distanceTo(F),point:F,face:g,object:a};W.push(g)}}else if(g instanceof THREE.Face4)if(b(F,i,p,k)||b(F,p,c,k)){g={distance:this.origin.distanceTo(F),point:F,face:g,object:a};W.push(g)}}}return W}};
|
|
|
+THREE.Rectangle=function(){function a(){i=f-b;p=g-e}var b,e,f,g,i,p,c=true;this.getX=function(){return b};this.getY=function(){return e};this.getWidth=function(){return i};this.getHeight=function(){return p};this.getLeft=function(){return b};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(k,l,D,F){c=false;b=k;e=l;f=D;g=F;a()};this.addPoint=function(k,l){if(c){c=false;b=k;e=l;f=k;g=l}else{b=b<k?b:k;e=e<l?e:l;f=f>k?f:k;g=g>l?
|
|
|
+g:l}a()};this.add3Points=function(k,l,D,F,y,C){if(c){c=false;b=k<D?k<y?k:y:D<y?D:y;e=l<F?l<C?l:C:F<C?F:C;f=k>D?k>y?k:y:D>y?D:y;g=l>F?l>C?l:C:F>C?F:C}else{b=k<D?k<y?k<b?k:b:y<b?y:b:D<y?D<b?D:b:y<b?y:b;e=l<F?l<C?l<e?l:e:C<e?C:e:F<C?F<e?F:e:C<e?C:e;f=k>D?k>y?k>f?k:f:y>f?y:f:D>y?D>f?D:f:y>f?y:f;g=l>F?l>C?l>g?l:g:C>g?C:g:F>C?F>g?F:g:C>g?C:g}a()};this.addRectangle=function(k){if(c){c=false;b=k.getLeft();e=k.getTop();f=k.getRight();g=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();e=e<k.getTop()?e:k.getTop();
|
|
|
+f=f>k.getRight()?f:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;e-=k;f+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();e=e>k.getTop()?e:k.getTop();f=f<k.getRight()?f:k.getRight();g=g<k.getBottom()?g:k.getBottom();a()};this.instersects=function(k){return Math.min(f,k.getRight())-Math.max(b,k.getLeft())>=0&&Math.min(g,k.getBottom())-Math.max(e,k.getTop())>=0};this.empty=function(){c=true;g=f=e=b=0;a()};this.isEmpty=function(){return c};this.toString=
|
|
|
+function(){return"THREE.Rectangle ( left: "+b+", right: "+f+", top: "+e+", bottom: "+g+", 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,b,e,f,g,i,p,c,k,l,D,F,y,C,S,W){this.n11=a||1;this.n12=b||0;this.n13=e||0;this.n14=f||0;this.n21=g||0;this.n22=i||1;this.n23=p||0;this.n24=c||0;this.n31=k||0;this.n32=l||0;this.n33=D||1;this.n34=F||0;this.n41=y||0;this.n42=C||0;this.n43=S||0;this.n44=W||1};
|
|
|
+THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,b,e,f,g,i,p,c,k,l,D,F,y,C,S,W){this.n11=a;this.n12=b;this.n13=e;this.n14=f;this.n21=g;this.n22=i;this.n23=p;this.n24=c;this.n31=k;this.n32=l;this.n33=D;this.n34=F;this.n41=y;this.n42=C;this.n43=S;this.n44=W;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
|
|
|
+a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,b,e){var f=new THREE.Vector3,g=new THREE.Vector3,i=new THREE.Vector3;i.sub(a,b).normalize();f.cross(e,i).normalize();g.cross(i,f).normalize();this.n11=f.x;this.n12=f.y;this.n13=f.z;this.n14=-f.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.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 b=a.x,e=a.y,f=a.z,g=1/(this.n41*b+this.n42*e+this.n43*f+this.n44);a.x=(this.n11*b+this.n12*e+this.n13*f+this.n14)*g;a.y=(this.n21*b+this.n22*e+this.n23*f+this.n24)*g;a.z=(this.n31*b+this.n32*e+this.n33*f+this.n34)*g;return a},multiplyVector4:function(a){var b=a.x,e=a.y,f=a.z,g=a.w;a.x=this.n11*b+this.n12*e+this.n13*f+this.n14*g;a.y=this.n21*b+this.n22*e+this.n23*f+this.n24*
|
|
|
+g;a.z=this.n31*b+this.n32*e+this.n33*f+this.n34*g;a.w=this.n41*b+this.n42*e+this.n43*f+this.n44*g;return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},multiply:function(a,b){var e=a.n11,f=a.n12,g=a.n13,i=a.n14,p=a.n21,c=a.n22,k=a.n23,l=a.n24,D=a.n31,F=a.n32,
|
|
|
+y=a.n33,C=a.n34,S=a.n41,W=a.n42,U=a.n43,s=a.n44,R=b.n11,d=b.n12,h=b.n13,o=b.n14,n=b.n21,m=b.n22,t=b.n23,r=b.n24,q=b.n31,z=b.n32,u=b.n33,j=b.n34,w=b.n41,T=b.n42,A=b.n43,K=b.n44;this.n11=e*R+f*n+g*q+i*w;this.n12=e*d+f*m+g*z+i*T;this.n13=e*h+f*t+g*u+i*A;this.n14=e*o+f*r+g*j+i*K;this.n21=p*R+c*n+k*q+l*w;this.n22=p*d+c*m+k*z+l*T;this.n23=p*h+c*t+k*u+l*A;this.n24=p*o+c*r+k*j+l*K;this.n31=D*R+F*n+y*q+C*w;this.n32=D*d+F*m+y*z+C*T;this.n33=D*h+F*t+y*u+C*A;this.n34=D*o+F*r+y*j+C*K;this.n41=S*R+W*n+U*q+s*w;
|
|
|
+this.n42=S*d+W*m+U*z+s*T;this.n43=S*h+W*t+U*u+s*A;this.n44=S*o+W*r+U*j+s*K;return this},multiplySelf:function(a){var b=this.n11,e=this.n12,f=this.n13,g=this.n14,i=this.n21,p=this.n22,c=this.n23,k=this.n24,l=this.n31,D=this.n32,F=this.n33,y=this.n34,C=this.n41,S=this.n42,W=this.n43,U=this.n44,s=a.n11,R=a.n21,d=a.n31,h=a.n41,o=a.n12,n=a.n22,m=a.n32,t=a.n42,r=a.n13,q=a.n23,z=a.n33,u=a.n43,j=a.n14,w=a.n24,T=a.n34;a=a.n44;this.n11=b*s+e*R+f*d+g*h;this.n12=b*o+e*n+f*m+g*t;this.n13=b*r+e*q+f*z+g*u;this.n14=
|
|
|
+b*j+e*w+f*T+g*a;this.n21=i*s+p*R+c*d+k*h;this.n22=i*o+p*n+c*m+k*t;this.n23=i*r+p*q+c*z+k*u;this.n24=i*j+p*w+c*T+k*a;this.n31=l*s+D*R+F*d+y*h;this.n32=l*o+D*n+F*m+y*t;this.n33=l*r+D*q+F*z+y*u;this.n34=l*j+D*w+F*T+y*a;this.n41=C*s+S*R+W*d+U*h;this.n42=C*o+S*n+W*m+U*t;this.n43=C*r+S*q+W*z+U*u;this.n44=C*j+S*w+W*T+U*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=
|
|
|
a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){return this.n14*this.n23*this.n32*this.n41-this.n13*this.n24*this.n32*this.n41-this.n14*this.n22*this.n33*this.n41+this.n12*this.n24*this.n33*this.n41+this.n13*this.n22*this.n34*this.n41-this.n12*this.n23*this.n34*this.n41-this.n14*this.n23*this.n31*this.n42+this.n13*this.n24*this.n31*this.n42+this.n14*this.n21*this.n33*this.n42-this.n11*this.n24*this.n33*this.n42-this.n13*this.n21*this.n34*this.n42+this.n11*this.n23*this.n34*
|
|
|
-this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14*this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(b,f,e){var g=b[f];b[f]=b[e];
|
|
|
-b[e]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){return[this.n11,this.n21,this.n31,this.n41,this.n12,
|
|
|
-this.n22,this.n32,this.n42,this.n13,this.n23,this.n33,this.n43,this.n14,this.n24,this.n34,this.n44]},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,f){var e=new THREE.Matrix4;e.n14=a;e.n24=b;e.n34=f;return e};
|
|
|
-THREE.Matrix4.scaleMatrix=function(a,b,f){var e=new THREE.Matrix4;e.n11=a;e.n22=b;e.n33=f;return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.n22=b.n33=Math.cos(a);b.n32=Math.sin(a);b.n23=-b.n32;return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n33=Math.cos(a);b.n13=Math.sin(a);b.n31=-b.n13;return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n22=Math.cos(a);b.n21=Math.sin(a);b.n12=-b.n21;return b};
|
|
|
-THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var f=new THREE.Matrix4,e=Math.cos(b),g=Math.sin(b),j=1-e,p=a.x,c=a.y,k=a.z;f.n11=j*p*p+e;f.n12=j*p*c-g*k;f.n13=j*p*k+g*c;f.n21=j*p*c+g*k;f.n22=j*c*c+e;f.n23=j*c*k-g*p;f.n31=j*p*k-g*c;f.n32=j*c*k+g*p;f.n33=j*k*k+e;return f};
|
|
|
+this.n42+this.n14*this.n22*this.n31*this.n43-this.n12*this.n24*this.n31*this.n43-this.n14*this.n21*this.n32*this.n43+this.n11*this.n24*this.n32*this.n43+this.n12*this.n21*this.n34*this.n43-this.n11*this.n22*this.n34*this.n43-this.n13*this.n22*this.n31*this.n44+this.n12*this.n23*this.n31*this.n44+this.n13*this.n21*this.n32*this.n44-this.n11*this.n23*this.n32*this.n44-this.n12*this.n21*this.n33*this.n44+this.n11*this.n22*this.n33*this.n44},transpose:function(){function a(b,e,f){var g=b[e];b[e]=b[f];
|
|
|
+b[f]=g}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){return[this.n11,this.n21,this.n31,this.n41,this.n12,
|
|
|
+this.n22,this.n32,this.n42,this.n13,this.n23,this.n33,this.n43,this.n14,this.n24,this.n34,this.n44]},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,e){var f=new THREE.Matrix4;f.n14=a;f.n24=b;f.n34=e;return f};
|
|
|
+THREE.Matrix4.scaleMatrix=function(a,b,e){var f=new THREE.Matrix4;f.n11=a;f.n22=b;f.n33=e;return f};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.n22=b.n33=Math.cos(a);b.n32=Math.sin(a);b.n23=-b.n32;return b};THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n33=Math.cos(a);b.n13=Math.sin(a);b.n31=-b.n13;return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.n11=b.n22=Math.cos(a);b.n21=Math.sin(a);b.n12=-b.n21;return b};
|
|
|
+THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var e=new THREE.Matrix4,f=Math.cos(b),g=Math.sin(b),i=1-f,p=a.x,c=a.y,k=a.z;e.n11=i*p*p+f;e.n12=i*p*c-g*k;e.n13=i*p*k+g*c;e.n21=i*p*c+g*k;e.n22=i*c*c+f;e.n23=i*c*k-g*p;e.n31=i*p*k-g*c;e.n32=i*c*k+g*p;e.n33=i*k*k+f;return e};
|
|
|
THREE.Matrix4.makeInvert=function(a){var b=new THREE.Matrix4;b.n11=a.n23*a.n34*a.n42-a.n24*a.n33*a.n42+a.n24*a.n32*a.n43-a.n22*a.n34*a.n43-a.n23*a.n32*a.n44+a.n22*a.n33*a.n44;b.n12=a.n14*a.n33*a.n42-a.n13*a.n34*a.n42-a.n14*a.n32*a.n43+a.n12*a.n34*a.n43+a.n13*a.n32*a.n44-a.n12*a.n33*a.n44;b.n13=a.n13*a.n24*a.n42-a.n14*a.n23*a.n42+a.n14*a.n22*a.n43-a.n12*a.n24*a.n43-a.n13*a.n22*a.n44+a.n12*a.n23*a.n44;b.n14=a.n14*a.n23*a.n32-a.n13*a.n24*a.n32-a.n14*a.n22*a.n33+a.n12*a.n24*a.n33+a.n13*a.n22*a.n34-a.n12*
|
|
|
a.n23*a.n34;b.n21=a.n24*a.n33*a.n41-a.n23*a.n34*a.n41-a.n24*a.n31*a.n43+a.n21*a.n34*a.n43+a.n23*a.n31*a.n44-a.n21*a.n33*a.n44;b.n22=a.n13*a.n34*a.n41-a.n14*a.n33*a.n41+a.n14*a.n31*a.n43-a.n11*a.n34*a.n43-a.n13*a.n31*a.n44+a.n11*a.n33*a.n44;b.n23=a.n14*a.n23*a.n41-a.n13*a.n24*a.n41-a.n14*a.n21*a.n43+a.n11*a.n24*a.n43+a.n13*a.n21*a.n44-a.n11*a.n23*a.n44;b.n24=a.n13*a.n24*a.n31-a.n14*a.n23*a.n31+a.n14*a.n21*a.n33-a.n11*a.n24*a.n33-a.n13*a.n21*a.n34+a.n11*a.n23*a.n34;b.n31=a.n22*a.n34*a.n41-a.n24*a.n32*
|
|
|
a.n41+a.n24*a.n31*a.n42-a.n21*a.n34*a.n42-a.n22*a.n31*a.n44+a.n21*a.n32*a.n44;b.n32=a.n14*a.n32*a.n41-a.n12*a.n34*a.n41-a.n14*a.n31*a.n42+a.n11*a.n34*a.n42+a.n12*a.n31*a.n44-a.n11*a.n32*a.n44;b.n33=a.n13*a.n24*a.n41-a.n14*a.n22*a.n41+a.n14*a.n21*a.n42-a.n11*a.n24*a.n42-a.n12*a.n21*a.n44+a.n11*a.n22*a.n44;b.n34=a.n14*a.n22*a.n31-a.n12*a.n24*a.n31-a.n14*a.n21*a.n32+a.n11*a.n24*a.n32+a.n12*a.n21*a.n34-a.n11*a.n22*a.n34;b.n41=a.n23*a.n32*a.n41-a.n22*a.n33*a.n41-a.n23*a.n31*a.n42+a.n21*a.n33*a.n42+a.n22*
|
|
|
a.n31*a.n43-a.n21*a.n32*a.n43;b.n42=a.n12*a.n33*a.n41-a.n13*a.n32*a.n41+a.n13*a.n31*a.n42-a.n11*a.n33*a.n42-a.n12*a.n31*a.n43+a.n11*a.n32*a.n43;b.n43=a.n13*a.n22*a.n41-a.n12*a.n23*a.n41-a.n13*a.n21*a.n42+a.n11*a.n23*a.n42+a.n12*a.n21*a.n43-a.n11*a.n22*a.n43;b.n44=a.n12*a.n23*a.n31-a.n13*a.n22*a.n31+a.n13*a.n21*a.n32-a.n11*a.n23*a.n32-a.n12*a.n21*a.n33+a.n11*a.n22*a.n33;b.multiplyScalar(1/a.determinant());return b};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var f=b[10]*b[5]-b[6]*b[9],e=-b[10]*b[1]+b[2]*b[9],g=b[6]*b[1]-b[2]*b[5],j=-b[10]*b[4]+b[6]*b[8],p=b[10]*b[0]-b[2]*b[8],c=-b[6]*b[0]+b[2]*b[4],k=b[9]*b[4]-b[5]*b[8],m=-b[9]*b[0]+b[1]*b[8],B=b[5]*b[0]-b[1]*b[4];b=b[0]*f+b[1]*j+b[2]*k;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*f;a.m[1]=b*e;a.m[2]=b*g;a.m[3]=b*j;a.m[4]=b*p;a.m[5]=b*c;a.m[6]=b*k;a.m[7]=b*m;a.m[8]=b*B;return a};
|
|
|
-THREE.Matrix4.makeFrustum=function(a,b,f,e,g,j){var p,c,k;p=new THREE.Matrix4;c=2*g/(b-a);k=2*g/(e-f);a=(b+a)/(b-a);f=(e+f)/(e-f);e=-(j+g)/(j-g);g=-2*j*g/(j-g);p.n11=c;p.n12=0;p.n13=a;p.n14=0;p.n21=0;p.n22=k;p.n23=f;p.n24=0;p.n31=0;p.n32=0;p.n33=e;p.n34=g;p.n41=0;p.n42=0;p.n43=-1;p.n44=0;return p};THREE.Matrix4.makePerspective=function(a,b,f,e){var g;a=f*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,f,e)};
|
|
|
-THREE.Matrix4.makeOrtho=function(a,b,f,e,g,j){var p,c,k,m;p=new THREE.Matrix4;c=b-a;k=f-e;m=j-g;a=(b+a)/c;f=(f+e)/k;g=(j+g)/m;p.n11=2/c;p.n12=0;p.n13=0;p.n14=-a;p.n21=0;p.n22=2/k;p.n23=0;p.n24=-f;p.n31=0;p.n32=0;p.n33=-2/m;p.n34=-g;p.n41=0;p.n42=0;p.n43=0;p.n44=1;return p};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.flatten();a=new THREE.Matrix3;var e=b[10]*b[5]-b[6]*b[9],f=-b[10]*b[1]+b[2]*b[9],g=b[6]*b[1]-b[2]*b[5],i=-b[10]*b[4]+b[6]*b[8],p=b[10]*b[0]-b[2]*b[8],c=-b[6]*b[0]+b[2]*b[4],k=b[9]*b[4]-b[5]*b[8],l=-b[9]*b[0]+b[1]*b[8],D=b[5]*b[0]-b[1]*b[4];b=b[0]*e+b[1]*i+b[2]*k;if(b==0)throw"matrix not invertible";b=1/b;a.m[0]=b*e;a.m[1]=b*f;a.m[2]=b*g;a.m[3]=b*i;a.m[4]=b*p;a.m[5]=b*c;a.m[6]=b*k;a.m[7]=b*l;a.m[8]=b*D;return a};
|
|
|
+THREE.Matrix4.makeFrustum=function(a,b,e,f,g,i){var p,c,k;p=new THREE.Matrix4;c=2*g/(b-a);k=2*g/(f-e);a=(b+a)/(b-a);e=(f+e)/(f-e);f=-(i+g)/(i-g);g=-2*i*g/(i-g);p.n11=c;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=g;p.n41=0;p.n42=0;p.n43=-1;p.n44=0;return p};THREE.Matrix4.makePerspective=function(a,b,e,f){var g;a=e*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,e,f)};
|
|
|
+THREE.Matrix4.makeOrtho=function(a,b,e,f,g,i){var p,c,k,l;p=new THREE.Matrix4;c=b-a;k=e-f;l=i-g;a=(b+a)/c;e=(e+f)/k;g=(i+g)/l;p.n11=2/c;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/l;p.n34=-g;p.n41=0;p.n42=0;p.n43=0;p.n44=1;return p};
|
|
|
THREE.Vertex=function(a,b){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=b||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
|
|
|
-THREE.Face3=function(a,b,f,e,g){this.a=a;this.b=b;this.c=f;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,b,f,e,g,j){this.a=a;this.b=b;this.c=f;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=j instanceof Array?j:[j]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,b){this.u=a||0;this.v=b||0};
|
|
|
+THREE.Face3=function(a,b,e,f,g){this.a=a;this.b=b;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=g instanceof Array?g:[g]};THREE.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
|
|
|
+THREE.Face4=function(a,b,e,f,g,i){this.a=a;this.b=b;this.c=e;this.d=f;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];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,b){this.u=a||0;this.v=b||0};
|
|
|
THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.vertices=[];this.faces=[];this.uvs=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
|
|
|
-THREE.Geometry.prototype={computeCentroids:function(){var a,b,f;a=0;for(b=this.faces.length;a<b;a++){f=this.faces[a];f.centroid.set(0,0,0);if(f instanceof THREE.Face3){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);f.centroid.divideScalar(3)}else if(f instanceof THREE.Face4){f.centroid.addSelf(this.vertices[f.a].position);f.centroid.addSelf(this.vertices[f.b].position);f.centroid.addSelf(this.vertices[f.c].position);
|
|
|
-f.centroid.addSelf(this.vertices[f.d].position);f.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,f,e,g,j,p,c=new THREE.Vector3,k=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){j=this.vertices[e];j.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){j=this.faces[e];if(a&&j.vertexNormals.length){c.set(0,0,0);b=0;for(f=j.normal.length;b<f;b++)c.addSelf(j.vertexNormals[b]);c.divideScalar(3)}else{b=this.vertices[j.a];f=this.vertices[j.b];p=this.vertices[j.c];c.sub(p.position,
|
|
|
-f.position);k.sub(b.position,f.position);c.crossSelf(k)}c.isZero()||c.normalize();j.normal.copy(c)}},computeVertexNormals:function(){var a,b,f=[],e;a=0;for(b=this.vertices.length;a<b;a++)f[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;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(b=this.vertices.length;a<b;a++)f[a].normalize();a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];if(e instanceof THREE.Face3){e.vertexNormals[0]=f[e.a].clone();e.vertexNormals[1]=f[e.b].clone();e.vertexNormals[2]=f[e.c].clone()}else if(e instanceof THREE.Face4){e.vertexNormals[0]=f[e.a].clone();e.vertexNormals[1]=f[e.b].clone();e.vertexNormals[2]=f[e.c].clone();e.vertexNormals[3]=f[e.d].clone()}}},computeTangents:function(){function a(r,w,W,G,T,P,H){j=r.vertices[w].position;p=r.vertices[W].position;
|
|
|
-c=r.vertices[G].position;k=g[T];m=g[P];B=g[H];D=p.x-j.x;x=c.x-j.x;A=p.y-j.y;M=c.y-j.y;Q=p.z-j.z;O=c.z-j.z;s=m.u-k.u;L=B.u-k.u;d=m.v-k.v;h=B.v-k.v;q=1/(s*h-L*d);i.set((h*D-d*x)*q,(h*A-d*M)*q,(h*Q-d*O)*q);u.set((s*x-L*D)*q,(s*M-L*A)*q,(s*O-L*Q)*q);n[w].addSelf(i);n[W].addSelf(i);n[G].addSelf(i);l[w].addSelf(u);l[W].addSelf(u);l[G].addSelf(u)}var b,f,e,g,j,p,c,k,m,B,D,x,A,M,Q,O,s,L,d,h,q,n=[],l=[],i=new THREE.Vector3,u=new THREE.Vector3,o=new THREE.Vector3,y=new THREE.Vector3,t=new THREE.Vector3;b=0;
|
|
|
-for(f=this.vertices.length;b<f;b++){n[b]=new THREE.Vector3;l[b]=new THREE.Vector3}b=0;for(f=this.faces.length;b<f;b++){e=this.faces[b];g=this.uvs[b];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])}}b=0;for(f=this.vertices.length;b<f;b++){t.copy(this.vertices[b].normal);e=n[b];o.copy(e);o.subSelf(t.multiplyScalar(t.dot(e))).normalize();y.cross(this.vertices[b].normal,e);e=y.dot(l[b]);e=e<0?-1:1;this.vertices[b].tangent.set(o.x,o.y,o.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 b=1,f=this.vertices.length;b<f;b++){a=this.vertices[b];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,b=0,f=this.vertices.length;b<f;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(B){var D=[];b=0;for(f=B.length;b<f;b++)B[b]==undefined?D.push("undefined"):D.push(B[b].toString());return D.join("_")}
|
|
|
-var b,f,e,g,j,p,c,k,m={};e=0;for(g=this.faces.length;e<g;e++){j=this.faces[e];p=j.materials;c=a(p);if(m[c]==undefined)m[c]={hash:c,counter:0};k=m[c].hash+"_"+m[c].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:p,vertices:0};j=j instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+j>65535){m[c].counter+=1;k=m[c].hash+"_"+m[c].counter;if(this.geometryChunks[k]==undefined)this.geometryChunks[k]={faces:[],materials:p,vertices:0}}this.geometryChunks[k].faces.push(e);
|
|
|
-this.geometryChunks[k].vertices+=j}},toString:function(){return"THREE.Geometry ( vertices: "+this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};
|
|
|
-THREE.Camera=function(a,b,f,e){this.fov=a;this.aspect=b;this.near=f;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.translateX=function(g){g=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(g);g.cross(g.clone(),this.up);this.position.addSelf(g);this.target.position.addSelf(g)};this.translateZ=function(g){g=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(g);
|
|
|
+THREE.Geometry.prototype={computeCentroids:function(){var a,b,e;a=0;for(b=this.faces.length;a<b;a++){e=this.faces[a];e.centroid.set(0,0,0);if(e instanceof THREE.Face3){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);e.centroid.divideScalar(3)}else if(e instanceof THREE.Face4){e.centroid.addSelf(this.vertices[e.a].position);e.centroid.addSelf(this.vertices[e.b].position);e.centroid.addSelf(this.vertices[e.c].position);
|
|
|
+e.centroid.addSelf(this.vertices[e.d].position);e.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,e,f,g,i,p,c=new THREE.Vector3,k=new THREE.Vector3;f=0;for(g=this.vertices.length;f<g;f++){i=this.vertices[f];i.normal.set(0,0,0)}f=0;for(g=this.faces.length;f<g;f++){i=this.faces[f];if(a&&i.vertexNormals.length){c.set(0,0,0);b=0;for(e=i.normal.length;b<e;b++)c.addSelf(i.vertexNormals[b]);c.divideScalar(3)}else{b=this.vertices[i.a];e=this.vertices[i.b];p=this.vertices[i.c];c.sub(p.position,
|
|
|
+e.position);k.sub(b.position,e.position);c.crossSelf(k)}c.isZero()||c.normalize();i.normal.copy(c)}},computeVertexNormals:function(){var a,b,e,f;if(this.__tmpVertices==undefined){f=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)f[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;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(b=this.vertices.length;a<b;a++)f[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;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(b=this.vertices.length;a<b;a++)f[a].normalize();a=0;for(b=this.faces.length;a<
|
|
|
+b;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(j,w,T,A,K,N,I){i=j.vertices[w].position;p=j.vertices[T].position;c=j.vertices[A].position;k=g[K];l=g[N];D=g[I];F=p.x-i.x;y=c.x-i.x;C=p.y-i.y;S=c.y-i.y;
|
|
|
+W=p.z-i.z;U=c.z-i.z;s=l.u-k.u;R=D.u-k.u;d=l.v-k.v;h=D.v-k.v;o=1/(s*h-R*d);t.set((h*F-d*y)*o,(h*C-d*S)*o,(h*W-d*U)*o);r.set((s*y-R*F)*o,(s*S-R*C)*o,(s*U-R*W)*o);n[w].addSelf(t);n[T].addSelf(t);n[A].addSelf(t);m[w].addSelf(r);m[T].addSelf(r);m[A].addSelf(r)}var b,e,f,g,i,p,c,k,l,D,F,y,C,S,W,U,s,R,d,h,o,n=[],m=[],t=new THREE.Vector3,r=new THREE.Vector3,q=new THREE.Vector3,z=new THREE.Vector3,u=new THREE.Vector3;b=0;for(e=this.vertices.length;b<e;b++){n[b]=new THREE.Vector3;m[b]=new THREE.Vector3}b=0;
|
|
|
+for(e=this.faces.length;b<e;b++){f=this.faces[b];g=this.uvs[b];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])}}b=0;for(e=this.vertices.length;b<e;b++){u.copy(this.vertices[b].normal);f=n[b];q.copy(f);q.subSelf(u.multiplyScalar(u.dot(f))).normalize();z.cross(this.vertices[b].normal,f);f=z.dot(m[b]);f=f<0?-1:1;this.vertices[b].tangent.set(q.x,q.y,q.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 b=1,e=this.vertices.length;b<e;b++){a=this.vertices[b];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,b=0,e=this.vertices.length;b<e;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(D){var F=[];b=0;for(e=D.length;b<e;b++)D[b]==undefined?F.push("undefined"):F.push(D[b].toString());return F.join("_")}var b,e,f,g,i,p,c,k,l={};f=0;for(g=this.faces.length;f<g;f++){i=this.faces[f];
|
|
|
+p=i.materials;c=a(p);if(l[c]==undefined)l[c]={hash:c,counter:0};k=l[c].hash+"_"+l[c].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){l[c].counter+=1;k=l[c].hash+"_"+l[c].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,b,e,f){this.fov=a;this.aspect=b;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.translateX=function(g){g=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(g);g.cross(g.clone(),this.up);this.position.addSelf(g);this.target.position.addSelf(g)};this.translateZ=function(g){g=this.target.position.clone().subSelf(this.position).normalize().multiplyScalar(g);
|
|
|
this.position.subSelf(g);this.target.position.subSelf(g)};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,b){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;
|
|
|
THREE.PointLight=function(a,b){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=b||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.PointLight;
|
|
|
THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.translationMatrix=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.scaleMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true};
|
|
|
THREE.Object3D.prototype={updateMatrix:function(){this.matrixPosition=THREE.Matrix4.translationMatrix(this.position.x,this.position.y,this.position.z);this.rotationMatrix=THREE.Matrix4.rotationXMatrix(this.rotation.x);this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationYMatrix(this.rotation.y));this.rotationMatrix.multiplySelf(THREE.Matrix4.rotationZMatrix(this.rotation.z));this.scaleMatrix=THREE.Matrix4.scaleMatrix(this.scale.x,this.scale.y,this.scale.z);this.matrix.copy(this.matrixPosition);
|
|
|
this.matrix.multiplySelf(this.rotationMatrix);this.matrix.multiplySelf(this.scaleMatrix)}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.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,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.autoUpdateMatrix=false};
|
|
|
-THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,f){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=f!==undefined?f:THREE.LineContinuous};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
|
+THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,b,e){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=e!==undefined?e:THREE.LineContinuous};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
|
THREE.Mesh=function(a,b){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];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/>)"}};
|
|
@@ -90,95 +91,98 @@ THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderM
|
|
|
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,b,f,e,g,j){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=f!==undefined?f:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=j!==undefined?j:THREE.LinearMipMapLinearFilter};
|
|
|
+THREE.Texture=function(a,b,e,f,g,i){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrap_t=f!==undefined?f:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g: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;var Uniforms={clone:function(a){var b,f,e,g={};for(b in a){g[b]={};for(f in a[b]){e=a[b][f];g[b][f]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,f,e,g={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(f in e)g[f]=e[f]}return g}};
|
|
|
+THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;var Uniforms={clone:function(a){var b,e,f,g={};for(b in a){g[b]={};for(e in a[b]){f=a[b][e];g[b][e]=f instanceof THREE.Color||f instanceof THREE.Vector3||f instanceof THREE.Texture?f.clone():f}}return g},merge:function(a){var b,e,f,g={};for(b=0;b<a.length;b++){f=this.clone(a[b]);for(e in f)g[e]=f[e]}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,b,f){this.color=new THREE.Color(a);this.near=b||1;this.far=f||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
|
|
-THREE.Projector=function(){function a(l,i){return i.z-l.z}function b(l,i){var u=0,o=1,y=l.z+l.w,t=i.z+i.w,r=-l.z+l.w,w=-i.z+i.w;if(y>=0&&t>=0&&r>=0&&w>=0)return true;else if(y<0&&t<0||r<0&&w<0)return false;else{if(y<0)u=Math.max(u,y/(y-t));else if(t<0)o=Math.min(o,y/(y-t));if(r<0)u=Math.max(u,r/(r-w));else if(w<0)o=Math.min(o,r/(r-w));if(o<u)return false;else{l.lerpSelf(i,u);i.lerpSelf(l,1-o);return true}}}var f,e,g=[],j,p,c,k=[],m,B,D=[],x,A,M=[],Q=new THREE.Vector4,O=new THREE.Vector4,s=new THREE.Matrix4,
|
|
|
-L=new THREE.Matrix4,d=[],h=new THREE.Vector4,q=new THREE.Vector4,n;this.projectObjects=function(l,i,u){var o=[],y,t;e=0;s.multiply(i.projectionMatrix,i.matrix);d[0]=new THREE.Vector4(s.n41-s.n11,s.n42-s.n12,s.n43-s.n13,s.n44-s.n14);d[1]=new THREE.Vector4(s.n41+s.n11,s.n42+s.n12,s.n43+s.n13,s.n44+s.n14);d[2]=new THREE.Vector4(s.n41+s.n21,s.n42+s.n22,s.n43+s.n23,s.n44+s.n24);d[3]=new THREE.Vector4(s.n41-s.n21,s.n42-s.n22,s.n43-s.n23,s.n44-s.n24);d[4]=new THREE.Vector4(s.n41-s.n31,s.n42-s.n32,s.n43-
|
|
|
-s.n33,s.n44-s.n34);d[5]=new THREE.Vector4(s.n41+s.n31,s.n42+s.n32,s.n43+s.n33,s.n44+s.n34);i=0;for(y=d.length;i<y;i++){t=d[i];t.divideScalar(Math.sqrt(t.x*t.x+t.y*t.y+t.z*t.z))}y=l.objects;l=0;for(i=y.length;l<i;l++){t=y[l];var r;if(!(r=!t.visible)){if(r=t instanceof THREE.Mesh){a:{r=void 0;for(var w=t.position,W=-t.geometry.boundingSphere.radius*Math.max(t.scale.x,Math.max(t.scale.y,t.scale.z)),G=0;G<6;G++){r=d[G].x*w.x+d[G].y*w.y+d[G].z*w.z+d[G].w;if(r<=W){r=false;break a}}r=true}r=!r}r=r}if(!r){f=
|
|
|
-g[e]=g[e]||new THREE.RenderableObject;Q.copy(t.position);s.multiplyVector3(Q);f.object=t;f.z=Q.z;o.push(f);e++}}u&&o.sort(a);return o};this.projectScene=function(l,i,u){var o=[],y=i.near,t=i.far,r,w,W,G,T,P,H,X,K,E,F,U,R,C,N,V;c=B=A=0;i.autoUpdateMatrix&&i.updateMatrix();s.multiply(i.projectionMatrix,i.matrix);P=this.projectObjects(l,i,true);l=0;for(r=P.length;l<r;l++){H=P[l].object;if(H.visible){H.autoUpdateMatrix&&H.updateMatrix();X=H.matrix;K=H.rotationMatrix;E=H.materials;F=H.overdraw;if(H instanceof
|
|
|
-THREE.Mesh){U=H.geometry;R=U.vertices;w=0;for(W=R.length;w<W;w++){C=R[w];C.positionWorld.copy(C.position);X.multiplyVector3(C.positionWorld);G=C.positionScreen;G.copy(C.positionWorld);s.multiplyVector4(G);G.x/=G.w;G.y/=G.w;C.__visible=G.z>y&&G.z<t}U=U.faces;w=0;for(W=U.length;w<W;w++){C=U[w];if(C instanceof THREE.Face3){G=R[C.a];T=R[C.b];N=R[C.c];if(G.__visible&&T.__visible&&N.__visible)if(H.doubleSided||H.flipSided!=(N.positionScreen.x-G.positionScreen.x)*(T.positionScreen.y-G.positionScreen.y)-
|
|
|
-(N.positionScreen.y-G.positionScreen.y)*(T.positionScreen.x-G.positionScreen.x)<0){j=k[c]=k[c]||new THREE.RenderableFace3;j.v1.positionWorld.copy(G.positionWorld);j.v2.positionWorld.copy(T.positionWorld);j.v3.positionWorld.copy(N.positionWorld);j.v1.positionScreen.copy(G.positionScreen);j.v2.positionScreen.copy(T.positionScreen);j.v3.positionScreen.copy(N.positionScreen);j.normalWorld.copy(C.normal);K.multiplyVector3(j.normalWorld);j.centroidWorld.copy(C.centroid);X.multiplyVector3(j.centroidWorld);
|
|
|
-j.centroidScreen.copy(j.centroidWorld);s.multiplyVector3(j.centroidScreen);N=C.vertexNormals;n=j.vertexNormalsWorld;G=0;for(T=N.length;G<T;G++){V=n[G]=n[G]||new THREE.Vector3;V.copy(N[G]);K.multiplyVector3(V)}j.z=j.centroidScreen.z;j.meshMaterials=E;j.faceMaterials=C.materials;j.overdraw=F;if(H.geometry.uvs[w]){j.uvs[0]=H.geometry.uvs[w][0];j.uvs[1]=H.geometry.uvs[w][1];j.uvs[2]=H.geometry.uvs[w][2]}o.push(j);c++}}else if(C instanceof THREE.Face4){G=R[C.a];T=R[C.b];N=R[C.c];V=R[C.d];if(G.__visible&&
|
|
|
-T.__visible&&N.__visible&&V.__visible)if(H.doubleSided||H.flipSided!=((V.positionScreen.x-G.positionScreen.x)*(T.positionScreen.y-G.positionScreen.y)-(V.positionScreen.y-G.positionScreen.y)*(T.positionScreen.x-G.positionScreen.x)<0||(T.positionScreen.x-N.positionScreen.x)*(V.positionScreen.y-N.positionScreen.y)-(T.positionScreen.y-N.positionScreen.y)*(V.positionScreen.x-N.positionScreen.x)<0)){j=k[c]=k[c]||new THREE.RenderableFace3;j.v1.positionWorld.copy(G.positionWorld);j.v2.positionWorld.copy(T.positionWorld);
|
|
|
-j.v3.positionWorld.copy(V.positionWorld);j.v1.positionScreen.copy(G.positionScreen);j.v2.positionScreen.copy(T.positionScreen);j.v3.positionScreen.copy(V.positionScreen);j.normalWorld.copy(C.normal);K.multiplyVector3(j.normalWorld);j.centroidWorld.copy(C.centroid);X.multiplyVector3(j.centroidWorld);j.centroidScreen.copy(j.centroidWorld);s.multiplyVector3(j.centroidScreen);j.z=j.centroidScreen.z;j.meshMaterials=E;j.faceMaterials=C.materials;j.overdraw=F;if(H.geometry.uvs[w]){j.uvs[0]=H.geometry.uvs[w][0];
|
|
|
-j.uvs[1]=H.geometry.uvs[w][1];j.uvs[2]=H.geometry.uvs[w][3]}o.push(j);c++;p=k[c]=k[c]||new THREE.RenderableFace3;p.v1.positionWorld.copy(T.positionWorld);p.v2.positionWorld.copy(N.positionWorld);p.v3.positionWorld.copy(V.positionWorld);p.v1.positionScreen.copy(T.positionScreen);p.v2.positionScreen.copy(N.positionScreen);p.v3.positionScreen.copy(V.positionScreen);p.normalWorld.copy(j.normalWorld);p.centroidWorld.copy(j.centroidWorld);p.centroidScreen.copy(j.centroidScreen);p.z=p.centroidScreen.z;p.meshMaterials=
|
|
|
-E;p.faceMaterials=C.materials;p.overdraw=F;if(H.geometry.uvs[w]){p.uvs[0]=H.geometry.uvs[w][1];p.uvs[1]=H.geometry.uvs[w][2];p.uvs[2]=H.geometry.uvs[w][3]}o.push(p);c++}}}}else if(H instanceof THREE.Line){L.multiply(s,X);R=H.geometry.vertices;C=R[0];C.positionScreen.copy(C.position);L.multiplyVector4(C.positionScreen);w=1;for(W=R.length;w<W;w++){G=R[w];G.positionScreen.copy(G.position);L.multiplyVector4(G.positionScreen);T=R[w-1];h.copy(G.positionScreen);q.copy(T.positionScreen);if(b(h,q)){h.multiplyScalar(1/
|
|
|
-h.w);q.multiplyScalar(1/q.w);m=D[B]=D[B]||new THREE.RenderableLine;m.v1.positionScreen.copy(h);m.v2.positionScreen.copy(q);m.z=Math.max(h.z,q.z);m.materials=H.materials;o.push(m);B++}}}else if(H instanceof THREE.Particle){O.set(H.position.x,H.position.y,H.position.z,1);s.multiplyVector4(O);O.z/=O.w;if(O.z>0&&O.z<1){x=M[A]=M[A]||new THREE.RenderableParticle;x.x=O.x/O.w;x.y=O.y/O.w;x.z=O.z;x.rotation=H.rotation.z;x.scale.x=H.scale.x*Math.abs(x.x-(O.x+i.projectionMatrix.n11)/(O.w+i.projectionMatrix.n14));
|
|
|
-x.scale.y=H.scale.y*Math.abs(x.y-(O.y+i.projectionMatrix.n22)/(O.w+i.projectionMatrix.n24));x.materials=H.materials;o.push(x);A++}}}}u&&o.sort(a);return o};this.unprojectVector=function(l,i){var u=new THREE.Matrix4;u.multiply(THREE.Matrix4.makeInvert(i.matrix),THREE.Matrix4.makeInvert(i.projectionMatrix));u.multiplyVector3(l);return l}};
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,f,e,g,j;this.domElement=document.createElement("div");this.setSize=function(p,c){f=p;e=c;g=f/2;j=e/2};this.render=function(p,c){var k,m,B,D,x,A,M,Q;a=b.projectScene(p,c);k=0;for(m=a.length;k<m;k++){x=a[k];if(x instanceof THREE.RenderableParticle){M=x.x*g+g;Q=x.y*j+j;B=0;for(D=x.material.length;B<D;B++){A=x.material[B];if(A instanceof THREE.ParticleDOMMaterial){A=A.domElement;A.style.left=M+"px";A.style.top=Q+"px"}}}}}};
|
|
|
-THREE.CanvasRenderer=function(){function a(ba){if(x!=ba)m.globalAlpha=x=ba}function b(ba){if(A!=ba){switch(ba){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}A=ba}}var f=null,e=new THREE.Projector,g=document.createElement("canvas"),j,p,c,k,m=g.getContext("2d"),B=null,D=null,x=1,A=0,M=null,Q=null,O=1,s,L,d,h,q,n,l,i,u,o=new THREE.Color,
|
|
|
-y=new THREE.Color,t=new THREE.Color,r=new THREE.Color,w=new THREE.Color,W,G,T,P,H,X,K,E,F,U=new THREE.Rectangle,R=new THREE.Rectangle,C=new THREE.Rectangle,N=false,V=new THREE.Color,ea=new THREE.Color,ma=new THREE.Color,na=new THREE.Color,La=Math.PI*2,Z=new THREE.Vector3,ra,sa,Ca,fa,ta,xa,pa=16;ra=document.createElement("canvas");ra.width=ra.height=2;sa=ra.getContext("2d");sa.fillStyle="rgba(0,0,0,1)";sa.fillRect(0,0,2,2);Ca=sa.getImageData(0,0,2,2);fa=Ca.data;ta=document.createElement("canvas");
|
|
|
-ta.width=ta.height=pa;xa=ta.getContext("2d");xa.translate(-pa/2,-pa/2);xa.scale(pa,pa);pa--;this.domElement=g;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(ba,la){j=ba;p=la;c=j/2;k=p/2;g.width=j;g.height=p;U.set(-c,-k,c,k)};this.setClearColor=function(ba,la){B=ba!==null?new THREE.Color(ba):null;D=la;R.set(-c,-k,c,k);m.setTransform(1,0,0,-1,c,k);this.clear()};this.clear=function(){if(!R.isEmpty()){R.inflate(1);R.minSelf(U);if(B!==null){b(THREE.NormalBlending);a(1);m.fillStyle=
|
|
|
-"rgba("+Math.floor(B.r*255)+","+Math.floor(B.g*255)+","+Math.floor(B.b*255)+","+D+")";m.fillRect(R.getX(),R.getY(),R.getWidth(),R.getHeight())}else m.clearRect(R.getX(),R.getY(),R.getWidth(),R.getHeight());R.empty()}};this.render=function(ba,la){function Ma(v){var S,J,z,I=v.lights;ea.setRGB(0,0,0);ma.setRGB(0,0,0);na.setRGB(0,0,0);v=0;for(S=I.length;v<S;v++){J=I[v];z=J.color;if(J instanceof THREE.AmbientLight){ea.r+=z.r;ea.g+=z.g;ea.b+=z.b}else if(J instanceof THREE.DirectionalLight){ma.r+=z.r;ma.g+=
|
|
|
-z.g;ma.b+=z.b}else if(J instanceof THREE.PointLight){na.r+=z.r;na.g+=z.g;na.b+=z.b}}}function ya(v,S,J,z){var I,Y,aa,ca,da=v.lights;v=0;for(I=da.length;v<I;v++){Y=da[v];aa=Y.color;ca=Y.intensity;if(Y instanceof THREE.DirectionalLight){Y=J.dot(Y.position)*ca;if(Y>0){z.r+=aa.r*Y;z.g+=aa.g*Y;z.b+=aa.b*Y}}else if(Y instanceof THREE.PointLight){Z.sub(Y.position,S);Z.normalize();Y=J.dot(Z)*ca;if(Y>0){z.r+=aa.r*Y;z.g+=aa.g*Y;z.b+=aa.b*Y}}}}function Na(v,S,J){if(J.opacity!=0){a(J.opacity);b(J.blending);var z,
|
|
|
-I,Y,aa,ca,da;if(J instanceof THREE.ParticleBasicMaterial){if(J.map){aa=J.map;ca=aa.width>>1;da=aa.height>>1;I=S.scale.x*c;Y=S.scale.y*k;J=I*ca;z=Y*da;C.set(v.x-J,v.y-z,v.x+J,v.y+z);if(!U.instersects(C))return;m.save();m.translate(v.x,v.y);m.rotate(-S.rotation);m.scale(I,-Y);m.translate(-ca,-da);m.drawImage(aa,0,0);m.restore()}m.beginPath();m.moveTo(v.x-10,v.y);m.lineTo(v.x+10,v.y);m.moveTo(v.x,v.y-10);m.lineTo(v.x,v.y+10);m.closePath();m.strokeStyle="rgb(255,255,0)";m.stroke()}else if(J instanceof
|
|
|
-THREE.ParticleCircleMaterial){if(N){V.r=ea.r+ma.r+na.r;V.g=ea.g+ma.g+na.g;V.b=ea.b+ma.b+na.b;o.r=J.color.r*V.r;o.g=J.color.g*V.g;o.b=J.color.b*V.b;o.updateStyleString()}else o.__styleString=J.color.__styleString;J=S.scale.x*c;z=S.scale.y*k;C.set(v.x-J,v.y-z,v.x+J,v.y+z);if(U.instersects(C)){I=o.__styleString;if(Q!=I)m.fillStyle=Q=I;m.save();m.translate(v.x,v.y);m.rotate(-S.rotation);m.scale(J,z);m.beginPath();m.arc(0,0,1,0,La,true);m.closePath();m.fill();m.restore()}}}}function Oa(v,S,J,z){if(z.opacity!=
|
|
|
-0){a(z.opacity);b(z.blending);m.beginPath();m.moveTo(v.positionScreen.x,v.positionScreen.y);m.lineTo(S.positionScreen.x,S.positionScreen.y);m.closePath();if(z instanceof THREE.LineBasicMaterial){o.__styleString=z.color.__styleString;v=z.linewidth;if(O!=v)m.lineWidth=O=v;v=o.__styleString;if(M!=v)m.strokeStyle=M=v;m.stroke();C.inflate(z.linewidth*2)}}}function Ha(v,S,J,z,I,Y){if(I.opacity!=0){a(I.opacity);b(I.blending);h=v.positionScreen.x;q=v.positionScreen.y;n=S.positionScreen.x;l=S.positionScreen.y;
|
|
|
-i=J.positionScreen.x;u=J.positionScreen.y;m.beginPath();m.moveTo(h,q);m.lineTo(n,l);m.lineTo(i,u);m.lineTo(h,q);m.closePath();if(I instanceof THREE.MeshBasicMaterial)if(I.map)I.map.image.loaded&&I.map.mapping instanceof THREE.UVMapping&&ua(h,q,n,l,i,u,I.map.image,z.uvs[0].u,z.uvs[0].v,z.uvs[1].u,z.uvs[1].v,z.uvs[2].u,z.uvs[2].v);else if(I.env_map){if(I.env_map.image.loaded)if(I.env_map.mapping instanceof THREE.SphericalReflectionMapping){v=la.matrix;Z.copy(z.vertexNormalsWorld[0]);P=(Z.x*v.n11+Z.y*
|
|
|
-v.n12+Z.z*v.n13)*0.5+0.5;H=-(Z.x*v.n21+Z.y*v.n22+Z.z*v.n23)*0.5+0.5;Z.copy(z.vertexNormalsWorld[1]);X=(Z.x*v.n11+Z.y*v.n12+Z.z*v.n13)*0.5+0.5;K=-(Z.x*v.n21+Z.y*v.n22+Z.z*v.n23)*0.5+0.5;Z.copy(z.vertexNormalsWorld[2]);E=(Z.x*v.n11+Z.y*v.n12+Z.z*v.n13)*0.5+0.5;F=-(Z.x*v.n21+Z.y*v.n22+Z.z*v.n23)*0.5+0.5;ua(h,q,n,l,i,u,I.env_map.image,P,H,X,K,E,F)}}else I.wireframe?za(I.color.__styleString,I.wireframe_linewidth):Aa(I.color.__styleString);else if(I instanceof THREE.MeshLambertMaterial){if(I.map&&!I.wireframe){I.map.mapping instanceof
|
|
|
-THREE.UVMapping&&ua(h,q,n,l,i,u,I.map.image,z.uvs[0].u,z.uvs[0].v,z.uvs[1].u,z.uvs[1].v,z.uvs[2].u,z.uvs[2].v);b(THREE.SubtractiveBlending)}if(N)if(!I.wireframe&&I.shading==THREE.SmoothShading&&z.vertexNormalsWorld.length==3){y.r=t.r=r.r=ea.r;y.g=t.g=r.g=ea.g;y.b=t.b=r.b=ea.b;ya(Y,z.v1.positionWorld,z.vertexNormalsWorld[0],y);ya(Y,z.v2.positionWorld,z.vertexNormalsWorld[1],t);ya(Y,z.v3.positionWorld,z.vertexNormalsWorld[2],r);w.r=(t.r+r.r)*0.5;w.g=(t.g+r.g)*0.5;w.b=(t.b+r.b)*0.5;T=Ia(y,t,r,w);ua(h,
|
|
|
-q,n,l,i,u,T,0,0,1,0,0,1)}else{V.r=ea.r;V.g=ea.g;V.b=ea.b;ya(Y,z.centroidWorld,z.normalWorld,V);o.r=I.color.r*V.r;o.g=I.color.g*V.g;o.b=I.color.b*V.b;o.updateStyleString();I.wireframe?za(o.__styleString,I.wireframe_linewidth):Aa(o.__styleString)}else I.wireframe?za(I.color.__styleString,I.wireframe_linewidth):Aa(I.color.__styleString)}else if(I instanceof THREE.MeshDepthMaterial){W=la.near;G=la.far;y.r=y.g=y.b=1-Da(v.positionScreen.z,W,G);t.r=t.g=t.b=1-Da(S.positionScreen.z,W,G);r.r=r.g=r.b=1-Da(J.positionScreen.z,
|
|
|
-W,G);w.r=(t.r+r.r)*0.5;w.g=(t.g+r.g)*0.5;w.b=(t.b+r.b)*0.5;T=Ia(y,t,r,w);ua(h,q,n,l,i,u,T,0,0,1,0,0,1)}else if(I instanceof THREE.MeshNormalMaterial){o.r=Ea(z.normalWorld.x);o.g=Ea(z.normalWorld.y);o.b=Ea(z.normalWorld.z);o.updateStyleString();I.wireframe?za(o.__styleString,I.wireframe_linewidth):Aa(o.__styleString)}}}function za(v,S){if(M!=v)m.strokeStyle=M=v;if(O!=S)m.lineWidth=O=S;m.stroke();C.inflate(S*2)}function Aa(v){if(Q!=v)m.fillStyle=Q=v;m.fill()}function ua(v,S,J,z,I,Y,aa,ca,da,ia,ga,ja,
|
|
|
-va){var oa,ka;oa=aa.width-1;ka=aa.height-1;ca*=oa;da*=ka;ia*=oa;ga*=ka;ja*=oa;va*=ka;J-=v;z-=S;I-=v;Y-=S;ia-=ca;ga-=da;ja-=ca;va-=da;ka=1/(ia*va-ja*ga);oa=(va*J-ga*I)*ka;ga=(va*z-ga*Y)*ka;J=(ia*I-ja*J)*ka;z=(ia*Y-ja*z)*ka;v=v-oa*ca-J*da;S=S-ga*ca-z*da;m.save();m.transform(oa,ga,J,z,v,S);m.clip();m.drawImage(aa,0,0);m.restore()}function Ia(v,S,J,z){var I=~~(v.r*255),Y=~~(v.g*255);v=~~(v.b*255);var aa=~~(S.r*255),ca=~~(S.g*255);S=~~(S.b*255);var da=~~(J.r*255),ia=~~(J.g*255);J=~~(J.b*255);var ga=~~(z.r*
|
|
|
-255),ja=~~(z.g*255);z=~~(z.b*255);fa[0]=I<0?0:I>255?255:I;fa[1]=Y<0?0:Y>255?255:Y;fa[2]=v<0?0:v>255?255:v;fa[4]=aa<0?0:aa>255?255:aa;fa[5]=ca<0?0:ca>255?255:ca;fa[6]=S<0?0:S>255?255:S;fa[8]=da<0?0:da>255?255:da;fa[9]=ia<0?0:ia>255?255:ia;fa[10]=J<0?0:J>255?255:J;fa[12]=ga<0?0:ga>255?255:ga;fa[13]=ja<0?0:ja>255?255:ja;fa[14]=z<0?0:z>255?255:z;sa.putImageData(Ca,0,0);xa.drawImage(ra,0,0);return ta}function Da(v,S,J){v=(v-S)/(J-S);return v*v*(3-2*v)}function Ea(v){v=(v+1)*0.5;return v<0?0:v>1?1:v}function Fa(v,
|
|
|
-S){var J=S.x-v.x,z=S.y-v.y,I=1/Math.sqrt(J*J+z*z);J*=I;z*=I;S.x+=J;S.y+=z;v.x-=J;v.y-=z}var Ba,Ja,$,ha,qa,Ga,Ka,wa;m.setTransform(1,0,0,-1,c,k);this.autoClear&&this.clear();f=e.projectScene(ba,la,this.sortElements);m.fillStyle="rgba( 0, 255, 255, 0.5 )";m.fillRect(U.getX(),U.getY(),U.getWidth(),U.getHeight());(N=ba.lights.length>0)&&Ma(ba);Ba=0;for(Ja=f.length;Ba<Ja;Ba++){$=f[Ba];C.empty();if($ instanceof THREE.RenderableParticle){s=$;s.x*=c;s.y*=k;ha=0;for(qa=$.materials.length;ha<qa;ha++)Na(s,$,
|
|
|
-$.materials[ha],ba)}else if($ instanceof THREE.RenderableLine){s=$.v1;L=$.v2;s.positionScreen.x*=c;s.positionScreen.y*=k;L.positionScreen.x*=c;L.positionScreen.y*=k;C.addPoint(s.positionScreen.x,s.positionScreen.y);C.addPoint(L.positionScreen.x,L.positionScreen.y);if(U.instersects(C)){ha=0;for(qa=$.materials.length;ha<qa;)Oa(s,L,$,$.materials[ha++],ba)}}else if($ instanceof THREE.RenderableFace3){s=$.v1;L=$.v2;d=$.v3;s.positionScreen.x*=c;s.positionScreen.y*=k;L.positionScreen.x*=c;L.positionScreen.y*=
|
|
|
-k;d.positionScreen.x*=c;d.positionScreen.y*=k;if($.overdraw){Fa(s.positionScreen,L.positionScreen);Fa(L.positionScreen,d.positionScreen);Fa(d.positionScreen,s.positionScreen)}C.add3Points(s.positionScreen.x,s.positionScreen.y,L.positionScreen.x,L.positionScreen.y,d.positionScreen.x,d.positionScreen.y);if(U.instersects(C)){ha=0;for(qa=$.meshMaterials.length;ha<qa;){wa=$.meshMaterials[ha++];if(wa instanceof THREE.MeshFaceMaterial){Ga=0;for(Ka=$.faceMaterials.length;Ga<Ka;)(wa=$.faceMaterials[Ga++])&&
|
|
|
-Ha(s,L,d,$,wa,ba)}else Ha(s,L,d,$,wa,ba)}}}R.addRectangle(C)}m.lineWidth=1;m.strokeStyle="rgba( 255, 0, 0, 0.5 )";m.strokeRect(R.getX(),R.getY(),R.getWidth(),R.getHeight());m.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(P,H,X){var K,E,F,U;K=0;for(E=P.lights.length;K<E;K++){F=P.lights[K];if(F instanceof THREE.DirectionalLight){U=H.normalWorld.dot(F.position)*F.intensity;if(U>0){X.r+=F.color.r*U;X.g+=F.color.g*U;X.b+=F.color.b*U}}else if(F instanceof THREE.PointLight){u.sub(F.position,H.centroidWorld);u.normalize();U=H.normalWorld.dot(u)*F.intensity;if(U>0){X.r+=F.color.r*U;X.g+=F.color.g*U;X.b+=F.color.b*U}}}}function b(P,H,X,K,E,F){r=e(w++);r.setAttribute("d","M "+P.positionScreen.x+
|
|
|
-" "+P.positionScreen.y+" L "+H.positionScreen.x+" "+H.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+"z");if(E instanceof THREE.MeshBasicMaterial)d.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshLambertMaterial)if(L){h.r=q.r;h.g=q.g;h.b=q.b;a(F,K,h);d.r=E.color.r*h.r;d.g=E.color.g*h.g;d.b=E.color.b*h.b;d.updateStyleString()}else d.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshDepthMaterial){i=1-E.__2near/(E.__farPlusNear-K.z*E.__farMinusNear);
|
|
|
-d.setRGB(i,i,i)}else E instanceof THREE.MeshNormalMaterial&&d.setRGB(g(K.normalWorld.x),g(K.normalWorld.y),g(K.normalWorld.z));E.wireframe?r.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+E.wireframe_linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframe_linecap+"; stroke-linejoin: "+E.wireframe_linejoin):r.setAttribute("style","fill: "+d.__styleString+"; fill-opacity: "+E.opacity);c.appendChild(r)}function f(P,H,X,K,E,F,U){r=e(w++);r.setAttribute("d",
|
|
|
-"M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+H.positionScreen.x+" "+H.positionScreen.y+" L "+X.positionScreen.x+","+X.positionScreen.y+" L "+K.positionScreen.x+","+K.positionScreen.y+"z");if(F instanceof THREE.MeshBasicMaterial)d.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshLambertMaterial)if(L){h.r=q.r;h.g=q.g;h.b=q.b;a(U,E,h);d.r=F.color.r*h.r;d.g=F.color.g*h.g;d.b=F.color.b*h.b;d.updateStyleString()}else d.__styleString=F.color.__styleString;else if(F instanceof THREE.MeshDepthMaterial){i=
|
|
|
-1-F.__2near/(F.__farPlusNear-E.z*F.__farMinusNear);d.setRGB(i,i,i)}else F instanceof THREE.MeshNormalMaterial&&d.setRGB(g(E.normalWorld.x),g(E.normalWorld.y),g(E.normalWorld.z));F.wireframe?r.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+F.wireframe_linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.wireframe_linecap+"; stroke-linejoin: "+F.wireframe_linejoin):r.setAttribute("style","fill: "+d.__styleString+"; fill-opacity: "+F.opacity);c.appendChild(r)}
|
|
|
-function e(P){if(o[P]==null){o[P]=document.createElementNS("http://www.w3.org/2000/svg","path");T==0&&o[P].setAttribute("shape-rendering","crispEdges");return o[P]}return o[P]}function g(P){return P<0?Math.min((1+P)*0.5,0.5):0.5+Math.min(P*0.5,0.5)}var j=null,p=new THREE.Projector,c=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,m,B,D,x,A,M,Q,O=new THREE.Rectangle,s=new THREE.Rectangle,L=false,d=new THREE.Color(16777215),h=new THREE.Color(16777215),q=new THREE.Color(0),n=new THREE.Color(0),
|
|
|
-l=new THREE.Color(0),i,u=new THREE.Vector3,o=[],y=[],t=[],r,w,W,G,T=1;this.domElement=c;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(P){switch(P){case "high":T=1;break;case "low":T=0}};this.setSize=function(P,H){k=P;m=H;B=k/2;D=m/2;c.setAttribute("viewBox",-B+" "+-D+" "+k+" "+m);c.setAttribute("width",k);c.setAttribute("height",m);O.set(-B,-D,B,D)};this.clear=function(){for(;c.childNodes.length>0;)c.removeChild(c.childNodes[0])};this.render=function(P,H){var X,K,
|
|
|
-E,F,U,R,C,N;this.autoClear&&this.clear();j=p.projectScene(P,H,this.sortElements);G=W=w=0;if(L=P.lights.length>0){C=P.lights;q.setRGB(0,0,0);n.setRGB(0,0,0);l.setRGB(0,0,0);X=0;for(K=C.length;X<K;X++){E=C[X];F=E.color;if(E instanceof THREE.AmbientLight){q.r+=F.r;q.g+=F.g;q.b+=F.b}else if(E instanceof THREE.DirectionalLight){n.r+=F.r;n.g+=F.g;n.b+=F.b}else if(E instanceof THREE.PointLight){l.r+=F.r;l.g+=F.g;l.b+=F.b}}}X=0;for(K=j.length;X<K;X++){C=j[X];s.empty();if(C instanceof THREE.RenderableParticle){x=
|
|
|
-C;x.x*=B;x.y*=-D;E=0;for(F=C.materials.length;E<F;E++)if(N=C.materials[E]){U=x;R=C;N=N;var V=W++;if(y[V]==null){y[V]=document.createElementNS("http://www.w3.org/2000/svg","circle");T==0&&y[V].setAttribute("shape-rendering","crispEdges")}r=y[V];r.setAttribute("cx",U.x);r.setAttribute("cy",U.y);r.setAttribute("r",R.scale.x*B);if(N instanceof THREE.ParticleCircleMaterial){if(L){h.r=q.r+n.r+l.r;h.g=q.g+n.g+l.g;h.b=q.b+n.b+l.b;d.r=N.color.r*h.r;d.g=N.color.g*h.g;d.b=N.color.b*h.b;d.updateStyleString()}else d=
|
|
|
-N.color;r.setAttribute("style","fill: "+d.__styleString)}c.appendChild(r)}}else if(C instanceof THREE.RenderableLine){x=C.v1;A=C.v2;x.positionScreen.x*=B;x.positionScreen.y*=-D;A.positionScreen.x*=B;A.positionScreen.y*=-D;s.addPoint(x.positionScreen.x,x.positionScreen.y);s.addPoint(A.positionScreen.x,A.positionScreen.y);if(O.instersects(s)){E=0;for(F=C.materials.length;E<F;)if(N=C.materials[E++]){U=x;R=A;N=N;V=G++;if(t[V]==null){t[V]=document.createElementNS("http://www.w3.org/2000/svg","line");T==
|
|
|
-0&&t[V].setAttribute("shape-rendering","crispEdges")}r=t[V];r.setAttribute("x1",U.positionScreen.x);r.setAttribute("y1",U.positionScreen.y);r.setAttribute("x2",R.positionScreen.x);r.setAttribute("y2",R.positionScreen.y);if(N instanceof THREE.LineBasicMaterial){d.__styleString=N.color.__styleString;r.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+N.linewidth+"; stroke-opacity: "+N.opacity+"; stroke-linecap: "+N.linecap+"; stroke-linejoin: "+N.linejoin);c.appendChild(r)}}}}else if(C instanceof
|
|
|
-THREE.RenderableFace3){x=C.v1;A=C.v2;M=C.v3;x.positionScreen.x*=B;x.positionScreen.y*=-D;A.positionScreen.x*=B;A.positionScreen.y*=-D;M.positionScreen.x*=B;M.positionScreen.y*=-D;s.addPoint(x.positionScreen.x,x.positionScreen.y);s.addPoint(A.positionScreen.x,A.positionScreen.y);s.addPoint(M.positionScreen.x,M.positionScreen.y);if(O.instersects(s)){E=0;for(F=C.meshMaterials.length;E<F;){N=C.meshMaterials[E++];if(N instanceof THREE.MeshFaceMaterial){U=0;for(R=C.faceMaterials.length;U<R;)(N=C.faceMaterials[U++])&&
|
|
|
-b(x,A,M,C,N,P)}else N&&b(x,A,M,C,N,P)}}}else if(C instanceof THREE.RenderableFace4){x=C.v1;A=C.v2;M=C.v3;Q=C.v4;x.positionScreen.x*=B;x.positionScreen.y*=-D;A.positionScreen.x*=B;A.positionScreen.y*=-D;M.positionScreen.x*=B;M.positionScreen.y*=-D;Q.positionScreen.x*=B;Q.positionScreen.y*=-D;s.addPoint(x.positionScreen.x,x.positionScreen.y);s.addPoint(A.positionScreen.x,A.positionScreen.y);s.addPoint(M.positionScreen.x,M.positionScreen.y);s.addPoint(Q.positionScreen.x,Q.positionScreen.y);if(O.instersects(s)){E=
|
|
|
-0;for(F=C.meshMaterials.length;E<F;){N=C.meshMaterials[E++];if(N instanceof THREE.MeshFaceMaterial){U=0;for(R=C.faceMaterials.length;U<R;)(N=C.faceMaterials[U++])&&f(x,A,M,Q,C,N,P)}else N&&f(x,A,M,Q,C,N,P)}}}}}};
|
|
|
-THREE.WebGLRenderer=function(a){function b(d,h){d.fragment_shader=h.fragment_shader;d.vertex_shader=h.vertex_shader;d.uniforms=Uniforms.clone(h.uniforms)}function f(d,h){d.uniforms.color.value.setRGB(d.color.r*d.opacity,d.color.g*d.opacity,d.color.b*d.opacity);d.uniforms.opacity.value=d.opacity;d.uniforms.map.texture=d.map;d.uniforms.env_map.texture=d.env_map;d.uniforms.reflectivity.value=d.reflectivity;d.uniforms.refraction_ratio.value=d.refraction_ratio;d.uniforms.combine.value=d.combine;d.uniforms.useRefract.value=
|
|
|
-d.env_map&&d.env_map.mapping instanceof THREE.CubeRefractionMapping;if(h){d.uniforms.fogColor.value.setHex(h.color.hex);if(h instanceof THREE.Fog){d.uniforms.fogNear.value=h.near;d.uniforms.fogFar.value=h.far}else if(h instanceof THREE.FogExp2)d.uniforms.fogDensity.value=h.density}}function e(d,h){d.uniforms.color.value.setRGB(d.color.r*d.opacity,d.color.g*d.opacity,d.color.b*d.opacity);d.uniforms.opacity.value=d.opacity;if(h){d.uniforms.fogColor.value.setHex(h.color.hex);if(h instanceof THREE.Fog){d.uniforms.fogNear.value=
|
|
|
-h.near;d.uniforms.fogFar.value=h.far}else if(h instanceof THREE.FogExp2)d.uniforms.fogDensity.value=h.density}}function g(d,h){var q;if(d=="fragment")q=c.createShader(c.FRAGMENT_SHADER);else if(d=="vertex")q=c.createShader(c.VERTEX_SHADER);c.shaderSource(q,h);c.compileShader(q);if(!c.getShaderParameter(q,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(q));return null}return q}function j(d){switch(d){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;
|
|
|
-case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR}return 0}var p=document.createElement("canvas"),c,k=null,m=new THREE.Matrix4,B,D=new Float32Array(16),x=new Float32Array(16),A=new Float32Array(16),
|
|
|
-M=new Float32Array(9),Q=new Float32Array(16),O=true,s=new THREE.Color(0),L=0;if(a){if(a.antialias!==undefined)O=a.antialias;a.clearColor!==undefined&&s.setHex(a.clearColor);if(a.clearAlpha!==undefined)L=a.clearAlpha}this.domElement=p;this.autoClear=true;(function(d,h,q){try{c=p.getContext("experimental-webgl",{antialias:d})}catch(n){}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);
|
|
|
-c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(h.r,h.g,h.b,q)})(O,s,L);this.setSize=function(d,h){p.width=d;p.height=h;c.viewport(0,0,p.width,p.height)};this.setClearColor=function(d,h){var q=new THREE.Color(d);c.clearColor(q.r,q.g,q.b,h)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(d,h){var q,n,l,i=0,u=0,o=0,y=[],t=[],r=[],w=[];q=0;for(n=h.length;q<n;q++){l=h[q];if(l instanceof THREE.AmbientLight){i+=
|
|
|
-l.color.r;u+=l.color.g;o+=l.color.b}else if(l instanceof THREE.DirectionalLight){y.push(l.color.r*l.intensity,l.color.g*l.intensity,l.color.b*l.intensity);t.push(l.position.x,l.position.y,l.position.z)}else if(l instanceof THREE.PointLight){r.push(l.color.r*l.intensity,l.color.g*l.intensity,l.color.b*l.intensity);w.push(l.position.x,l.position.y,l.position.z)}}return{ambient:[i,u,o],directional:{colors:y,positions:t},point:{colors:r,positions:w}}};this.createParticleBuffers=function(){};this.createLineBuffers=
|
|
|
-function(d){var h,q,n,l=[],i=[],u=d.geometry.vertices;h=0;for(q=u.length;h<q;h++){n=u[h].position;l.push(n.x,n.y,n.z);i.push(h)}if(l.length){d.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,d.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(l),c.STATIC_DRAW);d.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,d.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(i),c.STATIC_DRAW);d.__webGLLineCount=i.length}};this.createBuffers=
|
|
|
-function(d,h){var q,n,l,i,u,o,y,t,r,w,W=[],G=[],T=[],P=[],H=[],X=[],K=0,E=d.geometry.geometryChunks[h],F;u=false;q=0;for(n=d.materials.length;q<n;q++){o=d.materials[q];if(o instanceof THREE.MeshFaceMaterial){o=0;for(F=E.materials.length;o<F;o++)if(E.materials[o]&&E.materials[o].shading!=undefined&&E.materials[o].shading==THREE.SmoothShading){u=true;break}}else if(o&&o.shading!=undefined&&o.shading==THREE.SmoothShading){u=true;break}if(u)break}F=u;q=0;for(n=E.faces.length;q<n;q++){l=E.faces[q];i=d.geometry.faces[l];
|
|
|
-u=i.vertexNormals;o=i.normal;l=d.geometry.uvs[l];if(i instanceof THREE.Face3){y=d.geometry.vertices[i.a].position;t=d.geometry.vertices[i.b].position;r=d.geometry.vertices[i.c].position;T.push(y.x,y.y,y.z,t.x,t.y,t.z,r.x,r.y,r.z);if(d.geometry.hasTangents){y=d.geometry.vertices[i.a].tangent;t=d.geometry.vertices[i.b].tangent;r=d.geometry.vertices[i.c].tangent;H.push(y.x,y.y,y.z,y.w,t.x,t.y,t.z,t.w,r.x,r.y,r.z,r.w)}if(u.length==3&&F)for(i=0;i<3;i++)P.push(u[i].x,u[i].y,u[i].z);else for(i=0;i<3;i++)P.push(o.x,
|
|
|
-o.y,o.z);if(l)for(i=0;i<3;i++)X.push(l[i].u,l[i].v);W.push(K,K+1,K+2);G.push(K,K+1,K,K+2,K+1,K+2);K+=3}else if(i instanceof THREE.Face4){y=d.geometry.vertices[i.a].position;t=d.geometry.vertices[i.b].position;r=d.geometry.vertices[i.c].position;w=d.geometry.vertices[i.d].position;T.push(y.x,y.y,y.z,t.x,t.y,t.z,r.x,r.y,r.z,w.x,w.y,w.z);if(d.geometry.hasTangents){y=d.geometry.vertices[i.a].tangent;t=d.geometry.vertices[i.b].tangent;r=d.geometry.vertices[i.c].tangent;i=d.geometry.vertices[i.d].tangent;
|
|
|
-H.push(y.x,y.y,y.z,y.w,t.x,t.y,t.z,t.w,r.x,r.y,r.z,r.w,i.x,i.y,i.z,i.w)}if(u.length==4&&F)for(i=0;i<4;i++)P.push(u[i].x,u[i].y,u[i].z);else for(i=0;i<4;i++)P.push(o.x,o.y,o.z);if(l)for(i=0;i<4;i++)X.push(l[i].u,l[i].v);W.push(K,K+1,K+2,K,K+2,K+3);G.push(K,K+1,K,K+2,K,K+3,K+1,K+2,K+2,K+3);K+=4}}if(T.length){E.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,E.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(T),c.STATIC_DRAW);E.__webGLNormalBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
-E.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(P),c.STATIC_DRAW);if(d.geometry.hasTangents){E.__webGLTangentBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,E.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(H),c.STATIC_DRAW)}if(X.length>0){E.__webGLUVBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,E.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(X),c.STATIC_DRAW)}E.__webGLFaceBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
|
|
|
-E.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(W),c.STATIC_DRAW);E.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,E.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(G),c.STATIC_DRAW);E.__webGLFaceCount=W.length;E.__webGLLineCount=G.length}};this.renderBuffer=function(d,h,q,n,l){var i,u,o,y;if(!n.program){if(n instanceof THREE.MeshDepthMaterial){b(n,THREE.ShaderLib.depth);n.uniforms.mNear.value=d.near;n.uniforms.mFar.value=d.far}else if(n instanceof
|
|
|
-THREE.MeshNormalMaterial)b(n,THREE.ShaderLib.normal);else if(n instanceof THREE.MeshBasicMaterial){b(n,THREE.ShaderLib.basic);f(n,q)}else if(n instanceof THREE.MeshLambertMaterial){b(n,THREE.ShaderLib.lambert);f(n,q)}else if(n instanceof THREE.MeshPhongMaterial){b(n,THREE.ShaderLib.phong);f(n,q)}else if(n instanceof THREE.LineBasicMaterial){b(n,THREE.ShaderLib.basic);e(n,q)}var t,r,w;t=y=u=0;for(r=h.length;t<r;t++){w=h[t];w instanceof THREE.DirectionalLight&&y++;w instanceof THREE.PointLight&&u++}if(u+
|
|
|
-y<=4){t=y;u=u}else{t=Math.ceil(4*y/(u+y));u=4-t}u={directional:t,point:u};y={fog:q,map:n.map,env_map:n.env_map,maxDirLights:u.directional,maxPointLights:u.point};u=n.fragment_shader;t=n.vertex_shader;r=c.createProgram();w=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+y.maxDirLights,"#define MAX_POINT_LIGHTS "+y.maxPointLights,y.fog?"#define USE_FOG":"",y.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",y.map?"#define USE_MAP":"",y.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
|
|
|
-y=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+y.maxDirLights,"#define MAX_POINT_LIGHTS "+y.maxPointLights,y.map?"#define USE_MAP":"",y.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");c.attachShader(r,
|
|
|
-g("fragment",w+u));c.attachShader(r,g("vertex",y+t));c.linkProgram(r);c.getProgramParameter(r,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(r,c.VALIDATE_STATUS)+", gl error ["+c.getError()+"]");r.uniforms={};r.attributes={};n.program=r;u=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(i in n.uniforms)u.push(i);i=n.program;t=0;for(r=u.length;t<r;t++){w=u[t];i.uniforms[w]=c.getUniformLocation(i,w)}i=
|
|
|
-n.program;u=["position","normal","uv","tangent"];t=0;for(r=u.length;t<r;t++){w=u[t];i.attributes[w]=c.getAttribLocation(i,w)}}i=n.program;if(i!=k){c.useProgram(i);k=i}this.loadCamera(i,d);this.loadMatrices(i);if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial){d=this.setupLights(i,h);n.uniforms.enableLighting.value=d.directional.positions.length+d.point.positions.length;n.uniforms.ambientLightColor.value=d.ambient;n.uniforms.directionalLightColor.value=d.directional.colors;
|
|
|
-n.uniforms.directionalLightDirection.value=d.directional.positions;n.uniforms.pointLightColor.value=d.point.colors;n.uniforms.pointLightPosition.value=d.point.positions}if(n instanceof THREE.MeshBasicMaterial||n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial)f(n,q);n instanceof THREE.LineBasicMaterial&&e(n,q);if(n instanceof THREE.MeshPhongMaterial){n.uniforms.ambient.value.setRGB(n.ambient.r,n.ambient.g,n.ambient.b);n.uniforms.specular.value.setRGB(n.specular.r,n.specular.g,
|
|
|
-n.specular.b);n.uniforms.shininess.value=n.shininess}q=n.uniforms;for(o in q)if(u=i.uniforms[o]){h=q[o].type;d=q[o].value;if(h=="i")c.uniform1i(u,d);else if(h=="f")c.uniform1f(u,d);else if(h=="fv")c.uniform3fv(u,d);else if(h=="v2")c.uniform2f(u,d.x,d.y);else if(h=="v3")c.uniform3f(u,d.x,d.y,d.z);else if(h=="c")c.uniform3f(u,d.r,d.g,d.b);else if(h=="t"){c.uniform1i(u,d);if(h=q[o].texture)if(h.image instanceof Array&&h.image.length==6){h=h;d=d;if(h.image.length==6){if(!h.image.__webGLTextureCube&&!h.image.__cubeMapInitialized&&
|
|
|
-h.image.loadCount==6){h.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,h.image.__webGLTextureCube);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(u=0;u<6;++u)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+u,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,
|
|
|
-h.image[u]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);h.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_CUBE_MAP,h.image.__webGLTextureCube)}}else{h=h;d=d;if(!h.__webGLTexture&&h.image.loaded){h.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,h.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,h.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,j(h.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,
|
|
|
-j(h.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,j(h.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,j(h.min_filter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,null)}c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_2D,h.__webGLTexture)}}}o=i.attributes;c.bindBuffer(c.ARRAY_BUFFER,l.__webGLVertexBuffer);c.vertexAttribPointer(o.position,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(o.position);if(o.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLNormalBuffer);
|
|
|
-c.vertexAttribPointer(o.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(o.normal)}if(o.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLTangentBuffer);c.vertexAttribPointer(o.tangent,4,c.FLOAT,false,0,0);c.enableVertexAttribArray(o.tangent)}if(o.uv>=0)if(l.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,l.__webGLUVBuffer);c.vertexAttribPointer(o.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(o.uv)}else c.disableVertexAttribArray(o.uv);if(n.wireframe||n instanceof THREE.LineBasicMaterial){o=
|
|
|
-n.wireframe_linewidth!==undefined?n.wireframe_linewidth:n.linewidth!==undefined?n.linewidth:1;n=n instanceof THREE.LineBasicMaterial&&l.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(o);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,l.__webGLLineBuffer);c.drawElements(n,l.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,l.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,l.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(d,h,q,n,l,i,u){var o,y,t,r,w;t=0;for(r=
|
|
|
-n.materials.length;t<r;t++){o=n.materials[t];if(o instanceof THREE.MeshFaceMaterial){o=0;for(y=l.materials.length;o<y;o++)if((w=l.materials[o])&&w.blending==i&&w.opacity<1==u){this.setBlending(w.blending);this.renderBuffer(d,h,q,w,l)}}else if((w=o)&&w.blending==i&&w.opacity<1==u){this.setBlending(w.blending);this.renderBuffer(d,h,q,w,l)}}};this.render=function(d,h){var q,n,l,i,u=d.lights,o=d.fog;this.initWebGLObjects(d);this.autoClear&&this.clear();h.autoUpdateMatrix&&h.updateMatrix();D.set(h.matrix.flatten());
|
|
|
-A.set(h.projectionMatrix.flatten());q=0;for(n=d.__webGLObjects.length;q<n;q++){l=d.__webGLObjects[q];i=l.object;l=l.buffer;if(i.visible){this.setupMatrices(i,h);this.renderPass(h,u,o,i,l,THREE.NormalBlending,false)}}q=0;for(n=d.__webGLObjects.length;q<n;q++){l=d.__webGLObjects[q];i=l.object;l=l.buffer;if(i.visible){this.setupMatrices(i,h);this.renderPass(h,u,o,i,l,THREE.AdditiveBlending,false);this.renderPass(h,u,o,i,l,THREE.SubtractiveBlending,false);this.renderPass(h,u,o,i,l,THREE.AdditiveBlending,
|
|
|
-true);this.renderPass(h,u,o,i,l,THREE.SubtractiveBlending,true);this.renderPass(h,u,o,i,l,THREE.NormalBlending,true)}}};this.initWebGLObjects=function(d){function h(y,t,r,w){if(y[t]==undefined){d.__webGLObjects.push({buffer:r,object:w});y[t]=1}}var q,n,l,i,u,o;if(!d.__webGLObjects){d.__webGLObjects=[];d.__webGLObjectsMap={}}q=0;for(n=d.objects.length;q<n;q++){l=d.objects[q];if(d.__webGLObjectsMap[l.id]==undefined)d.__webGLObjectsMap[l.id]={};o=d.__webGLObjectsMap[l.id];if(l instanceof THREE.Mesh)for(i in l.geometry.geometryChunks){u=
|
|
|
-l.geometry.geometryChunks[i];u.__webGLVertexBuffer||this.createBuffers(l,i);h(o,i,u,l)}else if(l instanceof THREE.Line){l.__webGLVertexBuffer||this.createLineBuffers(l);h(o,0,l,l)}else if(l instanceof THREE.ParticleSystem){l.__webGLVertexBuffer||this.createParticleBuffers(l);h(o,0,l,l)}}};this.removeObject=function(d,h){var q,n;for(q=d.__webGLObjects.length-1;q>=0;q--){n=d.__webGLObjects[q].object;h==n&&d.__webGLObjects.splice(q,1)}};this.setupMatrices=function(d,h){d.autoUpdateMatrix&&d.updateMatrix();
|
|
|
-m.multiply(h.matrix,d.matrix);x.set(m.flatten());B=THREE.Matrix4.makeInvert3x3(m).transpose();M.set(B.m);Q.set(d.matrix.flatten())};this.loadMatrices=function(d){c.uniformMatrix4fv(d.uniforms.viewMatrix,false,D);c.uniformMatrix4fv(d.uniforms.modelViewMatrix,false,x);c.uniformMatrix4fv(d.uniforms.projectionMatrix,false,A);c.uniformMatrix3fv(d.uniforms.normalMatrix,false,M);c.uniformMatrix4fv(d.uniforms.objectMatrix,false,Q)};this.loadCamera=function(d,h){c.uniform3f(d.uniforms.cameraPosition,h.position.x,
|
|
|
-h.position.y,h.position.z)};this.setBlending=function(d){switch(d){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=function(d,h){if(d){!h||h=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(d=="back")c.cullFace(c.BACK);else d=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};
|
|
|
-this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
-THREE.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",
|
|
|
+THREE.Fog=function(a,b,e){this.color=new THREE.Color(a);this.near=b||1;this.far=e||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
|
|
+THREE.Projector=function(){function a(m,t){return t.z-m.z}function b(m,t){var r=0,q=1,z=m.z+m.w,u=t.z+t.w,j=-m.z+m.w,w=-t.z+t.w;if(z>=0&&u>=0&&j>=0&&w>=0)return true;else if(z<0&&u<0||j<0&&w<0)return false;else{if(z<0)r=Math.max(r,z/(z-u));else if(u<0)q=Math.min(q,z/(z-u));if(j<0)r=Math.max(r,j/(j-w));else if(w<0)q=Math.min(q,j/(j-w));if(q<r)return false;else{m.lerpSelf(t,r);t.lerpSelf(m,1-q);return true}}}var e,f,g=[],i,p,c,k=[],l,D,F=[],y,C,S=[],W=new THREE.Vector4,U=new THREE.Vector4,s=new THREE.Matrix4,
|
|
|
+R=new THREE.Matrix4,d=[],h=new THREE.Vector4,o=new THREE.Vector4,n;this.projectObjects=function(m,t,r){var q=[],z,u;f=0;s.multiply(t.projectionMatrix,t.matrix);d[0]=new THREE.Vector4(s.n41-s.n11,s.n42-s.n12,s.n43-s.n13,s.n44-s.n14);d[1]=new THREE.Vector4(s.n41+s.n11,s.n42+s.n12,s.n43+s.n13,s.n44+s.n14);d[2]=new THREE.Vector4(s.n41+s.n21,s.n42+s.n22,s.n43+s.n23,s.n44+s.n24);d[3]=new THREE.Vector4(s.n41-s.n21,s.n42-s.n22,s.n43-s.n23,s.n44-s.n24);d[4]=new THREE.Vector4(s.n41-s.n31,s.n42-s.n32,s.n43-
|
|
|
+s.n33,s.n44-s.n34);d[5]=new THREE.Vector4(s.n41+s.n31,s.n42+s.n32,s.n43+s.n33,s.n44+s.n34);t=0;for(z=d.length;t<z;t++){u=d[t];u.divideScalar(Math.sqrt(u.x*u.x+u.y*u.y+u.z*u.z))}z=m.objects;m=0;for(t=z.length;m<t;m++){u=z[m];var j;if(!(j=!u.visible)){if(j=u instanceof THREE.Mesh){a:{j=void 0;for(var w=u.position,T=-u.geometry.boundingSphere.radius*Math.max(u.scale.x,Math.max(u.scale.y,u.scale.z)),A=0;A<6;A++){j=d[A].x*w.x+d[A].y*w.y+d[A].z*w.z+d[A].w;if(j<=T){j=false;break a}}j=true}j=!j}j=j}if(!j){e=
|
|
|
+g[f]=g[f]||new THREE.RenderableObject;W.copy(u.position);s.multiplyVector3(W);e.object=u;e.z=W.z;q.push(e);f++}}r&&q.sort(a);return q};this.projectScene=function(m,t,r){var q=[],z=t.near,u=t.far,j,w,T,A,K,N,I,V,Q,E,H,O,J,v,G,L;c=D=C=0;t.autoUpdateMatrix&&t.updateMatrix();s.multiply(t.projectionMatrix,t.matrix);N=this.projectObjects(m,t,true);m=0;for(j=N.length;m<j;m++){I=N[m].object;if(I.visible){I.autoUpdateMatrix&&I.updateMatrix();V=I.matrix;Q=I.rotationMatrix;E=I.materials;H=I.overdraw;if(I instanceof
|
|
|
+THREE.Mesh){O=I.geometry;J=O.vertices;w=0;for(T=J.length;w<T;w++){v=J[w];v.positionWorld.copy(v.position);V.multiplyVector3(v.positionWorld);A=v.positionScreen;A.copy(v.positionWorld);s.multiplyVector4(A);A.x/=A.w;A.y/=A.w;v.__visible=A.z>z&&A.z<u}O=O.faces;w=0;for(T=O.length;w<T;w++){v=O[w];if(v instanceof THREE.Face3){A=J[v.a];K=J[v.b];G=J[v.c];if(A.__visible&&K.__visible&&G.__visible)if(I.doubleSided||I.flipSided!=(G.positionScreen.x-A.positionScreen.x)*(K.positionScreen.y-A.positionScreen.y)-
|
|
|
+(G.positionScreen.y-A.positionScreen.y)*(K.positionScreen.x-A.positionScreen.x)<0){i=k[c]=k[c]||new THREE.RenderableFace3;i.v1.positionWorld.copy(A.positionWorld);i.v2.positionWorld.copy(K.positionWorld);i.v3.positionWorld.copy(G.positionWorld);i.v1.positionScreen.copy(A.positionScreen);i.v2.positionScreen.copy(K.positionScreen);i.v3.positionScreen.copy(G.positionScreen);i.normalWorld.copy(v.normal);Q.multiplyVector3(i.normalWorld);i.centroidWorld.copy(v.centroid);V.multiplyVector3(i.centroidWorld);
|
|
|
+i.centroidScreen.copy(i.centroidWorld);s.multiplyVector3(i.centroidScreen);G=v.vertexNormals;n=i.vertexNormalsWorld;A=0;for(K=G.length;A<K;A++){L=n[A]=n[A]||new THREE.Vector3;L.copy(G[A]);Q.multiplyVector3(L)}i.z=i.centroidScreen.z;i.meshMaterials=E;i.faceMaterials=v.materials;i.overdraw=H;if(I.geometry.uvs[w]){i.uvs[0]=I.geometry.uvs[w][0];i.uvs[1]=I.geometry.uvs[w][1];i.uvs[2]=I.geometry.uvs[w][2]}q.push(i);c++}}else if(v instanceof THREE.Face4){A=J[v.a];K=J[v.b];G=J[v.c];L=J[v.d];if(A.__visible&&
|
|
|
+K.__visible&&G.__visible&&L.__visible)if(I.doubleSided||I.flipSided!=((L.positionScreen.x-A.positionScreen.x)*(K.positionScreen.y-A.positionScreen.y)-(L.positionScreen.y-A.positionScreen.y)*(K.positionScreen.x-A.positionScreen.x)<0||(K.positionScreen.x-G.positionScreen.x)*(L.positionScreen.y-G.positionScreen.y)-(K.positionScreen.y-G.positionScreen.y)*(L.positionScreen.x-G.positionScreen.x)<0)){i=k[c]=k[c]||new THREE.RenderableFace3;i.v1.positionWorld.copy(A.positionWorld);i.v2.positionWorld.copy(K.positionWorld);
|
|
|
+i.v3.positionWorld.copy(L.positionWorld);i.v1.positionScreen.copy(A.positionScreen);i.v2.positionScreen.copy(K.positionScreen);i.v3.positionScreen.copy(L.positionScreen);i.normalWorld.copy(v.normal);Q.multiplyVector3(i.normalWorld);i.centroidWorld.copy(v.centroid);V.multiplyVector3(i.centroidWorld);i.centroidScreen.copy(i.centroidWorld);s.multiplyVector3(i.centroidScreen);i.z=i.centroidScreen.z;i.meshMaterials=E;i.faceMaterials=v.materials;i.overdraw=H;if(I.geometry.uvs[w]){i.uvs[0]=I.geometry.uvs[w][0];
|
|
|
+i.uvs[1]=I.geometry.uvs[w][1];i.uvs[2]=I.geometry.uvs[w][3]}q.push(i);c++;p=k[c]=k[c]||new THREE.RenderableFace3;p.v1.positionWorld.copy(K.positionWorld);p.v2.positionWorld.copy(G.positionWorld);p.v3.positionWorld.copy(L.positionWorld);p.v1.positionScreen.copy(K.positionScreen);p.v2.positionScreen.copy(G.positionScreen);p.v3.positionScreen.copy(L.positionScreen);p.normalWorld.copy(i.normalWorld);p.centroidWorld.copy(i.centroidWorld);p.centroidScreen.copy(i.centroidScreen);p.z=p.centroidScreen.z;p.meshMaterials=
|
|
|
+E;p.faceMaterials=v.materials;p.overdraw=H;if(I.geometry.uvs[w]){p.uvs[0]=I.geometry.uvs[w][1];p.uvs[1]=I.geometry.uvs[w][2];p.uvs[2]=I.geometry.uvs[w][3]}q.push(p);c++}}}}else if(I instanceof THREE.Line){R.multiply(s,V);J=I.geometry.vertices;v=J[0];v.positionScreen.copy(v.position);R.multiplyVector4(v.positionScreen);w=1;for(T=J.length;w<T;w++){A=J[w];A.positionScreen.copy(A.position);R.multiplyVector4(A.positionScreen);K=J[w-1];h.copy(A.positionScreen);o.copy(K.positionScreen);if(b(h,o)){h.multiplyScalar(1/
|
|
|
+h.w);o.multiplyScalar(1/o.w);l=F[D]=F[D]||new THREE.RenderableLine;l.v1.positionScreen.copy(h);l.v2.positionScreen.copy(o);l.z=Math.max(h.z,o.z);l.materials=I.materials;q.push(l);D++}}}else if(I instanceof THREE.Particle){U.set(I.position.x,I.position.y,I.position.z,1);s.multiplyVector4(U);U.z/=U.w;if(U.z>0&&U.z<1){y=S[C]=S[C]||new THREE.RenderableParticle;y.x=U.x/U.w;y.y=U.y/U.w;y.z=U.z;y.rotation=I.rotation.z;y.scale.x=I.scale.x*Math.abs(y.x-(U.x+t.projectionMatrix.n11)/(U.w+t.projectionMatrix.n14));
|
|
|
+y.scale.y=I.scale.y*Math.abs(y.y-(U.y+t.projectionMatrix.n22)/(U.w+t.projectionMatrix.n24));y.materials=I.materials;q.push(y);C++}}}}r&&q.sort(a);return q};this.unprojectVector=function(m,t){var r=new THREE.Matrix4;r.multiply(THREE.Matrix4.makeInvert(t.matrix),THREE.Matrix4.makeInvert(t.projectionMatrix));r.multiplyVector3(m);return m}};
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,e,f,g,i;this.domElement=document.createElement("div");this.setSize=function(p,c){e=p;f=c;g=e/2;i=f/2};this.render=function(p,c){var k,l,D,F,y,C,S,W;a=b.projectScene(p,c);k=0;for(l=a.length;k<l;k++){y=a[k];if(y instanceof THREE.RenderableParticle){S=y.x*g+g;W=y.y*i+i;D=0;for(F=y.material.length;D<F;D++){C=y.material[D];if(C instanceof THREE.ParticleDOMMaterial){C=C.domElement;C.style.left=S+"px";C.style.top=W+"px"}}}}}};
|
|
|
+THREE.CanvasRenderer=function(){function a(da){if(y!=da)l.globalAlpha=y=da}function b(da){if(C!=da){switch(da){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}C=da}}var e=null,f=new THREE.Projector,g=document.createElement("canvas"),i,p,c,k,l=g.getContext("2d"),D=null,F=null,y=1,C=0,S=null,W=null,U=1,s,R,d,h,o,n,m,t,r,q=new THREE.Color,
|
|
|
+z=new THREE.Color,u=new THREE.Color,j=new THREE.Color,w=new THREE.Color,T,A,K,N,I,V,Q,E,H,O=new THREE.Rectangle,J=new THREE.Rectangle,v=new THREE.Rectangle,G=false,L=new THREE.Color,ea=new THREE.Color,ba=new THREE.Color,Z=new THREE.Color,ia=Math.PI*2,Y=new THREE.Vector3,pa,ja,Da,ha,ua,ya,sa=16;pa=document.createElement("canvas");pa.width=pa.height=2;ja=pa.getContext("2d");ja.fillStyle="rgba(0,0,0,1)";ja.fillRect(0,0,2,2);Da=ja.getImageData(0,0,2,2);ha=Da.data;ua=document.createElement("canvas");ua.width=
|
|
|
+ua.height=sa;ya=ua.getContext("2d");ya.translate(-sa/2,-sa/2);ya.scale(sa,sa);sa--;this.domElement=g;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(da,qa){i=da;p=qa;c=i/2;k=p/2;g.width=i;g.height=p;O.set(-c,-k,c,k)};this.setClearColor=function(da,qa){D=da!==null?new THREE.Color(da):null;F=qa;J.set(-c,-k,c,k);l.setTransform(1,0,0,-1,c,k);this.clear()};this.clear=function(){if(!J.isEmpty()){J.inflate(1);J.minSelf(O);if(D!==null){b(THREE.NormalBlending);a(1);l.fillStyle=
|
|
|
+"rgba("+Math.floor(D.r*255)+","+Math.floor(D.g*255)+","+Math.floor(D.b*255)+","+F+")";l.fillRect(J.getX(),J.getY(),J.getWidth(),J.getHeight())}else l.clearRect(J.getX(),J.getY(),J.getWidth(),J.getHeight());J.empty()}};this.render=function(da,qa){function Ma(x){var X,P,B,M=x.lights;ea.setRGB(0,0,0);ba.setRGB(0,0,0);Z.setRGB(0,0,0);x=0;for(X=M.length;x<X;x++){P=M[x];B=P.color;if(P instanceof THREE.AmbientLight){ea.r+=B.r;ea.g+=B.g;ea.b+=B.b}else if(P instanceof THREE.DirectionalLight){ba.r+=B.r;ba.g+=
|
|
|
+B.g;ba.b+=B.b}else if(P instanceof THREE.PointLight){Z.r+=B.r;Z.g+=B.g;Z.b+=B.b}}}function za(x,X,P,B){var M,$,ca,fa,ga=x.lights;x=0;for(M=ga.length;x<M;x++){$=ga[x];ca=$.color;fa=$.intensity;if($ instanceof THREE.DirectionalLight){$=P.dot($.position)*fa;if($>0){B.r+=ca.r*$;B.g+=ca.g*$;B.b+=ca.b*$}}else if($ instanceof THREE.PointLight){Y.sub($.position,X);Y.normalize();$=P.dot(Y)*fa;if($>0){B.r+=ca.r*$;B.g+=ca.g*$;B.b+=ca.b*$}}}}function Na(x,X,P){if(P.opacity!=0){a(P.opacity);b(P.blending);var B,
|
|
|
+M,$,ca,fa,ga;if(P instanceof THREE.ParticleBasicMaterial){if(P.map){ca=P.map;fa=ca.width>>1;ga=ca.height>>1;M=X.scale.x*c;$=X.scale.y*k;P=M*fa;B=$*ga;v.set(x.x-P,x.y-B,x.x+P,x.y+B);if(!O.instersects(v))return;l.save();l.translate(x.x,x.y);l.rotate(-X.rotation);l.scale(M,-$);l.translate(-fa,-ga);l.drawImage(ca,0,0);l.restore()}l.beginPath();l.moveTo(x.x-10,x.y);l.lineTo(x.x+10,x.y);l.moveTo(x.x,x.y-10);l.lineTo(x.x,x.y+10);l.closePath();l.strokeStyle="rgb(255,255,0)";l.stroke()}else if(P instanceof
|
|
|
+THREE.ParticleCircleMaterial){if(G){L.r=ea.r+ba.r+Z.r;L.g=ea.g+ba.g+Z.g;L.b=ea.b+ba.b+Z.b;q.r=P.color.r*L.r;q.g=P.color.g*L.g;q.b=P.color.b*L.b;q.updateStyleString()}else q.__styleString=P.color.__styleString;P=X.scale.x*c;B=X.scale.y*k;v.set(x.x-P,x.y-B,x.x+P,x.y+B);if(O.instersects(v)){M=q.__styleString;if(W!=M)l.fillStyle=W=M;l.save();l.translate(x.x,x.y);l.rotate(-X.rotation);l.scale(P,B);l.beginPath();l.arc(0,0,1,0,ia,true);l.closePath();l.fill();l.restore()}}}}function Oa(x,X,P,B){if(B.opacity!=
|
|
|
+0){a(B.opacity);b(B.blending);l.beginPath();l.moveTo(x.positionScreen.x,x.positionScreen.y);l.lineTo(X.positionScreen.x,X.positionScreen.y);l.closePath();if(B instanceof THREE.LineBasicMaterial){q.__styleString=B.color.__styleString;x=B.linewidth;if(U!=x)l.lineWidth=U=x;x=q.__styleString;if(S!=x)l.strokeStyle=S=x;l.stroke();v.inflate(B.linewidth*2)}}}function Ia(x,X,P,B,M,$){if(M.opacity!=0){a(M.opacity);b(M.blending);h=x.positionScreen.x;o=x.positionScreen.y;n=X.positionScreen.x;m=X.positionScreen.y;
|
|
|
+t=P.positionScreen.x;r=P.positionScreen.y;l.beginPath();l.moveTo(h,o);l.lineTo(n,m);l.lineTo(t,r);l.lineTo(h,o);l.closePath();if(M instanceof THREE.MeshBasicMaterial)if(M.map)M.map.image.loaded&&M.map.mapping instanceof THREE.UVMapping&&va(h,o,n,m,t,r,M.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);else if(M.env_map){if(M.env_map.image.loaded)if(M.env_map.mapping instanceof THREE.SphericalReflectionMapping){x=qa.matrix;Y.copy(B.vertexNormalsWorld[0]);N=(Y.x*x.n11+Y.y*
|
|
|
+x.n12+Y.z*x.n13)*0.5+0.5;I=-(Y.x*x.n21+Y.y*x.n22+Y.z*x.n23)*0.5+0.5;Y.copy(B.vertexNormalsWorld[1]);V=(Y.x*x.n11+Y.y*x.n12+Y.z*x.n13)*0.5+0.5;Q=-(Y.x*x.n21+Y.y*x.n22+Y.z*x.n23)*0.5+0.5;Y.copy(B.vertexNormalsWorld[2]);E=(Y.x*x.n11+Y.y*x.n12+Y.z*x.n13)*0.5+0.5;H=-(Y.x*x.n21+Y.y*x.n22+Y.z*x.n23)*0.5+0.5;va(h,o,n,m,t,r,M.env_map.image,N,I,V,Q,E,H)}}else M.wireframe?Aa(M.color.__styleString,M.wireframe_linewidth):Ba(M.color.__styleString);else if(M instanceof THREE.MeshLambertMaterial){if(M.map&&!M.wireframe){M.map.mapping instanceof
|
|
|
+THREE.UVMapping&&va(h,o,n,m,t,r,M.map.image,B.uvs[0].u,B.uvs[0].v,B.uvs[1].u,B.uvs[1].v,B.uvs[2].u,B.uvs[2].v);b(THREE.SubtractiveBlending)}if(G)if(!M.wireframe&&M.shading==THREE.SmoothShading&&B.vertexNormalsWorld.length==3){z.r=u.r=j.r=ea.r;z.g=u.g=j.g=ea.g;z.b=u.b=j.b=ea.b;za($,B.v1.positionWorld,B.vertexNormalsWorld[0],z);za($,B.v2.positionWorld,B.vertexNormalsWorld[1],u);za($,B.v3.positionWorld,B.vertexNormalsWorld[2],j);w.r=(u.r+j.r)*0.5;w.g=(u.g+j.g)*0.5;w.b=(u.b+j.b)*0.5;K=Ja(z,u,j,w);va(h,
|
|
|
+o,n,m,t,r,K,0,0,1,0,0,1)}else{L.r=ea.r;L.g=ea.g;L.b=ea.b;za($,B.centroidWorld,B.normalWorld,L);q.r=M.color.r*L.r;q.g=M.color.g*L.g;q.b=M.color.b*L.b;q.updateStyleString();M.wireframe?Aa(q.__styleString,M.wireframe_linewidth):Ba(q.__styleString)}else M.wireframe?Aa(M.color.__styleString,M.wireframe_linewidth):Ba(M.color.__styleString)}else if(M instanceof THREE.MeshDepthMaterial){T=qa.near;A=qa.far;z.r=z.g=z.b=1-Ea(x.positionScreen.z,T,A);u.r=u.g=u.b=1-Ea(X.positionScreen.z,T,A);j.r=j.g=j.b=1-Ea(P.positionScreen.z,
|
|
|
+T,A);w.r=(u.r+j.r)*0.5;w.g=(u.g+j.g)*0.5;w.b=(u.b+j.b)*0.5;K=Ja(z,u,j,w);va(h,o,n,m,t,r,K,0,0,1,0,0,1)}else if(M instanceof THREE.MeshNormalMaterial){q.r=Fa(B.normalWorld.x);q.g=Fa(B.normalWorld.y);q.b=Fa(B.normalWorld.z);q.updateStyleString();M.wireframe?Aa(q.__styleString,M.wireframe_linewidth):Ba(q.__styleString)}}}function Aa(x,X){if(S!=x)l.strokeStyle=S=x;if(U!=X)l.lineWidth=U=X;l.stroke();v.inflate(X*2)}function Ba(x){if(W!=x)l.fillStyle=W=x;l.fill()}function va(x,X,P,B,M,$,ca,fa,ga,ma,ka,na,
|
|
|
+wa){var ra,oa;ra=ca.width-1;oa=ca.height-1;fa*=ra;ga*=oa;ma*=ra;ka*=oa;na*=ra;wa*=oa;P-=x;B-=X;M-=x;$-=X;ma-=fa;ka-=ga;na-=fa;wa-=ga;oa=1/(ma*wa-na*ka);ra=(wa*P-ka*M)*oa;ka=(wa*B-ka*$)*oa;P=(ma*M-na*P)*oa;B=(ma*$-na*B)*oa;x=x-ra*fa-P*ga;X=X-ka*fa-B*ga;l.save();l.transform(ra,ka,P,B,x,X);l.clip();l.drawImage(ca,0,0);l.restore()}function Ja(x,X,P,B){var M=~~(x.r*255),$=~~(x.g*255);x=~~(x.b*255);var ca=~~(X.r*255),fa=~~(X.g*255);X=~~(X.b*255);var ga=~~(P.r*255),ma=~~(P.g*255);P=~~(P.b*255);var ka=~~(B.r*
|
|
|
+255),na=~~(B.g*255);B=~~(B.b*255);ha[0]=M<0?0:M>255?255:M;ha[1]=$<0?0:$>255?255:$;ha[2]=x<0?0:x>255?255:x;ha[4]=ca<0?0:ca>255?255:ca;ha[5]=fa<0?0:fa>255?255:fa;ha[6]=X<0?0:X>255?255:X;ha[8]=ga<0?0:ga>255?255:ga;ha[9]=ma<0?0:ma>255?255:ma;ha[10]=P<0?0:P>255?255:P;ha[12]=ka<0?0:ka>255?255:ka;ha[13]=na<0?0:na>255?255:na;ha[14]=B<0?0:B>255?255:B;ja.putImageData(Da,0,0);ya.drawImage(pa,0,0);return ua}function Ea(x,X,P){x=(x-X)/(P-X);return x*x*(3-2*x)}function Fa(x){x=(x+1)*0.5;return x<0?0:x>1?1:x}function Ga(x,
|
|
|
+X){var P=X.x-x.x,B=X.y-x.y,M=1/Math.sqrt(P*P+B*B);P*=M;B*=M;X.x+=P;X.y+=B;x.x-=P;x.y-=B}var Ca,Ka,aa,la,ta,Ha,La,xa;l.setTransform(1,0,0,-1,c,k);this.autoClear&&this.clear();e=f.projectScene(da,qa,this.sortElements);l.fillStyle="rgba( 0, 255, 255, 0.5 )";l.fillRect(O.getX(),O.getY(),O.getWidth(),O.getHeight());(G=da.lights.length>0)&&Ma(da);Ca=0;for(Ka=e.length;Ca<Ka;Ca++){aa=e[Ca];v.empty();if(aa instanceof THREE.RenderableParticle){s=aa;s.x*=c;s.y*=k;la=0;for(ta=aa.materials.length;la<ta;la++)Na(s,
|
|
|
+aa,aa.materials[la],da)}else if(aa instanceof THREE.RenderableLine){s=aa.v1;R=aa.v2;s.positionScreen.x*=c;s.positionScreen.y*=k;R.positionScreen.x*=c;R.positionScreen.y*=k;v.addPoint(s.positionScreen.x,s.positionScreen.y);v.addPoint(R.positionScreen.x,R.positionScreen.y);if(O.instersects(v)){la=0;for(ta=aa.materials.length;la<ta;)Oa(s,R,aa,aa.materials[la++],da)}}else if(aa instanceof THREE.RenderableFace3){s=aa.v1;R=aa.v2;d=aa.v3;s.positionScreen.x*=c;s.positionScreen.y*=k;R.positionScreen.x*=c;
|
|
|
+R.positionScreen.y*=k;d.positionScreen.x*=c;d.positionScreen.y*=k;if(aa.overdraw){Ga(s.positionScreen,R.positionScreen);Ga(R.positionScreen,d.positionScreen);Ga(d.positionScreen,s.positionScreen)}v.add3Points(s.positionScreen.x,s.positionScreen.y,R.positionScreen.x,R.positionScreen.y,d.positionScreen.x,d.positionScreen.y);if(O.instersects(v)){la=0;for(ta=aa.meshMaterials.length;la<ta;){xa=aa.meshMaterials[la++];if(xa instanceof THREE.MeshFaceMaterial){Ha=0;for(La=aa.faceMaterials.length;Ha<La;)(xa=
|
|
|
+aa.faceMaterials[Ha++])&&Ia(s,R,d,aa,xa,da)}else Ia(s,R,d,aa,xa,da)}}}J.addRectangle(v)}l.lineWidth=1;l.strokeStyle="rgba( 255, 0, 0, 0.5 )";l.strokeRect(J.getX(),J.getY(),J.getWidth(),J.getHeight());l.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function a(N,I,V){var Q,E,H,O;Q=0;for(E=N.lights.length;Q<E;Q++){H=N.lights[Q];if(H instanceof THREE.DirectionalLight){O=I.normalWorld.dot(H.position)*H.intensity;if(O>0){V.r+=H.color.r*O;V.g+=H.color.g*O;V.b+=H.color.b*O}}else if(H instanceof THREE.PointLight){r.sub(H.position,I.centroidWorld);r.normalize();O=I.normalWorld.dot(r)*H.intensity;if(O>0){V.r+=H.color.r*O;V.g+=H.color.g*O;V.b+=H.color.b*O}}}}function b(N,I,V,Q,E,H){j=f(w++);j.setAttribute("d","M "+N.positionScreen.x+
|
|
|
+" "+N.positionScreen.y+" L "+I.positionScreen.x+" "+I.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+"z");if(E instanceof THREE.MeshBasicMaterial)d.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshLambertMaterial)if(R){h.r=o.r;h.g=o.g;h.b=o.b;a(H,Q,h);d.r=E.color.r*h.r;d.g=E.color.g*h.g;d.b=E.color.b*h.b;d.updateStyleString()}else d.__styleString=E.color.__styleString;else if(E instanceof THREE.MeshDepthMaterial){t=1-E.__2near/(E.__farPlusNear-Q.z*E.__farMinusNear);
|
|
|
+d.setRGB(t,t,t)}else E instanceof THREE.MeshNormalMaterial&&d.setRGB(g(Q.normalWorld.x),g(Q.normalWorld.y),g(Q.normalWorld.z));E.wireframe?j.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+E.wireframe_linewidth+"; stroke-opacity: "+E.opacity+"; stroke-linecap: "+E.wireframe_linecap+"; stroke-linejoin: "+E.wireframe_linejoin):j.setAttribute("style","fill: "+d.__styleString+"; fill-opacity: "+E.opacity);c.appendChild(j)}function e(N,I,V,Q,E,H,O){j=f(w++);j.setAttribute("d",
|
|
|
+"M "+N.positionScreen.x+" "+N.positionScreen.y+" L "+I.positionScreen.x+" "+I.positionScreen.y+" L "+V.positionScreen.x+","+V.positionScreen.y+" L "+Q.positionScreen.x+","+Q.positionScreen.y+"z");if(H instanceof THREE.MeshBasicMaterial)d.__styleString=H.color.__styleString;else if(H instanceof THREE.MeshLambertMaterial)if(R){h.r=o.r;h.g=o.g;h.b=o.b;a(O,E,h);d.r=H.color.r*h.r;d.g=H.color.g*h.g;d.b=H.color.b*h.b;d.updateStyleString()}else d.__styleString=H.color.__styleString;else if(H instanceof THREE.MeshDepthMaterial){t=
|
|
|
+1-H.__2near/(H.__farPlusNear-E.z*H.__farMinusNear);d.setRGB(t,t,t)}else H instanceof THREE.MeshNormalMaterial&&d.setRGB(g(E.normalWorld.x),g(E.normalWorld.y),g(E.normalWorld.z));H.wireframe?j.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+H.wireframe_linewidth+"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.wireframe_linecap+"; stroke-linejoin: "+H.wireframe_linejoin):j.setAttribute("style","fill: "+d.__styleString+"; fill-opacity: "+H.opacity);c.appendChild(j)}
|
|
|
+function f(N){if(q[N]==null){q[N]=document.createElementNS("http://www.w3.org/2000/svg","path");K==0&&q[N].setAttribute("shape-rendering","crispEdges");return q[N]}return q[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 i=null,p=new THREE.Projector,c=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,D,F,y,C,S,W,U=new THREE.Rectangle,s=new THREE.Rectangle,R=false,d=new THREE.Color(16777215),h=new THREE.Color(16777215),o=new THREE.Color(0),n=new THREE.Color(0),
|
|
|
+m=new THREE.Color(0),t,r=new THREE.Vector3,q=[],z=[],u=[],j,w,T,A,K=1;this.domElement=c;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(N){switch(N){case "high":K=1;break;case "low":K=0}};this.setSize=function(N,I){k=N;l=I;D=k/2;F=l/2;c.setAttribute("viewBox",-D+" "+-F+" "+k+" "+l);c.setAttribute("width",k);c.setAttribute("height",l);U.set(-D,-F,D,F)};this.clear=function(){for(;c.childNodes.length>0;)c.removeChild(c.childNodes[0])};this.render=function(N,I){var V,Q,
|
|
|
+E,H,O,J,v,G;this.autoClear&&this.clear();i=p.projectScene(N,I,this.sortElements);A=T=w=0;if(R=N.lights.length>0){v=N.lights;o.setRGB(0,0,0);n.setRGB(0,0,0);m.setRGB(0,0,0);V=0;for(Q=v.length;V<Q;V++){E=v[V];H=E.color;if(E instanceof THREE.AmbientLight){o.r+=H.r;o.g+=H.g;o.b+=H.b}else if(E instanceof THREE.DirectionalLight){n.r+=H.r;n.g+=H.g;n.b+=H.b}else if(E instanceof THREE.PointLight){m.r+=H.r;m.g+=H.g;m.b+=H.b}}}V=0;for(Q=i.length;V<Q;V++){v=i[V];s.empty();if(v instanceof THREE.RenderableParticle){y=
|
|
|
+v;y.x*=D;y.y*=-F;E=0;for(H=v.materials.length;E<H;E++)if(G=v.materials[E]){O=y;J=v;G=G;var L=T++;if(z[L]==null){z[L]=document.createElementNS("http://www.w3.org/2000/svg","circle");K==0&&z[L].setAttribute("shape-rendering","crispEdges")}j=z[L];j.setAttribute("cx",O.x);j.setAttribute("cy",O.y);j.setAttribute("r",J.scale.x*D);if(G instanceof THREE.ParticleCircleMaterial){if(R){h.r=o.r+n.r+m.r;h.g=o.g+n.g+m.g;h.b=o.b+n.b+m.b;d.r=G.color.r*h.r;d.g=G.color.g*h.g;d.b=G.color.b*h.b;d.updateStyleString()}else d=
|
|
|
+G.color;j.setAttribute("style","fill: "+d.__styleString)}c.appendChild(j)}}else if(v instanceof THREE.RenderableLine){y=v.v1;C=v.v2;y.positionScreen.x*=D;y.positionScreen.y*=-F;C.positionScreen.x*=D;C.positionScreen.y*=-F;s.addPoint(y.positionScreen.x,y.positionScreen.y);s.addPoint(C.positionScreen.x,C.positionScreen.y);if(U.instersects(s)){E=0;for(H=v.materials.length;E<H;)if(G=v.materials[E++]){O=y;J=C;G=G;L=A++;if(u[L]==null){u[L]=document.createElementNS("http://www.w3.org/2000/svg","line");K==
|
|
|
+0&&u[L].setAttribute("shape-rendering","crispEdges")}j=u[L];j.setAttribute("x1",O.positionScreen.x);j.setAttribute("y1",O.positionScreen.y);j.setAttribute("x2",J.positionScreen.x);j.setAttribute("y2",J.positionScreen.y);if(G instanceof THREE.LineBasicMaterial){d.__styleString=G.color.__styleString;j.setAttribute("style","fill: none; stroke: "+d.__styleString+"; stroke-width: "+G.linewidth+"; stroke-opacity: "+G.opacity+"; stroke-linecap: "+G.linecap+"; stroke-linejoin: "+G.linejoin);c.appendChild(j)}}}}else if(v instanceof
|
|
|
+THREE.RenderableFace3){y=v.v1;C=v.v2;S=v.v3;y.positionScreen.x*=D;y.positionScreen.y*=-F;C.positionScreen.x*=D;C.positionScreen.y*=-F;S.positionScreen.x*=D;S.positionScreen.y*=-F;s.addPoint(y.positionScreen.x,y.positionScreen.y);s.addPoint(C.positionScreen.x,C.positionScreen.y);s.addPoint(S.positionScreen.x,S.positionScreen.y);if(U.instersects(s)){E=0;for(H=v.meshMaterials.length;E<H;){G=v.meshMaterials[E++];if(G instanceof THREE.MeshFaceMaterial){O=0;for(J=v.faceMaterials.length;O<J;)(G=v.faceMaterials[O++])&&
|
|
|
+b(y,C,S,v,G,N)}else G&&b(y,C,S,v,G,N)}}}else if(v instanceof THREE.RenderableFace4){y=v.v1;C=v.v2;S=v.v3;W=v.v4;y.positionScreen.x*=D;y.positionScreen.y*=-F;C.positionScreen.x*=D;C.positionScreen.y*=-F;S.positionScreen.x*=D;S.positionScreen.y*=-F;W.positionScreen.x*=D;W.positionScreen.y*=-F;s.addPoint(y.positionScreen.x,y.positionScreen.y);s.addPoint(C.positionScreen.x,C.positionScreen.y);s.addPoint(S.positionScreen.x,S.positionScreen.y);s.addPoint(W.positionScreen.x,W.positionScreen.y);if(U.instersects(s)){E=
|
|
|
+0;for(H=v.meshMaterials.length;E<H;){G=v.meshMaterials[E++];if(G instanceof THREE.MeshFaceMaterial){O=0;for(J=v.faceMaterials.length;O<J;)(G=v.faceMaterials[O++])&&e(y,C,S,W,v,G,N)}else G&&e(y,C,S,W,v,G,N)}}}}}};
|
|
|
+THREE.WebGLRenderer=function(a){function b(d,h){d.fragment_shader=h.fragment_shader;d.vertex_shader=h.vertex_shader;d.uniforms=Uniforms.clone(h.uniforms)}function e(d,h){d.uniforms.color.value.setRGB(d.color.r*d.opacity,d.color.g*d.opacity,d.color.b*d.opacity);d.uniforms.opacity.value=d.opacity;d.uniforms.map.texture=d.map;d.uniforms.env_map.texture=d.env_map;d.uniforms.reflectivity.value=d.reflectivity;d.uniforms.refraction_ratio.value=d.refraction_ratio;d.uniforms.combine.value=d.combine;d.uniforms.useRefract.value=
|
|
|
+d.env_map&&d.env_map.mapping instanceof THREE.CubeRefractionMapping;if(h){d.uniforms.fogColor.value.setHex(h.color.hex);if(h instanceof THREE.Fog){d.uniforms.fogNear.value=h.near;d.uniforms.fogFar.value=h.far}else if(h instanceof THREE.FogExp2)d.uniforms.fogDensity.value=h.density}}function f(d,h){d.uniforms.color.value.setRGB(d.color.r*d.opacity,d.color.g*d.opacity,d.color.b*d.opacity);d.uniforms.opacity.value=d.opacity;if(h){d.uniforms.fogColor.value.setHex(h.color.hex);if(h instanceof THREE.Fog){d.uniforms.fogNear.value=
|
|
|
+h.near;d.uniforms.fogFar.value=h.far}else if(h instanceof THREE.FogExp2)d.uniforms.fogDensity.value=h.density}}function g(d,h){var o;if(d=="fragment")o=c.createShader(c.FRAGMENT_SHADER);else if(d=="vertex")o=c.createShader(c.VERTEX_SHADER);c.shaderSource(o,h);c.compileShader(o);if(!c.getShaderParameter(o,c.COMPILE_STATUS)){alert(c.getShaderInfoLog(o));return null}return o}function i(d){switch(d){case THREE.RepeatWrapping:return c.REPEAT;case THREE.ClampToEdgeWrapping:return c.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return c.MIRRORED_REPEAT;
|
|
|
+case THREE.NearestFilter:return c.NEAREST;case THREE.NearestMipMapNearestFilter:return c.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return c.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return c.LINEAR;case THREE.LinearMipMapNearestFilter:return c.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return c.LINEAR_MIPMAP_LINEAR}return 0}var p=document.createElement("canvas"),c,k=null,l=new THREE.Matrix4,D,F=new Float32Array(16),y=new Float32Array(16),C=new Float32Array(16),
|
|
|
+S=new Float32Array(9),W=new Float32Array(16),U=true,s=new THREE.Color(0),R=0;if(a){if(a.antialias!==undefined)U=a.antialias;a.clearColor!==undefined&&s.setHex(a.clearColor);if(a.clearAlpha!==undefined)R=a.clearAlpha}this.domElement=p;this.autoClear=true;(function(d,h,o){try{c=p.getContext("experimental-webgl",{antialias:d})}catch(n){}if(!c){alert("WebGL not supported");throw"cannot create webgl context";}c.clearColor(0,0,0,1);c.clearDepth(1);c.enable(c.DEPTH_TEST);c.depthFunc(c.LEQUAL);c.frontFace(c.CCW);
|
|
|
+c.cullFace(c.BACK);c.enable(c.CULL_FACE);c.enable(c.BLEND);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA);c.clearColor(h.r,h.g,h.b,o)})(U,s,R);this.setSize=function(d,h){p.width=d;p.height=h;c.viewport(0,0,p.width,p.height)};this.setClearColor=function(d,h){var o=new THREE.Color(d);c.clearColor(o.r,o.g,o.b,h)};this.clear=function(){c.clear(c.COLOR_BUFFER_BIT|c.DEPTH_BUFFER_BIT)};this.setupLights=function(d,h){var o,n,m,t=0,r=0,q=0,z,u,j,w=[],T=[],A=[],K=[];o=0;for(n=h.length;o<n;o++){m=h[o];z=m.color;u=
|
|
|
+m.position;j=m.intensity;if(m instanceof THREE.AmbientLight){t+=z.r;r+=z.g;q+=z.b}else if(m instanceof THREE.DirectionalLight){w.push(z.r*j,z.g*j,z.b*j);T.push(u.x,u.y,u.z)}else if(m instanceof THREE.PointLight){A.push(z.r*j,z.g*j,z.b*j);K.push(u.x,u.y,u.z)}}return{ambient:[t,r,q],directional:{colors:w,positions:T},point:{colors:A,positions:K}}};this.createParticleBuffers=function(){};this.createLineBuffers=function(d){var h,o,n,m=[],t=[],r=d.geometry.vertices;h=0;for(o=r.length;h<o;h++){n=r[h].position;
|
|
|
+m.push(n.x,n.y,n.z);t.push(h)}if(m.length){d.__webGLVertexBuffer=c.createBuffer();c.bindBuffer(c.ARRAY_BUFFER,d.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,new Float32Array(m),c.STATIC_DRAW);d.__webGLLineBuffer=c.createBuffer();c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,d.__webGLLineBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,new Uint16Array(t),c.STATIC_DRAW);d.__webGLLineCount=t.length}};this.createBuffers=function(d){d.__webGLVertexBuffer=c.createBuffer();d.__webGLNormalBuffer=c.createBuffer();d.__webGLTangentBuffer=
|
|
|
+c.createBuffer();d.__webGLUVBuffer=c.createBuffer();d.__webGLFaceBuffer=c.createBuffer();d.__webGLLineBuffer=c.createBuffer()};this.initBuffers=function(d,h){var o,n,m=0,t=0,r=0,q=h.geometry.faces,z=d.faces;o=0;for(n=z.length;o<n;o++){fi=z[o];face=q[fi];if(face instanceof THREE.Face3){m+=3;t+=1;r+=3}else if(face instanceof THREE.Face4){m+=4;t+=2;r+=5}}d.__vertexArray=new Float32Array(m*3);d.__normalArray=new Float32Array(m*3);d.__tangentArray=new Float32Array(m*4);d.__uvArray=new Float32Array(m*2);
|
|
|
+d.__faceArray=new Uint16Array(t*3);d.__lineArray=new Uint16Array(r*2);m=false;o=0;for(n=h.materials.length;o<n;o++){q=h.materials[o];if(q instanceof THREE.MeshFaceMaterial){q=0;for(z=d.materials.length;q<z;q++)if(d.materials[q]&&d.materials[q].shading!=undefined&&d.materials[q].shading==THREE.SmoothShading){m=true;break}}else if(q&&q.shading!=undefined&&q.shading==THREE.SmoothShading){m=true;break}if(m)break}d.__needsSmoothNormals=m;d.__webGLFaceCount=t*3;d.__webGLLineCount=r*2};this.setBuffers=function(d,
|
|
|
+h,o,n,m,t,r,q){var z,u,j,w,T,A,K,N,I,V,Q=0,E=0,H=0,O=0,J=0,v=0,G=0,L=d.__vertexArray,ea=d.__uvArray,ba=d.__normalArray,Z=d.__tangentArray,ia=d.__faceArray,Y=d.__lineArray,pa=d.__needsSmoothNormals,ja=h.geometry;h=0;for(z=d.faces.length;h<z;h++){u=d.faces[h];j=ja.faces[u];w=j.vertexNormals;T=j.normal;u=ja.uvs[u];V=ja.vertices;if(j instanceof THREE.Face3){if(n){A=V[j.a].position;K=V[j.b].position;N=V[j.c].position;L[E]=A.x;L[E+1]=A.y;L[E+2]=A.z;L[E+3]=K.x;L[E+4]=K.y;L[E+5]=K.z;L[E+6]=N.x;L[E+7]=N.y;
|
|
|
+L[E+8]=N.z;E+=9}if(q&&ja.hasTangents){A=V[j.a].tangent;K=V[j.b].tangent;N=V[j.c].tangent;Z[v]=A.x;Z[v+1]=A.y;Z[v+2]=A.z;Z[v+3]=A.w;Z[v+4]=K.x;Z[v+5]=K.y;Z[v+6]=K.z;Z[v+7]=K.w;Z[v+8]=N.x;Z[v+9]=N.y;Z[v+10]=N.z;Z[v+11]=N.w;v+=12}if(r)if(w.length==3&&pa)for(j=0;j<3;j++){T=w[j];ba[J]=T.x;ba[J+1]=T.y;ba[J+2]=T.z;J+=3}else for(j=0;j<3;j++){ba[J]=T.x;ba[J+1]=T.y;ba[J+2]=T.z;J+=3}if(t&&u)for(j=0;j<3;j++){w=u[j];ea[H]=w.u;ea[H+1]=w.v;H+=2}if(m){ia[O]=Q;ia[O+1]=Q+1;ia[O+2]=Q+2;O+=3;Y[G]=Q;Y[G+1]=Q+1;Y[G+2]=
|
|
|
+Q;Y[G+3]=Q+2;Y[G+4]=Q+1;Y[G+5]=Q+2;G+=6;Q+=3}}else if(j instanceof THREE.Face4){if(n){A=V[j.a].position;K=V[j.b].position;N=V[j.c].position;I=V[j.d].position;L[E]=A.x;L[E+1]=A.y;L[E+2]=A.z;L[E+3]=K.x;L[E+4]=K.y;L[E+5]=K.z;L[E+6]=N.x;L[E+7]=N.y;L[E+8]=N.z;L[E+9]=I.x;L[E+10]=I.y;L[E+11]=I.z;E+=12}if(q&&ja.hasTangents){A=V[j.a].tangent;K=V[j.b].tangent;N=V[j.c].tangent;j=V[j.d].tangent;Z[v]=A.x;Z[v+1]=A.y;Z[v+2]=A.z;Z[v+3]=A.w;Z[v+4]=K.x;Z[v+5]=K.y;Z[v+6]=K.z;Z[v+7]=K.w;Z[v+8]=N.x;Z[v+9]=N.y;Z[v+10]=
|
|
|
+N.z;Z[v+11]=N.w;Z[v+12]=j.x;Z[v+13]=j.y;Z[v+14]=j.z;Z[v+15]=j.w;v+=16}if(r)if(w.length==4&&pa)for(j=0;j<4;j++){T=w[j];ba[J]=T.x;ba[J+1]=T.y;ba[J+2]=T.z;J+=3}else for(j=0;j<4;j++){ba[J]=T.x;ba[J+1]=T.y;ba[J+2]=T.z;J+=3}if(t&&u)for(j=0;j<4;j++){w=u[j];ea[H]=w.u;ea[H+1]=w.v;H+=2}if(m){ia[O]=Q;ia[O+1]=Q+1;ia[O+2]=Q+2;ia[O+3]=Q;ia[O+4]=Q+2;ia[O+5]=Q+3;O+=6;Y[G]=Q;Y[G+1]=Q+1;Y[G+2]=Q;Y[G+3]=Q+2;Y[G+4]=Q;Y[G+5]=Q+3;Y[G+6]=Q+1;Y[G+7]=Q+2;Y[G+8]=Q+2;Y[G+9]=Q+3;G+=10;Q+=4}}}if(n){c.bindBuffer(c.ARRAY_BUFFER,
|
|
|
+d.__webGLVertexBuffer);c.bufferData(c.ARRAY_BUFFER,L,o)}if(r){c.bindBuffer(c.ARRAY_BUFFER,d.__webGLNormalBuffer);c.bufferData(c.ARRAY_BUFFER,ba,o)}if(q&&ja.hasTangents){c.bindBuffer(c.ARRAY_BUFFER,d.__webGLTangentBuffer);c.bufferData(c.ARRAY_BUFFER,Z,o)}if(t&&H>0){c.bindBuffer(c.ARRAY_BUFFER,d.__webGLUVBuffer);c.bufferData(c.ARRAY_BUFFER,ea,o)}if(m){c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,d.__webGLFaceBuffer);c.bufferData(c.ELEMENT_ARRAY_BUFFER,ia,o);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,d.__webGLLineBuffer);
|
|
|
+c.bufferData(c.ELEMENT_ARRAY_BUFFER,Y,o)}};this.renderBuffer=function(d,h,o,n,m){var t,r,q,z;if(!n.program){if(n instanceof THREE.MeshDepthMaterial){b(n,THREE.ShaderLib.depth);n.uniforms.mNear.value=d.near;n.uniforms.mFar.value=d.far}else if(n instanceof THREE.MeshNormalMaterial)b(n,THREE.ShaderLib.normal);else if(n instanceof THREE.MeshBasicMaterial){b(n,THREE.ShaderLib.basic);e(n,o)}else if(n instanceof THREE.MeshLambertMaterial){b(n,THREE.ShaderLib.lambert);e(n,o)}else if(n instanceof THREE.MeshPhongMaterial){b(n,
|
|
|
+THREE.ShaderLib.phong);e(n,o)}else if(n instanceof THREE.LineBasicMaterial){b(n,THREE.ShaderLib.basic);f(n,o)}var u,j,w;u=z=r=0;for(j=h.length;u<j;u++){w=h[u];w instanceof THREE.DirectionalLight&&z++;w instanceof THREE.PointLight&&r++}if(r+z<=4){u=z;r=r}else{u=Math.ceil(4*z/(r+z));r=4-u}r={directional:u,point:r};z={fog:o,map:n.map,env_map:n.env_map,maxDirLights:r.directional,maxPointLights:r.point};r=n.fragment_shader;u=n.vertex_shader;j=c.createProgram();w=["#ifdef GL_ES\nprecision highp float;\n#endif",
|
|
|
+"#define MAX_DIR_LIGHTS "+z.maxDirLights,"#define MAX_POINT_LIGHTS "+z.maxPointLights,z.fog?"#define USE_FOG":"",z.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",z.map?"#define USE_MAP":"",z.env_map?"#define USE_ENVMAP":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");z=[c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+z.maxDirLights,"#define MAX_POINT_LIGHTS "+z.maxPointLights,z.map?"#define USE_MAP":"",z.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");c.attachShader(j,g("fragment",w+r));c.attachShader(j,g("vertex",z+u));c.linkProgram(j);c.getProgramParameter(j,c.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+c.getProgramParameter(j,c.VALIDATE_STATUS)+
|
|
|
+", gl error ["+c.getError()+"]");j.uniforms={};j.attributes={};n.program=j;r=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(t in n.uniforms)r.push(t);t=n.program;u=0;for(j=r.length;u<j;u++){w=r[u];t.uniforms[w]=c.getUniformLocation(t,w)}t=n.program;r=["position","normal","uv","tangent"];u=0;for(j=r.length;u<j;u++){w=r[u];t.attributes[w]=c.getAttribLocation(t,w)}}t=n.program;if(t!=k){c.useProgram(t);k=t}this.loadCamera(t,d);this.loadMatrices(t);
|
|
|
+if(n instanceof THREE.MeshPhongMaterial||n instanceof THREE.MeshLambertMaterial){d=this.setupLights(t,h);n.uniforms.enableLighting.value=d.directional.positions.length+d.point.positions.length;n.uniforms.ambientLightColor.value=d.ambient;n.uniforms.directionalLightColor.value=d.directional.colors;n.uniforms.directionalLightDirection.value=d.directional.positions;n.uniforms.pointLightColor.value=d.point.colors;n.uniforms.pointLightPosition.value=d.point.positions}if(n instanceof THREE.MeshBasicMaterial||
|
|
|
+n instanceof THREE.MeshLambertMaterial||n instanceof THREE.MeshPhongMaterial)e(n,o);n instanceof THREE.LineBasicMaterial&&f(n,o);if(n instanceof THREE.MeshPhongMaterial){n.uniforms.ambient.value.setRGB(n.ambient.r,n.ambient.g,n.ambient.b);n.uniforms.specular.value.setRGB(n.specular.r,n.specular.g,n.specular.b);n.uniforms.shininess.value=n.shininess}o=n.uniforms;for(q in o)if(u=t.uniforms[q]){h=o[q];r=h.type;d=h.value;if(r=="i")c.uniform1i(u,d);else if(r=="f")c.uniform1f(u,d);else if(r=="fv")c.uniform3fv(u,
|
|
|
+d);else if(r=="v2")c.uniform2f(u,d.x,d.y);else if(r=="v3")c.uniform3f(u,d.x,d.y,d.z);else if(r=="c")c.uniform3f(u,d.r,d.g,d.b);else if(r=="t"){c.uniform1i(u,d);if(h=h.texture)if(h.image instanceof Array&&h.image.length==6){h=h;d=d;if(h.image.length==6){if(!h.image.__webGLTextureCube&&!h.image.__cubeMapInitialized&&h.image.loadCount==6){h.image.__webGLTextureCube=c.createTexture();c.bindTexture(c.TEXTURE_CUBE_MAP,h.image.__webGLTextureCube);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE);
|
|
|
+c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MAG_FILTER,c.LINEAR);c.texParameteri(c.TEXTURE_CUBE_MAP,c.TEXTURE_MIN_FILTER,c.LINEAR_MIPMAP_LINEAR);for(r=0;r<6;++r)c.texImage2D(c.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,h.image[r]);c.generateMipmap(c.TEXTURE_CUBE_MAP);c.bindTexture(c.TEXTURE_CUBE_MAP,null);h.image.__cubeMapInitialized=true}c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_CUBE_MAP,h.image.__webGLTextureCube)}}else{h=
|
|
|
+h;d=d;if(!h.__webGLTexture&&h.image.loaded){h.__webGLTexture=c.createTexture();c.bindTexture(c.TEXTURE_2D,h.__webGLTexture);c.texImage2D(c.TEXTURE_2D,0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,h.image);c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,i(h.wrap_s));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,i(h.wrap_t));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,i(h.mag_filter));c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,i(h.min_filter));c.generateMipmap(c.TEXTURE_2D);c.bindTexture(c.TEXTURE_2D,
|
|
|
+null)}c.activeTexture(c.TEXTURE0+d);c.bindTexture(c.TEXTURE_2D,h.__webGLTexture)}}}q=t.attributes;c.bindBuffer(c.ARRAY_BUFFER,m.__webGLVertexBuffer);c.vertexAttribPointer(q.position,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(q.position);if(q.normal>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webGLNormalBuffer);c.vertexAttribPointer(q.normal,3,c.FLOAT,false,0,0);c.enableVertexAttribArray(q.normal)}if(q.tangent>=0){c.bindBuffer(c.ARRAY_BUFFER,m.__webGLTangentBuffer);c.vertexAttribPointer(q.tangent,4,c.FLOAT,
|
|
|
+false,0,0);c.enableVertexAttribArray(q.tangent)}if(q.uv>=0)if(m.__webGLUVBuffer){c.bindBuffer(c.ARRAY_BUFFER,m.__webGLUVBuffer);c.vertexAttribPointer(q.uv,2,c.FLOAT,false,0,0);c.enableVertexAttribArray(q.uv)}else c.disableVertexAttribArray(q.uv);if(n.wireframe||n instanceof THREE.LineBasicMaterial){q=n.wireframe_linewidth!==undefined?n.wireframe_linewidth:n.linewidth!==undefined?n.linewidth:1;n=n instanceof THREE.LineBasicMaterial&&m.type==THREE.LineStrip?c.LINE_STRIP:c.LINES;c.lineWidth(q);c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,
|
|
|
+m.__webGLLineBuffer);c.drawElements(n,m.__webGLLineCount,c.UNSIGNED_SHORT,0)}else{c.bindBuffer(c.ELEMENT_ARRAY_BUFFER,m.__webGLFaceBuffer);c.drawElements(c.TRIANGLES,m.__webGLFaceCount,c.UNSIGNED_SHORT,0)}};this.renderPass=function(d,h,o,n,m,t,r){var q,z,u,j,w;u=0;for(j=n.materials.length;u<j;u++){q=n.materials[u];if(q instanceof THREE.MeshFaceMaterial){q=0;for(z=m.materials.length;q<z;q++)if((w=m.materials[q])&&w.blending==t&&w.opacity<1==r){this.setBlending(w.blending);this.renderBuffer(d,h,o,w,
|
|
|
+m)}}else if((w=q)&&w.blending==t&&w.opacity<1==r){this.setBlending(w.blending);this.renderBuffer(d,h,o,w,m)}}};this.render=function(d,h){var o,n,m,t,r=d.lights,q=d.fog;this.initWebGLObjects(d);this.autoClear&&this.clear();h.autoUpdateMatrix&&h.updateMatrix();F.set(h.matrix.flatten());C.set(h.projectionMatrix.flatten());o=0;for(n=d.__webGLObjects.length;o<n;o++){m=d.__webGLObjects[o];t=m.object;m=m.buffer;if(t.visible){this.setupMatrices(t,h);this.renderPass(h,r,q,t,m,THREE.NormalBlending,false)}}o=
|
|
|
+0;for(n=d.__webGLObjects.length;o<n;o++){m=d.__webGLObjects[o];t=m.object;m=m.buffer;if(t.visible){this.setupMatrices(t,h);this.renderPass(h,r,q,t,m,THREE.AdditiveBlending,false);this.renderPass(h,r,q,t,m,THREE.SubtractiveBlending,false);this.renderPass(h,r,q,t,m,THREE.AdditiveBlending,true);this.renderPass(h,r,q,t,m,THREE.SubtractiveBlending,true);this.renderPass(h,r,q,t,m,THREE.NormalBlending,true)}}};this.initWebGLObjects=function(d){function h(u,j,w,T){if(u[j]==undefined){d.__webGLObjects.push({buffer:w,
|
|
|
+object:T});u[j]=1}}var o,n,m,t,r,q,z;if(!d.__webGLObjects){d.__webGLObjects=[];d.__webGLObjectsMap={}}o=0;for(n=d.objects.length;o<n;o++){m=d.objects[o];r=m.geometry;if(d.__webGLObjectsMap[m.id]==undefined)d.__webGLObjectsMap[m.id]={};z=d.__webGLObjectsMap[m.id];if(m instanceof THREE.Mesh){for(t in r.geometryChunks){q=r.geometryChunks[t];if(!q.__webGLVertexBuffer){this.createBuffers(q);this.initBuffers(q,m);r.__dirtyVertices=true;r.__dirtyElements=true;r.__dirtyUvs=true;r.__dirtyNormals=true;r.__dirtyTangents=
|
|
|
+true}if(r.__dirtyVertices||r.__dirtyElements||r.__dirtyUvs)this.setBuffers(q,m,c.DYNAMIC_DRAW,r.__dirtyVertices,r.__dirtyElements,r.__dirtyUvs,r.__dirtyNormals,r.__dirtyTangents);h(z,t,q,m)}r.__dirtyVertices=false;r.__dirtyElements=false;r.__dirtyUvs=false;r.__dirtyNormals=false;r.__dirtyTangents=false}else if(m instanceof THREE.Line){m.__webGLVertexBuffer||this.createLineBuffers(m);h(z,0,m,m)}else if(m instanceof THREE.ParticleSystem){m.__webGLVertexBuffer||this.createParticleBuffers(m);h(z,0,m,
|
|
|
+m)}}};this.removeObject=function(d,h){var o,n;for(o=d.__webGLObjects.length-1;o>=0;o--){n=d.__webGLObjects[o].object;h==n&&d.__webGLObjects.splice(o,1)}};this.setupMatrices=function(d,h){d.autoUpdateMatrix&&d.updateMatrix();l.multiply(h.matrix,d.matrix);y.set(l.flatten());D=THREE.Matrix4.makeInvert3x3(l).transpose();S.set(D.m);W.set(d.matrix.flatten())};this.loadMatrices=function(d){c.uniformMatrix4fv(d.uniforms.viewMatrix,false,F);c.uniformMatrix4fv(d.uniforms.modelViewMatrix,false,y);c.uniformMatrix4fv(d.uniforms.projectionMatrix,
|
|
|
+false,C);c.uniformMatrix3fv(d.uniforms.normalMatrix,false,S);c.uniformMatrix4fv(d.uniforms.objectMatrix,false,W)};this.loadCamera=function(d,h){c.uniform3f(d.uniforms.cameraPosition,h.position.x,h.position.y,h.position.z)};this.setBlending=function(d){switch(d){case THREE.AdditiveBlending:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE);break;case THREE.SubtractiveBlending:c.blendFunc(c.DST_COLOR,c.ZERO);break;default:c.blendEquation(c.FUNC_ADD);c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA)}};this.setFaceCulling=
|
|
|
+function(d,h){if(d){!h||h=="ccw"?c.frontFace(c.CCW):c.frontFace(c.CW);if(d=="back")c.cullFace(c.BACK);else d=="front"?c.cullFace(c.FRONT):c.cullFace(c.FRONT_AND_BACK);c.enable(c.CULL_FACE)}else c.disable(c.CULL_FACE)};this.supportsVertexTextures=function(){return c.getParameter(c.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
|
+THREE.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",
|