|
@@ -8,10 +8,11 @@ this.length());return this},length:function(){return Math.sqrt(this.lengthSq())}
|
|
|
THREE.Vector3.prototype={set:function(a,c,d){this.x=a;this.y=c;this.z=d;return this},copy:function(a){this.set(a.x,a.y,a.z);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z);return this},addScalar:function(a){this.set(this.x+a,this.y+a,this.z+a);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z);return this},cross:function(a,
|
|
|
c){this.set(a.y*c.z-a.z*c.y,a.z*c.x-a.x*c.z,a.x*c.y-a.y*c.x);return this},crossSelf:function(a){var c=this.x,d=this.y,e=this.z;this.set(d*a.z-e*a.y,e*a.x-c*a.z,c*a.y-d*a.x);return this},multiply:function(a,c){this.set(a.x*c.x,a.y*c.y,a.z*c.z);return this},multiplySelf:function(a){this.set(this.x*a.x,this.y*a.y,this.z*a.z);return this},multiplyScalar:function(a){this.set(this.x*a,this.y*a,this.z*a);return this},divideSelf:function(a){this.set(this.x/a.x,this.y/a.y,this.z/a.z);return this},divideScalar:function(a){this.set(this.x/
|
|
|
a,this.y/a,this.z/a);return this},negate:function(){this.set(-this.x,-this.y,-this.z);return this},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z},distanceTo:function(a){return Math.sqrt(this.distanceToSquared(a))},distanceToSquared:function(a){var c=this.x-a.x,d=this.y-a.y;a=this.z-a.z;return c*c+d*d+a*a},length:function(){return Math.sqrt(this.lengthSq())},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},lengthManhattan:function(){return this.x+this.y+this.z},normalize:function(){var a=
|
|
|
-this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,d,e){this.set(a||0,c||0,d||0,e||1)};
|
|
|
+this.length();a>0?this.multiplyScalar(1/a):this.set(0,0,0);return this},setPositionFromMatrix:function(a){this.x=a.n14;this.y=a.n24;this.z=a.n34},setRotationFromMatrix:function(a){this.y=Math.asin(a.n13);var c=Math.cos(this.y);if(Math.abs(c)>1.0E-5){this.x=Math.atan2(-a.n23/c,a.n33/c);this.z=Math.atan2(-a.n13/c,a.n11/c)}else{this.x=0;this.z=Math.atan2(a.n21,a.n22)}},setLength:function(a){return this.normalize().multiplyScalar(a)},isZero:function(){return Math.abs(this.x)<1.0E-4&&Math.abs(this.y)<
|
|
|
+1.0E-4&&Math.abs(this.z)<1.0E-4},clone:function(){return new THREE.Vector3(this.x,this.y,this.z)}};THREE.Vector4=function(a,c,d,e){this.set(a||0,c||0,d||0,e||1)};
|
|
|
THREE.Vector4.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},copy:function(a){this.set(a.x,a.y,a.z,a.w||1);return this},add:function(a,c){this.set(a.x+c.x,a.y+c.y,a.z+c.z,a.w+c.w);return this},addSelf:function(a){this.set(this.x+a.x,this.y+a.y,this.z+a.z,this.w+a.w);return this},sub:function(a,c){this.set(a.x-c.x,a.y-c.y,a.z-c.z,a.w-c.w);return this},subSelf:function(a){this.set(this.x-a.x,this.y-a.y,this.z-a.z,this.w-a.w);return this},multiplyScalar:function(a){this.set(this.x*
|
|
|
a,this.y*a,this.z*a,this.w*a);return this},divideScalar:function(a){this.set(this.x/a,this.y/a,this.z/a,this.w/a);return this},lerpSelf:function(a,c){this.set(this.x+(a.x-this.x)*c,this.y+(a.y-this.y)*c,this.z+(a.z-this.z)*c,this.w+(a.w-this.w)*c)},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)}};THREE.Ray=function(a,c){this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3};
|
|
|
-THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,h=[];a=0;for(c=e.length;a<c;a++){d=e[a];d instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(d)))}h.sort(function(l,m){return l.distance-m.distance});return h},intersectObject:function(a){function c(L,M,Z,X){X=X.clone().subSelf(M);Z=Z.clone().subSelf(M);var P=L.clone().subSelf(M);L=X.dot(X);M=X.dot(Z);X=X.dot(P);var W=Z.dot(Z);Z=Z.dot(P);P=1/(L*W-M*M);W=(W*X-M*Z)*P;L=(L*Z-M*X)*P;return W>0&&L>0&&W+L<1}var d,e,h,l,m,q,n,w,A,y,
|
|
|
+THREE.Ray.prototype={intersectScene:function(a){var c,d,e=a.objects,h=[];a=0;for(c=e.length;a<c;a++){d=e[a];d instanceof THREE.Mesh&&(h=h.concat(this.intersectObject(d)))}h.sort(function(l,m){return l.distance-m.distance});return h},intersectObject:function(a){function c(L,M,Z,X){X=X.clone().subSelf(M);Z=Z.clone().subSelf(M);var O=L.clone().subSelf(M);L=X.dot(X);M=X.dot(Z);X=X.dot(O);var W=Z.dot(Z);Z=Z.dot(O);O=1/(L*W-M*M);W=(W*X-M*Z)*O;L=(L*Z-M*X)*O;return W>0&&L>0&&W+L<1}var d,e,h,l,m,q,n,w,A,y,
|
|
|
D,E=a.geometry,F=E.vertices,H=[];d=0;for(e=E.faces.length;d<e;d++){h=E.faces[d];y=this.origin.clone();D=this.direction.clone();n=a.matrixWorld;l=n.multiplyVector3(F[h.a].position.clone());m=n.multiplyVector3(F[h.b].position.clone());q=n.multiplyVector3(F[h.c].position.clone());n=h instanceof THREE.Face4?n.multiplyVector3(F[h.d].position.clone()):null;w=a.matrixRotationWorld.multiplyVector3(h.normal.clone());A=D.dot(w);if(A<0){w=w.dot((new THREE.Vector3).sub(l,y))/A;y=y.addSelf(D.multiplyScalar(w));
|
|
|
if(h instanceof THREE.Face3){if(c(y,l,m,q)){h={distance:this.origin.distanceTo(y),point:y,face:h,object:a};H.push(h)}}else if(h instanceof THREE.Face4&&(c(y,l,m,n)||c(y,m,q,n))){h={distance:this.origin.distanceTo(y),point:y,face:h,object:a};H.push(h)}}}return H}};
|
|
|
THREE.Rectangle=function(){function a(){l=e-c;m=h-d}var c,d,e,h,l,m,q=!0;this.getX=function(){return c};this.getY=function(){return d};this.getWidth=function(){return l};this.getHeight=function(){return m};this.getLeft=function(){return c};this.getTop=function(){return d};this.getRight=function(){return e};this.getBottom=function(){return h};this.set=function(n,w,A,y){q=!1;c=n;d=w;e=A;h=y;a()};this.addPoint=function(n,w){if(q){q=!1;c=n;d=w;e=n;h=w}else{c=c<n?c:n;d=d<w?d:w;e=e>n?e:n;h=h>w?h:w}a()};
|
|
@@ -19,30 +20,30 @@ this.add3Points=function(n,w,A,y,D,E){if(q){q=!1;c=n<A?n<D?n:D:A<D?A:D;d=w<y?w<E
|
|
|
e:n.getRight();h=h>n.getBottom()?h:n.getBottom()}a()};this.inflate=function(n){c-=n;d-=n;e+=n;h+=n;a()};this.minSelf=function(n){c=c>n.getLeft()?c:n.getLeft();d=d>n.getTop()?d:n.getTop();e=e<n.getRight()?e:n.getRight();h=h<n.getBottom()?h:n.getBottom();a()};this.instersects=function(n){return Math.min(e,n.getRight())-Math.max(c,n.getLeft())>=0&&Math.min(h,n.getBottom())-Math.max(d,n.getTop())>=0};this.empty=function(){q=!0;h=e=d=c=0;a()};this.isEmpty=function(){return q}};
|
|
|
THREE.Matrix3=function(){this.m=[]};THREE.Matrix3.prototype={transpose:function(){var a,c=this.m;a=c[1];c[1]=c[3];c[3]=a;a=c[2];c[2]=c[6];c[6]=a;a=c[5];c[5]=c[7];c[7]=a;return this},transposeIntoArray:function(a){var c=this.m;a[0]=c[0];a[1]=c[3];a[2]=c[6];a[3]=c[1];a[4]=c[4];a[5]=c[7];a[6]=c[2];a[7]=c[5];a[8]=c[8];return this}};
|
|
|
THREE.Matrix4=function(a,c,d,e,h,l,m,q,n,w,A,y,D,E,F,H){this.set(a||1,c||0,d||0,e||0,h||0,l||1,m||0,q||0,n||0,w||0,A||1,y||0,D||0,E||0,F||0,H||1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
-THREE.Matrix4.prototype={set:function(a,c,d,e,h,l,m,q,n,w,A,y,D,E,F,H){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=l;this.n23=m;this.n24=q;this.n31=n;this.n32=w;this.n33=A;this.n34=y;this.n41=D;this.n42=E;this.n43=F;this.n44=H;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__tmpVec1,
|
|
|
-h=THREE.Matrix4.__tmpVec2,l=THREE.Matrix4.__tmpVec3;l.sub(a,c).normalize();e.cross(d,l).normalize();h.cross(l,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=l.x;this.n14=a.x;this.n21=e.y;this.n22=h.y;this.n23=l.y;this.n24=a.y;this.n31=e.z;this.n32=h.z;this.n33=l.z;this.n34=a.z;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,h=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*h;a.z=(this.n31*
|
|
|
-c+this.n32*d+this.n33*e+this.n34)*h;return a},multiplyVector3OnlyZ:function(a){var c=a.x,d=a.y;a=a.z;return(this.n31*c+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*c+this.n42*d+this.n43*a+this.n44))},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23*e+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*h;return a},crossVector:function(a){var c=new THREE.Vector4;
|
|
|
-c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,h=a.n13,l=a.n14,m=a.n21,q=a.n22,n=a.n23,w=a.n24,A=a.n31,y=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44,Z=c.n11,X=c.n12,P=c.n13,W=c.n14,b=c.n21,ka=c.n22,oa=c.n23,la=c.n24,ma=c.n31,ra=c.n32,pa=c.n33,qa=c.n34;this.n11=
|
|
|
-d*Z+e*b+h*ma;this.n12=d*X+e*ka+h*ra;this.n13=d*P+e*oa+h*pa;this.n14=d*W+e*la+h*qa+l;this.n21=m*Z+q*b+n*ma;this.n22=m*X+q*ka+n*ra;this.n23=m*P+q*oa+n*pa;this.n24=m*W+q*la+n*qa+w;this.n31=A*Z+y*b+D*ma;this.n32=A*X+y*ka+D*ra;this.n33=A*P+y*oa+D*pa;this.n34=A*W+y*la+D*qa+E;this.n41=F*Z+H*b+L*ma;this.n42=F*X+H*ka+L*ra;this.n43=F*P+H*oa+L*pa;this.n44=F*W+H*la+L*qa+M;return this},multiplyToArray:function(a,c,d){this.multiply(a,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=
|
|
|
-this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,
|
|
|
-d=this.n13,e=this.n14,h=this.n21,l=this.n22,m=this.n23,q=this.n24,n=this.n31,w=this.n32,A=this.n33,y=this.n34,D=this.n41,E=this.n42,F=this.n43,H=this.n44;return e*m*w*D-d*q*w*D-e*l*A*D+c*q*A*D+d*l*y*D-c*m*y*D-e*m*n*E+d*q*n*E+e*h*A*E-a*q*A*E-d*h*y*E+a*m*y*E+e*l*n*F-c*q*n*F-e*h*w*F+a*q*w*F+c*h*y*F-a*l*y*F-d*l*n*H+c*m*n*H+d*h*w*H-a*m*w*H-c*h*A*H+a*l*A*H},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;
|
|
|
-a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;
|
|
|
-this.flat[3]=this.n41;this.flat[4]=this.n12;this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;
|
|
|
-a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,
|
|
|
-0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),h=1-d,l=a.x,m=a.y,q=a.z,n=h*l,w=h*m;this.set(n*l+d,n*m-e*q,n*
|
|
|
-q+e*m,0,n*m+e*q,w*m+d,w*q-e*l,0,n*q-e*m,w*q+e*l,h*q*q+d,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,d=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var l=Math.cos(e);e=Math.sin(e);var m=a*d,q=c*d;this.n11=h*l;this.n12=-h*e;this.n13=d;this.n21=q*l+a*e;this.n22=-q*e+a*l;this.n23=-c*h;this.n31=-m*l+c*e;this.n32=m*e+c*l;this.n33=a*h},setRotationFromQuaternion:function(a){var c=a.x,
|
|
|
-d=a.y,e=a.z,h=a.w,l=c+c,m=d+d,q=e+e;a=c*l;var n=c*m;c*=q;var w=d*m;d*=q;e*=q;l*=h;m*=h;h*=q;this.n11=1-(w+e);this.n12=n-h;this.n13=c+m;this.n21=n+h;this.n22=1-(a+e);this.n23=d-l;this.n31=c-m;this.n32=d+l;this.n33=1-(a+w)},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=d;this.n13*=a;this.n21*=c;this.n22*=d;this.n23*=a;this.n31*=c;this.n32*=d;this.n33*=a;this.n41*=c;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,
|
|
|
-c){var d=1/c.x,e=1/c.y,h=1/c.z;this.n11=a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*h;this.n23=a.n23*h;this.n33=a.n33*h}};
|
|
|
+THREE.Matrix4.prototype={set:function(a,c,d,e,h,l,m,q,n,w,A,y,D,E,F,H){this.n11=a;this.n12=c;this.n13=d;this.n14=e;this.n21=h;this.n22=l;this.n23=m;this.n24=q;this.n31=n;this.n32=w;this.n33=A;this.n34=y;this.n41=D;this.n42=E;this.n43=F;this.n44=H;return this},identity:function(){this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1);return this},copy:function(a){this.set(a.n11,a.n12,a.n13,a.n14,a.n21,a.n22,a.n23,a.n24,a.n31,a.n32,a.n33,a.n34,a.n41,a.n42,a.n43,a.n44);return this},lookAt:function(a,c,d){var e=THREE.Matrix4.__v1,
|
|
|
+h=THREE.Matrix4.__v2,l=THREE.Matrix4.__v3;l.sub(a,c).normalize();e.cross(d,l).normalize();h.cross(l,e).normalize();this.n11=e.x;this.n12=h.x;this.n13=l.x;this.n21=e.y;this.n22=h.y;this.n23=l.y;this.n31=e.z;this.n32=h.z;this.n33=l.z;return this},multiplyVector3:function(a){var c=a.x,d=a.y,e=a.z,h=1/(this.n41*c+this.n42*d+this.n43*e+this.n44);a.x=(this.n11*c+this.n12*d+this.n13*e+this.n14)*h;a.y=(this.n21*c+this.n22*d+this.n23*e+this.n24)*h;a.z=(this.n31*c+this.n32*d+this.n33*e+this.n34)*h;return a},
|
|
|
+multiplyVector3OnlyZ:function(a){var c=a.x,d=a.y;a=a.z;return(this.n31*c+this.n32*d+this.n33*a+this.n34)*(1/(this.n41*c+this.n42*d+this.n43*a+this.n44))},multiplyVector4:function(a){var c=a.x,d=a.y,e=a.z,h=a.w;a.x=this.n11*c+this.n12*d+this.n13*e+this.n14*h;a.y=this.n21*c+this.n22*d+this.n23*e+this.n24*h;a.z=this.n31*c+this.n32*d+this.n33*e+this.n34*h;a.w=this.n41*c+this.n42*d+this.n43*e+this.n44*h;return a},crossVector:function(a){var c=new THREE.Vector4;c.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+
|
|
|
+this.n14*a.w;c.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;c.z=this.n31*a.x+this.n32*a.y+this.n33*a.z+this.n34*a.w;c.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return c},multiply:function(a,c){var d=a.n11,e=a.n12,h=a.n13,l=a.n14,m=a.n21,q=a.n22,n=a.n23,w=a.n24,A=a.n31,y=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44,Z=c.n11,X=c.n12,O=c.n13,W=c.n14,b=c.n21,ka=c.n22,oa=c.n23,la=c.n24,ma=c.n31,ra=c.n32,pa=c.n33,qa=c.n34;this.n11=d*Z+e*b+h*ma;this.n12=d*X+e*ka+h*ra;this.n13=
|
|
|
+d*O+e*oa+h*pa;this.n14=d*W+e*la+h*qa+l;this.n21=m*Z+q*b+n*ma;this.n22=m*X+q*ka+n*ra;this.n23=m*O+q*oa+n*pa;this.n24=m*W+q*la+n*qa+w;this.n31=A*Z+y*b+D*ma;this.n32=A*X+y*ka+D*ra;this.n33=A*O+y*oa+D*pa;this.n34=A*W+y*la+D*qa+E;this.n41=F*Z+H*b+L*ma;this.n42=F*X+H*ka+L*ra;this.n43=F*O+H*oa+L*pa;this.n44=F*W+H*la+L*qa+M;return this},multiplyToArray:function(a,c,d){this.multiply(a,c);d[0]=this.n11;d[1]=this.n21;d[2]=this.n31;d[3]=this.n41;d[4]=this.n12;d[5]=this.n22;d[6]=this.n32;d[7]=this.n42;d[8]=this.n13;
|
|
|
+d[9]=this.n23;d[10]=this.n33;d[11]=this.n43;d[12]=this.n14;d[13]=this.n24;d[14]=this.n34;d[15]=this.n44;return this},multiplySelf:function(a){this.multiply(this,a);return this},multiplyScalar:function(a){this.n11*=a;this.n12*=a;this.n13*=a;this.n14*=a;this.n21*=a;this.n22*=a;this.n23*=a;this.n24*=a;this.n31*=a;this.n32*=a;this.n33*=a;this.n34*=a;this.n41*=a;this.n42*=a;this.n43*=a;this.n44*=a;return this},determinant:function(){var a=this.n11,c=this.n12,d=this.n13,e=this.n14,h=this.n21,l=this.n22,
|
|
|
+m=this.n23,q=this.n24,n=this.n31,w=this.n32,A=this.n33,y=this.n34,D=this.n41,E=this.n42,F=this.n43,H=this.n44;return e*m*w*D-d*q*w*D-e*l*A*D+c*q*A*D+d*l*y*D-c*m*y*D-e*m*n*E+d*q*n*E+e*h*A*E-a*q*A*E-d*h*y*E+a*m*y*E+e*l*n*F-c*q*n*F-e*h*w*F+a*q*w*F+c*h*y*F-a*l*y*F-d*l*n*H+c*m*n*H+d*h*w*H-a*m*w*H-c*h*A*H+a*l*A*H},transpose:function(){var a;a=this.n21;this.n21=this.n12;this.n12=a;a=this.n31;this.n31=this.n13;this.n13=a;a=this.n32;this.n32=this.n23;this.n23=a;a=this.n41;this.n41=this.n14;this.n14=a;a=this.n42;
|
|
|
+this.n42=this.n24;this.n24=a;a=this.n43;this.n43=this.n34;this.n43=a;return this},clone:function(){var a=new THREE.Matrix4;a.n11=this.n11;a.n12=this.n12;a.n13=this.n13;a.n14=this.n14;a.n21=this.n21;a.n22=this.n22;a.n23=this.n23;a.n24=this.n24;a.n31=this.n31;a.n32=this.n32;a.n33=this.n33;a.n34=this.n34;a.n41=this.n41;a.n42=this.n42;a.n43=this.n43;a.n44=this.n44;return a},flatten:function(){this.flat[0]=this.n11;this.flat[1]=this.n21;this.flat[2]=this.n31;this.flat[3]=this.n41;this.flat[4]=this.n12;
|
|
|
+this.flat[5]=this.n22;this.flat[6]=this.n32;this.flat[7]=this.n42;this.flat[8]=this.n13;this.flat[9]=this.n23;this.flat[10]=this.n33;this.flat[11]=this.n43;this.flat[12]=this.n14;this.flat[13]=this.n24;this.flat[14]=this.n34;this.flat[15]=this.n44;return this.flat},flattenToArray:function(a){a[0]=this.n11;a[1]=this.n21;a[2]=this.n31;a[3]=this.n41;a[4]=this.n12;a[5]=this.n22;a[6]=this.n32;a[7]=this.n42;a[8]=this.n13;a[9]=this.n23;a[10]=this.n33;a[11]=this.n43;a[12]=this.n14;a[13]=this.n24;a[14]=this.n34;
|
|
|
+a[15]=this.n44;return a},flattenToArrayOffset:function(a,c){a[c]=this.n11;a[c+1]=this.n21;a[c+2]=this.n31;a[c+3]=this.n41;a[c+4]=this.n12;a[c+5]=this.n22;a[c+6]=this.n32;a[c+7]=this.n42;a[c+8]=this.n13;a[c+9]=this.n23;a[c+10]=this.n33;a[c+11]=this.n43;a[c+12]=this.n14;a[c+13]=this.n24;a[c+14]=this.n34;a[c+15]=this.n44;return a},setTranslation:function(a,c,d){this.set(1,0,0,a,0,1,0,c,0,0,1,d,0,0,0,1);return this},setScale:function(a,c,d){this.set(a,0,0,0,0,c,0,0,0,0,d,0,0,0,0,1);return this},setRotationX:function(a){var c=
|
|
|
+Math.cos(a);a=Math.sin(a);this.set(1,0,0,0,0,c,-a,0,0,a,c,0,0,0,0,1);return this},setRotationY:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,0,a,0,0,1,0,0,-a,0,c,0,0,0,0,1);return this},setRotationZ:function(a){var c=Math.cos(a);a=Math.sin(a);this.set(c,-a,0,0,a,c,0,0,0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,c){var d=Math.cos(c),e=Math.sin(c),h=1-d,l=a.x,m=a.y,q=a.z,n=h*l,w=h*m;this.set(n*l+d,n*m-e*q,n*q+e*m,0,n*m+e*q,w*m+d,w*q-e*l,0,n*q-e*m,w*q+e*l,h*q*q+d,0,0,0,0,1);return this},
|
|
|
+setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},setRotationFromEuler:function(a){var c=a.x,d=a.y,e=a.z;a=Math.cos(c);c=Math.sin(c);var h=Math.cos(d);d=Math.sin(d);var l=Math.cos(e);e=Math.sin(e);var m=a*d,q=c*d;this.n11=h*l;this.n12=-h*e;this.n13=d;this.n21=q*l+a*e;this.n22=-q*e+a*l;this.n23=-c*h;this.n31=-m*l+c*e;this.n32=m*e+c*l;this.n33=a*h;return this},setRotationFromQuaternion:function(a){var c=a.x,d=a.y,e=a.z,h=a.w,l=c+c,m=d+d,q=e+e;a=c*l;var n=c*m;c*=q;var w=d*m;
|
|
|
+d*=q;e*=q;l*=h;m*=h;h*=q;this.n11=1-(w+e);this.n12=n-h;this.n13=c+m;this.n21=n+h;this.n22=1-(a+e);this.n23=d-l;this.n31=c-m;this.n32=d+l;this.n33=1-(a+w);return this},scale:function(a){var c=a.x,d=a.y;a=a.z;this.n11*=c;this.n12*=d;this.n13*=a;this.n21*=c;this.n22*=d;this.n23*=a;this.n31*=c;this.n32*=d;this.n33*=a;this.n41*=c;this.n42*=d;this.n43*=a;return this},extractPosition:function(a){this.n14=a.n14;this.n24=a.n24;this.n34=a.n34},extractRotation:function(a,c){var d=1/c.x,e=1/c.y,h=1/c.z;this.n11=
|
|
|
+a.n11*d;this.n21=a.n21*d;this.n31=a.n31*d;this.n12=a.n12*e;this.n22=a.n22*e;this.n32=a.n32*e;this.n13=a.n13*h;this.n23=a.n23*h;this.n33=a.n33*h}};
|
|
|
THREE.Matrix4.makeInvert=function(a,c){var d=a.n11,e=a.n12,h=a.n13,l=a.n14,m=a.n21,q=a.n22,n=a.n23,w=a.n24,A=a.n31,y=a.n32,D=a.n33,E=a.n34,F=a.n41,H=a.n42,L=a.n43,M=a.n44;c===undefined&&(c=new THREE.Matrix4);c.n11=n*E*H-w*D*H+w*y*L-q*E*L-n*y*M+q*D*M;c.n12=l*D*H-h*E*H-l*y*L+e*E*L+h*y*M-e*D*M;c.n13=h*w*H-l*n*H+l*q*L-e*w*L-h*q*M+e*n*M;c.n14=l*n*y-h*w*y-l*q*D+e*w*D+h*q*E-e*n*E;c.n21=w*D*F-n*E*F-w*A*L+m*E*L+n*A*M-m*D*M;c.n22=h*E*F-l*D*F+l*A*L-d*E*L-h*A*M+d*D*M;c.n23=l*n*F-h*w*F-l*m*L+d*w*L+h*m*M-d*n*M;
|
|
|
c.n24=h*w*A-l*n*A+l*m*D-d*w*D-h*m*E+d*n*E;c.n31=q*E*F-w*y*F+w*A*H-m*E*H-q*A*M+m*y*M;c.n32=l*y*F-e*E*F-l*A*H+d*E*H+e*A*M-d*y*M;c.n33=h*w*F-l*q*F+l*m*H-d*w*H-e*m*M+d*q*M;c.n34=l*q*A-e*w*A-l*m*y+d*w*y+e*m*E-d*q*E;c.n41=n*y*F-q*D*F-n*A*H+m*D*H+q*A*L-m*y*L;c.n42=e*D*F-h*y*F+h*A*H-d*D*H-e*A*L+d*y*L;c.n43=h*q*F-e*n*F-h*m*H+d*n*H+e*m*L-d*q*L;c.n44=e*n*A-h*q*A+h*m*y-d*n*y-e*m*D+d*q*D;c.multiplyScalar(1/a.determinant());return c};
|
|
|
THREE.Matrix4.makeInvert3x3=function(a){var c=a.m33,d=c.m,e=a.n33*a.n22-a.n32*a.n23,h=-a.n33*a.n21+a.n31*a.n23,l=a.n32*a.n21-a.n31*a.n22,m=-a.n33*a.n12+a.n32*a.n13,q=a.n33*a.n11-a.n31*a.n13,n=-a.n32*a.n11+a.n31*a.n12,w=a.n23*a.n12-a.n22*a.n13,A=-a.n23*a.n11+a.n21*a.n13,y=a.n22*a.n11-a.n21*a.n12;a=a.n11*e+a.n21*m+a.n31*w;if(a==0)throw"matrix not invertible";a=1/a;d[0]=a*e;d[1]=a*h;d[2]=a*l;d[3]=a*m;d[4]=a*q;d[5]=a*n;d[6]=a*w;d[7]=a*A;d[8]=a*y;return c};
|
|
|
THREE.Matrix4.makeFrustum=function(a,c,d,e,h,l){var m;m=new THREE.Matrix4;m.n11=2*h/(c-a);m.n12=0;m.n13=(c+a)/(c-a);m.n14=0;m.n21=0;m.n22=2*h/(e-d);m.n23=(e+d)/(e-d);m.n24=0;m.n31=0;m.n32=0;m.n33=-(l+h)/(l-h);m.n34=-2*l*h/(l-h);m.n41=0;m.n42=0;m.n43=-1;m.n44=0;return m};THREE.Matrix4.makePerspective=function(a,c,d,e){var h;a=d*Math.tan(a*Math.PI/360);h=-a;return THREE.Matrix4.makeFrustum(h*c,a*c,h,a,d,e)};
|
|
|
-THREE.Matrix4.makeOrtho=function(a,c,d,e,h,l){var m,q,n,w;m=new THREE.Matrix4;q=c-a;n=d-e;w=l-h;m.n11=2/q;m.n12=0;m.n13=0;m.n14=-((c+a)/q);m.n21=0;m.n22=2/n;m.n23=0;m.n24=-((d+e)/n);m.n31=0;m.n32=0;m.n33=-2/w;m.n34=-((l+h)/w);m.n41=0;m.n42=0;m.n43=0;m.n44=1;return m};THREE.Matrix4.__tmpVec1=new THREE.Vector3;THREE.Matrix4.__tmpVec2=new THREE.Vector3;THREE.Matrix4.__tmpVec3=new THREE.Vector3;
|
|
|
-THREE.Object3D=function(){this.id=THREE.Object3DCounter.value++;this.parent=undefined;this.children=[];this.position=new THREE.Vector3;this.positionScreen=new THREE.Vector4;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixNeedsUpdate=!0;this.matrixAutoUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;
|
|
|
-this.visible=!0};
|
|
|
-THREE.Object3D.prototype={translateX:function(){},translateY:function(){},translateZ:function(){},lookAt:function(){},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?
|
|
|
-this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);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))}return!0},update:function(a,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,
|
|
|
-this.scale);this.matrixNeedsUpdate=!1;c=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,c,d)}}};THREE.Object3DCounter={value:0};THREE.Quaternion=function(a,c,d,e){this.set(a||0,c||0,d||0,e!==undefined?e:1)};
|
|
|
+THREE.Matrix4.makeOrtho=function(a,c,d,e,h,l){var m,q,n,w;m=new THREE.Matrix4;q=c-a;n=d-e;w=l-h;m.n11=2/q;m.n12=0;m.n13=0;m.n14=-((c+a)/q);m.n21=0;m.n22=2/n;m.n23=0;m.n24=-((d+e)/n);m.n31=0;m.n32=0;m.n33=-2/w;m.n34=-((l+h)/w);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.Object3D=function(){this.parent=undefined;this.children=[];this.up=new THREE.Vector3(0,1,0);this.position=new THREE.Vector3;this.rotation=new THREE.Vector3;this.scale=new THREE.Vector3(1,1,1);this.rotationAutoUpdate=!0;this.matrix=new THREE.Matrix4;this.matrixWorld=new THREE.Matrix4;this.matrixRotationWorld=new THREE.Matrix4;this.matrixAutoUpdate=!0;this.matrixWorldNeedsUpdate=!0;this.quaternion=new THREE.Quaternion;this.useQuaternion=!1;this.boundRadius=0;this.boundRadiusScale=1;this.visible=
|
|
|
+!0};
|
|
|
+THREE.Object3D.prototype={lookAt:function(a){this.matrix.lookAt(this.position,a,this.up);this.rotationAutoUpdate&&this.rotation.setRotationFromMatrix(this.matrix)},addChild:function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);for(var c=this;c instanceof THREE.Scene===!1&&c!==undefined;)c=c.parent;c!==undefined&&c.addChildRecurse(a)}},removeChild:function(a){var c=this.children.indexOf(a);if(c!==-1){a.parent=undefined;this.children.splice(c,1)}},
|
|
|
+updateMatrix:function(){this.matrix.setPosition(this.position);this.useQuaternion?this.matrix.setRotationFromQuaternion(this.quaternion):this.matrix.setRotationFromEuler(this.rotation);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))}return!0},update:function(a,c,d){if(this.visible){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,
|
|
|
+this.matrix):this.matrixWorld.copy(this.matrix);this.matrixRotationWorld.extractRotation(this.matrixWorld,this.scale);this.matrixWorldNeedsUpdate=!1;c=!0}a=0;for(var e=this.children.length;a<e;a++)this.children[a].update(this.matrixWorld,c,d)}}};THREE.Quaternion=function(a,c,d,e){this.set(a||0,c||0,d||0,e!==undefined?e:1)};
|
|
|
THREE.Quaternion.prototype={set:function(a,c,d,e){this.x=a;this.y=c;this.z=d;this.w=e;return this},setFromEuler:function(a){var c=0.5*Math.PI/360,d=a.x*c,e=a.y*c,h=a.z*c;a=Math.cos(e);e=Math.sin(e);c=Math.cos(-h);h=Math.sin(-h);var l=Math.cos(d);d=Math.sin(d);var m=a*c,q=e*h;this.w=m*l-q*d;this.x=m*d+q*l;this.y=e*c*l+a*h*d;this.z=a*h*l-e*c*d;return this},calculateW:function(){this.w=-Math.sqrt(Math.abs(1-this.x*this.x-this.y*this.y-this.z*this.z));return this},inverse:function(){this.x*=-1;this.y*=
|
|
|
-1;this.z*=-1;return this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},normalize:function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);if(a==0)this.w=this.z=this.y=this.x=0;else{a=1/a;this.x*=a;this.y*=a;this.z*=a;this.w*=a}return this},multiplySelf:function(a){var c=this.x,d=this.y,e=this.z,h=this.w,l=a.x,m=a.y,q=a.z;a=a.w;this.x=c*a+h*l+d*q-e*m;this.y=d*a+h*m+e*l-c*q;this.z=e*a+h*q+c*m-d*l;this.w=h*a-c*l-d*m-e*q;return this},
|
|
|
multiplyVector3:function(a,c){c||(c=a);var d=a.x,e=a.y,h=a.z,l=this.x,m=this.y,q=this.z,n=this.w,w=n*d+m*h-q*e,A=n*e+q*d-l*h,y=n*h+l*e-m*d;d=-l*d-m*e-q*h;c.x=w*n+d*-l+A*-q-y*-m;c.y=A*n+d*-m+y*-l-w*-q;c.z=y*n+d*-q+w*-m-A*-l;return c}};
|
|
@@ -55,17 +56,17 @@ d.centroid.addSelf(this.vertices[d.d].position);d.centroid.divideScalar(4)}}},co
|
|
|
d.position);n.sub(c.position,d.position);q.crossSelf(n)}q.isZero()||q.normalize();l.normal.copy(q)}},computeVertexNormals:function(){var a,c,d,e;if(this.__tmpVertices==undefined){e=this.__tmpVertices=Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)e[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3)d.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(d instanceof THREE.Face4)d.vertexNormals=[new THREE.Vector3,
|
|
|
new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}}else{e=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)e[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++){d=this.faces[a];if(d instanceof THREE.Face3){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal)}else if(d instanceof THREE.Face4){e[d.a].addSelf(d.normal);e[d.b].addSelf(d.normal);e[d.c].addSelf(d.normal);e[d.d].addSelf(d.normal)}}a=0;for(c=this.vertices.length;a<c;a++)e[a].normalize();a=0;for(c=this.faces.length;a<
|
|
|
c;a++){d=this.faces[a];if(d instanceof THREE.Face3){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c])}else if(d instanceof THREE.Face4){d.vertexNormals[0].copy(e[d.a]);d.vertexNormals[1].copy(e[d.b]);d.vertexNormals[2].copy(e[d.c]);d.vertexNormals[3].copy(e[d.d])}}},computeTangents:function(){function a(qa,ha,ua,Aa,Ca,wa,Fa){l=qa.vertices[ha].position;m=qa.vertices[ua].position;q=qa.vertices[Aa].position;n=h[Ca];w=h[wa];A=h[Fa];y=m.x-l.x;D=q.x-l.x;E=m.y-
|
|
|
-l.y;F=q.y-l.y;H=m.z-l.z;L=q.z-l.z;M=w.u-n.u;Z=A.u-n.u;X=w.v-n.v;P=A.v-n.v;W=1/(M*P-Z*X);oa.set((P*y-X*D)*W,(P*E-X*F)*W,(P*H-X*L)*W);la.set((M*D-Z*y)*W,(M*F-Z*E)*W,(M*L-Z*H)*W);b[ha].addSelf(oa);b[ua].addSelf(oa);b[Aa].addSelf(oa);ka[ha].addSelf(la);ka[ua].addSelf(la);ka[Aa].addSelf(la)}var c,d,e,h,l,m,q,n,w,A,y,D,E,F,H,L,M,Z,X,P,W,b=[],ka=[],oa=new THREE.Vector3,la=new THREE.Vector3,ma=new THREE.Vector3,ra=new THREE.Vector3,pa=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){b[c]=new THREE.Vector3;
|
|
|
+l.y;F=q.y-l.y;H=m.z-l.z;L=q.z-l.z;M=w.u-n.u;Z=A.u-n.u;X=w.v-n.v;O=A.v-n.v;W=1/(M*O-Z*X);oa.set((O*y-X*D)*W,(O*E-X*F)*W,(O*H-X*L)*W);la.set((M*D-Z*y)*W,(M*F-Z*E)*W,(M*L-Z*H)*W);b[ha].addSelf(oa);b[ua].addSelf(oa);b[Aa].addSelf(oa);ka[ha].addSelf(la);ka[ua].addSelf(la);ka[Aa].addSelf(la)}var c,d,e,h,l,m,q,n,w,A,y,D,E,F,H,L,M,Z,X,O,W,b=[],ka=[],oa=new THREE.Vector3,la=new THREE.Vector3,ma=new THREE.Vector3,ra=new THREE.Vector3,pa=new THREE.Vector3;c=0;for(d=this.vertices.length;c<d;c++){b[c]=new THREE.Vector3;
|
|
|
ka[c]=new THREE.Vector3}c=0;for(d=this.faces.length;c<d;c++){e=this.faces[c];h=this.uvs[c];if(e instanceof THREE.Face3){a(this,e.a,e.b,e.c,0,1,2);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2])}else if(e instanceof THREE.Face4){a(this,e.a,e.b,e.c,0,1,2);a(this,e.a,e.b,e.d,0,1,3);this.vertices[e.a].normal.copy(e.vertexNormals[0]);this.vertices[e.b].normal.copy(e.vertexNormals[1]);this.vertices[e.c].normal.copy(e.vertexNormals[2]);
|
|
|
this.vertices[e.d].normal.copy(e.vertexNormals[3])}}c=0;for(d=this.vertices.length;c<d;c++){pa.copy(this.vertices[c].normal);e=b[c];ma.copy(e);ma.subSelf(pa.multiplyScalar(pa.dot(e))).normalize();ra.cross(this.vertices[c].normal,e);e=ra.dot(ka[c]);e=e<0?-1:1;this.vertices[c].tangent.set(ma.x,ma.y,ma.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],
|
|
|
z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var c=1,d=this.vertices.length;c<d;c++){a=this.vertices[c];if(a.position.x<this.boundingBox.x[0])this.boundingBox.x[0]=a.position.x;else if(a.position.x>this.boundingBox.x[1])this.boundingBox.x[1]=a.position.x;if(a.position.y<this.boundingBox.y[0])this.boundingBox.y[0]=a.position.y;else if(a.position.y>this.boundingBox.y[1])this.boundingBox.y[1]=a.position.y;if(a.position.z<this.boundingBox.z[0])this.boundingBox.z[0]=a.position.z;else if(a.position.z>
|
|
|
this.boundingBox.z[1])this.boundingBox.z[1]=a.position.z}}},computeBoundingSphere:function(){for(var a=this.boundingSphere===null?0:this.boundingSphere.radius,c=0,d=this.vertices.length;c<d;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}}};THREE.GeometryIdCounter=0;
|
|
|
-THREE.Camera=function(a,c,d,e,h){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=d||0.1;this.far=e||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.up=new THREE.Vector3(0,1,0);this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;var l=new THREE.Vector3;this.translateX=function(m,q){l.sub(this.target.position,this.position).normalize().multiplyScalar(m);l.crossSelf(this.up);if(q)l.y=0;this.position.addSelf(l);this.target.position.addSelf(l)};this.translateZ=
|
|
|
-function(m,q){l.sub(this.target.position,this.position).normalize().multiplyScalar(m);if(q)l.y=0;this.position.subSelf(l);this.target.position.subSelf(l)};this.updateProjectionMatrix()};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
-THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,
|
|
|
-this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;
|
|
|
-THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;THREE.FlatShading=0;THREE.SmoothShading=1;
|
|
|
-THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
|
|
|
+THREE.Camera=function(a,c,d,e,h){THREE.Object3D.call(this);this.fov=a||50;this.aspect=c||1;this.near=d||0.1;this.far=e||2E3;this.target=h||new THREE.Object3D;this.useTarget=!0;this.matrixWorldInverse=new THREE.Matrix4;this.projectionMatrix=null;this.updateProjectionMatrix();var l=new THREE.Vector3;this.translateX=function(m,q){l.sub(this.target.position,this.position).normalize().multiplyScalar(m);l.crossSelf(this.up);if(q)l.y=0;this.position.addSelf(l);this.target.position.addSelf(l)};this.translateZ=
|
|
|
+function(m,q){l.sub(this.target.position,this.position).normalize().multiplyScalar(m);if(q)l.y=0;this.position.subSelf(l);this.target.position.subSelf(l)}};THREE.Camera.prototype=new THREE.Object3D;THREE.Camera.prototype.constructor=THREE.Camera;THREE.Camera.prototype.supr=THREE.Object3D.prototype;THREE.Camera.prototype.updateProjectionMatrix=function(){this.projectionMatrix=THREE.Matrix4.makePerspective(this.fov,this.aspect,this.near,this.far)};
|
|
|
+THREE.Camera.prototype.update=function(a,c,d){if(this.useTarget){this.matrix.lookAt(this.position,this.target.position,this.up);this.matrix.setPosition(this.position);a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse);c=!0}else{this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=
|
|
|
+!1;c=!0;THREE.Matrix4.makeInvert(this.matrixWorld,this.matrixWorldInverse)}}for(a=0;a<this.children.length;a++)this.children[a].update(this.matrixWorld,c,d)};THREE.Light=function(a){THREE.Object3D.call(this);this.color=new THREE.Color(a)};THREE.Light.prototype=new THREE.Object3D;THREE.Light.prototype.constructor=THREE.Light;THREE.Light.prototype.supr=THREE.Object3D.prototype;THREE.AmbientLight=function(a){THREE.Light.call(this,a)};THREE.AmbientLight.prototype=new THREE.Light;
|
|
|
+THREE.AmbientLight.prototype.constructor=THREE.AmbientLight;THREE.DirectionalLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3(0,1,0);this.intensity=c||1};THREE.DirectionalLight.prototype=new THREE.Light;THREE.DirectionalLight.prototype.constructor=THREE.DirectionalLight;THREE.PointLight=function(a,c){THREE.Light.call(this,a);this.position=new THREE.Vector3;this.intensity=c||1};THREE.PointLight.prototype=new THREE.Light;THREE.PointLight.prototype.constructor=THREE.PointLight;
|
|
|
+THREE.FlatShading=0;THREE.SmoothShading=1;THREE.NormalBlending=0;THREE.AdditiveBlending=1;THREE.SubtractiveBlending=2;THREE.BillboardBlending=3;THREE.ReverseSubtractiveBlending=4;THREE.MaterialCounter={value:0};THREE.CubeReflectionMapping=function(){};THREE.CubeRefractionMapping=function(){};THREE.LatitudeReflectionMapping=function(){};THREE.LatitudeRefractionMapping=function(){};THREE.SphericalReflectionMapping=function(){};THREE.SphericalRefractionMapping=function(){};THREE.UVMapping=function(){};
|
|
|
THREE.LineBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.blending=THREE.NormalBlending;this.depthTest=!0;this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;if(a){a.color!==undefined&&this.color.setHex(a.color);if(a.opacity!==undefined)this.opacity=a.opacity;if(a.blending!==undefined)this.blending=a.blending;if(a.depthTest!==undefined)this.depthTest=a.depthTest;if(a.linewidth!==undefined)this.linewidth=
|
|
|
a.linewidth;if(a.linecap!==undefined)this.linecap=a.linecap;if(a.linejoin!==undefined)this.linejoin=a.linejoin;if(a.vertexColors!==undefined)this.vertexColors=a.vertexColors}};
|
|
|
THREE.MeshBasicMaterial=function(a){this.id=THREE.MaterialCounter.value++;this.color=new THREE.Color(16777215);this.opacity=1;this.envMap=this.lightMap=this.map=null;this.combine=THREE.MultiplyOperation;this.reflectivity=1;this.refractionRatio=0.98;this.fog=!0;this.shading=THREE.SmoothShading;this.blending=THREE.NormalBlending;this.depthTest=!0;this.wireframe=!1;this.wireframeLinewidth=1;this.wireframeLinejoin=this.wireframeLinecap="round";this.vertexColors=!1;this.skinning=!1;if(a){a.color!==undefined&&
|
|
@@ -95,13 +96,13 @@ var Uniforms={clone:function(a){var c,d,e,h={};for(c in a){h[c]={};for(d in a[c]
|
|
|
THREE.Particle.prototype.constructor=THREE.Particle;THREE.ParticleSystem=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.sortParticles=!1};THREE.ParticleSystem.prototype=new THREE.Object3D;THREE.ParticleSystem.prototype.constructor=THREE.ParticleSystem;THREE.Line=function(a,c,d){THREE.Object3D.call(this);this.geometry=a;this.materials=c instanceof Array?c:[c];this.type=d!=undefined?d:THREE.LineStrip};THREE.LineStrip=0;THREE.LinePieces=1;
|
|
|
THREE.Line.prototype=new THREE.Object3D;THREE.Line.prototype.constructor=THREE.Line;THREE.Mesh=function(a,c){THREE.Object3D.call(this);this.geometry=a;this.materials=c&&c.length?c:[c];this.flipSided=!1;this.doubleSided=!1;this.overdraw=!1;if(this.geometry){this.geometry.boundingSphere||this.geometry.computeBoundingSphere();this.boundRadius=a.boundingSphere.radius}};THREE.Mesh.prototype=new THREE.Object3D;THREE.Mesh.prototype.constructor=THREE.Mesh;THREE.Mesh.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.Bone=function(a){THREE.Object3D.call(this);this.skin=a;this.skinMatrix=new THREE.Matrix4;this.hasNoneBoneChildren=!1};THREE.Bone.prototype=new THREE.Object3D;THREE.Bone.prototype.constructor=THREE.Bone;THREE.Bone.prototype.supr=THREE.Object3D.prototype;
|
|
|
-THREE.Bone.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixNeedsUpdate=!1;c=!0}var e,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<h;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,c,d):a.update(this.matrixWorld,!0,d)}}else for(e=0;e<h;e++)this.children[e].update(this.skinMatrix,
|
|
|
+THREE.Bone.prototype.update=function(a,c,d){this.matrixAutoUpdate&&(c|=this.updateMatrix());if(c||this.matrixWorldNeedsUpdate){a?this.skinMatrix.multiply(a,this.matrix):this.skinMatrix.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e,h=this.children.length;if(this.hasNoneBoneChildren){this.matrixWorld.multiply(this.skin.matrixWorld,this.skinMatrix);for(e=0;e<h;e++){a=this.children[e];a instanceof THREE.Bone?a.update(this.skinMatrix,c,d):a.update(this.matrixWorld,!0,d)}}else for(e=0;e<h;e++)this.children[e].update(this.skinMatrix,
|
|
|
c,d)};THREE.Bone.prototype.addChild=function(a){if(this.children.indexOf(a)===-1){a.parent!==undefined&&a.parent.removeChild(a);a.parent=this;this.children.push(a);if(!(a instanceof THREE.Bone))this.hasNoneBoneChildren=!0}};
|
|
|
THREE.Sound=function(a,c,d,e){THREE.Object3D.call(this);this.isLoaded=!1;this.isAddedToDOM=!1;this.isPlaying=!1;this.duration=-1;this.radius=c!==undefined?Math.abs(c):100;this.volume=Math.min(1,Math.max(0,d!==undefined?d:1));this.domElement=document.createElement("audio");this.domElement.volume=0;this.domElement.pan=0;this.domElement.loop=e!==undefined?e:!0;this.sources=a instanceof Array?a:[a];var h;d=this.sources.length;for(a=0;a<d;a++){c=this.sources[a];c.toLowerCase();if(c.indexOf(".mp3")!==-1)h=
|
|
|
"audio/mpeg";else if(c.indexOf(".ogg")!==-1)h="audio/ogg";else c.indexOf(".wav")!==-1&&(h="audio/wav");if(this.domElement.canPlayType(h)){h=document.createElement("source");h.src=this.sources[a];this.domElement.THREESound=this;this.domElement.appendChild(h);this.domElement.addEventListener("canplay",this.onLoad,!0);this.domElement.load();break}}};THREE.Sound.prototype=new THREE.Object3D;THREE.Sound.prototype.constructor=THREE.Sound;THREE.Sound.prototype.supr=THREE.Object3D.prototype;
|
|
|
THREE.Sound.prototype.onLoad=function(){var a=this.THREESound;if(!a.isLoaded){this.removeEventListener("canplay",this.onLoad,!0);a.isLoaded=!0;a.duration=this.duration;a.isPlaying&&a.play()}};THREE.Sound.prototype.addToDOM=function(a){this.isAddedToDOM=!0;a.appendChild(this.domElement)};THREE.Sound.prototype.play=function(a){this.isPlaying=!0;if(this.isLoaded){this.domElement.play();if(a)this.domElement.currentTime=a%this.duration}};THREE.Sound.prototype.pause=function(){this.isPlaying=!1;this.domElement.pause()};
|
|
|
THREE.Sound.prototype.stop=function(){this.isPlaying=!1;this.domElement.pause();this.domElement.currentTime=0};THREE.Sound.prototype.calculateVolumeAndPan=function(a){a=a.length();this.domElement.volume=a<=this.radius?this.volume*(1-a/this.radius):0};
|
|
|
-THREE.Sound.prototype.update=function(a,c,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixNeedsUpdate=!1;c=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,c,d)};
|
|
|
+THREE.Sound.prototype.update=function(a,c,d){if(this.matrixAutoUpdate){this.matrix.setPosition(this.position);c=!0}if(c||this.matrixWorldNeedsUpdate){a?this.matrixWorld.multiply(a,this.matrix):this.matrixWorld.copy(this.matrix);this.matrixWorldNeedsUpdate=!1;c=!0}var e=this.children.length;for(a=0;a<e;a++)this.children[a].update(this.matrixWorld,c,d)};
|
|
|
THREE.Scene=function(){THREE.Object3D.call(this);this.matrixAutoUpdate=!1;this.fog=null;this.objects=[];this.lights=[];this.sounds=[];this.__objectsAdded=[];this.__objectsRemoved=[]};THREE.Scene.prototype=new THREE.Object3D;THREE.Scene.prototype.constructor=THREE.Scene;THREE.Scene.prototype.supr=THREE.Object3D.prototype;THREE.Scene.prototype.addChild=function(a){this.supr.addChild.call(this,a);this.addChildRecurse(a)};
|
|
|
THREE.Scene.prototype.addChildRecurse=function(a){if(a instanceof THREE.Light)this.lights.indexOf(a)===-1&&this.lights.push(a);else if(a instanceof THREE.Sound)this.sounds.indexOf(a)===-1&&this.sounds.push(a);else if(!(a instanceof THREE.Camera||a instanceof THREE.Bone)&&this.objects.indexOf(a)===-1){this.objects.push(a);this.__objectsAdded.push(a)}for(var c=0;c<a.children.length;c++)this.addChildRecurse(a.children[c])};
|
|
|
THREE.Scene.prototype.removeChild=function(a){this.supr.removeChild.call(this,a);this.removeChildRecurse(a)};THREE.Scene.prototype.removeChildRecurse=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else if(a instanceof THREE.Sound){c=this.sounds.indexOf(a);c!==-1&&this.sounds.splice(c,1)}else if(!(a instanceof THREE.Camera)){c=this.objects.indexOf(a);if(c!==-1){this.objects.splice(c,1);this.__objectsRemoved.push(a)}}for(c=0;c<a.children.length;c++)this.removeChildRecurse(a.children[c])};
|
|
@@ -115,35 +116,35 @@ I.y;t[s+2]=I.z;ea+=1}else if(s instanceof THREE.PointLight){s=z*3;ca[s]=N.r*K;ca
|
|
|
r.pointLightColor.value=j.point.colors;r.pointLightPosition.value=j.point.positions}if(g instanceof THREE.MeshBasicMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshPhongMaterial){r.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity;r.map.texture=g.map;r.lightMap.texture=g.lightMap;r.envMap.texture=g.envMap;r.reflectivity.value=g.reflectivity;r.refractionRatio.value=g.refractionRatio;r.combine.value=g.combine;r.useRefract.value=
|
|
|
g.envMap&&g.envMap.mapping instanceof THREE.CubeRefractionMapping}if(g instanceof THREE.LineBasicMaterial){r.diffuse.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity}else if(g instanceof THREE.ParticleBasicMaterial){r.psColor.value.setRGB(g.color.r*g.opacity,g.color.g*g.opacity,g.color.b*g.opacity);r.opacity.value=g.opacity;r.size.value=g.size;r.map.texture=g.map}else if(g instanceof THREE.MeshPhongMaterial){r.ambient.value.setRGB(g.ambient.r,g.ambient.g,
|
|
|
g.ambient.b);r.specular.value.setRGB(g.specular.r,g.specular.g,g.specular.b);r.shininess.value=g.shininess}else if(g instanceof THREE.MeshDepthMaterial){r.mNear.value=f.near;r.mFar.value=f.far;r.opacity.value=g.opacity}else if(g instanceof THREE.MeshNormalMaterial)r.opacity.value=g.opacity;for(var B in r)if(v=u.uniforms[B]){k=r[B];x=k.type;j=k.value;if(x=="i")b.uniform1i(v,j);else if(x=="f")b.uniform1f(v,j);else if(x=="fv1")b.uniform1fv(v,j);else if(x=="fv")b.uniform3fv(v,j);else if(x=="v2")b.uniform2f(v,
|
|
|
-j.x,j.y);else if(x=="v3")b.uniform3f(v,j.x,j.y,j.z);else if(x=="c")b.uniform3f(v,j.r,j.g,j.b);else if(x=="t"){b.uniform1i(v,j);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){try{if((k.image.width&k.image.width-1)!=0||(k.image.height&k.image.height-1)!=0)throw"Texture not power of 2: "+k.image.src;}catch(C){console.error(C)}if(!k.image.__webGLTextureCube)k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);
|
|
|
-b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR);for(x=0;x<6;++x)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[x]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+
|
|
|
-j);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{if(k.needsUpdate){try{if((k.image.width&k.image.width-1)!=0||(k.image.height&k.image.height-1)!=0)throw"Texture not power of 2: "+k.image.src;}catch(O){console.error(O)}if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,P(k.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,P(k.wrapT));b.texParameteri(b.TEXTURE_2D,
|
|
|
-b.TEXTURE_MAG_FILTER,P(k.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,P(k.minFilter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null)}else{k.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,P(k.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,P(k.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,P(k.magFilter));
|
|
|
-b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,P(k.minFilter));b.generateMipmap(b.TEXTURE_2D);b.bindTexture(b.TEXTURE_2D,null);k.__wasSetOnce=!0}k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+j);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}b.uniformMatrix4fv(o.modelViewMatrix,!1,i._modelViewMatrixArray);b.uniformMatrix3fv(o.normalMatrix,!1,i._normalMatrixArray);(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.envMap)&&b.uniform3f(o.cameraPosition,f.position.x,f.position.y,
|
|
|
-f.position.z);(g instanceof THREE.MeshShaderMaterial||g.envMap||g.skinning)&&b.uniformMatrix4fv(o.objectMatrix,!1,i._objectMatrixArray);(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial||g.skinning)&&b.uniformMatrix4fv(o.viewMatrix,!1,Ca);if(g.skinning){b.uniformMatrix4fv(o.cameraInverseMatrix,!1,Ca);b.uniformMatrix4fv(o.boneGlobalMatrices,!1,i.boneMatrices)}return u}function h(f,j,k,g,i,u){f=e(f,j,k,g,u).attributes;b.bindBuffer(b.ARRAY_BUFFER,
|
|
|
-i.__webGLVertexBuffer);b.vertexAttribPointer(f.position,3,b.FLOAT,!1,0,0);if(f.color>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLColorBuffer);b.vertexAttribPointer(f.color,3,b.FLOAT,!1,0,0)}if(f.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLNormalBuffer);b.vertexAttribPointer(f.normal,3,b.FLOAT,!1,0,0)}if(f.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLTangentBuffer);b.vertexAttribPointer(f.tangent,4,b.FLOAT,!1,0,0)}if(f.uv>=0)if(i.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUVBuffer);
|
|
|
-b.vertexAttribPointer(f.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(f.uv)}else b.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(i.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUV2Buffer);b.vertexAttribPointer(f.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(f.uv2)}else b.disableVertexAttribArray(f.uv2);if(g.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);b.vertexAttribPointer(f.skinVertexA,4,b.FLOAT,
|
|
|
-!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);b.vertexAttribPointer(f.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);b.vertexAttribPointer(f.skinIndex,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);b.vertexAttribPointer(f.skinWeight,4,b.FLOAT,!1,0,0)}if(u instanceof THREE.Mesh)if(g.wireframe){b.lineWidth(g.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);b.drawElements(b.LINES,i.__webGLLineCount,
|
|
|
-b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,i.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(u instanceof THREE.Line){u=u.type==THREE.LineStrip?b.LINE_STRIP:b.LINES;b.lineWidth(g.linewidth);b.drawArrays(u,0,i.__webGLLineCount)}else if(u instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,i.__webGLParticleCount);else u instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,i.__webGLVertexCount)}function l(f,j){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=
|
|
|
-b.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=b.createBuffer();if(f.hasPos){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,f.positionArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(j.attributes.position);b.vertexAttribPointer(j.attributes.position,3,b.FLOAT,!1,0,0)}if(f.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,f.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(j.attributes.normal);b.vertexAttribPointer(j.attributes.normal,
|
|
|
-3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,f.count);f.count=0}function m(f){if(ma!=f.doubleSided){f.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);ma=f.doubleSided}if(ra!=f.flipSided){f.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);ra=f.flipSided}}function q(f){if(qa!=f){f?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);qa=f}}function n(f){ha[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);ha[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);ha[2].set(f.n41+f.n21,f.n42+f.n22,
|
|
|
-f.n43+f.n23,f.n44+f.n24);ha[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);ha[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);ha[5].set(f.n41+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var j;for(f=0;f<6;f++){j=ha[f];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z*j.z))}}function w(f){for(var j=f.matrixWorld,k=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),g=0;g<6;g++){f=ha[g].x*j.n14+ha[g].y*j.n24+ha[g].z*j.n34+ha[g].w;if(f<=k)return!1}return!0}function A(f,
|
|
|
-j){f.list[f.count]=j;f.count+=1}function y(f){var j,k,g=f.object,i=f.opaque,u=f.transparent;u.count=0;f=i.count=0;for(j=g.materials.length;f<j;f++){k=g.materials[f];k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?A(u,k):A(i,k)}}function D(f){var j,k,g,i,u=f.object,o=f.buffer,r=f.opaque,x=f.transparent;x.count=0;f=r.count=0;for(g=u.materials.length;f<g;f++){j=u.materials[f];if(j instanceof THREE.MeshFaceMaterial){j=0;for(k=o.materials.length;j<k;j++)(i=o.materials[j])&&(i.opacity&&i.opacity<
|
|
|
-1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i))}else{i=j;i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i)}}}function E(f,j){return j.z-f.z}function F(f,j){f._modelViewMatrix.multiplyToArray(j.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function H(f){function j(J){var Q=[];k=0;for(g=J.length;k<g;k++)J[k]==undefined?Q.push("undefined"):Q.push(J[k].id);return Q.join("_")}var k,
|
|
|
-g,i,u,o,r,x,s,v={};f.geometryGroups={};i=0;for(u=f.faces.length;i<u;i++){o=f.faces[i];r=o.materials;x=j(r);v[x]==undefined&&(v[x]={hash:x,counter:0});s=v[x].hash+"_"+v[x].counter;f.geometryGroups[s]==undefined&&(f.geometryGroups[s]={faces:[],materials:r,vertices:0});o=o instanceof THREE.Face3?3:4;if(f.geometryGroups[s].vertices+o>65535){v[x].counter+=1;s=v[x].hash+"_"+v[x].counter;f.geometryGroups[s]==undefined&&(f.geometryGroups[s]={faces:[],materials:r,vertices:0})}f.geometryGroups[s].faces.push(i);
|
|
|
-f.geometryGroups[s].vertices+=o}}function L(f,j,k){f.push({buffer:j,object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(f){if(f!=pa){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:b.blendEquation(b.FUNC_REVERSE_SUBTRACT);
|
|
|
-b.blendFunc(b.ONE,b.ONE);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}pa=f}}function Z(f,j){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=b.createFramebuffer();f.__webGLRenderbuffer=b.createRenderbuffer();f.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,f.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,f.width,f.height);b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,
|
|
|
-P(f.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,P(f.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,P(f.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,P(f.minFilter));b.texImage2D(b.TEXTURE_2D,0,P(f.format),f.width,f.height,0,P(f.format),P(f.type),null);b.bindFramebuffer(b.FRAMEBUFFER,f.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,f.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,
|
|
|
-f.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var k,g,i;if(f){k=f.__webGLFramebuffer;g=f.width;i=f.height}else{k=null;g=W.width;i=W.height}if(k!=oa){b.bindFramebuffer(b.FRAMEBUFFER,k);b.viewport(0,0,g,i);j&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);oa=k}}function X(f,j){var k;if(f=="fragment")k=b.createShader(b.FRAGMENT_SHADER);else f=="vertex"&&(k=b.createShader(b.VERTEX_SHADER));b.shaderSource(k,j);b.compileShader(k);
|
|
|
-if(!b.getShaderParameter(k,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(k));return null}return k}function P(f){switch(f){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;
|
|
|
-case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;
|
|
|
-case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var W=document.createElement("canvas"),b,ka=null,oa=null,la=this,ma=null,ra=null,pa=null,qa=null,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,Aa=new Float32Array(16),Ca=new Float32Array(16),wa=new THREE.Vector4,Fa=!0,La=new THREE.Color(0),Ma=0;if(a){if(a.antialias!==undefined)Fa=a.antialias;a.clearColor!==undefined&&La.setHex(a.clearColor);if(a.clearAlpha!==
|
|
|
-undefined)Ma=a.clearAlpha}this.domElement=W;this.autoClear=!0;this.sortObjects=!0;(function(f,j,k){try{if(!(b=W.getContext("experimental-webgl",{antialias:f})))throw"Error creating WebGL context.";}catch(g){console.error(g)}b.clearColor(0,0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(j.r,j.g,j.b,k);_cullEnabled=!0})(Fa,La,Ma);this.context=b;this.lights=
|
|
|
-{ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,j){W.width=f;W.height=j;b.viewport(0,0,W.width,W.height)};this.setClearColorHex=function(f,j){var k=new THREE.Color(f);b.clearColor(k.r,k.g,k.b,j)};this.setClearColor=function(f,j){b.clearColor(f.r,f.g,f.b,j)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,j,k){var g,i;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);
|
|
|
-else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)d(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);var u,o,r,x;i=r=x=0;for(u=j.length;i<u;i++){o=j[i];o instanceof
|
|
|
-THREE.DirectionalLight&&r++;o instanceof THREE.PointLight&&x++}if(x+r<=4)j=r;else{j=Math.ceil(4*r/(x+r));x=4-j}i={directional:j,point:x};x=f.fragmentShader;j=f.vertexShader;u={fog:k,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,skinning:f.skinning,maxDirLights:i.directional,maxPointLights:i.point};k=b.createProgram();i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.fog?"#define USE_FOG":
|
|
|
-"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");u=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?
|
|
|
-"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"",u.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
+j.x,j.y);else if(x=="v3")b.uniform3f(v,j.x,j.y,j.z);else if(x=="c")b.uniform3f(v,j.r,j.g,j.b);else if(x=="t"){b.uniform1i(v,j);if(k=k.texture)if(k.image instanceof Array&&k.image.length==6){if(k.image.length==6){if(k.needsUpdate){if(!k.image.__webGLTextureCube)k.image.__webGLTextureCube=b.createTexture();b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);
|
|
|
+b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MAG_FILTER,b.LINEAR);(k.image.width&k.image.width-1)==0&&(k.image.height&k.image.height-1)==0?b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR_MIPMAP_LINEAR):b.texParameteri(b.TEXTURE_CUBE_MAP,b.TEXTURE_MIN_FILTER,b.LINEAR);for(x=0;x<6;++x)b.texImage2D(b.TEXTURE_CUBE_MAP_POSITIVE_X+x,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image[x]);b.generateMipmap(b.TEXTURE_CUBE_MAP);b.bindTexture(b.TEXTURE_CUBE_MAP,null);k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+
|
|
|
+j);b.bindTexture(b.TEXTURE_CUBE_MAP,k.image.__webGLTextureCube)}}else{if(k.needsUpdate){if(k.__wasSetOnce){b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texSubImage2D(b.TEXTURE_2D,0,0,0,b.RGBA,b.UNSIGNED_BYTE,k.image);if((k.image.width&k.image.width-1)==0&&(k.image.height&k.image.height-1)==0){b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,O(k.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,O(k.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,O(k.magFilter));b.texParameteri(b.TEXTURE_2D,
|
|
|
+b.TEXTURE_MIN_FILTER,O(k.minFilter));b.generateMipmap(b.TEXTURE_2D)}else{b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE)}b.bindTexture(b.TEXTURE_2D,null)}else{k.__webGLTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,k.__webGLTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,k.image);if((k.image.width&k.image.width-1)==0&&(k.image.height&k.image.height-
|
|
|
+1)==0){b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,O(k.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,O(k.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,O(k.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,O(k.minFilter));b.generateMipmap(b.TEXTURE_2D)}else{b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.LINEAR);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE)}b.bindTexture(b.TEXTURE_2D,
|
|
|
+null);k.__wasSetOnce=!0}k.needsUpdate=!1}b.activeTexture(b.TEXTURE0+j);b.bindTexture(b.TEXTURE_2D,k.__webGLTexture)}}}b.uniformMatrix4fv(o.modelViewMatrix,!1,i._modelViewMatrixArray);b.uniformMatrix3fv(o.normalMatrix,!1,i._normalMatrixArray);(g instanceof THREE.MeshShaderMaterial||g instanceof THREE.MeshPhongMaterial||g.envMap)&&b.uniform3f(o.cameraPosition,f.position.x,f.position.y,f.position.z);(g instanceof THREE.MeshShaderMaterial||g.envMap||g.skinning)&&b.uniformMatrix4fv(o.objectMatrix,!1,i._objectMatrixArray);
|
|
|
+(g instanceof THREE.MeshPhongMaterial||g instanceof THREE.MeshLambertMaterial||g instanceof THREE.MeshShaderMaterial||g.skinning)&&b.uniformMatrix4fv(o.viewMatrix,!1,Ca);if(g.skinning){b.uniformMatrix4fv(o.cameraInverseMatrix,!1,Ca);b.uniformMatrix4fv(o.boneGlobalMatrices,!1,i.boneMatrices)}return u}function h(f,j,k,g,i,u){f=e(f,j,k,g,u).attributes;b.bindBuffer(b.ARRAY_BUFFER,i.__webGLVertexBuffer);b.vertexAttribPointer(f.position,3,b.FLOAT,!1,0,0);if(f.color>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLColorBuffer);
|
|
|
+b.vertexAttribPointer(f.color,3,b.FLOAT,!1,0,0)}if(f.normal>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLNormalBuffer);b.vertexAttribPointer(f.normal,3,b.FLOAT,!1,0,0)}if(f.tangent>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLTangentBuffer);b.vertexAttribPointer(f.tangent,4,b.FLOAT,!1,0,0)}if(f.uv>=0)if(i.__webGLUVBuffer){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLUVBuffer);b.vertexAttribPointer(f.uv,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(f.uv)}else b.disableVertexAttribArray(f.uv);if(f.uv2>=0)if(i.__webGLUV2Buffer){b.bindBuffer(b.ARRAY_BUFFER,
|
|
|
+i.__webGLUV2Buffer);b.vertexAttribPointer(f.uv2,2,b.FLOAT,!1,0,0);b.enableVertexAttribArray(f.uv2)}else b.disableVertexAttribArray(f.uv2);if(g.skinning&&f.skinVertexA>=0&&f.skinVertexB>=0&&f.skinIndex>=0&&f.skinWeight>=0){b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexABuffer);b.vertexAttribPointer(f.skinVertexA,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinVertexBBuffer);b.vertexAttribPointer(f.skinVertexB,4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinIndicesBuffer);b.vertexAttribPointer(f.skinIndex,
|
|
|
+4,b.FLOAT,!1,0,0);b.bindBuffer(b.ARRAY_BUFFER,i.__webGLSkinWeightsBuffer);b.vertexAttribPointer(f.skinWeight,4,b.FLOAT,!1,0,0)}if(u instanceof THREE.Mesh)if(g.wireframe){b.lineWidth(g.wireframeLinewidth);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLLineBuffer);b.drawElements(b.LINES,i.__webGLLineCount,b.UNSIGNED_SHORT,0)}else{b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,i.__webGLFaceBuffer);b.drawElements(b.TRIANGLES,i.__webGLFaceCount,b.UNSIGNED_SHORT,0)}else if(u instanceof THREE.Line){u=u.type==THREE.LineStrip?
|
|
|
+b.LINE_STRIP:b.LINES;b.lineWidth(g.linewidth);b.drawArrays(u,0,i.__webGLLineCount)}else if(u instanceof THREE.ParticleSystem)b.drawArrays(b.POINTS,0,i.__webGLParticleCount);else u instanceof THREE.Ribbon&&b.drawArrays(b.TRIANGLE_STRIP,0,i.__webGLVertexCount)}function l(f,j){if(!f.__webGLVertexBuffer)f.__webGLVertexBuffer=b.createBuffer();if(!f.__webGLNormalBuffer)f.__webGLNormalBuffer=b.createBuffer();if(f.hasPos){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,f.positionArray,
|
|
|
+b.DYNAMIC_DRAW);b.enableVertexAttribArray(j.attributes.position);b.vertexAttribPointer(j.attributes.position,3,b.FLOAT,!1,0,0)}if(f.hasNormal){b.bindBuffer(b.ARRAY_BUFFER,f.__webGLNormalBuffer);b.bufferData(b.ARRAY_BUFFER,f.normalArray,b.DYNAMIC_DRAW);b.enableVertexAttribArray(j.attributes.normal);b.vertexAttribPointer(j.attributes.normal,3,b.FLOAT,!1,0,0)}b.drawArrays(b.TRIANGLES,0,f.count);f.count=0}function m(f){if(ma!=f.doubleSided){f.doubleSided?b.disable(b.CULL_FACE):b.enable(b.CULL_FACE);ma=
|
|
|
+f.doubleSided}if(ra!=f.flipSided){f.flipSided?b.frontFace(b.CW):b.frontFace(b.CCW);ra=f.flipSided}}function q(f){if(qa!=f){f?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST);qa=f}}function n(f){ha[0].set(f.n41-f.n11,f.n42-f.n12,f.n43-f.n13,f.n44-f.n14);ha[1].set(f.n41+f.n11,f.n42+f.n12,f.n43+f.n13,f.n44+f.n14);ha[2].set(f.n41+f.n21,f.n42+f.n22,f.n43+f.n23,f.n44+f.n24);ha[3].set(f.n41-f.n21,f.n42-f.n22,f.n43-f.n23,f.n44-f.n24);ha[4].set(f.n41-f.n31,f.n42-f.n32,f.n43-f.n33,f.n44-f.n34);ha[5].set(f.n41+
|
|
|
+f.n31,f.n42+f.n32,f.n43+f.n33,f.n44+f.n34);var j;for(f=0;f<6;f++){j=ha[f];j.divideScalar(Math.sqrt(j.x*j.x+j.y*j.y+j.z*j.z))}}function w(f){for(var j=f.matrixWorld,k=-f.geometry.boundingSphere.radius*Math.max(f.scale.x,Math.max(f.scale.y,f.scale.z)),g=0;g<6;g++){f=ha[g].x*j.n14+ha[g].y*j.n24+ha[g].z*j.n34+ha[g].w;if(f<=k)return!1}return!0}function A(f,j){f.list[f.count]=j;f.count+=1}function y(f){var j,k,g=f.object,i=f.opaque,u=f.transparent;u.count=0;f=i.count=0;for(j=g.materials.length;f<j;f++){k=
|
|
|
+g.materials[f];k.opacity&&k.opacity<1||k.blending!=THREE.NormalBlending?A(u,k):A(i,k)}}function D(f){var j,k,g,i,u=f.object,o=f.buffer,r=f.opaque,x=f.transparent;x.count=0;f=r.count=0;for(g=u.materials.length;f<g;f++){j=u.materials[f];if(j instanceof THREE.MeshFaceMaterial){j=0;for(k=o.materials.length;j<k;j++)(i=o.materials[j])&&(i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i))}else{i=j;i.opacity&&i.opacity<1||i.blending!=THREE.NormalBlending?A(x,i):A(r,i)}}}function E(f,j){return j.z-
|
|
|
+f.z}function F(f,j){f._modelViewMatrix.multiplyToArray(j.matrixWorldInverse,f.matrixWorld,f._modelViewMatrixArray);THREE.Matrix4.makeInvert3x3(f._modelViewMatrix).transposeIntoArray(f._normalMatrixArray)}function H(f){function j(J){var Q=[];k=0;for(g=J.length;k<g;k++)J[k]==undefined?Q.push("undefined"):Q.push(J[k].id);return Q.join("_")}var k,g,i,u,o,r,x,s,v={};f.geometryGroups={};i=0;for(u=f.faces.length;i<u;i++){o=f.faces[i];r=o.materials;x=j(r);v[x]==undefined&&(v[x]={hash:x,counter:0});s=v[x].hash+
|
|
|
+"_"+v[x].counter;f.geometryGroups[s]==undefined&&(f.geometryGroups[s]={faces:[],materials:r,vertices:0});o=o instanceof THREE.Face3?3:4;if(f.geometryGroups[s].vertices+o>65535){v[x].counter+=1;s=v[x].hash+"_"+v[x].counter;f.geometryGroups[s]==undefined&&(f.geometryGroups[s]={faces:[],materials:r,vertices:0})}f.geometryGroups[s].faces.push(i);f.geometryGroups[s].vertices+=o}}function L(f,j,k){f.push({buffer:j,object:k,opaque:{list:[],count:0},transparent:{list:[],count:0}})}function M(f){if(f!=pa){switch(f){case THREE.AdditiveBlending:b.blendEquation(b.FUNC_ADD);
|
|
|
+b.blendFunc(b.ONE,b.ONE);break;case THREE.SubtractiveBlending:b.blendFunc(b.DST_COLOR,b.ZERO);break;case THREE.BillboardBlending:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.SRC_ALPHA,b.ONE_MINUS_SRC_ALPHA);break;case THREE.ReverseSubtractiveBlending:b.blendEquation(b.FUNC_REVERSE_SUBTRACT);b.blendFunc(b.ONE,b.ONE);break;default:b.blendEquation(b.FUNC_ADD);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA)}pa=f}}function Z(f,j){if(f&&!f.__webGLFramebuffer){f.__webGLFramebuffer=b.createFramebuffer();f.__webGLRenderbuffer=
|
|
|
+b.createRenderbuffer();f.__webGLTexture=b.createTexture();b.bindRenderbuffer(b.RENDERBUFFER,f.__webGLRenderbuffer);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,f.width,f.height);b.bindTexture(b.TEXTURE_2D,f.__webGLTexture);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,O(f.wrapS));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,O(f.wrapT));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,O(f.magFilter));b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,O(f.minFilter));b.texImage2D(b.TEXTURE_2D,
|
|
|
+0,O(f.format),f.width,f.height,0,O(f.format),O(f.type),null);b.bindFramebuffer(b.FRAMEBUFFER,f.__webGLFramebuffer);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,f.__webGLTexture,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,f.__webGLRenderbuffer);b.bindTexture(b.TEXTURE_2D,null);b.bindRenderbuffer(b.RENDERBUFFER,null);b.bindFramebuffer(b.FRAMEBUFFER,null)}var k,g,i;if(f){k=f.__webGLFramebuffer;g=f.width;i=f.height}else{k=null;g=W.width;i=W.height}if(k!=
|
|
|
+oa){b.bindFramebuffer(b.FRAMEBUFFER,k);b.viewport(0,0,g,i);j&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT);oa=k}}function X(f,j){var k;if(f=="fragment")k=b.createShader(b.FRAGMENT_SHADER);else f=="vertex"&&(k=b.createShader(b.VERTEX_SHADER));b.shaderSource(k,j);b.compileShader(k);if(!b.getShaderParameter(k,b.COMPILE_STATUS)){alert(b.getShaderInfoLog(k));return null}return k}function O(f){switch(f){case THREE.RepeatWrapping:return b.REPEAT;case THREE.ClampToEdgeWrapping:return b.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return b.MIRRORED_REPEAT;
|
|
|
+case THREE.NearestFilter:return b.NEAREST;case THREE.NearestMipMapNearestFilter:return b.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return b.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return b.LINEAR;case THREE.LinearMipMapNearestFilter:return b.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return b.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return b.BYTE;case THREE.UnsignedByteType:return b.UNSIGNED_BYTE;case THREE.ShortType:return b.SHORT;case THREE.UnsignedShortType:return b.UNSIGNED_SHORT;
|
|
|
+case THREE.IntType:return b.INT;case THREE.UnsignedShortType:return b.UNSIGNED_INT;case THREE.FloatType:return b.FLOAT;case THREE.AlphaFormat:return b.ALPHA;case THREE.RGBFormat:return b.RGB;case THREE.RGBAFormat:return b.RGBA;case THREE.LuminanceFormat:return b.LUMINANCE;case THREE.LuminanceAlphaFormat:return b.LUMINANCE_ALPHA}return 0}var W=document.createElement("canvas"),b,ka=null,oa=null,la=this,ma=null,ra=null,pa=null,qa=null,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,
|
|
|
+new THREE.Vector4,new THREE.Vector4],ua=new THREE.Matrix4,Aa=new Float32Array(16),Ca=new Float32Array(16),wa=new THREE.Vector4,Fa=!0,La=new THREE.Color(0),Ma=0;if(a){if(a.antialias!==undefined)Fa=a.antialias;a.clearColor!==undefined&&La.setHex(a.clearColor);if(a.clearAlpha!==undefined)Ma=a.clearAlpha}this.domElement=W;this.autoClear=!0;this.sortObjects=!0;(function(f,j,k){try{if(!(b=W.getContext("experimental-webgl",{antialias:f})))throw"Error creating WebGL context.";}catch(g){console.error(g)}b.clearColor(0,
|
|
|
+0,0,1);b.clearDepth(1);b.enable(b.DEPTH_TEST);b.depthFunc(b.LEQUAL);b.frontFace(b.CCW);b.cullFace(b.BACK);b.enable(b.CULL_FACE);b.enable(b.BLEND);b.blendFunc(b.ONE,b.ONE_MINUS_SRC_ALPHA);b.clearColor(j.r,j.g,j.b,k);_cullEnabled=!0})(Fa,La,Ma);this.context=b;this.lights={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[]}};this.setSize=function(f,j){W.width=f;W.height=j;b.viewport(0,0,W.width,W.height)};this.setClearColorHex=function(f,j){var k=new THREE.Color(f);
|
|
|
+b.clearColor(k.r,k.g,k.b,j)};this.setClearColor=function(f,j){b.clearColor(f.r,f.g,f.b,j)};this.clear=function(){b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT)};this.initMaterial=function(f,j,k){var g,i;if(f instanceof THREE.MeshDepthMaterial)d(f,THREE.ShaderLib.depth);else if(f instanceof THREE.MeshNormalMaterial)d(f,THREE.ShaderLib.normal);else if(f instanceof THREE.MeshBasicMaterial)d(f,THREE.ShaderLib.basic);else if(f instanceof THREE.MeshLambertMaterial)d(f,THREE.ShaderLib.lambert);else if(f instanceof
|
|
|
+THREE.MeshPhongMaterial)d(f,THREE.ShaderLib.phong);else if(f instanceof THREE.LineBasicMaterial)d(f,THREE.ShaderLib.basic);else f instanceof THREE.ParticleBasicMaterial&&d(f,THREE.ShaderLib.particle_basic);var u,o,r,x;i=r=x=0;for(u=j.length;i<u;i++){o=j[i];o instanceof THREE.DirectionalLight&&r++;o instanceof THREE.PointLight&&x++}if(x+r<=4)j=r;else{j=Math.ceil(4*r/(x+r));x=4-j}i={directional:j,point:x};x=f.fragmentShader;j=f.vertexShader;u={fog:k,map:f.map,envMap:f.envMap,lightMap:f.lightMap,vertexColors:f.vertexColors,
|
|
|
+skinning:f.skinning,maxDirLights:i.directional,maxPointLights:i.point};k=b.createProgram();i=["#ifdef GL_ES\nprecision highp float;\n#endif","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.fog?"#define USE_FOG":"",u.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");
|
|
|
+u=[b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0?"#define VERTEX_TEXTURES":"","#define MAX_DIR_LIGHTS "+u.maxDirLights,"#define MAX_POINT_LIGHTS "+u.maxPointLights,u.map?"#define USE_MAP":"",u.envMap?"#define USE_ENVMAP":"",u.lightMap?"#define USE_LIGHTMAP":"",u.vertexColors?"#define USE_COLOR":"",u.skinning?"#define USE_SKINNING":"","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 vec3 color;\nattribute vec2 uv;\nattribute vec2 uv2;\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n"].join("\n");
|
|
|
b.attachShader(k,X("fragment",i+x));b.attachShader(k,X("vertex",u+j));b.linkProgram(k);b.getProgramParameter(k,b.LINK_STATUS)||alert("Could not initialise shaders\nVALIDATE_STATUS: "+b.getProgramParameter(k,b.VALIDATE_STATUS)+", gl error ["+b.getError()+"]");k.uniforms={};k.attributes={};f.program=k;k=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices"];for(g in f.uniforms)k.push(g);g=f.program;x=0;for(j=k.length;x<
|
|
|
j;x++){i=k[x];g.uniforms[i]=b.getUniformLocation(g,i)}g=f.program;k=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];x=0;for(j=k.length;x<j;x++){i=k[x];g.attributes[i]=b.getAttribLocation(g,i)}g=f.program.attributes;b.enableVertexAttribArray(g.position);g.color>=0&&b.enableVertexAttribArray(g.color);g.normal>=0&&b.enableVertexAttribArray(g.normal);g.tangent>=0&&b.enableVertexAttribArray(g.tangent);if(f.skinning&&g.skinVertexA>=0&&g.skinVertexB>=
|
|
|
0&&g.skinIndex>=0&&g.skinWeight>=0){b.enableVertexAttribArray(g.skinVertexA);b.enableVertexAttribArray(g.skinVertexB);b.enableVertexAttribArray(g.skinIndex);b.enableVertexAttribArray(g.skinWeight)}};this.render=function(f,j,k,g){var i,u,o,r,x,s,v,J,Q=f.lights,N=f.fog;j.matrixAutoUpdate&&j.update();j.matrixWorldInverse.flattenToArray(Ca);j.projectionMatrix.flattenToArray(Aa);ua.multiply(j.projectionMatrix,j.matrixWorldInverse);n(ua);f.update(undefined,!1,j);this.initWebGLObjects(f,j);Z(k,g!==undefined?
|
|
@@ -158,15 +159,15 @@ K.shading==THREE.SmoothShading){I=!0;break}if(I)break}x.__needsSmoothNormals=I;o
|
|
|
new Float32Array(u*3);g.__webGLVertexCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else if(j instanceof THREE.Line){i=j.geometry;if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=b.createBuffer();g.__webGLColorBuffer=b.createBuffer();g=i;u=g.vertices.length;g.__vertexArray=new Float32Array(u*3);g.__colorArray=new Float32Array(u*3);g.__webGLLineCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else if(j instanceof THREE.ParticleSystem){i=j.geometry;
|
|
|
if(!i.__webGLVertexBuffer){g=i;g.__webGLVertexBuffer=b.createBuffer();g.__webGLColorBuffer=b.createBuffer();g=i;u=g.vertices.length;g.__vertexArray=new Float32Array(u*3);g.__colorArray=new Float32Array(u*3);g.__sortArray=[];g.__webGLParticleCount=u;i.__dirtyVertices=!0;i.__dirtyColors=!0}L(k.__webglObjects,i,j)}else THREE.MarchingCubes!==undefined&&j instanceof THREE.MarchingCubes&&k.__webglObjectsImmediate.push({object:j,opaque:{list:[],count:0},transparent:{list:[],count:0}});f.__objectsAdded.splice(0,
|
|
|
1)}for(;f.__objectsRemoved.length;){j=f.__objectsRemoved[0];k=f;i=void 0;g=void 0;for(i=k.__webglObjects.length-1;i>=0;i--){g=k.__webglObjects[i].object;j==g&&k.__webglObjects.splice(i,1)}f.__objectsRemoved.splice(0,1)}j=0;for(k=f.__webglObjects.length;j<k;j++){g=f.__webglObjects[j].object;u=void 0;i=void 0;o=void 0;if(g instanceof THREE.Mesh){i=g.geometry;for(u in i.geometryGroups){o=i.geometryGroups[u];if(i.__dirtyVertices||i.__dirtyElements||i.__dirtyUvs||i.__dirtyNormals||i.__dirtyColors||i.__dirtyTangents){J=
|
|
|
-b.DYNAMIC_DRAW;Q=void 0;x=void 0;var fa=void 0,t=void 0,ca=void 0,ba=void 0,ea=void 0;fa=void 0;var z=void 0,B=void 0,C=void 0,O=void 0;z=void 0;B=void 0;C=void 0;t=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;z=void 0;B=void 0;C=void 0;O=void 0;t=void 0;ba=void 0;ca=void 0;ea=void 0;var ga=G=K=I=N=v=r=s=0,Y=0,p=0,$=o.__vertexArray,Da=o.__uvArray,Ea=o.__uv2Array,na=o.__normalArray,R=o.__tangentArray,
|
|
|
+b.DYNAMIC_DRAW;Q=void 0;x=void 0;var fa=void 0,t=void 0,ca=void 0,ba=void 0,ea=void 0;fa=void 0;var z=void 0,B=void 0,C=void 0,P=void 0;z=void 0;B=void 0;C=void 0;t=void 0;z=void 0;B=void 0;C=void 0;P=void 0;z=void 0;B=void 0;C=void 0;P=void 0;z=void 0;B=void 0;C=void 0;P=void 0;z=void 0;B=void 0;C=void 0;P=void 0;z=void 0;B=void 0;C=void 0;P=void 0;t=void 0;ba=void 0;ca=void 0;ea=void 0;var ga=G=K=I=N=v=r=s=0,Y=0,p=0,$=o.__vertexArray,Da=o.__uvArray,Ea=o.__uv2Array,na=o.__normalArray,R=o.__tangentArray,
|
|
|
aa=o.__colorArray,S=o.__skinVertexAArray,T=o.__skinVertexBArray,U=o.__skinIndexArray,V=o.__skinWeightArray,sa=o.__faceArray,ia=o.__lineArray,Na=o.__needsSmoothNormals,da=g.geometry,Ga=da.__dirtyVertices,Ha=da.__dirtyElements,Ba=da.__dirtyUvs,Ia=da.__dirtyNormals,Ja=da.__dirtyTangents,Ka=da.__dirtyColors,ja=da.vertices,Oa=o.faces,Pa=da.faces,Qa=da.uvs,Ra=da.uvs2,ta=da.colors,xa=da.skinVerticesA,ya=da.skinVerticesB,za=da.skinIndices,va=da.skinWeights;Q=0;for(x=Oa.length;Q<x;Q++){fa=Oa[Q];t=Pa[fa];ea=
|
|
|
Qa[fa];fa=Ra[fa];ca=t.vertexNormals;ba=t.normal;if(t instanceof THREE.Face3){if(Ga){z=ja[t.a].position;B=ja[t.b].position;C=ja[t.c].position;$[r]=z.x;$[r+1]=z.y;$[r+2]=z.z;$[r+3]=B.x;$[r+4]=B.y;$[r+5]=B.z;$[r+6]=C.x;$[r+7]=C.y;$[r+8]=C.z;r+=9}if(va.length){z=va[t.a];B=va[t.b];C=va[t.c];V[p]=z.x;V[p+1]=z.y;V[p+2]=z.z;V[p+3]=z.w;V[p+4]=B.x;V[p+5]=B.y;V[p+6]=B.z;V[p+7]=B.w;V[p+8]=C.x;V[p+9]=C.y;V[p+10]=C.z;V[p+11]=C.w;z=za[t.a];B=za[t.b];C=za[t.c];U[p]=z.x;U[p+1]=z.y;U[p+2]=z.z;U[p+3]=z.w;U[p+4]=B.x;
|
|
|
U[p+5]=B.y;U[p+6]=B.z;U[p+7]=B.w;U[p+8]=C.x;U[p+9]=C.y;U[p+10]=C.z;U[p+11]=C.w;z=xa[t.a];B=xa[t.b];C=xa[t.c];S[p]=z.x;S[p+1]=z.y;S[p+2]=z.z;S[p+3]=1;S[p+4]=B.x;S[p+5]=B.y;S[p+6]=B.z;S[p+7]=1;S[p+8]=C.x;S[p+9]=C.y;S[p+10]=C.z;S[p+11]=1;z=ya[t.a];B=ya[t.b];C=ya[t.c];T[p]=z.x;T[p+1]=z.y;T[p+2]=z.z;T[p+3]=1;T[p+4]=B.x;T[p+5]=B.y;T[p+6]=B.z;T[p+7]=1;T[p+8]=C.x;T[p+9]=C.y;T[p+10]=C.z;T[p+11]=1;p+=12}if(Ka&&ta.length){z=ta[t.a];B=ta[t.b];C=ta[t.c];aa[Y]=z.r;aa[Y+1]=z.g;aa[Y+2]=z.b;aa[Y+3]=B.r;aa[Y+4]=B.g;
|
|
|
aa[Y+5]=B.b;aa[Y+6]=C.r;aa[Y+7]=C.g;aa[Y+8]=C.b;Y+=9}if(Ja&&da.hasTangents){z=ja[t.a].tangent;B=ja[t.b].tangent;C=ja[t.c].tangent;R[G]=z.x;R[G+1]=z.y;R[G+2]=z.z;R[G+3]=z.w;R[G+4]=B.x;R[G+5]=B.y;R[G+6]=B.z;R[G+7]=B.w;R[G+8]=C.x;R[G+9]=C.y;R[G+10]=C.z;R[G+11]=C.w;G+=12}if(Ia)if(ca.length==3&&Na)for(t=0;t<3;t++){ba=ca[t];na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}else for(t=0;t<3;t++){na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}if(Ba&&ea)for(t=0;t<3;t++){ca=ea[t];Da[v]=ca.u;Da[v+1]=ca.v;v+=2}if(Ba&&fa)for(t=
|
|
|
-0;t<3;t++){ea=fa[t];Ea[N]=ea.u;Ea[N+1]=ea.v;N+=2}if(Ha){sa[I]=s;sa[I+1]=s+1;sa[I+2]=s+2;I+=3;ia[ga]=s;ia[ga+1]=s+1;ia[ga+2]=s;ia[ga+3]=s+2;ia[ga+4]=s+1;ia[ga+5]=s+2;ga+=6;s+=3}}else if(t instanceof THREE.Face4){if(Ga){z=ja[t.a].position;B=ja[t.b].position;C=ja[t.c].position;O=ja[t.d].position;$[r]=z.x;$[r+1]=z.y;$[r+2]=z.z;$[r+3]=B.x;$[r+4]=B.y;$[r+5]=B.z;$[r+6]=C.x;$[r+7]=C.y;$[r+8]=C.z;$[r+9]=O.x;$[r+10]=O.y;$[r+11]=O.z;r+=12}if(va.length){z=va[t.a];B=va[t.b];C=va[t.c];O=va[t.d];V[p]=z.x;V[p+1]=
|
|
|
-z.y;V[p+2]=z.z;V[p+3]=z.w;V[p+4]=B.x;V[p+5]=B.y;V[p+6]=B.z;V[p+7]=B.w;V[p+8]=C.x;V[p+9]=C.y;V[p+10]=C.z;V[p+11]=C.w;V[p+12]=O.x;V[p+13]=O.y;V[p+14]=O.z;V[p+15]=O.w;z=za[t.a];B=za[t.b];C=za[t.c];O=za[t.d];U[p]=z.x;U[p+1]=z.y;U[p+2]=z.z;U[p+3]=z.w;U[p+4]=B.x;U[p+5]=B.y;U[p+6]=B.z;U[p+7]=B.w;U[p+8]=C.x;U[p+9]=C.y;U[p+10]=C.z;U[p+11]=C.w;U[p+12]=O.x;U[p+13]=O.y;U[p+14]=O.z;U[p+15]=O.w;z=xa[t.a];B=xa[t.b];C=xa[t.c];O=xa[t.d];S[p]=z.x;S[p+1]=z.y;S[p+2]=z.z;S[p+3]=1;S[p+4]=B.x;S[p+5]=B.y;S[p+6]=B.z;S[p+
|
|
|
-7]=1;S[p+8]=C.x;S[p+9]=C.y;S[p+10]=C.z;S[p+11]=1;S[p+12]=O.x;S[p+13]=O.y;S[p+14]=O.z;S[p+15]=1;z=ya[t.a];B=ya[t.b];C=ya[t.c];O=ya[t.d];T[p]=z.x;T[p+1]=z.y;T[p+2]=z.z;T[p+3]=1;T[p+4]=B.x;T[p+5]=B.y;T[p+6]=B.z;T[p+7]=1;T[p+8]=C.x;T[p+9]=C.y;T[p+10]=C.z;T[p+11]=1;T[p+12]=O.x;T[p+13]=O.y;T[p+14]=O.z;T[p+15]=1;p+=16}if(Ka&&ta.length){z=ta[t.a];B=ta[t.b];C=ta[t.c];O=ta[t.d];aa[Y]=z.r;aa[Y+1]=z.g;aa[Y+2]=z.b;aa[Y+3]=B.r;aa[Y+4]=B.g;aa[Y+5]=B.b;aa[Y+6]=C.r;aa[Y+7]=C.g;aa[Y+8]=C.b;aa[Y+9]=O.r;aa[Y+10]=O.g;
|
|
|
-aa[Y+11]=O.b;Y+=12}if(Ja&&da.hasTangents){z=ja[t.a].tangent;B=ja[t.b].tangent;C=ja[t.c].tangent;t=ja[t.d].tangent;R[G]=z.x;R[G+1]=z.y;R[G+2]=z.z;R[G+3]=z.w;R[G+4]=B.x;R[G+5]=B.y;R[G+6]=B.z;R[G+7]=B.w;R[G+8]=C.x;R[G+9]=C.y;R[G+10]=C.z;R[G+11]=C.w;R[G+12]=t.x;R[G+13]=t.y;R[G+14]=t.z;R[G+15]=t.w;G+=16}if(Ia)if(ca.length==4&&Na)for(t=0;t<4;t++){ba=ca[t];na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}else for(t=0;t<4;t++){na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}if(Ba&&ea)for(t=0;t<4;t++){ca=ea[t];Da[v]=ca.u;
|
|
|
+0;t<3;t++){ea=fa[t];Ea[N]=ea.u;Ea[N+1]=ea.v;N+=2}if(Ha){sa[I]=s;sa[I+1]=s+1;sa[I+2]=s+2;I+=3;ia[ga]=s;ia[ga+1]=s+1;ia[ga+2]=s;ia[ga+3]=s+2;ia[ga+4]=s+1;ia[ga+5]=s+2;ga+=6;s+=3}}else if(t instanceof THREE.Face4){if(Ga){z=ja[t.a].position;B=ja[t.b].position;C=ja[t.c].position;P=ja[t.d].position;$[r]=z.x;$[r+1]=z.y;$[r+2]=z.z;$[r+3]=B.x;$[r+4]=B.y;$[r+5]=B.z;$[r+6]=C.x;$[r+7]=C.y;$[r+8]=C.z;$[r+9]=P.x;$[r+10]=P.y;$[r+11]=P.z;r+=12}if(va.length){z=va[t.a];B=va[t.b];C=va[t.c];P=va[t.d];V[p]=z.x;V[p+1]=
|
|
|
+z.y;V[p+2]=z.z;V[p+3]=z.w;V[p+4]=B.x;V[p+5]=B.y;V[p+6]=B.z;V[p+7]=B.w;V[p+8]=C.x;V[p+9]=C.y;V[p+10]=C.z;V[p+11]=C.w;V[p+12]=P.x;V[p+13]=P.y;V[p+14]=P.z;V[p+15]=P.w;z=za[t.a];B=za[t.b];C=za[t.c];P=za[t.d];U[p]=z.x;U[p+1]=z.y;U[p+2]=z.z;U[p+3]=z.w;U[p+4]=B.x;U[p+5]=B.y;U[p+6]=B.z;U[p+7]=B.w;U[p+8]=C.x;U[p+9]=C.y;U[p+10]=C.z;U[p+11]=C.w;U[p+12]=P.x;U[p+13]=P.y;U[p+14]=P.z;U[p+15]=P.w;z=xa[t.a];B=xa[t.b];C=xa[t.c];P=xa[t.d];S[p]=z.x;S[p+1]=z.y;S[p+2]=z.z;S[p+3]=1;S[p+4]=B.x;S[p+5]=B.y;S[p+6]=B.z;S[p+
|
|
|
+7]=1;S[p+8]=C.x;S[p+9]=C.y;S[p+10]=C.z;S[p+11]=1;S[p+12]=P.x;S[p+13]=P.y;S[p+14]=P.z;S[p+15]=1;z=ya[t.a];B=ya[t.b];C=ya[t.c];P=ya[t.d];T[p]=z.x;T[p+1]=z.y;T[p+2]=z.z;T[p+3]=1;T[p+4]=B.x;T[p+5]=B.y;T[p+6]=B.z;T[p+7]=1;T[p+8]=C.x;T[p+9]=C.y;T[p+10]=C.z;T[p+11]=1;T[p+12]=P.x;T[p+13]=P.y;T[p+14]=P.z;T[p+15]=1;p+=16}if(Ka&&ta.length){z=ta[t.a];B=ta[t.b];C=ta[t.c];P=ta[t.d];aa[Y]=z.r;aa[Y+1]=z.g;aa[Y+2]=z.b;aa[Y+3]=B.r;aa[Y+4]=B.g;aa[Y+5]=B.b;aa[Y+6]=C.r;aa[Y+7]=C.g;aa[Y+8]=C.b;aa[Y+9]=P.r;aa[Y+10]=P.g;
|
|
|
+aa[Y+11]=P.b;Y+=12}if(Ja&&da.hasTangents){z=ja[t.a].tangent;B=ja[t.b].tangent;C=ja[t.c].tangent;t=ja[t.d].tangent;R[G]=z.x;R[G+1]=z.y;R[G+2]=z.z;R[G+3]=z.w;R[G+4]=B.x;R[G+5]=B.y;R[G+6]=B.z;R[G+7]=B.w;R[G+8]=C.x;R[G+9]=C.y;R[G+10]=C.z;R[G+11]=C.w;R[G+12]=t.x;R[G+13]=t.y;R[G+14]=t.z;R[G+15]=t.w;G+=16}if(Ia)if(ca.length==4&&Na)for(t=0;t<4;t++){ba=ca[t];na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}else for(t=0;t<4;t++){na[K]=ba.x;na[K+1]=ba.y;na[K+2]=ba.z;K+=3}if(Ba&&ea)for(t=0;t<4;t++){ca=ea[t];Da[v]=ca.u;
|
|
|
Da[v+1]=ca.v;v+=2}if(Ba&&fa)for(t=0;t<4;t++){ea=fa[t];Ea[N]=ea.u;Ea[N+1]=ea.v;N+=2}if(Ha){sa[I]=s;sa[I+1]=s+1;sa[I+2]=s+2;sa[I+3]=s;sa[I+4]=s+2;sa[I+5]=s+3;I+=6;ia[ga]=s;ia[ga+1]=s+1;ia[ga+2]=s;ia[ga+3]=s+3;ia[ga+4]=s+1;ia[ga+5]=s+2;ia[ga+6]=s+2;ia[ga+7]=s+3;ga+=8;s+=4}}}if(Ga){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLVertexBuffer);b.bufferData(b.ARRAY_BUFFER,$,J)}if(Ka&&ta.length){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLColorBuffer);b.bufferData(b.ARRAY_BUFFER,aa,J)}if(Ia){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLNormalBuffer);
|
|
|
b.bufferData(b.ARRAY_BUFFER,na,J)}if(Ja&&da.hasTangents){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLTangentBuffer);b.bufferData(b.ARRAY_BUFFER,R,J)}if(Ba&&v>0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLUVBuffer);b.bufferData(b.ARRAY_BUFFER,Da,J)}if(Ba&&N>0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLUV2Buffer);b.bufferData(b.ARRAY_BUFFER,Ea,J)}if(Ha){b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,o.__webGLFaceBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,sa,J);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,o.__webGLLineBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,
|
|
|
ia,J)}if(p>0){b.bindBuffer(b.ARRAY_BUFFER,o.__webGLSkinVertexABuffer);b.bufferData(b.ARRAY_BUFFER,S,J);b.bindBuffer(b.ARRAY_BUFFER,o.__webGLSkinVertexBBuffer);b.bufferData(b.ARRAY_BUFFER,T,J);b.bindBuffer(b.ARRAY_BUFFER,o.__webGLSkinIndicesBuffer);b.bufferData(b.ARRAY_BUFFER,U,J);b.bindBuffer(b.ARRAY_BUFFER,o.__webGLSkinWeightsBuffer);b.bufferData(b.ARRAY_BUFFER,V,J)}}}i.__dirtyVertices=!1;i.__dirtyElements=!1;i.__dirtyUvs=!1;i.__dirtyNormals=!1;i.__dirtyTangents=!1;i.__dirtyColors=!1}else if(g instanceof
|