|
@@ -15,11 +15,11 @@ this.y=Math.asin(a.n13);Math.abs(c)>1.0E-5?(this.x=Math.atan2(-a.n23/c,a.n33/c),
|
|
|
THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w!==void 0?a.w:1},clone:function(){return new THREE.Vector4(this.x,this.y,this.z,this.w)},add:function(a,c){this.x=a.x+c.x;this.y=a.y+c.y;this.z=a.z+c.z;this.w=a.w+c.w;return this},addSelf:function(a){this.x+=a.x;this.y+=a.y;this.z+=a.z;this.w+=a.w;return this},sub:function(a,c){this.x=a.x-c.x;this.y=a.y-c.y;this.z=a.z-
|
|
|
c.z;this.w=a.w-c.w;return this},subSelf:function(a){this.x-=a.x;this.y-=a.y;this.z-=a.z;this.w-=a.w;return this},multiplyScalar:function(a){this.x*=a;this.y*=a;this.z*=a;this.w*=a;return this},divideScalar:function(a){a?(this.x/=a,this.y/=a,this.z/=a,this.w/=a):(this.z=this.y=this.x=0,this.w=1);return this},negate:function(){return this.multiplyScalar(-1)},dot:function(a){return this.x*a.x+this.y*a.y+this.z*a.z+this.w*a.w},lengthSq:function(){return this.dot(this)},length:function(){return Math.sqrt(this.lengthSq())},
|
|
|
normalize:function(){return this.divideScalar(this.length())},setLength:function(a){return this.normalize().multiplyScalar(a)},lerpSelf:function(a,c){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;return this}};
|
|
|
-THREE.Ray=function(a,c){function b(a,b,c){p.sub(c,a);t=p.dot(b);if(t<=0)return null;n=q.add(a,m.copy(b).multiplyScalar(t));return o=c.distanceTo(n)}function d(a,b,c,d){p.sub(d,b);q.sub(c,b);m.sub(a,b);s=p.dot(p);u=p.dot(q);r=p.dot(m);y=q.dot(q);v=q.dot(m);G=1/(s*y-u*u);B=(y*r-u*v)*G;H=(s*v-u*r)*G;return B>=0&&H>=0&&B+H<1}this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
|
|
|
+THREE.Ray=function(a,c){function b(a,b,c){p.sub(c,a);t=p.dot(b);if(t<=0)return null;n=q.add(a,m.copy(b).multiplyScalar(t));return o=c.distanceTo(n)}function d(a,b,c,d){p.sub(d,b);q.sub(c,b);m.sub(a,b);s=p.dot(p);u=p.dot(q);r=p.dot(m);z=q.dot(q);E=q.dot(m);G=1/(s*z-u*u);v=(z*r-u*E)*G;w=(s*E-u*r)*G;return v>=0&&w>=0&&v+w<1}this.origin=a||new THREE.Vector3;this.direction=c||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
|
|
|
c,d=[];b=0;for(c=a.length;b<c;b++)Array.prototype.push.apply(d,this.intersectObject(a[b]));d.sort(function(a,b){return a.distance-b.distance});return d};var g=new THREE.Vector3,e=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,c=new THREE.Vector3,i=new THREE.Vector3,l=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(m){for(var n,p=[],q=0,t=m.children.length;q<t;q++)Array.prototype.push.apply(p,this.intersectObject(m.children[q]));if(m instanceof THREE.Particle){q=
|
|
|
b(this.origin,this.direction,m.matrixWorld.getPosition());if(q===null||q>m.scale.x)return[];n={distance:q,point:m.position,face:null,object:m};p.push(n)}else if(m instanceof THREE.Mesh){q=b(this.origin,this.direction,m.matrixWorld.getPosition());if(q===null||q>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return p;var o,s=m.geometry,u=s.vertices,r;m.matrixRotationWorld.extractRotation(m.matrixWorld);q=0;for(t=s.faces.length;q<t;q++)if(n=s.faces[q],a.copy(this.origin),
|
|
|
c.copy(this.direction),r=m.matrixWorld,i=r.multiplyVector3(i.copy(n.centroid)).subSelf(a),o=i.dot(c),!(o<=0)&&(g=r.multiplyVector3(g.copy(u[n.a].position)),e=r.multiplyVector3(e.copy(u[n.b].position)),f=r.multiplyVector3(f.copy(u[n.c].position)),h=n instanceof THREE.Face4?r.multiplyVector3(h.copy(u[n.d].position)):null,l=m.matrixRotationWorld.multiplyVector3(l.copy(n.normal)),o=c.dot(l),m.doubleSided||(m.flipSided?o>0:o<0)))if(o=l.dot(i.sub(g,a))/o,k.add(a,c.multiplyScalar(o)),n instanceof THREE.Face3)d(k,
|
|
|
-g,e,f)&&(n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},p.push(n));else if(n instanceof THREE.Face4&&(d(k,g,e,h)||d(k,e,f,h)))n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},p.push(n)}return p};var p=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3,t,n,o,s,u,r,y,v,G,B,H};
|
|
|
+g,e,f)&&(n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},p.push(n));else if(n instanceof THREE.Face4&&(d(k,g,e,h)||d(k,e,f,h)))n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},p.push(n)}return p};var p=new THREE.Vector3,q=new THREE.Vector3,m=new THREE.Vector3,t,n,o,s,u,r,z,E,G,v,w};
|
|
|
THREE.Rectangle=function(){function a(){e=d-c;f=g-b}var c,b,d,g,e,f,h=!0;this.getX=function(){return c};this.getY=function(){return b};this.getWidth=function(){return e};this.getHeight=function(){return f};this.getLeft=function(){return c};this.getTop=function(){return b};this.getRight=function(){return d};this.getBottom=function(){return g};this.set=function(e,f,k,p){h=!1;c=e;b=f;d=k;g=p;a()};this.addPoint=function(e,f){h?(h=!1,c=e,b=f,d=e,g=f):(c=c<e?c:e,b=b<f?b:f,d=d>e?d:e,g=g>f?g:f);a()};this.add3Points=
|
|
|
function(e,f,k,p,q,m){h?(h=!1,c=e<k?e<q?e:q:k<q?k:q,b=f<p?f<m?f:m:p<m?p:m,d=e>k?e>q?e:q:k>q?k:q,g=f>p?f>m?f:m:p>m?p:m):(c=e<k?e<q?e<c?e:c:q<c?q:c:k<q?k<c?k:c:q<c?q:c,b=f<p?f<m?f<b?f:b:m<b?m:b:p<m?p<b?p:b:m<b?m:b,d=e>k?e>q?e>d?e:d:q>d?q:d:k>q?k>d?k:d:q>d?q:d,g=f>p?f>m?f>g?f:g:m>g?m:g:p>m?p>g?p:g:m>g?m:g);a()};this.addRectangle=function(e){h?(h=!1,c=e.getLeft(),b=e.getTop(),d=e.getRight(),g=e.getBottom()):(c=c<e.getLeft()?c:e.getLeft(),b=b<e.getTop()?b:e.getTop(),d=d>e.getRight()?d:e.getRight(),g=g>
|
|
|
e.getBottom()?g:e.getBottom());a()};this.inflate=function(e){c-=e;b-=e;d+=e;g+=e;a()};this.minSelf=function(e){c=c>e.getLeft()?c:e.getLeft();b=b>e.getTop()?b:e.getTop();d=d<e.getRight()?d:e.getRight();g=g<e.getBottom()?g:e.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(c,a.getLeft())>=0&&Math.min(g,a.getBottom())-Math.max(b,a.getTop())>=0};this.empty=function(){h=!0;g=d=b=c=0;a()};this.isEmpty=function(){return h}};
|
|
@@ -28,16 +28,16 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,c=
|
|
|
THREE.Matrix4=function(a,c,b,d,g,e,f,h,i,l,k,p,q,m,t,n){this.set(a!==void 0?a:1,c||0,b||0,d||0,g||0,e!==void 0?e:1,f||0,h||0,i||0,l||0,k!==void 0?k:1,p||0,q||0,m||0,t||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,c,b,d,g,e,f,h,i,l,k,p,q,m,t,n){this.n11=a;this.n12=c;this.n13=b;this.n14=d;this.n21=g;this.n22=e;this.n23=f;this.n24=h;this.n31=i;this.n32=l;this.n33=k;this.n34=p;this.n41=q;this.n42=m;this.n43=t;this.n44=n;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,b){var d=THREE.Matrix4.__v1,g=THREE.Matrix4.__v2,e=THREE.Matrix4.__v3;e.sub(a,c).normalize();if(e.length()===0)e.z=1;d.cross(b,e).normalize();d.length()===0&&(e.x+=1.0E-4,d.cross(b,e).normalize());g.cross(e,d).normalize();this.n11=d.x;this.n12=g.x;this.n13=e.x;this.n21=d.y;this.n22=g.y;this.n23=e.y;this.n31=d.z;this.n32=g.z;this.n33=e.z;return this},multiply:function(a,c){var b=a.n11,d=a.n12,g=a.n13,e=a.n14,f=a.n21,h=a.n22,i=a.n23,l=a.n24,k=a.n31,p=a.n32,q=a.n33,m=a.n34,t=a.n41,n=a.n42,o=a.n43,
|
|
|
-s=a.n44,u=c.n11,r=c.n12,y=c.n13,v=c.n14,G=c.n21,B=c.n22,H=c.n23,w=c.n24,D=c.n31,A=c.n32,K=c.n33,L=c.n34,S=c.n41,W=c.n42,U=c.n43,X=c.n44;this.n11=b*u+d*G+g*D+e*S;this.n12=b*r+d*B+g*A+e*W;this.n13=b*y+d*H+g*K+e*U;this.n14=b*v+d*w+g*L+e*X;this.n21=f*u+h*G+i*D+l*S;this.n22=f*r+h*B+i*A+l*W;this.n23=f*y+h*H+i*K+l*U;this.n24=f*v+h*w+i*L+l*X;this.n31=k*u+p*G+q*D+m*S;this.n32=k*r+p*B+q*A+m*W;this.n33=k*y+p*H+q*K+m*U;this.n34=k*v+p*w+q*L+m*X;this.n41=t*u+n*G+o*D+s*S;this.n42=t*r+n*B+o*A+s*W;this.n43=t*y+n*
|
|
|
-H+o*K+s*U;this.n44=t*v+n*w+o*L+s*X;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);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 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},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=this.n21*c+this.n22*
|
|
|
-b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();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},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,l=this.n32,k=this.n33,p=this.n34,q=this.n41,m=this.n42,t=this.n43,n=this.n44;return d*f*l*q-b*h*l*q-d*e*k*q+c*h*k*q+b*e*p*q-c*f*p*q-d*f*i*m+b*h*i*m+d*g*k*m-a*h*k*m-b*g*p*m+a*f*p*m+d*e*i*t-c*h*i*t-d*g*l*t+a*h*l*t+c*g*p*t-a*e*p*t-b*e*i*n+c*f*i*n+b*g*l*n-a*f*l*n-c*g*k*n+a*e*k*n},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,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,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 b=Math.cos(c),d=Math.sin(c),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,l=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+b,l*h-d*e,0,i*h-d*f,l*h+d*e,g*h*h+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
|
|
|
+s=a.n44,u=c.n11,r=c.n12,z=c.n13,E=c.n14,G=c.n21,v=c.n22,w=c.n23,C=c.n24,F=c.n31,B=c.n32,L=c.n33,J=c.n34,W=c.n41,X=c.n42,T=c.n43,ea=c.n44;this.n11=b*u+d*G+g*F+e*W;this.n12=b*r+d*v+g*B+e*X;this.n13=b*z+d*w+g*L+e*T;this.n14=b*E+d*C+g*J+e*ea;this.n21=f*u+h*G+i*F+l*W;this.n22=f*r+h*v+i*B+l*X;this.n23=f*z+h*w+i*L+l*T;this.n24=f*E+h*C+i*J+l*ea;this.n31=k*u+p*G+q*F+m*W;this.n32=k*r+p*v+q*B+m*X;this.n33=k*z+p*w+q*L+m*T;this.n34=k*E+p*C+q*J+m*ea;this.n41=t*u+n*G+o*F+s*W;this.n42=t*r+n*v+o*B+s*X;this.n43=t*
|
|
|
+z+n*w+o*L+s*T;this.n44=t*E+n*C+o*J+s*ea;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,c,b){this.multiply(a,c);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 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},multiplyVector3:function(a){var c=a.x,b=a.y,d=a.z,g=1/(this.n41*c+this.n42*b+this.n43*d+this.n44);a.x=(this.n11*c+this.n12*b+this.n13*d+this.n14)*g;a.y=(this.n21*c+this.n22*b+this.n23*d+this.n24)*g;a.z=(this.n31*c+this.n32*b+this.n33*d+this.n34)*g;return a},multiplyVector4:function(a){var c=a.x,b=a.y,d=a.z,g=a.w;a.x=this.n11*c+this.n12*b+this.n13*d+this.n14*g;a.y=this.n21*
|
|
|
+c+this.n22*b+this.n23*d+this.n24*g;a.z=this.n31*c+this.n32*b+this.n33*d+this.n34*g;a.w=this.n41*c+this.n42*b+this.n43*d+this.n44*g;return a},rotateAxis:function(a){var c=a.x,b=a.y,d=a.z;a.x=c*this.n11+b*this.n12+d*this.n13;a.y=c*this.n21+b*this.n22+d*this.n23;a.z=c*this.n31+b*this.n32+d*this.n33;a.normalize();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},determinant:function(){var a=this.n11,c=this.n12,b=this.n13,d=this.n14,g=this.n21,e=this.n22,f=this.n23,h=this.n24,i=this.n31,l=this.n32,k=this.n33,p=this.n34,q=this.n41,m=this.n42,t=this.n43,n=this.n44;return d*f*l*q-b*h*l*q-d*e*k*q+c*h*k*q+b*e*p*q-c*f*p*q-d*f*i*m+b*h*i*m+d*g*k*m-a*h*k*m-b*g*p*m+a*f*p*m+d*e*i*t-c*h*i*t-d*g*l*t+a*h*l*t+c*g*p*t-a*e*p*t-b*e*i*n+c*f*i*n+b*g*l*n-a*f*l*n-c*g*k*n+a*e*k*
|
|
|
+n},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,b){this.set(1,0,0,a,0,1,0,c,0,0,1,b,0,0,0,1);return this},setScale:function(a,c,b){this.set(a,0,0,0,0,c,0,0,0,0,b,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 b=Math.cos(c),d=Math.sin(c),g=1-b,e=a.x,f=a.y,h=a.z,i=g*e,l=g*f;this.set(i*e+b,i*f-d*h,i*h+d*f,0,i*f+d*h,l*f+b,l*h-d*e,0,i*h-d*f,l*h+d*e,g*h*h+b,0,0,0,0,1);return this},setPosition:function(a){this.n14=a.x;this.n24=a.y;this.n34=a.z;return this},getPosition:function(){return THREE.Matrix4.__v1.set(this.n14,this.n24,this.n34)},getColumnX:function(){return THREE.Matrix4.__v1.set(this.n11,this.n21,this.n31)},getColumnY:function(){return THREE.Matrix4.__v1.set(this.n12,
|
|
|
this.n22,this.n32)},getColumnZ:function(){return THREE.Matrix4.__v1.set(this.n13,this.n23,this.n33)},getInverse:function(a){var c=a.n11,b=a.n12,d=a.n13,g=a.n14,e=a.n21,f=a.n22,h=a.n23,i=a.n24,l=a.n31,k=a.n32,p=a.n33,q=a.n34,m=a.n41,t=a.n42,n=a.n43,o=a.n44;this.n11=h*q*t-i*p*t+i*k*n-f*q*n-h*k*o+f*p*o;this.n12=g*p*t-d*q*t-g*k*n+b*q*n+d*k*o-b*p*o;this.n13=d*i*t-g*h*t+g*f*n-b*i*n-d*f*o+b*h*o;this.n14=g*h*k-d*i*k-g*f*p+b*i*p+d*f*q-b*h*q;this.n21=i*p*m-h*q*m-i*l*n+e*q*n+h*l*o-e*p*o;this.n22=d*q*m-g*p*m+
|
|
|
g*l*n-c*q*n-d*l*o+c*p*o;this.n23=g*h*m-d*i*m-g*e*n+c*i*n+d*e*o-c*h*o;this.n24=d*i*l-g*h*l+g*e*p-c*i*p-d*e*q+c*h*q;this.n31=f*q*m-i*k*m+i*l*t-e*q*t-f*l*o+e*k*o;this.n32=g*k*m-b*q*m-g*l*t+c*q*t+b*l*o-c*k*o;this.n33=d*i*m-g*f*m+g*e*t-c*i*t-b*e*o+c*f*o;this.n34=g*f*l-b*i*l-g*e*k+c*i*k+b*e*q-c*f*q;this.n41=h*k*m-f*p*m-h*l*t+e*p*t+f*l*n-e*k*n;this.n42=b*p*m-d*k*m+d*l*t-c*p*t-b*l*n+c*k*n;this.n43=d*f*m-b*h*m-d*e*t+c*h*t+b*e*n-c*f*n;this.n44=b*h*l-d*f*l+d*e*k-c*h*k-b*e*p+c*f*p;this.multiplyScalar(1/a.determinant());
|
|
|
return this},setRotationFromEuler:function(a,c){var b=a.x,d=a.y,g=a.z,e=Math.cos(b),b=Math.sin(b),f=Math.cos(d),d=Math.sin(d),h=Math.cos(g),g=Math.sin(g);switch(c){case "YXZ":var i=f*h,l=f*g,k=d*h,p=d*g;this.n11=i+p*b;this.n12=k*b-l;this.n13=e*d;this.n21=e*g;this.n22=e*h;this.n23=-b;this.n31=l*b-k;this.n32=p+i*b;this.n33=e*f;break;case "ZXY":i=f*h;l=f*g;k=d*h;p=d*g;this.n11=i-p*b;this.n12=-e*g;this.n13=k+l*b;this.n21=l+k*b;this.n22=e*h;this.n23=p-i*b;this.n31=-e*d;this.n32=b;this.n33=e*f;break;case "ZYX":i=
|
|
@@ -56,18 +56,18 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,c){thi
|
|
|
if(c&&(g=g.getChildByName(a,c),g!==void 0))return g}},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},updateMatrixWorld:function(a){this.matrixAutoUpdate&&
|
|
|
this.updateMatrix();if(this.matrixWorldNeedsUpdate||a)this.parent?this.matrixWorld.multiply(this.parent.matrixWorld,this.matrix):this.matrixWorld.copy(this.matrix),this.matrixWorldNeedsUpdate=!1,a=!0;for(var c=0,b=this.children.length;c<b;c++)this.children[c].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
|
THREE.Projector=function(){function a(){var a=f[e]=f[e]||new THREE.RenderableObject;e++;return a}function c(){var a=l[i]=l[i]||new THREE.RenderableVertex;i++;return a}function b(a,b){return b.z-a.z}function d(a,b){var c=0,d=1,e=a.z+a.w,g=b.z+b.w,f=-a.z+a.w,h=-b.z+b.w;return e>=0&&g>=0&&f>=0&&h>=0?!0:e<0&&g<0||f<0&&h<0?!1:(e<0?c=Math.max(c,e/(e-g)):g<0&&(d=Math.min(d,e/(e-g))),f<0?c=Math.max(c,f/(f-h)):h<0&&(d=Math.min(d,f/(f-h))),d<c?!1:(a.lerpSelf(b,c),b.lerpSelf(a,1-d),!0))}var g,e,f=[],h,i,l=[],
|
|
|
-k,p,q=[],m,t=[],n,o,s=[],u,r,y=[],v={objects:[],sprites:[],lights:[],elements:[]},G=new THREE.Vector3,B=new THREE.Vector4,H=new THREE.Matrix4,w=new THREE.Matrix4,D=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],A=new THREE.Vector4,K=new THREE.Vector4;this.computeFrustum=function(a){D[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);D[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);D[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
|
-a.n23,a.n44+a.n24);D[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);D[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);D[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=D[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);H.multiply(b.projectionMatrix,b.matrixWorldInverse);H.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
-H.multiply(b.matrixWorld,b.projectionMatrixInverse);H.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){e=0;v.objects.length=0;v.sprites.length=0;v.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
|
|
|
-e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=D[h].x*d.n14+D[h].y*d.n24+D[h].z*d.n34+D[h].w,c<=e){c=!1;break a}c=!0}c?(H.multiplyVector3(G.copy(b.position)),g=a(),g.object=b,g.z=G.z,v.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(H.multiplyVector3(G.copy(b.position)),g=a(),g.object=b,g.z=G.z,v.sprites.push(g)):b instanceof THREE.Light&&v.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
|
|
|
-v.objects.sort(b);return v};this.projectScene=function(a,e,g){var f=e.near,D=e.far,G,E,I,P,M,j,V,Z,O,aa,Y,ea,Q,ga,na,ja;r=o=m=p=0;v.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);H.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(H);v=this.projectGraph(a,!1);a=0;for(G=v.objects.length;a<G;a++)if(O=v.objects[a].object,aa=O.matrixWorld,
|
|
|
-ea=O.material,i=0,O instanceof THREE.Mesh){Y=O.geometry;Q=O.geometry.materials;P=Y.vertices;ga=Y.faces;na=Y.faceVertexUvs;Y=O.matrixRotationWorld.extractRotation(aa);E=0;for(I=P.length;E<I;E++)h=c(),h.positionWorld.copy(P[E].position),aa.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),H.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<D;P=0;for(E=ga.length;P<E;P++){I=
|
|
|
-ga[P];if(I instanceof THREE.Face3)if(M=l[I.a],j=l[I.b],V=l[I.c],M.visible&&j.visible&&V.visible&&(O.doubleSided||O.flipSided!=(V.positionScreen.x-M.positionScreen.x)*(j.positionScreen.y-M.positionScreen.y)-(V.positionScreen.y-M.positionScreen.y)*(j.positionScreen.x-M.positionScreen.x)<0))Z=q[p]=q[p]||new THREE.RenderableFace3,p++,k=Z,k.v1.copy(M),k.v2.copy(j),k.v3.copy(V);else continue;else if(I instanceof THREE.Face4)if(M=l[I.a],j=l[I.b],V=l[I.c],Z=l[I.d],M.visible&&j.visible&&V.visible&&Z.visible&&
|
|
|
-(O.doubleSided||O.flipSided!=((Z.positionScreen.x-M.positionScreen.x)*(j.positionScreen.y-M.positionScreen.y)-(Z.positionScreen.y-M.positionScreen.y)*(j.positionScreen.x-M.positionScreen.x)<0||(j.positionScreen.x-V.positionScreen.x)*(Z.positionScreen.y-V.positionScreen.y)-(j.positionScreen.y-V.positionScreen.y)*(Z.positionScreen.x-V.positionScreen.x)<0)))ja=t[m]=t[m]||new THREE.RenderableFace4,m++,k=ja,k.v1.copy(M),k.v2.copy(j),k.v3.copy(V),k.v4.copy(Z);else continue;k.normalWorld.copy(I.normal);
|
|
|
-Y.multiplyVector3(k.normalWorld);k.centroidWorld.copy(I.centroid);aa.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);H.multiplyVector3(k.centroidScreen);V=I.vertexNormals;M=0;for(j=V.length;M<j;M++)Z=k.vertexNormalsWorld[M],Z.copy(V[M]),Y.multiplyVector3(Z);M=0;for(j=na.length;M<j;M++)if(ja=na[M][P]){V=0;for(Z=ja.length;V<Z;V++)k.uvs[M][V]=ja[V]}k.material=ea;k.faceMaterial=I.materialIndex!==null?Q[I.materialIndex]:null;k.z=k.centroidScreen.z;v.elements.push(k)}}else if(O instanceof
|
|
|
-THREE.Line){w.multiply(H,aa);P=O.geometry.vertices;M=c();M.positionScreen.copy(P[0].position);w.multiplyVector4(M.positionScreen);E=1;for(I=P.length;E<I;E++)if(M=c(),M.positionScreen.copy(P[E].position),w.multiplyVector4(M.positionScreen),j=l[i-2],A.copy(M.positionScreen),K.copy(j.positionScreen),d(A,K))A.multiplyScalar(1/A.w),K.multiplyScalar(1/K.w),O=s[o]=s[o]||new THREE.RenderableLine,o++,n=O,n.v1.positionScreen.copy(A),n.v2.positionScreen.copy(K),n.z=Math.max(A.z,K.z),n.material=ea,v.elements.push(n)}a=
|
|
|
-0;for(G=v.sprites.length;a<G;a++)if(O=v.sprites[a].object,aa=O.matrixWorld,O instanceof THREE.Particle&&(B.set(aa.n14,aa.n24,aa.n34,1),H.multiplyVector4(B),B.z/=B.w,B.z>0&&B.z<1))f=y[r]=y[r]||new THREE.RenderableParticle,r++,u=f,u.x=B.x/B.w,u.y=B.y/B.w,u.z=B.z,u.rotation=O.rotation.z,u.scale.x=O.scale.x*Math.abs(u.x-(B.x+e.projectionMatrix.n11)/(B.w+e.projectionMatrix.n14)),u.scale.y=O.scale.y*Math.abs(u.y-(B.y+e.projectionMatrix.n22)/(B.w+e.projectionMatrix.n24)),u.material=O.material,v.elements.push(u);
|
|
|
-g&&v.elements.sort(b);return v}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
|
|
|
+k,p,q=[],m,t=[],n,o,s=[],u,r,z=[],E={objects:[],sprites:[],lights:[],elements:[]},G=new THREE.Vector3,v=new THREE.Vector4,w=new THREE.Matrix4,C=new THREE.Matrix4,F=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],B=new THREE.Vector4,L=new THREE.Vector4;this.computeFrustum=function(a){F[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);F[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);F[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
|
+a.n23,a.n44+a.n24);F[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);F[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);F[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(a=0;a<6;a++){var b=F[a];b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}};this.projectVector=function(a,b){b.matrixWorldInverse.getInverse(b.matrixWorld);w.multiply(b.projectionMatrix,b.matrixWorldInverse);w.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
+w.multiply(b.matrixWorld,b.projectionMatrixInverse);w.multiplyVector3(a);return a};this.pickingRay=function(a,b){var c;a.z=-1;c=new THREE.Vector3(a.x,a.y,1);this.unprojectVector(a,b);this.unprojectVector(c,b);c.subSelf(a).normalize();return new THREE.Ray(a,c)};this.projectGraph=function(c,d){e=0;E.objects.length=0;E.sprites.length=0;E.lights.length=0;var f=function(b){if(b.visible!==!1){var c;if(c=b instanceof THREE.Mesh||b instanceof THREE.Line)if(!(c=b.frustumCulled===!1))a:{for(var d=b.matrixWorld,
|
|
|
+e=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=F[h].x*d.n14+F[h].y*d.n24+F[h].z*d.n34+F[h].w,c<=e){c=!1;break a}c=!0}c?(w.multiplyVector3(G.copy(b.position)),g=a(),g.object=b,g.z=G.z,E.objects.push(g)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(w.multiplyVector3(G.copy(b.position)),g=a(),g.object=b,g.z=G.z,E.sprites.push(g)):b instanceof THREE.Light&&E.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(c);d&&
|
|
|
+E.objects.sort(b);return E};this.projectScene=function(a,e,g){var f=e.near,F=e.far,G,x,I,O,M,j,P,ha,V,Q,K,fa,U,ia,pa,na;r=o=m=p=0;E.elements.length=0;e.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(e));a.updateMatrixWorld();e.matrixWorldInverse.getInverse(e.matrixWorld);w.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(w);E=this.projectGraph(a,!1);a=0;for(G=E.objects.length;a<G;a++)if(V=E.objects[a].object,Q=V.matrixWorld,
|
|
|
+fa=V.material,i=0,V instanceof THREE.Mesh){K=V.geometry;U=V.geometry.materials;O=K.vertices;ia=K.faces;pa=K.faceVertexUvs;K=V.matrixRotationWorld.extractRotation(Q);x=0;for(I=O.length;x<I;x++)h=c(),h.positionWorld.copy(O[x].position),Q.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),w.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<F;O=0;for(x=ia.length;O<x;O++){I=
|
|
|
+ia[O];if(I instanceof THREE.Face3)if(M=l[I.a],j=l[I.b],P=l[I.c],M.visible&&j.visible&&P.visible&&(V.doubleSided||V.flipSided!=(P.positionScreen.x-M.positionScreen.x)*(j.positionScreen.y-M.positionScreen.y)-(P.positionScreen.y-M.positionScreen.y)*(j.positionScreen.x-M.positionScreen.x)<0))ha=q[p]=q[p]||new THREE.RenderableFace3,p++,k=ha,k.v1.copy(M),k.v2.copy(j),k.v3.copy(P);else continue;else if(I instanceof THREE.Face4)if(M=l[I.a],j=l[I.b],P=l[I.c],ha=l[I.d],M.visible&&j.visible&&P.visible&&ha.visible&&
|
|
|
+(V.doubleSided||V.flipSided!=((ha.positionScreen.x-M.positionScreen.x)*(j.positionScreen.y-M.positionScreen.y)-(ha.positionScreen.y-M.positionScreen.y)*(j.positionScreen.x-M.positionScreen.x)<0||(j.positionScreen.x-P.positionScreen.x)*(ha.positionScreen.y-P.positionScreen.y)-(j.positionScreen.y-P.positionScreen.y)*(ha.positionScreen.x-P.positionScreen.x)<0)))na=t[m]=t[m]||new THREE.RenderableFace4,m++,k=na,k.v1.copy(M),k.v2.copy(j),k.v3.copy(P),k.v4.copy(ha);else continue;k.normalWorld.copy(I.normal);
|
|
|
+K.multiplyVector3(k.normalWorld);k.centroidWorld.copy(I.centroid);Q.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);w.multiplyVector3(k.centroidScreen);P=I.vertexNormals;M=0;for(j=P.length;M<j;M++)ha=k.vertexNormalsWorld[M],ha.copy(P[M]),K.multiplyVector3(ha);M=0;for(j=pa.length;M<j;M++)if(na=pa[M][O]){P=0;for(ha=na.length;P<ha;P++)k.uvs[M][P]=na[P]}k.material=fa;k.faceMaterial=I.materialIndex!==null?U[I.materialIndex]:null;k.z=k.centroidScreen.z;E.elements.push(k)}}else if(V instanceof
|
|
|
+THREE.Line){C.multiply(w,Q);O=V.geometry.vertices;M=c();M.positionScreen.copy(O[0].position);C.multiplyVector4(M.positionScreen);x=1;for(I=O.length;x<I;x++)if(M=c(),M.positionScreen.copy(O[x].position),C.multiplyVector4(M.positionScreen),j=l[i-2],B.copy(M.positionScreen),L.copy(j.positionScreen),d(B,L))B.multiplyScalar(1/B.w),L.multiplyScalar(1/L.w),V=s[o]=s[o]||new THREE.RenderableLine,o++,n=V,n.v1.positionScreen.copy(B),n.v2.positionScreen.copy(L),n.z=Math.max(B.z,L.z),n.material=fa,E.elements.push(n)}a=
|
|
|
+0;for(G=E.sprites.length;a<G;a++)if(V=E.sprites[a].object,Q=V.matrixWorld,V instanceof THREE.Particle&&(v.set(Q.n14,Q.n24,Q.n34,1),w.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))f=z[r]=z[r]||new THREE.RenderableParticle,r++,u=f,u.x=v.x/v.w,u.y=v.y/v.w,u.z=v.z,u.rotation=V.rotation.z,u.scale.x=V.scale.x*Math.abs(u.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),u.scale.y=V.scale.y*Math.abs(u.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),u.material=V.material,E.elements.push(u);
|
|
|
+g&&E.elements.sort(b);return E}};THREE.Quaternion=function(a,c,b,d){this.set(a||0,c||0,b||0,d!==void 0?d:1)};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,c,b,d){this.x=a;this.y=c;this.z=b;this.w=d;return this},copy:function(a){this.x=a.x;this.y=a.y;this.z=a.z;this.w=a.w;return this},setFromEuler:function(a){var c=Math.PI/360,b=a.x*c,d=a.y*c,g=a.z*c,a=Math.cos(d),d=Math.sin(d),c=Math.cos(-g),g=Math.sin(-g),e=Math.cos(b),b=Math.sin(b),f=a*c,h=d*g;this.w=f*e-h*b;this.x=f*b+h*e;this.y=d*c*e+a*g*b;this.z=a*g*e-d*c*b;return this},setFromAxisAngle:function(a,c){var b=c/2,d=Math.sin(b);
|
|
|
this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(b);return this},setFromRotationMatrix:function(a){var c=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,c+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,c+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,c-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,c-a.n11-a.n22+a.n33))/2;this.x=a.n32-a.n23<0?-Math.abs(this.x):Math.abs(this.x);this.y=a.n13-a.n31<0?-Math.abs(this.y):Math.abs(this.y);this.z=a.n21-a.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 a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);a===0?this.w=this.z=this.y=this.x=0:(a=1/a,this.x*=a,this.y*=a,this.z*=a,this.w*=a);return this},multiplySelf:function(a){var c=
|
|
@@ -83,9 +83,9 @@ c;a++)b=this.faces[a],b.centroid.set(0,0,0),b instanceof THREE.Face3?(b.centroid
|
|
|
b,d,g,e,f,h=new THREE.Vector3,i=new THREE.Vector3;d=0;for(g=this.faces.length;d<g;d++){e=this.faces[d];if(a&&e.vertexNormals.length){h.set(0,0,0);c=0;for(b=e.vertexNormals.length;c<b;c++)h.addSelf(e.vertexNormals[c]);h.divideScalar(3)}else c=this.vertices[e.a],b=this.vertices[e.b],f=this.vertices[e.c],h.sub(f.position,b.position),i.sub(c.position,b.position),h.crossSelf(i);h.isZero()||h.normalize();e.normal.copy(h)}},computeVertexNormals:function(){var a,c,b,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=
|
|
|
Array(this.vertices.length);a=0;for(c=this.vertices.length;a<c;a++)d[a]=new THREE.Vector3;a=0;for(c=this.faces.length;a<c;a++)if(b=this.faces[a],b instanceof THREE.Face3)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(b instanceof THREE.Face4)b.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(c=this.vertices.length;a<c;a++)d[a].set(0,0,0)}a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof
|
|
|
THREE.Face3?(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal)):b instanceof THREE.Face4&&(d[b.a].addSelf(b.normal),d[b.b].addSelf(b.normal),d[b.c].addSelf(b.normal),d[b.d].addSelf(b.normal));a=0;for(c=this.vertices.length;a<c;a++)d[a].normalize();a=0;for(c=this.faces.length;a<c;a++)b=this.faces[a],b instanceof THREE.Face3?(b.vertexNormals[0].copy(d[b.a]),b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c])):b instanceof THREE.Face4&&(b.vertexNormals[0].copy(d[b.a]),
|
|
|
-b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,j){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=f[e];p=f[g];q=f[j];m=i.x-h.x;t=l.x-h.x;n=i.y-h.y;o=l.y-h.y;s=i.z-h.z;u=l.z-h.z;r=p.u-k.u;y=q.u-k.u;v=p.v-k.v;G=q.v-k.v;B=1/(r*G-y*v);A.set((G*m-v*t)*B,(G*n-v*o)*B,(G*s-v*u)*B);K.set((r*t-y*m)*B,(r*o-y*n)*B,(r*u-y*s)*B);w[b].addSelf(A);w[c].addSelf(A);w[d].addSelf(A);D[b].addSelf(K);
|
|
|
-D[c].addSelf(K);D[d].addSelf(K)}var c,b,d,g,e,f,h,i,l,k,p,q,m,t,n,o,s,u,r,y,v,G,B,H,w=[],D=[],A=new THREE.Vector3,K=new THREE.Vector3,L=new THREE.Vector3,S=new THREE.Vector3,W=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)w[c]=new THREE.Vector3,D[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var U=["a","b",
|
|
|
-"c","d"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)W.copy(e.vertexNormals[d]),g=e[U[d]],H=w[g],L.copy(H),L.subSelf(W.multiplyScalar(W.dot(H))).normalize(),S.cross(e.vertexNormals[d],H),g=S.dot(D[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(L.x,L.y,L.z,g)}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,
|
|
|
+b.vertexNormals[1].copy(d[b.b]),b.vertexNormals[2].copy(d[b.c]),b.vertexNormals[3].copy(d[b.d]))},computeTangents:function(){function a(a,b,c,d,e,g,j){h=a.vertices[b].position;i=a.vertices[c].position;l=a.vertices[d].position;k=f[e];p=f[g];q=f[j];m=i.x-h.x;t=l.x-h.x;n=i.y-h.y;o=l.y-h.y;s=i.z-h.z;u=l.z-h.z;r=p.u-k.u;z=q.u-k.u;E=p.v-k.v;G=q.v-k.v;v=1/(r*G-z*E);B.set((G*m-E*t)*v,(G*n-E*o)*v,(G*s-E*u)*v);L.set((r*t-z*m)*v,(r*o-z*n)*v,(r*u-z*s)*v);C[b].addSelf(B);C[c].addSelf(B);C[d].addSelf(B);F[b].addSelf(L);
|
|
|
+F[c].addSelf(L);F[d].addSelf(L)}var c,b,d,g,e,f,h,i,l,k,p,q,m,t,n,o,s,u,r,z,E,G,v,w,C=[],F=[],B=new THREE.Vector3,L=new THREE.Vector3,J=new THREE.Vector3,W=new THREE.Vector3,X=new THREE.Vector3;c=0;for(b=this.vertices.length;c<b;c++)C[c]=new THREE.Vector3,F[c]=new THREE.Vector3;c=0;for(b=this.faces.length;c<b;c++)e=this.faces[c],f=this.faceVertexUvs[0][c],e instanceof THREE.Face3?a(this,e.a,e.b,e.c,0,1,2):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));var T=["a","b",
|
|
|
+"c","d"];c=0;for(b=this.faces.length;c<b;c++){e=this.faces[c];for(d=0;d<e.vertexNormals.length;d++)X.copy(e.vertexNormals[d]),g=e[T[d]],w=C[g],J.copy(w),J.subSelf(X.multiplyScalar(X.dot(w))).normalize(),W.cross(e.vertexNormals[d],w),g=W.dot(F[g]),g=g<0?-1:1,e.vertexTangents[d]=new THREE.Vector4(J.x,J.y,J.z,g)}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,b=this.vertices.length;c<b;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=0,c=0,b=this.vertices.length;c<b;c++)a=Math.max(a,this.vertices[c].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},c=[],b=[],d,g=Math.pow(10,4),e,f;e=0;for(f=this.vertices.length;e<f;e++)d=this.vertices[e].position,d=[Math.round(d.x*g),Math.round(d.y*g),Math.round(d.z*g)].join("_"),a[d]===void 0?(a[d]=e,c.push(this.vertices[e]),
|
|
|
b[e]=c.length-1):b[e]=b[a[d]];e=0;for(f=this.faces.length;e<f;e++)if(a=this.faces[e],a instanceof THREE.Face3)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c];else if(a instanceof THREE.Face4)a.a=b[a.a],a.b=b[a.b],a.c=b[a.c],a.d=b[a.d];this.vertices=c}};THREE.GeometryCount=0;
|
|
@@ -149,45 +149,46 @@ THREE.Scene.prototype.addObject=function(a){if(a instanceof THREE.Light)this.lig
|
|
|
THREE.Scene.prototype.removeObject=function(a){if(a instanceof THREE.Light){var c=this.lights.indexOf(a);c!==-1&&this.lights.splice(c,1)}else a instanceof THREE.Camera||(c=this.objects.indexOf(a),c!==-1&&(this.objects.splice(c,1),this.__objectsRemoved.push(a),c=this.__objectsAdded.indexOf(a),c!==-1&&this.__objectsAdded.splice(c,1)));for(c=0;c<a.children.length;c++)this.removeObject(a.children[c])};
|
|
|
THREE.Fog=function(a,c,b){this.color=new THREE.Color(a);this.near=c!==void 0?c:1;this.far=b!==void 0?b:1E3};THREE.FogExp2=function(a,c){this.color=new THREE.Color(a);this.density=c!==void 0?c:2.5E-4};
|
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,c=new THREE.Projector,b,d,g,e;this.domElement=document.createElement("div");this.setSize=function(a,c){b=a;d=c;g=b/2;e=d/2};this.render=function(b,d){var i,l,k,p,q,m,t,n;a=c.projectScene(b,d);i=0;for(l=a.length;i<l;i++)if(q=a[i],q instanceof THREE.RenderableParticle){t=q.x*g+g;n=q.y*e+e;k=0;for(p=q.material.length;k<p;k++)if(m=q.material[k],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=t+"px",m.style.top=n+"px"}}};
|
|
|
-THREE.CanvasRenderer=function(a){function c(a){if(u!=a)n.globalAlpha=u=a}function b(a){if(r!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}r=a}}function d(a){if(y!=a)n.strokeStyle=y=a}function g(a){if(v!=a)n.fillStyle=v=a}var e=this,f,h,i,l=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
-p,q,m,t,n=k.getContext("2d"),o=new THREE.Color(0),s=0,u=1,r=0,y=null,v=null,G=null,B=null,H=null,w,D,A,K,L=new THREE.RenderableVertex,S=new THREE.RenderableVertex,W,U,X,$,E,I,P,M,j,V,Z,O,aa=new THREE.Color,Y=new THREE.Color,ea=new THREE.Color,Q=new THREE.Color,ga=new THREE.Color,na=[],ja,ma,la,ka,ya,xa,sa,pa,qa,R,z=new THREE.Rectangle,ba=new THREE.Rectangle,F=new THREE.Rectangle,ca=!1,J=new THREE.Color,da=new THREE.Color,T=new THREE.Color,ha=new THREE.Vector3,ta,wa,N,ra,ua,fa,a=16;ta=document.createElement("canvas");
|
|
|
-ta.width=ta.height=2;wa=ta.getContext("2d");wa.fillStyle="rgba(0,0,0,1)";wa.fillRect(0,0,2,2);N=wa.getImageData(0,0,2,2);ra=N.data;ua=document.createElement("canvas");ua.width=ua.height=a;fa=ua.getContext("2d");fa.translate(-a/2,-a/2);fa.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;q=b;m=Math.floor(p/2);t=Math.floor(q/2);k.width=p;k.height=q;z.set(-m,-t,m,t);ba.set(-m,-t,m,t);u=1;r=0;H=
|
|
|
-B=G=v=y=null};this.setClearColor=function(a,b){o.copy(a);s=b;ba.set(-m,-t,m,t)};this.setClearColorHex=function(a,b){o.setHex(a);s=b;ba.set(-m,-t,m,t)};this.clear=function(){n.setTransform(1,0,0,-1,m,t);ba.isEmpty()||(ba.minSelf(z),ba.inflate(2),s<1&&n.clearRect(Math.floor(ba.getX()),Math.floor(ba.getY()),Math.floor(ba.getWidth()),Math.floor(ba.getHeight())),s>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+s+")"),n.fillRect(Math.floor(ba.getX()),
|
|
|
-Math.floor(ba.getY()),Math.floor(ba.getWidth()),Math.floor(ba.getHeight()))),ba.empty())};this.render=function(a,k){function q(a){var b,c,d,e;J.setRGB(0,0,0);da.setRGB(0,0,0);T.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(J.r+=e.r,J.g+=e.g,J.b+=e.b):d instanceof THREE.DirectionalLight?(da.r+=e.r,da.g+=e.g,da.b+=e.b):d instanceof THREE.PointLight&&(T.r+=e.r,T.g+=e.g,T.b+=e.b)}function p(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,
|
|
|
-f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(ha.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function o(a,e,f){c(f.opacity);b(f.blending);var j,h,i,k,l,fa;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,l=k.width>>1,fa=
|
|
|
-k.height>>1,f=e.scale.x*m,i=e.scale.y*t,j=f*l,h=i*fa,F.set(a.x-j,a.y-h,a.x+j,a.y+h),z.intersects(F)&&(n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(f,-i),n.translate(-l,-fa),n.drawImage(k,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*m,h=e.scale.y*t,F.set(a.x-j,a.y-h,a.x+j,a.y+h),z.intersects(F)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(j,h),f.program(n),n.restore()))}function s(a,
|
|
|
-e,g,f){c(f.opacity);b(f.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(f instanceof THREE.LineBasicMaterial){a=f.linewidth;if(G!=a)n.lineWidth=G=a;a=f.linecap;if(B!=a)n.lineCap=B=a;a=f.linejoin;if(H!=a)n.lineJoin=H=a;d(f.color.getContextStyle());n.stroke();F.inflate(f.linewidth*2)}}function Ga(a,d,g,f,j,h,m,l){e.info.render.vertices+=3;e.info.render.faces++;c(l.opacity);b(l.blending);W=a.positionScreen.x;U=a.positionScreen.y;
|
|
|
-X=d.positionScreen.x;$=d.positionScreen.y;E=g.positionScreen.x;I=g.positionScreen.y;r(W,U,X,$,E,I);if(l instanceof THREE.MeshBasicMaterial)if(l.map)l.map.mapping instanceof THREE.UVMapping&&(ka=m.uvs[0],Ha(W,U,X,$,E,I,ka[f].u,ka[f].v,ka[j].u,ka[j].v,ka[h].u,ka[h].v,l.map));else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,ha.copy(m.vertexNormalsWorld[f]),ya=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,xa=-(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+
|
|
|
-0.5,ha.copy(m.vertexNormalsWorld[j]),sa=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,pa=-(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+0.5,ha.copy(m.vertexNormalsWorld[h]),qa=(ha.x*a.n11+ha.y*a.n12+ha.z*a.n13)*0.5+0.5,R=-(ha.x*a.n21+ha.y*a.n22+ha.z*a.n23)*0.5+0.5,Ha(W,U,X,$,E,I,ya,xa,sa,pa,qa,R,l.envMap)}else l.wireframe?za(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):y(l.color);else if(l instanceof THREE.MeshLambertMaterial)l.map&&!l.wireframe&&(l.map.mapping instanceof THREE.UVMapping&&
|
|
|
-(ka=m.uvs[0],Ha(W,U,X,$,E,I,ka[f].u,ka[f].v,ka[j].u,ka[j].v,ka[h].u,ka[h].v,l.map)),b(THREE.SubtractiveBlending)),ca?!l.wireframe&&l.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(Y.r=ea.r=Q.r=J.r,Y.g=ea.g=Q.g=J.g,Y.b=ea.b=Q.b=J.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],Y),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],ea),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],Q),Y.r=Math.max(0,Math.min(l.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(l.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(l.color.b*
|
|
|
-Y.b,1)),ea.r=Math.max(0,Math.min(l.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(l.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(l.color.b*ea.b,1)),Q.r=Math.max(0,Math.min(l.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(l.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(l.color.b*Q.b,1)),ga.r=(ea.r+Q.r)*0.5,ga.g=(ea.g+Q.g)*0.5,ga.b=(ea.b+Q.b)*0.5,la=Da(Y,ea,Q,ga),v(W,U,X,$,E,I,0,0,1,0,0,1,la)):(aa.r=J.r,aa.g=J.g,aa.b=J.b,p(i,m.centroidWorld,m.normalWorld,aa),aa.r=Math.max(0,Math.min(l.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(l.color.g*
|
|
|
-aa.g,1)),aa.b=Math.max(0,Math.min(l.color.b*aa.b,1)),l.wireframe?za(aa,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):y(aa)):l.wireframe?za(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):y(l.color);else if(l instanceof THREE.MeshDepthMaterial)ja=k.near,ma=k.far,Y.r=Y.g=Y.b=1-Ba(a.positionScreen.z,ja,ma),ea.r=ea.g=ea.b=1-Ba(d.positionScreen.z,ja,ma),Q.r=Q.g=Q.b=1-Ba(g.positionScreen.z,ja,ma),ga.r=(ea.r+Q.r)*0.5,ga.g=(ea.g+Q.g)*0.5,ga.b=(ea.b+Q.b)*0.5,la=Da(Y,ea,
|
|
|
-Q,ga),v(W,U,X,$,E,I,0,0,1,0,0,1,la);else if(l instanceof THREE.MeshNormalMaterial)aa.r=Ca(m.normalWorld.x),aa.g=Ca(m.normalWorld.y),aa.b=Ca(m.normalWorld.z),l.wireframe?za(aa,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):y(aa)}function u(a,d,g,f,h,l,m,n,fa){e.info.render.vertices+=4;e.info.render.faces++;c(n.opacity);b(n.blending);if(n.map||n.envMap)Ga(a,d,f,0,1,3,m,n,fa),Ga(h,g,l,1,2,3,m,n,fa);else if(W=a.positionScreen.x,U=a.positionScreen.y,X=d.positionScreen.x,$=d.positionScreen.y,
|
|
|
-E=g.positionScreen.x,I=g.positionScreen.y,P=f.positionScreen.x,M=f.positionScreen.y,j=h.positionScreen.x,V=h.positionScreen.y,Z=l.positionScreen.x,O=l.positionScreen.y,n instanceof THREE.MeshBasicMaterial)Ea(W,U,X,$,E,I,P,M),n.wireframe?za(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):y(n.color);else if(n instanceof THREE.MeshLambertMaterial)ca?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4?(Y.r=ea.r=Q.r=ga.r=J.r,Y.g=ea.g=Q.g=ga.g=J.g,Y.b=ea.b=
|
|
|
-Q.b=ga.b=J.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],Y),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],ea),p(i,m.v4.positionWorld,m.vertexNormalsWorld[3],Q),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ga),Y.r=Math.max(0,Math.min(n.color.r*Y.r,1)),Y.g=Math.max(0,Math.min(n.color.g*Y.g,1)),Y.b=Math.max(0,Math.min(n.color.b*Y.b,1)),ea.r=Math.max(0,Math.min(n.color.r*ea.r,1)),ea.g=Math.max(0,Math.min(n.color.g*ea.g,1)),ea.b=Math.max(0,Math.min(n.color.b*ea.b,1)),Q.r=Math.max(0,Math.min(n.color.r*
|
|
|
-Q.r,1)),Q.g=Math.max(0,Math.min(n.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(n.color.b*Q.b,1)),ga.r=Math.max(0,Math.min(n.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(n.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(n.color.b*ga.b,1)),la=Da(Y,ea,Q,ga),r(W,U,X,$,P,M),v(W,U,X,$,P,M,0,0,1,0,0,1,la),r(j,V,E,I,Z,O),v(j,V,E,I,Z,O,1,0,1,1,0,1,la)):(aa.r=J.r,aa.g=J.g,aa.b=J.b,p(i,m.centroidWorld,m.normalWorld,aa),aa.r=Math.max(0,Math.min(n.color.r*aa.r,1)),aa.g=Math.max(0,Math.min(n.color.g*aa.g,1)),aa.b=Math.max(0,
|
|
|
-Math.min(n.color.b*aa.b,1)),Ea(W,U,X,$,E,I,P,M),n.wireframe?za(aa,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):y(aa)):(Ea(W,U,X,$,E,I,P,M),n.wireframe?za(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):y(n.color));else if(n instanceof THREE.MeshNormalMaterial)aa.r=Ca(m.normalWorld.x),aa.g=Ca(m.normalWorld.y),aa.b=Ca(m.normalWorld.z),Ea(W,U,X,$,E,I,P,M),n.wireframe?za(aa,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):y(aa);else if(n instanceof THREE.MeshDepthMaterial)ja=
|
|
|
-k.near,ma=k.far,Y.r=Y.g=Y.b=1-Ba(a.positionScreen.z,ja,ma),ea.r=ea.g=ea.b=1-Ba(d.positionScreen.z,ja,ma),Q.r=Q.g=Q.b=1-Ba(f.positionScreen.z,ja,ma),ga.r=ga.g=ga.b=1-Ba(g.positionScreen.z,ja,ma),la=Da(Y,ea,Q,ga),r(W,U,X,$,P,M),v(W,U,X,$,P,M,0,0,1,0,0,1,la),r(j,V,E,I,Z,O),v(j,V,E,I,Z,O,1,0,1,1,0,1,la)}function r(a,b,c,d,e,g){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(a,b);n.closePath()}function Ea(a,b,c,d,e,g,f,j){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(f,
|
|
|
-j);n.lineTo(a,b);n.closePath()}function za(a,b,c,e){if(G!=b)n.lineWidth=G=b;if(B!=c)n.lineCap=B=c;if(H!=e)n.lineJoin=H=e;d(a.getContextStyle());n.stroke();F.inflate(b*2)}function y(a){g(a.getContextStyle());n.fill()}function Ha(a,b,c,d,e,f,j,h,i,m,l,k,fa){if(fa.image.width!=0){if(fa.needsUpdate==!0||na[fa.id]==void 0){var p=fa.wrapS==THREE.RepeatWrapping,q=fa.wrapT==THREE.RepeatWrapping;na[fa.id]=n.createPattern(fa.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");fa.needsUpdate=
|
|
|
-!1}g(na[fa.id]);var p=fa.offset.x/fa.repeat.x,q=fa.offset.y/fa.repeat.y,R=(fa.image.width-1)*fa.repeat.x,fa=(fa.image.height-1)*fa.repeat.y,j=(j+p)*R,h=(h+q)*fa,i=(i+p)*R,m=(m+q)*fa,l=(l+p)*R,k=(k+q)*fa;c-=a;d-=b;e-=a;f-=b;i-=j;m-=h;l-=j;k-=h;p=1/(i*k-l*m);fa=(k*c-m*e)*p;m=(k*d-m*f)*p;c=(i*e-l*c)*p;d=(i*f-l*d)*p;a=a-fa*j-c*h;b=b-m*j-d*h;n.save();n.transform(fa,m,c,d,a,b);n.fill();n.restore()}}function v(a,b,c,d,e,f,g,j,h,i,m,l,k){var fa,p;fa=k.width-1;p=k.height-1;g*=fa;j*=p;h*=fa;i*=p;m*=fa;l*=p;
|
|
|
-c-=a;d-=b;e-=a;f-=b;h-=g;i-=j;m-=g;l-=j;p=1/(h*l-m*i);fa=(l*c-i*e)*p;i=(l*d-i*f)*p;c=(h*e-m*c)*p;d=(h*f-m*d)*p;a=a-fa*g-c*j;b=b-i*g-d*j;n.save();n.transform(fa,i,c,d,a,b);n.clip();n.drawImage(k,0,0);n.restore()}function Da(a,b,c,d){var e=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),f=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ra[0]=e<0?0:e>255?255:e;ra[1]=g<0?0:g>255?255:g;ra[2]=a<0?0:a>255?255:a;ra[4]=f<0?0:f>255?255:f;ra[5]=
|
|
|
-j<0?0:j>255?255:j;ra[6]=b<0?0:b>255?255:b;ra[8]=h<0?0:h>255?255:h;ra[9]=i<0?0:i>255?255:i;ra[10]=c<0?0:c>255?255:c;ra[12]=m<0?0:m>255?255:m;ra[13]=l<0?0:l>255?255:l;ra[14]=d<0?0:d>255?255:d;wa.putImageData(N,0,0);fa.drawImage(ta,0,0);return ua}function Ba(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ca(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Aa(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Fa,Ia,oa,va;this.autoClear?this.clear():
|
|
|
-n.setTransform(1,0,0,-1,m,t);e.info.render.vertices=0;e.info.render.faces=0;f=l.projectScene(a,k,this.sortElements);h=f.elements;i=f.lights;(ca=i.length>0)&&q(i);Fa=0;for(Ia=h.length;Fa<Ia;Fa++)if(oa=h[Fa],va=oa.material,va=va instanceof THREE.MeshFaceMaterial?oa.faceMaterial:va,!(va==null||va.opacity==0)){F.empty();if(oa instanceof THREE.RenderableParticle)w=oa,w.x*=m,w.y*=t,o(w,oa,va,a);else if(oa instanceof THREE.RenderableLine)w=oa.v1,D=oa.v2,w.positionScreen.x*=m,w.positionScreen.y*=t,D.positionScreen.x*=
|
|
|
-m,D.positionScreen.y*=t,F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(D.positionScreen.x,D.positionScreen.y),z.intersects(F)&&s(w,D,oa,va,a);else if(oa instanceof THREE.RenderableFace3)w=oa.v1,D=oa.v2,A=oa.v3,w.positionScreen.x*=m,w.positionScreen.y*=t,D.positionScreen.x*=m,D.positionScreen.y*=t,A.positionScreen.x*=m,A.positionScreen.y*=t,va.overdraw&&(Aa(w.positionScreen,D.positionScreen),Aa(D.positionScreen,A.positionScreen),Aa(A.positionScreen,w.positionScreen)),F.add3Points(w.positionScreen.x,
|
|
|
-w.positionScreen.y,D.positionScreen.x,D.positionScreen.y,A.positionScreen.x,A.positionScreen.y),z.intersects(F)&&Ga(w,D,A,0,1,2,oa,va,a);else if(oa instanceof THREE.RenderableFace4)w=oa.v1,D=oa.v2,A=oa.v3,K=oa.v4,w.positionScreen.x*=m,w.positionScreen.y*=t,D.positionScreen.x*=m,D.positionScreen.y*=t,A.positionScreen.x*=m,A.positionScreen.y*=t,K.positionScreen.x*=m,K.positionScreen.y*=t,L.positionScreen.copy(D.positionScreen),S.positionScreen.copy(K.positionScreen),va.overdraw&&(Aa(w.positionScreen,
|
|
|
-D.positionScreen),Aa(D.positionScreen,K.positionScreen),Aa(K.positionScreen,w.positionScreen),Aa(A.positionScreen,L.positionScreen),Aa(A.positionScreen,S.positionScreen)),F.addPoint(w.positionScreen.x,w.positionScreen.y),F.addPoint(D.positionScreen.x,D.positionScreen.y),F.addPoint(A.positionScreen.x,A.positionScreen.y),F.addPoint(K.positionScreen.x,K.positionScreen.y),z.intersects(F)&&u(w,D,A,K,L,S,oa,va,a);ba.addRectangle(F)}n.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(w.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function c(a){D[a]==null&&(D[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"path"),W==0&&D[a].setAttribute("shape-rendering","crispEdges"));return D[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,p,q,m,t,n,o,s=new THREE.Rectangle,u=new THREE.Rectangle,r=!1,y=new THREE.Color,v=new THREE.Color,G=new THREE.Color,B=new THREE.Color,H,w=new THREE.Vector3,D=[],A=[],K,L,S,W=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
-faces:0}};this.setQuality=function(a){switch(a){case "high":W=1;break;case "low":W=0}};this.setSize=function(a,b){l=a;k=b;p=l/2;q=k/2;i.setAttribute("viewBox",-p+" "+-q+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);s.set(-p,-q,p,q)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(l,k){var D,E,I,P;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(l,k,this.sortElements);e=g.elements;
|
|
|
-f=g.lights;S=L=0;if(r=f.length>0){v.setRGB(0,0,0);G.setRGB(0,0,0);B.setRGB(0,0,0);D=0;for(E=f.length;D<E;D++)P=f[D],I=P.color,P instanceof THREE.AmbientLight?(v.r+=I.r,v.g+=I.g,v.b+=I.b):P instanceof THREE.DirectionalLight?(G.r+=I.r,G.g+=I.g,G.b+=I.b):P instanceof THREE.PointLight&&(B.r+=I.r,B.g+=I.g,B.b+=I.b)}D=0;for(E=e.length;D<E;D++)if(I=e[D],P=I.material,P=P instanceof THREE.MeshFaceMaterial?I.faceMaterial:P,!(P==null||P.opacity==0))if(u.empty(),I instanceof THREE.RenderableParticle)m=I,m.x*=
|
|
|
-p,m.y*=-q;else if(I instanceof THREE.RenderableLine){if(m=I.v1,t=I.v2,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),s.intersects(u)){I=m;var M=t,j=S++;A[j]==null&&(A[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),W==0&&A[j].setAttribute("shape-rendering","crispEdges"));K=A[j];K.setAttribute("x1",I.positionScreen.x);K.setAttribute("y1",I.positionScreen.y);
|
|
|
-K.setAttribute("x2",M.positionScreen.x);K.setAttribute("y2",M.positionScreen.y);P instanceof THREE.LineBasicMaterial&&(K.setAttribute("style","fill: none; stroke: "+P.color.getContextStyle()+"; stroke-width: "+P.linewidth+"; stroke-opacity: "+P.opacity+"; stroke-linecap: "+P.linecap+"; stroke-linejoin: "+P.linejoin),i.appendChild(K))}}else if(I instanceof THREE.RenderableFace3){if(m=I.v1,t=I.v2,n=I.v3,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,n.positionScreen.x*=
|
|
|
-p,n.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(u)){var M=m,j=t,w=n;d.info.render.vertices+=3;d.info.render.faces++;K=c(L++);K.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+w.positionScreen.x+","+w.positionScreen.y+"z");P instanceof THREE.MeshBasicMaterial?y.copy(P.color):P instanceof THREE.MeshLambertMaterial?
|
|
|
-r?(y.r=v.r,y.g=v.g,y.b=v.b,a(f,I.centroidWorld,I.normalWorld,y),y.r=Math.max(0,Math.min(P.color.r*y.r,1)),y.g=Math.max(0,Math.min(P.color.g*y.g,1)),y.b=Math.max(0,Math.min(P.color.b*y.b,1))):y.copy(P.color):P instanceof THREE.MeshDepthMaterial?(H=1-P.__2near/(P.__farPlusNear-I.z*P.__farMinusNear),y.setRGB(H,H,H)):P instanceof THREE.MeshNormalMaterial&&y.setRGB(b(I.normalWorld.x),b(I.normalWorld.y),b(I.normalWorld.z));P.wireframe?K.setAttribute("style","fill: none; stroke: "+y.getContextStyle()+"; stroke-width: "+
|
|
|
-P.wireframeLinewidth+"; stroke-opacity: "+P.opacity+"; stroke-linecap: "+P.wireframeLinecap+"; stroke-linejoin: "+P.wireframeLinejoin):K.setAttribute("style","fill: "+y.getContextStyle()+"; fill-opacity: "+P.opacity);i.appendChild(K)}}else if(I instanceof THREE.RenderableFace4&&(m=I.v1,t=I.v2,n=I.v3,o=I.v4,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,n.positionScreen.x*=p,n.positionScreen.y*=-q,o.positionScreen.x*=p,o.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,
|
|
|
-m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),u.addPoint(o.positionScreen.x,o.positionScreen.y),s.intersects(u))){var M=m,j=t,w=n,Z=o;d.info.render.vertices+=4;d.info.render.faces++;K=c(L++);K.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+w.positionScreen.x+","+w.positionScreen.y+" L "+Z.positionScreen.x+","+Z.positionScreen.y+"z");P instanceof THREE.MeshBasicMaterial?
|
|
|
-y.copy(P.color):P instanceof THREE.MeshLambertMaterial?r?(y.r=v.r,y.g=v.g,y.b=v.b,a(f,I.centroidWorld,I.normalWorld,y),y.r=Math.max(0,Math.min(P.color.r*y.r,1)),y.g=Math.max(0,Math.min(P.color.g*y.g,1)),y.b=Math.max(0,Math.min(P.color.b*y.b,1))):y.copy(P.color):P instanceof THREE.MeshDepthMaterial?(H=1-P.__2near/(P.__farPlusNear-I.z*P.__farMinusNear),y.setRGB(H,H,H)):P instanceof THREE.MeshNormalMaterial&&y.setRGB(b(I.normalWorld.x),b(I.normalWorld.y),b(I.normalWorld.z));P.wireframe?K.setAttribute("style",
|
|
|
-"fill: none; stroke: "+y.getContextStyle()+"; stroke-width: "+P.wireframeLinewidth+"; stroke-opacity: "+P.opacity+"; stroke-linecap: "+P.wireframeLinecap+"; stroke-linejoin: "+P.wireframeLinejoin):K.setAttribute("style","fill: "+y.getContextStyle()+"; fill-opacity: "+P.opacity);i.appendChild(K)}}};
|
|
|
+THREE.CanvasRenderer=function(a){function c(a){if(u!=a)n.globalAlpha=u=a}function b(a){if(r!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}r=a}}function d(a){if(z!=a)n.strokeStyle=z=a}function g(a){if(E!=a)n.fillStyle=E=a}var e=this,f,h,i,l=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
+p,q,m,t,n=k.getContext("2d"),o=new THREE.Color(0),s=0,u=1,r=0,z=null,E=null,G=null,v=null,w=null,C,F,B,L,J=new THREE.RenderableVertex,W=new THREE.RenderableVertex,X,T,ea,ba,x,I,O,M,j,P,ha,V,Q=new THREE.Color,K=new THREE.Color,fa=new THREE.Color,U=new THREE.Color,ia=new THREE.Color,pa=[],na=[],ka,oa,la,ma,ya,ra,sa,xa,R,A,Z=new THREE.Rectangle,H=new THREE.Rectangle,$=new THREE.Rectangle,ca=!1,aa=new THREE.Color,S=new THREE.Color,ga=new THREE.Color,Y=new THREE.Vector3,va,N,ua,ta,da,Fa,a=16;va=document.createElement("canvas");
|
|
|
+va.width=va.height=2;N=va.getContext("2d");N.fillStyle="rgba(0,0,0,1)";N.fillRect(0,0,2,2);ua=N.getImageData(0,0,2,2);ta=ua.data;da=document.createElement("canvas");da.width=da.height=a;Fa=da.getContext("2d");Fa.translate(-a/2,-a/2);Fa.scale(a,a);a--;this.domElement=k;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,faces:0}};this.setSize=function(a,b){p=a;q=b;m=Math.floor(p/2);t=Math.floor(q/2);k.width=p;k.height=q;Z.set(-m,-t,m,t);H.set(-m,-t,m,t);u=1;r=0;w=v=G=
|
|
|
+E=z=null};this.setClearColor=function(a,b){o.copy(a);s=b;H.set(-m,-t,m,t)};this.setClearColorHex=function(a,b){o.setHex(a);s=b;H.set(-m,-t,m,t)};this.clear=function(){n.setTransform(1,0,0,-1,m,t);H.isEmpty()||(H.minSelf(Z),H.inflate(2),s<1&&n.clearRect(Math.floor(H.getX()),Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight())),s>0&&(b(THREE.NormalBlending),c(1),g("rgba("+Math.floor(o.r*255)+","+Math.floor(o.g*255)+","+Math.floor(o.b*255)+","+s+")"),n.fillRect(Math.floor(H.getX()),
|
|
|
+Math.floor(H.getY()),Math.floor(H.getWidth()),Math.floor(H.getHeight()))),H.empty())};this.render=function(a,k){function q(a){var b,c,d,e;aa.setRGB(0,0,0);S.setRGB(0,0,0);ga.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(aa.r+=e.r,aa.g+=e.g,aa.b+=e.b):d instanceof THREE.DirectionalLight?(S.r+=e.r,S.g+=e.g,S.b+=e.b):d instanceof THREE.PointLight&&(ga.r+=e.r,ga.g+=e.g,ga.b+=e.b)}function p(a,b,c,d){var e,g,f,j,h,i;e=0;for(g=a.length;e<g;e++)f=a[e],j=f.color,
|
|
|
+f instanceof THREE.DirectionalLight?(h=f.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):f instanceof THREE.PointLight&&(h=f.matrixWorld.getPosition(),i=c.dot(Y.sub(h,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(h)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function o(a,e,f){c(f.opacity);b(f.blending);var j,h,i,k,l,da;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,l=k.width>>1,da=k.height>>
|
|
|
+1,f=e.scale.x*m,i=e.scale.y*t,j=f*l,h=i*da,$.set(a.x-j,a.y-h,a.x+j,a.y+h),Z.intersects($)&&(n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(f,-i),n.translate(-l,-da),n.drawImage(k,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(j=e.scale.x*m,h=e.scale.y*t,$.set(a.x-j,a.y-h,a.x+j,a.y+h),Z.intersects($)&&(d(f.color.getContextStyle()),g(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-e.rotation),n.scale(j,h),f.program(n),n.restore()))}function s(a,e,
|
|
|
+f,g){c(g.opacity);b(g.blending);n.beginPath();n.moveTo(a.positionScreen.x,a.positionScreen.y);n.lineTo(e.positionScreen.x,e.positionScreen.y);n.closePath();if(g instanceof THREE.LineBasicMaterial){a=g.linewidth;if(G!=a)n.lineWidth=G=a;a=g.linecap;if(v!=a)n.lineCap=v=a;a=g.linejoin;if(w!=a)n.lineJoin=w=a;d(g.color.getContextStyle());n.stroke();$.inflate(g.linewidth*2)}}function u(a,d,g,f,j,h,m,l){e.info.render.vertices+=3;e.info.render.faces++;c(l.opacity);b(l.blending);X=a.positionScreen.x;T=a.positionScreen.y;
|
|
|
+ea=d.positionScreen.x;ba=d.positionScreen.y;x=g.positionScreen.x;I=g.positionScreen.y;Ea(X,T,ea,ba,x,I);if(l instanceof THREE.MeshBasicMaterial)if(l.map)l.map.mapping instanceof THREE.UVMapping&&(ma=m.uvs[0],E(X,T,ea,ba,x,I,ma[f].u,ma[f].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,l.map));else if(l.envMap){if(l.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,Y.copy(m.vertexNormalsWorld[f]),ya=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,ra=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,
|
|
|
+Y.copy(m.vertexNormalsWorld[j]),sa=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,xa=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,Y.copy(m.vertexNormalsWorld[h]),R=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,A=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,E(X,T,ea,ba,x,I,ya,ra,sa,xa,R,A,l.envMap)}else l.wireframe?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color);else if(l instanceof THREE.MeshLambertMaterial)l.map&&!l.wireframe&&(l.map.mapping instanceof THREE.UVMapping&&(ma=m.uvs[0],
|
|
|
+E(X,T,ea,ba,x,I,ma[f].u,ma[f].v,ma[j].u,ma[j].v,ma[h].u,ma[h].v,l.map)),b(THREE.SubtractiveBlending)),ca?!l.wireframe&&l.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(K.r=fa.r=U.r=aa.r,K.g=fa.g=U.g=aa.g,K.b=fa.b=U.b=aa.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],K),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],fa),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],U),K.r=Math.max(0,Math.min(l.color.r*K.r,1)),K.g=Math.max(0,Math.min(l.color.g*K.g,1)),K.b=Math.max(0,Math.min(l.color.b*
|
|
|
+K.b,1)),fa.r=Math.max(0,Math.min(l.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(l.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(l.color.b*fa.b,1)),U.r=Math.max(0,Math.min(l.color.r*U.r,1)),U.g=Math.max(0,Math.min(l.color.g*U.g,1)),U.b=Math.max(0,Math.min(l.color.b*U.b,1)),ia.r=(fa.r+U.r)*0.5,ia.g=(fa.g+U.g)*0.5,ia.b=(fa.b+U.b)*0.5,la=Ga(K,fa,U,ia),Ca(X,T,ea,ba,x,I,0,0,1,0,0,1,la)):(Q.r=aa.r,Q.g=aa.g,Q.b=aa.b,p(i,m.centroidWorld,m.normalWorld,Q),Q.r=Math.max(0,Math.min(l.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(l.color.g*
|
|
|
+Q.g,1)),Q.b=Math.max(0,Math.min(l.color.b*Q.b,1)),l.wireframe?z(Q,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(Q)):l.wireframe?z(l.color,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(l.color);else if(l instanceof THREE.MeshDepthMaterial)ka=k.near,oa=k.far,K.r=K.g=K.b=1-Ba(a.positionScreen.z,ka,oa),fa.r=fa.g=fa.b=1-Ba(d.positionScreen.z,ka,oa),U.r=U.g=U.b=1-Ba(g.positionScreen.z,ka,oa),ia.r=(fa.r+U.r)*0.5,ia.g=(fa.g+U.g)*0.5,ia.b=(fa.b+U.b)*0.5,la=Ga(K,fa,U,ia),
|
|
|
+Ca(X,T,ea,ba,x,I,0,0,1,0,0,1,la);else if(l instanceof THREE.MeshNormalMaterial)Q.r=Da(m.normalWorld.x),Q.g=Da(m.normalWorld.y),Q.b=Da(m.normalWorld.z),l.wireframe?z(Q,l.wireframeLinewidth,l.wireframeLinecap,l.wireframeLinejoin):za(Q)}function r(a,d,g,f,h,l,m,n,da){e.info.render.vertices+=4;e.info.render.faces++;c(n.opacity);b(n.blending);if(n.map||n.envMap)u(a,d,f,0,1,3,m,n,da),u(h,g,l,1,2,3,m,n,da);else if(X=a.positionScreen.x,T=a.positionScreen.y,ea=d.positionScreen.x,ba=d.positionScreen.y,x=g.positionScreen.x,
|
|
|
+I=g.positionScreen.y,O=f.positionScreen.x,M=f.positionScreen.y,j=h.positionScreen.x,P=h.positionScreen.y,ha=l.positionScreen.x,V=l.positionScreen.y,n instanceof THREE.MeshBasicMaterial)Ha(X,T,ea,ba,x,I,O,M),n.wireframe?z(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(n.color);else if(n instanceof THREE.MeshLambertMaterial)ca?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4?(K.r=fa.r=U.r=ia.r=aa.r,K.g=fa.g=U.g=ia.g=aa.g,K.b=fa.b=U.b=ia.b=aa.b,p(i,
|
|
|
+m.v1.positionWorld,m.vertexNormalsWorld[0],K),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],fa),p(i,m.v4.positionWorld,m.vertexNormalsWorld[3],U),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ia),K.r=Math.max(0,Math.min(n.color.r*K.r,1)),K.g=Math.max(0,Math.min(n.color.g*K.g,1)),K.b=Math.max(0,Math.min(n.color.b*K.b,1)),fa.r=Math.max(0,Math.min(n.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(n.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(n.color.b*fa.b,1)),U.r=Math.max(0,Math.min(n.color.r*U.r,1)),U.g=
|
|
|
+Math.max(0,Math.min(n.color.g*U.g,1)),U.b=Math.max(0,Math.min(n.color.b*U.b,1)),ia.r=Math.max(0,Math.min(n.color.r*ia.r,1)),ia.g=Math.max(0,Math.min(n.color.g*ia.g,1)),ia.b=Math.max(0,Math.min(n.color.b*ia.b,1)),la=Ga(K,fa,U,ia),Ea(X,T,ea,ba,O,M),Ca(X,T,ea,ba,O,M,0,0,1,0,0,1,la),Ea(j,P,x,I,ha,V),Ca(j,P,x,I,ha,V,1,0,1,1,0,1,la)):(Q.r=aa.r,Q.g=aa.g,Q.b=aa.b,p(i,m.centroidWorld,m.normalWorld,Q),Q.r=Math.max(0,Math.min(n.color.r*Q.r,1)),Q.g=Math.max(0,Math.min(n.color.g*Q.g,1)),Q.b=Math.max(0,Math.min(n.color.b*
|
|
|
+Q.b,1)),Ha(X,T,ea,ba,x,I,O,M),n.wireframe?z(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(Q)):(Ha(X,T,ea,ba,x,I,O,M),n.wireframe?z(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(n.color));else if(n instanceof THREE.MeshNormalMaterial)Q.r=Da(m.normalWorld.x),Q.g=Da(m.normalWorld.y),Q.b=Da(m.normalWorld.z),Ha(X,T,ea,ba,x,I,O,M),n.wireframe?z(Q,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):za(Q);else if(n instanceof THREE.MeshDepthMaterial)ka=
|
|
|
+k.near,oa=k.far,K.r=K.g=K.b=1-Ba(a.positionScreen.z,ka,oa),fa.r=fa.g=fa.b=1-Ba(d.positionScreen.z,ka,oa),U.r=U.g=U.b=1-Ba(f.positionScreen.z,ka,oa),ia.r=ia.g=ia.b=1-Ba(g.positionScreen.z,ka,oa),la=Ga(K,fa,U,ia),Ea(X,T,ea,ba,O,M),Ca(X,T,ea,ba,O,M,0,0,1,0,0,1,la),Ea(j,P,x,I,ha,V),Ca(j,P,x,I,ha,V,1,0,1,1,0,1,la)}function Ea(a,b,c,d,e,g){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(a,b);n.closePath()}function Ha(a,b,c,d,e,g,f,j){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,
|
|
|
+g);n.lineTo(f,j);n.lineTo(a,b);n.closePath()}function z(a,b,c,e){if(G!=b)n.lineWidth=G=b;if(v!=c)n.lineCap=v=c;if(w!=e)n.lineJoin=w=e;d(a.getContextStyle());n.stroke();$.inflate(b*2)}function za(a){g(a.getContextStyle());n.fill()}function E(a,b,c,d,e,f,j,h,i,m,l,k,da){if(da.image.width!=0){if(da.needsUpdate==!0||pa[da.id]==void 0){var p=da.wrapS==THREE.RepeatWrapping,q=da.wrapT==THREE.RepeatWrapping;pa[da.id]=n.createPattern(da.image,p&&q?"repeat":p&&!q?"repeat-x":!p&&q?"repeat-y":"no-repeat");da.needsUpdate=
|
|
|
+!1}g(pa[da.id]);var p=da.offset.x/da.repeat.x,q=da.offset.y/da.repeat.y,R=da.image.width*da.repeat.x,t=da.image.height*da.repeat.y,j=(j+p)*R,h=(h+q)*t,i=(i+p)*R,m=(m+q)*t,l=(l+p)*R,k=(k+q)*t;c-=a;d-=b;e-=a;f-=b;i-=j;m-=h;l-=j;k-=h;p=i*k-l*m;if(p==0){if(na[da.id]==void 0)b=document.createElement("canvas"),b.width=da.image.width,b.height=da.image.height,a=b.getContext("2d"),a.drawImage(da.image,0,0),na[da.id]=a.getImageData(0,0,da.image.width,da.image.height).data,delete b;b=na[da.id];j=(Math.floor(j)+
|
|
|
+Math.floor(h)*da.image.width)*4;Q.setRGB(b[j]/255,b[j+1]/255,b[j+2]/255);za(Q)}else p=1/p,da=(k*c-m*e)*p,m=(k*d-m*f)*p,c=(i*e-l*c)*p,d=(i*f-l*d)*p,a=a-da*j-c*h,j=b-m*j-d*h,n.save(),n.transform(da,m,c,d,a,j),n.fill(),n.restore()}}function Ca(a,b,c,d,e,g,f,j,h,i,m,l,k){var da,p;da=k.width-1;p=k.height-1;f*=da;j*=p;h*=da;i*=p;m*=da;l*=p;c-=a;d-=b;e-=a;g-=b;h-=f;i-=j;m-=f;l-=j;p=1/(h*l-m*i);da=(l*c-i*e)*p;i=(l*d-i*g)*p;c=(h*e-m*c)*p;d=(h*g-m*d)*p;a=a-da*f-c*j;b=b-i*f-d*j;n.save();n.transform(da,i,c,d,
|
|
|
+a,b);n.clip();n.drawImage(k,0,0);n.restore()}function Ga(a,b,c,d){var e=~~(a.r*255),f=~~(a.g*255),a=~~(a.b*255),g=~~(b.r*255),j=~~(b.g*255),b=~~(b.b*255),h=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),m=~~(d.r*255),l=~~(d.g*255),d=~~(d.b*255);ta[0]=e<0?0:e>255?255:e;ta[1]=f<0?0:f>255?255:f;ta[2]=a<0?0:a>255?255:a;ta[4]=g<0?0:g>255?255:g;ta[5]=j<0?0:j>255?255:j;ta[6]=b<0?0:b>255?255:b;ta[8]=h<0?0:h>255?255:h;ta[9]=i<0?0:i>255?255:i;ta[10]=c<0?0:c>255?255:c;ta[12]=m<0?0:m>255?255:m;ta[13]=l<0?0:l>255?255:
|
|
|
+l;ta[14]=d<0?0:d>255?255:d;N.putImageData(ua,0,0);Fa.drawImage(va,0,0);return da}function Ba(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Da(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Aa(a,b){var c=b.x-a.x,d=b.y-a.y,e=c*c+d*d;e!=0&&(e=1/Math.sqrt(e),c*=e,d*=e,b.x+=c,b.y+=d,a.x-=c,a.y-=d)}var Ia,Ja,qa,wa;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,t);e.info.render.vertices=0;e.info.render.faces=0;f=l.projectScene(a,k,this.sortElements);h=f.elements;i=f.lights;(ca=i.length>0)&&q(i);
|
|
|
+Ia=0;for(Ja=h.length;Ia<Ja;Ia++)if(qa=h[Ia],wa=qa.material,wa=wa instanceof THREE.MeshFaceMaterial?qa.faceMaterial:wa,!(wa==null||wa.opacity==0)){$.empty();if(qa instanceof THREE.RenderableParticle)C=qa,C.x*=m,C.y*=t,o(C,qa,wa,a);else if(qa instanceof THREE.RenderableLine)C=qa.v1,F=qa.v2,C.positionScreen.x*=m,C.positionScreen.y*=t,F.positionScreen.x*=m,F.positionScreen.y*=t,$.addPoint(C.positionScreen.x,C.positionScreen.y),$.addPoint(F.positionScreen.x,F.positionScreen.y),Z.intersects($)&&s(C,F,qa,
|
|
|
+wa,a);else if(qa instanceof THREE.RenderableFace3)C=qa.v1,F=qa.v2,B=qa.v3,C.positionScreen.x*=m,C.positionScreen.y*=t,F.positionScreen.x*=m,F.positionScreen.y*=t,B.positionScreen.x*=m,B.positionScreen.y*=t,wa.overdraw&&(Aa(C.positionScreen,F.positionScreen),Aa(F.positionScreen,B.positionScreen),Aa(B.positionScreen,C.positionScreen)),$.add3Points(C.positionScreen.x,C.positionScreen.y,F.positionScreen.x,F.positionScreen.y,B.positionScreen.x,B.positionScreen.y),Z.intersects($)&&u(C,F,B,0,1,2,qa,wa,a);
|
|
|
+else if(qa instanceof THREE.RenderableFace4)C=qa.v1,F=qa.v2,B=qa.v3,L=qa.v4,C.positionScreen.x*=m,C.positionScreen.y*=t,F.positionScreen.x*=m,F.positionScreen.y*=t,B.positionScreen.x*=m,B.positionScreen.y*=t,L.positionScreen.x*=m,L.positionScreen.y*=t,J.positionScreen.copy(F.positionScreen),W.positionScreen.copy(L.positionScreen),wa.overdraw&&(Aa(C.positionScreen,F.positionScreen),Aa(F.positionScreen,L.positionScreen),Aa(L.positionScreen,C.positionScreen),Aa(B.positionScreen,J.positionScreen),Aa(B.positionScreen,
|
|
|
+W.positionScreen)),$.addPoint(C.positionScreen.x,C.positionScreen.y),$.addPoint(F.positionScreen.x,F.positionScreen.y),$.addPoint(B.positionScreen.x,B.positionScreen.y),$.addPoint(L.positionScreen.x,L.positionScreen.y),Z.intersects($)&&r(C,F,B,L,J,W,qa,wa,a);H.addRectangle($)}n.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,f,g,j,h,i;e=0;for(f=a.length;e<f;e++)g=a[e],j=g.color,g instanceof THREE.DirectionalLight?(h=g.matrixWorld.getPosition(),i=c.dot(h),i<=0||(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)):g instanceof THREE.PointLight&&(h=g.matrixWorld.getPosition(),i=c.dot(C.sub(h,b).normalize()),i<=0||(i*=g.distance==0?1:1-Math.min(b.distanceTo(h)/g.distance,1),i!=0&&(i*=g.intensity,d.r+=j.r*i,d.g+=j.g*i,d.b+=j.b*i)))}function c(a){F[a]==null&&(F[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"path"),X==0&&F[a].setAttribute("shape-rendering","crispEdges"));return F[a]}function b(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,g,e,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),l,k,p,q,m,t,n,o,s=new THREE.Rectangle,u=new THREE.Rectangle,r=!1,z=new THREE.Color,E=new THREE.Color,G=new THREE.Color,v=new THREE.Color,w,C=new THREE.Vector3,F=[],B=[],L,J,W,X=1;this.domElement=i;this.sortElements=this.sortObjects=this.autoClear=!0;this.info={render:{vertices:0,
|
|
|
+faces:0}};this.setQuality=function(a){switch(a){case "high":X=1;break;case "low":X=0}};this.setSize=function(a,b){l=a;k=b;p=l/2;q=k/2;i.setAttribute("viewBox",-p+" "+-q+" "+l+" "+k);i.setAttribute("width",l);i.setAttribute("height",k);s.set(-p,-q,p,q)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(l,k){var F,x,I,O;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;g=h.projectScene(l,k,this.sortElements);e=g.elements;
|
|
|
+f=g.lights;W=J=0;if(r=f.length>0){E.setRGB(0,0,0);G.setRGB(0,0,0);v.setRGB(0,0,0);F=0;for(x=f.length;F<x;F++)O=f[F],I=O.color,O instanceof THREE.AmbientLight?(E.r+=I.r,E.g+=I.g,E.b+=I.b):O instanceof THREE.DirectionalLight?(G.r+=I.r,G.g+=I.g,G.b+=I.b):O instanceof THREE.PointLight&&(v.r+=I.r,v.g+=I.g,v.b+=I.b)}F=0;for(x=e.length;F<x;F++)if(I=e[F],O=I.material,O=O instanceof THREE.MeshFaceMaterial?I.faceMaterial:O,!(O==null||O.opacity==0))if(u.empty(),I instanceof THREE.RenderableParticle)m=I,m.x*=
|
|
|
+p,m.y*=-q;else if(I instanceof THREE.RenderableLine){if(m=I.v1,t=I.v2,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),s.intersects(u)){I=m;var M=t,j=W++;B[j]==null&&(B[j]=document.createElementNS("http://www.w3.org/2000/svg","line"),X==0&&B[j].setAttribute("shape-rendering","crispEdges"));L=B[j];L.setAttribute("x1",I.positionScreen.x);L.setAttribute("y1",I.positionScreen.y);
|
|
|
+L.setAttribute("x2",M.positionScreen.x);L.setAttribute("y2",M.positionScreen.y);O instanceof THREE.LineBasicMaterial&&(L.setAttribute("style","fill: none; stroke: "+O.color.getContextStyle()+"; stroke-width: "+O.linewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.linecap+"; stroke-linejoin: "+O.linejoin),i.appendChild(L))}}else if(I instanceof THREE.RenderableFace3){if(m=I.v1,t=I.v2,n=I.v3,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,n.positionScreen.x*=
|
|
|
+p,n.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),s.intersects(u)){var M=m,j=t,C=n;d.info.render.vertices+=3;d.info.render.faces++;L=c(J++);L.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+C.positionScreen.x+","+C.positionScreen.y+"z");O instanceof THREE.MeshBasicMaterial?z.copy(O.color):O instanceof THREE.MeshLambertMaterial?
|
|
|
+r?(z.r=E.r,z.g=E.g,z.b=E.b,a(f,I.centroidWorld,I.normalWorld,z),z.r=Math.max(0,Math.min(O.color.r*z.r,1)),z.g=Math.max(0,Math.min(O.color.g*z.g,1)),z.b=Math.max(0,Math.min(O.color.b*z.b,1))):z.copy(O.color):O instanceof THREE.MeshDepthMaterial?(w=1-O.__2near/(O.__farPlusNear-I.z*O.__farMinusNear),z.setRGB(w,w,w)):O instanceof THREE.MeshNormalMaterial&&z.setRGB(b(I.normalWorld.x),b(I.normalWorld.y),b(I.normalWorld.z));O.wireframe?L.setAttribute("style","fill: none; stroke: "+z.getContextStyle()+"; stroke-width: "+
|
|
|
+O.wireframeLinewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.wireframeLinecap+"; stroke-linejoin: "+O.wireframeLinejoin):L.setAttribute("style","fill: "+z.getContextStyle()+"; fill-opacity: "+O.opacity);i.appendChild(L)}}else if(I instanceof THREE.RenderableFace4&&(m=I.v1,t=I.v2,n=I.v3,o=I.v4,m.positionScreen.x*=p,m.positionScreen.y*=-q,t.positionScreen.x*=p,t.positionScreen.y*=-q,n.positionScreen.x*=p,n.positionScreen.y*=-q,o.positionScreen.x*=p,o.positionScreen.y*=-q,u.addPoint(m.positionScreen.x,
|
|
|
+m.positionScreen.y),u.addPoint(t.positionScreen.x,t.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),u.addPoint(o.positionScreen.x,o.positionScreen.y),s.intersects(u))){var M=m,j=t,C=n,ha=o;d.info.render.vertices+=4;d.info.render.faces++;L=c(J++);L.setAttribute("d","M "+M.positionScreen.x+" "+M.positionScreen.y+" L "+j.positionScreen.x+" "+j.positionScreen.y+" L "+C.positionScreen.x+","+C.positionScreen.y+" L "+ha.positionScreen.x+","+ha.positionScreen.y+"z");O instanceof THREE.MeshBasicMaterial?
|
|
|
+z.copy(O.color):O instanceof THREE.MeshLambertMaterial?r?(z.r=E.r,z.g=E.g,z.b=E.b,a(f,I.centroidWorld,I.normalWorld,z),z.r=Math.max(0,Math.min(O.color.r*z.r,1)),z.g=Math.max(0,Math.min(O.color.g*z.g,1)),z.b=Math.max(0,Math.min(O.color.b*z.b,1))):z.copy(O.color):O instanceof THREE.MeshDepthMaterial?(w=1-O.__2near/(O.__farPlusNear-I.z*O.__farMinusNear),z.setRGB(w,w,w)):O instanceof THREE.MeshNormalMaterial&&z.setRGB(b(I.normalWorld.x),b(I.normalWorld.y),b(I.normalWorld.z));O.wireframe?L.setAttribute("style",
|
|
|
+"fill: none; stroke: "+z.getContextStyle()+"; stroke-width: "+O.wireframeLinewidth+"; stroke-opacity: "+O.opacity+"; stroke-linecap: "+O.wireframeLinecap+"; stroke-linejoin: "+O.wireframeLinejoin):L.setAttribute("style","fill: "+z.getContextStyle()+"; fill-opacity: "+O.opacity);i.appendChild(L)}}};
|
|
|
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 ) );\n#ifdef GAMMA_INPUT\ncubeColor.xyz *= cubeColor.xyz;\n#endif\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\n#ifdef GAMMA_INPUT\nvec4 texelColor = texture2D( map, vUv );\ntexelColor.xyz *= texelColor.xyz;\ngl_FragColor = gl_FragColor * texelColor;\n#else\ngl_FragColor = gl_FragColor * texture2D( map, vUv );\n#endif\n#endif",
|
|
@@ -221,123 +222,123 @@ THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.lights_phong_fragment,THR
|
|
|
THREE.ShaderChunk.shadowmap_pars_vertex,"void main() {",THREE.ShaderChunk.color_vertex,"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n#ifdef USE_SIZEATTENUATION\ngl_PointSize = size * ( scale / length( mvPosition.xyz ) );\n#else\ngl_PointSize = size;\n#endif\ngl_Position = projectionMatrix * mvPosition;",THREE.ShaderChunk.shadowmap_vertex,"}"].join("\n"),fragmentShader:["uniform vec3 psColor;\nuniform float opacity;",THREE.ShaderChunk.color_pars_fragment,THREE.ShaderChunk.map_particle_pars_fragment,
|
|
|
THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"void main() {\ngl_FragColor = vec4( psColor, opacity );",THREE.ShaderChunk.map_particle_fragment,THREE.ShaderChunk.alphatest_fragment,THREE.ShaderChunk.color_fragment,THREE.ShaderChunk.shadowmap_fragment,THREE.ShaderChunk.fog_fragment,"}"].join("\n")},depthRGBA:{uniforms:{},vertexShader:[THREE.ShaderChunk.morphtarget_pars_vertex,"void main() {\nvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",THREE.ShaderChunk.morphtarget_vertex,
|
|
|
THREE.ShaderChunk.default_vertex,"}"].join("\n"),fragmentShader:"vec4 pack_depth( const in float depth ) {\nconst vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );\nconst vec4 bit_mask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bit_shift );\nres -= res.xxyz * bit_mask;\nreturn res;\n}\nvoid main() {\ngl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );\n}"}};
|
|
|
-THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var f=d.attributes[e];if(!f.__webglInitialized||f.createUniqueBuffers){f.__webglInitialized=!0;var g=1;f.type==="v2"?g=2:f.type==="v3"?g=3:f.type==="v4"?g=4:f.type==="c"&&(g=3);f.size=g;f.array=new Float32Array(c*g);f.buffer=j.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
|
|
|
-function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,m=i.length,l=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,p=a.__dirtyVertices,q=a.__dirtyColors,R=a.__webglCustomAttributesList;if(c.sortParticles){ba.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,J.copy(e),ba.multiplyVector3(J),n[d]=[J.z,d];n.sort(function(a,
|
|
|
-b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[n[d][1]].position,f=d*3,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;for(d=0;d<m;d++)f=d*3,e=i[n[d][1]],k[f]=e.r,k[f+1]=e.g,k[f+2]=e.b;if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.boundTo===void 0||h.boundTo==="vertices")if(f=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)g=n[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=n[d][1],g=h.value[g],
|
|
|
-h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=n[d][1],g=h.value[g],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,f+=4}}else{if(p)for(d=0;d<g;d++)e=h[d].position,f=d*3,l[f]=e.x,l[f+1]=e.y,l[f+2]=e.z;if(q)for(d=0;d<m;d++)e=i[d],f=d*3,k[f]=e.r,k[f+1]=e.g,k[f+2]=e.b;if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.needsUpdate&&(h.boundTo===void 0||
|
|
|
-h.boundTo==="vertices"))if(e=h.value.length,f=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,f+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.r,h.array[f+1]=g.g,h.array[f+2]=g.b,f+=3;else for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,f+=3;else if(h.size===4)for(d=0;d<e;d++)g=h.value[d],h.array[f]=g.x,h.array[f+1]=g.y,h.array[f+2]=g.z,h.array[f+3]=g.w,
|
|
|
-f+=4}}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(q||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
|
|
|
-a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,m,l,k,n,p=a.count*3;for(n=0;n<p;n+=9)c=a.normalArray,d=c[n],e=c[n+1],f=c[n+2],g=c[n+3],i=c[n+4],l=c[n+5],h=c[n+6],m=c[n+7],k=c[n+8],d=(d+g+h)/3,e=(e+i+m)/3,f=
|
|
|
-(f+l+k)/3,c[n]=d,c[n+1]=e,c[n+2]=f,c[n+3]=d,c[n+4]=e,c[n+5]=f,c[n+6]=d,c[n+7]=e,c[n+8]=f}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=o(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==Y&&(Y=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
-e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&
|
|
|
-g<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],m=-1,l=0;h=f.morphTargetInfluences;var n,k=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(n=0;n<k;n++)!i[n]&&h[n]>m&&(l=n,m=h[l]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+g],3,j.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=
|
|
|
-m;i[l]=1;m=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=0;for(h=e.__webglCustomAttributesList.length;g<h;g++)c=e.__webglCustomAttributesList[g],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
|
|
|
+THREE.WebGLRenderer=function(a){function c(a,b){var c=a.vertices.length,d=b.material;if(d.attributes){if(a.__webglCustomAttributesList===void 0)a.__webglCustomAttributesList=[];for(var e in d.attributes){var g=d.attributes[e];if(!g.__webglInitialized||g.createUniqueBuffers){g.__webglInitialized=!0;var f=1;g.type==="v2"?f=2:g.type==="v3"?f=3:g.type==="v4"?f=4:g.type==="c"&&(f=3);g.size=f;g.array=new Float32Array(c*f);g.buffer=j.createBuffer();g.buffer.belongsToAttribute=e;g.needsUpdate=!0}a.__webglCustomAttributesList.push(g)}}}
|
|
|
+function b(a,b){if(a.material&&!(a.material instanceof THREE.MeshFaceMaterial))return a.material;else if(b.materialIndex>=0)return a.geometry.materials[b.materialIndex]}function d(a,b,c){var d,e,g,f,h=a.vertices;f=h.length;var i=a.colors,m=i.length,l=a.__vertexArray,k=a.__colorArray,n=a.__sortArray,p=a.__dirtyVertices,q=a.__dirtyColors,R=a.__webglCustomAttributesList;if(c.sortParticles){Z.multiplySelf(c.matrixWorld);for(d=0;d<f;d++)e=h[d].position,ca.copy(e),Z.multiplyVector3(ca),n[d]=[ca.z,d];n.sort(function(a,
|
|
|
+b){return b[0]-a[0]});for(d=0;d<f;d++)e=h[n[d][1]].position,g=d*3,l[g]=e.x,l[g+1]=e.y,l[g+2]=e.z;for(d=0;d<m;d++)g=d*3,e=i[n[d][1]],k[g]=e.r,k[g+1]=e.g,k[g+2]=e.b;if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.boundTo===void 0||h.boundTo==="vertices")if(g=0,e=h.value.length,h.size===1)for(d=0;d<e;d++)f=n[d][1],h.array[d]=h.value[f];else if(h.size===2)for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=n[d][1],f=h.value[f],
|
|
|
+h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=n[d][1],f=h.value[f],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,g+=4}}else{if(p)for(d=0;d<f;d++)e=h[d].position,g=d*3,l[g]=e.x,l[g+1]=e.y,l[g+2]=e.z;if(q)for(d=0;d<m;d++)e=i[d],g=d*3,k[g]=e.r,k[g+1]=e.g,k[g+2]=e.b;if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.needsUpdate&&(h.boundTo===void 0||
|
|
|
+h.boundTo==="vertices"))if(e=h.value.length,g=0,h.size===1)for(d=0;d<e;d++)h.array[d]=h.value[d];else if(h.size===2)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,g+=2;else if(h.size===3)if(h.type==="c")for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.r,h.array[g+1]=f.g,h.array[g+2]=f.b,g+=3;else for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,g+=3;else if(h.size===4)for(d=0;d<e;d++)f=h.value[d],h.array[g]=f.x,h.array[g+1]=f.y,h.array[g+2]=f.z,h.array[g+3]=f.w,
|
|
|
+g+=4}}if(p||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,l,b);if(q||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,a.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,k,b);if(R){i=0;for(m=R.length;i<m;i++)if(h=R[i],h.needsUpdate||c.sortParticles)j.bindBuffer(j.ARRAY_BUFFER,h.buffer),j.bufferData(j.ARRAY_BUFFER,h.array,b)}}function g(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=j.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=j.createBuffer();
|
|
|
+a.hasPos&&(j.bindBuffer(j.ARRAY_BUFFER,a.__webglVertexBuffer),j.bufferData(j.ARRAY_BUFFER,a.positionArray,j.DYNAMIC_DRAW),j.enableVertexAttribArray(b.attributes.position),j.vertexAttribPointer(b.attributes.position,3,j.FLOAT,!1,0,0));if(a.hasNormal){j.bindBuffer(j.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,g,f,h,i,m,l,k,n,p=a.count*3;for(n=0;n<p;n+=9)c=a.normalArray,d=c[n],e=c[n+1],g=c[n+2],f=c[n+3],i=c[n+4],l=c[n+5],h=c[n+6],m=c[n+7],k=c[n+8],d=(d+f+h)/3,e=(e+i+m)/3,g=
|
|
|
+(g+l+k)/3,c[n]=d,c[n+1]=e,c[n+2]=g,c[n+3]=d,c[n+4]=e,c[n+5]=g,c[n+6]=d,c[n+7]=e,c[n+8]=g}j.bufferData(j.ARRAY_BUFFER,a.normalArray,j.DYNAMIC_DRAW);j.enableVertexAttribArray(b.attributes.normal);j.vertexAttribPointer(b.attributes.normal,3,j.FLOAT,!1,0,0)}j.drawArrays(j.TRIANGLES,0,a.count);a.count=0}function e(a,b,c,d,e,g){if(d.opacity!==0){var f,h,c=o(a,b,c,d,g),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==K&&(K=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+e.__webglVertexBuffer),j.vertexAttribPointer(b.position,3,j.FLOAT,!1,0,0));else if(g.morphTargetBase){c=d.program.attributes;g.morphTargetBase!==-1?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[g.morphTargetBase]),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0)):c.position>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglVertexBuffer),j.vertexAttribPointer(c.position,3,j.FLOAT,!1,0,0));if(g.morphTargetForcedOrder.length){f=0;var i=g.morphTargetForcedOrder;for(h=g.morphTargetInfluences;f<d.numSupportedMorphTargets&&
|
|
|
+f<i.length;)j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[f]]),j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0),g.__webglMorphTargetInfluences[f]=h[i[f]],f++}else{var i=[],m=-1,l=0;h=g.morphTargetInfluences;var n,k=h.length;f=0;for(g.morphTargetBase!==-1&&(i[g.morphTargetBase]=!0);f<d.numSupportedMorphTargets;){for(n=0;n<k;n++)!i[n]&&h[n]>m&&(l=n,m=h[l]);j.bindBuffer(j.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[l]);j.vertexAttribPointer(c["morphTarget"+f],3,j.FLOAT,!1,0,0);g.__webglMorphTargetInfluences[f]=
|
|
|
+m;i[l]=1;m=-1;f++}}d.program.uniforms.morphTargetInfluences!==null&&j.uniform1fv(d.program.uniforms.morphTargetInfluences,g.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){f=0;for(h=e.__webglCustomAttributesList.length;f<h;f++)c=e.__webglCustomAttributesList[f],b[c.buffer.belongsToAttribute]>=0&&(j.bindBuffer(j.ARRAY_BUFFER,c.buffer),j.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,j.FLOAT,!1,0,0))}b.color>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglColorBuffer),j.vertexAttribPointer(b.color,
|
|
|
3,j.FLOAT,!1,0,0));b.normal>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglNormalBuffer),j.vertexAttribPointer(b.normal,3,j.FLOAT,!1,0,0));b.tangent>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglTangentBuffer),j.vertexAttribPointer(b.tangent,4,j.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUVBuffer),j.vertexAttribPointer(b.uv,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv)):j.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(j.bindBuffer(j.ARRAY_BUFFER,e.__webglUV2Buffer),
|
|
|
j.vertexAttribPointer(b.uv2,2,j.FLOAT,!1,0,0),j.enableVertexAttribArray(b.uv2)):j.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=0&&b.skinIndex>=0&&b.skinWeight>=0&&(j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexABuffer),j.vertexAttribPointer(b.skinVertexA,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),j.vertexAttribPointer(b.skinVertexB,4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),j.vertexAttribPointer(b.skinIndex,
|
|
|
-4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==xa&&(j.lineWidth(d),xa=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=
|
|
|
-e.__webglFaceCount,M.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==xa&&(j.lineWidth(d),xa=d),j.drawArrays(f,0,e.__webglLineCount),M.info.render.calls++):f instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),M.info.render.calls++):f instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),M.info.render.calls++)}}function f(a){z[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
|
|
|
-a.n13,a.n44-a.n14);z[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);z[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);z[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);z[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);z[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=z[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
|
|
|
-a.scale.z)),d=0;d<6;d++)if(a=z[d].x*b.n14+z[d].y*b.n24+z[d].z*b.n34+z[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function l(a){var b,c,d,i,m,l,n,k,p=0,q=a.lights;T||(T=new THREE.PerspectiveCamera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));b=0;for(c=q.length;b<c;b++)if(k=q[b],k.castShadow&&k instanceof THREE.SpotLight){aa=-1;M.shadowMap[p]||(M.shadowMap[p]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,
|
|
|
-magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ha[p]=new THREE.Matrix4);d=M.shadowMap[p];i=ha[p];T.position.copy(k.position);T.lookAt(k.target.position);T.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(T));this.autoUpdateScene&&a.updateMatrixWorld();T.matrixWorldInverse.getInverse(T.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(T.projectionMatrix);i.multiplySelf(T.matrixWorldInverse);T.matrixWorldInverse.flattenToArray(ca);T.projectionMatrix.flattenToArray(F);
|
|
|
-ba.multiply(T.projectionMatrix,T.matrixWorldInverse);f(ba);A(d);j.clearColor(1,1,1,1);M.clear();j.clearColor(E.r,E.g,E.b,I);i=a.__webglObjects.length;for(d=0;d<i;d++)if(l=a.__webglObjects[d],k=l.object,l.render=!1,k.visible&&k.castShadow&&(!(k instanceof THREE.Mesh)||!k.frustumCulled||h(k)))k.matrixWorld.flattenToArray(k._objectMatrixArray),s(k,T,!1),l.render=!0;r(!0);G(THREE.NormalBlending);for(d=0;d<i;d++)if(l=a.__webglObjects[d],l.render)k=l.object,l=l.buffer,u(k),n=k.customDepthMaterial?k.customDepthMaterial:
|
|
|
-k.geometry.morphTargets.length?wa:ta,e(T,q,null,n,l,k);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)l=a.__webglObjectsImmediate[d],k=l.object,k.visible&&k.castShadow&&(k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),Y=-1,s(k,T,!1),u(k),m=o(T,q,null,ta,k),k.immediateRenderCallback?k.immediateRenderCallback(m,j,z):k.render(function(a){g(a,m,ta.shading)}));p++}}function k(a,b,c,d,f,g,h,j){var i,l,m,k;b?(l=a.length-1,k=b=-1):(l=0,b=a.length,k=1);for(var n=l;n!==b;n+=k)if(i=
|
|
|
-a[n],i.render){l=i.object;m=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&G(i.blending);r(i.depthTest);y(i.depthWrite);v(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}u(l);e(d,f,g,i,m,l)}}function p(a,b,c,d,e,f,h){for(var i,l,m,k,n=0,p=a.length;n<p;n++)if(i=a[n],l=i.object,l.visible){Y=-1;if(h)m=h;else{m=i[b];if(!m)continue;f&&G(m.blending);r(m.depthTest);y(m.depthWrite);v(m.polygonOffset,m.polygonOffsetFactor,m.polygonOffsetUnits)}u(l);k=o(c,d,e,m,l);l.immediateRenderCallback?l.immediateRenderCallback(k,
|
|
|
-j,z):l.render(function(a){g(a,k,m.shading)})}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b,c,d,e){d.program||M.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);
|
|
|
-for(var f=0,g=M.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==Z&&(j.useProgram(f),Z=f,h=!0);if(d.id!==aa)aa=d.id,h=!0;if(h){j.uniformMatrix4fv(g.projectionMatrix,!1,F);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var l,
|
|
|
-m,k=0,n=0,p=0,q,R,t,o=da,ba=o.directional.colors,s=o.directional.positions,z=o.point.colors,u=o.point.positions,A=o.point.distances,r=0,D=0,c=l=t=0,h=b.length;c<h;c++)if(l=b[c],m=l.color,q=l.position,R=l.intensity,t=l.distance,l instanceof THREE.AmbientLight)M.gammaInput?(k+=m.r*m.r,n+=m.g*m.g,p+=m.b*m.b):(k+=m.r,n+=m.g,p+=m.b);else if(l instanceof THREE.DirectionalLight)t=r*3,M.gammaInput?(ba[t]=m.r*m.r*R*R,ba[t+1]=m.g*m.g*R*R,ba[t+2]=m.b*m.b*R*R):(ba[t]=m.r*R,ba[t+1]=m.g*R,ba[t+2]=m.b*R),s[t]=q.x,
|
|
|
-s[t+1]=q.y,s[t+2]=q.z,r+=1;else if(l instanceof THREE.SpotLight)t=r*3,M.gammaInput?(ba[t]=m.r*m.r*R*R,ba[t+1]=m.g*m.g*R*R,ba[t+2]=m.b*m.b*R*R):(ba[t]=m.r*R,ba[t+1]=m.g*R,ba[t+2]=m.b*R),m=1/q.length(),s[t]=q.x*m,s[t+1]=q.y*m,s[t+2]=q.z*m,r+=1;else if(l instanceof THREE.PointLight)l=D*3,M.gammaInput?(z[l]=m.r*m.r*R*R,z[l+1]=m.g*m.g*R*R,z[l+2]=m.b*m.b*R*R):(z[l]=m.r*R,z[l+1]=m.g*R,z[l+2]=m.b*R),u[l]=q.x,u[l+1]=q.y,u[l+2]=q.z,A[D]=t,D+=1;c=r*3;for(h=ba.length;c<h;c++)ba[c]=0;c=D*3;for(h=z.length;c<h;c++)z[c]=
|
|
|
-0;o.point.length=D;o.directional.length=r;o.ambient[0]=k;o.ambient[1]=n;o.ambient[2]=p;b=da;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,
|
|
|
-M.gammaInput?i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;
|
|
|
-if(d instanceof THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=S.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,M.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof
|
|
|
-THREE.MeshLambertMaterial)M.gammaInput?i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<ha.length;b++)i.shadowMatrix.value[b]=ha[b],i.shadowMap.texture[b]=M.shadowMap[b];i.shadowDarkness.value=M.shadowMapDarkness;i.shadowBias.value=M.shadowMapBias}b=
|
|
|
-d.uniformsList;i=0;for(c=b.length;i<c;i++)if(n=f.uniforms[b[i][1]])if(k=b[i][0],p=k.type,h=k.value,p==="i")j.uniform1i(n,h);else if(p==="f")j.uniform1f(n,h);else if(p==="v2")j.uniform2f(n,h.x,h.y);else if(p==="v3")j.uniform3f(n,h.x,h.y,h.z);else if(p==="v4")j.uniform4f(n,h.x,h.y,h.z,h.w);else if(p==="c")j.uniform3f(n,h.r,h.g,h.b);else if(p==="fv1")j.uniform1fv(n,h);else if(p==="fv")j.uniform3fv(n,h);else if(p==="v3v"){if(!k._array)k._array=new Float32Array(3*h.length);p=0;for(q=h.length;p<q;p++)o=
|
|
|
-p*3,k._array[o]=h[p].x,k._array[o+1]=h[p].y,k._array[o+2]=h[p].z;j.uniform3fv(n,k._array)}else if(p==="m4"){if(!k._array)k._array=new Float32Array(16);h.flattenToArray(k._array);j.uniformMatrix4fv(n,!1,k._array)}else if(p==="m4v"){if(!k._array)k._array=new Float32Array(16*h.length);p=0;for(q=h.length;p<q;p++)h[p].flattenToArrayOffset(k._array,p*16);j.uniformMatrix4fv(n,!1,k._array)}else if(p==="t"){if(j.uniform1i(n,h),n=k.texture)if(n.image instanceof Array&&n.image.length===6){if(k=n,k.image.length===
|
|
|
-6)if(k.needsUpdate){if(!k.image.__webglTextureCube)k.image.__webglTextureCube=j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,k.image.__webglTextureCube);for(h=0;h<6;h++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,k.image[h]);H(j.TEXTURE_CUBE_MAP,k,k.image[0]);k.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,k.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(k=n,j.activeTexture(j.TEXTURE0+
|
|
|
-h),j.bindTexture(j.TEXTURE_CUBE_MAP,k.__webglTexture)):w(n,h)}else if(p==="tv"){if(!k._array){k._array=[];p=0;for(q=k.texture.length;p<q;p++)k._array[p]=h+p}j.uniform1iv(n,k._array);p=0;for(q=k.texture.length;p<q;p++)(n=k.texture[p])&&w(n,k._array[p])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&j.uniform3f(g.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||
|
|
|
-d instanceof THREE.ShaderMaterial||d.skinning)&&g.viewMatrix!==null&&j.uniformMatrix4fv(g.viewMatrix,!1,ca);d.skinning&&(j.uniformMatrix4fv(g.cameraInverseMatrix,!1,ca),j.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&j.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==null&&j.uniformMatrix4fv(g.objectMatrix,
|
|
|
-!1,e._objectMatrixArray);return f}function s(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function u(a){if(Q!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),Q=a.doubleSided;if(ga!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ga=a.flipSided}function r(a){ja!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),
|
|
|
-ja=a)}function y(a){ma!==a&&(j.depthMask(a),ma=a)}function v(a,b,c){la!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):j.disable(j.POLYGON_OFFSET_FILL),la=a);if(a&&(ka!==b||ya!==c))j.polygonOffset(b,c),ka=b,ya=c}function G(a){if(a!==na){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,
|
|
|
-j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}na=a}}function B(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function H(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-
|
|
|
-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,L(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,L(b.wrapT)),j.texParameteri(a,j.TEXTURE_MAG_FILTER,L(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,L(b.minFilter)),j.generateMipmap(a)):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,K(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,K(b.minFilter)))}function w(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=
|
|
|
-!0,a.__webglTexture=j.createTexture(),M.info.memory.textures++;j.activeTexture(j.TEXTURE0+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,L(a.format),a.image.width,a.image.height,0,L(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);H(j.TEXTURE_2D,a,a.image);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}
|
|
|
-function D(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function A(a){var b=
|
|
|
-a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);H(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,L(a.format),
|
|
|
-a.width,a.height,0,L(a.format),L(a.type),null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);D(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),H(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,L(a.format),a.width,a.height,0,L(a.format),L(a.type),null),
|
|
|
-c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),D(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=qa,a=R,d=sa,
|
|
|
-e=pa);b!==O&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),O=b)}function K(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;default:return j.LINEAR}}function L(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;
|
|
|
-case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;
|
|
|
-case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}var a=a||{},S=a.canvas!==void 0?a.canvas:document.createElement("canvas"),W=a.precision!==void 0?a.precision:"highp",U=a.antialias!==void 0?a.antialias:!1,X=a.stencil!==void 0?a.stencil:!0,$=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,E=a.clearColor!==void 0?new THREE.Color(a.clearColor):
|
|
|
-new THREE.Color(0),I=a.clearAlpha!==void 0?a.clearAlpha:0,P=a.maxLights!==void 0?a.maxLights:4;this.domElement=S;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var M=this,j,V=[],Z=null,O=null,aa=-1,Y=null,ea=0,Q=null,ga=null,na=null,ja=null,ma=null,la=null,ka=null,ya=null,xa=null,sa=0,pa=0,qa=0,R=0,z=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],ba=new THREE.Matrix4,F=new Float32Array(16),
|
|
|
-ca=new Float32Array(16),J=new THREE.Vector4,da={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},T,ha=[],ta,wa,N={},ra=!1;j=function(){var a;try{if(!(a=S.getContext("experimental-webgl",{antialias:U,stencil:X,preserveDrawingBuffer:$})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();
|
|
|
-j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(E.r,E.g,E.b,I);(function(){N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);var a=0;N.vertices[a++]=-1;N.vertices[a++]=-1;N.vertices[a++]=0;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=
|
|
|
-1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=0;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=0;a=N.vertices[a++]=0;N.faces[a++]=0;N.faces[a++]=1;N.faces[a++]=2;N.faces[a++]=0;N.faces[a++]=2;N.faces[a++]=3;N.vertexBuffer=j.createBuffer();N.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,N.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,N.faces,j.STATIC_DRAW);
|
|
|
-N.program=j.createProgram();j.attachShader(N.program,B("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(N.program,B("vertex",THREE.ShaderLib.sprite.vertexShader));j.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=j.getAttribLocation(N.program,"position");N.attributes.uv=j.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=j.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=j.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=j.getUniformLocation(N.program,
|
|
|
-"rotation");N.uniforms.scale=j.getUniformLocation(N.program,"scale");N.uniforms.alignment=j.getUniformLocation(N.program,"alignment");N.uniforms.color=j.getUniformLocation(N.program,"color");N.uniforms.map=j.getUniformLocation(N.program,"map");N.uniforms.opacity=j.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=j.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=j.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=
|
|
|
-j.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=j.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=j.getUniformLocation(N.program,"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);ta=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});wa=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});
|
|
|
-ta._shadowPass=!0;wa._shadowPass=!0})();this.context=j;var ua=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=function(){return ua};this.setSize=function(a,b){S.width=a;S.height=b;this.setViewport(0,0,S.width,S.height)};this.setViewport=function(a,b,c,d){sa=a;pa=b;qa=c;R=d;j.viewport(sa,pa,qa,R)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};
|
|
|
-this.setClearColorHex=function(a,b){E.setHex(a);I=b;j.clearColor(E.r,E.g,E.b,I)};this.setClearColor=function(a,b){E.copy(a);I=b;j.clearColor(E.r,E.g,E.b,I)};this.getClearColor=function(){return E};this.getClearAlpha=function(){return I};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){A(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=
|
|
|
-!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);
|
|
|
-j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);M.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),
|
|
|
-j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),M.info.memory.textures--};this.updateShadowMap=function(a,b){l(a,b)};this.render=function(a,b,c,d){var e,g,m,n,q=a.lights,t=a.fog;aa=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);
|
|
|
-this.shadowMapEnabled&&this.shadowMapAutoUpdate&&l(a,b);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(ca);b.projectionMatrix.flattenToArray(F);ba.multiply(b.projectionMatrix,b.matrixWorldInverse);f(ba);A(c);(this.autoClear||d)&&this.clear(this.autoClearColor,
|
|
|
-this.autoClearDepth,this.autoClearStencil);n=a.__webglObjects;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);s(m,b,!0);var o=g,z=o.object,u=o.buffer,D=void 0,D=D=void 0,D=z.material;if(D instanceof THREE.MeshFaceMaterial){if(D=u.materialIndex,D>=0)D=z.geometry.materials[D],D.transparent?(o.transparent=D,o.opaque=null):(o.opaque=D,o.transparent=null)}else if(D)D.transparent?
|
|
|
-(o.transparent=D,o.opaque=null):(o.opaque=D,o.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(J.copy(m.position),ba.multiplyVector3(J),g.z=J.z)}this.sortObjects&&n.sort(i);n=a.__webglObjectsImmediate;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),s(m,b,!0),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(G(a.overrideMaterial.blending),
|
|
|
-r(a.overrideMaterial.depthTest),y(a.overrideMaterial.depthWrite),v(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,q,t,!0,a.overrideMaterial),p(a.__webglObjectsImmediate,"",b,q,t,!1,a.overrideMaterial)):(G(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,q,t,!1),p(a.__webglObjectsImmediate,"opaque",b,q,t,!1),k(a.__webglObjects,!1,"transparent",b,q,t,!0),p(a.__webglObjectsImmediate,"transparent",b,q,t,!0));
|
|
|
-if(a.__webglSprites.length){m=N.attributes;q=N.uniforms;t=R/qa;d=[];e=qa*0.5;n=R*0.5;g=!0;j.useProgram(N.program);Z=N.program;Y=ja=na=-1;ra||(j.enableVertexAttribArray(N.attributes.position),j.enableVertexAttribArray(N.attributes.uv),ra=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.vertexAttribPointer(m.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(m.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.uniformMatrix4fv(q.projectionMatrix,
|
|
|
-!1,F);j.activeTexture(j.TEXTURE0);j.uniform1i(q.map,0);m=0;for(o=a.__webglSprites.length;m<o;m++)if(z=a.__webglSprites[m],z.visible&&z.opacity!==0)z.useScreenCoordinates?z.z=-z.position.z:(z._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,z.matrixWorld,z._modelViewMatrixArray),z.z=-z._modelViewMatrix.n34);a.__webglSprites.sort(i);m=0;for(o=a.__webglSprites.length;m<o;m++)z=a.__webglSprites[m],z.visible&&z.opacity!==0&&z.map&&z.map.image&&z.map.image.width&&(z.useScreenCoordinates?(j.uniform1i(q.useScreenCoordinates,
|
|
|
-1),j.uniform3f(q.screenPosition,(z.position.x-e)/e,(n-z.position.y)/n,Math.max(0,Math.min(1,z.position.z)))):(j.uniform1i(q.useScreenCoordinates,0),j.uniform1i(q.affectedByDistance,z.affectedByDistance?1:0),j.uniformMatrix4fv(q.modelViewMatrix,!1,z._modelViewMatrixArray)),b=z.map.image.width/(z.scaleByViewport?R:1),d[0]=b*t*z.scale.x,d[1]=b*z.scale.y,j.uniform2f(q.uvScale,z.uvScale.x,z.uvScale.y),j.uniform2f(q.uvOffset,z.uvOffset.x,z.uvOffset.y),j.uniform2f(q.alignment,z.alignment.x,z.alignment.y),
|
|
|
-j.uniform1f(q.opacity,z.opacity),j.uniform3f(q.color,z.color.r,z.color.g,z.color.b),j.uniform1f(q.rotation,z.rotation),j.uniform2fv(q.scale,d),z.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!z.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),G(z.blending),w(z.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ma)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
-c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],f=a,g=void 0,h=void 0,i=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){h=e.geometry;if(h.geometryGroups===void 0){var i=h,k=void 0,l=void 0,p=void 0,R=void 0,o=void 0,z=void 0,ba=void 0,s={},u=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)p=i.faces[k],R=p.materialIndex,z=R!==void 0?R:-1,s[z]===void 0&&(s[z]={hash:z,counter:0}),ba=s[z].hash+"_"+s[z].counter,i.geometryGroups[ba]===
|
|
|
-void 0&&(i.geometryGroups[ba]={faces3:[],faces4:[],materialIndex:R,vertices:0,numMorphTargets:u}),o=p instanceof THREE.Face3?3:4,i.geometryGroups[ba].vertices+o>65535&&(s[z].counter+=1,ba=s[z].hash+"_"+s[z].counter,i.geometryGroups[ba]===void 0&&(i.geometryGroups[ba]={faces3:[],faces4:[],materialIndex:R,vertices:0,numMorphTargets:u})),p instanceof THREE.Face3?i.geometryGroups[ba].faces3.push(k):i.geometryGroups[ba].faces4.push(k),i.geometryGroups[ba].vertices+=o;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=
|
|
|
-ea++,i.geometryGroupsList.push(i.geometryGroups[k])}for(g in h.geometryGroups)if(i=h.geometryGroups[g],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=
|
|
|
-j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){p=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(p=k.numMorphTargets;l<p;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}M.info.memory.geometries++;R=e;o=R.geometry;l=i.faces3;z=i.faces4;k=l.length*3+z.length*4;p=l.length*1+z.length*2;z=l.length*3+z.length*4;l=b(R,i);ba=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;s=l instanceof THREE.MeshBasicMaterial&&!l.envMap||
|
|
|
-l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;u=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(s)i.__normalArray=new Float32Array(k*3);if(o.hasTangents)i.__tangentArray=new Float32Array(k*4);if(u)i.__colorArray=new Float32Array(k*3);if(ba){if(o.faceUvs.length>0||o.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(o.faceUvs.length>1||o.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*
|
|
|
-2)}if(R.geometry.skinWeights.length&&R.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(p*3);i.__lineArray=new Uint16Array(z*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];R=0;for(o=i.numMorphTargets;R<o;R++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=s===THREE.SmoothShading;i.__uvType=ba;
|
|
|
-i.__vertexColorType=u;i.__normalType=s;i.__webglFaceCount=p*3;i.__webglLineCount=z*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];p=void 0;for(p in l.attributes){var R=l.attributes[p],o={},A;for(A in R)o[A]=R[A];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=!0,z=1,o.type==="v2"?z=2:o.type==="v3"?z=3:o.type==="v4"?z=4:o.type==="c"&&(z=3),o.size=z,o.array=new Float32Array(k*z),o.buffer=j.createBuffer(),o.buffer.belongsToAttribute=
|
|
|
+4,j.FLOAT,!1,0,0),j.bindBuffer(j.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),j.vertexAttribPointer(b.skinWeight,4,j.FLOAT,!1,0,0))}g instanceof THREE.Mesh?(d.wireframe?(d=d.wireframeLinewidth,d!==ya&&(j.lineWidth(d),ya=d),a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),j.drawElements(j.LINES,e.__webglLineCount,j.UNSIGNED_SHORT,0)):(a&&j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),j.drawElements(j.TRIANGLES,e.__webglFaceCount,j.UNSIGNED_SHORT,0)),M.info.render.calls++,M.info.render.vertices+=
|
|
|
+e.__webglFaceCount,M.info.render.faces+=e.__webglFaceCount/3):g instanceof THREE.Line?(g=g.type===THREE.LineStrip?j.LINE_STRIP:j.LINES,d=d.linewidth,d!==ya&&(j.lineWidth(d),ya=d),j.drawArrays(g,0,e.__webglLineCount),M.info.render.calls++):g instanceof THREE.ParticleSystem?(j.drawArrays(j.POINTS,0,e.__webglParticleCount),M.info.render.calls++):g instanceof THREE.Ribbon&&(j.drawArrays(j.TRIANGLE_STRIP,0,e.__webglVertexCount),M.info.render.calls++)}}function f(a){A[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-
|
|
|
+a.n13,a.n44-a.n14);A[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);A[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);A[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);A[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);A[5].set(a.n41+a.n31,a.n42+a.n32,a.n43+a.n33,a.n44+a.n34);for(var b,a=0;a<6;a++)b=A[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function h(a){for(var b=a.matrixWorld,c=-a.geometry.boundingSphere.radius*Math.max(a.scale.x,Math.max(a.scale.y,
|
|
|
+a.scale.z)),d=0;d<6;d++)if(a=A[d].x*b.n14+A[d].y*b.n24+A[d].z*b.n34+A[d].w,a<=c)return!1;return!0}function i(a,b){return b.z-a.z}function l(a){var b,c,d,i,m,l,n,k,p=0,q=a.lights;S||(S=new THREE.PerspectiveCamera(M.shadowCameraFov,M.shadowMapWidth/M.shadowMapHeight,M.shadowCameraNear,M.shadowCameraFar));b=0;for(c=q.length;b<c;b++)if(k=q[b],k.castShadow&&k instanceof THREE.SpotLight){Q=-1;M.shadowMap[p]||(M.shadowMap[p]=new THREE.WebGLRenderTarget(M.shadowMapWidth,M.shadowMapHeight,{minFilter:THREE.LinearFilter,
|
|
|
+magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ga[p]=new THREE.Matrix4);d=M.shadowMap[p];i=ga[p];S.position.copy(k.position);S.lookAt(k.target.position);S.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(S));this.autoUpdateScene&&a.updateMatrixWorld();S.matrixWorldInverse.getInverse(S.matrixWorld);i.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);i.multiplySelf(S.projectionMatrix);i.multiplySelf(S.matrixWorldInverse);S.matrixWorldInverse.flattenToArray($);S.projectionMatrix.flattenToArray(H);
|
|
|
+Z.multiply(S.projectionMatrix,S.matrixWorldInverse);f(Z);B(d);j.clearColor(1,1,1,1);M.clear();j.clearColor(x.r,x.g,x.b,I);i=a.__webglObjects.length;for(d=0;d<i;d++)if(l=a.__webglObjects[d],k=l.object,l.render=!1,k.visible&&k.castShadow&&(!(k instanceof THREE.Mesh)||!k.frustumCulled||h(k)))k.matrixWorld.flattenToArray(k._objectMatrixArray),s(k,S,!1),l.render=!0;r(!0);G(THREE.NormalBlending);for(d=0;d<i;d++)if(l=a.__webglObjects[d],l.render)k=l.object,l=l.buffer,u(k),n=k.customDepthMaterial?k.customDepthMaterial:
|
|
|
+k.geometry.morphTargets.length?va:Y,e(S,q,null,n,l,k);i=a.__webglObjectsImmediate.length;for(d=0;d<i;d++)l=a.__webglObjectsImmediate[d],k=l.object,k.visible&&k.castShadow&&(k.matrixAutoUpdate&&k.matrixWorld.flattenToArray(k._objectMatrixArray),K=-1,s(k,S,!1),u(k),m=o(S,q,null,Y,k),k.immediateRenderCallback?k.immediateRenderCallback(m,j,A):k.render(function(a){g(a,m,Y.shading)}));p++}}function k(a,b,c,d,g,f,h,j){var i,l,k,m;b?(l=a.length-1,m=b=-1):(l=0,b=a.length,m=1);for(var n=l;n!==b;n+=m)if(i=a[n],
|
|
|
+i.render){l=i.object;k=i.buffer;if(j)i=j;else{i=i[c];if(!i)continue;h&&G(i.blending);r(i.depthTest);z(i.depthWrite);E(i.polygonOffset,i.polygonOffsetFactor,i.polygonOffsetUnits)}u(l);e(d,g,f,i,k,l)}}function p(a,b,c,d,e,f,h){for(var i,l,k,m,n=0,p=a.length;n<p;n++)if(i=a[n],l=i.object,l.visible){K=-1;if(h)k=h;else{k=i[b];if(!k)continue;f&&G(k.blending);r(k.depthTest);z(k.depthWrite);E(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits)}u(l);m=o(c,d,e,k,l);l.immediateRenderCallback?l.immediateRenderCallback(m,
|
|
|
+j,A):l.render(function(a){g(a,m,k.shading)})}}function q(a,b,c){a.push({buffer:b,object:c,opaque:null,transparent:null})}function m(a){for(var b in a.attributes)if(a.attributes[b].needsUpdate)return!0;return!1}function t(a){for(var b in a.attributes)a.attributes[b].needsUpdate=!1}function n(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function o(a,b,c,d,e){d.program||M.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(M.maxMorphTargets);
|
|
|
+for(var g=0,f=M.maxMorphTargets;g<f;g++)e.__webglMorphTargetInfluences[g]=0}var h=!1,g=d.program,f=g.uniforms,i=d.uniforms;g!==ha&&(j.useProgram(g),ha=g,h=!0);if(d.id!==Q)Q=d.id,h=!0;if(h){j.uniformMatrix4fv(f.projectionMatrix,!1,H);if(c&&d.fog)if(i.fogColor.value=c.color,c instanceof THREE.Fog)i.fogNear.value=c.near,i.fogFar.value=c.far;else if(c instanceof THREE.FogExp2)i.fogDensity.value=c.density;if(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d.lights){for(var l,
|
|
|
+k,m=0,n=0,p=0,q,R,t,o=aa,Z=o.directional.colors,s=o.directional.positions,A=o.point.colors,u=o.point.positions,B=o.point.distances,r=0,F=0,c=l=t=0,h=b.length;c<h;c++)if(l=b[c],k=l.color,q=l.position,R=l.intensity,t=l.distance,l instanceof THREE.AmbientLight)M.gammaInput?(m+=k.r*k.r,n+=k.g*k.g,p+=k.b*k.b):(m+=k.r,n+=k.g,p+=k.b);else if(l instanceof THREE.DirectionalLight)t=r*3,M.gammaInput?(Z[t]=k.r*k.r*R*R,Z[t+1]=k.g*k.g*R*R,Z[t+2]=k.b*k.b*R*R):(Z[t]=k.r*R,Z[t+1]=k.g*R,Z[t+2]=k.b*R),s[t]=q.x,s[t+
|
|
|
+1]=q.y,s[t+2]=q.z,r+=1;else if(l instanceof THREE.SpotLight)t=r*3,M.gammaInput?(Z[t]=k.r*k.r*R*R,Z[t+1]=k.g*k.g*R*R,Z[t+2]=k.b*k.b*R*R):(Z[t]=k.r*R,Z[t+1]=k.g*R,Z[t+2]=k.b*R),k=1/q.length(),s[t]=q.x*k,s[t+1]=q.y*k,s[t+2]=q.z*k,r+=1;else if(l instanceof THREE.PointLight)l=F*3,M.gammaInput?(A[l]=k.r*k.r*R*R,A[l+1]=k.g*k.g*R*R,A[l+2]=k.b*k.b*R*R):(A[l]=k.r*R,A[l+1]=k.g*R,A[l+2]=k.b*R),u[l]=q.x,u[l+1]=q.y,u[l+2]=q.z,B[F]=t,F+=1;c=r*3;for(h=Z.length;c<h;c++)Z[c]=0;c=F*3;for(h=A.length;c<h;c++)A[c]=0;o.point.length=
|
|
|
+F;o.directional.length=r;o.ambient[0]=m;o.ambient[1]=n;o.ambient[2]=p;b=aa;i.ambientLightColor.value=b.ambient;i.directionalLightColor.value=b.directional.colors;i.directionalLightDirection.value=b.directional.positions;i.pointLightColor.value=b.point.colors;i.pointLightPosition.value=b.point.positions;i.pointLightDistance.value=b.point.distances}if(d instanceof THREE.MeshBasicMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.MeshPhongMaterial)i.opacity.value=d.opacity,M.gammaInput?
|
|
|
+i.diffuse.value.copyGammaToLinear(d.color):i.diffuse.value=d.color,(i.map.texture=d.map)&&i.offsetRepeat.value.set(d.map.offset.x,d.map.offset.y,d.map.repeat.x,d.map.repeat.y),i.lightMap.texture=d.lightMap,i.envMap.texture=d.envMap,i.flipEnvMap.value=d.envMap instanceof THREE.WebGLRenderTargetCube?1:-1,i.reflectivity.value=d.reflectivity,i.refractionRatio.value=d.refractionRatio,i.combine.value=d.combine,i.useRefract.value=d.envMap&&d.envMap.mapping instanceof THREE.CubeRefractionMapping;if(d instanceof
|
|
|
+THREE.LineBasicMaterial)i.diffuse.value=d.color,i.opacity.value=d.opacity;else if(d instanceof THREE.ParticleBasicMaterial)i.psColor.value=d.color,i.opacity.value=d.opacity,i.size.value=d.size,i.scale.value=W.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,M.gammaInput?(i.ambient.value.copyGammaToLinear(d.ambient),i.specular.value.copyGammaToLinear(d.specular)):(i.ambient.value=d.ambient,i.specular.value=d.specular);else if(d instanceof THREE.MeshLambertMaterial)M.gammaInput?
|
|
|
+i.ambient.value.copyGammaToLinear(d.ambient):i.ambient.value=d.ambient;else if(d instanceof THREE.MeshDepthMaterial)i.mNear.value=a.near,i.mFar.value=a.far,i.opacity.value=d.opacity;else if(d instanceof THREE.MeshNormalMaterial)i.opacity.value=d.opacity;if(e.receiveShadow&&!d._shadowPass&&i.shadowMatrix){for(b=0;b<ga.length;b++)i.shadowMatrix.value[b]=ga[b],i.shadowMap.texture[b]=M.shadowMap[b];i.shadowDarkness.value=M.shadowMapDarkness;i.shadowBias.value=M.shadowMapBias}b=d.uniformsList;i=0;for(c=
|
|
|
+b.length;i<c;i++)if(n=g.uniforms[b[i][1]])if(m=b[i][0],p=m.type,h=m.value,p==="i")j.uniform1i(n,h);else if(p==="f")j.uniform1f(n,h);else if(p==="v2")j.uniform2f(n,h.x,h.y);else if(p==="v3")j.uniform3f(n,h.x,h.y,h.z);else if(p==="v4")j.uniform4f(n,h.x,h.y,h.z,h.w);else if(p==="c")j.uniform3f(n,h.r,h.g,h.b);else if(p==="fv1")j.uniform1fv(n,h);else if(p==="fv")j.uniform3fv(n,h);else if(p==="v3v"){if(!m._array)m._array=new Float32Array(3*h.length);p=0;for(q=h.length;p<q;p++)o=p*3,m._array[o]=h[p].x,m._array[o+
|
|
|
+1]=h[p].y,m._array[o+2]=h[p].z;j.uniform3fv(n,m._array)}else if(p==="m4"){if(!m._array)m._array=new Float32Array(16);h.flattenToArray(m._array);j.uniformMatrix4fv(n,!1,m._array)}else if(p==="m4v"){if(!m._array)m._array=new Float32Array(16*h.length);p=0;for(q=h.length;p<q;p++)h[p].flattenToArrayOffset(m._array,p*16);j.uniformMatrix4fv(n,!1,m._array)}else if(p==="t"){if(j.uniform1i(n,h),n=m.texture)if(n.image instanceof Array&&n.image.length===6){if(m=n,m.image.length===6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=
|
|
|
+j.createTexture();j.activeTexture(j.TEXTURE0+h);j.bindTexture(j.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);for(h=0;h<6;h++)j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+h,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,m.image[h]);w(j.TEXTURE_CUBE_MAP,m,m.image[0]);m.needsUpdate=!1}else j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else n instanceof THREE.WebGLRenderTargetCube?(m=n,j.activeTexture(j.TEXTURE0+h),j.bindTexture(j.TEXTURE_CUBE_MAP,m.__webglTexture)):C(n,h)}else if(p===
|
|
|
+"tv"){if(!m._array){m._array=[];p=0;for(q=m.texture.length;p<q;p++)m._array[p]=h+p}j.uniform1iv(n,m._array);p=0;for(q=m.texture.length;p<q;p++)(n=m.texture[p])&&C(n,m._array[p])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&f.cameraPosition!==null&&j.uniform3f(f.cameraPosition,a.position.x,a.position.y,a.position.z);(d instanceof THREE.MeshPhongMaterial||d instanceof THREE.MeshLambertMaterial||d instanceof THREE.ShaderMaterial||d.skinning)&&f.viewMatrix!==null&&
|
|
|
+j.uniformMatrix4fv(f.viewMatrix,!1,$);d.skinning&&(j.uniformMatrix4fv(f.cameraInverseMatrix,!1,$),j.uniformMatrix4fv(f.boneGlobalMatrices,!1,e.boneMatrices))}j.uniformMatrix4fv(f.modelViewMatrix,!1,e._modelViewMatrixArray);f.normalMatrix&&j.uniformMatrix3fv(f.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&f.objectMatrix!==null&&j.uniformMatrix4fv(f.objectMatrix,!1,e._objectMatrixArray);return g}function s(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,
|
|
|
+a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function u(a){if(U!==a.doubleSided)a.doubleSided?j.disable(j.CULL_FACE):j.enable(j.CULL_FACE),U=a.doubleSided;if(ia!==a.flipSided)a.flipSided?j.frontFace(j.CW):j.frontFace(j.CCW),ia=a.flipSided}function r(a){na!==a&&(a?j.enable(j.DEPTH_TEST):j.disable(j.DEPTH_TEST),na=a)}function z(a){ka!==a&&(j.depthMask(a),ka=a)}function E(a,b,c){oa!==a&&(a?j.enable(j.POLYGON_OFFSET_FILL):
|
|
|
+j.disable(j.POLYGON_OFFSET_FILL),oa=a);if(a&&(la!==b||ma!==c))j.polygonOffset(b,c),la=b,ma=c}function G(a){if(a!==pa){switch(a){case THREE.AdditiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE);break;case THREE.SubtractiveBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:j.blendEquation(j.FUNC_ADD);j.blendFunc(j.ZERO,j.SRC_COLOR);break;default:j.blendEquationSeparate(j.FUNC_ADD,j.FUNC_ADD),j.blendFuncSeparate(j.SRC_ALPHA,
|
|
|
+j.ONE_MINUS_SRC_ALPHA,j.ONE,j.ONE_MINUS_SRC_ALPHA)}pa=a}}function v(a,b){var c;a==="fragment"?c=j.createShader(j.FRAGMENT_SHADER):a==="vertex"&&(c=j.createShader(j.VERTEX_SHADER));j.shaderSource(c,b);j.compileShader(c);if(!j.getShaderParameter(c,j.COMPILE_STATUS))return console.error(j.getShaderInfoLog(c)),console.error(b),null;return c}function w(a,b,c){(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(j.texParameteri(a,j.TEXTURE_WRAP_S,J(b.wrapS)),j.texParameteri(a,j.TEXTURE_WRAP_T,J(b.wrapT)),
|
|
|
+j.texParameteri(a,j.TEXTURE_MAG_FILTER,J(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,J(b.minFilter)),j.generateMipmap(a)):(j.texParameteri(a,j.TEXTURE_WRAP_S,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_WRAP_T,j.CLAMP_TO_EDGE),j.texParameteri(a,j.TEXTURE_MAG_FILTER,L(b.magFilter)),j.texParameteri(a,j.TEXTURE_MIN_FILTER,L(b.minFilter)))}function C(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=j.createTexture(),M.info.memory.textures++;j.activeTexture(j.TEXTURE0+
|
|
|
+b);j.bindTexture(j.TEXTURE_2D,a.__webglTexture);a instanceof THREE.DataTexture?j.texImage2D(j.TEXTURE_2D,0,J(a.format),a.image.width,a.image.height,0,J(a.format),j.UNSIGNED_BYTE,a.image.data):j.texImage2D(j.TEXTURE_2D,0,j.RGBA,j.RGBA,j.UNSIGNED_BYTE,a.image);w(j.TEXTURE_2D,a,a.image);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else j.activeTexture(j.TEXTURE0+b),j.bindTexture(j.TEXTURE_2D,a.__webglTexture)}function F(a,b){j.bindRenderbuffer(j.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,
|
|
|
+j.DEPTH_COMPONENT16,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_ATTACHMENT,j.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(j.renderbufferStorage(j.RENDERBUFFER,j.DEPTH_STENCIL,b.width,b.height),j.framebufferRenderbuffer(j.FRAMEBUFFER,j.DEPTH_STENCIL_ATTACHMENT,j.RENDERBUFFER,a)):j.renderbufferStorage(j.RENDERBUFFER,j.RGBA4,b.width,b.height)}function B(a){var b=a instanceof THREE.WebGLRenderTargetCube;if(a&&!a.__webglFramebuffer){if(a.depthBuffer===void 0)a.depthBuffer=!0;
|
|
|
+if(a.stencilBuffer===void 0)a.stencilBuffer=!0;a.__webglTexture=j.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];j.bindTexture(j.TEXTURE_CUBE_MAP,a.__webglTexture);w(j.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=j.createFramebuffer();a.__webglRenderbuffer[c]=j.createRenderbuffer();j.texImage2D(j.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,J(a.format),a.width,a.height,0,J(a.format),J(a.type),null);var d=a,e=j.TEXTURE_CUBE_MAP_POSITIVE_X+c;j.bindFramebuffer(j.FRAMEBUFFER,
|
|
|
+a.__webglFramebuffer[c]);j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,e,d.__webglTexture,0);F(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=j.createFramebuffer(),a.__webglRenderbuffer=j.createRenderbuffer(),j.bindTexture(j.TEXTURE_2D,a.__webglTexture),w(j.TEXTURE_2D,a,a),j.texImage2D(j.TEXTURE_2D,0,J(a.format),a.width,a.height,0,J(a.format),J(a.type),null),c=j.TEXTURE_2D,j.bindFramebuffer(j.FRAMEBUFFER,a.__webglFramebuffer),j.framebufferTexture2D(j.FRAMEBUFFER,j.COLOR_ATTACHMENT0,
|
|
|
+c,a.__webglTexture,0),j.bindRenderbuffer(j.RENDERBUFFER,a.__webglRenderbuffer),F(a.__webglRenderbuffer,a);b?j.bindTexture(j.TEXTURE_CUBE_MAP,null):j.bindTexture(j.TEXTURE_2D,null);j.bindRenderbuffer(j.RENDERBUFFER,null);j.bindFramebuffer(j.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=xa,a=R,d=ra,e=sa);b!==V&&(j.bindFramebuffer(j.FRAMEBUFFER,b),j.viewport(d,e,c,a),V=b)}function L(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return j.NEAREST;
|
|
|
+default:return j.LINEAR}}function J(a){switch(a){case THREE.RepeatWrapping:return j.REPEAT;case THREE.ClampToEdgeWrapping:return j.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return j.MIRRORED_REPEAT;case THREE.NearestFilter:return j.NEAREST;case THREE.NearestMipMapNearestFilter:return j.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return j.NEAREST_MIPMAP_LINEAR;case THREE.LinearFilter:return j.LINEAR;case THREE.LinearMipMapNearestFilter:return j.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return j.LINEAR_MIPMAP_LINEAR;
|
|
|
+case THREE.ByteType:return j.BYTE;case THREE.UnsignedByteType:return j.UNSIGNED_BYTE;case THREE.ShortType:return j.SHORT;case THREE.UnsignedShortType:return j.UNSIGNED_SHORT;case THREE.IntType:return j.INT;case THREE.UnsignedShortType:return j.UNSIGNED_INT;case THREE.FloatType:return j.FLOAT;case THREE.AlphaFormat:return j.ALPHA;case THREE.RGBFormat:return j.RGB;case THREE.RGBAFormat:return j.RGBA;case THREE.LuminanceFormat:return j.LUMINANCE;case THREE.LuminanceAlphaFormat:return j.LUMINANCE_ALPHA}return 0}
|
|
|
+var a=a||{},W=a.canvas!==void 0?a.canvas:document.createElement("canvas"),X=a.precision!==void 0?a.precision:"highp",T=a.antialias!==void 0?a.antialias:!1,ea=a.stencil!==void 0?a.stencil:!0,ba=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,x=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),I=a.clearAlpha!==void 0?a.clearAlpha:0,O=a.maxLights!==void 0?a.maxLights:4;this.domElement=W;this.context=null;this.autoUpdateScene=this.autoUpdateObjects=this.sortObjects=this.autoClearStencil=
|
|
|
+this.autoClearDepth=this.autoClearColor=this.autoClear=!0;this.physicallyBasedShading=this.gammaOutput=this.gammaInput=!1;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=this.shadowMapAutoUpdate=!0;this.maxMorphTargets=8;this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var M=
|
|
|
+this,j,P=[],ha=null,V=null,Q=-1,K=null,fa=0,U=null,ia=null,pa=null,na=null,ka=null,oa=null,la=null,ma=null,ya=null,ra=0,sa=0,xa=0,R=0,A=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],Z=new THREE.Matrix4,H=new Float32Array(16),$=new Float32Array(16),ca=new THREE.Vector4,aa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},S,ga=[],Y,va,N={},ua=!1;j=function(){var a;try{if(!(a=
|
|
|
+W.getContext("experimental-webgl",{antialias:T,stencil:ea,preserveDrawingBuffer:ba})))throw"Error creating WebGL context.";console.log(navigator.userAgent+" | "+a.getParameter(a.VERSION)+" | "+a.getParameter(a.VENDOR)+" | "+a.getParameter(a.RENDERER)+" | "+a.getParameter(a.SHADING_LANGUAGE_VERSION))}catch(b){console.error(b)}return a}();j.clearColor(0,0,0,1);j.clearDepth(1);j.clearStencil(0);j.enable(j.DEPTH_TEST);j.depthFunc(j.LEQUAL);j.frontFace(j.CCW);j.cullFace(j.BACK);j.enable(j.CULL_FACE);j.enable(j.BLEND);
|
|
|
+j.blendEquation(j.FUNC_ADD);j.blendFunc(j.SRC_ALPHA,j.ONE_MINUS_SRC_ALPHA);j.clearColor(x.r,x.g,x.b,I);(function(){N.vertices=new Float32Array(16);N.faces=new Uint16Array(6);var a=0;N.vertices[a++]=-1;N.vertices[a++]=-1;N.vertices[a++]=0;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=1;N.vertices[a++]=0;N.vertices[a++]=-1;N.vertices[a++]=1;N.vertices[a++]=0;a=N.vertices[a++]=0;N.faces[a++]=0;N.faces[a++]=
|
|
|
+1;N.faces[a++]=2;N.faces[a++]=0;N.faces[a++]=2;N.faces[a++]=3;N.vertexBuffer=j.createBuffer();N.elementBuffer=j.createBuffer();j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.bufferData(j.ARRAY_BUFFER,N.vertices,j.STATIC_DRAW);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,N.faces,j.STATIC_DRAW);N.program=j.createProgram();j.attachShader(N.program,v("fragment",THREE.ShaderLib.sprite.fragmentShader));j.attachShader(N.program,v("vertex",THREE.ShaderLib.sprite.vertexShader));
|
|
|
+j.linkProgram(N.program);N.attributes={};N.uniforms={};N.attributes.position=j.getAttribLocation(N.program,"position");N.attributes.uv=j.getAttribLocation(N.program,"uv");N.uniforms.uvOffset=j.getUniformLocation(N.program,"uvOffset");N.uniforms.uvScale=j.getUniformLocation(N.program,"uvScale");N.uniforms.rotation=j.getUniformLocation(N.program,"rotation");N.uniforms.scale=j.getUniformLocation(N.program,"scale");N.uniforms.alignment=j.getUniformLocation(N.program,"alignment");N.uniforms.color=j.getUniformLocation(N.program,
|
|
|
+"color");N.uniforms.map=j.getUniformLocation(N.program,"map");N.uniforms.opacity=j.getUniformLocation(N.program,"opacity");N.uniforms.useScreenCoordinates=j.getUniformLocation(N.program,"useScreenCoordinates");N.uniforms.affectedByDistance=j.getUniformLocation(N.program,"affectedByDistance");N.uniforms.screenPosition=j.getUniformLocation(N.program,"screenPosition");N.uniforms.modelViewMatrix=j.getUniformLocation(N.program,"modelViewMatrix");N.uniforms.projectionMatrix=j.getUniformLocation(N.program,
|
|
|
+"projectionMatrix")})();(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);Y=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});va=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});Y._shadowPass=!0;va._shadowPass=!0})();this.context=j;var ta=j.getParameter(j.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return j};this.supportsVertexTextures=
|
|
|
+function(){return ta};this.setSize=function(a,b){W.width=a;W.height=b;this.setViewport(0,0,W.width,W.height)};this.setViewport=function(a,b,c,d){ra=a;sa=b;xa=c;R=d;j.viewport(ra,sa,xa,R)};this.setScissor=function(a,b,c,d){j.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?j.enable(j.SCISSOR_TEST):j.disable(j.SCISSOR_TEST)};this.setClearColorHex=function(a,b){x.setHex(a);I=b;j.clearColor(x.r,x.g,x.b,I)};this.setClearColor=function(a,b){x.copy(a);I=b;j.clearColor(x.r,x.g,x.b,I)};this.getClearColor=
|
|
|
+function(){return x};this.getClearAlpha=function(){return I};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=j.COLOR_BUFFER_BIT;if(b===void 0||b)d|=j.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=j.STENCIL_BUFFER_BIT;j.clear(d)};this.clearTarget=function(a,b,c,d){B(a);this.clear(b,c,d)};this.deallocateObject=function(a){if(a.__webglInit)if(a.__webglInit=!1,delete a._modelViewMatrix,delete a._normalMatrixArray,delete a._modelViewMatrixArray,delete a._objectMatrixArray,a instanceof THREE.Mesh)for(var b in a.geometry.geometryGroups){var c=
|
|
|
+a.geometry.geometryGroups[b];j.deleteBuffer(c.__webglVertexBuffer);j.deleteBuffer(c.__webglNormalBuffer);j.deleteBuffer(c.__webglTangentBuffer);j.deleteBuffer(c.__webglColorBuffer);j.deleteBuffer(c.__webglUVBuffer);j.deleteBuffer(c.__webglUV2Buffer);j.deleteBuffer(c.__webglSkinVertexABuffer);j.deleteBuffer(c.__webglSkinVertexBBuffer);j.deleteBuffer(c.__webglSkinIndicesBuffer);j.deleteBuffer(c.__webglSkinWeightsBuffer);j.deleteBuffer(c.__webglFaceBuffer);j.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=
|
|
|
+0,e=c.numMorphTargets;d<e;d++)j.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)j.deleteBuffer(c.__webglCustomAttributesList[d].buffer);M.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),
|
|
|
+M.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,j.deleteBuffer(a.__webglVertexBuffer),j.deleteBuffer(a.__webglColorBuffer),M.info.memory.geometries--};this.deallocateTexture=function(a){if(a.__webglInit)a.__webglInit=!1,j.deleteTexture(a.__webglTexture),M.info.memory.textures--};this.updateShadowMap=function(a,b){l(a,b)};this.render=function(a,b,c,d){var e,g,m,n,q=a.lights,t=a.fog;Q=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);this.shadowMapEnabled&&this.shadowMapAutoUpdate&&
|
|
|
+l(a,b);M.info.render.calls=0;M.info.render.vertices=0;M.info.render.faces=0;b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray($);b.projectionMatrix.flattenToArray(H);Z.multiply(b.projectionMatrix,b.matrixWorldInverse);f(Z);B(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);
|
|
|
+n=a.__webglObjects;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,g.render=!1,m.visible&&(!(m instanceof THREE.Mesh)||!m.frustumCulled||h(m))){m.matrixWorld.flattenToArray(m._objectMatrixArray);s(m,b,!0);var o=g,A=o.object,u=o.buffer,F=void 0,F=F=void 0,F=A.material;if(F instanceof THREE.MeshFaceMaterial){if(F=u.materialIndex,F>=0)F=A.geometry.materials[F],F.transparent?(o.transparent=F,o.opaque=null):(o.opaque=F,o.transparent=null)}else if(F)F.transparent?(o.transparent=F,o.opaque=null):(o.opaque=
|
|
|
+F,o.transparent=null);g.render=!0;if(this.sortObjects)m.renderDepth?g.z=m.renderDepth:(ca.copy(m.position),Z.multiplyVector3(ca),g.z=ca.z)}this.sortObjects&&n.sort(i);n=a.__webglObjectsImmediate;d=0;for(e=n.length;d<e;d++)if(g=n[d],m=g.object,m.visible)m.matrixAutoUpdate&&m.matrixWorld.flattenToArray(m._objectMatrixArray),s(m,b,!0),m=g.object.material,m.transparent?(g.transparent=m,g.opaque=null):(g.opaque=m,g.transparent=null);a.overrideMaterial?(G(a.overrideMaterial.blending),r(a.overrideMaterial.depthTest),
|
|
|
+z(a.overrideMaterial.depthWrite),E(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),k(a.__webglObjects,!1,"",b,q,t,!0,a.overrideMaterial),p(a.__webglObjectsImmediate,"",b,q,t,!1,a.overrideMaterial)):(G(THREE.NormalBlending),k(a.__webglObjects,!0,"opaque",b,q,t,!1),p(a.__webglObjectsImmediate,"opaque",b,q,t,!1),k(a.__webglObjects,!1,"transparent",b,q,t,!0),p(a.__webglObjectsImmediate,"transparent",b,q,t,!0));if(a.__webglSprites.length){m=
|
|
|
+N.attributes;q=N.uniforms;t=R/xa;d=[];e=xa*0.5;n=R*0.5;g=!0;j.useProgram(N.program);ha=N.program;K=na=pa=-1;ua||(j.enableVertexAttribArray(N.attributes.position),j.enableVertexAttribArray(N.attributes.uv),ua=!0);j.disable(j.CULL_FACE);j.enable(j.BLEND);j.depthMask(!0);j.bindBuffer(j.ARRAY_BUFFER,N.vertexBuffer);j.vertexAttribPointer(m.position,2,j.FLOAT,!1,16,0);j.vertexAttribPointer(m.uv,2,j.FLOAT,!1,16,8);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,N.elementBuffer);j.uniformMatrix4fv(q.projectionMatrix,
|
|
|
+!1,H);j.activeTexture(j.TEXTURE0);j.uniform1i(q.map,0);m=0;for(o=a.__webglSprites.length;m<o;m++)if(A=a.__webglSprites[m],A.visible&&A.opacity!==0)A.useScreenCoordinates?A.z=-A.position.z:(A._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,A.matrixWorld,A._modelViewMatrixArray),A.z=-A._modelViewMatrix.n34);a.__webglSprites.sort(i);m=0;for(o=a.__webglSprites.length;m<o;m++)A=a.__webglSprites[m],A.visible&&A.opacity!==0&&A.map&&A.map.image&&A.map.image.width&&(A.useScreenCoordinates?(j.uniform1i(q.useScreenCoordinates,
|
|
|
+1),j.uniform3f(q.screenPosition,(A.position.x-e)/e,(n-A.position.y)/n,Math.max(0,Math.min(1,A.position.z)))):(j.uniform1i(q.useScreenCoordinates,0),j.uniform1i(q.affectedByDistance,A.affectedByDistance?1:0),j.uniformMatrix4fv(q.modelViewMatrix,!1,A._modelViewMatrixArray)),b=A.map.image.width/(A.scaleByViewport?R:1),d[0]=b*t*A.scale.x,d[1]=b*A.scale.y,j.uniform2f(q.uvScale,A.uvScale.x,A.uvScale.y),j.uniform2f(q.uvOffset,A.uvOffset.x,A.uvOffset.y),j.uniform2f(q.alignment,A.alignment.x,A.alignment.y),
|
|
|
+j.uniform1f(q.opacity,A.opacity),j.uniform3f(q.color,A.color.r,A.color.g,A.color.b),j.uniform1f(q.rotation,A.rotation),j.uniform2fv(q.scale,d),A.mergeWith3D&&!g?(j.enable(j.DEPTH_TEST),g=!0):!A.mergeWith3D&&g&&(j.disable(j.DEPTH_TEST),g=!1),G(A.blending),C(A.map,0),j.drawElements(j.TRIANGLES,6,j.UNSIGNED_SHORT,0));j.enable(j.CULL_FACE);j.enable(j.DEPTH_TEST);j.depthMask(ka)}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(j.bindTexture(j.TEXTURE_CUBE_MAP,
|
|
|
+c.__webglTexture),j.generateMipmap(j.TEXTURE_CUBE_MAP),j.bindTexture(j.TEXTURE_CUBE_MAP,null)):(j.bindTexture(j.TEXTURE_2D,c.__webglTexture),j.generateMipmap(j.TEXTURE_2D),j.bindTexture(j.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[];for(;a.__objectsAdded.length;){var e=a.__objectsAdded[0],g=a,f=void 0,h=void 0,i=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){h=e.geometry;if(h.geometryGroups===void 0){var i=h,k=void 0,l=void 0,p=void 0,R=void 0,o=void 0,A=void 0,Z=void 0,s={},u=i.morphTargets.length;i.geometryGroups={};k=0;for(l=i.faces.length;k<l;k++)p=i.faces[k],R=p.materialIndex,A=R!==void 0?R:-1,s[A]===void 0&&(s[A]={hash:A,counter:0}),Z=s[A].hash+"_"+s[A].counter,i.geometryGroups[Z]===
|
|
|
+void 0&&(i.geometryGroups[Z]={faces3:[],faces4:[],materialIndex:R,vertices:0,numMorphTargets:u}),o=p instanceof THREE.Face3?3:4,i.geometryGroups[Z].vertices+o>65535&&(s[A].counter+=1,Z=s[A].hash+"_"+s[A].counter,i.geometryGroups[Z]===void 0&&(i.geometryGroups[Z]={faces3:[],faces4:[],materialIndex:R,vertices:0,numMorphTargets:u})),p instanceof THREE.Face3?i.geometryGroups[Z].faces3.push(k):i.geometryGroups[Z].faces4.push(k),i.geometryGroups[Z].vertices+=o;i.geometryGroupsList=[];k=void 0;for(k in i.geometryGroups)i.geometryGroups[k].id=
|
|
|
+fa++,i.geometryGroupsList.push(i.geometryGroups[k])}for(f in h.geometryGroups)if(i=h.geometryGroups[f],!i.__webglVertexBuffer){k=i;k.__webglVertexBuffer=j.createBuffer();k.__webglNormalBuffer=j.createBuffer();k.__webglTangentBuffer=j.createBuffer();k.__webglColorBuffer=j.createBuffer();k.__webglUVBuffer=j.createBuffer();k.__webglUV2Buffer=j.createBuffer();k.__webglSkinVertexABuffer=j.createBuffer();k.__webglSkinVertexBBuffer=j.createBuffer();k.__webglSkinIndicesBuffer=j.createBuffer();k.__webglSkinWeightsBuffer=
|
|
|
+j.createBuffer();k.__webglFaceBuffer=j.createBuffer();k.__webglLineBuffer=j.createBuffer();if(k.numMorphTargets){p=l=void 0;k.__webglMorphTargetsBuffers=[];l=0;for(p=k.numMorphTargets;l<p;l++)k.__webglMorphTargetsBuffers.push(j.createBuffer())}M.info.memory.geometries++;R=e;o=R.geometry;l=i.faces3;A=i.faces4;k=l.length*3+A.length*4;p=l.length*1+A.length*2;A=l.length*3+A.length*4;l=b(R,i);Z=l.map||l.lightMap||l instanceof THREE.ShaderMaterial?!0:!1;s=l instanceof THREE.MeshBasicMaterial&&!l.envMap||
|
|
|
+l instanceof THREE.MeshDepthMaterial?!1:l&&l.shading!==void 0&&l.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading;u=l.vertexColors?l.vertexColors:!1;i.__vertexArray=new Float32Array(k*3);if(s)i.__normalArray=new Float32Array(k*3);if(o.hasTangents)i.__tangentArray=new Float32Array(k*4);if(u)i.__colorArray=new Float32Array(k*3);if(Z){if(o.faceUvs.length>0||o.faceVertexUvs.length>0)i.__uvArray=new Float32Array(k*2);if(o.faceUvs.length>1||o.faceVertexUvs.length>1)i.__uv2Array=new Float32Array(k*
|
|
|
+2)}if(R.geometry.skinWeights.length&&R.geometry.skinIndices.length)i.__skinVertexAArray=new Float32Array(k*4),i.__skinVertexBArray=new Float32Array(k*4),i.__skinIndexArray=new Float32Array(k*4),i.__skinWeightArray=new Float32Array(k*4);i.__faceArray=new Uint16Array(p*3);i.__lineArray=new Uint16Array(A*2);if(i.numMorphTargets){i.__morphTargetsArrays=[];R=0;for(o=i.numMorphTargets;R<o;R++)i.__morphTargetsArrays.push(new Float32Array(k*3))}i.__needsSmoothNormals=s===THREE.SmoothShading;i.__uvType=Z;
|
|
|
+i.__vertexColorType=u;i.__normalType=s;i.__webglFaceCount=p*3;i.__webglLineCount=A*2;if(l.attributes){if(i.__webglCustomAttributesList===void 0)i.__webglCustomAttributesList=[];p=void 0;for(p in l.attributes){var R=l.attributes[p],o={},B;for(B in R)o[B]=R[B];if(!o.__webglInitialized||o.createUniqueBuffers)o.__webglInitialized=!0,A=1,o.type==="v2"?A=2:o.type==="v3"?A=3:o.type==="v4"?A=4:o.type==="c"&&(A=3),o.size=A,o.array=new Float32Array(k*A),o.buffer=j.createBuffer(),o.buffer.belongsToAttribute=
|
|
|
p,R.needsUpdate=!0,o.__original=R;i.__webglCustomAttributesList.push(o)}}i.__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)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.memory.geometries++,i=h,k=i.vertices.length,i.__vertexArray=new Float32Array(k*3),i.__colorArray=new Float32Array(k*
|
|
|
3),i.__webglVertexCount=k,h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.Line){if(h=e.geometry,!h.__webglVertexBuffer)i=h,i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.memory.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__webglLineCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0}else if(e instanceof THREE.ParticleSystem&&(h=e.geometry,!h.__webglVertexBuffer))i=h,
|
|
|
-i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(g in h=e.geometry,h.geometryGroups)i=h.geometryGroups[g],q(f.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?
|
|
|
-(h=e.geometry,q(f.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?f.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&f.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];f=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)n(f.__webglObjects,e);else if(e instanceof
|
|
|
-THREE.Sprite){f=f.__webglSprites;g=e;for(h=f.length-1;h>=0;h--)f[h]===g&&f.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&n(f.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(f=a.__webglObjects.length;e<f;e++)if(A=a.__webglObjects[e].object,g=A.geometry,h=p=l=void 0,A instanceof THREE.Mesh){i=0;for(k=g.geometryGroupsList.length;i<k;i++)if(l=g.geometryGroupsList[i],h=b(A,l),p=h.attributes&&m(h),g.__dirtyVertices||g.__dirtyMorphTargets||
|
|
|
-g.__dirtyElements||g.__dirtyUvs||g.__dirtyNormals||g.__dirtyColors||g.__dirtyTangents||p)if(p=j.DYNAMIC_DRAW,R=!g.dynamic,l.__inittedArrays){var D=z=o=void 0,r=void 0,K=void 0,L=void 0,F=void 0,y=void 0,I=void 0,P=void 0,G=void 0,E=D=L=void 0,J=void 0,w=void 0,v=void 0,B=r=void 0,H=void 0,ca=r=I=G=void 0,N=void 0,U=v=w=J=F=void 0,T=r=v=w=J=U=v=w=J=U=v=w=J=void 0,S=void 0,W=L=void 0,aa=void 0,da=void 0,ha=void 0,X=void 0,O=E=da=S=0,Y=0,$=T=D=0,Q=F=B=0,C=0,V=void 0,Q=l.__vertexArray,aa=l.__uvArray,
|
|
|
-C=l.__uv2Array,W=l.__normalArray,K=l.__tangentArray,H=l.__colorArray,ca=l.__skinVertexAArray,N=l.__skinVertexBArray,y=l.__skinIndexArray,Z=l.__skinWeightArray,U=l.__morphTargetsArrays,ba=l.__webglCustomAttributesList,x=void 0,x=l.__faceArray,V=l.__lineArray,ga=l.__needsSmoothNormals,G=l.__vertexColorType,P=l.__uvType,L=l.__normalType,I=A.geometry,wa=I.__dirtyElements,ta=I.__dirtyUvs,ja=I.__dirtyNormals,na=I.__dirtyTangents,ma=I.__dirtyColors,ha=I.__dirtyMorphTargets,X=I.vertices,s=l.faces3,u=l.faces4,
|
|
|
-ia=I.faces,ua=I.faceVertexUvs[0],ra=I.faceVertexUvs[1],ka=I.skinVerticesA,la=I.skinVerticesB,sa=I.skinIndices,pa=I.skinWeights,qa=I.morphTargets;if(I.__dirtyVertices){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],J=X[r.a].position,w=X[r.b].position,v=X[r.c].position,Q[da]=J.x,Q[da+1]=J.y,Q[da+2]=J.z,Q[da+3]=w.x,Q[da+4]=w.y,Q[da+5]=w.z,Q[da+6]=v.x,Q[da+7]=v.y,Q[da+8]=v.z,da+=9;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],J=X[r.a].position,w=X[r.b].position,v=X[r.c].position,r=X[r.d].position,Q[da]=J.x,Q[da+1]=J.y,
|
|
|
-Q[da+2]=J.z,Q[da+3]=w.x,Q[da+4]=w.y,Q[da+5]=w.z,Q[da+6]=v.x,Q[da+7]=v.y,Q[da+8]=v.z,Q[da+9]=r.x,Q[da+10]=r.y,Q[da+11]=r.z,da+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,Q,p)}if(ha){da=0;for(ha=qa.length;da<ha;da++){o=Q=0;for(z=s.length;o<z;o++)r=ia[s[o]],J=qa[da].vertices[r.a].position,w=qa[da].vertices[r.b].position,v=qa[da].vertices[r.c].position,X=U[da],X[Q]=J.x,X[Q+1]=J.y,X[Q+2]=J.z,X[Q+3]=w.x,X[Q+4]=w.y,X[Q+5]=w.z,X[Q+6]=v.x,X[Q+7]=v.y,X[Q+8]=v.z,Q+=9;o=
|
|
|
-0;for(z=u.length;o<z;o++)r=ia[u[o]],J=qa[da].vertices[r.a].position,w=qa[da].vertices[r.b].position,v=qa[da].vertices[r.c].position,r=qa[da].vertices[r.d].position,X=U[da],X[Q]=J.x,X[Q+1]=J.y,X[Q+2]=J.z,X[Q+3]=w.x,X[Q+4]=w.y,X[Q+5]=w.z,X[Q+6]=v.x,X[Q+7]=v.y,X[Q+8]=v.z,X[Q+9]=r.x,X[Q+10]=r.y,X[Q+11]=r.z,Q+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[da]);j.bufferData(j.ARRAY_BUFFER,U[da],p)}}if(pa.length){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],J=pa[r.a],w=pa[r.b],v=pa[r.c],Z[F]=J.x,
|
|
|
-Z[F+1]=J.y,Z[F+2]=J.z,Z[F+3]=J.w,Z[F+4]=w.x,Z[F+5]=w.y,Z[F+6]=w.z,Z[F+7]=w.w,Z[F+8]=v.x,Z[F+9]=v.y,Z[F+10]=v.z,Z[F+11]=v.w,J=sa[r.a],w=sa[r.b],v=sa[r.c],y[F]=J.x,y[F+1]=J.y,y[F+2]=J.z,y[F+3]=J.w,y[F+4]=w.x,y[F+5]=w.y,y[F+6]=w.z,y[F+7]=w.w,y[F+8]=v.x,y[F+9]=v.y,y[F+10]=v.z,y[F+11]=v.w,J=ka[r.a],w=ka[r.b],v=ka[r.c],ca[F]=J.x,ca[F+1]=J.y,ca[F+2]=J.z,ca[F+3]=1,ca[F+4]=w.x,ca[F+5]=w.y,ca[F+6]=w.z,ca[F+7]=1,ca[F+8]=v.x,ca[F+9]=v.y,ca[F+10]=v.z,ca[F+11]=1,J=la[r.a],w=la[r.b],v=la[r.c],N[F]=J.x,N[F+1]=J.y,
|
|
|
-N[F+2]=J.z,N[F+3]=1,N[F+4]=w.x,N[F+5]=w.y,N[F+6]=w.z,N[F+7]=1,N[F+8]=v.x,N[F+9]=v.y,N[F+10]=v.z,N[F+11]=1,F+=12;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],J=pa[r.a],w=pa[r.b],v=pa[r.c],U=pa[r.d],Z[F]=J.x,Z[F+1]=J.y,Z[F+2]=J.z,Z[F+3]=J.w,Z[F+4]=w.x,Z[F+5]=w.y,Z[F+6]=w.z,Z[F+7]=w.w,Z[F+8]=v.x,Z[F+9]=v.y,Z[F+10]=v.z,Z[F+11]=v.w,Z[F+12]=U.x,Z[F+13]=U.y,Z[F+14]=U.z,Z[F+15]=U.w,J=sa[r.a],w=sa[r.b],v=sa[r.c],U=sa[r.d],y[F]=J.x,y[F+1]=J.y,y[F+2]=J.z,y[F+3]=J.w,y[F+4]=w.x,y[F+5]=w.y,y[F+6]=w.z,y[F+7]=w.w,y[F+8]=
|
|
|
-v.x,y[F+9]=v.y,y[F+10]=v.z,y[F+11]=v.w,y[F+12]=U.x,y[F+13]=U.y,y[F+14]=U.z,y[F+15]=U.w,J=ka[r.a],w=ka[r.b],v=ka[r.c],U=ka[r.d],ca[F]=J.x,ca[F+1]=J.y,ca[F+2]=J.z,ca[F+3]=1,ca[F+4]=w.x,ca[F+5]=w.y,ca[F+6]=w.z,ca[F+7]=1,ca[F+8]=v.x,ca[F+9]=v.y,ca[F+10]=v.z,ca[F+11]=1,ca[F+12]=U.x,ca[F+13]=U.y,ca[F+14]=U.z,ca[F+15]=1,J=la[r.a],w=la[r.b],v=la[r.c],r=la[r.d],N[F]=J.x,N[F+1]=J.y,N[F+2]=J.z,N[F+3]=1,N[F+4]=w.x,N[F+5]=w.y,N[F+6]=w.z,N[F+7]=1,N[F+8]=v.x,N[F+9]=v.y,N[F+10]=v.z,N[F+11]=1,N[F+12]=r.x,N[F+13]=
|
|
|
-r.y,N[F+14]=r.z,N[F+15]=1,F+=16;F>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,ca,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,N,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,y,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Z,p))}if(ma&&G){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],F=r.vertexColors,y=r.color,F.length===3&&G===THREE.VertexColors?
|
|
|
-(r=F[0],ca=F[1],N=F[2]):N=ca=r=y,H[B]=r.r,H[B+1]=r.g,H[B+2]=r.b,H[B+3]=ca.r,H[B+4]=ca.g,H[B+5]=ca.b,H[B+6]=N.r,H[B+7]=N.g,H[B+8]=N.b,B+=9;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],F=r.vertexColors,y=r.color,F.length===4&&G===THREE.VertexColors?(r=F[0],ca=F[1],N=F[2],F=F[3]):F=N=ca=r=y,H[B]=r.r,H[B+1]=r.g,H[B+2]=r.b,H[B+3]=ca.r,H[B+4]=ca.g,H[B+5]=ca.b,H[B+6]=N.r,H[B+7]=N.g,H[B+8]=N.b,H[B+9]=F.r,H[B+10]=F.g,H[B+11]=F.b,B+=12;B>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,
|
|
|
-H,p))}if(na&&I.hasTangents){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],I=r.vertexTangents,B=I[0],H=I[1],G=I[2],K[T]=B.x,K[T+1]=B.y,K[T+2]=B.z,K[T+3]=B.w,K[T+4]=H.x,K[T+5]=H.y,K[T+6]=H.z,K[T+7]=H.w,K[T+8]=G.x,K[T+9]=G.y,K[T+10]=G.z,K[T+11]=G.w,T+=12;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],I=r.vertexTangents,B=I[0],H=I[1],G=I[2],I=I[3],K[T]=B.x,K[T+1]=B.y,K[T+2]=B.z,K[T+3]=B.w,K[T+4]=H.x,K[T+5]=H.y,K[T+6]=H.z,K[T+7]=H.w,K[T+8]=G.x,K[T+9]=G.y,K[T+10]=G.z,K[T+11]=G.w,K[T+12]=I.x,K[T+13]=I.y,K[T+14]=I.z,K[T+
|
|
|
-15]=I.w,T+=16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);j.bufferData(j.ARRAY_BUFFER,K,p)}if(ja&&L){o=0;for(z=s.length;o<z;o++)if(r=ia[s[o]],K=r.vertexNormals,L=r.normal,K.length===3&&ga)for(T=0;T<3;T++)L=K[T],W[D]=L.x,W[D+1]=L.y,W[D+2]=L.z,D+=3;else for(T=0;T<3;T++)W[D]=L.x,W[D+1]=L.y,W[D+2]=L.z,D+=3;o=0;for(z=u.length;o<z;o++)if(r=ia[u[o]],K=r.vertexNormals,L=r.normal,K.length===4&&ga)for(T=0;T<4;T++)L=K[T],W[D]=L.x,W[D+1]=L.y,W[D+2]=L.z,D+=3;else for(T=0;T<4;T++)W[D]=L.x,W[D+1]=L.y,W[D+
|
|
|
-2]=L.z,D+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,W,p)}if(ta&&ua&&P){o=0;for(z=s.length;o<z;o++)if(D=s[o],D=ua[D],D!==void 0)for(T=0;T<3;T++)W=D[T],aa[E]=W.u,aa[E+1]=W.v,E+=2;o=0;for(z=u.length;o<z;o++)if(D=u[o],D=ua[D],D!==void 0)for(T=0;T<4;T++)W=D[T],aa[E]=W.u,aa[E+1]=W.v,E+=2;E>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,aa,p))}if(ta&&ra&&P){o=0;for(z=s.length;o<z;o++)if(D=s[o],E=ra[D],E!==void 0)for(T=0;T<3;T++)aa=E[T],
|
|
|
-C[O]=aa.u,C[O+1]=aa.v,O+=2;o=0;for(z=u.length;o<z;o++)if(D=u[o],E=ra[D],E!==void 0)for(T=0;T<4;T++)aa=E[T],C[O]=aa.u,C[O+1]=aa.v,O+=2;O>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,C,p))}if(wa){o=0;for(z=s.length;o<z;o++)x[Y]=S,x[Y+1]=S+1,x[Y+2]=S+2,Y+=3,V[$]=S,V[$+1]=S+1,V[$+2]=S,V[$+3]=S+2,V[$+4]=S+1,V[$+5]=S+2,$+=6,S+=3;o=0;for(z=u.length;o<z;o++)x[Y]=S,x[Y+1]=S+1,x[Y+2]=S+3,x[Y+3]=S+1,x[Y+4]=S+2,x[Y+5]=S+3,Y+=6,V[$]=S,V[$+1]=S+1,V[$+2]=S,V[$+3]=S+3,V[$+4]=S+
|
|
|
-1,V[$+5]=S+2,V[$+6]=S+2,V[$+7]=S+3,$+=8,S+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,x,p);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,V,p)}if(ba){T=0;for(S=ba.length;T<S;T++)if(x=ba[T],x.__original.needsUpdate){C=0;if(x.size===1)if(x.boundTo===void 0||x.boundTo==="vertices"){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],x.array[C]=x.value[r.a],x.array[C+1]=x.value[r.b],x.array[C+2]=x.value[r.c],C+=3;o=0;
|
|
|
-for(z=u.length;o<z;o++)r=ia[u[o]],x.array[C]=x.value[r.a],x.array[C+1]=x.value[r.b],x.array[C+2]=x.value[r.c],x.array[C+3]=x.value[r.d],C+=4}else{if(x.boundTo==="faces"){o=0;for(z=s.length;o<z;o++)V=x.value[s[o]],x.array[C]=V,x.array[C+1]=V,x.array[C+2]=V,C+=3;o=0;for(z=u.length;o<z;o++)V=x.value[u[o]],x.array[C]=V,x.array[C+1]=V,x.array[C+2]=V,x.array[C+3]=V,C+=4}}else if(x.size===2)if(x.boundTo===void 0||x.boundTo==="vertices"){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],J=x.value[r.a],w=x.value[r.b],
|
|
|
-v=x.value[r.c],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=w.x,x.array[C+3]=w.y,x.array[C+4]=v.x,x.array[C+5]=v.y,C+=6;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],J=x.value[r.a],w=x.value[r.b],v=x.value[r.c],r=x.value[r.d],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=w.x,x.array[C+3]=w.y,x.array[C+4]=v.x,x.array[C+5]=v.y,x.array[C+6]=r.x,x.array[C+7]=r.y,C+=8}else{if(x.boundTo==="faces"){o=0;for(z=s.length;o<z;o++)v=w=J=V=x.value[s[o]],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=w.x,x.array[C+3]=w.y,
|
|
|
-x.array[C+4]=v.x,x.array[C+5]=v.y,C+=6;o=0;for(z=u.length;o<z;o++)r=v=w=J=V=x.value[u[o]],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=w.x,x.array[C+3]=w.y,x.array[C+4]=v.x,x.array[C+5]=v.y,x.array[C+6]=r.x,x.array[C+7]=r.y,C+=8}}else if(x.size===3)if(O=x.type==="c"?["r","g","b"]:["x","y","z"],x.boundTo===void 0||x.boundTo==="vertices"){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],J=x.value[r.a],w=x.value[r.b],v=x.value[r.c],x.array[C]=J[O[0]],x.array[C+1]=J[O[1]],x.array[C+2]=J[O[2]],x.array[C+3]=w[O[0]],
|
|
|
-x.array[C+4]=w[O[1]],x.array[C+5]=w[O[2]],x.array[C+6]=v[O[0]],x.array[C+7]=v[O[1]],x.array[C+8]=v[O[2]],C+=9;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],J=x.value[r.a],w=x.value[r.b],v=x.value[r.c],r=x.value[r.d],x.array[C]=J[O[0]],x.array[C+1]=J[O[1]],x.array[C+2]=J[O[2]],x.array[C+3]=w[O[0]],x.array[C+4]=w[O[1]],x.array[C+5]=w[O[2]],x.array[C+6]=v[O[0]],x.array[C+7]=v[O[1]],x.array[C+8]=v[O[2]],x.array[C+9]=r[O[0]],x.array[C+10]=r[O[1]],x.array[C+11]=r[O[2]],C+=12}else{if(x.boundTo==="faces"){o=0;for(z=
|
|
|
-s.length;o<z;o++)v=w=J=V=x.value[s[o]],x.array[C]=J[O[0]],x.array[C+1]=J[O[1]],x.array[C+2]=J[O[2]],x.array[C+3]=w[O[0]],x.array[C+4]=w[O[1]],x.array[C+5]=w[O[2]],x.array[C+6]=v[O[0]],x.array[C+7]=v[O[1]],x.array[C+8]=v[O[2]],C+=9;o=0;for(z=u.length;o<z;o++)r=v=w=J=V=x.value[u[o]],x.array[C]=J[O[0]],x.array[C+1]=J[O[1]],x.array[C+2]=J[O[2]],x.array[C+3]=w[O[0]],x.array[C+4]=w[O[1]],x.array[C+5]=w[O[2]],x.array[C+6]=v[O[0]],x.array[C+7]=v[O[1]],x.array[C+8]=v[O[2]],x.array[C+9]=r[O[0]],x.array[C+10]=
|
|
|
-r[O[1]],x.array[C+11]=r[O[2]],C+=12}}else if(x.size===4)if(x.boundTo===void 0||x.boundTo==="vertices"){o=0;for(z=s.length;o<z;o++)r=ia[s[o]],J=x.value[r.a],w=x.value[r.b],v=x.value[r.c],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=J.z,x.array[C+3]=J.w,x.array[C+4]=w.x,x.array[C+5]=w.y,x.array[C+6]=w.z,x.array[C+7]=w.w,x.array[C+8]=v.x,x.array[C+9]=v.y,x.array[C+10]=v.z,x.array[C+11]=v.w,C+=12;o=0;for(z=u.length;o<z;o++)r=ia[u[o]],J=x.value[r.a],w=x.value[r.b],v=x.value[r.c],r=x.value[r.d],x.array[C]=
|
|
|
-J.x,x.array[C+1]=J.y,x.array[C+2]=J.z,x.array[C+3]=J.w,x.array[C+4]=w.x,x.array[C+5]=w.y,x.array[C+6]=w.z,x.array[C+7]=w.w,x.array[C+8]=v.x,x.array[C+9]=v.y,x.array[C+10]=v.z,x.array[C+11]=v.w,x.array[C+12]=r.x,x.array[C+13]=r.y,x.array[C+14]=r.z,x.array[C+15]=r.w,C+=16}else if(x.boundTo==="faces"){o=0;for(z=s.length;o<z;o++)v=w=J=V=x.value[s[o]],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=J.z,x.array[C+3]=J.w,x.array[C+4]=w.x,x.array[C+5]=w.y,x.array[C+6]=w.z,x.array[C+7]=w.w,x.array[C+8]=v.x,x.array[C+
|
|
|
-9]=v.y,x.array[C+10]=v.z,x.array[C+11]=v.w,C+=12;o=0;for(z=u.length;o<z;o++)r=v=w=J=V=x.value[u[o]],x.array[C]=J.x,x.array[C+1]=J.y,x.array[C+2]=J.z,x.array[C+3]=J.w,x.array[C+4]=w.x,x.array[C+5]=w.y,x.array[C+6]=w.z,x.array[C+7]=w.w,x.array[C+8]=v.x,x.array[C+9]=v.y,x.array[C+10]=v.z,x.array[C+11]=v.w,x.array[C+12]=r.x,x.array[C+13]=r.y,x.array[C+14]=r.z,x.array[C+15]=r.w,C+=16}j.bindBuffer(j.ARRAY_BUFFER,x.buffer);j.bufferData(j.ARRAY_BUFFER,x.array,p)}}R&&(delete l.__inittedArrays,delete l.__colorArray,
|
|
|
-delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}g.__dirtyVertices=!1;g.__dirtyMorphTargets=!1;g.__dirtyElements=!1;g.__dirtyUvs=!1;g.__dirtyNormals=!1;g.__dirtyColors=!1;g.__dirtyTangents=!1;h.attributes&&t(h)}else if(A instanceof THREE.Ribbon){if(g.__dirtyVertices||g.__dirtyColors){h=g;
|
|
|
-A=j.DYNAMIC_DRAW;o=i=o=R=R=void 0;z=h.vertices;k=h.colors;ba=z.length;l=k.length;s=h.__vertexArray;p=h.__colorArray;u=h.__dirtyColors;if(h.__dirtyVertices){for(R=0;R<ba;R++)o=z[R].position,i=R*3,s[i]=o.x,s[i+1]=o.y,s[i+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,s,A)}if(u){for(R=0;R<l;R++)o=k[R],i=R*3,p[i]=o.r,p[i+1]=o.g,p[i+2]=o.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,p,A)}}g.__dirtyVertices=!1;g.__dirtyColors=!1}else if(A instanceof
|
|
|
-THREE.Line){h=b(A,l);p=h.attributes&&m(h);if(g.__dirtyVertices||g.__dirtyColors||p){A=g;i=j.DYNAMIC_DRAW;ba=k=S=z=ia=void 0;z=A.vertices;l=A.colors;ba=z.length;p=l.length;s=A.__vertexArray;R=A.__colorArray;u=A.__dirtyColors;o=A.__webglCustomAttributesList;E=$=Y=O=S=ia=void 0;if(A.__dirtyVertices){for(ia=0;ia<ba;ia++)S=z[ia].position,k=ia*3,s[k]=S.x,s[k+1]=S.y,s[k+2]=S.z;j.bindBuffer(j.ARRAY_BUFFER,A.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,s,i)}if(u){for(z=0;z<p;z++)ba=l[z],k=z*3,R[k]=ba.r,
|
|
|
-R[k+1]=ba.g,R[k+2]=ba.b;j.bindBuffer(j.ARRAY_BUFFER,A.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,R,i)}if(o){ia=0;for(S=o.length;ia<S;ia++)if(E=o[ia],E.needsUpdate&&(E.boundTo===void 0||E.boundTo==="vertices")){k=0;Y=E.value.length;if(E.size===1)for(O=0;O<Y;O++)E.array[O]=E.value[O];else if(E.size===2)for(O=0;O<Y;O++)$=E.value[O],E.array[k]=$.x,E.array[k+1]=$.y,k+=2;else if(E.size===3)if(E.type==="c")for(O=0;O<Y;O++)$=E.value[O],E.array[k]=$.r,E.array[k+1]=$.g,E.array[k+2]=$.b,k+=3;else for(O=
|
|
|
-0;O<Y;O++)$=E.value[O],E.array[k]=$.x,E.array[k+1]=$.y,E.array[k+2]=$.z,k+=3;else if(E.size===4)for(O=0;O<Y;O++)$=E.value[O],E.array[k]=$.x,E.array[k+1]=$.y,E.array[k+2]=$.z,E.array[k+3]=$.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,E.buffer);j.bufferData(j.ARRAY_BUFFER,E.array,i)}}}g.__dirtyVertices=!1;g.__dirtyColors=!1;h.attributes&&t(h)}else if(A instanceof THREE.ParticleSystem)h=b(A,l),p=h.attributes&&m(h),(g.__dirtyVertices||g.__dirtyColors||A.sortParticles||p)&&d(g,j.DYNAMIC_DRAW,A),g.__dirtyVertices=
|
|
|
-!1,g.__dirtyColors=!1,h.attributes&&t(h)};this.initMaterial=function(a,b,c,d){var e,g,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);
|
|
|
-a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var l,k,m;l=m=i=0;for(k=b.length;l<k;l++)f=b[l],f instanceof THREE.SpotLight&&m++,f instanceof THREE.DirectionalLight&&m++,f instanceof THREE.PointLight&&i++;i+m<=P?l=m:(l=Math.ceil(P*m/(i+m)),i=P-l);f={directional:l,point:i};i=m=0;for(l=b.length;i<l;i++)k=b[i],k instanceof THREE.SpotLight&&k.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{l=a.fragmentShader;k=a.vertexShader;var i=a.uniforms,
|
|
|
-b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,
|
|
|
-perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(l),d.push(k));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=V.length;p<d;p++)if(V[p].code===h){o=V[p].program;break a}p=j.createProgram();d=[ua?"#define VERTEX_TEXTURES":"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+
|
|
|
-c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
-f=["#ifdef GL_ES","precision "+W+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
|
|
|
-"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(p,B("fragment",f+l));j.attachShader(p,
|
|
|
-B("vertex",d+k));j.linkProgram(p);j.getProgramParameter(p,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(p,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)l=q[d],p.uniforms[l]=j.getUniformLocation(p,
|
|
|
-l);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=j.getAttribLocation(p,c);p.id=V.length;V.push({program:p,code:h});M.info.memory.programs=V.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal);
|
|
|
+i.__webglVertexBuffer=j.createBuffer(),i.__webglColorBuffer=j.createBuffer(),M.info.geometries++,i=h,k=e,l=i.vertices.length,i.__vertexArray=new Float32Array(l*3),i.__colorArray=new Float32Array(l*3),i.__sortArray=[],i.__webglParticleCount=l,c(i,k),h.__dirtyVertices=!0,h.__dirtyColors=!0;if(!e.__webglActive){if(e instanceof THREE.Mesh)for(f in h=e.geometry,h.geometryGroups)i=h.geometryGroups[f],q(g.__webglObjects,i,e);else e instanceof THREE.Ribbon||e instanceof THREE.Line||e instanceof THREE.ParticleSystem?
|
|
|
+(h=e.geometry,q(g.__webglObjects,h,e)):THREE.MarchingCubes!==void 0&&e instanceof THREE.MarchingCubes||e.immediateRenderCallback?g.__webglObjectsImmediate.push({object:e,opaque:null,transparent:null}):e instanceof THREE.Sprite&&g.__webglSprites.push(e);e.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;){e=a.__objectsRemoved[0];g=a;if(e instanceof THREE.Mesh||e instanceof THREE.ParticleSystem||e instanceof THREE.Ribbon||e instanceof THREE.Line)n(g.__webglObjects,e);else if(e instanceof
|
|
|
+THREE.Sprite){g=g.__webglSprites;f=e;for(h=g.length-1;h>=0;h--)g[h]===f&&g.splice(h,1)}else(e instanceof THREE.MarchingCubes||e.immediateRenderCallback)&&n(g.__webglObjectsImmediate,e);e.__webglActive=!1;a.__objectsRemoved.splice(0,1)}e=0;for(g=a.__webglObjects.length;e<g;e++)if(B=a.__webglObjects[e].object,f=B.geometry,h=p=l=void 0,B instanceof THREE.Mesh){i=0;for(k=f.geometryGroupsList.length;i<k;i++)if(l=f.geometryGroupsList[i],h=b(B,l),p=h.attributes&&m(h),f.__dirtyVertices||f.__dirtyMorphTargets||
|
|
|
+f.__dirtyElements||f.__dirtyUvs||f.__dirtyNormals||f.__dirtyColors||f.__dirtyTangents||p)if(p=j.DYNAMIC_DRAW,R=!f.dynamic,l.__inittedArrays){var F=A=o=void 0,r=void 0,L=void 0,z=void 0,H=void 0,J=void 0,I=void 0,O=void 0,G=void 0,C=F=z=void 0,x=void 0,w=void 0,v=void 0,E=r=void 0,$=void 0,ca=r=I=G=void 0,N=void 0,T=v=w=x=H=void 0,S=r=v=w=x=T=v=w=x=T=v=w=x=void 0,aa=void 0,W=z=void 0,X=void 0,Q=void 0,ea=void 0,V=void 0,K=C=Q=aa=0,ba=0,U=S=F=0,P=H=E=0,D=0,ga=void 0,P=l.__vertexArray,X=l.__uvArray,
|
|
|
+D=l.__uv2Array,W=l.__normalArray,L=l.__tangentArray,$=l.__colorArray,ca=l.__skinVertexAArray,N=l.__skinVertexBArray,J=l.__skinIndexArray,Y=l.__skinWeightArray,T=l.__morphTargetsArrays,Z=l.__webglCustomAttributesList,y=void 0,y=l.__faceArray,ga=l.__lineArray,ha=l.__needsSmoothNormals,G=l.__vertexColorType,O=l.__uvType,z=l.__normalType,I=B.geometry,ia=I.__dirtyElements,va=I.__dirtyUvs,pa=I.__dirtyNormals,ta=I.__dirtyTangents,na=I.__dirtyColors,ea=I.__dirtyMorphTargets,V=I.vertices,s=l.faces3,u=l.faces4,
|
|
|
+ja=I.faces,ka=I.faceVertexUvs[0],ma=I.faceVertexUvs[1],la=I.skinVerticesA,oa=I.skinVerticesB,ua=I.skinIndices,ra=I.skinWeights,sa=I.morphTargets;if(I.__dirtyVertices){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=V[r.a].position,w=V[r.b].position,v=V[r.c].position,P[Q]=x.x,P[Q+1]=x.y,P[Q+2]=x.z,P[Q+3]=w.x,P[Q+4]=w.y,P[Q+5]=w.z,P[Q+6]=v.x,P[Q+7]=v.y,P[Q+8]=v.z,Q+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=V[r.a].position,w=V[r.b].position,v=V[r.c].position,r=V[r.d].position,P[Q]=x.x,P[Q+1]=x.y,P[Q+2]=x.z,
|
|
|
+P[Q+3]=w.x,P[Q+4]=w.y,P[Q+5]=w.z,P[Q+6]=v.x,P[Q+7]=v.y,P[Q+8]=v.z,P[Q+9]=r.x,P[Q+10]=r.y,P[Q+11]=r.z,Q+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,P,p)}if(ea){Q=0;for(ea=sa.length;Q<ea;Q++){o=P=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=sa[Q].vertices[r.a].position,w=sa[Q].vertices[r.b].position,v=sa[Q].vertices[r.c].position,V=T[Q],V[P]=x.x,V[P+1]=x.y,V[P+2]=x.z,V[P+3]=w.x,V[P+4]=w.y,V[P+5]=w.z,V[P+6]=v.x,V[P+7]=v.y,V[P+8]=v.z,P+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],
|
|
|
+x=sa[Q].vertices[r.a].position,w=sa[Q].vertices[r.b].position,v=sa[Q].vertices[r.c].position,r=sa[Q].vertices[r.d].position,V=T[Q],V[P]=x.x,V[P+1]=x.y,V[P+2]=x.z,V[P+3]=w.x,V[P+4]=w.y,V[P+5]=w.z,V[P+6]=v.x,V[P+7]=v.y,V[P+8]=v.z,V[P+9]=r.x,V[P+10]=r.y,V[P+11]=r.z,P+=12;j.bindBuffer(j.ARRAY_BUFFER,l.__webglMorphTargetsBuffers[Q]);j.bufferData(j.ARRAY_BUFFER,T[Q],p)}}if(ra.length){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=ra[r.a],w=ra[r.b],v=ra[r.c],Y[H]=x.x,Y[H+1]=x.y,Y[H+2]=x.z,Y[H+3]=x.w,Y[H+4]=w.x,
|
|
|
+Y[H+5]=w.y,Y[H+6]=w.z,Y[H+7]=w.w,Y[H+8]=v.x,Y[H+9]=v.y,Y[H+10]=v.z,Y[H+11]=v.w,x=ua[r.a],w=ua[r.b],v=ua[r.c],J[H]=x.x,J[H+1]=x.y,J[H+2]=x.z,J[H+3]=x.w,J[H+4]=w.x,J[H+5]=w.y,J[H+6]=w.z,J[H+7]=w.w,J[H+8]=v.x,J[H+9]=v.y,J[H+10]=v.z,J[H+11]=v.w,x=la[r.a],w=la[r.b],v=la[r.c],ca[H]=x.x,ca[H+1]=x.y,ca[H+2]=x.z,ca[H+3]=1,ca[H+4]=w.x,ca[H+5]=w.y,ca[H+6]=w.z,ca[H+7]=1,ca[H+8]=v.x,ca[H+9]=v.y,ca[H+10]=v.z,ca[H+11]=1,x=oa[r.a],w=oa[r.b],v=oa[r.c],N[H]=x.x,N[H+1]=x.y,N[H+2]=x.z,N[H+3]=1,N[H+4]=w.x,N[H+5]=w.y,
|
|
|
+N[H+6]=w.z,N[H+7]=1,N[H+8]=v.x,N[H+9]=v.y,N[H+10]=v.z,N[H+11]=1,H+=12;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=ra[r.a],w=ra[r.b],v=ra[r.c],T=ra[r.d],Y[H]=x.x,Y[H+1]=x.y,Y[H+2]=x.z,Y[H+3]=x.w,Y[H+4]=w.x,Y[H+5]=w.y,Y[H+6]=w.z,Y[H+7]=w.w,Y[H+8]=v.x,Y[H+9]=v.y,Y[H+10]=v.z,Y[H+11]=v.w,Y[H+12]=T.x,Y[H+13]=T.y,Y[H+14]=T.z,Y[H+15]=T.w,x=ua[r.a],w=ua[r.b],v=ua[r.c],T=ua[r.d],J[H]=x.x,J[H+1]=x.y,J[H+2]=x.z,J[H+3]=x.w,J[H+4]=w.x,J[H+5]=w.y,J[H+6]=w.z,J[H+7]=w.w,J[H+8]=v.x,J[H+9]=v.y,J[H+10]=v.z,J[H+11]=v.w,J[H+
|
|
|
+12]=T.x,J[H+13]=T.y,J[H+14]=T.z,J[H+15]=T.w,x=la[r.a],w=la[r.b],v=la[r.c],T=la[r.d],ca[H]=x.x,ca[H+1]=x.y,ca[H+2]=x.z,ca[H+3]=1,ca[H+4]=w.x,ca[H+5]=w.y,ca[H+6]=w.z,ca[H+7]=1,ca[H+8]=v.x,ca[H+9]=v.y,ca[H+10]=v.z,ca[H+11]=1,ca[H+12]=T.x,ca[H+13]=T.y,ca[H+14]=T.z,ca[H+15]=1,x=oa[r.a],w=oa[r.b],v=oa[r.c],r=oa[r.d],N[H]=x.x,N[H+1]=x.y,N[H+2]=x.z,N[H+3]=1,N[H+4]=w.x,N[H+5]=w.y,N[H+6]=w.z,N[H+7]=1,N[H+8]=v.x,N[H+9]=v.y,N[H+10]=v.z,N[H+11]=1,N[H+12]=r.x,N[H+13]=r.y,N[H+14]=r.z,N[H+15]=1,H+=16;H>0&&(j.bindBuffer(j.ARRAY_BUFFER,
|
|
|
+l.__webglSkinVertexABuffer),j.bufferData(j.ARRAY_BUFFER,ca,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinVertexBBuffer),j.bufferData(j.ARRAY_BUFFER,N,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinIndicesBuffer),j.bufferData(j.ARRAY_BUFFER,J,p),j.bindBuffer(j.ARRAY_BUFFER,l.__webglSkinWeightsBuffer),j.bufferData(j.ARRAY_BUFFER,Y,p))}if(na&&G){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],H=r.vertexColors,J=r.color,H.length===3&&G===THREE.VertexColors?(r=H[0],ca=H[1],N=H[2]):N=ca=r=J,$[E]=r.r,$[E+1]=r.g,$[E+2]=
|
|
|
+r.b,$[E+3]=ca.r,$[E+4]=ca.g,$[E+5]=ca.b,$[E+6]=N.r,$[E+7]=N.g,$[E+8]=N.b,E+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],H=r.vertexColors,J=r.color,H.length===4&&G===THREE.VertexColors?(r=H[0],ca=H[1],N=H[2],H=H[3]):H=N=ca=r=J,$[E]=r.r,$[E+1]=r.g,$[E+2]=r.b,$[E+3]=ca.r,$[E+4]=ca.g,$[E+5]=ca.b,$[E+6]=N.r,$[E+7]=N.g,$[E+8]=N.b,$[E+9]=H.r,$[E+10]=H.g,$[E+11]=H.b,E+=12;E>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglColorBuffer),j.bufferData(j.ARRAY_BUFFER,$,p))}if(ta&&I.hasTangents){o=0;for(A=s.length;o<A;o++)r=
|
|
|
+ja[s[o]],I=r.vertexTangents,E=I[0],$=I[1],G=I[2],L[S]=E.x,L[S+1]=E.y,L[S+2]=E.z,L[S+3]=E.w,L[S+4]=$.x,L[S+5]=$.y,L[S+6]=$.z,L[S+7]=$.w,L[S+8]=G.x,L[S+9]=G.y,L[S+10]=G.z,L[S+11]=G.w,S+=12;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],I=r.vertexTangents,E=I[0],$=I[1],G=I[2],I=I[3],L[S]=E.x,L[S+1]=E.y,L[S+2]=E.z,L[S+3]=E.w,L[S+4]=$.x,L[S+5]=$.y,L[S+6]=$.z,L[S+7]=$.w,L[S+8]=G.x,L[S+9]=G.y,L[S+10]=G.z,L[S+11]=G.w,L[S+12]=I.x,L[S+13]=I.y,L[S+14]=I.z,L[S+15]=I.w,S+=16;j.bindBuffer(j.ARRAY_BUFFER,l.__webglTangentBuffer);
|
|
|
+j.bufferData(j.ARRAY_BUFFER,L,p)}if(pa&&z){o=0;for(A=s.length;o<A;o++)if(r=ja[s[o]],L=r.vertexNormals,z=r.normal,L.length===3&&ha)for(S=0;S<3;S++)z=L[S],W[F]=z.x,W[F+1]=z.y,W[F+2]=z.z,F+=3;else for(S=0;S<3;S++)W[F]=z.x,W[F+1]=z.y,W[F+2]=z.z,F+=3;o=0;for(A=u.length;o<A;o++)if(r=ja[u[o]],L=r.vertexNormals,z=r.normal,L.length===4&&ha)for(S=0;S<4;S++)z=L[S],W[F]=z.x,W[F+1]=z.y,W[F+2]=z.z,F+=3;else for(S=0;S<4;S++)W[F]=z.x,W[F+1]=z.y,W[F+2]=z.z,F+=3;j.bindBuffer(j.ARRAY_BUFFER,l.__webglNormalBuffer);j.bufferData(j.ARRAY_BUFFER,
|
|
|
+W,p)}if(va&&ka&&O){o=0;for(A=s.length;o<A;o++)if(F=s[o],F=ka[F],F!==void 0)for(S=0;S<3;S++)W=F[S],X[C]=W.u,X[C+1]=W.v,C+=2;o=0;for(A=u.length;o<A;o++)if(F=u[o],F=ka[F],F!==void 0)for(S=0;S<4;S++)W=F[S],X[C]=W.u,X[C+1]=W.v,C+=2;C>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUVBuffer),j.bufferData(j.ARRAY_BUFFER,X,p))}if(va&&ma&&O){o=0;for(A=s.length;o<A;o++)if(F=s[o],C=ma[F],C!==void 0)for(S=0;S<3;S++)X=C[S],D[K]=X.u,D[K+1]=X.v,K+=2;o=0;for(A=u.length;o<A;o++)if(F=u[o],C=ma[F],C!==void 0)for(S=0;S<4;S++)X=
|
|
|
+C[S],D[K]=X.u,D[K+1]=X.v,K+=2;K>0&&(j.bindBuffer(j.ARRAY_BUFFER,l.__webglUV2Buffer),j.bufferData(j.ARRAY_BUFFER,D,p))}if(ia){o=0;for(A=s.length;o<A;o++)y[ba]=aa,y[ba+1]=aa+1,y[ba+2]=aa+2,ba+=3,ga[U]=aa,ga[U+1]=aa+1,ga[U+2]=aa,ga[U+3]=aa+2,ga[U+4]=aa+1,ga[U+5]=aa+2,U+=6,aa+=3;o=0;for(A=u.length;o<A;o++)y[ba]=aa,y[ba+1]=aa+1,y[ba+2]=aa+3,y[ba+3]=aa+1,y[ba+4]=aa+2,y[ba+5]=aa+3,ba+=6,ga[U]=aa,ga[U+1]=aa+1,ga[U+2]=aa,ga[U+3]=aa+3,ga[U+4]=aa+1,ga[U+5]=aa+2,ga[U+6]=aa+2,ga[U+7]=aa+3,U+=8,aa+=4;j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,
|
|
|
+l.__webglFaceBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,y,p);j.bindBuffer(j.ELEMENT_ARRAY_BUFFER,l.__webglLineBuffer);j.bufferData(j.ELEMENT_ARRAY_BUFFER,ga,p)}if(Z){S=0;for(aa=Z.length;S<aa;S++)if(y=Z[S],y.__original.needsUpdate){D=0;if(y.size===1)if(y.boundTo===void 0||y.boundTo==="vertices"){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],y.array[D]=y.value[r.a],y.array[D+1]=y.value[r.b],y.array[D+2]=y.value[r.c],D+=3;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],y.array[D]=y.value[r.a],y.array[D+1]=y.value[r.b],
|
|
|
+y.array[D+2]=y.value[r.c],y.array[D+3]=y.value[r.d],D+=4}else{if(y.boundTo==="faces"){o=0;for(A=s.length;o<A;o++)ga=y.value[s[o]],y.array[D]=ga,y.array[D+1]=ga,y.array[D+2]=ga,D+=3;o=0;for(A=u.length;o<A;o++)ga=y.value[u[o]],y.array[D]=ga,y.array[D+1]=ga,y.array[D+2]=ga,y.array[D+3]=ga,D+=4}}else if(y.size===2)if(y.boundTo===void 0||y.boundTo==="vertices"){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+
|
|
|
+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,D+=6;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],r=y.value[r.d],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,y.array[D+6]=r.x,y.array[D+7]=r.y,D+=8}else{if(y.boundTo==="faces"){o=0;for(A=s.length;o<A;o++)v=w=x=ga=y.value[s[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,D+=6;o=0;for(A=u.length;o<A;o++)r=v=w=x=
|
|
|
+ga=y.value[u[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=w.x,y.array[D+3]=w.y,y.array[D+4]=v.x,y.array[D+5]=v.y,y.array[D+6]=r.x,y.array[D+7]=r.y,D+=8}}else if(y.size===3)if(K=y.type==="c"?["r","g","b"]:["x","y","z"],y.boundTo===void 0||y.boundTo==="vertices"){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+
|
|
|
+7]=v[K[1]],y.array[D+8]=v[K[2]],D+=9;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],r=y.value[r.d],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],y.array[D+8]=v[K[2]],y.array[D+9]=r[K[0]],y.array[D+10]=r[K[1]],y.array[D+11]=r[K[2]],D+=12}else{if(y.boundTo==="faces"){o=0;for(A=s.length;o<A;o++)v=w=x=ga=y.value[s[o]],y.array[D]=x[K[0]],y.array[D+
|
|
|
+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],y.array[D+8]=v[K[2]],D+=9;o=0;for(A=u.length;o<A;o++)r=v=w=x=ga=y.value[u[o]],y.array[D]=x[K[0]],y.array[D+1]=x[K[1]],y.array[D+2]=x[K[2]],y.array[D+3]=w[K[0]],y.array[D+4]=w[K[1]],y.array[D+5]=w[K[2]],y.array[D+6]=v[K[0]],y.array[D+7]=v[K[1]],y.array[D+8]=v[K[2]],y.array[D+9]=r[K[0]],y.array[D+10]=r[K[1]],y.array[D+11]=r[K[2]],D+=12}}else if(y.size===4)if(y.boundTo===
|
|
|
+void 0||y.boundTo==="vertices"){o=0;for(A=s.length;o<A;o++)r=ja[s[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,D+=12;o=0;for(A=u.length;o<A;o++)r=ja[u[o]],x=y.value[r.a],w=y.value[r.b],v=y.value[r.c],r=y.value[r.d],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=
|
|
|
+w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,y.array[D+12]=r.x,y.array[D+13]=r.y,y.array[D+14]=r.z,y.array[D+15]=r.w,D+=16}else if(y.boundTo==="faces"){o=0;for(A=s.length;o<A;o++)v=w=x=ga=y.value[s[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,D+=12;o=0;for(A=
|
|
|
+u.length;o<A;o++)r=v=w=x=ga=y.value[u[o]],y.array[D]=x.x,y.array[D+1]=x.y,y.array[D+2]=x.z,y.array[D+3]=x.w,y.array[D+4]=w.x,y.array[D+5]=w.y,y.array[D+6]=w.z,y.array[D+7]=w.w,y.array[D+8]=v.x,y.array[D+9]=v.y,y.array[D+10]=v.z,y.array[D+11]=v.w,y.array[D+12]=r.x,y.array[D+13]=r.y,y.array[D+14]=r.z,y.array[D+15]=r.w,D+=16}j.bindBuffer(j.ARRAY_BUFFER,y.buffer);j.bufferData(j.ARRAY_BUFFER,y.array,p)}}R&&(delete l.__inittedArrays,delete l.__colorArray,delete l.__normalArray,delete l.__tangentArray,delete l.__uvArray,
|
|
|
+delete l.__uv2Array,delete l.__faceArray,delete l.__vertexArray,delete l.__lineArray,delete l.__skinVertexAArray,delete l.__skinVertexBArray,delete l.__skinIndexArray,delete l.__skinWeightArray)}f.__dirtyVertices=!1;f.__dirtyMorphTargets=!1;f.__dirtyElements=!1;f.__dirtyUvs=!1;f.__dirtyNormals=!1;f.__dirtyColors=!1;f.__dirtyTangents=!1;h.attributes&&t(h)}else if(B instanceof THREE.Ribbon){if(f.__dirtyVertices||f.__dirtyColors){h=f;B=j.DYNAMIC_DRAW;o=i=o=R=R=void 0;A=h.vertices;k=h.colors;Z=A.length;
|
|
|
+l=k.length;s=h.__vertexArray;p=h.__colorArray;u=h.__dirtyColors;if(h.__dirtyVertices){for(R=0;R<Z;R++)o=A[R].position,i=R*3,s[i]=o.x,s[i+1]=o.y,s[i+2]=o.z;j.bindBuffer(j.ARRAY_BUFFER,h.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,s,B)}if(u){for(R=0;R<l;R++)o=k[R],i=R*3,p[i]=o.r,p[i+1]=o.g,p[i+2]=o.b;j.bindBuffer(j.ARRAY_BUFFER,h.__webglColorBuffer);j.bufferData(j.ARRAY_BUFFER,p,B)}}f.__dirtyVertices=!1;f.__dirtyColors=!1}else if(B instanceof THREE.Line){h=b(B,l);p=h.attributes&&m(h);if(f.__dirtyVertices||
|
|
|
+f.__dirtyColors||p){B=f;i=j.DYNAMIC_DRAW;Z=k=aa=A=ja=void 0;A=B.vertices;l=B.colors;Z=A.length;p=l.length;s=B.__vertexArray;R=B.__colorArray;u=B.__dirtyColors;o=B.__webglCustomAttributesList;C=U=ba=K=aa=ja=void 0;if(B.__dirtyVertices){for(ja=0;ja<Z;ja++)aa=A[ja].position,k=ja*3,s[k]=aa.x,s[k+1]=aa.y,s[k+2]=aa.z;j.bindBuffer(j.ARRAY_BUFFER,B.__webglVertexBuffer);j.bufferData(j.ARRAY_BUFFER,s,i)}if(u){for(A=0;A<p;A++)Z=l[A],k=A*3,R[k]=Z.r,R[k+1]=Z.g,R[k+2]=Z.b;j.bindBuffer(j.ARRAY_BUFFER,B.__webglColorBuffer);
|
|
|
+j.bufferData(j.ARRAY_BUFFER,R,i)}if(o){ja=0;for(aa=o.length;ja<aa;ja++)if(C=o[ja],C.needsUpdate&&(C.boundTo===void 0||C.boundTo==="vertices")){k=0;ba=C.value.length;if(C.size===1)for(K=0;K<ba;K++)C.array[K]=C.value[K];else if(C.size===2)for(K=0;K<ba;K++)U=C.value[K],C.array[k]=U.x,C.array[k+1]=U.y,k+=2;else if(C.size===3)if(C.type==="c")for(K=0;K<ba;K++)U=C.value[K],C.array[k]=U.r,C.array[k+1]=U.g,C.array[k+2]=U.b,k+=3;else for(K=0;K<ba;K++)U=C.value[K],C.array[k]=U.x,C.array[k+1]=U.y,C.array[k+2]=
|
|
|
+U.z,k+=3;else if(C.size===4)for(K=0;K<ba;K++)U=C.value[K],C.array[k]=U.x,C.array[k+1]=U.y,C.array[k+2]=U.z,C.array[k+3]=U.w,k+=4;j.bindBuffer(j.ARRAY_BUFFER,C.buffer);j.bufferData(j.ARRAY_BUFFER,C.array,i)}}}f.__dirtyVertices=!1;f.__dirtyColors=!1;h.attributes&&t(h)}else if(B instanceof THREE.ParticleSystem)h=b(B,l),p=h.attributes&&m(h),(f.__dirtyVertices||f.__dirtyColors||B.sortParticles||p)&&d(f,j.DYNAMIC_DRAW,B),f.__dirtyVertices=!1,f.__dirtyColors=!1,h.attributes&&t(h)};this.initMaterial=function(a,
|
|
|
+b,c,d){var e,g,f,h;a instanceof THREE.MeshDepthMaterial?h="depth":a instanceof THREE.MeshNormalMaterial?h="normal":a instanceof THREE.MeshBasicMaterial?h="basic":a instanceof THREE.MeshLambertMaterial?h="lambert":a instanceof THREE.MeshPhongMaterial?h="phong":a instanceof THREE.LineBasicMaterial?h="basic":a instanceof THREE.ParticleBasicMaterial&&(h="particle_basic");if(h){var i=THREE.ShaderLib[h];a.uniforms=THREE.UniformsUtils.clone(i.uniforms);a.vertexShader=i.vertexShader;a.fragmentShader=i.fragmentShader}var k,
|
|
|
+l,m;k=m=i=0;for(l=b.length;k<l;k++)f=b[k],f instanceof THREE.SpotLight&&m++,f instanceof THREE.DirectionalLight&&m++,f instanceof THREE.PointLight&&i++;i+m<=O?k=m:(k=Math.ceil(O*m/(i+m)),i=O-k);f={directional:k,point:i};i=m=0;for(k=b.length;i<k;i++)l=b[i],l instanceof THREE.SpotLight&&l.castShadow&&m++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{k=a.fragmentShader;l=a.vertexShader;var i=a.uniforms,b=a.attributes,c={map:!!a.map,envMap:!!a.envMap,lightMap:!!a.lightMap,
|
|
|
+vertexColors:a.vertexColors,fog:c,useFog:a.fog,sizeAttenuation:a.sizeAttenuation,skinning:a.skinning,morphTargets:a.morphTargets,maxMorphTargets:this.maxMorphTargets,maxDirLights:f.directional,maxPointLights:f.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:m,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(k),d.push(l));for(p in c)d.push(p),
|
|
|
+d.push(c[p]);h=d.join();p=0;for(d=P.length;p<d;p++)if(P[p].code===h){o=P[p].program;break a}p=j.createProgram();d=[ta?"#define VERTEX_TEXTURES":"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,"#define MAX_BONES "+c.maxBones,c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":"",
|
|
|
+c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.skinning?"#define USE_SKINNING":"",c.morphTargets?"#define USE_MORPHTARGETS":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.sizeAttenuation?"#define USE_SIZEATTENUATION":"","uniform mat4 objectMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nuniform mat4 cameraInverseMatrix;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\nattribute vec2 uv2;\n#ifdef USE_COLOR\nattribute vec3 color;\n#endif\n#ifdef USE_MORPHTARGETS\nattribute vec3 morphTarget0;\nattribute vec3 morphTarget1;\nattribute vec3 morphTarget2;\nattribute vec3 morphTarget3;\nattribute vec3 morphTarget4;\nattribute vec3 morphTarget5;\nattribute vec3 morphTarget6;\nattribute vec3 morphTarget7;\n#endif\n#ifdef USE_SKINNING\nattribute vec4 skinVertexA;\nattribute vec4 skinVertexB;\nattribute vec4 skinIndex;\nattribute vec4 skinWeight;\n#endif\n"].join("\n");
|
|
|
+f=["#ifdef GL_ES","precision "+X+" float;","#endif","#define MAX_DIR_LIGHTS "+c.maxDirLights,"#define MAX_POINT_LIGHTS "+c.maxPointLights,"#define MAX_SHADOWS "+c.maxShadows,c.alphaTest?"#define ALPHATEST "+c.alphaTest:"",M.gammaInput?"#define GAMMA_INPUT":"",M.gammaOutput?"#define GAMMA_OUTPUT":"",M.physicallyBasedShading?"#define PHYSICALLY_BASED_SHADING":"",c.useFog&&c.fog?"#define USE_FOG":"",c.useFog&&c.fog instanceof THREE.FogExp2?"#define FOG_EXP2":"",c.map?"#define USE_MAP":"",c.envMap?"#define USE_ENVMAP":
|
|
|
+"",c.lightMap?"#define USE_LIGHTMAP":"",c.vertexColors?"#define USE_COLOR":"",c.metal?"#define METAL":"",c.perPixel?"#define PHONG_PER_PIXEL":"",c.shadowMapEnabled?"#define USE_SHADOWMAP":"",c.shadowMapSoft?"#define SHADOWMAP_SOFT":"",c.shadowMapSoft?"#define SHADOWMAP_WIDTH "+c.shadowMapWidth.toFixed(1):"",c.shadowMapSoft?"#define SHADOWMAP_HEIGHT "+c.shadowMapHeight.toFixed(1):"","uniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"].join("\n");j.attachShader(p,v("fragment",f+k));j.attachShader(p,
|
|
|
+v("vertex",d+l));j.linkProgram(p);j.getProgramParameter(p,j.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+j.getProgramParameter(p,j.VALIDATE_STATUS)+", gl error ["+j.getError()+"]");p.uniforms={};p.attributes={};var q,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(q in i)d.push(q);q=d;d=0;for(i=q.length;d<i;d++)k=q[d],p.uniforms[k]=j.getUniformLocation(p,
|
|
|
+k);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(q=0;q<c.maxMorphTargets;q++)d.push("morphTarget"+q);for(o in b)d.push(o);o=d;q=0;for(b=o.length;q<b;q++)c=o[q],p.attributes[c]=j.getAttribLocation(p,c);p.id=P.length;P.push({program:p,code:h});M.info.memory.programs=P.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&j.enableVertexAttribArray(o.position);o.color>=0&&j.enableVertexAttribArray(o.color);o.normal>=0&&j.enableVertexAttribArray(o.normal);
|
|
|
o.tangent>=0&&j.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(j.enableVertexAttribArray(o.skinVertexA),j.enableVertexAttribArray(o.skinVertexB),j.enableVertexAttribArray(o.skinIndex),j.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(g in a.attributes)o[g]!==void 0&&o[g]>=0&&j.enableVertexAttribArray(o[g]);if(a.morphTargets)for(g=a.numSupportedMorphTargets=0;g<this.maxMorphTargets;g++)q="morphTarget"+g,o[q]>=0&&(j.enableVertexAttribArray(o[q]),
|
|
|
a.numSupportedMorphTargets++);a.uniformsList=[];for(e in a.uniforms)a.uniformsList.push([a.uniforms[e],e])};this.setFaceCulling=function(a,b){a?(!b||b==="ccw"?j.frontFace(j.CCW):j.frontFace(j.CW),a==="back"?j.cullFace(j.BACK):a==="front"?j.cullFace(j.FRONT):j.cullFace(j.FRONT_AND_BACK),j.enable(j.CULL_FACE)):j.disable(j.CULL_FACE)}};
|
|
|
THREE.WebGLRenderTarget=function(a,c,b){this.width=a;this.height=c;b=b||{};this.wrapS=b.wrapS!==void 0?b.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=b.wrapT!==void 0?b.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=b.magFilter!==void 0?b.magFilter:THREE.LinearFilter;this.minFilter=b.minFilter!==void 0?b.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=b.format!==void 0?b.format:THREE.RGBAFormat;this.type=b.type!==void 0?b.type:
|
|
@@ -485,22 +486,23 @@ b.object.position.addSelf(c);b.target.addSelf(c);b.staticMoving?p=q:p.addSelf(a.
|
|
|
b.panCamera();b.object.position.add(b.target,f);b.checkDistances();b.object.lookAt(b.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){b.enabled&&(g&&(h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY),l=k=b.getMouseOnScreen(a.clientX,a.clientY),p=q=b.getMouseOnScreen(a.clientX,a.clientY),g=!1),e!==d.NONE&&(e===d.ROTATE?i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?k=b.getMouseOnScreen(a.clientX,
|
|
|
a.clientY):e===d.PAN&&!b.noPan&&(q=b.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(b.enabled&&(a.preventDefault(),a.stopPropagation(),e===d.NONE))e=a.button,e===d.ROTATE?h=i=b.getMouseProjectionOnBall(a.clientX,a.clientY):e===d.ZOOM&&!b.noZoom?l=k=b.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(p=q=b.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",function(a){if(b.enabled)a.preventDefault(),a.stopPropagation(),
|
|
|
e=d.NONE},!1);window.addEventListener("keydown",function(a){if(b.enabled&&e===d.NONE){if(a.keyCode===b.keys[d.ROTATE])e=d.ROTATE;else if(a.keyCode===b.keys[d.ZOOM]&&!b.noZoom)e=d.ZOOM;else if(a.keyCode===b.keys[d.PAN]&&!b.noPan)e=d.PAN;e!==d.NONE&&(g=!0)}},!1);window.addEventListener("keyup",function(){if(b.enabled&&e!==d.NONE)e=d.NONE},!1)};
|
|
|
-THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,k,m){var n,o,p=d||1,q=g||1,s=h/2,r=i/2,t=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",q=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",p=e||1;var u=p+1,I=q+1;h/=p;var P=i/q;for(o=0;o<I;o++)for(i=0;i<u;i++){var M=new THREE.Vector3;M[a]=(i*h-s)*c;M[b]=(o*P-r)*f;M[n]=k;l.vertices.push(new THREE.Vertex(M))}for(o=0;o<q;o++)for(i=0;i<p;i++)l.faces.push(new THREE.Face4(i+
|
|
|
-u*o+t,i+u*(o+1)+t,i+1+u*(o+1)+t,i+1+u*o+t,null,null,m)),l.faceVertexUvs[0].push([new THREE.UV(i/p,o/q),new THREE.UV(i/p,(o+1)/q),new THREE.UV((i+1)/p,(o+1)/q),new THREE.UV((i+1)/p,o/q)])}THREE.Geometry.call(this);var l=this,k=a/2,p=c/2,q=b/2,m,t,n,o,s,u;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;o=1;t=2;s=3;n=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var r in h)this.sides[r]!=
|
|
|
-void 0&&(this.sides[r]=h[r]);this.sides.px&&i("z","y",-1,-1,b,c,k,m);this.sides.nx&&i("z","y",1,-1,b,c,-k,o);this.sides.py&&i("x","z",1,1,a,b,p,t);this.sides.ny&&i("x","z",1,-1,a,b,-p,s);this.sides.pz&&i("x","y",1,-1,a,c,q,n);this.sides.nz&&i("x","y",-1,-1,a,c,-q,u);this.mergeVertices();this.computeCentroids();this.computeFaceNormals()};THREE.CubeGeometry.prototype=new THREE.Geometry;THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
+THREE.CubeGeometry=function(a,c,b,d,g,e,f,h){function i(a,b,c,f,h,i,k,m){var n,o=d||1,p=g||1,q=h/2,s=i/2,t=l.vertices.length;if(a==="x"&&b==="y"||a==="y"&&b==="x")n="z";else if(a==="x"&&b==="z"||a==="z"&&b==="x")n="y",p=e||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=e||1;var r=o+1,u=p+1,I=h/o,O=i/p,M=new THREE.Vector3;M[n]=k>0?1:-1;for(h=0;h<u;h++)for(i=0;i<r;i++){var j=new THREE.Vector3;j[a]=(i*I-q)*c;j[b]=(h*O-s)*f;j[n]=k;l.vertices.push(new THREE.Vertex(j))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
|
|
|
+new THREE.Face4(i+r*h+t,i+r*(h+1)+t,i+1+r*(h+1)+t,i+1+r*h+t),a.normal.copy(M),a.vertexNormals.push(M.clone(),M.clone(),M.clone(),M.clone()),a.materialIndex=m,l.faces.push(a),l.faceVertexUvs[0].push([new THREE.UV(i/o,h/p),new THREE.UV(i/o,(h+1)/p),new THREE.UV((i+1)/o,(h+1)/p),new THREE.UV((i+1)/o,h/p)])}THREE.Geometry.call(this);var l=this,k=a/2,p=c/2,q=b/2,m,t,n,o,s,u;if(f!==void 0){if(f instanceof Array)this.materials=f;else{this.materials=[];for(m=0;m<6;m++)this.materials.push(f)}m=0;o=1;t=2;s=
|
|
|
+3;n=4;u=5}else this.materials=[];this.sides={px:!0,nx:!0,py:!0,ny:!0,pz:!0,nz:!0};if(h!=void 0)for(var r in h)this.sides[r]!=void 0&&(this.sides[r]=h[r]);this.sides.px&&i("z","y",-1,-1,b,c,k,m);this.sides.nx&&i("z","y",1,-1,b,c,-k,o);this.sides.py&&i("x","z",1,1,a,b,p,t);this.sides.ny&&i("x","z",1,-1,a,b,-p,s);this.sides.pz&&i("x","y",1,-1,a,c,q,n);this.sides.nz&&i("x","y",-1,-1,a,c,-q,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
+THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
THREE.CylinderGeometry=function(a,c,b,d,g,e){THREE.Geometry.call(this);var a=a!=null?a:20,c=c!=null?c:20,b=b||100,f=b/2,d=d||8,g=g||1,h,i,l=[],k=[];for(i=0;i<=g;i++){var p=[],q=[],m=i/g,t=m*(c-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(t*Math.sin(n*Math.PI*2),-m*b+f,t*Math.cos(n*Math.PI*2))));p.push(this.vertices.length-1);q.push(new THREE.UV(n,m))}l.push(p);k.push(q)}for(i=0;i<g;i++)for(h=0;h<d;h++){var b=l[i][h],p=l[i+1][h],q=l[i+1][h+1],m=l[i][h+1],t=
|
|
|
-this.vertices[b].position.clone().setY(0).normalize(),n=this.vertices[p].position.clone().setY(0).normalize(),o=this.vertices[q].position.clone().setY(0).normalize(),s=this.vertices[m].position.clone().setY(0).normalize(),u=k[i][h].clone(),r=k[i+1][h].clone(),y=k[i+1][h+1].clone(),v=k[i][h+1].clone();this.faces.push(new THREE.Face4(b,p,q,m,[t,n,o,s]));this.faceVertexUvs[0].push([u,r,y,v])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)b=l[0][h],p=l[0][h+
|
|
|
-1],q=this.vertices.length-1,t=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),u=k[0][h].clone(),r=k[0][h+1].clone(),y=new THREE.UV(r.u,0),this.faces.push(new THREE.Face3(b,p,q,[t,n,o])),this.faceVertexUvs[0].push([u,r,y])}if(!e&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)b=l[i][h+1],p=l[i][h],q=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,0),u=k[i][h+1].clone(),r=k[i][h].clone(),
|
|
|
-y=new THREE.UV(r.u,1),this.faces.push(new THREE.Face3(b,p,q,[t,n,o])),this.faceVertexUvs[0].push([u,r,y])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+this.vertices[b].position.clone().setY(0).normalize(),n=this.vertices[p].position.clone().setY(0).normalize(),o=this.vertices[q].position.clone().setY(0).normalize(),s=this.vertices[m].position.clone().setY(0).normalize(),u=k[i][h].clone(),r=k[i+1][h].clone(),z=k[i+1][h+1].clone(),E=k[i][h+1].clone();this.faces.push(new THREE.Face4(b,p,q,m,[t,n,o,s]));this.faceVertexUvs[0].push([u,r,z,E])}if(!e&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)b=l[0][h],p=l[0][h+
|
|
|
+1],q=this.vertices.length-1,t=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),o=new THREE.Vector3(0,1,0),u=k[0][h].clone(),r=k[0][h+1].clone(),z=new THREE.UV(r.u,0),this.faces.push(new THREE.Face3(b,p,q,[t,n,o])),this.faceVertexUvs[0].push([u,r,z])}if(!e&&c>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)b=l[i][h+1],p=l[i][h],q=this.vertices.length-1,t=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),o=new THREE.Vector3(0,-1,0),u=k[i][h+1].clone(),r=k[i][h].clone(),
|
|
|
+z=new THREE.UV(r.u,1),this.faces.push(new THREE.Face3(b,p,q,[t,n,o])),this.faceVertexUvs[0].push([u,r,z])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
THREE.ExtrudeGeometry=function(a,c){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],b,d=a.length,g;this.shapebb=a[d-1].getBoundingBox();for(b=0;b<d;b++)g=a[b],this.addShape(g,c);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,c){function b(a,b,c){b||console.log("die");return b.clone().multiplyScalar(c).addSelf(a)}function d(a,b,c){var d=THREE.ExtrudeGeometry.__v1,e=THREE.ExtrudeGeometry.__v2,f=THREE.ExtrudeGeometry.__v3,g=THREE.ExtrudeGeometry.__v4,h=THREE.ExtrudeGeometry.__v5,i=THREE.ExtrudeGeometry.__v6;d.set(a.x-b.x,a.y-b.y);e.set(a.x-c.x,a.y-c.y);d=d.normalize();e=e.normalize();f.set(-d.y,d.x);g.set(e.y,-e.x);h.copy(a).addSelf(f);i.copy(a).addSelf(g);if(h.equals(i))return g.clone();
|
|
|
-h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(A=a.length;--A>=0;){j=A;V=A-1;V<0&&(V=a.length-1);for(var b=
|
|
|
-0,c=m+k*2,b=0;b<c;b++){var d=X*b,e=X*(b+1),f=Z+j+d,g=Z+j+e,l=f,d=Z+V+d,e=Z+V+e,n=g;l+=D;d+=D;e+=D;n+=D;w.faces.push(new THREE.Face4(l,d,e,n,null,null,y));y&&(l=b/c,d=(b+1)/c,e=h+i*2,f=(w.vertices[f].position.z+i)/e,g=(w.vertices[g].position.z+i)/e,w.faceVertexUvs[0].push([new THREE.UV(f,l),new THREE.UV(g,l),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){w.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=D;b+=D;c+=D;w.faces.push(new THREE.Face3(a,b,c,null,
|
|
|
-null,r));if(r){var d=v.maxY,e=v.maxX,f=w.vertices[b].position.x,b=w.vertices[b].position.y,g=w.vertices[c].position.x,c=w.vertices[c].position.y;w.faceVertexUvs[0].push([new THREE.UV(w.vertices[a].position.x/e,w.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,l=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,q=c.curveSegments!==
|
|
|
-void 0?c.curveSegments:12,m=c.steps!==void 0?c.steps:1,t=c.bendPath,n=c.extrudePath,o,s=!1,u=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,r=c.material,y=c.extrudeMaterial,v=this.shapebb;if(n)o=n.getPoints(q),m=o.length,s=!0,p=!1;p||(l=i=k=0);var G,B,H,w=this,D=this.vertices.length;t&&a.addWrapPath(t);q=u?a.extractAllSpacedPoints(q):a.extractAllPoints(q);t=q.shape;q=q.holes;if(n=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();B=0;for(H=q.length;B<H;B++)G=q[B],THREE.Shape.Utils.isClockWise(G)&&
|
|
|
-(q[B]=G.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(t,q);u=t;B=0;for(H=q.length;B<H;B++)G=q[B],t=t.concat(G);var A,K,L,S,W,U,X=t.length,$=n.length,E=[];A=0;K=u.length;j=K-1;for(V=A+1;A<K;A++,j++,V++)j===K&&(j=0),V===K&&(V=0),E[A]=d(u[A],u[j],u[V]);var I=[],P,M=E.concat();B=0;for(H=q.length;B<H;B++){G=q[B];P=[];A=0;K=G.length;j=K-1;for(V=A+1;A<K;A++,j++,V++)j===K&&(j=0),V===K&&(V=0),P[A]=d(G[A],G[j],G[V]);I.push(P);M=M.concat(P)}for(L=0;L<k;L++){S=L/k;W=i*(1-S);S=l*Math.sin(S*Math.PI/2);A=
|
|
|
-0;for(K=u.length;A<K;A++)U=b(u[A],E[A],S),e(U.x,U.y,-W);B=0;for(H=q.length;B<H;B++){G=q[B];P=I[B];A=0;for(K=G.length;A<K;A++)U=b(G[A],P[A],S),e(U.x,U.y,-W)}}S=l;for(A=0;A<X;A++)U=p?b(t[A],M[A],S):t[A],s?e(U.x,U.y+o[0].y,o[0].x):e(U.x,U.y,0);for(L=1;L<=m;L++)for(A=0;A<X;A++)U=p?b(t[A],M[A],S):t[A],s?e(U.x,U.y+o[L-1].y,o[L-1].x):e(U.x,U.y,h/m*L);for(L=k-1;L>=0;L--){S=L/k;W=i*(1-S);S=l*Math.sin(S*Math.PI/2);A=0;for(K=u.length;A<K;A++)U=b(u[A],E[A],S),e(U.x,U.y,h+W);B=0;for(H=q.length;B<H;B++){G=q[B];
|
|
|
-P=I[B];A=0;for(K=G.length;A<K;A++)U=b(G[A],P[A],S),s?e(U.x,U.y+o[m-1].y,o[m-1].x+W):e(U.x,U.y,h+W)}}if(p){p=X*0;for(A=0;A<$;A++)l=n[A],f(l[2]+p,l[1]+p,l[0]+p);p=X*(m+k*2);for(A=0;A<$;A++)l=n[A],f(l[0]+p,l[1]+p,l[2]+p)}else{for(A=0;A<$;A++)l=n[A],f(l[2],l[1],l[0]);for(A=0;A<$;A++)l=n[A],f(l[0]+X*m,l[1]+X*m,l[2]+X*m)}var j,V,Z=0;g(u);Z+=u.length;B=0;for(H=q.length;B<H;B++)G=q[B],g(G),Z+=G.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
+h.copy(b).addSelf(f);i.copy(c).addSelf(g);f=d.dot(g);g=i.subSelf(h).dot(g);f===0&&(console.log("Either infinite or no solutions!"),g===0?console.log("Its finite solutions."):console.log("Too bad, no solutions."));g/=f;if(g<0)return b=Math.atan2(b.y-a.y,b.x-a.x),a=Math.atan2(c.y-a.y,c.x-a.x),b>a&&(a+=Math.PI*2),a=(b+a)/2,new THREE.Vector2(-Math.cos(a),-Math.sin(a));return d.multiplyScalar(g).addSelf(h).subSelf(a).clone()}function g(a){for(B=a.length;--B>=0;){j=B;P=B-1;P<0&&(P=a.length-1);for(var b=
|
|
|
+0,c=m+k*2,b=0;b<c;b++){var d=ea*b,e=ea*(b+1),f=ha+j+d,g=ha+j+e,l=f,d=ha+P+d,e=ha+P+e,n=g;l+=F;d+=F;e+=F;n+=F;C.faces.push(new THREE.Face4(l,d,e,n,null,null,z));z&&(l=b/c,d=(b+1)/c,e=h+i*2,f=(C.vertices[f].position.z+i)/e,g=(C.vertices[g].position.z+i)/e,C.faceVertexUvs[0].push([new THREE.UV(f,l),new THREE.UV(g,l),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function e(a,b,c){C.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=F;b+=F;c+=F;C.faces.push(new THREE.Face3(a,b,c,
|
|
|
+null,null,r));if(r){var d=E.maxY,e=E.maxX,f=C.vertices[b].position.x,b=C.vertices[b].position.y,g=C.vertices[c].position.x,c=C.vertices[c].position.y;C.faceVertexUvs[0].push([new THREE.UV(C.vertices[a].position.x/e,C.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=c.amount!==void 0?c.amount:100,i=c.bevelThickness!==void 0?c.bevelThickness:6,l=c.bevelSize!==void 0?c.bevelSize:i-2,k=c.bevelSegments!==void 0?c.bevelSegments:3,p=c.bevelEnabled!==void 0?c.bevelEnabled:!0,
|
|
|
+q=c.curveSegments!==void 0?c.curveSegments:12,m=c.steps!==void 0?c.steps:1,t=c.bendPath,n=c.extrudePath,o,s=!1,u=c.useSpacedPoints!==void 0?c.useSpacedPoints:!1,r=c.material,z=c.extrudeMaterial,E=this.shapebb;if(n)o=n.getPoints(q),m=o.length,s=!0,p=!1;p||(l=i=k=0);var G,v,w,C=this,F=this.vertices.length;t&&a.addWrapPath(t);q=u?a.extractAllSpacedPoints(q):a.extractAllPoints(q);t=q.shape;q=q.holes;if(n=!THREE.Shape.Utils.isClockWise(t)){t=t.reverse();v=0;for(w=q.length;v<w;v++)G=q[v],THREE.Shape.Utils.isClockWise(G)&&
|
|
|
+(q[v]=G.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(t,q);u=t;v=0;for(w=q.length;v<w;v++)G=q[v],t=t.concat(G);var B,L,J,W,X,T,ea=t.length,ba=n.length,x=[];B=0;L=u.length;j=L-1;for(P=B+1;B<L;B++,j++,P++)j===L&&(j=0),P===L&&(P=0),x[B]=d(u[B],u[j],u[P]);var I=[],O,M=x.concat();v=0;for(w=q.length;v<w;v++){G=q[v];O=[];B=0;L=G.length;j=L-1;for(P=B+1;B<L;B++,j++,P++)j===L&&(j=0),P===L&&(P=0),O[B]=d(G[B],G[j],G[P]);I.push(O);M=M.concat(O)}for(J=0;J<k;J++){W=J/k;X=i*(1-W);W=l*Math.sin(W*Math.PI/2);
|
|
|
+B=0;for(L=u.length;B<L;B++)T=b(u[B],x[B],W),e(T.x,T.y,-X);v=0;for(w=q.length;v<w;v++){G=q[v];O=I[v];B=0;for(L=G.length;B<L;B++)T=b(G[B],O[B],W),e(T.x,T.y,-X)}}W=l;for(B=0;B<ea;B++)T=p?b(t[B],M[B],W):t[B],s?e(T.x,T.y+o[0].y,o[0].x):e(T.x,T.y,0);for(J=1;J<=m;J++)for(B=0;B<ea;B++)T=p?b(t[B],M[B],W):t[B],s?e(T.x,T.y+o[J-1].y,o[J-1].x):e(T.x,T.y,h/m*J);for(J=k-1;J>=0;J--){W=J/k;X=i*(1-W);W=l*Math.sin(W*Math.PI/2);B=0;for(L=u.length;B<L;B++)T=b(u[B],x[B],W),e(T.x,T.y,h+X);v=0;for(w=q.length;v<w;v++){G=
|
|
|
+q[v];O=I[v];B=0;for(L=G.length;B<L;B++)T=b(G[B],O[B],W),s?e(T.x,T.y+o[m-1].y,o[m-1].x+X):e(T.x,T.y,h+X)}}if(p){p=ea*0;for(B=0;B<ba;B++)l=n[B],f(l[2]+p,l[1]+p,l[0]+p);p=ea*(m+k*2);for(B=0;B<ba;B++)l=n[B],f(l[0]+p,l[1]+p,l[2]+p)}else{for(B=0;B<ba;B++)l=n[B],f(l[2],l[1],l[0]);for(B=0;B<ba;B++)l=n[B],f(l[0]+ea*m,l[1]+ea*m,l[2]+ea*m)}var j,P,ha=0;g(u);ha+=u.length;v=0;for(w=q.length;v<w;v++)G=q[v],g(G),ha+=G.length};THREE.ExtrudeGeometry.__v1=new THREE.Vector2;THREE.ExtrudeGeometry.__v2=new THREE.Vector2;
|
|
|
THREE.ExtrudeGeometry.__v3=new THREE.Vector2;THREE.ExtrudeGeometry.__v4=new THREE.Vector2;THREE.ExtrudeGeometry.__v5=new THREE.Vector2;THREE.ExtrudeGeometry.__v6=new THREE.Vector2;
|
|
|
THREE.IcosahedronGeometry=function(a){function c(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return g.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function b(a,b,c,d){d.faces.push(new THREE.Face3(a,b,c))}function d(a,b){var d=g.vertices[a].position,e=g.vertices[b].position;return c((d.x+e.x)/2,(d.y+e.y)/2,(d.z+e.z)/2)}var g=this,e=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;c(-1,a,0);c(1,a,0);c(-1,-a,0);c(1,-a,0);c(0,-1,a);c(0,1,a);c(0,-1,
|
|
|
-a);c(0,1,-a);c(a,0,-1);c(a,0,1);c(-a,0,-1);c(-a,0,1);b(0,11,5,e);b(0,5,1,e);b(0,1,7,e);b(0,7,10,e);b(0,10,11,e);b(1,5,9,e);b(5,11,4,e);b(11,10,2,e);b(10,7,6,e);b(7,1,8,e);b(3,9,4,e);b(3,4,2,e);b(3,2,6,e);b(3,6,8,e);b(3,8,9,e);b(4,9,5,e);b(2,4,11,e);b(6,2,10,e);b(8,6,7,e);b(9,8,1,e);for(var f=0;f<this.subdivisions;f++){var a=new THREE.Geometry,h;for(h in e.faces){var i=d(e.faces[h].a,e.faces[h].b),l=d(e.faces[h].b,e.faces[h].c),k=d(e.faces[h].c,e.faces[h].a);b(e.faces[h].a,i,k,a);b(e.faces[h].b,l,
|
|
@@ -511,8 +513,8 @@ THREE.OctahedronGeometry=function(a,c){function b(b){var c=b.clone().normalize()
|
|
|
f.faces.push(h),h=Math.atan2(h.centroid.z,-h.centroid.x),f.faceVertexUvs[0].push([e(a.uv,a.position,h),e(b.uv,b.position,h),e(c.uv,c.position,h)])):(h-=1,d(a,g(a,b),g(a,c),h),d(g(a,b),b,g(b,c),h),d(g(a,c),g(b,c),c,h),d(g(a,b),g(b,c),g(a,c),h))}function g(a,c){h[a.index]||(h[a.index]=[]);h[c.index]||(h[c.index]=[]);var d=h[a.index][c.index];d===void 0&&(h[a.index][c.index]=h[c.index][a.index]=d=b((new THREE.Vector3).add(a.position,c.position).divideScalar(2)));return d}function e(a,b,c){c<0&&a.u===
|
|
|
1&&(a=new THREE.UV(a.u-1,a.v));b.x===0&&b.z===0&&(a=new THREE.UV(c/2/Math.PI+0.5,a.v));return a}THREE.Geometry.call(this);var c=c||0,f=this;b(new THREE.Vector3(1,0,0));b(new THREE.Vector3(-1,0,0));b(new THREE.Vector3(0,1,0));b(new THREE.Vector3(0,-1,0));b(new THREE.Vector3(0,0,1));b(new THREE.Vector3(0,0,-1));var h=[],i=this.vertices;d(i[0],i[2],i[4],c);d(i[0],i[4],i[3],c);d(i[0],i[3],i[5],c);d(i[0],i[5],i[2],c);d(i[1],i[2],i[5],c);d(i[1],i[5],i[3],c);d(i[1],i[3],i[4],c);d(i[1],i[4],i[2],c);this.boundingSphere=
|
|
|
{radius:a}};THREE.OctahedronGeometry.prototype=new THREE.Geometry;THREE.OctahedronGeometry.prototype.constructor=THREE.OctahedronGeometry;
|
|
|
-THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);var g,e=a/2,f=c/2,b=b||1,d=d||1,h=b+1,i=d+1;a/=b;var l=c/d;for(g=0;g<i;g++)for(c=0;c<h;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*a-e,-(g*l-f),0)));for(g=0;g<d;g++)for(c=0;c<b;c++)this.faces.push(new THREE.Face4(c+h*g,c+h*(g+1),c+1+h*(g+1),c+1+h*g)),this.faceVertexUvs[0].push([new THREE.UV(c/b,g/d),new THREE.UV(c/b,(g+1)/d),new THREE.UV((c+1)/b,(g+1)/d),new THREE.UV((c+1)/b,g/d)]);this.computeCentroids();this.computeFaceNormals()};
|
|
|
-THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
+THREE.PlaneGeometry=function(a,c,b,d){THREE.Geometry.call(this);for(var g=a/2,e=c/2,b=b||1,d=d||1,f=b+1,h=d+1,i=a/b,l=c/d,k=new THREE.Vector3(0,0,1),a=0;a<h;a++)for(c=0;c<f;c++)this.vertices.push(new THREE.Vertex(new THREE.Vector3(c*i-g,-(a*l-e),0)));for(a=0;a<d;a++)for(c=0;c<b;c++)g=new THREE.Face4(c+f*a,c+f*(a+1),c+1+f*(a+1),c+1+f*a),g.normal.copy(k),g.vertexNormals.push(k.clone(),k.clone(),k.clone(),k.clone()),this.faces.push(g),this.faceVertexUvs[0].push([new THREE.UV(c/b,a/d),new THREE.UV(c/
|
|
|
+b,(a+1)/d),new THREE.UV((c+1)/b,(a+1)/d),new THREE.UV((c+1)/b,a/d)]);this.computeCentroids()};THREE.PlaneGeometry.prototype=new THREE.Geometry;THREE.PlaneGeometry.prototype.constructor=THREE.PlaneGeometry;
|
|
|
THREE.SphereGeometry=function(a,c,b){THREE.Geometry.call(this);for(var a=a||50,d,g=Math.PI,e=Math.max(3,c||8),f=Math.max(2,b||6),c=[],b=0;b<f+1;b++){d=b/f;var h=a*Math.cos(d*g),i=a*Math.sin(d*g),l=[],k=0;for(d=0;d<e;d++){var p=2*d/e,q=i*Math.sin(p*g),p=i*Math.cos(p*g);(b==0||b==f)&&d>0||(k=this.vertices.push(new THREE.Vertex(new THREE.Vector3(p,h,q)))-1);l.push(k)}c.push(l)}for(var m,t,n,g=c.length,b=0;b<g;b++)if(e=c[b].length,b>0)for(d=0;d<e;d++){l=d==e-1;f=c[b][l?0:d+1];h=c[b][l?e-1:d];i=c[b-1][l?
|
|
|
e-1:d];l=c[b-1][l?0:d+1];q=b/(g-1);m=(b-1)/(g-1);t=(d+1)/e;var p=d/e,k=new THREE.UV(1-t,q),q=new THREE.UV(1-p,q),p=new THREE.UV(1-p,m),o=new THREE.UV(1-t,m);b<c.length-1&&(m=this.vertices[f].position.clone(),t=this.vertices[h].position.clone(),n=this.vertices[i].position.clone(),m.normalize(),t.normalize(),n.normalize(),this.faces.push(new THREE.Face3(f,h,i,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(n.x,n.y,n.z)])),this.faceVertexUvs[0].push([k,q,p]));b>1&&(m=
|
|
|
this.vertices[f].position.clone(),t=this.vertices[i].position.clone(),n=this.vertices[l].position.clone(),m.normalize(),t.normalize(),n.normalize(),this.faces.push(new THREE.Face3(f,i,l,[new THREE.Vector3(m.x,m.y,m.z),new THREE.Vector3(t.x,t.y,t.z),new THREE.Vector3(n.x,n.y,n.z)])),this.faceVertexUvs[0].push([k,p,o]))}this.computeCentroids();this.computeFaceNormals();this.computeVertexNormals();this.boundingSphere={radius:a}};THREE.SphereGeometry.prototype=new THREE.Geometry;
|
|
@@ -523,9 +525,9 @@ THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:
|
|
|
0,g=String(a).split(""),e=g.length,f=[],a=0;a<e;a++){var h=new THREE.Path,h=this.extractGlyphPoints(g[a],c,b,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,c,b,d,g){var e=[],f,h,i,l,k,p,q,m,t,n,o,s=c.glyphs[a]||c.glyphs["?"];if(s){if(s.o){c=s._cachedOutline||(s._cachedOutline=s.o.split(" "));l=c.length;for(a=0;a<l;)switch(i=c[a++],i){case "m":i=c[a++]*b+d;k=c[a++]*b;e.push(new THREE.Vector2(i,k));g.moveTo(i,k);break;case "l":i=c[a++]*b+d;k=c[a++]*b;e.push(new THREE.Vector2(i,
|
|
|
k));g.lineTo(i,k);break;case "q":i=c[a++]*b+d;k=c[a++]*b;m=c[a++]*b+d;t=c[a++]*b;g.quadraticCurveTo(m,t,i,k);if(f=e[e.length-1]){p=f.x;q=f.y;f=1;for(h=this.divisions;f<=h;f++){var u=f/h,r=THREE.Shape.Utils.b2(u,p,m,i),u=THREE.Shape.Utils.b2(u,q,t,k);e.push(new THREE.Vector2(r,u))}}break;case "b":if(i=c[a++]*b+d,k=c[a++]*b,m=c[a++]*b+d,t=c[a++]*-b,n=c[a++]*b+d,o=c[a++]*-b,g.bezierCurveTo(i,k,m,t,n,o),f=e[e.length-1]){p=f.x;q=f.y;f=1;for(h=this.divisions;f<=h;f++)u=f/h,r=THREE.Shape.Utils.b3(u,p,m,
|
|
|
n,i),u=THREE.Shape.Utils.b3(u,q,t,o,k),e.push(new THREE.Vector2(r,u))}}}return{offset:s.ha*b,points:e,path:g}}}};
|
|
|
-(function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,l,k;if(c(a)>0)for(l=0;l<g;l++)f[l]=l;else for(l=0;l<g;l++)f[l]=g-1-l;var p=2*g;for(l=g-1;g>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=l;g<=i&&(i=0);l=i+1;g<=l&&(l=0);k=l+1;g<=k&&(k=0);var q;a:{q=a;var m=i,t=l,n=k,o=g,s=f,u=void 0,r=void 0,y=void 0,
|
|
|
-v=void 0,G=void 0,B=void 0,H=void 0,w=void 0,D=void 0,r=q[s[m]].x,y=q[s[m]].y,v=q[s[t]].x,G=q[s[t]].y,B=q[s[n]].x,H=q[s[n]].y;if(1.0E-10>(v-r)*(H-y)-(G-y)*(B-r))q=!1;else{for(u=0;u<o;u++)if(!(u==m||u==t||u==n)){var w=q[s[u]].x,D=q[s[u]].y,A=void 0,K=void 0,L=void 0,S=void 0,W=void 0,U=void 0,X=void 0,$=void 0,E=void 0,I=void 0,P=void 0,M=void 0,A=L=W=void 0,A=B-v,K=H-G,L=r-B,S=y-H,W=v-r,U=G-y,X=w-r,$=D-y,E=w-v,I=D-G,P=w-B,M=D-H,A=A*I-K*E,W=W*$-U*X,L=L*M-S*P;if(A>=0&&L>=0&&W>=0){q=!1;break a}}q=!0}}if(q){e.push([a[f[i]],
|
|
|
-a[f[l]],a[f[k]]]);h.push([f[i],f[l],f[k]]);i=l;for(k=l+1;k<g;i++,k++)f[i]=f[k];g--;p=2*g}}if(d)return h;return e};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
+(function(a){var c=function(a){for(var c=a.length,g=0,e=c-1,f=0;f<c;e=f++)g+=a[e].x*a[f].y-a[f].x*a[e].y;return g*0.5};a.Triangulate=function(a,d){var g=a.length;if(g<3)return null;var e=[],f=[],h=[],i,l,k;if(c(a)>0)for(l=0;l<g;l++)f[l]=l;else for(l=0;l<g;l++)f[l]=g-1-l;var p=2*g;for(l=g-1;g>2;){if(p--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return e}i=l;g<=i&&(i=0);l=i+1;g<=l&&(l=0);k=l+1;g<=k&&(k=0);var q;a:{q=a;var m=i,t=l,n=k,o=g,s=f,u=void 0,r=void 0,z=void 0,
|
|
|
+E=void 0,G=void 0,v=void 0,w=void 0,C=void 0,F=void 0,r=q[s[m]].x,z=q[s[m]].y,E=q[s[t]].x,G=q[s[t]].y,v=q[s[n]].x,w=q[s[n]].y;if(1.0E-10>(E-r)*(w-z)-(G-z)*(v-r))q=!1;else{for(u=0;u<o;u++)if(!(u==m||u==t||u==n)){var C=q[s[u]].x,F=q[s[u]].y,B=void 0,L=void 0,J=void 0,W=void 0,X=void 0,T=void 0,ea=void 0,ba=void 0,x=void 0,I=void 0,O=void 0,M=void 0,B=J=X=void 0,B=v-E,L=w-G,J=r-v,W=z-w,X=E-r,T=G-z,ea=C-r,ba=F-z,x=C-E,I=F-G,O=C-v,M=F-w,B=B*I-L*x,X=X*ba-T*ea,J=J*M-W*O;if(B>=0&&J>=0&&X>=0){q=!1;break a}}q=
|
|
|
+!0}}if(q){e.push([a[f[i]],a[f[l]],a[f[k]]]);h.push([f[i],f[l],f[k]]);i=l;for(k=l+1;k<g;i++,k++)f[i]=f[k];g--;p=2*g}}if(d)return h;return e};a.Triangulate.area=c;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(a,c,b,d,g){THREE.Geometry.call(this);this.radius=a||100;this.tube=c||40;this.segmentsR=b||8;this.segmentsT=d||6;this.arc=g||Math.PI*2;g=new THREE.Vector3;a=[];c=[];for(b=0;b<=this.segmentsR;b++)for(d=0;d<=this.segmentsT;d++){var e=d/this.segmentsT*this.arc,f=b/this.segmentsR*Math.PI*2;g.x=this.radius*Math.cos(e);g.y=this.radius*Math.sin(e);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(e);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(e);h.z=
|
|
|
this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-b/this.segmentsR));c.push(h.clone().subSelf(g).normalize())}for(b=1;b<=this.segmentsR;b++)for(d=1;d<=this.segmentsT;d++){var g=(this.segmentsT+1)*b+d-1,e=(this.segmentsT+1)*(b-1)+d-1,f=(this.segmentsT+1)*(b-1)+d,h=(this.segmentsT+1)*b+d,i=new THREE.Face4(g,e,f,h,[c[g],c[e],c[f],c[h]]);i.normal.addSelf(c[g]);i.normal.addSelf(c[e]);i.normal.addSelf(c[f]);i.normal.addSelf(c[h]);i.normal.normalize();this.faces.push(i);
|
|
|
this.faceVertexUvs[0].push([a[g].clone(),a[e].clone(),a[f].clone(),a[h].clone()])}this.computeCentroids()};THREE.TorusGeometry.prototype=new THREE.Geometry;THREE.TorusGeometry.prototype.constructor=THREE.TorusGeometry;
|
|
@@ -533,13 +535,13 @@ THREE.TorusKnotGeometry=function(a,c,b,d,g,e,f){function h(a,b,c,d,e,f){b=c/d*a;
|
|
|
this.segmentsT;++c){var i=a/this.segmentsR*2*this.p*Math.PI,f=c/this.segmentsT*2*Math.PI,g=h(i,f,this.q,this.p,this.radius,this.heightScale),i=h(i+0.01,f,this.q,this.p,this.radius,this.heightScale);b.x=i.x-g.x;b.y=i.y-g.y;b.z=i.z-g.z;d.x=i.x+g.x;d.y=i.y+g.y;d.z=i.z+g.z;e.cross(b,d);d.cross(e,b);e.normalize();d.normalize();i=-this.tube*Math.cos(f);f=this.tube*Math.sin(f);g.x+=i*d.x+f*e.x;g.y+=i*d.y+f*e.y;g.z+=i*d.z+f*e.z;this.grid[a][c]=this.vertices.push(new THREE.Vertex(new THREE.Vector3(g.x,g.y,
|
|
|
g.z)))-1}}for(a=0;a<this.segmentsR;++a)for(c=0;c<this.segmentsT;++c){var d=(a+1)%this.segmentsR,e=(c+1)%this.segmentsT,g=this.grid[a][c],b=this.grid[d][c],d=this.grid[d][e],e=this.grid[a][e],f=new THREE.UV(a/this.segmentsR,c/this.segmentsT),i=new THREE.UV((a+1)/this.segmentsR,c/this.segmentsT),l=new THREE.UV((a+1)/this.segmentsR,(c+1)/this.segmentsT),k=new THREE.UV(a/this.segmentsR,(c+1)/this.segmentsT);this.faces.push(new THREE.Face4(g,b,d,e));this.faceVertexUvs[0].push([f,i,l,k])}this.computeCentroids();
|
|
|
this.computeFaceNormals();this.computeVertexNormals()};THREE.TorusKnotGeometry.prototype=new THREE.Geometry;THREE.TorusKnotGeometry.prototype.constructor=THREE.TorusKnotGeometry;THREE.SubdivisionModifier=function(a){this.subdivisions=a===void 0?1:a;this.useOldVertexColors=!1;this.supportUVs=!0};THREE.SubdivisionModifier.prototype.constructor=THREE.SubdivisionModifier;THREE.SubdivisionModifier.prototype.modify=function(a){for(var c=this.subdivisions;c-- >0;)this.smooth(a)};
|
|
|
-THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var l=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){l.vertexColors=[];for(var j,k,m,n=0;n<4;n++){m=i[n];j=new THREE.Color;j.setRGB(0,0,0);for(var o=0;o<m.length;o++)k=h.vertexColors[m[o]-1],j.r+=k.r,j.g+=k.g,j.b+=k.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;l.vertexColors[n]=j}}g.push(l);(!f.supportUVs||q.length!=0)&&e.push([q[a],q[b],q[c],q[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
+THREE.SubdivisionModifier.prototype.smooth=function(a){function c(a,b,c,d,h,i){var k=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){k.vertexColors=[];for(var j,l,m,n=0;n<4;n++){m=i[n];j=new THREE.Color;j.setRGB(0,0,0);for(var o=0;o<m.length;o++)l=h.vertexColors[m[o]-1],j.r+=l.r,j.g+=l.g,j.b+=l.b;j.r/=m.length;j.g/=m.length;j.b/=m.length;k.vertexColors[n]=j}}g.push(k);(!f.supportUVs||q.length!=0)&&e.push([q[a],q[b],q[c],q[d]])}function b(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
b)}var d=[],g=[],e=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),l=[],k={},p={},q=[],m,t,n,o,s,u=a.faceVertexUvs[0];m=0;for(t=u.length;m<t;m++){n=0;for(o=u[m].length;n<o;n++)s=d[m]["abcd".charAt(n)],q[s]||(q[s]=u[m][n])}var r;m=0;for(t=d.length;m<t;m++)if(s=d[m],l.push(s.centroid),i.push(new THREE.Vertex(s.centroid)),f.supportUVs&&q.length!=0){r=new THREE.UV;if(s instanceof THREE.Face3)r.u=q[s.a].u+q[s.b].u+q[s.c].u,r.v=q[s.a].v+q[s.b].v+q[s.c].v,r.u/=3,r.v/=3;else if(s instanceof THREE.Face4)r.u=
|
|
|
-q[s.a].u+q[s.b].u+q[s.c].u+q[s.d].u,r.v=q[s.a].v+q[s.b].v+q[s.c].v+q[s.d].v,r.u/=4,r.v/=4;q.push(r)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var y=0,u=h.length,v,G,B={},H={},w=function(a,
|
|
|
-b){B[a]===void 0&&(B[a]=[]);B[a].push(b)},D=function(a,b){H[a]===void 0&&(H[a]={});H[a][b]=null};for(m in t){r=t[m];v=m.split("_");G=v[0];v=v[1];w(G,[G,v]);w(v,[G,v]);n=0;for(o=r.length;n<o;n++)s=r[n],D(G,s,m),D(v,s,m);r.length<2&&(p[m]=!0)}for(m in t)if(r=t[m],s=r[0],r=r[1],v=m.split("_"),G=v[0],v=v[1],o=new THREE.Vector3,p[m]?(o.addSelf(h[G].position),o.addSelf(h[v].position),o.multiplyScalar(0.5)):(o.addSelf(l[s]),o.addSelf(l[r]),o.addSelf(h[G].position),o.addSelf(h[v].position),o.multiplyScalar(0.25)),
|
|
|
-k[m]=u+d.length+y,i.push(new THREE.Vertex(o)),y++,f.supportUVs&&q.length!=0)r=new THREE.UV,r.u=q[G].u+q[v].u,r.v=q[G].v+q[v].v,r.u/=2,r.v/=2,q.push(r);var A,K;v=["123","12","2","23"];o=["123","23","3","31"];var w=["123","31","1","12"],D=["1234","12","2","23"],L=["1234","23","3","34"],S=["1234","34","4","41"],W=["1234","41","1","12"];m=0;for(t=l.length;m<t;m++)s=d[m],r=u+m,s instanceof THREE.Face3?(y=b(s.a,s.b),G=b(s.b,s.c),A=b(s.c,s.a),c(r,k[y],s.b,k[G],s,v),c(r,k[G],s.c,k[A],s,o),c(r,k[A],s.a,k[y],
|
|
|
-s,w)):s instanceof THREE.Face4?(y=b(s.a,s.b),G=b(s.b,s.c),A=b(s.c,s.d),K=b(s.d,s.a),c(r,k[y],s.b,k[G],s,D),c(r,k[G],s.c,k[A],s,L),c(r,k[A],s.d,k[K],s,S),c(r,k[K],s.a,k[y],s,W)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;m=0;for(t=h.length;m<t;m++)if(B[m]!==void 0){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);r=0;for(n in H[m])i.addSelf(l[n]),r++;y=0;u=B[m].length;for(n=0;n<u;n++)p[b(B[m][n][0],B[m][n][1])]&&y++;if(y!=2){i.divideScalar(r);for(n=0;n<
|
|
|
-u;n++)r=B[m][n],r=h[r[0]].position.clone().addSelf(h[r[1]].position).divideScalar(2),k.addSelf(r);k.divideScalar(u);s.addSelf(h[m].position);s.multiplyScalar(u-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(u);d[m].position=s}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
+q[s.a].u+q[s.b].u+q[s.c].u+q[s.d].u,r.v=q[s.a].v+q[s.b].v+q[s.c].v+q[s.d].v,r.u/=4,r.v/=4;q.push(r)}t=function(a){function c(a,b,d){a[b]===void 0&&(a[b]=[]);a[b].push(d)}var d,e,f,g,h={};d=0;for(e=a.faces.length;d<e;d++)f=a.faces[d],f instanceof THREE.Face3?(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.a),c(h,g,d)):f instanceof THREE.Face4&&(g=b(f.a,f.b),c(h,g,d),g=b(f.b,f.c),c(h,g,d),g=b(f.c,f.d),c(h,g,d),g=b(f.d,f.a),c(h,g,d));return h}(a);var z=0,u=h.length,E,G,v={},w={},C=function(a,
|
|
|
+b){v[a]===void 0&&(v[a]=[]);v[a].push(b)},F=function(a,b){w[a]===void 0&&(w[a]={});w[a][b]=null};for(m in t){r=t[m];E=m.split("_");G=E[0];E=E[1];C(G,[G,E]);C(E,[G,E]);n=0;for(o=r.length;n<o;n++)s=r[n],F(G,s,m),F(E,s,m);r.length<2&&(p[m]=!0)}for(m in t)if(r=t[m],s=r[0],r=r[1],E=m.split("_"),G=E[0],E=E[1],o=new THREE.Vector3,p[m]?(o.addSelf(h[G].position),o.addSelf(h[E].position),o.multiplyScalar(0.5)):(o.addSelf(l[s]),o.addSelf(l[r]),o.addSelf(h[G].position),o.addSelf(h[E].position),o.multiplyScalar(0.25)),
|
|
|
+k[m]=u+d.length+z,i.push(new THREE.Vertex(o)),z++,f.supportUVs&&q.length!=0)r=new THREE.UV,r.u=q[G].u+q[E].u,r.v=q[G].v+q[E].v,r.u/=2,r.v/=2,q.push(r);var B,L;E=["123","12","2","23"];o=["123","23","3","31"];var C=["123","31","1","12"],F=["1234","12","2","23"],J=["1234","23","3","34"],W=["1234","34","4","41"],X=["1234","41","1","12"];m=0;for(t=l.length;m<t;m++)s=d[m],r=u+m,s instanceof THREE.Face3?(z=b(s.a,s.b),G=b(s.b,s.c),B=b(s.c,s.a),c(r,k[z],s.b,k[G],s,E),c(r,k[G],s.c,k[B],s,o),c(r,k[B],s.a,k[z],
|
|
|
+s,C)):s instanceof THREE.Face4?(z=b(s.a,s.b),G=b(s.b,s.c),B=b(s.c,s.d),L=b(s.d,s.a),c(r,k[z],s.b,k[G],s,F),c(r,k[G],s.c,k[B],s,J),c(r,k[B],s.d,k[L],s,W),c(r,k[L],s.a,k[z],s,X)):console.log("face should be a face!",s);d=i;i=new THREE.Vector3;k=new THREE.Vector3;m=0;for(t=h.length;m<t;m++)if(v[m]!==void 0){i.set(0,0,0);k.set(0,0,0);s=new THREE.Vector3(0,0,0);r=0;for(n in w[m])i.addSelf(l[n]),r++;z=0;u=v[m].length;for(n=0;n<u;n++)p[b(v[m][n][0],v[m][n][1])]&&z++;if(z!=2){i.divideScalar(r);for(n=0;n<
|
|
|
+u;n++)r=v[m][n],r=h[r[0]].position.clone().addSelf(h[r[1]].position).divideScalar(2),k.addSelf(r);k.divideScalar(u);s.addSelf(h[m].position);s.multiplyScalar(u-3);s.addSelf(i);s.addSelf(k.multiplyScalar(2));s.divideScalar(u);d[m].position=s}}a.vertices=d;a.faces=g;a.faceVertexUvs[0]=e;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
THREE.Loader=function(a){this.statusDomElement=(this.showStatus=a)?THREE.Loader.prototype.addStatusElement():null;this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){}};
|
|
|
THREE.Loader.prototype={constructor:THREE.Loader,addStatusElement:function(){var a=document.createElement("div");a.style.position="absolute";a.style.right="0px";a.style.top="0px";a.style.fontSize="0.8em";a.style.textAlign="left";a.style.background="rgba(0,0,0,0.25)";a.style.color="#fff";a.style.width="120px";a.style.padding="0.5em 0.5em 0.5em 0.5em";a.style.zIndex=1E3;a.innerHTML="Loading ...";return a},updateProgress:function(a){var c="Loaded ";c+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=c},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,c,b){a.materials=[];for(var d=0;d<c.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(c[d],b)},hasNormals:function(a){var c,b,d=a.materials.length;for(b=0;b<d;b++)if(c=a.materials[b],c instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,c){function b(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
@@ -554,111 +556,111 @@ THREE.BinaryLoader.prototype.loadAjaxJSON=function(a,c,b,d,g,e){var f=new XMLHtt
|
|
|
f.status+"]")};f.open("GET",c,!0);f.overrideMimeType("text/plain; charset=x-user-defined");f.setRequestHeader("Content-Type","text/plain");f.send(null)};
|
|
|
THREE.BinaryLoader.prototype.loadAjaxBuffers=function(a,c,b,d,g){var e=new XMLHttpRequest,f=b+"/"+a.buffers,h=0;e.onreadystatechange=function(){e.readyState==4?e.status==200||e.status==0?THREE.BinaryLoader.prototype.createBinModel(e.response,c,d,a.materials):console.error("Couldn't load ["+f+"] ["+e.status+"]"):e.readyState==3?g&&(h==0&&(h=e.getResponseHeader("Content-Length")),g({total:h,loaded:e.responseText.length})):e.readyState==2&&(h=e.getResponseHeader("Content-Length"))};e.open("GET",f,!0);
|
|
|
e.responseType="arraybuffer";e.send(null)};
|
|
|
-THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a){return a%4?4-a%4:0}function g(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function l(b,c){var d,e,f,g,h,i,l,k,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=r[e*2];e=r[e*2+1];i=r[f*2];l=r[f*2+1];f=r[g*2];k=r[g*2+1];g=n.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,l));o.push(new THREE.UV(f,k));g.push(o)}}
|
|
|
-function k(b,c){var d,e,f,g,h,i,l,k,m,o,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=r[e*2];e=r[e*2+1];l=r[f*2];m=r[f*2+1];k=r[g*2];o=r[g*2+1];g=r[h*2];f=r[h*2+1];h=n.faceVertexUvs[0];var j=[];j.push(new THREE.UV(i,e));j.push(new THREE.UV(l,m));j.push(new THREE.UV(k,o));j.push(new THREE.UV(g,f));h.push(j)}}function p(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
|
|
|
-f,g,null,null,h))}function q(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),l=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=l[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function m(b,c,d,e){for(var f,g,h,i,l,k,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];l=d[e*3];k=d[e*3+1];m=d[e*3+2];i=o[e];var p=u[k*3],j=u[k*3+1];k=u[k*3+2];var q=u[m*3],s=u[m*3+1];m=u[m*3+2];n.faces.push(new THREE.Face3(f,
|
|
|
-g,h,[new THREE.Vector3(u[l*3],u[l*3+1],u[l*3+2]),new THREE.Vector3(p,j,k),new THREE.Vector3(q,s,m)],null,i))}}function t(b,c,d,e){for(var f,g,h,i,l,k,m,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),j=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];k=d[e*4];m=d[e*4+1];o=d[e*4+2];p=d[e*4+3];l=j[e];var q=u[m*3],s=u[m*3+1];m=u[m*3+2];var r=u[o*3],t=u[o*3+1];o=u[o*3+2];var v=u[p*3],w=u[p*3+1];p=u[p*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(u[k*
|
|
|
-3],u[k*3+1],u[k*3+2]),new THREE.Vector3(q,s,m),new THREE.Vector3(r,t,o),new THREE.Vector3(v,w,p)],null,l))}}var n=this,o=0,s,u=[],r=[],y,v,G,B,H,w;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);s={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,o,12),header_bytes:g(a,o+12),vertex_coordinate_bytes:g(a,o+13),normal_coordinate_bytes:g(a,o+14),uv_coordinate_bytes:g(a,o+15),vertex_index_bytes:g(a,o+16),normal_index_bytes:g(a,
|
|
|
-o+17),uv_index_bytes:g(a,o+18),material_index_bytes:g(a,o+19),nvertices:i(a,o+20),nnormals:i(a,o+20+4),nuvs:i(a,o+20+8),ntri_flat:i(a,o+20+12),ntri_smooth:i(a,o+20+16),ntri_flat_uv:i(a,o+20+20),ntri_smooth_uv:i(a,o+20+24),nquad_flat:i(a,o+20+28),nquad_smooth:i(a,o+20+32),nquad_flat_uv:i(a,o+20+36),nquad_smooth_uv:i(a,o+20+40)};s.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");o+=s.header_bytes;b=s.vertex_index_bytes*3+s.material_index_bytes;w=s.vertex_index_bytes*
|
|
|
-4+s.material_index_bytes;y=s.ntri_flat*b;v=s.ntri_smooth*(b+s.normal_index_bytes*3);G=s.ntri_flat_uv*(b+s.uv_index_bytes*3);B=s.ntri_smooth_uv*(b+s.normal_index_bytes*3+s.uv_index_bytes*3);H=s.nquad_flat*w;b=s.nquad_smooth*(w+s.normal_index_bytes*4);w=s.nquad_flat_uv*(w+s.uv_index_bytes*4);o+=function(b){var c=s.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(o);
|
|
|
-o+=function(b){var c=s.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],u.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(o);o+=c(s.nnormals*3);o+=function(b){var c=s.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],r.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(o);y=o+y+c(s.ntri_flat*2);v=y+v+c(s.ntri_smooth*2);G=v+G+c(s.ntri_flat_uv*2);B=G+B+c(s.ntri_smooth_uv*2);H=B+H+c(s.nquad_flat*2);
|
|
|
-b=H+b+c(s.nquad_smooth*2);w=b+w+c(s.nquad_flat_uv*2);(function(a){var b=s.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,c)}})(v);(function(a){var b=s.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,d)}})(G);(function(a){var b=s.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,
|
|
|
-c)}})(b);(function(a){var b=s.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;t(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(w);(function(a){var b=s.ntri_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(o);(function(a){var b=s.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(y);(function(a){var b=s.nquad_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(B);(function(a){var b=
|
|
|
-s.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;t(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(H);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
|
|
|
-THREE.ColladaLoader=function(){function a(a,d,g){O=a;d=d||ea;g!==void 0&&(a=g.split("/"),a.pop(),xa=a.length<1?"":a.join("/")+"/");ga=c("//dae:library_images/dae:image",f,"image");la=c("//dae:library_materials/dae:material",H,"material");ka=c("//dae:library_effects/dae:effect",L,"effect");ma=c("//dae:library_geometries/dae:geometry",o,"geometry");ja=c("//dae:library_controllers/dae:controller",h,"controller");na=c("//dae:library_animations/dae:animation",W,"animation");ya=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
-k,"visual_scene");sa=[];pa=[];(a=O.evaluate(".//dae:scene/dae:instance_visual_scene",O,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),Y=ya[a]):Y=null;aa=new THREE.Object3D;for(a=0;a<Y.nodes.length;a++)aa.add(e(Y.nodes[a]));b();for(var i in na);i={scene:aa,morphs:sa,skins:pa,dae:{images:ga,materials:la,effects:ka,geometries:ma,controllers:ja,animations:na,visualScenes:ya,scene:Y}};d&&d(i);return i}function c(a,b,c){for(var a=O.evaluate(a,O,E,
|
|
|
-XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in na)for(var e=na[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=
|
|
|
-a.channels[0].sampler.output[c];f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=ja[c.url];if(!f||!f.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 g=b(),c=Y.getChildById(c.skeleton[0],!0)||Y.getChildBySid(c.skeleton[0],!0),h,i,j,l,k=new THREE.Vector3,
|
|
|
-m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(l=0;l<h.length;l++)if(j=h[l],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=
|
|
|
-0;q<i.weights[p].length;q++){var s=i.weights[p][q];s.joint==m&&j.weights.push(s)}}else throw"ColladaLoader: Could not find joint '"+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],l=j.index,j=j.weight,m=a.vertices[l],l=o[l],k.x=m.position.x,k.y=m.position.y,k.z=m.position.z,n[h].skinningMatrix.multiplyVector3(k),l.position.x+=k.x*j,l.position.y+=k.y*j,l.position.z+=k.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function e(a){var b=
|
|
|
-new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=ja[a.controllers[f].url];switch(i.type){case "skin":if(ma[i.skin.source]){var j=new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(ja[i.skin.source]&&(d=i=ja[i.skin.source],i.morph&&ma[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ma[i.morph.source])j=new n,
|
|
|
-j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ma[i.url],l={},k=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=ka[la[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=l[o.symbol]=
|
|
|
-p.material;k++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(k>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)k=i.faces[h],k.materials=[l[k.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=ja[c.url],j.skinInstanceController=c,j.name="skin_"+pa.length,pa.push(j);else if(d!==void 0){h=i;l=d instanceof m?ja[d.url]:d;if(!l||!l.morph)console.log("could not find morph controller!");
|
|
|
-else{l=l.morph;for(k=0;k<l.targets.length;k++)if(p=ma[l.targets[k]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+sa.length;sa.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,
|
|
|
-b.scale);for(f=0;f<a.nodes.length;f++)b.add(e(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){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 q(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function o(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function r(){this.material="";this.count=
|
|
|
-0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function y(){this.source="";this.stride=this.count=0;this.params=[]}function v(){this.input={}}function G(){this.semantic="";this.offset=0;this.source="";this.set=0}function B(a){this.id=a;this.type=null}function H(){this.name=this.id="";this.instance_effect=null}function w(){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 D(a,
|
|
|
-b){this.type=a;this.effect=b;this.material=null}function A(a){this.effect=a;this.format=this.init_from=null}function K(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function L(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function S(){this.url=""}function W(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function U(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
|
|
|
-this.dotSyntax=this.sid=null}function X(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function $(a){var b=a.getAttribute("id");if(Q[b]!=void 0)return Q[b];Q[b]=(new B(b)).parse(a);return Q[b]}function E(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function I(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function P(a){for(var a=M(a),b=[],c=0;c<
|
|
|
-a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function j(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function V(a,b){if(a===void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function Z(a,b){var c="";c+=V(a.x,b)+",";c+=V(a.y,b)+",";c+=V(a.z,b);return c}var O=null,aa=null,Y,ea=null,Q=
|
|
|
-{},ga={},na={},ja={},ma={},la={},ka={},ya,xa,sa,pa,qa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).parse(c);this.type=
|
|
|
-c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new B).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=
|
|
|
-e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new G).parse(d))}}return b};l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=
|
|
|
-I(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new B).parse(f);b[f.id]=f;break;case "joints":c=f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=
|
|
|
-(new G).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new G).parse(g));break;case "v":c=P(g.textContent);break;case "vcount":d=P(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var l={},k=0;k<e.length;k++){var m=
|
|
|
-e[k],n=c[g+m.offset];switch(m.semantic){case "JOINT":l.joint=n;break;case "WEIGHT":l.weight=b[m.source].data[n]}}i.push(l);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=
|
|
|
-a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();
|
|
|
-for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=
|
|
|
-function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.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<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==
|
|
|
-1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=b.getAttribute("url").replace(/^#/,"");(b=O.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",O,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new q).parse(b));
|
|
|
-break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in na)for(var e=na[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+
|
|
|
-1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,l,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){l=j.output[i];break}g=l!==void 0?l instanceof THREE.Matrix4?g.multiply(g,l):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,
|
|
|
-b.n24,b.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 a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};q.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=I(a.textContent);this.updateMatrix();return this};q.prototype.updateMatrix=function(){var a=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":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};
|
|
|
-m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=O.evaluate(".//dae:instance_material",c,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new t).parse(d)),d=c.iterateNext()}}return this};
|
|
|
-t.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=O.evaluate(".//dae:instance_material",c,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new t).parse(b)),
|
|
|
-b=a.iterateNext();break}}return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=(new s(this)).parse(c)}}return this};s.prototype.parse=function(a){function b(a,c){var d=Z(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":$(d);break;case "vertices":this.vertices=
|
|
|
-(new v).parse(d);break;case "triangles":this.primitives.push((new r).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(d))}}var e={};this.geometry3js=new THREE.Geometry;d=Q[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),
|
|
|
-this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();return this};s.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,l,k,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],s={},r=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],
|
|
|
-k=Q[i.source],j=g[d+e*h.length+i.offset],l=k.accessor.params.length,l*=j,i.semantic){case "VERTEX":i=Z(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(k.data[l],k.data[l+1],k.data[l+2]));break;case "TEXCOORD":s[i.set]===void 0&&(s[i.set]=[]);s[i.set].push(new THREE.UV(k.data[l],k.data[l+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(k.data[l],k.data[l+1],k.data[l+2]))}var t;n==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],r.length?r:new THREE.Color):
|
|
|
-n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],r.length?r:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=s[o[f]],b.faceVertexUvs[f].push([e[0],e[1],e[2]]);d+=h.length*n}};u.prototype=new r;u.prototype.constructor=u;r.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};r.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");
|
|
|
-this.count=j(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new G).parse(a.childNodes[b]));break;case "vcount":this.vcount=P(c.textContent);break;case "p":this.p=P(c.textContent)}}return this};y.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=j(a,"count",0);this.stride=j(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=
|
|
|
-c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="input"){var c=(new G).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};G.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=j(a,"set",-1);this.offset=j(a,"offset",0);if(this.semantic=="TEXCOORD"&&
|
|
|
-this.set<0)this.set=0;return this};B.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=M(c.textContent),e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=I(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=P(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=
|
|
|
-M(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new y).parse(c.childNodes[d]);break}}}return this};B.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.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]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};H.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new S).parse(a.childNodes[b]);break}return this};w.prototype.isColor=function(){return this.texture==null};w.prototype.isTexture=function(){return this.texture!=
|
|
|
-null};w.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=I(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};D.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=
|
|
|
-(new w).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=O.evaluate(".//dae:float",c,E,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};D.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];
|
|
|
-if(d instanceof w)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=ga[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(xa+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=
|
|
|
-this[c],b=!0}a.shading=qa;return this.material=new THREE.MeshLambertMaterial(a)};A.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];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};K.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];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};L.prototype.create=function(){if(this.shader==null)return null};L.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=
|
|
|
-null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};L.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new A(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new K(this)).parse(d);this.sampler.sid=b;break;case "extra":break;
|
|
|
-default:console.log(d.nodeName)}}};L.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};L.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=
|
|
|
-(new D(c.nodeName,this)).parse(c)}}};S.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};W.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new B).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new X(this)).parse(c));break;case "channel":this.channel.push((new U(this)).parse(c))}}return this};
|
|
|
-U.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};X.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
-this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new G).parse(c))}}return this};X.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.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(b.semantic)}}this.duration=
|
|
|
-this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;
|
|
|
-d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==200))ea=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){qa=a},applySkin:g,geometries:ma}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;
|
|
|
-THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;THREE.JSONLoader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
|
|
|
+THREE.BinaryLoader.prototype.createBinModel=function(a,c,b,d){var g=function(b){function c(a){return a%4?4-a%4:0}function g(a,b){return(new Uint8Array(a,b,1))[0]}function i(a,b){return(new Uint32Array(a,b,1))[0]}function l(b,c){var d,e,f,g,h,i,k,l,m=new Uint32Array(a,c,3*b);for(d=0;d<b;d++){e=m[d*3];f=m[d*3+1];g=m[d*3+2];h=r[e*2];e=r[e*2+1];i=r[f*2];k=r[f*2+1];f=r[g*2];l=r[g*2+1];g=n.faceVertexUvs[0];var o=[];o.push(new THREE.UV(h,e));o.push(new THREE.UV(i,k));o.push(new THREE.UV(f,l));g.push(o)}}
|
|
|
+function k(b,c){var d,e,f,g,h,i,k,l,m,o,p=new Uint32Array(a,c,4*b);for(d=0;d<b;d++){e=p[d*4];f=p[d*4+1];g=p[d*4+2];h=p[d*4+3];i=r[e*2];e=r[e*2+1];k=r[f*2];m=r[f*2+1];l=r[g*2];o=r[g*2+1];g=r[h*2];f=r[h*2+1];h=n.faceVertexUvs[0];var j=[];j.push(new THREE.UV(i,e));j.push(new THREE.UV(k,m));j.push(new THREE.UV(l,o));j.push(new THREE.UV(g,f));h.push(j)}}function p(b,c,d){for(var e,f,g,h,c=new Uint32Array(a,c,3*b),i=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*3],f=c[d*3+1],g=c[d*3+2],h=i[d],n.faces.push(new THREE.Face3(e,
|
|
|
+f,g,null,null,h))}function q(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),k=new Uint16Array(a,d,b),d=0;d<b;d++)e=c[d*4],f=c[d*4+1],g=c[d*4+2],h=c[d*4+3],i=k[d],n.faces.push(new THREE.Face4(e,f,g,h,null,null,i))}function m(b,c,d,e){for(var f,g,h,i,k,l,m,c=new Uint32Array(a,c,3*b),d=new Uint32Array(a,d,3*b),o=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*3];g=c[e*3+1];h=c[e*3+2];k=d[e*3];l=d[e*3+1];m=d[e*3+2];i=o[e];var p=u[l*3],j=u[l*3+1];l=u[l*3+2];var q=u[m*3],s=u[m*3+1];m=u[m*3+2];n.faces.push(new THREE.Face3(f,
|
|
|
+g,h,[new THREE.Vector3(u[k*3],u[k*3+1],u[k*3+2]),new THREE.Vector3(p,j,l),new THREE.Vector3(q,s,m)],null,i))}}function t(b,c,d,e){for(var f,g,h,i,k,l,m,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),j=new Uint16Array(a,e,b),e=0;e<b;e++){f=c[e*4];g=c[e*4+1];h=c[e*4+2];i=c[e*4+3];l=d[e*4];m=d[e*4+1];o=d[e*4+2];p=d[e*4+3];k=j[e];var q=u[m*3],s=u[m*3+1];m=u[m*3+2];var r=u[o*3],t=u[o*3+1];o=u[o*3+2];var v=u[p*3],w=u[p*3+1];p=u[p*3+2];n.faces.push(new THREE.Face4(f,g,h,i,[new THREE.Vector3(u[l*
|
|
|
+3],u[l*3+1],u[l*3+2]),new THREE.Vector3(q,s,m),new THREE.Vector3(r,t,o),new THREE.Vector3(v,w,p)],null,k))}}var n=this,o=0,s,u=[],r=[],z,E,G,v,w,C;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);s={signature:function(a,b,c){for(var a=new Uint8Array(a,b,c),d="",e=0;e<c;e++)d+=String.fromCharCode(a[b+e]);return d}(a,o,12),header_bytes:g(a,o+12),vertex_coordinate_bytes:g(a,o+13),normal_coordinate_bytes:g(a,o+14),uv_coordinate_bytes:g(a,o+15),vertex_index_bytes:g(a,o+16),normal_index_bytes:g(a,
|
|
|
+o+17),uv_index_bytes:g(a,o+18),material_index_bytes:g(a,o+19),nvertices:i(a,o+20),nnormals:i(a,o+20+4),nuvs:i(a,o+20+8),ntri_flat:i(a,o+20+12),ntri_smooth:i(a,o+20+16),ntri_flat_uv:i(a,o+20+20),ntri_smooth_uv:i(a,o+20+24),nquad_flat:i(a,o+20+28),nquad_smooth:i(a,o+20+32),nquad_flat_uv:i(a,o+20+36),nquad_smooth_uv:i(a,o+20+40)};s.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");o+=s.header_bytes;b=s.vertex_index_bytes*3+s.material_index_bytes;C=s.vertex_index_bytes*
|
|
|
+4+s.material_index_bytes;z=s.ntri_flat*b;E=s.ntri_smooth*(b+s.normal_index_bytes*3);G=s.ntri_flat_uv*(b+s.uv_index_bytes*3);v=s.ntri_smooth_uv*(b+s.normal_index_bytes*3+s.uv_index_bytes*3);w=s.nquad_flat*C;b=s.nquad_smooth*(C+s.normal_index_bytes*4);C=s.nquad_flat_uv*(C+s.uv_index_bytes*4);o+=function(b){var c=s.nvertices,b=new Float32Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],n.vertices.push(new THREE.Vertex(new THREE.Vector3(e,f,g)));return c*3*Float32Array.BYTES_PER_ELEMENT}(o);
|
|
|
+o+=function(b){var c=s.nnormals;if(c){var b=new Int8Array(a,b,c*3),d,e,f,g;for(d=0;d<c;d++)e=b[d*3],f=b[d*3+1],g=b[d*3+2],u.push(e/127,f/127,g/127)}return c*3*Int8Array.BYTES_PER_ELEMENT}(o);o+=c(s.nnormals*3);o+=function(b){var c=s.nuvs;if(c){var b=new Float32Array(a,b,c*2),d,e,f;for(d=0;d<c;d++)e=b[d*2],f=b[d*2+1],r.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(o);z=o+z+c(s.ntri_flat*2);E=z+E+c(s.ntri_smooth*2);G=E+G+c(s.ntri_flat_uv*2);v=G+v+c(s.ntri_smooth_uv*2);w=v+w+c(s.nquad_flat*2);
|
|
|
+b=w+b+c(s.nquad_smooth*2);C=b+C+c(s.nquad_flat_uv*2);(function(a){var b=s.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,c)}})(E);(function(a){var b=s.ntri_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3,d=c+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*3);l(b,d)}})(G);(function(a){var b=s.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,
|
|
|
+c)}})(b);(function(a){var b=s.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;t(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(C);(function(a){var b=s.ntri_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(o);(function(a){var b=s.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(z);(function(a){var b=s.nquad_flat;b&&q(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(v);(function(a){var b=
|
|
|
+s.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;t(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(w);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};g.prototype=new THREE.Geometry;g.prototype.constructor=g;c(new g(b))};
|
|
|
+THREE.ColladaLoader=function(){function a(a,d,g){V=a;d=d||fa;g!==void 0&&(a=g.split("/"),a.pop(),ya=a.length<1?"":a.join("/")+"/");ia=c("//dae:library_images/dae:image",f,"image");oa=c("//dae:library_materials/dae:material",w,"material");la=c("//dae:library_effects/dae:effect",J,"effect");ka=c("//dae:library_geometries/dae:geometry",o,"geometry");na=c("//dae:library_controllers/dae:controller",h,"controller");pa=c("//dae:library_animations/dae:animation",X,"animation");ma=c(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
+k,"visual_scene");ra=[];sa=[];(a=V.evaluate(".//dae:scene/dae:instance_visual_scene",V,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),K=ma[a]):K=null;Q=new THREE.Object3D;for(a=0;a<K.nodes.length;a++)Q.add(e(K.nodes[a]));b();for(var i in pa);i={scene:Q,morphs:ra,skins:sa,dae:{images:ia,materials:oa,effects:la,geometries:ka,controllers:na,animations:pa,visualScenes:ma,scene:K}};d&&d(i);return i}function c(a,b,c){for(var a=V.evaluate(a,V,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
+null),d={},e=a.iterateNext(),f=0;e;){e=(new b).parse(e);if(e.id.length==0)e.id=c+f++;d[e.id]=e;e=a.iterateNext()}return d}function b(){var a=1E6,b=-a,c=0,d;for(d in pa)for(var e=pa[d],f=0;f<e.sampler.length;f++){var g=e.sampler[f];g.create();a=Math.min(a,g.startTime);b=Math.max(b,g.endTime);c=Math.max(c,g.input.length)}return{start:a,end:b,frames:c}}function d(a,b,c,e){a.world=a.world||new THREE.Matrix4;a.world.copy(a.matrix);if(a.channels&&a.channels.length){var f=a.channels[0].sampler.output[c];
|
|
|
+f instanceof THREE.Matrix4&&a.world.copy(f)}e&&a.world.multiply(e,a.world);b.push(a);for(e=0;e<a.nodes.length;e++)d(a.nodes[e],b,c,a.world)}function g(a,c,e){var f=na[c.url];if(!f||!f.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 g=b(),c=K.getChildById(c.skeleton[0],!0)||K.getChildBySid(c.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,m;for(h=0;h<a.vertices.length;h++)f.skin.bindShapeMatrix.multiplyVector3(a.vertices[h].position);
|
|
|
+for(e=0;e<g.frames;e++){var n=[],o=[];for(h=0;h<a.vertices.length;h++)o.push(new THREE.Vertex(new THREE.Vector3));d(c,n,e);h=n;i=f.skin;for(k=0;k<h.length;k++)if(j=h[k],m=-1,j.type=="JOINT"){for(var p=0;p<i.joints.length;p++)if(j.sid==i.joints[p]){m=p;break}if(m>=0){p=i.invBindMatrices[m];j.invBindMatrix=p;j.skinningMatrix=new THREE.Matrix4;j.skinningMatrix.multiply(j.world,p);j.weights=[];for(p=0;p<i.weights.length;p++)for(var q=0;q<i.weights[p].length;q++){var s=i.weights[p][q];s.joint==m&&j.weights.push(s)}}else throw"ColladaLoader: Could not find joint '"+
|
|
|
+j.sid+"'.";}for(h=0;h<n.length;h++)if(n[h].type=="JOINT")for(i=0;i<n[h].weights.length;i++)j=n[h].weights[i],k=j.index,j=j.weight,m=a.vertices[k],k=o[k],l.x=m.position.x,l.y=m.position.y,l.z=m.position.z,n[h].skinningMatrix.multiplyVector3(l),k.position.x+=l.x*j,k.position.y+=l.y*j,k.position.z+=l.z*j;a.morphTargets.push({name:"target_"+e,vertices:o})}}}function e(a){var b=new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=na[a.controllers[f].url];switch(i.type){case "skin":if(ka[i.skin.source]){var j=
|
|
|
+new n;j.url=i.skin.source;j.instance_material=a.controllers[f].instance_material;a.geometries.push(j);c=a.controllers[f]}else if(na[i.skin.source]&&(d=i=na[i.skin.source],i.morph&&ka[i.morph.source]))j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j);break;case "morph":if(ka[i.morph.source])j=new n,j.url=i.morph.source,j.instance_material=a.controllers[f].instance_material,a.geometries.push(j),d=a.controllers[f];console.log("ColladaLoader: Morph-controller partially supported.")}}for(f=
|
|
|
+0;f<a.geometries.length;f++){var i=a.geometries[f],j=i.instance_material,i=ka[i.url],k={},l=0,o;if(i&&i.mesh&&i.mesh.primitives){if(b.name.length==0)b.name=i.id;if(j)for(h=0;h<j.length;h++){o=j[h];var p=la[oa[o.target].instance_effect.url].shader;p.material.opacity=!p.material.opacity?1:p.material.opacity;o=k[o.symbol]=p.material;l++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.FlatShading});i=i.mesh.geometry3js;if(l>1){j=new THREE.MeshFaceMaterial;for(h=0;h<i.faces.length;h++)l=
|
|
|
+i.faces[h],l.materials=[k[l.daeMaterial]]}if(c!==void 0)g(i,c),j.morphTargets=!0,j=new THREE.SkinnedMesh(i,j),j.skeleton=c.skeleton,j.skinController=na[c.url],j.skinInstanceController=c,j.name="skin_"+sa.length,sa.push(j);else if(d!==void 0){h=i;k=d instanceof m?na[d.url]:d;if(!k||!k.morph)console.log("could not find morph controller!");else{k=k.morph;for(l=0;l<k.targets.length;l++)if(p=ka[k.targets[l]],p.mesh&&p.mesh.primitives&&p.mesh.primitives.length)p=p.mesh.primitives[0].geometry,p.vertices.length===
|
|
|
+h.vertices.length&&h.morphTargets.push({name:"target_1",vertices:p.vertices});h.morphTargets.push({name:"target_Z",vertices:h.vertices})}j.morphTargets=!0;j=new THREE.Mesh(i,j);j.name="morph_"+ra.length;ra.push(j)}else j=new THREE.Mesh(i,j);a.geometries.length>1?b.add(j):b=j}}b.name=a.id||"";a.matrix.decompose(b.position,b.rotation,b.scale);for(f=0;f<a.nodes.length;f++)b.add(e(a.nodes[f],a));return b}function f(){this.init_from=this.id=""}function h(){this.type=this.name=this.id="";this.morph=this.skin=
|
|
|
+null}function i(){this.weights=this.targets=this.source=this.method=null}function l(){this.source="";this.bindShapeMatrix=null;this.invBindMatrices=[];this.joints=[];this.weights=[]}function k(){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 q(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url=
|
|
|
+"";this.skeleton=[];this.instance_material=[]}function t(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function o(){this.id="";this.mesh=null}function s(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function r(){this.material="";this.count=0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function z(){this.source="";this.stride=this.count=0;this.params=[]}function E(){this.input={}}function G(){this.semantic=
|
|
|
+"";this.offset=0;this.source="";this.set=0}function v(a){this.id=a;this.type=null}function w(){this.name=this.id="";this.instance_effect=null}function C(){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 F(a,b){this.type=a;this.effect=b;this.material=null}function B(a){this.effect=a;this.format=this.init_from=null}function L(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=
|
|
|
+this.source=null}function J(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function W(){this.url=""}function X(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function T(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=this.dotSyntax=this.sid=null}function ea(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ba(a){var b=a.getAttribute("id");
|
|
|
+if(U[b]!=void 0)return U[b];U[b]=(new v(b)).parse(a);return U[b]}function x(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function I(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function O(a){for(var a=M(a),b=[],c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function M(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function j(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function P(a,b){if(a===
|
|
|
+void 0){for(var c="0.";c.length<b+2;)c+="0";return c}b=b||2;c=a.toString().split(".");for(c[1]=c.length>1?c[1].substr(0,b):"0";c[1].length<b;)c[1]+="0";return c.join(".")}function ha(a,b){var c="";c+=P(a.x,b)+",";c+=P(a.y,b)+",";c+=P(a.z,b);return c}var V=null,Q=null,K,fa=null,U={},ia={},pa={},na={},ka={},oa={},la={},ma,ya,ra,sa,xa=THREE.SmoothShading;f.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="init_from")this.init_from=
|
|
|
+c.textContent}return this};h.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.type="none";for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "skin":this.skin=(new l).parse(c);this.type=c.nodeName;break;case "morph":this.morph=(new i).parse(c),this.type=c.nodeName}}return this};i.prototype.parse=function(a){var b={},c=[],d;this.method=a.getAttribute("method");this.source=a.getAttribute("source").replace(/^#/,"");for(d=
|
|
|
+0;d<a.childNodes.length;d++){var e=a.childNodes[d];if(e.nodeType==1)switch(e.nodeName){case "source":e=(new v).parse(e);b[e.id]=e;break;case "targets":c=this.parseInputs(e);break;default:console.log(e.nodeName)}}for(d=0;d<c.length;d++)switch(a=c[d],e=b[a.source],a.semantic){case "MORPH_TARGET":this.targets=e.read();break;case "MORPH_WEIGHT":this.weights=e.read()}return this};i.prototype.parseInputs=function(a){for(var b=[],c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":b.push((new G).parse(d))}}return b};
|
|
|
+l.prototype.parse=function(a){var b={},c,d;this.source=a.getAttribute("source").replace(/^#/,"");this.invBindMatrices=[];this.joints=[];this.weights=[];for(var e=0;e<a.childNodes.length;e++){var f=a.childNodes[e];if(f.nodeType==1)switch(f.nodeName){case "bind_shape_matrix":f=I(f.textContent);this.bindShapeMatrix=new THREE.Matrix4;this.bindShapeMatrix.set(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9],f[10],f[11],f[12],f[13],f[14],f[15]);break;case "source":f=(new v).parse(f);b[f.id]=f;break;case "joints":c=
|
|
|
+f;break;case "vertex_weights":d=f;break;default:console.log(f.nodeName)}}this.parseJoints(c,b);this.parseWeights(d,b);return this};l.prototype.parseJoints=function(a,b){for(var c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "input":var d=(new G).parse(d),e=b[d.source];if(d.semantic=="JOINT")this.joints=e.read();else if(d.semantic=="INV_BIND_MATRIX")this.invBindMatrices=e.read()}}};l.prototype.parseWeights=function(a,b){for(var c,d,e=[],f=0;f<a.childNodes.length;f++){var g=
|
|
|
+a.childNodes[f];if(g.nodeType==1)switch(g.nodeName){case "input":e.push((new G).parse(g));break;case "v":c=O(g.textContent);break;case "vcount":d=O(g.textContent)}}for(f=g=0;f<d.length;f++){for(var h=d[f],i=[],j=0;j<h;j++){for(var k={},l=0;l<e.length;l++){var m=e[l],n=c[g+m.offset];switch(m.semantic){case "JOINT":k.joint=n;break;case "WEIGHT":k.weight=b[m.source].data[n]}}i.push(k);g+=e.length}for(j=0;j<i.length;j++)i[j].index=f;this.weights.push(i)}};k.prototype.getChildById=function(a,b){for(var c=
|
|
|
+0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,b);if(d)return d}return null};k.prototype.getChildBySid=function(a,b){for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};k.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.nodes=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "node":this.nodes.push((new p).parse(c))}}return this};p.prototype.getChannelForTransform=
|
|
|
+function(a){for(var b=0;b<this.channels.length;b++){var c=this.channels[b],d=c.target.split("/");d.shift();var e=d.shift(),f=e.indexOf(".")>=0,g=e.indexOf("(")>=0,h;if(f)d=e.split("."),e=d.shift(),d.shift();else if(g){h=e.split("(");e=h.shift();for(d=0;d<h.length;d++)h[d]=parseInt(h[d].replace(/\)/,""))}if(e==a)return c.info={sid:e,dotSyntax:f,arrSyntax:g,arrIndices:h},c}return null};p.prototype.getChildById=function(a,b){if(this.id==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildById(a,
|
|
|
+b);if(d)return d}return null};p.prototype.getChildBySid=function(a,b){if(this.sid==a)return this;if(b)for(var c=0;c<this.nodes.length;c++){var d=this.nodes[c].getChildBySid(a,b);if(d)return d}return null};p.prototype.getTransformBySid=function(a){for(var b=0;b<this.transforms.length;b++)if(this.transforms[b].sid==a)return this.transforms[b];return null};p.prototype.parse=function(a){var b;this.id=a.getAttribute("id");this.sid=a.getAttribute("sid");this.name=a.getAttribute("name");this.type=a.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<a.childNodes.length;c++)if(b=a.childNodes[c],b.nodeType==1)switch(b.nodeName){case "node":this.nodes.push((new p).parse(b));break;case "instance_camera":break;case "instance_controller":this.controllers.push((new m).parse(b));break;case "instance_geometry":this.geometries.push((new n).parse(b));break;case "instance_light":break;case "instance_node":b=
|
|
|
+b.getAttribute("url").replace(/^#/,"");(b=V.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",V,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new p).parse(b));break;case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new q).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in pa)for(var e=pa[d],f=0;f<e.channel.length;f++){var g=e.channel[f],h=e.sampler[f];d=g.target.split("/")[0];
|
|
|
+if(d==this.id)h.create(),g.sampler=h,c=Math.min(c,h.startTime),b=Math.max(b,h.endTime),a.push(g)}if(a.length)this.startTime=c,this.endTime=b;if((this.channels=a)&&this.channels.length){d=1E7;for(a=0;a<this.channels.length;a++){c=this.channels[a].sampler;for(b=0;b<c.input.length-1;b++)d=Math.min(d,c.input[b+1]-c.input[b])}c=[];for(a=this.startTime;a<this.endTime;a+=d){b=a;for(var e={},i=f=void 0,f=0;f<this.channels.length;f++)i=this.channels[f],e[i.sid]=i;g=new THREE.Matrix4;for(f=0;f<this.transforms.length;f++)if(h=
|
|
|
+this.transforms[f],i=e[h.sid],i!==void 0){for(var j=i.sampler,k,i=0;i<j.input.length-1;i++)if(j.input[i+1]>b){k=j.output[i];break}g=k!==void 0?k instanceof THREE.Matrix4?g.multiply(g,k):g.multiply(g,h.matrix):g.multiply(g,h.matrix)}else g=g.multiply(g,h.matrix);b=g;c.push({time:a,pos:[b.n14,b.n24,b.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 a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,
|
|
|
+this.transforms[a].matrix)};q.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=I(a.textContent);this.updateMatrix();return this};q.prototype.updateMatrix=function(){var a=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":a=this.data[3]*(Math.PI/180);this.matrix.setRotationAxis(new THREE.Vector3(this.data[0],this.data[1],this.data[2]),a);break;case "scale":this.matrix.setScale(this.data[0],this.data[1],this.data[2])}return this.matrix};m.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");this.skeleton=[];this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
+if(c.nodeType==1)switch(c.nodeName){case "skeleton":this.skeleton.push(c.textContent.replace(/^#/,""));break;case "bind_material":if(c=V.evaluate(".//dae:instance_material",c,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(var d=c.iterateNext();d;)this.instance_material.push((new t).parse(d)),d=c.iterateNext()}}return this};t.prototype.parse=function(a){this.symbol=a.getAttribute("symbol");this.target=a.getAttribute("target").replace(/^#/,"");return this};n.prototype.parse=function(a){this.url=
|
|
|
+a.getAttribute("url").replace(/^#/,"");this.instance_material=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1&&c.nodeName=="bind_material"){if(a=V.evaluate(".//dae:instance_material",c,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new t).parse(b)),b=a.iterateNext();break}}return this};o.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "mesh":this.mesh=
|
|
|
+(new s(this)).parse(c)}}return this};s.prototype.parse=function(a){function b(a,c){var d=ha(a.position);e[d]===void 0&&(e[d]={v:a,index:c});return e[d]}this.primitives=[];var c;for(c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];switch(d.nodeName){case "source":ba(d);break;case "vertices":this.vertices=(new E).parse(d);break;case "triangles":this.primitives.push((new r).parse(d));break;case "polygons":console.warn("polygon holes not yet supported!");case "polylist":this.primitives.push((new u).parse(d))}}var e=
|
|
|
+{};this.geometry3js=new THREE.Geometry;d=U[this.vertices.input.POSITION.source].data;for(a=c=0;c<d.length;c+=3,a++){var f=new THREE.Vertex(new THREE.Vector3(d[c],d[c+1],d[c+2]));b(f,a);this.geometry3js.vertices.push(f)}for(c=0;c<this.primitives.length;c++)a=this.primitives[c],a.setVertices(this.vertices),this.handlePrimitive(a,this.geometry3js,e);this.geometry3js.computeCentroids();this.geometry3js.computeFaceNormals();this.geometry3js.computeVertexNormals();this.geometry3js.computeBoundingBox();
|
|
|
+return this};s.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,l,m=0,n=3,o=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":o.push(i.set)}for(;d<g.length;){var p=[],q=[],s={},r=[];a.vcount&&(n=a.vcount[m++]);for(e=0;e<n;e++)for(f=0;f<h.length;f++)switch(i=h[f],l=U[i.source],j=g[d+e*h.length+i.offset],k=l.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=ha(b.vertices[j].position);p.push(c[i].index);break;case "NORMAL":q.push(new THREE.Vector3(l.data[k],
|
|
|
+l.data[k+1],l.data[k+2]));break;case "TEXCOORD":s[i.set]===void 0&&(s[i.set]=[]);s[i.set].push(new THREE.UV(l.data[k],l.data[k+1]));break;case "COLOR":r.push((new THREE.Color).setRGB(l.data[k],l.data[k+1],l.data[k+2]))}var t;n==3?t=new THREE.Face3(p[0],p[1],p[2],[q[0],q[1],q[2]],r.length?r:new THREE.Color):n==4&&(t=new THREE.Face4(p[0],p[1],p[2],p[3],[q[0],q[1],q[2],q[3]],r.length?r:new THREE.Color));t.daeMaterial=a.material;b.faces.push(t);for(f=0;f<o.length;f++)e=s[o[f]],b.faceVertexUvs[f].push([e[0],
|
|
|
+e[1],e[2]]);d+=h.length*n}};u.prototype=new r;u.prototype.constructor=u;r.prototype.setVertices=function(a){for(var b=0;b<this.inputs.length;b++)if(this.inputs[b].source==a.id)this.inputs[b].source=a.input.POSITION.source};r.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=j(a,"count",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "input":this.inputs.push((new G).parse(a.childNodes[b]));break;case "vcount":this.vcount=
|
|
|
+O(c.textContent);break;case "p":this.p=O(c.textContent)}}return this};z.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=j(a,"count",0);this.stride=j(a,"stride",0);for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeName=="param"){var d={};d.name=c.getAttribute("name");d.type=c.getAttribute("type");this.params.push(d)}}return this};E.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName==
|
|
|
+"input"){var c=(new G).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};G.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,"");this.set=j(a,"set",-1);this.offset=j(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};v.prototype.parse=function(a){this.id=a.getAttribute("id");for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];switch(c.nodeName){case "bool_array":for(var d=M(c.textContent),
|
|
|
+e=[],f=0;f<d.length;f++)e.push(d[f]=="true"||d[f]=="1"?!0:!1);this.data=e;this.type=c.nodeName;break;case "float_array":this.data=I(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=O(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=M(c.textContent);this.type=c.nodeName;break;case "technique_common":for(d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeName=="accessor"){this.accessor=(new z).parse(c.childNodes[d]);break}}}return this};
|
|
|
+v.prototype.read=function(){var a=[],b=this.accessor.params[0];switch(b.type){case "IDREF":case "Name":case "name":case "float":return this.data;case "float4x4":for(b=0;b<this.data.length;b+=16){var c=this.data.slice(b,b+16),d=new THREE.Matrix4;d.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]);a.push(d)}break;default:console.log("ColladaLoader: Source: Read dont know how to read "+b.type+".")}return a};w.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
+this.name=a.getAttribute("name");for(var b=0;b<a.childNodes.length;b++)if(a.childNodes[b].nodeName=="instance_effect"){this.instance_effect=(new W).parse(a.childNodes[b]);break}return this};C.prototype.isColor=function(){return this.texture==null};C.prototype.isTexture=function(){return this.texture!=null};C.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "color":c=I(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};F.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new C).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=V.evaluate(".//dae:float",c,x,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
+null);for(var e=d.iterateNext(),f=[];e;)f.push(e),e=d.iterateNext();d=f;d.length>0&&(this[c.nodeName]=parseFloat(d[0].textContent))}}this.create();return this};F.prototype.create=function(){var a={},b=this.transparency!==void 0&&this.transparency<1,c;for(c in this)switch(c){case "ambient":case "emission":case "diffuse":case "specular":var d=this[c];if(d instanceof C)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=ia[this.effect.surface.init_from]))a.map=
|
|
|
+THREE.ImageUtils.loadTexture(ya+d.init_from),a.map.wrapS=THREE.RepeatWrapping,a.map.wrapT=THREE.RepeatWrapping,a.map.repeat.x=1,a.map.repeat.y=-1}else c=="diffuse"?a.color=d.color.getHex():b||(a[c]=d.color.getHex());break;case "shininess":case "reflectivity":a[c]=this[c];break;case "transparency":if(b)a.transparent=!0,a.opacity=this[c],b=!0}a.shading=xa;return this.material=new THREE.MeshLambertMaterial(a)};B.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];
|
|
|
+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};L.prototype.parse=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];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};J.prototype.create=function(){if(this.shader==null)return null};J.prototype.parse=function(a){this.id=a.getAttribute("id");this.name=a.getAttribute("name");this.shader=null;for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "profile_COMMON":this.parseTechnique(this.parseProfileCOMMON(c))}}return this};
|
|
|
+J.prototype.parseNewparam=function(a){for(var b=a.getAttribute("sid"),c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "surface":this.surface=(new B(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new L(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};J.prototype.parseProfileCOMMON=function(a){for(var b,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];if(d.nodeType==1)switch(d.nodeName){case "profile_COMMON":this.parseProfileCOMMON(d);
|
|
|
+break;case "technique":b=d;break;case "newparam":this.parseNewparam(d);break;case "extra":break;default:console.log(d.nodeName)}}return b};J.prototype.parseTechnique=function(a){for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "lambert":case "blinn":case "phong":this.shader=(new F(c.nodeName,this)).parse(c)}}};W.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};X.prototype.parse=function(a){this.id=a.getAttribute("id");
|
|
|
+this.name=a.getAttribute("name");this.source={};for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "source":c=(new v).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new ea(this)).parse(c));break;case "channel":this.channel.push((new T(this)).parse(c))}}return this};T.prototype.parse=function(a){this.source=a.getAttribute("source").replace(/^#/,"");this.target=a.getAttribute("target");var b=this.target.split("/");b.shift();var a=
|
|
|
+b.shift(),c=a.indexOf(".")>=0,d=a.indexOf("(")>=0,e,f;if(c)b=a.split("."),a=b.shift(),f=b.shift();else if(d){e=a.split("(");a=e.shift();for(b=0;b<e.length;b++)e[b]=parseInt(e[b].replace(/\)/,""))}this.sid=a;this.dotSyntax=c;this.arrSyntax=d;this.arrIndices=e;this.member=f;return this};ea.prototype.parse=function(a){this.id=a.getAttribute("id");this.inputs=[];for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];if(c.nodeType==1)switch(c.nodeName){case "input":this.inputs.push((new G).parse(c))}}return this};
|
|
|
+ea.prototype.create=function(){for(var a=0;a<this.inputs.length;a++){var b=this.inputs[a],c=this.animation.source[b.source];switch(b.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(b.semantic)}}this.duration=this.endTime=this.startTime=0;if(this.input.length){this.startTime=1E8;this.endTime=-1E8;for(a=0;a<this.input.length;a++)this.startTime=
|
|
|
+Math.min(this.startTime,this.input[a]),this.endTime=Math.max(this.endTime,this.input[a]);this.duration=this.endTime-this.startTime}};return{load:function(b,c){if(document.implementation&&document.implementation.createDocument){document.implementation.createDocument("http://www.collada.org/2005/11/COLLADASchema","COLLADA",null);b+="?rnd="+Math.random();var d=new XMLHttpRequest;d.overrideMimeType&&d.overrideMimeType("text/xml");d.onreadystatechange=function(){if(d.readyState==4&&(d.status==0||d.status==
|
|
|
+200))fa=c,a(d.responseXML,void 0,b)};d.open("GET",b,!0);d.send(null)}else alert("Don't know how to parse XML!")},parse:a,setPreferredShading:function(a){xa=a},applySkin:g,geometries:ka}};THREE.JSONLoader=function(a){THREE.Loader.call(this,a)};THREE.JSONLoader.prototype=new THREE.Loader;THREE.JSONLoader.prototype.constructor=THREE.JSONLoader;THREE.JSONLoader.prototype.supr=THREE.Loader.prototype;
|
|
|
+THREE.JSONLoader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),b=a,a=b.model,c=b.callback,b=b.texture_path;b=b?b:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,c,b)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,c,b,d,g){var e=new XMLHttpRequest,f=0;e.onreadystatechange=function(){if(e.readyState==4)if(e.status==200||e.status==0)try{var h=JSON.parse(e.responseText);a.createModel(h,b,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+c+"] seems to be using old model format")}else console.error("Couldn't load ["+c+"] ["+e.status+"]");else e.readyState==3?g&&(f==0&&(f=e.getResponseHeader("Content-Length")),g({total:f,loaded:e.responseText.length})):
|
|
|
e.readyState==2&&(f=e.getResponseHeader("Content-Length"))};e.open("GET",c,!0);e.overrideMimeType("text/plain; charset=x-user-defined");e.setRequestHeader("Content-Type","text/plain");e.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,l,k,p,q,m,t,n,o,s,u,r,y=a.faces;p=a.vertices;var v=a.normals,G=a.colors,B=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&B++;for(c=0;c<B;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=p.length;l<
|
|
|
-k;)q=new THREE.Vertex,q.position.x=p[l++]*b,q.position.y=p[l++]*b,q.position.z=p[l++]*b,d.vertices.push(q);l=0;for(k=y.length;l<k;){b=y[l++];p=b&1;i=b&2;c=b&4;g=b&8;m=b&16;q=b&32;n=b&64;b&=128;p?(o=new THREE.Face4,o.a=y[l++],o.b=y[l++],o.c=y[l++],o.d=y[l++],p=4):(o=new THREE.Face3,o.a=y[l++],o.b=y[l++],o.c=y[l++],p=3);if(i)i=y[l++],o.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<B;c++)s=a.uvs[c],t=y[l++],r=s[t*2],t=s[t*2+1],d.faceUvs[c][i]=new THREE.UV(r,t);if(g)for(c=0;c<B;c++){s=a.uvs[c];u=[];
|
|
|
-for(g=0;g<p;g++)t=y[l++],r=s[t*2],t=s[t*2+1],u[g]=new THREE.UV(r,t);d.faceVertexUvs[c][i]=u}if(m)m=y[l++]*3,g=new THREE.Vector3,g.x=v[m++],g.y=v[m++],g.z=v[m],o.normal=g;if(q)for(c=0;c<p;c++)m=y[l++]*3,g=new THREE.Vector3,g.x=v[m++],g.y=v[m++],g.z=v[m],o.vertexNormals.push(g);if(n)q=y[l++],q=new THREE.Color(G[q]),o.color=q;if(b)for(c=0;c<p;c++)q=y[l++],q=new THREE.Color(G[q]),o.vertexColors.push(q);d.faces.push(o)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,c,b){var d=new THREE.Geometry,g=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,b);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,g,i,l,k,p,q,m,t,n,o,s,u,r,z=a.faces;p=a.vertices;var E=a.normals,G=a.colors,v=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&v++;for(c=0;c<v;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];l=0;for(k=p.length;l<
|
|
|
+k;)q=new THREE.Vertex,q.position.x=p[l++]*b,q.position.y=p[l++]*b,q.position.z=p[l++]*b,d.vertices.push(q);l=0;for(k=z.length;l<k;){b=z[l++];p=b&1;i=b&2;c=b&4;g=b&8;m=b&16;q=b&32;n=b&64;b&=128;p?(o=new THREE.Face4,o.a=z[l++],o.b=z[l++],o.c=z[l++],o.d=z[l++],p=4):(o=new THREE.Face3,o.a=z[l++],o.b=z[l++],o.c=z[l++],p=3);if(i)i=z[l++],o.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<v;c++)s=a.uvs[c],t=z[l++],r=s[t*2],t=s[t*2+1],d.faceUvs[c][i]=new THREE.UV(r,t);if(g)for(c=0;c<v;c++){s=a.uvs[c];u=[];
|
|
|
+for(g=0;g<p;g++)t=z[l++],r=s[t*2],t=s[t*2+1],u[g]=new THREE.UV(r,t);d.faceVertexUvs[c][i]=u}if(m)m=z[l++]*3,g=new THREE.Vector3,g.x=E[m++],g.y=E[m++],g.z=E[m],o.normal=g;if(q)for(c=0;c<p;c++)m=z[l++]*3,g=new THREE.Vector3,g.x=E[m++],g.y=E[m++],g.z=E[m],o.vertexNormals.push(g);if(n)q=z[l++],q=new THREE.Color(G[q]),o.color=q;if(b)for(c=0;c<p;c++)q=z[l++],q=new THREE.Color(G[q]),o.vertexColors.push(q);d.faces.push(o)}}})(g);(function(){var b,c,g,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
|
|
|
2)g=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(g,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)g=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(g,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,g,i,l,k,p,q,m,t;c=0;for(g=a.morphTargets.length;c<g;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;
|
|
|
t=a.morphTargets[c].vertices;i=0;for(l=t.length;i<l;i+=3)k=t[i]*b,p=t[i+1]*b,q=t[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(k,p,q)))}}if(a.morphColors!==void 0){c=0;for(g=a.morphColors.length;c<g;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];l=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)p=new THREE.Color(16755200),p.setRGB(k[b],k[b+1],k[b+2]),l.push(p)}}})(g);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
|
|
|
d.computeTangents();c(d)};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){}};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
|
|
|
THREE.SceneLoader.prototype.load=function(a,c){var b=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var g=JSON.parse(d.responseText);g.metadata===void 0||g.metadata.formatVersion===void 0||g.metadata.formatVersion!==3?console.error("Deprecated file format."):b.createScene(g,c,a)}catch(e){console.error(e),console.warn("DEPRECATED: ["+a+"] seems to be using old model format")}else console.error("Couldn't load ["+a+"] ["+d.status+"]")};
|
|
|
d.open("GET",a,!0);d.overrideMimeType("text/plain; charset=x-user-defined");d.setRequestHeader("Content-Type","text/plain");d.send(null)};
|
|
|
-THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function g(){var a;for(q in L.objects)if(!E.objects[q])if(s=L.objects[q],s.geometry!==void 0){if(w=E.geometries[s.geometry]){a=!1;for(P=0;P<s.materials.length;P++)K=E.materials[s.materials[P]],a=K instanceof THREE.ShaderMaterial;a&&w.computeTangents();y=s.position;v=s.rotation;G=s.quaternion;B=s.scale;G=0;K.length==0&&(K=new THREE.MeshFaceMaterial);K.length>1&&(K=new THREE.MeshFaceMaterial);
|
|
|
-a=new THREE.Mesh(w,K);a.name=q;a.position.set(y[0],y[1],y[2]);G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]);a.scale.set(B[0],B[1],B[2]);a.visible=s.visible;E.scene.add(a);E.objects[q]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);E.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(w),E.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b=
|
|
|
-{type:s.trigger,object:s},E.triggers[a.name]=b)}}else y=s.position,v=s.rotation,G=s.quaternion,B=s.scale,G=0,a=new THREE.Object3D,a.name=q,a.position.set(y[0],y[1],y[2]),G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(v[0],v[1],v[2]),a.scale.set(B[0],B[1],B[2]),a.visible=s.visible!==void 0?s.visible:!1,E.scene.add(a),E.objects[q]=a,E.empties[q]=a,s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},E.triggers[a.name]=b)}function e(a){return function(b){E.geometries[a]=
|
|
|
-b;g();W-=1;i.onLoadComplete();h()}}function f(a){return function(b){E.geometries[a]=b}}function h(){i.callbackProgress({totalModels:X,totalTextures:$,loadedModels:X-W,loadedTextures:$-U},E);i.onLoadProgress();W==0&&U==0&&c(E)}var i=this,l=THREE.Loader.prototype.extractUrlbase(b),k,p,q,m,t,n,o,s,u,r,y,v,G,B,H,w,D,A,K,L,S,W,U,X,$,E;L=a;b=new THREE.BinaryLoader;S=new THREE.JSONLoader;U=W=0;E={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
-empties:{}};a=!1;for(q in L.objects)if(s=L.objects[q],s.meshCollider){a=!0;break}if(a)E.scene.collisions=new THREE.CollisionSystem;if(L.transform){a=L.transform.position;u=L.transform.rotation;var I=L.transform.scale;a&&E.scene.position.set(a[0],a[1],a[2]);u&&E.scene.rotation.set(u[0],u[1],u[2]);I&&E.scene.scale.set(I[0],I[1],I[2]);(a||u||I)&&E.scene.updateMatrix()}a=function(){U-=1;h();i.onLoadComplete()};for(t in L.cameras)u=L.cameras[t],u.type=="perspective"?D=new THREE.PerspectiveCamera(u.fov,
|
|
|
-u.aspect,u.near,u.far):u.type=="ortho"&&(D=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far)),y=u.position,u=u.target,D.position.set(y[0],y[1],y[2]),D.target=new THREE.Vector3(u[0],u[1],u[2]),E.cameras[t]=D;for(m in L.lights)u=L.lights[m],t=u.color!==void 0?u.color:16777215,D=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(y=u.direction,r=new THREE.DirectionalLight(t,D),r.position.set(y[0],y[1],y[2]),r.position.normalize()):u.type=="point"?(y=u.position,r=u.distance,
|
|
|
-r=new THREE.PointLight(t,D,r),r.position.set(y[0],y[1],y[2])):u.type=="ambient"&&(r=new THREE.AmbientLight(t)),E.scene.add(r),E.lights[m]=r;for(n in L.fogs)m=L.fogs[n],m.type=="linear"?A=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(A=new THREE.FogExp2(0,m.density)),u=m.color,A.color.setRGB(u[0],u[1],u[2]),E.fogs[n]=A;if(E.cameras&&L.defaults.camera)E.currentCamera=E.cameras[L.defaults.camera];if(E.fogs&&L.defaults.fog)E.scene.fog=E.fogs[L.defaults.fog];u=L.defaults.bgcolor;E.bgColor=new THREE.Color;
|
|
|
-E.bgColor.setRGB(u[0],u[1],u[2]);E.bgColorAlpha=L.defaults.bgalpha;for(k in L.geometries)if(n=L.geometries[k],n.type=="bin_mesh"||n.type=="ascii_mesh")W+=1,i.onLoadStart();X=W;for(k in L.geometries)n=L.geometries[k],n.type=="cube"?(w=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),E.geometries[k]=w):n.type=="plane"?(w=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),E.geometries[k]=w):n.type=="sphere"?
|
|
|
-(w=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),E.geometries[k]=w):n.type=="cylinder"?(w=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),E.geometries[k]=w):n.type=="torus"?(w=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),E.geometries[k]=w):n.type=="icosahedron"?(w=new THREE.IcosahedronGeometry(n.subdivisions),E.geometries[k]=w):n.type=="bin_mesh"?b.load(d(n.url,L.urlBaseType),e(k)):n.type=="ascii_mesh"?S.load(d(n.url,L.urlBaseType),
|
|
|
-e(k)):n.type=="embedded_mesh"&&(n=L.embeds[n.id])&&S.createModel(n,f(k),"");for(o in L.textures)if(k=L.textures[o],k.url instanceof Array){U+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else U+=1,i.onLoadStart();$=U;for(o in L.textures){k=L.textures[o];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(var P=0;P<k.url.length;P++)n[P]=d(k.url[P],L.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,
|
|
|
-L.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)n.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)n.magFilter=THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);if(k.wrap){A={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(A[k.wrap[0]]!==void 0)n.wrapS=A[k.wrap[0]];if(A[k.wrap[1]]!==void 0)n.wrapT=
|
|
|
-A[k.wrap[1]]}}E.textures[o]=n}for(p in L.materials){o=L.materials[p];for(H in o.parameters)if(H=="envMap"||H=="map"||H=="lightMap")o.parameters[H]=E.textures[o.parameters[H]];else if(H=="shading")o.parameters[H]=o.parameters[H]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(H=="blending")o.parameters[H]=THREE[o.parameters[H]]?THREE[o.parameters[H]]:THREE.NormalBlending;else if(H=="combine")o.parameters[H]=o.parameters[H]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(H==
|
|
|
-"vertexColors")if(o.parameters[H]=="face")o.parameters[H]=THREE.FaceColors;else if(o.parameters[H])o.parameters[H]=THREE.VertexColors;if(o.parameters.opacity!==void 0&&o.parameters.opacity<1)o.parameters.transparent=!0;if(o.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);n=o.parameters.color;A=o.parameters.specular;b=o.parameters.ambient;S=o.parameters.shininess;a.tNormal.texture=E.textures[o.parameters.normalMap];if(o.parameters.normalMapFactor)a.uNormalScale.value=
|
|
|
-o.parameters.normalMapFactor;if(o.parameters.map)a.tDiffuse.texture=o.parameters.map,a.enableDiffuse.value=!0;if(o.parameters.lightMap)a.tAO.texture=o.parameters.lightMap,a.enableAO.value=!0;if(o.parameters.specularMap)a.tSpecular.texture=E.textures[o.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(A);a.uAmbientColor.value.setHex(b);a.uShininess.value=S;if(o.parameters.opacity)a.uOpacity.value=o.parameters.opacity;o=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
|
|
|
-vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else o=new THREE[o.type](o.parameters);E.materials[p]=o}g();i.callbackSync(E);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
+THREE.SceneLoader.prototype.createScene=function(a,c,b){function d(a,b){return b=="relativeToHTML"?a:l+"/"+a}function g(){var a;for(q in J.objects)if(!x.objects[q])if(s=J.objects[q],s.geometry!==void 0){if(C=x.geometries[s.geometry]){a=!1;for(O=0;O<s.materials.length;O++)L=x.materials[s.materials[O]],a=L instanceof THREE.ShaderMaterial;a&&C.computeTangents();z=s.position;E=s.rotation;G=s.quaternion;v=s.scale;G=0;L.length==0&&(L=new THREE.MeshFaceMaterial);L.length>1&&(L=new THREE.MeshFaceMaterial);
|
|
|
+a=new THREE.Mesh(C,L);a.name=q;a.position.set(z[0],z[1],z[2]);G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(E[0],E[1],E[2]);a.scale.set(v[0],v[1],v[2]);a.visible=s.visible;x.scene.add(a);x.objects[q]=a;if(s.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);x.scene.collisions.colliders.push(b)}if(s.castsShadow)b=new THREE.ShadowVolume(C),x.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;s.trigger&&s.trigger.toLowerCase()!="none"&&(b=
|
|
|
+{type:s.trigger,object:s},x.triggers[a.name]=b)}}else z=s.position,E=s.rotation,G=s.quaternion,v=s.scale,G=0,a=new THREE.Object3D,a.name=q,a.position.set(z[0],z[1],z[2]),G?(a.quaternion.set(G[0],G[1],G[2],G[3]),a.useQuaternion=!0):a.rotation.set(E[0],E[1],E[2]),a.scale.set(v[0],v[1],v[2]),a.visible=s.visible!==void 0?s.visible:!1,x.scene.add(a),x.objects[q]=a,x.empties[q]=a,s.trigger&&s.trigger.toLowerCase()!="none"&&(b={type:s.trigger,object:s},x.triggers[a.name]=b)}function e(a){return function(b){x.geometries[a]=
|
|
|
+b;g();X-=1;i.onLoadComplete();h()}}function f(a){return function(b){x.geometries[a]=b}}function h(){i.callbackProgress({totalModels:ea,totalTextures:ba,loadedModels:ea-X,loadedTextures:ba-T},x);i.onLoadProgress();X==0&&T==0&&c(x)}var i=this,l=THREE.Loader.prototype.extractUrlbase(b),k,p,q,m,t,n,o,s,u,r,z,E,G,v,w,C,F,B,L,J,W,X,T,ea,ba,x;J=a;b=new THREE.BinaryLoader;W=new THREE.JSONLoader;T=X=0;x={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
+empties:{}};a=!1;for(q in J.objects)if(s=J.objects[q],s.meshCollider){a=!0;break}if(a)x.scene.collisions=new THREE.CollisionSystem;if(J.transform){a=J.transform.position;u=J.transform.rotation;var I=J.transform.scale;a&&x.scene.position.set(a[0],a[1],a[2]);u&&x.scene.rotation.set(u[0],u[1],u[2]);I&&x.scene.scale.set(I[0],I[1],I[2]);(a||u||I)&&x.scene.updateMatrix()}a=function(){T-=1;h();i.onLoadComplete()};for(t in J.cameras)u=J.cameras[t],u.type=="perspective"?F=new THREE.PerspectiveCamera(u.fov,
|
|
|
+u.aspect,u.near,u.far):u.type=="ortho"&&(F=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far)),z=u.position,u=u.target,F.position.set(z[0],z[1],z[2]),F.target=new THREE.Vector3(u[0],u[1],u[2]),x.cameras[t]=F;for(m in J.lights)u=J.lights[m],t=u.color!==void 0?u.color:16777215,F=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(z=u.direction,r=new THREE.DirectionalLight(t,F),r.position.set(z[0],z[1],z[2]),r.position.normalize()):u.type=="point"?(z=u.position,r=u.distance,
|
|
|
+r=new THREE.PointLight(t,F,r),r.position.set(z[0],z[1],z[2])):u.type=="ambient"&&(r=new THREE.AmbientLight(t)),x.scene.add(r),x.lights[m]=r;for(n in J.fogs)m=J.fogs[n],m.type=="linear"?B=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(B=new THREE.FogExp2(0,m.density)),u=m.color,B.color.setRGB(u[0],u[1],u[2]),x.fogs[n]=B;if(x.cameras&&J.defaults.camera)x.currentCamera=x.cameras[J.defaults.camera];if(x.fogs&&J.defaults.fog)x.scene.fog=x.fogs[J.defaults.fog];u=J.defaults.bgcolor;x.bgColor=new THREE.Color;
|
|
|
+x.bgColor.setRGB(u[0],u[1],u[2]);x.bgColorAlpha=J.defaults.bgalpha;for(k in J.geometries)if(n=J.geometries[k],n.type=="bin_mesh"||n.type=="ascii_mesh")X+=1,i.onLoadStart();ea=X;for(k in J.geometries)n=J.geometries[k],n.type=="cube"?(C=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),x.geometries[k]=C):n.type=="plane"?(C=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),x.geometries[k]=C):n.type=="sphere"?
|
|
|
+(C=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),x.geometries[k]=C):n.type=="cylinder"?(C=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),x.geometries[k]=C):n.type=="torus"?(C=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),x.geometries[k]=C):n.type=="icosahedron"?(C=new THREE.IcosahedronGeometry(n.subdivisions),x.geometries[k]=C):n.type=="bin_mesh"?b.load(d(n.url,J.urlBaseType),e(k)):n.type=="ascii_mesh"?W.load(d(n.url,J.urlBaseType),
|
|
|
+e(k)):n.type=="embedded_mesh"&&(n=J.embeds[n.id])&&W.createModel(n,f(k),"");for(o in J.textures)if(k=J.textures[o],k.url instanceof Array){T+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else T+=1,i.onLoadStart();ba=T;for(o in J.textures){k=J.textures[o];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(var O=0;O<k.url.length;O++)n[O]=d(k.url[O],J.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,
|
|
|
+J.urlBaseType),k.mapping,a);if(THREE[k.minFilter]!=void 0)n.minFilter=THREE[k.minFilter];if(THREE[k.magFilter]!=void 0)n.magFilter=THREE[k.magFilter];if(k.repeat){n.repeat.set(k.repeat[0],k.repeat[1]);if(k.repeat[0]!=1)n.wrapS=THREE.RepeatWrapping;if(k.repeat[1]!=1)n.wrapT=THREE.RepeatWrapping}k.offset&&n.offset.set(k.offset[0],k.offset[1]);if(k.wrap){B={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(B[k.wrap[0]]!==void 0)n.wrapS=B[k.wrap[0]];if(B[k.wrap[1]]!==void 0)n.wrapT=
|
|
|
+B[k.wrap[1]]}}x.textures[o]=n}for(p in J.materials){o=J.materials[p];for(w in o.parameters)if(w=="envMap"||w=="map"||w=="lightMap")o.parameters[w]=x.textures[o.parameters[w]];else if(w=="shading")o.parameters[w]=o.parameters[w]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(w=="blending")o.parameters[w]=THREE[o.parameters[w]]?THREE[o.parameters[w]]:THREE.NormalBlending;else if(w=="combine")o.parameters[w]=o.parameters[w]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(w==
|
|
|
+"vertexColors")if(o.parameters[w]=="face")o.parameters[w]=THREE.FaceColors;else if(o.parameters[w])o.parameters[w]=THREE.VertexColors;if(o.parameters.opacity!==void 0&&o.parameters.opacity<1)o.parameters.transparent=!0;if(o.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);n=o.parameters.color;B=o.parameters.specular;b=o.parameters.ambient;W=o.parameters.shininess;a.tNormal.texture=x.textures[o.parameters.normalMap];if(o.parameters.normalMapFactor)a.uNormalScale.value=
|
|
|
+o.parameters.normalMapFactor;if(o.parameters.map)a.tDiffuse.texture=o.parameters.map,a.enableDiffuse.value=!0;if(o.parameters.lightMap)a.tAO.texture=o.parameters.lightMap,a.enableAO.value=!0;if(o.parameters.specularMap)a.tSpecular.texture=x.textures[o.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(B);a.uAmbientColor.value.setHex(b);a.uShininess.value=W;if(o.parameters.opacity)a.uOpacity.value=o.parameters.opacity;o=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
|
|
|
+vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else o=new THREE[o.type](o.parameters);x.materials[p]=o}g();i.callbackSync(x);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype.load=function(a,c,b){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),b=a,a=b.model,c=b.callback,b={scale:b.scale,offsetX:b.offsetX,offsetY:b.offsetY,offsetZ:b.offsetZ};var d=new XMLHttpRequest,g=b.scale!==void 0?b.scale:1,e=b.offsetX!==void 0?b.offsetX:0,f=b.offsetY!==void 0?b.offsetY:0,h=b.offsetZ!==void 0?b.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
|
|
|
c,g,e,f,h):alert("Couldn't load ["+a+"] ["+d.status+"]"):d.readyState!=3&&d.readyState==2&&d.getResponseHeader("Content-Length")};d.open("GET",a,!0);d.send(null)};THREE.UTF8Loader.prototype.decompressMesh=function(a){var c=a.charCodeAt(0);c>=57344&&(c-=2048);c++;for(var b=new Float32Array(8*c),d=1,g=0;g<8;g++){for(var e=0,f=0;f<c;++f){var h=a.charCodeAt(f+d);e+=h>>1^-(h&1);b[8*f+g]=e}d+=c}c=a.length-d;e=new Uint16Array(c);for(g=f=0;g<c;g++)h=a.charCodeAt(g+d),e[g]=f-h,h==0&&f++;return[b,e]};
|
|
|
-THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],k=[];(function(a,f,i){for(var l,k,o,s=a.length;i<s;i+=f)l=a[i],k=a[i+1],o=a[i+2],l=l/16383*b,k=k/16383*b,o=o/16383*b,l+=d,k+=g,o+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(l,k,o)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(f[0],8,3);(function(a,
|
|
|
-b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,u,r,y,v=a.length;for(b=0;b<v;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;r=d;y=e;i=f;u=d;var G=e,B=f,H=g.materials[0],w=l[G*3],D=l[G*3+1],G=l[G*3+2],A=l[B*3],K=l[B*3+1],B=l[B*3+2];u=new THREE.Vector3(l[u*3],l[u*3+1],l[u*3+2]);G=new THREE.Vector3(w,D,G);B=new THREE.Vector3(A,K,B);g.faces.push(new THREE.Face3(r,y,i,[u,G,B],null,H));g=k[d*2];d=k[d*2+
|
|
|
-1];i=k[e*2];u=k[e*2+1];r=k[f*2];y=k[f*2+1];f=c.faceVertexUvs[0];e=i;i=u;u=[];u.push(new THREE.UV(g,d));u.push(new THREE.UV(e,i));u.push(new THREE.UV(r,y));f.push(u)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
|
|
|
+THREE.UTF8Loader.prototype.createModel=function(a,c,b,d,g,e){var f=function(){var c=this;c.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),l=[],k=[];(function(a,f,i){for(var k,l,o,s=a.length;i<s;i+=f)k=a[i],l=a[i+1],o=a[i+2],k=k/16383*b,l=l/16383*b,o=o/16383*b,k+=d,l+=g,o+=e,c.vertices.push(new THREE.Vertex(new THREE.Vector3(k,l,o)))})(f[0],8,0);(function(a,b,c){for(var d,e,f=a.length;c<f;c+=b)d=a[c],e=a[c+1],d/=1023,e/=1023,k.push(d,1-e)})(f[0],8,3);(function(a,
|
|
|
+b,c){for(var d,e,f,g=a.length;c<g;c+=b)d=a[c],e=a[c+1],f=a[c+2],d=(d-512)/511,e=(e-512)/511,f=(f-512)/511,l.push(d,e,f)})(f[0],8,5);(function(a){var b,d,e,f,g,i,u,r,z,E=a.length;for(b=0;b<E;b+=3){d=a[b];e=a[b+1];f=a[b+2];g=c;r=d;z=e;i=f;u=d;var G=e,v=f,w=g.materials[0],C=l[G*3],F=l[G*3+1],G=l[G*3+2],B=l[v*3],L=l[v*3+1],v=l[v*3+2];u=new THREE.Vector3(l[u*3],l[u*3+1],l[u*3+2]);G=new THREE.Vector3(C,F,G);v=new THREE.Vector3(B,L,v);g.faces.push(new THREE.Face3(r,z,i,[u,G,v],null,w));g=k[d*2];d=k[d*2+
|
|
|
+1];i=k[e*2];u=k[e*2+1];r=k[f*2];z=k[f*2+1];f=c.faceVertexUvs[0];e=i;i=u;u=[];u.push(new THREE.UV(g,d));u.push(new THREE.UV(e,i));u.push(new THREE.UV(r,z));f.push(u)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;c(new f)};
|
|
|
THREE.Axes=function(){THREE.Object3D.call(this);var a=new THREE.Geometry;a.vertices.push(new THREE.Vertex);a.vertices.push(new THREE.Vertex(new THREE.Vector3(0,100,0)));var c=new THREE.CylinderGeometry(0,5,25,5,1),b=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:16711680}));b.position.x=100;b.rotation.z=-Math.PI/2;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(b);
|
|
|
b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:65280}));b.position.y=100;this.add(b);b=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));b.rotation.x=Math.PI/2;this.add(b);b=new THREE.Mesh(c,new THREE.MeshBasicMaterial({color:255}));b.position.z=100;b.rotation.x=Math.PI/2;this.add(b)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
|
THREE.MarchingCubes=function(a,c){THREE.Object3D.call(this);this.materials=c instanceof Array?c:[c];this.init=function(a){this.isolation=80;this.size=a;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(a,c,g){return a+(c-a)*g};this.VIntX=function(a,c,g,e,f,h,i,l,k,p){f=(f-k)/(p-k);k=this.normal_cache;c[e]=h+f*this.delta;c[e+1]=i;c[e+2]=l;g[e]=this.lerp(k[a],k[a+3],f);g[e+1]=this.lerp(k[a+1],k[a+4],f);g[e+2]=this.lerp(k[a+2],k[a+5],f)};this.VIntY=function(a,c,g,e,f,h,i,l,k,p){f=(f-k)/(p-k);k=this.normal_cache;c[e]=h;c[e+1]=i+f*this.delta;c[e+
|
|
|
2]=l;c=a+this.yd*3;g[e]=this.lerp(k[a],k[c],f);g[e+1]=this.lerp(k[a+1],k[c+1],f);g[e+2]=this.lerp(k[a+2],k[c+2],f)};this.VIntZ=function(a,c,g,e,f,h,i,l,k,p){f=(f-k)/(p-k);k=this.normal_cache;c[e]=h;c[e+1]=i;c[e+2]=l+f*this.delta;c=a+this.zd*3;g[e]=this.lerp(k[a],k[c],f);g[e+1]=this.lerp(k[a+1],k[c+1],f);g[e+2]=this.lerp(k[a+2],k[c+2],f)};this.compNorm=function(a){var c=a*3;this.normal_cache[c]===0&&(this.normal_cache[c]=this.field[a-1]-this.field[a+1],this.normal_cache[c+1]=this.field[a-this.yd]-
|
|
|
-this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,e,f,h){var i=e+1,l=e+this.yd,k=e+this.zd,p=i+this.yd,q=i+this.zd,m=e+this.yd+this.zd,t=i+this.yd+this.zd,n=0,o=this.field[e],s=this.field[i],u=this.field[l],r=this.field[p],y=this.field[k],v=this.field[q],G=this.field[m],B=this.field[t];o<f&&(n|=1);s<f&&(n|=2);u<f&&(n|=8);r<f&&(n|=4);y<f&&(n|=16);v<f&&(n|=32);G<f&&(n|=128);B<f&&(n|=64);var H=THREE.edgeTable[n];if(H===0)return 0;
|
|
|
-var w=this.delta,D=a+w,A=c+w,w=g+w;H&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,o,s));H&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(i*3,this.vlist,this.nlist,3,f,D,c,g,s,r));H&4&&(this.compNorm(l),this.compNorm(p),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,A,g,u,r));H&8&&(this.compNorm(e),this.compNorm(l),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,o,u));H&16&&(this.compNorm(k),this.compNorm(q),this.VIntX(k*3,this.vlist,this.nlist,12,f,a,c,w,y,v));
|
|
|
-H&32&&(this.compNorm(q),this.compNorm(t),this.VIntY(q*3,this.vlist,this.nlist,15,f,D,c,w,v,B));H&64&&(this.compNorm(m),this.compNorm(t),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,A,w,G,B));H&128&&(this.compNorm(k),this.compNorm(m),this.VIntY(k*3,this.vlist,this.nlist,21,f,a,c,w,y,G));H&256&&(this.compNorm(e),this.compNorm(k),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,o,y));H&512&&(this.compNorm(i),this.compNorm(q),this.VIntZ(i*3,this.vlist,this.nlist,27,f,D,c,g,s,v));H&1024&&(this.compNorm(p),
|
|
|
-this.compNorm(t),this.VIntZ(p*3,this.vlist,this.nlist,30,f,D,A,g,r,B));H&2048&&(this.compNorm(l),this.compNorm(m),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,A,g,u,G));n<<=4;for(f=e=0;THREE.triTable[n+f]!=-1;)a=n+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),f+=3,e++;return e};this.posnormtriv=function(a,c,g,e,f,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
|
|
|
+this.field[a+this.yd],this.normal_cache[c+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,c,g,e,f,h){var i=e+1,l=e+this.yd,k=e+this.zd,p=i+this.yd,q=i+this.zd,m=e+this.yd+this.zd,t=i+this.yd+this.zd,n=0,o=this.field[e],s=this.field[i],u=this.field[l],r=this.field[p],z=this.field[k],E=this.field[q],G=this.field[m],v=this.field[t];o<f&&(n|=1);s<f&&(n|=2);u<f&&(n|=8);r<f&&(n|=4);z<f&&(n|=16);E<f&&(n|=32);G<f&&(n|=128);v<f&&(n|=64);var w=THREE.edgeTable[n];if(w===0)return 0;
|
|
|
+var C=this.delta,F=a+C,B=c+C,C=g+C;w&1&&(this.compNorm(e),this.compNorm(i),this.VIntX(e*3,this.vlist,this.nlist,0,f,a,c,g,o,s));w&2&&(this.compNorm(i),this.compNorm(p),this.VIntY(i*3,this.vlist,this.nlist,3,f,F,c,g,s,r));w&4&&(this.compNorm(l),this.compNorm(p),this.VIntX(l*3,this.vlist,this.nlist,6,f,a,B,g,u,r));w&8&&(this.compNorm(e),this.compNorm(l),this.VIntY(e*3,this.vlist,this.nlist,9,f,a,c,g,o,u));w&16&&(this.compNorm(k),this.compNorm(q),this.VIntX(k*3,this.vlist,this.nlist,12,f,a,c,C,z,E));
|
|
|
+w&32&&(this.compNorm(q),this.compNorm(t),this.VIntY(q*3,this.vlist,this.nlist,15,f,F,c,C,E,v));w&64&&(this.compNorm(m),this.compNorm(t),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,B,C,G,v));w&128&&(this.compNorm(k),this.compNorm(m),this.VIntY(k*3,this.vlist,this.nlist,21,f,a,c,C,z,G));w&256&&(this.compNorm(e),this.compNorm(k),this.VIntZ(e*3,this.vlist,this.nlist,24,f,a,c,g,o,z));w&512&&(this.compNorm(i),this.compNorm(q),this.VIntZ(i*3,this.vlist,this.nlist,27,f,F,c,g,s,E));w&1024&&(this.compNorm(p),
|
|
|
+this.compNorm(t),this.VIntZ(p*3,this.vlist,this.nlist,30,f,F,B,g,r,v));w&2048&&(this.compNorm(l),this.compNorm(m),this.VIntZ(l*3,this.vlist,this.nlist,33,f,a,B,g,u,G));n<<=4;for(f=e=0;THREE.triTable[n+f]!=-1;)a=n+f,c=a+1,g=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[c],3*THREE.triTable[g],h),f+=3,e++;return e};this.posnormtriv=function(a,c,g,e,f,h){var i=this.count*3;this.positionArray[i]=a[g];this.positionArray[i+1]=a[g+1];this.positionArray[i+2]=a[g+2];this.positionArray[i+
|
|
|
3]=a[e];this.positionArray[i+4]=a[e+1];this.positionArray[i+5]=a[e+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=c[g];this.normalArray[i+1]=c[g+1];this.normalArray[i+2]=c[g+2];this.normalArray[i+3]=c[e];this.normalArray[i+4]=c[e+1];this.normalArray[i+5]=c[e+2];this.normalArray[i+6]=c[f];this.normalArray[i+7]=c[f+1];this.normalArray[i+8]=c[f+2];this.hasNormal=this.hasPos=!0;this.count+=3;this.count>=this.maxCount-3&&h(this)};this.begin=
|
|
|
function(){this.count=0;this.hasNormal=this.hasPos=!1};this.end=function(a){if(this.count!==0){for(var c=this.count*3;c<this.positionArray.length;c++)this.positionArray[c]=0;a(this)}};this.addBall=function(a,c,g,e,f){var h=this.size*Math.sqrt(e/f),i=g*this.size,l=c*this.size,k=a*this.size,p=Math.floor(i-h);p<1&&(p=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var q=Math.floor(l-h);q<1&&(q=1);l=Math.floor(l+h);l>this.size-1&&(l=this.size-1);var m=Math.floor(k-h);m<1&&(m=1);h=Math.floor(k+h);
|
|
|
h>this.size-1&&(h=this.size-1);for(var t,n,o,s,u,r;p<i;p++){k=this.size2*p;n=p/this.size-g;u=n*n;for(n=q;n<l;n++){o=k+this.size*n;t=n/this.size-c;r=t*t;for(t=m;t<h;t++)s=t/this.size-a,s=e/(1.0E-6+s*s+r+u)-f,s>0&&(this.field[o+t]+=s)}}};this.addPlaneX=function(a,c){var g,e,f,h,i,l=this.size,k=this.yd,p=this.zd,q=this.field,m=l*Math.sqrt(a/c);m>l&&(m=l);for(g=0;g<m;g++)if(e=g/l,e*=e,h=a/(1.0E-4+e)-c,h>0)for(e=0;e<l;e++){i=g+e*k;for(f=0;f<l;f++)q[p*f+i]+=h}};this.addPlaneY=function(a,c){var g,e,f,h,
|
|
@@ -706,7 +708,7 @@ THREE.CollisionSystem.__r=new THREE.Ray;THREE.CollisionUtils={};THREE.CollisionU
|
|
|
THREE.CollisionUtils.MeshColliderWBox=function(a){return new THREE.MeshCollider(a,THREE.CollisionUtils.MeshOBB(a))};
|
|
|
if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var c=this,b=this.setSize,d=this.render,g=new THREE.PerspectiveCamera,e=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,l,k,p;g.matrixAutoUpdate=e.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},q=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),t=new THREE.PerspectiveCamera(53,
|
|
|
1,1,1E4);t.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:q},mapRight:{type:"t",value:1,texture:m}},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}"}),
|
|
|
-n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(t);this.setSize=function(a,d){b.call(c,a,d);q.width=a;q.height=d;m.width=a;m.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||l!==b.near||k!==b.far||p!==b.fov){i=b.aspect;l=b.near;k=b.far;p=b.fov;var u=b.projectionMatrix.clone(),r=125/30*0.5,y=r*l/125,v=l*Math.tan(p*Math.PI/360),G;f.n14=r;h.n14=-r;r=-v*i+y;G=v*i+y;u.n11=2*l/(G-r);u.n13=(G+r)/(G-r);g.projectionMatrix.copy(u);r=-v*i-y;G=v*i-y;u.n11=
|
|
|
+n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(t);this.setSize=function(a,d){b.call(c,a,d);q.width=a;q.height=d;m.width=a;m.height=d};this.render=function(a,b){a.updateMatrixWorld();if(i!==b.aspect||l!==b.near||k!==b.far||p!==b.fov){i=b.aspect;l=b.near;k=b.far;p=b.fov;var u=b.projectionMatrix.clone(),r=125/30*0.5,z=r*l/125,E=l*Math.tan(p*Math.PI/360),G;f.n14=r;h.n14=-r;r=-E*i+z;G=E*i+z;u.n11=2*l/(G-r);u.n13=(G+r)/(G-r);g.projectionMatrix.copy(u);r=-E*i-z;G=E*i-z;u.n11=
|
|
|
2*l/(G-r);u.n13=(G+r)/(G-r);e.projectionMatrix.copy(u)}g.matrixWorld.copy(b.matrixWorld).multiplySelf(h);g.position.copy(b.position);g.near=b.near;g.far=b.far;d.call(c,a,g,q,!0);e.matrixWorld.copy(b.matrixWorld).multiplySelf(f);e.position.copy(b.position);e.near=b.near;e.far=b.far;d.call(c,a,e,m,!0);n.updateMatrixWorld();d.call(c,n,t)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var c=this,b=this.setSize,d=this.render,g,e,f=new THREE.PerspectiveCamera;f.target=new THREE.Vector3(0,0,0);var h=new THREE.PerspectiveCamera;h.target=new THREE.Vector3(0,0,0);c.separation=10;if(a&&a.separation!==void 0)c.separation=a.separation;this.setSize=function(a,d){b.call(c,a,d);g=a/2;e=d};this.render=function(a,b){this.clear();f.fov=b.fov;f.aspect=0.5*b.aspect;f.near=b.near;f.far=
|
|
|
b.far;f.updateProjectionMatrix();f.position.copy(b.position);f.target.copy(b.target);f.translateX(c.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(b.position);h.target.copy(b.target);h.translateX(-c.separation);h.lookAt(h.target);this.setViewport(0,0,g,e);d.call(c,a,f);this.setViewport(g,0,g,e);d.call(c,a,h,!1)}};
|