|
@@ -15,38 +15,38 @@ 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,q){d.copy(q).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);o=1/(f*k-h*h);r=(k*i-h*l)*o;n=(f*l-h*i)*o;return r>=0&&n>=0&&r+n<1}for(var d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Vector3,f,h,i,k,l,o,r,n,s,q=[],m=0,u=a.children.length;m<u;m++)Array.prototype.push.apply(q,this.intersectObject(a.children[m]));if(a instanceof THREE.Particle){m=c(this.origin,this.direction,a.matrixWorld.getPosition());if(m===null||m>a.scale.x)return[];s={distance:m,point:a.position,
|
|
|
-face:null,object:a};q.push(s)}else if(a instanceof THREE.Mesh){m=c(this.origin,this.direction,a.matrixWorld.getPosition());if(m===null||m>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return q;var w,p,z,C,x,v,I,H,F=a.geometry,B=F.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);m=0;for(u=F.faces.length;m<u;m++)if(s=F.faces[m],I=this.origin.clone(),H=this.direction.clone(),C=a.matrixWorld,w=C.multiplyVector3(s.centroid.clone()).subSelf(I),v=w.dot(H),
|
|
|
-!(v<=0)&&(w=C.multiplyVector3(B[s.a].position.clone()),p=C.multiplyVector3(B[s.b].position.clone()),z=C.multiplyVector3(B[s.c].position.clone()),C=s instanceof THREE.Face4?C.multiplyVector3(B[s.d].position.clone()):null,x=a.matrixRotationWorld.multiplyVector3(s.normal.clone()),v=H.dot(x),a.doubleSided||(a.flipSided?v>0:v<0)))if(v=x.dot((new THREE.Vector3).sub(w,I))/v,I=I.addSelf(H.multiplyScalar(v)),s instanceof THREE.Face3)b(I,w,p,z)&&(s={distance:this.origin.distanceTo(I),point:I,face:s,object:a},
|
|
|
-q.push(s));else if(s instanceof THREE.Face4&&(b(I,w,p,C)||b(I,p,z,C)))s={distance:this.origin.distanceTo(I),point:I,face:s,object:a},q.push(s)}return q}};
|
|
|
-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,o){h=!1;c=e;b=f;d=l;g=o;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,o,r,n){h?(h=!1,c=e<l?e<r?e:r:l<r?l:r,b=f<o?f<n?f:n:o<n?o:n,d=e>l?e>r?e:r:l>r?l:r,g=f>o?f>n?f:n:o>n?o:n):(c=e<l?e<r?e<c?e:c:r<c?r:c:l<r?l<c?l:c:r<c?r:c,b=f<o?f<n?f<b?f:b:n<b?n:b:o<n?o<b?o:b:n<b?n:b,d=e>l?e>r?e>d?e:d:r>d?r:d:l>r?l>d?l:d:r>d?r:d,g=f>o?f>n?f>g?f:g:n>g?n:g:o>n?o>g?o: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>
|
|
|
+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);n=1/(f*k-h*h);r=(k*i-h*l)*n;m=(f*l-h*i)*n;return r>=0&&m>=0&&r+m<1}for(var d=new THREE.Vector3,g=new THREE.Vector3,e=new THREE.Vector3,f,h,i,k,l,n,r,m,s,p=[],o=0,t=a.children.length;o<t;o++)Array.prototype.push.apply(p,this.intersectObject(a.children[o]));if(a instanceof THREE.Particle){o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o===null||o>a.scale.x)return[];s={distance:o,point:a.position,
|
|
|
+face:null,object:a};p.push(s)}else if(a instanceof THREE.Mesh){o=c(this.origin,this.direction,a.matrixWorld.getPosition());if(o===null||o>a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,a.scale.z)))return p;var v,q,A,D,w,u,E,I,x=a.geometry,C=x.vertices;a.matrixRotationWorld.extractRotation(a.matrixWorld);o=0;for(t=x.faces.length;o<t;o++)if(s=x.faces[o],E=this.origin.clone(),I=this.direction.clone(),D=a.matrixWorld,v=D.multiplyVector3(s.centroid.clone()).subSelf(E),u=v.dot(I),
|
|
|
+!(u<=0)&&(v=D.multiplyVector3(C[s.a].position.clone()),q=D.multiplyVector3(C[s.b].position.clone()),A=D.multiplyVector3(C[s.c].position.clone()),D=s instanceof THREE.Face4?D.multiplyVector3(C[s.d].position.clone()):null,w=a.matrixRotationWorld.multiplyVector3(s.normal.clone()),u=I.dot(w),a.doubleSided||(a.flipSided?u>0:u<0)))if(u=w.dot((new THREE.Vector3).sub(v,E))/u,E=E.addSelf(I.multiplyScalar(u)),s instanceof THREE.Face3)b(E,v,q,A)&&(s={distance:this.origin.distanceTo(E),point:E,face:s,object:a},
|
|
|
+p.push(s));else if(s instanceof THREE.Face4&&(b(E,v,q,D)||b(E,q,A,D)))s={distance:this.origin.distanceTo(E),point:E,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,n){h=!1;c=e;b=f;d=l;g=n;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,n,r,m){h?(h=!1,c=e<l?e<r?e:r:l<r?l:r,b=f<n?f<m?f:m:n<m?n:m,d=e>l?e>r?e:r:l>r?l:r,g=f>n?f>m?f:m:n>m?n:m):(c=e<l?e<r?e<c?e:c:r<c?r:c:l<r?l<c?l:c:r<c?r:c,b=f<n?f<m?f<b?f:b:m<b?m:b:n<m?n<b?n:b:m<b?m:b,d=e>l?e>r?e>d?e:d:r>d?r:d:l>r?l>d?l:d:r>d?r:d,g=f>n?f>m?f>g?f:g:m>g?m:g:n>m?n>g?n:g:m>g?m: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,k,l,o,r,n,s,q){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,o||0,r||0,n||0,s||0,q!==void 0?q: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,o,r,n,s,q){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=o;this.n41=r;this.n42=n;this.n43=s;this.n44=q;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,o=a.n32,r=a.n33,n=a.n34,s=a.n41,q=a.n42,m=a.n43,
|
|
|
-u=a.n44,w=c.n11,p=c.n12,z=c.n13,C=c.n14,x=c.n21,v=c.n22,I=c.n23,H=c.n24,F=c.n31,B=c.n32,P=c.n33,Q=c.n34,aa=c.n41,N=c.n42,S=c.n43,ga=c.n44;this.n11=b*w+d*x+g*F+e*aa;this.n12=b*p+d*v+g*B+e*N;this.n13=b*z+d*I+g*P+e*S;this.n14=b*C+d*H+g*Q+e*ga;this.n21=f*w+h*x+i*F+k*aa;this.n22=f*p+h*v+i*B+k*N;this.n23=f*z+h*I+i*P+k*S;this.n24=f*C+h*H+i*Q+k*ga;this.n31=l*w+o*x+r*F+n*aa;this.n32=l*p+o*v+r*B+n*N;this.n33=l*z+o*I+r*P+n*S;this.n34=l*C+o*H+r*Q+n*ga;this.n41=s*w+q*x+m*F+u*aa;this.n42=s*p+q*v+m*B+u*N;this.n43=
|
|
|
-s*z+q*I+m*P+u*S;this.n44=s*C+q*H+m*Q+u*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,o=this.n34,r=this.n41,n=this.n42,s=this.n43,q=this.n44;return d*f*k*r-b*h*k*r-d*e*l*r+c*h*l*r+b*e*o*r-c*f*o*r-d*f*i*n+b*h*i*n+d*g*l*n-a*h*l*n-b*g*o*n+a*f*o*n+d*e*i*s-c*h*i*s-d*g*k*s+a*h*k*s+c*g*o*s-a*e*o*s-b*e*i*q+c*f*i*q+b*g*k*q-a*f*k*q-
|
|
|
-c*g*l*q+a*e*l*q},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,o=a.n33,r=a.n34,n=a.n41,s=a.n42,q=a.n43,m=a.n44;this.n11=h*r*s-i*o*s+i*l*q-f*r*q-h*l*m+f*o*m;this.n12=g*o*s-d*r*s-g*l*q+b*r*q+d*l*m-b*o*m;this.n13=d*i*s-g*h*s+g*f*q-b*i*q-d*f*m+b*h*m;this.n14=g*h*l-d*i*l-g*f*o+b*i*o+d*f*r-b*h*r;this.n21=i*o*n-h*r*n-i*k*q+e*r*q+h*k*m-e*o*m;this.n22=d*r*n-g*o*n+
|
|
|
-g*k*q-c*r*q-d*k*m+c*o*m;this.n23=g*h*n-d*i*n-g*e*q+c*i*q+d*e*m-c*h*m;this.n24=d*i*k-g*h*k+g*e*o-c*i*o-d*e*r+c*h*r;this.n31=f*r*n-i*l*n+i*k*s-e*r*s-f*k*m+e*l*m;this.n32=g*l*n-b*r*n-g*k*s+c*r*s+b*k*m-c*l*m;this.n33=d*i*n-g*f*n+g*e*s-c*i*s-b*e*m+c*f*m;this.n34=g*f*k-b*i*k-g*e*l+c*i*l+b*e*r-c*f*r;this.n41=h*l*n-f*o*n-h*k*s+e*o*s+f*k*q-e*l*q;this.n42=b*o*n-d*l*n+d*k*s-c*o*s-b*k*q+c*l*q;this.n43=d*f*n-b*h*n-d*e*s+c*h*s+b*e*q-c*f*q;this.n44=b*h*k-d*f*k+d*e*l-c*h*l-b*e*o+c*f*o;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,o=d*g;this.n11=i+o*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=o+i*b;this.n33=e*f;break;case "ZXY":i=f*h;k=f*g;l=d*h;o=d*g;this.n11=i-o*b;this.n12=-e*g;this.n13=l+k*b;this.n21=k+l*b;this.n22=e*h;this.n23=o-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;o=b*g;this.n11=f*h;this.n12=l*d-k;this.n13=i*d+o;this.n21=f*g;this.n22=o*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;o=b*d;this.n11=f*h;this.n12=o-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-o*g;break;case "XZY":i=e*f;k=e*d;l=b*f;o=b*d;this.n11=f*h;this.n12=-g;this.n13=d*h;this.n21=i*g+o;this.n22=e*h;this.n23=k*g-l;this.n31=l*g-k;this.n32=b*h;this.n33=o*g+i;break;default:i=e*h,k=e*
|
|
|
-g,l=b*h,o=b*g,this.n11=f*h,this.n12=-f*g,this.n13=d,this.n21=k+l*d,this.n22=i-o*d,this.n23=-b*f,this.n31=o-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*=
|
|
|
+THREE.Matrix4=function(a,c,b,d,g,e,f,h,i,k,l,n,r,m,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,n||0,r||0,m||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,n,r,m,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=n;this.n41=r;this.n42=m;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,n=a.n32,r=a.n33,m=a.n34,s=a.n41,p=a.n42,o=a.n43,
|
|
|
+t=a.n44,v=c.n11,q=c.n12,A=c.n13,D=c.n14,w=c.n21,u=c.n22,E=c.n23,I=c.n24,x=c.n31,C=c.n32,O=c.n33,G=c.n34,$=c.n41,M=c.n42,J=c.n43,da=c.n44;this.n11=b*v+d*w+g*x+e*$;this.n12=b*q+d*u+g*C+e*M;this.n13=b*A+d*E+g*O+e*J;this.n14=b*D+d*I+g*G+e*da;this.n21=f*v+h*w+i*x+k*$;this.n22=f*q+h*u+i*C+k*M;this.n23=f*A+h*E+i*O+k*J;this.n24=f*D+h*I+i*G+k*da;this.n31=l*v+n*w+r*x+m*$;this.n32=l*q+n*u+r*C+m*M;this.n33=l*A+n*E+r*O+m*J;this.n34=l*D+n*I+r*G+m*da;this.n41=s*v+p*w+o*x+t*$;this.n42=s*q+p*u+o*C+t*M;this.n43=s*
|
|
|
+A+p*E+o*O+t*J;this.n44=s*D+p*I+o*G+t*da;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,n=this.n34,r=this.n41,m=this.n42,s=this.n43,p=this.n44;return d*f*k*r-b*h*k*r-d*e*l*r+c*h*l*r+b*e*n*r-c*f*n*r-d*f*i*m+b*h*i*m+d*g*l*m-a*h*l*m-b*g*n*m+a*f*n*m+d*e*i*s-c*h*i*s-d*g*k*s+a*h*k*s+c*g*n*s-a*e*n*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,n=a.n33,r=a.n34,m=a.n41,s=a.n42,p=a.n43,o=a.n44;this.n11=h*r*s-i*n*s+i*l*p-f*r*p-h*l*o+f*n*o;this.n12=g*n*s-d*r*s-g*l*p+b*r*p+d*l*o-b*n*o;this.n13=d*i*s-g*h*s+g*f*p-b*i*p-d*f*o+b*h*o;this.n14=g*h*l-d*i*l-g*f*n+b*i*n+d*f*r-b*h*r;this.n21=i*n*m-h*r*m-i*k*p+e*r*p+h*k*o-e*n*o;this.n22=d*r*m-g*n*m+
|
|
|
+g*k*p-c*r*p-d*k*o+c*n*o;this.n23=g*h*m-d*i*m-g*e*p+c*i*p+d*e*o-c*h*o;this.n24=d*i*k-g*h*k+g*e*n-c*i*n-d*e*r+c*h*r;this.n31=f*r*m-i*l*m+i*k*s-e*r*s-f*k*o+e*l*o;this.n32=g*l*m-b*r*m-g*k*s+c*r*s+b*k*o-c*l*o;this.n33=d*i*m-g*f*m+g*e*s-c*i*s-b*e*o+c*f*o;this.n34=g*f*k-b*i*k-g*e*l+c*i*l+b*e*r-c*f*r;this.n41=h*l*m-f*n*m-h*k*s+e*n*s+f*k*p-e*l*p;this.n42=b*n*m-d*l*m+d*k*s-c*n*s-b*k*p+c*l*p;this.n43=d*f*m-b*h*m-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*n+c*f*n;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,n=d*g;this.n11=i+n*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=n+i*b;this.n33=e*f;break;case "ZXY":i=f*h;k=f*g;l=d*h;n=d*g;this.n11=i-n*b;this.n12=-e*g;this.n13=l+k*b;this.n21=k+l*b;this.n22=e*h;this.n23=n-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;n=b*g;this.n11=f*h;this.n12=l*d-k;this.n13=i*d+n;this.n21=f*g;this.n22=n*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;n=b*d;this.n11=f*h;this.n12=n-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-n*g;break;case "XZY":i=e*f;k=e*d;l=b*f;n=b*d;this.n11=f*h;this.n12=-g;this.n13=d*h;this.n21=i*g+n;this.n22=e*h;this.n23=k*g-l;this.n31=l*g-k;this.n32=b*h;this.n33=n*g+i;break;default:i=e*h,k=e*
|
|
|
+g,l=b*h,n=b*g,this.n11=f*h,this.n12=-f*g,this.n13=d,this.n21=k+l*d,this.n22=i-n*d,this.n23=-b*f,this.n31=n-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,k=a.n23*a.n12-a.n22*a.n13,l=-a.n23*a.n11+a.n21*a.n13,o=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*o;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,n=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*n;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,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=
|
|
@@ -56,23 +56,23 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){thi
|
|
|
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=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,o,r=[],n,s=[],q,m,u=[],w,p,z=[],C={objects:[],sprites:[],lights:[],elements:[]},x=new THREE.Vector3,v=new THREE.Vector4,I=new THREE.Matrix4,H=new THREE.Matrix4,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],B=new THREE.Vector4,P=new THREE.Vector4;this.computeFrustum=function(a){F[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);F[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);F[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
|
-a.n23,a.n44+a.n24);F[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);F[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);F[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=F[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);I.multiply(b.projectionMatrix,b.matrixWorldInverse);I.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
-I.multiply(b.matrixWorld,b.projectionMatrixInverse);I.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;C.objects.length=0;C.sprites.length=0;C.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=F[h].x*d.n14+F[h].y*d.n24+F[h].z*d.n34+F[h].w,c<=e){c=!1;break a}c=!0}c?(I.multiplyVector3(x.copy(b.position)),g=a(),g.object=b,g.z=x.z,C.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(I.multiplyVector3(x.copy(b.position)),g=a(),g.object=b,g.z=x.z,C.sprites.push(g)):b instanceof THREE.Light&&C.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
|
|
|
-C.objects.sort(b);return C};this.projectScene=function(a,e,g){var f=e.near,x=e.far,F,ba,D,A,j,J,R,ja,ea,E,fa,W,$,U,Z,T;p=m=n=o=0;C.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);I.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(I);C=this.projectGraph(a,!1);a=0;for(F=C.objects.length;a<F;a++)if(ea=C.objects[a].object,E=ea.matrixWorld,
|
|
|
-W=ea.material,i=0,ea instanceof THREE.Mesh){fa=ea.geometry;$=ea.geometry.materials;A=fa.vertices;U=fa.faces;Z=fa.faceVertexUvs;fa=ea.matrixRotationWorld.extractRotation(E);ba=0;for(D=A.length;ba<D;ba++)h=c(),h.positionWorld.copy(A[ba].position),E.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),I.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<x;A=0;for(ba=U.length;A<
|
|
|
-ba;A++){D=U[A];if(D instanceof THREE.Face3)if(j=k[D.a],J=k[D.b],R=k[D.c],j.visible&&J.visible&&R.visible&&(ea.doubleSided||ea.flipSided!=(R.positionScreen.x-j.positionScreen.x)*(J.positionScreen.y-j.positionScreen.y)-(R.positionScreen.y-j.positionScreen.y)*(J.positionScreen.x-j.positionScreen.x)<0))ja=r[o]=r[o]||new THREE.RenderableFace3,o++,l=ja,l.v1.copy(j),l.v2.copy(J),l.v3.copy(R);else continue;else if(D instanceof THREE.Face4)if(j=k[D.a],J=k[D.b],R=k[D.c],ja=k[D.d],j.visible&&J.visible&&R.visible&&
|
|
|
-ja.visible&&(ea.doubleSided||ea.flipSided!=((ja.positionScreen.x-j.positionScreen.x)*(J.positionScreen.y-j.positionScreen.y)-(ja.positionScreen.y-j.positionScreen.y)*(J.positionScreen.x-j.positionScreen.x)<0||(J.positionScreen.x-R.positionScreen.x)*(ja.positionScreen.y-R.positionScreen.y)-(J.positionScreen.y-R.positionScreen.y)*(ja.positionScreen.x-R.positionScreen.x)<0)))T=s[n]=s[n]||new THREE.RenderableFace4,n++,l=T,l.v1.copy(j),l.v2.copy(J),l.v3.copy(R),l.v4.copy(ja);else continue;l.normalWorld.copy(D.normal);
|
|
|
-fa.multiplyVector3(l.normalWorld);l.centroidWorld.copy(D.centroid);E.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);I.multiplyVector3(l.centroidScreen);R=D.vertexNormals;j=0;for(J=R.length;j<J;j++)ja=l.vertexNormalsWorld[j],ja.copy(R[j]),fa.multiplyVector3(ja);j=0;for(J=Z.length;j<J;j++)if(T=Z[j][A]){R=0;for(ja=T.length;R<ja;R++)l.uvs[j][R]=T[R]}l.material=W;l.faceMaterial=D.materialIndex!==null?$[D.materialIndex]:null;l.z=l.centroidScreen.z;C.elements.push(l)}}else if(ea instanceof
|
|
|
-THREE.Line){H.multiply(I,E);A=ea.geometry.vertices;j=c();j.positionScreen.copy(A[0].position);H.multiplyVector4(j.positionScreen);ba=1;for(D=A.length;ba<D;ba++)if(j=c(),j.positionScreen.copy(A[ba].position),H.multiplyVector4(j.positionScreen),J=k[i-2],B.copy(j.positionScreen),P.copy(J.positionScreen),d(B,P))B.multiplyScalar(1/B.w),P.multiplyScalar(1/P.w),ea=u[m]=u[m]||new THREE.RenderableLine,m++,q=ea,q.v1.positionScreen.copy(B),q.v2.positionScreen.copy(P),q.z=Math.max(B.z,P.z),q.material=W,C.elements.push(q)}a=
|
|
|
-0;for(F=C.sprites.length;a<F;a++)if(ea=C.sprites[a].object,E=ea.matrixWorld,ea instanceof THREE.Particle&&(v.set(E.n14,E.n24,E.n34,1),I.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))f=z[p]=z[p]||new THREE.RenderableParticle,p++,w=f,w.x=v.x/v.w,w.y=v.y/v.w,w.z=v.z,w.rotation=ea.rotation.z,w.scale.x=ea.scale.x*Math.abs(w.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),w.scale.y=ea.scale.y*Math.abs(w.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),w.material=ea.material,C.elements.push(w);
|
|
|
-g&&C.elements.sort(b);return C}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
|
|
|
+l,n,r=[],m,s=[],p,o,t=[],v,q,A=[],D={objects:[],sprites:[],lights:[],elements:[]},w=new THREE.Vector3,u=new THREE.Vector4,E=new THREE.Matrix4,I=new THREE.Matrix4,x=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],C=new THREE.Vector4,O=new THREE.Vector4;this.computeFrustum=function(a){x[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);x[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);x[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
|
+a.n23,a.n44+a.n24);x[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);x[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);x[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=x[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);E.multiply(b.projectionMatrix,b.matrixWorldInverse);E.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
+E.multiply(b.matrixWorld,b.projectionMatrixInverse);E.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;D.objects.length=0;D.sprites.length=0;D.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=x[h].x*d.n14+x[h].y*d.n24+x[h].z*d.n34+x[h].w,c<=e){c=!1;break a}c=!0}c?(E.multiplyVector3(w.copy(b.position)),g=a(),g.object=b,g.z=w.z,D.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(E.multiplyVector3(w.copy(b.position)),g=a(),g.object=b,g.z=w.z,D.sprites.push(g)):b instanceof THREE.Light&&D.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
|
|
|
+D.objects.sort(b);return D};this.projectScene=function(a,e,g){var f=e.near,w=e.far,x,V,y,B,j,Q,P,ia,S,N,ca,ba,R,U,Z,W;q=o=m=n=0;D.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);E.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(E);D=this.projectGraph(a,!1);a=0;for(x=D.objects.length;a<x;a++)if(S=D.objects[a].object,N=S.matrixWorld,
|
|
|
+ba=S.material,i=0,S instanceof THREE.Mesh){ca=S.geometry;R=S.geometry.materials;B=ca.vertices;U=ca.faces;Z=ca.faceVertexUvs;ca=S.matrixRotationWorld.extractRotation(N);V=0;for(y=B.length;V<y;V++)h=c(),h.positionWorld.copy(B[V].position),N.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),E.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<w;B=0;for(V=U.length;B<V;B++){y=
|
|
|
+U[B];if(y instanceof THREE.Face3)if(j=k[y.a],Q=k[y.b],P=k[y.c],j.visible&&Q.visible&&P.visible&&(S.doubleSided||S.flipSided!=(P.positionScreen.x-j.positionScreen.x)*(Q.positionScreen.y-j.positionScreen.y)-(P.positionScreen.y-j.positionScreen.y)*(Q.positionScreen.x-j.positionScreen.x)<0))ia=r[n]=r[n]||new THREE.RenderableFace3,n++,l=ia,l.v1.copy(j),l.v2.copy(Q),l.v3.copy(P);else continue;else if(y instanceof THREE.Face4)if(j=k[y.a],Q=k[y.b],P=k[y.c],ia=k[y.d],j.visible&&Q.visible&&P.visible&&ia.visible&&
|
|
|
+(S.doubleSided||S.flipSided!=((ia.positionScreen.x-j.positionScreen.x)*(Q.positionScreen.y-j.positionScreen.y)-(ia.positionScreen.y-j.positionScreen.y)*(Q.positionScreen.x-j.positionScreen.x)<0||(Q.positionScreen.x-P.positionScreen.x)*(ia.positionScreen.y-P.positionScreen.y)-(Q.positionScreen.y-P.positionScreen.y)*(ia.positionScreen.x-P.positionScreen.x)<0)))W=s[m]=s[m]||new THREE.RenderableFace4,m++,l=W,l.v1.copy(j),l.v2.copy(Q),l.v3.copy(P),l.v4.copy(ia);else continue;l.normalWorld.copy(y.normal);
|
|
|
+ca.multiplyVector3(l.normalWorld);l.centroidWorld.copy(y.centroid);N.multiplyVector3(l.centroidWorld);l.centroidScreen.copy(l.centroidWorld);E.multiplyVector3(l.centroidScreen);P=y.vertexNormals;j=0;for(Q=P.length;j<Q;j++)ia=l.vertexNormalsWorld[j],ia.copy(P[j]),ca.multiplyVector3(ia);j=0;for(Q=Z.length;j<Q;j++)if(W=Z[j][B]){P=0;for(ia=W.length;P<ia;P++)l.uvs[j][P]=W[P]}l.material=ba;l.faceMaterial=y.materialIndex!==null?R[y.materialIndex]:null;l.z=l.centroidScreen.z;D.elements.push(l)}}else if(S instanceof
|
|
|
+THREE.Line){I.multiply(E,N);B=S.geometry.vertices;j=c();j.positionScreen.copy(B[0].position);I.multiplyVector4(j.positionScreen);V=1;for(y=B.length;V<y;V++)if(j=c(),j.positionScreen.copy(B[V].position),I.multiplyVector4(j.positionScreen),Q=k[i-2],C.copy(j.positionScreen),O.copy(Q.positionScreen),d(C,O))C.multiplyScalar(1/C.w),O.multiplyScalar(1/O.w),S=t[o]=t[o]||new THREE.RenderableLine,o++,p=S,p.v1.positionScreen.copy(C),p.v2.positionScreen.copy(O),p.z=Math.max(C.z,O.z),p.material=ba,D.elements.push(p)}a=
|
|
|
+0;for(x=D.sprites.length;a<x;a++)if(S=D.sprites[a].object,N=S.matrixWorld,S instanceof THREE.Particle&&(u.set(N.n14,N.n24,N.n34,1),E.multiplyVector4(u),u.z/=u.w,u.z>0&&u.z<1))f=A[q]=A[q]||new THREE.RenderableParticle,q++,v=f,v.x=u.x/u.w,v.y=u.y/u.w,v.z=u.z,v.rotation=S.rotation.z,v.scale.x=S.scale.x*Math.abs(v.x-(u.x+e.projectionMatrix.n11)/(u.w+e.projectionMatrix.n14)),v.scale.y=S.scale.y*Math.abs(v.y-(u.y+e.projectionMatrix.n22)/(u.w+e.projectionMatrix.n24)),v.material=S.material,D.elements.push(v);
|
|
|
+g&&D.elements.sort(b);return D}};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,k=i*b+f*g-h*d,l=i*d+h*b-e*g,o=i*g+e*d-f*b,b=-e*
|
|
|
-b-f*d-h*g;c.x=k*i+b*-e+l*-h-o*-f;c.y=l*i+b*-f+o*-e-k*-h;c.z=o*i+b*-h+k*-f-l*-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,n=i*g+e*d-f*b,b=-e*
|
|
|
+b-f*d-h*g;c.x=k*i+b*-e+l*-h-n*-f;c.y=l*i+b*-f+n*-e-k*-h;c.z=n*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,14 +83,14 @@ 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,I){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=f[e];o=f[g];r=f[I];n=i.x-h.x;s=k.x-h.x;q=i.y-h.y;m=k.y-h.y;u=i.z-h.z;w=k.z-h.z;p=o.u-l.u;z=r.u-l.u;C=o.v-l.v;x=r.v-l.v;v=1/(p*x-z*C);B.set((x*n-C*s)*v,(x*q-C*m)*v,(x*u-C*w)*v);P.set((p*s-z*n)*v,(p*m-z*q)*v,(p*w-z*u)*v);H[b].addSelf(B);H[c].addSelf(B);H[d].addSelf(B);F[b].addSelf(P);
|
|
|
-F[c].addSelf(P);F[d].addSelf(P)}var c,b,d,g,e,f,h,i,k,l,o,r,n,s,q,m,u,w,p,z,C,x,v,I,H=[],F=[],B=new THREE.Vector3,P=new THREE.Vector3,Q=new THREE.Vector3,aa=new THREE.Vector3,N=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)H[c]=new THREE.Vector3,F[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 S=["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++)N.copy(e.vertexNormals[d]),g=e[S[d]],I=H[g],Q.copy(I),Q.subSelf(N.multiplyScalar(N.dot(I))).normalize(),aa.cross(e.vertexNormals[d],I),g=aa.dot(F[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(Q.x,Q.y,Q.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,E){h=a.vertices[b].position;i=a.vertices[c].position;k=a.vertices[d].position;l=f[e];n=f[g];r=f[E];m=i.x-h.x;s=k.x-h.x;p=i.y-h.y;o=k.y-h.y;t=i.z-h.z;v=k.z-h.z;q=n.u-l.u;A=r.u-l.u;D=n.v-l.v;w=r.v-l.v;u=1/(q*w-A*D);C.set((w*m-D*s)*u,(w*p-D*o)*u,(w*t-D*v)*u);O.set((q*s-A*m)*u,(q*o-A*p)*u,(q*v-A*t)*u);I[b].addSelf(C);I[c].addSelf(C);I[d].addSelf(C);x[b].addSelf(O);
|
|
|
+x[c].addSelf(O);x[d].addSelf(O)}var c,b,d,g,e,f,h,i,k,l,n,r,m,s,p,o,t,v,q,A,D,w,u,E,I=[],x=[],C=new THREE.Vector3,O=new THREE.Vector3,G=new THREE.Vector3,$=new THREE.Vector3,M=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)I[c]=new THREE.Vector3,x[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 J=["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[J[d]],E=I[g],G.copy(E),G.subSelf(M.multiplyScalar(M.dot(E))).normalize(),$.cross(e.vertexNormals[d],E),g=$.dot(x[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(G.x,G.y,G.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,k,l,o,r;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]];
|
|
|
-o=this.points[b[2]];r=this.points[b[3]];h=f*f;i=f*h;d.x=c(k.x,l.x,o.x,r.x,f,h,i);d.y=c(k.y,l.y,o.y,r.y,f,h,i);d.z=c(k.z,l.z,o.z,r.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),
|
|
|
+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,n,r;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]];
|
|
|
+n=this.points[b[2]];r=this.points[b[3]];h=f*f;i=f*h;d.x=c(k.x,l.x,n.x,r.x,f,h,i);d.y=c(k.y,l.y,n.y,r.y,f,h,i);d.z=c(k.z,l.z,n.z,r.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;
|
|
@@ -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,k,l,o,r,n,s,q;a=c.projectScene(b,d);i=0;for(k=a.length;i<k;i++)if(r=a[i],r instanceof THREE.RenderableParticle){s=r.x*g+g;q=r.y*e+e;l=0;for(o=r.material.length;l<o;l++)if(n=r.material[l],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=s+"px",n.style.top=q+"px"}}};
|
|
|
-THREE.CanvasRenderer=function(a){function c(a){if(w!=a)q.globalAlpha=w=a}function b(a){if(p!=a){switch(a){case THREE.NormalBlending:q.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:q.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:q.globalCompositeOperation="darker"}p=a}}function d(a){if(z!=a)q.strokeStyle=z=a}function g(a){if(C!=a)q.fillStyle=C=a}var e=this,f,h,i,k=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
-o,r,n,s,q=l.getContext("2d"),m=new THREE.Color(0),u=0,w=1,p=0,z=null,C=null,x=null,v=null,I=null,H,F,B,P,Q=new THREE.RenderableVertex,aa=new THREE.RenderableVertex,N,S,ga,da,ba,D,A,j,J,R,ja,ea,E=new THREE.Color,fa=new THREE.Color,W=new THREE.Color,$=new THREE.Color,U=new THREE.Color,Z=[],T,la,ua,na,xa,va,ta,ra,pa,M,V=new THREE.Rectangle,ia=new THREE.Rectangle,G=new THREE.Rectangle,ha=!1,qa=new THREE.Color,X=new THREE.Color,ka=new THREE.Color,ca=new THREE.Vector3,wa,O,ma,oa,Y,Fa,a=16;wa=document.createElement("canvas");
|
|
|
-wa.width=wa.height=2;O=wa.getContext("2d");O.fillStyle="rgba(0,0,0,1)";O.fillRect(0,0,2,2);ma=O.getImageData(0,0,2,2);oa=ma.data;Y=document.createElement("canvas");Y.width=Y.height=a;Fa=Y.getContext("2d");Fa.translate(-a/2,-a/2);Fa.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){o=a;r=b;n=Math.floor(o/2);s=Math.floor(r/2);l.width=o;l.height=r;V.set(-n,-s,n,s);ia.set(-n,-s,n,s);w=1;p=0;I=v=x=C=
|
|
|
-z=null};this.setClearColor=function(a,b){m.copy(a);u=b;ia.set(-n,-s,n,s)};this.setClearColorHex=function(a,b){m.setHex(a);u=b;ia.set(-n,-s,n,s)};this.clear=function(){q.setTransform(1,0,0,-1,n,s);ia.isEmpty()||(ia.minSelf(V),ia.inflate(2),u<1&&q.clearRect(Math.floor(ia.getX()),Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight())),u>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(m.r*255)+","+Math.floor(m.g*255)+","+Math.floor(m.b*255)+","+u+")"),q.fillRect(Math.floor(ia.getX()),
|
|
|
-Math.floor(ia.getY()),Math.floor(ia.getWidth()),Math.floor(ia.getHeight()))),ia.empty())};this.render=function(a,l){function o(a){var b,c,d,e;qa.setRGB(0,0,0);X.setRGB(0,0,0);ka.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(qa.r+=e.r,qa.g+=e.g,qa.b+=e.b):d instanceof THREE.DirectionalLight?(X.r+=e.r,X.g+=e.g,X.b+=e.b):d instanceof THREE.PointLight&&(ka.r+=e.r,ka.g+=e.g,ka.b+=e.b)}function r(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(ca.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 m(a,e,f){c(f.opacity);b(f.blending);var j,h,i,k,l,Y;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,l=k.width>>1,Y=k.height>>
|
|
|
-1,f=e.scale.x*n,i=e.scale.y*s,j=f*l,h=i*Y,G.set(a.x-j,a.y-h,a.x+j,a.y+h),V.intersects(G)&&(q.save(),q.translate(a.x,a.y),q.rotate(-e.rotation),q.scale(f,-i),q.translate(-l,-Y),q.drawImage(k,0,0),q.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*n,h=e.scale.y*s,G.set(a.x-j,a.y-h,a.x+j,a.y+h),V.intersects(G)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),q.save(),q.translate(a.x,a.y),q.rotate(-e.rotation),q.scale(j,h),f.program(q),q.restore()))}function p(a,e,g,
|
|
|
-f){c(f.opacity);b(f.blending);q.beginPath();q.moveTo(a.positionScreen.x,a.positionScreen.y);q.lineTo(e.positionScreen.x,e.positionScreen.y);q.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(x!=a)q.lineWidth=x=a;a=f.linecap;if(v!=a)q.lineCap=v=a;a=f.linejoin;if(I!=a)q.lineJoin=I=a;d(f.color.getContextStyle());q.stroke();G.inflate(f.linewidth*2)}}function u(a,d,f,g,j,h,k,n){e.info.render.vertices+=3;e.info.render.faces++;c(n.opacity);b(n.blending);N=a.positionScreen.x;S=a.positionScreen.y;
|
|
|
-ga=d.positionScreen.x;da=d.positionScreen.y;ba=f.positionScreen.x;D=f.positionScreen.y;Ea(N,S,ga,da,ba,D);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(na=k.uvs[0],C(N,S,ga,da,ba,D,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,ca.copy(k.vertexNormalsWorld[g]),xa=(ca.x*a.n11+ca.y*a.n12+ca.z*a.n13)*0.5+0.5,va=-(ca.x*a.n21+ca.y*a.n22+ca.z*a.n23)*
|
|
|
-0.5+0.5,ca.copy(k.vertexNormalsWorld[j]),ta=(ca.x*a.n11+ca.y*a.n12+ca.z*a.n13)*0.5+0.5,ra=-(ca.x*a.n21+ca.y*a.n22+ca.z*a.n23)*0.5+0.5,ca.copy(k.vertexNormalsWorld[h]),pa=(ca.x*a.n11+ca.y*a.n12+ca.z*a.n13)*0.5+0.5,M=-(ca.x*a.n21+ca.y*a.n22+ca.z*a.n23)*0.5+0.5,C(N,S,ga,da,ba,D,xa,va,ta,ra,pa,M,n.envMap)}else n.wireframe?z(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&
|
|
|
-(na=k.uvs[0],C(N,S,ga,da,ba,D,na[g].u,na[g].v,na[j].u,na[j].v,na[h].u,na[h].v,n.map)),b(THREE.SubtractiveBlending)),ha?!n.wireframe&&n.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(fa.r=W.r=$.r=qa.r,fa.g=W.g=$.g=qa.g,fa.b=W.b=$.b=qa.b,r(i,k.v1.positionWorld,k.vertexNormalsWorld[0],fa),r(i,k.v2.positionWorld,k.vertexNormalsWorld[1],W),r(i,k.v3.positionWorld,k.vertexNormalsWorld[2],$),fa.r=Math.max(0,Math.min(n.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(n.color.g*fa.g,1)),fa.b=Math.max(0,
|
|
|
-Math.min(n.color.b*fa.b,1)),W.r=Math.max(0,Math.min(n.color.r*W.r,1)),W.g=Math.max(0,Math.min(n.color.g*W.g,1)),W.b=Math.max(0,Math.min(n.color.b*W.b,1)),$.r=Math.max(0,Math.min(n.color.r*$.r,1)),$.g=Math.max(0,Math.min(n.color.g*$.g,1)),$.b=Math.max(0,Math.min(n.color.b*$.b,1)),U.r=(W.r+$.r)*0.5,U.g=(W.g+$.g)*0.5,U.b=(W.b+$.b)*0.5,ua=Ga(fa,W,$,U),Ca(N,S,ga,da,ba,D,0,0,1,0,0,1,ua)):(E.r=qa.r,E.g=qa.g,E.b=qa.b,r(i,k.centroidWorld,k.normalWorld,E),E.r=Math.max(0,Math.min(n.color.r*E.r,1)),E.g=Math.max(0,
|
|
|
-Math.min(n.color.g*E.g,1)),E.b=Math.max(0,Math.min(n.color.b*E.b,1)),n.wireframe?z(E,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(E)):n.wireframe?z(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(n.color);else if(n instanceof THREE.MeshDepthMaterial)T=l.near,la=l.far,fa.r=fa.g=fa.b=1-Ba(a.positionScreen.z,T,la),W.r=W.g=W.b=1-Ba(d.positionScreen.z,T,la),$.r=$.g=$.b=1-Ba(f.positionScreen.z,T,la),U.r=(W.r+$.r)*0.5,U.g=(W.g+$.g)*0.5,U.b=(W.b+$.b)*0.5,ua=Ga(fa,
|
|
|
-W,$,U),Ca(N,S,ga,da,ba,D,0,0,1,0,0,1,ua);else if(n instanceof THREE.MeshNormalMaterial)E.r=Da(k.normalWorld.x),E.g=Da(k.normalWorld.y),E.b=Da(k.normalWorld.z),n.wireframe?z(E,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(E)}function w(a,d,f,g,h,n,k,Y,o){e.info.render.vertices+=4;e.info.render.faces++;c(Y.opacity);b(Y.blending);if(Y.map||Y.envMap)u(a,d,g,0,1,3,k,Y,o),u(h,f,n,1,2,3,k,Y,o);else if(N=a.positionScreen.x,S=a.positionScreen.y,ga=d.positionScreen.x,da=d.positionScreen.y,
|
|
|
-ba=f.positionScreen.x,D=f.positionScreen.y,A=g.positionScreen.x,j=g.positionScreen.y,J=h.positionScreen.x,R=h.positionScreen.y,ja=n.positionScreen.x,ea=n.positionScreen.y,Y instanceof THREE.MeshBasicMaterial)Ha(N,S,ga,da,ba,D,A,j),Y.wireframe?z(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):za(Y.color);else if(Y instanceof THREE.MeshLambertMaterial)ha?!Y.wireframe&&Y.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==4?(fa.r=W.r=$.r=U.r=qa.r,fa.g=W.g=$.g=U.g=qa.g,fa.b=
|
|
|
-W.b=$.b=U.b=qa.b,r(i,k.v1.positionWorld,k.vertexNormalsWorld[0],fa),r(i,k.v2.positionWorld,k.vertexNormalsWorld[1],W),r(i,k.v4.positionWorld,k.vertexNormalsWorld[3],$),r(i,k.v3.positionWorld,k.vertexNormalsWorld[2],U),fa.r=Math.max(0,Math.min(Y.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(Y.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(Y.color.b*fa.b,1)),W.r=Math.max(0,Math.min(Y.color.r*W.r,1)),W.g=Math.max(0,Math.min(Y.color.g*W.g,1)),W.b=Math.max(0,Math.min(Y.color.b*W.b,1)),$.r=Math.max(0,Math.min(Y.color.r*
|
|
|
-$.r,1)),$.g=Math.max(0,Math.min(Y.color.g*$.g,1)),$.b=Math.max(0,Math.min(Y.color.b*$.b,1)),U.r=Math.max(0,Math.min(Y.color.r*U.r,1)),U.g=Math.max(0,Math.min(Y.color.g*U.g,1)),U.b=Math.max(0,Math.min(Y.color.b*U.b,1)),ua=Ga(fa,W,$,U),Ea(N,S,ga,da,A,j),Ca(N,S,ga,da,A,j,0,0,1,0,0,1,ua),Ea(J,R,ba,D,ja,ea),Ca(J,R,ba,D,ja,ea,1,0,1,1,0,1,ua)):(E.r=qa.r,E.g=qa.g,E.b=qa.b,r(i,k.centroidWorld,k.normalWorld,E),E.r=Math.max(0,Math.min(Y.color.r*E.r,1)),E.g=Math.max(0,Math.min(Y.color.g*E.g,1)),E.b=Math.max(0,
|
|
|
-Math.min(Y.color.b*E.b,1)),Ha(N,S,ga,da,ba,D,A,j),Y.wireframe?z(E,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):za(E)):(Ha(N,S,ga,da,ba,D,A,j),Y.wireframe?z(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):za(Y.color));else if(Y instanceof THREE.MeshNormalMaterial)E.r=Da(k.normalWorld.x),E.g=Da(k.normalWorld.y),E.b=Da(k.normalWorld.z),Ha(N,S,ga,da,ba,D,A,j),Y.wireframe?z(E,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):za(E);else if(Y instanceof THREE.MeshDepthMaterial)T=
|
|
|
-l.near,la=l.far,fa.r=fa.g=fa.b=1-Ba(a.positionScreen.z,T,la),W.r=W.g=W.b=1-Ba(d.positionScreen.z,T,la),$.r=$.g=$.b=1-Ba(g.positionScreen.z,T,la),U.r=U.g=U.b=1-Ba(f.positionScreen.z,T,la),ua=Ga(fa,W,$,U),Ea(N,S,ga,da,A,j),Ca(N,S,ga,da,A,j,0,0,1,0,0,1,ua),Ea(J,R,ba,D,ja,ea),Ca(J,R,ba,D,ja,ea,1,0,1,1,0,1,ua)}function Ea(a,b,c,d,e,f){q.beginPath();q.moveTo(a,b);q.lineTo(c,d);q.lineTo(e,f);q.lineTo(a,b);q.closePath()}function Ha(a,b,c,d,e,f,g,j){q.beginPath();q.moveTo(a,b);q.lineTo(c,d);q.lineTo(e,f);
|
|
|
-q.lineTo(g,j);q.lineTo(a,b);q.closePath()}function z(a,b,c,e){if(x!=b)q.lineWidth=x=b;if(v!=c)q.lineCap=v=c;if(I!=e)q.lineJoin=I=e;d(a.getContextStyle());q.stroke();G.inflate(b*2)}function za(a){g(a.getContextStyle());q.fill()}function C(a,b,c,d,e,f,j,h,i,n,k,Y,l){if(l.image.width!=0){if(l.needsUpdate==!0||Z[l.id]==void 0){var o=l.wrapS==THREE.RepeatWrapping,r=l.wrapT==THREE.RepeatWrapping;Z[l.id]=q.createPattern(l.image,o&&r?"repeat":o&&!r?"repeat-x":!o&&r?"repeat-y":"no-repeat");l.needsUpdate=!1}g(Z[l.id]);
|
|
|
-var o=l.offset.x/l.repeat.x,r=l.offset.y/l.repeat.y,M=(l.image.width-1)*l.repeat.x,l=(l.image.height-1)*l.repeat.y,j=(j+o)*M,h=(h+r)*l,i=(i+o)*M,n=(n+r)*l,k=(k+o)*M,Y=(Y+r)*l;c-=a;d-=b;e-=a;f-=b;i-=j;n-=h;k-=j;Y-=h;o=1/(i*Y-k*n);l=(Y*c-n*e)*o;n=(Y*d-n*f)*o;c=(i*e-k*c)*o;d=(i*f-k*d)*o;a=a-l*j-c*h;b=b-n*j-d*h;q.save();q.transform(l,n,c,d,a,b);q.fill();q.restore()}}function Ca(a,b,c,d,e,f,g,j,h,i,n,k,Y){var l,o;l=Y.width-1;o=Y.height-1;g*=l;j*=o;h*=l;i*=o;n*=l;k*=o;c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;n-=g;
|
|
|
-k-=j;o=1/(h*k-n*i);l=(k*c-i*e)*o;i=(k*d-i*f)*o;c=(h*e-n*c)*o;d=(h*f-n*d)*o;a=a-l*g-c*j;b=b-i*g-d*j;q.save();q.transform(l,i,c,d,a,b);q.clip();q.drawImage(Y,0,0);q.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);oa[0]=e<0?0:e>255?255:e;oa[1]=f<0?0:f>255?255:f;oa[2]=a<0?0:a>255?255:a;oa[4]=g<0?0:g>255?255:g;oa[5]=j<0?0:j>255?255:j;oa[6]=b<0?0:b>255?
|
|
|
-255:b;oa[8]=h<0?0:h>255?255:h;oa[9]=i<0?0:i>255?255:i;oa[10]=c<0?0:c>255?255:c;oa[12]=n<0?0:n>255?255:n;oa[13]=k<0?0:k>255?255:k;oa[14]=d<0?0:d>255?255:d;O.putImageData(ma,0,0);Fa.drawImage(wa,0,0);return Y}function Ba(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Da(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Aa(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 Ia,Ja,sa,ya;this.autoClear?this.clear():q.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;(ha=i.length>0)&&o(i);Ia=0;for(Ja=h.length;Ia<Ja;Ia++)if(sa=h[Ia],ya=sa.material,ya=ya instanceof THREE.MeshFaceMaterial?sa.faceMaterial:ya,!(ya==null||ya.opacity==0)){G.empty();if(sa instanceof THREE.RenderableParticle)H=sa,H.x*=n,H.y*=s,m(H,sa,ya,a);else if(sa instanceof THREE.RenderableLine)H=sa.v1,F=sa.v2,H.positionScreen.x*=n,H.positionScreen.y*=s,F.positionScreen.x*=n,F.positionScreen.y*=s,G.addPoint(H.positionScreen.x,
|
|
|
-H.positionScreen.y),G.addPoint(F.positionScreen.x,F.positionScreen.y),V.intersects(G)&&p(H,F,sa,ya,a);else if(sa instanceof THREE.RenderableFace3)H=sa.v1,F=sa.v2,B=sa.v3,H.positionScreen.x*=n,H.positionScreen.y*=s,F.positionScreen.x*=n,F.positionScreen.y*=s,B.positionScreen.x*=n,B.positionScreen.y*=s,ya.overdraw&&(Aa(H.positionScreen,F.positionScreen),Aa(F.positionScreen,B.positionScreen),Aa(B.positionScreen,H.positionScreen)),G.add3Points(H.positionScreen.x,H.positionScreen.y,F.positionScreen.x,
|
|
|
-F.positionScreen.y,B.positionScreen.x,B.positionScreen.y),V.intersects(G)&&u(H,F,B,0,1,2,sa,ya,a);else if(sa instanceof THREE.RenderableFace4)H=sa.v1,F=sa.v2,B=sa.v3,P=sa.v4,H.positionScreen.x*=n,H.positionScreen.y*=s,F.positionScreen.x*=n,F.positionScreen.y*=s,B.positionScreen.x*=n,B.positionScreen.y*=s,P.positionScreen.x*=n,P.positionScreen.y*=s,Q.positionScreen.copy(F.positionScreen),aa.positionScreen.copy(P.positionScreen),ya.overdraw&&(Aa(H.positionScreen,F.positionScreen),Aa(F.positionScreen,
|
|
|
-P.positionScreen),Aa(P.positionScreen,H.positionScreen),Aa(B.positionScreen,Q.positionScreen),Aa(B.positionScreen,aa.positionScreen)),G.addPoint(H.positionScreen.x,H.positionScreen.y),G.addPoint(F.positionScreen.x,F.positionScreen.y),G.addPoint(B.positionScreen.x,B.positionScreen.y),G.addPoint(P.positionScreen.x,P.positionScreen.y),V.intersects(G)&&w(H,F,B,P,Q,aa,sa,ya,a);ia.addRectangle(G)}q.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,n;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),n=c.dot(i),n<=0||(n*=g.intensity,d.r+=h.r*n,d.g+=h.g*n,d.b+=h.b*n)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),n=c.dot(H.sub(i,b).normalize()),n<=0||(n*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),n!=0&&(n*=g.intensity,d.r+=h.r*n,d.g+=h.g*n,d.b+=h.b*n)))}function c(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"path"),N==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[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,o,r,n,s,q,m,u=new THREE.Rectangle,w=new THREE.Rectangle,p=!1,z=new THREE.Color,C=new THREE.Color,x=new THREE.Color,v=new THREE.Color,I,H=new THREE.Vector3,F=[],B=[],P,Q,aa,N=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":N=1;break;case "low":N=0}};this.setSize=function(a,b){k=a;l=b;o=k/2;r=l/2;i.setAttribute("viewBox",-o+" "+-r+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);u.set(-o,-r,o,r)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var H,F,D,A;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;aa=Q=0;if(p=f.length>0){C.setRGB(0,0,0);x.setRGB(0,0,0);v.setRGB(0,0,0);H=0;for(F=f.length;H<F;H++)A=f[H],D=A.color,A instanceof THREE.AmbientLight?(C.r+=D.r,C.g+=D.g,C.b+=D.b):A instanceof THREE.DirectionalLight?(x.r+=D.r,x.g+=D.g,x.b+=D.b):A instanceof THREE.PointLight&&(v.r+=D.r,v.g+=D.g,v.b+=D.b)}H=0;for(F=e.length;H<F;H++)if(D=e[H],A=D.material,A=A instanceof THREE.MeshFaceMaterial?D.faceMaterial:A,!(A==null||A.opacity==0))if(w.empty(),D instanceof THREE.RenderableParticle)n=D,n.x*=
|
|
|
-o,n.y*=-r;else if(D instanceof THREE.RenderableLine){if(n=D.v1,s=D.v2,n.positionScreen.x*=o,n.positionScreen.y*=-r,s.positionScreen.x*=o,s.positionScreen.y*=-r,w.addPoint(n.positionScreen.x,n.positionScreen.y),w.addPoint(s.positionScreen.x,s.positionScreen.y),u.intersects(w)){D=n;var j=s,J=aa++;B[J]==null&&(B[J]=document.createElementNS("http://www.w3.org/2000/svg","line"),N==0&&B[J].setAttribute("shape-rendering","crispEdges"));P=B[J];P.setAttribute("x1",D.positionScreen.x);P.setAttribute("y1",D.positionScreen.y);
|
|
|
-P.setAttribute("x2",j.positionScreen.x);P.setAttribute("y2",j.positionScreen.y);A instanceof THREE.LineBasicMaterial&&(P.setAttribute("style","fill: none; stroke: "+A.color.getContextStyle()+"; stroke-width: "+A.linewidth+"; stroke-opacity: "+A.opacity+"; stroke-linecap: "+A.linecap+"; stroke-linejoin: "+A.linejoin),i.appendChild(P))}}else if(D instanceof THREE.RenderableFace3){if(n=D.v1,s=D.v2,q=D.v3,n.positionScreen.x*=o,n.positionScreen.y*=-r,s.positionScreen.x*=o,s.positionScreen.y*=-r,q.positionScreen.x*=
|
|
|
-o,q.positionScreen.y*=-r,w.addPoint(n.positionScreen.x,n.positionScreen.y),w.addPoint(s.positionScreen.x,s.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),u.intersects(w)){var j=n,J=s,R=q;d.info.render.vertices+=3;d.info.render.faces++;P=c(Q++);P.setAttribute("d","M "+j.positionScreen.x+" "+j.positionScreen.y+" L "+J.positionScreen.x+" "+J.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+"z");A instanceof THREE.MeshBasicMaterial?z.copy(A.color):A instanceof THREE.MeshLambertMaterial?
|
|
|
-p?(z.r=C.r,z.g=C.g,z.b=C.b,a(f,D.centroidWorld,D.normalWorld,z),z.r=Math.max(0,Math.min(A.color.r*z.r,1)),z.g=Math.max(0,Math.min(A.color.g*z.g,1)),z.b=Math.max(0,Math.min(A.color.b*z.b,1))):z.copy(A.color):A instanceof THREE.MeshDepthMaterial?(I=1-A.__2near/(A.__farPlusNear-D.z*A.__farMinusNear),z.setRGB(I,I,I)):A instanceof THREE.MeshNormalMaterial&&z.setRGB(b(D.normalWorld.x),b(D.normalWorld.y),b(D.normalWorld.z));A.wireframe?P.setAttribute("style","fill: none; stroke: "+z.getContextStyle()+"; stroke-width: "+
|
|
|
-A.wireframeLinewidth+"; stroke-opacity: "+A.opacity+"; stroke-linecap: "+A.wireframeLinecap+"; stroke-linejoin: "+A.wireframeLinejoin):P.setAttribute("style","fill: "+z.getContextStyle()+"; fill-opacity: "+A.opacity);i.appendChild(P)}}else if(D instanceof THREE.RenderableFace4&&(n=D.v1,s=D.v2,q=D.v3,m=D.v4,n.positionScreen.x*=o,n.positionScreen.y*=-r,s.positionScreen.x*=o,s.positionScreen.y*=-r,q.positionScreen.x*=o,q.positionScreen.y*=-r,m.positionScreen.x*=o,m.positionScreen.y*=-r,w.addPoint(n.positionScreen.x,
|
|
|
-n.positionScreen.y),w.addPoint(s.positionScreen.x,s.positionScreen.y),w.addPoint(q.positionScreen.x,q.positionScreen.y),w.addPoint(m.positionScreen.x,m.positionScreen.y),u.intersects(w))){var j=n,J=s,R=q,ja=m;d.info.render.vertices+=4;d.info.render.faces++;P=c(Q++);P.setAttribute("d","M "+j.positionScreen.x+" "+j.positionScreen.y+" L "+J.positionScreen.x+" "+J.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+" L "+ja.positionScreen.x+","+ja.positionScreen.y+"z");A instanceof THREE.MeshBasicMaterial?
|
|
|
-z.copy(A.color):A instanceof THREE.MeshLambertMaterial?p?(z.r=C.r,z.g=C.g,z.b=C.b,a(f,D.centroidWorld,D.normalWorld,z),z.r=Math.max(0,Math.min(A.color.r*z.r,1)),z.g=Math.max(0,Math.min(A.color.g*z.g,1)),z.b=Math.max(0,Math.min(A.color.b*z.b,1))):z.copy(A.color):A instanceof THREE.MeshDepthMaterial?(I=1-A.__2near/(A.__farPlusNear-D.z*A.__farMinusNear),z.setRGB(I,I,I)):A instanceof THREE.MeshNormalMaterial&&z.setRGB(b(D.normalWorld.x),b(D.normalWorld.y),b(D.normalWorld.z));A.wireframe?P.setAttribute("style",
|
|
|
-"fill: none; stroke: "+z.getContextStyle()+"; stroke-width: "+A.wireframeLinewidth+"; stroke-opacity: "+A.opacity+"; stroke-linecap: "+A.wireframeLinecap+"; stroke-linejoin: "+A.wireframeLinejoin):P.setAttribute("style","fill: "+z.getContextStyle()+"; fill-opacity: "+A.opacity);i.appendChild(P)}}};
|
|
|
+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,n,r,m,s,p;a=c.projectScene(b,d);i=0;for(k=a.length;i<k;i++)if(r=a[i],r instanceof THREE.RenderableParticle){s=r.x*g+g;p=r.y*e+e;l=0;for(n=r.material.length;l<n;l++)if(m=r.material[l],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=s+"px",m.style.top=p+"px"}}};
|
|
|
+THREE.CanvasRenderer=function(a){function c(a){if(v!=a)p.globalAlpha=v=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(A!=a)p.strokeStyle=A=a}function g(a){if(D!=a)p.fillStyle=D=a}var e=this,f,h,i,k=new THREE.Projector,a=a||{},l=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
+n,r,m,s,p=l.getContext("2d"),o=new THREE.Color(0),t=0,v=1,q=0,A=null,D=null,w=null,u=null,E=null,I,x,C,O,G=new THREE.RenderableVertex,$=new THREE.RenderableVertex,M,J,da,T,V,y,B,j,Q,P,ia,S,N=new THREE.Color,ca=new THREE.Color,ba=new THREE.Color,R=new THREE.Color,U=new THREE.Color,Z=[],W,fa,qa,la,ja,ta,ra,sa,pa,K,X=new THREE.Rectangle,ga=new THREE.Rectangle,H=new THREE.Rectangle,ha=!1,na=new THREE.Color,aa=new THREE.Color,ka=new THREE.Color,ea=new THREE.Vector3,va,L,xa,ma,Y,Fa,a=16;va=document.createElement("canvas");
|
|
|
+va.width=va.height=2;L=va.getContext("2d");L.fillStyle="rgba(0,0,0,1)";L.fillRect(0,0,2,2);xa=L.getImageData(0,0,2,2);ma=xa.data;Y=document.createElement("canvas");Y.width=Y.height=a;Fa=Y.getContext("2d");Fa.translate(-a/2,-a/2);Fa.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){n=a;r=b;m=Math.floor(n/2);s=Math.floor(r/2);l.width=n;l.height=r;X.set(-m,-s,m,s);ga.set(-m,-s,m,s);v=1;q=0;E=u=w=D=
|
|
|
+A=null};this.setClearColor=function(a,b){o.copy(a);t=b;ga.set(-m,-s,m,s)};this.setClearColorHex=function(a,b){o.setHex(a);t=b;ga.set(-m,-s,m,s)};this.clear=function(){p.setTransform(1,0,0,-1,m,s);ga.isEmpty()||(ga.minSelf(X),ga.inflate(2),t<1&&p.clearRect(Math.floor(ga.getX()),Math.floor(ga.getY()),Math.floor(ga.getWidth()),Math.floor(ga.getHeight())),t>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+t+")"),p.fillRect(Math.floor(ga.getX()),
|
|
|
+Math.floor(ga.getY()),Math.floor(ga.getWidth()),Math.floor(ga.getHeight()))),ga.empty())};this.render=function(a,l){function n(a){var b,c,d,e;na.setRGB(0,0,0);aa.setRGB(0,0,0);ka.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(na.r+=e.r,na.g+=e.g,na.b+=e.b):d instanceof THREE.DirectionalLight?(aa.r+=e.r,aa.g+=e.g,aa.b+=e.b):d instanceof THREE.PointLight&&(ka.r+=e.r,ka.g+=e.g,ka.b+=e.b)}function r(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(ea.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 o(a,e,f){c(f.opacity);b(f.blending);var j,h,i,k,l,Y;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,l=k.width>>
|
|
|
+1,Y=k.height>>1,f=e.scale.x*m,i=e.scale.y*s,j=f*l,h=i*Y,H.set(a.x-j,a.y-h,a.x+j,a.y+h),X.intersects(H)&&(p.save(),p.translate(a.x,a.y),p.rotate(-e.rotation),p.scale(f,-i),p.translate(-l,-Y),p.drawImage(k,0,0),p.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*m,h=e.scale.y*s,H.set(a.x-j,a.y-h,a.x+j,a.y+h),X.intersects(H)&&(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 q(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(w!=a)p.lineWidth=w=a;a=f.linecap;if(u!=a)p.lineCap=u=a;a=f.linejoin;if(E!=a)p.lineJoin=E=a;d(f.color.getContextStyle());p.stroke();H.inflate(f.linewidth*2)}}function t(a,d,f,g,j,h,k,m){e.info.render.vertices+=3;e.info.render.faces++;c(m.opacity);b(m.blending);M=a.positionScreen.x;J=a.positionScreen.y;
|
|
|
+da=d.positionScreen.x;T=d.positionScreen.y;V=f.positionScreen.x;y=f.positionScreen.y;Ea(M,J,da,T,V,y);if(m instanceof THREE.MeshBasicMaterial)if(m.map)m.map.mapping instanceof THREE.UVMapping&&(la=k.uvs[0],D(M,J,da,T,V,y,la[g].u,la[g].v,la[j].u,la[j].v,la[h].u,la[h].v,m.map));else if(m.envMap){if(m.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=l.matrixWorldInverse,ea.copy(k.vertexNormalsWorld[g]),ja=(ea.x*a.n11+ea.y*a.n12+ea.z*a.n13)*0.5+0.5,ta=-(ea.x*a.n21+ea.y*a.n22+ea.z*a.n23)*0.5+
|
|
|
+0.5,ea.copy(k.vertexNormalsWorld[j]),ra=(ea.x*a.n11+ea.y*a.n12+ea.z*a.n13)*0.5+0.5,sa=-(ea.x*a.n21+ea.y*a.n22+ea.z*a.n23)*0.5+0.5,ea.copy(k.vertexNormalsWorld[h]),pa=(ea.x*a.n11+ea.y*a.n12+ea.z*a.n13)*0.5+0.5,K=-(ea.x*a.n21+ea.y*a.n22+ea.z*a.n23)*0.5+0.5,D(M,J,da,T,V,y,ja,ta,ra,sa,pa,K,m.envMap)}else m.wireframe?A(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):ya(m.color);else if(m instanceof THREE.MeshLambertMaterial)m.map&&!m.wireframe&&(m.map.mapping instanceof THREE.UVMapping&&
|
|
|
+(la=k.uvs[0],D(M,J,da,T,V,y,la[g].u,la[g].v,la[j].u,la[j].v,la[h].u,la[h].v,m.map)),b(THREE.SubtractiveBlending)),ha?!m.wireframe&&m.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==3?(ca.r=ba.r=R.r=na.r,ca.g=ba.g=R.g=na.g,ca.b=ba.b=R.b=na.b,r(i,k.v1.positionWorld,k.vertexNormalsWorld[0],ca),r(i,k.v2.positionWorld,k.vertexNormalsWorld[1],ba),r(i,k.v3.positionWorld,k.vertexNormalsWorld[2],R),ca.r=Math.max(0,Math.min(m.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(m.color.g*ca.g,1)),ca.b=Math.max(0,
|
|
|
+Math.min(m.color.b*ca.b,1)),ba.r=Math.max(0,Math.min(m.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(m.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(m.color.b*ba.b,1)),R.r=Math.max(0,Math.min(m.color.r*R.r,1)),R.g=Math.max(0,Math.min(m.color.g*R.g,1)),R.b=Math.max(0,Math.min(m.color.b*R.b,1)),U.r=(ba.r+R.r)*0.5,U.g=(ba.g+R.g)*0.5,U.b=(ba.b+R.b)*0.5,qa=Ga(ca,ba,R,U),Ca(M,J,da,T,V,y,0,0,1,0,0,1,qa)):(N.r=na.r,N.g=na.g,N.b=na.b,r(i,k.centroidWorld,k.normalWorld,N),N.r=Math.max(0,Math.min(m.color.r*N.r,1)),N.g=
|
|
|
+Math.max(0,Math.min(m.color.g*N.g,1)),N.b=Math.max(0,Math.min(m.color.b*N.b,1)),m.wireframe?A(N,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):ya(N)):m.wireframe?A(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):ya(m.color);else if(m instanceof THREE.MeshDepthMaterial)W=l.near,fa=l.far,ca.r=ca.g=ca.b=1-Ba(a.positionScreen.z,W,fa),ba.r=ba.g=ba.b=1-Ba(d.positionScreen.z,W,fa),R.r=R.g=R.b=1-Ba(f.positionScreen.z,W,fa),U.r=(ba.r+R.r)*0.5,U.g=(ba.g+R.g)*0.5,U.b=(ba.b+
|
|
|
+R.b)*0.5,qa=Ga(ca,ba,R,U),Ca(M,J,da,T,V,y,0,0,1,0,0,1,qa);else if(m instanceof THREE.MeshNormalMaterial)N.r=Da(k.normalWorld.x),N.g=Da(k.normalWorld.y),N.b=Da(k.normalWorld.z),m.wireframe?A(N,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):ya(N)}function v(a,d,f,g,h,m,k,Y,n){e.info.render.vertices+=4;e.info.render.faces++;c(Y.opacity);b(Y.blending);if(Y.map||Y.envMap)t(a,d,g,0,1,3,k,Y,n),t(h,f,m,1,2,3,k,Y,n);else if(M=a.positionScreen.x,J=a.positionScreen.y,da=d.positionScreen.x,T=d.positionScreen.y,
|
|
|
+V=f.positionScreen.x,y=f.positionScreen.y,B=g.positionScreen.x,j=g.positionScreen.y,Q=h.positionScreen.x,P=h.positionScreen.y,ia=m.positionScreen.x,S=m.positionScreen.y,Y instanceof THREE.MeshBasicMaterial)Ha(M,J,da,T,V,y,B,j),Y.wireframe?A(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):ya(Y.color);else if(Y instanceof THREE.MeshLambertMaterial)ha?!Y.wireframe&&Y.shading==THREE.SmoothShading&&k.vertexNormalsWorld.length==4?(ca.r=ba.r=R.r=U.r=na.r,ca.g=ba.g=R.g=U.g=na.g,ca.b=
|
|
|
+ba.b=R.b=U.b=na.b,r(i,k.v1.positionWorld,k.vertexNormalsWorld[0],ca),r(i,k.v2.positionWorld,k.vertexNormalsWorld[1],ba),r(i,k.v4.positionWorld,k.vertexNormalsWorld[3],R),r(i,k.v3.positionWorld,k.vertexNormalsWorld[2],U),ca.r=Math.max(0,Math.min(Y.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(Y.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(Y.color.b*ca.b,1)),ba.r=Math.max(0,Math.min(Y.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(Y.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(Y.color.b*ba.b,1)),R.r=Math.max(0,Math.min(Y.color.r*
|
|
|
+R.r,1)),R.g=Math.max(0,Math.min(Y.color.g*R.g,1)),R.b=Math.max(0,Math.min(Y.color.b*R.b,1)),U.r=Math.max(0,Math.min(Y.color.r*U.r,1)),U.g=Math.max(0,Math.min(Y.color.g*U.g,1)),U.b=Math.max(0,Math.min(Y.color.b*U.b,1)),qa=Ga(ca,ba,R,U),Ea(M,J,da,T,B,j),Ca(M,J,da,T,B,j,0,0,1,0,0,1,qa),Ea(Q,P,V,y,ia,S),Ca(Q,P,V,y,ia,S,1,0,1,1,0,1,qa)):(N.r=na.r,N.g=na.g,N.b=na.b,r(i,k.centroidWorld,k.normalWorld,N),N.r=Math.max(0,Math.min(Y.color.r*N.r,1)),N.g=Math.max(0,Math.min(Y.color.g*N.g,1)),N.b=Math.max(0,Math.min(Y.color.b*
|
|
|
+N.b,1)),Ha(M,J,da,T,V,y,B,j),Y.wireframe?A(N,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):ya(N)):(Ha(M,J,da,T,V,y,B,j),Y.wireframe?A(Y.color,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):ya(Y.color));else if(Y instanceof THREE.MeshNormalMaterial)N.r=Da(k.normalWorld.x),N.g=Da(k.normalWorld.y),N.b=Da(k.normalWorld.z),Ha(M,J,da,T,V,y,B,j),Y.wireframe?A(N,Y.wireframeLinewidth,Y.wireframeLinecap,Y.wireframeLinejoin):ya(N);else if(Y instanceof THREE.MeshDepthMaterial)W=l.near,
|
|
|
+fa=l.far,ca.r=ca.g=ca.b=1-Ba(a.positionScreen.z,W,fa),ba.r=ba.g=ba.b=1-Ba(d.positionScreen.z,W,fa),R.r=R.g=R.b=1-Ba(g.positionScreen.z,W,fa),U.r=U.g=U.b=1-Ba(f.positionScreen.z,W,fa),qa=Ga(ca,ba,R,U),Ea(M,J,da,T,B,j),Ca(M,J,da,T,B,j,0,0,1,0,0,1,qa),Ea(Q,P,V,y,ia,S),Ca(Q,P,V,y,ia,S,1,0,1,1,0,1,qa)}function Ea(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 Ha(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 A(a,b,c,e){if(w!=b)p.lineWidth=w=b;if(u!=c)p.lineCap=u=c;if(E!=e)p.lineJoin=E=e;d(a.getContextStyle());p.stroke();H.inflate(b*2)}function ya(a){g(a.getContextStyle());p.fill()}function D(a,b,c,d,e,f,j,h,i,m,k,Y,l){if(l.image.width!=0){if(l.needsUpdate==!0||Z[l.id]==void 0){var n=l.wrapS==THREE.RepeatWrapping,r=l.wrapT==THREE.RepeatWrapping;Z[l.id]=p.createPattern(l.image,n&&r?"repeat":n&&!r?"repeat-x":!n&&r?"repeat-y":"no-repeat");l.needsUpdate=!1}g(Z[l.id]);
|
|
|
+var n=l.offset.x/l.repeat.x,r=l.offset.y/l.repeat.y,K=(l.image.width-1)*l.repeat.x,l=(l.image.height-1)*l.repeat.y,j=(j+n)*K,h=(h+r)*l,i=(i+n)*K,m=(m+r)*l,k=(k+n)*K,Y=(Y+r)*l;c-=a;d-=b;e-=a;f-=b;i-=j;m-=h;k-=j;Y-=h;n=1/(i*Y-k*m);l=(Y*c-m*e)*n;m=(Y*d-m*f)*n;c=(i*e-k*c)*n;d=(i*f-k*d)*n;a=a-l*j-c*h;b=b-m*j-d*h;p.save();p.transform(l,m,c,d,a,b);p.fill();p.restore()}}function Ca(a,b,c,d,e,f,g,j,h,i,m,k,Y){var l,n;l=Y.width-1;n=Y.height-1;g*=l;j*=n;h*=l;i*=n;m*=l;k*=n;c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;m-=g;
|
|
|
+k-=j;n=1/(h*k-m*i);l=(k*c-i*e)*n;i=(k*d-i*f)*n;c=(h*e-m*c)*n;d=(h*f-m*d)*n;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(Y,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),m=~~(d.r*255),k=~~(d.g*255),d=~~(d.b*255);ma[0]=e<0?0:e>255?255:e;ma[1]=f<0?0:f>255?255:f;ma[2]=a<0?0:a>255?255:a;ma[4]=g<0?0:g>255?255:g;ma[5]=j<0?0:j>255?255:j;ma[6]=b<0?0:b>255?
|
|
|
+255:b;ma[8]=h<0?0:h>255?255:h;ma[9]=i<0?0:i>255?255:i;ma[10]=c<0?0:c>255?255:c;ma[12]=m<0?0:m>255?255:m;ma[13]=k<0?0:k>255?255:k;ma[14]=d<0?0:d>255?255:d;L.putImageData(xa,0,0);Fa.drawImage(va,0,0);return Y}function Ba(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Da(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function za(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 Ia,Ja,oa,ua;this.autoClear?this.clear():p.setTransform(1,0,0,-1,m,s);e.info.render.vertices=
|
|
|
+0;e.info.render.faces=0;f=k.projectScene(a,l,this.sortElements);h=f.elements;i=f.lights;(ha=i.length>0)&&n(i);Ia=0;for(Ja=h.length;Ia<Ja;Ia++)if(oa=h[Ia],ua=oa.material,ua=ua instanceof THREE.MeshFaceMaterial?oa.faceMaterial:ua,!(ua==null||ua.opacity==0)){H.empty();if(oa instanceof THREE.RenderableParticle)I=oa,I.x*=m,I.y*=s,o(I,oa,ua,a);else if(oa instanceof THREE.RenderableLine)I=oa.v1,x=oa.v2,I.positionScreen.x*=m,I.positionScreen.y*=s,x.positionScreen.x*=m,x.positionScreen.y*=s,H.addPoint(I.positionScreen.x,
|
|
|
+I.positionScreen.y),H.addPoint(x.positionScreen.x,x.positionScreen.y),X.intersects(H)&&q(I,x,oa,ua,a);else if(oa instanceof THREE.RenderableFace3)I=oa.v1,x=oa.v2,C=oa.v3,I.positionScreen.x*=m,I.positionScreen.y*=s,x.positionScreen.x*=m,x.positionScreen.y*=s,C.positionScreen.x*=m,C.positionScreen.y*=s,ua.overdraw&&(za(I.positionScreen,x.positionScreen),za(x.positionScreen,C.positionScreen),za(C.positionScreen,I.positionScreen)),H.add3Points(I.positionScreen.x,I.positionScreen.y,x.positionScreen.x,
|
|
|
+x.positionScreen.y,C.positionScreen.x,C.positionScreen.y),X.intersects(H)&&t(I,x,C,0,1,2,oa,ua,a);else if(oa instanceof THREE.RenderableFace4)I=oa.v1,x=oa.v2,C=oa.v3,O=oa.v4,I.positionScreen.x*=m,I.positionScreen.y*=s,x.positionScreen.x*=m,x.positionScreen.y*=s,C.positionScreen.x*=m,C.positionScreen.y*=s,O.positionScreen.x*=m,O.positionScreen.y*=s,G.positionScreen.copy(x.positionScreen),$.positionScreen.copy(O.positionScreen),ua.overdraw&&(za(I.positionScreen,x.positionScreen),za(x.positionScreen,
|
|
|
+O.positionScreen),za(O.positionScreen,I.positionScreen),za(C.positionScreen,G.positionScreen),za(C.positionScreen,$.positionScreen)),H.addPoint(I.positionScreen.x,I.positionScreen.y),H.addPoint(x.positionScreen.x,x.positionScreen.y),H.addPoint(C.positionScreen.x,C.positionScreen.y),H.addPoint(O.positionScreen.x,O.positionScreen.y),X.intersects(H)&&v(I,x,C,O,G,$,oa,ua,a);ga.addRectangle(H)}p.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,h,i,m;e=0;for(f=a.length;e<f;e++)g=a[e],h=g.color,g instanceof THREE.DirectionalLight?(i=g.matrixWorld.getPosition(),m=c.dot(i),m<=0||(m*=g.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)):g instanceof THREE.PointLight&&(i=g.matrixWorld.getPosition(),m=c.dot(I.sub(i,b).normalize()),m<=0||(m*=g.distance==0?1:1-Math.min(b.distanceTo(i)/g.distance,1),m!=0&&(m*=g.intensity,d.r+=h.r*m,d.g+=h.g*m,d.b+=h.b*m)))}function c(a){x[a]==null&&(x[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"path"),M==0&&x[a].setAttribute("shape-rendering","crispEdges"));return x[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,n,r,m,s,p,o,t=new THREE.Rectangle,v=new THREE.Rectangle,q=!1,A=new THREE.Color,D=new THREE.Color,w=new THREE.Color,u=new THREE.Color,E,I=new THREE.Vector3,x=[],C=[],O,G,$,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;n=k/2;r=l/2;i.setAttribute("viewBox",-n+" "+-r+" "+k+" "+l);i.setAttribute("width",k);i.setAttribute("height",l);t.set(-n,-r,n,r)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,l){var I,x,y,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;$=G=0;if(q=f.length>0){D.setRGB(0,0,0);w.setRGB(0,0,0);u.setRGB(0,0,0);I=0;for(x=f.length;I<x;I++)B=f[I],y=B.color,B instanceof THREE.AmbientLight?(D.r+=y.r,D.g+=y.g,D.b+=y.b):B instanceof THREE.DirectionalLight?(w.r+=y.r,w.g+=y.g,w.b+=y.b):B instanceof THREE.PointLight&&(u.r+=y.r,u.g+=y.g,u.b+=y.b)}I=0;for(x=e.length;I<x;I++)if(y=e[I],B=y.material,B=B instanceof THREE.MeshFaceMaterial?y.faceMaterial:B,!(B==null||B.opacity==0))if(v.empty(),y instanceof THREE.RenderableParticle)m=y,m.x*=
|
|
|
+n,m.y*=-r;else if(y instanceof THREE.RenderableLine){if(m=y.v1,s=y.v2,m.positionScreen.x*=n,m.positionScreen.y*=-r,s.positionScreen.x*=n,s.positionScreen.y*=-r,v.addPoint(m.positionScreen.x,m.positionScreen.y),v.addPoint(s.positionScreen.x,s.positionScreen.y),t.intersects(v)){y=m;var j=s,Q=$++;C[Q]==null&&(C[Q]=document.createElementNS("http://www.w3.org/2000/svg","line"),M==0&&C[Q].setAttribute("shape-rendering","crispEdges"));O=C[Q];O.setAttribute("x1",y.positionScreen.x);O.setAttribute("y1",y.positionScreen.y);
|
|
|
+O.setAttribute("x2",j.positionScreen.x);O.setAttribute("y2",j.positionScreen.y);B instanceof THREE.LineBasicMaterial&&(O.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(O))}}else if(y instanceof THREE.RenderableFace3){if(m=y.v1,s=y.v2,p=y.v3,m.positionScreen.x*=n,m.positionScreen.y*=-r,s.positionScreen.x*=n,s.positionScreen.y*=-r,p.positionScreen.x*=
|
|
|
+n,p.positionScreen.y*=-r,v.addPoint(m.positionScreen.x,m.positionScreen.y),v.addPoint(s.positionScreen.x,s.positionScreen.y),v.addPoint(p.positionScreen.x,p.positionScreen.y),t.intersects(v)){var j=m,Q=s,P=p;d.info.render.vertices+=3;d.info.render.faces++;O=c(G++);O.setAttribute("d","M "+j.positionScreen.x+" "+j.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+"z");B instanceof THREE.MeshBasicMaterial?A.copy(B.color):B instanceof THREE.MeshLambertMaterial?
|
|
|
+q?(A.r=D.r,A.g=D.g,A.b=D.b,a(f,y.centroidWorld,y.normalWorld,A),A.r=Math.max(0,Math.min(B.color.r*A.r,1)),A.g=Math.max(0,Math.min(B.color.g*A.g,1)),A.b=Math.max(0,Math.min(B.color.b*A.b,1))):A.copy(B.color):B instanceof THREE.MeshDepthMaterial?(E=1-B.__2near/(B.__farPlusNear-y.z*B.__farMinusNear),A.setRGB(E,E,E)):B instanceof THREE.MeshNormalMaterial&&A.setRGB(b(y.normalWorld.x),b(y.normalWorld.y),b(y.normalWorld.z));B.wireframe?O.setAttribute("style","fill: none; stroke: "+A.getContextStyle()+"; stroke-width: "+
|
|
|
+B.wireframeLinewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframeLinecap+"; stroke-linejoin: "+B.wireframeLinejoin):O.setAttribute("style","fill: "+A.getContextStyle()+"; fill-opacity: "+B.opacity);i.appendChild(O)}}else if(y instanceof THREE.RenderableFace4&&(m=y.v1,s=y.v2,p=y.v3,o=y.v4,m.positionScreen.x*=n,m.positionScreen.y*=-r,s.positionScreen.x*=n,s.positionScreen.y*=-r,p.positionScreen.x*=n,p.positionScreen.y*=-r,o.positionScreen.x*=n,o.positionScreen.y*=-r,v.addPoint(m.positionScreen.x,
|
|
|
+m.positionScreen.y),v.addPoint(s.positionScreen.x,s.positionScreen.y),v.addPoint(p.positionScreen.x,p.positionScreen.y),v.addPoint(o.positionScreen.x,o.positionScreen.y),t.intersects(v))){var j=m,Q=s,P=p,ia=o;d.info.render.vertices+=4;d.info.render.faces++;O=c(G++);O.setAttribute("d","M "+j.positionScreen.x+" "+j.positionScreen.y+" L "+Q.positionScreen.x+" "+Q.positionScreen.y+" L "+P.positionScreen.x+","+P.positionScreen.y+" L "+ia.positionScreen.x+","+ia.positionScreen.y+"z");B instanceof THREE.MeshBasicMaterial?
|
|
|
+A.copy(B.color):B instanceof THREE.MeshLambertMaterial?q?(A.r=D.r,A.g=D.g,A.b=D.b,a(f,y.centroidWorld,y.normalWorld,A),A.r=Math.max(0,Math.min(B.color.r*A.r,1)),A.g=Math.max(0,Math.min(B.color.g*A.g,1)),A.b=Math.max(0,Math.min(B.color.b*A.b,1))):A.copy(B.color):B instanceof THREE.MeshDepthMaterial?(E=1-B.__2near/(B.__farPlusNear-y.z*B.__farMinusNear),A.setRGB(E,E,E)):B instanceof THREE.MeshNormalMaterial&&A.setRGB(b(y.normalWorld.x),b(y.normalWorld.y),b(y.normalWorld.z));B.wireframe?O.setAttribute("style",
|
|
|
+"fill: none; stroke: "+A.getContextStyle()+"; stroke-width: "+B.wireframeLinewidth+"; stroke-opacity: "+B.opacity+"; stroke-linecap: "+B.wireframeLinecap+"; stroke-linejoin: "+B.wireframeLinejoin):O.setAttribute("style","fill: "+A.getContextStyle()+"; fill-opacity: "+B.opacity);i.appendChild(O)}}};
|
|
|
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,128 +222,123 @@ 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,n=i.length,k=a.__vertexArray,l=a.__colorArray,o=a.__sortArray,q=a.__dirtyVertices,r=a.__dirtyColors,M=a.__webglCustomAttributesList;if(c.sortParticles){V.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,ha.copy(e),V.multiplyVector3(ha),o[d]=[ha.z,d];o.sort(function(a,
|
|
|
-b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[o[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[o[d][1]],l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(M){i=0;for(n=M.length;i<n;i++)if(h=M[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=o[d][1],h.array[d]=h.value[f];else if(h.size===2)for(d=0;d<e;d++)f=o[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=o[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=o[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=o[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(q)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(r)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(M){i=0;for(n=M.length;i<n;i++)if(h=M[i],h.needsUpdate&&(h.boundTo===void 0||
|
|
|
+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,m=i.length,k=a.__vertexArray,l=a.__colorArray,n=a.__sortArray,p=a.__dirtyVertices,r=a.__dirtyColors,K=a.__webglCustomAttributesList;if(c.sortParticles){X.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,ha.copy(e),X.multiplyVector3(ha),n[d]=[ha.z,d];n.sort(function(a,
|
|
|
+b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[n[d][1]].position,g=d*3,k[g]=e.x,k[g+1]=e.y,k[g+2]=e.z;for(d=0;d<m;d++)g=d*3,e=i[n[d][1]],l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(K){i=0;for(m=K.length;i<m;i++)if(h=K[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=n[d][1],h.array[d]=h.value[f];else if(h.size===2)for(d=0;d<e;d++)f=n[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=n[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=n[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=n[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(r)for(d=0;d<m;d++)e=i[d],g=d*3,l[g]=e.r,l[g+1]=e.g,l[g+2]=e.b;if(K){i=0;for(m=K.length;i<m;i++)if(h=K[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(q||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(r||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(M){i=0;for(n=M.length;i<n;i++)if(h=M[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,o,q=a.count*3;for(o=0;o<q;o+=9)c=a.normalArray,d=c[o],e=c[o+1],g=c[o+2],f=c[o+3],i=c[o+4],k=c[o+5],h=c[o+6],n=c[o+7],l=c[o+8],d=(d+f+h)/3,e=(e+i+n)/3,g=
|
|
|
-(g+k+l)/3,c[o]=d,c[o+1]=e,c[o+2]=g,c[o+3]=d,c[o+4]=e,c[o+5]=g,c[o+6]=d,c[o+7]=e,c[o+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=m(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==E&&(E=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+g+=4}}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(r||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(K){i=0;for(m=K.length;i<m;i++)if(h=K[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,m,k,l,n,p=a.count*3;for(n=0;n<p;n+=9)c=a.normalArray,d=c[n],e=c[n+1],g=c[n+2],f=c[n+3],i=c[n+4],k=c[n+5],h=c[n+6],m=c[n+7],l=c[n+8],d=(d+f+h)/3,e=(e+i+m)/3,g=
|
|
|
+(g+k+l)/3,c[n]=d,c[n+1]=e,c[n+2]=g,c[n+3]=d,c[n+4]=e,c[n+5]=g,c[n+6]=d,c[n+7]=e,c[n+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=o(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==N&&(N=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,o=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(l=0;l<o;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,
|
|
|
+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=[],m=-1,k=0;h=g.morphTargetInfluences;var l,n=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(l=0;l<n;l++)!i[l]&&h[l]>m&&(k=l,m=h[k]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[k]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]=
|
|
|
+m;i[k]=1;m=-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!==xa&&(j.lineWidth(d),xa=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)),A.info.render.calls++,A.info.render.vertices+=
|
|
|
-e.__webglFaceCount,A.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==xa&&(j.lineWidth(d),xa=d),j.drawArrays(g,0,e.__webglLineCount),A.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),A.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),A.info.render.calls++)}}function f(a){M[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
|
|
|
-a.n13,a.n44-a.n14);M[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);M[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);M[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);M[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);M[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=M[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=M[d].x*b.n14+M[d].y*b.n24+M[d].z*b.n34+M[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,n,k,l,o,q=0,r=a.lights;X||(X=new THREE.PerspectiveCamera(A.shadowCameraFov,A.shadowMapWidth/A.shadowMapHeight,A.shadowCameraNear,A.shadowCameraFar));b=0;for(c=r.length;b<c;b++)if(o=r[b],o.castShadow&&o instanceof THREE.SpotLight){ea=-1;A.shadowMap[q]||(A.shadowMap[q]=new THREE.WebGLRenderTarget(A.shadowMapWidth,A.shadowMapHeight,{minFilter:THREE.LinearFilter,
|
|
|
-magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ka[q]=new THREE.Matrix4);d=A.shadowMap[q];i=ka[q];X.position.copy(o.position);X.lookAt(o.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);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(X.projectionMatrix);i.multiplySelf(X.matrixWorldInverse);X.matrixWorldInverse.flattenToArray(G);X.projectionMatrix.flattenToArray(ia);
|
|
|
-V.multiply(X.projectionMatrix,X.matrixWorldInverse);f(V);B(d);j.clearColor(1,1,1,1);A.clear();j.clearColor(da.r,da.g,da.b,ba);i=a.__webglObjects.length;for(d=0;d<i;d++)if(k=a.__webglObjects[d],o=k.object,k.render=!1,o.visible&&o.castShadow&&(!(o instanceof THREE.Mesh)||!o.frustumCulled||h(o)))o.matrixWorld.flattenToArray(o._objectMatrixArray),u(o,X,!1),k.render=!0;p(!0);x(THREE.NormalBlending);for(d=0;d<i;d++)if(k=a.__webglObjects[d],k.render)o=k.object,k=k.buffer,w(o),l=o.customDepthMaterial?o.customDepthMaterial:
|
|
|
-o.geometry.morphTargets.length?wa:ca,e(X,r,null,l,k,o);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)k=a.__webglObjectsImmediate[d],o=k.object,o.visible&&o.castShadow&&(o.matrixAutoUpdate&&o.matrixWorld.flattenToArray(o._objectMatrixArray),E=-1,u(o,X,!1),w(o),n=m(X,r,null,ca,o),o.immediateRenderCallback?o.immediateRenderCallback(n,j,M):o.render(function(a){g(a,n,ca.shading)}));q++}}function l(a,b,c,d,g,f,h,j){var i,n,k,l;b?(n=a.length-1,l=b=-1):(n=0,b=a.length,l=1);for(var o=n;o!==b;o+=l)if(i=
|
|
|
-a[o],i.render){n=i.object;k=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&x(i.blending);p(i.depthTest);z(i.depthWrite);C(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}w(n);e(d,g,f,i,k,n)}}function o(a,b,c,d,e,f,h){for(var i,n,k,l,o=0,q=a.length;o<q;o++)if(i=a[o],n=i.object,n.visible){E=-1;if(h)k=h;else{k=i[b];if(!k)continue;f&&x(k.blending);p(k.depthTest);z(k.depthWrite);C(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}w(n);l=m(c,d,e,k,n);n.immediateRenderCallback?n.immediateRenderCallback(l,
|
|
|
-j,M):n.render(function(a){g(a,l,k.shading)})}}function r(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function n(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function s(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function q(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function m(a,b,c,d,e){d.program||A.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(A.maxMorphTargets);
|
|
|
-for(var g=0,f=A.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==R&&(j.useProgram(g),R=g,h=!0);if(d.id!==ea)ea=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,ia);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,o=0,q=0,r,M,s,m=qa,p=m.directional.colors,u=m.directional.positions,V=m.point.colors,w=m.point.positions,z=m.point.distances,U=0,C=0,c=n=s=0,h=b.length;c<h;c++)if(n=b[c],k=n.color,r=n.position,M=n.intensity,s=n.distance,n instanceof THREE.AmbientLight)A.gammaInput?(l+=k.r*k.r,o+=k.g*k.g,q+=k.b*k.b):(l+=k.r,o+=k.g,q+=k.b);else if(n instanceof THREE.DirectionalLight)s=U*3,A.gammaInput?(p[s]=k.r*k.r*M*M,p[s+1]=k.g*k.g*M*M,p[s+2]=k.b*k.b*M*M):(p[s]=k.r*M,p[s+1]=k.g*M,p[s+2]=k.b*M),u[s]=r.x,u[s+
|
|
|
-1]=r.y,u[s+2]=r.z,U+=1;else if(n instanceof THREE.SpotLight)s=U*3,A.gammaInput?(p[s]=k.r*k.r*M*M,p[s+1]=k.g*k.g*M*M,p[s+2]=k.b*k.b*M*M):(p[s]=k.r*M,p[s+1]=k.g*M,p[s+2]=k.b*M),k=1/r.length(),u[s]=r.x*k,u[s+1]=r.y*k,u[s+2]=r.z*k,U+=1;else if(n instanceof THREE.PointLight)n=C*3,A.gammaInput?(V[n]=k.r*k.r*M*M,V[n+1]=k.g*k.g*M*M,V[n+2]=k.b*k.b*M*M):(V[n]=k.r*M,V[n+1]=k.g*M,V[n+2]=k.b*M),w[n]=r.x,w[n+1]=r.y,w[n+2]=r.z,z[C]=s,C+=1;c=U*3;for(h=p.length;c<h;c++)p[c]=0;c=C*3;for(h=V.length;c<h;c++)V[c]=0;m.point.length=
|
|
|
-C;m.directional.length=U;m.ambient[0]=l;m.ambient[1]=o;m.ambient[2]=q;b=qa;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,A.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=aa.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,A.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)A.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<ka.length;b++)i.shadowMatrix.value[b]=ka[b],i.shadowMap.texture[b]=A.shadowMap[b];i.shadowDarkness.value=A.shadowMapDarkness;i.shadowBias.value=A.shadowMapBias}b=d.uniformsList;i=0;for(c=
|
|
|
-b.length;i<c;i++)if(o=g.uniforms[b[i][1]])if(l=b[i][0],q=l.type,h=l.value,q==="i")j.uniform1i(o,h);else if(q==="f")j.uniform1f(o,h);else if(q==="v2")j.uniform2f(o,h.x,h.y);else if(q==="v3")j.uniform3f(o,h.x,h.y,h.z);else if(q==="v4")j.uniform4f(o,h.x,h.y,h.z,h.w);else if(q==="c")j.uniform3f(o,h.r,h.g,h.b);else if(q==="fv1")j.uniform1fv(o,h);else if(q==="fv")j.uniform3fv(o,h);else if(q==="v3v"){if(!l._array)l._array=new Float32Array(3*h.length);q=0;for(r=h.length;q<r;q++)m=q*3,l._array[m]=h[q].x,l._array[m+
|
|
|
-1]=h[q].y,l._array[m+2]=h[q].z;j.uniform3fv(o,l._array)}else if(q==="m4"){if(!l._array)l._array=new Float32Array(16);h.flattenToArray(l._array);j.uniformMatrix4fv(o,!1,l._array)}else if(q==="m4v"){if(!l._array)l._array=new Float32Array(16*h.length);q=0;for(r=h.length;q<r;q++)h[q].flattenToArrayOffset(l._array,q*16);j.uniformMatrix4fv(o,!1,l._array)}else if(q==="t"){if(j.uniform1i(o,h),o=l.texture)if(o.image instanceof Array&&o.image.length===6){if(l=o,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 o instanceof THREE.WebGLRenderTargetCube?(l=o,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.__webglTexture)):H(o,h)}else if(q===
|
|
|
-"tv"){if(!l._array){l._array=[];q=0;for(r=l.texture.length;q<r;q++)l._array[q]=h+q}j.uniform1iv(o,l._array);q=0;for(r=l.texture.length;q<r;q++)(o=l.texture[q])&&H(o,l._array[q])}(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,G);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,G),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 u(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,
|
|
|
-a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function w(a){if(W!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),W=a.doubleSided;if($!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),$=a.flipSided}function p(a){Z!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),Z=a)}function z(a){T!==a&&(j.depthMask(a),T=a)}function C(a,b,c){la!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):
|
|
|
-j.disable(j.POLYGON_OFFSET_FILL),la=a);if(a&&(ua!==b||na!==c))j.polygonOffset(b,c),ua=b,na=c}function x(a){if(a!==U){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)}U=a}}function v(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,Q(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,Q(b.wrapT)),
|
|
|
-j.texParameteri(a,j.TEXTURE_MAG_FILTER,Q(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,Q(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,P(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,P(b.minFilter)))}function H(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),A.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,Q(a.format),a.image.width,a.image.height,0,Q(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 F(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 B(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,Q(a.format),a.width,a.height,0,Q(a.format),Q(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);F(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,Q(a.format),a.width,a.height,0,Q(a.format),Q(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),F(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=ra,a=pa,d=va,e=ta);b!==ja&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),ja=b)}function P(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;
|
|
|
-default:return j.LINEAR}}function Q(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||{},aa=a.canvas!==void 0?a.canvas:document.createElement("canvas"),N=a.stencil!==void 0?a.stencil:!0,S=a.antialias!==void 0?a.antialias:!1,ga=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,da=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),ba=a.clearAlpha!==void 0?a.clearAlpha:0,D=a.maxLights!==void 0?a.maxLights:4;this.domElement=aa;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 A=this,j,J=[],R=null,
|
|
|
-ja=null,ea=-1,E=null,fa=0,W=null,$=null,U=null,Z=null,T=null,la=null,ua=null,na=null,xa=null,va=0,ta=0,ra=0,pa=0,M=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],V=new THREE.Matrix4,ia=new Float32Array(16),G=new Float32Array(16),ha=new THREE.Vector4,qa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},X,ka=[],ca,wa,O={},ma=!1;j=function(){var a;try{if(!(a=aa.getContext("experimental-webgl",
|
|
|
-{antialias:S,stencil:N,preserveDrawingBuffer:ga})))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(da.r,da.g,da.b,ba);(function(){O.vertices=new Float32Array(16);O.faces=new Uint16Array(6);var a=0;O.vertices[a++]=-1;O.vertices[a++]=-1;O.vertices[a++]=0;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=-1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=1;O.vertices[a++]=0;O.vertices[a++]=-1;O.vertices[a++]=1;O.vertices[a++]=0;a=O.vertices[a++]=0;O.faces[a++]=0;O.faces[a++]=1;O.faces[a++]=2;O.faces[a++]=
|
|
|
-0;O.faces[a++]=2;O.faces[a++]=3;O.vertexBuffer=j.createBuffer();O.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,O.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,O.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,O.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,O.faces,j.STATIC_DRAW);O.program=j.createProgram();j.attachShader(O.program,v("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(O.program,v("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(O.program);
|
|
|
-O.attributes={};O.uniforms={};O.attributes.position=j.getAttribLocation(O.program,"position");O.attributes.uv=j.getAttribLocation(O.program,"uv");O.uniforms.uvOffset=j.getUniformLocation(O.program,"uvOffset");O.uniforms.uvScale=j.getUniformLocation(O.program,"uvScale");O.uniforms.rotation=j.getUniformLocation(O.program,"rotation");O.uniforms.scale=j.getUniformLocation(O.program,"scale");O.uniforms.alignment=j.getUniformLocation(O.program,"alignment");O.uniforms.color=j.getUniformLocation(O.program,
|
|
|
-"color");O.uniforms.map=j.getUniformLocation(O.program,"map");O.uniforms.opacity=j.getUniformLocation(O.program,"opacity");O.uniforms.useScreenCoordinates=j.getUniformLocation(O.program,"useScreenCoordinates");O.uniforms.affectedByDistance=j.getUniformLocation(O.program,"affectedByDistance");O.uniforms.screenPosition=j.getUniformLocation(O.program,"screenPosition");O.uniforms.modelViewMatrix=j.getUniformLocation(O.program,"modelViewMatrix");O.uniforms.projectionMatrix=j.getUniformLocation(O.program,
|
|
|
-"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);ca=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});wa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});ca._shadowPass=!0;wa._shadowPass=!0})();this.context=j;var oa=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=
|
|
|
-function(){return oa};this.setSize=function(a,b){aa.width=a;aa.height=b;this.setViewport(0,0,aa.width,aa.height)};this.setViewport=function(a,b,c,d){va=a;ta=b;ra=c;pa=d;j.viewport(va,ta,ra,pa)};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){da.setHex(a);ba=b;j.clearColor(da.r,da.g,da.b,ba)};this.setClearColor=function(a,b){da.copy(a);ba=b;j.clearColor(da.r,da.g,da.b,
|
|
|
-ba)};this.getClearColor=function(){return da};this.getClearAlpha=function(){return ba};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){B(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]);A.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=
|
|
|
-a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),A.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),A.info.memory.textures--};this.updateShadowMap=function(a,b){k(a,b)};this.render=function(a,b,c,d){var e,g,n,q,r=a.lights,M=a.fog;ea=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&k(a,b);A.info.render.calls=0;A.info.render.vertices=
|
|
|
-0;A.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(G);b.projectionMatrix.flattenToArray(ia);V.multiply(b.projectionMatrix,b.matrixWorldInverse);f(V);B(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);q=a.__webglObjects;d=0;for(e=q.length;d<e;d++)if(g=
|
|
|
-q[d],n=g.object,g.render=!1,n.visible&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||h(n))){n.matrixWorld.flattenToArray(n._objectMatrixArray);u(n,b,!0);var s=g,m=s.object,w=s.buffer,v=void 0,v=v=void 0,v=m.material;if(v instanceof THREE.MeshFaceMaterial){if(v=w.materialIndex,v>=0)v=m.geometry.materials[v],v.transparent?(s.transparent=v,s.opaque=null):(s.opaque=v,s.transparent=null)}else if(v)v.transparent?(s.transparent=v,s.opaque=null):(s.opaque=v,s.transparent=null);g.render=!0;if(this.sortObjects)n.renderDepth?
|
|
|
-g.z=n.renderDepth:(ha.copy(n.position),V.multiplyVector3(ha),g.z=ha.z)}this.sortObjects&&q.sort(i);q=a.__webglObjectsImmediate;d=0;for(e=q.length;d<e;d++)if(g=q[d],n=g.object,n.visible)n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),u(n,b,!0),n=g.object.material,n.transparent?(g.transparent=n,g.opaque=null):(g.opaque=n,g.transparent=null);a.overrideMaterial?(x(a.overrideMaterial.blending),p(a.overrideMaterial.depthTest),z(a.overrideMaterial.depthWrite),C(a.overrideMaterial.polygonOffset,
|
|
|
-a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,r,M,!0,a.overrideMaterial),o(a.__webglObjectsImmediate,"",b,r,M,!1,a.overrideMaterial)):(x(THREE.NormalBlending),l(a.__webglObjects,!0,"opaque",b,r,M,!1),o(a.__webglObjectsImmediate,"opaque",b,r,M,!1),l(a.__webglObjects,!1,"transparent",b,r,M,!0),o(a.__webglObjectsImmediate,"transparent",b,r,M,!0));if(a.__webglSprites.length){n=O.attributes;r=O.uniforms;M=pa/ra;d=[];e=ra*0.5;q=pa*0.5;g=!0;j.useProgram(O.program);
|
|
|
-R=O.program;E=Z=U=-1;ma||(j.enableVertexAttribArray(O.attributes.position),j.enableVertexAttribArray(O.attributes.uv),ma=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,O.vertexBuffer);j.vertexAttribPointer(n.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(n.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,O.elementBuffer);j.uniformMatrix4fv(r.projectionMatrix,!1,ia);j.activeTexture(j.TEXTURE0);j.uniform1i(r.map,0);n=0;for(s=a.__webglSprites.length;n<
|
|
|
-s;n++)if(m=a.__webglSprites[n],m.visible&&m.opacity!==0)m.useScreenCoordinates?m.z=-m.position.z:(m._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,m.matrixWorld,m._modelViewMatrixArray),m.z=-m._modelViewMatrix.n34);a.__webglSprites.sort(i);n=0;for(s=a.__webglSprites.length;n<s;n++)m=a.__webglSprites[n],m.visible&&m.opacity!==0&&m.map&&m.map.image&&m.map.image.width&&(m.useScreenCoordinates?(j.uniform1i(r.useScreenCoordinates,1),j.uniform3f(r.screenPosition,(m.position.x-e)/e,(q-m.position.y)/
|
|
|
-q,Math.max(0,Math.min(1,m.position.z)))):(j.uniform1i(r.useScreenCoordinates,0),j.uniform1i(r.affectedByDistance,m.affectedByDistance?1:0),j.uniformMatrix4fv(r.modelViewMatrix,!1,m._modelViewMatrixArray)),b=m.map.image.width/(m.scaleByViewport?pa:1),d[0]=b*M*m.scale.x,d[1]=b*m.scale.y,j.uniform2f(r.uvScale,m.uvScale.x,m.uvScale.y),j.uniform2f(r.uvOffset,m.uvOffset.x,m.uvOffset.y),j.uniform2f(r.alignment,m.alignment.x,m.alignment.y),j.uniform1f(r.opacity,m.opacity),j.uniform3f(r.color,m.color.r,m.color.g,
|
|
|
-m.color.b),j.uniform1f(r.rotation,m.rotation),j.uniform2fv(r.scale,d),m.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!m.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),x(m.blending),H(m.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(T)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),
|
|
|
-j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};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,o=void 0,M=void 0,m=void 0,p=void 0,ia=void 0,u={},V=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)o=i.faces[k],M=o.materialIndex,p=M!==void 0?M:-1,u[p]===void 0&&(u[p]={hash:p,counter:0}),ia=u[p].hash+"_"+u[p].counter,i.geometryGroups[ia]===void 0&&(i.geometryGroups[ia]=
|
|
|
-{faces3:[],faces4:[],materialIndex:M,vertices:0,numMorphTargets:V}),m=o instanceof THREE.Face3?3:4,i.geometryGroups[ia].vertices+m>65535&&(u[p].counter+=1,ia=u[p].hash+"_"+u[p].counter,i.geometryGroups[ia]===void 0&&(i.geometryGroups[ia]={faces3:[],faces4:[],materialIndex:M,vertices:0,numMorphTargets:V})),o instanceof THREE.Face3?i.geometryGroups[ia].faces3.push(k):i.geometryGroups[ia].faces4.push(k),i.geometryGroups[ia].vertices+=m;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=
|
|
|
-fa++,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){o=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(o=k.numMorphTargets;l<o;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}A.info.memory.geometries++;M=e;m=M.geometry;l=i.faces3;p=i.faces4;k=l.length*3+p.length*4;o=l.length*1+p.length*2;p=l.length*3+p.length*4;l=b(M,i);ia=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;u=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(u)i.__normalArray=new Float32Array(k*3);if(m.hasTangents)i.__tangentArray=new Float32Array(k*4);if(V)i.__colorArray=new Float32Array(k*3);if(ia){if(m.faceUvs.length>0||m.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(m.faceUvs.length>1||m.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*
|
|
|
-2)}if(M.geometry.skinWeights.length&&M.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(o*3);i.__lineArray=new Uint16Array(p*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];M=0;for(m=i.numMorphTargets;M<m;M++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=u===THREE.SmoothShading;i.__uvType=ia;
|
|
|
-i.__vertexColorType=V;i.__normalType=u;i.__webglFaceCount=o*3;i.__webglLineCount=p*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];o=void 0;for(o in l.attributes){var M=l.attributes[o],m={},w;for(w in M)m[w]=M[w];if(!m.__webglInitialized||m.createUniqueBuffers)m.__webglInitialized=!0,p=1,m.type==="v2"?p=2:m.type==="v3"?p=3:m.type==="v4"?p=4:m.type==="c"&&(p=3),m.size=p,m.array=new Float32Array(k*p),m.buffer=j.createBuffer(),m.buffer.belongsToAttribute=
|
|
|
-o,M.needsUpdate=!0,m.__original=M;i.__webglCustomAttributesList.push(m)}}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(),A.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(),A.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(),A.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],r(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?
|
|
|
-(h=e.geometry,r(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)q(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)&&q(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(w=a.__webglObjects[e].object,f=w.geometry,h=o=l=void 0,w instanceof THREE.Mesh){i=0;for(k=f.geometryGroupsList.length;i<k;i++)if(l=f.geometryGroupsList[i],h=b(w,l),o=h.attributes&&n(h),f.__dirtyVertices||f.__dirtyMorphTargets||
|
|
|
-f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||o)if(o=j.DYNAMIC_DRAW,M=!f.dynamic,l.__inittedArrays){var z=p=m=void 0,G=void 0,U=void 0,C=void 0,v=void 0,B=void 0,H=void 0,qa=void 0,Z=z=C=H=void 0,x=void 0,K=void 0,L=void 0,D=void 0,F=void 0,I=void 0,ha=G=H=G=void 0,O=void 0,T=G=L=K=x=D=L=K=x=D=L=K=x=D=L=K=x=v=void 0,R=void 0,Q=C=void 0,X=z=void 0,N=void 0,P=void 0,E=Z=X=R=0,la=0,ka=T=z=0,S=v=F=0,y=0,J=0,J=void 0,N=l.__vertexArray,ea=l.__uvArray,y=l.__uv2Array,
|
|
|
-Q=l.__normalArray,U=l.__tangentArray,I=l.__colorArray,ha=l.__skinVertexAArray,O=l.__skinVertexBArray,B=l.__skinIndexArray,ca=l.__skinWeightArray,$=l.__morphTargetsArrays,ia=l.__webglCustomAttributesList,t=void 0,t=l.__faceArray,J=l.__lineArray,da=l.__needsSmoothNormals,H=l.__vertexColorType,qa=l.__uvType,C=l.__normalType,W=w.geometry,ga=W.__dirtyElements,ba=W.__dirtyUvs,ja=W.__dirtyNormals,aa=W.__dirtyTangents,ua=W.__dirtyColors,P=W.__dirtyMorphTargets,wa=W.vertices,u=l.faces3,V=l.faces4,ma=W.faces,
|
|
|
-na=W.faceVertexUvs[0],xa=W.faceVertexUvs[1],va=W.skinVerticesA,ra=W.skinVerticesB,oa=W.skinIndices,ta=W.skinWeights,pa=W.morphTargets;if(W.__dirtyVertices){m=0;for(p=u.length;m<p;m++)G=ma[u[m]],x=wa[G.a].position,K=wa[G.b].position,L=wa[G.c].position,N[X]=x.x,N[X+1]=x.y,N[X+2]=x.z,N[X+3]=K.x,N[X+4]=K.y,N[X+5]=K.z,N[X+6]=L.x,N[X+7]=L.y,N[X+8]=L.z,X+=9;m=0;for(p=V.length;m<p;m++)G=ma[V[m]],x=wa[G.a].position,K=wa[G.b].position,L=wa[G.c].position,D=wa[G.d].position,N[X]=x.x,N[X+1]=x.y,N[X+2]=x.z,N[X+
|
|
|
-3]=K.x,N[X+4]=K.y,N[X+5]=K.z,N[X+6]=L.x,N[X+7]=L.y,N[X+8]=L.z,N[X+9]=D.x,N[X+10]=D.y,N[X+11]=D.z,X+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,N,o)}if(P){m=0;for(p=u.length;m<p;m++){G=ma[u[m]];X=0;for(N=pa.length;X<N;X++)x=pa[X].vertices[G.a].position,K=pa[X].vertices[G.b].position,L=pa[X].vertices[G.c].position,P=$[X],P[S]=x.x,P[S+1]=x.y,P[S+2]=x.z,P[S+3]=K.x,P[S+4]=K.y,P[S+5]=K.z,P[S+6]=L.x,P[S+7]=L.y,P[S+8]=L.z;S+=9}m=0;for(p=V.length;m<p;m++){G=ma[V[m]];
|
|
|
-X=0;for(N=pa.length;X<N;X++)x=pa[X].vertices[G.a].position,K=pa[X].vertices[G.b].position,L=pa[X].vertices[G.c].position,D=pa[X].vertices[G.d].position,P=$[X],P[S]=x.x,P[S+1]=x.y,P[S+2]=x.z,P[S+3]=K.x,P[S+4]=K.y,P[S+5]=K.z,P[S+6]=L.x,P[S+7]=L.y,P[S+8]=L.z,P[S+9]=D.x,P[S+10]=D.y,P[S+11]=D.z;S+=12}X=0;for(N=pa.length;X<N;X++)j.bindBuffer(j.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[X]),j.bufferData(j.ARRAY_BUFFER,$[X],o)}if(ta.length){m=0;for(p=u.length;m<p;m++)G=ma[u[m]],x=ta[G.a],K=ta[G.b],L=ta[G.c],
|
|
|
-ca[v]=x.x,ca[v+1]=x.y,ca[v+2]=x.z,ca[v+3]=x.w,ca[v+4]=K.x,ca[v+5]=K.y,ca[v+6]=K.z,ca[v+7]=K.w,ca[v+8]=L.x,ca[v+9]=L.y,ca[v+10]=L.z,ca[v+11]=L.w,x=oa[G.a],K=oa[G.b],L=oa[G.c],B[v]=x.x,B[v+1]=x.y,B[v+2]=x.z,B[v+3]=x.w,B[v+4]=K.x,B[v+5]=K.y,B[v+6]=K.z,B[v+7]=K.w,B[v+8]=L.x,B[v+9]=L.y,B[v+10]=L.z,B[v+11]=L.w,x=va[G.a],K=va[G.b],L=va[G.c],ha[v]=x.x,ha[v+1]=x.y,ha[v+2]=x.z,ha[v+3]=1,ha[v+4]=K.x,ha[v+5]=K.y,ha[v+6]=K.z,ha[v+7]=1,ha[v+8]=L.x,ha[v+9]=L.y,ha[v+10]=L.z,ha[v+11]=1,x=ra[G.a],K=ra[G.b],L=ra[G.c],
|
|
|
-O[v]=x.x,O[v+1]=x.y,O[v+2]=x.z,O[v+3]=1,O[v+4]=K.x,O[v+5]=K.y,O[v+6]=K.z,O[v+7]=1,O[v+8]=L.x,O[v+9]=L.y,O[v+10]=L.z,O[v+11]=1,v+=12;m=0;for(p=V.length;m<p;m++)G=ma[V[m]],x=ta[G.a],K=ta[G.b],L=ta[G.c],D=ta[G.d],ca[v]=x.x,ca[v+1]=x.y,ca[v+2]=x.z,ca[v+3]=x.w,ca[v+4]=K.x,ca[v+5]=K.y,ca[v+6]=K.z,ca[v+7]=K.w,ca[v+8]=L.x,ca[v+9]=L.y,ca[v+10]=L.z,ca[v+11]=L.w,ca[v+12]=D.x,ca[v+13]=D.y,ca[v+14]=D.z,ca[v+15]=D.w,x=oa[G.a],K=oa[G.b],L=oa[G.c],D=oa[G.d],B[v]=x.x,B[v+1]=x.y,B[v+2]=x.z,B[v+3]=x.w,B[v+4]=K.x,B[v+
|
|
|
-5]=K.y,B[v+6]=K.z,B[v+7]=K.w,B[v+8]=L.x,B[v+9]=L.y,B[v+10]=L.z,B[v+11]=L.w,B[v+12]=D.x,B[v+13]=D.y,B[v+14]=D.z,B[v+15]=D.w,x=va[G.a],K=va[G.b],L=va[G.c],D=va[G.d],ha[v]=x.x,ha[v+1]=x.y,ha[v+2]=x.z,ha[v+3]=1,ha[v+4]=K.x,ha[v+5]=K.y,ha[v+6]=K.z,ha[v+7]=1,ha[v+8]=L.x,ha[v+9]=L.y,ha[v+10]=L.z,ha[v+11]=1,ha[v+12]=D.x,ha[v+13]=D.y,ha[v+14]=D.z,ha[v+15]=1,x=ra[G.a],K=ra[G.b],L=ra[G.c],G=ra[G.d],O[v]=x.x,O[v+1]=x.y,O[v+2]=x.z,O[v+3]=1,O[v+4]=K.x,O[v+5]=K.y,O[v+6]=K.z,O[v+7]=1,O[v+8]=L.x,O[v+9]=L.y,O[v+10]=
|
|
|
-L.z,O[v+11]=1,O[v+12]=G.x,O[v+13]=G.y,O[v+14]=G.z,O[v+15]=1,v+=16;v>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,ha,o),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,O,o),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,B,o),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,ca,o))}if(ua&&H){m=0;for(p=u.length;m<p;m++)G=ma[u[m]],v=G.vertexColors,B=G.color,
|
|
|
-v.length===3&&H===THREE.VertexColors?(G=v[0],ha=v[1],O=v[2]):O=ha=G=B,I[F]=G.r,I[F+1]=G.g,I[F+2]=G.b,I[F+3]=ha.r,I[F+4]=ha.g,I[F+5]=ha.b,I[F+6]=O.r,I[F+7]=O.g,I[F+8]=O.b,F+=9;m=0;for(p=V.length;m<p;m++)G=ma[V[m]],v=G.vertexColors,B=G.color,v.length===4&&H===THREE.VertexColors?(G=v[0],ha=v[1],O=v[2],v=v[3]):v=O=ha=G=B,I[F]=G.r,I[F+1]=G.g,I[F+2]=G.b,I[F+3]=ha.r,I[F+4]=ha.g,I[F+5]=ha.b,I[F+6]=O.r,I[F+7]=O.g,I[F+8]=O.b,I[F+9]=v.r,I[F+10]=v.g,I[F+11]=v.b,F+=12;F>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),
|
|
|
-j.bufferData(j.ARRAY_BUFFER,I,o))}if(aa&&W.hasTangents){m=0;for(p=u.length;m<p;m++)G=ma[u[m]],H=G.vertexTangents,F=H[0],I=H[1],G=H[2],U[T]=F.x,U[T+1]=F.y,U[T+2]=F.z,U[T+3]=F.w,U[T+4]=I.x,U[T+5]=I.y,U[T+6]=I.z,U[T+7]=I.w,U[T+8]=G.x,U[T+9]=G.y,U[T+10]=G.z,U[T+11]=G.w,T+=12;m=0;for(p=V.length;m<p;m++)G=ma[V[m]],H=G.vertexTangents,F=H[0],I=H[1],G=H[2],H=H[3],U[T]=F.x,U[T+1]=F.y,U[T+2]=F.z,U[T+3]=F.w,U[T+4]=I.x,U[T+5]=I.y,U[T+6]=I.z,U[T+7]=I.w,U[T+8]=G.x,U[T+9]=G.y,U[T+10]=G.z,U[T+11]=G.w,U[T+12]=H.x,
|
|
|
-U[T+13]=H.y,U[T+14]=H.z,U[T+15]=H.w,T+=16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,U,o)}if(ja&&C){m=0;for(p=u.length;m<p;m++)if(G=ma[u[m]],U=G.vertexNormals,C=G.normal,U.length===3&&da)for(T=0;T<3;T++)C=U[T],Q[z]=C.x,Q[z+1]=C.y,Q[z+2]=C.z,z+=3;else for(T=0;T<3;T++)Q[z]=C.x,Q[z+1]=C.y,Q[z+2]=C.z,z+=3;m=0;for(p=V.length;m<p;m++)if(G=ma[V[m]],U=G.vertexNormals,C=G.normal,U.length===4&&da)for(T=0;T<4;T++)C=U[T],Q[z]=C.x,Q[z+1]=C.y,Q[z+2]=C.z,z+=3;else for(T=0;T<
|
|
|
-4;T++)Q[z]=C.x,Q[z+1]=C.y,Q[z+2]=C.z,z+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,Q,o)}if(ba&&na&&qa){m=0;for(p=u.length;m<p;m++)if(z=u[m],z=na[z],z!==void 0)for(T=0;T<3;T++)Q=z[T],ea[Z]=Q.u,ea[Z+1]=Q.v,Z+=2;m=0;for(p=V.length;m<p;m++)if(z=V[m],z=na[z],z!==void 0)for(T=0;T<4;T++)Q=z[T],ea[Z]=Q.u,ea[Z+1]=Q.v,Z+=2;Z>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,ea,o))}if(ba&&xa&&qa){m=0;for(p=u.length;m<p;m++)if(z=u[m],Z=xa[z],
|
|
|
-Z!==void 0)for(T=0;T<3;T++)z=Z[T],y[E]=z.u,y[E+1]=z.v,E+=2;m=0;for(p=V.length;m<p;m++)if(z=V[m],Z=xa[z],Z!==void 0)for(T=0;T<4;T++)z=Z[T],y[E]=z.u,y[E+1]=z.v,E+=2;E>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,y,o))}if(ga){m=0;for(p=u.length;m<p;m++)t[la]=R,t[la+1]=R+1,t[la+2]=R+2,la+=3,J[ka]=R,J[ka+1]=R+1,J[ka+2]=R,J[ka+3]=R+2,J[ka+4]=R+1,J[ka+5]=R+2,ka+=6,R+=3;m=0;for(p=V.length;m<p;m++)t[la]=R,t[la+1]=R+1,t[la+2]=R+3,t[la+3]=R+1,t[la+4]=R+2,t[la+5]=R+3,la+=6,
|
|
|
-J[ka]=R,J[ka+1]=R+1,J[ka+2]=R,J[ka+3]=R+3,J[ka+4]=R+1,J[ka+5]=R+2,J[ka+6]=R+2,J[ka+7]=R+3,ka+=8,R+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,t,o);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,J,o)}if(ia){T=0;for(R=ia.length;T<R;T++)if(t=ia[T],t.__original.needsUpdate){J=y=0;if(t.size===1)if(t.boundTo===void 0||t.boundTo==="vertices"){m=0;for(p=u.length;m<p;m++)G=ma[u[m]],t.array[y]=t.value[G.a],t.array[y+
|
|
|
-1]=t.value[G.b],t.array[y+2]=t.value[G.c],y+=3;m=0;for(p=V.length;m<p;m++)G=ma[V[m]],t.array[y]=t.value[G.a],t.array[y+1]=t.value[G.b],t.array[y+2]=t.value[G.c],t.array[y+3]=t.value[G.d],y+=4}else if(t.boundTo==="faces"){m=0;for(p=u.length;m<p;m++)J=t.value[u[m]],t.array[y]=J,t.array[y+1]=J,t.array[y+2]=J,y+=3;m=0;for(p=V.length;m<p;m++)J=t.value[V[m]],t.array[y]=J,t.array[y+1]=J,t.array[y+2]=J,t.array[y+3]=J,y+=4}else{if(t.boundTo==="faceVertices"){m=0;for(p=u.length;m<p;m++)t.array[y]=t.value[J],
|
|
|
-t.array[y+1]=t.value[J+1],t.array[y+2]=t.value[J+2],y+=3,J+=3;m=0;for(p=V.length;m<p;m++)t.array[y]=t.value[J],t.array[y+1]=t.value[J+1],t.array[y+2]=t.value[J+2],t.array[y+3]=t.value[J+3],y+=4,J+=4}}else if(t.size===2)if(t.boundTo===void 0||t.boundTo==="vertices"){m=0;for(p=u.length;m<p;m++)G=ma[u[m]],x=t.value[G.a],K=t.value[G.b],L=t.value[G.c],t.array[y]=x.x,t.array[y+1]=x.y,t.array[y+2]=K.x,t.array[y+3]=K.y,t.array[y+4]=L.x,t.array[y+5]=L.y,y+=6;m=0;for(p=V.length;m<p;m++)G=ma[V[m]],x=t.value[G.a],
|
|
|
-K=t.value[G.b],L=t.value[G.c],D=t.value[G.d],t.array[y]=x.x,t.array[y+1]=x.y,t.array[y+2]=K.x,t.array[y+3]=K.y,t.array[y+4]=L.x,t.array[y+5]=L.y,t.array[y+6]=D.x,t.array[y+7]=D.y,y+=8}else if(t.boundTo==="faces"){m=0;for(p=u.length;m<p;m++)L=K=x=J=t.value[u[m]],t.array[y]=x.x,t.array[y+1]=x.y,t.array[y+2]=K.x,t.array[y+3]=K.y,t.array[y+4]=L.x,t.array[y+5]=L.y,y+=6;m=0;for(p=V.length;m<p;m++)D=L=K=x=J=t.value[V[m]],t.array[y]=x.x,t.array[y+1]=x.y,t.array[y+2]=K.x,t.array[y+3]=K.y,t.array[y+4]=L.x,
|
|
|
-t.array[y+5]=L.y,t.array[y+6]=D.x,t.array[y+7]=D.y,y+=8}else{if(t.boundTo==="faceVertices"){m=0;for(p=u.length;m<p;m++)x=t.value[J],K=t.value[J+1],L=t.value[J+2],t.array[y]=x.x,t.array[y+1]=x.y,t.array[y+2]=K.x,t.array[y+3]=K.y,t.array[y+4]=L.x,t.array[y+5]=L.y,y+=6,J+=3;m=0;for(p=V.length;m<p;m++)x=t.value[J],K=t.value[J+1],L=t.value[J+2],D=t.value[J+3],t.array[y]=x.x,t.array[y+1]=x.y,t.array[y+2]=K.x,t.array[y+3]=K.y,t.array[y+4]=L.x,t.array[y+5]=L.y,t.array[y+6]=D.x,t.array[y+7]=D.y,y+=8,J+=4}}else if(t.size===
|
|
|
-3)if(E=t.type==="c"?["r","g","b"]:["x","y","z"],t.boundTo===void 0||t.boundTo==="vertices"){m=0;for(p=u.length;m<p;m++)G=ma[u[m]],x=t.value[G.a],K=t.value[G.b],L=t.value[G.c],t.array[y]=x[E[0]],t.array[y+1]=x[E[1]],t.array[y+2]=x[E[2]],t.array[y+3]=K[E[0]],t.array[y+4]=K[E[1]],t.array[y+5]=K[E[2]],t.array[y+6]=L[E[0]],t.array[y+7]=L[E[1]],t.array[y+8]=L[E[2]],y+=9;m=0;for(p=V.length;m<p;m++)G=ma[V[m]],x=t.value[G.a],K=t.value[G.b],L=t.value[G.c],D=t.value[G.d],t.array[y]=x[E[0]],t.array[y+1]=x[E[1]],
|
|
|
-t.array[y+2]=x[E[2]],t.array[y+3]=K[E[0]],t.array[y+4]=K[E[1]],t.array[y+5]=K[E[2]],t.array[y+6]=L[E[0]],t.array[y+7]=L[E[1]],t.array[y+8]=L[E[2]],t.array[y+9]=D[E[0]],t.array[y+10]=D[E[1]],t.array[y+11]=D[E[2]],y+=12}else if(t.boundTo==="faces"){m=0;for(p=u.length;m<p;m++)L=K=x=J=t.value[u[m]],t.array[y]=x[E[0]],t.array[y+1]=x[E[1]],t.array[y+2]=x[E[2]],t.array[y+3]=K[E[0]],t.array[y+4]=K[E[1]],t.array[y+5]=K[E[2]],t.array[y+6]=L[E[0]],t.array[y+7]=L[E[1]],t.array[y+8]=L[E[2]],y+=9;m=0;for(p=V.length;m<
|
|
|
-p;m++)D=L=K=x=J=t.value[V[m]],t.array[y]=x[E[0]],t.array[y+1]=x[E[1]],t.array[y+2]=x[E[2]],t.array[y+3]=K[E[0]],t.array[y+4]=K[E[1]],t.array[y+5]=K[E[2]],t.array[y+6]=L[E[0]],t.array[y+7]=L[E[1]],t.array[y+8]=L[E[2]],t.array[y+9]=D[E[0]],t.array[y+10]=D[E[1]],t.array[y+11]=D[E[2]],y+=12}else{if(t.boundTo==="faceVertices"){m=0;for(p=u.length;m<p;m++)x=t.value[J],K=t.value[J+1],L=t.value[J+2],t.array[y]=x[E[0]],t.array[y+1]=x[E[1]],t.array[y+2]=x[E[2]],t.array[y+3]=K[E[0]],t.array[y+4]=K[E[1]],t.array[y+
|
|
|
-5]=K[E[2]],t.array[y+6]=L[E[0]],t.array[y+7]=L[E[1]],t.array[y+8]=L[E[2]],y+=9,J+=3;m=0;for(p=V.length;m<p;m++)x=t.value[J],K=t.value[J+1],L=t.value[J+2],D=t.value[J+3],t.array[y]=x[E[0]],t.array[y+1]=x[E[1]],t.array[y+2]=x[E[2]],t.array[y+3]=K[E[0]],t.array[y+4]=K[E[1]],t.array[y+5]=K[E[2]],t.array[y+6]=L[E[0]],t.array[y+7]=L[E[1]],t.array[y+8]=L[E[2]],t.array[y+9]=D[E[0]],t.array[y+10]=D[E[1]],t.array[y+11]=D[E[2]],y+=12,J+=4}}else if(t.size===4)if(t.boundTo===void 0||t.boundTo==="vertices"){m=
|
|
|
-0;for(p=u.length;m<p;m++)G=ma[u[m]],x=t.value[G.a],K=t.value[G.b],L=t.value[G.c],t.array[y]=x.x,t.array[y+1]=x.y,t.array[y+2]=x.z,t.array[y+3]=x.w,t.array[y+4]=K.x,t.array[y+5]=K.y,t.array[y+6]=K.z,t.array[y+7]=K.w,t.array[y+8]=L.x,t.array[y+9]=L.y,t.array[y+10]=L.z,t.array[y+11]=L.w,y+=12;m=0;for(p=V.length;m<p;m++)G=ma[V[m]],x=t.value[G.a],K=t.value[G.b],L=t.value[G.c],D=t.value[G.d],t.array[y]=x.x,t.array[y+1]=x.y,t.array[y+2]=x.z,t.array[y+3]=x.w,t.array[y+4]=K.x,t.array[y+5]=K.y,t.array[y+6]=
|
|
|
-K.z,t.array[y+7]=K.w,t.array[y+8]=L.x,t.array[y+9]=L.y,t.array[y+10]=L.z,t.array[y+11]=L.w,t.array[y+12]=D.x,t.array[y+13]=D.y,t.array[y+14]=D.z,t.array[y+15]=D.w,y+=16}else if(t.boundTo==="faces"){m=0;for(p=u.length;m<p;m++)L=K=x=J=t.value[u[m]],t.array[y]=x.x,t.array[y+1]=x.y,t.array[y+2]=x.z,t.array[y+3]=x.w,t.array[y+4]=K.x,t.array[y+5]=K.y,t.array[y+6]=K.z,t.array[y+7]=K.w,t.array[y+8]=L.x,t.array[y+9]=L.y,t.array[y+10]=L.z,t.array[y+11]=L.w,y+=12;m=0;for(p=V.length;m<p;m++)D=L=K=x=J=t.value[V[m]],
|
|
|
-t.array[y]=x.x,t.array[y+1]=x.y,t.array[y+2]=x.z,t.array[y+3]=x.w,t.array[y+4]=K.x,t.array[y+5]=K.y,t.array[y+6]=K.z,t.array[y+7]=K.w,t.array[y+8]=L.x,t.array[y+9]=L.y,t.array[y+10]=L.z,t.array[y+11]=L.w,t.array[y+12]=D.x,t.array[y+13]=D.y,t.array[y+14]=D.z,t.array[y+15]=D.w,y+=16}else if(t.boundTo==="faceVertices"){m=0;for(p=u.length;m<p;m++)x=t.value[J],K=t.value[J+1],L=t.value[J+2],t.array[y]=x.x,t.array[y+1]=x.y,t.array[y+2]=x.z,t.array[y+3]=x.w,t.array[y+4]=K.x,t.array[y+5]=K.y,t.array[y+6]=
|
|
|
-K.z,t.array[y+7]=K.w,t.array[y+8]=L.x,t.array[y+9]=L.y,t.array[y+10]=L.z,t.array[y+11]=L.w,y+=12,J+=3;m=0;for(p=V.length;m<p;m++)x=t.value[J],K=t.value[J+1],L=t.value[J+2],D=t.value[J+3],t.array[y]=x.x,t.array[y+1]=x.y,t.array[y+2]=x.z,t.array[y+3]=x.w,t.array[y+4]=K.x,t.array[y+5]=K.y,t.array[y+6]=K.z,t.array[y+7]=K.w,t.array[y+8]=L.x,t.array[y+9]=L.y,t.array[y+10]=L.z,t.array[y+11]=L.w,t.array[y+12]=D.x,t.array[y+13]=D.y,t.array[y+14]=D.z,t.array[y+15]=D.w,y+=16,J+=4}j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-t.buffer);j.bufferData(j.ARRAY_BUFFER,t.array,o)}}M&&(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&&s(h)}else if(w instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;w=j.DYNAMIC_DRAW;m=i=m=M=M=void 0;p=h.vertices;k=h.colors;ia=p.length;l=k.length;u=h.__vertexArray;o=h.__colorArray;V=h.__dirtyColors;if(h.__dirtyVertices){for(M=0;M<ia;M++)m=p[M].position,i=M*3,u[i]=m.x,u[i+1]=m.y,u[i+2]=m.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,u,w)}if(V){for(M=0;M<l;M++)m=k[M],i=M*3,o[i]=m.r,o[i+1]=m.g,o[i+2]=m.b;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,o,w)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(w instanceof THREE.Line){h=b(w,l);o=h.attributes&&n(h);if(f.__dirtyVertices||f.__dirtyColors||o){w=f;i=j.DYNAMIC_DRAW;ia=k=R=p=ma=void 0;p=w.vertices;l=w.colors;ia=p.length;o=l.length;u=w.__vertexArray;M=w.__colorArray;V=w.__dirtyColors;m=w.__webglCustomAttributesList;Z=ka=la=E=R=ma=void 0;if(w.__dirtyVertices){for(ma=0;ma<ia;ma++)R=p[ma].position,k=ma*3,u[k]=R.x,u[k+1]=R.y,u[k+2]=R.z;j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-w.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,u,i)}if(V){for(p=0;p<o;p++)ia=l[p],k=p*3,M[k]=ia.r,M[k+1]=ia.g,M[k+2]=ia.b;j.bindBuffer(j.ARRAY_BUFFER,w.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,M,i)}if(m){ma=0;for(R=m.length;ma<R;ma++)if(Z=m[ma],Z.needsUpdate&&(Z.boundTo===void 0||Z.boundTo==="vertices")){k=0;la=Z.value.length;if(Z.size===1)for(E=0;E<la;E++)Z.array[E]=Z.value[E];else if(Z.size===2)for(E=0;E<la;E++)ka=Z.value[E],Z.array[k]=ka.x,Z.array[k+1]=ka.y,k+=2;else if(Z.size===3)if(Z.type===
|
|
|
-"c")for(E=0;E<la;E++)ka=Z.value[E],Z.array[k]=ka.r,Z.array[k+1]=ka.g,Z.array[k+2]=ka.b,k+=3;else for(E=0;E<la;E++)ka=Z.value[E],Z.array[k]=ka.x,Z.array[k+1]=ka.y,Z.array[k+2]=ka.z,k+=3;else if(Z.size===4)for(E=0;E<la;E++)ka=Z.value[E],Z.array[k]=ka.x,Z.array[k+1]=ka.y,Z.array[k+2]=ka.z,Z.array[k+3]=ka.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,Z.buffer);j.bufferData(j.ARRAY_BUFFER,Z.array,i)}}}f.__dirtyVertices=!1;f.__dirtyColors=!1;h.attributes&&s(h)}else if(w instanceof THREE.ParticleSystem)h=b(w,l),o=
|
|
|
-h.attributes&&n(h),(f.__dirtyVertices||f.__dirtyColors||w.sortParticles||o)&&d(f,j.DYNAMIC_DRAW,w),f.__dirtyVertices=!1,f.__dirtyColors=!1,h.attributes&&s(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<=D?k=n:(k=Math.ceil(D*n/(i+n)),i=D-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 o=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)o=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:o,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},q,d=[];h?d.push(h):(d.push(k),d.push(l));for(q in c)d.push(q),d.push(c[q]);h=d.join();q=0;for(d=J.length;q<d;q++)if(J[q].code===h){m=J[q].program;break a}q=j.createProgram();d=[oa?"#define VERTEX_TEXTURES":"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":"",A.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:"",A.gammaInput?"#define GAMMA_INPUT":"",A.gammaOutput?"#define GAMMA_OUTPUT":"",A.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(q,v("fragment",f+k));j.attachShader(q,
|
|
|
-v("vertex",d+l));j.linkProgram(q);j.getProgramParameter(q,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(q,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");q.uniforms={};q.attributes={};var M,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(M in i)d.push(M);M=d;d=0;for(i=M.length;d<i;d++)k=M[d],q.uniforms[k]=j.getUniformLocation(q,
|
|
|
-k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(M=0;M<c.maxMorphTargets;M++)d.push("morphTarget"+M);for(m in b)d.push(m);m=d;M=0;for(b=m.length;M<b;M++)c=m[M],q.attributes[c]=j.getAttribLocation(q,c);q.id=J.length;J.push({program:q,code:h});A.info.memory.programs=J.length;m=q}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++)M="morphTarget"+g,m[M]>=0&&(j.enableVertexAttribArray(m[M]),
|
|
|
+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!==ja&&(j.lineWidth(d),ja=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)),B.info.render.calls++,B.info.render.vertices+=
|
|
|
+e.__webglFaceCount,B.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ja&&(j.lineWidth(d),ja=d),j.drawArrays(g,0,e.__webglLineCount),B.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),B.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),B.info.render.calls++)}}function f(a){K[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
|
|
|
+a.n13,a.n44-a.n14);K[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);K[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);K[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);K[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);K[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=K[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=K[d].x*b.n14+K[d].y*b.n24+K[d].z*b.n34+K[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,m,k,l,n,p=0,r=a.lights;aa||(aa=new THREE.PerspectiveCamera(B.shadowCameraFov,B.shadowMapWidth/B.shadowMapHeight,B.shadowCameraNear,B.shadowCameraFar));b=0;for(c=r.length;b<c;b++)if(n=r[b],n.castShadow&&n instanceof THREE.SpotLight){S=-1;B.shadowMap[p]||(B.shadowMap[p]=new THREE.WebGLRenderTarget(B.shadowMapWidth,B.shadowMapHeight,{minFilter:THREE.LinearFilter,
|
|
|
+magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ka[p]=new THREE.Matrix4);d=B.shadowMap[p];i=ka[p];aa.position.copy(n.position);aa.lookAt(n.target.position);aa.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(aa));this.autoUpdateScene&&a.updateMatrixWorld();aa.matrixWorldInverse.getInverse(aa.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(aa.projectionMatrix);i.multiplySelf(aa.matrixWorldInverse);aa.matrixWorldInverse.flattenToArray(H);
|
|
|
+aa.projectionMatrix.flattenToArray(ga);X.multiply(aa.projectionMatrix,aa.matrixWorldInverse);f(X);C(d);j.clearColor(1,1,1,1);B.clear();j.clearColor(T.r,T.g,T.b,V);i=a.__webglObjects.length;for(d=0;d<i;d++)if(k=a.__webglObjects[d],n=k.object,k.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||h(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),t(n,aa,!1),k.render=!0;q(!0);w(THREE.NormalBlending);for(d=0;d<i;d++)if(k=a.__webglObjects[d],k.render)n=k.object,k=k.buffer,
|
|
|
+v(n),l=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?va:ea,e(aa,r,null,l,k,n);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)k=a.__webglObjectsImmediate[d],n=k.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),N=-1,t(n,aa,!1),v(n),m=o(aa,r,null,ea,n),n.immediateRenderCallback?n.immediateRenderCallback(m,j,K):n.render(function(a){g(a,m,ea.shading)}));p++}}function l(a,b,c,d,g,f,h,j){var i,m,k,l;b?(m=a.length-1,l=
|
|
|
+b=-1):(m=0,b=a.length,l=1);for(var n=m;n!==b;n+=l)if(i=a[n],i.render){m=i.object;k=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&w(i.blending);q(i.depthTest);A(i.depthWrite);D(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}v(m);e(d,g,f,i,k,m)}}function n(a,b,c,d,e,f,h){for(var i,m,k,l,n=0,p=a.length;n<p;n++)if(i=a[n],m=i.object,m.visible){N=-1;if(h)k=h;else{k=i[b];if(!k)continue;f&&w(k.blending);q(k.depthTest);A(k.depthWrite);D(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}v(m);
|
|
|
+l=o(c,d,e,k,m);m.immediateRenderCallback?m.immediateRenderCallback(l,j,K):m.render(function(a){g(a,l,k.shading)})}}function r(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function s(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function p(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b,c,d,e){d.program||B.initMaterial(d,b,c,e);if(d.morphTargets&&
|
|
|
+!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(B.maxMorphTargets);for(var g=0,f=B.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==P&&(j.useProgram(g),P=g,h=!0);if(d.id!==S)S=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,ga);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 m,k,l=0,n=0,p=0,r,K,s,o=na,q=o.directional.colors,t=o.directional.positions,X=o.point.colors,v=o.point.positions,A=o.point.distances,U=0,D=0,c=m=s=0,h=b.length;c<h;c++)if(m=b[c],k=m.color,r=m.position,K=m.intensity,s=m.distance,m instanceof THREE.AmbientLight)B.gammaInput?(l+=k.r*k.r,n+=k.g*k.g,p+=k.b*k.b):(l+=k.r,n+=k.g,p+=k.b);else if(m instanceof THREE.DirectionalLight)s=U*3,B.gammaInput?(q[s]=k.r*
|
|
|
+k.r*K*K,q[s+1]=k.g*k.g*K*K,q[s+2]=k.b*k.b*K*K):(q[s]=k.r*K,q[s+1]=k.g*K,q[s+2]=k.b*K),t[s]=r.x,t[s+1]=r.y,t[s+2]=r.z,U+=1;else if(m instanceof THREE.SpotLight)s=U*3,B.gammaInput?(q[s]=k.r*k.r*K*K,q[s+1]=k.g*k.g*K*K,q[s+2]=k.b*k.b*K*K):(q[s]=k.r*K,q[s+1]=k.g*K,q[s+2]=k.b*K),k=1/r.length(),t[s]=r.x*k,t[s+1]=r.y*k,t[s+2]=r.z*k,U+=1;else if(m instanceof THREE.PointLight)m=D*3,B.gammaInput?(X[m]=k.r*k.r*K*K,X[m+1]=k.g*k.g*K*K,X[m+2]=k.b*k.b*K*K):(X[m]=k.r*K,X[m+1]=k.g*K,X[m+2]=k.b*K),v[m]=r.x,v[m+1]=r.y,
|
|
|
+v[m+2]=r.z,A[D]=s,D+=1;c=U*3;for(h=q.length;c<h;c++)q[c]=0;c=D*3;for(h=X.length;c<h;c++)X[c]=0;o.point.length=D;o.directional.length=U;o.ambient[0]=l;o.ambient[1]=n;o.ambient[2]=p;b=na;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,B.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=$.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,B.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)B.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<ka.length;b++)i.shadowMatrix.value[b]=ka[b],i.shadowMap.texture[b]=B.shadowMap[b];
|
|
|
+i.shadowDarkness.value=B.shadowMapDarkness;i.shadowBias.value=B.shadowMapBias}b=d.uniformsList;i=0;for(c=b.length;i<c;i++)if(n=g.uniforms[b[i][1]])if(l=b[i][0],p=l.type,h=l.value,p==="i")j.uniform1i(n,h);else if(p==="f")j.uniform1f(n,h);else if(p==="v2")j.uniform2f(n,h.x,h.y);else if(p==="v3")j.uniform3f(n,h.x,h.y,h.z);else if(p==="v4")j.uniform4f(n,h.x,h.y,h.z,h.w);else if(p==="c")j.uniform3f(n,h.r,h.g,h.b);else if(p==="fv1")j.uniform1fv(n,h);else if(p==="fv")j.uniform3fv(n,h);else if(p==="v3v"){if(!l._array)l._array=
|
|
|
+new Float32Array(3*h.length);p=0;for(r=h.length;p<r;p++)o=p*3,l._array[o]=h[p].x,l._array[o+1]=h[p].y,l._array[o+2]=h[p].z;j.uniform3fv(n,l._array)}else if(p==="m4"){if(!l._array)l._array=new Float32Array(16);h.flattenToArray(l._array);j.uniformMatrix4fv(n,!1,l._array)}else if(p==="m4v"){if(!l._array)l._array=new Float32Array(16*h.length);p=0;for(r=h.length;p<r;p++)h[p].flattenToArrayOffset(l._array,p*16);j.uniformMatrix4fv(n,!1,l._array)}else if(p==="t"){if(j.uniform1i(n,h),n=l.texture)if(n.image instanceof
|
|
|
+Array&&n.image.length===6){if(l=n,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]);E(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 n instanceof
|
|
|
+THREE.WebGLRenderTargetCube?(l=n,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,l.__webglTexture)):I(n,h)}else if(p==="tv"){if(!l._array){l._array=[];p=0;for(r=l.texture.length;p<r;p++)l._array[p]=h+p}j.uniform1iv(n,l._array);p=0;for(r=l.texture.length;p<r;p++)(n=l.texture[p])&&I(n,l._array[p])}(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 t(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function v(a){if(ba!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),ba=a.doubleSided;if(R!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),R=a.flipSided}function q(a){Z!==
|
|
|
+a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),Z=a)}function A(a){W!==a&&(j.depthMask(a),W=a)}function D(a,b,c){fa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),fa=a);if(a&&(qa!==b||la!==c))j.polygonOffset(b,c),qa=b,la=c}function w(a){if(a!==U){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)}U=a}}function u(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 E(a,b,c){(c.width&c.width-1)===
|
|
|
+0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,G(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,G(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,G(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,G(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,O(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,O(b.minFilter)))}function I(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
|
|
|
+!0,a.__webglTexture=j.createTexture(),B.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,G(a.format),a.image.width,a.image.height,0,G(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);E(j.TEXTURE_2D,a,a.image);a.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}function x(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 C(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);E(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,G(a.format),a.width,a.height,0,G(a.format),G(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);x(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),E(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,G(a.format),a.width,a.height,0,G(a.format),G(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),x(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=sa,a=pa,d=ta,e=ra);b!==ia&&(j.bindFramebuffer(j.FRAMEBUFFER,
|
|
|
+b),j.viewport(d,e,c,a),ia=b)}function O(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function G(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||{},$=a.canvas!==void 0?a.canvas:document.createElement("canvas"),M=a.stencil!==void 0?a.stencil:!0,J=a.antialias!==void 0?a.antialias:!1,da=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,T=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),V=a.clearAlpha!==void 0?a.clearAlpha:
|
|
|
+0,y=a.maxLights!==void 0?a.maxLights:4;this.domElement=$;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 B=this,j,Q=[],P=null,ia=null,S=-1,N=null,ca=0,ba=null,R=null,U=null,Z=null,W=null,fa=null,qa=null,la=null,ja=null,ta=0,ra=0,sa=0,pa=0,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],X=new THREE.Matrix4,ga=new Float32Array(16),H=new Float32Array(16),ha=new THREE.Vector4,na={ambient:[0,0,0],
|
|
|
+directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},aa,ka=[],ea,va,L={},xa=!1;j=function(){var a;try{if(!(a=$.getContext("experimental-webgl",{antialias:J,stencil:M,preserveDrawingBuffer:da})))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(T.r,T.g,T.b,V);(function(){L.vertices=new Float32Array(16);L.faces=new Uint16Array(6);var a=0;L.vertices[a++]=-1;L.vertices[a++]=-1;L.vertices[a++]=0;L.vertices[a++]=1;L.vertices[a++]=1;L.vertices[a++]=-1;L.vertices[a++]=1;L.vertices[a++]=1;L.vertices[a++]=
|
|
|
+1;L.vertices[a++]=1;L.vertices[a++]=1;L.vertices[a++]=0;L.vertices[a++]=-1;L.vertices[a++]=1;L.vertices[a++]=0;a=L.vertices[a++]=0;L.faces[a++]=0;L.faces[a++]=1;L.faces[a++]=2;L.faces[a++]=0;L.faces[a++]=2;L.faces[a++]=3;L.vertexBuffer=j.createBuffer();L.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,L.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,L.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,L.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,L.faces,j.STATIC_DRAW);L.program=
|
|
|
+j.createProgram();j.attachShader(L.program,u("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(L.program,u("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(L.program);L.attributes={};L.uniforms={};L.attributes.position=j.getAttribLocation(L.program,"position");L.attributes.uv=j.getAttribLocation(L.program,"uv");L.uniforms.uvOffset=j.getUniformLocation(L.program,"uvOffset");L.uniforms.uvScale=j.getUniformLocation(L.program,"uvScale");L.uniforms.rotation=j.getUniformLocation(L.program,
|
|
|
+"rotation");L.uniforms.scale=j.getUniformLocation(L.program,"scale");L.uniforms.alignment=j.getUniformLocation(L.program,"alignment");L.uniforms.color=j.getUniformLocation(L.program,"color");L.uniforms.map=j.getUniformLocation(L.program,"map");L.uniforms.opacity=j.getUniformLocation(L.program,"opacity");L.uniforms.useScreenCoordinates=j.getUniformLocation(L.program,"useScreenCoordinates");L.uniforms.affectedByDistance=j.getUniformLocation(L.program,"affectedByDistance");L.uniforms.screenPosition=
|
|
|
+j.getUniformLocation(L.program,"screenPosition");L.uniforms.modelViewMatrix=j.getUniformLocation(L.program,"modelViewMatrix");L.uniforms.projectionMatrix=j.getUniformLocation(L.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);ea=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
|
|
|
+ea._shadowPass=!0;va._shadowPass=!0})();this.context=j;var ma=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=function(){return ma};this.setSize=function(a,b){$.width=a;$.height=b;this.setViewport(0,0,$.width,$.height)};this.setViewport=function(a,b,c,d){ta=a;ra=b;sa=c;pa=d;j.viewport(ta,ra,sa,pa)};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){T.setHex(a);V=b;j.clearColor(T.r,T.g,T.b,V)};this.setClearColor=function(a,b){T.copy(a);V=b;j.clearColor(T.r,T.g,T.b,V)};this.getClearColor=function(){return T};this.getClearAlpha=function(){return V};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){C(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]);B.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),B.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
|
|
|
+j.deleteBuffer(a.__webglColorBuffer),B.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),B.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),B.info.memory.textures--};this.updateShadowMap=function(a,b){k(a,b)};this.render=function(a,b,c,d){var e,g,m,p,r=a.lights,K=a.fog;S=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
|
|
|
+this.shadowMapEnabled&&this.shadowMapAutoUpdate&&k(a,b);B.info.render.calls=0;B.info.render.vertices=0;B.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(ga);X.multiply(b.projectionMatrix,b.matrixWorldInverse);f(X);C(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
|
|
|
+this.autoClearDepth,this.autoClearStencil);p=a.__webglObjects;d=0;for(e=p.length;d<e;d++)if(g=p[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);t(m,b,!0);var s=g,o=s.object,v=s.buffer,u=void 0,u=u=void 0,u=o.material;if(u instanceof THREE.MeshFaceMaterial){if(u=v.materialIndex,u>=0)u=o.geometry.materials[u],u.transparent?(s.transparent=u,s.opaque=null):(s.opaque=u,s.transparent=null)}else if(u)u.transparent?
|
|
|
+(s.transparent=u,s.opaque=null):(s.opaque=u,s.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(ha.copy(m.position),X.multiplyVector3(ha),g.z=ha.z)}this.sortObjects&&p.sort(i);p=a.__webglObjectsImmediate;d=0;for(e=p.length;d<e;d++)if(g=p[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),t(m,b,!0),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(w(a.overrideMaterial.blending),
|
|
|
+q(a.overrideMaterial.depthTest),A(a.overrideMaterial.depthWrite),D(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),l(a.__webglObjects,!1,"",b,r,K,!0,a.overrideMaterial),n(a.__webglObjectsImmediate,"",b,r,K,!1,a.overrideMaterial)):(w(THREE.NormalBlending),l(a.__webglObjects,!0,"opaque",b,r,K,!1),n(a.__webglObjectsImmediate,"opaque",b,r,K,!1),l(a.__webglObjects,!1,"transparent",b,r,K,!0),n(a.__webglObjectsImmediate,"transparent",b,r,K,!0));
|
|
|
+if(a.__webglSprites.length){m=L.attributes;r=L.uniforms;K=pa/sa;d=[];e=sa*0.5;p=pa*0.5;g=!0;j.useProgram(L.program);P=L.program;N=Z=U=-1;xa||(j.enableVertexAttribArray(L.attributes.position),j.enableVertexAttribArray(L.attributes.uv),xa=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,L.vertexBuffer);j.vertexAttribPointer(m.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(m.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,L.elementBuffer);j.uniformMatrix4fv(r.projectionMatrix,
|
|
|
+!1,ga);j.activeTexture(j.TEXTURE0);j.uniform1i(r.map,0);m=0;for(s=a.__webglSprites.length;m<s;m++)if(o=a.__webglSprites[m],o.visible&&o.opacity!==0)o.useScreenCoordinates?o.z=-o.position.z:(o._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,o.matrixWorld,o._modelViewMatrixArray),o.z=-o._modelViewMatrix.n34);a.__webglSprites.sort(i);m=0;for(s=a.__webglSprites.length;m<s;m++)o=a.__webglSprites[m],o.visible&&o.opacity!==0&&o.map&&o.map.image&&o.map.image.width&&(o.useScreenCoordinates?(j.uniform1i(r.useScreenCoordinates,
|
|
|
+1),j.uniform3f(r.screenPosition,(o.position.x-e)/e,(p-o.position.y)/p,Math.max(0,Math.min(1,o.position.z)))):(j.uniform1i(r.useScreenCoordinates,0),j.uniform1i(r.affectedByDistance,o.affectedByDistance?1:0),j.uniformMatrix4fv(r.modelViewMatrix,!1,o._modelViewMatrixArray)),b=o.map.image.width/(o.scaleByViewport?pa:1),d[0]=b*K*o.scale.x,d[1]=b*o.scale.y,j.uniform2f(r.uvScale,o.uvScale.x,o.uvScale.y),j.uniform2f(r.uvOffset,o.uvOffset.x,o.uvOffset.y),j.uniform2f(r.alignment,o.alignment.x,o.alignment.y),
|
|
|
+j.uniform1f(r.opacity,o.opacity),j.uniform3f(r.color,o.color.r,o.color.g,o.color.b),j.uniform1f(r.rotation,o.rotation),j.uniform2fv(r.scale,d),o.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!o.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),w(o.blending),I(o.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(W)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
+c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};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,n=void 0,K=void 0,o=void 0,q=void 0,ga=void 0,t={},X=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)n=i.faces[k],K=n.materialIndex,q=K!==void 0?K:-1,t[q]===void 0&&(t[q]={hash:q,counter:0}),ga=t[q].hash+"_"+t[q].counter,i.geometryGroups[ga]===
|
|
|
+void 0&&(i.geometryGroups[ga]={faces3:[],faces4:[],materialIndex:K,vertices:0,numMorphTargets:X}),o=n instanceof THREE.Face3?3:4,i.geometryGroups[ga].vertices+o>65535&&(t[q].counter+=1,ga=t[q].hash+"_"+t[q].counter,i.geometryGroups[ga]===void 0&&(i.geometryGroups[ga]={faces3:[],faces4:[],materialIndex:K,vertices:0,numMorphTargets:X})),n instanceof THREE.Face3?i.geometryGroups[ga].faces3.push(k):i.geometryGroups[ga].faces4.push(k),i.geometryGroups[ga].vertices+=o;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=
|
|
|
+ca++,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){n=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(n=k.numMorphTargets;l<n;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}B.info.memory.geometries++;K=e;o=K.geometry;l=i.faces3;q=i.faces4;k=l.length*3+q.length*4;n=l.length*1+q.length*2;q=l.length*3+q.length*4;l=b(K,i);ga=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;t=l instanceof THREE.MeshBasicMaterial&&!l.envMap||
|
|
|
+l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;X=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(t)i.__normalArray=new Float32Array(k*3);if(o.hasTangents)i.__tangentArray=new Float32Array(k*4);if(X)i.__colorArray=new Float32Array(k*3);if(ga){if(o.faceUvs.length>0||o.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(o.faceUvs.length>1||o.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*
|
|
|
+2)}if(K.geometry.skinWeights.length&&K.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(n*3);i.__lineArray=new Uint16Array(q*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];K=0;for(o=i.numMorphTargets;K<o;K++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=t===THREE.SmoothShading;i.__uvType=ga;
|
|
|
+i.__vertexColorType=X;i.__normalType=t;i.__webglFaceCount=n*3;i.__webglLineCount=q*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];n=void 0;for(n in l.attributes){var K=l.attributes[n],o={},v;for(v in K)o[v]=K[v];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=!0,q=1,o.type==="v2"?q=2:o.type==="v3"?q=3:o.type==="v4"?q=4:o.type==="c"&&(q=3),o.size=q,o.array=new Float32Array(k*q),o.buffer=j.createBuffer(),o.buffer.belongsToAttribute=
|
|
|
+n,K.needsUpdate=!0,o.__original=K;i.__webglCustomAttributesList.push(o)}}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(),B.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(),B.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(),B.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],r(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?
|
|
|
+(h=e.geometry,r(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)p(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)&&p(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(v=a.__webglObjects[e].object,f=v.geometry,h=n=l=void 0,v instanceof THREE.Mesh){i=0;for(k=f.geometryGroupsList.length;i<k;i++)if(l=f.geometryGroupsList[i],h=b(v,l),n=h.attributes&&m(h),f.__dirtyVertices||f.__dirtyMorphTargets||
|
|
|
+f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||n)if(n=j.DYNAMIC_DRAW,K=!f.dynamic,l.__inittedArrays){var A=q=o=void 0,H=void 0,U=void 0,D=void 0,u=void 0,C=void 0,I=void 0,na=void 0,Z=A=D=I=void 0,w=void 0,y=void 0,x=void 0,E=void 0,ha=void 0,L=void 0,W=H=I=H=void 0,P=void 0,G=H=x=y=w=E=x=y=w=E=x=y=w=E=x=y=w=u=void 0,aa=void 0,M=D=void 0,O=void 0,N=void 0,fa=void 0,ka=void 0,J=Z=N=aa=0,Q=0,S=G=A=0,ea=u=ha=0,F=0,R=void 0,fa=l.__vertexArray,O=l.__uvArray,F=l.__uv2Array,
|
|
|
+M=l.__normalArray,U=l.__tangentArray,L=l.__colorArray,W=l.__skinVertexAArray,P=l.__skinVertexBArray,C=l.__skinIndexArray,T=l.__skinWeightArray,ba=l.__morphTargetsArrays,ga=l.__webglCustomAttributesList,z=void 0,z=l.__faceArray,R=l.__lineArray,da=l.__needsSmoothNormals,I=l.__vertexColorType,na=l.__uvType,D=l.__normalType,V=v.geometry,ia=V.__dirtyElements,$=V.__dirtyUvs,qa=V.__dirtyNormals,va=V.__dirtyTangents,xa=V.__dirtyColors,ka=V.__dirtyMorphTargets,la=V.vertices,t=l.faces3,X=l.faces4,ja=V.faces,
|
|
|
+ta=V.faceVertexUvs[0],sa=V.faceVertexUvs[1],ma=V.skinVerticesA,ra=V.skinVerticesB,pa=V.skinIndices,Aa=V.skinWeights,wa=V.morphTargets;if(V.__dirtyVertices){o=0;for(q=t.length;o<q;o++)H=ja[t[o]],w=la[H.a].position,y=la[H.b].position,x=la[H.c].position,fa[N]=w.x,fa[N+1]=w.y,fa[N+2]=w.z,fa[N+3]=y.x,fa[N+4]=y.y,fa[N+5]=y.z,fa[N+6]=x.x,fa[N+7]=x.y,fa[N+8]=x.z,N+=9;o=0;for(q=X.length;o<q;o++)H=ja[X[o]],w=la[H.a].position,y=la[H.b].position,x=la[H.c].position,E=la[H.d].position,fa[N]=w.x,fa[N+1]=w.y,fa[N+
|
|
|
+2]=w.z,fa[N+3]=y.x,fa[N+4]=y.y,fa[N+5]=y.z,fa[N+6]=x.x,fa[N+7]=x.y,fa[N+8]=x.z,fa[N+9]=E.x,fa[N+10]=E.y,fa[N+11]=E.z,N+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,fa,n)}if(ka){o=0;for(q=t.length;o<q;o++){H=ja[t[o]];N=0;for(fa=wa.length;N<fa;N++)w=wa[N].vertices[H.a].position,y=wa[N].vertices[H.b].position,x=wa[N].vertices[H.c].position,ka=ba[N],ka[ea]=w.x,ka[ea+1]=w.y,ka[ea+2]=w.z,ka[ea+3]=y.x,ka[ea+4]=y.y,ka[ea+5]=y.z,ka[ea+6]=x.x,ka[ea+7]=x.y,ka[ea+8]=x.z;
|
|
|
+ea+=9}o=0;for(q=X.length;o<q;o++){H=ja[X[o]];N=0;for(fa=wa.length;N<fa;N++)w=wa[N].vertices[H.a].position,y=wa[N].vertices[H.b].position,x=wa[N].vertices[H.c].position,E=wa[N].vertices[H.d].position,ka=ba[N],ka[ea]=w.x,ka[ea+1]=w.y,ka[ea+2]=w.z,ka[ea+3]=y.x,ka[ea+4]=y.y,ka[ea+5]=y.z,ka[ea+6]=x.x,ka[ea+7]=x.y,ka[ea+8]=x.z,ka[ea+9]=E.x,ka[ea+10]=E.y,ka[ea+11]=E.z;ea+=12}N=0;for(fa=wa.length;N<fa;N++)j.bindBuffer(j.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[N]),j.bufferData(j.ARRAY_BUFFER,ba[N],n)}if(Aa.length){o=
|
|
|
+0;for(q=t.length;o<q;o++)H=ja[t[o]],w=Aa[H.a],y=Aa[H.b],x=Aa[H.c],T[u]=w.x,T[u+1]=w.y,T[u+2]=w.z,T[u+3]=w.w,T[u+4]=y.x,T[u+5]=y.y,T[u+6]=y.z,T[u+7]=y.w,T[u+8]=x.x,T[u+9]=x.y,T[u+10]=x.z,T[u+11]=x.w,w=pa[H.a],y=pa[H.b],x=pa[H.c],C[u]=w.x,C[u+1]=w.y,C[u+2]=w.z,C[u+3]=w.w,C[u+4]=y.x,C[u+5]=y.y,C[u+6]=y.z,C[u+7]=y.w,C[u+8]=x.x,C[u+9]=x.y,C[u+10]=x.z,C[u+11]=x.w,w=ma[H.a],y=ma[H.b],x=ma[H.c],W[u]=w.x,W[u+1]=w.y,W[u+2]=w.z,W[u+3]=1,W[u+4]=y.x,W[u+5]=y.y,W[u+6]=y.z,W[u+7]=1,W[u+8]=x.x,W[u+9]=x.y,W[u+10]=
|
|
|
+x.z,W[u+11]=1,w=ra[H.a],y=ra[H.b],x=ra[H.c],P[u]=w.x,P[u+1]=w.y,P[u+2]=w.z,P[u+3]=1,P[u+4]=y.x,P[u+5]=y.y,P[u+6]=y.z,P[u+7]=1,P[u+8]=x.x,P[u+9]=x.y,P[u+10]=x.z,P[u+11]=1,u+=12;o=0;for(q=X.length;o<q;o++)H=ja[X[o]],w=Aa[H.a],y=Aa[H.b],x=Aa[H.c],E=Aa[H.d],T[u]=w.x,T[u+1]=w.y,T[u+2]=w.z,T[u+3]=w.w,T[u+4]=y.x,T[u+5]=y.y,T[u+6]=y.z,T[u+7]=y.w,T[u+8]=x.x,T[u+9]=x.y,T[u+10]=x.z,T[u+11]=x.w,T[u+12]=E.x,T[u+13]=E.y,T[u+14]=E.z,T[u+15]=E.w,w=pa[H.a],y=pa[H.b],x=pa[H.c],E=pa[H.d],C[u]=w.x,C[u+1]=w.y,C[u+2]=
|
|
|
+w.z,C[u+3]=w.w,C[u+4]=y.x,C[u+5]=y.y,C[u+6]=y.z,C[u+7]=y.w,C[u+8]=x.x,C[u+9]=x.y,C[u+10]=x.z,C[u+11]=x.w,C[u+12]=E.x,C[u+13]=E.y,C[u+14]=E.z,C[u+15]=E.w,w=ma[H.a],y=ma[H.b],x=ma[H.c],E=ma[H.d],W[u]=w.x,W[u+1]=w.y,W[u+2]=w.z,W[u+3]=1,W[u+4]=y.x,W[u+5]=y.y,W[u+6]=y.z,W[u+7]=1,W[u+8]=x.x,W[u+9]=x.y,W[u+10]=x.z,W[u+11]=1,W[u+12]=E.x,W[u+13]=E.y,W[u+14]=E.z,W[u+15]=1,w=ra[H.a],y=ra[H.b],x=ra[H.c],H=ra[H.d],P[u]=w.x,P[u+1]=w.y,P[u+2]=w.z,P[u+3]=1,P[u+4]=y.x,P[u+5]=y.y,P[u+6]=y.z,P[u+7]=1,P[u+8]=x.x,P[u+
|
|
|
+9]=x.y,P[u+10]=x.z,P[u+11]=1,P[u+12]=H.x,P[u+13]=H.y,P[u+14]=H.z,P[u+15]=1,u+=16;u>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,W,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,P,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,C,n),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,T,n))}if(xa&&I){o=0;for(q=t.length;o<q;o++)H=ja[t[o]],u=H.vertexColors,
|
|
|
+C=H.color,u.length===3&&I===THREE.VertexColors?(H=u[0],W=u[1],P=u[2]):P=W=H=C,L[ha]=H.r,L[ha+1]=H.g,L[ha+2]=H.b,L[ha+3]=W.r,L[ha+4]=W.g,L[ha+5]=W.b,L[ha+6]=P.r,L[ha+7]=P.g,L[ha+8]=P.b,ha+=9;o=0;for(q=X.length;o<q;o++)H=ja[X[o]],u=H.vertexColors,C=H.color,u.length===4&&I===THREE.VertexColors?(H=u[0],W=u[1],P=u[2],u=u[3]):u=P=W=H=C,L[ha]=H.r,L[ha+1]=H.g,L[ha+2]=H.b,L[ha+3]=W.r,L[ha+4]=W.g,L[ha+5]=W.b,L[ha+6]=P.r,L[ha+7]=P.g,L[ha+8]=P.b,L[ha+9]=u.r,L[ha+10]=u.g,L[ha+11]=u.b,ha+=12;ha>0&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,L,n))}if(va&&V.hasTangents){o=0;for(q=t.length;o<q;o++)H=ja[t[o]],I=H.vertexTangents,ha=I[0],L=I[1],H=I[2],U[G]=ha.x,U[G+1]=ha.y,U[G+2]=ha.z,U[G+3]=ha.w,U[G+4]=L.x,U[G+5]=L.y,U[G+6]=L.z,U[G+7]=L.w,U[G+8]=H.x,U[G+9]=H.y,U[G+10]=H.z,U[G+11]=H.w,G+=12;o=0;for(q=X.length;o<q;o++)H=ja[X[o]],I=H.vertexTangents,ha=I[0],L=I[1],H=I[2],I=I[3],U[G]=ha.x,U[G+1]=ha.y,U[G+2]=ha.z,U[G+3]=ha.w,U[G+4]=L.x,U[G+5]=L.y,U[G+6]=L.z,U[G+7]=L.w,U[G+8]=H.x,U[G+9]=H.y,U[G+
|
|
|
+10]=H.z,U[G+11]=H.w,U[G+12]=I.x,U[G+13]=I.y,U[G+14]=I.z,U[G+15]=I.w,G+=16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,U,n)}if(qa&&D){o=0;for(q=t.length;o<q;o++)if(H=ja[t[o]],U=H.vertexNormals,D=H.normal,U.length===3&&da)for(G=0;G<3;G++)D=U[G],M[A]=D.x,M[A+1]=D.y,M[A+2]=D.z,A+=3;else for(G=0;G<3;G++)M[A]=D.x,M[A+1]=D.y,M[A+2]=D.z,A+=3;o=0;for(q=X.length;o<q;o++)if(H=ja[X[o]],U=H.vertexNormals,D=H.normal,U.length===4&&da)for(G=0;G<4;G++)D=U[G],M[A]=D.x,M[A+1]=D.y,
|
|
|
+M[A+2]=D.z,A+=3;else for(G=0;G<4;G++)M[A]=D.x,M[A+1]=D.y,M[A+2]=D.z,A+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,M,n)}if($&&ta&&na){o=0;for(q=t.length;o<q;o++)if(A=t[o],A=ta[A],A!==void 0)for(G=0;G<3;G++)M=A[G],O[Z]=M.u,O[Z+1]=M.v,Z+=2;o=0;for(q=X.length;o<q;o++)if(A=X[o],A=ta[A],A!==void 0)for(G=0;G<4;G++)M=A[G],O[Z]=M.u,O[Z+1]=M.v,Z+=2;Z>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,O,n))}if($&&sa&&na){o=0;for(q=t.length;o<
|
|
|
+q;o++)if(A=t[o],Z=sa[A],Z!==void 0)for(G=0;G<3;G++)O=Z[G],F[J]=O.u,F[J+1]=O.v,J+=2;o=0;for(q=X.length;o<q;o++)if(A=X[o],Z=sa[A],Z!==void 0)for(G=0;G<4;G++)O=Z[G],F[J]=O.u,F[J+1]=O.v,J+=2;J>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,F,n))}if(ia){o=0;for(q=t.length;o<q;o++)z[Q]=aa,z[Q+1]=aa+1,z[Q+2]=aa+2,Q+=3,R[S]=aa,R[S+1]=aa+1,R[S+2]=aa,R[S+3]=aa+2,R[S+4]=aa+1,R[S+5]=aa+2,S+=6,aa+=3;o=0;for(q=X.length;o<q;o++)z[Q]=aa,z[Q+1]=aa+1,z[Q+2]=aa+3,z[Q+3]=aa+1,z[Q+4]=
|
|
|
+aa+2,z[Q+5]=aa+3,Q+=6,R[S]=aa,R[S+1]=aa+1,R[S+2]=aa,R[S+3]=aa+3,R[S+4]=aa+1,R[S+5]=aa+2,R[S+6]=aa+2,R[S+7]=aa+3,S+=8,aa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,z,n);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,R,n)}if(ga){G=0;for(aa=ga.length;G<aa;G++)if(z=ga[G],z.__original.needsUpdate){F=0;if(z.size===1)if(z.boundTo===void 0||z.boundTo==="vertices"){o=0;for(q=t.length;o<q;o++)H=ja[t[o]],z.array[F]=
|
|
|
+z.value[H.a],z.array[F+1]=z.value[H.b],z.array[F+2]=z.value[H.c],F+=3;o=0;for(q=X.length;o<q;o++)H=ja[X[o]],z.array[F]=z.value[H.a],z.array[F+1]=z.value[H.b],z.array[F+2]=z.value[H.c],z.array[F+3]=z.value[H.d],F+=4}else{if(z.boundTo==="faces"){o=0;for(q=t.length;o<q;o++)R=z.value[t[o]],z.array[F]=R,z.array[F+1]=R,z.array[F+2]=R,F+=3;o=0;for(q=X.length;o<q;o++)R=z.value[X[o]],z.array[F]=R,z.array[F+1]=R,z.array[F+2]=R,z.array[F+3]=R,F+=4}}else if(z.size===2)if(z.boundTo===void 0||z.boundTo==="vertices"){o=
|
|
|
+0;for(q=t.length;o<q;o++)H=ja[t[o]],w=z.value[H.a],y=z.value[H.b],x=z.value[H.c],z.array[F]=w.x,z.array[F+1]=w.y,z.array[F+2]=y.x,z.array[F+3]=y.y,z.array[F+4]=x.x,z.array[F+5]=x.y,F+=6;o=0;for(q=X.length;o<q;o++)H=ja[X[o]],w=z.value[H.a],y=z.value[H.b],x=z.value[H.c],E=z.value[H.d],z.array[F]=w.x,z.array[F+1]=w.y,z.array[F+2]=y.x,z.array[F+3]=y.y,z.array[F+4]=x.x,z.array[F+5]=x.y,z.array[F+6]=E.x,z.array[F+7]=E.y,F+=8}else{if(z.boundTo==="faces"){o=0;for(q=t.length;o<q;o++)x=y=w=R=z.value[t[o]],
|
|
|
+z.array[F]=w.x,z.array[F+1]=w.y,z.array[F+2]=y.x,z.array[F+3]=y.y,z.array[F+4]=x.x,z.array[F+5]=x.y,F+=6;o=0;for(q=X.length;o<q;o++)E=x=y=w=R=z.value[X[o]],z.array[F]=w.x,z.array[F+1]=w.y,z.array[F+2]=y.x,z.array[F+3]=y.y,z.array[F+4]=x.x,z.array[F+5]=x.y,z.array[F+6]=E.x,z.array[F+7]=E.y,F+=8}}else if(z.size===3)if(J=z.type==="c"?["r","g","b"]:["x","y","z"],z.boundTo===void 0||z.boundTo==="vertices"){o=0;for(q=t.length;o<q;o++)H=ja[t[o]],w=z.value[H.a],y=z.value[H.b],x=z.value[H.c],z.array[F]=w[J[0]],
|
|
|
+z.array[F+1]=w[J[1]],z.array[F+2]=w[J[2]],z.array[F+3]=y[J[0]],z.array[F+4]=y[J[1]],z.array[F+5]=y[J[2]],z.array[F+6]=x[J[0]],z.array[F+7]=x[J[1]],z.array[F+8]=x[J[2]],F+=9;o=0;for(q=X.length;o<q;o++)H=ja[X[o]],w=z.value[H.a],y=z.value[H.b],x=z.value[H.c],E=z.value[H.d],z.array[F]=w[J[0]],z.array[F+1]=w[J[1]],z.array[F+2]=w[J[2]],z.array[F+3]=y[J[0]],z.array[F+4]=y[J[1]],z.array[F+5]=y[J[2]],z.array[F+6]=x[J[0]],z.array[F+7]=x[J[1]],z.array[F+8]=x[J[2]],z.array[F+9]=E[J[0]],z.array[F+10]=E[J[1]],
|
|
|
+z.array[F+11]=E[J[2]],F+=12}else{if(z.boundTo==="faces"){o=0;for(q=t.length;o<q;o++)x=y=w=R=z.value[t[o]],z.array[F]=w[J[0]],z.array[F+1]=w[J[1]],z.array[F+2]=w[J[2]],z.array[F+3]=y[J[0]],z.array[F+4]=y[J[1]],z.array[F+5]=y[J[2]],z.array[F+6]=x[J[0]],z.array[F+7]=x[J[1]],z.array[F+8]=x[J[2]],F+=9;o=0;for(q=X.length;o<q;o++)E=x=y=w=R=z.value[X[o]],z.array[F]=w[J[0]],z.array[F+1]=w[J[1]],z.array[F+2]=w[J[2]],z.array[F+3]=y[J[0]],z.array[F+4]=y[J[1]],z.array[F+5]=y[J[2]],z.array[F+6]=x[J[0]],z.array[F+
|
|
|
+7]=x[J[1]],z.array[F+8]=x[J[2]],z.array[F+9]=E[J[0]],z.array[F+10]=E[J[1]],z.array[F+11]=E[J[2]],F+=12}}else if(z.size===4)if(z.boundTo===void 0||z.boundTo==="vertices"){o=0;for(q=t.length;o<q;o++)H=ja[t[o]],w=z.value[H.a],y=z.value[H.b],x=z.value[H.c],z.array[F]=w.x,z.array[F+1]=w.y,z.array[F+2]=w.z,z.array[F+3]=w.w,z.array[F+4]=y.x,z.array[F+5]=y.y,z.array[F+6]=y.z,z.array[F+7]=y.w,z.array[F+8]=x.x,z.array[F+9]=x.y,z.array[F+10]=x.z,z.array[F+11]=x.w,F+=12;o=0;for(q=X.length;o<q;o++)H=ja[X[o]],
|
|
|
+w=z.value[H.a],y=z.value[H.b],x=z.value[H.c],E=z.value[H.d],z.array[F]=w.x,z.array[F+1]=w.y,z.array[F+2]=w.z,z.array[F+3]=w.w,z.array[F+4]=y.x,z.array[F+5]=y.y,z.array[F+6]=y.z,z.array[F+7]=y.w,z.array[F+8]=x.x,z.array[F+9]=x.y,z.array[F+10]=x.z,z.array[F+11]=x.w,z.array[F+12]=E.x,z.array[F+13]=E.y,z.array[F+14]=E.z,z.array[F+15]=E.w,F+=16}else if(z.boundTo==="faces"){o=0;for(q=t.length;o<q;o++)x=y=w=R=z.value[t[o]],z.array[F]=w.x,z.array[F+1]=w.y,z.array[F+2]=w.z,z.array[F+3]=w.w,z.array[F+4]=y.x,
|
|
|
+z.array[F+5]=y.y,z.array[F+6]=y.z,z.array[F+7]=y.w,z.array[F+8]=x.x,z.array[F+9]=x.y,z.array[F+10]=x.z,z.array[F+11]=x.w,F+=12;o=0;for(q=X.length;o<q;o++)E=x=y=w=R=z.value[X[o]],z.array[F]=w.x,z.array[F+1]=w.y,z.array[F+2]=w.z,z.array[F+3]=w.w,z.array[F+4]=y.x,z.array[F+5]=y.y,z.array[F+6]=y.z,z.array[F+7]=y.w,z.array[F+8]=x.x,z.array[F+9]=x.y,z.array[F+10]=x.z,z.array[F+11]=x.w,z.array[F+12]=E.x,z.array[F+13]=E.y,z.array[F+14]=E.z,z.array[F+15]=E.w,F+=16}j.bindBuffer(j.ARRAY_BUFFER,z.buffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
+z.array,n)}}K&&(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&&s(h)}else if(v instanceof
|
|
|
+THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;v=j.DYNAMIC_DRAW;o=i=o=K=K=void 0;q=h.vertices;k=h.colors;ga=q.length;l=k.length;t=h.__vertexArray;n=h.__colorArray;X=h.__dirtyColors;if(h.__dirtyVertices){for(K=0;K<ga;K++)o=q[K].position,i=K*3,t[i]=o.x,t[i+1]=o.y,t[i+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,t,v)}if(X){for(K=0;K<l;K++)o=k[K],i=K*3,n[i]=o.r,n[i+1]=o.g,n[i+2]=o.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
+n,v)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(v instanceof THREE.Line){h=b(v,l);n=h.attributes&&m(h);if(f.__dirtyVertices||f.__dirtyColors||n){v=f;i=j.DYNAMIC_DRAW;ga=k=aa=q=ja=void 0;q=v.vertices;l=v.colors;ga=q.length;n=l.length;t=v.__vertexArray;K=v.__colorArray;X=v.__dirtyColors;o=v.__webglCustomAttributesList;Z=S=Q=J=aa=ja=void 0;if(v.__dirtyVertices){for(ja=0;ja<ga;ja++)aa=q[ja].position,k=ja*3,t[k]=aa.x,t[k+1]=aa.y,t[k+2]=aa.z;j.bindBuffer(j.ARRAY_BUFFER,v.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
+t,i)}if(X){for(q=0;q<n;q++)ga=l[q],k=q*3,K[k]=ga.r,K[k+1]=ga.g,K[k+2]=ga.b;j.bindBuffer(j.ARRAY_BUFFER,v.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,K,i)}if(o){ja=0;for(aa=o.length;ja<aa;ja++)if(Z=o[ja],Z.needsUpdate&&(Z.boundTo===void 0||Z.boundTo==="vertices")){k=0;Q=Z.value.length;if(Z.size===1)for(J=0;J<Q;J++)Z.array[J]=Z.value[J];else if(Z.size===2)for(J=0;J<Q;J++)S=Z.value[J],Z.array[k]=S.x,Z.array[k+1]=S.y,k+=2;else if(Z.size===3)if(Z.type==="c")for(J=0;J<Q;J++)S=Z.value[J],Z.array[k]=
|
|
|
+S.r,Z.array[k+1]=S.g,Z.array[k+2]=S.b,k+=3;else for(J=0;J<Q;J++)S=Z.value[J],Z.array[k]=S.x,Z.array[k+1]=S.y,Z.array[k+2]=S.z,k+=3;else if(Z.size===4)for(J=0;J<Q;J++)S=Z.value[J],Z.array[k]=S.x,Z.array[k+1]=S.y,Z.array[k+2]=S.z,Z.array[k+3]=S.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,Z.buffer);j.bufferData(j.ARRAY_BUFFER,Z.array,i)}}}f.__dirtyVertices=!1;f.__dirtyColors=!1;h.attributes&&s(h)}else if(v instanceof THREE.ParticleSystem)h=b(v,l),n=h.attributes&&m(h),(f.__dirtyVertices||f.__dirtyColors||v.sortParticles||
|
|
|
+n)&&d(f,j.DYNAMIC_DRAW,v),f.__dirtyVertices=!1,f.__dirtyColors=!1,h.attributes&&s(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,m;k=m=i=0;for(l=b.length;k<l;k++)f=b[k],f instanceof THREE.SpotLight&&m++,f instanceof THREE.DirectionalLight&&m++,f instanceof THREE.PointLight&&i++;i+m<=y?k=m:(k=Math.ceil(y*m/(i+m)),i=y-k);f={directional:k,point:i};i=m=0;for(k=b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;
|
|
|
+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:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,
|
|
|
+maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(k),d.push(l));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=Q.length;p<d;p++)if(Q[p].code===h){o=Q[p].program;break a}p=j.createProgram();d=[ma?"#define VERTEX_TEXTURES":"",B.gammaInput?"#define GAMMA_INPUT":"",B.gammaOutput?"#define GAMMA_OUTPUT":"",B.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:"",B.gammaInput?"#define GAMMA_INPUT":"",B.gammaOutput?"#define GAMMA_OUTPUT":"",B.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(p,u("fragment",f+k));j.attachShader(p,
|
|
|
+u("vertex",d+l));j.linkProgram(p);j.getProgramParameter(p,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(p,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");p.uniforms={};p.attributes={};var K,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(K in i)d.push(K);K=d;d=0;for(i=K.length;d<i;d++)k=K[d],p.uniforms[k]=j.getUniformLocation(p,
|
|
|
+k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(K=0;K<c.maxMorphTargets;K++)d.push("morphTarget"+K);for(o in b)d.push(o);o=d;K=0;for(b=o.length;K<b;K++)c=o[K],p.attributes[c]=j.getAttribLocation(p,c);p.id=Q.length;Q.push({program:p,code:h});B.info.memory.programs=Q.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal);
|
|
|
+o.tangent>=0&&j.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(g in a.attributes)o[g]!==void 0&&o[g]>=0&&j.enableVertexAttribArray(o[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)K="morphTarget"+g,o[K]>=0&&(j.enableVertexAttribArray(o[K]),
|
|
|
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};
|
|
@@ -354,19 +349,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,k=e.faces,l=a.faceVertexUvs[0],o=e.faceVertexUvs[0],r={},n=0;n<a.materials.length;n++)r[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 q=new THREE.Vertex(h[n].position.clone());b&&b.multiplyVector3(q.position);f.push(q)}n=
|
|
|
-0;for(s=k.length;n<s;n++){var f=k[n],m,u,w=f.vertexNormals,p=f.vertexColors;f instanceof THREE.Face3?m=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(m=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));m.normal.copy(f.normal);d&&d.multiplyVector3(m.normal);h=0;for(q=w.length;h<q;h++)u=w[h].clone(),d&&d.multiplyVector3(u),m.vertexNormals.push(u);m.color.copy(f.color);h=0;for(q=p.length;h<q;h++)u=p[h],m.vertexColors.push(u.clone());if(f.materialIndex!==void 0){h=e.materials[f.materialIndex];
|
|
|
-q=r[h.id];if(q===void 0)q=a.materials.length,a.materials.push(h);m.materialIndex=q}m.centroid.copy(f.centroid);b&&b.multiplyVector3(m.centroid);i.push(m)}n=0;for(s=o.length;n<s;n++){b=o[n];d=[];h=0;for(q=b.length;h<q;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,o=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=o.length;d<f;d++)k=o[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<
|
|
|
+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],n=e.faceVertexUvs[0],r={},m=0;m<a.materials.length;m++)r[a.materials[m].id]=m;if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),b=c.matrix,d=new THREE.Matrix4,d.extractRotation(b,c.scale);for(var m=0,s=h.length;m<s;m++){var p=new THREE.Vertex(h[m].position.clone());b&&b.multiplyVector3(p.position);f.push(p)}m=
|
|
|
+0;for(s=k.length;m<s;m++){var f=k[m],o,t,v=f.vertexNormals,q=f.vertexColors;f instanceof THREE.Face3?o=new THREE.Face3(f.a+g,f.b+g,f.c+g):f instanceof THREE.Face4&&(o=new THREE.Face4(f.a+g,f.b+g,f.c+g,f.d+g));o.normal.copy(f.normal);d&&d.multiplyVector3(o.normal);h=0;for(p=v.length;h<p;h++)t=v[h].clone(),d&&d.multiplyVector3(t),o.vertexNormals.push(t);o.color.copy(f.color);h=0;for(p=q.length;h<p;h++)t=q[h],o.vertexColors.push(t.clone());if(f.materialIndex!==void 0){h=e.materials[f.materialIndex];
|
|
|
+p=r[h.id];if(p===void 0)p=a.materials.length,a.materials.push(h);o.materialIndex=p}o.centroid.copy(f.centroid);b&&b.multiplyVector3(o.centroid);i.push(o)}m=0;for(s=n.length;m<s;m++){b=n[m];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,n=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=n.length;d<f;d++)k=n[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 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,o,r,n;for(g=0;g<h;g++){d=e[g];if(d instanceof THREE.Face3)l=f[d.a].position,o=f[d.b].position,r=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(l,o,r);else if(d instanceof
|
|
|
-THREE.Face4)l=f[d.a].position,o=f[d.b].position,r=f[d.c].position,n=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(l,o,n),d._area2=THREE.GeometryUtils.triangleArea(o,r,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();
|
|
|
+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,n,r,m;for(g=0;g<h;g++){d=e[g];if(d instanceof THREE.Face3)l=f[d.a].position,n=f[d.b].position,r=f[d.c].position,d._area=THREE.GeometryUtils.triangleArea(l,n,r);else if(d instanceof
|
|
|
+THREE.Face4)l=f[d.a].position,n=f[d.b].position,r=f[d.c].position,m=f[d.d].position,d._area1=THREE.GeometryUtils.triangleArea(l,n,m),d._area2=THREE.GeometryUtils.triangleArea(n,r,m),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),k=i.data,l=0;l<d;l++)for(var o=1;o<g;o++){var r=o-1<0?g-1:o-1,n=(o+1)%g,s=l-1<0?d-1:l-1,q=(l+1)%d,m=[],u=[0,0,h[(o*d+l)*4]/255*c];m.push([-1,0,h[(o*d+s)*4]/255*c]);m.push([-1,-1,h[(r*d+s)*4]/255*c]);m.push([0,-1,h[(r*d+l)*4]/255*c]);m.push([1,-1,h[(r*d+q)*4]/255*c]);
|
|
|
-m.push([1,0,h[(o*d+q)*4]/255*c]);m.push([1,1,h[(n*d+q)*4]/255*c]);m.push([0,1,h[(n*d+l)*4]/255*c]);m.push([-1,1,h[(n*d+s)*4]/255*c]);r=[];s=m.length;for(n=0;n<s;n++){var q=m[n],w=m[(n+1)%s],q=[q[0]-u[0],q[1]-u[1],q[2]-u[2]],w=[w[0]-u[0],w[1]-u[1],w[2]-u[2]];r.push(b([q[1]*w[2]-q[2]*w[1],q[2]*w[0]-q[0]*w[2],q[0]*w[1]-q[1]*w[0]]))}m=[0,0,0];for(n=0;n<r.length;n++)m[0]+=r[n][0],m[1]+=r[n][1],m[2]+=r[n][2];m[0]/=r.length;m[1]/=r.length;m[2]/=r.length;u=(o*d+l)*4;k[u]=(m[0]+1)/2*255|0;k[u+1]=(m[1]+0.5)*
|
|
|
-255|0;k[u+2]=m[2]*255|0;k[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 n=1;n<g;n++){var r=n-1<0?g-1:n-1,m=(n+1)%g,s=l-1<0?d-1:l-1,p=(l+1)%d,o=[],t=[0,0,h[(n*d+l)*4]/255*c];o.push([-1,0,h[(n*d+s)*4]/255*c]);o.push([-1,-1,h[(r*d+s)*4]/255*c]);o.push([0,-1,h[(r*d+l)*4]/255*c]);o.push([1,-1,h[(r*d+p)*4]/255*c]);
|
|
|
+o.push([1,0,h[(n*d+p)*4]/255*c]);o.push([1,1,h[(m*d+p)*4]/255*c]);o.push([0,1,h[(m*d+l)*4]/255*c]);o.push([-1,1,h[(m*d+s)*4]/255*c]);r=[];s=o.length;for(m=0;m<s;m++){var p=o[m],v=o[(m+1)%s],p=[p[0]-t[0],p[1]-t[1],p[2]-t[2]],v=[v[0]-t[0],v[1]-t[1],v[2]-t[2]];r.push(b([p[1]*v[2]-p[2]*v[1],p[2]*v[0]-p[0]*v[2],p[0]*v[1]-p[1]*v[0]]))}o=[0,0,0];for(m=0;m<r.length;m++)o[0]+=r[m][0],o[1]+=r[m][1],o[2]+=r[m][2];o[0]/=r.length;o[1]/=r.length;o[2]/=r.length;t=(n*d+l)*4;k[t]=(o[0]+1)/2*255|0;k[t+1]=(o[1]+0.5)*
|
|
|
+255|0;k[t+2]=o[2]*255|0;k[t+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",
|
|
@@ -405,18 +400,18 @@ 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,k,l,o,r,n,s,q;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];o=e[0];r=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++)q=f/a,e=THREE.Shape.Utils.b2(q,n,o,h),q=THREE.Shape.Utils.b2(q,s,r,
|
|
|
-i),b.push(new THREE.Vector2(e,q));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];o=e[0];r=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++)q=f/a,e=THREE.Shape.Utils.b3(q,n,o,k,h),q=THREE.Shape.Utils.b3(q,s,r,l,i),b.push(new THREE.Vector2(e,q));break;case THREE.PathActions.CSPLINE_THRU:f=this.actions[d-1].args;f=[new THREE.Vector2(f[f.length-2],f[f.length-1])];q=a*e[0].length;f=f.concat(e[0]);e=new THREE.SplineCurve(f);
|
|
|
-for(f=1;f<=q;f++)b.push(e.getPointAt(f/q));break;case THREE.PathActions.ARC:f=this.actions[d-1].args;h=e[0];i=e[1];k=e[2];o=e[3];q=e[4];r=!!e[5];l=f[f.length-2];n=f[f.length-1];f.length==0&&(l=n=0);s=q-o;var m=a*2;for(f=1;f<=m;f++)q=f/m,r||(q=1-q),q=o+q*s,e=l+h+k*Math.cos(q),q=n+i+k*Math.sin(q),b.push(new THREE.Vector2(e,q))}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,o;h=0;for(i=f.length;h<i;h++)k=f[h],l=k.x,o=k.y,k.x=a*l+c*o+b,k.y=d*o+g*l+e;return f};
|
|
|
+THREE.Path.prototype.getPoints=function(a,c){var a=a||12,b=[],d,g,e,f,h,i,k,l,n,r,m,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];n=e[0];r=e[1];b.length>0?(f=b[b.length-1],m=f.x,s=f.y):(f=this.actions[d-1].args,m=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b2(p,m,n,h),p=THREE.Shape.Utils.b2(p,s,r,
|
|
|
+i),b.push(new THREE.Vector2(e,p));break;case THREE.PathActions.BEZIER_CURVE_TO:h=e[4];i=e[5];n=e[0];r=e[1];k=e[2];l=e[3];b.length>0?(f=b[b.length-1],m=f.x,s=f.y):(f=this.actions[d-1].args,m=f[f.length-2],s=f[f.length-1]);for(f=1;f<=a;f++)p=f/a,e=THREE.Shape.Utils.b3(p,m,n,k,h),p=THREE.Shape.Utils.b3(p,s,r,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];n=e[3];p=e[4];r=!!e[5];l=f[f.length-2];m=f[f.length-1];f.length==0&&(l=m=0);s=p-n;var o=a*2;for(f=1;f<=o;f++)p=f/o,r||(p=1-p),p=n+p*s,e=l+h+k*Math.cos(p),p=m+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,n;h=0;for(i=f.length;h<i;h++)k=f[h],l=k.x,n=k.y,k.x=a*l+c*n+b,k.y=d*n+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,k,l,o,r,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++){r=k[g];n=[];for(o=0;o<b.length;o++)l=b[o],l=r.distanceToSquared(l),n.push(l),l<e&&(e=l,f=g,h=o)}g=h-1>=0?h-1:b.length-1;e=f-1>=0?f-1:k.length-1;var q=[k[f],b[h],b[g]];o=THREE.FontUtils.Triangulate.area(q);var m=[k[f],k[e],b[h]];r=THREE.FontUtils.Triangulate.area(m);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;q=[k[f],b[h],b[g]];q=THREE.FontUtils.Triangulate.area(q);m=[k[f],k[e],b[h]];m=THREE.FontUtils.Triangulate.area(m);o+r>q+m&&(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);o=b.slice(0,h);r=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=o.concat(n).concat(l).concat(r)}return{shape:b,
|
|
|
+THREE.Shape.Utils={removeHoles:function(a,c){var b=a.concat(),d=b.concat(),g,e,f,h,i,k,l,n,r,m,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++){r=k[g];m=[];for(n=0;n<b.length;n++)l=b[n],l=r.distanceToSquared(l),m.push(l),l<e&&(e=l,f=g,h=n)}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]];n=THREE.FontUtils.Triangulate.area(p);var o=[k[f],k[e],b[h]];r=THREE.FontUtils.Triangulate.area(o);m=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);o=[k[f],k[e],b[h]];o=THREE.FontUtils.Triangulate.area(o);n+r>p+o&&(h=m,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);n=b.slice(0,h);r=b.slice(h);m=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=n.concat(m).concat(l).concat(r)}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};
|
|
@@ -430,11 +425,11 @@ THREE.Animation.prototype.play=function(a,c){if(!this.isPlaying){this.isPlaying=
|
|
|
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,k,l=this.data.JIT.hierarchy,o,r;this.currentTime+=a*this.timeScale;r=this.currentTime;o=this.currentTime%=this.data.length;k=parseInt(Math.min(o*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 q=0;q<3;q++){b=c[q];f=i.prevKey[b];h=i.nextKey[b];if(h.time<=r){if(o<r)if(this.loop){f=this.data.hierarchy[n].keys[0];for(h=this.getNextKeyWith(b,n,1);h.time<o;)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<
|
|
|
-o)}i.prevKey[b]=f;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(o-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.update=function(a){if(this.isPlaying){var c=["pos","rot","scl"],b,d,g,e,f,h,i,k,l=this.data.JIT.hierarchy,n,r;this.currentTime+=a*this.timeScale;r=this.currentTime;n=this.currentTime%=this.data.length;k=parseInt(Math.min(n*this.data.fps,this.data.length*this.data.fps),10);for(var m=0,s=this.hierarchy.length;m<s;m++)if(a=this.hierarchy[m],i=a.animationCache,this.JITCompile&&l[m][k]!==void 0)a instanceof THREE.Bone?(a.skinMatrix=l[m][k],a.matrixAutoUpdate=!1,a.matrixWorldNeedsUpdate=
|
|
|
+!1):(a.matrix=l[m][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<=r){if(n<r)if(this.loop){f=this.data.hierarchy[m].keys[0];for(h=this.getNextKeyWith(b,m,1);h.time<n;)f=h,h=this.getNextKeyWith(b,m,h.index+1)}else{this.stop();return}else{do f=h,h=this.getNextKeyWith(b,m,h.index+1);while(h.time<
|
|
|
+n)}i.prevKey[b]=f;i.nextKey[b]=h}a.matrixAutoUpdate=!0;a.matrixWorldNeedsUpdate=!0;d=(n-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 "+m),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",m,f.index-1).pos,this.points[1]=g,this.points[2]=e,this.points[3]=this.getNextKeyWith("pos",m,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(m=0;m<this.hierarchy.length;m++)l[m][k]=this.hierarchy[m]instanceof THREE.Bone?this.hierarchy[m].skinMatrix.clone():this.hierarchy[m].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]};
|
|
@@ -457,14 +452,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(),m=g.length,u=0;f=m-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<m-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(),o=g.length,t=0;f=o-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<o-1;f++)t=d*h.chunks[f]/h.total,b.keys[f]={time:t,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}),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),
|
|
|
+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}),m=0;m<b.points.length;m++)c=new THREE.Mesh(f,h),c.position.copy(b.points[m]),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=
|
|
@@ -475,37 +470,37 @@ 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,k=0,l=0,o=0,r=0,n=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
|
|
|
-this.rotateHorizontally(c*o);this.rotateVertically(c*r)}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,
|
|
|
+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,n=0,r=0,m=window.innerWidth/2,s=window.innerHeight/2;this.update=function(a){if(this.mouseLook){var c=a*this.lookSpeed;
|
|
|
+this.rotateHorizontally(c*n);this.rotateVertically(c*r)}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){o=(a.clientX-n)/window.innerWidth;r=(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){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){n=(a.clientX-m)/window.innerWidth;r=(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,k=new THREE.Vector2,l=new THREE.Vector2,o=new THREE.Vector2,r=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,n=new THREE.Vector2,r=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+(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=r.clone().subSelf(o);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?o=r:o.addSelf(a.sub(r,o).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),o=r=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&&(r=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||(o=r=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=r.clone().subSelf(n);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?n=r:n.addSelf(a.sub(r,n).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),n=r=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&&(r=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||(n=r=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,l,n){var o,m,q=d||1,r=g||1,p=h/2,s=i/2,u=k.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")o="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")o="y",r=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")o="x",q=e||1;var w=q+1,D=r+1;h/=q;var A=i/r;for(m=0;m<D;m++)for(i=0;i<w;i++){var j=new THREE.Vector3;j[a]=(i*h-p)*c;j[b]=(m*A-s)*f;j[o]=l;k.vertices.push(new THREE.Vertex(j))}for(m=0;m<r;m++)for(i=0;i<q;i++)k.faces.push(new THREE.Face4(i+
|
|
|
-w*m+u,i+w*(m+1)+u,i+1+w*(m+1)+u,i+1+w*m+u,null,null,n)),k.faceVertexUvs[0].push([new THREE.UV(i/q,m/r),new THREE.UV(i/q,(m+1)/r),new THREE.UV((i+1)/q,(m+1)/r),new THREE.UV((i+1)/q,m/r)])}THREE.Geometry.call(this);var k=this,l=a/2,o=c/2,r=b/2,n,s,q,m,u,w;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;m=1;s=2;u=3;q=4;w=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var p in h)this.sides[p]!=
|
|
|
-void 0&&(this.sides[p]=h[p]);this.sides.px&&i("z","y",-1,-1,b,c,l,n);this.sides.nx&&i("z","y",1,-1,b,c,-l,m);this.sides.py&&i("x","z",1,1,a,b,o,s);this.sides.ny&&i("x","z",1,-1,a,b,-o,u);this.sides.pz&&i("x","y",1,-1,a,c,r,q);this.sides.nz&&i("x","y",-1,-1,a,c,-r,w);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 o=[],r=[],n=i/g,s=n*(c-a)+a;for(h=0;h<=d;h++){var q=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(s*Math.sin(q*Math.PI*2),-n*b+f,s*Math.cos(q*Math.PI*2))));o.push(this.vertices.length-1);r.push(new THREE.UV(q,n))}k.push(o);l.push(r)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],o=k[i+1][h],r=k[i+1][h+1],n=k[i][h+1],s=
|
|
|
-this.vertices[b].position.clone().setY(0).normalize(),q=this.vertices[o].position.clone().setY(0).normalize(),m=this.vertices[r].position.clone().setY(0).normalize(),u=this.vertices[n].position.clone().setY(0).normalize(),w=l[i][h].clone(),p=l[i+1][h].clone(),z=l[i+1][h+1].clone(),C=l[i][h+1].clone();this.faces.push(new THREE.Face4(b,o,r,n,[s,q,m,u]));this.faceVertexUvs[0].push([w,p,z,C])}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],o=k[0][h+
|
|
|
-1],r=this.vertices.length-1,s=new THREE.Vector3(0,1,0),q=new THREE.Vector3(0,1,0),m=new THREE.Vector3(0,1,0),w=l[0][h].clone(),p=l[0][h+1].clone(),z=new THREE.UV(p.u,0),this.faces.push(new THREE.Face3(b,o,r,[s,q,m])),this.faceVertexUvs[0].push([w,p,z])}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],o=k[i][h],r=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),q=new THREE.Vector3(0,-1,0),m=new THREE.Vector3(0,-1,0),w=l[i][h+1].clone(),p=l[i][h].clone(),
|
|
|
-z=new THREE.UV(p.u,1),this.faces.push(new THREE.Face3(b,o,r,[s,q,m])),this.faceVertexUvs[0].push([w,p,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,r=g||1,q=h/2,s=i/2,t=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",r=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",p=e||1;var v=p+1,y=r+1;h/=p;var B=i/r;for(o=0;o<y;o++)for(i=0;i<v;i++){var j=new THREE.Vector3;j[a]=(i*h-q)*c;j[b]=(o*B-s)*f;j[n]=l;k.vertices.push(new THREE.Vertex(j))}for(o=0;o<r;o++)for(i=0;i<p;i++)k.faces.push(new THREE.Face4(i+
|
|
|
+v*o+t,i+v*(o+1)+t,i+1+v*(o+1)+t,i+1+v*o+t,null,null,m)),k.faceVertexUvs[0].push([new THREE.UV(i/p,o/r),new THREE.UV(i/p,(o+1)/r),new THREE.UV((i+1)/p,(o+1)/r),new THREE.UV((i+1)/p,o/r)])}THREE.Geometry.call(this);var k=this,l=a/2,n=c/2,r=b/2,m,s,p,o,t,v;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;o=1;s=2;t=3;p=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 q in h)this.sides[q]!=
|
|
|
+void 0&&(this.sides[q]=h[q]);this.sides.px&&i("z","y",-1,-1,b,c,l,m);this.sides.nx&&i("z","y",1,-1,b,c,-l,o);this.sides.py&&i("x","z",1,1,a,b,n,s);this.sides.ny&&i("x","z",1,-1,a,b,-n,t);this.sides.pz&&i("x","y",1,-1,a,c,r,p);this.sides.nz&&i("x","y",-1,-1,a,c,-r,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,k=[],l=[];for(i=0;i<=g;i++){var n=[],r=[],m=i/g,s=m*(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),-m*b+f,s*Math.cos(p*Math.PI*2))));n.push(this.vertices.length-1);r.push(new THREE.UV(p,m))}k.push(n);l.push(r)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=k[i][h],n=k[i+1][h],r=k[i+1][h+1],m=k[i][h+1],s=
|
|
|
+this.vertices[b].position.clone().setY(0).normalize(),p=this.vertices[n].position.clone().setY(0).normalize(),o=this.vertices[r].position.clone().setY(0).normalize(),t=this.vertices[m].position.clone().setY(0).normalize(),v=l[i][h].clone(),q=l[i+1][h].clone(),A=l[i+1][h+1].clone(),D=l[i][h+1].clone();this.faces.push(new THREE.Face4(b,n,r,m,[s,p,o,t]));this.faceVertexUvs[0].push([v,q,A,D])}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],n=k[0][h+
|
|
|
+1],r=this.vertices.length-1,s=new THREE.Vector3(0,1,0),p=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),v=l[0][h].clone(),q=l[0][h+1].clone(),A=new THREE.UV(q.u,0),this.faces.push(new THREE.Face3(b,n,r,[s,p,o])),this.faceVertexUvs[0].push([v,q,A])}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],n=k[i][h],r=this.vertices.length-1,s=new THREE.Vector3(0,-1,0),p=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,0),v=l[i][h+1].clone(),q=l[i][h].clone(),
|
|
|
+A=new THREE.UV(q.u,1),this.faces.push(new THREE.Face3(b,n,r,[s,p,o])),this.faceVertexUvs[0].push([v,q,A])}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(B=a.length;--B>=0;){J=B;R=B-1;R<0&&(R=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=ja+J+d,g=ja+J+e,j=f,d=ja+R+d,e=ja+R+e,k=g;j+=F;d+=F;e+=F;k+=F;H.faces.push(new THREE.Face4(j,d,e,k,null,null,z));z&&(j=b/c,d=(b+1)/c,e=h+i*2,f=(H.vertices[f].position.z+i)/e,g=(H.vertices[g].position.z+i)/e,H.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){H.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=F;b+=F;c+=F;H.faces.push(new THREE.Face3(a,b,c,
|
|
|
-null,null,p));if(p){var d=C.maxY,e=C.maxX,f=H.vertices[b].position.x,b=H.vertices[b].position.y,g=H.vertices[c].position.x,c=H.vertices[c].position.y;H.faceVertexUvs[0].push([new THREE.UV(H.vertices[a].position.x/e,H.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,o=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
|
|
|
-r=c.curveSegments!==void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,s=c.bendPath,q=c.extrudePath,m,u=!1,w=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,p=c.material,z=c.extrudeMaterial,C=this.shapebb;if(q)m=q.getPoints(r),n=m.length,u=!0,o=!1;o||(k=i=l=0);var x,v,I,H=this,F=this.vertices.length;s&&a.addWrapPath(s);r=w?a.extractAllSpacedPoints(r):a.extractAllPoints(r);s=r.shape;r=r.holes;if(q=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();v=0;for(I=r.length;v<I;v++)x=r[v],THREE.Shape.Utils.isClockWise(x)&&
|
|
|
-(r[v]=x.reverse());q=!1}q=THREE.Shape.Utils.triangulateShape(s,r);w=s;v=0;for(I=r.length;v<I;v++)x=r[v],s=s.concat(x);var B,P,Q,aa,N,S,ga=s.length,da=q.length,ba=[];B=0;P=w.length;J=P-1;for(R=B+1;B<P;B++,J++,R++)J===P&&(J=0),R===P&&(R=0),ba[B]=d(w[B],w[J],w[R]);var D=[],A,j=ba.concat();v=0;for(I=r.length;v<I;v++){x=r[v];A=[];B=0;P=x.length;J=P-1;for(R=B+1;B<P;B++,J++,R++)J===P&&(J=0),R===P&&(R=0),A[B]=d(x[B],x[J],x[R]);D.push(A);j=j.concat(A)}for(Q=0;Q<l;Q++){aa=Q/l;N=i*(1-aa);aa=k*Math.sin(aa*Math.PI/
|
|
|
-2);B=0;for(P=w.length;B<P;B++)S=b(w[B],ba[B],aa),e(S.x,S.y,-N);v=0;for(I=r.length;v<I;v++){x=r[v];A=D[v];B=0;for(P=x.length;B<P;B++)S=b(x[B],A[B],aa),e(S.x,S.y,-N)}}aa=k;for(B=0;B<ga;B++)S=o?b(s[B],j[B],aa):s[B],u?e(S.x,S.y+m[0].y,m[0].x):e(S.x,S.y,0);for(Q=1;Q<=n;Q++)for(B=0;B<ga;B++)S=o?b(s[B],j[B],aa):s[B],u?e(S.x,S.y+m[Q-1].y,m[Q-1].x):e(S.x,S.y,h/n*Q);for(Q=l-1;Q>=0;Q--){aa=Q/l;N=i*(1-aa);aa=k*Math.sin(aa*Math.PI/2);B=0;for(P=w.length;B<P;B++)S=b(w[B],ba[B],aa),e(S.x,S.y,h+N);v=0;for(I=r.length;v<
|
|
|
-I;v++){x=r[v];A=D[v];B=0;for(P=x.length;B<P;B++)S=b(x[B],A[B],aa),u?e(S.x,S.y+m[n-1].y,m[n-1].x+N):e(S.x,S.y,h+N)}}if(o){o=ga*0;for(B=0;B<da;B++)k=q[B],f(k[2]+o,k[1]+o,k[0]+o);o=ga*(n+l*2);for(B=0;B<da;B++)k=q[B],f(k[0]+o,k[1]+o,k[2]+o)}else{for(B=0;B<da;B++)k=q[B],f(k[2],k[1],k[0]);for(B=0;B<da;B++)k=q[B],f(k[0]+ga*n,k[1]+ga*n,k[2]+ga*n)}var J,R,ja=0;g(w);ja+=w.length;v=0;for(I=r.length;v<I;v++)x=r[v],g(x),ja+=x.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;){Q=C;P=C-1;P<0&&(P=a.length-1);for(var b=
|
|
|
+0,c=m+l*2,b=0;b<c;b++){var d=da*b,e=da*(b+1),f=ia+Q+d,g=ia+Q+e,j=f,d=ia+P+d,e=ia+P+e,k=g;j+=x;d+=x;e+=x;k+=x;I.faces.push(new THREE.Face4(j,d,e,k,null,null,A));A&&(j=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,j),new THREE.UV(g,j),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+=x;b+=x;c+=x;I.faces.push(new THREE.Face3(a,b,c,
|
|
|
+null,null,q));if(q){var d=D.maxY,e=D.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,n=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
|
|
|
+r=c.curveSegments!==void 0?c.curveSegments:12,m=c.steps!==void 0?c.steps:1,s=c.bendPath,p=c.extrudePath,o,t=!1,v=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,q=c.material,A=c.extrudeMaterial,D=this.shapebb;if(p)o=p.getPoints(r),m=o.length,t=!0,n=!1;n||(k=i=l=0);var w,u,E,I=this,x=this.vertices.length;s&&a.addWrapPath(s);r=v?a.extractAllSpacedPoints(r):a.extractAllPoints(r);s=r.shape;r=r.holes;if(p=!THREE.Shape.Utils.isClockWise(s)){s=s.reverse();u=0;for(E=r.length;u<E;u++)w=r[u],THREE.Shape.Utils.isClockWise(w)&&
|
|
|
+(r[u]=w.reverse());p=!1}p=THREE.Shape.Utils.triangulateShape(s,r);v=s;u=0;for(E=r.length;u<E;u++)w=r[u],s=s.concat(w);var C,O,G,$,M,J,da=s.length,T=p.length,V=[];C=0;O=v.length;Q=O-1;for(P=C+1;C<O;C++,Q++,P++)Q===O&&(Q=0),P===O&&(P=0),V[C]=d(v[C],v[Q],v[P]);var y=[],B,j=V.concat();u=0;for(E=r.length;u<E;u++){w=r[u];B=[];C=0;O=w.length;Q=O-1;for(P=C+1;C<O;C++,Q++,P++)Q===O&&(Q=0),P===O&&(P=0),B[C]=d(w[C],w[Q],w[P]);y.push(B);j=j.concat(B)}for(G=0;G<l;G++){$=G/l;M=i*(1-$);$=k*Math.sin($*Math.PI/2);
|
|
|
+C=0;for(O=v.length;C<O;C++)J=b(v[C],V[C],$),e(J.x,J.y,-M);u=0;for(E=r.length;u<E;u++){w=r[u];B=y[u];C=0;for(O=w.length;C<O;C++)J=b(w[C],B[C],$),e(J.x,J.y,-M)}}$=k;for(C=0;C<da;C++)J=n?b(s[C],j[C],$):s[C],t?e(J.x,J.y+o[0].y,o[0].x):e(J.x,J.y,0);for(G=1;G<=m;G++)for(C=0;C<da;C++)J=n?b(s[C],j[C],$):s[C],t?e(J.x,J.y+o[G-1].y,o[G-1].x):e(J.x,J.y,h/m*G);for(G=l-1;G>=0;G--){$=G/l;M=i*(1-$);$=k*Math.sin($*Math.PI/2);C=0;for(O=v.length;C<O;C++)J=b(v[C],V[C],$),e(J.x,J.y,h+M);u=0;for(E=r.length;u<E;u++){w=
|
|
|
+r[u];B=y[u];C=0;for(O=w.length;C<O;C++)J=b(w[C],B[C],$),t?e(J.x,J.y+o[m-1].y,o[m-1].x+M):e(J.x,J.y,h+M)}}if(n){n=da*0;for(C=0;C<T;C++)k=p[C],f(k[2]+n,k[1]+n,k[0]+n);n=da*(m+l*2);for(C=0;C<T;C++)k=p[C],f(k[0]+n,k[1]+n,k[2]+n)}else{for(C=0;C<T;C++)k=p[C],f(k[2],k[1],k[0]);for(C=0;C<T;C++)k=p[C],f(k[0]+da*m,k[1]+da*m,k[2]+da*m)}var Q,P,ia=0;g(v);ia+=v.length;u=0;for(E=r.length;u<E;u++)w=r[u],g(w),ia+=w.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),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,
|
|
@@ -518,19 +513,19 @@ f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push
|
|
|
{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 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),k=[],l=0;for(d=0;d<e;d++){var o=2*d/e,r=i*Math.sin(o*g),o=i*Math.cos(o*g);(b==0||b==f)&&d>0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,h,r)))-1);k.push(l)}c.push(k)}for(var n,s,q,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];r=b/(g-1);n=(b-1)/(g-1);s=(d+1)/e;var o=d/e,l=new THREE.UV(1-s,r),r=new THREE.UV(1-o,r),o=new THREE.UV(1-o,n),m=new THREE.UV(1-s,n);b<c.length-1&&(n=this.vertices[f].position.clone(),s=this.vertices[h].position.clone(),q=this.vertices[i].position.clone(),n.normalize(),s.normalize(),q.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(q.x,q.y,q.z)])),this.faceVertexUvs[0].push([l,r,o]));b>1&&(n=
|
|
|
-this.vertices[f].position.clone(),s=this.vertices[i].position.clone(),q=this.vertices[k].position.clone(),n.normalize(),s.normalize(),q.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(q.x,q.y,q.z)])),this.faceVertexUvs[0].push([l,o,m]))}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 n=2*d/e,r=i*Math.sin(n*g),n=i*Math.cos(n*g);(b==0||b==f)&&d>0||(l=this.vertices.push(new THREE.Vertex(new THREE.Vector3(n,h,r)))-1);k.push(l)}c.push(k)}for(var m,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];r=b/(g-1);m=(b-1)/(g-1);s=(d+1)/e;var n=d/e,l=new THREE.UV(1-s,r),r=new THREE.UV(1-n,r),n=new THREE.UV(1-n,m),o=new THREE.UV(1-s,m);b<c.length-1&&(m=this.vertices[f].position.clone(),s=this.vertices[h].position.clone(),p=this.vertices[i].position.clone(),m.normalize(),s.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,r,n]));b>1&&(m=
|
|
|
+this.vertices[f].position.clone(),s=this.vertices[i].position.clone(),p=this.vertices[k].position.clone(),m.normalize(),s.normalize(),p.normalize(),this.faces.push(new THREE.Face3(f,i,k,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(s.x,s.y,s.z),new THREE.Vector3(p.x,p.y,p.z)])),this.faceVertexUvs[0].push([l,n,o]))}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,k,l,o,r,n,s,q,m,u=c.glyphs[a]||c.glyphs["?"];if(u){if(u.o){c=u._cachedOutline||(u._cachedOutline=u.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]){o=f.x;r=f.y;f=1;for(h=this.divisions;f<=h;f++){var w=f/h,p=THREE.Shape.Utils.b2(w,o,n,i),w=THREE.Shape.Utils.b2(w,r,s,l);e.push(new THREE.Vector2(p,w))}}break;case "b":if(i=c[a++]*b+d,l=c[a++]*b,n=c[a++]*b+d,s=c[a++]*-b,q=c[a++]*b+d,m=c[a++]*-b,g.bezierCurveTo(i,l,n,s,q,m),f=e[e.length-1]){o=f.x;r=f.y;f=1;for(h=this.divisions;f<=h;f++)w=f/h,p=THREE.Shape.Utils.b3(w,o,n,
|
|
|
-q,i),w=THREE.Shape.Utils.b3(w,r,s,m,l),e.push(new THREE.Vector2(p,w))}}}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,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 o=2*g;for(k=g-1;g>2;){if(o--<=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 r;a:{r=a;var n=i,s=k,q=l,m=g,u=f,w=void 0,p=void 0,z=void 0,
|
|
|
-C=void 0,x=void 0,v=void 0,I=void 0,H=void 0,F=void 0,p=r[u[n]].x,z=r[u[n]].y,C=r[u[s]].x,x=r[u[s]].y,v=r[u[q]].x,I=r[u[q]].y;if(1.0E-10>(C-p)*(I-z)-(x-z)*(v-p))r=!1;else{for(w=0;w<m;w++)if(!(w==n||w==s||w==q)){var H=r[u[w]].x,F=r[u[w]].y,B=void 0,P=void 0,Q=void 0,aa=void 0,N=void 0,S=void 0,ga=void 0,da=void 0,ba=void 0,D=void 0,A=void 0,j=void 0,B=Q=N=void 0,B=v-C,P=I-x,Q=p-v,aa=z-I,N=C-p,S=x-z,ga=H-p,da=F-z,ba=H-C,D=F-x,A=H-v,j=F-I,B=B*D-P*ba,N=N*da-S*ga,Q=Q*j-aa*A;if(B>=0&&Q>=0&&N>=0){r=!1;break a}}r=
|
|
|
-!0}}if(r){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--;o=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,n,r,m,s,p,o,t=c.glyphs[a]||c.glyphs["?"];if(t){if(t.o){c=t._cachedOutline||(t._cachedOutline=t.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;m=c[a++]*b+d;s=c[a++]*b;g.quadraticCurveTo(m,s,i,l);if(f=e[e.length-1]){n=f.x;r=f.y;f=1;for(h=this.divisions;f<=h;f++){var v=f/h,q=THREE.Shape.Utils.b2(v,n,m,i),v=THREE.Shape.Utils.b2(v,r,s,l);e.push(new THREE.Vector2(q,v))}}break;case "b":if(i=c[a++]*b+d,l=c[a++]*b,m=c[a++]*b+d,s=c[a++]*-b,p=c[a++]*b+d,o=c[a++]*-b,g.bezierCurveTo(i,l,m,s,p,o),f=e[e.length-1]){n=f.x;r=f.y;f=1;for(h=this.divisions;f<=h;f++)v=f/h,q=THREE.Shape.Utils.b3(v,n,m,
|
|
|
+p,i),v=THREE.Shape.Utils.b3(v,r,s,o,l),e.push(new THREE.Vector2(q,v))}}}return{offset:t.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 n=2*g;for(k=g-1;g>2;){if(n--<=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 r;a:{r=a;var m=i,s=k,p=l,o=g,t=f,v=void 0,q=void 0,A=void 0,
|
|
|
+D=void 0,w=void 0,u=void 0,E=void 0,I=void 0,x=void 0,q=r[t[m]].x,A=r[t[m]].y,D=r[t[s]].x,w=r[t[s]].y,u=r[t[p]].x,E=r[t[p]].y;if(1.0E-10>(D-q)*(E-A)-(w-A)*(u-q))r=!1;else{for(v=0;v<o;v++)if(!(v==m||v==s||v==p)){var I=r[t[v]].x,x=r[t[v]].y,C=void 0,O=void 0,G=void 0,$=void 0,M=void 0,J=void 0,da=void 0,T=void 0,V=void 0,y=void 0,B=void 0,j=void 0,C=G=M=void 0,C=u-D,O=E-w,G=q-u,$=A-E,M=D-q,J=w-A,da=I-q,T=x-A,V=I-D,y=x-w,B=I-u,j=x-E,C=C*y-O*V,M=M*T-J*da,G=G*j-$*B;if(C>=0&&G>=0&&M>=0){r=!1;break a}}r=
|
|
|
+!0}}if(r){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--;n=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;
|
|
@@ -538,13 +533,13 @@ THREE.TorusKnotGeometry=function(a,c,b,d,g,e,f){function h(a,b,c,d,e,f){b=c/d*a;
|
|
|
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),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 j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,l,n,m=0;m<4;m++){n=i[m];k=new THREE.Color;k.setRGB(0,0,0);for(var o=0;o<n.length;o++)l=h.vertexColors[n[o]-1],k.r+=l.r,k.g+=l.g,k.b+=l.b;k.r/=n.length;k.g/=n.length;k.b/=n.length;j.vertexColors[m]=k}}g.push(j);(!f.supportUVs||r.length!=0)&&e.push([r[a],r[b],r[c],r[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={},o={},r=[],n,s,q,m,u,w=a.faceVertexUvs[0];n=0;for(s=w.length;n<s;n++){q=0;for(m=w[n].length;q<m;q++)u=d[n]["abcd".charAt(q)],r[u]||(r[u]=w[n][q])}var p;n=0;for(s=d.length;n<s;n++)if(u=d[n],k.push(u.centroid),i.push(new THREE.Vertex(u.centroid)),f.supportUVs&&r.length!=0){p=new THREE.UV;if(u instanceof THREE.Face3)p.u=r[u.a].u+r[u.b].u+r[u.c].u,p.v=r[u.a].v+r[u.b].v+r[u.c].v,p.u/=3,p.v/=3;else if(u instanceof THREE.Face4)p.u=
|
|
|
-r[u.a].u+r[u.b].u+r[u.c].u+r[u.d].u,p.v=r[u.a].v+r[u.b].v+r[u.c].v+r[u.d].v,p.u/=4,p.v/=4;r.push(p)}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 z=0,w=h.length,C,x,v={},I={},H=function(a,
|
|
|
-b){v[a]===void 0&&(v[a]=[]);v[a].push(b)},F=function(a,b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(n in s){p=s[n];C=n.split("_");x=C[0];C=C[1];H(x,[x,C]);H(C,[x,C]);q=0;for(m=p.length;q<m;q++)u=p[q],F(x,u,n),F(C,u,n);p.length<2&&(o[n]=!0)}for(n in s)if(p=s[n],u=p[0],p=p[1],C=n.split("_"),x=C[0],C=C[1],m=new THREE.Vector3,o[n]?(m.addSelf(h[x].position),m.addSelf(h[C].position),m.multiplyScalar(0.5)):(m.addSelf(k[u]),m.addSelf(k[p]),m.addSelf(h[x].position),m.addSelf(h[C].position),m.multiplyScalar(0.25)),
|
|
|
-l[n]=w+d.length+z,i.push(new THREE.Vertex(m)),z++,f.supportUVs&&r.length!=0)p=new THREE.UV,p.u=r[x].u+r[C].u,p.v=r[x].v+r[C].v,p.u/=2,p.v/=2,r.push(p);var B,P;C=["123","12","2","23"];m=["123","23","3","31"];var H=["123","31","1","12"],F=["1234","12","2","23"],Q=["1234","23","3","34"],aa=["1234","34","4","41"],N=["1234","41","1","12"];n=0;for(s=k.length;n<s;n++)u=d[n],p=w+n,u instanceof THREE.Face3?(z=b(u.a,u.b),x=b(u.b,u.c),B=b(u.c,u.a),c(p,l[z],u.b,l[x],u,C),c(p,l[x],u.c,l[B],u,m),c(p,l[B],u.a,l[z],
|
|
|
-u,H)):u instanceof THREE.Face4?(z=b(u.a,u.b),x=b(u.b,u.c),B=b(u.c,u.d),P=b(u.d,u.a),c(p,l[z],u.b,l[x],u,F),c(p,l[x],u.c,l[B],u,Q),c(p,l[B],u.d,l[P],u,aa),c(p,l[P],u.a,l[z],u,N)):console.log("face should be a face!",u);d=i;i=new THREE.Vector3;l=new THREE.Vector3;n=0;for(s=h.length;n<s;n++)if(v[n]!==void 0){i.set(0,0,0);l.set(0,0,0);u=new THREE.Vector3(0,0,0);p=0;for(q in I[n])i.addSelf(k[q]),p++;z=0;w=v[n].length;for(q=0;q<w;q++)o[b(v[n][q][0],v[n][q][1])]&&z++;if(z!=2){i.divideScalar(p);for(q=0;q<
|
|
|
-w;q++)p=v[n][q],p=h[p[0]].position.clone().addSelf(h[p[1]].position).divideScalar(2),l.addSelf(p);l.divideScalar(w);u.addSelf(h[n].position);u.multiplyScalar(w-3);u.addSelf(i);u.addSelf(l.multiplyScalar(2));u.divideScalar(w);d[n].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 j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,l,m,o=0;o<4;o++){m=i[o];k=new THREE.Color;k.setRGB(0,0,0);for(var n=0;n<m.length;n++)l=h.vertexColors[m[n]-1],k.r+=l.r,k.g+=l.g,k.b+=l.b;k.r/=m.length;k.g/=m.length;k.b/=m.length;j.vertexColors[o]=k}}g.push(j);(!f.supportUVs||r.length!=0)&&e.push([r[a],r[b],r[c],r[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={},n={},r=[],m,s,p,o,t,v=a.faceVertexUvs[0];m=0;for(s=v.length;m<s;m++){p=0;for(o=v[m].length;p<o;p++)t=d[m]["abcd".charAt(p)],r[t]||(r[t]=v[m][p])}var q;m=0;for(s=d.length;m<s;m++)if(t=d[m],k.push(t.centroid),i.push(new THREE.Vertex(t.centroid)),f.supportUVs&&r.length!=0){q=new THREE.UV;if(t instanceof THREE.Face3)q.u=r[t.a].u+r[t.b].u+r[t.c].u,q.v=r[t.a].v+r[t.b].v+r[t.c].v,q.u/=3,q.v/=3;else if(t instanceof THREE.Face4)q.u=
|
|
|
+r[t.a].u+r[t.b].u+r[t.c].u+r[t.d].u,q.v=r[t.a].v+r[t.b].v+r[t.c].v+r[t.d].v,q.u/=4,q.v/=4;r.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 A=0,v=h.length,D,w,u={},E={},I=function(a,
|
|
|
+b){u[a]===void 0&&(u[a]=[]);u[a].push(b)},x=function(a,b){E[a]===void 0&&(E[a]={});E[a][b]=null};for(m in s){q=s[m];D=m.split("_");w=D[0];D=D[1];I(w,[w,D]);I(D,[w,D]);p=0;for(o=q.length;p<o;p++)t=q[p],x(w,t,m),x(D,t,m);q.length<2&&(n[m]=!0)}for(m in s)if(q=s[m],t=q[0],q=q[1],D=m.split("_"),w=D[0],D=D[1],o=new THREE.Vector3,n[m]?(o.addSelf(h[w].position),o.addSelf(h[D].position),o.multiplyScalar(0.5)):(o.addSelf(k[t]),o.addSelf(k[q]),o.addSelf(h[w].position),o.addSelf(h[D].position),o.multiplyScalar(0.25)),
|
|
|
+l[m]=v+d.length+A,i.push(new THREE.Vertex(o)),A++,f.supportUVs&&r.length!=0)q=new THREE.UV,q.u=r[w].u+r[D].u,q.v=r[w].v+r[D].v,q.u/=2,q.v/=2,r.push(q);var C,O;D=["123","12","2","23"];o=["123","23","3","31"];var I=["123","31","1","12"],x=["1234","12","2","23"],G=["1234","23","3","34"],$=["1234","34","4","41"],M=["1234","41","1","12"];m=0;for(s=k.length;m<s;m++)t=d[m],q=v+m,t instanceof THREE.Face3?(A=b(t.a,t.b),w=b(t.b,t.c),C=b(t.c,t.a),c(q,l[A],t.b,l[w],t,D),c(q,l[w],t.c,l[C],t,o),c(q,l[C],t.a,l[A],
|
|
|
+t,I)):t instanceof THREE.Face4?(A=b(t.a,t.b),w=b(t.b,t.c),C=b(t.c,t.d),O=b(t.d,t.a),c(q,l[A],t.b,l[w],t,x),c(q,l[w],t.c,l[C],t,G),c(q,l[C],t.d,l[O],t,$),c(q,l[O],t.a,l[A],t,M)):console.log("face should be a face!",t);d=i;i=new THREE.Vector3;l=new THREE.Vector3;m=0;for(s=h.length;m<s;m++)if(u[m]!==void 0){i.set(0,0,0);l.set(0,0,0);t=new THREE.Vector3(0,0,0);q=0;for(p in E[m])i.addSelf(k[p]),q++;A=0;v=u[m].length;for(p=0;p<v;p++)n[b(u[m][p][0],u[m][p][1])]&&A++;if(A!=2){i.divideScalar(q);for(p=0;p<
|
|
|
+v;p++)q=u[m][p],q=h[q[0]].position.clone().addSelf(h[q[1]].position).divideScalar(2),l.addSelf(q);l.divideScalar(v);t.addSelf(h[m].position);t.multiplyScalar(v-3);t.addSelf(i);t.addSelf(l.multiplyScalar(2));t.divideScalar(v);d[m].position=t}}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)==
|
|
@@ -552,122 +547,121 @@ 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 k=THREE.ShaderUtils.lib.normal,l=THREE.UniformsUtils.clone(k.uniforms),o=f.color;h=f.specular;i=f.ambient;var r=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(o);l.uSpecularColor.value.setHex(h);l.uAmbientColor.value.setHex(i);l.uShininess.value=r;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;
|
|
|
+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),n=f.color;h=f.specular;i=f.ambient;var r=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(n);l.uSpecularColor.value.setHex(h);l.uAmbientColor.value.setHex(i);l.uShininess.value=r;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=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 o(b){var c,
|
|
|
-d,e;c=g(a,b);d=g(a,b+x);e=g(a,b+v);b=i(a,b+I);u.faces.push(new THREE.Face3(c,d,e,null,null,b))}function r(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+x);e=g(a,b+v);f=i(a,b+I);j=g(a,b+H);k=g(a,b+F);l=g(a,b+B);var b=z[k*3],n=z[k*3+1];k=z[k*3+2];var m=z[l*3],o=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,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+Q);f=g(a,b+aa);b=i(a,b+N);u.faces.push(new THREE.Face4(c,
|
|
|
-d,e,f,null,null,b))}function s(b){var c,d,e,f,j,k,l,n,m;c=g(a,b);d=g(a,b+P);e=g(a,b+Q);f=g(a,b+aa);j=i(a,b+N);k=g(a,b+S);l=g(a,b+ga);n=g(a,b+da);m=g(a,b+ba);var b=z[l*3],o=z[l*3+1];l=z[l*3+2];var M=z[n*3],q=z[n*3+1];n=z[n*3+2];var p=z[m*3],r=z[m*3+1];m=z[m*3+2];u.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(z[k*3],z[k*3+1],z[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(M,q,n),new THREE.Vector3(p,r,m)],null,j))}function q(b){var c,d,e,f;c=g(a,b);d=g(a,b+D);e=g(a,b+A);b=C[c*2];f=C[c*
|
|
|
-2+1];c=C[d*2];var i=u.faceVertexUvs[0];d=C[d*2+1];var j=C[e*2];e=C[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 m(b){var c,d,e,f,i,k;c=g(a,b);d=g(a,b+j);e=g(a,b+J);f=g(a,b+R);b=C[c*2];i=C[c*2+1];c=C[d*2];k=C[d*2+1];d=C[e*2];var l=u.faceVertexUvs[0];e=C[e*2+1];var n=C[f*2];f=C[f*2+1];var m=[];m.push(new THREE.UV(b,i));m.push(new THREE.UV(c,k));m.push(new THREE.UV(d,e));m.push(new THREE.UV(n,f));l.push(m)}var u=this,w=0,p,z=[],C=[],
|
|
|
-x,v,I,H,F,B,P,Q,aa,N,S,ga,da,ba,D,A,j,J,R,ja,ea,E,fa,W,$;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(u,d,b);p={signature:a.substr(w,8),header_bytes:l(a,w+8),vertex_coordinate_bytes:l(a,w+9),normal_coordinate_bytes:l(a,w+10),uv_coordinate_bytes:l(a,w+11),vertex_index_bytes:l(a,w+12),normal_index_bytes:l(a,w+13),uv_index_bytes:l(a,w+14),material_index_bytes:l(a,w+15),nvertices:g(a,w+16),nnormals:g(a,w+16+4),nuvs:g(a,w+16+8),ntri_flat:g(a,w+16+12),ntri_smooth:g(a,w+16+16),ntri_flat_uv:g(a,
|
|
|
-w+16+20),ntri_smooth_uv:g(a,w+16+24),nquad_flat:g(a,w+16+28),nquad_smooth:g(a,w+16+32),nquad_flat_uv:g(a,w+16+36),nquad_smooth_uv:g(a,w+16+40)};w+=p.header_bytes;x=p.vertex_index_bytes;v=p.vertex_index_bytes*2;I=p.vertex_index_bytes*3;H=p.vertex_index_bytes*3+p.material_index_bytes;F=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes;B=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*2;P=p.vertex_index_bytes;Q=p.vertex_index_bytes*2;aa=p.vertex_index_bytes*3;N=p.vertex_index_bytes*
|
|
|
-4;S=p.vertex_index_bytes*4+p.material_index_bytes;ga=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes;da=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*2;ba=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*3;D=p.uv_index_bytes;A=p.uv_index_bytes*2;j=p.uv_index_bytes;J=p.uv_index_bytes*2;R=p.uv_index_bytes*3;b=p.vertex_index_bytes*3+p.material_index_bytes;$=p.vertex_index_bytes*4+p.material_index_bytes;ja=p.ntri_flat*b;ea=p.ntri_smooth*(b+p.normal_index_bytes*
|
|
|
-3);E=p.ntri_flat_uv*(b+p.uv_index_bytes*3);fa=p.ntri_smooth_uv*(b+p.normal_index_bytes*3+p.uv_index_bytes*3);W=p.nquad_flat*$;b=p.nquad_smooth*($+p.normal_index_bytes*4);$=p.nquad_flat_uv*($+p.uv_index_bytes*4);w+=function(b){for(var d,e,g,h=p.vertex_coordinate_bytes*3,i=b+p.nvertices*h;b<i;b+=h)d=c(a,b),e=c(a,b+p.vertex_coordinate_bytes),g=c(a,b+p.vertex_coordinate_bytes*2),u.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return p.nvertices*h}(w);w+=function(b){for(var c,d,e,f=p.normal_coordinate_bytes*
|
|
|
-3,g=b+p.nnormals*f;b<g;b+=f)c=k(a,b),d=k(a,b+p.normal_coordinate_bytes),e=k(a,b+p.normal_coordinate_bytes*2),z.push(c/127,d/127,e/127);return p.nnormals*f}(w);w+=function(b){for(var d,e,g=p.uv_coordinate_bytes*2,h=b+p.nuvs*g;b<h;b+=g)d=c(a,b),e=c(a,b+p.uv_coordinate_bytes),C.push(d,e);return p.nuvs*g}(w);ja=w+ja;ea=ja+ea;E=ea+E;fa=E+fa;W=fa+W;b=W+b;$=b+$;(function(a){var b,c=p.vertex_index_bytes*3+p.material_index_bytes,d=c+p.uv_index_bytes*3,e=a+p.ntri_flat_uv*d;for(b=a;b<e;b+=d)o(b),q(b+c);return e-
|
|
|
-a})(ea);(function(a){var b,c=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*3,d=c+p.uv_index_bytes*3,e=a+p.ntri_smooth_uv*d;for(b=a;b<e;b+=d)r(b),q(b+c);return e-a})(E);(function(a){var b,c=p.vertex_index_bytes*4+p.material_index_bytes,d=c+p.uv_index_bytes*4,e=a+p.nquad_flat_uv*d;for(b=a;b<e;b+=d)n(b),m(b+c);return e-a})(b);(function(a){var b,c=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*4,d=c+p.uv_index_bytes*4,e=a+p.nquad_smooth_uv*d;for(b=a;b<e;b+=d)s(b),
|
|
|
-m(b+c);return e-a})($);(function(a){var b,c=p.vertex_index_bytes*3+p.material_index_bytes,d=a+p.ntri_flat*c;for(b=a;b<d;b+=c)o(b);return d-a})(w);(function(a){var b,c=p.vertex_index_bytes*3+p.material_index_bytes+p.normal_index_bytes*3,d=a+p.ntri_smooth*c;for(b=a;b<d;b+=c)r(b);return d-a})(ja);(function(a){var b,c=p.vertex_index_bytes*4+p.material_index_bytes,d=a+p.nquad_flat*c;for(b=a;b<d;b+=c)n(b);return d-a})(fa);(function(a){var b,c=p.vertex_index_bytes*4+p.material_index_bytes+p.normal_index_bytes*
|
|
|
-4,d=a+p.nquad_smooth*c;for(b=a;b<d;b+=c)s(b);return d-a})(W);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){ea=a;d=d||W;g!==void 0&&(a=g.split("/"),a.pop(),va=a.length<1?"":a.join("/")+"/");U=c("//dae:library_images/dae:image",f,"image");ua=c("//dae:library_materials/dae:material",I,"material");na=c("//dae:library_effects/dae:effect",Q,"effect");la=c("//dae:library_geometries/dae:geometry",m,"geometry");T=c("//dae:library_controllers/dae:controller",h,"controller");Z=c("//dae:library_animations/dae:animation",N,"animation");xa=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
-l,"visual_scene");ta=[];ra=[];(a=ea.evaluate(".//dae:scene/dae:instance_visual_scene",ea,ba,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),fa=xa[a]):fa=null;E=new THREE.Object3D;for(a=0;a<fa.nodes.length;a++)E.add(e(fa.nodes[a]));b();for(var i in Z);i={scene:E,morphs:ta,skins:ra,dae:{images:U,materials:ua,effects:na,geometries:la,controllers:T,animations:Z,visualScenes:xa,scene:fa}};d&&d(i);return i}function c(a,b,c){for(var a=ea.evaluate(a,ea,
|
|
|
-ba,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 Z)for(var e=Z[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=T[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=fa.getChildById(c.skeleton[0],!0)||fa.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=[],o=[];for(h=0;h<a.vertices.length;h++)o.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 q=0;q<i.joints.length;q++)if(j.sid==i.joints[q]){n=q;break}if(n>=0){q=i.invBindMatrices[n];j.invBindMatrix=q;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,q);j.weights=[];for(q=0;q<i.weights.length;q++)for(var p=
|
|
|
-0;p<i.weights[q].length;p++){var r=i.weights[q][p];r.joint==n&&j.weights.push(r)}}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=o[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:o})}}}function e(a){var b=
|
|
|
-new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=T[a.controllers[f].url];switch(i.type){case "skin":if(la[i.skin.source]){var j=new q;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(T[i.skin.source]&&(d=i=T[i.skin.source],i.morph&&la[i.morph.source]))j=new q,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 q,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[ua[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=T[c.url],j.skinInstanceController=c,j.name="skin_"+ra.length,ra.push(j);else if(d!==void 0){h=i;k=d instanceof n?T[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_"+ta.length;ta.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 o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
|
|
|
-[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function r(){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 q(){this.url="";this.instance_material=[]}function m(){this.id="";this.mesh=null}function u(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function w(){}function p(){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 C(){this.input={}}function x(){this.semantic="";this.offset=0;this.source="";this.set=0}function v(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function H(){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 F(a,
|
|
|
-b){this.type=a;this.effect=b;this.material=null}function B(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 Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function aa(){this.url=""}function N(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function S(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 da(a){var b=a.getAttribute("id");if($[b]!=void 0)return $[b];$[b]=(new v(b)).parse(a);return $[b]}function ba(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function D(a){for(var a=j(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function A(a){for(var a=j(a),b=[],c=0;c<
|
|
|
-a.length;c++)b.push(parseInt(a[c],10));return b}function j(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function J(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function R(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 ja(a,b){var c="";c+=R(a.x,b)+",";c+=R(a.y,b)+",";c+=R(a.z,b);return c}var ea=null,E=null,fa,W=null,$=
|
|
|
-{},U={},Z={},T={},la={},ua={},na={},xa,va,ta,ra,pa=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 v).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 x).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=
|
|
|
-D(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 v).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 x).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 x).parse(g));break;case "v":c=A(g.textContent);break;case "vcount":d=A(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 o).parse(c))}}return this};o.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};o.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};o.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};o.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};o.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 o).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 q).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=ea.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ea,ba,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;
|
|
|
-case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new r).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Z)for(var e=Z[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};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};r.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=D(a.textContent);this.updateMatrix();return this};
|
|
|
-r.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};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=ea.evaluate(".//dae:instance_material",c,ba,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};q.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=ea.evaluate(".//dae:instance_material",
|
|
|
-c,ba,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};m.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=ja(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":da(d);break;case "vertices":this.vertices=(new C).parse(d);break;case "triangles":this.primitives.push((new p).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new w).parse(d))}}var e={};this.geometry3js=new THREE.Geometry;d=$[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,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 q=[],p=[],r={},s=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=$[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=ja(b.vertices[j].position);q.push(c[i].index);break;case "NORMAL":p.push(new THREE.Vector3(l.data[k],l.data[k+1],l.data[k+2]));break;case "TEXCOORD":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(l.data[k],
|
|
|
-l.data[k+1],l.data[k+2]))}var u;n==3?u=new THREE.Face3(q[0],q[1],q[2],[p[0],p[1],p[2]],s.length?s:new THREE.Color):n==4&&(u=new THREE.Face4(q[0],q[1],q[2],q[3],[p[0],p[1],p[2],p[3]],s.length?s:new THREE.Color));u.daeMaterial=a.material;b.faces.push(u);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],e[1],e[2]]);d+=h.length*n}};w.prototype=new p;w.prototype.constructor=w;p.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};p.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=J(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 x).parse(a.childNodes[b]));break;case "vcount":this.vcount=A(c.textContent);break;case "p":this.p=A(c.textContent)}}return this};z.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=J(a,"count",0);this.stride=
|
|
|
-J(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};C.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 x).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};x.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
|
|
|
-"");this.set=J(a,"set",-1);this.offset=J(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};v.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=j(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=D(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
-A(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=j(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};v.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};I.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 aa).parse(a.childNodes[b]);break}return this};H.prototype.isColor=
|
|
|
-function(){return this.texture==null};H.prototype.isTexture=function(){return this.texture!=null};H.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=D(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};F.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 H).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=ea.evaluate(".//dae:float",c,ba,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};F.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 H)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=U[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=pa;return this.material=new THREE.MeshLambertMaterial(a)};B.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};
|
|
|
-Q.prototype.create=function(){if(this.shader==null)return null};Q.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};Q.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 B(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)}}};Q.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};
|
|
|
-Q.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 F(c.nodeName,this)).parse(c)}}};aa.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};N.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 v).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 S(this)).parse(c))}}return this};S.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 x).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))W=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){pa=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.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 n(b){var c,
|
|
|
+d,e;c=g(a,b);d=g(a,b+w);e=g(a,b+u);b=i(a,b+E);t.faces.push(new THREE.Face3(c,d,e,null,null,b))}function r(b){var c,d,e,f,j,k,l;c=g(a,b);d=g(a,b+w);e=g(a,b+u);f=i(a,b+E);j=g(a,b+I);k=g(a,b+x);l=g(a,b+C);var b=A[k*3],m=A[k*3+1];k=A[k*3+2];var n=A[l*3],o=A[l*3+1];l=A[l*3+2];t.faces.push(new THREE.Face3(c,d,e,[new THREE.Vector3(A[j*3],A[j*3+1],A[j*3+2]),new THREE.Vector3(b,m,k),new THREE.Vector3(n,o,l)],null,f))}function m(b){var c,d,e,f;c=g(a,b);d=g(a,b+O);e=g(a,b+G);f=g(a,b+$);b=i(a,b+M);t.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+O);e=g(a,b+G);f=g(a,b+$);j=i(a,b+M);k=g(a,b+J);l=g(a,b+da);m=g(a,b+T);n=g(a,b+V);var b=A[l*3],o=A[l*3+1];l=A[l*3+2];var K=A[m*3],p=A[m*3+1];m=A[m*3+2];var q=A[n*3],r=A[n*3+1];n=A[n*3+2];t.faces.push(new THREE.Face4(c,d,e,f,[new THREE.Vector3(A[k*3],A[k*3+1],A[k*3+2]),new THREE.Vector3(b,o,l),new THREE.Vector3(K,p,m),new THREE.Vector3(q,r,n)],null,j))}function p(b){var c,d,e,f;c=g(a,b);d=g(a,b+y);e=g(a,b+B);b=D[c*2];f=D[c*2+1];
|
|
|
+c=D[d*2];var i=t.faceVertexUvs[0];d=D[d*2+1];var j=D[e*2];e=D[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 o(b){var c,d,e,f,i,k;c=g(a,b);d=g(a,b+j);e=g(a,b+Q);f=g(a,b+P);b=D[c*2];i=D[c*2+1];c=D[d*2];k=D[d*2+1];d=D[e*2];var l=t.faceVertexUvs[0];e=D[e*2+1];var m=D[f*2];f=D[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 t=this,v=0,q,A=[],D=[],w,u,
|
|
|
+E,I,x,C,O,G,$,M,J,da,T,V,y,B,j,Q,P,ia,S,N,ca,ba,R;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(t,d,b);q={signature:a.substr(v,8),header_bytes:l(a,v+8),vertex_coordinate_bytes:l(a,v+9),normal_coordinate_bytes:l(a,v+10),uv_coordinate_bytes:l(a,v+11),vertex_index_bytes:l(a,v+12),normal_index_bytes:l(a,v+13),uv_index_bytes:l(a,v+14),material_index_bytes:l(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+=q.header_bytes;w=q.vertex_index_bytes;u=q.vertex_index_bytes*2;E=q.vertex_index_bytes*3;I=q.vertex_index_bytes*3+q.material_index_bytes;x=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;O=q.vertex_index_bytes;G=q.vertex_index_bytes*2;$=q.vertex_index_bytes*3;M=q.vertex_index_bytes*
|
|
|
+4;J=q.vertex_index_bytes*4+q.material_index_bytes;da=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes;T=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*2;V=q.vertex_index_bytes*4+q.material_index_bytes+q.normal_index_bytes*3;y=q.uv_index_bytes;B=q.uv_index_bytes*2;j=q.uv_index_bytes;Q=q.uv_index_bytes*2;P=q.uv_index_bytes*3;b=q.vertex_index_bytes*3+q.material_index_bytes;R=q.vertex_index_bytes*4+q.material_index_bytes;ia=q.ntri_flat*b;S=q.ntri_smooth*(b+q.normal_index_bytes*
|
|
|
+3);N=q.ntri_flat_uv*(b+q.uv_index_bytes*3);ca=q.ntri_smooth_uv*(b+q.normal_index_bytes*3+q.uv_index_bytes*3);ba=q.nquad_flat*R;b=q.nquad_smooth*(R+q.normal_index_bytes*4);R=q.nquad_flat_uv*(R+q.uv_index_bytes*4);v+=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),t.vertices.push(new THREE.Vertex(new THREE.Vector3(d,e,g)));return q.nvertices*h}(v);v+=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),A.push(c/127,d/127,e/127);return q.nnormals*f}(v);v+=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),D.push(d,e);return q.nuvs*g}(v);ia=v+ia;S=ia+S;N=S+N;ca=N+ca;ba=ca+ba;b=ba+b;R=b+R;(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)n(b),p(b+c);return e-
|
|
|
+a})(S);(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)r(b),p(b+c);return e-a})(N);(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)m(b),o(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),
|
|
|
+o(b+c);return e-a})(R);(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)n(b);return d-a})(v);(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)r(b);return d-a})(ia);(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)m(b);return d-a})(ca);(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})(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){S=a;d=d||ba;g!==void 0&&(a=g.split("/"),a.pop(),ta=a.length<1?"":a.join("/")+"/");U=c("//dae:library_images/dae:image",f,"image");qa=c("//dae:library_materials/dae:material",E,"material");la=c("//dae:library_effects/dae:effect",G,"effect");fa=c("//dae:library_geometries/dae:geometry",o,"geometry");W=c("//dae:library_controllers/dae:controller",h,"controller");Z=c("//dae:library_animations/dae:animation",M,"animation");ja=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
+l,"visual_scene");ra=[];sa=[];(a=S.evaluate(".//dae:scene/dae:instance_visual_scene",S,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ca=ja[a]):ca=null;N=new THREE.Object3D;for(a=0;a<ca.nodes.length;a++)N.add(e(ca.nodes[a]));b();for(var i in Z);i={scene:N,morphs:ra,skins:sa,dae:{images:U,materials:qa,effects:la,geometries:fa,controllers:W,animations:Z,visualScenes:ja,scene:ca}};d&&d(i);return i}function c(a,b,c){for(var a=S.evaluate(a,S,V,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 Z)for(var e=Z[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=W[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=ca.getChildById(c.skeleton[0],!0)||ca.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 r=i.weights[p][q];r.joint==m&&j.weights.push(r)}}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=W[a.controllers[f].url];switch(i.type){case "skin":if(fa[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(W[i.skin.source]&&(d=i=W[i.skin.source],i.morph&&fa[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(fa[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=fa[i.url],k={},l=0,n;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++){n=j[h];var o=la[qa[n.target].instance_effect.url].shader;o.material.opacity=!o.material.opacity?1:o.material.opacity;n=k[n.symbol]=o.material;l++}j=n||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=W[c.url],j.skinInstanceController=c,j.name="skin_"+sa.length,sa.push(j);else if(d!==void 0){h=i;k=d instanceof m?W[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=fa[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 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 n(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function r(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url=
|
|
|
+"";this.skeleton=[];this.instance_material=[]}function s(){this.target=this.symbol=""}function p(){this.url="";this.instance_material=[]}function o(){this.id="";this.mesh=null}function t(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function v(){}function q(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function A(){this.source="";this.stride=this.count=0;this.params=[]}function D(){this.input={}}function w(){this.semantic=
|
|
|
+"";this.offset=0;this.source="";this.set=0}function u(a){this.id=a;this.type=null}function E(){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 x(a,b){this.type=a;this.effect=b;this.material=null}function C(a){this.effect=a;this.format=this.init_from=null}function O(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
|
|
|
+this.source=null}function G(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function $(){this.url=""}function M(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function J(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function da(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function T(a){var b=a.getAttribute("id");
|
|
|
+if(R[b]!=void 0)return R[b];R[b]=(new u(b)).parse(a);return R[b]}function V(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function y(a){for(var a=j(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function B(a){for(var a=j(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function j(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function Q(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function P(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 ia(a,b){var c="";c+=P(a.x,b)+",";c+=P(a.y,b)+",";c+=P(a.z,b);return c}var S=null,N=null,ca,ba=null,R={},U={},Z={},W={},fa={},qa={},la={},ja,ta,ra,sa,pa=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 u).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 w).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=y(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 u).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 w).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 w).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 n).parse(c))}}return this};n.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};n.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};n.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};n.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};n.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 n).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).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=S.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",S,V,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new n).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new r).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in Z)for(var e=Z[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};n.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
|
|
|
+this.transforms[a].matrix)};r.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=y(a.textContent);this.updateMatrix();return this};r.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};m.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=S.evaluate(".//dae:instance_material",c,V,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=S.evaluate(".//dae:instance_material",c,V,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};o.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 t(this)).parse(c)}}return this};t.prototype.parse=function(a){function b(a,c){var d=ia(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":T(d);break;case "vertices":this.vertices=(new D).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 v).parse(d))}}var e=
|
|
|
+{};this.geometry3js=new THREE.Geometry;d=R[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};t.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=[],r={},s=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=R[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=ia(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":r[i.set]===void 0&&(r[i.set]=[]);r[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;n==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],s.length?s:new THREE.Color):n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],s.length?s:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=r[o[f]],b.faceVertexUvs[f].push([e[0],
|
|
|
+e[1],e[2]]);d+=h.length*n}};v.prototype=new q;v.prototype.constructor=v;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=Q(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 w).parse(a.childNodes[b]));break;case "vcount":this.vcount=
|
|
|
+B(c.textContent);break;case "p":this.p=B(c.textContent)}}return this};A.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=Q(a,"count",0);this.stride=Q(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};D.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 w).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};w.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=Q(a,"set",-1);this.offset=Q(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;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 "bool_array":for(var d=j(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=y(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=j(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 A).parse(c.childNodes[d]);break}}}return this};
|
|
|
+u.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};E.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 $).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=y(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};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 "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=S.evaluate(".//dae:float",c,V,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};x.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=U[this.effect.surface.init_from]))a.map=
|
|
|
+THREE.ImageUtils.loadTexture(ta+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=pa;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};O.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};G.prototype.create=function(){if(this.shader==null)return null};G.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};
|
|
|
+G.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 O(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};G.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};G.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 x(c.nodeName,this)).parse(c)}}};$.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 u).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new da(this)).parse(c));break;case "channel":this.channel.push((new J(this)).parse(c))}}return this};J.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};da.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 w).parse(c))}}return this};
|
|
|
+da.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){pa=a},applySkin:g,geometries:fa}};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,k,l,o,r,n,s,q,m,u,w,p,z=a.faces;o=a.vertices;var C=a.normals,x=a.colors,v=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&v++;for(c=0;c<v;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(l=o.length;k<l;)r=new THREE.Vertex,r.position.x=o[k++]*b,r.position.y=
|
|
|
-o[k++]*b,r.position.z=o[k++]*b,d.vertices.push(r);k=0;for(l=z.length;k<l;){b=z[k++];o=b&1;i=b&2;c=b&4;g=b&8;n=b&16;r=b&32;q=b&64;b&=128;o?(m=new THREE.Face4,m.a=z[k++],m.b=z[k++],m.c=z[k++],m.d=z[k++],o=4):(m=new THREE.Face3,m.a=z[k++],m.b=z[k++],m.c=z[k++],o=3);if(i)i=z[k++],m.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<v;c++)u=a.uvs[c],s=z[k++],p=u[s*2],s=u[s*2+1],d.faceUvs[c][i]=new THREE.UV(p,s);if(g)for(c=0;c<v;c++){u=a.uvs[c];w=[];for(g=0;g<o;g++)s=z[k++],p=u[s*2],s=u[s*2+1],w[g]=new THREE.UV(p,
|
|
|
-s);d.faceVertexUvs[c][i]=w}if(n)n=z[k++]*3,g=new THREE.Vector3,g.x=C[n++],g.y=C[n++],g.z=C[n],m.normal=g;if(r)for(c=0;c<o;c++)n=z[k++]*3,g=new THREE.Vector3,g.x=C[n++],g.y=C[n++],g.z=C[n],m.vertexNormals.push(g);if(q)r=z[k++],r=new THREE.Color(x[r]),m.color=r;if(b)for(c=0;c<o;c++)r=z[k++],r=new THREE.Color(x[r]),m.vertexColors.push(r);d.faces.push(m)}}})(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,o,r,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,o=s[i+1]*
|
|
|
-b,r=s[i+2]*b,n.push(new THREE.Vertex(new THREE.Vector3(l,o,r)))}}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)o=new THREE.Color(16755200),o.setRGB(l[b],l[b+1],l[b+2]),k.push(o)}}})(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,n,r,m,s,p,o,t,v,q,A=a.faces;n=a.vertices;var D=a.normals,w=a.colors,u=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&u++;for(c=0;c<u;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];k=0;for(l=n.length;k<l;)r=new THREE.Vertex,r.position.x=n[k++]*b,r.position.y=
|
|
|
+n[k++]*b,r.position.z=n[k++]*b,d.vertices.push(r);k=0;for(l=A.length;k<l;){b=A[k++];n=b&1;i=b&2;c=b&4;g=b&8;m=b&16;r=b&32;p=b&64;b&=128;n?(o=new THREE.Face4,o.a=A[k++],o.b=A[k++],o.c=A[k++],o.d=A[k++],n=4):(o=new THREE.Face3,o.a=A[k++],o.b=A[k++],o.c=A[k++],n=3);if(i)i=A[k++],o.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<u;c++)t=a.uvs[c],s=A[k++],q=t[s*2],s=t[s*2+1],d.faceUvs[c][i]=new THREE.UV(q,s);if(g)for(c=0;c<u;c++){t=a.uvs[c];v=[];for(g=0;g<n;g++)s=A[k++],q=t[s*2],s=t[s*2+1],v[g]=new THREE.UV(q,
|
|
|
+s);d.faceVertexUvs[c][i]=v}if(m)m=A[k++]*3,g=new THREE.Vector3,g.x=D[m++],g.y=D[m++],g.z=D[m],o.normal=g;if(r)for(c=0;c<n;c++)m=A[k++]*3,g=new THREE.Vector3,g.x=D[m++],g.y=D[m++],g.z=D[m],o.vertexNormals.push(g);if(p)r=A[k++],r=new THREE.Color(w[r]),o.color=r;if(b)for(c=0;c<n;c++)r=A[k++],r=new THREE.Color(w[r]),o.vertexColors.push(r);d.faces.push(o)}}})(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,n,r,m,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=[];m=d.morphTargets[c].vertices;s=a.morphTargets[c].vertices;i=0;for(k=s.length;i<k;i+=3)l=s[i]*b,n=s[i+1]*
|
|
|
+b,r=s[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(l,n,r)))}}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)n=new THREE.Color(16755200),n.setRGB(l[b],l[b+1],l[b+2]),k.push(n)}}})(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(n in N.objects)if(!A.objects[n])if(w=N.objects[n],w.geometry!==void 0){if(F=A.geometries[w.geometry]){a=!1;for(J=0;J<w.materials.length;J++)aa=A.materials[w.materials[J]],a=aa instanceof THREE.ShaderMaterial;a&&F.computeTangents();C=w.position;x=w.rotation;v=w.quaternion;
|
|
|
-I=w.scale;v=0;aa.length==0&&(aa=new THREE.MeshFaceMaterial);aa.length>1&&(aa=new THREE.MeshFaceMaterial);a=new THREE.Mesh(F,aa);a.name=n;a.position.set(C[0],C[1],C[2]);v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]);a.scale.set(I[0],I[1],I[2]);a.visible=w.visible;A.scene.add(a);A.objects[n]=a;if(w.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);A.scene.collisions.colliders.push(b)}if(w.castsShadow)b=new THREE.ShadowVolume(F),A.scene.add(b),
|
|
|
-b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;w.trigger&&w.trigger.toLowerCase()!="none"&&(b={type:w.trigger,object:w},A.triggers[a.name]=b)}}else C=w.position,x=w.rotation,v=w.quaternion,I=w.scale,v=0,a=new THREE.Object3D,a.name=n,a.position.set(C[0],C[1],C[2]),v?(a.quaternion.set(v[0],v[1],v[2],v[3]),a.useQuaternion=!0):a.rotation.set(x[0],x[1],x[2]),a.scale.set(I[0],I[1],I[2]),a.visible=w.visible!==void 0?w.visible:!1,A.scene.add(a),A.objects[n]=a,A.empties[n]=a,w.trigger&&w.trigger.toLowerCase()!=
|
|
|
-"none"&&(b={type:w.trigger,object:w},A.triggers[a.name]=b)}function i(a){return function(c){A.geometries[a]=c;h();ga-=1;b.onLoadComplete();l()}}function k(a){return function(b){A.geometries[a]=b}}function l(){b.callbackProgress({totalModels:ba,totalTextures:D,loadedModels:ba-ga,loadedTextures:D-da},A);b.onLoadProgress();ga==0&&da==0&&c(A)}var o,r,n,s,q,m,u,w,p,z,C,x,v,I,H,F,B,P,Q,aa,N,S,ga,da,ba,D,A;N=a.data;Q=new THREE.BinaryLoader;S=new THREE.JSONLoader;da=ga=0;A={scene:new THREE.Scene,geometries:{},
|
|
|
-materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(n in N.objects)if(w=N.objects[n],w.meshCollider){a=!0;break}if(a)A.scene.collisions=new THREE.CollisionSystem;if(N.transform){a=N.transform.position;p=N.transform.rotation;var j=N.transform.scale;a&&A.scene.position.set(a[0],a[1],a[2]);p&&A.scene.rotation.set(p[0],p[1],p[2]);j&&A.scene.scale.set(j[0],j[1],j[2]);(a||p||j)&&A.scene.updateMatrix()}a=function(){da-=1;l();b.onLoadComplete()};for(q in N.cameras)p=
|
|
|
-N.cameras[q],p.type=="perspective"?B=new THREE.PerspectiveCamera(p.fov,p.aspect,p.near,p.far):p.type=="ortho"&&(B=new THREE.OrthographicCamera(p.left,p.right,p.top,p.bottom,p.near,p.far)),C=p.position,p=p.target,B.position.set(C[0],C[1],C[2]),B.target=new THREE.Vector3(p[0],p[1],p[2]),A.cameras[q]=B;for(s in N.lights)p=N.lights[s],q=p.color!==void 0?p.color:16777215,B=p.intensity!==void 0?p.intensity:1,p.type=="directional"?(C=p.direction,z=new THREE.DirectionalLight(q,B),z.position.set(C[0],C[1],
|
|
|
-C[2]),z.position.normalize()):p.type=="point"?(C=p.position,z=p.distance,z=new THREE.PointLight(q,B,z),z.position.set(C[0],C[1],C[2])):p.type=="ambient"&&(z=new THREE.AmbientLight(q)),A.scene.add(z),A.lights[s]=z;for(m in N.fogs)s=N.fogs[m],s.type=="linear"?P=new THREE.Fog(0,s.near,s.far):s.type=="exp2"&&(P=new THREE.FogExp2(0,s.density)),p=s.color,P.color.setRGB(p[0],p[1],p[2]),A.fogs[m]=P;if(A.cameras&&N.defaults.camera)A.currentCamera=A.cameras[N.defaults.camera];if(A.fogs&&N.defaults.fog)A.scene.fog=
|
|
|
-A.fogs[N.defaults.fog];p=N.defaults.bgcolor;A.bgColor=new THREE.Color;A.bgColor.setRGB(p[0],p[1],p[2]);A.bgColorAlpha=N.defaults.bgalpha;for(o in N.geometries)if(m=N.geometries[o],m.type=="bin_mesh"||m.type=="ascii_mesh")ga+=1,b.onLoadStart();ba=ga;for(o in N.geometries)m=N.geometries[o],m.type=="cube"?(F=new THREE.CubeGeometry(m.width,m.height,m.depth,m.segmentsWidth,m.segmentsHeight,m.segmentsDepth,null,m.flipped,m.sides),A.geometries[o]=F):m.type=="plane"?(F=new THREE.PlaneGeometry(m.width,m.height,
|
|
|
-m.segmentsWidth,m.segmentsHeight),A.geometries[o]=F):m.type=="sphere"?(F=new THREE.SphereGeometry(m.radius,m.segmentsWidth,m.segmentsHeight),A.geometries[o]=F):m.type=="cylinder"?(F=new THREE.CylinderGeometry(m.topRad,m.botRad,m.height,m.radSegs,m.heightSegs),A.geometries[o]=F):m.type=="torus"?(F=new THREE.TorusGeometry(m.radius,m.tube,m.segmentsR,m.segmentsT),A.geometries[o]=F):m.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(m.subdivisions),A.geometries[o]=F):m.type=="bin_mesh"?Q.load(d(m.url,
|
|
|
-N.urlBaseType),i(o)):m.type=="ascii_mesh"?S.load(d(m.url,N.urlBaseType),i(o)):m.type=="embedded_mesh"&&(m=N.embeds[m.id])&&S.createModel(m,k(o),"");for(u in N.textures)if(o=N.textures[u],o.url instanceof Array){da+=o.url.length;for(Q=0;Q<o.url.length;Q++)b.onLoadStart()}else da+=1,b.onLoadStart();D=da;for(u in N.textures){o=N.textures[u];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){Q=[];for(var J=0;J<o.url.length;J++)Q[J]=d(o.url[J],N.urlBaseType);
|
|
|
-Q=THREE.ImageUtils.loadTextureCube(Q,o.mapping,a)}else{Q=THREE.ImageUtils.loadTexture(d(o.url,N.urlBaseType),o.mapping,a);if(THREE[o.minFilter]!=void 0)Q.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)Q.magFilter=THREE[o.magFilter];if(o.repeat){Q.repeat.set(o.repeat[0],o.repeat[1]);if(o.repeat[0]!=1)Q.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)Q.wrapT=THREE.RepeatWrapping}o.offset&&Q.offset.set(o.offset[0],o.offset[1]);if(o.wrap){S={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};
|
|
|
-if(S[o.wrap[0]]!==void 0)Q.wrapS=S[o.wrap[0]];if(S[o.wrap[1]]!==void 0)Q.wrapT=S[o.wrap[1]]}}A.textures[u]=Q}for(r in N.materials){u=N.materials[r];for(H in u.parameters)if(H=="envMap"||H=="map"||H=="lightMap")u.parameters[H]=A.textures[u.parameters[H]];else if(H=="shading")u.parameters[H]=u.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")u.parameters[H]=THREE[u.parameters[H]]?THREE[u.parameters[H]]:THREE.NormalBlending;else if(H=="combine")u.parameters[H]=u.parameters[H]==
|
|
|
-"MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H=="vertexColors")if(u.parameters[H]=="face")u.parameters[H]=THREE.FaceColors;else if(u.parameters[H])u.parameters[H]=THREE.VertexColors;if(u.parameters.opacity!==void 0&&u.parameters.opacity<1)u.parameters.transparent=!0;if(u.parameters.normalMap){o=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(o.uniforms);Q=u.parameters.color;S=u.parameters.specular;m=u.parameters.ambient;P=u.parameters.shininess;a.tNormal.texture=A.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=A.textures[u.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(Q);a.uSpecularColor.value.setHex(S);a.uAmbientColor.value.setHex(m);a.uShininess.value=P;if(u.parameters.opacity)a.uOpacity.value=
|
|
|
-u.parameters.opacity;u=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:a,lights:!0,fog:!0})}else u=new THREE[u.type](u.parameters);A.materials[r]=u}h();b.callbackSync(A);l()}},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(m in M.objects)if(!B.objects[m])if(v=M.objects[m],v.geometry!==void 0){if(x=B.geometries[v.geometry]){a=!1;for(Q=0;Q<v.materials.length;Q++)$=B.materials[v.materials[Q]],a=$ instanceof THREE.ShaderMaterial;a&&x.computeTangents();D=v.position;w=v.rotation;u=v.quaternion;
|
|
|
+E=v.scale;u=0;$.length==0&&($=new THREE.MeshFaceMaterial);$.length>1&&($=new THREE.MeshFaceMaterial);a=new THREE.Mesh(x,$);a.name=m;a.position.set(D[0],D[1],D[2]);u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]);a.scale.set(E[0],E[1],E[2]);a.visible=v.visible;B.scene.add(a);B.objects[m]=a;if(v.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);B.scene.collisions.colliders.push(b)}if(v.castsShadow)b=new THREE.ShadowVolume(x),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 D=v.position,w=v.rotation,u=v.quaternion,E=v.scale,u=0,a=new THREE.Object3D,a.name=m,a.position.set(D[0],D[1],D[2]),u?(a.quaternion.set(u[0],u[1],u[2],u[3]),a.useQuaternion=!0):a.rotation.set(w[0],w[1],w[2]),a.scale.set(E[0],E[1],E[2]),a.visible=v.visible!==void 0?v.visible:!1,B.scene.add(a),B.objects[m]=a,B.empties[m]=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();da-=1;b.onLoadComplete();l()}}function k(a){return function(b){B.geometries[a]=b}}function l(){b.callbackProgress({totalModels:V,totalTextures:y,loadedModels:V-da,loadedTextures:y-T},B);b.onLoadProgress();da==0&&T==0&&c(B)}var n,r,m,s,p,o,t,v,q,A,D,w,u,E,I,x,C,O,G,$,M,J,da,T,V,y,B;M=a.data;G=new THREE.BinaryLoader;J=new THREE.JSONLoader;T=da=0;B={scene:new THREE.Scene,geometries:{},materials:{},
|
|
|
+textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};a=!1;for(m in M.objects)if(v=M.objects[m],v.meshCollider){a=!0;break}if(a)B.scene.collisions=new THREE.CollisionSystem;if(M.transform){a=M.transform.position;q=M.transform.rotation;var j=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]);j&&B.scene.scale.set(j[0],j[1],j[2]);(a||q||j)&&B.scene.updateMatrix()}a=function(){T-=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)),D=q.position,q=q.target,C.position.set(D[0],D[1],D[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"?(D=q.direction,A=new THREE.DirectionalLight(p,C),A.position.set(D[0],D[1],D[2]),A.position.normalize()):
|
|
|
+q.type=="point"?(D=q.position,A=q.distance,A=new THREE.PointLight(p,C,A),A.position.set(D[0],D[1],D[2])):q.type=="ambient"&&(A=new THREE.AmbientLight(p)),B.scene.add(A),B.lights[s]=A;for(o in M.fogs)s=M.fogs[o],s.type=="linear"?O=new THREE.Fog(0,s.near,s.far):s.type=="exp2"&&(O=new THREE.FogExp2(0,s.density)),q=s.color,O.color.setRGB(q[0],q[1],q[2]),B.fogs[o]=O;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(n in M.geometries)if(o=M.geometries[n],o.type=="bin_mesh"||o.type=="ascii_mesh")da+=1,b.onLoadStart();V=da;for(n in M.geometries)o=M.geometries[n],o.type=="cube"?(x=new THREE.CubeGeometry(o.width,o.height,o.depth,o.segmentsWidth,o.segmentsHeight,o.segmentsDepth,null,o.flipped,o.sides),B.geometries[n]=x):o.type=="plane"?(x=new THREE.PlaneGeometry(o.width,o.height,o.segmentsWidth,o.segmentsHeight),
|
|
|
+B.geometries[n]=x):o.type=="sphere"?(x=new THREE.SphereGeometry(o.radius,o.segmentsWidth,o.segmentsHeight),B.geometries[n]=x):o.type=="cylinder"?(x=new THREE.CylinderGeometry(o.topRad,o.botRad,o.height,o.radSegs,o.heightSegs),B.geometries[n]=x):o.type=="torus"?(x=new THREE.TorusGeometry(o.radius,o.tube,o.segmentsR,o.segmentsT),B.geometries[n]=x):o.type=="icosahedron"?(x=new THREE.IcosahedronGeometry(o.subdivisions),B.geometries[n]=x):o.type=="bin_mesh"?G.load(d(o.url,M.urlBaseType),i(n)):o.type==
|
|
|
+"ascii_mesh"?J.load(d(o.url,M.urlBaseType),i(n)):o.type=="embedded_mesh"&&(o=M.embeds[o.id])&&J.createModel(o,k(n),"");for(t in M.textures)if(n=M.textures[t],n.url instanceof Array){T+=n.url.length;for(G=0;G<n.url.length;G++)b.onLoadStart()}else T+=1,b.onLoadStart();y=T;for(t in M.textures){n=M.textures[t];if(n.mapping!=void 0&&THREE[n.mapping]!=void 0)n.mapping=new THREE[n.mapping];if(n.url instanceof Array){G=[];for(var Q=0;Q<n.url.length;Q++)G[Q]=d(n.url[Q],M.urlBaseType);G=THREE.ImageUtils.loadTextureCube(G,
|
|
|
+n.mapping,a)}else{G=THREE.ImageUtils.loadTexture(d(n.url,M.urlBaseType),n.mapping,a);if(THREE[n.minFilter]!=void 0)G.minFilter=THREE[n.minFilter];if(THREE[n.magFilter]!=void 0)G.magFilter=THREE[n.magFilter];if(n.repeat){G.repeat.set(n.repeat[0],n.repeat[1]);if(n.repeat[0]!=1)G.wrapS=THREE.RepeatWrapping;if(n.repeat[1]!=1)G.wrapT=THREE.RepeatWrapping}n.offset&&G.offset.set(n.offset[0],n.offset[1]);if(n.wrap){J={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(J[n.wrap[0]]!==void 0)G.wrapS=
|
|
|
+J[n.wrap[0]];if(J[n.wrap[1]]!==void 0)G.wrapT=J[n.wrap[1]]}}B.textures[t]=G}for(r in M.materials){t=M.materials[r];for(I in t.parameters)if(I=="envMap"||I=="map"||I=="lightMap")t.parameters[I]=B.textures[t.parameters[I]];else if(I=="shading")t.parameters[I]=t.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")t.parameters[I]=THREE[t.parameters[I]]?THREE[t.parameters[I]]:THREE.NormalBlending;else if(I=="combine")t.parameters[I]=t.parameters[I]=="MixOperation"?THREE.MixOperation:
|
|
|
+THREE.MultiplyOperation;else if(I=="vertexColors")if(t.parameters[I]=="face")t.parameters[I]=THREE.FaceColors;else if(t.parameters[I])t.parameters[I]=THREE.VertexColors;if(t.parameters.opacity!==void 0&&t.parameters.opacity<1)t.parameters.transparent=!0;if(t.parameters.normalMap){n=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(n.uniforms);G=t.parameters.color;J=t.parameters.specular;o=t.parameters.ambient;O=t.parameters.shininess;a.tNormal.texture=B.textures[t.parameters.normalMap];if(t.parameters.normalMapFactor)a.uNormalScale.value=
|
|
|
+t.parameters.normalMapFactor;if(t.parameters.map)a.tDiffuse.texture=t.parameters.map,a.enableDiffuse.value=!0;if(t.parameters.lightMap)a.tAO.texture=t.parameters.lightMap,a.enableAO.value=!0;if(t.parameters.specularMap)a.tSpecular.texture=B.textures[t.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(G);a.uSpecularColor.value.setHex(J);a.uAmbientColor.value.setHex(o);a.uShininess.value=O;if(t.parameters.opacity)a.uOpacity.value=t.parameters.opacity;t=new THREE.ShaderMaterial({fragmentShader:n.fragmentShader,
|
|
|
+vertexShader:n.vertexShader,uniforms:a,lights:!0,fog:!0})}else t=new THREE[t.type](t.parameters);B.materials[r]=t}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),k=[],l=[];(function(a,f,i){for(var k,l,m,u=a.length;i<u;i+=f)k=a[i],l=a[i+1],m=a[i+2],k=k/16383*b,l=l/16383*b,m=m/16383*b,k+=d,l+=g,m+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,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,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,w,p,z,C=a.length;for(b=0;b<C;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;p=d;z=e;i=f;w=d;var x=e,v=f,I=g.materials[0],H=k[x*3],F=k[x*3+1],x=k[x*3+2],B=k[v*3],P=k[v*3+1],v=k[v*3+2];w=new THREE.Vector3(k[w*3],k[w*3+1],k[w*3+2]);x=new THREE.Vector3(H,F,x);v=new THREE.Vector3(B,P,v);g.faces.push(new THREE.Face3(p,z,i,[w,x,v],null,I));g=l[d*2];d=l[d*2+
|
|
|
-1];i=l[e*2];w=l[e*2+1];p=l[f*2];z=l[f*2+1];f=c.faceVertexUvs[0];e=i;i=w;w=[];w.push(new THREE.UV(g,d));w.push(new THREE.UV(e,i));w.push(new THREE.UV(p,z));f.push(w)}})(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,o,t=a.length;i<t;i+=f)k=a[i],l=a[i+1],o=a[i+2],k=k/16383*b,l=l/16383*b,o=o/16383*b,k+=d,l+=g,o+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,o)))})(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,v,q,A,D=a.length;for(b=0;b<D;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;q=d;A=e;i=f;v=d;var w=e,u=f,E=g.materials[0],I=k[w*3],x=k[w*3+1],w=k[w*3+2],C=k[u*3],O=k[u*3+1],u=k[u*3+2];v=new THREE.Vector3(k[v*3],k[v*3+1],k[v*3+2]);w=new THREE.Vector3(I,x,w);u=new THREE.Vector3(C,O,u);g.faces.push(new THREE.Face3(q,A,i,[v,w,u],null,E));g=l[d*2];d=l[d*2+
|
|
|
+1];i=l[e*2];v=l[e*2+1];q=l[f*2];A=l[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(q,A));f.push(v)}})(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,k,l,o){f=(f-l)/(o-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,o){f=(f-l)/(o-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,o){f=(f-l)/(o-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,o=i+this.yd,r=i+this.zd,n=e+this.yd+this.zd,s=i+this.yd+this.zd,q=0,m=this.field[e],u=this.field[i],w=this.field[k],p=this.field[o],z=this.field[l],C=this.field[r],x=this.field[n],v=this.field[s];m<f&&(q|=1);u<f&&(q|=2);w<f&&(q|=8);p<f&&(q|=4);z<f&&(q|=16);C<f&&(q|=32);x<f&&(q|=128);v<f&&(q|=64);var I=THREE.edgeTable[q];if(I===0)return 0;
|
|
|
-var H=this.delta,F=a+H,B=c+H,H=g+H;I&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,m,u));I&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,F,c,g,u,p));I&4&&(this.compNorm(k),this.compNorm(o),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,B,g,w,p));I&8&&(this.compNorm(e),this.compNorm(k),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,m,w));I&16&&(this.compNorm(l),this.compNorm(r),this.VIntX(l*3,this.vlist,this.nlist,12,f,a,c,H,z,C));
|
|
|
-I&32&&(this.compNorm(r),this.compNorm(s),this.VIntY(r*3,this.vlist,this.nlist,15,f,F,c,H,C,v));I&64&&(this.compNorm(n),this.compNorm(s),this.VIntX(n*3,this.vlist,this.nlist,18,f,a,B,H,x,v));I&128&&(this.compNorm(l),this.compNorm(n),this.VIntY(l*3,this.vlist,this.nlist,21,f,a,c,H,z,x));I&256&&(this.compNorm(e),this.compNorm(l),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,m,z));I&512&&(this.compNorm(i),this.compNorm(r),this.VIntZ(i*3,this.vlist,this.nlist,27,f,F,c,g,u,C));I&1024&&(this.compNorm(o),
|
|
|
-this.compNorm(s),this.VIntZ(o*3,this.vlist,this.nlist,30,f,F,B,g,p,v));I&2048&&(this.compNorm(k),this.compNorm(n),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,B,g,w,x));q<<=4;for(f=e=0;THREE.triTable[q+f]!=-1;)a=q+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,n){f=(f-l)/(n-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,n){f=(f-l)/(n-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,n){f=(f-l)/(n-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,n=i+this.yd,r=i+this.zd,m=e+this.yd+this.zd,s=i+this.yd+this.zd,p=0,o=this.field[e],t=this.field[i],v=this.field[k],q=this.field[n],A=this.field[l],D=this.field[r],w=this.field[m],u=this.field[s];o<f&&(p|=1);t<f&&(p|=2);v<f&&(p|=8);q<f&&(p|=4);A<f&&(p|=16);D<f&&(p|=32);w<f&&(p|=128);u<f&&(p|=64);var E=THREE.edgeTable[p];if(E===0)return 0;
|
|
|
+var I=this.delta,x=a+I,C=c+I,I=g+I;E&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,o,t));E&2&&(this.compNorm(i),this.compNorm(n),this.VIntY(i*3,this.vlist,this.nlist,3,f,x,c,g,t,q));E&4&&(this.compNorm(k),this.compNorm(n),this.VIntX(k*3,this.vlist,this.nlist,6,f,a,C,g,v,q));E&8&&(this.compNorm(e),this.compNorm(k),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,o,v));E&16&&(this.compNorm(l),this.compNorm(r),this.VIntX(l*3,this.vlist,this.nlist,12,f,a,c,I,A,D));
|
|
|
+E&32&&(this.compNorm(r),this.compNorm(s),this.VIntY(r*3,this.vlist,this.nlist,15,f,x,c,I,D,u));E&64&&(this.compNorm(m),this.compNorm(s),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,C,I,w,u));E&128&&(this.compNorm(l),this.compNorm(m),this.VIntY(l*3,this.vlist,this.nlist,21,f,a,c,I,A,w));E&256&&(this.compNorm(e),this.compNorm(l),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,o,A));E&512&&(this.compNorm(i),this.compNorm(r),this.VIntZ(i*3,this.vlist,this.nlist,27,f,x,c,g,t,D));E&1024&&(this.compNorm(n),
|
|
|
+this.compNorm(s),this.VIntZ(n*3,this.vlist,this.nlist,30,f,x,C,g,q,u));E&2048&&(this.compNorm(k),this.compNorm(m),this.VIntZ(k*3,this.vlist,this.nlist,33,f,a,C,g,v,w));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,k=c*this.size,l=a*this.size,o=Math.floor(i-h);o<1&&(o=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var r=Math.floor(k-h);r<1&&(r=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,q,m,u,w,p;o<i;o++){l=this.size2*o;q=o/this.size-g;w=q*q;for(q=r;q<k;q++){m=l+this.size*q;s=q/this.size-c;p=s*s;for(s=n;s<h;s++)u=s/this.size-a,u=e/(1.0E-6+u*u+p+w)-f,u>0&&(this.field[m+s]+=u)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,k=this.size,l=this.yd,o=this.zd,r=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++)r[o*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
|
|
|
-i,k,l=this.size,o=this.yd,r=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*o;for(g=0;g<l;g++){k=i+g;for(f=0;f<l;f++)n[r*f+k]+=h}}};this.addPlaneZ=function(a,c){var g,e,f,h,i,k,l=this.size,o=this.yd,r=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=r*f;for(e=0;e<l;e++){k=i+e*o;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,o,r=this.size-2;for(f=1;f<r;f++){o=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(e=1;e<r;e++){l=o+this.size*e;i=(e-this.halfsize)/this.halfsize;for(g=1;g<r;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,o,r,n;for(f=0;f<e.count;f++)r=f*3,l=r+1,n=r+2,h=e.positionArray[r],
|
|
|
-i=e.positionArray[l],k=e.positionArray[n],o=new THREE.Vector3(h,i,k),h=e.normalArray[r],i=e.normalArray[l],k=e.normalArray[n],r=new THREE.Vector3(h,i,k),r.normalize(),l=new THREE.Vertex(o),c.vertices.push(l),g.push(r);o=e.count/3;for(f=0;f<o;f++)r=(a+f)*3,l=r+1,n=r+2,h=g[r],i=g[l],k=g[n],r=new THREE.Face3(r,l,n,[h,i,k]),c.faces.push(r);a+=o;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,n=Math.floor(i-h);n<1&&(n=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var r=Math.floor(k-h);r<1&&(r=1);k=Math.floor(k+h);k>this.size-1&&(k=this.size-1);var m=Math.floor(l-h);m<1&&(m=1);h=Math.floor(l+h);
|
|
|
+h>this.size-1&&(h=this.size-1);for(var s,p,o,t,v,q;n<i;n++){l=this.size2*n;p=n/this.size-g;v=p*p;for(p=r;p<k;p++){o=l+this.size*p;s=p/this.size-c;q=s*s;for(s=m;s<h;s++)t=s/this.size-a,t=e/(1.0E-6+t*t+q+v)-f,t>0&&(this.field[o+s]+=t)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,k=this.size,l=this.yd,n=this.zd,r=this.field,m=k*Math.sqrt(a/c);m>k&&(m=k);for(g=0;g<m;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++)r[n*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
|
|
|
+i,k,l=this.size,n=this.yd,r=this.zd,m=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*n;for(g=0;g<l;g++){k=i+g;for(f=0;f<l;f++)m[r*f+k]+=h}}};this.addPlaneZ=function(a,c){var g,e,f,h,i,k,l=this.size,n=this.yd,r=this.zd,m=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=r*f;for(e=0;e<l;e++){k=i+e*n;for(g=0;g<l;g++)m[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,n,r=this.size-2;for(f=1;f<r;f++){n=this.size2*f;k=(f-this.halfsize)/this.halfsize;for(e=1;e<r;e++){l=n+this.size*e;i=(e-this.halfsize)/this.halfsize;for(g=1;g<r;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,n,r,m;for(f=0;f<e.count;f++)r=f*3,l=r+1,m=r+2,h=e.positionArray[r],
|
|
|
+i=e.positionArray[l],k=e.positionArray[m],n=new THREE.Vector3(h,i,k),h=e.normalArray[r],i=e.normalArray[l],k=e.normalArray[m],r=new THREE.Vector3(h,i,k),r.normalize(),l=new THREE.Vertex(n),c.vertices.push(l),g.push(r);n=e.count/3;for(f=0;f<n;f++)r=(a+f)*3,l=r+1,m=r+2,h=g[r],i=g[l],k=g[m],r=new THREE.Face3(r,l,m,[h,i,k]),c.faces.push(r);a+=n;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]);
|
|
@@ -707,9 +701,9 @@ d;if(b<c.min.z||b>c.max.z)return Number.MAX_VALUE;c.normal.set(0,h,0);break;case
|
|
|
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,k,l,o;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},r=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:r},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}"}),
|
|
|
-q=new THREE.Scene;q.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));q.add(s);this.setSize=function(a,d){b.call(c,a,d);r.width=a;r.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||o!==b.fov){i=b.aspect;k=b.near;l=b.far;o=b.fov;var w=b.projectionMatrix.clone(),p=125/30*0.5,z=p*k/125,C=k*Math.tan(o*Math.PI/360),x;f.n14=p;h.n14=-p;p=-C*i+z;x=C*i+z;w.n11=2*k/(x-p);w.n13=(x+p)/(x-p);g.projectionMatrix.copy(w);p=-C*i-z;x=C*i-z;w.n11=
|
|
|
-2*k/(x-p);w.n13=(x+p)/(x-p);e.projectionMatrix.copy(w)}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,r,!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);q.updateMatrixWorld();d.call(c,q,s)}};
|
|
|
+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,n;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},r=new THREE.WebGLRenderTarget(512,512,a),m=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:r},mapRight:{type:"t",value:1,texture:m}},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);r.width=a;r.height=d;m.width=a;m.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||k!==b.near||l!==b.far||n!==b.fov){i=b.aspect;k=b.near;l=b.far;n=b.fov;var v=b.projectionMatrix.clone(),q=125/30*0.5,A=q*k/125,D=k*Math.tan(n*Math.PI/360),w;f.n14=q;h.n14=-q;q=-D*i+A;w=D*i+A;v.n11=2*k/(w-q);v.n13=(w+q)/(w-q);g.projectionMatrix.copy(v);q=-D*i-A;w=D*i-A;v.n11=
|
|
|
+2*k/(w-q);v.n13=(w+q)/(w-q);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,r,!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,m,!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)}};
|