|
@@ -1,231 +1,280 @@
|
|
// ThreeDebug.js r32 - http://github.com/mrdoob/three.js
|
|
// ThreeDebug.js r32 - http://github.com/mrdoob/three.js
|
|
-var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=true;this.setHex(a)};
|
|
|
|
-THREE.Color.prototype={setRGB:function(a,c,e){this.r=a;this.g=c;this.b=e;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,c,e){var g,i,k,q,p,l;if(e==0)g=i=k=0;else{q=Math.floor(a*6);p=a*6-q;a=e*(1-c);l=e*(1-c*p);c=e*(1-c*(1-p));switch(q){case 1:g=l;i=e;k=a;break;case 2:g=a;i=e;k=c;break;case 3:g=a;i=l;k=e;break;case 4:g=c;i=a;k=e;break;case 5:g=e;i=a;k=l;break;case 6:case 0:g=e;i=c;k=a}}this.r=g;this.g=i;this.b=k;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},
|
|
|
|
|
|
+var THREE=THREE||{};THREE.Color=function(a){this.autoUpdate=!0;this.setHex(a)};
|
|
|
|
+THREE.Color.prototype={setRGB:function(a,b,c){this.r=a;this.g=b;this.b=c;if(this.autoUpdate){this.updateHex();this.updateStyleString()}},setHSV:function(a,b,c){var e,g,h,m,n,k;if(c==0)e=g=h=0;else{m=Math.floor(a*6);n=a*6-m;a=c*(1-b);k=c*(1-b*n);b=c*(1-b*(1-n));switch(m){case 1:e=k;g=c;h=a;break;case 2:e=a;g=c;h=b;break;case 3:e=a;g=k;h=c;break;case 4:e=b;g=a;h=c;break;case 5:e=c;g=a;h=k;break;case 6:case 0:e=c;g=b;h=a}}this.r=e;this.g=g;this.b=h;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: "+
|
|
setHex:function(a){this.hex=~~a&16777215;if(this.autoUpdate){this.updateRGBA();this.updateStyleString()}},updateHex:function(){this.hex=~~(this.r*255)<<16^~~(this.g*255)<<8^~~(this.b*255)},updateRGBA:function(){this.r=(this.hex>>16&255)/255;this.g=(this.hex>>8&255)/255;this.b=(this.hex&255)/255},updateStyleString:function(){this.__styleString="rgb("+~~(this.r*255)+","+~~(this.g*255)+","+~~(this.b*255)+")"},clone:function(){return new THREE.Color(this.hex)},toString:function(){return"THREE.Color ( r: "+
|
|
-this.r+", g: "+this.g+", b: "+this.b+", hex: "+this.hex+" )"}};THREE.Vector2=function(a,c){this.x=a||0;this.y=c||0};
|
|
|
|
-THREE.Vector2.prototype={set:function(a,c){this.x=a;this.y=c;return this},copy:function(a){this.x=a.x;this.y=a.y;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;return this},unit:function(){this.multiplyScalar(1/this.length());return this},length:function(){return Math.sqrt(this.x*
|
|
|
|
-this.x+this.y*this.y)},lengthSq:function(){return this.x*this.x+this.y*this.y},negate:function(){this.x=-this.x;this.y=-this.y;return this},clone:function(){return new THREE.Vector2(this.x,this.y)},toString:function(){return"THREE.Vector2 ("+this.x+", "+this.y+")"}};THREE.Vector3=function(a,c,e){this.x=a||0;this.y=c||0;this.z=e||0};
|
|
|
|
-THREE.Vector3.prototype={set:function(a,c,e){this.x=a;this.y=c;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,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;return this},addScalar:function(a){this.x+=a;this.y+=a;this.z+=a;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;return this},
|
|
|
|
-cross:function(a,c){this.x=a.y*c.z-a.z*c.y;this.y=a.z*c.x-a.x*c.z;this.z=a.x*c.y-a.y*c.x;return this},crossSelf:function(a){var c=this.x,e=this.y,g=this.z;this.x=e*a.z-g*a.y;this.y=g*a.x-c*a.z;this.z=c*a.y-e*a.x;return this},multiply:function(a,c){this.x=a.x*c.x;this.y=a.y*c.y;this.z=a.z*c.z;return this},multiplySelf:function(a){this.x*=a.x;this.y*=a.y;this.z*=a.z;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;return this},divideSelf:function(a){this.x/=a.x;this.y/=a.y;this.z/=
|
|
|
|
-a.z;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){var c=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return Math.sqrt(c*c+e*e+a*a)},distanceToSquared:function(a){var c=this.x-a.x,e=this.y-a.y;a=this.z-a.z;return c*c+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,c,e,g){this.x=a||0;this.y=c||0;this.z=e||0;this.w=g||1};
|
|
|
|
-THREE.Vector4.prototype={set:function(a,c,e,g){this.x=a;this.y=c;this.z=e;this.w=g;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
|
|
|
|
-return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,c){this.x+=(a.x-this.x)*c;this.y+=(a.y-this.y)*c;this.z+=(a.z-this.z)*c;this.w+=(a.w-this.w)*c},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
|
|
|
|
-THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
|
|
-THREE.Ray.prototype={intersectScene:function(a){var c,e,g=a.objects,i=[];a=0;for(c=g.length;a<c;a++){e=g[a];if(e instanceof THREE.Mesh)i=i.concat(this.intersectObject(e))}i.sort(function(k,q){return k.distance-q.distance});return i},intersectObject:function(a){function c(G,r,S,B){B=B.clone().subSelf(r);S=S.clone().subSelf(r);var I=G.clone().subSelf(r);G=B.dot(B);r=B.dot(S);B=B.dot(I);var b=S.dot(S);S=S.dot(I);I=1/(G*b-r*r);b=(b*B-r*S)*I;G=(G*S-r*B)*I;return b>0&&G>0&&b+G<1}var e,g,i,k,q,p,l,m,z,A,
|
|
|
|
-t,y=a.geometry,D=y.vertices,H=[];e=0;for(g=y.faces.length;e<g;e++){i=y.faces[e];A=this.origin.clone();t=this.direction.clone();k=a.matrix.multiplyVector3(D[i.a].position.clone());q=a.matrix.multiplyVector3(D[i.b].position.clone());p=a.matrix.multiplyVector3(D[i.c].position.clone());l=i instanceof THREE.Face4?a.matrix.multiplyVector3(D[i.d].position.clone()):null;m=a.rotationMatrix.multiplyVector3(i.normal.clone());z=t.dot(m);if(z<0){m=m.dot((new THREE.Vector3).sub(k,A))/z;A=A.addSelf(t.multiplyScalar(m));
|
|
|
|
-if(i instanceof THREE.Face3){if(c(A,k,q,p)){i={distance:this.origin.distanceTo(A),point:A,face:i,object:a};H.push(i)}}else if(i instanceof THREE.Face4)if(c(A,k,q,l)||c(A,q,p,l)){i={distance:this.origin.distanceTo(A),point:A,face:i,object:a};H.push(i)}}}return H}};
|
|
|
|
-THREE.Rectangle=function(){function a(){k=g-c;q=i-e}var c,e,g,i,k,q,p=true;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return q};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return g};this.getBottom=function(){return i};this.set=function(l,m,z,A){p=false;c=l;e=m;g=z;i=A;a()};this.addPoint=function(l,m){if(p){p=false;c=l;e=m;g=l;i=m}else{c=c<l?c:l;e=e<m?e:m;g=g>l?g:l;i=i>m?
|
|
|
|
-i:m}a()};this.add3Points=function(l,m,z,A,t,y){if(p){p=false;c=l<z?l<t?l:t:z<t?z:t;e=m<A?m<y?m:y:A<y?A:y;g=l>z?l>t?l:t:z>t?z:t;i=m>A?m>y?m:y:A>y?A:y}else{c=l<z?l<t?l<c?l:c:t<c?t:c:z<t?z<c?z:c:t<c?t:c;e=m<A?m<y?m<e?m:e:y<e?y:e:A<y?A<e?A:e:y<e?y:e;g=l>z?l>t?l>g?l:g:t>g?t:g:z>t?z>g?z:g:t>g?t:g;i=m>A?m>y?m>i?m:i:y>i?y:i:A>y?A>i?A:i:y>i?y:i}a()};this.addRectangle=function(l){if(p){p=false;c=l.getLeft();e=l.getTop();g=l.getRight();i=l.getBottom()}else{c=c<l.getLeft()?c:l.getLeft();e=e<l.getTop()?e:l.getTop();
|
|
|
|
-g=g>l.getRight()?g:l.getRight();i=i>l.getBottom()?i:l.getBottom()}a()};this.inflate=function(l){c-=l;e-=l;g+=l;i+=l;a()};this.minSelf=function(l){c=c>l.getLeft()?c:l.getLeft();e=e>l.getTop()?e:l.getTop();g=g<l.getRight()?g:l.getRight();i=i<l.getBottom()?i:l.getBottom();a()};this.instersects=function(l){return Math.min(g,l.getRight())-Math.max(c,l.getLeft())>=0&&Math.min(i,l.getBottom())-Math.max(e,l.getTop())>=0};this.empty=function(){p=true;i=g=e=c=0;a()};this.isEmpty=function(){return p};this.toString=
|
|
|
|
-function(){return"THREE.Rectangle ( left: "+c+", right: "+g+", top: "+e+", bottom: "+i+", width: "+k+", height: "+q+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
|
|
|
|
-THREE.Matrix4=function(a,c,e,g,i,k,q,p,l,m,z,A,t,y,D,H){this.n11=a||1;this.n12=c||0;this.n13=e||0;this.n14=g||0;this.n21=i||0;this.n22=k||1;this.n23=q||0;this.n24=p||0;this.n31=l||0;this.n32=m||0;this.n33=z||1;this.n34=A||0;this.n41=t||0;this.n42=y||0;this.n43=D||0;this.n44=H||1;this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
|
-THREE.Matrix4.prototype={identity:function(){this.n11=1;this.n21=this.n14=this.n13=this.n12=0;this.n22=1;this.n32=this.n31=this.n24=this.n23=0;this.n33=1;this.n43=this.n42=this.n41=this.n34=0;this.n44=1;return this},set:function(a,c,e,g,i,k,q,p,l,m,z,A,t,y,D,H){this.n11=a;this.n12=c;this.n13=e;this.n14=g;this.n21=i;this.n22=k;this.n23=q;this.n24=p;this.n31=l;this.n32=m;this.n33=z;this.n34=A;this.n41=t;this.n42=y;this.n43=D;this.n44=H;return this},copy:function(a){this.n11=a.n11;this.n12=a.n12;this.n13=
|
|
|
|
-a.n13;this.n14=a.n14;this.n21=a.n21;this.n22=a.n22;this.n23=a.n23;this.n24=a.n24;this.n31=a.n31;this.n32=a.n32;this.n33=a.n33;this.n34=a.n34;this.n41=a.n41;this.n42=a.n42;this.n43=a.n43;this.n44=a.n44;return this},lookAt:function(a,c,e){var g=THREE.Matrix4.__tmpVec1,i=THREE.Matrix4.__tmpVec2,k=THREE.Matrix4.__tmpVec3;k.sub(a,c).normalize();g.cross(e,k).normalize();i.cross(k,g).normalize();this.n11=g.x;this.n12=g.y;this.n13=g.z;this.n14=-g.dot(a);this.n21=i.x;this.n22=i.y;this.n23=i.z;this.n24=-i.dot(a);
|
|
|
|
-this.n31=k.x;this.n32=k.y;this.n33=k.z;this.n34=-k.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var c=a.x,e=a.y,g=a.z,i=1/(this.n41*c+this.n42*e+this.n43*g+this.n44);a.x=(this.n11*c+this.n12*e+this.n13*g+this.n14)*i;a.y=(this.n21*c+this.n22*e+this.n23*g+this.n24)*i;a.z=(this.n31*c+this.n32*e+this.n33*g+this.n34)*i;return a},multiplyVector4:function(a){var c=a.x,e=a.y,g=a.z,i=a.w;a.x=this.n11*c+this.n12*e+this.n13*g+this.n14*i;a.y=this.n21*c+this.n22*e+this.n23*
|
|
|
|
-g+this.n24*i;a.z=this.n31*c+this.n32*e+this.n33*g+this.n34*i;a.w=this.n41*c+this.n42*e+this.n43*g+this.n44*i;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var e=a.n11,g=a.n12,i=a.n13,k=a.n14,q=a.n21,p=a.n22,l=a.n23,m=a.n24,z=a.n31,
|
|
|
|
-A=a.n32,t=a.n33,y=a.n34,D=a.n41,H=a.n42,G=a.n43,r=a.n44,S=c.n11,B=c.n12,I=c.n13,b=c.n14,aa=c.n21,P=c.n22,J=c.n23,W=c.n24,M=c.n31,R=c.n32,K=c.n33,C=c.n34,L=c.n41,ba=c.n42,N=c.n43,da=c.n44;this.n11=e*S+g*aa+i*M+k*L;this.n12=e*B+g*P+i*R+k*ba;this.n13=e*I+g*J+i*K+k*N;this.n14=e*b+g*W+i*C+k*da;this.n21=q*S+p*aa+l*M+m*L;this.n22=q*B+p*P+l*R+m*ba;this.n23=q*I+p*J+l*K+m*N;this.n24=q*b+p*W+l*C+m*da;this.n31=z*S+A*aa+t*M+y*L;this.n32=z*B+A*P+t*R+y*ba;this.n33=z*I+A*J+t*K+y*N;this.n34=z*b+A*W+t*C+y*da;this.n41=
|
|
|
|
-D*S+H*aa+G*M+r*L;this.n42=D*B+H*P+G*R+r*ba;this.n43=D*I+H*J+G*K+r*N;this.n44=D*b+H*W+G*C+r*da;return this},multiplyToArray:function(a,c,e){var g=a.n11,i=a.n12,k=a.n13,q=a.n14,p=a.n21,l=a.n22,m=a.n23,z=a.n24,A=a.n31,t=a.n32,y=a.n33,D=a.n34,H=a.n41,G=a.n42,r=a.n43;a=a.n44;var S=c.n11,B=c.n12,I=c.n13,b=c.n14,aa=c.n21,P=c.n22,J=c.n23,W=c.n24,M=c.n31,R=c.n32,K=c.n33,C=c.n34,L=c.n41,ba=c.n42,N=c.n43;c=c.n44;this.n11=g*S+i*aa+k*M+q*L;this.n12=g*B+i*P+k*R+q*ba;this.n13=g*I+i*J+k*K+q*N;this.n14=g*b+i*W+k*
|
|
|
|
-C+q*c;this.n21=p*S+l*aa+m*M+z*L;this.n22=p*B+l*P+m*R+z*ba;this.n23=p*I+l*J+m*K+z*N;this.n24=p*b+l*W+m*C+z*c;this.n31=A*S+t*aa+y*M+D*L;this.n32=A*B+t*P+y*R+D*ba;this.n33=A*I+t*J+y*K+D*N;this.n34=A*b+t*W+y*C+D*c;this.n41=H*S+G*aa+r*M+a*L;this.n42=H*B+G*P+r*R+a*ba;this.n43=H*I+G*J+r*K+a*N;this.n44=H*b+G*W+r*C+a*c;e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=
|
|
|
|
-this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(a){var c=this.n11,e=this.n12,g=this.n13,i=this.n14,k=this.n21,q=this.n22,p=this.n23,l=this.n24,m=this.n31,z=this.n32,A=this.n33,t=this.n34,y=this.n41,D=this.n42,H=this.n43,G=this.n44,r=a.n11,S=a.n21,B=a.n31,I=a.n41,b=a.n12,aa=a.n22,P=a.n32,J=a.n42,W=a.n13,M=a.n23,R=a.n33,K=a.n43,C=a.n14,L=a.n24,ba=a.n34;a=a.n44;this.n11=c*r+e*S+g*B+i*I;this.n12=c*b+e*aa+g*P+i*J;this.n13=c*W+e*M+g*R+i*K;this.n14=c*C+e*L+g*ba+i*a;this.n21=k*r+
|
|
|
|
-q*S+p*B+l*I;this.n22=k*b+q*aa+p*P+l*J;this.n23=k*W+q*M+p*R+l*K;this.n24=k*C+q*L+p*ba+l*a;this.n31=m*r+z*S+A*B+t*I;this.n32=m*b+z*aa+A*P+t*J;this.n33=m*W+z*M+A*R+t*K;this.n34=m*C+z*L+A*ba+t*a;this.n41=y*r+D*S+H*B+G*I;this.n42=y*b+D*aa+H*P+G*J;this.n43=y*W+D*M+H*R+G*K;this.n44=y*C+D*L+H*ba+G*a;return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;
|
|
|
|
-this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,e=this.n13,g=this.n14,i=this.n21,k=this.n22,q=this.n23,p=this.n24,l=this.n31,m=this.n32,z=this.n33,A=this.n34,t=this.n41,y=this.n42,D=this.n43,H=this.n44;return g*q*m*t-e*p*m*t-g*k*z*t+c*p*z*t+e*k*A*t-c*q*A*t-g*q*l*y+e*p*l*y+g*i*z*y-a*p*z*y-e*i*A*y+a*q*A*y+g*k*l*D-c*p*l*D-g*i*m*D+a*p*m*D+c*i*A*D-a*k*A*D-e*k*l*H+c*q*l*H+e*i*m*H-a*q*m*H-c*i*z*H+a*k*z*H},transpose:function(){function a(c,e,g){var i=c[e];c[e]=c[g];c[g]=
|
|
|
|
-i}a(this,"n21","n12");a(this,"n31","n13");a(this,"n32","n23");a(this,"n41","n14");a(this,"n42","n24");a(this,"n43","n34");return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){var a=this.flat;a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;
|
|
|
|
-a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},setTranslation:function(a,c,e){this.set(1,
|
|
|
|
-0,0,a,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(a,c,e){this.set(a,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,c){var e=Math.cos(c),g=Math.sin(c),
|
|
|
|
-i=1-e,k=a.x,q=a.y,p=a.z,l=i*k,m=i*q;this.set(l*k+e,l*q-g*p,l*p+g*q,0,l*q+g*p,m*q+e,m*p-g*k,0,l*p-g*q,m*p+g*k,i*p*p+e,0,0,0,0,1);return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,c,e){var g=new THREE.Matrix4;g.setTranslation(a,c,e);return g};
|
|
|
|
-THREE.Matrix4.scaleMatrix=function(a,c,e){var g=new THREE.Matrix4;g.setScale(a,c,e);return g};THREE.Matrix4.rotationXMatrix=function(a){var c=new THREE.Matrix4;c.setRotX(a);return c};THREE.Matrix4.rotationYMatrix=function(a){var c=new THREE.Matrix4;c.setRotY(a);return c};THREE.Matrix4.rotationZMatrix=function(a){var c=new THREE.Matrix4;c.setRotZ(a);return c};THREE.Matrix4.rotationAxisAngleMatrix=function(a,c){var e=new THREE.Matrix4;e.setRotAxis(a,c);return e};
|
|
|
|
-THREE.Matrix4.makeInvert=function(a){var c=a.n11,e=a.n12,g=a.n13,i=a.n14,k=a.n21,q=a.n22,p=a.n23,l=a.n24,m=a.n31,z=a.n32,A=a.n33,t=a.n34,y=a.n41,D=a.n42,H=a.n43,G=a.n44,r=new THREE.Matrix4;r.n11=p*t*D-l*A*D+l*z*H-q*t*H-p*z*G+q*A*G;r.n12=i*A*D-g*t*D-i*z*H+e*t*H+g*z*G-e*A*G;r.n13=g*l*D-i*p*D+i*q*H-e*l*H-g*q*G+e*p*G;r.n14=i*p*z-g*l*z-i*q*A+e*l*A+g*q*t-e*p*t;r.n21=l*A*y-p*t*y-l*m*H+k*t*H+p*m*G-k*A*G;r.n22=g*t*y-i*A*y+i*m*H-c*t*H-g*m*G+c*A*G;r.n23=i*p*y-g*l*y-i*k*H+c*l*H+g*k*G-c*p*G;r.n24=g*l*m-i*p*m+
|
|
|
|
-i*k*A-c*l*A-g*k*t+c*p*t;r.n31=q*t*y-l*z*y+l*m*D-k*t*D-q*m*G+k*z*G;r.n32=i*z*y-e*t*y-i*m*D+c*t*D+e*m*G-c*z*G;r.n33=g*l*y-i*q*y+i*k*D-c*l*D-e*k*G+c*q*G;r.n34=i*q*m-e*l*m-i*k*z+c*l*z+e*k*t-c*q*t;r.n41=p*z*y-q*A*y-p*m*D+k*A*D+q*m*H-k*z*H;r.n42=e*A*y-g*z*y+g*m*D-c*A*D-e*m*H+c*z*H;r.n43=g*q*y-e*p*y-g*k*D+c*p*D+e*k*H-c*q*H;r.n44=e*p*m-g*q*m+g*k*z-c*p*z-e*k*A+c*q*A;r.multiplyScalar(1/a.determinant());return r};
|
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,e=c.m,g=a.n33*a.n22-a.n32*a.n23,i=-a.n33*a.n21+a.n31*a.n23,k=a.n32*a.n21-a.n31*a.n22,q=-a.n33*a.n12+a.n32*a.n13,p=a.n33*a.n11-a.n31*a.n13,l=-a.n32*a.n11+a.n31*a.n12,m=a.n23*a.n12-a.n22*a.n13,z=-a.n23*a.n11+a.n21*a.n13,A=a.n22*a.n11-a.n21*a.n12;a=a.n11*g+a.n21*q+a.n31*m;if(a==0)throw"matrix not invertible";a=1/a;e[0]=a*g;e[1]=a*i;e[2]=a*k;e[3]=a*q;e[4]=a*p;e[5]=a*l;e[6]=a*m;e[7]=a*z;e[8]=a*A;return c};
|
|
|
|
-THREE.Matrix4.makeFrustum=function(a,c,e,g,i,k){var q,p,l;q=new THREE.Matrix4;p=2*i/(c-a);l=2*i/(g-e);a=(c+a)/(c-a);e=(g+e)/(g-e);g=-(k+i)/(k-i);i=-2*k*i/(k-i);q.n11=p;q.n12=0;q.n13=a;q.n14=0;q.n21=0;q.n22=l;q.n23=e;q.n24=0;q.n31=0;q.n32=0;q.n33=g;q.n34=i;q.n41=0;q.n42=0;q.n43=-1;q.n44=0;return q};THREE.Matrix4.makePerspective=function(a,c,e,g){var i;a=e*Math.tan(a*Math.PI/360);i=-a;return THREE.Matrix4.makeFrustum(i*c,a*c,i,a,e,g)};
|
|
|
|
-THREE.Matrix4.makeOrtho=function(a,c,e,g,i,k){var q,p,l,m;q=new THREE.Matrix4;p=c-a;l=e-g;m=k-i;a=(c+a)/p;e=(e+g)/l;i=(k+i)/m;q.n11=2/p;q.n12=0;q.n13=0;q.n14=-a;q.n21=0;q.n22=2/l;q.n23=0;q.n24=-e;q.n31=0;q.n32=0;q.n33=-2/m;q.n34=-i;q.n41=0;q.n42=0;q.n43=0;q.n44=1;return q};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
|
|
-THREE.Vertex=function(a,c){this.position=a||new THREE.Vector3;this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.normal=c||new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.normalScreen=new THREE.Vector3;this.tangent=new THREE.Vector4;this.__visible=true};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
|
|
|
|
-THREE.Face3=function(a,c,e,g,i){this.a=a;this.b=c;this.c=e;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.Face3.prototype={toString:function(){return"THREE.Face3 ( "+this.a+", "+this.b+", "+this.c+" )"}};
|
|
|
|
-THREE.Face4=function(a,c,e,g,i,k){this.a=a;this.b=c;this.c=e;this.d=g;this.centroid=new THREE.Vector3;this.normal=i instanceof THREE.Vector3?i:new THREE.Vector3;this.vertexNormals=i instanceof Array?i:[];this.materials=k instanceof Array?k:[k]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
|
|
|
|
-THREE.UV.prototype={copy:function(a){this.u=a.u;this.v=a.v},toString:function(){return"THREE.UV ("+this.u+", "+this.v+")"}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=false};
|
|
|
|
-THREE.Geometry.prototype={computeCentroids:function(){var a,c,e;a=0;for(c=this.faces.length;a<c;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 c,e,g,i,k,q,p=new THREE.Vector3,l=new THREE.Vector3;g=0;for(i=this.vertices.length;g<i;g++){k=this.vertices[g];k.normal.set(0,0,0)}g=0;for(i=this.faces.length;g<i;g++){k=this.faces[g];if(a&&k.vertexNormals.length){p.set(0,0,0);c=0;for(e=k.normal.length;c<e;c++)p.addSelf(k.vertexNormals[c]);p.divideScalar(3)}else{c=this.vertices[k.a];e=this.vertices[k.b];q=this.vertices[k.c];p.sub(q.position,
|
|
|
|
-e.position);l.sub(c.position,e.position);p.crossSelf(l)}p.isZero()||p.normalize();k.normal.copy(p)}},computeVertexNormals:function(){var a,c,e,g;if(this.__tmpVertices==undefined){g=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)g[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;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{g=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)g[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){e=this.faces[a];if(e instanceof THREE.Face3){g[e.a].addSelf(e.normal);g[e.b].addSelf(e.normal);g[e.c].addSelf(e.normal)}else if(e instanceof THREE.Face4){g[e.a].addSelf(e.normal);g[e.b].addSelf(e.normal);g[e.c].addSelf(e.normal);g[e.d].addSelf(e.normal)}}a=0;for(c=this.vertices.length;a<c;a++)g[a].normalize();a=0;for(c=this.faces.length;a<
|
|
|
|
-c;a++){e=this.faces[a];if(e instanceof THREE.Face3){e.vertexNormals[0].copy(g[e.a]);e.vertexNormals[1].copy(g[e.b]);e.vertexNormals[2].copy(g[e.c])}else if(e instanceof THREE.Face4){e.vertexNormals[0].copy(g[e.a]);e.vertexNormals[1].copy(g[e.b]);e.vertexNormals[2].copy(g[e.c]);e.vertexNormals[3].copy(g[e.d])}}},computeTangents:function(){function a(C,L,ba,N,da,ca,d){k=C.vertices[L].position;q=C.vertices[ba].position;p=C.vertices[N].position;l=i[da];m=i[ca];z=i[d];A=q.x-k.x;t=p.x-k.x;y=q.y-k.y;D=p.y-
|
|
|
|
-k.y;H=q.z-k.z;G=p.z-k.z;r=m.u-l.u;S=z.u-l.u;B=m.v-l.v;I=z.v-l.v;b=1/(r*I-S*B);J.set((I*A-B*t)*b,(I*y-B*D)*b,(I*H-B*G)*b);W.set((r*t-S*A)*b,(r*D-S*y)*b,(r*G-S*H)*b);aa[L].addSelf(J);aa[ba].addSelf(J);aa[N].addSelf(J);P[L].addSelf(W);P[ba].addSelf(W);P[N].addSelf(W)}var c,e,g,i,k,q,p,l,m,z,A,t,y,D,H,G,r,S,B,I,b,aa=[],P=[],J=new THREE.Vector3,W=new THREE.Vector3,M=new THREE.Vector3,R=new THREE.Vector3,K=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++){aa[c]=new THREE.Vector3;P[c]=new THREE.Vector3}c=
|
|
|
|
-0;for(e=this.faces.length;c<e;c++){g=this.faces[c];i=this.uvs[c];if(g instanceof THREE.Face3){a(this,g.a,g.b,g.c,0,1,2);this.vertices[g.a].normal.copy(g.vertexNormals[0]);this.vertices[g.b].normal.copy(g.vertexNormals[1]);this.vertices[g.c].normal.copy(g.vertexNormals[2])}else if(g instanceof THREE.Face4){a(this,g.a,g.b,g.c,0,1,2);a(this,g.a,g.b,g.d,0,1,3);this.vertices[g.a].normal.copy(g.vertexNormals[0]);this.vertices[g.b].normal.copy(g.vertexNormals[1]);this.vertices[g.c].normal.copy(g.vertexNormals[2]);
|
|
|
|
-this.vertices[g.d].normal.copy(g.vertexNormals[3])}}c=0;for(e=this.vertices.length;c<e;c++){K.copy(this.vertices[c].normal);g=aa[c];M.copy(g);M.subSelf(K.multiplyScalar(K.dot(g))).normalize();R.cross(this.vertices[c].normal,g);g=R.dot(P[c]);g=g<0?-1:1;this.vertices[c].tangent.set(M.x,M.y,M.z,g)}this.hasTangents=true},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
|
|
-z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
|
|
|
|
-this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,e=this.vertices.length;c<e;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(z){var A=[];c=0;for(e=z.length;c<e;c++)z[c]==undefined?A.push("undefined"):A.push(z[c].toString());return A.join("_")}var c,e,g,i,k,q,p,l,m={};g=0;for(i=this.faces.length;g<i;g++){k=this.faces[g];
|
|
|
|
-q=k.materials;p=a(q);if(m[p]==undefined)m[p]={hash:p,counter:0};l=m[p].hash+"_"+m[p].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:q,vertices:0};k=k instanceof THREE.Face3?3:4;if(this.geometryChunks[l].vertices+k>65535){m[p].counter+=1;l=m[p].hash+"_"+m[p].counter;if(this.geometryChunks[l]==undefined)this.geometryChunks[l]={faces:[],materials:q,vertices:0}}this.geometryChunks[l].faces.push(g);this.geometryChunks[l].vertices+=k}},toString:function(){return"THREE.Geometry ( vertices: "+
|
|
|
|
|
|
+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,c){this.x=a||0;this.y=b||0;this.z=c||0;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},set x(e){this.that.x=e;this.isDirty=!0},set y(e){this.that.y=e;this.isDirty=!0},set z(e){this.that.z=e;this.isDirty=!0}};this.api.__proto__=THREE.Vector3.prototype;return this.api};
|
|
|
|
+THREE.Vector3.prototype={set:function(a,b,c){var e=this.that;e.x=a;e.y=b;e.z=c;this.isDirty=!0;return this},copy:function(a){var b=this.that;b.x=a.x;b.y=a.y;b.z=a.z;this.isDirty=!0;return this},add:function(a,b){var c=this.that;c.x=a.x+b.x;c.y=a.y+b.y;c.z=a.z+b.z;this.isDirty=!0;return this},addSelf:function(a){var b=this.that;b.x+=a.x;b.y+=a.y;b.z+=a.z;this.isDirty=!0;return this},addScalar:function(a){var b=this.that;b.x+=a;b.y+=a;b.z+=a;this.isDirty=!0;return this},sub:function(a,b){var c=this.that;
|
|
|
|
+c.x=a.x-b.x;c.y=a.y-b.y;c.z=a.z-b.z;this.isDirty=!0;return this},subSelf:function(a){var b=this.that;b.x-=a.x;b.y-=a.y;b.z-=a.z;this.isDirty=!0;return this},cross:function(a,b){var c=this.that;c.x=a.y*b.z-a.z*b.y;c.y=a.z*b.x-a.x*b.z;c.z=a.x*b.y-a.y*b.x;this.isDirty=!0;return this},crossSelf:function(a){var b=this.that,c=b.x,e=b.y,g=b.z;b.x=e*a.z-g*a.y;b.y=g*a.x-c*a.z;b.z=c*a.y-e*a.x;this.isDirty=!0;return this},multiply:function(a,b){var c=this.that;c.x=a.x*b.x;c.y=a.y*b.y;c.z=a.z*b.z;this.isDirty=
|
|
|
|
+!0;return this},multiplySelf:function(a){var b=this.that;b.x*=a.x;b.y*=a.y;b.z*=a.z;this.isDirty=!0;return this},multiplyScalar:function(a){var b=this.that;b.x*=a;b.y*=a;b.z*=a;this.isDirty=!0;return this},divideSelf:function(a){var b=this.that;b.x/=a.x;b.y/=a.y;b.z/=a.z;this.isDirty=!0;return this},divideScalar:function(a){var b=this.that;b.x/=a;b.y/=a;b.z/=a;this.isDirty=!0;return this},dot:function(a){var b=this.that;return b.x*a.x+b.y*a.y+b.z*a.z},distanceTo:function(a){var b=this.that,c=b.x-
|
|
|
|
+a.x,e=b.y-a.y;a=b.z-a.z;return Math.sqrt(c*c+e*e+a*a)},distanceToSquared:function(a){var b=this.that,c=b.x-a.x,e=b.y-a.y;a=b.z-a.z;return c*c+e*e+a*a},length:function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z)},lengthSq:function(){var a=this.that;return a.x*a.x+a.y*a.y+a.z*a.z},lengthManhattan:function(){var a=this.that;return a.x+a.y+a.z},negate:function(){var a=this.that;a.x=-this.x;a.y=-this.y;a.z=-this.z;this.isDirty=!0;return this},normalize:function(){var a=this.that;a=Math.sqrt(a.x*
|
|
|
|
+a.x+a.y*a.y+a.z*a.z);a>0?this.multiplyScalar(1/a):this.set(0,0,0);this.isDirty=!0;return this},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){var a=this.that;return Math.abs(a.x)<1.0E-4&&Math.abs(a.y)<1.0E-4&&Math.abs(a.z)<1.0E-4},clone:function(){var a=this.that;return new THREE.Vector3(a.x,a.y,a.z)},toString:function(){return"THREE.Vector3 ( "+this.x+", "+this.y+", "+this.z+" )"}};
|
|
|
|
+THREE.Vector4=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==undefined?e:1};
|
|
|
|
+THREE.Vector4.prototype={set:function(a,b,c,e){this.x=a;this.y=b;this.z=c;this.w=e;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w||1;return this},add:function(a,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-b.z;this.w=a.w-b.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;
|
|
|
|
+return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){this.x/=a;this.y/=a;this.z/=a;this.w/=a;return this},lerpSelf:function(a,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},toString:function(){return"THREE.Vector4 ("+this.x+", "+this.y+", "+this.z+", "+this.w+")"}};
|
|
|
|
+THREE.Ray=function(a,b){this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3};
|
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var b,c,e=a.objects,g=[];a=0;for(b=e.length;a<b;a++){c=e[a];c instanceof THREE.Mesh&&(g=g.concat(this.intersectObject(c)))}g.sort(function(h,m){return h.distance-m.distance});return g},intersectObject:function(a){function b(A,p,d,J){J=J.clone().subSelf(p);d=d.clone().subSelf(p);var T=A.clone().subSelf(p);A=J.dot(J);p=J.dot(d);J=J.dot(T);var W=d.dot(d);d=d.dot(T);T=1/(A*W-p*p);W=(W*J-p*d)*T;A=(A*d-p*J)*T;return W>0&&A>0&&W+A<1}var c,e,g,h,m,n,k,l,u,w,
|
|
|
|
+v,z=a.geometry,K=z.vertices,N=[];c=0;for(e=z.faces.length;c<e;c++){g=z.faces[c];w=this.origin.clone();v=this.direction.clone();h=a.matrix.multiplyVector3(K[g.a].position.clone());m=a.matrix.multiplyVector3(K[g.b].position.clone());n=a.matrix.multiplyVector3(K[g.c].position.clone());k=g instanceof THREE.Face4?a.matrix.multiplyVector3(K[g.d].position.clone()):null;l=a.rotationMatrix.multiplyVector3(g.normal.clone());u=v.dot(l);if(u<0){l=l.dot((new THREE.Vector3).sub(h,w))/u;w=w.addSelf(v.multiplyScalar(l));
|
|
|
|
+if(g instanceof THREE.Face3){if(b(w,h,m,n)){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};N.push(g)}}else if(g instanceof THREE.Face4&&(b(w,h,m,k)||b(w,m,n,k))){g={distance:this.origin.distanceTo(w),point:w,face:g,object:a};N.push(g)}}}return N}};
|
|
|
|
+THREE.Rectangle=function(){function a(){h=e-b;m=g-c}var b,c,e,g,h,m,n=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return h};this.getHeight=function(){return m};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return e};this.getBottom=function(){return g};this.set=function(k,l,u,w){n=!1;b=k;c=l;e=u;g=w;a()};this.addPoint=function(k,l){if(n){n=!1;b=k;c=l;e=k;g=l}else{b=b<k?b:k;c=c<l?c:l;e=e>k?e:k;g=g>l?g:l}a()};
|
|
|
|
+this.add3Points=function(k,l,u,w,v,z){if(n){n=!1;b=k<u?k<v?k:v:u<v?u:v;c=l<w?l<z?l:z:w<z?w:z;e=k>u?k>v?k:v:u>v?u:v;g=l>w?l>z?l:z:w>z?w:z}else{b=k<u?k<v?k<b?k:b:v<b?v:b:u<v?u<b?u:b:v<b?v:b;c=l<w?l<z?l<c?l:c:z<c?z:c:w<z?w<c?w:c:z<c?z:c;e=k>u?k>v?k>e?k:e:v>e?v:e:u>v?u>e?u:e:v>e?v:e;g=l>w?l>z?l>g?l:g:z>g?z:g:w>z?w>g?w:g:z>g?z:g}a()};this.addRectangle=function(k){if(n){n=!1;b=k.getLeft();c=k.getTop();e=k.getRight();g=k.getBottom()}else{b=b<k.getLeft()?b:k.getLeft();c=c<k.getTop()?c:k.getTop();e=e>k.getRight()?
|
|
|
|
+e:k.getRight();g=g>k.getBottom()?g:k.getBottom()}a()};this.inflate=function(k){b-=k;c-=k;e+=k;g+=k;a()};this.minSelf=function(k){b=b>k.getLeft()?b:k.getLeft();c=c>k.getTop()?c: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(c,k.getTop())>=0};this.empty=function(){n=!0;g=e=c=b=0;a()};this.isEmpty=function(){return n};this.toString=function(){return"THREE.Rectangle ( left: "+
|
|
|
|
+b+", right: "+e+", top: "+c+", bottom: "+g+", width: "+h+", height: "+m+" )"}};THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,b=this.m;a=b[1];b[1]=b[3];b[3]=a;a=b[2];b[2]=b[6];b[6]=a;a=b[5];b[5]=b[7];b[7]=a;return this},transposeIntoArray:function(a){var b=this.m;a[0]=b[0];a[1]=b[3];a[2]=b[6];a[3]=b[1];a[4]=b[4];a[5]=b[7];a[6]=b[2];a[7]=b[5];a[8]=b[8];return this}};
|
|
|
|
+THREE.Matrix4=function(a,b,c,e,g,h,m,n,k,l,u,w,v,z,K,N){this.n11=a||1;this.n12=b||0;this.n13=c||0;this.n14=e||0;this.n21=g||0;this.n22=h||1;this.n23=m||0;this.n24=n||0;this.n31=k||0;this.n32=l||0;this.n33=u||1;this.n34=w||0;this.n41=v||0;this.n42=z||0;this.n43=K||0;this.n44=N||1;this.flat=Array(16);this.m33=new THREE.Matrix3;if(typeof Float32Array!=="undefined"){var A=this;this.float32Array=new Float32Array(16);this.float32Array3x3=new Float32Array(9);this.flatten32=function(){var p=A.float32Array;
|
|
|
|
+p[0]=A.n11;p[1]=A.n21;p[2]=A.n31;p[3]=A.n41;p[4]=A.n12;p[5]=A.n22;p[6]=A.n32;p[7]=A.n42;p[8]=A.n13;p[9]=A.n23;p[10]=A.n33;p[11]=A.n43;p[12]=A.n14;p[13]=A.n24;p[14]=A.n34;p[15]=A.n44;return p};this.flatten323x3=function(){var p=A.float32Array3x3;p[0]=A.n11;p[1]=A.n21;p[2]=A.n31;p[3]=A.n12;p[4]=A.n22;p[5]=A.n32;p[6]=A.n13;p[7]=A.n23;p[8]=A.n33;return p}}};
|
|
|
|
+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,c,e,g,h,m,n,k,l,u,w,v,z,K,N){this.n11=a;this.n12=b;this.n13=c;this.n14=e;this.n21=g;this.n22=h;this.n23=m;this.n24=n;this.n31=k;this.n32=l;this.n33=u;this.n34=w;this.n41=v;this.n42=z;this.n43=K;this.n44=N;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,c){var e=THREE.Matrix4.__tmpVec1,g=THREE.Matrix4.__tmpVec2,h=THREE.Matrix4.__tmpVec3;h.sub(a,b).normalize();e.cross(c,h).normalize();g.cross(h,e).normalize();this.n11=e.x;this.n12=e.y;this.n13=e.z;this.n14=-e.dot(a);this.n21=g.x;this.n22=g.y;this.n23=g.z;this.n24=-g.dot(a);
|
|
|
|
+this.n31=h.x;this.n32=h.y;this.n33=h.z;this.n34=-h.dot(a);this.n43=this.n42=this.n41=0;this.n44=1;return this},multiplyVector3:function(a){var b=a.x,c=a.y,e=a.z,g=1/(this.n41*b+this.n42*c+this.n43*e+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*e+this.n14)*g;a.y=(this.n21*b+this.n22*c+this.n23*e+this.n24)*g;a.z=(this.n31*b+this.n32*c+this.n33*e+this.n34)*g;return a},multiplyVector3OnlyZ:function(a){var b=a.x,c=a.y;a=a.z;return(this.n31*b+this.n32*c+this.n33*a+this.n34)*(1/(this.n41*b+this.n42*c+this.n43*
|
|
|
|
+a+this.n44))},multiplyVector4:function(a){var b=a.x,c=a.y,e=a.z,g=a.w;a.x=this.n11*b+this.n12*c+this.n13*e+this.n14*g;a.y=this.n21*b+this.n22*c+this.n23*e+this.n24*g;a.z=this.n31*b+this.n32*c+this.n33*e+this.n34*g;a.w=this.n41*b+this.n42*c+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 c=a.n11,e=a.n12,g=a.n13,h=a.n14,m=a.n21,n=a.n22,k=a.n23,l=a.n24,u=a.n31,w=a.n32,v=a.n33,z=a.n34,K=a.n41,N=a.n42,A=a.n43,p=a.n44,d=b.n11,J=b.n12,T=b.n13,W=b.n14,ea=b.n21,V=b.n22,L=b.n23,aa=b.n24,R=b.n31,ba=b.n32,Q=b.n33,H=b.n34,O=b.n41,ia=b.n42,S=b.n43,f=b.n44;this.n11=c*d+e*ea+g*R+h*O;this.n12=c*J+e*V+g*ba+h*ia;this.n13=c*T+e*L+g*Q+h*S;this.n14=c*W+e*aa+g*H+h*f;this.n21=m*d+n*ea+k*R+l*O;this.n22=m*J+n*V+k*ba+l*ia;this.n23=
|
|
|
|
+m*T+n*L+k*Q+l*S;this.n24=m*W+n*aa+k*H+l*f;this.n31=u*d+w*ea+v*R+z*O;this.n32=u*J+w*V+v*ba+z*ia;this.n33=u*T+w*L+v*Q+z*S;this.n34=u*W+w*aa+v*H+z*f;this.n41=K*d+N*ea+A*R+p*O;this.n42=K*J+N*V+A*ba+p*ia;this.n43=K*T+N*L+A*Q+p*S;this.n44=K*W+N*aa+A*H+p*f;return this},multiplyToArray:function(a,b,c){var e=a.n11,g=a.n12,h=a.n13,m=a.n14,n=a.n21,k=a.n22,l=a.n23,u=a.n24,w=a.n31,v=a.n32,z=a.n33,K=a.n34,N=a.n41,A=a.n42,p=a.n43;a=a.n44;var d=b.n11,J=b.n12,T=b.n13,W=b.n14,ea=b.n21,V=b.n22,L=b.n23,aa=b.n24,R=b.n31,
|
|
|
|
+ba=b.n32,Q=b.n33,H=b.n34,O=b.n41,ia=b.n42,S=b.n43;b=b.n44;this.n11=e*d+g*ea+h*R+m*O;this.n12=e*J+g*V+h*ba+m*ia;this.n13=e*T+g*L+h*Q+m*S;this.n14=e*W+g*aa+h*H+m*b;this.n21=n*d+k*ea+l*R+u*O;this.n22=n*J+k*V+l*ba+u*ia;this.n23=n*T+k*L+l*Q+u*S;this.n24=n*W+k*aa+l*H+u*b;this.n31=w*d+v*ea+z*R+K*O;this.n32=w*J+v*V+z*ba+K*ia;this.n33=w*T+v*L+z*Q+K*S;this.n34=w*W+v*aa+z*H+K*b;this.n41=N*d+A*ea+p*R+a*O;this.n42=N*J+A*V+p*ba+a*ia;this.n43=N*T+A*L+p*Q+a*S;this.n44=N*W+A*aa+p*H+a*b;c[0]=this.n11;c[1]=this.n21;
|
|
|
|
+c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[15]=this.n44;return this},multiplySelf:function(a){var b=this.n11,c=this.n12,e=this.n13,g=this.n14,h=this.n21,m=this.n22,n=this.n23,k=this.n24,l=this.n31,u=this.n32,w=this.n33,v=this.n34,z=this.n41,K=this.n42,N=this.n43,A=this.n44,p=a.n11,d=a.n21,J=a.n31,T=a.n41,W=a.n12,ea=a.n22,V=a.n32,L=a.n42,aa=a.n13,R=a.n23,
|
|
|
|
+ba=a.n33,Q=a.n43,H=a.n14,O=a.n24,ia=a.n34;a=a.n44;this.n11=b*p+c*d+e*J+g*T;this.n12=b*W+c*ea+e*V+g*L;this.n13=b*aa+c*R+e*ba+g*Q;this.n14=b*H+c*O+e*ia+g*a;this.n21=h*p+m*d+n*J+k*T;this.n22=h*W+m*ea+n*V+k*L;this.n23=h*aa+m*R+n*ba+k*Q;this.n24=h*H+m*O+n*ia+k*a;this.n31=l*p+u*d+w*J+v*T;this.n32=l*W+u*ea+w*V+v*L;this.n33=l*aa+u*R+w*ba+v*Q;this.n34=l*H+u*O+w*ia+v*a;this.n41=z*p+K*d+N*J+A*T;this.n42=z*W+K*ea+N*V+A*L;this.n43=z*aa+K*R+N*ba+A*Q;this.n44=z*H+K*O+N*ia+A*a;return this},multiplyScalar:function(a){this.n11*=
|
|
|
|
+a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,e=this.n14,g=this.n21,h=this.n22,m=this.n23,n=this.n24,k=this.n31,l=this.n32,u=this.n33,w=this.n34,v=this.n41,z=this.n42,K=this.n43,N=this.n44;return e*m*l*v-c*n*l*v-e*h*u*v+b*n*u*v+c*h*w*v-b*m*w*v-e*m*k*z+c*n*k*z+e*g*u*z-a*n*u*z-c*g*w*z+a*m*w*z+
|
|
|
|
+e*h*k*K-b*n*k*K-e*g*l*K+a*n*l*K+b*g*w*K-a*h*w*K-c*h*k*N+b*m*k*N+c*g*l*N-a*m*l*N-b*g*u*N+a*h*u*N},transpose:function(){function a(b,c,e){var g=b[c];b[c]=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(){var a=this.flat;a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=
|
|
|
|
+this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);
|
|
|
|
+return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotX:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotY:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotZ:function(a){var b=Math.cos(a);a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},setRotAxis:function(a,b){var c=Math.cos(b),e=Math.sin(b),g=1-c,h=a.x,m=a.y,n=a.z,k=g*
|
|
|
|
+h,l=g*m;this.set(k*h+c,k*m-e*n,k*n+e*m,0,k*m+e*n,l*m+c,l*n-e*h,0,k*n-e*m,l*n+e*h,g*n*n+c,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var b=a.x,c=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var g=Math.cos(-e);e=Math.sin(-e);var h=Math.cos(b);b=Math.sin(b);var m=a*e,n=c*e;this.n11=a*g;this.n12=c*b-m*h;this.n13=m*b+c*h;this.n21=e;this.n22=g*h;this.n23=-g*b;this.n31=-c*g;this.n32=n*h+a*b;this.n33=-n*b+a*h},setRotationFromQuaternion:function(a){var b=
|
|
|
|
+a.x,c=a.y,e=a.z,g=a.w,h=b+b,m=c+c,n=e+e;a=b*h;var k=b*m;b*=n;var l=c*m;c*=n;e*=n;h*=g;m*=g;g*=n;this.n11=1-(l+e);this.n12=k-g;this.n13=b+m;this.n21=k+g;this.n22=1-(a+e);this.n23=c-h;this.n31=b-m;this.n32=c+h;this.n33=1-(a+l)},scale:function(a){var b=a.x,c=a.y;a=a.z;this.n11*=b;this.n12*=b;this.n13*=b;this.n21*=c;this.n22*=c;this.n23*=c;this.n31*=a;this.n32*=a;this.n33*=a;return this},toString:function(){return"| "+this.n11+" "+this.n12+" "+this.n13+" "+this.n14+" |\n| "+this.n21+" "+this.n22+" "+
|
|
|
|
+this.n23+" "+this.n24+" |\n| "+this.n31+" "+this.n32+" "+this.n33+" "+this.n34+" |\n| "+this.n41+" "+this.n42+" "+this.n43+" "+this.n44+" |"}};THREE.Matrix4.translationMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setTranslation(a,b,c);return e};THREE.Matrix4.scaleMatrix=function(a,b,c){var e=new THREE.Matrix4;e.setScale(a,b,c);return e};THREE.Matrix4.rotationXMatrix=function(a){var b=new THREE.Matrix4;b.setRotX(a);return b};
|
|
|
|
+THREE.Matrix4.rotationYMatrix=function(a){var b=new THREE.Matrix4;b.setRotY(a);return b};THREE.Matrix4.rotationZMatrix=function(a){var b=new THREE.Matrix4;b.setRotZ(a);return b};THREE.Matrix4.rotationAxisAngleMatrix=function(a,b){var c=new THREE.Matrix4;c.setRotAxis(a,b);return c};
|
|
|
|
+THREE.Matrix4.makeInvert=function(a,b){var c=a.n11,e=a.n12,g=a.n13,h=a.n14,m=a.n21,n=a.n22,k=a.n23,l=a.n24,u=a.n31,w=a.n32,v=a.n33,z=a.n34,K=a.n41,N=a.n42,A=a.n43,p=a.n44;b===undefined&&(b=new THREE.Matrix4);b.n11=k*z*N-l*v*N+l*w*A-n*z*A-k*w*p+n*v*p;b.n12=h*v*N-g*z*N-h*w*A+e*z*A+g*w*p-e*v*p;b.n13=g*l*N-h*k*N+h*n*A-e*l*A-g*n*p+e*k*p;b.n14=h*k*w-g*l*w-h*n*v+e*l*v+g*n*z-e*k*z;b.n21=l*v*K-k*z*K-l*u*A+m*z*A+k*u*p-m*v*p;b.n22=g*z*K-h*v*K+h*u*A-c*z*A-g*u*p+c*v*p;b.n23=h*k*K-g*l*K-h*m*A+c*l*A+g*m*p-c*k*p;
|
|
|
|
+b.n24=g*l*u-h*k*u+h*m*v-c*l*v-g*m*z+c*k*z;b.n31=n*z*K-l*w*K+l*u*N-m*z*N-n*u*p+m*w*p;b.n32=h*w*K-e*z*K-h*u*N+c*z*N+e*u*p-c*w*p;b.n33=g*l*K-h*n*K+h*m*N-c*l*N-e*m*p+c*n*p;b.n34=h*n*u-e*l*u-h*m*w+c*l*w+e*m*z-c*n*z;b.n41=k*w*K-n*v*K-k*u*N+m*v*N+n*u*A-m*w*A;b.n42=e*v*K-g*w*K+g*u*N-c*v*N-e*u*A+c*w*A;b.n43=g*n*K-e*k*K-g*m*N+c*k*N+e*m*A-c*n*A;b.n44=e*k*u-g*n*u+g*m*w-c*k*w-e*m*v+c*n*v;b.multiplyScalar(1/a.determinant());return b};
|
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var b=a.m33,c=b.m,e=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,h=a.n32*a.n21-a.n31*a.n22,m=-a.n33*a.n12+a.n32*a.n13,n=a.n33*a.n11-a.n31*a.n13,k=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,u=-a.n23*a.n11+a.n21*a.n13,w=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*m+a.n31*l;if(a==0)throw"matrix not invertible";a=1/a;c[0]=a*e;c[1]=a*g;c[2]=a*h;c[3]=a*m;c[4]=a*n;c[5]=a*k;c[6]=a*l;c[7]=a*u;c[8]=a*w;return b};
|
|
|
|
+THREE.Matrix4.makeFrustum=function(a,b,c,e,g,h){var m;m=new THREE.Matrix4;m.n11=2*g/(b-a);m.n12=0;m.n13=(b+a)/(b-a);m.n14=0;m.n21=0;m.n22=2*g/(e-c);m.n23=(e+c)/(e-c);m.n24=0;m.n31=0;m.n32=0;m.n33=-(h+g)/(h-g);m.n34=-2*h*g/(h-g);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(a,b,c,e){var g;a=c*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*b,a*b,g,a,c,e)};
|
|
|
|
+THREE.Matrix4.makeOrtho=function(a,b,c,e,g,h){var m,n,k,l;m=new THREE.Matrix4;n=b-a;k=c-e;l=h-g;m.n11=2/n;m.n12=0;m.n13=0;m.n14=-((b+a)/n);m.n21=0;m.n22=2/k;m.n23=0;m.n24=-((c+e)/k);m.n31=0;m.n32=0;m.n33=-2/l;m.n34=-((h+g)/l);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
|
|
+THREE.Quaternion=function(a,b,c,e){this.x=a||0;this.y=b||0;this.z=c||0;this.w=e!==undefined?e:1;this.api={isDirty:!1,that:this,get x(){return this.that.x},get y(){return this.that.y},get z(){return this.that.z},get w(){return this.that.w},set x(g){this.that.x=g;this.isDirty=!0},set y(g){this.that.y=g;this.isDirty=!0},set z(g){this.that.z=g;this.isDirty=!0},set w(g){this.that.w=g;this.isDirty=!0}};this.api.__proto__=THREE.Quaternion.prototype;return this.api};
|
|
|
|
+THREE.Quaternion.prototype.set=function(a,b,c,e){var g=this.that;g.x=a;g.y=b;g.z=c;g.w=e;this.isDirty=!0;return this};THREE.Quaternion.prototype.setFromEuler=function(a){var b=0.5*Math.PI/360,c=a.x*b,e=a.y*b,g=a.z*b;a=Math.cos(e);e=Math.sin(e);b=Math.cos(-g);g=Math.sin(-g);var h=Math.cos(c);c=Math.sin(c);var m=a*b,n=e*g,k=this.that;k.w=m*h-n*c;k.x=m*c+n*h;k.y=e*b*h+a*g*c;k.z=a*g*h-e*b*c;this.isDirty=!0;return this};
|
|
|
|
+THREE.Quaternion.prototype.calculateW=function(){var a=this.that,b=a.x,c=a.y,e=a.z;a.w=-Math.sqrt(Math.abs(1-b*b-c*c-e*e));this.isDirty=!0;return this};THREE.Quaternion.prototype.inverse=function(){var a=this.that;a.x*=-1;a.y*=-1;a.z*=-1;this.isDirty=!0;return this};THREE.Quaternion.prototype.length=function(){var a=this.that;return Math.sqrt(a.x*a.x+a.y*a.y+a.z*a.z+a.w*a.w)};
|
|
|
|
+THREE.Quaternion.prototype.normalize=function(){var a=this.that,b=a.x,c=a.y,e=a.z,g=a.w,h=Math.sqrt(b*b+c*c+e*e+g*g);if(h==0){a.x=0;a.y=0;a.z=0;a.w=0;this.isDirty=!0;return this}h=1/h;a.x=b*h;a.y=c*h;a.z=e*h;a.w=g*h;this.isDirty=!0;return this};
|
|
|
|
+THREE.Quaternion.prototype.multiplySelf=function(a){var b=this.that;qax=b.x;qay=b.y;qaz=b.z;qaw=b.w;qbx=a.x;qby=a.y;qbz=a.z;qbw=a.w;b.x=qax*qbw+qaw*qbx+qay*qbz-qaz*qby;b.y=qay*qbw+qaw*qby+qaz*qbx-qax*qbz;b.z=qaz*qbw+qaw*qbz+qax*qby-qay*qbx;b.w=qaw*qbw-qax*qbx-qay*qby-qaz*qbz;this.isDirty=!0;return this};
|
|
|
|
+THREE.Quaternion.prototype.multiplyVector3=function(a,b){b||(b=a);var c=this.that,e=a.x,g=a.y,h=a.z,m=c.x,n=c.y,k=c.z;c=c.w;var l=c*e+n*h-k*g,u=c*g+k*e-m*h,w=c*h+m*g-n*e;e=-m*e-n*g-k*h;b.x=l*c+e*-m+u*-k-w*-n;b.y=u*c+e*-n+w*-m-l*-k;b.z=w*c+e*-k+l*-n-u*-m;return b};THREE.Quaternion.prototype.toMatrix3=function(){};THREE.Quaternion.prototype.toMatrix4=function(){};
|
|
|
|
+THREE.Quaternion.slerp=function(a,b,c,e){var g=a.w*b.w+a.x*b.x+a.y*b.y+a.z*b.z;if(Math.abs(g)>=1){c.w=a.w;c.x=a.x;c.y=a.y;c.z=a.z;return c}var h=Math.acos(g),m=Math.sqrt(1-g*g);if(Math.abs(m)<0.0010){c.w=0.5*(a.w+b.w);c.x=0.5*(a.x+b.x);c.y=0.5*(a.y+b.y);c.z=0.5*(a.z+b.z);return c}g=Math.sin((1-e)*h)/m;e=Math.sin(e*h)/m;c.w=a.w*g+b.w*e;c.x=a.x*g+b.x*e;c.y=a.y*g+b.y*e;c.z=a.z*g+b.z*e;return c};
|
|
|
|
+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=!0};THREE.Vertex.prototype={toString:function(){return"THREE.Vertex ( position: "+this.position+", normal: "+this.normal+" )"}};
|
|
|
|
+THREE.Face3=function(a,b,c,e,g){this.a=a;this.b=b;this.c=c;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,c,e,g,h){this.a=a;this.b=b;this.c=c;this.d=e;this.centroid=new THREE.Vector3;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.materials=h instanceof Array?h:[h]};THREE.Face4.prototype={toString:function(){return"THREE.Face4 ( "+this.a+", "+this.b+", "+this.c+" "+this.d+" )"}};THREE.UV=function(a,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.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.faces=[];this.uvs=[];this.uvs2=[];this.colors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.geometryChunks={};this.hasTangents=!1};
|
|
|
|
+THREE.Geometry.prototype={computeCentroids:function(){var a,b,c;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];c.centroid.set(0,0,0);if(c instanceof THREE.Face3){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);c.centroid.divideScalar(3)}else if(c instanceof THREE.Face4){c.centroid.addSelf(this.vertices[c.a].position);c.centroid.addSelf(this.vertices[c.b].position);c.centroid.addSelf(this.vertices[c.c].position);
|
|
|
|
+c.centroid.addSelf(this.vertices[c.d].position);c.centroid.divideScalar(4)}}},computeFaceNormals:function(a){var b,c,e,g,h,m,n=new THREE.Vector3,k=new THREE.Vector3;e=0;for(g=this.vertices.length;e<g;e++){h=this.vertices[e];h.normal.set(0,0,0)}e=0;for(g=this.faces.length;e<g;e++){h=this.faces[e];if(a&&h.vertexNormals.length){n.set(0,0,0);b=0;for(c=h.normal.length;b<c;b++)n.addSelf(h.vertexNormals[b]);n.divideScalar(3)}else{b=this.vertices[h.a];c=this.vertices[h.b];m=this.vertices[h.c];n.sub(m.position,
|
|
|
|
+c.position);k.sub(b.position,c.position);n.crossSelf(k)}n.isZero()||n.normalize();h.normal.copy(n)}},computeVertexNormals:function(){var a,b,c,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)e[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,
|
|
|
|
+new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)e[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++){c=this.faces[a];if(c instanceof THREE.Face3){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal)}else if(c instanceof THREE.Face4){e[c.a].addSelf(c.normal);e[c.b].addSelf(c.normal);e[c.c].addSelf(c.normal);e[c.d].addSelf(c.normal)}}a=0;for(b=this.vertices.length;a<b;a++)e[a].normalize();a=0;for(b=this.faces.length;a<
|
|
|
|
+b;a++){c=this.faces[a];if(c instanceof THREE.Face3){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c])}else if(c instanceof THREE.Face4){c.vertexNormals[0].copy(e[c.a]);c.vertexNormals[1].copy(e[c.b]);c.vertexNormals[2].copy(e[c.c]);c.vertexNormals[3].copy(e[c.d])}}},computeTangents:function(){function a(H,O,ia,S,f,q,o){h=H.vertices[O].position;m=H.vertices[ia].position;n=H.vertices[S].position;k=g[f];l=g[q];u=g[o];w=m.x-h.x;v=n.x-h.x;z=m.y-h.y;K=n.y-h.y;
|
|
|
|
+N=m.z-h.z;A=n.z-h.z;p=l.u-k.u;d=u.u-k.u;J=l.v-k.v;T=u.v-k.v;W=1/(p*T-d*J);L.set((T*w-J*v)*W,(T*z-J*K)*W,(T*N-J*A)*W);aa.set((p*v-d*w)*W,(p*K-d*z)*W,(p*A-d*N)*W);ea[O].addSelf(L);ea[ia].addSelf(L);ea[S].addSelf(L);V[O].addSelf(aa);V[ia].addSelf(aa);V[S].addSelf(aa)}var b,c,e,g,h,m,n,k,l,u,w,v,z,K,N,A,p,d,J,T,W,ea=[],V=[],L=new THREE.Vector3,aa=new THREE.Vector3,R=new THREE.Vector3,ba=new THREE.Vector3,Q=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++){ea[b]=new THREE.Vector3;V[b]=new THREE.Vector3}b=
|
|
|
|
+0;for(c=this.faces.length;b<c;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(c=this.vertices.length;b<c;b++){Q.copy(this.vertices[b].normal);e=ea[b];R.copy(e);R.subSelf(Q.multiplyScalar(Q.dot(e))).normalize();ba.cross(this.vertices[b].normal,e);e=ba.dot(V[b]);e=e<0?-1:1;this.vertices[b].tangent.set(R.x,R.y,R.z,e)}this.hasTangents=!0},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,c=this.vertices.length;b<c;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,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},sortFacesByMaterial:function(){function a(u){var w=[];b=0;for(c=u.length;b<c;b++)u[b]==undefined?w.push("undefined"):w.push(u[b].toString());return w.join("_")}var b,c,e,g,h,m,n,k,l={};e=0;for(g=this.faces.length;e<g;e++){h=this.faces[e];
|
|
|
|
+m=h.materials;n=a(m);l[n]==undefined&&(l[n]={hash:n,counter:0});k=l[n].hash+"_"+l[n].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:m,vertices:0});h=h instanceof THREE.Face3?3:4;if(this.geometryChunks[k].vertices+h>65535){l[n].counter+=1;k=l[n].hash+"_"+l[n].counter;this.geometryChunks[k]==undefined&&(this.geometryChunks[k]={faces:[],materials:m,vertices:0})}this.geometryChunks[k].faces.push(e);this.geometryChunks[k].vertices+=h}},toString:function(){return"THREE.Geometry ( vertices: "+
|
|
this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
|
|
this.vertices+", faces: "+this.faces+", uvs: "+this.uvs+" )"}};THREE.GeometryIdCounter=0;
|
|
-THREE.Camera=function(a,c,e,g){this.fov=a;this.aspect=c;this.near=e;this.far=g;this.position=new THREE.Vector3;this.target={position:new THREE.Vector3};this.autoUpdateMatrix=true;this.projectionMatrix=null;this.matrix=new THREE.Matrix4;this.up=new THREE.Vector3(0,1,0);this.tmpVec=new THREE.Vector3;this.translateX=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.tmpVec.crossSelf(this.up);this.position.addSelf(this.tmpVec);this.target.position.addSelf(this.tmpVec)};
|
|
|
|
-this.translateZ=function(i){this.tmpVec.sub(this.target.position,this.position).normalize().multiplyScalar(i);this.position.subSelf(this.tmpVec);this.target.position.subSelf(this.tmpVec)};this.updateMatrix=function(){this.matrix.lookAt(this.position,this.target.position,this.up)};this.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};this.updateProjectionMatrix()};
|
|
|
|
-THREE.Camera.prototype={toString:function(){return"THREE.Camera ( "+this.position+", "+this.target.position+" )"}};THREE.Light=function(a){this.color=new THREE.Color(a)};THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;
|
|
|
|
-THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
|
|
|
|
-THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.rotationMatrix=new THREE.Matrix4;this.tmpMatrix=new THREE.Matrix4;this.screen=new THREE.Vector3;this.visible=this.autoUpdateMatrix=true;this.children=[]};
|
|
|
|
-THREE.Object3D.prototype={addChild:function(a){this.children.indexOf(a)===-1&&this.children.push(a)},removeChild:function(a){a=this.children.indexOf(a);a!==-1&&this.children.splice(a,1)},updateMatrix:function(){var a=this.position,c=this.rotation,e=this.scale,g=this.matrix,i=this.rotationMatrix,k=this.tmpMatrix;g.setTranslation(a.x,a.y,a.z);i.setRotX(c.x);c.y!=0&&i.multiplySelf(k.setRotY(c.y));c.z!=0&&i.multiplySelf(k.setRotZ(c.z));g.multiplySelf(i);if(e.x!=0||e.y!=0||e.z!=0)g.multiplySelf(k.setScale(e.x,
|
|
|
|
-e.y,e.z))}};THREE.Object3DCounter={value:0};THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=false};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=false};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
|
|
|
|
-THREE.Line=function(a,c,e){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=e!=undefined?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.overdraw=this.doubleSided=this.flipSided=false;this.geometry.boundingSphere||this.geometry.computeBoundingSphere()};
|
|
|
|
-THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;
|
|
|
|
-THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
|
|
|
|
|
|
+THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.visible=!0;this.autoUpdateMatrix=!0;this.matrixNeedsToUpdate=!0;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.localMatrix=new THREE.Matrix4;this.globalMatrix=new THREE.Matrix4;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.screenPosition=new THREE.Vector4;this.boundRadius=0;this.boundRadiusScale=1};
|
|
|
|
+THREE.Object3D.prototype.update=function(a,b,c,e){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c,e)}};
|
|
|
|
+THREE.Object3D.prototype.updateMatrix=function(){var a=!1;if(this.position.isDirty){this.localMatrix.setPosition(this.position);this.position.isDirty=!1;a=!0}if(this.useQuaternion){if(this.quaternion.isDirty){this.localMatrix.setRotationFromQuaternion(this.quaternion);this.quaternion.isDirty=!1;this.rotation.isDirty=!1;if(this.scale.isDirty||this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.scale.isDirty=!1;this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,
|
|
|
|
+this.scale.z))}a=!0}}else if(this.rotation.isDirty){this.localMatrix.setRotationFromEuler(this.rotation);this.rotation.isDirty=!1;if(this.scale.isDirty||this.scale.x!==1||this.scale.y!==1||this.scale.z!==1){this.localMatrix.scale(this.scale);this.scale.isDirty=!1;this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z))}a=!0}if(this.scale.isDirty){this.useQuaternion?this.localMatrix.setRotationFromQuaternion(this.quaternion):this.localMatrix.setRotationFromEuler(this.rotation);
|
|
|
|
+this.localMatrix.scale(this.scale);this.scale.isDirty=!1;this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));a=!0}return a};THREE.Object3D.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a)}};THREE.Object3D.prototype.removeChild=function(){var a=this.children.indexOf(child);if(a!==-1){this.children.splice(a,1);child.parent=undefined}};THREE.Object3DCounter={value:0};
|
|
|
|
+THREE.Particle=function(a){THREE.Object3D.call(this);this.materials=a instanceof Array?a:[a];this.autoUpdateMatrix=!1};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.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;
|
|
|
|
+THREE.Line=function(a,b,c){THREE.Object3D.call(this);this.geometry=a;this.materials=b instanceof Array?b:[b];this.type=c!=undefined?c:THREE.LineStrip};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&&b.length?b:[b];this.normalMatrix=THREE.Matrix4.makeInvert3x3(this.globalMatrix).transpose();this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
+THREE.Mesh.prototype.update=function(a,b,c,e){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;this.normalMatrix=THREE.Matrix4.makeInvert3x3(this.globalMatrix).transpose()}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,c,e);e&&c&&(c.frustumContains(this)?e.addToRenderList(this):e.removeFromRenderList(this))}else e.removeFromRenderList(this)};
|
|
|
|
+THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
+THREE.Bone.prototype.update=function(a,b,c,e){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.skinMatrix.multiply(a,this.localMatrix):this.skinMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0}if(this.hasNoneBoneChildren){this.globalMatrix.multiply(this.skin.globalMatrix,this.skinMatrix);for(a=0;a<this.children.length;a++)this.children[a]instanceof THREE.Bone?this.children[a].update(this.skinMatrix,b,c,e):this.children[a].update(this.globalMatrix,
|
|
|
|
+!0,c,e)}else for(a=0;a<this.children.length;a++)this.children[a].update(this.skinMatrix,b,c,e)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};if(!window.Float32Array)window.Float32Array=Array;
|
|
|
|
+THREE.SkinnedMesh=function(a,b){THREE.Mesh.call(this,a,b);this.identityMatrix=new THREE.Matrix4;this.bones=[];this.boneMatrices=[];if(this.geometry.bones!==undefined){for(var c=0;c<this.geometry.bones.length;c++){var e=this.addBone();e.name=this.geometry.bones[c].name;e.position.x=this.geometry.bones[c].pos[0];e.position.y=this.geometry.bones[c].pos[1];e.position.z=this.geometry.bones[c].pos[2];e.quaternion.x=this.geometry.bones[c].rotq[0];e.quaternion.y=this.geometry.bones[c].rotq[1];e.quaternion.z=
|
|
|
|
+this.geometry.bones[c].rotq[2];e.quaternion.w=this.geometry.bones[c].rotq[3];e.scale.x=this.geometry.bones[c].scl!==undefined?this.geometry.bones[c].scl[0]:1;e.scale.y=this.geometry.bones[c].scl!==undefined?this.geometry.bones[c].scl[1]:1;e.scale.z=this.geometry.bones[c].scl!==undefined?this.geometry.bones[c].scl[2]:1}for(c=0;c<this.bones.length;c++)this.geometry.bones[c].parent===-1?this.addChild(this.bones[c]):this.bones[this.geometry.bones[c].parent].addChild(this.bones[c]);this.boneMatrices=new Float32Array(16*
|
|
|
|
+this.bones.length);this.pose()}};THREE.SkinnedMesh.prototype=new THREE.Mesh;THREE.SkinnedMesh.prototype.constructor=THREE.SkinnedMesh;
|
|
|
|
+THREE.SkinnedMesh.prototype.update=function(a,b,c,e){if(this.visible){this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;this.normalMatrix=THREE.Matrix4.makeInvert3x3(this.globalMatrix).transpose()}for(a=0;a<this.children.length;a++)this.children[a]instanceof THREE.Bone?this.children[a].update(this.identityMatrix,!1,c,e):this.children[a].update(this.globalMatrix,
|
|
|
|
+b,c,e);e&&c&&(c.frustumContains(this)?e.addToRenderList(this):e.removeFromRenderList(this))}else e.removeFromRenderList(this)};THREE.SkinnedMesh.prototype.addBone=function(a){a===undefined&&(a=new THREE.Bone(this));this.bones.push(a);return a};
|
|
|
|
+THREE.SkinnedMesh.prototype.pose=function(){this.update(undefined,!0);for(var a,b=[],c=0;c<this.bones.length;c++){a=this.bones[c];b.push(THREE.Matrix4.makeInvert(a.skinMatrix));a.skinMatrix.flattenToArrayOffset(this.boneMatrices,c*16)}if(this.geometry.skinVerticesA===undefined){this.geometry.skinVerticesA=[];this.geometry.skinVerticesB=[];var e;for(a=0;a<this.geometry.skinIndices.length;a++){c=this.geometry.vertices[a].position;var g=this.geometry.skinIndices[a].x,h=this.geometry.skinIndices[a].y;
|
|
|
|
+e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesA.push(b[g].multiplyVector3(e));e=new THREE.Vector3(c.x,c.y,c.z);this.geometry.skinVerticesB.push(b[h].multiplyVector3(e));if(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y!==1){c=(1-(this.geometry.skinWeights[a].x+this.geometry.skinWeights[a].y))*0.5;this.geometry.skinWeights[a].x+=c;this.geometry.skinWeights[a].y+=c}}}};
|
|
|
|
+THREE.AnimationHandler=function(){var a=[],b={};b.update=function(c){for(var e=0;e<a.length;e++)a[e].update(c)};b.add=function(c){a.indexOf(c)===-1&&a.push(c)};b.remove=function(c){a.indexOf(c)!==-1&&a.splice(childIndex,1)};b.initData=function(c){if(c.initialized!==!0){for(var e=0;e<c.hierarchy.length;e++)for(var g=0;g<c.hierarchy[e].keys.length;g++){if(c.hierarchy[e].keys[g].time<0)c.hierarchy[e].keys[g].time=0;c.hierarchy[e].keys[g].index=g;if(c.hierarchy[e].keys[g].rot!==undefined&&!(c.hierarchy[e].keys[g].rot instanceof
|
|
|
|
+THREE.Quaternion)){var h=c.hierarchy[e].keys[g].rot;c.hierarchy[e].keys[g].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}g=parseInt(c.length*c.fps,10);c.JIT={};c.JIT.hierarchy=[];for(e=0;e<c.hierarchy.length;e++)c.JIT.hierarchy.push(Array(g));c.initialized=!0}};return b}();
|
|
|
|
+THREE.Animation=function(a,b){this.root=a;this.data=b;this.hierarchy=[];this.startTime=0;this.isPlaying=!1;this.loop=!0;this.offset=0;this.data.initialized||THREE.AnimationHandler.initData(this.data);if(a instanceof THREE.SkinnedMesh)for(var c=0;c<this.root.bones.length;c++)this.hierarchy.push(this.root.bones[c])};
|
|
|
|
+THREE.Animation.prototype.play=function(){if(!this.isPlaying){this.isPlaying=!0;this.startTime=(new Date).getTime()*0.0010;for(var a=0;a<this.hierarchy.length;a++){this.hierarchy[a].useQuaternion=!0;this.hierarchy[a].autoUpdateMatrix=!0;if(this.hierarchy[a].prevKey===undefined){this.hierarchy[a].prevKey={pos:0,rot:0,scl:0};this.hierarchy[a].nextKey={pos:0,rot:0,scl:0}}this.hierarchy[a].prevKey.pos=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.rot=this.data.hierarchy[a].keys[0];this.hierarchy[a].prevKey.scl=
|
|
|
|
+this.data.hierarchy[a].keys[0];this.hierarchy[a].nextKey.pos=this.getNextKeyWith("pos",a,1);this.hierarchy[a].nextKey.rot=this.getNextKeyWith("rot",a,1);this.hierarchy[a].nextKey.scl=this.getNextKeyWith("scl",a,1)}this.update();THREE.AnimationHandler.add(this)}};THREE.Animation.prototype.pause=function(){THREE.AnimationHandler.remove(this)};THREE.Animation.prototype.stop=function(){this.isPlaying=!1;THREE.AnimationHandler.remove(this)};
|
|
|
|
+THREE.Animation.prototype.update=function(){if(this.isPlaying){var a=["pos","rot","scl"],b,c,e,g,h,m,n=this.data.JIT.hierarchy,k=(new Date).getTime()*0.0010-this.startTime+this.offset,l=k;if(k>this.data.length){for(;k>this.data.length;)k-=this.data.length;this.startTime=(new Date).getTime()*0.0010-k;k=(new Date).getTime()*0.0010-this.startTime}m=Math.min(parseInt(k*this.data.fps),parseInt(this.data.length*this.data.fps));for(var u=0,w=this.hierarchy.length;u<w;u++){h=this.hierarchy[u];if(n[u][m]!==
|
|
|
|
+undefined){h.skinMatrix=n[u][m];h.autoUpdateMatrix=!1;h.matrixNeedsToUpdate=!1;h.skinMatrix.flattenToArrayOffset(this.root.boneMatrices,u*16)}else for(var v=0;v<3;v++){c=a[v];e=h.prevKey[c];g=h.nextKey[c];if(g.time<l){if(k<l)if(this.loop){e=this.data.hierarchy[u].keys[0];g=this.getNextKeyWith(c,u,1)}else{this.stop();return}else{do{e=g;g=this.getNextKeyWith(c,u,g.index+1)}while(g.time<k)}h.prevKey[c]=e;h.nextKey[c]=g}h.autoUpdateMatrix=!0;h.matrixNeedsToUpdate=!0;b=(k-e.time)/(g.time-e.time);e=e[c];
|
|
|
|
+g=g[c];if(c==="rot"){if(b<0||b>1){console.log("Scale out of bounds:"+b);b=b<0?0:1}THREE.Quaternion.slerp(e,g,h.quaternion,b)}else{c=c==="pos"?h.position:h.scale;c.x=e[0]+(g[0]-e[0])*b;c.y=e[1]+(g[1]-e[1])*b;c.z=e[2]+(g[2]-e[2])*b}}}if(n[0][m]===undefined){this.hierarchy[0].update(undefined,!0);for(u=0;u<this.hierarchy.length;u++)n[u][m]=this.hierarchy[u].skinMatrix.clone()}}};THREE.Animation.prototype.updateObject=function(){};
|
|
|
|
+THREE.Animation.prototype.getNextKeyWith=function(a,b,c){for(var e=this.data.hierarchy[b].keys;c<e.length;c++)if(e[c][a]!==undefined)return e[c];return this.data.hierarchy[b].keys[0]};
|
|
|
|
+THREE.Camera=function(a,b,c,e,g,h){THREE.Object3D.call(this);this.FOV=a||50;this.aspect=b||1;this.zNear=c||0.1;this.zFar=e||2E3;this.screenCenterY=this.screenCenterX=0;this.target=h||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.inverseMatrix=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;
|
|
|
|
+THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.FOV,this.aspect,this.zNear,this.zFar)};
|
|
|
|
+THREE.Camera.prototype.update=function(a,b,c,e){if(this.useTarget){this.localMatrix.lookAt(this.position,this.target.position,this.up);a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix);b=!0}else{this.autoUpdateMatrix&&(b|=this.updateMatrix());if(b||this.matrixNeedsToUpdate){a?this.globalMatrix.multiply(a,this.localMatrix):this.globalMatrix.copy(this.localMatrix);this.matrixNeedsToUpdate=!1;b=!0;
|
|
|
|
+THREE.Matrix4.makeInvert(this.globalMatrix,this.inverseMatrix)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.globalMatrix,b,e,renderer)};
|
|
|
|
+THREE.Camera.prototype.frustumContains=function(a){var b=a.globalMatrix.n14,c=a.globalMatrix.n24,e=a.globalMatrix.n34,g=this.inverseMatrix,h=a.boundRadius*a.boundRadiusScale,m=g.n31*b+g.n32*c+g.n33*e+g.n34;if(m-h>-this.zNear)return!1;if(m+h<-this.zFar)return!1;m-=h;var n=this.projectionMatrix,k=1/(n.n43*m),l=k*this.screenCenterX,u=(g.n11*b+g.n12*c+g.n13*e+g.n14)*n.n11*l;h=n.n11*h*l;if(u+h<-this.screenCenterX)return!1;if(u-h>this.screenCenterX)return!1;b=(g.n21*b+g.n22*c+g.n23*e+g.n24)*n.n22*k*this.screenCenterY;
|
|
|
|
+if(b+h<-this.screenCenterY)return!1;if(b-h>this.screenCenterY)return!1;a.screenPosition.set(u,b,m,h);return!0};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;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.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
|
|
|
|
+THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;
|
|
|
|
+THREE.LineBasicMaterial=function(a){this.id=THREE.LineBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.linewidth!==undefined)this.linewidth=
|
|
a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
|
a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
|
THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.LineBasicMaterialCounter={value:0};
|
|
THREE.LineBasicMaterial.prototype={toString:function(){return"THREE.LineBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>linewidth: "+this.linewidth+"<br/>linecap: "+this.linecap+"<br/>linejoin: "+this.linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.LineBasicMaterialCounter={value:0};
|
|
-THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){a.color!==
|
|
|
|
|
|
+THREE.MeshBasicMaterial=function(a){this.id=THREE.MeshBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){a.color!==
|
|
undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
|
undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
|
-undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
|
|
|
|
|
+undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+
|
|
THREE.MeshBasicMaterial.prototype={toString:function(){return"THREE.MeshBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+
|
|
-"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
|
|
|
|
-THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){a.color!==
|
|
|
|
-undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==
|
|
|
|
-undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
|
|
|
-THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+
|
|
|
|
-"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
|
|
|
|
-THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=true;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=
|
|
|
|
-1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=
|
|
|
|
-a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=
|
|
|
|
-a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
|
|
|
|
|
+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};THREE.MeshBasicMaterialCounter={value:0};
|
|
|
|
+THREE.MeshLambertMaterial=function(a){this.id=THREE.MeshLambertMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;
|
|
|
|
+if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.env_map!==undefined)this.env_map=a.env_map;if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;
|
|
|
|
+if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=
|
|
|
|
+a.skinning}};
|
|
|
|
+THREE.MeshLambertMaterial.prototype={toString:function(){return"THREE.MeshLambertMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>light_map: "+this.light_map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+
|
|
|
|
+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/> )"}};THREE.MeshLambertMaterialCounter={value:0};
|
|
|
|
+THREE.MeshPhongMaterial=function(a){this.id=THREE.MeshPhongMaterialCounter.value++;this.color=new THREE.Color(16777215);this.ambient=new THREE.Color(328965);this.specular=new THREE.Color(1118481);this.shininess=30;this.opacity=1;this.env_map=this.light_map=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refraction_ratio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=
|
|
|
|
+this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.color!==undefined)this.color=new THREE.Color(a.color);if(a.ambient!==undefined)this.ambient=new THREE.Color(a.ambient);if(a.specular!==undefined)this.specular=new THREE.Color(a.specular);if(a.shininess!==undefined)this.shininess=a.shininess;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.light_map!==undefined)this.light_map=a.light_map;if(a.map!==undefined)this.map=a.map;if(a.env_map!==undefined)this.env_map=a.env_map;
|
|
|
|
+if(a.combine!==undefined)this.combine=a.combine;if(a.reflectivity!==undefined)this.reflectivity=a.reflectivity;if(a.refraction_ratio!==undefined)this.refraction_ratio=a.refraction_ratio;if(a.fog!==undefined)this.fog=a.fog;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;
|
|
|
|
+if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+
|
|
THREE.MeshPhongMaterial.prototype={toString:function(){return"THREE.MeshPhongMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>ambient: "+this.ambient+"<br/>specular: "+this.specular+"<br/>shininess: "+this.shininess+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>env_map: "+this.env_map+"<br/>combine: "+this.combine+"<br/>reflectivity: "+this.reflectivity+"<br/>refraction_ratio: "+this.refraction_ratio+"<br/>shading: "+this.shading+"<br/>blending: "+this.blending+"<br/>depth_test: "+
|
|
-this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.MeshPhongMaterialCounter={value:0};
|
|
|
|
-THREE.MeshDepthMaterial=function(a){this.id=THREE.MeshDepthMaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
|
|
|
+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};THREE.MeshPhongMaterialCounter={value:0};
|
|
|
|
+THREE.MeshDepthMaterial=function(a){this.id=THREE.MeshDepthMaterialCounter.value++;this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshDepthMaterialCounter={value:0};
|
|
undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshDepthMaterial.prototype={toString:function(){return"THREE.MeshDepthMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshDepthMaterialCounter={value:0};
|
|
-THREE.MeshNormalMaterial=function(a){this.id=THREE.MeshNormalMaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
|
|
|
|
+THREE.MeshNormalMaterial=function(a){this.id=THREE.MeshNormalMaterialCounter.value++;this.opacity=1;this.shading=THREE.FlatShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;if(a){if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==
|
|
undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshNormalMaterialCounter={value:0};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
|
|
undefined)this.wireframe_linewidth=a.wireframe_linewidth}};THREE.MeshNormalMaterial.prototype={toString:function(){return"THREE.MeshNormalMaterial (<br/>id: "+this.id+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>)"}};THREE.MeshNormalMaterialCounter={value:0};THREE.MeshFaceMaterial=function(){};THREE.MeshFaceMaterial.prototype={toString:function(){return"THREE.MeshFaceMaterial"}};
|
|
-THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=true;this.wireframe=false;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=false;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=
|
|
|
|
|
|
+THREE.MeshShaderMaterial=function(a){this.id=THREE.MeshShaderMaterialCounter.value++;this.vertex_shader=this.fragment_shader="void main() {}";this.uniforms={};this.opacity=1;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depth_test=!0;this.wireframe=!1;this.wireframe_linewidth=1;this.wireframe_linejoin=this.wireframe_linecap="round";this.vertex_colors=!1;this.skinning=!1;if(a){if(a.fragment_shader!==undefined)this.fragment_shader=a.fragment_shader;if(a.vertex_shader!==undefined)this.vertex_shader=
|
|
a.vertex_shader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==
|
|
a.vertex_shader;if(a.uniforms!==undefined)this.uniforms=a.uniforms;if(a.opacity!==undefined)this.opacity=a.opacity;if(a.shading!==undefined)this.shading=a.shading;if(a.blending!==undefined)this.blending=a.blending;if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.wireframe!==undefined)this.wireframe=a.wireframe;if(a.wireframe_linewidth!==undefined)this.wireframe_linewidth=a.wireframe_linewidth;if(a.wireframe_linecap!==undefined)this.wireframe_linecap=a.wireframe_linecap;if(a.wireframe_linejoin!==
|
|
-undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};
|
|
|
|
-THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
|
|
|
|
-THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=true;this.offset=new THREE.Vector2;this.vertex_colors=false;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;
|
|
|
|
|
|
+undefined)this.wireframe_linejoin=a.wireframe_linejoin;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors;if(a.skinning!==undefined)this.skinning=a.skinning}};
|
|
|
|
+THREE.MeshShaderMaterial.prototype={toString:function(){return"THREE.MeshShaderMaterial (<br/>id: "+this.id+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>wireframe: "+this.wireframe+"<br/>wireframe_linewidth: "+this.wireframe_linewidth+"<br/>wireframe_linecap: "+this.wireframe_linecap+"<br/>wireframe_linejoin: "+this.wireframe_linejoin+"<br/>vertex_colors: "+this.vertex_colors+"<br/>skinning: "+this.skinning+"<br/>)"}};THREE.MeshShaderMaterialCounter={value:0};
|
|
|
|
+THREE.ParticleBasicMaterial=function(a){this.id=THREE.ParticleBasicMaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.map=null;this.size=1;this.blending=THREE.NormalBlending;this.depth_test=!0;this.offset=new THREE.Vector2;this.vertex_colors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.map!==undefined)this.map=a.map;if(a.size!==undefined)this.size=a.size;if(a.blending!==undefined)this.blending=a.blending;
|
|
if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.ParticleBasicMaterialCounter={value:0};
|
|
if(a.depth_test!==undefined)this.depth_test=a.depth_test;if(a.vertex_colors!==undefined)this.vertex_colors=a.vertex_colors}};THREE.ParticleBasicMaterial.prototype={toString:function(){return"THREE.ParticleBasicMaterial (<br/>id: "+this.id+"<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>map: "+this.map+"<br/>size: "+this.size+"<br/>blending: "+this.blending+"<br/>depth_test: "+this.depth_test+"<br/>vertex_colors: "+this.vertex_colors+"<br/>)"}};THREE.ParticleBasicMaterialCounter={value:0};
|
|
THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
|
|
THREE.ParticleCircleMaterial=function(a){this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending}};THREE.ParticleCircleMaterial.prototype={toString:function(){return"THREE.ParticleCircleMaterial (<br/>color: "+this.color+"<br/>opacity: "+this.opacity+"<br/>blending: "+this.blending+"<br/>)"}};
|
|
-THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,c,e,g,i,k){this.image=a;this.mapping=c!==undefined?c:new THREE.UVMapping;this.wrap_s=e!==undefined?e:THREE.ClampToEdgeWrapping;this.wrap_t=g!==undefined?g:THREE.ClampToEdgeWrapping;this.mag_filter=i!==undefined?i:THREE.LinearFilter;this.min_filter=k!==undefined?k:THREE.LinearMipMapLinearFilter};
|
|
|
|
|
|
+THREE.ParticleDOMMaterial=function(a){this.domElement=a};THREE.ParticleDOMMaterial.prototype={toString:function(){return"THREE.ParticleDOMMaterial ( domElement: "+this.domElement+" )"}};THREE.Texture=function(a,b,c,e,g,h){this.image=a;this.mapping=b!==undefined?b:new THREE.UVMapping;this.wrap_s=c!==undefined?c:THREE.ClampToEdgeWrapping;this.wrap_t=e!==undefined?e:THREE.ClampToEdgeWrapping;this.mag_filter=g!==undefined?g:THREE.LinearFilter;this.min_filter=h!==undefined?h:THREE.LinearMipMapLinearFilter};
|
|
THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;
|
|
THREE.Texture.prototype={clone:function(){return new THREE.Texture(this.image,this.mapping,this.wrap_s,this.wrap_t,this.mag_filter,this.min_filter)},toString:function(){return"THREE.Texture (<br/>image: "+this.image+"<br/>wrap_s: "+this.wrap_s+"<br/>wrap_t: "+this.wrap_t+"<br/>mag_filter: "+this.mag_filter+"<br/>min_filter: "+this.min_filter+"<br/>)"}};THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;
|
|
THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
|
|
THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;
|
|
-THREE.RenderTarget=function(a,c,e){this.width=a;this.height=c;e=e||{};this.wrap_s=e.wrap_s!==undefined?e.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=e.wrap_t!==undefined?e.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=e.mag_filter!==undefined?e.mag_filter:THREE.LinearFilter;this.min_filter=e.min_filter!==undefined?e.min_filter:THREE.LinearMipMapLinearFilter;this.format=e.format!==undefined?e.format:THREE.RGBFormat;this.type=e.type!==undefined?e.type:THREE.UnsignedByteType};
|
|
|
|
-var Uniforms={clone:function(a){var c,e,g,i={};for(c in a){i[c]={};for(e in a[c]){g=a[c][e];i[c][e]=g instanceof THREE.Color||g instanceof THREE.Vector3||g instanceof THREE.Texture?g.clone():g}}return i},merge:function(a){var c,e,g,i={};for(c=0;c<a.length;c++){g=this.clone(a[c]);for(e in g)i[e]=g[e]}return i}};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
|
|
-THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
|
|
|
|
-THREE.Scene=function(){this.objects=[];this.lights=[];this.fog=null;this.addObject=function(a){this.objects.indexOf(a)===-1&&this.objects.push(a)};this.removeObject=function(a){a=this.objects.indexOf(a);a!==-1&&this.objects.splice(a,1)};this.addLight=function(a){this.lights.indexOf(a)===-1&&this.lights.push(a)};this.removeLight=function(a){a=this.lights.indexOf(a);a!==-1&&this.lights.splice(a,1)};this.toString=function(){return"THREE.Scene ( "+this.objects+" )"}};
|
|
|
|
-THREE.Fog=function(a,c,e){this.color=new THREE.Color(a);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c||2.5E-4};
|
|
|
|
-THREE.Projector=function(){function a(P,J){return J.z-P.z}function c(P,J){var W=0,M=1,R=P.z+P.w,K=J.z+J.w,C=-P.z+P.w,L=-J.z+J.w;if(R>=0&&K>=0&&C>=0&&L>=0)return true;else if(R<0&&K<0||C<0&&L<0)return false;else{if(R<0)W=Math.max(W,R/(R-K));else if(K<0)M=Math.min(M,R/(R-K));if(C<0)W=Math.max(W,C/(C-L));else if(L<0)M=Math.min(M,C/(C-L));if(M<W)return false;else{P.lerpSelf(J,W);J.lerpSelf(P,1-M);return true}}}var e,g,i=[],k,q,p,l=[],m,z,A=[],t,y,D=[],H=new THREE.Vector4,G=new THREE.Vector4,r=new THREE.Matrix4,
|
|
|
|
-S=new THREE.Matrix4,B=[],I=new THREE.Vector4,b=new THREE.Vector4,aa;this.projectObjects=function(P,J,W){var M=[],R,K;g=0;r.multiply(J.projectionMatrix,J.matrix);B[0]=new THREE.Vector4(r.n41-r.n11,r.n42-r.n12,r.n43-r.n13,r.n44-r.n14);B[1]=new THREE.Vector4(r.n41+r.n11,r.n42+r.n12,r.n43+r.n13,r.n44+r.n14);B[2]=new THREE.Vector4(r.n41+r.n21,r.n42+r.n22,r.n43+r.n23,r.n44+r.n24);B[3]=new THREE.Vector4(r.n41-r.n21,r.n42-r.n22,r.n43-r.n23,r.n44-r.n24);B[4]=new THREE.Vector4(r.n41-r.n31,r.n42-r.n32,r.n43-
|
|
|
|
-r.n33,r.n44-r.n34);B[5]=new THREE.Vector4(r.n41+r.n31,r.n42+r.n32,r.n43+r.n33,r.n44+r.n34);J=0;for(R=B.length;J<R;J++){K=B[J];K.divideScalar(Math.sqrt(K.x*K.x+K.y*K.y+K.z*K.z))}R=P.objects;P=0;for(J=R.length;P<J;P++){K=R[P];var C;if(!(C=!K.visible)){if(C=K instanceof THREE.Mesh){a:{C=void 0;for(var L=K.position,ba=-K.geometry.boundingSphere.radius*Math.max(K.scale.x,Math.max(K.scale.y,K.scale.z)),N=0;N<6;N++){C=B[N].x*L.x+B[N].y*L.y+B[N].z*L.z+B[N].w;if(C<=ba){C=false;break a}}C=true}C=!C}C=C}if(!C){e=
|
|
|
|
-i[g]=i[g]||new THREE.RenderableObject;H.copy(K.position);r.multiplyVector3(H);e.object=K;e.z=H.z;M.push(e);g++}}W&&M.sort(a);return M};this.projectScene=function(P,J,W){var M=[],R=J.near,K=J.far,C,L,ba,N,da,ca,d,j,o,h,f,v,u,n,w,s;p=z=y=0;J.autoUpdateMatrix&&J.updateMatrix();r.multiply(J.projectionMatrix,J.matrix);ca=this.projectObjects(P,J,true);P=0;for(C=ca.length;P<C;P++){d=ca[P].object;if(d.visible){d.autoUpdateMatrix&&d.updateMatrix();j=d.matrix;o=d.rotationMatrix;h=d.materials;f=d.overdraw;if(d instanceof
|
|
|
|
-THREE.Mesh){v=d.geometry;u=v.vertices;L=0;for(ba=u.length;L<ba;L++){n=u[L];n.positionWorld.copy(n.position);j.multiplyVector3(n.positionWorld);N=n.positionScreen;N.copy(n.positionWorld);r.multiplyVector4(N);N.x/=N.w;N.y/=N.w;n.__visible=N.z>R&&N.z<K}v=v.faces;L=0;for(ba=v.length;L<ba;L++){n=v[L];if(n instanceof THREE.Face3){N=u[n.a];da=u[n.b];w=u[n.c];if(N.__visible&&da.__visible&&w.__visible)if(d.doubleSided||d.flipSided!=(w.positionScreen.x-N.positionScreen.x)*(da.positionScreen.y-N.positionScreen.y)-
|
|
|
|
-(w.positionScreen.y-N.positionScreen.y)*(da.positionScreen.x-N.positionScreen.x)<0){k=l[p]=l[p]||new THREE.RenderableFace3;k.v1.positionWorld.copy(N.positionWorld);k.v2.positionWorld.copy(da.positionWorld);k.v3.positionWorld.copy(w.positionWorld);k.v1.positionScreen.copy(N.positionScreen);k.v2.positionScreen.copy(da.positionScreen);k.v3.positionScreen.copy(w.positionScreen);k.normalWorld.copy(n.normal);o.multiplyVector3(k.normalWorld);k.centroidWorld.copy(n.centroid);j.multiplyVector3(k.centroidWorld);
|
|
|
|
-k.centroidScreen.copy(k.centroidWorld);r.multiplyVector3(k.centroidScreen);w=n.vertexNormals;aa=k.vertexNormalsWorld;N=0;for(da=w.length;N<da;N++){s=aa[N]=aa[N]||new THREE.Vector3;s.copy(w[N]);o.multiplyVector3(s)}k.z=k.centroidScreen.z;k.meshMaterials=h;k.faceMaterials=n.materials;k.overdraw=f;if(d.geometry.uvs[L]){k.uvs[0]=d.geometry.uvs[L][0];k.uvs[1]=d.geometry.uvs[L][1];k.uvs[2]=d.geometry.uvs[L][2]}M.push(k);p++}}else if(n instanceof THREE.Face4){N=u[n.a];da=u[n.b];w=u[n.c];s=u[n.d];if(N.__visible&&
|
|
|
|
-da.__visible&&w.__visible&&s.__visible)if(d.doubleSided||d.flipSided!=((s.positionScreen.x-N.positionScreen.x)*(da.positionScreen.y-N.positionScreen.y)-(s.positionScreen.y-N.positionScreen.y)*(da.positionScreen.x-N.positionScreen.x)<0||(da.positionScreen.x-w.positionScreen.x)*(s.positionScreen.y-w.positionScreen.y)-(da.positionScreen.y-w.positionScreen.y)*(s.positionScreen.x-w.positionScreen.x)<0)){k=l[p]=l[p]||new THREE.RenderableFace3;k.v1.positionWorld.copy(N.positionWorld);k.v2.positionWorld.copy(da.positionWorld);
|
|
|
|
-k.v3.positionWorld.copy(s.positionWorld);k.v1.positionScreen.copy(N.positionScreen);k.v2.positionScreen.copy(da.positionScreen);k.v3.positionScreen.copy(s.positionScreen);k.normalWorld.copy(n.normal);o.multiplyVector3(k.normalWorld);k.centroidWorld.copy(n.centroid);j.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);r.multiplyVector3(k.centroidScreen);k.z=k.centroidScreen.z;k.meshMaterials=h;k.faceMaterials=n.materials;k.overdraw=f;if(d.geometry.uvs[L]){k.uvs[0]=d.geometry.uvs[L][0];
|
|
|
|
-k.uvs[1]=d.geometry.uvs[L][1];k.uvs[2]=d.geometry.uvs[L][3]}M.push(k);p++;q=l[p]=l[p]||new THREE.RenderableFace3;q.v1.positionWorld.copy(da.positionWorld);q.v2.positionWorld.copy(w.positionWorld);q.v3.positionWorld.copy(s.positionWorld);q.v1.positionScreen.copy(da.positionScreen);q.v2.positionScreen.copy(w.positionScreen);q.v3.positionScreen.copy(s.positionScreen);q.normalWorld.copy(k.normalWorld);q.centroidWorld.copy(k.centroidWorld);q.centroidScreen.copy(k.centroidScreen);q.z=q.centroidScreen.z;
|
|
|
|
-q.meshMaterials=h;q.faceMaterials=n.materials;q.overdraw=f;if(d.geometry.uvs[L]){q.uvs[0]=d.geometry.uvs[L][1];q.uvs[1]=d.geometry.uvs[L][2];q.uvs[2]=d.geometry.uvs[L][3]}M.push(q);p++}}}}else if(d instanceof THREE.Line){S.multiply(r,j);u=d.geometry.vertices;n=u[0];n.positionScreen.copy(n.position);S.multiplyVector4(n.positionScreen);L=1;for(ba=u.length;L<ba;L++){N=u[L];N.positionScreen.copy(N.position);S.multiplyVector4(N.positionScreen);da=u[L-1];I.copy(N.positionScreen);b.copy(da.positionScreen);
|
|
|
|
-if(c(I,b)){I.multiplyScalar(1/I.w);b.multiplyScalar(1/b.w);m=A[z]=A[z]||new THREE.RenderableLine;m.v1.positionScreen.copy(I);m.v2.positionScreen.copy(b);m.z=Math.max(I.z,b.z);m.materials=d.materials;M.push(m);z++}}}else if(d instanceof THREE.Particle){G.set(d.position.x,d.position.y,d.position.z,1);r.multiplyVector4(G);G.z/=G.w;if(G.z>0&&G.z<1){t=D[y]=D[y]||new THREE.RenderableParticle;t.x=G.x/G.w;t.y=G.y/G.w;t.z=G.z;t.rotation=d.rotation.z;t.scale.x=d.scale.x*Math.abs(t.x-(G.x+J.projectionMatrix.n11)/
|
|
|
|
-(G.w+J.projectionMatrix.n14));t.scale.y=d.scale.y*Math.abs(t.y-(G.y+J.projectionMatrix.n22)/(G.w+J.projectionMatrix.n24));t.materials=d.materials;M.push(t);y++}}}}W&&M.sort(a);return M};this.unprojectVector=function(P,J){var W=THREE.Matrix4.makeInvert(J.matrix);W.multiplySelf(THREE.Matrix4.makeInvert(J.projectionMatrix));W.multiplyVector3(P);return P}};
|
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,e,g,i,k;this.domElement=document.createElement("div");this.setSize=function(q,p){e=q;g=p;i=e/2;k=g/2};this.render=function(q,p){var l,m,z,A,t,y,D,H;a=c.projectScene(q,p);l=0;for(m=a.length;l<m;l++){t=a[l];if(t instanceof THREE.RenderableParticle){D=t.x*i+i;H=t.y*k+k;z=0;for(A=t.material.length;z<A;z++){y=t.material[z];if(y instanceof THREE.ParticleDOMMaterial){y=y.domElement;y.style.left=D+"px";y.style.top=H+"px"}}}}}};
|
|
|
|
-THREE.CanvasRenderer=function(){function a(V){if(t!=V)m.globalAlpha=t=V}function c(V){if(y!=V){switch(V){case THREE.NormalBlending:m.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:m.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:m.globalCompositeOperation="darker"}y=V}}var e=null,g=new THREE.Projector,i=document.createElement("canvas"),k,q,p,l,m=i.getContext("2d"),z=new THREE.Color(0),A=0,t=1,y=0,D=null,H=null,G=1,r,S,B,I,b,aa,P,J,W,M=new THREE.Color,
|
|
|
|
-R=new THREE.Color,K=new THREE.Color,C=new THREE.Color,L=new THREE.Color,ba,N,da,ca,d,j,o,h,f,v=new THREE.Rectangle,u=new THREE.Rectangle,n=new THREE.Rectangle,w=false,s=new THREE.Color,O=new THREE.Color,Y=new THREE.Color,ga=new THREE.Color,ia=Math.PI*2,U=new THREE.Vector3,ea,Z,qa,F,ua,oa,ra=16;ea=document.createElement("canvas");ea.width=ea.height=2;Z=ea.getContext("2d");Z.fillStyle="rgba(0,0,0,1)";Z.fillRect(0,0,2,2);qa=Z.getImageData(0,0,2,2);F=qa.data;ua=document.createElement("canvas");ua.width=
|
|
|
|
-ua.height=ra;oa=ua.getContext("2d");oa.translate(-ra/2,-ra/2);oa.scale(ra,ra);ra--;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=true;this.setSize=function(V,fa){k=V;q=fa;p=k/2;l=q/2;i.width=k;i.height=q;v.set(-p,-l,p,l);t=1;y=0;H=D=null;G=1};this.setClearColor=function(V,fa){z=V;A=fa;u.set(-p,-l,p,l);m.setTransform(1,0,0,-1,p,l);this.clear()};this.setClearColorHex=function(V,fa){z.setHex(V);A=fa;u.set(-p,-l,p,l);m.setTransform(1,0,0,-1,p,l);this.clear()};this.clear=function(){m.setTransform(1,
|
|
|
|
-0,0,-1,p,l);if(!u.isEmpty()){u.inflate(1);u.minSelf(v);if(z.hex==0&&A==0)m.clearRect(u.getX(),u.getY(),u.getWidth(),u.getHeight());else{c(THREE.NormalBlending);a(1);m.fillStyle="rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+Math.floor(z.b*255)+","+A+")";m.fillRect(u.getX(),u.getY(),u.getWidth(),u.getHeight())}u.empty()}};this.render=function(V,fa){function ja(x){var X,T,E,Q=x.lights;O.setRGB(0,0,0);Y.setRGB(0,0,0);ga.setRGB(0,0,0);x=0;for(X=Q.length;x<X;x++){T=Q[x];E=T.color;if(T instanceof
|
|
|
|
-THREE.AmbientLight){O.r+=E.r;O.g+=E.g;O.b+=E.b}else if(T instanceof THREE.DirectionalLight){Y.r+=E.r;Y.g+=E.g;Y.b+=E.b}else if(T instanceof THREE.PointLight){ga.r+=E.r;ga.g+=E.g;ga.b+=E.b}}}function za(x,X,T,E){var Q,$,pa,wa,ya=x.lights;x=0;for(Q=ya.length;x<Q;x++){$=ya[x];pa=$.color;wa=$.intensity;if($ instanceof THREE.DirectionalLight){$=T.dot($.position)*wa;if($>0){E.r+=pa.r*$;E.g+=pa.g*$;E.b+=pa.b*$}}else if($ instanceof THREE.PointLight){U.sub($.position,X);U.normalize();$=T.dot(U)*wa;if($>0){E.r+=
|
|
|
|
-pa.r*$;E.g+=pa.g*$;E.b+=pa.b*$}}}}function va(x,X,T){if(T.opacity!=0){a(T.opacity);c(T.blending);var E,Q,$,pa,wa,ya;if(T instanceof THREE.ParticleBasicMaterial){if(T.map&&T.map.image.loaded){pa=T.map.image;wa=pa.width>>1;ya=pa.height>>1;Q=X.scale.x*p;$=X.scale.y*l;T=Q*wa;E=$*ya;n.set(x.x-T,x.y-E,x.x+T,x.y+E);if(!v.instersects(n))return;m.save();m.translate(x.x,x.y);m.rotate(-X.rotation);m.scale(Q,-$);m.translate(-wa,-ya);m.drawImage(pa,0,0);m.restore()}m.beginPath();m.moveTo(x.x-10,x.y);m.lineTo(x.x+
|
|
|
|
-10,x.y);m.moveTo(x.x,x.y-10);m.lineTo(x.x,x.y+10);m.closePath();m.strokeStyle="rgb(255,255,0)";m.stroke()}else if(T instanceof THREE.ParticleCircleMaterial){if(w){s.r=O.r+Y.r+ga.r;s.g=O.g+Y.g+ga.g;s.b=O.b+Y.b+ga.b;M.r=T.color.r*s.r;M.g=T.color.g*s.g;M.b=T.color.b*s.b;M.updateStyleString()}else M.__styleString=T.color.__styleString;T=X.scale.x*p;E=X.scale.y*l;n.set(x.x-T,x.y-E,x.x+T,x.y+E);if(v.instersects(n)){Q=M.__styleString;if(H!=Q)m.fillStyle=H=Q;m.save();m.translate(x.x,x.y);m.rotate(-X.rotation);
|
|
|
|
-m.scale(T,E);m.beginPath();m.arc(0,0,1,0,ia,true);m.closePath();m.fill();m.restore()}}}}function ma(x,X,T,E){if(E.opacity!=0){a(E.opacity);c(E.blending);m.beginPath();m.moveTo(x.positionScreen.x,x.positionScreen.y);m.lineTo(X.positionScreen.x,X.positionScreen.y);m.closePath();if(E instanceof THREE.LineBasicMaterial){M.__styleString=E.color.__styleString;x=E.linewidth;if(G!=x)m.lineWidth=G=x;x=M.__styleString;if(D!=x)m.strokeStyle=D=x;m.stroke();n.inflate(E.linewidth*2)}}}function na(x,X,T,E,Q,$){if(Q.opacity!=
|
|
|
|
-0){a(Q.opacity);c(Q.blending);I=x.positionScreen.x;b=x.positionScreen.y;aa=X.positionScreen.x;P=X.positionScreen.y;J=T.positionScreen.x;W=T.positionScreen.y;m.beginPath();m.moveTo(I,b);m.lineTo(aa,P);m.lineTo(J,W);m.lineTo(I,b);m.closePath();if(Q instanceof THREE.MeshBasicMaterial)if(Q.map)Q.map.image.loaded&&Q.map.mapping instanceof THREE.UVMapping&&sa(I,b,aa,P,J,W,Q.map.image,E.uvs[0].u,E.uvs[0].v,E.uvs[1].u,E.uvs[1].v,E.uvs[2].u,E.uvs[2].v);else if(Q.env_map){if(Q.env_map.image.loaded)if(Q.env_map.mapping instanceof
|
|
|
|
-THREE.SphericalReflectionMapping){x=fa.matrix;U.copy(E.vertexNormalsWorld[0]);ca=(U.x*x.n11+U.y*x.n12+U.z*x.n13)*0.5+0.5;d=-(U.x*x.n21+U.y*x.n22+U.z*x.n23)*0.5+0.5;U.copy(E.vertexNormalsWorld[1]);j=(U.x*x.n11+U.y*x.n12+U.z*x.n13)*0.5+0.5;o=-(U.x*x.n21+U.y*x.n22+U.z*x.n23)*0.5+0.5;U.copy(E.vertexNormalsWorld[2]);h=(U.x*x.n11+U.y*x.n12+U.z*x.n13)*0.5+0.5;f=-(U.x*x.n21+U.y*x.n22+U.z*x.n23)*0.5+0.5;sa(I,b,aa,P,J,W,Q.env_map.image,ca,d,j,o,h,f)}}else Q.wireframe?Ea(Q.color.__styleString,Q.wireframe_linewidth):
|
|
|
|
-Fa(Q.color.__styleString);else if(Q instanceof THREE.MeshLambertMaterial){if(Q.map&&!Q.wireframe){Q.map.mapping instanceof THREE.UVMapping&&sa(I,b,aa,P,J,W,Q.map.image,E.uvs[0].u,E.uvs[0].v,E.uvs[1].u,E.uvs[1].v,E.uvs[2].u,E.uvs[2].v);c(THREE.SubtractiveBlending)}if(w)if(!Q.wireframe&&Q.shading==THREE.SmoothShading&&E.vertexNormalsWorld.length==3){R.r=K.r=C.r=O.r;R.g=K.g=C.g=O.g;R.b=K.b=C.b=O.b;za($,E.v1.positionWorld,E.vertexNormalsWorld[0],R);za($,E.v2.positionWorld,E.vertexNormalsWorld[1],K);za($,
|
|
|
|
-E.v3.positionWorld,E.vertexNormalsWorld[2],C);L.r=(K.r+C.r)*0.5;L.g=(K.g+C.g)*0.5;L.b=(K.b+C.b)*0.5;da=ha(R,K,C,L);sa(I,b,aa,P,J,W,da,0,0,1,0,0,1)}else{s.r=O.r;s.g=O.g;s.b=O.b;za($,E.centroidWorld,E.normalWorld,s);M.r=Q.color.r*s.r;M.g=Q.color.g*s.g;M.b=Q.color.b*s.b;M.updateStyleString();Q.wireframe?Ea(M.__styleString,Q.wireframe_linewidth):Fa(M.__styleString)}else Q.wireframe?Ea(Q.color.__styleString,Q.wireframe_linewidth):Fa(Q.color.__styleString)}else if(Q instanceof THREE.MeshDepthMaterial){ba=
|
|
|
|
-fa.near;N=fa.far;R.r=R.g=R.b=1-la(x.positionScreen.z,ba,N);K.r=K.g=K.b=1-la(X.positionScreen.z,ba,N);C.r=C.g=C.b=1-la(T.positionScreen.z,ba,N);L.r=(K.r+C.r)*0.5;L.g=(K.g+C.g)*0.5;L.b=(K.b+C.b)*0.5;da=ha(R,K,C,L);sa(I,b,aa,P,J,W,da,0,0,1,0,0,1)}else if(Q instanceof THREE.MeshNormalMaterial){M.r=Aa(E.normalWorld.x);M.g=Aa(E.normalWorld.y);M.b=Aa(E.normalWorld.z);M.updateStyleString();Q.wireframe?Ea(M.__styleString,Q.wireframe_linewidth):Fa(M.__styleString)}}}function Ea(x,X){if(D!=x)m.strokeStyle=D=
|
|
|
|
-x;if(G!=X)m.lineWidth=G=X;m.stroke();n.inflate(X*2)}function Fa(x){if(H!=x)m.fillStyle=H=x;m.fill()}function sa(x,X,T,E,Q,$,pa,wa,ya,Ha,Da,Ia,Oa){var Ga,Ja;Ga=pa.width-1;Ja=pa.height-1;wa*=Ga;ya*=Ja;Ha*=Ga;Da*=Ja;Ia*=Ga;Oa*=Ja;T-=x;E-=X;Q-=x;$-=X;Ha-=wa;Da-=ya;Ia-=wa;Oa-=ya;Ga=Ha*Oa-Ia*Da;if(Ga!=0){Ja=1/Ga;Ga=(Oa*T-Da*Q)*Ja;Da=(Oa*E-Da*$)*Ja;T=(Ha*Q-Ia*T)*Ja;E=(Ha*$-Ia*E)*Ja;x=x-Ga*wa-T*ya;X=X-Da*wa-E*ya;m.save();m.transform(Ga,Da,T,E,x,X);m.clip();m.drawImage(pa,0,0);m.restore()}}function ha(x,X,
|
|
|
|
-T,E){var Q=~~(x.r*255),$=~~(x.g*255);x=~~(x.b*255);var pa=~~(X.r*255),wa=~~(X.g*255);X=~~(X.b*255);var ya=~~(T.r*255),Ha=~~(T.g*255);T=~~(T.b*255);var Da=~~(E.r*255),Ia=~~(E.g*255);E=~~(E.b*255);F[0]=Q<0?0:Q>255?255:Q;F[1]=$<0?0:$>255?255:$;F[2]=x<0?0:x>255?255:x;F[4]=pa<0?0:pa>255?255:pa;F[5]=wa<0?0:wa>255?255:wa;F[6]=X<0?0:X>255?255:X;F[8]=ya<0?0:ya>255?255:ya;F[9]=Ha<0?0:Ha>255?255:Ha;F[10]=T<0?0:T>255?255:T;F[12]=Da<0?0:Da>255?255:Da;F[13]=Ia<0?0:Ia>255?255:Ia;F[14]=E<0?0:E>255?255:E;Z.putImageData(qa,
|
|
|
|
-0,0);oa.drawImage(ea,0,0);return ua}function la(x,X,T){x=(x-X)/(T-X);return x*x*(3-2*x)}function Aa(x){x=(x+1)*0.5;return x<0?0:x>1?1:x}function ta(x,X){var T=X.x-x.x,E=X.y-x.y,Q=1/Math.sqrt(T*T+E*E);T*=Q;E*=Q;X.x+=T;X.y+=E;x.x-=T;x.y-=E}var La,xa,ka,Ba,Ca,Ma,Na,Ka;this.autoClear?this.clear():m.setTransform(1,0,0,-1,p,l);e=g.projectScene(V,fa,this.sortElements);m.fillStyle="rgba( 0, 255, 255, 0.5 )";m.fillRect(v.getX(),v.getY(),v.getWidth(),v.getHeight());(w=V.lights.length>0)&&ja(V);La=0;for(xa=
|
|
|
|
-e.length;La<xa;La++){ka=e[La];n.empty();if(ka instanceof THREE.RenderableParticle){r=ka;r.x*=p;r.y*=l;Ba=0;for(Ca=ka.materials.length;Ba<Ca;Ba++)va(r,ka,ka.materials[Ba],V)}else if(ka instanceof THREE.RenderableLine){r=ka.v1;S=ka.v2;r.positionScreen.x*=p;r.positionScreen.y*=l;S.positionScreen.x*=p;S.positionScreen.y*=l;n.addPoint(r.positionScreen.x,r.positionScreen.y);n.addPoint(S.positionScreen.x,S.positionScreen.y);if(v.instersects(n)){Ba=0;for(Ca=ka.materials.length;Ba<Ca;)ma(r,S,ka,ka.materials[Ba++],
|
|
|
|
-V)}}else if(ka instanceof THREE.RenderableFace3){r=ka.v1;S=ka.v2;B=ka.v3;r.positionScreen.x*=p;r.positionScreen.y*=l;S.positionScreen.x*=p;S.positionScreen.y*=l;B.positionScreen.x*=p;B.positionScreen.y*=l;if(ka.overdraw){ta(r.positionScreen,S.positionScreen);ta(S.positionScreen,B.positionScreen);ta(B.positionScreen,r.positionScreen)}n.add3Points(r.positionScreen.x,r.positionScreen.y,S.positionScreen.x,S.positionScreen.y,B.positionScreen.x,B.positionScreen.y);if(v.instersects(n)){Ba=0;for(Ca=ka.meshMaterials.length;Ba<
|
|
|
|
-Ca;){Ka=ka.meshMaterials[Ba++];if(Ka instanceof THREE.MeshFaceMaterial){Ma=0;for(Na=ka.faceMaterials.length;Ma<Na;)(Ka=ka.faceMaterials[Ma++])&&na(r,S,B,ka,Ka,V)}else na(r,S,B,ka,Ka,V)}}}u.addRectangle(n)}m.lineWidth=1;m.strokeStyle="rgba( 255, 0, 0, 0.5 )";m.strokeRect(u.getX(),u.getY(),u.getWidth(),u.getHeight());m.setTransform(1,0,0,1,0,0)}};
|
|
|
|
-THREE.SVGRenderer=function(){function a(ca,d,j){var o,h,f,v;o=0;for(h=ca.lights.length;o<h;o++){f=ca.lights[o];if(f instanceof THREE.DirectionalLight){v=d.normalWorld.dot(f.position)*f.intensity;if(v>0){j.r+=f.color.r*v;j.g+=f.color.g*v;j.b+=f.color.b*v}}else if(f instanceof THREE.PointLight){W.sub(f.position,d.centroidWorld);W.normalize();v=d.normalWorld.dot(W)*f.intensity;if(v>0){j.r+=f.color.r*v;j.g+=f.color.g*v;j.b+=f.color.b*v}}}}function c(ca,d,j,o,h,f){C=g(L++);C.setAttribute("d","M "+ca.positionScreen.x+
|
|
|
|
-" "+ca.positionScreen.y+" L "+d.positionScreen.x+" "+d.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");if(h instanceof THREE.MeshBasicMaterial)B.__styleString=h.color.__styleString;else if(h instanceof THREE.MeshLambertMaterial)if(S){I.r=b.r;I.g=b.g;I.b=b.b;a(f,o,I);B.r=h.color.r*I.r;B.g=h.color.g*I.g;B.b=h.color.b*I.b;B.updateStyleString()}else B.__styleString=h.color.__styleString;else if(h instanceof THREE.MeshDepthMaterial){J=1-h.__2near/(h.__farPlusNear-o.z*h.__farMinusNear);
|
|
|
|
-B.setRGB(J,J,J)}else h instanceof THREE.MeshNormalMaterial&&B.setRGB(i(o.normalWorld.x),i(o.normalWorld.y),i(o.normalWorld.z));h.wireframe?C.setAttribute("style","fill: none; stroke: "+B.__styleString+"; stroke-width: "+h.wireframe_linewidth+"; stroke-opacity: "+h.opacity+"; stroke-linecap: "+h.wireframe_linecap+"; stroke-linejoin: "+h.wireframe_linejoin):C.setAttribute("style","fill: "+B.__styleString+"; fill-opacity: "+h.opacity);p.appendChild(C)}function e(ca,d,j,o,h,f,v){C=g(L++);C.setAttribute("d",
|
|
|
|
-"M "+ca.positionScreen.x+" "+ca.positionScreen.y+" L "+d.positionScreen.x+" "+d.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");if(f instanceof THREE.MeshBasicMaterial)B.__styleString=f.color.__styleString;else if(f instanceof THREE.MeshLambertMaterial)if(S){I.r=b.r;I.g=b.g;I.b=b.b;a(v,h,I);B.r=f.color.r*I.r;B.g=f.color.g*I.g;B.b=f.color.b*I.b;B.updateStyleString()}else B.__styleString=f.color.__styleString;else if(f instanceof
|
|
|
|
-THREE.MeshDepthMaterial){J=1-f.__2near/(f.__farPlusNear-h.z*f.__farMinusNear);B.setRGB(J,J,J)}else f instanceof THREE.MeshNormalMaterial&&B.setRGB(i(h.normalWorld.x),i(h.normalWorld.y),i(h.normalWorld.z));f.wireframe?C.setAttribute("style","fill: none; stroke: "+B.__styleString+"; stroke-width: "+f.wireframe_linewidth+"; stroke-opacity: "+f.opacity+"; stroke-linecap: "+f.wireframe_linecap+"; stroke-linejoin: "+f.wireframe_linejoin):C.setAttribute("style","fill: "+B.__styleString+"; fill-opacity: "+
|
|
|
|
-f.opacity);p.appendChild(C)}function g(ca){if(M[ca]==null){M[ca]=document.createElementNS("http://www.w3.org/2000/svg","path");da==0&&M[ca].setAttribute("shape-rendering","crispEdges");return M[ca]}return M[ca]}function i(ca){return ca<0?Math.min((1+ca)*0.5,0.5):0.5+Math.min(ca*0.5,0.5)}var k=null,q=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,m,z,A,t,y,D,H,G=new THREE.Rectangle,r=new THREE.Rectangle,S=false,B=new THREE.Color(16777215),I=new THREE.Color(16777215),
|
|
|
|
-b=new THREE.Color(0),aa=new THREE.Color(0),P=new THREE.Color(0),J,W=new THREE.Vector3,M=[],R=[],K=[],C,L,ba,N,da=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=true;this.setQuality=function(ca){switch(ca){case "high":da=1;break;case "low":da=0}};this.setSize=function(ca,d){l=ca;m=d;z=l/2;A=m/2;p.setAttribute("viewBox",-z+" "+-A+" "+l+" "+m);p.setAttribute("width",l);p.setAttribute("height",m);G.set(-z,-A,z,A)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};
|
|
|
|
-this.render=function(ca,d){var j,o,h,f,v,u,n,w;this.autoClear&&this.clear();k=q.projectScene(ca,d,this.sortElements);N=ba=L=0;if(S=ca.lights.length>0){n=ca.lights;b.setRGB(0,0,0);aa.setRGB(0,0,0);P.setRGB(0,0,0);j=0;for(o=n.length;j<o;j++){h=n[j];f=h.color;if(h instanceof THREE.AmbientLight){b.r+=f.r;b.g+=f.g;b.b+=f.b}else if(h instanceof THREE.DirectionalLight){aa.r+=f.r;aa.g+=f.g;aa.b+=f.b}else if(h instanceof THREE.PointLight){P.r+=f.r;P.g+=f.g;P.b+=f.b}}}j=0;for(o=k.length;j<o;j++){n=k[j];r.empty();
|
|
|
|
-if(n instanceof THREE.RenderableParticle){t=n;t.x*=z;t.y*=-A;h=0;for(f=n.materials.length;h<f;h++)if(w=n.materials[h]){v=t;u=n;w=w;var s=ba++;if(R[s]==null){R[s]=document.createElementNS("http://www.w3.org/2000/svg","circle");da==0&&R[s].setAttribute("shape-rendering","crispEdges")}C=R[s];C.setAttribute("cx",v.x);C.setAttribute("cy",v.y);C.setAttribute("r",u.scale.x*z);if(w instanceof THREE.ParticleCircleMaterial){if(S){I.r=b.r+aa.r+P.r;I.g=b.g+aa.g+P.g;I.b=b.b+aa.b+P.b;B.r=w.color.r*I.r;B.g=w.color.g*
|
|
|
|
-I.g;B.b=w.color.b*I.b;B.updateStyleString()}else B=w.color;C.setAttribute("style","fill: "+B.__styleString)}p.appendChild(C)}}else if(n instanceof THREE.RenderableLine){t=n.v1;y=n.v2;t.positionScreen.x*=z;t.positionScreen.y*=-A;y.positionScreen.x*=z;y.positionScreen.y*=-A;r.addPoint(t.positionScreen.x,t.positionScreen.y);r.addPoint(y.positionScreen.x,y.positionScreen.y);if(G.instersects(r)){h=0;for(f=n.materials.length;h<f;)if(w=n.materials[h++]){v=t;u=y;w=w;s=N++;if(K[s]==null){K[s]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
-"line");da==0&&K[s].setAttribute("shape-rendering","crispEdges")}C=K[s];C.setAttribute("x1",v.positionScreen.x);C.setAttribute("y1",v.positionScreen.y);C.setAttribute("x2",u.positionScreen.x);C.setAttribute("y2",u.positionScreen.y);if(w instanceof THREE.LineBasicMaterial){B.__styleString=w.color.__styleString;C.setAttribute("style","fill: none; stroke: "+B.__styleString+"; stroke-width: "+w.linewidth+"; stroke-opacity: "+w.opacity+"; stroke-linecap: "+w.linecap+"; stroke-linejoin: "+w.linejoin);p.appendChild(C)}}}}else if(n instanceof
|
|
|
|
-THREE.RenderableFace3){t=n.v1;y=n.v2;D=n.v3;t.positionScreen.x*=z;t.positionScreen.y*=-A;y.positionScreen.x*=z;y.positionScreen.y*=-A;D.positionScreen.x*=z;D.positionScreen.y*=-A;r.addPoint(t.positionScreen.x,t.positionScreen.y);r.addPoint(y.positionScreen.x,y.positionScreen.y);r.addPoint(D.positionScreen.x,D.positionScreen.y);if(G.instersects(r)){h=0;for(f=n.meshMaterials.length;h<f;){w=n.meshMaterials[h++];if(w instanceof THREE.MeshFaceMaterial){v=0;for(u=n.faceMaterials.length;v<u;)(w=n.faceMaterials[v++])&&
|
|
|
|
-c(t,y,D,n,w,ca)}else w&&c(t,y,D,n,w,ca)}}}else if(n instanceof THREE.RenderableFace4){t=n.v1;y=n.v2;D=n.v3;H=n.v4;t.positionScreen.x*=z;t.positionScreen.y*=-A;y.positionScreen.x*=z;y.positionScreen.y*=-A;D.positionScreen.x*=z;D.positionScreen.y*=-A;H.positionScreen.x*=z;H.positionScreen.y*=-A;r.addPoint(t.positionScreen.x,t.positionScreen.y);r.addPoint(y.positionScreen.x,y.positionScreen.y);r.addPoint(D.positionScreen.x,D.positionScreen.y);r.addPoint(H.positionScreen.x,H.positionScreen.y);if(G.instersects(r)){h=
|
|
|
|
-0;for(f=n.meshMaterials.length;h<f;){w=n.meshMaterials[h++];if(w instanceof THREE.MeshFaceMaterial){v=0;for(u=n.faceMaterials.length;v<u;)(w=n.faceMaterials[v++])&&e(t,y,D,H,n,w,ca)}else w&&e(t,y,D,H,n,w,ca)}}}}}};
|
|
|
|
-THREE.WebGLRenderer=function(a){function c(d,j,o){var h,f,v,u=d.vertices,n=u.length,w=d.colors,s=w.length,O=d.__vertexArray,Y=d.__colorArray,ga=d.__sortArray,ia=d.__dirtyVertices,U=d.__dirtyColors;if(o.sortParticles){K.multiplySelf(o.matrixWorld);for(h=0;h<n;h++){f=u[h].position;ba.copy(f);K.multiplyVector3(ba);ga[h]=[ba.z,h]}ga.sort(function(ea,Z){return Z[0]-ea[0]});for(h=0;h<n;h++){f=u[ga[h][1]].position;v=h*3;O[v]=f.x;O[v+1]=f.y;O[v+2]=f.z}for(h=0;h<s;h++){v=h*3;color=w[ga[h][1]];Y[v]=color.r;
|
|
|
|
-Y[v+1]=color.g;Y[v+2]=color.b}}else{if(ia)for(h=0;h<n;h++){f=u[h].position;v=h*3;O[v]=f.x;O[v+1]=f.y;O[v+2]=f.z}if(U)for(h=0;h<s;h++){color=w[h];v=h*3;Y[v]=color.r;Y[v+1]=color.g;Y[v+2]=color.b}}if(ia||o.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,d.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,O,j)}if(U||o.sortParticles){b.bindBuffer(b.ARRAY_BUFFER,d.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,Y,j)}}function e(d,j){d.fragment_shader=j.fragment_shader;d.vertex_shader=j.vertex_shader;d.uniforms=
|
|
|
|
-Uniforms.clone(j.uniforms)}function g(d,j){if(!d.__webGLVertexBuffer)d.__webGLVertexBuffer=b.createBuffer();if(!d.__webGLNormalBuffer)d.__webGLNormalBuffer=b.createBuffer();if(d.hasPos){b.bindBuffer(b.ARRAY_BUFFER,d.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.positionArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(j.attributes.position);b.vertexAttribPointer(j.attributes.position,3,b.FLOAT,false,0,0)}if(d.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,d.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,
|
|
|
|
-d.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(j.attributes.normal);b.vertexAttribPointer(j.attributes.normal,3,b.FLOAT,false,0,0)}b.drawArrays(b.TRIANGLES,0,d.count);d.count=0}function i(d){if(J!=d.doubleSided){d.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);J=d.doubleSided}if(W!=d.flipSided){d.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);W=d.flipSided}}function k(d){R[0].set(d.n41-d.n11,d.n42-d.n12,d.n43-d.n13,d.n44-d.n14);R[1].set(d.n41+d.n11,d.n42+d.n12,d.n43+d.n13,d.n44+
|
|
|
|
-d.n14);R[2].set(d.n41+d.n21,d.n42+d.n22,d.n43+d.n23,d.n44+d.n24);R[3].set(d.n41-d.n21,d.n42-d.n22,d.n43-d.n23,d.n44-d.n24);R[4].set(d.n41-d.n31,d.n42-d.n32,d.n43-d.n33,d.n44-d.n34);R[5].set(d.n41+d.n31,d.n42+d.n32,d.n43+d.n33,d.n44+d.n34);var j;for(d=0;d<5;d++){j=R[d];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z*j.z))}}function q(d){for(var j=d.matrix,o=-d.geometry.boundingSphere.radius*Math.max(d.scale.x,Math.max(d.scale.y,d.scale.z)),h=0;h<6;h++){d=R[h].x*j.n14+R[h].y*j.n24+R[h].z*j.n34+R[h].w;
|
|
|
|
-if(d<=o)return false}return true}function p(d,j){d.list[d.count]=j;d.count+=1}function l(d){var j,o,h=d.object,f=d.opaque,v=d.transparent;v.count=0;d=f.count=0;for(j=h.materials.length;d<j;d++){o=h.materials[d];o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?p(v,o):p(f,o)}}function m(d){var j,o,h,f,v=d.object,u=d.buffer,n=d.opaque,w=d.transparent;w.count=0;d=n.count=0;for(h=v.materials.length;d<h;d++){j=v.materials[d];if(j instanceof THREE.MeshFaceMaterial){j=0;for(o=u.materials.length;j<
|
|
|
|
-o;j++)if(f=u.materials[j])f.opacity&&f.opacity<1||f.blending!=THREE.NormalBlending?p(w,f):p(n,f)}else{f=j;f.opacity&&f.opacity<1||f.blending!=THREE.NormalBlending?p(w,f):p(n,f)}}}function z(d){var j,o,h,f=d.children;j=0;for(o=f.length;j<o;j++){h=f[j];h.autoUpdateMatrix&&h.updateMatrix();h.matrixWorld.multiply(d.matrixWorld,h.matrix);z(h)}}function A(d,j){return j.z-d.z}function t(d,j){var o,h,f=j.children;o=0;for(h=f.length;o<h;o++){child=f[o];y(d,child,false);t(d,child)}}function y(d,j,o){var h,
|
|
|
|
-f,v;f=j.geometry;if(d.__webGLObjectsMap[j.id]==undefined){d.__webGLObjectsMap[j.id]={};j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);j._objectMatrixArray=new Float32Array(16);j.matrix.flattenToArray(j._objectMatrixArray)}v=d.__webGLObjectsMap[j.id];objlist=d.__webGLObjects;if(j instanceof THREE.Mesh){for(h in f.geometryChunks){d=f.geometryChunks[h];if(!d.__webGLVertexBuffer){var u=d;u.__webGLVertexBuffer=b.createBuffer();
|
|
|
|
-u.__webGLNormalBuffer=b.createBuffer();u.__webGLTangentBuffer=b.createBuffer();u.__webGLColorBuffer=b.createBuffer();u.__webGLUVBuffer=b.createBuffer();u.__webGLUV2Buffer=b.createBuffer();u.__webGLFaceBuffer=b.createBuffer();u.__webGLLineBuffer=b.createBuffer();u=d;var n=j,w=void 0,s=void 0,O=0,Y=0,ga=0,ia=n.geometry.faces,U=u.faces;w=0;for(s=U.length;w<s;w++){fi=U[w];face=ia[fi];if(face instanceof THREE.Face3){O+=3;Y+=1;ga+=3}else if(face instanceof THREE.Face4){O+=4;Y+=2;ga+=4}}u.__vertexArray=
|
|
|
|
-new Float32Array(O*3);u.__normalArray=new Float32Array(O*3);u.__tangentArray=new Float32Array(O*4);u.__colorArray=new Float32Array(O*3);u.__uvArray=new Float32Array(O*2);u.__uv2Array=new Float32Array(O*2);u.__faceArray=new Uint16Array(Y*3);u.__lineArray=new Uint16Array(ga*2);s=w=u;n=n;O=void 0;ia=void 0;var ea=void 0,Z=void 0;ea=void 0;U=false;O=0;for(ia=n.materials.length;O<ia;O++){ea=n.materials[O];if(ea instanceof THREE.MeshFaceMaterial){ea=0;for(Z=s.materials.length;ea<Z;ea++)if(s.materials[ea]&&
|
|
|
|
-s.materials[ea].shading!=undefined&&s.materials[ea].shading==THREE.SmoothShading){U=true;break}}else if(ea&&ea.shading!=undefined&&ea.shading==THREE.SmoothShading){U=true;break}if(U)break}w.__needsSmoothNormals=U;u.__webGLFaceCount=Y*3;u.__webGLLineCount=ga*2;f.__dirtyVertices=true;f.__dirtyElements=true;f.__dirtyUvs=true;f.__dirtyNormals=true;f.__dirtyTangents=true;f.__dirtyColors=true}if(f.__dirtyVertices||f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents){u=
|
|
|
|
-d;Y=b.DYNAMIC_DRAW;ga=void 0;w=void 0;var qa=void 0,F=void 0,ua=void 0,oa=void 0,ra=void 0;qa=void 0;var V=void 0,fa=void 0,ja=void 0,za=void 0;V=void 0;fa=void 0;ja=void 0;F=void 0;V=void 0;fa=void 0;ja=void 0;za=void 0;F=void 0;oa=void 0;ua=void 0;ra=void 0;var va=Z=ea=U=ia=O=n=s=0,ma=0,na=u.__vertexArray,Ea=u.__uvArray,Fa=u.__uv2Array,sa=u.__normalArray,ha=u.__tangentArray,la=u.__colorArray,Aa=u.__faceArray,ta=u.__lineArray,La=u.__needsSmoothNormals,xa=j.geometry,ka=xa.__dirtyVertices,Ba=xa.__dirtyElements,
|
|
|
|
-Ca=xa.__dirtyUvs,Ma=xa.__dirtyNormals,Na=xa.__dirtyTangents,Ka=xa.__dirtyColors,x=xa.vertices,X=u.faces,T=xa.faces,E=xa.uvs,Q=xa.uvs2,$=xa.colors;ga=0;for(w=X.length;ga<w;ga++){qa=X[ga];F=T[qa];ra=E[qa];qa=Q[qa];ua=F.vertexNormals;oa=F.normal;if(F instanceof THREE.Face3){if(ka){V=x[F.a].position;fa=x[F.b].position;ja=x[F.c].position;na[n]=V.x;na[n+1]=V.y;na[n+2]=V.z;na[n+3]=fa.x;na[n+4]=fa.y;na[n+5]=fa.z;na[n+6]=ja.x;na[n+7]=ja.y;na[n+8]=ja.z;n+=9}if(Ka&&$.length){V=$[F.a];fa=$[F.b];ja=$[F.c];la[ma]=
|
|
|
|
-V.r;la[ma+1]=V.g;la[ma+2]=V.b;la[ma+3]=fa.r;la[ma+4]=fa.g;la[ma+5]=fa.b;la[ma+6]=ja.r;la[ma+7]=ja.g;la[ma+8]=ja.b;ma+=9}if(Na&&xa.hasTangents){V=x[F.a].tangent;fa=x[F.b].tangent;ja=x[F.c].tangent;ha[Z]=V.x;ha[Z+1]=V.y;ha[Z+2]=V.z;ha[Z+3]=V.w;ha[Z+4]=fa.x;ha[Z+5]=fa.y;ha[Z+6]=fa.z;ha[Z+7]=fa.w;ha[Z+8]=ja.x;ha[Z+9]=ja.y;ha[Z+10]=ja.z;ha[Z+11]=ja.w;Z+=12}if(Ma)if(ua.length==3&&La)for(F=0;F<3;F++){oa=ua[F];sa[ea]=oa.x;sa[ea+1]=oa.y;sa[ea+2]=oa.z;ea+=3}else for(F=0;F<3;F++){sa[ea]=oa.x;sa[ea+1]=oa.y;sa[ea+
|
|
|
|
-2]=oa.z;ea+=3}if(Ca&&ra)for(F=0;F<3;F++){ua=ra[F];Ea[O]=ua.u;Ea[O+1]=ua.v;O+=2}if(Ca&&qa)for(F=0;F<3;F++){ra=qa[F];Fa[ia]=ra.u;Fa[ia+1]=ra.v;ia+=2}if(Ba){Aa[U]=s;Aa[U+1]=s+1;Aa[U+2]=s+2;U+=3;ta[va]=s;ta[va+1]=s+1;ta[va+2]=s;ta[va+3]=s+2;ta[va+4]=s+1;ta[va+5]=s+2;va+=6;s+=3}}else if(F instanceof THREE.Face4){if(ka){V=x[F.a].position;fa=x[F.b].position;ja=x[F.c].position;za=x[F.d].position;na[n]=V.x;na[n+1]=V.y;na[n+2]=V.z;na[n+3]=fa.x;na[n+4]=fa.y;na[n+5]=fa.z;na[n+6]=ja.x;na[n+7]=ja.y;na[n+8]=ja.z;
|
|
|
|
-na[n+9]=za.x;na[n+10]=za.y;na[n+11]=za.z;n+=12}if(Ka&&$.length){V=$[F.a];fa=$[F.b];ja=$[F.c];za=$[F.d];la[ma]=V.r;la[ma+1]=V.g;la[ma+2]=V.b;la[ma+3]=fa.r;la[ma+4]=fa.g;la[ma+5]=fa.b;la[ma+6]=ja.r;la[ma+7]=ja.g;la[ma+8]=ja.b;la[ma+9]=za.r;la[ma+10]=za.g;la[ma+11]=za.b;ma+=12}if(Na&&xa.hasTangents){V=x[F.a].tangent;fa=x[F.b].tangent;ja=x[F.c].tangent;F=x[F.d].tangent;ha[Z]=V.x;ha[Z+1]=V.y;ha[Z+2]=V.z;ha[Z+3]=V.w;ha[Z+4]=fa.x;ha[Z+5]=fa.y;ha[Z+6]=fa.z;ha[Z+7]=fa.w;ha[Z+8]=ja.x;ha[Z+9]=ja.y;ha[Z+10]=
|
|
|
|
-ja.z;ha[Z+11]=ja.w;ha[Z+12]=F.x;ha[Z+13]=F.y;ha[Z+14]=F.z;ha[Z+15]=F.w;Z+=16}if(Ma)if(ua.length==4&&La)for(F=0;F<4;F++){oa=ua[F];sa[ea]=oa.x;sa[ea+1]=oa.y;sa[ea+2]=oa.z;ea+=3}else for(F=0;F<4;F++){sa[ea]=oa.x;sa[ea+1]=oa.y;sa[ea+2]=oa.z;ea+=3}if(Ca&&ra)for(F=0;F<4;F++){ua=ra[F];Ea[O]=ua.u;Ea[O+1]=ua.v;O+=2}if(Ca&&qa)for(F=0;F<4;F++){ra=qa[F];Fa[ia]=ra.u;Fa[ia+1]=ra.v;ia+=2}if(Ba){Aa[U]=s;Aa[U+1]=s+1;Aa[U+2]=s+2;Aa[U+3]=s;Aa[U+4]=s+2;Aa[U+5]=s+3;U+=6;ta[va]=s;ta[va+1]=s+1;ta[va+2]=s;ta[va+3]=s+3;ta[va+
|
|
|
|
-4]=s+1;ta[va+5]=s+2;ta[va+6]=s+2;ta[va+7]=s+3;va+=8;s+=4}}}if(ka){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,na,Y)}if(Ka&&$.length){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,la,Y)}if(Ma){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,sa,Y)}if(Na&&xa.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,ha,Y)}if(Ca&&O>0){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLUVBuffer);
|
|
|
|
-b.bufferData(b.ARRAY_BUFFER,Ea,Y)}if(Ca&&ia>0){b.bindBuffer(b.ARRAY_BUFFER,u.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,Fa,Y)}if(Ba){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,u.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,Aa,Y);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,u.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,ta,Y)}}D(objlist,v,h,d,j,o)}f.__dirtyVertices=false;f.__dirtyElements=false;f.__dirtyUvs=false;f.__dirtyNormals=false;f.__dirtyTangents=false;f.__dirtyColors=false}else if(j instanceof
|
|
|
|
-THREE.Line){if(!f.__webGLVertexBuffer){f.__webGLVertexBuffer=b.createBuffer();f.__webGLColorBuffer=b.createBuffer();h=f.vertices.length;f.__vertexArray=new Float32Array(h*3);f.__colorArray=new Float32Array(h*3);f.__webGLLineCount=h;f.__dirtyVertices=true;f.__dirtyColors=true}if(f.__dirtyVertices||f.__dirtyColors){h=b.DYNAMIC_DRAW;n=f.vertices;u=f.colors;O=n.length;Y=u.length;ia=f.__vertexArray;ga=f.__colorArray;U=f.__dirtyColors;if(f.__dirtyVertices){for(w=0;w<O;w++){s=n[w].position;d=w*3;ia[d]=s.x;
|
|
|
|
-ia[d+1]=s.y;ia[d+2]=s.z}b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,ia,h)}if(U){for(w=0;w<Y;w++){color=u[w];d=w*3;ga[d]=color.r;ga[d+1]=color.g;ga[d+2]=color.b}b.bindBuffer(b.ARRAY_BUFFER,f.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,ga,h)}}D(objlist,v,0,f,j,o);f.__dirtyVertices=false;f.__dirtyColors=false}else if(j instanceof THREE.ParticleSystem){if(!f.__webGLVertexBuffer){f.__webGLVertexBuffer=b.createBuffer();f.__webGLColorBuffer=b.createBuffer();h=f.vertices.length;
|
|
|
|
-f.__vertexArray=new Float32Array(h*3);f.__colorArray=new Float32Array(h*3);f.__sortArray=[];f.__webGLParticleCount=h;f.__dirtyVertices=true;f.__dirtyColors=true}if(f.__dirtyVertices||f.__dirtyColors||j.sortParticles)c(f,b.DYNAMIC_DRAW,j,camera);D(objlist,v,0,f,j,o);f.__dirtyVertices=false;f.__dirtyColors=false}else if(j instanceof THREE.MarchingCubes)if(v[0]==undefined){d.__webGLObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0},root:o});v[0]=1}}function D(d,j,
|
|
|
|
-o,h,f,v){if(j[o]==undefined){d.push({buffer:h,object:f,opaque:{list:[],count:0},transparent:{list:[],count:0},root:v});j[o]=1}}function H(d,j){d._modelViewMatrix.multiplyToArray(j.matrix,d.matrixWorld,d._modelViewMatrixArray);d._normalMatrix=THREE.Matrix4.makeInvert3x3(d._modelViewMatrix).transposeIntoArray(d._normalMatrixArray)}function G(d){if(d!=M){switch(d){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,
|
|
|
|
-b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}M=d}}function r(d,j){if(d&&!d.__webGLFramebuffer){d.__webGLFramebuffer=b.createFramebuffer();d.__webGLRenderbuffer=b.createRenderbuffer();d.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,d.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,d.width,d.height);
|
|
|
|
-b.bindTexture(b.TEXTURE_2D,d.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,B(d.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,B(d.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,B(d.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,B(d.min_filter));b.texImage2D(b.TEXTURE_2D,0,B(d.format),d.width,d.height,0,B(d.format),B(d.type),null);b.bindFramebuffer(b.FRAMEBUFFER,d.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,
|
|
|
|
-d.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,d.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var o,h,f;if(d){o=d.__webGLFramebuffer;h=d.width;f=d.height}else{o=null;h=I.width;f=I.height}if(o!=P){b.bindFramebuffer(b.FRAMEBUFFER,o);b.viewport(0,0,h,f);j&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);P=o}}function S(d,j){var o;if(d=="fragment")o=b.createShader(b.FRAGMENT_SHADER);
|
|
|
|
-else if(d=="vertex")o=b.createShader(b.VERTEX_SHADER);b.shaderSource(o,j);b.compileShader(o);if(!b.getShaderParameter(o,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(o));return null}return o}function B(d){switch(d){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;
|
|
|
|
-case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;
|
|
|
|
-case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var I=document.createElement("canvas"),b,aa=null,P=null,J=null,W=null,M=null,R=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],K=new THREE.Matrix4,C=new Float32Array(16),L=new Float32Array(16),ba=new THREE.Vector4,N=true,da=new THREE.Color(0),ca=0;if(a){if(a.antialias!==
|
|
|
|
-undefined)N=a.antialias;a.clearColor!==undefined&&da.setHex(a.clearColor);if(a.clearAlpha!==undefined)ca=a.clearAlpha}this.domElement=I;this.autoClear=true;(function(d,j,o){try{b=I.getContext("experimental-webgl",{antialias:d})}catch(h){console.log(h)}if(!b){alert("WebGL not supported");throw"cannot create webgl context";}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,
|
|
|
|
-b.ONE_MINUS_SRC_ALPHA);b.clearColor(j.r,j.g,j.b,o);_cullEnabled=true})(N,da,ca);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(d,j){I.width=d;I.height=j;b.viewport(0,0,I.width,I.height)};this.setClearColorHex=function(d,j){var o=new THREE.Color(d);b.clearColor(o.r,o.g,o.b,j)};this.setClearColor=function(d,j){b.clearColor(d.r,d.g,d.b,j)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};
|
|
|
|
-this.setupLights=function(d,j){var o,h,f,v=0,u=0,n=0,w,s,O,Y=this.lights,ga=Y.directional.colors,ia=Y.directional.positions,U=Y.point.colors,ea=Y.point.positions,Z=0,qa=0;o=f=f=0;for(h=j.length;o<h;o++){f=j[o];w=f.color;s=f.position;O=f.intensity;if(f instanceof THREE.AmbientLight){v+=w.r;u+=w.g;n+=w.b}else if(f instanceof THREE.DirectionalLight){f=Z*3;ga[f]=w.r*O;ga[f+1]=w.g*O;ga[f+2]=w.b*O;ia[f]=s.x;ia[f+1]=s.y;ia[f+2]=s.z;Z+=1}else if(f instanceof THREE.PointLight){f=qa*3;U[f]=w.r*O;U[f+1]=w.g*
|
|
|
|
-O;U[f+2]=w.b*O;ea[f]=s.x;ea[f+1]=s.y;ea[f+2]=s.z;qa+=1}}for(o=Z*3;o<ga.length;o++)ga[o]=0;for(o=qa*3;o<U.length;o++)U[o]=0;Y.point.length=qa;Y.directional.length=Z;Y.ambient[0]=v;Y.ambient[1]=u;Y.ambient[2]=n};this.initMaterial=function(d,j,o){var h,f;if(d instanceof THREE.MeshDepthMaterial)e(d,THREE.ShaderLib.depth);else if(d instanceof THREE.MeshNormalMaterial)e(d,THREE.ShaderLib.normal);else if(d instanceof THREE.MeshBasicMaterial)e(d,THREE.ShaderLib.basic);else if(d instanceof THREE.MeshLambertMaterial)e(d,
|
|
|
|
-THREE.ShaderLib.lambert);else if(d instanceof THREE.MeshPhongMaterial)e(d,THREE.ShaderLib.phong);else if(d instanceof THREE.LineBasicMaterial)e(d,THREE.ShaderLib.basic);else d instanceof THREE.ParticleBasicMaterial&&e(d,THREE.ShaderLib.particle_basic);var v,u,n,w;f=n=w=0;for(v=j.length;f<v;f++){u=j[f];u instanceof THREE.DirectionalLight&&n++;u instanceof THREE.PointLight&&w++}if(w+n<=4){j=n;w=w}else{j=Math.ceil(4*n/(w+n));w=4-j}f={directional:j,point:w};w=d.fragment_shader;j=d.vertex_shader;v={fog:o,
|
|
|
|
-map:d.map,env_map:d.env_map,light_map:d.light_map,vertex_colors:d.vertex_colors,maxDirLights:f.directional,maxPointLights:f.point};o=b.createProgram();f=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.fog?"#define USE_FOG":"",v.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",v.map?"#define USE_MAP":"",v.env_map?"#define USE_ENVMAP":"",v.light_map?"#define USE_LIGHTMAP":"",v.vertex_colors?"#define USE_COLOR":
|
|
|
|
-"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");v=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+v.maxDirLights,"#define MAX_POINT_LIGHTS "+v.maxPointLights,v.map?"#define USE_MAP":"",v.env_map?"#define USE_ENVMAP":"",v.light_map?"#define USE_LIGHTMAP":"",v.vertex_colors?"#define USE_COLOR":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\n"].join("\n");
|
|
|
|
-b.attachShader(o,S("fragment",f+w));b.attachShader(o,S("vertex",v+j));b.linkProgram(o);b.getProgramParameter(o,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(o,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");o.uniforms={};o.attributes={};d.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition"];for(h in d.uniforms)o.push(h);h=d.program;w=0;for(j=o.length;w<j;w++){f=o[w];h.uniforms[f]=b.getUniformLocation(h,
|
|
|
|
-f)}d=d.program;h=["position","normal","uv","uv2","tangent","color"];o=0;for(w=h.length;o<w;o++){j=h[o];d.attributes[j]=b.getAttribLocation(d,j)}};this.setProgram=function(d,j,o,h,f){h.program||this.initMaterial(h,j,o);var v=h.program,u=v.uniforms,n=h.uniforms;if(v!=aa){b.useProgram(v);aa=v;b.uniformMatrix4fv(u.projectionMatrix,false,C)}if(o&&(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial||h instanceof THREE.LineBasicMaterial||h instanceof
|
|
|
|
-THREE.ParticleBasicMaterial)){n.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){n.fogNear.value=o.near;n.fogFar.value=o.far}else if(o instanceof THREE.FogExp2)n.fogDensity.value=o.density}if(h instanceof THREE.MeshPhongMaterial||h instanceof THREE.MeshLambertMaterial){this.setupLights(v,j);j=this.lights;n.enableLighting.value=j.directional.length+j.point.length;n.ambientLightColor.value=j.ambient;n.directionalLightColor.value=j.directional.colors;n.directionalLightDirection.value=j.directional.positions;
|
|
|
|
-n.pointLightColor.value=j.point.colors;n.pointLightPosition.value=j.point.positions}if(h instanceof THREE.MeshBasicMaterial||h instanceof THREE.MeshLambertMaterial||h instanceof THREE.MeshPhongMaterial){n.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);n.opacity.value=h.opacity;n.map.texture=h.map;n.light_map.texture=h.light_map;n.env_map.texture=h.env_map;n.reflectivity.value=h.reflectivity;n.refraction_ratio.value=h.refraction_ratio;n.combine.value=h.combine;n.useRefract.value=
|
|
|
|
-h.env_map&&h.env_map.mapping instanceof THREE.CubeRefractionMapping}if(h instanceof THREE.LineBasicMaterial){n.diffuse.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);n.opacity.value=h.opacity}else if(h instanceof THREE.ParticleBasicMaterial){n.psColor.value.setRGB(h.color.r*h.opacity,h.color.g*h.opacity,h.color.b*h.opacity);n.opacity.value=h.opacity;n.size.value=h.size;n.map.texture=h.map}else if(h instanceof THREE.MeshPhongMaterial){n.ambient.value.setRGB(h.ambient.r,h.ambient.g,
|
|
|
|
-h.ambient.b);n.specular.value.setRGB(h.specular.r,h.specular.g,h.specular.b);n.shininess.value=h.shininess}else if(h instanceof THREE.MeshDepthMaterial){n.mNear.value=d.near;n.mFar.value=d.far;n.opacity.value=h.opacity}else if(h instanceof THREE.MeshNormalMaterial)n.opacity.value=h.opacity;var w,s,O;for(w in n)if(O=v.uniforms[w]){o=n[w];s=o.type;j=o.value;if(s=="i")b.uniform1i(O,j);else if(s=="f")b.uniform1f(O,j);else if(s=="fv1")b.uniform1fv(O,j);else if(s=="fv")b.uniform3fv(O,j);else if(s=="v2")b.uniform2f(O,
|
|
|
|
-j.x,j.y);else if(s=="v3")b.uniform3f(O,j.x,j.y,j.z);else if(s=="c")b.uniform3f(O,j.r,j.g,j.b);else if(s=="t"){b.uniform1i(O,j);if(o=o.texture)if(o.image instanceof Array&&o.image.length==6){o=o;j=j;if(o.image.length==6){if(!o.image.__webGLTextureCube&&!o.image.__cubeMapInitialized&&o.image.loadCount==6){o.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,
|
|
|
|
-b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(s=0;s<6;++s)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,o.image[s]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);o.image.__cubeMapInitialized=true}b.activeTexture(b.TEXTURE0+j);b.bindTexture(b.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube)}}else{o=o;j=j;if(!o.__webGLTexture&&
|
|
|
|
-o.image.loaded){o.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,o.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,o.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,B(o.wrap_s));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,B(o.wrap_t));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,B(o.mag_filter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,B(o.min_filter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}b.activeTexture(b.TEXTURE0+
|
|
|
|
-j);b.bindTexture(b.TEXTURE_2D,o.__webGLTexture)}}}b.uniformMatrix4fv(u.modelViewMatrix,false,f._modelViewMatrixArray);b.uniformMatrix3fv(u.normalMatrix,false,f._normalMatrixArray);if(h instanceof THREE.MeshShaderMaterial||h instanceof THREE.MeshPhongMaterial||h.env_map)b.uniform3f(u.cameraPosition,d.position.x,d.position.y,d.position.z);if(h instanceof THREE.MeshShaderMaterial||h.env_map)b.uniformMatrix4fv(u.objectMatrix,false,f._objectMatrixArray);if(h instanceof THREE.MeshPhongMaterial||h instanceof
|
|
|
|
-THREE.MeshLambertMaterial||h instanceof THREE.MeshShaderMaterial)b.uniformMatrix4fv(u.viewMatrix,false,L);return v};this.renderBuffer=function(d,j,o,h,f,v){d=this.setProgram(d,j,o,h,v).attributes;b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.vertexAttribPointer(d.position,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.position);if(d.color>=0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLColorBuffer);b.vertexAttribPointer(d.color,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.color)}if(d.normal>=
|
|
|
|
-0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLNormalBuffer);b.vertexAttribPointer(d.normal,3,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.normal)}if(d.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLTangentBuffer);b.vertexAttribPointer(d.tangent,4,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.tangent)}if(d.uv>=0)if(f.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUVBuffer);b.vertexAttribPointer(d.uv,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.uv)}else b.disableVertexAttribArray(d.uv);if(d.uv2>=
|
|
|
|
-0)if(f.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLUV2Buffer);b.vertexAttribPointer(d.uv2,2,b.FLOAT,false,0,0);b.enableVertexAttribArray(d.uv2)}else b.disableVertexAttribArray(d.uv2);if(v instanceof THREE.Mesh)if(h.wireframe){b.lineWidth(h.wireframe_linewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLLineBuffer);b.drawElements(b.LINES,f.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,f.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,f.__webGLFaceCount,b.UNSIGNED_SHORT,
|
|
|
|
-0)}else if(v instanceof THREE.Line){v=v.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(h.linewidth);b.drawArrays(v,0,f.__webGLLineCount)}else v instanceof THREE.ParticleSystem&&b.drawArrays(b.POINTS,0,f.__webGLParticleCount)};this.render=function(d,j,o,h){var f,v,u,n,w,s,O,Y=d.lights,ga=d.fog;j.autoUpdateMatrix&&j.updateMatrix();j.matrix.flattenToArray(L);j.projectionMatrix.flattenToArray(C);K.multiply(j.projectionMatrix,j.matrix);k(K);this.initWebGLObjects(d,j);r(o,h!==undefined?h:true);
|
|
|
|
-this.autoClear&&this.clear();n=d.__webGLObjects.length;for(h=0;h<n;h++){f=d.__webGLObjects[h];s=f.object;if(s.visible){if(f.root){s.autoUpdateMatrix&&s.updateMatrix();s.matrixWorld.copy(s.matrix);z(s)}if(!(s instanceof THREE.Mesh)||q(s)){s.matrixWorld.flattenToArray(s._objectMatrixArray);H(s,j);m(f);f.render=true;ba.copy(s.position);K.multiplyVector3(ba);f.z=ba.z}else f.render=false}else f.render=false}d.__webGLObjects.sort(A);w=d.__webGLObjectsImmediate.length;for(h=0;h<w;h++){f=d.__webGLObjectsImmediate[h];
|
|
|
|
-s=f.object;if(s.visible){if(s.autoUpdateMatrix){s.updateMatrix();s.matrixWorld.copy(s.matrix);s.matrixWorld.flattenToArray(s._objectMatrixArray)}H(s,j);l(f)}}G(THREE.NormalBlending);for(h=0;h<n;h++){f=d.__webGLObjects[h];if(f.render){s=f.object;O=f.buffer;u=f.opaque;i(s);for(f=0;f<u.count;f++){material=u.list[f];this.setDepthTest(material.depth_test);this.renderBuffer(j,Y,ga,material,O,s)}}}for(h=0;h<w;h++){f=d.__webGLObjectsImmediate[h];s=f.object;if(s.visible){u=f.opaque;i(s);for(f=0;f<u.count;f++){material=
|
|
|
|
-u.list[f];this.setDepthTest(material.depth_test);v=this.setProgram(j,Y,ga,material,s);s.render(function(ia){g(ia,v)})}}}for(h=0;h<n;h++){f=d.__webGLObjects[h];if(f.render){s=f.object;O=f.buffer;u=f.transparent;i(s);for(f=0;f<u.count;f++){material=u.list[f];G(material.blending);this.setDepthTest(material.depth_test);this.renderBuffer(j,Y,ga,material,O,s)}}}for(h=0;h<w;h++){f=d.__webGLObjectsImmediate[h];s=f.object;if(s.visible){u=f.transparent;i(s);for(f=0;f<u.count;f++){material=u.list[f];G(material.blending);
|
|
|
|
-this.setDepthTest(material.depth_test);v=this.setProgram(j,Y,ga,material,s);s.render(function(ia){g(ia,v)})}}}if(o&&o.min_filter!==THREE.NearestFilter&&o.min_filter!==THREE.LinearFilter){b.bindTexture(b.TEXTURE_2D,o.__webGLTexture);b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}};this.initWebGLObjects=function(d){var j,o,h;if(!d.__webGLObjects){d.__webGLObjects=[];d.__webGLObjectsMap={};d.__webGLObjectsImmediate=[]}j=0;for(o=d.objects.length;j<o;j++){h=d.objects[j];y(d,h,true);t(d,
|
|
|
|
-h)}};this.removeObject=function(d,j){var o,h;for(o=d.__webGLObjects.length-1;o>=0;o--){h=d.__webGLObjects[o].object;j==h&&d.__webGLObjects.splice(o,1)}};this.setDepthTest=function(d){d?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST)};this.setFaceCulling=function(d,j){if(d){!j||j=="ccw"?b.frontFace(b.CCW):b.frontFace(b.CW);if(d=="back")b.cullFace(b.BACK);else d=="front"?b.cullFace(b.FRONT):b.cullFace(b.FRONT_AND_BACK);b.enable(b.CULL_FACE)}else b.disable(b.CULL_FACE)};this.supportsVertexTextures=function(){return b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>
|
|
|
|
-0}};
|
|
|
|
|
|
+THREE.RenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrap_s=c.wrap_s!==undefined?c.wrap_s:THREE.ClampToEdgeWrapping;this.wrap_t=c.wrap_t!==undefined?c.wrap_t:THREE.ClampToEdgeWrapping;this.mag_filter=c.mag_filter!==undefined?c.mag_filter:THREE.LinearFilter;this.min_filter=c.min_filter!==undefined?c.min_filter:THREE.LinearMipMapLinearFilter;this.format=c.format!==undefined?c.format:THREE.RGBFormat;this.type=c.type!==undefined?c.type:THREE.UnsignedByteType};
|
|
|
|
+var Uniforms={clone:function(a){var b,c,e,g={};for(b in a){g[b]={};for(c in a[b]){e=a[b][c];g[b][c]=e instanceof THREE.Color||e instanceof THREE.Vector3||e instanceof THREE.Texture?e.clone():e}}return g},merge:function(a){var b,c,e,g={};for(b=0;b<a.length;b++){e=this.clone(a[b]);for(c in e)g[c]=e[c]}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(){THREE.Object3D.call(this);this.objects=[];this.lights=[];this.fog=null};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
|
|
|
|
+THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else a instanceof THREE.Camera||this.objects.indexOf(a)===-1&&this.objects.push(a);for(var b=0;b<a.children.length;b++)this.addChildRecurse(a.children[b])};THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};
|
|
|
|
+THREE.Scene.prototype.removeChildRecurse=function(){if(object instanceof THREE.Light){var a=this.lights.indexOf(object);a===-1&&this.lights.splice(a,1)}else if(!(object instanceof THREE.Camera)){a=this.objects.indexOf(object);a===-1&&this.objects.splice(a,1)}for(a=0;a<object.children.length;a++)this.removeChildRecurse(object.children[a])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
|
|
|
|
+THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b||1;this.far=c||1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b||2.5E-4};
|
|
|
|
+THREE.Projector=function(){function a(V,L){return L.z-V.z}function b(V,L){var aa=0,R=1,ba=V.z+V.w,Q=L.z+L.w,H=-V.z+V.w,O=-L.z+L.w;if(ba>=0&&Q>=0&&H>=0&&O>=0)return!0;else if(ba<0&&Q<0||H<0&&O<0)return!1;else{if(ba<0)aa=Math.max(aa,ba/(ba-Q));else Q<0&&(R=Math.min(R,ba/(ba-Q)));if(H<0)aa=Math.max(aa,H/(H-O));else O<0&&(R=Math.min(R,H/(H-O)));if(R<aa)return!1;else{V.lerpSelf(L,aa);L.lerpSelf(V,1-R);return!0}}}var c,e,g=[],h,m,n,k=[],l,u,w=[],v,z,K=[],N=new THREE.Vector4,A=new THREE.Vector4,p=new THREE.Matrix4,
|
|
|
|
+d=new THREE.Matrix4,J=[],T=new THREE.Vector4,W=new THREE.Vector4,ea;this.projectObjects=function(V,L,aa){var R=[],ba,Q;e=0;p.multiply(L.projectionMatrix,L.matrix);J[0]=new THREE.Vector4(p.n41-p.n11,p.n42-p.n12,p.n43-p.n13,p.n44-p.n14);J[1]=new THREE.Vector4(p.n41+p.n11,p.n42+p.n12,p.n43+p.n13,p.n44+p.n14);J[2]=new THREE.Vector4(p.n41+p.n21,p.n42+p.n22,p.n43+p.n23,p.n44+p.n24);J[3]=new THREE.Vector4(p.n41-p.n21,p.n42-p.n22,p.n43-p.n23,p.n44-p.n24);J[4]=new THREE.Vector4(p.n41-p.n31,p.n42-p.n32,p.n43-
|
|
|
|
+p.n33,p.n44-p.n34);J[5]=new THREE.Vector4(p.n41+p.n31,p.n42+p.n32,p.n43+p.n33,p.n44+p.n34);L=0;for(ba=J.length;L<ba;L++){Q=J[L];Q.divideScalar(Math.sqrt(Q.x*Q.x+Q.y*Q.y+Q.z*Q.z))}ba=V.objects;V=0;for(L=ba.length;V<L;V++){Q=ba[V];var H;if(!(H=!Q.visible))if(H=Q instanceof THREE.Mesh){a:{H=void 0;for(var O=Q.position,ia=-Q.geometry.boundingSphere.radius*Math.max(Q.scale.x,Math.max(Q.scale.y,Q.scale.z)),S=0;S<6;S++){H=J[S].x*O.x+J[S].y*O.y+J[S].z*O.z+J[S].w;if(H<=ia){H=!1;break a}}H=!0}H=!H}if(!H){c=
|
|
|
|
+g[e]=g[e]||new THREE.RenderableObject;N.copy(Q.position);p.multiplyVector3(N);c.object=Q;c.z=N.z;R.push(c);e++}}aa&&R.sort(a);return R};this.projectScene=function(V,L,aa){var R=[],ba=L.near,Q=L.far,H,O,ia,S,f,q,o,j,i,s,t,x,E,r,F,B;n=u=z=0;L.autoUpdateMatrix&&L.updateMatrix();p.multiply(L.projectionMatrix,L.matrix);q=this.projectObjects(V,L,!0);V=0;for(H=q.length;V<H;V++){o=q[V].object;if(o.visible){o.autoUpdateMatrix&&o.updateMatrix();j=o.matrix;i=o.rotationMatrix;s=o.materials;t=o.overdraw;if(o instanceof
|
|
|
|
+THREE.Mesh){x=o.geometry;E=x.vertices;O=0;for(ia=E.length;O<ia;O++){r=E[O];r.positionWorld.copy(r.position);j.multiplyVector3(r.positionWorld);S=r.positionScreen;S.copy(r.positionWorld);p.multiplyVector4(S);S.x/=S.w;S.y/=S.w;r.__visible=S.z>ba&&S.z<Q}x=x.faces;O=0;for(ia=x.length;O<ia;O++){r=x[O];if(r instanceof THREE.Face3){S=E[r.a];f=E[r.b];F=E[r.c];if(S.__visible&&f.__visible&&F.__visible&&(o.doubleSided||o.flipSided!=(F.positionScreen.x-S.positionScreen.x)*(f.positionScreen.y-S.positionScreen.y)-
|
|
|
|
+(F.positionScreen.y-S.positionScreen.y)*(f.positionScreen.x-S.positionScreen.x)<0)){h=k[n]=k[n]||new THREE.RenderableFace3;h.v1.positionWorld.copy(S.positionWorld);h.v2.positionWorld.copy(f.positionWorld);h.v3.positionWorld.copy(F.positionWorld);h.v1.positionScreen.copy(S.positionScreen);h.v2.positionScreen.copy(f.positionScreen);h.v3.positionScreen.copy(F.positionScreen);h.normalWorld.copy(r.normal);i.multiplyVector3(h.normalWorld);h.centroidWorld.copy(r.centroid);j.multiplyVector3(h.centroidWorld);
|
|
|
|
+h.centroidScreen.copy(h.centroidWorld);p.multiplyVector3(h.centroidScreen);F=r.vertexNormals;ea=h.vertexNormalsWorld;S=0;for(f=F.length;S<f;S++){B=ea[S]=ea[S]||new THREE.Vector3;B.copy(F[S]);i.multiplyVector3(B)}h.z=h.centroidScreen.z;h.meshMaterials=s;h.faceMaterials=r.materials;h.overdraw=t;if(o.geometry.uvs[O]){h.uvs[0]=o.geometry.uvs[O][0];h.uvs[1]=o.geometry.uvs[O][1];h.uvs[2]=o.geometry.uvs[O][2]}R.push(h);n++}}else if(r instanceof THREE.Face4){S=E[r.a];f=E[r.b];F=E[r.c];B=E[r.d];if(S.__visible&&
|
|
|
|
+f.__visible&&F.__visible&&B.__visible&&(o.doubleSided||o.flipSided!=((B.positionScreen.x-S.positionScreen.x)*(f.positionScreen.y-S.positionScreen.y)-(B.positionScreen.y-S.positionScreen.y)*(f.positionScreen.x-S.positionScreen.x)<0||(f.positionScreen.x-F.positionScreen.x)*(B.positionScreen.y-F.positionScreen.y)-(f.positionScreen.y-F.positionScreen.y)*(B.positionScreen.x-F.positionScreen.x)<0))){h=k[n]=k[n]||new THREE.RenderableFace3;h.v1.positionWorld.copy(S.positionWorld);h.v2.positionWorld.copy(f.positionWorld);
|
|
|
|
+h.v3.positionWorld.copy(B.positionWorld);h.v1.positionScreen.copy(S.positionScreen);h.v2.positionScreen.copy(f.positionScreen);h.v3.positionScreen.copy(B.positionScreen);h.normalWorld.copy(r.normal);i.multiplyVector3(h.normalWorld);h.centroidWorld.copy(r.centroid);j.multiplyVector3(h.centroidWorld);h.centroidScreen.copy(h.centroidWorld);p.multiplyVector3(h.centroidScreen);h.z=h.centroidScreen.z;h.meshMaterials=s;h.faceMaterials=r.materials;h.overdraw=t;if(o.geometry.uvs[O]){h.uvs[0]=o.geometry.uvs[O][0];
|
|
|
|
+h.uvs[1]=o.geometry.uvs[O][1];h.uvs[2]=o.geometry.uvs[O][3]}R.push(h);n++;m=k[n]=k[n]||new THREE.RenderableFace3;m.v1.positionWorld.copy(f.positionWorld);m.v2.positionWorld.copy(F.positionWorld);m.v3.positionWorld.copy(B.positionWorld);m.v1.positionScreen.copy(f.positionScreen);m.v2.positionScreen.copy(F.positionScreen);m.v3.positionScreen.copy(B.positionScreen);m.normalWorld.copy(h.normalWorld);m.centroidWorld.copy(h.centroidWorld);m.centroidScreen.copy(h.centroidScreen);m.z=m.centroidScreen.z;m.meshMaterials=
|
|
|
|
+s;m.faceMaterials=r.materials;m.overdraw=t;if(o.geometry.uvs[O]){m.uvs[0]=o.geometry.uvs[O][1];m.uvs[1]=o.geometry.uvs[O][2];m.uvs[2]=o.geometry.uvs[O][3]}R.push(m);n++}}}}else if(o instanceof THREE.Line){d.multiply(p,j);E=o.geometry.vertices;r=E[0];r.positionScreen.copy(r.position);d.multiplyVector4(r.positionScreen);O=1;for(ia=E.length;O<ia;O++){S=E[O];S.positionScreen.copy(S.position);d.multiplyVector4(S.positionScreen);f=E[O-1];T.copy(S.positionScreen);W.copy(f.positionScreen);if(b(T,W)){T.multiplyScalar(1/
|
|
|
|
+T.w);W.multiplyScalar(1/W.w);l=w[u]=w[u]||new THREE.RenderableLine;l.v1.positionScreen.copy(T);l.v2.positionScreen.copy(W);l.z=Math.max(T.z,W.z);l.materials=o.materials;R.push(l);u++}}}else if(o instanceof THREE.Particle){A.set(o.position.x,o.position.y,o.position.z,1);p.multiplyVector4(A);A.z/=A.w;if(A.z>0&&A.z<1){v=K[z]=K[z]||new THREE.RenderableParticle;v.x=A.x/A.w;v.y=A.y/A.w;v.z=A.z;v.rotation=o.rotation.z;v.scale.x=o.scale.x*Math.abs(v.x-(A.x+L.projectionMatrix.n11)/(A.w+L.projectionMatrix.n14));
|
|
|
|
+v.scale.y=o.scale.y*Math.abs(v.y-(A.y+L.projectionMatrix.n22)/(A.w+L.projectionMatrix.n24));v.materials=o.materials;R.push(v);z++}}}}aa&&R.sort(a);return R};this.unprojectVector=function(V,L){var aa=THREE.Matrix4.makeInvert(L.matrix);aa.multiplySelf(THREE.Matrix4.makeInvert(L.projectionMatrix));aa.multiplyVector3(V);return V}};
|
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,e,g,h;this.domElement=document.createElement("div");this.setSize=function(m,n){c=m;e=n;g=c/2;h=e/2};this.render=function(m,n){var k,l,u,w,v,z,K,N;a=b.projectScene(m,n);k=0;for(l=a.length;k<l;k++){v=a[k];if(v instanceof THREE.RenderableParticle){K=v.x*g+g;N=v.y*h+h;u=0;for(w=v.material.length;u<w;u++){z=v.material[u];if(z instanceof THREE.ParticleDOMMaterial){z=z.domElement;z.style.left=K+"px";z.style.top=N+"px"}}}}}};
|
|
|
|
+THREE.CanvasRenderer=function(){function a(G){if(v!=G)l.globalAlpha=v=G}function b(G){if(z!=G){switch(G){case THREE.NormalBlending:l.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:l.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:l.globalCompositeOperation="darker"}z=G}}var c=null,e=new THREE.Projector,g=document.createElement("canvas"),h,m,n,k,l=g.getContext("2d"),u=new THREE.Color(0),w=0,v=1,z=0,K=null,N=null,A=1,p,d,J,T,W,ea,V,L,aa,R=new THREE.Color,
|
|
|
|
+ba=new THREE.Color,Q=new THREE.Color,H=new THREE.Color,O=new THREE.Color,ia,S,f,q,o,j,i,s,t,x=new THREE.Rectangle,E=new THREE.Rectangle,r=new THREE.Rectangle,F=!1,B=new THREE.Color,Y=new THREE.Color,ga=new THREE.Color,oa=new THREE.Color,ua=Math.PI*2,Z=new THREE.Vector3,fa,ha,Ia,C,Ca,wa,za=16;fa=document.createElement("canvas");fa.width=fa.height=2;ha=fa.getContext("2d");ha.fillStyle="rgba(0,0,0,1)";ha.fillRect(0,0,2,2);Ia=ha.getImageData(0,0,2,2);C=Ia.data;Ca=document.createElement("canvas");Ca.width=
|
|
|
|
+Ca.height=za;wa=Ca.getContext("2d");wa.translate(-za/2,-za/2);wa.scale(za,za);za--;this.domElement=g;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setSize=function(G,M){h=G;m=M;n=h/2;k=m/2;g.width=h;g.height=m;x.set(-n,-k,n,k);v=1;z=0;N=K=null;A=1};this.setClearColor=function(G,M){u=G;w=M;E.set(-n,-k,n,k);l.setTransform(1,0,0,-1,n,k);this.clear()};this.setClearColorHex=function(G,M){u.setHex(G);w=M;E.set(-n,-k,n,k);l.setTransform(1,0,0,-1,n,k);this.clear()};this.clear=function(){l.setTransform(1,
|
|
|
|
+0,0,-1,n,k);if(!E.isEmpty()){E.inflate(1);E.minSelf(x);if(u.hex==0&&w==0)l.clearRect(E.getX(),E.getY(),E.getWidth(),E.getHeight());else{b(THREE.NormalBlending);a(1);l.fillStyle="rgba("+Math.floor(u.r*255)+","+Math.floor(u.g*255)+","+Math.floor(u.b*255)+","+w+")";l.fillRect(E.getX(),E.getY(),E.getWidth(),E.getHeight())}E.empty()}};this.render=function(G,M){function P(D){var ca,X,I,U=D.lights;Y.setRGB(0,0,0);ga.setRGB(0,0,0);oa.setRGB(0,0,0);D=0;for(ca=U.length;D<ca;D++){X=U[D];I=X.color;if(X instanceof
|
|
|
|
+THREE.AmbientLight){Y.r+=I.r;Y.g+=I.g;Y.b+=I.b}else if(X instanceof THREE.DirectionalLight){ga.r+=I.r;ga.g+=I.g;ga.b+=I.b}else if(X instanceof THREE.PointLight){oa.r+=I.r;oa.g+=I.g;oa.b+=I.b}}}function ja(D,ca,X,I){var U,da,sa,Aa,Da=D.lights;D=0;for(U=Da.length;D<U;D++){da=Da[D];sa=da.color;Aa=da.intensity;if(da instanceof THREE.DirectionalLight){da=X.dot(da.position)*Aa;if(da>0){I.r+=sa.r*da;I.g+=sa.g*da;I.b+=sa.b*da}}else if(da instanceof THREE.PointLight){Z.sub(da.position,ca);Z.normalize();da=
|
|
|
|
+X.dot(Z)*Aa;if(da>0){I.r+=sa.r*da;I.g+=sa.g*da;I.b+=sa.b*da}}}}function Ea(D,ca,X){if(X.opacity!=0){a(X.opacity);b(X.blending);var I,U,da,sa,Aa,Da;if(X instanceof THREE.ParticleBasicMaterial){if(X.map&&X.map.image.loaded){sa=X.map.image;Aa=sa.width>>1;Da=sa.height>>1;U=ca.scale.x*n;da=ca.scale.y*k;X=U*Aa;I=da*Da;r.set(D.x-X,D.y-I,D.x+X,D.y+I);if(!x.instersects(r))return;l.save();l.translate(D.x,D.y);l.rotate(-ca.rotation);l.scale(U,-da);l.translate(-Aa,-Da);l.drawImage(sa,0,0);l.restore()}l.beginPath();
|
|
|
|
+l.moveTo(D.x-10,D.y);l.lineTo(D.x+10,D.y);l.moveTo(D.x,D.y-10);l.lineTo(D.x,D.y+10);l.closePath();l.strokeStyle="rgb(255,255,0)";l.stroke()}else if(X instanceof THREE.ParticleCircleMaterial){if(F){B.r=Y.r+ga.r+oa.r;B.g=Y.g+ga.g+oa.g;B.b=Y.b+ga.b+oa.b;R.r=X.color.r*B.r;R.g=X.color.g*B.g;R.b=X.color.b*B.b;R.updateStyleString()}else R.__styleString=X.color.__styleString;X=ca.scale.x*n;I=ca.scale.y*k;r.set(D.x-X,D.y-I,D.x+X,D.y+I);if(x.instersects(r)){U=R.__styleString;if(N!=U)l.fillStyle=N=U;l.save();
|
|
|
|
+l.translate(D.x,D.y);l.rotate(-ca.rotation);l.scale(X,I);l.beginPath();l.arc(0,0,1,0,ua,!0);l.closePath();l.fill();l.restore()}}}}function ra(D,ca,X,I){if(I.opacity!=0){a(I.opacity);b(I.blending);l.beginPath();l.moveTo(D.positionScreen.x,D.positionScreen.y);l.lineTo(ca.positionScreen.x,ca.positionScreen.y);l.closePath();if(I instanceof THREE.LineBasicMaterial){R.__styleString=I.color.__styleString;D=I.linewidth;if(A!=D)l.lineWidth=A=D;D=R.__styleString;if(K!=D)l.strokeStyle=K=D;l.stroke();r.inflate(I.linewidth*
|
|
|
|
+2)}}}function y(D,ca,X,I,U,da){if(U.opacity!=0){a(U.opacity);b(U.blending);T=D.positionScreen.x;W=D.positionScreen.y;ea=ca.positionScreen.x;V=ca.positionScreen.y;L=X.positionScreen.x;aa=X.positionScreen.y;l.beginPath();l.moveTo(T,W);l.lineTo(ea,V);l.lineTo(L,aa);l.lineTo(T,W);l.closePath();if(U instanceof THREE.MeshBasicMaterial)if(U.map)U.map.image.loaded&&U.map.mapping instanceof THREE.UVMapping&&Ka(T,W,ea,V,L,aa,U.map.image,I.uvs[0].u,I.uvs[0].v,I.uvs[1].u,I.uvs[1].v,I.uvs[2].u,I.uvs[2].v);else if(U.env_map){if(U.env_map.image.loaded&&
|
|
|
|
+U.env_map.mapping instanceof THREE.SphericalReflectionMapping){D=M.matrix;Z.copy(I.vertexNormalsWorld[0]);q=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;o=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(I.vertexNormalsWorld[1]);j=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;i=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Z.copy(I.vertexNormalsWorld[2]);s=(Z.x*D.n11+Z.y*D.n12+Z.z*D.n13)*0.5+0.5;t=-(Z.x*D.n21+Z.y*D.n22+Z.z*D.n23)*0.5+0.5;Ka(T,W,ea,V,L,aa,U.env_map.image,q,o,j,i,s,t)}}else U.wireframe?pa(U.color.__styleString,
|
|
|
|
+U.wireframe_linewidth):Ma(U.color.__styleString);else if(U instanceof THREE.MeshLambertMaterial){if(U.map&&!U.wireframe){U.map.mapping instanceof THREE.UVMapping&&Ka(T,W,ea,V,L,aa,U.map.image,I.uvs[0].u,I.uvs[0].v,I.uvs[1].u,I.uvs[1].v,I.uvs[2].u,I.uvs[2].v);b(THREE.SubtractiveBlending)}if(F)if(!U.wireframe&&U.shading==THREE.SmoothShading&&I.vertexNormalsWorld.length==3){ba.r=Q.r=H.r=Y.r;ba.g=Q.g=H.g=Y.g;ba.b=Q.b=H.b=Y.b;ja(da,I.v1.positionWorld,I.vertexNormalsWorld[0],ba);ja(da,I.v2.positionWorld,
|
|
|
|
+I.vertexNormalsWorld[1],Q);ja(da,I.v3.positionWorld,I.vertexNormalsWorld[2],H);O.r=(Q.r+H.r)*0.5;O.g=(Q.g+H.g)*0.5;O.b=(Q.b+H.b)*0.5;f=Ha(ba,Q,H,O);Ka(T,W,ea,V,L,aa,f,0,0,1,0,0,1)}else{B.r=Y.r;B.g=Y.g;B.b=Y.b;ja(da,I.centroidWorld,I.normalWorld,B);R.r=U.color.r*B.r;R.g=U.color.g*B.g;R.b=U.color.b*B.b;R.updateStyleString();U.wireframe?pa(R.__styleString,U.wireframe_linewidth):Ma(R.__styleString)}else U.wireframe?pa(U.color.__styleString,U.wireframe_linewidth):Ma(U.color.__styleString)}else if(U instanceof
|
|
|
|
+THREE.MeshDepthMaterial){ia=M.near;S=M.far;ba.r=ba.g=ba.b=1-la(D.positionScreen.z,ia,S);Q.r=Q.g=Q.b=1-la(ca.positionScreen.z,ia,S);H.r=H.g=H.b=1-la(X.positionScreen.z,ia,S);O.r=(Q.r+H.r)*0.5;O.g=(Q.g+H.g)*0.5;O.b=(Q.b+H.b)*0.5;f=Ha(ba,Q,H,O);Ka(T,W,ea,V,L,aa,f,0,0,1,0,0,1)}else if(U instanceof THREE.MeshNormalMaterial){R.r=qa(I.normalWorld.x);R.g=qa(I.normalWorld.y);R.b=qa(I.normalWorld.z);R.updateStyleString();U.wireframe?pa(R.__styleString,U.wireframe_linewidth):Ma(R.__styleString)}}}function pa(D,
|
|
|
|
+ca){if(K!=D)l.strokeStyle=K=D;if(A!=ca)l.lineWidth=A=ca;l.stroke();r.inflate(ca*2)}function Ma(D){if(N!=D)l.fillStyle=N=D;l.fill()}function Ka(D,ca,X,I,U,da,sa,Aa,Da,La,ta,Ga,Ja){var Fa,Ba;Fa=sa.width-1;Ba=sa.height-1;Aa*=Fa;Da*=Ba;La*=Fa;ta*=Ba;Ga*=Fa;Ja*=Ba;X-=D;I-=ca;U-=D;da-=ca;La-=Aa;ta-=Da;Ga-=Aa;Ja-=Da;Fa=La*Ja-Ga*ta;if(Fa!=0){Ba=1/Fa;Fa=(Ja*X-ta*U)*Ba;ta=(Ja*I-ta*da)*Ba;X=(La*U-Ga*X)*Ba;I=(La*da-Ga*I)*Ba;D=D-Fa*Aa-X*Da;ca=ca-ta*Aa-I*Da;l.save();l.transform(Fa,ta,X,I,D,ca);l.clip();l.drawImage(sa,
|
|
|
|
+0,0);l.restore()}}function Ha(D,ca,X,I){var U=~~(D.r*255),da=~~(D.g*255);D=~~(D.b*255);var sa=~~(ca.r*255),Aa=~~(ca.g*255);ca=~~(ca.b*255);var Da=~~(X.r*255),La=~~(X.g*255);X=~~(X.b*255);var ta=~~(I.r*255),Ga=~~(I.g*255);I=~~(I.b*255);C[0]=U<0?0:U>255?255:U;C[1]=da<0?0:da>255?255:da;C[2]=D<0?0:D>255?255:D;C[4]=sa<0?0:sa>255?255:sa;C[5]=Aa<0?0:Aa>255?255:Aa;C[6]=ca<0?0:ca>255?255:ca;C[8]=Da<0?0:Da>255?255:Da;C[9]=La<0?0:La>255?255:La;C[10]=X<0?0:X>255?255:X;C[12]=ta<0?0:ta>255?255:ta;C[13]=Ga<0?0:
|
|
|
|
+Ga>255?255:Ga;C[14]=I<0?0:I>255?255:I;ha.putImageData(Ia,0,0);wa.drawImage(fa,0,0);return Ca}function la(D,ca,X){D=(D-ca)/(X-ca);return D*D*(3-2*D)}function qa(D){D=(D+1)*0.5;return D<0?0:D>1?1:D}function ma(D,ca){var X=ca.x-D.x,I=ca.y-D.y,U=1/Math.sqrt(X*X+I*I);X*=U;I*=U;ca.x+=X;ca.y+=I;D.x-=X;D.y-=I}var ka,na,$,xa,va,Oa,ya,Na;this.autoClear?this.clear():l.setTransform(1,0,0,-1,n,k);c=e.projectScene(G,M,this.sortElements);l.fillStyle="rgba( 0, 255, 255, 0.5 )";l.fillRect(x.getX(),x.getY(),x.getWidth(),
|
|
|
|
+x.getHeight());(F=G.lights.length>0)&&P(G);ka=0;for(na=c.length;ka<na;ka++){$=c[ka];r.empty();if($ instanceof THREE.RenderableParticle){p=$;p.x*=n;p.y*=k;xa=0;for(va=$.materials.length;xa<va;xa++)Ea(p,$,$.materials[xa],G)}else if($ instanceof THREE.RenderableLine){p=$.v1;d=$.v2;p.positionScreen.x*=n;p.positionScreen.y*=k;d.positionScreen.x*=n;d.positionScreen.y*=k;r.addPoint(p.positionScreen.x,p.positionScreen.y);r.addPoint(d.positionScreen.x,d.positionScreen.y);if(x.instersects(r)){xa=0;for(va=$.materials.length;xa<
|
|
|
|
+va;)ra(p,d,$,$.materials[xa++],G)}}else if($ instanceof THREE.RenderableFace3){p=$.v1;d=$.v2;J=$.v3;p.positionScreen.x*=n;p.positionScreen.y*=k;d.positionScreen.x*=n;d.positionScreen.y*=k;J.positionScreen.x*=n;J.positionScreen.y*=k;if($.overdraw){ma(p.positionScreen,d.positionScreen);ma(d.positionScreen,J.positionScreen);ma(J.positionScreen,p.positionScreen)}r.add3Points(p.positionScreen.x,p.positionScreen.y,d.positionScreen.x,d.positionScreen.y,J.positionScreen.x,J.positionScreen.y);if(x.instersects(r)){xa=
|
|
|
|
+0;for(va=$.meshMaterials.length;xa<va;){Na=$.meshMaterials[xa++];if(Na instanceof THREE.MeshFaceMaterial){Oa=0;for(ya=$.faceMaterials.length;Oa<ya;)(Na=$.faceMaterials[Oa++])&&y(p,d,J,$,Na,G)}else y(p,d,J,$,Na,G)}}}E.addRectangle(r)}l.lineWidth=1;l.strokeStyle="rgba( 255, 0, 0, 0.5 )";l.strokeRect(E.getX(),E.getY(),E.getWidth(),E.getHeight());l.setTransform(1,0,0,1,0,0)}};
|
|
|
|
+THREE.SVGRenderer=function(){function a(q,o,j){var i,s,t,x;i=0;for(s=q.lights.length;i<s;i++){t=q.lights[i];if(t instanceof THREE.DirectionalLight){x=o.normalWorld.dot(t.position)*t.intensity;if(x>0){j.r+=t.color.r*x;j.g+=t.color.g*x;j.b+=t.color.b*x}}else if(t instanceof THREE.PointLight){aa.sub(t.position,o.centroidWorld);aa.normalize();x=o.normalWorld.dot(aa)*t.intensity;if(x>0){j.r+=t.color.r*x;j.g+=t.color.g*x;j.b+=t.color.b*x}}}}function b(q,o,j,i,s,t){H=e(O++);H.setAttribute("d","M "+q.positionScreen.x+
|
|
|
|
+" "+q.positionScreen.y+" L "+o.positionScreen.x+" "+o.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");if(s instanceof THREE.MeshBasicMaterial)J.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshLambertMaterial)if(d){T.r=W.r;T.g=W.g;T.b=W.b;a(t,i,T);J.r=s.color.r*T.r;J.g=s.color.g*T.g;J.b=s.color.b*T.b;J.updateStyleString()}else J.__styleString=s.color.__styleString;else if(s instanceof THREE.MeshDepthMaterial){L=1-s.__2near/(s.__farPlusNear-i.z*s.__farMinusNear);
|
|
|
|
+J.setRGB(L,L,L)}else s instanceof THREE.MeshNormalMaterial&&J.setRGB(g(i.normalWorld.x),g(i.normalWorld.y),g(i.normalWorld.z));s.wireframe?H.setAttribute("style","fill: none; stroke: "+J.__styleString+"; stroke-width: "+s.wireframe_linewidth+"; stroke-opacity: "+s.opacity+"; stroke-linecap: "+s.wireframe_linecap+"; stroke-linejoin: "+s.wireframe_linejoin):H.setAttribute("style","fill: "+J.__styleString+"; fill-opacity: "+s.opacity);n.appendChild(H)}function c(q,o,j,i,s,t,x){H=e(O++);H.setAttribute("d",
|
|
|
|
+"M "+q.positionScreen.x+" "+q.positionScreen.y+" L "+o.positionScreen.x+" "+o.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+i.positionScreen.x+","+i.positionScreen.y+"z");if(t instanceof THREE.MeshBasicMaterial)J.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshLambertMaterial)if(d){T.r=W.r;T.g=W.g;T.b=W.b;a(x,s,T);J.r=t.color.r*T.r;J.g=t.color.g*T.g;J.b=t.color.b*T.b;J.updateStyleString()}else J.__styleString=t.color.__styleString;else if(t instanceof THREE.MeshDepthMaterial){L=
|
|
|
|
+1-t.__2near/(t.__farPlusNear-s.z*t.__farMinusNear);J.setRGB(L,L,L)}else t instanceof THREE.MeshNormalMaterial&&J.setRGB(g(s.normalWorld.x),g(s.normalWorld.y),g(s.normalWorld.z));t.wireframe?H.setAttribute("style","fill: none; stroke: "+J.__styleString+"; stroke-width: "+t.wireframe_linewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframe_linecap+"; stroke-linejoin: "+t.wireframe_linejoin):H.setAttribute("style","fill: "+J.__styleString+"; fill-opacity: "+t.opacity);n.appendChild(H)}
|
|
|
|
+function e(q){if(R[q]==null){R[q]=document.createElementNS("http://www.w3.org/2000/svg","path");f==0&&R[q].setAttribute("shape-rendering","crispEdges")}return R[q]}function g(q){return q<0?Math.min((1+q)*0.5,0.5):0.5+Math.min(q*0.5,0.5)}var h=null,m=new THREE.Projector,n=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,u,w,v,z,K,N,A=new THREE.Rectangle,p=new THREE.Rectangle,d=!1,J=new THREE.Color(16777215),T=new THREE.Color(16777215),W=new THREE.Color(0),ea=new THREE.Color(0),V=new THREE.Color(0),
|
|
|
|
+L,aa=new THREE.Vector3,R=[],ba=[],Q=[],H,O,ia,S,f=1;this.domElement=n;this.autoClear=!0;this.sortObjects=!0;this.sortElements=!0;this.setQuality=function(q){switch(q){case "high":f=1;break;case "low":f=0}};this.setSize=function(q,o){k=q;l=o;u=k/2;w=l/2;n.setAttribute("viewBox",-u+" "+-w+" "+k+" "+l);n.setAttribute("width",k);n.setAttribute("height",l);A.set(-u,-w,u,w)};this.clear=function(){for(;n.childNodes.length>0;)n.removeChild(n.childNodes[0])};this.render=function(q,o){var j,i,s,t,x,E,r,F;this.autoClear&&
|
|
|
|
+this.clear();h=m.projectScene(q,o,this.sortElements);S=ia=O=0;if(d=q.lights.length>0){r=q.lights;W.setRGB(0,0,0);ea.setRGB(0,0,0);V.setRGB(0,0,0);j=0;for(i=r.length;j<i;j++){s=r[j];t=s.color;if(s instanceof THREE.AmbientLight){W.r+=t.r;W.g+=t.g;W.b+=t.b}else if(s instanceof THREE.DirectionalLight){ea.r+=t.r;ea.g+=t.g;ea.b+=t.b}else if(s instanceof THREE.PointLight){V.r+=t.r;V.g+=t.g;V.b+=t.b}}}j=0;for(i=h.length;j<i;j++){r=h[j];p.empty();if(r instanceof THREE.RenderableParticle){v=r;v.x*=u;v.y*=-w;
|
|
|
|
+s=0;for(t=r.materials.length;s<t;s++)if(F=r.materials[s]){x=v;E=r;var B=ia++;if(ba[B]==null){ba[B]=document.createElementNS("http://www.w3.org/2000/svg","circle");f==0&&ba[B].setAttribute("shape-rendering","crispEdges")}H=ba[B];H.setAttribute("cx",x.x);H.setAttribute("cy",x.y);H.setAttribute("r",E.scale.x*u);if(F instanceof THREE.ParticleCircleMaterial){if(d){T.r=W.r+ea.r+V.r;T.g=W.g+ea.g+V.g;T.b=W.b+ea.b+V.b;J.r=F.color.r*T.r;J.g=F.color.g*T.g;J.b=F.color.b*T.b;J.updateStyleString()}else J=F.color;
|
|
|
|
+H.setAttribute("style","fill: "+J.__styleString)}n.appendChild(H)}}else if(r instanceof THREE.RenderableLine){v=r.v1;z=r.v2;v.positionScreen.x*=u;v.positionScreen.y*=-w;z.positionScreen.x*=u;z.positionScreen.y*=-w;p.addPoint(v.positionScreen.x,v.positionScreen.y);p.addPoint(z.positionScreen.x,z.positionScreen.y);if(A.instersects(p)){s=0;for(t=r.materials.length;s<t;)if(F=r.materials[s++]){x=v;E=z;B=S++;if(Q[B]==null){Q[B]=document.createElementNS("http://www.w3.org/2000/svg","line");f==0&&Q[B].setAttribute("shape-rendering",
|
|
|
|
+"crispEdges")}H=Q[B];H.setAttribute("x1",x.positionScreen.x);H.setAttribute("y1",x.positionScreen.y);H.setAttribute("x2",E.positionScreen.x);H.setAttribute("y2",E.positionScreen.y);if(F instanceof THREE.LineBasicMaterial){J.__styleString=F.color.__styleString;H.setAttribute("style","fill: none; stroke: "+J.__styleString+"; stroke-width: "+F.linewidth+"; stroke-opacity: "+F.opacity+"; stroke-linecap: "+F.linecap+"; stroke-linejoin: "+F.linejoin);n.appendChild(H)}}}}else if(r instanceof THREE.RenderableFace3){v=
|
|
|
|
+r.v1;z=r.v2;K=r.v3;v.positionScreen.x*=u;v.positionScreen.y*=-w;z.positionScreen.x*=u;z.positionScreen.y*=-w;K.positionScreen.x*=u;K.positionScreen.y*=-w;p.addPoint(v.positionScreen.x,v.positionScreen.y);p.addPoint(z.positionScreen.x,z.positionScreen.y);p.addPoint(K.positionScreen.x,K.positionScreen.y);if(A.instersects(p)){s=0;for(t=r.meshMaterials.length;s<t;){F=r.meshMaterials[s++];if(F instanceof THREE.MeshFaceMaterial){x=0;for(E=r.faceMaterials.length;x<E;)(F=r.faceMaterials[x++])&&b(v,z,K,r,
|
|
|
|
+F,q)}else F&&b(v,z,K,r,F,q)}}}else if(r instanceof THREE.RenderableFace4){v=r.v1;z=r.v2;K=r.v3;N=r.v4;v.positionScreen.x*=u;v.positionScreen.y*=-w;z.positionScreen.x*=u;z.positionScreen.y*=-w;K.positionScreen.x*=u;K.positionScreen.y*=-w;N.positionScreen.x*=u;N.positionScreen.y*=-w;p.addPoint(v.positionScreen.x,v.positionScreen.y);p.addPoint(z.positionScreen.x,z.positionScreen.y);p.addPoint(K.positionScreen.x,K.positionScreen.y);p.addPoint(N.positionScreen.x,N.positionScreen.y);if(A.instersects(p)){s=
|
|
|
|
+0;for(t=r.meshMaterials.length;s<t;){F=r.meshMaterials[s++];if(F instanceof THREE.MeshFaceMaterial){x=0;for(E=r.faceMaterials.length;x<E;)(F=r.faceMaterials[x++])&&c(v,z,K,N,r,F,q)}else F&&c(v,z,K,N,r,F,q)}}}}}};
|
|
|
|
+THREE.WebGLRenderer=function(a){function b(f,q,o){var j,i,s,t=f.vertices,x=t.length,E=f.colors,r=E.length,F=f.__vertexArray,B=f.__colorArray,Y=f.__sortArray,ga=f.__dirtyVertices,oa=f.__dirtyColors;if(o.sortParticles){aa.multiplySelf(o.globalMatrix);for(j=0;j<x;j++){i=t[j].position;H.copy(i);aa.multiplyVector3(H);Y[j]=[H.z,j]}Y.sort(function(ua,Z){return Z[0]-ua[0]});for(j=0;j<x;j++){i=t[Y[j][1]].position;s=j*3;F[s]=i.x;F[s+1]=i.y;F[s+2]=i.z}for(j=0;j<r;j++){s=j*3;color=E[Y[j][1]];B[s]=color.r;B[s+
|
|
|
|
+1]=color.g;B[s+2]=color.b}}else{if(ga)for(j=0;j<x;j++){i=t[j].position;s=j*3;F[s]=i.x;F[s+1]=i.y;F[s+2]=i.z}if(oa)for(j=0;j<r;j++){color=E[j];s=j*3;B[s]=color.r;B[s+1]=color.g;B[s+2]=color.b}}if(ga||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,F,q)}if(oa||o.sortParticles){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,B,q)}}function c(f,q){f.fragment_shader=q.fragment_shader;f.vertex_shader=q.vertex_shader;f.uniforms=
|
|
|
|
+Uniforms.clone(q.uniforms)}function e(f,q){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=d.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=d.createBuffer();if(f.hasPos){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,f.positionArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(q.attributes.position);d.vertexAttribPointer(q.attributes.position,3,d.FLOAT,!1,0,0)}if(f.hasNormal){d.bindBuffer(d.ARRAY_BUFFER,f.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,
|
|
|
|
+f.normalArray,d.DYNAMIC_DRAW);d.enableVertexAttribArray(q.attributes.normal);d.vertexAttribPointer(q.attributes.normal,3,d.FLOAT,!1,0,0)}d.drawArrays(d.TRIANGLES,0,f.count);f.count=0}function g(f){if(W!=f.doubleSided){f.doubleSided?d.disable(d.CULL_FACE):d.enable(d.CULL_FACE);W=f.doubleSided}if(ea!=f.flipSided){f.flipSided?d.frontFace(d.CW):d.frontFace(d.CCW);ea=f.flipSided}}function h(f){L[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);L[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+
|
|
|
|
+f.n14);L[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);L[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);L[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);L[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var q;for(f=0;f<5;f++){q=L[f];q.divideScalar(Math.sqrt(q.x*q.x+q.y*q.y+q.z*q.z))}}function m(f){for(var q=f.globalMatrix,o=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),j=0;j<6;j++){f=L[j].x*q.n14+L[j].y*q.n24+L[j].z*q.n34+L[j].w;
|
|
|
|
+if(f<=o)return!1}return!0}function n(f,q){f.list[f.count]=q;f.count+=1}function k(f){var q,o,j=f.object,i=f.opaque,s=f.transparent;s.count=0;f=i.count=0;for(q=j.materials.length;f<q;f++){o=j.materials[f];o.opacity&&o.opacity<1||o.blending!=THREE.NormalBlending?n(s,o):n(i,o)}}function l(f){var q,o,j,i,s=f.object,t=f.buffer,x=f.opaque,E=f.transparent;E.count=0;f=x.count=0;for(j=s.materials.length;f<j;f++){q=s.materials[f];if(q instanceof THREE.MeshFaceMaterial){q=0;for(o=t.materials.length;q<o;q++)(i=
|
|
|
|
+t.materials[q])&&(i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?n(E,i):n(x,i))}else{i=q;i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?n(E,i):n(x,i)}}}function u(f,q){return q.z-f.z}function w(f,q,o,j,i){if(q[o]==undefined){f.push({buffer:j,object:i,opaque:{list:[],count:0},transparent:{list:[],count:0}});q[o]=1}}function v(f,q){f._modelViewMatrix.multiplyToArray(q.globalMatrix,f.globalMatrix,f._modelViewMatrixArray);f._normalMatrix=THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}
|
|
|
|
+function z(f){if(f!=V){switch(f){case THREE.AdditiveBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE);break;case THREE.SubtractiveBlending:d.blendFunc(d.DST_COLOR,d.ZERO);break;case THREE.BillboardBlending:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.SRC_ALPHA,d.ONE_MINUS_SRC_ALPHA);break;default:d.blendEquation(d.FUNC_ADD);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA)}V=f}}function K(f,q){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=d.createFramebuffer();f.__webGLRenderbuffer=d.createRenderbuffer();
|
|
|
|
+f.__webGLTexture=d.createTexture();d.bindRenderbuffer(d.RENDERBUFFER,f.__webGLRenderbuffer);d.renderbufferStorage(d.RENDERBUFFER,d.DEPTH_COMPONENT16,f.width,f.height);d.bindTexture(d.TEXTURE_2D,f.__webGLTexture);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,A(f.wrap_s));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,A(f.wrap_t));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,A(f.mag_filter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,A(f.min_filter));d.texImage2D(d.TEXTURE_2D,0,A(f.format),
|
|
|
|
+f.width,f.height,0,A(f.format),A(f.type),null);d.bindFramebuffer(d.FRAMEBUFFER,f.__webGLFramebuffer);d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0,d.TEXTURE_2D,f.__webGLTexture,0);d.framebufferRenderbuffer(d.FRAMEBUFFER,d.DEPTH_ATTACHMENT,d.RENDERBUFFER,f.__webGLRenderbuffer);d.bindTexture(d.TEXTURE_2D,null);d.bindRenderbuffer(d.RENDERBUFFER,null);d.bindFramebuffer(d.FRAMEBUFFER,null)}var o,j,i;if(f){o=f.__webGLFramebuffer;j=f.width;i=f.height}else{o=null;j=p.width;i=p.height}if(o!=T){d.bindFramebuffer(d.FRAMEBUFFER,
|
|
|
|
+o);d.viewport(0,0,j,i);q&&d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT);T=o}}function N(f,q){var o;if(f=="fragment")o=d.createShader(d.FRAGMENT_SHADER);else f=="vertex"&&(o=d.createShader(d.VERTEX_SHADER));d.shaderSource(o,q);d.compileShader(o);if(!d.getShaderParameter(o,d.COMPILE_STATUS)){alert(d.getShaderInfoLog(o));return null}return o}function A(f){switch(f){case THREE.RepeatWrapping:return d.REPEAT;case THREE.ClampToEdgeWrapping:return d.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return d.MIRRORED_REPEAT;
|
|
|
|
+case THREE.NearestFilter:return d.NEAREST;case THREE.NearestMipMapNearestFilter:return d.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return d.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return d.LINEAR;case THREE.LinearMipMapNearestFilter:return d.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return d.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return d.BYTE;case THREE.UnsignedByteType:return d.UNSIGNED_BYTE;case THREE.ShortType:return d.SHORT;case THREE.UnsignedShortType:return d.UNSIGNED_SHORT;
|
|
|
|
+case THREE.IntType:return d.INT;case THREE.UnsignedShortType:return d.UNSIGNED_INT;case THREE.FloatType:return d.FLOAT;case THREE.AlphaFormat:return d.ALPHA;case THREE.RGBFormat:return d.RGB;case THREE.RGBAFormat:return d.RGBA;case THREE.LuminanceFormat:return d.LUMINANCE;case THREE.LuminanceAlphaFormat:return d.LUMINANCE_ALPHA}return 0}var p=document.createElement("canvas"),d,J=null,T=null,W=null,ea=null,V=null,L=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
|
|
|
|
+new THREE.Vector4],aa=new THREE.Matrix4,R=new Float32Array(16),ba=new Float32Array(16),Q=new Float32Array(16),H=new THREE.Vector4,O=!0,ia=new THREE.Color(0),S=0;if(a){if(a.antialias!==undefined)O=a.antialias;a.clearColor!==undefined&&ia.setHex(a.clearColor);if(a.clearAlpha!==undefined)S=a.clearAlpha}this.domElement=p;this.autoClear=!0;this.sortObjects=!1;(function(f,q,o){try{d=p.getContext("experimental-webgl",{antialias:f})}catch(j){console.log(j)}if(!d){alert("WebGL not supported");throw"cannot create webgl context";
|
|
|
|
+}d.clearColor(0,0,0,1);d.clearDepth(1);d.enable(d.DEPTH_TEST);d.depthFunc(d.LEQUAL);d.frontFace(d.CCW);d.cullFace(d.BACK);d.enable(d.CULL_FACE);d.enable(d.BLEND);d.blendFunc(d.ONE,d.ONE_MINUS_SRC_ALPHA);d.clearColor(q.r,q.g,q.b,o);_cullEnabled=!0})(O,ia,S);this.context=d;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,q){p.width=f;p.height=q;d.viewport(0,0,p.width,p.height)};this.setClearColorHex=function(f,
|
|
|
|
+q){var o=new THREE.Color(f);d.clearColor(o.r,o.g,o.b,q)};this.setClearColor=function(f,q){d.clearColor(f.r,f.g,f.b,q)};this.clear=function(){d.clear(d.COLOR_BUFFER_BIT|d.DEPTH_BUFFER_BIT)};this.setupLights=function(f,q){var o,j,i,s=0,t=0,x=0,E,r,F,B=this.lights,Y=B.directional.colors,ga=B.directional.positions,oa=B.point.colors,ua=B.point.positions,Z=0,fa=0;o=i=i=0;for(j=q.length;o<j;o++){i=q[o];E=i.color;r=i.position;F=i.intensity;if(i instanceof THREE.AmbientLight){s+=E.r;t+=E.g;x+=E.b}else if(i instanceof
|
|
|
|
+THREE.DirectionalLight){i=Z*3;Y[i]=E.r*F;Y[i+1]=E.g*F;Y[i+2]=E.b*F;ga[i]=r.x;ga[i+1]=r.y;ga[i+2]=r.z;Z+=1}else if(i instanceof THREE.PointLight){i=fa*3;oa[i]=E.r*F;oa[i+1]=E.g*F;oa[i+2]=E.b*F;ua[i]=r.x;ua[i+1]=r.y;ua[i+2]=r.z;fa+=1}}for(o=Z*3;o<Y.length;o++)Y[o]=0;for(o=fa*3;o<oa.length;o++)oa[o]=0;B.point.length=fa;B.directional.length=Z;B.ambient[0]=s;B.ambient[1]=t;B.ambient[2]=x};this.initMaterial=function(f,q,o){var j,i;if(f instanceof THREE.MeshDepthMaterial)c(f,THREE.ShaderLib.depth);else if(f instanceof
|
|
|
|
+THREE.MeshNormalMaterial)c(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)c(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)c(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)c(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)c(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&c(f,THREE.ShaderLib.particle_basic);var s,t,x,E;i=x=E=0;for(s=q.length;i<s;i++){t=q[i];t instanceof THREE.DirectionalLight&&
|
|
|
|
+x++;t instanceof THREE.PointLight&&E++}if(E+x<=4)q=x;else{q=Math.ceil(4*x/(E+x));E=4-q}i={directional:q,point:E};E=f.fragment_shader;q=f.vertex_shader;s={fog:o,map:f.map,env_map:f.env_map,light_map:f.light_map,vertex_colors:f.vertex_colors,skinning:f.skinning,maxDirLights:i.directional,maxPointLights:i.point};o=d.createProgram();i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights,s.fog?"#define USE_FOG":"",s.fog instanceof
|
|
|
|
+THREE.FogExp2?"#define FOG_EXP2":"",s.map?"#define USE_MAP":"",s.env_map?"#define USE_ENVMAP":"",s.light_map?"#define USE_LIGHTMAP":"",s.vertex_colors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");s=[d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+s.maxDirLights,"#define MAX_POINT_LIGHTS "+s.maxPointLights,s.map?"#define USE_MAP":"",s.env_map?"#define USE_ENVMAP":"",s.light_map?"#define USE_LIGHTMAP":
|
|
|
|
+"",s.vertex_colors?"#define USE_COLOR":"",s.skinning?"#define USE_SKINNING":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
|
+d.attachShader(o,N("fragment",i+E));d.attachShader(o,N("vertex",s+q));d.linkProgram(o);d.getProgramParameter(o,d.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+d.getProgramParameter(o,d.VALIDATE_STATUS)+", gl error ["+d.getError()+"]");o.uniforms={};o.attributes={};f.program=o;o=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","uBoneGlobalMatrices"];for(j in f.uniforms)o.push(j);j=f.program;E=0;for(q=o.length;E<
|
|
|
|
+q;E++){i=o[E];j.uniforms[i]=d.getUniformLocation(j,i)}f=f.program;j=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];o=0;for(E=j.length;o<E;o++){q=j[o];f.attributes[q]=d.getAttribLocation(f,q)}};this.setProgram=function(f,q,o,j,i){j.program||this.initMaterial(j,q,o);var s=j.program,t=s.uniforms,x=j.uniforms;if(s!=J){d.useProgram(s);J=s;d.uniformMatrix4fv(t.projectionMatrix,!1,R)}if(o&&(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||
|
|
|
|
+j instanceof THREE.MeshPhongMaterial||j instanceof THREE.LineBasicMaterial||j instanceof THREE.ParticleBasicMaterial)){x.fogColor.value.setHex(o.color.hex);if(o instanceof THREE.Fog){x.fogNear.value=o.near;x.fogFar.value=o.far}else if(o instanceof THREE.FogExp2)x.fogDensity.value=o.density}if(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial){this.setupLights(s,q);q=this.lights;x.enableLighting.value=q.directional.length+q.point.length;x.ambientLightColor.value=q.ambient;
|
|
|
|
+x.directionalLightColor.value=q.directional.colors;x.directionalLightDirection.value=q.directional.positions;x.pointLightColor.value=q.point.colors;x.pointLightPosition.value=q.point.positions}if(j instanceof THREE.MeshBasicMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshPhongMaterial){x.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);x.opacity.value=j.opacity;x.map.texture=j.map;x.light_map.texture=j.light_map;x.env_map.texture=j.env_map;
|
|
|
|
+x.reflectivity.value=j.reflectivity;x.refraction_ratio.value=j.refraction_ratio;x.combine.value=j.combine;x.useRefract.value=j.env_map&&j.env_map.mapping instanceof THREE.CubeRefractionMapping}if(j instanceof THREE.LineBasicMaterial){x.diffuse.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);x.opacity.value=j.opacity}else if(j instanceof THREE.ParticleBasicMaterial){x.psColor.value.setRGB(j.color.r*j.opacity,j.color.g*j.opacity,j.color.b*j.opacity);x.opacity.value=j.opacity;
|
|
|
|
+x.size.value=j.size;x.map.texture=j.map}else if(j instanceof THREE.MeshPhongMaterial){x.ambient.value.setRGB(j.ambient.r,j.ambient.g,j.ambient.b);x.specular.value.setRGB(j.specular.r,j.specular.g,j.specular.b);x.shininess.value=j.shininess}else if(j instanceof THREE.MeshDepthMaterial){x.mNear.value=f.near;x.mFar.value=f.far;x.opacity.value=j.opacity}else if(j instanceof THREE.MeshNormalMaterial)x.opacity.value=j.opacity;var E,r,F;for(E in x)if(F=s.uniforms[E]){o=x[E];r=o.type;q=o.value;if(r=="i")d.uniform1i(F,
|
|
|
|
+q);else if(r=="f")d.uniform1f(F,q);else if(r=="fv1")d.uniform1fv(F,q);else if(r=="fv")d.uniform3fv(F,q);else if(r=="v2")d.uniform2f(F,q.x,q.y);else if(r=="v3")d.uniform3f(F,q.x,q.y,q.z);else if(r=="c")d.uniform3f(F,q.r,q.g,q.b);else if(r=="t"){d.uniform1i(F,q);if(o=o.texture)if(o.image instanceof Array&&o.image.length==6){if(o.image.length==6){if(!o.image.__webGLTextureCube&&!o.image.__cubeMapInitialized&&o.image.loadCount==6){o.image.__webGLTextureCube=d.createTexture();d.bindTexture(d.TEXTURE_CUBE_MAP,
|
|
|
|
+o.image.__webGLTextureCube);d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_WRAP_S,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_WRAP_T,d.CLAMP_TO_EDGE);d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_MAG_FILTER,d.LINEAR);d.texParameteri(d.TEXTURE_CUBE_MAP,d.TEXTURE_MIN_FILTER,d.LINEAR_MIPMAP_LINEAR);for(r=0;r<6;++r)d.texImage2D(d.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image[r]);d.generateMipmap(d.TEXTURE_CUBE_MAP);d.bindTexture(d.TEXTURE_CUBE_MAP,null);o.image.__cubeMapInitialized=
|
|
|
|
+!0}d.activeTexture(d.TEXTURE0+q);d.bindTexture(d.TEXTURE_CUBE_MAP,o.image.__webGLTextureCube)}}else{if(!o.__webGLTexture&&o.image.loaded){o.__webGLTexture=d.createTexture();d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.texImage2D(d.TEXTURE_2D,0,d.RGBA,d.RGBA,d.UNSIGNED_BYTE,o.image);d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,A(o.wrap_s));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,A(o.wrap_t));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,A(o.mag_filter));d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,
|
|
|
|
+A(o.min_filter));d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}d.activeTexture(d.TEXTURE0+q);d.bindTexture(d.TEXTURE_2D,o.__webGLTexture)}}}d.uniformMatrix4fv(t.modelViewMatrix,!1,i._modelViewMatrixArray);d.uniformMatrix3fv(t.normalMatrix,!1,i._normalMatrixArray);(j instanceof THREE.MeshShaderMaterial||j instanceof THREE.MeshPhongMaterial||j.env_map)&&d.uniform3f(t.cameraPosition,f.position.x,f.position.y,f.position.z);(j instanceof THREE.MeshShaderMaterial||j.env_map||j.skinning)&&
|
|
|
|
+d.uniformMatrix4fv(t.objectMatrix,!1,i._objectMatrixArray);(j instanceof THREE.MeshPhongMaterial||j instanceof THREE.MeshLambertMaterial||j instanceof THREE.MeshShaderMaterial||j.skinning)&&d.uniformMatrix4fv(t.viewMatrix,!1,Q);if(j.skinning){d.uniformMatrix4fv(t.cameraInverseMatrix,!1,ba);d.uniformMatrix4fv(t.uBoneGlobalMatrices,!1,i.boneMatrices)}return s};this.renderBuffer=function(f,q,o,j,i,s){f=this.setProgram(f,q,o,j,s).attributes;d.bindBuffer(d.ARRAY_BUFFER,i.__webGLVertexBuffer);d.vertexAttribPointer(f.position,
|
|
|
|
+3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.position);if(f.color>=0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLColorBuffer);d.vertexAttribPointer(f.color,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.color)}if(f.normal>=0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLNormalBuffer);d.vertexAttribPointer(f.normal,3,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.normal)}if(f.tangent>=0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLTangentBuffer);d.vertexAttribPointer(f.tangent,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.tangent)}if(f.uv>=
|
|
|
|
+0)if(i.__webGLUVBuffer){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUVBuffer);d.vertexAttribPointer(f.uv,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv)}else d.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(i.__webGLUV2Buffer){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUV2Buffer);d.vertexAttribPointer(f.uv2,2,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.uv2)}else d.disableVertexAttribArray(f.uv2);if(s instanceof THREE.SkinnedMesh){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);d.vertexAttribPointer(f.skinVertexA,
|
|
|
|
+4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinVertexA);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);d.vertexAttribPointer(f.skinVertexB,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinVertexB);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);d.vertexAttribPointer(f.skinIndex,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinIndex);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);d.vertexAttribPointer(f.skinWeight,4,d.FLOAT,!1,0,0);d.enableVertexAttribArray(f.skinWeight)}if(s instanceof
|
|
|
|
+THREE.Mesh)if(j.wireframe){d.lineWidth(j.wireframe_linewidth);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);d.drawElements(d.LINES,i.__webGLLineCount,d.UNSIGNED_SHORT,0)}else{d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);d.drawElements(d.TRIANGLES,i.__webGLFaceCount,d.UNSIGNED_SHORT,0)}else if(s instanceof THREE.Line){s=s.type==THREE.LineStrip?d.LINE_STRIP:d.LINES;d.lineWidth(j.linewidth);d.drawArrays(s,0,i.__webGLLineCount)}else s instanceof THREE.ParticleSystem&&d.drawArrays(d.POINTS,
|
|
|
|
+0,i.__webGLParticleCount)};this.render=function(f,q,o,j){var i,s,t,x,E,r,F,B=f.lights,Y=f.fog;q.autoUpdateMatrix&&q.update();q.globalMatrix.flattenToArray(Q);q.projectionMatrix.flattenToArray(R);q.inverseMatrix.flattenToArray(ba);aa.multiply(q.projectionMatrix,q.globalMatrix);h(aa);THREE.AnimationHandler&&THREE.AnimationHandler.update();f.update(undefined,!1,q,this);this.initWebGLObjects(f,q);K(o,j!==undefined?j:!0);this.autoClear&&this.clear();x=f.__webGLObjects.length;for(j=0;j<x;j++){i=f.__webGLObjects[j];
|
|
|
|
+r=i.object;if(r.visible)if(!(r instanceof THREE.Mesh)||m(r)){r.globalMatrix.flattenToArray(r._objectMatrixArray);v(r,q);l(i);i.render=!0;if(this.sortObjects){H.copy(r.position);aa.multiplyVector3(H);i.z=H.z}}else i.render=!1;else i.render=!1}this.sortObjects&&f.__webGLObjects.sort(u);E=f.__webGLObjectsImmediate.length;for(j=0;j<E;j++){i=f.__webGLObjectsImmediate[j];r=i.object;if(r.visible){r.autoUpdateMatrix&&r.globalMatrix.flattenToArray(r._objectMatrixArray);v(r,q);k(i)}}z(THREE.NormalBlending);
|
|
|
|
+for(j=0;j<x;j++){i=f.__webGLObjects[j];if(i.render){r=i.object;F=i.buffer;t=i.opaque;g(r);for(i=0;i<t.count;i++){material=t.list[i];this.setDepthTest(material.depth_test);this.renderBuffer(q,B,Y,material,F,r)}}}for(j=0;j<E;j++){i=f.__webGLObjectsImmediate[j];r=i.object;if(r.visible){t=i.opaque;g(r);for(i=0;i<t.count;i++){material=t.list[i];this.setDepthTest(material.depth_test);s=this.setProgram(q,B,Y,material,r);r.render(function(ga){e(ga,s)})}}}for(j=0;j<x;j++){i=f.__webGLObjects[j];if(i.render){r=
|
|
|
|
+i.object;F=i.buffer;t=i.transparent;g(r);for(i=0;i<t.count;i++){material=t.list[i];z(material.blending);this.setDepthTest(material.depth_test);this.renderBuffer(q,B,Y,material,F,r)}}}for(j=0;j<E;j++){i=f.__webGLObjectsImmediate[j];r=i.object;if(r.visible){t=i.transparent;g(r);for(i=0;i<t.count;i++){material=t.list[i];z(material.blending);this.setDepthTest(material.depth_test);s=this.setProgram(q,B,Y,material,r);r.render(function(ga){e(ga,s)})}}}if(o&&o.min_filter!==THREE.NearestFilter&&o.min_filter!==
|
|
|
|
+THREE.LinearFilter){d.bindTexture(d.TEXTURE_2D,o.__webGLTexture);d.generateMipmap(d.TEXTURE_2D);d.bindTexture(d.TEXTURE_2D,null)}};this.initWebGLObjects=function(f){var q,o,j;if(!f.__webGLObjects){f.__webGLObjects=[];f.__webGLObjectsMap={};f.__webGLObjectsImmediate=[]}q=0;for(o=f.objects.length;q<o;q++){j=f.objects[q];var i=f,s=void 0,t=void 0,x=void 0,E=void 0;t=j.geometry;if(i.__webGLObjectsMap[j.id]==undefined){i.__webGLObjectsMap[j.id]={};j._modelViewMatrix=new THREE.Matrix4;j._normalMatrixArray=
|
|
|
|
+new Float32Array(9);j._modelViewMatrixArray=new Float32Array(16);j._objectMatrixArray=new Float32Array(16);j.globalMatrix.flattenToArray(j._objectMatrixArray)}E=i.__webGLObjectsMap[j.id];objlist=i.__webGLObjects;if(j instanceof THREE.Mesh){for(s in t.geometryChunks){x=t.geometryChunks[s];if(!x.__webGLVertexBuffer){i=x;i.__webGLVertexBuffer=d.createBuffer();i.__webGLNormalBuffer=d.createBuffer();i.__webGLTangentBuffer=d.createBuffer();i.__webGLColorBuffer=d.createBuffer();i.__webGLUVBuffer=d.createBuffer();
|
|
|
|
+i.__webGLUV2Buffer=d.createBuffer();i.__webGLSkinVertexABuffer=d.createBuffer();i.__webGLSkinVertexBBuffer=d.createBuffer();i.__webGLSkinIndicesBuffer=d.createBuffer();i.__webGLSkinWeightsBuffer=d.createBuffer();i.__webGLFaceBuffer=d.createBuffer();i.__webGLLineBuffer=d.createBuffer();i=x;var r=j,F=void 0,B=void 0,Y=0,ga=0,oa=0,ua=r.geometry.faces,Z=i.faces;F=0;for(B=Z.length;F<B;F++){fi=Z[F];face=ua[fi];if(face instanceof THREE.Face3){Y+=3;ga+=1;oa+=3}else if(face instanceof THREE.Face4){Y+=4;ga+=
|
|
|
|
+2;oa+=4}}i.__vertexArray=new Float32Array(Y*3);i.__normalArray=new Float32Array(Y*3);i.__tangentArray=new Float32Array(Y*4);i.__colorArray=new Float32Array(Y*3);i.__uvArray=new Float32Array(Y*2);i.__uv2Array=new Float32Array(Y*2);i.__skinVertexAArray=new Float32Array(Y*4);i.__skinVertexBArray=new Float32Array(Y*4);i.__skinIndexArray=new Float32Array(Y*4);i.__skinWeightArray=new Float32Array(Y*4);i.__faceArray=new Uint16Array(ga*3);i.__lineArray=new Uint16Array(oa*2);B=F=i;Y=void 0;ua=void 0;var fa=
|
|
|
|
+void 0,ha=void 0;fa=void 0;Z=!1;Y=0;for(ua=r.materials.length;Y<ua;Y++){fa=r.materials[Y];if(fa instanceof THREE.MeshFaceMaterial){fa=0;for(ha=B.materials.length;fa<ha;fa++)if(B.materials[fa]&&B.materials[fa].shading!=undefined&&B.materials[fa].shading==THREE.SmoothShading){Z=!0;break}}else if(fa&&fa.shading!=undefined&&fa.shading==THREE.SmoothShading){Z=!0;break}if(Z)break}F.__needsSmoothNormals=Z;i.__webGLFaceCount=ga*3;i.__webGLLineCount=oa*2;t.__dirtyVertices=!0;t.__dirtyElements=!0;t.__dirtyUvs=
|
|
|
|
+!0;t.__dirtyNormals=!0;t.__dirtyTangents=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyElements||t.__dirtyUvs||t.__dirtyNormals||t.__dirtyColors||t.__dirtyTangents){i=x;ga=d.DYNAMIC_DRAW;oa=void 0;F=void 0;var Ia=void 0,C=void 0,Ca=void 0,wa=void 0,za=void 0;Ia=void 0;var G=void 0,M=void 0,P=void 0,ja=void 0;G=void 0;M=void 0;P=void 0;C=void 0;G=void 0;M=void 0;P=void 0;ja=void 0;G=void 0;M=void 0;P=void 0;ja=void 0;G=void 0;M=void 0;P=void 0;ja=void 0;G=void 0;M=void 0;P=void 0;ja=void 0;
|
|
|
|
+G=void 0;M=void 0;P=void 0;ja=void 0;C=void 0;wa=void 0;Ca=void 0;za=void 0;var Ea=ha=fa=Z=ua=Y=r=B=0,ra=0,y=0,pa=i.__vertexArray,Ma=i.__uvArray,Ka=i.__uv2Array,Ha=i.__normalArray,la=i.__tangentArray,qa=i.__colorArray,ma=i.__skinVertexAArray,ka=i.__skinVertexBArray,na=i.__skinIndexArray,$=i.__skinWeightArray,xa=i.__faceArray,va=i.__lineArray,Oa=i.__needsSmoothNormals,ya=j.geometry,Na=ya.__dirtyVertices,D=ya.__dirtyElements,ca=ya.__dirtyUvs,X=ya.__dirtyNormals,I=ya.__dirtyTangents,U=ya.__dirtyColors,
|
|
|
|
+da=ya.vertices,sa=i.faces,Aa=ya.faces,Da=ya.uvs,La=ya.uvs2,ta=ya.colors,Ga=ya.skinVerticesA,Ja=ya.skinVerticesB,Fa=ya.skinIndices,Ba=ya.skinWeights;oa=0;for(F=sa.length;oa<F;oa++){Ia=sa[oa];C=Aa[Ia];za=Da[Ia];Ia=La[Ia];Ca=C.vertexNormals;wa=C.normal;if(C instanceof THREE.Face3){if(Na){G=da[C.a].position;M=da[C.b].position;P=da[C.c].position;pa[r]=G.x;pa[r+1]=G.y;pa[r+2]=G.z;pa[r+3]=M.x;pa[r+4]=M.y;pa[r+5]=M.z;pa[r+6]=P.x;pa[r+7]=P.y;pa[r+8]=P.z;r+=9}if(Ba.length){G=Ba[C.a];M=Ba[C.b];P=Ba[C.c];$[y]=
|
|
|
|
+G.x;$[y+1]=G.y;$[y+2]=G.z;$[y+3]=G.w;$[y+4]=M.x;$[y+5]=M.y;$[y+6]=M.z;$[y+7]=M.w;$[y+8]=P.x;$[y+9]=P.y;$[y+10]=P.z;$[y+11]=P.w;G=Fa[C.a];M=Fa[C.b];P=Fa[C.c];na[y]=G.x;na[y+1]=G.y;na[y+2]=G.z;na[y+3]=G.w;na[y+4]=M.x;na[y+5]=M.y;na[y+6]=M.z;na[y+7]=M.w;na[y+8]=P.x;na[y+9]=P.y;na[y+10]=P.z;na[y+11]=P.w;G=Ga[C.a];M=Ga[C.b];P=Ga[C.c];ma[y]=G.x;ma[y+1]=G.y;ma[y+2]=G.z;ma[y+3]=1;ma[y+4]=M.x;ma[y+5]=M.y;ma[y+6]=M.z;ma[y+7]=1;ma[y+8]=P.x;ma[y+9]=P.y;ma[y+10]=P.z;ma[y+11]=1;G=Ja[C.a];M=Ja[C.b];P=Ja[C.c];ka[y]=
|
|
|
|
+G.x;ka[y+1]=G.y;ka[y+2]=G.z;ka[y+3]=1;ka[y+4]=M.x;ka[y+5]=M.y;ka[y+6]=M.z;ka[y+7]=1;ka[y+8]=P.x;ka[y+9]=P.y;ka[y+10]=P.z;ka[y+11]=1;y+=12}if(U&&ta.length){G=ta[C.a];M=ta[C.b];P=ta[C.c];qa[ra]=G.r;qa[ra+1]=G.g;qa[ra+2]=G.b;qa[ra+3]=M.r;qa[ra+4]=M.g;qa[ra+5]=M.b;qa[ra+6]=P.r;qa[ra+7]=P.g;qa[ra+8]=P.b;ra+=9}if(I&&ya.hasTangents){G=da[C.a].tangent;M=da[C.b].tangent;P=da[C.c].tangent;la[ha]=G.x;la[ha+1]=G.y;la[ha+2]=G.z;la[ha+3]=G.w;la[ha+4]=M.x;la[ha+5]=M.y;la[ha+6]=M.z;la[ha+7]=M.w;la[ha+8]=P.x;la[ha+
|
|
|
|
+9]=P.y;la[ha+10]=P.z;la[ha+11]=P.w;ha+=12}if(X)if(Ca.length==3&&Oa)for(C=0;C<3;C++){wa=Ca[C];Ha[fa]=wa.x;Ha[fa+1]=wa.y;Ha[fa+2]=wa.z;fa+=3}else for(C=0;C<3;C++){Ha[fa]=wa.x;Ha[fa+1]=wa.y;Ha[fa+2]=wa.z;fa+=3}if(ca&&za)for(C=0;C<3;C++){Ca=za[C];Ma[Y]=Ca.u;Ma[Y+1]=Ca.v;Y+=2}if(ca&&Ia)for(C=0;C<3;C++){za=Ia[C];Ka[ua]=za.u;Ka[ua+1]=za.v;ua+=2}if(D){xa[Z]=B;xa[Z+1]=B+1;xa[Z+2]=B+2;Z+=3;va[Ea]=B;va[Ea+1]=B+1;va[Ea+2]=B;va[Ea+3]=B+2;va[Ea+4]=B+1;va[Ea+5]=B+2;Ea+=6;B+=3}}else if(C instanceof THREE.Face4){if(Na){G=
|
|
|
|
+da[C.a].position;M=da[C.b].position;P=da[C.c].position;ja=da[C.d].position;pa[r]=G.x;pa[r+1]=G.y;pa[r+2]=G.z;pa[r+3]=M.x;pa[r+4]=M.y;pa[r+5]=M.z;pa[r+6]=P.x;pa[r+7]=P.y;pa[r+8]=P.z;pa[r+9]=ja.x;pa[r+10]=ja.y;pa[r+11]=ja.z;r+=12}if(Ba.length){G=Ba[C.a];M=Ba[C.b];P=Ba[C.c];ja=Ba[C.d];$[y]=G.x;$[y+1]=G.y;$[y+2]=G.z;$[y+3]=G.w;$[y+4]=M.x;$[y+5]=M.y;$[y+6]=M.z;$[y+7]=M.w;$[y+8]=P.x;$[y+9]=P.y;$[y+10]=P.z;$[y+11]=P.w;$[y+12]=ja.x;$[y+13]=ja.y;$[y+14]=ja.z;$[y+15]=ja.w;G=Fa[C.a];M=Fa[C.b];P=Fa[C.c];ja=Fa[C.d];
|
|
|
|
+na[y]=G.x;na[y+1]=G.y;na[y+2]=G.z;na[y+3]=G.w;na[y+4]=M.x;na[y+5]=M.y;na[y+6]=M.z;na[y+7]=M.w;na[y+8]=P.x;na[y+9]=P.y;na[y+10]=P.z;na[y+11]=P.w;na[y+12]=ja.x;na[y+13]=ja.y;na[y+14]=ja.z;na[y+15]=ja.w;G=Ga[C.a];M=Ga[C.b];P=Ga[C.c];ja=Ga[C.d];ma[y]=G.x;ma[y+1]=G.y;ma[y+2]=G.z;ma[y+3]=1;ma[y+4]=M.x;ma[y+5]=M.y;ma[y+6]=M.z;ma[y+7]=1;ma[y+8]=P.x;ma[y+9]=P.y;ma[y+10]=P.z;ma[y+11]=1;ma[y+12]=ja.x;ma[y+13]=ja.y;ma[y+14]=ja.z;ma[y+15]=1;G=Ja[C.a];M=Ja[C.b];P=Ja[C.c];ja=Ja[C.d];ka[y]=G.x;ka[y+1]=G.y;ka[y+2]=
|
|
|
|
+G.z;ka[y+3]=1;ka[y+4]=M.x;ka[y+5]=M.y;ka[y+6]=M.z;ka[y+7]=1;ka[y+8]=P.x;ka[y+9]=P.y;ka[y+10]=P.z;ka[y+11]=1;ka[y+12]=ja.x;ka[y+13]=ja.y;ka[y+14]=ja.z;ka[y+15]=1;y+=16}if(U&&ta.length){G=ta[C.a];M=ta[C.b];P=ta[C.c];ja=ta[C.d];qa[ra]=G.r;qa[ra+1]=G.g;qa[ra+2]=G.b;qa[ra+3]=M.r;qa[ra+4]=M.g;qa[ra+5]=M.b;qa[ra+6]=P.r;qa[ra+7]=P.g;qa[ra+8]=P.b;qa[ra+9]=ja.r;qa[ra+10]=ja.g;qa[ra+11]=ja.b;ra+=12}if(I&&ya.hasTangents){G=da[C.a].tangent;M=da[C.b].tangent;P=da[C.c].tangent;C=da[C.d].tangent;la[ha]=G.x;la[ha+
|
|
|
|
+1]=G.y;la[ha+2]=G.z;la[ha+3]=G.w;la[ha+4]=M.x;la[ha+5]=M.y;la[ha+6]=M.z;la[ha+7]=M.w;la[ha+8]=P.x;la[ha+9]=P.y;la[ha+10]=P.z;la[ha+11]=P.w;la[ha+12]=C.x;la[ha+13]=C.y;la[ha+14]=C.z;la[ha+15]=C.w;ha+=16}if(X)if(Ca.length==4&&Oa)for(C=0;C<4;C++){wa=Ca[C];Ha[fa]=wa.x;Ha[fa+1]=wa.y;Ha[fa+2]=wa.z;fa+=3}else for(C=0;C<4;C++){Ha[fa]=wa.x;Ha[fa+1]=wa.y;Ha[fa+2]=wa.z;fa+=3}if(ca&&za)for(C=0;C<4;C++){Ca=za[C];Ma[Y]=Ca.u;Ma[Y+1]=Ca.v;Y+=2}if(ca&&Ia)for(C=0;C<4;C++){za=Ia[C];Ka[ua]=za.u;Ka[ua+1]=za.v;ua+=2}if(D){xa[Z]=
|
|
|
|
+B;xa[Z+1]=B+1;xa[Z+2]=B+2;xa[Z+3]=B;xa[Z+4]=B+2;xa[Z+5]=B+3;Z+=6;va[Ea]=B;va[Ea+1]=B+1;va[Ea+2]=B;va[Ea+3]=B+3;va[Ea+4]=B+1;va[Ea+5]=B+2;va[Ea+6]=B+2;va[Ea+7]=B+3;Ea+=8;B+=4}}}if(Na){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,pa,ga)}if(U&&ta.length){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,qa,ga)}if(X){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLNormalBuffer);d.bufferData(d.ARRAY_BUFFER,Ha,ga)}if(I&&ya.hasTangents){d.bindBuffer(d.ARRAY_BUFFER,
|
|
|
|
+i.__webGLTangentBuffer);d.bufferData(d.ARRAY_BUFFER,la,ga)}if(ca&&Y>0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUVBuffer);d.bufferData(d.ARRAY_BUFFER,Ma,ga)}if(ca&&ua>0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLUV2Buffer);d.bufferData(d.ARRAY_BUFFER,Ka,ga)}if(D){d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,xa,ga);d.bindBuffer(d.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);d.bufferData(d.ELEMENT_ARRAY_BUFFER,va,ga)}if(y>0){d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);
|
|
|
|
+d.bufferData(d.ARRAY_BUFFER,ma,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);d.bufferData(d.ARRAY_BUFFER,ka,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);d.bufferData(d.ARRAY_BUFFER,na,ga);d.bindBuffer(d.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);d.bufferData(d.ARRAY_BUFFER,$,ga)}}w(objlist,E,s,x,j)}t.__dirtyVertices=!1;t.__dirtyElements=!1;t.__dirtyUvs=!1;t.__dirtyNormals=!1;t.__dirtyTangents=!1;t.__dirtyColors=!1}else if(j instanceof THREE.Line){if(!t.__webGLVertexBuffer){s=
|
|
|
|
+t;s.__webGLVertexBuffer=d.createBuffer();s.__webGLColorBuffer=d.createBuffer();s=t;x=s.vertices.length;s.__vertexArray=new Float32Array(x*3);s.__colorArray=new Float32Array(x*3);s.__webGLLineCount=x;t.__dirtyVertices=!0;t.__dirtyColors=!0}if(t.__dirtyVertices||t.__dirtyColors){s=t;x=d.DYNAMIC_DRAW;B=void 0;B=void 0;r=void 0;i=void 0;Y=s.vertices;ga=s.colors;ua=Y.length;oa=ga.length;Z=s.__vertexArray;F=s.__colorArray;fa=s.__dirtyColors;if(s.__dirtyVertices){for(B=0;B<ua;B++){r=Y[B].position;i=B*3;
|
|
|
|
+Z[i]=r.x;Z[i+1]=r.y;Z[i+2]=r.z}d.bindBuffer(d.ARRAY_BUFFER,s.__webGLVertexBuffer);d.bufferData(d.ARRAY_BUFFER,Z,x)}if(fa){for(B=0;B<oa;B++){color=ga[B];i=B*3;F[i]=color.r;F[i+1]=color.g;F[i+2]=color.b}d.bindBuffer(d.ARRAY_BUFFER,s.__webGLColorBuffer);d.bufferData(d.ARRAY_BUFFER,F,x)}}w(objlist,E,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.ParticleSystem){if(!t.__webGLVertexBuffer){s=t;s.__webGLVertexBuffer=d.createBuffer();s.__webGLColorBuffer=d.createBuffer();s=t;x=
|
|
|
|
+s.vertices.length;s.__vertexArray=new Float32Array(x*3);s.__colorArray=new Float32Array(x*3);s.__sortArray=[];s.__webGLParticleCount=x;t.__dirtyVertices=!0;t.__dirtyColors=!0}(t.__dirtyVertices||t.__dirtyColors||j.sortParticles)&&b(t,d.DYNAMIC_DRAW,j,camera);w(objlist,E,0,t,j);t.__dirtyVertices=!1;t.__dirtyColors=!1}else if(j instanceof THREE.MarchingCubes){t=E;if(t[0]==undefined){i.__webGLObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});t[0]=1}}}};this.removeObject=
|
|
|
|
+function(f,q){var o,j;for(o=f.__webGLObjects.length-1;o>=0;o--){j=f.__webGLObjects[o].object;q==j&&f.__webGLObjects.splice(o,1)}};this.addToRenderList=function(){};this.removeFromRenderList=function(){};this.setDepthTest=function(f){f?d.enable(d.DEPTH_TEST):d.disable(d.DEPTH_TEST)};this.setFaceCulling=function(f,q){if(f){!q||q=="ccw"?d.frontFace(d.CCW):d.frontFace(d.CW);if(f=="back")d.cullFace(d.BACK);else f=="front"?d.cullFace(d.FRONT):d.cullFace(d.FRONT_AND_BACK);d.enable(d.CULL_FACE)}else d.disable(d.CULL_FACE)};
|
|
|
|
+this.supportsVertexTextures=function(){return d.getParameter(d.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0}};
|
|
THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
|
|
THREE.Snippets={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube env_map;\nuniform int combine;\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( env_map, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refraction_ratio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refraction_ratio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\nuniform sampler2D light_map;\n#endif",
|
|
lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
lightmap_pars_vertex:"#ifdef USE_LIGHTMAP\nvarying vec2 vUv2;\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\ngl_FragColor = gl_FragColor * texture2D( light_map, vUv2 );\n#endif",lightmap_vertex:"#ifdef USE_LIGHTMAP\nvUv2 = uv2;\n#endif",lights_pars_vertex:"uniform bool enableLighting;\nuniform vec3 ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightColor[ MAX_DIR_LIGHTS ];\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nuniform vec3 pointLightColor[ MAX_POINT_LIGHTS ];\nuniform vec3 pointLightPosition[ MAX_POINT_LIGHTS ];\n#ifdef PHONG\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\n#endif",
|
|
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
|
lights_vertex:"if ( !enableLighting ) {\nvLightWeighting = vec3( 1.0 );\n} else {\nvLightWeighting = ambientLightColor;\n#if MAX_DIR_LIGHTS > 0\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nfloat directionalLightWeighting = max( dot( transformedNormal, normalize( lDirection.xyz ) ), 0.0 );\nvLightWeighting += directionalLightColor[ i ] * directionalLightWeighting;\n}\n#endif\n#if MAX_POINT_LIGHTS > 0\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec4 lPosition = viewMatrix * vec4( pointLightPosition[ i ], 1.0 );\nvec3 pointLightVector = normalize( lPosition.xyz - mvPosition.xyz );\nfloat pointLightWeighting = max( dot( transformedNormal, pointLightVector ), 0.0 );\nvLightWeighting += pointLightColor[ i ] * pointLightWeighting;\n#ifdef PHONG\nvPointLightVector[ i ] = pointLightVector;\n#endif\n}\n#endif\n}",
|
|
lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
|
|
lights_pars_fragment:"#if MAX_DIR_LIGHTS > 0\nuniform vec3 directionalLightDirection[ MAX_DIR_LIGHTS ];\n#endif\n#if MAX_POINT_LIGHTS > 0\nvarying vec3 vPointLightVector[ MAX_POINT_LIGHTS ];\n#endif\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",lights_fragment:"vec3 normal = normalize( vNormal );\nvec3 viewPosition = normalize( vViewPosition );\nvec4 mColor = vec4( diffuse, opacity );\nvec4 mSpecular = vec4( specular, opacity );\n#if MAX_POINT_LIGHTS > 0\nvec4 pointDiffuse = vec4( 0.0 );\nvec4 pointSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_POINT_LIGHTS; i++ ) {\nvec3 pointVector = normalize( vPointLightVector[ i ] );\nvec3 pointHalfVector = normalize( vPointLightVector[ i ] + vViewPosition );\nfloat pointDotNormalHalf = dot( normal, pointHalfVector );\nfloat pointDiffuseWeight = max( dot( normal, pointVector ), 0.0 );\nfloat pointSpecularWeight = 0.0;\nif ( pointDotNormalHalf >= 0.0 )\npointSpecularWeight = pow( pointDotNormalHalf, shininess );\npointDiffuse += mColor * pointDiffuseWeight;\npointSpecular += mSpecular * pointSpecularWeight;\n}\n#endif\n#if MAX_DIR_LIGHTS > 0\nvec4 dirDiffuse = vec4( 0.0 );\nvec4 dirSpecular = vec4( 0.0 );\nfor( int i = 0; i < MAX_DIR_LIGHTS; i++ ) {\nvec4 lDirection = viewMatrix * vec4( directionalLightDirection[ i ], 0.0 );\nvec3 dirVector = normalize( lDirection.xyz );\nvec3 dirHalfVector = normalize( lDirection.xyz + vViewPosition );\nfloat dirDotNormalHalf = dot( normal, dirHalfVector );\nfloat dirDiffuseWeight = max( dot( normal, dirVector ), 0.0 );\nfloat dirSpecularWeight = 0.0;\nif ( dirDotNormalHalf >= 0.0 )\ndirSpecularWeight = pow( dirDotNormalHalf, shininess );\ndirDiffuse += mColor * dirDiffuseWeight;\ndirSpecular += mSpecular * dirSpecularWeight;\n}\n#endif\nvec4 totalLight = vec4( ambient, opacity );\n#if MAX_DIR_LIGHTS > 0\ntotalLight += dirDiffuse + dirSpecular;\n#endif\n#if MAX_POINT_LIGHTS > 0\ntotalLight += pointDiffuse + pointSpecular;\n#endif\ngl_FragColor = gl_FragColor * totalLight;",
|
|
-color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif"};
|
|
|
|
|
|
+color_pars_fragment:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_fragment:"#ifdef USE_COLOR\ngl_FragColor = gl_FragColor * vec4( vColor, opacity );\n#endif",color_pars_vertex:"#ifdef USE_COLOR\nvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\nvColor = color;\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\nuniform mat4 uBoneGlobalMatrices[20];\n#endif",skinning_vertex:"#ifdef USE_SKINNING\ngl_Position = ( uBoneGlobalMatrices[ int( skinIndex.x ) ] * skinVertexA ) * skinWeight.x;\ngl_Position += ( uBoneGlobalMatrices[ int( skinIndex.y ) ] * skinVertexB ) * skinWeight.y;\ngl_Position = projectionMatrix * viewMatrix * objectMatrix * gl_Position;\n#else\ngl_Position = projectionMatrix * mvPosition;\n#endif"};
|
|
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
|
|
THREE.UniformsLib={common:{diffuse:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},map:{type:"t",value:0,texture:null},light_map:{type:"t",value:2,texture:null},env_map:{type:"t",value:1,texture:null},useRefract:{type:"i",value:0},reflectivity:{type:"f",value:1},refraction_ratio:{type:"f",value:0.98},combine:{type:"i",value:0},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}},lights:{enableLighting:{type:"i",
|
|
value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
|
|
value:1},ambientLightColor:{type:"fv",value:[]},directionalLightDirection:{type:"fv",value:[]},directionalLightColor:{type:"fv",value:[]},pointLightPosition:{type:"fv",value:[]},pointLightColor:{type:"fv",value:[]}},particle:{psColor:{type:"c",value:new THREE.Color(15658734)},opacity:{type:"f",value:1},size:{type:"f",value:1},map:{type:"t",value:0,texture:null},fogDensity:{type:"f",value:2.5E-4},fogNear:{type:"f",value:1},fogFar:{type:"f",value:2E3},fogColor:{type:"c",value:new THREE.Color(16777215)}}};
|
|
THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
|
|
THREE.ShaderLib={depth:{uniforms:{mNear:{type:"f",value:1},mFar:{type:"f",value:2E3},opacity:{type:"f",value:1}},fragment_shader:"uniform float mNear;\nuniform float mFar;\nuniform float opacity;\nvoid main() {\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\nfloat color = 1.0 - smoothstep( mNear, mFar, depth );\ngl_FragColor = vec4( vec3( color ), opacity );\n}",vertex_shader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}"},normal:{uniforms:{opacity:{type:"f",
|
|
value:1}},fragment_shader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,
|
|
value:1}},fragment_shader:"uniform float opacity;\nvarying vec3 vNormal;\nvoid main() {\ngl_FragColor = vec4( 0.5 * normalize( vNormal ) + 0.5, opacity );\n}",vertex_shader:"varying vec3 vNormal;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvNormal = normalize( normalMatrix * normal );\ngl_Position = projectionMatrix * mvPosition;\n}"},basic:{uniforms:THREE.UniformsLib.common,fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,
|
|
THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,
|
|
THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:[THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,THREE.Snippets.color_pars_vertex,
|
|
-"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,
|
|
|
|
|
|
+THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},lambert:{uniforms:Uniforms.merge([THREE.UniformsLib.common,THREE.UniformsLib.lights]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,
|
|
THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,
|
|
THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( diffuse, opacity );\ngl_FragColor = gl_FragColor * vec4( vLightWeighting, 1.0 );",THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["varying vec3 vLightWeighting;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,
|
|
-THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,
|
|
|
|
|
|
+THREE.Snippets.envmap_pars_vertex,THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"vec3 transformedNormal = normalize( normalMatrix * normal );",THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},phong:{uniforms:Uniforms.merge([THREE.UniformsLib.common,
|
|
THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,
|
|
THREE.UniformsLib.lights,{ambient:{type:"c",value:new THREE.Color(328965)},specular:{type:"c",value:new THREE.Color(1118481)},shininess:{type:"f",value:30}}]),fragment_shader:["uniform vec3 diffuse;\nuniform float opacity;\nuniform vec3 ambient;\nuniform vec3 specular;\nuniform float shininess;\nvarying vec3 vLightWeighting;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_pars_fragment,THREE.Snippets.lightmap_pars_fragment,THREE.Snippets.envmap_pars_fragment,THREE.Snippets.fog_pars_fragment,
|
|
THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
|
|
THREE.Snippets.lights_pars_fragment,"void main() {\ngl_FragColor = vec4( vLightWeighting, 1.0 );",THREE.Snippets.lights_fragment,THREE.Snippets.map_fragment,THREE.Snippets.lightmap_fragment,THREE.Snippets.color_fragment,THREE.Snippets.envmap_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["#define PHONG\nvarying vec3 vLightWeighting;\nvarying vec3 vViewPosition;\nvarying vec3 vNormal;",THREE.Snippets.map_pars_vertex,THREE.Snippets.lightmap_pars_vertex,THREE.Snippets.envmap_pars_vertex,
|
|
-THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",THREE.Snippets.lights_vertex,
|
|
|
|
-"gl_Position = projectionMatrix * mvPosition;\n}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",THREE.Snippets.color_pars_vertex,
|
|
|
|
-"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};THREE.RenderableObject=function(){this.z=this.object=null};
|
|
|
|
-THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=false;this.uvs=[null,null,null]};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};
|
|
|
|
|
|
+THREE.Snippets.lights_pars_vertex,THREE.Snippets.color_pars_vertex,THREE.Snippets.skinning_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.Snippets.map_vertex,THREE.Snippets.lightmap_vertex,THREE.Snippets.envmap_vertex,THREE.Snippets.color_vertex,"#ifndef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\n#endif\nvViewPosition = cameraPosition - mPosition.xyz;\nvec3 transformedNormal = normalize( normalMatrix * normal );\nvNormal = transformedNormal;",
|
|
|
|
+THREE.Snippets.lights_vertex,THREE.Snippets.skinning_vertex,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsLib.particle,fragment_shader:["uniform vec3 psColor;\nuniform float opacity;",THREE.Snippets.color_pars_fragment,THREE.Snippets.map_particle_pars_fragment,THREE.Snippets.fog_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.Snippets.map_particle_fragment,THREE.Snippets.color_fragment,THREE.Snippets.fog_fragment,"}"].join("\n"),vertex_shader:["uniform float size;",
|
|
|
|
+THREE.Snippets.color_pars_vertex,"void main() {",THREE.Snippets.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\ngl_Position = projectionMatrix * mvPosition;\ngl_PointSize = size;\n}"].join("\n")}};THREE.RenderableObject=function(){this.z=this.object=null};
|
|
|
|
+THREE.RenderableFace3=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.v3=new THREE.Vertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[null,null,null]};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};
|
|
THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|
|
THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.Vertex;this.v2=new THREE.Vertex;this.materials=null};
|