|
@@ -16,35 +16,35 @@ c.z;this.w=b.w-c.w;return this},subSelf:function(b){this.x-=b.x;this.y-=b.y;this
|
|
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};
|
|
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,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),
|
|
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}for(var f,h=[],k=0,m=b.children.length;k<m;k++)Array.prototype.push.apply(h,this.intersectObject(b.children[k]));if(b instanceof THREE.Particle){k=c(this.origin,this.direction,b.matrixWorld.getPosition());if(k==null||k>b.scale.x)return[];f={distance:k,point:b.position,face:null,object:b};h.push(f)}else if(b instanceof THREE.Mesh){k=c(this.origin,
|
|
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}for(var f,h=[],k=0,m=b.children.length;k<m;k++)Array.prototype.push.apply(h,this.intersectObject(b.children[k]));if(b instanceof THREE.Particle){k=c(this.origin,this.direction,b.matrixWorld.getPosition());if(k==null||k>b.scale.x)return[];f={distance:k,point:b.position,face:null,object:b};h.push(f)}else if(b instanceof THREE.Mesh){k=c(this.origin,
|
|
-this.direction,b.matrixWorld.getPosition());if(k==null||k>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return h;for(var n,t,u,v,p,x,w,z,y=b.geometry,A=y.vertices,k=0,m=y.faces.length;k<m;k++)if(f=y.faces[k],w=this.origin.clone(),z=this.direction.clone(),v=b.matrixWorld,n=v.multiplyVector3(f.centroid.clone()).subSelf(w),x=n.dot(z),!(x<=0)&&(n=v.multiplyVector3(A[f.a].position.clone()),t=v.multiplyVector3(A[f.b].position.clone()),u=v.multiplyVector3(A[f.c].position.clone()),
|
|
|
|
-v=f instanceof THREE.Face4?v.multiplyVector3(A[f.d].position.clone()):null,p=b.matrixRotationWorld.multiplyVector3(f.normal.clone()),x=z.dot(p),b.doubleSided||(b.flipSided?x>0:x<0)))if(x=p.dot((new THREE.Vector3).sub(n,w))/x,w=w.addSelf(z.multiplyScalar(x)),f instanceof THREE.Face3)e(w,n,t,u)&&(f={distance:this.origin.distanceTo(w),point:w,face:f,object:b},h.push(f));else if(f instanceof THREE.Face4&&(e(w,n,t,v)||e(w,t,u,v)))f={distance:this.origin.distanceTo(w),point:w,face:f,object:b},h.push(f)}return h}};
|
|
|
|
-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,v,p){n=!1;c=k;e=m;f=v;h=p;b()};this.addPoint=function(k,m){n?(n=!1,c=k,e=m,f=k,h=m):(c=c<k?c:k,e=e<m?e:m,f=f>k?f:k,h=h>m?h:m);b()};this.add3Points=
|
|
|
|
-function(k,m,v,p,x,w){n?(n=!1,c=k<v?k<x?k:x:v<x?v:x,e=m<p?m<w?m:w:p<w?p:w,f=k>v?k>x?k:x:v>x?v:x,h=m>p?m>w?m:w:p>w?p:w):(c=k<v?k<x?k<c?k:c:x<c?x:c:v<x?v<c?v:c:x<c?x:c,e=m<p?m<w?m<e?m:e:w<e?w:e:p<w?p<e?p:e:w<e?w:e,f=k>v?k>x?k>f?k:f:x>f?x:f:v>x?v>f?v:f:x>f?x:f,h=m>p?m>w?m>h?m:h:w>h?w:h:p>w?p>h?p:h:w>h?w: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>
|
|
|
|
|
|
+this.direction,b.matrixWorld.getPosition());if(k==null||k>b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)))return h;for(var n,t,u,w,o,x,v,z,y=b.geometry,A=y.vertices,k=0,m=y.faces.length;k<m;k++)if(f=y.faces[k],v=this.origin.clone(),z=this.direction.clone(),w=b.matrixWorld,n=w.multiplyVector3(f.centroid.clone()).subSelf(v),x=n.dot(z),!(x<=0)&&(n=w.multiplyVector3(A[f.a].position.clone()),t=w.multiplyVector3(A[f.b].position.clone()),u=w.multiplyVector3(A[f.c].position.clone()),
|
|
|
|
+w=f instanceof THREE.Face4?w.multiplyVector3(A[f.d].position.clone()):null,o=b.matrixRotationWorld.multiplyVector3(f.normal.clone()),x=z.dot(o),b.doubleSided||(b.flipSided?x>0:x<0)))if(x=o.dot((new THREE.Vector3).sub(n,v))/x,v=v.addSelf(z.multiplyScalar(x)),f instanceof THREE.Face3)e(v,n,t,u)&&(f={distance:this.origin.distanceTo(v),point:v,face:f,object:b},h.push(f));else if(f instanceof THREE.Face4&&(e(v,n,t,w)||e(v,t,u,w)))f={distance:this.origin.distanceTo(v),point:v,face:f,object:b},h.push(f)}return h}};
|
|
|
|
+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,o){n=!1;c=k;e=m;f=w;h=o;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,o,x,v){n?(n=!1,c=k<w?k<x?k:x:w<x?w:x,e=m<o?m<v?m:v:o<v?o:v,f=k>w?k>x?k:x:w>x?w:x,h=m>o?m>v?m:v:o>v?o: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<o?m<v?m<e?m:e:v<e?v:e:o<v?o<e?o: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>o?m>v?m>h?m:h:v>h?v:h:o>v?o>h?o: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=[]};
|
|
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.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,u,v,p,x,w,z,y){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,u||0,v!==void 0?v:1,p||0,x||0,w||0,z||0,y!==void 0?y: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,u,v,p,x,w,z,y){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=u;this.n33=v;this.n34=p;this.n41=x;this.n42=w;this.n43=z;this.n44=y;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,t,u,w,o,x,v,z,y){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,u||0,w!==void 0?w:1,o||0,x||0,v||0,z||0,y!==void 0?y: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,u,w,o,x,v,z,y){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=u;this.n33=w;this.n34=o;this.n41=x;this.n42=v;this.n43=z;this.n44=y;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;
|
|
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+
|
|
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,u=b.n24,v=b.n31,p=b.n32,x=b.n33,w=b.n34,z=b.n41,y=b.n42,A=b.n43,E=b.n44,F=c.n11,D=c.n12,
|
|
|
|
-G=c.n13,K=c.n14,N=c.n21,L=c.n22,B=c.n23,M=c.n24,U=c.n31,I=c.n32,S=c.n33,Q=c.n34,Y=c.n41,W=c.n42,o=c.n43,$=c.n44;this.n11=e*F+f*N+h*U+k*Y;this.n12=e*D+f*L+h*I+k*W;this.n13=e*G+f*B+h*S+k*o;this.n14=e*K+f*M+h*Q+k*$;this.n21=m*F+n*N+t*U+u*Y;this.n22=m*D+n*L+t*I+u*W;this.n23=m*G+n*B+t*S+u*o;this.n24=m*K+n*M+t*Q+u*$;this.n31=v*F+p*N+x*U+w*Y;this.n32=v*D+p*L+x*I+w*W;this.n33=v*G+p*B+x*S+w*o;this.n34=v*K+p*M+x*Q+w*$;this.n41=z*F+y*N+A*U+E*Y;this.n42=z*D+y*L+A*I+E*W;this.n43=z*G+y*B+A*S+E*o;this.n44=z*K+y*
|
|
|
|
-M+A*Q+E*$;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,u=this.n32,v=this.n33,p=this.n34,x=this.n41,w=this.n42,z=this.n43,y=this.n44;return f*m*u*x-e*n*u*x-f*k*v*x+c*n*v*x+e*k*p*x-c*m*p*x-f*m*t*w+e*n*t*w+f*h*v*w-b*n*v*w-e*h*p*w+b*m*p*w+f*k*t*z-c*n*t*z-f*h*u*z+b*n*u*z+c*h*p*z-b*k*p*z-e*k*t*y+c*m*t*y+e*h*u*y-b*m*u*y-c*h*v*y+b*k*v*y},
|
|
|
|
|
|
+e*this.n32+f*this.n33;b.normalize();return b},crossVector:function(b){var c=new THREE.Vector4;c.x=this.n11*b.x+this.n12*b.y+this.n13*b.z+this.n14*b.w;c.y=this.n21*b.x+this.n22*b.y+this.n23*b.z+this.n24*b.w;c.z=this.n31*b.x+this.n32*b.y+this.n33*b.z+this.n34*b.w;c.w=b.w?this.n41*b.x+this.n42*b.y+this.n43*b.z+this.n44*b.w:1;return c},multiply:function(b,c){var e=b.n11,f=b.n12,h=b.n13,k=b.n14,m=b.n21,n=b.n22,t=b.n23,u=b.n24,w=b.n31,o=b.n32,x=b.n33,v=b.n34,z=b.n41,y=b.n42,A=b.n43,E=b.n44,F=c.n11,C=c.n12,
|
|
|
|
+G=c.n13,J=c.n14,O=c.n21,K=c.n22,B=c.n23,N=c.n24,Y=c.n31,H=c.n32,T=c.n33,Q=c.n34,Z=c.n41,$=c.n42,S=c.n43,p=c.n44;this.n11=e*F+f*O+h*Y+k*Z;this.n12=e*C+f*K+h*H+k*$;this.n13=e*G+f*B+h*T+k*S;this.n14=e*J+f*N+h*Q+k*p;this.n21=m*F+n*O+t*Y+u*Z;this.n22=m*C+n*K+t*H+u*$;this.n23=m*G+n*B+t*T+u*S;this.n24=m*J+n*N+t*Q+u*p;this.n31=w*F+o*O+x*Y+v*Z;this.n32=w*C+o*K+x*H+v*$;this.n33=w*G+o*B+x*T+v*S;this.n34=w*J+o*N+x*Q+v*p;this.n41=z*F+y*O+A*Y+E*Z;this.n42=z*C+y*K+A*H+E*$;this.n43=z*G+y*B+A*T+E*S;this.n44=z*J+y*
|
|
|
|
+N+A*Q+E*p;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,u=this.n32,w=this.n33,o=this.n34,x=this.n41,v=this.n42,z=this.n43,y=this.n44;return f*m*u*x-e*n*u*x-f*k*w*x+c*n*w*x+e*k*o*x-c*m*o*x-f*m*t*v+e*n*t*v+f*h*w*v-b*n*w*v-e*h*o*v+b*m*o*v+f*k*t*z-c*n*t*z-f*h*u*z+b*n*u*z+c*h*o*z-b*k*o*z-e*k*t*y+c*m*t*y+e*h*u*y-b*m*u*y-c*h*w*y+b*k*w*y},
|
|
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;
|
|
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.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[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,
|
|
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,u=h*m;this.set(t*k+e,t*m-f*n,t*n+f*m,0,t*m+f*n,u*m+e,u*n-f*k,0,t*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=
|
|
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,u=h*m;this.set(t*k+e,t*m-f*n,t*n+f*m,0,t*m+f*n,u*m+e,u*n-f*k,0,t*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 t=
|
|
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,u=m*h,v=f*n,p=f*h;this.n11=t+p*e;this.n12=v*e-u;this.n13=k*f;this.n21=k*h;this.n22=k*n;this.n23=-e;this.n31=u*e-v;this.n32=p+t*e;this.n33=k*m;break;case "ZXY":t=m*n;u=m*h;v=f*n;p=f*h;this.n11=t-p*e;this.n12=-k*h;this.n13=v+u*e;this.n21=u+v*e;this.n22=k*n;this.n23=p-t*e;this.n31=-k*f;this.n32=e;this.n33=k*m;break;case "ZYX":t=k*n;u=k*h;v=e*n;p=e*h;this.n11=m*n;this.n12=v*f-u;this.n13=t*f+p;this.n21=m*h;this.n22=p*f+t;this.n23=u*f-v;this.n31=-f;this.n32=e*m;this.n33=k*m;break;case "YZX":t=k*m;u=
|
|
|
|
-k*f;v=e*m;p=e*f;this.n11=m*n;this.n12=p-t*h;this.n13=v*h+u;this.n21=h;this.n22=k*n;this.n23=-e*n;this.n31=-f*n;this.n32=u*h+v;this.n33=t-p*h;break;case "XZY":t=k*m;u=k*f;v=e*m;p=e*f;this.n11=m*n;this.n12=-h;this.n13=f*n;this.n21=t*h+p;this.n22=k*n;this.n23=u*h-v;this.n31=v*h-u;this.n32=e*n;this.n33=p*h+t;break;default:t=k*n,u=k*h,v=e*n,p=e*h,this.n11=m*n,this.n12=-m*h,this.n13=f,this.n21=u+v*f,this.n22=t-p*f,this.n23=-e*m,this.n31=p-t*f,this.n32=v+u*f,this.n33=k*m}return this},setRotationFromQuaternion:function(b){var c=
|
|
|
|
|
|
+m*n,u=m*h,w=f*n,o=f*h;this.n11=t+o*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=o+t*e;this.n33=k*m;break;case "ZXY":t=m*n;u=m*h;w=f*n;o=f*h;this.n11=t-o*e;this.n12=-k*h;this.n13=w+u*e;this.n21=u+w*e;this.n22=k*n;this.n23=o-t*e;this.n31=-k*f;this.n32=e;this.n33=k*m;break;case "ZYX":t=k*n;u=k*h;w=e*n;o=e*h;this.n11=m*n;this.n12=w*f-u;this.n13=t*f+o;this.n21=m*h;this.n22=o*f+t;this.n23=u*f-w;this.n31=-f;this.n32=e*m;this.n33=k*m;break;case "YZX":t=k*m;u=
|
|
|
|
+k*f;w=e*m;o=e*f;this.n11=m*n;this.n12=o-t*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=t-o*h;break;case "XZY":t=k*m;u=k*f;w=e*m;o=e*f;this.n11=m*n;this.n12=-h;this.n13=f*n;this.n21=t*h+o;this.n22=k*n;this.n23=u*h-w;this.n31=w*h-u;this.n32=e*n;this.n33=o*h+t;break;default:t=k*n,u=k*h,w=e*n,o=e*h,this.n11=m*n,this.n12=-m*h,this.n13=f,this.n21=u+w*f,this.n22=t-o*f,this.n23=-e*m,this.n31=o-t*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,t=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=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+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;
|
|
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 u=e*m;e*=n;f*=n;k*=h;m*=h;h*=n;this.n11=1-(u+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+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();
|
|
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=
|
|
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}};
|
|
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,u=b.n24,v=b.n31,p=b.n32,x=b.n33,w=b.n34,z=b.n41,y=b.n42,A=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*w*y-u*x*y+u*p*A-n*w*A-t*p*E+n*x*E;c.n12=k*x*y-h*w*y-k*p*A+f*w*A+h*p*E-f*x*E;c.n13=h*u*y-k*t*y+k*n*A-f*u*A-h*n*E+f*t*E;c.n14=k*t*p-h*u*p-k*n*x+f*u*x+h*n*w-f*t*w;c.n21=u*x*z-t*w*z-u*v*A+m*w*A+t*v*E-m*x*E;c.n22=h*w*z-k*x*z+k*v*A-e*w*A-h*v*E+e*x*E;c.n23=k*t*z-h*u*z-k*m*A+e*u*A+h*m*E-e*t*E;c.n24=
|
|
|
|
-h*u*v-k*t*v+k*m*x-e*u*x-h*m*w+e*t*w;c.n31=n*w*z-u*p*z+u*v*y-m*w*y-n*v*E+m*p*E;c.n32=k*p*z-f*w*z-k*v*y+e*w*y+f*v*E-e*p*E;c.n33=h*u*z-k*n*z+k*m*y-e*u*y-f*m*E+e*n*E;c.n34=k*n*v-f*u*v-k*m*p+e*u*p+f*m*w-e*n*w;c.n41=t*p*z-n*x*z-t*v*y+m*x*y+n*v*A-m*p*A;c.n42=f*x*z-h*p*z+h*v*y-e*x*y-f*v*A+e*p*A;c.n43=h*n*z-f*t*z-h*m*y+e*t*y+f*m*A-e*n*A;c.n44=f*t*v-h*n*v+h*m*p-e*t*p-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,u=b.n23*b.n12-b.n22*b.n13,v=-b.n23*b.n11+b.n21*b.n13,p=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*t;e[6]=b*u;e[7]=b*v;e[8]=b*p;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,t=b.n23,u=b.n24,w=b.n31,o=b.n32,x=b.n33,v=b.n34,z=b.n41,y=b.n42,A=b.n43,E=b.n44;c===void 0&&(c=new THREE.Matrix4);c.n11=t*v*y-u*x*y+u*o*A-n*v*A-t*o*E+n*x*E;c.n12=k*x*y-h*v*y-k*o*A+f*v*A+h*o*E-f*x*E;c.n13=h*u*y-k*t*y+k*n*A-f*u*A-h*n*E+f*t*E;c.n14=k*t*o-h*u*o-k*n*x+f*u*x+h*n*v-f*t*v;c.n21=u*x*z-t*v*z-u*w*A+m*v*A+t*w*E-m*x*E;c.n22=h*v*z-k*x*z+k*w*A-e*v*A-h*w*E+e*x*E;c.n23=k*t*z-h*u*z-k*m*A+e*u*A+h*m*E-e*t*E;c.n24=
|
|
|
|
+h*u*w-k*t*w+k*m*x-e*u*x-h*m*v+e*t*v;c.n31=n*v*z-u*o*z+u*w*y-m*v*y-n*w*E+m*o*E;c.n32=k*o*z-f*v*z-k*w*y+e*v*y+f*w*E-e*o*E;c.n33=h*u*z-k*n*z+k*m*y-e*u*y-f*m*E+e*n*E;c.n34=k*n*w-f*u*w-k*m*o+e*u*o+f*m*v-e*n*v;c.n41=t*o*z-n*x*z-t*w*y+m*x*y+n*w*A-m*o*A;c.n42=f*x*z-h*o*z+h*w*y-e*x*y-f*w*A+e*o*A;c.n43=h*n*z-f*t*z-h*m*y+e*t*y+f*m*A-e*n*A;c.n44=f*t*w-h*n*w+h*m*o-e*t*o-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,u=b.n23*b.n12-b.n22*b.n13,w=-b.n23*b.n11+b.n21*b.n13,o=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*t;e[6]=b*u;e[7]=b*w;e[8]=b*o;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.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,u;m=new THREE.Matrix4;n=c-b;t=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/t;m.n23=0;m.n24=-((e+f)/t);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.Matrix4.makeOrtho=function(b,c,e,f,h,k){var m,n,t,u;m=new THREE.Matrix4;n=c-b;t=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/t;m.n23=0;m.n24=-((e+f)/t);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=
|
|
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=
|
|
@@ -54,23 +54,23 @@ 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&&
|
|
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.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;
|
|
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,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,t=[],u,v,p=[],x,w=[],z,y,A=[],E,F,D=[],G=[],K=[],N=new THREE.Vector4,L=new THREE.Vector4,
|
|
|
|
-B=new THREE.Matrix4,M=new THREE.Matrix4,U=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],I=new THREE.Vector4,S=new THREE.Vector4;this.projectVector=function(b,c){B.multiply(c.projectionMatrix,c.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,c){B.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));B.multiplyVector3(b);return b};this.pickingRay=function(b,c){var e;b.z=-1;e=new THREE.Vector3(b.x,
|
|
|
|
-b.y,1);this.unprojectVector(b,c);this.unprojectVector(e,c);e.subSelf(b).normalize();return new THREE.Ray(b,e)};this.projectObjects=function(b,e,m){var o,n;h=G.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,w=-n.geometry.boundingSphere.radius*Math.max(n.scale.x,Math.max(n.scale.y,n.scale.z)),p=0;p<6;p++)if(t=U[p].x*u.n14+U[p].y*u.n24+U[p].z*u.n34+U[p].w,t<=w){t=!1;break a}t=!0}t=
|
|
|
|
-!t}if(!t)t=k[h]=k[h]||new THREE.RenderableObject,h++,f=t,N.copy(n.position),B.multiplyVector3(N),f.object=n,f.z=N.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=function(f,k,h){var o=k.near,G=k.far,N,ha,fa,oa,ca,ja,la,da,X,V,aa,ia,ra,ma,ga,na,qa;F=y=x=v=K.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);B.multiply(k.projectionMatrix,k.matrixWorldInverse);U[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);U[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);
|
|
|
|
-U[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);U[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);U[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);U[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(N=0;N<6;N++)X=U[N],X.divideScalar(Math.sqrt(X.x*X.x+X.y*X.y+X.z*X.z));X=this.projectObjects(f,k,!0);f=0;for(N=X.length;f<N;f++)if(V=X[f].object,V.visible)if(aa=V.matrixWorld,ia=V.matrixRotationWorld,ra=V.materials,ma=V.overdraw,n=0,V instanceof THREE.Mesh){ga=V.geometry;
|
|
|
|
-oa=ga.vertices;na=ga.faces;ga=ga.faceVertexUvs;ha=0;for(fa=oa.length;ha<fa;ha++)m=b(),m.positionWorld.copy(oa[ha].position),aa.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),B.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>o&&m.positionScreen.z<G;oa=0;for(ha=na.length;oa<ha;oa++){fa=na[oa];if(fa instanceof THREE.Face3)if(ca=t[fa.a],ja=t[fa.b],la=t[fa.c],ca.visible&&ja.visible&&la.visible&&
|
|
|
|
-(V.doubleSided||V.flipSided!=(la.positionScreen.x-ca.positionScreen.x)*(ja.positionScreen.y-ca.positionScreen.y)-(la.positionScreen.y-ca.positionScreen.y)*(ja.positionScreen.x-ca.positionScreen.x)<0))da=p[v]=p[v]||new THREE.RenderableFace3,v++,u=da,u.v1.copy(ca),u.v2.copy(ja),u.v3.copy(la);else continue;else if(fa instanceof THREE.Face4)if(ca=t[fa.a],ja=t[fa.b],la=t[fa.c],da=t[fa.d],ca.visible&&ja.visible&&la.visible&&da.visible&&(V.doubleSided||V.flipSided!=((da.positionScreen.x-ca.positionScreen.x)*
|
|
|
|
-(ja.positionScreen.y-ca.positionScreen.y)-(da.positionScreen.y-ca.positionScreen.y)*(ja.positionScreen.x-ca.positionScreen.x)<0||(ja.positionScreen.x-la.positionScreen.x)*(da.positionScreen.y-la.positionScreen.y)-(ja.positionScreen.y-la.positionScreen.y)*(da.positionScreen.x-la.positionScreen.x)<0)))qa=w[x]=w[x]||new THREE.RenderableFace4,x++,u=qa,u.v1.copy(ca),u.v2.copy(ja),u.v3.copy(la),u.v4.copy(da);else continue;u.normalWorld.copy(fa.normal);ia.multiplyVector3(u.normalWorld);u.centroidWorld.copy(fa.centroid);
|
|
|
|
-aa.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);B.multiplyVector3(u.centroidScreen);la=fa.vertexNormals;ca=0;for(ja=la.length;ca<ja;ca++)da=u.vertexNormalsWorld[ca],da.copy(la[ca]),ia.multiplyVector3(da);ca=0;for(ja=ga.length;ca<ja;ca++)if(qa=ga[ca][oa]){la=0;for(da=qa.length;la<da;la++)u.uvs[ca][la]=qa[la]}u.meshMaterials=ra;u.faceMaterials=fa.materials;u.overdraw=ma;u.z=u.centroidScreen.z;K.push(u)}}else if(V instanceof THREE.Line){M.multiply(B,aa);oa=V.geometry.vertices;
|
|
|
|
-ca=b();ca.positionScreen.copy(oa[0].position);M.multiplyVector4(ca.positionScreen);ha=1;for(fa=oa.length;ha<fa;ha++)if(ca=b(),ca.positionScreen.copy(oa[ha].position),M.multiplyVector4(ca.positionScreen),ja=t[n-2],I.copy(ca.positionScreen),S.copy(ja.positionScreen),e(I,S))I.multiplyScalar(1/I.w),S.multiplyScalar(1/S.w),aa=A[y]=A[y]||new THREE.RenderableLine,y++,z=aa,z.v1.positionScreen.copy(I),z.v2.positionScreen.copy(S),z.z=Math.max(I.z,S.z),z.materials=V.materials,K.push(z)}else if(V instanceof THREE.Particle&&
|
|
|
|
-(L.set(V.matrixWorld.n14,V.matrixWorld.n24,V.matrixWorld.n34,1),B.multiplyVector4(L),L.z/=L.w,L.z>0&&L.z<1))aa=D[F]=D[F]||new THREE.RenderableParticle,F++,E=aa,E.x=L.x/L.w,E.y=L.y/L.w,E.z=L.z,E.rotation=V.rotation.z,E.scale.x=V.scale.x*Math.abs(E.x-(L.x+k.projectionMatrix.n11)/(L.w+k.projectionMatrix.n14)),E.scale.y=V.scale.y*Math.abs(E.y-(L.y+k.projectionMatrix.n22)/(L.w+k.projectionMatrix.n24)),E.materials=V.materials,K.push(E);h&&K.sort(c);return K}};
|
|
|
|
|
|
+THREE.Projector=function(){function b(){var b=t[n]=t[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,t=[],u,w,o=[],x,v=[],z,y,A=[],E,F,C=[],G=[],J=[],O=new THREE.Vector4,K=new THREE.Vector4,
|
|
|
|
+B=new THREE.Matrix4,N=new THREE.Matrix4,Y=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Vector4,T=new THREE.Vector4;this.projectVector=function(b,c){B.multiply(c.projectionMatrix,c.matrixWorldInverse);B.multiplyVector3(b);return b};this.unprojectVector=function(b,c){B.multiply(c.matrixWorld,THREE.Matrix4.makeInvert(c.projectionMatrix));B.multiplyVector3(b);return b};this.pickingRay=function(b,c){var e;b.z=-1;e=new THREE.Vector3(b.x,
|
|
|
|
+b.y,1);this.unprojectVector(b,c);this.unprojectVector(e,c);e.subSelf(b).normalize();return new THREE.Ray(b,e)};this.projectObjects=function(b,e,m){var n,p;h=G.length=0;n=b.objects;b=0;for(e=n.length;b<e;b++){p=n[b];var t;if(!(t=!p.visible))if(t=p instanceof THREE.Mesh)if(t=p.frustumCulled){a:{t=void 0;for(var u=p.matrixWorld,v=-p.geometry.boundingSphere.radius*Math.max(p.scale.x,Math.max(p.scale.y,p.scale.z)),o=0;o<6;o++)if(t=Y[o].x*u.n14+Y[o].y*u.n24+Y[o].z*u.n34+Y[o].w,t<=v){t=!1;break a}t=!0}t=
|
|
|
|
+!t}if(!t)t=k[h]=k[h]||new THREE.RenderableObject,h++,f=t,O.copy(p.position),B.multiplyVector3(O),f.object=p,f.z=O.z,G.push(f)}m&&G.sort(c);return G};this.projectScene=function(f,k,h){var G=k.near,p=k.far,O,ea,da,ha,ga,ka,na,aa,W,U,ia,ja,ta,la,ca,pa,ra;F=y=x=w=J.length=0;k.matrixAutoUpdate&&k.update(void 0,!0);f.update(void 0,!1,k);B.multiply(k.projectionMatrix,k.matrixWorldInverse);Y[0].set(B.n41-B.n11,B.n42-B.n12,B.n43-B.n13,B.n44-B.n14);Y[1].set(B.n41+B.n11,B.n42+B.n12,B.n43+B.n13,B.n44+B.n14);
|
|
|
|
+Y[2].set(B.n41+B.n21,B.n42+B.n22,B.n43+B.n23,B.n44+B.n24);Y[3].set(B.n41-B.n21,B.n42-B.n22,B.n43-B.n23,B.n44-B.n24);Y[4].set(B.n41-B.n31,B.n42-B.n32,B.n43-B.n33,B.n44-B.n34);Y[5].set(B.n41+B.n31,B.n42+B.n32,B.n43+B.n33,B.n44+B.n34);for(O=0;O<6;O++)W=Y[O],W.divideScalar(Math.sqrt(W.x*W.x+W.y*W.y+W.z*W.z));W=this.projectObjects(f,k,!0);f=0;for(O=W.length;f<O;f++)if(U=W[f].object,U.visible)if(ia=U.matrixWorld,ja=U.matrixRotationWorld,ta=U.materials,la=U.overdraw,n=0,U instanceof THREE.Mesh){ca=U.geometry;
|
|
|
|
+ha=ca.vertices;pa=ca.faces;ca=ca.faceVertexUvs;ea=0;for(da=ha.length;ea<da;ea++)m=b(),m.positionWorld.copy(ha[ea].position),ia.multiplyVector3(m.positionWorld),m.positionScreen.copy(m.positionWorld),B.multiplyVector4(m.positionScreen),m.positionScreen.x/=m.positionScreen.w,m.positionScreen.y/=m.positionScreen.w,m.visible=m.positionScreen.z>G&&m.positionScreen.z<p;ha=0;for(ea=pa.length;ha<ea;ha++){da=pa[ha];if(da instanceof THREE.Face3)if(ga=t[da.a],ka=t[da.b],na=t[da.c],ga.visible&&ka.visible&&na.visible&&
|
|
|
|
+(U.doubleSided||U.flipSided!=(na.positionScreen.x-ga.positionScreen.x)*(ka.positionScreen.y-ga.positionScreen.y)-(na.positionScreen.y-ga.positionScreen.y)*(ka.positionScreen.x-ga.positionScreen.x)<0))aa=o[w]=o[w]||new THREE.RenderableFace3,w++,u=aa,u.v1.copy(ga),u.v2.copy(ka),u.v3.copy(na);else continue;else if(da instanceof THREE.Face4)if(ga=t[da.a],ka=t[da.b],na=t[da.c],aa=t[da.d],ga.visible&&ka.visible&&na.visible&&aa.visible&&(U.doubleSided||U.flipSided!=((aa.positionScreen.x-ga.positionScreen.x)*
|
|
|
|
+(ka.positionScreen.y-ga.positionScreen.y)-(aa.positionScreen.y-ga.positionScreen.y)*(ka.positionScreen.x-ga.positionScreen.x)<0||(ka.positionScreen.x-na.positionScreen.x)*(aa.positionScreen.y-na.positionScreen.y)-(ka.positionScreen.y-na.positionScreen.y)*(aa.positionScreen.x-na.positionScreen.x)<0)))ra=v[x]=v[x]||new THREE.RenderableFace4,x++,u=ra,u.v1.copy(ga),u.v2.copy(ka),u.v3.copy(na),u.v4.copy(aa);else continue;u.normalWorld.copy(da.normal);ja.multiplyVector3(u.normalWorld);u.centroidWorld.copy(da.centroid);
|
|
|
|
+ia.multiplyVector3(u.centroidWorld);u.centroidScreen.copy(u.centroidWorld);B.multiplyVector3(u.centroidScreen);na=da.vertexNormals;ga=0;for(ka=na.length;ga<ka;ga++)aa=u.vertexNormalsWorld[ga],aa.copy(na[ga]),ja.multiplyVector3(aa);ga=0;for(ka=ca.length;ga<ka;ga++)if(ra=ca[ga][ha]){na=0;for(aa=ra.length;na<aa;na++)u.uvs[ga][na]=ra[na]}u.meshMaterials=ta;u.faceMaterials=da.materials;u.overdraw=la;u.z=u.centroidScreen.z;J.push(u)}}else if(U instanceof THREE.Line){N.multiply(B,ia);ha=U.geometry.vertices;
|
|
|
|
+ga=b();ga.positionScreen.copy(ha[0].position);N.multiplyVector4(ga.positionScreen);ea=1;for(da=ha.length;ea<da;ea++)if(ga=b(),ga.positionScreen.copy(ha[ea].position),N.multiplyVector4(ga.positionScreen),ka=t[n-2],H.copy(ga.positionScreen),T.copy(ka.positionScreen),e(H,T))H.multiplyScalar(1/H.w),T.multiplyScalar(1/T.w),ia=A[y]=A[y]||new THREE.RenderableLine,y++,z=ia,z.v1.positionScreen.copy(H),z.v2.positionScreen.copy(T),z.z=Math.max(H.z,T.z),z.materials=U.materials,J.push(z)}else if(U instanceof THREE.Particle&&
|
|
|
|
+(K.set(U.matrixWorld.n14,U.matrixWorld.n24,U.matrixWorld.n34,1),B.multiplyVector4(K),K.z/=K.w,K.z>0&&K.z<1))ia=C[F]=C[F]||new THREE.RenderableParticle,F++,E=ia,E.x=K.x/K.w,E.y=K.y/K.w,E.z=K.z,E.rotation=U.rotation.z,E.scale.x=U.scale.x*Math.abs(E.x-(K.x+k.projectionMatrix.n11)/(K.w+k.projectionMatrix.n14)),E.scale.y=U.scale.y*Math.abs(E.y-(K.y+k.projectionMatrix.n22)/(K.w+k.projectionMatrix.n24)),E.materials=U.materials,J.push(E);h&&J.sort(c);return J}};
|
|
THREE.Quaternion=function(b,c,e,f){this.set(b||0,c||0,e||0,f!==void 0?f:1)};
|
|
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);
|
|
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.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.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,u=t*e+m*h-n*f,v=t*f+n*e-k*h,p=t*h+k*f-m*e,e=-k*
|
|
|
|
-e-m*f-n*h;c.x=u*t+e*-k+v*-n-p*-m;c.y=v*t+e*-m+p*-k-u*-n;c.z=p*t+e*-n+u*-m-v*-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,t=this.w,u=t*e+m*h-n*f,w=t*f+n*e-k*h,o=t*h+k*f-m*e,e=-k*
|
|
|
|
+e-m*f-n*h;c.x=u*t+e*-k+w*-n-o*-m;c.y=w*t+e*-m+o*-k-u*-n;c.z=o*t+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.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.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.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};
|
|
@@ -79,14 +79,14 @@ c;b++)e=this.faces[b],e.centroid.set(0,0,0),e instanceof THREE.Face3?(e.centroid
|
|
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,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=
|
|
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
|
|
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]),
|
|
THREE.Face3?(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal)):e instanceof THREE.Face4&&(f[e.a].addSelf(e.normal),f[e.b].addSelf(e.normal),f[e.c].addSelf(e.normal),f[e.d].addSelf(e.normal));b=0;for(c=this.vertices.length;b<c;b++)f[b].normalize();b=0;for(c=this.faces.length;b<c;b++)e=this.faces[b],e instanceof THREE.Face3?(e.vertexNormals[0].copy(f[e.a]),e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c])):e instanceof THREE.Face4&&(e.vertexNormals[0].copy(f[e.a]),
|
|
-e.vertexNormals[1].copy(f[e.b]),e.vertexNormals[2].copy(f[e.c]),e.vertexNormals[3].copy(f[e.d]))},computeTangents:function(){function b(b,c,e,f,k,h,o){n=b.vertices[c].position;t=b.vertices[e].position;u=b.vertices[f].position;v=m[k];p=m[h];x=m[o];w=t.x-n.x;z=u.x-n.x;y=t.y-n.y;A=u.y-n.y;E=t.z-n.z;F=u.z-n.z;D=p.u-v.u;G=x.u-v.u;K=p.v-v.v;N=x.v-v.v;L=1/(D*N-G*K);I.set((N*w-K*z)*L,(N*y-K*A)*L,(N*E-K*F)*L);S.set((D*z-G*w)*L,(D*A-G*y)*L,(D*F-G*E)*L);M[c].addSelf(I);M[e].addSelf(I);M[f].addSelf(I);U[c].addSelf(S);
|
|
|
|
-U[e].addSelf(S);U[f].addSelf(S)}var c,e,f,h,k,m,n,t,u,v,p,x,w,z,y,A,E,F,D,G,K,N,L,B,M=[],U=[],I=new THREE.Vector3,S=new THREE.Vector3,Q=new THREE.Vector3,Y=new THREE.Vector3,W=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)M[c]=new THREE.Vector3,U[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]],B=M[h],Q.copy(B),Q.subSelf(W.multiplyScalar(W.dot(B))).normalize(),Y.cross(k.vertexNormals[f],B),h=Y.dot(U[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(Q.x,Q.y,Q.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,B){n=b.vertices[c].position;t=b.vertices[e].position;u=b.vertices[f].position;w=m[k];o=m[h];x=m[B];v=t.x-n.x;z=u.x-n.x;y=t.y-n.y;A=u.y-n.y;E=t.z-n.z;F=u.z-n.z;C=o.u-w.u;G=x.u-w.u;J=o.v-w.v;O=x.v-w.v;K=1/(C*O-G*J);H.set((O*v-J*z)*K,(O*y-J*A)*K,(O*E-J*F)*K);T.set((C*z-G*v)*K,(C*A-G*y)*K,(C*F-G*E)*K);N[c].addSelf(H);N[e].addSelf(H);N[f].addSelf(H);Y[c].addSelf(T);
|
|
|
|
+Y[e].addSelf(T);Y[f].addSelf(T)}var c,e,f,h,k,m,n,t,u,w,o,x,v,z,y,A,E,F,C,G,J,O,K,B,N=[],Y=[],H=new THREE.Vector3,T=new THREE.Vector3,Q=new THREE.Vector3,Z=new THREE.Vector3,$=new THREE.Vector3;c=0;for(e=this.vertices.length;c<e;c++)N[c]=new THREE.Vector3,Y[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 S=["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++)$.copy(k.vertexNormals[f]),h=k[S[f]],B=N[h],Q.copy(B),Q.subSelf($.multiplyScalar($.dot(B))).normalize(),Z.cross(k.vertexNormals[f],B),h=Z.dot(Y[h]),h=h<0?-1:1,k.vertexTangents[f]=new THREE.Vector4(Q.x,Q.y,Q.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]=
|
|
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]),
|
|
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;
|
|
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,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,t,u,v,p,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]];v=this.points[e[1]];
|
|
|
|
-p=this.points[e[2]];x=this.points[e[3]];n=m*m;t=m*n;f.x=c(u.x,v.x,p.x,x.x,m,n,t);f.y=c(u.y,v.y,p.y,x.y,m,n,t);f.z=c(u.z,v.z,p.z,x.z,m,n,t);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),
|
|
|
|
|
|
+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,t,u,w,o,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]];
|
|
|
|
+o=this.points[e[2]];x=this.points[e[3]];n=m*m;t=m*n;f.x=c(u.x,w.x,o.x,x.x,m,n,t);f.y=c(u.y,w.y,o.y,x.y,m,n,t);f.z=c(u.z,w.z,o.z,x.z,m,n,t);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+=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(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};
|
|
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(){if(arguments.length)return console.warn("DEPRECATED: Camera() is now PerspectiveCamera() or OrthographicCamera()."),new THREE.PerspectiveCamera(arguments[0],arguments[1],arguments[2],arguments[3]);THREE.Object3D.call(this);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=new THREE.Matrix4};
|
|
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=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)};
|
|
@@ -147,49 +147,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.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.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.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,u,v,p,x,w,z,y;b=c.projectScene(e,f);t=0;for(u=b.length;t<u;t++)if(x=b[t],x instanceof THREE.RenderableParticle){z=x.x*h+h;y=x.y*k+k;v=0;for(p=x.material.length;v<p;v++)if(w=x.material[v],w instanceof THREE.ParticleDOMMaterial)w=w.domElement,w.style.left=z+"px",w.style.top=y+"px"}}};
|
|
|
|
-THREE.CanvasRenderer=function(b){function c(b){if(A!=b)w.globalAlpha=A=b}function e(b){if(E!=b){switch(b){case THREE.NormalBlending:w.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:w.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:w.globalCompositeOperation="darker"}E=b}}function f(b){if(F!=b)w.strokeStyle=F=b}function h(b){if(D!=b)w.fillStyle=D=b}var k=this,m=null,n=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
|
-u,v,p,x,w=t.getContext("2d"),z=new THREE.Color(0),y=0,A=1,E=0,F=null,D=null,G=null,K=null,N=null,L,B,M,U,I=new THREE.RenderableVertex,S=new THREE.RenderableVertex,Q,Y,W,o,$,T,ha,fa,oa,ca,ja,la,da=new THREE.Color(0),X=new THREE.Color(0),V=new THREE.Color(0),aa=new THREE.Color(0),ia=new THREE.Color(0),ra=[],ma,ga,na,qa,wa,Ca,Fa,Ea,Da,Ga,ya=new THREE.Rectangle,H=new THREE.Rectangle,Z=new THREE.Rectangle,ea=!1,ka=new THREE.Color,O=new THREE.Color,va=new THREE.Color,ua=new THREE.Color,pa=new THREE.Vector3,
|
|
|
|
-za,Ha,Aa,sa,Ia,R,b=16;za=document.createElement("canvas");za.width=za.height=2;Ha=za.getContext("2d");Ha.fillStyle="rgba(0,0,0,1)";Ha.fillRect(0,0,2,2);Aa=Ha.getImageData(0,0,2,2);sa=Aa.data;Ia=document.createElement("canvas");Ia.width=Ia.height=b;R=Ia.getContext("2d");R.translate(-b/2,-b/2);R.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,c){u=b;v=c;p=Math.floor(u/2);x=Math.floor(v/2);t.width=u;
|
|
|
|
-t.height=v;ya.set(-p,-x,p,x);H.set(-p,-x,p,x);A=1;E=0;N=K=G=D=F=null};this.setClearColor=function(b,c){z.copy(b);y=c;H.set(-p,-x,p,x)};this.setClearColorHex=function(b,c){z.setHex(b);y=c;H.set(-p,-x,p,x)};this.clear=function(){w.setTransform(1,0,0,-1,p,x);H.isEmpty()||(H.minSelf(ya),H.inflate(2),y<1&&w.clearRect(Math.floor(H.getX()),Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight())),y>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+
|
|
|
|
-Math.floor(z.b*255)+","+y+")"),w.fillRect(Math.floor(H.getX()),Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight()))),H.empty())};this.render=function(b,t){function u(b){var c,e,f,k=b.lights;O.setRGB(0,0,0);va.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.AmbientLight?(O.r+=f.r,O.g+=f.g,O.b+=f.b):e instanceof THREE.DirectionalLight?(va.r+=f.r,va.g+=f.g,va.b+=f.b):e instanceof THREE.PointLight&&(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b)}function v(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 y(b,k,m){c(m.opacity);e(m.blending);var o,n,t,u,v,xa;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)u=
|
|
|
|
-m.map.image,v=u.width>>1,xa=u.height>>1,m=k.scale.x*p,t=k.scale.y*x,o=m*v,n=t*xa,Z.set(b.x-o,b.y-n,b.x+o,b.y+n),ya.intersects(Z)&&(w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(m,-t),w.translate(-v,-xa),w.drawImage(u,0,0),w.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(o=k.scale.x*p,n=k.scale.y*x,Z.set(b.x-o,b.y-n,b.x+o,b.y+n),ya.intersects(Z)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),w.save(),w.translate(b.x,b.y),w.rotate(-k.rotation),w.scale(o,n),m.program(w),
|
|
|
|
-w.restore()))}function A(b,k,h,m){c(m.opacity);e(m.blending);w.beginPath();w.moveTo(b.positionScreen.x,b.positionScreen.y);w.lineTo(k.positionScreen.x,k.positionScreen.y);w.closePath();if(m instanceof THREE.LineBasicMaterial){b=m.linewidth;if(G!=b)w.lineWidth=G=b;b=m.linecap;if(K!=b)w.lineCap=K=b;b=m.linejoin;if(N!=b)w.lineJoin=N=b;f(m.color.getContextStyle());w.stroke();Z.inflate(m.linewidth*2)}}function z(b,f,h,m,n,u,p,w,x){k.info.render.vertices+=3;k.info.render.faces++;c(w.opacity);e(w.blending);
|
|
|
|
-Q=b.positionScreen.x;Y=b.positionScreen.y;W=f.positionScreen.x;o=f.positionScreen.y;$=h.positionScreen.x;T=h.positionScreen.y;E(Q,Y,W,o,$,T);if(w instanceof THREE.MeshBasicMaterial)if(w.map)w.map.mapping instanceof THREE.UVMapping&&(qa=p.uvs[0],ab(Q,Y,W,o,$,T,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[u].u,qa[u].v,w.map));else if(w.envMap){if(w.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=t.matrixWorldInverse,pa.copy(p.vertexNormalsWorld[0]),wa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Ca=
|
|
|
|
--(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(p.vertexNormalsWorld[1]),Fa=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Ea=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,pa.copy(p.vertexNormalsWorld[2]),Da=(pa.x*b.n11+pa.y*b.n12+pa.z*b.n13)*0.5+0.5,Ga=-(pa.x*b.n21+pa.y*b.n22+pa.z*b.n23)*0.5+0.5,ab(Q,Y,W,o,$,T,wa,Ca,Fa,Ea,Da,Ga,w.envMap)}else w.wireframe?Na(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(w.color);else if(w instanceof THREE.MeshLambertMaterial)w.map&&!w.wireframe&&
|
|
|
|
-(w.map.mapping instanceof THREE.UVMapping&&(qa=p.uvs[0],ab(Q,Y,W,o,$,T,qa[m].u,qa[m].v,qa[n].u,qa[n].v,qa[u].u,qa[u].v,w.map)),e(THREE.SubtractiveBlending)),ea?!w.wireframe&&w.shading==THREE.SmoothShading&&p.vertexNormalsWorld.length==3?(X.r=V.r=aa.r=O.r,X.g=V.g=aa.g=O.g,X.b=V.b=aa.b=O.b,v(x,p.v1.positionWorld,p.vertexNormalsWorld[0],X),v(x,p.v2.positionWorld,p.vertexNormalsWorld[1],V),v(x,p.v3.positionWorld,p.vertexNormalsWorld[2],aa),X.r=Math.max(0,Math.min(w.color.r*X.r,1)),X.g=Math.max(0,Math.min(w.color.g*
|
|
|
|
-X.g,1)),X.b=Math.max(0,Math.min(w.color.b*X.b,1)),V.r=Math.max(0,Math.min(w.color.r*V.r,1)),V.g=Math.max(0,Math.min(w.color.g*V.g,1)),V.b=Math.max(0,Math.min(w.color.b*V.b,1)),aa.r=Math.max(0,Math.min(w.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(w.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(w.color.b*aa.b,1)),ia.r=(V.r+aa.r)*0.5,ia.g=(V.g+aa.g)*0.5,ia.b=(V.b+aa.b)*0.5,na=Ya(X,V,aa,ia),Va(Q,Y,W,o,$,T,0,0,1,0,0,1,na)):(ka.r=O.r,ka.g=O.g,ka.b=O.b,v(x,p.centroidWorld,p.normalWorld,ka),da.r=Math.max(0,Math.min(w.color.r*
|
|
|
|
-ka.r,1)),da.g=Math.max(0,Math.min(w.color.g*ka.g,1)),da.b=Math.max(0,Math.min(w.color.b*ka.b,1)),w.wireframe?Na(da,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(da)):w.wireframe?Na(w.color,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(w.color);else if(w instanceof THREE.MeshDepthMaterial)ma=t.near,ga=t.far,X.r=X.g=X.b=1-Ra(b.positionScreen.z,ma,ga),V.r=V.g=V.b=1-Ra(f.positionScreen.z,ma,ga),aa.r=aa.g=aa.b=1-Ra(h.positionScreen.z,ma,ga),ia.r=(V.r+aa.r)*0.5,ia.g=
|
|
|
|
-(V.g+aa.g)*0.5,ia.b=(V.b+aa.b)*0.5,na=Ya(X,V,aa,ia),Va(Q,Y,W,o,$,T,0,0,1,0,0,1,na);else if(w instanceof THREE.MeshNormalMaterial)da.r=Wa(p.normalWorld.x),da.g=Wa(p.normalWorld.y),da.b=Wa(p.normalWorld.z),w.wireframe?Na(da,w.wireframeLinewidth,w.wireframeLinecap,w.wireframeLinejoin):Oa(da)}function F(b,f,h,m,n,u,w,p,x){k.info.render.vertices+=4;k.info.render.faces++;c(p.opacity);e(p.blending);if(p.map||p.envMap)z(b,f,m,0,1,3,w,p,x),z(n,h,u,1,2,3,w,p,x);else if(Q=b.positionScreen.x,Y=b.positionScreen.y,
|
|
|
|
-W=f.positionScreen.x,o=f.positionScreen.y,$=h.positionScreen.x,T=h.positionScreen.y,ha=m.positionScreen.x,fa=m.positionScreen.y,oa=n.positionScreen.x,ca=n.positionScreen.y,ja=u.positionScreen.x,la=u.positionScreen.y,p instanceof THREE.MeshBasicMaterial)D(Q,Y,W,o,$,T,ha,fa),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color);else if(p instanceof THREE.MeshLambertMaterial)ea?!p.wireframe&&p.shading==THREE.SmoothShading&&w.vertexNormalsWorld.length==4?(X.r=
|
|
|
|
-V.r=aa.r=ia.r=O.r,X.g=V.g=aa.g=ia.g=O.g,X.b=V.b=aa.b=ia.b=O.b,v(x,w.v1.positionWorld,w.vertexNormalsWorld[0],X),v(x,w.v2.positionWorld,w.vertexNormalsWorld[1],V),v(x,w.v4.positionWorld,w.vertexNormalsWorld[3],aa),v(x,w.v3.positionWorld,w.vertexNormalsWorld[2],ia),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)),V.r=Math.max(0,Math.min(p.color.r*V.r,1)),V.g=Math.max(0,Math.min(p.color.g*V.g,1)),V.b=Math.max(0,Math.min(p.color.b*
|
|
|
|
-V.b,1)),aa.r=Math.max(0,Math.min(p.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(p.color.g*aa.g,1)),aa.b=Math.max(0,Math.min(p.color.b*aa.b,1)),ia.r=Math.max(0,Math.min(p.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(p.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(p.color.b*ia.b,1)),na=Ya(X,V,aa,ia),E(Q,Y,W,o,ha,fa),Va(Q,Y,W,o,ha,fa,0,0,1,0,0,1,na),E(oa,ca,$,T,ja,la),Va(oa,ca,$,T,ja,la,1,0,1,1,0,1,na)):(ka.r=O.r,ka.g=O.g,ka.b=O.b,v(x,w.centroidWorld,w.normalWorld,ka),da.r=Math.max(0,Math.min(p.color.r*ka.r,1)),
|
|
|
|
-da.g=Math.max(0,Math.min(p.color.g*ka.g,1)),da.b=Math.max(0,Math.min(p.color.b*ka.b,1)),D(Q,Y,W,o,$,T,ha,fa),p.wireframe?Na(da,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(da)):(D(Q,Y,W,o,$,T,ha,fa),p.wireframe?Na(p.color,p.wireframeLinewidth,p.wireframeLinecap,p.wireframeLinejoin):Oa(p.color));else if(p instanceof THREE.MeshNormalMaterial)da.r=Wa(w.normalWorld.x),da.g=Wa(w.normalWorld.y),da.b=Wa(w.normalWorld.z),D(Q,Y,W,o,$,T,ha,fa),p.wireframe?Na(da,p.wireframeLinewidth,p.wireframeLinecap,
|
|
|
|
-p.wireframeLinejoin):Oa(da);else if(p instanceof THREE.MeshDepthMaterial)ma=t.near,ga=t.far,X.r=X.g=X.b=1-Ra(b.positionScreen.z,ma,ga),V.r=V.g=V.b=1-Ra(f.positionScreen.z,ma,ga),aa.r=aa.g=aa.b=1-Ra(m.positionScreen.z,ma,ga),ia.r=ia.g=ia.b=1-Ra(h.positionScreen.z,ma,ga),na=Ya(X,V,aa,ia),E(Q,Y,W,o,ha,fa),Va(Q,Y,W,o,ha,fa,0,0,1,0,0,1,na),E(oa,ca,$,T,ja,la),Va(oa,ca,$,T,ja,la,1,0,1,1,0,1,na)}function E(b,c,e,f,k,h){w.beginPath();w.moveTo(b,c);w.lineTo(e,f);w.lineTo(k,h);w.lineTo(b,c);w.closePath()}function D(b,
|
|
|
|
-c,e,f,k,h,m,o){w.beginPath();w.moveTo(b,c);w.lineTo(e,f);w.lineTo(k,h);w.lineTo(m,o);w.lineTo(b,c);w.closePath()}function Na(b,c,e,k){if(G!=c)w.lineWidth=G=c;if(K!=e)w.lineCap=K=e;if(N!=k)w.lineJoin=N=k;f(b.getContextStyle());w.stroke();Z.inflate(c*2)}function Oa(b){h(b.getContextStyle());w.fill()}function ab(b,c,e,f,k,m,o,n,t,p,u,v,x){if(x.image.width!=0){if(x.needsUpdate==!0||ra[x.id]==void 0){var xa=x.wrapS==THREE.RepeatWrapping,H=x.wrapT==THREE.RepeatWrapping;ra[x.id]=w.createPattern(x.image,
|
|
|
|
-xa&&H?"repeat":xa&&!H?"repeat-x":!xa&&H?"repeat-y":"no-repeat");x.needsUpdate=!1}h(ra[x.id]);var xa=x.offset.x/x.repeat.x,H=x.offset.y/x.repeat.y,y=(x.image.width-1)*x.repeat.x,x=(x.image.height-1)*x.repeat.y,o=(o+xa)*y,n=(n+H)*x,t=(t+xa)*y,p=(p+H)*x,u=(u+xa)*y,v=(v+H)*x;e-=b;f-=c;k-=b;m-=c;t-=o;p-=n;u-=o;v-=n;xa=1/(t*v-u*p);x=(v*e-p*k)*xa;p=(v*f-p*m)*xa;e=(t*k-u*e)*xa;f=(t*m-u*f)*xa;b=b-x*o-e*n;c=c-p*o-f*n;w.save();w.transform(x,p,e,f,b,c);w.fill();w.restore()}}function Va(b,c,e,f,k,h,m,o,n,t,p,
|
|
|
|
-u,x){var xa,v;xa=x.width-1;v=x.height-1;m*=xa;o*=v;n*=xa;t*=v;p*=xa;u*=v;e-=b;f-=c;k-=b;h-=c;n-=m;t-=o;p-=m;u-=o;v=1/(n*u-p*t);xa=(u*e-t*k)*v;t=(u*f-t*h)*v;e=(n*k-p*e)*v;f=(n*h-p*f)*v;b=b-xa*m-e*o;c=c-t*m-f*o;w.save();w.transform(xa,t,e,f,b,c);w.clip();w.drawImage(x,0,0);w.restore()}function Ya(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),t=~~(e.g*255),e=~~(e.b*255),p=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);sa[0]=k<0?0:k>255?255:k;
|
|
|
|
-sa[1]=h<0?0:h>255?255:h;sa[2]=b<0?0:b>255?255:b;sa[4]=m<0?0:m>255?255:m;sa[5]=o<0?0:o>255?255:o;sa[6]=c<0?0:c>255?255:c;sa[8]=n<0?0:n>255?255:n;sa[9]=t<0?0:t>255?255:t;sa[10]=e<0?0:e>255?255:e;sa[12]=p<0?0:p>255?255:p;sa[13]=u<0?0:u>255?255:u;sa[14]=f<0?0:f>255?255:f;Ha.putImageData(Aa,0,0);R.drawImage(za,0,0);return Ia}function Ra(b,c,e){b=(b-c)/(e-c);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,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 Za,bb,ta,Ja,Qa,Xa,$a,Ba;this.autoClear?this.clear():w.setTransform(1,0,0,-1,p,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,t,this.sortElements);(ea=b.lights.length>0)&&u(b);Za=0;for(bb=m.length;Za<bb;Za++){ta=m[Za];Z.empty();if(ta instanceof THREE.RenderableParticle){L=ta;L.x*=p;L.y*=x;Ja=0;for(Qa=ta.materials.length;Ja<Qa;)Ba=ta.materials[Ja++],Ba.opacity!=0&&y(L,ta,Ba,b)}else if(ta instanceof THREE.RenderableLine){if(L=ta.v1,B=ta.v2,
|
|
|
|
-L.positionScreen.x*=p,L.positionScreen.y*=x,B.positionScreen.x*=p,B.positionScreen.y*=x,Z.addPoint(L.positionScreen.x,L.positionScreen.y),Z.addPoint(B.positionScreen.x,B.positionScreen.y),ya.intersects(Z)){Ja=0;for(Qa=ta.materials.length;Ja<Qa;)Ba=ta.materials[Ja++],Ba.opacity!=0&&A(L,B,ta,Ba,b)}}else if(ta instanceof THREE.RenderableFace3){if(L=ta.v1,B=ta.v2,M=ta.v3,L.positionScreen.x*=p,L.positionScreen.y*=x,B.positionScreen.x*=p,B.positionScreen.y*=x,M.positionScreen.x*=p,M.positionScreen.y*=x,
|
|
|
|
-ta.overdraw&&(Pa(L.positionScreen,B.positionScreen),Pa(B.positionScreen,M.positionScreen),Pa(M.positionScreen,L.positionScreen)),Z.add3Points(L.positionScreen.x,L.positionScreen.y,B.positionScreen.x,B.positionScreen.y,M.positionScreen.x,M.positionScreen.y),ya.intersects(Z)){Ja=0;for(Qa=ta.meshMaterials.length;Ja<Qa;)if(Ba=ta.meshMaterials[Ja++],Ba instanceof THREE.MeshFaceMaterial){Xa=0;for($a=ta.faceMaterials.length;Xa<$a;)(Ba=ta.faceMaterials[Xa++])&&Ba.opacity!=0&&z(L,B,M,0,1,2,ta,Ba,b)}else Ba.opacity!=
|
|
|
|
-0&&z(L,B,M,0,1,2,ta,Ba,b)}}else if(ta instanceof THREE.RenderableFace4&&(L=ta.v1,B=ta.v2,M=ta.v3,U=ta.v4,L.positionScreen.x*=p,L.positionScreen.y*=x,B.positionScreen.x*=p,B.positionScreen.y*=x,M.positionScreen.x*=p,M.positionScreen.y*=x,U.positionScreen.x*=p,U.positionScreen.y*=x,I.positionScreen.copy(B.positionScreen),S.positionScreen.copy(U.positionScreen),ta.overdraw&&(Pa(L.positionScreen,B.positionScreen),Pa(B.positionScreen,U.positionScreen),Pa(U.positionScreen,L.positionScreen),Pa(M.positionScreen,
|
|
|
|
-I.positionScreen),Pa(M.positionScreen,S.positionScreen)),Z.addPoint(L.positionScreen.x,L.positionScreen.y),Z.addPoint(B.positionScreen.x,B.positionScreen.y),Z.addPoint(M.positionScreen.x,M.positionScreen.y),Z.addPoint(U.positionScreen.x,U.positionScreen.y),ya.intersects(Z))){Ja=0;for(Qa=ta.meshMaterials.length;Ja<Qa;)if(Ba=ta.meshMaterials[Ja++],Ba instanceof THREE.MeshFaceMaterial){Xa=0;for($a=ta.faceMaterials.length;Xa<$a;)(Ba=ta.faceMaterials[Xa++])&&Ba.opacity!=0&&F(L,B,M,U,I,S,ta,Ba,b)}else Ba.opacity!=
|
|
|
|
-0&&F(L,B,M,U,I,S,ta,Ba,b)}H.addRectangle(Z)}w.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&&(U.sub(h.position,c.centroidWorld),U.normalize(),m=c.normalWorld.dot(U)*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,p){k.info.render.vertices+=3;k.info.render.faces++;Q=f(Y++);
|
|
|
|
-Q.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?G.copy(n.color):n instanceof THREE.MeshLambertMaterial?D?(K.r=N.r,K.g=N.g,K.b=N.b,b(p,o,K),G.r=Math.max(0,Math.min(n.color.r*K.r,1)),G.g=Math.max(0,Math.min(n.color.g*K.g,1)),G.b=Math.max(0,Math.min(n.color.b*K.b,1))):G.copy(n.color):n instanceof THREE.MeshDepthMaterial?(M=1-n.__2near/(n.__farPlusNear-
|
|
|
|
-o.z*n.__farMinusNear),G.setRGB(M,M,M)):n instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));n.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+n.wireframeLinewidth+"; stroke-opacity: "+n.opacity+"; stroke-linecap: "+n.wireframeLinecap+"; stroke-linejoin: "+n.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+n.opacity);t.appendChild(Q)}function e(c,e,m,o,n,p,u){k.info.render.vertices+=
|
|
|
|
-4;k.info.render.faces++;Q=f(Y++);Q.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");p instanceof THREE.MeshBasicMaterial?G.copy(p.color):p instanceof THREE.MeshLambertMaterial?D?(K.r=N.r,K.g=N.g,K.b=N.b,b(u,n,K),G.r=Math.max(0,Math.min(p.color.r*K.r,1)),G.g=Math.max(0,Math.min(p.color.g*K.g,1)),G.b=Math.max(0,Math.min(p.color.b*K.b,1))):
|
|
|
|
-G.copy(p.color):p instanceof THREE.MeshDepthMaterial?(M=1-p.__2near/(p.__farPlusNear-n.z*p.__farMinusNear),G.setRGB(M,M,M)):p instanceof THREE.MeshNormalMaterial&&G.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));p.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+p.wireframeLinewidth+"; stroke-opacity: "+p.opacity+"; stroke-linecap: "+p.wireframeLinecap+"; stroke-linejoin: "+p.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+
|
|
|
|
-"; fill-opacity: "+p.opacity);t.appendChild(Q)}function f(b){I[b]==null&&(I[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),o==0&&I[b].setAttribute("shape-rendering","crispEdges"));return I[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"),u,v,p,x,w,z,y,A,E=new THREE.Rectangle,F=new THREE.Rectangle,D=!1,G=new THREE.Color(16777215),K=new THREE.Color(16777215),N=new THREE.Color(0),
|
|
|
|
-L=new THREE.Color(0),B=new THREE.Color(0),M,U=new THREE.Vector3,I=[],S=[],Q,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,c){u=b;v=c;p=u/2;x=v/2;t.setAttribute("viewBox",-p+" "+-x+" "+u+" "+v);t.setAttribute("width",u);t.setAttribute("height",v);E.set(-p,-x,p,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};
|
|
|
|
-this.render=function(b,f){var h,u,v,G,I,M,K,X;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){K=b.lights;N.setRGB(0,0,0);L.setRGB(0,0,0);B.setRGB(0,0,0);h=0;for(u=K.length;h<u;h++)v=K[h],G=v.color,v instanceof THREE.AmbientLight?(N.r+=G.r,N.g+=G.g,N.b+=G.b):v instanceof THREE.DirectionalLight?(L.r+=G.r,L.g+=G.g,L.b+=G.b):v instanceof THREE.PointLight&&(B.r+=G.r,B.g+=G.g,B.b+=G.b)}h=0;for(u=m.length;h<
|
|
|
|
-u;h++)if(K=m[h],F.empty(),K instanceof THREE.RenderableParticle){w=K;w.x*=p;w.y*=-x;v=0;for(G=K.materials.length;v<G;)v++}else if(K instanceof THREE.RenderableLine){if(w=K.v1,z=K.v2,w.positionScreen.x*=p,w.positionScreen.y*=-x,z.positionScreen.x*=p,z.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),E.intersects(F)){v=0;for(G=K.materials.length;v<G;)if((X=K.materials[v++])&&X.opacity!=0){I=w;M=z;var V=W++;S[V]==null&&(S[V]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
-"line"),o==0&&S[V].setAttribute("shape-rendering","crispEdges"));Q=S[V];Q.setAttribute("x1",I.positionScreen.x);Q.setAttribute("y1",I.positionScreen.y);Q.setAttribute("x2",M.positionScreen.x);Q.setAttribute("y2",M.positionScreen.y);X instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: "+X.color.getContextStyle()+"; stroke-width: "+X.linewidth+"; stroke-opacity: "+X.opacity+"; stroke-linecap: "+X.linecap+"; stroke-linejoin: "+X.linejoin),t.appendChild(Q))}}}else if(K instanceof
|
|
|
|
-THREE.RenderableFace3){if(w=K.v1,z=K.v2,y=K.v3,w.positionScreen.x*=p,w.positionScreen.y*=-x,z.positionScreen.x*=p,z.positionScreen.y*=-x,y.positionScreen.x*=p,y.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),E.intersects(F)){v=0;for(G=K.meshMaterials.length;v<G;)if(X=K.meshMaterials[v++],X instanceof THREE.MeshFaceMaterial){I=0;for(M=K.faceMaterials.length;I<M;)(X=K.faceMaterials[I++])&&
|
|
|
|
-X.opacity!=0&&c(w,z,y,K,X,b)}else X&&X.opacity!=0&&c(w,z,y,K,X,b)}}else if(K instanceof THREE.RenderableFace4&&(w=K.v1,z=K.v2,y=K.v3,A=K.v4,w.positionScreen.x*=p,w.positionScreen.y*=-x,z.positionScreen.x*=p,z.positionScreen.y*=-x,y.positionScreen.x*=p,y.positionScreen.y*=-x,A.positionScreen.x*=p,A.positionScreen.y*=-x,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),
|
|
|
|
-E.intersects(F))){v=0;for(G=K.meshMaterials.length;v<G;)if(X=K.meshMaterials[v++],X instanceof THREE.MeshFaceMaterial){I=0;for(M=K.faceMaterials.length;I<M;)(X=K.faceMaterials[I++])&&X.opacity!=0&&e(w,z,y,A,K,X,b)}else X&&X.opacity!=0&&e(w,z,y,A,K,X,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 t,u,w,o,x,v,z,y;b=c.projectScene(e,f);t=0;for(u=b.length;t<u;t++)if(x=b[t],x instanceof THREE.RenderableParticle){z=x.x*h+h;y=x.y*k+k;w=0;for(o=x.material.length;w<o;w++)if(v=x.material[w],v instanceof THREE.ParticleDOMMaterial)v=v.domElement,v.style.left=z+"px",v.style.top=y+"px"}}};
|
|
|
|
+THREE.CanvasRenderer=function(b){function c(b){if(A!=b)v.globalAlpha=A=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(C!=b)v.fillStyle=C=b}var k=this,m=null,n=new THREE.Projector,b=b||{},t=b.canvas!==void 0?b.canvas:document.createElement("canvas"),
|
|
|
|
+u,w,o,x,v=t.getContext("2d"),z=new THREE.Color(0),y=0,A=1,E=0,F=null,C=null,G=null,J=null,O=null,K,B,N,Y,H=new THREE.RenderableVertex,T=new THREE.RenderableVertex,Q,Z,$,S,p,V,ea,da,ha,ga,ka,na,aa=new THREE.Color(0),W=new THREE.Color(0),U=new THREE.Color(0),ia=new THREE.Color(0),ja=new THREE.Color(0),ta=[],la,ca,pa,ra,sa,ya,Ca,Ga,Fa,Da,za=new THREE.Rectangle,L=new THREE.Rectangle,M=new THREE.Rectangle,fa=!1,qa=new THREE.Color,P=new THREE.Color,ma=new THREE.Color,ua=new THREE.Color,oa=new THREE.Vector3,
|
|
|
|
+Ea,Ia,Ba,va,Ka,Ha,b=16;Ea=document.createElement("canvas");Ea.width=Ea.height=2;Ia=Ea.getContext("2d");Ia.fillStyle="rgba(0,0,0,1)";Ia.fillRect(0,0,2,2);Ba=Ia.getImageData(0,0,2,2);va=Ba.data;Ka=document.createElement("canvas");Ka.width=Ka.height=b;Ha=Ka.getContext("2d");Ha.translate(-b/2,-b/2);Ha.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,c){u=b;w=c;o=Math.floor(u/2);x=Math.floor(w/2);t.width=
|
|
|
|
+u;t.height=w;za.set(-o,-x,o,x);L.set(-o,-x,o,x);A=1;E=0;O=J=G=C=F=null};this.setClearColor=function(b,c){z.copy(b);y=c;L.set(-o,-x,o,x)};this.setClearColorHex=function(b,c){z.setHex(b);y=c;L.set(-o,-x,o,x)};this.clear=function(){v.setTransform(1,0,0,-1,o,x);L.isEmpty()||(L.minSelf(za),L.inflate(2),y<1&&v.clearRect(Math.floor(L.getX()),Math.floor(L.getY()),Math.floor(L.getWidth()),Math.floor(L.getHeight())),y>0&&(e(THREE.NormalBlending),c(1),h("rgba("+Math.floor(z.r*255)+","+Math.floor(z.g*255)+","+
|
|
|
|
+Math.floor(z.b*255)+","+y+")"),v.fillRect(Math.floor(L.getX()),Math.floor(L.getY()),Math.floor(L.getWidth()),Math.floor(L.getHeight()))),L.empty())};this.render=function(b,t){function u(b){var c,e,f,k=b.lights;P.setRGB(0,0,0);ma.setRGB(0,0,0);ua.setRGB(0,0,0);b=0;for(c=k.length;b<c;b++)e=k[b],f=e.color,e instanceof THREE.AmbientLight?(P.r+=f.r,P.g+=f.g,P.b+=f.b):e instanceof THREE.DirectionalLight?(ma.r+=f.r,ma.g+=f.g,ma.b+=f.b):e instanceof THREE.PointLight&&(ua.r+=f.r,ua.g+=f.g,ua.b+=f.b)}function w(b,
|
|
|
|
+c,e,f){var k,h,m,p,n=b.lights,b=0;for(k=n.length;b<k;b++)h=n[b],m=h.color,h instanceof THREE.DirectionalLight?(p=e.dot(h.position),p<=0||(p*=h.intensity,f.r+=m.r*p,f.g+=m.g*p,f.b+=m.b*p)):h instanceof THREE.PointLight&&(p=e.dot(oa.sub(h.position,c).normalize()),p<=0||(p*=h.distance==0?1:1-Math.min(c.distanceTo(h.position)/h.distance,1),p!=0&&(p*=h.intensity,f.r+=m.r*p,f.g+=m.g*p,f.b+=m.b*p)))}function y(b,k,m){c(m.opacity);e(m.blending);var p,n,t,u,w,xa;if(m instanceof THREE.ParticleBasicMaterial){if(m.map)u=
|
|
|
|
+m.map.image,w=u.width>>1,xa=u.height>>1,m=k.scale.x*o,t=k.scale.y*x,p=m*w,n=t*xa,M.set(b.x-p,b.y-n,b.x+p,b.y+n),za.intersects(M)&&(v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(m,-t),v.translate(-w,-xa),v.drawImage(u,0,0),v.restore())}else m instanceof THREE.ParticleCanvasMaterial&&(p=k.scale.x*o,n=k.scale.y*x,M.set(b.x-p,b.y-n,b.x+p,b.y+n),za.intersects(M)&&(f(m.color.getContextStyle()),h(m.color.getContextStyle()),v.save(),v.translate(b.x,b.y),v.rotate(-k.rotation),v.scale(p,n),m.program(v),
|
|
|
|
+v.restore()))}function eb(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(G!=b)v.lineWidth=G=b;b=m.linecap;if(J!=b)v.lineCap=J=b;b=m.linejoin;if(O!=b)v.lineJoin=O=b;f(m.color.getContextStyle());v.stroke();M.inflate(m.linewidth*2)}}function A(b,f,h,m,n,u,o,v,xa){k.info.render.vertices+=3;k.info.render.faces++;c(v.opacity);e(v.blending);
|
|
|
|
+Q=b.positionScreen.x;Z=b.positionScreen.y;$=f.positionScreen.x;S=f.positionScreen.y;p=h.positionScreen.x;V=h.positionScreen.y;F(Q,Z,$,S,p,V);if(v instanceof THREE.MeshBasicMaterial)if(v.map)v.map.mapping instanceof THREE.UVMapping&&(ra=o.uvs[0],ab(Q,Z,$,S,p,V,ra[m].u,ra[m].v,ra[n].u,ra[n].v,ra[u].u,ra[u].v,v.map));else if(v.envMap){if(v.envMap.mapping instanceof THREE.SphericalReflectionMapping)b=t.matrixWorldInverse,oa.copy(o.vertexNormalsWorld[0]),sa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,ya=
|
|
|
|
+-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(o.vertexNormalsWorld[1]),Ca=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Ga=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,oa.copy(o.vertexNormalsWorld[2]),Fa=(oa.x*b.n11+oa.y*b.n12+oa.z*b.n13)*0.5+0.5,Da=-(oa.x*b.n21+oa.y*b.n22+oa.z*b.n23)*0.5+0.5,ab(Q,Z,$,S,p,V,sa,ya,Ca,Ga,Fa,Da,v.envMap)}else v.wireframe?C(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&&(ra=o.uvs[0],ab(Q,Z,$,S,p,V,ra[m].u,ra[m].v,ra[n].u,ra[n].v,ra[u].u,ra[u].v,v.map)),e(THREE.SubtractiveBlending)),fa?!v.wireframe&&v.shading==THREE.SmoothShading&&o.vertexNormalsWorld.length==3?(W.r=U.r=ia.r=P.r,W.g=U.g=ia.g=P.g,W.b=U.b=ia.b=P.b,w(xa,o.v1.positionWorld,o.vertexNormalsWorld[0],W),w(xa,o.v2.positionWorld,o.vertexNormalsWorld[1],U),w(xa,o.v3.positionWorld,o.vertexNormalsWorld[2],ia),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)),U.r=Math.max(0,Math.min(v.color.r*U.r,1)),U.g=Math.max(0,Math.min(v.color.g*U.g,1)),U.b=Math.max(0,Math.min(v.color.b*U.b,1)),ia.r=Math.max(0,Math.min(v.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(v.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(v.color.b*ia.b,1)),ja.r=(U.r+ia.r)*0.5,ja.g=(U.g+ia.g)*0.5,ja.b=(U.b+ia.b)*0.5,pa=Ya(W,U,ia,ja),Ua(Q,Z,$,S,p,V,0,0,1,0,0,1,pa)):(qa.r=P.r,qa.g=P.g,qa.b=P.b,w(xa,o.centroidWorld,o.normalWorld,qa),aa.r=Math.max(0,Math.min(v.color.r*
|
|
|
|
+qa.r,1)),aa.g=Math.max(0,Math.min(v.color.g*qa.g,1)),aa.b=Math.max(0,Math.min(v.color.b*qa.b,1)),v.wireframe?C(aa,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Na(aa)):v.wireframe?C(v.color,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Na(v.color);else if(v instanceof THREE.MeshDepthMaterial)la=t.near,ca=t.far,W.r=W.g=W.b=1-Qa(b.positionScreen.z,la,ca),U.r=U.g=U.b=1-Qa(f.positionScreen.z,la,ca),ia.r=ia.g=ia.b=1-Qa(h.positionScreen.z,la,ca),ja.r=(U.r+ia.r)*0.5,ja.g=(U.g+
|
|
|
|
+ia.g)*0.5,ja.b=(U.b+ia.b)*0.5,pa=Ya(W,U,ia,ja),Ua(Q,Z,$,S,p,V,0,0,1,0,0,1,pa);else if(v instanceof THREE.MeshNormalMaterial)aa.r=Va(o.normalWorld.x),aa.g=Va(o.normalWorld.y),aa.b=Va(o.normalWorld.z),v.wireframe?C(aa,v.wireframeLinewidth,v.wireframeLinecap,v.wireframeLinejoin):Na(aa)}function z(b,f,h,m,n,u,v,o,xa){k.info.render.vertices+=4;k.info.render.faces++;c(o.opacity);e(o.blending);if(o.map||o.envMap)A(b,f,m,0,1,3,v,o,xa),A(n,h,u,1,2,3,v,o,xa);else if(Q=b.positionScreen.x,Z=b.positionScreen.y,
|
|
|
|
+$=f.positionScreen.x,S=f.positionScreen.y,p=h.positionScreen.x,V=h.positionScreen.y,ea=m.positionScreen.x,da=m.positionScreen.y,ha=n.positionScreen.x,ga=n.positionScreen.y,ka=u.positionScreen.x,na=u.positionScreen.y,o instanceof THREE.MeshBasicMaterial)E(Q,Z,$,S,p,V,ea,da),o.wireframe?C(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Na(o.color);else if(o instanceof THREE.MeshLambertMaterial)fa?!o.wireframe&&o.shading==THREE.SmoothShading&&v.vertexNormalsWorld.length==4?(W.r=
|
|
|
|
+U.r=ia.r=ja.r=P.r,W.g=U.g=ia.g=ja.g=P.g,W.b=U.b=ia.b=ja.b=P.b,w(xa,v.v1.positionWorld,v.vertexNormalsWorld[0],W),w(xa,v.v2.positionWorld,v.vertexNormalsWorld[1],U),w(xa,v.v4.positionWorld,v.vertexNormalsWorld[3],ia),w(xa,v.v3.positionWorld,v.vertexNormalsWorld[2],ja),W.r=Math.max(0,Math.min(o.color.r*W.r,1)),W.g=Math.max(0,Math.min(o.color.g*W.g,1)),W.b=Math.max(0,Math.min(o.color.b*W.b,1)),U.r=Math.max(0,Math.min(o.color.r*U.r,1)),U.g=Math.max(0,Math.min(o.color.g*U.g,1)),U.b=Math.max(0,Math.min(o.color.b*
|
|
|
|
+U.b,1)),ia.r=Math.max(0,Math.min(o.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(o.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(o.color.b*ia.b,1)),ja.r=Math.max(0,Math.min(o.color.r*ja.r,1)),ja.g=Math.max(0,Math.min(o.color.g*ja.g,1)),ja.b=Math.max(0,Math.min(o.color.b*ja.b,1)),pa=Ya(W,U,ia,ja),F(Q,Z,$,S,ea,da),Ua(Q,Z,$,S,ea,da,0,0,1,0,0,1,pa),F(ha,ga,p,V,ka,na),Ua(ha,ga,p,V,ka,na,1,0,1,1,0,1,pa)):(qa.r=P.r,qa.g=P.g,qa.b=P.b,w(xa,v.centroidWorld,v.normalWorld,qa),aa.r=Math.max(0,Math.min(o.color.r*qa.r,
|
|
|
|
+1)),aa.g=Math.max(0,Math.min(o.color.g*qa.g,1)),aa.b=Math.max(0,Math.min(o.color.b*qa.b,1)),E(Q,Z,$,S,p,V,ea,da),o.wireframe?C(aa,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Na(aa)):(E(Q,Z,$,S,p,V,ea,da),o.wireframe?C(o.color,o.wireframeLinewidth,o.wireframeLinecap,o.wireframeLinejoin):Na(o.color));else if(o instanceof THREE.MeshNormalMaterial)aa.r=Va(v.normalWorld.x),aa.g=Va(v.normalWorld.y),aa.b=Va(v.normalWorld.z),E(Q,Z,$,S,p,V,ea,da),o.wireframe?C(aa,o.wireframeLinewidth,o.wireframeLinecap,
|
|
|
|
+o.wireframeLinejoin):Na(aa);else if(o instanceof THREE.MeshDepthMaterial)la=t.near,ca=t.far,W.r=W.g=W.b=1-Qa(b.positionScreen.z,la,ca),U.r=U.g=U.b=1-Qa(f.positionScreen.z,la,ca),ia.r=ia.g=ia.b=1-Qa(m.positionScreen.z,la,ca),ja.r=ja.g=ja.b=1-Qa(h.positionScreen.z,la,ca),pa=Ya(W,U,ia,ja),F(Q,Z,$,S,ea,da),Ua(Q,Z,$,S,ea,da,0,0,1,0,0,1,pa),F(ha,ga,p,V,ka,na),Ua(ha,ga,p,V,ka,na,1,0,1,1,0,1,pa)}function F(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 E(b,
|
|
|
|
+c,e,f,k,h,m,p){v.beginPath();v.moveTo(b,c);v.lineTo(e,f);v.lineTo(k,h);v.lineTo(m,p);v.lineTo(b,c);v.closePath()}function C(b,c,e,k){if(G!=c)v.lineWidth=G=c;if(J!=e)v.lineCap=J=e;if(O!=k)v.lineJoin=O=k;f(b.getContextStyle());v.stroke();M.inflate(c*2)}function Na(b){h(b.getContextStyle());v.fill()}function ab(b,c,e,f,k,m,p,n,t,o,u,xa,w){if(w.image.width!=0){if(w.needsUpdate==!0||ta[w.id]==void 0){var x=w.wrapS==THREE.RepeatWrapping,L=w.wrapT==THREE.RepeatWrapping;ta[w.id]=v.createPattern(w.image,x&&
|
|
|
|
+L?"repeat":x&&!L?"repeat-x":!x&&L?"repeat-y":"no-repeat");w.needsUpdate=!1}h(ta[w.id]);var x=w.offset.x/w.repeat.x,L=w.offset.y/w.repeat.y,y=(w.image.width-1)*w.repeat.x,w=(w.image.height-1)*w.repeat.y,p=(p+x)*y,n=(n+L)*w,t=(t+x)*y,o=(o+L)*w,u=(u+x)*y,xa=(xa+L)*w;e-=b;f-=c;k-=b;m-=c;t-=p;o-=n;u-=p;xa-=n;x=1/(t*xa-u*o);w=(xa*e-o*k)*x;o=(xa*f-o*m)*x;e=(t*k-u*e)*x;f=(t*m-u*f)*x;b=b-w*p-e*n;c=c-o*p-f*n;v.save();v.transform(w,o,e,f,b,c);v.fill();v.restore()}}function Ua(b,c,e,f,k,h,m,p,n,t,o,u,w){var xa,
|
|
|
|
+x;xa=w.width-1;x=w.height-1;m*=xa;p*=x;n*=xa;t*=x;o*=xa;u*=x;e-=b;f-=c;k-=b;h-=c;n-=m;t-=p;o-=m;u-=p;x=1/(n*u-o*t);xa=(u*e-t*k)*x;t=(u*f-t*h)*x;e=(n*k-o*e)*x;f=(n*h-o*f)*x;b=b-xa*m-e*p;c=c-t*m-f*p;v.save();v.transform(xa,t,e,f,b,c);v.clip();v.drawImage(w,0,0);v.restore()}function Ya(b,c,e,f){var k=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),m=~~(c.r*255),p=~~(c.g*255),c=~~(c.b*255),n=~~(e.r*255),t=~~(e.g*255),e=~~(e.b*255),o=~~(f.r*255),u=~~(f.g*255),f=~~(f.b*255);va[0]=k<0?0:k>255?255:k;va[1]=h<0?0:
|
|
|
|
+h>255?255:h;va[2]=b<0?0:b>255?255:b;va[4]=m<0?0:m>255?255:m;va[5]=p<0?0:p>255?255:p;va[6]=c<0?0:c>255?255:c;va[8]=n<0?0:n>255?255:n;va[9]=t<0?0:t>255?255:t;va[10]=e<0?0:e>255?255:e;va[12]=o<0?0:o>255?255:o;va[13]=u<0?0:u>255?255:u;va[14]=f<0?0:f>255?255:f;Ia.putImageData(Ba,0,0);Ha.drawImage(Ea,0,0);return Ka}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 Za,bb,wa,Ja,Pa,Wa,$a,Aa;this.autoClear?this.clear():v.setTransform(1,0,0,-1,o,x);k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,t,this.sortElements);(fa=b.lights.length>0)&&u(b);Za=0;for(bb=m.length;Za<bb;Za++){wa=m[Za];M.empty();if(wa instanceof THREE.RenderableParticle){K=wa;K.x*=o;K.y*=x;Ja=0;for(Pa=wa.materials.length;Ja<Pa;)Aa=wa.materials[Ja++],Aa.opacity!=0&&y(K,wa,Aa,b)}else if(wa instanceof THREE.RenderableLine){if(K=wa.v1,B=wa.v2,K.positionScreen.x*=
|
|
|
|
+o,K.positionScreen.y*=x,B.positionScreen.x*=o,B.positionScreen.y*=x,M.addPoint(K.positionScreen.x,K.positionScreen.y),M.addPoint(B.positionScreen.x,B.positionScreen.y),za.intersects(M)){Ja=0;for(Pa=wa.materials.length;Ja<Pa;)Aa=wa.materials[Ja++],Aa.opacity!=0&&eb(K,B,wa,Aa,b)}}else if(wa instanceof THREE.RenderableFace3){if(K=wa.v1,B=wa.v2,N=wa.v3,K.positionScreen.x*=o,K.positionScreen.y*=x,B.positionScreen.x*=o,B.positionScreen.y*=x,N.positionScreen.x*=o,N.positionScreen.y*=x,wa.overdraw&&(Oa(K.positionScreen,
|
|
|
|
+B.positionScreen),Oa(B.positionScreen,N.positionScreen),Oa(N.positionScreen,K.positionScreen)),M.add3Points(K.positionScreen.x,K.positionScreen.y,B.positionScreen.x,B.positionScreen.y,N.positionScreen.x,N.positionScreen.y),za.intersects(M)){Ja=0;for(Pa=wa.meshMaterials.length;Ja<Pa;)if(Aa=wa.meshMaterials[Ja++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for($a=wa.faceMaterials.length;Wa<$a;)(Aa=wa.faceMaterials[Wa++])&&Aa.opacity!=0&&A(K,B,N,0,1,2,wa,Aa,b)}else Aa.opacity!=0&&A(K,B,N,0,1,2,wa,Aa,
|
|
|
|
+b)}}else if(wa instanceof THREE.RenderableFace4&&(K=wa.v1,B=wa.v2,N=wa.v3,Y=wa.v4,K.positionScreen.x*=o,K.positionScreen.y*=x,B.positionScreen.x*=o,B.positionScreen.y*=x,N.positionScreen.x*=o,N.positionScreen.y*=x,Y.positionScreen.x*=o,Y.positionScreen.y*=x,H.positionScreen.copy(B.positionScreen),T.positionScreen.copy(Y.positionScreen),wa.overdraw&&(Oa(K.positionScreen,B.positionScreen),Oa(B.positionScreen,Y.positionScreen),Oa(Y.positionScreen,K.positionScreen),Oa(N.positionScreen,H.positionScreen),
|
|
|
|
+Oa(N.positionScreen,T.positionScreen)),M.addPoint(K.positionScreen.x,K.positionScreen.y),M.addPoint(B.positionScreen.x,B.positionScreen.y),M.addPoint(N.positionScreen.x,N.positionScreen.y),M.addPoint(Y.positionScreen.x,Y.positionScreen.y),za.intersects(M))){Ja=0;for(Pa=wa.meshMaterials.length;Ja<Pa;)if(Aa=wa.meshMaterials[Ja++],Aa instanceof THREE.MeshFaceMaterial){Wa=0;for($a=wa.faceMaterials.length;Wa<$a;)(Aa=wa.faceMaterials[Wa++])&&Aa.opacity!=0&&z(K,B,N,Y,H,T,wa,Aa,b)}else Aa.opacity!=0&&z(K,
|
|
|
|
+B,N,Y,H,T,wa,Aa,b)}L.addRectangle(M)}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&&(Y.sub(h.position,c.centroidWorld),Y.normalize(),m=c.normalWorld.dot(Y)*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,n,o,u){k.info.render.vertices+=3;k.info.render.faces++;Q=f(Z++);
|
|
|
|
+Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+"z");o instanceof THREE.MeshBasicMaterial?G.copy(o.color):o instanceof THREE.MeshLambertMaterial?C?(J.r=O.r,J.g=O.g,J.b=O.b,b(u,n,J),G.r=Math.max(0,Math.min(o.color.r*J.r,1)),G.g=Math.max(0,Math.min(o.color.g*J.g,1)),G.b=Math.max(0,Math.min(o.color.b*J.b,1))):G.copy(o.color):o instanceof THREE.MeshDepthMaterial?(N=1-o.__2near/(o.__farPlusNear-
|
|
|
|
+n.z*o.__farMinusNear),G.setRGB(N,N,N)):o instanceof THREE.MeshNormalMaterial&&G.setRGB(h(n.normalWorld.x),h(n.normalWorld.y),h(n.normalWorld.z));o.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+o.wireframeLinewidth+"; stroke-opacity: "+o.opacity+"; stroke-linecap: "+o.wireframeLinecap+"; stroke-linejoin: "+o.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+"; fill-opacity: "+o.opacity);t.appendChild(Q)}function e(c,e,m,n,o,u,v){k.info.render.vertices+=
|
|
|
|
+4;k.info.render.faces++;Q=f(Z++);Q.setAttribute("d","M "+c.positionScreen.x+" "+c.positionScreen.y+" L "+e.positionScreen.x+" "+e.positionScreen.y+" L "+m.positionScreen.x+","+m.positionScreen.y+" L "+n.positionScreen.x+","+n.positionScreen.y+"z");u instanceof THREE.MeshBasicMaterial?G.copy(u.color):u instanceof THREE.MeshLambertMaterial?C?(J.r=O.r,J.g=O.g,J.b=O.b,b(v,o,J),G.r=Math.max(0,Math.min(u.color.r*J.r,1)),G.g=Math.max(0,Math.min(u.color.g*J.g,1)),G.b=Math.max(0,Math.min(u.color.b*J.b,1))):
|
|
|
|
+G.copy(u.color):u instanceof THREE.MeshDepthMaterial?(N=1-u.__2near/(u.__farPlusNear-o.z*u.__farMinusNear),G.setRGB(N,N,N)):u instanceof THREE.MeshNormalMaterial&&G.setRGB(h(o.normalWorld.x),h(o.normalWorld.y),h(o.normalWorld.z));u.wireframe?Q.setAttribute("style","fill: none; stroke: "+G.getContextStyle()+"; stroke-width: "+u.wireframeLinewidth+"; stroke-opacity: "+u.opacity+"; stroke-linecap: "+u.wireframeLinecap+"; stroke-linejoin: "+u.wireframeLinejoin):Q.setAttribute("style","fill: "+G.getContextStyle()+
|
|
|
|
+"; fill-opacity: "+u.opacity);t.appendChild(Q)}function f(b){H[b]==null&&(H[b]=document.createElementNS("http://www.w3.org/2000/svg","path"),S==0&&H[b].setAttribute("shape-rendering","crispEdges"));return H[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"),u,w,o,x,v,z,y,A,E=new THREE.Rectangle,F=new THREE.Rectangle,C=!1,G=new THREE.Color(16777215),J=new THREE.Color(16777215),O=new THREE.Color(0),
|
|
|
|
+K=new THREE.Color(0),B=new THREE.Color(0),N,Y=new THREE.Vector3,H=[],T=[],Q,Z,$,S=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":S=1;break;case "low":S=0}};this.setSize=function(b,c){u=b;w=c;o=u/2;x=w/2;t.setAttribute("viewBox",-o+" "+-x+" "+u+" "+w);t.setAttribute("width",u);t.setAttribute("height",w);E.set(-o,-x,o,x)};this.clear=function(){for(;t.childNodes.length>0;)t.removeChild(t.childNodes[0])};
|
|
|
|
+this.render=function(b,f){var h,u,w,G,H,N,J,W;this.autoClear&&this.clear();k.info.render.vertices=0;k.info.render.faces=0;m=n.projectScene(b,f,this.sortElements);$=Z=0;if(C=b.lights.length>0){J=b.lights;O.setRGB(0,0,0);K.setRGB(0,0,0);B.setRGB(0,0,0);h=0;for(u=J.length;h<u;h++)w=J[h],G=w.color,w instanceof THREE.AmbientLight?(O.r+=G.r,O.g+=G.g,O.b+=G.b):w instanceof THREE.DirectionalLight?(K.r+=G.r,K.g+=G.g,K.b+=G.b):w instanceof THREE.PointLight&&(B.r+=G.r,B.g+=G.g,B.b+=G.b)}h=0;for(u=m.length;h<
|
|
|
|
+u;h++)if(J=m[h],F.empty(),J instanceof THREE.RenderableParticle){v=J;v.x*=o;v.y*=-x;w=0;for(G=J.materials.length;w<G;)w++}else if(J instanceof THREE.RenderableLine){if(v=J.v1,z=J.v2,v.positionScreen.x*=o,v.positionScreen.y*=-x,z.positionScreen.x*=o,z.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),E.intersects(F)){w=0;for(G=J.materials.length;w<G;)if((W=J.materials[w++])&&W.opacity!=0){H=v;N=z;var U=$++;T[U]==null&&(T[U]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
|
+"line"),S==0&&T[U].setAttribute("shape-rendering","crispEdges"));Q=T[U];Q.setAttribute("x1",H.positionScreen.x);Q.setAttribute("y1",H.positionScreen.y);Q.setAttribute("x2",N.positionScreen.x);Q.setAttribute("y2",N.positionScreen.y);W instanceof THREE.LineBasicMaterial&&(Q.setAttribute("style","fill: none; stroke: "+W.color.getContextStyle()+"; stroke-width: "+W.linewidth+"; stroke-opacity: "+W.opacity+"; stroke-linecap: "+W.linecap+"; stroke-linejoin: "+W.linejoin),t.appendChild(Q))}}}else if(J instanceof
|
|
|
|
+THREE.RenderableFace3){if(v=J.v1,z=J.v2,y=J.v3,v.positionScreen.x*=o,v.positionScreen.y*=-x,z.positionScreen.x*=o,z.positionScreen.y*=-x,y.positionScreen.x*=o,y.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),E.intersects(F)){w=0;for(G=J.meshMaterials.length;w<G;)if(W=J.meshMaterials[w++],W instanceof THREE.MeshFaceMaterial){H=0;for(N=J.faceMaterials.length;H<N;)(W=J.faceMaterials[H++])&&
|
|
|
|
+W.opacity!=0&&c(v,z,y,J,W,b)}else W&&W.opacity!=0&&c(v,z,y,J,W,b)}}else if(J instanceof THREE.RenderableFace4&&(v=J.v1,z=J.v2,y=J.v3,A=J.v4,v.positionScreen.x*=o,v.positionScreen.y*=-x,z.positionScreen.x*=o,z.positionScreen.y*=-x,y.positionScreen.x*=o,y.positionScreen.y*=-x,A.positionScreen.x*=o,A.positionScreen.y*=-x,F.addPoint(v.positionScreen.x,v.positionScreen.y),F.addPoint(z.positionScreen.x,z.positionScreen.y),F.addPoint(y.positionScreen.x,y.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),
|
|
|
|
+E.intersects(F))){w=0;for(G=J.meshMaterials.length;w<G;)if(W=J.meshMaterials[w++],W instanceof THREE.MeshFaceMaterial){H=0;for(N=J.faceMaterials.length;H<N;)(W=J.faceMaterials[H++])&&W.opacity!=0&&e(v,z,y,A,J,W,b)}else W&&W.opacity!=0&&e(v,z,y,A,J,W,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 float flipEnvMap;\nuniform int combine;\n#endif",
|
|
THREE.ShaderChunk={fog_pars_fragment:"#ifdef USE_FOG\nuniform vec3 fogColor;\n#ifdef FOG_EXP2\nuniform float fogDensity;\n#else\nuniform float fogNear;\nuniform float fogFar;\n#endif\n#endif",fog_fragment:"#ifdef USE_FOG\nfloat depth = gl_FragCoord.z / gl_FragCoord.w;\n#ifdef FOG_EXP2\nconst float LOG2 = 1.442695;\nfloat fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 );\nfogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 );\n#else\nfloat fogFactor = smoothstep( fogNear, fogFar, depth );\n#endif\ngl_FragColor = mix( gl_FragColor, vec4( fogColor, gl_FragColor.w ), fogFactor );\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float reflectivity;\nuniform samplerCube envMap;\nuniform float flipEnvMap;\nuniform int combine;\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
envmap_fragment:"#ifdef USE_ENVMAP\nvec4 cubeColor = textureCube( envMap, vec3( flipEnvMap * vReflect.x, vReflect.yz ) );\nif ( combine == 1 ) {\ngl_FragColor.xyz = mix( gl_FragColor.xyz, cubeColor.xyz, reflectivity );\n} else {\ngl_FragColor.xyz = gl_FragColor.xyz * cubeColor.xyz;\n}\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\nvarying vec3 vReflect;\nuniform float refractionRatio;\nuniform bool useRefract;\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\nvec4 mPosition = objectMatrix * vec4( position, 1.0 );\nvec3 nWorld = mat3( objectMatrix[ 0 ].xyz, objectMatrix[ 1 ].xyz, objectMatrix[ 2 ].xyz ) * normal;\nif ( useRefract ) {\nvReflect = refract( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ), refractionRatio );\n} else {\nvReflect = reflect( normalize( mPosition.xyz - cameraPosition ), normalize( nWorld.xyz ) );\n}\n#endif",
|
|
map_particle_pars_fragment:"#ifdef USE_MAP\nuniform sampler2D map;\n#endif",map_particle_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, gl_PointCoord );\n#endif",map_pars_vertex:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform vec4 offsetRepeat;\n#endif",map_pars_fragment:"#ifdef USE_MAP\nvarying vec2 vUv;\nuniform sampler2D map;\n#endif",map_vertex:"#ifdef USE_MAP\nvUv = uv * offsetRepeat.zw + offsetRepeat.xy;\n#endif",map_fragment:"#ifdef USE_MAP\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\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",
|
|
@@ -221,122 +221,122 @@ 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.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,
|
|
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}"}};
|
|
"}"].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,c,e){var f,k,h,m=b.vertices,n=m.length,t=b.colors,p=t.length,u=b.__vertexArray,w=b.__colorArray,v=b.__sortArray,x=b.__dirtyVertices,H=b.__dirtyColors,y=b.__webglCustomAttributes,A,z;if(y)for(A in y)y[A].offset=0;if(e.sortParticles){Ca.multiplySelf(e.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Da.copy(k),Ca.multiplyVector3(Da),v[f]=[Da.z,f];v.sort(function(b,c){return c[0]-b[0]});for(f=0;f<n;f++)k=m[v[f][1]].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;
|
|
|
|
-for(f=0;f<p;f++)h=f*3,color=t[v[f][1]],w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(y)for(A in y){f=y[A];t=f.value.length;for(h=0;h<t;h++){index=v[h][1];p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[index];f.size===2?(f.array[p]=z.x,f.array[p+1]=z.y):f.size===3?f.type==="c"?(f.array[p]=z.r,f.array[p+1]=z.g,f.array[p+2]=z.b):(f.array[p]=z.x,f.array[p+1]=z.y,f.array[p+2]=z.z):(f.array[p]=
|
|
|
|
-z.x,f.array[p+1]=z.y,f.array[p+2]=z.z,f.array[p+3]=z.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(H)for(f=0;f<p;f++)color=t[f],h=f*3,w[h]=color.r,w[h+1]=color.g,w[h+2]=color.b;if(y)for(A in y)if(f=y[A],f.__original.needsUpdate){t=f.value.length;for(h=0;h<t;h++){p=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[p]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[h];f.size===2?(f.array[p]=
|
|
|
|
-z.x,f.array[p+1]=z.y):f.size===3?f.type==="c"?(f.array[p]=z.r,f.array[p+1]=z.g,f.array[p+2]=z.b):(f.array[p]=z.x,f.array[p+1]=z.y,f.array[p+2]=z.z):(f.array[p]=z.x,f.array[p+1]=z.y,f.array[p+2]=z.z,f.array[p+3]=z.w)}f.offset+=f.size}}}if(x||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,u,c);if(H||e.sortParticles)o.bindBuffer(o.ARRAY_BUFFER,b.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,w,c);if(y)for(A in y)if(f=y[A],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,h){f.program||W.initMaterial(f,c,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(W.maxMorphTargets);for(var k=0,m=W.maxMorphTargets;k<m;k++)h.__webglMorphTargetInfluences[k]=0}var n=!1,k=f.program,m=k.uniforms,p=f.uniforms;k!=T&&(o.useProgram(k),T=k,n=!0);if(f.id!=fa)fa=f.id,n=!0;if(n){o.uniformMatrix4fv(m.projectionMatrix,!1,Fa);if(e&&f.fog)if(p.fogColor.value=e.color,e instanceof
|
|
|
|
-THREE.Fog)p.fogNear.value=e.near,p.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)p.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var t,u,w=0,v=0,x=0,H,y,z,A=Ga,ea=A.directional.colors,Z=A.directional.positions,E=A.point.colors,F=A.point.positions,D=A.point.distances,G=0,ka=0,e=t=z=0,n=c.length;e<n;e++)if(t=c[e],u=t.color,H=t.position,y=t.intensity,z=t.distance,t instanceof THREE.AmbientLight)w+=u.r,v+=u.g,x+=u.b;else if(t instanceof
|
|
|
|
-THREE.DirectionalLight)z=G*3,ea[z]=u.r*y,ea[z+1]=u.g*y,ea[z+2]=u.b*y,Z[z]=H.x,Z[z+1]=H.y,Z[z+2]=H.z,G+=1;else if(t instanceof THREE.SpotLight)z=G*3,ea[z]=u.r*y,ea[z+1]=u.g*y,ea[z+2]=u.b*y,u=1/H.length(),Z[z]=H.x*u,Z[z+1]=H.y*u,Z[z+2]=H.z*u,G+=1;else if(t instanceof THREE.PointLight)t=ka*3,E[t]=u.r*y,E[t+1]=u.g*y,E[t+2]=u.b*y,F[t]=H.x,F[t+1]=H.y,F[t+2]=H.z,D[ka]=z,ka+=1;e=G*3;for(n=ea.length;e<n;e++)ea[e]=0;e=ka*3;for(n=E.length;e<n;e++)E[e]=0;A.point.length=ka;A.directional.length=G;A.ambient[0]=
|
|
|
|
-w;A.ambient[1]=v;A.ambient[2]=x;c=Ga;p.enableLighting.value=c.directional.length+c.point.length;p.ambientLightColor.value=c.ambient;p.directionalLightColor.value=c.directional.colors;p.directionalLightDirection.value=c.directional.positions;p.pointLightColor.value=c.point.colors;p.pointLightPosition.value=c.point.positions;p.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)p.diffuse.value=
|
|
|
|
-f.color,p.opacity.value=f.opacity,(p.map.texture=f.map)&&p.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),p.lightMap.texture=f.lightMap,p.envMap.texture=f.envMap,p.flipEnvMap.value=f.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,p.reflectivity.value=f.reflectivity,p.refractionRatio.value=f.refractionRatio,p.combine.value=f.combine,p.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)p.diffuse.value=
|
|
|
|
-f.color,p.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)p.psColor.value=f.color,p.opacity.value=f.opacity,p.size.value=f.size,p.scale.value=ya.height/2,p.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)p.ambient.value=f.ambient,p.specular.value=f.specular,p.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)p.mNear.value=b.near,p.mFar.value=b.far,p.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)p.opacity.value=
|
|
|
|
-f.opacity;if(h.receiveShadow&&!f._shadowPass&&p.shadowMatrix){for(c=0;c<pa.length;c++)p.shadowMatrix.value[c]=pa[c],p.shadowMap.texture[c]=W.shadowMap[c];p.shadowDarkness.value=W.shadowMapDarkness;p.shadowBias.value=W.shadowMapBias}c=f.uniformsList;p=0;for(e=c.length;p<e;p++)if(v=k.uniforms[c[p][1]])if(w=c[p][0],x=w.type,n=w.value,x=="i")o.uniform1i(v,n);else if(x=="f")o.uniform1f(v,n);else if(x=="v2")o.uniform2f(v,n.x,n.y);else if(x=="v3")o.uniform3f(v,n.x,n.y,n.z);else if(x=="v4")o.uniform4f(v,
|
|
|
|
-n.x,n.y,n.z,n.w);else if(x=="c")o.uniform3f(v,n.r,n.g,n.b);else if(x=="fv1")o.uniform1fv(v,n);else if(x=="fv")o.uniform3fv(v,n);else if(x=="v3v"){if(!w._array)w._array=new Float32Array(3*n.length);x=0;for(H=n.length;x<H;x++)A=x*3,w._array[A]=n[x].x,w._array[A+1]=n[x].y,w._array[A+2]=n[x].z;o.uniform3fv(v,w._array)}else if(x=="m4"){if(!w._array)w._array=new Float32Array(16);n.flattenToArray(w._array);o.uniformMatrix4fv(v,!1,w._array)}else if(x=="m4v"){if(!w._array)w._array=new Float32Array(16*n.length);
|
|
|
|
-x=0;for(H=n.length;x<H;x++)n[x].flattenToArrayOffset(w._array,x*16);o.uniformMatrix4fv(v,!1,w._array)}else if(x=="t"){if(o.uniform1i(v,n),v=w.texture)if(v.image instanceof Array&&v.image.length==6){if(w=v,w.image.length==6)if(w.needsUpdate){if(!w.image.__webglTextureCube)w.image.__webglTextureCube=o.createTexture();o.activeTexture(o.TEXTURE0+n);o.bindTexture(o.TEXTURE_CUBE_MAP,w.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,
|
|
|
|
-w.image[n]);B(o.TEXTURE_CUBE_MAP,w,w.image[0]);w.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,w.image.__webglTextureCube)}else v instanceof THREE.WebGLRenderTargetCube?(w=v,o.activeTexture(o.TEXTURE0+n),o.bindTexture(o.TEXTURE_CUBE_MAP,w.__webglTexture)):M(v,n)}else if(x=="tv"){if(!w._array){w._array=[];x=0;for(H=w.texture.length;x<H;x++)w._array[x]=n+x}o.uniform1iv(v,w._array);x=0;for(H=w.texture.length;x<H;x++)(v=w.texture[x])&&M(v,w._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,Ea);f.skinning&&(o.uniformMatrix4fv(m.cameraInverseMatrix,!1,Ea),o.uniformMatrix4fv(m.boneGlobalMatrices,!1,h.boneMatrices))}o.uniformMatrix4fv(m.modelViewMatrix,
|
|
|
|
-!1,h._modelViewMatrixArray);m.normalMatrix&&o.uniformMatrix3fv(m.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&m.objectMatrix!==null&&o.uniformMatrix4fv(m.objectMatrix,!1,h._objectMatrixArray);return k}function f(b,c,f,h,k,m){if(h.opacity!=0){var n,f=e(b,c,f,h,m),b=f.attributes,c=!1,f=k.id*16777215+f.id*2+(h.wireframe?1:0);f!=oa&&(oa=f,c=!0);if(!h.morphTargets&&b.position>=0)c&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),
|
|
|
|
-o.vertexAttribPointer(b.position,3,o.FLOAT,!1,0,0));else if(m.morphTargetBase){f=h.program.attributes;m.morphTargetBase!==-1?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[m.morphTargetBase]),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0)):f.position>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglVertexBuffer),o.vertexAttribPointer(f.position,3,o.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var p=0,t=m.morphTargetForcedOrder,u=m.morphTargetInfluences;p<h.numSupportedMorphTargets&&
|
|
|
|
-p<t.length;)o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[t[p]]),o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[p]=u[t[p]],p++;else{var t=[],w=-1,x=0,u=m.morphTargetInfluences,v,H=u.length,p=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);p<h.numSupportedMorphTargets;){for(v=0;v<H;v++)!t[v]&&u[v]>w&&(x=v,w=u[x]);o.bindBuffer(o.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[x]);o.vertexAttribPointer(f["morphTarget"+p],3,o.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[p]=
|
|
|
|
-w;t[x]=1;w=-1;p++}}h.program.uniforms.morphTargetInfluences!==null&&o.uniform1fv(h.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(k.__webglCustomAttributes)for(n in k.__webglCustomAttributes)b[n]>=0&&(f=k.__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,k.__webglColorBuffer),o.vertexAttribPointer(b.color,3,o.FLOAT,!1,0,0));b.normal>=0&&(o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
-k.__webglNormalBuffer),o.vertexAttribPointer(b.normal,3,o.FLOAT,!1,0,0));b.tangent>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglTangentBuffer),o.vertexAttribPointer(b.tangent,4,o.FLOAT,!1,0,0));b.uv>=0&&(k.__webglUVBuffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUVBuffer),o.vertexAttribPointer(b.uv,2,o.FLOAT,!1,0,0),o.enableVertexAttribArray(b.uv)):o.disableVertexAttribArray(b.uv));b.uv2>=0&&(k.__webglUV2Buffer?(o.bindBuffer(o.ARRAY_BUFFER,k.__webglUV2Buffer),o.vertexAttribPointer(b.uv2,2,o.FLOAT,!1,0,
|
|
|
|
-0),o.enableVertexAttribArray(b.uv2)):o.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexABuffer),o.vertexAttribPointer(b.skinVertexA,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),o.vertexAttribPointer(b.skinVertexB,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),o.vertexAttribPointer(b.skinIndex,4,o.FLOAT,!1,0,0),o.bindBuffer(o.ARRAY_BUFFER,
|
|
|
|
-k.__webglSkinWeightsBuffer),o.vertexAttribPointer(b.skinWeight,4,o.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(h.wireframe?(o.lineWidth(h.wireframeLinewidth),c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer),o.drawElements(o.LINES,k.__webglLineCount,o.UNSIGNED_SHORT,0)):(c&&o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),o.drawElements(o.TRIANGLES,k.__webglFaceCount,o.UNSIGNED_SHORT,0)),W.info.render.calls++,W.info.render.vertices+=k.__webglFaceCount,W.info.render.faces+=k.__webglFaceCount/
|
|
|
|
-3):m instanceof THREE.Line?(m=m.type==THREE.LineStrip?o.LINE_STRIP:o.LINES,o.lineWidth(h.linewidth),o.drawArrays(m,0,k.__webglLineCount),W.info.render.calls++):m instanceof THREE.ParticleSystem?(o.drawArrays(o.POINTS,0,k.__webglParticleCount),W.info.render.calls++):m instanceof THREE.Ribbon&&(o.drawArrays(o.TRIANGLE_STRIP,0,k.__webglVertexCount),W.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,k,h,m,n,p,t,u,w,x,v=b.count*3;for(x=0;x<v;x+=9)e=b.normalArray,f=e[x],k=e[x+1],h=e[x+2],m=e[x+3],p=e[x+4],u=e[x+5],n=e[x+6],t=e[x+7],w=e[x+8],f=(f+m+n)/
|
|
|
|
-3,k=(k+p+t)/3,h=(h+u+w)/3,e[x]=f,e[x+1]=k,e[x+2]=h,e[x+3]=f,e[x+4]=k,e[x+5]=h,e[x+6]=f,e[x+7]=k,e[x+8]=h}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(ja!=b.doubleSided)b.doubleSided?o.disable(o.CULL_FACE):o.enable(o.CULL_FACE),ja=b.doubleSided;if(la!=b.flipSided)b.flipSided?o.frontFace(o.CW):o.frontFace(o.CCW),la=b.flipSided}
|
|
|
|
-function m(b){X!=b&&(b?o.enable(o.DEPTH_TEST):o.disable(o.DEPTH_TEST),X=b)}function n(b){V!=b&&(o.depthMask(b),V=b)}function t(b,c,e){aa!=b&&(b?o.enable(o.POLYGON_OFFSET_FILL):o.disable(o.POLYGON_OFFSET_FILL),aa=b);if(b&&(ia!=c||ra!=e))o.polygonOffset(c,e),ia=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 v(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 p(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,
|
|
|
|
-k=b.opaque,h=b.transparent;h.count=0;b=k.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?p(h,e):p(k,e)}function w(b){var c,e,f,k,h=b.object,m=b.buffer,n=b.opaque,o=b.transparent;o.count=0;b=n.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=m.materials.length;c<e;c++)(k=m.materials[c])&&(k.transparent?p(o,k):p(n,k))}else(k=c)&&(k.transparent?p(o,k):p(n,k))}function z(b,c){return c.z-b.z}function y(b){var c,n,p,t=0,
|
|
|
|
-w,x,H,y,z=b.lights;ua||(ua=new THREE.PerspectiveCamera(W.shadowCameraFov,W.shadowMapWidth/W.shadowMapHeight,W.shadowCameraNear,W.shadowCameraFar));c=0;for(n=z.length;c<n;c++)if(p=z[c],p instanceof THREE.SpotLight&&p.castShadow){fa=-1;W.shadowMap[t]||(W.shadowMap[t]=new THREE.WebGLRenderTarget(W.shadowMapWidth,W.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));pa[t]||(pa[t]=new THREE.Matrix4);w=W.shadowMap[t];x=pa[t];ua.position.copy(p.position);
|
|
|
|
-ua.lookAt(p.target.position);ua.update(void 0,!0);b.update(void 0,!1,ua);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(ua.projectionMatrix);x.multiplySelf(ua.matrixWorldInverse);ua.matrixWorldInverse.flattenToArray(Ea);ua.projectionMatrix.flattenToArray(Fa);Ca.multiply(ua.projectionMatrix,ua.matrixWorldInverse);u(Ca);W.initWebGLObjects(b);U(w);o.clearColor(1,1,1,1);W.clear();o.clearColor(ka.r,ka.g,ka.b,O);x=b.__webglObjects.length;p=b.__webglObjectsImmediate.length;for(w=0;w<x;w++)H=
|
|
|
|
-b.__webglObjects[w],y=H.object,y.visible&&y.castShadow?!(y instanceof THREE.Mesh)||!y.frustumCulled||v(y)?(y.matrixWorld.flattenToArray(y._objectMatrixArray),E(y,ua,!1),H.render=!0):H.render=!1:H.render=!1;m(!0);L(THREE.NormalBlending);for(w=0;w<x;w++)if(H=b.__webglObjects[w],H.render)y=H.object,buffer=H.buffer,k(y),H=y.customDepthMaterial?y.customDepthMaterial:y.geometry.morphTargets.length?Aa:Ha,f(ua,z,null,H,buffer,y);for(w=0;w<p;w++)H=b.__webglObjectsImmediate[w],y=H.object,y.visible&&y.castShadow&&
|
|
|
|
-(y.matrixAutoUpdate&&y.matrixWorld.flattenToArray(y._objectMatrixArray),oa=-1,E(y,ua,!1),k(y),program=e(ua,z,null,Ha,y),y.immediateRenderCallback?y.immediateRenderCallback(program,o,wa):y.render(function(b){h(b,program,Ha.shading)}));t++}}function A(b,c){var e,f,k;e=R.attributes;var h=R.uniforms,m=qa/na,n,p=[],t=na*0.5,w=qa*0.5,u=!0;o.useProgram(R.program);T=R.program;oa=X=da=-1;Ka||(o.enableVertexAttribArray(R.attributes.position),o.enableVertexAttribArray(R.attributes.uv),Ka=!0);o.disable(o.CULL_FACE);
|
|
|
|
-o.enable(o.BLEND);o.depthMask(!0);o.bindBuffer(o.ARRAY_BUFFER,R.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,R.elementBuffer);o.uniformMatrix4fv(h.projectionMatrix,!1,Fa);o.activeTexture(o.TEXTURE0);o.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)if(k=b.__webglSprites[e],k.visible&&k.opacity!=0)k.useScreenCoordinates?k.z=-k.position.z:(k._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,
|
|
|
|
-k.matrixWorld,k._modelViewMatrixArray),k.z=-k._modelViewMatrix.n34);b.__webglSprites.sort(z);e=0;for(f=b.__webglSprites.length;e<f;e++)k=b.__webglSprites[e],k.visible&&k.opacity!=0&&k.map&&k.map.image&&k.map.image.width&&(k.useScreenCoordinates?(o.uniform1i(h.useScreenCoordinates,1),o.uniform3f(h.screenPosition,(k.position.x-t)/t,(w-k.position.y)/w,Math.max(0,Math.min(1,k.position.z)))):(o.uniform1i(h.useScreenCoordinates,0),o.uniform1i(h.affectedByDistance,k.affectedByDistance?1:0),o.uniformMatrix4fv(h.modelViewMatrix,
|
|
|
|
-!1,k._modelViewMatrixArray)),n=k.map.image.width/(k.scaleByViewport?qa:1),p[0]=n*m*k.scale.x,p[1]=n*k.scale.y,o.uniform2f(h.uvScale,k.uvScale.x,k.uvScale.y),o.uniform2f(h.uvOffset,k.uvOffset.x,k.uvOffset.y),o.uniform2f(h.alignment,k.alignment.x,k.alignment.y),o.uniform1f(h.opacity,k.opacity),o.uniform3f(h.color,k.color.r,k.color.g,k.color.b),o.uniform1f(h.rotation,k.rotation),o.uniform2fv(h.scale,p),k.mergeWith3D&&!u?(o.enable(o.DEPTH_TEST),u=!0):!k.mergeWith3D&&u&&(o.disable(o.DEPTH_TEST),u=!1),
|
|
|
|
-L(k.blending),M(k.map,0),o.drawElements(o.TRIANGLES,6,o.UNSIGNED_SHORT,0));o.enable(o.CULL_FACE);o.enable(o.DEPTH_TEST);o.depthMask(V)}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,k;k=b.__materials;b=0;for(e=k.length;b<e;b++)if(f=k[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}
|
|
|
|
-function D(b){var c,e,f,k;k=b.__materials;b=0;for(e=k.length;b<e;b++)if(f=k[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function G(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function K(b){function c(b){var k=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?k.push("undefined"):k.push(b[e].id);return k.join("_")}var e,f,k,h,m,n,o,p,t={},w=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};k=0;for(h=b.faces.length;k<h;k++)m=b.faces[k],n=m.materials,
|
|
|
|
-o=c(n),t[o]==void 0&&(t[o]={hash:o,counter:0}),p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:w}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[p].vertices+m>65535&&(t[o].counter+=1,p=t[o].hash+"_"+t[o].counter,b.geometryGroups[p]==void 0&&(b.geometryGroups[p]={faces:[],materials:n,vertices:0,numMorphTargets:w})),b.geometryGroups[p].faces.push(k),b.geometryGroups[p].vertices+=m;b.geometryGroupsList=[];for(var u in b.geometryGroups)b.geometryGroups[u].id=
|
|
|
|
-ca++,b.geometryGroupsList.push(b.geometryGroups[u])}function N(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function L(b){if(b!=da){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)}da=b}}function B(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,Q(c.magFilter)),o.texParameteri(b,o.TEXTURE_MIN_FILTER,Q(c.minFilter)))}function M(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=o.createTexture(),W.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);
|
|
|
|
-B(o.TEXTURE_2D,b,b.image);b.needsUpdate=!1}else o.activeTexture(o.TEXTURE0+c),o.bindTexture(o.TEXTURE_2D,b.__webglTexture)}function U(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);B(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),B(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,k;b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,e=b.width,b=b.height,k=f=0):(c=null,e=na,b=qa,f=ma,k=ga);c!=ha&&(o.bindFramebuffer(o.FRAMEBUFFER,
|
|
|
|
-c),o.viewport(f,k,e,b),ha=c)}function I(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 S(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 Q(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,$=[],T=null,ha=null,fa=-1,oa=null,ca=0,ja=null,la=null,da=null,X=null,V=null,aa=null,ia=null,ra=null,ma=0,ga=0,na=0,qa=0,wa=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Fa=new Float32Array(16),
|
|
|
|
-Ea=new Float32Array(16),Da=new THREE.Vector4,Ga={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},b=b||{},ya=b.canvas!==void 0?b.canvas:document.createElement("canvas"),H=b.stencil!==void 0?b.stencil:!0,Z=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,ea=b.antialias!==void 0?b.antialias:!1,ka=b.clearColor!==void 0?new THREE.Color(b.clearColor):new THREE.Color(0),O=b.clearAlpha!==void 0?b.clearAlpha:0,va=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=ya;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 ua,pa=[],
|
|
|
|
-b=THREE.ShaderLib.depthRGBA,za=THREE.UniformsUtils.clone(b.uniforms),Ha=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:za}),Aa=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:za,morphTargets:!0});Ha._shadowPass=!0;Aa._shadowPass=!0;try{if(!(o=ya.getContext("experimental-webgl",{antialias:ea,stencil:H,preserveDrawingBuffer:Z})))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(sa){console.error(sa)}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(ka.r,ka.g,ka.b,O);this.context=o;var Ia=o.getParameter(o.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,R=
|
|
|
|
-{};R.vertices=new Float32Array(16);R.faces=new Uint16Array(6);H=0;R.vertices[H++]=-1;R.vertices[H++]=-1;R.vertices[H++]=0;R.vertices[H++]=1;R.vertices[H++]=1;R.vertices[H++]=-1;R.vertices[H++]=1;R.vertices[H++]=1;R.vertices[H++]=1;R.vertices[H++]=1;R.vertices[H++]=1;R.vertices[H++]=0;R.vertices[H++]=-1;R.vertices[H++]=1;R.vertices[H++]=0;H=R.vertices[H++]=0;R.faces[H++]=0;R.faces[H++]=1;R.faces[H++]=2;R.faces[H++]=0;R.faces[H++]=2;R.faces[H++]=3;R.vertexBuffer=o.createBuffer();R.elementBuffer=o.createBuffer();
|
|
|
|
-o.bindBuffer(o.ARRAY_BUFFER,R.vertexBuffer);o.bufferData(o.ARRAY_BUFFER,R.vertices,o.STATIC_DRAW);o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,R.elementBuffer);o.bufferData(o.ELEMENT_ARRAY_BUFFER,R.faces,o.STATIC_DRAW);R.program=o.createProgram();o.attachShader(R.program,S("fragment",THREE.ShaderLib.sprite.fragmentShader));o.attachShader(R.program,S("vertex",THREE.ShaderLib.sprite.vertexShader));o.linkProgram(R.program);R.attributes={};R.uniforms={};R.attributes.position=o.getAttribLocation(R.program,"position");
|
|
|
|
-R.attributes.uv=o.getAttribLocation(R.program,"uv");R.uniforms.uvOffset=o.getUniformLocation(R.program,"uvOffset");R.uniforms.uvScale=o.getUniformLocation(R.program,"uvScale");R.uniforms.rotation=o.getUniformLocation(R.program,"rotation");R.uniforms.scale=o.getUniformLocation(R.program,"scale");R.uniforms.alignment=o.getUniformLocation(R.program,"alignment");R.uniforms.color=o.getUniformLocation(R.program,"color");R.uniforms.map=o.getUniformLocation(R.program,"map");R.uniforms.opacity=o.getUniformLocation(R.program,
|
|
|
|
-"opacity");R.uniforms.useScreenCoordinates=o.getUniformLocation(R.program,"useScreenCoordinates");R.uniforms.affectedByDistance=o.getUniformLocation(R.program,"affectedByDistance");R.uniforms.screenPosition=o.getUniformLocation(R.program,"screenPosition");R.uniforms.modelViewMatrix=o.getUniformLocation(R.program,"modelViewMatrix");R.uniforms.projectionMatrix=o.getUniformLocation(R.program,"projectionMatrix");var Ka=!1;this.setSize=function(b,c){ya.width=b;ya.height=c;this.setViewport(0,0,ya.width,
|
|
|
|
-ya.height)};this.setViewport=function(b,c,e,f){ma=b;ga=c;na=e;qa=f;o.viewport(ma,ga,na,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){ka.setHex(b);O=c;o.clearColor(ka.r,ka.g,ka.b,O)};this.setClearColor=function(b,c){ka.copy(b);O=c;o.clearColor(ka.r,ka.g,ka.b,O)};this.getClearColor=function(){return ka};this.getClearAlpha=function(){return O};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]);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,c,e,f){var k,h,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 p=THREE.ShaderLib[n];b.uniforms=
|
|
|
|
-THREE.UniformsUtils.clone(p.uniforms);b.vertexShader=p.vertexShader;b.fragmentShader=p.fragmentShader}var t,w,u;t=u=p=0;for(w=c.length;t<w;t++)m=c[t],m instanceof THREE.SpotLight&&u++,m instanceof THREE.DirectionalLight&&u++,m instanceof THREE.PointLight&&p++;p+u<=va?t=u:(t=Math.ceil(va*u/(p+u)),p=va-t);m={directional:t,point:p};p=u=0;for(t=c.length;p<t;p++)w=c[p],w instanceof THREE.SpotLight&&w.castShadow&&u++;var x=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)x=f.bones.length;var v;a:{t=b.fragmentShader;
|
|
|
|
-w=b.vertexShader;var p=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:x,shadowMapEnabled:this.shadowMapEnabled&&f.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:u,
|
|
|
|
-alphaTest:b.alphaTest},H,f=[];n?f.push(n):(f.push(t),f.push(w));for(H in e)f.push(H),f.push(e[H]);n=f.join();H=0;for(f=$.length;H<f;H++)if($[H].code==n){v=$[H].program;break a}H=o.createProgram();f=[Ia?"#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");
|
|
|
|
|
|
+THREE.WebGLRenderer=function(b){function c(b,c,e){var f,k,h,m=b.vertices,n=m.length,t=b.colors,o=t.length,u=b.__vertexArray,v=b.__colorArray,w=b.__sortArray,x=b.__dirtyVertices,L=b.__dirtyColors,y=b.__webglCustomAttributes,A,z;if(y)for(A in y)y[A].offset=0;if(e.sortParticles){Ca.multiplySelf(e.matrixWorld);for(f=0;f<n;f++)k=m[f].position,Da.copy(k),Ca.multiplyVector3(Da),w[f]=[Da.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,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;
|
|
|
|
+for(f=0;f<o;f++)h=f*3,color=t[w[f][1]],v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(y)for(A in y){f=y[A];t=f.value.length;for(h=0;h<t;h++){index=w[h][1];o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[index]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[index];f.size===2?(f.array[o]=z.x,f.array[o+1]=z.y):f.size===3?f.type==="c"?(f.array[o]=z.r,f.array[o+1]=z.g,f.array[o+2]=z.b):(f.array[o]=z.x,f.array[o+1]=z.y,f.array[o+2]=z.z):(f.array[o]=
|
|
|
|
+z.x,f.array[o+1]=z.y,f.array[o+2]=z.z,f.array[o+3]=z.w)}f.offset+=f.size}}}else{if(x)for(f=0;f<n;f++)k=m[f].position,h=f*3,u[h]=k.x,u[h+1]=k.y,u[h+2]=k.z;if(L)for(f=0;f<o;f++)color=t[f],h=f*3,v[h]=color.r,v[h+1]=color.g,v[h+2]=color.b;if(y)for(A in y)if(f=y[A],f.__original.needsUpdate){t=f.value.length;for(h=0;h<t;h++){o=f.offset;if(f.size===1){if(f.boundTo===void 0||f.boundTo==="vertices")f.array[o]=f.value[h]}else{if(f.boundTo===void 0||f.boundTo==="vertices")z=f.value[h];f.size===2?(f.array[o]=
|
|
|
|
+z.x,f.array[o+1]=z.y):f.size===3?f.type==="c"?(f.array[o]=z.r,f.array[o+1]=z.g,f.array[o+2]=z.b):(f.array[o]=z.x,f.array[o+1]=z.y,f.array[o+2]=z.z):(f.array[o]=z.x,f.array[o+1]=z.y,f.array[o+2]=z.z,f.array[o+3]=z.w)}f.offset+=f.size}}}if(x||e.sortParticles)p.bindBuffer(p.ARRAY_BUFFER,b.__webglVertexBuffer),p.bufferData(p.ARRAY_BUFFER,u,c);if(L||e.sortParticles)p.bindBuffer(p.ARRAY_BUFFER,b.__webglColorBuffer),p.bufferData(p.ARRAY_BUFFER,v,c);if(y)for(A in y)if(f=y[A],f.__original.needsUpdate||e.sortParticles)p.bindBuffer(p.ARRAY_BUFFER,
|
|
|
|
+f.buffer),p.bufferData(p.ARRAY_BUFFER,f.array,c)}function e(b,c,e,f,h){f.program||S.initMaterial(f,c,e,h);if(f.morphTargets&&!h.__webglMorphTargetInfluences){h.__webglMorphTargetInfluences=new Float32Array(S.maxMorphTargets);for(var k=0,m=S.maxMorphTargets;k<m;k++)h.__webglMorphTargetInfluences[k]=0}var n=!1,k=f.program,m=k.uniforms,o=f.uniforms;k!=ea&&(p.useProgram(k),ea=k,n=!0);if(f.id!=ha)ha=f.id,n=!0;if(n){p.uniformMatrix4fv(m.projectionMatrix,!1,Ga);if(e&&f.fog)if(o.fogColor.value=e.color,e instanceof
|
|
|
|
+THREE.Fog)o.fogNear.value=e.near,o.fogFar.value=e.far;else if(e instanceof THREE.FogExp2)o.fogDensity.value=e.density;if(f instanceof THREE.MeshPhongMaterial||f instanceof THREE.MeshLambertMaterial||f.lights){for(var t,u,v=0,w=0,x=0,y,A,z,M=za,fa=M.directional.colors,F=M.directional.positions,E=M.point.colors,C=M.point.positions,G=M.point.distances,qa=0,la=0,e=t=z=0,n=c.length;e<n;e++)if(t=c[e],u=t.color,y=t.position,A=t.intensity,z=t.distance,t instanceof THREE.AmbientLight)v+=u.r,w+=u.g,x+=u.b;
|
|
|
|
+else if(t instanceof THREE.DirectionalLight)z=qa*3,fa[z]=u.r*A,fa[z+1]=u.g*A,fa[z+2]=u.b*A,F[z]=y.x,F[z+1]=y.y,F[z+2]=y.z,qa+=1;else if(t instanceof THREE.SpotLight)z=qa*3,fa[z]=u.r*A,fa[z+1]=u.g*A,fa[z+2]=u.b*A,u=1/y.length(),F[z]=y.x*u,F[z+1]=y.y*u,F[z+2]=y.z*u,qa+=1;else if(t instanceof THREE.PointLight)t=la*3,E[t]=u.r*A,E[t+1]=u.g*A,E[t+2]=u.b*A,C[t]=y.x,C[t+1]=y.y,C[t+2]=y.z,G[la]=z,la+=1;e=qa*3;for(n=fa.length;e<n;e++)fa[e]=0;e=la*3;for(n=E.length;e<n;e++)E[e]=0;M.point.length=la;M.directional.length=
|
|
|
|
+qa;M.ambient[0]=v;M.ambient[1]=w;M.ambient[2]=x;c=za;o.enableLighting.value=c.directional.length+c.point.length;o.ambientLightColor.value=c.ambient;o.directionalLightColor.value=c.directional.colors;o.directionalLightDirection.value=c.directional.positions;o.pointLightColor.value=c.point.colors;o.pointLightPosition.value=c.point.positions;o.pointLightDistance.value=c.point.distances}if(f instanceof THREE.MeshBasicMaterial||f instanceof THREE.MeshLambertMaterial||f instanceof THREE.MeshPhongMaterial)o.diffuse.value=
|
|
|
|
+f.color,o.opacity.value=f.opacity,(o.map.texture=f.map)&&o.offsetRepeat.value.set(f.map.offset.x,f.map.offset.y,f.map.repeat.x,f.map.repeat.y),o.lightMap.texture=f.lightMap,o.envMap.texture=f.envMap,o.flipEnvMap.value=f.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,o.reflectivity.value=f.reflectivity,o.refractionRatio.value=f.refractionRatio,o.combine.value=f.combine,o.useRefract.value=f.envMap&&f.envMap.mapping instanceof THREE.CubeRefractionMapping;if(f instanceof THREE.LineBasicMaterial)o.diffuse.value=
|
|
|
|
+f.color,o.opacity.value=f.opacity;else if(f instanceof THREE.ParticleBasicMaterial)o.psColor.value=f.color,o.opacity.value=f.opacity,o.size.value=f.size,o.scale.value=L.height/2,o.map.texture=f.map;else if(f instanceof THREE.MeshPhongMaterial)o.ambient.value=f.ambient,o.specular.value=f.specular,o.shininess.value=f.shininess;else if(f instanceof THREE.MeshDepthMaterial)o.mNear.value=b.near,o.mFar.value=b.far,o.opacity.value=f.opacity;else if(f instanceof THREE.MeshNormalMaterial)o.opacity.value=f.opacity;
|
|
|
|
+if(h.receiveShadow&&!f._shadowPass&&o.shadowMatrix){for(c=0;c<Ea.length;c++)o.shadowMatrix.value[c]=Ea[c],o.shadowMap.texture[c]=S.shadowMap[c];o.shadowDarkness.value=S.shadowMapDarkness;o.shadowBias.value=S.shadowMapBias}c=f.uniformsList;o=0;for(e=c.length;o<e;o++)if(w=k.uniforms[c[o][1]])if(v=c[o][0],x=v.type,n=v.value,x=="i")p.uniform1i(w,n);else if(x=="f")p.uniform1f(w,n);else if(x=="v2")p.uniform2f(w,n.x,n.y);else if(x=="v3")p.uniform3f(w,n.x,n.y,n.z);else if(x=="v4")p.uniform4f(w,n.x,n.y,n.z,
|
|
|
|
+n.w);else if(x=="c")p.uniform3f(w,n.r,n.g,n.b);else if(x=="fv1")p.uniform1fv(w,n);else if(x=="fv")p.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++)M=x*3,v._array[M]=n[x].x,v._array[M+1]=n[x].y,v._array[M+2]=n[x].z;p.uniform3fv(w,v._array)}else if(x=="m4"){if(!v._array)v._array=new Float32Array(16);n.flattenToArray(v._array);p.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);p.uniformMatrix4fv(w,!1,v._array)}else if(x=="t"){if(p.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=p.createTexture();p.activeTexture(p.TEXTURE0+n);p.bindTexture(p.TEXTURE_CUBE_MAP,v.image.__webglTextureCube);for(n=0;n<6;n++)p.texImage2D(p.TEXTURE_CUBE_MAP_POSITIVE_X+n,0,p.RGBA,p.RGBA,p.UNSIGNED_BYTE,v.image[n]);
|
|
|
|
+B(p.TEXTURE_CUBE_MAP,v,v.image[0]);v.needsUpdate=!1}else p.activeTexture(p.TEXTURE0+n),p.bindTexture(p.TEXTURE_CUBE_MAP,v.image.__webglTextureCube)}else w instanceof THREE.WebGLRenderTargetCube?(v=w,p.activeTexture(p.TEXTURE0+n),p.bindTexture(p.TEXTURE_CUBE_MAP,v.__webglTexture)):N(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}p.uniform1iv(w,v._array);x=0;for(y=v.texture.length;x<y;x++)(w=v.texture[x])&&N(w,v._array[x])}(f instanceof THREE.ShaderMaterial||
|
|
|
|
+f instanceof THREE.MeshPhongMaterial||f.envMap)&&m.cameraPosition!==null&&p.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&&p.uniformMatrix4fv(m.viewMatrix,!1,Fa);f.skinning&&(p.uniformMatrix4fv(m.cameraInverseMatrix,!1,Fa),p.uniformMatrix4fv(m.boneGlobalMatrices,!1,h.boneMatrices))}p.uniformMatrix4fv(m.modelViewMatrix,!1,h._modelViewMatrixArray);
|
|
|
|
+m.normalMatrix&&p.uniformMatrix3fv(m.normalMatrix,!1,h._normalMatrixArray);(f instanceof THREE.ShaderMaterial||f.envMap||f.skinning||h.receiveShadow)&&m.objectMatrix!==null&&p.uniformMatrix4fv(m.objectMatrix,!1,h._objectMatrixArray);return k}function f(b,c,f,h,k,m){if(h.opacity!=0){var n,f=e(b,c,f,h,m),b=f.attributes,c=!1,f=k.id*16777215+f.id*2+(h.wireframe?1:0);f!=ga&&(ga=f,c=!0);if(!h.morphTargets&&b.position>=0)c&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglVertexBuffer),p.vertexAttribPointer(b.position,
|
|
|
|
+3,p.FLOAT,!1,0,0));else if(m.morphTargetBase){f=h.program.attributes;m.morphTargetBase!==-1?(p.bindBuffer(p.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[m.morphTargetBase]),p.vertexAttribPointer(f.position,3,p.FLOAT,!1,0,0)):f.position>=0&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglVertexBuffer),p.vertexAttribPointer(f.position,3,p.FLOAT,!1,0,0));if(m.morphTargetForcedOrder.length)for(var o=0,t=m.morphTargetForcedOrder,u=m.morphTargetInfluences;o<h.numSupportedMorphTargets&&o<t.length;)p.bindBuffer(p.ARRAY_BUFFER,
|
|
|
|
+k.__webglMorphTargetsBuffers[t[o]]),p.vertexAttribPointer(f["morphTarget"+o],3,p.FLOAT,!1,0,0),m.__webglMorphTargetInfluences[o]=u[t[o]],o++;else{var t=[],v=-1,w=0,u=m.morphTargetInfluences,x,y=u.length,o=0;for(m.morphTargetBase!==-1&&(t[m.morphTargetBase]=!0);o<h.numSupportedMorphTargets;){for(x=0;x<y;x++)!t[x]&&u[x]>v&&(w=x,v=u[w]);p.bindBuffer(p.ARRAY_BUFFER,k.__webglMorphTargetsBuffers[w]);p.vertexAttribPointer(f["morphTarget"+o],3,p.FLOAT,!1,0,0);m.__webglMorphTargetInfluences[o]=v;t[w]=1;v=
|
|
|
|
+-1;o++}}h.program.uniforms.morphTargetInfluences!==null&&p.uniform1fv(h.program.uniforms.morphTargetInfluences,m.__webglMorphTargetInfluences)}if(c){if(k.__webglCustomAttributes)for(n in k.__webglCustomAttributes)b[n]>=0&&(f=k.__webglCustomAttributes[n],p.bindBuffer(p.ARRAY_BUFFER,f.buffer),p.vertexAttribPointer(b[n],f.size,p.FLOAT,!1,0,0));b.color>=0&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglColorBuffer),p.vertexAttribPointer(b.color,3,p.FLOAT,!1,0,0));b.normal>=0&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglNormalBuffer),
|
|
|
|
+p.vertexAttribPointer(b.normal,3,p.FLOAT,!1,0,0));b.tangent>=0&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglTangentBuffer),p.vertexAttribPointer(b.tangent,4,p.FLOAT,!1,0,0));b.uv>=0&&(k.__webglUVBuffer?(p.bindBuffer(p.ARRAY_BUFFER,k.__webglUVBuffer),p.vertexAttribPointer(b.uv,2,p.FLOAT,!1,0,0),p.enableVertexAttribArray(b.uv)):p.disableVertexAttribArray(b.uv));b.uv2>=0&&(k.__webglUV2Buffer?(p.bindBuffer(p.ARRAY_BUFFER,k.__webglUV2Buffer),p.vertexAttribPointer(b.uv2,2,p.FLOAT,!1,0,0),p.enableVertexAttribArray(b.uv2)):
|
|
|
|
+p.disableVertexAttribArray(b.uv2));h.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(p.bindBuffer(p.ARRAY_BUFFER,k.__webglSkinVertexABuffer),p.vertexAttribPointer(b.skinVertexA,4,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,k.__webglSkinVertexBBuffer),p.vertexAttribPointer(b.skinVertexB,4,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,k.__webglSkinIndicesBuffer),p.vertexAttribPointer(b.skinIndex,4,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,k.__webglSkinWeightsBuffer),
|
|
|
|
+p.vertexAttribPointer(b.skinWeight,4,p.FLOAT,!1,0,0))}m instanceof THREE.Mesh?(h.wireframe?(p.lineWidth(h.wireframeLinewidth),c&&p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,k.__webglLineBuffer),p.drawElements(p.LINES,k.__webglLineCount,p.UNSIGNED_SHORT,0)):(c&&p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,k.__webglFaceBuffer),p.drawElements(p.TRIANGLES,k.__webglFaceCount,p.UNSIGNED_SHORT,0)),S.info.render.calls++,S.info.render.vertices+=k.__webglFaceCount,S.info.render.faces+=k.__webglFaceCount/3):m instanceof THREE.Line?
|
|
|
|
+(m=m.type==THREE.LineStrip?p.LINE_STRIP:p.LINES,p.lineWidth(h.linewidth),p.drawArrays(m,0,k.__webglLineCount),S.info.render.calls++):m instanceof THREE.ParticleSystem?(p.drawArrays(p.POINTS,0,k.__webglParticleCount),S.info.render.calls++):m instanceof THREE.Ribbon&&(p.drawArrays(p.TRIANGLE_STRIP,0,k.__webglVertexCount),S.info.render.calls++)}}function h(b,c,e){if(!b.__webglVertexBuffer)b.__webglVertexBuffer=p.createBuffer();if(!b.__webglNormalBuffer)b.__webglNormalBuffer=p.createBuffer();b.hasPos&&
|
|
|
|
+(p.bindBuffer(p.ARRAY_BUFFER,b.__webglVertexBuffer),p.bufferData(p.ARRAY_BUFFER,b.positionArray,p.DYNAMIC_DRAW),p.enableVertexAttribArray(c.attributes.position),p.vertexAttribPointer(c.attributes.position,3,p.FLOAT,!1,0,0));if(b.hasNormal){p.bindBuffer(p.ARRAY_BUFFER,b.__webglNormalBuffer);if(e==THREE.FlatShading){var f,k,h,m,n,o,t,u,v,w,x=b.count*3;for(w=0;w<x;w+=9)e=b.normalArray,f=e[w],k=e[w+1],h=e[w+2],m=e[w+3],o=e[w+4],u=e[w+5],n=e[w+6],t=e[w+7],v=e[w+8],f=(f+m+n)/3,k=(k+o+t)/3,h=(h+u+v)/3,e[w]=
|
|
|
|
+f,e[w+1]=k,e[w+2]=h,e[w+3]=f,e[w+4]=k,e[w+5]=h,e[w+6]=f,e[w+7]=k,e[w+8]=h}p.bufferData(p.ARRAY_BUFFER,b.normalArray,p.DYNAMIC_DRAW);p.enableVertexAttribArray(c.attributes.normal);p.vertexAttribPointer(c.attributes.normal,3,p.FLOAT,!1,0,0)}p.drawArrays(p.TRIANGLES,0,b.count);b.count=0}function k(b){if(na!=b.doubleSided)b.doubleSided?p.disable(p.CULL_FACE):p.enable(p.CULL_FACE),na=b.doubleSided;if(aa!=b.flipSided)b.flipSided?p.frontFace(p.CW):p.frontFace(p.CCW),aa=b.flipSided}function m(b){U!=b&&(b?
|
|
|
|
+p.enable(p.DEPTH_TEST):p.disable(p.DEPTH_TEST),U=b)}function n(b){ia!=b&&(p.depthMask(b),ia=b)}function t(b,c,e){ja!=b&&(b?p.enable(p.POLYGON_OFFSET_FILL):p.disable(p.POLYGON_OFFSET_FILL),ja=b);if(b&&(ta!=c||la!=e))p.polygonOffset(c,e),ta=c,la=e}function u(b){ya[0].set(b.n41-b.n11,b.n42-b.n12,b.n43-b.n13,b.n44-b.n14);ya[1].set(b.n41+b.n11,b.n42+b.n12,b.n43+b.n13,b.n44+b.n14);ya[2].set(b.n41+b.n21,b.n42+b.n22,b.n43+b.n23,b.n44+b.n24);ya[3].set(b.n41-b.n21,b.n42-b.n22,b.n43-b.n23,b.n44-b.n24);ya[4].set(b.n41-
|
|
|
|
+b.n31,b.n42-b.n32,b.n43-b.n33,b.n44-b.n34);ya[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=ya[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=ya[f].x*c.n14+ya[f].y*c.n24+ya[f].z*c.n34+ya[f].w,b<=e)return!1;return!0}function o(b,c){b.list[b.count]=c;b.count+=1}function x(b){var c,e,f=b.object,k=b.opaque,h=b.transparent;
|
|
|
|
+h.count=0;b=k.count=0;for(c=f.materials.length;b<c;b++)e=f.materials[b],e.transparent?o(h,e):o(k,e)}function v(b){var c,e,f,k,h=b.object,m=b.buffer,n=b.opaque,p=b.transparent;p.count=0;b=n.count=0;for(f=h.materials.length;b<f;b++)if(c=h.materials[b],c instanceof THREE.MeshFaceMaterial){c=0;for(e=m.materials.length;c<e;c++)(k=m.materials[c])&&(k.transparent?o(p,k):o(n,k))}else(k=c)&&(k.transparent?o(p,k):o(n,k))}function z(b,c){return c.z-b.z}function y(b){var c,n,o,t=0,v,x,y,L,z=b.lights;oa||(oa=
|
|
|
|
+new THREE.PerspectiveCamera(S.shadowCameraFov,S.shadowMapWidth/S.shadowMapHeight,S.shadowCameraNear,S.shadowCameraFar));c=0;for(n=z.length;c<n;c++)if(o=z[c],o instanceof THREE.SpotLight&&o.castShadow){ha=-1;S.shadowMap[t]||(S.shadowMap[t]=new THREE.WebGLRenderTarget(S.shadowMapWidth,S.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}));Ea[t]||(Ea[t]=new THREE.Matrix4);v=S.shadowMap[t];x=Ea[t];oa.position.copy(o.position);oa.lookAt(o.target.position);
|
|
|
|
+oa.update(void 0,!0);b.update(void 0,!1,oa);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(oa.projectionMatrix);x.multiplySelf(oa.matrixWorldInverse);oa.matrixWorldInverse.flattenToArray(Fa);oa.projectionMatrix.flattenToArray(Ga);Ca.multiply(oa.projectionMatrix,oa.matrixWorldInverse);u(Ca);S.initWebGLObjects(b);H(v);p.clearColor(1,1,1,1);S.clear();p.clearColor(P.r,P.g,P.b,ma);x=b.__webglObjects.length;o=b.__webglObjectsImmediate.length;for(v=0;v<x;v++)y=b.__webglObjects[v],L=y.object,
|
|
|
|
+L.visible&&L.castShadow?!(L instanceof THREE.Mesh)||!L.frustumCulled||w(L)?(L.matrixWorld.flattenToArray(L._objectMatrixArray),E(L,oa,!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)L=y.object,buffer=y.buffer,k(L),y=L.customDepthMaterial?L.customDepthMaterial:L.geometry.morphTargets.length?va:Ba,f(oa,z,null,y,buffer,L);for(v=0;v<o;v++)y=b.__webglObjectsImmediate[v],L=y.object,L.visible&&L.castShadow&&(L.matrixAutoUpdate&&L.matrixWorld.flattenToArray(L._objectMatrixArray),
|
|
|
|
+ga=-1,E(L,oa,!1),k(L),program=e(oa,z,null,Ba,L),L.immediateRenderCallback?L.immediateRenderCallback(program,p,ya):L.render(function(b){h(b,program,Ba.shading)}));t++}}function A(b,c){var e,f,k;e=X.attributes;var h=X.uniforms,m=sa/ra,n,o=[],t=ra*0.5,u=sa*0.5,v=!0;p.useProgram(X.program);ea=X.program;ga=U=W=-1;Xa||(p.enableVertexAttribArray(X.attributes.position),p.enableVertexAttribArray(X.attributes.uv),Xa=!0);p.disable(p.CULL_FACE);p.enable(p.BLEND);p.depthMask(!0);p.bindBuffer(p.ARRAY_BUFFER,X.vertexBuffer);
|
|
|
|
+p.vertexAttribPointer(e.position,2,p.FLOAT,!1,16,0);p.vertexAttribPointer(e.uv,2,p.FLOAT,!1,16,8);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,X.elementBuffer);p.uniformMatrix4fv(h.projectionMatrix,!1,Ga);p.activeTexture(p.TEXTURE0);p.uniform1i(h.map,0);e=0;for(f=b.__webglSprites.length;e<f;e++)if(k=b.__webglSprites[e],k.visible&&k.opacity!=0)k.useScreenCoordinates?k.z=-k.position.z:(k._modelViewMatrix.multiplyToArray(c.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray),k.z=-k._modelViewMatrix.n34);
|
|
|
|
+b.__webglSprites.sort(z);e=0;for(f=b.__webglSprites.length;e<f;e++)k=b.__webglSprites[e],k.visible&&k.opacity!=0&&k.map&&k.map.image&&k.map.image.width&&(k.useScreenCoordinates?(p.uniform1i(h.useScreenCoordinates,1),p.uniform3f(h.screenPosition,(k.position.x-t)/t,(u-k.position.y)/u,Math.max(0,Math.min(1,k.position.z)))):(p.uniform1i(h.useScreenCoordinates,0),p.uniform1i(h.affectedByDistance,k.affectedByDistance?1:0),p.uniformMatrix4fv(h.modelViewMatrix,!1,k._modelViewMatrixArray)),n=k.map.image.width/
|
|
|
|
+(k.scaleByViewport?sa:1),o[0]=n*m*k.scale.x,o[1]=n*k.scale.y,p.uniform2f(h.uvScale,k.uvScale.x,k.uvScale.y),p.uniform2f(h.uvOffset,k.uvOffset.x,k.uvOffset.y),p.uniform2f(h.alignment,k.alignment.x,k.alignment.y),p.uniform1f(h.opacity,k.opacity),p.uniform3f(h.color,k.color.r,k.color.g,k.color.b),p.uniform1f(h.rotation,k.rotation),p.uniform2fv(h.scale,o),k.mergeWith3D&&!v?(p.enable(p.DEPTH_TEST),v=!0):!k.mergeWith3D&&v&&(p.disable(p.DEPTH_TEST),v=!1),K(k.blending),N(k.map,0),p.drawElements(p.TRIANGLES,
|
|
|
|
+6,p.UNSIGNED_SHORT,0));p.enable(p.CULL_FACE);p.enable(p.DEPTH_TEST);p.depthMask(ia)}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,k;k=b.__materials;b=0;for(e=k.length;b<e;b++)if(f=k[b],f.attributes)for(c in f.attributes)if(f.attributes[c].needsUpdate)return!0;return!1}function C(b){var c,e,f,k;k=b.__materials;b=0;for(e=
|
|
|
|
+k.length;b<e;b++)if(f=k[b],f.attributes)for(c in f.attributes)f.attributes[c].needsUpdate=!1}function G(b,c){var e;for(e=b.length-1;e>=0;e--)b[e].object==c&&b.splice(e,1)}function J(b){function c(b){var k=[];e=0;for(f=b.length;e<f;e++)b[e]==void 0?k.push("undefined"):k.push(b[e].id);return k.join("_")}var e,f,k,h,m,n,p,o,t={},u=b.morphTargets!==void 0?b.morphTargets.length:0;b.geometryGroups={};k=0;for(h=b.faces.length;k<h;k++)m=b.faces[k],n=m.materials,p=c(n),t[p]==void 0&&(t[p]={hash:p,counter:0}),
|
|
|
|
+o=t[p].hash+"_"+t[p].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:n,vertices:0,numMorphTargets:u}),m=m instanceof THREE.Face3?3:4,b.geometryGroups[o].vertices+m>65535&&(t[p].counter+=1,o=t[p].hash+"_"+t[p].counter,b.geometryGroups[o]==void 0&&(b.geometryGroups[o]={faces:[],materials:n,vertices:0,numMorphTargets:u})),b.geometryGroups[o].faces.push(k),b.geometryGroups[o].vertices+=m;b.geometryGroupsList=[];for(var v in b.geometryGroups)b.geometryGroups[v].id=ka++,b.geometryGroupsList.push(b.geometryGroups[v])}
|
|
|
|
+function O(b,c,e){b.push({buffer:c,object:e,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function K(b){if(b!=W){switch(b){case THREE.AdditiveBlending:p.blendEquation(p.FUNC_ADD);p.blendFunc(p.SRC_ALPHA,p.ONE);break;case THREE.SubtractiveBlending:p.blendEquation(p.FUNC_ADD);p.blendFunc(p.ZERO,p.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:p.blendEquation(p.FUNC_ADD);p.blendFunc(p.ZERO,p.SRC_COLOR);break;default:p.blendEquationSeparate(p.FUNC_ADD,p.FUNC_ADD),p.blendFuncSeparate(p.SRC_ALPHA,
|
|
|
|
+p.ONE_MINUS_SRC_ALPHA,p.ONE,p.ONE_MINUS_SRC_ALPHA)}W=b}}function B(b,c,e){(e.width&e.width-1)==0&&(e.height&e.height-1)==0?(p.texParameteri(b,p.TEXTURE_WRAP_S,$(c.wrapS)),p.texParameteri(b,p.TEXTURE_WRAP_T,$(c.wrapT)),p.texParameteri(b,p.TEXTURE_MAG_FILTER,$(c.magFilter)),p.texParameteri(b,p.TEXTURE_MIN_FILTER,$(c.minFilter)),p.generateMipmap(b)):(p.texParameteri(b,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(b,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(b,p.TEXTURE_MAG_FILTER,Z(c.magFilter)),
|
|
|
|
+p.texParameteri(b,p.TEXTURE_MIN_FILTER,Z(c.minFilter)))}function N(b,c){if(b.needsUpdate){if(!b.__webglInit)b.__webglInit=!0,b.__webglTexture=p.createTexture(),S.info.memory.textures++;p.activeTexture(p.TEXTURE0+c);p.bindTexture(p.TEXTURE_2D,b.__webglTexture);b instanceof THREE.DataTexture?p.texImage2D(p.TEXTURE_2D,0,$(b.format),b.image.width,b.image.height,0,$(b.format),p.UNSIGNED_BYTE,b.image.data):p.texImage2D(p.TEXTURE_2D,0,p.RGBA,p.RGBA,p.UNSIGNED_BYTE,b.image);B(p.TEXTURE_2D,b,b.image);b.needsUpdate=
|
|
|
|
+!1}else p.activeTexture(p.TEXTURE0+c),p.bindTexture(p.TEXTURE_2D,b.__webglTexture)}function Y(b,c){p.bindRenderbuffer(p.RENDERBUFFER,b);c.depthBuffer&&!c.stencilBuffer?(p.renderbufferStorage(p.RENDERBUFFER,p.DEPTH_COMPONENT16,c.width,c.height),p.framebufferRenderbuffer(p.FRAMEBUFFER,p.DEPTH_ATTACHMENT,p.RENDERBUFFER,b)):c.depthBuffer&&c.stencilBuffer?(p.renderbufferStorage(p.RENDERBUFFER,p.DEPTH_STENCIL,c.width,c.height),p.framebufferRenderbuffer(p.FRAMEBUFFER,p.DEPTH_STENCIL_ATTACHMENT,p.RENDERBUFFER,
|
|
|
|
+b)):p.renderbufferStorage(p.RENDERBUFFER,p.RGBA4,c.width,c.height)}function H(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.__webglTexture=p.createTexture();if(c){b.__webglFramebuffer=[];b.__webglRenderbuffer=[];p.bindTexture(p.TEXTURE_CUBE_MAP,b.__webglTexture);B(p.TEXTURE_CUBE_MAP,b,b);for(var e=0;e<6;e++){b.__webglFramebuffer[e]=p.createFramebuffer();b.__webglRenderbuffer[e]=
|
|
|
|
+p.createRenderbuffer();p.texImage2D(p.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,$(b.format),b.width,b.height,0,$(b.format),$(b.type),null);var f=b,k=p.TEXTURE_CUBE_MAP_POSITIVE_X+e;p.bindFramebuffer(p.FRAMEBUFFER,b.__webglFramebuffer[e]);p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,k,f.__webglTexture,0);Y(b.__webglRenderbuffer[e],b)}}else b.__webglFramebuffer=p.createFramebuffer(),b.__webglRenderbuffer=p.createRenderbuffer(),p.bindTexture(p.TEXTURE_2D,b.__webglTexture),B(p.TEXTURE_2D,b,b),p.texImage2D(p.TEXTURE_2D,
|
|
|
|
+0,$(b.format),b.width,b.height,0,$(b.format),$(b.type),null),e=p.TEXTURE_2D,p.bindFramebuffer(p.FRAMEBUFFER,b.__webglFramebuffer),p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,e,b.__webglTexture,0),p.bindRenderbuffer(p.RENDERBUFFER,b.__webglRenderbuffer),Y(b.__webglRenderbuffer,b);c?p.bindTexture(p.TEXTURE_CUBE_MAP,null):p.bindTexture(p.TEXTURE_2D,null);p.bindRenderbuffer(p.RENDERBUFFER,null);p.bindFramebuffer(p.FRAMEBUFFER,null)}b?(c=c?b.__webglFramebuffer[b.activeCubeFace]:b.__webglFramebuffer,
|
|
|
|
+e=b.width,b=b.height,k=f=0):(c=null,e=ra,b=sa,f=ca,k=pa);c!=da&&(p.bindFramebuffer(p.FRAMEBUFFER,c),p.viewport(f,k,e,b),da=c)}function T(b){b instanceof THREE.WebGLRenderTargetCube?(p.bindTexture(p.TEXTURE_CUBE_MAP,b.__webglTexture),p.generateMipmap(p.TEXTURE_CUBE_MAP),p.bindTexture(p.TEXTURE_CUBE_MAP,null)):(p.bindTexture(p.TEXTURE_2D,b.__webglTexture),p.generateMipmap(p.TEXTURE_2D),p.bindTexture(p.TEXTURE_2D,null))}function Q(b,c){var e;b=="fragment"?e=p.createShader(p.FRAGMENT_SHADER):b=="vertex"&&
|
|
|
|
+(e=p.createShader(p.VERTEX_SHADER));p.shaderSource(e,c);p.compileShader(e);if(!p.getShaderParameter(e,p.COMPILE_STATUS))return console.error(p.getShaderInfoLog(e)),console.error(c),null;return e}function Z(b){switch(b){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return p.NEAREST;default:return p.LINEAR}}function $(b){switch(b){case THREE.RepeatWrapping:return p.REPEAT;case THREE.ClampToEdgeWrapping:return p.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return p.MIRRORED_REPEAT;
|
|
|
|
+case THREE.NearestFilter:return p.NEAREST;case THREE.NearestMipMapNearestFilter:return p.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return p.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return p.LINEAR;case THREE.LinearMipMapNearestFilter:return p.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return p.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return p.BYTE;case THREE.UnsignedByteType:return p.UNSIGNED_BYTE;case THREE.ShortType:return p.SHORT;case THREE.UnsignedShortType:return p.UNSIGNED_SHORT;
|
|
|
|
+case THREE.IntType:return p.INT;case THREE.UnsignedShortType:return p.UNSIGNED_INT;case THREE.FloatType:return p.FLOAT;case THREE.AlphaFormat:return p.ALPHA;case THREE.RGBFormat:return p.RGB;case THREE.RGBAFormat:return p.RGBA;case THREE.LuminanceFormat:return p.LUMINANCE;case THREE.LuminanceAlphaFormat:return p.LUMINANCE_ALPHA}return 0}var S=this,p,V=[],ea=null,da=null,ha=-1,ga=null,ka=0,na=null,aa=null,W=null,U=null,ia=null,ja=null,ta=null,la=null,ca=0,pa=0,ra=0,sa=0,ya=[new THREE.Vector4,new THREE.Vector4,
|
|
|
|
+new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Ca=new THREE.Matrix4,Ga=new Float32Array(16),Fa=new Float32Array(16),Da=new THREE.Vector4,za={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"),M=b.stencil!==void 0?b.stencil:!0,fa=b.preserveDrawingBuffer!==void 0?b.preserveDrawingBuffer:!1,qa=b.antialias!==void 0?b.antialias:!1,P=b.clearColor!==
|
|
|
|
+void 0?new THREE.Color(b.clearColor):new THREE.Color(0),ma=b.clearAlpha!==void 0?b.clearAlpha:0,ua=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=!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 oa,Ea=[],b=THREE.ShaderLib.depthRGBA,Ia=THREE.UniformsUtils.clone(b.uniforms),Ba=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia}),va=new THREE.ShaderMaterial({fragmentShader:b.fragmentShader,vertexShader:b.vertexShader,uniforms:Ia,morphTargets:!0});Ba._shadowPass=!0;va._shadowPass=!0;try{if(!(p=L.getContext("experimental-webgl",{antialias:qa,stencil:M,
|
|
|
|
+preserveDrawingBuffer:fa})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+p.getParameter(p.VERSION)+" | "+p.getParameter(p.VENDOR)+" | "+p.getParameter(p.RENDERER)+" | "+p.getParameter(p.SHADING_LANGUAGE_VERSION))}catch(Ka){console.error(Ka)}p.clearColor(0,0,0,1);p.clearDepth(1);p.clearStencil(0);p.enable(p.DEPTH_TEST);p.depthFunc(p.LEQUAL);p.frontFace(p.CCW);p.cullFace(p.BACK);p.enable(p.CULL_FACE);p.enable(p.BLEND);p.blendEquation(p.FUNC_ADD);p.blendFunc(p.SRC_ALPHA,
|
|
|
|
+p.ONE_MINUS_SRC_ALPHA);p.clearColor(P.r,P.g,P.b,ma);this.context=p;var Ha=p.getParameter(p.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0,X={};X.vertices=new Float32Array(16);X.faces=new Uint16Array(6);M=0;X.vertices[M++]=-1;X.vertices[M++]=-1;X.vertices[M++]=0;X.vertices[M++]=1;X.vertices[M++]=1;X.vertices[M++]=-1;X.vertices[M++]=1;X.vertices[M++]=1;X.vertices[M++]=1;X.vertices[M++]=1;X.vertices[M++]=1;X.vertices[M++]=0;X.vertices[M++]=-1;X.vertices[M++]=1;X.vertices[M++]=0;M=X.vertices[M++]=0;X.faces[M++]=0;
|
|
|
|
+X.faces[M++]=1;X.faces[M++]=2;X.faces[M++]=0;X.faces[M++]=2;X.faces[M++]=3;X.vertexBuffer=p.createBuffer();X.elementBuffer=p.createBuffer();p.bindBuffer(p.ARRAY_BUFFER,X.vertexBuffer);p.bufferData(p.ARRAY_BUFFER,X.vertices,p.STATIC_DRAW);p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,X.elementBuffer);p.bufferData(p.ELEMENT_ARRAY_BUFFER,X.faces,p.STATIC_DRAW);X.program=p.createProgram();p.attachShader(X.program,Q("fragment",THREE.ShaderLib.sprite.fragmentShader));p.attachShader(X.program,Q("vertex",THREE.ShaderLib.sprite.vertexShader));
|
|
|
|
+p.linkProgram(X.program);X.attributes={};X.uniforms={};X.attributes.position=p.getAttribLocation(X.program,"position");X.attributes.uv=p.getAttribLocation(X.program,"uv");X.uniforms.uvOffset=p.getUniformLocation(X.program,"uvOffset");X.uniforms.uvScale=p.getUniformLocation(X.program,"uvScale");X.uniforms.rotation=p.getUniformLocation(X.program,"rotation");X.uniforms.scale=p.getUniformLocation(X.program,"scale");X.uniforms.alignment=p.getUniformLocation(X.program,"alignment");X.uniforms.color=p.getUniformLocation(X.program,
|
|
|
|
+"color");X.uniforms.map=p.getUniformLocation(X.program,"map");X.uniforms.opacity=p.getUniformLocation(X.program,"opacity");X.uniforms.useScreenCoordinates=p.getUniformLocation(X.program,"useScreenCoordinates");X.uniforms.affectedByDistance=p.getUniformLocation(X.program,"affectedByDistance");X.uniforms.screenPosition=p.getUniformLocation(X.program,"screenPosition");X.uniforms.modelViewMatrix=p.getUniformLocation(X.program,"modelViewMatrix");X.uniforms.projectionMatrix=p.getUniformLocation(X.program,
|
|
|
|
+"projectionMatrix");var Xa=!1;this.setSize=function(b,c){L.width=b;L.height=c;this.setViewport(0,0,L.width,L.height)};this.setViewport=function(b,c,e,f){ca=b;pa=c;ra=e;sa=f;p.viewport(ca,pa,ra,sa)};this.setScissor=function(b,c,e,f){p.scissor(b,c,e,f)};this.enableScissorTest=function(b){b?p.enable(p.SCISSOR_TEST):p.disable(p.SCISSOR_TEST)};this.setClearColorHex=function(b,c){P.setHex(b);ma=c;p.clearColor(P.r,P.g,P.b,ma)};this.setClearColor=function(b,c){P.copy(b);ma=c;p.clearColor(P.r,P.g,P.b,ma)};
|
|
|
|
+this.getClearColor=function(){return P};this.getClearAlpha=function(){return ma};this.clear=function(b,c,e){var f=0;if(b==void 0||b)f|=p.COLOR_BUFFER_BIT;if(c==void 0||c)f|=p.DEPTH_BUFFER_BIT;if(e==void 0||e)f|=p.STENCIL_BUFFER_BIT;p.clear(f)};this.getContext=function(){return p};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];p.deleteBuffer(c.__webglVertexBuffer);p.deleteBuffer(c.__webglNormalBuffer);p.deleteBuffer(c.__webglTangentBuffer);p.deleteBuffer(c.__webglColorBuffer);p.deleteBuffer(c.__webglUVBuffer);p.deleteBuffer(c.__webglUV2Buffer);p.deleteBuffer(c.__webglSkinVertexABuffer);p.deleteBuffer(c.__webglSkinVertexBBuffer);p.deleteBuffer(c.__webglSkinIndicesBuffer);p.deleteBuffer(c.__webglSkinWeightsBuffer);p.deleteBuffer(c.__webglFaceBuffer);p.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var e=
|
|
|
|
+0,f=c.numMorphTargets;e<f;e++)p.deleteBuffer(c.__webglMorphTargetsBuffers[e]);S.info.memory.geometries--}else if(b instanceof THREE.Ribbon)b=b.geometry,p.deleteBuffer(b.__webglVertexBuffer),p.deleteBuffer(b.__webglColorBuffer),S.info.memory.geometries--;else if(b instanceof THREE.Line)b=b.geometry,p.deleteBuffer(b.__webglVertexBuffer),p.deleteBuffer(b.__webglColorBuffer),S.info.memory.geometries--;else if(b instanceof THREE.ParticleSystem)b=b.geometry,p.deleteBuffer(b.__webglVertexBuffer),p.deleteBuffer(b.__webglColorBuffer),
|
|
|
|
+S.info.memory.geometries--};this.deallocateTexture=function(b){if(b.__webglInit)b.__webglInit=!1,p.deleteTexture(b.__webglTexture),S.info.memory.textures--};this.initMaterial=function(b,c,e,f){var k,h,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 o=THREE.ShaderLib[n];b.uniforms=THREE.UniformsUtils.clone(o.uniforms);b.vertexShader=o.vertexShader;b.fragmentShader=o.fragmentShader}var t,u,v;t=v=o=0;for(u=c.length;t<u;t++)m=c[t],m instanceof THREE.SpotLight&&v++,m instanceof THREE.DirectionalLight&&v++,m instanceof THREE.PointLight&&o++;o+v<=ua?t=v:(t=Math.ceil(ua*v/(o+v)),o=ua-t);m={directional:t,point:o};o=v=0;for(t=c.length;o<t;o++)u=c[o],u instanceof THREE.SpotLight&&u.castShadow&&
|
|
|
|
+v++;var w=50;if(f!==void 0&&f instanceof THREE.SkinnedMesh)w=f.bones.length;var x;a:{t=b.fragmentShader;u=b.vertexShader;var o=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:v,alphaTest:b.alphaTest},y,f=[];n?f.push(n):(f.push(t),f.push(u));for(y in e)f.push(y),f.push(e[y]);n=f.join();y=0;for(f=V.length;y<f;y++)if(V[y].code==n){x=V[y].program;break a}y=p.createProgram();f=[Ha?"#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":"",
|
|
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(H,S("fragment",m+t));o.attachShader(H,S("vertex",f+w));o.linkProgram(H);o.getProgramParameter(H,o.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+o.getProgramParameter(H,o.VALIDATE_STATUS)+", gl error ["+
|
|
|
|
-o.getError()+"]");H.uniforms={};H.attributes={};var y,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(y in p)f.push(y);y=f;f=0;for(p=y.length;f<p;f++)t=y[f],H.uniforms[t]=o.getUniformLocation(H,t);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(y=0;y<e.maxMorphTargets;y++)f.push("morphTarget"+y);for(v in c)f.push(v);
|
|
|
|
-v=f;y=0;for(c=v.length;y<c;y++)e=v[y],H.attributes[e]=o.getAttribLocation(H,e);H.id=$.length;$.push({program:H,code:n});W.info.memory.programs=$.length;v=H}b.program=v;v=b.program.attributes;v.position>=0&&o.enableVertexAttribArray(v.position);v.color>=0&&o.enableVertexAttribArray(v.color);v.normal>=0&&o.enableVertexAttribArray(v.normal);v.tangent>=0&&o.enableVertexAttribArray(v.tangent);b.skinning&&v.skinVertexA>=0&&v.skinVertexB>=0&&v.skinIndex>=0&&v.skinWeight>=0&&(o.enableVertexAttribArray(v.skinVertexA),
|
|
|
|
-o.enableVertexAttribArray(v.skinVertexB),o.enableVertexAttribArray(v.skinIndex),o.enableVertexAttribArray(v.skinWeight));if(b.attributes)for(h in b.attributes)v[h]!==void 0&&v[h]>=0&&o.enableVertexAttribArray(v[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)y="morphTarget"+h,v[y]>=0&&(o.enableVertexAttribArray(v[y]),b.numSupportedMorphTargets++);b.uniformsList=[];for(k in b.uniforms)b.uniformsList.push([b.uniforms[k],k])};this.clearTarget=function(b,c,e,f){U(b);
|
|
|
|
-this.clear(c,e,f)};this.render=function(b,c,p,H){var ea,Z,F,D,G,ka,B,ma,K=b.lights,ga=b.fog;fa=-1;this.shadowMapEnabled&&y(b,c);W.info.render.calls=0;W.info.render.vertices=0;W.info.render.faces=0;if(c.matrixAutoUpdate){for(G=c;G.parent;)G=G.parent;G.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Ea);c.projectionMatrix.flattenToArray(Fa);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);u(Ca);this.initWebGLObjects(b);U(p);(this.autoClear||H)&&this.clear(this.autoClearColor,
|
|
|
|
-this.autoClearDepth,this.autoClearStencil);G=b.__webglObjects.length;for(H=0;H<G;H++)if(ea=b.__webglObjects[H],B=ea.object,B.visible)if(!(B instanceof THREE.Mesh)||!B.frustumCulled||v(B)){if(B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),w(ea),ea.render=!0,this.sortObjects)ea.object.renderDepth?ea.z=ea.object.renderDepth:(Da.copy(B.position),Ca.multiplyVector3(Da),ea.z=Da.z)}else ea.render=!1;else ea.render=!1;this.sortObjects&&b.__webglObjects.sort(z);ka=b.__webglObjectsImmediate.length;
|
|
|
|
-for(H=0;H<ka;H++)ea=b.__webglObjectsImmediate[H],B=ea.object,B.visible&&(B.matrixAutoUpdate&&B.matrixWorld.flattenToArray(B._objectMatrixArray),E(B,c,!0),x(ea));if(b.overrideMaterial){m(b.overrideMaterial.depthTest);L(b.overrideMaterial.blending);for(H=0;H<G;H++)if(ea=b.__webglObjects[H],ea.render)B=ea.object,ma=ea.buffer,k(B),f(c,K,ga,b.overrideMaterial,ma,B);for(H=0;H<ka;H++)ea=b.__webglObjectsImmediate[H],B=ea.object,B.visible&&(oa=-1,k(B),Z=e(c,K,ga,b.overrideMaterial,B),B.immediateRenderCallback?
|
|
|
|
-B.immediateRenderCallback(Z,o,wa):B.render(function(c){h(c,Z,b.overrideMaterial.shading)}))}else{L(THREE.NormalBlending);for(H=G-1;H>=0;H--)if(ea=b.__webglObjects[H],ea.render){B=ea.object;ma=ea.buffer;F=ea.opaque;k(B);for(ea=0;ea<F.count;ea++)D=F.list[ea],m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,K,ga,D,ma,B)}for(H=0;H<ka;H++)if(ea=b.__webglObjectsImmediate[H],B=ea.object,B.visible){oa=-1;F=ea.opaque;k(B);for(ea=0;ea<F.count;ea++)D=F.list[ea],
|
|
|
|
-m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),Z=e(c,K,ga,D,B),B.immediateRenderCallback?B.immediateRenderCallback(Z,o,wa):B.render(function(b){h(b,Z,D.shading)})}for(H=0;H<G;H++)if(ea=b.__webglObjects[H],ea.render){B=ea.object;ma=ea.buffer;F=ea.transparent;k(B);for(ea=0;ea<F.count;ea++)D=F.list[ea],L(D.blending),m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),f(c,K,ga,D,ma,B)}for(H=0;H<ka;H++)if(ea=b.__webglObjectsImmediate[H],
|
|
|
|
-B=ea.object,B.visible){oa=-1;F=ea.transparent;k(B);for(ea=0;ea<F.count;ea++)D=F.list[ea],L(D.blending),m(D.depthTest),n(D.depthWrite),t(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits),Z=e(c,K,ga,D,B),B.immediateRenderCallback?B.immediateRenderCallback(Z,o,wa):B.render(function(b){h(b,Z,D.shading)})}}b.__webglSprites.length&&A(b,c);p&&p.minFilter!==THREE.NearestFilter&&p.minFilter!==THREE.LinearFilter&&I(p)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=
|
|
|
|
-[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=b.__objectsAdded[0],f=b,k=void 0,h=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(k in h=e.geometry,h.geometryGroups==void 0&&K(h),h.geometryGroups){if(m=h.geometryGroups[k],!m.__webglVertexBuffer){var n=
|
|
|
|
-m;n.__webglVertexBuffer=o.createBuffer();n.__webglNormalBuffer=o.createBuffer();n.__webglTangentBuffer=o.createBuffer();n.__webglColorBuffer=o.createBuffer();n.__webglUVBuffer=o.createBuffer();n.__webglUV2Buffer=o.createBuffer();n.__webglSkinVertexABuffer=o.createBuffer();n.__webglSkinVertexBBuffer=o.createBuffer();n.__webglSkinIndicesBuffer=o.createBuffer();n.__webglSkinWeightsBuffer=o.createBuffer();n.__webglFaceBuffer=o.createBuffer();n.__webglLineBuffer=o.createBuffer();if(n.numMorphTargets){var p=
|
|
|
|
-void 0,t=void 0;n.__webglMorphTargetsBuffers=[];p=0;for(t=n.numMorphTargets;p<t;p++)n.__webglMorphTargetsBuffers.push(o.createBuffer())}W.info.memory.geometries++;for(var n=e,w=void 0,u=void 0,x=void 0,v=x=void 0,H=void 0,y=void 0,z=y=p=0,A=x=u=void 0,x=t=A=u=w=void 0,v=n.geometry,H=v.faces,A=m.faces,w=0,u=A.length;w<u;w++)x=A[w],x=H[x],x instanceof THREE.Face3?(p+=3,y+=1,z+=3):x instanceof THREE.Face4&&(p+=4,y+=2,z+=4);for(var w=m,u=n,ea=A=H=void 0,Z=void 0,ea=void 0,x=[],H=0,A=u.materials.length;H<
|
|
|
|
-A;H++)if(ea=u.materials[H],ea instanceof THREE.MeshFaceMaterial){ea=0;for(l=w.materials.length;ea<l;ea++)(Z=w.materials[ea])&&x.push(Z)}else(Z=ea)&&x.push(Z);w=x;m.__materials=w;a:{H=u=void 0;A=w.length;for(u=0;u<A;u++)if(H=w[u],H.map||H.lightMap||H instanceof THREE.ShaderMaterial){u=!0;break a}u=!1}a:{A=H=void 0;x=w.length;for(H=0;H<x;H++)if(A=w[H],!(A instanceof THREE.MeshBasicMaterial&&!A.envMap||A instanceof THREE.MeshDepthMaterial)){A=A&&A.shading!=void 0&&A.shading==THREE.SmoothShading?THREE.SmoothShading:
|
|
|
|
-THREE.FlatShading;break a}A=!1}a:{x=H=void 0;ea=w.length;for(H=0;H<ea;H++)if(x=w[H],x.vertexColors){x=x.vertexColors;break a}x=!1}m.__vertexArray=new Float32Array(p*3);if(A)m.__normalArray=new Float32Array(p*3);if(v.hasTangents)m.__tangentArray=new Float32Array(p*4);if(x)m.__colorArray=new Float32Array(p*3);if(u){if(v.faceUvs.length>0||v.faceVertexUvs.length>0)m.__uvArray=new Float32Array(p*2);if(v.faceUvs.length>1||v.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(p*2)}if(n.geometry.skinWeights.length&&
|
|
|
|
-n.geometry.skinIndices.length)m.__skinVertexAArray=new Float32Array(p*4),m.__skinVertexBArray=new Float32Array(p*4),m.__skinIndexArray=new Float32Array(p*4),m.__skinWeightArray=new Float32Array(p*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(z*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];v=0;for(H=m.numMorphTargets;v<H;v++)m.__morphTargetsArrays.push(new Float32Array(p*3))}m.__needsSmoothNormals=A==THREE.SmoothShading;
|
|
|
|
-m.__uvType=u;m.__vertexColorType=x;m.__normalType=A;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);m.__webglLineCount=z*2;v=0;for(H=w.length;v<H;v++)if(u=w[v],u.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in u.attributes){x=u.attributes[a];A={};for(t in x)A[t]=x[t];if(!A.__webglInitialized||A.createUniqueBuffers)A.__webglInitialized=!0,y=1,A.type==="v2"?y=2:A.type==="v3"?y=3:A.type==="v4"?y=4:A.type==="c"&&(y=3),A.size=y,A.array=
|
|
|
|
-new Float32Array(p*y),A.buffer=o.createBuffer(),A.buffer.belongsToAttribute=a,x.needsUpdate=!0,A.__original=x;m.__webglCustomAttributes[a]=A}}m.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)m=h,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=h,n=m.vertices.length,
|
|
|
|
-m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)m=h,m.__webglVertexBuffer=o.createBuffer(),m.__webglColorBuffer=o.createBuffer(),W.info.memory.geometries++,m=h,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&
|
|
|
|
-(h=e.geometry,!h.__webglVertexBuffer)){m=h;m.__webglVertexBuffer=o.createBuffer();m.__webglColorBuffer=o.createBuffer();W.info.geometries++;m=h;n=e;p=m.vertices.length;m.__vertexArray=new Float32Array(p*3);m.__colorArray=new Float32Array(p*3);m.__sortArray=[];m.__webglParticleCount=p;m.__materials=n.materials;z=y=t=void 0;t=0;for(y=n.materials.length;t<y;t++)if(z=n.materials[t],z.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in z.attributes){originalAttribute=
|
|
|
|
-z.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(p*size),attribute.buffer=o.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=
|
|
|
|
-originalAttribute;m.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=!0;h.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(k in h=e.geometry,h.geometryGroups)m=h.geometryGroups[k],N(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,N(f.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:{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)G(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;k=e;h=void 0;for(h=f.length-1;h>=0;h--)f[h]==k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&
|
|
|
|
-G(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(h=b.__webglObjects[e].object,t=m=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(p=k.geometryGroupsList.length;n<p;n++)if(m=k.geometryGroupsList[n],t=F(m),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||t)if(t=m,y=o.DYNAMIC_DRAW,z=!k.dynamic,t.__inittedArrays){var E=w=v=void 0,B=void 0,
|
|
|
|
-ka=E=void 0,ma=void 0,L=void 0,ga=void 0,I=Z=ea=x=A=H=u=void 0,M=void 0,va=void 0,J=B=ga=B=L=ma=void 0,C=void 0,O=C=J=ma=void 0,Q=void 0,X=O=C=J=E=E=ka=ga=B=O=C=J=Q=O=C=J=Q=O=C=J=void 0,na=0,V=0,S=0,qa=0,ua=0,U=0,R=0,Y=0,T=0,P=0,aa=0,O=J=0,O=void 0,pa=t.__vertexArray,wa=t.__uvArray,oa=t.__uv2Array,za=t.__normalArray,$=t.__tangentArray,fa=t.__colorArray,ca=t.__skinVertexAArray,ia=t.__skinVertexBArray,da=t.__skinIndexArray,ha=t.__skinWeightArray,la=t.__morphTargetsArrays,ja=t.__webglCustomAttributes,
|
|
|
|
-C=void 0,ra=t.__faceArray,Aa=t.__lineArray,Ha=t.__needsSmoothNormals,H=t.__vertexColorType,u=t.__uvType,A=t.__normalType,sa=h.geometry,Ca=sa.__dirtyVertices,Fa=sa.__dirtyElements,Ea=sa.__dirtyUvs,Da=sa.__dirtyNormals,ya=sa.__dirtyTangents,Ia=sa.__dirtyColors,Ga=sa.__dirtyMorphTargets,Ka=sa.vertices,cb=t.faces,fb=sa.faces,db=sa.faceVertexUvs[0],eb=sa.faceVertexUvs[1],Sa=sa.skinVerticesA,Ta=sa.skinVerticesB,Ua=sa.skinIndices,Ma=sa.skinWeights,La=sa.morphTargets;if(ja)for(X in ja)ja[X].offset=0,ja[X].offsetSrc=
|
|
|
|
-0;v=0;for(w=cb.length;v<w;v++)if(E=cb[v],B=fb[E],db&&(x=db[E]),eb&&(ea=eb[E]),E=B.vertexNormals,ka=B.normal,ma=B.vertexColors,L=B.color,ga=B.vertexTangents,B instanceof THREE.Face3){if(Ca)Z=Ka[B.a].position,I=Ka[B.b].position,M=Ka[B.c].position,pa[V]=Z.x,pa[V+1]=Z.y,pa[V+2]=Z.z,pa[V+3]=I.x,pa[V+4]=I.y,pa[V+5]=I.z,pa[V+6]=M.x,pa[V+7]=M.y,pa[V+8]=M.z,V+=9;if(ja)for(X in ja)if(C=ja[X],C.__original.needsUpdate)J=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[J]=
|
|
|
|
-C.value[B.a],C.array[J+1]=C.value[B.b],C.array[J+2]=C.value[B.c]):C.boundTo==="faces"?(O=C.value[O],C.array[J]=O,C.array[J+1]=O,C.array[J+2]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[J]=C.value[O],C.array[J+1]=C.value[O+1],C.array[J+2]=C.value[O+2],C.offsetSrc+=3),C.offset+=3):(C.boundTo===void 0||C.boundTo==="vertices"?(Z=C.value[B.a],I=C.value[B.b],M=C.value[B.c]):C.boundTo==="faces"?(M=I=Z=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(Z=C.value[O],I=C.value[O+1],M=C.value[O+
|
|
|
|
-2],C.offsetSrc+=3),C.size===2?(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=I.x,C.array[J+3]=I.y,C.array[J+4]=M.x,C.array[J+5]=M.y,C.offset+=6):C.size===3?(C.type==="c"?(C.array[J]=Z.r,C.array[J+1]=Z.g,C.array[J+2]=Z.b,C.array[J+3]=I.r,C.array[J+4]=I.g,C.array[J+5]=I.b,C.array[J+6]=M.r,C.array[J+7]=M.g,C.array[J+8]=M.b):(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=Z.z,C.array[J+3]=I.x,C.array[J+4]=I.y,C.array[J+5]=I.z,C.array[J+6]=M.x,C.array[J+7]=M.y,C.array[J+8]=M.z),C.offset+=9):(C.array[J]=Z.x,
|
|
|
|
-C.array[J+1]=Z.y,C.array[J+2]=Z.z,C.array[J+3]=Z.w,C.array[J+4]=I.x,C.array[J+5]=I.y,C.array[J+6]=I.z,C.array[J+7]=I.w,C.array[J+8]=M.x,C.array[J+9]=M.y,C.array[J+10]=M.z,C.array[J+11]=M.w,C.offset+=12));if(Ga){J=0;for(C=La.length;J<C;J++)Z=La[J].vertices[B.a].position,I=La[J].vertices[B.b].position,M=La[J].vertices[B.c].position,O=la[J],O[aa]=Z.x,O[aa+1]=Z.y,O[aa+2]=Z.z,O[aa+3]=I.x,O[aa+4]=I.y,O[aa+5]=I.z,O[aa+6]=M.x,O[aa+7]=M.y,O[aa+8]=M.z;aa+=9}if(Ma.length)J=Ma[B.a],C=Ma[B.b],O=Ma[B.c],ha[P]=
|
|
|
|
-J.x,ha[P+1]=J.y,ha[P+2]=J.z,ha[P+3]=J.w,ha[P+4]=C.x,ha[P+5]=C.y,ha[P+6]=C.z,ha[P+7]=C.w,ha[P+8]=O.x,ha[P+9]=O.y,ha[P+10]=O.z,ha[P+11]=O.w,J=Ua[B.a],C=Ua[B.b],O=Ua[B.c],da[P]=J.x,da[P+1]=J.y,da[P+2]=J.z,da[P+3]=J.w,da[P+4]=C.x,da[P+5]=C.y,da[P+6]=C.z,da[P+7]=C.w,da[P+8]=O.x,da[P+9]=O.y,da[P+10]=O.z,da[P+11]=O.w,J=Sa[B.a],C=Sa[B.b],O=Sa[B.c],ca[P]=J.x,ca[P+1]=J.y,ca[P+2]=J.z,ca[P+3]=1,ca[P+4]=C.x,ca[P+5]=C.y,ca[P+6]=C.z,ca[P+7]=1,ca[P+8]=O.x,ca[P+9]=O.y,ca[P+10]=O.z,ca[P+11]=1,J=Ta[B.a],C=Ta[B.b],O=
|
|
|
|
-Ta[B.c],ia[P]=J.x,ia[P+1]=J.y,ia[P+2]=J.z,ia[P+3]=1,ia[P+4]=C.x,ia[P+5]=C.y,ia[P+6]=C.z,ia[P+7]=1,ia[P+8]=O.x,ia[P+9]=O.y,ia[P+10]=O.z,ia[P+11]=1,P+=12;if(Ia&&H)ma.length==3&&H==THREE.VertexColors?(B=ma[0],J=ma[1],C=ma[2]):C=J=B=L,fa[T]=B.r,fa[T+1]=B.g,fa[T+2]=B.b,fa[T+3]=J.r,fa[T+4]=J.g,fa[T+5]=J.b,fa[T+6]=C.r,fa[T+7]=C.g,fa[T+8]=C.b,T+=9;if(ya&&sa.hasTangents)ma=ga[0],L=ga[1],B=ga[2],$[R]=ma.x,$[R+1]=ma.y,$[R+2]=ma.z,$[R+3]=ma.w,$[R+4]=L.x,$[R+5]=L.y,$[R+6]=L.z,$[R+7]=L.w,$[R+8]=B.x,$[R+9]=B.y,
|
|
|
|
-$[R+10]=B.z,$[R+11]=B.w,R+=12;if(Da&&A)if(E.length==3&&Ha)for(ga=0;ga<3;ga++)ka=E[ga],za[U]=ka.x,za[U+1]=ka.y,za[U+2]=ka.z,U+=3;else for(ga=0;ga<3;ga++)za[U]=ka.x,za[U+1]=ka.y,za[U+2]=ka.z,U+=3;if(Ea&&x!==void 0&&u)for(ga=0;ga<3;ga++)E=x[ga],wa[S]=E.u,wa[S+1]=E.v,S+=2;if(Ea&&ea!==void 0&&u)for(ga=0;ga<3;ga++)E=ea[ga],oa[qa]=E.u,oa[qa+1]=E.v,qa+=2;Fa&&(ra[ua]=na,ra[ua+1]=na+1,ra[ua+2]=na+2,ua+=3,Aa[Y]=na,Aa[Y+1]=na+1,Aa[Y+2]=na,Aa[Y+3]=na+2,Aa[Y+4]=na+1,Aa[Y+5]=na+2,Y+=6,na+=3)}else if(B instanceof
|
|
|
|
-THREE.Face4){if(Ca)Z=Ka[B.a].position,I=Ka[B.b].position,M=Ka[B.c].position,va=Ka[B.d].position,pa[V]=Z.x,pa[V+1]=Z.y,pa[V+2]=Z.z,pa[V+3]=I.x,pa[V+4]=I.y,pa[V+5]=I.z,pa[V+6]=M.x,pa[V+7]=M.y,pa[V+8]=M.z,pa[V+9]=va.x,pa[V+10]=va.y,pa[V+11]=va.z,V+=12;if(ja)for(X in ja)if(C=ja[X],C.__original.needsUpdate)J=C.offset,O=C.offsetSrc,C.size===1?(C.boundTo===void 0||C.boundTo==="vertices"?(C.array[J]=C.value[B.a],C.array[J+1]=C.value[B.b],C.array[J+2]=C.value[B.c],C.array[J+3]=C.value[B.d]):C.boundTo==="faces"?
|
|
|
|
-(O=C.value[O],C.array[J]=O,C.array[J+1]=O,C.array[J+2]=O,C.array[J+3]=O,C.offsetSrc++):C.boundTo==="faceVertices"&&(C.array[J]=C.value[O],C.array[J+1]=C.value[O+1],C.array[J+2]=C.value[O+2],C.array[J+3]=C.value[O+3],C.offsetSrc+=4),C.offset+=4):(C.boundTo===void 0||C.boundTo==="vertices"?(Z=C.value[B.a],I=C.value[B.b],M=C.value[B.c],va=C.value[B.d]):C.boundTo==="faces"?(va=M=I=Z=O=C.value[O],C.offsetSrc++):C.boundTo==="faceVertices"&&(Z=C.value[O],I=C.value[O+1],M=C.value[O+2],va=C.value[O+3],C.offsetSrc+=
|
|
|
|
-4),C.size===2?(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=I.x,C.array[J+3]=I.y,C.array[J+4]=M.x,C.array[J+5]=M.y,C.array[J+6]=va.x,C.array[J+7]=va.y,C.offset+=8):C.size===3?(C.type==="c"?(C.array[J]=Z.r,C.array[J+1]=Z.g,C.array[J+2]=Z.b,C.array[J+3]=I.r,C.array[J+4]=I.g,C.array[J+5]=I.b,C.array[J+6]=M.r,C.array[J+7]=M.g,C.array[J+8]=M.b,C.array[J+9]=va.r,C.array[J+10]=va.g,C.array[J+11]=va.b):(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=Z.z,C.array[J+3]=I.x,C.array[J+4]=I.y,C.array[J+5]=I.z,C.array[J+
|
|
|
|
-6]=M.x,C.array[J+7]=M.y,C.array[J+8]=M.z,C.array[J+9]=va.x,C.array[J+10]=va.y,C.array[J+11]=va.z),C.offset+=12):(C.array[J]=Z.x,C.array[J+1]=Z.y,C.array[J+2]=Z.z,C.array[J+3]=Z.w,C.array[J+4]=I.x,C.array[J+5]=I.y,C.array[J+6]=I.z,C.array[J+7]=I.w,C.array[J+8]=M.x,C.array[J+9]=M.y,C.array[J+10]=M.z,C.array[J+11]=M.w,C.array[J+12]=va.x,C.array[J+13]=va.y,C.array[J+14]=va.z,C.array[J+15]=va.w,C.offset+=16));if(Ga){J=0;for(C=La.length;J<C;J++)Z=La[J].vertices[B.a].position,I=La[J].vertices[B.b].position,
|
|
|
|
-M=La[J].vertices[B.c].position,va=La[J].vertices[B.d].position,O=la[J],O[aa]=Z.x,O[aa+1]=Z.y,O[aa+2]=Z.z,O[aa+3]=I.x,O[aa+4]=I.y,O[aa+5]=I.z,O[aa+6]=M.x,O[aa+7]=M.y,O[aa+8]=M.z,O[aa+9]=va.x,O[aa+10]=va.y,O[aa+11]=va.z;aa+=12}if(Ma.length)J=Ma[B.a],C=Ma[B.b],O=Ma[B.c],Q=Ma[B.d],ha[P]=J.x,ha[P+1]=J.y,ha[P+2]=J.z,ha[P+3]=J.w,ha[P+4]=C.x,ha[P+5]=C.y,ha[P+6]=C.z,ha[P+7]=C.w,ha[P+8]=O.x,ha[P+9]=O.y,ha[P+10]=O.z,ha[P+11]=O.w,ha[P+12]=Q.x,ha[P+13]=Q.y,ha[P+14]=Q.z,ha[P+15]=Q.w,J=Ua[B.a],C=Ua[B.b],O=Ua[B.c],
|
|
|
|
-Q=Ua[B.d],da[P]=J.x,da[P+1]=J.y,da[P+2]=J.z,da[P+3]=J.w,da[P+4]=C.x,da[P+5]=C.y,da[P+6]=C.z,da[P+7]=C.w,da[P+8]=O.x,da[P+9]=O.y,da[P+10]=O.z,da[P+11]=O.w,da[P+12]=Q.x,da[P+13]=Q.y,da[P+14]=Q.z,da[P+15]=Q.w,J=Sa[B.a],C=Sa[B.b],O=Sa[B.c],Q=Sa[B.d],ca[P]=J.x,ca[P+1]=J.y,ca[P+2]=J.z,ca[P+3]=1,ca[P+4]=C.x,ca[P+5]=C.y,ca[P+6]=C.z,ca[P+7]=1,ca[P+8]=O.x,ca[P+9]=O.y,ca[P+10]=O.z,ca[P+11]=1,ca[P+12]=Q.x,ca[P+13]=Q.y,ca[P+14]=Q.z,ca[P+15]=1,J=Ta[B.a],C=Ta[B.b],O=Ta[B.c],B=Ta[B.d],ia[P]=J.x,ia[P+1]=J.y,ia[P+
|
|
|
|
-2]=J.z,ia[P+3]=1,ia[P+4]=C.x,ia[P+5]=C.y,ia[P+6]=C.z,ia[P+7]=1,ia[P+8]=O.x,ia[P+9]=O.y,ia[P+10]=O.z,ia[P+11]=1,ia[P+12]=B.x,ia[P+13]=B.y,ia[P+14]=B.z,ia[P+15]=1,P+=16;if(Ia&&H)ma.length==4&&H==THREE.VertexColors?(B=ma[0],J=ma[1],C=ma[2],ma=ma[3]):ma=C=J=B=L,fa[T]=B.r,fa[T+1]=B.g,fa[T+2]=B.b,fa[T+3]=J.r,fa[T+4]=J.g,fa[T+5]=J.b,fa[T+6]=C.r,fa[T+7]=C.g,fa[T+8]=C.b,fa[T+9]=ma.r,fa[T+10]=ma.g,fa[T+11]=ma.b,T+=12;if(ya&&sa.hasTangents)ma=ga[0],L=ga[1],B=ga[2],ga=ga[3],$[R]=ma.x,$[R+1]=ma.y,$[R+2]=ma.z,
|
|
|
|
-$[R+3]=ma.w,$[R+4]=L.x,$[R+5]=L.y,$[R+6]=L.z,$[R+7]=L.w,$[R+8]=B.x,$[R+9]=B.y,$[R+10]=B.z,$[R+11]=B.w,$[R+12]=ga.x,$[R+13]=ga.y,$[R+14]=ga.z,$[R+15]=ga.w,R+=16;if(Da&&A)if(E.length==4&&Ha)for(ga=0;ga<4;ga++)ka=E[ga],za[U]=ka.x,za[U+1]=ka.y,za[U+2]=ka.z,U+=3;else for(ga=0;ga<4;ga++)za[U]=ka.x,za[U+1]=ka.y,za[U+2]=ka.z,U+=3;if(Ea&&x!==void 0&&u)for(ga=0;ga<4;ga++)E=x[ga],wa[S]=E.u,wa[S+1]=E.v,S+=2;if(Ea&&ea!==void 0&&u)for(ga=0;ga<4;ga++)E=ea[ga],oa[qa]=E.u,oa[qa+1]=E.v,qa+=2;Fa&&(ra[ua]=na,ra[ua+1]=
|
|
|
|
-na+1,ra[ua+2]=na+3,ra[ua+3]=na+1,ra[ua+4]=na+2,ra[ua+5]=na+3,ua+=6,Aa[Y]=na,Aa[Y+1]=na+1,Aa[Y+2]=na,Aa[Y+3]=na+3,Aa[Y+4]=na+1,Aa[Y+5]=na+2,Aa[Y+6]=na+2,Aa[Y+7]=na+3,Y+=8,na+=4)}Ca&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglVertexBuffer),o.bufferData(o.ARRAY_BUFFER,pa,y));if(ja)for(X in ja)C=ja[X],C.__original.needsUpdate&&(o.bindBuffer(o.ARRAY_BUFFER,C.buffer),o.bufferData(o.ARRAY_BUFFER,C.array,y));if(Ga){J=0;for(C=La.length;J<C;J++)o.bindBuffer(o.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[J]),o.bufferData(o.ARRAY_BUFFER,
|
|
|
|
-la[J],y)}Ia&&T>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglColorBuffer),o.bufferData(o.ARRAY_BUFFER,fa,y));Da&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglNormalBuffer),o.bufferData(o.ARRAY_BUFFER,za,y));ya&&sa.hasTangents&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglTangentBuffer),o.bufferData(o.ARRAY_BUFFER,$,y));Ea&&S>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUVBuffer),o.bufferData(o.ARRAY_BUFFER,wa,y));Ea&&qa>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglUV2Buffer),o.bufferData(o.ARRAY_BUFFER,oa,y));Fa&&(o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,
|
|
|
|
-t.__webglFaceBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,ra,y),o.bindBuffer(o.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,Aa,y));P>0&&(o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexABuffer),o.bufferData(o.ARRAY_BUFFER,ca,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),o.bufferData(o.ARRAY_BUFFER,ia,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),o.bufferData(o.ARRAY_BUFFER,da,y),o.bindBuffer(o.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),o.bufferData(o.ARRAY_BUFFER,
|
|
|
|
-ha,y));z&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;D(m)}else if(h instanceof THREE.Ribbon){k=
|
|
|
|
-h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=v=z=z=void 0;w=h.vertices;p=h.colors;u=w.length;t=p.length;H=h.__vertexArray;y=h.__colorArray;A=h.__dirtyColors;if(h.__dirtyVertices){for(z=0;z<u;z++)v=w[z].position,n=z*3,H[n]=v.x,H[n+1]=v.y,H[n+2]=v.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,H,m)}if(A){for(z=0;z<t;z++)color=p[z],n=z*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,
|
|
|
|
-y,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=o.DYNAMIC_DRAW;n=v=z=z=void 0;w=h.vertices;p=h.colors;u=w.length;t=p.length;H=h.__vertexArray;y=h.__colorArray;A=h.__dirtyColors;if(h.__dirtyVertices){for(z=0;z<u;z++)v=w[z].position,n=z*3,H[n]=v.x,H[n+1]=v.y,H[n+2]=v.z;o.bindBuffer(o.ARRAY_BUFFER,h.__webglVertexBuffer);o.bufferData(o.ARRAY_BUFFER,H,m)}if(A){for(z=0;z<t;z++)color=p[z],n=z*3,y[n]=color.r,y[n+1]=color.g,
|
|
|
|
-y[n+2]=color.b;o.bindBuffer(o.ARRAY_BUFFER,h.__webglColorBuffer);o.bufferData(o.ARRAY_BUFFER,y,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)k=h.geometry,t=F(k),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||t)&&c(k,o.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,D(k)};this.setFaceCulling=function(b,e){b?(!e||e=="ccw"?o.frontFace(o.CCW):o.frontFace(o.CW),b=="back"?o.cullFace(o.BACK):b=="front"?o.cullFace(o.FRONT):o.cullFace(o.FRONT_AND_BACK),
|
|
|
|
-o.enable(o.CULL_FACE)):o.disable(o.CULL_FACE)};this.supportsVertexTextures=function(){return Ia}};
|
|
|
|
|
|
+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");p.attachShader(y,Q("fragment",m+t));p.attachShader(y,Q("vertex",f+u));p.linkProgram(y);p.getProgramParameter(y,p.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+p.getProgramParameter(y,p.VALIDATE_STATUS)+", gl error ["+
|
|
|
|
+p.getError()+"]");y.uniforms={};y.attributes={};var L,f=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(L in o)f.push(L);L=f;f=0;for(o=L.length;f<o;f++)t=L[f],y.uniforms[t]=p.getUniformLocation(y,t);f=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(L=0;L<e.maxMorphTargets;L++)f.push("morphTarget"+L);for(x in c)f.push(x);
|
|
|
|
+x=f;L=0;for(c=x.length;L<c;L++)e=x[L],y.attributes[e]=p.getAttribLocation(y,e);y.id=V.length;V.push({program:y,code:n});S.info.memory.programs=V.length;x=y}b.program=x;x=b.program.attributes;x.position>=0&&p.enableVertexAttribArray(x.position);x.color>=0&&p.enableVertexAttribArray(x.color);x.normal>=0&&p.enableVertexAttribArray(x.normal);x.tangent>=0&&p.enableVertexAttribArray(x.tangent);b.skinning&&x.skinVertexA>=0&&x.skinVertexB>=0&&x.skinIndex>=0&&x.skinWeight>=0&&(p.enableVertexAttribArray(x.skinVertexA),
|
|
|
|
+p.enableVertexAttribArray(x.skinVertexB),p.enableVertexAttribArray(x.skinIndex),p.enableVertexAttribArray(x.skinWeight));if(b.attributes)for(h in b.attributes)x[h]!==void 0&&x[h]>=0&&p.enableVertexAttribArray(x[h]);if(b.morphTargets)for(h=b.numSupportedMorphTargets=0;h<this.maxMorphTargets;h++)L="morphTarget"+h,x[L]>=0&&(p.enableVertexAttribArray(x[L]),b.numSupportedMorphTargets++);b.uniformsList=[];for(k in b.uniforms)b.uniformsList.push([b.uniforms[k],k])};this.clearTarget=function(b,c,e,f){H(b);
|
|
|
|
+this.clear(c,e,f)};this.render=function(b,c,o,L){var M,fa,F,C,G,qa,B,la,J=b.lights,ca=b.fog;ha=-1;this.shadowMapEnabled&&y(b,c);S.info.render.calls=0;S.info.render.vertices=0;S.info.render.faces=0;if(c.matrixAutoUpdate){for(G=c;G.parent;)G=G.parent;G.update(void 0,!0)}b.update(void 0,!1,c);c.matrixWorldInverse.flattenToArray(Fa);c.projectionMatrix.flattenToArray(Ga);Ca.multiply(c.projectionMatrix,c.matrixWorldInverse);u(Ca);this.initWebGLObjects(b);H(o);(this.autoClear||L)&&this.clear(this.autoClearColor,
|
|
|
|
+this.autoClearDepth,this.autoClearStencil);G=b.__webglObjects.length;for(L=0;L<G;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),v(M),M.render=!0,this.sortObjects)M.object.renderDepth?M.z=M.object.renderDepth:(Da.copy(B.position),Ca.multiplyVector3(Da),M.z=Da.z)}else M.render=!1;else M.render=!1;this.sortObjects&&b.__webglObjects.sort(z);qa=b.__webglObjectsImmediate.length;for(L=
|
|
|
|
+0;L<qa;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<G;L++)if(M=b.__webglObjects[L],M.render)B=M.object,la=M.buffer,k(B),f(c,J,ca,b.overrideMaterial,la,B);for(L=0;L<qa;L++)M=b.__webglObjectsImmediate[L],B=M.object,B.visible&&(ga=-1,k(B),fa=e(c,J,ca,b.overrideMaterial,B),B.immediateRenderCallback?B.immediateRenderCallback(fa,
|
|
|
|
+p,ya):B.render(function(c){h(c,fa,b.overrideMaterial.shading)}))}else{K(THREE.NormalBlending);for(L=G-1;L>=0;L--)if(M=b.__webglObjects[L],M.render){B=M.object;la=M.buffer;F=M.opaque;k(B);for(M=0;M<F.count;M++)C=F.list[M],m(C.depthTest),n(C.depthWrite),t(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(c,J,ca,C,la,B)}for(L=0;L<qa;L++)if(M=b.__webglObjectsImmediate[L],B=M.object,B.visible){ga=-1;F=M.opaque;k(B);for(M=0;M<F.count;M++)C=F.list[M],m(C.depthTest),n(C.depthWrite),t(C.polygonOffset,
|
|
|
|
+C.polygonOffsetFactor,C.polygonOffsetUnits),fa=e(c,J,ca,C,B),B.immediateRenderCallback?B.immediateRenderCallback(fa,p,ya):B.render(function(b){h(b,fa,C.shading)})}for(L=0;L<G;L++)if(M=b.__webglObjects[L],M.render){B=M.object;la=M.buffer;F=M.transparent;k(B);for(M=0;M<F.count;M++)C=F.list[M],K(C.blending),m(C.depthTest),n(C.depthWrite),t(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),f(c,J,ca,C,la,B)}for(L=0;L<qa;L++)if(M=b.__webglObjectsImmediate[L],B=M.object,B.visible){ga=-1;F=M.transparent;
|
|
|
|
+k(B);for(M=0;M<F.count;M++)C=F.list[M],K(C.blending),m(C.depthTest),n(C.depthWrite),t(C.polygonOffset,C.polygonOffsetFactor,C.polygonOffsetUnits),fa=e(c,J,ca,C,B),B.immediateRenderCallback?B.immediateRenderCallback(fa,p,ya):B.render(function(b){h(b,fa,C.shading)})}}b.__webglSprites.length&&A(b,c);o&&o.minFilter!==THREE.NearestFilter&&o.minFilter!==THREE.LinearFilter&&T(o)};this.initWebGLObjects=function(b){if(!b.__webglObjects)b.__webglObjects=[],b.__webglObjectsImmediate=[],b.__webglSprites=[];for(;b.__objectsAdded.length;){var e=
|
|
|
|
+b.__objectsAdded[0],f=b,k=void 0,h=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(k in h=e.geometry,h.geometryGroups==void 0&&J(h),h.geometryGroups){if(m=h.geometryGroups[k],!m.__webglVertexBuffer){var n=m;n.__webglVertexBuffer=p.createBuffer();n.__webglNormalBuffer=
|
|
|
|
+p.createBuffer();n.__webglTangentBuffer=p.createBuffer();n.__webglColorBuffer=p.createBuffer();n.__webglUVBuffer=p.createBuffer();n.__webglUV2Buffer=p.createBuffer();n.__webglSkinVertexABuffer=p.createBuffer();n.__webglSkinVertexBBuffer=p.createBuffer();n.__webglSkinIndicesBuffer=p.createBuffer();n.__webglSkinWeightsBuffer=p.createBuffer();n.__webglFaceBuffer=p.createBuffer();n.__webglLineBuffer=p.createBuffer();if(n.numMorphTargets){var o=void 0,t=void 0;n.__webglMorphTargetsBuffers=[];o=0;for(t=
|
|
|
|
+n.numMorphTargets;o<t;o++)n.__webglMorphTargetsBuffers.push(p.createBuffer())}S.info.memory.geometries++;for(var n=e,u=void 0,v=void 0,w=void 0,x=w=void 0,L=void 0,y=void 0,z=y=o=0,M=w=v=void 0,w=t=M=v=u=void 0,x=n.geometry,L=x.faces,M=m.faces,u=0,v=M.length;u<v;u++)w=M[u],w=L[w],w instanceof THREE.Face3?(o+=3,y+=1,z+=3):w instanceof THREE.Face4&&(o+=4,y+=2,z+=4);for(var u=m,v=n,A=M=L=void 0,fa=void 0,A=void 0,w=[],L=0,M=v.materials.length;L<M;L++)if(A=v.materials[L],A instanceof THREE.MeshFaceMaterial){A=
|
|
|
|
+0;for(l=u.materials.length;A<l;A++)(fa=u.materials[A])&&w.push(fa)}else(fa=A)&&w.push(fa);u=w;m.__materials=u;a:{L=v=void 0;M=u.length;for(v=0;v<M;v++)if(L=u[v],L.map||L.lightMap||L instanceof THREE.ShaderMaterial){v=!0;break a}v=!1}a:{M=L=void 0;w=u.length;for(L=0;L<w;L++)if(M=u[L],!(M instanceof THREE.MeshBasicMaterial&&!M.envMap||M instanceof THREE.MeshDepthMaterial)){M=M&&M.shading!=void 0&&M.shading==THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;break a}M=!1}a:{w=L=void 0;A=u.length;
|
|
|
|
+for(L=0;L<A;L++)if(w=u[L],w.vertexColors){w=w.vertexColors;break a}w=!1}m.__vertexArray=new Float32Array(o*3);if(M)m.__normalArray=new Float32Array(o*3);if(x.hasTangents)m.__tangentArray=new Float32Array(o*4);if(w)m.__colorArray=new Float32Array(o*3);if(v){if(x.faceUvs.length>0||x.faceVertexUvs.length>0)m.__uvArray=new Float32Array(o*2);if(x.faceUvs.length>1||x.faceVertexUvs.length>1)m.__uv2Array=new Float32Array(o*2)}if(n.geometry.skinWeights.length&&n.geometry.skinIndices.length)m.__skinVertexAArray=
|
|
|
|
+new Float32Array(o*4),m.__skinVertexBArray=new Float32Array(o*4),m.__skinIndexArray=new Float32Array(o*4),m.__skinWeightArray=new Float32Array(o*4);m.__faceArray=new Uint16Array(y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0));m.__lineArray=new Uint16Array(z*2);if(m.numMorphTargets){m.__morphTargetsArrays=[];x=0;for(L=m.numMorphTargets;x<L;x++)m.__morphTargetsArrays.push(new Float32Array(o*3))}m.__needsSmoothNormals=M==THREE.SmoothShading;m.__uvType=v;m.__vertexColorType=w;m.__normalType=
|
|
|
|
+M;m.__webglFaceCount=y*3+(n.geometry.edgeFaces?n.geometry.edgeFaces.length*6:0);m.__webglLineCount=z*2;x=0;for(L=u.length;x<L;x++)if(v=u[x],v.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in v.attributes){w=v.attributes[a];M={};for(t in w)M[t]=w[t];if(!M.__webglInitialized||M.createUniqueBuffers)M.__webglInitialized=!0,y=1,M.type==="v2"?y=2:M.type==="v3"?y=3:M.type==="v4"?y=4:M.type==="c"&&(y=3),M.size=y,M.array=new Float32Array(o*y),M.buffer=p.createBuffer(),
|
|
|
|
+M.buffer.belongsToAttribute=a,w.needsUpdate=!0,M.__original=w;m.__webglCustomAttributes[a]=M}}m.__inittedArrays=!0;h.__dirtyVertices=!0;h.__dirtyMorphTargets=!0;h.__dirtyElements=!0;h.__dirtyUvs=!0;h.__dirtyNormals=!0;h.__dirtyTangents=!0;h.__dirtyColors=!0}}else if(e instanceof THREE.Ribbon){if(h=e.geometry,!h.__webglVertexBuffer)m=h,m.__webglVertexBuffer=p.createBuffer(),m.__webglColorBuffer=p.createBuffer(),S.info.memory.geometries++,m=h,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),
|
|
|
|
+m.__colorArray=new Float32Array(n*3),m.__webglVertexCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)m=h,m.__webglVertexBuffer=p.createBuffer(),m.__webglColorBuffer=p.createBuffer(),S.info.memory.geometries++,m=h,n=m.vertices.length,m.__vertexArray=new Float32Array(n*3),m.__colorArray=new Float32Array(n*3),m.__webglLineCount=n,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer)){m=
|
|
|
|
+h;m.__webglVertexBuffer=p.createBuffer();m.__webglColorBuffer=p.createBuffer();S.info.geometries++;m=h;n=e;o=m.vertices.length;m.__vertexArray=new Float32Array(o*3);m.__colorArray=new Float32Array(o*3);m.__sortArray=[];m.__webglParticleCount=o;m.__materials=n.materials;z=y=t=void 0;t=0;for(y=n.materials.length;t<y;t++)if(z=n.materials[t],z.attributes){if(m.__webglCustomAttributes===void 0)m.__webglCustomAttributes={};for(a in z.attributes){originalAttribute=z.attributes[a];attribute={};for(property in originalAttribute)attribute[property]=
|
|
|
|
+originalAttribute[property];if(!attribute.__webglInitialized||attribute.createUniqueBuffers)attribute.__webglInitialized=!0,size=1,attribute.type==="v2"?size=2:attribute.type==="v3"?size=3:attribute.type==="v4"?size=4:attribute.type==="c"&&(size=3),attribute.size=size,attribute.array=new Float32Array(o*size),attribute.buffer=p.createBuffer(),attribute.buffer.belongsToAttribute=a,originalAttribute.needsUpdate=!0,attribute.__original=originalAttribute;m.__webglCustomAttributes[a]=attribute}}h.__dirtyVertices=
|
|
|
|
+!0;h.__dirtyColors=!0}if(!e.__webglActive){if(e instanceof THREE.Mesh)for(k in h=e.geometry,h.geometryGroups)m=h.geometryGroups[k],O(f.__webglObjects,m,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?(h=e.geometry,O(f.__webglObjects,h,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)G(f.__webglObjects,e);else if(e instanceof THREE.Sprite){f=f.__webglSprites;k=e;h=void 0;for(h=f.length-1;h>=0;h--)f[h]==k&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&G(f.__webglObjectsImmediate,e);e.__webglActive=!1;b.__objectsRemoved.splice(0,
|
|
|
|
+1)}e=0;for(f=b.__webglObjects.length;e<f;e++)if(h=b.__webglObjects[e].object,t=m=k=void 0,h instanceof THREE.Mesh){k=h.geometry;n=0;for(o=k.geometryGroupsList.length;n<o;n++)if(m=k.geometryGroupsList[n],t=F(m),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||t)if(t=m,y=p.DYNAMIC_DRAW,z=!k.dynamic,t.__inittedArrays){var E=u=x=void 0,B=void 0,qa=E=void 0,la=void 0,K=void 0,H=void 0,ca=fa=A=w=M=L=v=void 0,ma=void 0,N=void 0,
|
|
|
|
+I=B=H=B=K=la=void 0,D=void 0,P=D=I=la=void 0,Q=void 0,W=P=D=I=E=E=qa=H=B=P=D=I=Q=P=D=I=Q=P=D=I=void 0,U=0,pa=0,ra=0,T=0,Y=0,V=0,ua=0,oa=0,Z=0,R=0,X=0,P=I=0,P=void 0,$=t.__vertexArray,ia=t.__uvArray,Ea=t.__uv2Array,ga=t.__normalArray,ha=t.__tangentArray,da=t.__colorArray,ja=t.__skinVertexAArray,sa=t.__skinVertexBArray,aa=t.__skinIndexArray,ea=t.__skinWeightArray,na=t.__morphTargetsArrays,ka=t.__webglCustomAttributes,D=void 0,Ba=t.__faceArray,ta=t.__lineArray,ya=t.__needsSmoothNormals,L=t.__vertexColorType,
|
|
|
|
+v=t.__uvType,M=t.__normalType,va=h.geometry,Ia=va.__dirtyVertices,Ca=va.__dirtyElements,Ha=va.__dirtyUvs,Ga=va.__dirtyNormals,Da=va.__dirtyTangents,Fa=va.__dirtyColors,Ka=va.__dirtyMorphTargets,za=va.vertices,Xa=t.faces,fb=va.faces,cb=va.faceVertexUvs[0],db=va.faceVertexUvs[1],Ra=va.skinVerticesA,Sa=va.skinVerticesB,Ta=va.skinIndices,Ma=va.skinWeights,La=va.morphTargets;if(ka)for(W in ka)ka[W].offset=0,ka[W].offsetSrc=0;x=0;for(u=Xa.length;x<u;x++)if(E=Xa[x],B=fb[E],cb&&(w=cb[E]),db&&(A=db[E]),E=
|
|
|
|
+B.vertexNormals,qa=B.normal,la=B.vertexColors,K=B.color,H=B.vertexTangents,B instanceof THREE.Face3){if(Ia)fa=za[B.a].position,ca=za[B.b].position,ma=za[B.c].position,$[pa]=fa.x,$[pa+1]=fa.y,$[pa+2]=fa.z,$[pa+3]=ca.x,$[pa+4]=ca.y,$[pa+5]=ca.z,$[pa+6]=ma.x,$[pa+7]=ma.y,$[pa+8]=ma.z,pa+=9;if(ka)for(W in ka)if(D=ka[W],D.__original.needsUpdate)I=D.offset,P=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[I]=D.value[B.a],D.array[I+1]=D.value[B.b],D.array[I+2]=D.value[B.c]):D.boundTo===
|
|
|
|
+"faces"?(P=D.value[P],D.array[I]=P,D.array[I+1]=P,D.array[I+2]=P,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[I]=D.value[P],D.array[I+1]=D.value[P+1],D.array[I+2]=D.value[P+2],D.offsetSrc+=3),D.offset+=3):(D.boundTo===void 0||D.boundTo==="vertices"?(fa=D.value[B.a],ca=D.value[B.b],ma=D.value[B.c]):D.boundTo==="faces"?(ma=ca=fa=P=D.value[P],D.offsetSrc++):D.boundTo==="faceVertices"&&(fa=D.value[P],ca=D.value[P+1],ma=D.value[P+2],D.offsetSrc+=3),D.size===2?(D.array[I]=fa.x,D.array[I+1]=fa.y,
|
|
|
|
+D.array[I+2]=ca.x,D.array[I+3]=ca.y,D.array[I+4]=ma.x,D.array[I+5]=ma.y,D.offset+=6):D.size===3?(D.type==="c"?(D.array[I]=fa.r,D.array[I+1]=fa.g,D.array[I+2]=fa.b,D.array[I+3]=ca.r,D.array[I+4]=ca.g,D.array[I+5]=ca.b,D.array[I+6]=ma.r,D.array[I+7]=ma.g,D.array[I+8]=ma.b):(D.array[I]=fa.x,D.array[I+1]=fa.y,D.array[I+2]=fa.z,D.array[I+3]=ca.x,D.array[I+4]=ca.y,D.array[I+5]=ca.z,D.array[I+6]=ma.x,D.array[I+7]=ma.y,D.array[I+8]=ma.z),D.offset+=9):(D.array[I]=fa.x,D.array[I+1]=fa.y,D.array[I+2]=fa.z,D.array[I+
|
|
|
|
+3]=fa.w,D.array[I+4]=ca.x,D.array[I+5]=ca.y,D.array[I+6]=ca.z,D.array[I+7]=ca.w,D.array[I+8]=ma.x,D.array[I+9]=ma.y,D.array[I+10]=ma.z,D.array[I+11]=ma.w,D.offset+=12));if(Ka){I=0;for(D=La.length;I<D;I++)fa=La[I].vertices[B.a].position,ca=La[I].vertices[B.b].position,ma=La[I].vertices[B.c].position,P=na[I],P[X]=fa.x,P[X+1]=fa.y,P[X+2]=fa.z,P[X+3]=ca.x,P[X+4]=ca.y,P[X+5]=ca.z,P[X+6]=ma.x,P[X+7]=ma.y,P[X+8]=ma.z;X+=9}if(Ma.length)I=Ma[B.a],D=Ma[B.b],P=Ma[B.c],ea[R]=I.x,ea[R+1]=I.y,ea[R+2]=I.z,ea[R+
|
|
|
|
+3]=I.w,ea[R+4]=D.x,ea[R+5]=D.y,ea[R+6]=D.z,ea[R+7]=D.w,ea[R+8]=P.x,ea[R+9]=P.y,ea[R+10]=P.z,ea[R+11]=P.w,I=Ta[B.a],D=Ta[B.b],P=Ta[B.c],aa[R]=I.x,aa[R+1]=I.y,aa[R+2]=I.z,aa[R+3]=I.w,aa[R+4]=D.x,aa[R+5]=D.y,aa[R+6]=D.z,aa[R+7]=D.w,aa[R+8]=P.x,aa[R+9]=P.y,aa[R+10]=P.z,aa[R+11]=P.w,I=Ra[B.a],D=Ra[B.b],P=Ra[B.c],ja[R]=I.x,ja[R+1]=I.y,ja[R+2]=I.z,ja[R+3]=1,ja[R+4]=D.x,ja[R+5]=D.y,ja[R+6]=D.z,ja[R+7]=1,ja[R+8]=P.x,ja[R+9]=P.y,ja[R+10]=P.z,ja[R+11]=1,I=Sa[B.a],D=Sa[B.b],P=Sa[B.c],sa[R]=I.x,sa[R+1]=I.y,sa[R+
|
|
|
|
+2]=I.z,sa[R+3]=1,sa[R+4]=D.x,sa[R+5]=D.y,sa[R+6]=D.z,sa[R+7]=1,sa[R+8]=P.x,sa[R+9]=P.y,sa[R+10]=P.z,sa[R+11]=1,R+=12;if(Fa&&L)la.length==3&&L==THREE.VertexColors?(B=la[0],I=la[1],D=la[2]):D=I=B=K,da[Z]=B.r,da[Z+1]=B.g,da[Z+2]=B.b,da[Z+3]=I.r,da[Z+4]=I.g,da[Z+5]=I.b,da[Z+6]=D.r,da[Z+7]=D.g,da[Z+8]=D.b,Z+=9;if(Da&&va.hasTangents)la=H[0],K=H[1],B=H[2],ha[ua]=la.x,ha[ua+1]=la.y,ha[ua+2]=la.z,ha[ua+3]=la.w,ha[ua+4]=K.x,ha[ua+5]=K.y,ha[ua+6]=K.z,ha[ua+7]=K.w,ha[ua+8]=B.x,ha[ua+9]=B.y,ha[ua+10]=B.z,ha[ua+
|
|
|
|
+11]=B.w,ua+=12;if(Ga&&M)if(E.length==3&&ya)for(H=0;H<3;H++)qa=E[H],ga[V]=qa.x,ga[V+1]=qa.y,ga[V+2]=qa.z,V+=3;else for(H=0;H<3;H++)ga[V]=qa.x,ga[V+1]=qa.y,ga[V+2]=qa.z,V+=3;if(Ha&&w!==void 0&&v)for(H=0;H<3;H++)E=w[H],ia[ra]=E.u,ia[ra+1]=E.v,ra+=2;if(Ha&&A!==void 0&&v)for(H=0;H<3;H++)E=A[H],Ea[T]=E.u,Ea[T+1]=E.v,T+=2;Ca&&(Ba[Y]=U,Ba[Y+1]=U+1,Ba[Y+2]=U+2,Y+=3,ta[oa]=U,ta[oa+1]=U+1,ta[oa+2]=U,ta[oa+3]=U+2,ta[oa+4]=U+1,ta[oa+5]=U+2,oa+=6,U+=3)}else if(B instanceof THREE.Face4){if(Ia)fa=za[B.a].position,
|
|
|
|
+ca=za[B.b].position,ma=za[B.c].position,N=za[B.d].position,$[pa]=fa.x,$[pa+1]=fa.y,$[pa+2]=fa.z,$[pa+3]=ca.x,$[pa+4]=ca.y,$[pa+5]=ca.z,$[pa+6]=ma.x,$[pa+7]=ma.y,$[pa+8]=ma.z,$[pa+9]=N.x,$[pa+10]=N.y,$[pa+11]=N.z,pa+=12;if(ka)for(W in ka)if(D=ka[W],D.__original.needsUpdate)I=D.offset,P=D.offsetSrc,D.size===1?(D.boundTo===void 0||D.boundTo==="vertices"?(D.array[I]=D.value[B.a],D.array[I+1]=D.value[B.b],D.array[I+2]=D.value[B.c],D.array[I+3]=D.value[B.d]):D.boundTo==="faces"?(P=D.value[P],D.array[I]=
|
|
|
|
+P,D.array[I+1]=P,D.array[I+2]=P,D.array[I+3]=P,D.offsetSrc++):D.boundTo==="faceVertices"&&(D.array[I]=D.value[P],D.array[I+1]=D.value[P+1],D.array[I+2]=D.value[P+2],D.array[I+3]=D.value[P+3],D.offsetSrc+=4),D.offset+=4):(D.boundTo===void 0||D.boundTo==="vertices"?(fa=D.value[B.a],ca=D.value[B.b],ma=D.value[B.c],N=D.value[B.d]):D.boundTo==="faces"?(N=ma=ca=fa=P=D.value[P],D.offsetSrc++):D.boundTo==="faceVertices"&&(fa=D.value[P],ca=D.value[P+1],ma=D.value[P+2],N=D.value[P+3],D.offsetSrc+=4),D.size===
|
|
|
|
+2?(D.array[I]=fa.x,D.array[I+1]=fa.y,D.array[I+2]=ca.x,D.array[I+3]=ca.y,D.array[I+4]=ma.x,D.array[I+5]=ma.y,D.array[I+6]=N.x,D.array[I+7]=N.y,D.offset+=8):D.size===3?(D.type==="c"?(D.array[I]=fa.r,D.array[I+1]=fa.g,D.array[I+2]=fa.b,D.array[I+3]=ca.r,D.array[I+4]=ca.g,D.array[I+5]=ca.b,D.array[I+6]=ma.r,D.array[I+7]=ma.g,D.array[I+8]=ma.b,D.array[I+9]=N.r,D.array[I+10]=N.g,D.array[I+11]=N.b):(D.array[I]=fa.x,D.array[I+1]=fa.y,D.array[I+2]=fa.z,D.array[I+3]=ca.x,D.array[I+4]=ca.y,D.array[I+5]=ca.z,
|
|
|
|
+D.array[I+6]=ma.x,D.array[I+7]=ma.y,D.array[I+8]=ma.z,D.array[I+9]=N.x,D.array[I+10]=N.y,D.array[I+11]=N.z),D.offset+=12):(D.array[I]=fa.x,D.array[I+1]=fa.y,D.array[I+2]=fa.z,D.array[I+3]=fa.w,D.array[I+4]=ca.x,D.array[I+5]=ca.y,D.array[I+6]=ca.z,D.array[I+7]=ca.w,D.array[I+8]=ma.x,D.array[I+9]=ma.y,D.array[I+10]=ma.z,D.array[I+11]=ma.w,D.array[I+12]=N.x,D.array[I+13]=N.y,D.array[I+14]=N.z,D.array[I+15]=N.w,D.offset+=16));if(Ka){I=0;for(D=La.length;I<D;I++)fa=La[I].vertices[B.a].position,ca=La[I].vertices[B.b].position,
|
|
|
|
+ma=La[I].vertices[B.c].position,N=La[I].vertices[B.d].position,P=na[I],P[X]=fa.x,P[X+1]=fa.y,P[X+2]=fa.z,P[X+3]=ca.x,P[X+4]=ca.y,P[X+5]=ca.z,P[X+6]=ma.x,P[X+7]=ma.y,P[X+8]=ma.z,P[X+9]=N.x,P[X+10]=N.y,P[X+11]=N.z;X+=12}if(Ma.length)I=Ma[B.a],D=Ma[B.b],P=Ma[B.c],Q=Ma[B.d],ea[R]=I.x,ea[R+1]=I.y,ea[R+2]=I.z,ea[R+3]=I.w,ea[R+4]=D.x,ea[R+5]=D.y,ea[R+6]=D.z,ea[R+7]=D.w,ea[R+8]=P.x,ea[R+9]=P.y,ea[R+10]=P.z,ea[R+11]=P.w,ea[R+12]=Q.x,ea[R+13]=Q.y,ea[R+14]=Q.z,ea[R+15]=Q.w,I=Ta[B.a],D=Ta[B.b],P=Ta[B.c],Q=Ta[B.d],
|
|
|
|
+aa[R]=I.x,aa[R+1]=I.y,aa[R+2]=I.z,aa[R+3]=I.w,aa[R+4]=D.x,aa[R+5]=D.y,aa[R+6]=D.z,aa[R+7]=D.w,aa[R+8]=P.x,aa[R+9]=P.y,aa[R+10]=P.z,aa[R+11]=P.w,aa[R+12]=Q.x,aa[R+13]=Q.y,aa[R+14]=Q.z,aa[R+15]=Q.w,I=Ra[B.a],D=Ra[B.b],P=Ra[B.c],Q=Ra[B.d],ja[R]=I.x,ja[R+1]=I.y,ja[R+2]=I.z,ja[R+3]=1,ja[R+4]=D.x,ja[R+5]=D.y,ja[R+6]=D.z,ja[R+7]=1,ja[R+8]=P.x,ja[R+9]=P.y,ja[R+10]=P.z,ja[R+11]=1,ja[R+12]=Q.x,ja[R+13]=Q.y,ja[R+14]=Q.z,ja[R+15]=1,I=Sa[B.a],D=Sa[B.b],P=Sa[B.c],B=Sa[B.d],sa[R]=I.x,sa[R+1]=I.y,sa[R+2]=I.z,sa[R+
|
|
|
|
+3]=1,sa[R+4]=D.x,sa[R+5]=D.y,sa[R+6]=D.z,sa[R+7]=1,sa[R+8]=P.x,sa[R+9]=P.y,sa[R+10]=P.z,sa[R+11]=1,sa[R+12]=B.x,sa[R+13]=B.y,sa[R+14]=B.z,sa[R+15]=1,R+=16;if(Fa&&L)la.length==4&&L==THREE.VertexColors?(B=la[0],I=la[1],D=la[2],la=la[3]):la=D=I=B=K,da[Z]=B.r,da[Z+1]=B.g,da[Z+2]=B.b,da[Z+3]=I.r,da[Z+4]=I.g,da[Z+5]=I.b,da[Z+6]=D.r,da[Z+7]=D.g,da[Z+8]=D.b,da[Z+9]=la.r,da[Z+10]=la.g,da[Z+11]=la.b,Z+=12;if(Da&&va.hasTangents)la=H[0],K=H[1],B=H[2],H=H[3],ha[ua]=la.x,ha[ua+1]=la.y,ha[ua+2]=la.z,ha[ua+3]=la.w,
|
|
|
|
+ha[ua+4]=K.x,ha[ua+5]=K.y,ha[ua+6]=K.z,ha[ua+7]=K.w,ha[ua+8]=B.x,ha[ua+9]=B.y,ha[ua+10]=B.z,ha[ua+11]=B.w,ha[ua+12]=H.x,ha[ua+13]=H.y,ha[ua+14]=H.z,ha[ua+15]=H.w,ua+=16;if(Ga&&M)if(E.length==4&&ya)for(H=0;H<4;H++)qa=E[H],ga[V]=qa.x,ga[V+1]=qa.y,ga[V+2]=qa.z,V+=3;else for(H=0;H<4;H++)ga[V]=qa.x,ga[V+1]=qa.y,ga[V+2]=qa.z,V+=3;if(Ha&&w!==void 0&&v)for(H=0;H<4;H++)E=w[H],ia[ra]=E.u,ia[ra+1]=E.v,ra+=2;if(Ha&&A!==void 0&&v)for(H=0;H<4;H++)E=A[H],Ea[T]=E.u,Ea[T+1]=E.v,T+=2;Ca&&(Ba[Y]=U,Ba[Y+1]=U+1,Ba[Y+
|
|
|
|
+2]=U+3,Ba[Y+3]=U+1,Ba[Y+4]=U+2,Ba[Y+5]=U+3,Y+=6,ta[oa]=U,ta[oa+1]=U+1,ta[oa+2]=U,ta[oa+3]=U+3,ta[oa+4]=U+1,ta[oa+5]=U+2,ta[oa+6]=U+2,ta[oa+7]=U+3,oa+=8,U+=4)}Ia&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglVertexBuffer),p.bufferData(p.ARRAY_BUFFER,$,y));if(ka)for(W in ka)D=ka[W],D.__original.needsUpdate&&(p.bindBuffer(p.ARRAY_BUFFER,D.buffer),p.bufferData(p.ARRAY_BUFFER,D.array,y));if(Ka){I=0;for(D=La.length;I<D;I++)p.bindBuffer(p.ARRAY_BUFFER,t.__webglMorphTargetsBuffers[I]),p.bufferData(p.ARRAY_BUFFER,
|
|
|
|
+na[I],y)}Fa&&Z>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglColorBuffer),p.bufferData(p.ARRAY_BUFFER,da,y));Ga&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglNormalBuffer),p.bufferData(p.ARRAY_BUFFER,ga,y));Da&&va.hasTangents&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglTangentBuffer),p.bufferData(p.ARRAY_BUFFER,ha,y));Ha&&ra>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglUVBuffer),p.bufferData(p.ARRAY_BUFFER,ia,y));Ha&&T>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglUV2Buffer),p.bufferData(p.ARRAY_BUFFER,Ea,y));Ca&&(p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,
|
|
|
|
+t.__webglFaceBuffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,Ba,y),p.bindBuffer(p.ELEMENT_ARRAY_BUFFER,t.__webglLineBuffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,ta,y));R>0&&(p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinVertexABuffer),p.bufferData(p.ARRAY_BUFFER,ja,y),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinVertexBBuffer),p.bufferData(p.ARRAY_BUFFER,sa,y),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinIndicesBuffer),p.bufferData(p.ARRAY_BUFFER,aa,y),p.bindBuffer(p.ARRAY_BUFFER,t.__webglSkinWeightsBuffer),p.bufferData(p.ARRAY_BUFFER,
|
|
|
|
+ea,y));z&&(delete t.__inittedArrays,delete t.__colorArray,delete t.__normalArray,delete t.__tangentArray,delete t.__uvArray,delete t.__uv2Array,delete t.__faceArray,delete t.__vertexArray,delete t.__lineArray,delete t.__skinVertexAArray,delete t.__skinVertexBArray,delete t.__skinIndexArray,delete t.__skinWeightArray)}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyTangents=!1;k.__dirtyColors=!1;C(m)}else if(h instanceof THREE.Ribbon){k=
|
|
|
|
+h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=p.DYNAMIC_DRAW;n=x=z=z=void 0;u=h.vertices;o=h.colors;v=u.length;t=o.length;L=h.__vertexArray;y=h.__colorArray;M=h.__dirtyColors;if(h.__dirtyVertices){for(z=0;z<v;z++)x=u[z].position,n=z*3,L[n]=x.x,L[n+1]=x.y,L[n+2]=x.z;p.bindBuffer(p.ARRAY_BUFFER,h.__webglVertexBuffer);p.bufferData(p.ARRAY_BUFFER,L,m)}if(M){for(z=0;z<t;z++)color=o[z],n=z*3,y[n]=color.r,y[n+1]=color.g,y[n+2]=color.b;p.bindBuffer(p.ARRAY_BUFFER,h.__webglColorBuffer);p.bufferData(p.ARRAY_BUFFER,
|
|
|
|
+y,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.Line){k=h.geometry;if(k.__dirtyVertices||k.__dirtyColors){h=k;m=p.DYNAMIC_DRAW;n=x=z=z=void 0;u=h.vertices;o=h.colors;v=u.length;t=o.length;L=h.__vertexArray;y=h.__colorArray;M=h.__dirtyColors;if(h.__dirtyVertices){for(z=0;z<v;z++)x=u[z].position,n=z*3,L[n]=x.x,L[n+1]=x.y,L[n+2]=x.z;p.bindBuffer(p.ARRAY_BUFFER,h.__webglVertexBuffer);p.bufferData(p.ARRAY_BUFFER,L,m)}if(M){for(z=0;z<t;z++)color=o[z],n=z*3,y[n]=color.r,y[n+1]=color.g,
|
|
|
|
+y[n+2]=color.b;p.bindBuffer(p.ARRAY_BUFFER,h.__webglColorBuffer);p.bufferData(p.ARRAY_BUFFER,y,m)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(h instanceof THREE.ParticleSystem)k=h.geometry,t=F(k),(k.__dirtyVertices||k.__dirtyColors||h.sortParticles||t)&&c(k,p.DYNAMIC_DRAW,h),k.__dirtyVertices=!1,k.__dirtyColors=!1,C(k)};this.setFaceCulling=function(b,c){b?(!c||c=="ccw"?p.frontFace(p.CCW):p.frontFace(p.CW),b=="back"?p.cullFace(p.BACK):b=="front"?p.cullFace(p.FRONT):p.cullFace(p.FRONT_AND_BACK),
|
|
|
|
+p.enable(p.CULL_FACE)):p.disable(p.CULL_FACE)};this.supportsVertexTextures=function(){return Ha}};
|
|
THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
|
|
THREE.WebGLRenderTarget=function(b,c,e){this.width=b;this.height=c;e=e||{};this.wrapS=e.wrapS!==void 0?e.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=e.wrapT!==void 0?e.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=e.magFilter!==void 0?e.magFilter:THREE.LinearFilter;this.minFilter=e.minFilter!==void 0?e.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=e.format!==void 0?e.format:THREE.RGBAFormat;this.type=e.type!==void 0?e.type:
|
|
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
|
|
THREE.UnsignedByteType;this.depthBuffer=e.depthBuffer!==void 0?e.depthBuffer:!0;this.stencilBuffer=e.stencilBuffer!==void 0?e.stencilBuffer:!0};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,e){THREE.WebGLRenderTarget.call(this,b,c,e);this.activeCubeFace=0};
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var b=new THREE.WebGLRenderTarget(this.width,this.height);b.wrapS=this.wrapS;b.wrapT=this.wrapT;b.magFilter=this.magFilter;b.minFilter=this.minFilter;b.offset.copy(this.offset);b.repeat.copy(this.repeat);b.format=this.format;b.type=this.type;b.depthBuffer=this.depthBuffer;b.stencilBuffer=this.stencilBuffer;return b};THREE.WebGLRenderTargetCube=function(b,c,e){THREE.WebGLRenderTarget.call(this,b,c,e);this.activeCubeFace=0};
|
|
@@ -346,18 +346,18 @@ 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.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},
|
|
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};
|
|
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,u=k.faces,v=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 p=0,x=n.length;p<x;p++){var w=new THREE.Vertex(n[p].position.clone());e&&e.multiplyVector3(w.position);m.push(w)}p=0;for(x=u.length;p<x;p++){var w=u[p],z,y,A=w.vertexNormals,
|
|
|
|
-E=w.vertexColors;w instanceof THREE.Face3?z=new THREE.Face3(w.a+h,w.b+h,w.c+h):w instanceof THREE.Face4&&(z=new THREE.Face4(w.a+h,w.b+h,w.c+h,w.d+h));z.normal.copy(w.normal);f&&f.multiplyVector3(z.normal);m=0;for(n=A.length;m<n;m++)y=A[m].clone(),f&&f.multiplyVector3(y),z.vertexNormals.push(y);z.color.copy(w.color);m=0;for(n=E.length;m<n;m++)y=E[m],z.vertexColors.push(y.clone());z.materials=w.materials.slice();z.centroid.copy(w.centroid);e&&e.multiplyVector3(z.centroid);t.push(z)}p=0;for(x=k.length;p<
|
|
|
|
-x;p++){e=k[p];f=[];m=0;for(n=e.length;m<n;m++)f.push(new THREE.UV(e[m].u,e[m].v));v.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,u,v=n.vertexNormals,p=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=v.length;f<m;f++)u=v[f],t.vertexNormals.push(u.clone());t.color.copy(n.color);f=0;for(m=p.length;f<m;f++)u=p[f],t.vertexColors.push(u.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,t=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 o=0,x=n.length;o<x;o++){var v=new THREE.Vertex(n[o].position.clone());e&&e.multiplyVector3(v.position);m.push(v)}o=0;for(x=u.length;o<x;o++){var v=u[o],z,y,A=v.vertexNormals,
|
|
|
|
+E=v.vertexColors;v instanceof THREE.Face3?z=new THREE.Face3(v.a+h,v.b+h,v.c+h):v instanceof THREE.Face4&&(z=new THREE.Face4(v.a+h,v.b+h,v.c+h,v.d+h));z.normal.copy(v.normal);f&&f.multiplyVector3(z.normal);m=0;for(n=A.length;m<n;m++)y=A[m].clone(),f&&f.multiplyVector3(y),z.vertexNormals.push(y);z.color.copy(v.color);m=0;for(n=E.length;m<n;m++)y=E[m],z.vertexColors.push(y.clone());z.materials=v.materials.slice();z.centroid.copy(v.centroid);e&&e.multiplyVector3(z.centroid);t.push(z)}o=0;for(x=k.length;o<
|
|
|
|
+x;o++){e=k[o];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,u,w=n.vertexNormals,o=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++)u=w[f],t.vertexNormals.push(u.clone());t.color.copy(n.color);f=0;for(m=o.length;f<m;f++)u=o[f],t.vertexColors.push(u.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();
|
|
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,
|
|
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 k=c+Math.floor((f-c)/2);return u[k]>
|
|
|
|
-b?e(c,k-1):u[k]<b?e(k+1,f):k}return e(0,u.length-1)}var f,h,k=b.faces,m=b.vertices,n=k.length,t=0,u=[],v,p,x,w;for(h=0;h<n;h++){f=k[h];if(f instanceof THREE.Face3)v=m[f.a].position,p=m[f.b].position,x=m[f.c].position,f._area=THREE.GeometryUtils.triangleArea(v,p,x);else if(f instanceof THREE.Face4)v=m[f.a].position,p=m[f.b].position,x=m[f.c].position,w=m[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(v,p,w),f._area2=THREE.GeometryUtils.triangleArea(p,x,w),f._area=f._area1+f._area2;t+=f._area;
|
|
|
|
|
|
+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 c(e,f){if(f<e)return e;var k=e+Math.floor((f-e)/2);return u[k]>
|
|
|
|
+b?c(e,k-1):u[k]<b?c(k+1,f):k}return c(0,u.length-1)}var f,h,k=b.faces,m=b.vertices,n=k.length,t=0,u=[],w,o,x,v;for(h=0;h<n;h++){f=k[h];if(f instanceof THREE.Face3)w=m[f.a].position,o=m[f.b].position,x=m[f.c].position,f._area=THREE.GeometryUtils.triangleArea(w,o,x);else if(f instanceof THREE.Face4)w=m[f.a].position,o=m[f.b].position,x=m[f.c].position,v=m[f.d].position,f._area1=THREE.GeometryUtils.triangleArea(w,o,v),f._area2=THREE.GeometryUtils.triangleArea(o,x,v),f._area=f._area1+f._area2;t+=f._area;
|
|
u[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*
|
|
u[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*
|
|
(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;
|
|
(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),u=t.data,v=0;v<f;v++)for(var p=1;p<h;p++){var x=p-1<0?h-1:p-1,w=(p+1)%h,z=v-1<0?f-1:v-1,y=(v+1)%f,A=[],E=[0,0,n[(p*f+v)*4]/255*c];A.push([-1,0,n[(p*f+z)*4]/255*c]);A.push([-1,-1,n[(x*f+z)*4]/255*c]);A.push([0,-1,n[(x*f+v)*4]/255*c]);A.push([1,-1,n[(x*f+y)*4]/255*c]);
|
|
|
|
-A.push([1,0,n[(p*f+y)*4]/255*c]);A.push([1,1,n[(w*f+y)*4]/255*c]);A.push([0,1,n[(w*f+v)*4]/255*c]);A.push([-1,1,n[(w*f+z)*4]/255*c]);x=[];z=A.length;for(w=0;w<z;w++){var y=A[w],F=A[(w+1)%z],y=[y[0]-E[0],y[1]-E[1],y[2]-E[2]],F=[F[0]-E[0],F[1]-E[1],F[2]-E[2]];x.push(e([y[1]*F[2]-y[2]*F[1],y[2]*F[0]-y[0]*F[2],y[0]*F[1]-y[1]*F[0]]))}A=[0,0,0];for(w=0;w<x.length;w++)A[0]+=x[w][0],A[1]+=x[w][1],A[2]+=x[w][2];A[0]/=x.length;A[1]/=x.length;A[2]/=x.length;E=(p*f+v)*4;u[E]=(A[0]+1)/2*255|0;u[E+1]=(A[1]+0.5)*
|
|
|
|
|
|
+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 c=Math.sqrt(b[0]*b[0]+b[1]*b[1]+
|
|
|
|
+b[2]*b[2]);return[b[0]/c,b[1]/c,b[2]/c]};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),u=t.data,w=0;w<f;w++)for(var o=1;o<h;o++){var x=o-1<0?h-1:o-1,v=(o+1)%h,z=w-1<0?f-1:w-1,y=(w+1)%f,A=[],E=[0,0,n[(o*f+w)*4]/255*c];A.push([-1,0,n[(o*f+z)*4]/255*c]);A.push([-1,-1,n[(x*f+z)*4]/255*c]);A.push([0,-1,n[(x*f+w)*4]/255*c]);A.push([1,-1,n[(x*f+y)*4]/255*c]);
|
|
|
|
+A.push([1,0,n[(o*f+y)*4]/255*c]);A.push([1,1,n[(v*f+y)*4]/255*c]);A.push([0,1,n[(v*f+w)*4]/255*c]);A.push([-1,1,n[(v*f+z)*4]/255*c]);x=[];z=A.length;for(v=0;v<z;v++){var y=A[v],F=A[(v+1)%z],y=[y[0]-E[0],y[1]-E[1],y[2]-E[2]],F=[F[0]-E[0],F[1]-E[1],F[2]-E[2]];x.push(e([y[1]*F[2]-y[2]*F[1],y[2]*F[0]-y[0]*F[2],y[0]*F[1]-y[1]*F[0]]))}A=[0,0,0];for(v=0;v<x.length;v++)A[0]+=x[v][0],A[1]+=x[v][1],A[2]+=x[v][2];A[0]/=x.length;A[1]/=x.length;A[2]/=x.length;E=(o*f+w)*4;u[E]=(A[0]+1)/2*255|0;u[E+1]=(A[1]+0.5)*
|
|
255|0;u[E+2]=A[2]*255|0;u[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)}};
|
|
255|0;u[E+2]=A[2]*255|0;u[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)}};
|
|
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}",
|
|
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}"},
|
|
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}"},
|
|
@@ -397,36 +397,36 @@ THREE.Path.prototype.quadraticCurveTo=function(b,c,e,f){var h=Array.prototype.sl
|
|
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.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.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.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,u,v,p,x,w,z,y;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];p=k[0];x=k[1];e.length>0?(m=e[e.length-1],w=m.x,z=m.y):(m=this.actions[f-1].args,w=m[m.length-2],z=m[m.length-1]);for(m=1;m<=b;m++)y=m/b,k=THREE.Shape.Utils.b2(y,w,p,n),y=THREE.Shape.Utils.b2(y,z,x,
|
|
|
|
-t),e.push(new THREE.Vector2(k,y));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];t=k[5];p=k[0];x=k[1];u=k[2];v=k[3];e.length>0?(m=e[e.length-1],w=m.x,z=m.y):(m=this.actions[f-1].args,w=m[m.length-2],z=m[m.length-1]);for(m=1;m<=b;m++)y=m/b,k=THREE.Shape.Utils.b3(y,w,p,u,n),y=THREE.Shape.Utils.b3(y,z,x,v,t),e.push(new THREE.Vector2(k,y));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];y=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m);
|
|
|
|
-for(m=1;m<=y;m++)e.push(k.getPointAt(m/y));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];t=k[1];u=k[2];p=k[3];y=k[4];x=!!k[5];v=m[m.length-2];w=m[m.length-1];m.length==0&&(v=w=0);z=y-p;var A=b*2;for(m=1;m<=A;m++)y=m/A,x||(y=1-y),y=p+y*z,k=v+n+u*Math.cos(y),y=w+t+u*Math.sin(y),e.push(new THREE.Vector2(k,y))}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,u,v,p;n=0;for(t=m.length;n<t;n++)u=m[n],v=u.x,p=u.y,u.x=b*v+c*p+e,u.y=f*p+h*v+k;return m};
|
|
|
|
|
|
+THREE.Path.prototype.getPoints=function(b,c){var b=b||12,e=[],f,h,k,m,n,t,u,w,o,x,v,z,y;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];o=k[0];x=k[1];e.length>0?(m=e[e.length-1],v=m.x,z=m.y):(m=this.actions[f-1].args,v=m[m.length-2],z=m[m.length-1]);for(m=1;m<=b;m++)y=m/b,k=THREE.Shape.Utils.b2(y,v,o,n),y=THREE.Shape.Utils.b2(y,z,x,
|
|
|
|
+t),e.push(new THREE.Vector2(k,y));break;case THREE.PathActions.BEZIER_CURVE_TO:n=k[4];t=k[5];o=k[0];x=k[1];u=k[2];w=k[3];e.length>0?(m=e[e.length-1],v=m.x,z=m.y):(m=this.actions[f-1].args,v=m[m.length-2],z=m[m.length-1]);for(m=1;m<=b;m++)y=m/b,k=THREE.Shape.Utils.b3(y,v,o,u,n),y=THREE.Shape.Utils.b3(y,z,x,w,t),e.push(new THREE.Vector2(k,y));break;case THREE.PathActions.CSPLINE_THRU:m=this.actions[f-1].args;m=[new THREE.Vector2(m[m.length-2],m[m.length-1])];y=b*k[0].length;m=m.concat(k[0]);k=new THREE.SplineCurve(m);
|
|
|
|
+for(m=1;m<=y;m++)e.push(k.getPointAt(m/y));break;case THREE.PathActions.ARC:m=this.actions[f-1].args;n=k[0];t=k[1];u=k[2];o=k[3];y=k[4];x=!!k[5];w=m[m.length-2];v=m[m.length-1];m.length==0&&(w=v=0);z=y-o;var A=b*2;for(m=1;m<=A;m++)y=m/A,x||(y=1-y),y=o+y*z,k=w+n+u*Math.cos(y),y=v+t+u*Math.sin(y),e.push(new THREE.Vector2(k,y))}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,u,w,o;n=0;for(t=m.length;n<t;n++)u=m[n],w=u.x,o=u.y,u.x=b*w+c*o+e,u.y=f*o+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=
|
|
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()};
|
|
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=
|
|
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)};
|
|
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.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.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,u,v,p,x,w,z=[];for(t=0;t<c.length;t++){u=c[t];Array.prototype.push.apply(f,u);k=Number.POSITIVE_INFINITY;for(h=0;h<u.length;h++){x=u[h];w=[];for(p=0;p<e.length;p++)v=e[p],v=x.distanceToSquared(v),w.push(v),v<k&&(k=v,m=h,n=p)}h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:u.length-1;var y=[u[m],e[n],e[h]];p=THREE.FontUtils.Triangulate.area(y);var A=[u[m],u[k],e[n]];x=THREE.FontUtils.Triangulate.area(A);w=n;v=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;y=[u[m],e[n],e[h]];y=THREE.FontUtils.Triangulate.area(y);A=[u[m],u[k],e[n]];A=THREE.FontUtils.Triangulate.area(A);p+x>y+A&&(n=w,m=v,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);p=e.slice(0,n);x=e.slice(n);w=u.slice(m);v=u.slice(0,m);k=[u[m],u[k],e[n]];z.push([u[m],e[n],e[h]]);z.push(k);e=p.concat(w).concat(v).concat(x)}return{shape:e,
|
|
|
|
|
|
+THREE.Shape.Utils={removeHoles:function(b,c){var e=b.concat(),f=e.concat(),h,k,m,n,t,u,w,o,x,v,z=[];for(t=0;t<c.length;t++){u=c[t];Array.prototype.push.apply(f,u);k=Number.POSITIVE_INFINITY;for(h=0;h<u.length;h++){x=u[h];v=[];for(o=0;o<e.length;o++)w=e[o],w=x.distanceToSquared(w),v.push(w),w<k&&(k=w,m=h,n=o)}h=n-1>=0?n-1:e.length-1;k=m-1>=0?m-1:u.length-1;var y=[u[m],e[n],e[h]];o=THREE.FontUtils.Triangulate.area(y);var A=[u[m],u[k],e[n]];x=THREE.FontUtils.Triangulate.area(A);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;y=[u[m],e[n],e[h]];y=THREE.FontUtils.Triangulate.area(y);A=[u[m],u[k],e[n]];A=THREE.FontUtils.Triangulate.area(A);o+x>y+A&&(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);o=e.slice(0,n);x=e.slice(n);v=u.slice(m);w=u.slice(0,m);k=[u[m],u[k],e[n]];z.push([u[m],e[n],e[h]]);z.push(k);e=o.concat(v).concat(w).concat(x)}return{shape:e,
|
|
isolatedPts:z,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,u={};k=0;for(m=f.length;k<m;k++)t=f[k].x+":"+f[k].y,u[t]!==void 0&&console.log("Duplicate point",t),u[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=u[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=u[t],t!==void 0&&(n[f]=t)}return e.concat(h)},
|
|
isolatedPts:z,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,u={};k=0;for(m=f.length;k<m;k++)t=f[k].x+":"+f[k].y,u[t]!==void 0&&console.log("Duplicate point",t),u[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=u[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=u[t],t!==void 0&&(n[f]=t)}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)+
|
|
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};
|
|
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.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 u=b.hierarchy[e].keys[f].morphTargets[t];n[u]=-1}b.hierarchy[e].usedMorphTargets=n;for(f=0;f<b.hierarchy[e].keys.length;f++){var v=
|
|
|
|
-{};for(u in n){for(t=0;t<b.hierarchy[e].keys[f].morphTargets.length;t++)if(b.hierarchy[e].keys[f].morphTargets[t]===u){v[u]=b.hierarchy[e].keys[f].morphTargetsInfluences[t];break}t===b.hierarchy[e].keys[f].morphTargets.length&&(v[u]=0)}b.hierarchy[e].keys[f].morphTargetsInfluences=v}}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*
|
|
|
|
|
|
+THREE.AnimationHandler=function(){var b=[],c={},e={update:function(c){for(var e=0;e<b.length;e++)b[e].update(c)},addToUpdate:function(c){b.indexOf(c)===-1&&b.push(c)},removeFromUpdate:function(c){c=b.indexOf(c);c!==-1&&b.splice(c,1)},add:function(b){c[b.name]!==void 0&&console.log("THREE.AnimationHandler.add: Warning! "+b.name+" already exists in library. Overwriting.");c[b.name]=b;if(b.initialized!==!0){for(var e=0;e<b.hierarchy.length;e++){for(var f=0;f<b.hierarchy[e].keys.length;f++){if(b.hierarchy[e].keys[f].time<
|
|
|
|
+0)b.hierarchy[e].keys[f].time=0;if(b.hierarchy[e].keys[f].rot!==void 0&&!(b.hierarchy[e].keys[f].rot instanceof THREE.Quaternion)){var 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 u=b.hierarchy[e].keys[f].morphTargets[t];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(t=0;t<b.hierarchy[e].keys[f].morphTargets.length;t++)if(b.hierarchy[e].keys[f].morphTargets[t]===u){w[u]=b.hierarchy[e].keys[f].morphTargetsInfluences[t];break}t===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=
|
|
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};
|
|
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.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.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.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.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,u,v=this.data.JIT.hierarchy,p,x;this.currentTime+=b*this.timeScale;x=this.currentTime;p=this.currentTime%=this.data.length;u=parseInt(Math.min(p*this.data.fps,this.data.length*this.data.fps),10);for(var w=0,z=this.hierarchy.length;w<z;w++)if(b=this.hierarchy[w],t=b.animationCache,this.JITCompile&&v[w][u]!==void 0)b instanceof THREE.Bone?(b.skinMatrix=v[w][u],b.matrixAutoUpdate=!1,b.matrixWorldNeedsUpdate=
|
|
|
|
-!1):(b.matrix=v[w][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 y=0;y<3;y++){e=c[y];m=t.prevKey[e];n=t.nextKey[e];if(n.time<=x){if(p<x)if(this.loop){m=this.data.hierarchy[w].keys[0];for(n=this.getNextKeyWith(e,w,1);n.time<p;)m=n,n=this.getNextKeyWith(e,w,n.index+1)}else{this.stop();return}else{do m=n,n=this.getNextKeyWith(e,w,n.index+1);while(n.time<
|
|
|
|
-p)}t.prevKey[e]=m;t.nextKey[e]=n}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(p-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 "+w),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",w,m.index-1).pos,this.points[1]=h,this.points[2]=k,this.points[3]=this.getNextKeyWith("pos",w,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&&v[0][u]===void 0){this.hierarchy[0].update(void 0,!0);for(w=0;w<this.hierarchy.length;w++)v[w][u]=this.hierarchy[w]instanceof THREE.Bone?this.hierarchy[w].skinMatrix.clone():this.hierarchy[w].matrix.clone()}}};
|
|
|
|
|
|
+THREE.Animation.prototype.update=function(b){if(this.isPlaying){var c=["pos","rot","scl"],e,f,h,k,m,n,t,u,w=this.data.JIT.hierarchy,o,x;this.currentTime+=b*this.timeScale;x=this.currentTime;o=this.currentTime%=this.data.length;u=parseInt(Math.min(o*this.data.fps,this.data.length*this.data.fps),10);for(var v=0,z=this.hierarchy.length;v<z;v++)if(b=this.hierarchy[v],t=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 y=0;y<3;y++){e=c[y];m=t.prevKey[e];n=t.nextKey[e];if(n.time<=x){if(o<x)if(this.loop){m=this.data.hierarchy[v].keys[0];for(n=this.getNextKeyWith(e,v,1);n.time<o;)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<
|
|
|
|
+o)}t.prevKey[e]=m;t.nextKey[e]=n}b.matrixAutoUpdate=!0;b.matrixWorldNeedsUpdate=!0;f=(o-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,t,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]];t=b[e[2]];u=b[e[3]];e=h*h;m=h*e;f[0]=this.interpolate(k[0],n[0],t[0],u[0],h,e,m);f[1]=this.interpolate(k[1],n[1],t[1],u[1],h,e,m);f[2]=this.interpolate(k[2],n[2],t[2],u[2],h,e,m);return f};
|
|
THREE.Animation.prototype.interpolateCatmullRom=function(b,c){var e=[],f=[],h,k,m,n,t,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]];t=b[e[2]];u=b[e[3]];e=h*h;m=h*e;f[0]=this.interpolate(k[0],n[0],t[0],u[0],h,e,m);f[1]=this.interpolate(k[1],n[1],t[1],u[1],h,e,m);f[2]=this.interpolate(k[2],n[2],t[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.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.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]};
|
|
@@ -465,43 +465,43 @@ THREE.FlyControls=function(b,c){function e(b,e){return function(){e.apply(b,argu
|
|
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};
|
|
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,
|
|
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",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()};
|
|
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,t=0,u=0,v=0,p=0,x=0,w=window.innerWidth/2,z=window.innerHeight/2;this.update=function(){var b=
|
|
|
|
-(new Date).getTime();if(this.lastUpdate==-1)this.lastUpdate=b;this.delta=(b-this.lastUpdate)/1E3;this.lastUpdate=b;this.mouseLook&&(b=this.delta*this.lookSpeed,this.rotateHorizontally(b*p),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.object.translateZ(-b*(t>0||this.autoForward&&!(t<0)?1:t));this.object.translateX(b*u);this.object.translateY(b*v);m&&(this.roll+=this.rollSpeed*this.delta*n);if(this.forward.y>this.constrainVertical[1])this.forward.y=this.constrainVertical[1],this.forward.normalize();
|
|
|
|
|
|
+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,t=0,u=0,w=0,o=0,x=0,v=window.innerWidth/2,z=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*o),this.rotateVertically(b*x));b=this.delta*this.movementSpeed;this.object.translateZ(-b*(t>0||this.autoForward&&!(t<0)?1:t));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);
|
|
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*
|
|
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,
|
|
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){p=(b.clientX-w)/window.innerWidth;x=(b.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:t=1;break;case 2:t=-1}},!1);this.domElement.addEventListener("mouseup",
|
|
|
|
-function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:t=0;break;case 2:t=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:t=1;break;case 37:case 65:u=-1;break;case 40:case 83:t=-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:v=1;break;case 70:v=-1}},!1);this.domElement.addEventListener("keyup",function(b){switch(b.keyCode){case 38:case 87:t=0;break;case 37:case 65:u=0;break;case 40:case 83:t=
|
|
|
|
-0;break;case 39:case 68:u=0;break;case 81:m=!1;break;case 69:m=!1;break;case 82:v=0;break;case 70:v=0}},!1)};
|
|
|
|
|
|
+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){o=(b.clientX-v)/window.innerWidth;x=(b.clientY-z)/window.innerHeight},!1);this.domElement.addEventListener("mousedown",function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:t=1;break;case 2:t=-1}},!1);this.domElement.addEventListener("mouseup",
|
|
|
|
+function(b){b.preventDefault();b.stopPropagation();switch(b.button){case 0:t=0;break;case 2:t=0}},!1);this.domElement.addEventListener("keydown",function(b){switch(b.keyCode){case 38:case 87:t=1;break;case 37:case 65:u=-1;break;case 40:case 83:t=-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:t=0;break;case 37:case 65:u=0;break;case 40:case 83:t=
|
|
|
|
+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,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=c!==void 0?c:document;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
|
|
THREE.TrackballControls=function(b,c){function e(b,e){return function(){e.apply(b,arguments)}}this.object=b;this.domElement=c!==void 0?c:document;this.screen={width:window.innerWidth,height:window.innerHeight,offsetLeft:0,offsetTop:0};this.radius=(this.screen.width+this.screen.height)/4;this.rotateSpeed=1;this.zoomSpeed=1.2;this.panSpeed=0.3;this.staticMoving=this.noPan=this.noZoom=!1;this.dynamicDampingFactor=0.2;this.minDistance=0;this.maxDistance=Infinity;this.keys=[65,83,68];this.target=new THREE.Vector3(0,
|
|
-0,0);var f=!1,h=this.STATE.NONE,k=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector2,u=new THREE.Vector2,v=new THREE.Vector2,p=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,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)/
|
|
|
|
|
|
+0,0);var f=!1,h=this.STATE.NONE,k=new THREE.Vector3,m=new THREE.Vector3,n=new THREE.Vector3,t=new THREE.Vector2,u=new THREE.Vector2,w=new THREE.Vector2,o=new THREE.Vector2;this.handleEvent=function(b){if(typeof this[b.type]=="function")this[b.type](b)};this.getMouseOnScreen=function(b,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);k.copy(this.object.position).subSelf(this.target);f=this.object.up.clone().setLength(c.y);f.addSelf(this.object.up.clone().crossSelf(k).setLength(c.x));f.addSelf(k.setLength(c.z));return f};this.rotateCamera=function(){var b=Math.acos(m.dot(n)/m.length()/n.length());if(b){var e=(new THREE.Vector3).cross(m,n).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,
|
|
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);k.copy(this.object.position).subSelf(this.target);f=this.object.up.clone().setLength(c.y);f.addSelf(this.object.up.clone().crossSelf(k).setLength(c.x));f.addSelf(k.setLength(c.z));return f};this.rotateCamera=function(){var b=Math.acos(m.dot(n)/m.length()/n.length());if(b){var e=(new THREE.Vector3).cross(m,n).normalize(),c=new THREE.Quaternion;b*=this.rotateSpeed;c.setFromAxisAngle(e,
|
|
--b);c.multiplyVector3(k);c.multiplyVector3(this.object.up);c.multiplyVector3(n);this.staticMoving?m=n:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(m))}};this.zoomCamera=function(){var b=1+(u.y-t.y)*this.zoomSpeed;b!==1&&b>0&&(k.multiplyScalar(b),this.staticMoving?t=u:t.y+=(u.y-t.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=p.clone().subSelf(v);if(b.lengthSq()){b.multiplyScalar(k.length()*this.panSpeed);var e=k.clone().crossSelf(this.object.up).setLength(b.x);
|
|
|
|
-e.addSelf(this.object.up.clone().setLength(b.y));this.object.position.addSelf(e);this.target.addSelf(e);this.staticMoving?v=p:v.addSelf(b.sub(p,v).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),k.lengthSq()<this.minDistance*this.minDistance&&this.object.position.add(this.target,k.setLength(this.minDistance))};this.update=function(){k.copy(this.object.position).subSelf(this.target);
|
|
|
|
-this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.object.position.add(this.target,k);this.checkDistances();this.object.lookAt(this.target)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",e(this,function(b){f&&(m=n=this.getMouseProjectionOnBall(b.clientX,b.clientY),t=u=this.getMouseOnScreen(b.clientX,b.clientY),v=p=this.getMouseOnScreen(b.clientX,b.clientY),f=!1);h!==this.STATE.NONE&&
|
|
|
|
-(h===this.STATE.ROTATE?n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?u=this.getMouseOnScreen(b.clientX,b.clientY):h===this.STATE.PAN&&!this.noPan&&(p=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",e(this,function(b){b.preventDefault();b.stopPropagation();if(h===this.STATE.NONE)h=b.button,h===this.STATE.ROTATE?m=n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?t=u=this.getMouseOnScreen(b.clientX,
|
|
|
|
-b.clientY):this.noPan||(v=p=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",e(this,function(b){b.preventDefault();b.stopPropagation();h=this.STATE.NONE}),!1);window.addEventListener("keydown",e(this,function(b){if(h===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])h=this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)h=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)h=this.STATE.PAN;h!==
|
|
|
|
|
|
+-b);c.multiplyVector3(k);c.multiplyVector3(this.object.up);c.multiplyVector3(n);this.staticMoving?m=n:(c.setFromAxisAngle(e,b*(this.dynamicDampingFactor-1)),c.multiplyVector3(m))}};this.zoomCamera=function(){var b=1+(u.y-t.y)*this.zoomSpeed;b!==1&&b>0&&(k.multiplyScalar(b),this.staticMoving?t=u:t.y+=(u.y-t.y)*this.dynamicDampingFactor)};this.panCamera=function(){var b=o.clone().subSelf(w);if(b.lengthSq()){b.multiplyScalar(k.length()*this.panSpeed);var e=k.clone().crossSelf(this.object.up).setLength(b.x);
|
|
|
|
+e.addSelf(this.object.up.clone().setLength(b.y));this.object.position.addSelf(e);this.target.addSelf(e);this.staticMoving?w=o:w.addSelf(b.sub(o,w).multiplyScalar(this.dynamicDampingFactor))}};this.checkDistances=function(){if(!this.noZoom||!this.noPan)this.object.position.lengthSq()>this.maxDistance*this.maxDistance&&this.object.position.setLength(this.maxDistance),k.lengthSq()<this.minDistance*this.minDistance&&this.object.position.add(this.target,k.setLength(this.minDistance))};this.update=function(){k.copy(this.object.position).subSelf(this.target);
|
|
|
|
+this.rotateCamera();this.noZoom||this.zoomCamera();this.noPan||this.panCamera();this.object.position.add(this.target,k);this.checkDistances();this.object.lookAt(this.target)};this.domElement.addEventListener("contextmenu",function(b){b.preventDefault()},!1);this.domElement.addEventListener("mousemove",e(this,function(b){f&&(m=n=this.getMouseProjectionOnBall(b.clientX,b.clientY),t=u=this.getMouseOnScreen(b.clientX,b.clientY),w=o=this.getMouseOnScreen(b.clientX,b.clientY),f=!1);h!==this.STATE.NONE&&
|
|
|
|
+(h===this.STATE.ROTATE?n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?u=this.getMouseOnScreen(b.clientX,b.clientY):h===this.STATE.PAN&&!this.noPan&&(o=this.getMouseOnScreen(b.clientX,b.clientY)))}),!1);this.domElement.addEventListener("mousedown",e(this,function(b){b.preventDefault();b.stopPropagation();if(h===this.STATE.NONE)h=b.button,h===this.STATE.ROTATE?m=n=this.getMouseProjectionOnBall(b.clientX,b.clientY):h===this.STATE.ZOOM&&!this.noZoom?t=u=this.getMouseOnScreen(b.clientX,
|
|
|
|
+b.clientY):this.noPan||(w=o=this.getMouseOnScreen(b.clientX,b.clientY))}),!1);this.domElement.addEventListener("mouseup",e(this,function(b){b.preventDefault();b.stopPropagation();h=this.STATE.NONE}),!1);window.addEventListener("keydown",e(this,function(b){if(h===this.STATE.NONE){if(b.keyCode===this.keys[this.STATE.ROTATE])h=this.STATE.ROTATE;else if(b.keyCode===this.keys[this.STATE.ZOOM]&&!this.noZoom)h=this.STATE.ZOOM;else if(b.keyCode===this.keys[this.STATE.PAN]&&!this.noPan)h=this.STATE.PAN;h!==
|
|
this.STATE.NONE&&(f=!0)}}),!1);window.addEventListener("keyup",e(this,function(){if(h!==this.STATE.NONE)h=this.STATE.NONE}),!1)};THREE.TrackballControls.prototype.STATE={NONE:-1,ROTATE:0,ZOOM:1,PAN:2};
|
|
this.STATE.NONE&&(f=!0)}}),!1);window.addEventListener("keyup",e(this,function(){if(h!==this.STATE.NONE)h=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){function t(b,e,c,m,n,p,t,w){var v,x,z=f||1,U=h||1,I=n/2,S=p/2,Q=u.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",U=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")v="x",z=k||1;var Y=z+1,W=U+1;n/=z;var o=p/U;for(x=0;x<W;x++)for(p=0;p<Y;p++){var $=new THREE.Vector3;$[b]=(p*n-I)*c;$[e]=(x*o-S)*m;$[v]=t;u.vertices.push(new THREE.Vertex($))}for(x=0;x<U;x++)for(p=0;p<z;p++)u.faces.push(new THREE.Face4(p+Y*x+Q,
|
|
|
|
-p+Y*(x+1)+Q,p+1+Y*(x+1)+Q,p+1+Y*x+Q,null,null,w)),u.faceVertexUvs[0].push([new THREE.UV(p/z,x/U),new THREE.UV(p/z,(x+1)/U),new THREE.UV((p+1)/z,(x+1)/U),new THREE.UV((p+1)/z,x/U)])}THREE.Geometry.call(this);var u=this,v=b/2,p=c/2,x=e/2;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var w=0;w<6;w++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var z in n)this.sides[z]!=void 0&&(this.sides[z]=n[z]);
|
|
|
|
-this.sides.px&&t("z","y",-1,-1,e,c,v,this.materials[0]);this.sides.nx&&t("z","y",1,-1,e,c,-v,this.materials[1]);this.sides.py&&t("x","z",1,1,b,e,p,this.materials[2]);this.sides.ny&&t("x","z",1,-1,b,e,-p,this.materials[3]);this.sides.pz&&t("x","y",1,-1,b,c,x,this.materials[4]);this.sides.nz&&t("x","y",-1,-1,b,c,-x,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,u=[],v=[];for(t=0;t<=h;t++){var p=[],x=[],w=t/h,z=w*(c-b)+b;for(n=0;n<=f;n++){var y=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(y*Math.PI*2),-w*e+m,z*Math.cos(y*Math.PI*2))));p.push(this.vertices.length-1);x.push(new THREE.UV(y,w))}u.push(p);v.push(x)}for(t=0;t<h;t++)for(n=0;n<f;n++){var e=u[t][n],p=u[t+1][n],x=u[t+1][n+1],w=u[t][n+1],z=
|
|
|
|
-this.vertices[e].position.clone().setY(0).normalize(),y=this.vertices[p].position.clone().setY(0).normalize(),A=this.vertices[x].position.clone().setY(0).normalize(),E=this.vertices[w].position.clone().setY(0).normalize(),F=v[t][n].clone(),D=v[t+1][n].clone(),G=v[t+1][n+1].clone(),K=v[t][n+1].clone();this.faces.push(new THREE.Face4(e,p,x,w,[z,y,A,E]));this.faceVertexUvs[0].push([F,D,G,K])}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],p=u[0][n+
|
|
|
|
-1],x=this.vertices.length-1,z=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),F=v[0][n].clone(),D=v[0][n+1].clone(),G=new THREE.UV(D.u,0),this.faces.push(new THREE.Face3(e,p,x,[z,y,A])),this.faceVertexUvs[0].push([F,D,G])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=u[t][n+1],p=u[t][n],x=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),F=v[t][n+1].clone(),D=v[t][n].clone(),
|
|
|
|
-G=new THREE.UV(D.u,1),this.faces.push(new THREE.Face3(e,p,x,[z,y,A])),this.faceVertexUvs[0].push([F,D,G])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
|
|
|
+THREE.CubeGeometry=function(b,c,e,f,h,k,m,n){function t(b,e,c,m,n,o,t,v){var w,x,z=f||1,Y=h||1,H=n/2,T=o/2,Q=u.vertices.length;if(b=="x"&&e=="y"||b=="y"&&e=="x")w="z";else if(b=="x"&&e=="z"||b=="z"&&e=="x")w="y",Y=k||1;else if(b=="z"&&e=="y"||b=="y"&&e=="z")w="x",z=k||1;var Z=z+1,$=Y+1;n/=z;var S=o/Y;for(x=0;x<$;x++)for(o=0;o<Z;o++){var p=new THREE.Vector3;p[b]=(o*n-H)*c;p[e]=(x*S-T)*m;p[w]=t;u.vertices.push(new THREE.Vertex(p))}for(x=0;x<Y;x++)for(o=0;o<z;o++)u.faces.push(new THREE.Face4(o+Z*x+Q,
|
|
|
|
+o+Z*(x+1)+Q,o+1+Z*(x+1)+Q,o+1+Z*x+Q,null,null,v)),u.faceVertexUvs[0].push([new THREE.UV(o/z,x/Y),new THREE.UV(o/z,(x+1)/Y),new THREE.UV((o+1)/z,(x+1)/Y),new THREE.UV((o+1)/z,x/Y)])}THREE.Geometry.call(this);var u=this,w=b/2,o=c/2,x=e/2;if(m!==void 0)if(m instanceof Array)this.materials=m;else{this.materials=[];for(var v=0;v<6;v++)this.materials.push([m])}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(n!=void 0)for(var z in n)this.sides[z]!=void 0&&(this.sides[z]=n[z]);
|
|
|
|
+this.sides.px&&t("z","y",-1,-1,e,c,w,this.materials[0]);this.sides.nx&&t("z","y",1,-1,e,c,-w,this.materials[1]);this.sides.py&&t("x","z",1,1,b,e,o,this.materials[2]);this.sides.ny&&t("x","z",1,-1,b,e,-o,this.materials[3]);this.sides.pz&&t("x","y",1,-1,b,c,x,this.materials[4]);this.sides.nz&&t("x","y",-1,-1,b,c,-x,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,u=[],w=[];for(t=0;t<=h;t++){var o=[],x=[],v=t/h,z=v*(c-b)+b;for(n=0;n<=f;n++){var y=n/f;this.vertices.push(new THREE.Vertex(new THREE.Vector3(z*Math.sin(y*Math.PI*2),-v*e+m,z*Math.cos(y*Math.PI*2))));o.push(this.vertices.length-1);x.push(new THREE.UV(y,v))}u.push(o);w.push(x)}for(t=0;t<h;t++)for(n=0;n<f;n++){var e=u[t][n],o=u[t+1][n],x=u[t+1][n+1],v=u[t][n+1],z=
|
|
|
|
+this.vertices[e].position.clone().setY(0).normalize(),y=this.vertices[o].position.clone().setY(0).normalize(),A=this.vertices[x].position.clone().setY(0).normalize(),E=this.vertices[v].position.clone().setY(0).normalize(),F=w[t][n].clone(),C=w[t+1][n].clone(),G=w[t+1][n+1].clone(),J=w[t][n+1].clone();this.faces.push(new THREE.Face4(e,o,x,v,[z,y,A,E]));this.faceVertexUvs[0].push([F,C,G,J])}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],o=u[0][n+
|
|
|
|
+1],x=this.vertices.length-1,z=new THREE.Vector3(0,1,0),y=new THREE.Vector3(0,1,0),A=new THREE.Vector3(0,1,0),F=w[0][n].clone(),C=w[0][n+1].clone(),G=new THREE.UV(C.u,0),this.faces.push(new THREE.Face3(e,o,x,[z,y,A])),this.faceVertexUvs[0].push([F,C,G])}if(!k&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-m,0)));for(n=0;n<f;n++)e=u[t][n+1],o=u[t][n],x=this.vertices.length-1,z=new THREE.Vector3(0,-1,0),y=new THREE.Vector3(0,-1,0),A=new THREE.Vector3(0,-1,0),F=w[t][n+1].clone(),C=w[t][n].clone(),
|
|
|
|
+G=new THREE.UV(C.u,1),this.faces.push(new THREE.Face3(e,o,x,[z,y,A])),this.faceVertexUvs[0].push([F,C,G])}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=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,k=THREE.ExtrudeGeometry.__v2,h=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);k.set(b.x-c.x,b.y-c.y);f=f.normalize();k=k.normalize();h.set(-f.y,f.x);m.set(k.y,-k.x);n.copy(b).addSelf(h);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
|
|
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,k=THREE.ExtrudeGeometry.__v2,h=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);k.set(b.x-c.x,b.y-c.y);f=f.normalize();k=k.normalize();h.set(-f.y,f.x);m.set(k.y,-k.x);n.copy(b).addSelf(h);o.copy(b).addSelf(m);if(n.equals(o))return m.clone();
|
|
-n.copy(e).addSelf(h);o.copy(c).addSelf(m);h=f.dot(m);m=o.subSelf(n).dot(m);h==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=h;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(I=b.length;--I>=0;){ja=I;la=I-1;la<0&&(la=b.length-
|
|
|
|
-1);for(var e=0,c=w+v*2,e=0;e<c;e++){var f=$*e,k=$*(e+1),m=da+ja+f,h=da+ja+k,o=m,f=da+la+f,k=da+la+k,p=h;o+=U;f+=U;k+=U;p+=U;M.faces.push(new THREE.Face4(o,f,k,p,null,null,G));G&&(o=e/c,f=(e+1)/c,k=n+t*2,m=(M.vertices[m].position.z+t)/k,h=(M.vertices[h].position.z+t)/k,M.faceVertexUvs[0].push([new THREE.UV(m,o),new THREE.UV(h,o),new THREE.UV(h,f),new THREE.UV(m,f)]))}}}function k(b,e,c){M.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=U;e+=U;c+=U;M.faces.push(new THREE.Face3(b,
|
|
|
|
-e,c,null,null,D));if(D){var f=K.maxY,k=K.maxX,m=M.vertices[e].position.x,e=M.vertices[e].position.y,h=M.vertices[c].position.x,c=M.vertices[c].position.y;M.faceVertexUvs[0].push([new THREE.UV(M.vertices[b].position.x/k,M.vertices[b].position.y/f),new THREE.UV(m/k,e/f),new THREE.UV(h/k,c/f)])}}var n=c.amount!==void 0?c.amount:100,t=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:t-2,v=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
|
-!0,x=c.curveSegments!==void 0?c.curveSegments:12,w=c.steps!==void 0?c.steps:1,z=c.bendPath,y=c.extrudePath,A,E=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,D=c.material,G=c.extrudeMaterial,K=this.shapebb;if(y)A=y.getPoints(x),w=A.length,E=!0,p=!1;p||(u=t=v=0);var N,L,B,M=this,U=this.vertices.length;z&&b.addWrapPath(z);x=F?b.extractAllSpacedPoints(x):b.extractAllPoints(x);z=x.shape;x=x.holes;if(y=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();L=0;for(B=x.length;L<B;L++)N=x[L],THREE.Shape.Utils.isClockWise(N)&&
|
|
|
|
-(x[L]=N.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(z,x);F=z;L=0;for(B=x.length;L<B;L++)N=x[L],z=z.concat(N);var I,S,Q,Y,W,o,$=z.length,T=y.length,ha=[];I=0;S=F.length;ja=S-1;for(la=I+1;I<S;I++,ja++,la++)ja==S&&(ja=0),la==S&&(la=0),ha[I]=f(F[I],F[ja],F[la]);var fa=[],oa,ca=ha.concat();L=0;for(B=x.length;L<B;L++){N=x[L];oa=[];I=0;S=N.length;ja=S-1;for(la=I+1;I<S;I++,ja++,la++)ja==S&&(ja=0),la==S&&(la=0),oa[I]=f(N[I],N[ja],N[la]);fa.push(oa);ca=ca.concat(oa)}for(Q=0;Q<v;Q++){Y=Q/v;W=t*(1-Y);
|
|
|
|
-Y=u*Math.sin(Y*Math.PI/2);I=0;for(S=F.length;I<S;I++)o=e(F[I],ha[I],Y),k(o.x,o.y,-W);L=0;for(B=x.length;L<B;L++){N=x[L];oa=fa[L];I=0;for(S=N.length;I<S;I++)o=e(N[I],oa[I],Y),k(o.x,o.y,-W)}}Y=u;for(I=0;I<$;I++)o=p?e(z[I],ca[I],Y):z[I],E?k(o.x,o.y+A[0].y,A[0].x):k(o.x,o.y,0);for(Q=1;Q<=w;Q++)for(I=0;I<$;I++)o=p?e(z[I],ca[I],Y):z[I],E?k(o.x,o.y+A[Q-1].y,A[Q-1].x):k(o.x,o.y,n/w*Q);for(Q=v-1;Q>=0;Q--){Y=Q/v;W=t*(1-Y);Y=u*Math.sin(Y*Math.PI/2);I=0;for(S=F.length;I<S;I++)o=e(F[I],ha[I],Y),k(o.x,o.y,n+W);
|
|
|
|
-L=0;for(B=x.length;L<B;L++){N=x[L];oa=fa[L];I=0;for(S=N.length;I<S;I++)o=e(N[I],oa[I],Y),E?k(o.x,o.y+A[w-1].y,A[w-1].x+W):k(o.x,o.y,n+W)}}if(p){p=$*0;for(I=0;I<T;I++)u=y[I],m(u[2]+p,u[1]+p,u[0]+p);p=$*(w+v*2);for(I=0;I<T;I++)u=y[I],m(u[0]+p,u[1]+p,u[2]+p)}else{for(I=0;I<T;I++)u=y[I],m(u[2],u[1],u[0]);for(I=0;I<T;I++)u=y[I],m(u[0]+$*w,u[1]+$*w,u[2]+$*w)}var ja,la,da=0;h(F);da+=F.length;L=0;for(B=x.length;L<B;L++)N=x[L],h(N),da+=N.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;
|
|
|
|
|
|
+n.copy(e).addSelf(h);o.copy(c).addSelf(m);h=f.dot(m);m=o.subSelf(n).dot(m);h==0&&(console.log("Either infinite or no solutions!"),m==0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));m/=h;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(H=b.length;--H>=0;){ka=H;na=H-1;na<0&&(na=b.length-
|
|
|
|
+1);for(var e=0,c=v+w*2,e=0;e<c;e++){var f=p*e,k=p*(e+1),m=aa+ka+f,h=aa+ka+k,o=m,f=aa+na+f,k=aa+na+k,u=h;o+=Y;f+=Y;k+=Y;u+=Y;N.faces.push(new THREE.Face4(o,f,k,u,null,null,G));G&&(o=e/c,f=(e+1)/c,k=n+t*2,m=(N.vertices[m].position.z+t)/k,h=(N.vertices[h].position.z+t)/k,N.faceVertexUvs[0].push([new THREE.UV(m,o),new THREE.UV(h,o),new THREE.UV(h,f),new THREE.UV(m,f)]))}}}function k(b,e,c){N.vertices.push(new THREE.Vertex(new THREE.Vector3(b,e,c)))}function m(b,e,c){b+=Y;e+=Y;c+=Y;N.faces.push(new THREE.Face3(b,
|
|
|
|
+e,c,null,null,C));if(C){var f=J.maxY,k=J.maxX,m=N.vertices[e].position.x,e=N.vertices[e].position.y,h=N.vertices[c].position.x,c=N.vertices[c].position.y;N.faceVertexUvs[0].push([new THREE.UV(N.vertices[b].position.x/k,N.vertices[b].position.y/f),new THREE.UV(m/k,e/f),new THREE.UV(h/k,c/f)])}}var n=c.amount!==void 0?c.amount:100,t=c.bevelThickness!==void 0?c.bevelThickness:6,u=c.bevelSize!==void 0?c.bevelSize:t-2,w=c.bevelSegments!==void 0?c.bevelSegments:3,o=c.bevelEnabled!==void 0?c.bevelEnabled:
|
|
|
|
+!0,x=c.curveSegments!==void 0?c.curveSegments:12,v=c.steps!==void 0?c.steps:1,z=c.bendPath,y=c.extrudePath,A,E=!1,F=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,C=c.material,G=c.extrudeMaterial,J=this.shapebb;if(y)A=y.getPoints(x),v=A.length,E=!0,o=!1;o||(u=t=w=0);var O,K,B,N=this,Y=this.vertices.length;z&&b.addWrapPath(z);x=F?b.extractAllSpacedPoints(x):b.extractAllPoints(x);z=x.shape;x=x.holes;if(y=!THREE.Shape.Utils.isClockWise(z)){z=z.reverse();K=0;for(B=x.length;K<B;K++)O=x[K],THREE.Shape.Utils.isClockWise(O)&&
|
|
|
|
+(x[K]=O.reverse());y=!1}y=THREE.Shape.Utils.triangulateShape(z,x);F=z;K=0;for(B=x.length;K<B;K++)O=x[K],z=z.concat(O);var H,T,Q,Z,$,S,p=z.length,V=y.length,ea=[];H=0;T=F.length;ka=T-1;for(na=H+1;H<T;H++,ka++,na++)ka==T&&(ka=0),na==T&&(na=0),ea[H]=f(F[H],F[ka],F[na]);var da=[],ha,ga=ea.concat();K=0;for(B=x.length;K<B;K++){O=x[K];ha=[];H=0;T=O.length;ka=T-1;for(na=H+1;H<T;H++,ka++,na++)ka==T&&(ka=0),na==T&&(na=0),ha[H]=f(O[H],O[ka],O[na]);da.push(ha);ga=ga.concat(ha)}for(Q=0;Q<w;Q++){Z=Q/w;$=t*(1-Z);
|
|
|
|
+Z=u*Math.sin(Z*Math.PI/2);H=0;for(T=F.length;H<T;H++)S=e(F[H],ea[H],Z),k(S.x,S.y,-$);K=0;for(B=x.length;K<B;K++){O=x[K];ha=da[K];H=0;for(T=O.length;H<T;H++)S=e(O[H],ha[H],Z),k(S.x,S.y,-$)}}Z=u;for(H=0;H<p;H++)S=o?e(z[H],ga[H],Z):z[H],E?k(S.x,S.y+A[0].y,A[0].x):k(S.x,S.y,0);for(Q=1;Q<=v;Q++)for(H=0;H<p;H++)S=o?e(z[H],ga[H],Z):z[H],E?k(S.x,S.y+A[Q-1].y,A[Q-1].x):k(S.x,S.y,n/v*Q);for(Q=w-1;Q>=0;Q--){Z=Q/w;$=t*(1-Z);Z=u*Math.sin(Z*Math.PI/2);H=0;for(T=F.length;H<T;H++)S=e(F[H],ea[H],Z),k(S.x,S.y,n+$);
|
|
|
|
+K=0;for(B=x.length;K<B;K++){O=x[K];ha=da[K];H=0;for(T=O.length;H<T;H++)S=e(O[H],ha[H],Z),E?k(S.x,S.y+A[v-1].y,A[v-1].x+$):k(S.x,S.y,n+$)}}if(o){o=p*0;for(H=0;H<V;H++)u=y[H],m(u[2]+o,u[1]+o,u[0]+o);o=p*(v+w*2);for(H=0;H<V;H++)u=y[H],m(u[0]+o,u[1]+o,u[2]+o)}else{for(H=0;H<V;H++)u=y[H],m(u[2],u[1],u[0]);for(H=0;H<V;H++)u=y[H],m(u[0]+p*v,u[1]+p*v,u[2]+p*v)}var ka,na,aa=0;h(F);aa+=F.length;K=0;for(B=x.length;K<B;K++)O=x[K],h(O),aa+=O.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.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,
|
|
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),u=f(k.faces[n].b,k.faces[n].c),v=f(k.faces[n].c,k.faces[n].a);e(k.faces[n].a,t,v,b);e(k.faces[n].b,u,
|
|
|
|
-t,b);e(k.faces[n].c,v,u,b);e(t,u,v,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;
|
|
|
|
|
|
+-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),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,t,w,b);e(k.faces[n].b,u,
|
|
|
|
+t,b);e(k.faces[n].c,w,u,b);e(t,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 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);
|
|
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;
|
|
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;
|
|
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(),
|
|
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(),
|
|
@@ -510,156 +510,156 @@ m.faces.push(n),n=Math.atan2(n.centroid.z,-n.centroid.x),m.faceVertexUvs[0].push
|
|
c);this.boundingSphere={radius:b}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
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 u=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*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=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 u=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*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.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),u=[],v=0;for(f=0;f<k;f++){var p=2*f/k,x=t*Math.sin(p*h),p=t*Math.cos(p*h);(e==0||e==m)&&f>0||(v=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,n,x)))-1);u.push(v)}c.push(u)}for(var w,z,y,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];t=c[e-1][u?
|
|
|
|
-k-1:f];u=c[e-1][u?0:f+1];x=e/(h-1);w=(e-1)/(h-1);z=(f+1)/k;var p=f/k,v=new THREE.UV(1-z,x),x=new THREE.UV(1-p,x),p=new THREE.UV(1-p,w),A=new THREE.UV(1-z,w);e<c.length-1&&(w=this.vertices[m].position.clone(),z=this.vertices[n].position.clone(),y=this.vertices[t].position.clone(),w.normalize(),z.normalize(),y.normalize(),this.faces.push(new THREE.Face3(m,n,t,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([v,x,p]));e>1&&(w=
|
|
|
|
-this.vertices[m].position.clone(),z=this.vertices[t].position.clone(),y=this.vertices[u].position.clone(),w.normalize(),z.normalize(),y.normalize(),this.faces.push(new THREE.Face3(m,t,u,[new THREE.Vector3(w.x,w.y,w.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([v,p,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
|
|
|
|
+THREE.SphereGeometry=function(b,c,e){THREE.Geometry.call(this);for(var b=b||50,f,h=Math.PI,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),u=[],w=0;for(f=0;f<k;f++){var o=2*f/k,x=t*Math.sin(o*h),o=t*Math.cos(o*h);(e==0||e==m)&&f>0||(w=this.vertices.push(new THREE.Vertex(new THREE.Vector3(o,n,x)))-1);u.push(w)}c.push(u)}for(var v,z,y,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];t=c[e-1][u?
|
|
|
|
+k-1:f];u=c[e-1][u?0:f+1];x=e/(h-1);v=(e-1)/(h-1);z=(f+1)/k;var o=f/k,w=new THREE.UV(1-z,x),x=new THREE.UV(1-o,x),o=new THREE.UV(1-o,v),A=new THREE.UV(1-z,v);e<c.length-1&&(v=this.vertices[m].position.clone(),z=this.vertices[n].position.clone(),y=this.vertices[t].position.clone(),v.normalize(),z.normalize(),y.normalize(),this.faces.push(new THREE.Face3(m,n,t,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([w,x,o]));e>1&&(v=
|
|
|
|
+this.vertices[m].position.clone(),z=this.vertices[t].position.clone(),y=this.vertices[u].position.clone(),v.normalize(),z.normalize(),y.normalize(),this.faces.push(new THREE.Face3(m,t,u,[new THREE.Vector3(v.x,v.y,v.z),new THREE.Vector3(z.x,z.y,z.z),new THREE.Vector3(y.x,y.y,y.z)])),this.faceVertexUvs[0].push([w,o,A]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:b}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
THREE.SphereGeometry.prototype.constructor=THREE.SphereGeometry;
|
|
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=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.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=
|
|
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,u,v,p,x,w,z,y,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));t=c.length;for(b=0;b<t;)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;w=c[b++]*e;h.quadraticCurveTo(x,w,n,u);if(m=k[k.length-1]){v=m.x;p=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++){var E=m/divisions,F=THREE.Shape.Utils.b2(E,v,x,n),E=THREE.Shape.Utils.b2(E,p,w,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,w=c[b++]*-e,z=c[b++]*e+f,y=c[b++]*-e,h.bezierCurveTo(n,u,
|
|
|
|
-x,w,z,y),m=k[k.length-1]){v=m.x;p=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)E=m/divisions,F=THREE.Shape.Utils.b3(E,v,x,z,n),E=THREE.Shape.Utils.b3(E,p,w,y,u),k.push(new THREE.Vector2(F,E))}}}return{offset:A.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,u,v;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 p=2*h;for(u=h-1;h>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}t=u;h<=t&&(t=0);u=t+1;h<=u&&(u=0);v=u+1;h<=v&&(v=0);var x;a:{x=b;var w=t,z=u,y=v,A=h,E=m,F=void 0,D=void 0,G=void 0,
|
|
|
|
-K=void 0,N=void 0,L=void 0,B=void 0,M=void 0,U=void 0,D=x[E[w]].x,G=x[E[w]].y,K=x[E[z]].x,N=x[E[z]].y,L=x[E[y]].x,B=x[E[y]].y;if(1.0E-10>(K-D)*(B-G)-(N-G)*(L-D))x=!1;else{for(F=0;F<A;F++)if(!(F==w||F==z||F==y)){var M=x[E[F]].x,U=x[E[F]].y,I=void 0,S=void 0,Q=void 0,Y=void 0,W=void 0,o=void 0,$=void 0,T=void 0,ha=void 0,fa=void 0,oa=void 0,ca=void 0,I=Q=W=void 0,I=L-K,S=B-N,Q=D-L,Y=G-B,W=K-D,o=N-G,$=M-D,T=U-G,ha=M-K,fa=U-N,oa=M-L,ca=U-B,I=I*fa-S*ha,W=W*T-o*$,Q=Q*ca-Y*oa;if(I>=0&&Q>=0&&W>=0){x=!1;break a}}x=
|
|
|
|
-!0}}if(x){k.push([b[m[t]],b[m[u]],b[m[v]]]);n.push([m[t],m[u],m[v]]);t=u;for(v=u+1;v<h;t++,v++)m[t]=m[v];h--;p=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,t,u,w,o,x,v,z,y,A=c.glyphs[b]||c.glyphs[ctxt.options.fallbackCharacter];if(A){if(A.o){c=A._cachedOutline||(A._cachedOutline=A.o.split(" "));t=c.length;for(b=0;b<t;)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;o=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,o,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,z=c[b++]*e+f,y=c[b++]*-e,h.bezierCurveTo(n,u,
|
|
|
|
+x,v,z,y),m=k[k.length-1]){w=m.x;o=m.y;m=1;for(divisions=this.divisions;m<=divisions;m++)E=m/divisions,F=THREE.Shape.Utils.b3(E,w,x,z,n),E=THREE.Shape.Utils.b3(E,o,v,y,u),k.push(new THREE.Vector2(F,E))}}}return{offset:A.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,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 o=2*h;for(u=h-1;h>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(f)return n;return k}t=u;h<=t&&(t=0);u=t+1;h<=u&&(u=0);w=u+1;h<=w&&(w=0);var x;a:{x=b;var v=t,z=u,y=w,A=h,E=m,F=void 0,C=void 0,G=void 0,
|
|
|
|
+J=void 0,O=void 0,K=void 0,B=void 0,N=void 0,Y=void 0,C=x[E[v]].x,G=x[E[v]].y,J=x[E[z]].x,O=x[E[z]].y,K=x[E[y]].x,B=x[E[y]].y;if(1.0E-10>(J-C)*(B-G)-(O-G)*(K-C))x=!1;else{for(F=0;F<A;F++)if(!(F==v||F==z||F==y)){var N=x[E[F]].x,Y=x[E[F]].y,H=void 0,T=void 0,Q=void 0,Z=void 0,$=void 0,S=void 0,p=void 0,V=void 0,ea=void 0,da=void 0,ha=void 0,ga=void 0,H=Q=$=void 0,H=K-J,T=B-O,Q=C-K,Z=G-B,$=J-C,S=O-G,p=N-C,V=Y-G,ea=N-J,da=Y-O,ha=N-K,ga=Y-B,H=H*da-T*ea,$=$*V-S*p,Q=Q*ga-Z*ha;if(H>=0&&Q>=0&&$>=0){x=!1;break a}}x=
|
|
|
|
+!0}}if(x){k.push([b[m[t]],b[m[u]],b[m[w]]]);n.push([m[t],m[u],m[w]]);t=u;for(w=u+1;w<h;t++,w++)m[t]=m[w];h--;o=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=
|
|
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,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.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;
|
|
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,k,m){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,m*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<
|
|
THREE.TorusKnotGeometry=function(b,c,e,f,h,k,m){function n(b,e,c,f,k,m){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,m*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 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,
|
|
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),u=new THREE.UV((b+1)/this.segmentsR,(c+1)/this.segmentsT),v=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,u,v])}this.computeCentroids();
|
|
|
|
|
|
+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),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,t,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-- >0;)this.smooth(b)};
|
|
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-- >0;)this.smooth(b)};
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(b){function c(b,e,c,f,n,t){var w=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors){w.vertexColors=[];for(var o,u,v,x=0;x<4;x++){v=t[x];o=new THREE.Color;o.setRGB(0,0,0);for(var y=0;y<v.length;y++)u=n.vertexColors[v[y]-1],o.r+=u.r,o.g+=u.g,o.b+=u.b;o.r/=v.length;o.g/=v.length;o.b/=v.length;w.vertexColors[x]=o}}h.push(w);(!m.supportUVs||p.length!=0)&&k.push([p[b],p[e],p[c],p[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(),u=[],v={},p=[],x,w,z,y,A,E=b.faceVertexUvs[0];x=0;for(w=E.length;x<w;x++){z=0;for(y=E[x].length;z<y;z++)A=f[x]["abcd".charAt(z)],p[A]||(p[A]=E[x][z])}var F;x=0;for(w=f.length;x<w;x++)if(A=f[x],u.push(A.centroid),t.push(new THREE.Vertex(A.centroid)),m.supportUVs&&p.length!=0){F=new THREE.UV;if(A instanceof THREE.Face3)F.u=p[A.a].u+p[A.b].u+p[A.c].u,F.v=p[A.a].v+p[A.b].v+p[A.c].v,F.u/=3,F.v/=3;else if(A instanceof THREE.Face4)F.u=p[A.a].u+
|
|
|
|
-p[A.b].u+p[A.c].u+p[A.d].u,F.v=p[A.a].v+p[A.b].v+p[A.c].v+p[A.d].v,F.u/=4,F.v/=4;p.push(F)}y=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,k,m,h,n={};f=0;for(k=b.faces.length;f<k;f++)m=b.faces[f],m instanceof THREE.Face3?(h=e(m.a,m.b),c(n,h,f),h=e(m.b,m.c),c(n,h,f),h=e(m.c,m.a),c(n,h,f)):m instanceof THREE.Face4&&(h=e(m.a,m.b),c(n,h,f),h=e(m.b,m.c),c(n,h,f),h=e(m.c,m.d),c(n,h,f),h=e(m.d,m.a),c(n,h,f));return n}(b);var D,G,K=0,E=n.length,N;for(x in y)if(A=y[x],F=A[0],D=
|
|
|
|
-A[1],N=x.split("_"),w=N[0],N=N[1],G=new THREE.Vector3,A.length!=2?(G.addSelf(n[w].position),G.addSelf(n[N].position),G.multiplyScalar(0.5)):(G.addSelf(u[F]),G.addSelf(u[D]),G.addSelf(n[w].position),G.addSelf(n[N].position),G.multiplyScalar(0.25)),v[x]=E+f.length+K,t.push(new THREE.Vertex(G)),K++,m.supportUVs&&p.length!=0)F=new THREE.UV,F.u=p[w].u+p[N].u,F.v=p[w].v+p[N].v,F.u/=2,F.v/=2,p.push(F);x=0;for(w=u.length;x<w;x++)A=f[x],F=E+x,A instanceof THREE.Face3?(D=e(A.a,A.b),N=e(A.b,A.c),K=e(A.c,A.a),
|
|
|
|
-c(F,v[D],A.b,v[N],A,["123","12","2","23"]),c(F,v[N],A.c,v[K],A,["123","23","3","31"]),c(F,v[K],A.a,v[D],A,["123","31","1","12"])):A instanceof THREE.Face4?(D=e(A.a,A.b),N=e(A.b,A.c),K=e(A.c,A.d),G=e(A.d,A.a),c(F,v[D],A.b,v[N],A,["1234","12","2","23"]),c(F,v[N],A.c,v[K],A,["1234","23","3","34"]),c(F,v[K],A.d,v[G],A,["1234","34","4","41"]),c(F,v[G],A.a,v[D],A,["1234","41","1","12"])):console.log("face should be a face!",A);var f=t,L={},B={},t=function(b,e){L[b]===void 0&&(L[b]=[]);L[b].push(e)},v=function(b,
|
|
|
|
-e){B[b]===void 0&&(B[b]={});B[b][e]=null};for(x in y)A=y[x],N=x.split("_"),w=N[0],N=N[1],t(w,[w,N]),t(N,[w,N]),F=A[0],D=A[1],v(w,F),D?v(w,D):v(w,F),v(N,F),D?v(N,D):v(N,F);t=new THREE.Vector3;v=new THREE.Vector3;x=0;for(w=n.length;x<w;x++)if(L[x]!==void 0){t.set(0,0,0);v.set(0,0,0);y=new THREE.Vector3(0,0,0);E=0;for(z in B[x])t.addSelf(u[z]),E++;t.divideScalar(E);E=L[x].length;for(z=0;z<E;z++)A=L[x][z],A=n[A[0]].position.clone().addSelf(n[A[1]].position).divideScalar(2),v.addSelf(A);v.divideScalar(E);
|
|
|
|
-y.addSelf(n[x].position);y.multiplyScalar(E-3);y.addSelf(t);y.addSelf(v.multiplyScalar(2));y.divideScalar(E);f[x].position=y}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,t){var v=new THREE.Face4(b,e,c,f,null,n.color,n.material);if(m.useOldVertexColors){v.vertexColors=[];for(var u,p,w,x=0;x<4;x++){w=t[x];u=new THREE.Color;u.setRGB(0,0,0);for(var y=0;y<w.length;y++)p=n.vertexColors[w[y]-1],u.r+=p.r,u.g+=p.g,u.b+=p.b;u.r/=w.length;u.g/=w.length;u.b/=w.length;v.vertexColors[x]=u}}h.push(v);(!m.supportUVs||o.length!=0)&&k.push([o[b],o[e],o[c],o[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(),u=[],w={},o=[],x,v,z,y,A,E=b.faceVertexUvs[0];x=0;for(v=E.length;x<v;x++){z=0;for(y=E[x].length;z<y;z++)A=f[x]["abcd".charAt(z)],o[A]||(o[A]=E[x][z])}var F;x=0;for(v=f.length;x<v;x++)if(A=f[x],u.push(A.centroid),t.push(new THREE.Vertex(A.centroid)),m.supportUVs&&o.length!=0){F=new THREE.UV;if(A instanceof THREE.Face3)F.u=o[A.a].u+o[A.b].u+o[A.c].u,F.v=o[A.a].v+o[A.b].v+o[A.c].v,F.u/=3,F.v/=3;else if(A instanceof THREE.Face4)F.u=o[A.a].u+
|
|
|
|
+o[A.b].u+o[A.c].u+o[A.d].u,F.v=o[A.a].v+o[A.b].v+o[A.c].v+o[A.d].v,F.u/=4,F.v/=4;o.push(F)}y=function(b){function c(b,e,f){b[e]===void 0&&(b[e]=[]);b[e].push(f)}var f,k,m,h,n={};f=0;for(k=b.faces.length;f<k;f++)m=b.faces[f],m instanceof THREE.Face3?(h=e(m.a,m.b),c(n,h,f),h=e(m.b,m.c),c(n,h,f),h=e(m.c,m.a),c(n,h,f)):m instanceof THREE.Face4&&(h=e(m.a,m.b),c(n,h,f),h=e(m.b,m.c),c(n,h,f),h=e(m.c,m.d),c(n,h,f),h=e(m.d,m.a),c(n,h,f));return n}(b);var C,G,J=0,E=n.length,O;for(x in y)if(A=y[x],F=A[0],C=
|
|
|
|
+A[1],O=x.split("_"),v=O[0],O=O[1],G=new THREE.Vector3,A.length!=2?(G.addSelf(n[v].position),G.addSelf(n[O].position),G.multiplyScalar(0.5)):(G.addSelf(u[F]),G.addSelf(u[C]),G.addSelf(n[v].position),G.addSelf(n[O].position),G.multiplyScalar(0.25)),w[x]=E+f.length+J,t.push(new THREE.Vertex(G)),J++,m.supportUVs&&o.length!=0)F=new THREE.UV,F.u=o[v].u+o[O].u,F.v=o[v].v+o[O].v,F.u/=2,F.v/=2,o.push(F);x=0;for(v=u.length;x<v;x++)A=f[x],F=E+x,A instanceof THREE.Face3?(C=e(A.a,A.b),O=e(A.b,A.c),J=e(A.c,A.a),
|
|
|
|
+c(F,w[C],A.b,w[O],A,["123","12","2","23"]),c(F,w[O],A.c,w[J],A,["123","23","3","31"]),c(F,w[J],A.a,w[C],A,["123","31","1","12"])):A instanceof THREE.Face4?(C=e(A.a,A.b),O=e(A.b,A.c),J=e(A.c,A.d),G=e(A.d,A.a),c(F,w[C],A.b,w[O],A,["1234","12","2","23"]),c(F,w[O],A.c,w[J],A,["1234","23","3","34"]),c(F,w[J],A.d,w[G],A,["1234","34","4","41"]),c(F,w[G],A.a,w[C],A,["1234","41","1","12"])):console.log("face should be a face!",A);var f=t,K={},B={},t=function(b,e){K[b]===void 0&&(K[b]=[]);K[b].push(e)},w=function(b,
|
|
|
|
+e){B[b]===void 0&&(B[b]={});B[b][e]=null};for(x in y)A=y[x],O=x.split("_"),v=O[0],O=O[1],t(v,[v,O]),t(O,[v,O]),F=A[0],C=A[1],w(v,F),C?w(v,C):w(v,F),w(O,F),C?w(O,C):w(O,F);t=new THREE.Vector3;w=new THREE.Vector3;x=0;for(v=n.length;x<v;x++)if(K[x]!==void 0){t.set(0,0,0);w.set(0,0,0);y=new THREE.Vector3(0,0,0);E=0;for(z in B[x])t.addSelf(u[z]),E++;t.divideScalar(E);E=K[x].length;for(z=0;z<E;z++)A=K[x][z],A=n[A[0]].position.clone().addSelf(n[A[1]].position).divideScalar(2),w.addSelf(A);w.divideScalar(E);
|
|
|
|
+y.addSelf(n[x].position);y.multiplyScalar(E-3);y.addSelf(t);y.addSelf(w.multiplyScalar(2));y.divideScalar(E);f[x].position=y}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/
|
|
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)==
|
|
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,m,h,n){var p=document.createElement("canvas");b[e]=new THREE.Texture(p);b[e].sourceFile=k;if(m){b[e].repeat.set(m[0],m[1]);if(m[0]!=1)b[e].wrapS=THREE.RepeatWrapping;
|
|
|
|
|
|
+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,m,h,n){var o=document.createElement("canvas");b[e]=new THREE.Texture(o);b[e].sourceFile=k;if(m){b[e].repeat.set(m[0],m[1]);if(m[0]!=1)b[e].wrapS=THREE.RepeatWrapping;
|
|
if(m[1]!=1)b[e].wrapT=THREE.RepeatWrapping}h&&b[e].offset.set(h[0],h[1]);if(n){m={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(m[n[0]]!==void 0)b[e].wrapS=m[n[0]];if(m[n[1]]!==void 0)b[e].wrapT=m[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"));
|
|
if(m[1]!=1)b[e].wrapT=THREE.RepeatWrapping}h&&b[e].offset.set(h[0],h[1]);if(n){m={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(m[n[0]]!==void 0)b[e].wrapS=m[n[0]];if(m[n[1]]!==void 0)b[e].wrapT=m[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"));
|
|
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);
|
|
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);
|
|
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 u=THREE.ShaderUtils.lib.normal,v=THREE.UniformsUtils.clone(u.uniforms),p=m.color;n=m.specular;t=m.ambient;var x=m.shininess;v.tNormal.texture=m.normalMap;if(b.mapNormalFactor)v.uNormalScale.value=b.mapNormalFactor;if(m.map)v.tDiffuse.texture=m.map,v.enableDiffuse.value=!0;if(m.specularMap)v.tSpecular.texture=m.specularMap,v.enableSpecular.value=!0;if(m.lightMap)v.tAO.texture=
|
|
|
|
-m.lightMap,v.enableAO.value=!0;v.uDiffuseColor.value.setHex(p);v.uSpecularColor.value.setHex(n);v.uAmbientColor.value.setHex(t);v.uShininess.value=x;if(m.opacity)v.uOpacity.value=m.opacity;m=new THREE.ShaderMaterial({fragmentShader:u.fragmentShader,vertexShader:u.vertexShader,uniforms:v,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),o=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(o);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: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.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()};
|
|
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)};
|
|
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,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");
|
|
m.setRequestHeader("Content-Type","text/plain");m.send(null)};
|
|
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=v(b,e),k=v(b,e+1),h=v(b,e+2),m=v(b,e+3),n=(m<<1&255|h>>7)-127;f|=(h&127)<<16|k<<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=v(b,e),f=v(b,e+1),k=v(b,e+2);return(v(b,e+3)<<24)+(k<<16)+(f<<8)+c}function t(b,e){var c=v(b,e);return(v(b,e+1)<<8)+c}function u(b,e){var c=v(b,e);return c>127?c-256:c}function v(b,e){return b.charCodeAt(e)&255}function p(e){var c,
|
|
|
|
-f,k;c=h(b,e);f=h(b,e+N);k=h(b,e+L);e=t(b,e+B);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+N);k=h(b,e+L);m=t(b,e+B);o=h(b,e+M);p=h(b,e+U);e=h(b,e+I);m=E.materials[m];var w=G[p*3],u=G[p*3+1];p=G[p*3+2];var v=G[e*3],x=G[e*3+1],e=G[e*3+2];E.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(w,u,p),new THREE.Vector3(v,x,e)],null,m))}function w(e){var c,f,k,m;c=h(b,e);f=h(b,e+S);k=h(b,e+Q);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 z(e){var c,f,k,m,p,w,u,v;c=h(b,e);f=h(b,e+S);k=h(b,e+Q);m=h(b,e+Y);p=t(b,e+W);w=h(b,e+o);u=h(b,e+$);v=h(b,e+T);e=h(b,e+ha);p=E.materials[p];var x=G[u*3],y=G[u*3+1];u=G[u*3+2];var H=G[v*3],A=G[v*3+1];v=G[v*3+2];var ea=G[e*3],z=G[e*3+1],e=G[e*3+2];E.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(G[w*3],G[w*3+1],G[w*3+2]),new THREE.Vector3(x,y,u),new THREE.Vector3(H,A,v),new THREE.Vector3(ea,z,e)],null,p))}
|
|
|
|
-function y(e){var c,f,k,m;c=h(b,e);f=h(b,e+fa);k=h(b,e+oa);e=K[c*2];m=K[c*2+1];c=K[f*2];var o=E.faceVertexUvs[0];f=K[f*2+1];var p=K[k*2];k=K[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 A(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+ca);k=h(b,e+ja);m=h(b,e+la);e=K[c*2];o=K[c*2+1];c=K[f*2];p=K[f*2+1];f=K[k*2];var t=E.faceVertexUvs[0];k=K[k*2+1];var w=K[m*2];m=K[m*2+1];var u=[];u.push(new THREE.UV(e,o));u.push(new THREE.UV(c,p));u.push(new THREE.UV(f,
|
|
|
|
-k));u.push(new THREE.UV(w,m));t.push(u)}var E=this,F=0,D,G=[],K=[],N,L,B,M,U,I,S,Q,Y,W,o,$,T,ha,fa,oa,ca,ja,la,da,X,V,aa,ia,ra;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,e);D={signature:b.substr(F,8),header_bytes:v(b,F+8),vertex_coordinate_bytes:v(b,F+9),normal_coordinate_bytes:v(b,F+10),uv_coordinate_bytes:v(b,F+11),vertex_index_bytes:v(b,F+12),normal_index_bytes:v(b,F+13),uv_index_bytes:v(b,F+14),material_index_bytes:v(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;N=D.vertex_index_bytes;L=D.vertex_index_bytes*2;B=D.vertex_index_bytes*3;M=D.vertex_index_bytes*3+D.material_index_bytes;U=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes;I=D.vertex_index_bytes*3+D.material_index_bytes+D.normal_index_bytes*2;S=D.vertex_index_bytes;
|
|
|
|
-Q=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;$=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes;T=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*2;ha=D.vertex_index_bytes*4+D.material_index_bytes+D.normal_index_bytes*3;fa=D.uv_index_bytes;oa=D.uv_index_bytes*2;ca=D.uv_index_bytes;ja=D.uv_index_bytes*2;la=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;da=D.ntri_flat*e;X=D.ntri_smooth*(e+D.normal_index_bytes*3);V=D.ntri_flat_uv*(e+D.uv_index_bytes*3);aa=D.ntri_smooth_uv*(e+D.normal_index_bytes*3+D.uv_index_bytes*3);ia=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,k,h,n=D.vertex_coordinate_bytes*3,o=e+D.nvertices*n;e<o;e+=n)f=c(b,e),k=c(b,e+D.vertex_coordinate_bytes),h=c(b,e+D.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
|
|
|
|
-k,h)));return D.nvertices*n}(F);F+=function(e){for(var c,f,k,h=D.normal_coordinate_bytes*3,m=e+D.nnormals*h;e<m;e+=h)c=u(b,e),f=u(b,e+D.normal_coordinate_bytes),k=u(b,e+D.normal_coordinate_bytes*2),G.push(c/127,f/127,k/127);return D.nnormals*h}(F);F+=function(e){for(var f,k,h=D.uv_coordinate_bytes*2,n=e+D.nuvs*h;e<n;e+=h)f=c(b,e),k=c(b,e+D.uv_coordinate_bytes),K.push(f,k);return D.nuvs*h}(F);da=F+da;X=da+X;V=X+V;aa=V+aa;ia=aa+ia;e=ia+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,k=b+D.ntri_flat_uv*f;for(e=b;e<k;e+=f)p(e),y(e+c);return k-b})(X);(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,k=b+D.ntri_smooth_uv*f;for(e=b;e<k;e+=f)x(e),y(e+c);return k-b})(V);(function(b){var e,c=D.vertex_index_bytes*4+D.material_index_bytes,f=c+D.uv_index_bytes*4,k=b+D.nquad_flat_uv*f;for(e=b;e<k;e+=f)w(e),A(e+c);return k-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,k=b+D.nquad_smooth_uv*f;for(e=b;e<k;e+=f)z(e),A(e+c);return k-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)p(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})(da);(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)w(e);return f-b})(aa);(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)z(e);return f-b})(ia);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};h.prototype=new THREE.Geometry;h.prototype.constructor=h;c(new h(e))};
|
|
|
|
-THREE.ColladaLoader=function(){function b(b,f,h){X=b;f=f||ia;h!==void 0&&(b=h.split("/"),b.pop(),Ea=b.length<1?"":b.join("/")+"/");ma=c("//dae:library_images/dae:image",m,"image");wa=c("//dae:library_materials/dae:material",B,"material");Ca=c("//dae:library_effects/dae:effect",Q,"effect");qa=c("//dae:library_geometries/dae:geometry",A,"geometry");na=c("//dae:library_controllers/dae:controller",n,"controller");ga=c("//dae:library_animations/dae:animation",W,"animation");Fa=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
|
-v,"visual_scene");Da=[];Ga=[];(b=X.evaluate(".//dae:scene/dae:instance_visual_scene",X,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(b=b.getAttribute("url").replace(/^#/,""),aa=Fa[b]):aa=null;V=new THREE.Object3D;for(b=0;b<aa.nodes.length;b++)V.add(k(aa.nodes[b]));e();for(var o in ga);o={scene:V,morphs:Da,skins:Ga,dae:{images:ma,materials:wa,effects:Ca,geometries:qa,controllers:na,animations:ga,visualScenes:Fa,scene:aa}};f&&f(o);return o}function c(b,e,c){for(var b=X.evaluate(b,
|
|
|
|
-X,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},k=b.iterateNext(),h=0;k;){k=(new e).parse(k);if(k.id.length==0)k.id=c+h++;f[k.id]=k;k=b.iterateNext()}return f}function e(){var b=1E6,e=-b,c=0,f;for(f in ga)for(var k=ga[f],h=0;h<k.sampler.length;h++){var m=k.sampler[h];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 f(b,e,c,k){b.world=b.world||new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var h=
|
|
|
|
-b.channels[0].sampler.output[c];h instanceof THREE.Matrix4&&b.world.copy(h)}k&&b.world.multiply(k,b.world);e.push(b);for(k=0;k<b.nodes.length;k++)f(b.nodes[k],e,c,b.world)}function h(b,c,k){var h=na[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var m=e(),c=aa.getChildById(c.skeleton[0],!0)||aa.getChildBySid(c.skeleton[0],!0),n,o,p,t,w=new THREE.Vector3,
|
|
|
|
-u;for(n=0;n<b.vertices.length;n++)h.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(k=0;k<m.frames;k++){var v=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));f(c,v,k);n=v;o=h.skin;for(t=0;t<n.length;t++)if(p=n[t],u=-1,p.type=="JOINT"){for(var y=0;y<o.joints.length;y++)if(p.sid==o.joints[y]){u=y;break}if(u>=0){y=o.invBindMatrices[u];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 A=
|
|
|
|
-0;A<o.weights[y].length;A++){var z=o.weights[y][A];z.joint==u&&p.weights.push(z)}}else throw"ColladaLoader: Could not find joint '"+p.sid+"'.";}for(n=0;n<v.length;n++)if(v[n].type=="JOINT")for(o=0;o<v[n].weights.length;o++)p=v[n].weights[o],t=p.index,p=p.weight,u=b.vertices[t],t=x[t],w.x=u.position.x,w.y=u.position.y,w.z=u.position.z,v[n].skinningMatrix.multiplyVector3(w),t.position.x+=w.x*p,t.position.y+=w.y*p,t.position.z+=w.z*p;b.morphTargets.push({name:"target_"+k,vertices:x})}}}function k(b){var e=
|
|
|
|
-new THREE.Object3D,c,f,m;e.name=b.id||"";e.matrixAutoUpdate=!1;e.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=na[b.controllers[m].url];switch(n.type){case "skin":if(qa[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(na[n.skin.source]&&(f=n=na[n.skin.source],n.morph&&qa[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(qa[n.morph.source])o=new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),f=b.controllers[m];console.log("ColladaLoader: Morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=qa[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=Ca[wa[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)h(n,c),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=c.skeleton,o.skinController=na[c.url],o.skinInstanceController=c,o.name="skin_"+Ga.length,Ga.push(o);else if(f!==void 0){p=n;t=f instanceof w?
|
|
|
|
-na[f.url]:f;if(!t||!t.morph)console.log("could not find morph controller!");else{t=t.morph;for(v=0;v<t.targets.length;v++){var x=qa[t.targets[v]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:x.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Da.length;Da.push(o)}else o=new THREE.Mesh(n,o);e.add(o)}}for(m=
|
|
|
|
-0;m<b.nodes.length;m++)e.add(k(b.nodes[m],b));return e}function m(){this.init_from=this.id=""}function n(){this.type=this.name=this.id="";this.morph=this.skin=null}function t(){this.weights=this.targets=this.source=this.method=null}function u(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function v(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function p(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=
|
|
|
|
-[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function w(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function A(){this.id="";this.mesh=null}function E(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function F(){}function D(){this.material="";this.count=0;this.inputs=
|
|
|
|
-[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function G(){this.source="";this.stride=this.count=0;this.params=[]}function K(){this.input={}}function N(){this.semantic="";this.offset=0;this.source="";this.set=0}function L(b){this.id=b;this.type=null}function B(){this.name=this.id="";this.instance_effect=null}function M(){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 U(b,e){this.type=
|
|
|
|
-b;this.effect=e;this.material=null}function I(b){this.effect=b;this.format=this.init_from=null}function S(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 Y(){this.url=""}function W(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function o(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=
|
|
|
|
-this.sid=null}function $(b){this.id="";this.animation=b;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function T(b){var e=b.getAttribute("id");if(ra[e]!=void 0)return ra[e];ra[e]=(new L(e)).parse(b);return ra[e]}function ha(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function fa(b){for(var b=ca(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function oa(b){for(var b=ca(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],
|
|
|
|
-10));return e}function ca(b){return b.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function ja(b,e,c){return b.hasAttribute(e)?parseInt(b.getAttribute(e),10):c}function la(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 da(b,e){var c="";c+=la(b.x,e)+",";c+=la(b.y,e)+",";c+=la(b.z,e);return c}var X=null,V=null,aa,ia=null,ra={},ma={},ga={},na={},qa={},
|
|
|
|
-wa={},Ca={},Fa,Ea,Da,Ga,ya=THREE.SmoothShading;m.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};n.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 u).parse(c);this.type=c.nodeName;break;case "morph":this.morph=
|
|
|
|
-(new t).parse(c),this.type=c.nodeName}}return this};t.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 k=b.childNodes[f];if(k.nodeType==1)switch(k.nodeName){case "source":k=(new L).parse(k);e[k.id]=k;break;case "targets":c=this.parseInputs(k);break;default:console.log(k.nodeName)}}for(f=0;f<c.length;f++)switch(b=c[f],k=e[b.source],b.semantic){case "MORPH_TARGET":this.targets=
|
|
|
|
-k.read();break;case "MORPH_WEIGHT":this.weights=k.read()}return this};t.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};u.prototype.parse=function(b){var e={},c,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var k=0;k<b.childNodes.length;k++){var h=b.childNodes[k];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=
|
|
|
|
-fa(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new L).parse(h);e[h.id]=h;break;case "joints":c=h;break;case "vertex_weights":f=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,e);this.parseWeights(f,e);return this};u.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),k=e[f.source];if(f.semantic=="JOINT")this.joints=k.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=k.read()}}};u.prototype.parseWeights=function(b,e){for(var c,f,k=[],h=0;h<b.childNodes.length;h++){var m=b.childNodes[h];if(m.nodeType==1)switch(m.nodeName){case "input":k.push((new N).parse(m));break;case "v":c=oa(m.textContent);break;case "vcount":f=oa(m.textContent)}}for(h=m=0;h<f.length;h++){for(var n=f[h],o=[],p=0;p<n;p++){for(var t={},u=0;u<k.length;u++){var w=
|
|
|
|
-k[u],v=c[m+w.offset];switch(w.semantic){case "JOINT":t.joint=v;break;case "WEIGHT":t.weight=e[w.source].data[v]}}o.push(t);m+=k.length}for(p=0;p<o.length;p++)o[p].index=h;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.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 p).parse(c))}}return this};p.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 k=f.shift(),h=k.indexOf(".")>=0,m=k.indexOf("(")>=0,n;if(h)f=k.split("."),k=f.shift(),f.shift();else if(m){n=k.split("(");k=n.shift();
|
|
|
|
-for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,""))}if(k==b)return c.info={sid:k,dotSyntax:h,arrSyntax:m,arrIndices:n},c}return null};p.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};p.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};p.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};p.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 p).parse(e));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new w).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=X.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",X,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(e));break;
|
|
|
|
-case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new x).parse(e));break;case "extra":break;default:console.log(e.nodeName)}b=[];c=1E6;e=-1E6;for(var f in ga)for(var k=ga[f],h=0;h<k.channel.length;h++){var m=k.channel[h],n=k.sampler[h];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 k={},o=h=void 0,h=0;h<this.channels.length;h++)o=this.channels[h],k[o.sid]=o;m=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(n=this.transforms[h],o=k[n.sid],o!==void 0){for(var t=o.sampler,u,o=0;o<t.input.length-1;o++)if(t.input[o+1]>e){u=t.output[o];break}m=u!==void 0?u instanceof THREE.Matrix4?
|
|
|
|
-m.multiply(m,u):m.multiply(m,n.matrix):m.multiply(m,n.matrix)}else m=m.multiply(m,n.matrix);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};p.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};x.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=fa(b.textContent);this.updateMatrix();return this};
|
|
|
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(b,c,e,f){var h=function(e){function c(b,e){var f=w(b,e),k=w(b,e+1),h=w(b,e+2),m=w(b,e+3),n=(m<<1&255|h>>7)-127;f|=(h&127)<<16|k<<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 u(b,e){var c=w(b,e);return c>127?c-256:c}function w(b,e){return b.charCodeAt(e)&255}function o(e){var c,
|
|
|
|
+f,k;c=h(b,e);f=h(b,e+O);k=h(b,e+K);e=t(b,e+B);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+B);o=h(b,e+N);p=h(b,e+Y);e=h(b,e+H);m=E.materials[m];var u=G[p*3],v=G[p*3+1];p=G[p*3+2];var w=G[e*3],x=G[e*3+1],e=G[e*3+2];E.faces.push(new THREE.Face3(c,f,k,[new THREE.Vector3(G[o*3],G[o*3+1],G[o*3+2]),new THREE.Vector3(u,v,p),new THREE.Vector3(w,x,e)],null,m))}function v(e){var c,f,k,m;c=h(b,e);f=h(b,e+T);k=h(b,e+Q);m=h(b,
|
|
|
|
+e+Z);e=t(b,e+$);E.faces.push(new THREE.Face4(c,f,k,m,null,null,E.materials[e]))}function z(e){var c,f,k,m,o,u,v,w;c=h(b,e);f=h(b,e+T);k=h(b,e+Q);m=h(b,e+Z);o=t(b,e+$);u=h(b,e+S);v=h(b,e+p);w=h(b,e+V);e=h(b,e+ea);o=E.materials[o];var x=G[v*3],y=G[v*3+1];v=G[v*3+2];var L=G[w*3],M=G[w*3+1];w=G[w*3+2];var z=G[e*3],A=G[e*3+1],e=G[e*3+2];E.faces.push(new THREE.Face4(c,f,k,m,[new THREE.Vector3(G[u*3],G[u*3+1],G[u*3+2]),new THREE.Vector3(x,y,v),new THREE.Vector3(L,M,w),new THREE.Vector3(z,A,e)],null,o))}
|
|
|
|
+function y(e){var c,f,k,m;c=h(b,e);f=h(b,e+da);k=h(b,e+ha);e=J[c*2];m=J[c*2+1];c=J[f*2];var o=E.faceVertexUvs[0];f=J[f*2+1];var p=J[k*2];k=J[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 A(e){var c,f,k,m,o,p;c=h(b,e);f=h(b,e+ga);k=h(b,e+ka);m=h(b,e+na);e=J[c*2];o=J[c*2+1];c=J[f*2];p=J[f*2+1];f=J[k*2];var t=E.faceVertexUvs[0];k=J[k*2+1];var v=J[m*2];m=J[m*2+1];var u=[];u.push(new THREE.UV(e,o));u.push(new THREE.UV(c,p));u.push(new THREE.UV(f,
|
|
|
|
+k));u.push(new THREE.UV(v,m));t.push(u)}var E=this,F=0,C,G=[],J=[],O,K,B,N,Y,H,T,Q,Z,$,S,p,V,ea,da,ha,ga,ka,na,aa,W,U,ia,ja,ta;THREE.Geometry.call(this);THREE.Loader.prototype.init_materials(E,f,e);C={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+=C.header_bytes;O=C.vertex_index_bytes;K=C.vertex_index_bytes*2;B=C.vertex_index_bytes*3;N=C.vertex_index_bytes*3+C.material_index_bytes;Y=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes;H=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*2;T=C.vertex_index_bytes;
|
|
|
|
+Q=C.vertex_index_bytes*2;Z=C.vertex_index_bytes*3;$=C.vertex_index_bytes*4;S=C.vertex_index_bytes*4+C.material_index_bytes;p=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes;V=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*2;ea=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*3;da=C.uv_index_bytes;ha=C.uv_index_bytes*2;ga=C.uv_index_bytes;ka=C.uv_index_bytes*2;na=C.uv_index_bytes*3;e=C.vertex_index_bytes*3+C.material_index_bytes;ta=C.vertex_index_bytes*
|
|
|
|
+4+C.material_index_bytes;aa=C.ntri_flat*e;W=C.ntri_smooth*(e+C.normal_index_bytes*3);U=C.ntri_flat_uv*(e+C.uv_index_bytes*3);ia=C.ntri_smooth_uv*(e+C.normal_index_bytes*3+C.uv_index_bytes*3);ja=C.nquad_flat*ta;e=C.nquad_smooth*(ta+C.normal_index_bytes*4);ta=C.nquad_flat_uv*(ta+C.uv_index_bytes*4);F+=function(e){for(var f,k,h,n=C.vertex_coordinate_bytes*3,o=e+C.nvertices*n;e<o;e+=n)f=c(b,e),k=c(b,e+C.vertex_coordinate_bytes),h=c(b,e+C.vertex_coordinate_bytes*2),E.vertices.push(new THREE.Vertex(new THREE.Vector3(f,
|
|
|
|
+k,h)));return C.nvertices*n}(F);F+=function(e){for(var c,f,k,h=C.normal_coordinate_bytes*3,m=e+C.nnormals*h;e<m;e+=h)c=u(b,e),f=u(b,e+C.normal_coordinate_bytes),k=u(b,e+C.normal_coordinate_bytes*2),G.push(c/127,f/127,k/127);return C.nnormals*h}(F);F+=function(e){for(var f,k,h=C.uv_coordinate_bytes*2,n=e+C.nuvs*h;e<n;e+=h)f=c(b,e),k=c(b,e+C.uv_coordinate_bytes),J.push(f,k);return C.nuvs*h}(F);aa=F+aa;W=aa+W;U=W+U;ia=U+ia;ja=ia+ja;e=ja+e;ta=e+ta;(function(b){var e,c=C.vertex_index_bytes*3+C.material_index_bytes,
|
|
|
|
+f=c+C.uv_index_bytes*3,k=b+C.ntri_flat_uv*f;for(e=b;e<k;e+=f)o(e),y(e+c);return k-b})(W);(function(b){var e,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=c+C.uv_index_bytes*3,k=b+C.ntri_smooth_uv*f;for(e=b;e<k;e+=f)x(e),y(e+c);return k-b})(U);(function(b){var e,c=C.vertex_index_bytes*4+C.material_index_bytes,f=c+C.uv_index_bytes*4,k=b+C.nquad_flat_uv*f;for(e=b;e<k;e+=f)v(e),A(e+c);return k-b})(e);(function(b){var e,c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*
|
|
|
|
+4,f=c+C.uv_index_bytes*4,k=b+C.nquad_smooth_uv*f;for(e=b;e<k;e+=f)z(e),A(e+c);return k-b})(ta);(function(b){var e,c=C.vertex_index_bytes*3+C.material_index_bytes,f=b+C.ntri_flat*c;for(e=b;e<f;e+=c)o(e);return f-b})(F);(function(b){var e,c=C.vertex_index_bytes*3+C.material_index_bytes+C.normal_index_bytes*3,f=b+C.ntri_smooth*c;for(e=b;e<f;e+=c)x(e);return f-b})(aa);(function(b){var e,c=C.vertex_index_bytes*4+C.material_index_bytes,f=b+C.nquad_flat*c;for(e=b;e<f;e+=c)v(e);return f-b})(ia);(function(b){var e,
|
|
|
|
+c=C.vertex_index_bytes*4+C.material_index_bytes+C.normal_index_bytes*4,f=b+C.nquad_smooth*c;for(e=b;e<f;e+=c)z(e);return f-b})(ja);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,f,h){W=b;f=f||ja;h!==void 0&&(b=h.split("/"),b.pop(),Ga=b.length<1?"":b.join("/")+"/");la=c("//dae:library_images/dae:image",m,"image");sa=c("//dae:library_materials/dae:material",B,"material");ya=c("//dae:library_effects/dae:effect",Q,"effect");ra=c("//dae:library_geometries/dae:geometry",A,"geometry");pa=c("//dae:library_controllers/dae:controller",n,"controller");ca=c("//dae:library_animations/dae:animation",$,"animation");Ca=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
|
+w,"visual_scene");Fa=[];Da=[];(b=W.evaluate(".//dae:scene/dae:instance_visual_scene",W,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(b=b.getAttribute("url").replace(/^#/,""),ia=Ca[b]):ia=null;U=new THREE.Object3D;for(b=0;b<ia.nodes.length;b++)U.add(k(ia.nodes[b]));e();for(var o in ca);o={scene:U,morphs:Fa,skins:Da,dae:{images:la,materials:sa,effects:ya,geometries:ra,controllers:pa,animations:ca,visualScenes:Ca,scene:ia}};f&&f(o);return o}function c(b,e,c){for(var b=W.evaluate(b,
|
|
|
|
+W,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),f={},k=b.iterateNext(),h=0;k;){k=(new e).parse(k);if(k.id.length==0)k.id=c+h++;f[k.id]=k;k=b.iterateNext()}return f}function e(){var b=1E6,e=-b,c=0,f;for(f in ca)for(var k=ca[f],h=0;h<k.sampler.length;h++){var m=k.sampler[h];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 f(b,e,c,k){b.world=b.world||new THREE.Matrix4;b.world.copy(b.matrix);if(b.channels&&b.channels.length){var h=
|
|
|
|
+b.channels[0].sampler.output[c];h instanceof THREE.Matrix4&&b.world.copy(h)}k&&b.world.multiply(k,b.world);e.push(b);for(k=0;k<b.nodes.length;k++)f(b.nodes[k],e,c,b.world)}function h(b,c,k){var h=pa[c.url];if(!h||!h.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!c.skeleton||!c.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var m=e(),c=ia.getChildById(c.skeleton[0],!0)||ia.getChildBySid(c.skeleton[0],!0),n,o,p,t,u=new THREE.Vector3,
|
|
|
|
+v;for(n=0;n<b.vertices.length;n++)h.skin.bindShapeMatrix.multiplyVector3(b.vertices[n].position);for(k=0;k<m.frames;k++){var w=[],x=[];for(n=0;n<b.vertices.length;n++)x.push(new THREE.Vertex(new THREE.Vector3));f(c,w,k);n=w;o=h.skin;for(t=0;t<n.length;t++)if(p=n[t],v=-1,p.type=="JOINT"){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"ColladaLoader: Could not find joint '"+p.sid+"'.";}for(n=0;n<w.length;n++)if(w[n].type=="JOINT")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_"+k,vertices:x})}}}function k(b){var e=
|
|
|
|
+new THREE.Object3D,c,f,m;e.name=b.id||"";e.matrixAutoUpdate=!1;e.matrix=b.matrix;for(m=0;m<b.controllers.length;m++){var n=pa[b.controllers[m].url];switch(n.type){case "skin":if(ra[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(pa[n.skin.source]&&(f=n=pa[n.skin.source],n.morph&&ra[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(ra[n.morph.source])o=new y,o.url=n.morph.source,o.instance_material=b.controllers[m].instance_material,b.geometries.push(o),f=b.controllers[m];console.log("ColladaLoader: Morph-controller partially supported.")}}for(m=0;m<b.geometries.length;m++){var n=b.geometries[m],o=n.instance_material,n=ra[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 w=ya[sa[u.target].instance_effect.url].shader;w.material.opacity=
|
|
|
|
+!w.material.opacity?1:w.material.opacity;u=p[u.symbol]=w.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)h(n,c),o.morphTargets=!0,o=new THREE.SkinnedMesh(n,o),o.skeleton=c.skeleton,o.skinController=pa[c.url],o.skinInstanceController=c,o.name="skin_"+Da.length,Da.push(o);else if(f!==void 0){p=n;t=f instanceof v?
|
|
|
|
+pa[f.url]:f;if(!t||!t.morph)console.log("could not find morph controller!");else{t=t.morph;for(w=0;w<t.targets.length;w++){var x=ra[t.targets[w]];if(x.mesh&&x.mesh.primitives&&x.mesh.primitives.length)x=x.mesh.primitives[0].geometry,x.vertices.length===p.vertices.length&&p.morphTargets.push({name:"target_1",vertices:x.vertices})}p.morphTargets.push({name:"target_Z",vertices:p.vertices})}o.morphTargets=!0;o=new THREE.Mesh(n,o);o.name="morph_"+Fa.length;Fa.push(o)}else o=new THREE.Mesh(n,o);e.add(o)}}for(m=
|
|
|
|
+0;m<b.nodes.length;m++)e.add(k(b.nodes[m],b));return e}function m(){this.init_from=this.id=""}function n(){this.type=this.name=this.id="";this.morph=this.skin=null}function t(){this.weights=this.targets=this.source=this.method=null}function u(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function w(){this.name=this.id="";this.nodes=[];this.scene=new THREE.Object3D}function o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=[];this.transforms=
|
|
|
|
+[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function x(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function v(){this.url="";this.skeleton=[];this.instance_material=[]}function z(){this.target=this.symbol=""}function y(){this.url="";this.instance_material=[]}function A(){this.id="";this.mesh=null}function E(b){this.geometry=b.id;this.primitives=[];this.geometry3js=this.vertices=null}function F(){}function C(){this.material="";this.count=0;this.inputs=
|
|
|
|
+[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function G(){this.source="";this.stride=this.count=0;this.params=[]}function J(){this.input={}}function O(){this.semantic="";this.offset=0;this.source="";this.set=0}function K(b){this.id=b;this.type=null}function B(){this.name=this.id="";this.instance_effect=null}function N(){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 Y(b,e){this.type=
|
|
|
|
+b;this.effect=e;this.material=null}function H(b){this.effect=b;this.format=this.init_from=null}function T(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 Z(){this.url=""}function $(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function S(b){this.animation=b;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=
|
|
|
|
+this.sid=null}function p(b){this.id="";this.animation=b;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function V(b){var e=b.getAttribute("id");if(ta[e]!=void 0)return ta[e];ta[e]=(new K(e)).parse(b);return ta[e]}function ea(b){if(b=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function da(b){for(var b=ga(b),e=[],c=0;c<b.length;c++)e.push(parseFloat(b[c]));return e}function ha(b){for(var b=ga(b),e=[],c=0;c<b.length;c++)e.push(parseInt(b[c],
|
|
|
|
+10));return e}function ga(b){return b.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function ka(b,e,c){return b.hasAttribute(e)?parseInt(b.getAttribute(e),10):c}function na(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 aa(b,e){var c="";c+=na(b.x,e)+",";c+=na(b.y,e)+",";c+=na(b.z,e);return c}var W=null,U=null,ia,ja=null,ta={},la={},ca={},pa={},ra={},
|
|
|
|
+sa={},ya={},Ca,Ga,Fa,Da,za=THREE.SmoothShading;m.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};n.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 u).parse(c);this.type=c.nodeName;break;case "morph":this.morph=
|
|
|
|
+(new t).parse(c),this.type=c.nodeName}}return this};t.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 k=b.childNodes[f];if(k.nodeType==1)switch(k.nodeName){case "source":k=(new K).parse(k);e[k.id]=k;break;case "targets":c=this.parseInputs(k);break;default:console.log(k.nodeName)}}for(f=0;f<c.length;f++)switch(b=c[f],k=e[b.source],b.semantic){case "MORPH_TARGET":this.targets=
|
|
|
|
+k.read();break;case "MORPH_WEIGHT":this.weights=k.read()}return this};t.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 O).parse(f))}}return e};u.prototype.parse=function(b){var e={},c,f;this.source=b.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var k=0;k<b.childNodes.length;k++){var h=b.childNodes[k];if(h.nodeType==1)switch(h.nodeName){case "bind_shape_matrix":h=
|
|
|
|
+da(h.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],h[8],h[9],h[10],h[11],h[12],h[13],h[14],h[15]);break;case "source":h=(new K).parse(h);e[h.id]=h;break;case "joints":c=h;break;case "vertex_weights":f=h;break;default:console.log(h.nodeName)}}this.parseJoints(c,e);this.parseWeights(f,e);return this};u.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 O).parse(f),k=e[f.source];if(f.semantic=="JOINT")this.joints=k.read();else if(f.semantic=="INV_BIND_MATRIX")this.invBindMatrices=k.read()}}};u.prototype.parseWeights=function(b,e){for(var c,f,k=[],h=0;h<b.childNodes.length;h++){var m=b.childNodes[h];if(m.nodeType==1)switch(m.nodeName){case "input":k.push((new O).parse(m));break;case "v":c=ha(m.textContent);break;case "vcount":f=ha(m.textContent)}}for(h=m=0;h<f.length;h++){for(var n=f[h],o=[],p=0;p<n;p++){for(var t={},u=0;u<k.length;u++){var v=
|
|
|
|
+k[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+=k.length}for(p=0;p<o.length;p++)o[p].index=h;this.weights.push(o)}};w.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};w.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};w.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 o).parse(c))}}return this};o.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 k=f.shift(),h=k.indexOf(".")>=0,m=k.indexOf("(")>=0,n;if(h)f=k.split("."),k=f.shift(),f.shift();else if(m){n=k.split("(");k=n.shift();
|
|
|
|
+for(f=0;f<n.length;f++)n[f]=parseInt(n[f].replace(/\)/,""))}if(k==b)return c.info={sid:k,dotSyntax:h,arrSyntax:m,arrIndices:n},c}return null};o.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};o.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};o.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};o.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 o).parse(e));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new v).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=W.evaluate(".//dae:library_nodes//dae:node[@id='"+e+"']",W,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(e));break;
|
|
|
|
+case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new x).parse(e));break;case "extra":break;default:console.log(e.nodeName)}b=[];c=1E6;e=-1E6;for(var f in ca)for(var k=ca[f],h=0;h<k.channel.length;h++){var m=k.channel[h],n=k.sampler[h];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 k={},p=h=void 0,h=0;h<this.channels.length;h++)p=this.channels[h],k[p.sid]=p;m=new THREE.Matrix4;for(h=0;h<this.transforms.length;h++)if(n=this.transforms[h],p=k[n.sid],p!==void 0){for(var t=p.sampler,u,p=0;p<t.input.length-1;p++)if(t.input[p+1]>e){u=t.output[p];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};o.prototype.updateMatrix=function(){this.matrix.identity();for(var b=0;b<this.transforms.length;b++)this.matrix.multiply(this.matrix,this.transforms[b].matrix)};x.prototype.parse=function(b){this.sid=b.getAttribute("sid");this.type=b.nodeName;this.data=da(b.textContent);this.updateMatrix();return this};
|
|
x.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],
|
|
x.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};w.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=X.evaluate(".//dae:instance_material",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
|
-null))for(var f=c.iterateNext();f;)this.instance_material.push((new z).parse(f)),f=c.iterateNext()}}return this};z.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=X.evaluate(".//dae:instance_material",
|
|
|
|
-c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new z).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 E(this)).parse(c)}}return this};E.prototype.parse=function(b){function e(b,c){var f=da(b.position);k[f]===void 0&&(k[f]={v:b,index:c});return k[f]}this.primitives=[];var c;for(c=
|
|
|
|
-0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":T(f);break;case "vertices":this.vertices=(new K).parse(f);break;case "triangles":this.primitives.push((new D).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new F).parse(f))}}var k={};this.geometry3js=new THREE.Geometry;f=ra[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var h=new THREE.Vertex(new THREE.Vector3(f[c],f[c+
|
|
|
|
-1],f[c+2]));e(h,b);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,k);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};E.prototype.handlePrimitive=function(b,e,c){var f=0,k,h,m=b.p,n=b.inputs,o,p,t,u=0,w=3,v=[];for(k=0;k<n.length;k++)switch(o=n[k],
|
|
|
|
-o.semantic){case "TEXCOORD":v.push(o.set)}for(;f<m.length;){var x=[],y=[],A={},z=[];b.vcount&&(w=b.vcount[u++]);for(k=0;k<w;k++)for(h=0;h<n.length;h++)switch(o=n[h],source=ra[o.source],p=m[f+k*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=da(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":A[o.set]===void 0&&(A[o.set]=[]);A[o.set].push(new THREE.UV(source.data[t],
|
|
|
|
-source.data[t+1]));break;case "COLOR":z.push((new THREE.Color).setRGB(source.data[t],source.data[t+1],source.data[t+2]))}var B;w==3?B=new THREE.Face3(x[0],x[1],x[2],[y[0],y[1],y[2]],z.length?z:new THREE.Color):w==4&&(B=new THREE.Face4(x[0],x[1],x[2],x[3],[y[0],y[1],y[2],y[3]],z.length?z:new THREE.Color));B.daeMaterial=b.material;e.faces.push(B);for(h=0;h<v.length;h++)k=A[v[h]],e.faceVertexUvs[h].push([k[0],k[1],k[2]]);f+=n.length*w}};F.prototype=new D;F.prototype.constructor=F;D.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};D.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=ja(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=oa(c.textContent);break;case "p":this.p=oa(c.textContent)}}return this};G.prototype.parse=
|
|
|
|
-function(b){this.params=[];this.source=b.getAttribute("source");this.count=ja(b,"count",0);this.stride=ja(b,"stride",0);for(var 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};K.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=ja(b,"set",-1);this.offset=ja(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};L.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=ca(c.textContent),k=[],h=0;h<f.length;h++)k.push(f[h]=="true"||f[h]=="1"?
|
|
|
|
-!0:!1);this.data=k;this.type=c.nodeName;break;case "float_array":this.data=fa(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=oa(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ca(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 G).parse(c.childNodes[f]);break}}}return this};L.prototype.read=function(){var b=[],e=this.accessor.params[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};v.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=W.evaluate(".//dae:instance_material",c,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
|
+null))for(var f=c.iterateNext();f;)this.instance_material.push((new z).parse(f)),f=c.iterateNext()}}return this};z.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=W.evaluate(".//dae:instance_material",
|
|
|
|
+c,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(e=b.iterateNext();e;)this.instance_material.push((new z).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 E(this)).parse(c)}}return this};E.prototype.parse=function(b){function e(b,c){var f=aa(b.position);k[f]===void 0&&(k[f]={v:b,index:c});return k[f]}this.primitives=[];var c;for(c=
|
|
|
|
+0;c<b.childNodes.length;c++){var f=b.childNodes[c];switch(f.nodeName){case "source":V(f);break;case "vertices":this.vertices=(new J).parse(f);break;case "triangles":this.primitives.push((new C).parse(f));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new F).parse(f))}}var k={};this.geometry3js=new THREE.Geometry;f=ta[this.vertices.input.POSITION.source].data;for(b=c=0;c<f.length;c+=3,b++){var h=new THREE.Vertex(new THREE.Vector3(f[c],f[c+
|
|
|
|
+1],f[c+2]));e(h,b);this.geometry3js.vertices.push(h)}for(c=0;c<this.primitives.length;c++)primitive=this.primitives[c],primitive.setVertices(this.vertices),this.handlePrimitive(primitive,this.geometry3js,k);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};E.prototype.handlePrimitive=function(b,e,c){var f=0,k,h,m=b.p,n=b.inputs,o,p,t,u=0,v=3,w=[];for(k=0;k<n.length;k++)switch(o=n[k],
|
|
|
|
+o.semantic){case "TEXCOORD":w.push(o.set)}for(;f<m.length;){var x=[],y=[],z={},A=[];b.vcount&&(v=b.vcount[u++]);for(k=0;k<v;k++)for(h=0;h<n.length;h++)switch(o=n[h],source=ta[o.source],p=m[f+k*n.length+o.offset],numParams=source.accessor.params.length,t=p*numParams,o.semantic){case "VERTEX":o=aa(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(h=0;h<w.length;h++)k=z[w[h]],e.faceVertexUvs[h].push([k[0],k[1],k[2]]);f+=n.length*v}};F.prototype=new C;F.prototype.constructor=F;C.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};C.prototype.parse=function(b){this.inputs=[];this.material=b.getAttribute("material");this.count=ka(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 O).parse(b.childNodes[e]));break;case "vcount":this.vcount=ha(c.textContent);break;case "p":this.p=ha(c.textContent)}}return this};G.prototype.parse=
|
|
|
|
+function(b){this.params=[];this.source=b.getAttribute("source");this.count=ka(b,"count",0);this.stride=ka(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};J.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 O).parse(b.childNodes[e]),this.input[input.semantic]=
|
|
|
|
+input);return this};O.prototype.parse=function(b){this.semantic=b.getAttribute("semantic");this.source=b.getAttribute("source").replace(/^#/,"");this.set=ka(b,"set",-1);this.offset=ka(b,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};K.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=ga(c.textContent),k=[],h=0;h<f.length;h++)k.push(f[h]=="true"||f[h]=="1"?
|
|
|
|
+!0:!1);this.data=k;this.type=c.nodeName;break;case "float_array":this.data=da(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=ha(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=ga(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 G).parse(c.childNodes[f]);break}}}return this};K.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("ColladaLoader: Source: Read dont know how to read "+e.type+".")}return b};B.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==
|
|
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("ColladaLoader: Source: Read dont know how to read "+e.type+".")}return b};B.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 Y).parse(b.childNodes[e]);break}return this};M.prototype.isColor=function(){return this.texture==null};M.prototype.isTexture=function(){return this.texture!=null};M.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=fa(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};U.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 M).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=X.evaluate(".//dae:float",c,ha,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var k=f.iterateNext(),h=[];k;)h.push(k),k=f.iterateNext();
|
|
|
|
-f=h;f.length>0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};U.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 M)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=ma[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=ya;return this.material=new THREE.MeshLambertMaterial(b)};I.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};S.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;
|
|
|
|
|
|
+"instance_effect"){this.instance_effect=(new Z).parse(b.childNodes[e]);break}return this};N.prototype.isColor=function(){return this.texture==null};N.prototype.isTexture=function(){return this.texture!=null};N.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=da(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};Y.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 N).parse(c);break;case "shininess":case "reflectivity":case "transparency":var f;f=W.evaluate(".//dae:float",c,ea,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var k=f.iterateNext(),h=[];k;)h.push(k),k=f.iterateNext();
|
|
|
|
+f=h;f.length>0&&(this[c.nodeName]=parseFloat(f[0].textContent))}}this.create();return this};Y.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 N)if(f.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(f=la[this.effect.surface.init_from]))b.map=THREE.ImageUtils.loadTexture(Ga+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=za;return this.material=new THREE.MeshLambertMaterial(b)};H.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};T.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};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=
|
|
break;case "wrap_t":this.wrap_t=c.textContent;break;default:console.log("unhandled Sampler2D prop: "+c.nodeName)}}return this};Q.prototype.create=function(){if(this.shader==null)return null};Q.prototype.parse=function(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 I(this)).parse(f);this.surface.sid=e;break;case "sampler2D":this.sampler=(new S(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 U(c.nodeName,this)).parse(c)}}};Y.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};W.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 L).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new $(this)).parse(c));break;case "channel":this.channel.push((new o(this)).parse(c))}}return this};o.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,k,h;if(c)e=b.split("."),b=e.shift(),h=e.shift();else if(f){k=b.split("(");b=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}this.sid=b;this.dotSyntax=c;this.arrSyntax=f;this.arrIndices=k;this.member=h;return this};$.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};
|
|
|
|
-$.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=
|
|
|
|
|
|
+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 H(this)).parse(f);this.surface.sid=e;break;case "sampler2D":this.sampler=(new T(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 Y(c.nodeName,this)).parse(c)}}};Z.prototype.parse=function(b){this.url=b.getAttribute("url").replace(/^#/,"");return this};$.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 K).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new p(this)).parse(c));break;case "channel":this.channel.push((new S(this)).parse(c))}}return this};S.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,k,h;if(c)e=b.split("."),b=e.shift(),h=e.shift();else if(f){k=b.split("(");b=k.shift();for(e=0;e<k.length;e++)k[e]=parseInt(k[e].replace(/\)/,""))}this.sid=b;this.dotSyntax=c;this.arrSyntax=f;this.arrIndices=k;this.member=h;return this};p.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 O).parse(c))}}return this};
|
|
|
|
+p.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,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(f.readyState==4&&(f.status==0||f.status==
|
|
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,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);e+="?rnd="+Math.random();var f=new XMLHttpRequest;f.overrideMimeType&&f.overrideMimeType("text/xml");f.onreadystatechange=function(){if(f.readyState==4&&(f.status==0||f.status==
|
|
-200))ia=c,b(f.responseXML,void 0,e)};f.open("GET",e,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:b,setPreferredShading:function(b){ya=b},applySkin:h,geometries:qa}};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;
|
|
|
|
|
|
+200))ja=c,b(f.responseXML,void 0,e)};f.open("GET",e,!0);f.send(null)}else alert("Don't know how to parse XML!")},parse:b,setPreferredShading:function(b){za=b},applySkin:h,geometries:ra}};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,c,e){var f=this,h;if(b instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),h=b,b=h.model,c=h.callback,e=h.texture_path;h=new Worker(b);e=e?e:this.extractUrlbase(b);h.onmessage=function(b){f.createModel(b.data,c,e);f.onLoadComplete()};this.onLoadStart();h.postMessage((new Date).getTime())};
|
|
THREE.JSONLoader.prototype.load=function(b,c,e){var f=this,h;if(b instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),h=b,b=h.model,c=h.callback,e=h.texture_path;h=new Worker(b);e=e?e:this.extractUrlbase(b);h.onmessage=function(b){f.createModel(b.data,c,e);f.onLoadComplete()};this.onLoadStart();h.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,u,v,p,x,w,z,y,A,E,F,D,G=b.faces;p=b.vertices;var K=b.normals,N=b.colors,L=0;for(c=0;c<b.uvs.length;c++)b.uvs[c].length&&L++;for(c=0;c<L;c++)f.faceUvs[c]=[],f.faceVertexUvs[c]=[];u=0;for(v=p.length;u<v;)x=new THREE.Vertex,x.position.x=p[u++]*e,x.position.y=
|
|
|
|
-p[u++]*e,x.position.z=p[u++]*e,f.vertices.push(x);u=0;for(v=G.length;u<v;){e=G[u++];p=e&1;t=e&2;c=e&4;h=e&8;w=e&16;x=e&32;y=e&64;e&=128;p?(A=new THREE.Face4,A.a=G[u++],A.b=G[u++],A.c=G[u++],A.d=G[u++],p=4):(A=new THREE.Face3,A.a=G[u++],A.b=G[u++],A.c=G[u++],p=3);if(t)t=G[u++],A.materials=f.materials[t];t=f.faces.length;if(c)for(c=0;c<L;c++)E=b.uvs[c],z=G[u++],D=E[z*2],z=E[z*2+1],f.faceUvs[c][t]=new THREE.UV(D,z);if(h)for(c=0;c<L;c++){E=b.uvs[c];F=[];for(h=0;h<p;h++)z=G[u++],D=E[z*2],z=E[z*2+1],F[h]=
|
|
|
|
-new THREE.UV(D,z);f.faceVertexUvs[c][t]=F}if(w)w=G[u++]*3,h=new THREE.Vector3,h.x=K[w++],h.y=K[w++],h.z=K[w],A.normal=h;if(x)for(c=0;c<p;c++)w=G[u++]*3,h=new THREE.Vector3,h.x=K[w++],h.y=K[w++],h.z=K[w],A.vertexNormals.push(h);if(y)x=G[u++],x=new THREE.Color(N[x]),A.color=x;if(e)for(c=0;c<p;c++)x=G[u++],x=new THREE.Color(N[x]),A.vertexColors.push(x);f.faces.push(A)}}})(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,u,v,p,x,w,z;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=[];w=f.morphTargets[c].vertices;z=b.morphTargets[c].vertices;t=0;for(u=z.length;t<u;t+=3)v=z[t]*e,p=z[t+1]*
|
|
|
|
-e,x=z[t+2]*e,w.push(new THREE.Vertex(new THREE.Vector3(v,p,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;v=b.morphColors[c].colors;e=0;for(t=v.length;e<t;e+=3)p=new THREE.Color(16755200),p.setRGB(v[e],v[e+1],v[e+2]),u.push(p)}}})(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,t,u,w,o,x,v,z,y,A,E,F,C,G=b.faces;o=b.vertices;var J=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]=[];u=0;for(w=o.length;u<w;)x=new THREE.Vertex,x.position.x=o[u++]*e,x.position.y=
|
|
|
|
+o[u++]*e,x.position.z=o[u++]*e,f.vertices.push(x);u=0;for(w=G.length;u<w;){e=G[u++];o=e&1;t=e&2;c=e&4;h=e&8;v=e&16;x=e&32;y=e&64;e&=128;o?(A=new THREE.Face4,A.a=G[u++],A.b=G[u++],A.c=G[u++],A.d=G[u++],o=4):(A=new THREE.Face3,A.a=G[u++],A.b=G[u++],A.c=G[u++],o=3);if(t)t=G[u++],A.materials=f.materials[t];t=f.faces.length;if(c)for(c=0;c<K;c++)E=b.uvs[c],z=G[u++],C=E[z*2],z=E[z*2+1],f.faceUvs[c][t]=new THREE.UV(C,z);if(h)for(c=0;c<K;c++){E=b.uvs[c];F=[];for(h=0;h<o;h++)z=G[u++],C=E[z*2],z=E[z*2+1],F[h]=
|
|
|
|
+new THREE.UV(C,z);f.faceVertexUvs[c][t]=F}if(v)v=G[u++]*3,h=new THREE.Vector3,h.x=J[v++],h.y=J[v++],h.z=J[v],A.normal=h;if(x)for(c=0;c<o;c++)v=G[u++]*3,h=new THREE.Vector3,h.x=J[v++],h.y=J[v++],h.z=J[v],A.vertexNormals.push(h);if(y)x=G[u++],x=new THREE.Color(O[x]),A.color=x;if(e)for(c=0;c<o;c++)x=G[u++],x=new THREE.Color(O[x]),A.vertexColors.push(x);f.faces.push(A)}}})(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,u,w,o,x,v,z;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;z=b.morphTargets[c].vertices;t=0;for(u=z.length;t<u;t+=3)w=z[t]*e,o=z[t+1]*
|
|
|
|
+e,x=z[t+2]*e,v.push(new THREE.Vertex(new THREE.Vector3(w,o,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(t=w.length;e<t;e+=3)o=new THREE.Color(16755200),o.setRGB(w[e],w[e+1],w[e+2]),u.push(o)}}})(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=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(w in S.objects)if(!T.objects[w])if(F=S.objects[w],F.geometry!==void 0){if(N=T.geometries[F.geometry]){var b=!1;U=[];for(fa=0;fa<F.materials.length;fa++)U[fa]=T.materials[F.materials[fa]],b=U[fa]instanceof THREE.ShaderMaterial;b&&N.computeTangents();D=F.position;r=F.rotation;
|
|
|
|
-q=F.quaternion;s=F.scale;q=0;U.length==0&&(U[0]=new THREE.MeshFaceMaterial);U.length>1&&(U=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(N,U);object.name=w;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;T.scene.add(object);T.objects[w]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),T.scene.collisions.colliders.push(b));
|
|
|
|
-if(F.castsShadow)b=new THREE.ShadowVolume(N),T.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},T.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=w,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,T.scene.add(object),T.objects[w]=object,T.empties[w]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},T.triggers[object.name]=b)}function t(b){return function(c){T.geometries[b]=c;n();Y-=1;e.onLoadComplete();v()}}function u(b){return function(e){T.geometries[b]=e}}function v(){e.callbackProgress({totalModels:o,totalTextures:$,loadedModels:o-Y,loadedTextures:$-W},T);e.onLoadProgress();Y==0&&W==0&&c(T)}var p,x,
|
|
|
|
-w,z,y,A,E,F,D,G,K,N,L,B,M,U,I,S,Q,Y,W,o,$,T;S=b.data;M=new THREE.BinaryLoader;Q=new THREE.JSONLoader;W=Y=0;T={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(w in S.objects)if(F=S.objects[w],F.meshCollider){b=!0;break}if(b)T.scene.collisions=new THREE.CollisionSystem;if(S.transform){b=S.transform.position;G=S.transform.rotation;var ha=S.transform.scale;b&&T.scene.position.set(b[0],b[1],b[2]);G&&T.scene.rotation.set(G[0],
|
|
|
|
-G[1],G[2]);ha&&T.scene.scale.set(ha[0],ha[1],ha[2]);(b||G||ha)&&T.scene.updateMatrix()}b=function(){W-=1;v();e.onLoadComplete()};for(y in S.cameras)G=S.cameras[y],G.type=="perspective"?L=new THREE.PerspectiveCamera(G.fov,G.aspect,G.near,G.far):G.type=="ortho"&&(L=new THREE.OrthographicCamera(G.left,G.right,G.top,G.bottom,G.near,G.far)),D=G.position,G=G.target,L.position.set(D[0],D[1],D[2]),L.target=new THREE.Vector3(G[0],G[1],G[2]),T.cameras[y]=L;for(z in S.lights)y=S.lights[z],L=y.color!==void 0?
|
|
|
|
-y.color:16777215,G=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(D=y.direction,I=new THREE.DirectionalLight(L,G),I.position.set(D[0],D[1],D[2]),I.position.normalize()):y.type=="point"?(D=y.position,d=y.distance,I=new THREE.PointLight(L,G,d),I.position.set(D[0],D[1],D[2])):y.type=="ambient"&&(I=new THREE.AmbientLight(L)),T.scene.add(I),T.lights[z]=I;for(A in S.fogs)z=S.fogs[A],z.type=="linear"?B=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(B=new THREE.FogExp2(0,z.density)),G=z.color,
|
|
|
|
-B.color.setRGB(G[0],G[1],G[2]),T.fogs[A]=B;if(T.cameras&&S.defaults.camera)T.currentCamera=T.cameras[S.defaults.camera];if(T.fogs&&S.defaults.fog)T.scene.fog=T.fogs[S.defaults.fog];G=S.defaults.bgcolor;T.bgColor=new THREE.Color;T.bgColor.setRGB(G[0],G[1],G[2]);T.bgColorAlpha=S.defaults.bgalpha;for(p in S.geometries)if(A=S.geometries[p],A.type=="bin_mesh"||A.type=="ascii_mesh")Y+=1,e.onLoadStart();o=Y;for(p in S.geometries)A=S.geometries[p],A.type=="cube"?(N=new THREE.CubeGeometry(A.width,A.height,
|
|
|
|
-A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),T.geometries[p]=N):A.type=="plane"?(N=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),T.geometries[p]=N):A.type=="sphere"?(N=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),T.geometries[p]=N):A.type=="cylinder"?(N=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),T.geometries[p]=N):A.type=="torus"?(N=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,
|
|
|
|
-A.segmentsT),T.geometries[p]=N):A.type=="icosahedron"?(N=new THREE.IcosahedronGeometry(A.subdivisions),T.geometries[p]=N):A.type=="bin_mesh"?M.load({model:f(A.url,S.urlBaseType),callback:t(p)}):A.type=="ascii_mesh"?Q.load({model:f(A.url,S.urlBaseType),callback:t(p)}):A.type=="embedded_mesh"&&(A=S.embeds[A.id])&&Q.createModel(A,u(p),"");for(E in S.textures)if(p=S.textures[E],p.url instanceof Array){W+=p.url.length;for(M=0;M<p.url.length;M++)e.onLoadStart()}else W+=1,e.onLoadStart();$=W;for(E in S.textures){p=
|
|
|
|
-S.textures[E];if(p.mapping!=void 0&&THREE[p.mapping]!=void 0)p.mapping=new THREE[p.mapping];if(p.url instanceof Array){M=[];for(var fa=0;fa<p.url.length;fa++)M[fa]=f(p.url[fa],S.urlBaseType);M=THREE.ImageUtils.loadTextureCube(M,p.mapping,b)}else{M=THREE.ImageUtils.loadTexture(f(p.url,S.urlBaseType),p.mapping,b);if(THREE[p.minFilter]!=void 0)M.minFilter=THREE[p.minFilter];if(THREE[p.magFilter]!=void 0)M.magFilter=THREE[p.magFilter];if(p.repeat){M.repeat.set(p.repeat[0],p.repeat[1]);if(p.repeat[0]!=
|
|
|
|
-1)M.wrapS=THREE.RepeatWrapping;if(p.repeat[1]!=1)M.wrapT=THREE.RepeatWrapping}p.offset&&M.offset.set(p.offset[0],p.offset[1]);if(p.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Q[p.wrap[0]]!==void 0)M.wrapS=Q[p.wrap[0]];if(Q[p.wrap[1]]!==void 0)M.wrapT=Q[p.wrap[1]]}}T.textures[E]=M}for(x in S.materials){E=S.materials[x];for(K in E.parameters)if(K=="envMap"||K=="map"||K=="lightMap")E.parameters[K]=T.textures[E.parameters[K]];else if(K=="shading")E.parameters[K]=E.parameters[K]==
|
|
|
|
-"flat"?THREE.FlatShading:THREE.SmoothShading;else if(K=="blending")E.parameters[K]=THREE[E.parameters[K]]?THREE[E.parameters[K]]:THREE.NormalBlending;else if(K=="combine")E.parameters[K]=E.parameters[K]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(K=="vertexColors")if(E.parameters[K]=="face")E.parameters[K]=THREE.FaceColors;else if(E.parameters[K])E.parameters[K]=THREE.VertexColors;if(E.parameters.opacity!==void 0&&E.parameters.opacity<1)E.parameters.transparent=!0;if(E.parameters.normalMap){p=
|
|
|
|
-THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(p.uniforms);M=E.parameters.color;Q=E.parameters.specular;A=E.parameters.ambient;B=E.parameters.shininess;b.tNormal.texture=T.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=
|
|
|
|
-T.textures[E.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(M);b.uSpecularColor.value.setHex(Q);b.uAmbientColor.value.setHex(A);b.uShininess.value=B;if(E.parameters.opacity)b.uOpacity.value=E.parameters.opacity;E=new THREE.ShaderMaterial({fragmentShader:p.fragmentShader,vertexShader:p.vertexShader,uniforms:b,lights:!0,fog:!0})}else E=new THREE[E.type](E.parameters);T.materials[x]=E}n();e.callbackSync(T)}},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 T.objects)if(!V.objects[v])if(F=T.objects[v],F.geometry!==void 0){if(O=V.geometries[F.geometry]){var b=!1;Y=[];for(da=0;da<F.materials.length;da++)Y[da]=V.materials[F.materials[da]],b=Y[da]instanceof THREE.ShaderMaterial;b&&O.computeTangents();C=F.position;r=F.rotation;
|
|
|
|
+q=F.quaternion;s=F.scale;q=0;Y.length==0&&(Y[0]=new THREE.MeshFaceMaterial);Y.length>1&&(Y=[new THREE.MeshFaceMaterial]);object=new THREE.Mesh(O,Y);object.name=v;object.position.set(C[0],C[1],C[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;V.scene.add(object);V.objects[v]=object;F.meshCollider&&(b=THREE.CollisionUtils.MeshColliderWBox(object),V.scene.collisions.colliders.push(b));
|
|
|
|
+if(F.castsShadow)b=new THREE.ShadowVolume(O),V.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},V.triggers[object.name]=b)}}else C=F.position,r=F.rotation,q=F.quaternion,s=F.scale,q=0,object=new THREE.Object3D,object.name=v,object.position.set(C[0],C[1],C[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,V.scene.add(object),V.objects[v]=object,V.empties[v]=object,F.trigger&&F.trigger.toLowerCase()!="none"&&(b={type:F.trigger,object:F},V.triggers[object.name]=b)}function t(b){return function(c){V.geometries[b]=c;n();Z-=1;e.onLoadComplete();w()}}function u(b){return function(e){V.geometries[b]=e}}function w(){e.callbackProgress({totalModels:S,totalTextures:p,loadedModels:S-Z,loadedTextures:p-$},V);e.onLoadProgress();Z==0&&$==0&&c(V)}var o,x,
|
|
|
|
+v,z,y,A,E,F,C,G,J,O,K,B,N,Y,H,T,Q,Z,$,S,p,V;T=b.data;N=new THREE.BinaryLoader;Q=new THREE.JSONLoader;$=Z=0;V={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},empties:{}};b=!1;for(v in T.objects)if(F=T.objects[v],F.meshCollider){b=!0;break}if(b)V.scene.collisions=new THREE.CollisionSystem;if(T.transform){b=T.transform.position;G=T.transform.rotation;var ea=T.transform.scale;b&&V.scene.position.set(b[0],b[1],b[2]);G&&V.scene.rotation.set(G[0],
|
|
|
|
+G[1],G[2]);ea&&V.scene.scale.set(ea[0],ea[1],ea[2]);(b||G||ea)&&V.scene.updateMatrix()}b=function(){$-=1;w();e.onLoadComplete()};for(y in T.cameras)G=T.cameras[y],G.type=="perspective"?K=new THREE.PerspectiveCamera(G.fov,G.aspect,G.near,G.far):G.type=="ortho"&&(K=new THREE.OrthographicCamera(G.left,G.right,G.top,G.bottom,G.near,G.far)),C=G.position,G=G.target,K.position.set(C[0],C[1],C[2]),K.target=new THREE.Vector3(G[0],G[1],G[2]),V.cameras[y]=K;for(z in T.lights)y=T.lights[z],K=y.color!==void 0?
|
|
|
|
+y.color:16777215,G=y.intensity!==void 0?y.intensity:1,y.type=="directional"?(C=y.direction,H=new THREE.DirectionalLight(K,G),H.position.set(C[0],C[1],C[2]),H.position.normalize()):y.type=="point"?(C=y.position,d=y.distance,H=new THREE.PointLight(K,G,d),H.position.set(C[0],C[1],C[2])):y.type=="ambient"&&(H=new THREE.AmbientLight(K)),V.scene.add(H),V.lights[z]=H;for(A in T.fogs)z=T.fogs[A],z.type=="linear"?B=new THREE.Fog(0,z.near,z.far):z.type=="exp2"&&(B=new THREE.FogExp2(0,z.density)),G=z.color,
|
|
|
|
+B.color.setRGB(G[0],G[1],G[2]),V.fogs[A]=B;if(V.cameras&&T.defaults.camera)V.currentCamera=V.cameras[T.defaults.camera];if(V.fogs&&T.defaults.fog)V.scene.fog=V.fogs[T.defaults.fog];G=T.defaults.bgcolor;V.bgColor=new THREE.Color;V.bgColor.setRGB(G[0],G[1],G[2]);V.bgColorAlpha=T.defaults.bgalpha;for(o in T.geometries)if(A=T.geometries[o],A.type=="bin_mesh"||A.type=="ascii_mesh")Z+=1,e.onLoadStart();S=Z;for(o in T.geometries)A=T.geometries[o],A.type=="cube"?(O=new THREE.CubeGeometry(A.width,A.height,
|
|
|
|
+A.depth,A.segmentsWidth,A.segmentsHeight,A.segmentsDepth,null,A.flipped,A.sides),V.geometries[o]=O):A.type=="plane"?(O=new THREE.PlaneGeometry(A.width,A.height,A.segmentsWidth,A.segmentsHeight),V.geometries[o]=O):A.type=="sphere"?(O=new THREE.SphereGeometry(A.radius,A.segmentsWidth,A.segmentsHeight),V.geometries[o]=O):A.type=="cylinder"?(O=new THREE.CylinderGeometry(A.topRad,A.botRad,A.height,A.radSegs,A.heightSegs),V.geometries[o]=O):A.type=="torus"?(O=new THREE.TorusGeometry(A.radius,A.tube,A.segmentsR,
|
|
|
|
+A.segmentsT),V.geometries[o]=O):A.type=="icosahedron"?(O=new THREE.IcosahedronGeometry(A.subdivisions),V.geometries[o]=O):A.type=="bin_mesh"?N.load({model:f(A.url,T.urlBaseType),callback:t(o)}):A.type=="ascii_mesh"?Q.load({model:f(A.url,T.urlBaseType),callback:t(o)}):A.type=="embedded_mesh"&&(A=T.embeds[A.id])&&Q.createModel(A,u(o),"");for(E in T.textures)if(o=T.textures[E],o.url instanceof Array){$+=o.url.length;for(N=0;N<o.url.length;N++)e.onLoadStart()}else $+=1,e.onLoadStart();p=$;for(E in T.textures){o=
|
|
|
|
+T.textures[E];if(o.mapping!=void 0&&THREE[o.mapping]!=void 0)o.mapping=new THREE[o.mapping];if(o.url instanceof Array){N=[];for(var da=0;da<o.url.length;da++)N[da]=f(o.url[da],T.urlBaseType);N=THREE.ImageUtils.loadTextureCube(N,o.mapping,b)}else{N=THREE.ImageUtils.loadTexture(f(o.url,T.urlBaseType),o.mapping,b);if(THREE[o.minFilter]!=void 0)N.minFilter=THREE[o.minFilter];if(THREE[o.magFilter]!=void 0)N.magFilter=THREE[o.magFilter];if(o.repeat){N.repeat.set(o.repeat[0],o.repeat[1]);if(o.repeat[0]!=
|
|
|
|
+1)N.wrapS=THREE.RepeatWrapping;if(o.repeat[1]!=1)N.wrapT=THREE.RepeatWrapping}o.offset&&N.offset.set(o.offset[0],o.offset[1]);if(o.wrap){Q={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(Q[o.wrap[0]]!==void 0)N.wrapS=Q[o.wrap[0]];if(Q[o.wrap[1]]!==void 0)N.wrapT=Q[o.wrap[1]]}}V.textures[E]=N}for(x in T.materials){E=T.materials[x];for(J in E.parameters)if(J=="envMap"||J=="map"||J=="lightMap")E.parameters[J]=V.textures[E.parameters[J]];else if(J=="shading")E.parameters[J]=E.parameters[J]==
|
|
|
|
+"flat"?THREE.FlatShading:THREE.SmoothShading;else if(J=="blending")E.parameters[J]=THREE[E.parameters[J]]?THREE[E.parameters[J]]:THREE.NormalBlending;else if(J=="combine")E.parameters[J]=E.parameters[J]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(J=="vertexColors")if(E.parameters[J]=="face")E.parameters[J]=THREE.FaceColors;else if(E.parameters[J])E.parameters[J]=THREE.VertexColors;if(E.parameters.opacity!==void 0&&E.parameters.opacity<1)E.parameters.transparent=!0;if(E.parameters.normalMap){o=
|
|
|
|
+THREE.ShaderUtils.lib.normal;b=THREE.UniformsUtils.clone(o.uniforms);N=E.parameters.color;Q=E.parameters.specular;A=E.parameters.ambient;B=E.parameters.shininess;b.tNormal.texture=V.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=
|
|
|
|
+V.textures[E.parameters.specularMap],b.enableSpecular.value=!0;b.uDiffuseColor.value.setHex(N);b.uSpecularColor.value.setHex(Q);b.uAmbientColor.value.setHex(A);b.uShininess.value=B;if(E.parameters.opacity)b.uOpacity.value=E.parameters.opacity;E=new THREE.ShaderMaterial({fragmentShader:o.fragmentShader,vertexShader:o.vertexShader,uniforms:b,lights:!0,fog:!0})}else E=new THREE[E.type](E.parameters);V.materials[x]=E}n();e.callbackSync(V)}},constructor:THREE.SceneLoader};THREE.UTF8Loader=function(){};
|
|
THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
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.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.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),u=[],v=[];(function(b,m,t){for(var u,v,A,E=b.length;t<E;t+=m)u=b[t],v=b[t+1],A=b[t+2],u=u/16383*e,v=v/16383*e,A=A/16383*e,u+=f,v+=h,A+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,v,A)))})(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,v.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,t,F,D,G,K=b.length;for(e=0;e<K;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;D=f;G=h;t=k;F=f;var N=h,L=k,B=m.materials[0],M=u[N*3],U=u[N*3+1],N=u[N*3+2],I=u[L*3],S=u[L*3+1],L=u[L*3+2];F=new THREE.Vector3(u[F*3],u[F*3+1],u[F*3+2]);N=new THREE.Vector3(M,U,N);L=new THREE.Vector3(I,S,L);m.faces.push(new THREE.Face3(D,G,t,[F,N,L],null,B));m=v[f*2];f=v[f*2+
|
|
|
|
-1];t=v[h*2];F=v[h*2+1];D=v[k*2];G=v[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,G));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,t){for(var u,w,A,E=b.length;t<E;t+=m)u=b[t],w=b[t+1],A=b[t+2],u=u/16383*e,w=w/16383*e,A=A/16383*e,u+=f,w+=h,A+=k,c.vertices.push(new THREE.Vertex(new THREE.Vector3(u,w,A)))})(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,t,F,C,G,J=b.length;for(e=0;e<J;e+=3){f=b[e];h=b[e+1];k=b[e+2];m=c;C=f;G=h;t=k;F=f;var O=h,K=k,B=m.materials[0],N=u[O*3],Y=u[O*3+1],O=u[O*3+2],H=u[K*3],T=u[K*3+1],K=u[K*3+2];F=new THREE.Vector3(u[F*3],u[F*3+1],u[F*3+2]);O=new THREE.Vector3(N,Y,O);K=new THREE.Vector3(H,T,K);m.faces.push(new THREE.Face3(C,G,t,[F,O,K],null,B));m=w[f*2];f=w[f*2+
|
|
|
|
+1];t=w[h*2];F=w[h*2+1];C=w[k*2];G=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(C,G));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);
|
|
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;
|
|
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=
|
|
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,u,v,p){m=(m-v)/(p-v);v=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=t;c[k+2]=u;h[k]=this.lerp(v[b],v[b+3],m);h[k+1]=this.lerp(v[b+1],v[b+4],m);h[k+2]=this.lerp(v[b+2],v[b+5],m)};this.VIntY=function(b,c,h,k,m,n,t,u,v,p){m=(m-v)/(p-v);v=this.normal_cache;c[k]=n;c[k+1]=t+m*this.delta;c[k+
|
|
|
|
-2]=u;c=b+this.yd*3;h[k]=this.lerp(v[b],v[c],m);h[k+1]=this.lerp(v[b+1],v[c+1],m);h[k+2]=this.lerp(v[b+2],v[c+2],m)};this.VIntZ=function(b,c,h,k,m,n,t,u,v,p){m=(m-v)/(p-v);v=this.normal_cache;c[k]=n;c[k+1]=t;c[k+2]=u+m*this.delta;c=b+this.zd*3;h[k]=this.lerp(v[b],v[c],m);h[k+1]=this.lerp(v[b+1],v[c+1],m);h[k+2]=this.lerp(v[b+2],v[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,u=k+this.yd,v=k+this.zd,p=t+this.yd,x=t+this.zd,w=k+this.yd+this.zd,z=t+this.yd+this.zd,y=0,A=this.field[k],E=this.field[t],F=this.field[u],D=this.field[p],G=this.field[v],K=this.field[x],N=this.field[w],L=this.field[z];A<m&&(y|=1);E<m&&(y|=2);F<m&&(y|=8);D<m&&(y|=4);G<m&&(y|=16);K<m&&(y|=32);N<m&&(y|=128);L<m&&(y|=64);var B=THREE.edgeTable[y];if(B==0)return 0;var M=this.delta,
|
|
|
|
-U=b+M,I=c+M,M=h+M;B&1&&(this.compNorm(k),this.compNorm(t),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,A,E));B&2&&(this.compNorm(t),this.compNorm(p),this.VIntY(t*3,this.vlist,this.nlist,3,m,U,c,h,E,D));B&4&&(this.compNorm(u),this.compNorm(p),this.VIntX(u*3,this.vlist,this.nlist,6,m,b,I,h,F,D));B&8&&(this.compNorm(k),this.compNorm(u),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,A,F));B&16&&(this.compNorm(v),this.compNorm(x),this.VIntX(v*3,this.vlist,this.nlist,12,m,b,c,M,G,K));B&32&&(this.compNorm(x),
|
|
|
|
-this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,m,U,c,M,K,L));B&64&&(this.compNorm(w),this.compNorm(z),this.VIntX(w*3,this.vlist,this.nlist,18,m,b,I,M,N,L));B&128&&(this.compNorm(v),this.compNorm(w),this.VIntY(v*3,this.vlist,this.nlist,21,m,b,c,M,G,N));B&256&&(this.compNorm(k),this.compNorm(v),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,A,G));B&512&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*3,this.vlist,this.nlist,27,m,U,c,h,E,K));B&1024&&(this.compNorm(p),this.compNorm(z),this.VIntZ(p*
|
|
|
|
-3,this.vlist,this.nlist,30,m,U,I,h,D,L));B&2048&&(this.compNorm(u),this.compNorm(w),this.VIntZ(u*3,this.vlist,this.nlist,33,m,b,I,h,F,N));y<<=4;for(m=k=0;THREE.triTable[y+m]!=-1;)b=y+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+
|
|
|
|
|
|
+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,u,w,o){m=(m-w)/(o-w);w=this.normal_cache;c[k]=n+m*this.delta;c[k+1]=t;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,t,u,w,o){m=(m-w)/(o-w);w=this.normal_cache;c[k]=n;c[k+1]=t+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,t,u,w,o){m=(m-w)/(o-w);w=this.normal_cache;c[k]=n;c[k+1]=t;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 t=k+1,u=k+this.yd,w=k+this.zd,o=t+this.yd,x=t+this.zd,v=k+this.yd+this.zd,z=t+this.yd+this.zd,y=0,A=this.field[k],E=this.field[t],F=this.field[u],C=this.field[o],G=this.field[w],J=this.field[x],O=this.field[v],K=this.field[z];A<m&&(y|=1);E<m&&(y|=2);F<m&&(y|=8);C<m&&(y|=4);G<m&&(y|=16);J<m&&(y|=32);O<m&&(y|=128);K<m&&(y|=64);var B=THREE.edgeTable[y];if(B==0)return 0;var N=this.delta,
|
|
|
|
+Y=b+N,H=c+N,N=h+N;B&1&&(this.compNorm(k),this.compNorm(t),this.VIntX(k*3,this.vlist,this.nlist,0,m,b,c,h,A,E));B&2&&(this.compNorm(t),this.compNorm(o),this.VIntY(t*3,this.vlist,this.nlist,3,m,Y,c,h,E,C));B&4&&(this.compNorm(u),this.compNorm(o),this.VIntX(u*3,this.vlist,this.nlist,6,m,b,H,h,F,C));B&8&&(this.compNorm(k),this.compNorm(u),this.VIntY(k*3,this.vlist,this.nlist,9,m,b,c,h,A,F));B&16&&(this.compNorm(w),this.compNorm(x),this.VIntX(w*3,this.vlist,this.nlist,12,m,b,c,N,G,J));B&32&&(this.compNorm(x),
|
|
|
|
+this.compNorm(z),this.VIntY(x*3,this.vlist,this.nlist,15,m,Y,c,N,J,K));B&64&&(this.compNorm(v),this.compNorm(z),this.VIntX(v*3,this.vlist,this.nlist,18,m,b,H,N,O,K));B&128&&(this.compNorm(w),this.compNorm(v),this.VIntY(w*3,this.vlist,this.nlist,21,m,b,c,N,G,O));B&256&&(this.compNorm(k),this.compNorm(w),this.VIntZ(k*3,this.vlist,this.nlist,24,m,b,c,h,A,G));B&512&&(this.compNorm(t),this.compNorm(x),this.VIntZ(t*3,this.vlist,this.nlist,27,m,Y,c,h,E,J));B&1024&&(this.compNorm(o),this.compNorm(z),this.VIntZ(o*
|
|
|
|
+3,this.vlist,this.nlist,30,m,Y,H,h,C,K));B&2048&&(this.compNorm(u),this.compNorm(v),this.VIntZ(u*3,this.vlist,this.nlist,33,m,b,H,h,F,O));y<<=4;for(m=k=0;THREE.triTable[y+m]!=-1;)b=y+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;
|
|
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,u=c*this.size,v=b*this.size,p=Math.floor(t-n);p<1&&(p=1);t=Math.floor(t+n);t>this.size-1&&(t=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 w=Math.floor(v-n);w<1&&(w=1);n=Math.floor(v+n);n>this.size-1&&(n=this.size-
|
|
|
|
-1);for(var z,y,A,E,F,D;p<t;p++){v=this.size2*p;y=p/this.size-h;F=y*y;for(y=x;y<u;y++){A=v+this.size*y;z=y/this.size-c;D=z*z;for(z=w;z<n;z++)E=z/this.size-b,E=k/(1.0E-6+E*E+D+F)-m,E>0&&(this.field[A+z]+=E)}}};this.addPlaneX=function(b,c){var h,k,m,n,t,u=this.size,v=this.yd,p=this.zd,x=this.field,w=u*Math.sqrt(b/c);w>u&&(w=u);for(h=0;h<w;h++)if(k=h/u,k*=k,n=b/(1.0E-4+k)-c,n>0)for(k=0;k<u;k++){t=h+k*v;for(m=0;m<u;m++)x[p*m+t]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,t,u,v=this.size,p=this.yd,x=
|
|
|
|
-this.zd,w=this.field,z=v*Math.sqrt(b/c);z>v&&(z=v);for(k=0;k<z;k++)if(h=k/v,h*=h,n=b/(1.0E-4+h)-c,n>0){t=k*p;for(h=0;h<v;h++){u=t+h;for(m=0;m<v;m++)w[x*m+u]+=n}}};this.addPlaneZ=function(b,c){var h,k,m,n,t,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){t=zd*m;for(k=0;k<size;k++){u=t+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,t,u,v,p,x=this.size-2;for(m=1;m<x;m++){p=this.size2*m;u=(m-this.halfsize)/this.halfsize;for(k=1;k<x;k++){v=p+this.size*k;t=(k-this.halfsize)/this.halfsize;for(h=1;h<x;h++)n=(h-this.halfsize)/this.halfsize,c=v+h,this.polygonize(n,t,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,t,u,v,p,x,w;for(m=0;m<k.count;m++)x=m*3,v=x+1,w=x+2,n=k.positionArray[x],
|
|
|
|
-t=k.positionArray[v],u=k.positionArray[w],p=new THREE.Vector3(n,t,u),n=k.normalArray[x],t=k.normalArray[v],u=k.normalArray[w],x=new THREE.Vector3(n,t,u),x.normalize(),v=new THREE.Vertex(p),c.vertices.push(v),h.push(x);nfaces=k.count/3;for(m=0;m<nfaces;m++)x=(b+m)*3,v=x+1,w=x+2,p=h[x],n=h[v],t=h[w],x=new THREE.Face3(x,v,w,[p,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;
|
|
|
|
|
|
+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,u=c*this.size,w=b*this.size,o=Math.floor(t-n);o<1&&(o=1);t=Math.floor(t+n);t>this.size-1&&(t=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 z,y,A,E,F,C;o<t;o++){w=this.size2*o;y=o/this.size-h;F=y*y;for(y=x;y<u;y++){A=w+this.size*y;z=y/this.size-c;C=z*z;for(z=v;z<n;z++)E=z/this.size-b,E=k/(1.0E-6+E*E+C+F)-m,E>0&&(this.field[A+z]+=E)}}};this.addPlaneX=function(b,c){var h,k,m,n,t,u=this.size,w=this.yd,o=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++){t=h+k*w;for(m=0;m<u;m++)x[o*m+t]+=n}};this.addPlaneY=function(b,c){var h,k,m,n,t,u,w=this.size,o=this.yd,x=
|
|
|
|
+this.zd,v=this.field,z=w*Math.sqrt(b/c);z>w&&(z=w);for(k=0;k<z;k++)if(h=k/w,h*=h,n=b/(1.0E-4+h)-c,n>0){t=k*o;for(h=0;h<w;h++){u=t+h;for(m=0;m<w;m++)v[x*m+u]+=n}}};this.addPlaneZ=function(b,c){var h,k,m,n,t,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){t=zd*m;for(k=0;k<size;k++){u=t+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,t,u,w,o,x=this.size-2;for(m=1;m<x;m++){o=this.size2*m;u=(m-this.halfsize)/this.halfsize;for(k=1;k<x;k++){w=o+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,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,t,u,w,o,x,v;for(m=0;m<k.count;m++)x=m*3,w=x+1,v=x+2,n=k.positionArray[x],
|
|
|
|
+t=k.positionArray[w],u=k.positionArray[v],o=new THREE.Vector3(n,t,u),n=k.normalArray[x],t=k.normalArray[w],u=k.normalArray[v],x=new THREE.Vector3(n,t,u),x.normalize(),w=new THREE.Vertex(o),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,o=h[x],n=h[w],t=h[v],x=new THREE.Face3(x,w,v,[o,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;
|
|
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,
|
|
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,
|
|
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]);
|
|
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]);
|
|
@@ -688,8 +688,8 @@ 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.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.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.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,u=c.mesh.geometry.vertices[m.c].position,v=m instanceof THREE.Face4?c.mesh.geometry.vertices[m.d].position:null;m instanceof THREE.Face3?(m=this.rayTriangle(e,n,t,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,t,v,f,this.collisionNormal,c.mesh),m<f&&(f=m,h=k,c.normal.copy(this.collisionNormal),c.normal.normalize()),m=this.rayTriangle(e,t,u,v,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.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,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,t,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,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,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,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.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)>
|
|
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};
|
|
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.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};
|
|
@@ -699,9 +699,9 @@ f;if(e<c.min.z||e>c.max.z)return Number.MAX_VALUE;c.normal.set(0,n,0);break;case
|
|
THREE.CollisionSystem.prototype.raySphere=function(b,c){var e=c.center.clone().subSelf(b.origin);if(e.lengthSq<c.radiusSq)return-1;var f=e.dot(b.direction.clone());if(f<=0)return Number.MAX_VALUE;e=c.radiusSq-(e.lengthSq()-f*f);if(e>=0)return Math.abs(f)-Math.sqrt(e);return Number.MAX_VALUE};THREE.CollisionSystem.__v1=new THREE.Vector3;THREE.CollisionSystem.__v2=new THREE.Vector3;THREE.CollisionSystem.__v3=new THREE.Vector3;THREE.CollisionSystem.__nr=new THREE.Vector3;THREE.CollisionSystem.__m=new THREE.Matrix4;
|
|
THREE.CollisionSystem.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.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))};
|
|
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.PerspectiveCamera,k=new THREE.PerspectiveCamera,m=new THREE.Matrix4,n=new THREE.Matrix4,t,u,v;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),w=new THREE.PerspectiveCamera(53,1,1,1E4);w.position.z=
|
|
|
|
-2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},mapRight:{type:"t",value:1,texture:x}},vertexShader:"varying vec2 vUv;\nvoid main() {\nvUv = vec2( uv.x, 1.0 - uv.y );\ngl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D mapLeft;\nuniform sampler2D mapRight;\nvarying vec2 vUv;\nvoid main() {\nvec4 colorL, colorR;\nvec2 uv = vUv;\ncolorL = texture2D( mapLeft, uv );\ncolorR = texture2D( mapRight, uv );\ngl_FragColor = vec4( colorL.g * 0.7 + colorL.b * 0.3, colorR.g, colorR.b, colorL.a + colorR.a ) * 1.1;\n}"});
|
|
|
|
-var z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);p.width=b;p.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(t!==e.aspect||u!==e.near||v!==e.fov){t=e.aspect;u=e.near;v=e.fov;var E=e.projectionMatrix.clone(),F=125/30*0.5,D=F*u/125,G=u*Math.tan(v*Math.PI/360),K;m.n14=F;n.n14=-F;F=-G*t+D;K=G*t+D;E.n11=2*u/(K-F);E.n13=(K+F)/(K-F);h.projectionMatrix=E.clone();F=-G*t-D;K=G*t-D;E.n11=2*u/(K-F);E.n13=
|
|
|
|
-(K+F)/(K-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,p,!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,z,w)}};
|
|
|
|
|
|
+if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(b){THREE.WebGLRenderer.call(this,b);var c=this,e=this.setSize,f=this.render,h=new THREE.PerspectiveCamera,k=new THREE.PerspectiveCamera,m=new THREE.Matrix4,n=new THREE.Matrix4,t,u,w;h.matrixAutoUpdate=k.matrixAutoUpdate=!1;var b={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},o=new THREE.WebGLRenderTarget(512,512,b),x=new THREE.WebGLRenderTarget(512,512,b),v=new THREE.PerspectiveCamera(53,1,1,1E4);v.position.z=
|
|
|
|
+2;_material=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:o},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 z=new THREE.Scene;z.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),_material));this.setSize=function(b,f){e.call(c,b,f);o.width=b;o.height=f;x.width=b;x.height=f};this.render=function(b,e){e.update(null,!0);if(t!==e.aspect||u!==e.near||w!==e.fov){t=e.aspect;u=e.near;w=e.fov;var E=e.projectionMatrix.clone(),F=125/30*0.5,C=F*u/125,G=u*Math.tan(w*Math.PI/360),J;m.n14=F;n.n14=-F;F=-G*t+C;J=G*t+C;E.n11=2*u/(J-F);E.n13=(J+F)/(J-F);h.projectionMatrix=E.clone();F=-G*t-C;J=G*t-C;E.n11=2*u/(J-F);E.n13=
|
|
|
|
+(J+F)/(J-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,o,!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,z,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.PerspectiveCamera;m.target=new THREE.Vector3(0,0,0);var n=new THREE.PerspectiveCamera;n.target=new THREE.Vector3(0,0,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=
|
|
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.PerspectiveCamera;m.target=new THREE.Vector3(0,0,0);var n=new THREE.PerspectiveCamera;n.target=new THREE.Vector3(0,0,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.copy(e.target);m.translateX(c.separation);m.lookAt(m.target);n.projectionMatrix=m.projectionMatrix;n.position.copy(e.position);n.target.copy(e.target);n.translateX(-c.separation);n.lookAt(n.target);this.setViewport(0,0,h,k);f.call(c,b,m);this.setViewport(h,0,h,k);f.call(c,b,n,!1)}};
|
|
e.far;m.updateProjectionMatrix();m.position.copy(e.position);m.target.copy(e.target);m.translateX(c.separation);m.lookAt(m.target);n.projectionMatrix=m.projectionMatrix;n.position.copy(e.position);n.target.copy(e.target);n.translateX(-c.separation);n.lookAt(n.target);this.setViewport(0,0,h,k);f.call(c,b,m);this.setViewport(h,0,h,k);f.call(c,b,n,!1)}};
|