|
@@ -16,34 +16,34 @@ subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this}
|
|
|
setLength:function(b){return this.normalize().multiplyScalar(b)},lerpSelf:function(b,c){this.x+=(b.x-this.x)*c;this.y+=(b.y-this.y)*c;this.z+=(b.z-this.z)*c;this.w+=(b.w-this.w)*c;return this}};THREE.Ray=function(b,c){this.origin=b||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
|
THREE.Ray.prototype={constructor:THREE.Ray,intersectScene:function(b){return this.intersectObjects(b.objects)},intersectObjects:function(b){var c,e,f=[];c=0;for(e=b.length;c<e;c++)f=f.concat(this.intersectObject(b[c]));f.sort(function(b,c){return b.distance-c.distance});return f},intersectObject:function(b){function c(b,c,e){var f,e=e.matrixWorld.getPosition();f=e.clone().subSelf(b).dot(c);b=b.clone().addSelf(c.clone().multiplyScalar(f));return e.distanceTo(b)}function e(b,c,e,f){var f=f.clone().subSelf(c),
|
|
|
e=e.clone().subSelf(c),g=b.clone().subSelf(c),b=f.dot(f),c=f.dot(e),f=f.dot(g),h=e.dot(e),e=e.dot(g),g=1/(b*h-c*c),h=(h*f-c*e)*g,b=(b*e-c*f)*g;return h>0&&b>0&&h+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b);if(!f||f>b.scale.x)return[];return[{distance:f,point:b.position,face:null,object:b}]}else if(b instanceof THREE.Mesh){f=c(this.origin,this.direction,b);if(!f||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return[];var g,j,h,k,
|
|
|
-o,m,p,u,v,t,w=b.geometry,x=w.vertices,B=[],f=0;for(g=w.faces.length;f<g;f++)if(j=w.faces[f],v=this.origin.clone(),t=this.direction.clone(),m=b.matrixWorld,h=m.multiplyVector3(x[j.a].position.clone()),k=m.multiplyVector3(x[j.b].position.clone()),o=m.multiplyVector3(x[j.c].position.clone()),m=j instanceof THREE.Face4?m.multiplyVector3(x[j.d].position.clone()):null,p=b.matrixRotationWorld.multiplyVector3(j.normal.clone()),u=t.dot(p),b.doubleSided||(b.flipSided?u>0:u<0))if(p=p.dot((new THREE.Vector3).sub(h,
|
|
|
-v))/u,v=v.addSelf(t.multiplyScalar(p)),j instanceof THREE.Face3)e(v,h,k,o)&&(j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},B.push(j));else if(j instanceof THREE.Face4&&(e(v,h,k,m)||e(v,k,o,m)))j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},B.push(j);return B}else return[]}};
|
|
|
-THREE.Rectangle=function(){function b(){j=f-c;h=g-e}var c,e,f,g,j,h,k=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return j};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,j,p,u){k=!1;c=h;e=j;f=p;g=u;b()};this.addPoint=function(h,j){k?(k=!1,c=h,e=j,f=h,g=j):(c=c<h?c:h,e=e<j?e:j,f=f>h?f:h,g=g>j?g:j);b()};this.add3Points=
|
|
|
-function(h,j,p,u,v,t){k?(k=!1,c=h<p?h<v?h:v:p<v?p:v,e=j<u?j<t?j:t:u<t?u:t,f=h>p?h>v?h:v:p>v?p:v,g=j>u?j>t?j:t:u>t?u:t):(c=h<p?h<v?h<c?h:c:v<c?v:c:p<v?p<c?p:c:v<c?v:c,e=j<u?j<t?j<e?j:e:t<e?t:e:u<t?u<e?u:e:t<e?t:e,f=h>p?h>v?h>f?h:f:v>f?v:f:p>v?p>f?p:f:v>f?v:f,g=j>u?j>t?j>g?j:g:t>g?t:g:u>t?u>g?u:g:t>g?t:g);b()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
|
|
|
+p,t,o,u,v,n,w=b.geometry,x=w.vertices,B=[],f=0;for(g=w.faces.length;f<g;f++)if(j=w.faces[f],v=this.origin.clone(),n=this.direction.clone(),t=b.matrixWorld,h=t.multiplyVector3(x[j.a].position.clone()),k=t.multiplyVector3(x[j.b].position.clone()),p=t.multiplyVector3(x[j.c].position.clone()),t=j instanceof THREE.Face4?t.multiplyVector3(x[j.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(j.normal.clone()),u=n.dot(o),b.doubleSided||(b.flipSided?u>0:u<0))if(o=o.dot((new THREE.Vector3).sub(h,
|
|
|
+v))/u,v=v.addSelf(n.multiplyScalar(o)),j instanceof THREE.Face3)e(v,h,k,p)&&(j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},B.push(j));else if(j instanceof THREE.Face4&&(e(v,h,k,t)||e(v,k,p,t)))j={distance:this.origin.distanceTo(v),point:v,face:j,object:b},B.push(j);return B}else return[]}};
|
|
|
+THREE.Rectangle=function(){function b(){j=f-c;h=g-e}var c,e,f,g,j,h,k=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return j};this.getHeight=function(){return h};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return g};this.set=function(h,j,o,u){k=!1;c=h;e=j;f=o;g=u;b()};this.addPoint=function(h,j){k?(k=!1,c=h,e=j,f=h,g=j):(c=c<h?c:h,e=e<j?e:j,f=f>h?f:h,g=g>j?g:j);b()};this.add3Points=
|
|
|
+function(h,j,o,u,v,n){k?(k=!1,c=h<o?h<v?h:v:o<v?o:v,e=j<u?j<n?j:n:u<n?u:n,f=h>o?h>v?h:v:o>v?o:v,g=j>u?j>n?j:n:u>n?u:n):(c=h<o?h<v?h<c?h:c:v<c?v:c:o<v?o<c?o:c:v<c?v:c,e=j<u?j<n?j<e?j:e:n<e?n:e:u<n?u<e?u:e:n<e?n:e,f=h>o?h>v?h>f?h:f:v>f?v:f:o>v?o>f?o:f:v>f?v:f,g=j>u?j>n?j>g?j:g:n>g?n:g:u>n?u>g?u:g:n>g?n:g);b()};this.addRectangle=function(h){k?(k=!1,c=h.getLeft(),e=h.getTop(),f=h.getRight(),g=h.getBottom()):(c=c<h.getLeft()?c:h.getLeft(),e=e<h.getTop()?e:h.getTop(),f=f>h.getRight()?f:h.getRight(),g=g>
|
|
|
h.getBottom()?g:h.getBottom());b()};this.inflate=function(h){c-=h;e-=h;f+=h;g+=h;b()};this.minSelf=function(h){c=c>h.getLeft()?c:h.getLeft();e=e>h.getTop()?e:h.getTop();f=f<h.getRight()?f:h.getRight();g=g<h.getBottom()?g:h.getBottom();b()};this.instersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(g,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){k=!0;g=f=e=c=0;b()};this.isEmpty=function(){return k}};THREE.Matrix3=function(){this.m=[]};
|
|
|
-THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,j,h,k,o,m,p,u,v,t,w,x){this.set(b||1,c||0,e||0,f||0,g||0,j||1,h||0,k||0,o||0,m||0,p||1,u||0,v||0,t||0,w||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,g,j,h,k,o,m,p,u,v,t,w,x){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=j;this.n23=h;this.n24=k;this.n31=o;this.n32=m;this.n33=p;this.n34=u;this.n41=v;this.n42=t;this.n43=w;this.n44=x;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
|
|
|
+THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var b,c=this.m;b=c[1];c[1]=c[3];c[3]=b;b=c[2];c[2]=c[6];c[6]=b;b=c[5];c[5]=c[7];c[7]=b;return this},transposeIntoArray:function(b){var c=this.m;b[0]=c[0];b[1]=c[3];b[2]=c[6];b[3]=c[1];b[4]=c[4];b[5]=c[7];b[6]=c[2];b[7]=c[5];b[8]=c[8];return this}};THREE.Matrix4=function(b,c,e,f,g,j,h,k,p,t,o,u,v,n,w,x){this.set(b||1,c||0,e||0,f||0,g||0,j||1,h||0,k||0,p||0,t||0,o||1,u||0,v||0,n||0,w||0,x||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,g,j,h,k,p,t,o,u,v,n,w,x){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=g;this.n22=j;this.n23=h;this.n24=k;this.n31=p;this.n32=t;this.n33=o;this.n34=u;this.n41=v;this.n42=n;this.n43=w;this.n44=x;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(b){this.set(b.n11,b.n12,b.n13,b.n14,b.n21,b.n22,b.n23,b.n24,b.n31,b.n32,b.n33,b.n34,b.n41,b.n42,b.n43,b.n44);return this},lookAt:function(b,
|
|
|
c,e){var f=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,j=THREE.Matrix4.__v3;j.sub(b,c).normalize();if(j.length()===0)j.z=1;f.cross(e,j).normalize();f.length()===0&&(j.x+=1.0E-4,f.cross(e,j).normalize());g.cross(j,f).normalize();this.n11=f.x;this.n12=g.x;this.n13=j.x;this.n21=f.y;this.n22=g.y;this.n23=j.y;this.n31=f.z;this.n32=g.z;this.n33=j.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,g=1/(this.n41*c+this.n42*e+this.n43*f+this.n44);b.x=(this.n11*c+this.n12*e+this.n13*f+this.n14)*g;
|
|
|
b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*g;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*g;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,g=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*g;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*g;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*g;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*g;return b},rotateAxis:function(b){var c=b.x,e=b.y,f=b.z;b.x=c*this.n11+e*this.n12+f*this.n13;b.y=c*this.n21+e*this.n22+f*this.n23;b.z=c*this.n31+
|
|
|
-e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,k=b.n22,o=b.n23,m=b.n24,p=b.n31,u=b.n32,v=b.n33,t=b.n34,w=b.n41,x=b.n42,B=b.n43,A=b.n44,I=c.n11,z=c.n12,
|
|
|
-H=c.n13,G=c.n14,C=c.n21,O=c.n22,N=c.n23,D=c.n24,E=c.n31,U=c.n32,M=c.n33,L=c.n34,n=c.n41,S=c.n42,V=c.n43,X=c.n44;this.n11=e*I+f*C+g*E+j*n;this.n12=e*z+f*O+g*U+j*S;this.n13=e*H+f*N+g*M+j*V;this.n14=e*G+f*D+g*L+j*X;this.n21=h*I+k*C+o*E+m*n;this.n22=h*z+k*O+o*U+m*S;this.n23=h*H+k*N+o*M+m*V;this.n24=h*G+k*D+o*L+m*X;this.n31=p*I+u*C+v*E+t*n;this.n32=p*z+u*O+v*U+t*S;this.n33=p*H+u*N+v*M+t*V;this.n34=p*G+u*D+v*L+t*X;this.n41=w*I+x*C+B*E+A*n;this.n42=w*z+x*O+B*U+A*S;this.n43=w*H+x*N+B*M+A*V;this.n44=w*G+x*
|
|
|
-D+B*L+A*X;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=
|
|
|
-b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,j=this.n22,h=this.n23,k=this.n24,o=this.n31,m=this.n32,p=this.n33,u=this.n34,v=this.n41,t=this.n42,w=this.n43,x=this.n44;return f*h*m*v-e*k*m*v-f*j*p*v+c*k*p*v+e*j*u*v-c*h*u*v-f*h*o*t+e*k*o*t+f*g*p*t-b*k*p*t-e*g*u*t+b*h*u*t+f*j*o*w-c*k*o*w-f*g*m*w+b*k*m*w+c*g*u*w-b*j*u*w-e*j*o*x+c*h*o*x+e*g*m*x-b*h*m*x-c*g*p*x+b*j*p*x},
|
|
|
+e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,k=b.n22,p=b.n23,t=b.n24,o=b.n31,u=b.n32,v=b.n33,n=b.n34,w=b.n41,x=b.n42,B=b.n43,A=b.n44,F=c.n11,z=c.n12,
|
|
|
+G=c.n13,I=c.n14,C=c.n21,L=c.n22,D=c.n23,H=c.n24,T=c.n31,J=c.n32,K=c.n33,N=c.n34,m=c.n41,U=c.n42,V=c.n43,W=c.n44;this.n11=e*F+f*C+g*T+j*m;this.n12=e*z+f*L+g*J+j*U;this.n13=e*G+f*D+g*K+j*V;this.n14=e*I+f*H+g*N+j*W;this.n21=h*F+k*C+p*T+t*m;this.n22=h*z+k*L+p*J+t*U;this.n23=h*G+k*D+p*K+t*V;this.n24=h*I+k*H+p*N+t*W;this.n31=o*F+u*C+v*T+n*m;this.n32=o*z+u*L+v*J+n*U;this.n33=o*G+u*D+v*K+n*V;this.n34=o*I+u*H+v*N+n*W;this.n41=w*F+x*C+B*T+A*m;this.n42=w*z+x*L+B*J+A*U;this.n43=w*G+x*D+B*K+A*V;this.n44=w*I+x*
|
|
|
+H+B*N+A*W;return this},multiplyToArray:function(b,c,e){this.multiply(b,c);e[0]=this.n11;e[1]=this.n21;e[2]=this.n31;e[3]=this.n41;e[4]=this.n12;e[5]=this.n22;e[6]=this.n32;e[7]=this.n42;e[8]=this.n13;e[9]=this.n23;e[10]=this.n33;e[11]=this.n43;e[12]=this.n14;e[13]=this.n24;e[14]=this.n34;e[15]=this.n44;return this},multiplySelf:function(b){this.multiply(this,b);return this},multiplyScalar:function(b){this.n11*=b;this.n12*=b;this.n13*=b;this.n14*=b;this.n21*=b;this.n22*=b;this.n23*=b;this.n24*=b;this.n31*=
|
|
|
+b;this.n32*=b;this.n33*=b;this.n34*=b;this.n41*=b;this.n42*=b;this.n43*=b;this.n44*=b;return this},determinant:function(){var b=this.n11,c=this.n12,e=this.n13,f=this.n14,g=this.n21,j=this.n22,h=this.n23,k=this.n24,p=this.n31,t=this.n32,o=this.n33,u=this.n34,v=this.n41,n=this.n42,w=this.n43,x=this.n44;return f*h*t*v-e*k*t*v-f*j*o*v+c*k*o*v+e*j*u*v-c*h*u*v-f*h*p*n+e*k*p*n+f*g*o*n-b*k*o*n-e*g*u*n+b*h*u*n+f*j*p*w-c*k*p*w-f*g*t*w+b*k*t*w+c*g*u*w-b*j*u*w-e*j*p*x+c*h*p*x+e*g*t*x-b*h*t*x-c*g*o*x+b*j*o*x},
|
|
|
transpose:function(){var b;b=this.n21;this.n21=this.n12;this.n12=b;b=this.n31;this.n31=this.n13;this.n13=b;b=this.n32;this.n32=this.n23;this.n23=b;b=this.n41;this.n41=this.n14;this.n14=b;b=this.n42;this.n42=this.n24;this.n24=b;b=this.n43;this.n43=this.n34;this.n43=b;return this},clone:function(){var b=new THREE.Matrix4;b.n11=this.n11;b.n12=this.n12;b.n13=this.n13;b.n14=this.n14;b.n21=this.n21;b.n22=this.n22;b.n23=this.n23;b.n24=this.n24;b.n31=this.n31;b.n32=this.n32;b.n33=this.n33;b.n34=this.n34;
|
|
|
b.n41=this.n41;b.n42=this.n42;b.n43=this.n43;b.n44=this.n44;return b},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(b){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 b},flattenToArrayOffset:function(b,c){b[c]=this.n11;b[c+1]=this.n21;b[c+2]=this.n31;b[c+3]=this.n41;b[c+4]=this.n12;b[c+5]=this.n22;b[c+6]=this.n32;b[c+7]=this.n42;b[c+8]=this.n13;b[c+9]=this.n23;b[c+10]=this.n33;b[c+11]=this.n43;b[c+12]=this.n14;b[c+13]=this.n24;b[c+14]=this.n34;
|
|
|
b[c+15]=this.n44;return b},setTranslation:function(b,c,e){this.set(1,0,0,b,0,1,0,c,0,0,1,e,0,0,0,1);return this},setScale:function(b,c,e){this.set(b,0,0,0,0,c,0,0,0,0,e,0,0,0,0,1);return this},setRotationX:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(1,0,0,0,0,c,-b,0,0,b,c,0,0,0,0,1);return this},setRotationY:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,0,b,0,0,1,0,0,-b,0,c,0,0,0,0,1);return this},setRotationZ:function(b){var c=Math.cos(b),b=Math.sin(b);this.set(c,-b,0,0,b,c,0,0,
|
|
|
-0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),g=1-e,j=b.x,h=b.y,k=b.z,o=g*j,m=g*h;this.set(o*j+e,o*h-f*k,o*k+f*h,0,o*h+f*k,m*h+e,m*k-f*j,0,o*k-f*h,m*k+f*j,g*k*k+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
|
|
|
-new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,j=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),k=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var o=
|
|
|
-h*k,m=h*g,p=f*k,u=f*g;this.n11=o+u*e;this.n12=p*e-m;this.n13=j*f;this.n21=j*g;this.n22=j*k;this.n23=-e;this.n31=m*e-p;this.n32=u+o*e;this.n33=j*h;break;case "ZXY":o=h*k;m=h*g;p=f*k;u=f*g;this.n11=o-u*e;this.n12=-j*g;this.n13=p+m*e;this.n21=m+p*e;this.n22=j*k;this.n23=u-o*e;this.n31=-j*f;this.n32=e;this.n33=j*h;break;case "ZYX":o=j*k;m=j*g;p=e*k;u=e*g;this.n11=h*k;this.n12=p*f-m;this.n13=o*f+u;this.n21=h*g;this.n22=u*f+o;this.n23=m*f-p;this.n31=-f;this.n32=e*h;this.n33=j*h;break;case "YZX":o=j*h;m=
|
|
|
-j*f;p=e*h;u=e*f;this.n11=h*k;this.n12=u-o*g;this.n13=p*g+m;this.n21=g;this.n22=j*k;this.n23=-e*k;this.n31=-f*k;this.n32=m*g+p;this.n33=o-u*g;break;case "XZY":o=j*h;m=j*f;p=e*h;u=e*f;this.n11=h*k;this.n12=-g;this.n13=f*k;this.n21=o*g+u;this.n22=j*k;this.n23=m*g-p;this.n31=p*g-m;this.n32=e*k;this.n33=u*g+o;break;default:o=j*k,m=j*g,p=e*k,u=e*g,this.n11=h*k,this.n12=-h*g,this.n13=f,this.n21=m+p*f,this.n22=o-u*f,this.n23=-e*h,this.n31=u-o*f,this.n32=p+m*f,this.n33=j*h}return this},setRotationFromQuaternion:function(b){var c=
|
|
|
-b.x,e=b.y,f=b.z,g=b.w,j=c+c,h=e+e,k=f+f,b=c*j,o=c*h;c*=k;var m=e*h;e*=k;f*=k;j*=g;h*=g;g*=k;this.n11=1-(m+f);this.n12=o-g;this.n13=c+h;this.n21=o+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-h;this.n32=e+j;this.n33=1-(b+m);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},
|
|
|
+0,0,1,0,0,0,0,1);return this},setRotationAxis:function(b,c){var e=Math.cos(c),f=Math.sin(c),g=1-e,j=b.x,h=b.y,k=b.z,p=g*j,t=g*h;this.set(p*j+e,p*h-f*k,p*k+f*h,0,p*h+f*k,t*h+e,t*k-f*j,0,p*k-f*h,t*k+f*j,g*k*k+e,0,0,0,0,1);return this},setPosition:function(b){this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},getPosition:function(){if(!this.position)this.position=new THREE.Vector3;this.position.set(this.n14,this.n24,this.n34);return this.position},getColumnX:function(){if(!this.columnX)this.columnX=
|
|
|
+new THREE.Vector3;this.columnX.set(this.n11,this.n21,this.n31);return this.columnX},getColumnY:function(){if(!this.columnY)this.columnY=new THREE.Vector3;this.columnY.set(this.n12,this.n22,this.n32);return this.columnY},getColumnZ:function(){if(!this.columnZ)this.columnZ=new THREE.Vector3;this.columnZ.set(this.n13,this.n23,this.n33);return this.columnZ},setRotationFromEuler:function(b,c){var e=b.x,f=b.y,g=b.z,j=Math.cos(e),e=Math.sin(e),h=Math.cos(f),f=Math.sin(f),k=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var p=
|
|
|
+h*k,t=h*g,o=f*k,u=f*g;this.n11=p+u*e;this.n12=o*e-t;this.n13=j*f;this.n21=j*g;this.n22=j*k;this.n23=-e;this.n31=t*e-o;this.n32=u+p*e;this.n33=j*h;break;case "ZXY":p=h*k;t=h*g;o=f*k;u=f*g;this.n11=p-u*e;this.n12=-j*g;this.n13=o+t*e;this.n21=t+o*e;this.n22=j*k;this.n23=u-p*e;this.n31=-j*f;this.n32=e;this.n33=j*h;break;case "ZYX":p=j*k;t=j*g;o=e*k;u=e*g;this.n11=h*k;this.n12=o*f-t;this.n13=p*f+u;this.n21=h*g;this.n22=u*f+p;this.n23=t*f-o;this.n31=-f;this.n32=e*h;this.n33=j*h;break;case "YZX":p=j*h;t=
|
|
|
+j*f;o=e*h;u=e*f;this.n11=h*k;this.n12=u-p*g;this.n13=o*g+t;this.n21=g;this.n22=j*k;this.n23=-e*k;this.n31=-f*k;this.n32=t*g+o;this.n33=p-u*g;break;case "XZY":p=j*h;t=j*f;o=e*h;u=e*f;this.n11=h*k;this.n12=-g;this.n13=f*k;this.n21=p*g+u;this.n22=j*k;this.n23=t*g-o;this.n31=o*g-t;this.n32=e*k;this.n33=u*g+p;break;default:p=j*k,t=j*g,o=e*k,u=e*g,this.n11=h*k,this.n12=-h*g,this.n13=f,this.n21=t+o*f,this.n22=p-u*f,this.n23=-e*h,this.n31=u-p*f,this.n32=o+t*f,this.n33=j*h}return this},setRotationFromQuaternion:function(b){var c=
|
|
|
+b.x,e=b.y,f=b.z,g=b.w,j=c+c,h=e+e,k=f+f,b=c*j,p=c*h;c*=k;var t=e*h;e*=k;f*=k;j*=g;h*=g;g*=k;this.n11=1-(t+f);this.n12=p-g;this.n13=c+h;this.n21=p+g;this.n22=1-(b+f);this.n23=e-j;this.n31=c-h;this.n32=e+j;this.n33=1-(b+t);return this},scale:function(b){var c=b.x,e=b.y,b=b.z;this.n11*=c;this.n12*=e;this.n13*=b;this.n21*=c;this.n22*=e;this.n23*=b;this.n31*=c;this.n32*=e;this.n33*=b;this.n41*=c;this.n42*=e;this.n43*=b;return this},extractPosition:function(b){this.n14=b.n14;this.n24=b.n24;this.n34=b.n34},
|
|
|
extractRotation:function(b,c){var e=1/c.x,f=1/c.y,g=1/c.z;this.n11=b.n11*e;this.n21=b.n21*e;this.n31=b.n31*e;this.n12=b.n12*f;this.n22=b.n22*f;this.n32=b.n32*f;this.n13=b.n13*g;this.n23=b.n23*g;this.n33=b.n33*g}};
|
|
|
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,k=b.n22,o=b.n23,m=b.n24,p=b.n31,u=b.n32,v=b.n33,t=b.n34,w=b.n41,x=b.n42,B=b.n43,A=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=o*t*x-m*v*x+m*u*B-k*t*B-o*u*A+k*v*A;c.n12=j*v*x-g*t*x-j*u*B+f*t*B+g*u*A-f*v*A;c.n13=g*m*x-j*o*x+j*k*B-f*m*B-g*k*A+f*o*A;c.n14=j*o*u-g*m*u-j*k*v+f*m*v+g*k*t-f*o*t;c.n21=m*v*w-o*t*w-m*p*B+h*t*B+o*p*A-h*v*A;c.n22=g*t*w-j*v*w+j*p*B-e*t*B-g*p*A+e*v*A;c.n23=j*o*w-g*m*w-j*h*B+e*m*B+g*h*A-e*o*A;c.n24=
|
|
|
-g*m*p-j*o*p+j*h*v-e*m*v-g*h*t+e*o*t;c.n31=k*t*w-m*u*w+m*p*x-h*t*x-k*p*A+h*u*A;c.n32=j*u*w-f*t*w-j*p*x+e*t*x+f*p*A-e*u*A;c.n33=g*m*w-j*k*w+j*h*x-e*m*x-f*h*A+e*k*A;c.n34=j*k*p-f*m*p-j*h*u+e*m*u+f*h*t-e*k*t;c.n41=o*u*w-k*v*w-o*p*x+h*v*x+k*p*B-h*u*B;c.n42=f*v*w-g*u*w+g*p*x-e*v*x-f*p*B+e*u*B;c.n43=g*k*w-f*o*w-g*h*x+e*o*x+f*h*B-e*k*B;c.n44=f*o*p-g*k*p+g*h*u-e*o*u-f*h*v+e*k*v;c.multiplyScalar(1/b.determinant());return c};
|
|
|
-THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,o=-b.n32*b.n11+b.n31*b.n12,m=b.n23*b.n12-b.n22*b.n13,p=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*m;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*j;e[3]=b*h;e[4]=b*k;e[5]=b*o;e[6]=b*m;e[7]=b*p;e[8]=b*u;return c};
|
|
|
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,g=b.n13,j=b.n14,h=b.n21,k=b.n22,p=b.n23,t=b.n24,o=b.n31,u=b.n32,v=b.n33,n=b.n34,w=b.n41,x=b.n42,B=b.n43,A=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*n*x-t*v*x+t*u*B-k*n*B-p*u*A+k*v*A;c.n12=j*v*x-g*n*x-j*u*B+f*n*B+g*u*A-f*v*A;c.n13=g*t*x-j*p*x+j*k*B-f*t*B-g*k*A+f*p*A;c.n14=j*p*u-g*t*u-j*k*v+f*t*v+g*k*n-f*p*n;c.n21=t*v*w-p*n*w-t*o*B+h*n*B+p*o*A-h*v*A;c.n22=g*n*w-j*v*w+j*o*B-e*n*B-g*o*A+e*v*A;c.n23=j*p*w-g*t*w-j*h*B+e*t*B+g*h*A-e*p*A;c.n24=
|
|
|
+g*t*o-j*p*o+j*h*v-e*t*v-g*h*n+e*p*n;c.n31=k*n*w-t*u*w+t*o*x-h*n*x-k*o*A+h*u*A;c.n32=j*u*w-f*n*w-j*o*x+e*n*x+f*o*A-e*u*A;c.n33=g*t*w-j*k*w+j*h*x-e*t*x-f*h*A+e*k*A;c.n34=j*k*o-f*t*o-j*h*u+e*t*u+f*h*n-e*k*n;c.n41=p*u*w-k*v*w-p*o*x+h*v*x+k*o*B-h*u*B;c.n42=f*v*w-g*u*w+g*o*x-e*v*x-f*o*B+e*u*B;c.n43=g*k*w-f*p*w-g*h*x+e*p*x+f*h*B-e*k*B;c.n44=f*p*o-g*k*o+g*h*u-e*p*u-f*h*v+e*k*v;c.multiplyScalar(1/b.determinant());return c};
|
|
|
+THREE.Matrix4.makeInvert3x3=function(b){var c=b.m33,e=c.m,f=b.n33*b.n22-b.n32*b.n23,g=-b.n33*b.n21+b.n31*b.n23,j=b.n32*b.n21-b.n31*b.n22,h=-b.n33*b.n12+b.n32*b.n13,k=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,t=b.n23*b.n12-b.n22*b.n13,o=-b.n23*b.n11+b.n21*b.n13,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*h+b.n31*t;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*g;e[2]=b*j;e[3]=b*h;e[4]=b*k;e[5]=b*p;e[6]=b*t;e[7]=b*o;e[8]=b*u;return c};
|
|
|
THREE.Matrix4.makeFrustum=function(b,c,e,f,g,j){var h;h=new THREE.Matrix4;h.n11=2*g/(c-b);h.n12=0;h.n13=(c+b)/(c-b);h.n14=0;h.n21=0;h.n22=2*g/(f-e);h.n23=(f+e)/(f-e);h.n24=0;h.n31=0;h.n32=0;h.n33=-(j+g)/(j-g);h.n34=-2*j*g/(j-g);h.n41=0;h.n42=0;h.n43=-1;h.n44=0;return h};THREE.Matrix4.makePerspective=function(b,c,e,f){var g,b=e*Math.tan(b*Math.PI/360);g=-b;return THREE.Matrix4.makeFrustum(g*c,b*c,g,b,e,f)};
|
|
|
-THREE.Matrix4.makeOrtho=function(b,c,e,f,g,j){var h,k,o,m;h=new THREE.Matrix4;k=c-b;o=e-f;m=j-g;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((c+b)/k);h.n21=0;h.n22=2/o;h.n23=0;h.n24=-((e+f)/o);h.n31=0;h.n32=0;h.n33=-2/m;h.n34=-((j+g)/m);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
+THREE.Matrix4.makeOrtho=function(b,c,e,f,g,j){var h,k,p,t;h=new THREE.Matrix4;k=c-b;p=e-f;t=j-g;h.n11=2/k;h.n12=0;h.n13=0;h.n14=-((c+b)/k);h.n21=0;h.n22=2/p;h.n23=0;h.n24=-((e+f)/p);h.n31=0;h.n32=0;h.n33=-2/t;h.n34=-((j+g)/t);h.n41=0;h.n42=0;h.n43=0;h.n44=1;return h};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;
|
|
|
THREE.Object3D=function(){this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;
|
|
|
this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this._vector=new THREE.Vector3;this.name=""};
|
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(b){if(this.children.indexOf(b)===
|
|
@@ -53,26 +53,26 @@ this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matri
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(b,c,e,f){this.x=b;this.y=c;this.z=e;this.w=f;return this},copy:function(b){this.x=b.x;this.y=b.y;this.z=b.z;this.w=b.w;return this},setFromEuler:function(b){var c=0.5*Math.PI/360,e=b.x*c,f=b.y*c,g=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-g),g=Math.sin(-g),j=Math.cos(e),e=Math.sin(e),h=b*c,k=f*g;this.w=h*j-k*e;this.x=h*e+k*j;this.y=f*c*j+b*g*e;this.z=b*g*j-f*c*e;return this},setFromAxisAngle:function(b,c){var e=c/2,f=Math.sin(e);
|
|
|
this.x=b.x*f;this.y=b.y*f;this.z=b.z*f;this.w=Math.cos(e);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 b=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);b==0?this.w=this.z=this.y=this.x=0:(b=1/b,this.x*=b,this.y*=b,this.z*=
|
|
|
b,this.w*=b);return this},multiplySelf:function(b){var c=this.x,e=this.y,f=this.z,g=this.w,j=b.x,h=b.y,k=b.z,b=b.w;this.x=c*b+g*j+e*k-f*h;this.y=e*b+g*h+f*j-c*k;this.z=f*b+g*k+c*h-e*j;this.w=g*b-c*j-e*h-f*k;return this},multiply:function(b,c){this.x=b.x*c.w+b.y*c.z-b.z*c.y+b.w*c.x;this.y=-b.x*c.z+b.y*c.w+b.z*c.x+b.w*c.y;this.z=b.x*c.y-b.y*c.x+b.z*c.w+b.w*c.z;this.w=-b.x*c.x-b.y*c.y-b.z*c.z+b.w*c.w;return this},multiplyVector3:function(b,c){c||(c=b);var e=b.x,f=b.y,g=b.z,j=this.x,h=this.y,k=this.z,
|
|
|
-o=this.w,m=o*e+h*g-k*f,p=o*f+k*e-j*g,u=o*g+j*f-h*e,e=-j*e-h*f-k*g;c.x=m*o+e*-j+p*-k-u*-h;c.y=p*o+e*-h+u*-j-m*-k;c.z=u*o+e*-k+m*-h-p*-j;return c}};
|
|
|
+p=this.w,t=p*e+h*g-k*f,o=p*f+k*e-j*g,u=p*g+j*f-h*e,e=-j*e-h*f-k*g;c.x=t*p+e*-j+o*-k-u*-h;c.y=o*p+e*-h+u*-j-t*-k;c.z=u*p+e*-k+t*-h-o*-j;return c}};
|
|
|
THREE.Quaternion.slerp=function(b,c,e,f){var g=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(g)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var j=Math.acos(g),h=Math.sqrt(1-g*g);if(Math.abs(h)<0.0010)return e.w=0.5*(b.w+c.w),e.x=0.5*(b.x+c.x),e.y=0.5*(b.y+c.y),e.z=0.5*(b.z+c.z),e;g=Math.sin((1-f)*j)/h;f=Math.sin(f*j)/h;e.w=b.w*g+c.w*f;e.x=b.x*g+c.x*f;e.y=b.y*g+c.y*f;e.z=b.z*g+c.z*f;return e};THREE.Vertex=function(b){this.position=b||new THREE.Vector3};
|
|
|
THREE.Face3=function(b,c,e,f,g,j){this.a=b;this.b=c;this.c=e;this.normal=f instanceof THREE.Vector3?f:new THREE.Vector3;this.vertexNormals=f instanceof Array?f:[];this.color=g instanceof THREE.Color?g:new THREE.Color;this.vertexColors=g instanceof Array?g:[];this.vertexTangents=[];this.materials=j instanceof Array?j:[j];this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(b,c,e,f,g,j,h){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=g instanceof THREE.Vector3?g:new THREE.Vector3;this.vertexNormals=g instanceof Array?g:[];this.color=j instanceof THREE.Color?j:new THREE.Color;this.vertexColors=j instanceof Array?j:[];this.vertexTangents=[];this.materials=h instanceof Array?h:[h];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.set(b||0,c||0)};
|
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.set(b.u,b.v);return this}};THREE.Geometry=function(){this.id="Geometry"+THREE.GeometryIdCounter++;this.vertices=[];this.colors=[];this.faces=[];this.edges=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
|
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),
|
|
|
-e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,j,h,k=new THREE.Vector3,o=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];if(b&&j.vertexNormals.length){k.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)k.addSelf(j.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],h=this.vertices[j.c],k.sub(h.position,e.position),o.sub(c.position,e.position),k.crossSelf(o);k.isZero()||
|
|
|
+e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,e,f,g,j,h,k=new THREE.Vector3,p=new THREE.Vector3;f=0;for(g=this.faces.length;f<g;f++){j=this.faces[f];if(b&&j.vertexNormals.length){k.set(0,0,0);c=0;for(e=j.vertexNormals.length;c<e;c++)k.addSelf(j.vertexNormals[c]);k.divideScalar(3)}else c=this.vertices[j.a],e=this.vertices[j.b],h=this.vertices[j.c],k.sub(h.position,e.position),p.sub(c.position,e.position),k.crossSelf(p);k.isZero()||
|
|
|
k.normalize();j.normal.copy(k)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=Array(this.vertices.length);b=0;for(c=this.vertices.length;b<c;b++)f[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)if(e=this.faces[b],e instanceof THREE.Face3)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(e instanceof THREE.Face4)e.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{f=
|
|
|
this.__tmpVertices;b=0;for(c=this.vertices.length;b<c;b++)f[b].set(0,0,0)}b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),
|
|
|
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,e,f,g,j,n){k=b.vertices[c].position;o=b.vertices[e].position;m=b.vertices[f].position;p=h[g];u=h[j];v=h[n];t=o.x-k.x;w=m.x-k.x;x=o.y-k.y;B=m.y-k.y;A=o.z-k.z;I=m.z-k.z;z=u.u-p.u;H=v.u-p.u;G=u.v-p.v;C=v.v-p.v;O=1/(z*C-H*G);U.set((C*t-G*w)*
|
|
|
-O,(C*x-G*B)*O,(C*A-G*I)*O);M.set((z*w-H*t)*O,(z*B-H*x)*O,(z*I-H*A)*O);D[c].addSelf(U);D[e].addSelf(U);D[f].addSelf(U);E[c].addSelf(M);E[e].addSelf(M);E[f].addSelf(M)}var c,e,f,g,j,h,k,o,m,p,u,v,t,w,x,B,A,I,z,H,G,C,O,N,D=[],E=[],U=new THREE.Vector3,M=new THREE.Vector3,L=new THREE.Vector3,n=new THREE.Vector3,S=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)D[c]=new THREE.Vector3,E[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],h=this.faceVertexUvs[0][c],j instanceof
|
|
|
-THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var V=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)S.copy(j.vertexNormals[f]),g=j[V[f]],N=D[g],L.copy(N),L.subSelf(S.multiplyScalar(S.dot(N))).normalize(),n.cross(j.vertexNormals[f],N),g=n.dot(E[g]),g=g<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(L.x,L.y,L.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
|
|
|
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,e,f,g,j,m){k=b.vertices[c].position;p=b.vertices[e].position;t=b.vertices[f].position;o=h[g];u=h[j];v=h[m];n=p.x-k.x;w=t.x-k.x;x=p.y-k.y;B=t.y-k.y;A=p.z-k.z;F=t.z-k.z;z=u.u-o.u;G=v.u-o.u;I=u.v-o.v;C=v.v-o.v;L=1/(z*C-G*I);J.set((C*n-I*w)*
|
|
|
+L,(C*x-I*B)*L,(C*A-I*F)*L);K.set((z*w-G*n)*L,(z*B-G*x)*L,(z*F-G*A)*L);H[c].addSelf(J);H[e].addSelf(J);H[f].addSelf(J);T[c].addSelf(K);T[e].addSelf(K);T[f].addSelf(K)}var c,e,f,g,j,h,k,p,t,o,u,v,n,w,x,B,A,F,z,G,I,C,L,D,H=[],T=[],J=new THREE.Vector3,K=new THREE.Vector3,N=new THREE.Vector3,m=new THREE.Vector3,U=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)H[c]=new THREE.Vector3,T[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)j=this.faces[c],h=this.faceVertexUvs[0][c],j instanceof
|
|
|
+THREE.Face3?b(this,j.a,j.b,j.c,0,1,2):j instanceof THREE.Face4&&(b(this,j.a,j.b,j.c,0,1,2),b(this,j.a,j.b,j.d,0,1,3));var V=["a","b","c","d"];c=0;for(e=this.faces.length;c<e;c++){j=this.faces[c];for(f=0;f<j.vertexNormals.length;f++)U.copy(j.vertexNormals[f]),g=j[V[f]],D=H[g],N.copy(D),N.subSelf(U.multiplyScalar(U.dot(D))).normalize(),m.cross(j.vertexNormals[f],D),g=m.dot(T[g]),g=g<0?-1:1,j.vertexTangents[f]=new THREE.Vector4(N.x,N.y,N.z,g)}this.hasTangents=!0},computeBoundingBox:function(){var b;
|
|
|
if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,e=this.vertices.length;c<e;c++){b=this.vertices[c];if(b.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=b.position.x;else if(b.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=b.position.x;if(b.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=b.position.y;
|
|
|
else if(b.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=b.position.y;if(b.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=b.position.z;else if(b.position.z>this.boundingBox.z[1])this.boundingBox.z[1]=b.position.z}}},computeBoundingSphere:function(){for(var b=0,c=0,e=this.vertices.length;c<e;c++)b=Math.max(b,this.vertices[c].position.length());this.boundingSphere={radius:b}},computeEdgeFaces:function(){function b(b,c){return Math.min(b,c)+"_"+Math.max(b,c)}function c(b,c,e){b[c]===
|
|
|
void 0?(b[c]={set:{},array:[]},b[c].set[e]=1,b[c].array.push(e)):b[c].set[e]===void 0&&(b[c].set[e]=1,b[c].array.push(e))}var e,f,g,j,h,k={};e=0;for(f=this.faces.length;e<f;e++)h=this.faces[e],h instanceof THREE.Face3?(g=b(h.a,h.b),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.a,h.c),c(k,g,e)):h instanceof THREE.Face4&&(g=b(h.b,h.d),c(k,g,e),g=b(h.a,h.b),c(k,g,e),g=b(h.a,h.d),c(k,g,e),g=b(h.b,h.c),c(k,g,e),g=b(h.c,h.d),c(k,g,e));e=0;for(f=this.edges.length;e<f;e++){h=this.edges[e];g=h.vertexIndices[0];j=h.vertexIndices[1];
|
|
|
h.faceIndices=k[b(g,j)].array;for(g=0;g<h.faceIndices.length;g++)j=h.faceIndices[g],h.faces.push(this.faces[j])}}};THREE.GeometryIdCounter=0;
|
|
|
-THREE.Spline=function(b){function c(b,c,e,f,h,g,j){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*j+(-3*(c-e)-2*b-f)*g+b*h+c}this.points=b;var e=[],f={x:0,y:0,z:0},g,j,h,k,o,m,p,u,v;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;j=Math.floor(g);h=g-j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>this.points.length-2?j:j+1;e[3]=j>this.points.length-3?j:j+2;m=this.points[e[0]];p=this.points[e[1]];
|
|
|
-u=this.points[e[2]];v=this.points[e[3]];k=h*h;o=h*k;f.x=c(m.x,p.x,u.x,v.x,h,k,o);f.y=c(m.y,p.y,u.y,v.y,h,k,o);f.z=c(m.z,p.z,u.z,v.z,h,k,o);return f};this.getControlPointsArray=function(){var b,c,e=this.points.length,f=[];for(b=0;b<e;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,e,f=c=c=0,h=new THREE.Vector3,g=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);e=this.points.length*b;h.copy(this.points[0]);for(b=1;b<e;b++)c=b/e,position=this.getPoint(c),g.copy(position),
|
|
|
-k+=g.distanceTo(h),h.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(j[c]=k,f=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,e,f,h,g,j,k=[],o=new THREE.Vector3,u=this.getLength();k.push(o.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){e=u.chunks[c]-u.chunks[c-1];j=Math.ceil(b*e/u.total);h=(c-1)/(this.points.length-1);g=c/(this.points.length-1);for(e=1;e<j-1;e++)f=h+e*(1/j)*(g-h),position=this.getPoint(f),k.push(o.copy(position).clone());
|
|
|
-k.push(o.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
|
|
|
+THREE.Spline=function(b){function c(b,c,e,f,h,g,j){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*j+(-3*(c-e)-2*b-f)*g+b*h+c}this.points=b;var e=[],f={x:0,y:0,z:0},g,j,h,k,p,t,o,u,v;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){g=(this.points.length-1)*b;j=Math.floor(g);h=g-j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>this.points.length-2?j:j+1;e[3]=j>this.points.length-3?j:j+2;t=this.points[e[0]];o=this.points[e[1]];
|
|
|
+u=this.points[e[2]];v=this.points[e[3]];k=h*h;p=h*k;f.x=c(t.x,o.x,u.x,v.x,h,k,p);f.y=c(t.y,o.y,u.y,v.y,h,k,p);f.z=c(t.z,o.z,u.z,v.z,h,k,p);return f};this.getControlPointsArray=function(){var b,c,e=this.points.length,f=[];for(b=0;b<e;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,e,f=c=c=0,h=new THREE.Vector3,g=new THREE.Vector3,j=[],k=0;j[0]=0;b||(b=100);e=this.points.length*b;h.copy(this.points[0]);for(b=1;b<e;b++)c=b/e,position=this.getPoint(c),g.copy(position),
|
|
|
+k+=g.distanceTo(h),h.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(j[c]=k,f=c);j[j.length]=k;return{chunks:j,total:k}};this.reparametrizeByArcLength=function(b){var c,e,f,h,g,j,k=[],p=new THREE.Vector3,t=this.getLength();k.push(p.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){e=t.chunks[c]-t.chunks[c-1];j=Math.ceil(b*e/t.total);h=(c-1)/(this.points.length-1);g=c/(this.points.length-1);for(e=1;e<j-1;e++)f=h+e*(1/j)*(g-h),position=this.getPoint(f),k.push(p.copy(position).clone());
|
|
|
+k.push(p.copy(this.points[c]).clone())}this.points=k}};THREE.Edge=function(b,c,e,f){this.vertices=[b,c];this.vertexIndices=[e,f];this.faces=[];this.faceIndices=[]};THREE.Camera=function(b,c,e,f,g){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=g||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;
|
|
|
THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);c.multiplyScalar(b);this.position.addSelf(c);this.target.position.addSelf(c)};
|
|
|
THREE.Camera.prototype.updateProjectionMatrix=function(){if(this.fullWidth){var b=this.fullWidth/this.fullHeight,c=Math.tan(this.fov*Math.PI/360)*this.near,e=-c,f=b*e,b=Math.abs(b*c-f),e=Math.abs(c-e);this.projectionMatrix=THREE.Matrix4.makeFrustum(f+this.x*b/this.fullWidth,f+(this.x+this.width)*b/this.fullWidth,c-(this.y+this.height)*e/this.fullHeight,c-this.y*e/this.fullHeight,this.near,this.far)}else this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
THREE.Camera.prototype.setViewOffset=function(b,c,e,f,g,j){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=g;this.height=j;this.updateProjectionMatrix()};
|
|
@@ -101,7 +101,7 @@ THREE.ParticleBasicMaterial=function(b){THREE.Material.call(this,b);b=b||{};this
|
|
|
THREE.ParticleCanvasMaterial=function(b){THREE.Material.call(this,b);b=b||{};this.color=b.color!==void 0?new THREE.Color(b.color):new THREE.Color(16777215);this.program=b.program!==void 0?b.program:function(){}};THREE.ParticleCanvasMaterial.prototype=new THREE.Material;THREE.ParticleCanvasMaterial.prototype.constructor=THREE.ParticleCanvasMaterial;THREE.ParticleDOMMaterial=function(b){THREE.Material.call(this);this.domElement=b};
|
|
|
THREE.Texture=function(b,c,e,f,g,j){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=g!==void 0?g:THREE.LinearFilter;this.minFilter=j!==void 0?j:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
|
THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;
|
|
|
-THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,e,f,g,j,h,k,o){THREE.Texture.call(this,null,g,j,h,k,o);this.image={data:b,width:c,height:e};this.format=f!==void 0?f:THREE.RGBAFormat};
|
|
|
+THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,e,f,g,j,h,k,p){THREE.Texture.call(this,null,g,j,h,k,p);this.image={data:b,width:c,height:e};this.format=f!==void 0?f:THREE.RGBAFormat};
|
|
|
THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;THREE.DataTexture.prototype={clone:function(){var b=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;
|
|
|
THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,e){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
|
|
THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;
|
|
@@ -127,58 +127,58 @@ THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.c
|
|
|
THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)this.lights.indexOf(b)===-1&&this.lights.push(b);else if(!(b instanceof THREE.Camera||b instanceof THREE.Bone)&&this.objects.indexOf(b)===-1)this.objects.push(b),this.__objectsAdded.push(b);for(var c=0;c<b.children.length;c++)this.addChildRecurse(b.children[c])};THREE.Scene.prototype.removeChild=function(b){this.supr.removeChild.call(this,b);this.removeChildRecurse(b)};
|
|
|
THREE.Scene.prototype.removeChildRecurse=function(b){if(b instanceof THREE.Light){var c=this.lights.indexOf(b);c!==-1&&this.lights.splice(c,1)}else b instanceof THREE.Camera||(c=this.objects.indexOf(b),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(b)));for(c=0;c<b.children.length;c++)this.removeChildRecurse(b.children[c])};THREE.Scene.prototype.addObject=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeObject=THREE.Scene.prototype.removeChild;
|
|
|
THREE.Scene.prototype.addLight=THREE.Scene.prototype.addChild;THREE.Scene.prototype.removeLight=THREE.Scene.prototype.removeChild;THREE.Fog=function(b,c,e){this.color=new THREE.Color(b);this.near=c||1;this.far=e||1E3};THREE.FogExp2=function(b,c){this.color=new THREE.Color(b);this.density=c!==void 0?c:2.5E-4};
|
|
|
-THREE.Projector=function(){function b(){var b=o[k]=o[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,h=b.z+b.w,g=c.z+c.w,j=-b.z+b.w,k=-c.z+c.w;return h>=0&&g>=0&&j>=0&&k>=0?!0:h<0&&g<0||j<0&&k<0?!1:(h<0?e=Math.max(e,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),j<0?e=Math.max(e,j/(j-k)):k<0&&(f=Math.min(f,j/(j-k))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,g,j=[],h,k,o=[],m,p,u=[],v,t=[],w,x,B=[],A,I,z=[],H=new THREE.Vector4,G=new THREE.Vector4,
|
|
|
-C=new THREE.Matrix4,O=new THREE.Matrix4,N=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,E=new THREE.Vector4;this.projectVector=function(b,c){C.multiply(c.projectionMatrix,c.matrixWorldInverse);C.multiplyVector3(b);return b};this.unprojectVector=function(b,c){C.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));C.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],k,o,u;g=0;o=
|
|
|
-b.objects;b=0;for(k=o.length;b<k;b++){u=o[b];var m;if(!(m=!u.visible))if(m=u instanceof THREE.Mesh){a:{m=void 0;for(var t=u.matrixWorld,p=-u.geometry.boundingSphere.radius*Math.max(u.scale.x,Math.max(u.scale.y,u.scale.z)),v=0;v<6;v++)if(m=N[v].x*t.n14+N[v].y*t.n24+N[v].z*t.n34+N[v].w,m<=p){m=!1;break a}m=!0}m=!m}if(!m)m=j[g]=j[g]||new THREE.RenderableObject,g++,f=m,H.copy(u.position),C.multiplyVector3(H),f.object=u,f.z=H.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,j){var n=[],
|
|
|
-H=g.near,V=g.far,X,Q,fa,W,ca,Y,ea,$,ga,K,da,Z,ka,ia,ja,R,oa;I=x=v=p=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);C.multiply(g.projectionMatrix,g.matrixWorldInverse);N[0].set(C.n41-C.n11,C.n42-C.n12,C.n43-C.n13,C.n44-C.n14);N[1].set(C.n41+C.n11,C.n42+C.n12,C.n43+C.n13,C.n44+C.n14);N[2].set(C.n41+C.n21,C.n42+C.n22,C.n43+C.n23,C.n44+C.n24);N[3].set(C.n41-C.n21,C.n42-C.n22,C.n43-C.n23,C.n44-C.n24);N[4].set(C.n41-C.n31,C.n42-C.n32,C.n43-C.n33,C.n44-C.n34);N[5].set(C.n41+C.n31,C.n42+
|
|
|
-C.n32,C.n43+C.n33,C.n44+C.n34);for(X=0;X<6;X++)ga=N[X],ga.divideScalar(Math.sqrt(ga.x*ga.x+ga.y*ga.y+ga.z*ga.z));ga=this.projectObjects(f,g,!0);f=0;for(X=ga.length;f<X;f++)if(K=ga[f].object,K.visible)if(da=K.matrixWorld,Z=K.matrixRotationWorld,ka=K.materials,ia=K.overdraw,k=0,K instanceof THREE.Mesh){ja=K.geometry;W=ja.vertices;R=ja.faces;ja=ja.faceVertexUvs;Q=0;for(fa=W.length;Q<fa;Q++)h=b(),h.positionWorld.copy(W[Q].position),da.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),
|
|
|
-C.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>H&&h.positionScreen.z<V;W=0;for(Q=R.length;W<Q;W++){fa=R[W];if(fa instanceof THREE.Face3)if(ca=o[fa.a],Y=o[fa.b],ea=o[fa.c],ca.visible&&Y.visible&&ea.visible&&(K.doubleSided||K.flipSided!=(ea.positionScreen.x-ca.positionScreen.x)*(Y.positionScreen.y-ca.positionScreen.y)-(ea.positionScreen.y-ca.positionScreen.y)*(Y.positionScreen.x-ca.positionScreen.x)<0))$=
|
|
|
-u[p]=u[p]||new THREE.RenderableFace3,p++,m=$,m.v1.copy(ca),m.v2.copy(Y),m.v3.copy(ea);else continue;else if(fa instanceof THREE.Face4)if(ca=o[fa.a],Y=o[fa.b],ea=o[fa.c],$=o[fa.d],ca.visible&&Y.visible&&ea.visible&&$.visible&&(K.doubleSided||K.flipSided!=(($.positionScreen.x-ca.positionScreen.x)*(Y.positionScreen.y-ca.positionScreen.y)-($.positionScreen.y-ca.positionScreen.y)*(Y.positionScreen.x-ca.positionScreen.x)<0||(Y.positionScreen.x-ea.positionScreen.x)*($.positionScreen.y-ea.positionScreen.y)-
|
|
|
-(Y.positionScreen.y-ea.positionScreen.y)*($.positionScreen.x-ea.positionScreen.x)<0)))oa=t[v]=t[v]||new THREE.RenderableFace4,v++,m=oa,m.v1.copy(ca),m.v2.copy(Y),m.v3.copy(ea),m.v4.copy($);else continue;m.normalWorld.copy(fa.normal);Z.multiplyVector3(m.normalWorld);m.centroidWorld.copy(fa.centroid);da.multiplyVector3(m.centroidWorld);m.centroidScreen.copy(m.centroidWorld);C.multiplyVector3(m.centroidScreen);ea=fa.vertexNormals;ca=0;for(Y=ea.length;ca<Y;ca++)$=m.vertexNormalsWorld[ca],$.copy(ea[ca]),
|
|
|
-Z.multiplyVector3($);ca=0;for(Y=ja.length;ca<Y;ca++)if(oa=ja[ca][W]){ea=0;for($=oa.length;ea<$;ea++)m.uvs[ca][ea]=oa[ea]}m.meshMaterials=ka;m.faceMaterials=fa.materials;m.overdraw=ia;m.z=m.centroidScreen.z;n.push(m)}}else if(K instanceof THREE.Line){O.multiply(C,da);W=K.geometry.vertices;ca=b();ca.positionScreen.copy(W[0].position);O.multiplyVector4(ca.positionScreen);Q=1;for(fa=W.length;Q<fa;Q++)if(ca=b(),ca.positionScreen.copy(W[Q].position),O.multiplyVector4(ca.positionScreen),Y=o[k-2],D.copy(ca.positionScreen),
|
|
|
-E.copy(Y.positionScreen),e(D,E))D.multiplyScalar(1/D.w),E.multiplyScalar(1/E.w),da=B[x]=B[x]||new THREE.RenderableLine,x++,w=da,w.v1.positionScreen.copy(D),w.v2.positionScreen.copy(E),w.z=Math.max(D.z,E.z),w.materials=K.materials,n.push(w)}else if(K instanceof THREE.Particle&&(G.set(K.matrixWorld.n14,K.matrixWorld.n24,K.matrixWorld.n34,1),C.multiplyVector4(G),G.z/=G.w,G.z>0&&G.z<1))da=z[I]=z[I]||new THREE.RenderableParticle,I++,A=da,A.x=G.x/G.w,A.y=G.y/G.w,A.z=G.z,A.rotation=K.rotation.z,A.scale.x=
|
|
|
-K.scale.x*Math.abs(A.x-(G.x+g.projectionMatrix.n11)/(G.w+g.projectionMatrix.n14)),A.scale.y=K.scale.y*Math.abs(A.y-(G.y+g.projectionMatrix.n22)/(G.w+g.projectionMatrix.n24)),A.materials=K.materials,n.push(A);j&&n.sort(c);return n}};
|
|
|
-THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;j=f/2};this.render=function(e,f){var o,m,p,u,v,t,w,x;b=c.projectScene(e,f);o=0;for(m=b.length;o<m;o++)if(v=b[o],v instanceof THREE.RenderableParticle){w=v.x*g+g;x=v.y*j+j;p=0;for(u=v.material.length;p<u;p++)if(t=v.material[p],t instanceof THREE.ParticleDOMMaterial)t=t.domElement,t.style.left=w+"px",t.style.top=x+"px"}}};
|
|
|
-THREE.CanvasRenderer=function(b){function c(b){if(B!=b)t.globalAlpha=B=b}function e(b){if(A!=b){switch(b){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}A=b}}function f(b){if(I!=b)t.strokeStyle=I=b}function g(b){if(z!=b)t.fillStyle=z=b}var j=this,h=null,k=new THREE.Projector,b=b||{},o=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
-m,p,u,v,t=o.getContext("2d"),w=new THREE.Color(0),x=0,B=1,A=0,I=null,z=null,H=null,G=null,C=null,O,N,D,E,U=new THREE.RenderableVertex,M=new THREE.RenderableVertex,L,n,S,V,X,Q,fa,W,ca,Y,ea,$,ga=new THREE.Color(0),K=new THREE.Color(0),da=new THREE.Color(0),Z=new THREE.Color(0),ka=new THREE.Color(0),ia=[],ja,R,oa,qa,la,ua,Ia,Ja,Ka,va,ya=new THREE.Rectangle,aa=new THREE.Rectangle,ta=new THREE.Rectangle,Ea=!1,pa=new THREE.Color,ma=new THREE.Color,Ga=new THREE.Color,Da=new THREE.Color,J=new THREE.Vector3,
|
|
|
-za,ha,Ya,Aa,Ba,Va,b=16;za=document.createElement("canvas");za.width=za.height=2;ha=za.getContext("2d");ha.fillStyle="rgba(0,0,0,1)";ha.fillRect(0,0,2,2);Ya=ha.getImageData(0,0,2,2);Aa=Ya.data;Ba=document.createElement("canvas");Ba.width=Ba.height=b;Va=Ba.getContext("2d");Va.translate(-b/2,-b/2);Va.scale(b,b);b--;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,c){m=b;p=c;u=Math.floor(m/2);v=Math.floor(p/2);o.width=m;o.height=
|
|
|
-p;ya.set(-u,-v,u,v);aa.set(-u,-v,u,v);B=1;A=0;C=G=H=z=I=null};this.setClearColor=function(b,c){w.copy(b);x=c;aa.set(-u,-v,u,v)};this.setClearColorHex=function(b,c){w.setHex(b);x=c;aa.set(-u,-v,u,v)};this.clear=function(){t.setTransform(1,0,0,-1,u,v);aa.isEmpty()||(aa.minSelf(ya),aa.inflate(2),x<1&&t.clearRect(Math.floor(aa.getX()),Math.floor(aa.getY()),Math.floor(aa.getWidth()),Math.floor(aa.getHeight())),x>0&&(e(THREE.NormalBlending),c(1),g("rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*255)+","+
|
|
|
-Math.floor(w.b*255)+","+x+")"),t.fillRect(Math.floor(aa.getX()),Math.floor(aa.getY()),Math.floor(aa.getWidth()),Math.floor(aa.getHeight()))),aa.empty())};this.render=function(b,o){function m(b){var c,e,f,h=b.lights;ma.setRGB(0,0,0);Ga.setRGB(0,0,0);Da.setRGB(0,0,0);b=0;for(c=h.length;b<c;b++)e=h[b],f=e.color,e instanceof THREE.AmbientLight?(ma.r+=f.r,ma.g+=f.g,ma.b+=f.b):e instanceof THREE.DirectionalLight?(Ga.r+=f.r,Ga.g+=f.g,Ga.b+=f.b):e instanceof THREE.PointLight&&(Da.r+=f.r,Da.g+=f.g,Da.b+=f.b)}
|
|
|
-function p(b,c,e,f){var h,g,j,k,n=b.lights,b=0;for(h=n.length;b<h;b++)g=n[b],j=g.color,g instanceof THREE.DirectionalLight?(k=e.dot(g.position),k<=0||(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)):g instanceof THREE.PointLight&&(k=e.dot(J.sub(g.position,c).normalize()),k<=0||(k*=g.distance==0?1:1-Math.min(c.distanceTo(g.position)/g.distance,1),k!=0&&(k*=g.intensity,f.r+=j.r*k,f.g+=j.g*k,f.b+=j.b*k)))}function w(b,h,j){c(j.opacity);e(j.blending);var k,n,o,m,p,ha;if(j instanceof THREE.ParticleBasicMaterial){if(j.map)m=
|
|
|
-j.map.image,p=m.width>>1,ha=m.height>>1,j=h.scale.x*u,o=h.scale.y*v,k=j*p,n=o*ha,ta.set(b.x-k,b.y-n,b.x+k,b.y+n),ya.instersects(ta)&&(t.save(),t.translate(b.x,b.y),t.rotate(-h.rotation),t.scale(j,-o),t.translate(-p,-ha),t.drawImage(m,0,0),t.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(k=h.scale.x*u,n=h.scale.y*v,ta.set(b.x-k,b.y-n,b.x+k,b.y+n),ya.instersects(ta)&&(f(j.color.getContextStyle()),g(j.color.getContextStyle()),t.save(),t.translate(b.x,b.y),t.rotate(-h.rotation),t.scale(k,
|
|
|
-n),j.program(t),t.restore()))}function x(b,h,g,j){c(j.opacity);e(j.blending);t.beginPath();t.moveTo(b.positionScreen.x,b.positionScreen.y);t.lineTo(h.positionScreen.x,h.positionScreen.y);t.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(H!=b)t.lineWidth=H=b;b=j.linecap;if(G!=b)t.lineCap=G=b;b=j.linejoin;if(C!=b)t.lineJoin=C=b;f(j.color.getContextStyle());t.stroke();ta.inflate(j.linewidth*2)}}function A(b,f,h,g,k,m,u,t,ha){j.data.vertices+=3;j.data.faces++;c(t.opacity);e(t.blending);
|
|
|
-L=b.positionScreen.x;n=b.positionScreen.y;S=f.positionScreen.x;V=f.positionScreen.y;X=h.positionScreen.x;Q=h.positionScreen.y;z(L,n,S,V,X,Q);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(qa=u.uvs[0],Za(L,n,S,V,X,Q,qa[g].u,qa[g].v,qa[k].u,qa[k].v,qa[m].u,qa[m].v,t.map));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=o.matrixWorldInverse,J.copy(u.vertexNormalsWorld[0]),la=(J.x*b.n11+J.y*b.n12+J.z*b.n13)*0.5+0.5,ua=-(J.x*
|
|
|
-b.n21+J.y*b.n22+J.z*b.n23)*0.5+0.5,J.copy(u.vertexNormalsWorld[1]),Ia=(J.x*b.n11+J.y*b.n12+J.z*b.n13)*0.5+0.5,Ja=-(J.x*b.n21+J.y*b.n22+J.z*b.n23)*0.5+0.5,J.copy(u.vertexNormalsWorld[2]),Ka=(J.x*b.n11+J.y*b.n12+J.z*b.n13)*0.5+0.5,va=-(J.x*b.n21+J.y*b.n22+J.z*b.n23)*0.5+0.5,Za(L,n,S,V,X,Q,la,ua,Ia,Ja,Ka,va,t.envMap)}else t.wireframe?La(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ma(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&!t.wireframe&&(t.map.mapping instanceof
|
|
|
-THREE.UVMapping&&(qa=u.uvs[0],Za(L,n,S,V,X,Q,qa[g].u,qa[g].v,qa[k].u,qa[k].v,qa[m].u,qa[m].v,t.map)),e(THREE.SubtractiveBlending)),Ea?!t.wireframe&&t.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?(K.r=da.r=Z.r=ma.r,K.g=da.g=Z.g=ma.g,K.b=da.b=Z.b=ma.b,p(ha,u.v1.positionWorld,u.vertexNormalsWorld[0],K),p(ha,u.v2.positionWorld,u.vertexNormalsWorld[1],da),p(ha,u.v3.positionWorld,u.vertexNormalsWorld[2],Z),ka.r=(da.r+Z.r)*0.5,ka.g=(da.g+Z.g)*0.5,ka.b=(da.b+Z.b)*0.5,oa=Wa(K,da,Z,ka),Ta(L,
|
|
|
-n,S,V,X,Q,0,0,1,0,0,1,oa)):(pa.r=ma.r,pa.g=ma.g,pa.b=ma.b,p(ha,u.centroidWorld,u.normalWorld,pa),ga.r=Math.max(0,Math.min(t.color.r*pa.r,1)),ga.g=Math.max(0,Math.min(t.color.g*pa.g,1)),ga.b=Math.max(0,Math.min(t.color.b*pa.b,1)),t.wireframe?La(ga,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ma(ga)):t.wireframe?La(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ma(t.color);else if(t instanceof THREE.MeshDepthMaterial)ja=o.near,R=o.far,K.r=K.g=K.b=1-Oa(b.positionScreen.z,
|
|
|
-ja,R),da.r=da.g=da.b=1-Oa(f.positionScreen.z,ja,R),Z.r=Z.g=Z.b=1-Oa(h.positionScreen.z,ja,R),ka.r=(da.r+Z.r)*0.5,ka.g=(da.g+Z.g)*0.5,ka.b=(da.b+Z.b)*0.5,oa=Wa(K,da,Z,ka),Ta(L,n,S,V,X,Q,0,0,1,0,0,1,oa);else if(t instanceof THREE.MeshNormalMaterial)ga.r=Ua(u.normalWorld.x),ga.g=Ua(u.normalWorld.y),ga.b=Ua(u.normalWorld.z),t.wireframe?La(ga,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ma(ga)}function B(b,f,h,g,k,u,t,m,ha){j.data.vertices+=4;j.data.faces++;c(m.opacity);e(m.blending);if(m.map||
|
|
|
-m.envMap)A(b,f,g,0,1,3,t,m,ha),A(k,h,u,1,2,3,t,m,ha);else if(L=b.positionScreen.x,n=b.positionScreen.y,S=f.positionScreen.x,V=f.positionScreen.y,X=h.positionScreen.x,Q=h.positionScreen.y,fa=g.positionScreen.x,W=g.positionScreen.y,ca=k.positionScreen.x,Y=k.positionScreen.y,ea=u.positionScreen.x,$=u.positionScreen.y,m instanceof THREE.MeshBasicMaterial)I(L,n,S,V,X,Q,fa,W),m.wireframe?La(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ma(m.color);else if(m instanceof THREE.MeshLambertMaterial)Ea?
|
|
|
-!m.wireframe&&m.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==4?(K.r=da.r=Z.r=ka.r=ma.r,K.g=da.g=Z.g=ka.g=ma.g,K.b=da.b=Z.b=ka.b=ma.b,p(ha,t.v1.positionWorld,t.vertexNormalsWorld[0],K),p(ha,t.v2.positionWorld,t.vertexNormalsWorld[1],da),p(ha,t.v4.positionWorld,t.vertexNormalsWorld[3],Z),p(ha,t.v3.positionWorld,t.vertexNormalsWorld[2],ka),oa=Wa(K,da,Z,ka),z(L,n,S,V,fa,W),Ta(L,n,S,V,fa,W,0,0,1,0,0,1,oa),z(ca,Y,X,Q,ea,$),Ta(ca,Y,X,Q,ea,$,1,0,1,1,0,1,oa)):(pa.r=ma.r,pa.g=ma.g,pa.b=ma.b,p(ha,
|
|
|
-t.centroidWorld,t.normalWorld,pa),ga.r=Math.max(0,Math.min(m.color.r*pa.r,1)),ga.g=Math.max(0,Math.min(m.color.g*pa.g,1)),ga.b=Math.max(0,Math.min(m.color.b*pa.b,1)),I(L,n,S,V,X,Q,fa,W),m.wireframe?La(ga,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ma(ga)):(I(L,n,S,V,X,Q,fa,W),m.wireframe?La(m.color,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ma(m.color));else if(m instanceof THREE.MeshNormalMaterial)ga.r=Ua(t.normalWorld.x),ga.g=Ua(t.normalWorld.y),ga.b=Ua(t.normalWorld.z),
|
|
|
-I(L,n,S,V,X,Q,fa,W),m.wireframe?La(ga,m.wireframeLinewidth,m.wireframeLinecap,m.wireframeLinejoin):Ma(ga);else if(m instanceof THREE.MeshDepthMaterial)ja=o.near,R=o.far,K.r=K.g=K.b=1-Oa(b.positionScreen.z,ja,R),da.r=da.g=da.b=1-Oa(f.positionScreen.z,ja,R),Z.r=Z.g=Z.b=1-Oa(g.positionScreen.z,ja,R),ka.r=ka.g=ka.b=1-Oa(h.positionScreen.z,ja,R),oa=Wa(K,da,Z,ka),z(L,n,S,V,fa,W),Ta(L,n,S,V,fa,W,0,0,1,0,0,1,oa),z(ca,Y,X,Q,ea,$),Ta(ca,Y,X,Q,ea,$,1,0,1,1,0,1,oa)}function z(b,c,e,f,h,g){t.beginPath();t.moveTo(b,
|
|
|
-c);t.lineTo(e,f);t.lineTo(h,g);t.lineTo(b,c);t.closePath()}function I(b,c,e,f,h,g,j,k){t.beginPath();t.moveTo(b,c);t.lineTo(e,f);t.lineTo(h,g);t.lineTo(j,k);t.lineTo(b,c);t.closePath()}function La(b,c,e,h){if(H!=c)t.lineWidth=H=c;if(G!=e)t.lineCap=G=e;if(C!=h)t.lineJoin=C=h;f(b.getContextStyle());t.stroke();ta.inflate(c*2)}function Ma(b){g(b.getContextStyle());t.fill()}function Za(b,c,e,f,h,j,k,n,o,m,u,p,ha){if(ha.image.width!=0){if(ha.needsUpdate==!0||ia[ha.id]==void 0){var v=ha.wrapS==THREE.RepeatWrapping,
|
|
|
-Ba=ha.wrapT==THREE.RepeatWrapping;ia[ha.id]=t.createPattern(ha.image,v&&Ba?"repeat":v&&!Ba?"repeat-x":!v&&Ba?"repeat-y":"no-repeat");ha.needsUpdate=!1}g(ia[ha.id]);var v=ha.offset.x/ha.repeat.x,Ba=ha.offset.y/ha.repeat.y,w=(ha.image.width-1)*ha.repeat.x,ha=(ha.image.height-1)*ha.repeat.y,k=(k+v)*w,n=(n+Ba)*ha,o=(o+v)*w,m=(m+Ba)*ha,u=(u+v)*w,p=(p+Ba)*ha;e-=b;f-=c;h-=b;j-=c;o-=k;m-=n;u-=k;p-=n;v=1/(o*p-u*m);ha=(p*e-m*h)*v;m=(p*f-m*j)*v;e=(o*h-u*e)*v;f=(o*j-u*f)*v;b=b-ha*k-e*n;c=c-m*k-f*n;t.save();t.transform(ha,
|
|
|
-m,e,f,b,c);t.fill();t.restore()}}function Ta(b,c,e,f,h,g,j,k,n,o,m,u,ha){var p,v;p=ha.width-1;v=ha.height-1;j*=p;k*=v;n*=p;o*=v;m*=p;u*=v;e-=b;f-=c;h-=b;g-=c;n-=j;o-=k;m-=j;u-=k;v=1/(n*u-m*o);p=(u*e-o*h)*v;o=(u*f-o*g)*v;e=(n*h-m*e)*v;f=(n*g-m*f)*v;b=b-p*j-e*k;c=c-o*j-f*k;t.save();t.transform(p,o,e,f,b,c);t.clip();t.drawImage(ha,0,0);t.restore()}function Wa(b,c,e,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),j=~~(c.r*255),k=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),m=~~(f.r*
|
|
|
-255),u=~~(f.g*255),f=~~(f.b*255);Aa[0]=h<0?0:h>255?255:h;Aa[1]=g<0?0:g>255?255:g;Aa[2]=b<0?0:b>255?255:b;Aa[4]=j<0?0:j>255?255:j;Aa[5]=k<0?0:k>255?255:k;Aa[6]=c<0?0:c>255?255:c;Aa[8]=n<0?0:n>255?255:n;Aa[9]=o<0?0:o>255?255:o;Aa[10]=e<0?0:e>255?255:e;Aa[12]=m<0?0:m>255?255:m;Aa[13]=u<0?0:u>255?255:u;Aa[14]=f<0?0:f>255?255:f;ha.putImageData(Ya,0,0);Va.drawImage(za,0,0);return Ba}function Oa(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Ua(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Na(b,c){var e=
|
|
|
-c.x-b.x,f=c.y-b.y,h=e*e+f*f;h!=0&&(h=1/Math.sqrt(h),e*=h,f*=h,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Xa,$a,na,Ca,F,y,T,wa;this.autoClear?this.clear():t.setTransform(1,0,0,-1,u,v);j.data.vertices=0;j.data.faces=0;h=k.projectScene(b,o,this.sortElements);(Ea=b.lights.length>0)&&m(b);Xa=0;for($a=h.length;Xa<$a;Xa++){na=h[Xa];ta.empty();if(na instanceof THREE.RenderableParticle){O=na;O.x*=u;O.y*=v;Ca=0;for(F=na.materials.length;Ca<F;)wa=na.materials[Ca++],wa.opacity!=0&&w(O,na,wa,b)}else if(na instanceof THREE.RenderableLine){if(O=
|
|
|
-na.v1,N=na.v2,O.positionScreen.x*=u,O.positionScreen.y*=v,N.positionScreen.x*=u,N.positionScreen.y*=v,ta.addPoint(O.positionScreen.x,O.positionScreen.y),ta.addPoint(N.positionScreen.x,N.positionScreen.y),ya.instersects(ta)){Ca=0;for(F=na.materials.length;Ca<F;)wa=na.materials[Ca++],wa.opacity!=0&&x(O,N,na,wa,b)}}else if(na instanceof THREE.RenderableFace3){if(O=na.v1,N=na.v2,D=na.v3,O.positionScreen.x*=u,O.positionScreen.y*=v,N.positionScreen.x*=u,N.positionScreen.y*=v,D.positionScreen.x*=u,D.positionScreen.y*=
|
|
|
-v,na.overdraw&&(Na(O.positionScreen,N.positionScreen),Na(N.positionScreen,D.positionScreen),Na(D.positionScreen,O.positionScreen)),ta.add3Points(O.positionScreen.x,O.positionScreen.y,N.positionScreen.x,N.positionScreen.y,D.positionScreen.x,D.positionScreen.y),ya.instersects(ta)){Ca=0;for(F=na.meshMaterials.length;Ca<F;)if(wa=na.meshMaterials[Ca++],wa instanceof THREE.MeshFaceMaterial){y=0;for(T=na.faceMaterials.length;y<T;)(wa=na.faceMaterials[y++])&&wa.opacity!=0&&A(O,N,D,0,1,2,na,wa,b)}else wa.opacity!=
|
|
|
-0&&A(O,N,D,0,1,2,na,wa,b)}}else if(na instanceof THREE.RenderableFace4&&(O=na.v1,N=na.v2,D=na.v3,E=na.v4,O.positionScreen.x*=u,O.positionScreen.y*=v,N.positionScreen.x*=u,N.positionScreen.y*=v,D.positionScreen.x*=u,D.positionScreen.y*=v,E.positionScreen.x*=u,E.positionScreen.y*=v,U.positionScreen.copy(N.positionScreen),M.positionScreen.copy(E.positionScreen),na.overdraw&&(Na(O.positionScreen,N.positionScreen),Na(N.positionScreen,E.positionScreen),Na(E.positionScreen,O.positionScreen),Na(D.positionScreen,
|
|
|
-U.positionScreen),Na(D.positionScreen,M.positionScreen)),ta.addPoint(O.positionScreen.x,O.positionScreen.y),ta.addPoint(N.positionScreen.x,N.positionScreen.y),ta.addPoint(D.positionScreen.x,D.positionScreen.y),ta.addPoint(E.positionScreen.x,E.positionScreen.y),ya.instersects(ta))){Ca=0;for(F=na.meshMaterials.length;Ca<F;)if(wa=na.meshMaterials[Ca++],wa instanceof THREE.MeshFaceMaterial){y=0;for(T=na.faceMaterials.length;y<T;)(wa=na.faceMaterials[y++])&&wa.opacity!=0&&B(O,N,D,E,U,M,na,wa,b)}else wa.opacity!=
|
|
|
-0&&B(O,N,D,E,U,M,na,wa,b)}aa.addRectangle(ta)}t.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function b(b,c,e){var f,h,g,j;f=0;for(h=b.lights.length;f<h;f++)g=b.lights[f],g instanceof THREE.DirectionalLight?(j=c.normalWorld.dot(g.position)*g.intensity,j>0&&(e.r+=g.color.r*j,e.g+=g.color.g*j,e.b+=g.color.b*j)):g instanceof THREE.PointLight&&(E.sub(g.position,c.centroidWorld),E.normalize(),j=c.normalWorld.dot(E)*g.intensity,j>0&&(e.r+=g.color.r*j,e.g+=g.color.g*j,e.b+=g.color.b*j))}function c(c,e,h,k,m,u){j.data.vertices+=3;j.data.faces++;L=f(n++);L.setAttribute("d",
|
|
|
-"M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");m instanceof THREE.MeshBasicMaterial?H.copy(m.color):m instanceof THREE.MeshLambertMaterial?z?(G.r=C.r,G.g=C.g,G.b=C.b,b(u,k,G),H.r=Math.max(0,Math.min(m.color.r*G.r,1)),H.g=Math.max(0,Math.min(m.color.g*G.g,1)),H.b=Math.max(0,Math.min(m.color.b*G.b,1))):H.copy(m.color):m instanceof THREE.MeshDepthMaterial?(D=1-m.__2near/(m.__farPlusNear-k.z*m.__farMinusNear),
|
|
|
-H.setRGB(D,D,D)):m instanceof THREE.MeshNormalMaterial&&H.setRGB(g(k.normalWorld.x),g(k.normalWorld.y),g(k.normalWorld.z));m.wireframe?L.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+m.wireframeLinewidth+"; stroke-opacity: "+m.opacity+"; stroke-linecap: "+m.wireframeLinecap+"; stroke-linejoin: "+m.wireframeLinejoin):L.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+m.opacity);o.appendChild(L)}function e(c,e,h,k,m,u,t){j.data.vertices+=4;j.data.faces++;
|
|
|
-L=f(n++);L.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?H.copy(u.color):u instanceof THREE.MeshLambertMaterial?z?(G.r=C.r,G.g=C.g,G.b=C.b,b(t,m,G),H.r=Math.max(0,Math.min(u.color.r*G.r,1)),H.g=Math.max(0,Math.min(u.color.g*G.g,1)),H.b=Math.max(0,Math.min(u.color.b*G.b,1))):H.copy(u.color):u instanceof
|
|
|
-THREE.MeshDepthMaterial?(D=1-u.__2near/(u.__farPlusNear-m.z*u.__farMinusNear),H.setRGB(D,D,D)):u instanceof THREE.MeshNormalMaterial&&H.setRGB(g(m.normalWorld.x),g(m.normalWorld.y),g(m.normalWorld.z));u.wireframe?L.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):L.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+
|
|
|
-u.opacity);o.appendChild(L)}function f(b){U[b]==null&&(U[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),V==0&&U[b].setAttribute("shape-rendering","crispEdges"));return U[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var j=this,h=null,k=new THREE.Projector,o=document.createElementNS("http://www.w3.org/2000/svg","svg"),m,p,u,v,t,w,x,B,A=new THREE.Rectangle,I=new THREE.Rectangle,z=!1,H=new THREE.Color(16777215),G=new THREE.Color(16777215),C=new THREE.Color(0),O=new THREE.Color(0),
|
|
|
-N=new THREE.Color(0),D,E=new THREE.Vector3,U=[],M=[],L,n,S,V=1;this.domElement=o;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":V=1;break;case "low":V=0}};this.setSize=function(b,c){m=b;p=c;u=m/2;v=p/2;o.setAttribute("viewBox",-u+" "+-v+" "+m+" "+p);o.setAttribute("width",m);o.setAttribute("height",p);A.set(-u,-v,u,v)};this.clear=function(){for(;o.childNodes.length>0;)o.removeChild(o.childNodes[0])};this.render=
|
|
|
-function(b,f){var g,m,p,G,H,E,D,K;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;h=k.projectScene(b,f,this.sortElements);S=n=0;if(z=b.lights.length>0){D=b.lights;C.setRGB(0,0,0);O.setRGB(0,0,0);N.setRGB(0,0,0);g=0;for(m=D.length;g<m;g++)p=D[g],G=p.color,p instanceof THREE.AmbientLight?(C.r+=G.r,C.g+=G.g,C.b+=G.b):p instanceof THREE.DirectionalLight?(O.r+=G.r,O.g+=G.g,O.b+=G.b):p instanceof THREE.PointLight&&(N.r+=G.r,N.g+=G.g,N.b+=G.b)}g=0;for(m=h.length;g<m;g++)if(D=h[g],I.empty(),
|
|
|
-D instanceof THREE.RenderableParticle){t=D;t.x*=u;t.y*=-v;p=0;for(G=D.materials.length;p<G;)p++}else if(D instanceof THREE.RenderableLine){if(t=D.v1,w=D.v2,t.positionScreen.x*=u,t.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,I.addPoint(t.positionScreen.x,t.positionScreen.y),I.addPoint(w.positionScreen.x,w.positionScreen.y),A.instersects(I)){p=0;for(G=D.materials.length;p<G;)if((K=D.materials[p++])&&K.opacity!=0){H=t;E=w;var U=S++;M[U]==null&&(M[U]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"line"),V==0&&M[U].setAttribute("shape-rendering","crispEdges"));L=M[U];L.setAttribute("x1",H.positionScreen.x);L.setAttribute("y1",H.positionScreen.y);L.setAttribute("x2",E.positionScreen.x);L.setAttribute("y2",E.positionScreen.y);K instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+K.color.getContextStyle()+"; stroke-width: "+K.linewidth+"; stroke-opacity: "+K.opacity+"; stroke-linecap: "+K.linecap+"; stroke-linejoin: "+K.linejoin),o.appendChild(L))}}}else if(D instanceof
|
|
|
-THREE.RenderableFace3){if(t=D.v1,w=D.v2,x=D.v3,t.positionScreen.x*=u,t.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,I.addPoint(t.positionScreen.x,t.positionScreen.y),I.addPoint(w.positionScreen.x,w.positionScreen.y),I.addPoint(x.positionScreen.x,x.positionScreen.y),A.instersects(I)){p=0;for(G=D.meshMaterials.length;p<G;)if(K=D.meshMaterials[p++],K instanceof THREE.MeshFaceMaterial){H=0;for(E=D.faceMaterials.length;H<E;)(K=D.faceMaterials[H++])&&
|
|
|
-K.opacity!=0&&c(t,w,x,D,K,b)}else K&&K.opacity!=0&&c(t,w,x,D,K,b)}}else if(D instanceof THREE.RenderableFace4&&(t=D.v1,w=D.v2,x=D.v3,B=D.v4,t.positionScreen.x*=u,t.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,I.addPoint(t.positionScreen.x,t.positionScreen.y),I.addPoint(w.positionScreen.x,w.positionScreen.y),I.addPoint(x.positionScreen.x,x.positionScreen.y),I.addPoint(B.positionScreen.x,B.positionScreen.y),
|
|
|
-A.instersects(I))){p=0;for(G=D.meshMaterials.length;p<G;)if(K=D.meshMaterials[p++],K instanceof THREE.MeshFaceMaterial){H=0;for(E=D.faceMaterials.length;H<E;)(K=D.faceMaterials[H++])&&K.opacity!=0&&e(t,w,x,B,D,K,b)}else K&&K.opacity!=0&&e(t,w,x,B,D,K,b)}}};
|
|
|
+THREE.Projector=function(){function b(){var b=p[k]=p[k]||new THREE.RenderableVertex;k++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,h=b.z+b.w,g=c.z+c.w,j=-b.z+b.w,k=-c.z+c.w;return h>=0&&g>=0&&j>=0&&k>=0?!0:h<0&&g<0||j<0&&k<0?!1:(h<0?e=Math.max(e,h/(h-g)):g<0&&(f=Math.min(f,h/(h-g))),j<0?e=Math.max(e,j/(j-k)):k<0&&(f=Math.min(f,j/(j-k))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,g,j=[],h,k,p=[],t,o,u=[],v,n=[],w,x,B=[],A,F,z=[],G=new THREE.Vector4,I=new THREE.Vector4,
|
|
|
+C=new THREE.Matrix4,L=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,T=new THREE.Vector4;this.projectVector=function(b,c){C.multiply(c.projectionMatrix,c.matrixWorldInverse);C.multiplyVector3(b);return b};this.unprojectVector=function(b,c){C.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));C.multiplyVector3(b);return b};this.projectObjects=function(b,e,h){var e=[],m,k,p;g=0;k=
|
|
|
+b.objects;b=0;for(m=k.length;b<m;b++){p=k[b];var t;if(!(t=!p.visible))if(t=p instanceof THREE.Mesh){a:{t=void 0;for(var u=p.matrixWorld,n=-p.geometry.boundingSphere.radius*Math.max(p.scale.x,Math.max(p.scale.y,p.scale.z)),o=0;o<6;o++)if(t=D[o].x*u.n14+D[o].y*u.n24+D[o].z*u.n34+D[o].w,t<=n){t=!1;break a}t=!0}t=!t}if(!t)t=j[g]=j[g]||new THREE.RenderableObject,g++,f=t,G.copy(p.position),C.multiplyVector3(G),f.object=p,f.z=G.z,e.push(f)}h&&e.sort(c);return e};this.projectScene=function(f,g,j){var m=[],
|
|
|
+G=g.near,V=g.far,W,R,Y,ha,da,aa,ia,ca,Z,P,fa,$,ja,la,X,Q,ma;F=x=v=o=0;g.matrixAutoUpdate&&g.update(void 0,!0);f.update(void 0,!1,g);C.multiply(g.projectionMatrix,g.matrixWorldInverse);D[0].set(C.n41-C.n11,C.n42-C.n12,C.n43-C.n13,C.n44-C.n14);D[1].set(C.n41+C.n11,C.n42+C.n12,C.n43+C.n13,C.n44+C.n14);D[2].set(C.n41+C.n21,C.n42+C.n22,C.n43+C.n23,C.n44+C.n24);D[3].set(C.n41-C.n21,C.n42-C.n22,C.n43-C.n23,C.n44-C.n24);D[4].set(C.n41-C.n31,C.n42-C.n32,C.n43-C.n33,C.n44-C.n34);D[5].set(C.n41+C.n31,C.n42+
|
|
|
+C.n32,C.n43+C.n33,C.n44+C.n34);for(W=0;W<6;W++)Z=D[W],Z.divideScalar(Math.sqrt(Z.x*Z.x+Z.y*Z.y+Z.z*Z.z));Z=this.projectObjects(f,g,!0);f=0;for(W=Z.length;f<W;f++)if(P=Z[f].object,P.visible)if(fa=P.matrixWorld,$=P.matrixRotationWorld,ja=P.materials,la=P.overdraw,k=0,P instanceof THREE.Mesh){X=P.geometry;ha=X.vertices;Q=X.faces;X=X.faceVertexUvs;R=0;for(Y=ha.length;R<Y;R++)h=b(),h.positionWorld.copy(ha[R].position),fa.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),C.multiplyVector4(h.positionScreen),
|
|
|
+h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>G&&h.positionScreen.z<V;ha=0;for(R=Q.length;ha<R;ha++){Y=Q[ha];if(Y instanceof THREE.Face3)if(da=p[Y.a],aa=p[Y.b],ia=p[Y.c],da.visible&&aa.visible&&ia.visible&&(P.doubleSided||P.flipSided!=(ia.positionScreen.x-da.positionScreen.x)*(aa.positionScreen.y-da.positionScreen.y)-(ia.positionScreen.y-da.positionScreen.y)*(aa.positionScreen.x-da.positionScreen.x)<0))ca=u[o]=u[o]||new THREE.RenderableFace3,
|
|
|
+o++,t=ca,t.v1.copy(da),t.v2.copy(aa),t.v3.copy(ia);else continue;else if(Y instanceof THREE.Face4)if(da=p[Y.a],aa=p[Y.b],ia=p[Y.c],ca=p[Y.d],da.visible&&aa.visible&&ia.visible&&ca.visible&&(P.doubleSided||P.flipSided!=((ca.positionScreen.x-da.positionScreen.x)*(aa.positionScreen.y-da.positionScreen.y)-(ca.positionScreen.y-da.positionScreen.y)*(aa.positionScreen.x-da.positionScreen.x)<0||(aa.positionScreen.x-ia.positionScreen.x)*(ca.positionScreen.y-ia.positionScreen.y)-(aa.positionScreen.y-ia.positionScreen.y)*
|
|
|
+(ca.positionScreen.x-ia.positionScreen.x)<0)))ma=n[v]=n[v]||new THREE.RenderableFace4,v++,t=ma,t.v1.copy(da),t.v2.copy(aa),t.v3.copy(ia),t.v4.copy(ca);else continue;t.normalWorld.copy(Y.normal);$.multiplyVector3(t.normalWorld);t.centroidWorld.copy(Y.centroid);fa.multiplyVector3(t.centroidWorld);t.centroidScreen.copy(t.centroidWorld);C.multiplyVector3(t.centroidScreen);ia=Y.vertexNormals;da=0;for(aa=ia.length;da<aa;da++)ca=t.vertexNormalsWorld[da],ca.copy(ia[da]),$.multiplyVector3(ca);da=0;for(aa=
|
|
|
+X.length;da<aa;da++)if(ma=X[da][ha]){ia=0;for(ca=ma.length;ia<ca;ia++)t.uvs[da][ia]=ma[ia]}t.meshMaterials=ja;t.faceMaterials=Y.materials;t.overdraw=la;t.z=t.centroidScreen.z;m.push(t)}}else if(P instanceof THREE.Line){L.multiply(C,fa);ha=P.geometry.vertices;da=b();da.positionScreen.copy(ha[0].position);L.multiplyVector4(da.positionScreen);R=1;for(Y=ha.length;R<Y;R++)if(da=b(),da.positionScreen.copy(ha[R].position),L.multiplyVector4(da.positionScreen),aa=p[k-2],H.copy(da.positionScreen),T.copy(aa.positionScreen),
|
|
|
+e(H,T))H.multiplyScalar(1/H.w),T.multiplyScalar(1/T.w),fa=B[x]=B[x]||new THREE.RenderableLine,x++,w=fa,w.v1.positionScreen.copy(H),w.v2.positionScreen.copy(T),w.z=Math.max(H.z,T.z),w.materials=P.materials,m.push(w)}else if(P instanceof THREE.Particle&&(I.set(P.matrixWorld.n14,P.matrixWorld.n24,P.matrixWorld.n34,1),C.multiplyVector4(I),I.z/=I.w,I.z>0&&I.z<1))fa=z[F]=z[F]||new THREE.RenderableParticle,F++,A=fa,A.x=I.x/I.w,A.y=I.y/I.w,A.z=I.z,A.rotation=P.rotation.z,A.scale.x=P.scale.x*Math.abs(A.x-
|
|
|
+(I.x+g.projectionMatrix.n11)/(I.w+g.projectionMatrix.n14)),A.scale.y=P.scale.y*Math.abs(A.y-(I.y+g.projectionMatrix.n22)/(I.w+g.projectionMatrix.n24)),A.materials=P.materials,m.push(A);j&&m.sort(c);return m}};
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,g,j;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;g=e/2;j=f/2};this.render=function(e,f){var p,t,o,u,v,n,w,x;b=c.projectScene(e,f);p=0;for(t=b.length;p<t;p++)if(v=b[p],v instanceof THREE.RenderableParticle){w=v.x*g+g;x=v.y*j+j;o=0;for(u=v.material.length;o<u;o++)if(n=v.material[o],n instanceof THREE.ParticleDOMMaterial)n=n.domElement,n.style.left=w+"px",n.style.top=x+"px"}}};
|
|
|
+THREE.CanvasRenderer=function(b){function c(b){if(B!=b)n.globalAlpha=B=b}function e(b){if(A!=b){switch(b){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}A=b}}function f(b){if(F!=b)n.strokeStyle=F=b}function g(b){if(z!=b)n.fillStyle=z=b}var j=this,h=null,k=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
+t,o,u,v,n=p.getContext("2d"),w=new THREE.Color(0),x=0,B=1,A=0,F=null,z=null,G=null,I=null,C=null,L,D,H,T,J=new THREE.RenderableVertex,K=new THREE.RenderableVertex,N,m,U,V,W,R,Y,ha,da,aa,ia,ca,Z=new THREE.Color(0),P=new THREE.Color(0),fa=new THREE.Color(0),$=new THREE.Color(0),ja=new THREE.Color(0),la=[],X,Q,ma,ka,na,ua,Ia,Ja,Ka,va,ya=new THREE.Rectangle,ea=new THREE.Rectangle,ta=new THREE.Rectangle,Ea=!1,qa=new THREE.Color,oa=new THREE.Color,Ga=new THREE.Color,Da=new THREE.Color,M=new THREE.Vector3,
|
|
|
+za,ga,Ya,Aa,Ba,Va,b=16;za=document.createElement("canvas");za.width=za.height=2;ga=za.getContext("2d");ga.fillStyle="rgba(0,0,0,1)";ga.fillRect(0,0,2,2);Ya=ga.getImageData(0,0,2,2);Aa=Ya.data;Ba=document.createElement("canvas");Ba.width=Ba.height=b;Va=Ba.getContext("2d");Va.translate(-b/2,-b/2);Va.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,c){t=b;o=c;u=Math.floor(t/2);v=Math.floor(o/2);p.width=t;p.height=
|
|
|
+o;ya.set(-u,-v,u,v);ea.set(-u,-v,u,v);B=1;A=0;C=I=G=z=F=null};this.setClearColor=function(b,c){w.copy(b);x=c;ea.set(-u,-v,u,v)};this.setClearColorHex=function(b,c){w.setHex(b);x=c;ea.set(-u,-v,u,v)};this.clear=function(){n.setTransform(1,0,0,-1,u,v);ea.isEmpty()||(ea.minSelf(ya),ea.inflate(2),x<1&&n.clearRect(Math.floor(ea.getX()),Math.floor(ea.getY()),Math.floor(ea.getWidth()),Math.floor(ea.getHeight())),x>0&&(e(THREE.NormalBlending),c(1),g("rgba("+Math.floor(w.r*255)+","+Math.floor(w.g*255)+","+
|
|
|
+Math.floor(w.b*255)+","+x+")"),n.fillRect(Math.floor(ea.getX()),Math.floor(ea.getY()),Math.floor(ea.getWidth()),Math.floor(ea.getHeight()))),ea.empty())};this.render=function(b,p){function t(b){var c,e,f,h=b.lights;oa.setRGB(0,0,0);Ga.setRGB(0,0,0);Da.setRGB(0,0,0);b=0;for(c=h.length;b<c;b++)e=h[b],f=e.color,e instanceof THREE.AmbientLight?(oa.r+=f.r,oa.g+=f.g,oa.b+=f.b):e instanceof THREE.DirectionalLight?(Ga.r+=f.r,Ga.g+=f.g,Ga.b+=f.b):e instanceof THREE.PointLight&&(Da.r+=f.r,Da.g+=f.g,Da.b+=f.b)}
|
|
|
+function o(b,c,e,f){var h,g,j,m,k=b.lights,b=0;for(h=k.length;b<h;b++)g=k[b],j=g.color,g instanceof THREE.DirectionalLight?(m=e.dot(g.position),m<=0||(m*=g.intensity,f.r+=j.r*m,f.g+=j.g*m,f.b+=j.b*m)):g instanceof THREE.PointLight&&(m=e.dot(M.sub(g.position,c).normalize()),m<=0||(m*=g.distance==0?1:1-Math.min(c.distanceTo(g.position)/g.distance,1),m!=0&&(m*=g.intensity,f.r+=j.r*m,f.g+=j.g*m,f.b+=j.b*m)))}function w(b,h,j){c(j.opacity);e(j.blending);var m,k,p,t,o,ga;if(j instanceof THREE.ParticleBasicMaterial){if(j.map)t=
|
|
|
+j.map.image,o=t.width>>1,ga=t.height>>1,j=h.scale.x*u,p=h.scale.y*v,m=j*o,k=p*ga,ta.set(b.x-m,b.y-k,b.x+m,b.y+k),ya.instersects(ta)&&(n.save(),n.translate(b.x,b.y),n.rotate(-h.rotation),n.scale(j,-p),n.translate(-o,-ga),n.drawImage(t,0,0),n.restore())}else j instanceof THREE.ParticleCanvasMaterial&&(m=h.scale.x*u,k=h.scale.y*v,ta.set(b.x-m,b.y-k,b.x+m,b.y+k),ya.instersects(ta)&&(f(j.color.getContextStyle()),g(j.color.getContextStyle()),n.save(),n.translate(b.x,b.y),n.rotate(-h.rotation),n.scale(m,
|
|
|
+k),j.program(n),n.restore()))}function x(b,h,g,j){c(j.opacity);e(j.blending);n.beginPath();n.moveTo(b.positionScreen.x,b.positionScreen.y);n.lineTo(h.positionScreen.x,h.positionScreen.y);n.closePath();if(j instanceof THREE.LineBasicMaterial){b=j.linewidth;if(G!=b)n.lineWidth=G=b;b=j.linecap;if(I!=b)n.lineCap=I=b;b=j.linejoin;if(C!=b)n.lineJoin=C=b;f(j.color.getContextStyle());n.stroke();ta.inflate(j.linewidth*2)}}function A(b,f,h,g,k,t,u,n,ga){j.data.vertices+=3;j.data.faces++;c(n.opacity);e(n.blending);
|
|
|
+N=b.positionScreen.x;m=b.positionScreen.y;U=f.positionScreen.x;V=f.positionScreen.y;W=h.positionScreen.x;R=h.positionScreen.y;z(N,m,U,V,W,R);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(ka=u.uvs[0],Za(N,m,U,V,W,R,ka[g].u,ka[g].v,ka[k].u,ka[k].v,ka[t].u,ka[t].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=p.matrixWorldInverse,M.copy(u.vertexNormalsWorld[0]),na=(M.x*b.n11+M.y*b.n12+M.z*b.n13)*0.5+0.5,ua=-(M.x*
|
|
|
+b.n21+M.y*b.n22+M.z*b.n23)*0.5+0.5,M.copy(u.vertexNormalsWorld[1]),Ia=(M.x*b.n11+M.y*b.n12+M.z*b.n13)*0.5+0.5,Ja=-(M.x*b.n21+M.y*b.n22+M.z*b.n23)*0.5+0.5,M.copy(u.vertexNormalsWorld[2]),Ka=(M.x*b.n11+M.y*b.n12+M.z*b.n13)*0.5+0.5,va=-(M.x*b.n21+M.y*b.n22+M.z*b.n23)*0.5+0.5,Za(N,m,U,V,W,R,na,ua,Ia,Ja,Ka,va,n.envMap)}else n.wireframe?La(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ma(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof
|
|
|
+THREE.UVMapping&&(ka=u.uvs[0],Za(N,m,U,V,W,R,ka[g].u,ka[g].v,ka[k].u,ka[k].v,ka[t].u,ka[t].v,n.map)),e(THREE.SubtractiveBlending)),Ea?!n.wireframe&&n.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==3?(P.r=fa.r=$.r=oa.r,P.g=fa.g=$.g=oa.g,P.b=fa.b=$.b=oa.b,o(ga,u.v1.positionWorld,u.vertexNormalsWorld[0],P),o(ga,u.v2.positionWorld,u.vertexNormalsWorld[1],fa),o(ga,u.v3.positionWorld,u.vertexNormalsWorld[2],$),ja.r=(fa.r+$.r)*0.5,ja.g=(fa.g+$.g)*0.5,ja.b=(fa.b+$.b)*0.5,ma=Wa(P,fa,$,ja),Ta(N,
|
|
|
+m,U,V,W,R,0,0,1,0,0,1,ma)):(qa.r=oa.r,qa.g=oa.g,qa.b=oa.b,o(ga,u.centroidWorld,u.normalWorld,qa),Z.r=Math.max(0,Math.min(n.color.r*qa.r,1)),Z.g=Math.max(0,Math.min(n.color.g*qa.g,1)),Z.b=Math.max(0,Math.min(n.color.b*qa.b,1)),n.wireframe?La(Z,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ma(Z)):n.wireframe?La(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ma(n.color);else if(n instanceof THREE.MeshDepthMaterial)X=p.near,Q=p.far,P.r=P.g=P.b=1-Oa(b.positionScreen.z,
|
|
|
+X,Q),fa.r=fa.g=fa.b=1-Oa(f.positionScreen.z,X,Q),$.r=$.g=$.b=1-Oa(h.positionScreen.z,X,Q),ja.r=(fa.r+$.r)*0.5,ja.g=(fa.g+$.g)*0.5,ja.b=(fa.b+$.b)*0.5,ma=Wa(P,fa,$,ja),Ta(N,m,U,V,W,R,0,0,1,0,0,1,ma);else if(n instanceof THREE.MeshNormalMaterial)Z.r=Ua(u.normalWorld.x),Z.g=Ua(u.normalWorld.y),Z.b=Ua(u.normalWorld.z),n.wireframe?La(Z,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ma(Z)}function B(b,f,h,g,k,t,u,n,ga){j.data.vertices+=4;j.data.faces++;c(n.opacity);e(n.blending);if(n.map||
|
|
|
+n.envMap)A(b,f,g,0,1,3,u,n,ga),A(k,h,t,1,2,3,u,n,ga);else if(N=b.positionScreen.x,m=b.positionScreen.y,U=f.positionScreen.x,V=f.positionScreen.y,W=h.positionScreen.x,R=h.positionScreen.y,Y=g.positionScreen.x,ha=g.positionScreen.y,da=k.positionScreen.x,aa=k.positionScreen.y,ia=t.positionScreen.x,ca=t.positionScreen.y,n instanceof THREE.MeshBasicMaterial)F(N,m,U,V,W,R,Y,ha),n.wireframe?La(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ma(n.color);else if(n instanceof THREE.MeshLambertMaterial)Ea?
|
|
|
+!n.wireframe&&n.shading==THREE.SmoothShading&&u.vertexNormalsWorld.length==4?(P.r=fa.r=$.r=ja.r=oa.r,P.g=fa.g=$.g=ja.g=oa.g,P.b=fa.b=$.b=ja.b=oa.b,o(ga,u.v1.positionWorld,u.vertexNormalsWorld[0],P),o(ga,u.v2.positionWorld,u.vertexNormalsWorld[1],fa),o(ga,u.v4.positionWorld,u.vertexNormalsWorld[3],$),o(ga,u.v3.positionWorld,u.vertexNormalsWorld[2],ja),ma=Wa(P,fa,$,ja),z(N,m,U,V,Y,ha),Ta(N,m,U,V,Y,ha,0,0,1,0,0,1,ma),z(da,aa,W,R,ia,ca),Ta(da,aa,W,R,ia,ca,1,0,1,1,0,1,ma)):(qa.r=oa.r,qa.g=oa.g,qa.b=oa.b,
|
|
|
+o(ga,u.centroidWorld,u.normalWorld,qa),Z.r=Math.max(0,Math.min(n.color.r*qa.r,1)),Z.g=Math.max(0,Math.min(n.color.g*qa.g,1)),Z.b=Math.max(0,Math.min(n.color.b*qa.b,1)),F(N,m,U,V,W,R,Y,ha),n.wireframe?La(Z,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ma(Z)):(F(N,m,U,V,W,R,Y,ha),n.wireframe?La(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ma(n.color));else if(n instanceof THREE.MeshNormalMaterial)Z.r=Ua(u.normalWorld.x),Z.g=Ua(u.normalWorld.y),Z.b=Ua(u.normalWorld.z),
|
|
|
+F(N,m,U,V,W,R,Y,ha),n.wireframe?La(Z,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Ma(Z);else if(n instanceof THREE.MeshDepthMaterial)X=p.near,Q=p.far,P.r=P.g=P.b=1-Oa(b.positionScreen.z,X,Q),fa.r=fa.g=fa.b=1-Oa(f.positionScreen.z,X,Q),$.r=$.g=$.b=1-Oa(g.positionScreen.z,X,Q),ja.r=ja.g=ja.b=1-Oa(h.positionScreen.z,X,Q),ma=Wa(P,fa,$,ja),z(N,m,U,V,Y,ha),Ta(N,m,U,V,Y,ha,0,0,1,0,0,1,ma),z(da,aa,W,R,ia,ca),Ta(da,aa,W,R,ia,ca,1,0,1,1,0,1,ma)}function z(b,c,e,f,h,g){n.beginPath();n.moveTo(b,
|
|
|
+c);n.lineTo(e,f);n.lineTo(h,g);n.lineTo(b,c);n.closePath()}function F(b,c,e,f,h,g,j,m){n.beginPath();n.moveTo(b,c);n.lineTo(e,f);n.lineTo(h,g);n.lineTo(j,m);n.lineTo(b,c);n.closePath()}function La(b,c,e,h){if(G!=c)n.lineWidth=G=c;if(I!=e)n.lineCap=I=e;if(C!=h)n.lineJoin=C=h;f(b.getContextStyle());n.stroke();ta.inflate(c*2)}function Ma(b){g(b.getContextStyle());n.fill()}function Za(b,c,e,f,h,j,m,k,p,u,t,o,ga){if(ga.image.width!=0){if(ga.needsUpdate==!0||la[ga.id]==void 0){var v=ga.wrapS==THREE.RepeatWrapping,
|
|
|
+Ba=ga.wrapT==THREE.RepeatWrapping;la[ga.id]=n.createPattern(ga.image,v&&Ba?"repeat":v&&!Ba?"repeat-x":!v&&Ba?"repeat-y":"no-repeat");ga.needsUpdate=!1}g(la[ga.id]);var v=ga.offset.x/ga.repeat.x,Ba=ga.offset.y/ga.repeat.y,w=(ga.image.width-1)*ga.repeat.x,ga=(ga.image.height-1)*ga.repeat.y,m=(m+v)*w,k=(k+Ba)*ga,p=(p+v)*w,u=(u+Ba)*ga,t=(t+v)*w,o=(o+Ba)*ga;e-=b;f-=c;h-=b;j-=c;p-=m;u-=k;t-=m;o-=k;v=1/(p*o-t*u);ga=(o*e-u*h)*v;u=(o*f-u*j)*v;e=(p*h-t*e)*v;f=(p*j-t*f)*v;b=b-ga*m-e*k;c=c-u*m-f*k;n.save();n.transform(ga,
|
|
|
+u,e,f,b,c);n.fill();n.restore()}}function Ta(b,c,e,f,h,g,j,m,k,p,u,t,o){var ga,v;ga=o.width-1;v=o.height-1;j*=ga;m*=v;k*=ga;p*=v;u*=ga;t*=v;e-=b;f-=c;h-=b;g-=c;k-=j;p-=m;u-=j;t-=m;v=1/(k*t-u*p);ga=(t*e-p*h)*v;p=(t*f-p*g)*v;e=(k*h-u*e)*v;f=(k*g-u*f)*v;b=b-ga*j-e*m;c=c-p*j-f*m;n.save();n.transform(ga,p,e,f,b,c);n.clip();n.drawImage(o,0,0);n.restore()}function Wa(b,c,e,f){var h=~~(b.r*255),g=~~(b.g*255),b=~~(b.b*255),j=~~(c.r*255),m=~~(c.g*255),c=~~(c.b*255),k=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255),
|
|
|
+u=~~(f.r*255),n=~~(f.g*255),f=~~(f.b*255);Aa[0]=h<0?0:h>255?255:h;Aa[1]=g<0?0:g>255?255:g;Aa[2]=b<0?0:b>255?255:b;Aa[4]=j<0?0:j>255?255:j;Aa[5]=m<0?0:m>255?255:m;Aa[6]=c<0?0:c>255?255:c;Aa[8]=k<0?0:k>255?255:k;Aa[9]=p<0?0:p>255?255:p;Aa[10]=e<0?0:e>255?255:e;Aa[12]=u<0?0:u>255?255:u;Aa[13]=n<0?0:n>255?255:n;Aa[14]=f<0?0:f>255?255:f;ga.putImageData(Ya,0,0);Va.drawImage(za,0,0);return Ba}function Oa(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Ua(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Na(b,
|
|
|
+c){var e=c.x-b.x,f=c.y-b.y,h=e*e+f*f;h!=0&&(h=1/Math.sqrt(h),e*=h,f*=h,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Xa,$a,pa,Ca,E,y,S,wa;this.autoClear?this.clear():n.setTransform(1,0,0,-1,u,v);j.data.vertices=0;j.data.faces=0;h=k.projectScene(b,p,this.sortElements);(Ea=b.lights.length>0)&&t(b);Xa=0;for($a=h.length;Xa<$a;Xa++){pa=h[Xa];ta.empty();if(pa instanceof THREE.RenderableParticle){L=pa;L.x*=u;L.y*=v;Ca=0;for(E=pa.materials.length;Ca<E;)wa=pa.materials[Ca++],wa.opacity!=0&&w(L,pa,wa,b)}else if(pa instanceof
|
|
|
+THREE.RenderableLine){if(L=pa.v1,D=pa.v2,L.positionScreen.x*=u,L.positionScreen.y*=v,D.positionScreen.x*=u,D.positionScreen.y*=v,ta.addPoint(L.positionScreen.x,L.positionScreen.y),ta.addPoint(D.positionScreen.x,D.positionScreen.y),ya.instersects(ta)){Ca=0;for(E=pa.materials.length;Ca<E;)wa=pa.materials[Ca++],wa.opacity!=0&&x(L,D,pa,wa,b)}}else if(pa instanceof THREE.RenderableFace3){if(L=pa.v1,D=pa.v2,H=pa.v3,L.positionScreen.x*=u,L.positionScreen.y*=v,D.positionScreen.x*=u,D.positionScreen.y*=v,
|
|
|
+H.positionScreen.x*=u,H.positionScreen.y*=v,pa.overdraw&&(Na(L.positionScreen,D.positionScreen),Na(D.positionScreen,H.positionScreen),Na(H.positionScreen,L.positionScreen)),ta.add3Points(L.positionScreen.x,L.positionScreen.y,D.positionScreen.x,D.positionScreen.y,H.positionScreen.x,H.positionScreen.y),ya.instersects(ta)){Ca=0;for(E=pa.meshMaterials.length;Ca<E;)if(wa=pa.meshMaterials[Ca++],wa instanceof THREE.MeshFaceMaterial){y=0;for(S=pa.faceMaterials.length;y<S;)(wa=pa.faceMaterials[y++])&&wa.opacity!=
|
|
|
+0&&A(L,D,H,0,1,2,pa,wa,b)}else wa.opacity!=0&&A(L,D,H,0,1,2,pa,wa,b)}}else if(pa instanceof THREE.RenderableFace4&&(L=pa.v1,D=pa.v2,H=pa.v3,T=pa.v4,L.positionScreen.x*=u,L.positionScreen.y*=v,D.positionScreen.x*=u,D.positionScreen.y*=v,H.positionScreen.x*=u,H.positionScreen.y*=v,T.positionScreen.x*=u,T.positionScreen.y*=v,J.positionScreen.copy(D.positionScreen),K.positionScreen.copy(T.positionScreen),pa.overdraw&&(Na(L.positionScreen,D.positionScreen),Na(D.positionScreen,T.positionScreen),Na(T.positionScreen,
|
|
|
+L.positionScreen),Na(H.positionScreen,J.positionScreen),Na(H.positionScreen,K.positionScreen)),ta.addPoint(L.positionScreen.x,L.positionScreen.y),ta.addPoint(D.positionScreen.x,D.positionScreen.y),ta.addPoint(H.positionScreen.x,H.positionScreen.y),ta.addPoint(T.positionScreen.x,T.positionScreen.y),ya.instersects(ta))){Ca=0;for(E=pa.meshMaterials.length;Ca<E;)if(wa=pa.meshMaterials[Ca++],wa instanceof THREE.MeshFaceMaterial){y=0;for(S=pa.faceMaterials.length;y<S;)(wa=pa.faceMaterials[y++])&&wa.opacity!=
|
|
|
+0&&B(L,D,H,T,J,K,pa,wa,b)}else wa.opacity!=0&&B(L,D,H,T,J,K,pa,wa,b)}ea.addRectangle(ta)}n.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function b(b,c,e){var f,h,g,j;f=0;for(h=b.lights.length;f<h;f++)g=b.lights[f],g instanceof THREE.DirectionalLight?(j=c.normalWorld.dot(g.position)*g.intensity,j>0&&(e.r+=g.color.r*j,e.g+=g.color.g*j,e.b+=g.color.b*j)):g instanceof THREE.PointLight&&(T.sub(g.position,c.centroidWorld),T.normalize(),j=c.normalWorld.dot(T)*g.intensity,j>0&&(e.r+=g.color.r*j,e.g+=g.color.g*j,e.b+=g.color.b*j))}function c(c,e,h,k,u,n){j.data.vertices+=3;j.data.faces++;N=f(m++);N.setAttribute("d",
|
|
|
+"M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?G.copy(u.color):u instanceof THREE.MeshLambertMaterial?z?(I.r=C.r,I.g=C.g,I.b=C.b,b(n,k,I),G.r=Math.max(0,Math.min(u.color.r*I.r,1)),G.g=Math.max(0,Math.min(u.color.g*I.g,1)),G.b=Math.max(0,Math.min(u.color.b*I.b,1))):G.copy(u.color):u instanceof THREE.MeshDepthMaterial?(H=1-u.__2near/(u.__farPlusNear-k.z*u.__farMinusNear),
|
|
|
+G.setRGB(H,H,H)):u instanceof THREE.MeshNormalMaterial&&G.setRGB(g(k.normalWorld.x),g(k.normalWorld.y),g(k.normalWorld.z));u.wireframe?N.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):N.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+u.opacity);p.appendChild(N)}function e(c,e,h,k,u,n,t){j.data.vertices+=4;j.data.faces++;
|
|
|
+N=f(m++);N.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+h.positionScreen.x+","+h.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?G.copy(n.color):n instanceof THREE.MeshLambertMaterial?z?(I.r=C.r,I.g=C.g,I.b=C.b,b(t,u,I),G.r=Math.max(0,Math.min(n.color.r*I.r,1)),G.g=Math.max(0,Math.min(n.color.g*I.g,1)),G.b=Math.max(0,Math.min(n.color.b*I.b,1))):G.copy(n.color):n instanceof
|
|
|
+THREE.MeshDepthMaterial?(H=1-n.__2near/(n.__farPlusNear-u.z*n.__farMinusNear),G.setRGB(H,H,H)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(g(u.normalWorld.x),g(u.normalWorld.y),g(u.normalWorld.z));n.wireframe?N.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):N.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+
|
|
|
+n.opacity);p.appendChild(N)}function f(b){J[b]==null&&(J[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),V==0&&J[b].setAttribute("shape-rendering","crispEdges"));return J[b]}function g(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var j=this,h=null,k=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),t,o,u,v,n,w,x,B,A=new THREE.Rectangle,F=new THREE.Rectangle,z=!1,G=new THREE.Color(16777215),I=new THREE.Color(16777215),C=new THREE.Color(0),L=new THREE.Color(0),
|
|
|
+D=new THREE.Color(0),H,T=new THREE.Vector3,J=[],K=[],N,m,U,V=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":V=1;break;case "low":V=0}};this.setSize=function(b,c){t=b;o=c;u=t/2;v=o/2;p.setAttribute("viewBox",-u+" "+-v+" "+t+" "+o);p.setAttribute("width",t);p.setAttribute("height",o);A.set(-u,-v,u,v)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};this.render=
|
|
|
+function(b,f){var g,t,o,I,G,J,H,P;this.autoClear&&this.clear();j.data.vertices=0;j.data.faces=0;h=k.projectScene(b,f,this.sortElements);U=m=0;if(z=b.lights.length>0){H=b.lights;C.setRGB(0,0,0);L.setRGB(0,0,0);D.setRGB(0,0,0);g=0;for(t=H.length;g<t;g++)o=H[g],I=o.color,o instanceof THREE.AmbientLight?(C.r+=I.r,C.g+=I.g,C.b+=I.b):o instanceof THREE.DirectionalLight?(L.r+=I.r,L.g+=I.g,L.b+=I.b):o instanceof THREE.PointLight&&(D.r+=I.r,D.g+=I.g,D.b+=I.b)}g=0;for(t=h.length;g<t;g++)if(H=h[g],F.empty(),
|
|
|
+H instanceof THREE.RenderableParticle){n=H;n.x*=u;n.y*=-v;o=0;for(I=H.materials.length;o<I;)o++}else if(H instanceof THREE.RenderableLine){if(n=H.v1,w=H.v2,n.positionScreen.x*=u,n.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,F.addPoint(n.positionScreen.x,n.positionScreen.y),F.addPoint(w.positionScreen.x,w.positionScreen.y),A.instersects(F)){o=0;for(I=H.materials.length;o<I;)if((P=H.materials[o++])&&P.opacity!=0){G=n;J=w;var T=U++;K[T]==null&&(K[T]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"line"),V==0&&K[T].setAttribute("shape-rendering","crispEdges"));N=K[T];N.setAttribute("x1",G.positionScreen.x);N.setAttribute("y1",G.positionScreen.y);N.setAttribute("x2",J.positionScreen.x);N.setAttribute("y2",J.positionScreen.y);P instanceof THREE.LineBasicMaterial&&(N.setAttribute("style","fill: none; stroke: "+P.color.getContextStyle()+"; stroke-width: "+P.linewidth+"; stroke-opacity: "+P.opacity+"; stroke-linecap: "+P.linecap+"; stroke-linejoin: "+P.linejoin),p.appendChild(N))}}}else if(H instanceof
|
|
|
+THREE.RenderableFace3){if(n=H.v1,w=H.v2,x=H.v3,n.positionScreen.x*=u,n.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,F.addPoint(n.positionScreen.x,n.positionScreen.y),F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(x.positionScreen.x,x.positionScreen.y),A.instersects(F)){o=0;for(I=H.meshMaterials.length;o<I;)if(P=H.meshMaterials[o++],P instanceof THREE.MeshFaceMaterial){G=0;for(J=H.faceMaterials.length;G<J;)(P=H.faceMaterials[G++])&&
|
|
|
+P.opacity!=0&&c(n,w,x,H,P,b)}else P&&P.opacity!=0&&c(n,w,x,H,P,b)}}else if(H instanceof THREE.RenderableFace4&&(n=H.v1,w=H.v2,x=H.v3,B=H.v4,n.positionScreen.x*=u,n.positionScreen.y*=-v,w.positionScreen.x*=u,w.positionScreen.y*=-v,x.positionScreen.x*=u,x.positionScreen.y*=-v,B.positionScreen.x*=u,B.positionScreen.y*=-v,F.addPoint(n.positionScreen.x,n.positionScreen.y),F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(x.positionScreen.x,x.positionScreen.y),F.addPoint(B.positionScreen.x,B.positionScreen.y),
|
|
|
+A.instersects(F))){o=0;for(I=H.meshMaterials.length;o<I;)if(P=H.meshMaterials[o++],P instanceof THREE.MeshFaceMaterial){G=0;for(J=H.faceMaterials.length;G<J;)(P=H.faceMaterials[G++])&&P.opacity!=0&&e(n,w,x,B,H,P,b)}else P&&P.opacity!=0&&e(n,w,x,B,H,P,b)}}};
|
|
|
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 int combine;\n#endif",
|
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( -vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor = vec4( mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity ), opacity );\n} else {\ngl_FragColor = gl_FragColor * cubeColor;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float 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\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif",
|
|
@@ -214,113 +214,113 @@ THREE.ShaderChunk.lights_vertex,THREE.ShaderChunk.skinning_vertex,THREE.ShaderCh
|
|
|
"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"),vertexShader:["uniform float size;\nuniform float scale;",THREE.ShaderChunk.color_pars_vertex,THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",
|
|
|
THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n")},depthRGBA:{uniforms:{},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}",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")}};
|
|
|
-THREE.WebGLRenderer=function(b){function c(b,c,e){var f,h,g,j=b.vertices,k=j.length,m=b.colors,o=m.length,u=b.__vertexArray,t=b.__colorArray,p=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors,x=b.__webglCustomAttributes,A,B;if(x)for(A in x)x[A].offset=0;if(e.sortParticles){ja.multiplySelf(e.matrixWorld);for(f=0;f<k;f++)h=j[f].position,qa.copy(h),ja.multiplyVector3(qa),p[f]=[qa.z,f];p.sort(function(b,c){return c[0]-b[0]});for(f=0;f<k;f++)h=j[p[f][1]].position,g=f*3,u[g]=h.x,u[g+1]=h.y,u[g+2]=h.z;
|
|
|
-for(f=0;f<o;f++)g=f*3,color=m[p[f][1]],t[g]=color.r,t[g+1]=color.g,t[g+2]=color.b;if(x)for(A in x){f=x[A];m=f.value.length;for(g=0;g<m;g++){index=p[g][1];o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")B=f.value[index];f.size===2?(f.array[o]=B.x,f.array[o+1]=B.y):f.size===3?f.type==="c"?(f.array[o]=B.r,f.array[o+1]=B.g,f.array[o+2]=B.b):(f.array[o]=B.x,f.array[o+1]=B.y,f.array[o+2]=B.z):(f.array[o]=
|
|
|
-B.x,f.array[o+1]=B.y,f.array[o+2]=B.z,f.array[o+3]=B.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<k;f++)h=j[f].position,g=f*3,u[g]=h.x,u[g+1]=h.y,u[g+2]=h.z;if(w)for(f=0;f<o;f++)color=m[f],g=f*3,t[g]=color.r,t[g+1]=color.g,t[g+2]=color.b;if(x)for(A in x)if(f=x[A],f.__original.needsUpdate){m=f.value.length;for(g=0;g<m;g++){o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")B=f.value[g];f.size===2?(f.array[o]=
|
|
|
-B.x,f.array[o+1]=B.y):f.size===3?f.type==="c"?(f.array[o]=B.r,f.array[o+1]=B.g,f.array[o+2]=B.b):(f.array[o]=B.x,f.array[o+1]=B.y,f.array[o+2]=B.z):(f.array[o]=B.x,f.array[o+1]=B.y,f.array[o+2]=B.z,f.array[o+3]=B.w)}f.offset+=f.size}}}if(v||e.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,u,c);if(w||e.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,b.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,t,c);if(x)for(A in x)if(f=x[A],f.__original.needsUpdate||e.sortParticles)n.bindBuffer(n.ARRAY_BUFFER,
|
|
|
-f.buffer),n.bufferData(n.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,h){f.program||L.initMaterial(f,c,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(L.maxMorphTargets);for(var g=0,j=L.maxMorphTargets;g<j;g++)h.__webglMorphTargetInfluences[g]=0}var g=f.program,j=g.uniforms,k=f.uniforms;g!=V&&(n.useProgram(g),V=g);n.uniformMatrix4fv(j.projectionMatrix,!1,R);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof
|
|
|
-THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(k.fogColor.value=e.color,e instanceof THREE.Fog)k.fogNear.value=e.near,k.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)k.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var m,o,u,t=0,p=0,v=0,w,B,x,A=la,z=A.directional.colors,I=A.directional.positions,G=A.point.colors,C=A.point.positions,ja=A.point.distances,
|
|
|
-H=0,D=0,e=o=x=0;for(m=c.length;e<m;e++)if(o=c[e],u=o.color,w=o.position,B=o.intensity,x=o.distance,o instanceof THREE.AmbientLight)t+=u.r,p+=u.g,v+=u.b;else if(o instanceof THREE.DirectionalLight)x=H*3,z[x]=u.r*B,z[x+1]=u.g*B,z[x+2]=u.b*B,I[x]=w.x,I[x+1]=w.y,I[x+2]=w.z,H+=1;else if(o instanceof THREE.SpotLight)x=H*3,z[x]=u.r*B,z[x+1]=u.g*B,z[x+2]=u.b*B,u=1/w.length(),I[x]=w.x*u,I[x+1]=w.y*u,I[x+2]=w.z*u,H+=1;else if(o instanceof THREE.PointLight)o=D*3,G[o]=u.r*B,G[o+1]=u.g*B,G[o+2]=u.b*B,C[o]=w.x,
|
|
|
-C[o+1]=w.y,C[o+2]=w.z,ja[D]=x,D+=1;for(e=H*3;e<z.length;e++)z[e]=0;for(e=D*3;e<G.length;e++)G[e]=0;A.point.length=D;A.directional.length=H;A.ambient[0]=t;A.ambient[1]=p;A.ambient[2]=v;c=la;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=
|
|
|
+THREE.WebGLRenderer=function(b){function c(b,c,e){var f,h,g,j=b.vertices,k=j.length,u=b.colors,n=u.length,p=b.__vertexArray,t=b.__colorArray,o=b.__sortArray,v=b.__dirtyVertices,w=b.__dirtyColors,x=b.__webglCustomAttributes,A,B;if(x)for(A in x)x[A].offset=0;if(e.sortParticles){X.multiplySelf(e.matrixWorld);for(f=0;f<k;f++)h=j[f].position,ka.copy(h),X.multiplyVector3(ka),o[f]=[ka.z,f];o.sort(function(b,c){return c[0]-b[0]});for(f=0;f<k;f++)h=j[o[f][1]].position,g=f*3,p[g]=h.x,p[g+1]=h.y,p[g+2]=h.z;
|
|
|
+for(f=0;f<n;f++)g=f*3,color=u[o[f][1]],t[g]=color.r,t[g+1]=color.g,t[g+2]=color.b;if(x)for(A in x){f=x[A];u=f.value.length;for(g=0;g<u;g++){index=o[g][1];n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")B=f.value[index];f.size===2?(f.array[n]=B.x,f.array[n+1]=B.y):f.size===3?f.type==="c"?(f.array[n]=B.r,f.array[n+1]=B.g,f.array[n+2]=B.b):(f.array[n]=B.x,f.array[n+1]=B.y,f.array[n+2]=B.z):(f.array[n]=
|
|
|
+B.x,f.array[n+1]=B.y,f.array[n+2]=B.z,f.array[n+3]=B.w)}f.offset+=f.size}}}else{if(v)for(f=0;f<k;f++)h=j[f].position,g=f*3,p[g]=h.x,p[g+1]=h.y,p[g+2]=h.z;if(w)for(f=0;f<n;f++)color=u[f],g=f*3,t[g]=color.r,t[g+1]=color.g,t[g+2]=color.b;if(x)for(A in x)if(f=x[A],f.__original.needsUpdate){u=f.value.length;for(g=0;g<u;g++){n=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[n]=f.value[g]}else{if(f.boundTo===void 0||f.boundTo==="vertices")B=f.value[g];f.size===2?(f.array[n]=
|
|
|
+B.x,f.array[n+1]=B.y):f.size===3?f.type==="c"?(f.array[n]=B.r,f.array[n+1]=B.g,f.array[n+2]=B.b):(f.array[n]=B.x,f.array[n+1]=B.y,f.array[n+2]=B.z):(f.array[n]=B.x,f.array[n+1]=B.y,f.array[n+2]=B.z,f.array[n+3]=B.w)}f.offset+=f.size}}}if(v||e.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,b.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,p,c);if(w||e.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,b.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,t,c);if(x)for(A in x)if(f=x[A],f.__original.needsUpdate||e.sortParticles)m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
+f.buffer),m.bufferData(m.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,h){f.program||N.initMaterial(f,c,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(N.maxMorphTargets);for(var g=0,j=N.maxMorphTargets;g<j;g++)h.__webglMorphTargetInfluences[g]=0}var g=f.program,j=g.uniforms,k=f.uniforms;g!=V&&(m.useProgram(g),V=g);m.uniformMatrix4fv(j.projectionMatrix,!1,Q);if(e&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof
|
|
|
+THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(k.fogColor.value=e.color,e instanceof THREE.Fog)k.fogNear.value=e.near,k.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)k.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var n,u,p,t=0,o=0,v=0,w,B,x,A=na,z=A.directional.colors,F=A.directional.positions,I=A.point.colors,X=A.point.positions,C=A.point.distances,
|
|
|
+H=0,G=0,e=u=x=0;for(n=c.length;e<n;e++)if(u=c[e],p=u.color,w=u.position,B=u.intensity,x=u.distance,u instanceof THREE.AmbientLight)t+=p.r,o+=p.g,v+=p.b;else if(u instanceof THREE.DirectionalLight)x=H*3,z[x]=p.r*B,z[x+1]=p.g*B,z[x+2]=p.b*B,F[x]=w.x,F[x+1]=w.y,F[x+2]=w.z,H+=1;else if(u instanceof THREE.SpotLight)x=H*3,z[x]=p.r*B,z[x+1]=p.g*B,z[x+2]=p.b*B,p=1/w.length(),F[x]=w.x*p,F[x+1]=w.y*p,F[x+2]=w.z*p,H+=1;else if(u instanceof THREE.PointLight)u=G*3,I[u]=p.r*B,I[u+1]=p.g*B,I[u+2]=p.b*B,X[u]=w.x,
|
|
|
+X[u+1]=w.y,X[u+2]=w.z,C[G]=x,G+=1;for(e=H*3;e<z.length;e++)z[e]=0;for(e=G*3;e<I.length;e++)I[e]=0;A.point.length=G;A.directional.length=H;A.ambient[0]=t;A.ambient[1]=o;A.ambient[2]=v;c=na;k.enableLighting.value=c.directional.length+c.point.length;k.ambientLightColor.value=c.ambient;k.directionalLightColor.value=c.directional.colors;k.directionalLightDirection.value=c.directional.positions;k.pointLightColor.value=c.point.colors;k.pointLightPosition.value=c.point.positions;k.pointLightDistance.value=
|
|
|
c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity,(k.map.texture=f.map)&&k.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),k.lightMap.texture=f.lightMap,k.envMap.texture=f.envMap,k.reflectivity.value=f.reflectivity,k.refractionRatio.value=f.refractionRatio,k.combine.value=f.combine,k.useRefract.value=f.envMap&&f.envMap.mapping instanceof
|
|
|
THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)k.diffuse.value=f.color,k.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)k.psColor.value=f.color,k.opacity.value=f.opacity,k.size.value=f.size,k.scale.value=ua.height/2,k.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)k.ambient.value=f.ambient,k.specular.value=f.specular,k.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)k.mNear.value=b.near,k.mFar.value=b.far,k.opacity.value=
|
|
|
-f.opacity;else if(f instanceof THREE.MeshNormalMaterial)k.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&k.shadowMatrix){for(c=0;c<ta.length;c++)k.shadowMatrix.value[c]=ta[c],k.shadowMap.texture[c]=L.shadowMap[c];k.shadowDarkness.value=L.shadowMapDarkness;k.shadowBias.value=L.shadowMapBias}for(var E in k)if(m=g.uniforms[E])if(e=k[E],t=e.type,c=e.value,t=="i")n.uniform1i(m,c);else if(t=="f")n.uniform1f(m,c);else if(t=="fv1")n.uniform1fv(m,c);else if(t=="fv")n.uniform3fv(m,c);else if(t==
|
|
|
-"v2")n.uniform2f(m,c.x,c.y);else if(t=="v3")n.uniform3f(m,c.x,c.y,c.z);else if(t=="v4")n.uniform4f(m,c.x,c.y,c.z,c.w);else if(t=="m4"){if(!e._array)e._array=new Float32Array(16);c.flattenToArray(e._array);n.uniformMatrix4fv(m,!1,e._array)}else if(t=="m4v"){if(!e._array)e._array=new Float32Array(16*c.length);t=0;for(p=c.length;t<p;t++)c[t].flattenToArrayOffset(e._array,t*16);n.uniformMatrix4fv(m,!1,e._array)}else if(t=="c")n.uniform3f(m,c.r,c.g,c.b);else if(t=="t"){if(n.uniform1i(m,c),m=e.texture)if(m.image instanceof
|
|
|
-Array&&m.image.length==6){if(e=m,e.image.length==6){if(e.needsUpdate){if(e.__webglInit){n.bindTexture(n.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(m=0;m<6;++m)n.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,0,0,n.RGBA,n.UNSIGNED_BYTE,e.image[m])}else{e.image.__webglTextureCube=n.createTexture();n.bindTexture(n.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(m=0;m<6;++m)n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+m,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,e.image[m]);e.__webglInit=!0}O(n.TEXTURE_CUBE_MAP,
|
|
|
-e,e.image[0]);n.bindTexture(n.TEXTURE_CUBE_MAP,null);e.needsUpdate=!1}n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else N(m,c)}else if(t=="tv"){if(!e._array){e._array=[];t=0;for(p=e.texture.length;t<p;t++)e._array[t]=c+t}n.uniform1iv(m,e._array);t=0;for(p=e.texture.length;t<p;t++)(m=e.texture[t])&&N(m,e._array[t])}n.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);n.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
|
|
|
-f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&n.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&j.objectMatrix!==null&&n.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&n.uniformMatrix4fv(j.viewMatrix,!1,oa);f.skinning&&
|
|
|
-(n.uniformMatrix4fv(j.cameraInverseMatrix,!1,oa),n.uniformMatrix4fv(j.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,c,f,h,g,j){if(h.opacity!=0){var k,b=e(b,c,f,h,j).attributes;if(!h.morphTargets&&b.position>=0)n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer),n.vertexAttribPointer(b.position,3,n.FLOAT,!1,0,0);else if(j.morphTargetBase){c=h.program.attributes;j.morphTargetBase!==-1?(n.bindBuffer(n.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]),n.vertexAttribPointer(c.position,
|
|
|
-3,n.FLOAT,!1,0,0)):c.position>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer),n.vertexAttribPointer(c.position,3,n.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,m=j.morphTargetForcedOrder,o=j.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<m.length;)n.bindBuffer(n.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[m[f]]),n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=o[m[f]],f++;else{var m=[],u=-1,t=0,o=j.morphTargetInfluences,p,v=
|
|
|
-o.length,f=0;for(j.morphTargetBase!==-1&&(m[j.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(p=0;p<v;p++)!m[p]&&o[p]>u&&(t=p,u=o[t]);n.bindBuffer(n.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[t]);n.vertexAttribPointer(c["morphTarget"+f],3,n.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=u;m[t]=1;u=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&n.uniform1fv(h.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(k in g.__webglCustomAttributes)b[k]>=
|
|
|
-0&&(c=g.__webglCustomAttributes[k],n.bindBuffer(n.ARRAY_BUFFER,c.buffer),n.vertexAttribPointer(b[k],c.size,n.FLOAT,!1,0,0));b.color>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer),n.vertexAttribPointer(b.color,3,n.FLOAT,!1,0,0));b.normal>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglNormalBuffer),n.vertexAttribPointer(b.normal,3,n.FLOAT,!1,0,0));b.tangent>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglTangentBuffer),n.vertexAttribPointer(b.tangent,4,n.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(n.bindBuffer(n.ARRAY_BUFFER,
|
|
|
-g.__webglUVBuffer),n.vertexAttribPointer(b.uv,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv)):n.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(n.bindBuffer(n.ARRAY_BUFFER,g.__webglUV2Buffer),n.vertexAttribPointer(b.uv2,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(b.uv2)):n.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinVertexABuffer),n.vertexAttribPointer(b.skinVertexA,4,
|
|
|
-n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),n.vertexAttribPointer(b.skinVertexB,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),n.vertexAttribPointer(b.skinIndex,4,n.FLOAT,!1,0,0),n.bindBuffer(n.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),n.vertexAttribPointer(b.skinWeight,4,n.FLOAT,!1,0,0));j instanceof THREE.Mesh?(h.wireframe?(n.lineWidth(h.wireframeLinewidth),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),n.drawElements(n.LINES,g.__webglLineCount,
|
|
|
-n.UNSIGNED_SHORT,0)):(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),n.drawElements(n.TRIANGLES,g.__webglFaceCount,n.UNSIGNED_SHORT,0)),L.data.vertices+=g.__webglFaceCount,L.data.faces+=g.__webglFaceCount/3,L.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?n.LINE_STRIP:n.LINES,n.lineWidth(h.linewidth),n.drawArrays(j,0,g.__webglLineCount),L.data.drawCalls++):j instanceof THREE.ParticleSystem?(n.drawArrays(n.POINTS,0,g.__webglParticleCount),L.data.drawCalls++):j instanceof
|
|
|
-THREE.Ribbon&&(n.drawArrays(n.TRIANGLE_STRIP,0,g.__webglVertexCount),L.data.drawCalls++)}}function g(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=n.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=n.createBuffer();b.hasPos&&(n.bindBuffer(n.ARRAY_BUFFER,b.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,b.positionArray,n.DYNAMIC_DRAW),n.enableVertexAttribArray(c.attributes.position),n.vertexAttribPointer(c.attributes.position,3,n.FLOAT,!1,0,0));if(b.hasNormal){n.bindBuffer(n.ARRAY_BUFFER,
|
|
|
-b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,g,h,j,k,m,o,u,t,p,v=b.count*3;for(p=0;p<v;p+=9)e=b.normalArray,f=e[p],g=e[p+1],h=e[p+2],j=e[p+3],m=e[p+4],u=e[p+5],k=e[p+6],o=e[p+7],t=e[p+8],f=(f+j+k)/3,g=(g+m+o)/3,h=(h+u+t)/3,e[p]=f,e[p+1]=g,e[p+2]=h,e[p+3]=f,e[p+4]=g,e[p+5]=h,e[p+6]=f,e[p+7]=g,e[p+8]=h}n.bufferData(n.ARRAY_BUFFER,b.normalArray,n.DYNAMIC_DRAW);n.enableVertexAttribArray(c.attributes.normal);n.vertexAttribPointer(c.attributes.normal,3,n.FLOAT,!1,0,0)}n.drawArrays(n.TRIANGLES,
|
|
|
-0,b.count);b.count=0}function j(b){if(fa!=b.doubleSided)b.doubleSided?n.disable(n.CULL_FACE):n.enable(n.CULL_FACE),fa=b.doubleSided;if(W!=b.flipSided)b.flipSided?n.frontFace(n.CW):n.frontFace(n.CCW),W=b.flipSided}function h(b){Y!=b&&(b?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),Y=b)}function k(b,c,e){ea!=b&&(b?n.enable(n.POLYGON_OFFSET_FILL):n.disable(n.POLYGON_OFFSET_FILL),ea=b);if(b&&($!=c||ga!=e))n.polygonOffset(c,e),$=c,ga=e}function o(b){ia[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-
|
|
|
-b.n14);ia[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ia[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ia[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ia[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ia[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=ia[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function m(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),
|
|
|
-f=0;f<6;f++)if(b=ia[f].x*c.n14+ia[f].y*c.n24+ia[f].z*c.n34+ia[f].w,b<=e)return!1;return!0}function p(b,c){b.list[b.count]=c;b.count+=1}function u(b){var c,e,f=b.object,g=b.opaque,h=b.transparent;h.count=0;b=g.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?p(h,e):p(g,e)}function v(b){var c,e,f,g,h=b.object,j=b.buffer,k=b.opaque,n=b.transparent;n.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=j.materials.length;c<
|
|
|
-e;c++)(g=j.materials[c])&&(g.transparent?p(n,g):p(k,g))}else(g=c)&&(g.transparent?p(n,g):p(k,g))}function t(b,c){return c.z-b.z}function w(b,c){var k,u,t,p=0,v,w,x,A,z=b.lights;aa||(aa=new THREE.Camera(L.shadowCameraFov,c.aspect,L.shadowCameraNear,L.shadowCameraFar));k=0;for(u=z.length;k<u;k++)if(t=z[k],t instanceof THREE.SpotLight&&t.castShadow){L.shadowMap[p]||(L.shadowMap[p]=new THREE.WebGLRenderTarget(L.shadowMapWidth,L.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
-format:THREE.RGBAFormat}));ta[p]||(ta[p]=new THREE.Matrix4);v=L.shadowMap[p];w=ta[p];aa.position.copy(t.position);aa.target.position.copy(t.target.position);aa.update(void 0,!0);b.update(void 0,!1,aa);w.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);w.multiplySelf(aa.projectionMatrix);w.multiplySelf(aa.matrixWorldInverse);aa.matrixWorldInverse.flattenToArray(oa);aa.projectionMatrix.flattenToArray(R);ja.multiply(aa.projectionMatrix,aa.matrixWorldInverse);o(ja);L.initWebGLObjects(b);D(v);n.clearColor(1,
|
|
|
-1,1,1);L.clear();n.clearColor(va.r,va.g,va.b,ya);w=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(v=0;v<w;v++)x=b.__webglObjects[v],A=x.object,A.visible&&A.castShadow?!(A instanceof THREE.Mesh)||m(A)?(A.matrixWorld.flattenToArray(A._objectMatrixArray),B(A,aa,!1),x.render=!0):x.render=!1:x.render=!1;h(!0);C(THREE.NormalBlending);for(v=0;v<w;v++)if(x=b.__webglObjects[v],x.render)A=x.object,buffer=x.buffer,j(A),x=A.customDepthMaterial?A.customDepthMaterial:A.geometry.morphTargets.length?
|
|
|
-ma:pa,f(aa,z,null,x,buffer,A);for(v=0;v<t;v++)x=b.__webglObjectsImmediate[v],A=x.object,A.visible&&A.castShadow&&(A.matrixAutoUpdate&&A.matrixWorld.flattenToArray(A._objectMatrixArray),B(A,aa,!1),j(A),program=e(aa,z,null,pa,A),A.render(function(b){g(b,program,pa.shading)}));p++}}function x(b,c){var e,f,g;e=J.attributes;var h=J.uniforms,j=ka/Z,k,m=[],o=Z*0.5,u=ka*0.5,p=!0;n.useProgram(J.program);V=J.program;Y=ca=-1;za||(n.enableVertexAttribArray(J.attributes.position),n.enableVertexAttribArray(J.attributes.uv),
|
|
|
-za=!0);n.disable(n.CULL_FACE);n.enable(n.BLEND);n.depthMask(!0);n.bindBuffer(n.ARRAY_BUFFER,J.vertexBuffer);n.vertexAttribPointer(e.position,2,n.FLOAT,!1,16,0);n.vertexAttribPointer(e.uv,2,n.FLOAT,!1,16,8);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,J.elementBuffer);n.uniformMatrix4fv(h.projectionMatrix,!1,R);n.activeTexture(n.TEXTURE0);n.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
|
|
|
-g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(t);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(n.uniform1i(h.useScreenCoordinates,1),n.uniform3f(h.screenPosition,(g.position.x-o)/o,(u-g.position.y)/u,Math.max(0,Math.min(1,g.position.z)))):(n.uniform1i(h.useScreenCoordinates,0),n.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),n.uniformMatrix4fv(h.modelViewMatrix,
|
|
|
-!1,g._modelViewMatrixArray)),k=g.map.image.width/(g.scaleByViewport?ka:1),m[0]=k*j*g.scale.x,m[1]=k*g.scale.y,n.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),n.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),n.uniform2f(h.alignment,g.alignment.x,g.alignment.y),n.uniform1f(h.opacity,g.opacity),n.uniform1f(h.rotation,g.rotation),n.uniform2fv(h.scale,m),g.mergeWith3D&&!p?(n.enable(n.DEPTH_TEST),p=!0):!g.mergeWith3D&&p&&(n.disable(n.DEPTH_TEST),p=!1),C(g.blending),N(g.map,0),n.drawElements(n.TRIANGLES,
|
|
|
-6,n.UNSIGNED_SHORT,0));n.enable(n.CULL_FACE);n.enable(n.DEPTH_TEST);n.depthMask(Q)}function B(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function A(b){var c,e,f,g;g=b.__materials;b=0;for(e=g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function I(b){var c,e,f,g;g=b.__materials;b=0;for(e=
|
|
|
-g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function z(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function H(b){function c(b){var g=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?g.push("undefined"):g.push(b[e].id);return g.join("_")}var e,f,g,h,j,k,n,m,o={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(h=b.faces.length;g<h;g++)j=b.faces[g],k=j.materials,n=c(k),o[n]==void 0&&(o[n]={hash:n,counter:0}),
|
|
|
-m=o[n].hash+"_"+o[n].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:k,vertices:0,numMorphTargets:u}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[m].vertices+j>65535&&(o[n].counter+=1,m=o[n].hash+"_"+o[n].counter,b.geometryGroups[m]==void 0&&(b.geometryGroups[m]={faces:[],materials:k,vertices:0,numMorphTargets:u})),b.geometryGroups[m].faces.push(g),b.geometryGroups[m].vertices+=j}function G(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],
|
|
|
-count:0}})}function C(b){if(b!=ca){switch(b){case THREE.AdditiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE);break;case THREE.SubtractiveBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:n.blendEquation(n.FUNC_ADD);n.blendFunc(n.ZERO,n.SRC_COLOR);break;default:n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD),n.blendFuncSeparate(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA,n.ONE,n.ONE_MINUS_SRC_ALPHA)}ca=b}}function O(b,c,e){(e.width&
|
|
|
-e.width-1)==0&&(e.height&e.height-1)==0?(n.texParameteri(b,n.TEXTURE_WRAP_S,M(c.wrapS)),n.texParameteri(b,n.TEXTURE_WRAP_T,M(c.wrapT)),n.texParameteri(b,n.TEXTURE_MAG_FILTER,M(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,M(c.minFilter)),n.generateMipmap(b)):(n.texParameteri(b,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE),n.texParameteri(b,n.TEXTURE_MAG_FILTER,U(c.magFilter)),n.texParameteri(b,n.TEXTURE_MIN_FILTER,U(c.minFilter)))}function N(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
|
|
|
-n.createTexture(),b.__webglInit=!0;n.bindTexture(n.TEXTURE_2D,b.__webglTexture);b.image.data?n.texImage2D(n.TEXTURE_2D,0,M(b.format),b.image.width,b.image.height,0,M(b.format),n.UNSIGNED_BYTE,b.image.data):n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,b.image);O(n.TEXTURE_2D,b,b.image);n.bindTexture(n.TEXTURE_2D,null);b.needsUpdate=!1}n.activeTexture(n.TEXTURE0+c);n.bindTexture(n.TEXTURE_2D,b.__webglTexture)}function D(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=
|
|
|
-!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=n.createFramebuffer();b.__webglRenderbuffer=n.createRenderbuffer();b.__webglTexture=n.createTexture();n.bindTexture(n.TEXTURE_2D,b.__webglTexture);n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,M(b.wrapS));n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,M(b.wrapT));n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,M(b.magFilter));n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,M(b.minFilter));n.texImage2D(n.TEXTURE_2D,0,M(b.format),
|
|
|
-b.width,b.height,0,M(b.format),M(b.type),null);n.bindRenderbuffer(n.RENDERBUFFER,b.__webglRenderbuffer);n.bindFramebuffer(n.FRAMEBUFFER,b.__webglFramebuffer);n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_COMPONENT16,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(n.renderbufferStorage(n.RENDERBUFFER,
|
|
|
-n.DEPTH_STENCIL,b.width,b.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,b.__webglRenderbuffer)):n.renderbufferStorage(n.RENDERBUFFER,n.RGBA4,b.width,b.height);n.bindTexture(n.TEXTURE_2D,null);n.bindRenderbuffer(n.RENDERBUFFER,null);n.bindFramebuffer(n.FRAMEBUFFER,null)}var c,e;b?(c=b.__webglFramebuffer,e=b.width,b=b.height):(c=null,e=Z,b=ka);c!=X&&(n.bindFramebuffer(n.FRAMEBUFFER,c),n.viewport(K,da,e,b),X=c)}function E(b,c){var e;b=="fragment"?e=n.createShader(n.FRAGMENT_SHADER):
|
|
|
-b=="vertex"&&(e=n.createShader(n.VERTEX_SHADER));n.shaderSource(e,c);n.compileShader(e);if(!n.getShaderParameter(e,n.COMPILE_STATUS))return console.error(n.getShaderInfoLog(e)),console.error(c),null;return e}function U(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return n.NEAREST;default:return n.LINEAR}}function M(b){switch(b){case THREE.RepeatWrapping:return n.REPEAT;case THREE.ClampToEdgeWrapping:return n.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return n.MIRRORED_REPEAT;
|
|
|
-case THREE.NearestFilter:return n.NEAREST;case THREE.NearestMipMapNearestFilter:return n.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return n.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return n.LINEAR;case THREE.LinearMipMapNearestFilter:return n.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return n.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return n.BYTE;case THREE.UnsignedByteType:return n.UNSIGNED_BYTE;case THREE.ShortType:return n.SHORT;case THREE.UnsignedShortType:return n.UNSIGNED_SHORT;
|
|
|
-case THREE.IntType:return n.INT;case THREE.UnsignedShortType:return n.UNSIGNED_INT;case THREE.FloatType:return n.FLOAT;case THREE.AlphaFormat:return n.ALPHA;case THREE.RGBFormat:return n.RGB;case THREE.RGBAFormat:return n.RGBA;case THREE.LuminanceFormat:return n.LUMINANCE;case THREE.LuminanceAlphaFormat:return n.LUMINANCE_ALPHA}return 0}var L=this,n,S=[],V=null,X=null,Q=!0,fa=null,W=null,ca=null,Y=null,ea=null,$=null,ga=null,K=0,da=0,Z=0,ka=0,ia=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
|
|
|
-new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ja=new THREE.Matrix4,R=new Float32Array(16),oa=new Float32Array(16),qa=new THREE.Vector4,la={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ua=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ia=b.stencil!==void 0?b.stencil:!0,Ja=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,Ka=b.antialias!==void 0?b.antialias:!1,va=b.clearColor!==void 0?new THREE.Color(b.clearColor):
|
|
|
-new THREE.Color(0),ya=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ua;this.sortObjects=this.autoClear=!0;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=!0;var aa,ta=[],b=THREE.ShaderLib.depthRGBA,Ea=THREE.UniformsUtils.clone(b.uniforms),pa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,
|
|
|
-vertexShader:b.vertexShader,uniforms:Ea}),ma=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ea,morphTargets:!0});pa._shadowPass=!0;ma._shadowPass=!0;try{if(!(n=ua.getContext("experimental-webgl",{antialias:Ka,stencil:Ia,preserveDrawingBuffer:Ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+n.getParameter(n.VERSION)+" | "+n.getParameter(n.VENDOR)+" | "+n.getParameter(n.RENDERER)+" | "+n.getParameter(n.SHADING_LANGUAGE_VERSION))}catch(Ga){console.error(Ga)}n.clearColor(0,
|
|
|
-0,0,1);n.clearDepth(1);n.enable(n.DEPTH_TEST);n.depthFunc(n.LEQUAL);n.frontFace(n.CCW);n.cullFace(n.BACK);n.enable(n.CULL_FACE);n.enable(n.BLEND);n.blendEquation(n.FUNC_ADD);n.blendFunc(n.SRC_ALPHA,n.ONE_MINUS_SRC_ALPHA);n.clearColor(va.r,va.g,va.b,ya);this.context=n;var Da=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,J={};J.vertices=new Float32Array(16);J.faces=new Uint16Array(6);i=0;J.vertices[i++]=-1;J.vertices[i++]=-1;J.vertices[i++]=0;J.vertices[i++]=1;J.vertices[i++]=1;J.vertices[i++]=
|
|
|
--1;J.vertices[i++]=1;J.vertices[i++]=1;J.vertices[i++]=1;J.vertices[i++]=1;J.vertices[i++]=1;J.vertices[i++]=0;J.vertices[i++]=-1;J.vertices[i++]=1;J.vertices[i++]=0;i=J.vertices[i++]=0;J.faces[i++]=0;J.faces[i++]=1;J.faces[i++]=2;J.faces[i++]=0;J.faces[i++]=2;J.faces[i++]=3;J.vertexBuffer=n.createBuffer();J.elementBuffer=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,J.vertexBuffer);n.bufferData(n.ARRAY_BUFFER,J.vertices,n.STATIC_DRAW);n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,J.elementBuffer);n.bufferData(n.ELEMENT_ARRAY_BUFFER,
|
|
|
-J.faces,n.STATIC_DRAW);J.program=n.createProgram();n.attachShader(J.program,E("fragment",THREE.ShaderLib.sprite.fragmentShader));n.attachShader(J.program,E("vertex",THREE.ShaderLib.sprite.vertexShader));n.linkProgram(J.program);J.attributes={};J.uniforms={};J.attributes.position=n.getAttribLocation(J.program,"position");J.attributes.uv=n.getAttribLocation(J.program,"uv");J.uniforms.uvOffset=n.getUniformLocation(J.program,"uvOffset");J.uniforms.uvScale=n.getUniformLocation(J.program,"uvScale");J.uniforms.rotation=
|
|
|
-n.getUniformLocation(J.program,"rotation");J.uniforms.scale=n.getUniformLocation(J.program,"scale");J.uniforms.alignment=n.getUniformLocation(J.program,"alignment");J.uniforms.map=n.getUniformLocation(J.program,"map");J.uniforms.opacity=n.getUniformLocation(J.program,"opacity");J.uniforms.useScreenCoordinates=n.getUniformLocation(J.program,"useScreenCoordinates");J.uniforms.affectedByDistance=n.getUniformLocation(J.program,"affectedByDistance");J.uniforms.screenPosition=n.getUniformLocation(J.program,
|
|
|
-"screenPosition");J.uniforms.modelViewMatrix=n.getUniformLocation(J.program,"modelViewMatrix");J.uniforms.projectionMatrix=n.getUniformLocation(J.program,"projectionMatrix");var za=!1;this.setSize=function(b,c){ua.width=b;ua.height=c;this.setViewport(0,0,ua.width,ua.height)};this.setViewport=function(b,c,e,f){K=b;da=c;Z=e;ka=f;n.viewport(K,da,Z,ka)};this.setScissor=function(b,c,e,f){n.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?n.enable(n.SCISSOR_TEST):n.disable(n.SCISSOR_TEST)};this.enableDepthBufferWrite=
|
|
|
-function(b){Q=b;n.depthMask(b)};this.setClearColorHex=function(b,c){va.setHex(b);ya=c;n.clearColor(va.r,va.g,va.b,ya)};this.setClearColor=function(b,c){va.copy(b);ya=c;n.clearColor(va.r,va.g,va.b,ya)};this.clear=function(){n.clear(n.COLOR_BUFFER_BIT|n.DEPTH_BUFFER_BIT|n.STENCIL_BUFFER_BIT)};this.getContext=function(){return n};this.initMaterial=function(b,c,e,f){var g,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?
|
|
|
-j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var m,o,u;m=u=k=0;for(o=c.length;m<o;m++)h=c[m],h instanceof THREE.SpotLight&&u++,h instanceof THREE.DirectionalLight&&u++,h instanceof THREE.PointLight&&
|
|
|
-k++;k+u<=4?m=u:(m=Math.ceil(4*u/(k+u)),k=4-m);h={directional:m,point:k};k=u=0;for(m=c.length;k<m;k++)o=c[k],o instanceof THREE.SpotLight&&o.castShadow&&u++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var p;a:{m=b.fragmentShader;o=b.vertexShader;var k=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
|
-maxDirLights:h.directional,maxPointLights:h.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(m),f.push(o));for(v in e)f.push(v),f.push(e[v]);j=f.join();v=0;for(f=S.length;v<f;v++)if(S[v].code==j){p=S[v].program;break a}v=n.createProgram();f=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
|
|
|
+f.opacity;else if(f instanceof THREE.MeshNormalMaterial)k.opacity.value=f.opacity;if(h.receiveShadow&&!f._shadowPass&&k.shadowMatrix){for(c=0;c<ta.length;c++)k.shadowMatrix.value[c]=ta[c],k.shadowMap.texture[c]=N.shadowMap[c];k.shadowDarkness.value=N.shadowMapDarkness;k.shadowBias.value=N.shadowMapBias}for(var J in k)if(n=g.uniforms[J])if(e=k[J],t=e.type,c=e.value,t=="i")m.uniform1i(n,c);else if(t=="f")m.uniform1f(n,c);else if(t=="fv1")m.uniform1fv(n,c);else if(t=="fv")m.uniform3fv(n,c);else if(t==
|
|
|
+"v2")m.uniform2f(n,c.x,c.y);else if(t=="v3")m.uniform3f(n,c.x,c.y,c.z);else if(t=="v4")m.uniform4f(n,c.x,c.y,c.z,c.w);else if(t=="m4"){if(!e._array)e._array=new Float32Array(16);c.flattenToArray(e._array);m.uniformMatrix4fv(n,!1,e._array)}else if(t=="m4v"){if(!e._array)e._array=new Float32Array(16*c.length);t=0;for(o=c.length;t<o;t++)c[t].flattenToArrayOffset(e._array,t*16);m.uniformMatrix4fv(n,!1,e._array)}else if(t=="c")m.uniform3f(n,c.r,c.g,c.b);else if(t=="t"){if(m.uniform1i(n,c),n=e.texture)if(n.image instanceof
|
|
|
+Array&&n.image.length==6){if(e=n,e.image.length==6){if(e.needsUpdate){if(e.__webglInit){m.bindTexture(m.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(n=0;n<6;++n)m.texSubImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,0,0,m.RGBA,m.UNSIGNED_BYTE,e.image[n])}else{e.image.__webglTextureCube=m.createTexture();m.bindTexture(m.TEXTURE_CUBE_MAP,e.image.__webglTextureCube);for(n=0;n<6;++n)m.texImage2D(m.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,e.image[n]);e.__webglInit=!0}L(m.TEXTURE_CUBE_MAP,
|
|
|
+e,e.image[0]);m.bindTexture(m.TEXTURE_CUBE_MAP,null);e.needsUpdate=!1}m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_CUBE_MAP,e.image.__webglTextureCube)}}else D(n,c)}else if(t=="tv"){if(!e._array){e._array=[];t=0;for(o=e.texture.length;t<o;t++)e._array[t]=c+t}m.uniform1iv(n,e._array);t=0;for(o=e.texture.length;t<o;t++)(n=e.texture[t])&&D(n,e._array[t])}m.uniformMatrix4fv(j.modelViewMatrix,!1,h._modelViewMatrixArray);m.uniformMatrix3fv(j.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||
|
|
|
+f instanceof THREE.MeshPhongMaterial||f.envMap)&&j.cameraPosition!==null&&m.uniform3f(j.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&j.objectMatrix!==null&&m.uniformMatrix4fv(j.objectMatrix,!1,h._objectMatrixArray);(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&j.viewMatrix!==null&&m.uniformMatrix4fv(j.viewMatrix,!1,ma);f.skinning&&
|
|
|
+(m.uniformMatrix4fv(j.cameraInverseMatrix,!1,ma),m.uniformMatrix4fv(j.boneGlobalMatrices,!1,h.boneMatrices));return g}function f(b,c,f,h,g,j){if(h.opacity!=0){var k,b=e(b,c,f,h,j).attributes;if(!h.morphTargets&&b.position>=0)m.bindBuffer(m.ARRAY_BUFFER,g.__webglVertexBuffer),m.vertexAttribPointer(b.position,3,m.FLOAT,!1,0,0);else if(j.morphTargetBase){c=h.program.attributes;j.morphTargetBase!==-1?(m.bindBuffer(m.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[j.morphTargetBase]),m.vertexAttribPointer(c.position,
|
|
|
+3,m.FLOAT,!1,0,0)):c.position>=0&&(m.bindBuffer(m.ARRAY_BUFFER,g.__webglVertexBuffer),m.vertexAttribPointer(c.position,3,m.FLOAT,!1,0,0));if(j.morphTargetForcedOrder.length)for(var f=0,n=j.morphTargetForcedOrder,u=j.morphTargetInfluences;f<h.numSupportedMorphTargets&&f<n.length;)m.bindBuffer(m.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[n[f]]),m.vertexAttribPointer(c["morphTarget"+f],3,m.FLOAT,!1,0,0),j.__webglMorphTargetInfluences[f]=u[n[f]],f++;else{var n=[],p=-1,t=0,u=j.morphTargetInfluences,o,v=
|
|
|
+u.length,f=0;for(j.morphTargetBase!==-1&&(n[j.morphTargetBase]=!0);f<h.numSupportedMorphTargets;){for(o=0;o<v;o++)!n[o]&&u[o]>p&&(t=o,p=u[t]);m.bindBuffer(m.ARRAY_BUFFER,g.__webglMorphTargetsBuffers[t]);m.vertexAttribPointer(c["morphTarget"+f],3,m.FLOAT,!1,0,0);j.__webglMorphTargetInfluences[f]=p;n[t]=1;p=-1;f++}}h.program.uniforms.morphTargetInfluences!==null&&m.uniform1fv(h.program.uniforms.morphTargetInfluences,j.__webglMorphTargetInfluences)}if(g.__webglCustomAttributes)for(k in g.__webglCustomAttributes)b[k]>=
|
|
|
+0&&(c=g.__webglCustomAttributes[k],m.bindBuffer(m.ARRAY_BUFFER,c.buffer),m.vertexAttribPointer(b[k],c.size,m.FLOAT,!1,0,0));b.color>=0&&(m.bindBuffer(m.ARRAY_BUFFER,g.__webglColorBuffer),m.vertexAttribPointer(b.color,3,m.FLOAT,!1,0,0));b.normal>=0&&(m.bindBuffer(m.ARRAY_BUFFER,g.__webglNormalBuffer),m.vertexAttribPointer(b.normal,3,m.FLOAT,!1,0,0));b.tangent>=0&&(m.bindBuffer(m.ARRAY_BUFFER,g.__webglTangentBuffer),m.vertexAttribPointer(b.tangent,4,m.FLOAT,!1,0,0));b.uv>=0&&(g.__webglUVBuffer?(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
+g.__webglUVBuffer),m.vertexAttribPointer(b.uv,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(b.uv)):m.disableVertexAttribArray(b.uv));b.uv2>=0&&(g.__webglUV2Buffer?(m.bindBuffer(m.ARRAY_BUFFER,g.__webglUV2Buffer),m.vertexAttribPointer(b.uv2,2,m.FLOAT,!1,0,0),m.enableVertexAttribArray(b.uv2)):m.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(m.bindBuffer(m.ARRAY_BUFFER,g.__webglSkinVertexABuffer),m.vertexAttribPointer(b.skinVertexA,4,
|
|
|
+m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,g.__webglSkinVertexBBuffer),m.vertexAttribPointer(b.skinVertexB,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,g.__webglSkinIndicesBuffer),m.vertexAttribPointer(b.skinIndex,4,m.FLOAT,!1,0,0),m.bindBuffer(m.ARRAY_BUFFER,g.__webglSkinWeightsBuffer),m.vertexAttribPointer(b.skinWeight,4,m.FLOAT,!1,0,0));j instanceof THREE.Mesh?(h.wireframe?(m.lineWidth(h.wireframeLinewidth),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,g.__webglLineBuffer),m.drawElements(m.LINES,g.__webglLineCount,
|
|
|
+m.UNSIGNED_SHORT,0)):(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,g.__webglFaceBuffer),m.drawElements(m.TRIANGLES,g.__webglFaceCount,m.UNSIGNED_SHORT,0)),N.data.vertices+=g.__webglFaceCount,N.data.faces+=g.__webglFaceCount/3,N.data.drawCalls++):j instanceof THREE.Line?(j=j.type==THREE.LineStrip?m.LINE_STRIP:m.LINES,m.lineWidth(h.linewidth),m.drawArrays(j,0,g.__webglLineCount),N.data.drawCalls++):j instanceof THREE.ParticleSystem?(m.drawArrays(m.POINTS,0,g.__webglParticleCount),N.data.drawCalls++):j instanceof
|
|
|
+THREE.Ribbon&&(m.drawArrays(m.TRIANGLE_STRIP,0,g.__webglVertexCount),N.data.drawCalls++)}}function g(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=m.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=m.createBuffer();b.hasPos&&(m.bindBuffer(m.ARRAY_BUFFER,b.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,b.positionArray,m.DYNAMIC_DRAW),m.enableVertexAttribArray(c.attributes.position),m.vertexAttribPointer(c.attributes.position,3,m.FLOAT,!1,0,0));if(b.hasNormal){m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
+b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,g,h,j,k,n,u,p,t,o,v=b.count*3;for(o=0;o<v;o+=9)e=b.normalArray,f=e[o],g=e[o+1],h=e[o+2],j=e[o+3],n=e[o+4],p=e[o+5],k=e[o+6],u=e[o+7],t=e[o+8],f=(f+j+k)/3,g=(g+n+u)/3,h=(h+p+t)/3,e[o]=f,e[o+1]=g,e[o+2]=h,e[o+3]=f,e[o+4]=g,e[o+5]=h,e[o+6]=f,e[o+7]=g,e[o+8]=h}m.bufferData(m.ARRAY_BUFFER,b.normalArray,m.DYNAMIC_DRAW);m.enableVertexAttribArray(c.attributes.normal);m.vertexAttribPointer(c.attributes.normal,3,m.FLOAT,!1,0,0)}m.drawArrays(m.TRIANGLES,
|
|
|
+0,b.count);b.count=0}function j(b){if(Y!=b.doubleSided)b.doubleSided?m.disable(m.CULL_FACE):m.enable(m.CULL_FACE),Y=b.doubleSided;if(ha!=b.flipSided)b.flipSided?m.frontFace(m.CW):m.frontFace(m.CCW),ha=b.flipSided}function h(b){aa!=b&&(b?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),aa=b)}function k(b,c,e){ia!=b&&(b?m.enable(m.POLYGON_OFFSET_FILL):m.disable(m.POLYGON_OFFSET_FILL),ia=b);if(b&&(ca!=c||Z!=e))m.polygonOffset(c,e),ca=c,Z=e}function p(b){la[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-
|
|
|
+b.n14);la[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);la[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);la[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);la[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);la[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=la[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function t(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),
|
|
|
+f=0;f<6;f++)if(b=la[f].x*c.n14+la[f].y*c.n24+la[f].z*c.n34+la[f].w,b<=e)return!1;return!0}function o(b,c){b.list[b.count]=c;b.count+=1}function u(b){var c,e,f=b.object,g=b.opaque,h=b.transparent;h.count=0;b=g.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?o(h,e):o(g,e)}function v(b){var c,e,f,g,h=b.object,j=b.buffer,k=b.opaque,m=b.transparent;m.count=0;b=k.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=j.materials.length;c<
|
|
|
+e;c++)(g=j.materials[c])&&(g.transparent?o(m,g):o(k,g))}else(g=c)&&(g.transparent?o(m,g):o(k,g))}function n(b,c){return c.z-b.z}function w(b,c){var k,n,u,o=0,v,w,x,A,z=b.lights;ea||(ea=new THREE.Camera(N.shadowCameraFov,c.aspect,N.shadowCameraNear,N.shadowCameraFar));k=0;for(n=z.length;k<n;k++)if(u=z[k],u instanceof THREE.SpotLight&&u.castShadow){N.shadowMap[o]||(N.shadowMap[o]=new THREE.WebGLRenderTarget(N.shadowMapWidth,N.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,
|
|
|
+format:THREE.RGBAFormat}));ta[o]||(ta[o]=new THREE.Matrix4);v=N.shadowMap[o];w=ta[o];ea.position.copy(u.position);ea.target.position.copy(u.target.position);ea.update(void 0,!0);b.update(void 0,!1,ea);w.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);w.multiplySelf(ea.projectionMatrix);w.multiplySelf(ea.matrixWorldInverse);ea.matrixWorldInverse.flattenToArray(ma);ea.projectionMatrix.flattenToArray(Q);X.multiply(ea.projectionMatrix,ea.matrixWorldInverse);p(X);N.initWebGLObjects(b);H(v);m.clearColor(1,
|
|
|
+1,1,1);N.clear();m.clearColor(va.r,va.g,va.b,ya);w=b.__webglObjects.length;u=b.__webglObjectsImmediate.length;for(v=0;v<w;v++)x=b.__webglObjects[v],A=x.object,A.visible&&A.castShadow?!(A instanceof THREE.Mesh)||t(A)?(A.matrixWorld.flattenToArray(A._objectMatrixArray),B(A,ea,!1),x.render=!0):x.render=!1:x.render=!1;h(!0);C(THREE.NormalBlending);for(v=0;v<w;v++)if(x=b.__webglObjects[v],x.render)A=x.object,buffer=x.buffer,j(A),x=A.customDepthMaterial?A.customDepthMaterial:A.geometry.morphTargets.length?
|
|
|
+oa:qa,f(ea,z,null,x,buffer,A);for(v=0;v<u;v++)x=b.__webglObjectsImmediate[v],A=x.object,A.visible&&A.castShadow&&(A.matrixAutoUpdate&&A.matrixWorld.flattenToArray(A._objectMatrixArray),B(A,ea,!1),j(A),program=e(ea,z,null,qa,A),A.render(function(b){g(b,program,qa.shading)}));o++}}function x(b,c){var e,f,g;e=M.attributes;var h=M.uniforms,j=ja/$,k,u=[],p=$*0.5,t=ja*0.5,o=!0;m.useProgram(M.program);V=M.program;aa=da=-1;za||(m.enableVertexAttribArray(M.attributes.position),m.enableVertexAttribArray(M.attributes.uv),
|
|
|
+za=!0);m.disable(m.CULL_FACE);m.enable(m.BLEND);m.depthMask(!0);m.bindBuffer(m.ARRAY_BUFFER,M.vertexBuffer);m.vertexAttribPointer(e.position,2,m.FLOAT,!1,16,0);m.vertexAttribPointer(e.uv,2,m.FLOAT,!1,16,8);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,M.elementBuffer);m.uniformMatrix4fv(h.projectionMatrix,!1,Q);m.activeTexture(m.TEXTURE0);m.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.useScreenCoordinates?g.z=-g.position.z:(g._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
|
|
|
+g.matrixWorld,g._modelViewMatrixArray),g.z=-g._modelViewMatrix.n34);b.__webglSprites.sort(n);e=0;for(f=b.__webglSprites.length;e<f;e++)g=b.__webglSprites[e],g.material===void 0&&g.map&&g.map.image&&g.map.image.width&&(g.useScreenCoordinates?(m.uniform1i(h.useScreenCoordinates,1),m.uniform3f(h.screenPosition,(g.position.x-p)/p,(t-g.position.y)/t,Math.max(0,Math.min(1,g.position.z)))):(m.uniform1i(h.useScreenCoordinates,0),m.uniform1i(h.affectedByDistance,g.affectedByDistance?1:0),m.uniformMatrix4fv(h.modelViewMatrix,
|
|
|
+!1,g._modelViewMatrixArray)),k=g.map.image.width/(g.scaleByViewport?ja:1),u[0]=k*j*g.scale.x,u[1]=k*g.scale.y,m.uniform2f(h.uvScale,g.uvScale.x,g.uvScale.y),m.uniform2f(h.uvOffset,g.uvOffset.x,g.uvOffset.y),m.uniform2f(h.alignment,g.alignment.x,g.alignment.y),m.uniform1f(h.opacity,g.opacity),m.uniform1f(h.rotation,g.rotation),m.uniform2fv(h.scale,u),g.mergeWith3D&&!o?(m.enable(m.DEPTH_TEST),o=!0):!g.mergeWith3D&&o&&(m.disable(m.DEPTH_TEST),o=!1),C(g.blending),D(g.map,0),m.drawElements(m.TRIANGLES,
|
|
|
+6,m.UNSIGNED_SHORT,0));m.enable(m.CULL_FACE);m.enable(m.DEPTH_TEST);m.depthMask(R)}function B(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function A(b){var c,e,f,g;g=b.__materials;b=0;for(e=g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function F(b){var c,e,f,g;g=b.__materials;b=0;for(e=
|
|
|
+g.length;b<e;b++)if(f=g[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function z(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function G(b){function c(b){var g=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?g.push("undefined"):g.push(b[e].id);return g.join("_")}var e,f,g,h,j,k,m,n,u={},p=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};g=0;for(h=b.faces.length;g<h;g++)j=b.faces[g],k=j.materials,m=c(k),u[m]==void 0&&(u[m]={hash:m,counter:0}),
|
|
|
+n=u[m].hash+"_"+u[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p}),j=j instanceof THREE.Face3?3:4,b.geometryGroups[n].vertices+j>65535&&(u[m].counter+=1,n=u[m].hash+"_"+u[m].counter,b.geometryGroups[n]==void 0&&(b.geometryGroups[n]={faces:[],materials:k,vertices:0,numMorphTargets:p})),b.geometryGroups[n].faces.push(g),b.geometryGroups[n].vertices+=j}function I(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],
|
|
|
+count:0}})}function C(b){if(b!=da){switch(b){case THREE.AdditiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE);break;case THREE.SubtractiveBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:m.blendEquation(m.FUNC_ADD);m.blendFunc(m.ZERO,m.SRC_COLOR);break;default:m.blendEquationSeparate(m.FUNC_ADD,m.FUNC_ADD),m.blendFuncSeparate(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA,m.ONE,m.ONE_MINUS_SRC_ALPHA)}da=b}}function L(b,c,e){(e.width&
|
|
|
+e.width-1)==0&&(e.height&e.height-1)==0?(m.texParameteri(b,m.TEXTURE_WRAP_S,K(c.wrapS)),m.texParameteri(b,m.TEXTURE_WRAP_T,K(c.wrapT)),m.texParameteri(b,m.TEXTURE_MAG_FILTER,K(c.magFilter)),m.texParameteri(b,m.TEXTURE_MIN_FILTER,K(c.minFilter)),m.generateMipmap(b)):(m.texParameteri(b,m.TEXTURE_WRAP_S,m.CLAMP_TO_EDGE),m.texParameteri(b,m.TEXTURE_WRAP_T,m.CLAMP_TO_EDGE),m.texParameteri(b,m.TEXTURE_MAG_FILTER,J(c.magFilter)),m.texParameteri(b,m.TEXTURE_MIN_FILTER,J(c.minFilter)))}function D(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglTexture=
|
|
|
+m.createTexture(),b.__webglInit=!0;m.bindTexture(m.TEXTURE_2D,b.__webglTexture);b.image.data?m.texImage2D(m.TEXTURE_2D,0,K(b.format),b.image.width,b.image.height,0,K(b.format),m.UNSIGNED_BYTE,b.image.data):m.texImage2D(m.TEXTURE_2D,0,m.RGBA,m.RGBA,m.UNSIGNED_BYTE,b.image);L(m.TEXTURE_2D,b,b.image);m.bindTexture(m.TEXTURE_2D,null);b.needsUpdate=!1}m.activeTexture(m.TEXTURE0+c);m.bindTexture(m.TEXTURE_2D,b.__webglTexture)}function H(b){if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=
|
|
|
+!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglFramebuffer=m.createFramebuffer();b.__webglRenderbuffer=m.createRenderbuffer();b.__webglTexture=m.createTexture();m.bindTexture(m.TEXTURE_2D,b.__webglTexture);m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_S,K(b.wrapS));m.texParameteri(m.TEXTURE_2D,m.TEXTURE_WRAP_T,K(b.wrapT));m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MAG_FILTER,K(b.magFilter));m.texParameteri(m.TEXTURE_2D,m.TEXTURE_MIN_FILTER,K(b.minFilter));m.texImage2D(m.TEXTURE_2D,0,K(b.format),
|
|
|
+b.width,b.height,0,K(b.format),K(b.type),null);m.bindRenderbuffer(m.RENDERBUFFER,b.__webglRenderbuffer);m.bindFramebuffer(m.FRAMEBUFFER,b.__webglFramebuffer);m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,m.DEPTH_COMPONENT16,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_ATTACHMENT,m.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(m.renderbufferStorage(m.RENDERBUFFER,
|
|
|
+m.DEPTH_STENCIL,b.width,b.height),m.framebufferRenderbuffer(m.FRAMEBUFFER,m.DEPTH_STENCIL_ATTACHMENT,m.RENDERBUFFER,b.__webglRenderbuffer)):m.renderbufferStorage(m.RENDERBUFFER,m.RGBA4,b.width,b.height);m.bindTexture(m.TEXTURE_2D,null);m.bindRenderbuffer(m.RENDERBUFFER,null);m.bindFramebuffer(m.FRAMEBUFFER,null)}var c,e;b?(c=b.__webglFramebuffer,e=b.width,b=b.height):(c=null,e=$,b=ja);c!=W&&(m.bindFramebuffer(m.FRAMEBUFFER,c),m.viewport(P,fa,e,b),W=c)}function T(b,c){var e;b=="fragment"?e=m.createShader(m.FRAGMENT_SHADER):
|
|
|
+b=="vertex"&&(e=m.createShader(m.VERTEX_SHADER));m.shaderSource(e,c);m.compileShader(e);if(!m.getShaderParameter(e,m.COMPILE_STATUS))return console.error(m.getShaderInfoLog(e)),console.error(c),null;return e}function J(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return m.NEAREST;default:return m.LINEAR}}function K(b){switch(b){case THREE.RepeatWrapping:return m.REPEAT;case THREE.ClampToEdgeWrapping:return m.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return m.MIRRORED_REPEAT;
|
|
|
+case THREE.NearestFilter:return m.NEAREST;case THREE.NearestMipMapNearestFilter:return m.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return m.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return m.LINEAR;case THREE.LinearMipMapNearestFilter:return m.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return m.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return m.BYTE;case THREE.UnsignedByteType:return m.UNSIGNED_BYTE;case THREE.ShortType:return m.SHORT;case THREE.UnsignedShortType:return m.UNSIGNED_SHORT;
|
|
|
+case THREE.IntType:return m.INT;case THREE.UnsignedShortType:return m.UNSIGNED_INT;case THREE.FloatType:return m.FLOAT;case THREE.AlphaFormat:return m.ALPHA;case THREE.RGBFormat:return m.RGB;case THREE.RGBAFormat:return m.RGBA;case THREE.LuminanceFormat:return m.LUMINANCE;case THREE.LuminanceAlphaFormat:return m.LUMINANCE_ALPHA}return 0}var N=this,m,U=[],V=null,W=null,R=!0,Y=null,ha=null,da=null,aa=null,ia=null,ca=null,Z=null,P=0,fa=0,$=0,ja=0,la=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
|
|
|
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],X=new THREE.Matrix4,Q=new Float32Array(16),ma=new Float32Array(16),ka=new THREE.Vector4,na={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ua=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Ia=b.stencil!==void 0?b.stencil:!0,Ja=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,Ka=b.antialias!==void 0?b.antialias:!1,va=b.clearColor!==void 0?new THREE.Color(b.clearColor):
|
|
|
+new THREE.Color(0),ya=b.clearAlpha!==void 0?b.clearAlpha:0;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=ua;this.sortObjects=this.autoClear=!0;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=!0;var ea,ta=[],b=THREE.ShaderLib.depthRGBA,Ea=THREE.UniformsUtils.clone(b.uniforms),qa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,
|
|
|
+vertexShader:b.vertexShader,uniforms:Ea}),oa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ea,morphTargets:!0});qa._shadowPass=!0;oa._shadowPass=!0;try{if(!(m=ua.getContext("experimental-webgl",{antialias:Ka,stencil:Ia,preserveDrawingBuffer:Ja})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+m.getParameter(m.VERSION)+" | "+m.getParameter(m.VENDOR)+" | "+m.getParameter(m.RENDERER)+" | "+m.getParameter(m.SHADING_LANGUAGE_VERSION))}catch(Ga){console.error(Ga)}m.clearColor(0,
|
|
|
+0,0,1);m.clearDepth(1);m.enable(m.DEPTH_TEST);m.depthFunc(m.LEQUAL);m.frontFace(m.CCW);m.cullFace(m.BACK);m.enable(m.CULL_FACE);m.enable(m.BLEND);m.blendEquation(m.FUNC_ADD);m.blendFunc(m.SRC_ALPHA,m.ONE_MINUS_SRC_ALPHA);m.clearColor(va.r,va.g,va.b,ya);this.context=m;var Da=m.getParameter(m.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,M={};M.vertices=new Float32Array(16);M.faces=new Uint16Array(6);i=0;M.vertices[i++]=-1;M.vertices[i++]=-1;M.vertices[i++]=0;M.vertices[i++]=1;M.vertices[i++]=1;M.vertices[i++]=
|
|
|
+-1;M.vertices[i++]=1;M.vertices[i++]=1;M.vertices[i++]=1;M.vertices[i++]=1;M.vertices[i++]=1;M.vertices[i++]=0;M.vertices[i++]=-1;M.vertices[i++]=1;M.vertices[i++]=0;i=M.vertices[i++]=0;M.faces[i++]=0;M.faces[i++]=1;M.faces[i++]=2;M.faces[i++]=0;M.faces[i++]=2;M.faces[i++]=3;M.vertexBuffer=m.createBuffer();M.elementBuffer=m.createBuffer();m.bindBuffer(m.ARRAY_BUFFER,M.vertexBuffer);m.bufferData(m.ARRAY_BUFFER,M.vertices,m.STATIC_DRAW);m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,M.elementBuffer);m.bufferData(m.ELEMENT_ARRAY_BUFFER,
|
|
|
+M.faces,m.STATIC_DRAW);M.program=m.createProgram();m.attachShader(M.program,T("fragment",THREE.ShaderLib.sprite.fragmentShader));m.attachShader(M.program,T("vertex",THREE.ShaderLib.sprite.vertexShader));m.linkProgram(M.program);M.attributes={};M.uniforms={};M.attributes.position=m.getAttribLocation(M.program,"position");M.attributes.uv=m.getAttribLocation(M.program,"uv");M.uniforms.uvOffset=m.getUniformLocation(M.program,"uvOffset");M.uniforms.uvScale=m.getUniformLocation(M.program,"uvScale");M.uniforms.rotation=
|
|
|
+m.getUniformLocation(M.program,"rotation");M.uniforms.scale=m.getUniformLocation(M.program,"scale");M.uniforms.alignment=m.getUniformLocation(M.program,"alignment");M.uniforms.map=m.getUniformLocation(M.program,"map");M.uniforms.opacity=m.getUniformLocation(M.program,"opacity");M.uniforms.useScreenCoordinates=m.getUniformLocation(M.program,"useScreenCoordinates");M.uniforms.affectedByDistance=m.getUniformLocation(M.program,"affectedByDistance");M.uniforms.screenPosition=m.getUniformLocation(M.program,
|
|
|
+"screenPosition");M.uniforms.modelViewMatrix=m.getUniformLocation(M.program,"modelViewMatrix");M.uniforms.projectionMatrix=m.getUniformLocation(M.program,"projectionMatrix");var za=!1;this.setSize=function(b,c){ua.width=b;ua.height=c;this.setViewport(0,0,ua.width,ua.height)};this.setViewport=function(b,c,e,f){P=b;fa=c;$=e;ja=f;m.viewport(P,fa,$,ja)};this.setScissor=function(b,c,e,f){m.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?m.enable(m.SCISSOR_TEST):m.disable(m.SCISSOR_TEST)};this.enableDepthBufferWrite=
|
|
|
+function(b){R=b;m.depthMask(b)};this.setClearColorHex=function(b,c){va.setHex(b);ya=c;m.clearColor(va.r,va.g,va.b,ya)};this.setClearColor=function(b,c){va.copy(b);ya=c;m.clearColor(va.r,va.g,va.b,ya)};this.clear=function(){m.clear(m.COLOR_BUFFER_BIT|m.DEPTH_BUFFER_BIT|m.STENCIL_BUFFER_BIT)};this.getContext=function(){return m};this.initMaterial=function(b,c,e,f){var g,h,j;b instanceof THREE.MeshDepthMaterial?j="depth":b instanceof THREE.MeshNormalMaterial?j="normal":b instanceof THREE.MeshBasicMaterial?
|
|
|
+j="basic":b instanceof THREE.MeshLambertMaterial?j="lambert":b instanceof THREE.MeshPhongMaterial?j="phong":b instanceof THREE.LineBasicMaterial?j="basic":b instanceof THREE.ParticleBasicMaterial&&(j="particle_basic");if(j){var k=THREE.ShaderLib[j];b.uniforms=THREE.UniformsUtils.clone(k.uniforms);b.vertexShader=k.vertexShader;b.fragmentShader=k.fragmentShader}var n,u,p;n=p=k=0;for(u=c.length;n<u;n++)h=c[n],h instanceof THREE.SpotLight&&p++,h instanceof THREE.DirectionalLight&&p++,h instanceof THREE.PointLight&&
|
|
|
+k++;k+p<=4?n=p:(n=Math.ceil(4*p/(k+p)),k=4-n);h={directional:n,point:k};k=p=0;for(n=c.length;k<n;k++)u=c[k],u instanceof THREE.SpotLight&&u.castShadow&&p++;var t=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)t=f.bones.length;var o;a:{n=b.fragmentShader;u=b.vertexShader;var k=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
|
+maxDirLights:h.directional,maxPointLights:h.point,maxBones:t,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:p,alphaTest:b.alphaTest},v,f=[];j?f.push(j):(f.push(n),f.push(u));for(v in e)f.push(v),f.push(e[v]);j=f.join();v=0;for(f=U.length;v<f;v++)if(U[v].code==j){o=U[v].program;break a}v=m.createProgram();f=[Da?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
|
|
|
"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.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");
|
|
|
h=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.fog?"#define USE_FOG":"",e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":
|
|
|
-"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");n.attachShader(v,E("fragment",h+m));n.attachShader(v,E("vertex",f+o));n.linkProgram(v);n.getProgramParameter(v,n.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+n.getProgramParameter(v,n.VALIDATE_STATUS)+", gl error ["+n.getError()+"]");v.uniforms=
|
|
|
-{};v.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in k)f.push(w);w=f;f=0;for(k=w.length;f<k;f++)m=w[f],v.uniforms[m]=n.getUniformLocation(v,m);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<e.maxMorphTargets;w++)f.push("morphTarget"+w);for(p in c)f.push(p);p=f;w=0;for(c=p.length;w<c;w++)e=
|
|
|
-p[w],v.attributes[e]=n.getAttribLocation(v,e);S.push({program:v,code:j});p=v}b.program=p;p=b.program.attributes;p.position>=0&&n.enableVertexAttribArray(p.position);p.color>=0&&n.enableVertexAttribArray(p.color);p.normal>=0&&n.enableVertexAttribArray(p.normal);p.tangent>=0&&n.enableVertexAttribArray(p.tangent);b.skinning&&p.skinVertexA>=0&&p.skinVertexB>=0&&p.skinIndex>=0&&p.skinWeight>=0&&(n.enableVertexAttribArray(p.skinVertexA),n.enableVertexAttribArray(p.skinVertexB),n.enableVertexAttribArray(p.skinIndex),
|
|
|
-n.enableVertexAttribArray(p.skinWeight));if(b.attributes)for(g in b.attributes)p[g]!==void 0&&p[g]>=0&&n.enableVertexAttribArray(p[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)w="morphTarget"+g,p[w]>=0&&(n.enableVertexAttribArray(p[w]),b.numSupportedMorphTargets++)};this.render=function(b,c,p,A){var z,I,G,H,E,N,K,O,J=b.lights,M=b.fog;this.shadowMapEnabled&&w(b,c);L.data.vertices=0;L.data.faces=0;L.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
|
|
|
-!1,c);c.matrixWorldInverse.flattenToArray(oa);c.projectionMatrix.flattenToArray(R);ja.multiply(c.projectionMatrix,c.matrixWorldInverse);o(ja);this.initWebGLObjects(b);D(p);(this.autoClear||A)&&this.clear();E=b.__webglObjects.length;for(A=0;A<E;A++)if(z=b.__webglObjects[A],K=z.object,K.visible)if(!(K instanceof THREE.Mesh)||m(K)){if(K.matrixWorld.flattenToArray(K._objectMatrixArray),B(K,c,!0),v(z),z.render=!0,this.sortObjects)z.object.renderDepth?z.z=z.object.renderDepth:(qa.copy(K.position),ja.multiplyVector3(qa),
|
|
|
-z.z=qa.z)}else z.render=!1;else z.render=!1;this.sortObjects&&b.__webglObjects.sort(t);N=b.__webglObjectsImmediate.length;for(A=0;A<N;A++)z=b.__webglObjectsImmediate[A],K=z.object,K.visible&&(K.matrixAutoUpdate&&K.matrixWorld.flattenToArray(K._objectMatrixArray),B(K,c,!0),u(z));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);C(b.overrideMaterial.blending);for(A=0;A<E;A++)if(z=b.__webglObjects[A],z.render)K=z.object,O=z.buffer,j(K),f(c,J,M,b.overrideMaterial,O,K);for(A=0;A<N;A++)z=b.__webglObjectsImmediate[A],
|
|
|
-K=z.object,K.visible&&(j(K),I=e(c,J,M,b.overrideMaterial,K),K.render(function(c){g(c,I,b.overrideMaterial.shading)}))}else{C(THREE.NormalBlending);for(A=E-1;A>=0;A--)if(z=b.__webglObjects[A],z.render){K=z.object;O=z.buffer;G=z.opaque;j(K);for(z=0;z<G.count;z++)H=G.list[z],h(H.depthTest),k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,J,M,H,O,K)}for(A=0;A<N;A++)if(z=b.__webglObjectsImmediate[A],K=z.object,K.visible){G=z.opaque;j(K);for(z=0;z<G.count;z++)H=G.list[z],h(H.depthTest),
|
|
|
-k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),I=e(c,J,M,H,K),K.render(function(b){g(b,I,H.shading)})}for(A=0;A<E;A++)if(z=b.__webglObjects[A],z.render){K=z.object;O=z.buffer;G=z.transparent;j(K);for(z=0;z<G.count;z++)H=G.list[z],C(H.blending),h(H.depthTest),k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),f(c,J,M,H,O,K)}for(A=0;A<N;A++)if(z=b.__webglObjectsImmediate[A],K=z.object,K.visible){G=z.transparent;j(K);for(z=0;z<G.count;z++)H=G.list[z],C(H.blending),h(H.depthTest),
|
|
|
-k(H.polygonOffset,H.polygonOffsetFactor,H.polygonOffsetUnits),I=e(c,J,M,H,K),K.render(function(b){g(b,I,H.shading)})}}b.__webglSprites.length&&x(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&(n.bindTexture(n.TEXTURE_2D,p.__webglTexture),n.generateMipmap(n.TEXTURE_2D),n.bindTexture(n.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
|
|
|
-f=b,g=void 0,h=void 0,j=void 0;if(e._modelViewMatrix==void 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);if(e instanceof THREE.Mesh)for(g in h=e.geometry,h.geometryGroups==void 0&&H(h),h.geometryGroups){j=h.geometryGroups[g];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=n.createBuffer();k.__webglNormalBuffer=n.createBuffer();
|
|
|
-k.__webglTangentBuffer=n.createBuffer();k.__webglColorBuffer=n.createBuffer();k.__webglUVBuffer=n.createBuffer();k.__webglUV2Buffer=n.createBuffer();k.__webglSkinVertexABuffer=n.createBuffer();k.__webglSkinVertexBBuffer=n.createBuffer();k.__webglSkinIndicesBuffer=n.createBuffer();k.__webglSkinWeightsBuffer=n.createBuffer();k.__webglFaceBuffer=n.createBuffer();k.__webglLineBuffer=n.createBuffer();if(k.numMorphTargets){var m=void 0,o=void 0;k.__webglMorphTargetsBuffers=[];m=0;for(o=k.numMorphTargets;m<
|
|
|
-o;m++)k.__webglMorphTargetsBuffers.push(n.createBuffer())}for(var k=j,m=e,u=void 0,p=void 0,t=void 0,v=t=void 0,w=void 0,x=void 0,B=x=o=0,C=t=p=void 0,ja=C=p=u=void 0,t=void 0,v=m.geometry,w=v.faces,C=k.faces,u=0,p=C.length;u<p;u++)t=C[u],t=w[t],t instanceof THREE.Face3?(o+=3,x+=1,B+=3):t instanceof THREE.Face4&&(o+=4,x+=2,B+=4);for(var u=k,p=m,D=C=w=void 0,E=void 0,D=void 0,t=[],w=0,C=p.materials.length;w<C;w++)if(D=p.materials[w],D instanceof THREE.MeshFaceMaterial){D=0;for(l=u.materials.length;D<
|
|
|
-l;D++)(E=u.materials[D])&&t.push(E)}else(E=D)&&t.push(E);u=t;k.__materials=u;a:{w=p=void 0;C=u.length;for(p=0;p<C;p++)if(w=u[p],w.map||w.lightMap||w instanceof THREE.MeshShaderMaterial){p=!0;break a}p=!1}a:{C=w=void 0;t=u.length;for(w=0;w<t;w++)if(C=u[w],!(C instanceof THREE.MeshBasicMaterial&&!C.envMap||C instanceof THREE.MeshDepthMaterial)){C=C&&C.shading!=void 0&&C.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}C=!1}a:{t=w=void 0;D=u.length;for(w=0;w<D;w++)if(t=u[w],
|
|
|
-t.vertexColors){t=t.vertexColors;break a}t=!1}k.__vertexArray=new Float32Array(o*3);if(C)k.__normalArray=new Float32Array(o*3);if(v.hasTangents)k.__tangentArray=new Float32Array(o*4);if(t)k.__colorArray=new Float32Array(o*3);if(p){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)k.__uvArray=new Float32Array(o*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(o*2)}if(m.geometry.skinWeights.length&&m.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(o*4),
|
|
|
-k.__skinVertexBArray=new Float32Array(o*4),k.__skinIndexArray=new Float32Array(o*4),k.__skinWeightArray=new Float32Array(o*4);k.__faceArray=new Uint16Array(x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(B*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];v=0;for(w=k.numMorphTargets;v<w;v++)k.__morphTargetsArrays.push(new Float32Array(o*3))}k.__needsSmoothNormals=C==THREE.SmoothShading;k.__uvType=p;k.__vertexColorType=t;k.__normalType=C;k.__webglFaceCount=
|
|
|
-x*3+(m.geometry.edgeFaces?m.geometry.edgeFaces.length*6:0);k.__webglLineCount=B*2;v=0;for(w=u.length;v<w;v++)if(p=u[v],p.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in p.attributes){t=p.attributes[a];C={};for(ja in t)C[ja]=t[ja];if(!C.__webglInitialized||C.createUniqueBuffers)C.__webglInitialized=!0,x=1,C.type==="v2"?x=2:C.type==="v3"?x=3:C.type==="v4"?x=4:C.type==="c"&&(x=3),C.size=x,C.array=new Float32Array(o*x),C.buffer=n.createBuffer(),C.buffer.belongsToAttribute=
|
|
|
-a,t.needsUpdate=!0,C.__original=t;k.__webglCustomAttributes[a]=C}}k.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}G(f.__webglObjects,j,e)}else if(e instanceof THREE.Ribbon){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=n.createBuffer(),g.__webglColorBuffer=n.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*
|
|
|
-3),g.__webglVertexCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;G(f.__webglObjects,h,e)}else if(e instanceof THREE.Line){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=n.createBuffer(),g.__webglColorBuffer=n.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*3),g.__webglLineCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;G(f.__webglObjects,h,e)}else if(e instanceof THREE.ParticleSystem){h=e.geometry;if(!h.__webglVertexBuffer){g=
|
|
|
-h;g.__webglVertexBuffer=n.createBuffer();g.__webglColorBuffer=n.createBuffer();g=h;j=e;k=g.vertices.length;g.__vertexArray=new Float32Array(k*3);g.__colorArray=new Float32Array(k*3);g.__sortArray=[];g.__webglParticleCount=k;g.__materials=j.materials;ja=o=m=void 0;m=0;for(o=j.materials.length;m<o;m++)if(ja=j.materials[m],ja.attributes){if(g.__webglCustomAttributes===void 0)g.__webglCustomAttributes={};for(a in ja.attributes){originalAttribute=ja.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
|
|
|
-originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=n.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;g.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=
|
|
|
-!0;h.__dirtyColors=!0}G(f.__webglObjects,h,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)z(e.__webglObjects,f);else if(f instanceof
|
|
|
-THREE.Sprite){e=e.__webglSprites;h=void 0;for(h=e.length-1;h>=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof THREE.MarchingCubes&&z(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(g=b.__webglObjects[e].object,m=k=h=j=void 0,g instanceof THREE.Mesh){h=g.geometry;for(j in h.geometryGroups)if(k=h.geometryGroups[j],m=A(k),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
|
|
|
-m)if(m=k,o=n.DYNAMIC_DRAW,ja=!h.dynamic,m.__inittedArrays){var K=B=x=void 0,R=void 0,N=K=void 0,L=void 0,O=void 0,J=void 0,M=E=D=t=C=w=p=u=v=void 0,F=R=J=R=O=L=void 0,y=void 0,T=y=F=L=void 0,Q=void 0,oa=T=y=F=K=K=N=J=R=T=y=F=Q=T=y=F=Q=T=y=F=void 0,S=0,U=0,qa=0,ca=0,ga=0,da=0,V=0,Y=0,Z=0,P=0,W=0,T=F=0,T=void 0,X=m.__vertexArray,ea=m.__uvArray,fa=m.__uv2Array,ka=m.__normalArray,la=m.__tangentArray,ia=m.__colorArray,$=m.__skinVertexAArray,aa=m.__skinVertexBArray,ra=m.__skinIndexArray,sa=m.__skinWeightArray,
|
|
|
-ta=m.__morphTargetsArrays,ua=m.__webglCustomAttributes,y=void 0,pa=m.__faceArray,ma=m.__lineArray,va=m.__needsSmoothNormals,u=m.__vertexColorType,v=m.__uvType,p=m.__normalType,xa=g.geometry,ya=xa.__dirtyVertices,Ia=xa.__dirtyElements,za=xa.__dirtyUvs,Ja=xa.__dirtyNormals,Ka=xa.__dirtyTangents,Da=xa.__dirtyColors,Ea=xa.__dirtyMorphTargets,Pa=xa.vertices,Ga=m.faces,cb=xa.faces,ab=xa.faceVertexUvs[0],bb=xa.faceVertexUvs[1],Qa=xa.skinVerticesA,Ra=xa.skinVerticesB,Sa=xa.skinIndices,Ha=xa.skinWeights,Fa=
|
|
|
-xa.morphTargets;if(ua)for(oa in ua)ua[oa].offset=0,ua[oa].offsetSrc=0;x=0;for(B=Ga.length;x<B;x++)if(K=Ga[x],R=cb[K],ab&&(w=ab[K]),bb&&(C=bb[K]),K=R.vertexNormals,N=R.normal,L=R.vertexColors,O=R.color,J=R.vertexTangents,R instanceof THREE.Face3){if(ya)t=Pa[R.a].position,D=Pa[R.b].position,E=Pa[R.c].position,X[U]=t.x,X[U+1]=t.y,X[U+2]=t.z,X[U+3]=D.x,X[U+4]=D.y,X[U+5]=D.z,X[U+6]=E.x,X[U+7]=E.y,X[U+8]=E.z,U+=9;if(ua)for(oa in ua)if(y=ua[oa],y.__original.needsUpdate)F=y.offset,T=y.offsetSrc,y.size===
|
|
|
-1?(y.boundTo===void 0||y.boundTo==="vertices"?(y.array[F]=y.value[R.a],y.array[F+1]=y.value[R.b],y.array[F+2]=y.value[R.c]):y.boundTo==="faces"?(T=y.value[T],y.array[F]=T,y.array[F+1]=T,y.array[F+2]=T,y.offsetSrc++):y.boundTo==="faceVertices"&&(y.array[F]=y.value[T],y.array[F+1]=y.value[T+1],y.array[F+2]=y.value[T+2],y.offsetSrc+=3),y.offset+=3):(y.boundTo===void 0||y.boundTo==="vertices"?(t=y.value[R.a],D=y.value[R.b],E=y.value[R.c]):y.boundTo==="faces"?(E=D=t=T=y.value[T],y.offsetSrc++):y.boundTo===
|
|
|
-"faceVertices"&&(t=y.value[T],D=y.value[T+1],E=y.value[T+2],y.offsetSrc+=3),y.size===2?(y.array[F]=t.x,y.array[F+1]=t.y,y.array[F+2]=D.x,y.array[F+3]=D.y,y.array[F+4]=E.x,y.array[F+5]=E.y,y.offset+=6):y.size===3?(y.type==="c"?(y.array[F]=t.r,y.array[F+1]=t.g,y.array[F+2]=t.b,y.array[F+3]=D.r,y.array[F+4]=D.g,y.array[F+5]=D.b,y.array[F+6]=E.r,y.array[F+7]=E.g,y.array[F+8]=E.b):(y.array[F]=t.x,y.array[F+1]=t.y,y.array[F+2]=t.z,y.array[F+3]=D.x,y.array[F+4]=D.y,y.array[F+5]=D.z,y.array[F+6]=E.x,y.array[F+
|
|
|
-7]=E.y,y.array[F+8]=E.z),y.offset+=9):(y.array[F]=t.x,y.array[F+1]=t.y,y.array[F+2]=t.z,y.array[F+3]=t.w,y.array[F+4]=D.x,y.array[F+5]=D.y,y.array[F+6]=D.z,y.array[F+7]=D.w,y.array[F+8]=E.x,y.array[F+9]=E.y,y.array[F+10]=E.z,y.array[F+11]=E.w,y.offset+=12));if(Ea){F=0;for(y=Fa.length;F<y;F++)t=Fa[F].vertices[R.a].position,D=Fa[F].vertices[R.b].position,E=Fa[F].vertices[R.c].position,T=ta[F],T[W]=t.x,T[W+1]=t.y,T[W+2]=t.z,T[W+3]=D.x,T[W+4]=D.y,T[W+5]=D.z,T[W+6]=E.x,T[W+7]=E.y,T[W+8]=E.z;W+=9}if(Ha.length)F=
|
|
|
-Ha[R.a],y=Ha[R.b],T=Ha[R.c],sa[P]=F.x,sa[P+1]=F.y,sa[P+2]=F.z,sa[P+3]=F.w,sa[P+4]=y.x,sa[P+5]=y.y,sa[P+6]=y.z,sa[P+7]=y.w,sa[P+8]=T.x,sa[P+9]=T.y,sa[P+10]=T.z,sa[P+11]=T.w,F=Sa[R.a],y=Sa[R.b],T=Sa[R.c],ra[P]=F.x,ra[P+1]=F.y,ra[P+2]=F.z,ra[P+3]=F.w,ra[P+4]=y.x,ra[P+5]=y.y,ra[P+6]=y.z,ra[P+7]=y.w,ra[P+8]=T.x,ra[P+9]=T.y,ra[P+10]=T.z,ra[P+11]=T.w,F=Qa[R.a],y=Qa[R.b],T=Qa[R.c],$[P]=F.x,$[P+1]=F.y,$[P+2]=F.z,$[P+3]=1,$[P+4]=y.x,$[P+5]=y.y,$[P+6]=y.z,$[P+7]=1,$[P+8]=T.x,$[P+9]=T.y,$[P+10]=T.z,$[P+11]=1,
|
|
|
-F=Ra[R.a],y=Ra[R.b],T=Ra[R.c],aa[P]=F.x,aa[P+1]=F.y,aa[P+2]=F.z,aa[P+3]=1,aa[P+4]=y.x,aa[P+5]=y.y,aa[P+6]=y.z,aa[P+7]=1,aa[P+8]=T.x,aa[P+9]=T.y,aa[P+10]=T.z,aa[P+11]=1,P+=12;if(Da&&u)L.length==3&&u==THREE.VertexColors?(R=L[0],F=L[1],y=L[2]):y=F=R=O,ia[Z]=R.r,ia[Z+1]=R.g,ia[Z+2]=R.b,ia[Z+3]=F.r,ia[Z+4]=F.g,ia[Z+5]=F.b,ia[Z+6]=y.r,ia[Z+7]=y.g,ia[Z+8]=y.b,Z+=9;if(Ka&&xa.hasTangents)L=J[0],O=J[1],R=J[2],la[V]=L.x,la[V+1]=L.y,la[V+2]=L.z,la[V+3]=L.w,la[V+4]=O.x,la[V+5]=O.y,la[V+6]=O.z,la[V+7]=O.w,la[V+
|
|
|
-8]=R.x,la[V+9]=R.y,la[V+10]=R.z,la[V+11]=R.w,V+=12;if(Ja&&p)if(K.length==3&&va)for(J=0;J<3;J++)N=K[J],ka[da]=N.x,ka[da+1]=N.y,ka[da+2]=N.z,da+=3;else for(J=0;J<3;J++)ka[da]=N.x,ka[da+1]=N.y,ka[da+2]=N.z,da+=3;if(za&&w!==void 0&&v)for(J=0;J<3;J++)K=w[J],ea[qa]=K.u,ea[qa+1]=K.v,qa+=2;if(za&&C!==void 0&&v)for(J=0;J<3;J++)K=C[J],fa[ca]=K.u,fa[ca+1]=K.v,ca+=2;Ia&&(pa[ga]=S,pa[ga+1]=S+1,pa[ga+2]=S+2,ga+=3,ma[Y]=S,ma[Y+1]=S+1,ma[Y+2]=S,ma[Y+3]=S+2,ma[Y+4]=S+1,ma[Y+5]=S+2,Y+=6,S+=3)}else if(R instanceof THREE.Face4){if(ya)t=
|
|
|
-Pa[R.a].position,D=Pa[R.b].position,E=Pa[R.c].position,M=Pa[R.d].position,X[U]=t.x,X[U+1]=t.y,X[U+2]=t.z,X[U+3]=D.x,X[U+4]=D.y,X[U+5]=D.z,X[U+6]=E.x,X[U+7]=E.y,X[U+8]=E.z,X[U+9]=M.x,X[U+10]=M.y,X[U+11]=M.z,U+=12;if(ua)for(oa in ua)if(y=ua[oa],y.__original.needsUpdate)F=y.offset,T=y.offsetSrc,y.size===1?(y.boundTo===void 0||y.boundTo==="vertices"?(y.array[F]=y.value[R.a],y.array[F+1]=y.value[R.b],y.array[F+2]=y.value[R.c],y.array[F+3]=y.value[R.d]):y.boundTo==="faces"?(T=y.value[T],y.array[F]=T,y.array[F+
|
|
|
-1]=T,y.array[F+2]=T,y.array[F+3]=T,y.offsetSrc++):y.boundTo==="faceVertices"&&(y.array[F]=y.value[T],y.array[F+1]=y.value[T+1],y.array[F+2]=y.value[T+2],y.array[F+3]=y.value[T+3],y.offsetSrc+=4),y.offset+=4):(y.boundTo===void 0||y.boundTo==="vertices"?(t=y.value[R.a],D=y.value[R.b],E=y.value[R.c],M=y.value[R.d]):y.boundTo==="faces"?(M=E=D=t=T=y.value[T],y.offsetSrc++):y.boundTo==="faceVertices"&&(t=y.value[T],D=y.value[T+1],E=y.value[T+2],M=y.value[T+3],y.offsetSrc+=4),y.size===2?(y.array[F]=t.x,
|
|
|
-y.array[F+1]=t.y,y.array[F+2]=D.x,y.array[F+3]=D.y,y.array[F+4]=E.x,y.array[F+5]=E.y,y.array[F+6]=M.x,y.array[F+7]=M.y,y.offset+=8):y.size===3?(y.type==="c"?(y.array[F]=t.r,y.array[F+1]=t.g,y.array[F+2]=t.b,y.array[F+3]=D.r,y.array[F+4]=D.g,y.array[F+5]=D.b,y.array[F+6]=E.r,y.array[F+7]=E.g,y.array[F+8]=E.b,y.array[F+9]=M.r,y.array[F+10]=M.g,y.array[F+11]=M.b):(y.array[F]=t.x,y.array[F+1]=t.y,y.array[F+2]=t.z,y.array[F+3]=D.x,y.array[F+4]=D.y,y.array[F+5]=D.z,y.array[F+6]=E.x,y.array[F+7]=E.y,y.array[F+
|
|
|
-8]=E.z,y.array[F+9]=M.x,y.array[F+10]=M.y,y.array[F+11]=M.z),y.offset+=12):(y.array[F]=t.x,y.array[F+1]=t.y,y.array[F+2]=t.z,y.array[F+3]=t.w,y.array[F+4]=D.x,y.array[F+5]=D.y,y.array[F+6]=D.z,y.array[F+7]=D.w,y.array[F+8]=E.x,y.array[F+9]=E.y,y.array[F+10]=E.z,y.array[F+11]=E.w,y.array[F+12]=M.x,y.array[F+13]=M.y,y.array[F+14]=M.z,y.array[F+15]=M.w,y.offset+=16));if(Ea){F=0;for(y=Fa.length;F<y;F++)t=Fa[F].vertices[R.a].position,D=Fa[F].vertices[R.b].position,E=Fa[F].vertices[R.c].position,M=Fa[F].vertices[R.d].position,
|
|
|
-T=ta[F],T[W]=t.x,T[W+1]=t.y,T[W+2]=t.z,T[W+3]=D.x,T[W+4]=D.y,T[W+5]=D.z,T[W+6]=E.x,T[W+7]=E.y,T[W+8]=E.z,T[W+9]=M.x,T[W+10]=M.y,T[W+11]=M.z;W+=12}if(Ha.length)F=Ha[R.a],y=Ha[R.b],T=Ha[R.c],Q=Ha[R.d],sa[P]=F.x,sa[P+1]=F.y,sa[P+2]=F.z,sa[P+3]=F.w,sa[P+4]=y.x,sa[P+5]=y.y,sa[P+6]=y.z,sa[P+7]=y.w,sa[P+8]=T.x,sa[P+9]=T.y,sa[P+10]=T.z,sa[P+11]=T.w,sa[P+12]=Q.x,sa[P+13]=Q.y,sa[P+14]=Q.z,sa[P+15]=Q.w,F=Sa[R.a],y=Sa[R.b],T=Sa[R.c],Q=Sa[R.d],ra[P]=F.x,ra[P+1]=F.y,ra[P+2]=F.z,ra[P+3]=F.w,ra[P+4]=y.x,ra[P+5]=
|
|
|
-y.y,ra[P+6]=y.z,ra[P+7]=y.w,ra[P+8]=T.x,ra[P+9]=T.y,ra[P+10]=T.z,ra[P+11]=T.w,ra[P+12]=Q.x,ra[P+13]=Q.y,ra[P+14]=Q.z,ra[P+15]=Q.w,F=Qa[R.a],y=Qa[R.b],T=Qa[R.c],Q=Qa[R.d],$[P]=F.x,$[P+1]=F.y,$[P+2]=F.z,$[P+3]=1,$[P+4]=y.x,$[P+5]=y.y,$[P+6]=y.z,$[P+7]=1,$[P+8]=T.x,$[P+9]=T.y,$[P+10]=T.z,$[P+11]=1,$[P+12]=Q.x,$[P+13]=Q.y,$[P+14]=Q.z,$[P+15]=1,F=Ra[R.a],y=Ra[R.b],T=Ra[R.c],R=Ra[R.d],aa[P]=F.x,aa[P+1]=F.y,aa[P+2]=F.z,aa[P+3]=1,aa[P+4]=y.x,aa[P+5]=y.y,aa[P+6]=y.z,aa[P+7]=1,aa[P+8]=T.x,aa[P+9]=T.y,aa[P+
|
|
|
-10]=T.z,aa[P+11]=1,aa[P+12]=R.x,aa[P+13]=R.y,aa[P+14]=R.z,aa[P+15]=1,P+=16;if(Da&&u)L.length==4&&u==THREE.VertexColors?(R=L[0],F=L[1],y=L[2],L=L[3]):L=y=F=R=O,ia[Z]=R.r,ia[Z+1]=R.g,ia[Z+2]=R.b,ia[Z+3]=F.r,ia[Z+4]=F.g,ia[Z+5]=F.b,ia[Z+6]=y.r,ia[Z+7]=y.g,ia[Z+8]=y.b,ia[Z+9]=L.r,ia[Z+10]=L.g,ia[Z+11]=L.b,Z+=12;if(Ka&&xa.hasTangents)L=J[0],O=J[1],R=J[2],J=J[3],la[V]=L.x,la[V+1]=L.y,la[V+2]=L.z,la[V+3]=L.w,la[V+4]=O.x,la[V+5]=O.y,la[V+6]=O.z,la[V+7]=O.w,la[V+8]=R.x,la[V+9]=R.y,la[V+10]=R.z,la[V+11]=R.w,
|
|
|
-la[V+12]=J.x,la[V+13]=J.y,la[V+14]=J.z,la[V+15]=J.w,V+=16;if(Ja&&p)if(K.length==4&&va)for(J=0;J<4;J++)N=K[J],ka[da]=N.x,ka[da+1]=N.y,ka[da+2]=N.z,da+=3;else for(J=0;J<4;J++)ka[da]=N.x,ka[da+1]=N.y,ka[da+2]=N.z,da+=3;if(za&&w!==void 0&&v)for(J=0;J<4;J++)K=w[J],ea[qa]=K.u,ea[qa+1]=K.v,qa+=2;if(za&&C!==void 0&&v)for(J=0;J<4;J++)K=C[J],fa[ca]=K.u,fa[ca+1]=K.v,ca+=2;Ia&&(pa[ga]=S,pa[ga+1]=S+1,pa[ga+2]=S+3,pa[ga+3]=S+1,pa[ga+4]=S+2,pa[ga+5]=S+3,ga+=6,ma[Y]=S,ma[Y+1]=S+1,ma[Y+2]=S,ma[Y+3]=S+3,ma[Y+4]=S+
|
|
|
-1,ma[Y+5]=S+2,ma[Y+6]=S+2,ma[Y+7]=S+3,Y+=8,S+=4)}ya&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglVertexBuffer),n.bufferData(n.ARRAY_BUFFER,X,o));if(ua)for(oa in ua)y=ua[oa],y.__original.needsUpdate&&(n.bindBuffer(n.ARRAY_BUFFER,y.buffer),n.bufferData(n.ARRAY_BUFFER,y.array,o));if(Ea){F=0;for(y=Fa.length;F<y;F++)n.bindBuffer(n.ARRAY_BUFFER,m.__webglMorphTargetsBuffers[F]),n.bufferData(n.ARRAY_BUFFER,ta[F],o)}Da&&Z>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglColorBuffer),n.bufferData(n.ARRAY_BUFFER,ia,o));Ja&&
|
|
|
-(n.bindBuffer(n.ARRAY_BUFFER,m.__webglNormalBuffer),n.bufferData(n.ARRAY_BUFFER,ka,o));Ka&&xa.hasTangents&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglTangentBuffer),n.bufferData(n.ARRAY_BUFFER,la,o));za&&qa>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUVBuffer),n.bufferData(n.ARRAY_BUFFER,ea,o));za&&ca>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglUV2Buffer),n.bufferData(n.ARRAY_BUFFER,fa,o));Ia&&(n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,m.__webglFaceBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,pa,o),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,
|
|
|
-m.__webglLineBuffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,ma,o));P>0&&(n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexABuffer),n.bufferData(n.ARRAY_BUFFER,$,o),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinVertexBBuffer),n.bufferData(n.ARRAY_BUFFER,aa,o),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinIndicesBuffer),n.bufferData(n.ARRAY_BUFFER,ra,o),n.bindBuffer(n.ARRAY_BUFFER,m.__webglSkinWeightsBuffer),n.bufferData(n.ARRAY_BUFFER,sa,o));ja&&(delete m.__inittedArrays,delete m.__colorArray,delete m.__normalArray,
|
|
|
-delete m.__tangentArray,delete m.__uvArray,delete m.__uv2Array,delete m.__faceArray,delete m.__vertexArray,delete m.__lineArray,delete m.__skinVertexAArray,delete m.__skinVertexBArray,delete m.__skinIndexArray,delete m.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;I(k)}else if(g instanceof THREE.Ribbon){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=n.DYNAMIC_DRAW;k=B=x=x=
|
|
|
-void 0;v=g.vertices;m=g.colors;u=v.length;o=m.length;p=g.__vertexArray;ja=g.__colorArray;w=g.__dirtyColors;if(g.__dirtyVertices){for(x=0;x<u;x++)B=v[x].position,k=x*3,p[k]=B.x,p[k+1]=B.y,p[k+2]=B.z;n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,p,j)}if(w){for(x=0;x<o;x++)color=m[x],k=x*3,ja[k]=color.r,ja[k+1]=color.g,ja[k+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer);n.bufferData(n.ARRAY_BUFFER,ja,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof
|
|
|
-THREE.Line){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=n.DYNAMIC_DRAW;k=B=x=x=void 0;v=g.vertices;m=g.colors;u=v.length;o=m.length;p=g.__vertexArray;ja=g.__colorArray;w=g.__dirtyColors;if(g.__dirtyVertices){for(x=0;x<u;x++)B=v[x].position,k=x*3,p[k]=B.x,p[k+1]=B.y,p[k+2]=B.z;n.bindBuffer(n.ARRAY_BUFFER,g.__webglVertexBuffer);n.bufferData(n.ARRAY_BUFFER,p,j)}if(w){for(x=0;x<o;x++)color=m[x],k=x*3,ja[k]=color.r,ja[k+1]=color.g,ja[k+2]=color.b;n.bindBuffer(n.ARRAY_BUFFER,g.__webglColorBuffer);
|
|
|
-n.bufferData(n.ARRAY_BUFFER,ja,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem)h=g.geometry,m=A(h),(h.__dirtyVertices||h.__dirtyColors||g.sortParticles||m)&&c(h,n.DYNAMIC_DRAW,g),h.__dirtyVertices=!1,h.__dirtyColors=!1,I(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?n.frontFace(n.CCW):n.frontFace(n.CW),b=="back"?n.cullFace(n.BACK):b=="front"?n.cullFace(n.FRONT):n.cullFace(n.FRONT_AND_BACK),n.enable(n.CULL_FACE)):n.disable(n.CULL_FACE)};this.supportsVertexTextures=
|
|
|
-function(){return Da}};
|
|
|
+"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");m.attachShader(v,T("fragment",h+n));m.attachShader(v,T("vertex",f+u));m.linkProgram(v);m.getProgramParameter(v,m.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+m.getProgramParameter(v,m.VALIDATE_STATUS)+", gl error ["+m.getError()+"]");v.uniforms=
|
|
|
+{};v.attributes={};var w,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(w in k)f.push(w);w=f;f=0;for(k=w.length;f<k;f++)n=w[f],v.uniforms[n]=m.getUniformLocation(v,n);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(w=0;w<e.maxMorphTargets;w++)f.push("morphTarget"+w);for(o in c)f.push(o);o=f;w=0;for(c=o.length;w<c;w++)e=
|
|
|
+o[w],v.attributes[e]=m.getAttribLocation(v,e);U.push({program:v,code:j});o=v}b.program=o;o=b.program.attributes;o.position>=0&&m.enableVertexAttribArray(o.position);o.color>=0&&m.enableVertexAttribArray(o.color);o.normal>=0&&m.enableVertexAttribArray(o.normal);o.tangent>=0&&m.enableVertexAttribArray(o.tangent);b.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(m.enableVertexAttribArray(o.skinVertexA),m.enableVertexAttribArray(o.skinVertexB),m.enableVertexAttribArray(o.skinIndex),
|
|
|
+m.enableVertexAttribArray(o.skinWeight));if(b.attributes)for(g in b.attributes)o[g]!==void 0&&o[g]>=0&&m.enableVertexAttribArray(o[g]);if(b.morphTargets)for(g=b.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)w="morphTarget"+g,o[w]>=0&&(m.enableVertexAttribArray(o[w]),b.numSupportedMorphTargets++)};this.render=function(b,c,o,A){var z,F,I,G,J,L,D,P,K=b.lights,M=b.fog;this.shadowMapEnabled&&w(b,c);N.data.vertices=0;N.data.faces=0;N.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,
|
|
|
+!1,c);c.matrixWorldInverse.flattenToArray(ma);c.projectionMatrix.flattenToArray(Q);X.multiply(c.projectionMatrix,c.matrixWorldInverse);p(X);this.initWebGLObjects(b);H(o);(this.autoClear||A)&&this.clear();J=b.__webglObjects.length;for(A=0;A<J;A++)if(z=b.__webglObjects[A],D=z.object,D.visible)if(!(D instanceof THREE.Mesh)||t(D)){if(D.matrixWorld.flattenToArray(D._objectMatrixArray),B(D,c,!0),v(z),z.render=!0,this.sortObjects)z.object.renderDepth?z.z=z.object.renderDepth:(ka.copy(D.position),X.multiplyVector3(ka),
|
|
|
+z.z=ka.z)}else z.render=!1;else z.render=!1;this.sortObjects&&b.__webglObjects.sort(n);L=b.__webglObjectsImmediate.length;for(A=0;A<L;A++)z=b.__webglObjectsImmediate[A],D=z.object,D.visible&&(D.matrixAutoUpdate&&D.matrixWorld.flattenToArray(D._objectMatrixArray),B(D,c,!0),u(z));if(b.overrideMaterial){h(b.overrideMaterial.depthTest);C(b.overrideMaterial.blending);for(A=0;A<J;A++)if(z=b.__webglObjects[A],z.render)D=z.object,P=z.buffer,j(D),f(c,K,M,b.overrideMaterial,P,D);for(A=0;A<L;A++)z=b.__webglObjectsImmediate[A],
|
|
|
+D=z.object,D.visible&&(j(D),F=e(c,K,M,b.overrideMaterial,D),D.render(function(c){g(c,F,b.overrideMaterial.shading)}))}else{C(THREE.NormalBlending);for(A=J-1;A>=0;A--)if(z=b.__webglObjects[A],z.render){D=z.object;P=z.buffer;I=z.opaque;j(D);for(z=0;z<I.count;z++)G=I.list[z],h(G.depthTest),k(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),f(c,K,M,G,P,D)}for(A=0;A<L;A++)if(z=b.__webglObjectsImmediate[A],D=z.object,D.visible){I=z.opaque;j(D);for(z=0;z<I.count;z++)G=I.list[z],h(G.depthTest),
|
|
|
+k(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),F=e(c,K,M,G,D),D.render(function(b){g(b,F,G.shading)})}for(A=0;A<J;A++)if(z=b.__webglObjects[A],z.render){D=z.object;P=z.buffer;I=z.transparent;j(D);for(z=0;z<I.count;z++)G=I.list[z],C(G.blending),h(G.depthTest),k(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),f(c,K,M,G,P,D)}for(A=0;A<L;A++)if(z=b.__webglObjectsImmediate[A],D=z.object,D.visible){I=z.transparent;j(D);for(z=0;z<I.count;z++)G=I.list[z],C(G.blending),h(G.depthTest),
|
|
|
+k(G.polygonOffset,G.polygonOffsetFactor,G.polygonOffsetUnits),F=e(c,K,M,G,D),D.render(function(b){g(b,F,G.shading)})}}b.__webglSprites.length&&x(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&(m.bindTexture(m.TEXTURE_2D,o.__webglTexture),m.generateMipmap(m.TEXTURE_2D),m.bindTexture(m.TEXTURE_2D,null))};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],
|
|
|
+f=b,g=void 0,h=void 0,j=void 0;if(e._modelViewMatrix==void 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);if(e instanceof THREE.Mesh)for(g in h=e.geometry,h.geometryGroups==void 0&&G(h),h.geometryGroups){j=h.geometryGroups[g];if(!j.__webglVertexBuffer){var k=j;k.__webglVertexBuffer=m.createBuffer();k.__webglNormalBuffer=m.createBuffer();
|
|
|
+k.__webglTangentBuffer=m.createBuffer();k.__webglColorBuffer=m.createBuffer();k.__webglUVBuffer=m.createBuffer();k.__webglUV2Buffer=m.createBuffer();k.__webglSkinVertexABuffer=m.createBuffer();k.__webglSkinVertexBBuffer=m.createBuffer();k.__webglSkinIndicesBuffer=m.createBuffer();k.__webglSkinWeightsBuffer=m.createBuffer();k.__webglFaceBuffer=m.createBuffer();k.__webglLineBuffer=m.createBuffer();if(k.numMorphTargets){var n=void 0,u=void 0;k.__webglMorphTargetsBuffers=[];n=0;for(u=k.numMorphTargets;n<
|
|
|
+u;n++)k.__webglMorphTargetsBuffers.push(m.createBuffer())}for(var k=j,n=e,p=void 0,t=void 0,o=void 0,v=o=void 0,w=void 0,x=void 0,B=x=u=0,X=o=t=void 0,H=X=t=p=void 0,o=void 0,v=n.geometry,w=v.faces,X=k.faces,p=0,t=X.length;p<t;p++)o=X[p],o=w[o],o instanceof THREE.Face3?(u+=3,x+=1,B+=3):o instanceof THREE.Face4&&(u+=4,x+=2,B+=4);for(var p=k,t=n,C=X=w=void 0,D=void 0,C=void 0,o=[],w=0,X=t.materials.length;w<X;w++)if(C=t.materials[w],C instanceof THREE.MeshFaceMaterial){C=0;for(l=p.materials.length;C<
|
|
|
+l;C++)(D=p.materials[C])&&o.push(D)}else(D=C)&&o.push(D);p=o;k.__materials=p;a:{w=t=void 0;X=p.length;for(t=0;t<X;t++)if(w=p[t],w.map||w.lightMap||w instanceof THREE.MeshShaderMaterial){t=!0;break a}t=!1}a:{X=w=void 0;o=p.length;for(w=0;w<o;w++)if(X=p[w],!(X instanceof THREE.MeshBasicMaterial&&!X.envMap||X instanceof THREE.MeshDepthMaterial)){X=X&&X.shading!=void 0&&X.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}X=!1}a:{o=w=void 0;C=p.length;for(w=0;w<C;w++)if(o=p[w],
|
|
|
+o.vertexColors){o=o.vertexColors;break a}o=!1}k.__vertexArray=new Float32Array(u*3);if(X)k.__normalArray=new Float32Array(u*3);if(v.hasTangents)k.__tangentArray=new Float32Array(u*4);if(o)k.__colorArray=new Float32Array(u*3);if(t){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)k.__uvArray=new Float32Array(u*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)k.__uv2Array=new Float32Array(u*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)k.__skinVertexAArray=new Float32Array(u*4),
|
|
|
+k.__skinVertexBArray=new Float32Array(u*4),k.__skinIndexArray=new Float32Array(u*4),k.__skinWeightArray=new Float32Array(u*4);k.__faceArray=new Uint16Array(x*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));k.__lineArray=new Uint16Array(B*2);if(k.numMorphTargets){k.__morphTargetsArrays=[];v=0;for(w=k.numMorphTargets;v<w;v++)k.__morphTargetsArrays.push(new Float32Array(u*3))}k.__needsSmoothNormals=X==THREE.SmoothShading;k.__uvType=t;k.__vertexColorType=o;k.__normalType=X;k.__webglFaceCount=
|
|
|
+x*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);k.__webglLineCount=B*2;v=0;for(w=p.length;v<w;v++)if(t=p[v],t.attributes){if(k.__webglCustomAttributes===void 0)k.__webglCustomAttributes={};for(a in t.attributes){o=t.attributes[a];X={};for(H in o)X[H]=o[H];if(!X.__webglInitialized||X.createUniqueBuffers)X.__webglInitialized=!0,x=1,X.type==="v2"?x=2:X.type==="v3"?x=3:X.type==="v4"?x=4:X.type==="c"&&(x=3),X.size=x,X.array=new Float32Array(u*x),X.buffer=m.createBuffer(),X.buffer.belongsToAttribute=
|
|
|
+a,o.needsUpdate=!0,X.__original=o;k.__webglCustomAttributes[a]=X}}k.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}I(f.__webglObjects,j,e)}else if(e instanceof THREE.Ribbon){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=m.createBuffer(),g.__webglColorBuffer=m.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*
|
|
|
+3),g.__webglVertexCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;I(f.__webglObjects,h,e)}else if(e instanceof THREE.Line){h=e.geometry;if(!h.__webglVertexBuffer)g=h,g.__webglVertexBuffer=m.createBuffer(),g.__webglColorBuffer=m.createBuffer(),g=h,j=g.vertices.length,g.__vertexArray=new Float32Array(j*3),g.__colorArray=new Float32Array(j*3),g.__webglLineCount=j,h.__dirtyVertices=!0,h.__dirtyColors=!0;I(f.__webglObjects,h,e)}else if(e instanceof THREE.ParticleSystem){h=e.geometry;if(!h.__webglVertexBuffer){g=
|
|
|
+h;g.__webglVertexBuffer=m.createBuffer();g.__webglColorBuffer=m.createBuffer();g=h;j=e;k=g.vertices.length;g.__vertexArray=new Float32Array(k*3);g.__colorArray=new Float32Array(k*3);g.__sortArray=[];g.__webglParticleCount=k;g.__materials=j.materials;H=u=n=void 0;n=0;for(u=j.materials.length;n<u;n++)if(H=j.materials[n],H.attributes){if(g.__webglCustomAttributes===void 0)g.__webglCustomAttributes={};for(a in H.attributes){originalAttribute=H.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
|
|
|
+originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(k*size),attribute.buffer=m.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;g.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=
|
|
|
+!0;h.__dirtyColors=!0}I(f.__webglObjects,h,e)}else THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){f=b.__objectsRemoved[0];e=b;if(f instanceof THREE.Mesh||f instanceof THREE.ParticleSystem||f instanceof THREE.Ribbon||f instanceof THREE.Line)z(e.__webglObjects,f);else if(f instanceof
|
|
|
+THREE.Sprite){e=e.__webglSprites;h=void 0;for(h=e.length-1;h>=0;h--)e[h]==f&&e.splice(h,1)}else f instanceof THREE.MarchingCubes&&z(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(g=b.__webglObjects[e].object,n=k=h=j=void 0,g instanceof THREE.Mesh){h=g.geometry;for(j in h.geometryGroups)if(k=h.geometryGroups[j],n=A(k),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||
|
|
|
+n)if(n=k,u=m.DYNAMIC_DRAW,H=!h.dynamic,n.__inittedArrays){var J=B=x=void 0,Q=void 0,L=J=void 0,P=void 0,N=void 0,K=void 0,M=D=C=o=X=w=t=p=v=void 0,E=Q=K=Q=N=P=void 0,y=void 0,S=y=E=P=void 0,ma=void 0,R=S=y=E=J=J=L=K=Q=S=y=E=ma=S=y=E=ma=S=y=E=void 0,ka=0,T=0,da=0,V=0,fa=0,U=0,$=0,ja=0,W=0,O=0,Y=0,S=E=0,S=void 0,Z=n.__vertexArray,ha=n.__uvArray,ia=n.__uv2Array,la=n.__normalArray,aa=n.__tangentArray,ca=n.__colorArray,na=n.__skinVertexAArray,ea=n.__skinVertexBArray,ra=n.__skinIndexArray,sa=n.__skinWeightArray,
|
|
|
+ta=n.__morphTargetsArrays,ua=n.__webglCustomAttributes,y=void 0,qa=n.__faceArray,oa=n.__lineArray,va=n.__needsSmoothNormals,p=n.__vertexColorType,v=n.__uvType,t=n.__normalType,xa=g.geometry,ya=xa.__dirtyVertices,Ia=xa.__dirtyElements,za=xa.__dirtyUvs,Ja=xa.__dirtyNormals,Ka=xa.__dirtyTangents,Da=xa.__dirtyColors,Ea=xa.__dirtyMorphTargets,Pa=xa.vertices,Ga=n.faces,cb=xa.faces,ab=xa.faceVertexUvs[0],bb=xa.faceVertexUvs[1],Qa=xa.skinVerticesA,Ra=xa.skinVerticesB,Sa=xa.skinIndices,Ha=xa.skinWeights,Fa=
|
|
|
+xa.morphTargets;if(ua)for(R in ua)ua[R].offset=0,ua[R].offsetSrc=0;x=0;for(B=Ga.length;x<B;x++)if(J=Ga[x],Q=cb[J],ab&&(w=ab[J]),bb&&(X=bb[J]),J=Q.vertexNormals,L=Q.normal,P=Q.vertexColors,N=Q.color,K=Q.vertexTangents,Q instanceof THREE.Face3){if(ya)o=Pa[Q.a].position,C=Pa[Q.b].position,D=Pa[Q.c].position,Z[T]=o.x,Z[T+1]=o.y,Z[T+2]=o.z,Z[T+3]=C.x,Z[T+4]=C.y,Z[T+5]=C.z,Z[T+6]=D.x,Z[T+7]=D.y,Z[T+8]=D.z,T+=9;if(ua)for(R in ua)if(y=ua[R],y.__original.needsUpdate)E=y.offset,S=y.offsetSrc,y.size===1?(y.boundTo===
|
|
|
+void 0||y.boundTo==="vertices"?(y.array[E]=y.value[Q.a],y.array[E+1]=y.value[Q.b],y.array[E+2]=y.value[Q.c]):y.boundTo==="faces"?(S=y.value[S],y.array[E]=S,y.array[E+1]=S,y.array[E+2]=S,y.offsetSrc++):y.boundTo==="faceVertices"&&(y.array[E]=y.value[S],y.array[E+1]=y.value[S+1],y.array[E+2]=y.value[S+2],y.offsetSrc+=3),y.offset+=3):(y.boundTo===void 0||y.boundTo==="vertices"?(o=y.value[Q.a],C=y.value[Q.b],D=y.value[Q.c]):y.boundTo==="faces"?(D=C=o=S=y.value[S],y.offsetSrc++):y.boundTo==="faceVertices"&&
|
|
|
+(o=y.value[S],C=y.value[S+1],D=y.value[S+2],y.offsetSrc+=3),y.size===2?(y.array[E]=o.x,y.array[E+1]=o.y,y.array[E+2]=C.x,y.array[E+3]=C.y,y.array[E+4]=D.x,y.array[E+5]=D.y,y.offset+=6):y.size===3?(y.type==="c"?(y.array[E]=o.r,y.array[E+1]=o.g,y.array[E+2]=o.b,y.array[E+3]=C.r,y.array[E+4]=C.g,y.array[E+5]=C.b,y.array[E+6]=D.r,y.array[E+7]=D.g,y.array[E+8]=D.b):(y.array[E]=o.x,y.array[E+1]=o.y,y.array[E+2]=o.z,y.array[E+3]=C.x,y.array[E+4]=C.y,y.array[E+5]=C.z,y.array[E+6]=D.x,y.array[E+7]=D.y,y.array[E+
|
|
|
+8]=D.z),y.offset+=9):(y.array[E]=o.x,y.array[E+1]=o.y,y.array[E+2]=o.z,y.array[E+3]=o.w,y.array[E+4]=C.x,y.array[E+5]=C.y,y.array[E+6]=C.z,y.array[E+7]=C.w,y.array[E+8]=D.x,y.array[E+9]=D.y,y.array[E+10]=D.z,y.array[E+11]=D.w,y.offset+=12));if(Ea){E=0;for(y=Fa.length;E<y;E++)o=Fa[E].vertices[Q.a].position,C=Fa[E].vertices[Q.b].position,D=Fa[E].vertices[Q.c].position,S=ta[E],S[Y]=o.x,S[Y+1]=o.y,S[Y+2]=o.z,S[Y+3]=C.x,S[Y+4]=C.y,S[Y+5]=C.z,S[Y+6]=D.x,S[Y+7]=D.y,S[Y+8]=D.z;Y+=9}if(Ha.length)E=Ha[Q.a],
|
|
|
+y=Ha[Q.b],S=Ha[Q.c],sa[O]=E.x,sa[O+1]=E.y,sa[O+2]=E.z,sa[O+3]=E.w,sa[O+4]=y.x,sa[O+5]=y.y,sa[O+6]=y.z,sa[O+7]=y.w,sa[O+8]=S.x,sa[O+9]=S.y,sa[O+10]=S.z,sa[O+11]=S.w,E=Sa[Q.a],y=Sa[Q.b],S=Sa[Q.c],ra[O]=E.x,ra[O+1]=E.y,ra[O+2]=E.z,ra[O+3]=E.w,ra[O+4]=y.x,ra[O+5]=y.y,ra[O+6]=y.z,ra[O+7]=y.w,ra[O+8]=S.x,ra[O+9]=S.y,ra[O+10]=S.z,ra[O+11]=S.w,E=Qa[Q.a],y=Qa[Q.b],S=Qa[Q.c],na[O]=E.x,na[O+1]=E.y,na[O+2]=E.z,na[O+3]=1,na[O+4]=y.x,na[O+5]=y.y,na[O+6]=y.z,na[O+7]=1,na[O+8]=S.x,na[O+9]=S.y,na[O+10]=S.z,na[O+11]=
|
|
|
+1,E=Ra[Q.a],y=Ra[Q.b],S=Ra[Q.c],ea[O]=E.x,ea[O+1]=E.y,ea[O+2]=E.z,ea[O+3]=1,ea[O+4]=y.x,ea[O+5]=y.y,ea[O+6]=y.z,ea[O+7]=1,ea[O+8]=S.x,ea[O+9]=S.y,ea[O+10]=S.z,ea[O+11]=1,O+=12;if(Da&&p)P.length==3&&p==THREE.VertexColors?(Q=P[0],E=P[1],y=P[2]):y=E=Q=N,ca[W]=Q.r,ca[W+1]=Q.g,ca[W+2]=Q.b,ca[W+3]=E.r,ca[W+4]=E.g,ca[W+5]=E.b,ca[W+6]=y.r,ca[W+7]=y.g,ca[W+8]=y.b,W+=9;if(Ka&&xa.hasTangents)P=K[0],N=K[1],Q=K[2],aa[$]=P.x,aa[$+1]=P.y,aa[$+2]=P.z,aa[$+3]=P.w,aa[$+4]=N.x,aa[$+5]=N.y,aa[$+6]=N.z,aa[$+7]=N.w,aa[$+
|
|
|
+8]=Q.x,aa[$+9]=Q.y,aa[$+10]=Q.z,aa[$+11]=Q.w,$+=12;if(Ja&&t)if(J.length==3&&va)for(K=0;K<3;K++)L=J[K],la[U]=L.x,la[U+1]=L.y,la[U+2]=L.z,U+=3;else for(K=0;K<3;K++)la[U]=L.x,la[U+1]=L.y,la[U+2]=L.z,U+=3;if(za&&w!==void 0&&v)for(K=0;K<3;K++)J=w[K],ha[da]=J.u,ha[da+1]=J.v,da+=2;if(za&&X!==void 0&&v)for(K=0;K<3;K++)J=X[K],ia[V]=J.u,ia[V+1]=J.v,V+=2;Ia&&(qa[fa]=ka,qa[fa+1]=ka+1,qa[fa+2]=ka+2,fa+=3,oa[ja]=ka,oa[ja+1]=ka+1,oa[ja+2]=ka,oa[ja+3]=ka+2,oa[ja+4]=ka+1,oa[ja+5]=ka+2,ja+=6,ka+=3)}else if(Q instanceof
|
|
|
+THREE.Face4){if(ya)o=Pa[Q.a].position,C=Pa[Q.b].position,D=Pa[Q.c].position,M=Pa[Q.d].position,Z[T]=o.x,Z[T+1]=o.y,Z[T+2]=o.z,Z[T+3]=C.x,Z[T+4]=C.y,Z[T+5]=C.z,Z[T+6]=D.x,Z[T+7]=D.y,Z[T+8]=D.z,Z[T+9]=M.x,Z[T+10]=M.y,Z[T+11]=M.z,T+=12;if(ua)for(R in ua)if(y=ua[R],y.__original.needsUpdate)E=y.offset,S=y.offsetSrc,y.size===1?(y.boundTo===void 0||y.boundTo==="vertices"?(y.array[E]=y.value[Q.a],y.array[E+1]=y.value[Q.b],y.array[E+2]=y.value[Q.c],y.array[E+3]=y.value[Q.d]):y.boundTo==="faces"?(S=y.value[S],
|
|
|
+y.array[E]=S,y.array[E+1]=S,y.array[E+2]=S,y.array[E+3]=S,y.offsetSrc++):y.boundTo==="faceVertices"&&(y.array[E]=y.value[S],y.array[E+1]=y.value[S+1],y.array[E+2]=y.value[S+2],y.array[E+3]=y.value[S+3],y.offsetSrc+=4),y.offset+=4):(y.boundTo===void 0||y.boundTo==="vertices"?(o=y.value[Q.a],C=y.value[Q.b],D=y.value[Q.c],M=y.value[Q.d]):y.boundTo==="faces"?(M=D=C=o=S=y.value[S],y.offsetSrc++):y.boundTo==="faceVertices"&&(o=y.value[S],C=y.value[S+1],D=y.value[S+2],M=y.value[S+3],y.offsetSrc+=4),y.size===
|
|
|
+2?(y.array[E]=o.x,y.array[E+1]=o.y,y.array[E+2]=C.x,y.array[E+3]=C.y,y.array[E+4]=D.x,y.array[E+5]=D.y,y.array[E+6]=M.x,y.array[E+7]=M.y,y.offset+=8):y.size===3?(y.type==="c"?(y.array[E]=o.r,y.array[E+1]=o.g,y.array[E+2]=o.b,y.array[E+3]=C.r,y.array[E+4]=C.g,y.array[E+5]=C.b,y.array[E+6]=D.r,y.array[E+7]=D.g,y.array[E+8]=D.b,y.array[E+9]=M.r,y.array[E+10]=M.g,y.array[E+11]=M.b):(y.array[E]=o.x,y.array[E+1]=o.y,y.array[E+2]=o.z,y.array[E+3]=C.x,y.array[E+4]=C.y,y.array[E+5]=C.z,y.array[E+6]=D.x,y.array[E+
|
|
|
+7]=D.y,y.array[E+8]=D.z,y.array[E+9]=M.x,y.array[E+10]=M.y,y.array[E+11]=M.z),y.offset+=12):(y.array[E]=o.x,y.array[E+1]=o.y,y.array[E+2]=o.z,y.array[E+3]=o.w,y.array[E+4]=C.x,y.array[E+5]=C.y,y.array[E+6]=C.z,y.array[E+7]=C.w,y.array[E+8]=D.x,y.array[E+9]=D.y,y.array[E+10]=D.z,y.array[E+11]=D.w,y.array[E+12]=M.x,y.array[E+13]=M.y,y.array[E+14]=M.z,y.array[E+15]=M.w,y.offset+=16));if(Ea){E=0;for(y=Fa.length;E<y;E++)o=Fa[E].vertices[Q.a].position,C=Fa[E].vertices[Q.b].position,D=Fa[E].vertices[Q.c].position,
|
|
|
+M=Fa[E].vertices[Q.d].position,S=ta[E],S[Y]=o.x,S[Y+1]=o.y,S[Y+2]=o.z,S[Y+3]=C.x,S[Y+4]=C.y,S[Y+5]=C.z,S[Y+6]=D.x,S[Y+7]=D.y,S[Y+8]=D.z,S[Y+9]=M.x,S[Y+10]=M.y,S[Y+11]=M.z;Y+=12}if(Ha.length)E=Ha[Q.a],y=Ha[Q.b],S=Ha[Q.c],ma=Ha[Q.d],sa[O]=E.x,sa[O+1]=E.y,sa[O+2]=E.z,sa[O+3]=E.w,sa[O+4]=y.x,sa[O+5]=y.y,sa[O+6]=y.z,sa[O+7]=y.w,sa[O+8]=S.x,sa[O+9]=S.y,sa[O+10]=S.z,sa[O+11]=S.w,sa[O+12]=ma.x,sa[O+13]=ma.y,sa[O+14]=ma.z,sa[O+15]=ma.w,E=Sa[Q.a],y=Sa[Q.b],S=Sa[Q.c],ma=Sa[Q.d],ra[O]=E.x,ra[O+1]=E.y,ra[O+2]=
|
|
|
+E.z,ra[O+3]=E.w,ra[O+4]=y.x,ra[O+5]=y.y,ra[O+6]=y.z,ra[O+7]=y.w,ra[O+8]=S.x,ra[O+9]=S.y,ra[O+10]=S.z,ra[O+11]=S.w,ra[O+12]=ma.x,ra[O+13]=ma.y,ra[O+14]=ma.z,ra[O+15]=ma.w,E=Qa[Q.a],y=Qa[Q.b],S=Qa[Q.c],ma=Qa[Q.d],na[O]=E.x,na[O+1]=E.y,na[O+2]=E.z,na[O+3]=1,na[O+4]=y.x,na[O+5]=y.y,na[O+6]=y.z,na[O+7]=1,na[O+8]=S.x,na[O+9]=S.y,na[O+10]=S.z,na[O+11]=1,na[O+12]=ma.x,na[O+13]=ma.y,na[O+14]=ma.z,na[O+15]=1,E=Ra[Q.a],y=Ra[Q.b],S=Ra[Q.c],Q=Ra[Q.d],ea[O]=E.x,ea[O+1]=E.y,ea[O+2]=E.z,ea[O+3]=1,ea[O+4]=y.x,ea[O+
|
|
|
+5]=y.y,ea[O+6]=y.z,ea[O+7]=1,ea[O+8]=S.x,ea[O+9]=S.y,ea[O+10]=S.z,ea[O+11]=1,ea[O+12]=Q.x,ea[O+13]=Q.y,ea[O+14]=Q.z,ea[O+15]=1,O+=16;if(Da&&p)P.length==4&&p==THREE.VertexColors?(Q=P[0],E=P[1],y=P[2],P=P[3]):P=y=E=Q=N,ca[W]=Q.r,ca[W+1]=Q.g,ca[W+2]=Q.b,ca[W+3]=E.r,ca[W+4]=E.g,ca[W+5]=E.b,ca[W+6]=y.r,ca[W+7]=y.g,ca[W+8]=y.b,ca[W+9]=P.r,ca[W+10]=P.g,ca[W+11]=P.b,W+=12;if(Ka&&xa.hasTangents)P=K[0],N=K[1],Q=K[2],K=K[3],aa[$]=P.x,aa[$+1]=P.y,aa[$+2]=P.z,aa[$+3]=P.w,aa[$+4]=N.x,aa[$+5]=N.y,aa[$+6]=N.z,aa[$+
|
|
|
+7]=N.w,aa[$+8]=Q.x,aa[$+9]=Q.y,aa[$+10]=Q.z,aa[$+11]=Q.w,aa[$+12]=K.x,aa[$+13]=K.y,aa[$+14]=K.z,aa[$+15]=K.w,$+=16;if(Ja&&t)if(J.length==4&&va)for(K=0;K<4;K++)L=J[K],la[U]=L.x,la[U+1]=L.y,la[U+2]=L.z,U+=3;else for(K=0;K<4;K++)la[U]=L.x,la[U+1]=L.y,la[U+2]=L.z,U+=3;if(za&&w!==void 0&&v)for(K=0;K<4;K++)J=w[K],ha[da]=J.u,ha[da+1]=J.v,da+=2;if(za&&X!==void 0&&v)for(K=0;K<4;K++)J=X[K],ia[V]=J.u,ia[V+1]=J.v,V+=2;Ia&&(qa[fa]=ka,qa[fa+1]=ka+1,qa[fa+2]=ka+3,qa[fa+3]=ka+1,qa[fa+4]=ka+2,qa[fa+5]=ka+3,fa+=6,
|
|
|
+oa[ja]=ka,oa[ja+1]=ka+1,oa[ja+2]=ka,oa[ja+3]=ka+3,oa[ja+4]=ka+1,oa[ja+5]=ka+2,oa[ja+6]=ka+2,oa[ja+7]=ka+3,ja+=8,ka+=4)}ya&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglVertexBuffer),m.bufferData(m.ARRAY_BUFFER,Z,u));if(ua)for(R in ua)y=ua[R],y.__original.needsUpdate&&(m.bindBuffer(m.ARRAY_BUFFER,y.buffer),m.bufferData(m.ARRAY_BUFFER,y.array,u));if(Ea){E=0;for(y=Fa.length;E<y;E++)m.bindBuffer(m.ARRAY_BUFFER,n.__webglMorphTargetsBuffers[E]),m.bufferData(m.ARRAY_BUFFER,ta[E],u)}Da&&W>0&&(m.bindBuffer(m.ARRAY_BUFFER,
|
|
|
+n.__webglColorBuffer),m.bufferData(m.ARRAY_BUFFER,ca,u));Ja&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglNormalBuffer),m.bufferData(m.ARRAY_BUFFER,la,u));Ka&&xa.hasTangents&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglTangentBuffer),m.bufferData(m.ARRAY_BUFFER,aa,u));za&&da>0&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglUVBuffer),m.bufferData(m.ARRAY_BUFFER,ha,u));za&&V>0&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglUV2Buffer),m.bufferData(m.ARRAY_BUFFER,ia,u));Ia&&(m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,n.__webglFaceBuffer),
|
|
|
+m.bufferData(m.ELEMENT_ARRAY_BUFFER,qa,u),m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,n.__webglLineBuffer),m.bufferData(m.ELEMENT_ARRAY_BUFFER,oa,u));O>0&&(m.bindBuffer(m.ARRAY_BUFFER,n.__webglSkinVertexABuffer),m.bufferData(m.ARRAY_BUFFER,na,u),m.bindBuffer(m.ARRAY_BUFFER,n.__webglSkinVertexBBuffer),m.bufferData(m.ARRAY_BUFFER,ea,u),m.bindBuffer(m.ARRAY_BUFFER,n.__webglSkinIndicesBuffer),m.bufferData(m.ARRAY_BUFFER,ra,u),m.bindBuffer(m.ARRAY_BUFFER,n.__webglSkinWeightsBuffer),m.bufferData(m.ARRAY_BUFFER,
|
|
|
+sa,u));H&&(delete n.__inittedArrays,delete n.__colorArray,delete n.__normalArray,delete n.__tangentArray,delete n.__uvArray,delete n.__uv2Array,delete n.__faceArray,delete n.__vertexArray,delete n.__lineArray,delete n.__skinVertexAArray,delete n.__skinVertexBArray,delete n.__skinIndexArray,delete n.__skinWeightArray)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;F(k)}else if(g instanceof THREE.Ribbon){h=
|
|
|
+g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=m.DYNAMIC_DRAW;k=B=x=x=void 0;v=g.vertices;n=g.colors;p=v.length;u=n.length;t=g.__vertexArray;H=g.__colorArray;w=g.__dirtyColors;if(g.__dirtyVertices){for(x=0;x<p;x++)B=v[x].position,k=x*3,t[k]=B.x,t[k+1]=B.y,t[k+2]=B.z;m.bindBuffer(m.ARRAY_BUFFER,g.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,t,j)}if(w){for(x=0;x<u;x++)color=n[x],k=x*3,H[k]=color.r,H[k+1]=color.g,H[k+2]=color.b;m.bindBuffer(m.ARRAY_BUFFER,g.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,
|
|
|
+H,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof THREE.Line){h=g.geometry;if(h.__dirtyVertices||h.__dirtyColors){g=h;j=m.DYNAMIC_DRAW;k=B=x=x=void 0;v=g.vertices;n=g.colors;p=v.length;u=n.length;t=g.__vertexArray;H=g.__colorArray;w=g.__dirtyColors;if(g.__dirtyVertices){for(x=0;x<p;x++)B=v[x].position,k=x*3,t[k]=B.x,t[k+1]=B.y,t[k+2]=B.z;m.bindBuffer(m.ARRAY_BUFFER,g.__webglVertexBuffer);m.bufferData(m.ARRAY_BUFFER,t,j)}if(w){for(x=0;x<u;x++)color=n[x],k=x*3,H[k]=color.r,H[k+1]=color.g,
|
|
|
+H[k+2]=color.b;m.bindBuffer(m.ARRAY_BUFFER,g.__webglColorBuffer);m.bufferData(m.ARRAY_BUFFER,H,j)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(g instanceof THREE.ParticleSystem)h=g.geometry,n=A(h),(h.__dirtyVertices||h.__dirtyColors||g.sortParticles||n)&&c(h,m.DYNAMIC_DRAW,g),h.__dirtyVertices=!1,h.__dirtyColors=!1,F(h)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?m.frontFace(m.CCW):m.frontFace(m.CW),b=="back"?m.cullFace(m.BACK):b=="front"?m.cullFace(m.FRONT):m.cullFace(m.FRONT_AND_BACK),
|
|
|
+m.enable(m.CULL_FACE)):m.disable(m.CULL_FACE)};this.supportsVertexTextures=function(){return Da}};
|
|
|
THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};THREE.RenderableVertex=function(){this.positionWorld=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.visible=!0};THREE.RenderableVertex.prototype.copy=function(b){this.positionWorld.copy(b.positionWorld);this.positionScreen.copy(b.positionScreen)};
|
|
|
THREE.RenderableFace3=function(){this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.v3=new THREE.RenderableVertex;this.centroidWorld=new THREE.Vector3;this.centroidScreen=new THREE.Vector3;this.normalWorld=new THREE.Vector3;this.vertexNormalsWorld=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];this.faceMaterials=this.meshMaterials=null;this.overdraw=!1;this.uvs=[[]];this.z=null};
|
|
@@ -328,13 +328,13 @@ THREE.RenderableFace4=function(){this.v1=new THREE.RenderableVertex;this.v2=new
|
|
|
THREE.RenderableObject=function(){this.z=this.object=null};THREE.RenderableParticle=function(){this.rotation=this.z=this.y=this.x=null;this.scale=new THREE.Vector2;this.materials=null};THREE.RenderableLine=function(){this.z=null;this.v1=new THREE.RenderableVertex;this.v2=new THREE.RenderableVertex;this.materials=null};
|
|
|
THREE.ColorUtils={adjustHSV:function(b,c,e,f){var g=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,g);g.h=THREE.ColorUtils.clamp(g.h+c,0,1);g.s=THREE.ColorUtils.clamp(g.s+e,0,1);g.v=THREE.ColorUtils.clamp(g.v+f,0,1);b.setHSV(g.h,g.s,g.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,g=b.b,j=Math.max(Math.max(e,f),g),h=Math.min(Math.min(e,f),g);if(h==j)h=e=0;else{var k=j-h,h=k/j,e=e==j?(f-g)/k:f==j?2+(g-e)/k:4+(e-f)/k;e/=6;e<0&&(e+=1);e>1&&(e-=1)}c===void 0&&(c={h:0,s:0,v:0});c.h=e;c.s=h;c.v=j;return c},
|
|
|
clamp:function(b,c,e){return b<c?c:b>e?e:b}};THREE.ColorUtils.__hsv={h:0,s:0,v:0};
|
|
|
-THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,j=b.vertices,h=g.vertices,k=b.faces,o=g.faces,m=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var p=0,u=h.length;p<u;p++){var v=new THREE.Vertex(h[p].position.clone());e&&c.matrix.multiplyVector3(v.position);j.push(v)}p=0;for(u=o.length;p<u;p++){var h=o[p],t,w,x=h.vertexNormals,v=h.vertexColors;h instanceof THREE.Face3?t=new THREE.Face3(h.a+f,h.b+f,h.c+
|
|
|
-f):h instanceof THREE.Face4&&(t=new THREE.Face4(h.a+f,h.b+f,h.c+f,h.d+f));t.normal.copy(h.normal);e=0;for(j=x.length;e<j;e++)w=x[e],t.vertexNormals.push(w.clone());t.color.copy(h.color);e=0;for(j=v.length;e<j;e++)w=v[e],t.vertexColors.push(w.clone());t.materials=h.materials.slice();t.centroid.copy(h.centroid);k.push(t)}p=0;for(u=g.length;p<u;p++){f=g[p];k=[];e=0;for(j=f.length;e<j;e++)k.push(new THREE.UV(f[e].u,f[e].v));m.push(k)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,g=b.faces,
|
|
|
-j=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var h=new THREE.Vertex(f[b].position.clone());c.vertices.push(h)}b=0;for(e=g.length;b<e;b++){var k=g[b],o,m,p=k.vertexNormals,u=k.vertexColors;k instanceof THREE.Face3?o=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(o=new THREE.Face4(k.a,k.b,k.c,k.d));o.normal.copy(k.normal);f=0;for(h=p.length;f<h;f++)m=p[f],o.vertexNormals.push(m.clone());o.color.copy(k.color);f=0;for(h=u.length;f<h;f++)m=u[f],o.vertexColors.push(m.clone());o.materials=k.materials.slice();
|
|
|
-o.centroid.copy(k.centroid);c.faces.push(o)}b=0;for(e=j.length;b<e;b++){g=j[b];o=[];f=0;for(h=g.length;f<h;f++)o.push(new THREE.UV(g[f].u,g[f].v));c.faceVertexUvs[0].push(o)}return c},randomPointInTriangle:function(b,c,e){var f,g,j,h=new THREE.Vector3,k=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();f+g>1&&(f=1-f,g=1-g);j=1-f-g;h.copy(b);h.multiplyScalar(f);k.copy(c);k.multiplyScalar(g);h.addSelf(k);k.copy(e);k.multiplyScalar(j);h.addSelf(k);return h},randomPointInFace:function(b,
|
|
|
+THREE.GeometryUtils={merge:function(b,c){var e=c instanceof THREE.Mesh,f=b.vertices.length,g=e?c.geometry:c,j=b.vertices,h=g.vertices,k=b.faces,p=g.faces,t=b.faceVertexUvs[0],g=g.faceVertexUvs[0];e&&c.matrixAutoUpdate&&c.updateMatrix();for(var o=0,u=h.length;o<u;o++){var v=new THREE.Vertex(h[o].position.clone());e&&c.matrix.multiplyVector3(v.position);j.push(v)}o=0;for(u=p.length;o<u;o++){var h=p[o],n,w,x=h.vertexNormals,v=h.vertexColors;h instanceof THREE.Face3?n=new THREE.Face3(h.a+f,h.b+f,h.c+
|
|
|
+f):h instanceof THREE.Face4&&(n=new THREE.Face4(h.a+f,h.b+f,h.c+f,h.d+f));n.normal.copy(h.normal);e=0;for(j=x.length;e<j;e++)w=x[e],n.vertexNormals.push(w.clone());n.color.copy(h.color);e=0;for(j=v.length;e<j;e++)w=v[e],n.vertexColors.push(w.clone());n.materials=h.materials.slice();n.centroid.copy(h.centroid);k.push(n)}o=0;for(u=g.length;o<u;o++){f=g[o];k=[];e=0;for(j=f.length;e<j;e++)k.push(new THREE.UV(f[e].u,f[e].v));t.push(k)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,g=b.faces,
|
|
|
+j=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var h=new THREE.Vertex(f[b].position.clone());c.vertices.push(h)}b=0;for(e=g.length;b<e;b++){var k=g[b],p,t,o=k.vertexNormals,u=k.vertexColors;k instanceof THREE.Face3?p=new THREE.Face3(k.a,k.b,k.c):k instanceof THREE.Face4&&(p=new THREE.Face4(k.a,k.b,k.c,k.d));p.normal.copy(k.normal);f=0;for(h=o.length;f<h;f++)t=o[f],p.vertexNormals.push(t.clone());p.color.copy(k.color);f=0;for(h=u.length;f<h;f++)t=u[f],p.vertexColors.push(t.clone());p.materials=k.materials.slice();
|
|
|
+p.centroid.copy(k.centroid);c.faces.push(p)}b=0;for(e=j.length;b<e;b++){g=j[b];p=[];f=0;for(h=g.length;f<h;f++)p.push(new THREE.UV(g[f].u,g[f].v));c.faceVertexUvs[0].push(p)}return c},randomPointInTriangle:function(b,c,e){var f,g,j,h=new THREE.Vector3,k=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();g=THREE.GeometryUtils.random();f+g>1&&(f=1-f,g=1-g);j=1-f-g;h.copy(b);h.multiplyScalar(f);k.copy(c);k.multiplyScalar(g);h.addSelf(k);k.copy(e);k.multiplyScalar(j);h.addSelf(k);return h},randomPointInFace:function(b,
|
|
|
c,e){var f,g,j;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,g=c.vertices[b.b].position,j=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,g,j);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;g=c.vertices[b.b].position;j=c.vertices[b.c].position;var c=c.vertices[b.d].position,h;e?b._area1&&b._area2?(e=b._area1,h=b._area2):(e=THREE.GeometryUtils.triangleArea(f,g,c),h=THREE.GeometryUtils.triangleArea(g,j,c),b._area1=e,b._area2=h):(e=THREE.GeometryUtils.triangleArea(f,
|
|
|
-g,c),h=THREE.GeometryUtils.triangleArea(g,j,c));return THREE.GeometryUtils.random()*(e+h)<e?THREE.GeometryUtils.randomPointInTriangle(f,g,c):THREE.GeometryUtils.randomPointInTriangle(g,j,c)}},randomPointsInGeometry:function(b,c){function e(b){function c(e,f){if(f<e)return e;var g=e+Math.floor((f-e)/2);return m[g]>b?c(e,g-1):m[g]<b?c(g+1,f):g}return c(0,m.length-1)}var f,g,j=b.faces,h=b.vertices,k=j.length,o=0,m=[],p,u,v,t;for(g=0;g<k;g++){f=j[g];if(f instanceof THREE.Face3)p=h[f.a].position,u=h[f.b].position,
|
|
|
-v=h[f.c].position,f._area=THREE.GeometryUtils.triangleArea(p,u,v);else if(f instanceof THREE.Face4)p=h[f.a].position,u=h[f.b].position,v=h[f.c].position,t=h[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(p,u,t),f._area2=THREE.GeometryUtils.triangleArea(u,v,t),f._area=f._area1+f._area2;o+=f._area;m[g]=o}f=[];h={};for(g=0;g<c;g++)k=THREE.GeometryUtils.random()*o,k=e(k),f[g]=THREE.GeometryUtils.randomPointInFace(j[k],b,!0),h[k]?h[k]+=1:h[k]=1;return f},triangleArea:function(b,c,e){var f,g=THREE.GeometryUtils.__v1;
|
|
|
+g,c),h=THREE.GeometryUtils.triangleArea(g,j,c));return THREE.GeometryUtils.random()*(e+h)<e?THREE.GeometryUtils.randomPointInTriangle(f,g,c):THREE.GeometryUtils.randomPointInTriangle(g,j,c)}},randomPointsInGeometry:function(b,c){function e(b){function c(e,f){if(f<e)return e;var g=e+Math.floor((f-e)/2);return t[g]>b?c(e,g-1):t[g]<b?c(g+1,f):g}return c(0,t.length-1)}var f,g,j=b.faces,h=b.vertices,k=j.length,p=0,t=[],o,u,v,n;for(g=0;g<k;g++){f=j[g];if(f instanceof THREE.Face3)o=h[f.a].position,u=h[f.b].position,
|
|
|
+v=h[f.c].position,f._area=THREE.GeometryUtils.triangleArea(o,u,v);else if(f instanceof THREE.Face4)o=h[f.a].position,u=h[f.b].position,v=h[f.c].position,n=h[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(o,u,n),f._area2=THREE.GeometryUtils.triangleArea(u,v,n),f._area=f._area1+f._area2;p+=f._area;t[g]=p}f=[];h={};for(g=0;g<c;g++)k=THREE.GeometryUtils.random()*p,k=e(k),f[g]=THREE.GeometryUtils.randomPointInFace(j[k],b,!0),h[k]?h[k]+=1:h[k]=1;return f},triangleArea:function(b,c,e){var f,g=THREE.GeometryUtils.__v1;
|
|
|
g.sub(b,c);f=g.length();g.sub(b,e);b=g.length();g.sub(c,e);e=g.length();c=0.5*(f+b+e);return Math.sqrt(c*(c-f)*(c-b)*(c-e))},random16:function(){return(65280*Math.random()+255*Math.random())/65535}};THREE.GeometryUtils.random=THREE.GeometryUtils.random16;THREE.GeometryUtils.__v1=new THREE.Vector3;
|
|
|
THREE.ImageUtils={loadTexture:function(b,c,e){var f=new Image,g=new THREE.Texture(f,c);f.onload=function(){g.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return g},loadTextureCube:function(b,c,e){var f,g=[],j=new THREE.Texture(g,c),c=g.loadCount=0;for(f=b.length;c<f;++c)g[c]=new Image,g[c].onload=function(){g.loadCount+=1;if(g.loadCount==6)j.needsUpdate=!0;e&&e(this)},g[c].crossOrigin="",g[c].src=b[c];return j}};
|
|
|
THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,g=b.children.length;for(f=0;f<g;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
|
|
@@ -349,20 +349,20 @@ film:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},time:{type:"f",value:0}
|
|
|
screen:{uniforms:{tDiffuse:{type:"t",value:0,texture:null},opacity:{type:"f",value:1}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"varying vec2 vUv;\nuniform sampler2D tDiffuse;\nuniform float opacity;\nvoid main() {\nvec4 texel = texture2D( tDiffuse, vUv );\ngl_FragColor = opacity * texel;\n}"},basic:{uniforms:{},vertexShader:"void main() {\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",
|
|
|
fragmentShader:"void main() {\ngl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );\n}"}},buildKernel:function(b){var c,e,f,g,j=2*Math.ceil(b*3)+1;j>25&&(j=25);g=(j-1)*0.5;e=Array(j);for(c=f=0;c<j;++c)e[c]=Math.exp(-((c-g)*(c-g))/(2*b*b)),f+=e[c];for(c=0;c<j;++c)e[c]/=f;return e}};
|
|
|
THREE.AnimationHandler=function(){var b=[],c={},e={update:function(c){for(var e=0;e<b.length;e++)b[e].update(c)},addToUpdate:function(c){b.indexOf(c)===-1&&b.push(c)},removeFromUpdate:function(c){c=b.indexOf(c);c!==-1&&b.splice(c,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
|
|
|
-0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var k=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){k={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var o=0;o<b.hierarchy[e].keys[f].morphTargets.length;o++){var m=b.hierarchy[e].keys[f].morphTargets[o];k[m]=-1}b.hierarchy[e].usedMorphTargets=k;for(f=0;f<b.hierarchy[e].keys.length;f++){var p=
|
|
|
-{};for(m in k){for(o=0;o<b.hierarchy[e].keys[f].morphTargets.length;o++)if(b.hierarchy[e].keys[f].morphTargets[o]===m){p[m]=b.hierarchy[e].keys[f].morphTargetsInfluences[o];break}o===b.hierarchy[e].keys[f].morphTargets.length&&(p[m]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=p}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
|
|
|
+0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var k=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(k[0],k[1],k[2],k[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){k={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var p=0;p<b.hierarchy[e].keys[f].morphTargets.length;p++){var t=b.hierarchy[e].keys[f].morphTargets[p];k[t]=-1}b.hierarchy[e].usedMorphTargets=k;for(f=0;f<b.hierarchy[e].keys.length;f++){var o=
|
|
|
+{};for(t in k){for(p=0;p<b.hierarchy[e].keys[f].morphTargets.length;p++)if(b.hierarchy[e].keys[f].morphTargets[p]===t){o[t]=b.hierarchy[e].keys[f].morphTargetsInfluences[p];break}p===b.hierarchy[e].keys[f].morphTargets.length&&(o[t]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=o}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
|
|
|
b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
|
|
|
2;return e}();THREE.Animation=function(b,c,e,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,g;for(e=0;e<f;e++){g=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)g.useQuaternion=!0;g.matrixAutoUpdate=!0;if(g.animationCache===void 0)g.animationCache={},g.animationCache.prevKey={pos:0,rot:0,scl:0},g.animationCache.nextKey={pos:0,rot:0,scl:0},g.animationCache.originalMatrix=g instanceof
|
|
|
THREE.Bone?g.skinMatrix:g.matrix;var j=g.animationCache.prevKey;g=g.animationCache.nextKey;j.pos=this.data.hierarchy[e].keys[0];j.rot=this.data.hierarchy[e].keys[0];j.scl=this.data.hierarchy[e].keys[0];g.pos=this.getNextKeyWith("pos",e,1);g.rot=this.getNextKeyWith("rot",e,1);g.scl=this.getNextKeyWith("scl",e,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 b=0;b<this.hierarchy.length;b++)if(this.hierarchy[b].animationCache!==void 0)this.hierarchy[b]instanceof THREE.Bone?this.hierarchy[b].skinMatrix=this.hierarchy[b].animationCache.originalMatrix:this.hierarchy[b].matrix=this.hierarchy[b].animationCache.originalMatrix,delete this.hierarchy[b].animationCache};
|
|
|
-THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,j,h,k,o,m,p=this.data.JIT.hierarchy,u,v;this.currentTime+=b*this.timeScale;v=this.currentTime;u=this.currentTime%=this.data.length;m=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,w=this.hierarchy.length;t<w;t++)if(b=this.hierarchy[t],o=b.animationCache,this.JITCompile&&p[t][m]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=p[t][m],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
|
|
|
-!1):(b.matrix=p[t][m],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var x=0;x<3;x++){e=c[x];h=o.prevKey[e];k=o.nextKey[e];if(k.time<=v){if(u<v)if(this.loop){h=this.data.hierarchy[t].keys[0];for(k=this.getNextKeyWith(e,t,1);k.time<u;)h=k,k=this.getNextKeyWith(e,t,k.index+1)}else{this.stop();return}else{do h=k,k=this.getNextKeyWith(e,t,k.index+1);while(k.time<
|
|
|
-u)}o.prevKey[e]=h;o.nextKey[e]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-h.time)/(k.time-h.time);g=h[e];j=k[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+t),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
-this.getPrevKeyWith("pos",t,h.index-1).pos,this.points[1]=g,this.points[2]=j,this.points[3]=this.getNextKeyWith("pos",t,k.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
|
|
|
-"rot")THREE.Quaternion.slerp(g,j,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f}}if(this.JITCompile&&p[0][m]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;t<this.hierarchy.length;t++)p[t][m]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
|
|
|
-THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,j,h,k,o,m;g=(b.length-1)*c;j=Math.floor(g);g-=j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>b.length-2?j:j+1;e[3]=j>b.length-3?j:j+2;j=b[e[0]];k=b[e[1]];o=b[e[2]];m=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(j[0],k[0],o[0],m[0],g,e,h);f[1]=this.interpolate(j[1],k[1],o[1],m[1],g,e,h);f[2]=this.interpolate(j[2],k[2],o[2],m[2],g,e,h);return f};
|
|
|
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,g,j,h,k,p,t,o=this.data.JIT.hierarchy,u,v;this.currentTime+=b*this.timeScale;v=this.currentTime;u=this.currentTime%=this.data.length;t=parseInt(Math.min(u*this.data.fps,this.data.length*this.data.fps),10);for(var n=0,w=this.hierarchy.length;n<w;n++)if(b=this.hierarchy[n],p=b.animationCache,this.JITCompile&&o[n][t]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=o[n][t],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
|
|
|
+!1):(b.matrix=o[n][t],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=!0);else{if(this.JITCompile)b instanceof THREE.Bone?b.skinMatrix=b.animationCache.originalMatrix:b.matrix=b.animationCache.originalMatrix;for(var x=0;x<3;x++){e=c[x];h=p.prevKey[e];k=p.nextKey[e];if(k.time<=v){if(u<v)if(this.loop){h=this.data.hierarchy[n].keys[0];for(k=this.getNextKeyWith(e,n,1);k.time<u;)h=k,k=this.getNextKeyWith(e,n,k.index+1)}else{this.stop();return}else{do h=k,k=this.getNextKeyWith(e,n,k.index+1);while(k.time<
|
|
|
+u)}p.prevKey[e]=h;p.nextKey[e]=k}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-h.time)/(k.time-h.time);g=h[e];j=k[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+n),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
+this.getPrevKeyWith("pos",n,h.index-1).pos,this.points[1]=g,this.points[2]=j,this.points[3]=this.getNextKeyWith("pos",n,k.index+1).pos,f=f*0.33+0.33,g=this.interpolateCatmullRom(this.points,f),e.x=g[0],e.y=g[1],e.z=g[2],this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)f=this.interpolateCatmullRom(this.points,f*1.01),this.target.set(f[0],f[1],f[2]),this.target.subSelf(e),this.target.y=0,this.target.normalize(),f=Math.atan2(this.target.x,this.target.z),b.rotation.set(0,f,0)}else if(e===
|
|
|
+"rot")THREE.Quaternion.slerp(g,j,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=g[0]+(j[0]-g[0])*f,e.y=g[1]+(j[1]-g[1])*f,e.z=g[2]+(j[2]-g[2])*f}}if(this.JITCompile&&o[0][t]===void 0){this.hierarchy[0].update(void 0,!0);for(n=0;n<this.hierarchy.length;n++)o[n][t]=this.hierarchy[n]instanceof THREE.Bone?this.hierarchy[n].skinMatrix.clone():this.hierarchy[n].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],g,j,h,k,p,t;g=(b.length-1)*c;j=Math.floor(g);g-=j;e[0]=j==0?j:j-1;e[1]=j;e[2]=j>b.length-2?j:j+1;e[3]=j>b.length-3?j:j+2;j=b[e[0]];k=b[e[1]];p=b[e[2]];t=b[e[3]];e=g*g;h=g*e;f[0]=this.interpolate(j[0],k[0],p[0],t[0],g,e,h);f[1]=this.interpolate(j[1],k[1],p[1],t[1],g,e,h);f[2]=this.interpolate(j[2],k[2],p[2],t[2],g,e,h);return f};
|
|
|
THREE.Animation.prototype.interpolate=function(b,c,e,f,g,j,h){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*h+(-3*(c-e)-2*b-f)*j+b*g+c};THREE.Animation.prototype.getNextKeyWith=function(b,c,e){var f=this.data.hierarchy[c].keys;for(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e=e<f.length-1?e:f.length-1:e%=f.length;e<f.length;e++)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[0]};
|
|
|
THREE.Animation.prototype.getPrevKeyWith=function(b,c,e){for(var f=this.data.hierarchy[c].keys,e=this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD?e>0?e:0:e>=0?e:e+f.length;e>=0;e--)if(f[e][b]!==void 0)return f[e];return this.data.hierarchy[c].keys[f.length-1]};
|
|
|
THREE.FirstPersonCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.movementSpeed=1;this.lookSpeed=0.0050;this.noFly=!1;this.lookVertical=!0;this.autoForward=!1;this.activeLook=!0;this.heightSpeed=!1;this.heightCoef=1;this.heightMin=0;this.constrainVertical=!1;this.verticalMin=0;this.verticalMax=3.14;this.domElement=document;this.lastUpdate=(new Date).getTime();this.tdiff=0;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=
|
|
@@ -375,14 +375,14 @@ this.moveRight&&this.translateX(c);this.moveUp&&this.translateY(c);this.moveDown
|
|
|
1;this.constrainVertical&&(b=3.14/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*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;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/3.14+this.verticalMin;b=this.target.position;g=this.position;b.x=g.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=g.y+100*Math.cos(this.phi);b.z=g.z+100*Math.sin(this.phi)*
|
|
|
Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
|
|
|
THREE.FirstPersonCamera.prototype=new THREE.Camera;THREE.FirstPersonCamera.prototype.constructor=THREE.FirstPersonCamera;THREE.FirstPersonCamera.prototype.supr=THREE.Camera.prototype;THREE.FirstPersonCamera.prototype.translate=function(b,c){this.matrix.rotateAxis(c);if(this.noFly)c.y=0;this.position.addSelf(c.multiplyScalar(b));this.target.position.addSelf(c.multiplyScalar(b))};
|
|
|
-THREE.PathCamera=function(b){function c(b,c,e,f){var g={name:e,fps:0.6,length:f,hierarchy:[]},h,j=c.getControlPointsArray(),k=c.getLength(),o=j.length,I=0;h=o-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:f,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<o-1;h++)I=f*k.chunks[h]/k.total,c.keys[h]={time:I,pos:j[h]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
|
|
|
+THREE.PathCamera=function(b){function c(b,c,e,f){var g={name:e,fps:0.6,length:f,hierarchy:[]},h,j=c.getControlPointsArray(),k=c.getLength(),p=j.length,F=0;h=p-1;c={parent:-1,keys:[]};c.keys[0]={time:0,pos:j[0],rot:[0,0,0,1],scl:[1,1,1]};c.keys[h]={time:f,pos:j[h],rot:[0,0,0,1],scl:[1,1,1]};for(h=1;h<p-1;h++)F=f*k.chunks[h]/k.total,c.keys[h]={time:F,pos:j[h]};g.hierarchy[0]=c;THREE.AnimationHandler.add(g);return new THREE.Animation(b,e,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,c){var e,
|
|
|
f,g=new THREE.Geometry;for(e=0;e<b.points.length*c;e++)f=e/(b.points.length*c),f=b.getPoint(f),g.vertices[e]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return g}function f(b,c){var f=e(c,10),g=e(c,10),h=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,h);particleObj=new THREE.ParticleSystem(g,new THREE.ParticleBasicMaterial({color:16755200,size:3}));lineObj.scale.set(1,1,1);b.addChild(lineObj);particleObj.scale.set(1,1,1);b.addChild(particleObj);g=new THREE.SphereGeometry(1,
|
|
|
16,8);h=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(g,h),f.position.copy(c.points[i]),f.updateMatrix(),b.addChild(f)}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.id="PathCamera"+THREE.PathCameraIdCounter++;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,6.28],dstRange:[0,6.28]};this.horizontalAngleMap={srcRange:[0,6.28],dstRange:[0,6.28]};this.domElement=document;if(b){if(b.duration!==void 0)this.duration=b.duration*1E3;if(b.waypoints!==void 0)this.waypoints=b.waypoints;if(b.useConstantSpeed!==void 0)this.useConstantSpeed=b.useConstantSpeed;if(b.resamplingCoef!==void 0)this.resamplingCoef=b.resamplingCoef;if(b.createDebugPath!==void 0)this.createDebugPath=b.createDebugPath;if(b.createDebugDummy!==
|
|
|
void 0)this.createDebugDummy=b.createDebugDummy;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.lookHorizontal!==void 0)this.lookHorizontal=b.lookHorizontal;if(b.verticalAngleMap!==void 0)this.verticalAngleMap=b.verticalAngleMap;if(b.horizontalAngleMap!==void 0)this.horizontalAngleMap=b.horizontalAngleMap;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.windowHalfX=
|
|
|
window.innerWidth/2;this.windowHalfY=window.innerHeight/2;var g=Math.PI*2,j=Math.PI/180;this.update=function(b,c,e){var f,h;this.lookHorizontal&&(this.lon+=this.mouseX*this.lookSpeed);this.lookVertical&&(this.lat-=this.mouseY*this.lookSpeed);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)*j;this.theta=this.lon*j;f=this.phi%g;this.phi=f>=0?f:f+g;f=this.verticalAngleMap.srcRange;h=this.verticalAngleMap.dstRange;var k=h[1]-h[0];this.phi=
|
|
|
TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/k)*k+h[0];f=this.horizontalAngleMap.srcRange;h=this.horizontalAngleMap.dstRange;k=h[1]-h[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(h[1]-h[0])/(f[1]-f[0])+h[0]-h[0])/k)*k+h[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,c,e)};this.onMouseMove=function(b){this.mouseX=
|
|
|
-b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),h=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.CubeGeometry(10,10,20),o=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(o,h);b.position.set(0,10,0);this.animation=
|
|
|
+b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.spline=new THREE.Spline;this.spline.initFromArray(this.waypoints);this.useConstantSpeed&&this.spline.reparametrizeByArcLength(this.resamplingCoef);if(this.createDebugDummy){var b=new THREE.MeshLambertMaterial({color:30719}),h=new THREE.MeshLambertMaterial({color:65280}),k=new THREE.CubeGeometry(10,10,20),p=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(k,b);b=new THREE.Mesh(p,h);b.position.set(0,10,0);this.animation=
|
|
|
c(this.animationParent,this.spline,this.id,this.duration);this.animationParent.addChild(this);this.animationParent.addChild(this.target);this.animationParent.addChild(b)}else this.animation=c(this.animationParent,this.spline,this.id,this.duration),this.animationParent.addChild(this.target),this.animationParent.addChild(this);this.createDebugPath&&f(this.debugPath,this.spline);this.domElement.addEventListener("mousemove",function(b,c){return function(){c.apply(b,arguments)}}(this,this.onMouseMove),
|
|
|
!1)};THREE.PathCamera.prototype=new THREE.Camera;THREE.PathCamera.prototype.constructor=THREE.PathCamera;THREE.PathCamera.prototype.supr=THREE.Camera.prototype;THREE.PathCameraIdCounter=0;
|
|
|
THREE.FlyCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;if(b){if(b.movementSpeed!==void 0)this.movementSpeed=b.movementSpeed;if(b.rollSpeed!==void 0)this.rollSpeed=b.rollSpeed;if(b.dragToLook!==void 0)this.dragToLook=b.dragToLook;if(b.autoForward!==void 0)this.autoForward=
|
|
@@ -395,27 +395,27 @@ this.rollSpeed;this.translateX(this.moveVector.x*b);this.translateY(this.moveVec
|
|
|
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=-b+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",c(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",c(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",c(this,this.mouseup),!1);window.addEventListener("keydown",c(this,this.keydown),!1);window.addEventListener("keyup",c(this,
|
|
|
this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};THREE.FlyCamera.prototype=new THREE.Camera;THREE.FlyCamera.prototype.constructor=THREE.FlyCamera;THREE.FlyCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
-THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,o=!1,m=1,p=0,u=0,v=0,t=0,w=0,x=window.innerWidth/2,B=window.innerHeight/2;this.update=
|
|
|
-function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*t),this.rotateVertically(b*w));b=this.delta*this.movementSpeed;this.translateZ(b*(p>0||this.autoForward&&!(p<0)?1:p));this.translateX(b*u);this.translateY(b*v);o&&(this.roll+=this.rollSpeed*this.delta*m);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
|
|
|
+THREE.RollCamera=function(b,c,e,f){THREE.Camera.call(this,b,c,e,f);this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.domElement=document;this.matrixAutoUpdate=this.useTarget=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var g=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,p=!1,t=1,o=0,u=0,v=0,n=0,w=0,x=window.innerWidth/2,B=window.innerHeight/2;this.update=
|
|
|
+function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*n),this.rotateVertically(b*w));b=this.delta*this.movementSpeed;this.translateZ(b*(o>0||this.autoForward&&!(o<0)?1:o));this.translateX(b*u);this.translateY(b*v);p&&(this.roll+=this.rollSpeed*this.delta*t);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();h.copy(this.forward);j.set(0,1,0);g.cross(j,h).normalize();j.cross(h,g).normalize();this.matrix.n11=g.x;this.matrix.n12=j.x;this.matrix.n13=h.x;this.matrix.n21=g.y;this.matrix.n22=j.y;this.matrix.n23=h.y;this.matrix.n31=g.z;this.matrix.n32=j.z;this.matrix.n33=h.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.matrix.multiplySelf(k);
|
|
|
this.matrixWorldNeedsUpdate=!0;this.matrix.n14=this.position.x;this.matrix.n24=this.position.y;this.matrix.n34=this.position.z;this.supr.update.call(this)};this.translateX=function(b){this.position.x+=this.matrix.n11*b;this.position.y+=this.matrix.n21*b;this.position.z+=this.matrix.n31*b};this.translateY=function(b){this.position.x+=this.matrix.n12*b;this.position.y+=this.matrix.n22*b;this.position.z+=this.matrix.n32*b};this.translateZ=function(b){this.position.x-=this.matrix.n13*b;this.position.y-=
|
|
|
this.matrix.n23*b;this.position.z-=this.matrix.n33*b};this.rotateHorizontally=function(b){g.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);g.multiplyScalar(b);this.forward.subSelf(g);this.forward.normalize()};this.rotateVertically=function(b){j.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);j.multiplyScalar(b);this.forward.addSelf(j);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
-function(b){t=(b.clientX-x)/window.innerWidth;w=(b.clientY-B)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:u=-1;break;
|
|
|
-case 40:case 83:p=-1;break;case 39:case 68:u=1;break;case 81:o=!0;m=1;break;case 69:o=!0;m=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:p=0;break;case 37:case 65:u=0;break;case 40:case 83:p=0;break;case 39:case 68:u=0;break;case 81:o=!1;break;case 69:o=!1;break;case 82:v=0;break;case 70:v=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
|
+function(b){n=(b.clientX-x)/window.innerWidth;w=(b.clientY-B)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=1;break;case 2:o=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:o=0;break;case 2:o=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:o=1;break;case 37:case 65:u=-1;break;
|
|
|
+case 40:case 83:o=-1;break;case 39:case 68:u=1;break;case 81:p=!0;t=1;break;case 69:p=!0;t=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:o=0;break;case 37:case 65:u=0;break;case 40:case 83:o=0;break;case 39:case 68:u=0;break;case 81:p=!1;break;case 69:p=!1;break;case 82:v=0;break;case 70:v=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
|
THREE.RollCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
THREE.TrackballCamera=function(b){function c(b,c){return function(){c.apply(b,arguments)}}b=b||{};THREE.Camera.call(this,b.fov,b.aspect,b.near,b.far,b.target);this.domElement=b.domElement||document;this.screen=b.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=b.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=b.rotateSpeed||1;this.zoomSpeed=b.zoomSpeed||1.2;this.panSpeed=b.panSpeed||0.3;this.noZoom=b.noZoom||!1;this.noPan=b.noPan||
|
|
|
-!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector2,o=new THREE.Vector2,m=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
|
|
|
+!1;this.staticMoving=b.staticMoving||!1;this.dynamicDampingFactor=b.dynamicDampingFactor||0.2;this.minDistance=b.minDistance||0;this.maxDistance=b.maxDistance||Infinity;this.keys=b.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,g=new THREE.Vector3,j=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Vector2,p=new THREE.Vector2,t=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,c){return new THREE.Vector2((b-
|
|
|
this.screen.offsetLeft)/this.radius*0.5,(c-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,c){var e=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-c)/this.radius,0),f=e.length();f>1?e.normalize():e.z=Math.sqrt(1-f*f);g=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(e.y);f.addSelf(this.up.clone().crossSelf(g).setLength(e.x));f.addSelf(g.setLength(e.z));return f};
|
|
|
-this.rotateCamera=function(){var b=Math.acos(j.dot(h)/j.length()/h.length());if(b){var c=(new THREE.Vector3).cross(j,h).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(h);this.staticMoving?j=h:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(j))}};this.zoomCamera=function(){var b=1+(o.y-k.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?k=o:k.y+=(o.y-k.y)*this.dynamicDampingFactor)};
|
|
|
-this.panCamera=function(){var b=p.clone().subSelf(m);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var c=g.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?m=p:m.addSelf(b.sub(p,m).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
|
|
|
+this.rotateCamera=function(){var b=Math.acos(j.dot(h)/j.length()/h.length());if(b){var c=(new THREE.Vector3).cross(j,h).normalize(),e=new THREE.Quaternion;b*=this.rotateSpeed;e.setFromAxisAngle(c,-b);e.multiplyVector3(g);e.multiplyVector3(this.up);e.multiplyVector3(h);this.staticMoving?j=h:(e.setFromAxisAngle(c,b*(this.dynamicDampingFactor-1)),e.multiplyVector3(j))}};this.zoomCamera=function(){var b=1+(p.y-k.y)*this.zoomSpeed;b!==1&&b>0&&(g.multiplyScalar(b),this.staticMoving?k=p:k.y+=(p.y-k.y)*this.dynamicDampingFactor)};
|
|
|
+this.panCamera=function(){var b=o.clone().subSelf(t);if(b.lengthSq()){b.multiplyScalar(g.length()*this.panSpeed);var c=g.clone().crossSelf(this.up).setLength(b.x);c.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(c);this.target.position.addSelf(c);this.staticMoving?t=o:t.addSelf(b.sub(o,t).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*this.maxDistance&&this.position.setLength(this.maxDistance),
|
|
|
g.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,g.setLength(this.minDistance))};this.update=function(b,c,e){g=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,g);this.checkDistances();this.supr.update.call(this,b,c,e)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
-c(this,function(b){e&&(j=h=this.getMouseProjectionOnBall(b.clientX,b.clientY),k=o=this.getMouseOnScreen(b.clientX,b.clientY),m=p=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?o=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(p=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
|
|
|
-b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?j=h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?k=o=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(m=p=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
|
|
|
+c(this,function(b){e&&(j=h=this.getMouseProjectionOnBall(b.clientX,b.clientY),k=p=this.getMouseOnScreen(b.clientX,b.clientY),t=o=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?p=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",c(this,function(b){b.preventDefault();
|
|
|
+b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?j=h=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?k=p=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(t=o=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",c(this,function(b){b.preventDefault();b.stopPropagation();f=this.STATE.NONE}),!1);window.addEventListener("keydown",c(this,function(b){if(f===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])f=
|
|
|
this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)f=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)f=this.STATE.PAN;f!==this.STATE.NONE&&(e=!0)}}),!1);window.addEventListener("keyup",c(this,function(){if(f!==this.STATE.NONE)f=this.STATE.NONE}),!1)};THREE.TrackballCamera.prototype=new THREE.Camera;THREE.TrackballCamera.prototype.constructor=THREE.TrackballCamera;THREE.TrackballCamera.prototype.supr=THREE.Camera.prototype;
|
|
|
THREE.TrackballCamera.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};THREE.QuakeCamera=THREE.FirstPersonCamera;THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(b){return this.getPoint(this.getUtoTmapping(b))};THREE.Curve.prototype.getPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPoint(c/b));return e};
|
|
|
THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPointAt(c/b));return e};THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};
|
|
|
THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==b+1)return this.cacheArcLengths;var c=[],e,f=this.getPoint(0),g,j=0;c.push(0);for(g=1;g<=b;g++)e=this.getPoint(g/b),j+=e.distanceTo(f),c.push(j),f=e;return this.cacheArcLengths=c};
|
|
|
-THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,g=e.length,j;j=c?c:b*e[g-1];time=Date.now();for(var h=0,k=g-1,o;h<=k;)if(f=Math.floor(h+(k-h)/2),o=e[f]-j,o<0)h=f+1;else if(o>0)k=f-1;else{k=f;break}f=k;if(e[f]==j)return f/(g-1);h=e[f];return e=(f+(j-h)/(e[f+1]-h))/(g-1)};THREE.Curve.prototype.getNormalVector=function(b){b=this.getTangent(b);return new THREE.Vector2(-b.y,b.x)};
|
|
|
+THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,g=e.length,j;j=c?c:b*e[g-1];time=Date.now();for(var h=0,k=g-1,p;h<=k;)if(f=Math.floor(h+(k-h)/2),p=e[f]-j,p<0)h=f+1;else if(p>0)k=f-1;else{k=f;break}f=k;if(e[f]==j)return f/(g-1);h=e[f];return e=(f+(j-h)/(e[f+1]-h))/(g-1)};THREE.Curve.prototype.getNormalVector=function(b){b=this.getTangent(b);return new THREE.Vector2(-b.y,b.x)};
|
|
|
THREE.Curve.prototype.getTangent=function(b){var c=b-1.0E-4;b+=1.0E-4;c<0&&(c=0);b>1&&(b=1);var c=this.getPoint(c),b=this.getPoint(b),e=new THREE.Vector2;e.sub(b,c);return e.unit()};THREE.LineCurve=function(b,c){b instanceof THREE.Vector2?(this.v1=b,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(b,c,e,f){this.constructor(new THREE.Vector2(b,c),new THREE.Vector2(e,f))};THREE.LineCurve.prototype=new THREE.Curve;
|
|
|
THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(b).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(b){return this.getPoint(b)};THREE.LineCurve.prototype.getTangent=function(){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.normalize();return b};
|
|
|
THREE.QuadraticBezierCurve=function(b,c,e){if(!(c instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),b=new THREE.Vector2(f[0],f[1]),c=new THREE.Vector2(f[2],f[3]),e=new THREE.Vector2(f[4],f[5]);this.v0=b;this.v1=c;this.v2=e};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
|
|
@@ -430,140 +430,141 @@ THREE.Curve.create=function(b,c){b.prototype=new THREE.Curve;b.prototype.constru
|
|
|
THREE.QuadraticBezierCurve3=THREE.Curve.create(function(b,c,e){this.v0=b;this.v1=c;this.v2=e},function(b){var c,e;c=THREE.Shape.Utils.b2(b,this.v0.x,this.v1.x,this.v2.x);e=THREE.Shape.Utils.b2(b,this.v0.y,this.v1.y,this.v2.y);b=THREE.Shape.Utils.b2(b,this.v0.z,this.v1.z,this.v2.z);return new THREE.Vector3(c,e,b)});THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(b){this.curves.push(b)};
|
|
|
THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};THREE.CurvePath.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.getCurveLengths(),b=0;b<e.length;){if(e[b]>=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};THREE.CurvePath.prototype.getLength=function(){var b=this.getCurveLengths();return b[b.length-1]};
|
|
|
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var b=[],c=0,e,f=this.curves.length;for(e=0;e<f;e++)c+=this.curves[e].getLength(),b.push(c);return this.cacheLengths=b};
|
|
|
-THREE.CurvePath.prototype.getBoundingBox=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var j,h,k,o;o=new THREE.Vector2;h=0;for(k=b.length;h<k;h++){j=b[h];if(j.x>c)c=j.x;else if(j.x<f)f=j.x;if(j.y>e)e=j.y;else if(j.y<e)g=j.y;o.addSelf(j.x,j.y)}return{minX:f,minY:g,maxX:c,maxY:e,centroid:o.divideScalar(k)}};THREE.CurvePath.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,!0))};
|
|
|
+THREE.CurvePath.prototype.getBoundingBox=function(){var b=this.getPoints(),c,e,f,g;c=e=Number.NEGATIVE_INFINITY;f=g=Number.POSITIVE_INFINITY;var j,h,k,p;p=new THREE.Vector2;h=0;for(k=b.length;h<k;h++){j=b[h];if(j.x>c)c=j.x;else if(j.x<f)f=j.x;if(j.y>e)e=j.y;else if(j.y<e)g=j.y;p.addSelf(j.x,j.y)}return{minX:f,minY:g,maxX:c,maxY:e,centroid:p.divideScalar(k)}};THREE.CurvePath.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,!0))};
|
|
|
THREE.CurvePath.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,!0))};THREE.CurvePath.prototype.createGeometry=function(b){for(var c=new THREE.Geometry,e=0;e<b.length;e++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(b[e].x,b[e].y,0)));return c};THREE.CurvePath.prototype.addWrapPath=function(b){this.bends.push(b)};
|
|
|
THREE.CurvePath.prototype.getTransformedPoints=function(b,c){var e=this.getPoints(b),f,g;if(!c)c=this.bends;f=0;for(g=c.length;f<g;f++)e=this.getWrapPoints(e,c[f]);return e};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(b,c){var e=this.getSpacedPoints(b),f,g;if(!c)c=this.bends;f=0;for(g=c.length;f<g;f++)e=this.getWrapPoints(e,c[f]);return e};
|
|
|
-THREE.CurvePath.prototype.getWrapPoints=function(b,c){var e=this.getBoundingBox(),f,g,j,h,k,o;f=0;for(g=b.length;f<g;f++)j=b[f],h=j.x,k=j.y,o=h/e.maxX,o=c.getUtoTmapping(o,h),h=c.getPoint(o),k=c.getNormalVector(o).multiplyScalar(k),j.x=h.x+k.x,j.y=h.y+k.y;return b};THREE.Path=function(b){THREE.CurvePath.call(this);this.actions=[];b&&this.fromPoints(b)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
|
|
|
+THREE.CurvePath.prototype.getWrapPoints=function(b,c){var e=this.getBoundingBox(),f,g,j,h,k,p;f=0;for(g=b.length;f<g;f++)j=b[f],h=j.x,k=j.y,p=h/e.maxX,p=c.getUtoTmapping(p,h),h=c.getPoint(p),k=c.getNormalVector(p).multiplyScalar(k),j.x=h.x+k.x,j.y=h.y+k.y;return b};THREE.Path=function(b){THREE.CurvePath.call(this);this.actions=[];b&&this.fromPoints(b)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
|
|
|
THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(b){this.moveTo(b[0].x,b[0].y);var c,e=b.length;for(c=1;c<e;c++)this.lineTo(b[c].x,b[c].y)};THREE.Path.prototype.moveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:b})};
|
|
|
THREE.Path.prototype.lineTo=function(b,c){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(b,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:e})};
|
|
|
THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var g=Array.prototype.slice.call(arguments),j=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(j[j.length-2],j[j.length-1]),new THREE.Vector2(b,c),new THREE.Vector2(e,f)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:g})};
|
|
|
THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,g,j){var h=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(b,c),new THREE.Vector2(e,f),new THREE.Vector2(g,j)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:h})};
|
|
|
THREE.Path.prototype.splineThru=function(b){var c=Array.prototype.slice.call(arguments),e=this.actions[this.actions.length-1].args,e=[new THREE.Vector2(e[e.length-2],e[e.length-1])],e=e.concat(b);this.curves.push(new THREE.SplineCurve(e));this.actions.push({action:THREE.PathActions.CSPLINE_THRU,args:c})};THREE.Path.prototype.arc=function(b,c,e,f,g,j){var h=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,g,j));this.actions.push({action:THREE.PathActions.ARC,args:h})};
|
|
|
THREE.Path.prototype.getSpacedPoints=function(b){b||(b=40);for(var c=[],e=0;e<b;e++)c.push(this.getPoint(e/b));return c};
|
|
|
-THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,g,j,h,k,o,m,p,u,v,t,w,x;f=0;for(g=this.actions.length;f<g;f++)switch(j=this.actions[f],h=j.action,j=j.args,h){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(j[0],j[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=j[2];o=j[3];u=j[0];v=j[1];e.length>0?(h=e[e.length-1],t=h.x,w=h.y):(h=this.actions[f-1].args,t=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)x=h/b,j=THREE.Shape.Utils.b2(x,t,u,k),x=THREE.Shape.Utils.b2(x,w,v,
|
|
|
-o),e.push(new THREE.Vector2(j,x));break;case THREE.PathActions.BEZIER_CURVE_TO:k=j[4];o=j[5];u=j[0];v=j[1];m=j[2];p=j[3];e.length>0?(h=e[e.length-1],t=h.x,w=h.y):(h=this.actions[f-1].args,t=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)x=h/b,j=THREE.Shape.Utils.b3(x,t,u,m,k),x=THREE.Shape.Utils.b3(x,w,v,p,o),e.push(new THREE.Vector2(j,x));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[f-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];x=b*j[0].length;h=h.concat(j[0]);j=new THREE.SplineCurve(h);
|
|
|
-for(h=1;h<=x;h++)e.push(j.getPointAt(h/x));break;case THREE.PathActions.ARC:h=this.actions[f-1].args;k=j[0];o=j[1];m=j[2];u=j[3];x=j[4];v=!!j[5];p=h[h.length-2];t=h[h.length-1];h.length==0&&(p=t=0);w=x-u;var B=b*2;for(h=1;h<=B;h++)x=h/B,v||(x=1-x),x=u+x*w,j=p+k+m*Math.cos(x),x=t+o+m*Math.sin(x),e.push(new THREE.Vector2(j,x))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)};
|
|
|
-THREE.Path.prototype.nltransform=function(b,c,e,f,g,j){var h=this.getPoints(),k,o,m,p,u;k=0;for(o=h.length;k<o;k++)m=h[k],p=m.x,u=m.y,m.x=b*p+c*u+e,m.y=f*u+g*p+j;return h};
|
|
|
+THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,g,j,h,k,p,t,o,u,v,n,w,x;f=0;for(g=this.actions.length;f<g;f++)switch(j=this.actions[f],h=j.action,j=j.args,h){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(j[0],j[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:k=j[2];p=j[3];u=j[0];v=j[1];e.length>0?(h=e[e.length-1],n=h.x,w=h.y):(h=this.actions[f-1].args,n=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)x=h/b,j=THREE.Shape.Utils.b2(x,n,u,k),x=THREE.Shape.Utils.b2(x,w,v,
|
|
|
+p),e.push(new THREE.Vector2(j,x));break;case THREE.PathActions.BEZIER_CURVE_TO:k=j[4];p=j[5];u=j[0];v=j[1];t=j[2];o=j[3];e.length>0?(h=e[e.length-1],n=h.x,w=h.y):(h=this.actions[f-1].args,n=h[h.length-2],w=h[h.length-1]);for(h=1;h<=b;h++)x=h/b,j=THREE.Shape.Utils.b3(x,n,u,t,k),x=THREE.Shape.Utils.b3(x,w,v,o,p),e.push(new THREE.Vector2(j,x));break;case THREE.PathActions.CSPLINE_THRU:h=this.actions[f-1].args;h=[new THREE.Vector2(h[h.length-2],h[h.length-1])];x=b*j[0].length;h=h.concat(j[0]);j=new THREE.SplineCurve(h);
|
|
|
+for(h=1;h<=x;h++)e.push(j.getPointAt(h/x));break;case THREE.PathActions.ARC:h=this.actions[f-1].args;k=j[0];p=j[1];t=j[2];u=j[3];x=j[4];v=!!j[5];o=h[h.length-2];n=h[h.length-1];h.length==0&&(o=n=0);w=x-u;var B=b*2;for(h=1;h<=B;h++)x=h/B,v||(x=1-x),x=u+x*w,j=o+k+t*Math.cos(x),x=n+p+t*Math.sin(x),e.push(new THREE.Vector2(j,x))}c&&e.push(e[0]);return e};THREE.Path.prototype.transform=function(b,c){this.getBoundingBox();return this.getWrapPoints(this.getPoints(c),b)};
|
|
|
+THREE.Path.prototype.nltransform=function(b,c,e,f,g,j){var h=this.getPoints(),k,p,t,o,u;k=0;for(p=h.length;k<p;k++)t=h[k],o=t.x,u=t.y,t.x=b*o+c*u+e,t.y=f*u+g*o+j;return h};
|
|
|
THREE.Path.prototype.debug=function(b){var c=this.getBoundingBox();b||(b=document.createElement("canvas"),b.setAttribute("width",c.maxX+100),b.setAttribute("height",c.maxY+100),document.body.appendChild(b));c=b.getContext("2d");c.fillStyle="white";c.fillRect(0,0,b.width,b.height);c.strokeStyle="black";c.beginPath();var e,f,g,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],g=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,g);c.stroke();c.closePath();c.strokeStyle="red";f=
|
|
|
this.getPoints();b=0;for(e=f.length;b<e;b++)g=f[b],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 b,c,e,f,g=[],j=new THREE.Path;b=0;for(c=this.actions.length;b<c;b++)e=this.actions[b],f=e.args,e=e.action,e==THREE.PathActions.MOVE_TO&&j.actions.length!=0&&(g.push(j),j=new THREE.Path),j[e].apply(j,f);j.actions.length!=0&&g.push(j);if(g.length==0)return[];var h,j=[];if(THREE.Shape.Utils.isClockWise(g[0].getPoints())){b=0;for(c=g.length;b<c;b++)f=g[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(h&&j.push(h),h=new THREE.Shape,h.actions=f.actions,h.curves=
|
|
|
f.curves):h.holes.push(f);j.push(h)}else{h=new THREE.Shape;b=0;for(c=g.length;b<c;b++)f=g[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(h.actions=f.actions,h.curves=f.curves,j.push(h),h=new THREE.Shape):h.holes.push(f)}return j};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(b){return new THREE.ExtrudeGeometry(this,b)};
|
|
|
THREE.Shape.prototype.getPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getTransformedPoints(b,this.bends);return f};THREE.Shape.prototype.getSpacedPointsHoles=function(b){var c,e=this.holes.length,f=[];for(c=0;c<e;c++)f[c]=this.holes[c].getTransformedSpacedPoints(b,this.bends);return f};THREE.Shape.prototype.extractAllPoints=function(b){return{shape:this.getTransformedPoints(b),holes:this.getPointsHoles(b)}};
|
|
|
THREE.Shape.prototype.extractAllSpacedPoints=function(b){return{shape:this.getTransformedSpacedPoints(b),holes:this.getSpacedPointsHoles(b)}};
|
|
|
-THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),g,j,h,k,o,m,p,u,v,t,w=[];for(o=0;o<c.length;o++){m=c[o];f=f.concat(m);j=Number.POSITIVE_INFINITY;for(g=0;g<m.length;g++){v=m[g];t=[];for(u=0;u<e.length;u++)p=e[u],p=v.distanceToSquared(p),t.push(p),p<j&&(j=p,h=g,k=u)}g=k-1>=0?k-1:e.length-1;j=h-1>=0?h-1:m.length-1;var x=[m[h],e[k],e[g]];u=THREE.FontUtils.Triangulate.area(x);var B=[m[h],m[j],e[k]];v=THREE.FontUtils.Triangulate.area(B);t=k;p=h;k+=1;h+=-1;k<0&&(k+=e.length);k%=
|
|
|
-e.length;h<0&&(h+=m.length);h%=m.length;g=k-1>=0?k-1:e.length-1;j=h-1>=0?h-1:m.length-1;x=[m[h],e[k],e[g]];x=THREE.FontUtils.Triangulate.area(x);B=[m[h],m[j],e[k]];B=THREE.FontUtils.Triangulate.area(B);u+v>x+B&&(k=t,h=p,k<0&&(k+=e.length),k%=e.length,h<0&&(h+=m.length),h%=m.length,g=k-1>=0?k-1:e.length-1,j=h-1>=0?h-1:m.length-1);u=e.slice(0,k);v=e.slice(k);t=m.slice(h);p=m.slice(0,h);j=[m[h],m[j],e[k]];w.push([m[h],e[k],e[g]]);w.push(j);e=u.concat(t).concat(p).concat(v)}return{shape:e,isolatedPts:w,
|
|
|
-allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),j,h,k,o,m={};j=0;for(h=f.length;j<h;j++)o=f[j].x+":"+f[j].y,m[o]!==void 0&&console.log("Duplicate point",o),m[o]=j;j=0;for(h=e.length;j<h;j++){k=e[j];for(f=0;f<3;f++)o=k[f].x+":"+k[f].y,o=m[o],o!==void 0&&(k[f]=o)}j=0;for(h=g.length;j<h;j++){k=g[j];for(f=0;f<3;f++)o=k[f].x+":"+k[f].y,o=m[o],o!==void 0&&(k[f]=o)}return e.concat(g)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<
|
|
|
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),g,j,h,k,p,t,o,u,v,n,w=[];for(p=0;p<c.length;p++){t=c[p];f=f.concat(t);j=Number.POSITIVE_INFINITY;for(g=0;g<t.length;g++){v=t[g];n=[];for(u=0;u<e.length;u++)o=e[u],o=v.distanceToSquared(o),n.push(o),o<j&&(j=o,h=g,k=u)}g=k-1>=0?k-1:e.length-1;j=h-1>=0?h-1:t.length-1;var x=[t[h],e[k],e[g]];u=THREE.FontUtils.Triangulate.area(x);var B=[t[h],t[j],e[k]];v=THREE.FontUtils.Triangulate.area(B);n=k;o=h;k+=1;h+=-1;k<0&&(k+=e.length);k%=
|
|
|
+e.length;h<0&&(h+=t.length);h%=t.length;g=k-1>=0?k-1:e.length-1;j=h-1>=0?h-1:t.length-1;x=[t[h],e[k],e[g]];x=THREE.FontUtils.Triangulate.area(x);B=[t[h],t[j],e[k]];B=THREE.FontUtils.Triangulate.area(B);u+v>x+B&&(k=n,h=o,k<0&&(k+=e.length),k%=e.length,h<0&&(h+=t.length),h%=t.length,g=k-1>=0?k-1:e.length-1,j=h-1>=0?h-1:t.length-1);u=e.slice(0,k);v=e.slice(k);n=t.slice(h);o=t.slice(0,h);j=[t[h],t[j],e[k]];w.push([t[h],e[k],e[g]]);w.push(j);e=u.concat(n).concat(o).concat(v)}return{shape:e,isolatedPts:w,
|
|
|
+allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,g=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),j,h,k,p,t={};j=0;for(h=f.length;j<h;j++)p=f[j].x+":"+f[j].y,t[p]!==void 0&&console.log("Duplicate point",p),t[p]=j;j=0;for(h=e.length;j<h;j++){k=e[j];for(f=0;f<3;f++)p=k[f].x+":"+k[f].y,p=t[p],p!==void 0&&(k[f]=p)}j=0;for(h=g.length;j<h;j++){k=g[j];for(f=0;f<3;f++)p=k[f].x+":"+k[f].y,p=t[p],p!==void 0&&(k[f]=p)}return e.concat(g)},isClockWise:function(b){return THREE.FontUtils.Triangulate.area(b)<
|
|
|
0},b2p0:function(b,c){var e=1-b;return e*e*c},b2p1:function(b,c){return 2*(1-b)*b*c},b2p2:function(b,c){return b*b*c},b2:function(b,c,e,f){return this.b2p0(b,c)+this.b2p1(b,e)+this.b2p2(b,f)},b3p0:function(b,c){var e=1-b;return e*e*e*c},b3p1:function(b,c){var e=1-b;return 3*e*e*b*c},b3p2:function(b,c){return 3*(1-b)*b*b*c},b3p3:function(b,c){return b*b*b*c},b3:function(b,c,e,f,g){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,g)}};
|
|
|
THREE.TextPath=function(b,c){THREE.Path.call(this);this.parameters=c||{};this.set(b)};THREE.TextPath.prototype.set=function(b,c){this.text=b;var c=c||this.parameters,e=c.curveSegments!==void 0?c.curveSegments:4,f=c.font!==void 0?c.font:"helvetiker",g=c.weight!==void 0?c.weight:"normal",j=c.style!==void 0?c.style:"normal";THREE.FontUtils.size=c.size!==void 0?c.size:100;THREE.FontUtils.divisions=e;THREE.FontUtils.face=f;THREE.FontUtils.weight=g;THREE.FontUtils.style=j};
|
|
|
THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)c=c.concat(b[e].toShapes());return c};
|
|
|
-THREE.CubeGeometry=function(b,c,e,f,g,j,h,k,o){function m(b,c,e,h,k,m,o,t){var u,v,w=f||1,x=g||1,M=k/2,L=m/2,n=p.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",x=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=j||1;var S=w+1,V=x+1;k/=w;var X=m/x;for(v=0;v<V;v++)for(m=0;m<S;m++){var Q=new THREE.Vector3;Q[b]=(m*k-M)*e;Q[c]=(v*X-L)*h;Q[u]=o;p.vertices.push(new THREE.Vertex(Q))}for(v=0;v<x;v++)for(m=0;m<w;m++)p.faces.push(new THREE.Face4(m+S*v+
|
|
|
-n,m+S*(v+1)+n,m+1+S*(v+1)+n,m+1+S*v+n,null,null,t)),p.faceVertexUvs[0].push([new THREE.UV(m/w,v/x),new THREE.UV(m/w,(v+1)/x),new THREE.UV((m+1)/w,(v+1)/x),new THREE.UV((m+1)/w,v/x)])}THREE.Geometry.call(this);var p=this,u=b/2,v=c/2,t=e/2,k=k?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(o!=void 0)for(var x in o)this.sides[x]!=void 0&&(this.sides[x]=
|
|
|
-o[x]);this.sides.px&&m("z","y",1*k,-1,e,c,-u,this.materials[0]);this.sides.nx&&m("z","y",-1*k,-1,e,c,u,this.materials[1]);this.sides.py&&m("x","z",1*k,1,b,e,v,this.materials[2]);this.sides.ny&&m("x","z",1*k,-1,b,e,-v,this.materials[3]);this.sides.pz&&m("x","y",1*k,-1,b,c,t,this.materials[4]);this.sides.nz&&m("x","y",-1*k,-1,b,c,-t,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=p.vertices.length;e<f;e++){for(var g=p.vertices[e],h=!1,j=0,k=b.length;j<k;j++){var m=b[j];if(g.position.x==m.position.x&&
|
|
|
-g.position.y==m.position.y&&g.position.z==m.position.z){c[e]=j;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(g.position.clone()))}e=0;for(f=p.faces.length;e<f;e++)g=p.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];p.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(b,c,e,f,g,j){function h(b,c,e){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var k=this,o,m=Math.PI*2,p=f/2;for(o=0;o<b;o++)h(Math.sin(m*o/b)*c,Math.cos(m*o/b)*c,-p);for(o=0;o<b;o++)h(Math.sin(m*o/b)*e,Math.cos(m*o/b)*e,p);for(o=0;o<b;o++)k.faces.push(new THREE.Face4(o,o+b,b+(o+1)%b,(o+1)%b));if(e>0){h(0,0,-p-(j||0));for(o=b;o<b+b/2;o++)k.faces.push(new THREE.Face4(2*b,(2*o-2*b)%b,(2*o-2*b+1)%b,(2*o-2*b+2)%b))}if(c>0){h(0,0,p+
|
|
|
-(g||0));for(o=b+b/2;o<2*b;o++)k.faces.push(new THREE.Face4(2*b+1,(2*o-2*b+2)%b+b,(2*o-2*b+1)%b+b,(2*o-2*b)%b+b))}o=0;for(b=this.faces.length;o<b;o++){var c=[],e=this.faces[o],g=this.vertices[e.a],j=this.vertices[e.b],p=this.vertices[e.c],u=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/m,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/m,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(p.position.x,p.position.y)/m,0.5+p.position.z/
|
|
|
-f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(u.position.x,u.position.y)/m,0.5+u.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
-THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,g;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)g=b[e],this.addShape(g,c)}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
+THREE.CubeGeometry=function(b,c,e,f,g,j,h,k,p){function t(b,c,e,h,k,n,p,t){var u,v,w=f||1,x=g||1,K=k/2,N=n/2,m=o.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")u="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")u="y",x=j||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")u="x",w=j||1;var U=w+1,V=x+1;k/=w;var W=n/x;for(v=0;v<V;v++)for(n=0;n<U;n++){var R=new THREE.Vector3;R[b]=(n*k-K)*e;R[c]=(v*W-N)*h;R[u]=p;o.vertices.push(new THREE.Vertex(R))}for(v=0;v<x;v++)for(n=0;n<w;n++)o.faces.push(new THREE.Face4(n+U*v+
|
|
|
+m,n+U*(v+1)+m,n+1+U*(v+1)+m,n+1+U*v+m,null,null,t)),o.faceVertexUvs[0].push([new THREE.UV(n/w,v/x),new THREE.UV(n/w,(v+1)/x),new THREE.UV((n+1)/w,(v+1)/x),new THREE.UV((n+1)/w,v/x)])}THREE.Geometry.call(this);var o=this,u=b/2,v=c/2,n=e/2,k=k?-1:1;if(h!==void 0)if(h instanceof Array)this.materials=h;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([h])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var x in p)this.sides[x]!=void 0&&(this.sides[x]=
|
|
|
+p[x]);this.sides.px&&t("z","y",1*k,-1,e,c,-u,this.materials[0]);this.sides.nx&&t("z","y",-1*k,-1,e,c,u,this.materials[1]);this.sides.py&&t("x","z",1*k,1,b,e,v,this.materials[2]);this.sides.ny&&t("x","z",1*k,-1,b,e,-v,this.materials[3]);this.sides.pz&&t("x","y",1*k,-1,b,c,n,this.materials[4]);this.sides.nz&&t("x","y",-1*k,-1,b,c,-n,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=o.vertices.length;e<f;e++){for(var g=o.vertices[e],h=!1,j=0,k=b.length;j<k;j++){var n=b[j];if(g.position.x==n.position.x&&
|
|
|
+g.position.y==n.position.y&&g.position.z==n.position.z){c[e]=j;h=!0;break}}if(!h)c[e]=b.length,b.push(new THREE.Vertex(g.position.clone()))}e=0;for(f=o.faces.length;e<f;e++)g=o.faces[e],g.a=c[g.a],g.b=c[g.b],g.c=c[g.c],g.d=c[g.d];o.vertices=b})();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
+THREE.CylinderGeometry=function(b,c,e,f,g,j){function h(b,c,e){k.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}THREE.Geometry.call(this);var k=this,p,t=Math.PI*2,o=f/2;for(p=0;p<b;p++)h(Math.sin(t*p/b)*c,Math.cos(t*p/b)*c,-o);for(p=0;p<b;p++)h(Math.sin(t*p/b)*e,Math.cos(t*p/b)*e,o);for(p=0;p<b;p++)k.faces.push(new THREE.Face4(p,p+b,b+(p+1)%b,(p+1)%b));if(e>0){h(0,0,-o-(j||0));for(p=b;p<b+b/2;p++)k.faces.push(new THREE.Face4(2*b,(2*p-2*b)%b,(2*p-2*b+1)%b,(2*p-2*b+2)%b))}if(c>0){h(0,0,o+
|
|
|
+(g||0));for(p=b+b/2;p<2*b;p++)k.faces.push(new THREE.Face4(2*b+1,(2*p-2*b+2)%b+b,(2*p-2*b+1)%b+b,(2*p-2*b)%b+b))}p=0;for(b=this.faces.length;p<b;p++){var c=[],e=this.faces[p],g=this.vertices[e.a],j=this.vertices[e.b],o=this.vertices[e.c],u=this.vertices[e.d];c.push(new THREE.UV(0.5+Math.atan2(g.position.x,g.position.y)/t,0.5+g.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(j.position.x,j.position.y)/t,0.5+j.position.z/f));c.push(new THREE.UV(0.5+Math.atan2(o.position.x,o.position.y)/t,0.5+o.position.z/
|
|
|
+f));e instanceof THREE.Face4&&c.push(new THREE.UV(0.5+Math.atan2(u.position.x,u.position.y)/t,0.5+u.position.z/f));this.faceVertexUvs[0].push(c)}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.ExtrudeGeometry=function(b,c){if(typeof b!="undefined"){THREE.Geometry.call(this);var b=b instanceof Array?b:[b],e,f=b.length,g;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)g=b[e],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(b,c){function e(b,c,e){c||console.log("die");return c.clone().multiplyScalar(e).addSelf(b)}function f(b,c,e){var f=THREE.ExtrudeGeometry.__v1,g=THREE.ExtrudeGeometry.__v2,h=THREE.ExtrudeGeometry.__v3,j=THREE.ExtrudeGeometry.__v4,k=THREE.ExtrudeGeometry.__v5,m=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);g.set(b.x-e.x,b.y-e.y);f=f.normalize();g=g.normalize();h.set(-f.y,f.x);j.set(g.y,-g.x);k.copy(b).addSelf(h);m.copy(b).addSelf(j);if(k.equals(m))return j.clone();
|
|
|
-k.copy(c).addSelf(h);m.copy(e).addSelf(j);h=f.dot(j);j=m.subSelf(k).dot(j);h==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=h;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(k).subSelf(b).clone()}function g(b){for(E=b.length;--E>=0;){Y=E;ea=E-1;ea<0&&(ea=b.length-
|
|
|
-1);for(var c=0,c=0;c<t+p*2;c++){var e=V*c,f=V*(c+1),g=$+Y+e,e=$+ea+e,h=$+ea+f,f=$+Y+f;g+=D;e+=D;h+=D;f+=D;N.faces.push(new THREE.Face4(g,e,h,f))}}}function j(b,c,e){N.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=D;c+=D;e+=D;N.faces.push(new THREE.Face3(b,c,e,null,null,z));N.faceVertexUvs[0].push([new THREE.UV(N.vertices[b].x/H.maxX,N.vertices[b].y/H.maxY),new THREE.UV(N.vertices[c].x/H.maxX,N.vertices[c].y/H.maxY),new THREE.UV(N.vertices[e].x/H.maxX,N.vertices[e].y/
|
|
|
-H.maxY)])}var k=c.amount!==void 0?c.amount:100,o=c.bevelThickness!==void 0?c.bevelThickness:6,m=c.bevelSize!==void 0?c.bevelSize:o-2,p=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:!0,v=c.curveSegments!==void 0?c.curveSegments:12,t=c.steps!==void 0?c.steps:1,w=c.bendPath,x=c.extrudePath,B,A=!1,I=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,z=c.material,H=this.shapebb;console.log(H);if(x)B=x.getPoints(v),t=B.length,A=!0,u=!1;u||(m=o=p=0);var G,C,O,N=this,D=
|
|
|
-this.vertices.length;w&&b.addWrapPath(w);v=I?b.extractAllSpacedPoints(v):b.extractAllPoints(v);w=v.shape;v=v.holes;if(x=!THREE.Shape.Utils.isClockWise(w)){w=w.reverse();C=0;for(O=v.length;C<O;C++)G=v[C],THREE.Shape.Utils.isClockWise(G)&&(v[C]=G.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(w,v);I=w;C=0;for(O=v.length;C<O;C++)G=v[C],w=w.concat(G);var E,U,M,L,n,S,V=w.length,X=x.length,Q=[];E=0;U=I.length;Y=U-1;for(ea=E+1;E<U;E++,Y++,ea++)Y==U&&(Y=0),ea==U&&(ea=0),Q[E]=f(I[E],I[Y],I[ea]);var fa=
|
|
|
-[],W,ca=Q.concat();C=0;for(O=v.length;C<O;C++){G=v[C];W=[];E=0;U=G.length;Y=U-1;for(ea=E+1;E<U;E++,Y++,ea++)Y==U&&(Y=0),ea==U&&(ea=0),W[E]=f(G[E],G[Y],G[ea]);fa.push(W);ca=ca.concat(W)}for(M=0;M<p;M++){L=M/p;n=o*(1-L);L=m*Math.sin(L*Math.PI/2);E=0;for(U=I.length;E<U;E++)S=e(I[E],Q[E],L),j(S.x,S.y,-n);C=0;for(O=v.length;C<O;C++){G=v[C];W=fa[C];E=0;for(U=G.length;E<U;E++)S=e(G[E],W[E],L),j(S.x,S.y,-n)}}L=m;for(E=0;E<V;E++)S=u?e(w[E],ca[E],L):w[E],A?j(S.x,S.y+B[0].y,B[0].x):j(S.x,S.y,0);for(M=1;M<=t;M++)for(E=
|
|
|
-0;E<V;E++)S=u?e(w[E],ca[E],L):w[E],A?j(S.x,S.y+B[M-1].y,B[M-1].x):j(S.x,S.y,k/t*M);for(M=p-1;M>=0;M--){L=M/p;n=o*(1-L);L=m*Math.sin(L*Math.PI/2);E=0;for(U=I.length;E<U;E++)S=e(I[E],Q[E],L),j(S.x,S.y,k+n);C=0;for(O=v.length;C<O;C++){G=v[C];W=fa[C];E=0;for(U=G.length;E<U;E++)S=e(G[E],W[E],L),A?j(S.x,S.y+B[t-1].y,B[t-1].x+n):j(S.x,S.y,k+n)}}if(u){o=V*0;for(E=0;E<X;E++)k=x[E],h(k[2]+o,k[1]+o,k[0]+o);o=V*(t+p*2);for(E=0;E<X;E++)k=x[E],h(k[0]+o,k[1]+o,k[2]+o)}else{for(E=0;E<X;E++)k=x[E],h(k[2],k[1],k[0]);
|
|
|
-for(E=0;E<X;E++)k=x[E],h(k[0]+V*t,k[1]+V*t,k[2]+V*t)}var Y,ea,$=0;g(I);$+=I.length;C=0;for(O=v.length;C<O;C++)G=v[C],g(G),$+=G.length;this.computeCentroids();this.computeFaceNormals()};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;
|
|
|
+k.copy(c).addSelf(h);m.copy(e).addSelf(j);h=f.dot(j);j=m.subSelf(k).dot(j);h==0&&(console.log("Either infinite or no solutions!"),j==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));j/=h;if(j<0)return c=Math.atan2(c.y-b.y,c.x-b.x),b=Math.atan2(e.y-b.y,e.x-b.x),c>b&&(b+=Math.PI*2),anglec=(c+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(j).addSelf(k).subSelf(b).clone()}function g(b){for(J=b.length;--J>=0;){ia=J;ca=J-1;ca<0&&(ca=b.length-
|
|
|
+1);for(var c=0,e=n+o*2,c=0;c<e;c++){var f=W*c,g=W*(c+1),h=Z+ia+f,j=Z+ia+g,m=h,f=Z+ca+f,g=Z+ca+g,t=j;m+=T;f+=T;g+=T;t+=T;H.faces.push(new THREE.Face4(m,f,g,t,null,null,G));G&&(m=c/e,f=(c+1)/e,g=k+p*2,h=(H.vertices[h].position.z+p)/g,j=(H.vertices[j].position.z+p)/g,H.faceVertexUvs[0].push([new THREE.UV(h,m),new THREE.UV(j,m),new THREE.UV(j,f),new THREE.UV(h,f)]))}}}function j(b,c,e){H.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function h(b,c,e){b+=T;c+=T;e+=T;H.faces.push(new THREE.Face3(b,
|
|
|
+c,e,null,null,z));if(z){var f=I.maxY,g=I.maxX;H.faceVertexUvs[0].push([new THREE.UV(H.vertices[b].position.x/g,H.vertices[b].position.y/f),new THREE.UV(H.vertices[c].position.x/g,H.vertices[c].position.y/f),new THREE.UV(H.vertices[e].position.x/g,H.vertices[e].position.y/f)])}}var k=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,t=c.bevelSize!==void 0?c.bevelSize:p-2,o=c.bevelSegments!==void 0?c.bevelSegments:3,u=c.bevelEnabled!==void 0?c.bevelEnabled:!0,v=c.curveSegments!==
|
|
|
+void 0?c.curveSegments:12,n=c.steps!==void 0?c.steps:1,w=c.bendPath,x=c.extrudePath,B,A=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,z=c.material,G=c.extrudeMaterial,I=this.shapebb;if(x)B=x.getPoints(v),n=B.length,A=!0,u=!1;u||(t=p=o=0);var C,L,D,H=this,T=this.vertices.length;w&&b.addWrapPath(w);v=F?b.extractAllSpacedPoints(v):b.extractAllPoints(v);w=v.shape;v=v.holes;if(x=!THREE.Shape.Utils.isClockWise(w)){w=w.reverse();L=0;for(D=v.length;L<D;L++)C=v[L],THREE.Shape.Utils.isClockWise(C)&&
|
|
|
+(v[L]=C.reverse());x=!1}x=THREE.Shape.Utils.triangulateShape(w,v);F=w;L=0;for(D=v.length;L<D;L++)C=v[L],w=w.concat(C);var J,K,N,m,U,V,W=w.length,R=x.length,Y=[];J=0;K=F.length;ia=K-1;for(ca=J+1;J<K;J++,ia++,ca++)ia==K&&(ia=0),ca==K&&(ca=0),Y[J]=f(F[J],F[ia],F[ca]);var ha=[],da,aa=Y.concat();L=0;for(D=v.length;L<D;L++){C=v[L];da=[];J=0;K=C.length;ia=K-1;for(ca=J+1;J<K;J++,ia++,ca++)ia==K&&(ia=0),ca==K&&(ca=0),da[J]=f(C[J],C[ia],C[ca]);ha.push(da);aa=aa.concat(da)}for(N=0;N<o;N++){m=N/o;U=p*(1-m);m=
|
|
|
+t*Math.sin(m*Math.PI/2);J=0;for(K=F.length;J<K;J++)V=e(F[J],Y[J],m),j(V.x,V.y,-U);L=0;for(D=v.length;L<D;L++){C=v[L];da=ha[L];J=0;for(K=C.length;J<K;J++)V=e(C[J],da[J],m),j(V.x,V.y,-U)}}m=t;for(J=0;J<W;J++)V=u?e(w[J],aa[J],m):w[J],A?j(V.x,V.y+B[0].y,B[0].x):j(V.x,V.y,0);for(N=1;N<=n;N++)for(J=0;J<W;J++)V=u?e(w[J],aa[J],m):w[J],A?j(V.x,V.y+B[N-1].y,B[N-1].x):j(V.x,V.y,k/n*N);for(N=o-1;N>=0;N--){m=N/o;U=p*(1-m);m=t*Math.sin(m*Math.PI/2);J=0;for(K=F.length;J<K;J++)V=e(F[J],Y[J],m),j(V.x,V.y,k+U);L=0;
|
|
|
+for(D=v.length;L<D;L++){C=v[L];da=ha[L];J=0;for(K=C.length;J<K;J++)V=e(C[J],da[J],m),A?j(V.x,V.y+B[n-1].y,B[n-1].x+U):j(V.x,V.y,k+U)}}if(u){u=W*0;for(J=0;J<R;J++)t=x[J],h(t[2]+u,t[1]+u,t[0]+u);u=W*(n+o*2);for(J=0;J<R;J++)t=x[J],h(t[0]+u,t[1]+u,t[2]+u)}else{for(J=0;J<R;J++)t=x[J],h(t[2],t[1],t[0]);for(J=0;J<R;J++)t=x[J],h(t[0]+W*n,t[1]+W*n,t[2]+W*n)}var ia,ca,Z=0;g(F);Z+=F.length;L=0;for(D=v.length;L<D;L++)C=v[L],g(C),Z+=C.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(b){function c(b,c,e){var f=Math.sqrt(b*b+c*c+e*e);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,c/f,e/f)))-1}function e(b,c,e,f){f.faces.push(new THREE.Face3(b,c,e))}function f(b,e){var f=g.vertices[b].position,h=g.vertices[e].position;return c((f.x+h.x)/2,(f.y+h.y)/2,(f.z+h.z)/2)}var g=this,j=new THREE.Geometry;this.subdivisions=b||0;THREE.Geometry.call(this);b=(1+Math.sqrt(5))/2;c(-1,b,0);c(1,b,0);c(-1,-b,0);c(1,-b,0);c(0,-1,b);c(0,1,b);c(0,-1,
|
|
|
--b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,j);e(0,5,1,j);e(0,1,7,j);e(0,7,10,j);e(0,10,11,j);e(1,5,9,j);e(5,11,4,j);e(11,10,2,j);e(10,7,6,j);e(7,1,8,j);e(3,9,4,j);e(3,4,2,j);e(3,2,6,j);e(3,6,8,j);e(3,8,9,j);e(4,9,5,j);e(2,4,11,j);e(6,2,10,j);e(8,6,7,j);e(9,8,1,j);for(var h=0;h<this.subdivisions;h++){var b=new THREE.Geometry,k;for(k in j.faces){var o=f(j.faces[k].a,j.faces[k].b),m=f(j.faces[k].b,j.faces[k].c),p=f(j.faces[k].c,j.faces[k].a);e(j.faces[k].a,o,p,b);e(j.faces[k].b,m,
|
|
|
-o,b);e(j.faces[k].c,p,m,b);e(o,m,p,b)}j.faces=b.faces}g.faces=j.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
-THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],j=[],h=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++)this.vertices.push(new THREE.Vertex(b[k])),e[k]=b[k].clone(),f[k]=this.vertices.length-1;for(var o=0;o<=this.angle+0.0010;o+=c){for(k=0;k<e.length;k++)o<this.angle?(e[k]=h.multiplyVector3(e[k].clone()),this.vertices.push(new THREE.Vertex(e[k])),g[k]=this.vertices.length-1):g=j;o==0&&(j=f);
|
|
|
-for(k=0;k<f.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k])),this.faceVertexUvs[0].push([new THREE.UV(1-o/this.angle,k/b.length),new THREE.UV(1-o/this.angle,(k+1)/b.length),new THREE.UV(1-(o-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(o-c)/this.angle,k/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
-THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,j=b/2,h=c/2,e=e||1,f=f||1,k=e+1,o=f+1;b/=e;var m=c/f;for(g=0;g<o;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-j,-(g*m-h),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
+-b);c(0,1,-b);c(b,0,-1);c(b,0,1);c(-b,0,-1);c(-b,0,1);e(0,11,5,j);e(0,5,1,j);e(0,1,7,j);e(0,7,10,j);e(0,10,11,j);e(1,5,9,j);e(5,11,4,j);e(11,10,2,j);e(10,7,6,j);e(7,1,8,j);e(3,9,4,j);e(3,4,2,j);e(3,2,6,j);e(3,6,8,j);e(3,8,9,j);e(4,9,5,j);e(2,4,11,j);e(6,2,10,j);e(8,6,7,j);e(9,8,1,j);for(var h=0;h<this.subdivisions;h++){var b=new THREE.Geometry,k;for(k in j.faces){var p=f(j.faces[k].a,j.faces[k].b),t=f(j.faces[k].b,j.faces[k].c),o=f(j.faces[k].c,j.faces[k].a);e(j.faces[k].a,p,o,b);e(j.faces[k].b,t,
|
|
|
+p,b);e(j.faces[k].c,o,t,b);e(p,t,o,b)}j.faces=b.faces}g.faces=j.faces;this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.IcosahedronGeometry.prototype=new THREE.Geometry;THREE.IcosahedronGeometry.prototype.constructor=THREE.IcosahedronGeometry;
|
|
|
+THREE.LatheGeometry=function(b,c,e){THREE.Geometry.call(this);this.steps=c||12;this.angle=e||2*Math.PI;for(var c=this.angle/this.steps,e=[],f=[],g=[],j=[],h=(new THREE.Matrix4).setRotationZ(c),k=0;k<b.length;k++)this.vertices.push(new THREE.Vertex(b[k])),e[k]=b[k].clone(),f[k]=this.vertices.length-1;for(var p=0;p<=this.angle+0.0010;p+=c){for(k=0;k<e.length;k++)p<this.angle?(e[k]=h.multiplyVector3(e[k].clone()),this.vertices.push(new THREE.Vertex(e[k])),g[k]=this.vertices.length-1):g=j;p==0&&(j=f);
|
|
|
+for(k=0;k<f.length-1;k++)this.faces.push(new THREE.Face4(g[k],g[k+1],f[k+1],f[k])),this.faceVertexUvs[0].push([new THREE.UV(1-p/this.angle,k/b.length),new THREE.UV(1-p/this.angle,(k+1)/b.length),new THREE.UV(1-(p-c)/this.angle,(k+1)/b.length),new THREE.UV(1-(p-c)/this.angle,k/b.length)]);f=g;g=[]}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.LatheGeometry.prototype=new THREE.Geometry;THREE.LatheGeometry.prototype.constructor=THREE.LatheGeometry;
|
|
|
+THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var g,j=b/2,h=c/2,e=e||1,f=f||1,k=e+1,p=f+1;b/=e;var t=c/f;for(g=0;g<p;g++)for(c=0;c<k;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-j,-(g*t-h),0)));for(g=0;g<f;g++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+k*g,c+k*(g+1),c+1+k*(g+1),c+1+k*g)),this.faceVertexUvs[0].push([new THREE.UV(c/e,g/f),new THREE.UV(c/e,(g+1)/f),new THREE.UV((c+1)/e,(g+1)/f),new THREE.UV((c+1)/e,g/f)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
-THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,j=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e<h+1;e++){f=e/h;var k=b*Math.cos(f*g),o=b*Math.sin(f*g),m=[],p=0;for(f=0;f<j;f++){var u=2*f/j,v=o*Math.sin(u*g),u=o*Math.cos(u*g);(e==0||e==h)&&f>0||(p=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,k,v)))-1);m.push(p)}c.push(m)}for(var t,w,x,g=c.length,e=0;e<g;e++)if(j=c[e].length,e>0)for(f=0;f<j;f++){m=f==j-1;h=c[e][m?0:f+1];k=c[e][m?j-1:f];o=c[e-1][m?
|
|
|
-j-1:f];m=c[e-1][m?0:f+1];v=e/(g-1);t=(e-1)/(g-1);w=(f+1)/j;var u=f/j,p=new THREE.UV(1-w,v),v=new THREE.UV(1-u,v),u=new THREE.UV(1-u,t),B=new THREE.UV(1-w,t);e<c.length-1&&(t=this.vertices[h].position.clone(),w=this.vertices[k].position.clone(),x=this.vertices[o].position.clone(),t.normalize(),w.normalize(),x.normalize(),this.faces.push(new THREE.Face3(h,k,o,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([p,v,u]));e>1&&(t=
|
|
|
-this.vertices[h].position.clone(),w=this.vertices[o].position.clone(),x=this.vertices[m].position.clone(),t.normalize(),w.normalize(),x.normalize(),this.faces.push(new THREE.Face3(h,o,m,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([p,u,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,g=Math.PI,j=Math.max(3,c||8),h=Math.max(2,e||6),c=[],e=0;e<h+1;e++){f=e/h;var k=b*Math.cos(f*g),p=b*Math.sin(f*g),t=[],o=0;for(f=0;f<j;f++){var u=2*f/j,v=p*Math.sin(u*g),u=p*Math.cos(u*g);(e==0||e==h)&&f>0||(o=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,k,v)))-1);t.push(o)}c.push(t)}for(var n,w,x,g=c.length,e=0;e<g;e++)if(j=c[e].length,e>0)for(f=0;f<j;f++){t=f==j-1;h=c[e][t?0:f+1];k=c[e][t?j-1:f];p=c[e-1][t?
|
|
|
+j-1:f];t=c[e-1][t?0:f+1];v=e/(g-1);n=(e-1)/(g-1);w=(f+1)/j;var u=f/j,o=new THREE.UV(1-w,v),v=new THREE.UV(1-u,v),u=new THREE.UV(1-u,n),B=new THREE.UV(1-w,n);e<c.length-1&&(n=this.vertices[h].position.clone(),w=this.vertices[k].position.clone(),x=this.vertices[p].position.clone(),n.normalize(),w.normalize(),x.normalize(),this.faces.push(new THREE.Face3(h,k,p,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([o,v,u]));e>1&&(n=
|
|
|
+this.vertices[h].position.clone(),w=this.vertices[p].position.clone(),x=this.vertices[t].position.clone(),n.normalize(),w.normalize(),x.normalize(),this.faces.push(new THREE.Face3(h,p,t,[new THREE.Vector3(n.x,n.y,n.z),new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(x.x,x.y,x.z)])),this.faceVertexUvs[0].push([o,u,B]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
|
THREE.TextGeometry=function(b,c){var e=(new THREE.TextPath(b,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 f=e[e.length-1].getBoundingBox().maxX;c.bendPath=new THREE.QuadraticBezierCurve(new THREE.Vector2(0,0),new THREE.Vector2(f/2,120),new THREE.Vector2(f,0))}THREE.ExtrudeGeometry.call(this,e,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]},getTextShapes:function(b,c){return(new TextPath(b,c)).toShapes()},loadFace:function(b){var c=b.familyName.toLowerCase();this.faces[c]=this.faces[c]||{};this.faces[c][b.cssFontWeight]=this.faces[c][b.cssFontWeight]||{};this.faces[c][b.cssFontWeight][b.cssFontStyle]=b;return this.faces[c][b.cssFontWeight][b.cssFontStyle]=b},drawText:function(b){for(var c=
|
|
|
-this.getFace(),e=this.size/c.resolution,f=0,g=String(b).split(""),j=g.length,h=[],b=0;b<j;b++){var k=new THREE.Path,k=this.extractGlyphPoints(g[b],c,e,f,k);f+=k.offset;h.push(k.path)}return{paths:h,offset:f/2}},extractGlyphPoints:function(b,c,e,f,g){var j=[],h,k,o,m,p,u,v,t,w,x,B=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));o=c.length;for(b=0;b<o;)switch(k=c[b++],k){case "m":k=c[b++]*e+f;m=c[b++]*e;j.push(new THREE.Vector2(k,
|
|
|
-m));g.moveTo(k,m);break;case "l":k=c[b++]*e+f;m=c[b++]*e;j.push(new THREE.Vector2(k,m));g.lineTo(k,m);break;case "q":k=c[b++]*e+f;m=c[b++]*e;v=c[b++]*e+f;t=c[b++]*e;g.quadraticCurveTo(v,t,k,m);if(h=j[j.length-1]){p=h.x;u=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var A=h/divisions,I=THREE.Shape.Utils.b2(A,p,v,k),A=THREE.Shape.Utils.b2(A,u,t,m);j.push(new THREE.Vector2(I,A))}}break;case "b":if(k=c[b++]*e+f,m=c[b++]*e,v=c[b++]*e+f,t=c[b++]*-e,w=c[b++]*e+f,x=c[b++]*-e,g.bezierCurveTo(k,m,
|
|
|
-v,t,w,x),h=j[j.length-1]){p=h.x;u=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)A=h/divisions,I=THREE.Shape.Utils.b3(A,p,v,w,k),A=THREE.Shape.Utils.b3(A,u,t,x,m),j.push(new THREE.Vector2(I,A))}}}return{offset:B.ha*e,points:j,path:g}}}};
|
|
|
-(function(b){var c=function(b){for(var c=b.length,g=0,j=c-1,h=0;h<c;j=h++)g+=b[j].x*b[h].y-b[h].x*b[j].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var j=[],h=[],k=[],o,m,p;if(c(b)>0)for(m=0;m<g;m++)h[m]=m;else for(m=0;m<g;m++)h[m]=g-1-m;var u=2*g;for(m=g-1;g>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return k;return j}o=m;g<=o&&(o=0);m=o+1;g<=m&&(m=0);p=m+1;g<=p&&(p=0);var v;a:{v=b;var t=o,w=m,x=p,B=g,A=h,I=void 0,z=void 0,H=void 0,
|
|
|
-G=void 0,C=void 0,O=void 0,N=void 0,D=void 0,E=void 0,z=v[A[t]].x,H=v[A[t]].y,G=v[A[w]].x,C=v[A[w]].y,O=v[A[x]].x,N=v[A[x]].y;if(1.0E-10>(G-z)*(N-H)-(C-H)*(O-z))v=!1;else{for(I=0;I<B;I++)if(!(I==t||I==w||I==x)){var D=v[A[I]].x,E=v[A[I]].y,U=void 0,M=void 0,L=void 0,n=void 0,S=void 0,V=void 0,X=void 0,Q=void 0,fa=void 0,W=void 0,ca=void 0,Y=void 0,U=L=S=void 0,U=O-G,M=N-C,L=z-O,n=H-N,S=G-z,V=C-H,X=D-z,Q=E-H,fa=D-G,W=E-C,ca=D-O,Y=E-N,U=U*W-M*fa,S=S*Q-V*X,L=L*Y-n*ca;if(U>=0&&L>=0&&S>=0){v=!1;break a}}v=
|
|
|
-!0}}if(v){j.push([b[h[o]],b[h[m]],b[h[p]]]);k.push([h[o],h[m],h[p]]);o=m;for(p=m+1;p<g;o++,p++)h[o]=h[p];g--;u=2*g}}if(f)return k;return j};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
+this.getFace(),e=this.size/c.resolution,f=0,g=String(b).split(""),j=g.length,h=[],b=0;b<j;b++){var k=new THREE.Path,k=this.extractGlyphPoints(g[b],c,e,f,k);f+=k.offset;h.push(k.path)}return{paths:h,offset:f/2}},extractGlyphPoints:function(b,c,e,f,g){var j=[],h,k,p,t,o,u,v,n,w,x,B=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(B){if(B.o){c=B._cachedOutline||(B._cachedOutline=B.o.split(" "));p=c.length;for(b=0;b<p;)switch(k=c[b++],k){case "m":k=c[b++]*e+f;t=c[b++]*e;j.push(new THREE.Vector2(k,
|
|
|
+t));g.moveTo(k,t);break;case "l":k=c[b++]*e+f;t=c[b++]*e;j.push(new THREE.Vector2(k,t));g.lineTo(k,t);break;case "q":k=c[b++]*e+f;t=c[b++]*e;v=c[b++]*e+f;n=c[b++]*e;g.quadraticCurveTo(v,n,k,t);if(h=j[j.length-1]){o=h.x;u=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++){var A=h/divisions,F=THREE.Shape.Utils.b2(A,o,v,k),A=THREE.Shape.Utils.b2(A,u,n,t);j.push(new THREE.Vector2(F,A))}}break;case "b":if(k=c[b++]*e+f,t=c[b++]*e,v=c[b++]*e+f,n=c[b++]*-e,w=c[b++]*e+f,x=c[b++]*-e,g.bezierCurveTo(k,t,
|
|
|
+v,n,w,x),h=j[j.length-1]){o=h.x;u=h.y;h=1;for(divisions=this.divisions;h<=divisions;h++)A=h/divisions,F=THREE.Shape.Utils.b3(A,o,v,w,k),A=THREE.Shape.Utils.b3(A,u,n,x,t),j.push(new THREE.Vector2(F,A))}}}return{offset:B.ha*e,points:j,path:g}}}};
|
|
|
+(function(b){var c=function(b){for(var c=b.length,g=0,j=c-1,h=0;h<c;j=h++)g+=b[j].x*b[h].y-b[h].x*b[j].y;return g*0.5};b.Triangulate=function(b,f){var g=b.length;if(g<3)return null;var j=[],h=[],k=[],p,t,o;if(c(b)>0)for(t=0;t<g;t++)h[t]=t;else for(t=0;t<g;t++)h[t]=g-1-t;var u=2*g;for(t=g-1;g>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return k;return j}p=t;g<=p&&(p=0);t=p+1;g<=t&&(t=0);o=t+1;g<=o&&(o=0);var v;a:{v=b;var n=p,w=t,x=o,B=g,A=h,F=void 0,z=void 0,G=void 0,
|
|
|
+I=void 0,C=void 0,L=void 0,D=void 0,H=void 0,T=void 0,z=v[A[n]].x,G=v[A[n]].y,I=v[A[w]].x,C=v[A[w]].y,L=v[A[x]].x,D=v[A[x]].y;if(1.0E-10>(I-z)*(D-G)-(C-G)*(L-z))v=!1;else{for(F=0;F<B;F++)if(!(F==n||F==w||F==x)){var H=v[A[F]].x,T=v[A[F]].y,J=void 0,K=void 0,N=void 0,m=void 0,U=void 0,V=void 0,W=void 0,R=void 0,Y=void 0,ha=void 0,da=void 0,aa=void 0,J=N=U=void 0,J=L-I,K=D-C,N=z-L,m=G-D,U=I-z,V=C-G,W=H-z,R=T-G,Y=H-I,ha=T-C,da=H-L,aa=T-D,J=J*ha-K*Y,U=U*R-V*W,N=N*aa-m*da;if(J>=0&&N>=0&&U>=0){v=!1;break a}}v=
|
|
|
+!0}}if(v){j.push([b[h[p]],b[h[t]],b[h[o]]]);k.push([h[p],h[t],h[o]]);p=t;for(o=t+1;o<g;p++,o++)h[p]=h[o];g--;u=2*g}}if(f)return k;return j};b.Triangulate.area=c;return b})(THREE.FontUtils);window._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(b,c,e,f){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;b=[];for(c=0;c<=this.segmentsR;++c)for(e=0;e<=this.segmentsT;++e){var f=e/this.segmentsT*2*Math.PI,g=c/this.segmentsR*2*Math.PI;this.vertices.push(new THREE.Vertex(new THREE.Vector3((this.radius+this.tube*Math.cos(g))*Math.cos(f),(this.radius+this.tube*Math.cos(g))*Math.sin(f),this.tube*Math.sin(g))));b.push([e/this.segmentsT,1-c/this.segmentsR])}for(c=1;c<=this.segmentsR;++c)for(e=
|
|
|
1;e<=this.segmentsT;++e){var f=(this.segmentsT+1)*c+e,g=(this.segmentsT+1)*c+e-1,j=(this.segmentsT+1)*(c-1)+e-1,h=(this.segmentsT+1)*(c-1)+e;this.faces.push(new THREE.Face4(f,g,j,h));this.faceVertexUvs[0].push([new THREE.UV(b[f][0],b[f][1]),new THREE.UV(b[g][0],b[g][1]),new THREE.UV(b[j][0],b[j][1]),new THREE.UV(b[h][0],b[h][1])])}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
THREE.TorusKnotGeometry=function(b,c,e,f,g,j,h){function k(b,c,e,f,g,h){c=e/f*b;e=Math.cos(c);return new THREE.Vector3(g*(2+e)*0.5*Math.cos(b),g*(2+e)*Math.sin(b)*0.5,h*g*Math.sin(c)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=g||2;this.q=j||3;this.heightScale=h||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;j=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
|
|
|
-this.segmentsT;++c){var o=b/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,g=k(o,h,this.q,this.p,this.radius,this.heightScale),o=k(o+0.01,h,this.q,this.p,this.radius,this.heightScale);e.x=o.x-g.x;e.y=o.y-g.y;e.z=o.z-g.z;f.x=o.x+g.x;f.y=o.y+g.y;f.z=o.z+g.z;j.cross(e,f);f.cross(j,e);j.normalize();f.normalize();o=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);g.x+=o*f.x+h*j.x;g.y+=o*f.y+h*j.y;g.z+=o*f.z+h*j.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
|
-g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,j=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][j],j=this.grid[b][j],h=new THREE.UV(b/this.segmentsR,c/this.segmentsT),o=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),m=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),p=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,j));this.faceVertexUvs[0].push([h,o,m,p])}this.computeCentroids();
|
|
|
+this.segmentsT;++c){var p=b/this.segmentsR*2*this.p*Math.PI,h=c/this.segmentsT*2*Math.PI,g=k(p,h,this.q,this.p,this.radius,this.heightScale),p=k(p+0.01,h,this.q,this.p,this.radius,this.heightScale);e.x=p.x-g.x;e.y=p.y-g.y;e.z=p.z-g.z;f.x=p.x+g.x;f.y=p.y+g.y;f.z=p.z+g.z;j.cross(e,f);f.cross(j,e);j.normalize();f.normalize();p=-this.tube*Math.cos(h);h=this.tube*Math.sin(h);g.x+=p*f.x+h*j.x;g.y+=p*f.y+h*j.y;g.z+=p*f.z+h*j.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
|
+g.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,j=(c+1)%this.segmentsT,g=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][j],j=this.grid[b][j],h=new THREE.UV(b/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),t=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),o=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,e,f,j));this.faceVertexUvs[0].push([h,p,t,o])}this.computeCentroids();
|
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={addStatusElement:function(){var b=document.createElement("div");b.style.position="absolute";b.style.right="0px";b.style.top="0px";b.style.fontSize="0.8em";b.style.textAlign="left";b.style.background="rgba(0,0,0,0.25)";b.style.color="#fff";b.style.width="120px";b.style.padding="0.5em 0.5em 0.5em 0.5em";b.style.zIndex=1E3;b.innerHTML="Loading ...";return b},updateProgress:function(b){var c="Loaded ";c+=b.total?(100*b.loaded/b.total).toFixed(0)+"%":(b.loaded/1E3).toFixed(2)+" KB";
|
|
|
this.statusDomElement.innerHTML=c},extractUrlbase:function(b){b=b.split("/");b.pop();return b.join("/")},init_materials:function(b,c,e){b.materials=[];for(var f=0;f<c.length;++f)b.materials[f]=[THREE.Loader.prototype.createMaterial(c[f],e)]},hasNormals:function(b){var c,e,f=b.materials.length;for(e=0;e<f;e++)if(c=b.materials[e][0],c instanceof THREE.MeshShaderMaterial)return!0;return!1},createMaterial:function(b,c){function e(b){b=Math.log(b)/Math.LN2;return Math.floor(b)==b}function f(b,c){var f=
|
|
|
-new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,g,h,j,k){var m=document.createElement("canvas");b[e]=new THREE.Texture(m);b[e].sourceFile=g;if(h){b[e].repeat.set(h[0],h[1]);if(h[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(h[1]!=
|
|
|
-1)b[e].wrapT=THREE.RepeatWrapping}j&&b[e].offset.set(j[0],j[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)b[e].wrapS=h[k[0]];if(h[k[1]]!==void 0)b[e].wrapT=h[k[1]]}f(b[e],c+"/"+g)}function j(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,k,o;k="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?k="MeshPhongMaterial":b.shading=="Basic"&&(k="MeshBasicMaterial"));
|
|
|
+new Image;f.onload=function(){if(!e(this.width)||!e(this.height)){var c=Math.pow(2,Math.round(Math.log(this.width)/Math.LN2)),f=Math.pow(2,Math.round(Math.log(this.height)/Math.LN2));b.image.width=c;b.image.height=f;b.image.getContext("2d").drawImage(this,0,0,c,f)}else b.image=this;b.needsUpdate=!0};f.src=c}function g(b,e,g,h,j,k){var p=document.createElement("canvas");b[e]=new THREE.Texture(p);b[e].sourceFile=g;if(h){b[e].repeat.set(h[0],h[1]);if(h[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(h[1]!=
|
|
|
+1)b[e].wrapT=THREE.RepeatWrapping}j&&b[e].offset.set(j[0],j[1]);if(k){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[k[0]]!==void 0)b[e].wrapS=h[k[0]];if(h[k[1]]!==void 0)b[e].wrapT=h[k[1]]}f(b[e],c+"/"+g)}function j(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var h,k,p;k="MeshLambertMaterial";h={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?k="MeshPhongMaterial":b.shading=="Basic"&&(k="MeshBasicMaterial"));
|
|
|
if(b.blending)if(b.blending=="Additive")h.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")h.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")h.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)h.transparent=b.transparent;if(b.depthTest!==void 0)h.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")h.vertexColors=THREE.FaceColors;else if(b.vertexColors)h.vertexColors=THREE.VertexColors;if(b.colorDiffuse)h.color=j(b.colorDiffuse);
|
|
|
else if(b.DbgColor)h.color=b.DbgColor;if(b.colorSpecular)h.specular=j(b.colorSpecular);if(b.colorAmbient)h.ambient=j(b.colorAmbient);if(b.transparency)h.opacity=b.transparency;if(b.specularCoef)h.shininess=b.specularCoef;b.mapDiffuse&&c&&g(h,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&g(h,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&g(h,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
|
|
|
-b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var m=THREE.ShaderUtils.lib.normal,p=THREE.UniformsUtils.clone(m.uniforms),u=h.color;k=h.specular;o=h.ambient;var v=h.shininess;p.tNormal.texture=h.normalMap;if(b.mapNormalFactor)p.uNormalScale.value=b.mapNormalFactor;if(h.map)p.tDiffuse.texture=h.map,p.enableDiffuse.value=!0;if(h.specularMap)p.tSpecular.texture=h.specularMap,p.enableSpecular.value=!0;if(h.lightMap)p.tAO.texture=
|
|
|
-h.lightMap,p.enableAO.value=!0;p.uDiffuseColor.value.setHex(u);p.uSpecularColor.value.setHex(k);p.uAmbientColor.value.setHex(o);p.uShininess.value=v;if(h.opacity)p.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:m.fragmentShader,vertexShader:m.vertexShader,uniforms:p,lights:!0,fog:!0})}else h=new THREE[k](h);return h},constructor:THREE.Loader};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
|
|
|
+b.mapSpecular&&c&&g(h,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var t=THREE.ShaderUtils.lib.normal,o=THREE.UniformsUtils.clone(t.uniforms),u=h.color;k=h.specular;p=h.ambient;var v=h.shininess;o.tNormal.texture=h.normalMap;if(b.mapNormalFactor)o.uNormalScale.value=b.mapNormalFactor;if(h.map)o.tDiffuse.texture=h.map,o.enableDiffuse.value=!0;if(h.specularMap)o.tSpecular.texture=h.specularMap,o.enableSpecular.value=!0;if(h.lightMap)o.tAO.texture=
|
|
|
+h.lightMap,o.enableAO.value=!0;o.uDiffuseColor.value.setHex(u);o.uSpecularColor.value.setHex(k);o.uAmbientColor.value.setHex(p);o.uShininess.value=v;if(h.opacity)o.uOpacity.value=h.opacity;h=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:o,lights:!0,fog:!0})}else h=new THREE[k](h);return h},constructor:THREE.Loader};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
|
|
|
THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(b){var c=this,e=b.model,f=b.callback,g=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,g);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,o,m,p,u,v,t,w,x,B,A,I,z,H=b.faces;u=b.vertices;var G=b.normals,C=b.colors,O=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&O++;for(e=0;e<O;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];m=0;for(p=u.length;m<p;)v=new THREE.Vertex,v.position.x=u[m++]*c,v.position.y=
|
|
|
-u[m++]*c,v.position.z=u[m++]*c,f.vertices.push(v);m=0;for(p=H.length;m<p;){c=H[m++];u=c&1;o=c&2;e=c&4;g=c&8;t=c&16;v=c&32;x=c&64;c&=128;u?(B=new THREE.Face4,B.a=H[m++],B.b=H[m++],B.c=H[m++],B.d=H[m++],u=4):(B=new THREE.Face3,B.a=H[m++],B.b=H[m++],B.c=H[m++],u=3);if(o)o=H[m++],B.materials=f.materials[o];o=f.faces.length;if(e)for(e=0;e<O;e++)A=b.uvs[e],w=H[m++],z=A[w*2],w=A[w*2+1],f.faceUvs[e][o]=new THREE.UV(z,w);if(g)for(e=0;e<O;e++){A=b.uvs[e];I=[];for(g=0;g<u;g++)w=H[m++],z=A[w*2],w=A[w*2+1],I[g]=
|
|
|
-new THREE.UV(z,w);f.faceVertexUvs[e][o]=I}if(t)t=H[m++]*3,g=new THREE.Vector3,g.x=G[t++],g.y=G[t++],g.z=G[t],B.normal=g;if(v)for(e=0;e<u;e++)t=H[m++]*3,g=new THREE.Vector3,g.x=G[t++],g.y=G[t++],g.z=G[t],B.vertexNormals.push(g);if(x)v=H[m++],v=new THREE.Color(C[v]),B.color=v;if(c)for(e=0;e<u;e++)v=H[m++],v=new THREE.Color(C[v]),B.vertexColors.push(v);f.faces.push(B)}}})(g);(function(){var c,e,g,o;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],o=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
|
-o,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],o=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,o,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,o,m,p,u,v,t,w;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];t=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;o=0;for(m=w.length;o<m;o+=3)p=w[o]*c,u=w[o+1]*
|
|
|
-c,v=w[o+2]*c,t.push(new THREE.Vertex(new THREE.Vector3(p,u,v)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];m=f.morphColors[e].colors;p=b.morphColors[e].colors;c=0;for(o=p.length;c<o;c+=3)u=new THREE.Color(16755200),u.setRGB(p[c],p[c+1],p[c+2]),m.push(u)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
|
|
|
+THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,g=b.scale!==void 0?1/b.scale:1;this.init_materials(f,b.materials,e);(function(c){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var e,g,p,t,o,u,v,n,w,x,B,A,F,z,G=b.faces;u=b.vertices;var I=b.normals,C=b.colors,L=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&L++;for(e=0;e<L;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];t=0;for(o=u.length;t<o;)v=new THREE.Vertex,v.position.x=u[t++]*c,v.position.y=
|
|
|
+u[t++]*c,v.position.z=u[t++]*c,f.vertices.push(v);t=0;for(o=G.length;t<o;){c=G[t++];u=c&1;p=c&2;e=c&4;g=c&8;n=c&16;v=c&32;x=c&64;c&=128;u?(B=new THREE.Face4,B.a=G[t++],B.b=G[t++],B.c=G[t++],B.d=G[t++],u=4):(B=new THREE.Face3,B.a=G[t++],B.b=G[t++],B.c=G[t++],u=3);if(p)p=G[t++],B.materials=f.materials[p];p=f.faces.length;if(e)for(e=0;e<L;e++)A=b.uvs[e],w=G[t++],z=A[w*2],w=A[w*2+1],f.faceUvs[e][p]=new THREE.UV(z,w);if(g)for(e=0;e<L;e++){A=b.uvs[e];F=[];for(g=0;g<u;g++)w=G[t++],z=A[w*2],w=A[w*2+1],F[g]=
|
|
|
+new THREE.UV(z,w);f.faceVertexUvs[e][p]=F}if(n)n=G[t++]*3,g=new THREE.Vector3,g.x=I[n++],g.y=I[n++],g.z=I[n],B.normal=g;if(v)for(e=0;e<u;e++)n=G[t++]*3,g=new THREE.Vector3,g.x=I[n++],g.y=I[n++],g.z=I[n],B.vertexNormals.push(g);if(x)v=G[t++],v=new THREE.Color(C[v]),B.color=v;if(c)for(e=0;e<u;e++)v=G[t++],v=new THREE.Color(C[v]),B.vertexColors.push(v);f.faces.push(B)}}})(g);(function(){var c,e,g,p;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)g=b.skinWeights[c],p=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(g,
|
|
|
+p,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)g=b.skinIndices[c],p=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(g,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,g,p,t,o,u,v,n,w;e=0;for(g=b.morphTargets.length;e<g;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];n=f.morphTargets[e].vertices;w=b.morphTargets[e].vertices;p=0;for(t=w.length;p<t;p+=3)o=w[p]*c,u=w[p+1]*
|
|
|
+c,v=w[p+2]*c,n.push(new THREE.Vertex(new THREE.Vector3(o,u,v)))}}if(b.morphColors!==void 0){e=0;for(g=b.morphColors.length;e<g;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];t=f.morphColors[e].colors;o=b.morphColors[e].colors;c=0;for(p=o.length;c<p;c+=3)u=new THREE.Color(16755200),u.setRGB(o[c],o[c+1],o[c+2]),t.push(u)}}})(g);(function(){if(b.edges!==void 0){var c,e,g;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],g=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
|
|
|
f.vertices[g],e,g))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;THREE.BinaryLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
THREE.BinaryLoader.prototype={load:function(b){var c=b.model,e=b.callback,f=b.texture_path?b.texture_path:THREE.Loader.prototype.extractUrlbase(c),g=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),j=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,g,f,j)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
|
|
|
-c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,j){var h=new XMLHttpRequest,k=f+"/"+b,o=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,e,g,c):alert("Couldn't load ["+k+"] ["+h.status+"]"):h.readyState==3?j&&(o==0&&(o=h.getResponseHeader("Content-Length")),j({total:o,loaded:h.responseText.length})):h.readyState==2&&(o=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
-h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=p(b,c),g=p(b,c+1),h=p(b,c+2),j=p(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=p(b,c),f=p(b,c+1),h=p(b,c+2);return(p(b,c+3)<<24)+(h<<16)+(f<<8)+e}function o(b,c){var e=p(b,c);return(p(b,c+1)<<8)+e}function m(b,c){var e=p(b,c);return e>127?e-256:e}function p(b,
|
|
|
-c){return b.charCodeAt(c)&255}function u(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+O);c=o(b,c+N);THREE.BinaryLoader.prototype.f3(A,e,f,h,c)}function v(c){var e,f,h,j,m,n;e=g(b,c);f=g(b,c+C);h=g(b,c+O);j=o(b,c+N);m=g(b,c+D);n=g(b,c+E);c=g(b,c+U);THREE.BinaryLoader.prototype.f3n(A,H,e,f,h,j,m,n,c)}function t(c){var e,f,h,j;e=g(b,c);f=g(b,c+M);h=g(b,c+L);j=g(b,c+n);c=o(b,c+S);THREE.BinaryLoader.prototype.f4(A,e,f,h,j,c)}function w(c){var e,f,h,j,m,p,t,u;e=g(b,c);f=g(b,c+M);h=g(b,c+L);j=g(b,c+n);m=o(b,
|
|
|
-c+S);p=g(b,c+V);t=g(b,c+X);u=g(b,c+Q);c=g(b,c+fa);THREE.BinaryLoader.prototype.f4n(A,H,e,f,h,j,m,p,t,u,c)}function x(c){var e,f;e=g(b,c);f=g(b,c+W);c=g(b,c+ca);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[c*2],G[c*2+1])}function B(c){var e,f,h;e=g(b,c);f=g(b,c+Y);h=g(b,c+ea);c=g(b,c+$);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],G[e*2],G[e*2+1],G[f*2],G[f*2+1],G[h*2],G[h*2+1],G[c*2],G[c*2+1])}var A=this,I=0,z,H=[],G=[],C,O,N,D,E,U,M,L,n,S,V,X,Q,fa,
|
|
|
-W,ca,Y,ea,$,ga,K,da,Z,ka,ia;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,f,c);z={signature:b.substr(I,8),header_bytes:p(b,I+8),vertex_coordinate_bytes:p(b,I+9),normal_coordinate_bytes:p(b,I+10),uv_coordinate_bytes:p(b,I+11),vertex_index_bytes:p(b,I+12),normal_index_bytes:p(b,I+13),uv_index_bytes:p(b,I+14),material_index_bytes:p(b,I+15),nvertices:g(b,I+16),nnormals:g(b,I+16+4),nuvs:g(b,I+16+8),ntri_flat:g(b,I+16+12),ntri_smooth:g(b,I+16+16),ntri_flat_uv:g(b,I+16+20),ntri_smooth_uv:g(b,
|
|
|
-I+16+24),nquad_flat:g(b,I+16+28),nquad_smooth:g(b,I+16+32),nquad_flat_uv:g(b,I+16+36),nquad_smooth_uv:g(b,I+16+40)};I+=z.header_bytes;C=z.vertex_index_bytes;O=z.vertex_index_bytes*2;N=z.vertex_index_bytes*3;D=z.vertex_index_bytes*3+z.material_index_bytes;E=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;U=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;M=z.vertex_index_bytes;L=z.vertex_index_bytes*2;n=z.vertex_index_bytes*3;S=z.vertex_index_bytes*4;V=z.vertex_index_bytes*
|
|
|
-4+z.material_index_bytes;X=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;Q=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;fa=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;W=z.uv_index_bytes;ca=z.uv_index_bytes*2;Y=z.uv_index_bytes;ea=z.uv_index_bytes*2;$=z.uv_index_bytes*3;c=z.vertex_index_bytes*3+z.material_index_bytes;ia=z.vertex_index_bytes*4+z.material_index_bytes;ga=z.ntri_flat*c;K=z.ntri_smooth*(c+z.normal_index_bytes*3);da=z.ntri_flat_uv*
|
|
|
-(c+z.uv_index_bytes*3);Z=z.ntri_smooth_uv*(c+z.normal_index_bytes*3+z.uv_index_bytes*3);ka=z.nquad_flat*ia;c=z.nquad_smooth*(ia+z.normal_index_bytes*4);ia=z.nquad_flat_uv*(ia+z.uv_index_bytes*4);I+=function(c){for(var f,g,j,k=z.vertex_coordinate_bytes*3,m=c+z.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+z.vertex_coordinate_bytes),j=e(b,c+z.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(A,f,g,j);return z.nvertices*k}(I);I+=function(c){for(var e,f,g,h=z.normal_coordinate_bytes*3,j=c+z.nnormals*
|
|
|
-h;c<j;c+=h)e=m(b,c),f=m(b,c+z.normal_coordinate_bytes),g=m(b,c+z.normal_coordinate_bytes*2),H.push(e/127,f/127,g/127);return z.nnormals*h}(I);I+=function(c){for(var f,g,j=z.uv_coordinate_bytes*2,k=c+z.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+z.uv_coordinate_bytes),G.push(f,g);return z.nuvs*j}(I);ga=I+ga;K=ga+K;da=K+da;Z=da+Z;ka=Z+ka;c=ka+c;ia=c+ia;(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes,f=e+z.uv_index_bytes*3,g=b+z.ntri_flat_uv*f;for(c=b;c<g;c+=f)u(c),x(c+e);return g-b})(K);(function(b){var c,
|
|
|
-e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,f=e+z.uv_index_bytes*3,g=b+z.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),x(c+e);return g-b})(da);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes,f=e+z.uv_index_bytes*4,g=b+z.nquad_flat_uv*f;for(c=b;c<g;c+=f)t(c),B(c+e);return g-b})(c);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,f=e+z.uv_index_bytes*4,g=b+z.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),B(c+e);return g-b})(ia);
|
|
|
-(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes,f=b+z.ntri_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(I);(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,f=b+z.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(ga);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes,f=b+z.nquad_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(Z);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,f=b+z.nquad_smooth*
|
|
|
-e;for(c=b;c<f;c+=e)w(c);return f-b})(ka);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,j){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[j]))},f3n:function(b,c,e,
|
|
|
-f,g,j,h,k,o){var j=b.materials[j],m=c[k*3],p=c[k*3+1],k=c[k*3+2],u=c[o*3],v=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(m,p,k),new THREE.Vector3(u,v,o)],null,j))},f4n:function(b,c,e,f,g,j,h,k,o,m,p){var h=b.materials[h],u=c[o*3],v=c[o*3+1],o=c[o*3+2],t=c[m*3],w=c[m*3+1],m=c[m*3+2],x=c[p*3],B=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face4(e,f,g,j,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(u,v,o),new THREE.Vector3(t,
|
|
|
-w,m),new THREE.Vector3(x,B,p)],null,h))},uv3:function(b,c,e,f,g,j,h){var k=[];k.push(new THREE.UV(c,e));k.push(new THREE.UV(f,g));k.push(new THREE.UV(j,h));b.push(k)},uv4:function(b,c,e,f,g,j,h,k,o){var m=[];m.push(new THREE.UV(c,e));m.push(new THREE.UV(f,g));m.push(new THREE.UV(j,h));m.push(new THREE.UV(k,o));b.push(m)},constructor:THREE.BinaryLoader};
|
|
|
+c.postMessage(b)},loadAjaxBuffers:function(b,c,e,f,g,j){var h=new XMLHttpRequest,k=f+"/"+b,p=0;h.onreadystatechange=function(){h.readyState==4?h.status==200||h.status==0?THREE.BinaryLoader.prototype.createBinModel(h.responseText,e,g,c):alert("Couldn't load ["+k+"] ["+h.status+"]"):h.readyState==3?j&&(p==0&&(p=h.getResponseHeader("Content-Length")),j({total:p,loaded:h.responseText.length})):h.readyState==2&&(p=h.getResponseHeader("Content-Length"))};h.open("GET",k,!0);h.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
+h.setRequestHeader("Content-Type","text/plain");h.send(null)},createBinModel:function(b,c,e,f){var g=function(c){function e(b,c){var f=o(b,c),g=o(b,c+1),h=o(b,c+2),j=o(b,c+3),k=(j<<1&255|h>>7)-127;f|=(h&127)<<16|g<<8;if(f==0&&k==-127)return 0;return(1-2*(j>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,k)}function g(b,c){var e=o(b,c),f=o(b,c+1),h=o(b,c+2);return(o(b,c+3)<<24)+(h<<16)+(f<<8)+e}function p(b,c){var e=o(b,c);return(o(b,c+1)<<8)+e}function t(b,c){var e=o(b,c);return e>127?e-256:e}function o(b,
|
|
|
+c){return b.charCodeAt(c)&255}function u(c){var e,f,h;e=g(b,c);f=g(b,c+C);h=g(b,c+L);c=p(b,c+D);THREE.BinaryLoader.prototype.f3(A,e,f,h,c)}function v(c){var e,f,h,j,m,n;e=g(b,c);f=g(b,c+C);h=g(b,c+L);j=p(b,c+D);m=g(b,c+H);n=g(b,c+T);c=g(b,c+J);THREE.BinaryLoader.prototype.f3n(A,G,e,f,h,j,m,n,c)}function n(c){var e,f,h,j;e=g(b,c);f=g(b,c+K);h=g(b,c+N);j=g(b,c+m);c=p(b,c+U);THREE.BinaryLoader.prototype.f4(A,e,f,h,j,c)}function w(c){var e,f,h,j,n,o,t,u;e=g(b,c);f=g(b,c+K);h=g(b,c+N);j=g(b,c+m);n=p(b,
|
|
|
+c+U);o=g(b,c+V);t=g(b,c+W);u=g(b,c+R);c=g(b,c+Y);THREE.BinaryLoader.prototype.f4n(A,G,e,f,h,j,n,o,t,u,c)}function x(c){var e,f;e=g(b,c);f=g(b,c+ha);c=g(b,c+da);THREE.BinaryLoader.prototype.uv3(A.faceVertexUvs[0],I[e*2],I[e*2+1],I[f*2],I[f*2+1],I[c*2],I[c*2+1])}function B(c){var e,f,h;e=g(b,c);f=g(b,c+aa);h=g(b,c+ia);c=g(b,c+ca);THREE.BinaryLoader.prototype.uv4(A.faceVertexUvs[0],I[e*2],I[e*2+1],I[f*2],I[f*2+1],I[h*2],I[h*2+1],I[c*2],I[c*2+1])}var A=this,F=0,z,G=[],I=[],C,L,D,H,T,J,K,N,m,U,V,W,R,Y,
|
|
|
+ha,da,aa,ia,ca,Z,P,fa,$,ja,la;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(A,f,c);z={signature:b.substr(F,8),header_bytes:o(b,F+8),vertex_coordinate_bytes:o(b,F+9),normal_coordinate_bytes:o(b,F+10),uv_coordinate_bytes:o(b,F+11),vertex_index_bytes:o(b,F+12),normal_index_bytes:o(b,F+13),uv_index_bytes:o(b,F+14),material_index_bytes:o(b,F+15),nvertices:g(b,F+16),nnormals:g(b,F+16+4),nuvs:g(b,F+16+8),ntri_flat:g(b,F+16+12),ntri_smooth:g(b,F+16+16),ntri_flat_uv:g(b,F+16+20),ntri_smooth_uv:g(b,
|
|
|
+F+16+24),nquad_flat:g(b,F+16+28),nquad_smooth:g(b,F+16+32),nquad_flat_uv:g(b,F+16+36),nquad_smooth_uv:g(b,F+16+40)};F+=z.header_bytes;C=z.vertex_index_bytes;L=z.vertex_index_bytes*2;D=z.vertex_index_bytes*3;H=z.vertex_index_bytes*3+z.material_index_bytes;T=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes;J=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*2;K=z.vertex_index_bytes;N=z.vertex_index_bytes*2;m=z.vertex_index_bytes*3;U=z.vertex_index_bytes*4;V=z.vertex_index_bytes*
|
|
|
+4+z.material_index_bytes;W=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes;R=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*2;Y=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*3;ha=z.uv_index_bytes;da=z.uv_index_bytes*2;aa=z.uv_index_bytes;ia=z.uv_index_bytes*2;ca=z.uv_index_bytes*3;c=z.vertex_index_bytes*3+z.material_index_bytes;la=z.vertex_index_bytes*4+z.material_index_bytes;Z=z.ntri_flat*c;P=z.ntri_smooth*(c+z.normal_index_bytes*3);fa=
|
|
|
+z.ntri_flat_uv*(c+z.uv_index_bytes*3);$=z.ntri_smooth_uv*(c+z.normal_index_bytes*3+z.uv_index_bytes*3);ja=z.nquad_flat*la;c=z.nquad_smooth*(la+z.normal_index_bytes*4);la=z.nquad_flat_uv*(la+z.uv_index_bytes*4);F+=function(c){for(var f,g,j,k=z.vertex_coordinate_bytes*3,m=c+z.nvertices*k;c<m;c+=k)f=e(b,c),g=e(b,c+z.vertex_coordinate_bytes),j=e(b,c+z.vertex_coordinate_bytes*2),THREE.BinaryLoader.prototype.v(A,f,g,j);return z.nvertices*k}(F);F+=function(c){for(var e,f,g,h=z.normal_coordinate_bytes*3,
|
|
|
+j=c+z.nnormals*h;c<j;c+=h)e=t(b,c),f=t(b,c+z.normal_coordinate_bytes),g=t(b,c+z.normal_coordinate_bytes*2),G.push(e/127,f/127,g/127);return z.nnormals*h}(F);F+=function(c){for(var f,g,j=z.uv_coordinate_bytes*2,k=c+z.nuvs*j;c<k;c+=j)f=e(b,c),g=e(b,c+z.uv_coordinate_bytes),I.push(f,g);return z.nuvs*j}(F);Z=F+Z;P=Z+P;fa=P+fa;$=fa+$;ja=$+ja;c=ja+c;la=c+la;(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes,f=e+z.uv_index_bytes*3,g=b+z.ntri_flat_uv*f;for(c=b;c<g;c+=f)u(c),x(c+e);return g-
|
|
|
+b})(P);(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,f=e+z.uv_index_bytes*3,g=b+z.ntri_smooth_uv*f;for(c=b;c<g;c+=f)v(c),x(c+e);return g-b})(fa);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes,f=e+z.uv_index_bytes*4,g=b+z.nquad_flat_uv*f;for(c=b;c<g;c+=f)n(c),B(c+e);return g-b})(c);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*4,f=e+z.uv_index_bytes*4,g=b+z.nquad_smooth_uv*f;for(c=b;c<g;c+=f)w(c),
|
|
|
+B(c+e);return g-b})(la);(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes,f=b+z.ntri_flat*e;for(c=b;c<f;c+=e)u(c);return f-b})(F);(function(b){var c,e=z.vertex_index_bytes*3+z.material_index_bytes+z.normal_index_bytes*3,f=b+z.ntri_smooth*e;for(c=b;c<f;c+=e)v(c);return f-b})(Z);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes,f=b+z.nquad_flat*e;for(c=b;c<f;c+=e)n(c);return f-b})($);(function(b){var c,e=z.vertex_index_bytes*4+z.material_index_bytes+z.normal_index_bytes*
|
|
|
+4,f=b+z.nquad_smooth*e;for(c=b;c<f;c+=e)w(c);return f-b})(ja);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(e))},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3:function(b,c,e,f,g){b.faces.push(new THREE.Face3(c,e,f,null,null,b.materials[g]))},f4:function(b,c,e,f,g,j){b.faces.push(new THREE.Face4(c,e,f,g,null,null,b.materials[j]))},
|
|
|
+f3n:function(b,c,e,f,g,j,h,k,p){var j=b.materials[j],t=c[k*3],o=c[k*3+1],k=c[k*3+2],u=c[p*3],v=c[p*3+1],p=c[p*3+2];b.faces.push(new THREE.Face3(e,f,g,[new THREE.Vector3(c[h*3],c[h*3+1],c[h*3+2]),new THREE.Vector3(t,o,k),new THREE.Vector3(u,v,p)],null,j))},f4n:function(b,c,e,f,g,j,h,k,p,t,o){var h=b.materials[h],u=c[p*3],v=c[p*3+1],p=c[p*3+2],n=c[t*3],w=c[t*3+1],t=c[t*3+2],x=c[o*3],B=c[o*3+1],o=c[o*3+2];b.faces.push(new THREE.Face4(e,f,g,j,[new THREE.Vector3(c[k*3],c[k*3+1],c[k*3+2]),new THREE.Vector3(u,
|
|
|
+v,p),new THREE.Vector3(n,w,t),new THREE.Vector3(x,B,o)],null,h))},uv3:function(b,c,e,f,g,j,h){var k=[];k.push(new THREE.UV(c,e));k.push(new THREE.UV(f,g));k.push(new THREE.UV(j,h));b.push(k)},uv4:function(b,c,e,f,g,j,h,k,p){var t=[];t.push(new THREE.UV(c,e));t.push(new THREE.UV(f,g));t.push(new THREE.UV(j,h));t.push(new THREE.UV(k,p));b.push(t)},constructor:THREE.BinaryLoader};
|
|
|
THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};
|
|
|
-THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function k(){for(t in M.objects)if(!Q.objects[t])if(I=M.objects[t],I.geometry!==void 0){if(C=Q.geometries[I.geometry]){var b=!1;E=[];for(W=0;W<I.materials.length;W++)E[W]=Q.materials[I.materials[W]],b=E[W]instanceof THREE.MeshShaderMaterial;b&&C.computeTangents();z=I.position;r=I.rotation;
|
|
|
-q=I.quaternion;s=I.scale;q=0;E.length==0&&(E[0]=new THREE.MeshFaceMaterial);E.length>1&&(E=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,E);object.name=t;object.position.set(z[0],z[1],z[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=I.visible;Q.scene.addObject(object);Q.objects[t]=object;I.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),Q.scene.collisions.colliders.push(b));
|
|
|
-if(I.castsShadow)b=new THREE.ShadowVolume(C),Q.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},Q.triggers[object.name]=b)}}else z=I.position,r=I.rotation,q=I.quaternion,s=I.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(z[0],z[1],z[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
-s[1],s[2]),object.visible=I.visible!==void 0?I.visible:!1,Q.scene.addObject(object),Q.objects[t]=object,Q.empties[t]=object,I.trigger&&I.trigger.toLowerCase()!="none"&&(b={type:I.trigger,object:I},Q.triggers[object.name]=b)}function o(b){return function(c){Q.geometries[b]=c;k();n-=1;e.onLoadComplete();p()}}function m(b){return function(c){Q.geometries[b]=c}}function p(){e.callbackProgress({totalModels:V,totalTextures:X,loadedModels:V-n,loadedTextures:X-S},Q);e.onLoadProgress();n==0&&S==0&&c(Q)}var u,
|
|
|
-v,t,w,x,B,A,I,z,H,G,C,O,N,D,E,U,M,L,n,S,V,X,Q;M=b.data;D=new THREE.BinaryLoader;L=new THREE.JSONLoader;S=n=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(t in M.objects)if(I=M.objects[t],I.meshCollider){b=!0;break}if(b)Q.scene.collisions=new THREE.CollisionSystem;if(M.transform){b=M.transform.position;H=M.transform.rotation;var fa=M.transform.scale;b&&Q.scene.position.set(b[0],b[1],b[2]);H&&Q.scene.rotation.set(H[0],
|
|
|
-H[1],H[2]);fa&&Q.scene.scale.set(fa[0],fa[1],fa[2]);(b||H||fa)&&Q.scene.updateMatrix()}b=function(){S-=1;p();e.onLoadComplete()};for(x in M.cameras){H=M.cameras[x];if(H.type=="perspective")O=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")O=new THREE.Camera,O.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);z=H.position;H=H.target;O.position.set(z[0],z[1],z[2]);O.target.position.set(H[0],H[1],H[2]);Q.cameras[x]=O}for(w in M.lights)x=M.lights[w],
|
|
|
-O=x.color!==void 0?x.color:16777215,H=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(z=x.direction,U=new THREE.DirectionalLight(O,H),U.position.set(z[0],z[1],z[2]),U.position.normalize()):x.type=="point"?(z=x.position,d=x.distance,U=new THREE.PointLight(O,H,d),U.position.set(z[0],z[1],z[2])):x.type=="ambient"&&(U=new THREE.AmbientLight(O)),Q.scene.addLight(U),Q.lights[w]=U;for(B in M.fogs)w=M.fogs[B],w.type=="linear"?N=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(N=new THREE.FogExp2(0,
|
|
|
-w.density)),H=w.color,N.color.setRGB(H[0],H[1],H[2]),Q.fogs[B]=N;if(Q.cameras&&M.defaults.camera)Q.currentCamera=Q.cameras[M.defaults.camera];if(Q.fogs&&M.defaults.fog)Q.scene.fog=Q.fogs[M.defaults.fog];H=M.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(H[0],H[1],H[2]);Q.bgColorAlpha=M.defaults.bgalpha;for(u in M.geometries)if(B=M.geometries[u],B.type=="bin_mesh"||B.type=="ascii_mesh")n+=1,e.onLoadStart();V=n;for(u in M.geometries)B=M.geometries[u],B.type=="cube"?(C=new THREE.CubeGeometry(B.width,
|
|
|
-B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),Q.geometries[u]=C):B.type=="plane"?(C=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),Q.geometries[u]=C):B.type=="sphere"?(C=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),Q.geometries[u]=C):B.type=="cylinder"?(C=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),Q.geometries[u]=C):B.type=="torus"?(C=new THREE.TorusGeometry(B.radius,
|
|
|
-B.tube,B.segmentsR,B.segmentsT),Q.geometries[u]=C):B.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(B.subdivisions),Q.geometries[u]=C):B.type=="bin_mesh"?D.load({model:f(B.url,M.urlBaseType),callback:o(u)}):B.type=="ascii_mesh"?L.load({model:f(B.url,M.urlBaseType),callback:o(u)}):B.type=="embedded_mesh"&&(B=M.embeds[B.id])&&L.createModel(B,m(u),"");for(A in M.textures)if(u=M.textures[A],u.url instanceof Array){S+=u.url.length;for(D=0;D<u.url.length;D++)e.onLoadStart()}else S+=1,e.onLoadStart();
|
|
|
-X=S;for(A in M.textures){u=M.textures[A];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){D=[];for(var W=0;W<u.url.length;W++)D[W]=f(u.url[W],M.urlBaseType);D=THREE.ImageUtils.loadTextureCube(D,u.mapping,b)}else{D=THREE.ImageUtils.loadTexture(f(u.url,M.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)D.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)D.magFilter=THREE[u.magFilter];if(u.repeat){D.repeat.set(u.repeat[0],u.repeat[1]);
|
|
|
-if(u.repeat[0]!=1)D.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)D.wrapT=THREE.RepeatWrapping}u.offset&&D.offset.set(u.offset[0],u.offset[1]);if(u.wrap){L={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(L[u.wrap[0]]!==void 0)D.wrapS=L[u.wrap[0]];if(L[u.wrap[1]]!==void 0)D.wrapT=L[u.wrap[1]]}}Q.textures[A]=D}for(v in M.materials){A=M.materials[v];for(G in A.parameters)if(G=="envMap"||G=="map"||G=="lightMap")A.parameters[G]=Q.textures[A.parameters[G]];else if(G=="shading")A.parameters[G]=
|
|
|
-A.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")A.parameters[G]=THREE[A.parameters[G]]?THREE[A.parameters[G]]:THREE.NormalBlending;else if(G=="combine")A.parameters[G]=A.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(G=="vertexColors")if(A.parameters[G]=="face")A.parameters[G]=THREE.FaceColors;else if(A.parameters[G])A.parameters[G]=THREE.VertexColors;if(A.parameters.opacity!==void 0&&A.parameters.opacity<1)A.parameters.transparent=
|
|
|
-!0;if(A.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);D=A.parameters.color;L=A.parameters.specular;B=A.parameters.ambient;N=A.parameters.shininess;b.tNormal.texture=Q.textures[A.parameters.normalMap];if(A.parameters.normalMapFactor)b.uNormalScale.value=A.parameters.normalMapFactor;if(A.parameters.map)b.tDiffuse.texture=A.parameters.map,b.enableDiffuse.value=!0;if(A.parameters.lightMap)b.tAO.texture=A.parameters.lightMap,b.enableAO.value=!0;if(A.parameters.specularMap)b.tSpecular.texture=
|
|
|
-Q.textures[A.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(D);b.uSpecularColor.value.setHex(L);b.uAmbientColor.value.setHex(B);b.uShininess.value=N;if(A.parameters.opacity)b.uOpacity.value=A.parameters.opacity;A=new THREE.MeshShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else A=new THREE[A.type](A.parameters);Q.materials[v]=A}k();e.callbackSync(Q)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
|
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var g=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:g+"/"+b}function k(){for(n in K.objects)if(!R.objects[n])if(F=K.objects[n],F.geometry!==void 0){if(C=R.geometries[F.geometry]){var b=!1;T=[];for(ha=0;ha<F.materials.length;ha++)T[ha]=R.materials[F.materials[ha]],b=T[ha]instanceof THREE.MeshShaderMaterial;b&&C.computeTangents();z=F.position;r=
|
|
|
+F.rotation;q=F.quaternion;s=F.scale;q=0;T.length==0&&(T[0]=new THREE.MeshFaceMaterial);T.length>1&&(T=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(C,T);object.name=n;object.position.set(z[0],z[1],z[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=F.visible;R.scene.addObject(object);R.objects[n]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),R.scene.collisions.colliders.push(b));
|
|
|
+if(F.castsShadow)b=new THREE.ShadowVolume(C),R.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},R.triggers[object.name]=b)}}else z=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=n,object.position.set(z[0],z[1],z[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
+s[1],s[2]),object.visible=F.visible!==void 0?F.visible:!1,R.scene.addObject(object),R.objects[n]=object,R.empties[n]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},R.triggers[object.name]=b)}function p(b){return function(c){R.geometries[b]=c;k();m-=1;e.onLoadComplete();o()}}function t(b){return function(c){R.geometries[b]=c}}function o(){e.callbackProgress({totalModels:V,totalTextures:W,loadedModels:V-m,loadedTextures:W-U},R);e.onLoadProgress();m==0&&U==0&&c(R)}var u,
|
|
|
+v,n,w,x,B,A,F,z,G,I,C,L,D,H,T,J,K,N,m,U,V,W,R;K=b.data;H=new THREE.BinaryLoader;N=new THREE.JSONLoader;U=m=0;R={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(n in K.objects)if(F=K.objects[n],F.meshCollider){b=!0;break}if(b)R.scene.collisions=new THREE.CollisionSystem;if(K.transform){b=K.transform.position;G=K.transform.rotation;var Y=K.transform.scale;b&&R.scene.position.set(b[0],b[1],b[2]);G&&R.scene.rotation.set(G[0],
|
|
|
+G[1],G[2]);Y&&R.scene.scale.set(Y[0],Y[1],Y[2]);(b||G||Y)&&R.scene.updateMatrix()}b=function(){U-=1;o();e.onLoadComplete()};for(x in K.cameras){G=K.cameras[x];if(G.type=="perspective")L=new THREE.Camera(G.fov,G.aspect,G.near,G.far);else if(G.type=="ortho")L=new THREE.Camera,L.projectionMatrix=THREE.Matrix4.makeOrtho(G.left,G.right,G.top,G.bottom,G.near,G.far);z=G.position;G=G.target;L.position.set(z[0],z[1],z[2]);L.target.position.set(G[0],G[1],G[2]);R.cameras[x]=L}for(w in K.lights)x=K.lights[w],
|
|
|
+L=x.color!==void 0?x.color:16777215,G=x.intensity!==void 0?x.intensity:1,x.type=="directional"?(z=x.direction,J=new THREE.DirectionalLight(L,G),J.position.set(z[0],z[1],z[2]),J.position.normalize()):x.type=="point"?(z=x.position,d=x.distance,J=new THREE.PointLight(L,G,d),J.position.set(z[0],z[1],z[2])):x.type=="ambient"&&(J=new THREE.AmbientLight(L)),R.scene.addLight(J),R.lights[w]=J;for(B in K.fogs)w=K.fogs[B],w.type=="linear"?D=new THREE.Fog(0,w.near,w.far):w.type=="exp2"&&(D=new THREE.FogExp2(0,
|
|
|
+w.density)),G=w.color,D.color.setRGB(G[0],G[1],G[2]),R.fogs[B]=D;if(R.cameras&&K.defaults.camera)R.currentCamera=R.cameras[K.defaults.camera];if(R.fogs&&K.defaults.fog)R.scene.fog=R.fogs[K.defaults.fog];G=K.defaults.bgcolor;R.bgColor=new THREE.Color;R.bgColor.setRGB(G[0],G[1],G[2]);R.bgColorAlpha=K.defaults.bgalpha;for(u in K.geometries)if(B=K.geometries[u],B.type=="bin_mesh"||B.type=="ascii_mesh")m+=1,e.onLoadStart();V=m;for(u in K.geometries)B=K.geometries[u],B.type=="cube"?(C=new THREE.CubeGeometry(B.width,
|
|
|
+B.height,B.depth,B.segmentsWidth,B.segmentsHeight,B.segmentsDepth,null,B.flipped,B.sides),R.geometries[u]=C):B.type=="plane"?(C=new THREE.PlaneGeometry(B.width,B.height,B.segmentsWidth,B.segmentsHeight),R.geometries[u]=C):B.type=="sphere"?(C=new THREE.SphereGeometry(B.radius,B.segmentsWidth,B.segmentsHeight),R.geometries[u]=C):B.type=="cylinder"?(C=new THREE.CylinderGeometry(B.numSegs,B.topRad,B.botRad,B.height,B.topOffset,B.botOffset),R.geometries[u]=C):B.type=="torus"?(C=new THREE.TorusGeometry(B.radius,
|
|
|
+B.tube,B.segmentsR,B.segmentsT),R.geometries[u]=C):B.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(B.subdivisions),R.geometries[u]=C):B.type=="bin_mesh"?H.load({model:f(B.url,K.urlBaseType),callback:p(u)}):B.type=="ascii_mesh"?N.load({model:f(B.url,K.urlBaseType),callback:p(u)}):B.type=="embedded_mesh"&&(B=K.embeds[B.id])&&N.createModel(B,t(u),"");for(A in K.textures)if(u=K.textures[A],u.url instanceof Array){U+=u.url.length;for(H=0;H<u.url.length;H++)e.onLoadStart()}else U+=1,e.onLoadStart();
|
|
|
+W=U;for(A in K.textures){u=K.textures[A];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){H=[];for(var ha=0;ha<u.url.length;ha++)H[ha]=f(u.url[ha],K.urlBaseType);H=THREE.ImageUtils.loadTextureCube(H,u.mapping,b)}else{H=THREE.ImageUtils.loadTexture(f(u.url,K.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)H.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)H.magFilter=THREE[u.magFilter];if(u.repeat){H.repeat.set(u.repeat[0],u.repeat[1]);
|
|
|
+if(u.repeat[0]!=1)H.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)H.wrapT=THREE.RepeatWrapping}u.offset&&H.offset.set(u.offset[0],u.offset[1]);if(u.wrap){N={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(N[u.wrap[0]]!==void 0)H.wrapS=N[u.wrap[0]];if(N[u.wrap[1]]!==void 0)H.wrapT=N[u.wrap[1]]}}R.textures[A]=H}for(v in K.materials){A=K.materials[v];for(I in A.parameters)if(I=="envMap"||I=="map"||I=="lightMap")A.parameters[I]=R.textures[A.parameters[I]];else if(I=="shading")A.parameters[I]=
|
|
|
+A.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")A.parameters[I]=THREE[A.parameters[I]]?THREE[A.parameters[I]]:THREE.NormalBlending;else if(I=="combine")A.parameters[I]=A.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(I=="vertexColors")if(A.parameters[I]=="face")A.parameters[I]=THREE.FaceColors;else if(A.parameters[I])A.parameters[I]=THREE.VertexColors;if(A.parameters.opacity!==void 0&&A.parameters.opacity<1)A.parameters.transparent=
|
|
|
+!0;if(A.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);H=A.parameters.color;N=A.parameters.specular;B=A.parameters.ambient;D=A.parameters.shininess;b.tNormal.texture=R.textures[A.parameters.normalMap];if(A.parameters.normalMapFactor)b.uNormalScale.value=A.parameters.normalMapFactor;if(A.parameters.map)b.tDiffuse.texture=A.parameters.map,b.enableDiffuse.value=!0;if(A.parameters.lightMap)b.tAO.texture=A.parameters.lightMap,b.enableAO.value=!0;if(A.parameters.specularMap)b.tSpecular.texture=
|
|
|
+R.textures[A.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(H);b.uSpecularColor.value.setHex(N);b.uAmbientColor.value.setHex(B);b.uShininess.value=D;if(A.parameters.opacity)b.uOpacity.value=A.parameters.opacity;A=new THREE.MeshShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else A=new THREE[A.type](A.parameters);R.materials[v]=A}k();e.callbackSync(R)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
|
THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype={load:function(b){var c=new XMLHttpRequest,e=b.model,f=b.callback,g=b.scale!==void 0?b.scale:1,j=b.offsetX!==void 0?b.offsetX:0,h=b.offsetY!==void 0?b.offsetY:0,k=b.offsetZ!==void 0?b.offsetZ:0;c.onreadystatechange=function(){c.readyState==4?c.status==200||c.status==0?THREE.UTF8Loader.prototype.createModel(c.responseText,f,g,j,h,k):alert("Couldn't load ["+e+"] ["+c.status+"]"):c.readyState!=3&&c.readyState==2&&c.getResponseHeader("Content-Length")};c.open("GET",e,!0);c.send(null)},
|
|
|
-decompressMesh:function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,g=0;g<8;g++){for(var j=0,h=0;h<c;++h){var k=b.charCodeAt(h+f);j+=k>>1^-(k&1);e[8*h+g]=j}f+=c}c=b.length-f;j=new Uint16Array(c);for(g=h=0;g<c;g++)k=b.charCodeAt(g+f),j[g]=h-k,k==0&&h++;return[e,j]},createModel:function(b,c,e,f,g,j){var h=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var h=THREE.UTF8Loader.prototype.decompressMesh(b),m=[],p=[];(function(b,h,m){for(var o,p,B,
|
|
|
-A=b.length;m<A;m+=h)o=b[m],p=b[m+1],B=b[m+2],o=o/16383*e,p=p/16383*e,B=B/16383*e,o+=f,p+=g,B+=j,THREE.UTF8Loader.prototype.v(c,o,p,B)})(h[0],8,0);(function(b,c,e){for(var f,g,h=b.length;e<h;e+=c)f=b[e],g=b[e+1],f/=1023,g/=1023,p.push(f,g)})(h[0],8,3);(function(b,c,e){for(var f,g,h,j=b.length;e<j;e+=c)f=b[e],g=b[e+1],h=b[e+2],f=(f-512)/511,g=(g-512)/511,h=(h-512)/511,m.push(f,g,h)})(h[0],8,5);(function(b){var e,f,g,h,j,o,I,z=b.length;for(e=0;e<z;e+=3)f=b[e],g=b[e+1],h=b[e+2],THREE.UTF8Loader.prototype.f3n(c,
|
|
|
-m,f,g,h,0,f,g,h),j=p[f*2],f=p[f*2+1],o=p[g*2],g=p[g*2+1],I=p[h*2],h=p[h*2+1],THREE.UTF8Loader.prototype.uv3(c.faceVertexUvs[0],j,f,o,g,I,h)})(h[1]);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h)},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3n:function(b,c,e,f,g,j,h,k,o){var j=b.materials[j],m=c[k*3],p=c[k*3+1],k=c[k*3+2],u=c[o*3],v=c[o*3+1],o=c[o*3+2],h=new THREE.Vector3(c[h*3],c[h*3+1],c[h*
|
|
|
-3+2]),k=new THREE.Vector3(m,p,k),o=new THREE.Vector3(u,v,o);b.faces.push(new THREE.Face3(e,f,g,[h,k,o],null,j))},uv3:function(b,c,e,f,g,j,h){var k=[];k.push(new THREE.UV(c,e));k.push(new THREE.UV(f,g));k.push(new THREE.UV(j,h));b.push(k)},constructor:THREE.UTF8Loader};
|
|
|
+decompressMesh:function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,g=0;g<8;g++){for(var j=0,h=0;h<c;++h){var k=b.charCodeAt(h+f);j+=k>>1^-(k&1);e[8*h+g]=j}f+=c}c=b.length-f;j=new Uint16Array(c);for(g=h=0;g<c;g++)k=b.charCodeAt(g+f),j[g]=h-k,k==0&&h++;return[e,j]},createModel:function(b,c,e,f,g,j){var h=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var h=THREE.UTF8Loader.prototype.decompressMesh(b),t=[],o=[];(function(b,h,n){for(var p,o,t,
|
|
|
+A=b.length;n<A;n+=h)p=b[n],o=b[n+1],t=b[n+2],p=p/16383*e,o=o/16383*e,t=t/16383*e,p+=f,o+=g,t+=j,THREE.UTF8Loader.prototype.v(c,p,o,t)})(h[0],8,0);(function(b,c,e){for(var f,g,h=b.length;e<h;e+=c)f=b[e],g=b[e+1],f/=1023,g/=1023,o.push(f,g)})(h[0],8,3);(function(b,c,e){for(var f,g,h,j=b.length;e<j;e+=c)f=b[e],g=b[e+1],h=b[e+2],f=(f-512)/511,g=(g-512)/511,h=(h-512)/511,t.push(f,g,h)})(h[0],8,5);(function(b){var e,f,g,h,j,p,F,z=b.length;for(e=0;e<z;e+=3)f=b[e],g=b[e+1],h=b[e+2],THREE.UTF8Loader.prototype.f3n(c,
|
|
|
+t,f,g,h,0,f,g,h),j=o[f*2],f=o[f*2+1],p=o[g*2],g=o[g*2+1],F=o[h*2],h=o[h*2+1],THREE.UTF8Loader.prototype.uv3(c.faceVertexUvs[0],j,f,p,g,F,h)})(h[1]);this.computeCentroids();this.computeFaceNormals()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h)},v:function(b,c,e,f){b.vertices.push(new THREE.Vertex(new THREE.Vector3(c,e,f)))},f3n:function(b,c,e,f,g,j,h,k,p){var j=b.materials[j],t=c[k*3],o=c[k*3+1],k=c[k*3+2],u=c[p*3],v=c[p*3+1],p=c[p*3+2],h=new THREE.Vector3(c[h*3],c[h*3+1],c[h*
|
|
|
+3+2]),k=new THREE.Vector3(t,o,k),p=new THREE.Vector3(u,v,p);b.faces.push(new THREE.Face3(e,f,g,[h,k,p],null,j))},uv3:function(b,c,e,f,g,j,h){var k=[];k.push(new THREE.UV(c,e));k.push(new THREE.UV(f,g));k.push(new THREE.UV(j,h));b.push(k)},constructor:THREE.UTF8Loader};
|
|
|
THREE.MarchingCubes=function(b,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(b){this.isolation=80;this.size=b;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(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,j,h,k,o,m,p,u){h=(h-p)/(u-p);p=this.normal_cache;c[j]=k+h*this.delta;c[j+1]=o;c[j+2]=m;g[j]=this.lerp(p[b],p[b+3],h);g[j+1]=this.lerp(p[b+1],p[b+4],h);g[j+2]=this.lerp(p[b+2],p[b+5],h)};this.VIntY=function(b,c,g,j,h,k,o,m,p,u){h=(h-p)/(u-p);p=this.normal_cache;c[j]=k;c[j+1]=o+h*this.delta;c[j+
|
|
|
-2]=m;c=b+this.yd*3;g[j]=this.lerp(p[b],p[c],h);g[j+1]=this.lerp(p[b+1],p[c+1],h);g[j+2]=this.lerp(p[b+2],p[c+2],h)};this.VIntZ=function(b,c,g,j,h,k,o,m,p,u){h=(h-p)/(u-p);p=this.normal_cache;c[j]=k;c[j+1]=o;c[j+2]=m+h*this.delta;c=b+this.zd*3;g[j]=this.lerp(p[b],p[c],h);g[j+1]=this.lerp(p[b+1],p[c+1],h);g[j+2]=this.lerp(p[b+2],p[c+2],h)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
|
|
|
-this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,j,h,k){var o=j+1,m=j+this.yd,p=j+this.zd,u=o+this.yd,v=o+this.zd,t=j+this.yd+this.zd,w=o+this.yd+this.zd,x=0,B=this.field[j],A=this.field[o],I=this.field[m],z=this.field[u],H=this.field[p],G=this.field[v],C=this.field[t],O=this.field[w];B<h&&(x|=1);A<h&&(x|=2);I<h&&(x|=8);z<h&&(x|=4);H<h&&(x|=16);G<h&&(x|=32);C<h&&(x|=128);O<h&&(x|=64);var N=THREE.edgeTable[x];if(N==0)return 0;var D=this.delta,
|
|
|
-E=b+D,U=c+D,D=g+D;N&1&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,0,h,b,c,g,B,A));N&2&&(this.compNorm(o),this.compNorm(u),this.VIntY(o*3,this.vlist,this.nlist,3,h,E,c,g,A,z));N&4&&(this.compNorm(m),this.compNorm(u),this.VIntX(m*3,this.vlist,this.nlist,6,h,b,U,g,I,z));N&8&&(this.compNorm(j),this.compNorm(m),this.VIntY(j*3,this.vlist,this.nlist,9,h,b,c,g,B,I));N&16&&(this.compNorm(p),this.compNorm(v),this.VIntX(p*3,this.vlist,this.nlist,12,h,b,c,D,H,G));N&32&&(this.compNorm(v),
|
|
|
-this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,15,h,E,c,D,G,O));N&64&&(this.compNorm(t),this.compNorm(w),this.VIntX(t*3,this.vlist,this.nlist,18,h,b,U,D,C,O));N&128&&(this.compNorm(p),this.compNorm(t),this.VIntY(p*3,this.vlist,this.nlist,21,h,b,c,D,H,C));N&256&&(this.compNorm(j),this.compNorm(p),this.VIntZ(j*3,this.vlist,this.nlist,24,h,b,c,g,B,H));N&512&&(this.compNorm(o),this.compNorm(v),this.VIntZ(o*3,this.vlist,this.nlist,27,h,E,c,g,A,G));N&1024&&(this.compNorm(u),this.compNorm(w),this.VIntZ(u*
|
|
|
-3,this.vlist,this.nlist,30,h,E,U,g,z,O));N&2048&&(this.compNorm(m),this.compNorm(t),this.VIntZ(m*3,this.vlist,this.nlist,33,h,b,U,g,I,C));x<<=4;for(h=j=0;THREE.triTable[x+h]!=-1;)b=x+h,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],k),h+=3,j++;return j};this.posnormtriv=function(b,c,g,j,h,k){var o=this.count*3;this.positionArray[o]=b[g];this.positionArray[o+1]=b[g+1];this.positionArray[o+2]=b[g+2];this.positionArray[o+3]=b[j];this.positionArray[o+
|
|
|
-4]=b[j+1];this.positionArray[o+5]=b[j+2];this.positionArray[o+6]=b[h];this.positionArray[o+7]=b[h+1];this.positionArray[o+8]=b[h+2];this.normalArray[o]=c[g];this.normalArray[o+1]=c[g+1];this.normalArray[o+2]=c[g+2];this.normalArray[o+3]=c[j];this.normalArray[o+4]=c[j+1];this.normalArray[o+5]=c[j+2];this.normalArray[o+6]=c[h];this.normalArray[o+7]=c[h+1];this.normalArray[o+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
|
|
|
-this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,j,h){var k=this.size*Math.sqrt(j/h),o=g*this.size,m=c*this.size,p=b*this.size,u=Math.floor(o-k);u<1&&(u=1);o=Math.floor(o+k);o>this.size-1&&(o=this.size-1);var v=Math.floor(m-k);v<1&&(v=1);m=Math.floor(m+k);m>this.size-1&&(m=this.size-1);var t=Math.floor(p-k);t<1&&(t=1);k=Math.floor(p+k);k>this.size-1&&(k=this.size-
|
|
|
-1);for(var w,x,B,A,I,z;u<o;u++){p=this.size2*u;x=u/this.size-g;I=x*x;for(x=v;x<m;x++){B=p+this.size*x;w=x/this.size-c;z=w*w;for(w=t;w<k;w++)A=w/this.size-b,A=j/(1.0E-6+A*A+z+I)-h,A>0&&(this.field[B+w]+=A)}}};this.addPlaneX=function(b,c){var g,j,h,k,o,m=this.size,p=this.yd,u=this.zd,v=this.field,t=m*Math.sqrt(b/c);t>m&&(t=m);for(g=0;g<t;g++)if(j=g/m,j*=j,k=b/(1.0E-4+j)-c,k>0)for(j=0;j<m;j++){o=g+j*p;for(h=0;h<m;h++)v[u*h+o]+=k}};this.addPlaneY=function(b,c){var g,j,h,k,o,m,p=this.size,u=this.yd,v=
|
|
|
-this.zd,t=this.field,w=p*Math.sqrt(b/c);w>p&&(w=p);for(j=0;j<w;j++)if(g=j/p,g*=g,k=b/(1.0E-4+g)-c,k>0){o=j*u;for(g=0;g<p;g++){m=o+g;for(h=0;h<p;h++)t[v*h+m]+=k}}};this.addPlaneZ=function(b,c){var g,j,h,k,o,m;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(g=h/size,g*=g,k=b/(1.0E-4+g)-c,k>0){o=zd*h;for(j=0;j<size;j++){m=o+j*yd;for(g=0;g<size;g++)field[m+g]+=k}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
|
|
|
-3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,j,h,k,o,m,p,u,v=this.size-2;for(h=1;h<v;h++){u=this.size2*h;m=(h-this.halfsize)/this.halfsize;for(j=1;j<v;j++){p=u+this.size*j;o=(j-this.halfsize)/this.halfsize;for(g=1;g<v;g++)k=(g-this.halfsize)/this.halfsize,c=p+g,this.polygonize(k,o,m,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(j){var h,k,o,m,p,u,v,t;for(h=0;h<j.count;h++)v=h*3,p=v+1,t=v+2,k=j.positionArray[v],
|
|
|
-o=j.positionArray[p],m=j.positionArray[t],u=new THREE.Vector3(k,o,m),k=j.normalArray[v],o=j.normalArray[p],m=j.normalArray[t],v=new THREE.Vector3(k,o,m),v.normalize(),p=new THREE.Vertex(u),c.vertices.push(p),g.push(v);nfaces=j.count/3;for(h=0;h<nfaces;h++)v=(b+h)*3,p=v+1,t=v+2,u=g[v],k=g[p],o=g[t],v=new THREE.Face3(v,p,t,[u,k,o]),c.faces.push(v);b+=nfaces;j.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,g){return b+(c-b)*g};this.VIntX=function(b,c,g,j,h,k,p,t,o,u){h=(h-o)/(u-o);o=this.normal_cache;c[j]=k+h*this.delta;c[j+1]=p;c[j+2]=t;g[j]=this.lerp(o[b],o[b+3],h);g[j+1]=this.lerp(o[b+1],o[b+4],h);g[j+2]=this.lerp(o[b+2],o[b+5],h)};this.VIntY=function(b,c,g,j,h,k,p,t,o,u){h=(h-o)/(u-o);o=this.normal_cache;c[j]=k;c[j+1]=p+h*this.delta;c[j+
|
|
|
+2]=t;c=b+this.yd*3;g[j]=this.lerp(o[b],o[c],h);g[j+1]=this.lerp(o[b+1],o[c+1],h);g[j+2]=this.lerp(o[b+2],o[c+2],h)};this.VIntZ=function(b,c,g,j,h,k,p,t,o,u){h=(h-o)/(u-o);o=this.normal_cache;c[j]=k;c[j+1]=p;c[j+2]=t+h*this.delta;c=b+this.zd*3;g[j]=this.lerp(o[b],o[c],h);g[j+1]=this.lerp(o[b+1],o[c+1],h);g[j+2]=this.lerp(o[b+2],o[c+2],h)};this.compNorm=function(b){var c=b*3;this.normal_cache[c]==0&&(this.normal_cache[c]=this.field[b-1]-this.field[b+1],this.normal_cache[c+1]=this.field[b-this.yd]-this.field[b+
|
|
|
+this.yd],this.normal_cache[c+2]=this.field[b-this.zd]-this.field[b+this.zd])};this.polygonize=function(b,c,g,j,h,k){var p=j+1,t=j+this.yd,o=j+this.zd,u=p+this.yd,v=p+this.zd,n=j+this.yd+this.zd,w=p+this.yd+this.zd,x=0,B=this.field[j],A=this.field[p],F=this.field[t],z=this.field[u],G=this.field[o],I=this.field[v],C=this.field[n],L=this.field[w];B<h&&(x|=1);A<h&&(x|=2);F<h&&(x|=8);z<h&&(x|=4);G<h&&(x|=16);I<h&&(x|=32);C<h&&(x|=128);L<h&&(x|=64);var D=THREE.edgeTable[x];if(D==0)return 0;var H=this.delta,
|
|
|
+T=b+H,J=c+H,H=g+H;D&1&&(this.compNorm(j),this.compNorm(p),this.VIntX(j*3,this.vlist,this.nlist,0,h,b,c,g,B,A));D&2&&(this.compNorm(p),this.compNorm(u),this.VIntY(p*3,this.vlist,this.nlist,3,h,T,c,g,A,z));D&4&&(this.compNorm(t),this.compNorm(u),this.VIntX(t*3,this.vlist,this.nlist,6,h,b,J,g,F,z));D&8&&(this.compNorm(j),this.compNorm(t),this.VIntY(j*3,this.vlist,this.nlist,9,h,b,c,g,B,F));D&16&&(this.compNorm(o),this.compNorm(v),this.VIntX(o*3,this.vlist,this.nlist,12,h,b,c,H,G,I));D&32&&(this.compNorm(v),
|
|
|
+this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,15,h,T,c,H,I,L));D&64&&(this.compNorm(n),this.compNorm(w),this.VIntX(n*3,this.vlist,this.nlist,18,h,b,J,H,C,L));D&128&&(this.compNorm(o),this.compNorm(n),this.VIntY(o*3,this.vlist,this.nlist,21,h,b,c,H,G,C));D&256&&(this.compNorm(j),this.compNorm(o),this.VIntZ(j*3,this.vlist,this.nlist,24,h,b,c,g,B,G));D&512&&(this.compNorm(p),this.compNorm(v),this.VIntZ(p*3,this.vlist,this.nlist,27,h,T,c,g,A,I));D&1024&&(this.compNorm(u),this.compNorm(w),this.VIntZ(u*
|
|
|
+3,this.vlist,this.nlist,30,h,T,J,g,z,L));D&2048&&(this.compNorm(t),this.compNorm(n),this.VIntZ(t*3,this.vlist,this.nlist,33,h,b,J,g,F,C));x<<=4;for(h=j=0;THREE.triTable[x+h]!=-1;)b=x+h,c=b+1,g=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[g],k),h+=3,j++;return j};this.posnormtriv=function(b,c,g,j,h,k){var p=this.count*3;this.positionArray[p]=b[g];this.positionArray[p+1]=b[g+1];this.positionArray[p+2]=b[g+2];this.positionArray[p+3]=b[j];this.positionArray[p+
|
|
|
+4]=b[j+1];this.positionArray[p+5]=b[j+2];this.positionArray[p+6]=b[h];this.positionArray[p+7]=b[h+1];this.positionArray[p+8]=b[h+2];this.normalArray[p]=c[g];this.normalArray[p+1]=c[g+1];this.normalArray[p+2]=c[g+2];this.normalArray[p+3]=c[j];this.normalArray[p+4]=c[j+1];this.normalArray[p+5]=c[j+2];this.normalArray[p+6]=c[h];this.normalArray[p+7]=c[h+1];this.normalArray[p+8]=c[h+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&k(this)};this.begin=function(){this.count=0;
|
|
|
+this.hasNormal=this.hasPos=!1};this.end=function(b){if(this.count!=0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;b(this)}};this.addBall=function(b,c,g,j,h){var k=this.size*Math.sqrt(j/h),p=g*this.size,t=c*this.size,o=b*this.size,u=Math.floor(p-k);u<1&&(u=1);p=Math.floor(p+k);p>this.size-1&&(p=this.size-1);var v=Math.floor(t-k);v<1&&(v=1);t=Math.floor(t+k);t>this.size-1&&(t=this.size-1);var n=Math.floor(o-k);n<1&&(n=1);k=Math.floor(o+k);k>this.size-1&&(k=this.size-
|
|
|
+1);for(var w,x,B,A,F,z;u<p;u++){o=this.size2*u;x=u/this.size-g;F=x*x;for(x=v;x<t;x++){B=o+this.size*x;w=x/this.size-c;z=w*w;for(w=n;w<k;w++)A=w/this.size-b,A=j/(1.0E-6+A*A+z+F)-h,A>0&&(this.field[B+w]+=A)}}};this.addPlaneX=function(b,c){var g,j,h,k,p,t=this.size,o=this.yd,u=this.zd,v=this.field,n=t*Math.sqrt(b/c);n>t&&(n=t);for(g=0;g<n;g++)if(j=g/t,j*=j,k=b/(1.0E-4+j)-c,k>0)for(j=0;j<t;j++){p=g+j*o;for(h=0;h<t;h++)v[u*h+p]+=k}};this.addPlaneY=function(b,c){var g,j,h,k,p,t,o=this.size,u=this.yd,v=
|
|
|
+this.zd,n=this.field,w=o*Math.sqrt(b/c);w>o&&(w=o);for(j=0;j<w;j++)if(g=j/o,g*=g,k=b/(1.0E-4+g)-c,k>0){p=j*u;for(g=0;g<o;g++){t=p+g;for(h=0;h<o;h++)n[v*h+t]+=k}}};this.addPlaneZ=function(b,c){var g,j,h,k,p,t;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(h=0;h<dist;h++)if(g=h/size,g*=g,k=b/(1.0E-4+g)-c,k>0){p=zd*h;for(j=0;j<size;j++){t=p+j*yd;for(g=0;g<size;g++)field[t+g]+=k}}};this.reset=function(){var b;for(b=0;b<this.size3;b++)this.normal_cache[b*
|
|
|
+3]=0,this.field[b]=0};this.render=function(b){this.begin();var c,g,j,h,k,p,t,o,u,v=this.size-2;for(h=1;h<v;h++){u=this.size2*h;t=(h-this.halfsize)/this.halfsize;for(j=1;j<v;j++){o=u+this.size*j;p=(j-this.halfsize)/this.halfsize;for(g=1;g<v;g++)k=(g-this.halfsize)/this.halfsize,c=o+g,this.polygonize(k,p,t,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,g=[];this.render(function(j){var h,k,p,t,o,u,v,n;for(h=0;h<j.count;h++)v=h*3,o=v+1,n=v+2,k=j.positionArray[v],
|
|
|
+p=j.positionArray[o],t=j.positionArray[n],u=new THREE.Vector3(k,p,t),k=j.normalArray[v],p=j.normalArray[o],t=j.normalArray[n],v=new THREE.Vector3(k,p,t),v.normalize(),o=new THREE.Vertex(u),c.vertices.push(o),g.push(v);nfaces=j.count/3;for(h=0;h<nfaces;h++)v=(b+h)*3,o=v+1,n=v+2,u=g[v],k=g[o],p=g[n],v=new THREE.Face3(v,o,n,[u,k,p]),c.faces.push(v);b+=nfaces;j.count=0});return c};this.init(b)};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]);
|
|
@@ -595,20 +596,20 @@ THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.
|
|
|
THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,g,j=0;c=0;for(e=this.colliders.length;c<e;c++)if(g=this.colliders[c],f=this.rayCast(b,g),f<Number.MAX_VALUE)g.distance=f,f>j?this.hits.push(g):this.hits.unshift(g),j=f;return this.hits};
|
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
|
|
|
THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
|
|
|
-THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,j=0;j<c.numFaces;j++){var h=c.mesh.geometry.faces[j],k=c.mesh.geometry.vertices[h.a].position,o=c.mesh.geometry.vertices[h.b].position,m=c.mesh.geometry.vertices[h.c].position,p=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(e,k,o,m,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
-h instanceof THREE.Face4&&(h=this.rayTriangle(e,k,o,p,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(e,o,m,p,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
|
|
|
-THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,j,h){var k=THREE.CollisionSystem.__v1,o=THREE.CollisionSystem.__v2;j.set(0,0,0);k.sub(e,c);o.sub(f,e);j.cross(k,o);k=j.dot(b.direction);if(!(k<0))if(h.doubleSided||h.flipSided)j.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;h=j.dot(c)-j.dot(b.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=k*g))return Number.MAX_VALUE;h/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(h);k.addSelf(b.origin);Math.abs(j.x)>
|
|
|
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,g,j=0;j<c.numFaces;j++){var h=c.mesh.geometry.faces[j],k=c.mesh.geometry.vertices[h.a].position,p=c.mesh.geometry.vertices[h.b].position,t=c.mesh.geometry.vertices[h.c].position,o=h instanceof THREE.Face4?c.mesh.geometry.vertices[h.d].position:null;h instanceof THREE.Face3?(h=this.rayTriangle(e,k,p,t,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
+h instanceof THREE.Face4&&(h=this.rayTriangle(e,k,p,o,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize()),h=this.rayTriangle(e,p,t,o,f,this.collisionNormal,c.mesh),h<f&&(f=h,g=j,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:g}};
|
|
|
+THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,g,j,h){var k=THREE.CollisionSystem.__v1,p=THREE.CollisionSystem.__v2;j.set(0,0,0);k.sub(e,c);p.sub(f,e);j.cross(k,p);k=j.dot(b.direction);if(!(k<0))if(h.doubleSided||h.flipSided)j.multiplyScalar(-1),k*=-1;else return Number.MAX_VALUE;h=j.dot(c)-j.dot(b.origin);if(!(h<=0))return Number.MAX_VALUE;if(!(h>=k*g))return Number.MAX_VALUE;h/=k;k=THREE.CollisionSystem.__v3;k.copy(b.direction);k.multiplyScalar(h);k.addSelf(b.origin);Math.abs(j.x)>
|
|
|
Math.abs(j.y)?Math.abs(j.x)>Math.abs(j.z)?(b=k.y-c.y,j=e.y-c.y,g=f.y-c.y,k=k.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=k.x-c.x,j=e.x-c.x,g=f.x-c.x,k=k.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(j.y)>Math.abs(j.z)?(b=k.x-c.x,j=e.x-c.x,g=f.x-c.x,k=k.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=k.x-c.x,j=e.x-c.x,g=f.x-c.x,k=k.y-c.y,e=e.y-c.y,f=f.y-c.y);c=j*f-e*g;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-k*g)*c;if(!(f>=0))return Number.MAX_VALUE;c*=j*k-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return h};
|
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
|
|
|
-THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,j=0,h=0,k=0,o=0,m=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,m=!1,h=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,m=!1,h=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,m=!1,k=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
|
|
|
-m=!1,k=1);e.origin.z<c.min.z?(j=c.min.z-e.origin.z,j/=e.direction.z,m=!1,o=-1):e.origin.z>c.max.z&&(j=c.max.z-e.origin.z,j/=e.direction.z,m=!1,o=1);if(m)return-1;m=0;g>f&&(m=1,f=g);j>f&&(m=2,f=j);switch(m){case 0:k=e.origin.y+e.direction.y*f;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
|
|
|
-f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;k=e.origin.y+e.direction.y*f;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,o)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
|
|
|
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,g=0,j=0,h=0,k=0,p=0,t=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,t=!1,h=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,t=!1,h=1);e.origin.y<c.min.y?(g=c.min.y-e.origin.y,g/=e.direction.y,t=!1,k=-1):e.origin.y>c.max.y&&(g=c.max.y-e.origin.y,g/=e.direction.y,
|
|
|
+t=!1,k=1);e.origin.z<c.min.z?(j=c.min.z-e.origin.z,j/=e.direction.z,t=!1,p=-1):e.origin.z>c.max.z&&(j=c.max.z-e.origin.z,j/=e.direction.z,t=!1,p=1);if(t)return-1;t=0;g>f&&(t=1,f=g);j>f&&(t=2,f=j);switch(t){case 0:k=e.origin.y+e.direction.y*f;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(h,0,0);break;case 1:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
|
|
|
+f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,k,0);break;case 2:h=e.origin.x+e.direction.x*f;if(h<c.min.x||h>c.max.x)return Number.MAX_VALUE;k=e.origin.y+e.direction.y*f;if(k<c.min.y||k>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,p)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
|
|
|
THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);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(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=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]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
|
|
|
THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
|
|
|
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,j=new THREE.Camera,h=new THREE.Matrix4,k=new THREE.Matrix4,o,m,p;g.useTarget=j.useTarget=!1;g.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),t=new THREE.Camera(53,1,1,1E4);t.position.z=
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,g=new THREE.Camera,j=new THREE.Camera,h=new THREE.Matrix4,k=new THREE.Matrix4,p,t,o;g.useTarget=j.useTarget=!1;g.matrixAutoUpdate=j.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.WebGLRenderTarget(512,512,b),n=new THREE.Camera(53,1,1,1E4);n.position.z=
|
|
|
2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},mapRight:{type:"t",value:1,texture:v}},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}"});
|
|
|
-var w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(o!==e.aspect||m!==e.near||p!==e.fov){o=e.aspect;m=e.near;p=e.fov;var A=e.projectionMatrix.clone(),I=125/30*0.5,z=I*m/125,H=m*Math.tan(p*Math.PI/360),G;h.n14=I;k.n14=-I;I=-H*o+z;G=H*o+z;A.n11=2*m/(G-I);A.n13=(G+I)/(G-I);g.projectionMatrix=A.clone();I=-H*o-z;G=H*o-z;A.n11=2*m/(G-I);
|
|
|
-A.n13=(G+I)/(G-I);j.projectionMatrix=A.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(e.position);g.near=m;g.far=e.far;f.call(c,b,g,u,!0);j.matrix=e.matrixWorld.clone().multiplySelf(h);j.update(null,!0);j.position.copy(e.position);j.near=m;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,w,t)}};
|
|
|
+var w=new THREE.Scene;w.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;v.width=b;v.height=f};this.render=function(b,e){e.update(null,!0);if(p!==e.aspect||t!==e.near||o!==e.fov){p=e.aspect;t=e.near;o=e.fov;var A=e.projectionMatrix.clone(),F=125/30*0.5,z=F*t/125,G=t*Math.tan(o*Math.PI/360),I;h.n14=F;k.n14=-F;F=-G*p+z;I=G*p+z;A.n11=2*t/(I-F);A.n13=(I+F)/(I-F);g.projectionMatrix=A.clone();F=-G*p-z;I=G*p-z;A.n11=2*t/(I-F);
|
|
|
+A.n13=(I+F)/(I-F);j.projectionMatrix=A.clone()}g.matrix=e.matrixWorld.clone().multiplySelf(k);g.update(null,!0);g.position.copy(e.position);g.near=t;g.far=e.far;f.call(c,b,g,u,!0);j.matrix=e.matrixWorld.clone().multiplySelf(h);j.update(null,!0);j.position.copy(e.position);j.near=t;j.far=e.far;f.call(c,b,j,v,!0);f.call(c,w,n)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,g,j,h=new THREE.Camera,k=new THREE.Camera;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;(new THREE.Camera(53,window.innerWidth/2/window.innerHeight,1,1E4)).position.z=-10;this.setSize=function(b,f){e.call(c,b,f);g=b/2;j=f};this.render=function(b,e){this.clear();h.fov=e.fov;h.aspect=0.5*e.aspect;h.near=e.near;h.far=e.far;
|
|
|
h.updateProjectionMatrix();h.position.copy(e.position);h.target.position.copy(e.target.position);h.translateX(c.separation);k.projectionMatrix=h.projectionMatrix;k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(-c.separation);this.setViewport(0,0,g,j);f.call(c,b,h);this.setViewport(g,0,g,j);f.call(c,b,k,!1)}};
|