|
@@ -14,39 +14,39 @@ Math.abs(c)>1.0E-5?(this.x=Math.atan2(-b.n23/c,b.n33/c),this.z=Math.atan2(-b.n12
|
|
|
THREE.Vector4.prototype={constructor:THREE.Vector4,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!==void 0?b.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(b,c){this.x=b.x+c.x;this.y=b.y+c.y;this.z=b.z+c.z;this.w=b.w+c.w;return this},addSelf:function(b){this.x+=b.x;this.y+=b.y;this.z+=b.z;this.w+=b.w;return this},sub:function(b,c){this.x=b.x-c.x;this.y=b.y-c.y;this.z=b.z-
|
|
|
c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this.z-=b.z;this.w-=b.w;return this},multiplyScalar:function(b){this.x*=b;this.y*=b;this.z*=b;this.w*=b;return this},divideScalar:function(b){b?(this.x/=b,this.y/=b,this.z/=b,this.w/=b):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(b){return this.x*b.x+this.y*b.y+this.z*b.z+this.w*b.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
|
|
|
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++)Array.prototype.push.apply(f,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,k,m,n,t,v,w,u,x,p,y=b.geometry,A=y.vertices,z=[],f=0;for(h=y.faces.length;f<h;f++)if(k=y.faces[f],x=this.origin.clone(),p=this.direction.clone(),v=b.matrixWorld,m=v.multiplyVector3(k.centroid.clone()).subSelf(x),u=m.dot(p),!(u<=0)&&(m=v.multiplyVector3(A[k.a].position.clone()),n=v.multiplyVector3(A[k.b].position.clone()),t=v.multiplyVector3(A[k.c].position.clone()),v=k instanceof THREE.Face4?v.multiplyVector3(A[k.d].position.clone()):null,w=b.matrixRotationWorld.multiplyVector3(k.normal.clone()),
|
|
|
-u=p.dot(w),b.doubleSided||(b.flipSided?u>0:u<0)))if(u=w.dot((new THREE.Vector3).sub(m,x))/u,x=x.addSelf(p.multiplyScalar(u)),k instanceof THREE.Face3)e(x,m,n,t)&&(k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},z.push(k));else if(k instanceof THREE.Face4&&(e(x,m,n,v)||e(x,n,t,v)))k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},z.push(k);z.sort(function(b,e){return b.distance-e.distance});return z}else return[]}};
|
|
|
-THREE.Rectangle=function(){function b(){k=f-c;m=h-e}var c,e,f,h,k,m,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return m};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,u){n=!1;c=k;e=m;f=w;h=u;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,u,x,p){n?(n=!1,c=k<w?k<x?k:x:w<x?w:x,e=m<u?m<p?m:p:u<p?u:p,f=k>w?k>x?k:x:w>x?w:x,h=m>u?m>p?m:p:u>p?u: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<u?m<p?m<e?m:e:p<e?p:e:u<p?u<e?u: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>u?m>p?m>h?m:h:p>h?p:h:u>p?u>h?u: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>
|
|
|
+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++)Array.prototype.push.apply(f,this.intersectObject(b[c]));f.sort(function(b,c){return b.distance-c.distance});return f},intersectObject:function(b){function c(b,c,e){var f;f=e.clone().subSelf(b).dot(c);if(f<=0)return null;b=b.clone().addSelf(c.clone().multiplyScalar(f));return e.distanceTo(b)}function e(b,c,e,f){var f=f.clone().subSelf(c),
|
|
|
+e=e.clone().subSelf(c),h=b.clone().subSelf(c),b=f.dot(f),c=f.dot(e),f=f.dot(h),k=e.dot(e),e=e.dot(h),h=1/(b*k-c*c),k=(k*f-c*e)*h,b=(b*e-c*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,k,m,n,p,u,w,t,x,v,A=b.geometry,z=A.vertices,y=[],f=0;for(h=A.faces.length;f<h;f++)if(k=A.faces[f],x=this.origin.clone(),v=this.direction.clone(),u=b.matrixWorld,m=u.multiplyVector3(k.centroid.clone()).subSelf(x),t=m.dot(v),!(t<=0)&&(m=u.multiplyVector3(z[k.a].position.clone()),n=u.multiplyVector3(z[k.b].position.clone()),p=u.multiplyVector3(z[k.c].position.clone()),u=k instanceof THREE.Face4?u.multiplyVector3(z[k.d].position.clone()):null,w=b.matrixRotationWorld.multiplyVector3(k.normal.clone()),
|
|
|
+t=v.dot(w),b.doubleSided||(b.flipSided?t>0:t<0)))if(t=w.dot((new THREE.Vector3).sub(m,x))/t,x=x.addSelf(v.multiplyScalar(t)),k instanceof THREE.Face3)e(x,m,n,p)&&(k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},y.push(k));else if(k instanceof THREE.Face4&&(e(x,m,n,u)||e(x,n,p,u)))k={distance:this.origin.distanceTo(x),point:x,face:k,object:b},y.push(k);y.sort(function(b,c){return b.distance-c.distance});return y}else return[]}};
|
|
|
+THREE.Rectangle=function(){function b(){k=f-c;m=h-e}var c,e,f,h,k,m,n=!0;this.getX=function(){return c};this.getY=function(){return e};this.getWidth=function(){return k};this.getHeight=function(){return m};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,v){n?(n=!1,c=k<w?k<x?k:x:w<x?w:x,e=m<t?m<v?m:v:t<v?t:v,f=k>w?k>x?k:x:w>x?w:x,h=m>t?m>v?m:v:t>v?t:v):(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<v?m<e?m:e:v<e?v:e:t<v?t<e?t:e:v<e?v: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>v?m>h?m:h:v>h?v:h:t>v?t>h?t:h:v>h?v: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,k,m,n,t,v,w,u,x,p,y,A){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,k!==void 0?k:1,m||0,n||0,t||0,v||0,w!==void 0?w:1,u||0,x||0,p||0,y||0,A!==void 0?A:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(b,c,e,f,h,k,m,n,t,v,w,u,x,p,y,A){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=m;this.n24=n;this.n31=t;this.n32=v;this.n33=w;this.n34=u;this.n41=x;this.n42=p;this.n43=y;this.n44=A;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.Matrix4=function(b,c,e,f,h,k,m,n,p,u,w,t,x,v,A,z){this.set(b!==void 0?b:1,c||0,e||0,f||0,h||0,k!==void 0?k:1,m||0,n||0,p||0,u||0,w!==void 0?w:1,t||0,x||0,v||0,A||0,z!==void 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,k,m,n,p,u,w,t,x,v,A,z){this.n11=b;this.n12=c;this.n13=e;this.n14=f;this.n21=h;this.n22=k;this.n23=m;this.n24=n;this.n31=p;this.n32=u;this.n33=w;this.n34=t;this.n41=x;this.n42=v;this.n43=A;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,k=THREE.Matrix4.__v3;k.sub(b,c).normalize();if(k.length()===0)k.z=1;f.cross(e,k).normalize();f.length()===0&&(k.x+=1.0E-4,f.cross(e,k).normalize());h.cross(k,f).normalize();this.n11=f.x;this.n12=h.x;this.n13=k.x;this.n21=f.y;this.n22=h.y;this.n23=k.y;this.n31=f.z;this.n32=h.z;this.n33=k.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,k=b.n14,m=b.n21,n=b.n22,t=b.n23,v=b.n24,w=b.n31,u=b.n32,x=b.n33,p=b.n34,y=b.n41,A=b.n42,z=b.n43,E=b.n44,F=c.n11,D=c.n12,
|
|
|
-H=c.n13,N=c.n14,O=c.n21,K=c.n22,G=c.n23,B=c.n24,da=c.n31,J=c.n32,R=c.n33,S=c.n34,Y=c.n41,W=c.n42,o=c.n43,ea=c.n44;this.n11=e*F+f*O+h*da+k*Y;this.n12=e*D+f*K+h*J+k*W;this.n13=e*H+f*G+h*R+k*o;this.n14=e*N+f*B+h*S+k*ea;this.n21=m*F+n*O+t*da+v*Y;this.n22=m*D+n*K+t*J+v*W;this.n23=m*H+n*G+t*R+v*o;this.n24=m*N+n*B+t*S+v*ea;this.n31=w*F+u*O+x*da+p*Y;this.n32=w*D+u*K+x*J+p*W;this.n33=w*H+u*G+x*R+p*o;this.n34=w*N+u*B+x*S+p*ea;this.n41=y*F+A*O+z*da+E*Y;this.n42=y*D+A*K+z*J+E*W;this.n43=y*H+A*G+z*R+E*o;this.n44=
|
|
|
-y*N+A*B+z*S+E*ea;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,k=this.n22,m=this.n23,n=this.n24,t=this.n31,v=this.n32,w=this.n33,u=this.n34,x=this.n41,p=this.n42,y=this.n43,A=this.n44;return f*m*v*x-e*n*v*x-f*k*w*x+c*n*w*x+e*k*u*x-c*m*u*x-f*m*t*p+e*n*t*p+f*h*w*p-b*n*w*p-e*h*u*p+b*m*u*p+f*k*t*y-c*n*t*y-f*h*v*y+b*n*v*y+c*h*u*y-b*k*u*y-e*k*t*A+c*m*t*A+e*h*v*A-b*m*v*A-c*h*
|
|
|
-w*A+b*k*w*A},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=
|
|
|
+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,k=b.n14,m=b.n21,n=b.n22,p=b.n23,u=b.n24,w=b.n31,t=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,E=b.n44,F=c.n11,D=c.n12,
|
|
|
+H=c.n13,L=c.n14,M=c.n21,K=c.n22,G=c.n23,B=c.n24,da=c.n31,J=c.n32,Q=c.n33,R=c.n34,Y=c.n41,V=c.n42,o=c.n43,ea=c.n44;this.n11=e*F+f*M+h*da+k*Y;this.n12=e*D+f*K+h*J+k*V;this.n13=e*H+f*G+h*Q+k*o;this.n14=e*L+f*B+h*R+k*ea;this.n21=m*F+n*M+p*da+u*Y;this.n22=m*D+n*K+p*J+u*V;this.n23=m*H+n*G+p*Q+u*o;this.n24=m*L+n*B+p*R+u*ea;this.n31=w*F+t*M+x*da+v*Y;this.n32=w*D+t*K+x*J+v*V;this.n33=w*H+t*G+x*Q+v*o;this.n34=w*L+t*B+x*R+v*ea;this.n41=A*F+z*M+y*da+E*Y;this.n42=A*D+z*K+y*J+E*V;this.n43=A*H+z*G+y*Q+E*o;this.n44=
|
|
|
+A*L+z*B+y*R+E*ea;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,k=this.n22,m=this.n23,n=this.n24,p=this.n31,u=this.n32,w=this.n33,t=this.n34,x=this.n41,v=this.n42,A=this.n43,z=this.n44;return f*m*u*x-e*n*u*x-f*k*w*x+c*n*w*x+e*k*t*x-c*m*t*x-f*m*p*v+e*n*p*v+f*h*w*v-b*n*w*v-e*h*t*v+b*m*t*v+f*k*p*A-c*n*p*A-f*h*u*A+b*n*u*A+c*h*t*A-b*k*t*A-e*k*p*z+c*m*p*z+e*h*u*z-b*m*u*z-c*h*
|
|
|
+w*z+b*k*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,k=b.x,m=b.y,n=b.z,t=h*k,v=h*m;this.set(t*k+e,t*m-f*n,t*n+f*m,0,t*m+f*n,v*m+e,v*n-f*k,0,t*n-f*m,v*n+f*k,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,k=Math.cos(e),e=Math.sin(e),m=Math.cos(f),f=Math.sin(f),n=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var t=
|
|
|
-m*n,v=m*h,w=f*n,u=f*h;this.n11=t+u*e;this.n12=w*e-v;this.n13=k*f;this.n21=k*h;this.n22=k*n;this.n23=-e;this.n31=v*e-w;this.n32=u+t*e;this.n33=k*m;break;case "ZXY":t=m*n;v=m*h;w=f*n;u=f*h;this.n11=t-u*e;this.n12=-k*h;this.n13=w+v*e;this.n21=v+w*e;this.n22=k*n;this.n23=u-t*e;this.n31=-k*f;this.n32=e;this.n33=k*m;break;case "ZYX":t=k*n;v=k*h;w=e*n;u=e*h;this.n11=m*n;this.n12=w*f-v;this.n13=t*f+u;this.n21=m*h;this.n22=u*f+t;this.n23=v*f-w;this.n31=-f;this.n32=e*m;this.n33=k*m;break;case "YZX":t=k*m;v=
|
|
|
-k*f;w=e*m;u=e*f;this.n11=m*n;this.n12=u-t*h;this.n13=w*h+v;this.n21=h;this.n22=k*n;this.n23=-e*n;this.n31=-f*n;this.n32=v*h+w;this.n33=t-u*h;break;case "XZY":t=k*m;v=k*f;w=e*m;u=e*f;this.n11=m*n;this.n12=-h;this.n13=f*n;this.n21=t*h+u;this.n22=k*n;this.n23=v*h-w;this.n31=w*h-v;this.n32=e*n;this.n33=u*h+t;break;default:t=k*n,v=k*h,w=e*n,u=e*h,this.n11=m*n,this.n12=-m*h,this.n13=f,this.n21=v+w*f,this.n22=t-u*f,this.n23=-e*m,this.n31=u-t*f,this.n32=w+v*f,this.n33=k*m}return this},setRotationFromQuaternion:function(b){var c=
|
|
|
-b.x,e=b.y,f=b.z,h=b.w,k=c+c,m=e+e,n=f+f,b=c*k,t=c*m;c*=n;var v=e*m;e*=n;f*=n;k*=h;m*=h;h*=n;this.n11=1-(v+f);this.n12=t-h;this.n13=c+m;this.n21=t+h;this.n22=1-(b+f);this.n23=e-k;this.n31=c-m;this.n32=e+k;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;
|
|
|
+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,k=b.x,m=b.y,n=b.z,p=h*k,u=h*m;this.set(p*k+e,p*m-f*n,p*n+f*m,0,p*m+f*n,u*m+e,u*n-f*k,0,p*n-f*m,u*n+f*k,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,k=Math.cos(e),e=Math.sin(e),m=Math.cos(f),f=Math.sin(f),n=Math.cos(h),h=Math.sin(h);switch(c){case "YXZ":var p=
|
|
|
+m*n,u=m*h,w=f*n,t=f*h;this.n11=p+t*e;this.n12=w*e-u;this.n13=k*f;this.n21=k*h;this.n22=k*n;this.n23=-e;this.n31=u*e-w;this.n32=t+p*e;this.n33=k*m;break;case "ZXY":p=m*n;u=m*h;w=f*n;t=f*h;this.n11=p-t*e;this.n12=-k*h;this.n13=w+u*e;this.n21=u+w*e;this.n22=k*n;this.n23=t-p*e;this.n31=-k*f;this.n32=e;this.n33=k*m;break;case "ZYX":p=k*n;u=k*h;w=e*n;t=e*h;this.n11=m*n;this.n12=w*f-u;this.n13=p*f+t;this.n21=m*h;this.n22=t*f+p;this.n23=u*f-w;this.n31=-f;this.n32=e*m;this.n33=k*m;break;case "YZX":p=k*m;u=
|
|
|
+k*f;w=e*m;t=e*f;this.n11=m*n;this.n12=t-p*h;this.n13=w*h+u;this.n21=h;this.n22=k*n;this.n23=-e*n;this.n31=-f*n;this.n32=u*h+w;this.n33=p-t*h;break;case "XZY":p=k*m;u=k*f;w=e*m;t=e*f;this.n11=m*n;this.n12=-h;this.n13=f*n;this.n21=p*h+t;this.n22=k*n;this.n23=u*h-w;this.n31=w*h-u;this.n32=e*n;this.n33=t*h+p;break;default:p=k*n,u=k*h,w=e*n,t=e*h,this.n11=m*n,this.n12=-m*h,this.n13=f,this.n21=u+w*f,this.n22=p-t*f,this.n23=-e*m,this.n31=t-p*f,this.n32=w+u*f,this.n33=k*m}return this},setRotationFromQuaternion:function(b){var c=
|
|
|
+b.x,e=b.y,f=b.z,h=b.w,k=c+c,m=e+e,n=f+f,b=c*k,p=c*m;c*=n;var u=e*m;e*=n;f*=n;k*=h;m*=h;h*=n;this.n11=1-(u+f);this.n12=p-h;this.n13=c+m;this.n21=p+h;this.n22=1-(b+f);this.n23=e-k;this.n31=c-m;this.n32=e+k;this.n33=1-(b+u);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,k=THREE.Matrix4.__v3;f.set(this.n11,this.n21,this.n31);h.set(this.n12,this.n22,this.n32);k.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=k.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,k=b.n14,m=b.n21,n=b.n22,t=b.n23,v=b.n24,w=b.n31,u=b.n32,x=b.n33,p=b.n34,y=b.n41,A=b.n42,z=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*p*A-v*x*A+v*u*z-n*p*z-t*u*E+n*x*E;c.n12=k*x*A-h*p*A-k*u*z+f*p*z+h*u*E-f*x*E;c.n13=h*v*A-k*t*A+k*n*z-f*v*z-h*n*E+f*t*E;c.n14=k*t*u-h*v*u-k*n*x+f*v*x+h*n*p-f*t*p;c.n21=v*x*y-t*p*y-v*w*z+m*p*z+t*w*E-m*x*E;c.n22=h*p*y-k*x*y+k*w*z-e*p*z-h*w*E+e*x*E;c.n23=k*t*y-h*v*y-k*m*z+e*v*z+h*m*E-e*t*E;c.n24=
|
|
|
-h*v*w-k*t*w+k*m*x-e*v*x-h*m*p+e*t*p;c.n31=n*p*y-v*u*y+v*w*A-m*p*A-n*w*E+m*u*E;c.n32=k*u*y-f*p*y-k*w*A+e*p*A+f*w*E-e*u*E;c.n33=h*v*y-k*n*y+k*m*A-e*v*A-f*m*E+e*n*E;c.n34=k*n*w-f*v*w-k*m*u+e*v*u+f*m*p-e*n*p;c.n41=t*u*y-n*x*y-t*w*A+m*x*A+n*w*z-m*u*z;c.n42=f*x*y-h*u*y+h*w*A-e*x*A-f*w*z+e*u*z;c.n43=h*n*y-f*t*y-h*m*A+e*t*A+f*m*z-e*n*z;c.n44=f*t*w-h*n*w+h*m*u-e*t*u-f*m*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,k=b.n32*b.n21-b.n31*b.n22,m=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,t=-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,u=b.n22*b.n11-b.n21*b.n12,b=b.n11*f+b.n21*m+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*k;e[3]=b*m;e[4]=b*n;e[5]=b*t;e[6]=b*v;e[7]=b*w;e[8]=b*u;return c};
|
|
|
+THREE.Matrix4.makeInvert=function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,p=b.n23,u=b.n24,w=b.n31,t=b.n32,x=b.n33,v=b.n34,A=b.n41,z=b.n42,y=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=p*v*z-u*x*z+u*t*y-n*v*y-p*t*E+n*x*E;c.n12=k*x*z-h*v*z-k*t*y+f*v*y+h*t*E-f*x*E;c.n13=h*u*z-k*p*z+k*n*y-f*u*y-h*n*E+f*p*E;c.n14=k*p*t-h*u*t-k*n*x+f*u*x+h*n*v-f*p*v;c.n21=u*x*A-p*v*A-u*w*y+m*v*y+p*w*E-m*x*E;c.n22=h*v*A-k*x*A+k*w*y-e*v*y-h*w*E+e*x*E;c.n23=k*p*A-h*u*A-k*m*y+e*u*y+h*m*E-e*p*E;c.n24=
|
|
|
+h*u*w-k*p*w+k*m*x-e*u*x-h*m*v+e*p*v;c.n31=n*v*A-u*t*A+u*w*z-m*v*z-n*w*E+m*t*E;c.n32=k*t*A-f*v*A-k*w*z+e*v*z+f*w*E-e*t*E;c.n33=h*u*A-k*n*A+k*m*z-e*u*z-f*m*E+e*n*E;c.n34=k*n*w-f*u*w-k*m*t+e*u*t+f*m*v-e*n*v;c.n41=p*t*A-n*x*A-p*w*z+m*x*z+n*w*y-m*t*y;c.n42=f*x*A-h*t*A+h*w*z-e*x*z-f*w*y+e*t*y;c.n43=h*n*A-f*p*A-h*m*z+e*p*z+f*m*y-e*n*y;c.n44=f*p*w-h*n*w+h*m*t-e*p*t-f*m*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,k=b.n32*b.n21-b.n31*b.n22,m=-b.n33*b.n12+b.n32*b.n13,n=b.n33*b.n11-b.n31*b.n13,p=-b.n32*b.n11+b.n31*b.n12,u=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*m+b.n31*u;b==0&&console.error("THREE.Matrix4.makeInvert3x3: Matrix not invertible.");b=1/b;e[0]=b*f;e[1]=b*h;e[2]=b*k;e[3]=b*m;e[4]=b*n;e[5]=b*p;e[6]=b*u;e[7]=b*w;e[8]=b*t;return c};
|
|
|
THREE.Matrix4.makeFrustum=function(b,c,e,f,h,k){var m;m=new THREE.Matrix4;m.n11=2*h/(c-b);m.n12=0;m.n13=(c+b)/(c-b);m.n14=0;m.n21=0;m.n22=2*h/(f-e);m.n23=(f+e)/(f-e);m.n24=0;m.n31=0;m.n32=0;m.n33=-(k+h)/(k-h);m.n34=-2*k*h/(k-h);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};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,k){var m,n,t,v;m=new THREE.Matrix4;n=c-b;t=e-f;v=k-h;m.n11=2/n;m.n12=0;m.n13=0;m.n14=-((c+b)/n);m.n21=0;m.n22=2/t;m.n23=0;m.n24=-((e+f)/t);m.n31=0;m.n32=0;m.n33=-2/v;m.n34=-((k+h)/v);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
+THREE.Matrix4.makeOrtho=function(b,c,e,f,h,k){var m,n,p,u;m=new THREE.Matrix4;n=c-b;p=e-f;u=k-h;m.n11=2/n;m.n12=0;m.n13=0;m.n14=-((c+b)/n);m.n21=0;m.n22=2/p;m.n23=0;m.n24=-((e+f)/p);m.n31=0;m.n32=0;m.n33=-2/u;m.n34=-((k+h)/u);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__v1=new THREE.Vector3;THREE.Matrix4.__v2=new THREE.Vector3;THREE.Matrix4.__v3=new THREE.Vector3;THREE.Matrix4.__m1=new THREE.Matrix4;THREE.Matrix4.__m2=new THREE.Matrix4;
|
|
|
THREE.Object3D=function(){this.name="";this.id=THREE.Object3DCount++;this.parent=void 0;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.eulerOrder="XYZ";this.scale=new THREE.Vector3(1,1,1);this.flipSided=this.doubleSided=this.dynamic=!1;this.renderDepth=null;this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixWorldNeedsUpdate=this.matrixAutoUpdate=
|
|
|
!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=!0;this.receiveShadow=this.castShadow=!1;this.frustumCulled=!0;this._vector=new THREE.Vector3};
|
|
|
THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){this.matrix.rotateAxis(c);this.position.addSelf(c.multiplyScalar(b))},translateX:function(b){this.translate(b,this._vector.set(1,0,0))},translateY:function(b){this.translate(b,this._vector.set(0,1,0))},translateZ:function(b){this.translate(b,this._vector.set(0,0,1))},lookAt:function(b){this.matrix.lookAt(b,this.position,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},add:function(b){if(this.children.indexOf(b)===
|
|
@@ -54,40 +54,40 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(b,c){thi
|
|
|
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=t[n]=t[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,k=[],m,n,t=[],v,w,u=[],x,p=[],y,A,z=[],E,F,D=[],H=[],N=[],O=new THREE.Vector4,K=new THREE.Vector4,
|
|
|
-G=new THREE.Matrix4,B=new THREE.Matrix4,da=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,R=new THREE.Vector4;this.projectVector=function(b,e){G.multiply(e.projectionMatrix,e.matrixWorldInverse);G.multiplyVector3(b);return b};this.unprojectVector=function(b,e){G.multiply(e.matrixWorld,THREE.Matrix4.makeInvert(e.projectionMatrix));G.multiplyVector3(b);return b};this.projectObjects=function(b,e,m){var o,n;h=H.length=
|
|
|
-0;o=b.objects;b=0;for(e=o.length;b<e;b++){n=o[b];var u;if(!(u=!n.visible))if(u=n instanceof THREE.Mesh)if(u=n.frustumCulled){a:{u=void 0;for(var v=n.matrixWorld,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),t=0;t<6;t++)if(u=da[t].x*v.n14+da[t].y*v.n24+da[t].z*v.n34+da[t].w,u<=p){u=!1;break a}u=!0}u=!u}if(!u)u=k[h]=k[h]||new THREE.RenderableObject,h++,f=u,O.copy(n.position),G.multiplyVector3(O),f.object=n,f.z=O.z,H.push(f)}m&&H.sort(c);return H};this.projectScene=
|
|
|
-function(f,k,h){var o=k.near,H=k.far,O,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra,na,P,oa,qa;F=A=x=w=N.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);G.multiply(k.projectionMatrix,k.matrixWorldInverse);da[0].set(G.n41-G.n11,G.n42-G.n12,G.n43-G.n13,G.n44-G.n14);da[1].set(G.n41+G.n11,G.n42+G.n12,G.n43+G.n13,G.n44+G.n14);da[2].set(G.n41+G.n21,G.n42+G.n22,G.n43+G.n23,G.n44+G.n24);da[3].set(G.n41-G.n21,G.n42-G.n22,G.n43-G.n23,G.n44-G.n24);da[4].set(G.n41-G.n31,G.n42-G.n32,G.n43-G.n33,G.n44-
|
|
|
-G.n34);da[5].set(G.n41+G.n31,G.n42+G.n32,G.n43+G.n33,G.n44+G.n34);for(O=0;O<6;O++)$=da[O],$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z));$=this.projectObjects(f,k,!0);f=0;for(O=$.length;f<O;f++)if(X=$[f].object,X.visible)if(ga=X.matrixWorld,la=X.matrixRotationWorld,ra=X.materials,na=X.overdraw,n=0,X instanceof THREE.Mesh){P=X.geometry;ia=P.vertices;oa=P.faces;P=P.faceVertexUvs;ma=0;for(Z=ia.length;ma<Z;ma++)m=b(),m.positionWorld.copy(ia[ma].position),ga.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),
|
|
|
-G.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<H;ia=0;for(ma=oa.length;ia<ma;ia++){Z=oa[ia];if(Z instanceof THREE.Face3)if(aa=t[Z.a],ka=t[Z.b],fa=t[Z.c],aa.visible&&ka.visible&&fa.visible&&(X.doubleSided||X.flipSided!=(fa.positionScreen.x-aa.positionScreen.x)*(ka.positionScreen.y-aa.positionScreen.y)-(fa.positionScreen.y-aa.positionScreen.y)*(ka.positionScreen.x-aa.positionScreen.x)<
|
|
|
-0))ca=u[w]=u[w]||new THREE.RenderableFace3,w++,v=ca,v.v1.copy(aa),v.v2.copy(ka),v.v3.copy(fa);else continue;else if(Z instanceof THREE.Face4)if(aa=t[Z.a],ka=t[Z.b],fa=t[Z.c],ca=t[Z.d],aa.visible&&ka.visible&&fa.visible&&ca.visible&&(X.doubleSided||X.flipSided!=((ca.positionScreen.x-aa.positionScreen.x)*(ka.positionScreen.y-aa.positionScreen.y)-(ca.positionScreen.y-aa.positionScreen.y)*(ka.positionScreen.x-aa.positionScreen.x)<0||(ka.positionScreen.x-fa.positionScreen.x)*(ca.positionScreen.y-fa.positionScreen.y)-
|
|
|
-(ka.positionScreen.y-fa.positionScreen.y)*(ca.positionScreen.x-fa.positionScreen.x)<0)))qa=p[x]=p[x]||new THREE.RenderableFace4,x++,v=qa,v.v1.copy(aa),v.v2.copy(ka),v.v3.copy(fa),v.v4.copy(ca);else continue;v.normalWorld.copy(Z.normal);la.multiplyVector3(v.normalWorld);v.centroidWorld.copy(Z.centroid);ga.multiplyVector3(v.centroidWorld);v.centroidScreen.copy(v.centroidWorld);G.multiplyVector3(v.centroidScreen);fa=Z.vertexNormals;aa=0;for(ka=fa.length;aa<ka;aa++)ca=v.vertexNormalsWorld[aa],ca.copy(fa[aa]),
|
|
|
-la.multiplyVector3(ca);aa=0;for(ka=P.length;aa<ka;aa++)if(qa=P[aa][ia]){fa=0;for(ca=qa.length;fa<ca;fa++)v.uvs[aa][fa]=qa[fa]}v.meshMaterials=ra;v.faceMaterials=Z.materials;v.overdraw=na;v.z=v.centroidScreen.z;N.push(v)}}else if(X instanceof THREE.Line){B.multiply(G,ga);ia=X.geometry.vertices;aa=b();aa.positionScreen.copy(ia[0].position);B.multiplyVector4(aa.positionScreen);ma=1;for(Z=ia.length;ma<Z;ma++)if(aa=b(),aa.positionScreen.copy(ia[ma].position),B.multiplyVector4(aa.positionScreen),ka=t[n-
|
|
|
-2],J.copy(aa.positionScreen),R.copy(ka.positionScreen),e(J,R))J.multiplyScalar(1/J.w),R.multiplyScalar(1/R.w),ga=z[A]=z[A]||new THREE.RenderableLine,A++,y=ga,y.v1.positionScreen.copy(J),y.v2.positionScreen.copy(R),y.z=Math.max(J.z,R.z),y.materials=X.materials,N.push(y)}else if(X instanceof THREE.Particle&&(K.set(X.matrixWorld.n14,X.matrixWorld.n24,X.matrixWorld.n34,1),G.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))ga=D[F]=D[F]||new THREE.RenderableParticle,F++,E=ga,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=
|
|
|
-X.rotation.z,E.scale.x=X.scale.x*Math.abs(E.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),E.scale.y=X.scale.y*Math.abs(E.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),E.materials=X.materials,N.push(E);h&&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.Projector=function(){function b(){var b=p[n]=p[n]||new THREE.RenderableVertex;n++;return b}function c(b,c){return c.z-b.z}function e(b,c){var e=0,f=1,k=b.z+b.w,h=c.z+c.w,m=-b.z+b.w,n=-c.z+c.w;return k>=0&&h>=0&&m>=0&&n>=0?!0:k<0&&h<0||m<0&&n<0?!1:(k<0?e=Math.max(e,k/(k-h)):h<0&&(f=Math.min(f,k/(k-h))),m<0?e=Math.max(e,m/(m-n)):n<0&&(f=Math.min(f,m/(m-n))),f<e?!1:(b.lerpSelf(c,e),c.lerpSelf(b,1-f),!0))}var f,h,k=[],m,n,p=[],u,w,t=[],x,v=[],A,z,y=[],E,F,D=[],H=[],L=[],M=new THREE.Vector4,K=new THREE.Vector4,
|
|
|
+G=new THREE.Matrix4,B=new THREE.Matrix4,da=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Vector4,Q=new THREE.Vector4;this.projectVector=function(b,c){G.multiply(c.projectionMatrix,c.matrixWorldInverse);G.multiplyVector3(b);return b};this.unprojectVector=function(b,c){G.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));G.multiplyVector3(b);return b};this.projectObjects=function(b,e,m){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 u=n.matrixWorld,p=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),v=0;v<6;v++)if(t=da[v].x*u.n14+da[v].y*u.n24+da[v].z*u.n34+da[v].w,t<=p){t=!1;break a}t=!0}t=!t}if(!t)t=k[h]=k[h]||new THREE.RenderableObject,h++,f=t,M.copy(n.position),G.multiplyVector3(M),f.object=n,f.z=M.z,H.push(f)}m&&H.sort(c);return H};this.projectScene=
|
|
|
+function(f,k,h){var o=k.near,H=k.far,M,ma,Z,ia,aa,ka,fa,ca,$,W,ga,la,ra,na,O,oa,qa;F=z=x=w=L.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);G.multiply(k.projectionMatrix,k.matrixWorldInverse);da[0].set(G.n41-G.n11,G.n42-G.n12,G.n43-G.n13,G.n44-G.n14);da[1].set(G.n41+G.n11,G.n42+G.n12,G.n43+G.n13,G.n44+G.n14);da[2].set(G.n41+G.n21,G.n42+G.n22,G.n43+G.n23,G.n44+G.n24);da[3].set(G.n41-G.n21,G.n42-G.n22,G.n43-G.n23,G.n44-G.n24);da[4].set(G.n41-G.n31,G.n42-G.n32,G.n43-G.n33,G.n44-
|
|
|
+G.n34);da[5].set(G.n41+G.n31,G.n42+G.n32,G.n43+G.n33,G.n44+G.n34);for(M=0;M<6;M++)$=da[M],$.divideScalar(Math.sqrt($.x*$.x+$.y*$.y+$.z*$.z));$=this.projectObjects(f,k,!0);f=0;for(M=$.length;f<M;f++)if(W=$[f].object,W.visible)if(ga=W.matrixWorld,la=W.matrixRotationWorld,ra=W.materials,na=W.overdraw,n=0,W instanceof THREE.Mesh){O=W.geometry;ia=O.vertices;oa=O.faces;O=O.faceVertexUvs;ma=0;for(Z=ia.length;ma<Z;ma++)m=b(),m.positionWorld.copy(ia[ma].position),ga.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),
|
|
|
+G.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<H;ia=0;for(ma=oa.length;ia<ma;ia++){Z=oa[ia];if(Z instanceof THREE.Face3)if(aa=p[Z.a],ka=p[Z.b],fa=p[Z.c],aa.visible&&ka.visible&&fa.visible&&(W.doubleSided||W.flipSided!=(fa.positionScreen.x-aa.positionScreen.x)*(ka.positionScreen.y-aa.positionScreen.y)-(fa.positionScreen.y-aa.positionScreen.y)*(ka.positionScreen.x-aa.positionScreen.x)<
|
|
|
+0))ca=t[w]=t[w]||new THREE.RenderableFace3,w++,u=ca,u.v1.copy(aa),u.v2.copy(ka),u.v3.copy(fa);else continue;else if(Z instanceof THREE.Face4)if(aa=p[Z.a],ka=p[Z.b],fa=p[Z.c],ca=p[Z.d],aa.visible&&ka.visible&&fa.visible&&ca.visible&&(W.doubleSided||W.flipSided!=((ca.positionScreen.x-aa.positionScreen.x)*(ka.positionScreen.y-aa.positionScreen.y)-(ca.positionScreen.y-aa.positionScreen.y)*(ka.positionScreen.x-aa.positionScreen.x)<0||(ka.positionScreen.x-fa.positionScreen.x)*(ca.positionScreen.y-fa.positionScreen.y)-
|
|
|
+(ka.positionScreen.y-fa.positionScreen.y)*(ca.positionScreen.x-fa.positionScreen.x)<0)))qa=v[x]=v[x]||new THREE.RenderableFace4,x++,u=qa,u.v1.copy(aa),u.v2.copy(ka),u.v3.copy(fa),u.v4.copy(ca);else continue;u.normalWorld.copy(Z.normal);la.multiplyVector3(u.normalWorld);u.centroidWorld.copy(Z.centroid);ga.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);G.multiplyVector3(u.centroidScreen);fa=Z.vertexNormals;aa=0;for(ka=fa.length;aa<ka;aa++)ca=u.vertexNormalsWorld[aa],ca.copy(fa[aa]),
|
|
|
+la.multiplyVector3(ca);aa=0;for(ka=O.length;aa<ka;aa++)if(qa=O[aa][ia]){fa=0;for(ca=qa.length;fa<ca;fa++)u.uvs[aa][fa]=qa[fa]}u.meshMaterials=ra;u.faceMaterials=Z.materials;u.overdraw=na;u.z=u.centroidScreen.z;L.push(u)}}else if(W instanceof THREE.Line){B.multiply(G,ga);ia=W.geometry.vertices;aa=b();aa.positionScreen.copy(ia[0].position);B.multiplyVector4(aa.positionScreen);ma=1;for(Z=ia.length;ma<Z;ma++)if(aa=b(),aa.positionScreen.copy(ia[ma].position),B.multiplyVector4(aa.positionScreen),ka=p[n-
|
|
|
+2],J.copy(aa.positionScreen),Q.copy(ka.positionScreen),e(J,Q))J.multiplyScalar(1/J.w),Q.multiplyScalar(1/Q.w),ga=y[z]=y[z]||new THREE.RenderableLine,z++,A=ga,A.v1.positionScreen.copy(J),A.v2.positionScreen.copy(Q),A.z=Math.max(J.z,Q.z),A.materials=W.materials,L.push(A)}else if(W instanceof THREE.Particle&&(K.set(W.matrixWorld.n14,W.matrixWorld.n24,W.matrixWorld.n34,1),G.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))ga=D[F]=D[F]||new THREE.RenderableParticle,F++,E=ga,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=
|
|
|
+W.rotation.z,E.scale.x=W.scale.x*Math.abs(E.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),E.scale.y=W.scale.y*Math.abs(E.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),E.materials=W.materials,L.push(E);h&&L.sort(c);return L}};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=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),k=Math.cos(e),e=Math.sin(e),m=b*c,n=f*h;this.w=m*k-n*e;this.x=m*e+n*k;this.y=f*c*k+b*h*e;this.z=b*h*k-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,k=b.x,m=b.y,n=b.z,b=b.w;this.x=c*b+h*k+e*n-f*m;this.y=e*b+h*m+f*k-c*n;this.z=f*b+h*n+c*m-e*k;this.w=h*b-c*k-e*m-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,k=this.x,m=this.y,n=this.z,t=this.w,v=t*e+m*h-n*f,w=t*f+n*e-k*h,u=t*h+k*f-m*e,e=-k*
|
|
|
-e-m*f-n*h;c.x=v*t+e*-k+w*-n-u*-m;c.y=w*t+e*-m+u*-k-v*-n;c.z=u*t+e*-n+v*-m-w*-k;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 k=Math.acos(h),m=Math.sqrt(1-h*h);if(Math.abs(m)<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)*k)/m;f=Math.sin(f*k)/m;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,k=b.x,m=b.y,n=b.z,b=b.w;this.x=c*b+h*k+e*n-f*m;this.y=e*b+h*m+f*k-c*n;this.z=f*b+h*n+c*m-e*k;this.w=h*b-c*k-e*m-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,k=this.x,m=this.y,n=this.z,p=this.w,u=p*e+m*h-n*f,w=p*f+n*e-k*h,t=p*h+k*f-m*e,e=-k*
|
|
|
+e-m*f-n*h;c.x=u*p+e*-k+w*-n-t*-m;c.y=w*p+e*-m+t*-k-u*-n;c.z=t*p+e*-n+u*-m-w*-k;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 k=Math.acos(h),m=Math.sqrt(1-h*h);if(Math.abs(m)<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)*k)/m;f=Math.sin(f*k)/m;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,k){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=k instanceof Array?k:[k];this.centroid=new THREE.Vector3};
|
|
|
THREE.Face4=function(b,c,e,f,h,k,m){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=k instanceof THREE.Color?k:new THREE.Color;this.vertexColors=k instanceof Array?k:[];this.vertexTangents=[];this.materials=m instanceof Array?m:[m];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)}};THREE.Geometry=function(){this.id=THREE.GeometryCount++;this.vertices=[];this.colors=[];this.faces=[];this.faceUvs=[[]];this.faceVertexUvs=[[]];this.morphTargets=[];this.morphColors=[];this.skinWeights=[];this.skinIndices=[];this.boundingSphere=this.boundingBox=null;this.dynamic=this.hasTangents=!1};
|
|
|
THREE.Geometry.prototype={constructor:THREE.Geometry,applyMatrix:function(b){var c=new THREE.Matrix4;c.extractRotation(b,new THREE.Vector3(1,1,1));for(var e=0,f=this.vertices.length;e<f;e++)b.multiplyVector3(this.vertices[e].position);e=0;for(f=this.faces.length;e<f;e++){var h=this.faces[e];c.multiplyVector3(h.normal);for(var k=0,m=h.vertexNormals.length;k<m;k++)c.multiplyVector3(h.vertexNormals[k]);b.multiplyVector3(h.centroid)}},computeCentroids:function(){var b,c,e;b=0;for(c=this.faces.length;b<
|
|
|
c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.divideScalar(3)):e instanceof THREE.Face4&&(e.centroid.addSelf(this.vertices[e.a].position),e.centroid.addSelf(this.vertices[e.b].position),e.centroid.addSelf(this.vertices[e.c].position),e.centroid.addSelf(this.vertices[e.d].position),e.centroid.divideScalar(4))},computeFaceNormals:function(b){var c,
|
|
|
-e,f,h,k,m,n=new THREE.Vector3,t=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];if(b&&k.vertexNormals.length){n.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)n.addSelf(k.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],m=this.vertices[k.c],n.sub(m.position,e.position),t.sub(c.position,e.position),n.crossSelf(t);n.isZero()||n.normalize();k.normal.copy(n)}},computeVertexNormals:function(){var b,c,e,f;if(this.__tmpVertices==void 0){f=this.__tmpVertices=
|
|
|
+e,f,h,k,m,n=new THREE.Vector3,p=new THREE.Vector3;f=0;for(h=this.faces.length;f<h;f++){k=this.faces[f];if(b&&k.vertexNormals.length){n.set(0,0,0);c=0;for(e=k.vertexNormals.length;c<e;c++)n.addSelf(k.vertexNormals[c]);n.divideScalar(3)}else c=this.vertices[k.a],e=this.vertices[k.b],m=this.vertices[k.c],n.sub(m.position,e.position),p.sub(c.position,e.position),n.crossSelf(p);n.isZero()||n.normalize();k.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,k,h,o){n=b.vertices[e].position;t=b.vertices[c].position;v=b.vertices[f].position;w=m[k];u=m[h];x=m[o];p=t.x-n.x;y=v.x-n.x;A=t.y-n.y;z=v.y-n.y;E=t.z-n.z;F=v.z-n.z;D=u.u-w.u;H=x.u-w.u;N=u.v-w.v;O=x.v-w.v;K=1/(D*O-H*N);J.set((O*p-N*y)*K,(O*A-N*z)*K,(O*E-N*F)*K);R.set((D*y-H*p)*K,(D*z-H*A)*K,(D*F-H*E)*K);B[e].addSelf(J);B[c].addSelf(J);B[f].addSelf(J);da[e].addSelf(R);
|
|
|
-da[c].addSelf(R);da[f].addSelf(R)}var c,e,f,h,k,m,n,t,v,w,u,x,p,y,A,z,E,F,D,H,N,O,K,G,B=[],da=[],J=new THREE.Vector3,R=new THREE.Vector3,S=new THREE.Vector3,Y=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)B[c]=new THREE.Vector3,da[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=this.faceVertexUvs[0][c],k instanceof THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var o=["a",
|
|
|
-"b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)W.copy(k.vertexNormals[f]),h=k[o[f]],G=B[h],S.copy(G),S.subSelf(W.multiplyScalar(W.dot(G))).normalize(),Y.cross(k.vertexNormals[f],G),h=Y.dot(da[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(S.x,S.y,S.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,
|
|
|
+e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,e,f,k,h,o){n=b.vertices[c].position;p=b.vertices[e].position;u=b.vertices[f].position;w=m[k];t=m[h];x=m[o];v=p.x-n.x;A=u.x-n.x;z=p.y-n.y;y=u.y-n.y;E=p.z-n.z;F=u.z-n.z;D=t.u-w.u;H=x.u-w.u;L=t.v-w.v;M=x.v-w.v;K=1/(D*M-H*L);J.set((M*v-L*A)*K,(M*z-L*y)*K,(M*E-L*F)*K);Q.set((D*A-H*v)*K,(D*y-H*z)*K,(D*F-H*E)*K);B[c].addSelf(J);B[e].addSelf(J);B[f].addSelf(J);da[c].addSelf(Q);
|
|
|
+da[e].addSelf(Q);da[f].addSelf(Q)}var c,e,f,h,k,m,n,p,u,w,t,x,v,A,z,y,E,F,D,H,L,M,K,G,B=[],da=[],J=new THREE.Vector3,Q=new THREE.Vector3,R=new THREE.Vector3,Y=new THREE.Vector3,V=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)B[c]=new THREE.Vector3,da[c]=new THREE.Vector3;c=0;for(e=this.faces.length;c<e;c++)k=this.faces[c],m=this.faceVertexUvs[0][c],k instanceof THREE.Face3?b(this,k.a,k.b,k.c,0,1,2):k instanceof THREE.Face4&&(b(this,k.a,k.b,k.c,0,1,2),b(this,k.a,k.b,k.d,0,1,3));var o=["a",
|
|
|
+"b","c","d"];c=0;for(e=this.faces.length;c<e;c++){k=this.faces[c];for(f=0;f<k.vertexNormals.length;f++)V.copy(k.vertexNormals[f]),h=k[o[f]],G=B[h],R.copy(G),R.subSelf(V.multiplyScalar(V.dot(G))).normalize(),Y.cross(k.vertexNormals[f],G),h=Y.dot(da[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(R.x,R.y,R.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}},mergeVertices:function(){var b={},c=[],e=[],f,h=Math.pow(10,4),k,m;k=0;for(m=this.vertices.length;k<m;k++)f=this.vertices[k].position,f=[Math.round(f.x*h),Math.round(f.y*h),Math.round(f.z*h)].join("_"),b[f]===void 0?(b[f]=k,c.push(this.vertices[k]),
|
|
|
e[k]=c.length-1):e[k]=e[b[f]];k=0;for(m=this.faces.length;k<m;k++){b=this.faces[k];if(b instanceof THREE.Face3)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c];if(b instanceof THREE.Face4)b.a=e[b.a],b.b=e[b.b],b.c=e[b.c],b.d=e[b.d]}this.vertices=c}};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,k,m,n,t,v,w,u,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;k=Math.floor(h);m=h-k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>this.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;v=this.points[e[0]];w=this.points[e[1]];
|
|
|
-u=this.points[e[2]];x=this.points[e[3]];n=m*m;t=m*n;f.x=c(v.x,w.x,u.x,x.x,m,n,t);f.y=c(v.y,w.y,u.y,x.y,m,n,t);f.z=c(v.z,w.z,u.z,x.z,m,n,t);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=[],u=new THREE.Vector3,v=this.getLength();n.push(u.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(u.copy(position).clone());
|
|
|
-n.push(u.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(){THREE.Object3D.call(this);arguments.length&&console.warn("DEPRECATED: Camera() is now PerspectiveCamera().");this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
|
|
|
+THREE.Spline=function(b){function c(b,c,e,f,k,h,m){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*m+(-3*(c-e)-2*b-f)*h+b*k+c}this.points=b;var e=[],f={x:0,y:0,z:0},h,k,m,n,p,u,w,t,x;this.initFromArray=function(b){this.points=[];for(var c=0;c<b.length;c++)this.points[c]={x:b[c][0],y:b[c][1],z:b[c][2]}};this.getPoint=function(b){h=(this.points.length-1)*b;k=Math.floor(h);m=h-k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>this.points.length-2?k:k+1;e[3]=k>this.points.length-3?k:k+2;u=this.points[e[0]];w=this.points[e[1]];
|
|
|
+t=this.points[e[2]];x=this.points[e[3]];n=m*m;p=m*n;f.x=c(u.x,w.x,t.x,x.x,m,n,p);f.y=c(u.y,w.y,t.y,x.y,m,n,p);f.z=c(u.z,w.z,t.z,x.z,m,n,p);return f};this.getControlPointsArray=function(){var b,c,e=this.points.length,f=[];for(b=0;b<e;b++)c=this.points[b],f[b]=[c.x,c.y,c.z];return f};this.getLength=function(b){var c,e,f=c=c=0,k=new THREE.Vector3,h=new THREE.Vector3,m=[],n=0;m[0]=0;b||(b=100);e=this.points.length*b;k.copy(this.points[0]);for(b=1;b<e;b++)c=b/e,position=this.getPoint(c),h.copy(position),
|
|
|
+n+=h.distanceTo(k),k.copy(position),c*=this.points.length-1,c=Math.floor(c),c!=f&&(m[c]=n,f=c);m[m.length]=n;return{chunks:m,total:n}};this.reparametrizeByArcLength=function(b){var c,e,f,k,h,m,n=[],t=new THREE.Vector3,u=this.getLength();n.push(t.copy(this.points[0]).clone());for(c=1;c<this.points.length;c++){e=u.chunks[c]-u.chunks[c-1];m=Math.ceil(b*e/u.total);k=(c-1)/(this.points.length-1);h=c/(this.points.length-1);for(e=1;e<m-1;e++)f=k+e*(1/m)*(h-k),position=this.getPoint(f),n.push(t.copy(position).clone());
|
|
|
+n.push(t.copy(this.points[c]).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(){THREE.Object3D.call(this);arguments.length&&console.warn("DEPRECATED: Camera() is now PerspectiveCamera().");this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;
|
|
|
THREE.Camera.prototype.lookAt=function(b){this.matrix.lookAt(this.position,b,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)};
|
|
|
THREE.Camera.prototype.update=function(b,c,e){this.matrixAutoUpdate&&this.updateMatrix();if(c||this.matrixWorldNeedsUpdate)b?this.matrixWorld.multiply(b,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,c=!0,THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);for(b=0;b<this.children.length;b++)this.children[b].update(this.matrixWorld,c,e)};
|
|
|
THREE.OrthographicCamera=function(b,c,e,f,h,k){THREE.Camera.call(this);this.left=b;this.right=c;this.top=e;this.bottom=f;this.near=h!==void 0?h:0.1;this.far=k!==void 0?k:2E3;this.updateProjectionMatrix()};THREE.OrthographicCamera.prototype=new THREE.Camera;THREE.OrthographicCamera.prototype.constructor=THREE.OrthographicCamera;THREE.OrthographicCamera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makeOrtho(this.left,this.right,this.top,this.bottom,this.near,this.far)};
|
|
@@ -118,7 +118,7 @@ void 0?b.fog:!1;this.lights=b.lights!==void 0?b.lights:!1;this.vertexColors=b.ve
|
|
|
THREE.Texture=function(b,c,e,f,h,k){this.id=THREE.TextureCount++;this.image=b;this.mapping=c!==void 0?c:new THREE.UVMapping;this.wrapS=e!==void 0?e:THREE.ClampToEdgeWrapping;this.wrapT=f!==void 0?f:THREE.ClampToEdgeWrapping;this.magFilter=h!==void 0?h:THREE.LinearFilter;this.minFilter=k!==void 0?k:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.needsUpdate=!1};
|
|
|
THREE.Texture.prototype={constructor:THREE.Texture,clone:function(){var b=new THREE.Texture(this.image,this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b}};THREE.TextureCount=0;THREE.MultiplyOperation=0;THREE.MixOperation=1;THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};
|
|
|
THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};THREE.RepeatWrapping=0;THREE.ClampToEdgeWrapping=1;THREE.MirroredRepeatWrapping=2;THREE.NearestFilter=3;THREE.NearestMipMapNearestFilter=4;THREE.NearestMipMapLinearFilter=5;THREE.LinearFilter=6;THREE.LinearMipMapNearestFilter=7;THREE.LinearMipMapLinearFilter=8;THREE.ByteType=9;THREE.UnsignedByteType=10;THREE.ShortType=11;THREE.UnsignedShortType=12;THREE.IntType=13;
|
|
|
-THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,e,f,h,k,m,n,t){THREE.Texture.call(this,null,h,k,m,n,t);this.image={data:b,width:c,height:e};this.format=f!==void 0?f:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
|
|
|
+THREE.UnsignedIntType=14;THREE.FloatType=15;THREE.AlphaFormat=16;THREE.RGBFormat=17;THREE.RGBAFormat=18;THREE.LuminanceFormat=19;THREE.LuminanceAlphaFormat=20;THREE.DataTexture=function(b,c,e,f,h,k,m,n,p){THREE.Texture.call(this,null,h,k,m,n,p);this.image={data:b,width:c,height:e};this.format=f!==void 0?f:THREE.RGBAFormat};THREE.DataTexture.prototype=new THREE.Texture;THREE.DataTexture.prototype.constructor=THREE.DataTexture;
|
|
|
THREE.DataTexture.prototype.clone=function(){var b=new THREE.DataTexture(this.data.slice(0),this.mapping,this.wrapS,this.wrapT,this.magFilter,this.minFilter);b.offset.copy(this.offset);b.repeat.copy(this.repeat);return b};THREE.Particle=function(b){THREE.Object3D.call(this);this.materials=b instanceof Array?b:[b]};THREE.Particle.prototype=new THREE.Object3D;THREE.Particle.prototype.constructor=THREE.Particle;
|
|
|
THREE.ParticleSystem=function(b,c){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(b,c,e){THREE.Object3D.call(this);this.geometry=b;this.materials=c instanceof Array?c:[c];this.type=e!=void 0?e:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;THREE.Line.prototype=new THREE.Object3D;
|
|
|
THREE.Line.prototype.constructor=THREE.Line;
|
|
@@ -145,49 +145,49 @@ 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),c=this.__objectsAdded.indexOf(b),c!==-1&&this.__objectsAdded.splice(c,1)));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!==void 0?c:1;this.far=e!==void 0?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,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var t,v,w,u,x,p,y,A;b=c.projectScene(e,f);t=0;for(v=b.length;t<v;t++)if(x=b[t],x instanceof THREE.RenderableParticle){y=x.x*h+h;A=x.y*k+k;w=0;for(u=x.material.length;w<u;w++)if(p=x.material[w],p instanceof THREE.ParticleDOMMaterial)p=p.domElement,p.style.left=y+"px",p.style.top=A+"px"}}};
|
|
|
-THREE.CanvasRenderer=function(b){function c(b){if(z!=b)p.globalAlpha=z=b}function e(b){if(E!=b){switch(b){case THREE.NormalBlending:p.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:p.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:p.globalCompositeOperation="darker"}E=b}}function f(b){if(F!=b)p.strokeStyle=F=b}function h(b){if(D!=b)p.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
-v,w,u,x,p=t.getContext("2d"),y=new THREE.Color(0),A=0,z=1,E=0,F=null,D=null,H=null,N=null,O=null,K,G,B,da,J=new THREE.RenderableVertex,R=new THREE.RenderableVertex,S,Y,W,o,ea,Q,ma,Z,ia,aa,ka,fa,ca=new THREE.Color(0),$=new THREE.Color(0),X=new THREE.Color(0),ga=new THREE.Color(0),la=new THREE.Color(0),ra=[],na,P,oa,qa,wa,ta,Ea,Aa,Ca,Fa,L=new THREE.Rectangle,U=new THREE.Rectangle,M=new THREE.Rectangle,ua=!1,ha=new THREE.Color,ja=new THREE.Color,ya=new THREE.Color,xa=new THREE.Color,pa=new THREE.Vector3,
|
|
|
-Ia,Da,Ka,Ba,Ga,V,b=16;Ia=document.createElement("canvas");Ia.width=Ia.height=2;Da=Ia.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ka=Da.getImageData(0,0,2,2);Ba=Ka.data;Ga=document.createElement("canvas");Ga.width=Ga.height=b;V=Ga.getContext("2d");V.translate(-b/2,-b/2);V.scale(b,b);b--;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,e){v=b;w=e;u=Math.floor(v/2);x=Math.floor(w/2);t.width=v;
|
|
|
-t.height=w;L.set(-u,-x,u,x);U.set(-u,-x,u,x);z=1;E=0;O=N=H=D=F=null};this.setClearColor=function(b,e){y.copy(b);A=e;U.set(-u,-x,u,x)};this.setClearColorHex=function(b,e){y.setHex(b);A=e;U.set(-u,-x,u,x)};this.clear=function(){p.setTransform(1,0,0,-1,u,x);U.isEmpty()||(U.minSelf(L),U.inflate(2),A<1&&p.clearRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.getHeight())),A>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(y.r*255)+","+Math.floor(y.g*255)+","+Math.floor(y.b*
|
|
|
-255)+","+A+")"),p.fillRect(Math.floor(U.getX()),Math.floor(U.getY()),Math.floor(U.getWidth()),Math.floor(U.getHeight()))),U.empty())};this.render=function(b,v){function t(b){var e,c,f,k=b.lights;ja.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?(ja.r+=f.r,ja.g+=f.g,ja.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(pa.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,t,w,va;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)t=
|
|
|
-m.map.image,w=t.width>>1,va=t.height>>1,m=k.scale.x*u,v=k.scale.y*x,o=m*w,n=v*va,M.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(M)&&(p.save(),p.translate(b.x,b.y),p.rotate(-k.rotation),p.scale(m,-v),p.translate(-w,-va),p.drawImage(t,0,0),p.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*u,n=k.scale.y*x,M.set(b.x-o,b.y-n,b.x+o,b.y+n),L.intersects(M)&&(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(O!=b)p.lineJoin=O=b;f(m.color.getContextStyle());p.stroke();M.inflate(m.linewidth*2)}}function A(b,f,h,m,n,u,t,p,x){k.info.render.vertices+=3;k.info.render.faces++;c(p.opacity);e(p.blending);
|
|
|
-S=b.positionScreen.x;Y=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;ea=h.positionScreen.x;Q=h.positionScreen.y;F(S,Y,W,o,ea,Q);if(p instanceof THREE.MeshBasicMaterial)if(p.map)p.map.mapping instanceof THREE.UVMapping&&(qa=t.uvs[0],ab(S,Y,W,o,ea,Q,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[u].u,qa[u].v,p.map));else if(p.envMap){if(p.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=v.matrixWorldInverse,pa.copy(t.vertexNormalsWorld[0]),wa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
|
|
|
-ta=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(t.vertexNormalsWorld[2]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Fa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(S,Y,W,o,ea,Q,wa,ta,Ea,Aa,Ca,Fa,p.envMap)}else p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)p.map&&!p.wireframe&&
|
|
|
-(p.map.mapping instanceof THREE.UVMapping&&(qa=t.uvs[0],ab(S,Y,W,o,ea,Q,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[u].u,qa[u].v,p.map)),e(THREE.SubtractiveBlending)),ua?!p.wireframe&&p.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==3?($.r=X.r=ga.r=ja.r,$.g=X.g=ga.g=ja.g,$.b=X.b=ga.b=ja.b,w(x,t.v1.positionWorld,t.vertexNormalsWorld[0],$),w(x,t.v2.positionWorld,t.vertexNormalsWorld[1],X),w(x,t.v3.positionWorld,t.vertexNormalsWorld[2],ga),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,
|
|
|
-Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),X.r=Math.max(0,Math.min(p.color.r*X.r,1)),X.g=Math.max(0,Math.min(p.color.g*X.g,1)),X.b=Math.max(0,Math.min(p.color.b*X.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),la.r=(X.r+ga.r)*0.5,la.g=(X.g+ga.g)*0.5,la.b=(X.b+ga.b)*0.5,oa=Ya($,X,ga,la),Va(S,Y,W,o,ea,Q,0,0,1,0,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,t.centroidWorld,t.normalWorld,
|
|
|
-ha),ca.r=Math.max(0,Math.min(p.color.r*ha.r,1)),ca.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ha.b,1)),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(ca)):p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshDepthMaterial)na=v.near,P=v.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,P),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,P),ga.r=ga.g=ga.b=1-Ra(h.positionScreen.z,
|
|
|
-na,P),la.r=(X.r+ga.r)*0.5,la.g=(X.g+ga.g)*0.5,la.b=(X.b+ga.b)*0.5,oa=Ya($,X,ga,la),Va(S,Y,W,o,ea,Q,0,0,1,0,0,1,oa);else if(p instanceof THREE.MeshNormalMaterial)ca.r=Wa(t.normalWorld.x),ca.g=Wa(t.normalWorld.y),ca.b=Wa(t.normalWorld.z),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(ca)}function E(b,f,h,m,n,u,t,p,x){k.info.render.vertices+=4;k.info.render.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)A(b,f,m,0,1,3,t,p,x),A(n,h,u,1,2,3,t,p,x);else if(S=b.positionScreen.x,
|
|
|
-Y=b.positionScreen.y,W=f.positionScreen.x,o=f.positionScreen.y,ea=h.positionScreen.x,Q=h.positionScreen.y,ma=m.positionScreen.x,Z=m.positionScreen.y,ia=n.positionScreen.x,aa=n.positionScreen.y,ka=u.positionScreen.x,fa=u.positionScreen.y,p instanceof THREE.MeshBasicMaterial)D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)ua?!p.wireframe&&p.shading==THREE.SmoothShading&&t.vertexNormalsWorld.length==
|
|
|
-4?($.r=X.r=ga.r=la.r=ja.r,$.g=X.g=ga.g=la.g=ja.g,$.b=X.b=ga.b=la.b=ja.b,w(x,t.v1.positionWorld,t.vertexNormalsWorld[0],$),w(x,t.v2.positionWorld,t.vertexNormalsWorld[1],X),w(x,t.v4.positionWorld,t.vertexNormalsWorld[3],ga),w(x,t.v3.positionWorld,t.vertexNormalsWorld[2],la),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),X.r=Math.max(0,Math.min(p.color.r*X.r,1)),X.g=Math.max(0,Math.min(p.color.g*X.g,1)),X.b=Math.max(0,Math.min(p.color.b*
|
|
|
-X.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),la.r=Math.max(0,Math.min(p.color.r*la.r,1)),la.g=Math.max(0,Math.min(p.color.g*la.g,1)),la.b=Math.max(0,Math.min(p.color.b*la.b,1)),oa=Ya($,X,ga,la),F(S,Y,W,o,ma,Z),Va(S,Y,W,o,ma,Z,0,0,1,0,0,1,oa),F(ia,aa,ea,Q,ka,fa),Va(ia,aa,ea,Q,ka,fa,1,0,1,1,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,t.centroidWorld,t.normalWorld,ha),ca.r=Math.max(0,Math.min(p.color.r*ha.r,
|
|
|
-1)),ca.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ha.b,1)),D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(ca)):(D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color));else if(p instanceof THREE.MeshNormalMaterial)ca.r=Wa(t.normalWorld.x),ca.g=Wa(t.normalWorld.y),ca.b=Wa(t.normalWorld.z),D(S,Y,W,o,ea,Q,ma,Z),p.wireframe?Na(ca,p.wireframeLinewidth,p.wireframeLinecap,
|
|
|
-p.wireframeLinejoin):Oa(ca);else if(p instanceof THREE.MeshDepthMaterial)na=v.near,P=v.far,$.r=$.g=$.b=1-Ra(b.positionScreen.z,na,P),X.r=X.g=X.b=1-Ra(f.positionScreen.z,na,P),ga.r=ga.g=ga.b=1-Ra(m.positionScreen.z,na,P),la.r=la.g=la.b=1-Ra(h.positionScreen.z,na,P),oa=Ya($,X,ga,la),F(S,Y,W,o,ma,Z),Va(S,Y,W,o,ma,Z,0,0,1,0,0,1,oa),F(ia,aa,ea,Q,ka,fa),Va(ia,aa,ea,Q,ka,fa,1,0,1,1,0,1,oa)}function F(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 D(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 Na(b,e,c,k){if(H!=e)p.lineWidth=H=e;if(N!=c)p.lineCap=N=c;if(O!=k)p.lineJoin=O=k;f(b.getContextStyle());p.stroke();M.inflate(e*2)}function Oa(b){h(b.getContextStyle());p.fill()}function ab(b,e,c,f,k,m,o,n,u,t,v,w,va){if(va.image.width!=0){if(va.needsUpdate==!0||ra[va.id]==void 0){var x=va.wrapS==THREE.RepeatWrapping,y=va.wrapT==THREE.RepeatWrapping;ra[va.id]=p.createPattern(va.image,
|
|
|
-x&&y?"repeat":x&&!y?"repeat-x":!x&&y?"repeat-y":"no-repeat");va.needsUpdate=!1}h(ra[va.id]);var x=va.offset.x/va.repeat.x,y=va.offset.y/va.repeat.y,L=(va.image.width-1)*va.repeat.x,va=(va.image.height-1)*va.repeat.y,o=(o+x)*L,n=(n+y)*va,u=(u+x)*L,t=(t+y)*va,v=(v+x)*L,w=(w+y)*va;c-=b;f-=e;k-=b;m-=e;u-=o;t-=n;v-=o;w-=n;x=1/(u*w-v*t);va=(w*c-t*k)*x;t=(w*f-t*m)*x;c=(u*k-v*c)*x;f=(u*m-v*f)*x;b=b-va*o-c*n;e=e-t*o-f*n;p.save();p.transform(va,t,c,f,b,e);p.fill();p.restore()}}function Va(b,e,c,f,k,m,h,o,n,
|
|
|
-u,t,v,va){var w,x;w=va.width-1;x=va.height-1;h*=w;o*=x;n*=w;u*=x;t*=w;v*=x;c-=b;f-=e;k-=b;m-=e;n-=h;u-=o;t-=h;v-=o;x=1/(n*v-t*u);w=(v*c-u*k)*x;u=(v*f-u*m)*x;c=(n*k-t*c)*x;f=(n*m-t*f)*x;b=b-w*h-c*o;e=e-u*h-f*o;p.save();p.transform(w,u,c,f,b,e);p.clip();p.drawImage(va,0,0);p.restore()}function Ya(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),u=~~(f.r*255),t=~~(f.g*255),f=~~(f.b*255);Ba[0]=k<0?0:k>255?255:k;
|
|
|
-Ba[1]=h<0?0:h>255?255:h;Ba[2]=b<0?0:b>255?255:b;Ba[4]=m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=e<0?0:e>255?255:e;Ba[8]=n<0?0:n>255?255:n;Ba[9]=p<0?0:p>255?255:p;Ba[10]=c<0?0:c>255?255:c;Ba[12]=u<0?0:u>255?255:u;Ba[13]=t<0?0:t>255?255:t;Ba[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);V.drawImage(Ia,0,0);return Ga}function Ra(b,e,c){b=(b-e)/(c-e);return b*b*(3-2*b)}function Wa(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Pa(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 Za,bb,sa,Ha,Qa,Xa,$a,za;this.autoClear?this.clear():p.setTransform(1,0,0,-1,u,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,v,this.sortElements);(ua=b.lights.length>0)&&t(b);Za=0;for(bb=m.length;Za<bb;Za++){sa=m[Za];M.empty();if(sa instanceof THREE.RenderableParticle){K=sa;K.x*=u;K.y*=x;Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&y(K,sa,za,b)}else if(sa instanceof THREE.RenderableLine){if(K=sa.v1,G=sa.v2,
|
|
|
-K.positionScreen.x*=u,K.positionScreen.y*=x,G.positionScreen.x*=u,G.positionScreen.y*=x,M.addPoint(K.positionScreen.x,K.positionScreen.y),M.addPoint(G.positionScreen.x,G.positionScreen.y),L.intersects(M)){Ha=0;for(Qa=sa.materials.length;Ha<Qa;)za=sa.materials[Ha++],za.opacity!=0&&z(K,G,sa,za,b)}}else if(sa instanceof THREE.RenderableFace3){if(K=sa.v1,G=sa.v2,B=sa.v3,K.positionScreen.x*=u,K.positionScreen.y*=x,G.positionScreen.x*=u,G.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,
|
|
|
-sa.overdraw&&(Pa(K.positionScreen,G.positionScreen),Pa(G.positionScreen,B.positionScreen),Pa(B.positionScreen,K.positionScreen)),M.add3Points(K.positionScreen.x,K.positionScreen.y,G.positionScreen.x,G.positionScreen.y,B.positionScreen.x,B.positionScreen.y),L.intersects(M)){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&A(K,G,B,0,1,2,sa,za,b)}else za.opacity!=
|
|
|
-0&&A(K,G,B,0,1,2,sa,za,b)}}else if(sa instanceof THREE.RenderableFace4&&(K=sa.v1,G=sa.v2,B=sa.v3,da=sa.v4,K.positionScreen.x*=u,K.positionScreen.y*=x,G.positionScreen.x*=u,G.positionScreen.y*=x,B.positionScreen.x*=u,B.positionScreen.y*=x,da.positionScreen.x*=u,da.positionScreen.y*=x,J.positionScreen.copy(G.positionScreen),R.positionScreen.copy(da.positionScreen),sa.overdraw&&(Pa(K.positionScreen,G.positionScreen),Pa(G.positionScreen,da.positionScreen),Pa(da.positionScreen,K.positionScreen),Pa(B.positionScreen,
|
|
|
-J.positionScreen),Pa(B.positionScreen,R.positionScreen)),M.addPoint(K.positionScreen.x,K.positionScreen.y),M.addPoint(G.positionScreen.x,G.positionScreen.y),M.addPoint(B.positionScreen.x,B.positionScreen.y),M.addPoint(da.positionScreen.x,da.positionScreen.y),L.intersects(M))){Ha=0;for(Qa=sa.meshMaterials.length;Ha<Qa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Xa=0;for($a=sa.faceMaterials.length;Xa<$a;)(za=sa.faceMaterials[Xa++])&&za.opacity!=0&&E(K,G,B,da,J,R,sa,za,b)}else za.opacity!=
|
|
|
-0&&E(K,G,B,da,J,R,sa,za,b)}U.addRectangle(M)}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&&(da.sub(h.position,e.centroidWorld),da.normalize(),m=e.normalWorld.dot(da)*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,m,o,n,p){k.info.render.vertices+=3;k.info.render.faces++;S=f(Y++);
|
|
|
-S.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(N.r=O.r,N.g=O.g,N.b=O.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?(B=1-n.__2near/(n.__farPlusNear-
|
|
|
-o.z*n.__farMinusNear),H.setRGB(B,B,B)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?S.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):S.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(S)}function e(e,c,m,n,o,p,u){k.info.render.vertices+=
|
|
|
-4;k.info.render.faces++;S=f(Y++);S.setAttribute("d","M "+e.positionScreen.x+" "+e.positionScreen.y+" L "+c.positionScreen.x+" "+c.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");p instanceof THREE.MeshBasicMaterial?H.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(N.r=O.r,N.g=O.g,N.b=O.b,b(u,o,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?(B=1-p.__2near/(p.__farPlusNear-o.z*p.__farMinusNear),H.setRGB(B,B,B)):p instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));p.wireframe?S.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):S.setAttribute("style","fill: "+H.getContextStyle()+
|
|
|
-"; fill-opacity: "+p.opacity);t.appendChild(S)}function f(b){J[b]==null&&(J[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&J[b].setAttribute("shape-rendering","crispEdges"));return J[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,t=document.createElementNS("http://www.w3.org/2000/svg","svg"),v,w,u,x,p,y,A,z,E=new THREE.Rectangle,F=new THREE.Rectangle,D=!1,H=new THREE.Color(16777215),N=new THREE.Color(16777215),O=new THREE.Color(0),
|
|
|
-K=new THREE.Color(0),G=new THREE.Color(0),B,da=new THREE.Vector3,J=[],R=[],S,Y,W,o=1;this.domElement=t;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{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;u=v/2;x=w/2;t.setAttribute("viewBox",-u+" "+-x+" "+v+" "+w);t.setAttribute("width",v);t.setAttribute("height",w);E.set(-u,-x,u,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};
|
|
|
-this.render=function(b,f){var h,v,w,H,N,J,B,$;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);W=Y=0;if(D=b.lights.length>0){B=b.lights;O.setRGB(0,0,0);K.setRGB(0,0,0);G.setRGB(0,0,0);h=0;for(v=B.length;h<v;h++)w=B[h],H=w.color,w instanceof THREE.AmbientLight?(O.r+=H.r,O.g+=H.g,O.b+=H.b):w instanceof THREE.DirectionalLight?(K.r+=H.r,K.g+=H.g,K.b+=H.b):w instanceof THREE.PointLight&&(G.r+=H.r,G.g+=H.g,G.b+=H.b)}h=0;for(v=m.length;h<
|
|
|
-v;h++)if(B=m[h],F.empty(),B instanceof THREE.RenderableParticle){p=B;p.x*=u;p.y*=-x;w=0;for(H=B.materials.length;w<H;)w++}else if(B instanceof THREE.RenderableLine){if(p=B.v1,y=B.v2,p.positionScreen.x*=u,p.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,F.addPoint(p.positionScreen.x,p.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),E.intersects(F)){w=0;for(H=B.materials.length;w<H;)if(($=B.materials[w++])&&$.opacity!=0){N=p;J=y;var X=W++;R[X]==null&&(R[X]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"line"),o==0&&R[X].setAttribute("shape-rendering","crispEdges"));S=R[X];S.setAttribute("x1",N.positionScreen.x);S.setAttribute("y1",N.positionScreen.y);S.setAttribute("x2",J.positionScreen.x);S.setAttribute("y2",J.positionScreen.y);$ instanceof THREE.LineBasicMaterial&&(S.setAttribute("style","fill: none; stroke: "+$.color.getContextStyle()+"; stroke-width: "+$.linewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.linecap+"; stroke-linejoin: "+$.linejoin),t.appendChild(S))}}}else if(B instanceof
|
|
|
-THREE.RenderableFace3){if(p=B.v1,y=B.v2,A=B.v3,p.positionScreen.x*=u,p.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,F.addPoint(p.positionScreen.x,p.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),E.intersects(F)){w=0;for(H=B.meshMaterials.length;w<H;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){N=0;for(J=B.faceMaterials.length;N<J;)($=B.faceMaterials[N++])&&
|
|
|
-$.opacity!=0&&c(p,y,A,B,$,b)}else $&&$.opacity!=0&&c(p,y,A,B,$,b)}}else if(B instanceof THREE.RenderableFace4&&(p=B.v1,y=B.v2,A=B.v3,z=B.v4,p.positionScreen.x*=u,p.positionScreen.y*=-x,y.positionScreen.x*=u,y.positionScreen.y*=-x,A.positionScreen.x*=u,A.positionScreen.y*=-x,z.positionScreen.x*=u,z.positionScreen.y*=-x,F.addPoint(p.positionScreen.x,p.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),
|
|
|
-E.intersects(F))){w=0;for(H=B.meshMaterials.length;w<H;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){N=0;for(J=B.faceMaterials.length;N<J;)($=B.faceMaterials[N++])&&$.opacity!=0&&e(p,y,A,z,B,$,b)}else $&&$.opacity!=0&&e(p,y,A,z,B,$,b)}}};
|
|
|
+THREE.DOMRenderer=function(){THREE.Renderer.call(this);var b=null,c=new THREE.Projector,e,f,h,k;this.domElement=document.createElement("div");this.setSize=function(b,c){e=b;f=c;h=e/2;k=f/2};this.render=function(e,f){var p,u,w,t,x,v,A,z;b=c.projectScene(e,f);p=0;for(u=b.length;p<u;p++)if(x=b[p],x instanceof THREE.RenderableParticle){A=x.x*h+h;z=x.y*k+k;w=0;for(t=x.material.length;w<t;w++)if(v=x.material[w],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=A+"px",v.style.top=z+"px"}}};
|
|
|
+THREE.CanvasRenderer=function(b){function c(b){if(y!=b)v.globalAlpha=y=b}function e(b){if(E!=b){switch(b){case THREE.NormalBlending:v.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:v.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:v.globalCompositeOperation="darker"}E=b}}function f(b){if(F!=b)v.strokeStyle=F=b}function h(b){if(D!=b)v.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},p=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
+u,w,t,x,v=p.getContext("2d"),A=new THREE.Color(0),z=0,y=1,E=0,F=null,D=null,H=null,L=null,M=null,K,G,B,da,J=new THREE.RenderableVertex,Q=new THREE.RenderableVertex,R,Y,V,o,ea,P,ma,Z,ia,aa,ka,fa,ca=new THREE.Color(0),$=new THREE.Color(0),W=new THREE.Color(0),ga=new THREE.Color(0),la=new THREE.Color(0),ra=[],na,O,oa,qa,wa,ta,Ea,Aa,Ca,Fa,X=new THREE.Rectangle,T=new THREE.Rectangle,N=new THREE.Rectangle,ua=!1,ha=new THREE.Color,ja=new THREE.Color,ya=new THREE.Color,xa=new THREE.Color,pa=new THREE.Vector3,
|
|
|
+Ia,Da,Ka,Ba,Ga,U,b=16;Ia=document.createElement("canvas");Ia.width=Ia.height=2;Da=Ia.getContext("2d");Da.fillStyle="rgba(0,0,0,1)";Da.fillRect(0,0,2,2);Ka=Da.getImageData(0,0,2,2);Ba=Ka.data;Ga=document.createElement("canvas");Ga.width=Ga.height=b;U=Ga.getContext("2d");U.translate(-b/2,-b/2);U.scale(b,b);b--;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(b,c){u=b;w=c;t=Math.floor(u/2);x=Math.floor(w/2);p.width=u;
|
|
|
+p.height=w;X.set(-t,-x,t,x);T.set(-t,-x,t,x);y=1;E=0;M=L=H=D=F=null};this.setClearColor=function(b,c){A.copy(b);z=c;T.set(-t,-x,t,x)};this.setClearColorHex=function(b,c){A.setHex(b);z=c;T.set(-t,-x,t,x)};this.clear=function(){v.setTransform(1,0,0,-1,t,x);T.isEmpty()||(T.minSelf(X),T.inflate(2),z<1&&v.clearRect(Math.floor(T.getX()),Math.floor(T.getY()),Math.floor(T.getWidth()),Math.floor(T.getHeight())),z>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(A.r*255)+","+Math.floor(A.g*255)+","+Math.floor(A.b*
|
|
|
+255)+","+z+")"),v.fillRect(Math.floor(T.getX()),Math.floor(T.getY()),Math.floor(T.getWidth()),Math.floor(T.getHeight()))),T.empty())};this.render=function(b,u){function p(b){var c,e,f,k=b.lights;ja.setRGB(0,0,0);ya.setRGB(0,0,0);xa.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.AmbientLight?(ja.r+=f.r,ja.g+=f.g,ja.b+=f.b):e instanceof THREE.DirectionalLight?(ya.r+=f.r,ya.g+=f.g,ya.b+=f.b):e instanceof THREE.PointLight&&(xa.r+=f.r,xa.g+=f.g,xa.b+=f.b)}function w(b,c,e,
|
|
|
+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=e.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=e.dot(pa.sub(h.position,c).normalize()),o<=0||(o*=h.distance==0?1:1-Math.min(c.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 eb(b,k,m){c(m.opacity);e(m.blending);var o,n,u,p,w,va;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)p=
|
|
|
+m.map.image,w=p.width>>1,va=p.height>>1,m=k.scale.x*t,u=k.scale.y*x,o=m*w,n=u*va,N.set(b.x-o,b.y-n,b.x+o,b.y+n),X.intersects(N)&&(v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(m,-u),v.translate(-w,-va),v.drawImage(p,0,0),v.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*t,n=k.scale.y*x,N.set(b.x-o,b.y-n,b.x+o,b.y+n),X.intersects(N)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(o,n),m.program(v),
|
|
|
+v.restore()))}function z(b,k,h,m){c(m.opacity);e(m.blending);v.beginPath();v.moveTo(b.positionScreen.x,b.positionScreen.y);v.lineTo(k.positionScreen.x,k.positionScreen.y);v.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(H!=b)v.lineWidth=H=b;b=m.linecap;if(L!=b)v.lineCap=L=b;b=m.linejoin;if(M!=b)v.lineJoin=M=b;f(m.color.getContextStyle());v.stroke();N.inflate(m.linewidth*2)}}function y(b,f,h,m,n,t,p,v,x){k.info.render.vertices+=3;k.info.render.faces++;c(v.opacity);e(v.blending);
|
|
|
+R=b.positionScreen.x;Y=b.positionScreen.y;V=f.positionScreen.x;o=f.positionScreen.y;ea=h.positionScreen.x;P=h.positionScreen.y;E(R,Y,V,o,ea,P);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(qa=p.uvs[0],$a(R,Y,V,o,ea,P,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=u.matrixWorldInverse,pa.copy(p.vertexNormalsWorld[0]),wa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,
|
|
|
+ta=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(p.vertexNormalsWorld[1]),Ea=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Aa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(p.vertexNormalsWorld[2]),Ca=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Fa=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,$a(R,Y,V,o,ea,P,wa,ta,Ea,Aa,Ca,Fa,v.envMap)}else v.wireframe?D(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Na(v.color);else if(v instanceof THREE.MeshLambertMaterial)v.map&&!v.wireframe&&
|
|
|
+(v.map.mapping instanceof THREE.UVMapping&&(qa=p.uvs[0],$a(R,Y,V,o,ea,P,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[t].u,qa[t].v,v.map)),e(THREE.SubtractiveBlending)),ua?!v.wireframe&&v.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3?($.r=W.r=ga.r=ja.r,$.g=W.g=ga.g=ja.g,$.b=W.b=ga.b=ja.b,w(x,p.v1.positionWorld,p.vertexNormalsWorld[0],$),w(x,p.v2.positionWorld,p.vertexNormalsWorld[1],W),w(x,p.v3.positionWorld,p.vertexNormalsWorld[2],ga),$.r=Math.max(0,Math.min(v.color.r*$.r,1)),$.g=Math.max(0,
|
|
|
+Math.min(v.color.g*$.g,1)),$.b=Math.max(0,Math.min(v.color.b*$.b,1)),W.r=Math.max(0,Math.min(v.color.r*W.r,1)),W.g=Math.max(0,Math.min(v.color.g*W.g,1)),W.b=Math.max(0,Math.min(v.color.b*W.b,1)),ga.r=Math.max(0,Math.min(v.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(v.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(v.color.b*ga.b,1)),la.r=(W.r+ga.r)*0.5,la.g=(W.g+ga.g)*0.5,la.b=(W.b+ga.b)*0.5,oa=Xa($,W,ga,la),Ua(R,Y,V,o,ea,P,0,0,1,0,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,p.centroidWorld,p.normalWorld,
|
|
|
+ha),ca.r=Math.max(0,Math.min(v.color.r*ha.r,1)),ca.g=Math.max(0,Math.min(v.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(v.color.b*ha.b,1)),v.wireframe?D(ca,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Na(ca)):v.wireframe?D(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Na(v.color);else if(v instanceof THREE.MeshDepthMaterial)na=u.near,O=u.far,$.r=$.g=$.b=1-Qa(b.positionScreen.z,na,O),W.r=W.g=W.b=1-Qa(f.positionScreen.z,na,O),ga.r=ga.g=ga.b=1-Qa(h.positionScreen.z,
|
|
|
+na,O),la.r=(W.r+ga.r)*0.5,la.g=(W.g+ga.g)*0.5,la.b=(W.b+ga.b)*0.5,oa=Xa($,W,ga,la),Ua(R,Y,V,o,ea,P,0,0,1,0,0,1,oa);else if(v instanceof THREE.MeshNormalMaterial)ca.r=Va(p.normalWorld.x),ca.g=Va(p.normalWorld.y),ca.b=Va(p.normalWorld.z),v.wireframe?D(ca,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Na(ca)}function A(b,f,h,m,n,t,v,p,x){k.info.render.vertices+=4;k.info.render.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)y(b,f,m,0,1,3,v,p,x),y(n,h,t,1,2,3,v,p,x);else if(R=b.positionScreen.x,
|
|
|
+Y=b.positionScreen.y,V=f.positionScreen.x,o=f.positionScreen.y,ea=h.positionScreen.x,P=h.positionScreen.y,ma=m.positionScreen.x,Z=m.positionScreen.y,ia=n.positionScreen.x,aa=n.positionScreen.y,ka=t.positionScreen.x,fa=t.positionScreen.y,p instanceof THREE.MeshBasicMaterial)F(R,Y,V,o,ea,P,ma,Z),p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Na(p.color);else if(p instanceof THREE.MeshLambertMaterial)ua?!p.wireframe&&p.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==
|
|
|
+4?($.r=W.r=ga.r=la.r=ja.r,$.g=W.g=ga.g=la.g=ja.g,$.b=W.b=ga.b=la.b=ja.b,w(x,v.v1.positionWorld,v.vertexNormalsWorld[0],$),w(x,v.v2.positionWorld,v.vertexNormalsWorld[1],W),w(x,v.v4.positionWorld,v.vertexNormalsWorld[3],ga),w(x,v.v3.positionWorld,v.vertexNormalsWorld[2],la),$.r=Math.max(0,Math.min(p.color.r*$.r,1)),$.g=Math.max(0,Math.min(p.color.g*$.g,1)),$.b=Math.max(0,Math.min(p.color.b*$.b,1)),W.r=Math.max(0,Math.min(p.color.r*W.r,1)),W.g=Math.max(0,Math.min(p.color.g*W.g,1)),W.b=Math.max(0,Math.min(p.color.b*
|
|
|
+W.b,1)),ga.r=Math.max(0,Math.min(p.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(p.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(p.color.b*ga.b,1)),la.r=Math.max(0,Math.min(p.color.r*la.r,1)),la.g=Math.max(0,Math.min(p.color.g*la.g,1)),la.b=Math.max(0,Math.min(p.color.b*la.b,1)),oa=Xa($,W,ga,la),E(R,Y,V,o,ma,Z),Ua(R,Y,V,o,ma,Z,0,0,1,0,0,1,oa),E(ia,aa,ea,P,ka,fa),Ua(ia,aa,ea,P,ka,fa,1,0,1,1,0,1,oa)):(ha.r=ja.r,ha.g=ja.g,ha.b=ja.b,w(x,v.centroidWorld,v.normalWorld,ha),ca.r=Math.max(0,Math.min(p.color.r*ha.r,
|
|
|
+1)),ca.g=Math.max(0,Math.min(p.color.g*ha.g,1)),ca.b=Math.max(0,Math.min(p.color.b*ha.b,1)),F(R,Y,V,o,ea,P,ma,Z),p.wireframe?D(ca,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Na(ca)):(F(R,Y,V,o,ea,P,ma,Z),p.wireframe?D(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Na(p.color));else if(p instanceof THREE.MeshNormalMaterial)ca.r=Va(v.normalWorld.x),ca.g=Va(v.normalWorld.y),ca.b=Va(v.normalWorld.z),F(R,Y,V,o,ea,P,ma,Z),p.wireframe?D(ca,p.wireframeLinewidth,p.wireframeLinecap,
|
|
|
+p.wireframeLinejoin):Na(ca);else if(p instanceof THREE.MeshDepthMaterial)na=u.near,O=u.far,$.r=$.g=$.b=1-Qa(b.positionScreen.z,na,O),W.r=W.g=W.b=1-Qa(f.positionScreen.z,na,O),ga.r=ga.g=ga.b=1-Qa(m.positionScreen.z,na,O),la.r=la.g=la.b=1-Qa(h.positionScreen.z,na,O),oa=Xa($,W,ga,la),E(R,Y,V,o,ma,Z),Ua(R,Y,V,o,ma,Z,0,0,1,0,0,1,oa),E(ia,aa,ea,P,ka,fa),Ua(ia,aa,ea,P,ka,fa,1,0,1,1,0,1,oa)}function E(b,c,e,f,k,h){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(b,c);v.closePath()}function F(b,
|
|
|
+c,e,f,k,h,m,o){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(m,o);v.lineTo(b,c);v.closePath()}function D(b,c,e,k){if(H!=c)v.lineWidth=H=c;if(L!=e)v.lineCap=L=e;if(M!=k)v.lineJoin=M=k;f(b.getContextStyle());v.stroke();N.inflate(c*2)}function Na(b){h(b.getContextStyle());v.fill()}function $a(b,c,e,f,k,m,o,n,p,t,u,w,va){if(va.image.width!=0){if(va.needsUpdate==!0||ra[va.id]==void 0){var x=va.wrapS==THREE.RepeatWrapping,X=va.wrapT==THREE.RepeatWrapping;ra[va.id]=v.createPattern(va.image,
|
|
|
+x&&X?"repeat":x&&!X?"repeat-x":!x&&X?"repeat-y":"no-repeat");va.needsUpdate=!1}h(ra[va.id]);var x=va.offset.x/va.repeat.x,X=va.offset.y/va.repeat.y,y=(va.image.width-1)*va.repeat.x,va=(va.image.height-1)*va.repeat.y,o=(o+x)*y,n=(n+X)*va,p=(p+x)*y,t=(t+X)*va,u=(u+x)*y,w=(w+X)*va;e-=b;f-=c;k-=b;m-=c;p-=o;t-=n;u-=o;w-=n;x=1/(p*w-u*t);va=(w*e-t*k)*x;t=(w*f-t*m)*x;e=(p*k-u*e)*x;f=(p*m-u*f)*x;b=b-va*o-e*n;c=c-t*o-f*n;v.save();v.transform(va,t,e,f,b,c);v.fill();v.restore()}}function Ua(b,c,e,f,k,h,m,o,n,
|
|
|
+p,t,u,va){var w,x;w=va.width-1;x=va.height-1;m*=w;o*=x;n*=w;p*=x;t*=w;u*=x;e-=b;f-=c;k-=b;h-=c;n-=m;p-=o;t-=m;u-=o;x=1/(n*u-t*p);w=(u*e-p*k)*x;p=(u*f-p*h)*x;e=(n*k-t*e)*x;f=(n*h-t*f)*x;b=b-w*m-e*o;c=c-p*m-f*o;v.save();v.transform(w,p,e,f,b,c);v.clip();v.drawImage(va,0,0);v.restore()}function Xa(b,c,e,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(c.r*255),o=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),p=~~(e.g*255),e=~~(e.b*255),t=~~(f.r*255),v=~~(f.g*255),f=~~(f.b*255);Ba[0]=k<0?0:k>255?255:k;
|
|
|
+Ba[1]=h<0?0:h>255?255:h;Ba[2]=b<0?0:b>255?255:b;Ba[4]=m<0?0:m>255?255:m;Ba[5]=o<0?0:o>255?255:o;Ba[6]=c<0?0:c>255?255:c;Ba[8]=n<0?0:n>255?255:n;Ba[9]=p<0?0:p>255?255:p;Ba[10]=e<0?0:e>255?255:e;Ba[12]=t<0?0:t>255?255:t;Ba[13]=v<0?0:v>255?255:v;Ba[14]=f<0?0:f>255?255:f;Da.putImageData(Ka,0,0);U.drawImage(Ia,0,0);return Ga}function Qa(b,c,e){b=(b-c)/(e-c);return b*b*(3-2*b)}function Va(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}function Oa(b,c){var e=c.x-b.x,f=c.y-b.y,k=e*e+f*f;k!=0&&(k=1/Math.sqrt(k),e*=k,
|
|
|
+f*=k,c.x+=e,c.y+=f,b.x-=e,b.y-=f)}var Ya,ab,sa,Ha,Pa,Wa,Za,za;this.autoClear?this.clear():v.setTransform(1,0,0,-1,t,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,u,this.sortElements);(ua=b.lights.length>0)&&p(b);Ya=0;for(ab=m.length;Ya<ab;Ya++){sa=m[Ya];N.empty();if(sa instanceof THREE.RenderableParticle){K=sa;K.x*=t;K.y*=x;Ha=0;for(Pa=sa.materials.length;Ha<Pa;)za=sa.materials[Ha++],za.opacity!=0&&eb(K,sa,za,b)}else if(sa instanceof THREE.RenderableLine){if(K=sa.v1,G=sa.v2,
|
|
|
+K.positionScreen.x*=t,K.positionScreen.y*=x,G.positionScreen.x*=t,G.positionScreen.y*=x,N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(G.positionScreen.x,G.positionScreen.y),X.intersects(N)){Ha=0;for(Pa=sa.materials.length;Ha<Pa;)za=sa.materials[Ha++],za.opacity!=0&&z(K,G,sa,za,b)}}else if(sa instanceof THREE.RenderableFace3){if(K=sa.v1,G=sa.v2,B=sa.v3,K.positionScreen.x*=t,K.positionScreen.y*=x,G.positionScreen.x*=t,G.positionScreen.y*=x,B.positionScreen.x*=t,B.positionScreen.y*=x,
|
|
|
+sa.overdraw&&(Oa(K.positionScreen,G.positionScreen),Oa(G.positionScreen,B.positionScreen),Oa(B.positionScreen,K.positionScreen)),N.add3Points(K.positionScreen.x,K.positionScreen.y,G.positionScreen.x,G.positionScreen.y,B.positionScreen.x,B.positionScreen.y),X.intersects(N)){Ha=0;for(Pa=sa.meshMaterials.length;Ha<Pa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=sa.faceMaterials.length;Wa<Za;)(za=sa.faceMaterials[Wa++])&&za.opacity!=0&&y(K,G,B,0,1,2,sa,za,b)}else za.opacity!=
|
|
|
+0&&y(K,G,B,0,1,2,sa,za,b)}}else if(sa instanceof THREE.RenderableFace4&&(K=sa.v1,G=sa.v2,B=sa.v3,da=sa.v4,K.positionScreen.x*=t,K.positionScreen.y*=x,G.positionScreen.x*=t,G.positionScreen.y*=x,B.positionScreen.x*=t,B.positionScreen.y*=x,da.positionScreen.x*=t,da.positionScreen.y*=x,J.positionScreen.copy(G.positionScreen),Q.positionScreen.copy(da.positionScreen),sa.overdraw&&(Oa(K.positionScreen,G.positionScreen),Oa(G.positionScreen,da.positionScreen),Oa(da.positionScreen,K.positionScreen),Oa(B.positionScreen,
|
|
|
+J.positionScreen),Oa(B.positionScreen,Q.positionScreen)),N.addPoint(K.positionScreen.x,K.positionScreen.y),N.addPoint(G.positionScreen.x,G.positionScreen.y),N.addPoint(B.positionScreen.x,B.positionScreen.y),N.addPoint(da.positionScreen.x,da.positionScreen.y),X.intersects(N))){Ha=0;for(Pa=sa.meshMaterials.length;Ha<Pa;)if(za=sa.meshMaterials[Ha++],za instanceof THREE.MeshFaceMaterial){Wa=0;for(Za=sa.faceMaterials.length;Wa<Za;)(za=sa.faceMaterials[Wa++])&&za.opacity!=0&&A(K,G,B,da,J,Q,sa,za,b)}else za.opacity!=
|
|
|
+0&&A(K,G,B,da,J,Q,sa,za,b)}T.addRectangle(N)}v.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function b(b,c,e){var f,k,h,m;f=0;for(k=b.lights.length;f<k;f++)h=b.lights[f],h instanceof THREE.DirectionalLight?(m=c.normalWorld.dot(h.position)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m)):h instanceof THREE.PointLight&&(da.sub(h.position,c.centroidWorld),da.normalize(),m=c.normalWorld.dot(da)*h.intensity,m>0&&(e.r+=h.color.r*m,e.g+=h.color.g*m,e.b+=h.color.b*m))}function c(c,e,m,o,n,t){k.info.render.vertices+=3;k.info.render.faces++;R=f(Y++);
|
|
|
+R.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");n instanceof THREE.MeshBasicMaterial?H.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(t,o,L),H.r=Math.max(0,Math.min(n.color.r*L.r,1)),H.g=Math.max(0,Math.min(n.color.g*L.g,1)),H.b=Math.max(0,Math.min(n.color.b*L.b,1))):H.copy(n.color):n instanceof THREE.MeshDepthMaterial?(B=1-n.__2near/(n.__farPlusNear-
|
|
|
+o.z*n.__farMinusNear),H.setRGB(B,B,B)):n instanceof THREE.MeshNormalMaterial&&H.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?R.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):R.setAttribute("style","fill: "+H.getContextStyle()+"; fill-opacity: "+n.opacity);p.appendChild(R)}function e(c,e,m,o,n,t,v){k.info.render.vertices+=
|
|
|
+4;k.info.render.faces++;R=f(Y++);R.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+o.positionScreen.x+","+o.positionScreen.y+"z");t instanceof THREE.MeshBasicMaterial?H.copy(t.color):t instanceof THREE.MeshLambertMaterial?D?(L.r=M.r,L.g=M.g,L.b=M.b,b(v,n,L),H.r=Math.max(0,Math.min(t.color.r*L.r,1)),H.g=Math.max(0,Math.min(t.color.g*L.g,1)),H.b=Math.max(0,Math.min(t.color.b*L.b,1))):
|
|
|
+H.copy(t.color):t instanceof THREE.MeshDepthMaterial?(B=1-t.__2near/(t.__farPlusNear-n.z*t.__farMinusNear),H.setRGB(B,B,B)):t instanceof THREE.MeshNormalMaterial&&H.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));t.wireframe?R.setAttribute("style","fill: none; stroke: "+H.getContextStyle()+"; stroke-width: "+t.wireframeLinewidth+"; stroke-opacity: "+t.opacity+"; stroke-linecap: "+t.wireframeLinecap+"; stroke-linejoin: "+t.wireframeLinejoin):R.setAttribute("style","fill: "+H.getContextStyle()+
|
|
|
+"; fill-opacity: "+t.opacity);p.appendChild(R)}function f(b){J[b]==null&&(J[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&J[b].setAttribute("shape-rendering","crispEdges"));return J[b]}function h(b){b=(b+1)*0.5;return b<0?0:b>1?1:b}var k=this,m=null,n=new THREE.Projector,p=document.createElementNS("http://www.w3.org/2000/svg","svg"),u,w,t,x,v,A,z,y,E=new THREE.Rectangle,F=new THREE.Rectangle,D=!1,H=new THREE.Color(16777215),L=new THREE.Color(16777215),M=new THREE.Color(0),
|
|
|
+K=new THREE.Color(0),G=new THREE.Color(0),B,da=new THREE.Vector3,J=[],Q=[],R,Y,V,o=1;this.domElement=p;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setQuality=function(b){switch(b){case "high":o=1;break;case "low":o=0}};this.setSize=function(b,c){u=b;w=c;t=u/2;x=w/2;p.setAttribute("viewBox",-t+" "+-x+" "+u+" "+w);p.setAttribute("width",u);p.setAttribute("height",w);E.set(-t,-x,t,x)};this.clear=function(){for(;p.childNodes.length>0;)p.removeChild(p.childNodes[0])};
|
|
|
+this.render=function(b,f){var h,u,w,H,L,J,B,$;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);V=Y=0;if(D=b.lights.length>0){B=b.lights;M.setRGB(0,0,0);K.setRGB(0,0,0);G.setRGB(0,0,0);h=0;for(u=B.length;h<u;h++)w=B[h],H=w.color,w instanceof THREE.AmbientLight?(M.r+=H.r,M.g+=H.g,M.b+=H.b):w instanceof THREE.DirectionalLight?(K.r+=H.r,K.g+=H.g,K.b+=H.b):w instanceof THREE.PointLight&&(G.r+=H.r,G.g+=H.g,G.b+=H.b)}h=0;for(u=m.length;h<
|
|
|
+u;h++)if(B=m[h],F.empty(),B instanceof THREE.RenderableParticle){v=B;v.x*=t;v.y*=-x;w=0;for(H=B.materials.length;w<H;)w++}else if(B instanceof THREE.RenderableLine){if(v=B.v1,A=B.v2,v.positionScreen.x*=t,v.positionScreen.y*=-x,A.positionScreen.x*=t,A.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),E.intersects(F)){w=0;for(H=B.materials.length;w<H;)if(($=B.materials[w++])&&$.opacity!=0){L=v;J=A;var W=V++;Q[W]==null&&(Q[W]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"line"),o==0&&Q[W].setAttribute("shape-rendering","crispEdges"));R=Q[W];R.setAttribute("x1",L.positionScreen.x);R.setAttribute("y1",L.positionScreen.y);R.setAttribute("x2",J.positionScreen.x);R.setAttribute("y2",J.positionScreen.y);$ instanceof THREE.LineBasicMaterial&&(R.setAttribute("style","fill: none; stroke: "+$.color.getContextStyle()+"; stroke-width: "+$.linewidth+"; stroke-opacity: "+$.opacity+"; stroke-linecap: "+$.linecap+"; stroke-linejoin: "+$.linejoin),p.appendChild(R))}}}else if(B instanceof
|
|
|
+THREE.RenderableFace3){if(v=B.v1,A=B.v2,z=B.v3,v.positionScreen.x*=t,v.positionScreen.y*=-x,A.positionScreen.x*=t,A.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),E.intersects(F)){w=0;for(H=B.meshMaterials.length;w<H;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(J=B.faceMaterials.length;L<J;)($=B.faceMaterials[L++])&&
|
|
|
+$.opacity!=0&&c(v,A,z,B,$,b)}else $&&$.opacity!=0&&c(v,A,z,B,$,b)}}else if(B instanceof THREE.RenderableFace4&&(v=B.v1,A=B.v2,z=B.v3,y=B.v4,v.positionScreen.x*=t,v.positionScreen.y*=-x,A.positionScreen.x*=t,A.positionScreen.y*=-x,z.positionScreen.x*=t,z.positionScreen.y*=-x,y.positionScreen.x*=t,y.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),
|
|
|
+E.intersects(F))){w=0;for(H=B.meshMaterials.length;w<H;)if($=B.meshMaterials[w++],$ instanceof THREE.MeshFaceMaterial){L=0;for(J=B.faceMaterials.length;L<J;)($=B.faceMaterials[L++])&&$.opacity!=0&&e(v,A,z,y,B,$,b)}else $&&$.opacity!=0&&e(v,A,z,y,B,$,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",
|
|
@@ -219,119 +219,119 @@ THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_pars_fragment,THREE.
|
|
|
THREE.ShaderChunk.envmap_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},particle_basic:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.particle,THREE.UniformsLib.shadowmap]),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"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,
|
|
|
"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
|
-THREE.WebGLRenderer=function(b){function c(b,e,c){var f,k,h,m=b.vertices,n=m.length,p=b.colors,u=p.length,t=b.__vertexArray,v=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,y=b.__dirtyColors,L=b.__webglCustomAttributes,z,M;if(L)for(z in L)L[z].offset=0;if(c.sortParticles){ta.multiplySelf(c.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Ca.copy(k),ta.multiplyVector3(Ca),w[f]=[Ca.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,t[h]=k.x,t[h+1]=k.y,t[h+2]=k.z;
|
|
|
-for(f=0;f<u;f++)h=f*3,color=p[w[f][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(L)for(z in L){f=L[z];p=f.value.length;for(h=0;h<p;h++){index=w[h][1];u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")M=f.value[index];f.size===2?(f.array[u]=M.x,f.array[u+1]=M.y):f.size===3?f.type==="c"?(f.array[u]=M.r,f.array[u+1]=M.g,f.array[u+2]=M.b):(f.array[u]=M.x,f.array[u+1]=M.y,f.array[u+2]=M.z):(f.array[u]=
|
|
|
-M.x,f.array[u+1]=M.y,f.array[u+2]=M.z,f.array[u+3]=M.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,t[h]=k.x,t[h+1]=k.y,t[h+2]=k.z;if(y)for(f=0;f<u;f++)color=p[f],h=f*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(L)for(z in L)if(f=L[z],f.__original.needsUpdate){p=f.value.length;for(h=0;h<p;h++){u=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[u]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")M=f.value[h];f.size===2?(f.array[u]=
|
|
|
-M.x,f.array[u+1]=M.y):f.size===3?f.type==="c"?(f.array[u]=M.r,f.array[u+1]=M.g,f.array[u+2]=M.b):(f.array[u]=M.x,f.array[u+1]=M.y,f.array[u+2]=M.z):(f.array[u]=M.x,f.array[u+1]=M.y,f.array[u+2]=M.z,f.array[u+3]=M.w)}f.offset+=f.size}}}if(x||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,t,e);if(y||c.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,v,e);if(L)for(z in L)if(f=L[z],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||W.initMaterial(f,e,c,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var h=0,m=W.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var n=!1,h=f.program,m=h.uniforms,u=f.uniforms;h!=Q&&(o.useProgram(h),Q=h,n=!0);if(f.id!=Z)Z=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(c&&f.fog)if(u.fogColor.value=c.color,c instanceof
|
|
|
-THREE.Fog)u.fogNear.value=c.near,u.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)u.fogDensity.value=c.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var p,t,v=0,w=0,x=0,y,z,M,A=Fa,U=A.directional.colors,E=A.directional.positions,F=A.point.colors,D=A.point.positions,H=A.point.distances,na=0,ua=0,c=p=M=0,n=e.length;c<n;c++)if(p=e[c],t=p.color,y=p.position,z=p.intensity,M=p.distance,p instanceof THREE.AmbientLight)v+=t.r,w+=t.g,x+=t.b;else if(p instanceof
|
|
|
-THREE.DirectionalLight)M=na*3,U[M]=t.r*z,U[M+1]=t.g*z,U[M+2]=t.b*z,E[M]=y.x,E[M+1]=y.y,E[M+2]=y.z,na+=1;else if(p instanceof THREE.SpotLight)M=na*3,U[M]=t.r*z,U[M+1]=t.g*z,U[M+2]=t.b*z,t=1/y.length(),E[M]=y.x*t,E[M+1]=y.y*t,E[M+2]=y.z*t,na+=1;else if(p instanceof THREE.PointLight)p=ua*3,F[p]=t.r*z,F[p+1]=t.g*z,F[p+2]=t.b*z,D[p]=y.x,D[p+1]=y.y,D[p+2]=y.z,H[ua]=M,ua+=1;c=na*3;for(n=U.length;c<n;c++)U[c]=0;c=ua*3;for(n=F.length;c<n;c++)F[c]=0;A.point.length=ua;A.directional.length=na;A.ambient[0]=v;
|
|
|
-A.ambient[1]=w;A.ambient[2]=x;e=Fa;u.enableLighting.value=e.directional.length+e.point.length;u.ambientLightColor.value=e.ambient;u.directionalLightColor.value=e.directional.colors;u.directionalLightDirection.value=e.directional.positions;u.pointLightColor.value=e.point.colors;u.pointLightPosition.value=e.point.positions;u.pointLightDistance.value=e.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)u.diffuse.value=
|
|
|
-f.color,u.opacity.value=f.opacity,(u.map.texture=f.map)&&u.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),u.lightMap.texture=f.lightMap,u.envMap.texture=f.envMap,u.reflectivity.value=f.reflectivity,u.refractionRatio.value=f.refractionRatio,u.combine.value=f.combine,u.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)u.diffuse.value=f.color,u.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)u.psColor.value=
|
|
|
-f.color,u.opacity.value=f.opacity,u.size.value=f.size,u.scale.value=L.height/2,u.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)u.ambient.value=f.ambient,u.specular.value=f.specular,u.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)u.mNear.value=b.near,u.mFar.value=b.far,u.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)u.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&u.shadowMatrix){for(e=0;e<pa.length;e++)u.shadowMatrix.value[e]=
|
|
|
-pa[e],u.shadowMap.texture[e]=W.shadowMap[e];u.shadowDarkness.value=W.shadowMapDarkness;u.shadowBias.value=W.shadowMapBias}e=f.uniformsList;u=0;for(c=e.length;u<c;u++)if(w=h.uniforms[e[u][1]])if(v=e[u][0],x=v.type,n=v.value,x=="i")o.uniform1i(w,n);else if(x=="f")o.uniform1f(w,n);else if(x=="v2")o.uniform2f(w,n.x,n.y);else if(x=="v3")o.uniform3f(w,n.x,n.y,n.z);else if(x=="v4")o.uniform4f(w,n.x,n.y,n.z,n.w);else if(x=="c")o.uniform3f(w,n.r,n.g,n.b);else if(x=="fv1")o.uniform1fv(w,n);else if(x=="fv")o.uniform3fv(w,
|
|
|
-n);else if(x=="v3v"){if(!v._array)v._array=new Float32Array(3*n.length);x=0;for(y=n.length;x<y;x++)A=x*3,v._array[A]=n[x].x,v._array[A+1]=n[x].y,v._array[A+2]=n[x].z;o.uniform3fv(w,v._array)}else if(x=="m4"){if(!v._array)v._array=new Float32Array(16);n.flattenToArray(v._array);o.uniformMatrix4fv(w,!1,v._array)}else if(x=="m4v"){if(!v._array)v._array=new Float32Array(16*n.length);x=0;for(y=n.length;x<y;x++)n[x].flattenToArrayOffset(v._array,x*16);o.uniformMatrix4fv(w,!1,v._array)}else if(x=="t"){if(o.uniform1i(w,
|
|
|
-n),w=v.texture)if(w.image instanceof Array&&w.image.length==6){if(v=w,v.image.length==6)if(v.needsUpdate){if(!v.image.__webglTextureCube)v.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,v.image[n]);G(o.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else w instanceof
|
|
|
-THREE.WebGLRenderTargetCube?(v=w,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,v.__webglTexture)):B(w,n)}else if(x=="tv"){if(!v._array){v._array=[];x=0;for(y=v.texture.length;x<y;x++)v._array[x]=n+x}o.uniform1iv(w,v._array);x=0;for(y=v.texture.length;x<y;x++)(w=v.texture[x])&&B(w,v._array[x])}(f instanceof THREE.ShaderMaterial||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.WebGLRenderer=function(b){function c(b,c,e){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,X=b.__dirtyColors,y=b.__webglCustomAttributes,z,A;if(y)for(z in y)y[z].offset=0;if(e.sortParticles){ta.multiplySelf(e.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Ca.copy(k),ta.multiplyVector3(Ca),w[f]=[Ca.z,f];w.sort(function(b,c){return c[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(z in y){f=y[z];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")A=f.value[index];f.size===2?(f.array[t]=A.x,f.array[t+1]=A.y):f.size===3?f.type==="c"?(f.array[t]=A.r,f.array[t+1]=A.g,f.array[t+2]=A.b):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z):(f.array[t]=
|
|
|
+A.x,f.array[t+1]=A.y,f.array[t+2]=A.z,f.array[t+3]=A.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(X)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(z in y)if(f=y[z],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")A=f.value[h];f.size===2?(f.array[t]=
|
|
|
+A.x,f.array[t+1]=A.y):f.size===3?f.type==="c"?(f.array[t]=A.r,f.array[t+1]=A.g,f.array[t+2]=A.b):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z):(f.array[t]=A.x,f.array[t+1]=A.y,f.array[t+2]=A.z,f.array[t+3]=A.w)}f.offset+=f.size}}}if(x||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,v,c);if(X||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,u,c);if(y)for(z in y)if(f=y[z],f.__original.needsUpdate||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
+f.buffer),o.bufferData(o.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,k){f.program||V.initMaterial(f,c,e,k);if(f.morphTargets&&!k.__webglMorphTargetInfluences){k.__webglMorphTargetInfluences=new Float32Array(V.maxMorphTargets);for(var h=0,m=V.maxMorphTargets;h<m;h++)k.__webglMorphTargetInfluences[h]=0}var n=!1,h=f.program,m=h.uniforms,t=f.uniforms;h!=P&&(o.useProgram(h),P=h,n=!0);if(f.id!=Z)Z=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Ea);if(e&&f.fog)if(t.fogColor.value=e.color,e instanceof
|
|
|
+THREE.Fog)t.fogNear.value=e.near,t.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)t.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var p,v,u=0,w=0,x=0,y,A,z,N=Fa,T=N.directional.colors,E=N.directional.positions,F=N.point.colors,D=N.point.positions,H=N.point.distances,na=0,ua=0,e=p=z=0,n=c.length;e<n;e++)if(p=c[e],v=p.color,y=p.position,A=p.intensity,z=p.distance,p instanceof THREE.AmbientLight)u+=v.r,w+=v.g,x+=v.b;else if(p instanceof
|
|
|
+THREE.DirectionalLight)z=na*3,T[z]=v.r*A,T[z+1]=v.g*A,T[z+2]=v.b*A,E[z]=y.x,E[z+1]=y.y,E[z+2]=y.z,na+=1;else if(p instanceof THREE.SpotLight)z=na*3,T[z]=v.r*A,T[z+1]=v.g*A,T[z+2]=v.b*A,v=1/y.length(),E[z]=y.x*v,E[z+1]=y.y*v,E[z+2]=y.z*v,na+=1;else if(p instanceof THREE.PointLight)p=ua*3,F[p]=v.r*A,F[p+1]=v.g*A,F[p+2]=v.b*A,D[p]=y.x,D[p+1]=y.y,D[p+2]=y.z,H[ua]=z,ua+=1;e=na*3;for(n=T.length;e<n;e++)T[e]=0;e=ua*3;for(n=F.length;e<n;e++)F[e]=0;N.point.length=ua;N.directional.length=na;N.ambient[0]=u;
|
|
|
+N.ambient[1]=w;N.ambient[2]=x;c=Fa;t.enableLighting.value=c.directional.length+c.point.length;t.ambientLightColor.value=c.ambient;t.directionalLightColor.value=c.directional.colors;t.directionalLightDirection.value=c.directional.positions;t.pointLightColor.value=c.point.colors;t.pointLightPosition.value=c.point.positions;t.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)t.diffuse.value=
|
|
|
+f.color,t.opacity.value=f.opacity,(t.map.texture=f.map)&&t.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),t.lightMap.texture=f.lightMap,t.envMap.texture=f.envMap,t.reflectivity.value=f.reflectivity,t.refractionRatio.value=f.refractionRatio,t.combine.value=f.combine,t.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)t.diffuse.value=f.color,t.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)t.psColor.value=
|
|
|
+f.color,t.opacity.value=f.opacity,t.size.value=f.size,t.scale.value=X.height/2,t.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)t.ambient.value=f.ambient,t.specular.value=f.specular,t.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)t.mNear.value=b.near,t.mFar.value=b.far,t.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)t.opacity.value=f.opacity;if(k.receiveShadow&&!f._shadowPass&&t.shadowMatrix){for(c=0;c<pa.length;c++)t.shadowMatrix.value[c]=
|
|
|
+pa[c],t.shadowMap.texture[c]=V.shadowMap[c];t.shadowDarkness.value=V.shadowMapDarkness;t.shadowBias.value=V.shadowMapBias}c=f.uniformsList;t=0;for(e=c.length;t<e;t++)if(w=h.uniforms[c[t][1]])if(u=c[t][0],x=u.type,n=u.value,x=="i")o.uniform1i(w,n);else if(x=="f")o.uniform1f(w,n);else if(x=="v2")o.uniform2f(w,n.x,n.y);else if(x=="v3")o.uniform3f(w,n.x,n.y,n.z);else if(x=="v4")o.uniform4f(w,n.x,n.y,n.z,n.w);else if(x=="c")o.uniform3f(w,n.r,n.g,n.b);else if(x=="fv1")o.uniform1fv(w,n);else if(x=="fv")o.uniform3fv(w,
|
|
|
+n);else if(x=="v3v"){if(!u._array)u._array=new Float32Array(3*n.length);x=0;for(y=n.length;x<y;x++)N=x*3,u._array[N]=n[x].x,u._array[N+1]=n[x].y,u._array[N+2]=n[x].z;o.uniform3fv(w,u._array)}else if(x=="m4"){if(!u._array)u._array=new Float32Array(16);n.flattenToArray(u._array);o.uniformMatrix4fv(w,!1,u._array)}else if(x=="m4v"){if(!u._array)u._array=new Float32Array(16*n.length);x=0;for(y=n.length;x<y;x++)n[x].flattenToArrayOffset(u._array,x*16);o.uniformMatrix4fv(w,!1,u._array)}else if(x=="t"){if(o.uniform1i(w,
|
|
|
+n),w=u.texture)if(w.image instanceof Array&&w.image.length==6){if(u=w,u.image.length==6)if(u.needsUpdate){if(!u.image.__webglTextureCube)u.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,u.image.__webglTextureCube);for(n=0;n<6;n++)o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,u.image[n]);G(o.TEXTURE_CUBE_MAP,u,u.image[0]);u.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,u.image.__webglTextureCube)}else w instanceof
|
|
|
+THREE.WebGLRenderTargetCube?(u=w,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,u.__webglTexture)):B(w,n)}else if(x=="tv"){if(!u._array){u._array=[];x=0;for(y=u.texture.length;x<y;x++)u._array[x]=n+x}o.uniform1iv(w,u._array);x=0;for(y=u.texture.length;x<y;x++)(w=u.texture[x])&&B(w,u._array[x])}(f instanceof THREE.ShaderMaterial||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.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.ShaderMaterial||f.skinning)&&m.viewMatrix!==null&&o.uniformMatrix4fv(m.viewMatrix,!1,Aa);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Aa),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,k.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,!1,k._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,k._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||k.receiveShadow)&&
|
|
|
m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,k._objectMatrixArray);return h}function f(b,c,f,k,h,m){if(k.opacity!=0){var n,f=e(b,c,f,k,m),b=f.attributes,c=!1,f=h.id*16777215+f.id;f!=ia&&(ia=f,c=!0);if(!k.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=k.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[m.morphTargetBase]),
|
|
|
-o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var u=0,p=m.morphTargetForcedOrder,v=m.morphTargetInfluences;u<k.numSupportedMorphTargets&&u<p.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[u]]),o.vertexAttribPointer(f["morphTarget"+u],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[u]=v[p[u]],u++;else{var p=[],t=-1,
|
|
|
-w=0,v=m.morphTargetInfluences,x,y=v.length,u=0;for(m.morphTargetBase!==-1&&(p[m.morphTargetBase]=!0);u<k.numSupportedMorphTargets;){for(x=0;x<y;x++)!p[x]&&v[x]>t&&(w=x,t=v[w]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+u],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[u]=t;p[w]=1;t=-1;u++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=
|
|
|
+o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var t=0,p=m.morphTargetForcedOrder,u=m.morphTargetInfluences;t<k.numSupportedMorphTargets&&t<p.length;)o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[p[t]]),o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[t]=u[p[t]],t++;else{var p=[],v=-1,
|
|
|
+w=0,u=m.morphTargetInfluences,x,y=u.length,t=0;for(m.morphTargetBase!==-1&&(p[m.morphTargetBase]=!0);t<k.numSupportedMorphTargets;){for(x=0;x<y;x++)!p[x]&&u[x]>v&&(w=x,v=u[w]);o.bindBuffer(o.ARRAY_BUFFER,h.__webglMorphTargetsBuffers[w]);o.vertexAttribPointer(f["morphTarget"+t],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[t]=v;p[w]=1;v=-1;t++}}k.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(k.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(h.__webglCustomAttributes)for(n in h.__webglCustomAttributes)b[n]>=
|
|
|
0&&(f=h.__webglCustomAttributes[n],o.bindBuffer(o.ARRAY_BUFFER,f.buffer),o.vertexAttribPointer(b[n],f.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),c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglLineBuffer),o.drawElements(o.LINES,h.__webglLineCount,
|
|
|
-o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=h.__webglFaceCount,W.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),W.info.render.calls++):
|
|
|
-m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),W.info.render.calls++)}}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,u,p,v,t,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],u=c[w+4],v=c[w+5],n=c[w+6],p=c[w+7],t=c[w+8],f=(f+m+n)/3,h=(h+u+p)/3,k=(k+v+t)/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 k(b){if(ka!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ka=b.doubleSided;if(fa!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),fa=b.flipSided}function m(b){$!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),$=b)}function n(b){X!=b&&(o.depthMask(b),X=b)}function t(b,e,c){ga!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ga=b);if(b&&(la!=e||ra!=c))o.polygonOffset(e,c),la=e,ra=c}function v(b){wa[0].set(b.n41-
|
|
|
-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);wa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);wa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);wa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);wa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);wa[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=wa[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=wa[f].x*e.n14+wa[f].y*e.n24+wa[f].z*e.n34+wa[f].w,b<=c)return!1;return!0}function u(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?u(k,c):u(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?u(o,h):u(n,h))}else(h=e)&&(h.transparent?u(o,h):u(n,h))}function y(b,e){return e.z-b.z}function A(b){var c,n,u,p=0,t,x,y,L,z=b.lights;xa||(xa=new THREE.PerspectiveCamera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=z.length;c<n;c++)if(u=z[c],u instanceof THREE.SpotLight&&u.castShadow){Z=-1;W.shadowMap[p]||(W.shadowMap[p]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,
|
|
|
-{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[p]||(pa[p]=new THREE.Matrix4);t=W.shadowMap[p];x=pa[p];xa.position.copy(u.position);xa.lookAt(u.target.position);xa.update(void 0,!0);b.update(void 0,!1,xa);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(xa.projectionMatrix);x.multiplySelf(xa.matrixWorldInverse);xa.matrixWorldInverse.flattenToArray(Aa);xa.projectionMatrix.flattenToArray(Ea);ta.multiply(xa.projectionMatrix,xa.matrixWorldInverse);
|
|
|
-v(ta);W.initWebGLObjects(b);da(t);o.clearColor(1,1,1,1);W.clear();o.clearColor(ha.r,ha.g,ha.b,ja);x=b.__webglObjects.length;u=b.__webglObjectsImmediate.length;for(t=0;t<x;t++)y=b.__webglObjects[t],L=y.object,L.visible&&L.castShadow?!(L instanceof THREE.Mesh)||!L.frustumCulled||w(L)?(L.matrixWorld.flattenToArray(L._objectMatrixArray),E(L,xa,!1),y.render=!0):y.render=!1:y.render=!1;m(!0);K(THREE.NormalBlending);for(t=0;t<x;t++)if(y=b.__webglObjects[t],y.render)L=y.object,buffer=y.buffer,k(L),y=L.customDepthMaterial?
|
|
|
-L.customDepthMaterial:L.geometry.morphTargets.length?Ka:Da,f(xa,z,null,y,buffer,L);for(t=0;t<u;t++)y=b.__webglObjectsImmediate[t],L=y.object,L.visible&&L.castShadow&&(L.matrixAutoUpdate&&L.matrixWorld.flattenToArray(L._objectMatrixArray),E(L,xa,!1),k(L),program=e(xa,z,null,Da,L),L.immediateRenderCallback?L.immediateRenderCallback(program,o,wa):L.render(function(b){h(b,program,Da.shading)}));p++}}function z(b,e){var c,f,h;c=V.attributes;var k=V.uniforms,m=qa/oa,n,u=[],p=oa*0.5,t=qa*0.5,v=!0;o.useProgram(V.program);
|
|
|
-Q=V.program;ia=$=ca=-1;Ja||(o.enableVertexAttribArray(V.attributes.position),o.enableVertexAttribArray(V.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,V.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,V.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);c=0;for(f=b.__webglSprites.length;c<
|
|
|
-f;c++)if(h=b.__webglSprites[c],h.visible&&h.opacity!=0)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.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(h.position.x-p)/p,(t-h.position.y)/
|
|
|
-t,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?qa:1),u[0]=n*m*h.scale.x,u[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.uniform3f(k.color,h.color.r,h.color.g,
|
|
|
-h.color.b),o.uniform1f(k.rotation,h.rotation),o.uniform2fv(k.scale,u),h.mergeWith3D&&!v?(o.enable(o.DEPTH_TEST),v=!0):!h.mergeWith3D&&v&&(o.disable(o.DEPTH_TEST),v=!1),K(h.blending),B(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(X)}function E(b,e,c){b._modelViewMatrix.multiplyToArray(e.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
-function F(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 D(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,u,p={},t=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}),u=p[o].hash+"_"+p[o].counter,b.geometryGroups[u]==void 0&&(b.geometryGroups[u]={faces:[],materials:n,vertices:0,numMorphTargets:t}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[u].vertices+m>65535&&(p[o].counter+=1,u=p[o].hash+"_"+p[o].counter,b.geometryGroups[u]==void 0&&(b.geometryGroups[u]={faces:[],
|
|
|
-materials:n,vertices:0,numMorphTargets:t})),b.geometryGroups[u].faces.push(h),b.geometryGroups[u].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=aa++,b.geometryGroupsList.push(b.geometryGroups[v])}function O(b,e,c){b.push({buffer:e,object:c,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=ca){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)}ca=b}}function G(b,e,c){(c.width&c.width-1)==0&&(c.height&c.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,Y(e.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,Y(e.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Y(e.magFilter)),
|
|
|
-o.texParameteri(b,o.TEXTURE_MIN_FILTER,Y(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,S(e.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,S(e.minFilter)))}function B(b,e){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.info.memory.textures++;o.activeTexture(o.TEXTURE0+e);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof
|
|
|
-THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Y(b.format),b.image.width,b.image.height,0,Y(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);G(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+e),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function da(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();b.__webglTexture=o.createTexture();if(e){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);G(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var c=0;c<6;c++)b.__webglFramebuffer[c]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Y(b.format),b.width,b.height,0,Y(b.format),Y(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),G(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,Y(b.format),
|
|
|
-b.width,b.height,0,Y(b.format),Y(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(e)for(c=0;c<6;++c)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[c]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,
|
|
|
-o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);e?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,
|
|
|
-null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(e=e?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,c=b.width,b=b.height,h=f=0):(e=null,c=oa,b=qa,f=na,h=P);e!=ma&&(o.bindFramebuffer(o.FRAMEBUFFER,e),o.viewport(f,h,c,b),ma=e)}function J(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),
|
|
|
-o.bindTexture(o.TEXTURE_2D,null))}function R(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 S(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Y(b){switch(b){case THREE.RepeatWrapping:return o.REPEAT;
|
|
|
+o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,h.__webglFaceBuffer),o.drawElements(o.TRIANGLES,h.__webglFaceCount,o.UNSIGNED_SHORT,0)),V.info.render.calls++,V.info.render.vertices+=h.__webglFaceCount,V.info.render.faces+=h.__webglFaceCount/3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(k.linewidth),o.drawArrays(m,0,h.__webglLineCount),V.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,h.__webglParticleCount),V.info.render.calls++):
|
|
|
+m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,h.__webglVertexCount),V.info.render.calls++)}}function h(b,c,e){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(c.attributes.position),o.vertexAttribPointer(c.attributes.position,3,o.FLOAT,!1,0,0));if(b.hasNormal){o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
+b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,h,k,m,n,t,p,u,v,w,x=b.count*3;for(w=0;w<x;w+=9)e=b.normalArray,f=e[w],h=e[w+1],k=e[w+2],m=e[w+3],t=e[w+4],u=e[w+5],n=e[w+6],p=e[w+7],v=e[w+8],f=(f+m+n)/3,h=(h+t+p)/3,k=(k+u+v)/3,e[w]=f,e[w+1]=h,e[w+2]=k,e[w+3]=f,e[w+4]=h,e[w+5]=k,e[w+6]=f,e[w+7]=h,e[w+8]=k}o.bufferData(o.ARRAY_BUFFER,b.normalArray,o.DYNAMIC_DRAW);o.enableVertexAttribArray(c.attributes.normal);o.vertexAttribPointer(c.attributes.normal,3,o.FLOAT,!1,0,0)}o.drawArrays(o.TRIANGLES,
|
|
|
+0,b.count);b.count=0}function k(b){if(ka!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ka=b.doubleSided;if(fa!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),fa=b.flipSided}function m(b){$!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),$=b)}function n(b){W!=b&&(o.depthMask(b),W=b)}function p(b,c,e){ga!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),ga=b);if(b&&(la!=c||ra!=e))o.polygonOffset(c,e),la=c,ra=e}function u(b){wa[0].set(b.n41-
|
|
|
+b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);wa[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);wa[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);wa[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);wa[4].set(b.n41-b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);wa[5].set(b.n41+b.n31,b.n42+b.n32,b.n43+b.n33,b.n44+b.n34);for(var c,b=0;b<6;b++)c=wa[b],c.divideScalar(Math.sqrt(c.x*c.x+c.y*c.y+c.z*c.z))}function w(b){for(var c=b.matrixWorld,e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,
|
|
|
+Math.max(b.scale.y,b.scale.z)),f=0;f<6;f++)if(b=wa[f].x*c.n14+wa[f].y*c.n24+wa[f].z*c.n34+wa[f].w,b<=e)return!1;return!0}function t(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,h=b.opaque,k=b.transparent;k.count=0;b=h.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?t(k,e):t(h,e)}function v(b){var c,e,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(c=k.materials[b],c instanceof THREE.MeshFaceMaterial){c=
|
|
|
+0;for(e=m.materials.length;c<e;c++)(h=m.materials[c])&&(h.transparent?t(o,h):t(n,h))}else(h=c)&&(h.transparent?t(o,h):t(n,h))}function A(b,c){return c.z-b.z}function z(b){var c,n,t,p=0,v,x,y,z,A=b.lights;xa||(xa=new THREE.PerspectiveCamera(V.shadowCameraFov,V.shadowMapWidth/V.shadowMapHeight,V.shadowCameraNear,V.shadowCameraFar));c=0;for(n=A.length;c<n;c++)if(t=A[c],t instanceof THREE.SpotLight&&t.castShadow){Z=-1;V.shadowMap[p]||(V.shadowMap[p]=new THREE.WebGLRenderTarget(V.shadowMapWidth,V.shadowMapHeight,
|
|
|
+{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[p]||(pa[p]=new THREE.Matrix4);v=V.shadowMap[p];x=pa[p];xa.position.copy(t.position);xa.lookAt(t.target.position);xa.update(void 0,!0);b.update(void 0,!1,xa);x.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);x.multiplySelf(xa.projectionMatrix);x.multiplySelf(xa.matrixWorldInverse);xa.matrixWorldInverse.flattenToArray(Aa);xa.projectionMatrix.flattenToArray(Ea);ta.multiply(xa.projectionMatrix,xa.matrixWorldInverse);
|
|
|
+u(ta);V.initWebGLObjects(b);da(v);o.clearColor(1,1,1,1);V.clear();o.clearColor(ha.r,ha.g,ha.b,ja);x=b.__webglObjects.length;t=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)y=b.__webglObjects[v],z=y.object,z.visible&&z.castShadow?!(z instanceof THREE.Mesh)||!z.frustumCulled||w(z)?(z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,xa,!1),y.render=!0):y.render=!1:y.render=!1;m(!0);K(THREE.NormalBlending);for(v=0;v<x;v++)if(y=b.__webglObjects[v],y.render)z=y.object,buffer=y.buffer,k(z),y=z.customDepthMaterial?
|
|
|
+z.customDepthMaterial:z.geometry.morphTargets.length?Ka:Da,f(xa,A,null,y,buffer,z);for(v=0;v<t;v++)y=b.__webglObjectsImmediate[v],z=y.object,z.visible&&z.castShadow&&(z.matrixAutoUpdate&&z.matrixWorld.flattenToArray(z._objectMatrixArray),E(z,xa,!1),k(z),program=e(xa,A,null,Da,z),z.immediateRenderCallback?z.immediateRenderCallback(program,o,wa):z.render(function(b){h(b,program,Da.shading)}));p++}}function y(b,c){var e,f,h;e=U.attributes;var k=U.uniforms,m=qa/oa,n,t=[],p=oa*0.5,u=qa*0.5,v=!0;o.useProgram(U.program);
|
|
|
+P=U.program;ia=$=ca=-1;Ja||(o.enableVertexAttribArray(U.attributes.position),o.enableVertexAttribArray(U.attributes.uv),Ja=!0);o.disable(o.CULL_FACE);o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,U.vertexBuffer);o.vertexAttribPointer(e.position,2,o.FLOAT,!1,16,0);o.vertexAttribPointer(e.uv,2,o.FLOAT,!1,16,8);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,U.elementBuffer);o.uniformMatrix4fv(k.projectionMatrix,!1,Ea);o.activeTexture(o.TEXTURE0);o.uniform1i(k.map,0);e=0;for(f=b.__webglSprites.length;e<
|
|
|
+f;e++)if(h=b.__webglSprites[e],h.visible&&h.opacity!=0)h.useScreenCoordinates?h.z=-h.position.z:(h._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,h.matrixWorld,h._modelViewMatrixArray),h.z=-h._modelViewMatrix.n34);b.__webglSprites.sort(A);e=0;for(f=b.__webglSprites.length;e<f;e++)h=b.__webglSprites[e],h.visible&&h.opacity!=0&&h.map&&h.map.image&&h.map.image.width&&(h.useScreenCoordinates?(o.uniform1i(k.useScreenCoordinates,1),o.uniform3f(k.screenPosition,(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?qa: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.uniform3f(k.color,h.color.r,h.color.g,
|
|
|
+h.color.b),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),K(h.blending),B(h.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(W)}function E(b,c,e){b._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,b.matrixWorld,b._modelViewMatrixArray);e&&THREE.Matrix4.makeInvert3x3(b._modelViewMatrix).transposeIntoArray(b._normalMatrixArray)}
|
|
|
+function F(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function D(b){var c,e,f,h;h=b.__materials;b=0;for(e=h.length;b<e;b++)if(f=h[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function H(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function L(b){function c(b){var h=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?h.push("undefined"):h.push(b[e].id);return h.join("_")}
|
|
|
+var e,f,h,k,m,n,o,t,p={},v=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=c(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:v}),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:v})),b.geometryGroups[t].faces.push(h),b.geometryGroups[t].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=aa++,b.geometryGroupsList.push(b.geometryGroups[u])}function M(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=ca){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)}ca=b}}function G(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(o.texParameteri(b,o.TEXTURE_WRAP_S,Y(c.wrapS)),o.texParameteri(b,o.TEXTURE_WRAP_T,Y(c.wrapT)),o.texParameteri(b,o.TEXTURE_MAG_FILTER,Y(c.magFilter)),
|
|
|
+o.texParameteri(b,o.TEXTURE_MIN_FILTER,Y(c.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,R(c.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,R(c.minFilter)))}function B(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),V.info.memory.textures++;o.activeTexture(o.TEXTURE0+c);o.bindTexture(o.TEXTURE_2D,b.__webglTexture);b instanceof
|
|
|
+THREE.DataTexture?o.texImage2D(o.TEXTURE_2D,0,Y(b.format),b.image.width,b.image.height,0,Y(b.format),o.UNSIGNED_BYTE,b.image.data):o.texImage2D(o.TEXTURE_2D,0,o.RGBA,o.RGBA,o.UNSIGNED_BYTE,b.image);G(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+c),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function da(b){var c=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();b.__webglTexture=o.createTexture();if(c){o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture);G(o.TEXTURE_CUBE_MAP,b,b);b.__webglFramebuffer=[];for(var e=0;e<6;e++)b.__webglFramebuffer[e]=o.createFramebuffer(),o.texImage2D(o.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,Y(b.format),b.width,b.height,0,Y(b.format),Y(b.type),null)}else b.__webglFramebuffer=o.createFramebuffer(),o.bindTexture(o.TEXTURE_2D,b.__webglTexture),G(o.TEXTURE_2D,b,b),o.texImage2D(o.TEXTURE_2D,0,Y(b.format),
|
|
|
+b.width,b.height,0,Y(b.format),Y(b.type),null);o.bindRenderbuffer(o.RENDERBUFFER,b.__webglRenderbuffer);if(c)for(e=0;e<6;++e)o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer[e]),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_CUBE_MAP_POSITIVE_X+e,b.__webglTexture,0);else o.bindFramebuffer(o.FRAMEBUFFER,b.__webglFramebuffer),o.framebufferTexture2D(o.FRAMEBUFFER,o.COLOR_ATTACHMENT0,o.TEXTURE_2D,b.__webglTexture,0);b.depthBuffer&&!b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,
|
|
|
+o.DEPTH_COMPONENT16,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):b.depthBuffer&&b.stencilBuffer?(o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,b.width,b.height),o.framebufferRenderbuffer(o.FRAMEBUFFER,o.DEPTH_STENCIL_ATTACHMENT,o.RENDERBUFFER,b.__webglRenderbuffer)):o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,b.width,b.height);c?o.bindTexture(o.TEXTURE_CUBE_MAP,null):o.bindTexture(o.TEXTURE_2D,null);o.bindRenderbuffer(o.RENDERBUFFER,
|
|
|
+null);o.bindFramebuffer(o.FRAMEBUFFER,null)}var f,h;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height,h=f=0):(c=null,e=oa,b=qa,f=na,h=O);c!=ma&&(o.bindFramebuffer(o.FRAMEBUFFER,c),o.viewport(f,h,e,b),ma=c)}function J(b){b instanceof THREE.WebGLRenderTargetCube?(o.bindTexture(o.TEXTURE_CUBE_MAP,b.__webglTexture),o.generateMipmap(o.TEXTURE_CUBE_MAP),o.bindTexture(o.TEXTURE_CUBE_MAP,null)):(o.bindTexture(o.TEXTURE_2D,b.__webglTexture),o.generateMipmap(o.TEXTURE_2D),
|
|
|
+o.bindTexture(o.TEXTURE_2D,null))}function Q(b,c){var e;b=="fragment"?e=o.createShader(o.FRAGMENT_SHADER):b=="vertex"&&(e=o.createShader(o.VERTEX_SHADER));o.shaderSource(e,c);o.compileShader(e);if(!o.getShaderParameter(e,o.COMPILE_STATUS))return console.error(o.getShaderInfoLog(e)),console.error(c),null;return e}function R(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return o.NEAREST;default:return o.LINEAR}}function Y(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 W=this,o,ea=[],Q=null,
|
|
|
-ma=null,Z=-1,ia=null,aa=0,ka=null,fa=null,ca=null,$=null,X=null,ga=null,la=null,ra=null,na=0,P=0,oa=0,qa=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ea=new Float32Array(16),Aa=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},L=b.canvas!==void 0?b.canvas:document.createElement("canvas"),U=
|
|
|
-b.stencil!==void 0?b.stencil:!0,M=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ua=b.antialias!==void 0?b.antialias:!1,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ja=b.clearAlpha!==void 0?b.clearAlpha:0,ya=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=L;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=
|
|
|
+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 V=this,o,ea=[],P=null,
|
|
|
+ma=null,Z=-1,ia=null,aa=0,ka=null,fa=null,ca=null,$=null,W=null,ga=null,la=null,ra=null,na=0,O=0,oa=0,qa=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ta=new THREE.Matrix4,Ea=new Float32Array(16),Aa=new Float32Array(16),Ca=new THREE.Vector4,Fa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},X=b.canvas!==void 0?b.canvas:document.createElement("canvas"),T=
|
|
|
+b.stencil!==void 0?b.stencil:!0,N=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ua=b.antialias!==void 0?b.antialias:!1,ha=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ja=b.clearAlpha!==void 0?b.clearAlpha:0,ya=b.maxLights!==void 0?b.maxLights:4;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};this.maxMorphTargets=8;this.domElement=X;this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=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 xa,pa=[],b=THREE.ShaderLib.depthRGBA,Ia=THREE.UniformsUtils.clone(b.uniforms),Da=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia}),Ka=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,
|
|
|
-uniforms:Ia,morphTargets:!0});Da._shadowPass=!0;Ka._shadowPass=!0;try{if(!(o=L.getContext("experimental-webgl",{antialias:ua,stencil:U,preserveDrawingBuffer:M})))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(Ba){console.error(Ba)}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(ha.r,ha.g,ha.b,ja);this.context=o;var Ga=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,V={};V.vertices=new Float32Array(16);V.faces=new Uint16Array(6);U=0;V.vertices[U++]=-1;V.vertices[U++]=-1;V.vertices[U++]=0;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=-1;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=1;V.vertices[U++]=
|
|
|
-1;V.vertices[U++]=1;V.vertices[U++]=0;V.vertices[U++]=-1;V.vertices[U++]=1;V.vertices[U++]=0;U=V.vertices[U++]=0;V.faces[U++]=0;V.faces[U++]=1;V.faces[U++]=2;V.faces[U++]=0;V.faces[U++]=2;V.faces[U++]=3;V.vertexBuffer=o.createBuffer();V.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,V.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,V.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,V.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,V.faces,o.STATIC_DRAW);V.program=o.createProgram();
|
|
|
-o.attachShader(V.program,R("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(V.program,R("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(V.program);V.attributes={};V.uniforms={};V.attributes.position=o.getAttribLocation(V.program,"position");V.attributes.uv=o.getAttribLocation(V.program,"uv");V.uniforms.uvOffset=o.getUniformLocation(V.program,"uvOffset");V.uniforms.uvScale=o.getUniformLocation(V.program,"uvScale");V.uniforms.rotation=o.getUniformLocation(V.program,"rotation");
|
|
|
-V.uniforms.scale=o.getUniformLocation(V.program,"scale");V.uniforms.alignment=o.getUniformLocation(V.program,"alignment");V.uniforms.color=o.getUniformLocation(V.program,"color");V.uniforms.map=o.getUniformLocation(V.program,"map");V.uniforms.opacity=o.getUniformLocation(V.program,"opacity");V.uniforms.useScreenCoordinates=o.getUniformLocation(V.program,"useScreenCoordinates");V.uniforms.affectedByDistance=o.getUniformLocation(V.program,"affectedByDistance");V.uniforms.screenPosition=o.getUniformLocation(V.program,
|
|
|
-"screenPosition");V.uniforms.modelViewMatrix=o.getUniformLocation(V.program,"modelViewMatrix");V.uniforms.projectionMatrix=o.getUniformLocation(V.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,e){L.width=b;L.height=e;this.setViewport(0,0,L.width,L.height)};this.setViewport=function(b,e,c,f){na=b;P=e;oa=c;qa=f;o.viewport(na,P,oa,qa)};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){ha.setHex(b);ja=e;o.clearColor(ha.r,ha.g,ha.b,ja)};this.setClearColor=function(b,e){ha.copy(b);ja=e;o.clearColor(ha.r,ha.g,ha.b,ja)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return ja};this.clear=function(b,e,c){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(e==void 0||e)f|=o.DEPTH_BUFFER_BIT;if(c==void 0||c)f|=o.STENCIL_BUFFER_BIT;o.clear(f)};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]);W.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
|
|
|
-W.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),W.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),W.info.memory.textures--};this.initMaterial=function(b,e,c,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
|
|
|
-b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var u=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(u.uniforms);b.vertexShader=u.vertexShader;b.fragmentShader=u.fragmentShader}var p,t,v;p=v=u=0;for(t=e.length;p<t;p++)m=e[p],m instanceof THREE.SpotLight&&v++,m instanceof THREE.DirectionalLight&&v++,m instanceof THREE.PointLight&&
|
|
|
-u++;u+v<=ya?p=v:(p=Math.ceil(ya*v/(u+v)),u=ya-p);m={directional:p,point:u};u=v=0;for(p=e.length;u<p;u++)t=e[u],t instanceof THREE.SpotLight&&t.castShadow&&v++;var w=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)w=f.bones.length;var x;a:{p=b.fragmentShader;t=b.vertexShader;var u=b.uniforms,e=b.attributes,c={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:c,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
|
-maxDirLights:m.directional,maxPointLights:m.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:v,alphaTest:b.alphaTest},y,f=[];n?f.push(n):(f.push(p),f.push(t));for(y in c)f.push(y),f.push(c[y]);n=f.join();y=0;for(f=ea.length;y<f;y++)if(ea[y].code==n){x=ea[y].program;break a}y=o.createProgram();f=[Ga?"#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");
|
|
|
-m=["#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.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.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(y,R("fragment",m+p));o.attachShader(y,R("vertex",f+t));o.linkProgram(y);o.getProgramParameter(y,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(y,o.VALIDATE_STATUS)+", gl error ["+
|
|
|
-o.getError()+"]");y.uniforms={};y.attributes={};var L,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(L in u)f.push(L);L=f;f=0;for(u=L.length;f<u;f++)p=L[f],y.uniforms[p]=o.getUniformLocation(y,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(L=0;L<c.maxMorphTargets;L++)f.push("morphTarget"+L);for(x in e)f.push(x);
|
|
|
-x=f;L=0;for(e=x.length;L<e;L++)c=x[L],y.attributes[c]=o.getAttribLocation(y,c);y.id=ea.length;ea.push({program:y,code:n});W.info.memory.programs=ea.length;x=y}b.program=x;x=b.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);x.tangent>=0&&o.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),
|
|
|
-o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)L="morphTarget"+k,x[L]>=0&&(o.enableVertexAttribArray(x[L]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,e,c,f){da(b);
|
|
|
-this.clear(e,c,f)};this.render=function(b,c,u,L){var M,U,F,D,H,na,B,G,ua=b.lights,N=b.fog;Z=-1;this.shadowMapEnabled&&A(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);v(ta);this.initWebGLObjects(b);da(u);(this.autoClear||L)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
-H=b.__webglObjects.length;for(L=0;L<H;L++)if(M=b.__webglObjects[L],B=M.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),p(M),M.render=!0,this.sortObjects)M.object.renderDepth?M.z=M.object.renderDepth:(Ca.copy(B.position),ta.multiplyVector3(Ca),M.z=Ca.z)}else M.render=!1;else M.render=!1;this.sortObjects&&b.__webglObjects.sort(y);na=b.__webglObjectsImmediate.length;for(L=0;L<na;L++)M=b.__webglObjectsImmediate[L],
|
|
|
-B=M.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),x(M));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(L=0;L<H;L++)if(M=b.__webglObjects[L],M.render)B=M.object,G=M.buffer,k(B),f(c,ua,N,b.overrideMaterial,G,B);for(L=0;L<na;L++)M=b.__webglObjectsImmediate[L],B=M.object,B.visible&&(k(B),U=e(c,ua,N,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,wa):B.render(function(b){h(b,U,
|
|
|
-Da.shading)}))}else{K(THREE.NormalBlending);for(L=H-1;L>=0;L--)if(M=b.__webglObjects[L],M.render){B=M.object;G=M.buffer;F=M.opaque;k(B);for(M=0;M<F.count;M++)D=F.list[M],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,N,D,G,B)}for(L=0;L<na;L++)if(M=b.__webglObjectsImmediate[L],B=M.object,B.visible){F=M.opaque;k(B);for(M=0;M<F.count;M++)D=F.list[M],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),U=e(c,
|
|
|
-ua,N,D,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,wa):B.render(function(b){h(b,U,Da.shading)})}for(L=0;L<H;L++)if(M=b.__webglObjects[L],M.render){B=M.object;G=M.buffer;F=M.transparent;k(B);for(M=0;M<F.count;M++)D=F.list[M],K(D.blending),m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,N,D,G,B)}for(L=0;L<na;L++)if(M=b.__webglObjectsImmediate[L],B=M.object,B.visible){F=M.transparent;k(B);for(M=0;M<F.count;M++)D=F.list[M],K(D.blending),
|
|
|
-m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),U=e(c,ua,N,D,B),B.immediateRenderCallback?B.immediateRenderCallback(U,o,wa):B.render(function(b){h(b,U,Da.shading)})}}b.__webglSprites.length&&z(b,c);u&&u.minFilter!==THREE.NearestFilter&&u.minFilter!==THREE.LinearFilter&&J(u)};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){if(m=k.geometryGroups[h],!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 u=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];u=0;for(p=n.numMorphTargets;u<
|
|
|
-p;u++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,t=void 0,v=void 0,x=void 0,w=x=void 0,L=void 0,y=void 0,M=y=u=0,z=x=v=void 0,x=p=z=v=t=void 0,w=n.geometry,L=w.faces,z=m.faces,t=0,v=z.length;t<v;t++)x=z[t],x=L[x],x instanceof THREE.Face3?(u+=3,y+=1,M+=3):x instanceof THREE.Face4&&(u+=4,y+=2,M+=4);for(var t=m,v=n,A=z=L=void 0,U=void 0,A=void 0,x=[],L=0,z=v.materials.length;L<z;L++)if(A=v.materials[L],A instanceof THREE.MeshFaceMaterial){A=0;for(l=t.materials.length;A<
|
|
|
-l;A++)(U=t.materials[A])&&x.push(U)}else(U=A)&&x.push(U);t=x;m.__materials=t;a:{L=v=void 0;z=t.length;for(v=0;v<z;v++)if(L=t[v],L.map||L.lightMap||L instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{z=L=void 0;x=t.length;for(L=0;L<x;L++)if(z=t[L],!(z instanceof THREE.MeshBasicMaterial&&!z.envMap||z instanceof THREE.MeshDepthMaterial)){z=z&&z.shading!=void 0&&z.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}z=!1}a:{x=L=void 0;A=t.length;for(L=0;L<A;L++)if(x=t[L],x.vertexColors){x=
|
|
|
-x.vertexColors;break a}x=!1}m.__vertexArray=new Float32Array(u*3);if(z)m.__normalArray=new Float32Array(u*3);if(w.hasTangents)m.__tangentArray=new Float32Array(u*4);if(x)m.__colorArray=new Float32Array(u*3);if(v){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(u*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(u*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(u*4),m.__skinVertexBArray=
|
|
|
-new Float32Array(u*4),m.__skinIndexArray=new Float32Array(u*4),m.__skinWeightArray=new Float32Array(u*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(M*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(L=m.numMorphTargets;w<L;w++)m.__morphTargetsArrays.push(new Float32Array(u*3))}m.__needsSmoothNormals=z==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=x;m.__normalType=z;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?
|
|
|
-n.geometry.edgeFaces.length*6:0);m.__webglLineCount=M*2;w=0;for(L=t.length;w<L;w++)if(v=t[w],v.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in v.attributes){x=v.attributes[a];z={};for(p in x)z[p]=x[p];if(!z.__webglInitialized||z.createUniqueBuffers)z.__webglInitialized=!0,y=1,z.type==="v2"?y=2:z.type==="v3"?y=3:z.type==="v4"?y=4:z.type==="c"&&(y=3),z.size=y,z.array=new Float32Array(u*y),z.buffer=o.createBuffer(),z.buffer.belongsToAttribute=a,x.needsUpdate=!0,
|
|
|
-z.__original=x;m.__webglCustomAttributes[a]=z}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=
|
|
|
-n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();
|
|
|
-m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=k;n=e;u=m.vertices.length;m.__vertexArray=new Float32Array(u*3);m.__colorArray=new Float32Array(u*3);m.__sortArray=[];m.__webglParticleCount=u;m.__materials=n.materials;M=y=p=void 0;p=0;for(y=n.materials.length;p<y;p++)if(M=n.materials[p],M.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in M.attributes){originalAttribute=M.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(u*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=
|
|
|
-!0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)m=k.geometryGroups[h],O(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,O(f.__webglObjects,k,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);
|
|
|
+uniforms:Ia,morphTargets:!0});Da._shadowPass=!0;Ka._shadowPass=!0;try{if(!(o=X.getContext("experimental-webgl",{antialias:ua,stencil:T,preserveDrawingBuffer:N})))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(Ba){console.error(Ba)}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(ha.r,ha.g,ha.b,ja);this.context=o;var Ga=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,U={};U.vertices=new Float32Array(16);U.faces=new Uint16Array(6);T=0;U.vertices[T++]=-1;U.vertices[T++]=-1;U.vertices[T++]=0;U.vertices[T++]=1;U.vertices[T++]=1;U.vertices[T++]=-1;U.vertices[T++]=1;U.vertices[T++]=1;U.vertices[T++]=1;U.vertices[T++]=
|
|
|
+1;U.vertices[T++]=1;U.vertices[T++]=0;U.vertices[T++]=-1;U.vertices[T++]=1;U.vertices[T++]=0;T=U.vertices[T++]=0;U.faces[T++]=0;U.faces[T++]=1;U.faces[T++]=2;U.faces[T++]=0;U.faces[T++]=2;U.faces[T++]=3;U.vertexBuffer=o.createBuffer();U.elementBuffer=o.createBuffer();o.bindBuffer(o.ARRAY_BUFFER,U.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,U.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,U.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,U.faces,o.STATIC_DRAW);U.program=o.createProgram();
|
|
|
+o.attachShader(U.program,Q("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(U.program,Q("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(U.program);U.attributes={};U.uniforms={};U.attributes.position=o.getAttribLocation(U.program,"position");U.attributes.uv=o.getAttribLocation(U.program,"uv");U.uniforms.uvOffset=o.getUniformLocation(U.program,"uvOffset");U.uniforms.uvScale=o.getUniformLocation(U.program,"uvScale");U.uniforms.rotation=o.getUniformLocation(U.program,"rotation");
|
|
|
+U.uniforms.scale=o.getUniformLocation(U.program,"scale");U.uniforms.alignment=o.getUniformLocation(U.program,"alignment");U.uniforms.color=o.getUniformLocation(U.program,"color");U.uniforms.map=o.getUniformLocation(U.program,"map");U.uniforms.opacity=o.getUniformLocation(U.program,"opacity");U.uniforms.useScreenCoordinates=o.getUniformLocation(U.program,"useScreenCoordinates");U.uniforms.affectedByDistance=o.getUniformLocation(U.program,"affectedByDistance");U.uniforms.screenPosition=o.getUniformLocation(U.program,
|
|
|
+"screenPosition");U.uniforms.modelViewMatrix=o.getUniformLocation(U.program,"modelViewMatrix");U.uniforms.projectionMatrix=o.getUniformLocation(U.program,"projectionMatrix");var Ja=!1;this.setSize=function(b,c){X.width=b;X.height=c;this.setViewport(0,0,X.width,X.height)};this.setViewport=function(b,c,e,f){na=b;O=c;oa=e;qa=f;o.viewport(na,O,oa,qa)};this.setScissor=function(b,c,e,f){o.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)};this.setClearColorHex=
|
|
|
+function(b,c){ha.setHex(b);ja=c;o.clearColor(ha.r,ha.g,ha.b,ja)};this.setClearColor=function(b,c){ha.copy(b);ja=c;o.clearColor(ha.r,ha.g,ha.b,ja)};this.getClearColor=function(){return ha};this.getClearAlpha=function(){return ja};this.clear=function(b,c,e){var f=0;if(b==void 0||b)f|=o.COLOR_BUFFER_BIT;if(c==void 0||c)f|=o.DEPTH_BUFFER_BIT;if(e==void 0||e)f|=o.STENCIL_BUFFER_BIT;o.clear(f)};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 c=b.geometry.geometryGroups[g];o.deleteBuffer(c.__webglVertexBuffer);o.deleteBuffer(c.__webglNormalBuffer);o.deleteBuffer(c.__webglTangentBuffer);o.deleteBuffer(c.__webglColorBuffer);o.deleteBuffer(c.__webglUVBuffer);o.deleteBuffer(c.__webglUV2Buffer);o.deleteBuffer(c.__webglSkinVertexABuffer);o.deleteBuffer(c.__webglSkinVertexBBuffer);o.deleteBuffer(c.__webglSkinIndicesBuffer);
|
|
|
+o.deleteBuffer(c.__webglSkinWeightsBuffer);o.deleteBuffer(c.__webglFaceBuffer);o.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=0,f=c.numMorphTargets;e<f;e++)o.deleteBuffer(c.__webglMorphTargetsBuffers[e]);V.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),V.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),
|
|
|
+V.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,o.deleteBuffer(b.__webglVertexBuffer),o.deleteBuffer(b.__webglColorBuffer),V.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,o.deleteTexture(b.__webglTexture),V.info.memory.textures--};this.initMaterial=function(b,c,e,f){var h,k,m,n;b instanceof THREE.MeshDepthMaterial?n="depth":b instanceof THREE.MeshNormalMaterial?n="normal":b instanceof THREE.MeshBasicMaterial?n="basic":
|
|
|
+b instanceof THREE.MeshLambertMaterial?n="lambert":b instanceof THREE.MeshPhongMaterial?n="phong":b instanceof THREE.LineBasicMaterial?n="basic":b instanceof THREE.ParticleBasicMaterial&&(n="particle_basic");if(n){var t=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(t.uniforms);b.vertexShader=t.vertexShader;b.fragmentShader=t.fragmentShader}var p,v,u;p=u=t=0;for(v=c.length;p<v;p++)m=c[p],m instanceof THREE.SpotLight&&u++,m instanceof THREE.DirectionalLight&&u++,m instanceof THREE.PointLight&&
|
|
|
+t++;t+u<=ya?p=u:(p=Math.ceil(ya*u/(t+u)),t=ya-p);m={directional:p,point:t};t=u=0;for(p=c.length;t<p;t++)v=c[t],v instanceof THREE.SpotLight&&v.castShadow&&u++;var w=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)w=f.bones.length;var x;a:{p=b.fragmentShader;v=b.vertexShader;var t=b.uniforms,c=b.attributes,e={map:!!b.map,envMap:!!b.envMap,lightMap:!!b.lightMap,vertexColors:b.vertexColors,fog:e,useFog:b.fog,sizeAttenuation:b.sizeAttenuation,skinning:b.skinning,morphTargets:b.morphTargets,maxMorphTargets:this.maxMorphTargets,
|
|
|
+maxDirLights:m.directional,maxPointLights:m.point,maxBones:w,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,alphaTest:b.alphaTest},z,f=[];n?f.push(n):(f.push(p),f.push(v));for(z in e)f.push(z),f.push(e[z]);n=f.join();z=0;for(f=ea.length;z<f;z++)if(ea[z].code==n){x=ea[z].program;break a}z=o.createProgram();f=[Ga?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+e.maxDirLights,
|
|
|
+"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,"#define MAX_BONES "+e.maxBones,e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+m=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+e.maxDirLights,"#define MAX_POINT_LIGHTS "+e.maxPointLights,"#define MAX_SHADOWS "+e.maxShadows,e.alphaTest?"#define ALPHATEST "+e.alphaTest:"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.lightMap?"#define USE_LIGHTMAP":"",e.vertexColors?"#define USE_COLOR":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",
|
|
|
+e.shadowMapSoft?"#define SHADOWMAP_SOFT":"",e.shadowMapSoft?"#define SHADOWMAP_WIDTH "+e.shadowMapWidth.toFixed(1):"",e.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+e.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");o.attachShader(z,Q("fragment",m+p));o.attachShader(z,Q("vertex",f+v));o.linkProgram(z);o.getProgramParameter(z,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(z,o.VALIDATE_STATUS)+", gl error ["+
|
|
|
+o.getError()+"]");z.uniforms={};z.attributes={};var y,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in t)f.push(y);y=f;f=0;for(t=y.length;f<t;f++)p=y[f],z.uniforms[p]=o.getUniformLocation(z,p);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<e.maxMorphTargets;y++)f.push("morphTarget"+y);for(x in c)f.push(x);
|
|
|
+x=f;y=0;for(c=x.length;y<c;y++)e=x[y],z.attributes[e]=o.getAttribLocation(z,e);z.id=ea.length;ea.push({program:z,code:n});V.info.memory.programs=ea.length;x=z}b.program=x;x=b.program.attributes;x.position>=0&&o.enableVertexAttribArray(x.position);x.color>=0&&o.enableVertexAttribArray(x.color);x.normal>=0&&o.enableVertexAttribArray(x.normal);x.tangent>=0&&o.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(o.enableVertexAttribArray(x.skinVertexA),
|
|
|
+o.enableVertexAttribArray(x.skinVertexB),o.enableVertexAttribArray(x.skinIndex),o.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(k in b.attributes)x[k]!==void 0&&x[k]>=0&&o.enableVertexAttribArray(x[k]);if(b.morphTargets)for(k=b.numSupportedMorphTargets=0;k<this.maxMorphTargets;k++)y="morphTarget"+k,x[y]>=0&&(o.enableVertexAttribArray(x[y]),b.numSupportedMorphTargets++);b.uniformsList=[];for(h in b.uniforms)b.uniformsList.push([b.uniforms[h],h])};this.clearTarget=function(b,c,e,f){da(b);
|
|
|
+this.clear(c,e,f)};this.render=function(b,c,t,X){var N,T,F,D,H,na,B,G,ua=b.lights,L=b.fog;Z=-1;this.shadowMapEnabled&&z(b,c);V.info.render.calls=0;V.info.render.vertices=0;V.info.render.faces=0;c.matrixAutoUpdate&&c.update(void 0,!0);b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Aa);c.projectionMatrix.flattenToArray(Ea);ta.multiply(c.projectionMatrix,c.matrixWorldInverse);u(ta);this.initWebGLObjects(b);da(t);(this.autoClear||X)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
+H=b.__webglObjects.length;for(X=0;X<H;X++)if(N=b.__webglObjects[X],B=N.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||w(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),v(N),N.render=!0,this.sortObjects)N.object.renderDepth?N.z=N.object.renderDepth:(Ca.copy(B.position),ta.multiplyVector3(Ca),N.z=Ca.z)}else N.render=!1;else N.render=!1;this.sortObjects&&b.__webglObjects.sort(A);na=b.__webglObjectsImmediate.length;for(X=0;X<na;X++)N=b.__webglObjectsImmediate[X],
|
|
|
+B=N.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),x(N));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);K(b.overrideMaterial.blending);for(X=0;X<H;X++)if(N=b.__webglObjects[X],N.render)B=N.object,G=N.buffer,k(B),f(c,ua,L,b.overrideMaterial,G,B);for(X=0;X<na;X++)N=b.__webglObjectsImmediate[X],B=N.object,B.visible&&(k(B),T=e(c,ua,L,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,wa):B.render(function(b){h(b,T,
|
|
|
+Da.shading)}))}else{K(THREE.NormalBlending);for(X=H-1;X>=0;X--)if(N=b.__webglObjects[X],N.render){B=N.object;G=N.buffer;F=N.opaque;k(B);for(N=0;N<F.count;N++)D=F.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,L,D,G,B)}for(X=0;X<na;X++)if(N=b.__webglObjectsImmediate[X],B=N.object,B.visible){F=N.opaque;k(B);for(N=0;N<F.count;N++)D=F.list[N],m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),T=e(c,
|
|
|
+ua,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,wa):B.render(function(b){h(b,T,Da.shading)})}for(X=0;X<H;X++)if(N=b.__webglObjects[X],N.render){B=N.object;G=N.buffer;F=N.transparent;k(B);for(N=0;N<F.count;N++)D=F.list[N],K(D.blending),m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,ua,L,D,G,B)}for(X=0;X<na;X++)if(N=b.__webglObjectsImmediate[X],B=N.object,B.visible){F=N.transparent;k(B);for(N=0;N<F.count;N++)D=F.list[N],K(D.blending),
|
|
|
+m(D.depthTest),n(D.depthWrite),p(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),T=e(c,ua,L,D,B),B.immediateRenderCallback?B.immediateRenderCallback(T,o,wa):B.render(function(b){h(b,T,Da.shading)})}}b.__webglSprites.length&&y(b,c);t&&t.minFilter!==THREE.NearestFilter&&t.minFilter!==THREE.LinearFilter&&J(t)};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&&L(k),k.geometryGroups){if(m=k.geometryGroups[h],!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 t=void 0,p=void 0;n.__webglMorphTargetsBuffers=[];t=0;for(p=n.numMorphTargets;t<
|
|
|
+p;t++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}V.info.memory.geometries++;for(var n=e,u=void 0,v=void 0,x=void 0,w=x=void 0,z=void 0,y=void 0,X=y=t=0,N=x=v=void 0,x=p=N=v=u=void 0,w=n.geometry,z=w.faces,N=m.faces,u=0,v=N.length;u<v;u++)x=N[u],x=z[x],x instanceof THREE.Face3?(t+=3,y+=1,X+=3):x instanceof THREE.Face4&&(t+=4,y+=2,X+=4);for(var u=m,v=n,A=N=z=void 0,T=void 0,A=void 0,x=[],z=0,N=v.materials.length;z<N;z++)if(A=v.materials[z],A instanceof THREE.MeshFaceMaterial){A=0;for(l=u.materials.length;A<
|
|
|
+l;A++)(T=u.materials[A])&&x.push(T)}else(T=A)&&x.push(T);u=x;m.__materials=u;a:{z=v=void 0;N=u.length;for(v=0;v<N;v++)if(z=u[v],z.map||z.lightMap||z instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{N=z=void 0;x=u.length;for(z=0;z<x;z++)if(N=u[z],!(N instanceof THREE.MeshBasicMaterial&&!N.envMap||N instanceof THREE.MeshDepthMaterial)){N=N&&N.shading!=void 0&&N.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}N=!1}a:{x=z=void 0;A=u.length;for(z=0;z<A;z++)if(x=u[z],x.vertexColors){x=
|
|
|
+x.vertexColors;break a}x=!1}m.__vertexArray=new Float32Array(t*3);if(N)m.__normalArray=new Float32Array(t*3);if(w.hasTangents)m.__tangentArray=new Float32Array(t*4);if(x)m.__colorArray=new Float32Array(t*3);if(v){if(w.faceUvs.length>0||w.faceVertexUvs.length>0)m.__uvArray=new Float32Array(t*2);if(w.faceUvs.length>1||w.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(t*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(t*4),m.__skinVertexBArray=
|
|
|
+new Float32Array(t*4),m.__skinIndexArray=new Float32Array(t*4),m.__skinWeightArray=new Float32Array(t*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(X*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];w=0;for(z=m.numMorphTargets;w<z;w++)m.__morphTargetsArrays.push(new Float32Array(t*3))}m.__needsSmoothNormals=N==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=x;m.__normalType=N;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?
|
|
|
+n.geometry.edgeFaces.length*6:0);m.__webglLineCount=X*2;w=0;for(z=u.length;w<z;w++)if(v=u[w],v.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in v.attributes){x=v.attributes[a];N={};for(p in x)N[p]=x[p];if(!N.__webglInitialized||N.createUniqueBuffers)N.__webglInitialized=!0,y=1,N.type==="v2"?y=2:N.type==="v3"?y=3:N.type==="v4"?y=4:N.type==="c"&&(y=3),N.size=y,N.array=new Float32Array(t*y),N.buffer=o.createBuffer(),N.buffer.belongsToAttribute=a,x.needsUpdate=!0,
|
|
|
+N.__original=x;m.__webglCustomAttributes[a]=N}}m.__inittedArrays=!0;k.__dirtyVertices=!0;k.__dirtyMorphTargets=!0;k.__dirtyElements=!0;k.__dirtyUvs=!0;k.__dirtyNormals=!0;k.__dirtyTangents=!0;k.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),V.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=
|
|
|
+n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.Line){if(k=e.geometry,!k.__webglVertexBuffer)m=k,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),V.info.memory.geometries++,m=k,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,k.__dirtyVertices=!0,k.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(k=e.geometry,!k.__webglVertexBuffer)){m=k;m.__webglVertexBuffer=o.createBuffer();
|
|
|
+m.__webglColorBuffer=o.createBuffer();V.info.geometries++;m=k;n=e;t=m.vertices.length;m.__vertexArray=new Float32Array(t*3);m.__colorArray=new Float32Array(t*3);m.__sortArray=[];m.__webglParticleCount=t;m.__materials=n.materials;X=y=p=void 0;p=0;for(y=n.materials.length;p<y;p++)if(X=n.materials[p],X.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in X.attributes){originalAttribute=X.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(t*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}k.__dirtyVertices=
|
|
|
+!0;k.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(h in k=e.geometry,k.geometryGroups)m=k.geometryGroups[h],M(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(k=e.geometry,M(f.__webglObjects,k,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);
|
|
|
e.__webglActive=!0}b.__objectsAdded.splice(0,1)}for(;b.__objectsRemoved.length;){e=b.__objectsRemoved[0];f=b;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)H(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;h=e;k=void 0;for(k=f.length-1;k>=0;k--)f[k]==h&&f.splice(k,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&H(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,
|
|
|
-1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(u=h.geometryGroupsList.length;n<u;n++)if(m=h.geometryGroupsList[n],p=F(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=m,y=o.DYNAMIC_DRAW,M=!h.dynamic,p.__inittedArrays){var E=t=w=void 0,B=void 0,na=E=void 0,G=void 0,ua=void 0,ja=void 0,J=U=A=x=z=L=v=void 0,ha=void 0,K=void 0,
|
|
|
-I=B=ja=B=ua=G=void 0,C=void 0,P=C=I=G=void 0,X=void 0,R=P=C=I=E=E=na=ja=B=P=C=I=X=P=C=I=X=P=C=I=void 0,S=0,oa=0,$=0,da=0,qa=0,Y=0,Q=0,ya=0,V=0,T=0,pa=0,P=I=0,P=void 0,ga=p.__vertexArray,xa=p.__uvArray,wa=p.__uv2Array,la=p.__normalArray,ia=p.__tangentArray,ca=p.__colorArray,aa=p.__skinVertexAArray,Z=p.__skinVertexBArray,ea=p.__skinIndexArray,fa=p.__skinWeightArray,Da=p.__morphTargetsArrays,ka=p.__webglCustomAttributes,C=void 0,ma=p.__faceArray,ra=p.__lineArray,Ia=p.__needsSmoothNormals,L=p.__vertexColorType,
|
|
|
-v=p.__uvType,z=p.__normalType,ta=k.geometry,Ea=ta.__dirtyVertices,Ba=ta.__dirtyElements,Aa=ta.__dirtyUvs,Ga=ta.__dirtyNormals,Ka=ta.__dirtyTangents,Ca=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ja=ta.vertices,cb=p.faces,fb=ta.faces,db=ta.faceVertexUvs[0],eb=ta.faceVertexUvs[1],Sa=ta.skinVerticesA,Ta=ta.skinVerticesB,Ua=ta.skinIndices,Ma=ta.skinWeights,La=ta.morphTargets;if(ka)for(R in ka)ka[R].offset=0,ka[R].offsetSrc=0;w=0;for(t=cb.length;w<t;w++)if(E=cb[w],B=fb[E],db&&(x=db[E]),eb&&(A=eb[E]),E=
|
|
|
-B.vertexNormals,na=B.normal,G=B.vertexColors,ua=B.color,ja=B.vertexTangents,B instanceof THREE.Face3){if(Ea)U=Ja[B.a].position,J=Ja[B.b].position,ha=Ja[B.c].position,ga[oa]=U.x,ga[oa+1]=U.y,ga[oa+2]=U.z,ga[oa+3]=J.x,ga[oa+4]=J.y,ga[oa+5]=J.z,ga[oa+6]=ha.x,ga[oa+7]=ha.y,ga[oa+8]=ha.z,oa+=9;if(ka)for(R in ka)if(C=ka[R],C.__original.needsUpdate)I=C.offset,P=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c]):
|
|
|
-C.boundTo==="faces"?(P=C.value[P],C.array[I]=P,C.array[I+1]=P,C.array[I+2]=P,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[P],C.array[I+1]=C.value[P+1],C.array[I+2]=C.value[P+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(U=C.value[B.a],J=C.value[B.b],ha=C.value[B.c]):C.boundTo==="faces"?(ha=J=U=P=C.value[P],C.offsetSrc++):C.boundTo==="faceVertices"&&(U=C.value[P],J=C.value[P+1],ha=C.value[P+2],C.offsetSrc+=3),C.size===2?(C.array[I]=U.x,C.array[I+1]=
|
|
|
-U.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ha.x,C.array[I+5]=ha.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[I]=U.r,C.array[I+1]=U.g,C.array[I+2]=U.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ha.r,C.array[I+7]=ha.g,C.array[I+8]=ha.b):(C.array[I]=U.x,C.array[I+1]=U.y,C.array[I+2]=U.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ha.x,C.array[I+7]=ha.y,C.array[I+8]=ha.z),C.offset+=9):(C.array[I]=U.x,C.array[I+1]=U.y,C.array[I+2]=U.z,C.array[I+3]=U.w,
|
|
|
-C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ha.x,C.array[I+9]=ha.y,C.array[I+10]=ha.z,C.array[I+11]=ha.w,C.offset+=12));if(Fa){I=0;for(C=La.length;I<C;I++)U=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ha=La[I].vertices[B.c].position,P=Da[I],P[pa]=U.x,P[pa+1]=U.y,P[pa+2]=U.z,P[pa+3]=J.x,P[pa+4]=J.y,P[pa+5]=J.z,P[pa+6]=ha.x,P[pa+7]=ha.y,P[pa+8]=ha.z;pa+=9}if(Ma.length)I=Ma[B.a],C=Ma[B.b],P=Ma[B.c],fa[T]=I.x,fa[T+1]=I.y,fa[T+2]=I.z,fa[T+3]=I.w,fa[T+
|
|
|
-4]=C.x,fa[T+5]=C.y,fa[T+6]=C.z,fa[T+7]=C.w,fa[T+8]=P.x,fa[T+9]=P.y,fa[T+10]=P.z,fa[T+11]=P.w,I=Ua[B.a],C=Ua[B.b],P=Ua[B.c],ea[T]=I.x,ea[T+1]=I.y,ea[T+2]=I.z,ea[T+3]=I.w,ea[T+4]=C.x,ea[T+5]=C.y,ea[T+6]=C.z,ea[T+7]=C.w,ea[T+8]=P.x,ea[T+9]=P.y,ea[T+10]=P.z,ea[T+11]=P.w,I=Sa[B.a],C=Sa[B.b],P=Sa[B.c],aa[T]=I.x,aa[T+1]=I.y,aa[T+2]=I.z,aa[T+3]=1,aa[T+4]=C.x,aa[T+5]=C.y,aa[T+6]=C.z,aa[T+7]=1,aa[T+8]=P.x,aa[T+9]=P.y,aa[T+10]=P.z,aa[T+11]=1,I=Ta[B.a],C=Ta[B.b],P=Ta[B.c],Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,Z[T+3]=
|
|
|
-1,Z[T+4]=C.x,Z[T+5]=C.y,Z[T+6]=C.z,Z[T+7]=1,Z[T+8]=P.x,Z[T+9]=P.y,Z[T+10]=P.z,Z[T+11]=1,T+=12;if(Ca&&L)G.length==3&&L==THREE.VertexColors?(B=G[0],I=G[1],C=G[2]):C=I=B=ua,ca[V]=B.r,ca[V+1]=B.g,ca[V+2]=B.b,ca[V+3]=I.r,ca[V+4]=I.g,ca[V+5]=I.b,ca[V+6]=C.r,ca[V+7]=C.g,ca[V+8]=C.b,V+=9;if(Ka&&ta.hasTangents)G=ja[0],ua=ja[1],B=ja[2],ia[Q]=G.x,ia[Q+1]=G.y,ia[Q+2]=G.z,ia[Q+3]=G.w,ia[Q+4]=ua.x,ia[Q+5]=ua.y,ia[Q+6]=ua.z,ia[Q+7]=ua.w,ia[Q+8]=B.x,ia[Q+9]=B.y,ia[Q+10]=B.z,ia[Q+11]=B.w,Q+=12;if(Ga&&z)if(E.length==
|
|
|
-3&&Ia)for(ja=0;ja<3;ja++)na=E[ja],la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;else for(ja=0;ja<3;ja++)la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;if(Aa&&x!==void 0&&v)for(ja=0;ja<3;ja++)E=x[ja],xa[$]=E.u,xa[$+1]=E.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<3;ja++)E=A[ja],wa[da]=E.u,wa[da+1]=E.v,da+=2;Ba&&(ma[qa]=S,ma[qa+1]=S+1,ma[qa+2]=S+2,qa+=3,ra[ya]=S,ra[ya+1]=S+1,ra[ya+2]=S,ra[ya+3]=S+2,ra[ya+4]=S+1,ra[ya+5]=S+2,ya+=6,S+=3)}else if(B instanceof THREE.Face4){if(Ea)U=Ja[B.a].position,J=Ja[B.b].position,
|
|
|
-ha=Ja[B.c].position,K=Ja[B.d].position,ga[oa]=U.x,ga[oa+1]=U.y,ga[oa+2]=U.z,ga[oa+3]=J.x,ga[oa+4]=J.y,ga[oa+5]=J.z,ga[oa+6]=ha.x,ga[oa+7]=ha.y,ga[oa+8]=ha.z,ga[oa+9]=K.x,ga[oa+10]=K.y,ga[oa+11]=K.z,oa+=12;if(ka)for(R in ka)if(C=ka[R],C.__original.needsUpdate)I=C.offset,P=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c],C.array[I+3]=C.value[B.d]):C.boundTo==="faces"?(P=C.value[P],C.array[I]=P,C.array[I+1]=
|
|
|
-P,C.array[I+2]=P,C.array[I+3]=P,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[P],C.array[I+1]=C.value[P+1],C.array[I+2]=C.value[P+2],C.array[I+3]=C.value[P+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(U=C.value[B.a],J=C.value[B.b],ha=C.value[B.c],K=C.value[B.d]):C.boundTo==="faces"?(K=ha=J=U=P=C.value[P],C.offsetSrc++):C.boundTo==="faceVertices"&&(U=C.value[P],J=C.value[P+1],ha=C.value[P+2],K=C.value[P+3],C.offsetSrc+=4),C.size===2?(C.array[I]=U.x,
|
|
|
-C.array[I+1]=U.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ha.x,C.array[I+5]=ha.y,C.array[I+6]=K.x,C.array[I+7]=K.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[I]=U.r,C.array[I+1]=U.g,C.array[I+2]=U.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ha.r,C.array[I+7]=ha.g,C.array[I+8]=ha.b,C.array[I+9]=K.r,C.array[I+10]=K.g,C.array[I+11]=K.b):(C.array[I]=U.x,C.array[I+1]=U.y,C.array[I+2]=U.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ha.x,C.array[I+7]=ha.y,
|
|
|
-C.array[I+8]=ha.z,C.array[I+9]=K.x,C.array[I+10]=K.y,C.array[I+11]=K.z),C.offset+=12):(C.array[I]=U.x,C.array[I+1]=U.y,C.array[I+2]=U.z,C.array[I+3]=U.w,C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ha.x,C.array[I+9]=ha.y,C.array[I+10]=ha.z,C.array[I+11]=ha.w,C.array[I+12]=K.x,C.array[I+13]=K.y,C.array[I+14]=K.z,C.array[I+15]=K.w,C.offset+=16));if(Fa){I=0;for(C=La.length;I<C;I++)U=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ha=La[I].vertices[B.c].position,
|
|
|
-K=La[I].vertices[B.d].position,P=Da[I],P[pa]=U.x,P[pa+1]=U.y,P[pa+2]=U.z,P[pa+3]=J.x,P[pa+4]=J.y,P[pa+5]=J.z,P[pa+6]=ha.x,P[pa+7]=ha.y,P[pa+8]=ha.z,P[pa+9]=K.x,P[pa+10]=K.y,P[pa+11]=K.z;pa+=12}if(Ma.length)I=Ma[B.a],C=Ma[B.b],P=Ma[B.c],X=Ma[B.d],fa[T]=I.x,fa[T+1]=I.y,fa[T+2]=I.z,fa[T+3]=I.w,fa[T+4]=C.x,fa[T+5]=C.y,fa[T+6]=C.z,fa[T+7]=C.w,fa[T+8]=P.x,fa[T+9]=P.y,fa[T+10]=P.z,fa[T+11]=P.w,fa[T+12]=X.x,fa[T+13]=X.y,fa[T+14]=X.z,fa[T+15]=X.w,I=Ua[B.a],C=Ua[B.b],P=Ua[B.c],X=Ua[B.d],ea[T]=I.x,ea[T+1]=I.y,
|
|
|
-ea[T+2]=I.z,ea[T+3]=I.w,ea[T+4]=C.x,ea[T+5]=C.y,ea[T+6]=C.z,ea[T+7]=C.w,ea[T+8]=P.x,ea[T+9]=P.y,ea[T+10]=P.z,ea[T+11]=P.w,ea[T+12]=X.x,ea[T+13]=X.y,ea[T+14]=X.z,ea[T+15]=X.w,I=Sa[B.a],C=Sa[B.b],P=Sa[B.c],X=Sa[B.d],aa[T]=I.x,aa[T+1]=I.y,aa[T+2]=I.z,aa[T+3]=1,aa[T+4]=C.x,aa[T+5]=C.y,aa[T+6]=C.z,aa[T+7]=1,aa[T+8]=P.x,aa[T+9]=P.y,aa[T+10]=P.z,aa[T+11]=1,aa[T+12]=X.x,aa[T+13]=X.y,aa[T+14]=X.z,aa[T+15]=1,I=Ta[B.a],C=Ta[B.b],P=Ta[B.c],B=Ta[B.d],Z[T]=I.x,Z[T+1]=I.y,Z[T+2]=I.z,Z[T+3]=1,Z[T+4]=C.x,Z[T+5]=C.y,
|
|
|
-Z[T+6]=C.z,Z[T+7]=1,Z[T+8]=P.x,Z[T+9]=P.y,Z[T+10]=P.z,Z[T+11]=1,Z[T+12]=B.x,Z[T+13]=B.y,Z[T+14]=B.z,Z[T+15]=1,T+=16;if(Ca&&L)G.length==4&&L==THREE.VertexColors?(B=G[0],I=G[1],C=G[2],G=G[3]):G=C=I=B=ua,ca[V]=B.r,ca[V+1]=B.g,ca[V+2]=B.b,ca[V+3]=I.r,ca[V+4]=I.g,ca[V+5]=I.b,ca[V+6]=C.r,ca[V+7]=C.g,ca[V+8]=C.b,ca[V+9]=G.r,ca[V+10]=G.g,ca[V+11]=G.b,V+=12;if(Ka&&ta.hasTangents)G=ja[0],ua=ja[1],B=ja[2],ja=ja[3],ia[Q]=G.x,ia[Q+1]=G.y,ia[Q+2]=G.z,ia[Q+3]=G.w,ia[Q+4]=ua.x,ia[Q+5]=ua.y,ia[Q+6]=ua.z,ia[Q+7]=ua.w,
|
|
|
-ia[Q+8]=B.x,ia[Q+9]=B.y,ia[Q+10]=B.z,ia[Q+11]=B.w,ia[Q+12]=ja.x,ia[Q+13]=ja.y,ia[Q+14]=ja.z,ia[Q+15]=ja.w,Q+=16;if(Ga&&z)if(E.length==4&&Ia)for(ja=0;ja<4;ja++)na=E[ja],la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;else for(ja=0;ja<4;ja++)la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;if(Aa&&x!==void 0&&v)for(ja=0;ja<4;ja++)E=x[ja],xa[$]=E.u,xa[$+1]=E.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<4;ja++)E=A[ja],wa[da]=E.u,wa[da+1]=E.v,da+=2;Ba&&(ma[qa]=S,ma[qa+1]=S+1,ma[qa+2]=S+3,ma[qa+3]=S+1,ma[qa+4]=S+2,ma[qa+
|
|
|
-5]=S+3,qa+=6,ra[ya]=S,ra[ya+1]=S+1,ra[ya+2]=S,ra[ya+3]=S+3,ra[ya+4]=S+1,ra[ya+5]=S+2,ra[ya+6]=S+2,ra[ya+7]=S+3,ya+=8,S+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,y));if(ka)for(R in ka)C=ka[R],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Fa){I=0;for(C=La.length;I<C;I++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[I]),o.bufferData(o.ARRAY_BUFFER,Da[I],y)}Ca&&V>0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
+1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(k=b.__webglObjects[e].object,p=m=h=void 0,k instanceof THREE.Mesh){h=k.geometry;n=0;for(t=h.geometryGroupsList.length;n<t;n++)if(m=h.geometryGroupsList[n],p=F(m),h.__dirtyVertices||h.__dirtyMorphTargets||h.__dirtyElements||h.__dirtyUvs||h.__dirtyNormals||h.__dirtyColors||h.__dirtyTangents||p)if(p=m,y=o.DYNAMIC_DRAW,X=!h.dynamic,p.__inittedArrays){var E=u=w=void 0,B=void 0,na=E=void 0,G=void 0,ua=void 0,ja=void 0,J=T=A=x=N=z=v=void 0,ha=void 0,K=void 0,
|
|
|
+I=B=ja=B=ua=G=void 0,C=void 0,O=C=I=G=void 0,W=void 0,Q=O=C=I=E=E=na=ja=B=O=C=I=W=O=C=I=W=O=C=I=void 0,R=0,oa=0,$=0,da=0,qa=0,Y=0,P=0,ya=0,U=0,S=0,pa=0,O=I=0,O=void 0,ga=p.__vertexArray,xa=p.__uvArray,wa=p.__uv2Array,la=p.__normalArray,ia=p.__tangentArray,ca=p.__colorArray,aa=p.__skinVertexAArray,Z=p.__skinVertexBArray,ea=p.__skinIndexArray,fa=p.__skinWeightArray,Da=p.__morphTargetsArrays,ka=p.__webglCustomAttributes,C=void 0,ma=p.__faceArray,ra=p.__lineArray,Ia=p.__needsSmoothNormals,z=p.__vertexColorType,
|
|
|
+v=p.__uvType,N=p.__normalType,ta=k.geometry,Ea=ta.__dirtyVertices,Ba=ta.__dirtyElements,Aa=ta.__dirtyUvs,Ga=ta.__dirtyNormals,Ka=ta.__dirtyTangents,Ca=ta.__dirtyColors,Fa=ta.__dirtyMorphTargets,Ja=ta.vertices,bb=p.faces,fb=ta.faces,cb=ta.faceVertexUvs[0],db=ta.faceVertexUvs[1],Ra=ta.skinVerticesA,Sa=ta.skinVerticesB,Ta=ta.skinIndices,Ma=ta.skinWeights,La=ta.morphTargets;if(ka)for(Q in ka)ka[Q].offset=0,ka[Q].offsetSrc=0;w=0;for(u=bb.length;w<u;w++)if(E=bb[w],B=fb[E],cb&&(x=cb[E]),db&&(A=db[E]),E=
|
|
|
+B.vertexNormals,na=B.normal,G=B.vertexColors,ua=B.color,ja=B.vertexTangents,B instanceof THREE.Face3){if(Ea)T=Ja[B.a].position,J=Ja[B.b].position,ha=Ja[B.c].position,ga[oa]=T.x,ga[oa+1]=T.y,ga[oa+2]=T.z,ga[oa+3]=J.x,ga[oa+4]=J.y,ga[oa+5]=J.z,ga[oa+6]=ha.x,ga[oa+7]=ha.y,ga[oa+8]=ha.z,oa+=9;if(ka)for(Q in ka)if(C=ka[Q],C.__original.needsUpdate)I=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c]):
|
|
|
+C.boundTo==="faces"?(O=C.value[O],C.array[I]=O,C.array[I+1]=O,C.array[I+2]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[O],C.array[I+1]=C.value[O+1],C.array[I+2]=C.value[O+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(T=C.value[B.a],J=C.value[B.b],ha=C.value[B.c]):C.boundTo==="faces"?(ha=J=T=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(T=C.value[O],J=C.value[O+1],ha=C.value[O+2],C.offsetSrc+=3),C.size===2?(C.array[I]=T.x,C.array[I+1]=
|
|
|
+T.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ha.x,C.array[I+5]=ha.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[I]=T.r,C.array[I+1]=T.g,C.array[I+2]=T.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ha.r,C.array[I+7]=ha.g,C.array[I+8]=ha.b):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ha.x,C.array[I+7]=ha.y,C.array[I+8]=ha.z),C.offset+=9):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=T.w,
|
|
|
+C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ha.x,C.array[I+9]=ha.y,C.array[I+10]=ha.z,C.array[I+11]=ha.w,C.offset+=12));if(Fa){I=0;for(C=La.length;I<C;I++)T=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ha=La[I].vertices[B.c].position,O=Da[I],O[pa]=T.x,O[pa+1]=T.y,O[pa+2]=T.z,O[pa+3]=J.x,O[pa+4]=J.y,O[pa+5]=J.z,O[pa+6]=ha.x,O[pa+7]=ha.y,O[pa+8]=ha.z;pa+=9}if(Ma.length)I=Ma[B.a],C=Ma[B.b],O=Ma[B.c],fa[S]=I.x,fa[S+1]=I.y,fa[S+2]=I.z,fa[S+3]=I.w,fa[S+
|
|
|
+4]=C.x,fa[S+5]=C.y,fa[S+6]=C.z,fa[S+7]=C.w,fa[S+8]=O.x,fa[S+9]=O.y,fa[S+10]=O.z,fa[S+11]=O.w,I=Ta[B.a],C=Ta[B.b],O=Ta[B.c],ea[S]=I.x,ea[S+1]=I.y,ea[S+2]=I.z,ea[S+3]=I.w,ea[S+4]=C.x,ea[S+5]=C.y,ea[S+6]=C.z,ea[S+7]=C.w,ea[S+8]=O.x,ea[S+9]=O.y,ea[S+10]=O.z,ea[S+11]=O.w,I=Ra[B.a],C=Ra[B.b],O=Ra[B.c],aa[S]=I.x,aa[S+1]=I.y,aa[S+2]=I.z,aa[S+3]=1,aa[S+4]=C.x,aa[S+5]=C.y,aa[S+6]=C.z,aa[S+7]=1,aa[S+8]=O.x,aa[S+9]=O.y,aa[S+10]=O.z,aa[S+11]=1,I=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Z[S]=I.x,Z[S+1]=I.y,Z[S+2]=I.z,Z[S+3]=
|
|
|
+1,Z[S+4]=C.x,Z[S+5]=C.y,Z[S+6]=C.z,Z[S+7]=1,Z[S+8]=O.x,Z[S+9]=O.y,Z[S+10]=O.z,Z[S+11]=1,S+=12;if(Ca&&z)G.length==3&&z==THREE.VertexColors?(B=G[0],I=G[1],C=G[2]):C=I=B=ua,ca[U]=B.r,ca[U+1]=B.g,ca[U+2]=B.b,ca[U+3]=I.r,ca[U+4]=I.g,ca[U+5]=I.b,ca[U+6]=C.r,ca[U+7]=C.g,ca[U+8]=C.b,U+=9;if(Ka&&ta.hasTangents)G=ja[0],ua=ja[1],B=ja[2],ia[P]=G.x,ia[P+1]=G.y,ia[P+2]=G.z,ia[P+3]=G.w,ia[P+4]=ua.x,ia[P+5]=ua.y,ia[P+6]=ua.z,ia[P+7]=ua.w,ia[P+8]=B.x,ia[P+9]=B.y,ia[P+10]=B.z,ia[P+11]=B.w,P+=12;if(Ga&&N)if(E.length==
|
|
|
+3&&Ia)for(ja=0;ja<3;ja++)na=E[ja],la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;else for(ja=0;ja<3;ja++)la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;if(Aa&&x!==void 0&&v)for(ja=0;ja<3;ja++)E=x[ja],xa[$]=E.u,xa[$+1]=E.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<3;ja++)E=A[ja],wa[da]=E.u,wa[da+1]=E.v,da+=2;Ba&&(ma[qa]=R,ma[qa+1]=R+1,ma[qa+2]=R+2,qa+=3,ra[ya]=R,ra[ya+1]=R+1,ra[ya+2]=R,ra[ya+3]=R+2,ra[ya+4]=R+1,ra[ya+5]=R+2,ya+=6,R+=3)}else if(B instanceof THREE.Face4){if(Ea)T=Ja[B.a].position,J=Ja[B.b].position,
|
|
|
+ha=Ja[B.c].position,K=Ja[B.d].position,ga[oa]=T.x,ga[oa+1]=T.y,ga[oa+2]=T.z,ga[oa+3]=J.x,ga[oa+4]=J.y,ga[oa+5]=J.z,ga[oa+6]=ha.x,ga[oa+7]=ha.y,ga[oa+8]=ha.z,ga[oa+9]=K.x,ga[oa+10]=K.y,ga[oa+11]=K.z,oa+=12;if(ka)for(Q in ka)if(C=ka[Q],C.__original.needsUpdate)I=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[I]=C.value[B.a],C.array[I+1]=C.value[B.b],C.array[I+2]=C.value[B.c],C.array[I+3]=C.value[B.d]):C.boundTo==="faces"?(O=C.value[O],C.array[I]=O,C.array[I+1]=
|
|
|
+O,C.array[I+2]=O,C.array[I+3]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[I]=C.value[O],C.array[I+1]=C.value[O+1],C.array[I+2]=C.value[O+2],C.array[I+3]=C.value[O+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(T=C.value[B.a],J=C.value[B.b],ha=C.value[B.c],K=C.value[B.d]):C.boundTo==="faces"?(K=ha=J=T=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(T=C.value[O],J=C.value[O+1],ha=C.value[O+2],K=C.value[O+3],C.offsetSrc+=4),C.size===2?(C.array[I]=T.x,
|
|
|
+C.array[I+1]=T.y,C.array[I+2]=J.x,C.array[I+3]=J.y,C.array[I+4]=ha.x,C.array[I+5]=ha.y,C.array[I+6]=K.x,C.array[I+7]=K.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[I]=T.r,C.array[I+1]=T.g,C.array[I+2]=T.b,C.array[I+3]=J.r,C.array[I+4]=J.g,C.array[I+5]=J.b,C.array[I+6]=ha.r,C.array[I+7]=ha.g,C.array[I+8]=ha.b,C.array[I+9]=K.r,C.array[I+10]=K.g,C.array[I+11]=K.b):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=J.x,C.array[I+4]=J.y,C.array[I+5]=J.z,C.array[I+6]=ha.x,C.array[I+7]=ha.y,
|
|
|
+C.array[I+8]=ha.z,C.array[I+9]=K.x,C.array[I+10]=K.y,C.array[I+11]=K.z),C.offset+=12):(C.array[I]=T.x,C.array[I+1]=T.y,C.array[I+2]=T.z,C.array[I+3]=T.w,C.array[I+4]=J.x,C.array[I+5]=J.y,C.array[I+6]=J.z,C.array[I+7]=J.w,C.array[I+8]=ha.x,C.array[I+9]=ha.y,C.array[I+10]=ha.z,C.array[I+11]=ha.w,C.array[I+12]=K.x,C.array[I+13]=K.y,C.array[I+14]=K.z,C.array[I+15]=K.w,C.offset+=16));if(Fa){I=0;for(C=La.length;I<C;I++)T=La[I].vertices[B.a].position,J=La[I].vertices[B.b].position,ha=La[I].vertices[B.c].position,
|
|
|
+K=La[I].vertices[B.d].position,O=Da[I],O[pa]=T.x,O[pa+1]=T.y,O[pa+2]=T.z,O[pa+3]=J.x,O[pa+4]=J.y,O[pa+5]=J.z,O[pa+6]=ha.x,O[pa+7]=ha.y,O[pa+8]=ha.z,O[pa+9]=K.x,O[pa+10]=K.y,O[pa+11]=K.z;pa+=12}if(Ma.length)I=Ma[B.a],C=Ma[B.b],O=Ma[B.c],W=Ma[B.d],fa[S]=I.x,fa[S+1]=I.y,fa[S+2]=I.z,fa[S+3]=I.w,fa[S+4]=C.x,fa[S+5]=C.y,fa[S+6]=C.z,fa[S+7]=C.w,fa[S+8]=O.x,fa[S+9]=O.y,fa[S+10]=O.z,fa[S+11]=O.w,fa[S+12]=W.x,fa[S+13]=W.y,fa[S+14]=W.z,fa[S+15]=W.w,I=Ta[B.a],C=Ta[B.b],O=Ta[B.c],W=Ta[B.d],ea[S]=I.x,ea[S+1]=I.y,
|
|
|
+ea[S+2]=I.z,ea[S+3]=I.w,ea[S+4]=C.x,ea[S+5]=C.y,ea[S+6]=C.z,ea[S+7]=C.w,ea[S+8]=O.x,ea[S+9]=O.y,ea[S+10]=O.z,ea[S+11]=O.w,ea[S+12]=W.x,ea[S+13]=W.y,ea[S+14]=W.z,ea[S+15]=W.w,I=Ra[B.a],C=Ra[B.b],O=Ra[B.c],W=Ra[B.d],aa[S]=I.x,aa[S+1]=I.y,aa[S+2]=I.z,aa[S+3]=1,aa[S+4]=C.x,aa[S+5]=C.y,aa[S+6]=C.z,aa[S+7]=1,aa[S+8]=O.x,aa[S+9]=O.y,aa[S+10]=O.z,aa[S+11]=1,aa[S+12]=W.x,aa[S+13]=W.y,aa[S+14]=W.z,aa[S+15]=1,I=Sa[B.a],C=Sa[B.b],O=Sa[B.c],B=Sa[B.d],Z[S]=I.x,Z[S+1]=I.y,Z[S+2]=I.z,Z[S+3]=1,Z[S+4]=C.x,Z[S+5]=C.y,
|
|
|
+Z[S+6]=C.z,Z[S+7]=1,Z[S+8]=O.x,Z[S+9]=O.y,Z[S+10]=O.z,Z[S+11]=1,Z[S+12]=B.x,Z[S+13]=B.y,Z[S+14]=B.z,Z[S+15]=1,S+=16;if(Ca&&z)G.length==4&&z==THREE.VertexColors?(B=G[0],I=G[1],C=G[2],G=G[3]):G=C=I=B=ua,ca[U]=B.r,ca[U+1]=B.g,ca[U+2]=B.b,ca[U+3]=I.r,ca[U+4]=I.g,ca[U+5]=I.b,ca[U+6]=C.r,ca[U+7]=C.g,ca[U+8]=C.b,ca[U+9]=G.r,ca[U+10]=G.g,ca[U+11]=G.b,U+=12;if(Ka&&ta.hasTangents)G=ja[0],ua=ja[1],B=ja[2],ja=ja[3],ia[P]=G.x,ia[P+1]=G.y,ia[P+2]=G.z,ia[P+3]=G.w,ia[P+4]=ua.x,ia[P+5]=ua.y,ia[P+6]=ua.z,ia[P+7]=ua.w,
|
|
|
+ia[P+8]=B.x,ia[P+9]=B.y,ia[P+10]=B.z,ia[P+11]=B.w,ia[P+12]=ja.x,ia[P+13]=ja.y,ia[P+14]=ja.z,ia[P+15]=ja.w,P+=16;if(Ga&&N)if(E.length==4&&Ia)for(ja=0;ja<4;ja++)na=E[ja],la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;else for(ja=0;ja<4;ja++)la[Y]=na.x,la[Y+1]=na.y,la[Y+2]=na.z,Y+=3;if(Aa&&x!==void 0&&v)for(ja=0;ja<4;ja++)E=x[ja],xa[$]=E.u,xa[$+1]=E.v,$+=2;if(Aa&&A!==void 0&&v)for(ja=0;ja<4;ja++)E=A[ja],wa[da]=E.u,wa[da+1]=E.v,da+=2;Ba&&(ma[qa]=R,ma[qa+1]=R+1,ma[qa+2]=R+3,ma[qa+3]=R+1,ma[qa+4]=R+2,ma[qa+
|
|
|
+5]=R+3,qa+=6,ra[ya]=R,ra[ya+1]=R+1,ra[ya+2]=R,ra[ya+3]=R+3,ra[ya+4]=R+1,ra[ya+5]=R+2,ra[ya+6]=R+2,ra[ya+7]=R+3,ya+=8,R+=4)}Ea&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,ga,y));if(ka)for(Q in ka)C=ka[Q],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Fa){I=0;for(C=La.length;I<C;I++)o.bindBuffer(o.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[I]),o.bufferData(o.ARRAY_BUFFER,Da[I],y)}Ca&&U>0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
p.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,ca,y));Ga&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,la,y));Ka&&ta.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y));Aa&&$>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,xa,y));Aa&&da>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Ba&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer),
|
|
|
-o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y));T>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,Z,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
-fa,y));M&&(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)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(k instanceof THREE.Ribbon){h=
|
|
|
-k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=M=M=void 0;t=k.vertices;u=k.colors;v=t.length;p=u.length;L=k.__vertexArray;y=k.__colorArray;z=k.__dirtyColors;if(k.__dirtyVertices){for(M=0;M<v;M++)w=t[M].position,n=M*3,L[n]=w.x,L[n+1]=w.y,L[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(z){for(M=0;M<p;M++)color=u[M],n=M*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
|
|
|
-y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=M=M=void 0;t=k.vertices;u=k.colors;v=t.length;p=u.length;L=k.__vertexArray;y=k.__colorArray;z=k.__dirtyColors;if(k.__dirtyVertices){for(M=0;M<v;M++)w=t[M].position,n=M*3,L[n]=w.x,L[n+1]=w.y,L[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,L,m)}if(z){for(M=0;M<p;M++)color=u[M],n=M*3,y[n]=color.r,y[n+1]=color.g,
|
|
|
+o.bufferData(o.ELEMENT_ARRAY_BUFFER,ma,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y));S>0&&(o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,aa,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,Z,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,ea,y),o.bindBuffer(o.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
+fa,y));X&&(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)}h.__dirtyVertices=!1;h.__dirtyMorphTargets=!1;h.__dirtyElements=!1;h.__dirtyUvs=!1;h.__dirtyNormals=!1;h.__dirtyTangents=!1;h.__dirtyColors=!1;D(m)}else if(k instanceof THREE.Ribbon){h=
|
|
|
+k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=X=X=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(X=0;X<v;X++)w=u[X].position,n=X*3,z[n]=w.x,z[n+1]=w.y,z[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(X=0;X<p;X++)color=t[X],n=X*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
|
|
|
+y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.Line){h=k.geometry;if(h.__dirtyVertices||h.__dirtyColors){k=h;m=o.DYNAMIC_DRAW;n=w=X=X=void 0;u=k.vertices;t=k.colors;v=u.length;p=t.length;z=k.__vertexArray;y=k.__colorArray;N=k.__dirtyColors;if(k.__dirtyVertices){for(X=0;X<v;X++)w=u[X].position,n=X*3,z[n]=w.x,z[n+1]=w.y,z[n+2]=w.z;o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,z,m)}if(N){for(X=0;X<p;X++)color=t[X],n=X*3,y[n]=color.r,y[n+1]=color.g,
|
|
|
y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,k.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}h.__dirtyVertices=!1;h.__dirtyColors=!1}else if(k instanceof THREE.ParticleSystem)h=k.geometry,p=F(h),(h.__dirtyVertices||h.__dirtyColors||k.sortParticles||p)&&c(h,o.DYNAMIC_DRAW,k),h.__dirtyVertices=!1,h.__dirtyColors=!1,D(h)};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 Ga}};
|
|
|
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:
|
|
@@ -343,19 +343,19 @@ 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,k=Math.max(Math.max(e,f),h),m=Math.min(Math.min(e,f),h);if(m==k)m=e=0;else{var n=k-m,m=n/k,e=e==k?(f-h)/n:f==k?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=m;c.v=k;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,k=c instanceof THREE.Mesh?c.geometry:c,m=b.vertices,n=k.vertices,t=b.faces,v=k.faces,w=b.faceVertexUvs[0],k=k.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 u=0,x=n.length;u<x;u++){var p=new THREE.Vertex(n[u].position.clone());e&&e.multiplyVector3(p.position);m.push(p)}u=0;for(x=v.length;u<x;u++){var p=v[u],y,A,z=p.vertexNormals,
|
|
|
-E=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);m=0;for(n=z.length;m<n;m++)A=z[m].clone(),f&&f.multiplyVector3(A),y.vertexNormals.push(A);y.color.copy(p.color);m=0;for(n=E.length;m<n;m++)A=E[m],y.vertexColors.push(A.clone());y.materials=p.materials.slice();y.centroid.copy(p.centroid);e&&e.multiplyVector3(y.centroid);t.push(y)}u=0;for(x=k.length;u<
|
|
|
-x;u++){e=k[u];f=[];m=0;for(n=e.length;m<n;m++)f.push(new THREE.UV(e[m].u,e[m].v));w.push(f)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,k=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var m=new THREE.Vertex(f[b].position.clone());c.vertices.push(m)}b=0;for(e=h.length;b<e;b++){var n=h[b],t,v,w=n.vertexNormals,u=n.vertexColors;n instanceof THREE.Face3?t=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(t=new THREE.Face4(n.a,n.b,n.c,n.d));t.normal.copy(n.normal);f=0;
|
|
|
-for(m=w.length;f<m;f++)v=w[f],t.vertexNormals.push(v.clone());t.color.copy(n.color);f=0;for(m=u.length;f<m;f++)v=u[f],t.vertexColors.push(v.clone());t.materials=n.materials.slice();t.centroid.copy(n.centroid);c.faces.push(t)}b=0;for(e=k.length;b<e;b++){h=k[b];t=[];f=0;for(m=h.length;f<m;f++)t.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(t)}return c},randomPointInTriangle:function(b,c,e){var f,h,k,m=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,k=c instanceof THREE.Mesh?c.geometry:c,m=b.vertices,n=k.vertices,p=b.faces,u=k.faces,w=b.faceVertexUvs[0],k=k.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 v=new THREE.Vertex(n[t].position.clone());e&&e.multiplyVector3(v.position);m.push(v)}t=0;for(x=u.length;t<x;t++){var v=u[t],A,z,y=v.vertexNormals,
|
|
|
+E=v.vertexColors;v instanceof THREE.Face3?A=new THREE.Face3(v.a+h,v.b+h,v.c+h):v instanceof THREE.Face4&&(A=new THREE.Face4(v.a+h,v.b+h,v.c+h,v.d+h));A.normal.copy(v.normal);f&&f.multiplyVector3(A.normal);m=0;for(n=y.length;m<n;m++)z=y[m].clone(),f&&f.multiplyVector3(z),A.vertexNormals.push(z);A.color.copy(v.color);m=0;for(n=E.length;m<n;m++)z=E[m],A.vertexColors.push(z.clone());A.materials=v.materials.slice();A.centroid.copy(v.centroid);e&&e.multiplyVector3(A.centroid);p.push(A)}t=0;for(x=k.length;t<
|
|
|
+x;t++){e=k[t];f=[];m=0;for(n=e.length;m<n;m++)f.push(new THREE.UV(e[m].u,e[m].v));w.push(f)}},clone:function(b){var c=new THREE.Geometry,e,f=b.vertices,h=b.faces,k=b.faceVertexUvs[0],b=0;for(e=f.length;b<e;b++){var m=new THREE.Vertex(f[b].position.clone());c.vertices.push(m)}b=0;for(e=h.length;b<e;b++){var n=h[b],p,u,w=n.vertexNormals,t=n.vertexColors;n instanceof THREE.Face3?p=new THREE.Face3(n.a,n.b,n.c):n instanceof THREE.Face4&&(p=new THREE.Face4(n.a,n.b,n.c,n.d));p.normal.copy(n.normal);f=0;
|
|
|
+for(m=w.length;f<m;f++)u=w[f],p.vertexNormals.push(u.clone());p.color.copy(n.color);f=0;for(m=t.length;f<m;f++)u=t[f],p.vertexColors.push(u.clone());p.materials=n.materials.slice();p.centroid.copy(n.centroid);c.faces.push(p)}b=0;for(e=k.length;b<e;b++){h=k[b];p=[];f=0;for(m=h.length;f<m;f++)p.push(new THREE.UV(h[f].u,h[f].v));c.faceVertexUvs[0].push(p)}return c},randomPointInTriangle:function(b,c,e){var f,h,k,m=new THREE.Vector3,n=THREE.GeometryUtils.__v1;f=THREE.GeometryUtils.random();h=THREE.GeometryUtils.random();
|
|
|
f+h>1&&(f=1-f,h=1-h);k=1-f-h;m.copy(b);m.multiplyScalar(f);n.copy(c);n.multiplyScalar(h);m.addSelf(n);n.copy(e);n.multiplyScalar(k);m.addSelf(n);return m},randomPointInFace:function(b,c,e){var f,h,k;if(b instanceof THREE.Face3)return f=c.vertices[b.a].position,h=c.vertices[b.b].position,k=c.vertices[b.c].position,THREE.GeometryUtils.randomPointInTriangle(f,h,k);else if(b instanceof THREE.Face4){f=c.vertices[b.a].position;h=c.vertices[b.b].position;k=c.vertices[b.c].position;var c=c.vertices[b.d].position,
|
|
|
-m;e?b._area1&&b._area2?(e=b._area1,m=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c),b._area1=e,b._area2=m):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+m)<e?THREE.GeometryUtils.randomPointInTriangle(f,h,c):THREE.GeometryUtils.randomPointInTriangle(h,k,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,k=b.faces,m=b.vertices,n=k.length,t=0,v=[],w,u,x,p;for(h=0;h<n;h++){f=k[h];if(f instanceof THREE.Face3)w=m[f.a].position,u=m[f.b].position,x=m[f.c].position,f._area=THREE.GeometryUtils.triangleArea(w,u,x);else if(f instanceof THREE.Face4)w=m[f.a].position,u=m[f.b].position,x=m[f.c].position,p=m[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(w,u,p),f._area2=THREE.GeometryUtils.triangleArea(u,x,p),f._area=f._area1+f._area2;t+=f._area;
|
|
|
-v[h]=t}f=[];m={};for(h=0;h<c;h++)n=THREE.GeometryUtils.random()*t,n=e(n),f[h]=THREE.GeometryUtils.randomPointInFace(k[n],b,!0),m[n]?m[n]+=1:m[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},center:function(b){b.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*
|
|
|
+m;e?b._area1&&b._area2?(e=b._area1,m=b._area2):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c),b._area1=e,b._area2=m):(e=THREE.GeometryUtils.triangleArea(f,h,c),m=THREE.GeometryUtils.triangleArea(h,k,c));return THREE.GeometryUtils.random()*(e+m)<e?THREE.GeometryUtils.randomPointInTriangle(f,h,c):THREE.GeometryUtils.randomPointInTriangle(h,k,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 u[h]>
|
|
|
+b?e(c,h-1):u[h]<b?e(h+1,f):h}return e(0,u.length-1)}var f,h,k=b.faces,m=b.vertices,n=k.length,p=0,u=[],w,t,x,v;for(h=0;h<n;h++){f=k[h];if(f instanceof THREE.Face3)w=m[f.a].position,t=m[f.b].position,x=m[f.c].position,f._area=THREE.GeometryUtils.triangleArea(w,t,x);else if(f instanceof THREE.Face4)w=m[f.a].position,t=m[f.b].position,x=m[f.c].position,v=m[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(w,t,v),f._area2=THREE.GeometryUtils.triangleArea(t,x,v),f._area=f._area1+f._area2;p+=f._area;
|
|
|
+u[h]=p}f=[];m={};for(h=0;h<c;h++)n=THREE.GeometryUtils.random()*p,n=e(n),f[h]=THREE.GeometryUtils.randomPointInFace(k[n],b,!0),m[n]?m[n]+=1:m[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},center:function(b){b.computeBoundingBox();var c=new THREE.Matrix4;c.setTranslation(-0.5*
|
|
|
(b.boundingBox.x[1]+b.boundingBox.x[0]),-0.5*(b.boundingBox.y[1]+b.boundingBox.y[0]),-0.5*(b.boundingBox.z[1]+b.boundingBox.z[0]));b.applyMatrix(c);b.computeBoundingBox()}};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=[],k=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)k.needsUpdate=!0;e&&e(this)},h[c].crossOrigin="",h[c].src=b[c];return k},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,k=document.createElement("canvas");k.width=f;k.height=h;var m=k.getContext("2d");m.drawImage(b,0,0);for(var n=m.getImageData(0,0,f,h).data,t=m.createImageData(f,h),v=t.data,w=0;w<f;w++)for(var u=1;u<h;u++){var x=u-1<0?h-1:u-1,p=(u+1)%h,y=w-1<0?f-1:w-1,A=(w+1)%f,z=[],E=[0,0,n[(u*f+w)*4]/255*c];z.push([-1,0,n[(u*f+y)*4]/255*c]);z.push([-1,-1,n[(x*f+y)*4]/255*c]);z.push([0,-1,n[(x*f+w)*4]/255*c]);z.push([1,-1,n[(x*f+A)*4]/255*c]);
|
|
|
-z.push([1,0,n[(u*f+A)*4]/255*c]);z.push([1,1,n[(p*f+A)*4]/255*c]);z.push([0,1,n[(p*f+w)*4]/255*c]);z.push([-1,1,n[(p*f+y)*4]/255*c]);x=[];y=z.length;for(p=0;p<y;p++){var A=z[p],F=z[(p+1)%y],A=[A[0]-E[0],A[1]-E[1],A[2]-E[2]],F=[F[0]-E[0],F[1]-E[1],F[2]-E[2]];x.push(e([A[1]*F[2]-A[2]*F[1],A[2]*F[0]-A[0]*F[2],A[0]*F[1]-A[1]*F[0]]))}z=[0,0,0];for(p=0;p<x.length;p++)z[0]+=x[p][0],z[1]+=x[p][1],z[2]+=x[p][2];z[0]/=x.length;z[1]/=x.length;z[2]/=x.length;E=(u*f+w)*4;v[E]=(z[0]+1)/2*255|0;v[E+1]=(z[1]+0.5)*
|
|
|
-255|0;v[E+2]=z[2]*255|0;v[E+3]=255}m.putImageData(t,0,0);return k}};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)}};
|
|
|
+b[2]*b[2]);return[b[0]/e,b[1]/e,b[2]/e]};c|=1;var f=b.width,h=b.height,k=document.createElement("canvas");k.width=f;k.height=h;var m=k.getContext("2d");m.drawImage(b,0,0);for(var n=m.getImageData(0,0,f,h).data,p=m.createImageData(f,h),u=p.data,w=0;w<f;w++)for(var t=1;t<h;t++){var x=t-1<0?h-1:t-1,v=(t+1)%h,A=w-1<0?f-1:w-1,z=(w+1)%f,y=[],E=[0,0,n[(t*f+w)*4]/255*c];y.push([-1,0,n[(t*f+A)*4]/255*c]);y.push([-1,-1,n[(x*f+A)*4]/255*c]);y.push([0,-1,n[(x*f+w)*4]/255*c]);y.push([1,-1,n[(x*f+z)*4]/255*c]);
|
|
|
+y.push([1,0,n[(t*f+z)*4]/255*c]);y.push([1,1,n[(v*f+z)*4]/255*c]);y.push([0,1,n[(v*f+w)*4]/255*c]);y.push([-1,1,n[(v*f+A)*4]/255*c]);x=[];A=y.length;for(v=0;v<A;v++){var z=y[v],F=y[(v+1)%A],z=[z[0]-E[0],z[1]-E[1],z[2]-E[2]],F=[F[0]-E[0],F[1]-E[1],F[2]-E[2]];x.push(e([z[1]*F[2]-z[2]*F[1],z[2]*F[0]-z[0]*F[2],z[0]*F[1]-z[1]*F[0]]))}y=[0,0,0];for(v=0;v<x.length;v++)y[0]+=x[v][0],y[1]+=x[v][1],y[2]+=x[v][2];y[0]/=x.length;y[1]/=x.length;y[2]/=x.length;E=(t*f+w)*4;u[E]=(y[0]+1)/2*255|0;u[E+1]=(y[1]+0.5)*
|
|
|
+255|0;u[E+2]=y[2]*255|0;u[E+3]=255}m.putImageData(p,0,0);return k}};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}"},
|
|
|
normal:{uniforms:THREE.UniformsUtils.merge([THREE.UniformsLib.fog,THREE.UniformsLib.lights,{enableAO:{type:"i",value:0},enableDiffuse:{type:"i",value:0},enableSpecular:{type:"i",value:0},tDiffuse:{type:"t",value:0,texture:null},tNormal:{type:"t",value:2,texture:null},tSpecular:{type:"t",value:3,texture:null},tAO:{type:"t",value:4,texture:null},uNormalScale:{type:"f",value:1},tDisplacement:{type:"t",value:5,texture:null},uDisplacementBias:{type:"f",value:0},uDisplacementScale:{type:"f",value:1},uDiffuseColor:{type:"c",
|
|
@@ -365,7 +365,7 @@ THREE.ShaderChunk.fog_fragment,"}"].join("\n"),vertexShader:"attribute vec4 tang
|
|
|
cube:{uniforms:{tCube:{type:"t",value:1,texture:null}},vertexShader:"varying vec3 vViewPosition;\nvoid main() {\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvViewPosition = cameraPosition - mPosition.xyz;\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform samplerCube tCube;\nvarying vec3 vViewPosition;\nvoid main() {\nvec3 wPos = cameraPosition - vViewPosition;\ngl_FragColor = textureCube( tCube, vec3( - wPos.x, wPos.yz ) );\n}"}}};
|
|
|
THREE.Curve=function(){};THREE.Curve.prototype.getPoint=function(){console.log("Warning, getPoint() not implemented!");return null};THREE.Curve.prototype.getPointAt=function(b){return this.getPoint(this.getUtoTmapping(b))};THREE.Curve.prototype.getPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPoint(c/b));return e};THREE.Curve.prototype.getSpacedPoints=function(b){b||(b=5);var c,e=[];for(c=0;c<=b;c++)e.push(this.getPointAt(c/b));return e};
|
|
|
THREE.Curve.prototype.getLength=function(){var b=this.getLengths();return b[b.length-1]};THREE.Curve.prototype.getLengths=function(b){b||(b=200);if(this.cacheArcLengths&&this.cacheArcLengths.length==b+1)return this.cacheArcLengths;var c=[],e,f=this.getPoint(0),h,k=0;c.push(0);for(h=1;h<=b;h++)e=this.getPoint(h/b),k+=e.distanceTo(f),c.push(k),f=e;return this.cacheArcLengths=c};
|
|
|
-THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,h=e.length,k;k=c?c:b*e[h-1];time=Date.now();for(var m=0,n=h-1,t;m<=n;)if(f=Math.floor(m+(n-m)/2),t=e[f]-k,t<0)m=f+1;else if(t>0)n=f-1;else{n=f;break}f=n;if(e[f]==k)return f/(h-1);m=e[f];return e=(f+(k-m)/(e[f+1]-m))/(h-1)};THREE.Curve.prototype.getNormalVector=function(b){b=this.getTangent(b);return new THREE.Vector2(-b.y,b.x)};
|
|
|
+THREE.Curve.prototype.getUtoTmapping=function(b,c){var e=this.getLengths(),f=0,h=e.length,k;k=c?c:b*e[h-1];time=Date.now();for(var m=0,n=h-1,p;m<=n;)if(f=Math.floor(m+(n-m)/2),p=e[f]-k,p<0)m=f+1;else if(p>0)n=f-1;else{n=f;break}f=n;if(e[f]==k)return f/(h-1);m=e[f];return e=(f+(k-m)/(e[f+1]-m))/(h-1)};THREE.Curve.prototype.getNormalVector=function(b){b=this.getTangent(b);return new THREE.Vector2(-b.y,b.x)};
|
|
|
THREE.Curve.prototype.getTangent=function(b){var c=b-1.0E-4;b+=1.0E-4;c<0&&(c=0);b>1&&(b=1);var c=this.getPoint(c),b=this.getPoint(b),e=new THREE.Vector2;e.sub(b,c);return e.unit()};THREE.LineCurve=function(b,c){b instanceof THREE.Vector2?(this.v1=b,this.v2=c):THREE.LineCurve.oldConstructor.apply(this,arguments)};THREE.LineCurve.oldConstructor=function(b,c,e,f){this.constructor(new THREE.Vector2(b,c),new THREE.Vector2(e,f))};THREE.LineCurve.prototype=new THREE.Curve;
|
|
|
THREE.LineCurve.prototype.constructor=THREE.LineCurve;THREE.LineCurve.prototype.getPoint=function(b){var c=new THREE.Vector2;c.sub(this.v2,this.v1);c.multiplyScalar(b).addSelf(this.v1);return c};THREE.LineCurve.prototype.getPointAt=function(b){return this.getPoint(b)};THREE.LineCurve.prototype.getTangent=function(){var b=new THREE.Vector2;b.sub(this.v2,this.v1);b.normalize();return b};
|
|
|
THREE.QuadraticBezierCurve=function(b,c,e){if(!(c instanceof THREE.Vector2))var f=Array.prototype.slice.call(arguments),b=new THREE.Vector2(f[0],f[1]),c=new THREE.Vector2(f[2],f[3]),e=new THREE.Vector2(f[4],f[5]);this.v0=b;this.v1=c;this.v2=e};THREE.QuadraticBezierCurve.prototype=new THREE.Curve;THREE.QuadraticBezierCurve.prototype.constructor=THREE.QuadraticBezierCurve;
|
|
@@ -383,47 +383,47 @@ THREE.SplineCurve3=THREE.Curve.create(function(b){this.points=b},function(b){var
|
|
|
THREE.CurvePath=function(){this.curves=[];this.bends=[]};THREE.CurvePath.prototype=new THREE.Curve;THREE.CurvePath.prototype.constructor=THREE.CurvePath;THREE.CurvePath.prototype.add=function(b){this.curves.push(b)};THREE.CurvePath.prototype.checkConnection=function(){};THREE.CurvePath.prototype.closePath=function(){};
|
|
|
THREE.CurvePath.prototype.getPoint=function(b){for(var c=b*this.getLength(),e=this.getCurveLengths(),b=0;b<e.length;){if(e[b]>=c)return c=e[b]-c,b=this.curves[b],c=1-c/b.getLength(),b.getPointAt(c);b++}return null};THREE.CurvePath.prototype.getLength=function(){var b=this.getCurveLengths();return b[b.length-1]};
|
|
|
THREE.CurvePath.prototype.getCurveLengths=function(){if(this.cacheLengths&&this.cacheLengths.length==this.curves.length)return this.cacheLengths;var b=[],c=0,e,f=this.curves.length;for(e=0;e<f;e++)c+=this.curves[e].getLength(),b.push(c);return this.cacheLengths=b};
|
|
|
-THREE.CurvePath.prototype.getBoundingBox=function(){var b=this.getPoints(),c,e,f,h;c=e=Number.NEGATIVE_INFINITY;f=h=Number.POSITIVE_INFINITY;var k,m,n,t;t=new THREE.Vector2;m=0;for(n=b.length;m<n;m++){k=b[m];if(k.x>c)c=k.x;else if(k.x<f)f=k.x;if(k.y>e)e=k.y;else if(k.y<e)h=k.y;t.addSelf(k.x,k.y)}return{minX:f,minY:h,maxX:c,maxY:e,centroid:t.divideScalar(n)}};THREE.CurvePath.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,!0))};
|
|
|
+THREE.CurvePath.prototype.getBoundingBox=function(){var b=this.getPoints(),c,e,f,h;c=e=Number.NEGATIVE_INFINITY;f=h=Number.POSITIVE_INFINITY;var k,m,n,p;p=new THREE.Vector2;m=0;for(n=b.length;m<n;m++){k=b[m];if(k.x>c)c=k.x;else if(k.x<f)f=k.x;if(k.y>e)e=k.y;else if(k.y<e)h=k.y;p.addSelf(k.x,k.y)}return{minX:f,minY:h,maxX:c,maxY:e,centroid:p.divideScalar(n)}};THREE.CurvePath.prototype.createPointsGeometry=function(b){return this.createGeometry(this.getPoints(b,!0))};
|
|
|
THREE.CurvePath.prototype.createSpacedPointsGeometry=function(b){return this.createGeometry(this.getSpacedPoints(b,!0))};THREE.CurvePath.prototype.createGeometry=function(b){for(var c=new THREE.Geometry,e=0;e<b.length;e++)c.vertices.push(new THREE.Vertex(new THREE.Vector3(b[e].x,b[e].y,0)));return c};THREE.CurvePath.prototype.addWrapPath=function(b){this.bends.push(b)};
|
|
|
THREE.CurvePath.prototype.getTransformedPoints=function(b,c){var e=this.getPoints(b),f,h;if(!c)c=this.bends;f=0;for(h=c.length;f<h;f++)e=this.getWrapPoints(e,c[f]);return e};THREE.CurvePath.prototype.getTransformedSpacedPoints=function(b,c){var e=this.getSpacedPoints(b),f,h;if(!c)c=this.bends;f=0;for(h=c.length;f<h;f++)e=this.getWrapPoints(e,c[f]);return e};
|
|
|
-THREE.CurvePath.prototype.getWrapPoints=function(b,c){var e=this.getBoundingBox(),f,h,k,m,n,t;f=0;for(h=b.length;f<h;f++)k=b[f],m=k.x,n=k.y,t=m/e.maxX,t=c.getUtoTmapping(t,m),m=c.getPoint(t),n=c.getNormalVector(t).multiplyScalar(n),k.x=m.x+n.x,k.y=m.y+n.y;return b};THREE.Path=function(b){THREE.CurvePath.call(this);this.actions=[];b&&this.fromPoints(b)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
|
|
|
+THREE.CurvePath.prototype.getWrapPoints=function(b,c){var e=this.getBoundingBox(),f,h,k,m,n,p;f=0;for(h=b.length;f<h;f++)k=b[f],m=k.x,n=k.y,p=m/e.maxX,p=c.getUtoTmapping(p,m),m=c.getPoint(p),n=c.getNormalVector(p).multiplyScalar(n),k.x=m.x+n.x,k.y=m.y+n.y;return b};THREE.Path=function(b){THREE.CurvePath.call(this);this.actions=[];b&&this.fromPoints(b)};THREE.Path.prototype=new THREE.CurvePath;THREE.Path.prototype.constructor=THREE.Path;
|
|
|
THREE.PathActions={MOVE_TO:"moveTo",LINE_TO:"lineTo",QUADRATIC_CURVE_TO:"quadraticCurveTo",BEZIER_CURVE_TO:"bezierCurveTo",CSPLINE_THRU:"splineThru",ARC:"arc"};THREE.Path.prototype.fromPoints=function(b){this.moveTo(b[0].x,b[0].y);var c,e=b.length;for(c=1;c<e;c++)this.lineTo(b[c].x,b[c].y)};THREE.Path.prototype.moveTo=function(){var b=Array.prototype.slice.call(arguments);this.actions.push({action:THREE.PathActions.MOVE_TO,args:b})};
|
|
|
THREE.Path.prototype.lineTo=function(b,c){var e=Array.prototype.slice.call(arguments),f=this.actions[this.actions.length-1].args;this.curves.push(new THREE.LineCurve(new THREE.Vector2(f[f.length-2],f[f.length-1]),new THREE.Vector2(b,c)));this.actions.push({action:THREE.PathActions.LINE_TO,args:e})};
|
|
|
THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var h=Array.prototype.slice.call(arguments),k=this.actions[this.actions.length-1].args;this.curves.push(new THREE.QuadraticBezierCurve(new THREE.Vector2(k[k.length-2],k[k.length-1]),new THREE.Vector2(b,c),new THREE.Vector2(e,f)));this.actions.push({action:THREE.PathActions.QUADRATIC_CURVE_TO,args:h})};
|
|
|
THREE.Path.prototype.bezierCurveTo=function(b,c,e,f,h,k){var m=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,k)));this.actions.push({action:THREE.PathActions.BEZIER_CURVE_TO,args:m})};
|
|
|
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])];Array.prototype.push.apply(e,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,k){var m=Array.prototype.slice.call(arguments);this.curves.push(new THREE.ArcCurve(b,c,e,f,h,k));this.actions.push({action:THREE.PathActions.ARC,args:m})};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,k,m,n,t,v,w,u,x,p,y,A;f=0;for(h=this.actions.length;f<h;f++)switch(k=this.actions[f],m=k.action,k=k.args,m){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(k[0],k[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:n=k[2];t=k[3];u=k[0];x=k[1];e.length>0?(m=e[e.length-1],p=m.x,y=m.y):(m=this.actions[f-1].args,p=m[m.length-2],y=m[m.length-1]);for(m=1;m<=b;m++)A=m/b,k=THREE.Shape.Utils.b2(A,p,u,n),A=THREE.Shape.Utils.b2(A,y,x,
|
|
|
-t),e.push(new THREE.Vector2(k,A));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];t=k[5];u=k[0];x=k[1];v=k[2];w=k[3];e.length>0?(m=e[e.length-1],p=m.x,y=m.y):(m=this.actions[f-1].args,p=m[m.length-2],y=m[m.length-1]);for(m=1;m<=b;m++)A=m/b,k=THREE.Shape.Utils.b3(A,p,u,v,n),A=THREE.Shape.Utils.b3(A,y,x,w,t),e.push(new THREE.Vector2(k,A));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];A=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m);
|
|
|
-for(m=1;m<=A;m++)e.push(k.getPointAt(m/A));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];t=k[1];v=k[2];u=k[3];A=k[4];x=!!k[5];w=m[m.length-2];p=m[m.length-1];m.length==0&&(w=p=0);y=A-u;var z=b*2;for(m=1;m<=z;m++)A=m/z,x||(A=1-A),A=u+A*y,k=w+n+v*Math.cos(A),A=p+t+v*Math.sin(A),e.push(new THREE.Vector2(k,A))}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,k){var m=this.getPoints(),n,t,v,w,u;n=0;for(t=m.length;n<t;n++)v=m[n],w=v.x,u=v.y,v.x=b*w+c*u+e,v.y=f*u+h*w+k;return m};
|
|
|
+THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,h,k,m,n,p,u,w,t,x,v,A,z;f=0;for(h=this.actions.length;f<h;f++)switch(k=this.actions[f],m=k.action,k=k.args,m){case THREE.PathActions.LINE_TO:e.push(new THREE.Vector2(k[0],k[1]));break;case THREE.PathActions.QUADRATIC_CURVE_TO:n=k[2];p=k[3];t=k[0];x=k[1];e.length>0?(m=e[e.length-1],v=m.x,A=m.y):(m=this.actions[f-1].args,v=m[m.length-2],A=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b2(z,v,t,n),z=THREE.Shape.Utils.b2(z,A,x,
|
|
|
+p),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];p=k[5];t=k[0];x=k[1];u=k[2];w=k[3];e.length>0?(m=e[e.length-1],v=m.x,A=m.y):(m=this.actions[f-1].args,v=m[m.length-2],A=m[m.length-1]);for(m=1;m<=b;m++)z=m/b,k=THREE.Shape.Utils.b3(z,v,t,u,n),z=THREE.Shape.Utils.b3(z,A,x,w,p),e.push(new THREE.Vector2(k,z));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];z=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m);
|
|
|
+for(m=1;m<=z;m++)e.push(k.getPointAt(m/z));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];p=k[1];u=k[2];t=k[3];z=k[4];x=!!k[5];w=m[m.length-2];v=m[m.length-1];m.length==0&&(w=v=0);A=z-t;var y=b*2;for(m=1;m<=y;m++)z=m/y,x||(z=1-z),z=t+z*A,k=w+n+u*Math.cos(z),z=v+p+u*Math.sin(z),e.push(new THREE.Vector2(k,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,k){var m=this.getPoints(),n,p,u,w,t;n=0;for(p=m.length;n<p;n++)u=m[n],w=u.x,t=u.y,u.x=b*w+c*t+e,u.y=f*t+h*w+k;return m};
|
|
|
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=[],k=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&&k.actions.length!=0&&(h.push(k),k=new THREE.Path),k[e].apply(k,f);k.actions.length!=0&&h.push(k);if(h.length==0)return[];var m,k=[];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())?(m&&k.push(m),m=new THREE.Shape,m.actions=f.actions,m.curves=
|
|
|
f.curves):m.holes.push(f);k.push(m)}else{m=new THREE.Shape;b=0;for(c=h.length;b<c;b++)f=h[b],THREE.Shape.Utils.isClockWise(f.getPoints())?(m.actions=f.actions,m.curves=f.curves,k.push(m),m=new THREE.Shape):m.holes.push(f)}return k};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,k,m,n,t,v,w,u,x,p,y=[];for(t=0;t<c.length;t++){v=c[t];Array.prototype.push.apply(f,v);k=Number.POSITIVE_INFINITY;for(h=0;h<v.length;h++){x=v[h];p=[];for(u=0;u<e.length;u++)w=e[u],w=x.distanceToSquared(w),p.push(w),w<k&&(k=w,m=h,n=u)}h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:v.length-1;var A=[v[m],e[n],e[h]];u=THREE.FontUtils.Triangulate.area(A);var z=[v[m],v[k],e[n]];x=THREE.FontUtils.Triangulate.area(z);p=n;w=m;n+=1;m+=-1;n<
|
|
|
-0&&(n+=e.length);n%=e.length;m<0&&(m+=v.length);m%=v.length;h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:v.length-1;A=[v[m],e[n],e[h]];A=THREE.FontUtils.Triangulate.area(A);z=[v[m],v[k],e[n]];z=THREE.FontUtils.Triangulate.area(z);u+x>A+z&&(n=p,m=w,n<0&&(n+=e.length),n%=e.length,m<0&&(m+=v.length),m%=v.length,h=n-1>=0?n-1:e.length-1,k=m-1>=0?m-1:v.length-1);u=e.slice(0,n);x=e.slice(n);p=v.slice(m);w=v.slice(0,m);k=[v[m],v[k],e[n]];y.push([v[m],e[n],e[h]]);y.push(k);e=u.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),k,m,n,t,v={};k=0;for(m=f.length;k<m;k++)t=f[k].x+":"+f[k].y,v[t]!==void 0&&console.log("Duplicate point",t),v[t]=k;k=0;for(m=e.length;k<m;k++){n=e[k];for(f=0;f<3;f++)t=n[f].x+":"+n[f].y,t=v[t],t!==void 0&&(n[f]=t)}k=0;for(m=h.length;k<m;k++){n=h[k];for(f=0;f<3;f++)t=n[f].x+":"+n[f].y,t=v[t],t!==void 0&&(n[f]=t)}return e.concat(h)},
|
|
|
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,k,m,n,p,u,w,t,x,v,A=[];for(p=0;p<c.length;p++){u=c[p];Array.prototype.push.apply(f,u);k=Number.POSITIVE_INFINITY;for(h=0;h<u.length;h++){x=u[h];v=[];for(t=0;t<e.length;t++)w=e[t],w=x.distanceToSquared(w),v.push(w),w<k&&(k=w,m=h,n=t)}h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:u.length-1;var z=[u[m],e[n],e[h]];t=THREE.FontUtils.Triangulate.area(z);var y=[u[m],u[k],e[n]];x=THREE.FontUtils.Triangulate.area(y);v=n;w=m;n+=1;m+=-1;n<
|
|
|
+0&&(n+=e.length);n%=e.length;m<0&&(m+=u.length);m%=u.length;h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:u.length-1;z=[u[m],e[n],e[h]];z=THREE.FontUtils.Triangulate.area(z);y=[u[m],u[k],e[n]];y=THREE.FontUtils.Triangulate.area(y);t+x>z+y&&(n=v,m=w,n<0&&(n+=e.length),n%=e.length,m<0&&(m+=u.length),m%=u.length,h=n-1>=0?n-1:e.length-1,k=m-1>=0?m-1:u.length-1);t=e.slice(0,n);x=e.slice(n);v=u.slice(m);w=u.slice(0,m);k=[u[m],u[k],e[n]];A.push([u[m],e[n],e[h]]);A.push(k);e=t.concat(v).concat(w).concat(x)}return{shape:e,
|
|
|
+isolatedPts:A,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),k,m,n,p,u={};k=0;for(m=f.length;k<m;k++)p=f[k].x+":"+f[k].y,u[p]!==void 0&&console.log("Duplicate point",p),u[p]=k;k=0;for(m=e.length;k<m;k++){n=e[k];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=u[p],p!==void 0&&(n[f]=p)}k=0;for(m=h.length;k<m;k++){n=h[k];for(f=0;f<3;f++)p=n[f].x+":"+n[f].y,p=u[p],p!==void 0&&(n[f]=p)}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",k=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=k};
|
|
|
THREE.TextPath.prototype.toShapes=function(){for(var b=THREE.FontUtils.drawText(this.text).paths,c=[],e=0,f=b.length;e<f;e++)Array.prototype.push.apply(c,b[e].toShapes());return c};
|
|
|
THREE.AnimationHandler=function(){var b=[],c={},e={update:function(e){for(var c=0;c<b.length;c++)b[c].update(e)},addToUpdate:function(e){b.indexOf(e)===-1&&b.push(e)},removeFromUpdate:function(e){e=b.indexOf(e);e!==-1&&b.splice(e,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
|
|
|
-0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var n=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(n[0],n[1],n[2],n[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){n={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var t=0;t<b.hierarchy[e].keys[f].morphTargets.length;t++){var v=b.hierarchy[e].keys[f].morphTargets[t];n[v]=-1}b.hierarchy[e].usedMorphTargets=n;for(f=0;f<b.hierarchy[e].keys.length;f++){var w=
|
|
|
-{};for(v in n){for(t=0;t<b.hierarchy[e].keys[f].morphTargets.length;t++)if(b.hierarchy[e].keys[f].morphTargets[t]===v){w[v]=b.hierarchy[e].keys[f].morphTargetsInfluences[t];break}t===b.hierarchy[e].keys[f].morphTargets.length&&(w[v]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=w}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
|
|
|
+0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var n=b.hierarchy[e].keys[f].rot;b.hierarchy[e].keys[f].rot=new THREE.Quaternion(n[0],n[1],n[2],n[3])}}if(b.hierarchy[e].keys[0].morphTargets!==void 0){n={};for(f=0;f<b.hierarchy[e].keys.length;f++)for(var p=0;p<b.hierarchy[e].keys[f].morphTargets.length;p++){var u=b.hierarchy[e].keys[f].morphTargets[p];n[u]=-1}b.hierarchy[e].usedMorphTargets=n;for(f=0;f<b.hierarchy[e].keys.length;f++){var w=
|
|
|
+{};for(u in n){for(p=0;p<b.hierarchy[e].keys[f].morphTargets.length;p++)if(b.hierarchy[e].keys[f].morphTargets[p]===u){w[u]=b.hierarchy[e].keys[f].morphTargetsInfluences[p];break}p===b.hierarchy[e].keys[f].morphTargets.length&&(w[u]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=w}}for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].time===b.hierarchy[e].keys[f-1].time&&(b.hierarchy[e].keys.splice(f,1),f--);for(f=1;f<b.hierarchy[e].keys.length;f++)b.hierarchy[e].keys[f].index=f}f=parseInt(b.length*
|
|
|
b.fps,10);b.JIT={};b.JIT.hierarchy=[];for(e=0;e<b.hierarchy.length;e++)b.JIT.hierarchy.push(Array(f));b.initialized=!0}},get:function(b){if(typeof b==="string")return c[b]?c[b]:(console.log("THREE.AnimationHandler.get: Couldn't find animation "+b),null)},parse:function(b){var e=[];if(b instanceof THREE.SkinnedMesh)for(var c=0;c<b.bones.length;c++)e.push(b.bones[c]);else f(b,e);return e}},f=function(b,e){e.push(b);for(var c=0;c<b.children.length;c++)f(b.children[c],e)};e.LINEAR=0;e.CATMULLROM=1;e.CATMULLROM_FORWARD=
|
|
|
2;return e}();THREE.Animation=function(b,c,e,f){this.root=b;this.data=THREE.AnimationHandler.get(c);this.hierarchy=THREE.AnimationHandler.parse(b);this.currentTime=0;this.timeScale=1;this.isPlaying=!1;this.loop=this.isPaused=!0;this.interpolationType=e!==void 0?e:THREE.AnimationHandler.LINEAR;this.JITCompile=f!==void 0?f:!0;this.points=[];this.target=new THREE.Vector3};
|
|
|
THREE.Animation.prototype.play=function(b,c){if(!this.isPlaying){this.isPlaying=!0;this.loop=b!==void 0?b:!0;this.currentTime=c!==void 0?c:0;var e,f=this.hierarchy.length,h;for(e=0;e<f;e++){h=this.hierarchy[e];if(this.interpolationType!==THREE.AnimationHandler.CATMULLROM_FORWARD)h.useQuaternion=!0;h.matrixAutoUpdate=!0;if(h.animationCache===void 0)h.animationCache={},h.animationCache.prevKey={pos:0,rot:0,scl:0},h.animationCache.nextKey={pos:0,rot:0,scl:0},h.animationCache.originalMatrix=h instanceof
|
|
|
THREE.Bone?h.skinMatrix:h.matrix;var k=h.animationCache.prevKey;h=h.animationCache.nextKey;k.pos=this.data.hierarchy[e].keys[0];k.rot=this.data.hierarchy[e].keys[0];k.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,k,m,n,t,v,w=this.data.JIT.hierarchy,u,x;this.currentTime+=b*this.timeScale;x=this.currentTime;u=this.currentTime%=this.data.length;v=parseInt(Math.min(u*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],t=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 A=0;A<3;A++){e=c[A];m=t.prevKey[e];n=t.nextKey[e];if(n.time<=x){if(u<x)if(this.loop){m=this.data.hierarchy[p].keys[0];for(n=this.getNextKeyWith(e,p,1);n.time<u;)m=n,n=this.getNextKeyWith(e,p,n.index+1)}else{this.stop();return}else{do m=n,n=this.getNextKeyWith(e,p,n.index+1);while(n.time<
|
|
|
-u)}t.prevKey[e]=m;t.nextKey[e]=n}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(u-m.time)/(n.time-m.time);h=m[e];k=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]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[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,m.index-1).pos,this.points[1]=h,this.points[2]=k,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,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[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,k,m,n,t,v;h=(b.length-1)*c;k=Math.floor(h);h-=k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>b.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];n=b[e[1]];t=b[e[2]];v=b[e[3]];e=h*h;m=h*e;f[0]=this.interpolate(k[0],n[0],t[0],v[0],h,e,m);f[1]=this.interpolate(k[1],n[1],t[1],v[1],h,e,m);f[2]=this.interpolate(k[2],n[2],t[2],v[2],h,e,m);return f};
|
|
|
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,k,m,n,p,u,w=this.data.JIT.hierarchy,t,x;this.currentTime+=b*this.timeScale;x=this.currentTime;t=this.currentTime%=this.data.length;u=parseInt(Math.min(t*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,A=this.hierarchy.length;v<A;v++)if(b=this.hierarchy[v],p=b.animationCache,this.JITCompile&&w[v][u]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=w[v][u],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
|
|
|
+!1):(b.matrix=w[v][u],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];m=p.prevKey[e];n=p.nextKey[e];if(n.time<=x){if(t<x)if(this.loop){m=this.data.hierarchy[v].keys[0];for(n=this.getNextKeyWith(e,v,1);n.time<t;)m=n,n=this.getNextKeyWith(e,v,n.index+1)}else{this.stop();return}else{do m=n,n=this.getNextKeyWith(e,v,n.index+1);while(n.time<
|
|
|
+t)}p.prevKey[e]=m;p.nextKey[e]=n}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(t-m.time)/(n.time-m.time);h=m[e];k=n[e];if(f<0||f>1)console.log("THREE.Animation.update: Warning! Scale out of bounds:"+f+" on bone "+v),f=f<0?0:1;if(e==="pos")if(e=b.position,this.interpolationType===THREE.AnimationHandler.LINEAR)e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f;else{if(this.interpolationType===THREE.AnimationHandler.CATMULLROM||this.interpolationType===THREE.AnimationHandler.CATMULLROM_FORWARD)if(this.points[0]=
|
|
|
+this.getPrevKeyWith("pos",v,m.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",v,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,k,b.quaternion,f);else if(e==="scl")e=b.scale,e.x=h[0]+(k[0]-h[0])*f,e.y=h[1]+(k[1]-h[1])*f,e.z=h[2]+(k[2]-h[2])*f}}if(this.JITCompile&&w[0][u]===void 0){this.hierarchy[0].update(void 0,!0);for(v=0;v<this.hierarchy.length;v++)w[v][u]=this.hierarchy[v]instanceof THREE.Bone?this.hierarchy[v].skinMatrix.clone():this.hierarchy[v].matrix.clone()}}};
|
|
|
+THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],h,k,m,n,p,u;h=(b.length-1)*c;k=Math.floor(h);h-=k;e[0]=k==0?k:k-1;e[1]=k;e[2]=k>b.length-2?k:k+1;e[3]=k>b.length-3?k:k+2;k=b[e[0]];n=b[e[1]];p=b[e[2]];u=b[e[3]];e=h*h;m=h*e;f[0]=this.interpolate(k[0],n[0],p[0],u[0],h,e,m);f[1]=this.interpolate(k[1],n[1],p[1],u[1],h,e,m);f[2]=this.interpolate(k[2],n[2],p[2],u[2],h,e,m);return f};
|
|
|
THREE.Animation.prototype.interpolate=function(b,c,e,f,h,k,m){b=(e-b)*0.5;f=(f-c)*0.5;return(2*(c-e)+b+f)*m+(-3*(c-e)-2*b-f)*k+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.CubeCamera=function(b,c,e,f){this.cameraPX=new THREE.PerspectiveCamera(90,1,b,c);this.cameraNX=new THREE.PerspectiveCamera(90,1,b,c);this.cameraPY=new THREE.PerspectiveCamera(90,1,b,c);this.cameraNY=new THREE.PerspectiveCamera(90,1,b,c);this.cameraPZ=new THREE.PerspectiveCamera(90,1,b,c);this.cameraNZ=new THREE.PerspectiveCamera(90,1,b,c);this.cameraPXTarget=new THREE.Vector3(0,0,0);this.cameraNXTarget=new THREE.Vector3(0,0,0);this.cameraPYTarget=new THREE.Vector3(0,0,0);this.cameraNYTarget=
|
|
@@ -432,226 +432,227 @@ f,{format:THREE.RGBFormat,magFilter:THREE.LinearFilter,minFilter:THREE.LinearFil
|
|
|
new THREE.Vector3(0,0,-1));this.cameraPX.lookAt(this.cameraPXTarget);this.cameraNX.lookAt(this.cameraNXTarget);this.cameraPY.lookAt(this.cameraPYTarget);this.cameraNY.lookAt(this.cameraNYTarget);this.cameraPZ.lookAt(this.cameraPZTarget);this.cameraNZ.lookAt(this.cameraNZTarget)};this.updateCubeMap=function(b,e){var c=this.renderTarget;b.setFaceCulling("back","cw");e.scale.y=-1;e.position.y=2*this.height;e.updateMatrix();c.activeCubeFace=0;b.render(e,this.cameraPX,c);c.activeCubeFace=1;b.render(e,
|
|
|
this.cameraNX,c);e.scale.y=1;e.position.y=0;e.updateMatrix();e.scale.x=-1;e.updateMatrix();c.activeCubeFace=2;b.render(e,this.cameraPY,c);e.scale.x=1;e.updateMatrix();b.setFaceCulling("back","ccw");c.activeCubeFace=3;b.render(e,this.cameraNY,c);e.scale.x=-1;e.updateMatrix();b.setFaceCulling("back","cw");c.activeCubeFace=4;b.render(e,this.cameraPZ,c);c.activeCubeFace=5;b.render(e,this.cameraNZ,c);e.scale.x=1;e.updateMatrix();b.setFaceCulling("back","ccw")}};THREE.FirstPersonCamera=function(){console.warn("DEPRECATED: FirstPersonCamera() is FirstPersonControls().")};
|
|
|
THREE.PathCamera=function(){console.warn("DEPRECATED: PathCamera() is PathControls().")};THREE.FlyCamera=function(){console.warn("DEPRECATED: FlyCamera() is FlyControls().")};THREE.RollCamera=function(){console.warn("DEPRECATED: RollCamera() is RollControls().")};THREE.TrackballCamera=function(){console.warn("DEPRECATED: TrackballCamera() is TrackballControls().")};
|
|
|
-THREE.FirstPersonControls=function(b){function c(b,c){return function(){c.apply(b,arguments)}}this.object=b;this.target=new THREE.Vector3(0,0,0);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=Math.PI;this.domElement=document;this.lastUpdate=(new Date).getTime();this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=
|
|
|
-this.autoSpeedFactor=this.tdiff=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(b){this.domElement!==document&&this.domElement.focus();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.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=
|
|
|
-function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=
|
|
|
-!1;break;case 70:this.moveDown=!1}};this.update=function(){var b=(new Date).getTime();this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*((this.object.position.y<this.heightMin?this.heightMin:this.object.position.y>this.heightMax?this.heightMax:this.object.position.y)-this.heightMin)*this.heightCoef:0;var c=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&!this.moveBackward)&&this.object.translateZ(-(c+this.autoSpeedFactor));
|
|
|
-this.moveBackward&&this.object.translateZ(c);this.moveLeft&&this.object.translateX(-c);this.moveRight&&this.object.translateX(c);this.moveUp&&this.object.translateY(c);this.moveDown&&this.object.translateY(-c);c=this.tdiff*this.lookSpeed;this.activeLook||(c=0);this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;var b=this.target,h=this.object.position;b.x=h.x+100*Math.sin(this.phi)*
|
|
|
-Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*c;this.lookVertical&&(this.lat-=this.mouseY*c*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-this.verticalMin)/(Math.PI-0)+this.verticalMin;b=this.target;h=this.object.position;
|
|
|
-b.x=h.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=h.y+100*Math.cos(this.phi);b.z=h.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",c(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",c(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",c(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",
|
|
|
-c(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",c(this,this.onKeyUp),!1)};
|
|
|
-THREE.PathControls=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(),t=m.length,F=0;k=t-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<t-1;k++)F=f*n.chunks[k]/n.total,e.keys[k]={time:F,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,
|
|
|
+THREE.FirstPersonControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.target=new THREE.Vector3(0,0,0);this.domElement=c!==void 0?c:document;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=Math.PI;this.lastUpdate=(new Date).getTime();this.theta=this.phi=this.lon=this.lat=
|
|
|
+this.mouseY=this.mouseX=this.autoSpeedFactor=this.tdiff=0;this.mouseDragOn=this.freeze=this.moveRight=this.moveLeft=this.moveBackward=this.moveForward=!1;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));this.onMouseDown=function(b){this.domElement!==document&&this.domElement.focus();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.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-this.viewHalfX,this.mouseY=
|
|
|
+b.pageY-this.domElement.offsetTop-this.viewHalfY)};this.onKeyDown=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!0;break;case 37:case 65:this.moveLeft=!0;break;case 40:case 83:this.moveBackward=!0;break;case 39:case 68:this.moveRight=!0;break;case 82:this.moveUp=!0;break;case 70:this.moveDown=!0;break;case 81:this.freeze=!this.freeze}};this.onKeyUp=function(b){switch(b.keyCode){case 38:case 87:this.moveForward=!1;break;case 37:case 65:this.moveLeft=!1;break;case 40:case 83:this.moveBackward=
|
|
|
+!1;break;case 39:case 68:this.moveRight=!1;break;case 82:this.moveUp=!1;break;case 70:this.moveDown=!1}};this.update=function(){var b=(new Date).getTime();this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;if(!this.freeze){this.autoSpeedFactor=this.heightSpeed?this.tdiff*((this.object.position.y<this.heightMin?this.heightMin:this.object.position.y>this.heightMax?this.heightMax:this.object.position.y)-this.heightMin)*this.heightCoef:0;var e=this.tdiff*this.movementSpeed;(this.moveForward||this.autoForward&&
|
|
|
+!this.moveBackward)&&this.object.translateZ(-(e+this.autoSpeedFactor));this.moveBackward&&this.object.translateZ(e);this.moveLeft&&this.object.translateX(-e);this.moveRight&&this.object.translateX(e);this.moveUp&&this.object.translateY(e);this.moveDown&&this.object.translateY(-e);e=this.tdiff*this.lookSpeed;this.activeLook||(e=0);this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*
|
|
|
+Math.PI/180;var b=this.target,c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta)}b=1;this.constrainVertical&&(b=Math.PI/(this.verticalMax-this.verticalMin));this.lon+=this.mouseX*e;this.lookVertical&&(this.lat-=this.mouseY*e*b);this.lat=Math.max(-85,Math.min(85,this.lat));this.phi=(90-this.lat)*Math.PI/180;this.theta=this.lon*Math.PI/180;if(this.constrainVertical)this.phi=(this.phi-0)*(this.verticalMax-
|
|
|
+this.verticalMin)/(Math.PI-0)+this.verticalMin;b=this.target;c=this.object.position;b.x=c.x+100*Math.sin(this.phi)*Math.cos(this.theta);b.y=c.y+100*Math.cos(this.phi);b.z=c.z+100*Math.sin(this.phi)*Math.sin(this.theta);this.object.lookAt(b)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",e(this,this.onMouseMove),!1);this.domElement.addEventListener("mousedown",e(this,this.onMouseDown),!1);this.domElement.addEventListener("mouseup",
|
|
|
+e(this,this.onMouseUp),!1);this.domElement.addEventListener("keydown",e(this,this.onKeyDown),!1);this.domElement.addEventListener("keyup",e(this,this.onKeyUp),!1)};
|
|
|
+THREE.PathControls=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(),p=m.length,F=0;k=p-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<p-1;k++)F=f*n.chunks[k]/n.total,e.keys[k]={time:F,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)}this.object=b;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,2*Math.PI],dstRange:[0,2*Math.PI]};this.horizontalAngleMap={srcRange:[0,2*Math.PI],dstRange:[0,2*Math.PI]};this.domElement=document;this.theta=this.phi=this.lon=this.lat=this.mouseY=this.mouseX=0;this.domElement===document?(this.viewHalfX=window.innerWidth/2,this.viewHalfY=window.innerHeight/2):(this.viewHalfX=this.domElement.offsetWidth/2,this.viewHalfY=this.domElement.offsetHeight/2,this.domElement.setAttribute("tabindex",-1));var h=Math.PI*2,k=Math.PI/180;this.update=function(b,e,
|
|
|
c){var f,m;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)*k;this.theta=this.lon*k;f=this.phi%h;this.phi=f>=0?f:f+h;f=this.verticalAngleMap.srcRange;m=this.verticalAngleMap.dstRange;var n=m[1]-m[0];this.phi=TWEEN.Easing.Quadratic.EaseInOut(((this.phi-f[0])*(m[1]-m[0])/(f[1]-f[0])+m[0]-m[0])/n)*n+m[0];f=this.horizontalAngleMap.srcRange;
|
|
|
m=this.horizontalAngleMap.dstRange;n=m[1]-m[0];this.theta=TWEEN.Easing.Quadratic.EaseInOut(((this.theta-f[0])*(m[1]-m[0])/(f[1]-f[0])+m[0]-m[0])/n)*n+m[0];f=this.target.position;f.x=100*Math.sin(this.phi)*Math.cos(this.theta);f.y=100*Math.cos(this.phi);f.z=100*Math.sin(this.phi)*Math.sin(this.theta);this.supr.update.call(this,b,e,c)};this.onMouseMove=function(b){this.domElement===document?(this.mouseX=b.pageX-this.viewHalfX,this.mouseY=b.pageY-this.viewHalfY):(this.mouseX=b.pageX-this.domElement.offsetLeft-
|
|
|
-this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};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}),m=new THREE.MeshLambertMaterial({color:65280}),n=new THREE.CubeGeometry(10,10,20),t=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(t,m);b.position.set(0,
|
|
|
+this.viewHalfX,this.mouseY=b.pageY-this.domElement.offsetTop-this.viewHalfY)};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}),m=new THREE.MeshLambertMaterial({color:65280}),n=new THREE.CubeGeometry(10,10,20),p=new THREE.CubeGeometry(2,2,10);this.animationParent=new THREE.Mesh(n,b);b=new THREE.Mesh(p,m);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.PathCameraIdCounter=0;
|
|
|
-THREE.FlyControls=function(b){function c(b,c){return function(){c.apply(b,arguments)}}this.object=b;this.tmpQuaternion=new THREE.Quaternion;this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.domElement=document;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.domElement!==document&&this.domElement.setAttribute("tabindex",-1);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=
|
|
|
+THREE.FlyControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=c!==void 0?c:document;c&&this.domElement.setAttribute("tabindex",-1);this.movementSpeed=1;this.rollSpeed=0.0050;this.autoForward=this.dragToLook=!1;this.object.useQuaternion=!0;this.tmpQuaternion=new THREE.Quaternion;this.mouseStatus=0;this.moveState={up:0,down:0,left:0,right:0,forward:0,back:0,pitchUp:0,pitchDown:0,yawLeft:0,yawRight:0,rollLeft:0,rollRight:0};this.moveVector=new THREE.Vector3(0,
|
|
|
+0,0);this.rotationVector=new THREE.Vector3(0,0,0);this.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;case 69:this.moveState.rollRight=0}this.updateMovementVector();this.updateRotationVector()};this.mousedown=function(b){this.domElement!==document&&this.domElement.focus();b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus++;else switch(b.button){case 0:this.object.moveForward=
|
|
|
-!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var c=this.getContainerDimensions(),h=c.size[0]/2,k=c.size[1]/2;this.moveState.yawLeft=-(b.pageX-c.offset[0]-h)/h;this.moveState.pitchDown=(b.pageY-c.offset[1]-k)/k;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=
|
|
|
-!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,c=this.tdiff*this.rollSpeed;this.object.translateX(this.moveVector.x*b);this.object.translateY(this.moveVector.y*b);this.object.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*c,this.rotationVector.y*c,this.rotationVector.z*c,
|
|
|
-1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.position);this.object.matrix.setRotationFromQuaternion(this.quaternion);this.object.matrixWorldNeedsUpdate=!0;this.supr.update.call(this)};this.updateMovementVector=function(){var b=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-b+this.moveState.back};
|
|
|
+!0;break;case 2:this.object.moveBackward=!0}};this.mousemove=function(b){if(!this.dragToLook||this.mouseStatus>0){var e=this.getContainerDimensions(),c=e.size[0]/2,m=e.size[1]/2;this.moveState.yawLeft=-(b.pageX-e.offset[0]-c)/c;this.moveState.pitchDown=(b.pageY-e.offset[1]-m)/m;this.updateRotationVector()}};this.mouseup=function(b){b.preventDefault();b.stopPropagation();if(this.dragToLook)this.mouseStatus--,this.moveState.yawLeft=this.moveState.pitchDown=0;else switch(b.button){case 0:this.moveForward=
|
|
|
+!1;break;case 2:this.moveBackward=!1}this.updateRotationVector()};this.update=function(){var b=(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.tdiff=(b-this.lastUpdate)/1E3;this.lastUpdate=b;var b=this.tdiff*this.movementSpeed,e=this.tdiff*this.rollSpeed;this.object.translateX(this.moveVector.x*b);this.object.translateY(this.moveVector.y*b);this.object.translateZ(this.moveVector.z*b);this.tmpQuaternion.set(this.rotationVector.x*e,this.rotationVector.y*e,this.rotationVector.z*e,
|
|
|
+1).normalize();this.object.quaternion.multiplySelf(this.tmpQuaternion);this.object.matrix.setPosition(this.object.position);this.object.matrix.setRotationFromQuaternion(this.object.quaternion);this.object.matrixWorldNeedsUpdate=!0};this.updateMovementVector=function(){var b=this.moveState.forward||this.autoForward&&!this.moveState.back?1:0;this.moveVector.x=-this.moveState.left+this.moveState.right;this.moveVector.y=-this.moveState.down+this.moveState.up;this.moveVector.z=-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);this.domElement.addEventListener("keydown",c(this,this.keydown),!1);this.domElement.addEventListener("keyup",c(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
|
-THREE.RollControls=function(b){this.object=b;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 c=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Matrix4,k=!1,m=1,n=0,t=0,v=0,w=0,u=0,x=window.innerWidth/2,p=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*w),this.rotateVertically(b*u));b=this.delta*this.movementSpeed;this.translateZ(b*(n>0||this.autoForward&&!(n<0)?1:n));this.translateX(b*t);this.translateY(b*v);k&&(this.roll+=this.rollSpeed*this.delta*m);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();f.copy(this.forward);e.set(0,1,0);c.cross(e,f).normalize();e.cross(f,c).normalize();this.matrix.n11=c.x;this.matrix.n12=e.x;this.matrix.n13=f.x;this.matrix.n21=c.y;this.matrix.n22=e.y;this.matrix.n23=f.y;this.matrix.n31=c.z;this.matrix.n32=e.z;this.matrix.n33=f.z;h.identity();h.n11=Math.cos(this.roll);h.n12=-Math.sin(this.roll);h.n21=Math.sin(this.roll);h.n22=Math.cos(this.roll);this.matrix.multiplySelf(h);
|
|
|
-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){c.set(this.matrix.n11,this.matrix.n21,this.matrix.n31);c.multiplyScalar(b);this.forward.subSelf(c);this.forward.normalize()};this.rotateVertically=function(b){e.set(this.matrix.n12,this.matrix.n22,this.matrix.n32);e.multiplyScalar(b);this.forward.addSelf(e);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",
|
|
|
-function(b){w=(b.clientX-x)/window.innerWidth;u=(b.clientY-p)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=1;break;case 2:n=-1}},!1);this.domElement.addEventListener("mouseup",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:n=0;break;case 2:n=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:n=1;break;case 37:case 65:t=-1;break;
|
|
|
-case 40:case 83:n=-1;break;case 39:case 68:t=1;break;case 81:k=!0;m=1;break;case 69:k=!0;m=-1;break;case 82:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:n=0;break;case 37:case 65:t=0;break;case 40:case 83:n=0;break;case 39:case 68:t=0;break;case 81:k=!1;break;case 69:k=!1;break;case 82:v=0;break;case 70:v=0}},!1)};
|
|
|
+0]}};this.domElement.addEventListener("mousemove",e(this,this.mousemove),!1);this.domElement.addEventListener("mousedown",e(this,this.mousedown),!1);this.domElement.addEventListener("mouseup",e(this,this.mouseup),!1);this.domElement.addEventListener("keydown",e(this,this.keydown),!1);this.domElement.addEventListener("keyup",e(this,this.keyup),!1);this.updateMovementVector();this.updateRotationVector()};
|
|
|
+THREE.RollControls=function(b,c){this.object=b;this.domElement=c!==void 0?c:document;this.mouseLook=!0;this.autoForward=!1;this.rollSpeed=this.movementSpeed=this.lookSpeed=1;this.constrainVertical=[-0.9,0.9];this.object.matrixAutoUpdate=!1;this.forward=new THREE.Vector3(0,0,1);this.roll=0;this.lastUpdate=-1;this.delta=0;var e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,k=new THREE.Matrix4,m=!1,n=1,p=0,u=0,w=0,t=0,x=0,v=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*x));b=this.delta*this.movementSpeed;this.object.translateZ(-b*(p>0||this.autoForward&&!(p<0)?1:p));this.object.translateX(b*u);this.object.translateY(b*w);m&&(this.roll+=this.rollSpeed*this.delta*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
|
|
|
+else if(this.forward.y<this.constrainVertical[0])this.forward.y=this.constrainVertical[0],this.forward.normalize();h.copy(this.forward);f.set(0,1,0);e.cross(f,h).normalize();f.cross(h,e).normalize();this.object.matrix.n11=e.x;this.object.matrix.n12=f.x;this.object.matrix.n13=h.x;this.object.matrix.n21=e.y;this.object.matrix.n22=f.y;this.object.matrix.n23=h.y;this.object.matrix.n31=e.z;this.object.matrix.n32=f.z;this.object.matrix.n33=h.z;k.identity();k.n11=Math.cos(this.roll);k.n12=-Math.sin(this.roll);
|
|
|
+k.n21=Math.sin(this.roll);k.n22=Math.cos(this.roll);this.object.matrix.multiplySelf(k);this.object.matrixWorldNeedsUpdate=!0;this.object.matrix.n14=this.object.position.x;this.object.matrix.n24=this.object.position.y;this.object.matrix.n34=this.object.position.z};this.translateX=function(b){this.object.position.x+=this.object.matrix.n11*b;this.object.position.y+=this.object.matrix.n21*b;this.object.position.z+=this.object.matrix.n31*b};this.translateY=function(b){this.object.position.x+=this.object.matrix.n12*
|
|
|
+b;this.object.position.y+=this.object.matrix.n22*b;this.object.position.z+=this.object.matrix.n32*b};this.translateZ=function(b){this.object.position.x-=this.object.matrix.n13*b;this.object.position.y-=this.object.matrix.n23*b;this.object.position.z-=this.object.matrix.n33*b};this.rotateHorizontally=function(b){e.set(this.object.matrix.n11,this.object.matrix.n21,this.object.matrix.n31);e.multiplyScalar(b);this.forward.subSelf(e);this.forward.normalize()};this.rotateVertically=function(b){f.set(this.object.matrix.n12,
|
|
|
+this.object.matrix.n22,this.object.matrix.n32);f.multiplyScalar(b);this.forward.addSelf(f);this.forward.normalize()};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(b){t=(b.clientX-v)/window.innerWidth;x=(b.clientY-A)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=1;break;case 2:p=-1}},!1);this.domElement.addEventListener("mouseup",
|
|
|
+function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:p=0;break;case 2:p=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:p=1;break;case 37:case 65:u=-1;break;case 40:case 83:p=-1;break;case 39:case 68:u=1;break;case 81:m=!0;n=1;break;case 69:m=!0;n=-1;break;case 82:w=1;break;case 70:w=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:p=0;break;case 37:case 65:u=0;break;case 40:case 83:p=
|
|
|
+0;break;case 39:case 68:u=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:w=0;break;case 70:w=0}},!1)};
|
|
|
THREE.TrackballControls=function(b){function c(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=parameters.domElement||document;this.screen=parameters.screen||{width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=parameters.radius||(this.screen.width+this.screen.height)/4;this.rotateSpeed=parameters.rotateSpeed||1;this.zoomSpeed=parameters.zoomSpeed||1.2;this.panSpeed=parameters.panSpeed||0.3;this.noZoom=parameters.noZoom||!1;this.noPan=
|
|
|
-parameters.noPan||!1;this.staticMoving=parameters.staticMoving||!1;this.dynamicDampingFactor=parameters.dynamicDampingFactor||0.2;this.minDistance=parameters.minDistance||0;this.maxDistance=parameters.maxDistance||Infinity;this.keys=parameters.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,h=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector2,t=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)};
|
|
|
+parameters.noPan||!1;this.staticMoving=parameters.staticMoving||!1;this.dynamicDampingFactor=parameters.dynamicDampingFactor||0.2;this.minDistance=parameters.minDistance||0;this.maxDistance=parameters.maxDistance||Infinity;this.keys=parameters.keys||[65,83,68];this.useTarget=!0;var e=!1,f=this.STATE.NONE,h=new THREE.Vector3,k=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector2,p=new THREE.Vector2,u=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,e){return new THREE.Vector2((b-this.screen.offsetLeft)/this.radius*0.5,(e-this.screen.offsetTop)/this.radius*0.5)};this.getMouseProjectionOnBall=function(b,e){var c=new THREE.Vector3((b-this.screen.width*0.5-this.screen.offsetLeft)/this.radius,(this.screen.height*0.5+this.screen.offsetTop-e)/this.radius,0),f=c.length();f>1?c.normalize():c.z=Math.sqrt(1-f*f);h=this.position.clone().subSelf(this.target.position);f=this.up.clone().setLength(c.y);f.addSelf(this.up.clone().crossSelf(h).setLength(c.x));
|
|
|
-f.addSelf(h.setLength(c.z));return f};this.rotateCamera=function(){var b=Math.acos(k.dot(m)/k.length()/m.length());if(b){var e=(new THREE.Vector3).cross(k,m).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,-b);c.multiplyVector3(h);c.multiplyVector3(this.up);c.multiplyVector3(m);this.staticMoving?k=m:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(k))}};this.zoomCamera=function(){var b=1+(t.y-n.y)*this.zoomSpeed;b!==1&&b>0&&(h.multiplyScalar(b),
|
|
|
-this.staticMoving?n=t:n.y+=(t.y-n.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=w.clone().subSelf(v);if(b.lengthSq()){b.multiplyScalar(h.length()*this.panSpeed);var e=h.clone().crossSelf(this.up).setLength(b.x);e.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(e);this.target.position.addSelf(e);this.staticMoving?v=w:v.addSelf(b.sub(w,v).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*
|
|
|
+f.addSelf(h.setLength(c.z));return f};this.rotateCamera=function(){var b=Math.acos(k.dot(m)/k.length()/m.length());if(b){var e=(new THREE.Vector3).cross(k,m).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,-b);c.multiplyVector3(h);c.multiplyVector3(this.up);c.multiplyVector3(m);this.staticMoving?k=m:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(k))}};this.zoomCamera=function(){var b=1+(p.y-n.y)*this.zoomSpeed;b!==1&&b>0&&(h.multiplyScalar(b),
|
|
|
+this.staticMoving?n=p:n.y+=(p.y-n.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=w.clone().subSelf(u);if(b.lengthSq()){b.multiplyScalar(h.length()*this.panSpeed);var e=h.clone().crossSelf(this.up).setLength(b.x);e.addSelf(this.up.clone().setLength(b.y));this.position.addSelf(e);this.target.position.addSelf(e);this.staticMoving?u=w:u.addSelf(b.sub(w,u).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.position.lengthSq()>this.maxDistance*
|
|
|
this.maxDistance&&this.position.setLength(this.maxDistance),h.lengthSq()<this.minDistance*this.minDistance&&this.position.add(this.target.position,h.setLength(this.minDistance))};this.update=function(b,e,c){h=this.position.clone().subSelf(this.target.position);this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.position.add(this.target.position,h);this.checkDistances();this.supr.update.call(this,b,e,c)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},
|
|
|
-!1);this.domElement.addEventListener("mousemove",c(this,function(b){e&&(k=m=this.getMouseProjectionOnBall(b.clientX,b.clientY),n=t=this.getMouseOnScreen(b.clientX,b.clientY),v=w=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?m=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?t=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(w=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",
|
|
|
-c(this,function(b){b.preventDefault();b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?k=m=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=t=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===
|
|
|
+!1);this.domElement.addEventListener("mousemove",c(this,function(b){e&&(k=m=this.getMouseProjectionOnBall(b.clientX,b.clientY),n=p=this.getMouseOnScreen(b.clientX,b.clientY),u=w=this.getMouseOnScreen(b.clientX,b.clientY),e=!1);f!==this.STATE.NONE&&(f===this.STATE.ROTATE?m=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?p=this.getMouseOnScreen(b.clientX,b.clientY):f===this.STATE.PAN&&!this.noPan&&(w=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",
|
|
|
+c(this,function(b){b.preventDefault();b.stopPropagation();if(f===this.STATE.NONE)f=b.button,f===this.STATE.ROTATE?k=m=this.getMouseProjectionOnBall(b.clientX,b.clientY):f===this.STATE.ZOOM&&!this.noZoom?n=p=this.getMouseOnScreen(b.clientX,b.clientY):this.noPan||(u=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.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
|
|
|
-THREE.CubeGeometry=function(b,c,e,f,h,k,m,n,t){function v(b,e,c,m,n,p,u,t){var v,x,y=f||1,A=h||1,R=n/2,S=p/2,Y=w.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",A=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",y=k||1;var W=y+1,o=A+1;n/=y;var ea=p/A;for(x=0;x<o;x++)for(p=0;p<W;p++){var Q=new THREE.Vector3;Q[b]=(p*n-R)*c;Q[e]=(x*ea-S)*m;Q[v]=u;w.vertices.push(new THREE.Vertex(Q))}for(x=0;x<A;x++)for(p=0;p<y;p++)w.faces.push(new THREE.Face4(p+W*
|
|
|
-x+Y,p+W*(x+1)+Y,p+1+W*(x+1)+Y,p+1+W*x+Y,null,null,t)),w.faceVertexUvs[0].push([new THREE.UV(p/y,x/A),new THREE.UV(p/y,(x+1)/A),new THREE.UV((p+1)/y,(x+1)/A),new THREE.UV((p+1)/y,x/A)])}THREE.Geometry.call(this);var w=this,u=b/2,x=c/2,p=e/2,n=n?-1:1;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var y=0;y<6;y++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(t!=void 0)for(var A in t)this.sides[A]!=void 0&&(this.sides[A]=
|
|
|
-t[A]);this.sides.px&&v("z","y",1*n,-1,e,c,-u,this.materials[0]);this.sides.nx&&v("z","y",-1*n,-1,e,c,u,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]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.CubeGeometry=function(b,c,e,f,h,k,m,n,p){function u(b,e,c,m,n,p,t,u){var v,x,z=f||1,A=h||1,Q=n/2,R=p/2,Y=w.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")v="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")v="y",A=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",z=k||1;var V=z+1,o=A+1;n/=z;var ea=p/A;for(x=0;x<o;x++)for(p=0;p<V;p++){var P=new THREE.Vector3;P[b]=(p*n-Q)*c;P[e]=(x*ea-R)*m;P[v]=t;w.vertices.push(new THREE.Vertex(P))}for(x=0;x<A;x++)for(p=0;p<z;p++)w.faces.push(new THREE.Face4(p+V*
|
|
|
+x+Y,p+V*(x+1)+Y,p+1+V*(x+1)+Y,p+1+V*x+Y,null,null,u)),w.faceVertexUvs[0].push([new THREE.UV(p/z,x/A),new THREE.UV(p/z,(x+1)/A),new THREE.UV((p+1)/z,(x+1)/A),new THREE.UV((p+1)/z,x/A)])}THREE.Geometry.call(this);var w=this,t=b/2,x=c/2,v=e/2,n=n?-1:1;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var A=0;A<6;A++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(p!=void 0)for(var z in p)this.sides[z]!=void 0&&(this.sides[z]=
|
|
|
+p[z]);this.sides.px&&u("z","y",1*n,-1,e,c,-t,this.materials[0]);this.sides.nx&&u("z","y",-1*n,-1,e,c,t,this.materials[1]);this.sides.py&&u("x","z",1*n,1,b,e,x,this.materials[2]);this.sides.ny&&u("x","z",1*n,-1,b,e,-x,this.materials[3]);this.sides.pz&&u("x","y",1*n,-1,b,c,v,this.materials[4]);this.sides.nz&&u("x","y",-1*n,-1,b,c,-v,this.materials[5]);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
-THREE.CylinderGeometry=function(b,c,e,f,h,k){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,m=e/2,f=f||8,h=h||1,n,t,v=[],w=[];for(t=0;t<=h;t++){var u=[],x=[],p=t/h,y=p*(c-b)+b;for(n=0;n<=f;n++){var A=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(y*Math.sin(A*Math.PI*2),-p*e+m,y*Math.cos(A*Math.PI*2))));u.push(this.vertices.length-1);x.push(new THREE.UV(A,p))}v.push(u);w.push(x)}for(t=0;t<h;t++)for(n=0;n<f;n++){var e=v[t][n],u=v[t+1][n],x=v[t+1][n+1],p=v[t][n+1],y=
|
|
|
-this.vertices[e].position.clone().setY(0).normalize(),A=this.vertices[u].position.clone().setY(0).normalize(),z=this.vertices[x].position.clone().setY(0).normalize(),E=this.vertices[p].position.clone().setY(0).normalize(),F=w[t][n].clone(),D=w[t+1][n].clone(),H=w[t+1][n+1].clone(),N=w[t][n+1].clone();this.faces.push(new THREE.Face4(e,u,x,p,[y,A,z,E]));this.faceVertexUvs[0].push([F,D,H,N])}if(!k&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n<f;n++)e=v[0][n],u=v[0][n+
|
|
|
-1],x=this.vertices.length-1,y=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),F=w[0][n].clone(),D=w[0][n+1].clone(),H=new THREE.UV(D.u,0),this.faces.push(new THREE.Face3(e,u,x,[y,A,z])),this.faceVertexUvs[0].push([F,D,H])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=v[t][n+1],u=v[t][n],x=this.vertices.length-1,y=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),F=w[t][n+1].clone(),D=w[t][n].clone(),
|
|
|
-H=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,u,x,[y,A,z])),this.faceVertexUvs[0].push([F,D,H])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+THREE.CylinderGeometry=function(b,c,e,f,h,k){THREE.Geometry.call(this);var b=b!=null?b:20,c=c!=null?c:20,e=e||100,m=e/2,f=f||8,h=h||1,n,p,u=[],w=[];for(p=0;p<=h;p++){var t=[],x=[],v=p/h,A=v*(c-b)+b;for(n=0;n<=f;n++){var z=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(A*Math.sin(z*Math.PI*2),-v*e+m,A*Math.cos(z*Math.PI*2))));t.push(this.vertices.length-1);x.push(new THREE.UV(z,v))}u.push(t);w.push(x)}for(p=0;p<h;p++)for(n=0;n<f;n++){var e=u[p][n],t=u[p+1][n],x=u[p+1][n+1],v=u[p][n+1],A=
|
|
|
+this.vertices[e].position.clone().setY(0).normalize(),z=this.vertices[t].position.clone().setY(0).normalize(),y=this.vertices[x].position.clone().setY(0).normalize(),E=this.vertices[v].position.clone().setY(0).normalize(),F=w[p][n].clone(),D=w[p+1][n].clone(),H=w[p+1][n+1].clone(),L=w[p][n+1].clone();this.faces.push(new THREE.Face4(e,t,x,v,[A,z,y,E]));this.faceVertexUvs[0].push([F,D,H,L])}if(!k&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,m,0)));for(n=0;n<f;n++)e=u[0][n],t=u[0][n+
|
|
|
+1],x=this.vertices.length-1,A=new THREE.Vector3(0,1,0),z=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),F=w[0][n].clone(),D=w[0][n+1].clone(),H=new THREE.UV(D.u,0),this.faces.push(new THREE.Face3(e,t,x,[A,z,y])),this.faceVertexUvs[0].push([F,D,H])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=u[p][n+1],t=u[p][n],x=this.vertices.length-1,A=new THREE.Vector3(0,-1,0),z=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),F=w[p][n+1].clone(),D=w[p][n].clone(),
|
|
|
+H=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,t,x,[A,z,y])),this.faceVertexUvs[0].push([F,D,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,e,c){e||console.log("die");return e.clone().multiplyScalar(c).addSelf(b)}function f(b,e,c){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-e.x,b.y-e.y);h.set(b.x-c.x,b.y-c.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(e).addSelf(k);o.copy(c).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 e=Math.atan2(e.y-b.y,e.x-b.x),b=Math.atan2(c.y-b.y,c.x-b.x),e>b&&(b+=Math.PI*2),anglec=(e+b)/2,new THREE.Vector2(-Math.cos(anglec),-Math.sin(anglec));return f.multiplyScalar(m).addSelf(n).subSelf(b).clone()}function h(b){for(J=b.length;--J>=0;){ka=J;fa=J-1;fa<0&&(fa=b.length-
|
|
|
-1);for(var e=0,c=p+w*2,e=0;e<c;e++){var f=ea*e,h=ea*(e+1),k=ca+ka+f,m=ca+ka+h,o=k,f=ca+fa+f,h=ca+fa+h,u=m;o+=da;f+=da;h+=da;u+=da;B.faces.push(new THREE.Face4(o,f,h,u,null,null,H));H&&(o=e/c,f=(e+1)/c,h=n+t*2,k=(B.vertices[k].position.z+t)/h,m=(B.vertices[m].position.z+t)/h,B.faceVertexUvs[0].push([new THREE.UV(k,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(k,f)]))}}}function k(b,e,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=da;e+=da;c+=da;B.faces.push(new THREE.Face3(b,
|
|
|
-e,c,null,null,D));if(D){var f=N.maxY,h=N.maxX,k=B.vertices[e].position.x,e=B.vertices[e].position.y,m=B.vertices[c].position.x,c=B.vertices[c].position.y;B.faceVertexUvs[0].push([new THREE.UV(B.vertices[b].position.x/h,B.vertices[b].position.y/f),new THREE.UV(k/h,e/f),new THREE.UV(m/h,c/f)])}}var n=c.amount!==void 0?c.amount:100,t=c.bevelThickness!==void 0?c.bevelThickness:6,v=c.bevelSize!==void 0?c.bevelSize:t-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,u=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,A=c.extrudePath,z,E=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,H=c.extrudeMaterial,N=this.shapebb;if(A)z=A.getPoints(x),p=z.length,E=!0,u=!1;u||(v=t=w=0);var O,K,G,B=this,da=this.vertices.length;y&&b.addWrapPath(y);x=F?b.extractAllSpacedPoints(x):b.extractAllPoints(x);y=x.shape;x=x.holes;if(A=!THREE.Shape.Utils.isClockWise(y)){y=y.reverse();K=0;for(G=x.length;K<G;K++)O=x[K],THREE.Shape.Utils.isClockWise(O)&&
|
|
|
-(x[K]=O.reverse());A=!1}A=THREE.Shape.Utils.triangulateShape(y,x);F=y;K=0;for(G=x.length;K<G;K++)O=x[K],y=y.concat(O);var J,R,S,Y,W,o,ea=y.length,Q=A.length,ma=[];J=0;R=F.length;ka=R-1;for(fa=J+1;J<R;J++,ka++,fa++)ka==R&&(ka=0),fa==R&&(fa=0),ma[J]=f(F[J],F[ka],F[fa]);var Z=[],ia,aa=ma.concat();K=0;for(G=x.length;K<G;K++){O=x[K];ia=[];J=0;R=O.length;ka=R-1;for(fa=J+1;J<R;J++,ka++,fa++)ka==R&&(ka=0),fa==R&&(fa=0),ia[J]=f(O[J],O[ka],O[fa]);Z.push(ia);aa=aa.concat(ia)}for(S=0;S<w;S++){Y=S/w;W=t*(1-Y);
|
|
|
-Y=v*Math.sin(Y*Math.PI/2);J=0;for(R=F.length;J<R;J++)o=e(F[J],ma[J],Y),k(o.x,o.y,-W);K=0;for(G=x.length;K<G;K++){O=x[K];ia=Z[K];J=0;for(R=O.length;J<R;J++)o=e(O[J],ia[J],Y),k(o.x,o.y,-W)}}Y=v;for(J=0;J<ea;J++)o=u?e(y[J],aa[J],Y):y[J],E?k(o.x,o.y+z[0].y,z[0].x):k(o.x,o.y,0);for(S=1;S<=p;S++)for(J=0;J<ea;J++)o=u?e(y[J],aa[J],Y):y[J],E?k(o.x,o.y+z[S-1].y,z[S-1].x):k(o.x,o.y,n/p*S);for(S=w-1;S>=0;S--){Y=S/w;W=t*(1-Y);Y=v*Math.sin(Y*Math.PI/2);J=0;for(R=F.length;J<R;J++)o=e(F[J],ma[J],Y),k(o.x,o.y,n+W);
|
|
|
-K=0;for(G=x.length;K<G;K++){O=x[K];ia=Z[K];J=0;for(R=O.length;J<R;J++)o=e(O[J],ia[J],Y),E?k(o.x,o.y+z[p-1].y,z[p-1].x+W):k(o.x,o.y,n+W)}}if(u){u=ea*0;for(J=0;J<Q;J++)v=A[J],m(v[2]+u,v[1]+u,v[0]+u);u=ea*(p+w*2);for(J=0;J<Q;J++)v=A[J],m(v[0]+u,v[1]+u,v[2]+u)}else{for(J=0;J<Q;J++)v=A[J],m(v[2],v[1],v[0]);for(J=0;J<Q;J++)v=A[J],m(v[0]+ea*p,v[1]+ea*p,v[2]+ea*p)}var ka,fa,ca=0;h(F);ca+=F.length;K=0;for(G=x.length;K<G;K++)O=x[K],h(O),ca+=O.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
+1);for(var e=0,c=v+w*2,e=0;e<c;e++){var f=ea*e,k=ea*(e+1),h=ca+ka+f,m=ca+ka+k,o=h,f=ca+fa+f,k=ca+fa+k,t=m;o+=da;f+=da;k+=da;t+=da;B.faces.push(new THREE.Face4(o,f,k,t,null,null,H));H&&(o=e/c,f=(e+1)/c,k=n+p*2,h=(B.vertices[h].position.z+p)/k,m=(B.vertices[m].position.z+p)/k,B.faceVertexUvs[0].push([new THREE.UV(h,o),new THREE.UV(m,o),new THREE.UV(m,f),new THREE.UV(h,f)]))}}}function k(b,e,c){B.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=da;e+=da;c+=da;B.faces.push(new THREE.Face3(b,
|
|
|
+e,c,null,null,D));if(D){var f=L.maxY,k=L.maxX,h=B.vertices[e].position.x,e=B.vertices[e].position.y,m=B.vertices[c].position.x,c=B.vertices[c].position.y;B.faceVertexUvs[0].push([new THREE.UV(B.vertices[b].position.x/k,B.vertices[b].position.y/f),new THREE.UV(h/k,e/f),new THREE.UV(m/k,c/f)])}}var n=c.amount!==void 0?c.amount:100,p=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:p-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,v=c.steps!==void 0?c.steps:1,A=c.bendPath,z=c.extrudePath,y,E=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,H=c.extrudeMaterial,L=this.shapebb;if(z)y=z.getPoints(x),v=y.length,E=!0,t=!1;t||(u=p=w=0);var M,K,G,B=this,da=this.vertices.length;A&&b.addWrapPath(A);x=F?b.extractAllSpacedPoints(x):b.extractAllPoints(x);A=x.shape;x=x.holes;if(z=!THREE.Shape.Utils.isClockWise(A)){A=A.reverse();K=0;for(G=x.length;K<G;K++)M=x[K],THREE.Shape.Utils.isClockWise(M)&&
|
|
|
+(x[K]=M.reverse());z=!1}z=THREE.Shape.Utils.triangulateShape(A,x);F=A;K=0;for(G=x.length;K<G;K++)M=x[K],A=A.concat(M);var J,Q,R,Y,V,o,ea=A.length,P=z.length,ma=[];J=0;Q=F.length;ka=Q-1;for(fa=J+1;J<Q;J++,ka++,fa++)ka==Q&&(ka=0),fa==Q&&(fa=0),ma[J]=f(F[J],F[ka],F[fa]);var Z=[],ia,aa=ma.concat();K=0;for(G=x.length;K<G;K++){M=x[K];ia=[];J=0;Q=M.length;ka=Q-1;for(fa=J+1;J<Q;J++,ka++,fa++)ka==Q&&(ka=0),fa==Q&&(fa=0),ia[J]=f(M[J],M[ka],M[fa]);Z.push(ia);aa=aa.concat(ia)}for(R=0;R<w;R++){Y=R/w;V=p*(1-Y);
|
|
|
+Y=u*Math.sin(Y*Math.PI/2);J=0;for(Q=F.length;J<Q;J++)o=e(F[J],ma[J],Y),k(o.x,o.y,-V);K=0;for(G=x.length;K<G;K++){M=x[K];ia=Z[K];J=0;for(Q=M.length;J<Q;J++)o=e(M[J],ia[J],Y),k(o.x,o.y,-V)}}Y=u;for(J=0;J<ea;J++)o=t?e(A[J],aa[J],Y):A[J],E?k(o.x,o.y+y[0].y,y[0].x):k(o.x,o.y,0);for(R=1;R<=v;R++)for(J=0;J<ea;J++)o=t?e(A[J],aa[J],Y):A[J],E?k(o.x,o.y+y[R-1].y,y[R-1].x):k(o.x,o.y,n/v*R);for(R=w-1;R>=0;R--){Y=R/w;V=p*(1-Y);Y=u*Math.sin(Y*Math.PI/2);J=0;for(Q=F.length;J<Q;J++)o=e(F[J],ma[J],Y),k(o.x,o.y,n+V);
|
|
|
+K=0;for(G=x.length;K<G;K++){M=x[K];ia=Z[K];J=0;for(Q=M.length;J<Q;J++)o=e(M[J],ia[J],Y),E?k(o.x,o.y+y[v-1].y,y[v-1].x+V):k(o.x,o.y,n+V)}}if(t){t=ea*0;for(J=0;J<P;J++)u=z[J],m(u[2]+t,u[1]+t,u[0]+t);t=ea*(v+w*2);for(J=0;J<P;J++)u=z[J],m(u[0]+t,u[1]+t,u[2]+t)}else{for(J=0;J<P;J++)u=z[J],m(u[2],u[1],u[0]);for(J=0;J<P;J++)u=z[J],m(u[0]+ea*v,u[1]+ea*v,u[2]+ea*v)}var ka,fa,ca=0;h(F);ca+=F.length;K=0;for(G=x.length;K<G;K++)M=x[K],h(M),ca+=M.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,e,c){var f=Math.sqrt(b*b+e*e+c*c);return h.vertices.push(new THREE.Vertex(new THREE.Vector3(b/f,e/f,c/f)))-1}function e(b,e,c,f){f.faces.push(new THREE.Face3(b,e,c))}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,k=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,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(var m=0;m<this.subdivisions;m++){var b=new THREE.Geometry,n;for(n in k.faces){var t=f(k.faces[n].a,k.faces[n].b),v=f(k.faces[n].b,k.faces[n].c),w=f(k.faces[n].c,k.faces[n].a);e(k.faces[n].a,t,w,b);e(k.faces[n].b,v,
|
|
|
-t,b);e(k.faces[n].c,w,v,b);e(t,v,w,b)}k.faces=b.faces}h.faces=k.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=[],k=[],m=(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 t=0;t<=this.angle+0.0010;t+=c){for(n=0;n<e.length;n++)t<this.angle?(e[n]=m.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),h[n]=this.vertices.length-1):h=k;t==0&&(k=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-t/this.angle,n/b.length),new THREE.UV(1-t/this.angle,(n+1)/b.length),new THREE.UV(1-(t-c)/this.angle,(n+1)/b.length),new THREE.UV(1-(t-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;
|
|
|
+-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,k);e(0,5,1,k);e(0,1,7,k);e(0,7,10,k);e(0,10,11,k);e(1,5,9,k);e(5,11,4,k);e(11,10,2,k);e(10,7,6,k);e(7,1,8,k);e(3,9,4,k);e(3,4,2,k);e(3,2,6,k);e(3,6,8,k);e(3,8,9,k);e(4,9,5,k);e(2,4,11,k);e(6,2,10,k);e(8,6,7,k);e(9,8,1,k);for(var m=0;m<this.subdivisions;m++){var b=new THREE.Geometry,n;for(n in k.faces){var p=f(k.faces[n].a,k.faces[n].b),u=f(k.faces[n].b,k.faces[n].c),w=f(k.faces[n].c,k.faces[n].a);e(k.faces[n].a,p,w,b);e(k.faces[n].b,u,
|
|
|
+p,b);e(k.faces[n].c,w,u,b);e(p,u,w,b)}k.faces=b.faces}h.faces=k.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=[],k=[],m=(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 p=0;p<=this.angle+0.0010;p+=c){for(n=0;n<e.length;n++)p<this.angle?(e[n]=m.multiplyVector3(e[n].clone()),this.vertices.push(new THREE.Vertex(e[n])),h[n]=this.vertices.length-1):h=k;p==0&&(k=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-p/this.angle,n/b.length),new THREE.UV(1-p/this.angle,(n+1)/b.length),new THREE.UV(1-(p-c)/this.angle,(n+1)/b.length),new THREE.UV(1-(p-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.OctahedronGeometry=function(b,c){function e(e){var c=e.clone().normalize(),c=new THREE.Vertex(c.clone().multiplyScalar(b));c.index=m.vertices.push(c)-1;c.uv=new THREE.UV(Math.atan2(e.z,-e.x)/2/Math.PI+0.5,Math.atan2(-e.y,Math.sqrt(e.x*e.x+e.z*e.z))/Math.PI+0.5);return c}function f(b,e,c,n){n<1?(n=new THREE.Face3(b.index,e.index,c.index,[b.position,e.position,c.position]),n.centroid.addSelf(b.position).addSelf(e.position).addSelf(c.position).divideScalar(3),n.normal=n.centroid.clone().normalize(),
|
|
|
m.faces.push(n),n=Math.atan2(n.centroid.z,-n.centroid.x),m.faceVertexUvs[0].push([k(b.uv,b.position,n),k(e.uv,e.position,n),k(c.uv,c.position,n)])):(n-=1,f(b,h(b,e),h(b,c),n),f(h(b,e),e,h(e,c),n),f(h(b,c),h(e,c),c,n),f(h(b,e),h(e,c),h(b,c),n))}function h(b,c){n[b.index]||(n[b.index]=[]);n[c.index]||(n[c.index]=[]);var f=n[b.index][c.index];f===void 0&&(n[b.index][c.index]=n[c.index][b.index]=f=e((new THREE.Vector3).add(b.position,c.position).divideScalar(2)));return f}function k(b,e,c){c<0&&b.u===
|
|
|
-1&&(b=new THREE.UV(b.u-1,b.v));e.x===0&&e.z===0&&(b=new THREE.UV(c/2/Math.PI+0.5,b.v));return b}THREE.Geometry.call(this);var c=isFinite(c)?c:3,m=this;e(new THREE.Vector3(1,0,0));e(new THREE.Vector3(-1,0,0));e(new THREE.Vector3(0,1,0));e(new THREE.Vector3(0,-1,0));e(new THREE.Vector3(0,0,1));e(new THREE.Vector3(0,0,-1));var n=[],t=this.vertices;f(t[0],t[2],t[4],c);f(t[0],t[4],t[3],c);f(t[0],t[3],t[5],c);f(t[0],t[5],t[2],c);f(t[1],t[2],t[5],c);f(t[1],t[5],t[3],c);f(t[1],t[3],t[4],c);f(t[1],t[4],t[2],
|
|
|
+1&&(b=new THREE.UV(b.u-1,b.v));e.x===0&&e.z===0&&(b=new THREE.UV(c/2/Math.PI+0.5,b.v));return b}THREE.Geometry.call(this);var c=isFinite(c)?c:3,m=this;e(new THREE.Vector3(1,0,0));e(new THREE.Vector3(-1,0,0));e(new THREE.Vector3(0,1,0));e(new THREE.Vector3(0,-1,0));e(new THREE.Vector3(0,0,1));e(new THREE.Vector3(0,0,-1));var n=[],p=this.vertices;f(p[0],p[2],p[4],c);f(p[0],p[4],p[3],c);f(p[0],p[3],p[5],c);f(p[0],p[5],p[2],c);f(p[1],p[2],p[5],c);f(p[1],p[5],p[3],c);f(p[1],p[3],p[4],c);f(p[1],p[4],p[2],
|
|
|
c);this.boundingSphere={radius:b}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
|
-THREE.PlaneGeometry=function(b,c,e,f){THREE.Geometry.call(this);var h,k=b/2,m=c/2,e=e||1,f=f||1,n=e+1,t=f+1;b/=e;var v=c/f;for(h=0;h<t;h++)for(c=0;c<n;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-k,-(h*v-m),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=function(b,c,e,f){THREE.Geometry.call(this);var h,k=b/2,m=c/2,e=e||1,f=f||1,n=e+1,p=f+1;b/=e;var u=c/f;for(h=0;h<p;h++)for(c=0;c<n;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*b-k,-(h*u-m),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,k=Math.max(3,c||8),m=Math.max(2,e||6),c=[],e=0;e<m+1;e++){f=e/m;var n=b*Math.cos(f*h),t=b*Math.sin(f*h),v=[],w=0;for(f=0;f<k;f++){var u=2*f/k,x=t*Math.sin(u*h),u=t*Math.cos(u*h);(e==0||e==m)&&f>0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(u,n,x)))-1);v.push(w)}c.push(v)}for(var p,y,A,h=c.length,e=0;e<h;e++)if(k=c[e].length,e>0)for(f=0;f<k;f++){v=f==k-1;m=c[e][v?0:f+1];n=c[e][v?k-1:f];t=c[e-1][v?
|
|
|
-k-1:f];v=c[e-1][v?0:f+1];x=e/(h-1);p=(e-1)/(h-1);y=(f+1)/k;var u=f/k,w=new THREE.UV(1-y,x),x=new THREE.UV(1-u,x),u=new THREE.UV(1-u,p),z=new THREE.UV(1-y,p);e<c.length-1&&(p=this.vertices[m].position.clone(),y=this.vertices[n].position.clone(),A=this.vertices[t].position.clone(),p.normalize(),y.normalize(),A.normalize(),this.faces.push(new THREE.Face3(m,n,t,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([w,x,u]));e>1&&(p=
|
|
|
-this.vertices[m].position.clone(),y=this.vertices[t].position.clone(),A=this.vertices[v].position.clone(),p.normalize(),y.normalize(),A.normalize(),this.faces.push(new THREE.Face3(m,t,v,[new THREE.Vector3(p.x,p.y,p.z),new THREE.Vector3(y.x,y.y,y.z),new THREE.Vector3(A.x,A.y,A.z)])),this.faceVertexUvs[0].push([w,u,z]))}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,k=Math.max(3,c||8),m=Math.max(2,e||6),c=[],e=0;e<m+1;e++){f=e/m;var n=b*Math.cos(f*h),p=b*Math.sin(f*h),u=[],w=0;for(f=0;f<k;f++){var t=2*f/k,x=p*Math.sin(t*h),t=p*Math.cos(t*h);(e==0||e==m)&&f>0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(t,n,x)))-1);u.push(w)}c.push(u)}for(var v,A,z,h=c.length,e=0;e<h;e++)if(k=c[e].length,e>0)for(f=0;f<k;f++){u=f==k-1;m=c[e][u?0:f+1];n=c[e][u?k-1:f];p=c[e-1][u?
|
|
|
+k-1:f];u=c[e-1][u?0:f+1];x=e/(h-1);v=(e-1)/(h-1);A=(f+1)/k;var t=f/k,w=new THREE.UV(1-A,x),x=new THREE.UV(1-t,x),t=new THREE.UV(1-t,v),y=new THREE.UV(1-A,v);e<c.length-1&&(v=this.vertices[m].position.clone(),A=this.vertices[n].position.clone(),z=this.vertices[p].position.clone(),v.normalize(),A.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,n,p,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,x,t]));e>1&&(v=
|
|
|
+this.vertices[m].position.clone(),A=this.vertices[p].position.clone(),z=this.vertices[u].position.clone(),v.normalize(),A.normalize(),z.normalize(),this.faces.push(new THREE.Face3(m,p,u,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(A.x,A.y,A.z),new THREE.Vector3(z.x,z.y,z.z)])),this.faceVertexUvs[0].push([w,t,y]))}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(""),k=h.length,m=[],b=0;b<k;b++){var n=new THREE.Path,n=this.extractGlyphPoints(h[b],c,e,f,n);f+=n.offset;m.push(n.path)}return{paths:m,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var k=[],m,n,t,v,w,u,x,p,y,A,z=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(z){if(z.o){c=z._cachedOutline||(z._cachedOutline=z.o.split(" "));t=c.length;for(b=0;b<t;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;v=c[b++]*e;k.push(new THREE.Vector2(n,
|
|
|
-v));h.moveTo(n,v);break;case "l":n=c[b++]*e+f;v=c[b++]*e;k.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(m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var E=m/divisions,F=THREE.Shape.Utils.b2(E,w,x,n),E=THREE.Shape.Utils.b2(E,u,p,v);k.push(new THREE.Vector2(F,E))}}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,A=c[b++]*-e,h.bezierCurveTo(n,v,
|
|
|
-x,p,y,A),m=k[k.length-1]){w=m.x;u=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)E=m/divisions,F=THREE.Shape.Utils.b3(E,w,x,y,n),E=THREE.Shape.Utils.b3(E,u,p,A,v),k.push(new THREE.Vector2(F,E))}}}return{offset:z.ha*e,points:k,path:h}}}};
|
|
|
-(function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,m=0;m<c;k=m++)h+=b[k].x*b[m].y-b[m].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],m=[],n=[],t,v,w;if(c(b)>0)for(v=0;v<h;v++)m[v]=v;else for(v=0;v<h;v++)m[v]=h-1-v;var u=2*h;for(v=h-1;h>2;){if(u--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}t=v;h<=t&&(t=0);v=t+1;h<=v&&(v=0);w=v+1;h<=w&&(w=0);var x;a:{x=b;var p=t,y=v,A=w,z=h,E=m,F=void 0,D=void 0,H=void 0,
|
|
|
-N=void 0,O=void 0,K=void 0,G=void 0,B=void 0,da=void 0,D=x[E[p]].x,H=x[E[p]].y,N=x[E[y]].x,O=x[E[y]].y,K=x[E[A]].x,G=x[E[A]].y;if(1.0E-10>(N-D)*(G-H)-(O-H)*(K-D))x=!1;else{for(F=0;F<z;F++)if(!(F==p||F==y||F==A)){var B=x[E[F]].x,da=x[E[F]].y,J=void 0,R=void 0,S=void 0,Y=void 0,W=void 0,o=void 0,ea=void 0,Q=void 0,ma=void 0,Z=void 0,ia=void 0,aa=void 0,J=S=W=void 0,J=K-N,R=G-O,S=D-K,Y=H-G,W=N-D,o=O-H,ea=B-D,Q=da-H,ma=B-N,Z=da-O,ia=B-K,aa=da-G,J=J*Z-R*ma,W=W*Q-o*ea,S=S*aa-Y*ia;if(J>=0&&S>=0&&W>=0){x=
|
|
|
-!1;break a}}x=!0}}if(x){k.push([b[m[t]],b[m[v]],b[m[w]]]);n.push([m[t],m[v],m[w]]);t=v;for(w=v+1;w<h;t++,w++)m[t]=m[w];h--;u=2*h}}if(f)return n;return k};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(""),k=h.length,m=[],b=0;b<k;b++){var n=new THREE.Path,n=this.extractGlyphPoints(h[b],c,e,f,n);f+=n.offset;m.push(n.path)}return{paths:m,offset:f/2}},extractGlyphPoints:function(b,c,e,f,h){var k=[],m,n,p,u,w,t,x,v,A,z,y=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(y){if(y.o){c=y._cachedOutline||(y._cachedOutline=y.o.split(" "));p=c.length;for(b=0;b<p;)switch(n=c[b++],n){case "m":n=c[b++]*e+f;u=c[b++]*e;k.push(new THREE.Vector2(n,
|
|
|
+u));h.moveTo(n,u);break;case "l":n=c[b++]*e+f;u=c[b++]*e;k.push(new THREE.Vector2(n,u));h.lineTo(n,u);break;case "q":n=c[b++]*e+f;u=c[b++]*e;x=c[b++]*e+f;v=c[b++]*e;h.quadraticCurveTo(x,v,n,u);if(m=k[k.length-1]){w=m.x;t=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var E=m/divisions,F=THREE.Shape.Utils.b2(E,w,x,n),E=THREE.Shape.Utils.b2(E,t,v,u);k.push(new THREE.Vector2(F,E))}}break;case "b":if(n=c[b++]*e+f,u=c[b++]*e,x=c[b++]*e+f,v=c[b++]*-e,A=c[b++]*e+f,z=c[b++]*-e,h.bezierCurveTo(n,u,
|
|
|
+x,v,A,z),m=k[k.length-1]){w=m.x;t=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)E=m/divisions,F=THREE.Shape.Utils.b3(E,w,x,A,n),E=THREE.Shape.Utils.b3(E,t,v,z,u),k.push(new THREE.Vector2(F,E))}}}return{offset:y.ha*e,points:k,path:h}}}};
|
|
|
+(function(b){var c=function(b){for(var c=b.length,h=0,k=c-1,m=0;m<c;k=m++)h+=b[k].x*b[m].y-b[m].x*b[k].y;return h*0.5};b.Triangulate=function(b,f){var h=b.length;if(h<3)return null;var k=[],m=[],n=[],p,u,w;if(c(b)>0)for(u=0;u<h;u++)m[u]=u;else for(u=0;u<h;u++)m[u]=h-1-u;var t=2*h;for(u=h-1;h>2;){if(t--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}p=u;h<=p&&(p=0);u=p+1;h<=u&&(u=0);w=u+1;h<=w&&(w=0);var x;a:{x=b;var v=p,A=u,z=w,y=h,E=m,F=void 0,D=void 0,H=void 0,
|
|
|
+L=void 0,M=void 0,K=void 0,G=void 0,B=void 0,da=void 0,D=x[E[v]].x,H=x[E[v]].y,L=x[E[A]].x,M=x[E[A]].y,K=x[E[z]].x,G=x[E[z]].y;if(1.0E-10>(L-D)*(G-H)-(M-H)*(K-D))x=!1;else{for(F=0;F<y;F++)if(!(F==v||F==A||F==z)){var B=x[E[F]].x,da=x[E[F]].y,J=void 0,Q=void 0,R=void 0,Y=void 0,V=void 0,o=void 0,ea=void 0,P=void 0,ma=void 0,Z=void 0,ia=void 0,aa=void 0,J=R=V=void 0,J=K-L,Q=G-M,R=D-K,Y=H-G,V=L-D,o=M-H,ea=B-D,P=da-H,ma=B-L,Z=da-M,ia=B-K,aa=da-G,J=J*Z-Q*ma,V=V*P-o*ea,R=R*aa-Y*ia;if(J>=0&&R>=0&&V>=0){x=
|
|
|
+!1;break a}}x=!0}}if(x){k.push([b[m[p]],b[m[u]],b[m[w]]]);n.push([m[p],m[u],m[w]]);p=u;for(w=u+1;w<h;p++,w++)m[p]=m[w];h--;t=2*h}}if(f)return n;return k};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 k=f/this.segmentsT*this.arc,m=e/this.segmentsR*Math.PI*2;h.x=this.radius*Math.cos(k);h.y=this.radius*Math.sin(k);var n=new THREE.Vector3;n.x=(this.radius+this.tube*Math.cos(m))*Math.cos(k);n.y=(this.radius+this.tube*Math.cos(m))*Math.sin(k);n.z=
|
|
|
-this.tube*Math.sin(m);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,k=(this.segmentsT+1)*(e-1)+f-1,m=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,t=new THREE.Face4(h,k,m,n,[c[h],c[k],c[m],c[n]]);t.normal.addSelf(c[h]);t.normal.addSelf(c[k]);t.normal.addSelf(c[m]);t.normal.addSelf(c[n]);t.normal.normalize();this.faces.push(t);
|
|
|
+this.tube*Math.sin(m);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,k=(this.segmentsT+1)*(e-1)+f-1,m=(this.segmentsT+1)*(e-1)+f,n=(this.segmentsT+1)*e+f,p=new THREE.Face4(h,k,m,n,[c[h],c[k],c[m],c[n]]);p.normal.addSelf(c[h]);p.normal.addSelf(c[k]);p.normal.addSelf(c[m]);p.normal.addSelf(c[n]);p.normal.normalize();this.faces.push(p);
|
|
|
this.faceVertexUvs[0].push([b[h].clone(),b[k].clone(),b[m].clone(),b[n].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
|
-THREE.TorusKnotGeometry=function(b,c,e,f,h,k,m){function n(b,e,c,f,h,k){e=c/f*b;c=Math.cos(e);return new THREE.Vector3(h*(2+c)*0.5*Math.cos(b),h*(2+c)*Math.sin(b)*0.5,k*h*Math.sin(e)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=h||2;this.q=k||3;this.heightScale=m||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;k=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
|
|
|
-this.segmentsT;++c){var t=b/this.segmentsR*2*this.p*Math.PI,m=c/this.segmentsT*2*Math.PI,h=n(t,m,this.q,this.p,this.radius,this.heightScale),t=n(t+0.01,m,this.q,this.p,this.radius,this.heightScale);e.x=t.x-h.x;e.y=t.y-h.y;e.z=t.z-h.z;f.x=t.x+h.x;f.y=t.y+h.y;f.z=t.z+h.z;k.cross(e,f);f.cross(k,e);k.normalize();f.normalize();t=-this.tube*Math.cos(m);m=this.tube*Math.sin(m);h.x+=t*f.x+m*k.x;h.y+=t*f.y+m*k.y;h.z+=t*f.z+m*k.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(h.x,h.y,
|
|
|
-h.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,k=(c+1)%this.segmentsT,h=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],m=new THREE.UV(b/this.segmentsR,c/this.segmentsT),t=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),v=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),w=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,e,f,k));this.faceVertexUvs[0].push([m,t,v,w])}this.computeCentroids();
|
|
|
+THREE.TorusKnotGeometry=function(b,c,e,f,h,k,m){function n(b,e,c,f,k,h){e=c/f*b;c=Math.cos(e);return new THREE.Vector3(k*(2+c)*0.5*Math.cos(b),k*(2+c)*Math.sin(b)*0.5,h*k*Math.sin(e)*0.5)}THREE.Geometry.call(this);this.radius=b||200;this.tube=c||40;this.segmentsR=e||64;this.segmentsT=f||8;this.p=h||2;this.q=k||3;this.heightScale=m||1;this.grid=Array(this.segmentsR);e=new THREE.Vector3;f=new THREE.Vector3;k=new THREE.Vector3;for(b=0;b<this.segmentsR;++b){this.grid[b]=Array(this.segmentsT);for(c=0;c<
|
|
|
+this.segmentsT;++c){var p=b/this.segmentsR*2*this.p*Math.PI,m=c/this.segmentsT*2*Math.PI,h=n(p,m,this.q,this.p,this.radius,this.heightScale),p=n(p+0.01,m,this.q,this.p,this.radius,this.heightScale);e.x=p.x-h.x;e.y=p.y-h.y;e.z=p.z-h.z;f.x=p.x+h.x;f.y=p.y+h.y;f.z=p.z+h.z;k.cross(e,f);f.cross(k,e);k.normalize();f.normalize();p=-this.tube*Math.cos(m);m=this.tube*Math.sin(m);h.x+=p*f.x+m*k.x;h.y+=p*f.y+m*k.y;h.z+=p*f.z+m*k.z;this.grid[b][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(h.x,h.y,
|
|
|
+h.z)))-1}}for(b=0;b<this.segmentsR;++b)for(c=0;c<this.segmentsT;++c){var f=(b+1)%this.segmentsR,k=(c+1)%this.segmentsT,h=this.grid[b][c],e=this.grid[f][c],f=this.grid[f][k],k=this.grid[b][k],m=new THREE.UV(b/this.segmentsR,c/this.segmentsT),p=new THREE.UV((b+1)/this.segmentsR,c/this.segmentsT),u=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),w=new THREE.UV(b/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(h,e,f,k));this.faceVertexUvs[0].push([m,p,u,w])}this.computeCentroids();
|
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(b){this.subdivisions=b===void 0?1:b;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(b){for(var c=this.subdivisions;c--;)this.smooth(b)};
|
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(b){function c(b,e,c,f,n){var p=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors)p.vertexColors=n.vertexColors;h.push(p);(!m.supportUVs||u.length!=0)&&k.push([u[b],u[e],u[c],u[f]])}function e(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}var f=[],h=[],k=[],m=this,n=b.vertices,f=b.faces,t=n.concat(),v=[],w={},u=[],x,p,y,A,z,E=b.faceVertexUvs[0];x=0;for(p=E.length;x<p;x++){y=0;for(A=E[x].length;y<A;y++)z=f[x]["abcd".charAt(y)],
|
|
|
-u[z]||(u[z]=E[x][y])}var F;x=0;for(p=f.length;x<p;x++)if(z=f[x],v.push(z.centroid),t.push(new THREE.Vertex(z.centroid)),m.supportUVs&&u.length!=0){F=new THREE.UV;if(z instanceof THREE.Face3)F.u=u[z.a].u+u[z.b].u+u[z.c].u,F.v=u[z.a].v+u[z.b].v+u[z.c].v,F.u/=3,F.v/=3;else if(z instanceof THREE.Face4)F.u=u[z.a].u+u[z.b].u+u[z.c].u+u[z.d].u,F.v=u[z.a].v+u[z.b].v+u[z.c].v+u[z.d].v,F.u/=4,F.v/=4;u.push(F)}A=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,h,k,m,n={};f=0;for(h=b.faces.length;f<
|
|
|
-h;f++)k=b.faces[f],k instanceof THREE.Face3?(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.a),c(n,m,f)):k instanceof THREE.Face4&&(m=e(k.a,k.b),c(n,m,f),m=e(k.b,k.c),c(n,m,f),m=e(k.c,k.d),c(n,m,f),m=e(k.d,k.a),c(n,m,f));return n}(b);var D,H,N=0,E=n.length,O;for(x in A)if(z=A[x],F=z[0],D=z[1],H=new THREE.Vector3,z.length!=2)console.log("warning, edge fail",z);else if(H.addSelf(v[F]),H.addSelf(v[D]),O=x.split("_"),p=O[0],O=O[1],H.addSelf(n[p].position),H.addSelf(n[O].position),H.multiplyScalar(0.25),
|
|
|
-w[x]=E+f.length+N,t.push(new THREE.Vertex(H)),N++,m.supportUVs&&u.length!=0)F=new THREE.UV,F.u=u[p].u+u[O].u,F.v=u[p].v+u[O].v,F.u/=2,F.v/=2,u.push(F);x=0;for(p=v.length;x<p;x++)z=f[x],O=E+x,z instanceof THREE.Face3?(F=e(z.a,z.b),D=e(z.b,z.c),N=e(z.c,z.a),c(O,w[F],z.b,w[D],z),c(O,w[D],z.c,w[N],z),c(O,w[N],z.a,w[F],z)):z instanceof THREE.Face4?(F=e(z.a,z.b),D=e(z.b,z.c),N=e(z.c,z.d),H=e(z.d,z.a),c(O,w[F],z.b,w[D],z),c(O,w[D],z.c,w[N],z),c(O,w[N],z.d,w[H],z),c(O,w[H],z.a,w[F],z)):console.log("face should be a face!",
|
|
|
-z);var f=t,K={},G={},t=function(b,e){K[b]===void 0&&(K[b]=[]);K[b].push(e)},w=function(b,e){G[b]===void 0&&(G[b]={});G[b][e]=null};for(x in A)z=A[x],O=x.split("_"),p=O[0],O=O[1],t(p,[p,O]),t(O,[p,O]),F=z[0],D=z[1],w(p,F),w(p,D),w(O,F),w(O,D);t=new THREE.Vector3;w=new THREE.Vector3;x=0;for(p=n.length;x<p;x++)if(K[x]!==void 0){t.set(0,0,0);w.set(0,0,0);A=new THREE.Vector3(0,0,0);E=0;for(y in G[x])t.addSelf(v[y]),E++;t.divideScalar(E);E=K[x].length;for(y=0;y<E;y++)z=K[x][y],z=n[z[0]].position.clone().addSelf(n[z[1]].position).divideScalar(2),
|
|
|
-w.addSelf(z);w.divideScalar(E);A.addSelf(n[x].position);A.multiplyScalar(E-3);A.addSelf(t);A.addSelf(w.multiplyScalar(2));A.divideScalar(E);f[x].position=A}b.vertices=f;b.faces=h;b.faceVertexUvs[0]=k;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};THREE.Loader=function(b){this.statusDomElement=(this.showStatus=b)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(b){function c(b,e,c,f,n){var p=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors)p.vertexColors=n.vertexColors;h.push(p);(!m.supportUVs||t.length!=0)&&k.push([t[b],t[e],t[c],t[f]])}function e(b,e){return Math.min(b,e)+"_"+Math.max(b,e)}var f=[],h=[],k=[],m=this,n=b.vertices,f=b.faces,p=n.concat(),u=[],w={},t=[],x,v,A,z,y,E=b.faceVertexUvs[0];x=0;for(v=E.length;x<v;x++){A=0;for(z=E[x].length;A<z;A++)y=f[x]["abcd".charAt(A)],
|
|
|
+t[y]||(t[y]=E[x][A])}var F;x=0;for(v=f.length;x<v;x++)if(y=f[x],u.push(y.centroid),p.push(new THREE.Vertex(y.centroid)),m.supportUVs&&t.length!=0){F=new THREE.UV;if(y instanceof THREE.Face3)F.u=t[y.a].u+t[y.b].u+t[y.c].u,F.v=t[y.a].v+t[y.b].v+t[y.c].v,F.u/=3,F.v/=3;else if(y instanceof THREE.Face4)F.u=t[y.a].u+t[y.b].u+t[y.c].u+t[y.d].u,F.v=t[y.a].v+t[y.b].v+t[y.c].v+t[y.d].v,F.u/=4,F.v/=4;t.push(F)}z=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,k,h,m,n={};f=0;for(k=b.faces.length;f<
|
|
|
+k;f++)h=b.faces[f],h instanceof THREE.Face3?(m=e(h.a,h.b),c(n,m,f),m=e(h.b,h.c),c(n,m,f),m=e(h.c,h.a),c(n,m,f)):h instanceof THREE.Face4&&(m=e(h.a,h.b),c(n,m,f),m=e(h.b,h.c),c(n,m,f),m=e(h.c,h.d),c(n,m,f),m=e(h.d,h.a),c(n,m,f));return n}(b);var D,H,L=0,E=n.length,M;for(x in z)if(y=z[x],F=y[0],D=y[1],H=new THREE.Vector3,y.length!=2)console.log("warning, edge fail",y);else if(H.addSelf(u[F]),H.addSelf(u[D]),M=x.split("_"),v=M[0],M=M[1],H.addSelf(n[v].position),H.addSelf(n[M].position),H.multiplyScalar(0.25),
|
|
|
+w[x]=E+f.length+L,p.push(new THREE.Vertex(H)),L++,m.supportUVs&&t.length!=0)F=new THREE.UV,F.u=t[v].u+t[M].u,F.v=t[v].v+t[M].v,F.u/=2,F.v/=2,t.push(F);x=0;for(v=u.length;x<v;x++)y=f[x],M=E+x,y instanceof THREE.Face3?(F=e(y.a,y.b),D=e(y.b,y.c),L=e(y.c,y.a),c(M,w[F],y.b,w[D],y),c(M,w[D],y.c,w[L],y),c(M,w[L],y.a,w[F],y)):y instanceof THREE.Face4?(F=e(y.a,y.b),D=e(y.b,y.c),L=e(y.c,y.d),H=e(y.d,y.a),c(M,w[F],y.b,w[D],y),c(M,w[D],y.c,w[L],y),c(M,w[L],y.d,w[H],y),c(M,w[H],y.a,w[F],y)):console.log("face should be a face!",
|
|
|
+y);var f=p,K={},G={},p=function(b,e){K[b]===void 0&&(K[b]=[]);K[b].push(e)},w=function(b,e){G[b]===void 0&&(G[b]={});G[b][e]=null};for(x in z)y=z[x],M=x.split("_"),v=M[0],M=M[1],p(v,[v,M]),p(M,[v,M]),F=y[0],D=y[1],w(v,F),w(v,D),w(M,F),w(M,D);p=new THREE.Vector3;w=new THREE.Vector3;x=0;for(v=n.length;x<v;x++)if(K[x]!==void 0){p.set(0,0,0);w.set(0,0,0);z=new THREE.Vector3(0,0,0);E=0;for(A in G[x])p.addSelf(u[A]),E++;p.divideScalar(E);E=K[x].length;for(A=0;A<E;A++)y=K[x][A],y=n[y[0]].position.clone().addSelf(n[y[1]].position).divideScalar(2),
|
|
|
+w.addSelf(y);w.divideScalar(E);z.addSelf(n[x].position);z.multiplyScalar(E-3);z.addSelf(p);z.addSelf(w.multiplyScalar(2));z.divideScalar(E);f[x].position=z}b.vertices=f;b.faces=h;b.faceVertexUvs[0]=k;delete b.__tmpVertices;b.computeCentroids();b.computeFaceNormals();b.computeVertexNormals()};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={constructor:THREE.Loader,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.length<1?".":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.ShaderMaterial)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,k,h,m,n){var t=document.createElement("canvas");b[e]=new THREE.Texture(t);b[e].sourceFile=k;if(h){b[e].repeat.set(h[0],h[1]);if(h[0]!=1)b[e].wrapS=THREE.RepeatWrapping;
|
|
|
-if(h[1]!=1)b[e].wrapT=THREE.RepeatWrapping}m&&b[e].offset.set(m[0],m[1]);if(n){h={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(h[n[0]]!==void 0)b[e].wrapS=h[n[0]];if(h[n[1]]!==void 0)b[e].wrapT=h[n[1]]}f(b[e],c+"/"+k)}function k(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var m,n,t;n="MeshLambertMaterial";m={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"));
|
|
|
+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]!=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 k(b){return(b[0]*255<<16)+(b[1]*255<<8)+b[2]*255}var m,n,p;n="MeshLambertMaterial";m={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")m.blending=THREE.AdditiveBlending;else if(b.blending=="Subtractive")m.blending=THREE.SubtractiveBlending;else if(b.blending=="Multiply")m.blending=THREE.MultiplyBlending;if(b.transparent!==void 0||b.opacity<1)m.transparent=b.transparent;if(b.depthTest!==void 0)m.depthTest=b.depthTest;if(b.vertexColors!==void 0)if(b.vertexColors=="face")m.vertexColors=THREE.FaceColors;else if(b.vertexColors)m.vertexColors=THREE.VertexColors;if(b.colorDiffuse)m.color=k(b.colorDiffuse);
|
|
|
else if(b.DbgColor)m.color=b.DbgColor;if(b.colorSpecular)m.specular=k(b.colorSpecular);if(b.colorAmbient)m.ambient=k(b.colorAmbient);if(b.transparency)m.opacity=b.transparency;if(b.specularCoef)m.shininess=b.specularCoef;b.mapDiffuse&&c&&h(m,"map",b.mapDiffuse,b.mapDiffuseRepeat,b.mapDiffuseOffset,b.mapDiffuseWrap);b.mapLight&&c&&h(m,"lightMap",b.mapLight,b.mapLightRepeat,b.mapLightOffset,b.mapLightWrap);b.mapNormal&&c&&h(m,"normalMap",b.mapNormal,b.mapNormalRepeat,b.mapNormalOffset,b.mapNormalWrap);
|
|
|
-b.mapSpecular&&c&&h(m,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var v=THREE.ShaderUtils.lib.normal,w=THREE.UniformsUtils.clone(v.uniforms),u=m.color;n=m.specular;t=m.ambient;var x=m.shininess;w.tNormal.texture=m.normalMap;if(b.mapNormalFactor)w.uNormalScale.value=b.mapNormalFactor;if(m.map)w.tDiffuse.texture=m.map,w.enableDiffuse.value=!0;if(m.specularMap)w.tSpecular.texture=m.specularMap,w.enableSpecular.value=!0;if(m.lightMap)w.tAO.texture=
|
|
|
-m.lightMap,w.enableAO.value=!0;w.uDiffuseColor.value.setHex(u);w.uSpecularColor.value.setHex(n);w.uAmbientColor.value.setHex(t);w.uShininess.value=x;if(m.opacity)w.uOpacity.value=m.opacity;m=new THREE.ShaderMaterial({fragmentShader:v.fragmentShader,vertexShader:v.vertexShader,uniforms:w,lights:!0,fog:!0})}else m=new THREE[n](m);return m}};THREE.BinaryLoader=function(b){THREE.Loader.call(this,b)};THREE.BinaryLoader.prototype=new THREE.Loader;THREE.BinaryLoader.prototype.constructor=THREE.BinaryLoader;
|
|
|
+b.mapSpecular&&c&&h(m,"specularMap",b.mapSpecular,b.mapSpecularRepeat,b.mapSpecularOffset,b.mapSpecularWrap);if(b.mapNormal){var u=THREE.ShaderUtils.lib.normal,w=THREE.UniformsUtils.clone(u.uniforms),t=m.color;n=m.specular;p=m.ambient;var x=m.shininess;w.tNormal.texture=m.normalMap;if(b.mapNormalFactor)w.uNormalScale.value=b.mapNormalFactor;if(m.map)w.tDiffuse.texture=m.map,w.enableDiffuse.value=!0;if(m.specularMap)w.tSpecular.texture=m.specularMap,w.enableSpecular.value=!0;if(m.lightMap)w.tAO.texture=
|
|
|
+m.lightMap,w.enableAO.value=!0;w.uDiffuseColor.value.setHex(t);w.uSpecularColor.value.setHex(n);w.uAmbientColor.value.setHex(p);w.uShininess.value=x;if(m.opacity)w.uOpacity.value=m.opacity;m=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:w,lights:!0,fog:!0})}else m=new THREE[n](m);return m}};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),k=this.showProgress?THREE.Loader.prototype.updateProgress:null;c.onmessage=function(b){THREE.BinaryLoader.prototype.loadAjaxBuffers(b.data.buffers,b.data.materials,e,h,f,k)};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,k){var m=new XMLHttpRequest,n=f+"/"+b,t=0;m.onreadystatechange=function(){m.readyState==4?m.status==200||m.status==0?THREE.BinaryLoader.prototype.createBinModel(m.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+m.status+"]"):m.readyState==3?k&&(t==0&&(t=m.getResponseHeader("Content-Length")),k({total:t,loaded:m.responseText.length})):m.readyState==2&&(t=m.getResponseHeader("Content-Length"))};m.open("GET",n,!0);m.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
+THREE.BinaryLoader.prototype.loadAjaxBuffers=function(b,c,e,f,h,k){var m=new XMLHttpRequest,n=f+"/"+b,p=0;m.onreadystatechange=function(){m.readyState==4?m.status==200||m.status==0?THREE.BinaryLoader.prototype.createBinModel(m.responseText,e,h,c):alert("Couldn't load ["+n+"] ["+m.status+"]"):m.readyState==3?k&&(p==0&&(p=m.getResponseHeader("Content-Length")),k({total:p,loaded:m.responseText.length})):m.readyState==2&&(p=m.getResponseHeader("Content-Length"))};m.open("GET",n,!0);m.overrideMimeType("text/plain; charset=x-user-defined");
|
|
|
m.setRequestHeader("Content-Type","text/plain");m.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(e){function c(b,e){var f=w(b,e),h=w(b,e+1),k=w(b,e+2),m=w(b,e+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,e){var c=w(b,e),f=w(b,e+1),k=w(b,e+2);return(w(b,e+3)<<24)+(k<<16)+(f<<8)+c}function t(b,e){var c=w(b,e);return(w(b,e+1)<<8)+c}function v(b,e){var c=w(b,e);return c>127?c-256:c}function w(b,e){return b.charCodeAt(e)&255}function u(e){var c,
|
|
|
-f,k;c=h(b,e);f=h(b,e+O);k=h(b,e+K);e=t(b,e+G);E.faces.push(new THREE.Face3(c,f,k,null,null,E.materials[e]))}function x(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+O);k=h(b,e+K);m=t(b,e+G);o=h(b,e+B);p=h(b,e+da);e=h(b,e+J);m=E.materials[m];var u=H[p*3],v=H[p*3+1];p=H[p*3+2];var w=H[e*3],x=H[e*3+1],e=H[e*3+2];E.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(u,v,p),new THREE.Vector3(w,x,e)],null,m))}function p(e){var c,f,k,m;c=h(b,e);f=h(b,e+R);k=h(b,e+S);m=h(b,
|
|
|
-e+Y);e=t(b,e+W);E.faces.push(new THREE.Face4(c,f,k,m,null,null,E.materials[e]))}function y(e){var c,f,k,m,p,u,v,w;c=h(b,e);f=h(b,e+R);k=h(b,e+S);m=h(b,e+Y);p=t(b,e+W);u=h(b,e+o);v=h(b,e+ea);w=h(b,e+Q);e=h(b,e+ma);p=E.materials[p];var x=H[v*3],L=H[v*3+1];v=H[v*3+2];var y=H[w*3],M=H[w*3+1];w=H[w*3+2];var z=H[e*3],A=H[e*3+1],e=H[e*3+2];E.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(H[u*3],H[u*3+1],H[u*3+2]),new THREE.Vector3(x,L,v),new THREE.Vector3(y,M,w),new THREE.Vector3(z,A,e)],null,p))}
|
|
|
-function A(e){var c,f,k,m;c=h(b,e);f=h(b,e+Z);k=h(b,e+ia);e=N[c*2];m=N[c*2+1];c=N[f*2];var o=E.faceVertexUvs[0];f=N[f*2+1];var p=N[k*2];k=N[k*2+1];var t=[];t.push(new THREE.UV(e,m));t.push(new THREE.UV(c,f));t.push(new THREE.UV(p,k));o.push(t)}function z(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+aa);k=h(b,e+ka);m=h(b,e+fa);e=N[c*2];o=N[c*2+1];c=N[f*2];p=N[f*2+1];f=N[k*2];var t=E.faceVertexUvs[0];k=N[k*2+1];var u=N[m*2];m=N[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,p));v.push(new THREE.UV(f,
|
|
|
-k));v.push(new THREE.UV(u,m));t.push(v)}var E=this,F=0,D,H=[],N=[],O,K,G,B,da,J,R,S,Y,W,o,ea,Q,ma,Z,ia,aa,ka,fa,ca,$,X,ga,la,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,e);D={signature:b.substr(F,8),header_bytes:w(b,F+8),vertex_coordinate_bytes:w(b,F+9),normal_coordinate_bytes:w(b,F+10),uv_coordinate_bytes:w(b,F+11),vertex_index_bytes:w(b,F+12),normal_index_bytes:w(b,F+13),uv_index_bytes:w(b,F+14),material_index_bytes:w(b,F+15),nvertices:h(b,F+16),nnormals:h(b,F+16+4),nuvs:h(b,
|
|
|
-F+16+8),ntri_flat:h(b,F+16+12),ntri_smooth:h(b,F+16+16),ntri_flat_uv:h(b,F+16+20),ntri_smooth_uv:h(b,F+16+24),nquad_flat:h(b,F+16+28),nquad_smooth:h(b,F+16+32),nquad_flat_uv:h(b,F+16+36),nquad_smooth_uv:h(b,F+16+40)};F+=D.header_bytes;O=D.vertex_index_bytes;K=D.vertex_index_bytes*2;G=D.vertex_index_bytes*3;B=D.vertex_index_bytes*3+D.material_index_bytes;da=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;J=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;R=D.vertex_index_bytes;
|
|
|
-S=D.vertex_index_bytes*2;Y=D.vertex_index_bytes*3;W=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;ea=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;Q=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;ma=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;Z=D.uv_index_bytes;ia=D.uv_index_bytes*2;aa=D.uv_index_bytes;ka=D.uv_index_bytes*2;fa=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes;ra=D.vertex_index_bytes*
|
|
|
-4+D.material_index_bytes;ca=D.ntri_flat*e;$=D.ntri_smooth*(e+D.normal_index_bytes*3);X=D.ntri_flat_uv*(e+D.uv_index_bytes*3);ga=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);la=D.nquad_flat*ra;e=D.nquad_smooth*(ra+D.normal_index_bytes*4);ra=D.nquad_flat_uv*(ra+D.uv_index_bytes*4);F+=function(e){for(var f,h,k,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e<o;e+=n)f=c(b,e),h=c(b,e+D.vertex_coordinate_bytes),k=c(b,e+D.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
|
|
|
-h,k)));return D.nvertices*n}(F);F+=function(e){for(var c,f,h,k=D.normal_coordinate_bytes*3,m=e+D.nnormals*k;e<m;e+=k)c=v(b,e),f=v(b,e+D.normal_coordinate_bytes),h=v(b,e+D.normal_coordinate_bytes*2),H.push(c/127,f/127,h/127);return D.nnormals*k}(F);F+=function(e){for(var f,h,k=D.uv_coordinate_bytes*2,n=e+D.nuvs*k;e<n;e+=k)f=c(b,e),h=c(b,e+D.uv_coordinate_bytes),N.push(f,h);return D.nuvs*k}(F);ca=F+ca;$=ca+$;X=$+X;ga=X+ga;la=ga+la;e=la+e;ra=e+ra;(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,
|
|
|
-f=c+D.uv_index_bytes*3,h=b+D.ntri_flat_uv*f;for(e=b;e<h;e+=f)u(e),A(e+c);return h-b})($);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=c+D.uv_index_bytes*3,h=b+D.ntri_smooth_uv*f;for(e=b;e<h;e+=f)x(e),A(e+c);return h-b})(X);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=c+D.uv_index_bytes*4,h=b+D.nquad_flat_uv*f;for(e=b;e<h;e+=f)p(e),z(e+c);return h-b})(e);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
|
|
|
-4,f=c+D.uv_index_bytes*4,h=b+D.nquad_smooth_uv*f;for(e=b;e<h;e+=f)y(e),z(e+c);return h-b})(ra);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*c;for(e=b;e<f;e+=c)u(e);return f-b})(F);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(ca);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*c;for(e=b;e<f;e+=c)p(e);return f-b})(ga);(function(b){var e,
|
|
|
-c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*c;for(e=b;e<f;e+=c)y(e);return f-b})(la);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
|
|
|
-THREE.ColladaLoader=function(){function b(b,e,c){for(var b=ca.evaluate(b,ca,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new e).parse(h);if(h.id.length==0)h.id=c+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,e=-b,c=0,f;for(f in na)for(var h=na[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);e=Math.max(e,m.endTime);c=Math.max(c,m.input.length)}return{start:b,end:e,frames:c}}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=P[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=X.getChildById(f.skeleton[0],!0)||X.getChildBySid(f.skeleton[0],
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(e){function c(b,e){var f=w(b,e),h=w(b,e+1),k=w(b,e+2),m=w(b,e+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,e){var c=w(b,e),f=w(b,e+1),k=w(b,e+2);return(w(b,e+3)<<24)+(k<<16)+(f<<8)+c}function p(b,e){var c=w(b,e);return(w(b,e+1)<<8)+c}function u(b,e){var c=w(b,e);return c>127?c-256:c}function w(b,e){return b.charCodeAt(e)&255}function t(e){var c,
|
|
|
+f,k;c=h(b,e);f=h(b,e+M);k=h(b,e+K);e=p(b,e+G);E.faces.push(new THREE.Face3(c,f,k,null,null,E.materials[e]))}function x(e){var c,f,k,m,o,t;c=h(b,e);f=h(b,e+M);k=h(b,e+K);m=p(b,e+G);o=h(b,e+B);t=h(b,e+da);e=h(b,e+J);m=E.materials[m];var u=H[t*3],v=H[t*3+1];t=H[t*3+2];var w=H[e*3],x=H[e*3+1],e=H[e*3+2];E.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(H[o*3],H[o*3+1],H[o*3+2]),new THREE.Vector3(u,v,t),new THREE.Vector3(w,x,e)],null,m))}function v(e){var c,f,k,m;c=h(b,e);f=h(b,e+Q);k=h(b,e+R);m=h(b,
|
|
|
+e+Y);e=p(b,e+V);E.faces.push(new THREE.Face4(c,f,k,m,null,null,E.materials[e]))}function A(e){var c,f,k,m,t,u,v,w;c=h(b,e);f=h(b,e+Q);k=h(b,e+R);m=h(b,e+Y);t=p(b,e+V);u=h(b,e+o);v=h(b,e+ea);w=h(b,e+P);e=h(b,e+ma);t=E.materials[t];var x=H[v*3],X=H[v*3+1];v=H[v*3+2];var y=H[w*3],N=H[w*3+1];w=H[w*3+2];var z=H[e*3],A=H[e*3+1],e=H[e*3+2];E.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(H[u*3],H[u*3+1],H[u*3+2]),new THREE.Vector3(x,X,v),new THREE.Vector3(y,N,w),new THREE.Vector3(z,A,e)],null,t))}
|
|
|
+function z(e){var c,f,k,m;c=h(b,e);f=h(b,e+Z);k=h(b,e+ia);e=L[c*2];m=L[c*2+1];c=L[f*2];var o=E.faceVertexUvs[0];f=L[f*2+1];var p=L[k*2];k=L[k*2+1];var t=[];t.push(new THREE.UV(e,m));t.push(new THREE.UV(c,f));t.push(new THREE.UV(p,k));o.push(t)}function y(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+aa);k=h(b,e+ka);m=h(b,e+fa);e=L[c*2];o=L[c*2+1];c=L[f*2];p=L[f*2+1];f=L[k*2];var t=E.faceVertexUvs[0];k=L[k*2+1];var u=L[m*2];m=L[m*2+1];var v=[];v.push(new THREE.UV(e,o));v.push(new THREE.UV(c,p));v.push(new THREE.UV(f,
|
|
|
+k));v.push(new THREE.UV(u,m));t.push(v)}var E=this,F=0,D,H=[],L=[],M,K,G,B,da,J,Q,R,Y,V,o,ea,P,ma,Z,ia,aa,ka,fa,ca,$,W,ga,la,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,e);D={signature:b.substr(F,8),header_bytes:w(b,F+8),vertex_coordinate_bytes:w(b,F+9),normal_coordinate_bytes:w(b,F+10),uv_coordinate_bytes:w(b,F+11),vertex_index_bytes:w(b,F+12),normal_index_bytes:w(b,F+13),uv_index_bytes:w(b,F+14),material_index_bytes:w(b,F+15),nvertices:h(b,F+16),nnormals:h(b,F+16+4),nuvs:h(b,
|
|
|
+F+16+8),ntri_flat:h(b,F+16+12),ntri_smooth:h(b,F+16+16),ntri_flat_uv:h(b,F+16+20),ntri_smooth_uv:h(b,F+16+24),nquad_flat:h(b,F+16+28),nquad_smooth:h(b,F+16+32),nquad_flat_uv:h(b,F+16+36),nquad_smooth_uv:h(b,F+16+40)};F+=D.header_bytes;M=D.vertex_index_bytes;K=D.vertex_index_bytes*2;G=D.vertex_index_bytes*3;B=D.vertex_index_bytes*3+D.material_index_bytes;da=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;J=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;Q=D.vertex_index_bytes;
|
|
|
+R=D.vertex_index_bytes*2;Y=D.vertex_index_bytes*3;V=D.vertex_index_bytes*4;o=D.vertex_index_bytes*4+D.material_index_bytes;ea=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;P=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;ma=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;Z=D.uv_index_bytes;ia=D.uv_index_bytes*2;aa=D.uv_index_bytes;ka=D.uv_index_bytes*2;fa=D.uv_index_bytes*3;e=D.vertex_index_bytes*3+D.material_index_bytes;ra=D.vertex_index_bytes*
|
|
|
+4+D.material_index_bytes;ca=D.ntri_flat*e;$=D.ntri_smooth*(e+D.normal_index_bytes*3);W=D.ntri_flat_uv*(e+D.uv_index_bytes*3);ga=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);la=D.nquad_flat*ra;e=D.nquad_smooth*(ra+D.normal_index_bytes*4);ra=D.nquad_flat_uv*(ra+D.uv_index_bytes*4);F+=function(e){for(var f,h,k,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e<o;e+=n)f=c(b,e),h=c(b,e+D.vertex_coordinate_bytes),k=c(b,e+D.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
|
|
|
+h,k)));return D.nvertices*n}(F);F+=function(e){for(var c,f,h,k=D.normal_coordinate_bytes*3,m=e+D.nnormals*k;e<m;e+=k)c=u(b,e),f=u(b,e+D.normal_coordinate_bytes),h=u(b,e+D.normal_coordinate_bytes*2),H.push(c/127,f/127,h/127);return D.nnormals*k}(F);F+=function(e){for(var f,h,k=D.uv_coordinate_bytes*2,n=e+D.nuvs*k;e<n;e+=k)f=c(b,e),h=c(b,e+D.uv_coordinate_bytes),L.push(f,h);return D.nuvs*k}(F);ca=F+ca;$=ca+$;W=$+W;ga=W+ga;la=ga+la;e=la+e;ra=e+ra;(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,
|
|
|
+f=c+D.uv_index_bytes*3,h=b+D.ntri_flat_uv*f;for(e=b;e<h;e+=f)t(e),z(e+c);return h-b})($);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=c+D.uv_index_bytes*3,h=b+D.ntri_smooth_uv*f;for(e=b;e<h;e+=f)x(e),z(e+c);return h-b})(W);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=c+D.uv_index_bytes*4,h=b+D.nquad_flat_uv*f;for(e=b;e<h;e+=f)v(e),y(e+c);return h-b})(e);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*
|
|
|
+4,f=c+D.uv_index_bytes*4,h=b+D.nquad_smooth_uv*f;for(e=b;e<h;e+=f)A(e),y(e+c);return h-b})(ra);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes,f=b+D.ntri_flat*c;for(e=b;e<f;e+=c)t(e);return f-b})(F);(function(b){var e,c=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*3,f=b+D.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(ca);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=b+D.nquad_flat*c;for(e=b;e<f;e+=c)v(e);return f-b})(ga);(function(b){var e,
|
|
|
+c=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*4,f=b+D.nquad_smooth*c;for(e=b;e<f;e+=c)A(e);return f-b})(la);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
|
|
|
+THREE.ColladaLoader=function(){function b(b,e,c){for(var b=ca.evaluate(b,ca,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},h=b.iterateNext(),k=0;h;){h=(new e).parse(h);if(h.id.length==0)h.id=c+k++;f[h.id]=h;h=b.iterateNext()}return f}function c(){var b=1E6,e=-b,c=0,f;for(f in na)for(var h=na[f],k=0;k<h.sampler.length;k++){var m=h.sampler[k];m.create();b=Math.min(b,m.startTime);e=Math.max(e,m.endTime);c=Math.max(c,m.input.length)}return{start:b,end:e,frames:c}}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=W.getChildById(f.skeleton[0],!0)||W.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 e=new THREE.Object3D,
|
|
|
-c,k,m;e.name=b.id||"";e.matrixAutoUpdate=!1;e.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=P[b.controllers[m].url];switch(n.type){case "skin":if(oa[n.skin.source]){var o=new y;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);c=b.controllers[m]}else if(P[n.skin.source]&&(k=n=P[n.skin.source],n.morph&&oa[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(oa[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=oa[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(e.name.length==0)e.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=wa[qa[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(c!==void 0)f(n,c),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=c.skeleton,o.skinController=P[c.url],o.skinInstanceController=c,o.name="skin_"+Ca.length,Ca.push(o);else if(k!==void 0){p=n;t=k instanceof x?P[k.url]:k;if(!t||!t.morph)console.log("could not find morph controller!");
|
|
|
+c,k,m;e.name=b.id||"";e.matrixAutoUpdate=!1;e.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=O[b.controllers[m].url];switch(n.type){case "skin":if(oa[n.skin.source]){var o=new A;o.url=n.skin.source;o.instance_material=b.controllers[m].instance_material;b.geometries.push(o);c=b.controllers[m]}else if(O[n.skin.source]&&(k=n=O[n.skin.source],n.morph&&oa[n.morph.source]))o=new A,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o);break;case "morph":if(oa[n.morph.source])o=
|
|
|
+new A,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=oa[n.url],p={},t=0,u;if(n&&n.mesh&&n.mesh.primitives){if(e.name.length==0)e.name=n.id;if(o)for(j=0;j<o.length;j++){u=o[j];var v=wa[qa[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(c!==void 0)f(n,c),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=c.skeleton,o.skinController=O[c.url],o.skinInstanceController=c,o.name="skin_"+Ca.length,Ca.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=oa[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_"+Aa.length;Aa.push(o)}else o=new THREE.Mesh(n,o);e.add(o)}}for(m=0;m<b.nodes.length;m++)e.add(h(b.nodes[m],b));return e}function k(){this.init_from=
|
|
|
-this.id=""}function m(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function t(){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 u(){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 A(){this.id="";this.mesh=null}function z(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function E(){}function F(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){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 O(b){this.id=b;this.type=null}function K(){this.name=this.id="";this.instance_effect=null}function G(){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 B(b,e){this.type=b;this.effect=e;this.material=null}function da(b){this.effect=b;this.format=this.init_from=
|
|
|
-null}function J(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function R(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function S(){this.url=""}function Y(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function W(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 ea(b){var e=b.getAttribute("id");if(la[e]!=void 0)return la[e];la[e]=(new O(e)).parse(b);return la[e]}function Q(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function ma(b){for(var b=ia(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function Z(b){for(var b=ia(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],10));return e}function ia(b){return b.replace(/^\s+/,"").replace(/\s+$/,
|
|
|
-"").split(/\s+/)}function aa(b,e,c){return b.hasAttribute(e)?parseInt(b.getAttribute(e),10):c}function ka(b,e){if(b===void 0){for(var c="0.";c.length<e+2;)c+="0";return c}e=e||2;c=b.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,e):"0";c[1].length<e;)c[1]+="0";return c.join(".")}function fa(b,e){var c="";c+=ka(b.x,e)+",";c+=ka(b.y,e)+",";c+=ka(b.z,e);return c}var ca=null,$=null,X,ga=null,la={},ra={},na={},P={},oa={},qa={},wa={},ta,Ea,Aa,Ca,Fa=THREE.SmoothShading;k.prototype.parse=function(b){this.id=
|
|
|
-b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};m.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "skin":this.skin=(new t).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(b){var e=
|
|
|
-{},c=[],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 O).parse(h);e[h.id]=h;break;case "targets":c=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<c.length;f++)switch(b=c[f],h=e[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 e=[],c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new N).parse(f))}}return e};t.prototype.parse=function(b){var e={},c,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=ma(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
|
|
|
-k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new O).parse(k);e[k.id]=k;break;case "joints":c=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(c,e);this.parseWeights(f,e);return this};t.prototype.parseJoints=function(b,e){for(var c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new N).parse(f),h=e[f.source];if(f.semantic=="JOINT")this.joints=
|
|
|
-h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};t.prototype.parseWeights=function(b,e){for(var c,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new N).parse(m));break;case "v":c=Z(m.textContent);break;case "vcount":f=Z(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],p=0;p<n;p++){for(var t={},u=0;u<h.length;u++){var v=h[u],w=c[m+v.offset];switch(v.semantic){case "JOINT":t.joint=w;break;
|
|
|
-case "WEIGHT":t.weight=e[v.source].data[w]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};v.prototype.getChildById=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};v.prototype.getChildBySid=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};v.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
|
|
|
+this.id=""}function m(){this.type=this.name=this.id="";this.morph=this.skin=null}function n(){this.weights=this.targets=this.source=this.method=null}function p(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function u(){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 v(){this.target=this.symbol=""}function A(){this.url="";this.instance_material=[]}function z(){this.id="";this.mesh=null}function y(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function E(){}function F(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function D(){this.source="";
|
|
|
+this.stride=this.count=0;this.params=[]}function H(){this.input={}}function L(){this.semantic="";this.offset=0;this.source="";this.set=0}function M(b){this.id=b;this.type=null}function K(){this.name=this.id="";this.instance_effect=null}function G(){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 B(b,e){this.type=b;this.effect=e;this.material=null}function da(b){this.effect=b;this.format=this.init_from=
|
|
|
+null}function J(b){this.effect=b;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function Q(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function R(){this.url=""}function Y(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function V(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 ea(b){var e=b.getAttribute("id");if(la[e]!=void 0)return la[e];la[e]=(new M(e)).parse(b);return la[e]}function P(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function ma(b){for(var b=ia(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function Z(b){for(var b=ia(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],10));return e}function ia(b){return b.replace(/^\s+/,"").replace(/\s+$/,
|
|
|
+"").split(/\s+/)}function aa(b,e,c){return b.hasAttribute(e)?parseInt(b.getAttribute(e),10):c}function ka(b,e){if(b===void 0){for(var c="0.";c.length<e+2;)c+="0";return c}e=e||2;c=b.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,e):"0";c[1].length<e;)c[1]+="0";return c.join(".")}function fa(b,e){var c="";c+=ka(b.x,e)+",";c+=ka(b.y,e)+",";c+=ka(b.z,e);return c}var ca=null,$=null,W,ga=null,la={},ra={},na={},O={},oa={},qa={},wa={},ta,Ea,Aa,Ca,Fa=THREE.SmoothShading;k.prototype.parse=function(b){this.id=
|
|
|
+b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};m.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.type="none";for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "skin":this.skin=(new p).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new n).parse(c),this.type=c.nodeName}}return this};n.prototype.parse=function(b){var e=
|
|
|
+{},c=[],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 M).parse(h);e[h.id]=h;break;case "targets":c=this.parseInputs(h);break;default:console.log(h.nodeName)}}for(f=0;f<c.length;f++)switch(b=c[f],h=e[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 e=[],c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":e.push((new L).parse(f))}}return e};p.prototype.parse=function(b){var e={},c,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=ma(k.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(k[0],
|
|
|
+k[1],k[2],k[3],k[4],k[5],k[6],k[7],k[8],k[9],k[10],k[11],k[12],k[13],k[14],k[15]);break;case "source":k=(new M).parse(k);e[k.id]=k;break;case "joints":c=k;break;case "vertex_weights":f=k;break;default:console.log(k.nodeName)}}this.parseJoints(c,e);this.parseWeights(f,e);return this};p.prototype.parseJoints=function(b,e){for(var c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "input":var f=(new L).parse(f),h=e[f.source];if(f.semantic=="JOINT")this.joints=
|
|
|
+h.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=h.read()}}};p.prototype.parseWeights=function(b,e){for(var c,f,h=[],k=0;k<b.childNodes.length;k++){var m=b.childNodes[k];if(m.nodeType==1)switch(m.nodeName){case "input":h.push((new L).parse(m));break;case "v":c=Z(m.textContent);break;case "vcount":f=Z(m.textContent)}}for(k=m=0;k<f.length;k++){for(var n=f[k],o=[],p=0;p<n;p++){for(var t={},u=0;u<h.length;u++){var v=h[u],w=c[m+v.offset];switch(v.semantic){case "JOINT":t.joint=w;break;
|
|
|
+case "WEIGHT":t.weight=e[v.source].data[w]}}o.push(t);m+=h.length}for(p=0;p<o.length;p++)o[p].index=k;this.weights.push(o)}};u.prototype.getChildById=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};u.prototype.getChildBySid=function(b,e){for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};u.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");
|
|
|
this.nodes=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new w).parse(c))}}return this};w.prototype.getChannelForTransform=function(b){for(var e=0;e<this.channels.length;e++){var c=this.channels[e],f=c.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 c.info={sid:h,dotSyntax:k,arrSyntax:m,arrIndices:n},c}return null};w.prototype.getChildById=function(b,e){if(this.id==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildById(b,e);if(f)return f}return null};w.prototype.getChildBySid=function(b,e){if(this.sid==b)return this;if(e)for(var c=0;c<this.nodes.length;c++){var f=this.nodes[c].getChildBySid(b,e);if(f)return f}return null};w.prototype.getTransformBySid=function(b){for(var e=0;e<this.transforms.length;e++)if(this.transforms[e].sid==
|
|
|
b)return this.transforms[e];return null};w.prototype.parse=function(b){var e;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 c=0;c<b.childNodes.length;c++)if(e=b.childNodes[c],e.nodeType==1)switch(e.nodeName){case "node":this.nodes.push((new w).parse(e));break;case "instance_camera":break;
|
|
|
-case "instance_controller":this.controllers.push((new x).parse(e));break;case "instance_geometry":this.geometries.push((new y).parse(e));break;case "instance_light":break;case "instance_node":e=e.getAttribute("url").replace(/^#/,"");(e=ca.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",ca,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(e));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new u).parse(e));
|
|
|
+case "instance_controller":this.controllers.push((new x).parse(e));break;case "instance_geometry":this.geometries.push((new A).parse(e));break;case "instance_light":break;case "instance_node":e=e.getAttribute("url").replace(/^#/,"");(e=ca.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",ca,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new w).parse(e));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new t).parse(e));
|
|
|
break;case "extra":break;default:console.log(e.nodeName)}b=[];c=1E6;e=-1E6;for(var f in na)for(var h=na[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,c=Math.min(c,n.startTime),e=Math.max(e,n.endTime),b.push(m)}if(b.length)this.startTime=c,this.endTime=e;if((this.channels=b)&&this.channels.length){f=1E7;for(i=0;i<this.channels.length;i++){b=this.channels[i].sampler;for(c=0;c<b.input.length-1;c++)f=Math.min(f,b.input[c+
|
|
|
-1]-b.input[c])}c=[];for(b=this.startTime;b<this.endTime;b+=f){e=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,t,o=0;o<p.input.length-1;o++)if(p.input[o+1]>e){t=p.output[o];break}m=t!==void 0?t instanceof THREE.Matrix4?m.multiply(m,t):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);e=m;c.push({time:b,pos:[e.n14,
|
|
|
-e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}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)};u.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=ma(b.textContent);this.updateMatrix();return this};u.prototype.updateMatrix=function(){var b=0;this.matrix.identity();switch(this.type){case "matrix":this.matrix.set(this.data[0],
|
|
|
+1]-b.input[c])}c=[];for(b=this.startTime;b<this.endTime;b+=f){e=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]>e){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);e=m;c.push({time:b,pos:[e.n14,
|
|
|
+e.n24,e.n34],rotq:[0,0,0,1],scl:[1,1,1]})}this.keys=c}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=ma(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 e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ca.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=c.iterateNext();f;)this.instance_material.push((new p).parse(f)),f=c.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 e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1&&c.nodeName=="bind_material"){if(b=ca.evaluate(".//dae:instance_material",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new p).parse(e)),
|
|
|
-e=b.iterateNext();break}}return this};A.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new z(this)).parse(c)}}return this};z.prototype.parse=function(b){function e(b,c){var f=fa(b.position);h[f]===void 0&&(h[f]={v:b,index:c});return h[f]}this.primitives=[];var c;for(c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":ea(f);break;case "vertices":this.vertices=
|
|
|
+x.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=ca.evaluate(".//dae:instance_material",c,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var f=c.iterateNext();f;)this.instance_material.push((new v).parse(f)),f=c.iterateNext()}}return this};
|
|
|
+v.prototype.parse=function(b){this.symbol=b.getAttribute("symbol");this.target=b.getAttribute("target").replace(/^#/,"");return this};A.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1&&c.nodeName=="bind_material"){if(b=ca.evaluate(".//dae:instance_material",c,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new v).parse(e)),
|
|
|
+e=b.iterateNext();break}}return this};z.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "mesh":this.mesh=(new y(this)).parse(c)}}return this};y.prototype.parse=function(b){function e(b,c){var f=fa(b.position);h[f]===void 0&&(h[f]={v:b,index:c});return h[f]}this.primitives=[];var c;for(c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":ea(f);break;case "vertices":this.vertices=
|
|
|
(new H).parse(f);break;case "triangles":this.primitives.push((new F).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new E).parse(f))}}var h={};this.geometry3js=new THREE.Geometry;f=la[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var k=new THREE.Vertex(new THREE.Vector3(f[c],f[c+1],f[c+2]));e(k,b);this.geometry3js.vertices.push(k)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),
|
|
|
-this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};z.prototype.handlePrimitive=function(b,e,c){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++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=
|
|
|
+this.handlePrimitive(primitive,this.geometry3js,h);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};y.prototype.handlePrimitive=function(b,e,c){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++)switch(o=n[h],o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(h=0;h<v;h++)for(k=0;k<n.length;k++)switch(o=
|
|
|
n[k],source=la[o.source],p=m[f+h*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=fa(e.vertices[p].position);x.push(c[o].index);break;case "NORMAL":y.push(new THREE.Vector3(source.data[t],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],source.data[t+1]));break;case "COLOR":A.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var B;v==
|
|
|
3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],A.length?A:new THREE.Color):v==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],A.length?A:new THREE.Color));B.daeMaterial=b.material;e.faces.push(B);for(k=0;k<w.length;k++)h=z[w[k]],e.faceVertexUvs[k].push([h[0],h[1],h[2]]);f+=n.length*v}};E.prototype=new F;E.prototype.constructor=E;F.prototype.setVertices=function(b){for(var e=0;e<this.inputs.length;e++)if(this.inputs[e].source==b.id)this.inputs[e].source=b.input.POSITION.source};
|
|
|
-F.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=aa(b,"count",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "input":this.inputs.push((new N).parse(b.childNodes[e]));break;case "vcount":this.vcount=Z(c.textContent);break;case "p":this.p=Z(c.textContent)}}return this};D.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=aa(b,"count",0);this.stride=aa(b,"stride",0);for(var e=
|
|
|
-0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="param"){var f={};f.name=c.getAttribute("name");f.type=c.getAttribute("type");this.params.push(f)}}return this};H.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++)b.childNodes[e].nodeName=="input"&&(input=(new N).parse(b.childNodes[e]),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=aa(b,"set",-1);this.offset=aa(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};O.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "bool_array":for(var f=ia(c.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=c.nodeName;break;case "float_array":this.data=ma(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
-Z(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ia(c.textContent);this.type=c.nodeName;break;case "technique_common":for(f=0;f<c.childNodes.length;f++)if(c.childNodes[f].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[f]);break}}}return this};O.prototype.read=function(){var b=[],e=this.accessor.params[0];switch(e.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(e=0;e<this.data.length;e+=16){var c=
|
|
|
-this.data.slice(e,e+16),f=new THREE.Matrix4;f.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+e.type)}return b};K.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="instance_effect"){this.instance_effect=(new S).parse(b.childNodes[e]);break}return this};G.prototype.isColor=
|
|
|
+F.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=aa(b,"count",0);for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "input":this.inputs.push((new L).parse(b.childNodes[e]));break;case "vcount":this.vcount=Z(c.textContent);break;case "p":this.p=Z(c.textContent)}}return this};D.prototype.parse=function(b){this.params=[];this.source=b.getAttribute("source");this.count=aa(b,"count",0);this.stride=aa(b,"stride",0);for(var e=
|
|
|
+0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeName=="param"){var f={};f.name=c.getAttribute("name");f.type=c.getAttribute("type");this.params.push(f)}}return this};H.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++)b.childNodes[e].nodeName=="input"&&(input=(new L).parse(b.childNodes[e]),this.input[input.semantic]=input);return this};L.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,
|
|
|
+"");this.set=aa(b,"set",-1);this.offset=aa(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};M.prototype.parse=function(b){this.id=b.getAttribute("id");for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];switch(c.nodeName){case "bool_array":for(var f=ia(c.textContent),h=[],k=0;k<f.length;k++)h.push(f[k]=="true"||f[k]=="1"?!0:!1);this.data=h;this.type=c.nodeName;break;case "float_array":this.data=ma(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
+Z(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ia(c.textContent);this.type=c.nodeName;break;case "technique_common":for(f=0;f<c.childNodes.length;f++)if(c.childNodes[f].nodeName=="accessor"){this.accessor=(new D).parse(c.childNodes[f]);break}}}return this};M.prototype.read=function(){var b=[],e=this.accessor.params[0];switch(e.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(e=0;e<this.data.length;e+=16){var c=
|
|
|
+this.data.slice(e,e+16),f=new THREE.Matrix4;f.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15]);b.push(f)}break;default:console.log("Dae::Source:read dont know how to read "+e.type)}return b};K.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");for(var e=0;e<b.childNodes.length;e++)if(b.childNodes[e].nodeName=="instance_effect"){this.instance_effect=(new R).parse(b.childNodes[e]);break}return this};G.prototype.isColor=
|
|
|
function(){return this.texture==null};G.prototype.isTexture=function(){return this.texture!=null};G.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "color":c=ma(c.textContent);this.color=new THREE.Color(0);this.color.setRGB(c[0],c[1],c[2]);this.color.a=c[3];break;case "texture":this.texture=c.getAttribute("texture"),this.texcoord=c.getAttribute("texcoord")}}return this};B.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=
|
|
|
-b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=ca.evaluate(".//dae:float",c,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};B.prototype.create=function(){var b=
|
|
|
+b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new G).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=ca.evaluate(".//dae:float",c,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var h=f.iterateNext(),k=[];h;)k.push(h),h=f.iterateNext();f=k;f.length>0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};B.prototype.create=function(){var b=
|
|
|
{},e=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var f=this[c];if(f instanceof G)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ra[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ea+f.init_from),b.map.wrapS=THREE.RepeatWrapping,b.map.wrapT=THREE.RepeatWrapping,b.map.repeat.x=1,b.map.repeat.y=-1}else c=="diffuse"?b.color=
|
|
|
f.color.getHex():e||(b[c]=f.color.getHex());break;case "shininess":case "reflectivity":b[c]=this[c];break;case "transparency":if(e)b.transparent=!0,b.opacity=this[c],e=!0}b.shading=Fa;return this.material=new THREE.MeshLambertMaterial(b)};da.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "init_from":this.init_from=c.textContent;break;case "format":this.format=c.textContent;break;default:console.log("unhandled Surface prop: "+
|
|
|
c.nodeName)}}return this};J.prototype.parse=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":this.source=c.textContent;break;case "minfilter":this.minfilter=c.textContent;break;case "magfilter":this.magfilter=c.textContent;break;case "mipfilter":this.mipfilter=c.textContent;break;case "wrap_s":this.wrap_s=c.textContent;break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};
|
|
|
-R.prototype.create=function(){if(this.shader==null)return null};R.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};R.prototype.parseNewparam=function(b){for(var e=b.getAttribute("sid"),c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=
|
|
|
-(new da(this)).parse(f);this.surface.sid=e;break;case "sampler2D":this.sampler=(new J(this)).parse(f);this.sampler.sid=e;break;case "extra":break;default:console.log(f.nodeName)}}};R.prototype.parseProfileCOMMON=function(b){for(var e,c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":e=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return e};
|
|
|
-R.prototype.parseTechnique=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new B(c.nodeName,this)).parse(c)}}};S.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};Y.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":c=
|
|
|
-(new O).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new o(this)).parse(c));break;case "channel":this.channel.push((new W(this)).parse(c))}}return this};W.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var e=this.target.split("/");e.shift();var b=e.shift(),c=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e<h.length;e++)h[e]=
|
|
|
-parseInt(h[e].replace(/\)/,""))}this.sid=b;this.dotSyntax=c;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 e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new N).parse(c))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var e=this.inputs[b],c=this.animation.source[e.source];switch(e.semantic){case "INPUT":this.input=
|
|
|
+Q.prototype.create=function(){if(this.shader==null)return null};Q.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.shader=null;for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};Q.prototype.parseNewparam=function(b){for(var e=b.getAttribute("sid"),c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "surface":this.surface=
|
|
|
+(new da(this)).parse(f);this.surface.sid=e;break;case "sampler2D":this.sampler=(new J(this)).parse(f);this.sampler.sid=e;break;case "extra":break;default:console.log(f.nodeName)}}};Q.prototype.parseProfileCOMMON=function(b){for(var e,c=0;c<b.childNodes.length;c++){var f=b.childNodes[c];if(f.nodeType==1)switch(f.nodeName){case "profile_COMMON":this.parseProfileCOMMON(f);break;case "technique":e=f;break;case "newparam":this.parseNewparam(f);break;case "extra":break;default:console.log(f.nodeName)}}return e};
|
|
|
+Q.prototype.parseTechnique=function(b){for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new B(c.nodeName,this)).parse(c)}}};R.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};Y.prototype.parse=function(b){this.id=b.getAttribute("id");this.name=b.getAttribute("name");this.source={};for(var e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "source":c=
|
|
|
+(new M).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new o(this)).parse(c));break;case "channel":this.channel.push((new V(this)).parse(c))}}return this};V.prototype.parse=function(b){this.source=b.getAttribute("source").replace(/^#/,"");this.target=b.getAttribute("target");var e=this.target.split("/");e.shift();var b=e.shift(),c=b.indexOf(".")>=0,f=b.indexOf("(")>=0,h,k;if(c)e=b.split("."),b=e.shift(),k=e.shift();else if(f){h=b.split("(");b=h.shift();for(e=0;e<h.length;e++)h[e]=
|
|
|
+parseInt(h[e].replace(/\)/,""))}this.sid=b;this.dotSyntax=c;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 e=0;e<b.childNodes.length;e++){var c=b.childNodes[e];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new L).parse(c))}}return this};o.prototype.create=function(){for(var b=0;b<this.inputs.length;b++){var e=this.inputs[b],c=this.animation.source[e.source];switch(e.semantic){case "INPUT":this.input=
|
|
|
c.read();break;case "OUTPUT":this.output=c.read();break;case "INTERPOLATION":this.interpolation=c.read();break;case "IN_TANGENT":break;case "OUT_TANGENT":break;default:console.log(e.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)){ga=f;var o,p=e;ca=n.responseXML;o=ga;p!==void 0&&(p=p.split("/"),p.pop(),Ea=p.join("/")+"/");ra=b("//dae:library_images/dae:image",k,"image");qa=b("//dae:library_materials/dae:material",
|
|
|
-K,"material");wa=b("//dae:library_effects/dae:effect",R,"effect");oa=b("//dae:library_geometries/dae:geometry",A,"geometry");P=b("//dae:library_controllers/dae:controller",m,"controller");na=b("//dae:library_animations/dae:animation",Y,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",v,"visual_scene");Aa=[];Ca=[];(p=ca.evaluate(".//dae:scene/dae:instance_visual_scene",ca,Q,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),X=ta[p]):
|
|
|
-X=null;$=new THREE.Object3D;for(p=0;p<X.nodes.length;p++)$.add(h(X.nodes[p]));c();for(var t in na);t={scene:$,morphs:Aa,skins:Ca,dae:{images:ra,materials:qa,effects:wa,geometries:oa,controllers:P,animations:na,visualScenes:ta,scene:X}};o&&o(t)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Fa=b},applySkin:f,geometries:oa}};THREE.JSONLoader=function(b){THREE.Loader.call(this,b)};THREE.JSONLoader.prototype=new THREE.Loader;
|
|
|
+K,"material");wa=b("//dae:library_effects/dae:effect",Q,"effect");oa=b("//dae:library_geometries/dae:geometry",z,"geometry");O=b("//dae:library_controllers/dae:controller",m,"controller");na=b("//dae:library_animations/dae:animation",Y,"animation");ta=b(".//dae:library_visual_scenes/dae:visual_scene",u,"visual_scene");Aa=[];Ca=[];(p=ca.evaluate(".//dae:scene/dae:instance_visual_scene",ca,P,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(p=p.getAttribute("url").replace(/^#/,""),W=ta[p]):
|
|
|
+W=null;$=new THREE.Object3D;for(p=0;p<W.nodes.length;p++)$.add(h(W.nodes[p]));c();for(var t in na);t={scene:$,morphs:Aa,skins:Ca,dae:{images:ra,materials:qa,effects:wa,geometries:oa,controllers:O,animations:na,visualScenes:ta,scene:W}};o&&o(t)}};n.open("GET",e,!0);n.send(null)}else alert("Don't know how to parse XML!")},setPreferredShading:function(b){Fa=b},applySkin:f,geometries:oa}};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(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,h,t,v,w,u,x,p,y,A,z,E,F,D,H=b.faces;u=b.vertices;var N=b.normals,O=b.colors,K=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&K++;for(c=0;c<K;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];v=0;for(w=u.length;v<w;)x=new THREE.Vertex,x.position.x=u[v++]*e,x.position.y=
|
|
|
-u[v++]*e,x.position.z=u[v++]*e,f.vertices.push(x);v=0;for(w=H.length;v<w;){e=H[v++];u=e&1;t=e&2;c=e&4;h=e&8;p=e&16;x=e&32;A=e&64;e&=128;u?(z=new THREE.Face4,z.a=H[v++],z.b=H[v++],z.c=H[v++],z.d=H[v++],u=4):(z=new THREE.Face3,z.a=H[v++],z.b=H[v++],z.c=H[v++],u=3);if(t)t=H[v++],z.materials=f.materials[t];t=f.faces.length;if(c)for(c=0;c<K;c++)E=b.uvs[c],y=H[v++],D=E[y*2],y=E[y*2+1],f.faceUvs[c][t]=new THREE.UV(D,y);if(h)for(c=0;c<K;c++){E=b.uvs[c];F=[];for(h=0;h<u;h++)y=H[v++],D=E[y*2],y=E[y*2+1],F[h]=
|
|
|
-new THREE.UV(D,y);f.faceVertexUvs[c][t]=F}if(p)p=H[v++]*3,h=new THREE.Vector3,h.x=N[p++],h.y=N[p++],h.z=N[p],z.normal=h;if(x)for(c=0;c<u;c++)p=H[v++]*3,h=new THREE.Vector3,h.x=N[p++],h.y=N[p++],h.z=N[p],z.vertexNormals.push(h);if(A)x=H[v++],x=new THREE.Color(O[x]),z.color=x;if(e)for(c=0;c<u;c++)x=H[v++],x=new THREE.Color(O[x]),z.vertexColors.push(x);f.faces.push(z)}}})(h);(function(){var e,c,h,t;if(b.skinWeights){e=0;for(c=b.skinWeights.length;e<c;e+=2)h=b.skinWeights[e],t=b.skinWeights[e+1],f.skinWeights.push(new THREE.Vector4(h,
|
|
|
-t,0,0))}if(b.skinIndices){e=0;for(c=b.skinIndices.length;e<c;e+=2)h=b.skinIndices[e],t=b.skinIndices[e+1],f.skinIndices.push(new THREE.Vector4(h,t,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(e){if(b.morphTargets!==void 0){var c,h,t,v,w,u,x,p,y;c=0;for(h=b.morphTargets.length;c<h;c++){f.morphTargets[c]={};f.morphTargets[c].name=b.morphTargets[c].name;f.morphTargets[c].vertices=[];p=f.morphTargets[c].vertices;y=b.morphTargets[c].vertices;t=0;for(v=y.length;t<v;t+=3)w=y[t]*e,u=y[t+1]*
|
|
|
-e,x=y[t+2]*e,p.push(new THREE.Vertex(new THREE.Vector3(w,u,x)))}}if(b.morphColors!==void 0){c=0;for(h=b.morphColors.length;c<h;c++){f.morphColors[c]={};f.morphColors[c].name=b.morphColors[c].name;f.morphColors[c].colors=[];v=f.morphColors[c].colors;w=b.morphColors[c].colors;e=0;for(t=w.length;e<t;e+=3)u=new THREE.Color(16755200),u.setRGB(w[e],w[e+1],w[e+2]),v.push(u)}}})(h);f.computeCentroids();f.computeFaceNormals();this.hasNormals(f)&&f.computeTangents();c(f)};
|
|
|
+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(e){if(b.version===void 0||b.version!=2)console.error("Deprecated file format.");else{var c,h,p,u,w,t,x,v,A,z,y,E,F,D,H=b.faces;t=b.vertices;var L=b.normals,M=b.colors,K=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&K++;for(c=0;c<K;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];u=0;for(w=t.length;u<w;)x=new THREE.Vertex,x.position.x=t[u++]*e,x.position.y=
|
|
|
+t[u++]*e,x.position.z=t[u++]*e,f.vertices.push(x);u=0;for(w=H.length;u<w;){e=H[u++];t=e&1;p=e&2;c=e&4;h=e&8;v=e&16;x=e&32;z=e&64;e&=128;t?(y=new THREE.Face4,y.a=H[u++],y.b=H[u++],y.c=H[u++],y.d=H[u++],t=4):(y=new THREE.Face3,y.a=H[u++],y.b=H[u++],y.c=H[u++],t=3);if(p)p=H[u++],y.materials=f.materials[p];p=f.faces.length;if(c)for(c=0;c<K;c++)E=b.uvs[c],A=H[u++],D=E[A*2],A=E[A*2+1],f.faceUvs[c][p]=new THREE.UV(D,A);if(h)for(c=0;c<K;c++){E=b.uvs[c];F=[];for(h=0;h<t;h++)A=H[u++],D=E[A*2],A=E[A*2+1],F[h]=
|
|
|
+new THREE.UV(D,A);f.faceVertexUvs[c][p]=F}if(v)v=H[u++]*3,h=new THREE.Vector3,h.x=L[v++],h.y=L[v++],h.z=L[v],y.normal=h;if(x)for(c=0;c<t;c++)v=H[u++]*3,h=new THREE.Vector3,h.x=L[v++],h.y=L[v++],h.z=L[v],y.vertexNormals.push(h);if(z)x=H[u++],x=new THREE.Color(M[x]),y.color=x;if(e)for(c=0;c<t;c++)x=H[u++],x=new THREE.Color(M[x]),y.vertexColors.push(x);f.faces.push(y)}}})(h);(function(){var e,c,h,p;if(b.skinWeights){e=0;for(c=b.skinWeights.length;e<c;e+=2)h=b.skinWeights[e],p=b.skinWeights[e+1],f.skinWeights.push(new THREE.Vector4(h,
|
|
|
+p,0,0))}if(b.skinIndices){e=0;for(c=b.skinIndices.length;e<c;e+=2)h=b.skinIndices[e],p=b.skinIndices[e+1],f.skinIndices.push(new THREE.Vector4(h,p,0,0))}f.bones=b.bones;f.animation=b.animation})();(function(e){if(b.morphTargets!==void 0){var c,h,p,u,w,t,x,v,A;c=0;for(h=b.morphTargets.length;c<h;c++){f.morphTargets[c]={};f.morphTargets[c].name=b.morphTargets[c].name;f.morphTargets[c].vertices=[];v=f.morphTargets[c].vertices;A=b.morphTargets[c].vertices;p=0;for(u=A.length;p<u;p+=3)w=A[p]*e,t=A[p+1]*
|
|
|
+e,x=A[p+2]*e,v.push(new THREE.Vertex(new THREE.Vector3(w,t,x)))}}if(b.morphColors!==void 0){c=0;for(h=b.morphColors.length;c<h;c++){f.morphColors[c]={};f.morphColors[c].name=b.morphColors[c].name;f.morphColors[c].colors=[];u=f.morphColors[c].colors;w=b.morphColors[c].colors;e=0;for(p=w.length;e<p;e+=3)t=new THREE.Color(16755200),t.setRGB(w[e],w[e+1],w[e+2]),u.push(t)}}})(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,e){return e=="relativeToHTML"?b:h+"/"+b}function n(){for(p in R.objects)if(!Q.objects[p])if(F=R.objects[p],F.geometry!==void 0){if(O=Q.geometries[F.geometry]){var b=!1;da=[];for(Z=0;Z<F.materials.length;Z++)da[Z]=Q.materials[F.materials[Z]],b=da[Z]instanceof THREE.ShaderMaterial;b&&O.computeTangents();D=F.position;r=F.rotation;
|
|
|
-q=F.quaternion;s=F.scale;q=0;da.length==0&&(da[0]=new THREE.MeshFaceMaterial);da.length>1&&(da=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(O,da);object.name=p;object.position.set(D[0],D[1],D[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=F.visible;Q.scene.add(object);Q.objects[p]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),Q.scene.collisions.colliders.push(b));
|
|
|
-if(F.castsShadow)b=new THREE.ShadowVolume(O),Q.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},Q.triggers[object.name]=b)}}else D=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=p,object.position.set(D[0],D[1],D[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
-s[1],s[2]),object.visible=F.visible!==void 0?F.visible:!1,Q.scene.add(object),Q.objects[p]=object,Q.empties[p]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},Q.triggers[object.name]=b)}function t(b){return function(c){Q.geometries[b]=c;n();Y-=1;e.onLoadComplete();w()}}function v(b){return function(e){Q.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-Y,loadedTextures:ea-W},Q);e.onLoadProgress();Y==0&&W==0&&c(Q)}var u,
|
|
|
-x,p,y,A,z,E,F,D,H,N,O,K,G,B,da,J,R,S,Y,W,o,ea,Q;R=b.data;B=new THREE.BinaryLoader;S=new THREE.JSONLoader;W=Y=0;Q={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(p in R.objects)if(F=R.objects[p],F.meshCollider){b=!0;break}if(b)Q.scene.collisions=new THREE.CollisionSystem;if(R.transform){b=R.transform.position;H=R.transform.rotation;var ma=R.transform.scale;b&&Q.scene.position.set(b[0],b[1],b[2]);H&&Q.scene.rotation.set(H[0],
|
|
|
-H[1],H[2]);ma&&Q.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&Q.scene.updateMatrix()}b=function(){W-=1;w();e.onLoadComplete()};for(A in R.cameras){H=R.cameras[A];if(H.type=="perspective")K=new THREE.Camera(H.fov,H.aspect,H.near,H.far),K.useTarget=!0;else if(H.type=="ortho")K=new THREE.Camera,K.useTarget=!0,K.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);D=H.position;H=H.target;K.position.set(D[0],D[1],D[2]);K.target.position.set(H[0],H[1],H[2]);Q.cameras[A]=
|
|
|
-K}for(y in R.lights)A=R.lights[y],K=A.color!==void 0?A.color:16777215,H=A.intensity!==void 0?A.intensity:1,A.type=="directional"?(D=A.direction,J=new THREE.DirectionalLight(K,H),J.position.set(D[0],D[1],D[2]),J.position.normalize()):A.type=="point"?(D=A.position,d=A.distance,J=new THREE.PointLight(K,H,d),J.position.set(D[0],D[1],D[2])):A.type=="ambient"&&(J=new THREE.AmbientLight(K)),Q.scene.add(J),Q.lights[y]=J;for(z in R.fogs)y=R.fogs[z],y.type=="linear"?G=new THREE.Fog(0,y.near,y.far):y.type==
|
|
|
-"exp2"&&(G=new THREE.FogExp2(0,y.density)),H=y.color,G.color.setRGB(H[0],H[1],H[2]),Q.fogs[z]=G;if(Q.cameras&&R.defaults.camera)Q.currentCamera=Q.cameras[R.defaults.camera];if(Q.fogs&&R.defaults.fog)Q.scene.fog=Q.fogs[R.defaults.fog];H=R.defaults.bgcolor;Q.bgColor=new THREE.Color;Q.bgColor.setRGB(H[0],H[1],H[2]);Q.bgColorAlpha=R.defaults.bgalpha;for(u in R.geometries)if(z=R.geometries[u],z.type=="bin_mesh"||z.type=="ascii_mesh")Y+=1,e.onLoadStart();o=Y;for(u in R.geometries)z=R.geometries[u],z.type==
|
|
|
-"cube"?(O=new THREE.CubeGeometry(z.width,z.height,z.depth,z.segmentsWidth,z.segmentsHeight,z.segmentsDepth,null,z.flipped,z.sides),Q.geometries[u]=O):z.type=="plane"?(O=new THREE.PlaneGeometry(z.width,z.height,z.segmentsWidth,z.segmentsHeight),Q.geometries[u]=O):z.type=="sphere"?(O=new THREE.SphereGeometry(z.radius,z.segmentsWidth,z.segmentsHeight),Q.geometries[u]=O):z.type=="cylinder"?(O=new THREE.CylinderGeometry(z.topRad,z.botRad,z.height,z.radSegs,z.heightSegs),Q.geometries[u]=O):z.type=="torus"?
|
|
|
-(O=new THREE.TorusGeometry(z.radius,z.tube,z.segmentsR,z.segmentsT),Q.geometries[u]=O):z.type=="icosahedron"?(O=new THREE.IcosahedronGeometry(z.subdivisions),Q.geometries[u]=O):z.type=="bin_mesh"?B.load({model:f(z.url,R.urlBaseType),callback:t(u)}):z.type=="ascii_mesh"?S.load({model:f(z.url,R.urlBaseType),callback:t(u)}):z.type=="embedded_mesh"&&(z=R.embeds[z.id])&&S.createModel(z,v(u),"");for(E in R.textures)if(u=R.textures[E],u.url instanceof Array){W+=u.url.length;for(B=0;B<u.url.length;B++)e.onLoadStart()}else W+=
|
|
|
-1,e.onLoadStart();ea=W;for(E in R.textures){u=R.textures[E];if(u.mapping!=void 0&&THREE[u.mapping]!=void 0)u.mapping=new THREE[u.mapping];if(u.url instanceof Array){B=[];for(var Z=0;Z<u.url.length;Z++)B[Z]=f(u.url[Z],R.urlBaseType);B=THREE.ImageUtils.loadTextureCube(B,u.mapping,b)}else{B=THREE.ImageUtils.loadTexture(f(u.url,R.urlBaseType),u.mapping,b);if(THREE[u.minFilter]!=void 0)B.minFilter=THREE[u.minFilter];if(THREE[u.magFilter]!=void 0)B.magFilter=THREE[u.magFilter];if(u.repeat){B.repeat.set(u.repeat[0],
|
|
|
-u.repeat[1]);if(u.repeat[0]!=1)B.wrapS=THREE.RepeatWrapping;if(u.repeat[1]!=1)B.wrapT=THREE.RepeatWrapping}u.offset&&B.offset.set(u.offset[0],u.offset[1]);if(u.wrap){S={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(S[u.wrap[0]]!==void 0)B.wrapS=S[u.wrap[0]];if(S[u.wrap[1]]!==void 0)B.wrapT=S[u.wrap[1]]}}Q.textures[E]=B}for(x in R.materials){E=R.materials[x];for(N in E.parameters)if(N=="envMap"||N=="map"||N=="lightMap")E.parameters[N]=Q.textures[E.parameters[N]];else if(N=="shading")E.parameters[N]=
|
|
|
-E.parameters[N]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(N=="blending")E.parameters[N]=THREE[E.parameters[N]]?THREE[E.parameters[N]]:THREE.NormalBlending;else if(N=="combine")E.parameters[N]=E.parameters[N]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(N=="vertexColors")if(E.parameters[N]=="face")E.parameters[N]=THREE.FaceColors;else if(E.parameters[N])E.parameters[N]=THREE.VertexColors;if(E.parameters.opacity!==void 0&&E.parameters.opacity<1)E.parameters.transparent=
|
|
|
-!0;if(E.parameters.normalMap){u=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(u.uniforms);B=E.parameters.color;S=E.parameters.specular;z=E.parameters.ambient;G=E.parameters.shininess;b.tNormal.texture=Q.textures[E.parameters.normalMap];if(E.parameters.normalMapFactor)b.uNormalScale.value=E.parameters.normalMapFactor;if(E.parameters.map)b.tDiffuse.texture=E.parameters.map,b.enableDiffuse.value=!0;if(E.parameters.lightMap)b.tAO.texture=E.parameters.lightMap,b.enableAO.value=!0;if(E.parameters.specularMap)b.tSpecular.texture=
|
|
|
-Q.textures[E.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(B);b.uSpecularColor.value.setHex(S);b.uAmbientColor.value.setHex(z);b.uShininess.value=G;if(E.parameters.opacity)b.uOpacity.value=E.parameters.opacity;E=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:b,lights:!0,fog:!0})}else E=new THREE[E.type](E.parameters);Q.materials[x]=E}n();e.callbackSync(Q)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
|
+THREE.SceneLoader.prototype={load:function(b,c){var e=this,f=new Worker(b);f.postMessage(0);var h=THREE.Loader.prototype.extractUrlbase(b);f.onmessage=function(b){function f(b,e){return e=="relativeToHTML"?b:h+"/"+b}function n(){for(v in Q.objects)if(!P.objects[v])if(F=Q.objects[v],F.geometry!==void 0){if(M=P.geometries[F.geometry]){var b=!1;da=[];for(Z=0;Z<F.materials.length;Z++)da[Z]=P.materials[F.materials[Z]],b=da[Z]instanceof THREE.ShaderMaterial;b&&M.computeTangents();D=F.position;r=F.rotation;
|
|
|
+q=F.quaternion;s=F.scale;q=0;da.length==0&&(da[0]=new THREE.MeshFaceMaterial);da.length>1&&(da=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(M,da);object.name=v;object.position.set(D[0],D[1],D[2]);q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]);object.scale.set(s[0],s[1],s[2]);object.visible=F.visible;P.scene.add(object);P.objects[v]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),P.scene.collisions.colliders.push(b));
|
|
|
+if(F.castsShadow)b=new THREE.ShadowVolume(M),P.scene.add(b),b.position=object.position,b.rotation=object.rotation,b.scale=object.scale;F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},P.triggers[object.name]=b)}}else D=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(D[0],D[1],D[2]),q?(object.quaternion.set(q[0],q[1],q[2],q[3]),object.useQuaternion=!0):object.rotation.set(r[0],r[1],r[2]),object.scale.set(s[0],
|
|
|
+s[1],s[2]),object.visible=F.visible!==void 0?F.visible:!1,P.scene.add(object),P.objects[v]=object,P.empties[v]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},P.triggers[object.name]=b)}function p(b){return function(c){P.geometries[b]=c;n();Y-=1;e.onLoadComplete();w()}}function u(b){return function(e){P.geometries[b]=e}}function w(){e.callbackProgress({totalModels:o,totalTextures:ea,loadedModels:o-Y,loadedTextures:ea-V},P);e.onLoadProgress();Y==0&&V==0&&c(P)}var t,
|
|
|
+x,v,A,z,y,E,F,D,H,L,M,K,G,B,da,J,Q,R,Y,V,o,ea,P;Q=b.data;B=new THREE.BinaryLoader;R=new THREE.JSONLoader;V=Y=0;P={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in Q.objects)if(F=Q.objects[v],F.meshCollider){b=!0;break}if(b)P.scene.collisions=new THREE.CollisionSystem;if(Q.transform){b=Q.transform.position;H=Q.transform.rotation;var ma=Q.transform.scale;b&&P.scene.position.set(b[0],b[1],b[2]);H&&P.scene.rotation.set(H[0],
|
|
|
+H[1],H[2]);ma&&P.scene.scale.set(ma[0],ma[1],ma[2]);(b||H||ma)&&P.scene.updateMatrix()}b=function(){V-=1;w();e.onLoadComplete()};for(z in Q.cameras){H=Q.cameras[z];if(H.type=="perspective")K=new THREE.Camera(H.fov,H.aspect,H.near,H.far),K.useTarget=!0;else if(H.type=="ortho")K=new THREE.Camera,K.useTarget=!0,K.projectionMatrix=THREE.Matrix4.makeOrtho(H.left,H.right,H.top,H.bottom,H.near,H.far);D=H.position;H=H.target;K.position.set(D[0],D[1],D[2]);K.target.position.set(H[0],H[1],H[2]);P.cameras[z]=
|
|
|
+K}for(A in Q.lights)z=Q.lights[A],K=z.color!==void 0?z.color:16777215,H=z.intensity!==void 0?z.intensity:1,z.type=="directional"?(D=z.direction,J=new THREE.DirectionalLight(K,H),J.position.set(D[0],D[1],D[2]),J.position.normalize()):z.type=="point"?(D=z.position,d=z.distance,J=new THREE.PointLight(K,H,d),J.position.set(D[0],D[1],D[2])):z.type=="ambient"&&(J=new THREE.AmbientLight(K)),P.scene.add(J),P.lights[A]=J;for(y in Q.fogs)A=Q.fogs[y],A.type=="linear"?G=new THREE.Fog(0,A.near,A.far):A.type==
|
|
|
+"exp2"&&(G=new THREE.FogExp2(0,A.density)),H=A.color,G.color.setRGB(H[0],H[1],H[2]),P.fogs[y]=G;if(P.cameras&&Q.defaults.camera)P.currentCamera=P.cameras[Q.defaults.camera];if(P.fogs&&Q.defaults.fog)P.scene.fog=P.fogs[Q.defaults.fog];H=Q.defaults.bgcolor;P.bgColor=new THREE.Color;P.bgColor.setRGB(H[0],H[1],H[2]);P.bgColorAlpha=Q.defaults.bgalpha;for(t in Q.geometries)if(y=Q.geometries[t],y.type=="bin_mesh"||y.type=="ascii_mesh")Y+=1,e.onLoadStart();o=Y;for(t in Q.geometries)y=Q.geometries[t],y.type==
|
|
|
+"cube"?(M=new THREE.CubeGeometry(y.width,y.height,y.depth,y.segmentsWidth,y.segmentsHeight,y.segmentsDepth,null,y.flipped,y.sides),P.geometries[t]=M):y.type=="plane"?(M=new THREE.PlaneGeometry(y.width,y.height,y.segmentsWidth,y.segmentsHeight),P.geometries[t]=M):y.type=="sphere"?(M=new THREE.SphereGeometry(y.radius,y.segmentsWidth,y.segmentsHeight),P.geometries[t]=M):y.type=="cylinder"?(M=new THREE.CylinderGeometry(y.topRad,y.botRad,y.height,y.radSegs,y.heightSegs),P.geometries[t]=M):y.type=="torus"?
|
|
|
+(M=new THREE.TorusGeometry(y.radius,y.tube,y.segmentsR,y.segmentsT),P.geometries[t]=M):y.type=="icosahedron"?(M=new THREE.IcosahedronGeometry(y.subdivisions),P.geometries[t]=M):y.type=="bin_mesh"?B.load({model:f(y.url,Q.urlBaseType),callback:p(t)}):y.type=="ascii_mesh"?R.load({model:f(y.url,Q.urlBaseType),callback:p(t)}):y.type=="embedded_mesh"&&(y=Q.embeds[y.id])&&R.createModel(y,u(t),"");for(E in Q.textures)if(t=Q.textures[E],t.url instanceof Array){V+=t.url.length;for(B=0;B<t.url.length;B++)e.onLoadStart()}else V+=
|
|
|
+1,e.onLoadStart();ea=V;for(E in Q.textures){t=Q.textures[E];if(t.mapping!=void 0&&THREE[t.mapping]!=void 0)t.mapping=new THREE[t.mapping];if(t.url instanceof Array){B=[];for(var Z=0;Z<t.url.length;Z++)B[Z]=f(t.url[Z],Q.urlBaseType);B=THREE.ImageUtils.loadTextureCube(B,t.mapping,b)}else{B=THREE.ImageUtils.loadTexture(f(t.url,Q.urlBaseType),t.mapping,b);if(THREE[t.minFilter]!=void 0)B.minFilter=THREE[t.minFilter];if(THREE[t.magFilter]!=void 0)B.magFilter=THREE[t.magFilter];if(t.repeat){B.repeat.set(t.repeat[0],
|
|
|
+t.repeat[1]);if(t.repeat[0]!=1)B.wrapS=THREE.RepeatWrapping;if(t.repeat[1]!=1)B.wrapT=THREE.RepeatWrapping}t.offset&&B.offset.set(t.offset[0],t.offset[1]);if(t.wrap){R={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(R[t.wrap[0]]!==void 0)B.wrapS=R[t.wrap[0]];if(R[t.wrap[1]]!==void 0)B.wrapT=R[t.wrap[1]]}}P.textures[E]=B}for(x in Q.materials){E=Q.materials[x];for(L in E.parameters)if(L=="envMap"||L=="map"||L=="lightMap")E.parameters[L]=P.textures[E.parameters[L]];else if(L=="shading")E.parameters[L]=
|
|
|
+E.parameters[L]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(L=="blending")E.parameters[L]=THREE[E.parameters[L]]?THREE[E.parameters[L]]:THREE.NormalBlending;else if(L=="combine")E.parameters[L]=E.parameters[L]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(L=="vertexColors")if(E.parameters[L]=="face")E.parameters[L]=THREE.FaceColors;else if(E.parameters[L])E.parameters[L]=THREE.VertexColors;if(E.parameters.opacity!==void 0&&E.parameters.opacity<1)E.parameters.transparent=
|
|
|
+!0;if(E.parameters.normalMap){t=THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(t.uniforms);B=E.parameters.color;R=E.parameters.specular;y=E.parameters.ambient;G=E.parameters.shininess;b.tNormal.texture=P.textures[E.parameters.normalMap];if(E.parameters.normalMapFactor)b.uNormalScale.value=E.parameters.normalMapFactor;if(E.parameters.map)b.tDiffuse.texture=E.parameters.map,b.enableDiffuse.value=!0;if(E.parameters.lightMap)b.tAO.texture=E.parameters.lightMap,b.enableAO.value=!0;if(E.parameters.specularMap)b.tSpecular.texture=
|
|
|
+P.textures[E.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(B);b.uSpecularColor.value.setHex(R);b.uAmbientColor.value.setHex(y);b.uShininess.value=G;if(E.parameters.opacity)b.uOpacity.value=E.parameters.opacity;E=new THREE.ShaderMaterial({fragmentShader:t.fragmentShader,vertexShader:t.vertexShader,uniforms:b,lights:!0,fog:!0})}else E=new THREE[E.type](E.parameters);P.materials[x]=E}n();e.callbackSync(P)}},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,k=b.offsetX!==void 0?b.offsetX:0,m=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,k,m,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 k=0,m=0;m<c;++m){var n=b.charCodeAt(m+f);k+=n>>1^-(n&1);e[8*m+h]=k}f+=c}c=b.length-f;k=new Uint16Array(c);for(h=m=0;h<c;h++)n=b.charCodeAt(h+f),k[h]=m-n,n==0&&m++;return[e,k]};
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,k){var m=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var m=THREE.UTF8Loader.prototype.decompressMesh(b),v=[],w=[];(function(b,m,p){for(var t,v,w,E=b.length;p<E;p+=m)t=b[p],v=b[p+1],w=b[p+2],t=t/16383*e,v=v/16383*e,w=w/16383*e,t+=f,v+=h,w+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(t,v,w)))})(m[0],8,0);(function(b,e,c){for(var f,h,k=b.length;c<k;c+=e)f=b[c],h=b[c+1],f/=1023,h/=1023,w.push(f,1-h)})(m[0],8,3);(function(b,
|
|
|
-e,c){for(var f,h,k,m=b.length;c<m;c+=e)f=b[c],h=b[c+1],k=b[c+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,v.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,t,F,D,H,N=b.length;for(e=0;e<N;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;H=h;t=k;F=f;var O=h,K=k,G=m.materials[0],B=v[O*3],da=v[O*3+1],O=v[O*3+2],J=v[K*3],R=v[K*3+1],K=v[K*3+2];F=new THREE.Vector3(v[F*3],v[F*3+1],v[F*3+2]);O=new THREE.Vector3(B,da,O);K=new THREE.Vector3(J,R,K);m.faces.push(new THREE.Face3(D,H,t,[F,O,K],null,G));m=w[f*2];f=w[f*
|
|
|
-2+1];t=w[h*2];F=w[h*2+1];D=w[k*2];H=w[k*2+1];k=c.faceVertexUvs[0];h=t;t=F;F=[];F.push(new THREE.UV(m,f));F.push(new THREE.UV(h,t));F.push(new THREE.UV(D,H));k.push(F)}})(m[1]);this.computeCentroids();this.computeFaceNormals()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m)};
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(b,c,e,f,h,k){var m=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var m=THREE.UTF8Loader.prototype.decompressMesh(b),u=[],w=[];(function(b,m,p){for(var u,w,y,E=b.length;p<E;p+=m)u=b[p],w=b[p+1],y=b[p+2],u=u/16383*e,w=w/16383*e,y=y/16383*e,u+=f,w+=h,y+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,w,y)))})(m[0],8,0);(function(b,e,c){for(var f,h,k=b.length;c<k;c+=e)f=b[c],h=b[c+1],f/=1023,h/=1023,w.push(f,1-h)})(m[0],8,3);(function(b,
|
|
|
+e,c){for(var f,h,k,m=b.length;c<m;c+=e)f=b[c],h=b[c+1],k=b[c+2],f=(f-512)/511,h=(h-512)/511,k=(k-512)/511,u.push(f,h,k)})(m[0],8,5);(function(b){var e,f,h,k,m,p,F,D,H,L=b.length;for(e=0;e<L;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;H=h;p=k;F=f;var M=h,K=k,G=m.materials[0],B=u[M*3],da=u[M*3+1],M=u[M*3+2],J=u[K*3],Q=u[K*3+1],K=u[K*3+2];F=new THREE.Vector3(u[F*3],u[F*3+1],u[F*3+2]);M=new THREE.Vector3(B,da,M);K=new THREE.Vector3(J,Q,K);m.faces.push(new THREE.Face3(D,H,p,[F,M,K],null,G));m=w[f*2];f=w[f*
|
|
|
+2+1];p=w[h*2];F=w[h*2+1];D=w[k*2];H=w[k*2+1];k=c.faceVertexUvs[0];h=p;p=F;F=[];F.push(new THREE.UV(m,f));F.push(new THREE.UV(h,p));F.push(new THREE.UV(D,H));k.push(F)}})(m[1]);this.computeCentroids();this.computeFaceNormals()};m.prototype=new THREE.Geometry;m.prototype.constructor=m;c(new m)};
|
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var b=new THREE.Geometry;b.vertices.push(new THREE.Vertex);b.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),e=new THREE.Line(b,new THREE.LineBasicMaterial({color:16711680}));e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));e.position.x=100;e.rotation.z=-Math.PI/2;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:65280}));this.add(e);
|
|
|
e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));e.position.y=100;this.add(e);e=new THREE.Line(b,new THREE.LineBasicMaterial({color:255}));e.rotation.x=Math.PI/2;this.add(e);e=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));e.position.z=100;e.rotation.x=Math.PI/2;this.add(e)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
|
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,k,m,n,t,v,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=t;c[k+2]=v;h[k]=this.lerp(w[b],w[b+3],m);h[k+1]=this.lerp(w[b+1],w[b+4],m);h[k+2]=this.lerp(w[b+2],w[b+5],m)};this.VIntY=function(b,c,h,k,m,n,t,v,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=t+m*this.delta;c[k+
|
|
|
-2]=v;c=b+this.yd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.VIntZ=function(b,c,h,k,m,n,t,v,w,u){m=(m-w)/(u-w);w=this.normal_cache;c[k]=n;c[k+1]=t;c[k+2]=v+m*this.delta;c=b+this.zd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};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,k,m,n){var t=k+1,v=k+this.yd,w=k+this.zd,u=t+this.yd,x=t+this.zd,p=k+this.yd+this.zd,y=t+this.yd+this.zd,A=0,z=this.field[k],E=this.field[t],F=this.field[v],D=this.field[u],H=this.field[w],N=this.field[x],O=this.field[p],K=this.field[y];z<m&&(A|=1);E<m&&(A|=2);F<m&&(A|=8);D<m&&(A|=4);H<m&&(A|=16);N<m&&(A|=32);O<m&&(A|=128);K<m&&(A|=64);var G=THREE.edgeTable[A];if(G==0)return 0;var B=this.delta,
|
|
|
-da=b+B,J=c+B,B=h+B;G&1&&(this.compNorm(k),this.compNorm(t),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,z,E));G&2&&(this.compNorm(t),this.compNorm(u),this.VIntY(t*3,this.vlist,this.nlist,3,m,da,c,h,E,D));G&4&&(this.compNorm(v),this.compNorm(u),this.VIntX(v*3,this.vlist,this.nlist,6,m,b,J,h,F,D));G&8&&(this.compNorm(k),this.compNorm(v),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,z,F));G&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,B,H,N));G&32&&(this.compNorm(x),
|
|
|
-this.compNorm(y),this.VIntY(x*3,this.vlist,this.nlist,15,m,da,c,B,N,K));G&64&&(this.compNorm(p),this.compNorm(y),this.VIntX(p*3,this.vlist,this.nlist,18,m,b,J,B,O,K));G&128&&(this.compNorm(w),this.compNorm(p),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,B,H,O));G&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,z,H));G&512&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*3,this.vlist,this.nlist,27,m,da,c,h,E,N));G&1024&&(this.compNorm(u),this.compNorm(y),this.VIntZ(u*
|
|
|
-3,this.vlist,this.nlist,30,m,da,J,h,D,K));G&2048&&(this.compNorm(v),this.compNorm(p),this.VIntZ(v*3,this.vlist,this.nlist,33,m,b,J,h,F,O));A<<=4;for(m=k=0;THREE.triTable[A+m]!=-1;)b=A+m,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),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){var t=this.count*3;this.positionArray[t]=b[h];this.positionArray[t+1]=b[h+1];this.positionArray[t+2]=b[h+2];this.positionArray[t+3]=b[k];this.positionArray[t+
|
|
|
-4]=b[k+1];this.positionArray[t+5]=b[k+2];this.positionArray[t+6]=b[m];this.positionArray[t+7]=b[m+1];this.positionArray[t+8]=b[m+2];this.normalArray[t]=c[h];this.normalArray[t+1]=c[h+1];this.normalArray[t+2]=c[h+2];this.normalArray[t+3]=c[k];this.normalArray[t+4]=c[k+1];this.normalArray[t+5]=c[k+2];this.normalArray[t+6]=c[m];this.normalArray[t+7]=c[m+1];this.normalArray[t+8]=c[m+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,k,m){var n=this.size*Math.sqrt(k/m),t=h*this.size,v=c*this.size,w=b*this.size,u=Math.floor(t-n);u<1&&(u=1);t=Math.floor(t+n);t>this.size-1&&(t=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,A,z,E,F,D;u<t;u++){w=this.size2*u;A=u/this.size-h;F=A*A;for(A=x;A<v;A++){z=w+this.size*A;y=A/this.size-c;D=y*y;for(y=p;y<n;y++)E=y/this.size-b,E=k/(1.0E-6+E*E+D+F)-m,E>0&&(this.field[z+y]+=E)}}};this.addPlaneX=function(b,c){var h,k,m,n,t,v=this.size,w=this.yd,u=this.zd,x=this.field,p=v*Math.sqrt(b/c);p>v&&(p=v);for(h=0;h<p;h++)if(k=h/v,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<v;k++){t=h+k*w;for(m=0;m<v;m++)x[u*m+t]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,t,v,w=this.size,u=this.yd,x=
|
|
|
-this.zd,p=this.field,y=w*Math.sqrt(b/c);y>w&&(y=w);for(k=0;k<y;k++)if(h=k/w,h*=h,n=b/(1.0E-4+h)-c,n>0){t=k*u;for(h=0;h<w;h++){v=t+h;for(m=0;m<w;m++)p[x*m+v]+=n}}};this.addPlaneZ=function(b,c){var h,k,m,n,t,v;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(m=0;m<dist;m++)if(h=m/size,h*=h,n=b/(1.0E-4+h)-c,n>0){t=zd*m;for(k=0;k<size;k++){v=t+k*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,k,m,n,t,v,w,u,x=this.size-2;for(m=1;m<x;m++){u=this.size2*m;v=(m-this.halfsize)/this.halfsize;for(k=1;k<x;k++){w=u+this.size*k;t=(k-this.halfsize)/this.halfsize;for(h=1;h<x;h++)n=(h-this.halfsize)/this.halfsize,c=w+h,this.polygonize(n,t,v,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(k){var m,n,t,v,w,u,x,p;for(m=0;m<k.count;m++)x=m*3,w=x+1,p=x+2,n=k.positionArray[x],
|
|
|
-t=k.positionArray[w],v=k.positionArray[p],u=new THREE.Vector3(n,t,v),n=k.normalArray[x],t=k.normalArray[w],v=k.normalArray[p],x=new THREE.Vector3(n,t,v),x.normalize(),w=new THREE.Vertex(u),c.vertices.push(w),h.push(x);nfaces=k.count/3;for(m=0;m<nfaces;m++)x=(b+m)*3,w=x+1,p=x+2,u=h[x],n=h[w],t=h[p],x=new THREE.Face3(x,w,p,[u,n,t]),c.faces.push(x);b+=nfaces;k.count=0});return c};this.init(b)};THREE.MarchingCubes.prototype=new THREE.Object3D;THREE.MarchingCubes.prototype.constructor=THREE.MarchingCubes;
|
|
|
+0;this.hasNormal=this.hasPos=!1;this.positionArray=new Float32Array(this.maxCount*3);this.normalArray=new Float32Array(this.maxCount*3)};this.lerp=function(b,c,h){return b+(c-b)*h};this.VIntX=function(b,c,h,k,m,n,p,u,w,t){m=(m-w)/(t-w);w=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=p;c[k+2]=u;h[k]=this.lerp(w[b],w[b+3],m);h[k+1]=this.lerp(w[b+1],w[b+4],m);h[k+2]=this.lerp(w[b+2],w[b+5],m)};this.VIntY=function(b,c,h,k,m,n,p,u,w,t){m=(m-w)/(t-w);w=this.normal_cache;c[k]=n;c[k+1]=p+m*this.delta;c[k+
|
|
|
+2]=u;c=b+this.yd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};this.VIntZ=function(b,c,h,k,m,n,p,u,w,t){m=(m-w)/(t-w);w=this.normal_cache;c[k]=n;c[k+1]=p;c[k+2]=u+m*this.delta;c=b+this.zd*3;h[k]=this.lerp(w[b],w[c],m);h[k+1]=this.lerp(w[b+1],w[c+1],m);h[k+2]=this.lerp(w[b+2],w[c+2],m)};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,k,m,n){var p=k+1,u=k+this.yd,w=k+this.zd,t=p+this.yd,x=p+this.zd,v=k+this.yd+this.zd,A=p+this.yd+this.zd,z=0,y=this.field[k],E=this.field[p],F=this.field[u],D=this.field[t],H=this.field[w],L=this.field[x],M=this.field[v],K=this.field[A];y<m&&(z|=1);E<m&&(z|=2);F<m&&(z|=8);D<m&&(z|=4);H<m&&(z|=16);L<m&&(z|=32);M<m&&(z|=128);K<m&&(z|=64);var G=THREE.edgeTable[z];if(G==0)return 0;var B=this.delta,
|
|
|
+da=b+B,J=c+B,B=h+B;G&1&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,y,E));G&2&&(this.compNorm(p),this.compNorm(t),this.VIntY(p*3,this.vlist,this.nlist,3,m,da,c,h,E,D));G&4&&(this.compNorm(u),this.compNorm(t),this.VIntX(u*3,this.vlist,this.nlist,6,m,b,J,h,F,D));G&8&&(this.compNorm(k),this.compNorm(u),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,y,F));G&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,B,H,L));G&32&&(this.compNorm(x),
|
|
|
+this.compNorm(A),this.VIntY(x*3,this.vlist,this.nlist,15,m,da,c,B,L,K));G&64&&(this.compNorm(v),this.compNorm(A),this.VIntX(v*3,this.vlist,this.nlist,18,m,b,J,B,M,K));G&128&&(this.compNorm(w),this.compNorm(v),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,B,H,M));G&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,y,H));G&512&&(this.compNorm(p),this.compNorm(x),this.VIntZ(p*3,this.vlist,this.nlist,27,m,da,c,h,E,L));G&1024&&(this.compNorm(t),this.compNorm(A),this.VIntZ(t*
|
|
|
+3,this.vlist,this.nlist,30,m,da,J,h,D,K));G&2048&&(this.compNorm(u),this.compNorm(v),this.VIntZ(u*3,this.vlist,this.nlist,33,m,b,J,h,F,M));z<<=4;for(m=k=0;THREE.triTable[z+m]!=-1;)b=z+m,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),m+=3,k++;return k};this.posnormtriv=function(b,c,h,k,m,n){var p=this.count*3;this.positionArray[p]=b[h];this.positionArray[p+1]=b[h+1];this.positionArray[p+2]=b[h+2];this.positionArray[p+3]=b[k];this.positionArray[p+
|
|
|
+4]=b[k+1];this.positionArray[p+5]=b[k+2];this.positionArray[p+6]=b[m];this.positionArray[p+7]=b[m+1];this.positionArray[p+8]=b[m+2];this.normalArray[p]=c[h];this.normalArray[p+1]=c[h+1];this.normalArray[p+2]=c[h+2];this.normalArray[p+3]=c[k];this.normalArray[p+4]=c[k+1];this.normalArray[p+5]=c[k+2];this.normalArray[p+6]=c[m];this.normalArray[p+7]=c[m+1];this.normalArray[p+8]=c[m+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,k,m){var n=this.size*Math.sqrt(k/m),p=h*this.size,u=c*this.size,w=b*this.size,t=Math.floor(p-n);t<1&&(t=1);p=Math.floor(p+n);p>this.size-1&&(p=this.size-1);var x=Math.floor(u-n);x<1&&(x=1);u=Math.floor(u+n);u>this.size-1&&(u=this.size-1);var v=Math.floor(w-n);v<1&&(v=1);n=Math.floor(w+n);n>this.size-1&&(n=this.size-
|
|
|
+1);for(var A,z,y,E,F,D;t<p;t++){w=this.size2*t;z=t/this.size-h;F=z*z;for(z=x;z<u;z++){y=w+this.size*z;A=z/this.size-c;D=A*A;for(A=v;A<n;A++)E=A/this.size-b,E=k/(1.0E-6+E*E+D+F)-m,E>0&&(this.field[y+A]+=E)}}};this.addPlaneX=function(b,c){var h,k,m,n,p,u=this.size,w=this.yd,t=this.zd,x=this.field,v=u*Math.sqrt(b/c);v>u&&(v=u);for(h=0;h<v;h++)if(k=h/u,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<u;k++){p=h+k*w;for(m=0;m<u;m++)x[t*m+p]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,p,u,w=this.size,t=this.yd,x=
|
|
|
+this.zd,v=this.field,A=w*Math.sqrt(b/c);A>w&&(A=w);for(k=0;k<A;k++)if(h=k/w,h*=h,n=b/(1.0E-4+h)-c,n>0){p=k*t;for(h=0;h<w;h++){u=p+h;for(m=0;m<w;m++)v[x*m+u]+=n}}};this.addPlaneZ=function(b,c){var h,k,m,n,p,u;size=this.size;yd=this.yd;zd=this.zd;field=this.field;dist=size*Math.sqrt(b/c);dist>size&&(dist=size);for(m=0;m<dist;m++)if(h=m/size,h*=h,n=b/(1.0E-4+h)-c,n>0){p=zd*m;for(k=0;k<size;k++){u=p+k*yd;for(h=0;h<size;h++)field[u+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,k,m,n,p,u,w,t,x=this.size-2;for(m=1;m<x;m++){t=this.size2*m;u=(m-this.halfsize)/this.halfsize;for(k=1;k<x;k++){w=t+this.size*k;p=(k-this.halfsize)/this.halfsize;for(h=1;h<x;h++)n=(h-this.halfsize)/this.halfsize,c=w+h,this.polygonize(n,p,u,c,this.isolation,b)}}this.end(b)};this.generateGeometry=function(){var b=0,c=new THREE.Geometry,h=[];this.render(function(k){var m,n,p,u,w,t,x,v;for(m=0;m<k.count;m++)x=m*3,w=x+1,v=x+2,n=k.positionArray[x],
|
|
|
+p=k.positionArray[w],u=k.positionArray[v],t=new THREE.Vector3(n,p,u),n=k.normalArray[x],p=k.normalArray[w],u=k.normalArray[v],x=new THREE.Vector3(n,p,u),x.normalize(),w=new THREE.Vertex(t),c.vertices.push(w),h.push(x);nfaces=k.count/3;for(m=0;m<nfaces;m++)x=(b+m)*3,w=x+1,v=x+2,t=h[x],n=h[w],p=h[v],x=new THREE.Face3(x,w,v,[t,n,p]),c.faces.push(x);b+=nfaces;k.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]);
|
|
@@ -680,20 +681,20 @@ THREE.MeshCollider=function(b,c){this.mesh=b;this.box=c;this.numFaces=this.mesh.
|
|
|
THREE.CollisionSystem.prototype.rayCastAll=function(b){b.direction.normalize();this.hits.length=0;var c,e,f,h,k=0;c=0;for(e=this.colliders.length;c<e;c++)if(h=this.colliders[c],f=this.rayCast(b,h),f<Number.MAX_VALUE)h.distance=f,f>k?this.hits.push(h):this.hits.unshift(h),k=f;return this.hits};
|
|
|
THREE.CollisionSystem.prototype.rayCastNearest=function(b){var c=this.rayCastAll(b);if(c.length==0)return null;for(var e=0;c[e]instanceof THREE.MeshCollider;){var f=this.rayMesh(b,c[e]);if(f.dist<Number.MAX_VALUE){c[e].distance=f.dist;c[e].faceIndex=f.faceIndex;break}e++}if(e>c.length)return null;return c[e]};
|
|
|
THREE.CollisionSystem.prototype.rayCast=function(b,c){if(c instanceof THREE.PlaneCollider)return this.rayPlane(b,c);else if(c instanceof THREE.SphereCollider)return this.raySphere(b,c);else if(c instanceof THREE.BoxCollider)return this.rayBox(b,c);else if(c instanceof THREE.MeshCollider&&c.box)return this.rayBox(b,c.box)};
|
|
|
-THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,h,k=0;k<c.numFaces;k++){var m=c.mesh.geometry.faces[k],n=c.mesh.geometry.vertices[m.a].position,t=c.mesh.geometry.vertices[m.b].position,v=c.mesh.geometry.vertices[m.c].position,w=m instanceof THREE.Face4?c.mesh.geometry.vertices[m.d].position:null;m instanceof THREE.Face3?(m=this.rayTriangle(e,n,t,v,f,this.collisionNormal,c.mesh),m<f&&(f=m,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
-m instanceof THREE.Face4&&(m=this.rayTriangle(e,n,t,w,f,this.collisionNormal,c.mesh),m<f&&(f=m,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize()),m=this.rayTriangle(e,t,v,w,f,this.collisionNormal,c.mesh),m<f&&(f=m,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:h}};
|
|
|
-THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,h,k,m){var n=THREE.CollisionSystem.__v1,t=THREE.CollisionSystem.__v2;k.set(0,0,0);n.sub(e,c);t.sub(f,e);k.cross(n,t);n=k.dot(b.direction);if(!(n<0))if(m.doubleSided||m.flipSided)k.multiplyScalar(-1),n*=-1;else return Number.MAX_VALUE;m=k.dot(c)-k.dot(b.origin);if(!(m<=0))return Number.MAX_VALUE;if(!(m>=n*h))return Number.MAX_VALUE;m/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(m);n.addSelf(b.origin);Math.abs(k.x)>
|
|
|
+THREE.CollisionSystem.prototype.rayMesh=function(b,c){for(var e=this.makeRayLocal(b,c.mesh),f=Number.MAX_VALUE,h,k=0;k<c.numFaces;k++){var m=c.mesh.geometry.faces[k],n=c.mesh.geometry.vertices[m.a].position,p=c.mesh.geometry.vertices[m.b].position,u=c.mesh.geometry.vertices[m.c].position,w=m instanceof THREE.Face4?c.mesh.geometry.vertices[m.d].position:null;m instanceof THREE.Face3?(m=this.rayTriangle(e,n,p,u,f,this.collisionNormal,c.mesh),m<f&&(f=m,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize())):
|
|
|
+m instanceof THREE.Face4&&(m=this.rayTriangle(e,n,p,w,f,this.collisionNormal,c.mesh),m<f&&(f=m,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize()),m=this.rayTriangle(e,p,u,w,f,this.collisionNormal,c.mesh),m<f&&(f=m,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize()))}return{dist:f,faceIndex:h}};
|
|
|
+THREE.CollisionSystem.prototype.rayTriangle=function(b,c,e,f,h,k,m){var n=THREE.CollisionSystem.__v1,p=THREE.CollisionSystem.__v2;k.set(0,0,0);n.sub(e,c);p.sub(f,e);k.cross(n,p);n=k.dot(b.direction);if(!(n<0))if(m.doubleSided||m.flipSided)k.multiplyScalar(-1),n*=-1;else return Number.MAX_VALUE;m=k.dot(c)-k.dot(b.origin);if(!(m<=0))return Number.MAX_VALUE;if(!(m>=n*h))return Number.MAX_VALUE;m/=n;n=THREE.CollisionSystem.__v3;n.copy(b.direction);n.multiplyScalar(m);n.addSelf(b.origin);Math.abs(k.x)>
|
|
|
Math.abs(k.y)?Math.abs(k.x)>Math.abs(k.z)?(b=n.y-c.y,k=e.y-c.y,h=f.y-c.y,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,k=e.x-c.x,h=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y):Math.abs(k.y)>Math.abs(k.z)?(b=n.x-c.x,k=e.x-c.x,h=f.x-c.x,n=n.z-c.z,e=e.z-c.z,f=f.z-c.z):(b=n.x-c.x,k=e.x-c.x,h=f.x-c.x,n=n.y-c.y,e=e.y-c.y,f=f.y-c.y);c=k*f-e*h;if(c==0)return Number.MAX_VALUE;c=1/c;f=(b*f-n*h)*c;if(!(f>=0))return Number.MAX_VALUE;c*=k*n-e*b;if(!(c>=0))return Number.MAX_VALUE;if(!(1-f-c>=0))return Number.MAX_VALUE;return m};
|
|
|
THREE.CollisionSystem.prototype.makeRayLocal=function(b,c){var e=THREE.CollisionSystem.__m;THREE.Matrix4.makeInvert(c.matrixWorld,e);var f=THREE.CollisionSystem.__r;f.origin.copy(b.origin);f.direction.copy(b.direction);e.multiplyVector3(f.origin);e.rotateAxis(f.direction);f.direction.normalize();return f};
|
|
|
-THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,h=0,k=0,m=0,n=0,t=0,v=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,v=!1,m=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,v=!1,m=1);e.origin.y<c.min.y?(h=c.min.y-e.origin.y,h/=e.direction.y,v=!1,n=-1):e.origin.y>c.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y,
|
|
|
-v=!1,n=1);e.origin.z<c.min.z?(k=c.min.z-e.origin.z,k/=e.direction.z,v=!1,t=-1):e.origin.z>c.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,v=!1,t=1);if(v)return-1;v=0;h>f&&(v=1,f=h);k>f&&(v=2,f=k);switch(v){case 0:n=e.origin.y+e.direction.y*f;if(n<c.min.y||n>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(m,0,0);break;case 1:m=e.origin.x+e.direction.x*f;if(m<c.min.x||m>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
|
|
|
-f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,n,0);break;case 2:m=e.origin.x+e.direction.x*f;if(m<c.min.x||m>c.max.x)return Number.MAX_VALUE;n=e.origin.y+e.direction.y*f;if(n<c.min.y||n>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,t)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
|
|
|
+THREE.CollisionSystem.prototype.rayBox=function(b,c){var e;c.dynamic&&c.mesh&&c.mesh.matrixWorld?e=this.makeRayLocal(b,c.mesh):(e=THREE.CollisionSystem.__r,e.origin.copy(b.origin),e.direction.copy(b.direction));var f=0,h=0,k=0,m=0,n=0,p=0,u=!0;e.origin.x<c.min.x?(f=c.min.x-e.origin.x,f/=e.direction.x,u=!1,m=-1):e.origin.x>c.max.x&&(f=c.max.x-e.origin.x,f/=e.direction.x,u=!1,m=1);e.origin.y<c.min.y?(h=c.min.y-e.origin.y,h/=e.direction.y,u=!1,n=-1):e.origin.y>c.max.y&&(h=c.max.y-e.origin.y,h/=e.direction.y,
|
|
|
+u=!1,n=1);e.origin.z<c.min.z?(k=c.min.z-e.origin.z,k/=e.direction.z,u=!1,p=-1):e.origin.z>c.max.z&&(k=c.max.z-e.origin.z,k/=e.direction.z,u=!1,p=1);if(u)return-1;u=0;h>f&&(u=1,f=h);k>f&&(u=2,f=k);switch(u){case 0:n=e.origin.y+e.direction.y*f;if(n<c.min.y||n>c.max.y)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(m,0,0);break;case 1:m=e.origin.x+e.direction.x*f;if(m<c.min.x||m>c.max.x)return Number.MAX_VALUE;e=e.origin.z+e.direction.z*
|
|
|
+f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,n,0);break;case 2:m=e.origin.x+e.direction.x*f;if(m<c.min.x||m>c.max.x)return Number.MAX_VALUE;n=e.origin.y+e.direction.y*f;if(n<c.min.y||n>c.max.y)return Number.MAX_VALUE;c.normal.set(0,0,p)}return f};THREE.CollisionSystem.prototype.rayPlane=function(b,c){var e=b.direction.dot(c.normal),f=c.point.dot(c.normal);if(e<0)e=(f-b.origin.dot(c.normal))/e;else return Number.MAX_VALUE;return e>0?e:Number.MAX_VALUE};
|
|
|
THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
|
THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionUtils.MeshOBB=function(b){b.geometry.computeBoundingBox();var c=b.geometry.boundingBox,e=new THREE.Vector3(c.x[0],c.y[0],c.z[0]),c=new THREE.Vector3(c.x[1],c.y[1],c.z[1]),e=new THREE.BoxCollider(e,c);e.mesh=b;return e};THREE.CollisionUtils.MeshAABB=function(b){var c=THREE.CollisionUtils.MeshOBB(b);c.min.addSelf(b.position);c.max.addSelf(b.position);c.dynamic=!1;return c};
|
|
|
THREE.CollisionUtils.MeshColliderWBox=function(b){return new THREE.MeshCollider(b,THREE.CollisionUtils.MeshOBB(b))};
|
|
|
-if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.Camera,k=new THREE.Camera,m=new THREE.Matrix4,n=new THREE.Matrix4,t,v,w;h.useTarget=k.useTarget=!1;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},u=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.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:u},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.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);u.width=b;u.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(t!==e.aspect||v!==e.near||w!==e.fov){t=e.aspect;v=e.near;w=e.fov;var E=e.projectionMatrix.clone(),F=125/30*0.5,D=F*v/125,H=v*Math.tan(w*Math.PI/360),N;m.n14=F;n.n14=-F;F=-H*t+D;N=H*t+D;E.n11=2*v/(N-F);E.n13=(N+F)/(N-F);h.projectionMatrix=E.clone();F=-H*t-D;N=H*t-D;E.n11=2*v/(N-F);E.n13=
|
|
|
-(N+F)/(N-F);k.projectionMatrix=E.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,u,!0);k.matrix=e.matrixWorld.clone().multiplySelf(m);k.update(null,!0);k.position.copy(e.position);k.near=v;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,y,p)}};
|
|
|
+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,k=new THREE.Camera,m=new THREE.Matrix4,n=new THREE.Matrix4,p,u,w;h.useTarget=k.useTarget=!1;h.matrixAutoUpdate=k.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),v=new THREE.Camera(53,1,1,1E4);v.position.z=
|
|
|
+2;_material=new THREE.ShaderMaterial({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 A=new THREE.Scene;A.add(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(p!==e.aspect||u!==e.near||w!==e.fov){p=e.aspect;u=e.near;w=e.fov;var E=e.projectionMatrix.clone(),F=125/30*0.5,D=F*u/125,H=u*Math.tan(w*Math.PI/360),L;m.n14=F;n.n14=-F;F=-H*p+D;L=H*p+D;E.n11=2*u/(L-F);E.n13=(L+F)/(L-F);h.projectionMatrix=E.clone();F=-H*p-D;L=H*p-D;E.n11=2*u/(L-F);E.n13=
|
|
|
+(L+F)/(L-F);k.projectionMatrix=E.clone()}h.matrix=e.matrixWorld.clone().multiplySelf(n);h.update(null,!0);h.position.copy(e.position);h.near=u;h.far=e.far;f.call(c,b,h,t,!0);k.matrix=e.matrixWorld.clone().multiplySelf(m);k.update(null,!0);k.position.copy(e.position);k.near=u;k.far=e.far;f.call(c,b,k,x,!0);f.call(c,A,v)}};
|
|
|
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,k,m=new THREE.Camera;m.useTarget=!0;var n=new THREE.Camera;n.useTarget=!0;c.separation=10;if(b&&b.separation!==void 0)c.separation=b.separation;this.setSize=function(b,f){e.call(c,b,f);h=b/2;k=f};this.render=function(b,e){this.clear();m.fov=e.fov;m.aspect=0.5*e.aspect;m.near=e.near;m.far=e.far;m.updateProjectionMatrix();m.position.copy(e.position);
|
|
|
m.target.position.copy(e.target.position);m.translateX(c.separation);n.projectionMatrix=m.projectionMatrix;n.position.copy(e.position);n.target.position.copy(e.target.position);n.translateX(-c.separation);this.setViewport(0,0,h,k);f.call(c,b,m);this.setViewport(h,0,h,k);f.call(c,b,n,!1)}};
|