|
@@ -15,64 +15,64 @@ Math.abs(c)>1.0E-5?(this.x=Math.atan2(-a.n23/c,a.n33/c),this.z=Math.atan2(-a.n12
|
|
|
THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},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){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
|
|
|
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},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;return this}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
|
-THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,d=[];c=0;for(b=a.length;c<b;c++)Array.prototype.push.apply(d,this.intersectObject(a[c]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function c(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function b(a,b,c,n){d.copy(n).subSelf(b);
|
|
|
-g.copy(c).subSelf(b);e.copy(a).subSelf(b);f=d.dot(d);h=d.dot(g);i=d.dot(e);l=g.dot(g);m=g.dot(e);k=1/(f*l-h*h);o=(l*i-h*m)*k;p=(f*m-h*i)*k;return o>=0&&p>=0&&o+p<1}for(var d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Vector3,f,h,i,l,m,k,o,p,q,n=[],t=0,u=a.children.length;t<u;t++)Array.prototype.push.apply(n,this.intersectObject(a.children[t]));if(a instanceof THREE.Particle){t=c(this.origin,this.direction,a.matrixWorld.getPosition());if(t===null||t>a.scale.x)return[];q={distance:t,point:a.position,
|
|
|
-face:null,object:a};n.push(q)}else if(a instanceof THREE.Mesh){t=c(this.origin,this.direction,a.matrixWorld.getPosition());if(t===null||t>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return n;var v,r,z,E,N,A,J,x,w=a.geometry,D=w.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);t=0;for(u=w.faces.length;t<u;t++)if(q=w.faces[t],J=this.origin.clone(),x=this.direction.clone(),E=a.matrixWorld,v=E.multiplyVector3(q.centroid.clone()).subSelf(J),A=v.dot(x),
|
|
|
-!(A<=0)&&(v=E.multiplyVector3(D[q.a].position.clone()),r=E.multiplyVector3(D[q.b].position.clone()),z=E.multiplyVector3(D[q.c].position.clone()),E=q instanceof THREE.Face4?E.multiplyVector3(D[q.d].position.clone()):null,N=a.matrixRotationWorld.multiplyVector3(q.normal.clone()),A=x.dot(N),a.doubleSided||(a.flipSided?A>0:A<0)))if(A=N.dot((new THREE.Vector3).sub(v,J))/A,J=J.addSelf(x.multiplyScalar(A)),q instanceof THREE.Face3)b(J,v,r,z)&&(q={distance:this.origin.distanceTo(J),point:J,face:q,object:a},
|
|
|
-n.push(q));else if(q instanceof THREE.Face4&&(b(J,v,r,E)||b(J,r,z,E)))q={distance:this.origin.distanceTo(J),point:J,face:q,object:a},n.push(q)}return n}};
|
|
|
-THREE.Rectangle=function(){function a(){e=d-c;f=g-b}var c,b,d,g,e,f,h=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return e};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(e,f,m,k){h=!1;c=e;b=f;d=m;g=k;a()};this.addPoint=function(e,f){h?(h=!1,c=e,b=f,d=e,g=f):(c=c<e?c:e,b=b<f?b:f,d=d>e?d:e,g=g>f?g:f);a()};this.add3Points=
|
|
|
-function(e,f,m,k,o,p){h?(h=!1,c=e<m?e<o?e:o:m<o?m:o,b=f<k?f<p?f:p:k<p?k:p,d=e>m?e>o?e:o:m>o?m:o,g=f>k?f>p?f:p:k>p?k:p):(c=e<m?e<o?e<c?e:c:o<c?o:c:m<o?m<c?m:c:o<c?o:c,b=f<k?f<p?f<b?f:b:p<b?p:b:k<p?k<b?k:b:p<b?p:b,d=e>m?e>o?e>d?e:d:o>d?o:d:m>o?m>d?m:d:o>d?o:d,g=f>k?f>p?f>g?f:g:p>g?p:g:k>p?k>g?k:g:p>g?p:g);a()};this.addRectangle=function(e){h?(h=!1,c=e.getLeft(),b=e.getTop(),d=e.getRight(),g=e.getBottom()):(c=c<e.getLeft()?c:e.getLeft(),b=b<e.getTop()?b:e.getTop(),d=d>e.getRight()?d:e.getRight(),g=g>
|
|
|
+THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(a){return this.intersectObjects(a.children)},intersectObjects:function(a){var c,b,d=[];c=0;for(b=a.length;c<b;c++)Array.prototype.push.apply(d,this.intersectObject(a[c]));d.sort(function(a,b){return a.distance-b.distance});return d},intersectObject:function(a){function c(a,b,c){var d;d=c.clone().subSelf(a).dot(b);if(d<=0)return null;a=a.clone().addSelf(b.clone().multiplyScalar(d));return c.distanceTo(a)}function b(a,b,c,p){d.copy(p).subSelf(b);
|
|
|
+g.copy(c).subSelf(b);e.copy(a).subSelf(b);f=d.dot(d);h=d.dot(g);i=d.dot(e);k=g.dot(g);l=g.dot(e);m=1/(f*k-h*h);o=(k*i-h*l)*m;n=(f*l-h*i)*m;return o>=0&&n>=0&&o+n<1}for(var d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Vector3,f,h,i,k,l,m,o,n,s,p=[],u=0,v=a.children.length;u<v;u++)Array.prototype.push.apply(p,this.intersectObject(a.children[u]));if(a instanceof THREE.Particle){u=c(this.origin,this.direction,a.matrixWorld.getPosition());if(u===null||u>a.scale.x)return[];s={distance:u,point:a.position,
|
|
|
+face:null,object:a};p.push(s)}else if(a instanceof THREE.Mesh){u=c(this.origin,this.direction,a.matrixWorld.getPosition());if(u===null||u>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return p;var y,q,t,w,z,L,J,I,D=a.geometry,C=D.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);u=0;for(v=D.faces.length;u<v;u++)if(s=D.faces[u],J=this.origin.clone(),I=this.direction.clone(),w=a.matrixWorld,y=w.multiplyVector3(s.centroid.clone()).subSelf(J),L=y.dot(I),
|
|
|
+!(L<=0)&&(y=w.multiplyVector3(C[s.a].position.clone()),q=w.multiplyVector3(C[s.b].position.clone()),t=w.multiplyVector3(C[s.c].position.clone()),w=s instanceof THREE.Face4?w.multiplyVector3(C[s.d].position.clone()):null,z=a.matrixRotationWorld.multiplyVector3(s.normal.clone()),L=I.dot(z),a.doubleSided||(a.flipSided?L>0:L<0)))if(L=z.dot((new THREE.Vector3).sub(y,J))/L,J=J.addSelf(I.multiplyScalar(L)),s instanceof THREE.Face3)b(J,y,q,t)&&(s={distance:this.origin.distanceTo(J),point:J,face:s,object:a},
|
|
|
+p.push(s));else if(s instanceof THREE.Face4&&(b(J,y,q,w)||b(J,q,t,w)))s={distance:this.origin.distanceTo(J),point:J,face:s,object:a},p.push(s)}return p}};
|
|
|
+THREE.Rectangle=function(){function a(){e=d-c;f=g-b}var c,b,d,g,e,f,h=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return e};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(e,f,l,m){h=!1;c=e;b=f;d=l;g=m;a()};this.addPoint=function(e,f){h?(h=!1,c=e,b=f,d=e,g=f):(c=c<e?c:e,b=b<f?b:f,d=d>e?d:e,g=g>f?g:f);a()};this.add3Points=
|
|
|
+function(e,f,l,m,o,n){h?(h=!1,c=e<l?e<o?e:o:l<o?l:o,b=f<m?f<n?f:n:m<n?m:n,d=e>l?e>o?e:o:l>o?l:o,g=f>m?f>n?f:n:m>n?m:n):(c=e<l?e<o?e<c?e:c:o<c?o:c:l<o?l<c?l:c:o<c?o:c,b=f<m?f<n?f<b?f:b:n<b?n:b:m<n?m<b?m:b:n<b?n:b,d=e>l?e>o?e>d?e:d:o>d?o:d:l>o?l>d?l:d:o>d?o:d,g=f>m?f>n?f>g?f:g:n>g?n:g:m>n?m>g?m:g:n>g?n:g);a()};this.addRectangle=function(e){h?(h=!1,c=e.getLeft(),b=e.getTop(),d=e.getRight(),g=e.getBottom()):(c=c<e.getLeft()?c:e.getLeft(),b=b<e.getTop()?b:e.getTop(),d=d>e.getRight()?d:e.getRight(),g=g>
|
|
|
e.getBottom()?g:e.getBottom());a()};this.inflate=function(e){c-=e;b-=e;d+=e;g+=e;a()};this.minSelf=function(e){c=c>e.getLeft()?c:e.getLeft();b=b>e.getTop()?b:e.getTop();d=d<e.getRight()?d:e.getRight();g=g<e.getBottom()?g:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(g,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){h=!0;g=d=b=c=0;a()};this.isEmpty=function(){return h}};
|
|
|
THREE.Math={clamp:function(a,c,b){return a<c?c:a>b?b:a},clampBottom:function(a,c){return a<c?c:a},mapLinear:function(a,c,b,d,g){return d+(a-c)*(g-d)/(b-c)},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.Matrix3=function(){this.m=[]};
|
|
|
THREE.Matrix3.prototype={constructor:THREE.Matrix3,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,b,d,g,e,f,h,i,l,m,k,o,p,q,n){this.set(a!==void 0?a:1,c||0,b||0,d||0,g||0,e!==void 0?e:1,f||0,h||0,i||0,l||0,m!==void 0?m:1,k||0,o||0,p||0,q||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,d,g,e,f,h,i,l,m,k,o,p,q,n){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=g;this.n22=e;this.n23=f;this.n24=h;this.n31=i;this.n32=l;this.n33=m;this.n34=k;this.n41=o;this.n42=p;this.n43=q;this.n44=n;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
|
|
|
-c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,l=a.n24,m=a.n31,k=a.n32,o=a.n33,p=a.n34,q=a.n41,n=a.n42,t=a.n43,
|
|
|
-u=a.n44,v=c.n11,r=c.n12,z=c.n13,E=c.n14,N=c.n21,A=c.n22,J=c.n23,x=c.n24,w=c.n31,D=c.n32,M=c.n33,S=c.n34,ca=c.n41,L=c.n42,P=c.n43,j=c.n44;this.n11=b*v+d*N+g*w+e*ca;this.n12=b*r+d*A+g*D+e*L;this.n13=b*z+d*J+g*M+e*P;this.n14=b*E+d*x+g*S+e*j;this.n21=f*v+h*N+i*w+l*ca;this.n22=f*r+h*A+i*D+l*L;this.n23=f*z+h*J+i*M+l*P;this.n24=f*E+h*x+i*S+l*j;this.n31=m*v+k*N+o*w+p*ca;this.n32=m*r+k*A+o*D+p*L;this.n33=m*z+k*J+o*M+p*P;this.n34=m*E+k*x+o*S+p*j;this.n41=q*v+n*N+t*w+u*ca;this.n42=q*r+n*A+t*D+u*L;this.n43=q*
|
|
|
-z+n*J+t*M+u*P;this.n44=q*E+n*x+t*S+u*j;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;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},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=this.n21*c+this.n22*
|
|
|
-b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();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},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,l=this.n32,m=this.n33,k=this.n34,o=this.n41,p=this.n42,q=this.n43,n=this.n44;return d*f*l*o-b*h*l*o-d*e*m*o+c*h*m*o+b*e*k*o-c*f*k*o-d*f*i*p+b*h*i*p+d*g*m*p-a*h*m*p-b*g*k*p+a*f*k*p+d*e*i*q-c*h*i*q-d*g*l*q+a*h*l*q+c*g*k*q-a*e*k*q-b*e*i*n+c*f*i*n+b*g*l*n-a*f*l*n-c*g*m*n+a*e*m*n},transpose:function(){var a;
|
|
|
-a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;
|
|
|
-a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},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,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},
|
|
|
-setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX: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},setRotationY: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},setRotationZ: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},
|
|
|
-setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,l=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+b,l*h-d*e,0,i*h-d*f,l*h+d*e,g*h*h+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
|
|
|
-this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,d=a.n13,g=a.n14,e=a.n21,f=a.n22,h=a.n23,i=a.n24,l=a.n31,m=a.n32,k=a.n33,o=a.n34,p=a.n41,q=a.n42,n=a.n43,t=a.n44;this.n11=h*o*q-i*k*q+i*m*n-f*o*n-h*m*t+f*k*t;this.n12=g*k*q-d*o*q-g*m*n+b*o*n+d*m*t-b*k*t;this.n13=d*i*q-g*h*q+g*f*n-b*i*n-d*f*t+b*h*t;this.n14=g*h*m-d*i*m-g*f*k+b*i*k+d*f*o-b*h*o;this.n21=i*k*p-h*o*p-i*l*n+e*o*n+h*l*t-e*k*t;this.n22=d*o*p-g*k*p+
|
|
|
-g*l*n-c*o*n-d*l*t+c*k*t;this.n23=g*h*p-d*i*p-g*e*n+c*i*n+d*e*t-c*h*t;this.n24=d*i*l-g*h*l+g*e*k-c*i*k-d*e*o+c*h*o;this.n31=f*o*p-i*m*p+i*l*q-e*o*q-f*l*t+e*m*t;this.n32=g*m*p-b*o*p-g*l*q+c*o*q+b*l*t-c*m*t;this.n33=d*i*p-g*f*p+g*e*q-c*i*q-b*e*t+c*f*t;this.n34=g*f*l-b*i*l-g*e*m+c*i*m+b*e*o-c*f*o;this.n41=h*m*p-f*k*p-h*l*q+e*k*q+f*l*n-e*m*n;this.n42=b*k*p-d*m*p+d*l*q-c*k*q-b*l*n+c*m*n;this.n43=d*f*p-b*h*p-d*e*q+c*h*q+b*e*n-c*f*n;this.n44=b*h*l-d*f*l+d*e*m-c*h*m-b*e*k+c*f*k;this.multiplyScalar(1/a.determinant());
|
|
|
-return this},setRotationFromEuler:function(a,c){var b=a.x,d=a.y,g=a.z,e=Math.cos(b),b=Math.sin(b),f=Math.cos(d),d=Math.sin(d),h=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var i=f*h,l=f*g,m=d*h,k=d*g;this.n11=i+k*b;this.n12=m*b-l;this.n13=e*d;this.n21=e*g;this.n22=e*h;this.n23=-b;this.n31=l*b-m;this.n32=k+i*b;this.n33=e*f;break;case "ZXY":i=f*h;l=f*g;m=d*h;k=d*g;this.n11=i-k*b;this.n12=-e*g;this.n13=m+l*b;this.n21=l+m*b;this.n22=e*h;this.n23=k-i*b;this.n31=-e*d;this.n32=b;this.n33=e*f;break;case "ZYX":i=
|
|
|
-e*h;l=e*g;m=b*h;k=b*g;this.n11=f*h;this.n12=m*d-l;this.n13=i*d+k;this.n21=f*g;this.n22=k*d+i;this.n23=l*d-m;this.n31=-d;this.n32=b*f;this.n33=e*f;break;case "YZX":i=e*f;l=e*d;m=b*f;k=b*d;this.n11=f*h;this.n12=k-i*g;this.n13=m*g+l;this.n21=g;this.n22=e*h;this.n23=-b*h;this.n31=-d*h;this.n32=l*g+m;this.n33=i-k*g;break;case "XZY":i=e*f;l=e*d;m=b*f;k=b*d;this.n11=f*h;this.n12=-g;this.n13=d*h;this.n21=i*g+k;this.n22=e*h;this.n23=l*g-m;this.n31=m*g-l;this.n32=b*h;this.n33=k*g+i;break;default:i=e*h,l=e*
|
|
|
-g,m=b*h,k=b*g,this.n11=f*h,this.n12=-f*g,this.n13=d,this.n21=l+m*d,this.n22=i-k*d,this.n23=-b*f,this.n31=k-i*d,this.n32=m+l*d,this.n33=e*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,g=a.w,e=c+c,f=b+b,h=d+d,a=c*e,i=c*f;c*=h;var l=b*f;b*=h;d*=h;e*=g;f*=g;g*=h;this.n11=1-(l+d);this.n12=i-g;this.n13=c+f;this.n21=i+g;this.n22=1-(a+d);this.n23=b-e;this.n31=c-f;this.n32=b+e;this.n33=1-(a+l);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
|
|
|
+THREE.Matrix4=function(a,c,b,d,g,e,f,h,i,k,l,m,o,n,s,p){this.set(a!==void 0?a:1,c||0,b||0,d||0,g||0,e!==void 0?e:1,f||0,h||0,i||0,k||0,l!==void 0?l:1,m||0,o||0,n||0,s||0,p!==void 0?p:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,d,g,e,f,h,i,k,l,m,o,n,s,p){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=g;this.n22=e;this.n23=f;this.n24=h;this.n31=i;this.n32=k;this.n33=l;this.n34=m;this.n41=o;this.n42=n;this.n43=s;this.n44=p;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,
|
|
|
+c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,k=a.n24,l=a.n31,m=a.n32,o=a.n33,n=a.n34,s=a.n41,p=a.n42,u=a.n43,
|
|
|
+v=a.n44,y=c.n11,q=c.n12,t=c.n13,w=c.n14,z=c.n21,L=c.n22,J=c.n23,I=c.n24,D=c.n31,C=c.n32,P=c.n33,R=c.n34,fa=c.n41,M=c.n42,N=c.n43,ga=c.n44;this.n11=b*y+d*z+g*D+e*fa;this.n12=b*q+d*L+g*C+e*M;this.n13=b*t+d*J+g*P+e*N;this.n14=b*w+d*I+g*R+e*ga;this.n21=f*y+h*z+i*D+k*fa;this.n22=f*q+h*L+i*C+k*M;this.n23=f*t+h*J+i*P+k*N;this.n24=f*w+h*I+i*R+k*ga;this.n31=l*y+m*z+o*D+n*fa;this.n32=l*q+m*L+o*C+n*M;this.n33=l*t+m*J+o*P+n*N;this.n34=l*w+m*I+o*R+n*ga;this.n41=s*y+p*z+u*D+v*fa;this.n42=s*q+p*L+u*C+v*M;this.n43=
|
|
|
+s*t+p*J+u*P+v*N;this.n44=s*w+p*I+u*R+v*ga;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);b[0]=this.n11;b[1]=this.n21;b[2]=this.n31;b[3]=this.n41;b[4]=this.n12;b[5]=this.n22;b[6]=this.n32;b[7]=this.n42;b[8]=this.n13;b[9]=this.n23;b[10]=this.n33;b[11]=this.n43;b[12]=this.n14;b[13]=this.n24;b[14]=this.n34;b[15]=this.n44;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},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=
|
|
|
+this.n21*c+this.n22*b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();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},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,k=this.n32,l=this.n33,m=this.n34,o=this.n41,n=this.n42,s=this.n43,p=this.n44;return d*f*k*o-b*h*k*o-d*e*l*o+c*h*l*o+b*e*m*o-c*f*m*o-d*f*i*n+b*h*i*n+d*g*l*n-a*h*l*n-b*g*m*n+a*f*m*n+d*e*i*s-c*h*i*s-d*g*k*s+a*h*k*s+c*g*m*s-a*e*m*s-b*e*i*p+c*f*i*p+b*g*k*p-a*f*k*p-
|
|
|
+c*g*l*p+a*e*l*p},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;
|
|
|
+a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},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,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=
|
|
|
+this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,0,0,0,0,1);return this},setRotationX: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},setRotationY: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},setRotationZ: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},setRotationAxis:function(a,c){var b=Math.cos(c),d=Math.sin(c),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,k=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,k*f+b,k*h-d*e,0,i*h-d*f,k*h+d*e,g*h*h+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
|
|
|
+this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,d=a.n13,g=a.n14,e=a.n21,f=a.n22,h=a.n23,i=a.n24,k=a.n31,l=a.n32,m=a.n33,o=a.n34,n=a.n41,s=a.n42,p=a.n43,u=a.n44;this.n11=h*o*s-i*m*s+i*l*p-f*o*p-h*l*u+f*m*u;this.n12=g*m*s-d*o*s-g*l*p+b*o*p+d*l*u-b*m*u;this.n13=d*i*s-g*h*s+g*f*p-b*i*p-d*f*u+b*h*u;this.n14=g*h*l-d*i*l-g*f*m+b*i*m+d*f*o-b*h*o;this.n21=i*m*n-h*o*n-i*k*p+e*o*p+h*k*u-e*m*u;this.n22=d*o*n-g*m*n+
|
|
|
+g*k*p-c*o*p-d*k*u+c*m*u;this.n23=g*h*n-d*i*n-g*e*p+c*i*p+d*e*u-c*h*u;this.n24=d*i*k-g*h*k+g*e*m-c*i*m-d*e*o+c*h*o;this.n31=f*o*n-i*l*n+i*k*s-e*o*s-f*k*u+e*l*u;this.n32=g*l*n-b*o*n-g*k*s+c*o*s+b*k*u-c*l*u;this.n33=d*i*n-g*f*n+g*e*s-c*i*s-b*e*u+c*f*u;this.n34=g*f*k-b*i*k-g*e*l+c*i*l+b*e*o-c*f*o;this.n41=h*l*n-f*m*n-h*k*s+e*m*s+f*k*p-e*l*p;this.n42=b*m*n-d*l*n+d*k*s-c*m*s-b*k*p+c*l*p;this.n43=d*f*n-b*h*n-d*e*s+c*h*s+b*e*p-c*f*p;this.n44=b*h*k-d*f*k+d*e*l-c*h*l-b*e*m+c*f*m;this.multiplyScalar(1/a.determinant());
|
|
|
+return this},setRotationFromEuler:function(a,c){var b=a.x,d=a.y,g=a.z,e=Math.cos(b),b=Math.sin(b),f=Math.cos(d),d=Math.sin(d),h=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var i=f*h,k=f*g,l=d*h,m=d*g;this.n11=i+m*b;this.n12=l*b-k;this.n13=e*d;this.n21=e*g;this.n22=e*h;this.n23=-b;this.n31=k*b-l;this.n32=m+i*b;this.n33=e*f;break;case "ZXY":i=f*h;k=f*g;l=d*h;m=d*g;this.n11=i-m*b;this.n12=-e*g;this.n13=l+k*b;this.n21=k+l*b;this.n22=e*h;this.n23=m-i*b;this.n31=-e*d;this.n32=b;this.n33=e*f;break;case "ZYX":i=
|
|
|
+e*h;k=e*g;l=b*h;m=b*g;this.n11=f*h;this.n12=l*d-k;this.n13=i*d+m;this.n21=f*g;this.n22=m*d+i;this.n23=k*d-l;this.n31=-d;this.n32=b*f;this.n33=e*f;break;case "YZX":i=e*f;k=e*d;l=b*f;m=b*d;this.n11=f*h;this.n12=m-i*g;this.n13=l*g+k;this.n21=g;this.n22=e*h;this.n23=-b*h;this.n31=-d*h;this.n32=k*g+l;this.n33=i-m*g;break;case "XZY":i=e*f;k=e*d;l=b*f;m=b*d;this.n11=f*h;this.n12=-g;this.n13=d*h;this.n21=i*g+m;this.n22=e*h;this.n23=k*g-l;this.n31=l*g-k;this.n32=b*h;this.n33=m*g+i;break;default:i=e*h,k=e*
|
|
|
+g,l=b*h,m=b*g,this.n11=f*h,this.n12=-f*g,this.n13=d,this.n21=k+l*d,this.n22=i-m*d,this.n23=-b*f,this.n31=m-i*d,this.n32=l+k*d,this.n33=e*f}return this},setRotationFromQuaternion:function(a){var c=a.x,b=a.y,d=a.z,g=a.w,e=c+c,f=b+b,h=d+d,a=c*e,i=c*f;c*=h;var k=b*f;b*=h;d*=h;e*=g;f*=g;g*=h;this.n11=1-(k+d);this.n12=i-g;this.n13=c+f;this.n21=i+g;this.n22=1-(a+d);this.n23=b-e;this.n31=c-f;this.n32=b+e;this.n33=1-(a+k);return this},scale:function(a){var c=a.x,b=a.y,a=a.z;this.n11*=c;this.n12*=b;this.n13*=
|
|
|
a;this.n21*=c;this.n22*=b;this.n23*=a;this.n31*=c;this.n32*=b;this.n33*=a;this.n41*=c;this.n42*=b;this.n43*=a;return this},compose:function(a,c,b){var d=THREE.Matrix4.__m1,g=THREE.Matrix4.__m2;d.identity();d.setRotationFromQuaternion(c);g.setScale(b.x,b.y,b.z);this.multiply(d,g);this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},decompose:function(a,c,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;d.set(this.n11,this.n21,this.n31);g.set(this.n12,this.n22,this.n32);e.set(this.n13,
|
|
|
this.n23,this.n33);a=a instanceof THREE.Vector3?a:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;b=b instanceof THREE.Vector3?b:new THREE.Vector3;b.x=d.length();b.y=g.length();b.z=e.length();a.x=this.n14;a.y=this.n24;a.z=this.n34;d=THREE.Matrix4.__m1;d.copy(this);d.n11/=b.x;d.n21/=b.x;d.n31/=b.x;d.n12/=b.y;d.n22/=b.y;d.n32/=b.y;d.n13/=b.z;d.n23/=b.z;d.n33/=b.z;c.setFromRotationMatrix(d);return[a,c,b]},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34;
|
|
|
return this},extractRotation:function(a){var c=THREE.Matrix4.__v1,b=1/c.set(a.n11,a.n21,a.n31).length(),d=1/c.set(a.n12,a.n22,a.n32).length(),c=1/c.set(a.n13,a.n23,a.n33).length();this.n11=a.n11*b;this.n21=a.n21*b;this.n31=a.n31*b;this.n12=a.n12*d;this.n22=a.n22*d;this.n32=a.n32*d;this.n13=a.n13*c;this.n23=a.n23*c;this.n33=a.n33*c;return this}};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,l=a.n23*a.n12-a.n22*a.n13,m=-a.n23*a.n11+a.n21*a.n13,k=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*l;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*d;b[1]=a*g;b[2]=a*e;b[3]=a*f;b[4]=a*h;b[5]=a*i;b[6]=a*l;b[7]=a*m;b[8]=a*k;return c};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,b=c.m,d=a.n33*a.n22-a.n32*a.n23,g=-a.n33*a.n21+a.n31*a.n23,e=a.n32*a.n21-a.n31*a.n22,f=-a.n33*a.n12+a.n32*a.n13,h=a.n33*a.n11-a.n31*a.n13,i=-a.n32*a.n11+a.n31*a.n12,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,m=a.n22*a.n11-a.n21*a.n12,a=a.n11*d+a.n21*f+a.n31*k;a===0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");a=1/a;b[0]=a*d;b[1]=a*g;b[2]=a*e;b[3]=a*f;b[4]=a*h;b[5]=a*i;b[6]=a*k;b[7]=a*l;b[8]=a*m;return c};
|
|
|
THREE.Matrix4.makeFrustum=function(a,c,b,d,g,e){var f;f=new THREE.Matrix4;f.n11=2*g/(c-a);f.n12=0;f.n13=(c+a)/(c-a);f.n14=0;f.n21=0;f.n22=2*g/(d-b);f.n23=(d+b)/(d-b);f.n24=0;f.n31=0;f.n32=0;f.n33=-(e+g)/(e-g);f.n34=-2*e*g/(e-g);f.n41=0;f.n42=0;f.n43=-1;f.n44=0;return f};THREE.Matrix4.makePerspective=function(a,c,b,d){var g,a=b*Math.tan(a*Math.PI/360);g=-a;return THREE.Matrix4.makeFrustum(g*c,a*c,g,a,b,d)};
|
|
|
-THREE.Matrix4.makeOrtho=function(a,c,b,d,g,e){var f,h,i,l;f=new THREE.Matrix4;h=c-a;i=b-d;l=e-g;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((c+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((b+d)/i);f.n31=0;f.n32=0;f.n33=-2/l;f.n34=-((e+g)/l);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
+THREE.Matrix4.makeOrtho=function(a,c,b,d,g,e){var f,h,i,k;f=new THREE.Matrix4;h=c-a;i=b-d;k=e-g;f.n11=2/h;f.n12=0;f.n13=0;f.n14=-((c+a)/h);f.n21=0;f.n22=2/i;f.n23=0;f.n24=-((b+d)/i);f.n31=0;f.n32=0;f.n33=-2/k;f.n34=-((e+g)/k);f.n41=0;f.n42=0;f.n43=0;f.n44=1;return f};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
|
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
|
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(a))},translateX:function(a){this.translate(a,this._vector.set(1,0,0))},translateY:function(a){this.translate(a,this._vector.set(0,1,0))},translateZ:function(a){this.translate(a,this._vector.set(0,0,1))},lookAt:function(a){this.matrix.lookAt(a,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(a){if(this.children.indexOf(a)===
|
|
|
-1){a.parent!==void 0&&a.parent.remove(a);a.parent=this;this.children.push(a);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addObject(a)}},remove:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=void 0;this.children.splice(c,1);for(c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.removeObject(a)}},getChildByName:function(a,c){var b,d,g;b=0;for(d=this.children.length;b<d;b++){g=this.children[b];if(g.name===a)return g;
|
|
|
if(c&&(g=g.getChildByName(a,c),g!==void 0))return g}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
|
|
|
this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
|
-THREE.Projector=function(){function a(){var a=f[e]=f[e]||new THREE.RenderableObject;e++;return a}function c(){var a=l[i]=l[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var g,e,f=[],h,i,l=[],
|
|
|
-m,k,o=[],p,q=[],n,t,u=[],v,r,z=[],E={objects:[],sprites:[],lights:[],elements:[]},N=new THREE.Vector3,A=new THREE.Vector4,J=new THREE.Matrix4,x=new THREE.Matrix4,w=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,M=new THREE.Vector4;this.computeFrustum=function(a){w[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);w[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);w[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
|
-a.n23,a.n44+a.n24);w[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);w[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);w[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=w[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);J.multiply(b.projectionMatrix,b.matrixWorldInverse);J.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
-J.multiply(b.matrixWorld,b.projectionMatrixInverse);J.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){e=0;E.objects.length=0;E.sprites.length=0;E.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
|
|
|
-e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=w[h].x*d.n14+w[h].y*d.n24+w[h].z*d.n34+w[h].w,c<=e){c=!1;break a}c=!0}c?(J.multiplyVector3(N.copy(b.position)),g=a(),g.object=b,g.z=N.z,E.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(J.multiplyVector3(N.copy(b.position)),g=a(),g.object=b,g.z=N.z,E.sprites.push(g)):b instanceof THREE.Light&&E.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
|
|
|
-E.objects.sort(b);return E};this.projectScene=function(a,e,g){var f=e.near,j=e.far,N,w,F,B,R,Y,O,ga,$,X,aa,ba,V,C,I,Z;r=t=p=k=0;E.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);J.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(J);E=this.projectGraph(a,!1);a=0;for(N=E.objects.length;a<N;a++)if($=E.objects[a].object,X=$.matrixWorld,
|
|
|
-ba=$.material,i=0,$ instanceof THREE.Mesh){aa=$.geometry;V=$.geometry.materials;B=aa.vertices;C=aa.faces;I=aa.faceVertexUvs;aa=$.matrixRotationWorld.extractRotation(X);w=0;for(F=B.length;w<F;w++)h=c(),h.positionWorld.copy(B[w].position),X.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),J.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<j;B=0;for(w=C.length;B<w;B++){F=
|
|
|
-C[B];if(F instanceof THREE.Face3)if(R=l[F.a],Y=l[F.b],O=l[F.c],R.visible&&Y.visible&&O.visible&&($.doubleSided||$.flipSided!=(O.positionScreen.x-R.positionScreen.x)*(Y.positionScreen.y-R.positionScreen.y)-(O.positionScreen.y-R.positionScreen.y)*(Y.positionScreen.x-R.positionScreen.x)<0))ga=o[k]=o[k]||new THREE.RenderableFace3,k++,m=ga,m.v1.copy(R),m.v2.copy(Y),m.v3.copy(O);else continue;else if(F instanceof THREE.Face4)if(R=l[F.a],Y=l[F.b],O=l[F.c],ga=l[F.d],R.visible&&Y.visible&&O.visible&&ga.visible&&
|
|
|
-($.doubleSided||$.flipSided!=((ga.positionScreen.x-R.positionScreen.x)*(Y.positionScreen.y-R.positionScreen.y)-(ga.positionScreen.y-R.positionScreen.y)*(Y.positionScreen.x-R.positionScreen.x)<0||(Y.positionScreen.x-O.positionScreen.x)*(ga.positionScreen.y-O.positionScreen.y)-(Y.positionScreen.y-O.positionScreen.y)*(ga.positionScreen.x-O.positionScreen.x)<0)))Z=q[p]=q[p]||new THREE.RenderableFace4,p++,m=Z,m.v1.copy(R),m.v2.copy(Y),m.v3.copy(O),m.v4.copy(ga);else continue;m.normalWorld.copy(F.normal);
|
|
|
-aa.multiplyVector3(m.normalWorld);m.centroidWorld.copy(F.centroid);X.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);J.multiplyVector3(m.centroidScreen);O=F.vertexNormals;R=0;for(Y=O.length;R<Y;R++)ga=m.vertexNormalsWorld[R],ga.copy(O[R]),aa.multiplyVector3(ga);R=0;for(Y=I.length;R<Y;R++)if(Z=I[R][B]){O=0;for(ga=Z.length;O<ga;O++)m.uvs[R][O]=Z[O]}m.material=ba;m.faceMaterial=F.materialIndex!==null?V[F.materialIndex]:null;m.z=m.centroidScreen.z;E.elements.push(m)}}else if($ instanceof
|
|
|
-THREE.Line){x.multiply(J,X);B=$.geometry.vertices;R=c();R.positionScreen.copy(B[0].position);x.multiplyVector4(R.positionScreen);w=1;for(F=B.length;w<F;w++)if(R=c(),R.positionScreen.copy(B[w].position),x.multiplyVector4(R.positionScreen),Y=l[i-2],D.copy(R.positionScreen),M.copy(Y.positionScreen),d(D,M))D.multiplyScalar(1/D.w),M.multiplyScalar(1/M.w),$=u[t]=u[t]||new THREE.RenderableLine,t++,n=$,n.v1.positionScreen.copy(D),n.v2.positionScreen.copy(M),n.z=Math.max(D.z,M.z),n.material=ba,E.elements.push(n)}a=
|
|
|
-0;for(N=E.sprites.length;a<N;a++)if($=E.sprites[a].object,X=$.matrixWorld,$ instanceof THREE.Particle&&(A.set(X.n14,X.n24,X.n34,1),J.multiplyVector4(A),A.z/=A.w,A.z>0&&A.z<1))f=z[r]=z[r]||new THREE.RenderableParticle,r++,v=f,v.x=A.x/A.w,v.y=A.y/A.w,v.z=A.z,v.rotation=$.rotation.z,v.scale.x=$.scale.x*Math.abs(v.x-(A.x+e.projectionMatrix.n11)/(A.w+e.projectionMatrix.n14)),v.scale.y=$.scale.y*Math.abs(v.y-(A.y+e.projectionMatrix.n22)/(A.w+e.projectionMatrix.n24)),v.material=$.material,E.elements.push(v);
|
|
|
-g&&E.elements.sort(b);return E}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
|
|
|
+THREE.Projector=function(){function a(){var a=f[e]=f[e]||new THREE.RenderableObject;e++;return a}function c(){var a=k[i]=k[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var g,e,f=[],h,i,k=[],
|
|
|
+l,m,o=[],n,s=[],p,u,v=[],y,q,t=[],w={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,L=new THREE.Vector4,J=new THREE.Matrix4,I=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,P=new THREE.Vector4;this.computeFrustum=function(a){D[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);D[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);D[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
|
+a.n23,a.n44+a.n24);D[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);D[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);D[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=D[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);J.multiply(b.projectionMatrix,b.matrixWorldInverse);J.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
+J.multiply(b.matrixWorld,b.projectionMatrixInverse);J.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){e=0;w.objects.length=0;w.sprites.length=0;w.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
|
|
|
+e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=D[h].x*d.n14+D[h].y*d.n24+D[h].z*d.n34+D[h].w,c<=e){c=!1;break a}c=!0}c?(J.multiplyVector3(z.copy(b.position)),g=a(),g.object=b,g.z=z.z,w.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(J.multiplyVector3(z.copy(b.position)),g=a(),g.object=b,g.z=z.z,w.sprites.push(g)):b instanceof THREE.Light&&w.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
|
|
|
+w.objects.sort(b);return w};this.projectScene=function(a,e,g){var f=e.near,z=e.far,D,Z,F,B,Q,O,j,ha,aa,V,ba,U,ea,ca,K,$;q=u=n=m=0;w.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);J.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(J);w=this.projectGraph(a,!1);a=0;for(D=w.objects.length;a<D;a++)if(aa=w.objects[a].object,V=aa.matrixWorld,
|
|
|
+U=aa.material,i=0,aa instanceof THREE.Mesh){ba=aa.geometry;ea=aa.geometry.materials;B=ba.vertices;ca=ba.faces;K=ba.faceVertexUvs;ba=aa.matrixRotationWorld.extractRotation(V);Z=0;for(F=B.length;Z<F;Z++)h=c(),h.positionWorld.copy(B[Z].position),V.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),J.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<z;B=0;for(Z=ca.length;B<
|
|
|
+Z;B++){F=ca[B];if(F instanceof THREE.Face3)if(Q=k[F.a],O=k[F.b],j=k[F.c],Q.visible&&O.visible&&j.visible&&(aa.doubleSided||aa.flipSided!=(j.positionScreen.x-Q.positionScreen.x)*(O.positionScreen.y-Q.positionScreen.y)-(j.positionScreen.y-Q.positionScreen.y)*(O.positionScreen.x-Q.positionScreen.x)<0))ha=o[m]=o[m]||new THREE.RenderableFace3,m++,l=ha,l.v1.copy(Q),l.v2.copy(O),l.v3.copy(j);else continue;else if(F instanceof THREE.Face4)if(Q=k[F.a],O=k[F.b],j=k[F.c],ha=k[F.d],Q.visible&&O.visible&&j.visible&&
|
|
|
+ha.visible&&(aa.doubleSided||aa.flipSided!=((ha.positionScreen.x-Q.positionScreen.x)*(O.positionScreen.y-Q.positionScreen.y)-(ha.positionScreen.y-Q.positionScreen.y)*(O.positionScreen.x-Q.positionScreen.x)<0||(O.positionScreen.x-j.positionScreen.x)*(ha.positionScreen.y-j.positionScreen.y)-(O.positionScreen.y-j.positionScreen.y)*(ha.positionScreen.x-j.positionScreen.x)<0)))$=s[n]=s[n]||new THREE.RenderableFace4,n++,l=$,l.v1.copy(Q),l.v2.copy(O),l.v3.copy(j),l.v4.copy(ha);else continue;l.normalWorld.copy(F.normal);
|
|
|
+ba.multiplyVector3(l.normalWorld);l.centroidWorld.copy(F.centroid);V.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);J.multiplyVector3(l.centroidScreen);j=F.vertexNormals;Q=0;for(O=j.length;Q<O;Q++)ha=l.vertexNormalsWorld[Q],ha.copy(j[Q]),ba.multiplyVector3(ha);Q=0;for(O=K.length;Q<O;Q++)if($=K[Q][B]){j=0;for(ha=$.length;j<ha;j++)l.uvs[Q][j]=$[j]}l.material=U;l.faceMaterial=F.materialIndex!==null?ea[F.materialIndex]:null;l.z=l.centroidScreen.z;w.elements.push(l)}}else if(aa instanceof
|
|
|
+THREE.Line){I.multiply(J,V);B=aa.geometry.vertices;Q=c();Q.positionScreen.copy(B[0].position);I.multiplyVector4(Q.positionScreen);Z=1;for(F=B.length;Z<F;Z++)if(Q=c(),Q.positionScreen.copy(B[Z].position),I.multiplyVector4(Q.positionScreen),O=k[i-2],C.copy(Q.positionScreen),P.copy(O.positionScreen),d(C,P))C.multiplyScalar(1/C.w),P.multiplyScalar(1/P.w),aa=v[u]=v[u]||new THREE.RenderableLine,u++,p=aa,p.v1.positionScreen.copy(C),p.v2.positionScreen.copy(P),p.z=Math.max(C.z,P.z),p.material=U,w.elements.push(p)}a=
|
|
|
+0;for(D=w.sprites.length;a<D;a++)if(aa=w.sprites[a].object,V=aa.matrixWorld,aa instanceof THREE.Particle&&(L.set(V.n14,V.n24,V.n34,1),J.multiplyVector4(L),L.z/=L.w,L.z>0&&L.z<1))f=t[q]=t[q]||new THREE.RenderableParticle,q++,y=f,y.x=L.x/L.w,y.y=L.y/L.w,y.z=L.z,y.rotation=aa.rotation.z,y.scale.x=aa.scale.x*Math.abs(y.x-(L.x+e.projectionMatrix.n11)/(L.w+e.projectionMatrix.n14)),y.scale.y=aa.scale.y*Math.abs(y.y-(L.y+e.projectionMatrix.n22)/(L.w+e.projectionMatrix.n24)),y.material=aa.material,w.elements.push(y);
|
|
|
+g&&w.elements.sort(b);return w}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,d=a.y*c,g=a.z*c,a=Math.cos(d),d=Math.sin(d),c=Math.cos(-g),g=Math.sin(-g),e=Math.cos(b),b=Math.sin(b),f=a*c,h=d*g;this.w=f*e-h*b;this.x=f*b+h*e;this.y=d*c*e+a*g*b;this.z=a*g*e-d*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,d=Math.sin(b);
|
|
|
this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var c=
|
|
|
-this.x,b=this.y,d=this.z,g=this.w,e=a.x,f=a.y,h=a.z,a=a.w;this.x=c*a+g*e+b*h-d*f;this.y=b*a+g*f+d*e-c*h;this.z=d*a+g*h+c*f-b*e;this.w=g*a-c*e-b*f-d*h;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,g=a.z,e=this.x,f=this.y,h=this.z,i=this.w,l=i*b+f*g-h*d,m=i*d+h*b-e*g,k=i*g+e*d-f*b,b=-e*
|
|
|
-b-f*d-h*g;c.x=l*i+b*-e+m*-h-k*-f;c.y=m*i+b*-f+k*-e-l*-h;c.z=k*i+b*-h+l*-f-m*-e;return c}};
|
|
|
+this.x,b=this.y,d=this.z,g=this.w,e=a.x,f=a.y,h=a.z,a=a.w;this.x=c*a+g*e+b*h-d*f;this.y=b*a+g*f+d*e-c*h;this.z=d*a+g*h+c*f-b*e;this.w=g*a-c*e-b*f-d*h;return this},multiply:function(a,c){this.x=a.x*c.w+a.y*c.z-a.z*c.y+a.w*c.x;this.y=-a.x*c.z+a.y*c.w+a.z*c.x+a.w*c.y;this.z=a.x*c.y-a.y*c.x+a.z*c.w+a.w*c.z;this.w=-a.x*c.x-a.y*c.y-a.z*c.z+a.w*c.w;return this},multiplyVector3:function(a,c){c||(c=a);var b=a.x,d=a.y,g=a.z,e=this.x,f=this.y,h=this.z,i=this.w,k=i*b+f*g-h*d,l=i*d+h*b-e*g,m=i*g+e*d-f*b,b=-e*
|
|
|
+b-f*d-h*g;c.x=k*i+b*-e+l*-h-m*-f;c.y=l*i+b*-f+m*-e-k*-h;c.z=m*i+b*-h+k*-f-l*-e;return c}};
|
|
|
THREE.Quaternion.slerp=function(a,c,b,d){var g=a.w*c.w+a.x*c.x+a.y*c.y+a.z*c.z;g<0?(b.w=-c.w,b.x=-c.x,b.y=-c.y,b.z=-c.z,g=-g):b.copy(c);if(Math.abs(g)>=1)return b.w=a.w,b.x=a.x,b.y=a.y,b.z=a.z,b;var e=Math.acos(g),g=Math.sqrt(1-g*g);if(Math.abs(g)<0.0010)return b.w=0.5*(a.w+c.w),b.x=0.5*(a.x+c.x),b.y=0.5*(a.y+c.y),b.z=0.5*(a.z+c.z),b;c=Math.sin((1-d)*e)/g;d=Math.sin(d*e)/g;b.w=a.w*c+b.w*d;b.x=a.x*c+b.x*d;b.y=a.y*c+b.y*d;b.z=a.z*c+b.z*d;return b};THREE.Vertex=function(a){this.position=a||new THREE.Vector3};
|
|
|
THREE.Face3=function(a,c,b,d,g,e){this.a=a;this.b=c;this.c=b;this.normal=d instanceof THREE.Vector3?d:new THREE.Vector3;this.vertexNormals=d instanceof Array?d:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materialIndex=e;this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(a,c,b,d,g,e,f){this.a=a;this.b=c;this.c=b;this.d=d;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=e instanceof THREE.Color?e:new THREE.Color;this.vertexColors=e instanceof Array?e:[];this.vertexTangents=[];this.materialIndex=f;this.centroid=new THREE.Vector3};THREE.UV=function(a,c){this.u=a||0;this.v=c||0};
|
|
@@ -83,15 +83,15 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid
|
|
|
b,d,g,e,f,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(g=this.faces.length;d<g;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);c=0;for(b=e.vertexNormals.length;c<b;c++)h.addSelf(e.vertexNormals[c]);h.divideScalar(3)}else c=this.vertices[e.a],b=this.vertices[e.b],f=this.vertices[e.c],h.sub(f.position,b.position),i.sub(c.position,b.position),h.crossSelf(i);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
|
|
|
Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
|
|
|
THREE.Face3?(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal),d[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(d[b.a]),b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(d[b.a]),
|
|
|
-b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,P){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;m=f[e];k=f[g];o=f[P];p=i.x-h.x;q=l.x-h.x;n=i.y-h.y;t=l.y-h.y;u=i.z-h.z;v=l.z-h.z;r=k.u-m.u;z=o.u-m.u;E=k.v-m.v;N=o.v-m.v;A=1/(r*N-z*E);D.set((N*p-E*q)*A,(N*n-E*t)*A,(N*u-E*v)*A);M.set((r*q-z*p)*A,(r*t-z*n)*A,(r*v-z*u)*A);x[b].addSelf(D);x[c].addSelf(D);x[d].addSelf(D);w[b].addSelf(M);
|
|
|
-w[c].addSelf(M);w[d].addSelf(M)}var c,b,d,g,e,f,h,i,l,m,k,o,p,q,n,t,u,v,r,z,E,N,A,J,x=[],w=[],D=new THREE.Vector3,M=new THREE.Vector3,S=new THREE.Vector3,ca=new THREE.Vector3,L=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)x[c]=new THREE.Vector3,w[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var P=["a",
|
|
|
-"b","c","d"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)L.copy(e.vertexNormals[d]),g=e[P[d]],J=x[g],S.copy(J),S.subSelf(L.multiplyScalar(L.dot(J))).normalize(),ca.cross(e.vertexNormals[d],J),g=ca.dot(w[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(S.x,S.y,S.z,g)}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,
|
|
|
+b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,O){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=f[e];m=f[g];o=f[O];n=i.x-h.x;s=k.x-h.x;p=i.y-h.y;u=k.y-h.y;v=i.z-h.z;y=k.z-h.z;q=m.u-l.u;t=o.u-l.u;w=m.v-l.v;z=o.v-l.v;L=1/(q*z-t*w);C.set((z*n-w*s)*L,(z*p-w*u)*L,(z*v-w*y)*L);P.set((q*s-t*n)*L,(q*u-t*p)*L,(q*y-t*v)*L);I[b].addSelf(C);I[c].addSelf(C);I[d].addSelf(C);D[b].addSelf(P);
|
|
|
+D[c].addSelf(P);D[d].addSelf(P)}var c,b,d,g,e,f,h,i,k,l,m,o,n,s,p,u,v,y,q,t,w,z,L,J,I=[],D=[],C=new THREE.Vector3,P=new THREE.Vector3,R=new THREE.Vector3,fa=new THREE.Vector3,M=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)I[c]=new THREE.Vector3,D[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var N=["a",
|
|
|
+"b","c","d"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)M.copy(e.vertexNormals[d]),g=e[N[d]],J=I[g],R.copy(J),R.subSelf(M.multiplyScalar(M.dot(J))).normalize(),fa.cross(e.vertexNormals[d],J),g=fa.dot(D[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(R.x,R.y,R.z,g)}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 c=1,b=this.vertices.length;c<b;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=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],d,g=Math.pow(10,4),e,f;e=0;for(f=this.vertices.length;e<f;e++)d=this.vertices[e].position,d=[Math.round(d.x*g),Math.round(d.y*g),Math.round(d.z*g)].join("_"),a[d]===void 0?(a[d]=e,c.push(this.vertices[e]),
|
|
|
b[e]=c.length-1):b[e]=b[a[d]];e=0;for(f=this.faces.length;e<f;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
|
|
|
-THREE.Spline=function(a){function c(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var b=[],d={x:0,y:0,z:0},g,e,f,h,i,l,m,k,o;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){g=(this.points.length-1)*a;e=Math.floor(g);f=g-e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>this.points.length-2?e:e+1;b[3]=e>this.points.length-3?e:e+2;l=this.points[b[0]];m=this.points[b[1]];
|
|
|
-k=this.points[b[2]];o=this.points[b[3]];h=f*f;i=f*h;d.x=c(l.x,m.x,k.x,o.x,f,h,i);d.y=c(l.y,m.y,k.y,o.y,f,h,i);d.z=c(l.z,m.z,k.z,o.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
|
|
|
-g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,g,f,h=[],i=new THREE.Vector3,l=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=l.chunks[b]-l.chunks[b-1];f=Math.ceil(a*c/l.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<f-1;c++)d=e+c*(1/f)*(g-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
|
|
|
+THREE.Spline=function(a){function c(a,b,c,d,e,g,f){a=(c-a)*0.5;d=(d-b)*0.5;return(2*(b-c)+a+d)*f+(-3*(b-c)-2*a-d)*g+a*e+b}this.points=a;var b=[],d={x:0,y:0,z:0},g,e,f,h,i,k,l,m,o;this.initFromArray=function(a){this.points=[];for(var b=0;b<a.length;b++)this.points[b]={x:a[b][0],y:a[b][1],z:a[b][2]}};this.getPoint=function(a){g=(this.points.length-1)*a;e=Math.floor(g);f=g-e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>this.points.length-2?e:e+1;b[3]=e>this.points.length-3?e:e+2;k=this.points[b[0]];l=this.points[b[1]];
|
|
|
+m=this.points[b[2]];o=this.points[b[3]];h=f*f;i=f*h;d.x=c(k.x,l.x,m.x,o.x,f,h,i);d.y=c(k.y,l.y,m.y,o.y,f,h,i);d.z=c(k.z,l.z,m.z,o.z,f,h,i);return d};this.getControlPointsArray=function(){var a,b,c=this.points.length,d=[];for(a=0;a<c;a++)b=this.points[a],d[a]=[b.x,b.y,b.z];return d};this.getLength=function(a){var b,c,d,e=b=b=0,g=new THREE.Vector3,f=new THREE.Vector3,h=[],i=0;h[0]=0;a||(a=100);c=this.points.length*a;g.copy(this.points[0]);for(a=1;a<c;a++)b=a/c,d=this.getPoint(b),f.copy(d),i+=f.distanceTo(g),
|
|
|
+g.copy(d),b*=this.points.length-1,b=Math.floor(b),b!=e&&(h[b]=i,e=b);h[h.length]=i;return{chunks:h,total:i}};this.reparametrizeByArcLength=function(a){var b,c,d,e,g,f,h=[],i=new THREE.Vector3,k=this.getLength();h.push(i.copy(this.points[0]).clone());for(b=1;b<this.points.length;b++){c=k.chunks[b]-k.chunks[b-1];f=Math.ceil(a*c/k.total);e=(b-1)/(this.points.length-1);g=b/(this.points.length-1);for(c=1;c<f-1;c++)d=e+c*(1/f)*(g-e),d=this.getPoint(d),h.push(i.copy(d).clone());h.push(i.copy(this.points[b]).clone())}this.points=
|
|
|
h}};THREE.Edge=function(a,c,b,d){this.vertices=[a,c];this.vertexIndices=[b,d];this.faces=[];this.faceIndices=[]};THREE.Camera=function(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4;this.projectionMatrixInverse=new THREE.Matrix4};
|
|
|
THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.lookAt=function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};THREE.OrthographicCamera=function(a,c,b,d,g,e){THREE.Camera.call(this);this.left=a;this.right=c;this.top=b;this.bottom=d;this.near=g!==void 0?g:0.1;this.far=e!==void 0?e:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;
|
|
|
THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};THREE.PerspectiveCamera=function(a,c,b,d){THREE.Camera.call(this);this.fov=a!==void 0?a:50;this.aspect=c!==void 0?c:1;this.near=b!==void 0?b:0.1;this.far=d!==void 0?d:2E3;this.updateProjectionMatrix()};THREE.PerspectiveCamera.prototype=new THREE.Camera;
|
|
@@ -148,46 +148,46 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.overrideMaterial=this.fog=
|
|
|
THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a);var c=this.__objectsRemoved.indexOf(a);c!==-1&&this.__objectsRemoved.splice(c,1)}for(c=0;c<a.children.length;c++)this.addObject(a.children[c])};
|
|
|
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
|
|
|
THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,g,e;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;d=c;g=b/2;e=d/2};this.render=function(b,d){var i,l,m,k,o,p,q,n;a=c.projectScene(b,d);i=0;for(l=a.length;i<l;i++)if(o=a[i],o instanceof THREE.RenderableParticle){q=o.x*g+g;n=o.y*e+e;m=0;for(k=o.material.length;m<k;m++)if(p=o.material[m],p instanceof THREE.ParticleDOMMaterial)p=p.domElement,p.style.left=q+"px",p.style.top=n+"px"}}};
|
|
|
-THREE.CanvasRenderer=function(a){function c(a){if(v!=a)n.globalAlpha=v=a}function b(a){if(r!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}r=a}}function d(a){if(z!=a)n.strokeStyle=z=a}function g(a){if(E!=a)n.fillStyle=E=a}var e=this,f,h,i,l=new THREE.Projector,a=a||{},m=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
-k,o,p,q,n=m.getContext("2d"),t=new THREE.Color(0),u=0,v=1,r=0,z=null,E=null,N=null,A=null,J=null,x,w,D,M,S=new THREE.RenderableVertex,ca=new THREE.RenderableVertex,L,P,j,ea,ha,F,B,R,Y,O,ga,$,X=new THREE.Color,aa=new THREE.Color,ba=new THREE.Color,V=new THREE.Color,C=new THREE.Color,I=[],Z,da,ja,na,oa,sa,ra,ua,xa,Q,G=new THREE.Rectangle,H=new THREE.Rectangle,U=new THREE.Rectangle,fa=!1,la=new THREE.Color,ka=new THREE.Color,ma=new THREE.Color,W=new THREE.Vector3,va,ia,ya,pa,wa,Ca,a=16;va=document.createElement("canvas");
|
|
|
-va.width=va.height=2;ia=va.getContext("2d");ia.fillStyle="rgba(0,0,0,1)";ia.fillRect(0,0,2,2);ya=ia.getImageData(0,0,2,2);pa=ya.data;wa=document.createElement("canvas");wa.width=wa.height=a;Ca=wa.getContext("2d");Ca.translate(-a/2,-a/2);Ca.scale(a,a);a--;this.domElement=m;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){k=a;o=b;p=Math.floor(k/2);q=Math.floor(o/2);m.width=k;m.height=o;G.set(-p,-q,p,q);H.set(-p,-q,p,q);v=1;r=0;J=
|
|
|
-A=N=E=z=null};this.setClearColor=function(a,b){t.copy(a);u=b;H.set(-p,-q,p,q)};this.setClearColorHex=function(a,b){t.setHex(a);u=b;H.set(-p,-q,p,q)};this.clear=function(){n.setTransform(1,0,0,-1,p,q);H.isEmpty()||(H.minSelf(G),H.inflate(2),u<1&&n.clearRect(Math.floor(H.getX()),Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight())),u>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(t.r*255)+","+Math.floor(t.g*255)+","+Math.floor(t.b*255)+","+u+")"),n.fillRect(Math.floor(H.getX()),
|
|
|
-Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight()))),H.empty())};this.render=function(a,m){function k(a){var b,c,d,e;la.setRGB(0,0,0);ka.setRGB(0,0,0);ma.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(la.r+=e.r,la.g+=e.g,la.b+=e.b):d instanceof THREE.DirectionalLight?(ka.r+=e.r,ka.g+=e.g,ka.b+=e.b):d instanceof THREE.PointLight&&(ma.r+=e.r,ma.g+=e.g,ma.b+=e.b)}function o(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,
|
|
|
-f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(W.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function t(a,e,f){c(f.opacity);b(f.blending);var j,h,i,l,m,k;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)l=f.map.image,m=l.width>>1,k=l.height>>
|
|
|
-1,f=e.scale.x*p,i=e.scale.y*q,j=f*m,h=i*k,U.set(a.x-j,a.y-h,a.x+j,a.y+h),G.intersects(U)&&(n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(f,-i),n.translate(-m,-k),n.drawImage(l,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*p,h=e.scale.y*q,U.set(a.x-j,a.y-h,a.x+j,a.y+h),G.intersects(U)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(j,h),f.program(n),n.restore()))}function Ka(a,e,g,
|
|
|
-f){c(f.opacity);b(f.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(N!=a)n.lineWidth=N=a;a=f.linecap;if(A!=a)n.lineCap=A=a;a=f.linejoin;if(J!=a)n.lineJoin=J=a;d(f.color.getContextStyle());n.stroke();U.inflate(f.linewidth*2)}}function r(a,d,f,g,h,l,p,k){e.info.render.vertices+=3;e.info.render.faces++;c(k.opacity);b(k.blending);L=a.positionScreen.x;P=a.positionScreen.y;
|
|
|
-j=d.positionScreen.x;ea=d.positionScreen.y;ha=f.positionScreen.x;F=f.positionScreen.y;u(L,P,j,ea,ha,F);if(k instanceof THREE.MeshBasicMaterial)if(k.map)k.map.mapping instanceof THREE.UVMapping&&(na=p.uvs[0],Aa(L,P,j,ea,ha,F,na[g].u,na[g].v,na[h].u,na[h].v,na[l].u,na[l].v,k.map));else if(k.envMap){if(k.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=m.matrixWorldInverse,W.copy(p.vertexNormalsWorld[g]),oa=(W.x*a.n11+W.y*a.n12+W.z*a.n13)*0.5+0.5,sa=-(W.x*a.n21+W.y*a.n22+W.z*a.n23)*0.5+0.5,
|
|
|
-W.copy(p.vertexNormalsWorld[h]),ra=(W.x*a.n11+W.y*a.n12+W.z*a.n13)*0.5+0.5,ua=-(W.x*a.n21+W.y*a.n22+W.z*a.n23)*0.5+0.5,W.copy(p.vertexNormalsWorld[l]),xa=(W.x*a.n11+W.y*a.n12+W.z*a.n13)*0.5+0.5,Q=-(W.x*a.n21+W.y*a.n22+W.z*a.n23)*0.5+0.5,Aa(L,P,j,ea,ha,F,oa,sa,ra,ua,xa,Q,k.envMap)}else k.wireframe?v(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):z(k.color);else if(k instanceof THREE.MeshLambertMaterial)k.map&&!k.wireframe&&(k.map.mapping instanceof THREE.UVMapping&&(na=p.uvs[0],
|
|
|
-Aa(L,P,j,ea,ha,F,na[g].u,na[g].v,na[h].u,na[h].v,na[l].u,na[l].v,k.map)),b(THREE.SubtractiveBlending)),fa?!k.wireframe&&k.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3?(aa.r=ba.r=V.r=la.r,aa.g=ba.g=V.g=la.g,aa.b=ba.b=V.b=la.b,o(i,p.v1.positionWorld,p.vertexNormalsWorld[0],aa),o(i,p.v2.positionWorld,p.vertexNormalsWorld[1],ba),o(i,p.v3.positionWorld,p.vertexNormalsWorld[2],V),aa.r=Math.max(0,Math.min(k.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(k.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(k.color.b*
|
|
|
-aa.b,1)),ba.r=Math.max(0,Math.min(k.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(k.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(k.color.b*ba.b,1)),V.r=Math.max(0,Math.min(k.color.r*V.r,1)),V.g=Math.max(0,Math.min(k.color.g*V.g,1)),V.b=Math.max(0,Math.min(k.color.b*V.b,1)),C.r=(ba.r+V.r)*0.5,C.g=(ba.g+V.g)*0.5,C.b=(ba.b+V.b)*0.5,ja=E(aa,ba,V,C),Ea(L,P,j,ea,ha,F,0,0,1,0,0,1,ja)):(X.r=la.r,X.g=la.g,X.b=la.b,o(i,p.centroidWorld,p.normalWorld,X),X.r=Math.max(0,Math.min(k.color.r*X.r,1)),X.g=Math.max(0,Math.min(k.color.g*
|
|
|
-X.g,1)),X.b=Math.max(0,Math.min(k.color.b*X.b,1)),k.wireframe?v(X,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):z(X)):k.wireframe?v(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):z(k.color);else if(k instanceof THREE.MeshDepthMaterial)Z=m.near,da=m.far,aa.r=aa.g=aa.b=1-Da(a.positionScreen.z,Z,da),ba.r=ba.g=ba.b=1-Da(d.positionScreen.z,Z,da),V.r=V.g=V.b=1-Da(f.positionScreen.z,Z,da),C.r=(ba.r+V.r)*0.5,C.g=(ba.g+V.g)*0.5,C.b=(ba.b+V.b)*0.5,ja=E(aa,ba,V,C),Ea(L,P,
|
|
|
-j,ea,ha,F,0,0,1,0,0,1,ja);else if(k instanceof THREE.MeshNormalMaterial)X.r=Fa(p.normalWorld.x),X.g=Fa(p.normalWorld.y),X.b=Fa(p.normalWorld.z),k.wireframe?v(X,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):z(X)}function La(a,d,f,g,h,p,l,k,qa){e.info.render.vertices+=4;e.info.render.faces++;c(k.opacity);b(k.blending);if(k.map||k.envMap)r(a,d,g,0,1,3,l,k,qa),r(h,f,p,1,2,3,l,k,qa);else if(L=a.positionScreen.x,P=a.positionScreen.y,j=d.positionScreen.x,ea=d.positionScreen.y,ha=f.positionScreen.x,
|
|
|
-F=f.positionScreen.y,B=g.positionScreen.x,R=g.positionScreen.y,Y=h.positionScreen.x,O=h.positionScreen.y,ga=p.positionScreen.x,$=p.positionScreen.y,k instanceof THREE.MeshBasicMaterial)Ga(L,P,j,ea,ha,F,B,R),k.wireframe?v(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):z(k.color);else if(k instanceof THREE.MeshLambertMaterial)fa?!k.wireframe&&k.shading==THREE.SmoothShading&&l.vertexNormalsWorld.length==4?(aa.r=ba.r=V.r=C.r=la.r,aa.g=ba.g=V.g=C.g=la.g,aa.b=ba.b=V.b=C.b=la.b,o(i,
|
|
|
-l.v1.positionWorld,l.vertexNormalsWorld[0],aa),o(i,l.v2.positionWorld,l.vertexNormalsWorld[1],ba),o(i,l.v4.positionWorld,l.vertexNormalsWorld[3],V),o(i,l.v3.positionWorld,l.vertexNormalsWorld[2],C),aa.r=Math.max(0,Math.min(k.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(k.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(k.color.b*aa.b,1)),ba.r=Math.max(0,Math.min(k.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(k.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(k.color.b*ba.b,1)),V.r=Math.max(0,Math.min(k.color.r*V.r,1)),
|
|
|
-V.g=Math.max(0,Math.min(k.color.g*V.g,1)),V.b=Math.max(0,Math.min(k.color.b*V.b,1)),C.r=Math.max(0,Math.min(k.color.r*C.r,1)),C.g=Math.max(0,Math.min(k.color.g*C.g,1)),C.b=Math.max(0,Math.min(k.color.b*C.b,1)),ja=E(aa,ba,V,C),u(L,P,j,ea,B,R),Ea(L,P,j,ea,B,R,0,0,1,0,0,1,ja),u(Y,O,ha,F,ga,$),Ea(Y,O,ha,F,ga,$,1,0,1,1,0,1,ja)):(X.r=la.r,X.g=la.g,X.b=la.b,o(i,l.centroidWorld,l.normalWorld,X),X.r=Math.max(0,Math.min(k.color.r*X.r,1)),X.g=Math.max(0,Math.min(k.color.g*X.g,1)),X.b=Math.max(0,Math.min(k.color.b*
|
|
|
-X.b,1)),Ga(L,P,j,ea,ha,F,B,R),k.wireframe?v(X,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):z(X)):(Ga(L,P,j,ea,ha,F,B,R),k.wireframe?v(k.color,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):z(k.color));else if(k instanceof THREE.MeshNormalMaterial)X.r=Fa(l.normalWorld.x),X.g=Fa(l.normalWorld.y),X.b=Fa(l.normalWorld.z),Ga(L,P,j,ea,ha,F,B,R),k.wireframe?v(X,k.wireframeLinewidth,k.wireframeLinecap,k.wireframeLinejoin):z(X);else if(k instanceof THREE.MeshDepthMaterial)Z=m.near,
|
|
|
-da=m.far,aa.r=aa.g=aa.b=1-Da(a.positionScreen.z,Z,da),ba.r=ba.g=ba.b=1-Da(d.positionScreen.z,Z,da),V.r=V.g=V.b=1-Da(g.positionScreen.z,Z,da),C.r=C.g=C.b=1-Da(f.positionScreen.z,Z,da),ja=E(aa,ba,V,C),u(L,P,j,ea,B,R),Ea(L,P,j,ea,B,R,0,0,1,0,0,1,ja),u(Y,O,ha,F,ga,$),Ea(Y,O,ha,F,ga,$,1,0,1,1,0,1,ja)}function u(a,b,c,d,e,f){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(a,b);n.closePath()}function Ga(a,b,c,d,e,f,g,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,f);n.lineTo(g,
|
|
|
-h);n.lineTo(a,b);n.closePath()}function v(a,b,c,e){if(N!=b)n.lineWidth=N=b;if(A!=c)n.lineCap=A=c;if(J!=e)n.lineJoin=J=e;d(a.getContextStyle());n.stroke();U.inflate(b*2)}function z(a){g(a.getContextStyle());n.fill()}function Aa(a,b,c,d,e,f,h,j,i,k,l,p,m){if(m.image.width!=0){if(m.needsUpdate==!0||I[m.id]==void 0){var qa=m.wrapS==THREE.RepeatWrapping,o=m.wrapT==THREE.RepeatWrapping;I[m.id]=n.createPattern(m.image,qa&&o?"repeat":qa&&!o?"repeat-x":!qa&&o?"repeat-y":"no-repeat");m.needsUpdate=!1}g(I[m.id]);
|
|
|
-var qa=m.offset.x/m.repeat.x,o=m.offset.y/m.repeat.y,Q=(m.image.width-1)*m.repeat.x,m=(m.image.height-1)*m.repeat.y,h=(h+qa)*Q,j=(j+o)*m,i=(i+qa)*Q,k=(k+o)*m,l=(l+qa)*Q,p=(p+o)*m;c-=a;d-=b;e-=a;f-=b;i-=h;k-=j;l-=h;p-=j;qa=1/(i*p-l*k);m=(p*c-k*e)*qa;k=(p*d-k*f)*qa;c=(i*e-l*c)*qa;d=(i*f-l*d)*qa;a=a-m*h-c*j;b=b-k*h-d*j;n.save();n.transform(m,k,c,d,a,b);n.fill();n.restore()}}function Ea(a,b,c,d,e,f,g,h,j,i,k,l,p){var m,qa;m=p.width-1;qa=p.height-1;g*=m;h*=qa;j*=m;i*=qa;k*=m;l*=qa;c-=a;d-=b;e-=a;f-=b;
|
|
|
-j-=g;i-=h;k-=g;l-=h;qa=1/(j*l-k*i);m=(l*c-i*e)*qa;i=(l*d-i*f)*qa;c=(j*e-k*c)*qa;d=(j*f-k*d)*qa;a=a-m*g-c*h;b=b-i*g-d*h;n.save();n.transform(m,i,c,d,a,b);n.clip();n.drawImage(p,0,0);n.restore()}function E(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),j=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);pa[0]=e<0?0:e>255?255:e;pa[1]=f<0?0:f>255?255:f;pa[2]=a<0?0:a>255?255:a;pa[4]=g<0?0:g>255?255:g;pa[5]=h<0?0:h>255?255:
|
|
|
-h;pa[6]=b<0?0:b>255?255:b;pa[8]=j<0?0:j>255?255:j;pa[9]=i<0?0:i>255?255:i;pa[10]=c<0?0:c>255?255:c;pa[12]=k<0?0:k>255?255:k;pa[13]=l<0?0:l>255?255:l;pa[14]=d<0?0:d>255?255:d;ia.putImageData(ya,0,0);Ca.drawImage(va,0,0);return wa}function Da(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Fa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ba(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ha,Ja,ta,za;this.autoClear?this.clear():n.setTransform(1,
|
|
|
-0,0,-1,p,q);e.info.render.vertices=0;e.info.render.faces=0;f=l.projectScene(a,m,this.sortElements);h=f.elements;i=f.lights;(fa=i.length>0)&&k(i);Ha=0;for(Ja=h.length;Ha<Ja;Ha++)if(ta=h[Ha],za=ta.material,za=za instanceof THREE.MeshFaceMaterial?ta.faceMaterial:za,!(za==null||za.opacity==0)){U.empty();if(ta instanceof THREE.RenderableParticle)x=ta,x.x*=p,x.y*=q,t(x,ta,za,a);else if(ta instanceof THREE.RenderableLine)x=ta.v1,w=ta.v2,x.positionScreen.x*=p,x.positionScreen.y*=q,w.positionScreen.x*=p,w.positionScreen.y*=
|
|
|
-q,U.addPoint(x.positionScreen.x,x.positionScreen.y),U.addPoint(w.positionScreen.x,w.positionScreen.y),G.intersects(U)&&Ka(x,w,ta,za,a);else if(ta instanceof THREE.RenderableFace3)x=ta.v1,w=ta.v2,D=ta.v3,x.positionScreen.x*=p,x.positionScreen.y*=q,w.positionScreen.x*=p,w.positionScreen.y*=q,D.positionScreen.x*=p,D.positionScreen.y*=q,za.overdraw&&(Ba(x.positionScreen,w.positionScreen),Ba(w.positionScreen,D.positionScreen),Ba(D.positionScreen,x.positionScreen)),U.add3Points(x.positionScreen.x,x.positionScreen.y,
|
|
|
-w.positionScreen.x,w.positionScreen.y,D.positionScreen.x,D.positionScreen.y),G.intersects(U)&&r(x,w,D,0,1,2,ta,za,a);else if(ta instanceof THREE.RenderableFace4)x=ta.v1,w=ta.v2,D=ta.v3,M=ta.v4,x.positionScreen.x*=p,x.positionScreen.y*=q,w.positionScreen.x*=p,w.positionScreen.y*=q,D.positionScreen.x*=p,D.positionScreen.y*=q,M.positionScreen.x*=p,M.positionScreen.y*=q,S.positionScreen.copy(w.positionScreen),ca.positionScreen.copy(M.positionScreen),za.overdraw&&(Ba(x.positionScreen,w.positionScreen),
|
|
|
-Ba(w.positionScreen,M.positionScreen),Ba(M.positionScreen,x.positionScreen),Ba(D.positionScreen,S.positionScreen),Ba(D.positionScreen,ca.positionScreen)),U.addPoint(x.positionScreen.x,x.positionScreen.y),U.addPoint(w.positionScreen.x,w.positionScreen.y),U.addPoint(D.positionScreen.x,D.positionScreen.y),U.addPoint(M.positionScreen.x,M.positionScreen.y),G.intersects(U)&&La(x,w,D,M,S,ca,ta,za,a);H.addRectangle(U)}n.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,k;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),k=c.dot(i),k<=0||(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),k=c.dot(x.sub(i,b).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),k!=0&&(k*=g.intensity,d.r+=h.r*k,d.g+=h.g*k,d.b+=h.b*k)))}function c(a){w[a]==null&&(w[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"path"),L==0&&w[a].setAttribute("shape-rendering","crispEdges"));return w[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,m,k,o,p,q,n,t,u=new THREE.Rectangle,v=new THREE.Rectangle,r=!1,z=new THREE.Color,E=new THREE.Color,N=new THREE.Color,A=new THREE.Color,J,x=new THREE.Vector3,w=[],D=[],M,S,ca,L=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
-faces:0}};this.setQuality=function(a){switch(a){case "high":L=1;break;case "low":L=0}};this.setSize=function(a,b){l=a;m=b;k=l/2;o=m/2;i.setAttribute("viewBox",-k+" "+-o+" "+l+" "+m);i.setAttribute("width",l);i.setAttribute("height",m);u.set(-k,-o,k,o)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(l,j){var m,x,F,B;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(l,j,this.sortElements);e=g.elements;
|
|
|
-f=g.lights;ca=S=0;if(r=f.length>0){E.setRGB(0,0,0);N.setRGB(0,0,0);A.setRGB(0,0,0);m=0;for(x=f.length;m<x;m++)B=f[m],F=B.color,B instanceof THREE.AmbientLight?(E.r+=F.r,E.g+=F.g,E.b+=F.b):B instanceof THREE.DirectionalLight?(N.r+=F.r,N.g+=F.g,N.b+=F.b):B instanceof THREE.PointLight&&(A.r+=F.r,A.g+=F.g,A.b+=F.b)}m=0;for(x=e.length;m<x;m++)if(F=e[m],B=F.material,B=B instanceof THREE.MeshFaceMaterial?F.faceMaterial:B,!(B==null||B.opacity==0))if(v.empty(),F instanceof THREE.RenderableParticle)p=F,p.x*=
|
|
|
-k,p.y*=-o;else if(F instanceof THREE.RenderableLine){if(p=F.v1,q=F.v2,p.positionScreen.x*=k,p.positionScreen.y*=-o,q.positionScreen.x*=k,q.positionScreen.y*=-o,v.addPoint(p.positionScreen.x,p.positionScreen.y),v.addPoint(q.positionScreen.x,q.positionScreen.y),u.intersects(v)){F=p;var w=q,Y=ca++;D[Y]==null&&(D[Y]=document.createElementNS("http://www.w3.org/2000/svg","line"),L==0&&D[Y].setAttribute("shape-rendering","crispEdges"));M=D[Y];M.setAttribute("x1",F.positionScreen.x);M.setAttribute("y1",F.positionScreen.y);
|
|
|
-M.setAttribute("x2",w.positionScreen.x);M.setAttribute("y2",w.positionScreen.y);B instanceof THREE.LineBasicMaterial&&(M.setAttribute("style","fill: none; stroke: "+B.color.getContextStyle()+"; stroke-width: "+B.linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.linecap+"; stroke-linejoin: "+B.linejoin),i.appendChild(M))}}else if(F instanceof THREE.RenderableFace3){if(p=F.v1,q=F.v2,n=F.v3,p.positionScreen.x*=k,p.positionScreen.y*=-o,q.positionScreen.x*=k,q.positionScreen.y*=-o,n.positionScreen.x*=
|
|
|
-k,n.positionScreen.y*=-o,v.addPoint(p.positionScreen.x,p.positionScreen.y),v.addPoint(q.positionScreen.x,q.positionScreen.y),v.addPoint(n.positionScreen.x,n.positionScreen.y),u.intersects(v)){var w=p,Y=q,O=n;d.info.render.vertices+=3;d.info.render.faces++;M=c(S++);M.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+"z");B instanceof THREE.MeshBasicMaterial?z.copy(B.color):B instanceof THREE.MeshLambertMaterial?
|
|
|
-r?(z.r=E.r,z.g=E.g,z.b=E.b,a(f,F.centroidWorld,F.normalWorld,z),z.r=Math.max(0,Math.min(B.color.r*z.r,1)),z.g=Math.max(0,Math.min(B.color.g*z.g,1)),z.b=Math.max(0,Math.min(B.color.b*z.b,1))):z.copy(B.color):B instanceof THREE.MeshDepthMaterial?(J=1-B.__2near/(B.__farPlusNear-F.z*B.__farMinusNear),z.setRGB(J,J,J)):B instanceof THREE.MeshNormalMaterial&&z.setRGB(b(F.normalWorld.x),b(F.normalWorld.y),b(F.normalWorld.z));B.wireframe?M.setAttribute("style","fill: none; stroke: "+z.getContextStyle()+"; stroke-width: "+
|
|
|
-B.wireframeLinewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframeLinecap+"; stroke-linejoin: "+B.wireframeLinejoin):M.setAttribute("style","fill: "+z.getContextStyle()+"; fill-opacity: "+B.opacity);i.appendChild(M)}}else if(F instanceof THREE.RenderableFace4&&(p=F.v1,q=F.v2,n=F.v3,t=F.v4,p.positionScreen.x*=k,p.positionScreen.y*=-o,q.positionScreen.x*=k,q.positionScreen.y*=-o,n.positionScreen.x*=k,n.positionScreen.y*=-o,t.positionScreen.x*=k,t.positionScreen.y*=-o,v.addPoint(p.positionScreen.x,
|
|
|
-p.positionScreen.y),v.addPoint(q.positionScreen.x,q.positionScreen.y),v.addPoint(n.positionScreen.x,n.positionScreen.y),v.addPoint(t.positionScreen.x,t.positionScreen.y),u.intersects(v))){var w=p,Y=q,O=n,ga=t;d.info.render.vertices+=4;d.info.render.faces++;M=c(S++);M.setAttribute("d","M "+w.positionScreen.x+" "+w.positionScreen.y+" L "+Y.positionScreen.x+" "+Y.positionScreen.y+" L "+O.positionScreen.x+","+O.positionScreen.y+" L "+ga.positionScreen.x+","+ga.positionScreen.y+"z");B instanceof THREE.MeshBasicMaterial?
|
|
|
-z.copy(B.color):B instanceof THREE.MeshLambertMaterial?r?(z.r=E.r,z.g=E.g,z.b=E.b,a(f,F.centroidWorld,F.normalWorld,z),z.r=Math.max(0,Math.min(B.color.r*z.r,1)),z.g=Math.max(0,Math.min(B.color.g*z.g,1)),z.b=Math.max(0,Math.min(B.color.b*z.b,1))):z.copy(B.color):B instanceof THREE.MeshDepthMaterial?(J=1-B.__2near/(B.__farPlusNear-F.z*B.__farMinusNear),z.setRGB(J,J,J)):B instanceof THREE.MeshNormalMaterial&&z.setRGB(b(F.normalWorld.x),b(F.normalWorld.y),b(F.normalWorld.z));B.wireframe?M.setAttribute("style",
|
|
|
-"fill: none; stroke: "+z.getContextStyle()+"; stroke-width: "+B.wireframeLinewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframeLinecap+"; stroke-linejoin: "+B.wireframeLinejoin):M.setAttribute("style","fill: "+z.getContextStyle()+"; fill-opacity: "+B.opacity);i.appendChild(M)}}};
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,g,e;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;d=c;g=b/2;e=d/2};this.render=function(b,d){var i,k,l,m,o,n,s,p;a=c.projectScene(b,d);i=0;for(k=a.length;i<k;i++)if(o=a[i],o instanceof THREE.RenderableParticle){s=o.x*g+g;p=o.y*e+e;l=0;for(m=o.material.length;l<m;l++)if(n=o.material[l],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=s+"px",n.style.top=p+"px"}}};
|
|
|
+THREE.CanvasRenderer=function(a){function c(a){if(y!=a)p.globalAlpha=y=a}function b(a){if(q!=a){switch(a){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}q=a}}function d(a){if(t!=a)p.strokeStyle=t=a}function g(a){if(w!=a)p.fillStyle=w=a}var e=this,f,h,i,k=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
+m,o,n,s,p=l.getContext("2d"),u=new THREE.Color(0),v=0,y=1,q=0,t=null,w=null,z=null,L=null,J=null,I,D,C,P,R=new THREE.RenderableVertex,fa=new THREE.RenderableVertex,M,N,ga,ka,Z,F,B,Q,O,j,ha,aa,V=new THREE.Color,ba=new THREE.Color,U=new THREE.Color,ea=new THREE.Color,ca=new THREE.Color,K=[],$,la,oa,na,ua,va,pa,ra,Aa,x,S=new THREE.Rectangle,E=new THREE.Rectangle,Y=new THREE.Rectangle,ja=!1,H=new THREE.Color,ia=new THREE.Color,W=new THREE.Color,X=new THREE.Vector3,sa,xa,ma,G,ya,ta,a=16;sa=document.createElement("canvas");
|
|
|
+sa.width=sa.height=2;xa=sa.getContext("2d");xa.fillStyle="rgba(0,0,0,1)";xa.fillRect(0,0,2,2);ma=xa.getImageData(0,0,2,2);G=ma.data;ya=document.createElement("canvas");ya.width=ya.height=a;ta=ya.getContext("2d");ta.translate(-a/2,-a/2);ta.scale(a,a);a--;this.domElement=l;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){m=a;o=b;n=Math.floor(m/2);s=Math.floor(o/2);l.width=m;l.height=o;S.set(-n,-s,n,s);E.set(-n,-s,n,s);y=1;q=0;J=
|
|
|
+L=z=w=t=null};this.setClearColor=function(a,b){u.copy(a);v=b;E.set(-n,-s,n,s)};this.setClearColorHex=function(a,b){u.setHex(a);v=b;E.set(-n,-s,n,s)};this.clear=function(){p.setTransform(1,0,0,-1,n,s);E.isEmpty()||(E.minSelf(S),E.inflate(2),v<1&&p.clearRect(Math.floor(E.getX()),Math.floor(E.getY()),Math.floor(E.getWidth()),Math.floor(E.getHeight())),v>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(u.r*255)+","+Math.floor(u.g*255)+","+Math.floor(u.b*255)+","+v+")"),p.fillRect(Math.floor(E.getX()),
|
|
|
+Math.floor(E.getY()),Math.floor(E.getWidth()),Math.floor(E.getHeight()))),E.empty())};this.render=function(a,l){function m(a){var b,c,d,e;H.setRGB(0,0,0);ia.setRGB(0,0,0);W.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(H.r+=e.r,H.g+=e.g,H.b+=e.b):d instanceof THREE.DirectionalLight?(ia.r+=e.r,ia.g+=e.g,ia.b+=e.b):d instanceof THREE.PointLight&&(W.r+=e.r,W.g+=e.g,W.b+=e.b)}function o(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,f instanceof
|
|
|
+THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(X.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function q(a,e,f){c(f.opacity);b(f.blending);var j,h,i,k,l,da;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,l=k.width>>1,da=k.height>>1,f=
|
|
|
+e.scale.x*n,i=e.scale.y*s,j=f*l,h=i*da,Y.set(a.x-j,a.y-h,a.x+j,a.y+h),S.intersects(Y)&&(p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(f,-i),p.translate(-l,-da),p.drawImage(k,0,0),p.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*n,h=e.scale.y*s,Y.set(a.x-j,a.y-h,a.x+j,a.y+h),S.intersects(Y)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(j,h),f.program(p),p.restore()))}function u(a,e,g,f){c(f.opacity);
|
|
|
+b(f.blending);p.beginPath();p.moveTo(a.positionScreen.x,a.positionScreen.y);p.lineTo(e.positionScreen.x,e.positionScreen.y);p.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(z!=a)p.lineWidth=z=a;a=f.linecap;if(L!=a)p.lineCap=L=a;a=f.linejoin;if(J!=a)p.lineJoin=J=a;d(f.color.getContextStyle());p.stroke();Y.inflate(f.linewidth*2)}}function v(a,d,f,g,j,h,k,n){e.info.render.vertices+=3;e.info.render.faces++;c(n.opacity);b(n.blending);M=a.positionScreen.x;N=a.positionScreen.y;ga=
|
|
|
+d.positionScreen.x;ka=d.positionScreen.y;Z=f.positionScreen.x;F=f.positionScreen.y;y(M,N,ga,ka,Z,F);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(na=k.uvs[0],w(M,N,ga,ka,Z,F,na[g].u,na[g].v,na[j].u,na[j].v,na[h].u,na[h].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,X.copy(k.vertexNormalsWorld[g]),ua=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,va=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,X.copy(k.vertexNormalsWorld[j]),
|
|
|
+pa=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,ra=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,X.copy(k.vertexNormalsWorld[h]),Aa=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,x=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,w(M,N,ga,ka,Z,F,ua,va,pa,ra,Aa,x,n.envMap)}else n.wireframe?wa(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ba(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(na=k.uvs[0],w(M,N,ga,ka,Z,F,na[g].u,na[g].v,
|
|
|
+na[j].u,na[j].v,na[h].u,na[h].v,n.map)),b(THREE.SubtractiveBlending)),ja?!n.wireframe&&n.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(ba.r=U.r=ea.r=H.r,ba.g=U.g=ea.g=H.g,ba.b=U.b=ea.b=H.b,o(i,k.v1.positionWorld,k.vertexNormalsWorld[0],ba),o(i,k.v2.positionWorld,k.vertexNormalsWorld[1],U),o(i,k.v3.positionWorld,k.vertexNormalsWorld[2],ea),ba.r=Math.max(0,Math.min(n.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(n.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(n.color.b*ba.b,1)),U.r=Math.max(0,
|
|
|
+Math.min(n.color.r*U.r,1)),U.g=Math.max(0,Math.min(n.color.g*U.g,1)),U.b=Math.max(0,Math.min(n.color.b*U.b,1)),ea.r=Math.max(0,Math.min(n.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(n.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(n.color.b*ea.b,1)),ca.r=(U.r+ea.r)*0.5,ca.g=(U.g+ea.g)*0.5,ca.b=(U.b+ea.b)*0.5,oa=Ga(ba,U,ea,ca),Ea(M,N,ga,ka,Z,F,0,0,1,0,0,1,oa)):(V.r=H.r,V.g=H.g,V.b=H.b,o(i,k.centroidWorld,k.normalWorld,V),V.r=Math.max(0,Math.min(n.color.r*V.r,1)),V.g=Math.max(0,Math.min(n.color.g*V.g,1)),
|
|
|
+V.b=Math.max(0,Math.min(n.color.b*V.b,1)),n.wireframe?wa(V,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ba(V)):n.wireframe?wa(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ba(n.color);else if(n instanceof THREE.MeshDepthMaterial)$=l.near,la=l.far,ba.r=ba.g=ba.b=1-Da(a.positionScreen.z,$,la),U.r=U.g=U.b=1-Da(d.positionScreen.z,$,la),ea.r=ea.g=ea.b=1-Da(f.positionScreen.z,$,la),ca.r=(U.r+ea.r)*0.5,ca.g=(U.g+ea.g)*0.5,ca.b=(U.b+ea.b)*0.5,oa=Ga(ba,U,ea,ca),Ea(M,
|
|
|
+N,ga,ka,Z,F,0,0,1,0,0,1,oa);else if(n instanceof THREE.MeshNormalMaterial)V.r=Fa(k.normalWorld.x),V.g=Fa(k.normalWorld.y),V.b=Fa(k.normalWorld.z),n.wireframe?wa(V,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ba(V)}function Ja(a,d,f,g,h,n,k,da,m){e.info.render.vertices+=4;e.info.render.faces++;c(da.opacity);b(da.blending);if(da.map||da.envMap)v(a,d,g,0,1,3,k,da,m),v(h,f,n,1,2,3,k,da,m);else if(M=a.positionScreen.x,N=a.positionScreen.y,ga=d.positionScreen.x,ka=d.positionScreen.y,Z=f.positionScreen.x,
|
|
|
+F=f.positionScreen.y,B=g.positionScreen.x,Q=g.positionScreen.y,O=h.positionScreen.x,j=h.positionScreen.y,ha=n.positionScreen.x,aa=n.positionScreen.y,da instanceof THREE.MeshBasicMaterial)t(M,N,ga,ka,Z,F,B,Q),da.wireframe?wa(da.color,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):Ba(da.color);else if(da instanceof THREE.MeshLambertMaterial)ja?!da.wireframe&&da.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==4?(ba.r=U.r=ea.r=ca.r=H.r,ba.g=U.g=ea.g=ca.g=H.g,ba.b=U.b=ea.b=
|
|
|
+ca.b=H.b,o(i,k.v1.positionWorld,k.vertexNormalsWorld[0],ba),o(i,k.v2.positionWorld,k.vertexNormalsWorld[1],U),o(i,k.v4.positionWorld,k.vertexNormalsWorld[3],ea),o(i,k.v3.positionWorld,k.vertexNormalsWorld[2],ca),ba.r=Math.max(0,Math.min(da.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(da.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(da.color.b*ba.b,1)),U.r=Math.max(0,Math.min(da.color.r*U.r,1)),U.g=Math.max(0,Math.min(da.color.g*U.g,1)),U.b=Math.max(0,Math.min(da.color.b*U.b,1)),ea.r=Math.max(0,Math.min(da.color.r*
|
|
|
+ea.r,1)),ea.g=Math.max(0,Math.min(da.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(da.color.b*ea.b,1)),ca.r=Math.max(0,Math.min(da.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(da.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(da.color.b*ca.b,1)),oa=Ga(ba,U,ea,ca),y(M,N,ga,ka,B,Q),Ea(M,N,ga,ka,B,Q,0,0,1,0,0,1,oa),y(O,j,Z,F,ha,aa),Ea(O,j,Z,F,ha,aa,1,0,1,1,0,1,oa)):(V.r=H.r,V.g=H.g,V.b=H.b,o(i,k.centroidWorld,k.normalWorld,V),V.r=Math.max(0,Math.min(da.color.r*V.r,1)),V.g=Math.max(0,Math.min(da.color.g*V.g,1)),
|
|
|
+V.b=Math.max(0,Math.min(da.color.b*V.b,1)),t(M,N,ga,ka,Z,F,B,Q),da.wireframe?wa(V,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):Ba(V)):(t(M,N,ga,ka,Z,F,B,Q),da.wireframe?wa(da.color,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):Ba(da.color));else if(da instanceof THREE.MeshNormalMaterial)V.r=Fa(k.normalWorld.x),V.g=Fa(k.normalWorld.y),V.b=Fa(k.normalWorld.z),t(M,N,ga,ka,Z,F,B,Q),da.wireframe?wa(V,da.wireframeLinewidth,da.wireframeLinecap,da.wireframeLinejoin):Ba(V);
|
|
|
+else if(da instanceof THREE.MeshDepthMaterial)$=l.near,la=l.far,ba.r=ba.g=ba.b=1-Da(a.positionScreen.z,$,la),U.r=U.g=U.b=1-Da(d.positionScreen.z,$,la),ea.r=ea.g=ea.b=1-Da(g.positionScreen.z,$,la),ca.r=ca.g=ca.b=1-Da(f.positionScreen.z,$,la),oa=Ga(ba,U,ea,ca),y(M,N,ga,ka,B,Q),Ea(M,N,ga,ka,B,Q,0,0,1,0,0,1,oa),y(O,j,Z,F,ha,aa),Ea(O,j,Z,F,ha,aa,1,0,1,1,0,1,oa)}function y(a,b,c,d,e,f){p.beginPath();p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(a,b);p.closePath()}function t(a,b,c,d,e,f,g,j){p.beginPath();
|
|
|
+p.moveTo(a,b);p.lineTo(c,d);p.lineTo(e,f);p.lineTo(g,j);p.lineTo(a,b);p.closePath()}function wa(a,b,c,e){if(z!=b)p.lineWidth=z=b;if(L!=c)p.lineCap=L=c;if(J!=e)p.lineJoin=J=e;d(a.getContextStyle());p.stroke();Y.inflate(b*2)}function Ba(a){g(a.getContextStyle());p.fill()}function w(a,b,c,d,e,f,j,h,i,n,k,da,l){if(l.image.width!=0){if(l.needsUpdate==!0||K[l.id]==void 0){var m=l.wrapS==THREE.RepeatWrapping,o=l.wrapT==THREE.RepeatWrapping;K[l.id]=p.createPattern(l.image,m&&o?"repeat":m&&!o?"repeat-x":!m&&
|
|
|
+o?"repeat-y":"no-repeat");l.needsUpdate=!1}g(K[l.id]);var m=l.offset.x/l.repeat.x,o=l.offset.y/l.repeat.y,x=(l.image.width-1)*l.repeat.x,l=(l.image.height-1)*l.repeat.y,j=(j+m)*x,h=(h+o)*l,i=(i+m)*x,n=(n+o)*l,k=(k+m)*x,da=(da+o)*l;c-=a;d-=b;e-=a;f-=b;i-=j;n-=h;k-=j;da-=h;m=1/(i*da-k*n);l=(da*c-n*e)*m;n=(da*d-n*f)*m;c=(i*e-k*c)*m;d=(i*f-k*d)*m;a=a-l*j-c*h;b=b-n*j-d*h;p.save();p.transform(l,n,c,d,a,b);p.fill();p.restore()}}function Ea(a,b,c,d,e,f,g,j,h,i,n,k,da){var l,m;l=da.width-1;m=da.height-1;g*=
|
|
|
+l;j*=m;h*=l;i*=m;n*=l;k*=m;c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;n-=g;k-=j;m=1/(h*k-n*i);l=(k*c-i*e)*m;i=(k*d-i*f)*m;c=(h*e-n*c)*m;d=(h*f-n*d)*m;a=a-l*g-c*j;b=b-i*g-d*j;p.save();p.transform(l,i,c,d,a,b);p.clip();p.drawImage(da,0,0);p.restore()}function Ga(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),n=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);G[0]=e<0?0:e>255?255:e;G[1]=f<0?0:f>255?255:f;G[2]=a<0?0:a>255?255:a;G[4]=
|
|
|
+g<0?0:g>255?255:g;G[5]=j<0?0:j>255?255:j;G[6]=b<0?0:b>255?255:b;G[8]=h<0?0:h>255?255:h;G[9]=i<0?0:i>255?255:i;G[10]=c<0?0:c>255?255:c;G[12]=n<0?0:n>255?255:n;G[13]=k<0?0:k>255?255:k;G[14]=d<0?0:d>255?255:d;xa.putImageData(ma,0,0);ta.drawImage(sa,0,0);return ya}function Da(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Fa(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Ca(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ha,Ia,qa,za;this.autoClear?
|
|
|
+this.clear():p.setTransform(1,0,0,-1,n,s);e.info.render.vertices=0;e.info.render.faces=0;f=k.projectScene(a,l,this.sortElements);h=f.elements;i=f.lights;(ja=i.length>0)&&m(i);Ha=0;for(Ia=h.length;Ha<Ia;Ha++)if(qa=h[Ha],za=qa.material,za=za instanceof THREE.MeshFaceMaterial?qa.faceMaterial:za,!(za==null||za.opacity==0)){Y.empty();if(qa instanceof THREE.RenderableParticle)I=qa,I.x*=n,I.y*=s,q(I,qa,za,a);else if(qa instanceof THREE.RenderableLine)I=qa.v1,D=qa.v2,I.positionScreen.x*=n,I.positionScreen.y*=
|
|
|
+s,D.positionScreen.x*=n,D.positionScreen.y*=s,Y.addPoint(I.positionScreen.x,I.positionScreen.y),Y.addPoint(D.positionScreen.x,D.positionScreen.y),S.intersects(Y)&&u(I,D,qa,za,a);else if(qa instanceof THREE.RenderableFace3)I=qa.v1,D=qa.v2,C=qa.v3,I.positionScreen.x*=n,I.positionScreen.y*=s,D.positionScreen.x*=n,D.positionScreen.y*=s,C.positionScreen.x*=n,C.positionScreen.y*=s,za.overdraw&&(Ca(I.positionScreen,D.positionScreen),Ca(D.positionScreen,C.positionScreen),Ca(C.positionScreen,I.positionScreen)),
|
|
|
+Y.add3Points(I.positionScreen.x,I.positionScreen.y,D.positionScreen.x,D.positionScreen.y,C.positionScreen.x,C.positionScreen.y),S.intersects(Y)&&v(I,D,C,0,1,2,qa,za,a);else if(qa instanceof THREE.RenderableFace4)I=qa.v1,D=qa.v2,C=qa.v3,P=qa.v4,I.positionScreen.x*=n,I.positionScreen.y*=s,D.positionScreen.x*=n,D.positionScreen.y*=s,C.positionScreen.x*=n,C.positionScreen.y*=s,P.positionScreen.x*=n,P.positionScreen.y*=s,R.positionScreen.copy(D.positionScreen),fa.positionScreen.copy(P.positionScreen),
|
|
|
+za.overdraw&&(Ca(I.positionScreen,D.positionScreen),Ca(D.positionScreen,P.positionScreen),Ca(P.positionScreen,I.positionScreen),Ca(C.positionScreen,R.positionScreen),Ca(C.positionScreen,fa.positionScreen)),Y.addPoint(I.positionScreen.x,I.positionScreen.y),Y.addPoint(D.positionScreen.x,D.positionScreen.y),Y.addPoint(C.positionScreen.x,C.positionScreen.y),Y.addPoint(P.positionScreen.x,P.positionScreen.y),S.intersects(Y)&&Ja(I,D,C,P,R,fa,qa,za,a);E.addRectangle(Y)}p.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,j,i;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(j=g.matrixWorld.getPosition(),i=c.dot(j),i<=0||(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):g instanceof THREE.PointLight&&(j=g.matrixWorld.getPosition(),i=c.dot(I.sub(j,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(j)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function c(a){D[a]==null&&(D[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"path"),M==0&&D[a].setAttribute("shape-rendering","crispEdges"));return D[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),k,l,m,o,n,s,p,u,v=new THREE.Rectangle,y=new THREE.Rectangle,q=!1,t=new THREE.Color,w=new THREE.Color,z=new THREE.Color,L=new THREE.Color,J,I=new THREE.Vector3,D=[],C=[],P,R,fa,M=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
+faces:0}};this.setQuality=function(a){switch(a){case "high":M=1;break;case "low":M=0}};this.setSize=function(a,b){k=a;l=b;m=k/2;o=l/2;i.setAttribute("viewBox",-m+" "+-o+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);v.set(-m,-o,m,o)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var I,D,F,B;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(k,l,this.sortElements);e=g.elements;
|
|
|
+f=g.lights;fa=R=0;if(q=f.length>0){w.setRGB(0,0,0);z.setRGB(0,0,0);L.setRGB(0,0,0);I=0;for(D=f.length;I<D;I++)B=f[I],F=B.color,B instanceof THREE.AmbientLight?(w.r+=F.r,w.g+=F.g,w.b+=F.b):B instanceof THREE.DirectionalLight?(z.r+=F.r,z.g+=F.g,z.b+=F.b):B instanceof THREE.PointLight&&(L.r+=F.r,L.g+=F.g,L.b+=F.b)}I=0;for(D=e.length;I<D;I++)if(F=e[I],B=F.material,B=B instanceof THREE.MeshFaceMaterial?F.faceMaterial:B,!(B==null||B.opacity==0))if(y.empty(),F instanceof THREE.RenderableParticle)n=F,n.x*=
|
|
|
+m,n.y*=-o;else if(F instanceof THREE.RenderableLine){if(n=F.v1,s=F.v2,n.positionScreen.x*=m,n.positionScreen.y*=-o,s.positionScreen.x*=m,s.positionScreen.y*=-o,y.addPoint(n.positionScreen.x,n.positionScreen.y),y.addPoint(s.positionScreen.x,s.positionScreen.y),v.intersects(y)){F=n;var Q=s,O=fa++;C[O]==null&&(C[O]=document.createElementNS("http://www.w3.org/2000/svg","line"),M==0&&C[O].setAttribute("shape-rendering","crispEdges"));P=C[O];P.setAttribute("x1",F.positionScreen.x);P.setAttribute("y1",F.positionScreen.y);
|
|
|
+P.setAttribute("x2",Q.positionScreen.x);P.setAttribute("y2",Q.positionScreen.y);B instanceof THREE.LineBasicMaterial&&(P.setAttribute("style","fill: none; stroke: "+B.color.getContextStyle()+"; stroke-width: "+B.linewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.linecap+"; stroke-linejoin: "+B.linejoin),i.appendChild(P))}}else if(F instanceof THREE.RenderableFace3){if(n=F.v1,s=F.v2,p=F.v3,n.positionScreen.x*=m,n.positionScreen.y*=-o,s.positionScreen.x*=m,s.positionScreen.y*=-o,p.positionScreen.x*=
|
|
|
+m,p.positionScreen.y*=-o,y.addPoint(n.positionScreen.x,n.positionScreen.y),y.addPoint(s.positionScreen.x,s.positionScreen.y),y.addPoint(p.positionScreen.x,p.positionScreen.y),v.intersects(y)){var Q=n,O=s,j=p;d.info.render.vertices+=3;d.info.render.faces++;P=c(R++);P.setAttribute("d","M "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+O.positionScreen.x+" "+O.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+"z");B instanceof THREE.MeshBasicMaterial?t.copy(B.color):B instanceof THREE.MeshLambertMaterial?
|
|
|
+q?(t.r=w.r,t.g=w.g,t.b=w.b,a(f,F.centroidWorld,F.normalWorld,t),t.r=Math.max(0,Math.min(B.color.r*t.r,1)),t.g=Math.max(0,Math.min(B.color.g*t.g,1)),t.b=Math.max(0,Math.min(B.color.b*t.b,1))):t.copy(B.color):B instanceof THREE.MeshDepthMaterial?(J=1-B.__2near/(B.__farPlusNear-F.z*B.__farMinusNear),t.setRGB(J,J,J)):B instanceof THREE.MeshNormalMaterial&&t.setRGB(b(F.normalWorld.x),b(F.normalWorld.y),b(F.normalWorld.z));B.wireframe?P.setAttribute("style","fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+
|
|
|
+B.wireframeLinewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframeLinecap+"; stroke-linejoin: "+B.wireframeLinejoin):P.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+B.opacity);i.appendChild(P)}}else if(F instanceof THREE.RenderableFace4&&(n=F.v1,s=F.v2,p=F.v3,u=F.v4,n.positionScreen.x*=m,n.positionScreen.y*=-o,s.positionScreen.x*=m,s.positionScreen.y*=-o,p.positionScreen.x*=m,p.positionScreen.y*=-o,u.positionScreen.x*=m,u.positionScreen.y*=-o,y.addPoint(n.positionScreen.x,
|
|
|
+n.positionScreen.y),y.addPoint(s.positionScreen.x,s.positionScreen.y),y.addPoint(p.positionScreen.x,p.positionScreen.y),y.addPoint(u.positionScreen.x,u.positionScreen.y),v.intersects(y))){var Q=n,O=s,j=p,ha=u;d.info.render.vertices+=4;d.info.render.faces++;P=c(R++);P.setAttribute("d","M "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+O.positionScreen.x+" "+O.positionScreen.y+" L "+j.positionScreen.x+","+j.positionScreen.y+" L "+ha.positionScreen.x+","+ha.positionScreen.y+"z");B instanceof THREE.MeshBasicMaterial?
|
|
|
+t.copy(B.color):B instanceof THREE.MeshLambertMaterial?q?(t.r=w.r,t.g=w.g,t.b=w.b,a(f,F.centroidWorld,F.normalWorld,t),t.r=Math.max(0,Math.min(B.color.r*t.r,1)),t.g=Math.max(0,Math.min(B.color.g*t.g,1)),t.b=Math.max(0,Math.min(B.color.b*t.b,1))):t.copy(B.color):B instanceof THREE.MeshDepthMaterial?(J=1-B.__2near/(B.__farPlusNear-F.z*B.__farMinusNear),t.setRGB(J,J,J)):B instanceof THREE.MeshNormalMaterial&&t.setRGB(b(F.normalWorld.x),b(F.normalWorld.y),b(F.normalWorld.z));B.wireframe?P.setAttribute("style",
|
|
|
+"fill: none; stroke: "+t.getContextStyle()+"; stroke-width: "+B.wireframeLinewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframeLinecap+"; stroke-linejoin: "+B.wireframeLinejoin):P.setAttribute("style","fill: "+t.getContextStyle()+"; fill-opacity: "+B.opacity);i.appendChild(P)}}};
|
|
|
THREE.ShaderChunk={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 envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
|
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\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 ), refractionRatio );\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_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
|
|
@@ -222,130 +222,130 @@ THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_
|
|
|
THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
|
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
|
THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var g=d.attributes[e];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var f=1;g.type==="v2"?f=2:g.type==="v3"?f=3:g.type==="v4"?f=4:g.type==="c"&&(f=3);g.size=f;g.array=new Float32Array(c*f);g.buffer=j.createBuffer();g.buffer.belongsToAttribute=e;g.needsUpdate=!0}a.__webglCustomAttributesList.push(g)}}}
|
|
|
-function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;var i=a.colors,k=i.length,l=a.__vertexArray,m=a.__colorArray,p=a.__sortArray,n=a.__dirtyVertices,o=a.__dirtyColors,Q=a.__webglCustomAttributesList;if(c.sortParticles){sa.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,xa.copy(e),sa.multiplyVector3(xa),p[d]=[xa.z,d];
|
|
|
-p.sort(function(a,b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[p[d][1]].position,g=d*3,l[g]=e.x,l[g+1]=e.y,l[g+2]=e.z;for(d=0;d<k;d++)g=d*3,e=i[p[d][1]],m[g]=e.r,m[g+1]=e.g,m[g+2]=e.b;if(Q){i=0;for(k=Q.length;i<k;i++)if(h=Q[i],h.boundTo===void 0||h.boundTo==="vertices")if(g=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)f=p[d][1],h.array[d]=h.value[f];else if(h.size===2)for(d=0;d<e;d++)f=p[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=p[d][1],
|
|
|
-f=h.value[f],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=p[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=p[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}}else{if(n)for(d=0;d<f;d++)e=h[d].position,g=d*3,l[g]=e.x,l[g+1]=e.y,l[g+2]=e.z;if(o)for(d=0;d<k;d++)e=i[d],g=d*3,m[g]=e.r,m[g+1]=e.g,m[g+2]=e.b;if(Q){i=0;for(k=Q.length;i<k;i++)if(h=Q[i],h.needsUpdate&&(h.boundTo===
|
|
|
-void 0||h.boundTo==="vertices"))if(e=h.value.length,g=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+
|
|
|
-3]=f.w,g+=4}}if(n||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,m,b);if(Q){i=0;for(k=Q.length;i<k;i++)if(h=Q[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c,d,e){d.program||P.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=
|
|
|
-new Float32Array(P.maxMorphTargets);for(var g=0,f=P.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==ha&&(j.useProgram(g),ha=g,h=!0);if(d.id!==B)B=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,ra);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||
|
|
|
-d.lights){for(var k,l,m=0,p=0,n=0,o,q,H,t=Q,r=t.directional.colors,u=t.directional.positions,v=t.point.colors,z=t.point.positions,U=t.point.distances,C=0,E=0,c=k=H=0,h=b.length;c<h;c++)if(k=b[c],l=k.color,o=k.position,q=k.intensity,H=k.distance,k instanceof THREE.AmbientLight)P.gammaInput?(m+=l.r*l.r,p+=l.g*l.g,n+=l.b*l.b):(m+=l.r,p+=l.g,n+=l.b);else if(k instanceof THREE.DirectionalLight)H=C*3,P.gammaInput?(r[H]=l.r*l.r*q*q,r[H+1]=l.g*l.g*q*q,r[H+2]=l.b*l.b*q*q):(r[H]=l.r*q,r[H+1]=l.g*q,r[H+2]=l.b*
|
|
|
-q),u[H]=o.x,u[H+1]=o.y,u[H+2]=o.z,C+=1;else if(k instanceof THREE.SpotLight)H=C*3,P.gammaInput?(r[H]=l.r*l.r*q*q,r[H+1]=l.g*l.g*q*q,r[H+2]=l.b*l.b*q*q):(r[H]=l.r*q,r[H+1]=l.g*q,r[H+2]=l.b*q),l=1/o.length(),u[H]=o.x*l,u[H+1]=o.y*l,u[H+2]=o.z*l,C+=1;else if(k instanceof THREE.PointLight)k=E*3,P.gammaInput?(v[k]=l.r*l.r*q*q,v[k+1]=l.g*l.g*q*q,v[k+2]=l.b*l.b*q*q):(v[k]=l.r*q,v[k+1]=l.g*q,v[k+2]=l.b*q),z[k]=o.x,z[k+1]=o.y,z[k+2]=o.z,U[E]=H,E+=1;c=C*3;for(h=r.length;c<h;c++)r[c]=0;c=E*3;for(h=v.length;c<
|
|
|
-h;c++)v[c]=0;t.point.length=E;t.directional.length=C;t.ambient[0]=m;t.ambient[1]=p;t.ambient[2]=n;b=Q;i.enableLighting.value=b.directional.length+b.point.length;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||
|
|
|
-d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,P.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=
|
|
|
-d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=G.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,P.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):
|
|
|
-(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)P.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<va.length;b++)i.shadowMatrix.value[b]=va[b],i.shadowMap.texture[b]=P.shadowMap[b];
|
|
|
-i.shadowDarkness.value=P.shadowMapDarkness;i.shadowBias.value=P.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(p=g.uniforms[b[i][1]])if(m=b[i][0],n=m.type,h=m.value,n==="i")j.uniform1i(p,h);else if(n==="f")j.uniform1f(p,h);else if(n==="v2")j.uniform2f(p,h.x,h.y);else if(n==="v3")j.uniform3f(p,h.x,h.y,h.z);else if(n==="v4")j.uniform4f(p,h.x,h.y,h.z,h.w);else if(n==="c")j.uniform3f(p,h.r,h.g,h.b);else if(n==="fv1")j.uniform1fv(p,h);else if(n==="fv")j.uniform3fv(p,h);else if(n==="v3v"){if(!m._array)m._array=
|
|
|
-new Float32Array(3*h.length);n=0;for(o=h.length;n<o;n++)t=n*3,m._array[t]=h[n].x,m._array[t+1]=h[n].y,m._array[t+2]=h[n].z;j.uniform3fv(p,m._array)}else if(n==="m4"){if(!m._array)m._array=new Float32Array(16);h.flattenToArray(m._array);j.uniformMatrix4fv(p,!1,m._array)}else if(n==="m4v"){if(!m._array)m._array=new Float32Array(16*h.length);n=0;for(o=h.length;n<o;n++)h[n].flattenToArrayOffset(m._array,n*16);j.uniformMatrix4fv(p,!1,m._array)}else if(n==="t"){if(j.uniform1i(p,h),p=m.texture)if(p.image instanceof
|
|
|
-Array&&p.image.length===6){if(m=p,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(h=0;h<6;h++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,m.image[h]);J(j.TEXTURE_CUBE_MAP,m,m.image[0]);m.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else p instanceof
|
|
|
-THREE.WebGLRenderTargetCube?(m=p,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,m.__webglTexture)):x(p,h)}else if(n==="tv"){if(!m._array){m._array=[];n=0;for(o=m.texture.length;n<o;n++)m._array[n]=h+n}j.uniform1iv(p,m._array);n=0;for(o=m.texture.length;n<o;n++)(p=m.texture[n])&&x(p,m._array[n])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&f.cameraPosition!==null&&j.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof
|
|
|
-THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&f.viewMatrix!==null&&j.uniformMatrix4fv(f.viewMatrix,!1,ua);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,ua),j.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(f.modelViewMatrix,!1,e._modelViewMatrixArray);f.normalMatrix&&j.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&
|
|
|
-f.objectMatrix!==null&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function e(a,b,c,d,e,f){if(d.opacity!==0){var h,i,c=g(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==R&&(R=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),
|
|
|
-j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){h=0;var k=f.morphTargetForcedOrder;for(i=f.morphTargetInfluences;h<d.numSupportedMorphTargets&&h<k.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k[h]]),j.vertexAttribPointer(c["morphTarget"+h],3,j.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[h]=i[k[h]],h++}else{var k=[],l=-1,
|
|
|
-m=0;i=f.morphTargetInfluences;var p,n=i.length;h=0;for(f.morphTargetBase!==-1&&(k[f.morphTargetBase]=!0);h<d.numSupportedMorphTargets;){for(p=0;p<n;p++)!k[p]&&i[p]>l&&(m=p,l=i[m]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[m]);j.vertexAttribPointer(c["morphTarget"+h],3,j.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[h]=l;k[m]=1;l=-1;h++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){h=
|
|
|
-0;for(i=e.__webglCustomAttributesList.length;h<i;h++)c=e.__webglCustomAttributesList[h],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
|
|
|
-0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?
|
|
|
-(d=d.wireframeLinewidth,d!==I&&(j.lineWidth(d),I=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),P.info.render.calls++,P.info.render.vertices+=e.__webglFaceCount,P.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==
|
|
|
-I&&(j.lineWidth(d),I=d),j.drawArrays(f,0,e.__webglLineCount),P.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),P.info.render.calls++):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),P.info.render.calls++)}}function f(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),
|
|
|
-j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,k,l,m,p,n=a.count*3;for(p=0;p<n;p+=9)c=a.normalArray,d=c[p],e=c[p+1],f=c[p+2],g=c[p+3],i=c[p+4],l=c[p+5],h=c[p+6],k=c[p+7],m=c[p+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+l+m)/3,c[p]=d,c[p+1]=e,c[p+2]=f,c[p+3]=d,c[p+4]=e,c[p+5]=f,
|
|
|
-c[p+6]=d,c[p+7]=e,c[p+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function h(a){if(O!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),O=a.doubleSided;if(ga!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ga=a.flipSided}function i(a){X!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),
|
|
|
-X=a)}function l(a){aa!==a&&(j.depthMask(a),aa=a)}function m(a,b,c){ba!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),ba=a);if(a&&(V!==b||C!==c))j.polygonOffset(b,c),V=b,C=c}function k(a){oa[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);oa[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);oa[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);oa[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);oa[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-
|
|
|
-a.n34);oa[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=oa[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function o(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)),d=0;d<6;d++)if(a=oa[d].x*b.n14+oa[d].y*b.n24+oa[d].z*b.n34+oa[d].w,a<=c)return!1;return!0}function p(a){var b=a.object.material;b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function q(a){var b=a.object,
|
|
|
-c=a.buffer,d;d=b.material;if(d instanceof THREE.MeshFaceMaterial){if(c=c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=d)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function n(a,b){return b.z-a.z}function t(a){var b,c,d,l=0,m,p,n,q,Q,H,t=a.lights;W||(W=new THREE.PerspectiveCamera(P.shadowCameraFov,P.shadowMapWidth/P.shadowMapHeight,P.shadowCameraNear,P.shadowCameraFar));b=0;for(c=
|
|
|
-t.length;b<c;b++)if(d=t[b],d instanceof THREE.SpotLight&&d.castShadow){B=-1;P.shadowMap[l]||(P.shadowMap[l]=new THREE.WebGLRenderTarget(P.shadowMapWidth,P.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));va[l]||(va[l]=new THREE.Matrix4);m=P.shadowMap[l];p=va[l];W.position.copy(d.position);W.lookAt(d.target.position);W.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(W));this.autoUpdateScene&&a.updateMatrixWorld();W.matrixWorldInverse.getInverse(W.matrixWorld);
|
|
|
-p.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);p.multiplySelf(W.projectionMatrix);p.multiplySelf(W.matrixWorldInverse);W.matrixWorldInverse.flattenToArray(ua);W.projectionMatrix.flattenToArray(ra);sa.multiply(W.projectionMatrix,W.matrixWorldInverse);k(sa);D(m);j.clearColor(1,1,1,1);P.clear();j.clearColor(la.r,la.g,la.b,ka);p=a.__webglObjects.length;d=a.__webglObjectsImmediate.length;for(m=0;m<p;m++)n=a.__webglObjects[m],H=n.object,H.visible&&H.castShadow?!(H instanceof THREE.Mesh)||!H.frustumCulled||
|
|
|
-o(H)?(H.matrixWorld.flattenToArray(H._objectMatrixArray),v(H,W,!1),n.render=!0):n.render=!1:n.render=!1;i(!0);A(THREE.NormalBlending);for(m=0;m<p;m++)if(n=a.__webglObjects[m],n.render)H=n.object,Q=n.buffer,h(H),n=H.customDepthMaterial?H.customDepthMaterial:H.geometry.morphTargets.length?pa:ya,e(W,t,null,n,Q,H);for(m=0;m<d;m++)n=a.__webglObjectsImmediate[m],H=n.object,H.visible&&H.castShadow&&(H.matrixAutoUpdate&&H.matrixWorld.flattenToArray(H._objectMatrixArray),R=-1,v(H,W,!1),h(H),q=g(W,t,null,ya,
|
|
|
-H),H.immediateRenderCallback?H.immediateRenderCallback(q,j,oa):H.render(function(a){f(a,q,ya.shading)}));l++}}function u(a,b){var c,d,e;c=K.attributes;var f=K.uniforms,g=na/ja,h,i=[],k=ja*0.5,l=na*0.5,m=!0;j.useProgram(K.program);ha=K.program;R=X=$=-1;Ia||(j.enableVertexAttribArray(K.attributes.position),j.enableVertexAttribArray(K.attributes.uv),Ia=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,K.vertexBuffer);j.vertexAttribPointer(c.position,2,j.FLOAT,!1,
|
|
|
-16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,K.elementBuffer);j.uniformMatrix4fv(f.projectionMatrix,!1,ra);j.activeTexture(j.TEXTURE0);j.uniform1i(f.map,0);c=0;for(d=a.__webglSprites.length;c<d;c++)if(e=a.__webglSprites[c],e.visible&&e.opacity!==0)e.useScreenCoordinates?e.z=-e.position.z:(e._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,e.matrixWorld,e._modelViewMatrixArray),e.z=-e._modelViewMatrix.n34);a.__webglSprites.sort(n);c=0;for(d=a.__webglSprites.length;c<
|
|
|
-d;c++)e=a.__webglSprites[c],e.visible&&e.opacity!==0&&e.map&&e.map.image&&e.map.image.width&&(e.useScreenCoordinates?(j.uniform1i(f.useScreenCoordinates,1),j.uniform3f(f.screenPosition,(e.position.x-k)/k,(l-e.position.y)/l,Math.max(0,Math.min(1,e.position.z)))):(j.uniform1i(f.useScreenCoordinates,0),j.uniform1i(f.affectedByDistance,e.affectedByDistance?1:0),j.uniformMatrix4fv(f.modelViewMatrix,!1,e._modelViewMatrixArray)),h=e.map.image.width/(e.scaleByViewport?na:1),i[0]=h*g*e.scale.x,i[1]=h*e.scale.y,
|
|
|
-j.uniform2f(f.uvScale,e.uvScale.x,e.uvScale.y),j.uniform2f(f.uvOffset,e.uvOffset.x,e.uvOffset.y),j.uniform2f(f.alignment,e.alignment.x,e.alignment.y),j.uniform1f(f.opacity,e.opacity),j.uniform3f(f.color,e.color.r,e.color.g,e.color.b),j.uniform1f(f.rotation,e.rotation),j.uniform2fv(f.scale,i),e.mergeWith3D&&!m?(j.enable(j.DEPTH_TEST),m=!0):!e.mergeWith3D&&m&&(j.disable(j.DEPTH_TEST),m=!1),A(e.blending),x(e.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);
|
|
|
-j.depthMask(aa)}function v(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function r(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function z(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function E(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function N(a,b,c){a.push({buffer:b,object:c,
|
|
|
-opaque:null,transparent:null})}function A(a){if(a!==$){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}$=a}}
|
|
|
-function J(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,L(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,L(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,L(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,L(b.minFilter)),j.generateMipmap(a)):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,ca(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,ca(b.minFilter)))}
|
|
|
-function x(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),P.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,L(a.format),a.image.width,a.image.height,0,L(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);J(j.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,
|
|
|
-a.__webglTexture)}function w(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}
|
|
|
-function D(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);J(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
-c,0,L(a.format),a.width,a.height,0,L(a.format),L(a.type),null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);w(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),J(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,L(a.format),a.width,a.height,0,L(a.format),
|
|
|
-L(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),w(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,
|
|
|
-c=ja,a=na,d=Z,e=da);b!==F&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),F=b)}function M(a){a instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,a.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null))}function S(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));
|
|
|
-j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function ca(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function L(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;
|
|
|
-case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;
|
|
|
-case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var P=this,j,ea=[],ha=null,F=null,B=-1,R=null,Y=0,O=null,ga=null,$=null,X=null,aa=null,ba=null,V=null,C=null,I=null,Z=0,da=0,ja=0,na=0,oa=[new THREE.Vector4,new THREE.Vector4,
|
|
|
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],sa=new THREE.Matrix4,ra=new Float32Array(16),ua=new Float32Array(16),xa=new THREE.Vector4,Q={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},a=a||{},G=a.canvas!==void 0?a.canvas:document.createElement("canvas"),H=a.stencil!==void 0?a.stencil:!0,U=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,fa=a.antialias!==void 0?a.antialias:!1,la=a.clearColor!==
|
|
|
-void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ka=a.clearAlpha!==void 0?a.clearAlpha:0,ma=a.maxLights!==void 0?a.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=G;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=
|
|
|
-0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=this.shadowMapAutoUpdate=!0;var W,va=[],a=THREE.ShaderLib.depthRGBA,ia=THREE.UniformsUtils.clone(a.uniforms),ya=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ia}),pa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:ia,morphTargets:!0});
|
|
|
-ya._shadowPass=!0;pa._shadowPass=!0;try{if(!(j=G.getContext("experimental-webgl",{antialias:fa,stencil:H,preserveDrawingBuffer:U})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+j.getParameter(j.VERSION)+" | "+j.getParameter(j.VENDOR)+" | "+j.getParameter(j.RENDERER)+" | "+j.getParameter(j.SHADING_LANGUAGE_VERSION))}catch(wa){console.error(wa)}j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);
|
|
|
-j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(la.r,la.g,la.b,ka);this.context=j;var Ca=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,K={};K.vertices=new Float32Array(16);K.faces=new Uint16Array(6);H=0;K.vertices[H++]=-1;K.vertices[H++]=-1;K.vertices[H++]=0;K.vertices[H++]=1;K.vertices[H++]=1;K.vertices[H++]=-1;K.vertices[H++]=1;K.vertices[H++]=1;K.vertices[H++]=1;K.vertices[H++]=1;K.vertices[H++]=1;K.vertices[H++]=
|
|
|
-0;K.vertices[H++]=-1;K.vertices[H++]=1;K.vertices[H++]=0;H=K.vertices[H++]=0;K.faces[H++]=0;K.faces[H++]=1;K.faces[H++]=2;K.faces[H++]=0;K.faces[H++]=2;K.faces[H++]=3;K.vertexBuffer=j.createBuffer();K.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,K.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,K.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,K.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,K.faces,j.STATIC_DRAW);K.program=j.createProgram();j.attachShader(K.program,S("fragment",
|
|
|
-THREE.ShaderLib.sprite.fragmentShader));j.attachShader(K.program,S("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(K.program);K.attributes={};K.uniforms={};K.attributes.position=j.getAttribLocation(K.program,"position");K.attributes.uv=j.getAttribLocation(K.program,"uv");K.uniforms.uvOffset=j.getUniformLocation(K.program,"uvOffset");K.uniforms.uvScale=j.getUniformLocation(K.program,"uvScale");K.uniforms.rotation=j.getUniformLocation(K.program,"rotation");K.uniforms.scale=j.getUniformLocation(K.program,
|
|
|
-"scale");K.uniforms.alignment=j.getUniformLocation(K.program,"alignment");K.uniforms.color=j.getUniformLocation(K.program,"color");K.uniforms.map=j.getUniformLocation(K.program,"map");K.uniforms.opacity=j.getUniformLocation(K.program,"opacity");K.uniforms.useScreenCoordinates=j.getUniformLocation(K.program,"useScreenCoordinates");K.uniforms.affectedByDistance=j.getUniformLocation(K.program,"affectedByDistance");K.uniforms.screenPosition=j.getUniformLocation(K.program,"screenPosition");K.uniforms.modelViewMatrix=
|
|
|
-j.getUniformLocation(K.program,"modelViewMatrix");K.uniforms.projectionMatrix=j.getUniformLocation(K.program,"projectionMatrix");var Ia=!1;this.setSize=function(a,b){G.width=a;G.height=b;this.setViewport(0,0,G.width,G.height)};this.setViewport=function(a,b,c,d){Z=a;da=b;ja=c;na=d;j.viewport(Z,da,ja,na)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){la.setHex(a);ka=b;
|
|
|
-j.clearColor(la.r,la.g,la.b,ka)};this.setClearColor=function(a,b){la.copy(a);ka=b;j.clearColor(la.r,la.g,la.b,ka)};this.getClearColor=function(){return la};this.getClearAlpha=function(){return ka};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.getContext=function(){return j};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,
|
|
|
-delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);
|
|
|
-j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);P.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),P.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),
|
|
|
-P.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),P.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),P.info.memory.textures--};this.initMaterial=function(a,b,c,d){var e,f,g,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":
|
|
|
-a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var k,m,l;k=l=i=0;for(m=b.length;k<m;k++)g=b[k],g instanceof THREE.SpotLight&&l++,g instanceof THREE.DirectionalLight&&l++,g instanceof THREE.PointLight&&
|
|
|
-i++;i+l<=ma?k=l:(k=Math.ceil(ma*l/(i+l)),i=ma-k);g={directional:k,point:i};i=l=0;for(k=b.length;i<k;i++)m=b[i],m instanceof THREE.SpotLight&&m.castShadow&&l++;var p=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)p=d.bones.length;var n;a:{k=a.fragmentShader;m=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
|
-maxDirLights:g.directional,maxPointLights:g.point,maxBones:p,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:l,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},o,d=[];h?d.push(h):(d.push(k),d.push(m));for(o in c)d.push(o),d.push(c[o]);h=d.join();o=0;for(d=ea.length;o<d;o++)if(ea[o].code===h){n=ea[o].program;break a}o=j.createProgram();d=[Ca?"#define VERTEX_TEXTURES":
|
|
|
-"",P.gammaInput?"#define GAMMA_INPUT":"",P.gammaOutput?"#define GAMMA_OUTPUT":"",P.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":
|
|
|
-"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","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 vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
-g=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",P.gammaInput?"#define GAMMA_INPUT":"",P.gammaOutput?"#define GAMMA_OUTPUT":"",P.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
|
|
|
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(o,S("fragment",g+k));j.attachShader(o,
|
|
|
-S("vertex",d+m));j.linkProgram(o);j.getProgramParameter(o,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(o,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");o.uniforms={};o.attributes={};var H,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(H in i)d.push(H);H=d;d=0;for(i=H.length;d<i;d++)k=H[d],o.uniforms[k]=j.getUniformLocation(o,
|
|
|
-k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(H=0;H<c.maxMorphTargets;H++)d.push("morphTarget"+H);for(n in b)d.push(n);n=d;H=0;for(b=n.length;H<b;H++)c=n[H],o.attributes[c]=j.getAttribLocation(o,c);o.id=ea.length;ea.push({program:o,code:h});P.info.memory.programs=ea.length;n=o}a.program=n;n=a.program.attributes;n.position>=0&&j.enableVertexAttribArray(n.position);n.color>=0&&j.enableVertexAttribArray(n.color);n.normal>=0&&j.enableVertexAttribArray(n.normal);
|
|
|
-n.tangent>=0&&j.enableVertexAttribArray(n.tangent);a.skinning&&n.skinVertexA>=0&&n.skinVertexB>=0&&n.skinIndex>=0&&n.skinWeight>=0&&(j.enableVertexAttribArray(n.skinVertexA),j.enableVertexAttribArray(n.skinVertexB),j.enableVertexAttribArray(n.skinIndex),j.enableVertexAttribArray(n.skinWeight));if(a.attributes)for(f in a.attributes)n[f]!==void 0&&n[f]>=0&&j.enableVertexAttribArray(n[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)H="morphTarget"+f,n[H]>=0&&(j.enableVertexAttribArray(n[H]),
|
|
|
-a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.clearTarget=function(a,b,c,d){D(a);this.clear(b,c,d)};this.updateShadowMap=function(a,b){t(a,b)};this.render=function(a,b,c,d){var H,Q,r,G,z,U,Aa,C=a.lights,E=a.fog;B=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&t(a,b);P.info.render.calls=0;P.info.render.vertices=0;P.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),
|
|
|
-a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(ua);b.projectionMatrix.flattenToArray(ra);sa.multiply(b.projectionMatrix,b.matrixWorldInverse);k(sa);D(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);r=a.__webglObjects.length;for(d=0;d<r;d++)if(z=a.__webglObjects[d],U=z.object,U.visible)if(!(U instanceof THREE.Mesh)||!U.frustumCulled||o(U)){if(U.matrixWorld.flattenToArray(U._objectMatrixArray),
|
|
|
-v(U,b,!0),q(z),z.render=!0,this.sortObjects)U.renderDepth?z.z=U.renderDepth:(xa.copy(U.position),sa.multiplyVector3(xa),z.z=xa.z)}else z.render=!1;else z.render=!1;this.sortObjects&&a.__webglObjects.sort(n);G=a.__webglObjectsImmediate.length;for(d=0;d<G;d++)z=a.__webglObjectsImmediate[d],U=z.object,U.visible&&(U.matrixAutoUpdate&&U.matrixWorld.flattenToArray(U._objectMatrixArray),v(U,b,!0),p(z));if(a.overrideMaterial){i(a.overrideMaterial.depthTest);A(a.overrideMaterial.blending);for(d=0;d<r;d++)if(z=
|
|
|
-a.__webglObjects[d],z.render)U=z.object,Aa=z.buffer,h(U),e(b,C,E,a.overrideMaterial,Aa,U);for(d=0;d<G;d++)z=a.__webglObjectsImmediate[d],U=z.object,U.visible&&(R=-1,h(U),H=g(b,C,E,a.overrideMaterial,U),U.immediateRenderCallback?U.immediateRenderCallback(H,j,oa):U.render(function(b){f(b,H,a.overrideMaterial.shading)}))}else{A(THREE.NormalBlending);for(d=r-1;d>=0;d--)if(z=a.__webglObjects[d],z.render&&(U=z.object,Aa=z.buffer,Q=z.opaque))h(U),i(Q.depthTest),l(Q.depthWrite),m(Q.polygonOffset,Q.polygonOffsetFactor,
|
|
|
-Q.polygonOffsetUnits),e(b,C,E,Q,Aa,U);for(d=0;d<G;d++)if(z=a.__webglObjectsImmediate[d],U=z.object,U.visible&&(R=-1,Q=z.opaque))h(U),i(Q.depthTest),l(Q.depthWrite),m(Q.polygonOffset,Q.polygonOffsetFactor,Q.polygonOffsetUnits),H=g(b,C,E,Q,U),U.immediateRenderCallback?U.immediateRenderCallback(H,j,oa):U.render(function(a){f(a,H,Q.shading)});for(d=0;d<r;d++)if(z=a.__webglObjects[d],z.render&&(U=z.object,Aa=z.buffer,Q=z.transparent))h(U),A(Q.blending),i(Q.depthTest),l(Q.depthWrite),m(Q.polygonOffset,
|
|
|
-Q.polygonOffsetFactor,Q.polygonOffsetUnits),e(b,C,E,Q,Aa,U);for(d=0;d<G;d++)if(z=a.__webglObjectsImmediate[d],U=z.object,U.visible&&(R=-1,Q=z.transparent))h(U),A(Q.blending),i(Q.depthTest),l(Q.depthWrite),m(Q.polygonOffset,Q.polygonOffsetFactor,Q.polygonOffsetUnits),H=g(b,C,E,Q,U),U.immediateRenderCallback?U.immediateRenderCallback(H,j,oa):U.render(function(a){f(a,H,Q.shading)})}a.__webglSprites.length&&u(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&M(c)};this.initWebGLObjects=
|
|
|
-function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,g=void 0,h=void 0,i=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===
|
|
|
-void 0){var i=h,k=void 0,l=void 0,m=void 0,p=void 0,n=void 0,o=void 0,H=void 0,Q={},q=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)m=i.faces[k],p=m.materialIndex,o=p!==void 0?p:-1,Q[o]===void 0&&(Q[o]={hash:o,counter:0}),H=Q[o].hash+"_"+Q[o].counter,i.geometryGroups[H]===void 0&&(i.geometryGroups[H]={faces3:[],faces4:[],materialIndex:p,vertices:0,numMorphTargets:q}),n=m instanceof THREE.Face3?3:4,i.geometryGroups[H].vertices+n>65535&&(Q[o].counter+=1,H=Q[o].hash+"_"+
|
|
|
-Q[o].counter,i.geometryGroups[H]===void 0&&(i.geometryGroups[H]={faces3:[],faces4:[],materialIndex:p,vertices:0,numMorphTargets:q})),m instanceof THREE.Face3?i.geometryGroups[H].faces3.push(k):i.geometryGroups[H].faces4.push(k),i.geometryGroups[H].vertices+=n;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=Y++,i.geometryGroupsList.push(i.geometryGroups[k])}for(g in h.geometryGroups)if(i=h.geometryGroups[g],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();
|
|
|
-k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){m=l=void 0;k.__webglMorphTargetsBuffers=[];
|
|
|
-l=0;for(m=k.numMorphTargets;l<m;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}P.info.memory.geometries++;p=e;n=p.geometry;l=i.faces3;o=i.faces4;k=l.length*3+o.length*4;m=l.length*1+o.length*2;o=l.length*3+o.length*4;l=b(p,i);H=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;Q=l instanceof THREE.MeshBasicMaterial&&!l.envMap||l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;q=l.vertexColors?l.vertexColors:
|
|
|
-!1;i.__vertexArray=new Float32Array(k*3);if(Q)i.__normalArray=new Float32Array(k*3);if(n.hasTangents)i.__tangentArray=new Float32Array(k*4);if(q)i.__colorArray=new Float32Array(k*3);if(H){if(n.faceUvs.length>0||n.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(n.faceUvs.length>1||n.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*2)}if(p.geometry.skinWeights.length&&p.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),
|
|
|
-i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(m*3);i.__lineArray=new Uint16Array(o*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];p=0;for(n=i.numMorphTargets;p<n;p++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=Q===THREE.SmoothShading;i.__uvType=H;i.__vertexColorType=q;i.__normalType=Q;i.__webglFaceCount=m*3;i.__webglLineCount=o*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=
|
|
|
-[];m=void 0;for(m in l.attributes){var p=l.attributes[m],n={},t;for(t in p)n[t]=p[t];if(!n.__webglInitialized||n.createUniqueBuffers)n.__webglInitialized=!0,o=1,n.type==="v2"?o=2:n.type==="v3"?o=3:n.type==="v4"?o=4:n.type==="c"&&(o=3),n.size=o,n.array=new Float32Array(k*o),n.buffer=j.createBuffer(),n.buffer.belongsToAttribute=m,p.needsUpdate=!0,n.__original=p;i.__webglCustomAttributesList.push(n)}}i.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=
|
|
|
-!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),P.info.memory.geometries++,i=h,k=i.vertices.length,i.__vertexArray=new Float32Array(k*3),i.__colorArray=new Float32Array(k*3),i.__webglVertexCount=k,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=
|
|
|
-j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),P.info.memory.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__webglLineCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer))i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),P.info.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),
|
|
|
-i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(g in h=e.geometry,h.geometryGroups)i=h.geometryGroups[g],N(f.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,N(f.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,
|
|
|
-opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)E(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;g=e;for(h=f.length-1;h>=0;h--)f[h]===g&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&
|
|
|
-E(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(t=a.__webglObjects[e].object,g=t.geometry,h=m=l=void 0,t instanceof THREE.Mesh){i=0;for(k=g.geometryGroupsList.length;i<k;i++)if(l=g.geometryGroupsList[i],h=b(t,l),m=h.attributes&&r(h),g.__dirtyVertices||g.__dirtyMorphTargets||g.__dirtyElements||g.__dirtyUvs||g.__dirtyNormals||g.__dirtyColors||g.__dirtyTangents||m)if(m=j.DYNAMIC_DRAW,p=!g.dynamic,l.__inittedArrays){var u=o=
|
|
|
-n=void 0,G=void 0,v=void 0,U=void 0,C=void 0,B=void 0,D=void 0,la=void 0,A=u=U=D=void 0,x=void 0,I=void 0,w=void 0,F=void 0,J=void 0,L=G=void 0,fa=G=D=void 0,Z=void 0,O=G=w=I=x=F=w=I=x=F=w=I=x=F=w=I=x=C=void 0,W=void 0,S=U=void 0,M=u=void 0,da=void 0,ka=void 0,T=A=M=W=0,X=0,R=O=u=0,ma=C=J=0,y=0,K=0,$=void 0,da=l.__vertexArray,aa=l.__uvArray,y=l.__uv2Array,S=l.__normalArray,v=l.__tangentArray,L=l.__colorArray,fa=l.__skinVertexAArray,Z=l.__skinVertexBArray,B=l.__skinIndexArray,V=l.__skinWeightArray,
|
|
|
-ba=l.__morphTargetsArrays,H=l.__webglCustomAttributesList,s=void 0,s=l.__faceArray,K=l.__lineArray,ga=l.__needsSmoothNormals,D=l.__vertexColorType,la=l.__uvType,U=l.__normalType,ja=t.geometry,$=ja.__dirtyElements,ea=ja.__dirtyUvs,ca=ja.__dirtyNormals,ha=ja.__dirtyTangents,na=ja.__dirtyColors,ka=ja.__dirtyMorphTargets,va=ja.vertices,Q=l.faces3,q=l.faces4,ia=ja.faces,ya=ja.faceVertexUvs[0],oa=ja.faceVertexUvs[1],sa=ja.skinVerticesA,wa=ja.skinVerticesB,ua=ja.skinIndices,pa=ja.skinWeights,ra=ja.morphTargets;
|
|
|
-if(ja.__dirtyVertices){n=0;for(o=Q.length;n<o;n++)G=ia[Q[n]],x=va[G.a].position,I=va[G.b].position,w=va[G.c].position,da[M]=x.x,da[M+1]=x.y,da[M+2]=x.z,da[M+3]=I.x,da[M+4]=I.y,da[M+5]=I.z,da[M+6]=w.x,da[M+7]=w.y,da[M+8]=w.z,M+=9;n=0;for(o=q.length;n<o;n++)G=ia[q[n]],x=va[G.a].position,I=va[G.b].position,w=va[G.c].position,F=va[G.d].position,da[M]=x.x,da[M+1]=x.y,da[M+2]=x.z,da[M+3]=I.x,da[M+4]=I.y,da[M+5]=I.z,da[M+6]=w.x,da[M+7]=w.y,da[M+8]=w.z,da[M+9]=F.x,da[M+10]=F.y,da[M+11]=F.z,M+=12;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,da,m)}if(ka){n=0;for(o=Q.length;n<o;n++){G=ia[Q[n]];M=0;for(da=ra.length;M<da;M++)x=ra[M].vertices[G.a].position,I=ra[M].vertices[G.b].position,w=ra[M].vertices[G.c].position,ka=ba[M],ka[ma]=x.x,ka[ma+1]=x.y,ka[ma+2]=x.z,ka[ma+3]=I.x,ka[ma+4]=I.y,ka[ma+5]=I.z,ka[ma+6]=w.x,ka[ma+7]=w.y,ka[ma+8]=w.z;ma+=9}n=0;for(o=q.length;n<o;n++){G=ia[q[n]];M=0;for(da=ra.length;M<da;M++)x=ra[M].vertices[G.a].position,I=ra[M].vertices[G.b].position,w=ra[M].vertices[G.c].position,
|
|
|
-F=ra[M].vertices[G.d].position,ka=ba[M],ka[ma]=x.x,ka[ma+1]=x.y,ka[ma+2]=x.z,ka[ma+3]=I.x,ka[ma+4]=I.y,ka[ma+5]=I.z,ka[ma+6]=w.x,ka[ma+7]=w.y,ka[ma+8]=w.z,ka[ma+9]=F.x,ka[ma+10]=F.y,ka[ma+11]=F.z;ma+=12}M=0;for(da=ra.length;M<da;M++)j.bindBuffer(j.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[M]),j.bufferData(j.ARRAY_BUFFER,ba[M],m)}if(pa.length){n=0;for(o=Q.length;n<o;n++)G=ia[Q[n]],x=pa[G.a],I=pa[G.b],w=pa[G.c],V[C]=x.x,V[C+1]=x.y,V[C+2]=x.z,V[C+3]=x.w,V[C+4]=I.x,V[C+5]=I.y,V[C+6]=I.z,V[C+7]=I.w,V[C+
|
|
|
-8]=w.x,V[C+9]=w.y,V[C+10]=w.z,V[C+11]=w.w,x=ua[G.a],I=ua[G.b],w=ua[G.c],B[C]=x.x,B[C+1]=x.y,B[C+2]=x.z,B[C+3]=x.w,B[C+4]=I.x,B[C+5]=I.y,B[C+6]=I.z,B[C+7]=I.w,B[C+8]=w.x,B[C+9]=w.y,B[C+10]=w.z,B[C+11]=w.w,x=sa[G.a],I=sa[G.b],w=sa[G.c],fa[C]=x.x,fa[C+1]=x.y,fa[C+2]=x.z,fa[C+3]=1,fa[C+4]=I.x,fa[C+5]=I.y,fa[C+6]=I.z,fa[C+7]=1,fa[C+8]=w.x,fa[C+9]=w.y,fa[C+10]=w.z,fa[C+11]=1,x=wa[G.a],I=wa[G.b],w=wa[G.c],Z[C]=x.x,Z[C+1]=x.y,Z[C+2]=x.z,Z[C+3]=1,Z[C+4]=I.x,Z[C+5]=I.y,Z[C+6]=I.z,Z[C+7]=1,Z[C+8]=w.x,Z[C+9]=
|
|
|
-w.y,Z[C+10]=w.z,Z[C+11]=1,C+=12;n=0;for(o=q.length;n<o;n++)G=ia[q[n]],x=pa[G.a],I=pa[G.b],w=pa[G.c],F=pa[G.d],V[C]=x.x,V[C+1]=x.y,V[C+2]=x.z,V[C+3]=x.w,V[C+4]=I.x,V[C+5]=I.y,V[C+6]=I.z,V[C+7]=I.w,V[C+8]=w.x,V[C+9]=w.y,V[C+10]=w.z,V[C+11]=w.w,V[C+12]=F.x,V[C+13]=F.y,V[C+14]=F.z,V[C+15]=F.w,x=ua[G.a],I=ua[G.b],w=ua[G.c],F=ua[G.d],B[C]=x.x,B[C+1]=x.y,B[C+2]=x.z,B[C+3]=x.w,B[C+4]=I.x,B[C+5]=I.y,B[C+6]=I.z,B[C+7]=I.w,B[C+8]=w.x,B[C+9]=w.y,B[C+10]=w.z,B[C+11]=w.w,B[C+12]=F.x,B[C+13]=F.y,B[C+14]=F.z,B[C+
|
|
|
-15]=F.w,x=sa[G.a],I=sa[G.b],w=sa[G.c],F=sa[G.d],fa[C]=x.x,fa[C+1]=x.y,fa[C+2]=x.z,fa[C+3]=1,fa[C+4]=I.x,fa[C+5]=I.y,fa[C+6]=I.z,fa[C+7]=1,fa[C+8]=w.x,fa[C+9]=w.y,fa[C+10]=w.z,fa[C+11]=1,fa[C+12]=F.x,fa[C+13]=F.y,fa[C+14]=F.z,fa[C+15]=1,x=wa[G.a],I=wa[G.b],w=wa[G.c],G=wa[G.d],Z[C]=x.x,Z[C+1]=x.y,Z[C+2]=x.z,Z[C+3]=1,Z[C+4]=I.x,Z[C+5]=I.y,Z[C+6]=I.z,Z[C+7]=1,Z[C+8]=w.x,Z[C+9]=w.y,Z[C+10]=w.z,Z[C+11]=1,Z[C+12]=G.x,Z[C+13]=G.y,Z[C+14]=G.z,Z[C+15]=1,C+=16;C>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),
|
|
|
-j.bufferData(j.ARRAY_BUFFER,fa,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,Z,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,B,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,V,m))}if(na&&D){n=0;for(o=Q.length;n<o;n++)G=ia[Q[n]],C=G.vertexColors,B=G.color,C.length===3&&D===THREE.VertexColors?(G=C[0],fa=C[1],Z=C[2]):Z=fa=G=B,L[J]=G.r,L[J+1]=G.g,L[J+2]=G.b,L[J+3]=fa.r,L[J+4]=fa.g,
|
|
|
-L[J+5]=fa.b,L[J+6]=Z.r,L[J+7]=Z.g,L[J+8]=Z.b,J+=9;n=0;for(o=q.length;n<o;n++)G=ia[q[n]],C=G.vertexColors,B=G.color,C.length===4&&D===THREE.VertexColors?(G=C[0],fa=C[1],Z=C[2],C=C[3]):C=Z=fa=G=B,L[J]=G.r,L[J+1]=G.g,L[J+2]=G.b,L[J+3]=fa.r,L[J+4]=fa.g,L[J+5]=fa.b,L[J+6]=Z.r,L[J+7]=Z.g,L[J+8]=Z.b,L[J+9]=C.r,L[J+10]=C.g,L[J+11]=C.b,J+=12;J>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,L,m))}if(ha&&ja.hasTangents){n=0;for(o=Q.length;n<o;n++)G=ia[Q[n]],D=G.vertexTangents,
|
|
|
-J=D[0],G=D[1],L=D[2],v[O]=J.x,v[O+1]=J.y,v[O+2]=J.z,v[O+3]=J.w,v[O+4]=G.x,v[O+5]=G.y,v[O+6]=G.z,v[O+7]=G.w,v[O+8]=L.x,v[O+9]=L.y,v[O+10]=L.z,v[O+11]=L.w,O+=12;n=0;for(o=q.length;n<o;n++)G=ia[q[n]],D=G.vertexTangents,J=D[0],G=D[1],L=D[2],D=D[3],v[O]=J.x,v[O+1]=J.y,v[O+2]=J.z,v[O+3]=J.w,v[O+4]=G.x,v[O+5]=G.y,v[O+6]=G.z,v[O+7]=G.w,v[O+8]=L.x,v[O+9]=L.y,v[O+10]=L.z,v[O+11]=L.w,v[O+12]=D.x,v[O+13]=D.y,v[O+14]=D.z,v[O+15]=D.w,O+=16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
-v,m)}if(ca&&U){n=0;for(o=Q.length;n<o;n++)if(G=ia[Q[n]],v=G.vertexNormals,U=G.normal,v.length===3&&ga)for(O=0;O<3;O++)U=v[O],S[u]=U.x,S[u+1]=U.y,S[u+2]=U.z,u+=3;else for(O=0;O<3;O++)S[u]=U.x,S[u+1]=U.y,S[u+2]=U.z,u+=3;n=0;for(o=q.length;n<o;n++)if(G=ia[q[n]],v=G.vertexNormals,U=G.normal,v.length===4&&ga)for(O=0;O<4;O++)U=v[O],S[u]=U.x,S[u+1]=U.y,S[u+2]=U.z,u+=3;else for(O=0;O<4;O++)S[u]=U.x,S[u+1]=U.y,S[u+2]=U.z,u+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,S,
|
|
|
-m)}if(ea&&ya&&la){n=0;for(o=Q.length;n<o;n++)if(u=Q[n],u=ya[u],u!==void 0)for(O=0;O<3;O++)S=u[O],aa[A]=S.u,aa[A+1]=S.v,A+=2;n=0;for(o=q.length;n<o;n++)if(u=q[n],u=ya[u],u!==void 0)for(O=0;O<4;O++)S=u[O],aa[A]=S.u,aa[A+1]=S.v,A+=2;A>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,aa,m))}if(ea&&oa&&la){n=0;for(o=Q.length;n<o;n++)if(u=Q[n],A=oa[u],A!==void 0)for(O=0;O<3;O++)u=A[O],y[T]=u.u,y[T+1]=u.v,T+=2;n=0;for(o=q.length;n<o;n++)if(u=q[n],A=oa[u],A!==void 0)for(O=0;O<
|
|
|
-4;O++)u=A[O],y[T]=u.u,y[T+1]=u.v,T+=2;T>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,y,m))}if($){n=0;for(o=Q.length;n<o;n++)s[X]=W,s[X+1]=W+1,s[X+2]=W+2,X+=3,K[R]=W,K[R+1]=W+1,K[R+2]=W,K[R+3]=W+2,K[R+4]=W+1,K[R+5]=W+2,R+=6,W+=3;n=0;for(o=q.length;n<o;n++)s[X]=W,s[X+1]=W+1,s[X+2]=W+3,s[X+3]=W+1,s[X+4]=W+2,s[X+5]=W+3,X+=6,K[R]=W,K[R+1]=W+1,K[R+2]=W,K[R+3]=W+3,K[R+4]=W+1,K[R+5]=W+2,K[R+6]=W+2,K[R+7]=W+3,R+=8,W+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);
|
|
|
-j.bufferData(j.ELEMENT_ARRAY_BUFFER,s,m);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,K,m)}if(H){O=0;for(W=H.length;O<W;O++)if(s=H[O],s.__original.needsUpdate){K=y=0;if(s.size===1)if(s.boundTo===void 0||s.boundTo==="vertices"){n=0;for(o=Q.length;n<o;n++)G=ia[Q[n]],s.array[y]=s.value[G.a],s.array[y+1]=s.value[G.b],s.array[y+2]=s.value[G.c],y+=3;n=0;for(o=q.length;n<o;n++)G=ia[q[n]],s.array[y]=s.value[G.a],s.array[y+1]=s.value[G.b],s.array[y+2]=s.value[G.c],
|
|
|
-s.array[y+3]=s.value[G.d],y+=4}else if(s.boundTo==="faces"){n=0;for(o=Q.length;n<o;n++)$=s.value[K],s.array[y]=$,s.array[y+1]=$,s.array[y+2]=$,y+=3,K+=1;n=0;for(o=q.length;n<o;n++)$=s.value[K],s.array[y]=$,s.array[y+1]=$,s.array[y+2]=$,s.array[y+3]=$,y+=4,K+=1}else{if(s.boundTo==="faceVertices"){n=0;for(o=Q.length;n<o;n++)s.array[y]=s.value[K],s.array[y+1]=s.value[K+1],s.array[y+2]=s.value[K+2],y+=3,K+=3;n=0;for(o=q.length;n<o;n++)s.array[y]=s.value[K],s.array[y+1]=s.value[K+1],s.array[y+2]=s.value[K+
|
|
|
-2],s.array[y+3]=s.value[K+3],y+=4,K+=4}}else if(s.size===2)if(s.boundTo===void 0||s.boundTo==="vertices"){n=0;for(o=Q.length;n<o;n++)G=ia[Q[n]],x=s.value[G.a],I=s.value[G.b],w=s.value[G.c],s.array[y]=x.x,s.array[y+1]=x.y,s.array[y+2]=I.x,s.array[y+3]=I.y,s.array[y+4]=w.x,s.array[y+5]=w.y,y+=6;n=0;for(o=q.length;n<o;n++)G=ia[q[n]],x=s.value[G.a],I=s.value[G.b],w=s.value[G.c],F=s.value[G.d],s.array[y]=x.x,s.array[y+1]=x.y,s.array[y+2]=I.x,s.array[y+3]=I.y,s.array[y+4]=w.x,s.array[y+5]=w.y,s.array[y+
|
|
|
-6]=F.x,s.array[y+7]=F.y,y+=8}else if(s.boundTo==="faces"){n=0;for(o=Q.length;n<o;n++)w=I=x=$=s.value[K],s.array[y]=x.x,s.array[y+1]=x.y,s.array[y+2]=I.x,s.array[y+3]=I.y,s.array[y+4]=w.x,s.array[y+5]=w.y,y+=6,K+=1;n=0;for(o=q.length;n<o;n++)F=w=I=x=$=s.value[K],s.array[y]=x.x,s.array[y+1]=x.y,s.array[y+2]=I.x,s.array[y+3]=I.y,s.array[y+4]=w.x,s.array[y+5]=w.y,s.array[y+6]=F.x,s.array[y+7]=F.y,y+=8,K+=1}else{if(s.boundTo==="faceVertices"){n=0;for(o=Q.length;n<o;n++)x=s.value[K],I=s.value[K+1],w=s.value[K+
|
|
|
-2],s.array[y]=x.x,s.array[y+1]=x.y,s.array[y+2]=I.x,s.array[y+3]=I.y,s.array[y+4]=w.x,s.array[y+5]=w.y,y+=6,K+=3;n=0;for(o=q.length;n<o;n++)x=s.value[K],I=s.value[K+1],w=s.value[K+2],F=s.value[K+3],s.array[y]=x.x,s.array[y+1]=x.y,s.array[y+2]=I.x,s.array[y+3]=I.y,s.array[y+4]=w.x,s.array[y+5]=w.y,s.array[y+6]=F.x,s.array[y+7]=F.y,y+=8,K+=4}}else if(s.size===3)if(T=s.type==="c"?["r","g","b"]:["x","y","z"],s.boundTo===void 0||s.boundTo==="vertices"){n=0;for(o=Q.length;n<o;n++)G=ia[Q[n]],x=s.value[G.a],
|
|
|
-I=s.value[G.b],w=s.value[G.c],s.array[y]=x[T[0]],s.array[y+1]=x[T[1]],s.array[y+2]=x[T[2]],s.array[y+3]=I[T[0]],s.array[y+4]=I[T[1]],s.array[y+5]=I[T[2]],s.array[y+6]=w[T[0]],s.array[y+7]=w[T[1]],s.array[y+8]=w[T[2]],y+=9;n=0;for(o=q.length;n<o;n++)G=ia[q[n]],x=s.value[G.a],I=s.value[G.b],w=s.value[G.c],F=s.value[G.d],s.array[y]=x[T[0]],s.array[y+1]=x[T[1]],s.array[y+2]=x[T[2]],s.array[y+3]=I[T[0]],s.array[y+4]=I[T[1]],s.array[y+5]=I[T[2]],s.array[y+6]=w[T[0]],s.array[y+7]=w[T[1]],s.array[y+8]=w[T[2]],
|
|
|
-s.array[y+9]=F[T[0]],s.array[y+10]=F[T[1]],s.array[y+11]=F[T[2]],y+=12,K+=1}else if(s.boundTo==="faces"){n=0;for(o=Q.length;n<o;n++)w=I=x=$=s.value[K],s.array[y]=x[T[0]],s.array[y+1]=x[T[1]],s.array[y+2]=x[T[2]],s.array[y+3]=I[T[0]],s.array[y+4]=I[T[1]],s.array[y+5]=I[T[2]],s.array[y+6]=w[T[0]],s.array[y+7]=w[T[1]],s.array[y+8]=w[T[2]],y+=9,K+=1;n=0;for(o=q.length;n<o;n++)F=w=I=x=$=s.value[K],s.array[y]=x[T[0]],s.array[y+1]=x[T[1]],s.array[y+2]=x[T[2]],s.array[y+3]=I[T[0]],s.array[y+4]=I[T[1]],s.array[y+
|
|
|
-5]=I[T[2]],s.array[y+6]=w[T[0]],s.array[y+7]=w[T[1]],s.array[y+8]=w[T[2]],s.array[y+9]=F[T[0]],s.array[y+10]=F[T[1]],s.array[y+11]=F[T[2]],y+=12,K+=1}else{if(s.boundTo==="faceVertices"){n=0;for(o=Q.length;n<o;n++)x=s.value[K],I=s.value[K+1],w=s.value[K+2],s.array[y]=x[T[0]],s.array[y+1]=x[T[1]],s.array[y+2]=x[T[2]],s.array[y+3]=I[T[0]],s.array[y+4]=I[T[1]],s.array[y+5]=I[T[2]],s.array[y+6]=w[T[0]],s.array[y+7]=w[T[1]],s.array[y+8]=w[T[2]],y+=9,K+=3;n=0;for(o=q.length;n<o;n++)x=s.value[K],I=s.value[K+
|
|
|
-1],w=s.value[K+2],F=s.value[K+3],s.array[y]=x[T[0]],s.array[y+1]=x[T[1]],s.array[y+2]=x[T[2]],s.array[y+3]=I[T[0]],s.array[y+4]=I[T[1]],s.array[y+5]=I[T[2]],s.array[y+6]=w[T[0]],s.array[y+7]=w[T[1]],s.array[y+8]=w[T[2]],s.array[y+9]=F[T[0]],s.array[y+10]=F[T[1]],s.array[y+11]=F[T[2]],y+=12,K+=4}}else if(s.size===4)if(s.boundTo===void 0||s.boundTo==="vertices"){n=0;for(o=Q.length;n<o;n++)G=ia[Q[n]],x=s.value[G.a],I=s.value[G.b],w=s.value[G.c],s.array[y]=x.x,s.array[y+1]=x.y,s.array[y+2]=x.z,s.array[y+
|
|
|
-3]=x.w,s.array[y+4]=I.x,s.array[y+5]=I.y,s.array[y+6]=I.z,s.array[y+7]=I.w,s.array[y+8]=w.x,s.array[y+9]=w.y,s.array[y+10]=w.z,s.array[y+11]=w.w,y+=12;n=0;for(o=q.length;n<o;n++)G=ia[q[n]],x=s.value[G.a],I=s.value[G.b],w=s.value[G.c],F=s.value[G.d],s.array[y]=x.x,s.array[y+1]=x.y,s.array[y+2]=x.z,s.array[y+3]=x.w,s.array[y+4]=I.x,s.array[y+5]=I.y,s.array[y+6]=I.z,s.array[y+7]=I.w,s.array[y+8]=w.x,s.array[y+9]=w.y,s.array[y+10]=w.z,s.array[y+11]=w.w,s.array[y+12]=F.x,s.array[y+13]=F.y,s.array[y+14]=
|
|
|
-F.z,s.array[y+15]=F.w,y+=16}else if(s.boundTo==="faces"){n=0;for(o=Q.length;n<o;n++)w=I=x=$=s.value[K],s.array[y]=x.x,s.array[y+1]=x.y,s.array[y+2]=x.z,s.array[y+3]=x.w,s.array[y+4]=I.x,s.array[y+5]=I.y,s.array[y+6]=I.z,s.array[y+7]=I.w,s.array[y+8]=w.x,s.array[y+9]=w.y,s.array[y+10]=w.z,s.array[y+11]=w.w,y+=12,K+=1;n=0;for(o=q.length;n<o;n++)F=w=I=x=$=s.value[K],s.array[y]=x.x,s.array[y+1]=x.y,s.array[y+2]=x.z,s.array[y+3]=x.w,s.array[y+4]=I.x,s.array[y+5]=I.y,s.array[y+6]=I.z,s.array[y+7]=I.w,s.array[y+
|
|
|
-8]=w.x,s.array[y+9]=w.y,s.array[y+10]=w.z,s.array[y+11]=w.w,s.array[y+12]=F.x,s.array[y+13]=F.y,s.array[y+14]=F.z,s.array[y+15]=F.w,y+=16,K+=1}else if(s.boundTo==="faceVertices"){n=0;for(o=Q.length;n<o;n++)x=s.value[K],I=s.value[K+1],w=s.value[K+2],s.array[y]=x.x,s.array[y+1]=x.y,s.array[y+2]=x.z,s.array[y+3]=x.w,s.array[y+4]=I.x,s.array[y+5]=I.y,s.array[y+6]=I.z,s.array[y+7]=I.w,s.array[y+8]=w.x,s.array[y+9]=w.y,s.array[y+10]=w.z,s.array[y+11]=w.w,y+=12,K+=3;n=0;for(o=q.length;n<o;n++)x=s.value[K],
|
|
|
-I=s.value[K+1],w=s.value[K+2],F=s.value[K+3],s.array[y]=x.x,s.array[y+1]=x.y,s.array[y+2]=x.z,s.array[y+3]=x.w,s.array[y+4]=I.x,s.array[y+5]=I.y,s.array[y+6]=I.z,s.array[y+7]=I.w,s.array[y+8]=w.x,s.array[y+9]=w.y,s.array[y+10]=w.z,s.array[y+11]=w.w,s.array[y+12]=F.x,s.array[y+13]=F.y,s.array[y+14]=F.z,s.array[y+15]=F.w,y+=16,K+=4}j.bindBuffer(j.ARRAY_BUFFER,s.buffer);j.bufferData(j.ARRAY_BUFFER,s.array,m)}}p&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,
|
|
|
-delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}g.__dirtyVertices=!1;g.__dirtyMorphTargets=!1;g.__dirtyElements=!1;g.__dirtyUvs=!1;g.__dirtyNormals=!1;g.__dirtyColors=!1;g.__dirtyTangents=!1;h.attributes&&z(h)}else if(t instanceof THREE.Ribbon){if(g.__dirtyVertices||g.__dirtyColors){h=g;t=j.DYNAMIC_DRAW;n=i=n=p=p=void 0;o=h.vertices;
|
|
|
-k=h.colors;H=o.length;l=k.length;Q=h.__vertexArray;m=h.__colorArray;q=h.__dirtyColors;if(h.__dirtyVertices){for(p=0;p<H;p++)n=o[p].position,i=p*3,Q[i]=n.x,Q[i+1]=n.y,Q[i+2]=n.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Q,t)}if(q){for(p=0;p<l;p++)n=k[p],i=p*3,m[i]=n.r,m[i+1]=n.g,m[i+2]=n.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,m,t)}}g.__dirtyVertices=!1;g.__dirtyColors=!1}else if(t instanceof THREE.Line){h=b(t,l);m=h.attributes&&
|
|
|
-r(h);if(g.__dirtyVertices||g.__dirtyColors||m){t=g;i=j.DYNAMIC_DRAW;H=k=W=o=ia=void 0;o=t.vertices;l=t.colors;H=o.length;m=l.length;Q=t.__vertexArray;p=t.__colorArray;q=t.__dirtyColors;n=t.__webglCustomAttributesList;A=R=X=T=W=ia=void 0;if(t.__dirtyVertices){for(ia=0;ia<H;ia++)W=o[ia].position,k=ia*3,Q[k]=W.x,Q[k+1]=W.y,Q[k+2]=W.z;j.bindBuffer(j.ARRAY_BUFFER,t.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Q,i)}if(q){for(o=0;o<m;o++)H=l[o],k=o*3,p[k]=H.r,p[k+1]=H.g,p[k+2]=H.b;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-t.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,p,i)}if(n){ia=0;for(W=n.length;ia<W;ia++)if(A=n[ia],A.needsUpdate&&(A.boundTo===void 0||A.boundTo==="vertices")){k=0;X=A.value.length;if(A.size===1)for(T=0;T<X;T++)A.array[T]=A.value[T];else if(A.size===2)for(T=0;T<X;T++)R=A.value[T],A.array[k]=R.x,A.array[k+1]=R.y,k+=2;else if(A.size===3)if(A.type==="c")for(T=0;T<X;T++)R=A.value[T],A.array[k]=R.r,A.array[k+1]=R.g,A.array[k+2]=R.b,k+=3;else for(T=0;T<X;T++)R=A.value[T],A.array[k]=R.x,A.array[k+1]=
|
|
|
-R.y,A.array[k+2]=R.z,k+=3;else if(A.size===4)for(T=0;T<X;T++)R=A.value[T],A.array[k]=R.x,A.array[k+1]=R.y,A.array[k+2]=R.z,A.array[k+3]=R.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,A.buffer);j.bufferData(j.ARRAY_BUFFER,A.array,i)}}}g.__dirtyVertices=!1;g.__dirtyColors=!1;h.attributes&&z(h)}else if(t instanceof THREE.ParticleSystem)h=b(t,l),m=h.attributes&&r(h),(g.__dirtyVertices||g.__dirtyColors||t.sortParticles||m)&&d(g,j.DYNAMIC_DRAW,t),g.__dirtyVertices=!1,g.__dirtyColors=!1,h.attributes&&z(h)};this.setFaceCulling=
|
|
|
-function(a,b){a?(!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)};this.supportsVertexTextures=function(){return Ca}};
|
|
|
+function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;var i=a.colors,n=i.length,k=a.__vertexArray,l=a.__colorArray,m=a.__sortArray,p=a.__dirtyVertices,o=a.__dirtyColors,x=a.__webglCustomAttributesList;if(c.sortParticles){Y.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,ia.copy(e),Y.multiplyVector3(ia),m[d]=[ia.z,d];m.sort(function(a,
|
|
|
+b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[m[d][1]].position,g=d*3,k[g]=e.x,k[g+1]=e.y,k[g+2]=e.z;for(d=0;d<n;d++)g=d*3,e=i[m[d][1]],l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(x){i=0;for(n=x.length;i<n;i++)if(h=x[i],h.boundTo===void 0||h.boundTo==="vertices")if(g=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)f=m[d][1],h.array[d]=h.value[f];else if(h.size===2)for(d=0;d<e;d++)f=m[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=m[d][1],f=h.value[f],
|
|
|
+h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=m[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=m[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}}else{if(p)for(d=0;d<f;d++)e=h[d].position,g=d*3,k[g]=e.x,k[g+1]=e.y,k[g+2]=e.z;if(o)for(d=0;d<n;d++)e=i[d],g=d*3,l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(x){i=0;for(n=x.length;i<n;i++)if(h=x[i],h.needsUpdate&&(h.boundTo===void 0||
|
|
|
+h.boundTo==="vertices"))if(e=h.value.length,g=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,
|
|
|
+g+=4}}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(o||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(x){i=0;for(n=x.length;i<n;i++)if(h=x[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
|
|
|
+a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,f,h,i,n,k,l,m,p=a.count*3;for(m=0;m<p;m+=9)c=a.normalArray,d=c[m],e=c[m+1],g=c[m+2],f=c[m+3],i=c[m+4],k=c[m+5],h=c[m+6],n=c[m+7],l=c[m+8],d=(d+f+h)/3,e=(e+i+n)/3,g=
|
|
|
+(g+k+l)/3,c[m]=d,c[m+1]=e,c[m+2]=g,c[m+3]=d,c[m+4]=e,c[m+5]=g,c[m+6]=d,c[m+7]=e,c[m+8]=g}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,g){if(d.opacity!==0){var f,h,c=v(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==U&&(U=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){f=0;var i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;f<d.numSupportedMorphTargets&&
|
|
|
+f<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[f]=h[i[f]],f++}else{var i=[],n=-1,k=0;h=g.morphTargetInfluences;var l,m=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(l=0;l<m;l++)!i[l]&&h[l]>n&&(k=l,n=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]=
|
|
|
+n;i[k]=1;n=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=0;for(h=e.__webglCustomAttributesList.length;f<h;f++)c=e.__webglCustomAttributesList[f],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
|
|
|
+3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),
|
|
|
+j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,
|
|
|
+4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==pa&&(j.lineWidth(d),pa=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),O.info.render.calls++,O.info.render.vertices+=
|
|
|
+e.__webglFaceCount,O.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==pa&&(j.lineWidth(d),pa=d),j.drawArrays(g,0,e.__webglLineCount),O.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),O.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),O.info.render.calls++)}}function f(a){E[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
|
|
|
+a.n13,a.n44-a.n14);E[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);E[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);E[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);E[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);E[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=E[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
|
|
|
+a.scale.z)),d=0;d<6;d++)if(a=E[d].x*b.n14+E[d].y*b.n24+E[d].z*b.n34+E[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function k(a){var b,c,d,i=0,n,k,l,m,p,o,x=a.lights;X||(X=new THREE.PerspectiveCamera(O.shadowCameraFov,O.shadowMapWidth/O.shadowMapHeight,O.shadowCameraNear,O.shadowCameraFar));b=0;for(c=x.length;b<c;b++)if(d=x[b],d instanceof THREE.SpotLight&&d.castShadow){ba=-1;O.shadowMap[i]||(O.shadowMap[i]=new THREE.WebGLRenderTarget(O.shadowMapWidth,O.shadowMapHeight,{minFilter:THREE.LinearFilter,
|
|
|
+magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));sa[i]||(sa[i]=new THREE.Matrix4);n=O.shadowMap[i];k=sa[i];X.position.copy(d.position);X.lookAt(d.target.position);X.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(X));this.autoUpdateScene&&a.updateMatrixWorld();X.matrixWorldInverse.getInverse(X.matrixWorld);k.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);k.multiplySelf(X.projectionMatrix);k.multiplySelf(X.matrixWorldInverse);X.matrixWorldInverse.flattenToArray(H);
|
|
|
+X.projectionMatrix.flattenToArray(ja);Y.multiply(X.projectionMatrix,X.matrixWorldInverse);f(Y);P(n);j.clearColor(1,1,1,1);O.clear();j.clearColor(F.r,F.g,F.b,B);k=a.__webglObjects.length;d=a.__webglObjectsImmediate.length;for(n=0;n<k;n++)l=a.__webglObjects[n],o=l.object,o.visible&&o.castShadow?!(o instanceof THREE.Mesh)||!o.frustumCulled||h(o)?(o.matrixWorld.flattenToArray(o._objectMatrixArray),y(o,X,!1),l.render=!0):l.render=!1:l.render=!1;t(!0);L(THREE.NormalBlending);for(n=0;n<k;n++)if(l=a.__webglObjects[n],
|
|
|
+l.render)o=l.object,p=l.buffer,q(o),l=o.customDepthMaterial?o.customDepthMaterial:o.geometry.morphTargets.length?ma:xa,e(X,x,null,l,p,o);for(n=0;n<d;n++)l=a.__webglObjectsImmediate[n],o=l.object,o.visible&&o.castShadow&&(o.matrixAutoUpdate&&o.matrixWorld.flattenToArray(o._objectMatrixArray),U=-1,y(o,X,!1),q(o),m=v(X,x,null,xa,o),o.immediateRenderCallback?o.immediateRenderCallback(m,j,E):o.render(function(a){g(a,m,xa.shading)}));i++}}function l(a){var b=a.object.material;b.transparent?(a.transparent=
|
|
|
+b,a.opaque=null):(a.opaque=b,a.transparent=null)}function m(a){var b=a.object,c=a.buffer,d;d=b.material;if(d instanceof THREE.MeshFaceMaterial){if(c=c.materialIndex,c>=0)b=b.geometry.materials[c],b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}else if(b=d)b.transparent?(a.transparent=b,a.opaque=null):(a.opaque=b,a.transparent=null)}function o(a,b){var c,d,e;c=G.attributes;var g=G.uniforms,f=S/x,h,n=[],k=x*0.5,l=S*0.5,m=!0;j.useProgram(G.program);aa=G.program;U=la=$=-1;
|
|
|
+ya||(j.enableVertexAttribArray(G.attributes.position),j.enableVertexAttribArray(G.attributes.uv),ya=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,G.vertexBuffer);j.vertexAttribPointer(c.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(c.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,G.elementBuffer);j.uniformMatrix4fv(g.projectionMatrix,!1,ja);j.activeTexture(j.TEXTURE0);j.uniform1i(g.map,0);c=0;for(d=a.__webglSprites.length;c<d;c++)if(e=a.__webglSprites[c],
|
|
|
+e.visible&&e.opacity!==0)e.useScreenCoordinates?e.z=-e.position.z:(e._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,e.matrixWorld,e._modelViewMatrixArray),e.z=-e._modelViewMatrix.n34);a.__webglSprites.sort(i);c=0;for(d=a.__webglSprites.length;c<d;c++)e=a.__webglSprites[c],e.visible&&e.opacity!==0&&e.map&&e.map.image&&e.map.image.width&&(e.useScreenCoordinates?(j.uniform1i(g.useScreenCoordinates,1),j.uniform3f(g.screenPosition,(e.position.x-k)/k,(l-e.position.y)/l,Math.max(0,Math.min(1,e.position.z)))):
|
|
|
+(j.uniform1i(g.useScreenCoordinates,0),j.uniform1i(g.affectedByDistance,e.affectedByDistance?1:0),j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray)),h=e.map.image.width/(e.scaleByViewport?S:1),n[0]=h*f*e.scale.x,n[1]=h*e.scale.y,j.uniform2f(g.uvScale,e.uvScale.x,e.uvScale.y),j.uniform2f(g.uvOffset,e.uvOffset.x,e.uvOffset.y),j.uniform2f(g.alignment,e.alignment.x,e.alignment.y),j.uniform1f(g.opacity,e.opacity),j.uniform3f(g.color,e.color.r,e.color.g,e.color.b),j.uniform1f(g.rotation,
|
|
|
+e.rotation),j.uniform2fv(g.scale,n),e.mergeWith3D&&!m?(j.enable(j.DEPTH_TEST),m=!0):!e.mergeWith3D&&m&&(j.disable(j.DEPTH_TEST),m=!1),L(e.blending),D(e.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(oa)}function n(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function s(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function p(a){for(var b in a.attributes)a.attributes[b].needsUpdate=
|
|
|
+!1}function u(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function v(a,b,c,d,e){d.program||O.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(O.maxMorphTargets);for(var g=0,f=O.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==aa&&(j.useProgram(g),aa=g,h=!0);if(d.id!==ba)ba=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,ja);if(c&&d.fog)if(i.fogColor.value=
|
|
|
+c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var n,k,l=0,m=0,o=0,p,x,s,E=W,q=E.directional.colors,u=E.directional.positions,v=E.point.colors,S=E.point.positions,y=E.point.distances,Y=0,t=0,c=n=s=0,h=b.length;c<h;c++)if(n=b[c],k=n.color,p=n.position,x=n.intensity,s=n.distance,n instanceof THREE.AmbientLight)O.gammaInput?
|
|
|
+(l+=k.r*k.r,m+=k.g*k.g,o+=k.b*k.b):(l+=k.r,m+=k.g,o+=k.b);else if(n instanceof THREE.DirectionalLight)s=Y*3,O.gammaInput?(q[s]=k.r*k.r*x*x,q[s+1]=k.g*k.g*x*x,q[s+2]=k.b*k.b*x*x):(q[s]=k.r*x,q[s+1]=k.g*x,q[s+2]=k.b*x),u[s]=p.x,u[s+1]=p.y,u[s+2]=p.z,Y+=1;else if(n instanceof THREE.SpotLight)s=Y*3,O.gammaInput?(q[s]=k.r*k.r*x*x,q[s+1]=k.g*k.g*x*x,q[s+2]=k.b*k.b*x*x):(q[s]=k.r*x,q[s+1]=k.g*x,q[s+2]=k.b*x),k=1/p.length(),u[s]=p.x*k,u[s+1]=p.y*k,u[s+2]=p.z*k,Y+=1;else if(n instanceof THREE.PointLight)n=
|
|
|
+t*3,O.gammaInput?(v[n]=k.r*k.r*x*x,v[n+1]=k.g*k.g*x*x,v[n+2]=k.b*k.b*x*x):(v[n]=k.r*x,v[n+1]=k.g*x,v[n+2]=k.b*x),S[n]=p.x,S[n+1]=p.y,S[n+2]=p.z,y[t]=s,t+=1;c=Y*3;for(h=q.length;c<h;c++)q[c]=0;c=t*3;for(h=v.length;c<h;c++)v[c]=0;E.point.length=t;E.directional.length=Y;E.ambient[0]=l;E.ambient[1]=m;E.ambient[2]=o;b=W;i.enableLighting.value=b.directional.length+b.point.length;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;
|
|
|
+i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,O.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=
|
|
|
+d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=N.height/
|
|
|
+2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,O.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)O.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;
|
|
|
+else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<sa.length;b++)i.shadowMatrix.value[b]=sa[b],i.shadowMap.texture[b]=O.shadowMap[b];i.shadowDarkness.value=O.shadowMapDarkness;i.shadowBias.value=O.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(m=g.uniforms[b[i][1]])if(l=b[i][0],o=l.type,h=l.value,o==="i")j.uniform1i(m,h);else if(o==="f")j.uniform1f(m,h);else if(o==="v2")j.uniform2f(m,h.x,h.y);else if(o===
|
|
|
+"v3")j.uniform3f(m,h.x,h.y,h.z);else if(o==="v4")j.uniform4f(m,h.x,h.y,h.z,h.w);else if(o==="c")j.uniform3f(m,h.r,h.g,h.b);else if(o==="fv1")j.uniform1fv(m,h);else if(o==="fv")j.uniform3fv(m,h);else if(o==="v3v"){if(!l._array)l._array=new Float32Array(3*h.length);o=0;for(p=h.length;o<p;o++)E=o*3,l._array[E]=h[o].x,l._array[E+1]=h[o].y,l._array[E+2]=h[o].z;j.uniform3fv(m,l._array)}else if(o==="m4"){if(!l._array)l._array=new Float32Array(16);h.flattenToArray(l._array);j.uniformMatrix4fv(m,!1,l._array)}else if(o===
|
|
|
+"m4v"){if(!l._array)l._array=new Float32Array(16*h.length);o=0;for(p=h.length;o<p;o++)h[o].flattenToArrayOffset(l._array,o*16);j.uniformMatrix4fv(m,!1,l._array)}else if(o==="t"){if(j.uniform1i(m,h),m=l.texture)if(m.image instanceof Array&&m.image.length===6){if(l=m,l.image.length===6)if(l.needsUpdate){if(!l.image.__webglTextureCube)l.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,l.image.__webglTextureCube);for(h=0;h<6;h++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+
|
|
|
+h,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,l.image[h]);I(j.TEXTURE_CUBE_MAP,l,l.image[0]);l.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.image.__webglTextureCube)}else m instanceof THREE.WebGLRenderTargetCube?(l=m,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.__webglTexture)):D(m,h)}else if(o==="tv"){if(!l._array){l._array=[];o=0;for(p=l.texture.length;o<p;o++)l._array[o]=h+o}j.uniform1iv(m,l._array);o=0;for(p=l.texture.length;o<p;o++)(m=l.texture[o])&&
|
|
|
+D(m,l._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&f.cameraPosition!==null&&j.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&f.viewMatrix!==null&&j.uniformMatrix4fv(f.viewMatrix,!1,H);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,H),j.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(f.modelViewMatrix,
|
|
|
+!1,e._modelViewMatrixArray);f.normalMatrix&&j.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&f.objectMatrix!==null&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function y(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function q(a){if(ca!==a.doubleSided)a.doubleSided?
|
|
|
+j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ca=a.doubleSided;if(K!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),K=a.flipSided}function t(a){la!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),la=a)}function w(a){oa!==a&&(j.depthMask(a),oa=a)}function z(a,b,c){na!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),na=a);if(a&&(ua!==b||va!==c))j.polygonOffset(b,c),ua=b,va=c}function L(a){if(a!==$){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);
|
|
|
+j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}$=a}}function J(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));
|
|
|
+j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function I(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,M(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,M(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,M(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,M(b.minFilter)),j.generateMipmap(a)):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),
|
|
|
+j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,fa(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,fa(b.minFilter)))}function D(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),O.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,M(a.format),a.image.width,a.image.height,0,M(a.format),j.UNSIGNED_BYTE,a.image.data):
|
|
|
+j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);I(j.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}function C(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,
|
|
|
+b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function P(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);I(j.TEXTURE_CUBE_MAP,
|
|
|
+a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,M(a.format),a.width,a.height,0,M(a.format),M(a.type),null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);C(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=
|
|
|
+j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),I(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,M(a.format),a.width,a.height,0,M(a.format),M(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),C(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,
|
|
|
+null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=x,a=S,d=ra,e=Aa);b!==V&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),V=b)}function R(a){a instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,a.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,
|
|
|
+null))}function fa(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function M(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;
|
|
|
+case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;
|
|
|
+case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},N=a.canvas!==void 0?a.canvas:document.createElement("canvas"),ga=a.stencil!==void 0?a.stencil:!0,ka=a.antialias!==void 0?a.antialias:!1,Z=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,F=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),B=a.clearAlpha!==void 0?a.clearAlpha:
|
|
|
+0,Q=a.maxLights!==void 0?a.maxLights:4;this.domElement=N;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=1;this.shadowCameraFar=5E3;this.shadowCameraFov=50;this.shadowMap=[];this.shadowMapEnabled=!1;this.shadowMapSoft=
|
|
|
+this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var O=this,j,ha=[],aa=null,V=null,ba=-1,U=null,ea=0,ca=null,K=null,$=null,la=null,oa=null,na=null,ua=null,va=null,pa=null,ra=0,Aa=0,x=0,S=0,E=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Y=new THREE.Matrix4,ja=new Float32Array(16),H=new Float32Array(16),ia=new THREE.Vector4,W={ambient:[0,0,0],
|
|
|
+directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},X,sa=[],xa,ma,G={},ya=!1;j=function(){var a;try{if(!(a=N.getContext("experimental-webgl",{antialias:ka,stencil:ga,preserveDrawingBuffer:Z})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,
|
|
|
+0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(F.r,F.g,F.b,B);(function(){G.vertices=new Float32Array(16);G.faces=new Uint16Array(6);var a=0;G.vertices[a++]=-1;G.vertices[a++]=-1;G.vertices[a++]=0;G.vertices[a++]=1;G.vertices[a++]=1;G.vertices[a++]=-1;G.vertices[a++]=1;G.vertices[a++]=1;G.vertices[a++]=
|
|
|
+1;G.vertices[a++]=1;G.vertices[a++]=1;G.vertices[a++]=0;G.vertices[a++]=-1;G.vertices[a++]=1;G.vertices[a++]=0;a=G.vertices[a++]=0;G.faces[a++]=0;G.faces[a++]=1;G.faces[a++]=2;G.faces[a++]=0;G.faces[a++]=2;G.faces[a++]=3;G.vertexBuffer=j.createBuffer();G.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,G.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,G.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,G.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,G.faces,j.STATIC_DRAW);G.program=
|
|
|
+j.createProgram();j.attachShader(G.program,J("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(G.program,J("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(G.program);G.attributes={};G.uniforms={};G.attributes.position=j.getAttribLocation(G.program,"position");G.attributes.uv=j.getAttribLocation(G.program,"uv");G.uniforms.uvOffset=j.getUniformLocation(G.program,"uvOffset");G.uniforms.uvScale=j.getUniformLocation(G.program,"uvScale");G.uniforms.rotation=j.getUniformLocation(G.program,
|
|
|
+"rotation");G.uniforms.scale=j.getUniformLocation(G.program,"scale");G.uniforms.alignment=j.getUniformLocation(G.program,"alignment");G.uniforms.color=j.getUniformLocation(G.program,"color");G.uniforms.map=j.getUniformLocation(G.program,"map");G.uniforms.opacity=j.getUniformLocation(G.program,"opacity");G.uniforms.useScreenCoordinates=j.getUniformLocation(G.program,"useScreenCoordinates");G.uniforms.affectedByDistance=j.getUniformLocation(G.program,"affectedByDistance");G.uniforms.screenPosition=
|
|
|
+j.getUniformLocation(G.program,"screenPosition");G.uniforms.modelViewMatrix=j.getUniformLocation(G.program,"modelViewMatrix");G.uniforms.projectionMatrix=j.getUniformLocation(G.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);xa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});ma=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
|
|
|
+xa._shadowPass=!0;ma._shadowPass=!0})();this.context=j;var ta=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=function(){return ta};this.setSize=function(a,b){N.width=a;N.height=b;this.setViewport(0,0,N.width,N.height)};this.setViewport=function(a,b,c,d){ra=a;Aa=b;x=c;S=d;j.viewport(ra,Aa,x,S)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};
|
|
|
+this.setClearColorHex=function(a,b){F.setHex(a);B=b;j.clearColor(F.r,F.g,F.b,B)};this.setClearColor=function(a,b){F.copy(a);B=b;j.clearColor(F.r,F.g,F.b,B)};this.getClearColor=function(){return F};this.getClearAlpha=function(){return B};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){P(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
|
|
|
+!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);
|
|
|
+j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);O.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),O.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
|
|
|
+j.deleteBuffer(a.__webglColorBuffer),O.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),O.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),O.info.memory.textures--};this.updateShadowMap=function(a,b){k(a,b)};this.render=function(a,b,c,d){var n,p,x,s,u,S,wa,B=a.lights,ca=a.fog;ba=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
|
|
|
+this.shadowMapEnabled&&this.shadowMapAutoUpdate&&k(a,b);O.info.render.calls=0;O.info.render.vertices=0;O.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(H);b.projectionMatrix.flattenToArray(ja);Y.multiply(b.projectionMatrix,b.matrixWorldInverse);f(Y);P(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
|
|
|
+this.autoClearDepth,this.autoClearStencil);x=a.__webglObjects.length;for(d=0;d<x;d++)if(u=a.__webglObjects[d],S=u.object,S.visible)if(!(S instanceof THREE.Mesh)||!S.frustumCulled||h(S)){if(S.matrixWorld.flattenToArray(S._objectMatrixArray),y(S,b,!0),m(u),u.render=!0,this.sortObjects)S.renderDepth?u.z=S.renderDepth:(ia.copy(S.position),Y.multiplyVector3(ia),u.z=ia.z)}else u.render=!1;else u.render=!1;this.sortObjects&&a.__webglObjects.sort(i);s=a.__webglObjectsImmediate.length;for(d=0;d<s;d++)u=a.__webglObjectsImmediate[d],
|
|
|
+S=u.object,S.visible&&(S.matrixAutoUpdate&&S.matrixWorld.flattenToArray(S._objectMatrixArray),y(S,b,!0),l(u));if(a.overrideMaterial){t(a.overrideMaterial.depthTest);L(a.overrideMaterial.blending);for(d=0;d<x;d++)if(u=a.__webglObjects[d],u.render)S=u.object,wa=u.buffer,q(S),e(b,B,ca,a.overrideMaterial,wa,S);for(d=0;d<s;d++)u=a.__webglObjectsImmediate[d],S=u.object,S.visible&&(U=-1,q(S),n=v(b,B,ca,a.overrideMaterial,S),S.immediateRenderCallback?S.immediateRenderCallback(n,j,E):S.render(function(b){g(b,
|
|
|
+n,a.overrideMaterial.shading)}))}else{L(THREE.NormalBlending);for(d=x-1;d>=0;d--)if(u=a.__webglObjects[d],u.render&&(S=u.object,wa=u.buffer,p=u.opaque))q(S),t(p.depthTest),w(p.depthWrite),z(p.polygonOffset,p.polygonOffsetFactor,p.polygonOffsetUnits),e(b,B,ca,p,wa,S);for(d=0;d<s;d++)if(u=a.__webglObjectsImmediate[d],S=u.object,S.visible&&(U=-1,p=u.opaque))q(S),t(p.depthTest),w(p.depthWrite),z(p.polygonOffset,p.polygonOffsetFactor,p.polygonOffsetUnits),n=v(b,B,ca,p,S),S.immediateRenderCallback?S.immediateRenderCallback(n,
|
|
|
+j,E):S.render(function(a){g(a,n,p.shading)});for(d=0;d<x;d++)if(u=a.__webglObjects[d],u.render&&(S=u.object,wa=u.buffer,p=u.transparent))q(S),L(p.blending),t(p.depthTest),w(p.depthWrite),z(p.polygonOffset,p.polygonOffsetFactor,p.polygonOffsetUnits),e(b,B,ca,p,wa,S);for(d=0;d<s;d++)if(u=a.__webglObjectsImmediate[d],S=u.object,S.visible&&(U=-1,p=u.transparent))q(S),L(p.blending),t(p.depthTest),w(p.depthWrite),z(p.polygonOffset,p.polygonOffsetFactor,p.polygonOffsetUnits),n=v(b,B,ca,p,S),S.immediateRenderCallback?
|
|
|
+S.immediateRenderCallback(n,j,E):S.render(function(a){g(a,n,p.shading)})}a.__webglSprites.length&&o(a,b);c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&R(c)};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],g=a,f=void 0,h=void 0,i=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),
|
|
|
+e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh){h=e.geometry;if(h.geometryGroups===void 0){var i=h,k=void 0,l=void 0,m=void 0,o=void 0,x=void 0,E=void 0,S=void 0,q={},v=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)m=i.faces[k],o=m.materialIndex,E=o!==void 0?o:-1,q[E]===void 0&&(q[E]={hash:E,counter:0}),S=q[E].hash+"_"+q[E].counter,i.geometryGroups[S]===void 0&&
|
|
|
+(i.geometryGroups[S]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:v}),x=m instanceof THREE.Face3?3:4,i.geometryGroups[S].vertices+x>65535&&(q[E].counter+=1,S=q[E].hash+"_"+q[E].counter,i.geometryGroups[S]===void 0&&(i.geometryGroups[S]={faces3:[],faces4:[],materialIndex:o,vertices:0,numMorphTargets:v})),m instanceof THREE.Face3?i.geometryGroups[S].faces3.push(k):i.geometryGroups[S].faces4.push(k),i.geometryGroups[S].vertices+=x;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=
|
|
|
+ea++,i.geometryGroupsList.push(i.geometryGroups[k])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=
|
|
|
+j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){m=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(m=k.numMorphTargets;l<m;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}O.info.memory.geometries++;o=e;x=o.geometry;l=i.faces3;E=i.faces4;k=l.length*3+E.length*4;m=l.length*1+E.length*2;E=l.length*3+E.length*4;l=b(o,i);S=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;q=l instanceof THREE.MeshBasicMaterial&&!l.envMap||
|
|
|
+l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;v=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(q)i.__normalArray=new Float32Array(k*3);if(x.hasTangents)i.__tangentArray=new Float32Array(k*4);if(v)i.__colorArray=new Float32Array(k*3);if(S){if(x.faceUvs.length>0||x.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*
|
|
|
+2)}if(o.geometry.skinWeights.length&&o.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(m*3);i.__lineArray=new Uint16Array(E*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];o=0;for(x=i.numMorphTargets;o<x;o++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=q===THREE.SmoothShading;i.__uvType=S;
|
|
|
+i.__vertexColorType=v;i.__normalType=q;i.__webglFaceCount=m*3;i.__webglLineCount=E*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];m=void 0;for(m in l.attributes){var o=l.attributes[m],x={},y;for(y in o)x[y]=o[y];if(!x.__webglInitialized||x.createUniqueBuffers)x.__webglInitialized=!0,E=1,x.type==="v2"?E=2:x.type==="v3"?E=3:x.type==="v4"?E=4:x.type==="c"&&(E=3),x.size=E,x.array=new Float32Array(k*E),x.buffer=j.createBuffer(),x.buffer.belongsToAttribute=
|
|
|
+m,o.needsUpdate=!0,x.__original=o;i.__webglCustomAttributesList.push(x)}}i.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),O.info.memory.geometries++,i=h,k=i.vertices.length,i.__vertexArray=new Float32Array(k*3),i.__colorArray=new Float32Array(k*
|
|
|
+3),i.__webglVertexCount=k,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),O.info.memory.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__webglLineCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer))i=h,
|
|
|
+i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),O.info.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups)i=h.geometryGroups[f],n(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?
|
|
|
+(h=e.geometry,n(g.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?g.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&g.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];g=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)u(g.__webglObjects,e);else if(e instanceof
|
|
|
+THREE.Sprite){g=g.__webglSprites;f=e;for(h=g.length-1;h>=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&u(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(y=a.__webglObjects[e].object,f=y.geometry,h=m=l=void 0,y instanceof THREE.Mesh){i=0;for(k=f.geometryGroupsList.length;i<k;i++)if(l=f.geometryGroupsList[i],h=b(y,l),m=h.attributes&&s(h),f.__dirtyVertices||f.__dirtyMorphTargets||
|
|
|
+f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||m)if(m=j.DYNAMIC_DRAW,o=!f.dynamic,l.__inittedArrays){var Y=E=x=void 0,t=void 0,B=void 0,ca=void 0,w=void 0,C=void 0,I=void 0,L=void 0,F=Y=ca=I=void 0,H=void 0,K=void 0,z=void 0,D=void 0,J=void 0,ja=t=void 0,M=t=I=void 0,$=void 0,G=t=z=K=H=D=z=K=H=D=z=K=H=D=z=K=H=w=void 0,X=void 0,P=ca=void 0,N=Y=void 0,Q=void 0,R=void 0,T=F=N=X=0,la=0,ia=G=Y=0,V=w=J=0,A=0,W=0,aa=void 0,Q=l.__vertexArray,ba=l.__uvArray,A=l.__uv2Array,
|
|
|
+P=l.__normalArray,B=l.__tangentArray,ja=l.__colorArray,M=l.__skinVertexAArray,$=l.__skinVertexBArray,C=l.__skinIndexArray,U=l.__skinWeightArray,ha=l.__morphTargetsArrays,S=l.__webglCustomAttributesList,r=void 0,r=l.__faceArray,W=l.__lineArray,ga=l.__needsSmoothNormals,I=l.__vertexColorType,L=l.__uvType,ca=l.__normalType,Z=y.geometry,aa=Z.__dirtyElements,oa=Z.__dirtyUvs,fa=Z.__dirtyNormals,ka=Z.__dirtyTangents,xa=Z.__dirtyColors,R=Z.__dirtyMorphTargets,sa=Z.vertices,q=l.faces3,v=l.faces4,ma=Z.faces,
|
|
|
+na=Z.faceVertexUvs[0],ya=Z.faceVertexUvs[1],ua=Z.skinVerticesA,va=Z.skinVerticesB,ra=Z.skinIndices,pa=Z.skinWeights,ta=Z.morphTargets;if(Z.__dirtyVertices){x=0;for(E=q.length;x<E;x++)t=ma[q[x]],H=sa[t.a].position,K=sa[t.b].position,z=sa[t.c].position,Q[N]=H.x,Q[N+1]=H.y,Q[N+2]=H.z,Q[N+3]=K.x,Q[N+4]=K.y,Q[N+5]=K.z,Q[N+6]=z.x,Q[N+7]=z.y,Q[N+8]=z.z,N+=9;x=0;for(E=v.length;x<E;x++)t=ma[v[x]],H=sa[t.a].position,K=sa[t.b].position,z=sa[t.c].position,D=sa[t.d].position,Q[N]=H.x,Q[N+1]=H.y,Q[N+2]=H.z,Q[N+
|
|
|
+3]=K.x,Q[N+4]=K.y,Q[N+5]=K.z,Q[N+6]=z.x,Q[N+7]=z.y,Q[N+8]=z.z,Q[N+9]=D.x,Q[N+10]=D.y,Q[N+11]=D.z,N+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Q,m)}if(R){x=0;for(E=q.length;x<E;x++){t=ma[q[x]];N=0;for(Q=ta.length;N<Q;N++)H=ta[N].vertices[t.a].position,K=ta[N].vertices[t.b].position,z=ta[N].vertices[t.c].position,R=ha[N],R[V]=H.x,R[V+1]=H.y,R[V+2]=H.z,R[V+3]=K.x,R[V+4]=K.y,R[V+5]=K.z,R[V+6]=z.x,R[V+7]=z.y,R[V+8]=z.z;V+=9}x=0;for(E=v.length;x<E;x++){t=ma[v[x]];
|
|
|
+N=0;for(Q=ta.length;N<Q;N++)H=ta[N].vertices[t.a].position,K=ta[N].vertices[t.b].position,z=ta[N].vertices[t.c].position,D=ta[N].vertices[t.d].position,R=ha[N],R[V]=H.x,R[V+1]=H.y,R[V+2]=H.z,R[V+3]=K.x,R[V+4]=K.y,R[V+5]=K.z,R[V+6]=z.x,R[V+7]=z.y,R[V+8]=z.z,R[V+9]=D.x,R[V+10]=D.y,R[V+11]=D.z;V+=12}N=0;for(Q=ta.length;N<Q;N++)j.bindBuffer(j.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[N]),j.bufferData(j.ARRAY_BUFFER,ha[N],m)}if(pa.length){x=0;for(E=q.length;x<E;x++)t=ma[q[x]],H=pa[t.a],K=pa[t.b],z=pa[t.c],
|
|
|
+U[w]=H.x,U[w+1]=H.y,U[w+2]=H.z,U[w+3]=H.w,U[w+4]=K.x,U[w+5]=K.y,U[w+6]=K.z,U[w+7]=K.w,U[w+8]=z.x,U[w+9]=z.y,U[w+10]=z.z,U[w+11]=z.w,H=ra[t.a],K=ra[t.b],z=ra[t.c],C[w]=H.x,C[w+1]=H.y,C[w+2]=H.z,C[w+3]=H.w,C[w+4]=K.x,C[w+5]=K.y,C[w+6]=K.z,C[w+7]=K.w,C[w+8]=z.x,C[w+9]=z.y,C[w+10]=z.z,C[w+11]=z.w,H=ua[t.a],K=ua[t.b],z=ua[t.c],M[w]=H.x,M[w+1]=H.y,M[w+2]=H.z,M[w+3]=1,M[w+4]=K.x,M[w+5]=K.y,M[w+6]=K.z,M[w+7]=1,M[w+8]=z.x,M[w+9]=z.y,M[w+10]=z.z,M[w+11]=1,H=va[t.a],K=va[t.b],z=va[t.c],$[w]=H.x,$[w+1]=H.y,$[w+
|
|
|
+2]=H.z,$[w+3]=1,$[w+4]=K.x,$[w+5]=K.y,$[w+6]=K.z,$[w+7]=1,$[w+8]=z.x,$[w+9]=z.y,$[w+10]=z.z,$[w+11]=1,w+=12;x=0;for(E=v.length;x<E;x++)t=ma[v[x]],H=pa[t.a],K=pa[t.b],z=pa[t.c],D=pa[t.d],U[w]=H.x,U[w+1]=H.y,U[w+2]=H.z,U[w+3]=H.w,U[w+4]=K.x,U[w+5]=K.y,U[w+6]=K.z,U[w+7]=K.w,U[w+8]=z.x,U[w+9]=z.y,U[w+10]=z.z,U[w+11]=z.w,U[w+12]=D.x,U[w+13]=D.y,U[w+14]=D.z,U[w+15]=D.w,H=ra[t.a],K=ra[t.b],z=ra[t.c],D=ra[t.d],C[w]=H.x,C[w+1]=H.y,C[w+2]=H.z,C[w+3]=H.w,C[w+4]=K.x,C[w+5]=K.y,C[w+6]=K.z,C[w+7]=K.w,C[w+8]=z.x,
|
|
|
+C[w+9]=z.y,C[w+10]=z.z,C[w+11]=z.w,C[w+12]=D.x,C[w+13]=D.y,C[w+14]=D.z,C[w+15]=D.w,H=ua[t.a],K=ua[t.b],z=ua[t.c],D=ua[t.d],M[w]=H.x,M[w+1]=H.y,M[w+2]=H.z,M[w+3]=1,M[w+4]=K.x,M[w+5]=K.y,M[w+6]=K.z,M[w+7]=1,M[w+8]=z.x,M[w+9]=z.y,M[w+10]=z.z,M[w+11]=1,M[w+12]=D.x,M[w+13]=D.y,M[w+14]=D.z,M[w+15]=1,H=va[t.a],K=va[t.b],z=va[t.c],t=va[t.d],$[w]=H.x,$[w+1]=H.y,$[w+2]=H.z,$[w+3]=1,$[w+4]=K.x,$[w+5]=K.y,$[w+6]=K.z,$[w+7]=1,$[w+8]=z.x,$[w+9]=z.y,$[w+10]=z.z,$[w+11]=1,$[w+12]=t.x,$[w+13]=t.y,$[w+14]=t.z,$[w+
|
|
|
+15]=1,w+=16;w>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,M,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,$,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,C,m),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,U,m))}if(xa&&I){x=0;for(E=q.length;x<E;x++)t=ma[q[x]],w=t.vertexColors,C=t.color,w.length===3&&I===THREE.VertexColors?(t=w[0],M=w[1],
|
|
|
+$=w[2]):$=M=t=C,ja[J]=t.r,ja[J+1]=t.g,ja[J+2]=t.b,ja[J+3]=M.r,ja[J+4]=M.g,ja[J+5]=M.b,ja[J+6]=$.r,ja[J+7]=$.g,ja[J+8]=$.b,J+=9;x=0;for(E=v.length;x<E;x++)t=ma[v[x]],w=t.vertexColors,C=t.color,w.length===4&&I===THREE.VertexColors?(t=w[0],M=w[1],$=w[2],w=w[3]):w=$=M=t=C,ja[J]=t.r,ja[J+1]=t.g,ja[J+2]=t.b,ja[J+3]=M.r,ja[J+4]=M.g,ja[J+5]=M.b,ja[J+6]=$.r,ja[J+7]=$.g,ja[J+8]=$.b,ja[J+9]=w.r,ja[J+10]=w.g,ja[J+11]=w.b,J+=12;J>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
+ja,m))}if(ka&&Z.hasTangents){x=0;for(E=q.length;x<E;x++)t=ma[q[x]],I=t.vertexTangents,J=I[0],t=I[1],ja=I[2],B[G]=J.x,B[G+1]=J.y,B[G+2]=J.z,B[G+3]=J.w,B[G+4]=t.x,B[G+5]=t.y,B[G+6]=t.z,B[G+7]=t.w,B[G+8]=ja.x,B[G+9]=ja.y,B[G+10]=ja.z,B[G+11]=ja.w,G+=12;x=0;for(E=v.length;x<E;x++)t=ma[v[x]],I=t.vertexTangents,J=I[0],t=I[1],ja=I[2],I=I[3],B[G]=J.x,B[G+1]=J.y,B[G+2]=J.z,B[G+3]=J.w,B[G+4]=t.x,B[G+5]=t.y,B[G+6]=t.z,B[G+7]=t.w,B[G+8]=ja.x,B[G+9]=ja.y,B[G+10]=ja.z,B[G+11]=ja.w,B[G+12]=I.x,B[G+13]=I.y,B[G+14]=
|
|
|
+I.z,B[G+15]=I.w,G+=16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,B,m)}if(fa&&ca){x=0;for(E=q.length;x<E;x++)if(t=ma[q[x]],B=t.vertexNormals,ca=t.normal,B.length===3&&ga)for(G=0;G<3;G++)ca=B[G],P[Y]=ca.x,P[Y+1]=ca.y,P[Y+2]=ca.z,Y+=3;else for(G=0;G<3;G++)P[Y]=ca.x,P[Y+1]=ca.y,P[Y+2]=ca.z,Y+=3;x=0;for(E=v.length;x<E;x++)if(t=ma[v[x]],B=t.vertexNormals,ca=t.normal,B.length===4&&ga)for(G=0;G<4;G++)ca=B[G],P[Y]=ca.x,P[Y+1]=ca.y,P[Y+2]=ca.z,Y+=3;else for(G=0;G<4;G++)P[Y]=
|
|
|
+ca.x,P[Y+1]=ca.y,P[Y+2]=ca.z,Y+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,P,m)}if(oa&&na&&L){x=0;for(E=q.length;x<E;x++)if(Y=q[x],Y=na[Y],Y!==void 0)for(G=0;G<3;G++)P=Y[G],ba[F]=P.u,ba[F+1]=P.v,F+=2;x=0;for(E=v.length;x<E;x++)if(Y=v[x],Y=na[Y],Y!==void 0)for(G=0;G<4;G++)P=Y[G],ba[F]=P.u,ba[F+1]=P.v,F+=2;F>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,ba,m))}if(oa&&ya&&L){x=0;for(E=q.length;x<E;x++)if(Y=q[x],F=ya[Y],F!==void 0)for(G=
|
|
|
+0;G<3;G++)Y=F[G],A[T]=Y.u,A[T+1]=Y.v,T+=2;x=0;for(E=v.length;x<E;x++)if(Y=v[x],F=ya[Y],F!==void 0)for(G=0;G<4;G++)Y=F[G],A[T]=Y.u,A[T+1]=Y.v,T+=2;T>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,A,m))}if(aa){x=0;for(E=q.length;x<E;x++)r[la]=X,r[la+1]=X+1,r[la+2]=X+2,la+=3,W[ia]=X,W[ia+1]=X+1,W[ia+2]=X,W[ia+3]=X+2,W[ia+4]=X+1,W[ia+5]=X+2,ia+=6,X+=3;x=0;for(E=v.length;x<E;x++)r[la]=X,r[la+1]=X+1,r[la+2]=X+3,r[la+3]=X+1,r[la+4]=X+2,r[la+5]=X+3,la+=6,W[ia]=X,W[ia+1]=X+
|
|
|
+1,W[ia+2]=X,W[ia+3]=X+3,W[ia+4]=X+1,W[ia+5]=X+2,W[ia+6]=X+2,W[ia+7]=X+3,ia+=8,X+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,r,m);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,W,m)}if(S){G=0;for(X=S.length;G<X;G++)if(r=S[G],r.__original.needsUpdate){W=A=0;if(r.size===1)if(r.boundTo===void 0||r.boundTo==="vertices"){x=0;for(E=q.length;x<E;x++)t=ma[q[x]],r.array[A]=r.value[t.a],r.array[A+1]=r.value[t.b],
|
|
|
+r.array[A+2]=r.value[t.c],A+=3;x=0;for(E=v.length;x<E;x++)t=ma[v[x]],r.array[A]=r.value[t.a],r.array[A+1]=r.value[t.b],r.array[A+2]=r.value[t.c],r.array[A+3]=r.value[t.d],A+=4}else if(r.boundTo==="faces"){x=0;for(E=q.length;x<E;x++)aa=r.value[W],r.array[A]=aa,r.array[A+1]=aa,r.array[A+2]=aa,A+=3,W+=1;x=0;for(E=v.length;x<E;x++)aa=r.value[W],r.array[A]=aa,r.array[A+1]=aa,r.array[A+2]=aa,r.array[A+3]=aa,A+=4,W+=1}else{if(r.boundTo==="faceVertices"){x=0;for(E=q.length;x<E;x++)r.array[A]=r.value[W],r.array[A+
|
|
|
+1]=r.value[W+1],r.array[A+2]=r.value[W+2],A+=3,W+=3;x=0;for(E=v.length;x<E;x++)r.array[A]=r.value[W],r.array[A+1]=r.value[W+1],r.array[A+2]=r.value[W+2],r.array[A+3]=r.value[W+3],A+=4,W+=4}}else if(r.size===2)if(r.boundTo===void 0||r.boundTo==="vertices"){x=0;for(E=q.length;x<E;x++)t=ma[q[x]],H=r.value[t.a],K=r.value[t.b],z=r.value[t.c],r.array[A]=H.x,r.array[A+1]=H.y,r.array[A+2]=K.x,r.array[A+3]=K.y,r.array[A+4]=z.x,r.array[A+5]=z.y,A+=6;x=0;for(E=v.length;x<E;x++)t=ma[v[x]],H=r.value[t.a],K=r.value[t.b],
|
|
|
+z=r.value[t.c],D=r.value[t.d],r.array[A]=H.x,r.array[A+1]=H.y,r.array[A+2]=K.x,r.array[A+3]=K.y,r.array[A+4]=z.x,r.array[A+5]=z.y,r.array[A+6]=D.x,r.array[A+7]=D.y,A+=8}else if(r.boundTo==="faces"){x=0;for(E=q.length;x<E;x++)z=K=H=aa=r.value[W],r.array[A]=H.x,r.array[A+1]=H.y,r.array[A+2]=K.x,r.array[A+3]=K.y,r.array[A+4]=z.x,r.array[A+5]=z.y,A+=6,W+=1;x=0;for(E=v.length;x<E;x++)D=z=K=H=aa=r.value[W],r.array[A]=H.x,r.array[A+1]=H.y,r.array[A+2]=K.x,r.array[A+3]=K.y,r.array[A+4]=z.x,r.array[A+5]=z.y,
|
|
|
+r.array[A+6]=D.x,r.array[A+7]=D.y,A+=8,W+=1}else{if(r.boundTo==="faceVertices"){x=0;for(E=q.length;x<E;x++)H=r.value[W],K=r.value[W+1],z=r.value[W+2],r.array[A]=H.x,r.array[A+1]=H.y,r.array[A+2]=K.x,r.array[A+3]=K.y,r.array[A+4]=z.x,r.array[A+5]=z.y,A+=6,W+=3;x=0;for(E=v.length;x<E;x++)H=r.value[W],K=r.value[W+1],z=r.value[W+2],D=r.value[W+3],r.array[A]=H.x,r.array[A+1]=H.y,r.array[A+2]=K.x,r.array[A+3]=K.y,r.array[A+4]=z.x,r.array[A+5]=z.y,r.array[A+6]=D.x,r.array[A+7]=D.y,A+=8,W+=4}}else if(r.size===
|
|
|
+3)if(T=r.type==="c"?["r","g","b"]:["x","y","z"],r.boundTo===void 0||r.boundTo==="vertices"){x=0;for(E=q.length;x<E;x++)t=ma[q[x]],H=r.value[t.a],K=r.value[t.b],z=r.value[t.c],r.array[A]=H[T[0]],r.array[A+1]=H[T[1]],r.array[A+2]=H[T[2]],r.array[A+3]=K[T[0]],r.array[A+4]=K[T[1]],r.array[A+5]=K[T[2]],r.array[A+6]=z[T[0]],r.array[A+7]=z[T[1]],r.array[A+8]=z[T[2]],A+=9;x=0;for(E=v.length;x<E;x++)t=ma[v[x]],H=r.value[t.a],K=r.value[t.b],z=r.value[t.c],D=r.value[t.d],r.array[A]=H[T[0]],r.array[A+1]=H[T[1]],
|
|
|
+r.array[A+2]=H[T[2]],r.array[A+3]=K[T[0]],r.array[A+4]=K[T[1]],r.array[A+5]=K[T[2]],r.array[A+6]=z[T[0]],r.array[A+7]=z[T[1]],r.array[A+8]=z[T[2]],r.array[A+9]=D[T[0]],r.array[A+10]=D[T[1]],r.array[A+11]=D[T[2]],A+=12,W+=1}else if(r.boundTo==="faces"){x=0;for(E=q.length;x<E;x++)z=K=H=aa=r.value[W],r.array[A]=H[T[0]],r.array[A+1]=H[T[1]],r.array[A+2]=H[T[2]],r.array[A+3]=K[T[0]],r.array[A+4]=K[T[1]],r.array[A+5]=K[T[2]],r.array[A+6]=z[T[0]],r.array[A+7]=z[T[1]],r.array[A+8]=z[T[2]],A+=9,W+=1;x=0;for(E=
|
|
|
+v.length;x<E;x++)D=z=K=H=aa=r.value[W],r.array[A]=H[T[0]],r.array[A+1]=H[T[1]],r.array[A+2]=H[T[2]],r.array[A+3]=K[T[0]],r.array[A+4]=K[T[1]],r.array[A+5]=K[T[2]],r.array[A+6]=z[T[0]],r.array[A+7]=z[T[1]],r.array[A+8]=z[T[2]],r.array[A+9]=D[T[0]],r.array[A+10]=D[T[1]],r.array[A+11]=D[T[2]],A+=12,W+=1}else{if(r.boundTo==="faceVertices"){x=0;for(E=q.length;x<E;x++)H=r.value[W],K=r.value[W+1],z=r.value[W+2],r.array[A]=H[T[0]],r.array[A+1]=H[T[1]],r.array[A+2]=H[T[2]],r.array[A+3]=K[T[0]],r.array[A+4]=
|
|
|
+K[T[1]],r.array[A+5]=K[T[2]],r.array[A+6]=z[T[0]],r.array[A+7]=z[T[1]],r.array[A+8]=z[T[2]],A+=9,W+=3;x=0;for(E=v.length;x<E;x++)H=r.value[W],K=r.value[W+1],z=r.value[W+2],D=r.value[W+3],r.array[A]=H[T[0]],r.array[A+1]=H[T[1]],r.array[A+2]=H[T[2]],r.array[A+3]=K[T[0]],r.array[A+4]=K[T[1]],r.array[A+5]=K[T[2]],r.array[A+6]=z[T[0]],r.array[A+7]=z[T[1]],r.array[A+8]=z[T[2]],r.array[A+9]=D[T[0]],r.array[A+10]=D[T[1]],r.array[A+11]=D[T[2]],A+=12,W+=4}}else if(r.size===4)if(r.boundTo===void 0||r.boundTo===
|
|
|
+"vertices"){x=0;for(E=q.length;x<E;x++)t=ma[q[x]],H=r.value[t.a],K=r.value[t.b],z=r.value[t.c],r.array[A]=H.x,r.array[A+1]=H.y,r.array[A+2]=H.z,r.array[A+3]=H.w,r.array[A+4]=K.x,r.array[A+5]=K.y,r.array[A+6]=K.z,r.array[A+7]=K.w,r.array[A+8]=z.x,r.array[A+9]=z.y,r.array[A+10]=z.z,r.array[A+11]=z.w,A+=12;x=0;for(E=v.length;x<E;x++)t=ma[v[x]],H=r.value[t.a],K=r.value[t.b],z=r.value[t.c],D=r.value[t.d],r.array[A]=H.x,r.array[A+1]=H.y,r.array[A+2]=H.z,r.array[A+3]=H.w,r.array[A+4]=K.x,r.array[A+5]=K.y,
|
|
|
+r.array[A+6]=K.z,r.array[A+7]=K.w,r.array[A+8]=z.x,r.array[A+9]=z.y,r.array[A+10]=z.z,r.array[A+11]=z.w,r.array[A+12]=D.x,r.array[A+13]=D.y,r.array[A+14]=D.z,r.array[A+15]=D.w,A+=16}else if(r.boundTo==="faces"){x=0;for(E=q.length;x<E;x++)z=K=H=aa=r.value[W],r.array[A]=H.x,r.array[A+1]=H.y,r.array[A+2]=H.z,r.array[A+3]=H.w,r.array[A+4]=K.x,r.array[A+5]=K.y,r.array[A+6]=K.z,r.array[A+7]=K.w,r.array[A+8]=z.x,r.array[A+9]=z.y,r.array[A+10]=z.z,r.array[A+11]=z.w,A+=12,W+=1;x=0;for(E=v.length;x<E;x++)D=
|
|
|
+z=K=H=aa=r.value[W],r.array[A]=H.x,r.array[A+1]=H.y,r.array[A+2]=H.z,r.array[A+3]=H.w,r.array[A+4]=K.x,r.array[A+5]=K.y,r.array[A+6]=K.z,r.array[A+7]=K.w,r.array[A+8]=z.x,r.array[A+9]=z.y,r.array[A+10]=z.z,r.array[A+11]=z.w,r.array[A+12]=D.x,r.array[A+13]=D.y,r.array[A+14]=D.z,r.array[A+15]=D.w,A+=16,W+=1}else if(r.boundTo==="faceVertices"){x=0;for(E=q.length;x<E;x++)H=r.value[W],K=r.value[W+1],z=r.value[W+2],r.array[A]=H.x,r.array[A+1]=H.y,r.array[A+2]=H.z,r.array[A+3]=H.w,r.array[A+4]=K.x,r.array[A+
|
|
|
+5]=K.y,r.array[A+6]=K.z,r.array[A+7]=K.w,r.array[A+8]=z.x,r.array[A+9]=z.y,r.array[A+10]=z.z,r.array[A+11]=z.w,A+=12,W+=3;x=0;for(E=v.length;x<E;x++)H=r.value[W],K=r.value[W+1],z=r.value[W+2],D=r.value[W+3],r.array[A]=H.x,r.array[A+1]=H.y,r.array[A+2]=H.z,r.array[A+3]=H.w,r.array[A+4]=K.x,r.array[A+5]=K.y,r.array[A+6]=K.z,r.array[A+7]=K.w,r.array[A+8]=z.x,r.array[A+9]=z.y,r.array[A+10]=z.z,r.array[A+11]=z.w,r.array[A+12]=D.x,r.array[A+13]=D.y,r.array[A+14]=D.z,r.array[A+15]=D.w,A+=16,W+=4}j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+r.buffer);j.bufferData(j.ARRAY_BUFFER,r.array,m)}}o&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyColors=!1;f.__dirtyTangents=
|
|
|
+!1;h.attributes&&p(h)}else if(y instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;y=j.DYNAMIC_DRAW;x=i=x=o=o=void 0;E=h.vertices;k=h.colors;S=E.length;l=k.length;q=h.__vertexArray;m=h.__colorArray;v=h.__dirtyColors;if(h.__dirtyVertices){for(o=0;o<S;o++)x=E[o].position,i=o*3,q[i]=x.x,q[i+1]=x.y,q[i+2]=x.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,q,y)}if(v){for(o=0;o<l;o++)x=k[o],i=o*3,m[i]=x.r,m[i+1]=x.g,m[i+2]=x.b;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,m,y)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(y instanceof THREE.Line){h=b(y,l);m=h.attributes&&s(h);if(f.__dirtyVertices||f.__dirtyColors||m){y=f;i=j.DYNAMIC_DRAW;S=k=X=E=ma=void 0;E=y.vertices;l=y.colors;S=E.length;m=l.length;q=y.__vertexArray;o=y.__colorArray;v=y.__dirtyColors;x=y.__webglCustomAttributesList;F=ia=la=T=X=ma=void 0;if(y.__dirtyVertices){for(ma=0;ma<S;ma++)X=E[ma].position,k=ma*3,q[k]=X.x,q[k+1]=X.y,q[k+2]=X.z;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+y.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,q,i)}if(v){for(E=0;E<m;E++)S=l[E],k=E*3,o[k]=S.r,o[k+1]=S.g,o[k+2]=S.b;j.bindBuffer(j.ARRAY_BUFFER,y.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,o,i)}if(x){ma=0;for(X=x.length;ma<X;ma++)if(F=x[ma],F.needsUpdate&&(F.boundTo===void 0||F.boundTo==="vertices")){k=0;la=F.value.length;if(F.size===1)for(T=0;T<la;T++)F.array[T]=F.value[T];else if(F.size===2)for(T=0;T<la;T++)ia=F.value[T],F.array[k]=ia.x,F.array[k+1]=ia.y,k+=2;else if(F.size===3)if(F.type===
|
|
|
+"c")for(T=0;T<la;T++)ia=F.value[T],F.array[k]=ia.r,F.array[k+1]=ia.g,F.array[k+2]=ia.b,k+=3;else for(T=0;T<la;T++)ia=F.value[T],F.array[k]=ia.x,F.array[k+1]=ia.y,F.array[k+2]=ia.z,k+=3;else if(F.size===4)for(T=0;T<la;T++)ia=F.value[T],F.array[k]=ia.x,F.array[k+1]=ia.y,F.array[k+2]=ia.z,F.array[k+3]=ia.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,F.buffer);j.bufferData(j.ARRAY_BUFFER,F.array,i)}}}f.__dirtyVertices=!1;f.__dirtyColors=!1;h.attributes&&p(h)}else if(y instanceof THREE.ParticleSystem)h=b(y,l),m=
|
|
|
+h.attributes&&s(h),(f.__dirtyVertices||f.__dirtyColors||y.sortParticles||m)&&d(f,j.DYNAMIC_DRAW,y),f.__dirtyVertices=!1,f.__dirtyColors=!1,h.attributes&&p(h)};this.initMaterial=function(a,b,c,d){var e,g,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof
|
|
|
+THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var k,l,n;k=n=i=0;for(l=b.length;k<l;k++)f=b[k],f instanceof THREE.SpotLight&&n++,f instanceof THREE.DirectionalLight&&n++,f instanceof THREE.PointLight&&i++;i+n<=Q?k=n:(k=Math.ceil(Q*n/(i+n)),i=Q-k);f={directional:k,point:i};i=n=0;for(k=b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&n++;
|
|
|
+var x=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)x=d.bones.length;var m;a:{k=a.fragmentShader;l=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,maxBones:x,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,
|
|
|
+shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:n,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},o,d=[];h?d.push(h):(d.push(k),d.push(l));for(o in c)d.push(o),d.push(c[o]);h=d.join();o=0;for(d=ha.length;o<d;o++)if(ha[o].code===h){m=ha[o].program;break a}o=j.createProgram();d=[ta?"#define VERTEX_TEXTURES":"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+
|
|
|
+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":
|
|
|
+"","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 vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+f=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",O.gammaInput?"#define GAMMA_INPUT":"",O.gammaOutput?"#define GAMMA_OUTPUT":"",O.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
|
|
|
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(o,J("fragment",f+k));j.attachShader(o,
|
|
|
+J("vertex",d+l));j.linkProgram(o);j.getProgramParameter(o,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(o,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");o.uniforms={};o.attributes={};var p,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(p in i)d.push(p);p=d;d=0;for(i=p.length;d<i;d++)k=p[d],o.uniforms[k]=j.getUniformLocation(o,
|
|
|
+k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(p=0;p<c.maxMorphTargets;p++)d.push("morphTarget"+p);for(m in b)d.push(m);m=d;p=0;for(b=m.length;p<b;p++)c=m[p],o.attributes[c]=j.getAttribLocation(o,c);o.id=ha.length;ha.push({program:o,code:h});O.info.memory.programs=ha.length;m=o}a.program=m;m=a.program.attributes;m.position>=0&&j.enableVertexAttribArray(m.position);m.color>=0&&j.enableVertexAttribArray(m.color);m.normal>=0&&j.enableVertexAttribArray(m.normal);
|
|
|
+m.tangent>=0&&j.enableVertexAttribArray(m.tangent);a.skinning&&m.skinVertexA>=0&&m.skinVertexB>=0&&m.skinIndex>=0&&m.skinWeight>=0&&(j.enableVertexAttribArray(m.skinVertexA),j.enableVertexAttribArray(m.skinVertexB),j.enableVertexAttribArray(m.skinIndex),j.enableVertexAttribArray(m.skinWeight));if(a.attributes)for(g in a.attributes)m[g]!==void 0&&m[g]>=0&&j.enableVertexAttribArray(m[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)p="morphTarget"+g,m[p]>=0&&(j.enableVertexAttribArray(m[p]),
|
|
|
+a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)}};
|
|
|
THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=b.depthBuffer!==void 0?b.depthBuffer:!0;this.stencilBuffer=b.stencilBuffer!==void 0?b.stencilBuffer:!0};
|
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,c,b){THREE.WebGLRenderTarget.call(this,a,c,b);this.activeCubeFace=0};
|
|
@@ -355,19 +355,19 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
|
|
|
THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.material=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.material=null};
|
|
|
THREE.ColorUtils={adjustHSV:function(a,c,b,d){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(a,g);g.h=THREE.Math.clamp(g.h+c,0,1);g.s=THREE.Math.clamp(g.s+b,0,1);g.v=THREE.Math.clamp(g.v+d,0,1);a.setHSV(g.h,g.s,g.v)},rgbToHsv:function(a,c){var b=a.r,d=a.g,g=a.b,e=Math.max(Math.max(b,d),g),f=Math.min(Math.min(b,d),g);if(f===e)f=b=0;else{var h=e-f,f=h/e,b=b===e?(d-g)/h:d===e?2+(g-b)/h:4+(b-d)/h;b/=6;b<0&&(b+=1);b>1&&(b-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=b;c.s=f;c.v=e;return c}};
|
|
|
THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
-THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,e=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,h=e.vertices,i=a.faces,l=e.faces,m=a.faceVertexUvs[0],k=e.faceVertexUvs[0],o={},p=0;p<a.materials.length;p++)o[a.materials[p].id]=p;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var p=0,q=h.length;p<q;p++){var n=new THREE.Vertex(h[p].position.clone());b&&b.multiplyVector3(n.position);f.push(n)}p=
|
|
|
-0;for(q=l.length;p<q;p++){var f=l[p],t,u,v=f.vertexNormals,r=f.vertexColors;f instanceof THREE.Face3?t=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(t=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));t.normal.copy(f.normal);d&&d.multiplyVector3(t.normal);h=0;for(n=v.length;h<n;h++)u=v[h].clone(),d&&d.multiplyVector3(u),t.vertexNormals.push(u);t.color.copy(f.color);h=0;for(n=r.length;h<n;h++)u=r[h],t.vertexColors.push(u.clone());if(f.materialIndex!==void 0){h=e.materials[f.materialIndex];
|
|
|
-n=o[h.id];if(n===void 0)n=a.materials.length,a.materials.push(h);t.materialIndex=n}t.centroid.copy(f.centroid);b&&b.multiplyVector3(t.centroid);i.push(t)}p=0;for(q=k.length;p<q;p++){b=k[p];d=[];h=0;for(n=b.length;h<n;h++)d.push(new THREE.UV(b[h].u,b[h].v));m.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,e=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var f=new THREE.Vertex(d[a].position.clone());c.vertices.push(f)}a=0;
|
|
|
-for(b=g.length;a<b;a++){var h=g[a],i,l,m=h.vertexNormals,k=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=m.length;d<f;d++)l=m[d],i.vertexNormals.push(l.clone());i.color.copy(h.color);d=0;for(f=k.length;d<f;d++)l=k[d],i.vertexColors.push(l.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=e.length;a<b;a++){g=e[a];i=[];d=0;for(f=g.length;d<
|
|
|
+THREE.GeometryUtils={merge:function(a,c){for(var b,d,g=a.vertices.length,e=c instanceof THREE.Mesh?c.geometry:c,f=a.vertices,h=e.vertices,i=a.faces,k=e.faces,l=a.faceVertexUvs[0],m=e.faceVertexUvs[0],o={},n=0;n<a.materials.length;n++)o[a.materials[n].id]=n;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var n=0,s=h.length;n<s;n++){var p=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(p.position);f.push(p)}n=
|
|
|
+0;for(s=k.length;n<s;n++){var f=k[n],u,v,y=f.vertexNormals,q=f.vertexColors;f instanceof THREE.Face3?u=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(u=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));u.normal.copy(f.normal);d&&d.multiplyVector3(u.normal);h=0;for(p=y.length;h<p;h++)v=y[h].clone(),d&&d.multiplyVector3(v),u.vertexNormals.push(v);u.color.copy(f.color);h=0;for(p=q.length;h<p;h++)v=q[h],u.vertexColors.push(v.clone());if(f.materialIndex!==void 0){h=e.materials[f.materialIndex];
|
|
|
+p=o[h.id];if(p===void 0)p=a.materials.length,a.materials.push(h);u.materialIndex=p}u.centroid.copy(f.centroid);b&&b.multiplyVector3(u.centroid);i.push(u)}n=0;for(s=m.length;n<s;n++){b=m[n];d=[];h=0;for(p=b.length;h<p;h++)d.push(new THREE.UV(b[h].u,b[h].v));l.push(d)}},clone:function(a){var c=new THREE.Geometry,b,d=a.vertices,g=a.faces,e=a.faceVertexUvs[0];if(a.materials)c.materials=a.materials.slice();a=0;for(b=d.length;a<b;a++){var f=new THREE.Vertex(d[a].position.clone());c.vertices.push(f)}a=0;
|
|
|
+for(b=g.length;a<b;a++){var h=g[a],i,k,l=h.vertexNormals,m=h.vertexColors;h instanceof THREE.Face3?i=new THREE.Face3(h.a,h.b,h.c):h instanceof THREE.Face4&&(i=new THREE.Face4(h.a,h.b,h.c,h.d));i.normal.copy(h.normal);d=0;for(f=l.length;d<f;d++)k=l[d],i.vertexNormals.push(k.clone());i.color.copy(h.color);d=0;for(f=m.length;d<f;d++)k=m[d],i.vertexColors.push(k.clone());i.materialIndex=h.materialIndex;i.centroid.copy(h.centroid);c.faces.push(i)}a=0;for(b=e.length;a<b;a++){g=e[a];i=[];d=0;for(f=g.length;d<
|
|
|
f;d++)i.push(new THREE.UV(g[d].u,g[d].v));c.faceVertexUvs[0].push(i)}return c},randomPointInTriangle:function(a,c,b){var d,g,e,f=new THREE.Vector3,h=THREE.GeometryUtils.__v1;d=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();d+g>1&&(d=1-d,g=1-g);e=1-d-g;f.copy(a);f.multiplyScalar(d);h.copy(c);h.multiplyScalar(g);f.addSelf(h);h.copy(b);h.multiplyScalar(e);f.addSelf(h);return f},randomPointInFace:function(a,c,b){var d,g,e;if(a instanceof THREE.Face3)return d=c.vertices[a.a].position,g=c.vertices[a.b].position,
|
|
|
e=c.vertices[a.c].position,THREE.GeometryUtils.randomPointInTriangle(d,g,e);else if(a instanceof THREE.Face4){d=c.vertices[a.a].position;g=c.vertices[a.b].position;e=c.vertices[a.c].position;var c=c.vertices[a.d].position,f;b?a._area1&&a._area2?(b=a._area1,f=a._area2):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c),a._area1=b,a._area2=f):(b=THREE.GeometryUtils.triangleArea(d,g,c),f=THREE.GeometryUtils.triangleArea(g,e,c));return THREE.GeometryUtils.random()*(b+
|
|
|
-f)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,e,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return l[e]>a?b(c,e-1):l[e]<a?b(e+1,d):e}return b(0,l.length-1)}var d,g,e=a.faces,f=a.vertices,h=e.length,i=0,l=[],m,k,o,p;for(g=0;g<h;g++){d=e[g];if(d instanceof THREE.Face3)m=f[d.a].position,k=f[d.b].position,o=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(m,k,o);else if(d instanceof
|
|
|
-THREE.Face4)m=f[d.a].position,k=f[d.b].position,o=f[d.c].position,p=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(m,k,p),d._area2=THREE.GeometryUtils.triangleArea(k,o,p),d._area=d._area1+d._area2;i+=d._area;l[g]=i}d=[];f={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(e[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
|
|
|
+f)<b?THREE.GeometryUtils.randomPointInTriangle(d,g,c):THREE.GeometryUtils.randomPointInTriangle(g,e,c)}},randomPointsInGeometry:function(a,c){function b(a){function b(c,d){if(d<c)return c;var e=c+Math.floor((d-c)/2);return k[e]>a?b(c,e-1):k[e]<a?b(e+1,d):e}return b(0,k.length-1)}var d,g,e=a.faces,f=a.vertices,h=e.length,i=0,k=[],l,m,o,n;for(g=0;g<h;g++){d=e[g];if(d instanceof THREE.Face3)l=f[d.a].position,m=f[d.b].position,o=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(l,m,o);else if(d instanceof
|
|
|
+THREE.Face4)l=f[d.a].position,m=f[d.b].position,o=f[d.c].position,n=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(l,m,n),d._area2=THREE.GeometryUtils.triangleArea(m,o,n),d._area=d._area1+d._area2;i+=d._area;k[g]=i}d=[];f={};for(g=0;g<c;g++)h=THREE.GeometryUtils.random()*i,h=b(h),d[g]=THREE.GeometryUtils.randomPointInFace(e[h],a,!0),f[h]?f[h]+=1:f[h]=1;return d},triangleArea:function(a,c,b){var d,g=THREE.GeometryUtils.__v1;g.sub(a,c);d=g.length();g.sub(a,b);a=g.length();g.sub(c,b);b=g.length();
|
|
|
c=0.5*(d+a+b);return Math.sqrt(c*(c-d)*(c-a)*(c-b))},center:function(a){a.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*(a.boundingBox.x[1]+a.boundingBox.x[0]),-0.5*(a.boundingBox.y[1]+a.boundingBox.y[0]),-0.5*(a.boundingBox.z[1]+a.boundingBox.z[0]));a.applyMatrix(c);a.computeBoundingBox()}};THREE.GeometryUtils.random=THREE.Math.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
THREE.ImageUtils={loadTexture:function(a,c,b){var d=new Image,g=new THREE.Texture(d,c);d.onload=function(){g.needsUpdate=!0;b&&b(this)};d.crossOrigin="";d.src=a;return g},loadTextureCube:function(a,c,b){var d,g=[],e=new THREE.Texture(g,c),c=g.loadCount=0;for(d=a.length;c<d;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount===6)e.needsUpdate=!0;b&&b(this)},g[c].crossOrigin="",g[c].src=a[c];return e},getNormalMap:function(a,c){var b=function(a){var b=Math.sqrt(a[0]*a[0]+a[1]*a[1]+
|
|
|
-a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,e=document.createElement("canvas");e.width=d;e.height=g;var f=e.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,g).data,i=f.createImageData(d,g),l=i.data,m=0;m<d;m++)for(var k=1;k<g;k++){var o=k-1<0?g-1:k-1,p=(k+1)%g,q=m-1<0?d-1:m-1,n=(m+1)%d,t=[],u=[0,0,h[(k*d+m)*4]/255*c];t.push([-1,0,h[(k*d+q)*4]/255*c]);t.push([-1,-1,h[(o*d+q)*4]/255*c]);t.push([0,-1,h[(o*d+m)*4]/255*c]);t.push([1,-1,h[(o*d+n)*4]/255*c]);
|
|
|
-t.push([1,0,h[(k*d+n)*4]/255*c]);t.push([1,1,h[(p*d+n)*4]/255*c]);t.push([0,1,h[(p*d+m)*4]/255*c]);t.push([-1,1,h[(p*d+q)*4]/255*c]);o=[];q=t.length;for(p=0;p<q;p++){var n=t[p],v=t[(p+1)%q],n=[n[0]-u[0],n[1]-u[1],n[2]-u[2]],v=[v[0]-u[0],v[1]-u[1],v[2]-u[2]];o.push(b([n[1]*v[2]-n[2]*v[1],n[2]*v[0]-n[0]*v[2],n[0]*v[1]-n[1]*v[0]]))}t=[0,0,0];for(p=0;p<o.length;p++)t[0]+=o[p][0],t[1]+=o[p][1],t[2]+=o[p][2];t[0]/=o.length;t[1]/=o.length;t[2]/=o.length;u=(k*d+m)*4;l[u]=(t[0]+1)/2*255|0;l[u+1]=(t[1]+0.5)*
|
|
|
-255|0;l[u+2]=t[2]*255|0;l[u+3]=255}f.putImageData(i,0,0);return e}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var e=new THREE.Mesh(a,c[b]);g.add(e)}return g}};
|
|
|
+a[2]*a[2]);return[a[0]/b,a[1]/b,a[2]/b]};c|=1;var d=a.width,g=a.height,e=document.createElement("canvas");e.width=d;e.height=g;var f=e.getContext("2d");f.drawImage(a,0,0);for(var h=f.getImageData(0,0,d,g).data,i=f.createImageData(d,g),k=i.data,l=0;l<d;l++)for(var m=1;m<g;m++){var o=m-1<0?g-1:m-1,n=(m+1)%g,s=l-1<0?d-1:l-1,p=(l+1)%d,u=[],v=[0,0,h[(m*d+l)*4]/255*c];u.push([-1,0,h[(m*d+s)*4]/255*c]);u.push([-1,-1,h[(o*d+s)*4]/255*c]);u.push([0,-1,h[(o*d+l)*4]/255*c]);u.push([1,-1,h[(o*d+p)*4]/255*c]);
|
|
|
+u.push([1,0,h[(m*d+p)*4]/255*c]);u.push([1,1,h[(n*d+p)*4]/255*c]);u.push([0,1,h[(n*d+l)*4]/255*c]);u.push([-1,1,h[(n*d+s)*4]/255*c]);o=[];s=u.length;for(n=0;n<s;n++){var p=u[n],y=u[(n+1)%s],p=[p[0]-v[0],p[1]-v[1],p[2]-v[2]],y=[y[0]-v[0],y[1]-v[1],y[2]-v[2]];o.push(b([p[1]*y[2]-p[2]*y[1],p[2]*y[0]-p[0]*y[2],p[0]*y[1]-p[1]*y[0]]))}u=[0,0,0];for(n=0;n<o.length;n++)u[0]+=o[n][0],u[1]+=o[n][1],u[2]+=o[n][2];u[0]/=o.length;u[1]/=o.length;u[2]/=o.length;v=(m*d+l)*4;k[v]=(u[0]+1)/2*255|0;k[v+1]=(u[1]+0.5)*
|
|
|
+255|0;k[v+2]=u[2]*255|0;k[v+3]=255}f.putImageData(i,0,0);return e}};THREE.SceneUtils={showHierarchy:function(a,c){THREE.SceneUtils.traverseHierarchy(a,function(a){a.visible=c})},traverseHierarchy:function(a,c){var b,d,g=a.children.length;for(d=0;d<g;d++)b=a.children[d],c(b),THREE.SceneUtils.traverseHierarchy(b,c)},createMultiMaterialObject:function(a,c){var b,d=c.length,g=new THREE.Object3D;for(b=0;b<d;b++){var e=new THREE.Mesh(a,c[b]);g.add(e)}return g}};
|
|
|
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,THREE.UniformsLib.shadowmap,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},enableReflection:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tCube:{type:"t",value:1,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},tDisplacement:{type:"t",value:5,texture:null},uNormalScale:{type:"f",
|
|
@@ -406,37 +406,37 @@ THREE.Path.prototype.quadraticCurveTo=function(a,c,b,d){var g=Array.prototype.sl
|
|
|
THREE.Path.prototype.bezierCurveTo=function(a,c,b,d,g,e){var f=Array.prototype.slice.call(arguments),h=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(h[h.length-2],h[h.length-1]),new THREE.Vector2(a,c),new THREE.Vector2(b,d),new THREE.Vector2(g,e)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:f})};
|
|
|
THREE.Path.prototype.splineThru=function(a){var c=Array.prototype.slice.call(arguments),b=this.actions[this.actions.length-1].args,b=[new THREE.Vector2(b[b.length-2],b[b.length-1])];Array.prototype.push.apply(b,a);this.curves.push(new THREE.SplineCurve(b));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};
|
|
|
THREE.Path.prototype.arc=function(a,c,b,d,g,e){var f=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(a,c,b,d,g,e));this.actions.push({action:THREE.PathActions.ARC,args:f})};THREE.Path.prototype.getSpacedPoints=function(a){a||(a=40);for(var c=[],b=0;b<a;b++)c.push(this.getPoint(b/a));return c};
|
|
|
-THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,e,f,h,i,l,m,k,o,p,q,n;d=0;for(g=this.actions.length;d<g;d++)switch(e=this.actions[d],f=e.action,e=e.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];k=e[0];o=e[1];b.length>0?(f=b[b.length-1],p=f.x,q=f.y):(f=this.actions[d-1].args,p=f[f.length-2],q=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,e=THREE.Shape.Utils.b2(n,p,k,h),n=THREE.Shape.Utils.b2(n,q,o,
|
|
|
-i),b.push(new THREE.Vector2(e,n));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];k=e[0];o=e[1];l=e[2];m=e[3];b.length>0?(f=b[b.length-1],p=f.x,q=f.y):(f=this.actions[d-1].args,p=f[f.length-2],q=f[f.length-1]);for(f=1;f<=a;f++)n=f/a,e=THREE.Shape.Utils.b3(n,p,k,l,h),n=THREE.Shape.Utils.b3(n,q,o,m,i),b.push(new THREE.Vector2(e,n));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];n=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f);
|
|
|
-for(f=1;f<=n;f++)b.push(e.getPointAt(f/n));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];l=e[2];k=e[3];n=e[4];o=!!e[5];m=f[f.length-2];p=f[f.length-1];f.length==0&&(m=p=0);q=n-k;var t=a*2;for(f=1;f<=t;f++)n=f/t,o||(n=1-n),n=k+n*q,e=m+h+l*Math.cos(n),n=p+i+l*Math.sin(n),b.push(new THREE.Vector2(e,n))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
|
|
|
-THREE.Path.prototype.nltransform=function(a,c,b,d,g,e){var f=this.getPoints(),h,i,l,m,k;h=0;for(i=f.length;h<i;h++)l=f[h],m=l.x,k=l.y,l.x=a*m+c*k+b,l.y=d*k+g*m+e;return f};
|
|
|
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,e,f,h,i,k,l,m,o,n,s,p;d=0;for(g=this.actions.length;d<g;d++)switch(e=this.actions[d],f=e.action,e=e.args,f){case THREE.PathActions.LINE_TO:b.push(new THREE.Vector2(e[0],e[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:h=e[2];i=e[3];m=e[0];o=e[1];b.length>0?(f=b[b.length-1],n=f.x,s=f.y):(f=this.actions[d-1].args,n=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b2(p,n,m,h),p=THREE.Shape.Utils.b2(p,s,o,
|
|
|
+i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];m=e[0];o=e[1];k=e[2];l=e[3];b.length>0?(f=b[b.length-1],n=f.x,s=f.y):(f=this.actions[d-1].args,n=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b3(p,n,m,k,h),p=THREE.Shape.Utils.b3(p,s,o,l,i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];p=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f);
|
|
|
+for(f=1;f<=p;f++)b.push(e.getPointAt(f/p));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];k=e[2];m=e[3];p=e[4];o=!!e[5];l=f[f.length-2];n=f[f.length-1];f.length==0&&(l=n=0);s=p-m;var u=a*2;for(f=1;f<=u;f++)p=f/u,o||(p=1-p),p=m+p*s,e=l+h+k*Math.cos(p),p=n+i+k*Math.sin(p),b.push(new THREE.Vector2(e,p))}c&&b.push(b[0]);return b};THREE.Path.prototype.transform=function(a,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),a)};
|
|
|
+THREE.Path.prototype.nltransform=function(a,c,b,d,g,e){var f=this.getPoints(),h,i,k,l,m;h=0;for(i=f.length;h<i;h++)k=f[h],l=k.x,m=k.y,k.x=a*l+c*m+b,k.y=d*m+g*l+e;return f};
|
|
|
THREE.Path.prototype.debug=function(a){var c=this.getBoundingBox();a||(a=document.createElement("canvas"),a.setAttribute("width",c.maxX+100),a.setAttribute("height",c.maxY+100),document.body.appendChild(a));c=a.getContext("2d");c.fillStyle="white";c.fillRect(0,0,a.width,a.height);c.strokeStyle="black";c.beginPath();var b,d,g,a=0;for(b=this.actions.length;a<b;a++)d=this.actions[a],g=d.args,d=d.action,d!=THREE.PathActions.CSPLINE_THRU&&c[d].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";d=
|
|
|
this.getPoints();a=0;for(b=d.length;a<b;a++)g=d[a],c.beginPath(),c.arc(g.x,g.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
|
THREE.Path.prototype.toShapes=function(){var a,c,b,d,g=[],e=new THREE.Path;a=0;for(c=this.actions.length;a<c;a++)b=this.actions[a],d=b.args,b=b.action,b==THREE.PathActions.MOVE_TO&&e.actions.length!=0&&(g.push(e),e=new THREE.Path),e[b].apply(e,d);e.actions.length!=0&&g.push(e);if(g.length==0)return[];var f,e=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f&&e.push(f),f=new THREE.Shape,f.actions=d.actions,f.curves=
|
|
|
d.curves):f.holes.push(d);e.push(f)}else{f=new THREE.Shape;a=0;for(c=g.length;a<c;a++)d=g[a],THREE.Shape.Utils.isClockWise(d.getPoints())?(f.actions=d.actions,f.curves=d.curves,e.push(f),f=new THREE.Shape):f.holes.push(d)}return e};THREE.Shape=function(){THREE.Path.apply(this,arguments);this.holes=[]};THREE.Shape.prototype=new THREE.Path;THREE.Shape.prototype.constructor=THREE.Path;THREE.Shape.prototype.extrude=function(a){return new THREE.ExtrudeGeometry(this,a)};
|
|
|
THREE.Shape.prototype.getPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedPoints(a,this.bends);return d};THREE.Shape.prototype.getSpacedPointsHoles=function(a){var c,b=this.holes.length,d=[];for(c=0;c<b;c++)d[c]=this.holes[c].getTransformedSpacedPoints(a,this.bends);return d};THREE.Shape.prototype.extractAllPoints=function(a){return{shape:this.getTransformedPoints(a),holes:this.getPointsHoles(a)}};
|
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(a){return{shape:this.getTransformedSpacedPoints(a),holes:this.getSpacedPointsHoles(a)}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,e,f,h,i,l,m,k,o,p,q=[];for(i=0;i<c.length;i++){l=c[i];Array.prototype.push.apply(d,l);e=Number.POSITIVE_INFINITY;for(g=0;g<l.length;g++){o=l[g];p=[];for(k=0;k<b.length;k++)m=b[k],m=o.distanceToSquared(m),p.push(m),m<e&&(e=m,f=g,h=k)}g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:l.length-1;var n=[l[f],b[h],b[g]];k=THREE.FontUtils.Triangulate.area(n);var t=[l[f],l[e],b[h]];o=THREE.FontUtils.Triangulate.area(t);p=h;m=f;h+=1;f+=-1;h<
|
|
|
-0&&(h+=b.length);h%=b.length;f<0&&(f+=l.length);f%=l.length;g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:l.length-1;n=[l[f],b[h],b[g]];n=THREE.FontUtils.Triangulate.area(n);t=[l[f],l[e],b[h]];t=THREE.FontUtils.Triangulate.area(t);k+o>n+t&&(h=p,f=m,h<0&&(h+=b.length),h%=b.length,f<0&&(f+=l.length),f%=l.length,g=h-1>=0?h-1:b.length-1,e=f-1>=0?f-1:l.length-1);k=b.slice(0,h);o=b.slice(h);p=l.slice(f);m=l.slice(0,f);e=[l[f],l[e],b[h]];q.push([l[f],b[h],b[g]]);q.push(e);b=k.concat(p).concat(m).concat(o)}return{shape:b,
|
|
|
-isolatedPts:q,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),e,f,h,i,l={};e=0;for(f=d.length;e<f;e++)i=d[e].x+":"+d[e].y,l[i]!==void 0&&console.log("Duplicate point",i),l[i]=e;e=0;for(f=b.length;e<f;e++){h=b[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}e=0;for(f=g.length;e<f;e++){h=g[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=l[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,e,f,h,i,k,l,m,o,n,s=[];for(i=0;i<c.length;i++){k=c[i];Array.prototype.push.apply(d,k);e=Number.POSITIVE_INFINITY;for(g=0;g<k.length;g++){o=k[g];n=[];for(m=0;m<b.length;m++)l=b[m],l=o.distanceToSquared(l),n.push(l),l<e&&(e=l,f=g,h=m)}g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;var p=[k[f],b[h],b[g]];m=THREE.FontUtils.Triangulate.area(p);var u=[k[f],k[e],b[h]];o=THREE.FontUtils.Triangulate.area(u);n=h;l=f;h+=1;f+=-1;h<
|
|
|
+0&&(h+=b.length);h%=b.length;f<0&&(f+=k.length);f%=k.length;g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;p=[k[f],b[h],b[g]];p=THREE.FontUtils.Triangulate.area(p);u=[k[f],k[e],b[h]];u=THREE.FontUtils.Triangulate.area(u);m+o>p+u&&(h=n,f=l,h<0&&(h+=b.length),h%=b.length,f<0&&(f+=k.length),f%=k.length,g=h-1>=0?h-1:b.length-1,e=f-1>=0?f-1:k.length-1);m=b.slice(0,h);o=b.slice(h);n=k.slice(f);l=k.slice(0,f);e=[k[f],k[e],b[h]];s.push([k[f],b[h],b[g]]);s.push(e);b=m.concat(n).concat(l).concat(o)}return{shape:b,
|
|
|
+isolatedPts:s,allpoints:d}},triangulateShape:function(a,c){var b=THREE.Shape.Utils.removeHoles(a,c),d=b.allpoints,g=b.isolatedPts,b=THREE.FontUtils.Triangulate(b.shape,!1),e,f,h,i,k={};e=0;for(f=d.length;e<f;e++)i=d[e].x+":"+d[e].y,k[i]!==void 0&&console.log("Duplicate point",i),k[i]=e;e=0;for(f=b.length;e<f;e++){h=b[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}e=0;for(f=g.length;e<f;e++){h=g[e];for(d=0;d<3;d++)i=h[d].x+":"+h[d].y,i=k[i],i!==void 0&&(h[d]=i)}return b.concat(g)},
|
|
|
isClockWise:function(a){return THREE.FontUtils.Triangulate.area(a)<0},b2p0:function(a,c){var b=1-a;return b*b*c},b2p1:function(a,c){return 2*(1-a)*a*c},b2p2:function(a,c){return a*a*c},b2:function(a,c,b,d){return this.b2p0(a,c)+this.b2p1(a,b)+this.b2p2(a,d)},b3p0:function(a,c){var b=1-a;return b*b*b*c},b3p1:function(a,c){var b=1-a;return 3*b*b*a*c},b3p2:function(a,c){return 3*(1-a)*a*a*c},b3p3:function(a,c){return a*a*a*c},b3:function(a,c,b,d,g){return this.b3p0(a,c)+this.b3p1(a,b)+this.b3p2(a,d)+
|
|
|
this.b3p3(a,g)}};THREE.TextPath=function(a,c){THREE.Path.call(this);this.parameters=c||{};this.set(a)};THREE.TextPath.prototype.set=function(a,c){this.text=a;var c=c||this.parameters,b=c.curveSegments!==void 0?c.curveSegments:4,d=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",e=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=b;THREE.FontUtils.face=d;THREE.FontUtils.weight=g;THREE.FontUtils.style=e};
|
|
|
THREE.TextPath.prototype.toShapes=function(){for(var a=THREE.FontUtils.drawText(this.text).paths,c=[],b=0,d=a.length;b<d;b++)Array.prototype.push.apply(c,a[b].toShapes());return c};
|
|
|
THREE.AnimationHandler=function(){var a=[],c={},b={update:function(b){for(var c=0;c<a.length;c++)a[c].update(b)},addToUpdate:function(b){a.indexOf(b)===-1&&a.push(b)},removeFromUpdate:function(b){b=a.indexOf(b);b!==-1&&a.splice(b,1)},add:function(a){c[a.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+a.name+" already exists in library. Overwriting.");c[a.name]=a;if(a.initialized!==!0){for(var b=0;b<a.hierarchy.length;b++){for(var d=0;d<a.hierarchy[b].keys.length;d++){if(a.hierarchy[b].keys[d].time<
|
|
|
-0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var l=a.hierarchy[b].keys[d].morphTargets[i];h[l]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var m=
|
|
|
-{};for(l in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===l){m[l]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(m[l]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=m}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
|
|
|
+0)a.hierarchy[b].keys[d].time=0;if(a.hierarchy[b].keys[d].rot!==void 0&&!(a.hierarchy[b].keys[d].rot instanceof THREE.Quaternion)){var h=a.hierarchy[b].keys[d].rot;a.hierarchy[b].keys[d].rot=new THREE.Quaternion(h[0],h[1],h[2],h[3])}}if(a.hierarchy[b].keys[0].morphTargets!==void 0){h={};for(d=0;d<a.hierarchy[b].keys.length;d++)for(var i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++){var k=a.hierarchy[b].keys[d].morphTargets[i];h[k]=-1}a.hierarchy[b].usedMorphTargets=h;for(d=0;d<a.hierarchy[b].keys.length;d++){var l=
|
|
|
+{};for(k in h){for(i=0;i<a.hierarchy[b].keys[d].morphTargets.length;i++)if(a.hierarchy[b].keys[d].morphTargets[i]===k){l[k]=a.hierarchy[b].keys[d].morphTargetsInfluences[i];break}i===a.hierarchy[b].keys[d].morphTargets.length&&(l[k]=0)}a.hierarchy[b].keys[d].morphTargetsInfluences=l}}for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].time===a.hierarchy[b].keys[d-1].time&&(a.hierarchy[b].keys.splice(d,1),d--);for(d=1;d<a.hierarchy[b].keys.length;d++)a.hierarchy[b].keys[d].index=d}d=parseInt(a.length*
|
|
|
a.fps,10);a.JIT={};a.JIT.hierarchy=[];for(b=0;b<a.hierarchy.length;b++)a.JIT.hierarchy.push(Array(d));a.initialized=!0}},get:function(a){if(typeof a==="string")return c[a]?c[a]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+a),null)},parse:function(a){var b=[];if(a instanceof THREE.SkinnedMesh)for(var c=0;c<a.bones.length;c++)b.push(a.bones[c]);else d(a,b);return b}},d=function(a,b){b.push(a);for(var c=0;c<a.children.length;c++)d(a.children[c],b)};b.LINEAR=0;b.CATMULLROM=1;b.CATMULLROM_FORWARD=
|
|
|
2;return b}();THREE.Animation=function(a,c,b,d){this.root=a;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(a);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=b!==void 0?b:THREE.AnimationHandler.LINEAR;this.JITCompile=d!==void 0?d:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=a!==void 0?a:!0;this.currentTime=c!==void 0?c:0;var b,d=this.hierarchy.length,g;for(b=0;b<d;b++){g=this.hierarchy[b];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
|
|
|
THREE.Bone?g.skinMatrix:g.matrix;var e=g.animationCache.prevKey;g=g.animationCache.nextKey;e.pos=this.data.hierarchy[b].keys[0];e.rot=this.data.hierarchy[b].keys[0];e.scl=this.data.hierarchy[b].keys[0];g.pos=this.getNextKeyWith("pos",b,1);g.rot=this.getNextKeyWith("rot",b,1);g.scl=this.getNextKeyWith("scl",b,1)}this.update(0)}this.isPaused=!1;THREE.AnimationHandler.addToUpdate(this)};
|
|
|
THREE.Animation.prototype.pause=function(){this.isPaused?THREE.AnimationHandler.addToUpdate(this):THREE.AnimationHandler.removeFromUpdate(this);this.isPaused=!this.isPaused};
|
|
|
THREE.Animation.prototype.stop=function(){this.isPaused=this.isPlaying=!1;THREE.AnimationHandler.removeFromUpdate(this);for(var a=0;a<this.hierarchy.length;a++)if(this.hierarchy[a].animationCache!==void 0)this.hierarchy[a]instanceof THREE.Bone?this.hierarchy[a].skinMatrix=this.hierarchy[a].animationCache.originalMatrix:this.hierarchy[a].matrix=this.hierarchy[a].animationCache.originalMatrix,delete this.hierarchy[a].animationCache};
|
|
|
-THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,g,e,f,h,i,l,m=this.data.JIT.hierarchy,k,o;this.currentTime+=a*this.timeScale;o=this.currentTime;k=this.currentTime%=this.data.length;l=parseInt(Math.min(k*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,q=this.hierarchy.length;p<q;p++)if(a=this.hierarchy[p],i=a.animationCache,this.JITCompile&&m[p][l]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=m[p][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
-!1):(a.matrix=m[p][l],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var n=0;n<3;n++){b=c[n];f=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(k<o)if(this.loop){f=this.data.hierarchy[p].keys[0];for(h=this.getNextKeyWith(b,p,1);h.time<k;)f=h,h=this.getNextKeyWith(b,p,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(b,p,h.index+1);while(h.time<
|
|
|
-k)}i.prevKey[b]=f;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(k-f.time)/(h.time-f.time);g=f[b];e=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+p),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
-this.getPrevKeyWith("pos",p,f.index-1).pos,this.points[1]=g,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",p,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b===
|
|
|
-"rot")THREE.Quaternion.slerp(g,e,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d}}if(this.JITCompile&&m[0][l]===void 0){this.hierarchy[0].update(null,!0);for(p=0;p<this.hierarchy.length;p++)m[p][l]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,e,f,h,i,l;g=(a.length-1)*c;e=Math.floor(g);g-=e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>a.length-2?e:e+1;b[3]=e>a.length-3?e:e+2;e=a[b[0]];h=a[b[1]];i=a[b[2]];l=a[b[3]];b=g*g;f=g*b;d[0]=this.interpolate(e[0],h[0],i[0],l[0],g,b,f);d[1]=this.interpolate(e[1],h[1],i[1],l[1],g,b,f);d[2]=this.interpolate(e[2],h[2],i[2],l[2],g,b,f);return d};
|
|
|
+THREE.Animation.prototype.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,g,e,f,h,i,k,l=this.data.JIT.hierarchy,m,o;this.currentTime+=a*this.timeScale;o=this.currentTime;m=this.currentTime%=this.data.length;k=parseInt(Math.min(m*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,s=this.hierarchy.length;n<s;n++)if(a=this.hierarchy[n],i=a.animationCache,this.JITCompile&&l[n][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=l[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
+!1):(a.matrix=l[n][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)a instanceof THREE.Bone?a.skinMatrix=a.animationCache.originalMatrix:a.matrix=a.animationCache.originalMatrix;for(var p=0;p<3;p++){b=c[p];f=i.prevKey[b];h=i.nextKey[b];if(h.time<=o){if(m<o)if(this.loop){f=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<m;)f=h,h=this.getNextKeyWith(b,n,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(b,n,h.index+1);while(h.time<
|
|
|
+m)}i.prevKey[b]=f;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(m-f.time)/(h.time-f.time);g=f[b];e=h[b];if(d<0||d>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+d+" on bone "+n),d=d<0?0:1;if(b==="pos")if(b=a.position,this.interpolationType===THREE.AnimationHandler.LINEAR)b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
+this.getPrevKeyWith("pos",n,f.index-1).pos,this.points[1]=g,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",n,h.index+1).pos,d=d*0.33+0.33,g=this.interpolateCatmullRom(this.points,d),b.x=g[0],b.y=g[1],b.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)d=this.interpolateCatmullRom(this.points,d*1.01),this.target.set(d[0],d[1],d[2]),this.target.subSelf(b),this.target.y=0,this.target.normalize(),d=Math.atan2(this.target.x,this.target.z),a.rotation.set(0,d,0)}else if(b===
|
|
|
+"rot")THREE.Quaternion.slerp(g,e,a.quaternion,d);else if(b==="scl")b=a.scale,b.x=g[0]+(e[0]-g[0])*d,b.y=g[1]+(e[1]-g[1])*d,b.z=g[2]+(e[2]-g[2])*d}}if(this.JITCompile&&l[0][k]===void 0){this.hierarchy[0].update(null,!0);for(n=0;n<this.hierarchy.length;n++)l[n][k]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(a,c){var b=[],d=[],g,e,f,h,i,k;g=(a.length-1)*c;e=Math.floor(g);g-=e;b[0]=e===0?e:e-1;b[1]=e;b[2]=e>a.length-2?e:e+1;b[3]=e>a.length-3?e:e+2;e=a[b[0]];h=a[b[1]];i=a[b[2]];k=a[b[3]];b=g*g;f=g*b;d[0]=this.interpolate(e[0],h[0],i[0],k[0],g,b,f);d[1]=this.interpolate(e[1],h[1],i[1],k[1],g,b,f);d[2]=this.interpolate(e[2],h[2],i[2],k[2],g,b,f);return d};
|
|
|
THREE.Animation.prototype.interpolate=function(a,c,b,d,g,e,f){a=(b-a)*0.5;d=(d-c)*0.5;return(2*(c-b)+a+d)*f+(-3*(c-b)-2*a-d)*e+a*g+c};THREE.Animation.prototype.getNextKeyWith=function(a,c,b){var d=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b=b<d.length-1?b:d.length-1:b%=d.length;b<d.length;b++)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(a,c,b){for(var d=this.data.hierarchy[c].keys,b=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?b>0?b:0:b>=0?b:b+d.length;b>=0;b--)if(d[b][a]!==void 0)return d[b];return this.data.hierarchy[c].keys[d.length-1]};
|
|
|
THREE.CubeCamera=function(a,c,b,d){this.heightOffset=b;this.position=new THREE.Vector3(0,b,0);this.cameraPX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,a,c);this.cameraPX.position=this.position;this.cameraNX.position=this.position;this.cameraPY.position=
|
|
@@ -458,14 +458,14 @@ function(a){switch(a.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:
|
|
|
this.moveUp&&this.object.translateY(b);this.moveDown&&this.object.translateY(-b);b=a*this.lookSpeed;this.activeLook||(b=0);this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var a=this.target,c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}a=1;this.constrainVertical&&
|
|
|
(a=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*b;this.lookVertical&&(this.lat-=this.mouseY*b*a);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=THREE.Math.mapLinear(this.phi,0,Math.PI,this.verticalMin,this.verticalMax);a=this.target;c=this.object.position;a.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);a.y=c.y+100*Math.cos(this.phi);a.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);
|
|
|
this.object.lookAt(a)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",b(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",b(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",b(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",b(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",b(this,this.onKeyUp),!1)};
|
|
|
-THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),t=g.length,u=0;f=t-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<t-1;f++)u=d*h.chunks[f]/h.total,b.keys[f]={time:u,pos:g[f]};e.hierarchy[0]=
|
|
|
+THREE.PathControls=function(a,c){function b(a){if((a*=2)<1)return 0.5*a*a;return-0.5*(--a*(a-2)-1)}function d(a,b){return function(){b.apply(a,arguments)}}function g(a,b,c,d){var e={name:c,fps:0.6,length:d,hierarchy:[]},f,g=b.getControlPointsArray(),h=b.getLength(),u=g.length,v=0;f=u-1;b={parent:-1,keys:[]};b.keys[0]={time:0,pos:g[0],rot:[0,0,0,1],scl:[1,1,1]};b.keys[f]={time:d,pos:g[f],rot:[0,0,0,1],scl:[1,1,1]};for(f=1;f<u-1;f++)v=d*h.chunks[f]/h.total,b.keys[f]={time:v,pos:g[f]};e.hierarchy[0]=
|
|
|
b;THREE.AnimationHandler.add(e);return new THREE.Animation(a,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(a,b){var c,d,e=new THREE.Geometry;for(c=0;c<a.points.length*b;c++)d=c/(a.points.length*b),d=a.getPoint(d),e.vertices[c]=new THREE.Vertex(new THREE.Vector3(d.x,d.y,d.z));return e}this.object=a;this.domElement=c!==void 0?c:document;this.id="PathControls"+THREE.PathControlsIdCounter++;this.duration=1E4;this.waypoints=[];this.useConstantSpeed=!0;this.resamplingCoef=50;this.debugPath=
|
|
|
new THREE.Object3D;this.debugDummy=new THREE.Object3D;this.animationParent=new THREE.Object3D;this.lookSpeed=0.0050;this.lookHorizontal=this.lookVertical=!0;this.verticalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.target=new THREE.Object3D;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=
|
|
|
this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var f=Math.PI*2,h=Math.PI/180;this.update=function(a){var c;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed*a);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed*a);this.lon=Math.max(0,Math.min(360,this.lon));this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*h;this.theta=this.lon*h;a=this.phi%f;this.phi=a>=0?a:a+f;c=this.verticalAngleMap.srcRange;
|
|
|
a=this.verticalAngleMap.dstRange;c=THREE.Math.mapLinear(this.phi,c[0],c[1],a[0],a[1]);var d=a[1]-a[0];this.phi=b((c-a[0])/d)*d+a[0];c=this.horizontalAngleMap.srcRange;a=this.horizontalAngleMap.dstRange;c=THREE.Math.mapLinear(this.theta,c[0],c[1],a[0],a[1]);d=a[1]-a[0];this.theta=b((c-a[0])/d)*d+a[0];a=this.target.position;a.x=100*Math.sin(this.phi)*Math.cos(this.theta);a.y=100*Math.cos(this.phi);a.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(this.target.position)};this.onMouseMove=
|
|
|
function(a){this.domElement===document?(this.mouseX=a.pageX-this.viewHalfX,this.mouseY=a.pageY-this.viewHalfY):(this.mouseX=a.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=a.pageY-this.domElement.offsetTop-this.viewHalfY)};this.init=function(){this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var a=new THREE.MeshLambertMaterial({color:30719}),b=new THREE.MeshLambertMaterial({color:65280}),
|
|
|
c=new THREE.CubeGeometry(10,10,20),f=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(c,a);a=new THREE.Mesh(f,b);a.position.set(0,10,0);this.animation=g(this.animationParent,this.spline,this.id,this.duration);this.animationParent.add(this.object);this.animationParent.add(this.target);this.animationParent.add(a)}else this.animation=g(this.animationParent,this.spline,this.id,this.duration),this.animationParent.add(this.target),this.animationParent.add(this.object);if(this.createDebugPath){var a=
|
|
|
-this.debugPath,b=this.spline,f=e(b,10),c=e(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),p=0;p<b.points.length;p++)c=new THREE.Mesh(f,h),c.position.copy(b.points[p]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
|
|
|
+this.debugPath,b=this.spline,f=e(b,10),c=e(b,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3}),f=new THREE.Line(f,h),c=new THREE.ParticleSystem(c,new THREE.ParticleBasicMaterial({color:16755200,size:3}));f.scale.set(1,1,1);a.add(f);c.scale.set(1,1,1);a.add(c);for(var f=new THREE.SphereGeometry(1,16,8),h=new THREE.MeshBasicMaterial({color:65280}),n=0;n<b.points.length;n++)c=new THREE.Mesh(f,h),c.position.copy(b.points[n]),a.add(c)}this.domElement.addEventListener("mousemove",d(this,this.onMouseMove),
|
|
|
!1)}};THREE.PathControlsIdCounter=0;
|
|
|
THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,arguments)}}this.object=a;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
|
|
|
0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.keydown=function(a){if(!a.altKey){switch(a.keyCode){case 16:this.movementSpeedMultiplier=0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=
|
|
@@ -476,76 +476,76 @@ THREE.FlyControls=function(a,c){function b(a,b){return function(){b.apply(a,argu
|
|
|
this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var a=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-a+this.moveState.back};this.updateRotationVector=function(){this.rotationVector.x=-this.moveState.pitchDown+this.moveState.pitchUp;this.rotationVector.y=-this.moveState.yawRight+this.moveState.yawLeft;this.rotationVector.z=
|
|
|
-this.moveState.rollRight+this.moveState.rollLeft};this.getContainerDimensions=function(){return this.domElement!=document?{size:[this.domElement.offsetWidth,this.domElement.offsetHeight],offset:[this.domElement.offsetLeft,this.domElement.offsetTop]}:{size:[window.innerWidth,window.innerHeight],offset:[0,0]}};this.domElement.addEventListener("mousemove",b(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",b(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",b(this,
|
|
|
this.mouseup),!1);this.domElement.addEventListener("keydown",b(this,this.keydown),!1);this.domElement.addEventListener("keyup",b(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
|
-THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Matrix4,f=!1,h=1,i=0,l=0,m=0,k=0,o=0,p=window.innerWidth/2,q=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
|
|
|
-this.rotateHorizontally(c*k);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*l);this.object.translateY(c*m);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);d.set(0,1,0);b.cross(d,
|
|
|
+THREE.RollControls=function(a,c){this.object=a;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;var b=new THREE.Vector3,d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Matrix4,f=!1,h=1,i=0,k=0,l=0,m=0,o=0,n=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
|
|
|
+this.rotateHorizontally(c*m);this.rotateVertically(c*o)}c=a*this.movementSpeed;this.object.translateZ(-c*(i>0||this.autoForward&&!(i<0)?1:i));this.object.translateX(c*k);this.object.translateY(c*l);f&&(this.roll+=this.rollSpeed*a*h);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();g.copy(this.forward);d.set(0,1,0);b.cross(d,
|
|
|
g).normalize();d.cross(g,b).normalize();this.object.matrix.n11=b.x;this.object.matrix.n12=d.x;this.object.matrix.n13=g.x;this.object.matrix.n21=b.y;this.object.matrix.n22=d.y;this.object.matrix.n23=g.y;this.object.matrix.n31=b.z;this.object.matrix.n32=d.z;this.object.matrix.n33=g.z;e.identity();e.n11=Math.cos(this.roll);e.n12=-Math.sin(this.roll);e.n21=Math.sin(this.roll);e.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(e);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;
|
|
|
this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(a){this.object.position.x+=this.object.matrix.n11*a;this.object.position.y+=this.object.matrix.n21*a;this.object.position.z+=this.object.matrix.n31*a};this.translateY=function(a){this.object.position.x+=this.object.matrix.n12*a;this.object.position.y+=this.object.matrix.n22*a;this.object.position.z+=this.object.matrix.n32*a};this.translateZ=function(a){this.object.position.x-=this.object.matrix.n13*
|
|
|
a;this.object.position.y-=this.object.matrix.n23*a;this.object.position.z-=this.object.matrix.n33*a};this.rotateHorizontally=function(a){b.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);b.multiplyScalar(a);this.forward.subSelf(b);this.forward.normalize()};this.rotateVertically=function(a){d.set(this.object.matrix.n12,this.object.matrix.n22,this.object.matrix.n32);d.multiplyScalar(a);this.forward.addSelf(d);this.forward.normalize()};this.domElement.addEventListener("contextmenu",
|
|
|
-function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){k=(a.clientX-p)/window.innerWidth;o=(a.clientY-q)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
-function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:l=-1;break;case 40:case 83:i=-1;break;case 39:case 68:l=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:m=1;break;case 70:m=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:l=0;break;case 40:case 83:i=0;break;case 39:case 68:l=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:m=0;break;case 70:m=0}},!1)};
|
|
|
+function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){m=(a.clientX-n)/window.innerWidth;o=(a.clientY-s)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=1;break;case 2:i=-1}},!1);this.domElement.addEventListener("mouseup",function(a){a.preventDefault();a.stopPropagation();switch(a.button){case 0:i=0;break;case 2:i=0}},!1);this.domElement.addEventListener("keydown",
|
|
|
+function(a){switch(a.keyCode){case 38:case 87:i=1;break;case 37:case 65:k=-1;break;case 40:case 83:i=-1;break;case 39:case 68:k=1;break;case 81:f=!0;h=1;break;case 69:f=!0;h=-1;break;case 82:l=1;break;case 70:l=-1}},!1);this.domElement.addEventListener("keyup",function(a){switch(a.keyCode){case 38:case 87:i=0;break;case 37:case 65:k=0;break;case 40:case 83:i=0;break;case 39:case 68:k=0;break;case 81:f=!1;break;case 69:f=!1;break;case 82:l=0;break;case 70:l=0}},!1)};
|
|
|
THREE.TrackballControls=function(a,c){var b=this,d={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};this.object=a;this.domElement=c!==void 0?c:document;this.enabled=!0;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=
|
|
|
-new THREE.Vector3(0,0,0);var g=!1,e=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector2,m=new THREE.Vector2,k=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
|
|
|
+new THREE.Vector3(0,0,0);var g=!1,e=d.NONE,f=new THREE.Vector3,h=new THREE.Vector3,i=new THREE.Vector3,k=new THREE.Vector2,l=new THREE.Vector2,m=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(a){if(typeof this[a.type]=="function")this[a.type](a)};this.getMouseOnScreen=function(a,c){return new THREE.Vector2((a-b.screen.offsetLeft)/b.radius*0.5,(c-b.screen.offsetTop)/b.radius*0.5)};this.getMouseProjectionOnBall=function(a,c){var d=new THREE.Vector3((a-b.screen.width*0.5-b.screen.offsetLeft)/
|
|
|
b.radius,(b.screen.height*0.5+b.screen.offsetTop-c)/b.radius,0),e=d.length();e>1?d.normalize():d.z=Math.sqrt(1-e*e);f.copy(b.object.position).subSelf(b.target);e=b.object.up.clone().setLength(d.y);e.addSelf(b.object.up.clone().crossSelf(f).setLength(d.x));e.addSelf(f.setLength(d.z));return e};this.rotateCamera=function(){var a=Math.acos(h.dot(i)/h.length()/i.length());if(a){var c=(new THREE.Vector3).cross(h,i).normalize(),d=new THREE.Quaternion;a*=b.rotateSpeed;d.setFromAxisAngle(c,-a);d.multiplyVector3(f);
|
|
|
-d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(m.y-l.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?l=m:l.y+=(m.y-l.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(k);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
|
|
|
-b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?k=o:k.addSelf(a.sub(o,k).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
|
|
|
-b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),l=m=b.getMouseOnScreen(a.clientX,a.clientY),k=o=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),e!==d.NONE&&(e===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?m=b.getMouseOnScreen(a.clientX,
|
|
|
-a.clientY):e===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),e===d.NONE))e=a.button,e===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?l=m=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(k=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
|
|
|
+d.multiplyVector3(b.object.up);d.multiplyVector3(i);b.staticMoving?h=i:(d.setFromAxisAngle(c,a*(b.dynamicDampingFactor-1)),d.multiplyVector3(h))}};this.zoomCamera=function(){var a=1+(l.y-k.y)*b.zoomSpeed;a!==1&&a>0&&(f.multiplyScalar(a),b.staticMoving?k=l:k.y+=(l.y-k.y)*this.dynamicDampingFactor)};this.panCamera=function(){var a=o.clone().subSelf(m);if(a.lengthSq()){a.multiplyScalar(f.length()*b.panSpeed);var c=f.clone().crossSelf(b.object.up).setLength(a.x);c.addSelf(b.object.up.clone().setLength(a.y));
|
|
|
+b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?m=o:m.addSelf(a.sub(o,m).multiplyScalar(b.dynamicDampingFactor))}};this.checkDistances=function(){if(!b.noZoom||!b.noPan)b.object.position.lengthSq()>b.maxDistance*b.maxDistance&&b.object.position.setLength(b.maxDistance),f.lengthSq()<b.minDistance*b.minDistance&&b.object.position.add(b.target,f.setLength(b.minDistance))};this.update=function(){f.copy(b.object.position).subSelf(this.target);b.rotateCamera();b.noZoom||b.zoomCamera();b.noPan||
|
|
|
+b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),k=l=b.getMouseOnScreen(a.clientX,a.clientY),m=o=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),e!==d.NONE&&(e===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?l=b.getMouseOnScreen(a.clientX,
|
|
|
+a.clientY):e===d.PAN&&!b.noPan&&(o=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),e===d.NONE))e=a.button,e===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?k=l=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(m=o=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
|
|
|
e=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&e===d.NONE){if(a.keyCode===b.keys[d.ROTATE])e=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)e=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)e=d.PAN;e!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&e!==d.NONE)e=d.NONE},!1)};
|
|
|
-THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,k,m){var n,p,o=d||1,q=g||1,t=h/2,j=i/2,u=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",q=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=e||1;var r=o+1,v=q+1;h/=o;var B=i/q;for(p=0;p<v;p++)for(i=0;i<r;i++){var R=new THREE.Vector3;R[a]=(i*h-t)*c;R[b]=(p*B-j)*f;R[n]=k;l.vertices.push(new THREE.Vertex(R))}for(p=0;p<q;p++)for(i=0;i<o;i++)l.faces.push(new THREE.Face4(i+
|
|
|
-r*p+u,i+r*(p+1)+u,i+1+r*(p+1)+u,i+1+r*p+u,null,null,m)),l.faceVertexUvs[0].push([new THREE.UV(i/o,p/q),new THREE.UV(i/o,(p+1)/q),new THREE.UV((i+1)/o,(p+1)/q),new THREE.UV((i+1)/o,p/q)])}THREE.Geometry.call(this);var l=this,m=a/2,k=c/2,o=b/2,p,q,n,t,u,v;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(p=0;p<6;p++)this.materials.push(f)}p=0;t=1;q=2;u=3;n=4;v=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var r in h)this.sides[r]!=
|
|
|
-void 0&&(this.sides[r]=h[r]);this.sides.px&&i("z","y",-1,-1,b,c,m,p);this.sides.nx&&i("z","y",1,-1,b,c,-m,t);this.sides.py&&i("x","z",1,1,a,b,k,q);this.sides.ny&&i("x","z",1,-1,a,b,-k,u);this.sides.pz&&i("x","y",1,-1,a,c,o,n);this.sides.nz&&i("x","y",-1,-1,a,c,-o,v);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(a,c,b,d,g,e){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,d=d||8,g=g||1,h,i,l=[],m=[];for(i=0;i<=g;i++){var k=[],o=[],p=i/g,q=p*(c-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(q*Math.sin(n*Math.PI*2),-p*b+f,q*Math.cos(n*Math.PI*2))));k.push(this.vertices.length-1);o.push(new THREE.UV(n,p))}l.push(k);m.push(o)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=l[i][h],k=l[i+1][h],o=l[i+1][h+1],p=l[i][h+1],q=
|
|
|
-this.vertices[b].position.clone().setY(0).normalize(),n=this.vertices[k].position.clone().setY(0).normalize(),t=this.vertices[o].position.clone().setY(0).normalize(),u=this.vertices[p].position.clone().setY(0).normalize(),v=m[i][h].clone(),r=m[i+1][h].clone(),z=m[i+1][h+1].clone(),E=m[i][h+1].clone();this.faces.push(new THREE.Face4(b,k,o,p,[q,n,t,u]));this.faceVertexUvs[0].push([v,r,z,E])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)b=l[0][h],k=l[0][h+
|
|
|
-1],o=this.vertices.length-1,q=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),t=new THREE.Vector3(0,1,0),v=m[0][h].clone(),r=m[0][h+1].clone(),z=new THREE.UV(r.u,0),this.faces.push(new THREE.Face3(b,k,o,[q,n,t])),this.faceVertexUvs[0].push([v,r,z])}if(!e&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)b=l[i][h+1],k=l[i][h],o=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),t=new THREE.Vector3(0,-1,0),v=m[i][h+1].clone(),r=m[i][h].clone(),
|
|
|
-z=new THREE.UV(r.u,1),this.faces.push(new THREE.Face3(b,k,o,[q,n,t])),this.faceVertexUvs[0].push([v,r,z])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,l,m){var n,o,p=d||1,q=g||1,s=h/2,v=i/2,u=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",q=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",p=e||1;var y=p+1,F=q+1;h/=p;var B=i/q;for(o=0;o<F;o++)for(i=0;i<y;i++){var Q=new THREE.Vector3;Q[a]=(i*h-s)*c;Q[b]=(o*B-v)*f;Q[n]=l;k.vertices.push(new THREE.Vertex(Q))}for(o=0;o<q;o++)for(i=0;i<p;i++)k.faces.push(new THREE.Face4(i+
|
|
|
+y*o+u,i+y*(o+1)+u,i+1+y*(o+1)+u,i+1+y*o+u,null,null,m)),k.faceVertexUvs[0].push([new THREE.UV(i/p,o/q),new THREE.UV(i/p,(o+1)/q),new THREE.UV((i+1)/p,(o+1)/q),new THREE.UV((i+1)/p,o/q)])}THREE.Geometry.call(this);var k=this,l=a/2,m=c/2,o=b/2,n,s,p,u,v,y;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(n=0;n<6;n++)this.materials.push(f)}n=0;u=1;s=2;v=3;p=4;y=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var q in h)this.sides[q]!=
|
|
|
+void 0&&(this.sides[q]=h[q]);this.sides.px&&i("z","y",-1,-1,b,c,l,n);this.sides.nx&&i("z","y",1,-1,b,c,-l,u);this.sides.py&&i("x","z",1,1,a,b,m,s);this.sides.ny&&i("x","z",1,-1,a,b,-m,v);this.sides.pz&&i("x","y",1,-1,a,c,o,p);this.sides.nz&&i("x","y",-1,-1,a,c,-o,y);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
+THREE.CylinderGeometry=function(a,c,b,d,g,e){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,d=d||8,g=g||1,h,i,k=[],l=[];for(i=0;i<=g;i++){var m=[],o=[],n=i/g,s=n*(c-a)+a;for(h=0;h<=d;h++){var p=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(s*Math.sin(p*Math.PI*2),-n*b+f,s*Math.cos(p*Math.PI*2))));m.push(this.vertices.length-1);o.push(new THREE.UV(p,n))}k.push(m);l.push(o)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],m=k[i+1][h],o=k[i+1][h+1],n=k[i][h+1],s=
|
|
|
+this.vertices[b].position.clone().setY(0).normalize(),p=this.vertices[m].position.clone().setY(0).normalize(),u=this.vertices[o].position.clone().setY(0).normalize(),v=this.vertices[n].position.clone().setY(0).normalize(),y=l[i][h].clone(),q=l[i+1][h].clone(),t=l[i+1][h+1].clone(),w=l[i][h+1].clone();this.faces.push(new THREE.Face4(b,m,o,n,[s,p,u,v]));this.faceVertexUvs[0].push([y,q,t,w])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)b=k[0][h],m=k[0][h+
|
|
|
+1],o=this.vertices.length-1,s=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),u=new THREE.Vector3(0,1,0),y=l[0][h].clone(),q=l[0][h+1].clone(),t=new THREE.UV(q.u,0),this.faces.push(new THREE.Face3(b,m,o,[s,p,u])),this.faceVertexUvs[0].push([y,q,t])}if(!e&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)b=k[i][h+1],m=k[i][h],o=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),u=new THREE.Vector3(0,-1,0),y=l[i][h+1].clone(),q=l[i][h].clone(),
|
|
|
+t=new THREE.UV(q.u,1),this.faces.push(new THREE.Face3(b,m,o,[s,p,u])),this.faceVertexUvs[0].push([y,q,t])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,d=a.length,g;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
|
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(D=a.length;--D>=0;){Y=D;O=D-1;O<0&&(O=a.length-1);for(var b=
|
|
|
-0,c=p+m*2,b=0;b<c;b++){var d=j*b,e=j*(b+1),f=ga+Y+d,g=ga+Y+e,k=f,d=ga+O+d,e=ga+O+e,l=g;k+=w;d+=w;e+=w;l+=w;x.faces.push(new THREE.Face4(k,d,e,l,null,null,z));z&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(x.vertices[f].position.z+i)/e,g=(x.vertices[g].position.z+i)/e,x.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){x.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=w;b+=w;c+=w;x.faces.push(new THREE.Face3(a,b,c,null,
|
|
|
-null,r));if(r){var d=E.maxY,e=E.maxX,f=x.vertices[b].position.x,b=x.vertices[b].position.y,g=x.vertices[c].position.x,c=x.vertices[c].position.y;x.faceVertexUvs[0].push([new THREE.UV(x.vertices[a].position.x/e,x.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,l=c.bevelSize!==void 0?c.bevelSize:i-2,m=c.bevelSegments!==void 0?c.bevelSegments:3,k=c.bevelEnabled!==void 0?c.bevelEnabled:!0,o=c.curveSegments!==
|
|
|
-void 0?c.curveSegments:12,p=c.steps!==void 0?c.steps:1,q=c.bendPath,n=c.extrudePath,t,u=!1,v=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,r=c.material,z=c.extrudeMaterial,E=this.shapebb;if(n)t=n.getPoints(o),p=t.length,u=!0,k=!1;k||(l=i=m=0);var N,A,J,x=this,w=this.vertices.length;q&&a.addWrapPath(q);o=v?a.extractAllSpacedPoints(o):a.extractAllPoints(o);q=o.shape;o=o.holes;if(n=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();A=0;for(J=o.length;A<J;A++)N=o[A],THREE.Shape.Utils.isClockWise(N)&&
|
|
|
-(o[A]=N.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(q,o);v=q;A=0;for(J=o.length;A<J;A++)N=o[A],q=q.concat(N);var D,M,S,ca,L,P,j=q.length,ea=n.length,ha=[];D=0;M=v.length;Y=M-1;for(O=D+1;D<M;D++,Y++,O++)Y===M&&(Y=0),O===M&&(O=0),ha[D]=d(v[D],v[Y],v[O]);var F=[],B,R=ha.concat();A=0;for(J=o.length;A<J;A++){N=o[A];B=[];D=0;M=N.length;Y=M-1;for(O=D+1;D<M;D++,Y++,O++)Y===M&&(Y=0),O===M&&(O=0),B[D]=d(N[D],N[Y],N[O]);F.push(B);R=R.concat(B)}for(S=0;S<m;S++){ca=S/m;L=i*(1-ca);ca=l*Math.sin(ca*Math.PI/
|
|
|
-2);D=0;for(M=v.length;D<M;D++)P=b(v[D],ha[D],ca),e(P.x,P.y,-L);A=0;for(J=o.length;A<J;A++){N=o[A];B=F[A];D=0;for(M=N.length;D<M;D++)P=b(N[D],B[D],ca),e(P.x,P.y,-L)}}ca=l;for(D=0;D<j;D++)P=k?b(q[D],R[D],ca):q[D],u?e(P.x,P.y+t[0].y,t[0].x):e(P.x,P.y,0);for(S=1;S<=p;S++)for(D=0;D<j;D++)P=k?b(q[D],R[D],ca):q[D],u?e(P.x,P.y+t[S-1].y,t[S-1].x):e(P.x,P.y,h/p*S);for(S=m-1;S>=0;S--){ca=S/m;L=i*(1-ca);ca=l*Math.sin(ca*Math.PI/2);D=0;for(M=v.length;D<M;D++)P=b(v[D],ha[D],ca),e(P.x,P.y,h+L);A=0;for(J=o.length;A<
|
|
|
-J;A++){N=o[A];B=F[A];D=0;for(M=N.length;D<M;D++)P=b(N[D],B[D],ca),u?e(P.x,P.y+t[p-1].y,t[p-1].x+L):e(P.x,P.y,h+L)}}if(k){k=j*0;for(D=0;D<ea;D++)l=n[D],f(l[2]+k,l[1]+k,l[0]+k);k=j*(p+m*2);for(D=0;D<ea;D++)l=n[D],f(l[0]+k,l[1]+k,l[2]+k)}else{for(D=0;D<ea;D++)l=n[D],f(l[2],l[1],l[0]);for(D=0;D<ea;D++)l=n[D],f(l[0]+j*p,l[1]+j*p,l[2]+j*p)}var Y,O,ga=0;g(v);ga+=v.length;A=0;for(J=o.length;A<J;A++)N=o[A],g(N),ga+=N.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(C=a.length;--C>=0;){O=C;j=C-1;j<0&&(j=a.length-1);for(var b=
|
|
|
+0,c=n+l*2,b=0;b<c;b++){var d=ga*b,e=ga*(b+1),f=ha+O+d,g=ha+O+e,k=f,d=ha+j+d,e=ha+j+e,m=g;k+=D;d+=D;e+=D;m+=D;I.faces.push(new THREE.Face4(k,d,e,m,null,null,t));t&&(k=b/c,d=(b+1)/c,e=h+i*2,f=(I.vertices[f].position.z+i)/e,g=(I.vertices[g].position.z+i)/e,I.faceVertexUvs[0].push([new THREE.UV(f,k),new THREE.UV(g,k),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){I.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=D;b+=D;c+=D;I.faces.push(new THREE.Face3(a,b,c,
|
|
|
+null,null,q));if(q){var d=w.maxY,e=w.maxX,f=I.vertices[b].position.x,b=I.vertices[b].position.y,g=I.vertices[c].position.x,c=I.vertices[c].position.y;I.faceVertexUvs[0].push([new THREE.UV(I.vertices[a].position.x/e,I.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,k=c.bevelSize!==void 0?c.bevelSize:i-2,l=c.bevelSegments!==void 0?c.bevelSegments:3,m=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
|
|
|
+o=c.curveSegments!==void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,s=c.bendPath,p=c.extrudePath,u,v=!1,y=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,q=c.material,t=c.extrudeMaterial,w=this.shapebb;if(p)u=p.getPoints(o),n=u.length,v=!0,m=!1;m||(k=i=l=0);var z,L,J,I=this,D=this.vertices.length;s&&a.addWrapPath(s);o=y?a.extractAllSpacedPoints(o):a.extractAllPoints(o);s=o.shape;o=o.holes;if(p=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();L=0;for(J=o.length;L<J;L++)z=o[L],THREE.Shape.Utils.isClockWise(z)&&
|
|
|
+(o[L]=z.reverse());p=!1}p=THREE.Shape.Utils.triangulateShape(s,o);y=s;L=0;for(J=o.length;L<J;L++)z=o[L],s=s.concat(z);var C,P,R,fa,M,N,ga=s.length,ka=p.length,Z=[];C=0;P=y.length;O=P-1;for(j=C+1;C<P;C++,O++,j++)O===P&&(O=0),j===P&&(j=0),Z[C]=d(y[C],y[O],y[j]);var F=[],B,Q=Z.concat();L=0;for(J=o.length;L<J;L++){z=o[L];B=[];C=0;P=z.length;O=P-1;for(j=C+1;C<P;C++,O++,j++)O===P&&(O=0),j===P&&(j=0),B[C]=d(z[C],z[O],z[j]);F.push(B);Q=Q.concat(B)}for(R=0;R<l;R++){fa=R/l;M=i*(1-fa);fa=k*Math.sin(fa*Math.PI/
|
|
|
+2);C=0;for(P=y.length;C<P;C++)N=b(y[C],Z[C],fa),e(N.x,N.y,-M);L=0;for(J=o.length;L<J;L++){z=o[L];B=F[L];C=0;for(P=z.length;C<P;C++)N=b(z[C],B[C],fa),e(N.x,N.y,-M)}}fa=k;for(C=0;C<ga;C++)N=m?b(s[C],Q[C],fa):s[C],v?e(N.x,N.y+u[0].y,u[0].x):e(N.x,N.y,0);for(R=1;R<=n;R++)for(C=0;C<ga;C++)N=m?b(s[C],Q[C],fa):s[C],v?e(N.x,N.y+u[R-1].y,u[R-1].x):e(N.x,N.y,h/n*R);for(R=l-1;R>=0;R--){fa=R/l;M=i*(1-fa);fa=k*Math.sin(fa*Math.PI/2);C=0;for(P=y.length;C<P;C++)N=b(y[C],Z[C],fa),e(N.x,N.y,h+M);L=0;for(J=o.length;L<
|
|
|
+J;L++){z=o[L];B=F[L];C=0;for(P=z.length;C<P;C++)N=b(z[C],B[C],fa),v?e(N.x,N.y+u[n-1].y,u[n-1].x+M):e(N.x,N.y,h+M)}}if(m){m=ga*0;for(C=0;C<ka;C++)k=p[C],f(k[2]+m,k[1]+m,k[0]+m);m=ga*(n+l*2);for(C=0;C<ka;C++)k=p[C],f(k[0]+m,k[1]+m,k[2]+m)}else{for(C=0;C<ka;C++)k=p[C],f(k[2],k[1],k[0]);for(C=0;C<ka;C++)k=p[C],f(k[0]+ga*n,k[1]+ga*n,k[2]+ga*n)}var O,j,ha=0;g(y);ha+=y.length;L=0;for(J=o.length;L<J;L++)z=o[L],g(z),ha+=z.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
|
THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,e=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
|
|
|
--a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in e.faces){var i=d(e.faces[h].a,e.faces[h].b),l=d(e.faces[h].b,e.faces[h].c),m=d(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,i,m,a);b(e.faces[h].b,l,
|
|
|
-i,a);b(e.faces[h].c,m,l,a);b(i,l,m,a)}e.faces=a.faces}g.faces=e.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
+-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in e.faces){var i=d(e.faces[h].a,e.faces[h].b),k=d(e.faces[h].b,e.faces[h].c),l=d(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,i,l,a);b(e.faces[h].b,k,
|
|
|
+i,a);b(e.faces[h].c,l,k,a);b(i,k,l,a)}e.faces=a.faces}g.faces=e.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
THREE.LatheGeometry=function(a,c,b){THREE.Geometry.call(this);this.steps=c||12;this.angle=b||2*Math.PI;for(var c=this.angle/this.steps,b=[],d=[],g=[],e=[],f=(new THREE.Matrix4).setRotationZ(c),h=0;h<a.length;h++)this.vertices.push(new THREE.Vertex(a[h])),b[h]=a[h].clone(),d[h]=this.vertices.length-1;for(var i=0;i<=this.angle+0.0010;i+=c){for(h=0;h<b.length;h++)i<this.angle?(b[h]=f.multiplyVector3(b[h].clone()),this.vertices.push(new THREE.Vertex(b[h])),g[h]=this.vertices.length-1):g=e;i==0&&(e=d);
|
|
|
for(h=0;h<d.length-1;h++)this.faces.push(new THREE.Face4(g[h],g[h+1],d[h+1],d[h])),this.faceVertexUvs[0].push([new THREE.UV(1-i/this.angle,h/a.length),new THREE.UV(1-i/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,(h+1)/a.length),new THREE.UV(1-(i-c)/this.angle,h/a.length)]);d=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(a));c.index=f.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(b.z,-b.x)/2/Math.PI+0.5,Math.atan2(-b.y,Math.sqrt(b.x*b.x+b.z*b.z))/Math.PI+0.5);return c}function d(a,b,c,h){h<1?(h=new THREE.Face3(a.index,b.index,c.index,[a.position,b.position,c.position]),h.centroid.addSelf(a.position).addSelf(b.position).addSelf(c.position).divideScalar(3),h.normal=h.centroid.clone().normalize(),
|
|
|
f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([e(a.uv,a.position,h),e(b.uv,b.position,h),e(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function e(a,b,c){c<0&&a.u===
|
|
|
1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,f=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],c);d(i[0],i[4],i[3],c);d(i[0],i[3],i[5],c);d(i[0],i[5],i[2],c);d(i[1],i[2],i[5],c);d(i[1],i[5],i[3],c);d(i[1],i[3],i[4],c);d(i[1],i[4],i[2],c);this.boundingSphere=
|
|
|
{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
|
-THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var g,e=a/2,f=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var l=c/d;for(g=0;g<i;g++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-e,-(g*l-f),0)));for(g=0;g<d;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*g,c+h*(g+1),c+1+h*(g+1),c+1+h*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/d),new THREE.UV(c/b,(g+1)/d),new THREE.UV((c+1)/b,(g+1)/d),new THREE.UV((c+1)/b,g/d)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
+THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var g,e=a/2,f=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var k=c/d;for(g=0;g<i;g++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-e,-(g*k-f),0)));for(g=0;g<d;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*g,c+h*(g+1),c+1+h*(g+1),c+1+h*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/d),new THREE.UV(c/b,(g+1)/d),new THREE.UV((c+1)/b,(g+1)/d),new THREE.UV((c+1)/b,g/d)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
-THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,e=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){d=b/f;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),l=[],m=0;for(d=0;d<e;d++){var k=2*d/e,o=i*Math.sin(k*g),k=i*Math.cos(k*g);(b==0||b==f)&&d>0||(m=this.vertices.push(new THREE.Vertex(new THREE.Vector3(k,h,o)))-1);l.push(m)}c.push(l)}for(var p,q,n,g=c.length,b=0;b<g;b++)if(e=c[b].length,b>0)for(d=0;d<e;d++){l=d==e-1;f=c[b][l?0:d+1];h=c[b][l?e-1:d];i=c[b-1][l?
|
|
|
-e-1:d];l=c[b-1][l?0:d+1];o=b/(g-1);p=(b-1)/(g-1);q=(d+1)/e;var k=d/e,m=new THREE.UV(1-q,o),o=new THREE.UV(1-k,o),k=new THREE.UV(1-k,p),t=new THREE.UV(1-q,p);b<c.length-1&&(p=this.vertices[f].position.clone(),q=this.vertices[h].position.clone(),n=this.vertices[i].position.clone(),p.normalize(),q.normalize(),n.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(n.x,n.y,n.z)])),this.faceVertexUvs[0].push([m,o,k]));b>1&&(p=
|
|
|
-this.vertices[f].position.clone(),q=this.vertices[i].position.clone(),n=this.vertices[l].position.clone(),p.normalize(),q.normalize(),n.normalize(),this.faces.push(new THREE.Face3(f,i,l,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(q.x,q.y,q.z),new THREE.Vector3(n.x,n.y,n.z)])),this.faceVertexUvs[0].push([m,k,t]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,e=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){d=b/f;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),k=[],l=0;for(d=0;d<e;d++){var m=2*d/e,o=i*Math.sin(m*g),m=i*Math.cos(m*g);(b==0||b==f)&&d>0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(m,h,o)))-1);k.push(l)}c.push(k)}for(var n,s,p,g=c.length,b=0;b<g;b++)if(e=c[b].length,b>0)for(d=0;d<e;d++){k=d==e-1;f=c[b][k?0:d+1];h=c[b][k?e-1:d];i=c[b-1][k?
|
|
|
+e-1:d];k=c[b-1][k?0:d+1];o=b/(g-1);n=(b-1)/(g-1);s=(d+1)/e;var m=d/e,l=new THREE.UV(1-s,o),o=new THREE.UV(1-m,o),m=new THREE.UV(1-m,n),u=new THREE.UV(1-s,n);b<c.length-1&&(n=this.vertices[f].position.clone(),s=this.vertices[h].position.clone(),p=this.vertices[i].position.clone(),n.normalize(),s.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,o,m]));b>1&&(n=
|
|
|
+this.vertices[f].position.clone(),s=this.vertices[i].position.clone(),p=this.vertices[k].position.clone(),n.normalize(),s.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,i,k,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,m,u]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
THREE.TextGeometry=function(a,c){var b=(new THREE.TextPath(a,c)).toShapes();c.amount=c.height!==void 0?c.height:50;if(c.bevelThickness===void 0)c.bevelThickness=10;if(c.bevelSize===void 0)c.bevelSize=8;if(c.bevelEnabled===void 0)c.bevelEnabled=!1;if(c.bend){var d=b[b.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(d/2,120),new THREE.Vector2(d,0))}THREE.ExtrudeGeometry.call(this,b,c)};THREE.TextGeometry.prototype=new THREE.ExtrudeGeometry;
|
|
|
THREE.TextGeometry.prototype.constructor=THREE.TextGeometry;
|
|
|
THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:150,divisions:10,getFace:function(){return this.faces[this.face][this.weight][this.style]},loadFace:function(a){var c=a.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][a.cssFontWeight]=this.faces[c][a.cssFontWeight]||{};this.faces[c][a.cssFontWeight][a.cssFontStyle]=a;return this.faces[c][a.cssFontWeight][a.cssFontStyle]=a},drawText:function(a){for(var c=this.getFace(),b=this.size/c.resolution,d=
|
|
|
-0,g=String(a).split(""),e=g.length,f=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var e=[],f,h,i,l,m,k,o,p,q,n,t,u=c.glyphs[a]||c.glyphs["?"];if(u){if(u.o){c=u._cachedOutline||(u._cachedOutline=u.o.split(" "));l=c.length;for(a=0;a<l;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;m=c[a++]*b;e.push(new THREE.Vector2(i,m));g.moveTo(i,m);break;case "l":i=c[a++]*b+d;m=c[a++]*b;e.push(new THREE.Vector2(i,
|
|
|
-m));g.lineTo(i,m);break;case "q":i=c[a++]*b+d;m=c[a++]*b;p=c[a++]*b+d;q=c[a++]*b;g.quadraticCurveTo(p,q,i,m);if(f=e[e.length-1]){k=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++){var v=f/h,r=THREE.Shape.Utils.b2(v,k,p,i),v=THREE.Shape.Utils.b2(v,o,q,m);e.push(new THREE.Vector2(r,v))}}break;case "b":if(i=c[a++]*b+d,m=c[a++]*b,p=c[a++]*b+d,q=c[a++]*-b,n=c[a++]*b+d,t=c[a++]*-b,g.bezierCurveTo(i,m,p,q,n,t),f=e[e.length-1]){k=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++)v=f/h,r=THREE.Shape.Utils.b3(v,k,p,
|
|
|
-n,i),v=THREE.Shape.Utils.b3(v,o,q,t,m),e.push(new THREE.Vector2(r,v))}}}return{offset:u.ha*b,points:e,path:g}}}};
|
|
|
-(function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,l,m;if(c(a)>0)for(l=0;l<g;l++)f[l]=l;else for(l=0;l<g;l++)f[l]=g-1-l;var k=2*g;for(l=g-1;g>2;){if(k--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=l;g<=i&&(i=0);l=i+1;g<=l&&(l=0);m=l+1;g<=m&&(m=0);var o;a:{o=a;var p=i,q=l,n=m,t=g,u=f,v=void 0,r=void 0,z=void 0,
|
|
|
-E=void 0,N=void 0,A=void 0,J=void 0,x=void 0,w=void 0,r=o[u[p]].x,z=o[u[p]].y,E=o[u[q]].x,N=o[u[q]].y,A=o[u[n]].x,J=o[u[n]].y;if(1.0E-10>(E-r)*(J-z)-(N-z)*(A-r))o=!1;else{for(v=0;v<t;v++)if(!(v==p||v==q||v==n)){var x=o[u[v]].x,w=o[u[v]].y,D=void 0,M=void 0,S=void 0,ca=void 0,L=void 0,P=void 0,j=void 0,ea=void 0,ha=void 0,F=void 0,B=void 0,R=void 0,D=S=L=void 0,D=A-E,M=J-N,S=r-A,ca=z-J,L=E-r,P=N-z,j=x-r,ea=w-z,ha=x-E,F=w-N,B=x-A,R=w-J,D=D*F-M*ha,L=L*ea-P*j,S=S*R-ca*B;if(D>=0&&S>=0&&L>=0){o=!1;break a}}o=
|
|
|
-!0}}if(o){e.push([a[f[i]],a[f[l]],a[f[m]]]);h.push([f[i],f[l],f[m]]);i=l;for(m=l+1;m<g;i++,m++)f[i]=f[m];g--;k=2*g}}if(d)return h;return e};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
+0,g=String(a).split(""),e=g.length,f=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var e=[],f,h,i,k,l,m,o,n,s,p,u,v=c.glyphs[a]||c.glyphs["?"];if(v){if(v.o){c=v._cachedOutline||(v._cachedOutline=v.o.split(" "));k=c.length;for(a=0;a<k;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;l=c[a++]*b;e.push(new THREE.Vector2(i,l));g.moveTo(i,l);break;case "l":i=c[a++]*b+d;l=c[a++]*b;e.push(new THREE.Vector2(i,
|
|
|
+l));g.lineTo(i,l);break;case "q":i=c[a++]*b+d;l=c[a++]*b;n=c[a++]*b+d;s=c[a++]*b;g.quadraticCurveTo(n,s,i,l);if(f=e[e.length-1]){m=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++){var y=f/h,q=THREE.Shape.Utils.b2(y,m,n,i),y=THREE.Shape.Utils.b2(y,o,s,l);e.push(new THREE.Vector2(q,y))}}break;case "b":if(i=c[a++]*b+d,l=c[a++]*b,n=c[a++]*b+d,s=c[a++]*-b,p=c[a++]*b+d,u=c[a++]*-b,g.bezierCurveTo(i,l,n,s,p,u),f=e[e.length-1]){m=f.x;o=f.y;f=1;for(h=this.divisions;f<=h;f++)y=f/h,q=THREE.Shape.Utils.b3(y,m,n,
|
|
|
+p,i),y=THREE.Shape.Utils.b3(y,o,s,u,l),e.push(new THREE.Vector2(q,y))}}}return{offset:v.ha*b,points:e,path:g}}}};
|
|
|
+(function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,k,l;if(c(a)>0)for(k=0;k<g;k++)f[k]=k;else for(k=0;k<g;k++)f[k]=g-1-k;var m=2*g;for(k=g-1;g>2;){if(m--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=k;g<=i&&(i=0);k=i+1;g<=k&&(k=0);l=k+1;g<=l&&(l=0);var o;a:{o=a;var n=i,s=k,p=l,u=g,v=f,y=void 0,q=void 0,t=void 0,
|
|
|
+w=void 0,z=void 0,L=void 0,J=void 0,I=void 0,D=void 0,q=o[v[n]].x,t=o[v[n]].y,w=o[v[s]].x,z=o[v[s]].y,L=o[v[p]].x,J=o[v[p]].y;if(1.0E-10>(w-q)*(J-t)-(z-t)*(L-q))o=!1;else{for(y=0;y<u;y++)if(!(y==n||y==s||y==p)){var I=o[v[y]].x,D=o[v[y]].y,C=void 0,P=void 0,R=void 0,fa=void 0,M=void 0,N=void 0,ga=void 0,ka=void 0,Z=void 0,F=void 0,B=void 0,Q=void 0,C=R=M=void 0,C=L-w,P=J-z,R=q-L,fa=t-J,M=w-q,N=z-t,ga=I-q,ka=D-t,Z=I-w,F=D-z,B=I-L,Q=D-J,C=C*F-P*Z,M=M*ka-N*ga,R=R*Q-fa*B;if(C>=0&&R>=0&&M>=0){o=!1;break a}}o=
|
|
|
+!0}}if(o){e.push([a[f[i]],a[f[k]],a[f[l]]]);h.push([f[i],f[k],f[l]]);i=k;for(l=k+1;l<g;i++,l++)f[i]=f[l];g--;m=2*g}}if(d)return h;return e};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(a,c,b,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(e);g.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(e);h.z=
|
|
|
this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,e=(this.segmentsT+1)*(b-1)+d-1,f=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,e,f,h,[c[g],c[e],c[f],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[e]);i.normal.addSelf(c[f]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
|
|
|
this.faceVertexUvs[0].push([a[g].clone(),a[e].clone(),a[f].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
THREE.TorusKnotGeometry=function(a,c,b,d,g,e,f){function h(a,b,c,d,e,f){b=c/d*a;c=Math.cos(b);return new THREE.Vector3(e*(2+c)*0.5*Math.cos(a),e*(2+c)*Math.sin(a)*0.5,f*e*Math.sin(b)*0.5)}THREE.Geometry.call(this);this.radius=a||200;this.tube=c||40;this.segmentsR=b||64;this.segmentsT=d||8;this.p=g||2;this.q=e||3;this.heightScale=f||1;this.grid=Array(this.segmentsR);b=new THREE.Vector3;d=new THREE.Vector3;e=new THREE.Vector3;for(a=0;a<this.segmentsR;++a){this.grid[a]=Array(this.segmentsT);for(c=0;c<
|
|
|
this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;e.cross(b,d);d.cross(e,b);e.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=i*d.x+f*e.x;g.y+=i*d.y+f*e.y;g.z+=i*d.z+f*e.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
|
-g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,e=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][e],e=this.grid[a][e],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),m=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,e));this.faceVertexUvs[0].push([f,i,l,m])}this.computeCentroids();
|
|
|
+g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,e=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][e],e=this.grid[a][e],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),k=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),l=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,e));this.faceVertexUvs[0].push([f,i,k,l])}this.computeCentroids();
|
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
|
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var l,n,m,p=0;p<4;p++){m=i[p];l=new THREE.Color;l.setRGB(0,0,0);for(var q=0;q<m.length;q++)n=h.vertexColors[m[q]-1],l.r+=n.r,l.g+=n.g,l.b+=n.b;l.r/=m.length;l.g/=m.length;l.b/=m.length;k.vertexColors[p]=l}}g.push(k);(!f.supportUVs||o.length!=0)&&e.push([o[a],o[b],o[c],o[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
-b)}var d=[],g=[],e=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],m={},k={},o=[],p,q,n,t,u,v=a.faceVertexUvs[0];p=0;for(q=v.length;p<q;p++){n=0;for(t=v[p].length;n<t;n++)u=d[p]["abcd".charAt(n)],o[u]||(o[u]=v[p][n])}var r;p=0;for(q=d.length;p<q;p++)if(u=d[p],l.push(u.centroid),i.push(new THREE.Vertex(u.centroid)),f.supportUVs&&o.length!=0){r=new THREE.UV;if(u instanceof THREE.Face3)r.u=o[u.a].u+o[u.b].u+o[u.c].u,r.v=o[u.a].v+o[u.b].v+o[u.c].v,r.u/=3,r.v/=3;else if(u instanceof THREE.Face4)r.u=
|
|
|
-o[u.a].u+o[u.b].u+o[u.c].u+o[u.d].u,r.v=o[u.a].v+o[u.b].v+o[u.c].v+o[u.d].v,r.u/=4,r.v/=4;o.push(r)}q=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var z=0,v=h.length,E,N,A={},J={},x=function(a,
|
|
|
-b){A[a]===void 0&&(A[a]=[]);A[a].push(b)},w=function(a,b){J[a]===void 0&&(J[a]={});J[a][b]=null};for(p in q){r=q[p];E=p.split("_");N=E[0];E=E[1];x(N,[N,E]);x(E,[N,E]);n=0;for(t=r.length;n<t;n++)u=r[n],w(N,u,p),w(E,u,p);r.length<2&&(k[p]=!0)}for(p in q)if(r=q[p],u=r[0],r=r[1],E=p.split("_"),N=E[0],E=E[1],t=new THREE.Vector3,k[p]?(t.addSelf(h[N].position),t.addSelf(h[E].position),t.multiplyScalar(0.5)):(t.addSelf(l[u]),t.addSelf(l[r]),t.addSelf(h[N].position),t.addSelf(h[E].position),t.multiplyScalar(0.25)),
|
|
|
-m[p]=v+d.length+z,i.push(new THREE.Vertex(t)),z++,f.supportUVs&&o.length!=0)r=new THREE.UV,r.u=o[N].u+o[E].u,r.v=o[N].v+o[E].v,r.u/=2,r.v/=2,o.push(r);var D,M;E=["123","12","2","23"];t=["123","23","3","31"];var x=["123","31","1","12"],w=["1234","12","2","23"],S=["1234","23","3","34"],ca=["1234","34","4","41"],L=["1234","41","1","12"];p=0;for(q=l.length;p<q;p++)u=d[p],r=v+p,u instanceof THREE.Face3?(z=b(u.a,u.b),N=b(u.b,u.c),D=b(u.c,u.a),c(r,m[z],u.b,m[N],u,E),c(r,m[N],u.c,m[D],u,t),c(r,m[D],u.a,m[z],
|
|
|
-u,x)):u instanceof THREE.Face4?(z=b(u.a,u.b),N=b(u.b,u.c),D=b(u.c,u.d),M=b(u.d,u.a),c(r,m[z],u.b,m[N],u,w),c(r,m[N],u.c,m[D],u,S),c(r,m[D],u.d,m[M],u,ca),c(r,m[M],u.a,m[z],u,L)):console.log("face should be a face!",u);d=i;i=new THREE.Vector3;m=new THREE.Vector3;p=0;for(q=h.length;p<q;p++)if(A[p]!==void 0){i.set(0,0,0);m.set(0,0,0);u=new THREE.Vector3(0,0,0);r=0;for(n in J[p])i.addSelf(l[n]),r++;z=0;v=A[p].length;for(n=0;n<v;n++)k[b(A[p][n][0],A[p][n][1])]&&z++;if(z!=2){i.divideScalar(r);for(n=0;n<
|
|
|
-v;n++)r=A[p][n],r=h[r[0]].position.clone().addSelf(h[r[1]].position).divideScalar(2),m.addSelf(r);m.divideScalar(v);u.addSelf(h[p].position);u.multiplyScalar(v-3);u.addSelf(i);u.addSelf(m.multiplyScalar(2));u.divideScalar(v);d[p].position=u}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var l,j,n,m=0;m<4;m++){n=i[m];l=new THREE.Color;l.setRGB(0,0,0);for(var p=0;p<n.length;p++)j=h.vertexColors[n[p]-1],l.r+=j.r,l.g+=j.g,l.b+=j.b;l.r/=n.length;l.g/=n.length;l.b/=n.length;k.vertexColors[m]=l}}g.push(k);(!f.supportUVs||o.length!=0)&&e.push([o[a],o[b],o[c],o[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
+b)}var d=[],g=[],e=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),k=[],l={},m={},o=[],n,s,p,u,v,y=a.faceVertexUvs[0];n=0;for(s=y.length;n<s;n++){p=0;for(u=y[n].length;p<u;p++)v=d[n]["abcd".charAt(p)],o[v]||(o[v]=y[n][p])}var q;n=0;for(s=d.length;n<s;n++)if(v=d[n],k.push(v.centroid),i.push(new THREE.Vertex(v.centroid)),f.supportUVs&&o.length!=0){q=new THREE.UV;if(v instanceof THREE.Face3)q.u=o[v.a].u+o[v.b].u+o[v.c].u,q.v=o[v.a].v+o[v.b].v+o[v.c].v,q.u/=3,q.v/=3;else if(v instanceof THREE.Face4)q.u=
|
|
|
+o[v.a].u+o[v.b].u+o[v.c].u+o[v.d].u,q.v=o[v.a].v+o[v.b].v+o[v.c].v+o[v.d].v,q.u/=4,q.v/=4;o.push(q)}s=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var t=0,y=h.length,w,z,L={},J={},I=function(a,
|
|
|
+b){L[a]===void 0&&(L[a]=[]);L[a].push(b)},D=function(a,b){J[a]===void 0&&(J[a]={});J[a][b]=null};for(n in s){q=s[n];w=n.split("_");z=w[0];w=w[1];I(z,[z,w]);I(w,[z,w]);p=0;for(u=q.length;p<u;p++)v=q[p],D(z,v,n),D(w,v,n);q.length<2&&(m[n]=!0)}for(n in s)if(q=s[n],v=q[0],q=q[1],w=n.split("_"),z=w[0],w=w[1],u=new THREE.Vector3,m[n]?(u.addSelf(h[z].position),u.addSelf(h[w].position),u.multiplyScalar(0.5)):(u.addSelf(k[v]),u.addSelf(k[q]),u.addSelf(h[z].position),u.addSelf(h[w].position),u.multiplyScalar(0.25)),
|
|
|
+l[n]=y+d.length+t,i.push(new THREE.Vertex(u)),t++,f.supportUVs&&o.length!=0)q=new THREE.UV,q.u=o[z].u+o[w].u,q.v=o[z].v+o[w].v,q.u/=2,q.v/=2,o.push(q);var C,P;w=["123","12","2","23"];u=["123","23","3","31"];var I=["123","31","1","12"],D=["1234","12","2","23"],R=["1234","23","3","34"],fa=["1234","34","4","41"],M=["1234","41","1","12"];n=0;for(s=k.length;n<s;n++)v=d[n],q=y+n,v instanceof THREE.Face3?(t=b(v.a,v.b),z=b(v.b,v.c),C=b(v.c,v.a),c(q,l[t],v.b,l[z],v,w),c(q,l[z],v.c,l[C],v,u),c(q,l[C],v.a,l[t],
|
|
|
+v,I)):v instanceof THREE.Face4?(t=b(v.a,v.b),z=b(v.b,v.c),C=b(v.c,v.d),P=b(v.d,v.a),c(q,l[t],v.b,l[z],v,D),c(q,l[z],v.c,l[C],v,R),c(q,l[C],v.d,l[P],v,fa),c(q,l[P],v.a,l[t],v,M)):console.log("face should be a face!",v);d=i;i=new THREE.Vector3;l=new THREE.Vector3;n=0;for(s=h.length;n<s;n++)if(L[n]!==void 0){i.set(0,0,0);l.set(0,0,0);v=new THREE.Vector3(0,0,0);q=0;for(p in J[n])i.addSelf(k[p]),q++;t=0;y=L[n].length;for(p=0;p<y;p++)m[b(L[n][p][0],L[n][p][1])]&&t++;if(t!=2){i.divideScalar(q);for(p=0;p<
|
|
|
+y;p++)q=L[n][p],q=h[q[0]].position.clone().addSelf(h[q[1]].position).divideScalar(2),l.addSelf(q);l.divideScalar(y);v.addSelf(h[n].position);v.multiplyScalar(y-3);v.addSelf(i);v.addSelf(l.multiplyScalar(2));v.divideScalar(y);d[n].position=v}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
@@ -553,122 +553,122 @@ a}function d(a,c){var d=new Image;d.onload=function(){if(!b(this.width)||!b(this
|
|
|
if(f[1]!=1)a[b].wrapT=THREE.RepeatWrapping}g&&a[b].offset.set(g[0],g[1]);if(h){f={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(f[h[0]]!==void 0)a[b].wrapS=f[h[0]];if(f[h[1]]!==void 0)a[b].wrapT=f[h[1]]}d(a[b],c+"/"+e)}function e(a){return(a[0]*255<<16)+(a[1]*255<<8)+a[2]*255}var f,h,i;h="MeshLambertMaterial";f={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:a.wireframe};a.shading&&(a.shading=="Phong"?h="MeshPhongMaterial":a.shading=="Basic"&&(h="MeshBasicMaterial"));
|
|
|
if(a.blending)if(a.blending=="Additive")f.blending=THREE.AdditiveBlending;else if(a.blending=="Subtractive")f.blending=THREE.SubtractiveBlending;else if(a.blending=="Multiply")f.blending=THREE.MultiplyBlending;if(a.transparent!==void 0||a.opacity<1)f.transparent=a.transparent;if(a.depthTest!==void 0)f.depthTest=a.depthTest;if(a.vertexColors!==void 0)if(a.vertexColors=="face")f.vertexColors=THREE.FaceColors;else if(a.vertexColors)f.vertexColors=THREE.VertexColors;if(a.colorDiffuse)f.color=e(a.colorDiffuse);
|
|
|
else if(a.DbgColor)f.color=a.DbgColor;if(a.colorSpecular)f.specular=e(a.colorSpecular);if(a.colorAmbient)f.ambient=e(a.colorAmbient);if(a.transparency)f.opacity=a.transparency;if(a.specularCoef)f.shininess=a.specularCoef;a.mapDiffuse&&c&&g(f,"map",a.mapDiffuse,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap);a.mapLight&&c&&g(f,"lightMap",a.mapLight,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap);a.mapNormal&&c&&g(f,"normalMap",a.mapNormal,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap);
|
|
|
-a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var l=THREE.ShaderUtils.lib.normal,m=THREE.UniformsUtils.clone(l.uniforms),k=f.color;h=f.specular;i=f.ambient;var o=f.shininess;m.tNormal.texture=f.normalMap;if(a.mapNormalFactor)m.uNormalScale.value=a.mapNormalFactor;if(f.map)m.tDiffuse.texture=f.map,m.enableDiffuse.value=!0;if(f.specularMap)m.tSpecular.texture=f.specularMap,m.enableSpecular.value=!0;if(f.lightMap)m.tAO.texture=
|
|
|
-f.lightMap,m.enableAO.value=!0;m.uDiffuseColor.value.setHex(k);m.uSpecularColor.value.setHex(h);m.uAmbientColor.value.setHex(i);m.uShininess.value=o;if(f.opacity)m.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:l.fragmentShader,vertexShader:l.vertexShader,uniforms:m,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
|
+a.mapSpecular&&c&&g(f,"specularMap",a.mapSpecular,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap);if(a.mapNormal){var k=THREE.ShaderUtils.lib.normal,l=THREE.UniformsUtils.clone(k.uniforms),m=f.color;h=f.specular;i=f.ambient;var o=f.shininess;l.tNormal.texture=f.normalMap;if(a.mapNormalFactor)l.uNormalScale.value=a.mapNormalFactor;if(f.map)l.tDiffuse.texture=f.map,l.enableDiffuse.value=!0;if(f.specularMap)l.tSpecular.texture=f.specularMap,l.enableSpecular.value=!0;if(f.lightMap)l.tAO.texture=
|
|
|
+f.lightMap,l.enableAO.value=!0;l.uDiffuseColor.value.setHex(m);l.uSpecularColor.value.setHex(h);l.uAmbientColor.value.setHex(i);l.uShininess.value=o;if(f.opacity)l.uOpacity.value=f.opacity;f=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:l,lights:!0,fog:!0})}else f=new THREE[h](f);return f}};THREE.BinaryLoader=function(a){THREE.Loader.call(this,a)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
|
THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
THREE.BinaryLoader.prototype.load=function(a,c,b,d){if(a instanceof Object){console.warn("DEPRECATED: BinaryLoader( parameters ) is now BinaryLoader( url, callback, texturePath, binaryPath ).");var g=a,a=g.model,c=g.callback,b=g.texture_path,d=g.bin_path}var b=b?b:this.extractUrlbase(a),d=d?d:this.extractUrlbase(a),g=Date.now(),a=new Worker(a),e=this.showProgress?THREE.Loader.prototype.updateProgress:null;a.onmessage=function(a){THREE.BinaryLoader.prototype.loadAjaxBuffers(a.data.buffers,a.data.materials,
|
|
|
c,d,b,e)};a.onerror=function(a){alert("worker.onerror: "+a.message+"\n"+a.data);a.preventDefault()};a.postMessage(g)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g,e){var f=new XMLHttpRequest,h=d+"/"+a,i=0;f.onreadystatechange=function(){f.readyState==4?f.status==200||f.status==0?THREE.BinaryLoader.prototype.createBinModel(f.responseText,b,g,c):alert("Couldn't load ["+h+"] ["+f.status+"]"):f.readyState==3?e&&(i==0&&(i=f.getResponseHeader("Content-Length")),e({total:i,loaded:f.responseText.length})):f.readyState==2&&(i=f.getResponseHeader("Content-Length"))};f.open("GET",h,!0);f.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a,b){var d=m(a,b),e=m(a,b+1),f=m(a,b+2),g=m(a,b+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function g(a,b){var c=m(a,b),d=m(a,b+1),e=m(a,b+2);return(m(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=m(a,b);return(m(a,b+1)<<8)+c}function l(a,b){var c=m(a,b);return c>127?c-256:c}function m(a,b){return a.charCodeAt(b)&255}function k(b){var c,
|
|
|
-d,e;c=g(a,b);d=g(a,b+N);e=g(a,b+A);b=i(a,b+J);u.faces.push(new THREE.Face3(c,d,e,null,null,b))}function o(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+N);e=g(a,b+A);f=i(a,b+J);j=g(a,b+x);k=g(a,b+w);l=g(a,b+D);var b=z[k*3],n=z[k*3+1];k=z[k*3+2];var m=z[l*3],p=z[l*3+1];l=z[l*3+2];u.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(z[j*3],z[j*3+1],z[j*3+2]),new THREE.Vector3(b,n,k),new THREE.Vector3(m,p,l)],null,f))}function p(b){var c,d,e,f;c=g(a,b);d=g(a,b+M);e=g(a,b+S);f=g(a,b+ca);b=i(a,b+L);u.faces.push(new THREE.Face4(c,
|
|
|
-d,e,f,null,null,b))}function q(b){var c,d,e,f,k,l,n,m,p;c=g(a,b);d=g(a,b+M);e=g(a,b+S);f=g(a,b+ca);k=i(a,b+L);l=g(a,b+P);n=g(a,b+j);m=g(a,b+ea);p=g(a,b+ha);var b=z[n*3],o=z[n*3+1];n=z[n*3+2];var Q=z[m*3],G=z[m*3+1];m=z[m*3+2];var H=z[p*3],q=z[p*3+1];p=z[p*3+2];u.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(z[l*3],z[l*3+1],z[l*3+2]),new THREE.Vector3(b,o,n),new THREE.Vector3(Q,G,m),new THREE.Vector3(H,q,p)],null,k))}function n(b){var c,d,e,f;c=g(a,b);d=g(a,b+F);e=g(a,b+B);b=E[c*2];f=E[c*2+
|
|
|
-1];c=E[d*2];var i=u.faceVertexUvs[0];d=E[d*2+1];var j=E[e*2];e=E[e*2+1];var k=[];k.push(new THREE.UV(b,f));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function t(b){var c,d,e,f,i,j;c=g(a,b);d=g(a,b+R);e=g(a,b+Y);f=g(a,b+O);b=E[c*2];i=E[c*2+1];c=E[d*2];j=E[d*2+1];d=E[e*2];var k=u.faceVertexUvs[0];e=E[e*2+1];var l=E[f*2];f=E[f*2+1];var n=[];n.push(new THREE.UV(b,i));n.push(new THREE.UV(c,j));n.push(new THREE.UV(d,e));n.push(new THREE.UV(l,f));k.push(n)}var u=this,v=0,r,z=[],E=[],N,
|
|
|
-A,J,x,w,D,M,S,ca,L,P,j,ea,ha,F,B,R,Y,O,ga,$,X,aa,ba,V;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(u,d,b);r={signature:a.substr(v,8),header_bytes:m(a,v+8),vertex_coordinate_bytes:m(a,v+9),normal_coordinate_bytes:m(a,v+10),uv_coordinate_bytes:m(a,v+11),vertex_index_bytes:m(a,v+12),normal_index_bytes:m(a,v+13),uv_index_bytes:m(a,v+14),material_index_bytes:m(a,v+15),nvertices:g(a,v+16),nnormals:g(a,v+16+4),nuvs:g(a,v+16+8),ntri_flat:g(a,v+16+12),ntri_smooth:g(a,v+16+16),ntri_flat_uv:g(a,
|
|
|
-v+16+20),ntri_smooth_uv:g(a,v+16+24),nquad_flat:g(a,v+16+28),nquad_smooth:g(a,v+16+32),nquad_flat_uv:g(a,v+16+36),nquad_smooth_uv:g(a,v+16+40)};v+=r.header_bytes;N=r.vertex_index_bytes;A=r.vertex_index_bytes*2;J=r.vertex_index_bytes*3;x=r.vertex_index_bytes*3+r.material_index_bytes;w=r.vertex_index_bytes*3+r.material_index_bytes+r.normal_index_bytes;D=r.vertex_index_bytes*3+r.material_index_bytes+r.normal_index_bytes*2;M=r.vertex_index_bytes;S=r.vertex_index_bytes*2;ca=r.vertex_index_bytes*3;L=r.vertex_index_bytes*
|
|
|
-4;P=r.vertex_index_bytes*4+r.material_index_bytes;j=r.vertex_index_bytes*4+r.material_index_bytes+r.normal_index_bytes;ea=r.vertex_index_bytes*4+r.material_index_bytes+r.normal_index_bytes*2;ha=r.vertex_index_bytes*4+r.material_index_bytes+r.normal_index_bytes*3;F=r.uv_index_bytes;B=r.uv_index_bytes*2;R=r.uv_index_bytes;Y=r.uv_index_bytes*2;O=r.uv_index_bytes*3;b=r.vertex_index_bytes*3+r.material_index_bytes;V=r.vertex_index_bytes*4+r.material_index_bytes;ga=r.ntri_flat*b;$=r.ntri_smooth*(b+r.normal_index_bytes*
|
|
|
-3);X=r.ntri_flat_uv*(b+r.uv_index_bytes*3);aa=r.ntri_smooth_uv*(b+r.normal_index_bytes*3+r.uv_index_bytes*3);ba=r.nquad_flat*V;b=r.nquad_smooth*(V+r.normal_index_bytes*4);V=r.nquad_flat_uv*(V+r.uv_index_bytes*4);v+=function(b){for(var d,e,g,h=r.vertex_coordinate_bytes*3,i=b+r.nvertices*h;b<i;b+=h)d=c(a,b),e=c(a,b+r.vertex_coordinate_bytes),g=c(a,b+r.vertex_coordinate_bytes*2),u.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return r.nvertices*h}(v);v+=function(b){for(var c,d,e,f=r.normal_coordinate_bytes*
|
|
|
-3,g=b+r.nnormals*f;b<g;b+=f)c=l(a,b),d=l(a,b+r.normal_coordinate_bytes),e=l(a,b+r.normal_coordinate_bytes*2),z.push(c/127,d/127,e/127);return r.nnormals*f}(v);v+=function(b){for(var d,e,g=r.uv_coordinate_bytes*2,h=b+r.nuvs*g;b<h;b+=g)d=c(a,b),e=c(a,b+r.uv_coordinate_bytes),E.push(d,e);return r.nuvs*g}(v);ga=v+ga;$=ga+$;X=$+X;aa=X+aa;ba=aa+ba;b=ba+b;V=b+V;(function(a){var b,c=r.vertex_index_bytes*3+r.material_index_bytes,d=c+r.uv_index_bytes*3,e=a+r.ntri_flat_uv*d;for(b=a;b<e;b+=d)k(b),n(b+c);return e-
|
|
|
-a})($);(function(a){var b,c=r.vertex_index_bytes*3+r.material_index_bytes+r.normal_index_bytes*3,d=c+r.uv_index_bytes*3,e=a+r.ntri_smooth_uv*d;for(b=a;b<e;b+=d)o(b),n(b+c);return e-a})(X);(function(a){var b,c=r.vertex_index_bytes*4+r.material_index_bytes,d=c+r.uv_index_bytes*4,e=a+r.nquad_flat_uv*d;for(b=a;b<e;b+=d)p(b),t(b+c);return e-a})(b);(function(a){var b,c=r.vertex_index_bytes*4+r.material_index_bytes+r.normal_index_bytes*4,d=c+r.uv_index_bytes*4,e=a+r.nquad_smooth_uv*d;for(b=a;b<e;b+=d)q(b),
|
|
|
-t(b+c);return e-a})(V);(function(a){var b,c=r.vertex_index_bytes*3+r.material_index_bytes,d=a+r.ntri_flat*c;for(b=a;b<d;b+=c)k(b);return d-a})(v);(function(a){var b,c=r.vertex_index_bytes*3+r.material_index_bytes+r.normal_index_bytes*3,d=a+r.ntri_smooth*c;for(b=a;b<d;b+=c)o(b);return d-a})(ga);(function(a){var b,c=r.vertex_index_bytes*4+r.material_index_bytes,d=a+r.nquad_flat*c;for(b=a;b<d;b+=c)p(b);return d-a})(aa);(function(a){var b,c=r.vertex_index_bytes*4+r.material_index_bytes+r.normal_index_bytes*
|
|
|
-4,d=a+r.nquad_smooth*c;for(b=a;b<d;b+=c)q(b);return d-a})(ba);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
|
|
|
-THREE.ColladaLoader=function(){function a(a,d,g){$=a;d=d||ba;g!==void 0&&(a=g.split("/"),a.pop(),sa=a.length<1?"":a.join("/")+"/");C=c("//dae:library_images/dae:image",f,"image");ja=c("//dae:library_materials/dae:material",J,"material");na=c("//dae:library_effects/dae:effect",S,"effect");da=c("//dae:library_geometries/dae:geometry",t,"geometry");Z=c("//dae:library_controllers/dae:controller",h,"controller");I=c("//dae:library_animations/dae:animation",L,"animation");oa=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
-m,"visual_scene");ra=[];ua=[];(a=$.evaluate(".//dae:scene/dae:instance_visual_scene",$,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),aa=oa[a]):aa=null;X=new THREE.Object3D;for(a=0;a<aa.nodes.length;a++)X.add(e(aa.nodes[a]));b();for(var i in I);i={scene:X,morphs:ra,skins:ua,dae:{images:C,materials:ja,effects:na,geometries:da,controllers:Z,animations:I,visualScenes:oa,scene:aa}};d&&d(i);return i}function c(a,b,c){for(var a=$.evaluate(a,$,ha,
|
|
|
-XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in I)for(var e=I[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=
|
|
|
-a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=Z[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=aa.getChildById(c.skeleton[0],!0)||aa.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,
|
|
|
-n;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);for(e=0;e<g.frames;e++){var m=[],p=[];for(h=0;h<a.vertices.length;h++)p.push(new THREE.Vertex(new THREE.Vector3));d(c,m,e);h=m;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],n=-1,j.type=="JOINT"){for(var o=0;o<i.joints.length;o++)if(j.sid==i.joints[o]){n=o;break}if(n>=0){o=i.invBindMatrices[n];j.invBindMatrix=o;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,o);j.weights=[];for(o=0;o<i.weights.length;o++)for(var q=
|
|
|
-0;q<i.weights[o].length;q++){var t=i.weights[o][q];t.joint==n&&j.weights.push(t)}}else throw"ColladaLoader: Could not find joint '"+j.sid+"'.";}for(h=0;h<m.length;h++)if(m[h].type=="JOINT")for(i=0;i<m[h].weights.length;i++)j=m[h].weights[i],k=j.index,j=j.weight,n=a.vertices[k],k=p[k],l.x=n.position.x,l.y=n.position.y,l.z=n.position.z,m[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:p})}}}function e(a){var b=
|
|
|
-new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=Z[a.controllers[f].url];switch(i.type){case "skin":if(da[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(Z[i.skin.source]&&(d=i=Z[i.skin.source],i.morph&&da[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(da[i.morph.source])j=new n,j.url=
|
|
|
-i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=da[i.url],k={},l=0,m;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){m=j[h];var o=na[ja[m.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;m=k[m.symbol]=
|
|
|
-o.material;l++}j=m||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=Z[c.url],j.skinInstanceController=c,j.name="skin_"+ua.length,ua.push(j);else if(d!==void 0){h=i;k=d instanceof p?Z[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");
|
|
|
-else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=da[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+ra.length;ra.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
|
|
|
-b.scale);for(f=0;f<a.nodes.length;f++)b.add(e(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function m(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function k(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
|
|
|
-[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function p(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function t(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function v(){}function r(){this.material="";this.count=
|
|
|
-0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function z(){this.source="";this.stride=this.count=0;this.params=[]}function E(){this.input={}}function N(){this.semantic="";this.offset=0;this.source="";this.set=0}function A(a){this.id=a;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function x(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function w(a,
|
|
|
-b){this.type=a;this.effect=b;this.material=null}function D(a){this.effect=a;this.format=this.init_from=null}function M(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function S(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function ca(){this.url=""}function L(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function P(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
|
|
|
-this.dotSyntax=this.sid=null}function j(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ea(a){var b=a.getAttribute("id");if(V[b]!=void 0)return V[b];V[b]=(new A(b)).parse(a);return V[b]}function ha(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function F(a){for(var a=R(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function B(a){for(var a=R(a),b=[],c=0;c<
|
|
|
-a.length;c++)b.push(parseInt(a[c],10));return b}function R(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function Y(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function O(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ga(a,b){var c="";c+=O(a.x,b)+",";c+=O(a.y,b)+",";c+=O(a.z,b);return c}var $=null,X=null,aa,ba=null,V=
|
|
|
-{},C={},I={},Z={},da={},ja={},na={},oa,sa,ra,ua,xa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).parse(c);this.type=c.nodeName;
|
|
|
-break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new A).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=
|
|
|
-e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new N).parse(d))}}return b};l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=
|
|
|
-F(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new A).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=
|
|
|
-(new N).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new N).parse(g));break;case "v":c=B(g.textContent);break;case "vcount":d=B(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var n=
|
|
|
-e[l],m=c[g+n.offset];switch(n.semantic){case "JOINT":k.joint=m;break;case "WEIGHT":k.weight=b[n.source].data[m]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};m.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};m.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};m.prototype.parse=function(a){this.id=
|
|
|
-a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new k).parse(c))}}return this};k.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();
|
|
|
-for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};k.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.getTransformBySid=
|
|
|
-function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};k.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==
|
|
|
-1)switch(b.nodeName){case "node":this.nodes.push((new k).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new p).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=$.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",$,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new k).parse(b));break;
|
|
|
-case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in I)for(var e=I[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=
|
|
|
-1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,l,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){l=j.output[i];break}g=l!==void 0?l instanceof THREE.Matrix4?
|
|
|
-g.multiply(g,l):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};k.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=F(a.textContent);this.updateMatrix();return this};
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a,b){var d=l(a,b),e=l(a,b+1),f=l(a,b+2),g=l(a,b+3),h=(g<<1&255|f>>7)-127;d|=(f&127)<<16|e<<8;if(d==0&&h==-127)return 0;return(1-2*(g>>7))*(1+d*Math.pow(2,-23))*Math.pow(2,h)}function g(a,b){var c=l(a,b),d=l(a,b+1),e=l(a,b+2);return(l(a,b+3)<<24)+(e<<16)+(d<<8)+c}function i(a,b){var c=l(a,b);return(l(a,b+1)<<8)+c}function k(a,b){var c=l(a,b);return c>127?c-256:c}function l(a,b){return a.charCodeAt(b)&255}function m(b){var c,
|
|
|
+d,e;c=g(a,b);d=g(a,b+z);e=g(a,b+L);b=i(a,b+J);v.faces.push(new THREE.Face3(c,d,e,null,null,b))}function o(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+z);e=g(a,b+L);f=i(a,b+J);j=g(a,b+I);k=g(a,b+D);l=g(a,b+C);var b=t[k*3],m=t[k*3+1];k=t[k*3+2];var n=t[l*3],o=t[l*3+1];l=t[l*3+2];v.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(t[j*3],t[j*3+1],t[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,o,l)],null,f))}function n(b){var c,d,e,f;c=g(a,b);d=g(a,b+P);e=g(a,b+R);f=g(a,b+fa);b=i(a,b+M);v.faces.push(new THREE.Face4(c,
|
|
|
+d,e,f,null,null,b))}function s(b){var c,d,e,f,j,k,l,m,n;c=g(a,b);d=g(a,b+P);e=g(a,b+R);f=g(a,b+fa);j=i(a,b+M);k=g(a,b+N);l=g(a,b+ga);m=g(a,b+ka);n=g(a,b+Z);var b=t[l*3],o=t[l*3+1];l=t[l*3+2];var x=t[m*3],p=t[m*3+1];m=t[m*3+2];var E=t[n*3],q=t[n*3+1];n=t[n*3+2];v.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(t[k*3],t[k*3+1],t[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(x,p,m),new THREE.Vector3(E,q,n)],null,j))}function p(b){var c,d,e,f;c=g(a,b);d=g(a,b+F);e=g(a,b+B);b=w[c*2];f=w[c*2+
|
|
|
+1];c=w[d*2];var i=v.faceVertexUvs[0];d=w[d*2+1];var j=w[e*2];e=w[e*2+1];var k=[];k.push(new THREE.UV(b,f));k.push(new THREE.UV(c,d));k.push(new THREE.UV(j,e));i.push(k)}function u(b){var c,d,e,f,i,k;c=g(a,b);d=g(a,b+Q);e=g(a,b+O);f=g(a,b+j);b=w[c*2];i=w[c*2+1];c=w[d*2];k=w[d*2+1];d=w[e*2];var l=v.faceVertexUvs[0];e=w[e*2+1];var m=w[f*2];f=w[f*2+1];var n=[];n.push(new THREE.UV(b,i));n.push(new THREE.UV(c,k));n.push(new THREE.UV(d,e));n.push(new THREE.UV(m,f));l.push(n)}var v=this,y=0,q,t=[],w=[],z,
|
|
|
+L,J,I,D,C,P,R,fa,M,N,ga,ka,Z,F,B,Q,O,j,ha,aa,V,ba,U,ea;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(v,d,b);q={signature:a.substr(y,8),header_bytes:l(a,y+8),vertex_coordinate_bytes:l(a,y+9),normal_coordinate_bytes:l(a,y+10),uv_coordinate_bytes:l(a,y+11),vertex_index_bytes:l(a,y+12),normal_index_bytes:l(a,y+13),uv_index_bytes:l(a,y+14),material_index_bytes:l(a,y+15),nvertices:g(a,y+16),nnormals:g(a,y+16+4),nuvs:g(a,y+16+8),ntri_flat:g(a,y+16+12),ntri_smooth:g(a,y+16+16),ntri_flat_uv:g(a,
|
|
|
+y+16+20),ntri_smooth_uv:g(a,y+16+24),nquad_flat:g(a,y+16+28),nquad_smooth:g(a,y+16+32),nquad_flat_uv:g(a,y+16+36),nquad_smooth_uv:g(a,y+16+40)};y+=q.header_bytes;z=q.vertex_index_bytes;L=q.vertex_index_bytes*2;J=q.vertex_index_bytes*3;I=q.vertex_index_bytes*3+q.material_index_bytes;D=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes;C=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*2;P=q.vertex_index_bytes;R=q.vertex_index_bytes*2;fa=q.vertex_index_bytes*3;M=q.vertex_index_bytes*
|
|
|
+4;N=q.vertex_index_bytes*4+q.material_index_bytes;ga=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;ka=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*2;Z=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;F=q.uv_index_bytes;B=q.uv_index_bytes*2;Q=q.uv_index_bytes;O=q.uv_index_bytes*2;j=q.uv_index_bytes*3;b=q.vertex_index_bytes*3+q.material_index_bytes;ea=q.vertex_index_bytes*4+q.material_index_bytes;ha=q.ntri_flat*b;aa=q.ntri_smooth*(b+q.normal_index_bytes*
|
|
|
+3);V=q.ntri_flat_uv*(b+q.uv_index_bytes*3);ba=q.ntri_smooth_uv*(b+q.normal_index_bytes*3+q.uv_index_bytes*3);U=q.nquad_flat*ea;b=q.nquad_smooth*(ea+q.normal_index_bytes*4);ea=q.nquad_flat_uv*(ea+q.uv_index_bytes*4);y+=function(b){for(var d,e,g,h=q.vertex_coordinate_bytes*3,i=b+q.nvertices*h;b<i;b+=h)d=c(a,b),e=c(a,b+q.vertex_coordinate_bytes),g=c(a,b+q.vertex_coordinate_bytes*2),v.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return q.nvertices*h}(y);y+=function(b){for(var c,d,e,f=q.normal_coordinate_bytes*
|
|
|
+3,g=b+q.nnormals*f;b<g;b+=f)c=k(a,b),d=k(a,b+q.normal_coordinate_bytes),e=k(a,b+q.normal_coordinate_bytes*2),t.push(c/127,d/127,e/127);return q.nnormals*f}(y);y+=function(b){for(var d,e,g=q.uv_coordinate_bytes*2,h=b+q.nuvs*g;b<h;b+=g)d=c(a,b),e=c(a,b+q.uv_coordinate_bytes),w.push(d,e);return q.nuvs*g}(y);ha=y+ha;aa=ha+aa;V=aa+V;ba=V+ba;U=ba+U;b=U+b;ea=b+ea;(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes,d=c+q.uv_index_bytes*3,e=a+q.ntri_flat_uv*d;for(b=a;b<e;b+=d)m(b),p(b+c);return e-
|
|
|
+a})(aa);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,d=c+q.uv_index_bytes*3,e=a+q.ntri_smooth_uv*d;for(b=a;b<e;b+=d)o(b),p(b+c);return e-a})(V);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes,d=c+q.uv_index_bytes*4,e=a+q.nquad_flat_uv*d;for(b=a;b<e;b+=d)n(b),u(b+c);return e-a})(b);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*4,d=c+q.uv_index_bytes*4,e=a+q.nquad_smooth_uv*d;for(b=a;b<e;b+=d)s(b),
|
|
|
+u(b+c);return e-a})(ea);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes,d=a+q.ntri_flat*c;for(b=a;b<d;b+=c)m(b);return d-a})(y);(function(a){var b,c=q.vertex_index_bytes*3+q.material_index_bytes+q.normal_index_bytes*3,d=a+q.ntri_smooth*c;for(b=a;b<d;b+=c)o(b);return d-a})(ha);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes,d=a+q.nquad_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(ba);(function(a){var b,c=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*
|
|
|
+4,d=a+q.nquad_smooth*c;for(b=a;b<d;b+=c)s(b);return d-a})(U);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
|
|
|
+THREE.ColladaLoader=function(){function a(a,d,g){aa=a;d=d||U;g!==void 0&&(a=g.split("/"),a.pop(),va=a.length<1?"":a.join("/")+"/");ca=c("//dae:library_images/dae:image",f,"image");oa=c("//dae:library_materials/dae:material",J,"material");na=c("//dae:library_effects/dae:effect",R,"effect");la=c("//dae:library_geometries/dae:geometry",u,"geometry");$=c("//dae:library_controllers/dae:controller",h,"controller");K=c("//dae:library_animations/dae:animation",M,"animation");ua=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
+l,"visual_scene");pa=[];ra=[];(a=aa.evaluate(".//dae:scene/dae:instance_visual_scene",aa,Z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ba=ua[a]):ba=null;V=new THREE.Object3D;for(a=0;a<ba.nodes.length;a++)V.add(e(ba.nodes[a]));b();for(var i in K);i={scene:V,morphs:pa,skins:ra,dae:{images:ca,materials:oa,effects:na,geometries:la,controllers:$,animations:K,visualScenes:ua,scene:ba}};d&&d(i);return i}function c(a,b,c){for(var a=aa.evaluate(a,aa,
|
|
|
+Z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in K)for(var e=K[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=
|
|
|
+a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=$[c.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=b(),c=ba.getChildById(c.skeleton[0],!0)||ba.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,
|
|
|
+m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=
|
|
|
+0;q<i.weights[p].length;q++){var s=i.weights[p][q];s.joint==m&&j.weights.push(s)}}else throw"ColladaLoader: Could not find joint '"+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function e(a){var b=
|
|
|
+new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=$[a.controllers[f].url];switch(i.type){case "skin":if(la[i.skin.source]){var j=new p;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if($[i.skin.source]&&(d=i=$[i.skin.source],i.morph&&la[i.morph.source]))j=new p,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(la[i.morph.source])j=new p,j.url=
|
|
|
+i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=la[i.url],k={},l=0,m;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){m=j[h];var o=na[oa[m.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;m=k[m.symbol]=
|
|
|
+o.material;l++}j=m||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=$[c.url],j.skinInstanceController=c,j.name="skin_"+ra.length,ra.push(j);else if(d!==void 0){h=i;k=d instanceof n?$[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");
|
|
|
+else{k=k.morph;for(l=0;l<k.targets.length;l++)if(o=la[k.targets[l]],o.mesh&&o.mesh.primitives&&o.mesh.primitives.length)o=o.mesh.primitives[0].geometry,o.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:o.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+pa.length;pa.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
|
|
|
+b.scale);for(f=0;f<a.nodes.length;f++)b.add(e(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function k(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function l(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function m(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
|
|
|
+[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function o(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function n(){this.url="";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function p(){this.url="";this.instance_material=[]}function u(){this.id="";this.mesh=null}function v(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function y(){}function q(){this.material="";this.count=
|
|
|
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function t(){this.source="";this.stride=this.count=0;this.params=[]}function w(){this.input={}}function z(){this.semantic="";this.offset=0;this.source="";this.set=0}function L(a){this.id=a;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function I(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function D(a,
|
|
|
+b){this.type=a;this.effect=b;this.material=null}function C(a){this.effect=a;this.format=this.init_from=null}function P(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function R(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function fa(){this.url=""}function M(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function N(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
|
|
|
+this.dotSyntax=this.sid=null}function ga(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ka(a){var b=a.getAttribute("id");if(ea[b]!=void 0)return ea[b];ea[b]=(new L(b)).parse(a);return ea[b]}function Z(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function F(a){for(var a=Q(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function B(a){for(var a=Q(a),b=[],
|
|
|
+c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function Q(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function O(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function j(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ha(a,b){var c="";c+=j(a.x,b)+",";c+=j(a.y,b)+",";c+=j(a.z,b);return c}var aa=null,V=null,ba,U=
|
|
|
+null,ea={},ca={},K={},$={},la={},oa={},na={},ua,va,pa,ra,Aa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new k).parse(c);this.type=
|
|
|
+c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new L).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=
|
|
|
+e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new z).parse(d))}}return b};k.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=
|
|
|
+F(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new L).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};k.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=
|
|
|
+(new z).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};k.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new z).parse(g));break;case "v":c=B(g.textContent);break;case "vcount":d=B(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=
|
|
|
+e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};l.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};l.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};l.prototype.parse=function(a){this.id=
|
|
|
+a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new m).parse(c))}}return this};m.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();
|
|
|
+for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};m.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};m.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};m.prototype.getTransformBySid=
|
|
|
+function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};m.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var c=0;c<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==
|
|
|
+1)switch(b.nodeName){case "node":this.nodes.push((new m).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new n).parse(b));break;case "instance_geometry":this.geometries.push((new p).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=aa.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",aa,Z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new m).parse(b));break;
|
|
|
+case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new o).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in K)for(var e=K[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=
|
|
|
+1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?
|
|
|
+g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}this.updateMatrix();return this};m.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};o.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=F(a.textContent);this.updateMatrix();return this};
|
|
|
o.prototype.updateMatrix=function(){var a=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],
|
|
|
-this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};p.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=$.evaluate(".//dae:instance_material",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
-null))for(var d=c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=$.evaluate(".//dae:instance_material",
|
|
|
-c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};t.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new u(this)).parse(c)}}return this};u.prototype.parse=function(a){function b(a,c){var d=ga(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=
|
|
|
-0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":ea(d);break;case "vertices":this.vertices=(new E).parse(d);break;case "triangles":this.primitives.push((new r).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new v).parse(d))}}var e={};this.geometry3js=new THREE.Geometry;d=V[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+
|
|
|
-1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};u.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,n=0,m=3,p=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":p.push(i.set)}for(;d<
|
|
|
-g.length;){var o=[],q=[],t={},r=[];a.vcount&&(m=a.vcount[n++]);for(e=0;e<m;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=V[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=ga(b.vertices[j].position);o.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],l.data[k+1],l.data[k+2]));break;case "TEXCOORD":t[i.set]===void 0&&(t[i.set]=[]);t[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(l.data[k],
|
|
|
-l.data[k+1],l.data[k+2]))}var u;m==3?u=new THREE.Face3(o[0],o[1],o[2],[q[0],q[1],q[2]],r.length?r:new THREE.Color):m==4&&(u=new THREE.Face4(o[0],o[1],o[2],o[3],[q[0],q[1],q[2],q[3]],r.length?r:new THREE.Color));u.daeMaterial=a.material;b.faces.push(u);for(f=0;f<p.length;f++)e=t[p[f]],b.faceVertexUvs[f].push([e[0],e[1],e[2]]);d+=h.length*m}};v.prototype=new r;v.prototype.constructor=v;r.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=
|
|
|
-a.input.POSITION.source};r.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=Y(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new N).parse(a.childNodes[b]));break;case "vcount":this.vcount=B(c.textContent);break;case "p":this.p=B(c.textContent)}}return this};z.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=Y(a,"count",0);this.stride=
|
|
|
-Y(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new N).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};N.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
|
|
|
-"");this.set=Y(a,"set",-1);this.offset=Y(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};A.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=R(c.textContent),e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=F(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
-B(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=R(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new z).parse(c.childNodes[d]);break}}}return this};A.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=
|
|
|
-this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new ca).parse(a.childNodes[b]);break}return this};x.prototype.isColor=
|
|
|
-function(){return this.texture==null};x.prototype.isTexture=function(){return this.texture!=null};x.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=F(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};w.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=
|
|
|
-a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new x).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=$.evaluate(".//dae:float",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};w.prototype.create=function(){var a=
|
|
|
-{},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof x)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=C[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(sa+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=
|
|
|
-d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=xa;return this.material=new THREE.MeshLambertMaterial(a)};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
|
|
|
-c.nodeName)}}return this};M.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};
|
|
|
-S.prototype.create=function(){if(this.shader==null)return null};S.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};S.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=
|
|
|
-(new D(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new M(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};S.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};
|
|
|
-S.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new w(c.nodeName,this)).parse(c)}}};ca.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};L.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==
|
|
|
-1)switch(c.nodeName){case "source":c=(new A).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new j(this)).parse(c));break;case "channel":this.channel.push((new P(this)).parse(c))}}return this};P.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");
|
|
|
-a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};j.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new N).parse(c))}}return this};j.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];
|
|
|
+this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=aa.evaluate(".//dae:instance_material",c,Z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
+null))for(var d=c.iterateNext();d;)this.instance_material.push((new s).parse(d)),d=c.iterateNext()}}return this};s.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};p.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=aa.evaluate(".//dae:instance_material",
|
|
|
+c,Z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new s).parse(b)),b=a.iterateNext();break}}return this};u.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new v(this)).parse(c)}}return this};v.prototype.parse=function(a){function b(a,c){var d=ha(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=
|
|
|
+0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":ka(d);break;case "vertices":this.vertices=(new w).parse(d);break;case "triangles":this.primitives.push((new q).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new y).parse(d))}}var e={};this.geometry3js=new THREE.Geometry;d=ea[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],
|
|
|
+d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};v.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<
|
|
|
+g.length;){var p=[],q=[],s={},v=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=ea[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=ha(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],l.data[k+1],l.data[k+2]));break;case "TEXCOORD":s[i.set]===void 0&&(s[i.set]=[]);s[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":v.push((new THREE.Color).setRGB(l.data[k],
|
|
|
+l.data[k+1],l.data[k+2]))}var u;n==3?u=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],v.length?v:new THREE.Color):n==4&&(u=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],v.length?v:new THREE.Color));u.daeMaterial=a.material;b.faces.push(u);for(f=0;f<o.length;f++)e=s[o[f]],b.faceVertexUvs[f].push([e[0],e[1],e[2]]);d+=h.length*n}};y.prototype=new q;y.prototype.constructor=y;q.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=
|
|
|
+a.input.POSITION.source};q.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=O(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new z).parse(a.childNodes[b]));break;case "vcount":this.vcount=B(c.textContent);break;case "p":this.p=B(c.textContent)}}return this};t.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=O(a,"count",0);this.stride=
|
|
|
+O(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};w.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new z).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};z.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
|
|
|
+"");this.set=O(a,"set",-1);this.offset=O(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};L.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=Q(c.textContent),e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=F(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
+B(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=Q(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new t).parse(c.childNodes[d]);break}}}return this};L.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=
|
|
|
+this.data.slice(b,b+16),d=new THREE.Matrix4;d.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new fa).parse(a.childNodes[b]);break}return this};I.prototype.isColor=
|
|
|
+function(){return this.texture==null};I.prototype.isTexture=function(){return this.texture!=null};I.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=F(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=
|
|
|
+a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new I).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=aa.evaluate(".//dae:float",c,Z,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};D.prototype.create=function(){var a=
|
|
|
+{},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof I)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=ca[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(va+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=
|
|
|
+d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=Aa;return this.material=new THREE.MeshLambertMaterial(a)};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
|
|
|
+c.nodeName)}}return this};P.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};
|
|
|
+R.prototype.create=function(){if(this.shader==null)return null};R.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};R.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=
|
|
|
+(new C(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new P(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};R.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};
|
|
|
+R.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new D(c.nodeName,this)).parse(c)}}};fa.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};M.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==
|
|
|
+1)switch(c.nodeName){case "source":c=(new L).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new ga(this)).parse(c));break;case "channel":this.channel.push((new N(this)).parse(c))}}return this};N.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");
|
|
|
+a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};ga.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new z).parse(c))}}return this};ga.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];
|
|
|
switch(b.semantic){case "INPUT":this.input=c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-
|
|
|
-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==200))ba=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},
|
|
|
-parse:a,setPreferredShading:function(a){xa=a},applySkin:g,geometries:da}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
+this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==200))U=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},
|
|
|
+parse:a,setPreferredShading:function(a){Aa=a},applySkin:g,geometries:la}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
THREE.JSONLoader.prototype.load=function(a,c,b){var d,g=this;if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),d=a,a=d.model,c=d.callback,b=d.texture_path;d=new Worker(a);b=b?b:this.extractUrlbase(a);d.onmessage=function(a){g.createModel(a.data,c,b);g.onLoadComplete()};this.onLoadStart();d.postMessage(Date.now())};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,i,l,m,k,o,p,q,n,t,u,v,r,z=a.faces;k=a.vertices;var E=a.normals,N=a.colors,A=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&A++;for(c=0;c<A;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(m=k.length;l<m;)o=new THREE.Vertex,o.position.x=k[l++]*b,o.position.y=
|
|
|
-k[l++]*b,o.position.z=k[l++]*b,d.vertices.push(o);l=0;for(m=z.length;l<m;){b=z[l++];k=b&1;i=b&2;c=b&4;g=b&8;p=b&16;o=b&32;n=b&64;b&=128;k?(t=new THREE.Face4,t.a=z[l++],t.b=z[l++],t.c=z[l++],t.d=z[l++],k=4):(t=new THREE.Face3,t.a=z[l++],t.b=z[l++],t.c=z[l++],k=3);if(i)i=z[l++],t.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<A;c++)u=a.uvs[c],q=z[l++],r=u[q*2],q=u[q*2+1],d.faceUvs[c][i]=new THREE.UV(r,q);if(g)for(c=0;c<A;c++){u=a.uvs[c];v=[];for(g=0;g<k;g++)q=z[l++],r=u[q*2],q=u[q*2+1],v[g]=new THREE.UV(r,
|
|
|
-q);d.faceVertexUvs[c][i]=v}if(p)p=z[l++]*3,g=new THREE.Vector3,g.x=E[p++],g.y=E[p++],g.z=E[p],t.normal=g;if(o)for(c=0;c<k;c++)p=z[l++]*3,g=new THREE.Vector3,g.x=E[p++],g.y=E[p++],g.z=E[p],t.vertexNormals.push(g);if(n)o=z[l++],o=new THREE.Color(N[o]),t.color=o;if(b)for(c=0;c<k;c++)o=z[l++],o=new THREE.Color(N[o]),t.vertexColors.push(o);d.faces.push(t)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,
|
|
|
-i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,l,m,k,o,p,q;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];p=d.morphTargets[c].vertices;q=a.morphTargets[c].vertices;i=0;for(l=q.length;i<l;i+=3)m=q[i]*b,k=q[i+1]*
|
|
|
-b,o=q[i+2]*b,p.push(new THREE.Vertex(new THREE.Vector3(m,k,o)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;m=a.morphColors[c].colors;b=0;for(i=m.length;b<i;b+=3)k=new THREE.Color(16755200),k.setRGB(m[b],m[b+1],m[b+2]),l.push(k)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();c(d)};
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.version===void 0||a.version!=2)console.error("Deprecated file format.");else{var c,g,i,k,l,m,o,n,s,p,u,v,y,q,t=a.faces;m=a.vertices;var w=a.normals,z=a.colors,L=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&L++;for(c=0;c<L;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(l=m.length;k<l;)o=new THREE.Vertex,o.position.x=m[k++]*b,o.position.y=
|
|
|
+m[k++]*b,o.position.z=m[k++]*b,d.vertices.push(o);k=0;for(l=t.length;k<l;){b=t[k++];m=b&1;i=b&2;c=b&4;g=b&8;n=b&16;o=b&32;p=b&64;b&=128;m?(u=new THREE.Face4,u.a=t[k++],u.b=t[k++],u.c=t[k++],u.d=t[k++],m=4):(u=new THREE.Face3,u.a=t[k++],u.b=t[k++],u.c=t[k++],m=3);if(i)i=t[k++],u.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<L;c++)v=a.uvs[c],s=t[k++],q=v[s*2],s=v[s*2+1],d.faceUvs[c][i]=new THREE.UV(q,s);if(g)for(c=0;c<L;c++){v=a.uvs[c];y=[];for(g=0;g<m;g++)s=t[k++],q=v[s*2],s=v[s*2+1],y[g]=new THREE.UV(q,
|
|
|
+s);d.faceVertexUvs[c][i]=y}if(n)n=t[k++]*3,g=new THREE.Vector3,g.x=w[n++],g.y=w[n++],g.z=w[n],u.normal=g;if(o)for(c=0;c<m;c++)n=t[k++]*3,g=new THREE.Vector3,g.x=w[n++],g.y=w[n++],g.z=w[n],u.vertexNormals.push(g);if(p)o=t[k++],o=new THREE.Color(z[o]),u.color=o;if(b)for(c=0;c<m;c++)o=t[k++],o=new THREE.Color(z[o]),u.vertexColors.push(o);d.faces.push(u)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,
|
|
|
+i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,k,l,m,o,n,s;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];n=d.morphTargets[c].vertices;s=a.morphTargets[c].vertices;i=0;for(k=s.length;i<k;i+=3)l=s[i]*b,m=s[i+1]*
|
|
|
+b,o=s[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(l,m,o)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];k=d.morphColors[c].colors;l=a.morphColors[c].colors;b=0;for(i=l.length;b<i;b+=3)m=new THREE.Color(16755200),m.setRGB(l[b],l[b+1],l[b+2]),k.push(m)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&d.computeTangents();c(d)};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
|
-THREE.SceneLoader.prototype={load:function(a,c){var b=this,d=new Worker(a);d.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:g+"/"+a}function h(){var a;for(p in L.objects)if(!B.objects[p])if(v=L.objects[p],v.geometry!==void 0){if(w=B.geometries[v.geometry]){a=!1;for(Y=0;Y<v.materials.length;Y++)ca=B.materials[v.materials[Y]],a=ca instanceof THREE.ShaderMaterial;a&&w.computeTangents();E=v.position;N=v.rotation;A=v.quaternion;
|
|
|
-J=v.scale;A=0;ca.length==0&&(ca=new THREE.MeshFaceMaterial);ca.length>1&&(ca=new THREE.MeshFaceMaterial);a=new THREE.Mesh(w,ca);a.name=p;a.position.set(E[0],E[1],E[2]);A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(N[0],N[1],N[2]);a.scale.set(J[0],J[1],J[2]);a.visible=v.visible;B.scene.add(a);B.objects[p]=a;if(v.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(v.castsShadow)b=new THREE.ShadowVolume(w),B.scene.add(b),
|
|
|
-b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;v.trigger&&v.trigger.toLowerCase()!="none"&&(b={type:v.trigger,object:v},B.triggers[a.name]=b)}}else E=v.position,N=v.rotation,A=v.quaternion,J=v.scale,A=0,a=new THREE.Object3D,a.name=p,a.position.set(E[0],E[1],E[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(N[0],N[1],N[2]),a.scale.set(J[0],J[1],J[2]),a.visible=v.visible!==void 0?v.visible:!1,B.scene.add(a),B.objects[p]=a,B.empties[p]=a,v.trigger&&v.trigger.toLowerCase()!=
|
|
|
-"none"&&(b={type:v.trigger,object:v},B.triggers[a.name]=b)}function i(a){return function(c){B.geometries[a]=c;h();j-=1;b.onLoadComplete();m()}}function l(a){return function(b){B.geometries[a]=b}}function m(){b.callbackProgress({totalModels:ha,totalTextures:F,loadedModels:ha-j,loadedTextures:F-ea},B);b.onLoadProgress();j==0&&ea==0&&c(B)}var k,o,p,q,n,t,u,v,r,z,E,N,A,J,x,w,D,M,S,ca,L,P,j,ea,ha,F,B;L=a.data;S=new THREE.BinaryLoader;P=new THREE.JSONLoader;ea=j=0;B={scene:new THREE.Scene,geometries:{},
|
|
|
-materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(p in L.objects)if(v=L.objects[p],v.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(L.transform){a=L.transform.position;r=L.transform.rotation;var R=L.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);r&&B.scene.rotation.set(r[0],r[1],r[2]);R&&B.scene.scale.set(R[0],R[1],R[2]);(a||r||R)&&B.scene.updateMatrix()}a=function(){ea-=1;m();b.onLoadComplete()};for(n in L.cameras)r=
|
|
|
-L.cameras[n],r.type=="perspective"?D=new THREE.PerspectiveCamera(r.fov,r.aspect,r.near,r.far):r.type=="ortho"&&(D=new THREE.OrthographicCamera(r.left,r.right,r.top,r.bottom,r.near,r.far)),E=r.position,r=r.target,D.position.set(E[0],E[1],E[2]),D.target=new THREE.Vector3(r[0],r[1],r[2]),B.cameras[n]=D;for(q in L.lights)r=L.lights[q],n=r.color!==void 0?r.color:16777215,D=r.intensity!==void 0?r.intensity:1,r.type=="directional"?(E=r.direction,z=new THREE.DirectionalLight(n,D),z.position.set(E[0],E[1],
|
|
|
-E[2]),z.position.normalize()):r.type=="point"?(E=r.position,z=r.distance,z=new THREE.PointLight(n,D,z),z.position.set(E[0],E[1],E[2])):r.type=="ambient"&&(z=new THREE.AmbientLight(n)),B.scene.add(z),B.lights[q]=z;for(t in L.fogs)q=L.fogs[t],q.type=="linear"?M=new THREE.Fog(0,q.near,q.far):q.type=="exp2"&&(M=new THREE.FogExp2(0,q.density)),r=q.color,M.color.setRGB(r[0],r[1],r[2]),B.fogs[t]=M;if(B.cameras&&L.defaults.camera)B.currentCamera=B.cameras[L.defaults.camera];if(B.fogs&&L.defaults.fog)B.scene.fog=
|
|
|
-B.fogs[L.defaults.fog];r=L.defaults.bgcolor;B.bgColor=new THREE.Color;B.bgColor.setRGB(r[0],r[1],r[2]);B.bgColorAlpha=L.defaults.bgalpha;for(k in L.geometries)if(t=L.geometries[k],t.type=="bin_mesh"||t.type=="ascii_mesh")j+=1,b.onLoadStart();ha=j;for(k in L.geometries)t=L.geometries[k],t.type=="cube"?(w=new THREE.CubeGeometry(t.width,t.height,t.depth,t.segmentsWidth,t.segmentsHeight,t.segmentsDepth,null,t.flipped,t.sides),B.geometries[k]=w):t.type=="plane"?(w=new THREE.PlaneGeometry(t.width,t.height,
|
|
|
-t.segmentsWidth,t.segmentsHeight),B.geometries[k]=w):t.type=="sphere"?(w=new THREE.SphereGeometry(t.radius,t.segmentsWidth,t.segmentsHeight),B.geometries[k]=w):t.type=="cylinder"?(w=new THREE.CylinderGeometry(t.topRad,t.botRad,t.height,t.radSegs,t.heightSegs),B.geometries[k]=w):t.type=="torus"?(w=new THREE.TorusGeometry(t.radius,t.tube,t.segmentsR,t.segmentsT),B.geometries[k]=w):t.type=="icosahedron"?(w=new THREE.IcosahedronGeometry(t.subdivisions),B.geometries[k]=w):t.type=="bin_mesh"?S.load(d(t.url,
|
|
|
-L.urlBaseType),i(k)):t.type=="ascii_mesh"?P.load(d(t.url,L.urlBaseType),i(k)):t.type=="embedded_mesh"&&(t=L.embeds[t.id])&&P.createModel(t,l(k),"");for(u in L.textures)if(k=L.textures[u],k.url instanceof Array){ea+=k.url.length;for(S=0;S<k.url.length;S++)b.onLoadStart()}else ea+=1,b.onLoadStart();F=ea;for(u in L.textures){k=L.textures[u];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){S=[];for(var Y=0;Y<k.url.length;Y++)S[Y]=d(k.url[Y],L.urlBaseType);
|
|
|
-S=THREE.ImageUtils.loadTextureCube(S,k.mapping,a)}else{S=THREE.ImageUtils.loadTexture(d(k.url,L.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)S.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)S.magFilter=THREE[k.magFilter];if(k.repeat){S.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)S.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)S.wrapT=THREE.RepeatWrapping}k.offset&&S.offset.set(k.offset[0],k.offset[1]);if(k.wrap){P={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};
|
|
|
-if(P[k.wrap[0]]!==void 0)S.wrapS=P[k.wrap[0]];if(P[k.wrap[1]]!==void 0)S.wrapT=P[k.wrap[1]]}}B.textures[u]=S}for(o in L.materials){u=L.materials[o];for(x in u.parameters)if(x=="envMap"||x=="map"||x=="lightMap")u.parameters[x]=B.textures[u.parameters[x]];else if(x=="shading")u.parameters[x]=u.parameters[x]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(x=="blending")u.parameters[x]=THREE[u.parameters[x]]?THREE[u.parameters[x]]:THREE.NormalBlending;else if(x=="combine")u.parameters[x]=u.parameters[x]==
|
|
|
-"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(x=="vertexColors")if(u.parameters[x]=="face")u.parameters[x]=THREE.FaceColors;else if(u.parameters[x])u.parameters[x]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=!0;if(u.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);S=u.parameters.color;P=u.parameters.specular;t=u.parameters.ambient;M=u.parameters.shininess;a.tNormal.texture=B.textures[u.parameters.normalMap];
|
|
|
-if(u.parameters.normalMapFactor)a.uNormalScale.value=u.parameters.normalMapFactor;if(u.parameters.map)a.tDiffuse.texture=u.parameters.map,a.enableDiffuse.value=!0;if(u.parameters.lightMap)a.tAO.texture=u.parameters.lightMap,a.enableAO.value=!0;if(u.parameters.specularMap)a.tSpecular.texture=B.textures[u.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(S);a.uSpecularColor.value.setHex(P);a.uAmbientColor.value.setHex(t);a.uShininess.value=M;if(u.parameters.opacity)a.uOpacity.value=
|
|
|
-u.parameters.opacity;u=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else u=new THREE[u.type](u.parameters);B.materials[o]=u}h();b.callbackSync(B);m()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
+THREE.SceneLoader.prototype={load:function(a,c){var b=this,d=new Worker(a);d.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(a);d.onmessage=function(a){function d(a,b){return b=="relativeToHTML"?a:g+"/"+a}function h(){var a;for(n in M.objects)if(!B.objects[n])if(y=M.objects[n],y.geometry!==void 0){if(D=B.geometries[y.geometry]){a=!1;for(O=0;O<y.materials.length;O++)fa=B.materials[y.materials[O]],a=fa instanceof THREE.ShaderMaterial;a&&D.computeTangents();w=y.position;z=y.rotation;L=y.quaternion;
|
|
|
+J=y.scale;L=0;fa.length==0&&(fa=new THREE.MeshFaceMaterial);fa.length>1&&(fa=new THREE.MeshFaceMaterial);a=new THREE.Mesh(D,fa);a.name=n;a.position.set(w[0],w[1],w[2]);L?(a.quaternion.set(L[0],L[1],L[2],L[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]);a.scale.set(J[0],J[1],J[2]);a.visible=y.visible;B.scene.add(a);B.objects[n]=a;if(y.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(y.castsShadow)b=new THREE.ShadowVolume(D),B.scene.add(b),
|
|
|
+b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;y.trigger&&y.trigger.toLowerCase()!="none"&&(b={type:y.trigger,object:y},B.triggers[a.name]=b)}}else w=y.position,z=y.rotation,L=y.quaternion,J=y.scale,L=0,a=new THREE.Object3D,a.name=n,a.position.set(w[0],w[1],w[2]),L?(a.quaternion.set(L[0],L[1],L[2],L[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]),a.scale.set(J[0],J[1],J[2]),a.visible=y.visible!==void 0?y.visible:!1,B.scene.add(a),B.objects[n]=a,B.empties[n]=a,y.trigger&&y.trigger.toLowerCase()!=
|
|
|
+"none"&&(b={type:y.trigger,object:y},B.triggers[a.name]=b)}function i(a){return function(c){B.geometries[a]=c;h();ga-=1;b.onLoadComplete();l()}}function k(a){return function(b){B.geometries[a]=b}}function l(){b.callbackProgress({totalModels:Z,totalTextures:F,loadedModels:Z-ga,loadedTextures:F-ka},B);b.onLoadProgress();ga==0&&ka==0&&c(B)}var m,o,n,s,p,u,v,y,q,t,w,z,L,J,I,D,C,P,R,fa,M,N,ga,ka,Z,F,B;M=a.data;R=new THREE.BinaryLoader;N=new THREE.JSONLoader;ka=ga=0;B={scene:new THREE.Scene,geometries:{},
|
|
|
+materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(n in M.objects)if(y=M.objects[n],y.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(M.transform){a=M.transform.position;q=M.transform.rotation;var Q=M.transform.scale;a&&B.scene.position.set(a[0],a[1],a[2]);q&&B.scene.rotation.set(q[0],q[1],q[2]);Q&&B.scene.scale.set(Q[0],Q[1],Q[2]);(a||q||Q)&&B.scene.updateMatrix()}a=function(){ka-=1;l();b.onLoadComplete()};for(p in M.cameras)q=
|
|
|
+M.cameras[p],q.type=="perspective"?C=new THREE.PerspectiveCamera(q.fov,q.aspect,q.near,q.far):q.type=="ortho"&&(C=new THREE.OrthographicCamera(q.left,q.right,q.top,q.bottom,q.near,q.far)),w=q.position,q=q.target,C.position.set(w[0],w[1],w[2]),C.target=new THREE.Vector3(q[0],q[1],q[2]),B.cameras[p]=C;for(s in M.lights)q=M.lights[s],p=q.color!==void 0?q.color:16777215,C=q.intensity!==void 0?q.intensity:1,q.type=="directional"?(w=q.direction,t=new THREE.DirectionalLight(p,C),t.position.set(w[0],w[1],
|
|
|
+w[2]),t.position.normalize()):q.type=="point"?(w=q.position,t=q.distance,t=new THREE.PointLight(p,C,t),t.position.set(w[0],w[1],w[2])):q.type=="ambient"&&(t=new THREE.AmbientLight(p)),B.scene.add(t),B.lights[s]=t;for(u in M.fogs)s=M.fogs[u],s.type=="linear"?P=new THREE.Fog(0,s.near,s.far):s.type=="exp2"&&(P=new THREE.FogExp2(0,s.density)),q=s.color,P.color.setRGB(q[0],q[1],q[2]),B.fogs[u]=P;if(B.cameras&&M.defaults.camera)B.currentCamera=B.cameras[M.defaults.camera];if(B.fogs&&M.defaults.fog)B.scene.fog=
|
|
|
+B.fogs[M.defaults.fog];q=M.defaults.bgcolor;B.bgColor=new THREE.Color;B.bgColor.setRGB(q[0],q[1],q[2]);B.bgColorAlpha=M.defaults.bgalpha;for(m in M.geometries)if(u=M.geometries[m],u.type=="bin_mesh"||u.type=="ascii_mesh")ga+=1,b.onLoadStart();Z=ga;for(m in M.geometries)u=M.geometries[m],u.type=="cube"?(D=new THREE.CubeGeometry(u.width,u.height,u.depth,u.segmentsWidth,u.segmentsHeight,u.segmentsDepth,null,u.flipped,u.sides),B.geometries[m]=D):u.type=="plane"?(D=new THREE.PlaneGeometry(u.width,u.height,
|
|
|
+u.segmentsWidth,u.segmentsHeight),B.geometries[m]=D):u.type=="sphere"?(D=new THREE.SphereGeometry(u.radius,u.segmentsWidth,u.segmentsHeight),B.geometries[m]=D):u.type=="cylinder"?(D=new THREE.CylinderGeometry(u.topRad,u.botRad,u.height,u.radSegs,u.heightSegs),B.geometries[m]=D):u.type=="torus"?(D=new THREE.TorusGeometry(u.radius,u.tube,u.segmentsR,u.segmentsT),B.geometries[m]=D):u.type=="icosahedron"?(D=new THREE.IcosahedronGeometry(u.subdivisions),B.geometries[m]=D):u.type=="bin_mesh"?R.load(d(u.url,
|
|
|
+M.urlBaseType),i(m)):u.type=="ascii_mesh"?N.load(d(u.url,M.urlBaseType),i(m)):u.type=="embedded_mesh"&&(u=M.embeds[u.id])&&N.createModel(u,k(m),"");for(v in M.textures)if(m=M.textures[v],m.url instanceof Array){ka+=m.url.length;for(R=0;R<m.url.length;R++)b.onLoadStart()}else ka+=1,b.onLoadStart();F=ka;for(v in M.textures){m=M.textures[v];if(m.mapping!=void 0&&THREE[m.mapping]!=void 0)m.mapping=new THREE[m.mapping];if(m.url instanceof Array){R=[];for(var O=0;O<m.url.length;O++)R[O]=d(m.url[O],M.urlBaseType);
|
|
|
+R=THREE.ImageUtils.loadTextureCube(R,m.mapping,a)}else{R=THREE.ImageUtils.loadTexture(d(m.url,M.urlBaseType),m.mapping,a);if(THREE[m.minFilter]!=void 0)R.minFilter=THREE[m.minFilter];if(THREE[m.magFilter]!=void 0)R.magFilter=THREE[m.magFilter];if(m.repeat){R.repeat.set(m.repeat[0],m.repeat[1]);if(m.repeat[0]!=1)R.wrapS=THREE.RepeatWrapping;if(m.repeat[1]!=1)R.wrapT=THREE.RepeatWrapping}m.offset&&R.offset.set(m.offset[0],m.offset[1]);if(m.wrap){N={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};
|
|
|
+if(N[m.wrap[0]]!==void 0)R.wrapS=N[m.wrap[0]];if(N[m.wrap[1]]!==void 0)R.wrapT=N[m.wrap[1]]}}B.textures[v]=R}for(o in M.materials){v=M.materials[o];for(I in v.parameters)if(I=="envMap"||I=="map"||I=="lightMap")v.parameters[I]=B.textures[v.parameters[I]];else if(I=="shading")v.parameters[I]=v.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")v.parameters[I]=THREE[v.parameters[I]]?THREE[v.parameters[I]]:THREE.NormalBlending;else if(I=="combine")v.parameters[I]=v.parameters[I]==
|
|
|
+"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(I=="vertexColors")if(v.parameters[I]=="face")v.parameters[I]=THREE.FaceColors;else if(v.parameters[I])v.parameters[I]=THREE.VertexColors;if(v.parameters.opacity!==void 0&&v.parameters.opacity<1)v.parameters.transparent=!0;if(v.parameters.normalMap){m=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(m.uniforms);R=v.parameters.color;N=v.parameters.specular;u=v.parameters.ambient;P=v.parameters.shininess;a.tNormal.texture=B.textures[v.parameters.normalMap];
|
|
|
+if(v.parameters.normalMapFactor)a.uNormalScale.value=v.parameters.normalMapFactor;if(v.parameters.map)a.tDiffuse.texture=v.parameters.map,a.enableDiffuse.value=!0;if(v.parameters.lightMap)a.tAO.texture=v.parameters.lightMap,a.enableAO.value=!0;if(v.parameters.specularMap)a.tSpecular.texture=B.textures[v.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(R);a.uSpecularColor.value.setHex(N);a.uAmbientColor.value.setHex(u);a.uShininess.value=P;if(v.parameters.opacity)a.uOpacity.value=
|
|
|
+v.parameters.opacity;v=new THREE.ShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:a,lights:!0,fog:!0})}else v=new THREE[v.type](v.parameters);B.materials[o]=v}h();b.callbackSync(B);l()}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,e=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
|
|
|
c,g,e,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var e=0,f=0;f<c;++f){var h=a.charCodeAt(f+d);e+=h>>1^-(h&1);b[8*f+g]=e}d+=c}c=a.length-d;e=new Uint16Array(c);for(g=f=0;g<c;g++)h=a.charCodeAt(g+d),e[g]=f-h,h==0&&f++;return[b,e]};
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],m=[];(function(a,f,i){for(var l,n,m,u=a.length;i<u;i+=f)l=a[i],n=a[i+1],m=a[i+2],l=l/16383*b,n=n/16383*b,m=m/16383*b,l+=d,n+=g,m+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(l,n,m)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,m.push(d,1-e)})(f[0],8,3);(function(a,
|
|
|
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,v,r,z,E=a.length;for(b=0;b<E;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;r=d;z=e;i=f;v=d;var N=e,A=f,J=g.materials[0],x=l[N*3],w=l[N*3+1],N=l[N*3+2],D=l[A*3],M=l[A*3+1],A=l[A*3+2];v=new THREE.Vector3(l[v*3],l[v*3+1],l[v*3+2]);N=new THREE.Vector3(x,w,N);A=new THREE.Vector3(D,M,A);g.faces.push(new THREE.Face3(r,z,i,[v,N,A],null,J));g=m[d*2];d=m[d*2+
|
|
|
-1];i=m[e*2];v=m[e*2+1];r=m[f*2];z=m[f*2+1];f=c.faceVertexUvs[0];e=i;i=v;v=[];v.push(new THREE.UV(g,d));v.push(new THREE.UV(e,i));v.push(new THREE.UV(r,z));f.push(v)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),k=[],l=[];(function(a,f,i){for(var k,l,u,v=a.length;i<v;i+=f)k=a[i],l=a[i+1],u=a[i+2],k=k/16383*b,l=l/16383*b,u=u/16383*b,k+=d,l+=g,u+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,u)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,l.push(d,1-e)})(f[0],8,3);(function(a,
|
|
|
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,k.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,y,q,t,w=a.length;for(b=0;b<w;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;q=d;t=e;i=f;y=d;var z=e,L=f,J=g.materials[0],I=k[z*3],D=k[z*3+1],z=k[z*3+2],C=k[L*3],P=k[L*3+1],L=k[L*3+2];y=new THREE.Vector3(k[y*3],k[y*3+1],k[y*3+2]);z=new THREE.Vector3(I,D,z);L=new THREE.Vector3(C,P,L);g.faces.push(new THREE.Face3(q,t,i,[y,z,L],null,J));g=l[d*2];d=l[d*2+
|
|
|
+1];i=l[e*2];y=l[e*2+1];q=l[f*2];t=l[f*2+1];f=c.faceVertexUvs[0];e=i;i=y;y=[];y.push(new THREE.UV(g,d));y.push(new THREE.UV(e,i));y.push(new THREE.UV(q,t));f.push(y)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
|
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
|
|
|
b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;this.size2=this.size*this.size;this.size3=this.size2*this.size;this.halfsize=this.size/2;this.delta=2/this.size;this.yd=this.size;this.zd=this.size2;this.field=new Float32Array(this.size3);this.normal_cache=new Float32Array(this.size3*3);this.vlist=new Float32Array(36);this.nlist=new Float32Array(36);this.firstDraw=!0;this.maxCount=4096;this.count=
|
|
|
-0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,e,f,h,i,l,m,k){f=(f-m)/(k-m);m=this.normal_cache;c[e]=h+f*this.delta;c[e+1]=i;c[e+2]=l;g[e]=this.lerp(m[a],m[a+3],f);g[e+1]=this.lerp(m[a+1],m[a+4],f);g[e+2]=this.lerp(m[a+2],m[a+5],f)};this.VIntY=function(a,c,g,e,f,h,i,l,m,k){f=(f-m)/(k-m);m=this.normal_cache;c[e]=h;c[e+1]=i+f*this.delta;c[e+
|
|
|
-2]=l;c=a+this.yd*3;g[e]=this.lerp(m[a],m[c],f);g[e+1]=this.lerp(m[a+1],m[c+1],f);g[e+2]=this.lerp(m[a+2],m[c+2],f)};this.VIntZ=function(a,c,g,e,f,h,i,l,m,k){f=(f-m)/(k-m);m=this.normal_cache;c[e]=h;c[e+1]=i;c[e+2]=l+f*this.delta;c=a+this.zd*3;g[e]=this.lerp(m[a],m[c],f);g[e+1]=this.lerp(m[a+1],m[c+1],f);g[e+2]=this.lerp(m[a+2],m[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
|
|
|
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,e,f,h){var i=e+1,l=e+this.yd,m=e+this.zd,k=i+this.yd,o=i+this.zd,p=e+this.yd+this.zd,q=i+this.yd+this.zd,n=0,t=this.field[e],u=this.field[i],v=this.field[l],r=this.field[k],z=this.field[m],E=this.field[o],N=this.field[p],A=this.field[q];t<f&&(n|=1);u<f&&(n|=2);v<f&&(n|=8);r<f&&(n|=4);z<f&&(n|=16);E<f&&(n|=32);N<f&&(n|=128);A<f&&(n|=64);var J=THREE.edgeTable[n];if(J===0)return 0;
|
|
|
-var x=this.delta,w=a+x,D=c+x,x=g+x;J&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,t,u));J&2&&(this.compNorm(i),this.compNorm(k),this.VIntY(i*3,this.vlist,this.nlist,3,f,w,c,g,u,r));J&4&&(this.compNorm(l),this.compNorm(k),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,D,g,v,r));J&8&&(this.compNorm(e),this.compNorm(l),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,t,v));J&16&&(this.compNorm(m),this.compNorm(o),this.VIntX(m*3,this.vlist,this.nlist,12,f,a,c,x,z,E));
|
|
|
-J&32&&(this.compNorm(o),this.compNorm(q),this.VIntY(o*3,this.vlist,this.nlist,15,f,w,c,x,E,A));J&64&&(this.compNorm(p),this.compNorm(q),this.VIntX(p*3,this.vlist,this.nlist,18,f,a,D,x,N,A));J&128&&(this.compNorm(m),this.compNorm(p),this.VIntY(m*3,this.vlist,this.nlist,21,f,a,c,x,z,N));J&256&&(this.compNorm(e),this.compNorm(m),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,t,z));J&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,f,w,c,g,u,E));J&1024&&(this.compNorm(k),
|
|
|
-this.compNorm(q),this.VIntZ(k*3,this.vlist,this.nlist,30,f,w,D,g,r,A));J&2048&&(this.compNorm(l),this.compNorm(p),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,D,g,v,N));n<<=4;for(f=e=0;THREE.triTable[n+f]!=-1;)a=n+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),f+=3,e++;return e};this.posnormtriv=function(a,c,g,e,f,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
|
|
|
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,e,f,h,i,k,l,m){f=(f-l)/(m-l);l=this.normal_cache;c[e]=h+f*this.delta;c[e+1]=i;c[e+2]=k;g[e]=this.lerp(l[a],l[a+3],f);g[e+1]=this.lerp(l[a+1],l[a+4],f);g[e+2]=this.lerp(l[a+2],l[a+5],f)};this.VIntY=function(a,c,g,e,f,h,i,k,l,m){f=(f-l)/(m-l);l=this.normal_cache;c[e]=h;c[e+1]=i+f*this.delta;c[e+
|
|
|
+2]=k;c=a+this.yd*3;g[e]=this.lerp(l[a],l[c],f);g[e+1]=this.lerp(l[a+1],l[c+1],f);g[e+2]=this.lerp(l[a+2],l[c+2],f)};this.VIntZ=function(a,c,g,e,f,h,i,k,l,m){f=(f-l)/(m-l);l=this.normal_cache;c[e]=h;c[e+1]=i;c[e+2]=k+f*this.delta;c=a+this.zd*3;g[e]=this.lerp(l[a],l[c],f);g[e+1]=this.lerp(l[a+1],l[c+1],f);g[e+2]=this.lerp(l[a+2],l[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
|
|
|
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,e,f,h){var i=e+1,k=e+this.yd,l=e+this.zd,m=i+this.yd,o=i+this.zd,n=e+this.yd+this.zd,s=i+this.yd+this.zd,p=0,u=this.field[e],v=this.field[i],y=this.field[k],q=this.field[m],t=this.field[l],w=this.field[o],z=this.field[n],L=this.field[s];u<f&&(p|=1);v<f&&(p|=2);y<f&&(p|=8);q<f&&(p|=4);t<f&&(p|=16);w<f&&(p|=32);z<f&&(p|=128);L<f&&(p|=64);var J=THREE.edgeTable[p];if(J===0)return 0;
|
|
|
+var I=this.delta,D=a+I,C=c+I,I=g+I;J&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,u,v));J&2&&(this.compNorm(i),this.compNorm(m),this.VIntY(i*3,this.vlist,this.nlist,3,f,D,c,g,v,q));J&4&&(this.compNorm(k),this.compNorm(m),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,C,g,y,q));J&8&&(this.compNorm(e),this.compNorm(k),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,u,y));J&16&&(this.compNorm(l),this.compNorm(o),this.VIntX(l*3,this.vlist,this.nlist,12,f,a,c,I,t,w));
|
|
|
+J&32&&(this.compNorm(o),this.compNorm(s),this.VIntY(o*3,this.vlist,this.nlist,15,f,D,c,I,w,L));J&64&&(this.compNorm(n),this.compNorm(s),this.VIntX(n*3,this.vlist,this.nlist,18,f,a,C,I,z,L));J&128&&(this.compNorm(l),this.compNorm(n),this.VIntY(l*3,this.vlist,this.nlist,21,f,a,c,I,t,z));J&256&&(this.compNorm(e),this.compNorm(l),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,u,t));J&512&&(this.compNorm(i),this.compNorm(o),this.VIntZ(i*3,this.vlist,this.nlist,27,f,D,c,g,v,w));J&1024&&(this.compNorm(m),
|
|
|
+this.compNorm(s),this.VIntZ(m*3,this.vlist,this.nlist,30,f,D,C,g,q,L));J&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,C,g,y,z));p<<=4;for(f=e=0;THREE.triTable[p+f]!=-1;)a=p+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),f+=3,e++;return e};this.posnormtriv=function(a,c,g,e,f,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
|
|
|
3]=a[e];this.positionArray[i+4]=a[e+1];this.positionArray[i+5]=a[e+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=c[g];this.normalArray[i+1]=c[g+1];this.normalArray[i+2]=c[g+2];this.normalArray[i+3]=c[e];this.normalArray[i+4]=c[e+1];this.normalArray[i+5]=c[e+2];this.normalArray[i+6]=c[f];this.normalArray[i+7]=c[f+1];this.normalArray[i+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
|
|
|
-function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,e,f){var h=this.size*Math.sqrt(e/f),i=g*this.size,l=c*this.size,m=a*this.size,k=Math.floor(i-h);k<1&&(k=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(l-h);o<1&&(o=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var p=Math.floor(m-h);p<1&&(p=1);h=Math.floor(m+h);
|
|
|
-h>this.size-1&&(h=this.size-1);for(var q,n,t,u,v,r;k<i;k++){m=this.size2*k;n=k/this.size-g;v=n*n;for(n=o;n<l;n++){t=m+this.size*n;q=n/this.size-c;r=q*q;for(q=p;q<h;q++)u=q/this.size-a,u=e/(1.0E-6+u*u+r+v)-f,u>0&&(this.field[t+q]+=u)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,l=this.size,m=this.yd,k=this.zd,o=this.field,p=l*Math.sqrt(a/c);p>l&&(p=l);for(g=0;g<p;g++)if(e=g/l,e*=e,h=a/(1.0E-4+e)-c,h>0)for(e=0;e<l;e++){i=g+e*m;for(f=0;f<l;f++)o[k*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
|
|
|
-i,l,m=this.size,k=this.yd,o=this.zd,p=this.field,q=m*Math.sqrt(a/c);q>m&&(q=m);for(e=0;e<q;e++)if(g=e/m,g*=g,h=a/(1.0E-4+g)-c,h>0){i=e*k;for(g=0;g<m;g++){l=i+g;for(f=0;f<m;f++)p[o*f+l]+=h}}};this.addPlaneZ=function(a,c){var g,e,f,h,i,l,m=this.size,k=this.yd,o=this.zd,p=this.field,q=m*Math.sqrt(a/c);q>m&&(q=m);for(f=0;f<q;f++)if(g=f/m,g*=g,h=a/(1.0E-4+g)-c,h>0){i=o*f;for(e=0;e<m;e++){l=i+e*k;for(g=0;g<m;g++)p[l+g]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,
|
|
|
-this.field[a]=0};this.render=function(a){this.begin();var c,g,e,f,h,i,l,m,k,o=this.size-2;for(f=1;f<o;f++){k=this.size2*f;l=(f-this.halfsize)/this.halfsize;for(e=1;e<o;e++){m=k+this.size*e;i=(e-this.halfsize)/this.halfsize;for(g=1;g<o;g++)h=(g-this.halfsize)/this.halfsize,c=m+g,this.polygonize(h,i,l,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(e){var f,h,i,l,m,k,o,p;for(f=0;f<e.count;f++)o=f*3,m=o+1,p=o+2,h=e.positionArray[o],
|
|
|
-i=e.positionArray[m],l=e.positionArray[p],k=new THREE.Vector3(h,i,l),h=e.normalArray[o],i=e.normalArray[m],l=e.normalArray[p],o=new THREE.Vector3(h,i,l),o.normalize(),m=new THREE.Vertex(k),c.vertices.push(m),g.push(o);k=e.count/3;for(f=0;f<k;f++)o=(a+f)*3,m=o+1,p=o+2,h=g[o],i=g[m],l=g[p],o=new THREE.Face3(o,m,p,[h,i,l]),c.faces.push(o);a+=k;e.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
+function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,e,f){var h=this.size*Math.sqrt(e/f),i=g*this.size,k=c*this.size,l=a*this.size,m=Math.floor(i-h);m<1&&(m=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var o=Math.floor(k-h);o<1&&(o=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var n=Math.floor(l-h);n<1&&(n=1);h=Math.floor(l+h);
|
|
|
+h>this.size-1&&(h=this.size-1);for(var s,p,u,v,y,q;m<i;m++){l=this.size2*m;p=m/this.size-g;y=p*p;for(p=o;p<k;p++){u=l+this.size*p;s=p/this.size-c;q=s*s;for(s=n;s<h;s++)v=s/this.size-a,v=e/(1.0E-6+v*v+q+y)-f,v>0&&(this.field[u+s]+=v)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,k=this.size,l=this.yd,m=this.zd,o=this.field,n=k*Math.sqrt(a/c);n>k&&(n=k);for(g=0;g<n;g++)if(e=g/k,e*=e,h=a/(1.0E-4+e)-c,h>0)for(e=0;e<k;e++){i=g+e*l;for(f=0;f<k;f++)o[m*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
|
|
|
+i,k,l=this.size,m=this.yd,o=this.zd,n=this.field,s=l*Math.sqrt(a/c);s>l&&(s=l);for(e=0;e<s;e++)if(g=e/l,g*=g,h=a/(1.0E-4+g)-c,h>0){i=e*m;for(g=0;g<l;g++){k=i+g;for(f=0;f<l;f++)n[o*f+k]+=h}}};this.addPlaneZ=function(a,c){var g,e,f,h,i,k,l=this.size,m=this.yd,o=this.zd,n=this.field,s=l*Math.sqrt(a/c);s>l&&(s=l);for(f=0;f<s;f++)if(g=f/l,g*=g,h=a/(1.0E-4+g)-c,h>0){i=o*f;for(e=0;e<l;e++){k=i+e*m;for(g=0;g<l;g++)n[k+g]+=h}}};this.reset=function(){var a;for(a=0;a<this.size3;a++)this.normal_cache[a*3]=0,
|
|
|
+this.field[a]=0};this.render=function(a){this.begin();var c,g,e,f,h,i,k,l,m,o=this.size-2;for(f=1;f<o;f++){m=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(e=1;e<o;e++){l=m+this.size*e;i=(e-this.halfsize)/this.halfsize;for(g=1;g<o;g++)h=(g-this.halfsize)/this.halfsize,c=l+g,this.polygonize(h,i,k,c,this.isolation,a)}}this.end(a)};this.generateGeometry=function(){var a=0,c=new THREE.Geometry,g=[];this.render(function(e){var f,h,i,k,l,m,o,n;for(f=0;f<e.count;f++)o=f*3,l=o+1,n=o+2,h=e.positionArray[o],
|
|
|
+i=e.positionArray[l],k=e.positionArray[n],m=new THREE.Vector3(h,i,k),h=e.normalArray[o],i=e.normalArray[l],k=e.normalArray[n],o=new THREE.Vector3(h,i,k),o.normalize(),l=new THREE.Vertex(m),c.vertices.push(l),g.push(o);m=e.count/3;for(f=0;f<m;f++)o=(a+f)*3,l=o+1,n=o+2,h=g[o],i=g[l],k=g[n],o=new THREE.Face3(o,l,n,[h,i,k]),c.faces.push(o);a+=m;e.count=0});return c};this.init(a)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
THREE.edgeTable=new Int32Array([0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,
|
|
|
1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,
|
|
|
419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0]);
|
|
@@ -697,20 +697,20 @@ THREE.MeshCollider=function(a,c){this.mesh=a;this.box=c;this.numFaces=this.mesh.
|
|
|
THREE.CollisionSystem.prototype.rayCastAll=function(a){a.direction.normalize();this.hits.length=0;var c,b,d,g,e=0;c=0;for(b=this.colliders.length;c<b;c++)if(g=this.colliders[c],d=this.rayCast(a,g),d<Number.MAX_VALUE)g.distance=d,d>e?this.hits.push(g):this.hits.unshift(g),e=d;return this.hits};
|
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(a){var c=this.rayCastAll(a);if(c.length==0)return null;for(var b=0;c[b]instanceof THREE.MeshCollider;){var d=this.rayMesh(a,c[b]);if(d.dist<Number.MAX_VALUE){c[b].distance=d.dist;c[b].faceIndex=d.faceIndex;break}b++}if(b>c.length)return null;return c[b]};
|
|
|
THREE.CollisionSystem.prototype.rayCast=function(a,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(a,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(a,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(a,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(a,c.box)};
|
|
|
-THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,g,e=0;e<c.numFaces;e++){var f=c.mesh.geometry.faces[e],h=c.mesh.geometry.vertices[f.a].position,i=c.mesh.geometry.vertices[f.b].position,l=c.mesh.geometry.vertices[f.c].position,m=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,h,i,l,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
-f instanceof THREE.Face4&&(f=this.rayTriangle(b,h,i,m,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,i,l,m,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:g}};
|
|
|
+THREE.CollisionSystem.prototype.rayMesh=function(a,c){for(var b=this.makeRayLocal(a,c.mesh),d=Number.MAX_VALUE,g,e=0;e<c.numFaces;e++){var f=c.mesh.geometry.faces[e],h=c.mesh.geometry.vertices[f.a].position,i=c.mesh.geometry.vertices[f.b].position,k=c.mesh.geometry.vertices[f.c].position,l=f instanceof THREE.Face4?c.mesh.geometry.vertices[f.d].position:null;f instanceof THREE.Face3?(f=this.rayTriangle(b,h,i,k,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
+f instanceof THREE.Face4&&(f=this.rayTriangle(b,h,i,l,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize()),f=this.rayTriangle(b,i,k,l,d,this.collisionNormal,c.mesh),f<d&&(d=f,g=e,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:d,faceIndex:g}};
|
|
|
THREE.CollisionSystem.prototype.rayTriangle=function(a,c,b,d,g,e,f){var h=THREE.CollisionSystem.__v1,i=THREE.CollisionSystem.__v2;e.set(0,0,0);h.sub(b,c);i.sub(d,b);e.cross(h,i);h=e.dot(a.direction);if(!(h<0))if(f.doubleSided||f.flipSided)e.multiplyScalar(-1),h*=-1;else return Number.MAX_VALUE;f=e.dot(c)-e.dot(a.origin);if(!(f<=0))return Number.MAX_VALUE;if(!(f>=h*g))return Number.MAX_VALUE;f/=h;h=THREE.CollisionSystem.__v3;h.copy(a.direction);h.multiplyScalar(f);h.addSelf(a.origin);Math.abs(e.x)>
|
|
|
Math.abs(e.y)?Math.abs(e.x)>Math.abs(e.z)?(a=h.y-c.y,e=b.y-c.y,g=d.y-c.y,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,e=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y):Math.abs(e.y)>Math.abs(e.z)?(a=h.x-c.x,e=b.x-c.x,g=d.x-c.x,h=h.z-c.z,b=b.z-c.z,d=d.z-c.z):(a=h.x-c.x,e=b.x-c.x,g=d.x-c.x,h=h.y-c.y,b=b.y-c.y,d=d.y-c.y);c=e*d-b*g;if(c==0)return Number.MAX_VALUE;c=1/c;d=(a*d-h*g)*c;if(!(d>=0))return Number.MAX_VALUE;c*=e*h-b*a;if(!(c>=0))return Number.MAX_VALUE;if(!(1-d-c>=0))return Number.MAX_VALUE;return f};
|
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(a,c){var b=THREE.CollisionSystem.__m;b.getInverse(c.matrixWorld);var d=THREE.CollisionSystem.__r;d.origin.copy(a.origin);d.direction.copy(a.direction);b.multiplyVector3(d.origin);b.rotateAxis(d.direction);d.direction.normalize();return d};
|
|
|
-THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var d=0,g=0,e=0,f=0,h=0,i=0,l=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,l=!1,f=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,l=!1,f=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,l=!1,h=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
|
|
|
-l=!1,h=1);b.origin.z<c.min.z?(e=c.min.z-b.origin.z,e/=b.direction.z,l=!1,i=-1):b.origin.z>c.max.z&&(e=c.max.z-b.origin.z,e/=b.direction.z,l=!1,i=1);if(l)return-1;l=0;g>d&&(l=1,d=g);e>d&&(l=2,d=e);switch(l){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*d;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
|
|
|
+THREE.CollisionSystem.prototype.rayBox=function(a,c){var b;c.dynamic&&c.mesh&&c.mesh.matrixWorld?b=this.makeRayLocal(a,c.mesh):(b=THREE.CollisionSystem.__r,b.origin.copy(a.origin),b.direction.copy(a.direction));var d=0,g=0,e=0,f=0,h=0,i=0,k=!0;b.origin.x<c.min.x?(d=c.min.x-b.origin.x,d/=b.direction.x,k=!1,f=-1):b.origin.x>c.max.x&&(d=c.max.x-b.origin.x,d/=b.direction.x,k=!1,f=1);b.origin.y<c.min.y?(g=c.min.y-b.origin.y,g/=b.direction.y,k=!1,h=-1):b.origin.y>c.max.y&&(g=c.max.y-b.origin.y,g/=b.direction.y,
|
|
|
+k=!1,h=1);b.origin.z<c.min.z?(e=c.min.z-b.origin.z,e/=b.direction.z,k=!1,i=-1):b.origin.z>c.max.z&&(e=c.max.z-b.origin.z,e/=b.direction.z,k=!1,i=1);if(k)return-1;k=0;g>d&&(k=1,d=g);e>d&&(k=2,d=e);switch(k){case 0:h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(f,0,0);break;case 1:f=b.origin.x+b.direction.x*d;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;b=b.origin.z+b.direction.z*
|
|
|
d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case 2:f=b.origin.x+b.direction.x*d;if(f<c.min.x||f>c.max.x)return Number.MAX_VALUE;h=b.origin.y+b.direction.y*d;if(h<c.min.y||h>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,i)}return d};THREE.CollisionSystem.prototype.rayPlane=function(a,c){var b=a.direction.dot(c.normal),d=c.point.dot(c.normal);if(b<0)b=(d-a.origin.dot(c.normal))/b;else return Number.MAX_VALUE;return b>0?b:Number.MAX_VALUE};
|
|
|
THREE.CollisionSystem.prototype.raySphere=function(a,c){var b=c.center.clone().subSelf(a.origin);if(b.lengthSq<c.radiusSq)return-1;var d=b.dot(a.direction.clone());if(d<=0)return Number.MAX_VALUE;b=c.radiusSq-(b.lengthSq()-d*d);if(b>=0)return Math.abs(d)-Math.sqrt(b);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
|
THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(a){a.geometry.computeBoundingBox();var c=a.geometry.boundingBox,b=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),b=new THREE.BoxCollider(b,c);b.mesh=a;return b};THREE.CollisionUtils.MeshAABB=function(a){var c=THREE.CollisionUtils.MeshOBB(a);c.min.addSelf(a.position);c.max.addSelf(a.position);c.dynamic=!1;return c};
|
|
|
THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
|
|
|
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,l,m,k;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),p=new THREE.WebGLRenderTarget(512,512,a),q=new THREE.PerspectiveCamera(53,
|
|
|
-1,1,1E4);q.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:p}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
|
|
|
-n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(q);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;p.width=a;p.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||l!==b.near||m!==b.far||k!==b.fov){i=b.aspect;l=b.near;m=b.far;k=b.fov;var v=b.projectionMatrix.clone(),r=125/30*0.5,z=r*l/125,E=l*Math.tan(k*Math.PI/360),N;f.n14=r;h.n14=-r;r=-E*i+z;N=E*i+z;v.n11=2*l/(N-r);v.n13=(N+r)/(N-r);g.projectionMatrix.copy(v);r=-E*i-z;N=E*i-z;v.n11=
|
|
|
-2*l/(N-r);v.n13=(N+r)/(N-r);e.projectionMatrix.copy(v)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,o,!0);e.matrixWorld.copy(b.matrixWorld).multiplySelf(f);e.position.copy(b.position);e.near=b.near;e.far=b.far;d.call(c,a,e,p,!0);n.updateMatrixWorld();d.call(c,n,q)}};
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,k,l,m;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,a),n=new THREE.WebGLRenderTarget(512,512,a),s=new THREE.PerspectiveCamera(53,
|
|
|
+1,1,1E4);s.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},mapRight:{type:"t",value:1,texture:n}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"}),
|
|
|
+p=new THREE.Scene;p.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));p.add(s);this.setSize=function(a,d){b.call(c,a,d);o.width=a;o.height=d;n.width=a;n.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||l!==b.far||m!==b.fov){i=b.aspect;k=b.near;l=b.far;m=b.fov;var y=b.projectionMatrix.clone(),q=125/30*0.5,t=q*k/125,w=k*Math.tan(m*Math.PI/360),z;f.n14=q;h.n14=-q;q=-w*i+t;z=w*i+t;y.n11=2*k/(z-q);y.n13=(z+q)/(z-q);g.projectionMatrix.copy(y);q=-w*i-t;z=w*i-t;y.n11=
|
|
|
+2*k/(z-q);y.n13=(z+q)/(z-q);e.projectionMatrix.copy(y)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,o,!0);e.matrixWorld.copy(b.matrixWorld).multiplySelf(f);e.position.copy(b.position);e.near=b.near;e.far=b.far;d.call(c,a,e,n,!0);p.updateMatrixWorld();d.call(c,p,s)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,e,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;e=d};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
|
|
|
b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,e);d.call(c,a,f);this.setViewport(g,0,g,e);d.call(c,a,h,!1)}};
|