|
@@ -15,11 +15,11 @@ this.y=Math.asin(a.n13);Math.abs(b)>1.0E-5?(this.x=Math.atan2(-a.n23/b,a.n33/b),
|
|
|
THREE.Vector4.prototype={constructor:THREE.Vector4,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;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,b){this.x=a.x+b.x;this.y=a.y+b.y;this.z=a.z+b.z;this.w=a.w+b.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,b){this.x=a.x-b.x;this.y=a.y-b.y;this.z=a.z-
|
|
|
b.z;this.w=a.w-b.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,b){this.x+=(a.x-this.x)*b;this.y+=(a.y-this.y)*b;this.z+=(a.z-this.z)*b;this.w+=(a.w-this.w)*b;return this}};
|
|
|
-THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);q=o.dot(b);if(q<=0)return null;n=p.add(a,m.copy(b).multiplyScalar(q));return r=c.distanceTo(n)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);m.sub(a,b);t=o.dot(o);u=o.dot(p);y=o.dot(m);v=p.dot(p);A=p.dot(m);z=1/(t*v-u*u);w=(v*y-u*A)*z;I=(t*A-u*y)*z;return w>=0&&I>=0&&w+I<1}this.origin=a||new THREE.Vector3;this.direction=b||new THREE.Vector3;this.intersectScene=function(a){return this.intersectObjects(a.children)};this.intersectObjects=function(a){var b,
|
|
|
+THREE.Ray=function(a,b){function c(a,b,c){o.sub(c,a);q=o.dot(b);if(q<=0)return null;n=p.add(a,m.copy(b).multiplyScalar(q));return r=c.distanceTo(n)}function d(a,b,c,d){o.sub(d,b);p.sub(c,b);m.sub(a,b);t=o.dot(o);u=o.dot(p);y=o.dot(m);w=p.dot(p);z=p.dot(m);A=1/(t*w-u*u);v=(w*y-u*z)*A;G=(t*z-u*y)*A;return v>=0&&G>=0&&v+G<1}this.origin=a||new THREE.Vector3;this.direction=b||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 e=new THREE.Vector3,g=new THREE.Vector3,f=new THREE.Vector3,h=new THREE.Vector3,a=new THREE.Vector3,b=new THREE.Vector3,i=new THREE.Vector3,j=new THREE.Vector3,k=new THREE.Vector3;this.intersectObject=function(m){for(var n,o=[],p=0,q=m.children.length;p<q;p++)Array.prototype.push.apply(o,this.intersectObject(m.children[p]));if(m instanceof THREE.Particle){p=
|
|
|
c(this.origin,this.direction,m.matrixWorld.getPosition());if(p===null||p>m.scale.x)return[];n={distance:p,point:m.position,face:null,object:m};o.push(n)}else if(m instanceof THREE.Mesh){p=c(this.origin,this.direction,m.matrixWorld.getPosition());if(p===null||p>m.geometry.boundingSphere.radius*Math.max(m.scale.x,Math.max(m.scale.y,m.scale.z)))return o;var r,t=m.geometry,u=t.vertices,y;m.matrixRotationWorld.extractRotation(m.matrixWorld);p=0;for(q=t.faces.length;p<q;p++)if(n=t.faces[p],a.copy(this.origin),
|
|
|
b.copy(this.direction),y=m.matrixWorld,i=y.multiplyVector3(i.copy(n.centroid)).subSelf(a),r=i.dot(b),!(r<=0)&&(e=y.multiplyVector3(e.copy(u[n.a].position)),g=y.multiplyVector3(g.copy(u[n.b].position)),f=y.multiplyVector3(f.copy(u[n.c].position)),n instanceof THREE.Face4&&(h=y.multiplyVector3(h.copy(u[n.d].position))),j=m.matrixRotationWorld.multiplyVector3(j.copy(n.normal)),r=b.dot(j),m.doubleSided||(m.flipSided?r>0:r<0)))if(r=j.dot(i.sub(e,a))/r,k.add(a,b.multiplyScalar(r)),n instanceof THREE.Face3)d(k,
|
|
|
-e,g,f)&&(n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},o.push(n));else if(n instanceof THREE.Face4&&(d(k,e,g,h)||d(k,g,f,h)))n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},o.push(n)}return o};var o=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,q,n,r,t,u,y,v,A,z,w,I};
|
|
|
+e,g,f)&&(n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},o.push(n));else if(n instanceof THREE.Face4&&(d(k,e,g,h)||d(k,g,f,h)))n={distance:a.distanceTo(k),point:k.clone(),face:n,object:m},o.push(n)}return o};var o=new THREE.Vector3,p=new THREE.Vector3,m=new THREE.Vector3,q,n,r,t,u,y,w,z,A,v,G};
|
|
|
THREE.Rectangle=function(){function a(){g=d-b;f=e-c}var b,c,d,e,g,f,h=!0;this.getX=function(){return b};this.getY=function(){return c};this.getWidth=function(){return g};this.getHeight=function(){return f};this.getLeft=function(){return b};this.getTop=function(){return c};this.getRight=function(){return d};this.getBottom=function(){return e};this.set=function(g,f,k,o){h=!1;b=g;c=f;d=k;e=o;a()};this.addPoint=function(g,f){h?(h=!1,b=g,c=f,d=g,e=f):(b=b<g?b:g,c=c<f?c:f,d=d>g?d:g,e=e>f?e:f);a()};this.add3Points=
|
|
|
function(g,f,k,o,p,m){h?(h=!1,b=g<k?g<p?g:p:k<p?k:p,c=f<o?f<m?f:m:o<m?o:m,d=g>k?g>p?g:p:k>p?k:p,e=f>o?f>m?f:m:o>m?o:m):(b=g<k?g<p?g<b?g:b:p<b?p:b:k<p?k<b?k:b:p<b?p:b,c=f<o?f<m?f<c?f:c:m<c?m:c:o<m?o<c?o:c:m<c?m:c,d=g>k?g>p?g>d?g:d:p>d?p:d:k>p?k>d?k:d:p>d?p:d,e=f>o?f>m?f>e?f:e:m>e?m:e:o>m?o>e?o:e:m>e?m:e);a()};this.addRectangle=function(g){h?(h=!1,b=g.getLeft(),c=g.getTop(),d=g.getRight(),e=g.getBottom()):(b=b<g.getLeft()?b:g.getLeft(),c=c<g.getTop()?c:g.getTop(),d=d>g.getRight()?d:g.getRight(),e=e>
|
|
|
g.getBottom()?e:g.getBottom());a()};this.inflate=function(g){b-=g;c-=g;d+=g;e+=g;a()};this.minSelf=function(g){b=b>g.getLeft()?b:g.getLeft();c=c>g.getTop()?c:g.getTop();d=d<g.getRight()?d:g.getRight();e=e<g.getBottom()?e:g.getBottom();a()};this.intersects=function(a){return Math.min(d,a.getRight())-Math.max(b,a.getLeft())>=0&&Math.min(e,a.getBottom())-Math.max(c,a.getTop())>=0};this.empty=function(){h=!0;e=d=c=b=0;a()};this.isEmpty=function(){return h}};
|
|
@@ -28,16 +28,16 @@ THREE.Matrix3.prototype={constructor:THREE.Matrix3,transpose:function(){var a,b=
|
|
|
THREE.Matrix4=function(a,b,c,d,e,g,f,h,i,j,k,o,p,m,q,n){this.set(a!==void 0?a:1,b||0,c||0,d||0,e||0,g!==void 0?g:1,f||0,h||0,i||0,j||0,k!==void 0?k:1,o||0,p||0,m||0,q||0,n!==void 0?n:1);this.flat=Array(16);this.m33=new THREE.Matrix3};
|
|
|
THREE.Matrix4.prototype={constructor:THREE.Matrix4,set:function(a,b,c,d,e,g,f,h,i,j,k,o,p,m,q,n){this.n11=a;this.n12=b;this.n13=c;this.n14=d;this.n21=e;this.n22=g;this.n23=f;this.n24=h;this.n31=i;this.n32=j;this.n33=k;this.n34=o;this.n41=p;this.n42=m;this.n43=q;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,
|
|
|
b,c){var d=THREE.Matrix4.__v1,e=THREE.Matrix4.__v2,g=THREE.Matrix4.__v3;g.sub(a,b).normalize();if(g.length()===0)g.z=1;d.cross(c,g).normalize();d.length()===0&&(g.x+=1.0E-4,d.cross(c,g).normalize());e.cross(g,d).normalize();this.n11=d.x;this.n12=e.x;this.n13=g.x;this.n21=d.y;this.n22=e.y;this.n23=g.y;this.n31=d.z;this.n32=e.z;this.n33=g.z;return this},multiply:function(a,b){var c=a.n11,d=a.n12,e=a.n13,g=a.n14,f=a.n21,h=a.n22,i=a.n23,j=a.n24,k=a.n31,o=a.n32,p=a.n33,m=a.n34,q=a.n41,n=a.n42,r=a.n43,
|
|
|
-t=a.n44,u=b.n11,y=b.n12,v=b.n13,A=b.n14,z=b.n21,w=b.n22,I=b.n23,F=b.n24,G=b.n31,s=b.n32,E=b.n33,T=b.n34,Z=b.n41,Q=b.n42,U=b.n43,$=b.n44;this.n11=c*u+d*z+e*G+g*Z;this.n12=c*y+d*w+e*s+g*Q;this.n13=c*v+d*I+e*E+g*U;this.n14=c*A+d*F+e*T+g*$;this.n21=f*u+h*z+i*G+j*Z;this.n22=f*y+h*w+i*s+j*Q;this.n23=f*v+h*I+i*E+j*U;this.n24=f*A+h*F+i*T+j*$;this.n31=k*u+o*z+p*G+m*Z;this.n32=k*y+o*w+p*s+m*Q;this.n33=k*v+o*I+p*E+m*U;this.n34=k*A+o*F+p*T+m*$;this.n41=q*u+n*z+r*G+t*Z;this.n42=q*y+n*w+r*s+t*Q;this.n43=q*v+n*
|
|
|
-I+r*E+t*U;this.n44=q*A+n*F+r*T+t*$;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[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 b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*b+this.n22*
|
|
|
-c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*a.y+this.n33*
|
|
|
-a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,i=this.n31,j=this.n32,k=this.n33,o=this.n34,p=this.n41,m=this.n42,q=this.n43,n=this.n44;return d*f*j*p-c*h*j*p-d*g*k*p+b*h*k*p+c*g*o*p-b*f*o*p-d*f*i*m+c*h*i*m+d*e*k*m-a*h*k*m-c*e*o*m+a*f*o*m+d*g*i*q-b*h*i*q-d*e*j*q+a*h*j*q+b*e*o*q-a*g*o*q-c*g*i*n+b*f*i*n+c*e*j*n-a*f*j*n-b*e*k*n+a*g*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,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;a[b+15]=this.n44;return a},
|
|
|
-setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,0,0,1,0,0,0,0,1);return this},
|
|
|
-setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,i=e*g,j=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,j*f+c,j*h-d*g,0,i*h-d*f,j*h+d*g,e*h*h+c,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,
|
|
|
+t=a.n44,u=b.n11,y=b.n12,w=b.n13,z=b.n14,A=b.n21,v=b.n22,G=b.n23,F=b.n24,K=b.n31,s=b.n32,N=b.n33,U=b.n34,$=b.n41,R=b.n42,V=b.n43,aa=b.n44;this.n11=c*u+d*A+e*K+g*$;this.n12=c*y+d*v+e*s+g*R;this.n13=c*w+d*G+e*N+g*V;this.n14=c*z+d*F+e*U+g*aa;this.n21=f*u+h*A+i*K+j*$;this.n22=f*y+h*v+i*s+j*R;this.n23=f*w+h*G+i*N+j*V;this.n24=f*z+h*F+i*U+j*aa;this.n31=k*u+o*A+p*K+m*$;this.n32=k*y+o*v+p*s+m*R;this.n33=k*w+o*G+p*N+m*V;this.n34=k*z+o*F+p*U+m*aa;this.n41=q*u+n*A+r*K+t*$;this.n42=q*y+n*v+r*s+t*R;this.n43=q*
|
|
|
+w+n*G+r*N+t*V;this.n44=q*z+n*F+r*U+t*aa;return this},multiplySelf:function(a){return this.multiply(this,a)},multiplyToArray:function(a,b,c){this.multiply(a,b);c[0]=this.n11;c[1]=this.n21;c[2]=this.n31;c[3]=this.n41;c[4]=this.n12;c[5]=this.n22;c[6]=this.n32;c[7]=this.n42;c[8]=this.n13;c[9]=this.n23;c[10]=this.n33;c[11]=this.n43;c[12]=this.n14;c[13]=this.n24;c[14]=this.n34;c[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 b=a.x,c=a.y,d=a.z,e=1/(this.n41*b+this.n42*c+this.n43*d+this.n44);a.x=(this.n11*b+this.n12*c+this.n13*d+this.n14)*e;a.y=(this.n21*b+this.n22*c+this.n23*d+this.n24)*e;a.z=(this.n31*b+this.n32*c+this.n33*d+this.n34)*e;return a},multiplyVector4:function(a){var b=a.x,c=a.y,d=a.z,e=a.w;a.x=this.n11*b+this.n12*c+this.n13*d+this.n14*e;a.y=this.n21*
|
|
|
+b+this.n22*c+this.n23*d+this.n24*e;a.z=this.n31*b+this.n32*c+this.n33*d+this.n34*e;a.w=this.n41*b+this.n42*c+this.n43*d+this.n44*e;return a},rotateAxis:function(a){var b=a.x,c=a.y,d=a.z;a.x=b*this.n11+c*this.n12+d*this.n13;a.y=b*this.n21+c*this.n22+d*this.n23;a.z=b*this.n31+c*this.n32+d*this.n33;a.normalize();return a},crossVector:function(a){var b=new THREE.Vector4;b.x=this.n11*a.x+this.n12*a.y+this.n13*a.z+this.n14*a.w;b.y=this.n21*a.x+this.n22*a.y+this.n23*a.z+this.n24*a.w;b.z=this.n31*a.x+this.n32*
|
|
|
+a.y+this.n33*a.z+this.n34*a.w;b.w=a.w?this.n41*a.x+this.n42*a.y+this.n43*a.z+this.n44*a.w:1;return b},determinant:function(){var a=this.n11,b=this.n12,c=this.n13,d=this.n14,e=this.n21,g=this.n22,f=this.n23,h=this.n24,i=this.n31,j=this.n32,k=this.n33,o=this.n34,p=this.n41,m=this.n42,q=this.n43,n=this.n44;return d*f*j*p-c*h*j*p-d*g*k*p+b*h*k*p+c*g*o*p-b*f*o*p-d*f*i*m+c*h*i*m+d*e*k*m-a*h*k*m-c*e*o*m+a*f*o*m+d*g*i*q-b*h*i*q-d*e*j*q+a*h*j*q+b*e*o*q-a*g*o*q-c*g*i*n+b*f*i*n+c*e*j*n-a*f*j*n-b*e*k*n+a*g*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,b){a[b]=this.n11;a[b+1]=this.n21;a[b+2]=this.n31;a[b+3]=this.n41;a[b+4]=this.n12;a[b+5]=this.n22;a[b+6]=this.n32;a[b+7]=this.n42;a[b+8]=this.n13;a[b+9]=this.n23;a[b+10]=this.n33;a[b+11]=this.n43;a[b+12]=this.n14;a[b+13]=this.n24;a[b+14]=this.n34;
|
|
|
+a[b+15]=this.n44;return a},setTranslation:function(a,b,c){this.set(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1);return this},setScale:function(a,b,c){this.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1);return this},setRotationX:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(1,0,0,0,0,b,-a,0,0,a,b,0,0,0,0,1);return this},setRotationY:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,0,a,0,0,1,0,0,-a,0,b,0,0,0,0,1);return this},setRotationZ:function(a){var b=Math.cos(a),a=Math.sin(a);this.set(b,-a,0,0,a,b,0,0,
|
|
|
+0,0,1,0,0,0,0,1);return this},setRotationAxis:function(a,b){var c=Math.cos(b),d=Math.sin(b),e=1-c,g=a.x,f=a.y,h=a.z,i=e*g,j=e*f;this.set(i*g+c,i*f-d*h,i*h+d*f,0,i*f+d*h,j*f+c,j*h-d*g,0,i*h-d*f,j*h+d*g,e*h*h+c,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 b=a.n11,c=a.n12,d=a.n13,e=a.n14,g=a.n21,f=a.n22,h=a.n23,i=a.n24,j=a.n31,k=a.n32,o=a.n33,p=a.n34,m=a.n41,q=a.n42,n=a.n43,r=a.n44;this.n11=h*p*q-i*o*q+i*k*n-f*p*n-h*k*r+f*o*r;this.n12=e*o*q-d*p*q-e*k*n+c*p*n+d*k*r-c*o*r;this.n13=d*i*q-e*h*q+e*f*n-c*i*n-d*f*r+c*h*r;this.n14=e*h*k-d*i*k-e*f*o+c*i*o+d*f*p-c*h*p;this.n21=i*o*m-h*p*m-i*j*n+g*p*n+h*j*r-g*o*r;this.n22=d*p*m-e*o*m+
|
|
|
e*j*n-b*p*n-d*j*r+b*o*r;this.n23=e*h*m-d*i*m-e*g*n+b*i*n+d*g*r-b*h*r;this.n24=d*i*j-e*h*j+e*g*o-b*i*o-d*g*p+b*h*p;this.n31=f*p*m-i*k*m+i*j*q-g*p*q-f*j*r+g*k*r;this.n32=e*k*m-c*p*m-e*j*q+b*p*q+c*j*r-b*k*r;this.n33=d*i*m-e*f*m+e*g*q-b*i*q-c*g*r+b*f*r;this.n34=e*f*j-c*i*j-e*g*k+b*i*k+c*g*p-b*f*p;this.n41=h*k*m-f*o*m-h*j*q+g*o*q+f*j*n-g*k*n;this.n42=c*o*m-d*k*m+d*j*q-b*o*q-c*j*n+b*k*n;this.n43=d*f*m-c*h*m-d*g*q+b*h*q+c*g*n-b*f*n;this.n44=c*h*j-d*f*j+d*g*k-b*h*k-c*g*o+b*f*o;this.multiplyScalar(1/a.determinant());
|
|
|
return this},setRotationFromEuler:function(a,b){var c=a.x,d=a.y,e=a.z,g=Math.cos(c),c=Math.sin(c),f=Math.cos(d),d=Math.sin(d),h=Math.cos(e),e=Math.sin(e);switch(b){case "YXZ":var i=f*h,j=f*e,k=d*h,o=d*e;this.n11=i+o*c;this.n12=k*c-j;this.n13=g*d;this.n21=g*e;this.n22=g*h;this.n23=-c;this.n31=j*c-k;this.n32=o+i*c;this.n33=g*f;break;case "ZXY":i=f*h;j=f*e;k=d*h;o=d*e;this.n11=i-o*c;this.n12=-g*e;this.n13=k+j*c;this.n21=j+k*c;this.n22=g*h;this.n23=o-i*c;this.n31=-g*d;this.n32=c;this.n33=g*f;break;case "ZYX":i=
|
|
@@ -56,18 +56,18 @@ THREE.Object3D.prototype={constructor:THREE.Object3D,translate:function(a,b){thi
|
|
|
if(b&&(e=e.getChildByName(a,b),e!==void 0))return e}},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 b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)}};THREE.Object3DCount=0;
|
|
|
THREE.Projector=function(){function a(){var a=f[g]=f[g]||new THREE.RenderableObject;g++;return a}function b(){var a=j[i]=j[i]||new THREE.RenderableVertex;i++;return a}function c(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 e,g,f=[],h,i,j=[],
|
|
|
-k,o,p=[],m,q=[],n,r,t=[],u,y,v=[],A={objects:[],sprites:[],lights:[],elements:[]},z=new THREE.Vector3,w=new THREE.Vector4,I=new THREE.Matrix4,F=new THREE.Matrix4,G=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],s=new THREE.Vector4,E=new THREE.Vector4;this.computeFrustum=function(a){G[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);G[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);G[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
|
-a.n23,a.n44+a.n24);G[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);G[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);G[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=G[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);I.multiply(b.projectionMatrix,b.matrixWorldInverse);I.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
-I.multiply(b.matrixWorld,b.projectionMatrixInverse);I.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(b,d){g=0;A.objects.length=0;A.sprites.length=0;A.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,
|
|
|
-g=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=G[h].x*d.n14+G[h].y*d.n24+G[h].z*d.n34+G[h].w,c<=g){c=!1;break a}c=!0}c?(I.multiplyVector3(z.copy(b.position)),e=a(),e.object=b,e.z=z.z,A.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(I.multiplyVector3(z.copy(b.position)),e=a(),e.object=b,e.z=z.z,A.sprites.push(e)):b instanceof THREE.Light&&A.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&
|
|
|
-A.objects.sort(c);return A};this.projectScene=function(a,e,g){var f=e.near,G=e.far,z,K,L,H,O,V,R,l,ca,N,fa,W,ba,na,ia,qa;y=r=m=o=0;A.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);I.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(I);A=this.projectGraph(a,!1);a=0;for(z=A.objects.length;a<z;a++)if(ca=A.objects[a].object,N=ca.matrixWorld,
|
|
|
-W=ca.material,i=0,ca instanceof THREE.Mesh){fa=ca.geometry;ba=ca.geometry.materials;H=fa.vertices;na=fa.faces;ia=fa.faceVertexUvs;fa=ca.matrixRotationWorld.extractRotation(N);K=0;for(L=H.length;K<L;K++)h=b(),h.positionWorld.copy(H[K].position),N.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),I.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<G;H=0;for(K=na.length;H<
|
|
|
-K;H++){L=na[H];if(L instanceof THREE.Face3)if(O=j[L.a],V=j[L.b],R=j[L.c],O.visible&&V.visible&&R.visible&&(ca.doubleSided||ca.flipSided!=(R.positionScreen.x-O.positionScreen.x)*(V.positionScreen.y-O.positionScreen.y)-(R.positionScreen.y-O.positionScreen.y)*(V.positionScreen.x-O.positionScreen.x)<0))l=p[o]=p[o]||new THREE.RenderableFace3,o++,k=l,k.v1.copy(O),k.v2.copy(V),k.v3.copy(R);else continue;else if(L instanceof THREE.Face4)if(O=j[L.a],V=j[L.b],R=j[L.c],l=j[L.d],O.visible&&V.visible&&R.visible&&
|
|
|
-l.visible&&(ca.doubleSided||ca.flipSided!=((l.positionScreen.x-O.positionScreen.x)*(V.positionScreen.y-O.positionScreen.y)-(l.positionScreen.y-O.positionScreen.y)*(V.positionScreen.x-O.positionScreen.x)<0||(V.positionScreen.x-R.positionScreen.x)*(l.positionScreen.y-R.positionScreen.y)-(V.positionScreen.y-R.positionScreen.y)*(l.positionScreen.x-R.positionScreen.x)<0)))qa=q[m]=q[m]||new THREE.RenderableFace4,m++,k=qa,k.v1.copy(O),k.v2.copy(V),k.v3.copy(R),k.v4.copy(l);else continue;k.normalWorld.copy(L.normal);
|
|
|
-fa.multiplyVector3(k.normalWorld);k.centroidWorld.copy(L.centroid);N.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);I.multiplyVector3(k.centroidScreen);R=L.vertexNormals;O=0;for(V=R.length;O<V;O++)l=k.vertexNormalsWorld[O],l.copy(R[O]),fa.multiplyVector3(l);O=0;for(V=ia.length;O<V;O++)if(qa=ia[O][H]){R=0;for(l=qa.length;R<l;R++)k.uvs[O][R]=qa[R]}k.material=W;k.faceMaterial=L.materialIndex!==null?ba[L.materialIndex]:null;k.z=k.centroidScreen.z;A.elements.push(k)}}else if(ca instanceof
|
|
|
-THREE.Line){F.multiply(I,N);H=ca.geometry.vertices;O=b();O.positionScreen.copy(H[0].position);F.multiplyVector4(O.positionScreen);K=1;for(L=H.length;K<L;K++)if(O=b(),O.positionScreen.copy(H[K].position),F.multiplyVector4(O.positionScreen),V=j[i-2],s.copy(O.positionScreen),E.copy(V.positionScreen),d(s,E))s.multiplyScalar(1/s.w),E.multiplyScalar(1/E.w),ca=t[r]=t[r]||new THREE.RenderableLine,r++,n=ca,n.v1.positionScreen.copy(s),n.v2.positionScreen.copy(E),n.z=Math.max(s.z,E.z),n.material=W,A.elements.push(n)}a=
|
|
|
-0;for(z=A.sprites.length;a<z;a++)if(ca=A.sprites[a].object,N=ca.matrixWorld,ca instanceof THREE.Particle&&(w.set(N.n14,N.n24,N.n34,1),I.multiplyVector4(w),w.z/=w.w,w.z>0&&w.z<1))f=v[y]=v[y]||new THREE.RenderableParticle,y++,u=f,u.x=w.x/w.w,u.y=w.y/w.w,u.z=w.z,u.rotation=ca.rotation.z,u.scale.x=ca.scale.x*Math.abs(u.x-(w.x+e.projectionMatrix.n11)/(w.w+e.projectionMatrix.n14)),u.scale.y=ca.scale.y*Math.abs(u.y-(w.y+e.projectionMatrix.n22)/(w.w+e.projectionMatrix.n24)),u.material=ca.material,A.elements.push(u);
|
|
|
-g&&A.elements.sort(c);return A}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
|
|
|
+k,o,p=[],m,q=[],n,r,t=[],u,y,w=[],z={objects:[],sprites:[],lights:[],elements:[]},A=new THREE.Vector3,v=new THREE.Vector4,G=new THREE.Matrix4,F=new THREE.Matrix4,K=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],s=new THREE.Vector4,N=new THREE.Vector4;this.computeFrustum=function(a){K[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);K[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);K[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+
|
|
|
+a.n23,a.n44+a.n24);K[3].set(a.n41-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);K[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);K[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=K[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);G.multiply(b.projectionMatrix,b.matrixWorldInverse);G.multiplyVector3(a);return a};this.unprojectVector=function(a,b){b.projectionMatrixInverse.getInverse(b.projectionMatrix);
|
|
|
+G.multiply(b.matrixWorld,b.projectionMatrixInverse);G.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(b,d){g=0;z.objects.length=0;z.sprites.length=0;z.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,
|
|
|
+g=-b.geometry.boundingSphere.radius*Math.max(b.scale.x,Math.max(b.scale.y,b.scale.z)),h=0;h<6;h++)if(c=K[h].x*d.n14+K[h].y*d.n24+K[h].z*d.n34+K[h].w,c<=g){c=!1;break a}c=!0}c?(G.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,z.objects.push(e)):b instanceof THREE.Sprite||b instanceof THREE.Particle?(G.multiplyVector3(A.copy(b.position)),e=a(),e.object=b,e.z=A.z,z.sprites.push(e)):b instanceof THREE.Light&&z.lights.push(b);c=0;for(d=b.children.length;c<d;c++)f(b.children[c])}};f(b);d&&
|
|
|
+z.objects.sort(c);return z};this.projectScene=function(a,e,g){var f=e.near,K=e.far,A,I,L,C,P,W,S,l,da,O,ga,X,ca,na,ia,qa;y=r=m=o=0;z.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);G.multiply(e.projectionMatrix,e.matrixWorldInverse);this.computeFrustum(G);z=this.projectGraph(a,!1);a=0;for(A=z.objects.length;a<A;a++)if(da=z.objects[a].object,O=da.matrixWorld,
|
|
|
+X=da.material,i=0,da instanceof THREE.Mesh){ga=da.geometry;ca=da.geometry.materials;C=ga.vertices;na=ga.faces;ia=ga.faceVertexUvs;ga=da.matrixRotationWorld.extractRotation(O);I=0;for(L=C.length;I<L;I++)h=b(),h.positionWorld.copy(C[I].position),O.multiplyVector3(h.positionWorld),h.positionScreen.copy(h.positionWorld),G.multiplyVector4(h.positionScreen),h.positionScreen.x/=h.positionScreen.w,h.positionScreen.y/=h.positionScreen.w,h.visible=h.positionScreen.z>f&&h.positionScreen.z<K;C=0;for(I=na.length;C<
|
|
|
+I;C++){L=na[C];if(L instanceof THREE.Face3)if(P=j[L.a],W=j[L.b],S=j[L.c],P.visible&&W.visible&&S.visible&&(da.doubleSided||da.flipSided!=(S.positionScreen.x-P.positionScreen.x)*(W.positionScreen.y-P.positionScreen.y)-(S.positionScreen.y-P.positionScreen.y)*(W.positionScreen.x-P.positionScreen.x)<0))l=p[o]=p[o]||new THREE.RenderableFace3,o++,k=l,k.v1.copy(P),k.v2.copy(W),k.v3.copy(S);else continue;else if(L instanceof THREE.Face4)if(P=j[L.a],W=j[L.b],S=j[L.c],l=j[L.d],P.visible&&W.visible&&S.visible&&
|
|
|
+l.visible&&(da.doubleSided||da.flipSided!=((l.positionScreen.x-P.positionScreen.x)*(W.positionScreen.y-P.positionScreen.y)-(l.positionScreen.y-P.positionScreen.y)*(W.positionScreen.x-P.positionScreen.x)<0||(W.positionScreen.x-S.positionScreen.x)*(l.positionScreen.y-S.positionScreen.y)-(W.positionScreen.y-S.positionScreen.y)*(l.positionScreen.x-S.positionScreen.x)<0)))qa=q[m]=q[m]||new THREE.RenderableFace4,m++,k=qa,k.v1.copy(P),k.v2.copy(W),k.v3.copy(S),k.v4.copy(l);else continue;k.normalWorld.copy(L.normal);
|
|
|
+ga.multiplyVector3(k.normalWorld);k.centroidWorld.copy(L.centroid);O.multiplyVector3(k.centroidWorld);k.centroidScreen.copy(k.centroidWorld);G.multiplyVector3(k.centroidScreen);S=L.vertexNormals;P=0;for(W=S.length;P<W;P++)l=k.vertexNormalsWorld[P],l.copy(S[P]),ga.multiplyVector3(l);P=0;for(W=ia.length;P<W;P++)if(qa=ia[P][C]){S=0;for(l=qa.length;S<l;S++)k.uvs[P][S]=qa[S]}k.material=X;k.faceMaterial=L.materialIndex!==null?ca[L.materialIndex]:null;k.z=k.centroidScreen.z;z.elements.push(k)}}else if(da instanceof
|
|
|
+THREE.Line){F.multiply(G,O);C=da.geometry.vertices;P=b();P.positionScreen.copy(C[0].position);F.multiplyVector4(P.positionScreen);I=1;for(L=C.length;I<L;I++)if(P=b(),P.positionScreen.copy(C[I].position),F.multiplyVector4(P.positionScreen),W=j[i-2],s.copy(P.positionScreen),N.copy(W.positionScreen),d(s,N))s.multiplyScalar(1/s.w),N.multiplyScalar(1/N.w),da=t[r]=t[r]||new THREE.RenderableLine,r++,n=da,n.v1.positionScreen.copy(s),n.v2.positionScreen.copy(N),n.z=Math.max(s.z,N.z),n.material=X,z.elements.push(n)}a=
|
|
|
+0;for(A=z.sprites.length;a<A;a++)if(da=z.sprites[a].object,O=da.matrixWorld,da instanceof THREE.Particle&&(v.set(O.n14,O.n24,O.n34,1),G.multiplyVector4(v),v.z/=v.w,v.z>0&&v.z<1))f=w[y]=w[y]||new THREE.RenderableParticle,y++,u=f,u.x=v.x/v.w,u.y=v.y/v.w,u.z=v.z,u.rotation=da.rotation.z,u.scale.x=da.scale.x*Math.abs(u.x-(v.x+e.projectionMatrix.n11)/(v.w+e.projectionMatrix.n14)),u.scale.y=da.scale.y*Math.abs(u.y-(v.y+e.projectionMatrix.n22)/(v.w+e.projectionMatrix.n24)),u.material=da.material,z.elements.push(u);
|
|
|
+g&&z.elements.sort(c);return z}};THREE.Quaternion=function(a,b,c,d){this.set(a||0,b||0,c||0,d!==void 0?d:1)};
|
|
|
THREE.Quaternion.prototype={constructor:THREE.Quaternion,set:function(a,b,c,d){this.x=a;this.y=b;this.z=c;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 b=Math.PI/360,c=a.x*b,d=a.y*b,e=a.z*b,a=Math.cos(d),d=Math.sin(d),b=Math.cos(-e),e=Math.sin(-e),g=Math.cos(c),c=Math.sin(c),f=a*b,h=d*e;this.w=f*g-h*c;this.x=f*c+h*g;this.y=d*b*g+a*e*c;this.z=a*e*g-d*b*c;return this},setFromAxisAngle:function(a,b){var c=b/2,d=Math.sin(c);
|
|
|
this.x=a.x*d;this.y=a.y*d;this.z=a.z*d;this.w=Math.cos(c);return this},setFromRotationMatrix:function(a){var b=Math.pow(a.determinant(),1/3);this.w=Math.sqrt(Math.max(0,b+a.n11+a.n22+a.n33))/2;this.x=Math.sqrt(Math.max(0,b+a.n11-a.n22-a.n33))/2;this.y=Math.sqrt(Math.max(0,b-a.n11+a.n22-a.n33))/2;this.z=Math.sqrt(Math.max(0,b-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 b=
|
|
@@ -83,9 +83,9 @@ b;a++)c=this.faces[a],c.centroid.set(0,0,0),c instanceof THREE.Face3?(c.centroid
|
|
|
b,c,d,e,g,f=new THREE.Vector3,h=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],d=this.vertices[c.a],e=this.vertices[c.b],g=this.vertices[c.c],f.sub(g.position,e.position),h.sub(d.position,e.position),f.crossSelf(h),f.isZero()||f.normalize(),c.normal.copy(f)},computeVertexNormals:function(){var a,b,c,d;if(this.__tmpVertices===void 0){d=this.__tmpVertices=Array(this.vertices.length);a=0;for(b=this.vertices.length;a<b;a++)d[a]=new THREE.Vector3;a=0;for(b=this.faces.length;a<b;a++)if(c=
|
|
|
this.faces[a],c instanceof THREE.Face3)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3];else if(c instanceof THREE.Face4)c.vertexNormals=[new THREE.Vector3,new THREE.Vector3,new THREE.Vector3,new THREE.Vector3]}else{d=this.__tmpVertices;a=0;for(b=this.vertices.length;a<b;a++)d[a].set(0,0,0)}a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(d[c.a].addSelf(c.normal),d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal)):c instanceof THREE.Face4&&(d[c.a].addSelf(c.normal),
|
|
|
d[c.b].addSelf(c.normal),d[c.c].addSelf(c.normal),d[c.d].addSelf(c.normal));a=0;for(b=this.vertices.length;a<b;a++)d[a].normalize();a=0;for(b=this.faces.length;a<b;a++)c=this.faces[a],c instanceof THREE.Face3?(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c])):c instanceof THREE.Face4&&(c.vertexNormals[0].copy(d[c.a]),c.vertexNormals[1].copy(d[c.b]),c.vertexNormals[2].copy(d[c.c]),c.vertexNormals[3].copy(d[c.d]))},computeTangents:function(){function a(a,
|
|
|
-b,c,d,e,g,T){h=a.vertices[b].position;i=a.vertices[c].position;j=a.vertices[d].position;k=f[e];o=f[g];p=f[T];m=i.x-h.x;q=j.x-h.x;n=i.y-h.y;r=j.y-h.y;t=i.z-h.z;u=j.z-h.z;y=o.u-k.u;v=p.u-k.u;A=o.v-k.v;z=p.v-k.v;w=1/(y*z-v*A);s.set((z*m-A*q)*w,(z*n-A*r)*w,(z*t-A*u)*w);E.set((y*q-v*m)*w,(y*r-v*n)*w,(y*u-v*t)*w);F[b].addSelf(s);F[c].addSelf(s);F[d].addSelf(s);G[b].addSelf(E);G[c].addSelf(E);G[d].addSelf(E)}var b,c,d,e,g,f,h,i,j,k,o,p,m,q,n,r,t,u,y,v,A,z,w,I,F=[],G=[],s=new THREE.Vector3,E=new THREE.Vector3,
|
|
|
-T=new THREE.Vector3,Z=new THREE.Vector3,Q=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)F[b]=new THREE.Vector3,G[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var U=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)Q.copy(g.vertexNormals[d]),e=g[U[d]],
|
|
|
-I=F[e],T.copy(I),T.subSelf(Q.multiplyScalar(Q.dot(I))).normalize(),Z.cross(g.vertexNormals[d],I),e=Z.dot(G[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(T.x,T.y,T.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=
|
|
|
+b,c,d,e,g,U){h=a.vertices[b].position;i=a.vertices[c].position;j=a.vertices[d].position;k=f[e];o=f[g];p=f[U];m=i.x-h.x;q=j.x-h.x;n=i.y-h.y;r=j.y-h.y;t=i.z-h.z;u=j.z-h.z;y=o.u-k.u;w=p.u-k.u;z=o.v-k.v;A=p.v-k.v;v=1/(y*A-w*z);s.set((A*m-z*q)*v,(A*n-z*r)*v,(A*t-z*u)*v);N.set((y*q-w*m)*v,(y*r-w*n)*v,(y*u-w*t)*v);F[b].addSelf(s);F[c].addSelf(s);F[d].addSelf(s);K[b].addSelf(N);K[c].addSelf(N);K[d].addSelf(N)}var b,c,d,e,g,f,h,i,j,k,o,p,m,q,n,r,t,u,y,w,z,A,v,G,F=[],K=[],s=new THREE.Vector3,N=new THREE.Vector3,
|
|
|
+U=new THREE.Vector3,$=new THREE.Vector3,R=new THREE.Vector3;b=0;for(c=this.vertices.length;b<c;b++)F[b]=new THREE.Vector3,K[b]=new THREE.Vector3;b=0;for(c=this.faces.length;b<c;b++)g=this.faces[b],f=this.faceVertexUvs[0][b],g instanceof THREE.Face3?a(this,g.a,g.b,g.c,0,1,2):g instanceof THREE.Face4&&(a(this,g.a,g.b,g.c,0,1,2),a(this,g.a,g.b,g.d,0,1,3));var V=["a","b","c","d"];b=0;for(c=this.faces.length;b<c;b++){g=this.faces[b];for(d=0;d<g.vertexNormals.length;d++)R.copy(g.vertexNormals[d]),e=g[V[d]],
|
|
|
+G=F[e],U.copy(G),U.subSelf(R.multiplyScalar(R.dot(G))).normalize(),$.cross(g.vertexNormals[d],G),e=$.dot(K[e]),e=e<0?-1:1,g.vertexTangents[d]=new THREE.Vector4(U.x,U.y,U.z,e)}this.hasTangents=!0},computeBoundingBox:function(){var a;if(this.vertices.length>0){this.boundingBox={x:[this.vertices[0].position.x,this.vertices[0].position.x],y:[this.vertices[0].position.y,this.vertices[0].position.y],z:[this.vertices[0].position.z,this.vertices[0].position.z]};for(var b=1,c=this.vertices.length;b<c;b++){a=
|
|
|
this.vertices[b];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,b=0,c=this.vertices.length;b<c;b++)a=Math.max(a,this.vertices[b].position.length());this.boundingSphere={radius:a}},mergeVertices:function(){var a={},b=[],c=[],d,e=Math.pow(10,4),g,f;g=0;for(f=this.vertices.length;g<f;g++)d=this.vertices[g].position,d=[Math.round(d.x*e),Math.round(d.y*e),Math.round(d.z*e)].join("_"),a[d]===void 0?(a[d]=g,b.push(this.vertices[g]),c[g]=b.length-1):c[g]=c[a[d]];g=0;for(f=this.faces.length;g<f;g++)if(a=this.faces[g],a instanceof THREE.Face3)a.a=c[a.a],a.b=c[a.b],a.c=
|
|
|
c[a.c];else if(a instanceof THREE.Face4)a.a=c[a.a],a.b=c[a.b],a.c=c[a.c],a.d=c[a.d];this.vertices=b}};THREE.GeometryCount=0;
|
|
@@ -149,46 +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 b=this.lights.indexOf(a);b!==-1&&this.lights.splice(b,1)}else a instanceof THREE.Camera||(b=this.objects.indexOf(a),b!==-1&&(this.objects.splice(b,1),this.__objectsRemoved.push(a),b=this.__objectsAdded.indexOf(a),b!==-1&&this.__objectsAdded.splice(b,1)));for(b=0;b<a.children.length;b++)this.removeObject(a.children[b])};
|
|
|
THREE.Fog=function(a,b,c){this.color=new THREE.Color(a);this.near=b!==void 0?b:1;this.far=c!==void 0?c:1E3};THREE.FogExp2=function(a,b){this.color=new THREE.Color(a);this.density=b!==void 0?b:2.5E-4};
|
|
|
THREE.DOMRenderer=function(){THREE.Renderer.call(this);var a=null,b=new THREE.Projector,c,d,e,g;this.domElement=document.createElement("div");this.setSize=function(a,b){c=a;d=b;e=c/2;g=d/2};this.render=function(c,d){var i,j,k,o,p,m,q,n;a=b.projectScene(c,d);i=0;for(j=a.length;i<j;i++)if(p=a[i],p instanceof THREE.RenderableParticle){q=p.x*e+e;n=p.y*g+g;k=0;for(o=p.material.length;k<o;k++)if(m=p.material[k],m instanceof THREE.ParticleDOMMaterial)m=m.domElement,m.style.left=q+"px",m.style.top=n+"px"}}};
|
|
|
-THREE.CanvasRenderer=function(a){function b(a){if(u!=a)n.globalAlpha=u=a}function c(a){if(y!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}y=a}}function d(a){if(v!=a)n.strokeStyle=v=a}function e(a){if(A!=a)n.fillStyle=A=a}var g=this,f,h,i,j=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
-o,p,m,q,n=k.getContext("2d"),r=new THREE.Color(0),t=0,u=1,y=0,v=null,A=null,z=null,w=null,I=null,F,G,s,E,T=new THREE.RenderableVertex,Z=new THREE.RenderableVertex,Q,U,$,ja,K,L,H,O,V,R,l,ca,N=new THREE.Color,fa=new THREE.Color,W=new THREE.Color,ba=new THREE.Color,na=new THREE.Color,ia=[],qa=[],ra,oa,ta,pa,Ba,wa,va,xa,M,ea,S=new THREE.Rectangle,ha=new THREE.Rectangle,J=new THREE.Rectangle,P=!1,aa=new THREE.Color,Y=new THREE.Color,sa=new THREE.Color,X=new THREE.Vector3,ka,da,za,ya,ga,Ia,a=16;ka=document.createElement("canvas");
|
|
|
-ka.width=ka.height=2;da=ka.getContext("2d");da.fillStyle="rgba(0,0,0,1)";da.fillRect(0,0,2,2);za=da.getImageData(0,0,2,2);ya=za.data;ga=document.createElement("canvas");ga.width=ga.height=a;Ia=ga.getContext("2d");Ia.translate(-a/2,-a/2);Ia.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){o=a;p=b;m=Math.floor(o/2);q=Math.floor(p/2);k.width=o;k.height=p;S.set(-m,-q,m,q);ha.set(-m,-q,m,q);u=1;y=0;
|
|
|
-I=w=z=A=v=null};this.setClearColor=function(a,b){r.copy(a);t=b;ha.set(-m,-q,m,q)};this.setClearColorHex=function(a,b){r.setHex(a);t=b;ha.set(-m,-q,m,q)};this.clear=function(){n.setTransform(1,0,0,-1,m,q);ha.isEmpty()||(ha.minSelf(S),ha.inflate(2),t<1&&n.clearRect(Math.floor(ha.getX()),Math.floor(ha.getY()),Math.floor(ha.getWidth()),Math.floor(ha.getHeight())),t>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*255)+","+t+")"),n.fillRect(Math.floor(ha.getX()),
|
|
|
-Math.floor(ha.getY()),Math.floor(ha.getWidth()),Math.floor(ha.getHeight()))),ha.empty())};this.render=function(a,k){function o(a){var b,c,d,e;aa.setRGB(0,0,0);Y.setRGB(0,0,0);sa.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?(Y.r+=e.r,Y.g+=e.g,Y.b+=e.b):d instanceof THREE.PointLight&&(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b)}function p(a,b,c,d){var e,g,f,h,i,l;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,
|
|
|
-f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),l=c.dot(i),l<=0||(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),l=c.dot(X.sub(i,b).normalize()),l<=0||(l*=f.distance==0?1:1-Math.min(b.distanceTo(i)/f.distance,1),l!=0&&(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)))}function r(a,g,f){b(f.opacity);c(f.blending);var h,l,i,k,j,ga;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,j=k.width>>1,ga=k.height>>
|
|
|
-1,f=g.scale.x*m,i=g.scale.y*q,h=f*j,l=i*ga,J.set(a.x-h,a.y-l,a.x+h,a.y+l),S.intersects(J)&&(n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(f,-i),n.translate(-j,-ga),n.drawImage(k,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(h=g.scale.x*m,l=g.scale.y*q,J.set(a.x-h,a.y-l,a.x+h,a.y+l),S.intersects(J)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(h,l),f.program(n),n.restore()))}function t(a,e,
|
|
|
-g,f){b(f.opacity);c(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(z!=a)n.lineWidth=z=a;a=f.linecap;if(w!=a)n.lineCap=w=a;a=f.linejoin;if(I!=a)n.lineJoin=I=a;d(f.color.getContextStyle());n.stroke();J.inflate(f.linewidth*2)}}function u(a,d,e,f,h,l,m,n){g.info.render.vertices+=3;g.info.render.faces++;b(n.opacity);c(n.blending);Q=a.positionScreen.x;U=a.positionScreen.y;
|
|
|
-$=d.positionScreen.x;ja=d.positionScreen.y;K=e.positionScreen.x;L=e.positionScreen.y;Ha(Q,U,$,ja,K,L);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(pa=m.uvs[0],A(Q,U,$,ja,K,L,pa[f].u,pa[f].v,pa[h].u,pa[h].v,pa[l].u,pa[l].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,X.copy(m.vertexNormalsWorld[f]),Ba=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,wa=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,
|
|
|
-X.copy(m.vertexNormalsWorld[h]),va=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,xa=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,X.copy(m.vertexNormalsWorld[l]),M=(X.x*a.n11+X.y*a.n12+X.z*a.n13)*0.5+0.5,ea=-(X.x*a.n21+X.y*a.n22+X.z*a.n23)*0.5+0.5,A(Q,U,$,ja,K,L,Ba,wa,va,xa,M,ea,n.envMap)}else n.wireframe?Ca(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(pa=m.uvs[0],
|
|
|
-A(Q,U,$,ja,K,L,pa[f].u,pa[f].v,pa[h].u,pa[h].v,pa[l].u,pa[l].v,n.map)),c(THREE.SubtractiveBlending)),P?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(fa.r=W.r=ba.r=aa.r,fa.g=W.g=ba.g=aa.g,fa.b=W.b=ba.b=aa.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],fa),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],W),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ba),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)),W.r=Math.max(0,Math.min(n.color.r*W.r,1)),W.g=Math.max(0,Math.min(n.color.g*W.g,1)),W.b=Math.max(0,Math.min(n.color.b*W.b,1)),ba.r=Math.max(0,Math.min(n.color.r*ba.r,1)),ba.g=Math.max(0,Math.min(n.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(n.color.b*ba.b,1)),na.r=(W.r+ba.r)*0.5,na.g=(W.g+ba.g)*0.5,na.b=(W.b+ba.b)*0.5,ta=Ja(fa,W,ba,na),Fa(Q,U,$,ja,K,L,0,0,1,0,0,1,ta)):(N.r=aa.r,N.g=aa.g,N.b=aa.b,p(i,m.centroidWorld,m.normalWorld,N),N.r=Math.max(0,Math.min(n.color.r*N.r,1)),N.g=Math.max(0,Math.min(n.color.g*
|
|
|
-N.g,1)),N.b=Math.max(0,Math.min(n.color.b*N.b,1)),n.wireframe?Ca(N,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(N)):n.wireframe?Ca(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshDepthMaterial)ra=k.near,oa=k.far,fa.r=fa.g=fa.b=1-Ea(a.positionScreen.z,ra,oa),W.r=W.g=W.b=1-Ea(d.positionScreen.z,ra,oa),ba.r=ba.g=ba.b=1-Ea(e.positionScreen.z,ra,oa),na.r=(W.r+ba.r)*0.5,na.g=(W.g+ba.g)*0.5,na.b=(W.b+ba.b)*0.5,ta=Ja(fa,W,
|
|
|
-ba,na),Fa(Q,U,$,ja,K,L,0,0,1,0,0,1,ta);else if(n instanceof THREE.MeshNormalMaterial)N.r=Ga(m.normalWorld.x),N.g=Ga(m.normalWorld.y),N.b=Ga(m.normalWorld.z),n.wireframe?Ca(N,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(N)}function y(a,d,e,f,h,m,n,j,ga){g.info.render.vertices+=4;g.info.render.faces++;b(j.opacity);c(j.blending);if(j.map||j.envMap)u(a,d,f,0,1,3,n,j,ga),u(h,e,m,1,2,3,n,j,ga);else if(Q=a.positionScreen.x,U=a.positionScreen.y,$=d.positionScreen.x,ja=d.positionScreen.y,
|
|
|
-K=e.positionScreen.x,L=e.positionScreen.y,H=f.positionScreen.x,O=f.positionScreen.y,V=h.positionScreen.x,R=h.positionScreen.y,l=m.positionScreen.x,ca=m.positionScreen.y,j instanceof THREE.MeshBasicMaterial)v(Q,U,$,ja,K,L,H,O),j.wireframe?Ca(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(j.color);else if(j instanceof THREE.MeshLambertMaterial)P?!j.wireframe&&j.shading==THREE.SmoothShading&&n.vertexNormalsWorld.length==4?(fa.r=W.r=ba.r=na.r=aa.r,fa.g=W.g=ba.g=na.g=aa.g,fa.b=
|
|
|
-W.b=ba.b=na.b=aa.b,p(i,n.v1.positionWorld,n.vertexNormalsWorld[0],fa),p(i,n.v2.positionWorld,n.vertexNormalsWorld[1],W),p(i,n.v4.positionWorld,n.vertexNormalsWorld[3],ba),p(i,n.v3.positionWorld,n.vertexNormalsWorld[2],na),fa.r=Math.max(0,Math.min(j.color.r*fa.r,1)),fa.g=Math.max(0,Math.min(j.color.g*fa.g,1)),fa.b=Math.max(0,Math.min(j.color.b*fa.b,1)),W.r=Math.max(0,Math.min(j.color.r*W.r,1)),W.g=Math.max(0,Math.min(j.color.g*W.g,1)),W.b=Math.max(0,Math.min(j.color.b*W.b,1)),ba.r=Math.max(0,Math.min(j.color.r*
|
|
|
-ba.r,1)),ba.g=Math.max(0,Math.min(j.color.g*ba.g,1)),ba.b=Math.max(0,Math.min(j.color.b*ba.b,1)),na.r=Math.max(0,Math.min(j.color.r*na.r,1)),na.g=Math.max(0,Math.min(j.color.g*na.g,1)),na.b=Math.max(0,Math.min(j.color.b*na.b,1)),ta=Ja(fa,W,ba,na),Ha(Q,U,$,ja,H,O),Fa(Q,U,$,ja,H,O,0,0,1,0,0,1,ta),Ha(V,R,K,L,l,ca),Fa(V,R,K,L,l,ca,1,0,1,1,0,1,ta)):(N.r=aa.r,N.g=aa.g,N.b=aa.b,p(i,n.centroidWorld,n.normalWorld,N),N.r=Math.max(0,Math.min(j.color.r*N.r,1)),N.g=Math.max(0,Math.min(j.color.g*N.g,1)),N.b=Math.max(0,
|
|
|
-Math.min(j.color.b*N.b,1)),v(Q,U,$,ja,K,L,H,O),j.wireframe?Ca(N,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(N)):(v(Q,U,$,ja,K,L,H,O),j.wireframe?Ca(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(j.color));else if(j instanceof THREE.MeshNormalMaterial)N.r=Ga(n.normalWorld.x),N.g=Ga(n.normalWorld.y),N.b=Ga(n.normalWorld.z),v(Q,U,$,ja,K,L,H,O),j.wireframe?Ca(N,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(N);else if(j instanceof THREE.MeshDepthMaterial)ra=
|
|
|
-k.near,oa=k.far,fa.r=fa.g=fa.b=1-Ea(a.positionScreen.z,ra,oa),W.r=W.g=W.b=1-Ea(d.positionScreen.z,ra,oa),ba.r=ba.g=ba.b=1-Ea(f.positionScreen.z,ra,oa),na.r=na.g=na.b=1-Ea(e.positionScreen.z,ra,oa),ta=Ja(fa,W,ba,na),Ha(Q,U,$,ja,H,O),Fa(Q,U,$,ja,H,O,0,0,1,0,0,1,ta),Ha(V,R,K,L,l,ca),Fa(V,R,K,L,l,ca,1,0,1,1,0,1,ta)}function Ha(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 v(a,b,c,d,e,g,f,h){n.beginPath();n.moveTo(a,b);n.lineTo(c,d);n.lineTo(e,
|
|
|
-g);n.lineTo(f,h);n.lineTo(a,b);n.closePath()}function Ca(a,b,c,e){if(z!=b)n.lineWidth=z=b;if(w!=c)n.lineCap=w=c;if(I!=e)n.lineJoin=I=e;d(a.getContextStyle());n.stroke();J.inflate(b*2)}function Aa(a){e(a.getContextStyle());n.fill()}function A(a,b,c,d,g,f,h,l,i,k,m,j,ga){if(ga.image.width!=0){if(ga.needsUpdate==!0||ia[ga.id]==void 0){var o=ga.wrapS==THREE.RepeatWrapping,p=ga.wrapT==THREE.RepeatWrapping;ia[ga.id]=n.createPattern(ga.image,o&&p?"repeat":o&&!p?"repeat-x":!o&&p?"repeat-y":"no-repeat");ga.needsUpdate=
|
|
|
-!1}e(ia[ga.id]);var o=ga.offset.x/ga.repeat.x,p=ga.offset.y/ga.repeat.y,M=ga.image.width*ga.repeat.x,r=ga.image.height*ga.repeat.y,h=(h+o)*M,l=(l+p)*r,i=(i+o)*M,k=(k+p)*r,m=(m+o)*M,j=(j+p)*r;c-=a;d-=b;g-=a;f-=b;i-=h;k-=l;m-=h;j-=l;o=i*j-m*k;if(o==0){if(qa[ga.id]==void 0)b=document.createElement("canvas"),b.width=ga.image.width,b.height=ga.image.height,a=b.getContext("2d"),a.drawImage(ga.image,0,0),qa[ga.id]=a.getImageData(0,0,ga.image.width,ga.image.height).data,delete b;b=qa[ga.id];h=(Math.floor(h)+
|
|
|
-Math.floor(l)*ga.image.width)*4;N.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Aa(N)}else o=1/o,ga=(j*c-k*g)*o,k=(j*d-k*f)*o,c=(i*g-m*c)*o,d=(i*f-m*d)*o,a=a-ga*h-c*l,h=b-k*h-d*l,n.save(),n.transform(ga,k,c,d,a,h),n.fill(),n.restore()}}function Fa(a,b,c,d,e,g,f,h,l,i,k,m,j){var ga,o;ga=j.width-1;o=j.height-1;f*=ga;h*=o;l*=ga;i*=o;k*=ga;m*=o;c-=a;d-=b;e-=a;g-=b;l-=f;i-=h;k-=f;m-=h;o=1/(l*m-k*i);ga=(m*c-i*e)*o;i=(m*d-i*g)*o;c=(l*e-k*c)*o;d=(l*g-k*d)*o;a=a-ga*f-c*h;b=b-i*f-d*h;n.save();n.transform(ga,i,c,d,
|
|
|
-a,b);n.clip();n.drawImage(j,0,0);n.restore()}function Ja(a,b,c,d){var e=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),f=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),l=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),m=~~(d.g*255),d=~~(d.b*255);ya[0]=e<0?0:e>255?255:e;ya[1]=g<0?0:g>255?255:g;ya[2]=a<0?0:a>255?255:a;ya[4]=f<0?0:f>255?255:f;ya[5]=h<0?0:h>255?255:h;ya[6]=b<0?0:b>255?255:b;ya[8]=l<0?0:l>255?255:l;ya[9]=i<0?0:i>255?255:i;ya[10]=c<0?0:c>255?255:c;ya[12]=k<0?0:k>255?255:k;ya[13]=m<0?0:m>255?255:
|
|
|
-m;ya[14]=d<0?0:d>255?255:d;da.putImageData(za,0,0);Ia.drawImage(ka,0,0);return ga}function Ea(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ga(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Da(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 C,Ka,ua,D;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,q);g.info.render.vertices=0;g.info.render.faces=0;f=j.projectScene(a,k,this.sortElements);h=f.elements;i=f.lights;(P=i.length>0)&&o(i);C=
|
|
|
-0;for(Ka=h.length;C<Ka;C++)if(ua=h[C],D=ua.material,D=D instanceof THREE.MeshFaceMaterial?ua.faceMaterial:D,!(D==null||D.opacity==0)){J.empty();if(ua instanceof THREE.RenderableParticle)F=ua,F.x*=m,F.y*=q,r(F,ua,D,a);else if(ua instanceof THREE.RenderableLine)F=ua.v1,G=ua.v2,F.positionScreen.x*=m,F.positionScreen.y*=q,G.positionScreen.x*=m,G.positionScreen.y*=q,J.addPoint(F.positionScreen.x,F.positionScreen.y),J.addPoint(G.positionScreen.x,G.positionScreen.y),S.intersects(J)&&t(F,G,ua,D,a);else if(ua instanceof
|
|
|
-THREE.RenderableFace3)F=ua.v1,G=ua.v2,s=ua.v3,F.positionScreen.x*=m,F.positionScreen.y*=q,G.positionScreen.x*=m,G.positionScreen.y*=q,s.positionScreen.x*=m,s.positionScreen.y*=q,D.overdraw&&(Da(F.positionScreen,G.positionScreen),Da(G.positionScreen,s.positionScreen),Da(s.positionScreen,F.positionScreen)),J.add3Points(F.positionScreen.x,F.positionScreen.y,G.positionScreen.x,G.positionScreen.y,s.positionScreen.x,s.positionScreen.y),S.intersects(J)&&u(F,G,s,0,1,2,ua,D,a);else if(ua instanceof THREE.RenderableFace4)F=
|
|
|
-ua.v1,G=ua.v2,s=ua.v3,E=ua.v4,F.positionScreen.x*=m,F.positionScreen.y*=q,G.positionScreen.x*=m,G.positionScreen.y*=q,s.positionScreen.x*=m,s.positionScreen.y*=q,E.positionScreen.x*=m,E.positionScreen.y*=q,T.positionScreen.copy(G.positionScreen),Z.positionScreen.copy(E.positionScreen),D.overdraw&&(Da(F.positionScreen,G.positionScreen),Da(G.positionScreen,E.positionScreen),Da(E.positionScreen,F.positionScreen),Da(s.positionScreen,T.positionScreen),Da(s.positionScreen,Z.positionScreen)),J.addPoint(F.positionScreen.x,
|
|
|
-F.positionScreen.y),J.addPoint(G.positionScreen.x,G.positionScreen.y),J.addPoint(s.positionScreen.x,s.positionScreen.y),J.addPoint(E.positionScreen.x,E.positionScreen.y),S.intersects(J)&&y(F,G,s,E,T,Z,ua,D,a);ha.addRectangle(J)}n.setTransform(1,0,0,1,0,0)}};
|
|
|
-THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,h,i,l;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),l=c.dot(i),l<=0||(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),l=c.dot(F.sub(i,b).normalize()),l<=0||(l*=f.distance==0?1:1-Math.min(b.distanceTo(i)/f.distance,1),l!=0&&(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)))}function b(a){G[a]==null&&(G[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
-"path"),Q==0&&G[a].setAttribute("shape-rendering","crispEdges"));return G[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,e,g,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,k,o,p,m,q,n,r,t=new THREE.Rectangle,u=new THREE.Rectangle,y=!1,v=new THREE.Color,A=new THREE.Color,z=new THREE.Color,w=new THREE.Color,I,F=new THREE.Vector3,G=[],s=[],E,T,Z,Q=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":Q=1;break;case "low":Q=0}};this.setSize=function(a,b){j=a;k=b;o=j/2;p=k/2;i.setAttribute("viewBox",-o+" "+-p+" "+j+" "+k);i.setAttribute("width",j);i.setAttribute("height",k);t.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,j){var G,F,L,H;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,j,this.sortElements);g=e.elements;
|
|
|
-f=e.lights;Z=T=0;if(y=f.length>0){A.setRGB(0,0,0);z.setRGB(0,0,0);w.setRGB(0,0,0);G=0;for(F=f.length;G<F;G++)H=f[G],L=H.color,H instanceof THREE.AmbientLight?(A.r+=L.r,A.g+=L.g,A.b+=L.b):H instanceof THREE.DirectionalLight?(z.r+=L.r,z.g+=L.g,z.b+=L.b):H instanceof THREE.PointLight&&(w.r+=L.r,w.g+=L.g,w.b+=L.b)}G=0;for(F=g.length;G<F;G++)if(L=g[G],H=L.material,H=H instanceof THREE.MeshFaceMaterial?L.faceMaterial:H,!(H==null||H.opacity==0))if(u.empty(),L instanceof THREE.RenderableParticle)m=L,m.x*=
|
|
|
-o,m.y*=-p;else if(L instanceof THREE.RenderableLine){if(m=L.v1,q=L.v2,m.positionScreen.x*=o,m.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),t.intersects(u)){L=m;var O=q,V=Z++;s[V]==null&&(s[V]=document.createElementNS("http://www.w3.org/2000/svg","line"),Q==0&&s[V].setAttribute("shape-rendering","crispEdges"));E=s[V];E.setAttribute("x1",L.positionScreen.x);E.setAttribute("y1",L.positionScreen.y);
|
|
|
-E.setAttribute("x2",O.positionScreen.x);E.setAttribute("y2",O.positionScreen.y);H instanceof THREE.LineBasicMaterial&&(E.setAttribute("style","fill: none; stroke: "+H.color.getContextStyle()+"; stroke-width: "+H.linewidth+"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.linecap+"; stroke-linejoin: "+H.linejoin),i.appendChild(E))}}else if(L instanceof THREE.RenderableFace3){if(m=L.v1,q=L.v2,n=L.v3,m.positionScreen.x*=o,m.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,n.positionScreen.x*=
|
|
|
-o,n.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),t.intersects(u)){var O=m,V=q,R=n;d.info.render.vertices+=3;d.info.render.faces++;E=b(T++);E.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+V.positionScreen.x+" "+V.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+"z");H instanceof THREE.MeshBasicMaterial?v.copy(H.color):H instanceof THREE.MeshLambertMaterial?
|
|
|
-y?(v.r=A.r,v.g=A.g,v.b=A.b,a(f,L.centroidWorld,L.normalWorld,v),v.r=Math.max(0,Math.min(H.color.r*v.r,1)),v.g=Math.max(0,Math.min(H.color.g*v.g,1)),v.b=Math.max(0,Math.min(H.color.b*v.b,1))):v.copy(H.color):H instanceof THREE.MeshDepthMaterial?(I=1-H.__2near/(H.__farPlusNear-L.z*H.__farMinusNear),v.setRGB(I,I,I)):H instanceof THREE.MeshNormalMaterial&&v.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));H.wireframe?E.setAttribute("style","fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+
|
|
|
-H.wireframeLinewidth+"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.wireframeLinecap+"; stroke-linejoin: "+H.wireframeLinejoin):E.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+H.opacity);i.appendChild(E)}}else if(L instanceof THREE.RenderableFace4&&(m=L.v1,q=L.v2,n=L.v3,r=L.v4,m.positionScreen.x*=o,m.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,n.positionScreen.x*=o,n.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,
|
|
|
-m.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),t.intersects(u))){var O=m,V=q,R=n,l=r;d.info.render.vertices+=4;d.info.render.faces++;E=b(T++);E.setAttribute("d","M "+O.positionScreen.x+" "+O.positionScreen.y+" L "+V.positionScreen.x+" "+V.positionScreen.y+" L "+R.positionScreen.x+","+R.positionScreen.y+" L "+l.positionScreen.x+","+l.positionScreen.y+"z");H instanceof THREE.MeshBasicMaterial?
|
|
|
-v.copy(H.color):H instanceof THREE.MeshLambertMaterial?y?(v.r=A.r,v.g=A.g,v.b=A.b,a(f,L.centroidWorld,L.normalWorld,v),v.r=Math.max(0,Math.min(H.color.r*v.r,1)),v.g=Math.max(0,Math.min(H.color.g*v.g,1)),v.b=Math.max(0,Math.min(H.color.b*v.b,1))):v.copy(H.color):H instanceof THREE.MeshDepthMaterial?(I=1-H.__2near/(H.__farPlusNear-L.z*H.__farMinusNear),v.setRGB(I,I,I)):H instanceof THREE.MeshNormalMaterial&&v.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));H.wireframe?E.setAttribute("style",
|
|
|
-"fill: none; stroke: "+v.getContextStyle()+"; stroke-width: "+H.wireframeLinewidth+"; stroke-opacity: "+H.opacity+"; stroke-linecap: "+H.wireframeLinecap+"; stroke-linejoin: "+H.wireframeLinejoin):E.setAttribute("style","fill: "+v.getContextStyle()+"; fill-opacity: "+H.opacity);i.appendChild(E)}}};
|
|
|
+THREE.CanvasRenderer=function(a){function b(a){if(u!=a)n.globalAlpha=u=a}function c(a){if(y!=a){switch(a){case THREE.NormalBlending:n.globalCompositeOperation="source-over";break;case THREE.AdditiveBlending:n.globalCompositeOperation="lighter";break;case THREE.SubtractiveBlending:n.globalCompositeOperation="darker"}y=a}}function d(a){if(w!=a)n.strokeStyle=w=a}function e(a){if(z!=a)n.fillStyle=z=a}var g=this,f,h,i,j=new THREE.Projector,a=a||{},k=a.canvas!==void 0?a.canvas:document.createElement("canvas"),
|
|
|
+o,p,m,q,n=k.getContext("2d"),r=new THREE.Color(0),t=0,u=1,y=0,w=null,z=null,A=null,v=null,G=null,F,K,s,N,U=new THREE.RenderableVertex,$=new THREE.RenderableVertex,R,V,aa,ja,I,L,C,P,W,S,l,da,O=new THREE.Color,ga=new THREE.Color,X=new THREE.Color,ca=new THREE.Color,na=new THREE.Color,ia=[],qa=[],ra,oa,ta,pa,Ba,wa,va,xa,M,fa,T=new THREE.Rectangle,J=new THREE.Rectangle,H=new THREE.Rectangle,Q=!1,ba=new THREE.Color,Z=new THREE.Color,sa=new THREE.Color,Y=new THREE.Vector3,ka,ea,za,ya,ha,Ia,a=16;ka=document.createElement("canvas");
|
|
|
+ka.width=ka.height=2;ea=ka.getContext("2d");ea.fillStyle="rgba(0,0,0,1)";ea.fillRect(0,0,2,2);za=ea.getImageData(0,0,2,2);ya=za.data;ha=document.createElement("canvas");ha.width=ha.height=a;Ia=ha.getContext("2d");Ia.translate(-a/2,-a/2);Ia.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){o=a;p=b;m=Math.floor(o/2);q=Math.floor(p/2);k.width=o;k.height=p;T.set(-m,-q,m,q);J.set(-m,-q,m,q);u=1;y=0;G=
|
|
|
+v=A=z=w=null};this.setClearColor=function(a,b){r.copy(a);t=b;J.set(-m,-q,m,q)};this.setClearColorHex=function(a,b){r.setHex(a);t=b;J.set(-m,-q,m,q)};this.clear=function(){n.setTransform(1,0,0,-1,m,q);J.isEmpty()||(J.minSelf(T),J.inflate(2),t<1&&n.clearRect(Math.floor(J.getX()),Math.floor(J.getY()),Math.floor(J.getWidth()),Math.floor(J.getHeight())),t>0&&(c(THREE.NormalBlending),b(1),e("rgba("+Math.floor(r.r*255)+","+Math.floor(r.g*255)+","+Math.floor(r.b*255)+","+t+")"),n.fillRect(Math.floor(J.getX()),
|
|
|
+Math.floor(J.getY()),Math.floor(J.getWidth()),Math.floor(J.getHeight()))),J.empty())};this.render=function(a,k){function o(a){var b,c,d,e;ba.setRGB(0,0,0);Z.setRGB(0,0,0);sa.setRGB(0,0,0);b=0;for(c=a.length;b<c;b++)d=a[b],e=d.color,d instanceof THREE.AmbientLight?(ba.r+=e.r,ba.g+=e.g,ba.b+=e.b):d instanceof THREE.DirectionalLight?(Z.r+=e.r,Z.g+=e.g,Z.b+=e.b):d instanceof THREE.PointLight&&(sa.r+=e.r,sa.g+=e.g,sa.b+=e.b)}function p(a,b,c,d){var e,g,f,h,l,i;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,
|
|
|
+f instanceof THREE.DirectionalLight?(l=f.matrixWorld.getPosition(),i=c.dot(l),i<=0||(i*=f.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)):f instanceof THREE.PointLight&&(l=f.matrixWorld.getPosition(),i=c.dot(Y.sub(l,b).normalize()),i<=0||(i*=f.distance==0?1:1-Math.min(b.distanceTo(l)/f.distance,1),i!=0&&(i*=f.intensity,d.r+=h.r*i,d.g+=h.g*i,d.b+=h.b*i)))}function r(a,g,f){b(f.opacity);c(f.blending);var h,i,l,k,j,ha;if(f instanceof THREE.ParticleBasicMaterial){if(f.map)k=f.map.image,j=k.width>>1,ha=k.height>>
|
|
|
+1,f=g.scale.x*m,l=g.scale.y*q,h=f*j,i=l*ha,H.set(a.x-h,a.y-i,a.x+h,a.y+i),T.intersects(H)&&(n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(f,-l),n.translate(-j,-ha),n.drawImage(k,0,0),n.restore())}else f instanceof THREE.ParticleCanvasMaterial&&(h=g.scale.x*m,i=g.scale.y*q,H.set(a.x-h,a.y-i,a.x+h,a.y+i),T.intersects(H)&&(d(f.color.getContextStyle()),e(f.color.getContextStyle()),n.save(),n.translate(a.x,a.y),n.rotate(-g.rotation),n.scale(h,i),f.program(n),n.restore()))}function t(a,e,
|
|
|
+g,f){b(f.opacity);c(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(A!=a)n.lineWidth=A=a;a=f.linecap;if(v!=a)n.lineCap=v=a;a=f.linejoin;if(G!=a)n.lineJoin=G=a;d(f.color.getContextStyle());n.stroke();H.inflate(f.linewidth*2)}}function u(a,d,e,f,h,l,m,n){g.info.render.vertices+=3;g.info.render.faces++;b(n.opacity);c(n.blending);R=a.positionScreen.x;V=a.positionScreen.y;
|
|
|
+aa=d.positionScreen.x;ja=d.positionScreen.y;I=e.positionScreen.x;L=e.positionScreen.y;Ha(R,V,aa,ja,I,L);if(n instanceof THREE.MeshBasicMaterial)if(n.map)n.map.mapping instanceof THREE.UVMapping&&(pa=m.uvs[0],z(R,V,aa,ja,I,L,pa[f].u,pa[f].v,pa[h].u,pa[h].v,pa[l].u,pa[l].v,n.map));else if(n.envMap){if(n.envMap.mapping instanceof THREE.SphericalReflectionMapping)a=k.matrixWorldInverse,Y.copy(m.vertexNormalsWorld[f]),Ba=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,wa=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,
|
|
|
+Y.copy(m.vertexNormalsWorld[h]),va=(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[l]),M=(Y.x*a.n11+Y.y*a.n12+Y.z*a.n13)*0.5+0.5,fa=-(Y.x*a.n21+Y.y*a.n22+Y.z*a.n23)*0.5+0.5,z(R,V,aa,ja,I,L,Ba,wa,va,xa,M,fa,n.envMap)}else n.wireframe?Ca(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshLambertMaterial)n.map&&!n.wireframe&&(n.map.mapping instanceof THREE.UVMapping&&(pa=m.uvs[0],
|
|
|
+z(R,V,aa,ja,I,L,pa[f].u,pa[f].v,pa[h].u,pa[h].v,pa[l].u,pa[l].v,n.map)),c(THREE.SubtractiveBlending)),Q?!n.wireframe&&n.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==3?(ga.r=X.r=ca.r=ba.r,ga.g=X.g=ca.g=ba.g,ga.b=X.b=ca.b=ba.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],ga),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],X),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],ca),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)),X.r=Math.max(0,Math.min(n.color.r*X.r,1)),X.g=Math.max(0,Math.min(n.color.g*X.g,1)),X.b=Math.max(0,Math.min(n.color.b*X.b,1)),ca.r=Math.max(0,Math.min(n.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(n.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(n.color.b*ca.b,1)),na.r=(X.r+ca.r)*0.5,na.g=(X.g+ca.g)*0.5,na.b=(X.b+ca.b)*0.5,ta=Ja(ga,X,ca,na),Fa(R,V,aa,ja,I,L,0,0,1,0,0,1,ta)):(O.r=ba.r,O.g=ba.g,O.b=ba.b,p(i,m.centroidWorld,m.normalWorld,O),O.r=Math.max(0,Math.min(n.color.r*O.r,1)),O.g=Math.max(0,
|
|
|
+Math.min(n.color.g*O.g,1)),O.b=Math.max(0,Math.min(n.color.b*O.b,1)),n.wireframe?Ca(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(O)):n.wireframe?Ca(n.color,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(n.color);else if(n instanceof THREE.MeshDepthMaterial)ra=k.near,oa=k.far,ga.r=ga.g=ga.b=1-Ea(a.positionScreen.z,ra,oa),X.r=X.g=X.b=1-Ea(d.positionScreen.z,ra,oa),ca.r=ca.g=ca.b=1-Ea(e.positionScreen.z,ra,oa),na.r=(X.r+ca.r)*0.5,na.g=(X.g+ca.g)*0.5,na.b=(X.b+ca.b)*
|
|
|
+0.5,ta=Ja(ga,X,ca,na),Fa(R,V,aa,ja,I,L,0,0,1,0,0,1,ta);else if(n instanceof THREE.MeshNormalMaterial)O.r=Ga(m.normalWorld.x),O.g=Ga(m.normalWorld.y),O.b=Ga(m.normalWorld.z),n.wireframe?Ca(O,n.wireframeLinewidth,n.wireframeLinecap,n.wireframeLinejoin):Aa(O)}function y(a,d,e,f,h,n,m,j,ha){g.info.render.vertices+=4;g.info.render.faces++;b(j.opacity);c(j.blending);if(j.map||j.envMap)u(a,d,f,0,1,3,m,j,ha),u(h,e,n,1,2,3,m,j,ha);else if(R=a.positionScreen.x,V=a.positionScreen.y,aa=d.positionScreen.x,ja=
|
|
|
+d.positionScreen.y,I=e.positionScreen.x,L=e.positionScreen.y,C=f.positionScreen.x,P=f.positionScreen.y,W=h.positionScreen.x,S=h.positionScreen.y,l=n.positionScreen.x,da=n.positionScreen.y,j instanceof THREE.MeshBasicMaterial)w(R,V,aa,ja,I,L,C,P),j.wireframe?Ca(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(j.color);else if(j instanceof THREE.MeshLambertMaterial)Q?!j.wireframe&&j.shading==THREE.SmoothShading&&m.vertexNormalsWorld.length==4?(ga.r=X.r=ca.r=na.r=ba.r,ga.g=X.g=
|
|
|
+ca.g=na.g=ba.g,ga.b=X.b=ca.b=na.b=ba.b,p(i,m.v1.positionWorld,m.vertexNormalsWorld[0],ga),p(i,m.v2.positionWorld,m.vertexNormalsWorld[1],X),p(i,m.v4.positionWorld,m.vertexNormalsWorld[3],ca),p(i,m.v3.positionWorld,m.vertexNormalsWorld[2],na),ga.r=Math.max(0,Math.min(j.color.r*ga.r,1)),ga.g=Math.max(0,Math.min(j.color.g*ga.g,1)),ga.b=Math.max(0,Math.min(j.color.b*ga.b,1)),X.r=Math.max(0,Math.min(j.color.r*X.r,1)),X.g=Math.max(0,Math.min(j.color.g*X.g,1)),X.b=Math.max(0,Math.min(j.color.b*X.b,1)),ca.r=
|
|
|
+Math.max(0,Math.min(j.color.r*ca.r,1)),ca.g=Math.max(0,Math.min(j.color.g*ca.g,1)),ca.b=Math.max(0,Math.min(j.color.b*ca.b,1)),na.r=Math.max(0,Math.min(j.color.r*na.r,1)),na.g=Math.max(0,Math.min(j.color.g*na.g,1)),na.b=Math.max(0,Math.min(j.color.b*na.b,1)),ta=Ja(ga,X,ca,na),Ha(R,V,aa,ja,C,P),Fa(R,V,aa,ja,C,P,0,0,1,0,0,1,ta),Ha(W,S,I,L,l,da),Fa(W,S,I,L,l,da,1,0,1,1,0,1,ta)):(O.r=ba.r,O.g=ba.g,O.b=ba.b,p(i,m.centroidWorld,m.normalWorld,O),O.r=Math.max(0,Math.min(j.color.r*O.r,1)),O.g=Math.max(0,Math.min(j.color.g*
|
|
|
+O.g,1)),O.b=Math.max(0,Math.min(j.color.b*O.b,1)),w(R,V,aa,ja,I,L,C,P),j.wireframe?Ca(O,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(O)):(w(R,V,aa,ja,I,L,C,P),j.wireframe?Ca(j.color,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(j.color));else if(j instanceof THREE.MeshNormalMaterial)O.r=Ga(m.normalWorld.x),O.g=Ga(m.normalWorld.y),O.b=Ga(m.normalWorld.z),w(R,V,aa,ja,I,L,C,P),j.wireframe?Ca(O,j.wireframeLinewidth,j.wireframeLinecap,j.wireframeLinejoin):Aa(O);else if(j instanceof
|
|
|
+THREE.MeshDepthMaterial)ra=k.near,oa=k.far,ga.r=ga.g=ga.b=1-Ea(a.positionScreen.z,ra,oa),X.r=X.g=X.b=1-Ea(d.positionScreen.z,ra,oa),ca.r=ca.g=ca.b=1-Ea(f.positionScreen.z,ra,oa),na.r=na.g=na.b=1-Ea(e.positionScreen.z,ra,oa),ta=Ja(ga,X,ca,na),Ha(R,V,aa,ja,C,P),Fa(R,V,aa,ja,C,P,0,0,1,0,0,1,ta),Ha(W,S,I,L,l,da),Fa(W,S,I,L,l,da,1,0,1,1,0,1,ta)}function Ha(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 w(a,b,c,d,e,g,f,h){n.beginPath();n.moveTo(a,
|
|
|
+b);n.lineTo(c,d);n.lineTo(e,g);n.lineTo(f,h);n.lineTo(a,b);n.closePath()}function Ca(a,b,c,e){if(A!=b)n.lineWidth=A=b;if(v!=c)n.lineCap=v=c;if(G!=e)n.lineJoin=G=e;d(a.getContextStyle());n.stroke();H.inflate(b*2)}function Aa(a){e(a.getContextStyle());n.fill()}function z(a,b,c,d,g,f,h,i,l,k,m,j,ha){if(ha.image.width!=0){if(ha.needsUpdate==!0||ia[ha.id]==void 0){var o=ha.wrapS==THREE.RepeatWrapping,p=ha.wrapT==THREE.RepeatWrapping;ia[ha.id]=n.createPattern(ha.image,o&&p?"repeat":o&&!p?"repeat-x":!o&&
|
|
|
+p?"repeat-y":"no-repeat");ha.needsUpdate=!1}e(ia[ha.id]);var o=ha.offset.x/ha.repeat.x,p=ha.offset.y/ha.repeat.y,M=ha.image.width*ha.repeat.x,r=ha.image.height*ha.repeat.y,h=(h+o)*M,i=(i+p)*r,l=(l+o)*M,k=(k+p)*r,m=(m+o)*M,j=(j+p)*r;c-=a;d-=b;g-=a;f-=b;l-=h;k-=i;m-=h;j-=i;o=l*j-m*k;if(o==0){if(qa[ha.id]==void 0)b=document.createElement("canvas"),b.width=ha.image.width,b.height=ha.image.height,a=b.getContext("2d"),a.drawImage(ha.image,0,0),qa[ha.id]=a.getImageData(0,0,ha.image.width,ha.image.height).data,
|
|
|
+delete b;b=qa[ha.id];h=(Math.floor(h)+Math.floor(i)*ha.image.width)*4;O.setRGB(b[h]/255,b[h+1]/255,b[h+2]/255);Aa(O)}else o=1/o,ha=(j*c-k*g)*o,k=(j*d-k*f)*o,c=(l*g-m*c)*o,d=(l*f-m*d)*o,a=a-ha*h-c*i,h=b-k*h-d*i,n.save(),n.transform(ha,k,c,d,a,h),n.fill(),n.restore()}}function Fa(a,b,c,d,e,g,f,h,i,l,k,m,j){var ha,o;ha=j.width-1;o=j.height-1;f*=ha;h*=o;i*=ha;l*=o;k*=ha;m*=o;c-=a;d-=b;e-=a;g-=b;i-=f;l-=h;k-=f;m-=h;o=1/(i*m-k*l);ha=(m*c-l*e)*o;l=(m*d-l*g)*o;c=(i*e-k*c)*o;d=(i*g-k*d)*o;a=a-ha*f-c*h;b=b-
|
|
|
+l*f-d*h;n.save();n.transform(ha,l,c,d,a,b);n.clip();n.drawImage(j,0,0);n.restore()}function Ja(a,b,c,d){var e=~~(a.r*255),g=~~(a.g*255),a=~~(a.b*255),f=~~(b.r*255),h=~~(b.g*255),b=~~(b.b*255),l=~~(c.r*255),i=~~(c.g*255),c=~~(c.b*255),k=~~(d.r*255),m=~~(d.g*255),d=~~(d.b*255);ya[0]=e<0?0:e>255?255:e;ya[1]=g<0?0:g>255?255:g;ya[2]=a<0?0:a>255?255:a;ya[4]=f<0?0:f>255?255:f;ya[5]=h<0?0:h>255?255:h;ya[6]=b<0?0:b>255?255:b;ya[8]=l<0?0:l>255?255:l;ya[9]=i<0?0:i>255?255:i;ya[10]=c<0?0:c>255?255:c;ya[12]=k<
|
|
|
+0?0:k>255?255:k;ya[13]=m<0?0:m>255?255:m;ya[14]=d<0?0:d>255?255:d;ea.putImageData(za,0,0);Ia.drawImage(ka,0,0);return ha}function Ea(a,b,c){a=(a-b)/(c-b);return a*a*(3-2*a)}function Ga(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}function Da(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 D,Ka,ua,E;this.autoClear?this.clear():n.setTransform(1,0,0,-1,m,q);g.info.render.vertices=0;g.info.render.faces=0;f=j.projectScene(a,k,this.sortElements);h=f.elements;
|
|
|
+i=f.lights;(Q=i.length>0)&&o(i);D=0;for(Ka=h.length;D<Ka;D++)if(ua=h[D],E=ua.material,E=E instanceof THREE.MeshFaceMaterial?ua.faceMaterial:E,!(E==null||E.opacity==0)){H.empty();if(ua instanceof THREE.RenderableParticle)F=ua,F.x*=m,F.y*=q,r(F,ua,E,a);else if(ua instanceof THREE.RenderableLine)F=ua.v1,K=ua.v2,F.positionScreen.x*=m,F.positionScreen.y*=q,K.positionScreen.x*=m,K.positionScreen.y*=q,H.addPoint(F.positionScreen.x,F.positionScreen.y),H.addPoint(K.positionScreen.x,K.positionScreen.y),T.intersects(H)&&
|
|
|
+t(F,K,ua,E,a);else if(ua instanceof THREE.RenderableFace3)F=ua.v1,K=ua.v2,s=ua.v3,F.positionScreen.x*=m,F.positionScreen.y*=q,K.positionScreen.x*=m,K.positionScreen.y*=q,s.positionScreen.x*=m,s.positionScreen.y*=q,E.overdraw&&(Da(F.positionScreen,K.positionScreen),Da(K.positionScreen,s.positionScreen),Da(s.positionScreen,F.positionScreen)),H.add3Points(F.positionScreen.x,F.positionScreen.y,K.positionScreen.x,K.positionScreen.y,s.positionScreen.x,s.positionScreen.y),T.intersects(H)&&u(F,K,s,0,1,2,
|
|
|
+ua,E,a);else if(ua instanceof THREE.RenderableFace4)F=ua.v1,K=ua.v2,s=ua.v3,N=ua.v4,F.positionScreen.x*=m,F.positionScreen.y*=q,K.positionScreen.x*=m,K.positionScreen.y*=q,s.positionScreen.x*=m,s.positionScreen.y*=q,N.positionScreen.x*=m,N.positionScreen.y*=q,U.positionScreen.copy(K.positionScreen),$.positionScreen.copy(N.positionScreen),E.overdraw&&(Da(F.positionScreen,K.positionScreen),Da(K.positionScreen,N.positionScreen),Da(N.positionScreen,F.positionScreen),Da(s.positionScreen,U.positionScreen),
|
|
|
+Da(s.positionScreen,$.positionScreen)),H.addPoint(F.positionScreen.x,F.positionScreen.y),H.addPoint(K.positionScreen.x,K.positionScreen.y),H.addPoint(s.positionScreen.x,s.positionScreen.y),H.addPoint(N.positionScreen.x,N.positionScreen.y),T.intersects(H)&&y(F,K,s,N,U,$,ua,E,a);J.addRectangle(H)}n.setTransform(1,0,0,1,0,0)}};
|
|
|
+THREE.SVGRenderer=function(){function a(a,b,c,d){var e,g,f,h,i,l;e=0;for(g=a.length;e<g;e++)f=a[e],h=f.color,f instanceof THREE.DirectionalLight?(i=f.matrixWorld.getPosition(),l=c.dot(i),l<=0||(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)):f instanceof THREE.PointLight&&(i=f.matrixWorld.getPosition(),l=c.dot(F.sub(i,b).normalize()),l<=0||(l*=f.distance==0?1:1-Math.min(b.distanceTo(i)/f.distance,1),l!=0&&(l*=f.intensity,d.r+=h.r*l,d.g+=h.g*l,d.b+=h.b*l)))}function b(a){K[a]==null&&(K[a]=document.createElementNS("http://www.w3.org/2000/svg",
|
|
|
+"path"),R==0&&K[a].setAttribute("shape-rendering","crispEdges"));return K[a]}function c(a){a=(a+1)*0.5;return a<0?0:a>1?1:a}var d=this,e,g,f,h=new THREE.Projector,i=document.createElementNS("http://www.w3.org/2000/svg","svg"),j,k,o,p,m,q,n,r,t=new THREE.Rectangle,u=new THREE.Rectangle,y=!1,w=new THREE.Color,z=new THREE.Color,A=new THREE.Color,v=new THREE.Color,G,F=new THREE.Vector3,K=[],s=[],N,U,$,R=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":R=1;break;case "low":R=0}};this.setSize=function(a,b){j=a;k=b;o=j/2;p=k/2;i.setAttribute("viewBox",-o+" "+-p+" "+j+" "+k);i.setAttribute("width",j);i.setAttribute("height",k);t.set(-o,-p,o,p)};this.clear=function(){for(;i.childNodes.length>0;)i.removeChild(i.childNodes[0])};this.render=function(k,j){var K,F,L,C;this.autoClear&&this.clear();d.info.render.vertices=0;d.info.render.faces=0;e=h.projectScene(k,j,this.sortElements);g=e.elements;
|
|
|
+f=e.lights;$=U=0;if(y=f.length>0){z.setRGB(0,0,0);A.setRGB(0,0,0);v.setRGB(0,0,0);K=0;for(F=f.length;K<F;K++)C=f[K],L=C.color,C instanceof THREE.AmbientLight?(z.r+=L.r,z.g+=L.g,z.b+=L.b):C instanceof THREE.DirectionalLight?(A.r+=L.r,A.g+=L.g,A.b+=L.b):C instanceof THREE.PointLight&&(v.r+=L.r,v.g+=L.g,v.b+=L.b)}K=0;for(F=g.length;K<F;K++)if(L=g[K],C=L.material,C=C instanceof THREE.MeshFaceMaterial?L.faceMaterial:C,!(C==null||C.opacity==0))if(u.empty(),L instanceof THREE.RenderableParticle)m=L,m.x*=
|
|
|
+o,m.y*=-p;else if(L instanceof THREE.RenderableLine){if(m=L.v1,q=L.v2,m.positionScreen.x*=o,m.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),t.intersects(u)){L=m;var P=q,W=$++;s[W]==null&&(s[W]=document.createElementNS("http://www.w3.org/2000/svg","line"),R==0&&s[W].setAttribute("shape-rendering","crispEdges"));N=s[W];N.setAttribute("x1",L.positionScreen.x);N.setAttribute("y1",L.positionScreen.y);
|
|
|
+N.setAttribute("x2",P.positionScreen.x);N.setAttribute("y2",P.positionScreen.y);C instanceof THREE.LineBasicMaterial&&(N.setAttribute("style","fill: none; stroke: "+C.color.getContextStyle()+"; stroke-width: "+C.linewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.linecap+"; stroke-linejoin: "+C.linejoin),i.appendChild(N))}}else if(L instanceof THREE.RenderableFace3){if(m=L.v1,q=L.v2,n=L.v3,m.positionScreen.x*=o,m.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,n.positionScreen.x*=
|
|
|
+o,n.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,m.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),t.intersects(u)){var P=m,W=q,S=n;d.info.render.vertices+=3;d.info.render.faces++;N=b(U++);N.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?w.copy(C.color):C instanceof THREE.MeshLambertMaterial?
|
|
|
+y?(w.r=z.r,w.g=z.g,w.b=z.b,a(f,L.centroidWorld,L.normalWorld,w),w.r=Math.max(0,Math.min(C.color.r*w.r,1)),w.g=Math.max(0,Math.min(C.color.g*w.g,1)),w.b=Math.max(0,Math.min(C.color.b*w.b,1))):w.copy(C.color):C instanceof THREE.MeshDepthMaterial?(G=1-C.__2near/(C.__farPlusNear-L.z*C.__farMinusNear),w.setRGB(G,G,G)):C instanceof THREE.MeshNormalMaterial&&w.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));C.wireframe?N.setAttribute("style","fill: none; stroke: "+w.getContextStyle()+"; stroke-width: "+
|
|
|
+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):N.setAttribute("style","fill: "+w.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(N)}}else if(L instanceof THREE.RenderableFace4&&(m=L.v1,q=L.v2,n=L.v3,r=L.v4,m.positionScreen.x*=o,m.positionScreen.y*=-p,q.positionScreen.x*=o,q.positionScreen.y*=-p,n.positionScreen.x*=o,n.positionScreen.y*=-p,r.positionScreen.x*=o,r.positionScreen.y*=-p,u.addPoint(m.positionScreen.x,
|
|
|
+m.positionScreen.y),u.addPoint(q.positionScreen.x,q.positionScreen.y),u.addPoint(n.positionScreen.x,n.positionScreen.y),u.addPoint(r.positionScreen.x,r.positionScreen.y),t.intersects(u))){var P=m,W=q,S=n,l=r;d.info.render.vertices+=4;d.info.render.faces++;N=b(U++);N.setAttribute("d","M "+P.positionScreen.x+" "+P.positionScreen.y+" L "+W.positionScreen.x+" "+W.positionScreen.y+" L "+S.positionScreen.x+","+S.positionScreen.y+" L "+l.positionScreen.x+","+l.positionScreen.y+"z");C instanceof THREE.MeshBasicMaterial?
|
|
|
+w.copy(C.color):C instanceof THREE.MeshLambertMaterial?y?(w.r=z.r,w.g=z.g,w.b=z.b,a(f,L.centroidWorld,L.normalWorld,w),w.r=Math.max(0,Math.min(C.color.r*w.r,1)),w.g=Math.max(0,Math.min(C.color.g*w.g,1)),w.b=Math.max(0,Math.min(C.color.b*w.b,1))):w.copy(C.color):C instanceof THREE.MeshDepthMaterial?(G=1-C.__2near/(C.__farPlusNear-L.z*C.__farMinusNear),w.setRGB(G,G,G)):C instanceof THREE.MeshNormalMaterial&&w.setRGB(c(L.normalWorld.x),c(L.normalWorld.y),c(L.normalWorld.z));C.wireframe?N.setAttribute("style",
|
|
|
+"fill: none; stroke: "+w.getContextStyle()+"; stroke-width: "+C.wireframeLinewidth+"; stroke-opacity: "+C.opacity+"; stroke-linecap: "+C.wireframeLinecap+"; stroke-linejoin: "+C.wireframeLinejoin):N.setAttribute("style","fill: "+w.getContextStyle()+"; fill-opacity: "+C.opacity);i.appendChild(N)}}};
|
|
|
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",
|
|
@@ -223,117 +223,117 @@ THREE.ShaderChunk.fog_pars_fragment,THREE.ShaderChunk.shadowmap_pars_fragment,"v
|
|
|
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 b(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=l.createBuffer();f.buffer.belongsToAttribute=e;f.needsUpdate=!0}a.__webglCustomAttributesList.push(f)}}}
|
|
|
function c(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){if(a instanceof THREE.MeshBasicMaterial&&!a.envMap||a instanceof THREE.MeshDepthMaterial)return!1;return a&&a.shading!==void 0&&a.shading===THREE.SmoothShading?THREE.SmoothShading:THREE.FlatShading}function e(a){if(a.vertexColors)return a.vertexColors;return!1}function g(a){if(a.map||a.lightMap||a instanceof THREE.ShaderMaterial)return!0;
|
|
|
-return!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,k=i.length,m=a.__vertexArray,n=a.__colorArray,j=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,M=a.__webglCustomAttributesList;if(c.sortParticles){J.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Y.copy(e),J.multiplyVector3(Y),j[d]=[Y.z,d];j.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[j[d][1]].position,f=d*3,m[f]=e.x,m[f+1]=e.y,m[f+2]=e.z;for(d=0;d<k;d++)f=d*3,e=i[j[d][1]],n[f]=e.r,n[f+1]=
|
|
|
+return!1}function f(a,b,c){var d,e,f,g,h=a.vertices;g=h.length;var i=a.colors,k=i.length,m=a.__vertexArray,n=a.__colorArray,j=a.__sortArray,o=a.__dirtyVertices,p=a.__dirtyColors,M=a.__webglCustomAttributesList;if(c.sortParticles){H.multiplySelf(c.matrixWorld);for(d=0;d<g;d++)e=h[d].position,Z.copy(e),H.multiplyVector3(Z),j[d]=[Z.z,d];j.sort(function(a,b){return b[0]-a[0]});for(d=0;d<g;d++)e=h[j[d][1]].position,f=d*3,m[f]=e.x,m[f+1]=e.y,m[f+2]=e.z;for(d=0;d<k;d++)f=d*3,e=i[j[d][1]],n[f]=e.r,n[f+1]=
|
|
|
e.g,n[f+2]=e.b;if(M){i=0;for(k=M.length;i<k;i++)if(h=M[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=j[d][1],h.array[d]=h.value[g];else if(h.size===2)for(d=0;d<e;d++)g=j[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=j[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=j[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=j[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(o)for(d=0;d<g;d++)e=h[d].position,f=d*3,m[f]=e.x,m[f+1]=e.y,m[f+2]=e.z;if(p)for(d=0;d<k;d++)e=i[d],f=d*3,n[f]=e.r,n[f+1]=e.g,n[f+2]=e.b;if(M){i=0;for(k=M.length;i<k;i++)if(h=M[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(o||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,m,b);if(p||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,
|
|
|
a.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,n,b);if(M){i=0;for(k=M.length;i<k;i++)if(h=M[i],h.needsUpdate||c.sortParticles)l.bindBuffer(l.ARRAY_BUFFER,h.buffer),l.bufferData(l.ARRAY_BUFFER,h.array,b)}}function h(a,b,c){if(!a.__webglVertexBuffer)a.__webglVertexBuffer=l.createBuffer();if(!a.__webglNormalBuffer)a.__webglNormalBuffer=l.createBuffer();a.hasPos&&(l.bindBuffer(l.ARRAY_BUFFER,a.__webglVertexBuffer),l.bufferData(l.ARRAY_BUFFER,a.positionArray,l.DYNAMIC_DRAW),l.enableVertexAttribArray(b.attributes.position),
|
|
|
l.vertexAttribPointer(b.attributes.position,3,l.FLOAT,!1,0,0));if(a.hasNormal){l.bindBuffer(l.ARRAY_BUFFER,a.__webglNormalBuffer);if(c===THREE.FlatShading){var d,e,f,g,h,i,k,m,n,j,o=a.count*3;for(j=0;j<o;j+=9)c=a.normalArray,d=c[j],e=c[j+1],f=c[j+2],g=c[j+3],i=c[j+4],m=c[j+5],h=c[j+6],k=c[j+7],n=c[j+8],d=(d+g+h)/3,e=(e+i+k)/3,f=(f+m+n)/3,c[j]=d,c[j+1]=e,c[j+2]=f,c[j+3]=d,c[j+4]=e,c[j+5]=f,c[j+6]=d,c[j+7]=e,c[j+8]=f}l.bufferData(l.ARRAY_BUFFER,a.normalArray,l.DYNAMIC_DRAW);l.enableVertexAttribArray(b.attributes.normal);
|
|
|
-l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}l.drawArrays(l.TRIANGLES,0,a.count);a.count=0}function i(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=v(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==ba&&(ba=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),
|
|
|
+l.vertexAttribPointer(b.attributes.normal,3,l.FLOAT,!1,0,0)}l.drawArrays(l.TRIANGLES,0,a.count);a.count=0}function i(a,b,c,d,e,f){if(d.opacity!==0){var g,h,c=w(a,b,c,d,f),b=c.attributes,a=!1,c=e.id*16777215+c.id*2+(d.wireframe?1:0);c!==ca&&(ca=c,a=!0);if(!d.morphTargets&&b.position>=0)a&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),l.vertexAttribPointer(b.position,3,l.FLOAT,!1,0,0));else if(f.morphTargetBase){c=d.program.attributes;f.morphTargetBase!==-1?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[f.morphTargetBase]),
|
|
|
l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0)):c.position>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglVertexBuffer),l.vertexAttribPointer(c.position,3,l.FLOAT,!1,0,0));if(f.morphTargetForcedOrder.length){g=0;var i=f.morphTargetForcedOrder;for(h=f.morphTargetInfluences;g<d.numSupportedMorphTargets&&g<i.length;)l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[i[g]]),l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0),f.__webglMorphTargetInfluences[g]=h[i[g]],g++}else{var i=[],k=-1,
|
|
|
-j=0;h=f.morphTargetInfluences;var m,n=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(m=0;m<n;m++)!i[m]&&h[m]>k&&(j=m,k=h[j]);l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[j]);l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=k;i[j]=1;k=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&l.uniform1fv(d.program.uniforms.morphTargetInfluences,f.__webglMorphTargetInfluences)}if(a){if(e.__webglCustomAttributesList){g=
|
|
|
+m=0;h=f.morphTargetInfluences;var j,n=h.length;g=0;for(f.morphTargetBase!==-1&&(i[f.morphTargetBase]=!0);g<d.numSupportedMorphTargets;){for(j=0;j<n;j++)!i[j]&&h[j]>k&&(m=j,k=h[m]);l.bindBuffer(l.ARRAY_BUFFER,e.__webglMorphTargetsBuffers[m]);l.vertexAttribPointer(c["morphTarget"+g],3,l.FLOAT,!1,0,0);f.__webglMorphTargetInfluences[g]=k;i[m]=1;k=-1;g++}}d.program.uniforms.morphTargetInfluences!==null&&l.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&&(l.bindBuffer(l.ARRAY_BUFFER,c.buffer),l.vertexAttribPointer(b[c.buffer.belongsToAttribute],c.size,l.FLOAT,!1,0,0))}b.color>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglColorBuffer),l.vertexAttribPointer(b.color,3,l.FLOAT,!1,0,0));b.normal>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglNormalBuffer),l.vertexAttribPointer(b.normal,3,l.FLOAT,!1,0,0));b.tangent>=0&&(l.bindBuffer(l.ARRAY_BUFFER,
|
|
|
e.__webglTangentBuffer),l.vertexAttribPointer(b.tangent,4,l.FLOAT,!1,0,0));b.uv>=0&&(e.__webglUVBuffer?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUVBuffer),l.vertexAttribPointer(b.uv,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv)):l.disableVertexAttribArray(b.uv));b.uv2>=0&&(e.__webglUV2Buffer?(l.bindBuffer(l.ARRAY_BUFFER,e.__webglUV2Buffer),l.vertexAttribPointer(b.uv2,2,l.FLOAT,!1,0,0),l.enableVertexAttribArray(b.uv2)):l.disableVertexAttribArray(b.uv2));d.skinning&&b.skinVertexA>=0&&b.skinVertexB>=
|
|
|
0&&b.skinIndex>=0&&b.skinWeight>=0&&(l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinVertexABuffer),l.vertexAttribPointer(b.skinVertexA,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinVertexBBuffer),l.vertexAttribPointer(b.skinVertexB,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinIndicesBuffer),l.vertexAttribPointer(b.skinIndex,4,l.FLOAT,!1,0,0),l.bindBuffer(l.ARRAY_BUFFER,e.__webglSkinWeightsBuffer),l.vertexAttribPointer(b.skinWeight,4,l.FLOAT,!1,0,0))}f instanceof THREE.Mesh?(d.wireframe?
|
|
|
-(d=d.wireframeLinewidth,d!==va&&(l.lineWidth(d),va=d),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,l.UNSIGNED_SHORT,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,l.UNSIGNED_SHORT,0)),R.info.render.calls++,R.info.render.vertices+=e.__webglFaceCount,R.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,d=d.linewidth,d!==
|
|
|
-va&&(l.lineWidth(d),va=d),l.drawArrays(f,0,e.__webglLineCount),R.info.render.calls++):f instanceof THREE.ParticleSystem?(l.drawArrays(l.POINTS,0,e.__webglParticleCount),R.info.render.calls++):f instanceof THREE.Ribbon&&(l.drawArrays(l.TRIANGLE_STRIP,0,e.__webglVertexCount),R.info.render.calls++)}}function j(a){ha[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);ha[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);ha[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);ha[3].set(a.n41-
|
|
|
-a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);ha[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);ha[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=ha[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function k(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=ha[d].x*b.n14+ha[d].y*b.n24+ha[d].z*b.n34+ha[d].w,a<=c)return!1;return!0}function o(a,b){return b.z-a.z}function p(a){var b,
|
|
|
-c,d,e,f,g,m,n,o=0,p=a.lights;X||(X=new THREE.PerspectiveCamera(R.shadowCameraFov,R.shadowMapWidth/R.shadowMapHeight,R.shadowCameraNear,R.shadowCameraFar));b=0;for(c=p.length;b<c;b++)if(n=p[b],n.castShadow&&n instanceof THREE.SpotLight){W=-1;R.shadowMap[o]||(R.shadowMap[o]=new THREE.WebGLRenderTarget(R.shadowMapWidth,R.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ka[o]=new THREE.Matrix4);d=R.shadowMap[o];e=ka[o];X.position.copy(n.position);X.lookAt(n.target.position);
|
|
|
-X.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(X),this.autoUpdateScene&&a.updateMatrixWorld());X.matrixWorldInverse.getInverse(X.matrixWorld);e.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);e.multiplySelf(X.projectionMatrix);e.multiplySelf(X.matrixWorldInverse);X.matrixWorldInverse.flattenToArray(aa);X.projectionMatrix.flattenToArray(P);J.multiply(X.projectionMatrix,X.matrixWorldInverse);j(J);T(d);l.clearColor(1,1,1,1);R.clear();l.clearColor(H.r,H.g,H.b,O);e=a.__webglObjects.length;
|
|
|
-for(d=0;d<e;d++)if(g=a.__webglObjects[d],n=g.object,g.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||k(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),A(n,X,!1),g.render=!0;w(!0);R.setBlending(THREE.NormalBlending);for(d=0;d<e;d++)if(g=a.__webglObjects[d],g.render)n=g.object,g=g.buffer,z(n),m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?za:da,i(X,p,null,m,g,n);e=a.__webglObjectsImmediate.length;for(d=0;d<e;d++)g=a.__webglObjectsImmediate[d],
|
|
|
-n=g.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),ba=-1,A(n,X,!1),z(n),f=v(X,p,null,da,n),n.immediateRenderCallback?n.immediateRenderCallback(f,l,ha):n.render(function(a){h(a,f,da.shading)}));o++}}function m(a,b,c,d,e,f,g,h){var l,k,n,m;b?(k=a.length-1,m=b=-1):(k=0,b=a.length,m=1);for(var j=k;j!==b;j+=m)if(l=a[j],l.render){k=l.object;n=l.buffer;if(h)l=h;else{l=l[c];if(!l)continue;g&&R.setBlending(l.blending);w(l.depthTest);I(l.depthWrite);
|
|
|
-F(l.polygonOffset,l.polygonOffsetFactor,l.polygonOffsetUnits)}z(k);i(d,e,f,l,n,k)}}function q(a,b,c,d,e,f,g){for(var i,k,n,m,j=0,o=a.length;j<o;j++)if(i=a[j],k=i.object,k.visible){ba=-1;if(g)n=g;else{n=i[b];if(!n)continue;f&&this.setBlending(n.blending);w(n.depthTest);I(n.depthWrite);F(n.polygonOffset,n.polygonOffsetFactor,n.polygonOffsetUnits)}z(k);m=v(c,d,e,n,k);k.immediateRenderCallback?k.immediateRenderCallback(m,l,ha):k.render(function(a){h(a,m,n.shading)})}}function n(a,b,c){a.push({buffer:b,
|
|
|
-object:c,opaque:null,transparent:null})}function r(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 u(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function y(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function v(a,b,c,d,e){d.program||R.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(R.maxMorphTargets);
|
|
|
-for(var f=0,g=R.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==N&&(l.useProgram(f),N=f,h=!0);if(d.id!==W)W=d.id,h=!0;if(h){l.uniformMatrix4fv(g.projectionMatrix,!1,P);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 k,
|
|
|
-n,m=0,j=0,o=0,p,M,r,q=sa,t=q.directional.colors,S=q.directional.positions,ea=q.point.colors,u=q.point.positions,y=q.point.distances,v=0,ha=0,c=k=r=0,h=b.length;c<h;c++)if(k=b[c],n=k.color,p=k.position,M=k.intensity,r=k.distance,k instanceof THREE.AmbientLight)R.gammaInput?(m+=n.r*n.r,j+=n.g*n.g,o+=n.b*n.b):(m+=n.r,j+=n.g,o+=n.b);else if(k instanceof THREE.DirectionalLight)r=v*3,R.gammaInput?(t[r]=n.r*n.r*M*M,t[r+1]=n.g*n.g*M*M,t[r+2]=n.b*n.b*M*M):(t[r]=n.r*M,t[r+1]=n.g*M,t[r+2]=n.b*M),S[r]=p.x,S[r+
|
|
|
-1]=p.y,S[r+2]=p.z,v+=1;else if(k instanceof THREE.SpotLight)r=v*3,R.gammaInput?(t[r]=n.r*n.r*M*M,t[r+1]=n.g*n.g*M*M,t[r+2]=n.b*n.b*M*M):(t[r]=n.r*M,t[r+1]=n.g*M,t[r+2]=n.b*M),n=1/p.length(),S[r]=p.x*n,S[r+1]=p.y*n,S[r+2]=p.z*n,v+=1;else if(k instanceof THREE.PointLight)k=ha*3,R.gammaInput?(ea[k]=n.r*n.r*M*M,ea[k+1]=n.g*n.g*M*M,ea[k+2]=n.b*n.b*M*M):(ea[k]=n.r*M,ea[k+1]=n.g*M,ea[k+2]=n.b*M),u[k]=p.x,u[k+1]=p.y,u[k+2]=p.z,y[ha]=r,ha+=1;c=v*3;for(h=t.length;c<h;c++)t[c]=0;c=ha*3;for(h=ea.length;c<h;c++)ea[c]=
|
|
|
-0;q.point.length=ha;q.directional.length=v;q.ambient[0]=m;q.ambient[1]=j;q.ambient[2]=o;b=sa;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,R.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=U.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,R.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)R.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<ka.length;b++)i.shadowMatrix.value[b]=ka[b],i.shadowMap.texture[b]=R.shadowMap[b];i.shadowDarkness.value=R.shadowMapDarkness;i.shadowBias.value=R.shadowMapBias}b=
|
|
|
+(d=d.wireframeLinewidth,d!==va&&(l.lineWidth(d),va=d),a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglLineBuffer),l.drawElements(l.LINES,e.__webglLineCount,l.UNSIGNED_SHORT,0)):(a&&l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,e.__webglFaceBuffer),l.drawElements(l.TRIANGLES,e.__webglFaceCount,l.UNSIGNED_SHORT,0)),S.info.render.calls++,S.info.render.vertices+=e.__webglFaceCount,S.info.render.faces+=e.__webglFaceCount/3):f instanceof THREE.Line?(f=f.type===THREE.LineStrip?l.LINE_STRIP:l.LINES,d=d.linewidth,d!==
|
|
|
+va&&(l.lineWidth(d),va=d),l.drawArrays(f,0,e.__webglLineCount),S.info.render.calls++):f instanceof THREE.ParticleSystem?(l.drawArrays(l.POINTS,0,e.__webglParticleCount),S.info.render.calls++):f instanceof THREE.Ribbon&&(l.drawArrays(l.TRIANGLE_STRIP,0,e.__webglVertexCount),S.info.render.calls++)}}function j(a){J[0].set(a.n41-a.n11,a.n42-a.n12,a.n43-a.n13,a.n44-a.n14);J[1].set(a.n41+a.n11,a.n42+a.n12,a.n43+a.n13,a.n44+a.n14);J[2].set(a.n41+a.n21,a.n42+a.n22,a.n43+a.n23,a.n44+a.n24);J[3].set(a.n41-
|
|
|
+a.n21,a.n42-a.n22,a.n43-a.n23,a.n44-a.n24);J[4].set(a.n41-a.n31,a.n42-a.n32,a.n43-a.n33,a.n44-a.n34);J[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=J[a],b.divideScalar(Math.sqrt(b.x*b.x+b.y*b.y+b.z*b.z))}function k(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=J[d].x*b.n14+J[d].y*b.n24+J[d].z*b.n34+J[d].w,a<=c)return!1;return!0}function o(a,b){return b.z-a.z}function p(a){var b,c,
|
|
|
+d,e,f,g,m,n,o=0,p=a.lights;Y||(Y=new THREE.PerspectiveCamera(S.shadowCameraFov,S.shadowMapWidth/S.shadowMapHeight,S.shadowCameraNear,S.shadowCameraFar));b=0;for(c=p.length;b<c;b++)if(n=p[b],n.castShadow&&n instanceof THREE.SpotLight){X=-1;S.shadowMap[o]||(S.shadowMap[o]=new THREE.WebGLRenderTarget(S.shadowMapWidth,S.shadowMapHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.LinearFilter,format:THREE.RGBAFormat}),ka[o]=new THREE.Matrix4);d=S.shadowMap[o];e=ka[o];Y.position.copy(n.position);Y.lookAt(n.target.position);
|
|
|
+Y.parent==null&&(console.warn("Camera is not on the Scene. Adding it..."),a.add(Y),this.autoUpdateScene&&a.updateMatrixWorld());Y.matrixWorldInverse.getInverse(Y.matrixWorld);e.set(0.5,0,0,0.5,0,0.5,0,0.5,0,0,0.5,0.5,0,0,0,1);e.multiplySelf(Y.projectionMatrix);e.multiplySelf(Y.matrixWorldInverse);Y.matrixWorldInverse.flattenToArray(ba);Y.projectionMatrix.flattenToArray(Q);H.multiply(Y.projectionMatrix,Y.matrixWorldInverse);j(H);U(d);l.clearColor(1,1,1,1);S.clear();l.clearColor(C.r,C.g,C.b,P);e=a.__webglObjects.length;
|
|
|
+for(d=0;d<e;d++)if(g=a.__webglObjects[d],n=g.object,g.render=!1,n.visible&&n.castShadow&&(!(n instanceof THREE.Mesh)||!n.frustumCulled||k(n)))n.matrixWorld.flattenToArray(n._objectMatrixArray),z(n,Y,!1),g.render=!0;v(!0);S.setBlending(THREE.NormalBlending);for(d=0;d<e;d++)if(g=a.__webglObjects[d],g.render)n=g.object,g=g.buffer,A(n),m=n.customDepthMaterial?n.customDepthMaterial:n.geometry.morphTargets.length?za:ea,i(Y,p,null,m,g,n);e=a.__webglObjectsImmediate.length;for(d=0;d<e;d++)g=a.__webglObjectsImmediate[d],
|
|
|
+n=g.object,n.visible&&n.castShadow&&(n.matrixAutoUpdate&&n.matrixWorld.flattenToArray(n._objectMatrixArray),ca=-1,z(n,Y,!1),A(n),f=w(Y,p,null,ea,n),n.immediateRenderCallback?n.immediateRenderCallback(f,l,J):n.render(function(a){h(a,f,ea.shading)}));o++}}function m(a,b,c,d,e,f,g,h){var l,k,n,m;b?(k=a.length-1,m=b=-1):(k=0,b=a.length,m=1);for(var j=k;j!==b;j+=m)if(l=a[j],l.render){k=l.object;n=l.buffer;if(h)l=h;else{l=l[c];if(!l)continue;g&&S.setBlending(l.blending);v(l.depthTest);G(l.depthWrite);F(l.polygonOffset,
|
|
|
+l.polygonOffsetFactor,l.polygonOffsetUnits)}A(k);i(d,e,f,l,n,k)}}function q(a,b,c,d,e,f,g){for(var i,k,n,m,j=0,o=a.length;j<o;j++)if(i=a[j],k=i.object,k.visible){ca=-1;if(g)n=g;else{n=i[b];if(!n)continue;f&&this.setBlending(n.blending);v(n.depthTest);G(n.depthWrite);F(n.polygonOffset,n.polygonOffsetFactor,n.polygonOffsetUnits)}A(k);m=w(c,d,e,n,k);k.immediateRenderCallback?k.immediateRenderCallback(m,l,J):k.render(function(a){h(a,m,n.shading)})}}function n(a,b,c){a.push({buffer:b,object:c,opaque:null,
|
|
|
+transparent:null})}function r(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 u(a,b){for(var c=a.length-1;c>=0;c--)a[c].object===b&&a.splice(c,1)}function y(a,b){for(var c=a.length-1;c>=0;c--)a[c]===b&&a.splice(c,1)}function w(a,b,c,d,e){d.program||S.initMaterial(d,b,c,e);if(d.morphTargets&&!e.__webglMorphTargetInfluences){e.__webglMorphTargetInfluences=new Float32Array(S.maxMorphTargets);
|
|
|
+for(var f=0,g=S.maxMorphTargets;f<g;f++)e.__webglMorphTargetInfluences[f]=0}var h=!1,f=d.program,g=f.uniforms,i=d.uniforms;f!==O&&(l.useProgram(f),O=f,h=!0);if(d.id!==X)X=d.id,h=!0;if(h){l.uniformMatrix4fv(g.projectionMatrix,!1,Q);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 k,
|
|
|
+n,m=0,j=0,o=0,p,M,r,q=sa,t=q.directional.colors,T=q.directional.positions,fa=q.point.colors,u=q.point.positions,y=q.point.distances,J=0,K=0,c=k=r=0,h=b.length;c<h;c++)if(k=b[c],n=k.color,p=k.position,M=k.intensity,r=k.distance,k instanceof THREE.AmbientLight)S.gammaInput?(m+=n.r*n.r,j+=n.g*n.g,o+=n.b*n.b):(m+=n.r,j+=n.g,o+=n.b);else if(k instanceof THREE.DirectionalLight)r=J*3,S.gammaInput?(t[r]=n.r*n.r*M*M,t[r+1]=n.g*n.g*M*M,t[r+2]=n.b*n.b*M*M):(t[r]=n.r*M,t[r+1]=n.g*M,t[r+2]=n.b*M),T[r]=p.x,T[r+
|
|
|
+1]=p.y,T[r+2]=p.z,J+=1;else if(k instanceof THREE.SpotLight)r=J*3,S.gammaInput?(t[r]=n.r*n.r*M*M,t[r+1]=n.g*n.g*M*M,t[r+2]=n.b*n.b*M*M):(t[r]=n.r*M,t[r+1]=n.g*M,t[r+2]=n.b*M),n=1/p.length(),T[r]=p.x*n,T[r+1]=p.y*n,T[r+2]=p.z*n,J+=1;else if(k instanceof THREE.PointLight)k=K*3,S.gammaInput?(fa[k]=n.r*n.r*M*M,fa[k+1]=n.g*n.g*M*M,fa[k+2]=n.b*n.b*M*M):(fa[k]=n.r*M,fa[k+1]=n.g*M,fa[k+2]=n.b*M),u[k]=p.x,u[k+1]=p.y,u[k+2]=p.z,y[K]=r,K+=1;c=J*3;for(h=t.length;c<h;c++)t[c]=0;c=K*3;for(h=fa.length;c<h;c++)fa[c]=
|
|
|
+0;q.point.length=K;q.directional.length=J;q.ambient[0]=m;q.ambient[1]=j;q.ambient[2]=o;b=sa;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,
|
|
|
+S.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=V.height/2,i.map.texture=d.map;else if(d instanceof THREE.MeshPhongMaterial)i.shininess.value=d.shininess,S.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)S.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<ka.length;b++)i.shadowMatrix.value[b]=ka[b],i.shadowMap.texture[b]=S.shadowMap[b];i.shadowDarkness.value=S.shadowMapDarkness;i.shadowBias.value=S.shadowMapBias}b=
|
|
|
d.uniformsList;i=0;for(c=b.length;i<c;i++)if(j=f.uniforms[b[i][1]])if(m=b[i][0],o=m.type,h=m.value,o==="i")l.uniform1i(j,h);else if(o==="f")l.uniform1f(j,h);else if(o==="v2")l.uniform2f(j,h.x,h.y);else if(o==="v3")l.uniform3f(j,h.x,h.y,h.z);else if(o==="v4")l.uniform4f(j,h.x,h.y,h.z,h.w);else if(o==="c")l.uniform3f(j,h.r,h.g,h.b);else if(o==="fv1")l.uniform1fv(j,h);else if(o==="fv")l.uniform3fv(j,h);else if(o==="v3v"){if(!m._array)m._array=new Float32Array(3*h.length);o=0;for(p=h.length;o<p;o++)q=
|
|
|
o*3,m._array[q]=h[o].x,m._array[q+1]=h[o].y,m._array[q+2]=h[o].z;l.uniform3fv(j,m._array)}else if(o==="m4"){if(!m._array)m._array=new Float32Array(16);h.flattenToArray(m._array);l.uniformMatrix4fv(j,!1,m._array)}else if(o==="m4v"){if(!m._array)m._array=new Float32Array(16*h.length);o=0;for(p=h.length;o<p;o++)h[o].flattenToArrayOffset(m._array,o*16);l.uniformMatrix4fv(j,!1,m._array)}else if(o==="t"){if(l.uniform1i(j,h),j=m.texture)if(j.image instanceof Array&&j.image.length===6){if(m=j,m.image.length===
|
|
|
6)if(m.needsUpdate){if(!m.image.__webglTextureCube)m.image.__webglTextureCube=l.createTexture();l.activeTexture(l.TEXTURE0+h);l.bindTexture(l.TEXTURE_CUBE_MAP,m.image.__webglTextureCube);h=s(l.TEXTURE_CUBE_MAP,m,m.image[0]);for(j=0;j<6;j++)l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+j,0,l.RGBA,l.RGBA,l.UNSIGNED_BYTE,m.image[j]);h&&l.generateMipmap(l.TEXTURE_CUBE_MAP);m.needsUpdate=!1}else l.activeTexture(l.TEXTURE0+h),l.bindTexture(l.TEXTURE_CUBE_MAP,m.image.__webglTextureCube)}else j instanceof THREE.WebGLRenderTargetCube?
|
|
|
-(m=j,l.activeTexture(l.TEXTURE0+h),l.bindTexture(l.TEXTURE_CUBE_MAP,m.__webglTexture)):R.setTexture(j,h)}else if(o==="tv"){if(!m._array){m._array=[];o=0;for(p=m.texture.length;o<p;o++)m._array[o]=h+o}l.uniform1iv(j,m._array);o=0;for(p=m.texture.length;o<p;o++)(j=m.texture[o])&&R.setTexture(j,m._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&l.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&&l.uniformMatrix4fv(g.viewMatrix,!1,aa);d.skinning&&(l.uniformMatrix4fv(g.cameraInverseMatrix,!1,aa),l.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}l.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&l.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==
|
|
|
-null&&l.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function A(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function z(a){if(ia!==a.doubleSided)a.doubleSided?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),ia=a.doubleSided;if(qa!==a.flipSided)a.flipSided?l.frontFace(l.CW):l.frontFace(l.CCW),qa=a.flipSided}function w(a){oa!==a&&(a?l.enable(l.DEPTH_TEST):
|
|
|
-l.disable(l.DEPTH_TEST),oa=a)}function I(a){ta!==a&&(l.depthMask(a),ta=a)}function F(a,b,c){pa!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),pa=a);if(a&&(Ba!==b||wa!==c))l.polygonOffset(b,c),Ba=b,wa=c}function G(a,b){var c;a==="fragment"?c=l.createShader(l.FRAGMENT_SHADER):a==="vertex"&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);if(!l.getShaderParameter(c,l.COMPILE_STATUS))return console.error(l.getShaderInfoLog(c)),console.error(b),null;
|
|
|
-return c}function s(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(l.texParameteri(a,l.TEXTURE_WRAP_S,Q(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,Q(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,Q(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,Q(b.minFilter)),!0):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_MAG_FILTER,Z(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,Z(b.minFilter)),
|
|
|
-!1)}function E(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function T(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=l.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);s(l.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=l.createFramebuffer();a.__webglRenderbuffer[c]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,Q(a.format),
|
|
|
-a.width,a.height,0,Q(a.format),Q(a.type),null);var d=a,e=l.TEXTURE_CUBE_MAP_POSITIVE_X+c;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[c]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,e,d.__webglTexture,0);E(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),s(l.TEXTURE_2D,a,a),l.texImage2D(l.TEXTURE_2D,0,Q(a.format),a.width,a.height,0,Q(a.format),Q(a.type),null),
|
|
|
-c=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,c,a.__webglTexture,0),E(a.__webglRenderbuffer,a);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=ea,a=S,d=xa,e=M);b!==fa&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,
|
|
|
-e,c,a),fa=b)}function Z(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return l.NEAREST;default:return l.LINEAR}}function Q(a){switch(a){case THREE.RepeatWrapping:return l.REPEAT;case THREE.ClampToEdgeWrapping:return l.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return l.MIRRORED_REPEAT;case THREE.NearestFilter:return l.NEAREST;case THREE.NearestMipMapNearestFilter:return l.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return l.NEAREST_MIPMAP_LINEAR;
|
|
|
+(m=j,l.activeTexture(l.TEXTURE0+h),l.bindTexture(l.TEXTURE_CUBE_MAP,m.__webglTexture)):S.setTexture(j,h)}else if(o==="tv"){if(!m._array){m._array=[];o=0;for(p=m.texture.length;o<p;o++)m._array[o]=h+o}l.uniform1iv(j,m._array);o=0;for(p=m.texture.length;o<p;o++)(j=m.texture[o])&&S.setTexture(j,m._array[o])}(d instanceof THREE.ShaderMaterial||d instanceof THREE.MeshPhongMaterial||d.envMap)&&g.cameraPosition!==null&&l.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&&l.uniformMatrix4fv(g.viewMatrix,!1,ba);d.skinning&&(l.uniformMatrix4fv(g.cameraInverseMatrix,!1,ba),l.uniformMatrix4fv(g.boneGlobalMatrices,!1,e.boneMatrices))}l.uniformMatrix4fv(g.modelViewMatrix,!1,e._modelViewMatrixArray);g.normalMatrix&&l.uniformMatrix3fv(g.normalMatrix,!1,e._normalMatrixArray);(d instanceof THREE.ShaderMaterial||d.envMap||d.skinning||e.receiveShadow)&&g.objectMatrix!==
|
|
|
+null&&l.uniformMatrix4fv(g.objectMatrix,!1,e._objectMatrixArray);return f}function z(a,b,c){a._modelViewMatrix.multiplyToArray(b.matrixWorldInverse,a.matrixWorld,a._modelViewMatrixArray);c&&THREE.Matrix4.makeInvert3x3(a._modelViewMatrix).transposeIntoArray(a._normalMatrixArray)}function A(a){if(ia!==a.doubleSided)a.doubleSided?l.disable(l.CULL_FACE):l.enable(l.CULL_FACE),ia=a.doubleSided;if(qa!==a.flipSided)a.flipSided?l.frontFace(l.CW):l.frontFace(l.CCW),qa=a.flipSided}function v(a){oa!==a&&(a?l.enable(l.DEPTH_TEST):
|
|
|
+l.disable(l.DEPTH_TEST),oa=a)}function G(a){ta!==a&&(l.depthMask(a),ta=a)}function F(a,b,c){pa!==a&&(a?l.enable(l.POLYGON_OFFSET_FILL):l.disable(l.POLYGON_OFFSET_FILL),pa=a);if(a&&(Ba!==b||wa!==c))l.polygonOffset(b,c),Ba=b,wa=c}function K(a,b){var c;a==="fragment"?c=l.createShader(l.FRAGMENT_SHADER):a==="vertex"&&(c=l.createShader(l.VERTEX_SHADER));l.shaderSource(c,b);l.compileShader(c);if(!l.getShaderParameter(c,l.COMPILE_STATUS))return console.error(l.getShaderInfoLog(c)),console.error(b),null;
|
|
|
+return c}function s(a,b,c){return(c.width&c.width-1)===0&&(c.height&c.height-1)===0?(l.texParameteri(a,l.TEXTURE_WRAP_S,R(b.wrapS)),l.texParameteri(a,l.TEXTURE_WRAP_T,R(b.wrapT)),l.texParameteri(a,l.TEXTURE_MAG_FILTER,R(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,R(b.minFilter)),!0):(l.texParameteri(a,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),l.texParameteri(a,l.TEXTURE_MAG_FILTER,$(b.magFilter)),l.texParameteri(a,l.TEXTURE_MIN_FILTER,$(b.minFilter)),
|
|
|
+!1)}function N(a,b){l.bindRenderbuffer(l.RENDERBUFFER,a);b.depthBuffer&&!b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_COMPONENT16,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_ATTACHMENT,l.RENDERBUFFER,a)):b.depthBuffer&&b.stencilBuffer?(l.renderbufferStorage(l.RENDERBUFFER,l.DEPTH_STENCIL,b.width,b.height),l.framebufferRenderbuffer(l.FRAMEBUFFER,l.DEPTH_STENCIL_ATTACHMENT,l.RENDERBUFFER,a)):l.renderbufferStorage(l.RENDERBUFFER,l.RGBA4,b.width,b.height)}function U(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=l.createTexture();if(b){a.__webglFramebuffer=[];a.__webglRenderbuffer=[];l.bindTexture(l.TEXTURE_CUBE_MAP,a.__webglTexture);s(l.TEXTURE_CUBE_MAP,a,a);for(var c=0;c<6;c++){a.__webglFramebuffer[c]=l.createFramebuffer();a.__webglRenderbuffer[c]=l.createRenderbuffer();l.texImage2D(l.TEXTURE_CUBE_MAP_POSITIVE_X+c,0,R(a.format),
|
|
|
+a.width,a.height,0,R(a.format),R(a.type),null);var d=a,e=l.TEXTURE_CUBE_MAP_POSITIVE_X+c;l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer[c]);l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,e,d.__webglTexture,0);N(a.__webglRenderbuffer[c],a)}}else a.__webglFramebuffer=l.createFramebuffer(),a.__webglRenderbuffer=l.createRenderbuffer(),l.bindTexture(l.TEXTURE_2D,a.__webglTexture),s(l.TEXTURE_2D,a,a),l.texImage2D(l.TEXTURE_2D,0,R(a.format),a.width,a.height,0,R(a.format),R(a.type),null),
|
|
|
+c=l.TEXTURE_2D,l.bindFramebuffer(l.FRAMEBUFFER,a.__webglFramebuffer),l.framebufferTexture2D(l.FRAMEBUFFER,l.COLOR_ATTACHMENT0,c,a.__webglTexture,0),N(a.__webglRenderbuffer,a);b?l.bindTexture(l.TEXTURE_CUBE_MAP,null):l.bindTexture(l.TEXTURE_2D,null);l.bindRenderbuffer(l.RENDERBUFFER,null);l.bindFramebuffer(l.FRAMEBUFFER,null)}a?(b=b?a.__webglFramebuffer[a.activeCubeFace]:a.__webglFramebuffer,c=a.width,a=a.height,e=d=0):(b=null,c=fa,a=T,d=xa,e=M);b!==ga&&(l.bindFramebuffer(l.FRAMEBUFFER,b),l.viewport(d,
|
|
|
+e,c,a),ga=b)}function $(a){switch(a){case THREE.NearestFilter:case THREE.NearestMipMapNearestFilter:case THREE.NearestMipMapLinearFilter:return l.NEAREST;default:return l.LINEAR}}function R(a){switch(a){case THREE.RepeatWrapping:return l.REPEAT;case THREE.ClampToEdgeWrapping:return l.CLAMP_TO_EDGE;case THREE.MirroredRepeatWrapping:return l.MIRRORED_REPEAT;case THREE.NearestFilter:return l.NEAREST;case THREE.NearestMipMapNearestFilter:return l.NEAREST_MIPMAP_NEAREST;case THREE.NearestMipMapLinearFilter:return l.NEAREST_MIPMAP_LINEAR;
|
|
|
case THREE.LinearFilter:return l.LINEAR;case THREE.LinearMipMapNearestFilter:return l.LINEAR_MIPMAP_NEAREST;case THREE.LinearMipMapLinearFilter:return l.LINEAR_MIPMAP_LINEAR;case THREE.ByteType:return l.BYTE;case THREE.UnsignedByteType:return l.UNSIGNED_BYTE;case THREE.ShortType:return l.SHORT;case THREE.UnsignedShortType:return l.UNSIGNED_SHORT;case THREE.IntType:return l.INT;case THREE.UnsignedShortType:return l.UNSIGNED_INT;case THREE.FloatType:return l.FLOAT;case THREE.AlphaFormat:return l.ALPHA;
|
|
|
-case THREE.RGBFormat:return l.RGB;case THREE.RGBAFormat:return l.RGBA;case THREE.LuminanceFormat:return l.LUMINANCE;case THREE.LuminanceAlphaFormat:return l.LUMINANCE_ALPHA}return 0}var a=a||{},U=a.canvas!==void 0?a.canvas:document.createElement("canvas"),$=a.precision!==void 0?a.precision:"highp",ja=a.antialias!==void 0?a.antialias:!1,K=a.stencil!==void 0?a.stencil:!0,L=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,H=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),
|
|
|
-O=a.clearAlpha!==void 0?a.clearAlpha:0,V=a.maxLights!==void 0?a.maxLights:4;this.domElement=U;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.renderPlugins=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var R=this,l,ca=[],N=null,fa=null,W=-1,ba=null,na=0,ia=null,qa=null,ra=null,oa=null,ta=null,pa=null,Ba=null,wa=null,va=null,xa=0,M=0,ea=0,S=0,ha=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],J=new THREE.Matrix4,P=new Float32Array(16),
|
|
|
-aa=new Float32Array(16),Y=new THREE.Vector4,sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},X,ka=[],da,za;l=function(){var a;try{if(!(a=U.getContext("experimental-webgl",{antialias:ja,stencil:K,preserveDrawingBuffer:L})))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}();
|
|
|
-l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.clearColor(H.r,H.g,H.b,O);(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);da=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});za=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
|
|
|
-vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});da._shadowPass=!0;za._shadowPass=!0})();this.context=l;var ya=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return l};this.supportsVertexTextures=function(){return ya};this.setSize=function(a,b){U.width=a;U.height=b;this.setViewport(0,0,U.width,U.height)};this.setViewport=function(a,b,c,d){xa=a;M=b;ea=c;S=d;l.viewport(xa,M,ea,S)};this.setScissor=function(a,b,c,d){l.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?
|
|
|
-l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColorHex=function(a,b){H.setHex(a);O=b;l.clearColor(H.r,H.g,H.b,O)};this.setClearColor=function(a,b){H.copy(a);O=b;l.clearColor(H.r,H.g,H.b,O)};this.getClearColor=function(){return H};this.getClearAlpha=function(){return O};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=l.COLOR_BUFFER_BIT;if(b===void 0||b)d|=l.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearTarget=function(a,b,c,d){T(a);this.clear(b,
|
|
|
+case THREE.RGBFormat:return l.RGB;case THREE.RGBAFormat:return l.RGBA;case THREE.LuminanceFormat:return l.LUMINANCE;case THREE.LuminanceAlphaFormat:return l.LUMINANCE_ALPHA}return 0}var a=a||{},V=a.canvas!==void 0?a.canvas:document.createElement("canvas"),aa=a.precision!==void 0?a.precision:"highp",ja=a.antialias!==void 0?a.antialias:!1,I=a.stencil!==void 0?a.stencil:!0,L=a.preserveDrawingBuffer!==void 0?a.preserveDrawingBuffer:!1,C=a.clearColor!==void 0?new THREE.Color(a.clearColor):new THREE.Color(0),
|
|
|
+P=a.clearAlpha!==void 0?a.clearAlpha:0,W=a.maxLights!==void 0?a.maxLights:4;this.domElement=V;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.renderPlugins=[];this.info={memory:{programs:0,geometries:0,textures:0},render:{calls:0,vertices:0,faces:0}};var S=this,l,da=[],O=null,ga=null,X=-1,ca=null,na=0,ia=null,qa=null,ra=null,oa=null,ta=null,pa=null,Ba=null,wa=null,va=null,xa=0,M=0,fa=0,T=0,J=[new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4,new THREE.Vector4],H=new THREE.Matrix4,Q=new Float32Array(16),
|
|
|
+ba=new Float32Array(16),Z=new THREE.Vector4,sa={ambient:[0,0,0],directional:{length:0,colors:[],positions:[]},point:{length:0,colors:[],positions:[],distances:[]}},Y,ka=[],ea,za;l=function(){var a;try{if(!(a=V.getContext("experimental-webgl",{antialias:ja,stencil:I,preserveDrawingBuffer:L})))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}();
|
|
|
+l.clearColor(0,0,0,1);l.clearDepth(1);l.clearStencil(0);l.enable(l.DEPTH_TEST);l.depthFunc(l.LEQUAL);l.frontFace(l.CCW);l.cullFace(l.BACK);l.enable(l.CULL_FACE);l.enable(l.BLEND);l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA);l.clearColor(C.r,C.g,C.b,P);(function(){var a=THREE.ShaderLib.depthRGBA,b=THREE.UniformsUtils.clone(a.uniforms);ea=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,vertexShader:a.vertexShader,uniforms:b});za=new THREE.ShaderMaterial({fragmentShader:a.fragmentShader,
|
|
|
+vertexShader:a.vertexShader,uniforms:b,morphTargets:!0});ea._shadowPass=!0;za._shadowPass=!0})();this.context=l;var ya=l.getParameter(l.MAX_VERTEX_TEXTURE_IMAGE_UNITS)>0;this.getContext=function(){return l};this.supportsVertexTextures=function(){return ya};this.setSize=function(a,b){V.width=a;V.height=b;this.setViewport(0,0,V.width,V.height)};this.setViewport=function(a,b,c,d){xa=a;M=b;fa=c;T=d;l.viewport(xa,M,fa,T)};this.setScissor=function(a,b,c,d){l.scissor(a,b,c,d)};this.enableScissorTest=function(a){a?
|
|
|
+l.enable(l.SCISSOR_TEST):l.disable(l.SCISSOR_TEST)};this.setClearColorHex=function(a,b){C.setHex(a);P=b;l.clearColor(C.r,C.g,C.b,P)};this.setClearColor=function(a,b){C.copy(a);P=b;l.clearColor(C.r,C.g,C.b,P)};this.getClearColor=function(){return C};this.getClearAlpha=function(){return P};this.clear=function(a,b,c){var d=0;if(a===void 0||a)d|=l.COLOR_BUFFER_BIT;if(b===void 0||b)d|=l.DEPTH_BUFFER_BIT;if(c===void 0||c)d|=l.STENCIL_BUFFER_BIT;l.clear(d)};this.clearTarget=function(a,b,c,d){U(a);this.clear(b,
|
|
|
c,d)};this.addPlugin=function(a){a.init(this);this.renderPlugins.push(a)};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];l.deleteBuffer(c.__webglVertexBuffer);l.deleteBuffer(c.__webglNormalBuffer);l.deleteBuffer(c.__webglTangentBuffer);l.deleteBuffer(c.__webglColorBuffer);
|
|
|
l.deleteBuffer(c.__webglUVBuffer);l.deleteBuffer(c.__webglUV2Buffer);l.deleteBuffer(c.__webglSkinVertexABuffer);l.deleteBuffer(c.__webglSkinVertexBBuffer);l.deleteBuffer(c.__webglSkinIndicesBuffer);l.deleteBuffer(c.__webglSkinWeightsBuffer);l.deleteBuffer(c.__webglFaceBuffer);l.deleteBuffer(c.__webglLineBuffer);if(c.numMorphTargets)for(var d=0,e=c.numMorphTargets;d<e;d++)l.deleteBuffer(c.__webglMorphTargetsBuffers[d]);if(c.__webglCustomAttributesList)for(d in d=void 0,c.__webglCustomAttributesList)l.deleteBuffer(c.__webglCustomAttributesList[d].buffer);
|
|
|
-R.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),R.info.memory.geometries--};this.deallocateTexture=
|
|
|
-function(a){if(a.__webglInit)a.__webglInit=!1,l.deleteTexture(a.__webglTexture),R.info.memory.textures--};this.updateShadowMap=function(a,b){p(a,b)};this.render=function(a,b,c,d){var e,f,g,h,i=a.lights,n=a.fog;W=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();this.shadowMapEnabled&&this.shadowMapAutoUpdate&&p(a,b);R.info.render.calls=0;R.info.render.vertices=
|
|
|
-0;R.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(aa);b.projectionMatrix.flattenToArray(P);J.multiply(b.projectionMatrix,b.matrixWorldInverse);j(J);T(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh)||!g.frustumCulled||k(g))){g.matrixWorld.flattenToArray(g._objectMatrixArray);A(g,
|
|
|
-b,!0);var M=f,r=M.object,t=M.buffer,u=void 0,u=u=void 0,u=r.material;if(u instanceof THREE.MeshFaceMaterial){if(u=t.materialIndex,u>=0)u=r.geometry.materials[u],u.transparent?(M.transparent=u,M.opaque=null):(M.opaque=u,M.transparent=null)}else if(u)u.transparent?(M.transparent=u,M.opaque=null):(M.opaque=u,M.transparent=null);f.render=!0;if(this.sortObjects)g.renderDepth?f.z=g.renderDepth:(Y.copy(g.position),J.multiplyVector3(Y),f.z=Y.z)}this.sortObjects&&h.sort(o);h=a.__webglObjectsImmediate;d=0;
|
|
|
-for(e=h.length;d<e;d++)if(f=h[d],g=f.object,g.visible)g.matrixAutoUpdate&&g.matrixWorld.flattenToArray(g._objectMatrixArray),A(g,b,!0),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),w(a.overrideMaterial.depthTest),I(a.overrideMaterial.depthWrite),F(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),m(a.__webglObjects,!1,"",
|
|
|
-b,i,n,!0,a.overrideMaterial),q(a.__webglObjectsImmediate,"",b,i,n,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),m(a.__webglObjects,!0,"opaque",b,i,n,!1),q(a.__webglObjectsImmediate,"opaque",b,i,n,!1),m(a.__webglObjects,!1,"transparent",b,i,n,!0),q(a.__webglObjectsImmediate,"transparent",b,i,n,!0));if(this.renderPlugins.length){d=0;for(e=this.renderPlugins.length;d<e;d++)this.renderPlugins[d].render(a,b,ea,S,P),N=null,ba=ta=oa=ra=-1}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==
|
|
|
+S.info.memory.geometries--}else if(a instanceof THREE.Ribbon)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.Line)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--;else if(a instanceof THREE.ParticleSystem)a=a.geometry,l.deleteBuffer(a.__webglVertexBuffer),l.deleteBuffer(a.__webglColorBuffer),S.info.memory.geometries--};this.deallocateTexture=
|
|
|
+function(a){if(a.__webglInit)a.__webglInit=!1,l.deleteTexture(a.__webglTexture),S.info.memory.textures--};this.updateShadowMap=function(a,b){p(a,b)};this.render=function(a,b,c,d){var e,f,g,h,i=a.lights,n=a.fog;X=-1;this.autoUpdateObjects&&this.initWebGLObjects(a);b.parent===void 0&&(console.warn("DEPRECATED: Camera hasn't been added to a Scene. Adding it..."),a.add(b));this.autoUpdateScene&&a.updateMatrixWorld();this.shadowMapEnabled&&this.shadowMapAutoUpdate&&p(a,b);S.info.render.calls=0;S.info.render.vertices=
|
|
|
+0;S.info.render.faces=0;b.matrixWorldInverse.getInverse(b.matrixWorld);b.matrixWorldInverse.flattenToArray(ba);b.projectionMatrix.flattenToArray(Q);H.multiply(b.projectionMatrix,b.matrixWorldInverse);j(H);U(c);(this.autoClear||d)&&this.clear(this.autoClearColor,this.autoClearDepth,this.autoClearStencil);h=a.__webglObjects;d=0;for(e=h.length;d<e;d++)if(f=h[d],g=f.object,f.render=!1,g.visible&&(!(g instanceof THREE.Mesh)||!g.frustumCulled||k(g))){g.matrixWorld.flattenToArray(g._objectMatrixArray);z(g,
|
|
|
+b,!0);var M=f,r=M.object,t=M.buffer,u=void 0,u=u=void 0,u=r.material;if(u instanceof THREE.MeshFaceMaterial){if(u=t.materialIndex,u>=0)u=r.geometry.materials[u],u.transparent?(M.transparent=u,M.opaque=null):(M.opaque=u,M.transparent=null)}else if(u)u.transparent?(M.transparent=u,M.opaque=null):(M.opaque=u,M.transparent=null);f.render=!0;if(this.sortObjects)g.renderDepth?f.z=g.renderDepth:(Z.copy(g.position),H.multiplyVector3(Z),f.z=Z.z)}this.sortObjects&&h.sort(o);h=a.__webglObjectsImmediate;d=0;
|
|
|
+for(e=h.length;d<e;d++)if(f=h[d],g=f.object,g.visible)g.matrixAutoUpdate&&g.matrixWorld.flattenToArray(g._objectMatrixArray),z(g,b,!0),g=f.object.material,g.transparent?(f.transparent=g,f.opaque=null):(f.opaque=g,f.transparent=null);a.overrideMaterial?(this.setBlending(a.overrideMaterial.blending),v(a.overrideMaterial.depthTest),G(a.overrideMaterial.depthWrite),F(a.overrideMaterial.polygonOffset,a.overrideMaterial.polygonOffsetFactor,a.overrideMaterial.polygonOffsetUnits),m(a.__webglObjects,!1,"",
|
|
|
+b,i,n,!0,a.overrideMaterial),q(a.__webglObjectsImmediate,"",b,i,n,!1,a.overrideMaterial)):(this.setBlending(THREE.NormalBlending),m(a.__webglObjects,!0,"opaque",b,i,n,!1),q(a.__webglObjectsImmediate,"opaque",b,i,n,!1),m(a.__webglObjects,!1,"transparent",b,i,n,!0),q(a.__webglObjectsImmediate,"transparent",b,i,n,!0));if(this.renderPlugins.length){d=0;for(e=this.renderPlugins.length;d<e;d++)this.renderPlugins[d].render(a,b,fa,T,Q),O=null,ca=ta=oa=ra=-1}c&&c.minFilter!==THREE.NearestFilter&&c.minFilter!==
|
|
|
THREE.LinearFilter&&(c instanceof THREE.WebGLRenderTargetCube?(l.bindTexture(l.TEXTURE_CUBE_MAP,c.__webglTexture),l.generateMipmap(l.TEXTURE_CUBE_MAP),l.bindTexture(l.TEXTURE_CUBE_MAP,null)):(l.bindTexture(l.TEXTURE_2D,c.__webglTexture),l.generateMipmap(l.TEXTURE_2D),l.bindTexture(l.TEXTURE_2D,null)))};this.initWebGLObjects=function(a){if(!a.__webglObjects)a.__webglObjects=[],a.__webglObjectsImmediate=[],a.__webglSprites=[],a.__webglFlares=[];for(;a.__objectsAdded.length;){var h=a.__objectsAdded[0],
|
|
|
-i=a,k=void 0,m=void 0,j=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){m=h.geometry;if(m.geometryGroups===void 0){var j=m,o=void 0,p=void 0,M=void 0,q=void 0,S=void 0,ea=void 0,s=void 0,v={},ha=j.morphTargets.length;j.geometryGroups={};o=0;for(p=j.faces.length;o<
|
|
|
-p;o++)M=j.faces[o],q=M.materialIndex,ea=q!==void 0?q:-1,v[ea]===void 0&&(v[ea]={hash:ea,counter:0}),s=v[ea].hash+"_"+v[ea].counter,j.geometryGroups[s]===void 0&&(j.geometryGroups[s]={faces3:[],faces4:[],materialIndex:q,vertices:0,numMorphTargets:ha}),S=M instanceof THREE.Face3?3:4,j.geometryGroups[s].vertices+S>65535&&(v[ea].counter+=1,s=v[ea].hash+"_"+v[ea].counter,j.geometryGroups[s]===void 0&&(j.geometryGroups[s]={faces3:[],faces4:[],materialIndex:q,vertices:0,numMorphTargets:ha})),M instanceof
|
|
|
-THREE.Face3?j.geometryGroups[s].faces3.push(o):j.geometryGroups[s].faces4.push(o),j.geometryGroups[s].vertices+=S;j.geometryGroupsList=[];o=void 0;for(o in j.geometryGroups)j.geometryGroups[o].id=na++,j.geometryGroupsList.push(j.geometryGroups[o])}for(k in m.geometryGroups)if(j=m.geometryGroups[k],!j.__webglVertexBuffer){o=j;o.__webglVertexBuffer=l.createBuffer();o.__webglNormalBuffer=l.createBuffer();o.__webglTangentBuffer=l.createBuffer();o.__webglColorBuffer=l.createBuffer();o.__webglUVBuffer=
|
|
|
-l.createBuffer();o.__webglUV2Buffer=l.createBuffer();o.__webglSkinVertexABuffer=l.createBuffer();o.__webglSkinVertexBBuffer=l.createBuffer();o.__webglSkinIndicesBuffer=l.createBuffer();o.__webglSkinWeightsBuffer=l.createBuffer();o.__webglFaceBuffer=l.createBuffer();o.__webglLineBuffer=l.createBuffer();if(o.numMorphTargets){M=p=void 0;o.__webglMorphTargetsBuffers=[];p=0;for(M=o.numMorphTargets;p<M;p++)o.__webglMorphTargetsBuffers.push(l.createBuffer())}R.info.memory.geometries++;q=h;S=q.geometry;p=
|
|
|
-j.faces3;ea=j.faces4;o=p.length*3+ea.length*4;M=p.length*1+ea.length*2;ea=p.length*3+ea.length*4;p=c(q,j);s=g(p);v=d(p);ha=e(p);j.__vertexArray=new Float32Array(o*3);if(v)j.__normalArray=new Float32Array(o*3);if(S.hasTangents)j.__tangentArray=new Float32Array(o*4);if(ha)j.__colorArray=new Float32Array(o*3);if(s){if(S.faceUvs.length>0||S.faceVertexUvs.length>0)j.__uvArray=new Float32Array(o*2);if(S.faceUvs.length>1||S.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(o*2)}if(q.geometry.skinWeights.length&&
|
|
|
-q.geometry.skinIndices.length)j.__skinVertexAArray=new Float32Array(o*4),j.__skinVertexBArray=new Float32Array(o*4),j.__skinIndexArray=new Float32Array(o*4),j.__skinWeightArray=new Float32Array(o*4);j.__faceArray=new Uint16Array(M*3);j.__lineArray=new Uint16Array(ea*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];q=0;for(S=j.numMorphTargets;q<S;q++)j.__morphTargetsArrays.push(new Float32Array(o*3))}j.__webglFaceCount=M*3;j.__webglLineCount=ea*2;if(p.attributes){if(j.__webglCustomAttributesList===
|
|
|
-void 0)j.__webglCustomAttributesList=[];M=void 0;for(M in p.attributes){var q=p.attributes[M],S={},G;for(G in q)S[G]=q[G];if(!S.__webglInitialized||S.createUniqueBuffers)S.__webglInitialized=!0,ea=1,S.type==="v2"?ea=2:S.type==="v3"?ea=3:S.type==="v4"?ea=4:S.type==="c"&&(ea=3),S.size=ea,S.array=new Float32Array(o*ea),S.buffer=l.createBuffer(),S.buffer.belongsToAttribute=M,q.needsUpdate=!0,S.__original=q;j.__webglCustomAttributesList.push(S)}}j.__inittedArrays=!0;m.__dirtyVertices=!0;m.__dirtyMorphTargets=
|
|
|
-!0;m.__dirtyElements=!0;m.__dirtyUvs=!0;m.__dirtyNormals=!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}}else if(h instanceof THREE.Ribbon){if(m=h.geometry,!m.__webglVertexBuffer)j=m,j.__webglVertexBuffer=l.createBuffer(),j.__webglColorBuffer=l.createBuffer(),R.info.memory.geometries++,j=m,o=j.vertices.length,j.__vertexArray=new Float32Array(o*3),j.__colorArray=new Float32Array(o*3),j.__webglVertexCount=o,m.__dirtyVertices=!0,m.__dirtyColors=!0}else if(h instanceof THREE.Line){if(m=h.geometry,!m.__webglVertexBuffer)j=
|
|
|
-m,j.__webglVertexBuffer=l.createBuffer(),j.__webglColorBuffer=l.createBuffer(),R.info.memory.geometries++,j=m,o=h,p=j.vertices.length,j.__vertexArray=new Float32Array(p*3),j.__colorArray=new Float32Array(p*3),j.__webglLineCount=p,b(j,o),m.__dirtyVertices=!0,m.__dirtyColors=!0}else if(h instanceof THREE.ParticleSystem&&(m=h.geometry,!m.__webglVertexBuffer))j=m,j.__webglVertexBuffer=l.createBuffer(),j.__webglColorBuffer=l.createBuffer(),R.info.geometries++,j=m,o=h,p=j.vertices.length,j.__vertexArray=
|
|
|
-new Float32Array(p*3),j.__colorArray=new Float32Array(p*3),j.__sortArray=[],j.__webglParticleCount=p,b(j,o),m.__dirtyVertices=!0,m.__dirtyColors=!0;if(!h.__webglActive){if(h instanceof THREE.Mesh)for(k in m=h.geometry,m.geometryGroups)j=m.geometryGroups[k],n(i.__webglObjects,j,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(m=h.geometry,n(i.__webglObjects,m,h)):THREE.MarchingCubes!==void 0&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?
|
|
|
-i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):h instanceof THREE.Sprite?i.__webglSprites.push(h):h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)h=a.__objectsRemoved[0],i=a,h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem||h instanceof THREE.Ribbon||h instanceof THREE.Line?u(i.__webglObjects,h):h instanceof THREE.Sprite?y(i.__webglSprites,h):h instanceof THREE.LensFlare?y(i.__webglFlares,
|
|
|
-h):(h instanceof THREE.MarchingCubes||h.immediateRenderCallback)&&u(i.__webglObjectsImmediate,h),h.__webglActive=!1,a.__objectsRemoved.splice(0,1);h=0;for(i=a.__webglObjects.length;h<i;h++)if(G=a.__webglObjects[h].object,k=G.geometry,m=M=p=void 0,G instanceof THREE.Mesh){j=0;for(o=k.geometryGroupsList.length;j<o;j++)if(p=k.geometryGroupsList[j],m=c(G,p),M=m.attributes&&r(m),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||
|
|
|
-M){var E=G,M=l.DYNAMIC_DRAW,q=!k.dynamic,s=m;if(p.__inittedArrays){var S=d(s),ea=e(s),T=g(s),H=S===THREE.SmoothShading,z=v=s=void 0,C=void 0,A=void 0,L=void 0,D=void 0,O=void 0,F=void 0,I=z=void 0,w=void 0,J=void 0,P=void 0,K=C=void 0,U=void 0,V=void 0,Q=C=F=void 0,aa=void 0,Z=P=J=w=D=void 0,Y=C=P=J=w=Z=P=J=w=Z=P=J=w=void 0,N=void 0,$=L=void 0,ca=void 0,X=void 0,fa=void 0,W=void 0,ba=I=X=N=0,ja=0,sa=Y=z=0,da=D=K=0,B=0,ka=void 0,da=p.__vertexArray,ca=p.__uvArray,B=p.__uv2Array,$=p.__normalArray,A=
|
|
|
-p.__tangentArray,U=p.__colorArray,Q=p.__skinVertexAArray,aa=p.__skinVertexBArray,O=p.__skinIndexArray,ia=p.__skinWeightArray,Z=p.__morphTargetsArrays,ha=p.__webglCustomAttributesList,x=void 0,x=p.__faceArray,ka=p.__lineArray,V=E.geometry,ya=V.__dirtyElements,qa=V.__dirtyUvs,L=V.__dirtyNormals,F=V.__dirtyTangents,ra=V.__dirtyColors,fa=V.__dirtyMorphTargets,W=V.vertices,E=p.faces3,la=p.faces4,ma=V.faces,pa=V.faceVertexUvs[0],ta=V.faceVertexUvs[1],oa=V.skinVerticesA,za=V.skinVerticesB,va=V.skinIndices,
|
|
|
-wa=V.skinWeights,xa=V.morphTargets;if(V.__dirtyVertices){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],w=W[C.a].position,J=W[C.b].position,P=W[C.c].position,da[X]=w.x,da[X+1]=w.y,da[X+2]=w.z,da[X+3]=J.x,da[X+4]=J.y,da[X+5]=J.z,da[X+6]=P.x,da[X+7]=P.y,da[X+8]=P.z,X+=9;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],w=W[C.a].position,J=W[C.b].position,P=W[C.c].position,C=W[C.d].position,da[X]=w.x,da[X+1]=w.y,da[X+2]=w.z,da[X+3]=J.x,da[X+4]=J.y,da[X+5]=J.z,da[X+6]=P.x,da[X+7]=P.y,da[X+8]=P.z,da[X+9]=C.x,da[X+10]=C.y,
|
|
|
-da[X+11]=C.z,X+=12;l.bindBuffer(l.ARRAY_BUFFER,p.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,da,M)}if(fa){X=0;for(fa=xa.length;X<fa;X++){s=da=0;for(v=E.length;s<v;s++)C=ma[E[s]],w=xa[X].vertices[C.a].position,J=xa[X].vertices[C.b].position,P=xa[X].vertices[C.c].position,W=Z[X],W[da]=w.x,W[da+1]=w.y,W[da+2]=w.z,W[da+3]=J.x,W[da+4]=J.y,W[da+5]=J.z,W[da+6]=P.x,W[da+7]=P.y,W[da+8]=P.z,da+=9;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],w=xa[X].vertices[C.a].position,J=xa[X].vertices[C.b].position,P=xa[X].vertices[C.c].position,
|
|
|
-C=xa[X].vertices[C.d].position,W=Z[X],W[da]=w.x,W[da+1]=w.y,W[da+2]=w.z,W[da+3]=J.x,W[da+4]=J.y,W[da+5]=J.z,W[da+6]=P.x,W[da+7]=P.y,W[da+8]=P.z,W[da+9]=C.x,W[da+10]=C.y,W[da+11]=C.z,da+=12;l.bindBuffer(l.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[X]);l.bufferData(l.ARRAY_BUFFER,Z[X],M)}}if(wa.length){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],w=wa[C.a],J=wa[C.b],P=wa[C.c],ia[D]=w.x,ia[D+1]=w.y,ia[D+2]=w.z,ia[D+3]=w.w,ia[D+4]=J.x,ia[D+5]=J.y,ia[D+6]=J.z,ia[D+7]=J.w,ia[D+8]=P.x,ia[D+9]=P.y,ia[D+10]=P.z,ia[D+
|
|
|
-11]=P.w,w=va[C.a],J=va[C.b],P=va[C.c],O[D]=w.x,O[D+1]=w.y,O[D+2]=w.z,O[D+3]=w.w,O[D+4]=J.x,O[D+5]=J.y,O[D+6]=J.z,O[D+7]=J.w,O[D+8]=P.x,O[D+9]=P.y,O[D+10]=P.z,O[D+11]=P.w,w=oa[C.a],J=oa[C.b],P=oa[C.c],Q[D]=w.x,Q[D+1]=w.y,Q[D+2]=w.z,Q[D+3]=1,Q[D+4]=J.x,Q[D+5]=J.y,Q[D+6]=J.z,Q[D+7]=1,Q[D+8]=P.x,Q[D+9]=P.y,Q[D+10]=P.z,Q[D+11]=1,w=za[C.a],J=za[C.b],P=za[C.c],aa[D]=w.x,aa[D+1]=w.y,aa[D+2]=w.z,aa[D+3]=1,aa[D+4]=J.x,aa[D+5]=J.y,aa[D+6]=J.z,aa[D+7]=1,aa[D+8]=P.x,aa[D+9]=P.y,aa[D+10]=P.z,aa[D+11]=1,D+=12;s=
|
|
|
-0;for(v=la.length;s<v;s++)C=ma[la[s]],w=wa[C.a],J=wa[C.b],P=wa[C.c],Z=wa[C.d],ia[D]=w.x,ia[D+1]=w.y,ia[D+2]=w.z,ia[D+3]=w.w,ia[D+4]=J.x,ia[D+5]=J.y,ia[D+6]=J.z,ia[D+7]=J.w,ia[D+8]=P.x,ia[D+9]=P.y,ia[D+10]=P.z,ia[D+11]=P.w,ia[D+12]=Z.x,ia[D+13]=Z.y,ia[D+14]=Z.z,ia[D+15]=Z.w,w=va[C.a],J=va[C.b],P=va[C.c],Z=va[C.d],O[D]=w.x,O[D+1]=w.y,O[D+2]=w.z,O[D+3]=w.w,O[D+4]=J.x,O[D+5]=J.y,O[D+6]=J.z,O[D+7]=J.w,O[D+8]=P.x,O[D+9]=P.y,O[D+10]=P.z,O[D+11]=P.w,O[D+12]=Z.x,O[D+13]=Z.y,O[D+14]=Z.z,O[D+15]=Z.w,w=oa[C.a],
|
|
|
-J=oa[C.b],P=oa[C.c],Z=oa[C.d],Q[D]=w.x,Q[D+1]=w.y,Q[D+2]=w.z,Q[D+3]=1,Q[D+4]=J.x,Q[D+5]=J.y,Q[D+6]=J.z,Q[D+7]=1,Q[D+8]=P.x,Q[D+9]=P.y,Q[D+10]=P.z,Q[D+11]=1,Q[D+12]=Z.x,Q[D+13]=Z.y,Q[D+14]=Z.z,Q[D+15]=1,w=za[C.a],J=za[C.b],P=za[C.c],C=za[C.d],aa[D]=w.x,aa[D+1]=w.y,aa[D+2]=w.z,aa[D+3]=1,aa[D+4]=J.x,aa[D+5]=J.y,aa[D+6]=J.z,aa[D+7]=1,aa[D+8]=P.x,aa[D+9]=P.y,aa[D+10]=P.z,aa[D+11]=1,aa[D+12]=C.x,aa[D+13]=C.y,aa[D+14]=C.z,aa[D+15]=1,D+=16;D>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinVertexABuffer),l.bufferData(l.ARRAY_BUFFER,
|
|
|
-Q,M),l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),l.bufferData(l.ARRAY_BUFFER,aa,M),l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,O,M),l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,ia,M))}if(ra&&ea){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],D=C.vertexColors,O=C.color,D.length===3&&ea===THREE.VertexColors?(C=D[0],Q=D[1],aa=D[2]):aa=Q=C=O,U[K]=C.r,U[K+1]=C.g,U[K+2]=C.b,U[K+3]=Q.r,U[K+4]=Q.g,U[K+5]=Q.b,U[K+6]=aa.r,U[K+
|
|
|
-7]=aa.g,U[K+8]=aa.b,K+=9;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],D=C.vertexColors,O=C.color,D.length===4&&ea===THREE.VertexColors?(C=D[0],Q=D[1],aa=D[2],D=D[3]):D=aa=Q=C=O,U[K]=C.r,U[K+1]=C.g,U[K+2]=C.b,U[K+3]=Q.r,U[K+4]=Q.g,U[K+5]=Q.b,U[K+6]=aa.r,U[K+7]=aa.g,U[K+8]=aa.b,U[K+9]=D.r,U[K+10]=D.g,U[K+11]=D.b,K+=12;K>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,U,M))}if(F&&V.hasTangents){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],F=C.vertexTangents,K=F[0],U=F[1],V=F[2],
|
|
|
-A[Y]=K.x,A[Y+1]=K.y,A[Y+2]=K.z,A[Y+3]=K.w,A[Y+4]=U.x,A[Y+5]=U.y,A[Y+6]=U.z,A[Y+7]=U.w,A[Y+8]=V.x,A[Y+9]=V.y,A[Y+10]=V.z,A[Y+11]=V.w,Y+=12;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],F=C.vertexTangents,K=F[0],U=F[1],V=F[2],F=F[3],A[Y]=K.x,A[Y+1]=K.y,A[Y+2]=K.z,A[Y+3]=K.w,A[Y+4]=U.x,A[Y+5]=U.y,A[Y+6]=U.z,A[Y+7]=U.w,A[Y+8]=V.x,A[Y+9]=V.y,A[Y+10]=V.z,A[Y+11]=V.w,A[Y+12]=F.x,A[Y+13]=F.y,A[Y+14]=F.z,A[Y+15]=F.w,Y+=16;l.bindBuffer(l.ARRAY_BUFFER,p.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,A,M)}if(L&&
|
|
|
-S){s=0;for(v=E.length;s<v;s++)if(C=ma[E[s]],A=C.vertexNormals,L=C.normal,A.length===3&&H)for(Y=0;Y<3;Y++)L=A[Y],$[z]=L.x,$[z+1]=L.y,$[z+2]=L.z,z+=3;else for(Y=0;Y<3;Y++)$[z]=L.x,$[z+1]=L.y,$[z+2]=L.z,z+=3;s=0;for(v=la.length;s<v;s++)if(C=ma[la[s]],A=C.vertexNormals,L=C.normal,A.length===4&&H)for(Y=0;Y<4;Y++)L=A[Y],$[z]=L.x,$[z+1]=L.y,$[z+2]=L.z,z+=3;else for(Y=0;Y<4;Y++)$[z]=L.x,$[z+1]=L.y,$[z+2]=L.z,z+=3;l.bindBuffer(l.ARRAY_BUFFER,p.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,$,M)}if(qa&&pa&&
|
|
|
-T){s=0;for(v=E.length;s<v;s++)if(z=E[s],z=pa[z],z!==void 0)for(Y=0;Y<3;Y++)$=z[Y],ca[I]=$.u,ca[I+1]=$.v,I+=2;s=0;for(v=la.length;s<v;s++)if(z=la[s],z=pa[z],z!==void 0)for(Y=0;Y<4;Y++)$=z[Y],ca[I]=$.u,ca[I+1]=$.v,I+=2;I>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,ca,M))}if(qa&&ta&&T){s=0;for(v=E.length;s<v;s++)if(z=E[s],I=ta[z],I!==void 0)for(Y=0;Y<3;Y++)ca=I[Y],B[ba]=ca.u,B[ba+1]=ca.v,ba+=2;s=0;for(v=la.length;s<v;s++)if(z=la[s],I=ta[z],I!==void 0)for(Y=0;Y<4;Y++)ca=
|
|
|
-I[Y],B[ba]=ca.u,B[ba+1]=ca.v,ba+=2;ba>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,B,M))}if(ya){s=0;for(v=E.length;s<v;s++)x[ja]=N,x[ja+1]=N+1,x[ja+2]=N+2,ja+=3,ka[sa]=N,ka[sa+1]=N+1,ka[sa+2]=N,ka[sa+3]=N+2,ka[sa+4]=N+1,ka[sa+5]=N+2,sa+=6,N+=3;s=0;for(v=la.length;s<v;s++)x[ja]=N,x[ja+1]=N+1,x[ja+2]=N+3,x[ja+3]=N+1,x[ja+4]=N+2,x[ja+5]=N+3,ja+=6,ka[sa]=N,ka[sa+1]=N+1,ka[sa+2]=N,ka[sa+3]=N+3,ka[sa+4]=N+1,ka[sa+5]=N+2,ka[sa+6]=N+2,ka[sa+7]=N+3,sa+=8,N+=4;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,
|
|
|
-p.__webglFaceBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,x,M);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,ka,M)}if(ha){Y=0;for(N=ha.length;Y<N;Y++)if(x=ha[Y],x.__original.needsUpdate){B=0;if(x.size===1)if(x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],x.array[B]=x.value[C.a],x.array[B+1]=x.value[C.b],x.array[B+2]=x.value[C.c],B+=3;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],x.array[B]=x.value[C.a],x.array[B+1]=x.value[C.b],
|
|
|
-x.array[B+2]=x.value[C.c],x.array[B+3]=x.value[C.d],B+=4}else{if(x.boundTo==="faces"){s=0;for(v=E.length;s<v;s++)ka=x.value[E[s]],x.array[B]=ka,x.array[B+1]=ka,x.array[B+2]=ka,B+=3;s=0;for(v=la.length;s<v;s++)ka=x.value[la[s]],x.array[B]=ka,x.array[B+1]=ka,x.array[B+2]=ka,x.array[B+3]=ka,B+=4}}else if(x.size===2)if(x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],w=x.value[C.a],J=x.value[C.b],P=x.value[C.c],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=J.x,x.array[B+
|
|
|
-3]=J.y,x.array[B+4]=P.x,x.array[B+5]=P.y,B+=6;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],w=x.value[C.a],J=x.value[C.b],P=x.value[C.c],C=x.value[C.d],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=J.x,x.array[B+3]=J.y,x.array[B+4]=P.x,x.array[B+5]=P.y,x.array[B+6]=C.x,x.array[B+7]=C.y,B+=8}else{if(x.boundTo==="faces"){s=0;for(v=E.length;s<v;s++)P=J=w=ka=x.value[E[s]],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=J.x,x.array[B+3]=J.y,x.array[B+4]=P.x,x.array[B+5]=P.y,B+=6;s=0;for(v=la.length;s<v;s++)C=P=
|
|
|
-J=w=ka=x.value[la[s]],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=J.x,x.array[B+3]=J.y,x.array[B+4]=P.x,x.array[B+5]=P.y,x.array[B+6]=C.x,x.array[B+7]=C.y,B+=8}}else if(x.size===3)if(S=x.type==="c"?["r","g","b"]:["x","y","z"],x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],w=x.value[C.a],J=x.value[C.b],P=x.value[C.c],x.array[B]=w[S[0]],x.array[B+1]=w[S[1]],x.array[B+2]=w[S[2]],x.array[B+3]=J[S[0]],x.array[B+4]=J[S[1]],x.array[B+5]=J[S[2]],x.array[B+6]=P[S[0]],x.array[B+
|
|
|
-7]=P[S[1]],x.array[B+8]=P[S[2]],B+=9;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],w=x.value[C.a],J=x.value[C.b],P=x.value[C.c],C=x.value[C.d],x.array[B]=w[S[0]],x.array[B+1]=w[S[1]],x.array[B+2]=w[S[2]],x.array[B+3]=J[S[0]],x.array[B+4]=J[S[1]],x.array[B+5]=J[S[2]],x.array[B+6]=P[S[0]],x.array[B+7]=P[S[1]],x.array[B+8]=P[S[2]],x.array[B+9]=C[S[0]],x.array[B+10]=C[S[1]],x.array[B+11]=C[S[2]],B+=12}else{if(x.boundTo==="faces"){s=0;for(v=E.length;s<v;s++)P=J=w=ka=x.value[E[s]],x.array[B]=w[S[0]],x.array[B+
|
|
|
-1]=w[S[1]],x.array[B+2]=w[S[2]],x.array[B+3]=J[S[0]],x.array[B+4]=J[S[1]],x.array[B+5]=J[S[2]],x.array[B+6]=P[S[0]],x.array[B+7]=P[S[1]],x.array[B+8]=P[S[2]],B+=9;s=0;for(v=la.length;s<v;s++)C=P=J=w=ka=x.value[la[s]],x.array[B]=w[S[0]],x.array[B+1]=w[S[1]],x.array[B+2]=w[S[2]],x.array[B+3]=J[S[0]],x.array[B+4]=J[S[1]],x.array[B+5]=J[S[2]],x.array[B+6]=P[S[0]],x.array[B+7]=P[S[1]],x.array[B+8]=P[S[2]],x.array[B+9]=C[S[0]],x.array[B+10]=C[S[1]],x.array[B+11]=C[S[2]],B+=12}}else if(x.size===4)if(x.boundTo===
|
|
|
-void 0||x.boundTo==="vertices"){s=0;for(v=E.length;s<v;s++)C=ma[E[s]],w=x.value[C.a],J=x.value[C.b],P=x.value[C.c],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=w.z,x.array[B+3]=w.w,x.array[B+4]=J.x,x.array[B+5]=J.y,x.array[B+6]=J.z,x.array[B+7]=J.w,x.array[B+8]=P.x,x.array[B+9]=P.y,x.array[B+10]=P.z,x.array[B+11]=P.w,B+=12;s=0;for(v=la.length;s<v;s++)C=ma[la[s]],w=x.value[C.a],J=x.value[C.b],P=x.value[C.c],C=x.value[C.d],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=w.z,x.array[B+3]=w.w,x.array[B+
|
|
|
-4]=J.x,x.array[B+5]=J.y,x.array[B+6]=J.z,x.array[B+7]=J.w,x.array[B+8]=P.x,x.array[B+9]=P.y,x.array[B+10]=P.z,x.array[B+11]=P.w,x.array[B+12]=C.x,x.array[B+13]=C.y,x.array[B+14]=C.z,x.array[B+15]=C.w,B+=16}else if(x.boundTo==="faces"){s=0;for(v=E.length;s<v;s++)P=J=w=ka=x.value[E[s]],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=w.z,x.array[B+3]=w.w,x.array[B+4]=J.x,x.array[B+5]=J.y,x.array[B+6]=J.z,x.array[B+7]=J.w,x.array[B+8]=P.x,x.array[B+9]=P.y,x.array[B+10]=P.z,x.array[B+11]=P.w,B+=12;s=0;for(v=
|
|
|
-la.length;s<v;s++)C=P=J=w=ka=x.value[la[s]],x.array[B]=w.x,x.array[B+1]=w.y,x.array[B+2]=w.z,x.array[B+3]=w.w,x.array[B+4]=J.x,x.array[B+5]=J.y,x.array[B+6]=J.z,x.array[B+7]=J.w,x.array[B+8]=P.x,x.array[B+9]=P.y,x.array[B+10]=P.z,x.array[B+11]=P.w,x.array[B+12]=C.x,x.array[B+13]=C.y,x.array[B+14]=C.z,x.array[B+15]=C.w,B+=16}l.bindBuffer(l.ARRAY_BUFFER,x.buffer);l.bufferData(l.ARRAY_BUFFER,x.array,M)}}q&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,
|
|
|
-delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyColors=!1;k.__dirtyTangents=!1;m.attributes&&t(m)}else if(G instanceof THREE.Ribbon){if(k.__dirtyVertices||k.__dirtyColors){m=k;G=l.DYNAMIC_DRAW;S=j=S=q=q=void 0;ea=m.vertices;
|
|
|
-o=m.colors;s=ea.length;p=o.length;v=m.__vertexArray;M=m.__colorArray;ha=m.__dirtyColors;if(m.__dirtyVertices){for(q=0;q<s;q++)S=ea[q].position,j=q*3,v[j]=S.x,v[j+1]=S.y,v[j+2]=S.z;l.bindBuffer(l.ARRAY_BUFFER,m.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,v,G)}if(ha){for(q=0;q<p;q++)S=o[q],j=q*3,M[j]=S.r,M[j+1]=S.g,M[j+2]=S.b;l.bindBuffer(l.ARRAY_BUFFER,m.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,M,G)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(G instanceof THREE.Line){m=c(G,p);M=m.attributes&&
|
|
|
-r(m);if(k.__dirtyVertices||k.__dirtyColors||M){G=k;j=l.DYNAMIC_DRAW;s=o=H=ea=T=void 0;ea=G.vertices;p=G.colors;s=ea.length;M=p.length;v=G.__vertexArray;q=G.__colorArray;ha=G.__dirtyColors;S=G.__webglCustomAttributesList;N=ma=la=E=H=T=void 0;if(G.__dirtyVertices){for(T=0;T<s;T++)H=ea[T].position,o=T*3,v[o]=H.x,v[o+1]=H.y,v[o+2]=H.z;l.bindBuffer(l.ARRAY_BUFFER,G.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,v,j)}if(ha){for(ea=0;ea<M;ea++)s=p[ea],o=ea*3,q[o]=s.r,q[o+1]=s.g,q[o+2]=s.b;l.bindBuffer(l.ARRAY_BUFFER,
|
|
|
-G.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,q,j)}if(S){T=0;for(H=S.length;T<H;T++)if(N=S[T],N.needsUpdate&&(N.boundTo===void 0||N.boundTo==="vertices")){o=0;la=N.value.length;if(N.size===1)for(E=0;E<la;E++)N.array[E]=N.value[E];else if(N.size===2)for(E=0;E<la;E++)ma=N.value[E],N.array[o]=ma.x,N.array[o+1]=ma.y,o+=2;else if(N.size===3)if(N.type==="c")for(E=0;E<la;E++)ma=N.value[E],N.array[o]=ma.r,N.array[o+1]=ma.g,N.array[o+2]=ma.b,o+=3;else for(E=0;E<la;E++)ma=N.value[E],N.array[o]=ma.x,N.array[o+
|
|
|
-1]=ma.y,N.array[o+2]=ma.z,o+=3;else if(N.size===4)for(E=0;E<la;E++)ma=N.value[E],N.array[o]=ma.x,N.array[o+1]=ma.y,N.array[o+2]=ma.z,N.array[o+3]=ma.w,o+=4;l.bindBuffer(l.ARRAY_BUFFER,N.buffer);l.bufferData(l.ARRAY_BUFFER,N.array,j)}}}k.__dirtyVertices=!1;k.__dirtyColors=!1;m.attributes&&t(m)}else if(G instanceof THREE.ParticleSystem)m=c(G,p),M=m.attributes&&r(m),(k.__dirtyVertices||k.__dirtyColors||G.sortParticles||M)&&f(k,l.DYNAMIC_DRAW,G),k.__dirtyVertices=!1,k.__dirtyColors=!1,m.attributes&&t(m)};
|
|
|
-this.initMaterial=function(a,b,c,d){var e,f,g,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 j,m,k;j=k=i=0;for(m=b.length;j<m;j++)g=b[j],g instanceof THREE.SpotLight&&k++,g instanceof THREE.DirectionalLight&&k++,g instanceof THREE.PointLight&&i++;i+k<=V?j=k:(j=Math.ceil(V*k/(i+k)),i=V-j);g={directional:j,point:i};i=k=0;for(j=b.length;i<j;i++)m=b[i],m instanceof THREE.SpotLight&&m.castShadow&&k++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{j=a.fragmentShader;m=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:g.directional,maxPointLights:g.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:k,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=
|
|
|
-[];h?d.push(h):(d.push(j),d.push(m));for(p in c)d.push(p),d.push(c[p]);h=d.join();p=0;for(d=ca.length;p<d;p++)if(ca[p].code===h){o=ca[p].program;break a}p=l.createProgram();d=[ya?"#define VERTEX_TEXTURES":"",R.gammaInput?"#define GAMMA_INPUT":"",R.gammaOutput?"#define GAMMA_OUTPUT":"",R.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");
|
|
|
-g=["#ifdef GL_ES","precision "+$+" 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:"",R.gammaInput?"#define GAMMA_INPUT":"",R.gammaOutput?"#define GAMMA_OUTPUT":"",R.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");l.attachShader(p,G("fragment",g+j));l.attachShader(p,
|
|
|
-G("vertex",d+m));l.linkProgram(p);l.getProgramParameter(p,l.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+l.getProgramParameter(p,l.VALIDATE_STATUS)+", gl error ["+l.getError()+"]");p.uniforms={};p.attributes={};var M,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(M in i)d.push(M);M=d;d=0;for(i=M.length;d<i;d++)j=M[d],p.uniforms[j]=l.getUniformLocation(p,
|
|
|
-j);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(M=0;M<c.maxMorphTargets;M++)d.push("morphTarget"+M);for(o in b)d.push(o);o=d;M=0;for(b=o.length;M<b;M++)c=o[M],p.attributes[c]=l.getAttribLocation(p,c);p.id=ca.length;ca.push({program:p,code:h});R.info.memory.programs=ca.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&l.enableVertexAttribArray(o.position);o.color>=0&&l.enableVertexAttribArray(o.color);o.normal>=0&&l.enableVertexAttribArray(o.normal);
|
|
|
+i=a,k=void 0,m=void 0,j=void 0;if(!h.__webglInit)if(h.__webglInit=!0,h._modelViewMatrix=new THREE.Matrix4,h._normalMatrixArray=new Float32Array(9),h._modelViewMatrixArray=new Float32Array(16),h._objectMatrixArray=new Float32Array(16),h.matrixWorld.flattenToArray(h._objectMatrixArray),h instanceof THREE.Mesh){m=h.geometry;if(m.geometryGroups===void 0){var j=m,o=void 0,p=void 0,M=void 0,q=void 0,T=void 0,fa=void 0,s=void 0,J={},K=j.morphTargets.length;j.geometryGroups={};o=0;for(p=j.faces.length;o<
|
|
|
+p;o++)M=j.faces[o],q=M.materialIndex,fa=q!==void 0?q:-1,J[fa]===void 0&&(J[fa]={hash:fa,counter:0}),s=J[fa].hash+"_"+J[fa].counter,j.geometryGroups[s]===void 0&&(j.geometryGroups[s]={faces3:[],faces4:[],materialIndex:q,vertices:0,numMorphTargets:K}),T=M instanceof THREE.Face3?3:4,j.geometryGroups[s].vertices+T>65535&&(J[fa].counter+=1,s=J[fa].hash+"_"+J[fa].counter,j.geometryGroups[s]===void 0&&(j.geometryGroups[s]={faces3:[],faces4:[],materialIndex:q,vertices:0,numMorphTargets:K})),M instanceof THREE.Face3?
|
|
|
+j.geometryGroups[s].faces3.push(o):j.geometryGroups[s].faces4.push(o),j.geometryGroups[s].vertices+=T;j.geometryGroupsList=[];o=void 0;for(o in j.geometryGroups)j.geometryGroups[o].id=na++,j.geometryGroupsList.push(j.geometryGroups[o])}for(k in m.geometryGroups)if(j=m.geometryGroups[k],!j.__webglVertexBuffer){o=j;o.__webglVertexBuffer=l.createBuffer();o.__webglNormalBuffer=l.createBuffer();o.__webglTangentBuffer=l.createBuffer();o.__webglColorBuffer=l.createBuffer();o.__webglUVBuffer=l.createBuffer();
|
|
|
+o.__webglUV2Buffer=l.createBuffer();o.__webglSkinVertexABuffer=l.createBuffer();o.__webglSkinVertexBBuffer=l.createBuffer();o.__webglSkinIndicesBuffer=l.createBuffer();o.__webglSkinWeightsBuffer=l.createBuffer();o.__webglFaceBuffer=l.createBuffer();o.__webglLineBuffer=l.createBuffer();if(o.numMorphTargets){M=p=void 0;o.__webglMorphTargetsBuffers=[];p=0;for(M=o.numMorphTargets;p<M;p++)o.__webglMorphTargetsBuffers.push(l.createBuffer())}S.info.memory.geometries++;q=h;T=q.geometry;p=j.faces3;fa=j.faces4;
|
|
|
+o=p.length*3+fa.length*4;M=p.length*1+fa.length*2;fa=p.length*3+fa.length*4;p=c(q,j);s=g(p);J=d(p);K=e(p);j.__vertexArray=new Float32Array(o*3);if(J)j.__normalArray=new Float32Array(o*3);if(T.hasTangents)j.__tangentArray=new Float32Array(o*4);if(K)j.__colorArray=new Float32Array(o*3);if(s){if(T.faceUvs.length>0||T.faceVertexUvs.length>0)j.__uvArray=new Float32Array(o*2);if(T.faceUvs.length>1||T.faceVertexUvs.length>1)j.__uv2Array=new Float32Array(o*2)}if(q.geometry.skinWeights.length&&q.geometry.skinIndices.length)j.__skinVertexAArray=
|
|
|
+new Float32Array(o*4),j.__skinVertexBArray=new Float32Array(o*4),j.__skinIndexArray=new Float32Array(o*4),j.__skinWeightArray=new Float32Array(o*4);j.__faceArray=new Uint16Array(M*3);j.__lineArray=new Uint16Array(fa*2);if(j.numMorphTargets){j.__morphTargetsArrays=[];q=0;for(T=j.numMorphTargets;q<T;q++)j.__morphTargetsArrays.push(new Float32Array(o*3))}j.__webglFaceCount=M*3;j.__webglLineCount=fa*2;if(p.attributes){if(j.__webglCustomAttributesList===void 0)j.__webglCustomAttributesList=[];M=void 0;
|
|
|
+for(M in p.attributes){var q=p.attributes[M],T={},N;for(N in q)T[N]=q[N];if(!T.__webglInitialized||T.createUniqueBuffers)T.__webglInitialized=!0,fa=1,T.type==="v2"?fa=2:T.type==="v3"?fa=3:T.type==="v4"?fa=4:T.type==="c"&&(fa=3),T.size=fa,T.array=new Float32Array(o*fa),T.buffer=l.createBuffer(),T.buffer.belongsToAttribute=M,q.needsUpdate=!0,T.__original=q;j.__webglCustomAttributesList.push(T)}}j.__inittedArrays=!0;m.__dirtyVertices=!0;m.__dirtyMorphTargets=!0;m.__dirtyElements=!0;m.__dirtyUvs=!0;m.__dirtyNormals=
|
|
|
+!0;m.__dirtyTangents=!0;m.__dirtyColors=!0}}else if(h instanceof THREE.Ribbon){if(m=h.geometry,!m.__webglVertexBuffer)j=m,j.__webglVertexBuffer=l.createBuffer(),j.__webglColorBuffer=l.createBuffer(),S.info.memory.geometries++,j=m,o=j.vertices.length,j.__vertexArray=new Float32Array(o*3),j.__colorArray=new Float32Array(o*3),j.__webglVertexCount=o,m.__dirtyVertices=!0,m.__dirtyColors=!0}else if(h instanceof THREE.Line){if(m=h.geometry,!m.__webglVertexBuffer)j=m,j.__webglVertexBuffer=l.createBuffer(),
|
|
|
+j.__webglColorBuffer=l.createBuffer(),S.info.memory.geometries++,j=m,o=h,p=j.vertices.length,j.__vertexArray=new Float32Array(p*3),j.__colorArray=new Float32Array(p*3),j.__webglLineCount=p,b(j,o),m.__dirtyVertices=!0,m.__dirtyColors=!0}else if(h instanceof THREE.ParticleSystem&&(m=h.geometry,!m.__webglVertexBuffer))j=m,j.__webglVertexBuffer=l.createBuffer(),j.__webglColorBuffer=l.createBuffer(),S.info.geometries++,j=m,o=h,p=j.vertices.length,j.__vertexArray=new Float32Array(p*3),j.__colorArray=new Float32Array(p*
|
|
|
+3),j.__sortArray=[],j.__webglParticleCount=p,b(j,o),m.__dirtyVertices=!0,m.__dirtyColors=!0;if(!h.__webglActive){if(h instanceof THREE.Mesh)for(k in m=h.geometry,m.geometryGroups)j=m.geometryGroups[k],n(i.__webglObjects,j,h);else h instanceof THREE.Ribbon||h instanceof THREE.Line||h instanceof THREE.ParticleSystem?(m=h.geometry,n(i.__webglObjects,m,h)):THREE.MarchingCubes!==void 0&&h instanceof THREE.MarchingCubes||h.immediateRenderCallback?i.__webglObjectsImmediate.push({object:h,opaque:null,transparent:null}):
|
|
|
+h instanceof THREE.Sprite?i.__webglSprites.push(h):h instanceof THREE.LensFlare&&i.__webglFlares.push(h);h.__webglActive=!0}a.__objectsAdded.splice(0,1)}for(;a.__objectsRemoved.length;)h=a.__objectsRemoved[0],i=a,h instanceof THREE.Mesh||h instanceof THREE.ParticleSystem||h instanceof THREE.Ribbon||h instanceof THREE.Line?u(i.__webglObjects,h):h instanceof THREE.Sprite?y(i.__webglSprites,h):h instanceof THREE.LensFlare?y(i.__webglFlares,h):(h instanceof THREE.MarchingCubes||h.immediateRenderCallback)&&
|
|
|
+u(i.__webglObjectsImmediate,h),h.__webglActive=!1,a.__objectsRemoved.splice(0,1);h=0;for(i=a.__webglObjects.length;h<i;h++)if(N=a.__webglObjects[h].object,k=N.geometry,m=M=p=void 0,N instanceof THREE.Mesh){j=0;for(o=k.geometryGroupsList.length;j<o;j++)if(p=k.geometryGroupsList[j],m=c(N,p),M=m.attributes&&r(m),k.__dirtyVertices||k.__dirtyMorphTargets||k.__dirtyElements||k.__dirtyUvs||k.__dirtyNormals||k.__dirtyColors||k.__dirtyTangents||M){var w=N,M=l.DYNAMIC_DRAW,q=!k.dynamic,s=m;if(p.__inittedArrays){var T=
|
|
|
+d(s),fa=e(s),U=g(s),A=T===THREE.SmoothShading,C=J=s=void 0,D=void 0,z=void 0,L=void 0,E=void 0,P=void 0,F=void 0,G=C=void 0,v=void 0,H=void 0,Q=void 0,I=D=void 0,V=void 0,W=void 0,R=D=F=void 0,ba=void 0,$=Q=H=v=E=void 0,Z=D=Q=H=v=$=Q=H=v=$=Q=H=v=void 0,O=void 0,aa=L=void 0,da=void 0,Y=void 0,ga=void 0,X=void 0,ca=G=Y=O=0,ja=0,sa=Z=C=0,ea=E=I=0,B=0,ka=void 0,ea=p.__vertexArray,da=p.__uvArray,B=p.__uv2Array,aa=p.__normalArray,z=p.__tangentArray,V=p.__colorArray,R=p.__skinVertexAArray,ba=p.__skinVertexBArray,
|
|
|
+P=p.__skinIndexArray,ia=p.__skinWeightArray,$=p.__morphTargetsArrays,K=p.__webglCustomAttributesList,x=void 0,x=p.__faceArray,ka=p.__lineArray,W=w.geometry,ya=W.__dirtyElements,qa=W.__dirtyUvs,L=W.__dirtyNormals,F=W.__dirtyTangents,ra=W.__dirtyColors,ga=W.__dirtyMorphTargets,X=W.vertices,w=p.faces3,la=p.faces4,ma=W.faces,pa=W.faceVertexUvs[0],ta=W.faceVertexUvs[1],oa=W.skinVerticesA,za=W.skinVerticesB,va=W.skinIndices,wa=W.skinWeights,xa=W.morphTargets;if(W.__dirtyVertices){s=0;for(J=w.length;s<J;s++)D=
|
|
|
+ma[w[s]],v=X[D.a].position,H=X[D.b].position,Q=X[D.c].position,ea[Y]=v.x,ea[Y+1]=v.y,ea[Y+2]=v.z,ea[Y+3]=H.x,ea[Y+4]=H.y,ea[Y+5]=H.z,ea[Y+6]=Q.x,ea[Y+7]=Q.y,ea[Y+8]=Q.z,Y+=9;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],v=X[D.a].position,H=X[D.b].position,Q=X[D.c].position,D=X[D.d].position,ea[Y]=v.x,ea[Y+1]=v.y,ea[Y+2]=v.z,ea[Y+3]=H.x,ea[Y+4]=H.y,ea[Y+5]=H.z,ea[Y+6]=Q.x,ea[Y+7]=Q.y,ea[Y+8]=Q.z,ea[Y+9]=D.x,ea[Y+10]=D.y,ea[Y+11]=D.z,Y+=12;l.bindBuffer(l.ARRAY_BUFFER,p.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,
|
|
|
+ea,M)}if(ga){Y=0;for(ga=xa.length;Y<ga;Y++){s=ea=0;for(J=w.length;s<J;s++)D=ma[w[s]],v=xa[Y].vertices[D.a].position,H=xa[Y].vertices[D.b].position,Q=xa[Y].vertices[D.c].position,X=$[Y],X[ea]=v.x,X[ea+1]=v.y,X[ea+2]=v.z,X[ea+3]=H.x,X[ea+4]=H.y,X[ea+5]=H.z,X[ea+6]=Q.x,X[ea+7]=Q.y,X[ea+8]=Q.z,ea+=9;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],v=xa[Y].vertices[D.a].position,H=xa[Y].vertices[D.b].position,Q=xa[Y].vertices[D.c].position,D=xa[Y].vertices[D.d].position,X=$[Y],X[ea]=v.x,X[ea+1]=v.y,X[ea+2]=v.z,
|
|
|
+X[ea+3]=H.x,X[ea+4]=H.y,X[ea+5]=H.z,X[ea+6]=Q.x,X[ea+7]=Q.y,X[ea+8]=Q.z,X[ea+9]=D.x,X[ea+10]=D.y,X[ea+11]=D.z,ea+=12;l.bindBuffer(l.ARRAY_BUFFER,p.__webglMorphTargetsBuffers[Y]);l.bufferData(l.ARRAY_BUFFER,$[Y],M)}}if(wa.length){s=0;for(J=w.length;s<J;s++)D=ma[w[s]],v=wa[D.a],H=wa[D.b],Q=wa[D.c],ia[E]=v.x,ia[E+1]=v.y,ia[E+2]=v.z,ia[E+3]=v.w,ia[E+4]=H.x,ia[E+5]=H.y,ia[E+6]=H.z,ia[E+7]=H.w,ia[E+8]=Q.x,ia[E+9]=Q.y,ia[E+10]=Q.z,ia[E+11]=Q.w,v=va[D.a],H=va[D.b],Q=va[D.c],P[E]=v.x,P[E+1]=v.y,P[E+2]=v.z,
|
|
|
+P[E+3]=v.w,P[E+4]=H.x,P[E+5]=H.y,P[E+6]=H.z,P[E+7]=H.w,P[E+8]=Q.x,P[E+9]=Q.y,P[E+10]=Q.z,P[E+11]=Q.w,v=oa[D.a],H=oa[D.b],Q=oa[D.c],R[E]=v.x,R[E+1]=v.y,R[E+2]=v.z,R[E+3]=1,R[E+4]=H.x,R[E+5]=H.y,R[E+6]=H.z,R[E+7]=1,R[E+8]=Q.x,R[E+9]=Q.y,R[E+10]=Q.z,R[E+11]=1,v=za[D.a],H=za[D.b],Q=za[D.c],ba[E]=v.x,ba[E+1]=v.y,ba[E+2]=v.z,ba[E+3]=1,ba[E+4]=H.x,ba[E+5]=H.y,ba[E+6]=H.z,ba[E+7]=1,ba[E+8]=Q.x,ba[E+9]=Q.y,ba[E+10]=Q.z,ba[E+11]=1,E+=12;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],v=wa[D.a],H=wa[D.b],Q=wa[D.c],
|
|
|
+$=wa[D.d],ia[E]=v.x,ia[E+1]=v.y,ia[E+2]=v.z,ia[E+3]=v.w,ia[E+4]=H.x,ia[E+5]=H.y,ia[E+6]=H.z,ia[E+7]=H.w,ia[E+8]=Q.x,ia[E+9]=Q.y,ia[E+10]=Q.z,ia[E+11]=Q.w,ia[E+12]=$.x,ia[E+13]=$.y,ia[E+14]=$.z,ia[E+15]=$.w,v=va[D.a],H=va[D.b],Q=va[D.c],$=va[D.d],P[E]=v.x,P[E+1]=v.y,P[E+2]=v.z,P[E+3]=v.w,P[E+4]=H.x,P[E+5]=H.y,P[E+6]=H.z,P[E+7]=H.w,P[E+8]=Q.x,P[E+9]=Q.y,P[E+10]=Q.z,P[E+11]=Q.w,P[E+12]=$.x,P[E+13]=$.y,P[E+14]=$.z,P[E+15]=$.w,v=oa[D.a],H=oa[D.b],Q=oa[D.c],$=oa[D.d],R[E]=v.x,R[E+1]=v.y,R[E+2]=v.z,R[E+
|
|
|
+3]=1,R[E+4]=H.x,R[E+5]=H.y,R[E+6]=H.z,R[E+7]=1,R[E+8]=Q.x,R[E+9]=Q.y,R[E+10]=Q.z,R[E+11]=1,R[E+12]=$.x,R[E+13]=$.y,R[E+14]=$.z,R[E+15]=1,v=za[D.a],H=za[D.b],Q=za[D.c],D=za[D.d],ba[E]=v.x,ba[E+1]=v.y,ba[E+2]=v.z,ba[E+3]=1,ba[E+4]=H.x,ba[E+5]=H.y,ba[E+6]=H.z,ba[E+7]=1,ba[E+8]=Q.x,ba[E+9]=Q.y,ba[E+10]=Q.z,ba[E+11]=1,ba[E+12]=D.x,ba[E+13]=D.y,ba[E+14]=D.z,ba[E+15]=1,E+=16;E>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinVertexABuffer),l.bufferData(l.ARRAY_BUFFER,R,M),l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinVertexBBuffer),
|
|
|
+l.bufferData(l.ARRAY_BUFFER,ba,M),l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinIndicesBuffer),l.bufferData(l.ARRAY_BUFFER,P,M),l.bindBuffer(l.ARRAY_BUFFER,p.__webglSkinWeightsBuffer),l.bufferData(l.ARRAY_BUFFER,ia,M))}if(ra&&fa){s=0;for(J=w.length;s<J;s++)D=ma[w[s]],E=D.vertexColors,P=D.color,E.length===3&&fa===THREE.VertexColors?(D=E[0],R=E[1],ba=E[2]):ba=R=D=P,V[I]=D.r,V[I+1]=D.g,V[I+2]=D.b,V[I+3]=R.r,V[I+4]=R.g,V[I+5]=R.b,V[I+6]=ba.r,V[I+7]=ba.g,V[I+8]=ba.b,I+=9;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],
|
|
|
+E=D.vertexColors,P=D.color,E.length===4&&fa===THREE.VertexColors?(D=E[0],R=E[1],ba=E[2],E=E[3]):E=ba=R=D=P,V[I]=D.r,V[I+1]=D.g,V[I+2]=D.b,V[I+3]=R.r,V[I+4]=R.g,V[I+5]=R.b,V[I+6]=ba.r,V[I+7]=ba.g,V[I+8]=ba.b,V[I+9]=E.r,V[I+10]=E.g,V[I+11]=E.b,I+=12;I>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglColorBuffer),l.bufferData(l.ARRAY_BUFFER,V,M))}if(F&&W.hasTangents){s=0;for(J=w.length;s<J;s++)D=ma[w[s]],F=D.vertexTangents,I=F[0],V=F[1],W=F[2],z[Z]=I.x,z[Z+1]=I.y,z[Z+2]=I.z,z[Z+3]=I.w,z[Z+4]=V.x,z[Z+5]=V.y,
|
|
|
+z[Z+6]=V.z,z[Z+7]=V.w,z[Z+8]=W.x,z[Z+9]=W.y,z[Z+10]=W.z,z[Z+11]=W.w,Z+=12;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],F=D.vertexTangents,I=F[0],V=F[1],W=F[2],F=F[3],z[Z]=I.x,z[Z+1]=I.y,z[Z+2]=I.z,z[Z+3]=I.w,z[Z+4]=V.x,z[Z+5]=V.y,z[Z+6]=V.z,z[Z+7]=V.w,z[Z+8]=W.x,z[Z+9]=W.y,z[Z+10]=W.z,z[Z+11]=W.w,z[Z+12]=F.x,z[Z+13]=F.y,z[Z+14]=F.z,z[Z+15]=F.w,Z+=16;l.bindBuffer(l.ARRAY_BUFFER,p.__webglTangentBuffer);l.bufferData(l.ARRAY_BUFFER,z,M)}if(L&&T){s=0;for(J=w.length;s<J;s++)if(D=ma[w[s]],z=D.vertexNormals,L=
|
|
|
+D.normal,z.length===3&&A)for(Z=0;Z<3;Z++)L=z[Z],aa[C]=L.x,aa[C+1]=L.y,aa[C+2]=L.z,C+=3;else for(Z=0;Z<3;Z++)aa[C]=L.x,aa[C+1]=L.y,aa[C+2]=L.z,C+=3;s=0;for(J=la.length;s<J;s++)if(D=ma[la[s]],z=D.vertexNormals,L=D.normal,z.length===4&&A)for(Z=0;Z<4;Z++)L=z[Z],aa[C]=L.x,aa[C+1]=L.y,aa[C+2]=L.z,C+=3;else for(Z=0;Z<4;Z++)aa[C]=L.x,aa[C+1]=L.y,aa[C+2]=L.z,C+=3;l.bindBuffer(l.ARRAY_BUFFER,p.__webglNormalBuffer);l.bufferData(l.ARRAY_BUFFER,aa,M)}if(qa&&pa&&U){s=0;for(J=w.length;s<J;s++)if(C=w[s],C=pa[C],
|
|
|
+C!==void 0)for(Z=0;Z<3;Z++)aa=C[Z],da[G]=aa.u,da[G+1]=aa.v,G+=2;s=0;for(J=la.length;s<J;s++)if(C=la[s],C=pa[C],C!==void 0)for(Z=0;Z<4;Z++)aa=C[Z],da[G]=aa.u,da[G+1]=aa.v,G+=2;G>0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglUVBuffer),l.bufferData(l.ARRAY_BUFFER,da,M))}if(qa&&ta&&U){s=0;for(J=w.length;s<J;s++)if(C=w[s],G=ta[C],G!==void 0)for(Z=0;Z<3;Z++)da=G[Z],B[ca]=da.u,B[ca+1]=da.v,ca+=2;s=0;for(J=la.length;s<J;s++)if(C=la[s],G=ta[C],G!==void 0)for(Z=0;Z<4;Z++)da=G[Z],B[ca]=da.u,B[ca+1]=da.v,ca+=2;ca>
|
|
|
+0&&(l.bindBuffer(l.ARRAY_BUFFER,p.__webglUV2Buffer),l.bufferData(l.ARRAY_BUFFER,B,M))}if(ya){s=0;for(J=w.length;s<J;s++)x[ja]=O,x[ja+1]=O+1,x[ja+2]=O+2,ja+=3,ka[sa]=O,ka[sa+1]=O+1,ka[sa+2]=O,ka[sa+3]=O+2,ka[sa+4]=O+1,ka[sa+5]=O+2,sa+=6,O+=3;s=0;for(J=la.length;s<J;s++)x[ja]=O,x[ja+1]=O+1,x[ja+2]=O+3,x[ja+3]=O+1,x[ja+4]=O+2,x[ja+5]=O+3,ja+=6,ka[sa]=O,ka[sa+1]=O+1,ka[sa+2]=O,ka[sa+3]=O+3,ka[sa+4]=O+1,ka[sa+5]=O+2,ka[sa+6]=O+2,ka[sa+7]=O+3,sa+=8,O+=4;l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,p.__webglFaceBuffer);
|
|
|
+l.bufferData(l.ELEMENT_ARRAY_BUFFER,x,M);l.bindBuffer(l.ELEMENT_ARRAY_BUFFER,p.__webglLineBuffer);l.bufferData(l.ELEMENT_ARRAY_BUFFER,ka,M)}if(K){Z=0;for(O=K.length;Z<O;Z++)if(x=K[Z],x.__original.needsUpdate){B=0;if(x.size===1)if(x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(J=w.length;s<J;s++)D=ma[w[s]],x.array[B]=x.value[D.a],x.array[B+1]=x.value[D.b],x.array[B+2]=x.value[D.c],B+=3;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],x.array[B]=x.value[D.a],x.array[B+1]=x.value[D.b],x.array[B+2]=x.value[D.c],
|
|
|
+x.array[B+3]=x.value[D.d],B+=4}else{if(x.boundTo==="faces"){s=0;for(J=w.length;s<J;s++)ka=x.value[w[s]],x.array[B]=ka,x.array[B+1]=ka,x.array[B+2]=ka,B+=3;s=0;for(J=la.length;s<J;s++)ka=x.value[la[s]],x.array[B]=ka,x.array[B+1]=ka,x.array[B+2]=ka,x.array[B+3]=ka,B+=4}}else if(x.size===2)if(x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(J=w.length;s<J;s++)D=ma[w[s]],v=x.value[D.a],H=x.value[D.b],Q=x.value[D.c],x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=H.x,x.array[B+3]=H.y,x.array[B+4]=Q.x,
|
|
|
+x.array[B+5]=Q.y,B+=6;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],v=x.value[D.a],H=x.value[D.b],Q=x.value[D.c],D=x.value[D.d],x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=H.x,x.array[B+3]=H.y,x.array[B+4]=Q.x,x.array[B+5]=Q.y,x.array[B+6]=D.x,x.array[B+7]=D.y,B+=8}else{if(x.boundTo==="faces"){s=0;for(J=w.length;s<J;s++)Q=H=v=ka=x.value[w[s]],x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=H.x,x.array[B+3]=H.y,x.array[B+4]=Q.x,x.array[B+5]=Q.y,B+=6;s=0;for(J=la.length;s<J;s++)D=Q=H=v=ka=x.value[la[s]],x.array[B]=
|
|
|
+v.x,x.array[B+1]=v.y,x.array[B+2]=H.x,x.array[B+3]=H.y,x.array[B+4]=Q.x,x.array[B+5]=Q.y,x.array[B+6]=D.x,x.array[B+7]=D.y,B+=8}}else if(x.size===3)if(T=x.type==="c"?["r","g","b"]:["x","y","z"],x.boundTo===void 0||x.boundTo==="vertices"){s=0;for(J=w.length;s<J;s++)D=ma[w[s]],v=x.value[D.a],H=x.value[D.b],Q=x.value[D.c],x.array[B]=v[T[0]],x.array[B+1]=v[T[1]],x.array[B+2]=v[T[2]],x.array[B+3]=H[T[0]],x.array[B+4]=H[T[1]],x.array[B+5]=H[T[2]],x.array[B+6]=Q[T[0]],x.array[B+7]=Q[T[1]],x.array[B+8]=Q[T[2]],
|
|
|
+B+=9;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],v=x.value[D.a],H=x.value[D.b],Q=x.value[D.c],D=x.value[D.d],x.array[B]=v[T[0]],x.array[B+1]=v[T[1]],x.array[B+2]=v[T[2]],x.array[B+3]=H[T[0]],x.array[B+4]=H[T[1]],x.array[B+5]=H[T[2]],x.array[B+6]=Q[T[0]],x.array[B+7]=Q[T[1]],x.array[B+8]=Q[T[2]],x.array[B+9]=D[T[0]],x.array[B+10]=D[T[1]],x.array[B+11]=D[T[2]],B+=12}else{if(x.boundTo==="faces"){s=0;for(J=w.length;s<J;s++)Q=H=v=ka=x.value[w[s]],x.array[B]=v[T[0]],x.array[B+1]=v[T[1]],x.array[B+2]=v[T[2]],
|
|
|
+x.array[B+3]=H[T[0]],x.array[B+4]=H[T[1]],x.array[B+5]=H[T[2]],x.array[B+6]=Q[T[0]],x.array[B+7]=Q[T[1]],x.array[B+8]=Q[T[2]],B+=9;s=0;for(J=la.length;s<J;s++)D=Q=H=v=ka=x.value[la[s]],x.array[B]=v[T[0]],x.array[B+1]=v[T[1]],x.array[B+2]=v[T[2]],x.array[B+3]=H[T[0]],x.array[B+4]=H[T[1]],x.array[B+5]=H[T[2]],x.array[B+6]=Q[T[0]],x.array[B+7]=Q[T[1]],x.array[B+8]=Q[T[2]],x.array[B+9]=D[T[0]],x.array[B+10]=D[T[1]],x.array[B+11]=D[T[2]],B+=12}}else if(x.size===4)if(x.boundTo===void 0||x.boundTo==="vertices"){s=
|
|
|
+0;for(J=w.length;s<J;s++)D=ma[w[s]],v=x.value[D.a],H=x.value[D.b],Q=x.value[D.c],x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=v.z,x.array[B+3]=v.w,x.array[B+4]=H.x,x.array[B+5]=H.y,x.array[B+6]=H.z,x.array[B+7]=H.w,x.array[B+8]=Q.x,x.array[B+9]=Q.y,x.array[B+10]=Q.z,x.array[B+11]=Q.w,B+=12;s=0;for(J=la.length;s<J;s++)D=ma[la[s]],v=x.value[D.a],H=x.value[D.b],Q=x.value[D.c],D=x.value[D.d],x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=v.z,x.array[B+3]=v.w,x.array[B+4]=H.x,x.array[B+5]=H.y,x.array[B+
|
|
|
+6]=H.z,x.array[B+7]=H.w,x.array[B+8]=Q.x,x.array[B+9]=Q.y,x.array[B+10]=Q.z,x.array[B+11]=Q.w,x.array[B+12]=D.x,x.array[B+13]=D.y,x.array[B+14]=D.z,x.array[B+15]=D.w,B+=16}else if(x.boundTo==="faces"){s=0;for(J=w.length;s<J;s++)Q=H=v=ka=x.value[w[s]],x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=v.z,x.array[B+3]=v.w,x.array[B+4]=H.x,x.array[B+5]=H.y,x.array[B+6]=H.z,x.array[B+7]=H.w,x.array[B+8]=Q.x,x.array[B+9]=Q.y,x.array[B+10]=Q.z,x.array[B+11]=Q.w,B+=12;s=0;for(J=la.length;s<J;s++)D=Q=H=v=ka=x.value[la[s]],
|
|
|
+x.array[B]=v.x,x.array[B+1]=v.y,x.array[B+2]=v.z,x.array[B+3]=v.w,x.array[B+4]=H.x,x.array[B+5]=H.y,x.array[B+6]=H.z,x.array[B+7]=H.w,x.array[B+8]=Q.x,x.array[B+9]=Q.y,x.array[B+10]=Q.z,x.array[B+11]=Q.w,x.array[B+12]=D.x,x.array[B+13]=D.y,x.array[B+14]=D.z,x.array[B+15]=D.w,B+=16}l.bindBuffer(l.ARRAY_BUFFER,x.buffer);l.bufferData(l.ARRAY_BUFFER,x.array,M)}}q&&(delete p.__inittedArrays,delete p.__colorArray,delete p.__normalArray,delete p.__tangentArray,delete p.__uvArray,delete p.__uv2Array,delete p.__faceArray,
|
|
|
+delete p.__vertexArray,delete p.__lineArray,delete p.__skinVertexAArray,delete p.__skinVertexBArray,delete p.__skinIndexArray,delete p.__skinWeightArray)}}k.__dirtyVertices=!1;k.__dirtyMorphTargets=!1;k.__dirtyElements=!1;k.__dirtyUvs=!1;k.__dirtyNormals=!1;k.__dirtyColors=!1;k.__dirtyTangents=!1;m.attributes&&t(m)}else if(N instanceof THREE.Ribbon){if(k.__dirtyVertices||k.__dirtyColors){m=k;N=l.DYNAMIC_DRAW;T=j=T=q=q=void 0;fa=m.vertices;o=m.colors;s=fa.length;p=o.length;J=m.__vertexArray;M=m.__colorArray;
|
|
|
+K=m.__dirtyColors;if(m.__dirtyVertices){for(q=0;q<s;q++)T=fa[q].position,j=q*3,J[j]=T.x,J[j+1]=T.y,J[j+2]=T.z;l.bindBuffer(l.ARRAY_BUFFER,m.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,J,N)}if(K){for(q=0;q<p;q++)T=o[q],j=q*3,M[j]=T.r,M[j+1]=T.g,M[j+2]=T.b;l.bindBuffer(l.ARRAY_BUFFER,m.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,M,N)}}k.__dirtyVertices=!1;k.__dirtyColors=!1}else if(N instanceof THREE.Line){m=c(N,p);M=m.attributes&&r(m);if(k.__dirtyVertices||k.__dirtyColors||M){N=k;j=l.DYNAMIC_DRAW;
|
|
|
+s=o=A=fa=U=void 0;fa=N.vertices;p=N.colors;s=fa.length;M=p.length;J=N.__vertexArray;q=N.__colorArray;K=N.__dirtyColors;T=N.__webglCustomAttributesList;O=ma=la=w=A=U=void 0;if(N.__dirtyVertices){for(U=0;U<s;U++)A=fa[U].position,o=U*3,J[o]=A.x,J[o+1]=A.y,J[o+2]=A.z;l.bindBuffer(l.ARRAY_BUFFER,N.__webglVertexBuffer);l.bufferData(l.ARRAY_BUFFER,J,j)}if(K){for(fa=0;fa<M;fa++)s=p[fa],o=fa*3,q[o]=s.r,q[o+1]=s.g,q[o+2]=s.b;l.bindBuffer(l.ARRAY_BUFFER,N.__webglColorBuffer);l.bufferData(l.ARRAY_BUFFER,q,j)}if(T){U=
|
|
|
+0;for(A=T.length;U<A;U++)if(O=T[U],O.needsUpdate&&(O.boundTo===void 0||O.boundTo==="vertices")){o=0;la=O.value.length;if(O.size===1)for(w=0;w<la;w++)O.array[w]=O.value[w];else if(O.size===2)for(w=0;w<la;w++)ma=O.value[w],O.array[o]=ma.x,O.array[o+1]=ma.y,o+=2;else if(O.size===3)if(O.type==="c")for(w=0;w<la;w++)ma=O.value[w],O.array[o]=ma.r,O.array[o+1]=ma.g,O.array[o+2]=ma.b,o+=3;else for(w=0;w<la;w++)ma=O.value[w],O.array[o]=ma.x,O.array[o+1]=ma.y,O.array[o+2]=ma.z,o+=3;else if(O.size===4)for(w=
|
|
|
+0;w<la;w++)ma=O.value[w],O.array[o]=ma.x,O.array[o+1]=ma.y,O.array[o+2]=ma.z,O.array[o+3]=ma.w,o+=4;l.bindBuffer(l.ARRAY_BUFFER,O.buffer);l.bufferData(l.ARRAY_BUFFER,O.array,j)}}}k.__dirtyVertices=!1;k.__dirtyColors=!1;m.attributes&&t(m)}else if(N instanceof THREE.ParticleSystem)m=c(N,p),M=m.attributes&&r(m),(k.__dirtyVertices||k.__dirtyColors||N.sortParticles||M)&&f(k,l.DYNAMIC_DRAW,N),k.__dirtyVertices=!1,k.__dirtyColors=!1,m.attributes&&t(m)};this.initMaterial=function(a,b,c,d){var e,f,g,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 j,m,k;j=k=i=0;for(m=
|
|
|
+b.length;j<m;j++)g=b[j],g instanceof THREE.SpotLight&&k++,g instanceof THREE.DirectionalLight&&k++,g instanceof THREE.PointLight&&i++;i+k<=W?j=k:(j=Math.ceil(W*k/(i+k)),i=W-j);g={directional:j,point:i};i=k=0;for(j=b.length;i<j;i++)m=b[i],m instanceof THREE.SpotLight&&m.castShadow&&k++;var n=50;if(d!==void 0&&d instanceof THREE.SkinnedMesh)n=d.bones.length;var o;a:{j=a.fragmentShader;m=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:g.directional,maxPointLights:g.point,maxBones:n,shadowMapEnabled:this.shadowMapEnabled&&d.receiveShadow,shadowMapSoft:this.shadowMapSoft,shadowMapWidth:this.shadowMapWidth,shadowMapHeight:this.shadowMapHeight,maxShadows:k,alphaTest:a.alphaTest,metal:a.metal,perPixel:a.perPixel},p,d=[];h?d.push(h):(d.push(j),d.push(m));for(p in c)d.push(p),d.push(c[p]);
|
|
|
+h=d.join();p=0;for(d=da.length;p<d;p++)if(da[p].code===h){o=da[p].program;break a}p=l.createProgram();d=[ya?"#define VERTEX_TEXTURES":"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.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");
|
|
|
+g=["#ifdef GL_ES","precision "+aa+" 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:"",S.gammaInput?"#define GAMMA_INPUT":"",S.gammaOutput?"#define GAMMA_OUTPUT":"",S.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");l.attachShader(p,K("fragment",g+j));l.attachShader(p,
|
|
|
+K("vertex",d+m));l.linkProgram(p);l.getProgramParameter(p,l.LINK_STATUS)||console.error("Could not initialise shader\nVALIDATE_STATUS: "+l.getProgramParameter(p,l.VALIDATE_STATUS)+", gl error ["+l.getError()+"]");p.uniforms={};p.attributes={};var M,d=["viewMatrix","modelViewMatrix","projectionMatrix","normalMatrix","objectMatrix","cameraPosition","cameraInverseMatrix","boneGlobalMatrices","morphTargetInfluences"];for(M in i)d.push(M);M=d;d=0;for(i=M.length;d<i;d++)j=M[d],p.uniforms[j]=l.getUniformLocation(p,
|
|
|
+j);d=["position","normal","uv","uv2","tangent","color","skinVertexA","skinVertexB","skinIndex","skinWeight"];for(M=0;M<c.maxMorphTargets;M++)d.push("morphTarget"+M);for(o in b)d.push(o);o=d;M=0;for(b=o.length;M<b;M++)c=o[M],p.attributes[c]=l.getAttribLocation(p,c);p.id=da.length;da.push({program:p,code:h});S.info.memory.programs=da.length;o=p}a.program=o;o=a.program.attributes;o.position>=0&&l.enableVertexAttribArray(o.position);o.color>=0&&l.enableVertexAttribArray(o.color);o.normal>=0&&l.enableVertexAttribArray(o.normal);
|
|
|
o.tangent>=0&&l.enableVertexAttribArray(o.tangent);a.skinning&&o.skinVertexA>=0&&o.skinVertexB>=0&&o.skinIndex>=0&&o.skinWeight>=0&&(l.enableVertexAttribArray(o.skinVertexA),l.enableVertexAttribArray(o.skinVertexB),l.enableVertexAttribArray(o.skinIndex),l.enableVertexAttribArray(o.skinWeight));if(a.attributes)for(f in a.attributes)o[f]!==void 0&&o[f]>=0&&l.enableVertexAttribArray(o[f]);if(a.morphTargets)for(f=a.numSupportedMorphTargets=0;f<this.maxMorphTargets;f++)M="morphTarget"+f,o[M]>=0&&(l.enableVertexAttribArray(o[M]),
|
|
|
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"?l.frontFace(l.CCW):l.frontFace(l.CW),a==="back"?l.cullFace(l.BACK):a==="front"?l.cullFace(l.FRONT):l.cullFace(l.FRONT_AND_BACK),l.enable(l.CULL_FACE)):l.disable(l.CULL_FACE)};this.setBlending=function(a){if(a!==ra){switch(a){case THREE.AdditiveBlending:l.blendEquation(l.FUNC_ADD);l.blendFunc(l.SRC_ALPHA,l.ONE);break;case THREE.SubtractiveBlending:l.blendEquation(l.FUNC_ADD);
|
|
|
-l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.SRC_COLOR);break;default:l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)}ra=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=l.createTexture(),R.info.memory.textures++;l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);
|
|
|
-var c=s(l.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?l.texImage2D(l.TEXTURE_2D,0,Q(a.format),a.image.width,a.image.height,0,Q(a.format),l.UNSIGNED_BYTE,a.image.data):l.texImage2D(l.TEXTURE_2D,0,l.RGBA,l.RGBA,l.UNSIGNED_BYTE,a.image);c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else l.activeTexture(l.TEXTURE0+b),l.bindTexture(l.TEXTURE_2D,a.__webglTexture)}};
|
|
|
+l.blendFunc(l.ZERO,l.ONE_MINUS_SRC_COLOR);break;case THREE.MultiplyBlending:l.blendEquation(l.FUNC_ADD);l.blendFunc(l.ZERO,l.SRC_COLOR);break;default:l.blendEquationSeparate(l.FUNC_ADD,l.FUNC_ADD),l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA)}ra=a}};this.setTexture=function(a,b){if(a.needsUpdate){if(!a.__webglInit)a.__webglInit=!0,a.__webglTexture=l.createTexture(),S.info.memory.textures++;l.activeTexture(l.TEXTURE0+b);l.bindTexture(l.TEXTURE_2D,a.__webglTexture);
|
|
|
+var c=s(l.TEXTURE_2D,a,a.image);a instanceof THREE.DataTexture?l.texImage2D(l.TEXTURE_2D,0,R(a.format),a.image.width,a.image.height,0,R(a.format),l.UNSIGNED_BYTE,a.image.data):l.texImage2D(l.TEXTURE_2D,0,l.RGBA,l.RGBA,l.UNSIGNED_BYTE,a.image);c&&l.generateMipmap(l.TEXTURE_2D);a.needsUpdate=!1;if(a.onUpdated)a.onUpdated()}else l.activeTexture(l.TEXTURE0+b),l.bindTexture(l.TEXTURE_2D,a.__webglTexture)};this.addPlugin(new THREE.SpritePlugin);this.addPlugin(new THREE.LensFlarePlugin)};
|
|
|
THREE.WebGLRenderTarget=function(a,b,c){this.width=a;this.height=b;c=c||{};this.wrapS=c.wrapS!==void 0?c.wrapS:THREE.ClampToEdgeWrapping;this.wrapT=c.wrapT!==void 0?c.wrapT:THREE.ClampToEdgeWrapping;this.magFilter=c.magFilter!==void 0?c.magFilter:THREE.LinearFilter;this.minFilter=c.minFilter!==void 0?c.minFilter:THREE.LinearMipMapLinearFilter;this.offset=new THREE.Vector2(0,0);this.repeat=new THREE.Vector2(1,1);this.format=c.format!==void 0?c.format:THREE.RGBAFormat;this.type=c.type!==void 0?c.type:
|
|
|
THREE.UnsignedByteType;this.depthBuffer=c.depthBuffer!==void 0?c.depthBuffer:!0;this.stencilBuffer=c.stencilBuffer!==void 0?c.stencilBuffer:!0};
|
|
|
THREE.WebGLRenderTarget.prototype.clone=function(){var a=new THREE.WebGLRenderTarget(this.width,this.height);a.wrapS=this.wrapS;a.wrapT=this.wrapT;a.magFilter=this.magFilter;a.minFilter=this.minFilter;a.offset.copy(this.offset);a.repeat.copy(this.repeat);a.format=this.format;a.type=this.type;a.depthBuffer=this.depthBuffer;a.stencilBuffer=this.stencilBuffer;return a};THREE.WebGLRenderTargetCube=function(a,b,c){THREE.WebGLRenderTarget.call(this,a,b,c);this.activeCubeFace=0};
|
|
@@ -485,23 +485,23 @@ c.object.position.addSelf(b);c.target.addSelf(b);c.staticMoving?o=p:o.addSelf(a.
|
|
|
c.noPan||c.panCamera();c.object.position.add(c.target,f);c.checkDistances();c.object.lookAt(c.target)};this.domElement.addEventListener("contextmenu",function(a){a.preventDefault()},!1);this.domElement.addEventListener("mousemove",function(a){c.enabled&&(e&&(h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY),j=k=c.getMouseOnScreen(a.clientX,a.clientY),o=p=c.getMouseOnScreen(a.clientX,a.clientY),e=!1),g!==d.NONE&&(g===d.ROTATE&&!c.noRotate?i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&
|
|
|
!c.noZoom?k=c.getMouseOnScreen(a.clientX,a.clientY):g===d.PAN&&!c.noPan&&(p=c.getMouseOnScreen(a.clientX,a.clientY))))},!1);this.domElement.addEventListener("mousedown",function(a){if(c.enabled&&(a.preventDefault(),a.stopPropagation(),g===d.NONE))g=a.button,g===d.ROTATE&&!c.noRotate?h=i=c.getMouseProjectionOnBall(a.clientX,a.clientY):g===d.ZOOM&&!c.noZoom?j=k=c.getMouseOnScreen(a.clientX,a.clientY):this.noPan||(o=p=c.getMouseOnScreen(a.clientX,a.clientY))},!1);this.domElement.addEventListener("mouseup",
|
|
|
function(a){if(c.enabled)a.preventDefault(),a.stopPropagation(),g=d.NONE},!1);window.addEventListener("keydown",function(a){if(c.enabled&&g===d.NONE){if(a.keyCode===c.keys[d.ROTATE]&&!c.noRotate)g=d.ROTATE;else if(a.keyCode===c.keys[d.ZOOM]&&!c.noZoom)g=d.ZOOM;else if(a.keyCode===c.keys[d.PAN]&&!c.noPan)g=d.PAN;g!==d.NONE&&(e=!0)}},!1);window.addEventListener("keyup",function(){if(c.enabled&&g!==d.NONE)g=d.NONE},!1)};
|
|
|
-THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,k,m){var n,o=d||1,p=e||1,q=h/2,r=i/2,t=j.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=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=g||1;var u=o+1,y=p+1,L=h/o,H=i/p,O=new THREE.Vector3;O[n]=k>0?1:-1;for(h=0;h<y;h++)for(i=0;i<u;i++){var V=new THREE.Vector3;V[a]=(i*L-q)*c;V[b]=(h*H-r)*f;V[n]=k;j.vertices.push(new THREE.Vertex(V))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
|
|
|
-new THREE.Face4(i+u*h+t,i+u*(h+1)+t,i+1+u*(h+1)+t,i+1+u*h+t),a.normal.copy(O),a.vertexNormals.push(O.clone(),O.clone(),O.clone(),O.clone()),a.materialIndex=m,j.faces.push(a),j.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 j=this,k=a/2,o=b/2,p=c/2,m,q,n,r,t,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;r=1;q=2;t=
|
|
|
+THREE.CubeGeometry=function(a,b,c,d,e,g,f,h){function i(a,b,c,f,h,i,k,m){var n,o=d||1,p=e||1,q=h/2,r=i/2,t=j.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=g||1;else if(a==="z"&&b==="y"||a==="y"&&b==="z")n="x",o=g||1;var u=o+1,y=p+1,L=h/o,C=i/p,P=new THREE.Vector3;P[n]=k>0?1:-1;for(h=0;h<y;h++)for(i=0;i<u;i++){var W=new THREE.Vector3;W[a]=(i*L-q)*c;W[b]=(h*C-r)*f;W[n]=k;j.vertices.push(new THREE.Vertex(W))}for(h=0;h<p;h++)for(i=0;i<o;i++)a=
|
|
|
+new THREE.Face4(i+u*h+t,i+u*(h+1)+t,i+1+u*(h+1)+t,i+1+u*h+t),a.normal.copy(P),a.vertexNormals.push(P.clone(),P.clone(),P.clone(),P.clone()),a.materialIndex=m,j.faces.push(a),j.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 j=this,k=a/2,o=b/2,p=c/2,m,q,n,r,t,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;r=1;q=2;t=
|
|
|
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 y in h)this.sides[y]!=void 0&&(this.sides[y]=h[y]);this.sides.px&&i("z","y",-1,-1,c,b,k,m);this.sides.nx&&i("z","y",1,-1,c,b,-k,r);this.sides.py&&i("x","z",1,1,a,c,o,q);this.sides.ny&&i("x","z",1,-1,a,c,-o,t);this.sides.pz&&i("x","y",1,-1,a,b,p,n);this.sides.nz&&i("x","y",-1,-1,a,b,-p,u);this.computeCentroids();this.mergeVertices()};THREE.CubeGeometry.prototype=new THREE.Geometry;
|
|
|
THREE.CubeGeometry.prototype.constructor=THREE.CubeGeometry;
|
|
|
THREE.CylinderGeometry=function(a,b,c,d,e,g){THREE.Geometry.call(this);var a=a!=null?a:20,b=b!=null?b:20,c=c||100,f=c/2,d=d||8,e=e||1,h,i,j=[],k=[];for(i=0;i<=e;i++){var o=[],p=[],m=i/e,q=m*(b-a)+a;for(h=0;h<=d;h++){var n=h/d;this.vertices.push(new THREE.Vertex(new THREE.Vector3(q*Math.sin(n*Math.PI*2),-m*c+f,q*Math.cos(n*Math.PI*2))));o.push(this.vertices.length-1);p.push(new THREE.UV(n,m))}j.push(o);k.push(p)}for(i=0;i<e;i++)for(h=0;h<d;h++){var c=j[i][h],o=j[i+1][h],p=j[i+1][h+1],m=j[i][h+1],q=
|
|
|
-this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[o].position.clone().setY(0).normalize(),r=this.vertices[p].position.clone().setY(0).normalize(),t=this.vertices[m].position.clone().setY(0).normalize(),u=k[i][h].clone(),y=k[i+1][h].clone(),v=k[i+1][h+1].clone(),A=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,p,m,[q,n,r,t]));this.faceVertexUvs[0].push([u,y,v,A])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=j[0][h],o=j[0][h+
|
|
|
-1],p=this.vertices.length-1,q=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),u=k[0][h].clone(),y=k[0][h+1].clone(),v=new THREE.UV(y.u,0),this.faces.push(new THREE.Face3(c,o,p,[q,n,r])),this.faceVertexUvs[0].push([u,y,v])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=j[i][h+1],o=j[i][h],p=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),u=k[i][h+1].clone(),y=k[i][h].clone(),
|
|
|
-v=new THREE.UV(y.u,1),this.faces.push(new THREE.Face3(c,o,p,[q,n,r])),this.faceVertexUvs[0].push([u,y,v])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
+this.vertices[c].position.clone().setY(0).normalize(),n=this.vertices[o].position.clone().setY(0).normalize(),r=this.vertices[p].position.clone().setY(0).normalize(),t=this.vertices[m].position.clone().setY(0).normalize(),u=k[i][h].clone(),y=k[i+1][h].clone(),w=k[i+1][h+1].clone(),z=k[i][h+1].clone();this.faces.push(new THREE.Face4(c,o,p,m,[q,n,r,t]));this.faceVertexUvs[0].push([u,y,w,z])}if(!g&&a>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,f,0)));for(h=0;h<d;h++)c=j[0][h],o=j[0][h+
|
|
|
+1],p=this.vertices.length-1,q=new THREE.Vector3(0,1,0),n=new THREE.Vector3(0,1,0),r=new THREE.Vector3(0,1,0),u=k[0][h].clone(),y=k[0][h+1].clone(),w=new THREE.UV(y.u,0),this.faces.push(new THREE.Face3(c,o,p,[q,n,r])),this.faceVertexUvs[0].push([u,y,w])}if(!g&&b>0){this.vertices.push(new THREE.Vertex(new THREE.Vector3(0,-f,0)));for(h=0;h<d;h++)c=j[i][h+1],o=j[i][h],p=this.vertices.length-1,q=new THREE.Vector3(0,-1,0),n=new THREE.Vector3(0,-1,0),r=new THREE.Vector3(0,-1,0),u=k[i][h+1].clone(),y=k[i][h].clone(),
|
|
|
+w=new THREE.UV(y.u,1),this.faces.push(new THREE.Face3(c,o,p,[q,n,r])),this.faceVertexUvs[0].push([u,y,w])}this.computeCentroids();this.computeFaceNormals()};THREE.CylinderGeometry.prototype=new THREE.Geometry;THREE.CylinderGeometry.prototype.constructor=THREE.CylinderGeometry;
|
|
|
THREE.ExtrudeGeometry=function(a,b){if(typeof a!=="undefined"){THREE.Geometry.call(this);var a=a instanceof Array?a:[a],c,d=a.length,e;this.shapebb=a[d-1].getBoundingBox();for(c=0;c<d;c++)e=a[c],this.addShape(e,b);this.computeCentroids();this.computeFaceNormals()}};THREE.ExtrudeGeometry.prototype=new THREE.Geometry;THREE.ExtrudeGeometry.prototype.constructor=THREE.ExtrudeGeometry;
|
|
|
THREE.ExtrudeGeometry.prototype.addShape=function(a,b){function c(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 e(a){for(s=a.length;--s>=0;){V=s;R=s-1;R<0&&(R=a.length-1);for(var b=
|
|
|
-0,c=m+k*2,b=0;b<c;b++){var d=$*b,e=$*(b+1),f=l+V+d,g=l+V+e,j=f,d=l+R+d,e=l+R+e,n=g;j+=G;d+=G;e+=G;n+=G;F.faces.push(new THREE.Face4(j,d,e,n,null,null,v));v&&(j=b/c,d=(b+1)/c,e=h+i*2,f=(F.vertices[f].position.z+i)/e,g=(F.vertices[g].position.z+i)/e,F.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){F.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=G;b+=G;c+=G;F.faces.push(new THREE.Face3(a,b,c,null,
|
|
|
-null,y));if(y){var d=A.maxY,e=A.maxX,f=F.vertices[b].position.x,b=F.vertices[b].position.y,g=F.vertices[c].position.x,c=F.vertices[c].position.y;F.faceVertexUvs[0].push([new THREE.UV(F.vertices[a].position.x/e,F.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:!0,p=b.curveSegments!==
|
|
|
-void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,q=b.bendPath,n=b.extrudePath,r,t=!1,u=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,y=b.material,v=b.extrudeMaterial,A=this.shapebb;if(n)r=n.getPoints(p),m=r.length,t=!0,o=!1;o||(j=i=k=0);var z,w,I,F=this,G=this.vertices.length;q&&a.addWrapPath(q);p=u?a.extractAllSpacedPoints(p):a.extractAllPoints(p);q=p.shape;p=p.holes;if(n=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();w=0;for(I=p.length;w<I;w++)z=p[w],THREE.Shape.Utils.isClockWise(z)&&
|
|
|
-(p[w]=z.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(q,p);u=q;w=0;for(I=p.length;w<I;w++)z=p[w],q=q.concat(z);var s,E,T,Z,Q,U,$=q.length,ja=n.length,K=[];s=0;E=u.length;V=E-1;for(R=s+1;s<E;s++,V++,R++)V===E&&(V=0),R===E&&(R=0),K[s]=d(u[s],u[V],u[R]);var L=[],H,O=K.concat();w=0;for(I=p.length;w<I;w++){z=p[w];H=[];s=0;E=z.length;V=E-1;for(R=s+1;s<E;s++,V++,R++)V===E&&(V=0),R===E&&(R=0),H[s]=d(z[s],z[V],z[R]);L.push(H);O=O.concat(H)}for(T=0;T<k;T++){Z=T/k;Q=i*(1-Z);Z=j*Math.sin(Z*Math.PI/2);
|
|
|
-s=0;for(E=u.length;s<E;s++)U=c(u[s],K[s],Z),g(U.x,U.y,-Q);w=0;for(I=p.length;w<I;w++){z=p[w];H=L[w];s=0;for(E=z.length;s<E;s++)U=c(z[s],H[s],Z),g(U.x,U.y,-Q)}}Z=j;for(s=0;s<$;s++)U=o?c(q[s],O[s],Z):q[s],t?g(U.x,U.y+r[0].y,r[0].x):g(U.x,U.y,0);for(T=1;T<=m;T++)for(s=0;s<$;s++)U=o?c(q[s],O[s],Z):q[s],t?g(U.x,U.y+r[T-1].y,r[T-1].x):g(U.x,U.y,h/m*T);for(T=k-1;T>=0;T--){Z=T/k;Q=i*(1-Z);Z=j*Math.sin(Z*Math.PI/2);s=0;for(E=u.length;s<E;s++)U=c(u[s],K[s],Z),g(U.x,U.y,h+Q);w=0;for(I=p.length;w<I;w++){z=p[w];
|
|
|
-H=L[w];s=0;for(E=z.length;s<E;s++)U=c(z[s],H[s],Z),t?g(U.x,U.y+r[m-1].y,r[m-1].x+Q):g(U.x,U.y,h+Q)}}if(o){o=$*0;for(s=0;s<ja;s++)j=n[s],f(j[2]+o,j[1]+o,j[0]+o);o=$*(m+k*2);for(s=0;s<ja;s++)j=n[s],f(j[0]+o,j[1]+o,j[2]+o)}else{for(s=0;s<ja;s++)j=n[s],f(j[2],j[1],j[0]);for(s=0;s<ja;s++)j=n[s],f(j[0]+$*m,j[1]+$*m,j[2]+$*m)}var V,R,l=0;e(u);l+=u.length;w=0;for(I=p.length;w<I;w++)z=p[w],e(z),l+=z.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 e(a){for(s=a.length;--s>=0;){W=s;S=s-1;S<0&&(S=a.length-1);for(var b=
|
|
|
+0,c=m+k*2,b=0;b<c;b++){var d=aa*b,e=aa*(b+1),f=l+W+d,g=l+W+e,j=f,d=l+S+d,e=l+S+e,n=g;j+=K;d+=K;e+=K;n+=K;F.faces.push(new THREE.Face4(j,d,e,n,null,null,w));w&&(j=b/c,d=(b+1)/c,e=h+i*2,f=(F.vertices[f].position.z+i)/e,g=(F.vertices[g].position.z+i)/e,F.faceVertexUvs[0].push([new THREE.UV(f,j),new THREE.UV(g,j),new THREE.UV(g,d),new THREE.UV(f,d)]))}}}function g(a,b,c){F.vertices.push(new THREE.Vertex(new THREE.Vector3(a,b,c)))}function f(a,b,c){a+=K;b+=K;c+=K;F.faces.push(new THREE.Face3(a,b,c,null,
|
|
|
+null,y));if(y){var d=z.maxY,e=z.maxX,f=F.vertices[b].position.x,b=F.vertices[b].position.y,g=F.vertices[c].position.x,c=F.vertices[c].position.y;F.faceVertexUvs[0].push([new THREE.UV(F.vertices[a].position.x/e,F.vertices[a].position.y/d),new THREE.UV(f/e,b/d),new THREE.UV(g/e,c/d)])}}var h=b.amount!==void 0?b.amount:100,i=b.bevelThickness!==void 0?b.bevelThickness:6,j=b.bevelSize!==void 0?b.bevelSize:i-2,k=b.bevelSegments!==void 0?b.bevelSegments:3,o=b.bevelEnabled!==void 0?b.bevelEnabled:!0,p=b.curveSegments!==
|
|
|
+void 0?b.curveSegments:12,m=b.steps!==void 0?b.steps:1,q=b.bendPath,n=b.extrudePath,r,t=!1,u=b.useSpacedPoints!==void 0?b.useSpacedPoints:!1,y=b.material,w=b.extrudeMaterial,z=this.shapebb;if(n)r=n.getPoints(p),m=r.length,t=!0,o=!1;o||(j=i=k=0);var A,v,G,F=this,K=this.vertices.length;q&&a.addWrapPath(q);p=u?a.extractAllSpacedPoints(p):a.extractAllPoints(p);q=p.shape;p=p.holes;if(n=!THREE.Shape.Utils.isClockWise(q)){q=q.reverse();v=0;for(G=p.length;v<G;v++)A=p[v],THREE.Shape.Utils.isClockWise(A)&&
|
|
|
+(p[v]=A.reverse());n=!1}n=THREE.Shape.Utils.triangulateShape(q,p);u=q;v=0;for(G=p.length;v<G;v++)A=p[v],q=q.concat(A);var s,N,U,$,R,V,aa=q.length,ja=n.length,I=[];s=0;N=u.length;W=N-1;for(S=s+1;s<N;s++,W++,S++)W===N&&(W=0),S===N&&(S=0),I[s]=d(u[s],u[W],u[S]);var L=[],C,P=I.concat();v=0;for(G=p.length;v<G;v++){A=p[v];C=[];s=0;N=A.length;W=N-1;for(S=s+1;s<N;s++,W++,S++)W===N&&(W=0),S===N&&(S=0),C[s]=d(A[s],A[W],A[S]);L.push(C);P=P.concat(C)}for(U=0;U<k;U++){$=U/k;R=i*(1-$);$=j*Math.sin($*Math.PI/2);
|
|
|
+s=0;for(N=u.length;s<N;s++)V=c(u[s],I[s],$),g(V.x,V.y,-R);v=0;for(G=p.length;v<G;v++){A=p[v];C=L[v];s=0;for(N=A.length;s<N;s++)V=c(A[s],C[s],$),g(V.x,V.y,-R)}}$=j;for(s=0;s<aa;s++)V=o?c(q[s],P[s],$):q[s],t?g(V.x,V.y+r[0].y,r[0].x):g(V.x,V.y,0);for(U=1;U<=m;U++)for(s=0;s<aa;s++)V=o?c(q[s],P[s],$):q[s],t?g(V.x,V.y+r[U-1].y,r[U-1].x):g(V.x,V.y,h/m*U);for(U=k-1;U>=0;U--){$=U/k;R=i*(1-$);$=j*Math.sin($*Math.PI/2);s=0;for(N=u.length;s<N;s++)V=c(u[s],I[s],$),g(V.x,V.y,h+R);v=0;for(G=p.length;v<G;v++){A=
|
|
|
+p[v];C=L[v];s=0;for(N=A.length;s<N;s++)V=c(A[s],C[s],$),t?g(V.x,V.y+r[m-1].y,r[m-1].x+R):g(V.x,V.y,h+R)}}if(o){o=aa*0;for(s=0;s<ja;s++)j=n[s],f(j[2]+o,j[1]+o,j[0]+o);o=aa*(m+k*2);for(s=0;s<ja;s++)j=n[s],f(j[0]+o,j[1]+o,j[2]+o)}else{for(s=0;s<ja;s++)j=n[s],f(j[2],j[1],j[0]);for(s=0;s<ja;s++)j=n[s],f(j[0]+aa*m,j[1]+aa*m,j[2]+aa*m)}var W,S,l=0;e(u);l+=u.length;v=0;for(G=p.length;v<G;v++)A=p[v],e(A),l+=A.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 b(a,b,c){var d=Math.sqrt(a*a+b*b+c*c);return e.vertices.push(new THREE.Vertex(new THREE.Vector3(a/d,b/d,c/d)))-1}function c(a,b,c,d){var f=e.vertices[a].position,g=e.vertices[b].position,h=e.vertices[c].position,a=new THREE.Face3(a,b,c);a.vertexNormals.push(f.clone().normalize(),g.clone().normalize(),h.clone().normalize());d.faces.push(a);d.faceVertexUvs[0].push([new THREE.UV(1-(Math.atan2(f.z,f.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-f.y/2),new THREE.UV(1-
|
|
|
(Math.atan2(g.z,g.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-g.y/2),new THREE.UV(1-(Math.atan2(h.z,h.x)+Math.PI)%Math.PI/Math.PI*0.5,0.5-h.y/2)])}function d(a,c){var d=e.vertices[a].position,f=e.vertices[c].position;return b((d.x+f.x)/2,(d.y+f.y)/2,(d.z+f.z)/2)}var e=this,g=new THREE.Geometry;this.subdivisions=a||0;THREE.Geometry.call(this);a=(1+Math.sqrt(5))/2;b(-1,a,0);b(1,a,0);b(-1,-a,0);b(1,-a,0);b(0,-1,a);b(0,1,a);b(0,-1,-a);b(0,1,-a);b(a,0,-1);b(a,0,1);b(-a,0,-1);b(-a,0,1);c(0,11,5,g);c(0,5,1,g);c(0,
|
|
@@ -524,8 +524,8 @@ THREE.FontUtils={faces:{},face:"helvetiker",weight:"normal",style:"normal",size:
|
|
|
0,e=String(a).split(""),g=e.length,f=[],a=0;a<g;a++){var h=new THREE.Path,h=this.extractGlyphPoints(e[a],b,c,d,h);d+=h.offset;f.push(h.path)}return{paths:f,offset:d/2}},extractGlyphPoints:function(a,b,c,d,e){var g=[],f,h,i,j,k,o,p,m,q,n,r,t=b.glyphs[a]||b.glyphs["?"];if(t){if(t.o){b=t._cachedOutline||(t._cachedOutline=t.o.split(" "));j=b.length;for(a=0;a<j;)switch(i=b[a++],i){case "m":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,k));e.moveTo(i,k);break;case "l":i=b[a++]*c+d;k=b[a++]*c;g.push(new THREE.Vector2(i,
|
|
|
k));e.lineTo(i,k);break;case "q":i=b[a++]*c+d;k=b[a++]*c;m=b[a++]*c+d;q=b[a++]*c;e.quadraticCurveTo(m,q,i,k);if(f=g[g.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++){var u=f/h,y=THREE.Shape.Utils.b2(u,o,m,i),u=THREE.Shape.Utils.b2(u,p,q,k);g.push(new THREE.Vector2(y,u))}}break;case "b":if(i=b[a++]*c+d,k=b[a++]*c,m=b[a++]*c+d,q=b[a++]*-c,n=b[a++]*c+d,r=b[a++]*-c,e.bezierCurveTo(i,k,m,q,n,r),f=g[g.length-1]){o=f.x;p=f.y;f=1;for(h=this.divisions;f<=h;f++)u=f/h,y=THREE.Shape.Utils.b3(u,o,m,
|
|
|
n,i),u=THREE.Shape.Utils.b3(u,p,q,r,k),g.push(new THREE.Vector2(y,u))}}}return{offset:t.ha*c,points:g,path:e}}}};
|
|
|
-(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,j,k;if(b(a)>0)for(j=0;j<e;j++)f[j]=j;else for(j=0;j<e;j++)f[j]=e-1-j;var o=2*e;for(j=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);k=j+1;e<=k&&(k=0);var p;a:{p=a;var m=i,q=j,n=k,r=e,t=f,u=void 0,y=void 0,v=void 0,
|
|
|
-A=void 0,z=void 0,w=void 0,I=void 0,F=void 0,G=void 0,y=p[t[m]].x,v=p[t[m]].y,A=p[t[q]].x,z=p[t[q]].y,w=p[t[n]].x,I=p[t[n]].y;if(1.0E-10>(A-y)*(I-v)-(z-v)*(w-y))p=!1;else{for(u=0;u<r;u++)if(!(u==m||u==q||u==n)){var F=p[t[u]].x,G=p[t[u]].y,s=void 0,E=void 0,T=void 0,Z=void 0,Q=void 0,U=void 0,$=void 0,ja=void 0,K=void 0,L=void 0,H=void 0,O=void 0,s=T=Q=void 0,s=w-A,E=I-z,T=y-w,Z=v-I,Q=A-y,U=z-v,$=F-y,ja=G-v,K=F-A,L=G-z,H=F-w,O=G-I,s=s*L-E*K,Q=Q*ja-U*$,T=T*O-Z*H;if(s>=0&&T>=0&&Q>=0){p=!1;break a}}p=
|
|
|
+(function(a){var b=function(a){for(var b=a.length,e=0,g=b-1,f=0;f<b;g=f++)e+=a[g].x*a[f].y-a[f].x*a[g].y;return e*0.5};a.Triangulate=function(a,d){var e=a.length;if(e<3)return null;var g=[],f=[],h=[],i,j,k;if(b(a)>0)for(j=0;j<e;j++)f[j]=j;else for(j=0;j<e;j++)f[j]=e-1-j;var o=2*e;for(j=e-1;e>2;){if(o--<=0){console.log("Warning, unable to triangulate polygon!");if(d)return h;return g}i=j;e<=i&&(i=0);j=i+1;e<=j&&(j=0);k=j+1;e<=k&&(k=0);var p;a:{p=a;var m=i,q=j,n=k,r=e,t=f,u=void 0,y=void 0,w=void 0,
|
|
|
+z=void 0,A=void 0,v=void 0,G=void 0,F=void 0,K=void 0,y=p[t[m]].x,w=p[t[m]].y,z=p[t[q]].x,A=p[t[q]].y,v=p[t[n]].x,G=p[t[n]].y;if(1.0E-10>(z-y)*(G-w)-(A-w)*(v-y))p=!1;else{for(u=0;u<r;u++)if(!(u==m||u==q||u==n)){var F=p[t[u]].x,K=p[t[u]].y,s=void 0,N=void 0,U=void 0,$=void 0,R=void 0,V=void 0,aa=void 0,ja=void 0,I=void 0,L=void 0,C=void 0,P=void 0,s=U=R=void 0,s=v-z,N=G-A,U=y-v,$=w-G,R=z-y,V=A-w,aa=F-y,ja=K-w,I=F-z,L=K-A,C=F-v,P=K-G,s=s*L-N*I,R=R*ja-V*aa,U=U*P-$*C;if(s>=0&&U>=0&&R>=0){p=!1;break a}}p=
|
|
|
!0}}if(p){g.push([a[f[i]],a[f[j]],a[f[k]]]);h.push([f[i],f[j],f[k]]);i=j;for(k=j+1;k<e;i++,k++)f[i]=f[k];e--;o=2*e}}if(d)return h;return g};a.Triangulate.area=b;return a})(THREE.FontUtils);self._typeface_js={faces:THREE.FontUtils.faces,loadFace:THREE.FontUtils.loadFace};
|
|
|
THREE.TorusGeometry=function(a,b,c,d,e){THREE.Geometry.call(this);this.radius=a||100;this.tube=b||40;this.segmentsR=c||8;this.segmentsT=d||6;this.arc=e||Math.PI*2;e=new THREE.Vector3;a=[];b=[];for(c=0;c<=this.segmentsR;c++)for(d=0;d<=this.segmentsT;d++){var g=d/this.segmentsT*this.arc,f=c/this.segmentsR*Math.PI*2;e.x=this.radius*Math.cos(g);e.y=this.radius*Math.sin(g);var h=new THREE.Vector3;h.x=(this.radius+this.tube*Math.cos(f))*Math.cos(g);h.y=(this.radius+this.tube*Math.cos(f))*Math.sin(g);h.z=
|
|
|
this.tube*Math.sin(f);this.vertices.push(new THREE.Vertex(h));a.push(new THREE.UV(d/this.segmentsT,1-c/this.segmentsR));b.push(h.clone().subSelf(e).normalize())}for(c=1;c<=this.segmentsR;c++)for(d=1;d<=this.segmentsT;d++){var e=(this.segmentsT+1)*c+d-1,g=(this.segmentsT+1)*(c-1)+d-1,f=(this.segmentsT+1)*(c-1)+d,h=(this.segmentsT+1)*c+d,i=new THREE.Face4(e,g,f,h,[b[e],b[g],b[f],b[h]]);i.normal.addSelf(b[e]);i.normal.addSelf(b[g]);i.normal.addSelf(b[f]);i.normal.addSelf(b[h]);i.normal.normalize();this.faces.push(i);
|
|
@@ -536,11 +536,11 @@ e.z)))-1}}for(a=0;a<this.segmentsR;++a)for(b=0;b<this.segmentsT;++b){var d=(a+1)
|
|
|
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 b=this.subdivisions;b-- >0;)this.smooth(a)};
|
|
|
THREE.SubdivisionModifier.prototype.smooth=function(a){function b(a,b,c,d,h,i){var j=new THREE.Face4(a,b,c,d,null,h.color,h.material);if(f.useOldVertexColors){j.vertexColors=[];for(var k,m,l,n=0;n<4;n++){l=i[n];k=new THREE.Color;k.setRGB(0,0,0);for(var o=0;o<l.length;o++)m=h.vertexColors[l[o]-1],k.r+=m.r,k.g+=m.g,k.b+=m.b;k.r/=l.length;k.g/=l.length;k.b/=l.length;j.vertexColors[n]=k}}e.push(j);(!f.supportUVs||p.length!=0)&&g.push([p[a],p[b],p[c],p[d]])}function c(a,b){return Math.min(a,b)+"_"+Math.max(a,
|
|
|
b)}var d=[],e=[],g=[],f=this,h=a.vertices,d=a.faces,i=h.concat(),j=[],k={},o={},p=[],m,q,n,r,t,u=a.faceVertexUvs[0];m=0;for(q=u.length;m<q;m++){n=0;for(r=u[m].length;n<r;n++)t=d[m]["abcd".charAt(n)],p[t]||(p[t]=u[m][n])}var y;m=0;for(q=d.length;m<q;m++)if(t=d[m],j.push(t.centroid),i.push(new THREE.Vertex(t.centroid)),f.supportUVs&&p.length!=0){y=new THREE.UV;if(t instanceof THREE.Face3)y.u=p[t.a].u+p[t.b].u+p[t.c].u,y.v=p[t.a].v+p[t.b].v+p[t.c].v,y.u/=3,y.v/=3;else if(t instanceof THREE.Face4)y.u=
|
|
|
-p[t.a].u+p[t.b].u+p[t.c].u+p[t.d].u,y.v=p[t.a].v+p[t.b].v+p[t.c].v+p[t.d].v,y.u/=4,y.v/=4;p.push(y)}q=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].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=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var v=0,u=h.length,A,z,w={},I={},F=function(a,
|
|
|
-b){w[a]===void 0&&(w[a]=[]);w[a].push(b)},G=function(a,b){I[a]===void 0&&(I[a]={});I[a][b]=null};for(m in q){y=q[m];A=m.split("_");z=A[0];A=A[1];F(z,[z,A]);F(A,[z,A]);n=0;for(r=y.length;n<r;n++)t=y[n],G(z,t,m),G(A,t,m);y.length<2&&(o[m]=!0)}for(m in q)if(y=q[m],t=y[0],y=y[1],A=m.split("_"),z=A[0],A=A[1],r=new THREE.Vector3,o[m]?(r.addSelf(h[z].position),r.addSelf(h[A].position),r.multiplyScalar(0.5)):(r.addSelf(j[t]),r.addSelf(j[y]),r.addSelf(h[z].position),r.addSelf(h[A].position),r.multiplyScalar(0.25)),
|
|
|
-k[m]=u+d.length+v,i.push(new THREE.Vertex(r)),v++,f.supportUVs&&p.length!=0)y=new THREE.UV,y.u=p[z].u+p[A].u,y.v=p[z].v+p[A].v,y.u/=2,y.v/=2,p.push(y);var s,E;A=["123","12","2","23"];r=["123","23","3","31"];var F=["123","31","1","12"],G=["1234","12","2","23"],T=["1234","23","3","34"],Z=["1234","34","4","41"],Q=["1234","41","1","12"];m=0;for(q=j.length;m<q;m++)t=d[m],y=u+m,t instanceof THREE.Face3?(v=c(t.a,t.b),z=c(t.b,t.c),s=c(t.c,t.a),b(y,k[v],t.b,k[z],t,A),b(y,k[z],t.c,k[s],t,r),b(y,k[s],t.a,k[v],
|
|
|
-t,F)):t instanceof THREE.Face4?(v=c(t.a,t.b),z=c(t.b,t.c),s=c(t.c,t.d),E=c(t.d,t.a),b(y,k[v],t.b,k[z],t,G),b(y,k[z],t.c,k[s],t,T),b(y,k[s],t.d,k[E],t,Z),b(y,k[E],t.a,k[v],t,Q)):console.log("face should be a face!",t);d=i;i=new THREE.Vector3;k=new THREE.Vector3;m=0;for(q=h.length;m<q;m++)if(w[m]!==void 0){i.set(0,0,0);k.set(0,0,0);t=new THREE.Vector3(0,0,0);y=0;for(n in I[m])i.addSelf(j[n]),y++;v=0;u=w[m].length;for(n=0;n<u;n++)o[c(w[m][n][0],w[m][n][1])]&&v++;if(v!=2){i.divideScalar(y);for(n=0;n<
|
|
|
-u;n++)y=w[m][n],y=h[y[0]].position.clone().addSelf(h[y[1]].position).divideScalar(2),k.addSelf(y);k.divideScalar(u);t.addSelf(h[m].position);t.multiplyScalar(u-3);t.addSelf(i);t.addSelf(k.multiplyScalar(2));t.divideScalar(u);d[m].position=t}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;delete a.__tmpVertices;a.computeCentroids();a.computeFaceNormals();a.computeVertexNormals()};
|
|
|
+p[t.a].u+p[t.b].u+p[t.c].u+p[t.d].u,y.v=p[t.a].v+p[t.b].v+p[t.c].v+p[t.d].v,y.u/=4,y.v/=4;p.push(y)}q=function(a){function b(a,c,d){a[c]===void 0&&(a[c]=[]);a[c].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=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.a),b(h,g,d)):f instanceof THREE.Face4&&(g=c(f.a,f.b),b(h,g,d),g=c(f.b,f.c),b(h,g,d),g=c(f.c,f.d),b(h,g,d),g=c(f.d,f.a),b(h,g,d));return h}(a);var w=0,u=h.length,z,A,v={},G={},F=function(a,
|
|
|
+b){v[a]===void 0&&(v[a]=[]);v[a].push(b)},K=function(a,b){G[a]===void 0&&(G[a]={});G[a][b]=null};for(m in q){y=q[m];z=m.split("_");A=z[0];z=z[1];F(A,[A,z]);F(z,[A,z]);n=0;for(r=y.length;n<r;n++)t=y[n],K(A,t,m),K(z,t,m);y.length<2&&(o[m]=!0)}for(m in q)if(y=q[m],t=y[0],y=y[1],z=m.split("_"),A=z[0],z=z[1],r=new THREE.Vector3,o[m]?(r.addSelf(h[A].position),r.addSelf(h[z].position),r.multiplyScalar(0.5)):(r.addSelf(j[t]),r.addSelf(j[y]),r.addSelf(h[A].position),r.addSelf(h[z].position),r.multiplyScalar(0.25)),
|
|
|
+k[m]=u+d.length+w,i.push(new THREE.Vertex(r)),w++,f.supportUVs&&p.length!=0)y=new THREE.UV,y.u=p[A].u+p[z].u,y.v=p[A].v+p[z].v,y.u/=2,y.v/=2,p.push(y);var s,N;z=["123","12","2","23"];r=["123","23","3","31"];var F=["123","31","1","12"],K=["1234","12","2","23"],U=["1234","23","3","34"],$=["1234","34","4","41"],R=["1234","41","1","12"];m=0;for(q=j.length;m<q;m++)t=d[m],y=u+m,t instanceof THREE.Face3?(w=c(t.a,t.b),A=c(t.b,t.c),s=c(t.c,t.a),b(y,k[w],t.b,k[A],t,z),b(y,k[A],t.c,k[s],t,r),b(y,k[s],t.a,k[w],
|
|
|
+t,F)):t instanceof THREE.Face4?(w=c(t.a,t.b),A=c(t.b,t.c),s=c(t.c,t.d),N=c(t.d,t.a),b(y,k[w],t.b,k[A],t,K),b(y,k[A],t.c,k[s],t,U),b(y,k[s],t.d,k[N],t,$),b(y,k[N],t.a,k[w],t,R)):console.log("face should be a face!",t);d=i;i=new THREE.Vector3;k=new THREE.Vector3;m=0;for(q=h.length;m<q;m++)if(v[m]!==void 0){i.set(0,0,0);k.set(0,0,0);t=new THREE.Vector3(0,0,0);y=0;for(n in G[m])i.addSelf(j[n]),y++;w=0;u=v[m].length;for(n=0;n<u;n++)o[c(v[m][n][0],v[m][n][1])]&&w++;if(w!=2){i.divideScalar(y);for(n=0;n<
|
|
|
+u;n++)y=v[m][n],y=h[y[0]].position.clone().addSelf(h[y[1]].position).divideScalar(2),k.addSelf(y);k.divideScalar(u);t.addSelf(h[m].position);t.multiplyScalar(u-3);t.addSelf(i);t.addSelf(k.multiplyScalar(2));t.divideScalar(u);d[m].position=t}}a.vertices=d;a.faces=e;a.faceVertexUvs[0]=g;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 b="Loaded ";b+=a.total?(100*a.loaded/a.total).toFixed(0)+"%":(a.loaded/
|
|
|
1E3).toFixed(2)+" KB";this.statusDomElement.innerHTML=b},extractUrlbase:function(a){a=a.split("/");a.pop();return a.length<1?"":a.join("/")+"/"},initMaterials:function(a,b,c){a.materials=[];for(var d=0;d<b.length;++d)a.materials[d]=THREE.Loader.prototype.createMaterial(b[d],c)},hasNormals:function(a){var b,c,d=a.materials.length;for(c=0;c<d;c++)if(b=a.materials[c],b instanceof THREE.ShaderMaterial)return!0;return!1},createMaterial:function(a,b){function c(a){a=Math.log(a)/Math.LN2;return Math.floor(a)==
|
|
@@ -559,17 +559,17 @@ THREE.BinaryLoader.prototype.createBinModel=function(a,b,c,d){var e=function(b){
|
|
|
function k(b,c){var d,e,f,g,h,i,j,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=y[e*2];e=y[e*2+1];j=y[f*2];m=y[f*2+1];k=y[g*2];o=y[g*2+1];g=y[h*2];f=y[h*2+1];h=n.faceVertexUvs[0];var q=[];q.push(new THREE.UV(i,e));q.push(new THREE.UV(j,m));q.push(new THREE.UV(k,o));q.push(new THREE.UV(g,f));h.push(q)}}function o(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 p(b,c,d){for(var e,f,g,h,i,c=new Uint32Array(a,c,4*b),j=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=j[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,j,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];j=d[e*3];k=d[e*3+1];m=d[e*3+2];i=o[e];var p=u[k*3],q=u[k*3+1];k=u[k*3+2];var r=u[m*3],l=u[m*3+1];m=u[m*3+2];n.faces.push(new THREE.Face3(f,
|
|
|
g,h,[new THREE.Vector3(u[j*3],u[j*3+1],u[j*3+2]),new THREE.Vector3(p,q,k),new THREE.Vector3(r,l,m)],null,i))}}function q(b,c,d,e){for(var f,g,h,i,j,k,m,o,p,c=new Uint32Array(a,c,4*b),d=new Uint32Array(a,d,4*b),q=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];j=q[e];var r=u[m*3],l=u[m*3+1];m=u[m*3+2];var t=u[o*3],v=u[o*3+1];o=u[o*3+2];var w=u[p*3],y=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(r,l,m),new THREE.Vector3(t,v,o),new THREE.Vector3(w,y,p)],null,j))}}var n=this,r=0,t,u=[],y=[],v,A,z,w,I,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);t={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,r,12),header_bytes:e(a,r+12),vertex_coordinate_bytes:e(a,r+13),normal_coordinate_bytes:e(a,r+14),uv_coordinate_bytes:e(a,r+15),vertex_index_bytes:e(a,r+16),normal_index_bytes:e(a,
|
|
|
+3],u[k*3+1],u[k*3+2]),new THREE.Vector3(r,l,m),new THREE.Vector3(t,v,o),new THREE.Vector3(w,y,p)],null,j))}}var n=this,r=0,t,u=[],y=[],w,z,A,v,G,F;THREE.Geometry.call(this);THREE.Loader.prototype.initMaterials(n,d,b);t={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,r,12),header_bytes:e(a,r+12),vertex_coordinate_bytes:e(a,r+13),normal_coordinate_bytes:e(a,r+14),uv_coordinate_bytes:e(a,r+15),vertex_index_bytes:e(a,r+16),normal_index_bytes:e(a,
|
|
|
r+17),uv_index_bytes:e(a,r+18),material_index_bytes:e(a,r+19),nvertices:i(a,r+20),nnormals:i(a,r+20+4),nuvs:i(a,r+20+8),ntri_flat:i(a,r+20+12),ntri_smooth:i(a,r+20+16),ntri_flat_uv:i(a,r+20+20),ntri_smooth_uv:i(a,r+20+24),nquad_flat:i(a,r+20+28),nquad_smooth:i(a,r+20+32),nquad_flat_uv:i(a,r+20+36),nquad_smooth_uv:i(a,r+20+40)};t.signature!=="Three.js 003"&&console.warn("DEPRECATED: binary model seems to be using old format");r+=t.header_bytes;b=t.vertex_index_bytes*3+t.material_index_bytes;F=t.vertex_index_bytes*
|
|
|
-4+t.material_index_bytes;v=t.ntri_flat*b;A=t.ntri_smooth*(b+t.normal_index_bytes*3);z=t.ntri_flat_uv*(b+t.uv_index_bytes*3);w=t.ntri_smooth_uv*(b+t.normal_index_bytes*3+t.uv_index_bytes*3);I=t.nquad_flat*F;b=t.nquad_smooth*(F+t.normal_index_bytes*4);F=t.nquad_flat_uv*(F+t.uv_index_bytes*4);r+=function(b){var c=t.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}(r);
|
|
|
-r+=function(b){var c=t.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}(r);r+=c(t.nnormals*3);r+=function(b){var c=t.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],y.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(r);v=r+v+c(t.ntri_flat*2);A=v+A+c(t.ntri_smooth*2);z=A+z+c(t.ntri_flat_uv*2);w=z+w+c(t.ntri_smooth_uv*2);I=w+I+c(t.nquad_flat*2);
|
|
|
-b=I+b+c(t.nquad_smooth*2);F=b+F+c(t.nquad_flat_uv*2);(function(a){var b=t.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);j(b,c)}})(A);(function(a){var b=t.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);j(b,d)}})(z);(function(a){var b=t.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,
|
|
|
-c)}})(b);(function(a){var b=t.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(F);(function(a){var b=t.ntri_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(r);(function(a){var b=t.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(v);(function(a){var b=t.nquad_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(w);(function(a){var b=
|
|
|
-t.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(I);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
|
|
|
-THREE.ColladaLoader=function(){function a(a,d,e){ca=a;d=d||W;e!==void 0&&(a=e.split("/"),a.pop(),Ba=a.length<1?"":a.join("/")+"/");na=b("//dae:library_images/dae:image",f,"image");oa=b("//dae:library_materials/dae:material",I,"material");ta=b("//dae:library_effects/dae:effect",T,"effect");ra=b("//dae:library_geometries/dae:geometry",r,"geometry");qa=b("//dae:library_controllers/dae:controller",h,"controller");ia=b("//dae:library_animations/dae:animation",Q,"animation");pa=b(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
-k,"visual_scene");wa=[];va=[];(a=ca.evaluate(".//dae:scene/dae:instance_visual_scene",ca,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),fa=pa[a]):fa=null;N=new THREE.Object3D;for(a=0;a<fa.nodes.length;a++)N.add(g(fa.nodes[a]));c();for(var i in ia);i={scene:N,morphs:wa,skins:va,dae:{images:na,materials:oa,effects:ta,geometries:ra,controllers:qa,animations:ia,visualScenes:pa,scene:fa}};d&&d(i);return i}function b(a,b,c){for(var a=ca.evaluate(a,
|
|
|
-ca,K,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 c(){var a=1E6,b=-a,c=0,d;for(d in ia)for(var e=ia[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 e(a,b,e){var f=qa[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=c(),b=fa.getChildById(b.skeleton[0],!0)||fa.getChildBySid(b.skeleton[0],!0),h,i,j,k,l=new THREE.Vector3,
|
|
|
+4+t.material_index_bytes;w=t.ntri_flat*b;z=t.ntri_smooth*(b+t.normal_index_bytes*3);A=t.ntri_flat_uv*(b+t.uv_index_bytes*3);v=t.ntri_smooth_uv*(b+t.normal_index_bytes*3+t.uv_index_bytes*3);G=t.nquad_flat*F;b=t.nquad_smooth*(F+t.normal_index_bytes*4);F=t.nquad_flat_uv*(F+t.uv_index_bytes*4);r+=function(b){var c=t.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}(r);
|
|
|
+r+=function(b){var c=t.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}(r);r+=c(t.nnormals*3);r+=function(b){var c=t.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],y.push(e,f)}return c*2*Float32Array.BYTES_PER_ELEMENT}(r);w=r+w+c(t.ntri_flat*2);z=w+z+c(t.ntri_smooth*2);A=z+A+c(t.ntri_flat_uv*2);v=A+v+c(t.ntri_smooth_uv*2);G=v+G+c(t.nquad_flat*2);
|
|
|
+b=G+b+c(t.nquad_smooth*2);F=b+F+c(t.nquad_flat_uv*2);(function(a){var b=t.ntri_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;o(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*3);j(b,c)}})(z);(function(a){var b=t.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);j(b,d)}})(A);(function(a){var b=t.nquad_flat_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;p(b,a,c+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,
|
|
|
+c)}})(b);(function(a){var b=t.nquad_smooth_uv;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4,d=c+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c,d+b*Uint32Array.BYTES_PER_ELEMENT*4);k(b,d)}})(F);(function(a){var b=t.ntri_flat;b&&o(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*3)})(r);(function(a){var b=t.ntri_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*3;m(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*3)}})(w);(function(a){var b=t.nquad_flat;b&&p(b,a,a+b*Uint32Array.BYTES_PER_ELEMENT*4)})(v);(function(a){var b=
|
|
|
+t.nquad_smooth;if(b){var c=a+b*Uint32Array.BYTES_PER_ELEMENT*4;q(b,a,c,c+b*Uint32Array.BYTES_PER_ELEMENT*4)}})(G);this.computeCentroids();this.computeFaceNormals();THREE.Loader.prototype.hasNormals(this)&&this.computeTangents()};e.prototype=new THREE.Geometry;e.prototype.constructor=e;b(new e(c))};
|
|
|
+THREE.ColladaLoader=function(){function a(a,d,e){da=a;d=d||X;e!==void 0&&(a=e.split("/"),a.pop(),Ba=a.length<1?"":a.join("/")+"/");na=b("//dae:library_images/dae:image",f,"image");oa=b("//dae:library_materials/dae:material",G,"material");ta=b("//dae:library_effects/dae:effect",U,"effect");ra=b("//dae:library_geometries/dae:geometry",r,"geometry");qa=b("//dae:library_controllers/dae:controller",h,"controller");ia=b("//dae:library_animations/dae:animation",R,"animation");pa=b(".//dae:library_visual_scenes/dae:visual_scene",
|
|
|
+k,"visual_scene");wa=[];va=[];(a=da.evaluate(".//dae:scene/dae:instance_visual_scene",da,I,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())?(a=a.getAttribute("url").replace(/^#/,""),ga=pa[a]):ga=null;O=new THREE.Object3D;for(a=0;a<ga.nodes.length;a++)O.add(g(ga.nodes[a]));c();for(var i in ia);i={scene:O,morphs:wa,skins:va,dae:{images:na,materials:oa,effects:ta,geometries:ra,controllers:qa,animations:ia,visualScenes:pa,scene:ga}};d&&d(i);return i}function b(a,b,c){for(var a=da.evaluate(a,
|
|
|
+da,I,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 c(){var a=1E6,b=-a,c=0,d;for(d in ia)for(var e=ia[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 e(a,b,e){var f=qa[b.url];if(!f||!f.skin)console.log("ColladaLoader: Could not find skin controller.");else if(!b.skeleton||!b.skeleton.length)console.log("ColladaLoader: Could not find the skeleton for the skin. ");else{var g=c(),b=ga.getChildById(b.skeleton[0],!0)||ga.getChildBySid(b.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(b,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 r=i.weights[p][q];r.joint==m&&j.weights.push(r)}}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 g(a){var b=
|
|
|
new THREE.Object3D,c,d,f,h;for(f=0;f<a.controllers.length;f++){var i=qa[a.controllers[f].url];switch(i.type){case "skin":if(ra[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(qa[i.skin.source]&&(d=i=qa[i.skin.source],i.morph&&ra[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(ra[i.morph.source])j=new n,
|
|
@@ -578,89 +578,89 @@ p.material;l++}j=o||new THREE.MeshLambertMaterial({color:14540253,shading:THREE.
|
|
|
else{k=k.morph;for(l=0;l<k.targets.length;l++)if(p=ra[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_"+wa.length;wa.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(g(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 j(){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 o(){this.sid=this.name=this.id="";this.nodes=[];this.controllers=
|
|
|
[];this.transforms=[];this.geometries=[];this.channels=[];this.matrix=new THREE.Matrix4}function p(){this.type=this.sid="";this.data=[];this.matrix=new THREE.Matrix4}function m(){this.url="";this.skeleton=[];this.instance_material=[]}function q(){this.target=this.symbol=""}function n(){this.url="";this.instance_material=[]}function r(){this.id="";this.mesh=null}function t(a){this.geometry=a.id;this.primitives=[];this.geometry3js=this.vertices=null}function u(){}function y(){this.material="";this.count=
|
|
|
-0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function v(){this.source="";this.stride=this.count=0;this.params=[]}function A(){this.input={}}function z(){this.semantic="";this.offset=0;this.source="";this.set=0}function w(a){this.id=a;this.type=null}function I(){this.name=this.id="";this.instance_effect=null}function F(){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 G(a,
|
|
|
-b){this.type=a;this.effect=b;this.material=null}function s(a){this.effect=a;this.format=this.init_from=null}function E(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function T(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function Z(){this.url=""}function Q(){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 $(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ja(a){var b=a.getAttribute("id");if(ba[b]!=void 0)return ba[b];ba[b]=(new w(b)).parse(a);return ba[b]}function K(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=O(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function H(a){for(var a=O(a),b=[],c=
|
|
|
-0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function O(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function V(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function R(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 l(a,b){var c="";c+=R(a.x,b)+",";c+=R(a.y,b)+",";c+=R(a.z,b);return c}var ca=null,N=null,fa,W=null,
|
|
|
-ba={},na={},ia={},qa={},ra={},oa={},ta={},pa,Ba,wa,va,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 j).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 w).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 z).parse(d))}}return b};j.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=
|
|
|
-L(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 w).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};j.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 z).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()}}};j.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 z).parse(g));break;case "v":c=H(g.textContent);break;case "vcount":d=H(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=
|
|
|
+0;this.inputs=[];this.vcount=null;this.p=[];this.geometry=new THREE.Geometry}function w(){this.source="";this.stride=this.count=0;this.params=[]}function z(){this.input={}}function A(){this.semantic="";this.offset=0;this.source="";this.set=0}function v(a){this.id=a;this.type=null}function G(){this.name=this.id="";this.instance_effect=null}function F(){this.color=new THREE.Color(0);this.color.setRGB(Math.random(),Math.random(),Math.random());this.color.a=1;this.texcoord=this.texture=null}function K(a,
|
|
|
+b){this.type=a;this.effect=b;this.material=null}function s(a){this.effect=a;this.format=this.init_from=null}function N(a){this.effect=a;this.mipfilter=this.magfilter=this.minfilter=this.wrap_t=this.wrap_s=this.source=null}function U(){this.name=this.id="";this.sampler=this.surface=this.shader=null}function $(){this.url=""}function R(){this.name=this.id="";this.source={};this.sampler=[];this.channel=[]}function V(a){this.animation=a;this.target=this.source="";this.member=this.arrIndices=this.arrSyntax=
|
|
|
+this.dotSyntax=this.sid=null}function aa(a){this.id="";this.animation=a;this.inputs=[];this.endTime=this.startTime=this.interpolation=this.output=this.input=null;this.duration=0}function ja(a){var b=a.getAttribute("id");if(ca[b]!=void 0)return ca[b];ca[b]=(new v(b)).parse(a);return ca[b]}function I(a){if(a=="dae")return"http://www.collada.org/2005/11/COLLADASchema";return null}function L(a){for(var a=P(a),b=[],c=0;c<a.length;c++)b.push(parseFloat(a[c]));return b}function C(a){for(var a=P(a),b=[],
|
|
|
+c=0;c<a.length;c++)b.push(parseInt(a[c],10));return b}function P(a){return a.replace(/^\s+/,"").replace(/\s+$/,"").split(/\s+/)}function W(a,b,c){return a.hasAttribute(b)?parseInt(a.getAttribute(b),10):c}function S(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 l(a,b){var c="";c+=S(a.x,b)+",";c+=S(a.y,b)+",";c+=S(a.z,b);return c}var da=null,O=null,ga,X=null,
|
|
|
+ca={},na={},ia={},qa={},ra={},oa={},ta={},pa,Ba,wa,va,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 j).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 A).parse(d))}}return b};j.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=
|
|
|
+L(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};j.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 A).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()}}};j.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 A).parse(g));break;case "v":c=C(g.textContent);break;case "vcount":d=C(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 o).parse(c))}}return this};o.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};o.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};o.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};o.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};o.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 o).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=ca.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",ca,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;
|
|
|
+1)switch(b.nodeName){case "node":this.nodes.push((new o).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=da.evaluate(".//dae:library_nodes//dae:node[@id='"+b+"']",da,I,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null).iterateNext())&&this.nodes.push((new o).parse(b));break;
|
|
|
case "rotate":case "translate":case "scale":case "matrix":case "lookat":case "skew":this.transforms.push((new p).parse(b));break;case "extra":break;default:console.log(b.nodeName)}a=[];c=1E6;b=-1E6;for(var d in ia)for(var e=ia[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};o.prototype.updateMatrix=function(){this.matrix.identity();for(var a=0;a<this.transforms.length;a++)this.matrix.multiply(this.matrix,this.transforms[a].matrix)};p.prototype.parse=function(a){this.sid=a.getAttribute("sid");this.type=a.nodeName;this.data=L(a.textContent);this.updateMatrix();return this};
|
|
|
p.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=ca.evaluate(".//dae:instance_material",c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
-null))for(var d=c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.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=ca.evaluate(".//dae:instance_material",
|
|
|
-c,K,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};r.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 t(this)).parse(c)}}return this};t.prototype.parse=function(a){function b(a,c){var d=l(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":ja(d);break;case "vertices":this.vertices=(new A).parse(d);break;case "triangles":this.primitives.push((new y).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=ba[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],
|
|
|
+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=da.evaluate(".//dae:instance_material",c,I,XPathResult.ORDERED_NODE_ITERATOR_TYPE,
|
|
|
+null))for(var d=c.iterateNext();d;)this.instance_material.push((new q).parse(d)),d=c.iterateNext()}}return this};q.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=da.evaluate(".//dae:instance_material",
|
|
|
+c,I,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null))for(b=a.iterateNext();b;)this.instance_material.push((new q).parse(b)),b=a.iterateNext();break}}return this};r.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 t(this)).parse(c)}}return this};t.prototype.parse=function(a){function b(a,c){var d=l(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":ja(d);break;case "vertices":this.vertices=(new z).parse(d);break;case "triangles":this.primitives.push((new y).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=ca[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};t.prototype.handlePrimitive=function(a,b,c){var d=0,e,f,g=a.p,h=a.inputs,i,j,k,m,n=0,o=3,p=[];for(e=0;e<h.length;e++)switch(i=h[e],i.semantic){case "TEXCOORD":p.push(i.set)}for(;d<
|
|
|
-g.length;){var q=[],r=[],t={},s=[];a.vcount&&(o=a.vcount[n++]);for(e=0;e<o;e++)for(f=0;f<h.length;f++)switch(i=h[f],m=ba[i.source],j=g[d+e*h.length+i.offset],k=m.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=l(b.vertices[j].position);q.push(c[i].index);break;case "NORMAL":r.push(new THREE.Vector3(m.data[k],m.data[k+1],m.data[k+2]));break;case "TEXCOORD":t[i.set]===void 0&&(t[i.set]=[]);t[i.set].push(new THREE.UV(m.data[k],m.data[k+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(m.data[k],
|
|
|
+g.length;){var q=[],r=[],t={},s=[];a.vcount&&(o=a.vcount[n++]);for(e=0;e<o;e++)for(f=0;f<h.length;f++)switch(i=h[f],m=ca[i.source],j=g[d+e*h.length+i.offset],k=m.accessor.params.length,k*=j,i.semantic){case "VERTEX":i=l(b.vertices[j].position);q.push(c[i].index);break;case "NORMAL":r.push(new THREE.Vector3(m.data[k],m.data[k+1],m.data[k+2]));break;case "TEXCOORD":t[i.set]===void 0&&(t[i.set]=[]);t[i.set].push(new THREE.UV(m.data[k],m.data[k+1]));break;case "COLOR":s.push((new THREE.Color).setRGB(m.data[k],
|
|
|
m.data[k+1],m.data[k+2]))}var u;o==3?u=new THREE.Face3(q[0],q[1],q[2],[r[0],r[1],r[2]],s.length?s:new THREE.Color):o==4&&(u=new THREE.Face4(q[0],q[1],q[2],q[3],[r[0],r[1],r[2],r[3]],s.length?s:new THREE.Color));u.daeMaterial=a.material;b.faces.push(u);for(f=0;f<p.length;f++)e=t[p[f]],b.faceVertexUvs[f].push([e[0],e[1],e[2]]);d+=h.length*o}};u.prototype=new y;u.prototype.constructor=u;y.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};y.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=V(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 z).parse(a.childNodes[b]));break;case "vcount":this.vcount=H(c.textContent);break;case "p":this.p=H(c.textContent)}}return this};v.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=V(a,"count",0);this.stride=
|
|
|
-V(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};A.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 z).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};z.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
|
|
|
-"");this.set=V(a,"set",-1);this.offset=V(a,"offset",0);if(this.semantic=="TEXCOORD"&&this.set<0)this.set=0;return this};w.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=O(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=L(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
-H(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=O(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 v).parse(c.childNodes[d]);break}}}return this};w.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};I.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 Z).parse(a.childNodes[b]);break}return this};F.prototype.isColor=
|
|
|
-function(){return this.texture==null};F.prototype.isTexture=function(){return this.texture!=null};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 "color":c=L(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};G.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 F).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=ca.evaluate(".//dae:float",c,K,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};G.prototype.create=function(){var a=
|
|
|
+a.input.POSITION.source};y.prototype.parse=function(a){this.inputs=[];this.material=a.getAttribute("material");this.count=W(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 A).parse(a.childNodes[b]));break;case "vcount":this.vcount=C(c.textContent);break;case "p":this.p=C(c.textContent)}}return this};w.prototype.parse=function(a){this.params=[];this.source=a.getAttribute("source");this.count=W(a,"count",0);this.stride=
|
|
|
+W(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};z.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 A).parse(a.childNodes[b]);this.input[c.semantic]=c}return this};A.prototype.parse=function(a){this.semantic=a.getAttribute("semantic");this.source=a.getAttribute("source").replace(/^#/,
|
|
|
+"");this.set=W(a,"set",-1);this.offset=W(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=P(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=L(c.textContent);this.type=c.nodeName;break;case "int_array":this.data=
|
|
|
+C(c.textContent);this.type=c.nodeName;break;case "IDREF_array":case "Name_array":this.data=P(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 w).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};G.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 $).parse(a.childNodes[b]);break}return this};F.prototype.isColor=
|
|
|
+function(){return this.texture==null};F.prototype.isTexture=function(){return this.texture!=null};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 "color":c=L(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};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 "ambient":case "emission":case "diffuse":case "specular":case "transparent":this[c.nodeName]=(new F).parse(c);break;case "shininess":case "reflectivity":case "transparency":var d;d=da.evaluate(".//dae:float",c,I,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};K.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 F)if(d.isTexture()){if(this.effect.sampler&&this.effect.surface&&this.effect.sampler.source==this.effect.surface.sid&&(d=na[this.effect.surface.init_from]))a.map=THREE.ImageUtils.loadTexture(Ba+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)};s.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};E.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};
|
|
|
-T.prototype.create=function(){if(this.shader==null)return null};T.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};T.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 s(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new E(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};T.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};
|
|
|
-T.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 G(c.nodeName,this)).parse(c)}}};Z.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};Q.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 w).parse(c);this.source[c.id]=c;break;case "sampler":this.sampler.push((new $(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};$.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 z).parse(c))}}return this};$.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.nodeName)}}return this};N.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};
|
|
|
+U.prototype.create=function(){if(this.shader==null)return null};U.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};U.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 s(this)).parse(d);this.surface.sid=b;break;case "sampler2D":this.sampler=(new N(this)).parse(d);this.sampler.sid=b;break;case "extra":break;default:console.log(d.nodeName)}}};U.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};
|
|
|
+U.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 K(c.nodeName,this)).parse(c)}}};$.prototype.parse=function(a){this.url=a.getAttribute("url").replace(/^#/,"");return this};R.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 aa(this)).parse(c));break;case "channel":this.channel.push((new V(this)).parse(c))}}return this};V.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};aa.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 A).parse(c))}}return this};aa.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))W=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:e,geometries:ra}};
|
|
|
+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))X=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:e,geometries:ra}};
|
|
|
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,b,c){if(a instanceof Object)console.warn("DEPRECATED: JSONLoader( parameters ) is now JSONLoader( url, callback, texturePath )."),c=a,a=c.model,b=c.callback,c=c.texture_path;c=c?c:this.extractUrlbase(a);this.onLoadStart();this.loadAjaxJSON(this,a,b,c)};
|
|
|
THREE.JSONLoader.prototype.loadAjaxJSON=function(a,b,c,d,e){var g=new XMLHttpRequest,f=0;g.onreadystatechange=function(){if(g.readyState==4)if(g.status==200||g.status==0)try{var h=JSON.parse(g.responseText);a.createModel(h,c,d);a.onLoadComplete()}catch(i){console.error(i),console.warn("DEPRECATED: ["+b+"] seems to be using old model format")}else console.error("Couldn't load ["+b+"] ["+g.status+"]");else g.readyState==3?e&&(f==0&&(f=g.getResponseHeader("Content-Length")),e({total:f,loaded:g.responseText.length})):
|
|
|
g.readyState==2&&(f=g.getResponseHeader("Content-Length"))};g.open("GET",b,!0);g.overrideMimeType("text/plain; charset=x-user-defined");g.setRequestHeader("Content-Type","text/plain");g.send(null)};
|
|
|
-THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,j,k,o,p,m,q,n,r,t,u,y,v=a.faces;o=a.vertices;var A=a.normals,z=a.colors,w=0;for(c=0;c<a.uvs.length;c++)a.uvs[c].length&&w++;for(c=0;c<w;c++)d.faceUvs[c]=[],d.faceVertexUvs[c]=[];j=0;for(k=o.length;j<
|
|
|
-k;)p=new THREE.Vertex,p.position.x=o[j++]*b,p.position.y=o[j++]*b,p.position.z=o[j++]*b,d.vertices.push(p);j=0;for(k=v.length;j<k;){b=v[j++];o=b&1;i=b&2;c=b&4;e=b&8;m=b&16;p=b&32;n=b&64;b&=128;o?(r=new THREE.Face4,r.a=v[j++],r.b=v[j++],r.c=v[j++],r.d=v[j++],o=4):(r=new THREE.Face3,r.a=v[j++],r.b=v[j++],r.c=v[j++],o=3);if(i)i=v[j++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<w;c++)t=a.uvs[c],q=v[j++],y=t[q*2],q=t[q*2+1],d.faceUvs[c][i]=new THREE.UV(y,q);if(e)for(c=0;c<w;c++){t=a.uvs[c];u=[];
|
|
|
-for(e=0;e<o;e++)q=v[j++],y=t[q*2],q=t[q*2+1],u[e]=new THREE.UV(y,q);d.faceVertexUvs[c][i]=u}if(m)m=v[j++]*3,e=new THREE.Vector3,e.x=A[m++],e.y=A[m++],e.z=A[m],r.normal=e;if(p)for(c=0;c<o;c++)m=v[j++]*3,e=new THREE.Vector3,e.x=A[m++],e.y=A[m++],e.z=A[m],r.vertexNormals.push(e);if(n)p=v[j++],p=new THREE.Color(z[p]),r.color=p;if(b)for(c=0;c<o;c++)p=v[j++],p=new THREE.Color(z[p]),r.vertexColors.push(p);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
|
|
|
+THREE.JSONLoader.prototype.createModel=function(a,b,c){var d=new THREE.Geometry,e=a.scale!==void 0?1/a.scale:1;this.initMaterials(d,a.materials,c);(function(b){if(a.metadata===void 0||a.metadata.formatVersion===void 0||a.metadata.formatVersion!==3)console.error("Deprecated file format.");else{var c,e,i,j,k,o,p,m,q,n,r,t,u,y,w=a.faces;o=a.vertices;var z=a.normals,A=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]=[];j=0;for(k=o.length;j<
|
|
|
+k;)p=new THREE.Vertex,p.position.x=o[j++]*b,p.position.y=o[j++]*b,p.position.z=o[j++]*b,d.vertices.push(p);j=0;for(k=w.length;j<k;){b=w[j++];o=b&1;i=b&2;c=b&4;e=b&8;m=b&16;p=b&32;n=b&64;b&=128;o?(r=new THREE.Face4,r.a=w[j++],r.b=w[j++],r.c=w[j++],r.d=w[j++],o=4):(r=new THREE.Face3,r.a=w[j++],r.b=w[j++],r.c=w[j++],o=3);if(i)i=w[j++],r.materialIndex=i;i=d.faces.length;if(c)for(c=0;c<v;c++)t=a.uvs[c],q=w[j++],y=t[q*2],q=t[q*2+1],d.faceUvs[c][i]=new THREE.UV(y,q);if(e)for(c=0;c<v;c++){t=a.uvs[c];u=[];
|
|
|
+for(e=0;e<o;e++)q=w[j++],y=t[q*2],q=t[q*2+1],u[e]=new THREE.UV(y,q);d.faceVertexUvs[c][i]=u}if(m)m=w[j++]*3,e=new THREE.Vector3,e.x=z[m++],e.y=z[m++],e.z=z[m],r.normal=e;if(p)for(c=0;c<o;c++)m=w[j++]*3,e=new THREE.Vector3,e.x=z[m++],e.y=z[m++],e.z=z[m],r.vertexNormals.push(e);if(n)p=w[j++],p=new THREE.Color(A[p]),r.color=p;if(b)for(c=0;c<o;c++)p=w[j++],p=new THREE.Color(A[p]),r.vertexColors.push(p);d.faces.push(r)}}})(e);(function(){var b,c,e,i;if(a.skinWeights){b=0;for(c=a.skinWeights.length;b<c;b+=
|
|
|
2)e=a.skinWeights[b],i=a.skinWeights[b+1],d.skinWeights.push(new THREE.Vector4(e,i,0,0))}if(a.skinIndices){b=0;for(c=a.skinIndices.length;b<c;b+=2)e=a.skinIndices[b],i=a.skinIndices[b+1],d.skinIndices.push(new THREE.Vector4(e,i,0,0))}d.bones=a.bones;d.animation=a.animation})();(function(b){if(a.morphTargets!==void 0){var c,e,i,j,k,o,p,m,q;c=0;for(e=a.morphTargets.length;c<e;c++){d.morphTargets[c]={};d.morphTargets[c].name=a.morphTargets[c].name;d.morphTargets[c].vertices=[];m=d.morphTargets[c].vertices;
|
|
|
q=a.morphTargets[c].vertices;i=0;for(j=q.length;i<j;i+=3)k=q[i]*b,o=q[i+1]*b,p=q[i+2]*b,m.push(new THREE.Vertex(new THREE.Vector3(k,o,p)))}}if(a.morphColors!==void 0){c=0;for(e=a.morphColors.length;c<e;c++){d.morphColors[c]={};d.morphColors[c].name=a.morphColors[c].name;d.morphColors[c].colors=[];j=d.morphColors[c].colors;k=a.morphColors[c].colors;b=0;for(i=k.length;b<i;b+=3)o=new THREE.Color(16755200),o.setRGB(k[b],k[b+1],k[b+2]),j.push(o)}}})(e);d.computeCentroids();d.computeFaceNormals();this.hasNormals(d)&&
|
|
|
d.computeTangents();b(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,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState==4)if(d.status==200||d.status==0)try{var e=JSON.parse(d.responseText);e.metadata===void 0||e.metadata.formatVersion===void 0||e.metadata.formatVersion!==3?console.error("Deprecated file format."):c.createScene(e,b,a)}catch(g){console.error(g),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,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function e(){var a;for(p in T.objects)if(!K.objects[p])if(t=T.objects[p],t.geometry!==void 0){if(F=K.geometries[t.geometry]){a=!1;for(H=0;H<t.materials.length;H++)E=K.materials[t.materials[H]],a=E instanceof THREE.ShaderMaterial;a&&F.computeTangents();v=t.position;A=t.rotation;z=t.quaternion;w=t.scale;z=0;E.length==0&&(E=new THREE.MeshFaceMaterial);E.length>1&&(E=new THREE.MeshFaceMaterial);
|
|
|
-a=new THREE.Mesh(F,E);a.name=p;a.position.set(v[0],v[1],v[2]);z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(A[0],A[1],A[2]);a.scale.set(w[0],w[1],w[2]);a.visible=t.visible;K.scene.add(a);K.objects[p]=a;if(t.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);K.scene.collisions.colliders.push(b)}if(t.castsShadow)b=new THREE.ShadowVolume(F),K.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;t.trigger&&t.trigger.toLowerCase()!="none"&&(b=
|
|
|
-{type:t.trigger,object:t},K.triggers[a.name]=b)}}else v=t.position,A=t.rotation,z=t.quaternion,w=t.scale,z=0,a=new THREE.Object3D,a.name=p,a.position.set(v[0],v[1],v[2]),z?(a.quaternion.set(z[0],z[1],z[2],z[3]),a.useQuaternion=!0):a.rotation.set(A[0],A[1],A[2]),a.scale.set(w[0],w[1],w[2]),a.visible=t.visible!==void 0?t.visible:!1,K.scene.add(a),K.objects[p]=a,K.empties[p]=a,t.trigger&&t.trigger.toLowerCase()!="none"&&(b={type:t.trigger,object:t},K.triggers[a.name]=b)}function g(a){return function(b){K.geometries[a]=
|
|
|
-b;e();Q-=1;i.onLoadComplete();h()}}function f(a){return function(b){K.geometries[a]=b}}function h(){i.callbackProgress({totalModels:$,totalTextures:ja,loadedModels:$-Q,loadedTextures:ja-U},K);i.onLoadProgress();Q==0&&U==0&&b(K)}var i=this,j=THREE.Loader.prototype.extractUrlbase(c),k,o,p,m,q,n,r,t,u,y,v,A,z,w,I,F,G,s,E,T,Z,Q,U,$,ja,K;T=a;c=new THREE.BinaryLoader;Z=new THREE.JSONLoader;U=Q=0;K={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
-empties:{}};a=!1;for(p in T.objects)if(t=T.objects[p],t.meshCollider){a=!0;break}if(a)K.scene.collisions=new THREE.CollisionSystem;if(T.transform){a=T.transform.position;u=T.transform.rotation;var L=T.transform.scale;a&&K.scene.position.set(a[0],a[1],a[2]);u&&K.scene.rotation.set(u[0],u[1],u[2]);L&&K.scene.scale.set(L[0],L[1],L[2]);(a||u||L)&&K.scene.updateMatrix()}a=function(){U-=1;h();i.onLoadComplete()};for(q in T.cameras)u=T.cameras[q],u.type=="perspective"?G=new THREE.PerspectiveCamera(u.fov,
|
|
|
-u.aspect,u.near,u.far):u.type=="ortho"&&(G=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far)),v=u.position,u=u.target,G.position.set(v[0],v[1],v[2]),G.target=new THREE.Vector3(u[0],u[1],u[2]),K.cameras[q]=G;for(m in T.lights)u=T.lights[m],q=u.color!==void 0?u.color:16777215,G=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(v=u.direction,y=new THREE.DirectionalLight(q,G),y.position.set(v[0],v[1],v[2]),y.position.normalize()):u.type=="point"?(v=u.position,y=u.distance,
|
|
|
-y=new THREE.PointLight(q,G,y),y.position.set(v[0],v[1],v[2])):u.type=="ambient"&&(y=new THREE.AmbientLight(q)),K.scene.add(y),K.lights[m]=y;for(n in T.fogs)m=T.fogs[n],m.type=="linear"?s=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(s=new THREE.FogExp2(0,m.density)),u=m.color,s.color.setRGB(u[0],u[1],u[2]),K.fogs[n]=s;if(K.cameras&&T.defaults.camera)K.currentCamera=K.cameras[T.defaults.camera];if(K.fogs&&T.defaults.fog)K.scene.fog=K.fogs[T.defaults.fog];u=T.defaults.bgcolor;K.bgColor=new THREE.Color;
|
|
|
-K.bgColor.setRGB(u[0],u[1],u[2]);K.bgColorAlpha=T.defaults.bgalpha;for(k in T.geometries)if(n=T.geometries[k],n.type=="bin_mesh"||n.type=="ascii_mesh")Q+=1,i.onLoadStart();$=Q;for(k in T.geometries)n=T.geometries[k],n.type=="cube"?(F=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),K.geometries[k]=F):n.type=="plane"?(F=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),K.geometries[k]=F):n.type=="sphere"?
|
|
|
-(F=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),K.geometries[k]=F):n.type=="cylinder"?(F=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),K.geometries[k]=F):n.type=="torus"?(F=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),K.geometries[k]=F):n.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(n.subdivisions),K.geometries[k]=F):n.type=="bin_mesh"?c.load(d(n.url,T.urlBaseType),g(k)):n.type=="ascii_mesh"?Z.load(d(n.url,T.urlBaseType),
|
|
|
-g(k)):n.type=="embedded_mesh"&&(n=T.embeds[n.id])&&Z.createModel(n,f(k),"");for(r in T.textures)if(k=T.textures[r],k.url instanceof Array){U+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else U+=1,i.onLoadStart();ja=U;for(r in T.textures){k=T.textures[r];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(var H=0;H<k.url.length;H++)n[H]=d(k.url[H],T.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,
|
|
|
-T.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){s={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(s[k.wrap[0]]!==void 0)n.wrapS=s[k.wrap[0]];if(s[k.wrap[1]]!==void 0)n.wrapT=
|
|
|
-s[k.wrap[1]]}}K.textures[r]=n}for(o in T.materials){r=T.materials[o];for(I in r.parameters)if(I=="envMap"||I=="map"||I=="lightMap")r.parameters[I]=K.textures[r.parameters[I]];else if(I=="shading")r.parameters[I]=r.parameters[I]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(I=="blending")r.parameters[I]=THREE[r.parameters[I]]?THREE[r.parameters[I]]:THREE.NormalBlending;else if(I=="combine")r.parameters[I]=r.parameters[I]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(I==
|
|
|
-"vertexColors")if(r.parameters[I]=="face")r.parameters[I]=THREE.FaceColors;else if(r.parameters[I])r.parameters[I]=THREE.VertexColors;if(r.parameters.opacity!==void 0&&r.parameters.opacity<1)r.parameters.transparent=!0;if(r.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);n=r.parameters.color;s=r.parameters.specular;c=r.parameters.ambient;Z=r.parameters.shininess;a.tNormal.texture=K.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=
|
|
|
-r.parameters.normalMapFactor;if(r.parameters.map)a.tDiffuse.texture=r.parameters.map,a.enableDiffuse.value=!0;if(r.parameters.lightMap)a.tAO.texture=r.parameters.lightMap,a.enableAO.value=!0;if(r.parameters.specularMap)a.tSpecular.texture=K.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(s);a.uAmbientColor.value.setHex(c);a.uShininess.value=Z;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;r=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
|
|
|
-vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else r=new THREE[r.type](r.parameters);K.materials[o]=r}e();i.callbackSync(K);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
+THREE.SceneLoader.prototype.createScene=function(a,b,c){function d(a,b){return b=="relativeToHTML"?a:j+"/"+a}function e(){var a;for(p in U.objects)if(!I.objects[p])if(t=U.objects[p],t.geometry!==void 0){if(F=I.geometries[t.geometry]){a=!1;for(C=0;C<t.materials.length;C++)N=I.materials[t.materials[C]],a=N instanceof THREE.ShaderMaterial;a&&F.computeTangents();w=t.position;z=t.rotation;A=t.quaternion;v=t.scale;A=0;N.length==0&&(N=new THREE.MeshFaceMaterial);N.length>1&&(N=new THREE.MeshFaceMaterial);
|
|
|
+a=new THREE.Mesh(F,N);a.name=p;a.position.set(w[0],w[1],w[2]);A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]);a.scale.set(v[0],v[1],v[2]);a.visible=t.visible;I.scene.add(a);I.objects[p]=a;if(t.meshCollider){var b=THREE.CollisionUtils.MeshColliderWBox(a);I.scene.collisions.colliders.push(b)}if(t.castsShadow)b=new THREE.ShadowVolume(F),I.scene.add(b),b.position=a.position,b.rotation=a.rotation,b.scale=a.scale;t.trigger&&t.trigger.toLowerCase()!="none"&&(b=
|
|
|
+{type:t.trigger,object:t},I.triggers[a.name]=b)}}else w=t.position,z=t.rotation,A=t.quaternion,v=t.scale,A=0,a=new THREE.Object3D,a.name=p,a.position.set(w[0],w[1],w[2]),A?(a.quaternion.set(A[0],A[1],A[2],A[3]),a.useQuaternion=!0):a.rotation.set(z[0],z[1],z[2]),a.scale.set(v[0],v[1],v[2]),a.visible=t.visible!==void 0?t.visible:!1,I.scene.add(a),I.objects[p]=a,I.empties[p]=a,t.trigger&&t.trigger.toLowerCase()!="none"&&(b={type:t.trigger,object:t},I.triggers[a.name]=b)}function g(a){return function(b){I.geometries[a]=
|
|
|
+b;e();R-=1;i.onLoadComplete();h()}}function f(a){return function(b){I.geometries[a]=b}}function h(){i.callbackProgress({totalModels:aa,totalTextures:ja,loadedModels:aa-R,loadedTextures:ja-V},I);i.onLoadProgress();R==0&&V==0&&b(I)}var i=this,j=THREE.Loader.prototype.extractUrlbase(c),k,o,p,m,q,n,r,t,u,y,w,z,A,v,G,F,K,s,N,U,$,R,V,aa,ja,I;U=a;c=new THREE.BinaryLoader;$=new THREE.JSONLoader;V=R=0;I={scene:new THREE.Scene,geometries:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},triggers:{},
|
|
|
+empties:{}};a=!1;for(p in U.objects)if(t=U.objects[p],t.meshCollider){a=!0;break}if(a)I.scene.collisions=new THREE.CollisionSystem;if(U.transform){a=U.transform.position;u=U.transform.rotation;var L=U.transform.scale;a&&I.scene.position.set(a[0],a[1],a[2]);u&&I.scene.rotation.set(u[0],u[1],u[2]);L&&I.scene.scale.set(L[0],L[1],L[2]);(a||u||L)&&I.scene.updateMatrix()}a=function(){V-=1;h();i.onLoadComplete()};for(q in U.cameras)u=U.cameras[q],u.type=="perspective"?K=new THREE.PerspectiveCamera(u.fov,
|
|
|
+u.aspect,u.near,u.far):u.type=="ortho"&&(K=new THREE.OrthographicCamera(u.left,u.right,u.top,u.bottom,u.near,u.far)),w=u.position,u=u.target,K.position.set(w[0],w[1],w[2]),K.target=new THREE.Vector3(u[0],u[1],u[2]),I.cameras[q]=K;for(m in U.lights)u=U.lights[m],q=u.color!==void 0?u.color:16777215,K=u.intensity!==void 0?u.intensity:1,u.type=="directional"?(w=u.direction,y=new THREE.DirectionalLight(q,K),y.position.set(w[0],w[1],w[2]),y.position.normalize()):u.type=="point"?(w=u.position,y=u.distance,
|
|
|
+y=new THREE.PointLight(q,K,y),y.position.set(w[0],w[1],w[2])):u.type=="ambient"&&(y=new THREE.AmbientLight(q)),I.scene.add(y),I.lights[m]=y;for(n in U.fogs)m=U.fogs[n],m.type=="linear"?s=new THREE.Fog(0,m.near,m.far):m.type=="exp2"&&(s=new THREE.FogExp2(0,m.density)),u=m.color,s.color.setRGB(u[0],u[1],u[2]),I.fogs[n]=s;if(I.cameras&&U.defaults.camera)I.currentCamera=I.cameras[U.defaults.camera];if(I.fogs&&U.defaults.fog)I.scene.fog=I.fogs[U.defaults.fog];u=U.defaults.bgcolor;I.bgColor=new THREE.Color;
|
|
|
+I.bgColor.setRGB(u[0],u[1],u[2]);I.bgColorAlpha=U.defaults.bgalpha;for(k in U.geometries)if(n=U.geometries[k],n.type=="bin_mesh"||n.type=="ascii_mesh")R+=1,i.onLoadStart();aa=R;for(k in U.geometries)n=U.geometries[k],n.type=="cube"?(F=new THREE.CubeGeometry(n.width,n.height,n.depth,n.segmentsWidth,n.segmentsHeight,n.segmentsDepth,null,n.flipped,n.sides),I.geometries[k]=F):n.type=="plane"?(F=new THREE.PlaneGeometry(n.width,n.height,n.segmentsWidth,n.segmentsHeight),I.geometries[k]=F):n.type=="sphere"?
|
|
|
+(F=new THREE.SphereGeometry(n.radius,n.segmentsWidth,n.segmentsHeight),I.geometries[k]=F):n.type=="cylinder"?(F=new THREE.CylinderGeometry(n.topRad,n.botRad,n.height,n.radSegs,n.heightSegs),I.geometries[k]=F):n.type=="torus"?(F=new THREE.TorusGeometry(n.radius,n.tube,n.segmentsR,n.segmentsT),I.geometries[k]=F):n.type=="icosahedron"?(F=new THREE.IcosahedronGeometry(n.subdivisions),I.geometries[k]=F):n.type=="bin_mesh"?c.load(d(n.url,U.urlBaseType),g(k)):n.type=="ascii_mesh"?$.load(d(n.url,U.urlBaseType),
|
|
|
+g(k)):n.type=="embedded_mesh"&&(n=U.embeds[n.id])&&$.createModel(n,f(k),"");for(r in U.textures)if(k=U.textures[r],k.url instanceof Array){V+=k.url.length;for(n=0;n<k.url.length;n++)i.onLoadStart()}else V+=1,i.onLoadStart();ja=V;for(r in U.textures){k=U.textures[r];if(k.mapping!=void 0&&THREE[k.mapping]!=void 0)k.mapping=new THREE[k.mapping];if(k.url instanceof Array){n=[];for(var C=0;C<k.url.length;C++)n[C]=d(k.url[C],U.urlBaseType);n=THREE.ImageUtils.loadTextureCube(n,k.mapping,a)}else{n=THREE.ImageUtils.loadTexture(d(k.url,
|
|
|
+U.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){s={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping};if(s[k.wrap[0]]!==void 0)n.wrapS=s[k.wrap[0]];if(s[k.wrap[1]]!==void 0)n.wrapT=
|
|
|
+s[k.wrap[1]]}}I.textures[r]=n}for(o in U.materials){r=U.materials[o];for(G in r.parameters)if(G=="envMap"||G=="map"||G=="lightMap")r.parameters[G]=I.textures[r.parameters[G]];else if(G=="shading")r.parameters[G]=r.parameters[G]=="flat"?THREE.FlatShading:THREE.SmoothShading;else if(G=="blending")r.parameters[G]=THREE[r.parameters[G]]?THREE[r.parameters[G]]:THREE.NormalBlending;else if(G=="combine")r.parameters[G]=r.parameters[G]=="MixOperation"?THREE.MixOperation:THREE.MultiplyOperation;else if(G==
|
|
|
+"vertexColors")if(r.parameters[G]=="face")r.parameters[G]=THREE.FaceColors;else if(r.parameters[G])r.parameters[G]=THREE.VertexColors;if(r.parameters.opacity!==void 0&&r.parameters.opacity<1)r.parameters.transparent=!0;if(r.parameters.normalMap){k=THREE.ShaderUtils.lib.normal;a=THREE.UniformsUtils.clone(k.uniforms);n=r.parameters.color;s=r.parameters.specular;c=r.parameters.ambient;$=r.parameters.shininess;a.tNormal.texture=I.textures[r.parameters.normalMap];if(r.parameters.normalMapFactor)a.uNormalScale.value=
|
|
|
+r.parameters.normalMapFactor;if(r.parameters.map)a.tDiffuse.texture=r.parameters.map,a.enableDiffuse.value=!0;if(r.parameters.lightMap)a.tAO.texture=r.parameters.lightMap,a.enableAO.value=!0;if(r.parameters.specularMap)a.tSpecular.texture=I.textures[r.parameters.specularMap],a.enableSpecular.value=!0;a.uDiffuseColor.value.setHex(n);a.uSpecularColor.value.setHex(s);a.uAmbientColor.value.setHex(c);a.uShininess.value=$;if(r.parameters.opacity)a.uOpacity.value=r.parameters.opacity;r=new THREE.ShaderMaterial({fragmentShader:k.fragmentShader,
|
|
|
+vertexShader:k.vertexShader,uniforms:a,lights:!0,fog:!0})}else r=new THREE[r.type](r.parameters);I.materials[o]=r}e();i.callbackSync(I);h()};THREE.UTF8Loader=function(){};THREE.UTF8Loader.prototype=new THREE.UTF8Loader;THREE.UTF8Loader.prototype.constructor=THREE.UTF8Loader;
|
|
|
THREE.UTF8Loader.prototype.load=function(a,b,c){if(a instanceof Object)console.warn("DEPRECATED: UTF8Loader( parameters ) is now UTF8Loader( url, callback, metaData )."),c=a,a=c.model,b=c.callback,c={scale:c.scale,offsetX:c.offsetX,offsetY:c.offsetY,offsetZ:c.offsetZ};var d=new XMLHttpRequest,e=c.scale!==void 0?c.scale:1,g=c.offsetX!==void 0?c.offsetX:0,f=c.offsetY!==void 0?c.offsetY:0,h=c.offsetZ!==void 0?c.offsetZ:0;d.onreadystatechange=function(){d.readyState==4?d.status==200||d.status==0?THREE.UTF8Loader.prototype.createModel(d.responseText,
|
|
|
b,e,g,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 b=a.charCodeAt(0);b>=57344&&(b-=2048);b++;for(var c=new Float32Array(8*b),d=1,e=0;e<8;e++){for(var g=0,f=0;f<b;++f){var h=a.charCodeAt(f+d);g+=h>>1^-(h&1);c[8*f+e]=g}d+=b}b=a.length-d;g=new Uint16Array(b);for(e=f=0;e<b;e++)h=a.charCodeAt(e+d),g[e]=f-h,h==0&&f++;return[c,g]};
|
|
|
THREE.UTF8Loader.prototype.createModel=function(a,b,c,d,e,g){var f=function(){var b=this;b.materials=[];THREE.Geometry.call(this);var f=THREE.UTF8Loader.prototype.decompressMesh(a),j=[],k=[];(function(a,f,i){for(var j,k,r,t=a.length;i<t;i+=f)j=a[i],k=a[i+1],r=a[i+2],j=j/16383*c,k=k/16383*c,r=r/16383*c,j+=d,k+=e,r+=g,b.vertices.push(new THREE.Vertex(new THREE.Vector3(j,k,r)))})(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,j.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,u,y,v,A=a.length;for(c=0;c<A;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;y=d;v=e;i=f;u=d;var z=e,w=f,I=g.materials[0],F=j[z*3],G=j[z*3+1],z=j[z*3+2],s=j[w*3],E=j[w*3+1],w=j[w*3+2];u=new THREE.Vector3(j[u*3],j[u*3+1],j[u*3+2]);z=new THREE.Vector3(F,G,z);w=new THREE.Vector3(s,E,w);g.faces.push(new THREE.Face3(y,v,i,[u,z,w],null,I));g=k[d*2];d=k[d*2+
|
|
|
-1];i=k[e*2];u=k[e*2+1];y=k[f*2];v=k[f*2+1];f=b.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(y,v));f.push(u)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(new f)};
|
|
|
+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,j.push(d,e,f)})(f[0],8,5);(function(a){var c,d,e,f,g,i,u,y,w,z=a.length;for(c=0;c<z;c+=3){d=a[c];e=a[c+1];f=a[c+2];g=b;y=d;w=e;i=f;u=d;var A=e,v=f,G=g.materials[0],F=j[A*3],K=j[A*3+1],A=j[A*3+2],s=j[v*3],N=j[v*3+1],v=j[v*3+2];u=new THREE.Vector3(j[u*3],j[u*3+1],j[u*3+2]);A=new THREE.Vector3(F,K,A);v=new THREE.Vector3(s,N,v);g.faces.push(new THREE.Face3(y,w,i,[u,A,v],null,G));g=k[d*2];d=k[d*2+
|
|
|
+1];i=k[e*2];u=k[e*2+1];y=k[f*2];w=k[f*2+1];f=b.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(y,w));f.push(u)}})(f[1]);this.computeCentroids();this.computeFaceNormals()};f.prototype=new THREE.Geometry;f.prototype.constructor=f;b(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 b=new THREE.CylinderGeometry(0,5,25,5,1),c=new THREE.Line(a,new THREE.LineBasicMaterial({color:16711680}));c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:16711680}));c.position.x=100;c.rotation.z=-Math.PI/2;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:65280}));this.add(c);
|
|
|
c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:65280}));c.position.y=100;this.add(c);c=new THREE.Line(a,new THREE.LineBasicMaterial({color:255}));c.rotation.x=Math.PI/2;this.add(c);c=new THREE.Mesh(b,new THREE.MeshBasicMaterial({color:255}));c.position.z=100;c.rotation.x=Math.PI/2;this.add(c)};THREE.Axes.prototype=new THREE.Object3D;THREE.Axes.prototype.constructor=THREE.Axes;
|
|
|
THREE.MarchingCubes=function(a,b){THREE.Object3D.call(this);this.material=b;this.init=function(a){this.resolution=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,b,e){return a+(b-a)*e};this.VIntX=function(a,b,e,g,f,h,i,j,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h+f*this.delta;b[g+1]=i;b[g+2]=j;e[g]=this.lerp(k[a],k[a+3],f);e[g+1]=this.lerp(k[a+1],k[a+4],f);e[g+2]=this.lerp(k[a+2],k[a+5],f)};this.VIntY=function(a,b,e,g,f,h,i,j,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h;b[g+1]=i+f*this.delta;b[g+2]=j;b=a+this.yd*
|
|
|
3;e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.VIntZ=function(a,b,e,g,f,h,i,j,k,o){f=(f-k)/(o-k);k=this.normal_cache;b[g]=h;b[g+1]=i;b[g+2]=j+f*this.delta;b=a+this.zd*3;e[g]=this.lerp(k[a],k[b],f);e[g+1]=this.lerp(k[a+1],k[b+1],f);e[g+2]=this.lerp(k[a+2],k[b+2],f)};this.compNorm=function(a){var b=a*3;this.normal_cache[b]===0&&(this.normal_cache[b]=this.field[a-1]-this.field[a+1],this.normal_cache[b+1]=this.field[a-this.yd]-this.field[a+this.yd],
|
|
|
-this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,j=g+this.yd,k=g+this.zd,o=i+this.yd,p=i+this.zd,m=g+this.yd+this.zd,q=i+this.yd+this.zd,n=0,r=this.field[g],t=this.field[i],u=this.field[j],y=this.field[o],v=this.field[k],A=this.field[p],z=this.field[m],w=this.field[q];r<f&&(n|=1);t<f&&(n|=2);u<f&&(n|=8);y<f&&(n|=4);v<f&&(n|=16);A<f&&(n|=32);z<f&&(n|=128);w<f&&(n|=64);var I=THREE.edgeTable[n];if(I===0)return 0;var F=this.delta,G=a+
|
|
|
-F,s=b+F,F=e+F;I&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,r,t));I&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,G,b,e,t,y));I&4&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,6,f,a,s,e,u,y));I&8&&(this.compNorm(g),this.compNorm(j),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,r,u));I&16&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,12,f,a,b,F,v,A));I&32&&(this.compNorm(p),
|
|
|
-this.compNorm(q),this.VIntY(p*3,this.vlist,this.nlist,15,f,G,b,F,A,w));I&64&&(this.compNorm(m),this.compNorm(q),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,s,F,z,w));I&128&&(this.compNorm(k),this.compNorm(m),this.VIntY(k*3,this.vlist,this.nlist,21,f,a,b,F,v,z));I&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,r,v));I&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(i*3,this.vlist,this.nlist,27,f,G,b,e,t,A));I&1024&&(this.compNorm(o),this.compNorm(q),this.VIntZ(o*
|
|
|
-3,this.vlist,this.nlist,30,f,G,s,e,y,w));I&2048&&(this.compNorm(j),this.compNorm(m),this.VIntZ(j*3,this.vlist,this.nlist,33,f,a,s,e,u,z));n<<=4;for(f=g=0;THREE.triTable[n+f]!=-1;)a=n+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
|
|
|
+this.normal_cache[b+2]=this.field[a-this.zd]-this.field[a+this.zd])};this.polygonize=function(a,b,e,g,f,h){var i=g+1,j=g+this.yd,k=g+this.zd,o=i+this.yd,p=i+this.zd,m=g+this.yd+this.zd,q=i+this.yd+this.zd,n=0,r=this.field[g],t=this.field[i],u=this.field[j],y=this.field[o],w=this.field[k],z=this.field[p],A=this.field[m],v=this.field[q];r<f&&(n|=1);t<f&&(n|=2);u<f&&(n|=8);y<f&&(n|=4);w<f&&(n|=16);z<f&&(n|=32);A<f&&(n|=128);v<f&&(n|=64);var G=THREE.edgeTable[n];if(G===0)return 0;var F=this.delta,K=a+
|
|
|
+F,s=b+F,F=e+F;G&1&&(this.compNorm(g),this.compNorm(i),this.VIntX(g*3,this.vlist,this.nlist,0,f,a,b,e,r,t));G&2&&(this.compNorm(i),this.compNorm(o),this.VIntY(i*3,this.vlist,this.nlist,3,f,K,b,e,t,y));G&4&&(this.compNorm(j),this.compNorm(o),this.VIntX(j*3,this.vlist,this.nlist,6,f,a,s,e,u,y));G&8&&(this.compNorm(g),this.compNorm(j),this.VIntY(g*3,this.vlist,this.nlist,9,f,a,b,e,r,u));G&16&&(this.compNorm(k),this.compNorm(p),this.VIntX(k*3,this.vlist,this.nlist,12,f,a,b,F,w,z));G&32&&(this.compNorm(p),
|
|
|
+this.compNorm(q),this.VIntY(p*3,this.vlist,this.nlist,15,f,K,b,F,z,v));G&64&&(this.compNorm(m),this.compNorm(q),this.VIntX(m*3,this.vlist,this.nlist,18,f,a,s,F,A,v));G&128&&(this.compNorm(k),this.compNorm(m),this.VIntY(k*3,this.vlist,this.nlist,21,f,a,b,F,w,A));G&256&&(this.compNorm(g),this.compNorm(k),this.VIntZ(g*3,this.vlist,this.nlist,24,f,a,b,e,r,w));G&512&&(this.compNorm(i),this.compNorm(p),this.VIntZ(i*3,this.vlist,this.nlist,27,f,K,b,e,t,z));G&1024&&(this.compNorm(o),this.compNorm(q),this.VIntZ(o*
|
|
|
+3,this.vlist,this.nlist,30,f,K,s,e,y,v));G&2048&&(this.compNorm(j),this.compNorm(m),this.VIntZ(j*3,this.vlist,this.nlist,33,f,a,s,e,u,A));n<<=4;for(f=g=0;THREE.triTable[n+f]!=-1;)a=n+f,b=a+1,e=a+2,this.posnormtriv(this.vlist,this.nlist,3*THREE.triTable[a],3*THREE.triTable[b],3*THREE.triTable[e],h),f+=3,g++;return g};this.posnormtriv=function(a,b,e,g,f,h){var i=this.count*3;this.positionArray[i]=a[e];this.positionArray[i+1]=a[e+1];this.positionArray[i+2]=a[e+2];this.positionArray[i+3]=a[g];this.positionArray[i+
|
|
|
4]=a[g+1];this.positionArray[i+5]=a[g+2];this.positionArray[i+6]=a[f];this.positionArray[i+7]=a[f+1];this.positionArray[i+8]=a[f+2];this.normalArray[i]=b[e];this.normalArray[i+1]=b[e+1];this.normalArray[i+2]=b[e+2];this.normalArray[i+3]=b[g];this.normalArray[i+4]=b[g+1];this.normalArray[i+5]=b[g+2];this.normalArray[i+6]=b[f];this.normalArray[i+7]=b[f+1];this.normalArray[i+8]=b[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 b=this.count*3;b<this.positionArray.length;b++)this.positionArray[b]=0;a(this)}};this.addBall=function(a,b,e,g,f){var h=this.size*Math.sqrt(g/f),i=e*this.size,j=b*this.size,k=a*this.size,o=Math.floor(i-h);o<1&&(o=1);i=Math.floor(i+h);i>this.size-1&&(i=this.size-1);var p=Math.floor(j-h);p<1&&(p=1);j=Math.floor(j+h);j>this.size-1&&(j=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 q,n,r,t,u,y;o<i;o++){k=this.size2*o;n=o/this.size-e;u=n*n;for(n=p;n<j;n++){r=k+this.size*n;q=n/this.size-b;y=q*q;for(q=m;q<h;q++)t=q/this.size-a,t=g/(1.0E-6+t*t+y+u)-f,t>0&&(this.field[r+q]+=t)}}};this.addPlaneX=function(a,b){var e,g,f,h,i,j=this.size,k=this.yd,o=this.zd,p=this.field,m=j*Math.sqrt(a/b);m>j&&(m=j);for(e=0;e<m;e++)if(g=e/j,g*=g,h=a/(1.0E-4+g)-b,h>0)for(g=0;g<j;g++){i=e+g*k;for(f=0;f<j;f++)p[o*f+i]+=h}};this.addPlaneY=function(a,b){var e,g,f,h,i,j,k=this.size,o=this.yd,p=
|
|
@@ -698,24 +698,24 @@ d.vertices[e++]=1;d.vertices[e++]=-1;d.vertices[e++]=1;d.vertices[e++]=0;d.verti
|
|
|
d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);d.tempTexture=b.createTexture();d.occlusionTexture=b.createTexture();b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGB,16,16,0,b.RGB,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);
|
|
|
b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.texImage2D(b.TEXTURE_2D,0,b.RGBA,16,16,0,b.RGBA,b.UNSIGNED_BYTE,null);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,b.CLAMP_TO_EDGE);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,b.NEAREST);b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,b.NEAREST);b.getParameter(b.MAX_VERTEX_TEXTURE_IMAGE_UNITS)<=0?(d.hasVertexTexture=!1,d.program=a(THREE.ShaderFlares.lensFlare)):(d.hasVertexTexture=
|
|
|
!0,d.program=a(THREE.ShaderFlares.lensFlareVertexTexture));d.attributes={};d.uniforms={};d.attributes.vertex=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.renderType=b.getUniformLocation(d.program,"renderType");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.occlusionMap=b.getUniformLocation(d.program,"occlusionMap");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.color=b.getUniformLocation(d.program,
|
|
|
-"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i,j,k=a.length,o,p,m,q=new THREE.Vector3,n=h/f,r=f*0.5,t=h*0.5,u=16/h,y=new THREE.Vector2(u*n,u),v=new THREE.Vector3(1,1,0),A=new THREE.Vector2(1,1),z=d.uniforms;i=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
|
|
|
-b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(z.occlusionMap,0);b.uniform1i(z.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(i.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(i.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);for(j=0;j<k;j++)if(u=16/h,y.set(u*n,u),i=a[j],q.set(i.matrixWorld.n14,i.matrixWorld.n24,i.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(q),g.projectionMatrix.multiplyVector3(q),
|
|
|
-v.copy(q),A.x=v.x*r+r,A.y=v.y*t+t,d.hasVertexTexture||A.x>0&&A.x<f&&A.y>0&&A.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,A.x-8,A.y-8,16,16,0);b.uniform1i(z.renderType,0);b.uniform2f(z.scale,y.x,y.y);b.uniform3f(z.screenPosition,v.x,v.y,v.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);b.copyTexImage2D(b.TEXTURE_2D,
|
|
|
-0,b.RGBA,A.x-8,A.y-8,16,16,0);b.uniform1i(z.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);i.positionScreen.copy(v);i.customUpdateCallback?i.customUpdateCallback(i):i.updateLensFlares();b.uniform1i(z.renderType,2);b.enable(b.BLEND);o=0;for(p=i.lensFlares.length;o<p;o++)if(m=i.lensFlares[o],m.opacity>0.0010&&m.scale>0.0010)v.x=m.x,v.y=m.y,v.z=m.z,u=m.size*m.scale/h,y.x=u*n,y.y=u,b.uniform3f(z.screenPosition,
|
|
|
-v.x,v.y,v.z),b.uniform2f(z.scale,y.x,y.y),b.uniform1f(z.rotation,m.rotation),b.uniform1f(z.opacity,m.opacity),b.uniform3f(z.color,m.color.r,m.color.g,m.color.b),c.setBlending(m.blending),c.setTexture(m.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}};
|
|
|
+"color");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.attributesEnabled=!1};this.render=function(a,g,f,h){var a=a.__webglFlares,i=a.length;if(i){var j=new THREE.Vector3,k=h/f,o=f*0.5,p=h*0.5,m=16/h,q=new THREE.Vector2(m*k,m),n=new THREE.Vector3(1,1,0),r=new THREE.Vector2(1,1),t=d.uniforms,m=d.attributes;b.useProgram(d.program);if(!d.attributesEnabled)b.enableVertexAttribArray(d.attributes.vertex),
|
|
|
+b.enableVertexAttribArray(d.attributes.uv),d.attributesEnabled=!0;b.uniform1i(t.occlusionMap,0);b.uniform1i(t.map,1);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(m.vertex,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(m.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.disable(b.CULL_FACE);b.depthMask(!1);var u,y,w,z,A;for(u=0;u<i;u++)if(m=16/h,q.set(m*k,m),z=a[u],j.set(z.matrixWorld.n14,z.matrixWorld.n24,z.matrixWorld.n34),g.matrixWorldInverse.multiplyVector3(j),
|
|
|
+g.projectionMatrix.multiplyVector3(j),n.copy(j),r.x=n.x*o+o,r.y=n.y*p+p,d.hasVertexTexture||r.x>0&&r.x<f&&r.y>0&&r.y<h){b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.copyTexImage2D(b.TEXTURE_2D,0,b.RGB,r.x-8,r.y-8,16,16,0);b.uniform1i(t.renderType,0);b.uniform2f(t.scale,q.x,q.y);b.uniform3f(t.screenPosition,n.x,n.y,n.z);b.disable(b.BLEND);b.enable(b.DEPTH_TEST);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);b.activeTexture(b.TEXTURE0);b.bindTexture(b.TEXTURE_2D,d.occlusionTexture);
|
|
|
+b.copyTexImage2D(b.TEXTURE_2D,0,b.RGBA,r.x-8,r.y-8,16,16,0);b.uniform1i(t.renderType,1);b.disable(b.DEPTH_TEST);b.activeTexture(b.TEXTURE1);b.bindTexture(b.TEXTURE_2D,d.tempTexture);b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0);z.positionScreen.copy(n);z.customUpdateCallback?z.customUpdateCallback(z):z.updateLensFlares();b.uniform1i(t.renderType,2);b.enable(b.BLEND);y=0;for(w=z.lensFlares.length;y<w;y++)if(A=z.lensFlares[y],A.opacity>0.0010&&A.scale>0.0010)n.x=A.x,n.y=A.y,n.z=A.z,m=A.size*A.scale/
|
|
|
+h,q.x=m*k,q.y=m,b.uniform3f(t.screenPosition,n.x,n.y,n.z),b.uniform2f(t.scale,q.x,q.y),b.uniform1f(t.rotation,A.rotation),b.uniform1f(t.opacity,A.opacity),b.uniform3f(t.color,A.color.r,A.color.g,A.color.b),c.setBlending(A.blending),c.setTexture(A.texture,1),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0)}b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}}};
|
|
|
THREE.SpritePlugin=function(){function a(a,b){return b.z-a.z}var b,c,d={};this.init=function(a){b=a.context;c=a;d.vertices=new Float32Array(16);d.faces=new Uint16Array(6);a=0;d.vertices[a++]=-1;d.vertices[a++]=-1;d.vertices[a++]=0;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=1;d.vertices[a++]=0;d.vertices[a++]=-1;d.vertices[a++]=1;d.vertices[a++]=0;a=d.vertices[a++]=0;d.faces[a++]=0;d.faces[a++]=1;d.faces[a++]=
|
|
|
2;d.faces[a++]=0;d.faces[a++]=2;d.faces[a++]=3;d.vertexBuffer=b.createBuffer();d.elementBuffer=b.createBuffer();b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.bufferData(b.ARRAY_BUFFER,d.vertices,b.STATIC_DRAW);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.bufferData(b.ELEMENT_ARRAY_BUFFER,d.faces,b.STATIC_DRAW);var a=THREE.ShaderSprite.sprite,g=b.createProgram(),f=b.createShader(b.FRAGMENT_SHADER),h=b.createShader(b.VERTEX_SHADER);b.shaderSource(f,a.fragmentShader);b.shaderSource(h,a.vertexShader);
|
|
|
b.compileShader(f);b.compileShader(h);b.attachShader(g,f);b.attachShader(g,h);b.linkProgram(g);d.program=g;d.attributes={};d.uniforms={};d.attributes.position=b.getAttribLocation(d.program,"position");d.attributes.uv=b.getAttribLocation(d.program,"uv");d.uniforms.uvOffset=b.getUniformLocation(d.program,"uvOffset");d.uniforms.uvScale=b.getUniformLocation(d.program,"uvScale");d.uniforms.rotation=b.getUniformLocation(d.program,"rotation");d.uniforms.scale=b.getUniformLocation(d.program,"scale");d.uniforms.alignment=
|
|
|
b.getUniformLocation(d.program,"alignment");d.uniforms.color=b.getUniformLocation(d.program,"color");d.uniforms.map=b.getUniformLocation(d.program,"map");d.uniforms.opacity=b.getUniformLocation(d.program,"opacity");d.uniforms.useScreenCoordinates=b.getUniformLocation(d.program,"useScreenCoordinates");d.uniforms.affectedByDistance=b.getUniformLocation(d.program,"affectedByDistance");d.uniforms.screenPosition=b.getUniformLocation(d.program,"screenPosition");d.uniforms.modelViewMatrix=b.getUniformLocation(d.program,
|
|
|
-"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h,i){var j,k;j=d.attributes;var o=d.uniforms,p=h/f,m=[];f*=0.5;var q=h*0.5,n=!0;b.useProgram(d.program);_currentProgram=d.program;if(!d.attributesEnabled)b.enableVertexAttribArray(j.position),b.enableVertexAttribArray(j.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,d.vertexBuffer);b.vertexAttribPointer(j.position,
|
|
|
-2,b.FLOAT,!1,16,0);b.vertexAttribPointer(j.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(o.projectionMatrix,!1,i);b.activeTexture(b.TEXTURE0);b.uniform1i(o.map,0);i=0;for(j=e.__webglSprites.length;i<j;i++)if(k=e.__webglSprites[i],k.visible&&k.opacity!==0)k.useScreenCoordinates?k.z=-k.position.z:(k._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray),k.z=-k._modelViewMatrix.n34);e.__webglSprites.sort(a);i=0;for(j=
|
|
|
-e.__webglSprites.length;i<j;i++)k=e.__webglSprites[i],k.visible&&k.opacity!==0&&k.map&&k.map.image&&k.map.image.width&&(k.useScreenCoordinates?(b.uniform1i(o.useScreenCoordinates,1),b.uniform3f(o.screenPosition,(k.position.x-f)/f,(q-k.position.y)/q,Math.max(0,Math.min(1,k.position.z)))):(b.uniform1i(o.useScreenCoordinates,0),b.uniform1i(o.affectedByDistance,k.affectedByDistance?1:0),b.uniformMatrix4fv(o.modelViewMatrix,!1,k._modelViewMatrixArray)),g=k.map.image.width/(k.scaleByViewport?h:1),m[0]=
|
|
|
-g*p*k.scale.x,m[1]=g*k.scale.y,b.uniform2f(o.uvScale,k.uvScale.x,k.uvScale.y),b.uniform2f(o.uvOffset,k.uvOffset.x,k.uvOffset.y),b.uniform2f(o.alignment,k.alignment.x,k.alignment.y),b.uniform1f(o.opacity,k.opacity),b.uniform3f(o.color,k.color.r,k.color.g,k.color.b),b.uniform1f(o.rotation,k.rotation),b.uniform2fv(o.scale,m),k.mergeWith3D&&!n?(b.enable(b.DEPTH_TEST),n=!0):!k.mergeWith3D&&n&&(b.disable(b.DEPTH_TEST),n=!1),c.setBlending(k.blending),c.setTexture(k.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,
|
|
|
-0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);b.depthMask(!0)}};
|
|
|
+"modelViewMatrix");d.uniforms.projectionMatrix=b.getUniformLocation(d.program,"projectionMatrix");d.attributesEnabled=!1};this.render=function(e,g,f,h,i){var e=e.__webglSprites,j=e.length;if(j){var k=d.attributes,o=d.uniforms,p=h/f;f*=0.5;var m=h*0.5,q=!0;b.useProgram(d.program);_currentProgram=d.program;if(!d.attributesEnabled)b.enableVertexAttribArray(k.position),b.enableVertexAttribArray(k.uv),d.attributesEnabled=!0;b.disable(b.CULL_FACE);b.enable(b.BLEND);b.depthMask(!0);b.bindBuffer(b.ARRAY_BUFFER,
|
|
|
+d.vertexBuffer);b.vertexAttribPointer(k.position,2,b.FLOAT,!1,16,0);b.vertexAttribPointer(k.uv,2,b.FLOAT,!1,16,8);b.bindBuffer(b.ELEMENT_ARRAY_BUFFER,d.elementBuffer);b.uniformMatrix4fv(o.projectionMatrix,!1,i);b.activeTexture(b.TEXTURE0);b.uniform1i(o.map,0);for(var n=[],i=0;i<j;i++)if(k=e[i],k.visible&&k.opacity!==0)k.useScreenCoordinates?k.z=-k.position.z:(k._modelViewMatrix.multiplyToArray(g.matrixWorldInverse,k.matrixWorld,k._modelViewMatrixArray),k.z=-k._modelViewMatrix.n34);e.sort(a);for(i=
|
|
|
+0;i<j;i++)k=e[i],k.visible&&k.opacity!==0&&k.map&&k.map.image&&k.map.image.width&&(k.useScreenCoordinates?(b.uniform1i(o.useScreenCoordinates,1),b.uniform3f(o.screenPosition,(k.position.x-f)/f,(m-k.position.y)/m,Math.max(0,Math.min(1,k.position.z)))):(b.uniform1i(o.useScreenCoordinates,0),b.uniform1i(o.affectedByDistance,k.affectedByDistance?1:0),b.uniformMatrix4fv(o.modelViewMatrix,!1,k._modelViewMatrixArray)),g=k.map.image.width/(k.scaleByViewport?h:1),n[0]=g*p*k.scale.x,n[1]=g*k.scale.y,b.uniform2f(o.uvScale,
|
|
|
+k.uvScale.x,k.uvScale.y),b.uniform2f(o.uvOffset,k.uvOffset.x,k.uvOffset.y),b.uniform2f(o.alignment,k.alignment.x,k.alignment.y),b.uniform1f(o.opacity,k.opacity),b.uniform3f(o.color,k.color.r,k.color.g,k.color.b),b.uniform1f(o.rotation,k.rotation),b.uniform2fv(o.scale,n),k.mergeWith3D&&!q?(b.enable(b.DEPTH_TEST),q=!0):!k.mergeWith3D&&q&&(b.disable(b.DEPTH_TEST),q=!1),c.setBlending(k.blending),c.setTexture(k.map,0),b.drawElements(b.TRIANGLES,6,b.UNSIGNED_SHORT,0));b.enable(b.CULL_FACE);b.enable(b.DEPTH_TEST);
|
|
|
+b.depthMask(!0)}}};
|
|
|
if(THREE.WebGLRenderer)THREE.AnaglyphWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoUpdateScene=!1;var b=this,c=this.setSize,d=this.render,e=new THREE.PerspectiveCamera,g=new THREE.PerspectiveCamera,f=new THREE.Matrix4,h=new THREE.Matrix4,i,j,k,o;e.matrixAutoUpdate=g.matrixAutoUpdate=!1;var a={minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat},p=new THREE.WebGLRenderTarget(512,512,a),m=new THREE.WebGLRenderTarget(512,512,a),q=new THREE.PerspectiveCamera(53,
|
|
|
1,1,1E4);q.position.z=2;var a=new THREE.ShaderMaterial({uniforms:{mapLeft:{type:"t",value:0,texture:p},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(q);this.setSize=function(a,d){c.call(b,a,d);p.width=a;p.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||o!==c.fov){i=c.aspect;j=c.near;k=c.far;o=c.fov;var u=c.projectionMatrix.clone(),y=125/30*0.5,v=y*j/125,A=j*Math.tan(o*Math.PI/360),z;f.n14=y;h.n14=-y;y=-A*i+v;z=A*i+v;u.n11=2*j/(z-y);u.n13=(z+y)/(z-y);e.projectionMatrix.copy(u);y=-A*i-v;z=A*i-v;u.n11=
|
|
|
-2*j/(z-y);u.n13=(z+y)/(z-y);g.projectionMatrix.copy(u)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,p,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,m,!0);n.updateMatrixWorld();d.call(b,n,q)}};
|
|
|
+n=new THREE.Scene;n.add(new THREE.Mesh(new THREE.PlaneGeometry(2,2),a));n.add(q);this.setSize=function(a,d){c.call(b,a,d);p.width=a;p.height=d;m.width=a;m.height=d};this.render=function(a,c){a.updateMatrixWorld();if(i!==c.aspect||j!==c.near||k!==c.far||o!==c.fov){i=c.aspect;j=c.near;k=c.far;o=c.fov;var u=c.projectionMatrix.clone(),y=125/30*0.5,w=y*j/125,z=j*Math.tan(o*Math.PI/360),A;f.n14=y;h.n14=-y;y=-z*i+w;A=z*i+w;u.n11=2*j/(A-y);u.n13=(A+y)/(A-y);e.projectionMatrix.copy(u);y=-z*i-w;A=z*i-w;u.n11=
|
|
|
+2*j/(A-y);u.n13=(A+y)/(A-y);g.projectionMatrix.copy(u)}e.matrixWorld.copy(c.matrixWorld).multiplySelf(h);e.position.copy(c.position);e.near=c.near;e.far=c.far;d.call(b,a,e,p,!0);g.matrixWorld.copy(c.matrixWorld).multiplySelf(f);g.position.copy(c.position);g.near=c.near;g.far=c.far;d.call(b,a,g,m,!0);n.updateMatrixWorld();d.call(b,n,q)}};
|
|
|
if(THREE.WebGLRenderer)THREE.CrosseyedWebGLRenderer=function(a){THREE.WebGLRenderer.call(this,a);this.autoClear=!1;var b=this,c=this.setSize,d=this.render,e,g,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);b.separation=10;if(a&&a.separation!==void 0)b.separation=a.separation;this.setSize=function(a,d){c.call(b,a,d);e=a/2;g=d};this.render=function(a,c){this.clear();f.fov=c.fov;f.aspect=0.5*c.aspect;f.near=c.near;f.far=
|
|
|
c.far;f.updateProjectionMatrix();f.position.copy(c.position);f.target.copy(c.target);f.translateX(b.separation);f.lookAt(f.target);h.projectionMatrix=f.projectionMatrix;h.position.copy(c.position);h.target.copy(c.target);h.translateX(-b.separation);h.lookAt(h.target);this.setViewport(0,0,e,g);d.call(b,a,f);this.setViewport(e,0,e,g);d.call(b,a,h,!1)}};
|
|
|
THREE.ShaderFlares={lensFlareVertexTexture:{vertexShader:"uniform vec3 screenPosition;\nuniform vec2 scale;\nuniform float rotation;\nuniform int renderType;\nuniform sampler2D occlusionMap;\nattribute vec2 position;\nattribute vec2 uv;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nvUV = uv;\nvec2 pos = position;\nif( renderType == 2 ) {\nvec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.1 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.9, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.9 ) ) +\ntexture2D( occlusionMap, vec2( 0.1, 0.5 ) ) +\ntexture2D( occlusionMap, vec2( 0.5, 0.5 ) );\nvVisibility = ( visibility.r / 9.0 ) *\n( 1.0 - visibility.g / 9.0 ) *\n( visibility.b / 9.0 ) *\n( 1.0 - visibility.a / 9.0 );\npos.x = cos( rotation ) * position.x - sin( rotation ) * position.y;\npos.y = sin( rotation ) * position.x + cos( rotation ) * position.y;\n}\ngl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );\n}",fragmentShader:"#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D map;\nuniform float opacity;\nuniform int renderType;\nuniform vec3 color;\nvarying vec2 vUV;\nvarying float vVisibility;\nvoid main() {\nif( renderType == 0 ) {\ngl_FragColor = vec4( 1.0, 0.0, 1.0, 0.0 );\n} else if( renderType == 1 ) {\ngl_FragColor = texture2D( map, vUV );\n} else {\nvec4 texture = texture2D( map, vUV );\ntexture.a *= opacity * vVisibility;\ngl_FragColor = texture;\ngl_FragColor.rgb *= color;\n}\n}"},
|