|
@@ -16,34 +16,34 @@ b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;thi
|
|
|
normalize:function(){return this.divideScalar(this.length())},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,e){return b.distance-e.distance});return f},intersectObject:function(b){function c(b,e,c){var f;f=c.clone().subSelf(b).dot(e);if(f<=0)return null;b=b.clone().addSelf(e.clone().multiplyScalar(f));return c.distanceTo(b)}function e(b,e,c,f){var f=f.clone().subSelf(e),
|
|
|
c=c.clone().subSelf(e),h=b.clone().subSelf(e),b=f.dot(f),e=f.dot(c),f=f.dot(h),k=c.dot(c),c=c.dot(h),h=1/(b*k-e*e),k=(k*f-e*c)*h,b=(b*c-e*f)*h;return k>0&&b>0&&k+b<1}if(b instanceof THREE.Particle){var f=c(this.origin,this.direction,b.matrixWorld.getPosition());if(f==null||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.matrixWorld.getPosition());if(f==null||f>b.geometry.boundingSphere.radius*Math.max(b.scale.x,
|
|
|
-Math.max(b.scale.y,b.scale.z)))return[];var h,m,k,n,u,v,w,p,x,t,y=b.geometry,z=y.vertices,A=[],f=0;for(h=y.faces.length;f<h;f++)if(m=y.faces[f],x=this.origin.clone(),t=this.direction.clone(),v=b.matrixWorld,k=v.multiplyVector3(m.centroid.clone()).subSelf(x),p=k.dot(t),!(p<=0)&&(k=v.multiplyVector3(z[m.a].position.clone()),n=v.multiplyVector3(z[m.b].position.clone()),u=v.multiplyVector3(z[m.c].position.clone()),v=m instanceof THREE.Face4?v.multiplyVector3(z[m.d].position.clone()):null,w=b.matrixRotationWorld.multiplyVector3(m.normal.clone()),
|
|
|
-p=t.dot(w),b.doubleSided||(b.flipSided?p>0:p<0)))if(p=w.dot((new THREE.Vector3).sub(k,x))/p,x=x.addSelf(t.multiplyScalar(p)),m instanceof THREE.Face3)e(x,k,n,u)&&(m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m));else if(m instanceof THREE.Face4&&(e(x,k,n,v)||e(x,n,u,v)))m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m);A.sort(function(b,e){return b.distance-e.distance});return A}else return[]}};
|
|
|
-THREE.Rectangle=function(){function b(){m=f-c;k=h-e}var c,e,f,h,m,k,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return m};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,m,w,p){n=!1;c=k;e=m;f=w;h=p;b()};this.addPoint=function(k,m){n?(n=!1,c=k,e=m,f=k,h=m):(c=c<k?c:k,e=e<m?e:m,f=f>k?f:k,h=h>m?h:m);b()};this.add3Points=
|
|
|
-function(k,m,w,p,x,t){n?(n=!1,c=k<w?k<x?k:x:w<x?w:x,e=m<p?m<t?m:t:p<t?p:t,f=k>w?k>x?k:x:w>x?w:x,h=m>p?m>t?m:t:p>t?p:t):(c=k<w?k<x?k<c?k:c:x<c?x:c:w<x?w<c?w:c:x<c?x:c,e=m<p?m<t?m<e?m:e:t<e?t:e:p<t?p<e?p:e:t<e?t:e,f=k>w?k>x?k>f?k:f:x>f?x:f:w>x?w>f?w:f:x>f?x:f,h=m>p?m>t?m>h?m:h:t>h?t:h:p>t?p>h?p:h:t>h?t:h);b()};this.addRectangle=function(k){n?(n=!1,c=k.getLeft(),e=k.getTop(),f=k.getRight(),h=k.getBottom()):(c=c<k.getLeft()?c:k.getLeft(),e=e<k.getTop()?e:k.getTop(),f=f>k.getRight()?f:k.getRight(),h=h>
|
|
|
+Math.max(b.scale.y,b.scale.z)))return[];var h,m,k,n,u,v,w,t,x,p,y=b.geometry,z=y.vertices,A=[],f=0;for(h=y.faces.length;f<h;f++)if(m=y.faces[f],x=this.origin.clone(),p=this.direction.clone(),v=b.matrixWorld,k=v.multiplyVector3(m.centroid.clone()).subSelf(x),t=k.dot(p),!(t<=0)&&(k=v.multiplyVector3(z[m.a].position.clone()),n=v.multiplyVector3(z[m.b].position.clone()),u=v.multiplyVector3(z[m.c].position.clone()),v=m instanceof THREE.Face4?v.multiplyVector3(z[m.d].position.clone()):null,w=b.matrixRotationWorld.multiplyVector3(m.normal.clone()),
|
|
|
+t=p.dot(w),b.doubleSided||(b.flipSided?t>0:t<0)))if(t=w.dot((new THREE.Vector3).sub(k,x))/t,x=x.addSelf(p.multiplyScalar(t)),m instanceof THREE.Face3)e(x,k,n,u)&&(m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m));else if(m instanceof THREE.Face4&&(e(x,k,n,v)||e(x,n,u,v)))m={distance:this.origin.distanceTo(x),point:x,face:m,object:b},A.push(m);A.sort(function(b,e){return b.distance-e.distance});return A}else return[]}};
|
|
|
+THREE.Rectangle=function(){function b(){m=f-c;k=h-e}var c,e,f,h,m,k,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return m};this.getHeight=function(){return k};this.getLeft=function(){return c};this.getTop=function(){return e};this.getRight=function(){return f};this.getBottom=function(){return h};this.set=function(k,m,w,t){n=!1;c=k;e=m;f=w;h=t;b()};this.addPoint=function(k,m){n?(n=!1,c=k,e=m,f=k,h=m):(c=c<k?c:k,e=e<m?e:m,f=f>k?f:k,h=h>m?h:m);b()};this.add3Points=
|
|
|
+function(k,m,w,t,x,p){n?(n=!1,c=k<w?k<x?k:x:w<x?w:x,e=m<t?m<p?m:p:t<p?t:p,f=k>w?k>x?k:x:w>x?w:x,h=m>t?m>p?m:p:t>p?t:p):(c=k<w?k<x?k<c?k:c:x<c?x:c:w<x?w<c?w:c:x<c?x:c,e=m<t?m<p?m<e?m:e:p<e?p:e:t<p?t<e?t:e:p<e?p:e,f=k>w?k>x?k>f?k:f:x>f?x:f:w>x?w>f?w:f:x>f?x:f,h=m>t?m>p?m>h?m:h:p>h?p:h:t>p?t>h?t:h:p>h?p:h);b()};this.addRectangle=function(k){n?(n=!1,c=k.getLeft(),e=k.getTop(),f=k.getRight(),h=k.getBottom()):(c=c<k.getLeft()?c:k.getLeft(),e=e<k.getTop()?e:k.getTop(),f=f>k.getRight()?f:k.getRight(),h=h>
|
|
|
k.getBottom()?h:k.getBottom());b()};this.inflate=function(k){c-=k;e-=k;f+=k;h+=k;b()};this.minSelf=function(k){c=c>k.getLeft()?c:k.getLeft();e=e>k.getTop()?e:k.getTop();f=f<k.getRight()?f:k.getRight();h=h<k.getBottom()?h:k.getBottom();b()};this.intersects=function(b){return Math.min(f,b.getRight())-Math.max(c,b.getLeft())>=0&&Math.min(h,b.getBottom())-Math.max(e,b.getTop())>=0};this.empty=function(){n=!0;h=f=e=c=0;b()};this.isEmpty=function(){return n}};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,h,m,k,n,u,v,w,p,x,t,y,z){this.set(b||1,c||0,e||0,f||0,h||0,m||1,k||0,n||0,u||0,v||0,w||1,p||0,x||0,t||0,y||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n,u,v,w,p,x,t,y,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=m;this.n23=k;this.n24=n;this.n31=u;this.n32=v;this.n33=w;this.n34=p;this.n41=x;this.n42=t;this.n43=y;this.n44=z;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,h,m,k,n,u,v,w,t,x,p,y,z){this.set(b||1,c||0,e||0,f||0,h||0,m||1,k||0,n||0,u||0,v||0,w||1,t||0,x||0,p||0,y||0,z||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
+THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,m,k,n,u,v,w,t,x,p,y,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=m;this.n23=k;this.n24=n;this.n31=u;this.n32=v;this.n33=w;this.n34=t;this.n41=x;this.n42=p;this.n43=y;this.n44=z;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,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;m.sub(b,c).normalize();if(m.length()===0)m.z=1;f.cross(e,m).normalize();f.length()===0&&(m.x+=1.0E-4,f.cross(e,m).normalize());h.cross(m,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=m.x;this.n21=f.y;this.n22=h.y;this.n23=m.y;this.n31=f.z;this.n32=h.z;this.n33=m.z;return this},multiplyVector3:function(b){var c=b.x,e=b.y,f=b.z,h=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)*h;
|
|
|
b.y=(this.n21*c+this.n22*e+this.n23*f+this.n24)*h;b.z=(this.n31*c+this.n32*e+this.n33*f+this.n34)*h;return b},multiplyVector4:function(b){var c=b.x,e=b.y,f=b.z,h=b.w;b.x=this.n11*c+this.n12*e+this.n13*f+this.n14*h;b.y=this.n21*c+this.n22*e+this.n23*f+this.n24*h;b.z=this.n31*c+this.n32*e+this.n33*f+this.n34*h;b.w=this.n41*c+this.n42*e+this.n43*f+this.n44*h;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,h=b.n13,m=b.n14,k=b.n21,n=b.n22,u=b.n23,v=b.n24,w=b.n31,p=b.n32,x=b.n33,t=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44,E=c.n11,G=c.n12,
|
|
|
-H=c.n13,N=c.n14,S=c.n21,J=c.n22,I=c.n23,K=c.n24,W=c.n31,D=c.n32,M=c.n33,U=c.n34,V=c.n41,R=c.n42,o=c.n43,pa=c.n44;this.n11=e*E+f*S+h*W+m*V;this.n12=e*G+f*J+h*D+m*R;this.n13=e*H+f*I+h*M+m*o;this.n14=e*N+f*K+h*U+m*pa;this.n21=k*E+n*S+u*W+v*V;this.n22=k*G+n*J+u*D+v*R;this.n23=k*H+n*I+u*M+v*o;this.n24=k*N+n*K+u*U+v*pa;this.n31=w*E+p*S+x*W+t*V;this.n32=w*G+p*J+x*D+t*R;this.n33=w*H+p*I+x*M+t*o;this.n34=w*N+p*K+x*U+t*pa;this.n41=y*E+z*S+A*W+C*V;this.n42=y*G+z*J+A*D+C*R;this.n43=y*H+z*I+A*M+C*o;this.n44=y*
|
|
|
+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,h=b.n13,m=b.n14,k=b.n21,n=b.n22,u=b.n23,v=b.n24,w=b.n31,t=b.n32,x=b.n33,p=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44,E=c.n11,G=c.n12,
|
|
|
+H=c.n13,N=c.n14,S=c.n21,J=c.n22,I=c.n23,K=c.n24,W=c.n31,D=c.n32,M=c.n33,U=c.n34,V=c.n41,R=c.n42,o=c.n43,pa=c.n44;this.n11=e*E+f*S+h*W+m*V;this.n12=e*G+f*J+h*D+m*R;this.n13=e*H+f*I+h*M+m*o;this.n14=e*N+f*K+h*U+m*pa;this.n21=k*E+n*S+u*W+v*V;this.n22=k*G+n*J+u*D+v*R;this.n23=k*H+n*I+u*M+v*o;this.n24=k*N+n*K+u*U+v*pa;this.n31=w*E+t*S+x*W+p*V;this.n32=w*G+t*J+x*D+p*R;this.n33=w*H+t*I+x*M+p*o;this.n34=w*N+t*K+x*U+p*pa;this.n41=y*E+z*S+A*W+C*V;this.n42=y*G+z*J+A*D+C*R;this.n43=y*H+z*I+A*M+C*o;this.n44=y*
|
|
|
N+z*K+A*U+C*pa;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,h=this.n21,m=this.n22,k=this.n23,n=this.n24,u=this.n31,v=this.n32,w=this.n33,p=this.n34,x=this.n41,t=this.n42,y=this.n43,z=this.n44;return f*k*v*x-e*n*v*x-f*m*w*x+c*n*w*x+e*m*p*x-c*k*p*x-f*k*u*t+e*n*u*t+f*h*w*t-b*n*w*t-e*h*p*t+b*k*p*t+f*m*u*y-c*n*u*y-f*h*v*y+b*n*v*y+c*h*p*y-b*m*p*y-e*m*u*z+c*k*u*z+e*h*v*z-b*k*v*z-c*h*
|
|
|
+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,h=this.n21,m=this.n22,k=this.n23,n=this.n24,u=this.n31,v=this.n32,w=this.n33,t=this.n34,x=this.n41,p=this.n42,y=this.n43,z=this.n44;return f*k*v*x-e*n*v*x-f*m*w*x+c*n*w*x+e*m*t*x-c*k*t*x-f*k*u*p+e*n*u*p+f*h*w*p-b*n*w*p-e*h*t*p+b*k*t*p+f*m*u*y-c*n*u*y-f*h*v*y+b*n*v*y+c*h*t*y-b*m*t*y-e*m*u*z+c*k*u*z+e*h*v*z-b*k*v*z-c*h*
|
|
|
w*z+b*m*w*z},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),h=1-e,m=b.x,k=b.y,n=b.z,u=h*m,v=h*k;this.set(u*m+e,u*k-f*n,u*n+f*k,0,u*k+f*n,v*k+e,v*n-f*m,0,u*n-f*k,v*n+f*m,h*n*n+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,h=b.z,m=Math.cos(e),e=Math.sin(e),k=Math.cos(f),f=Math.sin(f),n=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var u=
|
|
|
-k*n,v=k*h,w=f*n,p=f*h;this.n11=u+p*e;this.n12=w*e-v;this.n13=m*f;this.n21=m*h;this.n22=m*n;this.n23=-e;this.n31=v*e-w;this.n32=p+u*e;this.n33=m*k;break;case "ZXY":u=k*n;v=k*h;w=f*n;p=f*h;this.n11=u-p*e;this.n12=-m*h;this.n13=w+v*e;this.n21=v+w*e;this.n22=m*n;this.n23=p-u*e;this.n31=-m*f;this.n32=e;this.n33=m*k;break;case "ZYX":u=m*n;v=m*h;w=e*n;p=e*h;this.n11=k*n;this.n12=w*f-v;this.n13=u*f+p;this.n21=k*h;this.n22=p*f+u;this.n23=v*f-w;this.n31=-f;this.n32=e*k;this.n33=m*k;break;case "YZX":u=m*k;v=
|
|
|
-m*f;w=e*k;p=e*f;this.n11=k*n;this.n12=p-u*h;this.n13=w*h+v;this.n21=h;this.n22=m*n;this.n23=-e*n;this.n31=-f*n;this.n32=v*h+w;this.n33=u-p*h;break;case "XZY":u=m*k;v=m*f;w=e*k;p=e*f;this.n11=k*n;this.n12=-h;this.n13=f*n;this.n21=u*h+p;this.n22=m*n;this.n23=v*h-w;this.n31=w*h-v;this.n32=e*n;this.n33=p*h+u;break;default:u=m*n,v=m*h,w=e*n,p=e*h,this.n11=k*n,this.n12=-k*h,this.n13=f,this.n21=v+w*f,this.n22=u-p*f,this.n23=-e*k,this.n31=p-u*f,this.n32=w+v*f,this.n33=m*k}return this},setRotationFromQuaternion:function(b){var c=
|
|
|
+k*n,v=k*h,w=f*n,t=f*h;this.n11=u+t*e;this.n12=w*e-v;this.n13=m*f;this.n21=m*h;this.n22=m*n;this.n23=-e;this.n31=v*e-w;this.n32=t+u*e;this.n33=m*k;break;case "ZXY":u=k*n;v=k*h;w=f*n;t=f*h;this.n11=u-t*e;this.n12=-m*h;this.n13=w+v*e;this.n21=v+w*e;this.n22=m*n;this.n23=t-u*e;this.n31=-m*f;this.n32=e;this.n33=m*k;break;case "ZYX":u=m*n;v=m*h;w=e*n;t=e*h;this.n11=k*n;this.n12=w*f-v;this.n13=u*f+t;this.n21=k*h;this.n22=t*f+u;this.n23=v*f-w;this.n31=-f;this.n32=e*k;this.n33=m*k;break;case "YZX":u=m*k;v=
|
|
|
+m*f;w=e*k;t=e*f;this.n11=k*n;this.n12=t-u*h;this.n13=w*h+v;this.n21=h;this.n22=m*n;this.n23=-e*n;this.n31=-f*n;this.n32=v*h+w;this.n33=u-t*h;break;case "XZY":u=m*k;v=m*f;w=e*k;t=e*f;this.n11=k*n;this.n12=-h;this.n13=f*n;this.n21=u*h+t;this.n22=m*n;this.n23=v*h-w;this.n31=w*h-v;this.n32=e*n;this.n33=t*h+u;break;default:u=m*n,v=m*h,w=e*n,t=e*h,this.n11=k*n,this.n12=-k*h,this.n13=f,this.n21=v+w*f,this.n22=u-t*f,this.n23=-e*k,this.n31=t-u*f,this.n32=w+v*f,this.n33=m*k}return this},setRotationFromQuaternion:function(b){var c=
|
|
|
b.x,e=b.y,f=b.z,h=b.w,m=c+c,k=e+e,n=f+f,b=c*m,u=c*k;c*=n;var v=e*k;e*=n;f*=n;m*=h;k*=h;h*=n;this.n11=1-(v+f);this.n12=u-h;this.n13=c+k;this.n21=u+h;this.n22=1-(b+f);this.n23=e-m;this.n31=c-k;this.n32=e+m;this.n33=1-(b+v);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},compose:function(b,c,e){var f=THREE.Matrix4.__m1,h=THREE.Matrix4.__m2;
|
|
|
f.identity();f.setRotationFromQuaternion(c);h.setScale(e.x,e.y,e.z);this.multiply(f,h);this.n14=b.x;this.n24=b.y;this.n34=b.z;return this},decompose:function(b,c,e){var f=THREE.Matrix4.__v1,h=THREE.Matrix4.__v2,m=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);m.set(this.n13,this.n23,this.n33);b=b instanceof THREE.Vector3?b:new THREE.Vector3;c=c instanceof THREE.Quaternion?c:new THREE.Quaternion;e=e instanceof THREE.Vector3?e:new THREE.Vector3;e.x=f.length();
|
|
|
e.y=h.length();e.z=m.length();b.x=this.n14;b.y=this.n24;b.z=this.n34;f=THREE.Matrix4.__m1;f.copy(this);f.n11/=e.x;f.n21/=e.x;f.n31/=e.x;f.n12/=e.y;f.n22/=e.y;f.n32/=e.y;f.n13/=e.z;f.n23/=e.z;f.n33/=e.z;c.setFromRotationMatrix(f);return[b,c,e]},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,h=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*h;this.n23=
|
|
|
b.n23*h;this.n33=b.n33*h}};
|
|
|
-THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,u=b.n23,v=b.n24,w=b.n31,p=b.n32,x=b.n33,t=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=u*t*z-v*x*z+v*p*A-n*t*A-u*p*C+n*x*C;c.n12=m*x*z-h*t*z-m*p*A+f*t*A+h*p*C-f*x*C;c.n13=h*v*z-m*u*z+m*n*A-f*v*A-h*n*C+f*u*C;c.n14=m*u*p-h*v*p-m*n*x+f*v*x+h*n*t-f*u*t;c.n21=v*x*y-u*t*y-v*w*A+k*t*A+u*w*C-k*x*C;c.n22=h*t*y-m*x*y+m*w*A-e*t*A-h*w*C+e*x*C;c.n23=m*u*y-h*v*y-m*k*A+e*v*A+h*k*C-e*u*C;c.n24=
|
|
|
-h*v*w-m*u*w+m*k*x-e*v*x-h*k*t+e*u*t;c.n31=n*t*y-v*p*y+v*w*z-k*t*z-n*w*C+k*p*C;c.n32=m*p*y-f*t*y-m*w*z+e*t*z+f*w*C-e*p*C;c.n33=h*v*y-m*n*y+m*k*z-e*v*z-f*k*C+e*n*C;c.n34=m*n*w-f*v*w-m*k*p+e*v*p+f*k*t-e*n*t;c.n41=u*p*y-n*x*y-u*w*z+k*x*z+n*w*A-k*p*A;c.n42=f*x*y-h*p*y+h*w*z-e*x*z-f*w*A+e*p*A;c.n43=h*n*y-f*u*y-h*k*z+e*u*z+f*k*A-e*n*A;c.n44=f*u*w-h*n*w+h*k*p-e*u*p-f*k*x+e*n*x;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,h=-b.n33*b.n21+b.n31*b.n23,m=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,u=-b.n32*b.n11+b.n31*b.n12,v=b.n23*b.n12-b.n22*b.n13,w=-b.n23*b.n11+b.n21*b.n13,p=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*v;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*m;e[3]=b*k;e[4]=b*n;e[5]=b*u;e[6]=b*v;e[7]=b*w;e[8]=b*p;return c};
|
|
|
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,m=b.n14,k=b.n21,n=b.n22,u=b.n23,v=b.n24,w=b.n31,t=b.n32,x=b.n33,p=b.n34,y=b.n41,z=b.n42,A=b.n43,C=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=u*p*z-v*x*z+v*t*A-n*p*A-u*t*C+n*x*C;c.n12=m*x*z-h*p*z-m*t*A+f*p*A+h*t*C-f*x*C;c.n13=h*v*z-m*u*z+m*n*A-f*v*A-h*n*C+f*u*C;c.n14=m*u*t-h*v*t-m*n*x+f*v*x+h*n*p-f*u*p;c.n21=v*x*y-u*p*y-v*w*A+k*p*A+u*w*C-k*x*C;c.n22=h*p*y-m*x*y+m*w*A-e*p*A-h*w*C+e*x*C;c.n23=m*u*y-h*v*y-m*k*A+e*v*A+h*k*C-e*u*C;c.n24=
|
|
|
+h*v*w-m*u*w+m*k*x-e*v*x-h*k*p+e*u*p;c.n31=n*p*y-v*t*y+v*w*z-k*p*z-n*w*C+k*t*C;c.n32=m*t*y-f*p*y-m*w*z+e*p*z+f*w*C-e*t*C;c.n33=h*v*y-m*n*y+m*k*z-e*v*z-f*k*C+e*n*C;c.n34=m*n*w-f*v*w-m*k*t+e*v*t+f*k*p-e*n*p;c.n41=u*t*y-n*x*y-u*w*z+k*x*z+n*w*A-k*t*A;c.n42=f*x*y-h*t*y+h*w*z-e*x*z-f*w*A+e*t*A;c.n43=h*n*y-f*u*y-h*k*z+e*u*z+f*k*A-e*n*A;c.n44=f*u*w-h*n*w+h*k*t-e*u*t-f*k*x+e*n*x;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,h=-b.n33*b.n21+b.n31*b.n23,m=b.n32*b.n21-b.n31*b.n22,k=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,u=-b.n32*b.n11+b.n31*b.n12,v=b.n23*b.n12-b.n22*b.n13,w=-b.n23*b.n11+b.n21*b.n13,t=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*k+b.n31*v;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*m;e[3]=b*k;e[4]=b*n;e[5]=b*u;e[6]=b*v;e[7]=b*w;e[8]=b*t;return c};
|
|
|
THREE.Matrix4.makeFrustum=function(b,c,e,f,h,m){var k;k=new THREE.Matrix4;k.n11=2*h/(c-b);k.n12=0;k.n13=(c+b)/(c-b);k.n14=0;k.n21=0;k.n22=2*h/(f-e);k.n23=(f+e)/(f-e);k.n24=0;k.n31=0;k.n32=0;k.n33=-(m+h)/(m-h);k.n34=-2*m*h/(m-h);k.n41=0;k.n42=0;k.n43=-1;k.n44=0;return k};THREE.Matrix4.makePerspective=function(b,c,e,f){var h,b=e*Math.tan(b*Math.PI/360);h=-b;return THREE.Matrix4.makeFrustum(h*c,b*c,h,b,e,f)};
|
|
|
THREE.Matrix4.makeOrtho=function(b,c,e,f,h,m){var k,n,u,v;k=new THREE.Matrix4;n=c-b;u=e-f;v=m-h;k.n11=2/n;k.n12=0;k.n13=0;k.n14=-((c+b)/n);k.n21=0;k.n22=2/u;k.n23=0;k.n24=-((e+f)/u);k.n31=0;k.n32=0;k.n33=-2/v;k.n34=-((m+h)/v);k.n41=0;k.n42=0;k.n43=0;k.n44=1;return k};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
THREE.Object3D=function(){this.id=THREE.Object3DCount++;this.name="";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=
|
|
@@ -52,22 +52,22 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi
|
|
|
-1){b.parent!==void 0&&b.parent.removeChild(b);b.parent=this;this.children.push(b);for(var c=this;c.parent!==void 0;)c=c.parent;c!==void 0&&c instanceof THREE.Scene&&c.addChildRecurse(b)}},remove:function(b){var c=this.children.indexOf(b);if(c!==-1)b.parent=void 0,this.children.splice(c,1)},getChildByName:function(b,c){var e,f,h;e=0;for(f=this.children.length;e<f;e++){h=this.children[e];if(h.name===b)return h;if(c&&(h=h.getChildByName(b,c),h!==void 0))return h}},updateMatrix:function(){this.matrix.setPosition(this.position);
|
|
|
this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation,this.eulerOrder);if(this.scale.x!==1||this.scale.y!==1||this.scale.z!==1)this.matrix.scale(this.scale),this.boundRadiusScale=Math.max(this.scale.x,Math.max(this.scale.y,this.scale.z));this.matrixWorldNeedsUpdate=!0},update:function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(this.matrixWorldNeedsUpdate||c)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),
|
|
|
this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale),this.matrixWorldNeedsUpdate=!1,c=!0;for(var b=0,f=this.children.length;b<f;b++)this.children[b].update(this.matrixWorld,c,e)},addChild:function(b){console.warn("DEPRECATED: Object3D.addChild() is now Object3D.add()");this.add(b)},removeChild:function(b){console.warn("DEPRECATED: Object3D.removeChild() is now Object3D.remove()");this.remove(b)}};THREE.Object3DCount=0;
|
|
|
-THREE.Projector=function(){function b(){var b=u[n]=u[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,m=[],k,n,u=[],v,w,p=[],x,t=[],y,z,A=[],C,E,G=[],H=[],N=[],S=new THREE.Vector4,J=new THREE.Vector4,
|
|
|
+THREE.Projector=function(){function b(){var b=u[n]=u[n]||new THREE.RenderableVertex;n++;return b}function c(b,e){return e.z-b.z}function e(b,e){var c=0,f=1,k=b.z+b.w,h=e.z+e.w,m=-b.z+b.w,n=-e.z+e.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?c=Math.max(c,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?c=Math.max(c,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<c?!1:(b.lerpSelf(e,c),e.lerpSelf(b,1-f),!0))}var f,h,m=[],k,n,u=[],v,w,t=[],x,p=[],y,z,A=[],C,E,G=[],H=[],N=[],S=new THREE.Vector4,J=new THREE.Vector4,
|
|
|
I=new THREE.Matrix4,K=new THREE.Matrix4,W=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],D=new THREE.Vector4,M=new THREE.Vector4;this.projectVector=function(b,e){I.multiply(e.projectionMatrix,e.matrixWorldInverse);I.multiplyVector3(b);return b};this.unprojectVector=function(b,e){I.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));I.multiplyVector3(b);return b};this.projectObjects=function(b,e,k){var o,n;h=H.length=0;
|
|
|
-o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var t;if(!(t=!n.visible))if(t=n instanceof THREE.Mesh)if(t=n.frustumCulled){a:{t=void 0;for(var p=n.matrixWorld,u=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),v=0;v<6;v++)if(t=W[v].x*p.n14+W[v].y*p.n24+W[v].z*p.n34+W[v].w,t<=u){t=!1;break a}t=!0}t=!t}if(!t)t=m[h]=m[h]||new THREE.RenderableObject,h++,f=t,S.copy(n.position),I.multiplyVector3(S),f.object=n,f.z=S.z,H.push(f)}k&&H.sort(c);return H};this.projectScene=
|
|
|
-function(f,h,m){var o=h.near,H=h.far,S,la,aa,na,ja,ka,da,Z,fa,Y,ma,ia,sa,O,ca,ua,ta;E=z=x=w=N.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);I.multiply(h.projectionMatrix,h.matrixWorldInverse);W[0].set(I.n41-I.n11,I.n42-I.n12,I.n43-I.n13,I.n44-I.n14);W[1].set(I.n41+I.n11,I.n42+I.n12,I.n43+I.n13,I.n44+I.n14);W[2].set(I.n41+I.n21,I.n42+I.n22,I.n43+I.n23,I.n44+I.n24);W[3].set(I.n41-I.n21,I.n42-I.n22,I.n43-I.n23,I.n44-I.n24);W[4].set(I.n41-I.n31,I.n42-I.n32,I.n43-I.n33,I.n44-I.n34);
|
|
|
-W[5].set(I.n41+I.n31,I.n42+I.n32,I.n43+I.n33,I.n44+I.n34);for(S=0;S<6;S++)fa=W[S],fa.divideScalar(Math.sqrt(fa.x*fa.x+fa.y*fa.y+fa.z*fa.z));fa=this.projectObjects(f,h,!0);f=0;for(S=fa.length;f<S;f++)if(Y=fa[f].object,Y.visible)if(ma=Y.matrixWorld,ia=Y.matrixRotationWorld,sa=Y.materials,O=Y.overdraw,n=0,Y instanceof THREE.Mesh){ca=Y.geometry;na=ca.vertices;ua=ca.faces;ca=ca.faceVertexUvs;la=0;for(aa=na.length;la<aa;la++)k=b(),k.positionWorld.copy(na[la].position),ma.multiplyVector3(k.positionWorld),
|
|
|
-k.positionScreen.copy(k.positionWorld),I.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>o&&k.positionScreen.z<H;na=0;for(la=ua.length;na<la;na++){aa=ua[na];if(aa instanceof THREE.Face3)if(ja=u[aa.a],ka=u[aa.b],da=u[aa.c],ja.visible&&ka.visible&&da.visible&&(Y.doubleSided||Y.flipSided!=(da.positionScreen.x-ja.positionScreen.x)*(ka.positionScreen.y-ja.positionScreen.y)-(da.positionScreen.y-ja.positionScreen.y)*
|
|
|
-(ka.positionScreen.x-ja.positionScreen.x)<0))Z=p[w]=p[w]||new THREE.RenderableFace3,w++,v=Z,v.v1.copy(ja),v.v2.copy(ka),v.v3.copy(da);else continue;else if(aa instanceof THREE.Face4)if(ja=u[aa.a],ka=u[aa.b],da=u[aa.c],Z=u[aa.d],ja.visible&&ka.visible&&da.visible&&Z.visible&&(Y.doubleSided||Y.flipSided!=((Z.positionScreen.x-ja.positionScreen.x)*(ka.positionScreen.y-ja.positionScreen.y)-(Z.positionScreen.y-ja.positionScreen.y)*(ka.positionScreen.x-ja.positionScreen.x)<0||(ka.positionScreen.x-da.positionScreen.x)*
|
|
|
-(Z.positionScreen.y-da.positionScreen.y)-(ka.positionScreen.y-da.positionScreen.y)*(Z.positionScreen.x-da.positionScreen.x)<0)))ta=t[x]=t[x]||new THREE.RenderableFace4,x++,v=ta,v.v1.copy(ja),v.v2.copy(ka),v.v3.copy(da),v.v4.copy(Z);else continue;v.normalWorld.copy(aa.normal);ia.multiplyVector3(v.normalWorld);v.centroidWorld.copy(aa.centroid);ma.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);I.multiplyVector3(v.centroidScreen);da=aa.vertexNormals;ja=0;for(ka=da.length;ja<ka;ja++)Z=
|
|
|
-v.vertexNormalsWorld[ja],Z.copy(da[ja]),ia.multiplyVector3(Z);ja=0;for(ka=ca.length;ja<ka;ja++)if(ta=ca[ja][na]){da=0;for(Z=ta.length;da<Z;da++)v.uvs[ja][da]=ta[da]}v.meshMaterials=sa;v.faceMaterials=aa.materials;v.overdraw=O;v.z=v.centroidScreen.z;N.push(v)}}else if(Y instanceof THREE.Line){K.multiply(I,ma);na=Y.geometry.vertices;ja=b();ja.positionScreen.copy(na[0].position);K.multiplyVector4(ja.positionScreen);la=1;for(aa=na.length;la<aa;la++)if(ja=b(),ja.positionScreen.copy(na[la].position),K.multiplyVector4(ja.positionScreen),
|
|
|
+o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var p;if(!(p=!n.visible))if(p=n instanceof THREE.Mesh)if(p=n.frustumCulled){a:{p=void 0;for(var t=n.matrixWorld,u=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),v=0;v<6;v++)if(p=W[v].x*t.n14+W[v].y*t.n24+W[v].z*t.n34+W[v].w,p<=u){p=!1;break a}p=!0}p=!p}if(!p)p=m[h]=m[h]||new THREE.RenderableObject,h++,f=p,S.copy(n.position),I.multiplyVector3(S),f.object=n,f.z=S.z,H.push(f)}k&&H.sort(c);return H};this.projectScene=
|
|
|
+function(f,h,m){var o=h.near,H=h.far,S,la,aa,na,ja,ka,ea,Z,ga,Y,ma,ia,sa,O,da,ua,ta;E=z=x=w=N.length=0;h.matrixAutoUpdate&&h.update(void 0,!0);f.update(void 0,!1,h);I.multiply(h.projectionMatrix,h.matrixWorldInverse);W[0].set(I.n41-I.n11,I.n42-I.n12,I.n43-I.n13,I.n44-I.n14);W[1].set(I.n41+I.n11,I.n42+I.n12,I.n43+I.n13,I.n44+I.n14);W[2].set(I.n41+I.n21,I.n42+I.n22,I.n43+I.n23,I.n44+I.n24);W[3].set(I.n41-I.n21,I.n42-I.n22,I.n43-I.n23,I.n44-I.n24);W[4].set(I.n41-I.n31,I.n42-I.n32,I.n43-I.n33,I.n44-I.n34);
|
|
|
+W[5].set(I.n41+I.n31,I.n42+I.n32,I.n43+I.n33,I.n44+I.n34);for(S=0;S<6;S++)ga=W[S],ga.divideScalar(Math.sqrt(ga.x*ga.x+ga.y*ga.y+ga.z*ga.z));ga=this.projectObjects(f,h,!0);f=0;for(S=ga.length;f<S;f++)if(Y=ga[f].object,Y.visible)if(ma=Y.matrixWorld,ia=Y.matrixRotationWorld,sa=Y.materials,O=Y.overdraw,n=0,Y instanceof THREE.Mesh){da=Y.geometry;na=da.vertices;ua=da.faces;da=da.faceVertexUvs;la=0;for(aa=na.length;la<aa;la++)k=b(),k.positionWorld.copy(na[la].position),ma.multiplyVector3(k.positionWorld),
|
|
|
+k.positionScreen.copy(k.positionWorld),I.multiplyVector4(k.positionScreen),k.positionScreen.x/=k.positionScreen.w,k.positionScreen.y/=k.positionScreen.w,k.visible=k.positionScreen.z>o&&k.positionScreen.z<H;na=0;for(la=ua.length;na<la;na++){aa=ua[na];if(aa instanceof THREE.Face3)if(ja=u[aa.a],ka=u[aa.b],ea=u[aa.c],ja.visible&&ka.visible&&ea.visible&&(Y.doubleSided||Y.flipSided!=(ea.positionScreen.x-ja.positionScreen.x)*(ka.positionScreen.y-ja.positionScreen.y)-(ea.positionScreen.y-ja.positionScreen.y)*
|
|
|
+(ka.positionScreen.x-ja.positionScreen.x)<0))Z=t[w]=t[w]||new THREE.RenderableFace3,w++,v=Z,v.v1.copy(ja),v.v2.copy(ka),v.v3.copy(ea);else continue;else if(aa instanceof THREE.Face4)if(ja=u[aa.a],ka=u[aa.b],ea=u[aa.c],Z=u[aa.d],ja.visible&&ka.visible&&ea.visible&&Z.visible&&(Y.doubleSided||Y.flipSided!=((Z.positionScreen.x-ja.positionScreen.x)*(ka.positionScreen.y-ja.positionScreen.y)-(Z.positionScreen.y-ja.positionScreen.y)*(ka.positionScreen.x-ja.positionScreen.x)<0||(ka.positionScreen.x-ea.positionScreen.x)*
|
|
|
+(Z.positionScreen.y-ea.positionScreen.y)-(ka.positionScreen.y-ea.positionScreen.y)*(Z.positionScreen.x-ea.positionScreen.x)<0)))ta=p[x]=p[x]||new THREE.RenderableFace4,x++,v=ta,v.v1.copy(ja),v.v2.copy(ka),v.v3.copy(ea),v.v4.copy(Z);else continue;v.normalWorld.copy(aa.normal);ia.multiplyVector3(v.normalWorld);v.centroidWorld.copy(aa.centroid);ma.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);I.multiplyVector3(v.centroidScreen);ea=aa.vertexNormals;ja=0;for(ka=ea.length;ja<ka;ja++)Z=
|
|
|
+v.vertexNormalsWorld[ja],Z.copy(ea[ja]),ia.multiplyVector3(Z);ja=0;for(ka=da.length;ja<ka;ja++)if(ta=da[ja][na]){ea=0;for(Z=ta.length;ea<Z;ea++)v.uvs[ja][ea]=ta[ea]}v.meshMaterials=sa;v.faceMaterials=aa.materials;v.overdraw=O;v.z=v.centroidScreen.z;N.push(v)}}else if(Y instanceof THREE.Line){K.multiply(I,ma);na=Y.geometry.vertices;ja=b();ja.positionScreen.copy(na[0].position);K.multiplyVector4(ja.positionScreen);la=1;for(aa=na.length;la<aa;la++)if(ja=b(),ja.positionScreen.copy(na[la].position),K.multiplyVector4(ja.positionScreen),
|
|
|
ka=u[n-2],D.copy(ja.positionScreen),M.copy(ka.positionScreen),e(D,M))D.multiplyScalar(1/D.w),M.multiplyScalar(1/M.w),ma=A[z]=A[z]||new THREE.RenderableLine,z++,y=ma,y.v1.positionScreen.copy(D),y.v2.positionScreen.copy(M),y.z=Math.max(D.z,M.z),y.materials=Y.materials,N.push(y)}else if(Y instanceof THREE.Particle&&(J.set(Y.matrixWorld.n14,Y.matrixWorld.n24,Y.matrixWorld.n34,1),I.multiplyVector4(J),J.z/=J.w,J.z>0&&J.z<1))ma=G[E]=G[E]||new THREE.RenderableParticle,E++,C=ma,C.x=J.x/J.w,C.y=J.y/J.w,C.z=
|
|
|
J.z,C.rotation=Y.rotation.z,C.scale.x=Y.scale.x*Math.abs(C.x-(J.x+h.projectionMatrix.n11)/(J.w+h.projectionMatrix.n14)),C.scale.y=Y.scale.y*Math.abs(C.y-(J.y+h.projectionMatrix.n22)/(J.w+h.projectionMatrix.n24)),C.materials=Y.materials,N.push(C);m&&N.sort(c);return N}};THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
|
|
|
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,h=b.z*c,b=Math.cos(f),f=Math.sin(f),c=Math.cos(-h),h=Math.sin(-h),m=Math.cos(e),e=Math.sin(e),k=b*c,n=f*h;this.w=k*m-n*e;this.x=k*e+n*m;this.y=f*c*m+b*h*e;this.z=b*h*m-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},setFromRotationMatrix:function(b){var c=Math.pow(b.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+b.n11+b.n22+b.n33))/2;this.x=Math.sqrt(Math.max(0,c+b.n11-b.n22-b.n33))/2;this.y=Math.sqrt(Math.max(0,c-b.n11+b.n22-b.n33))/2;this.z=Math.sqrt(Math.max(0,c-b.n11-b.n22+b.n33))/2;this.x=b.n32-b.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=b.n13-b.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=b.n21-b.n12<0?-Math.abs(this.z):Math.abs(this.z);
|
|
|
this.normalize();return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var 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,h=this.w,m=b.x,k=b.y,n=b.z,b=b.w;this.x=c*b+h*m+e*n-f*k;this.y=e*b+h*k+f*m-c*n;this.z=f*b+h*n+c*k-e*m;this.w=h*b-c*m-e*k-f*n;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,h=b.z,m=this.x,k=this.y,n=this.z,u=this.w,v=u*e+k*h-n*f,w=u*f+n*e-m*h,p=u*h+m*f-k*e,e=-m*
|
|
|
-e-k*f-n*h;c.x=v*u+e*-m+w*-n-p*-k;c.y=w*u+e*-k+p*-m-v*-n;c.z=p*u+e*-n+v*-k-w*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<0.001)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;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};
|
|
|
+this.x,e=this.y,f=this.z,h=this.w,m=b.x,k=b.y,n=b.z,b=b.w;this.x=c*b+h*m+e*n-f*k;this.y=e*b+h*k+f*m-c*n;this.z=f*b+h*n+c*k-e*m;this.w=h*b-c*m-e*k-f*n;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,h=b.z,m=this.x,k=this.y,n=this.z,u=this.w,v=u*e+k*h-n*f,w=u*f+n*e-m*h,t=u*h+m*f-k*e,e=-m*
|
|
|
+e-k*f-n*h;c.x=v*u+e*-m+w*-n-t*-k;c.y=w*u+e*-k+t*-m-v*-n;c.z=t*u+e*-n+v*-k-w*-m;return c}};THREE.Quaternion.slerp=function(b,c,e,f){var h=b.w*c.w+b.x*c.x+b.y*c.y+b.z*c.z;if(Math.abs(h)>=1)return e.w=b.w,e.x=b.x,e.y=b.y,e.z=b.z,e;var m=Math.acos(h),k=Math.sqrt(1-h*h);if(Math.abs(k)<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;h=Math.sin((1-f)*m)/k;f=Math.sin(f*m)/k;e.w=b.w*h+c.w*f;e.x=b.x*h+c.x*f;e.y=b.y*h+c.y*f;e.z=b.z*h+c.z*f;return e};
|
|
|
THREE.Vertex=function(b){this.position=b||new THREE.Vector3};THREE.Face3=function(b,c,e,f,h,m){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=h instanceof THREE.Color?h:new THREE.Color;this.vertexColors=h instanceof Array?h:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(b,c,e,f,h,m,k){this.a=b;this.b=c;this.c=e;this.d=f;this.normal=h instanceof THREE.Vector3?h:new THREE.Vector3;this.vertexNormals=h instanceof Array?h:[];this.color=m instanceof THREE.Color?m:new THREE.Color;this.vertexColors=m instanceof Array?m:[];this.vertexTangents=[];this.materials=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};THREE.UV=function(b,c){this.u=b||0;this.v=c||0};
|
|
|
THREE.UV.prototype={constructor:THREE.UV,set:function(b,c){this.u=b;this.v=c;return this},copy:function(b){this.u=b.u;this.v=b.v;return this},clone:function(){return new THREE.UV(this.u,this.v)}};
|
|
@@ -77,17 +77,17 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid
|
|
|
e,f,h,m,k,n=new THREE.Vector3,u=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){m=this.faces[f];if(b&&m.vertexNormals.length){n.set(0,0,0);c=0;for(e=m.vertexNormals.length;c<e;c++)n.addSelf(m.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[m.a],e=this.vertices[m.b],k=this.vertices[m.c],n.sub(k.position,e.position),u.sub(c.position,e.position),n.crossSelf(u);n.isZero()||n.normalize();m.normal.copy(n)}},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,e,c,f,h,m,o){n=b.vertices[e].position;u=b.vertices[c].position;v=b.vertices[f].position;w=k[h];p=k[m];x=k[o];t=u.x-n.x;y=v.x-n.x;z=u.y-n.y;A=v.y-n.y;C=u.z-n.z;E=v.z-n.z;G=p.u-w.u;H=x.u-w.u;N=p.v-w.v;S=x.v-w.v;J=1/(G*S-H*N);D.set((S*t-N*y)*J,(S*z-N*A)*J,(S*C-N*E)*J);M.set((G*y-H*t)*J,(G*A-H*z)*J,(G*E-H*C)*J);K[e].addSelf(D);K[c].addSelf(D);K[f].addSelf(D);W[e].addSelf(M);
|
|
|
-W[c].addSelf(M);W[f].addSelf(M)}var c,e,f,h,m,k,n,u,v,w,p,x,t,y,z,A,C,E,G,H,N,S,J,I,K=[],W=[],D=new THREE.Vector3,M=new THREE.Vector3,U=new THREE.Vector3,V=new THREE.Vector3,R=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)K[c]=new THREE.Vector3,W[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)m=this.faces[c],k=this.faceVertexUvs[0][c],m instanceof THREE.Face3?b(this,m.a,m.b,m.c,0,1,2):m instanceof THREE.Face4&&(b(this,m.a,m.b,m.c,0,1,2),b(this,m.a,m.b,m.d,0,1,3));var o=["a","b",
|
|
|
+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,e,c,f,h,m,o){n=b.vertices[e].position;u=b.vertices[c].position;v=b.vertices[f].position;w=k[h];t=k[m];x=k[o];p=u.x-n.x;y=v.x-n.x;z=u.y-n.y;A=v.y-n.y;C=u.z-n.z;E=v.z-n.z;G=t.u-w.u;H=x.u-w.u;N=t.v-w.v;S=x.v-w.v;J=1/(G*S-H*N);D.set((S*p-N*y)*J,(S*z-N*A)*J,(S*C-N*E)*J);M.set((G*y-H*p)*J,(G*A-H*z)*J,(G*E-H*C)*J);K[e].addSelf(D);K[c].addSelf(D);K[f].addSelf(D);W[e].addSelf(M);
|
|
|
+W[c].addSelf(M);W[f].addSelf(M)}var c,e,f,h,m,k,n,u,v,w,t,x,p,y,z,A,C,E,G,H,N,S,J,I,K=[],W=[],D=new THREE.Vector3,M=new THREE.Vector3,U=new THREE.Vector3,V=new THREE.Vector3,R=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)K[c]=new THREE.Vector3,W[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)m=this.faces[c],k=this.faceVertexUvs[0][c],m instanceof THREE.Face3?b(this,m.a,m.b,m.c,0,1,2):m instanceof THREE.Face4&&(b(this,m.a,m.b,m.c,0,1,2),b(this,m.a,m.b,m.d,0,1,3));var o=["a","b",
|
|
|
"c","d"];c=0;for(e=this.faces.length;c<e;c++){m=this.faces[c];for(f=0;f<m.vertexNormals.length;f++)R.copy(m.vertexNormals[f]),h=m[o[f]],I=K[h],U.copy(I),U.subSelf(R.multiplyScalar(R.dot(I))).normalize(),V.cross(m.vertexNormals[f],I),h=V.dot(W[h]),h=h<0?-1:1,m.vertexTangents[f]=new THREE.Vector4(U.x,U.y,U.z,h)}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,e){return Math.min(b,e)+"_"+Math.max(b,e)}function c(b,e,c){b[e]===void 0?(b[e]={set:{},array:[]},b[e].set[c]=1,b[e].array.push(c)):b[e].set[c]===void 0&&(b[e].set[c]=1,b[e].array.push(c))}var e,f,h,m,k,n=
|
|
|
{};e=0;for(f=this.faces.length;e<f;e++)k=this.faces[e],k instanceof THREE.Face3?(h=b(k.a,k.b),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.a,k.c),c(n,h,e)):k instanceof THREE.Face4&&(h=b(k.b,k.d),c(n,h,e),h=b(k.a,k.b),c(n,h,e),h=b(k.a,k.d),c(n,h,e),h=b(k.b,k.c),c(n,h,e),h=b(k.c,k.d),c(n,h,e));e=0;for(f=this.edges.length;e<f;e++){k=this.edges[e];h=k.vertexIndices[0];m=k.vertexIndices[1];k.faceIndices=n[b(h,m)].array;for(h=0;h<k.faceIndices.length;h++)m=k.faceIndices[h],k.faces.push(this.faces[m])}}};
|
|
|
THREE.GeometryCount=0;
|
|
|
-THREE.Spline=function(b){function c(b,e,c,f,k,h,m){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*m+(-3*(e-c)-2*b-f)*h+b*k+e}this.points=b;var e=[],f={x:0,y:0,z:0},h,m,k,n,u,v,w,p,x;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;m=Math.floor(h);k=h-m;e[0]=m==0?m:m-1;e[1]=m;e[2]=m>this.points.length-2?m:m+1;e[3]=m>this.points.length-3?m:m+2;v=this.points[e[0]];w=this.points[e[1]];
|
|
|
-p=this.points[e[2]];x=this.points[e[3]];n=k*k;u=k*n;f.x=c(v.x,w.x,p.x,x.x,k,n,u);f.y=c(v.y,w.y,p.y,x.y,k,n,u);f.z=c(v.z,w.z,p.z,x.z,k,n,u);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,k=new THREE.Vector3,h=new THREE.Vector3,m=[],n=0;m[0]=0;b||(b=100);c=this.points.length*b;k.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),h.copy(position),
|
|
|
-n+=h.distanceTo(k),k.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(m[e]=n,f=e);m[m.length]=n;return{chunks:m,total:n}};this.reparametrizeByArcLength=function(b){var e,c,f,k,h,m,n=[],p=new THREE.Vector3,v=this.getLength();n.push(p.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=v.chunks[e]-v.chunks[e-1];m=Math.ceil(b*c/v.total);k=(e-1)/(this.points.length-1);h=e/(this.points.length-1);for(c=1;c<m-1;c++)f=k+c*(1/m)*(h-k),position=this.getPoint(f),n.push(p.copy(position).clone());
|
|
|
-n.push(p.copy(this.points[e]).clone())}this.points=n}};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,h){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=h||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,e,c,f,k,h,m){b=(c-b)*0.5;f=(f-e)*0.5;return(2*(e-c)+b+f)*m+(-3*(e-c)-2*b-f)*h+b*k+e}this.points=b;var e=[],f={x:0,y:0,z:0},h,m,k,n,u,v,w,t,x;this.initFromArray=function(b){this.points=[];for(var e=0;e<b.length;e++)this.points[e]={x:b[e][0],y:b[e][1],z:b[e][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;m=Math.floor(h);k=h-m;e[0]=m==0?m:m-1;e[1]=m;e[2]=m>this.points.length-2?m:m+1;e[3]=m>this.points.length-3?m:m+2;v=this.points[e[0]];w=this.points[e[1]];
|
|
|
+t=this.points[e[2]];x=this.points[e[3]];n=k*k;u=k*n;f.x=c(v.x,w.x,t.x,x.x,k,n,u);f.y=c(v.y,w.y,t.y,x.y,k,n,u);f.z=c(v.z,w.z,t.z,x.z,k,n,u);return f};this.getControlPointsArray=function(){var b,e,c=this.points.length,f=[];for(b=0;b<c;b++)e=this.points[b],f[b]=[e.x,e.y,e.z];return f};this.getLength=function(b){var e,c,f=e=e=0,k=new THREE.Vector3,h=new THREE.Vector3,m=[],n=0;m[0]=0;b||(b=100);c=this.points.length*b;k.copy(this.points[0]);for(b=1;b<c;b++)e=b/c,position=this.getPoint(e),h.copy(position),
|
|
|
+n+=h.distanceTo(k),k.copy(position),e*=this.points.length-1,e=Math.floor(e),e!=f&&(m[e]=n,f=e);m[m.length]=n;return{chunks:m,total:n}};this.reparametrizeByArcLength=function(b){var e,c,f,k,h,m,n=[],t=new THREE.Vector3,v=this.getLength();n.push(t.copy(this.points[0]).clone());for(e=1;e<this.points.length;e++){c=v.chunks[e]-v.chunks[e-1];m=Math.ceil(b*c/v.total);k=(e-1)/(this.points.length-1);h=e/(this.points.length-1);for(c=1;c<m-1;c++)f=k+c*(1/m)*(h-k),position=this.getPoint(f),n.push(t.copy(position).clone());
|
|
|
+n.push(t.copy(this.points[e]).clone())}this.points=n}};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,h){THREE.Object3D.call(this);this.fov=b||50;this.aspect=c||1;this.near=e||0.1;this.far=f||2E3;this.target=h||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,h,m){this.fullWidth=b;this.fullHeight=c;this.x=e;this.y=f;this.width=h;this.height=m;this.updateProjectionMatrix()};
|
|
@@ -144,47 +144,47 @@ THREE.Scene.prototype.addChildRecurse=function(b){if(b instanceof THREE.Light)th
|
|
|
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.addChild=function(b){console.warn("DEPRECATED: Scene.addChild() is now Scene.add()");this.add(b)};
|
|
|
THREE.Scene.prototype.addObject=function(b){console.warn("DEPRECATED: Scene.addObject() is now Scene.add()");this.add(b)};THREE.Scene.prototype.addLight=function(b){console.warn("DEPRECATED: Scene.addLight() is now Scene.add()");this.add(b)};THREE.Scene.prototype.removeChild=function(b){console.warn("DEPRECATED: Scene.removeChild() is now Scene.remove()");this.remove(b)};THREE.Scene.prototype.removeObject=function(b){console.warn("DEPRECATED: Scene.removeObject() is now Scene.remove()");this.remove(b)};
|
|
|
THREE.Scene.prototype.removeLight=function(b){console.warn("DEPRECATED: Scene.removeLight() is now Scene.remove()");this.remove(b)};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.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,m;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;m=f/2};this.render=function(e,f){var u,v,w,p,x,t,y,z;b=c.projectScene(e,f);u=0;for(v=b.length;u<v;u++)if(x=b[u],x instanceof THREE.RenderableParticle){y=x.x*h+h;z=x.y*m+m;w=0;for(p=x.material.length;w<p;w++)if(t=x.material[w],t instanceof THREE.ParticleDOMMaterial)t=t.domElement,t.style.left=y+"px",t.style.top=z+"px"}}};
|
|
|
-THREE.CanvasRenderer=function(b){function c(b){if(A!=b)t.globalAlpha=A=b}function e(b){if(C!=b){switch(b){case THREE.NormalBlending:t.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:t.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:t.globalCompositeOperation="darker"}C=b}}function f(b){if(E!=b)t.strokeStyle=E=b}function h(b){if(G!=b)t.fillStyle=G=b}var m=this,k=null,n=new THREE.Projector,b=b||{},u=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
-v,w,p,x,t=u.getContext("2d"),y=new THREE.Color(0),z=0,A=1,C=0,E=null,G=null,H=null,N=null,S=null,J,I,K,W,D=new THREE.RenderableVertex,M=new THREE.RenderableVertex,U,V,R,o,pa,T,la,aa,na,ja,ka,da,Z=new THREE.Color(0),fa=new THREE.Color(0),Y=new THREE.Color(0),ma=new THREE.Color(0),ia=new THREE.Color(0),sa=[],O,ca,ua,ta,ra,wa,Ca,za,Aa,Ea,L=new THREE.Rectangle,P=new THREE.Rectangle,ea=new THREE.Rectangle,$=!1,ha=new THREE.Color,qa=new THREE.Color,ya=new THREE.Color,xa=new THREE.Color,oa=new THREE.Vector3,
|
|
|
-Fa,X,Ba,ga,Va,Wa,b=16;Fa=document.createElement("canvas");Fa.width=Fa.height=2;X=Fa.getContext("2d");X.fillStyle="rgba(0,0,0,1)";X.fillRect(0,0,2,2);Ba=X.getImageData(0,0,2,2);ga=Ba.data;Va=document.createElement("canvas");Va.width=Va.height=b;Wa=Va.getContext("2d");Wa.translate(-b/2,-b/2);Wa.scale(b,b);b--;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,e){v=b;w=e;p=Math.floor(v/2);x=Math.floor(w/2);u.width=v;u.height=
|
|
|
-w;L.set(-p,-x,p,x);P.set(-p,-x,p,x);A=1;C=0;S=N=H=G=E=null};this.setClearColor=function(b,e){y.copy(b);z=e;P.set(-p,-x,p,x)};this.setClearColorHex=function(b,e){y.setHex(b);z=e;P.set(-p,-x,p,x)};this.clear=function(){t.setTransform(1,0,0,-1,p,x);P.isEmpty()||(P.minSelf(L),P.inflate(2),z<1&&t.clearRect(Math.floor(P.getX()),Math.floor(P.getY()),Math.floor(P.getWidth()),Math.floor(P.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
|
|
|
-255)+","+z+")"),t.fillRect(Math.floor(P.getX()),Math.floor(P.getY()),Math.floor(P.getWidth()),Math.floor(P.getHeight()))),P.empty())};this.render=function(b,v){function u(b){var e,c,f,k=b.lights;qa.setRGB(0,0,0);ya.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b<e;b++)c=k[b],f=c.color,c instanceof THREE.AmbientLight?(qa.r+=f.r,qa.g+=f.g,qa.b+=f.b):c instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):c instanceof THREE.PointLight&&(xa.r+=f.r,xa.g+=f.g,xa.b+=f.b)}function w(b,e,c,
|
|
|
-f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(o=c.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=c.dot(oa.sub(h.position,e).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function y(b,k,m){c(m.opacity);e(m.blending);var o,n,v,ga,u,w;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)ga=
|
|
|
-m.map.image,u=ga.width>>1,w=ga.height>>1,m=k.scale.x*p,v=k.scale.y*x,o=m*u,n=v*w,ea.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ea)&&(t.save(),t.translate(b.x,b.y),t.rotate(-k.rotation),t.scale(m,-v),t.translate(-u,-w),t.drawImage(ga,0,0),t.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*p,n=k.scale.y*x,ea.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(ea)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),t.save(),t.translate(b.x,b.y),t.rotate(-k.rotation),t.scale(o,n),
|
|
|
-m.program(t),t.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);t.beginPath();t.moveTo(b.positionScreen.x,b.positionScreen.y);t.lineTo(k.positionScreen.x,k.positionScreen.y);t.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)t.lineWidth=H=b;b=m.linecap;if(N!=b)t.lineCap=N=b;b=m.linejoin;if(S!=b)t.lineJoin=S=b;f(m.color.getContextStyle());t.stroke();ea.inflate(m.linewidth*2)}}function A(b,f,k,h,n,p,ga,t,u){m.data.vertices+=3;m.data.faces++;c(t.opacity);e(t.blending);
|
|
|
-U=b.positionScreen.x;V=b.positionScreen.y;R=f.positionScreen.x;o=f.positionScreen.y;pa=k.positionScreen.x;T=k.positionScreen.y;E(U,V,R,o,pa,T);if(t instanceof THREE.MeshBasicMaterial)if(t.map)t.map.mapping instanceof THREE.UVMapping&&(ta=ga.uvs[0],$a(U,V,R,o,pa,T,ta[h].u,ta[h].v,ta[n].u,ta[n].v,ta[p].u,ta[p].v,t.map));else if(t.envMap){if(t.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=v.matrixWorldInverse,oa.copy(ga.vertexNormalsWorld[0]),ra=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+
|
|
|
-0.5,wa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ga.vertexNormalsWorld[1]),Ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,za=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ga.vertexNormalsWorld[2]),Aa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ea=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,$a(U,V,R,o,pa,T,ra,wa,Ca,za,Aa,Ea,t.envMap)}else t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color);else if(t instanceof THREE.MeshLambertMaterial)t.map&&
|
|
|
-!t.wireframe&&(t.map.mapping instanceof THREE.UVMapping&&(ta=ga.uvs[0],$a(U,V,R,o,pa,T,ta[h].u,ta[h].v,ta[n].u,ta[n].v,ta[p].u,ta[p].v,t.map)),e(THREE.SubtractiveBlending)),$?!t.wireframe&&t.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==3?(fa.r=Y.r=ma.r=qa.r,fa.g=Y.g=ma.g=qa.g,fa.b=Y.b=ma.b=qa.b,w(u,ga.v1.positionWorld,ga.vertexNormalsWorld[0],fa),w(u,ga.v2.positionWorld,ga.vertexNormalsWorld[1],Y),w(u,ga.v3.positionWorld,ga.vertexNormalsWorld[2],ma),ia.r=(Y.r+ma.r)*0.5,ia.g=(Y.g+ma.g)*
|
|
|
-0.5,ia.b=(Y.b+ma.b)*0.5,ua=Xa(fa,Y,ma,ia),Sa(U,V,R,o,pa,T,0,0,1,0,0,1,ua)):(ha.r=qa.r,ha.g=qa.g,ha.b=qa.b,w(u,ga.centroidWorld,ga.normalWorld,ha),Z.r=Math.max(0,Math.min(t.color.r*ha.r,1)),Z.g=Math.max(0,Math.min(t.color.g*ha.g,1)),Z.b=Math.max(0,Math.min(t.color.b*ha.b,1)),t.wireframe?Ia(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(Z)):t.wireframe?Ia(t.color,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(t.color);else if(t instanceof THREE.MeshDepthMaterial)O=
|
|
|
-v.near,ca=v.far,fa.r=fa.g=fa.b=1-Na(b.positionScreen.z,O,ca),Y.r=Y.g=Y.b=1-Na(f.positionScreen.z,O,ca),ma.r=ma.g=ma.b=1-Na(k.positionScreen.z,O,ca),ia.r=(Y.r+ma.r)*0.5,ia.g=(Y.g+ma.g)*0.5,ia.b=(Y.b+ma.b)*0.5,ua=Xa(fa,Y,ma,ia),Sa(U,V,R,o,pa,T,0,0,1,0,0,1,ua);else if(t instanceof THREE.MeshNormalMaterial)Z.r=Ta(ga.normalWorld.x),Z.g=Ta(ga.normalWorld.y),Z.b=Ta(ga.normalWorld.z),t.wireframe?Ia(Z,t.wireframeLinewidth,t.wireframeLinecap,t.wireframeLinejoin):Ja(Z)}function C(b,f,k,h,n,t,ga,p,u){m.data.vertices+=
|
|
|
-4;m.data.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)A(b,f,h,0,1,3,ga,p,u),A(n,k,t,1,2,3,ga,p,u);else if(U=b.positionScreen.x,V=b.positionScreen.y,R=f.positionScreen.x,o=f.positionScreen.y,pa=k.positionScreen.x,T=k.positionScreen.y,la=h.positionScreen.x,aa=h.positionScreen.y,na=n.positionScreen.x,ja=n.positionScreen.y,ka=t.positionScreen.x,da=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)G(U,V,R,o,pa,T,la,aa),p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):
|
|
|
-Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)$?!p.wireframe&&p.shading==THREE.SmoothShading&&ga.vertexNormalsWorld.length==4?(fa.r=Y.r=ma.r=ia.r=qa.r,fa.g=Y.g=ma.g=ia.g=qa.g,fa.b=Y.b=ma.b=ia.b=qa.b,w(u,ga.v1.positionWorld,ga.vertexNormalsWorld[0],fa),w(u,ga.v2.positionWorld,ga.vertexNormalsWorld[1],Y),w(u,ga.v4.positionWorld,ga.vertexNormalsWorld[3],ma),w(u,ga.v3.positionWorld,ga.vertexNormalsWorld[2],ia),ua=Xa(fa,Y,ma,ia),E(U,V,R,o,la,aa),Sa(U,V,R,o,la,aa,0,0,1,0,0,1,ua),E(na,ja,pa,
|
|
|
-T,ka,da),Sa(na,ja,pa,T,ka,da,1,0,1,1,0,1,ua)):(ha.r=qa.r,ha.g=qa.g,ha.b=qa.b,w(u,ga.centroidWorld,ga.normalWorld,ha),Z.r=Math.max(0,Math.min(p.color.r*ha.r,1)),Z.g=Math.max(0,Math.min(p.color.g*ha.g,1)),Z.b=Math.max(0,Math.min(p.color.b*ha.b,1)),G(U,V,R,o,pa,T,la,aa),p.wireframe?Ia(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(Z)):(G(U,V,R,o,pa,T,la,aa),p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color));else if(p instanceof THREE.MeshNormalMaterial)Z.r=
|
|
|
-Ta(ga.normalWorld.x),Z.g=Ta(ga.normalWorld.y),Z.b=Ta(ga.normalWorld.z),G(U,V,R,o,pa,T,la,aa),p.wireframe?Ia(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(Z);else if(p instanceof THREE.MeshDepthMaterial)O=v.near,ca=v.far,fa.r=fa.g=fa.b=1-Na(b.positionScreen.z,O,ca),Y.r=Y.g=Y.b=1-Na(f.positionScreen.z,O,ca),ma.r=ma.g=ma.b=1-Na(h.positionScreen.z,O,ca),ia.r=ia.g=ia.b=1-Na(k.positionScreen.z,O,ca),ua=Xa(fa,Y,ma,ia),E(U,V,R,o,la,aa),Sa(U,V,R,o,la,aa,0,0,1,0,0,1,ua),E(na,ja,pa,T,ka,
|
|
|
-da),Sa(na,ja,pa,T,ka,da,1,0,1,1,0,1,ua)}function E(b,e,c,f,k,h){t.beginPath();t.moveTo(b,e);t.lineTo(c,f);t.lineTo(k,h);t.lineTo(b,e);t.closePath()}function G(b,e,c,f,k,h,m,o){t.beginPath();t.moveTo(b,e);t.lineTo(c,f);t.lineTo(k,h);t.lineTo(m,o);t.lineTo(b,e);t.closePath()}function Ia(b,e,c,k){if(H!=e)t.lineWidth=H=e;if(N!=c)t.lineCap=N=c;if(S!=k)t.lineJoin=S=k;f(b.getContextStyle());t.stroke();ea.inflate(e*2)}function Ja(b){h(b.getContextStyle());t.fill()}function $a(b,e,c,f,k,m,o,n,p,ga,v,u,w){if(w.image.width!=
|
|
|
-0){if(w.needsUpdate==!0||sa[w.id]==void 0){var x=w.wrapS==THREE.RepeatWrapping,Ma=w.wrapT==THREE.RepeatWrapping;sa[w.id]=t.createPattern(w.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");w.needsUpdate=!1}h(sa[w.id]);var x=w.offset.x/w.repeat.x,Ma=w.offset.y/w.repeat.y,L=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+x)*L,n=(n+Ma)*w,p=(p+x)*L,ga=(ga+Ma)*w,v=(v+x)*L,u=(u+Ma)*w;c-=b;f-=e;k-=b;m-=e;p-=o;ga-=n;v-=o;u-=n;x=1/(p*u-v*ga);w=(u*c-ga*k)*x;ga=(u*f-ga*
|
|
|
-m)*x;c=(p*k-v*c)*x;f=(p*m-v*f)*x;b=b-w*o-c*n;e=e-ga*o-f*n;t.save();t.transform(w,ga,c,f,b,e);t.fill();t.restore()}}function Sa(b,e,c,f,k,h,m,o,n,p,ga,v,u){var w,x;w=u.width-1;x=u.height-1;m*=w;o*=x;n*=w;p*=x;ga*=w;v*=x;c-=b;f-=e;k-=b;h-=e;n-=m;p-=o;ga-=m;v-=o;x=1/(n*v-ga*p);w=(v*c-p*k)*x;p=(v*f-p*h)*x;c=(n*k-ga*c)*x;f=(n*h-ga*f)*x;b=b-w*m-c*o;e=e-p*m-f*o;t.save();t.transform(w,p,c,f,b,e);t.clip();t.drawImage(u,0,0);t.restore()}function Xa(b,e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*
|
|
|
-255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),t=~~(f.r*255),v=~~(f.g*255),f=~~(f.b*255);ga[0]=k<0?0:k>255?255:k;ga[1]=h<0?0:h>255?255:h;ga[2]=b<0?0:b>255?255:b;ga[4]=m<0?0:m>255?255:m;ga[5]=o<0?0:o>255?255:o;ga[6]=e<0?0:e>255?255:e;ga[8]=n<0?0:n>255?255:n;ga[9]=p<0?0:p>255?255:p;ga[10]=c<0?0:c>255?255:c;ga[12]=t<0?0:t>255?255:t;ga[13]=v<0?0:v>255?255:v;ga[14]=f<0?0:f>255?255:f;X.putImageData(Ba,0,0);Wa.drawImage(Fa,0,0);return Va}function Na(b,e,c){b=(b-e)/(c-e);return b*
|
|
|
-b*(3-2*b)}function Ta(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y,k=c*c+f*f;k!=0&&(k=1/Math.sqrt(k),c*=k,f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ya,cb,va,Da,La,Ua,Za,F;this.autoClear?this.clear():t.setTransform(1,0,0,-1,p,x);m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,v,this.sortElements);($=b.lights.length>0)&&u(b);Ya=0;for(cb=k.length;Ya<cb;Ya++){va=k[Ya];ea.empty();if(va instanceof THREE.RenderableParticle){J=va;J.x*=p;J.y*=x;Da=0;for(La=va.materials.length;Da<
|
|
|
-La;)F=va.materials[Da++],F.opacity!=0&&y(J,va,F,b)}else if(va instanceof THREE.RenderableLine){if(J=va.v1,I=va.v2,J.positionScreen.x*=p,J.positionScreen.y*=x,I.positionScreen.x*=p,I.positionScreen.y*=x,ea.addPoint(J.positionScreen.x,J.positionScreen.y),ea.addPoint(I.positionScreen.x,I.positionScreen.y),L.intersects(ea)){Da=0;for(La=va.materials.length;Da<La;)F=va.materials[Da++],F.opacity!=0&&z(J,I,va,F,b)}}else if(va instanceof THREE.RenderableFace3){if(J=va.v1,I=va.v2,K=va.v3,J.positionScreen.x*=
|
|
|
-p,J.positionScreen.y*=x,I.positionScreen.x*=p,I.positionScreen.y*=x,K.positionScreen.x*=p,K.positionScreen.y*=x,va.overdraw&&(Ka(J.positionScreen,I.positionScreen),Ka(I.positionScreen,K.positionScreen),Ka(K.positionScreen,J.positionScreen)),ea.add3Points(J.positionScreen.x,J.positionScreen.y,I.positionScreen.x,I.positionScreen.y,K.positionScreen.x,K.positionScreen.y),L.intersects(ea)){Da=0;for(La=va.meshMaterials.length;Da<La;)if(F=va.meshMaterials[Da++],F instanceof THREE.MeshFaceMaterial){Ua=0;
|
|
|
-for(Za=va.faceMaterials.length;Ua<Za;)(F=va.faceMaterials[Ua++])&&F.opacity!=0&&A(J,I,K,0,1,2,va,F,b)}else F.opacity!=0&&A(J,I,K,0,1,2,va,F,b)}}else if(va instanceof THREE.RenderableFace4&&(J=va.v1,I=va.v2,K=va.v3,W=va.v4,J.positionScreen.x*=p,J.positionScreen.y*=x,I.positionScreen.x*=p,I.positionScreen.y*=x,K.positionScreen.x*=p,K.positionScreen.y*=x,W.positionScreen.x*=p,W.positionScreen.y*=x,D.positionScreen.copy(I.positionScreen),M.positionScreen.copy(W.positionScreen),va.overdraw&&(Ka(J.positionScreen,
|
|
|
-I.positionScreen),Ka(I.positionScreen,W.positionScreen),Ka(W.positionScreen,J.positionScreen),Ka(K.positionScreen,D.positionScreen),Ka(K.positionScreen,M.positionScreen)),ea.addPoint(J.positionScreen.x,J.positionScreen.y),ea.addPoint(I.positionScreen.x,I.positionScreen.y),ea.addPoint(K.positionScreen.x,K.positionScreen.y),ea.addPoint(W.positionScreen.x,W.positionScreen.y),L.intersects(ea))){Da=0;for(La=va.meshMaterials.length;Da<La;)if(F=va.meshMaterials[Da++],F instanceof THREE.MeshFaceMaterial){Ua=
|
|
|
-0;for(Za=va.faceMaterials.length;Ua<Za;)(F=va.faceMaterials[Ua++])&&F.opacity!=0&&C(J,I,K,W,D,M,va,F,b)}else F.opacity!=0&&C(J,I,K,W,D,M,va,F,b)}P.addRectangle(ea)}t.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function b(b,e,c){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=e.normalWorld.dot(h.position)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(W.sub(h.position,e.centroidWorld),W.normalize(),m=e.normalWorld.dot(W)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,p){m.data.vertices+=3;m.data.faces++;U=f(V++);U.setAttribute("d",
|
|
|
-"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(N.r=S.r,N.g=S.g,N.b=S.b,b(p,o,N),H.r=Math.max(0,Math.min(n.color.r*N.r,1)),H.g=Math.max(0,Math.min(n.color.g*N.g,1)),H.b=Math.max(0,Math.min(n.color.b*N.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-o.z*n.__farMinusNear),
|
|
|
-H.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?U.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):U.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);u.appendChild(U)}function e(e,c,k,o,n,p,t){m.data.vertices+=4;m.data.faces++;
|
|
|
-U=f(V++);U.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?H.copy(p.color):p instanceof THREE.MeshLambertMaterial?G?(N.r=S.r,N.g=S.g,N.b=S.b,b(t,n,N),H.r=Math.max(0,Math.min(p.color.r*N.r,1)),H.g=Math.max(0,Math.min(p.color.g*N.g,1)),H.b=Math.max(0,Math.min(p.color.b*N.b,1))):H.copy(p.color):p instanceof
|
|
|
-THREE.MeshDepthMaterial?(K=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),H.setRGB(K,K,K)):p instanceof THREE.MeshNormalMaterial&&H.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));p.wireframe?U.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):U.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+
|
|
|
-p.opacity);u.appendChild(U)}function f(b){D[b]==null&&(D[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&D[b].setAttribute("shape-rendering","crispEdges"));return D[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),v,w,p,x,t,y,z,A,C=new THREE.Rectangle,E=new THREE.Rectangle,G=!1,H=new THREE.Color(16777215),N=new THREE.Color(16777215),S=new THREE.Color(0),J=new THREE.Color(0),
|
|
|
-I=new THREE.Color(0),K,W=new THREE.Vector3,D=[],M=[],U,V,R,o=1;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){v=b;w=e;p=v/2;x=w/2;u.setAttribute("viewBox",-p+" "+-x+" "+v+" "+w);u.setAttribute("width",v);u.setAttribute("height",w);C.set(-p,-x,p,x)};this.clear=function(){for(;u.childNodes.length>0;)u.removeChild(u.childNodes[0])};this.render=
|
|
|
-function(b,f){var h,v,w,H,N,D,K,fa;this.autoClear&&this.clear();m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,f,this.sortElements);R=V=0;if(G=b.lights.length>0){K=b.lights;S.setRGB(0,0,0);J.setRGB(0,0,0);I.setRGB(0,0,0);h=0;for(v=K.length;h<v;h++)w=K[h],H=w.color,w instanceof THREE.AmbientLight?(S.r+=H.r,S.g+=H.g,S.b+=H.b):w instanceof THREE.DirectionalLight?(J.r+=H.r,J.g+=H.g,J.b+=H.b):w instanceof THREE.PointLight&&(I.r+=H.r,I.g+=H.g,I.b+=H.b)}h=0;for(v=k.length;h<v;h++)if(K=k[h],E.empty(),
|
|
|
-K instanceof THREE.RenderableParticle){t=K;t.x*=p;t.y*=-x;w=0;for(H=K.materials.length;w<H;)w++}else if(K instanceof THREE.RenderableLine){if(t=K.v1,y=K.v2,t.positionScreen.x*=p,t.positionScreen.y*=-x,y.positionScreen.x*=p,y.positionScreen.y*=-x,E.addPoint(t.positionScreen.x,t.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),C.intersects(E)){w=0;for(H=K.materials.length;w<H;)if((fa=K.materials[w++])&&fa.opacity!=0){N=t;D=y;var Y=R++;M[Y]==null&&(M[Y]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"line"),o==0&&M[Y].setAttribute("shape-rendering","crispEdges"));U=M[Y];U.setAttribute("x1",N.positionScreen.x);U.setAttribute("y1",N.positionScreen.y);U.setAttribute("x2",D.positionScreen.x);U.setAttribute("y2",D.positionScreen.y);fa instanceof THREE.LineBasicMaterial&&(U.setAttribute("style","fill: none; stroke: "+fa.color.getContextStyle()+"; stroke-width: "+fa.linewidth+"; stroke-opacity: "+fa.opacity+"; stroke-linecap: "+fa.linecap+"; stroke-linejoin: "+fa.linejoin),u.appendChild(U))}}}else if(K instanceof
|
|
|
-THREE.RenderableFace3){if(t=K.v1,y=K.v2,z=K.v3,t.positionScreen.x*=p,t.positionScreen.y*=-x,y.positionScreen.x*=p,y.positionScreen.y*=-x,z.positionScreen.x*=p,z.positionScreen.y*=-x,E.addPoint(t.positionScreen.x,t.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),C.intersects(E)){w=0;for(H=K.meshMaterials.length;w<H;)if(fa=K.meshMaterials[w++],fa instanceof THREE.MeshFaceMaterial){N=0;for(D=K.faceMaterials.length;N<D;)(fa=K.faceMaterials[N++])&&
|
|
|
-fa.opacity!=0&&c(t,y,z,K,fa,b)}else fa&&fa.opacity!=0&&c(t,y,z,K,fa,b)}}else if(K instanceof THREE.RenderableFace4&&(t=K.v1,y=K.v2,z=K.v3,A=K.v4,t.positionScreen.x*=p,t.positionScreen.y*=-x,y.positionScreen.x*=p,y.positionScreen.y*=-x,z.positionScreen.x*=p,z.positionScreen.y*=-x,A.positionScreen.x*=p,A.positionScreen.y*=-x,E.addPoint(t.positionScreen.x,t.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(A.positionScreen.x,
|
|
|
-A.positionScreen.y),C.intersects(E))){w=0;for(H=K.meshMaterials.length;w<H;)if(fa=K.meshMaterials[w++],fa instanceof THREE.MeshFaceMaterial){N=0;for(D=K.faceMaterials.length;N<D;)(fa=K.faceMaterials[N++])&&fa.opacity!=0&&e(t,y,z,A,K,fa,b)}else fa&&fa.opacity!=0&&e(t,y,z,A,K,fa,b)}}};
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,m;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;m=f/2};this.render=function(e,f){var u,v,w,t,x,p,y,z;b=c.projectScene(e,f);u=0;for(v=b.length;u<v;u++)if(x=b[u],x instanceof THREE.RenderableParticle){y=x.x*h+h;z=x.y*m+m;w=0;for(t=x.material.length;w<t;w++)if(p=x.material[w],p instanceof THREE.ParticleDOMMaterial)p=p.domElement,p.style.left=y+"px",p.style.top=z+"px"}}};
|
|
|
+THREE.CanvasRenderer=function(b){function c(b){if(A!=b)p.globalAlpha=A=b}function e(b){if(C!=b){switch(b){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}C=b}}function f(b){if(E!=b)p.strokeStyle=E=b}function h(b){if(G!=b)p.fillStyle=G=b}var m=this,k=null,n=new THREE.Projector,b=b||{},u=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
+v,w,t,x,p=u.getContext("2d"),y=new THREE.Color(0),z=0,A=1,C=0,E=null,G=null,H=null,N=null,S=null,J,I,K,W,D=new THREE.RenderableVertex,M=new THREE.RenderableVertex,U,V,R,o,pa,T,la,aa,na,ja,ka,ea,Z=new THREE.Color(0),ga=new THREE.Color(0),Y=new THREE.Color(0),ma=new THREE.Color(0),ia=new THREE.Color(0),sa=[],O,da,ua,ta,ra,wa,Ca,za,Aa,Ea,L=new THREE.Rectangle,P=new THREE.Rectangle,fa=new THREE.Rectangle,$=!1,ha=new THREE.Color,qa=new THREE.Color,ya=new THREE.Color,xa=new THREE.Color,oa=new THREE.Vector3,
|
|
|
+Fa,X,Ba,ca,Va,Wa,b=16;Fa=document.createElement("canvas");Fa.width=Fa.height=2;X=Fa.getContext("2d");X.fillStyle="rgba(0,0,0,1)";X.fillRect(0,0,2,2);Ba=X.getImageData(0,0,2,2);ca=Ba.data;Va=document.createElement("canvas");Va.width=Va.height=b;Wa=Va.getContext("2d");Wa.translate(-b/2,-b/2);Wa.scale(b,b);b--;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setSize=function(b,e){v=b;w=e;t=Math.floor(v/2);x=Math.floor(w/2);u.width=v;u.height=
|
|
|
+w;L.set(-t,-x,t,x);P.set(-t,-x,t,x);A=1;C=0;S=N=H=G=E=null};this.setClearColor=function(b,e){y.copy(b);z=e;P.set(-t,-x,t,x)};this.setClearColorHex=function(b,e){y.setHex(b);z=e;P.set(-t,-x,t,x)};this.clear=function(){p.setTransform(1,0,0,-1,t,x);P.isEmpty()||(P.minSelf(L),P.inflate(2),z<1&&p.clearRect(Math.floor(P.getX()),Math.floor(P.getY()),Math.floor(P.getWidth()),Math.floor(P.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
|
|
|
+255)+","+z+")"),p.fillRect(Math.floor(P.getX()),Math.floor(P.getY()),Math.floor(P.getWidth()),Math.floor(P.getHeight()))),P.empty())};this.render=function(b,v){function u(b){var e,c,f,k=b.lights;qa.setRGB(0,0,0);ya.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(e=k.length;b<e;b++)c=k[b],f=c.color,c instanceof THREE.AmbientLight?(qa.r+=f.r,qa.g+=f.g,qa.b+=f.b):c instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):c instanceof THREE.PointLight&&(xa.r+=f.r,xa.g+=f.g,xa.b+=f.b)}function w(b,e,c,
|
|
|
+f){var k,h,m,o,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(o=c.dot(h.position),o<=0||(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)):h instanceof THREE.PointLight&&(o=c.dot(oa.sub(h.position,e).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(e.distanceTo(h.position)/h.distance,1),o!=0&&(o*=h.intensity,f.r+=m.r*o,f.g+=m.g*o,f.b+=m.b*o)))}function y(b,k,m){c(m.opacity);e(m.blending);var o,n,v,ca,u,w;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)ca=
|
|
|
+m.map.image,u=ca.width>>1,w=ca.height>>1,m=k.scale.x*t,v=k.scale.y*x,o=m*u,n=v*w,fa.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(fa)&&(p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(m,-v),p.translate(-u,-w),p.drawImage(ca,0,0),p.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*x,fa.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(fa)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(o,n),
|
|
|
+m.program(p),p.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);p.beginPath();p.moveTo(b.positionScreen.x,b.positionScreen.y);p.lineTo(k.positionScreen.x,k.positionScreen.y);p.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)p.lineWidth=H=b;b=m.linecap;if(N!=b)p.lineCap=N=b;b=m.linejoin;if(S!=b)p.lineJoin=S=b;f(m.color.getContextStyle());p.stroke();fa.inflate(m.linewidth*2)}}function A(b,f,k,h,n,t,ca,p,u){m.data.vertices+=3;m.data.faces++;c(p.opacity);e(p.blending);
|
|
|
+U=b.positionScreen.x;V=b.positionScreen.y;R=f.positionScreen.x;o=f.positionScreen.y;pa=k.positionScreen.x;T=k.positionScreen.y;E(U,V,R,o,pa,T);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(ta=ca.uvs[0],$a(U,V,R,o,pa,T,ta[h].u,ta[h].v,ta[n].u,ta[n].v,ta[t].u,ta[t].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=v.matrixWorldInverse,oa.copy(ca.vertexNormalsWorld[0]),ra=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+
|
|
|
+0.5,wa=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ca.vertexNormalsWorld[1]),Ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,za=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(ca.vertexNormalsWorld[2]),Aa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ea=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,$a(U,V,R,o,pa,T,ra,wa,Ca,za,Aa,Ea,p.envMap)}else p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&
|
|
|
+!p.wireframe&&(p.map.mapping instanceof THREE.UVMapping&&(ta=ca.uvs[0],$a(U,V,R,o,pa,T,ta[h].u,ta[h].v,ta[n].u,ta[n].v,ta[t].u,ta[t].v,p.map)),e(THREE.SubtractiveBlending)),$?!p.wireframe&&p.shading==THREE.SmoothShading&&ca.vertexNormalsWorld.length==3?(ga.r=Y.r=ma.r=qa.r,ga.g=Y.g=ma.g=qa.g,ga.b=Y.b=ma.b=qa.b,w(u,ca.v1.positionWorld,ca.vertexNormalsWorld[0],ga),w(u,ca.v2.positionWorld,ca.vertexNormalsWorld[1],Y),w(u,ca.v3.positionWorld,ca.vertexNormalsWorld[2],ma),ia.r=(Y.r+ma.r)*0.5,ia.g=(Y.g+ma.g)*
|
|
|
+0.5,ia.b=(Y.b+ma.b)*0.5,ua=Xa(ga,Y,ma,ia),Sa(U,V,R,o,pa,T,0,0,1,0,0,1,ua)):(ha.r=qa.r,ha.g=qa.g,ha.b=qa.b,w(u,ca.centroidWorld,ca.normalWorld,ha),Z.r=Math.max(0,Math.min(p.color.r*ha.r,1)),Z.g=Math.max(0,Math.min(p.color.g*ha.g,1)),Z.b=Math.max(0,Math.min(p.color.b*ha.b,1)),p.wireframe?Ia(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(Z)):p.wireframe?Ia(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(p.color);else if(p instanceof THREE.MeshDepthMaterial)O=
|
|
|
+v.near,da=v.far,ga.r=ga.g=ga.b=1-Na(b.positionScreen.z,O,da),Y.r=Y.g=Y.b=1-Na(f.positionScreen.z,O,da),ma.r=ma.g=ma.b=1-Na(k.positionScreen.z,O,da),ia.r=(Y.r+ma.r)*0.5,ia.g=(Y.g+ma.g)*0.5,ia.b=(Y.b+ma.b)*0.5,ua=Xa(ga,Y,ma,ia),Sa(U,V,R,o,pa,T,0,0,1,0,0,1,ua);else if(p instanceof THREE.MeshNormalMaterial)Z.r=Ta(ca.normalWorld.x),Z.g=Ta(ca.normalWorld.y),Z.b=Ta(ca.normalWorld.z),p.wireframe?Ia(Z,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Ja(Z)}function C(b,f,k,h,n,p,t,ca,u){m.data.vertices+=
|
|
|
+4;m.data.faces++;c(ca.opacity);e(ca.blending);if(ca.map||ca.envMap)A(b,f,h,0,1,3,t,ca,u),A(n,k,p,1,2,3,t,ca,u);else if(U=b.positionScreen.x,V=b.positionScreen.y,R=f.positionScreen.x,o=f.positionScreen.y,pa=k.positionScreen.x,T=k.positionScreen.y,la=h.positionScreen.x,aa=h.positionScreen.y,na=n.positionScreen.x,ja=n.positionScreen.y,ka=p.positionScreen.x,ea=p.positionScreen.y,ca instanceof THREE.MeshBasicMaterial)G(U,V,R,o,pa,T,la,aa),ca.wireframe?Ia(ca.color,ca.wireframeLinewidth,ca.wireframeLinecap,
|
|
|
+ca.wireframeLinejoin):Ja(ca.color);else if(ca instanceof THREE.MeshLambertMaterial)$?!ca.wireframe&&ca.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==4?(ga.r=Y.r=ma.r=ia.r=qa.r,ga.g=Y.g=ma.g=ia.g=qa.g,ga.b=Y.b=ma.b=ia.b=qa.b,w(u,t.v1.positionWorld,t.vertexNormalsWorld[0],ga),w(u,t.v2.positionWorld,t.vertexNormalsWorld[1],Y),w(u,t.v4.positionWorld,t.vertexNormalsWorld[3],ma),w(u,t.v3.positionWorld,t.vertexNormalsWorld[2],ia),ua=Xa(ga,Y,ma,ia),E(U,V,R,o,la,aa),Sa(U,V,R,o,la,aa,0,0,1,0,0,
|
|
|
+1,ua),E(na,ja,pa,T,ka,ea),Sa(na,ja,pa,T,ka,ea,1,0,1,1,0,1,ua)):(ha.r=qa.r,ha.g=qa.g,ha.b=qa.b,w(u,t.centroidWorld,t.normalWorld,ha),Z.r=Math.max(0,Math.min(ca.color.r*ha.r,1)),Z.g=Math.max(0,Math.min(ca.color.g*ha.g,1)),Z.b=Math.max(0,Math.min(ca.color.b*ha.b,1)),G(U,V,R,o,pa,T,la,aa),ca.wireframe?Ia(Z,ca.wireframeLinewidth,ca.wireframeLinecap,ca.wireframeLinejoin):Ja(Z)):(G(U,V,R,o,pa,T,la,aa),ca.wireframe?Ia(ca.color,ca.wireframeLinewidth,ca.wireframeLinecap,ca.wireframeLinejoin):Ja(ca.color));
|
|
|
+else if(ca instanceof THREE.MeshNormalMaterial)Z.r=Ta(t.normalWorld.x),Z.g=Ta(t.normalWorld.y),Z.b=Ta(t.normalWorld.z),G(U,V,R,o,pa,T,la,aa),ca.wireframe?Ia(Z,ca.wireframeLinewidth,ca.wireframeLinecap,ca.wireframeLinejoin):Ja(Z);else if(ca instanceof THREE.MeshDepthMaterial)O=v.near,da=v.far,ga.r=ga.g=ga.b=1-Na(b.positionScreen.z,O,da),Y.r=Y.g=Y.b=1-Na(f.positionScreen.z,O,da),ma.r=ma.g=ma.b=1-Na(h.positionScreen.z,O,da),ia.r=ia.g=ia.b=1-Na(k.positionScreen.z,O,da),ua=Xa(ga,Y,ma,ia),E(U,V,R,o,la,
|
|
|
+aa),Sa(U,V,R,o,la,aa,0,0,1,0,0,1,ua),E(na,ja,pa,T,ka,ea),Sa(na,ja,pa,T,ka,ea,1,0,1,1,0,1,ua)}function E(b,e,c,f,k,h){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(b,e);p.closePath()}function G(b,e,c,f,k,h,m,o){p.beginPath();p.moveTo(b,e);p.lineTo(c,f);p.lineTo(k,h);p.lineTo(m,o);p.lineTo(b,e);p.closePath()}function Ia(b,e,c,k){if(H!=e)p.lineWidth=H=e;if(N!=c)p.lineCap=N=c;if(S!=k)p.lineJoin=S=k;f(b.getContextStyle());p.stroke();fa.inflate(e*2)}function Ja(b){h(b.getContextStyle());
|
|
|
+p.fill()}function $a(b,e,c,f,k,m,o,n,ca,t,v,u,w){if(w.image.width!=0){if(w.needsUpdate==!0||sa[w.id]==void 0){var x=w.wrapS==THREE.RepeatWrapping,Ma=w.wrapT==THREE.RepeatWrapping;sa[w.id]=p.createPattern(w.image,x&&Ma?"repeat":x&&!Ma?"repeat-x":!x&&Ma?"repeat-y":"no-repeat");w.needsUpdate=!1}h(sa[w.id]);var x=w.offset.x/w.repeat.x,Ma=w.offset.y/w.repeat.y,L=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,o=(o+x)*L,n=(n+Ma)*w,ca=(ca+x)*L,t=(t+Ma)*w,v=(v+x)*L,u=(u+Ma)*w;c-=b;f-=e;k-=b;
|
|
|
+m-=e;ca-=o;t-=n;v-=o;u-=n;x=1/(ca*u-v*t);w=(u*c-t*k)*x;t=(u*f-t*m)*x;c=(ca*k-v*c)*x;f=(ca*m-v*f)*x;b=b-w*o-c*n;e=e-t*o-f*n;p.save();p.transform(w,t,c,f,b,e);p.fill();p.restore()}}function Sa(b,e,c,f,k,h,m,o,n,ca,t,v,u){var w,x;w=u.width-1;x=u.height-1;m*=w;o*=x;n*=w;ca*=x;t*=w;v*=x;c-=b;f-=e;k-=b;h-=e;n-=m;ca-=o;t-=m;v-=o;x=1/(n*v-t*ca);w=(v*c-ca*k)*x;ca=(v*f-ca*h)*x;c=(n*k-t*c)*x;f=(n*h-t*f)*x;b=b-w*m-c*o;e=e-ca*m-f*o;p.save();p.transform(w,ca,c,f,b,e);p.clip();p.drawImage(u,0,0);p.restore()}function Xa(b,
|
|
|
+e,c,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(e.r*255),o=~~(e.g*255),e=~~(e.b*255),n=~~(c.r*255),t=~~(c.g*255),c=~~(c.b*255),p=~~(f.r*255),v=~~(f.g*255),f=~~(f.b*255);ca[0]=k<0?0:k>255?255:k;ca[1]=h<0?0:h>255?255:h;ca[2]=b<0?0:b>255?255:b;ca[4]=m<0?0:m>255?255:m;ca[5]=o<0?0:o>255?255:o;ca[6]=e<0?0:e>255?255:e;ca[8]=n<0?0:n>255?255:n;ca[9]=t<0?0:t>255?255:t;ca[10]=c<0?0:c>255?255:c;ca[12]=p<0?0:p>255?255:p;ca[13]=v<0?0:v>255?255:v;ca[14]=f<0?0:f>255?255:f;X.putImageData(Ba,0,0);Wa.drawImage(Fa,
|
|
|
+0,0);return Va}function Na(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Ta(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Ka(b,e){var c=e.x-b.x,f=e.y-b.y,k=c*c+f*f;k!=0&&(k=1/Math.sqrt(k),c*=k,f*=k,e.x+=c,e.y+=f,b.x-=c,b.y-=f)}var Ya,cb,va,Da,La,Ua,Za,F;this.autoClear?this.clear():p.setTransform(1,0,0,-1,t,x);m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,v,this.sortElements);($=b.lights.length>0)&&u(b);Ya=0;for(cb=k.length;Ya<cb;Ya++){va=k[Ya];fa.empty();if(va instanceof THREE.RenderableParticle){J=
|
|
|
+va;J.x*=t;J.y*=x;Da=0;for(La=va.materials.length;Da<La;)F=va.materials[Da++],F.opacity!=0&&y(J,va,F,b)}else if(va instanceof THREE.RenderableLine){if(J=va.v1,I=va.v2,J.positionScreen.x*=t,J.positionScreen.y*=x,I.positionScreen.x*=t,I.positionScreen.y*=x,fa.addPoint(J.positionScreen.x,J.positionScreen.y),fa.addPoint(I.positionScreen.x,I.positionScreen.y),L.intersects(fa)){Da=0;for(La=va.materials.length;Da<La;)F=va.materials[Da++],F.opacity!=0&&z(J,I,va,F,b)}}else if(va instanceof THREE.RenderableFace3){if(J=
|
|
|
+va.v1,I=va.v2,K=va.v3,J.positionScreen.x*=t,J.positionScreen.y*=x,I.positionScreen.x*=t,I.positionScreen.y*=x,K.positionScreen.x*=t,K.positionScreen.y*=x,va.overdraw&&(Ka(J.positionScreen,I.positionScreen),Ka(I.positionScreen,K.positionScreen),Ka(K.positionScreen,J.positionScreen)),fa.add3Points(J.positionScreen.x,J.positionScreen.y,I.positionScreen.x,I.positionScreen.y,K.positionScreen.x,K.positionScreen.y),L.intersects(fa)){Da=0;for(La=va.meshMaterials.length;Da<La;)if(F=va.meshMaterials[Da++],
|
|
|
+F instanceof THREE.MeshFaceMaterial){Ua=0;for(Za=va.faceMaterials.length;Ua<Za;)(F=va.faceMaterials[Ua++])&&F.opacity!=0&&A(J,I,K,0,1,2,va,F,b)}else F.opacity!=0&&A(J,I,K,0,1,2,va,F,b)}}else if(va instanceof THREE.RenderableFace4&&(J=va.v1,I=va.v2,K=va.v3,W=va.v4,J.positionScreen.x*=t,J.positionScreen.y*=x,I.positionScreen.x*=t,I.positionScreen.y*=x,K.positionScreen.x*=t,K.positionScreen.y*=x,W.positionScreen.x*=t,W.positionScreen.y*=x,D.positionScreen.copy(I.positionScreen),M.positionScreen.copy(W.positionScreen),
|
|
|
+va.overdraw&&(Ka(J.positionScreen,I.positionScreen),Ka(I.positionScreen,W.positionScreen),Ka(W.positionScreen,J.positionScreen),Ka(K.positionScreen,D.positionScreen),Ka(K.positionScreen,M.positionScreen)),fa.addPoint(J.positionScreen.x,J.positionScreen.y),fa.addPoint(I.positionScreen.x,I.positionScreen.y),fa.addPoint(K.positionScreen.x,K.positionScreen.y),fa.addPoint(W.positionScreen.x,W.positionScreen.y),L.intersects(fa))){Da=0;for(La=va.meshMaterials.length;Da<La;)if(F=va.meshMaterials[Da++],F instanceof
|
|
|
+THREE.MeshFaceMaterial){Ua=0;for(Za=va.faceMaterials.length;Ua<Za;)(F=va.faceMaterials[Ua++])&&F.opacity!=0&&C(J,I,K,W,D,M,va,F,b)}else F.opacity!=0&&C(J,I,K,W,D,M,va,F,b)}P.addRectangle(fa)}p.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function b(b,e,c){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=e.normalWorld.dot(h.position)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m)):h instanceof THREE.PointLight&&(W.sub(h.position,e.centroidWorld),W.normalize(),m=e.normalWorld.dot(W)*h.intensity,m>0&&(c.r+=h.color.r*m,c.g+=h.color.g*m,c.b+=h.color.b*m))}function c(e,c,k,o,n,t){m.data.vertices+=3;m.data.faces++;U=f(V++);U.setAttribute("d",
|
|
|
+"M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?G?(N.r=S.r,N.g=S.g,N.b=S.b,b(t,o,N),H.r=Math.max(0,Math.min(n.color.r*N.r,1)),H.g=Math.max(0,Math.min(n.color.g*N.g,1)),H.b=Math.max(0,Math.min(n.color.b*N.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(K=1-n.__2near/(n.__farPlusNear-o.z*n.__farMinusNear),
|
|
|
+H.setRGB(K,K,K)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?U.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):U.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);u.appendChild(U)}function e(e,c,k,o,n,t,p){m.data.vertices+=4;m.data.faces++;
|
|
|
+U=f(V++);U.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+k.positionScreen.x+","+k.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?H.copy(t.color):t instanceof THREE.MeshLambertMaterial?G?(N.r=S.r,N.g=S.g,N.b=S.b,b(p,n,N),H.r=Math.max(0,Math.min(t.color.r*N.r,1)),H.g=Math.max(0,Math.min(t.color.g*N.g,1)),H.b=Math.max(0,Math.min(t.color.b*N.b,1))):H.copy(t.color):t instanceof
|
|
|
+THREE.MeshDepthMaterial?(K=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),H.setRGB(K,K,K)):t instanceof THREE.MeshNormalMaterial&&H.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?U.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):U.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+
|
|
|
+t.opacity);u.appendChild(U)}function f(b){D[b]==null&&(D[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&D[b].setAttribute("shape-rendering","crispEdges"));return D[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var m=this,k=null,n=new THREE.Projector,u=document.createElementNS("http://www.w3.org/2000/svg","svg"),v,w,t,x,p,y,z,A,C=new THREE.Rectangle,E=new THREE.Rectangle,G=!1,H=new THREE.Color(16777215),N=new THREE.Color(16777215),S=new THREE.Color(0),J=new THREE.Color(0),
|
|
|
+I=new THREE.Color(0),K,W=new THREE.Vector3,D=[],M=[],U,V,R,o=1;this.domElement=u;this.sortElements=this.sortObjects=this.autoClear=!0;this.data={vertices:0,faces:0};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,e){v=b;w=e;t=v/2;x=w/2;u.setAttribute("viewBox",-t+" "+-x+" "+v+" "+w);u.setAttribute("width",v);u.setAttribute("height",w);C.set(-t,-x,t,x)};this.clear=function(){for(;u.childNodes.length>0;)u.removeChild(u.childNodes[0])};this.render=
|
|
|
+function(b,f){var h,v,w,H,N,D,K,ga;this.autoClear&&this.clear();m.data.vertices=0;m.data.faces=0;k=n.projectScene(b,f,this.sortElements);R=V=0;if(G=b.lights.length>0){K=b.lights;S.setRGB(0,0,0);J.setRGB(0,0,0);I.setRGB(0,0,0);h=0;for(v=K.length;h<v;h++)w=K[h],H=w.color,w instanceof THREE.AmbientLight?(S.r+=H.r,S.g+=H.g,S.b+=H.b):w instanceof THREE.DirectionalLight?(J.r+=H.r,J.g+=H.g,J.b+=H.b):w instanceof THREE.PointLight&&(I.r+=H.r,I.g+=H.g,I.b+=H.b)}h=0;for(v=k.length;h<v;h++)if(K=k[h],E.empty(),
|
|
|
+K instanceof THREE.RenderableParticle){p=K;p.x*=t;p.y*=-x;w=0;for(H=K.materials.length;w<H;)w++}else if(K instanceof THREE.RenderableLine){if(p=K.v1,y=K.v2,p.positionScreen.x*=t,p.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),C.intersects(E)){w=0;for(H=K.materials.length;w<H;)if((ga=K.materials[w++])&&ga.opacity!=0){N=p;D=y;var Y=R++;M[Y]==null&&(M[Y]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"line"),o==0&&M[Y].setAttribute("shape-rendering","crispEdges"));U=M[Y];U.setAttribute("x1",N.positionScreen.x);U.setAttribute("y1",N.positionScreen.y);U.setAttribute("x2",D.positionScreen.x);U.setAttribute("y2",D.positionScreen.y);ga instanceof THREE.LineBasicMaterial&&(U.setAttribute("style","fill: none; stroke: "+ga.color.getContextStyle()+"; stroke-width: "+ga.linewidth+"; stroke-opacity: "+ga.opacity+"; stroke-linecap: "+ga.linecap+"; stroke-linejoin: "+ga.linejoin),u.appendChild(U))}}}else if(K instanceof
|
|
|
+THREE.RenderableFace3){if(p=K.v1,y=K.v2,z=K.v3,p.positionScreen.x*=t,p.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),C.intersects(E)){w=0;for(H=K.meshMaterials.length;w<H;)if(ga=K.meshMaterials[w++],ga instanceof THREE.MeshFaceMaterial){N=0;for(D=K.faceMaterials.length;N<D;)(ga=K.faceMaterials[N++])&&
|
|
|
+ga.opacity!=0&&c(p,y,z,K,ga,b)}else ga&&ga.opacity!=0&&c(p,y,z,K,ga,b)}}else if(K instanceof THREE.RenderableFace4&&(p=K.v1,y=K.v2,z=K.v3,A=K.v4,p.positionScreen.x*=t,p.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,A.positionScreen.x*=t,A.positionScreen.y*=-x,E.addPoint(p.positionScreen.x,p.positionScreen.y),E.addPoint(y.positionScreen.x,y.positionScreen.y),E.addPoint(z.positionScreen.x,z.positionScreen.y),E.addPoint(A.positionScreen.x,
|
|
|
+A.positionScreen.y),C.intersects(E))){w=0;for(H=K.meshMaterials.length;w<H;)if(ga=K.meshMaterials[w++],ga instanceof THREE.MeshFaceMaterial){N=0;for(D=K.faceMaterials.length;N<D;)(ga=K.faceMaterials[N++])&&ga.opacity!=0&&e(p,y,z,A,K,ga,b)}else ga&&ga.opacity!=0&&e(p,y,z,A,K,ga,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",
|
|
@@ -220,44 +220,44 @@ 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,e,c){var f,k,h,m=b.vertices,n=m.length,p=b.colors,t=p.length,v=b.__vertexArray,u=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,L=b.__dirtyColors,y=b.__webglCustomAttributes,ea,P;if(y)for(ea in y)y[ea].offset=0;if(c.sortParticles){ua.multiplySelf(c.matrixWorld);for(f=0;f<n;f++)k=m[f].position,wa.copy(k),ua.multiplyVector3(wa),w[f]=[wa.z,f];w.sort(function(b,e){return e[0]-b[0]});for(f=0;f<n;f++)k=m[w[f][1]].position,h=f*3,v[h]=k.x,v[h+1]=k.y,v[h+2]=
|
|
|
-k.z;for(f=0;f<t;f++)h=f*3,color=p[w[f][1]],u[h]=color.r,u[h+1]=color.g,u[h+2]=color.b;if(y)for(ea in y){f=y[ea];p=f.value.length;for(h=0;h<p;h++){index=w[h][1];t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")P=f.value[index];f.size===2?(f.array[t]=P.x,f.array[t+1]=P.y):f.size===3?f.type==="c"?(f.array[t]=P.r,f.array[t+1]=P.g,f.array[t+2]=P.b):(f.array[t]=P.x,f.array[t+1]=P.y,f.array[t+2]=P.z):(f.array[t]=
|
|
|
-P.x,f.array[t+1]=P.y,f.array[t+2]=P.z,f.array[t+3]=P.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,v[h]=k.x,v[h+1]=k.y,v[h+2]=k.z;if(L)for(f=0;f<t;f++)color=p[f],h=f*3,u[h]=color.r,u[h+1]=color.g,u[h+2]=color.b;if(y)for(ea in y)if(f=y[ea],f.__original.needsUpdate){p=f.value.length;for(h=0;h<p;h++){t=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[t]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")P=f.value[h];f.size===2?(f.array[t]=
|
|
|
-P.x,f.array[t+1]=P.y):f.size===3?f.type==="c"?(f.array[t]=P.r,f.array[t+1]=P.g,f.array[t+2]=P.b):(f.array[t]=P.x,f.array[t+1]=P.y,f.array[t+2]=P.z):(f.array[t]=P.x,f.array[t+1]=P.y,f.array[t+2]=P.z,f.array[t+3]=P.w)}f.offset+=f.size}}}if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,v,e);if(L||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,u,e);if(y)for(ea in y)if(f=y[ea],f.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
+THREE.WebGLRenderer=function(b){function c(b,e,c){var f,k,h,m=b.vertices,n=m.length,t=b.colors,p=t.length,v=b.__vertexArray,u=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,L=b.__dirtyColors,y=b.__webglCustomAttributes,fa,P;if(y)for(fa in y)y[fa].offset=0;if(c.sortParticles){ua.multiplySelf(c.matrixWorld);for(f=0;f<n;f++)k=m[f].position,wa.copy(k),ua.multiplyVector3(wa),w[f]=[wa.z,f];w.sort(function(b,e){return e[0]-b[0]});for(f=0;f<n;f++)k=m[w[f][1]].position,h=f*3,v[h]=k.x,v[h+1]=k.y,v[h+2]=
|
|
|
+k.z;for(f=0;f<p;f++)h=f*3,color=t[w[f][1]],u[h]=color.r,u[h+1]=color.g,u[h+2]=color.b;if(y)for(fa in y){f=y[fa];t=f.value.length;for(h=0;h<t;h++){index=w[h][1];p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")P=f.value[index];f.size===2?(f.array[p]=P.x,f.array[p+1]=P.y):f.size===3?f.type==="c"?(f.array[p]=P.r,f.array[p+1]=P.g,f.array[p+2]=P.b):(f.array[p]=P.x,f.array[p+1]=P.y,f.array[p+2]=P.z):(f.array[p]=
|
|
|
+P.x,f.array[p+1]=P.y,f.array[p+2]=P.z,f.array[p+3]=P.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,v[h]=k.x,v[h+1]=k.y,v[h+2]=k.z;if(L)for(f=0;f<p;f++)color=t[f],h=f*3,u[h]=color.r,u[h+1]=color.g,u[h+2]=color.b;if(y)for(fa in y)if(f=y[fa],f.__original.needsUpdate){t=f.value.length;for(h=0;h<t;h++){p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")P=f.value[h];f.size===2?(f.array[p]=
|
|
|
+P.x,f.array[p+1]=P.y):f.size===3?f.type==="c"?(f.array[p]=P.r,f.array[p+1]=P.g,f.array[p+2]=P.b):(f.array[p]=P.x,f.array[p+1]=P.y,f.array[p+2]=P.z):(f.array[p]=P.x,f.array[p+1]=P.y,f.array[p+2]=P.z,f.array[p+3]=P.w)}f.offset+=f.size}}}if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,v,e);if(L||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,u,e);if(y)for(fa in y)if(f=y[fa],f.__original.needsUpdate||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,e)}function e(b,e,c,f,k){f.program||R.initMaterial(f,e,c,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(R.maxMorphTargets);for(var h=0,m=R.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var h=f.program,m=h.uniforms,n=f.uniforms;h!=T&&(o.useProgram(h),T=h);o.uniformMatrix4fv(m.projectionMatrix,!1,ta);if(c&&(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||
|
|
|
-f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var p,t,v,u=0,w=0,x=0,L,y,ea,P=Ca,z=P.directional.colors,A=P.directional.positions,C=P.point.colors,E=P.point.positions,G=P.point.distances,
|
|
|
-H=0,$=0,c=t=ea=0;for(p=e.length;c<p;c++)if(t=e[c],v=t.color,L=t.position,y=t.intensity,ea=t.distance,t instanceof THREE.AmbientLight)u+=v.r,w+=v.g,x+=v.b;else if(t instanceof THREE.DirectionalLight)ea=H*3,z[ea]=v.r*y,z[ea+1]=v.g*y,z[ea+2]=v.b*y,A[ea]=L.x,A[ea+1]=L.y,A[ea+2]=L.z,H+=1;else if(t instanceof THREE.SpotLight)ea=H*3,z[ea]=v.r*y,z[ea+1]=v.g*y,z[ea+2]=v.b*y,v=1/L.length(),A[ea]=L.x*v,A[ea+1]=L.y*v,A[ea+2]=L.z*v,H+=1;else if(t instanceof THREE.PointLight)t=$*3,C[t]=v.r*y,C[t+1]=v.g*y,C[t+2]=
|
|
|
-v.b*y,E[t]=L.x,E[t+1]=L.y,E[t+2]=L.z,G[$]=ea,$+=1;for(c=H*3;c<z.length;c++)z[c]=0;for(c=$*3;c<C.length;c++)C[c]=0;P.point.length=$;P.directional.length=H;P.ambient[0]=u;P.ambient[1]=w;P.ambient[2]=x;e=Ca;n.enableLighting.value=e.directional.length+e.point.length;n.ambientLightColor.value=e.ambient;n.directionalLightColor.value=e.directional.colors;n.directionalLightDirection.value=e.directional.positions;n.pointLightColor.value=e.point.colors;n.pointLightPosition.value=e.point.positions;n.pointLightDistance.value=
|
|
|
+f instanceof THREE.MeshPhongMaterial||f instanceof THREE.LineBasicMaterial||f instanceof THREE.ParticleBasicMaterial||f.fog))if(n.fogColor.value=c.color,c instanceof THREE.Fog)n.fogNear.value=c.near,n.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)n.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){var t,p,v,u=0,w=0,x=0,L,y,fa,P=Ca,z=P.directional.colors,A=P.directional.positions,C=P.point.colors,E=P.point.positions,G=P.point.distances,
|
|
|
+H=0,$=0,c=p=fa=0;for(t=e.length;c<t;c++)if(p=e[c],v=p.color,L=p.position,y=p.intensity,fa=p.distance,p instanceof THREE.AmbientLight)u+=v.r,w+=v.g,x+=v.b;else if(p instanceof THREE.DirectionalLight)fa=H*3,z[fa]=v.r*y,z[fa+1]=v.g*y,z[fa+2]=v.b*y,A[fa]=L.x,A[fa+1]=L.y,A[fa+2]=L.z,H+=1;else if(p instanceof THREE.SpotLight)fa=H*3,z[fa]=v.r*y,z[fa+1]=v.g*y,z[fa+2]=v.b*y,v=1/L.length(),A[fa]=L.x*v,A[fa+1]=L.y*v,A[fa+2]=L.z*v,H+=1;else if(p instanceof THREE.PointLight)p=$*3,C[p]=v.r*y,C[p+1]=v.g*y,C[p+2]=
|
|
|
+v.b*y,E[p]=L.x,E[p+1]=L.y,E[p+2]=L.z,G[$]=fa,$+=1;for(c=H*3;c<z.length;c++)z[c]=0;for(c=$*3;c<C.length;c++)C[c]=0;P.point.length=$;P.directional.length=H;P.ambient[0]=u;P.ambient[1]=w;P.ambient[2]=x;e=Ca;n.enableLighting.value=e.directional.length+e.point.length;n.ambientLightColor.value=e.ambient;n.directionalLightColor.value=e.directional.colors;n.directionalLightDirection.value=e.directional.positions;n.pointLightColor.value=e.point.colors;n.pointLightPosition.value=e.point.positions;n.pointLightDistance.value=
|
|
|
e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity,(n.map.texture=f.map)&&n.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),n.lightMap.texture=f.lightMap,n.envMap.texture=f.envMap,n.reflectivity.value=f.reflectivity,n.refractionRatio.value=f.refractionRatio,n.combine.value=f.combine,n.useRefract.value=f.envMap&&f.envMap.mapping instanceof
|
|
|
THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)n.diffuse.value=f.color,n.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)n.psColor.value=f.color,n.opacity.value=f.opacity,n.size.value=f.size,n.scale.value=za.height/2,n.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)n.ambient.value=f.ambient,n.specular.value=f.specular,n.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)n.mNear.value=b.near,n.mFar.value=b.far,n.opacity.value=
|
|
|
-f.opacity;else if(f instanceof THREE.MeshNormalMaterial)n.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&n.shadowMatrix){for(e=0;e<ha.length;e++)n.shadowMatrix.value[e]=ha[e],n.shadowMap.texture[e]=R.shadowMap[e];n.shadowDarkness.value=R.shadowMapDarkness;n.shadowBias.value=R.shadowMapBias}for(var O in n)if(p=h.uniforms[O])if(c=n[O],u=c.type,e=c.value,u=="i")o.uniform1i(p,e);else if(u=="f")o.uniform1f(p,e);else if(u=="v2")o.uniform2f(p,e.x,e.y);else if(u=="v3")o.uniform3f(p,e.x,e.y,e.z);
|
|
|
-else if(u=="v4")o.uniform4f(p,e.x,e.y,e.z,e.w);else if(u=="c")o.uniform3f(p,e.r,e.g,e.b);else if(u=="fv1")o.uniform1fv(p,e);else if(u=="fv")o.uniform3fv(p,e);else if(u=="v3v"){if(!c._array)c._array=new Float32Array(3*e.length);u=0;for(w=e.length;u<w;u++)x=u*3,c._array[x]=e[u].x,c._array[x+1]=e[u].y,c._array[x+2]=e[u].z;o.uniform3fv(p,c._array)}else if(u=="m4"){if(!c._array)c._array=new Float32Array(16);e.flattenToArray(c._array);o.uniformMatrix4fv(p,!1,c._array)}else if(u=="m4v"){if(!c._array)c._array=
|
|
|
-new Float32Array(16*e.length);u=0;for(w=e.length;u<w;u++)e[u].flattenToArrayOffset(c._array,u*16);o.uniformMatrix4fv(p,!1,c._array)}else if(u=="t"){if(o.uniform1i(p,e),p=c.texture)if(p.image instanceof Array&&p.image.length==6){if(c=p,c.image.length==6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);for(e=0;e<6;e++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,
|
|
|
-o.RGBA,o.RGBA,o.UNSIGNED_BYTE,c.image[e]);I(o.TEXTURE_CUBE_MAP,c,c.image[0]);c.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else p instanceof THREE.WebGLRenderTargetCube?(c=p,o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.__webglTexture)):K(p,e)}else if(u=="tv"){if(!c._array){c._array=[];u=0;for(w=c.texture.length;u<w;u++)c._array[u]=e+u}o.uniform1iv(p,c._array);u=0;for(w=c.texture.length;u<w;u++)(p=c.texture[u])&&
|
|
|
-K(p,c._array[u])}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);
|
|
|
+f.opacity;else if(f instanceof THREE.MeshNormalMaterial)n.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&n.shadowMatrix){for(e=0;e<ha.length;e++)n.shadowMatrix.value[e]=ha[e],n.shadowMap.texture[e]=R.shadowMap[e];n.shadowDarkness.value=R.shadowMapDarkness;n.shadowBias.value=R.shadowMapBias}for(var O in n)if(t=h.uniforms[O])if(c=n[O],u=c.type,e=c.value,u=="i")o.uniform1i(t,e);else if(u=="f")o.uniform1f(t,e);else if(u=="v2")o.uniform2f(t,e.x,e.y);else if(u=="v3")o.uniform3f(t,e.x,e.y,e.z);
|
|
|
+else if(u=="v4")o.uniform4f(t,e.x,e.y,e.z,e.w);else if(u=="c")o.uniform3f(t,e.r,e.g,e.b);else if(u=="fv1")o.uniform1fv(t,e);else if(u=="fv")o.uniform3fv(t,e);else if(u=="v3v"){if(!c._array)c._array=new Float32Array(3*e.length);u=0;for(w=e.length;u<w;u++)x=u*3,c._array[x]=e[u].x,c._array[x+1]=e[u].y,c._array[x+2]=e[u].z;o.uniform3fv(t,c._array)}else if(u=="m4"){if(!c._array)c._array=new Float32Array(16);e.flattenToArray(c._array);o.uniformMatrix4fv(t,!1,c._array)}else if(u=="m4v"){if(!c._array)c._array=
|
|
|
+new Float32Array(16*e.length);u=0;for(w=e.length;u<w;u++)e[u].flattenToArrayOffset(c._array,u*16);o.uniformMatrix4fv(t,!1,c._array)}else if(u=="t"){if(o.uniform1i(t,e),t=c.texture)if(t.image instanceof Array&&t.image.length==6){if(c=t,c.image.length==6)if(c.needsUpdate){if(!c.image.__webglTextureCube)c.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube);for(e=0;e<6;e++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,
|
|
|
+o.RGBA,o.RGBA,o.UNSIGNED_BYTE,c.image[e]);I(o.TEXTURE_CUBE_MAP,c,c.image[0]);c.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.image.__webglTextureCube)}else t instanceof THREE.WebGLRenderTargetCube?(c=t,o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_CUBE_MAP,c.__webglTexture)):K(t,e)}else if(u=="tv"){if(!c._array){c._array=[];u=0;for(w=c.texture.length;u<w;u++)c._array[u]=e+u}o.uniform1iv(t,c._array);u=0;for(w=c.texture.length;u<w;u++)(t=c.texture[u])&&
|
|
|
+K(t,c._array[u])}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.MeshShaderMaterial||f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&o.uniform3f(m.cameraPosition,b.position.x,b.position.y,b.position.z);(f instanceof THREE.MeshShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);
|
|
|
(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,ra);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,ra),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,k.boneMatrices));return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,b=e(b,c,f,k,m).attributes;if(!k.morphTargets&&b.position>=0)o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,
|
|
|
-3,o.FLOAT,!1,0,0);else if(m.morphTargetBase){c=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var f=0,p=m.morphTargetForcedOrder,t=m.morphTargetInfluences;f<k.numSupportedMorphTargets&&f<p.length;)o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
-h.__webglMorphTargetsBuffers[p[f]]),o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[f]=t[p[f]],f++;else{var p=[],u=-1,v=0,t=m.morphTargetInfluences,w,x=t.length,f=0;for(m.morphTargetBase!==-1&&(p[m.morphTargetBase]=!0);f<k.numSupportedMorphTargets;){for(w=0;w<x;w++)!p[w]&&t[w]>u&&(v=w,u=t[v]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[v]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=u;p[v]=1;u=
|
|
|
+3,o.FLOAT,!1,0,0);else if(m.morphTargetBase){c=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0)):c.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(c.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var f=0,t=m.morphTargetForcedOrder,p=m.morphTargetInfluences;f<k.numSupportedMorphTargets&&f<t.length;)o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
+h.__webglMorphTargetsBuffers[t[f]]),o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[f]=p[t[f]],f++;else{var t=[],u=-1,v=0,p=m.morphTargetInfluences,w,x=p.length,f=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);f<k.numSupportedMorphTargets;){for(w=0;w<x;w++)!t[w]&&p[w]>u&&(v=w,u=p[v]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[v]);o.vertexAttribPointer(c["morphTarget"+f],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[f]=u;t[v]=1;u=
|
|
|
-1;f++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=0&&(c=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,c.buffer),o.vertexAttribPointer(b[n],c.size,o.FLOAT,!1,0,0));b.color>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglNormalBuffer),
|
|
|
o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(h.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(h.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv2)):
|
|
|
o.disableVertexAttribArray(b.uv2));k.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,h.__webglSkinWeightsBuffer),
|
|
|
o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0));m instanceof THREE.Mesh?(k.wireframe?(o.lineWidth(k.wireframeLinewidth),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,o.UNSIGNED_SHORT,0)):(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),R.data.vertices+=h.__webglFaceCount,R.data.faces+=h.__webglFaceCount/3,R.data.drawCalls++):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?
|
|
|
o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),R.data.drawCalls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),R.data.drawCalls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),R.data.drawCalls++)}}function h(b,e,c){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=o.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=o.createBuffer();b.hasPos&&(o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),
|
|
|
-o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,p,t,u,v,w,x=b.count*3;for(w=0;w<x;w+=9)c=b.normalArray,f=c[w],h=c[w+1],k=c[w+2],m=c[w+3],p=c[w+4],u=c[w+5],n=c[w+6],t=c[w+7],v=c[w+8],f=(f+m+n)/3,h=(h+p+t)/3,k=(k+u+v)/3,c[w]=f,c[w+1]=h,c[w+2]=k,c[w+3]=f,c[w+4]=h,c[w+5]=k,c[w+
|
|
|
+o.bufferData(o.ARRAY_BUFFER,b.positionArray,o.DYNAMIC_DRAW),o.enableVertexAttribArray(e.attributes.position),o.vertexAttribPointer(e.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,b.__webglNormalBuffer);if(c==THREE.FlatShading){var f,h,k,m,n,t,p,u,v,w,x=b.count*3;for(w=0;w<x;w+=9)c=b.normalArray,f=c[w],h=c[w+1],k=c[w+2],m=c[w+3],t=c[w+4],u=c[w+5],n=c[w+6],p=c[w+7],v=c[w+8],f=(f+m+n)/3,h=(h+t+p)/3,k=(k+u+v)/3,c[w]=f,c[w+1]=h,c[w+2]=k,c[w+3]=f,c[w+4]=h,c[w+5]=k,c[w+
|
|
|
6]=f,c[w+7]=h,c[w+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(e.attributes.normal);o.vertexAttribPointer(e.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,0,b.count);b.count=0}function m(b){if(aa!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),aa=b.doubleSided;if(na!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),na=b.flipSided}function k(b){ka!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),ka=
|
|
|
-b)}function n(b){da!=b&&(o.depthMask(b),da=b)}function u(b,e,c){Z!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),Z=b);if(b&&(fa!=e||Y!=c))o.polygonOffset(e,c),fa=e,Y=c}function v(b){ca[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ca[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ca[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ca[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ca[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);
|
|
|
-ca[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=ca[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function w(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=ca[f].x*e.n14+ca[f].y*e.n24+ca[f].z*e.n34+ca[f].w,b<=c)return!1;return!0}function p(b,e){b.list[b.count]=e;b.count+=1}function x(b){var e,c,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(e=f.materials.length;b<
|
|
|
-e;b++)c=f.materials[b],c.transparent?p(k,c):p(h,c)}function t(b){var e,c,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(e=k.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=m.materials.length;e<c;e++)(h=m.materials[e])&&(h.transparent?p(o,h):p(n,h))}else(h=e)&&(h.transparent?p(o,h):p(n,h))}function y(b,e){return e.z-b.z}function z(b,c){var n,p,t,u=0,x,L,y,z,A=b.lights;$||($=new THREE.Camera(R.shadowCameraFov,c.aspect,R.shadowCameraNear,
|
|
|
-R.shadowCameraFar));n=0;for(p=A.length;n<p;n++)if(t=A[n],t instanceof THREE.SpotLight&&t.castShadow){R.shadowMap[u]||(R.shadowMap[u]=new THREE.WebGLRenderTarget(R.shadowMapWidth,R.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ha[u]||(ha[u]=new THREE.Matrix4);x=R.shadowMap[u];L=ha[u];$.position.copy(t.position);$.target.position.copy(t.target.position);$.update(void 0,!0);b.update(void 0,!1,$);L.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);
|
|
|
-L.multiplySelf($.projectionMatrix);L.multiplySelf($.matrixWorldInverse);$.matrixWorldInverse.flattenToArray(ra);$.projectionMatrix.flattenToArray(ta);ua.multiply($.projectionMatrix,$.matrixWorldInverse);v(ua);R.initWebGLObjects(b);W(x);o.clearColor(1,1,1,1);R.clear();o.clearColor(P.r,P.g,P.b,ea);L=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(x=0;x<L;x++)y=b.__webglObjects[x],z=y.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||w(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),
|
|
|
-C(z,$,!1),y.render=!0):y.render=!1:y.render=!1;k(!0);J(THREE.NormalBlending);for(x=0;x<L;x++)if(y=b.__webglObjects[x],y.render)z=y.object,buffer=y.buffer,m(z),y=z.customDepthMaterial?z.customDepthMaterial:z.geometry.morphTargets.length?xa:ya,f($,A,null,y,buffer,z);for(x=0;x<t;x++)y=b.__webglObjectsImmediate[x],z=y.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),C(z,$,!1),m(z),program=e($,A,null,ya,z),z.render(function(b){h(b,program,ya.shading)}));
|
|
|
-u++}}function A(b,e){var c,f,h;c=X.attributes;var k=X.uniforms,m=O/sa,n,p=[],t=sa*0.5,u=O*0.5,v=!0;o.useProgram(X.program);T=X.program;ka=ja=-1;Ba||(o.enableVertexAttribArray(X.attributes.position),o.enableVertexAttribArray(X.attributes.uv),Ba=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,
|
|
|
+b)}function n(b){ea!=b&&(o.depthMask(b),ea=b)}function u(b,e,c){Z!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),Z=b);if(b&&(ga!=e||Y!=c))o.polygonOffset(e,c),ga=e,Y=c}function v(b){da[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);da[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);da[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);da[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);da[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);
|
|
|
+da[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var e,b=0;b<6;b++)e=da[b],e.divideScalar(Math.sqrt(e.x*e.x+e.y*e.y+e.z*e.z))}function w(b){for(var e=b.matrixWorld,c=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=da[f].x*e.n14+da[f].y*e.n24+da[f].z*e.n34+da[f].w,b<=c)return!1;return!0}function t(b,e){b.list[b.count]=e;b.count+=1}function x(b){var e,c,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(e=f.materials.length;b<
|
|
|
+e;b++)c=f.materials[b],c.transparent?t(k,c):t(h,c)}function p(b){var e,c,f,h,k=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=k.materials.length;b<f;b++)if(e=k.materials[b],e instanceof THREE.MeshFaceMaterial){e=0;for(c=m.materials.length;e<c;e++)(h=m.materials[e])&&(h.transparent?t(o,h):t(n,h))}else(h=e)&&(h.transparent?t(o,h):t(n,h))}function y(b,e){return e.z-b.z}function z(b,c){var n,t,p,u=0,x,L,y,z,A=b.lights;$||($=new THREE.Camera(R.shadowCameraFov,c.aspect,R.shadowCameraNear,
|
|
|
+R.shadowCameraFar));n=0;for(t=A.length;n<t;n++)if(p=A[n],p instanceof THREE.SpotLight&&p.castShadow){R.shadowMap[u]||(R.shadowMap[u]=new THREE.WebGLRenderTarget(R.shadowMapWidth,R.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));ha[u]||(ha[u]=new THREE.Matrix4);x=R.shadowMap[u];L=ha[u];$.position.copy(p.position);$.target.position.copy(p.target.position);$.update(void 0,!0);b.update(void 0,!1,$);L.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);
|
|
|
+L.multiplySelf($.projectionMatrix);L.multiplySelf($.matrixWorldInverse);$.matrixWorldInverse.flattenToArray(ra);$.projectionMatrix.flattenToArray(ta);ua.multiply($.projectionMatrix,$.matrixWorldInverse);v(ua);R.initWebGLObjects(b);W(x);o.clearColor(1,1,1,1);R.clear();o.clearColor(P.r,P.g,P.b,fa);L=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(x=0;x<L;x++)y=b.__webglObjects[x],z=y.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||w(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),
|
|
|
+C(z,$,!1),y.render=!0):y.render=!1:y.render=!1;k(!0);J(THREE.NormalBlending);for(x=0;x<L;x++)if(y=b.__webglObjects[x],y.render)z=y.object,buffer=y.buffer,m(z),y=z.customDepthMaterial?z.customDepthMaterial:z.geometry.morphTargets.length?xa:ya,f($,A,null,y,buffer,z);for(x=0;x<p;x++)y=b.__webglObjectsImmediate[x],z=y.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),C(z,$,!1),m(z),program=e($,A,null,ya,z),z.render(function(b){h(b,program,ya.shading)}));
|
|
|
+u++}}function A(b,e){var c,f,h;c=X.attributes;var k=X.uniforms,m=O/sa,n,t=[],p=sa*0.5,u=O*0.5,v=!0;o.useProgram(X.program);T=X.program;ka=ja=-1;Ba||(o.enableVertexAttribArray(X.attributes.position),o.enableVertexAttribArray(X.attributes.uv),Ba=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.vertexAttribPointer(c.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(c.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,
|
|
|
!1,ta);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(y);c=0;for(f=b.__webglSprites.length;c<f;c++)h=b.__webglSprites[c],h.material===void 0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,
|
|
|
-(h.position.x-t)/t,(u-h.position.y)/u,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?O:1),p[0]=n*m*h.scale.x,p[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),
|
|
|
-o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,p),h.mergeWith3D&&!v?(o.enable(o.DEPTH_TEST),v=!0):!h.mergeWith3D&&v&&(o.disable(o.DEPTH_TEST),v=!1),J(h.blending),K(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(da)}function C(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function E(b){var e,
|
|
|
+(h.position.x-p)/p,(u-h.position.y)/u,Math.max(0,Math.min(1,h.position.z)))):(o.uniform1i(k.useScreenCoordinates,0),o.uniform1i(k.affectedByDistance,h.affectedByDistance?1:0),o.uniformMatrix4fv(k.modelViewMatrix,!1,h._modelViewMatrixArray)),n=h.map.image.width/(h.scaleByViewport?O:1),t[0]=n*m*h.scale.x,t[1]=n*h.scale.y,o.uniform2f(k.uvScale,h.uvScale.x,h.uvScale.y),o.uniform2f(k.uvOffset,h.uvOffset.x,h.uvOffset.y),o.uniform2f(k.alignment,h.alignment.x,h.alignment.y),o.uniform1f(k.opacity,h.opacity),
|
|
|
+o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,t),h.mergeWith3D&&!v?(o.enable(o.DEPTH_TEST),v=!0):!h.mergeWith3D&&v&&(o.disable(o.DEPTH_TEST),v=!1),J(h.blending),K(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(ea)}function C(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}function E(b){var e,
|
|
|
c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)if(f.attributes[e].needsUpdate)return!0;return!1}function G(b){var e,c,f,h;h=b.__materials;b=0;for(c=h.length;b<c;b++)if(f=h[b],f.attributes)for(e in f.attributes)f.attributes[e].needsUpdate=!1}function H(b,e){var c;for(c=b.length-1;c>=0;c--)b[c].object==e&&b.splice(c,1)}function N(b){function e(b){var h=[];c=0;for(f=b.length;c<f;c++)b[c]==void 0?h.push("undefined"):h.push(b[c].id);return h.join("_")}var c,
|
|
|
-f,h,k,m,n,o,p,t={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=e(n),t[o]==void 0&&(t[o]={hash:o,counter:0}),p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:u}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+m>65535&&(t[o].counter+=1,p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],
|
|
|
-materials:n,vertices:0,numMorphTargets:u})),b.geometryGroups[p].faces.push(h),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[v])}function S(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=ja){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,
|
|
|
+f,h,k,m,n,o,t,p={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};h=0;for(k=b.faces.length;h<k;h++)m=b.faces[h],n=m.materials,o=e(n),p[o]==void 0&&(p[o]={hash:o,counter:0}),t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],materials:n,vertices:0,numMorphTargets:u}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[t].vertices+m>65535&&(p[o].counter+=1,t=p[o].hash+"_"+p[o].counter,b.geometryGroups[t]==void 0&&(b.geometryGroups[t]={faces:[],
|
|
|
+materials:n,vertices:0,numMorphTargets:u})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroupsList.push(b.geometryGroups[v])}function S(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function J(b){if(b!=ja){switch(b){case THREE.AdditiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.SRC_ALPHA,o.ONE);break;case THREE.SubtractiveBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,
|
|
|
o.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:o.blendEquation(o.FUNC_ADD);o.blendFunc(o.ZERO,o.SRC_COLOR);break;default:o.blendEquationSeparate(o.FUNC_ADD,o.FUNC_ADD),o.blendFuncSeparate(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA,o.ONE,o.ONE_MINUS_SRC_ALPHA)}ja=b}}function I(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,V(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,V(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,V(e.magFilter)),o.texParameteri(b,
|
|
|
o.TEXTURE_MIN_FILTER,V(e.minFilter)),o.generateMipmap(b)):(o.texParameteri(b,o.TEXTURE_WRAP_S,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_WRAP_T,o.CLAMP_TO_EDGE),o.texParameteri(b,o.TEXTURE_MAG_FILTER,U(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,U(e.minFilter)))}function K(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture();o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,
|
|
|
0,V(b.format),b.image.width,b.image.height,0,V(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);I(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function W(b){var e=b instanceof THREE.WebGLRenderTargetCube;if(b&&!b.__webglFramebuffer){if(b.depthBuffer===void 0)b.depthBuffer=!0;if(b.stencilBuffer===void 0)b.stencilBuffer=!0;b.__webglRenderbuffer=o.createRenderbuffer();
|
|
@@ -268,70 +268,70 @@ null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer
|
|
|
function M(b,e){var c;b=="fragment"?c=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(c=o.createShader(o.VERTEX_SHADER));o.shaderSource(c,e);o.compileShader(c);if(!o.getShaderParameter(c,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(c)),console.error(e),null;return c}function U(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function V(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;
|
|
|
case THREE.ClampToEdgeWrapping:return o.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return o.MIRRORED_REPEAT;case THREE.NearestFilter:return o.NEAREST;case THREE.NearestMipMapNearestFilter:return o.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return o.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return o.LINEAR;case THREE.LinearMipMapNearestFilter:return o.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return o.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return o.BYTE;
|
|
|
case THREE.UnsignedByteType:return o.UNSIGNED_BYTE;case THREE.ShortType:return o.SHORT;case THREE.UnsignedShortType:return o.UNSIGNED_SHORT;case THREE.IntType:return o.INT;case THREE.UnsignedShortType:return o.UNSIGNED_INT;case THREE.FloatType:return o.FLOAT;case THREE.AlphaFormat:return o.ALPHA;case THREE.RGBFormat:return o.RGB;case THREE.RGBAFormat:return o.RGBA;case THREE.LuminanceFormat:return o.LUMINANCE;case THREE.LuminanceAlphaFormat:return o.LUMINANCE_ALPHA}return 0}var R=this,o,pa=[],T=null,
|
|
|
-la=null,aa=null,na=null,ja=null,ka=null,da=null,Z=null,fa=null,Y=null,ma=0,ia=0,sa=0,O=0,ca=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,ta=new Float32Array(16),ra=new Float32Array(16),wa=new THREE.Vector4,Ca={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},za=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0?
|
|
|
-b.stencil:!0,Ea=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,P=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ea=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=za;this.sortObjects=this.autoClear=!0;this.shadowMapBias=0.0039;this.shadowMapDarkness=0.5;this.shadowMapHeight=this.shadowMapWidth=512;this.shadowCameraNear=
|
|
|
+la=null,aa=null,na=null,ja=null,ka=null,ea=null,Z=null,ga=null,Y=null,ma=0,ia=0,sa=0,O=0,da=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,ta=new Float32Array(16),ra=new Float32Array(16),wa=new THREE.Vector4,Ca={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},za=b.canvas!==void 0?b.canvas:document.createElement("canvas"),Aa=b.stencil!==void 0?
|
|
|
+b.stencil:!0,Ea=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,L=b.antialias!==void 0?b.antialias:!1,P=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),fa=b.clearAlpha!==void 0?b.clearAlpha:0;_maxLights=b.maxLights!==void 0?b.maxLights:4;this.data={vertices:0,faces:0,drawCalls:0};this.maxMorphTargets=8;this.domElement=za;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 $,ha=[],b=THREE.ShaderLib.depthRGBA,qa=THREE.UniformsUtils.clone(b.uniforms),ya=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:qa}),xa=new THREE.MeshShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:qa,morphTargets:!0});ya._shadowPass=!0;xa._shadowPass=!0;try{if(!(o=za.getContext("experimental-webgl",
|
|
|
{antialias:L,stencil:Aa,preserveDrawingBuffer:Ea})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+o.getParameter(o.VERSION)+" | "+o.getParameter(o.VENDOR)+" | "+o.getParameter(o.RENDERER)+" | "+o.getParameter(o.SHADING_LANGUAGE_VERSION))}catch(oa){console.error(oa)}o.clearColor(0,0,0,1);o.clearDepth(1);o.clearStencil(0);o.enable(o.DEPTH_TEST);o.depthFunc(o.LEQUAL);o.frontFace(o.CCW);o.cullFace(o.BACK);o.enable(o.CULL_FACE);o.enable(o.BLEND);o.blendEquation(o.FUNC_ADD);
|
|
|
-o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(P.r,P.g,P.b,ea);this.context=o;var Fa=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);i=0;X.vertices[i++]=-1;X.vertices[i++]=-1;X.vertices[i++]=0;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=-1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=0;X.vertices[i++]=-1;X.vertices[i++]=1;X.vertices[i++]=0;i=X.vertices[i++]=
|
|
|
+o.blendFunc(o.SRC_ALPHA,o.ONE_MINUS_SRC_ALPHA);o.clearColor(P.r,P.g,P.b,fa);this.context=o;var Fa=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);i=0;X.vertices[i++]=-1;X.vertices[i++]=-1;X.vertices[i++]=0;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=-1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=1;X.vertices[i++]=0;X.vertices[i++]=-1;X.vertices[i++]=1;X.vertices[i++]=0;i=X.vertices[i++]=
|
|
|
0;X.faces[i++]=0;X.faces[i++]=1;X.faces[i++]=2;X.faces[i++]=0;X.faces[i++]=2;X.faces[i++]=3;X.vertexBuffer=o.createBuffer();X.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,X.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,X.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,X.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,X.faces,o.STATIC_DRAW);X.program=o.createProgram();o.attachShader(X.program,M("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(X.program,M("vertex",
|
|
|
THREE.ShaderLib.sprite.vertexShader));o.linkProgram(X.program);X.attributes={};X.uniforms={};X.attributes.position=o.getAttribLocation(X.program,"position");X.attributes.uv=o.getAttribLocation(X.program,"uv");X.uniforms.uvOffset=o.getUniformLocation(X.program,"uvOffset");X.uniforms.uvScale=o.getUniformLocation(X.program,"uvScale");X.uniforms.rotation=o.getUniformLocation(X.program,"rotation");X.uniforms.scale=o.getUniformLocation(X.program,"scale");X.uniforms.alignment=o.getUniformLocation(X.program,
|
|
|
"alignment");X.uniforms.map=o.getUniformLocation(X.program,"map");X.uniforms.opacity=o.getUniformLocation(X.program,"opacity");X.uniforms.useScreenCoordinates=o.getUniformLocation(X.program,"useScreenCoordinates");X.uniforms.affectedByDistance=o.getUniformLocation(X.program,"affectedByDistance");X.uniforms.screenPosition=o.getUniformLocation(X.program,"screenPosition");X.uniforms.modelViewMatrix=o.getUniformLocation(X.program,"modelViewMatrix");X.uniforms.projectionMatrix=o.getUniformLocation(X.program,
|
|
|
-"projectionMatrix");var Ba=!1;this.setSize=function(b,e){za.width=b;za.height=e;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(b,e,c,f){ma=b;ia=e;sa=c;O=f;o.viewport(ma,ia,sa,O)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,e){P.setHex(b);ea=e;o.clearColor(P.r,P.g,P.b,ea)};this.setClearColor=function(b,e){P.copy(b);ea=e;o.clearColor(P.r,P.g,P.b,ea)};
|
|
|
-this.getClearColor=function(b){b.copy(P)};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);
|
|
|
+"projectionMatrix");var Ba=!1;this.setSize=function(b,e){za.width=b;za.height=e;this.setViewport(0,0,za.width,za.height)};this.setViewport=function(b,e,c,f){ma=b;ia=e;sa=c;O=f;o.viewport(ma,ia,sa,O)};this.setScissor=function(b,e,c,f){o.scissor(b,e,c,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=function(b,e){P.setHex(b);fa=e;o.clearColor(P.r,P.g,P.b,fa)};this.setClearColor=function(b,e){P.copy(b);fa=e;o.clearColor(P.r,P.g,P.b,fa)};
|
|
|
+this.getClearColor=function(){return P};this.clear=function(){o.clear(o.COLOR_BUFFER_BIT|o.DEPTH_BUFFER_BIT|o.STENCIL_BUFFER_BIT)};this.getContext=function(){return o};this.deallocateObject=function(b){if(b.__webglInit)if(b.__webglInit=!1,delete b._modelViewMatrix,delete b._normalMatrixArray,delete b._modelViewMatrixArray,delete b._objectMatrixArray,b instanceof THREE.Mesh)for(g in b.geometry.geometryGroups){var e=b.geometry.geometryGroups[g];o.deleteBuffer(e.__webglVertexBuffer);o.deleteBuffer(e.__webglNormalBuffer);
|
|
|
o.deleteBuffer(e.__webglTangentBuffer);o.deleteBuffer(e.__webglColorBuffer);o.deleteBuffer(e.__webglUVBuffer);o.deleteBuffer(e.__webglUV2Buffer);o.deleteBuffer(e.__webglSkinVertexABuffer);o.deleteBuffer(e.__webglSkinVertexBBuffer);o.deleteBuffer(e.__webglSkinIndicesBuffer);o.deleteBuffer(e.__webglSkinWeightsBuffer);o.deleteBuffer(e.__webglFaceBuffer);o.deleteBuffer(e.__webglLineBuffer);if(e.numMorphTargets)for(var c=0,f=e.numMorphTargets;c<f;c++)o.deleteBuffer(e.__webglMorphTargetsBuffers[c])}else if(b instanceof
|
|
|
THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer);else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer);else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer)};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture)};this.initMaterial=function(b,e,c,f){var h,k,m;
|
|
|
-b instanceof THREE.MeshDepthMaterial?m="depth":b instanceof THREE.MeshNormalMaterial?m="normal":b instanceof THREE.MeshBasicMaterial?m="basic":b instanceof THREE.MeshLambertMaterial?m="lambert":b instanceof THREE.MeshPhongMaterial?m="phong":b instanceof THREE.LineBasicMaterial?m="basic":b instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var p,
|
|
|
-t,u;p=u=n=0;for(t=e.length;p<t;p++)k=e[p],k instanceof THREE.SpotLight&&u++,k instanceof THREE.DirectionalLight&&u++,k instanceof THREE.PointLight&&n++;n+u<=_maxLights?p=u:(p=Math.ceil(_maxLights*u/(n+u)),n=_maxLights-p);k={directional:p,point:n};n=u=0;for(p=e.length;n<p;n++)t=e[n],t instanceof THREE.SpotLight&&t.castShadow&&u++;var v=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)v=f.bones.length;var w;a:{p=b.fragmentShader;t=b.vertexShader;var n=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,
|
|
|
-lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:k.directional,maxPointLights:k.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},x,f=[];m?f.push(m):(f.push(p),f.push(t));for(x in c)f.push(x),f.push(c[x]);
|
|
|
+b instanceof THREE.MeshDepthMaterial?m="depth":b instanceof THREE.MeshNormalMaterial?m="normal":b instanceof THREE.MeshBasicMaterial?m="basic":b instanceof THREE.MeshLambertMaterial?m="lambert":b instanceof THREE.MeshPhongMaterial?m="phong":b instanceof THREE.LineBasicMaterial?m="basic":b instanceof THREE.ParticleBasicMaterial&&(m="particle_basic");if(m){var n=THREE.ShaderLib[m];b.uniforms=THREE.UniformsUtils.clone(n.uniforms);b.vertexShader=n.vertexShader;b.fragmentShader=n.fragmentShader}var t,
|
|
|
+p,u;t=u=n=0;for(p=e.length;t<p;t++)k=e[t],k instanceof THREE.SpotLight&&u++,k instanceof THREE.DirectionalLight&&u++,k instanceof THREE.PointLight&&n++;n+u<=_maxLights?t=u:(t=Math.ceil(_maxLights*u/(n+u)),n=_maxLights-t);k={directional:t,point:n};n=u=0;for(t=e.length;n<t;n++)p=e[n],p instanceof THREE.SpotLight&&p.castShadow&&u++;var v=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)v=f.bones.length;var w;a:{t=b.fragmentShader;p=b.vertexShader;var n=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,
|
|
|
+lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:k.directional,maxPointLights:k.point,maxBones:v,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},x,f=[];m?f.push(m):(f.push(t),f.push(p));for(x in c)f.push(x),f.push(c[x]);
|
|
|
m=f.join();x=0;for(f=pa.length;x<f;x++)if(pa[x].code==m){w=pa[x].program;break a}x=o.createProgram();f=[Fa?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":
|
|
|
"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
k=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",c.fog?"#define USE_FOG":"",c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":
|
|
|
-"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,M("fragment",k+p));o.attachShader(x,M("vertex",f+t));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");x.uniforms=
|
|
|
-{};x.attributes={};var L,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(L in n)f.push(L);L=f;f=0;for(n=L.length;f<n;f++)p=L[f],x.uniforms[p]=o.getUniformLocation(x,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(L=0;L<c.maxMorphTargets;L++)f.push("morphTarget"+L);for(w in e)f.push(w);w=f;L=0;for(e=w.length;L<e;L++)c=
|
|
|
+"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(x,M("fragment",k+t));o.attachShader(x,M("vertex",f+p));o.linkProgram(x);o.getProgramParameter(x,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(x,o.VALIDATE_STATUS)+", gl error ["+o.getError()+"]");x.uniforms=
|
|
|
+{};x.attributes={};var L,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(L in n)f.push(L);L=f;f=0;for(n=L.length;f<n;f++)t=L[f],x.uniforms[t]=o.getUniformLocation(x,t);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(L=0;L<c.maxMorphTargets;L++)f.push("morphTarget"+L);for(w in e)f.push(w);w=f;L=0;for(e=w.length;L<e;L++)c=
|
|
|
w[L],x.attributes[c]=o.getAttribLocation(x,c);pa.push({program:x,code:m});w=x}b.program=w;w=b.program.attributes;w.position>=0&&o.enableVertexAttribArray(w.position);w.color>=0&&o.enableVertexAttribArray(w.color);w.normal>=0&&o.enableVertexAttribArray(w.normal);w.tangent>=0&&o.enableVertexAttribArray(w.tangent);b.skinning&&w.skinVertexA>=0&&w.skinVertexB>=0&&w.skinIndex>=0&&w.skinWeight>=0&&(o.enableVertexAttribArray(w.skinVertexA),o.enableVertexAttribArray(w.skinVertexB),o.enableVertexAttribArray(w.skinIndex),
|
|
|
-o.enableVertexAttribArray(w.skinWeight));if(b.attributes)for(h in b.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)L="morphTarget"+h,w[L]>=0&&(o.enableVertexAttribArray(w[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){W(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT);o.clear(b)};this.render=function(b,c,o,p){var L,ea,P,E,G,H,$,O,I=b.lights,
|
|
|
-qa=b.fog;this.shadowMapEnabled&&z(b,c);R.data.vertices=0;R.data.faces=0;R.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ra);c.projectionMatrix.flattenToArray(ta);ua.multiply(c.projectionMatrix,c.matrixWorldInverse);v(ua);this.initWebGLObjects(b);W(o);(this.autoClear||p)&&this.clear();G=b.__webglObjects.length;for(p=0;p<G;p++)if(L=b.__webglObjects[p],$=L.object,$.visible)if(!($ instanceof THREE.Mesh)||!$.frustumCulled||w($)){if($.matrixWorld.flattenToArray($._objectMatrixArray),
|
|
|
-C($,c,!0),t(L),L.render=!0,this.sortObjects)L.object.renderDepth?L.z=L.object.renderDepth:(wa.copy($.position),ua.multiplyVector3(wa),L.z=wa.z)}else L.render=!1;else L.render=!1;this.sortObjects&&b.__webglObjects.sort(y);H=b.__webglObjectsImmediate.length;for(p=0;p<H;p++)L=b.__webglObjectsImmediate[p],$=L.object,$.visible&&($.matrixAutoUpdate&&$.matrixWorld.flattenToArray($._objectMatrixArray),C($,c,!0),x(L));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);J(b.overrideMaterial.blending);for(p=
|
|
|
-0;p<G;p++)if(L=b.__webglObjects[p],L.render)$=L.object,O=L.buffer,m($),f(c,I,qa,b.overrideMaterial,O,$);for(p=0;p<H;p++)L=b.__webglObjectsImmediate[p],$=L.object,$.visible&&(m($),ea=e(c,I,qa,b.overrideMaterial,$),$.render(function(c){h(c,ea,b.overrideMaterial.shading)}))}else{J(THREE.NormalBlending);for(p=G-1;p>=0;p--)if(L=b.__webglObjects[p],L.render){$=L.object;O=L.buffer;P=L.opaque;m($);for(L=0;L<P.count;L++)E=P.list[L],k(E.depthTest),n(E.depthWrite),u(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),
|
|
|
-f(c,I,qa,E,O,$)}for(p=0;p<H;p++)if(L=b.__webglObjectsImmediate[p],$=L.object,$.visible){P=L.opaque;m($);for(L=0;L<P.count;L++)E=P.list[L],k(E.depthTest),n(E.depthWrite),u(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),ea=e(c,I,qa,E,$),$.render(function(b){h(b,ea,E.shading)})}for(p=0;p<G;p++)if(L=b.__webglObjects[p],L.render){$=L.object;O=L.buffer;P=L.transparent;m($);for(L=0;L<P.count;L++)E=P.list[L],J(E.blending),k(E.depthTest),n(E.depthWrite),u(E.polygonOffset,E.polygonOffsetFactor,
|
|
|
-E.polygonOffsetUnits),f(c,I,qa,E,O,$)}for(p=0;p<H;p++)if(L=b.__webglObjectsImmediate[p],$=L.object,$.visible){P=L.transparent;m($);for(L=0;L<P.count;L++)E=P.list[L],J(E.blending),k(E.depthTest),n(E.depthWrite),u(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),ea=e(c,I,qa,E,$),$.render(function(b){h(b,ea,E.shading)})}}b.__webglSprites.length&&A(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&D(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=
|
|
|
+o.enableVertexAttribArray(w.skinWeight));if(b.attributes)for(h in b.attributes)w[h]!==void 0&&w[h]>=0&&o.enableVertexAttribArray(w[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)L="morphTarget"+h,w[L]>=0&&(o.enableVertexAttribArray(w[L]),b.numSupportedMorphTargets++)};this.clearTarget=function(b,e,c,f){W(b);b=0;e&&(b|=o.COLOR_BUFFER_BIT);c&&(b|=o.DEPTH_BUFFER_BIT);f&&(b|=o.STENCIL_BUFFER_BIT);o.clear(b)};this.render=function(b,c,o,t){var L,fa,P,E,G,H,$,O,I=b.lights,
|
|
|
+qa=b.fog;this.shadowMapEnabled&&z(b,c);R.data.vertices=0;R.data.faces=0;R.data.drawCalls=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(ra);c.projectionMatrix.flattenToArray(ta);ua.multiply(c.projectionMatrix,c.matrixWorldInverse);v(ua);this.initWebGLObjects(b);W(o);(this.autoClear||t)&&this.clear();G=b.__webglObjects.length;for(t=0;t<G;t++)if(L=b.__webglObjects[t],$=L.object,$.visible)if(!($ instanceof THREE.Mesh)||!$.frustumCulled||w($)){if($.matrixWorld.flattenToArray($._objectMatrixArray),
|
|
|
+C($,c,!0),p(L),L.render=!0,this.sortObjects)L.object.renderDepth?L.z=L.object.renderDepth:(wa.copy($.position),ua.multiplyVector3(wa),L.z=wa.z)}else L.render=!1;else L.render=!1;this.sortObjects&&b.__webglObjects.sort(y);H=b.__webglObjectsImmediate.length;for(t=0;t<H;t++)L=b.__webglObjectsImmediate[t],$=L.object,$.visible&&($.matrixAutoUpdate&&$.matrixWorld.flattenToArray($._objectMatrixArray),C($,c,!0),x(L));if(b.overrideMaterial){k(b.overrideMaterial.depthTest);J(b.overrideMaterial.blending);for(t=
|
|
|
+0;t<G;t++)if(L=b.__webglObjects[t],L.render)$=L.object,O=L.buffer,m($),f(c,I,qa,b.overrideMaterial,O,$);for(t=0;t<H;t++)L=b.__webglObjectsImmediate[t],$=L.object,$.visible&&(m($),fa=e(c,I,qa,b.overrideMaterial,$),$.render(function(c){h(c,fa,b.overrideMaterial.shading)}))}else{J(THREE.NormalBlending);for(t=G-1;t>=0;t--)if(L=b.__webglObjects[t],L.render){$=L.object;O=L.buffer;P=L.opaque;m($);for(L=0;L<P.count;L++)E=P.list[L],k(E.depthTest),n(E.depthWrite),u(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),
|
|
|
+f(c,I,qa,E,O,$)}for(t=0;t<H;t++)if(L=b.__webglObjectsImmediate[t],$=L.object,$.visible){P=L.opaque;m($);for(L=0;L<P.count;L++)E=P.list[L],k(E.depthTest),n(E.depthWrite),u(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),fa=e(c,I,qa,E,$),$.render(function(b){h(b,fa,E.shading)})}for(t=0;t<G;t++)if(L=b.__webglObjects[t],L.render){$=L.object;O=L.buffer;P=L.transparent;m($);for(L=0;L<P.count;L++)E=P.list[L],J(E.blending),k(E.depthTest),n(E.depthWrite),u(E.polygonOffset,E.polygonOffsetFactor,
|
|
|
+E.polygonOffsetUnits),f(c,I,qa,E,O,$)}for(t=0;t<H;t++)if(L=b.__webglObjectsImmediate[t],$=L.object,$.visible){P=L.transparent;m($);for(L=0;L<P.count;L++)E=P.list[L],J(E.blending),k(E.depthTest),n(E.depthWrite),u(E.polygonOffset,E.polygonOffsetFactor,E.polygonOffsetUnits),fa=e(c,I,qa,E,$),$.render(function(b){h(b,fa,E.shading)})}}b.__webglSprites.length&&A(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&D(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=
|
|
|
[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,h=void 0,k=void 0,m=void 0;if(!e.__webglInit)if(e.__webglInit=!0,e._modelViewMatrix=new THREE.Matrix4,e._normalMatrixArray=new Float32Array(9),e._modelViewMatrixArray=new Float32Array(16),e._objectMatrixArray=new Float32Array(16),e.matrixWorld.flattenToArray(e._objectMatrixArray),e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups==void 0&&N(k),k.geometryGroups){m=k.geometryGroups[h];
|
|
|
if(!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();
|
|
|
-if(n.numMorphTargets){var p=void 0,t=void 0;n.__webglMorphTargetsBuffers=[];p=0;for(t=n.numMorphTargets;p<t;p++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}for(var n=m,p=e,u=void 0,v=void 0,w=void 0,x=w=void 0,L=void 0,y=void 0,ea=y=t=0,P=w=v=void 0,z=P=v=u=void 0,w=void 0,x=p.geometry,L=x.faces,P=n.faces,u=0,v=P.length;u<v;u++)w=P[u],w=L[w],w instanceof THREE.Face3?(t+=3,y+=1,ea+=3):w instanceof THREE.Face4&&(t+=4,y+=2,ea+=4);for(var u=n,v=p,A=P=L=void 0,C=void 0,A=void 0,w=[],L=0,P=v.materials.length;L<
|
|
|
+if(n.numMorphTargets){var t=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];t=0;for(p=n.numMorphTargets;t<p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}for(var n=m,t=e,u=void 0,v=void 0,w=void 0,x=w=void 0,L=void 0,y=void 0,fa=y=p=0,P=w=v=void 0,z=P=v=u=void 0,w=void 0,x=t.geometry,L=x.faces,P=n.faces,u=0,v=P.length;u<v;u++)w=P[u],w=L[w],w instanceof THREE.Face3?(p+=3,y+=1,fa+=3):w instanceof THREE.Face4&&(p+=4,y+=2,fa+=4);for(var u=n,v=t,A=P=L=void 0,C=void 0,A=void 0,w=[],L=0,P=v.materials.length;L<
|
|
|
P;L++)if(A=v.materials[L],A instanceof THREE.MeshFaceMaterial){A=0;for(l=u.materials.length;A<l;A++)(C=u.materials[A])&&w.push(C)}else(C=A)&&w.push(C);u=w;n.__materials=u;a:{L=v=void 0;P=u.length;for(v=0;v<P;v++)if(L=u[v],L.map||L.lightMap||L instanceof THREE.MeshShaderMaterial){v=!0;break a}v=!1}a:{P=L=void 0;w=u.length;for(L=0;L<w;L++)if(P=u[L],!(P instanceof THREE.MeshBasicMaterial&&!P.envMap||P instanceof THREE.MeshDepthMaterial)){P=P&&P.shading!=void 0&&P.shading==THREE.SmoothShading?THREE.SmoothShading:
|
|
|
-THREE.FlatShading;break a}P=!1}a:{w=L=void 0;A=u.length;for(L=0;L<A;L++)if(w=u[L],w.vertexColors){w=w.vertexColors;break a}w=!1}n.__vertexArray=new Float32Array(t*3);if(P)n.__normalArray=new Float32Array(t*3);if(x.hasTangents)n.__tangentArray=new Float32Array(t*4);if(w)n.__colorArray=new Float32Array(t*3);if(v){if(x.faceUvs.length>0||x.faceVertexUvs.length>0)n.__uvArray=new Float32Array(t*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(t*2)}if(p.geometry.skinWeights.length&&
|
|
|
-p.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(t*4),n.__skinVertexBArray=new Float32Array(t*4),n.__skinIndexArray=new Float32Array(t*4),n.__skinWeightArray=new Float32Array(t*4);n.__faceArray=new Uint16Array(y*3+(p.geometry.edgeFaces?p.geometry.edgeFaces.length*6:0));n.__lineArray=new Uint16Array(ea*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];x=0;for(L=n.numMorphTargets;x<L;x++)n.__morphTargetsArrays.push(new Float32Array(t*3))}n.__needsSmoothNormals=P==THREE.SmoothShading;
|
|
|
-n.__uvType=v;n.__vertexColorType=w;n.__normalType=P;n.__webglFaceCount=y*3+(p.geometry.edgeFaces?p.geometry.edgeFaces.length*6:0);n.__webglLineCount=ea*2;x=0;for(L=u.length;x<L;x++)if(v=u[x],v.attributes){if(n.__webglCustomAttributes===void 0)n.__webglCustomAttributes={};for(a in v.attributes){w=v.attributes[a];P={};for(z in w)P[z]=w[z];if(!P.__webglInitialized||P.createUniqueBuffers)P.__webglInitialized=!0,y=1,P.type==="v2"?y=2:P.type==="v3"?y=3:P.type==="v4"?y=4:P.type==="c"&&(y=3),P.size=y,P.array=
|
|
|
-new Float32Array(t*y),P.buffer=o.createBuffer(),P.buffer.belongsToAttribute=a,w.needsUpdate=!0,P.__original=w;n.__webglCustomAttributes[a]=P}}n.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}S(f.__webglObjects,m,e)}else if(e instanceof THREE.Ribbon){k=e.geometry;if(!k.__webglVertexBuffer)h=k,h.__webglVertexBuffer=o.createBuffer(),h.__webglColorBuffer=o.createBuffer(),h=k,m=h.vertices.length,
|
|
|
+THREE.FlatShading;break a}P=!1}a:{w=L=void 0;A=u.length;for(L=0;L<A;L++)if(w=u[L],w.vertexColors){w=w.vertexColors;break a}w=!1}n.__vertexArray=new Float32Array(p*3);if(P)n.__normalArray=new Float32Array(p*3);if(x.hasTangents)n.__tangentArray=new Float32Array(p*4);if(w)n.__colorArray=new Float32Array(p*3);if(v){if(x.faceUvs.length>0||x.faceVertexUvs.length>0)n.__uvArray=new Float32Array(p*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)n.__uv2Array=new Float32Array(p*2)}if(t.geometry.skinWeights.length&&
|
|
|
+t.geometry.skinIndices.length)n.__skinVertexAArray=new Float32Array(p*4),n.__skinVertexBArray=new Float32Array(p*4),n.__skinIndexArray=new Float32Array(p*4),n.__skinWeightArray=new Float32Array(p*4);n.__faceArray=new Uint16Array(y*3+(t.geometry.edgeFaces?t.geometry.edgeFaces.length*6:0));n.__lineArray=new Uint16Array(fa*2);if(n.numMorphTargets){n.__morphTargetsArrays=[];x=0;for(L=n.numMorphTargets;x<L;x++)n.__morphTargetsArrays.push(new Float32Array(p*3))}n.__needsSmoothNormals=P==THREE.SmoothShading;
|
|
|
+n.__uvType=v;n.__vertexColorType=w;n.__normalType=P;n.__webglFaceCount=y*3+(t.geometry.edgeFaces?t.geometry.edgeFaces.length*6:0);n.__webglLineCount=fa*2;x=0;for(L=u.length;x<L;x++)if(v=u[x],v.attributes){if(n.__webglCustomAttributes===void 0)n.__webglCustomAttributes={};for(a in v.attributes){w=v.attributes[a];P={};for(z in w)P[z]=w[z];if(!P.__webglInitialized||P.createUniqueBuffers)P.__webglInitialized=!0,y=1,P.type==="v2"?y=2:P.type==="v3"?y=3:P.type==="v4"?y=4:P.type==="c"&&(y=3),P.size=y,P.array=
|
|
|
+new Float32Array(p*y),P.buffer=o.createBuffer(),P.buffer.belongsToAttribute=a,w.needsUpdate=!0,P.__original=w;n.__webglCustomAttributes[a]=P}}n.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}S(f.__webglObjects,m,e)}else if(e instanceof THREE.Ribbon){k=e.geometry;if(!k.__webglVertexBuffer)h=k,h.__webglVertexBuffer=o.createBuffer(),h.__webglColorBuffer=o.createBuffer(),h=k,m=h.vertices.length,
|
|
|
h.__vertexArray=new Float32Array(m*3),h.__colorArray=new Float32Array(m*3),h.__webglVertexCount=m,k.__dirtyVertices=!0,k.__dirtyColors=!0;S(f.__webglObjects,k,e)}else if(e instanceof THREE.Line){k=e.geometry;if(!k.__webglVertexBuffer)h=k,h.__webglVertexBuffer=o.createBuffer(),h.__webglColorBuffer=o.createBuffer(),h=k,m=h.vertices.length,h.__vertexArray=new Float32Array(m*3),h.__colorArray=new Float32Array(m*3),h.__webglLineCount=m,k.__dirtyVertices=!0,k.__dirtyColors=!0;S(f.__webglObjects,k,e)}else if(e instanceof
|
|
|
-THREE.ParticleSystem){k=e.geometry;if(!k.__webglVertexBuffer){h=k;h.__webglVertexBuffer=o.createBuffer();h.__webglColorBuffer=o.createBuffer();h=k;m=e;n=h.vertices.length;h.__vertexArray=new Float32Array(n*3);h.__colorArray=new Float32Array(n*3);h.__sortArray=[];h.__webglParticleCount=n;h.__materials=m.materials;z=t=p=void 0;p=0;for(t=m.materials.length;p<t;p++)if(z=m.materials[p],z.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in z.attributes){originalAttribute=
|
|
|
+THREE.ParticleSystem){k=e.geometry;if(!k.__webglVertexBuffer){h=k;h.__webglVertexBuffer=o.createBuffer();h.__webglColorBuffer=o.createBuffer();h=k;m=e;n=h.vertices.length;h.__vertexArray=new Float32Array(n*3);h.__colorArray=new Float32Array(n*3);h.__sortArray=[];h.__webglParticleCount=n;h.__materials=m.materials;z=p=t=void 0;t=0;for(p=m.materials.length;t<p;t++)if(z=m.materials[t],z.attributes){if(h.__webglCustomAttributes===void 0)h.__webglCustomAttributes={};for(a in z.attributes){originalAttribute=
|
|
|
z.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(n*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=
|
|
|
originalAttribute;h.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=!0;k.__dirtyColors=!0}S(f.__webglObjects,k,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)H(e.__webglObjects,f);else if(f instanceof THREE.Sprite){e=e.__webglSprites;k=void 0;for(k=e.length-1;k>=0;k--)e[k]==f&&e.splice(k,1)}else f instanceof THREE.MarchingCubes&&H(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(h=b.__webglObjects[e].object,t=m=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(p=k.geometryGroupsList.length;n<p;n++)if(m=k.geometryGroupsList[n],t=E(m),k.__dirtyVertices||k.__dirtyMorphTargets||
|
|
|
-k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||t)if(t=m,z=o.DYNAMIC_DRAW,y=!k.dynamic,t.__inittedArrays){var $=x=ea=void 0,O=void 0,I=$=void 0,qa=void 0,K=void 0,ca=void 0,ha=C=A=w=P=L=v=u=void 0,J=void 0,F=O=ca=O=K=qa=void 0,B=void 0,D=B=F=qa=void 0,X=void 0,ua=D=B=F=$=$=I=ca=O=D=B=F=X=D=B=F=X=D=B=F=void 0,M=0,Y=0,ta=0,fa=0,ya=0,T=0,oa=0,U=0,R=0,Q=0,W=0,D=F=0,D=void 0,V=t.__vertexArray,ma=t.__uvArray,ja=t.__uv2Array,na=t.__normalArray,Z=t.__tangentArray,xa=
|
|
|
-t.__colorArray,aa=t.__skinVertexAArray,ra=t.__skinVertexBArray,ia=t.__skinIndexArray,da=t.__skinWeightArray,pa=t.__morphTargetsArrays,ka=t.__webglCustomAttributes,B=void 0,sa=t.__faceArray,la=t.__lineArray,Fa=t.__needsSmoothNormals,v=t.__vertexColorType,u=t.__uvType,L=t.__normalType,wa=h.geometry,za=wa.__dirtyVertices,Ca=wa.__dirtyElements,Ba=wa.__dirtyUvs,Aa=wa.__dirtyNormals,Ea=wa.__dirtyTangents,ab=wa.__dirtyColors,bb=wa.__dirtyMorphTargets,Oa=wa.vertices,db=t.faces,gb=wa.faces,eb=wa.faceVertexUvs[0],
|
|
|
-fb=wa.faceVertexUvs[1],Pa=wa.skinVerticesA,Qa=wa.skinVerticesB,Ra=wa.skinIndices,Ha=wa.skinWeights,Ga=wa.morphTargets;if(ka)for(ua in ka)ka[ua].offset=0,ka[ua].offsetSrc=0;ea=0;for(x=db.length;ea<x;ea++)if($=db[ea],O=gb[$],eb&&(P=eb[$]),fb&&(w=fb[$]),$=O.vertexNormals,I=O.normal,qa=O.vertexColors,K=O.color,ca=O.vertexTangents,O instanceof THREE.Face3){if(za)A=Oa[O.a].position,C=Oa[O.b].position,ha=Oa[O.c].position,V[Y]=A.x,V[Y+1]=A.y,V[Y+2]=A.z,V[Y+3]=C.x,V[Y+4]=C.y,V[Y+5]=C.z,V[Y+6]=ha.x,V[Y+7]=
|
|
|
+THREE.Ribbon||f instanceof THREE.Line)H(e.__webglObjects,f);else if(f instanceof THREE.Sprite){e=e.__webglSprites;k=void 0;for(k=e.length-1;k>=0;k--)e[k]==f&&e.splice(k,1)}else f instanceof THREE.MarchingCubes&&H(e.__webglObjectsImmediate,f);b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(h=b.__webglObjects[e].object,p=m=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(t=k.geometryGroupsList.length;n<t;n++)if(m=k.geometryGroupsList[n],p=E(m),k.__dirtyVertices||k.__dirtyMorphTargets||
|
|
|
+k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||p)if(p=m,z=o.DYNAMIC_DRAW,y=!k.dynamic,p.__inittedArrays){var $=x=fa=void 0,O=void 0,I=$=void 0,qa=void 0,K=void 0,da=void 0,ha=C=A=w=P=L=v=u=void 0,J=void 0,F=O=da=O=K=qa=void 0,B=void 0,D=B=F=qa=void 0,X=void 0,ua=D=B=F=$=$=I=da=O=D=B=F=X=D=B=F=X=D=B=F=void 0,M=0,Y=0,ta=0,ga=0,ya=0,T=0,oa=0,U=0,R=0,Q=0,W=0,D=F=0,D=void 0,V=p.__vertexArray,ma=p.__uvArray,ja=p.__uv2Array,na=p.__normalArray,Z=p.__tangentArray,xa=
|
|
|
+p.__colorArray,aa=p.__skinVertexAArray,ra=p.__skinVertexBArray,ia=p.__skinIndexArray,ea=p.__skinWeightArray,pa=p.__morphTargetsArrays,ka=p.__webglCustomAttributes,B=void 0,sa=p.__faceArray,la=p.__lineArray,Fa=p.__needsSmoothNormals,v=p.__vertexColorType,u=p.__uvType,L=p.__normalType,wa=h.geometry,za=wa.__dirtyVertices,Ca=wa.__dirtyElements,Ba=wa.__dirtyUvs,Aa=wa.__dirtyNormals,Ea=wa.__dirtyTangents,ab=wa.__dirtyColors,bb=wa.__dirtyMorphTargets,Oa=wa.vertices,db=p.faces,gb=wa.faces,eb=wa.faceVertexUvs[0],
|
|
|
+fb=wa.faceVertexUvs[1],Pa=wa.skinVerticesA,Qa=wa.skinVerticesB,Ra=wa.skinIndices,Ha=wa.skinWeights,Ga=wa.morphTargets;if(ka)for(ua in ka)ka[ua].offset=0,ka[ua].offsetSrc=0;fa=0;for(x=db.length;fa<x;fa++)if($=db[fa],O=gb[$],eb&&(P=eb[$]),fb&&(w=fb[$]),$=O.vertexNormals,I=O.normal,qa=O.vertexColors,K=O.color,da=O.vertexTangents,O instanceof THREE.Face3){if(za)A=Oa[O.a].position,C=Oa[O.b].position,ha=Oa[O.c].position,V[Y]=A.x,V[Y+1]=A.y,V[Y+2]=A.z,V[Y+3]=C.x,V[Y+4]=C.y,V[Y+5]=C.z,V[Y+6]=ha.x,V[Y+7]=
|
|
|
ha.y,V[Y+8]=ha.z,Y+=9;if(ka)for(ua in ka)if(B=ka[ua],B.__original.needsUpdate)F=B.offset,D=B.offsetSrc,B.size===1?(B.boundTo===void 0||B.boundTo==="vertices"?(B.array[F]=B.value[O.a],B.array[F+1]=B.value[O.b],B.array[F+2]=B.value[O.c]):B.boundTo==="faces"?(D=B.value[D],B.array[F]=D,B.array[F+1]=D,B.array[F+2]=D,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[D],B.array[F+1]=B.value[D+1],B.array[F+2]=B.value[D+2],B.offsetSrc+=3),B.offset+=3):(B.boundTo===void 0||B.boundTo==="vertices"?
|
|
|
(A=B.value[O.a],C=B.value[O.b],ha=B.value[O.c]):B.boundTo==="faces"?(ha=C=A=D=B.value[D],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[D],C=B.value[D+1],ha=B.value[D+2],B.offsetSrc+=3),B.size===2?(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=C.x,B.array[F+3]=C.y,B.array[F+4]=ha.x,B.array[F+5]=ha.y,B.offset+=6):B.size===3?(B.type==="c"?(B.array[F]=A.r,B.array[F+1]=A.g,B.array[F+2]=A.b,B.array[F+3]=C.r,B.array[F+4]=C.g,B.array[F+5]=C.b,B.array[F+6]=ha.r,B.array[F+7]=ha.g,B.array[F+8]=ha.b):
|
|
|
(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=C.x,B.array[F+4]=C.y,B.array[F+5]=C.z,B.array[F+6]=ha.x,B.array[F+7]=ha.y,B.array[F+8]=ha.z),B.offset+=9):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=A.w,B.array[F+4]=C.x,B.array[F+5]=C.y,B.array[F+6]=C.z,B.array[F+7]=C.w,B.array[F+8]=ha.x,B.array[F+9]=ha.y,B.array[F+10]=ha.z,B.array[F+11]=ha.w,B.offset+=12));if(bb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[O.a].position,C=Ga[F].vertices[O.b].position,ha=Ga[F].vertices[O.c].position,
|
|
|
-D=pa[F],D[W]=A.x,D[W+1]=A.y,D[W+2]=A.z,D[W+3]=C.x,D[W+4]=C.y,D[W+5]=C.z,D[W+6]=ha.x,D[W+7]=ha.y,D[W+8]=ha.z;W+=9}if(Ha.length)F=Ha[O.a],B=Ha[O.b],D=Ha[O.c],da[Q]=F.x,da[Q+1]=F.y,da[Q+2]=F.z,da[Q+3]=F.w,da[Q+4]=B.x,da[Q+5]=B.y,da[Q+6]=B.z,da[Q+7]=B.w,da[Q+8]=D.x,da[Q+9]=D.y,da[Q+10]=D.z,da[Q+11]=D.w,F=Ra[O.a],B=Ra[O.b],D=Ra[O.c],ia[Q]=F.x,ia[Q+1]=F.y,ia[Q+2]=F.z,ia[Q+3]=F.w,ia[Q+4]=B.x,ia[Q+5]=B.y,ia[Q+6]=B.z,ia[Q+7]=B.w,ia[Q+8]=D.x,ia[Q+9]=D.y,ia[Q+10]=D.z,ia[Q+11]=D.w,F=Pa[O.a],B=Pa[O.b],D=Pa[O.c],
|
|
|
+D=pa[F],D[W]=A.x,D[W+1]=A.y,D[W+2]=A.z,D[W+3]=C.x,D[W+4]=C.y,D[W+5]=C.z,D[W+6]=ha.x,D[W+7]=ha.y,D[W+8]=ha.z;W+=9}if(Ha.length)F=Ha[O.a],B=Ha[O.b],D=Ha[O.c],ea[Q]=F.x,ea[Q+1]=F.y,ea[Q+2]=F.z,ea[Q+3]=F.w,ea[Q+4]=B.x,ea[Q+5]=B.y,ea[Q+6]=B.z,ea[Q+7]=B.w,ea[Q+8]=D.x,ea[Q+9]=D.y,ea[Q+10]=D.z,ea[Q+11]=D.w,F=Ra[O.a],B=Ra[O.b],D=Ra[O.c],ia[Q]=F.x,ia[Q+1]=F.y,ia[Q+2]=F.z,ia[Q+3]=F.w,ia[Q+4]=B.x,ia[Q+5]=B.y,ia[Q+6]=B.z,ia[Q+7]=B.w,ia[Q+8]=D.x,ia[Q+9]=D.y,ia[Q+10]=D.z,ia[Q+11]=D.w,F=Pa[O.a],B=Pa[O.b],D=Pa[O.c],
|
|
|
aa[Q]=F.x,aa[Q+1]=F.y,aa[Q+2]=F.z,aa[Q+3]=1,aa[Q+4]=B.x,aa[Q+5]=B.y,aa[Q+6]=B.z,aa[Q+7]=1,aa[Q+8]=D.x,aa[Q+9]=D.y,aa[Q+10]=D.z,aa[Q+11]=1,F=Qa[O.a],B=Qa[O.b],D=Qa[O.c],ra[Q]=F.x,ra[Q+1]=F.y,ra[Q+2]=F.z,ra[Q+3]=1,ra[Q+4]=B.x,ra[Q+5]=B.y,ra[Q+6]=B.z,ra[Q+7]=1,ra[Q+8]=D.x,ra[Q+9]=D.y,ra[Q+10]=D.z,ra[Q+11]=1,Q+=12;if(ab&&v)qa.length==3&&v==THREE.VertexColors?(O=qa[0],F=qa[1],B=qa[2]):B=F=O=K,xa[R]=O.r,xa[R+1]=O.g,xa[R+2]=O.b,xa[R+3]=F.r,xa[R+4]=F.g,xa[R+5]=F.b,xa[R+6]=B.r,xa[R+7]=B.g,xa[R+8]=B.b,R+=9;
|
|
|
-if(Ea&&wa.hasTangents)qa=ca[0],K=ca[1],O=ca[2],Z[oa]=qa.x,Z[oa+1]=qa.y,Z[oa+2]=qa.z,Z[oa+3]=qa.w,Z[oa+4]=K.x,Z[oa+5]=K.y,Z[oa+6]=K.z,Z[oa+7]=K.w,Z[oa+8]=O.x,Z[oa+9]=O.y,Z[oa+10]=O.z,Z[oa+11]=O.w,oa+=12;if(Aa&&L)if($.length==3&&Fa)for(ca=0;ca<3;ca++)I=$[ca],na[T]=I.x,na[T+1]=I.y,na[T+2]=I.z,T+=3;else for(ca=0;ca<3;ca++)na[T]=I.x,na[T+1]=I.y,na[T+2]=I.z,T+=3;if(Ba&&P!==void 0&&u)for(ca=0;ca<3;ca++)$=P[ca],ma[ta]=$.u,ma[ta+1]=$.v,ta+=2;if(Ba&&w!==void 0&&u)for(ca=0;ca<3;ca++)$=w[ca],ja[fa]=$.u,ja[fa+
|
|
|
-1]=$.v,fa+=2;Ca&&(sa[ya]=M,sa[ya+1]=M+1,sa[ya+2]=M+2,ya+=3,la[U]=M,la[U+1]=M+1,la[U+2]=M,la[U+3]=M+2,la[U+4]=M+1,la[U+5]=M+2,U+=6,M+=3)}else if(O instanceof THREE.Face4){if(za)A=Oa[O.a].position,C=Oa[O.b].position,ha=Oa[O.c].position,J=Oa[O.d].position,V[Y]=A.x,V[Y+1]=A.y,V[Y+2]=A.z,V[Y+3]=C.x,V[Y+4]=C.y,V[Y+5]=C.z,V[Y+6]=ha.x,V[Y+7]=ha.y,V[Y+8]=ha.z,V[Y+9]=J.x,V[Y+10]=J.y,V[Y+11]=J.z,Y+=12;if(ka)for(ua in ka)if(B=ka[ua],B.__original.needsUpdate)F=B.offset,D=B.offsetSrc,B.size===1?(B.boundTo===void 0||
|
|
|
+if(Ea&&wa.hasTangents)qa=da[0],K=da[1],O=da[2],Z[oa]=qa.x,Z[oa+1]=qa.y,Z[oa+2]=qa.z,Z[oa+3]=qa.w,Z[oa+4]=K.x,Z[oa+5]=K.y,Z[oa+6]=K.z,Z[oa+7]=K.w,Z[oa+8]=O.x,Z[oa+9]=O.y,Z[oa+10]=O.z,Z[oa+11]=O.w,oa+=12;if(Aa&&L)if($.length==3&&Fa)for(da=0;da<3;da++)I=$[da],na[T]=I.x,na[T+1]=I.y,na[T+2]=I.z,T+=3;else for(da=0;da<3;da++)na[T]=I.x,na[T+1]=I.y,na[T+2]=I.z,T+=3;if(Ba&&P!==void 0&&u)for(da=0;da<3;da++)$=P[da],ma[ta]=$.u,ma[ta+1]=$.v,ta+=2;if(Ba&&w!==void 0&&u)for(da=0;da<3;da++)$=w[da],ja[ga]=$.u,ja[ga+
|
|
|
+1]=$.v,ga+=2;Ca&&(sa[ya]=M,sa[ya+1]=M+1,sa[ya+2]=M+2,ya+=3,la[U]=M,la[U+1]=M+1,la[U+2]=M,la[U+3]=M+2,la[U+4]=M+1,la[U+5]=M+2,U+=6,M+=3)}else if(O instanceof THREE.Face4){if(za)A=Oa[O.a].position,C=Oa[O.b].position,ha=Oa[O.c].position,J=Oa[O.d].position,V[Y]=A.x,V[Y+1]=A.y,V[Y+2]=A.z,V[Y+3]=C.x,V[Y+4]=C.y,V[Y+5]=C.z,V[Y+6]=ha.x,V[Y+7]=ha.y,V[Y+8]=ha.z,V[Y+9]=J.x,V[Y+10]=J.y,V[Y+11]=J.z,Y+=12;if(ka)for(ua in ka)if(B=ka[ua],B.__original.needsUpdate)F=B.offset,D=B.offsetSrc,B.size===1?(B.boundTo===void 0||
|
|
|
B.boundTo==="vertices"?(B.array[F]=B.value[O.a],B.array[F+1]=B.value[O.b],B.array[F+2]=B.value[O.c],B.array[F+3]=B.value[O.d]):B.boundTo==="faces"?(D=B.value[D],B.array[F]=D,B.array[F+1]=D,B.array[F+2]=D,B.array[F+3]=D,B.offsetSrc++):B.boundTo==="faceVertices"&&(B.array[F]=B.value[D],B.array[F+1]=B.value[D+1],B.array[F+2]=B.value[D+2],B.array[F+3]=B.value[D+3],B.offsetSrc+=4),B.offset+=4):(B.boundTo===void 0||B.boundTo==="vertices"?(A=B.value[O.a],C=B.value[O.b],ha=B.value[O.c],J=B.value[O.d]):B.boundTo===
|
|
|
"faces"?(J=ha=C=A=D=B.value[D],B.offsetSrc++):B.boundTo==="faceVertices"&&(A=B.value[D],C=B.value[D+1],ha=B.value[D+2],J=B.value[D+3],B.offsetSrc+=4),B.size===2?(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=C.x,B.array[F+3]=C.y,B.array[F+4]=ha.x,B.array[F+5]=ha.y,B.array[F+6]=J.x,B.array[F+7]=J.y,B.offset+=8):B.size===3?(B.type==="c"?(B.array[F]=A.r,B.array[F+1]=A.g,B.array[F+2]=A.b,B.array[F+3]=C.r,B.array[F+4]=C.g,B.array[F+5]=C.b,B.array[F+6]=ha.r,B.array[F+7]=ha.g,B.array[F+8]=ha.b,B.array[F+
|
|
|
9]=J.r,B.array[F+10]=J.g,B.array[F+11]=J.b):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=C.x,B.array[F+4]=C.y,B.array[F+5]=C.z,B.array[F+6]=ha.x,B.array[F+7]=ha.y,B.array[F+8]=ha.z,B.array[F+9]=J.x,B.array[F+10]=J.y,B.array[F+11]=J.z),B.offset+=12):(B.array[F]=A.x,B.array[F+1]=A.y,B.array[F+2]=A.z,B.array[F+3]=A.w,B.array[F+4]=C.x,B.array[F+5]=C.y,B.array[F+6]=C.z,B.array[F+7]=C.w,B.array[F+8]=ha.x,B.array[F+9]=ha.y,B.array[F+10]=ha.z,B.array[F+11]=ha.w,B.array[F+12]=J.x,B.array[F+
|
|
|
-13]=J.y,B.array[F+14]=J.z,B.array[F+15]=J.w,B.offset+=16));if(bb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[O.a].position,C=Ga[F].vertices[O.b].position,ha=Ga[F].vertices[O.c].position,J=Ga[F].vertices[O.d].position,D=pa[F],D[W]=A.x,D[W+1]=A.y,D[W+2]=A.z,D[W+3]=C.x,D[W+4]=C.y,D[W+5]=C.z,D[W+6]=ha.x,D[W+7]=ha.y,D[W+8]=ha.z,D[W+9]=J.x,D[W+10]=J.y,D[W+11]=J.z;W+=12}if(Ha.length)F=Ha[O.a],B=Ha[O.b],D=Ha[O.c],X=Ha[O.d],da[Q]=F.x,da[Q+1]=F.y,da[Q+2]=F.z,da[Q+3]=F.w,da[Q+4]=B.x,da[Q+5]=B.y,da[Q+6]=B.z,
|
|
|
-da[Q+7]=B.w,da[Q+8]=D.x,da[Q+9]=D.y,da[Q+10]=D.z,da[Q+11]=D.w,da[Q+12]=X.x,da[Q+13]=X.y,da[Q+14]=X.z,da[Q+15]=X.w,F=Ra[O.a],B=Ra[O.b],D=Ra[O.c],X=Ra[O.d],ia[Q]=F.x,ia[Q+1]=F.y,ia[Q+2]=F.z,ia[Q+3]=F.w,ia[Q+4]=B.x,ia[Q+5]=B.y,ia[Q+6]=B.z,ia[Q+7]=B.w,ia[Q+8]=D.x,ia[Q+9]=D.y,ia[Q+10]=D.z,ia[Q+11]=D.w,ia[Q+12]=X.x,ia[Q+13]=X.y,ia[Q+14]=X.z,ia[Q+15]=X.w,F=Pa[O.a],B=Pa[O.b],D=Pa[O.c],X=Pa[O.d],aa[Q]=F.x,aa[Q+1]=F.y,aa[Q+2]=F.z,aa[Q+3]=1,aa[Q+4]=B.x,aa[Q+5]=B.y,aa[Q+6]=B.z,aa[Q+7]=1,aa[Q+8]=D.x,aa[Q+9]=D.y,
|
|
|
+13]=J.y,B.array[F+14]=J.z,B.array[F+15]=J.w,B.offset+=16));if(bb){F=0;for(B=Ga.length;F<B;F++)A=Ga[F].vertices[O.a].position,C=Ga[F].vertices[O.b].position,ha=Ga[F].vertices[O.c].position,J=Ga[F].vertices[O.d].position,D=pa[F],D[W]=A.x,D[W+1]=A.y,D[W+2]=A.z,D[W+3]=C.x,D[W+4]=C.y,D[W+5]=C.z,D[W+6]=ha.x,D[W+7]=ha.y,D[W+8]=ha.z,D[W+9]=J.x,D[W+10]=J.y,D[W+11]=J.z;W+=12}if(Ha.length)F=Ha[O.a],B=Ha[O.b],D=Ha[O.c],X=Ha[O.d],ea[Q]=F.x,ea[Q+1]=F.y,ea[Q+2]=F.z,ea[Q+3]=F.w,ea[Q+4]=B.x,ea[Q+5]=B.y,ea[Q+6]=B.z,
|
|
|
+ea[Q+7]=B.w,ea[Q+8]=D.x,ea[Q+9]=D.y,ea[Q+10]=D.z,ea[Q+11]=D.w,ea[Q+12]=X.x,ea[Q+13]=X.y,ea[Q+14]=X.z,ea[Q+15]=X.w,F=Ra[O.a],B=Ra[O.b],D=Ra[O.c],X=Ra[O.d],ia[Q]=F.x,ia[Q+1]=F.y,ia[Q+2]=F.z,ia[Q+3]=F.w,ia[Q+4]=B.x,ia[Q+5]=B.y,ia[Q+6]=B.z,ia[Q+7]=B.w,ia[Q+8]=D.x,ia[Q+9]=D.y,ia[Q+10]=D.z,ia[Q+11]=D.w,ia[Q+12]=X.x,ia[Q+13]=X.y,ia[Q+14]=X.z,ia[Q+15]=X.w,F=Pa[O.a],B=Pa[O.b],D=Pa[O.c],X=Pa[O.d],aa[Q]=F.x,aa[Q+1]=F.y,aa[Q+2]=F.z,aa[Q+3]=1,aa[Q+4]=B.x,aa[Q+5]=B.y,aa[Q+6]=B.z,aa[Q+7]=1,aa[Q+8]=D.x,aa[Q+9]=D.y,
|
|
|
aa[Q+10]=D.z,aa[Q+11]=1,aa[Q+12]=X.x,aa[Q+13]=X.y,aa[Q+14]=X.z,aa[Q+15]=1,F=Qa[O.a],B=Qa[O.b],D=Qa[O.c],O=Qa[O.d],ra[Q]=F.x,ra[Q+1]=F.y,ra[Q+2]=F.z,ra[Q+3]=1,ra[Q+4]=B.x,ra[Q+5]=B.y,ra[Q+6]=B.z,ra[Q+7]=1,ra[Q+8]=D.x,ra[Q+9]=D.y,ra[Q+10]=D.z,ra[Q+11]=1,ra[Q+12]=O.x,ra[Q+13]=O.y,ra[Q+14]=O.z,ra[Q+15]=1,Q+=16;if(ab&&v)qa.length==4&&v==THREE.VertexColors?(O=qa[0],F=qa[1],B=qa[2],qa=qa[3]):qa=B=F=O=K,xa[R]=O.r,xa[R+1]=O.g,xa[R+2]=O.b,xa[R+3]=F.r,xa[R+4]=F.g,xa[R+5]=F.b,xa[R+6]=B.r,xa[R+7]=B.g,xa[R+8]=
|
|
|
-B.b,xa[R+9]=qa.r,xa[R+10]=qa.g,xa[R+11]=qa.b,R+=12;if(Ea&&wa.hasTangents)qa=ca[0],K=ca[1],O=ca[2],ca=ca[3],Z[oa]=qa.x,Z[oa+1]=qa.y,Z[oa+2]=qa.z,Z[oa+3]=qa.w,Z[oa+4]=K.x,Z[oa+5]=K.y,Z[oa+6]=K.z,Z[oa+7]=K.w,Z[oa+8]=O.x,Z[oa+9]=O.y,Z[oa+10]=O.z,Z[oa+11]=O.w,Z[oa+12]=ca.x,Z[oa+13]=ca.y,Z[oa+14]=ca.z,Z[oa+15]=ca.w,oa+=16;if(Aa&&L)if($.length==4&&Fa)for(ca=0;ca<4;ca++)I=$[ca],na[T]=I.x,na[T+1]=I.y,na[T+2]=I.z,T+=3;else for(ca=0;ca<4;ca++)na[T]=I.x,na[T+1]=I.y,na[T+2]=I.z,T+=3;if(Ba&&P!==void 0&&u)for(ca=
|
|
|
-0;ca<4;ca++)$=P[ca],ma[ta]=$.u,ma[ta+1]=$.v,ta+=2;if(Ba&&w!==void 0&&u)for(ca=0;ca<4;ca++)$=w[ca],ja[fa]=$.u,ja[fa+1]=$.v,fa+=2;Ca&&(sa[ya]=M,sa[ya+1]=M+1,sa[ya+2]=M+3,sa[ya+3]=M+1,sa[ya+4]=M+2,sa[ya+5]=M+3,ya+=6,la[U]=M,la[U+1]=M+1,la[U+2]=M,la[U+3]=M+3,la[U+4]=M+1,la[U+5]=M+2,la[U+6]=M+2,la[U+7]=M+3,U+=8,M+=4)}za&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,V,z));if(ka)for(ua in ka)B=ka[ua],B.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,B.buffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
-B.array,z));if(bb){F=0;for(B=Ga.length;F<B;F++)o.bindBuffer(o.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[F]),o.bufferData(o.ARRAY_BUFFER,pa[F],z)}ab&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,xa,z));Aa&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,na,z));Ea&&wa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,Z,z));Ba&&ta>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
-ma,z));Ba&&fa>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Ca&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,sa,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,la,z));Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,z),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ra,z),o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
-t.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ia,z),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,da,z));y&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=
|
|
|
-!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;G(m)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=ea=y=y=void 0;x=h.vertices;p=h.colors;u=x.length;t=p.length;v=h.__vertexArray;z=h.__colorArray;L=h.__dirtyColors;if(h.__dirtyVertices){for(y=0;y<u;y++)ea=x[y].position,n=y*3,v[n]=ea.x,v[n+1]=ea.y,v[n+2]=ea.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,
|
|
|
-v,m)}if(L){for(y=0;y<t;y++)color=p[y],n=y*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=ea=y=y=void 0;x=h.vertices;p=h.colors;u=x.length;t=p.length;v=h.__vertexArray;z=h.__colorArray;L=h.__dirtyColors;if(h.__dirtyVertices){for(y=0;y<u;y++)ea=x[y].position,n=y*3,v[n]=ea.x,
|
|
|
-v[n+1]=ea.y,v[n+2]=ea.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,v,m)}if(L){for(y=0;y<t;y++)color=p[y],n=y*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)k=h.geometry,t=E(k),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||t)&&c(k,o.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,G(k)};
|
|
|
+B.b,xa[R+9]=qa.r,xa[R+10]=qa.g,xa[R+11]=qa.b,R+=12;if(Ea&&wa.hasTangents)qa=da[0],K=da[1],O=da[2],da=da[3],Z[oa]=qa.x,Z[oa+1]=qa.y,Z[oa+2]=qa.z,Z[oa+3]=qa.w,Z[oa+4]=K.x,Z[oa+5]=K.y,Z[oa+6]=K.z,Z[oa+7]=K.w,Z[oa+8]=O.x,Z[oa+9]=O.y,Z[oa+10]=O.z,Z[oa+11]=O.w,Z[oa+12]=da.x,Z[oa+13]=da.y,Z[oa+14]=da.z,Z[oa+15]=da.w,oa+=16;if(Aa&&L)if($.length==4&&Fa)for(da=0;da<4;da++)I=$[da],na[T]=I.x,na[T+1]=I.y,na[T+2]=I.z,T+=3;else for(da=0;da<4;da++)na[T]=I.x,na[T+1]=I.y,na[T+2]=I.z,T+=3;if(Ba&&P!==void 0&&u)for(da=
|
|
|
+0;da<4;da++)$=P[da],ma[ta]=$.u,ma[ta+1]=$.v,ta+=2;if(Ba&&w!==void 0&&u)for(da=0;da<4;da++)$=w[da],ja[ga]=$.u,ja[ga+1]=$.v,ga+=2;Ca&&(sa[ya]=M,sa[ya+1]=M+1,sa[ya+2]=M+3,sa[ya+3]=M+1,sa[ya+4]=M+2,sa[ya+5]=M+3,ya+=6,la[U]=M,la[U+1]=M+1,la[U+2]=M,la[U+3]=M+3,la[U+4]=M+1,la[U+5]=M+2,la[U+6]=M+2,la[U+7]=M+3,U+=8,M+=4)}za&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,V,z));if(ka)for(ua in ka)B=ka[ua],B.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,B.buffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
+B.array,z));if(bb){F=0;for(B=Ga.length;F<B;F++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[F]),o.bufferData(o.ARRAY_BUFFER,pa[F],z)}ab&&R>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,xa,z));Aa&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,na,z));Ea&&wa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,Z,z));Ba&&ta>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
+ma,z));Ba&&ga>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,ja,z));Ca&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,sa,z),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,la,z));Q>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ra,z),o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
+p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ia,z),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,ea,z));y&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=
|
|
|
+!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;G(m)}else if(h instanceof THREE.Ribbon){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=fa=y=y=void 0;x=h.vertices;t=h.colors;u=x.length;p=t.length;v=h.__vertexArray;z=h.__colorArray;L=h.__dirtyColors;if(h.__dirtyVertices){for(y=0;y<u;y++)fa=x[y].position,n=y*3,v[n]=fa.x,v[n+1]=fa.y,v[n+2]=fa.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,
|
|
|
+v,m)}if(L){for(y=0;y<p;y++)color=t[y],n=y*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=fa=y=y=void 0;x=h.vertices;t=h.colors;u=x.length;p=t.length;v=h.__vertexArray;z=h.__colorArray;L=h.__dirtyColors;if(h.__dirtyVertices){for(y=0;y<u;y++)fa=x[y].position,n=y*3,v[n]=fa.x,
|
|
|
+v[n+1]=fa.y,v[n+2]=fa.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,v,m)}if(L){for(y=0;y<p;y++)color=t[y],n=y*3,z[n]=color.r,z[n+1]=color.g,z[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)k=h.geometry,p=E(k),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||p)&&c(k,o.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,G(k)};
|
|
|
this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Fa}};
|
|
|
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};
|
|
@@ -342,17 +342,17 @@ 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 h=THREE.ColorUtils.__hsv;THREE.ColorUtils.rgbToHsv(b,h);h.h=THREE.ColorUtils.clamp(h.h+c,0,1);h.s=THREE.ColorUtils.clamp(h.s+e,0,1);h.v=THREE.ColorUtils.clamp(h.v+f,0,1);b.setHSV(h.h,h.s,h.v)},rgbToHsv:function(b,c){var e=b.r,f=b.g,h=b.b,m=Math.max(Math.max(e,f),h),k=Math.min(Math.min(e,f),h);if(k==m)k=e=0;else{var n=m-k,k=n/m,e=e==m?(f-h)/n:f==m?2+(h-e)/n:4+(e-f)/n;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=k;c.v=m;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,f,h=b.vertices.length,m=c instanceof THREE.Mesh?c.geometry:c,k=b.vertices,n=m.vertices,u=b.faces,v=m.faces,w=b.faceVertexUvs[0],m=m.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),e=c.matrix,f=new THREE.Matrix4,f.extractRotation(e,c.scale);for(var p=0,x=n.length;p<x;p++){var t=new THREE.Vertex(n[p].position.clone());e&&e.multiplyVector3(t.position);k.push(t)}p=0;for(x=v.length;p<x;p++){var t=v[p],y,z,A=t.vertexNormals,
|
|
|
-C=t.vertexColors;t instanceof THREE.Face3?y=new THREE.Face3(t.a+h,t.b+h,t.c+h):t instanceof THREE.Face4&&(y=new THREE.Face4(t.a+h,t.b+h,t.c+h,t.d+h));y.normal.copy(t.normal);f&&f.multiplyVector3(y.normal);k=0;for(n=A.length;k<n;k++)z=A[k].clone(),f&&f.multiplyVector3(z),y.vertexNormals.push(z);y.color.copy(t.color);k=0;for(n=C.length;k<n;k++)z=C[k],y.vertexColors.push(z.clone());y.materials=t.materials.slice();y.centroid.copy(t.centroid);e&&e.multiplyVector3(y.centroid);u.push(y)}p=0;for(x=m.length;p<
|
|
|
-x;p++){e=m[p];f=[];k=0;for(n=e.length;k<n;k++)f.push(new THREE.UV(e[k].u,e[k].v));w.push(f)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,m=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var k=new THREE.Vertex(f[b].position.clone());c.vertices.push(k)}b=0;for(e=h.length;b<e;b++){var n=h[b],u,v,w=n.vertexNormals,p=n.vertexColors;n instanceof THREE.Face3?u=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(u=new THREE.Face4(n.a,n.b,n.c,n.d));u.normal.copy(n.normal);f=0;
|
|
|
-for(k=w.length;f<k;f++)v=w[f],u.vertexNormals.push(v.clone());u.color.copy(n.color);f=0;for(k=p.length;f<k;f++)v=p[f],u.vertexColors.push(v.clone());u.materials=n.materials.slice();u.centroid.copy(n.centroid);c.faces.push(u)}b=0;for(e=m.length;b<e;b++){h=m[b];u=[];f=0;for(k=h.length;f<k;f++)u.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(u)}return c},randomPointInTriangle:function(b,c,e){var f,h,m,k=new THREE.Vector3,n=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();
|
|
|
+THREE.GeometryUtils={merge:function(b,c){var e,f,h=b.vertices.length,m=c instanceof THREE.Mesh?c.geometry:c,k=b.vertices,n=m.vertices,u=b.faces,v=m.faces,w=b.faceVertexUvs[0],m=m.faceVertexUvs[0];if(c instanceof THREE.Mesh)c.matrixAutoUpdate&&c.updateMatrix(),e=c.matrix,f=new THREE.Matrix4,f.extractRotation(e,c.scale);for(var t=0,x=n.length;t<x;t++){var p=new THREE.Vertex(n[t].position.clone());e&&e.multiplyVector3(p.position);k.push(p)}t=0;for(x=v.length;t<x;t++){var p=v[t],y,z,A=p.vertexNormals,
|
|
|
+C=p.vertexColors;p instanceof THREE.Face3?y=new THREE.Face3(p.a+h,p.b+h,p.c+h):p instanceof THREE.Face4&&(y=new THREE.Face4(p.a+h,p.b+h,p.c+h,p.d+h));y.normal.copy(p.normal);f&&f.multiplyVector3(y.normal);k=0;for(n=A.length;k<n;k++)z=A[k].clone(),f&&f.multiplyVector3(z),y.vertexNormals.push(z);y.color.copy(p.color);k=0;for(n=C.length;k<n;k++)z=C[k],y.vertexColors.push(z.clone());y.materials=p.materials.slice();y.centroid.copy(p.centroid);e&&e.multiplyVector3(y.centroid);u.push(y)}t=0;for(x=m.length;t<
|
|
|
+x;t++){e=m[t];f=[];k=0;for(n=e.length;k<n;k++)f.push(new THREE.UV(e[k].u,e[k].v));w.push(f)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,m=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var k=new THREE.Vertex(f[b].position.clone());c.vertices.push(k)}b=0;for(e=h.length;b<e;b++){var n=h[b],u,v,w=n.vertexNormals,t=n.vertexColors;n instanceof THREE.Face3?u=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(u=new THREE.Face4(n.a,n.b,n.c,n.d));u.normal.copy(n.normal);f=0;
|
|
|
+for(k=w.length;f<k;f++)v=w[f],u.vertexNormals.push(v.clone());u.color.copy(n.color);f=0;for(k=t.length;f<k;f++)v=t[f],u.vertexColors.push(v.clone());u.materials=n.materials.slice();u.centroid.copy(n.centroid);c.faces.push(u)}b=0;for(e=m.length;b<e;b++){h=m[b];u=[];f=0;for(k=h.length;f<k;f++)u.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(u)}return c},randomPointInTriangle:function(b,c,e){var f,h,m,k=new THREE.Vector3,n=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();
|
|
|
f+h>1&&(f=1-f,h=1-h);m=1-f-h;k.copy(b);k.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);k.addSelf(n);n.copy(e);n.multiplyScalar(m);k.addSelf(n);return k},randomPointInFace:function(b,c,e){var f,h,m;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,m=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,m);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;m=c.vertices[b.c].position;var c=c.vertices[b.d].position,
|
|
|
k;e?b._area1&&b._area2?(e=b._area1,k=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),k=THREE.GeometryUtils.triangleArea(h,m,c),b._area1=e,b._area2=k):(e=THREE.GeometryUtils.triangleArea(f,h,c),k=THREE.GeometryUtils.triangleArea(h,m,c));return THREE.GeometryUtils.random()*(e+k)<e?THREE.GeometryUtils.randomPointInTriangle(f,h,c):THREE.GeometryUtils.randomPointInTriangle(h,m,c)}},randomPointsInGeometry:function(b,c){function e(b){function e(c,f){if(f<c)return c;var h=c+Math.floor((f-c)/2);return v[h]>
|
|
|
-b?e(c,h-1):v[h]<b?e(h+1,f):h}return e(0,v.length-1)}var f,h,m=b.faces,k=b.vertices,n=m.length,u=0,v=[],w,p,x,t;for(h=0;h<n;h++){f=m[h];if(f instanceof THREE.Face3)w=k[f.a].position,p=k[f.b].position,x=k[f.c].position,f._area=THREE.GeometryUtils.triangleArea(w,p,x);else if(f instanceof THREE.Face4)w=k[f.a].position,p=k[f.b].position,x=k[f.c].position,t=k[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(w,p,t),f._area2=THREE.GeometryUtils.triangleArea(p,x,t),f._area=f._area1+f._area2;u+=f._area;
|
|
|
+b?e(c,h-1):v[h]<b?e(h+1,f):h}return e(0,v.length-1)}var f,h,m=b.faces,k=b.vertices,n=m.length,u=0,v=[],w,t,x,p;for(h=0;h<n;h++){f=m[h];if(f instanceof THREE.Face3)w=k[f.a].position,t=k[f.b].position,x=k[f.c].position,f._area=THREE.GeometryUtils.triangleArea(w,t,x);else if(f instanceof THREE.Face4)w=k[f.a].position,t=k[f.b].position,x=k[f.c].position,p=k[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(w,t,p),f._area2=THREE.GeometryUtils.triangleArea(t,x,p),f._area=f._area1+f._area2;u+=f._area;
|
|
|
v[h]=u}f=[];k={};for(h=0;h<c;h++)n=THREE.GeometryUtils.random()*u,n=e(n),f[h]=THREE.GeometryUtils.randomPointInFace(m[n],b,!0),k[n]?k[n]+=1:k[n]=1;return f},triangleArea:function(b,c,e){var f,h=THREE.GeometryUtils.__v1;h.sub(b,c);f=h.length();h.sub(b,e);b=h.length();h.sub(c,e);e=h.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,h=new THREE.Texture(f,c);f.onload=function(){h.needsUpdate=!0;e&&e(this)};f.crossOrigin="";f.src=b;return h},loadTextureCube:function(b,c,e){var f,h=[],m=new THREE.Texture(h,c),c=h.loadCount=0;for(f=b.length;c<f;++c)h[c]=new Image,h[c].onload=function(){h.loadCount+=1;if(h.loadCount==6)m.needsUpdate=!0;e&&e(this)},h[c].crossOrigin="",h[c].src=b[c];return m},getNormalMap:function(b,c){var e=function(b){var e=Math.sqrt(b[0]*b[0]+b[1]*b[1]+
|
|
|
-b[2]*b[2]);return[b[0]/e,b[1]/e,b[2]/e]};c|=1;var f=b.width,h=b.height,m=document.createElement("canvas");m.width=f;m.height=h;var k=m.getContext("2d");k.drawImage(b,0,0);for(var n=k.getImageData(0,0,f,h).data,u=k.createImageData(f,h),v=u.data,w=0;w<f;w++)for(var p=1;p<h;p++){var x=p-1<0?h-1:p-1,t=(p+1)%h,y=w-1<0?f-1:w-1,z=(w+1)%f,A=[],C=[0,0,n[(p*f+w)*4]/255*c];A.push([-1,0,n[(p*f+y)*4]/255*c]);A.push([-1,-1,n[(x*f+y)*4]/255*c]);A.push([0,-1,n[(x*f+w)*4]/255*c]);A.push([1,-1,n[(x*f+z)*4]/255*c]);
|
|
|
-A.push([1,0,n[(p*f+z)*4]/255*c]);A.push([1,1,n[(t*f+z)*4]/255*c]);A.push([0,1,n[(t*f+w)*4]/255*c]);A.push([-1,1,n[(t*f+y)*4]/255*c]);x=[];y=A.length;for(t=0;t<y;t++){var z=A[t],E=A[(t+1)%y],z=[z[0]-C[0],z[1]-C[1],z[2]-C[2]],E=[E[0]-C[0],E[1]-C[1],E[2]-C[2]];x.push(e([z[1]*E[2]-z[2]*E[1],z[2]*E[0]-z[0]*E[2],z[0]*E[1]-z[1]*E[0]]))}A=[0,0,0];for(t=0;t<x.length;t++)A[0]+=x[t][0],A[1]+=x[t][1],A[2]+=x[t][2];A[0]/=x.length;A[1]/=x.length;A[2]/=x.length;C=(p*f+w)*4;v[C]=(A[0]+1)/2*255|0;v[C+1]=(A[1]+0.5)*
|
|
|
+b[2]*b[2]);return[b[0]/e,b[1]/e,b[2]/e]};c|=1;var f=b.width,h=b.height,m=document.createElement("canvas");m.width=f;m.height=h;var k=m.getContext("2d");k.drawImage(b,0,0);for(var n=k.getImageData(0,0,f,h).data,u=k.createImageData(f,h),v=u.data,w=0;w<f;w++)for(var t=1;t<h;t++){var x=t-1<0?h-1:t-1,p=(t+1)%h,y=w-1<0?f-1:w-1,z=(w+1)%f,A=[],C=[0,0,n[(t*f+w)*4]/255*c];A.push([-1,0,n[(t*f+y)*4]/255*c]);A.push([-1,-1,n[(x*f+y)*4]/255*c]);A.push([0,-1,n[(x*f+w)*4]/255*c]);A.push([1,-1,n[(x*f+z)*4]/255*c]);
|
|
|
+A.push([1,0,n[(t*f+z)*4]/255*c]);A.push([1,1,n[(p*f+z)*4]/255*c]);A.push([0,1,n[(p*f+w)*4]/255*c]);A.push([-1,1,n[(p*f+y)*4]/255*c]);x=[];y=A.length;for(p=0;p<y;p++){var z=A[p],E=A[(p+1)%y],z=[z[0]-C[0],z[1]-C[1],z[2]-C[2]],E=[E[0]-C[0],E[1]-C[1],E[2]-C[2]];x.push(e([z[1]*E[2]-z[2]*E[1],z[2]*E[0]-z[0]*E[2],z[0]*E[1]-z[1]*E[0]]))}A=[0,0,0];for(p=0;p<x.length;p++)A[0]+=x[p][0],A[1]+=x[p][1],A[2]+=x[p][2];A[0]/=x.length;A[1]/=x.length;A[2]/=x.length;C=(t*f+w)*4;v[C]=(A[0]+1)/2*255|0;v[C+1]=(A[1]+0.5)*
|
|
|
255|0;v[C+2]=A[2]*255|0;v[C+3]=255}k.putImageData(u,0,0);return m}};THREE.SceneUtils={showHierarchy:function(b,c){THREE.SceneUtils.traverseHierarchy(b,function(b){b.visible=c})},traverseHierarchy:function(b,c){var e,f,h=b.children.length;for(f=0;f<h;f++)e=b.children[f],c(e),THREE.SceneUtils.traverseHierarchy(e,c)}};
|
|
|
if(THREE.WebGLRenderer)THREE.ShaderUtils={lib:{fresnel:{uniforms:{mRefractionRatio:{type:"f",value:1.02},mFresnelBias:{type:"f",value:0.1},mFresnelPower:{type:"f",value:2},mFresnelScale:{type:"f",value:1},tCube:{type:"t",value:1,texture:null}},fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );\nvec4 refractedColor = vec4( 1.0, 1.0, 1.0, 1.0 );\nrefractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;\nrefractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;\nrefractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;\nrefractedColor.a = 1.0;\ngl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );\n}",
|
|
|
vertexShader:"uniform float mRefractionRatio;\nuniform float mFresnelBias;\nuniform float mFresnelScale;\nuniform float mFresnelPower;\nvarying vec3 vReflect;\nvarying vec3 vRefract[3];\nvarying float vReflectionFactor;\nvoid main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = normalize ( mat3( objectMatrix[0].xyz, objectMatrix[1].xyz, objectMatrix[2].xyz ) * normal );\nvec3 I = mPosition.xyz - cameraPosition;\nvReflect = reflect( I, nWorld );\nvRefract[0] = refract( normalize( I ), nWorld, mRefractionRatio );\nvRefract[1] = refract( normalize( I ), nWorld, mRefractionRatio * 0.99 );\nvRefract[2] = refract( normalize( I ), nWorld, mRefractionRatio * 0.98 );\nvReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), nWorld ), mFresnelPower );\ngl_Position = projectionMatrix * mvPosition;\n}"},
|
|
@@ -388,18 +388,18 @@ THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var h=Array.prototype.sl
|
|
|
THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,h,m){var k=Array.prototype.slice.call(arguments),n=this.actions[this.actions.length-1].args;this.curves.push(new THREE.CubicBezierCurve(new THREE.Vector2(n[n.length-2],n[n.length-1]),new THREE.Vector2(b,c),new THREE.Vector2(e,f),new THREE.Vector2(h,m)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:k})};
|
|
|
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,h,m){var k=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,h,m));this.actions.push({action:THREE.PathActions.ARC,args:k})};
|
|
|
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,h,m,k,n,u,v,w,p,x,t,y,z;f=0;for(h=this.actions.length;f<h;f++)switch(m=this.actions[f],k=m.action,m=m.args,k){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(m[0],m[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:n=m[2];u=m[3];p=m[0];x=m[1];e.length>0?(k=e[e.length-1],t=k.x,y=k.y):(k=this.actions[f-1].args,t=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b2(z,t,p,n),z=THREE.Shape.Utils.b2(z,y,x,
|
|
|
-u),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=m[4];u=m[5];p=m[0];x=m[1];v=m[2];w=m[3];e.length>0?(k=e[e.length-1],t=k.x,y=k.y):(k=this.actions[f-1].args,t=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b3(z,t,p,v,n),z=THREE.Shape.Utils.b3(z,y,x,w,u),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[f-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];z=b*m[0].length;k=k.concat(m[0]);m=new THREE.SplineCurve(k);
|
|
|
-for(k=1;k<=z;k++)e.push(m.getPointAt(k/z));break;case THREE.PathActions.ARC:k=this.actions[f-1].args;n=m[0];u=m[1];v=m[2];p=m[3];z=m[4];x=!!m[5];w=k[k.length-2];t=k[k.length-1];k.length==0&&(w=t=0);y=z-p;var A=b*2;for(k=1;k<=A;k++)z=k/A,x||(z=1-z),z=p+z*y,m=w+n+v*Math.cos(z),z=t+u+v*Math.sin(z),e.push(new THREE.Vector2(m,z))}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,h,m){var k=this.getPoints(),n,u,v,w,p;n=0;for(u=k.length;n<u;n++)v=k[n],w=v.x,p=v.y,v.x=b*w+c*p+e,v.y=f*p+h*w+m;return k};
|
|
|
+THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,h,m,k,n,u,v,w,t,x,p,y,z;f=0;for(h=this.actions.length;f<h;f++)switch(m=this.actions[f],k=m.action,m=m.args,k){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(m[0],m[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:n=m[2];u=m[3];t=m[0];x=m[1];e.length>0?(k=e[e.length-1],p=k.x,y=k.y):(k=this.actions[f-1].args,p=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b2(z,p,t,n),z=THREE.Shape.Utils.b2(z,y,x,
|
|
|
+u),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=m[4];u=m[5];t=m[0];x=m[1];v=m[2];w=m[3];e.length>0?(k=e[e.length-1],p=k.x,y=k.y):(k=this.actions[f-1].args,p=k[k.length-2],y=k[k.length-1]);for(k=1;k<=b;k++)z=k/b,m=THREE.Shape.Utils.b3(z,p,t,v,n),z=THREE.Shape.Utils.b3(z,y,x,w,u),e.push(new THREE.Vector2(m,z));break;case THREE.PathActions.CSPLINE_THRU:k=this.actions[f-1].args;k=[new THREE.Vector2(k[k.length-2],k[k.length-1])];z=b*m[0].length;k=k.concat(m[0]);m=new THREE.SplineCurve(k);
|
|
|
+for(k=1;k<=z;k++)e.push(m.getPointAt(k/z));break;case THREE.PathActions.ARC:k=this.actions[f-1].args;n=m[0];u=m[1];v=m[2];t=m[3];z=m[4];x=!!m[5];w=k[k.length-2];p=k[k.length-1];k.length==0&&(w=p=0);y=z-t;var A=b*2;for(k=1;k<=A;k++)z=k/A,x||(z=1-z),z=t+z*y,m=w+n+v*Math.cos(z),z=p+u+v*Math.sin(z),e.push(new THREE.Vector2(m,z))}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,h,m){var k=this.getPoints(),n,u,v,w,t;n=0;for(u=k.length;n<u;n++)v=k[n],w=v.x,t=v.y,v.x=b*w+c*t+e,v.y=f*t+h*w+m;return k};
|
|
|
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,h,b=0;for(e=this.actions.length;b<e;b++)f=this.actions[b],h=f.args,f=f.action,f!=THREE.PathActions.CSPLINE_THRU&&c[f].apply(c,h);c.stroke();c.closePath();c.strokeStyle="red";f=
|
|
|
this.getPoints();b=0;for(e=f.length;b<e;b++)h=f[b],c.beginPath(),c.arc(h.x,h.y,1.5,0,Math.PI*2,!1),c.stroke(),c.closePath()};
|
|
|
THREE.Path.prototype.toShapes=function(){var b,c,e,f,h=[],m=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&&m.actions.length!=0&&(h.push(m),m=new THREE.Path),m[e].apply(m,f);m.actions.length!=0&&h.push(m);if(h.length==0)return[];var k,m=[];if(THREE.Shape.Utils.isClockWise(h[0].getPoints())){b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(k&&m.push(k),k=new THREE.Shape,k.actions=f.actions,k.curves=
|
|
|
f.curves):k.holes.push(f);m.push(k)}else{k=new THREE.Shape;b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(k.actions=f.actions,k.curves=f.curves,m.push(k),k=new THREE.Shape):k.holes.push(f)}return m};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(),h,m,k,n,u,v,w,p,x,t,y=[];for(u=0;u<c.length;u++){v=c[u];f=f.concat(v);m=Number.POSITIVE_INFINITY;for(h=0;h<v.length;h++){x=v[h];t=[];for(p=0;p<e.length;p++)w=e[p],w=x.distanceToSquared(w),t.push(w),w<m&&(m=w,k=h,n=p)}h=n-1>=0?n-1:e.length-1;m=k-1>=0?k-1:v.length-1;var z=[v[k],e[n],e[h]];p=THREE.FontUtils.Triangulate.area(z);var A=[v[k],v[m],e[n]];x=THREE.FontUtils.Triangulate.area(A);t=n;w=k;n+=1;k+=-1;n<0&&(n+=e.length);n%=
|
|
|
-e.length;k<0&&(k+=v.length);k%=v.length;h=n-1>=0?n-1:e.length-1;m=k-1>=0?k-1:v.length-1;z=[v[k],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);A=[v[k],v[m],e[n]];A=THREE.FontUtils.Triangulate.area(A);p+x>z+A&&(n=t,k=w,n<0&&(n+=e.length),n%=e.length,k<0&&(k+=v.length),k%=v.length,h=n-1>=0?n-1:e.length-1,m=k-1>=0?k-1:v.length-1);p=e.slice(0,n);x=e.slice(n);t=v.slice(k);w=v.slice(0,k);m=[v[k],v[m],e[n]];y.push([v[k],e[n],e[h]]);y.push(m);e=p.concat(t).concat(w).concat(x)}return{shape:e,isolatedPts:y,
|
|
|
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,m,k,n,u,v,w,t,x,p,y=[];for(u=0;u<c.length;u++){v=c[u];f=f.concat(v);m=Number.POSITIVE_INFINITY;for(h=0;h<v.length;h++){x=v[h];p=[];for(t=0;t<e.length;t++)w=e[t],w=x.distanceToSquared(w),p.push(w),w<m&&(m=w,k=h,n=t)}h=n-1>=0?n-1:e.length-1;m=k-1>=0?k-1:v.length-1;var z=[v[k],e[n],e[h]];t=THREE.FontUtils.Triangulate.area(z);var A=[v[k],v[m],e[n]];x=THREE.FontUtils.Triangulate.area(A);p=n;w=k;n+=1;k+=-1;n<0&&(n+=e.length);n%=
|
|
|
+e.length;k<0&&(k+=v.length);k%=v.length;h=n-1>=0?n-1:e.length-1;m=k-1>=0?k-1:v.length-1;z=[v[k],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);A=[v[k],v[m],e[n]];A=THREE.FontUtils.Triangulate.area(A);t+x>z+A&&(n=p,k=w,n<0&&(n+=e.length),n%=e.length,k<0&&(k+=v.length),k%=v.length,h=n-1>=0?n-1:e.length-1,m=k-1>=0?k-1:v.length-1);t=e.slice(0,n);x=e.slice(n);p=v.slice(k);w=v.slice(0,k);m=[v[k],v[m],e[n]];y.push([v[k],e[n],e[h]]);y.push(m);e=t.concat(p).concat(w).concat(x)}return{shape:e,isolatedPts:y,
|
|
|
allpoints:f}},triangulateShape:function(b,c){var e=THREE.Shape.Utils.removeHoles(b,c),f=e.allpoints,h=e.isolatedPts,e=THREE.FontUtils.Triangulate(e.shape,!1),m,k,n,u,v={};m=0;for(k=f.length;m<k;m++)u=f[m].x+":"+f[m].y,v[u]!==void 0&&console.log("Duplicate point",u),v[u]=m;m=0;for(k=e.length;m<k;m++){n=e[m];for(f=0;f<3;f++)u=n[f].x+":"+n[f].y,u=v[u],u!==void 0&&(n[f]=u)}m=0;for(k=h.length;m<k;m++){n=h[m];for(f=0;f<3;f++)u=n[f].x+":"+n[f].y,u=v[u],u!==void 0&&(n[f]=u)}return e.concat(h)},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,h){return this.b3p0(b,c)+this.b3p1(b,e)+this.b3p2(b,f)+this.b3p3(b,h)}};
|
|
|
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",h=c.weight!==void 0?c.weight:"normal",m=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=h;THREE.FontUtils.style=m};
|
|
@@ -413,15 +413,15 @@ THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=
|
|
|
THREE.Bone?h.skinMatrix:h.matrix;var m=h.animationCache.prevKey;h=h.animationCache.nextKey;m.pos=this.data.hierarchy[e].keys[0];m.rot=this.data.hierarchy[e].keys[0];m.scl=this.data.hierarchy[e].keys[0];h.pos=this.getNextKeyWith("pos",e,1);h.rot=this.getNextKeyWith("rot",e,1);h.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,h,m,k,n,u,v,w=this.data.JIT.hierarchy,p,x;this.currentTime+=b*this.timeScale;x=this.currentTime;p=this.currentTime%=this.data.length;v=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var t=0,y=this.hierarchy.length;t<y;t++)if(b=this.hierarchy[t],u=b.animationCache,this.JITCompile&&w[t][v]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=w[t][v],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
|
|
|
-!1):(b.matrix=w[t][v],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 z=0;z<3;z++){e=c[z];k=u.prevKey[e];n=u.nextKey[e];if(n.time<=x){if(p<x)if(this.loop){k=this.data.hierarchy[t].keys[0];for(n=this.getNextKeyWith(e,t,1);n.time<p;)k=n,n=this.getNextKeyWith(e,t,n.index+1)}else{this.stop();return}else{do k=n,n=this.getNextKeyWith(e,t,n.index+1);while(n.time<
|
|
|
-p)}u.prevKey[e]=k;u.nextKey[e]=n}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(p-k.time)/(n.time-k.time);h=k[e];m=n[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=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
-this.getPrevKeyWith("pos",t,k.index-1).pos,this.points[1]=h,this.points[2]=m,this.points[3]=this.getNextKeyWith("pos",t,n.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[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(h,m,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f}}if(this.JITCompile&&w[0][v]===void 0){this.hierarchy[0].update(void 0,!0);for(t=0;t<this.hierarchy.length;t++)w[t][v]=this.hierarchy[t]instanceof THREE.Bone?this.hierarchy[t].skinMatrix.clone():this.hierarchy[t].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,m,k,n,u,v,w=this.data.JIT.hierarchy,t,x;this.currentTime+=b*this.timeScale;x=this.currentTime;t=this.currentTime%=this.data.length;v=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var p=0,y=this.hierarchy.length;p<y;p++)if(b=this.hierarchy[p],u=b.animationCache,this.JITCompile&&w[p][v]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=w[p][v],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
|
|
|
+!1):(b.matrix=w[p][v],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 z=0;z<3;z++){e=c[z];k=u.prevKey[e];n=u.nextKey[e];if(n.time<=x){if(t<x)if(this.loop){k=this.data.hierarchy[p].keys[0];for(n=this.getNextKeyWith(e,p,1);n.time<t;)k=n,n=this.getNextKeyWith(e,p,n.index+1)}else{this.stop();return}else{do k=n,n=this.getNextKeyWith(e,p,n.index+1);while(n.time<
|
|
|
+t)}u.prevKey[e]=k;u.nextKey[e]=n}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-k.time)/(n.time-k.time);h=k[e];m=n[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+p),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
+this.getPrevKeyWith("pos",p,k.index-1).pos,this.points[1]=h,this.points[2]=m,this.points[3]=this.getNextKeyWith("pos",p,n.index+1).pos,f=f*0.33+0.33,h=this.interpolateCatmullRom(this.points,f),e.x=h[0],e.y=h[1],e.z=h[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(h,m,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(m[0]-h[0])*f,e.y=h[1]+(m[1]-h[1])*f,e.z=h[2]+(m[2]-h[2])*f}}if(this.JITCompile&&w[0][v]===void 0){this.hierarchy[0].update(void 0,!0);for(p=0;p<this.hierarchy.length;p++)w[p][v]=this.hierarchy[p]instanceof THREE.Bone?this.hierarchy[p].skinMatrix.clone():this.hierarchy[p].matrix.clone()}}};
|
|
|
THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],h,m,k,n,u,v;h=(b.length-1)*c;m=Math.floor(h);h-=m;e[0]=m==0?m:m-1;e[1]=m;e[2]=m>b.length-2?m:m+1;e[3]=m>b.length-3?m:m+2;m=b[e[0]];n=b[e[1]];u=b[e[2]];v=b[e[3]];e=h*h;k=h*e;f[0]=this.interpolate(m[0],n[0],u[0],v[0],h,e,k);f[1]=this.interpolate(m[1],n[1],u[1],v[1],h,e,k);f[2]=this.interpolate(m[2],n[2],u[2],v[2],h,e,k);return f};
|
|
|
THREE.Animation.prototype.interpolate=function(b,c,e,f,h,m,k){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*k+(-3*(c-e)-2*b-f)*m+b*h+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.005;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=
|
|
|
+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=
|
|
|
b.movementSpeed;if(b.lookSpeed!==void 0)this.lookSpeed=b.lookSpeed;if(b.noFly!==void 0)this.noFly=b.noFly;if(b.lookVertical!==void 0)this.lookVertical=b.lookVertical;if(b.autoForward!==void 0)this.autoForward=b.autoForward;if(b.activeLook!==void 0)this.activeLook=b.activeLook;if(b.heightSpeed!==void 0)this.heightSpeed=b.heightSpeed;if(b.heightCoef!==void 0)this.heightCoef=b.heightCoef;if(b.heightMin!==void 0)this.heightMin=b.heightMin;if(b.heightMax!==void 0)this.heightMax=b.heightMax;if(b.constrainVertical!==
|
|
|
void 0)this.constrainVertical=b.constrainVertical;if(b.verticalMin!==void 0)this.verticalMin=b.verticalMin;if(b.verticalMax!==void 0)this.verticalMax=b.verticalMax;if(b.domElement!==void 0)this.domElement=b.domElement}this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=this.autoSpeedFactor=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.windowHalfX=window.innerWidth/2;this.windowHalfY=window.innerHeight/2;this.onMouseDown=function(b){b.preventDefault();
|
|
|
b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!0;break;case 2:this.moveBackward=!0}this.mouseDragOn=!0};this.onMouseUp=function(b){b.preventDefault();b.stopPropagation();if(this.activeLook)switch(b.button){case 0:this.moveForward=!1;break;case 2:this.moveBackward=!1}this.mouseDragOn=!1};this.onMouseMove=function(b){this.mouseX=b.clientX-this.windowHalfX;this.mouseY=b.clientY-this.windowHalfY};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=
|
|
@@ -433,7 +433,7 @@ Math.sin(this.theta);this.supr.update.call(this)};this.domElement.addEventListen
|
|
|
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,e,c,f){var h={name:c,fps:0.6,length:f,hierarchy:[]},k,m=e.getControlPointsArray(),n=e.getLength(),u=m.length,E=0;k=u-1;e={parent:-1,keys:[]};e.keys[0]={time:0,pos:m[0],rot:[0,0,0,1],scl:[1,1,1]};e.keys[k]={time:f,pos:m[k],rot:[0,0,0,1],scl:[1,1,1]};for(k=1;k<u-1;k++)E=f*n.chunks[k]/n.total,e.keys[k]={time:E,pos:m[k]};h.hierarchy[0]=e;THREE.AnimationHandler.add(h);return new THREE.Animation(b,c,THREE.AnimationHandler.CATMULLROM_FORWARD,!1)}function e(b,e){var c,
|
|
|
f,h=new THREE.Geometry;for(c=0;c<b.points.length*e;c++)f=c/(b.points.length*e),f=b.getPoint(f),h.vertices[c]=new THREE.Vertex(new THREE.Vector3(f.x,f.y,f.z));return h}function f(b,c){var f=e(c,10),h=e(c,10),k=new THREE.LineBasicMaterial({color:16711680,linewidth:3});lineObj=new THREE.Line(f,k);particleObj=new THREE.ParticleSystem(h,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);h=new THREE.SphereGeometry(1,
|
|
|
-16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,k),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.005;this.lookHorizontal=
|
|
|
+16,8);k=new THREE.MeshBasicMaterial({color:65280});for(i=0;i<c.points.length;i++)f=new THREE.Mesh(h,k),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 h=Math.PI*2,m=Math.PI/180;this.update=function(b,e,c){var f,k;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)*m;this.theta=this.lon*m;f=this.phi%h;this.phi=f>=0?f:f+h;f=this.verticalAngleMap.srcRange;k=this.verticalAngleMap.dstRange;var n=k[1]-k[0];this.phi=
|
|
@@ -441,7 +441,7 @@ TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(k[1]-k[0])/(f[1]-f[0])+k[0]-k
|
|
|
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}),k=new THREE.MeshLambertMaterial({color:65280}),n=new THREE.CubeGeometry(10,10,20),u=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(u,k);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,e){return function(){e.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.005;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=
|
|
|
+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=
|
|
|
b.autoForward;if(b.domElement!==void 0)this.domElement=b.domElement}this.useTarget=!1;this.useQuaternion=!0;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.lastUpdate=-1;this.tdiff=0;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.keydown=function(b){if(!b.altKey){switch(b.keyCode){case 16:this.movementSpeedMultiplier=
|
|
|
0.1;break;case 87:this.moveState.forward=1;break;case 83:this.moveState.back=1;break;case 65:this.moveState.left=1;break;case 68:this.moveState.right=1;break;case 82:this.moveState.up=1;break;case 70:this.moveState.down=1;break;case 38:this.moveState.pitchUp=1;break;case 40:this.moveState.pitchDown=1;break;case 37:this.moveState.yawLeft=1;break;case 39:this.moveState.yawRight=1;break;case 81:this.moveState.rollLeft=1;break;case 69:this.moveState.rollRight=1}this.updateMovementVector();this.updateRotationVector()}};
|
|
|
this.keyup=function(b){switch(b.keyCode){case 16:this.movementSpeedMultiplier=1;break;case 87:this.moveState.forward=0;break;case 83:this.moveState.back=0;break;case 65:this.moveState.left=0;break;case 68:this.moveState.right=0;break;case 82:this.moveState.up=0;break;case 70:this.moveState.down=0;break;case 38:this.moveState.pitchUp=0;break;case 40:this.moveState.pitchDown=0;break;case 37:this.moveState.yawLeft=0;break;case 39:this.moveState.yawRight=0;break;case 81:this.moveState.rollLeft=0;break;
|
|
@@ -451,13 +451,13 @@ 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 h=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Matrix4,u=!1,v=1,w=0,p=0,x=0,t=0,y=0,z=window.innerWidth/2,A=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*y));b=this.delta*this.movementSpeed;this.translateZ(b*(w>0||this.autoForward&&!(w<0)?1:w));this.translateX(b*p);this.translateY(b*x);u&&(this.roll+=this.rollSpeed*this.delta*v);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 h=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Matrix4,u=!1,v=1,w=0,t=0,x=0,p=0,y=0,z=window.innerWidth/2,A=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*p),this.rotateVertically(b*y));b=this.delta*this.movementSpeed;this.translateZ(b*(w>0||this.autoForward&&!(w<0)?1:w));this.translateX(b*t);this.translateY(b*x);u&&(this.roll+=this.rollSpeed*this.delta*v);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();k.copy(this.forward);m.set(0,1,0);h.cross(m,k).normalize();m.cross(k,h).normalize();this.matrix.n11=h.x;this.matrix.n12=m.x;this.matrix.n13=k.x;this.matrix.n21=h.y;this.matrix.n22=m.y;this.matrix.n23=k.y;this.matrix.n31=h.z;this.matrix.n32=m.z;this.matrix.n33=k.z;n.identity();n.n11=Math.cos(this.roll);n.n12=-Math.sin(this.roll);n.n21=Math.sin(this.roll);n.n22=Math.cos(this.roll);this.matrix.multiplySelf(n);
|
|
|
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){h.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);h.multiplyScalar(b);this.forward.subSelf(h);this.forward.normalize()};this.rotateVertically=function(b){m.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);m.multiplyScalar(b);this.forward.addSelf(m);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
-function(b){t=(b.clientX-z)/window.innerWidth;y=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:w=1;break;case 2:w=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:w=0;break;case 2:w=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:w=1;break;case 37:case 65:p=-1;break;
|
|
|
-case 40:case 83:w=-1;break;case 39:case 68:p=1;break;case 81:u=!0;v=1;break;case 69:u=!0;v=-1;break;case 82:x=1;break;case 70:x=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:w=0;break;case 37:case 65:p=0;break;case 40:case 83:w=0;break;case 39:case 68:p=0;break;case 81:u=!1;break;case 69:u=!1;break;case 82:x=0;break;case 70:x=0}},!1)};THREE.RollCamera.prototype=new THREE.Camera;THREE.RollCamera.prototype.constructor=THREE.RollCamera;
|
|
|
+function(b){p=(b.clientX-z)/window.innerWidth;y=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:w=1;break;case 2:w=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:w=0;break;case 2:w=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:w=1;break;case 37:case 65:t=-1;break;
|
|
|
+case 40:case 83:w=-1;break;case 39:case 68:t=1;break;case 81:u=!0;v=1;break;case 69:u=!0;v=-1;break;case 82:x=1;break;case 70:x=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:w=0;break;case 37:case 65:t=0;break;case 40:case 83:w=0;break;case 39:case 68:t=0;break;case 81:u=!1;break;case 69:u=!1;break;case 82:x=0;break;case 70:x=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,h=new THREE.Vector3,m=new THREE.Vector3,k=new THREE.Vector3,n=new THREE.Vector2,u=new THREE.Vector2,v=new THREE.Vector2,w=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-
|
|
@@ -469,44 +469,44 @@ c(this,function(b){e&&(m=k=this.getMouseProjectionOnBall(b.clientX,b.clientY),n=
|
|
|
b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?m=k=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=u=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(v=w=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.CubeGeometry=function(b,c,e,f,h,m,k,n,u){function v(b,c,e,k,n,t,p,u){var v,x,y=f||1,z=h||1,M=n/2,U=t/2,V=w.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")v="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")v="y",z=m||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")v="x",y=m||1;var R=y+1,o=z+1;n/=y;var pa=t/z;for(x=0;x<o;x++)for(t=0;t<R;t++){var T=new THREE.Vector3;T[b]=(t*n-M)*e;T[c]=(x*pa-U)*k;T[v]=p;w.vertices.push(new THREE.Vertex(T))}for(x=0;x<z;x++)for(t=0;t<y;t++)w.faces.push(new THREE.Face4(t+R*
|
|
|
-x+V,t+R*(x+1)+V,t+1+R*(x+1)+V,t+1+R*x+V,null,null,u)),w.faceVertexUvs[0].push([new THREE.UV(t/y,x/z),new THREE.UV(t/y,(x+1)/z),new THREE.UV((t+1)/y,(x+1)/z),new THREE.UV((t+1)/y,x/z)])}THREE.Geometry.call(this);var w=this,p=b/2,x=c/2,t=e/2,n=n?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(u!=void 0)for(var z in u)this.sides[z]!=void 0&&(this.sides[z]=
|
|
|
-u[z]);this.sides.px&&v("z","y",1*n,-1,e,c,-p,this.materials[0]);this.sides.nx&&v("z","y",-1*n,-1,e,c,p,this.materials[1]);this.sides.py&&v("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&v("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&v("x","y",1*n,-1,b,c,t,this.materials[4]);this.sides.nz&&v("x","y",-1*n,-1,b,c,-t,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=w.vertices.length;e<f;e++){for(var h=w.vertices[e],k=!1,m=0,n=b.length;m<n;m++){var t=b[m];if(h.position.x==t.position.x&&
|
|
|
-h.position.y==t.position.y&&h.position.z==t.position.z){c[e]=m;k=!0;break}}if(!k)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=w.faces.length;e<f;e++)h=w.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];w.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,h,m){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,k=e/2,f=f||8,h=h||1,n,u,v=[],w=[];for(u=0;u<=h;u++){var p=[],x=[],t=u/h,y=t*(c-b)+b;for(n=0;n<=f;n++){var z=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(z*Math.PI*2),-t*e+k,y*Math.cos(z*Math.PI*2))));p.push(this.vertices.length-1);x.push(new THREE.UV(z,t))}v.push(p);w.push(x)}for(u=0;u<h;u++)for(n=0;n<f;n++){var e=v[u][n],p=v[u+1][n],x=v[u+1][n+1],t=v[u][n+1],y=
|
|
|
-this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[p].position.clone().setY(0).normalize(),A=this.vertices[x].position.clone().setY(0).normalize(),C=this.vertices[t].position.clone().setY(0).normalize(),E=w[u][n].clone(),G=w[u+1][n].clone(),H=w[u+1][n+1].clone(),N=w[u][n+1].clone();this.faces.push(new THREE.Face4(e,p,x,t,[y,z,A,C]));this.faceVertexUvs[0].push([E,G,H,N])}if(!m&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n<f;n++)e=v[0][n],p=v[0][n+
|
|
|
-1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),E=w[0][n].clone(),G=w[0][n+1].clone(),H=new THREE.UV(G.u,0),this.faces.push(new THREE.Face3(e,p,x,[y,z,A])),this.faceVertexUvs[0].push([E,G,H])}if(!m&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;n<f;n++)e=v[u][n+1],p=v[u][n],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),E=w[u][n+1].clone(),G=w[u][n].clone(),
|
|
|
-H=new THREE.UV(G.u,1),this.faces.push(new THREE.Face3(e,p,x,[y,z,A])),this.faceVertexUvs[0].push([E,G,H])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.CubeGeometry=function(b,c,e,f,h,m,k,n,u){function v(b,c,e,k,n,p,t,u){var v,x,y=f||1,z=h||1,M=n/2,U=p/2,V=w.vertices.length;if(b=="x"&&c=="y"||b=="y"&&c=="x")v="z";else if(b=="x"&&c=="z"||b=="z"&&c=="x")v="y",z=m||1;else if(b=="z"&&c=="y"||b=="y"&&c=="z")v="x",y=m||1;var R=y+1,o=z+1;n/=y;var pa=p/z;for(x=0;x<o;x++)for(p=0;p<R;p++){var T=new THREE.Vector3;T[b]=(p*n-M)*e;T[c]=(x*pa-U)*k;T[v]=t;w.vertices.push(new THREE.Vertex(T))}for(x=0;x<z;x++)for(p=0;p<y;p++)w.faces.push(new THREE.Face4(p+R*
|
|
|
+x+V,p+R*(x+1)+V,p+1+R*(x+1)+V,p+1+R*x+V,null,null,u)),w.faceVertexUvs[0].push([new THREE.UV(p/y,x/z),new THREE.UV(p/y,(x+1)/z),new THREE.UV((p+1)/y,(x+1)/z),new THREE.UV((p+1)/y,x/z)])}THREE.Geometry.call(this);var w=this,t=b/2,x=c/2,p=e/2,n=n?-1:1;if(k!==void 0)if(k instanceof Array)this.materials=k;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([k])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(u!=void 0)for(var z in u)this.sides[z]!=void 0&&(this.sides[z]=
|
|
|
+u[z]);this.sides.px&&v("z","y",1*n,-1,e,c,-t,this.materials[0]);this.sides.nx&&v("z","y",-1*n,-1,e,c,t,this.materials[1]);this.sides.py&&v("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&v("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&v("x","y",1*n,-1,b,c,p,this.materials[4]);this.sides.nz&&v("x","y",-1*n,-1,b,c,-p,this.materials[5]);(function(){for(var b=[],c=[],e=0,f=w.vertices.length;e<f;e++){for(var h=w.vertices[e],k=!1,m=0,n=b.length;m<n;m++){var p=b[m];if(h.position.x==p.position.x&&
|
|
|
+h.position.y==p.position.y&&h.position.z==p.position.z){c[e]=m;k=!0;break}}if(!k)c[e]=b.length,b.push(new THREE.Vertex(h.position.clone()))}e=0;for(f=w.faces.length;e<f;e++)h=w.faces[e],h.a=c[h.a],h.b=c[h.b],h.c=c[h.c],h.d=c[h.d];w.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,h,m){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,k=e/2,f=f||8,h=h||1,n,u,v=[],w=[];for(u=0;u<=h;u++){var t=[],x=[],p=u/h,y=p*(c-b)+b;for(n=0;n<=f;n++){var z=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(z*Math.PI*2),-p*e+k,y*Math.cos(z*Math.PI*2))));t.push(this.vertices.length-1);x.push(new THREE.UV(z,p))}v.push(t);w.push(x)}for(u=0;u<h;u++)for(n=0;n<f;n++){var e=v[u][n],t=v[u+1][n],x=v[u+1][n+1],p=v[u][n+1],y=
|
|
|
+this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[t].position.clone().setY(0).normalize(),A=this.vertices[x].position.clone().setY(0).normalize(),C=this.vertices[p].position.clone().setY(0).normalize(),E=w[u][n].clone(),G=w[u+1][n].clone(),H=w[u+1][n+1].clone(),N=w[u][n+1].clone();this.faces.push(new THREE.Face4(e,t,x,p,[y,z,A,C]));this.faceVertexUvs[0].push([E,G,H,N])}if(!m&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,k,0)));for(n=0;n<f;n++)e=v[0][n],t=v[0][n+
|
|
|
+1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),E=w[0][n].clone(),G=w[0][n+1].clone(),H=new THREE.UV(G.u,0),this.faces.push(new THREE.Face3(e,t,x,[y,z,A])),this.faceVertexUvs[0].push([E,G,H])}if(!m&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-k,0)));for(n=0;n<f;n++)e=v[u][n+1],t=v[u][n],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),E=w[u][n+1].clone(),G=w[u][n].clone(),
|
|
|
+H=new THREE.UV(G.u,1),this.faces.push(new THREE.Face3(e,t,x,[y,z,A])),this.faceVertexUvs[0].push([E,G,H])}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,h;this.shapebb=b[f-1].getBoundingBox();for(e=0;e<f;e++)h=b[e],this.addShape(h,c);this.computeCentroids();this.computeFaceNormals()}};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,h=THREE.ExtrudeGeometry.__v2,k=THREE.ExtrudeGeometry.__v3,m=THREE.ExtrudeGeometry.__v4,n=THREE.ExtrudeGeometry.__v5,o=THREE.ExtrudeGeometry.__v6;f.set(b.x-c.x,b.y-c.y);h.set(b.x-e.x,b.y-e.y);f=f.normalize();h=h.normalize();k.set(-f.y,f.x);m.set(h.y,-h.x);n.copy(b).addSelf(k);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
|
|
|
-n.copy(c).addSelf(k);o.copy(e).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<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(m).addSelf(n).subSelf(b).clone()}function h(b){for(D=b.length;--D>=0;){ka=D;da=D-1;da<0&&(da=b.length-
|
|
|
-1);for(var c=0,e=t+w*2,c=0;c<e;c++){var f=pa*c,h=pa*(c+1),k=Z+ka+f,m=Z+ka+h,o=k,f=Z+da+f,h=Z+da+h,p=m;o+=W;f+=W;h+=W;p+=W;K.faces.push(new THREE.Face4(o,f,h,p,null,null,H));H&&(o=c/e,f=(c+1)/e,h=n+u*2,k=(K.vertices[k].position.z+u)/h,m=(K.vertices[m].position.z+u)/h,K.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function m(b,c,e){K.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=W;c+=W;e+=W;K.faces.push(new THREE.Face3(b,
|
|
|
-c,e,null,null,G));if(G){var f=N.maxY,h=N.maxX,k=K.vertices[c].position.x,c=K.vertices[c].position.y,m=K.vertices[e].position.x,e=K.vertices[e].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[b].position.x/h,K.vertices[b].position.y/f),new THREE.UV(k/h,c/f),new THREE.UV(m/h,e/f)])}}var n=c.amount!==void 0?c.amount:100,u=c.bevelThickness!==void 0?c.bevelThickness:6,v=c.bevelSize!==void 0?c.bevelSize:u-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,t=c.steps!==void 0?c.steps:1,y=c.bendPath,z=c.extrudePath,A,C=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,G=c.material,H=c.extrudeMaterial,N=this.shapebb;if(z)A=z.getPoints(x),t=A.length,C=!0,p=!1;p||(v=u=w=0);var S,J,I,K=this,W=this.vertices.length;y&&b.addWrapPath(y);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();J=0;for(I=x.length;J<I;J++)S=x[J],THREE.Shape.Utils.isClockWise(S)&&
|
|
|
-(x[J]=S.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(y,x);E=y;J=0;for(I=x.length;J<I;J++)S=x[J],y=y.concat(S);var D,M,U,V,R,o,pa=y.length,T=z.length,la=[];D=0;M=E.length;ka=M-1;for(da=D+1;D<M;D++,ka++,da++)ka==M&&(ka=0),da==M&&(da=0),la[D]=f(E[D],E[ka],E[da]);var aa=[],na,ja=la.concat();J=0;for(I=x.length;J<I;J++){S=x[J];na=[];D=0;M=S.length;ka=M-1;for(da=D+1;D<M;D++,ka++,da++)ka==M&&(ka=0),da==M&&(da=0),na[D]=f(S[D],S[ka],S[da]);aa.push(na);ja=ja.concat(na)}for(U=0;U<w;U++){V=U/w;R=u*(1-
|
|
|
-V);V=v*Math.sin(V*Math.PI/2);D=0;for(M=E.length;D<M;D++)o=e(E[D],la[D],V),m(o.x,o.y,-R);J=0;for(I=x.length;J<I;J++){S=x[J];na=aa[J];D=0;for(M=S.length;D<M;D++)o=e(S[D],na[D],V),m(o.x,o.y,-R)}}V=v;for(D=0;D<pa;D++)o=p?e(y[D],ja[D],V):y[D],C?m(o.x,o.y+A[0].y,A[0].x):m(o.x,o.y,0);for(U=1;U<=t;U++)for(D=0;D<pa;D++)o=p?e(y[D],ja[D],V):y[D],C?m(o.x,o.y+A[U-1].y,A[U-1].x):m(o.x,o.y,n/t*U);for(U=w-1;U>=0;U--){V=U/w;R=u*(1-V);V=v*Math.sin(V*Math.PI/2);D=0;for(M=E.length;D<M;D++)o=e(E[D],la[D],V),m(o.x,o.y,
|
|
|
-n+R);J=0;for(I=x.length;J<I;J++){S=x[J];na=aa[J];D=0;for(M=S.length;D<M;D++)o=e(S[D],na[D],V),C?m(o.x,o.y+A[t-1].y,A[t-1].x+R):m(o.x,o.y,n+R)}}if(p){p=pa*0;for(D=0;D<T;D++)v=z[D],k(v[2]+p,v[1]+p,v[0]+p);p=pa*(t+w*2);for(D=0;D<T;D++)v=z[D],k(v[0]+p,v[1]+p,v[2]+p)}else{for(D=0;D<T;D++)v=z[D],k(v[2],v[1],v[0]);for(D=0;D<T;D++)v=z[D],k(v[0]+pa*t,v[1]+pa*t,v[2]+pa*t)}var ka,da,Z=0;h(E);Z+=E.length;J=0;for(I=x.length;J<I;J++)S=x[J],h(S),Z+=S.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
+n.copy(c).addSelf(k);o.copy(e).addSelf(m);k=f.dot(m);m=o.subSelf(n).dot(m);k==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=k;if(m<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(m).addSelf(n).subSelf(b).clone()}function h(b){for(D=b.length;--D>=0;){ka=D;ea=D-1;ea<0&&(ea=b.length-
|
|
|
+1);for(var c=0,e=p+w*2,c=0;c<e;c++){var f=pa*c,h=pa*(c+1),k=Z+ka+f,m=Z+ka+h,o=k,f=Z+ea+f,h=Z+ea+h,t=m;o+=W;f+=W;h+=W;t+=W;K.faces.push(new THREE.Face4(o,f,h,t,null,null,H));H&&(o=c/e,f=(c+1)/e,h=n+u*2,k=(K.vertices[k].position.z+u)/h,m=(K.vertices[m].position.z+u)/h,K.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function m(b,c,e){K.vertices.push(new THREE.Vertex(new THREE.Vector3(b,c,e)))}function k(b,c,e){b+=W;c+=W;e+=W;K.faces.push(new THREE.Face3(b,
|
|
|
+c,e,null,null,G));if(G){var f=N.maxY,h=N.maxX,k=K.vertices[c].position.x,c=K.vertices[c].position.y,m=K.vertices[e].position.x,e=K.vertices[e].position.y;K.faceVertexUvs[0].push([new THREE.UV(K.vertices[b].position.x/h,K.vertices[b].position.y/f),new THREE.UV(k/h,c/f),new THREE.UV(m/h,e/f)])}}var n=c.amount!==void 0?c.amount:100,u=c.bevelThickness!==void 0?c.bevelThickness:6,v=c.bevelSize!==void 0?c.bevelSize:u-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,t=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,p=c.steps!==void 0?c.steps:1,y=c.bendPath,z=c.extrudePath,A,C=!1,E=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,G=c.material,H=c.extrudeMaterial,N=this.shapebb;if(z)A=z.getPoints(x),p=A.length,C=!0,t=!1;t||(v=u=w=0);var S,J,I,K=this,W=this.vertices.length;y&&b.addWrapPath(y);x=E?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();J=0;for(I=x.length;J<I;J++)S=x[J],THREE.Shape.Utils.isClockWise(S)&&
|
|
|
+(x[J]=S.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(y,x);E=y;J=0;for(I=x.length;J<I;J++)S=x[J],y=y.concat(S);var D,M,U,V,R,o,pa=y.length,T=z.length,la=[];D=0;M=E.length;ka=M-1;for(ea=D+1;D<M;D++,ka++,ea++)ka==M&&(ka=0),ea==M&&(ea=0),la[D]=f(E[D],E[ka],E[ea]);var aa=[],na,ja=la.concat();J=0;for(I=x.length;J<I;J++){S=x[J];na=[];D=0;M=S.length;ka=M-1;for(ea=D+1;D<M;D++,ka++,ea++)ka==M&&(ka=0),ea==M&&(ea=0),na[D]=f(S[D],S[ka],S[ea]);aa.push(na);ja=ja.concat(na)}for(U=0;U<w;U++){V=U/w;R=u*(1-
|
|
|
+V);V=v*Math.sin(V*Math.PI/2);D=0;for(M=E.length;D<M;D++)o=e(E[D],la[D],V),m(o.x,o.y,-R);J=0;for(I=x.length;J<I;J++){S=x[J];na=aa[J];D=0;for(M=S.length;D<M;D++)o=e(S[D],na[D],V),m(o.x,o.y,-R)}}V=v;for(D=0;D<pa;D++)o=t?e(y[D],ja[D],V):y[D],C?m(o.x,o.y+A[0].y,A[0].x):m(o.x,o.y,0);for(U=1;U<=p;U++)for(D=0;D<pa;D++)o=t?e(y[D],ja[D],V):y[D],C?m(o.x,o.y+A[U-1].y,A[U-1].x):m(o.x,o.y,n/p*U);for(U=w-1;U>=0;U--){V=U/w;R=u*(1-V);V=v*Math.sin(V*Math.PI/2);D=0;for(M=E.length;D<M;D++)o=e(E[D],la[D],V),m(o.x,o.y,
|
|
|
+n+R);J=0;for(I=x.length;J<I;J++){S=x[J];na=aa[J];D=0;for(M=S.length;D<M;D++)o=e(S[D],na[D],V),C?m(o.x,o.y+A[p-1].y,A[p-1].x+R):m(o.x,o.y,n+R)}}if(t){t=pa*0;for(D=0;D<T;D++)v=z[D],k(v[2]+t,v[1]+t,v[0]+t);t=pa*(p+w*2);for(D=0;D<T;D++)v=z[D],k(v[0]+t,v[1]+t,v[2]+t)}else{for(D=0;D<T;D++)v=z[D],k(v[2],v[1],v[0]);for(D=0;D<T;D++)v=z[D],k(v[0]+pa*p,v[1]+pa*p,v[2]+pa*p)}var ka,ea,Z=0;h(E);Z+=E.length;J=0;for(I=x.length;J<I;J++)S=x[J],h(S),Z+=S.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 h.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=h.vertices[b].position,k=h.vertices[e].position;return c((f.x+k.x)/2,(f.y+k.y)/2,(f.z+k.z)/2)}var h=this,m=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,m);e(0,5,1,m);e(0,1,7,m);e(0,7,10,m);e(0,10,11,m);e(1,5,9,m);e(5,11,4,m);e(11,10,2,m);e(10,7,6,m);e(7,1,8,m);e(3,9,4,m);e(3,4,2,m);e(3,2,6,m);e(3,6,8,m);e(3,8,9,m);e(4,9,5,m);e(2,4,11,m);e(6,2,10,m);e(8,6,7,m);e(9,8,1,m);for(var k=0;k<this.subdivisions;k++){var b=new THREE.Geometry,n;for(n in m.faces){var u=f(m.faces[n].a,m.faces[n].b),v=f(m.faces[n].b,m.faces[n].c),w=f(m.faces[n].c,m.faces[n].a);e(m.faces[n].a,u,w,b);e(m.faces[n].b,v,
|
|
|
u,b);e(m.faces[n].c,w,v,b);e(u,v,w,b)}m.faces=b.faces}h.faces=m.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=[],h=[],m=[],k=(new THREE.Matrix4).setRotationZ(c),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),e[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var u=0;u<=this.angle+0.001;u+=c){for(n=0;n<e.length;n++)u<this.angle?(e[n]=k.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),h[n]=this.vertices.length-1):h=m;u==0&&(m=f);
|
|
|
+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=[],h=[],m=[],k=(new THREE.Matrix4).setRotationZ(c),n=0;n<b.length;n++)this.vertices.push(new THREE.Vertex(b[n])),e[n]=b[n].clone(),f[n]=this.vertices.length-1;for(var u=0;u<=this.angle+0.0010;u+=c){for(n=0;n<e.length;n++)u<this.angle?(e[n]=k.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),h[n]=this.vertices.length-1):h=m;u==0&&(m=f);
|
|
|
for(n=0;n<f.length-1;n++)this.faces.push(new THREE.Face4(h[n],h[n+1],f[n+1],f[n])),this.faceVertexUvs[0].push([new THREE.UV(1-u/this.angle,n/b.length),new THREE.UV(1-u/this.angle,(n+1)/b.length),new THREE.UV(1-(u-c)/this.angle,(n+1)/b.length),new THREE.UV(1-(u-c)/this.angle,n/b.length)]);f=h;h=[]}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 h,m=b/2,k=c/2,e=e||1,f=f||1,n=e+1,u=f+1;b/=e;var v=c/f;for(h=0;h<u;h++)for(c=0;c<n;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-m,-(h*v-k),0)));for(h=0;h<f;h++)for(c=0;c<e;c++)this.faces.push(new THREE.Face4(c+n*h,c+n*(h+1),c+1+n*(h+1),c+1+n*h)),this.faceVertexUvs[0].push([new THREE.UV(c/e,h/f),new THREE.UV(c/e,(h+1)/f),new THREE.UV((c+1)/e,(h+1)/f),new THREE.UV((c+1)/e,h/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,h=Math.PI,m=Math.max(3,c||8),k=Math.max(2,e||6),c=[],e=0;e<k+1;e++){f=e/k;var n=b*Math.cos(f*h),u=b*Math.sin(f*h),v=[],w=0;for(f=0;f<m;f++){var p=2*f/m,x=u*Math.sin(p*h),p=u*Math.cos(p*h);(e==0||e==k)&&f>0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,n,x)))-1);v.push(w)}c.push(v)}for(var t,y,z,h=c.length,e=0;e<h;e++)if(m=c[e].length,e>0)for(f=0;f<m;f++){v=f==m-1;k=c[e][v?0:f+1];n=c[e][v?m-1:f];u=c[e-1][v?
|
|
|
-m-1:f];v=c[e-1][v?0:f+1];x=e/(h-1);t=(e-1)/(h-1);y=(f+1)/m;var p=f/m,w=new THREE.UV(1-y,x),x=new THREE.UV(1-p,x),p=new THREE.UV(1-p,t),A=new THREE.UV(1-y,t);e<c.length-1&&(t=this.vertices[k].position.clone(),y=this.vertices[n].position.clone(),z=this.vertices[u].position.clone(),t.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(k,n,u,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,x,p]));e>1&&(t=
|
|
|
-this.vertices[k].position.clone(),y=this.vertices[u].position.clone(),z=this.vertices[v].position.clone(),t.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(k,u,v,[new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,p,A]))}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,h=Math.PI,m=Math.max(3,c||8),k=Math.max(2,e||6),c=[],e=0;e<k+1;e++){f=e/k;var n=b*Math.cos(f*h),u=b*Math.sin(f*h),v=[],w=0;for(f=0;f<m;f++){var t=2*f/m,x=u*Math.sin(t*h),t=u*Math.cos(t*h);(e==0||e==k)&&f>0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,n,x)))-1);v.push(w)}c.push(v)}for(var p,y,z,h=c.length,e=0;e<h;e++)if(m=c[e].length,e>0)for(f=0;f<m;f++){v=f==m-1;k=c[e][v?0:f+1];n=c[e][v?m-1:f];u=c[e-1][v?
|
|
|
+m-1:f];v=c[e-1][v?0:f+1];x=e/(h-1);p=(e-1)/(h-1);y=(f+1)/m;var t=f/m,w=new THREE.UV(1-y,x),x=new THREE.UV(1-t,x),t=new THREE.UV(1-t,p),A=new THREE.UV(1-y,p);e<c.length-1&&(p=this.vertices[k].position.clone(),y=this.vertices[n].position.clone(),z=this.vertices[u].position.clone(),p.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(k,n,u,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,x,t]));e>1&&(p=
|
|
|
+this.vertices[k].position.clone(),y=this.vertices[u].position.clone(),z=this.vertices[v].position.clone(),p.normalize(),y.normalize(),z.normalize(),this.faces.push(new THREE.Face3(k,u,v,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,t,A]))}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,h=String(b).split(""),m=h.length,k=[],b=0;b<m;b++){var n=new THREE.Path,n=this.extractGlyphPoints(h[b],c,e,f,n);f+=n.offset;k.push(n.path)}return{paths:k,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var m=[],k,n,u,v,w,p,x,t,y,z,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));u=c.length;for(b=0;b<u;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;v=c[b++]*e;m.push(new THREE.Vector2(n,
|
|
|
-v));h.moveTo(n,v);break;case "l":n=c[b++]*e+f;v=c[b++]*e;m.push(new THREE.Vector2(n,v));h.lineTo(n,v);break;case "q":n=c[b++]*e+f;v=c[b++]*e;x=c[b++]*e+f;t=c[b++]*e;h.quadraticCurveTo(x,t,n,v);if(k=m[m.length-1]){w=k.x;p=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var C=k/divisions,E=THREE.Shape.Utils.b2(C,w,x,n),C=THREE.Shape.Utils.b2(C,p,t,v);m.push(new THREE.Vector2(E,C))}}break;case "b":if(n=c[b++]*e+f,v=c[b++]*e,x=c[b++]*e+f,t=c[b++]*-e,y=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,v,
|
|
|
-x,t,y,z),k=m[m.length-1]){w=k.x;p=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)C=k/divisions,E=THREE.Shape.Utils.b3(C,w,x,y,n),C=THREE.Shape.Utils.b3(C,p,t,z,v),m.push(new THREE.Vector2(E,C))}}}return{offset:A.ha*e,points:m,path:h}}}};
|
|
|
-(function(b){var c=function(b){for(var c=b.length,h=0,m=c-1,k=0;k<c;m=k++)h+=b[m].x*b[k].y-b[k].x*b[m].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var m=[],k=[],n=[],u,v,w;if(c(b)>0)for(v=0;v<h;v++)k[v]=v;else for(v=0;v<h;v++)k[v]=h-1-v;var p=2*h;for(v=h-1;h>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}u=v;h<=u&&(u=0);v=u+1;h<=v&&(v=0);w=v+1;h<=w&&(w=0);var x;a:{x=b;var t=u,y=v,z=w,A=h,C=k,E=void 0,G=void 0,H=void 0,
|
|
|
-N=void 0,S=void 0,J=void 0,I=void 0,K=void 0,W=void 0,G=x[C[t]].x,H=x[C[t]].y,N=x[C[y]].x,S=x[C[y]].y,J=x[C[z]].x,I=x[C[z]].y;if(1.0E-10>(N-G)*(I-H)-(S-H)*(J-G))x=!1;else{for(E=0;E<A;E++)if(!(E==t||E==y||E==z)){var K=x[C[E]].x,W=x[C[E]].y,D=void 0,M=void 0,U=void 0,V=void 0,R=void 0,o=void 0,pa=void 0,T=void 0,la=void 0,aa=void 0,na=void 0,ja=void 0,D=U=R=void 0,D=J-N,M=I-S,U=G-J,V=H-I,R=N-G,o=S-H,pa=K-G,T=W-H,la=K-N,aa=W-S,na=K-J,ja=W-I,D=D*aa-M*la,R=R*T-o*pa,U=U*ja-V*na;if(D>=0&&U>=0&&R>=0){x=!1;
|
|
|
-break a}}x=!0}}if(x){m.push([b[k[u]],b[k[v]],b[k[w]]]);n.push([k[u],k[v],k[w]]);u=v;for(w=v+1;w<h;u++,w++)k[u]=k[w];h--;p=2*h}}if(f)return n;return m};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
+this.getFace(),e=this.size/c.resolution,f=0,h=String(b).split(""),m=h.length,k=[],b=0;b<m;b++){var n=new THREE.Path,n=this.extractGlyphPoints(h[b],c,e,f,n);f+=n.offset;k.push(n.path)}return{paths:k,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var m=[],k,n,u,v,w,t,x,p,y,z,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));u=c.length;for(b=0;b<u;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;v=c[b++]*e;m.push(new THREE.Vector2(n,
|
|
|
+v));h.moveTo(n,v);break;case "l":n=c[b++]*e+f;v=c[b++]*e;m.push(new THREE.Vector2(n,v));h.lineTo(n,v);break;case "q":n=c[b++]*e+f;v=c[b++]*e;x=c[b++]*e+f;p=c[b++]*e;h.quadraticCurveTo(x,p,n,v);if(k=m[m.length-1]){w=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++){var C=k/divisions,E=THREE.Shape.Utils.b2(C,w,x,n),C=THREE.Shape.Utils.b2(C,t,p,v);m.push(new THREE.Vector2(E,C))}}break;case "b":if(n=c[b++]*e+f,v=c[b++]*e,x=c[b++]*e+f,p=c[b++]*-e,y=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,v,
|
|
|
+x,p,y,z),k=m[m.length-1]){w=k.x;t=k.y;k=1;for(divisions=this.divisions;k<=divisions;k++)C=k/divisions,E=THREE.Shape.Utils.b3(C,w,x,y,n),C=THREE.Shape.Utils.b3(C,t,p,z,v),m.push(new THREE.Vector2(E,C))}}}return{offset:A.ha*e,points:m,path:h}}}};
|
|
|
+(function(b){var c=function(b){for(var c=b.length,h=0,m=c-1,k=0;k<c;m=k++)h+=b[m].x*b[k].y-b[k].x*b[m].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var m=[],k=[],n=[],u,v,w;if(c(b)>0)for(v=0;v<h;v++)k[v]=v;else for(v=0;v<h;v++)k[v]=h-1-v;var t=2*h;for(v=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return m}u=v;h<=u&&(u=0);v=u+1;h<=v&&(v=0);w=v+1;h<=w&&(w=0);var x;a:{x=b;var p=u,y=v,z=w,A=h,C=k,E=void 0,G=void 0,H=void 0,
|
|
|
+N=void 0,S=void 0,J=void 0,I=void 0,K=void 0,W=void 0,G=x[C[p]].x,H=x[C[p]].y,N=x[C[y]].x,S=x[C[y]].y,J=x[C[z]].x,I=x[C[z]].y;if(1.0E-10>(N-G)*(I-H)-(S-H)*(J-G))x=!1;else{for(E=0;E<A;E++)if(!(E==p||E==y||E==z)){var K=x[C[E]].x,W=x[C[E]].y,D=void 0,M=void 0,U=void 0,V=void 0,R=void 0,o=void 0,pa=void 0,T=void 0,la=void 0,aa=void 0,na=void 0,ja=void 0,D=U=R=void 0,D=J-N,M=I-S,U=G-J,V=H-I,R=N-G,o=S-H,pa=K-G,T=W-H,la=K-N,aa=W-S,na=K-J,ja=W-I,D=D*aa-M*la,R=R*T-o*pa,U=U*ja-V*na;if(D>=0&&U>=0&&R>=0){x=!1;
|
|
|
+break a}}x=!0}}if(x){m.push([b[k[u]],b[k[v]],b[k[w]]]);n.push([k[u],k[v],k[w]]);u=v;for(w=v+1;w<h;u++,w++)k[u]=k[w];h--;t=2*h}}if(f)return n;return m};b.Triangulate.area=c;return b})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(b,c,e,f,h){THREE.Geometry.call(this);this.radius=b||100;this.tube=c||40;this.segmentsR=e||8;this.segmentsT=f||6;this.arc=h||Math.PI*2;h=new THREE.Vector3;b=[];c=[];for(e=0;e<=this.segmentsR;e++)for(f=0;f<=this.segmentsT;f++){var m=f/this.segmentsT*this.arc,k=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(m);h.y=this.radius*Math.sin(m);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(k))*Math.cos(m);n.y=(this.radius+this.tube*Math.cos(k))*Math.sin(m);n.z=
|
|
|
this.tube*Math.sin(k);this.vertices.push(new THREE.Vertex(n));b.push(new THREE.UV(f/this.segmentsT,1-e/this.segmentsR));c.push(n.clone().subSelf(h).normalize())}for(e=1;e<=this.segmentsR;e++)for(f=1;f<=this.segmentsT;f++){var h=(this.segmentsT+1)*e+f-1,m=(this.segmentsT+1)*(e-1)+f-1,k=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,u=new THREE.Face4(h,m,k,n,[c[h],c[m],c[k],c[n]]);u.normal.addSelf(c[h]);u.normal.addSelf(c[m]);u.normal.addSelf(c[k]);u.normal.addSelf(c[n]);u.normal.normalize();this.faces.push(u);
|
|
|
this.faceVertexUvs[0].push([b[h].clone(),b[m].clone(),b[k].clone(),b[n].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
@@ -516,43 +516,43 @@ h.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)
|
|
|
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 h(b,e,h,k,m,n){var p=document.createElement("canvas");b[e]=new THREE.Texture(p);b[e].sourceFile=h;if(k){b[e].repeat.set(k[0],k[1]);if(k[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(k[1]!=
|
|
|
+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 h(b,e,h,k,m,n){var t=document.createElement("canvas");b[e]=new THREE.Texture(t);b[e].sourceFile=h;if(k){b[e].repeat.set(k[0],k[1]);if(k[0]!=1)b[e].wrapS=THREE.RepeatWrapping;if(k[1]!=
|
|
|
1)b[e].wrapT=THREE.RepeatWrapping}m&&b[e].offset.set(m[0],m[1]);if(n){k={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(k[n[0]]!==void 0)b[e].wrapS=k[n[0]];if(k[n[1]]!==void 0)b[e].wrapT=k[n[1]]}f(b[e],c+"/"+h)}function m(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var k,n,u;n="MeshLambertMaterial";k={color:15658734,opacity:1,map:null,lightMap:null,normalMap:null,wireframe:b.wireframe};b.shading&&(b.shading=="Phong"?n="MeshPhongMaterial":b.shading=="Basic"&&(n="MeshBasicMaterial"));
|
|
|
if(b.blending)if(b.blending=="Additive")k.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")k.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")k.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)k.transparent=b.transparent;if(b.depthTest!==void 0)k.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")k.vertexColors=THREE.FaceColors;else if(b.vertexColors)k.vertexColors=THREE.VertexColors;if(b.colorDiffuse)k.color=m(b.colorDiffuse);
|
|
|
else if(b.DbgColor)k.color=b.DbgColor;if(b.colorSpecular)k.specular=m(b.colorSpecular);if(b.colorAmbient)k.ambient=m(b.colorAmbient);if(b.transparency)k.opacity=b.transparency;if(b.specularCoef)k.shininess=b.specularCoef;b.mapDiffuse&&c&&h(k,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&h(k,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&h(k,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
|
|
|
-b.mapSpecular&&c&&h(k,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var v=THREE.ShaderUtils.lib.normal,w=THREE.UniformsUtils.clone(v.uniforms),p=k.color;n=k.specular;u=k.ambient;var x=k.shininess;w.tNormal.texture=k.normalMap;if(b.mapNormalFactor)w.uNormalScale.value=b.mapNormalFactor;if(k.map)w.tDiffuse.texture=k.map,w.enableDiffuse.value=!0;if(k.specularMap)w.tSpecular.texture=k.specularMap,w.enableSpecular.value=!0;if(k.lightMap)w.tAO.texture=
|
|
|
-k.lightMap,w.enableAO.value=!0;w.uDiffuseColor.value.setHex(p);w.uSpecularColor.value.setHex(n);w.uAmbientColor.value.setHex(u);w.uShininess.value=x;if(k.opacity)w.uOpacity.value=k.opacity;k=new THREE.MeshShaderMaterial({fragmentShader:v.fragmentShader,vertexShader:v.vertexShader,uniforms:w,lights:!0,fog:!0})}else k=new THREE[n](k);return k},constructor:THREE.Loader};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;
|
|
|
+b.mapSpecular&&c&&h(k,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var v=THREE.ShaderUtils.lib.normal,w=THREE.UniformsUtils.clone(v.uniforms),t=k.color;n=k.specular;u=k.ambient;var x=k.shininess;w.tNormal.texture=k.normalMap;if(b.mapNormalFactor)w.uNormalScale.value=b.mapNormalFactor;if(k.map)w.tDiffuse.texture=k.map,w.enableDiffuse.value=!0;if(k.specularMap)w.tSpecular.texture=k.specularMap,w.enableSpecular.value=!0;if(k.lightMap)w.tAO.texture=
|
|
|
+k.lightMap,w.enableAO.value=!0;w.uDiffuseColor.value.setHex(t);w.uSpecularColor.value.setHex(n);w.uAmbientColor.value.setHex(u);w.uShininess.value=x;if(k.opacity)w.uOpacity.value=k.opacity;k=new THREE.MeshShaderMaterial({fragmentShader:v.fragmentShader,vertexShader:v.vertexShader,uniforms:w,lights:!0,fog:!0})}else k=new THREE[n](k);return k},constructor:THREE.Loader};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),h=b.bin_path?b.bin_path:THREE.Loader.prototype.extractUrlbase(c),b=(new Date).getTime(),c=new Worker(c),m=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,h,f,m)};c.onerror=function(b){alert("worker.onerror: "+b.message+"\n"+b.data);b.preventDefault()};
|
|
|
c.postMessage(b)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,m){var k=new XMLHttpRequest,n=f+"/"+b,u=0;k.onreadystatechange=function(){k.readyState==4?k.status==200||k.status==0?THREE.BinaryLoader.prototype.createBinModel(k.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+k.status+"]"):k.readyState==3?m&&(u==0&&(u=k.getResponseHeader("Content-Length")),m({total:u,loaded:k.responseText.length})):k.readyState==2&&(u=k.getResponseHeader("Content-Length"))};k.open("GET",n,!0);k.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
k.setRequestHeader("Content-Type","text/plain");k.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(c){function e(b,c){var f=w(b,c),h=w(b,c+1),k=w(b,c+2),m=w(b,c+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,c){var e=w(b,c),f=w(b,c+1),k=w(b,c+2);return(w(b,c+3)<<24)+(k<<16)+(f<<8)+e}function u(b,c){var e=w(b,c);return(w(b,c+1)<<8)+e}function v(b,c){var e=w(b,c);return e>127?e-256:e}function w(b,c){return b.charCodeAt(c)&255}function p(c){var e,
|
|
|
-f,k;e=h(b,c);f=h(b,c+S);k=h(b,c+J);c=u(b,c+I);C.faces.push(new THREE.Face3(e,f,k,null,null,C.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+S);k=h(b,c+J);m=u(b,c+I);o=h(b,c+K);p=h(b,c+W);c=h(b,c+D);m=C.materials[m];var t=H[p*3],v=H[p*3+1];p=H[p*3+2];var w=H[c*3],L=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(t,v,p),new THREE.Vector3(w,L,c)],null,m))}function t(c){var e,f,k,m;e=h(b,c);f=h(b,c+M);k=h(b,c+U);m=h(b,
|
|
|
-c+V);c=u(b,c+R);C.faces.push(new THREE.Face4(e,f,k,m,null,null,C.materials[c]))}function y(c){var e,f,k,m,p,t,v,w;e=h(b,c);f=h(b,c+M);k=h(b,c+U);m=h(b,c+V);p=u(b,c+R);t=h(b,c+o);v=h(b,c+pa);w=h(b,c+T);c=h(b,c+la);p=C.materials[p];var x=H[v*3],L=H[v*3+1];v=H[v*3+2];var P=H[w*3],ea=H[w*3+1];w=H[w*3+2];var y=H[c*3],z=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(H[t*3],H[t*3+1],H[t*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(P,ea,w),new THREE.Vector3(y,z,c)],null,p))}
|
|
|
-function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+aa);k=h(b,c+na);c=N[e*2];m=N[e*2+1];e=N[f*2];var o=C.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function A(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ja);k=h(b,c+ka);m=h(b,c+da);c=N[e*2];o=N[e*2+1];e=N[f*2];p=N[f*2+1];f=N[k*2];var t=C.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f,
|
|
|
-k));v.push(new THREE.UV(u,m));t.push(v)}var C=this,E=0,G,H=[],N=[],S,J,I,K,W,D,M,U,V,R,o,pa,T,la,aa,na,ja,ka,da,Z,fa,Y,ma,ia,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,c);G={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b,
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(c){function e(b,c){var f=w(b,c),h=w(b,c+1),k=w(b,c+2),m=w(b,c+3),n=(m<<1&255|k>>7)-127;f|=(k&127)<<16|h<<8;if(f==0&&n==-127)return 0;return(1-2*(m>>7))*(1+f*Math.pow(2,-23))*Math.pow(2,n)}function h(b,c){var e=w(b,c),f=w(b,c+1),k=w(b,c+2);return(w(b,c+3)<<24)+(k<<16)+(f<<8)+e}function u(b,c){var e=w(b,c);return(w(b,c+1)<<8)+e}function v(b,c){var e=w(b,c);return e>127?e-256:e}function w(b,c){return b.charCodeAt(c)&255}function t(c){var e,
|
|
|
+f,k;e=h(b,c);f=h(b,c+S);k=h(b,c+J);c=u(b,c+I);C.faces.push(new THREE.Face3(e,f,k,null,null,C.materials[c]))}function x(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+S);k=h(b,c+J);m=u(b,c+I);o=h(b,c+K);p=h(b,c+W);c=h(b,c+D);m=C.materials[m];var t=H[p*3],v=H[p*3+1];p=H[p*3+2];var w=H[c*3],L=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face3(e,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(t,v,p),new THREE.Vector3(w,L,c)],null,m))}function p(c){var e,f,k,m;e=h(b,c);f=h(b,c+M);k=h(b,c+U);m=h(b,
|
|
|
+c+V);c=u(b,c+R);C.faces.push(new THREE.Face4(e,f,k,m,null,null,C.materials[c]))}function y(c){var e,f,k,m,p,t,v,w;e=h(b,c);f=h(b,c+M);k=h(b,c+U);m=h(b,c+V);p=u(b,c+R);t=h(b,c+o);v=h(b,c+pa);w=h(b,c+T);c=h(b,c+la);p=C.materials[p];var x=H[v*3],L=H[v*3+1];v=H[v*3+2];var P=H[w*3],fa=H[w*3+1];w=H[w*3+2];var y=H[c*3],z=H[c*3+1],c=H[c*3+2];C.faces.push(new THREE.Face4(e,f,k,m,[new THREE.Vector3(H[t*3],H[t*3+1],H[t*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(P,fa,w),new THREE.Vector3(y,z,c)],null,p))}
|
|
|
+function z(c){var e,f,k,m;e=h(b,c);f=h(b,c+aa);k=h(b,c+na);c=N[e*2];m=N[e*2+1];e=N[f*2];var o=C.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(c,m));t.push(new THREE.UV(e,f));t.push(new THREE.UV(p,k));o.push(t)}function A(c){var e,f,k,m,o,p;e=h(b,c);f=h(b,c+ja);k=h(b,c+ka);m=h(b,c+ea);c=N[e*2];o=N[e*2+1];e=N[f*2];p=N[f*2+1];f=N[k*2];var t=C.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(c,o));v.push(new THREE.UV(e,p));v.push(new THREE.UV(f,
|
|
|
+k));v.push(new THREE.UV(u,m));t.push(v)}var C=this,E=0,G,H=[],N=[],S,J,I,K,W,D,M,U,V,R,o,pa,T,la,aa,na,ja,ka,ea,Z,ga,Y,ma,ia,sa;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(C,f,c);G={signature:b.substr(E,8),header_bytes:w(b,E+8),vertex_coordinate_bytes:w(b,E+9),normal_coordinate_bytes:w(b,E+10),uv_coordinate_bytes:w(b,E+11),vertex_index_bytes:w(b,E+12),normal_index_bytes:w(b,E+13),uv_index_bytes:w(b,E+14),material_index_bytes:w(b,E+15),nvertices:h(b,E+16),nnormals:h(b,E+16+4),nuvs:h(b,
|
|
|
E+16+8),ntri_flat:h(b,E+16+12),ntri_smooth:h(b,E+16+16),ntri_flat_uv:h(b,E+16+20),ntri_smooth_uv:h(b,E+16+24),nquad_flat:h(b,E+16+28),nquad_smooth:h(b,E+16+32),nquad_flat_uv:h(b,E+16+36),nquad_smooth_uv:h(b,E+16+40)};E+=G.header_bytes;S=G.vertex_index_bytes;J=G.vertex_index_bytes*2;I=G.vertex_index_bytes*3;K=G.vertex_index_bytes*3+G.material_index_bytes;W=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes;D=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*2;M=G.vertex_index_bytes;
|
|
|
-U=G.vertex_index_bytes*2;V=G.vertex_index_bytes*3;R=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;pa=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes;T=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*2;la=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;aa=G.uv_index_bytes;na=G.uv_index_bytes*2;ja=G.uv_index_bytes;ka=G.uv_index_bytes*2;da=G.uv_index_bytes*3;c=G.vertex_index_bytes*3+G.material_index_bytes;sa=G.vertex_index_bytes*
|
|
|
-4+G.material_index_bytes;Z=G.ntri_flat*c;fa=G.ntri_smooth*(c+G.normal_index_bytes*3);Y=G.ntri_flat_uv*(c+G.uv_index_bytes*3);ma=G.ntri_smooth_uv*(c+G.normal_index_bytes*3+G.uv_index_bytes*3);ia=G.nquad_flat*sa;c=G.nquad_smooth*(sa+G.normal_index_bytes*4);sa=G.nquad_flat_uv*(sa+G.uv_index_bytes*4);E+=function(c){for(var f,h,m,n=G.vertex_coordinate_bytes*3,o=c+G.nvertices*n;c<o;c+=n)f=e(b,c),h=e(b,c+G.vertex_coordinate_bytes),m=e(b,c+G.vertex_coordinate_bytes*2),C.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
|
|
|
-h,m)));return G.nvertices*n}(E);E+=function(c){for(var e,f,h,k=G.normal_coordinate_bytes*3,m=c+G.nnormals*k;c<m;c+=k)e=v(b,c),f=v(b,c+G.normal_coordinate_bytes),h=v(b,c+G.normal_coordinate_bytes*2),H.push(e/127,f/127,h/127);return G.nnormals*k}(E);E+=function(c){for(var f,h,m=G.uv_coordinate_bytes*2,n=c+G.nuvs*m;c<n;c+=m)f=e(b,c),h=e(b,c+G.uv_coordinate_bytes),N.push(f,h);return G.nuvs*m}(E);Z=E+Z;fa=Z+fa;Y=fa+Y;ma=Y+ma;ia=ma+ia;c=ia+c;sa=c+sa;(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes,
|
|
|
-f=e+G.uv_index_bytes*3,h=b+G.ntri_flat_uv*f;for(c=b;c<h;c+=f)p(c),z(c+e);return h-b})(fa);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*3,f=e+G.uv_index_bytes*3,h=b+G.ntri_smooth_uv*f;for(c=b;c<h;c+=f)x(c),z(c+e);return h-b})(Y);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes,f=e+G.uv_index_bytes*4,h=b+G.nquad_flat_uv*f;for(c=b;c<h;c+=f)t(c),A(c+e);return h-b})(c);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*
|
|
|
-4,f=e+G.uv_index_bytes*4,h=b+G.nquad_smooth_uv*f;for(c=b;c<h;c+=f)y(c),A(c+e);return h-b})(sa);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes,f=b+G.ntri_flat*e;for(c=b;c<f;c+=e)p(c);return f-b})(E);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*3,f=b+G.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(Z);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes,f=b+G.nquad_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(ma);(function(b){var c,
|
|
|
+U=G.vertex_index_bytes*2;V=G.vertex_index_bytes*3;R=G.vertex_index_bytes*4;o=G.vertex_index_bytes*4+G.material_index_bytes;pa=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes;T=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*2;la=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*3;aa=G.uv_index_bytes;na=G.uv_index_bytes*2;ja=G.uv_index_bytes;ka=G.uv_index_bytes*2;ea=G.uv_index_bytes*3;c=G.vertex_index_bytes*3+G.material_index_bytes;sa=G.vertex_index_bytes*
|
|
|
+4+G.material_index_bytes;Z=G.ntri_flat*c;ga=G.ntri_smooth*(c+G.normal_index_bytes*3);Y=G.ntri_flat_uv*(c+G.uv_index_bytes*3);ma=G.ntri_smooth_uv*(c+G.normal_index_bytes*3+G.uv_index_bytes*3);ia=G.nquad_flat*sa;c=G.nquad_smooth*(sa+G.normal_index_bytes*4);sa=G.nquad_flat_uv*(sa+G.uv_index_bytes*4);E+=function(c){for(var f,h,m,n=G.vertex_coordinate_bytes*3,o=c+G.nvertices*n;c<o;c+=n)f=e(b,c),h=e(b,c+G.vertex_coordinate_bytes),m=e(b,c+G.vertex_coordinate_bytes*2),C.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
|
|
|
+h,m)));return G.nvertices*n}(E);E+=function(c){for(var e,f,h,k=G.normal_coordinate_bytes*3,m=c+G.nnormals*k;c<m;c+=k)e=v(b,c),f=v(b,c+G.normal_coordinate_bytes),h=v(b,c+G.normal_coordinate_bytes*2),H.push(e/127,f/127,h/127);return G.nnormals*k}(E);E+=function(c){for(var f,h,m=G.uv_coordinate_bytes*2,n=c+G.nuvs*m;c<n;c+=m)f=e(b,c),h=e(b,c+G.uv_coordinate_bytes),N.push(f,h);return G.nuvs*m}(E);Z=E+Z;ga=Z+ga;Y=ga+Y;ma=Y+ma;ia=ma+ia;c=ia+c;sa=c+sa;(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes,
|
|
|
+f=e+G.uv_index_bytes*3,h=b+G.ntri_flat_uv*f;for(c=b;c<h;c+=f)t(c),z(c+e);return h-b})(ga);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*3,f=e+G.uv_index_bytes*3,h=b+G.ntri_smooth_uv*f;for(c=b;c<h;c+=f)x(c),z(c+e);return h-b})(Y);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes,f=e+G.uv_index_bytes*4,h=b+G.nquad_flat_uv*f;for(c=b;c<h;c+=f)p(c),A(c+e);return h-b})(c);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*
|
|
|
+4,f=e+G.uv_index_bytes*4,h=b+G.nquad_smooth_uv*f;for(c=b;c<h;c+=f)y(c),A(c+e);return h-b})(sa);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes,f=b+G.ntri_flat*e;for(c=b;c<f;c+=e)t(c);return f-b})(E);(function(b){var c,e=G.vertex_index_bytes*3+G.material_index_bytes+G.normal_index_bytes*3,f=b+G.ntri_smooth*e;for(c=b;c<f;c+=e)x(c);return f-b})(Z);(function(b){var c,e=G.vertex_index_bytes*4+G.material_index_bytes,f=b+G.nquad_flat*e;for(c=b;c<f;c+=e)p(c);return f-b})(ma);(function(b){var c,
|
|
|
e=G.vertex_index_bytes*4+G.material_index_bytes+G.normal_index_bytes*4,f=b+G.nquad_smooth*e;for(c=b;c<f;c+=e)y(c);return f-b})(ia);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
|
|
|
var ColladaLoader=function(){function b(b,c,e){for(var b=Z.evaluate(b,Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new c).parse(h);if(h.id.length==0)h.id=e+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,c=-b,e=0,f;for(f in sa)for(var h=sa[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);c=Math.max(c,m.endTime);e=Math.max(e,m.input.length)}return{start:b,end:c,frames:e}}function e(b,c,f,h){b.world=b.world||
|
|
|
new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var k=b.channels[0].sampler.output[f];k instanceof THREE.Matrix4&&b.world.copy(k)}h&&b.world.multiply(h,b.world);c.push(b);for(h=0;h<b.nodes.length;h++)e(b.nodes[h],c,f,b.world)}function f(b,f,h){var k=O[f.url];if(!k||!k.skin)console.log("could not find skin controller!");else if(!f.skeleton||!f.skeleton.length)console.log("could not find the skeleton for the skin!");else{var m=c(),f=Y.getChildById(f.skeleton[0],!0)||Y.getChildBySid(f.skeleton[0],
|
|
|
!0),n,o,p,t,u=new THREE.Vector3,v;for(n=0;n<b.vertices.length;n++)k.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(h=0;h<m.frames;h++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));e(f,w,h);n=w;o=k.skin;for(t=0;t<n.length;t++){p=n[t];v=-1;for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){v=y;break}if(v>=0){y=o.invBindMatrices[v];p.invBindMatrix=y;p.skinningMatrix=new THREE.Matrix4;p.skinningMatrix.multiply(p.world,y);p.weights=[];
|
|
|
for(y=0;y<o.weights.length;y++)for(var z=0;z<o.weights[y].length;z++){var A=o.weights[y][z];A.joint==v&&p.weights.push(A)}}else throw"could not find joint!";}for(n=0;n<w.length;n++)for(o=0;o<w[n].weights.length;o++)p=w[n].weights[o],t=p.index,p=p.weight,v=b.vertices[t],t=x[t],u.x=v.position.x,u.y=v.position.y,u.z=v.position.z,w[n].skinningMatrix.multiplyVector3(u),t.position.x+=u.x*p,t.position.y+=u.y*p,t.position.z+=u.z*p;b.morphTargets.push({name:"target_"+h,vertices:x})}}}function h(b){var c=new THREE.Object3D,
|
|
|
-e,k,m;c.name=b.id||"";c.matrixAutoUpdate=!1;c.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=O[b.controllers[m].url];switch(n.type){case "skin":if(ca[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);e=b.controllers[m]}else if(O[n.skin.source]&&(k=n=O[n.skin.source],n.morph&&ca[n.morph.source]))o=new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(ca[n.morph.source])o=
|
|
|
-new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),k=b.controllers[m];console.log("DAE: morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=ca[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(c.name.length==0)c.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=ta[ua[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=p[u.symbol]=
|
|
|
+e,k,m;c.name=b.id||"";c.matrixAutoUpdate=!1;c.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=O[b.controllers[m].url];switch(n.type){case "skin":if(da[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);e=b.controllers[m]}else if(O[n.skin.source]&&(k=n=O[n.skin.source],n.morph&&da[n.morph.source]))o=new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(da[n.morph.source])o=
|
|
|
+new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),k=b.controllers[m];console.log("DAE: morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=da[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(c.name.length==0)c.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=ta[ua[u.target].instance_effect.url].shader;v.material.opacity=!v.material.opacity?1:v.material.opacity;u=p[u.symbol]=
|
|
|
v.material;t++}o=u||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});n=n.mesh.geometry3js;if(t>1){o=new THREE.MeshFaceMaterial;for(j=0;j<n.faces.length;j++)t=n.faces[j],t.materials=[p[t.daeMaterial]]}if(e!==void 0)f(n,e),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=e.skeleton,o.skinController=O[e.url],o.skinInstanceController=e,o.name="skin_"+Aa.length,Aa.push(o);else if(k!==void 0){p=n;t=k instanceof x?O[k.url]:k;if(!t||!t.morph)console.log("could not find morph controller!");
|
|
|
-else{t=t.morph;for(v=0;v<t.targets.length;v++){var w=ca[t.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:w.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+za.length;za.push(o)}else o=new THREE.Mesh(n,o);c.addChild(o)}}for(m=0;m<b.nodes.length;m++)c.addChild(h(b.nodes[m],b));return c}function m(){this.init_from=
|
|
|
-this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function u(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function v(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function w(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=
|
|
|
-this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function A(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function C(){}function E(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function G(){this.source="";
|
|
|
+else{t=t.morph;for(v=0;v<t.targets.length;v++){var w=da[t.targets[v]];if(w.mesh&&w.mesh.primitives&&w.mesh.primitives.length)w=w.mesh.primitives[0].geometry,w.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:w.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+za.length;za.push(o)}else o=new THREE.Mesh(n,o);c.addChild(o)}}for(m=0;m<b.nodes.length;m++)c.addChild(h(b.nodes[m],b));return c}function m(){this.init_from=
|
|
|
+this.id=""}function k(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function u(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function v(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function w(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function t(){this.type=
|
|
|
+this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function x(){this.url="";this.skeleton=[];this.instance_material=[]}function p(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function A(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function C(){}function E(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function G(){this.source="";
|
|
|
this.stride=this.count=0;this.params=[]}function H(){this.input={}}function N(){this.semantic="";this.offset=0;this.source="";this.set=0}function S(b){this.id=b;this.type=null}function J(){this.name=this.id="";this.instance_effect=null}function I(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(b,c){this.type=b;this.effect=c;this.material=null}function W(b){this.effect=b;this.format=this.init_from=
|
|
|
null}function D(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function M(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function U(){this.url=""}function V(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function R(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function o(b){this.id="";this.animation=b;this.inputs=[];this.endTime=
|
|
|
this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function pa(b){var c=b.getAttribute("id");if(ma[c]!=void 0)return ma[c];ma[c]=(new S(c)).parse(b);return ma[c]}function T(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function la(b){for(var b=na(b),c=[],e=0;e<b.length;e++)c.push(parseFloat(b[e]));return c}function aa(b){for(var b=na(b),c=[],e=0;e<b.length;e++)c.push(parseInt(b[e],10));return c}function na(b){return b.replace(/^\s+/,"").replace(/\s+$/,
|
|
|
-"").split(/\s+/)}function ja(b,c,e){return b.hasAttribute(c)?parseInt(b.getAttribute(c),10):e}function ka(b,c){if(b===void 0){for(var e="0.";e.length<c+2;)e+="0";return e}c=c||2;e=b.toString().split(".");for(e[1]=e.length>1?e[1].substr(0,c):"0";e[1].length<c;)e[1]+="0";return e.join(".")}function da(b,c){var e="";e+=ka(b.x,c)+",";e+=ka(b.y,c)+",";e+=ka(b.z,c);return e}var Z=null,fa=null,Y,ma={},ia={},sa={},O={},ca={},ua={},ta={},ra,wa=null,Ca,za,Aa,Ea=THREE.SmoothShading;m.prototype.parse=function(b){this.id=
|
|
|
+"").split(/\s+/)}function ja(b,c,e){return b.hasAttribute(c)?parseInt(b.getAttribute(c),10):e}function ka(b,c){if(b===void 0){for(var e="0.";e.length<c+2;)e+="0";return e}c=c||2;e=b.toString().split(".");for(e[1]=e.length>1?e[1].substr(0,c):"0";e[1].length<c;)e[1]+="0";return e.join(".")}function ea(b,c){var e="";e+=ka(b.x,c)+",";e+=ka(b.y,c)+",";e+=ka(b.z,c);return e}var Z=null,ga=null,Y,ma={},ia={},sa={},O={},da={},ua={},ta={},ra,wa=null,Ca,za,Aa,Ea=THREE.SmoothShading;m.prototype.parse=function(b){this.id=
|
|
|
b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeName=="init_from")this.init_from=e.textContent}return this};k.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "skin":this.skin=(new u).parse(e);this.type=e.nodeName;break;case "morph":this.morph=(new n).parse(e),this.type=e.nodeName}}return this};n.prototype.parse=function(b){var c=
|
|
|
{},e=[],f;this.method=b.getAttribute("method");this.source=b.getAttribute("source").replace(/^#/,"");for(f=0;f<b.childNodes.length;f++){var h=b.childNodes[f];if(h.nodeType==1)switch(h.nodeName){case "source":h=(new S).parse(h);c[h.id]=h;break;case "targets":e=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<e.length;f++)switch(b=e[f],h=c[b.source],b.semantic){case "MORPH_TARGET":this.targets=h.read();break;case "MORPH_WEIGHT":this.weights=h.read()}return this};n.prototype.parseInputs=
|
|
|
function(b){for(var c=[],e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "input":c.push((new N).parse(f))}}return c};u.prototype.parse=function(b){var c={},e,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var h=0;h<b.childNodes.length;h++){var k=b.childNodes[h];if(k.nodeType==1)switch(k.nodeName){case "bind_shape_matrix":k=la(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
|
|
@@ -562,17 +562,17 @@ case "WEIGHT":t.weight=c[v.source].data[w]}}o.push(t);m+=h.length}for(p=0;p<o.le
|
|
|
this.nodes=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new w).parse(e))}}return this};w.prototype.getChannelForTransform=function(b){for(var c=0;c<this.channels.length;c++){var e=this.channels[c],f=e.target.split("/");f.shift();var h=f.shift(),k=h.indexOf(".")>=0,m=h.indexOf("(")>=0,n;if(k)f=h.split("."),h=f.shift(),f.shift();else if(m){n=h.split("(");h=n.shift();for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,
|
|
|
""))}if(h==b)return e.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},e}return null};w.prototype.getChildById=function(b,c){if(this.id==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildById(b,c);if(f)return f}return null};w.prototype.getChildBySid=function(b,c){if(this.sid==b)return this;if(c)for(var e=0;e<this.nodes.length;e++){var f=this.nodes[e].getChildBySid(b,c);if(f)return f}return null};w.prototype.getTransformBySid=function(b){for(var c=0;c<this.transforms.length;c++)if(this.transforms[c].sid==
|
|
|
b)return this.transforms[c];return null};w.prototype.parse=function(b){var c;this.id=b.getAttribute("id");this.sid=b.getAttribute("sid");this.name=b.getAttribute("name");this.type=b.getAttribute("type");this.type=this.type=="JOINT"?this.type:"NODE";this.nodes=[];this.transforms=[];this.geometries=[];this.controllers=[];this.matrix=new THREE.Matrix4;for(var e=0;e<b.childNodes.length;e++)if(c=b.childNodes[e],c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new w).parse(c));break;case "instance_camera":break;
|
|
|
-case "instance_controller":this.controllers.push((new x).parse(c));break;case "instance_geometry":this.geometries.push((new y).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=Z.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(c));
|
|
|
+case "instance_controller":this.controllers.push((new x).parse(c));break;case "instance_geometry":this.geometries.push((new y).parse(c));break;case "instance_light":break;case "instance_node":c=c.getAttribute("url").replace(/^#/,"");(c=Z.evaluate(".//dae:library_nodes//dae:node[@id='"+c+"']",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(c));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new t).parse(c));
|
|
|
break;case "extra":break;default:console.log(c.nodeName)}b=[];e=1E6;c=-1E6;for(var f in sa)for(var h=sa[f],k=0;k<h.channel.length;k++){var m=h.channel[k],n=h.sampler[k];f=m.target.split("/")[0];if(f==this.id)n.create(),m.sampler=n,e=Math.min(e,n.startTime),c=Math.max(c,n.endTime),b.push(m)}if(b.length)this.startTime=e,this.endTime=c;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(e=0;e<b.input.length-1;e++)f=Math.min(f,b.input[e+
|
|
|
-1]-b.input[e])}e=[];for(b=this.startTime;b<this.endTime;b+=f){c=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var t=o.sampler,u,o=0;o<t.input.length-1;o++)if(t.input[o+1]>c){u=t.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14,
|
|
|
-c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};p.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=la(b.textContent);this.updateMatrix();return this};p.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
|
|
|
+1]-b.input[e])}e=[];for(b=this.startTime;b<this.endTime;b+=f){c=b;for(var h={},o=k=void 0,k=0;k<this.channels.length;k++)o=this.channels[k],h[o.sid]=o;m=new THREE.Matrix4;for(k=0;k<this.transforms.length;k++)if(n=this.transforms[k],o=h[n.sid],o!==void 0){for(var p=o.sampler,u,o=0;o<p.input.length-1;o++)if(p.input[o+1]>c){u=p.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);c=m;e.push({time:b,pos:[c.n14,
|
|
|
+c.n24,c.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=e}this.updateMatrix();return this};w.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};t.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=la(b.textContent);this.updateMatrix();return this};t.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
|
|
|
this.data[1],this.data[2],this.data[3],this.data[4],this.data[5],this.data[6],this.data[7],this.data[8],this.data[9],this.data[10],this.data[11],this.data[12],this.data[13],this.data[14],this.data[15]);break;case "translate":this.matrix.setTranslation(this.data[0],this.data[1],this.data[2]);break;case "rotate":b=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),b);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
|
|
|
-x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "skeleton":this.skeleton.push(e.textContent.replace(/^#/,""));break;case "bind_material":if(e=Z.evaluate(".//dae:instance_material",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=e.iterateNext();f;)this.instance_material.push((new t).parse(f)),f=e.iterateNext()}}return this};
|
|
|
-t.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=Z.evaluate(".//dae:instance_material",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new t).parse(c)),
|
|
|
-c=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new A(this)).parse(e)}}return this};A.prototype.parse=function(b){function c(b,e){var f=da(b.position);h[f]===void 0&&(h[f]={v:b,index:e});return h[f]}this.primitives=[];var e;for(e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];switch(f.nodeName){case "source":pa(f);break;case "vertices":this.vertices=
|
|
|
+x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "skeleton":this.skeleton.push(e.textContent.replace(/^#/,""));break;case "bind_material":if(e=Z.evaluate(".//dae:instance_material",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=e.iterateNext();f;)this.instance_material.push((new p).parse(f)),f=e.iterateNext()}}return this};
|
|
|
+p.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1&&e.nodeName=="bind_material"){if(b=Z.evaluate(".//dae:instance_material",e,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(c=b.iterateNext();c;)this.instance_material.push((new p).parse(c)),
|
|
|
+c=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "mesh":this.mesh=(new A(this)).parse(e)}}return this};A.prototype.parse=function(b){function c(b,e){var f=ea(b.position);h[f]===void 0&&(h[f]={v:b,index:e});return h[f]}this.primitives=[];var e;for(e=0;e<b.childNodes.length;e++){var f=b.childNodes[e];switch(f.nodeName){case "source":pa(f);break;case "vertices":this.vertices=
|
|
|
(new H).parse(f);break;case "triangles":this.primitives.push((new E).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new C).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=ma[this.vertices.input.POSITION.source].data;for(b=e=0;e<f.length;e+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[e],f[e+1],f[e+2]));c(k,b);this.geometry3js.vertices.push(k)}for(e=0;e<this.primitives.length;e++)primitive=this.primitives[e],primitive.setVertices(this.vertices),
|
|
|
this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};A.prototype.handlePrimitive=function(b,c,e){var f=0,h,k,m=b.p,n=b.inputs,o,p,t,u=0,v=3,w=[];for(h=0;h<n.length;h++)o=n[h],o.semantic=="TEXCOORD"&&w.push(o.set);for(;f<m.length;){var x=[],y=[],z={};b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=n[k],source=
|
|
|
-ma[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=da(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t+0],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]),z[o.set].push(new THREE.UV(source.data[t+0],source.data[t+1]))}k=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]]);k.daeMaterial=b.material;c.faces.push(k);for(k=0;k<w.length;k++)o=
|
|
|
+ma[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=ea(c.vertices[p].position);x.push(e[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t+0],source.data[t+1],source.data[t+2]));break;case "TEXCOORD":z[o.set]===void 0&&(z[o.set]=[]),z[o.set].push(new THREE.UV(source.data[t+0],source.data[t+1]))}k=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]]);k.daeMaterial=b.material;c.faces.push(k);for(k=0;k<w.length;k++)o=
|
|
|
z[w[k]],c.faceVertexUvs[k].push([o[0],o[1],o[2]]);if(v>3)for(h=2;h<x.length-1;h++){k=new THREE.Face3(x[0],x[h],x[h+1],[y[0],y[h],y[h+1]]);k.daeMaterial=b.material;c.faces.push(k);for(k=0;k<w.length;k++)o=z[w[k]],c.faceVertexUvs[k].push([o[0],o[h],o[h+1]])}f+=n.length*v}};C.prototype=new E;C.prototype.constructor=C;E.prototype.setVertices=function(b){for(var c=0;c<this.inputs.length;c++)if(this.inputs[c].source==b.id)this.inputs[c].source=b.input.POSITION.source};E.prototype.parse=function(b){this.inputs=
|
|
|
[];this.material=b.getAttribute("material");this.count=ja(b,"count",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];switch(e.nodeName){case "input":this.inputs.push((new N).parse(b.childNodes[c]));break;case "vcount":this.vcount=aa(e.textContent);break;case "p":this.p=aa(e.textContent)}}return this};G.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=ja(b,"count",0);this.stride=ja(b,"stride",0);for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];
|
|
|
if(e.nodeName=="param"){var f={};f.name=e.getAttribute("name");f.type=e.getAttribute("type");this.params.push(f)}}return this};H.prototype.parse=function(b){this.id=b.getAttribute("id");for(var c=0;c<b.childNodes.length;c++)b.childNodes[c].nodeName=="input"&&(input=(new N).parse(b.childNodes[c]),this.input[input.semantic]=input);return this};N.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,"");this.set=ja(b,"set",-1);this.offset=
|
|
@@ -591,49 +591,49 @@ function(b){for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.no
|
|
|
parseInt(h[c].replace(/\)/,""))}this.sid=b;this.dotSyntax=e;this.arrSyntax=f;this.arrIndices=h;this.member=k;return this};o.prototype.parse=function(b){this.id=b.getAttribute("id");this.inputs=[];for(var c=0;c<b.childNodes.length;c++){var e=b.childNodes[c];if(e.nodeType==1)switch(e.nodeName){case "input":this.inputs.push((new N).parse(e))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var c=this.inputs[b],e=this.animation.source[c.source];switch(c.semantic){case "INPUT":this.input=
|
|
|
e.read();break;case "OUTPUT":this.output=e.read();break;case "INTERPOLATION":this.interpolation=e.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(c.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(b=0;b<this.input.length;b++)this.startTime=Math.min(this.startTime,this.input[b]),this.endTime=Math.max(this.endTime,this.input[b]);this.duration=this.endTime-this.startTime}};return{load:function(e,f){if(document.implementation&&
|
|
|
document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var n=new XMLHttpRequest;n.overrideMimeType&&n.overrideMimeType("text/xml");n.onreadystatechange=function(){if(n.readyState==4&&(n.status==0||n.status==200)){wa=f;var o,p=e;Z=n.responseXML;o=wa;p!==void 0&&(p=p.split("/"),p.pop(),Ca=p.join("/")+"/");ia=b("//dae:library_images/dae:image",m,"image");ua=b("//dae:library_materials/dae:material",
|
|
|
-J,"material");ta=b("//dae:library_effects/dae:effect",M,"effect");ca=b("//dae:library_geometries/dae:geometry",z,"geometry");O=b("//dae:library_controllers/dae:controller",k,"controller");sa=b("//dae:library_animations/dae:animation",V,"animation");ra=b(".//dae:library_visual_scenes/dae:visual_scene",v,"visual_scene");za=[];Aa=[];(p=Z.evaluate(".//dae:scene/dae:instance_visual_scene",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),Y=ra[p]):
|
|
|
-Y=null;fa=new THREE.Object3D;for(p=0;p<Y.nodes.length;p++)fa.addChild(h(Y.nodes[p]));c();for(var t in sa);t={scene:fa,morphs:za,skins:Aa,dae:{images:ia,materials:ua,effects:ta,geometries:ca,controllers:O,animations:sa,visualScenes:ra,scene:Y}};o&&o(t)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Ea=b},applySkin:f,geometries:ca}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
|
|
|
+J,"material");ta=b("//dae:library_effects/dae:effect",M,"effect");da=b("//dae:library_geometries/dae:geometry",z,"geometry");O=b("//dae:library_controllers/dae:controller",k,"controller");sa=b("//dae:library_animations/dae:animation",V,"animation");ra=b(".//dae:library_visual_scenes/dae:visual_scene",v,"visual_scene");za=[];Aa=[];(p=Z.evaluate(".//dae:scene/dae:instance_visual_scene",Z,T,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),Y=ra[p]):
|
|
|
+Y=null;ga=new THREE.Object3D;for(p=0;p<Y.nodes.length;p++)ga.addChild(h(Y.nodes[p]));c();for(var t in sa);t={scene:ga,morphs:za,skins:Aa,dae:{images:ia,materials:ua,effects:ta,geometries:da,controllers:O,animations:sa,visualScenes:ra,scene:Y}};o&&o(t)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Ea=b},applySkin:f,geometries:da}};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,h=b.texture_path?b.texture_path:this.extractUrlbase(e),b=new Worker(e);b.onmessage=function(b){c.createModel(b.data,f,h);c.onLoadComplete()};this.onLoadStart();b.postMessage((new Date).getTime())};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(b,c,e){var f=new THREE.Geometry,h=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,h,u,v,w,p,x,t,y,z,A,C,E,G,H=b.faces;p=b.vertices;var N=b.normals,S=b.colors,J=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&J++;for(e=0;e<J;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];v=0;for(w=p.length;v<w;)x=new THREE.Vertex,x.position.x=p[v++]*c,x.position.y=
|
|
|
-p[v++]*c,x.position.z=p[v++]*c,f.vertices.push(x);v=0;for(w=H.length;v<w;){c=H[v++];p=c&1;u=c&2;e=c&4;h=c&8;t=c&16;x=c&32;z=c&64;c&=128;p?(A=new THREE.Face4,A.a=H[v++],A.b=H[v++],A.c=H[v++],A.d=H[v++],p=4):(A=new THREE.Face3,A.a=H[v++],A.b=H[v++],A.c=H[v++],p=3);if(u)u=H[v++],A.materials=f.materials[u];u=f.faces.length;if(e)for(e=0;e<J;e++)C=b.uvs[e],y=H[v++],G=C[y*2],y=C[y*2+1],f.faceUvs[e][u]=new THREE.UV(G,y);if(h)for(e=0;e<J;e++){C=b.uvs[e];E=[];for(h=0;h<p;h++)y=H[v++],G=C[y*2],y=C[y*2+1],E[h]=
|
|
|
-new THREE.UV(G,y);f.faceVertexUvs[e][u]=E}if(t)t=H[v++]*3,h=new THREE.Vector3,h.x=N[t++],h.y=N[t++],h.z=N[t],A.normal=h;if(x)for(e=0;e<p;e++)t=H[v++]*3,h=new THREE.Vector3,h.x=N[t++],h.y=N[t++],h.z=N[t],A.vertexNormals.push(h);if(z)x=H[v++],x=new THREE.Color(S[x]),A.color=x;if(c)for(e=0;e<p;e++)x=H[v++],x=new THREE.Color(S[x]),A.vertexColors.push(x);f.faces.push(A)}}})(h);(function(){var c,e,h,u;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],u=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
|
|
|
-u,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],u=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,u,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,u,v,w,p,x,t,y;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];t=f.morphTargets[e].vertices;y=b.morphTargets[e].vertices;u=0;for(v=y.length;u<v;u+=3)w=y[u]*c,p=y[u+1]*
|
|
|
-c,x=y[u+2]*c,t.push(new THREE.Vertex(new THREE.Vector3(w,p,x)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];v=f.morphColors[e].colors;w=b.morphColors[e].colors;c=0;for(u=w.length;c<u;c+=3)p=new THREE.Color(16755200),p.setRGB(w[c],w[c+1],w[c+2]),v.push(p)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=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,h=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,h,u,v,w,t,x,p,y,z,A,C,E,G,H=b.faces;t=b.vertices;var N=b.normals,S=b.colors,J=0;for(e=0;e<b.uvs.length;e++)b.uvs[e].length&&J++;for(e=0;e<J;e++)f.faceUvs[e]=[],f.faceVertexUvs[e]=[];v=0;for(w=t.length;v<w;)x=new THREE.Vertex,x.position.x=t[v++]*c,x.position.y=
|
|
|
+t[v++]*c,x.position.z=t[v++]*c,f.vertices.push(x);v=0;for(w=H.length;v<w;){c=H[v++];t=c&1;u=c&2;e=c&4;h=c&8;p=c&16;x=c&32;z=c&64;c&=128;t?(A=new THREE.Face4,A.a=H[v++],A.b=H[v++],A.c=H[v++],A.d=H[v++],t=4):(A=new THREE.Face3,A.a=H[v++],A.b=H[v++],A.c=H[v++],t=3);if(u)u=H[v++],A.materials=f.materials[u];u=f.faces.length;if(e)for(e=0;e<J;e++)C=b.uvs[e],y=H[v++],G=C[y*2],y=C[y*2+1],f.faceUvs[e][u]=new THREE.UV(G,y);if(h)for(e=0;e<J;e++){C=b.uvs[e];E=[];for(h=0;h<t;h++)y=H[v++],G=C[y*2],y=C[y*2+1],E[h]=
|
|
|
+new THREE.UV(G,y);f.faceVertexUvs[e][u]=E}if(p)p=H[v++]*3,h=new THREE.Vector3,h.x=N[p++],h.y=N[p++],h.z=N[p],A.normal=h;if(x)for(e=0;e<t;e++)p=H[v++]*3,h=new THREE.Vector3,h.x=N[p++],h.y=N[p++],h.z=N[p],A.vertexNormals.push(h);if(z)x=H[v++],x=new THREE.Color(S[x]),A.color=x;if(c)for(e=0;e<t;e++)x=H[v++],x=new THREE.Color(S[x]),A.vertexColors.push(x);f.faces.push(A)}}})(h);(function(){var c,e,h,u;if(b.skinWeights){c=0;for(e=b.skinWeights.length;c<e;c+=2)h=b.skinWeights[c],u=b.skinWeights[c+1],f.skinWeights.push(new THREE.Vector4(h,
|
|
|
+u,0,0))}if(b.skinIndices){c=0;for(e=b.skinIndices.length;c<e;c+=2)h=b.skinIndices[c],u=b.skinIndices[c+1],f.skinIndices.push(new THREE.Vector4(h,u,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(c){if(b.morphTargets!==void 0){var e,h,u,v,w,t,x,p,y;e=0;for(h=b.morphTargets.length;e<h;e++){f.morphTargets[e]={};f.morphTargets[e].name=b.morphTargets[e].name;f.morphTargets[e].vertices=[];p=f.morphTargets[e].vertices;y=b.morphTargets[e].vertices;u=0;for(v=y.length;u<v;u+=3)w=y[u]*c,t=y[u+1]*
|
|
|
+c,x=y[u+2]*c,p.push(new THREE.Vertex(new THREE.Vector3(w,t,x)))}}if(b.morphColors!==void 0){e=0;for(h=b.morphColors.length;e<h;e++){f.morphColors[e]={};f.morphColors[e].name=b.morphColors[e].name;f.morphColors[e].colors=[];v=f.morphColors[e].colors;w=b.morphColors[e].colors;c=0;for(u=w.length;c<u;c+=3)t=new THREE.Color(16755200),t.setRGB(w[c],w[c+1],w[c+2]),v.push(t)}}})(h);(function(){if(b.edges!==void 0){var c,e,h;for(c=0;c<b.edges.length;c+=2)e=b.edges[c],h=b.edges[c+1],f.edges.push(new THREE.Edge(f.vertices[e],
|
|
|
f.vertices[h],e,h))}})();f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};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 h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function n(){for(t in M.objects)if(!T.objects[t])if(E=M.objects[t],E.geometry!==void 0){if(S=T.geometries[E.geometry]){var b=!1;W=[];for(aa=0;aa<E.materials.length;aa++)W[aa]=T.materials[E.materials[aa]],b=W[aa]instanceof THREE.MeshShaderMaterial;b&&S.computeTangents();G=E.position;r=
|
|
|
-E.rotation;q=E.quaternion;s=E.scale;q=0;W.length==0&&(W[0]=new THREE.MeshFaceMaterial);W.length>1&&(W=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(S,W);object.name=t;object.position.set(G[0],G[1],G[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=E.visible;T.scene.addObject(object);T.objects[t]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(b));
|
|
|
-if(E.castsShadow)b=new THREE.ShadowVolume(S),T.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}}else G=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=t,object.position.set(G[0],G[1],G[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=E.visible!==void 0?E.visible:!1,T.scene.addObject(object),T.objects[t]=object,T.empties[t]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}function u(b){return function(c){T.geometries[b]=c;n();V-=1;e.onLoadComplete();w()}}function v(b){return function(c){T.geometries[b]=c}}function w(){e.callbackProgress({totalModels:o,totalTextures:pa,loadedModels:o-V,loadedTextures:pa-R},T);e.onLoadProgress();V==0&&R==0&&c(T)}
|
|
|
-var p,x,t,y,z,A,C,E,G,H,N,S,J,I,K,W,D,M,U,V,R,o,pa,T;M=b.data;K=new THREE.BinaryLoader;U=new THREE.JSONLoader;R=V=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(t in M.objects)if(E=M.objects[t],E.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(M.transform){b=M.transform.position;H=M.transform.rotation;var la=M.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);H&&T.scene.rotation.set(H[0],
|
|
|
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,c){return c=="relativeToHTML"?b:h+"/"+b}function n(){for(p in M.objects)if(!T.objects[p])if(E=M.objects[p],E.geometry!==void 0){if(S=T.geometries[E.geometry]){var b=!1;W=[];for(aa=0;aa<E.materials.length;aa++)W[aa]=T.materials[E.materials[aa]],b=W[aa]instanceof THREE.MeshShaderMaterial;b&&S.computeTangents();G=E.position;r=
|
|
|
+E.rotation;q=E.quaternion;s=E.scale;q=0;W.length==0&&(W[0]=new THREE.MeshFaceMaterial);W.length>1&&(W=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(S,W);object.name=p;object.position.set(G[0],G[1],G[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=E.visible;T.scene.addObject(object);T.objects[p]=object;E.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(b));
|
|
|
+if(E.castsShadow)b=new THREE.ShadowVolume(S),T.scene.addChild(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}}else G=E.position,r=E.rotation,q=E.quaternion,s=E.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(G[0],G[1],G[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=E.visible!==void 0?E.visible:!1,T.scene.addObject(object),T.objects[p]=object,T.empties[p]=object,E.trigger&&E.trigger.toLowerCase()!="none"&&(b={type:E.trigger,object:E},T.triggers[object.name]=b)}function u(b){return function(c){T.geometries[b]=c;n();V-=1;e.onLoadComplete();w()}}function v(b){return function(c){T.geometries[b]=c}}function w(){e.callbackProgress({totalModels:o,totalTextures:pa,loadedModels:o-V,loadedTextures:pa-R},T);e.onLoadProgress();V==0&&R==0&&c(T)}
|
|
|
+var t,x,p,y,z,A,C,E,G,H,N,S,J,I,K,W,D,M,U,V,R,o,pa,T;M=b.data;K=new THREE.BinaryLoader;U=new THREE.JSONLoader;R=V=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(p in M.objects)if(E=M.objects[p],E.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(M.transform){b=M.transform.position;H=M.transform.rotation;var la=M.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);H&&T.scene.rotation.set(H[0],
|
|
|
H[1],H[2]);la&&T.scene.scale.set(la[0],la[1],la[2]);(b||H||la)&&T.scene.updateMatrix()}b=function(){R-=1;w();e.onLoadComplete()};for(z in M.cameras){H=M.cameras[z];if(H.type=="perspective")J=new THREE.Camera(H.fov,H.aspect,H.near,H.far);else if(H.type=="ortho")J=new THREE.Camera,J.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);G=H.position;H=H.target;J.position.set(G[0],G[1],G[2]);J.target.position.set(H[0],H[1],H[2]);T.cameras[z]=J}for(y in M.lights)z=M.lights[y],
|
|
|
J=z.color!==void 0?z.color:16777215,H=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(G=z.direction,D=new THREE.DirectionalLight(J,H),D.position.set(G[0],G[1],G[2]),D.position.normalize()):z.type=="point"?(G=z.position,d=z.distance,D=new THREE.PointLight(J,H,d),D.position.set(G[0],G[1],G[2])):z.type=="ambient"&&(D=new THREE.AmbientLight(J)),T.scene.addLight(D),T.lights[y]=D;for(A in M.fogs)y=M.fogs[A],y.type=="linear"?I=new THREE.Fog(0,y.near,y.far):y.type=="exp2"&&(I=new THREE.FogExp2(0,
|
|
|
-y.density)),H=y.color,I.color.setRGB(H[0],H[1],H[2]),T.fogs[A]=I;if(T.cameras&&M.defaults.camera)T.currentCamera=T.cameras[M.defaults.camera];if(T.fogs&&M.defaults.fog)T.scene.fog=T.fogs[M.defaults.fog];H=M.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(H[0],H[1],H[2]);T.bgColorAlpha=M.defaults.bgalpha;for(p in M.geometries)if(A=M.geometries[p],A.type=="bin_mesh"||A.type=="ascii_mesh")V+=1,e.onLoadStart();o=V;for(p in M.geometries)A=M.geometries[p],A.type=="cube"?(S=new THREE.CubeGeometry(A.width,
|
|
|
-A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),T.geometries[p]=S):A.type=="plane"?(S=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),T.geometries[p]=S):A.type=="sphere"?(S=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),T.geometries[p]=S):A.type=="cylinder"?(S=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),T.geometries[p]=S):A.type=="torus"?(S=new THREE.TorusGeometry(A.radius,A.tube,
|
|
|
-A.segmentsR,A.segmentsT),T.geometries[p]=S):A.type=="icosahedron"?(S=new THREE.IcosahedronGeometry(A.subdivisions),T.geometries[p]=S):A.type=="bin_mesh"?K.load({model:f(A.url,M.urlBaseType),callback:u(p)}):A.type=="ascii_mesh"?U.load({model:f(A.url,M.urlBaseType),callback:u(p)}):A.type=="embedded_mesh"&&(A=M.embeds[A.id])&&U.createModel(A,v(p),"");for(C in M.textures)if(p=M.textures[C],p.url instanceof Array){R+=p.url.length;for(K=0;K<p.url.length;K++)e.onLoadStart()}else R+=1,e.onLoadStart();pa=
|
|
|
-R;for(C in M.textures){p=M.textures[C];if(p.mapping!=void 0&&THREE[p.mapping]!=void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){K=[];for(var aa=0;aa<p.url.length;aa++)K[aa]=f(p.url[aa],M.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,p.mapping,b)}else{K=THREE.ImageUtils.loadTexture(f(p.url,M.urlBaseType),p.mapping,b);if(THREE[p.minFilter]!=void 0)K.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)K.magFilter=THREE[p.magFilter];if(p.repeat){K.repeat.set(p.repeat[0],p.repeat[1]);
|
|
|
-if(p.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}p.offset&&K.offset.set(p.offset[0],p.offset[1]);if(p.wrap){U={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(U[p.wrap[0]]!==void 0)K.wrapS=U[p.wrap[0]];if(U[p.wrap[1]]!==void 0)K.wrapT=U[p.wrap[1]]}}T.textures[C]=K}for(x in M.materials){C=M.materials[x];for(N in C.parameters)if(N=="envMap"||N=="map"||N=="lightMap")C.parameters[N]=T.textures[C.parameters[N]];else if(N=="shading")C.parameters[N]=
|
|
|
+y.density)),H=y.color,I.color.setRGB(H[0],H[1],H[2]),T.fogs[A]=I;if(T.cameras&&M.defaults.camera)T.currentCamera=T.cameras[M.defaults.camera];if(T.fogs&&M.defaults.fog)T.scene.fog=T.fogs[M.defaults.fog];H=M.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(H[0],H[1],H[2]);T.bgColorAlpha=M.defaults.bgalpha;for(t in M.geometries)if(A=M.geometries[t],A.type=="bin_mesh"||A.type=="ascii_mesh")V+=1,e.onLoadStart();o=V;for(t in M.geometries)A=M.geometries[t],A.type=="cube"?(S=new THREE.CubeGeometry(A.width,
|
|
|
+A.height,A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),T.geometries[t]=S):A.type=="plane"?(S=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),T.geometries[t]=S):A.type=="sphere"?(S=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),T.geometries[t]=S):A.type=="cylinder"?(S=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),T.geometries[t]=S):A.type=="torus"?(S=new THREE.TorusGeometry(A.radius,A.tube,
|
|
|
+A.segmentsR,A.segmentsT),T.geometries[t]=S):A.type=="icosahedron"?(S=new THREE.IcosahedronGeometry(A.subdivisions),T.geometries[t]=S):A.type=="bin_mesh"?K.load({model:f(A.url,M.urlBaseType),callback:u(t)}):A.type=="ascii_mesh"?U.load({model:f(A.url,M.urlBaseType),callback:u(t)}):A.type=="embedded_mesh"&&(A=M.embeds[A.id])&&U.createModel(A,v(t),"");for(C in M.textures)if(t=M.textures[C],t.url instanceof Array){R+=t.url.length;for(K=0;K<t.url.length;K++)e.onLoadStart()}else R+=1,e.onLoadStart();pa=
|
|
|
+R;for(C in M.textures){t=M.textures[C];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){K=[];for(var aa=0;aa<t.url.length;aa++)K[aa]=f(t.url[aa],M.urlBaseType);K=THREE.ImageUtils.loadTextureCube(K,t.mapping,b)}else{K=THREE.ImageUtils.loadTexture(f(t.url,M.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)K.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)K.magFilter=THREE[t.magFilter];if(t.repeat){K.repeat.set(t.repeat[0],t.repeat[1]);
|
|
|
+if(t.repeat[0]!=1)K.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)K.wrapT=THREE.RepeatWrapping}t.offset&&K.offset.set(t.offset[0],t.offset[1]);if(t.wrap){U={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(U[t.wrap[0]]!==void 0)K.wrapS=U[t.wrap[0]];if(U[t.wrap[1]]!==void 0)K.wrapT=U[t.wrap[1]]}}T.textures[C]=K}for(x in M.materials){C=M.materials[x];for(N in C.parameters)if(N=="envMap"||N=="map"||N=="lightMap")C.parameters[N]=T.textures[C.parameters[N]];else if(N=="shading")C.parameters[N]=
|
|
|
C.parameters[N]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(N=="blending")C.parameters[N]=THREE[C.parameters[N]]?THREE[C.parameters[N]]:THREE.NormalBlending;else if(N=="combine")C.parameters[N]=C.parameters[N]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(N=="vertexColors")if(C.parameters[N]=="face")C.parameters[N]=THREE.FaceColors;else if(C.parameters[N])C.parameters[N]=THREE.VertexColors;if(C.parameters.opacity!==void 0&&C.parameters.opacity<1)C.parameters.transparent=
|
|
|
-!0;if(C.parameters.normalMap){p=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(p.uniforms);K=C.parameters.color;U=C.parameters.specular;A=C.parameters.ambient;I=C.parameters.shininess;b.tNormal.texture=T.textures[C.parameters.normalMap];if(C.parameters.normalMapFactor)b.uNormalScale.value=C.parameters.normalMapFactor;if(C.parameters.map)b.tDiffuse.texture=C.parameters.map,b.enableDiffuse.value=!0;if(C.parameters.lightMap)b.tAO.texture=C.parameters.lightMap,b.enableAO.value=!0;if(C.parameters.specularMap)b.tSpecular.texture=
|
|
|
-T.textures[C.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(K);b.uSpecularColor.value.setHex(U);b.uAmbientColor.value.setHex(A);b.uShininess.value=I;if(C.parameters.opacity)b.uOpacity.value=C.parameters.opacity;C=new THREE.MeshShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:b,lights:!0,fog:!0})}else C=new THREE[C.type](C.parameters);T.materials[x]=C}n();e.callbackSync(T)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
|
+!0;if(C.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);K=C.parameters.color;U=C.parameters.specular;A=C.parameters.ambient;I=C.parameters.shininess;b.tNormal.texture=T.textures[C.parameters.normalMap];if(C.parameters.normalMapFactor)b.uNormalScale.value=C.parameters.normalMapFactor;if(C.parameters.map)b.tDiffuse.texture=C.parameters.map,b.enableDiffuse.value=!0;if(C.parameters.lightMap)b.tAO.texture=C.parameters.lightMap,b.enableAO.value=!0;if(C.parameters.specularMap)b.tSpecular.texture=
|
|
|
+T.textures[C.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(K);b.uSpecularColor.value.setHex(U);b.uAmbientColor.value.setHex(A);b.uShininess.value=I;if(C.parameters.opacity)b.uOpacity.value=C.parameters.opacity;C=new THREE.MeshShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else C=new THREE[C.type](C.parameters);T.materials[x]=C}n();e.callbackSync(T)}},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,h=b.scale!==void 0?b.scale:1,m=b.offsetX!==void 0?b.offsetX:0,k=b.offsetY!==void 0?b.offsetY:0,n=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,h,m,k,n):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)};
|
|
|
THREE.UTF8Loader.prototype.decompressMesh=function(b){var c=b.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var e=new Float32Array(8*c),f=1,h=0;h<8;h++){for(var m=0,k=0;k<c;++k){var n=b.charCodeAt(k+f);m+=n>>1^-(n&1);e[8*k+h]=m}f+=c}c=b.length-f;m=new Uint16Array(c);for(h=k=0;h<c;h++)n=b.charCodeAt(h+f),m[h]=k-n,n==0&&k++;return[e,m]};
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,m){var k=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(b),v=[],w=[];(function(b,k,t){for(var u,v,w,C=b.length;t<C;t+=k)u=b[t],v=b[t+1],w=b[t+2],u=u/16383*e,v=v/16383*e,w=w/16383*e,u+=f,v+=h,w+=m,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,v,w)))})(k[0],8,0);(function(b,c,e){for(var f,h,k=b.length;e<k;e+=c)f=b[e],h=b[e+1],f/=1023,h/=1023,w.push(f,h)})(k[0],8,3);(function(b,
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,m){var k=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var k=THREE.UTF8Loader.prototype.decompressMesh(b),v=[],w=[];(function(b,k,p){for(var u,v,w,C=b.length;p<C;p+=k)u=b[p],v=b[p+1],w=b[p+2],u=u/16383*e,v=v/16383*e,w=w/16383*e,u+=f,v+=h,w+=m,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,v,w)))})(k[0],8,0);(function(b,c,e){for(var f,h,k=b.length;e<k;e+=c)f=b[e],h=b[e+1],f/=1023,h/=1023,w.push(f,h)})(k[0],8,3);(function(b,
|
|
|
c,e){for(var f,h,k,m=b.length;e<m;e+=c)f=b[e],h=b[e+1],k=b[e+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,v.push(f,h,k)})(k[0],8,5);(function(b){var e,f,h,k,m,u,E,G,H,N=b.length;for(e=0;e<N;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;G=f;H=h;u=k;E=f;var S=h,J=k,I=m.materials[0],K=v[S*3],W=v[S*3+1],S=v[S*3+2],D=v[J*3],M=v[J*3+1],J=v[J*3+2];E=new THREE.Vector3(v[E*3],v[E*3+1],v[E*3+2]);S=new THREE.Vector3(K,W,S);J=new THREE.Vector3(D,M,J);m.faces.push(new THREE.Face3(G,H,u,[E,S,J],null,I));m=w[f*2];f=w[f*2+
|
|
|
1];u=w[h*2];E=w[h*2+1];G=w[k*2];H=w[k*2+1];k=c.faceVertexUvs[0];h=u;u=E;E=[];E.push(new THREE.UV(m,f));E.push(new THREE.UV(h,u));E.push(new THREE.UV(G,H));k.push(E)}})(k[1]);this.computeCentroids();this.computeFaceNormals()};k.prototype=new THREE.Geometry;k.prototype.constructor=k;c(new k)};
|
|
|
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,h){return b+(c-b)*h};this.VIntX=function(b,c,h,m,k,n,u,v,w,p){k=(k-w)/(p-w);w=this.normal_cache;c[m]=n+k*this.delta;c[m+1]=u;c[m+2]=v;h[m]=this.lerp(w[b],w[b+3],k);h[m+1]=this.lerp(w[b+1],w[b+4],k);h[m+2]=this.lerp(w[b+2],w[b+5],k)};this.VIntY=function(b,c,h,m,k,n,u,v,w,p){k=(k-w)/(p-w);w=this.normal_cache;c[m]=n;c[m+1]=u+k*this.delta;c[m+
|
|
|
-2]=v;c=b+this.yd*3;h[m]=this.lerp(w[b],w[c],k);h[m+1]=this.lerp(w[b+1],w[c+1],k);h[m+2]=this.lerp(w[b+2],w[c+2],k)};this.VIntZ=function(b,c,h,m,k,n,u,v,w,p){k=(k-w)/(p-w);w=this.normal_cache;c[m]=n;c[m+1]=u;c[m+2]=v+k*this.delta;c=b+this.zd*3;h[m]=this.lerp(w[b],w[c],k);h[m+1]=this.lerp(w[b+1],w[c+1],k);h[m+2]=this.lerp(w[b+2],w[c+2],k)};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,h,m,k,n){var u=m+1,v=m+this.yd,w=m+this.zd,p=u+this.yd,x=u+this.zd,t=m+this.yd+this.zd,y=u+this.yd+this.zd,z=0,A=this.field[m],C=this.field[u],E=this.field[v],G=this.field[p],H=this.field[w],N=this.field[x],S=this.field[t],J=this.field[y];A<k&&(z|=1);C<k&&(z|=2);E<k&&(z|=8);G<k&&(z|=4);H<k&&(z|=16);N<k&&(z|=32);S<k&&(z|=128);J<k&&(z|=64);var I=THREE.edgeTable[z];if(I==0)return 0;var K=this.delta,
|
|
|
-W=b+K,D=c+K,K=h+K;I&1&&(this.compNorm(m),this.compNorm(u),this.VIntX(m*3,this.vlist,this.nlist,0,k,b,c,h,A,C));I&2&&(this.compNorm(u),this.compNorm(p),this.VIntY(u*3,this.vlist,this.nlist,3,k,W,c,h,C,G));I&4&&(this.compNorm(v),this.compNorm(p),this.VIntX(v*3,this.vlist,this.nlist,6,k,b,D,h,E,G));I&8&&(this.compNorm(m),this.compNorm(v),this.VIntY(m*3,this.vlist,this.nlist,9,k,b,c,h,A,E));I&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,k,b,c,K,H,N));I&32&&(this.compNorm(x),
|
|
|
-this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,k,W,c,K,N,J));I&64&&(this.compNorm(t),this.compNorm(y),this.VIntX(t*3,this.vlist,this.nlist,18,k,b,D,K,S,J));I&128&&(this.compNorm(w),this.compNorm(t),this.VIntY(w*3,this.vlist,this.nlist,21,k,b,c,K,H,S));I&256&&(this.compNorm(m),this.compNorm(w),this.VIntZ(m*3,this.vlist,this.nlist,24,k,b,c,h,A,H));I&512&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*3,this.vlist,this.nlist,27,k,W,c,h,C,N));I&1024&&(this.compNorm(p),this.compNorm(y),this.VIntZ(p*
|
|
|
-3,this.vlist,this.nlist,30,k,W,D,h,G,J));I&2048&&(this.compNorm(v),this.compNorm(t),this.VIntZ(v*3,this.vlist,this.nlist,33,k,b,D,h,E,S));z<<=4;for(k=m=0;THREE.triTable[z+k]!=-1;)b=z+k,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),k+=3,m++;return m};this.posnormtriv=function(b,c,h,m,k,n){var u=this.count*3;this.positionArray[u]=b[h];this.positionArray[u+1]=b[h+1];this.positionArray[u+2]=b[h+2];this.positionArray[u+3]=b[m];this.positionArray[u+
|
|
|
+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,h){return b+(c-b)*h};this.VIntX=function(b,c,h,m,k,n,u,v,w,t){k=(k-w)/(t-w);w=this.normal_cache;c[m]=n+k*this.delta;c[m+1]=u;c[m+2]=v;h[m]=this.lerp(w[b],w[b+3],k);h[m+1]=this.lerp(w[b+1],w[b+4],k);h[m+2]=this.lerp(w[b+2],w[b+5],k)};this.VIntY=function(b,c,h,m,k,n,u,v,w,t){k=(k-w)/(t-w);w=this.normal_cache;c[m]=n;c[m+1]=u+k*this.delta;c[m+
|
|
|
+2]=v;c=b+this.yd*3;h[m]=this.lerp(w[b],w[c],k);h[m+1]=this.lerp(w[b+1],w[c+1],k);h[m+2]=this.lerp(w[b+2],w[c+2],k)};this.VIntZ=function(b,c,h,m,k,n,u,v,w,t){k=(k-w)/(t-w);w=this.normal_cache;c[m]=n;c[m+1]=u;c[m+2]=v+k*this.delta;c=b+this.zd*3;h[m]=this.lerp(w[b],w[c],k);h[m+1]=this.lerp(w[b+1],w[c+1],k);h[m+2]=this.lerp(w[b+2],w[c+2],k)};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,h,m,k,n){var u=m+1,v=m+this.yd,w=m+this.zd,t=u+this.yd,x=u+this.zd,p=m+this.yd+this.zd,y=u+this.yd+this.zd,z=0,A=this.field[m],C=this.field[u],E=this.field[v],G=this.field[t],H=this.field[w],N=this.field[x],S=this.field[p],J=this.field[y];A<k&&(z|=1);C<k&&(z|=2);E<k&&(z|=8);G<k&&(z|=4);H<k&&(z|=16);N<k&&(z|=32);S<k&&(z|=128);J<k&&(z|=64);var I=THREE.edgeTable[z];if(I==0)return 0;var K=this.delta,
|
|
|
+W=b+K,D=c+K,K=h+K;I&1&&(this.compNorm(m),this.compNorm(u),this.VIntX(m*3,this.vlist,this.nlist,0,k,b,c,h,A,C));I&2&&(this.compNorm(u),this.compNorm(t),this.VIntY(u*3,this.vlist,this.nlist,3,k,W,c,h,C,G));I&4&&(this.compNorm(v),this.compNorm(t),this.VIntX(v*3,this.vlist,this.nlist,6,k,b,D,h,E,G));I&8&&(this.compNorm(m),this.compNorm(v),this.VIntY(m*3,this.vlist,this.nlist,9,k,b,c,h,A,E));I&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,k,b,c,K,H,N));I&32&&(this.compNorm(x),
|
|
|
+this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,k,W,c,K,N,J));I&64&&(this.compNorm(p),this.compNorm(y),this.VIntX(p*3,this.vlist,this.nlist,18,k,b,D,K,S,J));I&128&&(this.compNorm(w),this.compNorm(p),this.VIntY(w*3,this.vlist,this.nlist,21,k,b,c,K,H,S));I&256&&(this.compNorm(m),this.compNorm(w),this.VIntZ(m*3,this.vlist,this.nlist,24,k,b,c,h,A,H));I&512&&(this.compNorm(u),this.compNorm(x),this.VIntZ(u*3,this.vlist,this.nlist,27,k,W,c,h,C,N));I&1024&&(this.compNorm(t),this.compNorm(y),this.VIntZ(t*
|
|
|
+3,this.vlist,this.nlist,30,k,W,D,h,G,J));I&2048&&(this.compNorm(v),this.compNorm(p),this.VIntZ(v*3,this.vlist,this.nlist,33,k,b,D,h,E,S));z<<=4;for(k=m=0;THREE.triTable[z+k]!=-1;)b=z+k,c=b+1,h=b+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[b],3*THREE.triTable[c],3*THREE.triTable[h],n),k+=3,m++;return m};this.posnormtriv=function(b,c,h,m,k,n){var u=this.count*3;this.positionArray[u]=b[h];this.positionArray[u+1]=b[h+1];this.positionArray[u+2]=b[h+2];this.positionArray[u+3]=b[m];this.positionArray[u+
|
|
|
4]=b[m+1];this.positionArray[u+5]=b[m+2];this.positionArray[u+6]=b[k];this.positionArray[u+7]=b[k+1];this.positionArray[u+8]=b[k+2];this.normalArray[u]=c[h];this.normalArray[u+1]=c[h+1];this.normalArray[u+2]=c[h+2];this.normalArray[u+3]=c[m];this.normalArray[u+4]=c[m+1];this.normalArray[u+5]=c[m+2];this.normalArray[u+6]=c[k];this.normalArray[u+7]=c[k+1];this.normalArray[u+8]=c[k+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&n(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,h,m,k){var n=this.size*Math.sqrt(m/k),u=h*this.size,v=c*this.size,w=b*this.size,p=Math.floor(u-n);p<1&&(p=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var x=Math.floor(v-n);x<1&&(x=1);v=Math.floor(v+n);v>this.size-1&&(v=this.size-1);var t=Math.floor(w-n);t<1&&(t=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
|
|
|
-1);for(var y,z,A,C,E,G;p<u;p++){w=this.size2*p;z=p/this.size-h;E=z*z;for(z=x;z<v;z++){A=w+this.size*z;y=z/this.size-c;G=y*y;for(y=t;y<n;y++)C=y/this.size-b,C=m/(1.0E-6+C*C+G+E)-k,C>0&&(this.field[A+y]+=C)}}};this.addPlaneX=function(b,c){var h,m,k,n,u,v=this.size,w=this.yd,p=this.zd,x=this.field,t=v*Math.sqrt(b/c);t>v&&(t=v);for(h=0;h<t;h++)if(m=h/v,m*=m,n=b/(1.0E-4+m)-c,n>0)for(m=0;m<v;m++){u=h+m*w;for(k=0;k<v;k++)x[p*k+u]+=n}};this.addPlaneY=function(b,c){var h,m,k,n,u,v,w=this.size,p=this.yd,x=
|
|
|
-this.zd,t=this.field,y=w*Math.sqrt(b/c);y>w&&(y=w);for(m=0;m<y;m++)if(h=m/w,h*=h,n=b/(1.0E-4+h)-c,n>0){u=m*p;for(h=0;h<w;h++){v=u+h;for(k=0;k<w;k++)t[x*k+v]+=n}}};this.addPlaneZ=function(b,c){var h,m,k,n,u,v;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(k=0;k<dist;k++)if(h=k/size,h*=h,n=b/(1.0E-4+h)-c,n>0){u=zd*k;for(m=0;m<size;m++){v=u+m*yd;for(h=0;h<size;h++)field[v+h]+=n}}};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,h,m,k,n,u,v,w,p,x=this.size-2;for(k=1;k<x;k++){p=this.size2*k;v=(k-this.halfsize)/this.halfsize;for(m=1;m<x;m++){w=p+this.size*m;u=(m-this.halfsize)/this.halfsize;for(h=1;h<x;h++)n=(h-this.halfsize)/this.halfsize,c=w+h,this.polygonize(n,u,v,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(m){var k,n,u,v,w,p,x,t;for(k=0;k<m.count;k++)x=k*3,w=x+1,t=x+2,n=m.positionArray[x],
|
|
|
-u=m.positionArray[w],v=m.positionArray[t],p=new THREE.Vector3(n,u,v),n=m.normalArray[x],u=m.normalArray[w],v=m.normalArray[t],x=new THREE.Vector3(n,u,v),x.normalize(),w=new THREE.Vertex(p),c.vertices.push(w),h.push(x);nfaces=m.count/3;for(k=0;k<nfaces;k++)x=(b+k)*3,w=x+1,t=x+2,p=h[x],n=h[w],u=h[t],x=new THREE.Face3(x,w,t,[p,n,u]),c.faces.push(x);b+=nfaces;m.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
+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,h,m,k){var n=this.size*Math.sqrt(m/k),u=h*this.size,v=c*this.size,w=b*this.size,t=Math.floor(u-n);t<1&&(t=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var x=Math.floor(v-n);x<1&&(x=1);v=Math.floor(v+n);v>this.size-1&&(v=this.size-1);var p=Math.floor(w-n);p<1&&(p=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
|
|
|
+1);for(var y,z,A,C,E,G;t<u;t++){w=this.size2*t;z=t/this.size-h;E=z*z;for(z=x;z<v;z++){A=w+this.size*z;y=z/this.size-c;G=y*y;for(y=p;y<n;y++)C=y/this.size-b,C=m/(1.0E-6+C*C+G+E)-k,C>0&&(this.field[A+y]+=C)}}};this.addPlaneX=function(b,c){var h,m,k,n,u,v=this.size,w=this.yd,t=this.zd,x=this.field,p=v*Math.sqrt(b/c);p>v&&(p=v);for(h=0;h<p;h++)if(m=h/v,m*=m,n=b/(1.0E-4+m)-c,n>0)for(m=0;m<v;m++){u=h+m*w;for(k=0;k<v;k++)x[t*k+u]+=n}};this.addPlaneY=function(b,c){var h,m,k,n,u,v,w=this.size,t=this.yd,x=
|
|
|
+this.zd,p=this.field,y=w*Math.sqrt(b/c);y>w&&(y=w);for(m=0;m<y;m++)if(h=m/w,h*=h,n=b/(1.0E-4+h)-c,n>0){u=m*t;for(h=0;h<w;h++){v=u+h;for(k=0;k<w;k++)p[x*k+v]+=n}}};this.addPlaneZ=function(b,c){var h,m,k,n,u,v;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(k=0;k<dist;k++)if(h=k/size,h*=h,n=b/(1.0E-4+h)-c,n>0){u=zd*k;for(m=0;m<size;m++){v=u+m*yd;for(h=0;h<size;h++)field[v+h]+=n}}};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,h,m,k,n,u,v,w,t,x=this.size-2;for(k=1;k<x;k++){t=this.size2*k;v=(k-this.halfsize)/this.halfsize;for(m=1;m<x;m++){w=t+this.size*m;u=(m-this.halfsize)/this.halfsize;for(h=1;h<x;h++)n=(h-this.halfsize)/this.halfsize,c=w+h,this.polygonize(n,u,v,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(m){var k,n,u,v,w,t,x,p;for(k=0;k<m.count;k++)x=k*3,w=x+1,p=x+2,n=m.positionArray[x],
|
|
|
+u=m.positionArray[w],v=m.positionArray[p],t=new THREE.Vector3(n,u,v),n=m.normalArray[x],u=m.normalArray[w],v=m.normalArray[p],x=new THREE.Vector3(n,u,v),x.normalize(),w=new THREE.Vertex(t),c.vertices.push(w),h.push(x);nfaces=m.count/3;for(k=0;k<nfaces;k++)x=(b+k)*3,w=x+1,p=x+2,t=h[x],n=h[w],u=h[p],x=new THREE.Face3(x,w,p,[t,n,u]),c.faces.push(x);b+=nfaces;m.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]);
|
|
@@ -675,9 +675,9 @@ f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,n,0);break;case
|
|
|
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,h=new THREE.Camera,m=new THREE.Camera,k=new THREE.Matrix4,n=new THREE.Matrix4,u,v,w;h.useTarget=m.useTarget=!1;h.matrixAutoUpdate=m.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),t=new THREE.Camera(53,1,1,1E4);t.position.z=
|
|
|
-2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:x}},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 y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);p.width=b;p.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(u!==e.aspect||v!==e.near||w!==e.fov){u=e.aspect;v=e.near;w=e.fov;var C=e.projectionMatrix.clone(),E=125/30*0.5,G=E*v/125,H=v*Math.tan(w*Math.PI/360),N;k.n14=E;n.n14=-E;E=-H*u+G;N=H*u+G;C.n11=2*v/(N-E);C.n13=(N+E)/(N-E);h.projectionMatrix=C.clone();E=-H*u-G;N=H*u-G;C.n11=2*v/(N-E);
|
|
|
-C.n13=(N+E)/(N-E);m.projectionMatrix=C.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=v;h.far=e.far;f.call(c,b,h,p,!0);m.matrix=e.matrixWorld.clone().multiplySelf(k);m.update(null,!0);m.position.copy(e.position);m.near=v;m.far=e.far;f.call(c,b,m,x,!0);f.call(c,y,t)}};
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,m=new THREE.Camera,k=new THREE.Matrix4,n=new THREE.Matrix4,u,v,w;h.useTarget=m.useTarget=!1;h.matrixAutoUpdate=m.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},t=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),p=new THREE.Camera(53,1,1,1E4);p.position.z=
|
|
|
+2;_material=new THREE.MeshShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:t},mapRight:{type:"t",value:1,texture:x}},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 y=new THREE.Scene;y.addObject(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);t.width=b;t.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(u!==e.aspect||v!==e.near||w!==e.fov){u=e.aspect;v=e.near;w=e.fov;var C=e.projectionMatrix.clone(),E=125/30*0.5,G=E*v/125,H=v*Math.tan(w*Math.PI/360),N;k.n14=E;n.n14=-E;E=-H*u+G;N=H*u+G;C.n11=2*v/(N-E);C.n13=(N+E)/(N-E);h.projectionMatrix=C.clone();E=-H*u-G;N=H*u-G;C.n11=2*v/(N-E);
|
|
|
+C.n13=(N+E)/(N-E);m.projectionMatrix=C.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=v;h.far=e.far;f.call(c,b,h,t,!0);m.matrix=e.matrixWorld.clone().multiplySelf(k);m.update(null,!0);m.position.copy(e.position);m.near=v;m.far=e.far;f.call(c,b,m,x,!0);f.call(c,y,p)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);this.autoClear=!1;var c=this,e=this.setSize,f=this.render,h,m,k=new THREE.Camera,n=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);h=b/2;m=f};this.render=function(b,e){this.clear();k.fov=e.fov;k.aspect=0.5*e.aspect;k.near=e.near;k.far=e.far;
|
|
|
k.updateProjectionMatrix();k.position.copy(e.position);k.target.position.copy(e.target.position);k.translateX(c.separation);n.projectionMatrix=k.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,h,m);f.call(c,b,k);this.setViewport(h,0,h,m);f.call(c,b,n,!1)}};
|